id
stringlengths
25
25
content
stringlengths
649
72.1k
max_stars_repo_path
stringlengths
91
133
d2a_code_trace_data_43154
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_exp.c:730: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_div`. Showing all 13 steps of the trace crypto/bn/bn_exp.c:625:1: Parameter `ctx->stack.depth` 623. * http://www.daemonology.net/hyperthreading-considered-harmful/) 624. */ 625. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 626. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 627. { crypto/bn/bn_exp.c:659:2: Call 657. } 658. 659. BN_CTX_start(ctx); ^ 660. 661. /* Allocate a montgomery context if it was not supplied by the caller. crypto/bn/bn_ctx.c:257:1: Parameter `ctx->stack.depth` 255. } 256. 257. > void BN_CTX_start(BN_CTX *ctx) 258. { 259. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_exp.c:730:8: Call 728. if (a->neg || BN_ucmp(a,m) >= 0) 729. { 730. if (!BN_mod(&am,a,m,ctx)) goto err; ^ 731. if (!BN_to_montgomery(&am,&am,mont,ctx)) goto err; 732. } crypto/bn/bn_div.c:183:1: Parameter `ctx->stack.depth` 181. * If 'dv' or 'rm' is NULL, the respective value is not returned. 182. */ 183. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 184. BN_CTX *ctx) 185. { crypto/bn/bn_div.c:228:2: Call 226. } 227. 228. BN_CTX_start(ctx); ^ 229. tmp=BN_CTX_get(ctx); 230. snum=BN_CTX_get(ctx); crypto/bn/bn_ctx.c:257:1: Parameter `ctx->stack.depth` 255. } 256. 257. > void BN_CTX_start(BN_CTX *ctx) 258. { 259. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:443:2: Call 441. } 442. if (no_branch) bn_correct_top(res); 443. BN_CTX_end(ctx); ^ 444. return(1); 445. err: crypto/bn/bn_ctx.c:272:1: Parameter `ctx->stack.depth` 270. } 271. 272. > void BN_CTX_end(BN_CTX *ctx) 273. { 274. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:279:21: Call 277. else 278. { 279. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 280. /* Does this stack frame have anything to release? */ 281. if(fp < ctx->used) crypto/bn/bn_ctx.c:353:1: <LHS trace> 351. } 352. 353. > static unsigned int BN_STACK_pop(BN_STACK *st) 354. { 355. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:353:1: Parameter `st->depth` 351. } 352. 353. > static unsigned int BN_STACK_pop(BN_STACK *st) 354. { 355. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:355:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_div` 353. static unsigned int BN_STACK_pop(BN_STACK *st) 354. { 355. return st->indexes[--(st->depth)]; ^ 356. } 357.
https://github.com/openssl/openssl/blob/a9d14832fd98cb0c13b53fddea39765fb259358c/crypto/bn/bn_ctx.c/#L355
d2a_code_trace_data_43155
int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; if (pkt->buf->length > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = (pkt->buf->length == 0) ? DEFAULT_BUF_SIZE : pkt->buf->length * 2; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; pkt->written += len; pkt->curr += len; return 1; } ssl/t1_lib.c:1075: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + `s->tlsext_hostname->strlen` + 26]):unsigned64 by call to `WPACKET_start_sub_packet_len__`. Showing all 10 steps of the trace ssl/t1_lib.c:1074:21: Call 1072. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_srp) 1073. /* Sub-packet for SRP extension */ 1074. || !WPACKET_start_sub_packet_u16(pkt) ^ 1075. || !WPACKET_start_sub_packet_u8(pkt) 1076. /* login must not be zero...internal error if so */ ssl/packet.c:201:1: Parameter `pkt->buf->length` 199. } 200. 201. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 202. { 203. WPACKET_SUB *sub; ssl/t1_lib.c:1075:21: Call 1073. /* Sub-packet for SRP extension */ 1074. || !WPACKET_start_sub_packet_u16(pkt) 1075. || !WPACKET_start_sub_packet_u8(pkt) ^ 1076. /* login must not be zero...internal error if so */ 1077. || !WPACKET_set_flags(pkt, WPACKET_FLAGS_NON_ZERO_LENGTH) ssl/packet.c:201:1: Parameter `pkt->written` 199. } 200. 201. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 202. { 203. WPACKET_SUB *sub; ssl/packet.c:225:10: Call 223. } 224. 225. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 226. return 0; 227. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */ ssl/packet.c:15:1: <LHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `pkt->buf->length` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: <RHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `len` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:25:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + pkt->written + s->tlsext_hostname->strlen + 26]):unsigned64 by call to `WPACKET_start_sub_packet_len__` 23. return 0; 24. 25. if (pkt->buf->length - pkt->written < len) { ^ 26. size_t newlen; 27.
https://github.com/openssl/openssl/blob/84d5549e692e63a16fa1b11603e4098fc31746e9/ssl/packet.c/#L25
d2a_code_trace_data_43156
static ossl_inline unsigned int constant_time_lt(unsigned int a, unsigned int b) { return constant_time_msb(a ^ ((a ^ b) | ((a - b) ^ b))); } ssl/record/ssl3_record.c:1372: error: INTEGER_OVERFLOW_L2 ([1, +oo] - [0, 64]):unsigned32 by call to `ssl3_cbc_copy_mac`. Showing all 10 steps of the trace ssl/record/ssl3_record.c:1276:1: Parameter `s->rlayer.rrec.length` 1274. } 1275. 1276. > int dtls1_process_record(SSL *s, DTLS1_BITMAP *bitmap) 1277. { 1278. int i, al; ssl/record/ssl3_record.c:1315:5: Assignment 1313. /* decrypt in place in 'rr->input' */ 1314. rr->data = rr->input; 1315. rr->orig_len = rr->length; ^ 1316. 1317. enc_err = s->method->ssl3_enc->enc(s, rr, 1, 0); ssl/record/ssl3_record.c:1372:13: Call 1370. */ 1371. mac = mac_tmp; 1372. ssl3_cbc_copy_mac(mac_tmp, rr, mac_size); ^ 1373. rr->length -= mac_size; 1374. } else { ssl/record/ssl3_record.c:1199:1: Parameter `md_size` 1197. #define CBC_MAC_ROTATE_IN_PLACE 1198. 1199. > void ssl3_cbc_copy_mac(unsigned char *out, 1200. const SSL3_RECORD *rec, unsigned md_size) 1201. { ssl/record/ssl3_record.c:1251:14: Call 1249. unsigned char b = rec->data[i]; 1250. rotated_mac[j++] |= b & mac_started & ~mac_ended; 1251. j &= constant_time_lt(j, md_size); ^ 1252. } 1253. include/internal/constant_time_locl.h:105:1: <LHS trace> 103. } 104. 105. > static ossl_inline unsigned int constant_time_lt(unsigned int a, 106. unsigned int b) 107. { include/internal/constant_time_locl.h:105:1: Parameter `a` 103. } 104. 105. > static ossl_inline unsigned int constant_time_lt(unsigned int a, 106. unsigned int b) 107. { include/internal/constant_time_locl.h:105:1: <RHS trace> 103. } 104. 105. > static ossl_inline unsigned int constant_time_lt(unsigned int a, 106. unsigned int b) 107. { include/internal/constant_time_locl.h:105:1: Parameter `b` 103. } 104. 105. > static ossl_inline unsigned int constant_time_lt(unsigned int a, 106. unsigned int b) 107. { include/internal/constant_time_locl.h:108:12: Binary operation: ([1, +oo] - [0, 64]):unsigned32 by call to `ssl3_cbc_copy_mac` 106. unsigned int b) 107. { 108. return constant_time_msb(a ^ ((a ^ b) | ((a - b) ^ b))); ^ 109. } 110.
https://github.com/openssl/openssl/blob/1fb9fdc3027b27d8eb6a1e6a846435b070980770/include/internal/constant_time_locl.h/#L108
d2a_code_trace_data_43157
static int oog_encode(double u, double v) { static int oog_table[NANGLES]; static int initialized = 0; register int i; if (!initialized) { double eps[NANGLES], ua, va, ang, epsa; int ui, vi, ustep; for (i = NANGLES; i--; ) eps[i] = 2.; for (vi = UV_NVS; vi--; ) { va = UV_VSTART + (vi+.5)*UV_SQSIZ; ustep = uv_row[vi].nus-1; if (vi == UV_NVS-1 || vi == 0 || ustep <= 0) ustep = 1; for (ui = uv_row[vi].nus-1; ui >= 0; ui -= ustep) { ua = uv_row[vi].ustart + (ui+.5)*UV_SQSIZ; ang = uv2ang(ua, va); i = (int) ang; epsa = fabs(ang - (i+.5)); if (epsa < eps[i]) { oog_table[i] = uv_row[vi].ncum + ui; eps[i] = epsa; } } } for (i = NANGLES; i--; ) if (eps[i] > 1.5) { int i1, i2; for (i1 = 1; i1 < NANGLES/2; i1++) if (eps[(i+i1)%NANGLES] < 1.5) break; for (i2 = 1; i2 < NANGLES/2; i2++) if (eps[(i+NANGLES-i2)%NANGLES] < 1.5) break; if (i1 < i2) oog_table[i] = oog_table[(i+i1)%NANGLES]; else oog_table[i] = oog_table[(i+NANGLES-i2)%NANGLES]; } initialized = 1; } i = (int) uv2ang(u, v); return (oog_table[i]); } libtiff/tif_luv.c:836: error: Buffer Overrun L3 Offset: [-99, 99] Size: 100. libtiff/tif_luv.c:835:10: <Offset trace> 833. if (eps[i] > 1.5) { 834. int i1, i2; 835. for (i1 = 1; i1 < NANGLES/2; i1++) ^ 836. if (eps[(i+i1)%NANGLES] < 1.5) 837. break; libtiff/tif_luv.c:835:10: Assignment 833. if (eps[i] > 1.5) { 834. int i1, i2; 835. for (i1 = 1; i1 < NANGLES/2; i1++) ^ 836. if (eps[(i+i1)%NANGLES] < 1.5) 837. break; libtiff/tif_luv.c:804:1: <Length trace> 802. * atan2((v)-V_NEU,(u)-U_NEU) + .5*NANGLES ) 803. 804. static int ^ 805. oog_encode(double u, double v) /* encode out-of-gamut chroma */ 806. { libtiff/tif_luv.c:804:1: Array declaration 802. * atan2((v)-V_NEU,(u)-U_NEU) + .5*NANGLES ) 803. 804. static int ^ 805. oog_encode(double u, double v) /* encode out-of-gamut chroma */ 806. { libtiff/tif_luv.c:836:10: Array access: Offset: [-99, 99] Size: 100 834. int i1, i2; 835. for (i1 = 1; i1 < NANGLES/2; i1++) 836. if (eps[(i+i1)%NANGLES] < 1.5) ^ 837. break; 838. for (i2 = 1; i2 < NANGLES/2; i2++)
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_luv.c/#L836
d2a_code_trace_data_43158
static int opt_input_ts_scale(const char *opt, const char *arg) { unsigned int stream; double scale; char *p; stream = strtol(arg, &p, 0); if (*p) p++; scale= strtod(p, &p); if(stream >= MAX_STREAMS) ffmpeg_exit(1); input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); input_files_ts_scale[nb_input_files][stream]= scale; return 0; } ffmpeg.c:3079: error: Null Dereference pointer `input_files_ts_scale[nb_input_files]` last assigned on line 3078 could be null and is dereferenced at line 3079, column 5. ffmpeg.c:3064:1: start of procedure opt_input_ts_scale() 3062. } 3063. 3064. static int opt_input_ts_scale(const char *opt, const char *arg) ^ 3065. { 3066. unsigned int stream; ffmpeg.c:3070:5: 3068. char *p; 3069. 3070. stream = strtol(arg, &p, 0); ^ 3071. if (*p) 3072. p++; ffmpeg.c:3071:9: Taking false branch 3069. 3070. stream = strtol(arg, &p, 0); 3071. if (*p) ^ 3072. p++; 3073. scale= strtod(p, &p); ffmpeg.c:3073:5: 3071. if (*p) 3072. p++; 3073. scale= strtod(p, &p); ^ 3074. 3075. if(stream >= MAX_STREAMS) ffmpeg.c:3075:8: Taking true branch 3073. scale= strtod(p, &p); 3074. 3075. if(stream >= MAX_STREAMS) ^ 3076. ffmpeg_exit(1); 3077. ffmpeg.c:3076:9: Skipping ffmpeg_exit(): empty list of specs 3074. 3075. if(stream >= MAX_STREAMS) 3076. ffmpeg_exit(1); ^ 3077. 3078. input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); ffmpeg.c:3078:5: 3076. ffmpeg_exit(1); 3077. 3078. input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); ^ 3079. input_files_ts_scale[nb_input_files][stream]= scale; 3080. return 0; ffmpeg.c:519:1: start of procedure grow_array() 517. 518. /* similar to ff_dynarray_add() and av_fast_realloc() */ 519. static void *grow_array(void *array, int elem_size, int *size, int new_size) ^ 520. { 521. if (new_size >= INT_MAX / elem_size) { ffmpeg.c:521:9: Taking true branch 519. static void *grow_array(void *array, int elem_size, int *size, int new_size) 520. { 521. if (new_size >= INT_MAX / elem_size) { ^ 522. fprintf(stderr, "Array too big.\n"); 523. ffmpeg_exit(1); ffmpeg.c:522:9: 520. { 521. if (new_size >= INT_MAX / elem_size) { 522. fprintf(stderr, "Array too big.\n"); ^ 523. ffmpeg_exit(1); 524. } ffmpeg.c:523:9: Skipping ffmpeg_exit(): empty list of specs 521. if (new_size >= INT_MAX / elem_size) { 522. fprintf(stderr, "Array too big.\n"); 523. ffmpeg_exit(1); ^ 524. } 525. if (*size < new_size) { ffmpeg.c:525:9: Taking true branch 523. ffmpeg_exit(1); 524. } 525. if (*size < new_size) { ^ 526. uint8_t *tmp = av_realloc(array, new_size*elem_size); 527. if (!tmp) { ffmpeg.c:526:9: 524. } 525. if (*size < new_size) { 526. uint8_t *tmp = av_realloc(array, new_size*elem_size); ^ 527. if (!tmp) { 528. fprintf(stderr, "Could not alloc buffer.\n"); libavutil/mem.c:117:1: start of procedure av_realloc() 115. } 116. 117. void *av_realloc(void *ptr, size_t size) ^ 118. { 119. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:124:8: Taking false branch 122. 123. /* let's disallow possible ambiguous cases */ 124. if(size > (INT_MAX-16) ) ^ 125. return NULL; 126. libavutil/mem.c:133:5: 131. return (char*)realloc((char*)ptr - diff, size + diff) + diff; 132. #else 133. return realloc(ptr, size); ^ 134. #endif 135. } libavutil/mem.c:135:1: return from a call to av_realloc 133. return realloc(ptr, size); 134. #endif 135. } ^ 136. 137. void av_free(void *ptr) ffmpeg.c:527:14: Taking true branch 525. if (*size < new_size) { 526. uint8_t *tmp = av_realloc(array, new_size*elem_size); 527. if (!tmp) { ^ 528. fprintf(stderr, "Could not alloc buffer.\n"); 529. ffmpeg_exit(1); ffmpeg.c:528:13: 526. uint8_t *tmp = av_realloc(array, new_size*elem_size); 527. if (!tmp) { 528. fprintf(stderr, "Could not alloc buffer.\n"); ^ 529. ffmpeg_exit(1); 530. } ffmpeg.c:529:13: Skipping ffmpeg_exit(): empty list of specs 527. if (!tmp) { 528. fprintf(stderr, "Could not alloc buffer.\n"); 529. ffmpeg_exit(1); ^ 530. } 531. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); ffmpeg.c:531:9: 529. ffmpeg_exit(1); 530. } 531. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); ^ 532. *size = new_size; 533. return tmp; ffmpeg.c:532:9: 530. } 531. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); 532. *size = new_size; ^ 533. return tmp; 534. } ffmpeg.c:533:9: 531. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); 532. *size = new_size; 533. return tmp; ^ 534. } 535. return array; ffmpeg.c:536:1: return from a call to grow_array 534. } 535. return array; 536. } ^ 537. 538. static void choose_sample_fmt(AVStream *st, AVCodec *codec) ffmpeg.c:3079:5: 3077. 3078. input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); 3079. input_files_ts_scale[nb_input_files][stream]= scale; ^ 3080. return 0; 3081. }
https://github.com/libav/libav/blob/a6286bda0956bfe15b4e1a9f96e1689666e1d866/ffmpeg.c/#L3079
d2a_code_trace_data_43159
static void vc1_decode_b_mb(VC1Context *v) { MpegEncContext *s = &v->s; GetBitContext *gb = &s->gb; int i, j; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; int cbp = 0; int mqdiff, mquant; int ttmb = v->ttfrm; static const int size_table[6] = { 0, 2, 3, 4, 5, 8 }, offset_table[6] = { 0, 1, 3, 7, 15, 31 }; int mb_has_coeffs = 0; int index, index1; int val, sign; int first_block = 1; int dst_idx, off; int skipped, direct; int dmv_x[2], dmv_y[2]; int bmvtype = BMV_TYPE_BACKWARD; mquant = v->pq; s->mb_intra = 0; if (v->dmb_is_raw) direct = get_bits1(gb); else direct = v->direct_mb_plane[mb_pos]; if (v->skip_is_raw) skipped = get_bits1(gb); else skipped = v->s.mbskip_table[mb_pos]; s->dsp.clear_blocks(s->block[0]); dmv_x[0] = dmv_x[1] = dmv_y[0] = dmv_y[1] = 0; for(i = 0; i < 6; i++) { v->mb_type[0][s->block_index[i]] = 0; s->dc_val[0][s->block_index[i]] = 0; } s->current_picture.qscale_table[mb_pos] = 0; if (!direct) { if (!skipped) { GET_MVDATA(dmv_x[0], dmv_y[0]); dmv_x[1] = dmv_x[0]; dmv_y[1] = dmv_y[0]; } if(skipped || !s->mb_intra) { bmvtype = decode012(gb); switch(bmvtype) { case 0: bmvtype = (v->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_BACKWARD : BMV_TYPE_FORWARD; break; case 1: bmvtype = (v->bfraction >= (B_FRACTION_DEN/2)) ? BMV_TYPE_FORWARD : BMV_TYPE_BACKWARD; break; case 2: bmvtype = BMV_TYPE_INTERPOLATED; dmv_x[0] = dmv_y[0] = 0; } } } for(i = 0; i < 6; i++) v->mb_type[0][s->block_index[i]] = s->mb_intra; if (skipped) { if(direct) bmvtype = BMV_TYPE_INTERPOLATED; vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype); return; } if (direct) { cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); GET_MQUANT(); s->mb_intra = 0; mb_has_coeffs = 0; s->current_picture.qscale_table[mb_pos] = mquant; if(!v->ttmbf) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); dmv_x[0] = dmv_y[0] = dmv_x[1] = dmv_y[1] = 0; vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype); } else { if(!mb_has_coeffs && !s->mb_intra) { vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype); return; } if(s->mb_intra && !mb_has_coeffs) { GET_MQUANT(); s->current_picture.qscale_table[mb_pos] = mquant; s->ac_pred = get_bits1(gb); cbp = 0; vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); } else { if(bmvtype == BMV_TYPE_INTERPOLATED) { GET_MVDATA(dmv_x[0], dmv_y[0]); if(!mb_has_coeffs) { vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype); return; } } vc1_pred_b_mv(v, dmv_x, dmv_y, direct, bmvtype); if(!s->mb_intra) { vc1_b_mc(v, dmv_x, dmv_y, direct, bmvtype); } if(s->mb_intra) s->ac_pred = get_bits1(gb); cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); GET_MQUANT(); s->current_picture.qscale_table[mb_pos] = mquant; if(!v->ttmbf && !s->mb_intra && mb_has_coeffs) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); } } dst_idx = 0; for (i=0; i<6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); v->mb_type[0][s->block_index[i]] = s->mb_intra; if(s->mb_intra) { v->a_avail = v->c_avail = 0; if(i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; if(i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; s->dsp.vc1_inv_trans_8x8(s->block[i]); if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); } else if(val) { vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY)); if(!v->ttmbf && ttmb < 8) ttmb = -1; first_block = 0; } } } libavcodec/vc1.c:3279: error: Buffer Overrun L3 Offset: [-5, 5] Size: 6. libavcodec/vc1.c:3269:5: <Offset trace> 3267. skipped = v->s.mbskip_table[mb_pos]; 3268. 3269. s->dsp.clear_blocks(s->block[0]); ^ 3270. dmv_x[0] = dmv_x[1] = dmv_y[0] = dmv_y[1] = 0; 3271. for(i = 0; i < 6; i++) { libavcodec/vc1.c:3269:5: Unknown value from: non-const function 3267. skipped = v->s.mbskip_table[mb_pos]; 3268. 3269. s->dsp.clear_blocks(s->block[0]); ^ 3270. dmv_x[0] = dmv_x[1] = dmv_y[0] = dmv_y[1] = 0; 3271. for(i = 0; i < 6; i++) { libavcodec/vc1.c:3279:13: Call 3277. if (!direct) { 3278. if (!skipped) { 3279. GET_MVDATA(dmv_x[0], dmv_y[0]); ^ 3280. dmv_x[1] = dmv_x[0]; 3281. dmv_y[1] = dmv_y[0]; libavcodec/bitstream.h:877:1: Parameter `(*table)[*]` 875. * = (max_vlc_length + bits - 1) / bits 876. */ 877. static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2], ^ 878. int bits, int max_depth) 879. { libavcodec/bitstream.h:885:5: Assignment 883. UPDATE_CACHE(re, s) 884. 885. GET_VLC(code, re, s, table, bits, max_depth) ^ 886. 887. CLOSE_READER(re, s) libavcodec/bitstream.h:888:5: Assignment 886. 887. CLOSE_READER(re, s) 888. return code; ^ 889. } 890. libavcodec/vc1.c:3279:13: Assignment 3277. if (!direct) { 3278. if (!skipped) { 3279. GET_MVDATA(dmv_x[0], dmv_y[0]); ^ 3280. dmv_x[1] = dmv_x[0]; 3281. dmv_y[1] = dmv_y[0]; libavcodec/vc1.c:3279:13: Assignment 3277. if (!direct) { 3278. if (!skipped) { 3279. GET_MVDATA(dmv_x[0], dmv_y[0]); ^ 3280. dmv_x[1] = dmv_x[0]; 3281. dmv_y[1] = dmv_y[0]; libavcodec/vc1.c:3246:5: <Length trace> 3244. int ttmb = v->ttfrm; /* MB Transform type */ 3245. 3246. static const int size_table[6] = { 0, 2, 3, 4, 5, 8 }, ^ 3247. offset_table[6] = { 0, 1, 3, 7, 15, 31 }; 3248. int mb_has_coeffs = 0; /* last_flag */ libavcodec/vc1.c:3246:5: Array declaration 3244. int ttmb = v->ttfrm; /* MB Transform type */ 3245. 3246. static const int size_table[6] = { 0, 2, 3, 4, 5, 8 }, ^ 3247. offset_table[6] = { 0, 1, 3, 7, 15, 31 }; 3248. int mb_has_coeffs = 0; /* last_flag */ libavcodec/vc1.c:3279:13: Array access: Offset: [-5, 5] Size: 6 3277. if (!direct) { 3278. if (!skipped) { 3279. GET_MVDATA(dmv_x[0], dmv_y[0]); ^ 3280. dmv_x[1] = dmv_x[0]; 3281. dmv_y[1] = dmv_y[0];
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vc1.c/#L3279
d2a_code_trace_data_43160
static void PS_FlipBytes(unsigned char* buf, tsize_t count) { int i; unsigned char temp; if (count <= 0 || bitspersample <= 8) { return; } count--; for (i = 0; i < count; i += 2) { temp = buf[i]; buf[i] = buf[i + 1]; buf[i + 1] = temp; } } tools/tiff2ps.c:1528: error: Buffer Overrun L3 Offset: [1, +oo] Size: [0, +oo] by call to `PS_FlipBytes`. tools/tiff2ps.c:1509:18: Call 1507. } else { 1508. if (tiled_image) 1509. byte_count = TIFFReadEncodedTile(tif, ^ 1510. chunk_no, buf_data, 1511. chunk_size); libtiff/tif_read.c:436:3: Assignment 434. 435. if (!TIFFCheckRead(tif, 1)) 436. return ((tmsize_t)(-1)); ^ 437. if (tile >= td->td_nstrips) { 438. TIFFErrorExt(tif->tif_clientdata, module, tools/tiff2ps.c:1509:5: Assignment 1507. } else { 1508. if (tiled_image) 1509. byte_count = TIFFReadEncodedTile(tif, ^ 1510. chunk_no, buf_data, 1511. chunk_size); tools/tiff2ps.c:1528:4: Call 1526. */ 1527. if (bitspersample == 16 && !TIFFIsBigEndian(tif)) { 1528. PS_FlipBytes(buf_data, byte_count); ^ 1529. } 1530. /* tools/tiff2ps.c:1410:7: <Offset trace> 1408. count--; 1409. 1410. for (i = 0; i < count; i += 2) { ^ 1411. temp = buf[i]; 1412. buf[i] = buf[i + 1]; tools/tiff2ps.c:1410:7: Assignment 1408. count--; 1409. 1410. for (i = 0; i < count; i += 2) { ^ 1411. temp = buf[i]; 1412. buf[i] = buf[i + 1]; tools/tiff2ps.c:1398:1: <Length trace> 1396. 1397. /* Flip the byte order of buffers with 16 bit samples */ 1398. static void ^ 1399. PS_FlipBytes(unsigned char* buf, tsize_t count) 1400. { tools/tiff2ps.c:1398:1: Parameter `*buf` 1396. 1397. /* Flip the byte order of buffers with 16 bit samples */ 1398. static void ^ 1399. PS_FlipBytes(unsigned char* buf, tsize_t count) 1400. { tools/tiff2ps.c:1412:12: Array access: Offset: [1, +oo] Size: [0, +oo] by call to `PS_FlipBytes` 1410. for (i = 0; i < count; i += 2) { 1411. temp = buf[i]; 1412. buf[i] = buf[i + 1]; ^ 1413. buf[i + 1] = temp; 1414. }
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/tools/tiff2ps.c/#L1412
d2a_code_trace_data_43161
void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) { unsigned long hash; OPENSSL_LH_NODE *nn, **rn; void *ret; lh->error = 0; rn = getrn(lh, data, &hash); if (*rn == NULL) { lh->num_no_delete++; return NULL; } else { nn = *rn; *rn = nn->next; ret = nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))) contract(lh); return ret; } ssl/ssl_lib.c:3715: error: INTEGER_OVERFLOW_L2 ([0, max(0, `s->ctx->sessions->num_items`)] - 1):unsigned64 by call to `SSL_copy_session_id`. Showing all 19 steps of the trace ssl/ssl_lib.c:3693:1: Parameter `s->ctx->sessions->num_items` 3691. } 3692. 3693. > SSL *SSL_dup(SSL *s) 3694. { 3695. SSL *ret; ssl/ssl_lib.c:3707:16: Call 3705. * Otherwise, copy configuration state, and session if set. 3706. */ 3707. if ((ret = SSL_new(SSL_get_SSL_CTX(s))) == NULL) ^ 3708. return NULL; 3709. ssl/ssl_lib.c:671:1: Parameter `ctx->sessions->num_items` 669. } 670. 671. > SSL *SSL_new(SSL_CTX *ctx) 672. { 673. SSL *s; ssl/ssl_lib.c:3715:14: Call 3713. * session-id, SSL_METHOD, sid_ctx, and 'cert' 3714. */ 3715. if (!SSL_copy_session_id(ret, s)) ^ 3716. goto err; 3717. } else { ssl/ssl_lib.c:1544:1: Parameter `t->session_ctx->sessions->num_items` 1542. * modify. We need to be able to read f without being hassled 1543. */ 1544. > int SSL_copy_session_id(SSL *t, const SSL *f) 1545. { 1546. int i; ssl/ssl_lib.c:1548:10: Call 1546. int i; 1547. /* Do we need to to SSL locking? */ 1548. if (!SSL_set_session(t, SSL_get_session(f))) { ^ 1549. return 0; 1550. } ssl/ssl_sess.c:829:1: Parameter `s->session_ctx->sessions->num_items` 827. } 828. 829. > int SSL_set_session(SSL *s, SSL_SESSION *session) 830. { 831. ssl_clear_bad_session(s); ssl/ssl_sess.c:831:5: Call 829. int SSL_set_session(SSL *s, SSL_SESSION *session) 830. { 831. ssl_clear_bad_session(s); ^ 832. if (s->ctx->method != s->method) { 833. if (!SSL_set_ssl_method(s, s->ctx->method)) ssl/ssl_sess.c:1124:1: Parameter `s->session_ctx->sessions->num_items` 1122. } 1123. 1124. > int ssl_clear_bad_session(SSL *s) 1125. { 1126. if ((s->session != NULL) && ssl/ssl_sess.c:1129:9: Call 1127. !(s->shutdown & SSL_SENT_SHUTDOWN) && 1128. !(SSL_in_init(s) || SSL_in_before(s))) { 1129. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 1130. return 1; 1131. } else ssl/ssl_sess.c:742:1: Parameter `ctx->sessions->num_items` 740. } 741. 742. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 743. { 744. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:744:12: Call 742. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 743. { 744. return remove_session_lock(ctx, c, 1); ^ 745. } 746. ssl/ssl_sess.c:747:1: Parameter `ctx->sessions->num_items` 745. } 746. 747. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 748. { 749. SSL_SESSION *r; ssl/ssl_sess.c:757:17: Call 755. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) != NULL) { 756. ret = 1; 757. r = lh_SSL_SESSION_delete(ctx->sessions, r); ^ 758. SSL_SESSION_list_remove(ctx, r); 759. } ssl/ssl_locl.h:732:1: Parameter `lh->num_items` 730. } TLSEXT_INDEX; 731. 732. > DEFINE_LHASH_OF(SSL_SESSION); 733. /* Needed in ssl_cert.c */ 734. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:732:1: Call 730. } TLSEXT_INDEX; 731. 732. > DEFINE_LHASH_OF(SSL_SESSION); 733. /* Needed in ssl_cert.c */ 734. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:128:1: <LHS trace> 126. } 127. 128. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 129. { 130. unsigned long hash; crypto/lhash/lhash.c:128:1: Parameter `lh->num_items` 126. } 127. 128. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 129. { 130. unsigned long hash; crypto/lhash/lhash.c:148:5: Binary operation: ([0, max(0, s->ctx->sessions->num_items)] - 1):unsigned64 by call to `SSL_copy_session_id` 146. } 147. 148. lh->num_items--; ^ 149. if ((lh->num_nodes > MIN_NODES) && 150. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
https://github.com/openssl/openssl/blob/6e68dae85a8f91944370125561c7ec0d5da46c20/crypto/lhash/lhash.c/#L148
d2a_code_trace_data_43162
static int pkey_dh_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) { DH *dh = NULL; DH_PKEY_CTX *dctx = ctx->data; BN_GENCB *pcb; int ret; if (dctx->rfc5114_param) { switch (dctx->rfc5114_param) { case 1: dh = DH_get_1024_160(); break; case 2: dh = DH_get_2048_224(); break; case 3: dh = DH_get_2048_256(); break; default: return -2; } EVP_PKEY_assign(pkey, EVP_PKEY_DHX, dh); return 1; } if (ctx->pkey_gencb) { pcb = BN_GENCB_new(); if (pcb == NULL) return 0; evp_pkey_set_cb_translate(pcb, ctx); } else pcb = NULL; #ifndef OPENSSL_NO_DSA if (dctx->use_dsa) { DSA *dsa_dh; dsa_dh = dsa_dh_generate(dctx, pcb); BN_GENCB_free(pcb); if (dsa_dh == NULL) return 0; dh = DSA_dup_DH(dsa_dh); DSA_free(dsa_dh); if (!dh) return 0; EVP_PKEY_assign(pkey, EVP_PKEY_DHX, dh); return 1; } #endif dh = DH_new(); if (dh == NULL) { BN_GENCB_free(pcb); return 0; } ret = DH_generate_parameters_ex(dh, dctx->prime_len, dctx->generator, pcb); BN_GENCB_free(pcb); if (ret) EVP_PKEY_assign_DH(pkey, dh); else DH_free(dh); return ret; } crypto/dh/dh_pmeth.c:367: error: MEMORY_LEAK memory dynamically allocated by call to `DH_get_2048_224()` at line 357, column 18 is not reachable after line 367, column 9. Showing all 125 steps of the trace crypto/dh/dh_pmeth.c:344:1: start of procedure pkey_dh_paramgen() 342. #endif 343. 344. > static int pkey_dh_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) 345. { 346. DH *dh = NULL; crypto/dh/dh_pmeth.c:346:5: 344. static int pkey_dh_paramgen(EVP_PKEY_CTX *ctx, EVP_PKEY *pkey) 345. { 346. > DH *dh = NULL; 347. DH_PKEY_CTX *dctx = ctx->data; 348. BN_GENCB *pcb; crypto/dh/dh_pmeth.c:347:5: 345. { 346. DH *dh = NULL; 347. > DH_PKEY_CTX *dctx = ctx->data; 348. BN_GENCB *pcb; 349. int ret; crypto/dh/dh_pmeth.c:350:9: Taking true branch 348. BN_GENCB *pcb; 349. int ret; 350. if (dctx->rfc5114_param) { ^ 351. switch (dctx->rfc5114_param) { 352. case 1: crypto/dh/dh_pmeth.c:351:9: 349. int ret; 350. if (dctx->rfc5114_param) { 351. > switch (dctx->rfc5114_param) { 352. case 1: 353. dh = DH_get_1024_160(); crypto/dh/dh_pmeth.c:352:9: Switch condition is false. Skipping switch case 350. if (dctx->rfc5114_param) { 351. switch (dctx->rfc5114_param) { 352. case 1: ^ 353. dh = DH_get_1024_160(); 354. break; crypto/dh/dh_pmeth.c:356:9: Switch condition is true. Entering switch case 354. break; 355. 356. case 2: ^ 357. dh = DH_get_2048_224(); 358. break; crypto/dh/dh_pmeth.c:357:13: 355. 356. case 2: 357. > dh = DH_get_2048_224(); 358. break; 359. crypto/dh/dh_rfc5114.c:89:1: start of procedure DH_get_2048_224() 87. 88. make_dh(1024_160) 89. > make_dh(2048_224) 90. make_dh(2048_256) crypto/dh/dh_rfc5114.c:89:1: Taking false branch 87. 88. make_dh(1024_160) 89. > make_dh(2048_224) 90. make_dh(2048_256) crypto/bn/bn_lib.c:410:1: start of procedure BN_dup() 408. } 409. 410. > BIGNUM *BN_dup(const BIGNUM *a) 411. { 412. BIGNUM *t; crypto/bn/bn_lib.c:414:9: Taking false branch 412. BIGNUM *t; 413. 414. if (a == NULL) ^ 415. return NULL; 416. bn_check_top(a); crypto/bn/bn_lib.c:418:9: 416. bn_check_top(a); 417. 418. > t = BN_get_flags(a, BN_FLG_SECURE) ? BN_secure_new() : BN_new(); 419. if (t == NULL) 420. return NULL; crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:418:9: Condition is false 416. bn_check_top(a); 417. 418. t = BN_get_flags(a, BN_FLG_SECURE) ? BN_secure_new() : BN_new(); ^ 419. if (t == NULL) 420. return NULL; crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) crypto/bn/bn_lib.c:418:5: 416. bn_check_top(a); 417. 418. > t = BN_get_flags(a, BN_FLG_SECURE) ? BN_secure_new() : BN_new(); 419. if (t == NULL) 420. return NULL; crypto/bn/bn_lib.c:419:9: Taking false branch 417. 418. t = BN_get_flags(a, BN_FLG_SECURE) ? BN_secure_new() : BN_new(); 419. if (t == NULL) ^ 420. return NULL; 421. if (!BN_copy(t, a)) { crypto/bn/bn_lib.c:421:10: Taking false branch 419. if (t == NULL) 420. return NULL; 421. if (!BN_copy(t, a)) { ^ 422. BN_free(t); 423. return NULL; crypto/bn/bn_lib.c:426:5: 424. } 425. bn_check_top(t); 426. > return t; 427. } 428. crypto/bn/bn_lib.c:427:1: return from a call to BN_dup 425. bn_check_top(t); 426. return t; 427. > } 428. 429. BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) crypto/dh/dh_rfc5114.c:89:1: 87. 88. make_dh(1024_160) 89. > make_dh(2048_224) 90. make_dh(2048_256) crypto/bn/bn_lib.c:410:1: start of procedure BN_dup() 408. } 409. 410. > BIGNUM *BN_dup(const BIGNUM *a) 411. { 412. BIGNUM *t; crypto/bn/bn_lib.c:414:9: Taking false branch 412. BIGNUM *t; 413. 414. if (a == NULL) ^ 415. return NULL; 416. bn_check_top(a); crypto/bn/bn_lib.c:418:9: 416. bn_check_top(a); 417. 418. > t = BN_get_flags(a, BN_FLG_SECURE) ? BN_secure_new() : BN_new(); 419. if (t == NULL) 420. return NULL; crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:418:9: Condition is false 416. bn_check_top(a); 417. 418. t = BN_get_flags(a, BN_FLG_SECURE) ? BN_secure_new() : BN_new(); ^ 419. if (t == NULL) 420. return NULL; crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) crypto/bn/bn_lib.c:418:5: 416. bn_check_top(a); 417. 418. > t = BN_get_flags(a, BN_FLG_SECURE) ? BN_secure_new() : BN_new(); 419. if (t == NULL) 420. return NULL; crypto/bn/bn_lib.c:419:9: Taking false branch 417. 418. t = BN_get_flags(a, BN_FLG_SECURE) ? BN_secure_new() : BN_new(); 419. if (t == NULL) ^ 420. return NULL; 421. if (!BN_copy(t, a)) { crypto/bn/bn_lib.c:421:10: Taking false branch 419. if (t == NULL) 420. return NULL; 421. if (!BN_copy(t, a)) { ^ 422. BN_free(t); 423. return NULL; crypto/bn/bn_lib.c:426:5: 424. } 425. bn_check_top(t); 426. > return t; 427. } 428. crypto/bn/bn_lib.c:427:1: return from a call to BN_dup 425. bn_check_top(t); 426. return t; 427. > } 428. 429. BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) crypto/dh/dh_rfc5114.c:89:1: 87. 88. make_dh(1024_160) 89. > make_dh(2048_224) 90. make_dh(2048_256) crypto/bn/bn_lib.c:410:1: start of procedure BN_dup() 408. } 409. 410. > BIGNUM *BN_dup(const BIGNUM *a) 411. { 412. BIGNUM *t; crypto/bn/bn_lib.c:414:9: Taking false branch 412. BIGNUM *t; 413. 414. if (a == NULL) ^ 415. return NULL; 416. bn_check_top(a); crypto/bn/bn_lib.c:418:9: 416. bn_check_top(a); 417. 418. > t = BN_get_flags(a, BN_FLG_SECURE) ? BN_secure_new() : BN_new(); 419. if (t == NULL) 420. return NULL; crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:418:9: Condition is false 416. bn_check_top(a); 417. 418. t = BN_get_flags(a, BN_FLG_SECURE) ? BN_secure_new() : BN_new(); ^ 419. if (t == NULL) 420. return NULL; crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) crypto/bn/bn_lib.c:418:5: 416. bn_check_top(a); 417. 418. > t = BN_get_flags(a, BN_FLG_SECURE) ? BN_secure_new() : BN_new(); 419. if (t == NULL) 420. return NULL; crypto/bn/bn_lib.c:419:9: Taking false branch 417. 418. t = BN_get_flags(a, BN_FLG_SECURE) ? BN_secure_new() : BN_new(); 419. if (t == NULL) ^ 420. return NULL; 421. if (!BN_copy(t, a)) { crypto/bn/bn_lib.c:421:10: Taking false branch 419. if (t == NULL) 420. return NULL; 421. if (!BN_copy(t, a)) { ^ 422. BN_free(t); 423. return NULL; crypto/bn/bn_lib.c:426:5: 424. } 425. bn_check_top(t); 426. > return t; 427. } 428. crypto/bn/bn_lib.c:427:1: return from a call to BN_dup 425. bn_check_top(t); 426. return t; 427. > } 428. 429. BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) crypto/dh/dh_rfc5114.c:89:1: Taking false branch 87. 88. make_dh(1024_160) 89. > make_dh(2048_224) 90. make_dh(2048_256) crypto/dh/dh_rfc5114.c:89:1: Taking false branch 87. 88. make_dh(1024_160) 89. > make_dh(2048_224) 90. make_dh(2048_256) crypto/dh/dh_rfc5114.c:89:1: Taking false branch 87. 88. make_dh(1024_160) 89. > make_dh(2048_224) 90. make_dh(2048_256) crypto/dh/dh_rfc5114.c:89:1: return from a call to DH_get_2048_224 87. 88. make_dh(1024_160) 89. > make_dh(2048_224) 90. make_dh(2048_256) crypto/dh/dh_pmeth.c:367:9: 365. return -2; 366. } 367. > EVP_PKEY_assign(pkey, EVP_PKEY_DHX, dh); 368. return 1; 369. } crypto/evp/p_lib.c:270:1: start of procedure EVP_PKEY_assign() 268. } 269. 270. > int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key) 271. { 272. if (pkey == NULL || !EVP_PKEY_set_type(pkey, type)) crypto/evp/p_lib.c:272:9: Taking false branch 270. int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key) 271. { 272. if (pkey == NULL || !EVP_PKEY_set_type(pkey, type)) ^ 273. return 0; 274. pkey->pkey.ptr = key; crypto/evp/p_lib.c:272:26: 270. int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key) 271. { 272. > if (pkey == NULL || !EVP_PKEY_set_type(pkey, type)) 273. return 0; 274. pkey->pkey.ptr = key; crypto/evp/p_lib.c:260:1: start of procedure EVP_PKEY_set_type() 258. } 259. 260. > int EVP_PKEY_set_type(EVP_PKEY *pkey, int type) 261. { 262. return pkey_set_type(pkey, type, NULL, -1); crypto/evp/p_lib.c:262:5: Skipping pkey_set_type(): empty list of specs 260. int EVP_PKEY_set_type(EVP_PKEY *pkey, int type) 261. { 262. return pkey_set_type(pkey, type, NULL, -1); ^ 263. } 264. crypto/evp/p_lib.c:263:1: return from a call to EVP_PKEY_set_type 261. { 262. return pkey_set_type(pkey, type, NULL, -1); 263. > } 264. 265. int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len) crypto/evp/p_lib.c:272:26: Taking true branch 270. int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key) 271. { 272. if (pkey == NULL || !EVP_PKEY_set_type(pkey, type)) ^ 273. return 0; 274. pkey->pkey.ptr = key; crypto/evp/p_lib.c:273:9: 271. { 272. if (pkey == NULL || !EVP_PKEY_set_type(pkey, type)) 273. > return 0; 274. pkey->pkey.ptr = key; 275. return (key != NULL); crypto/evp/p_lib.c:276:1: return from a call to EVP_PKEY_assign 274. pkey->pkey.ptr = key; 275. return (key != NULL); 276. > } 277. 278. void *EVP_PKEY_get0(EVP_PKEY *pkey)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/dh/dh_pmeth.c/#L367
d2a_code_trace_data_43163
char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) { const X509_NAME_ENTRY *ne; int i; int n, lold, l, l1, l2, num, j, type; const char *s; char *p; unsigned char *q; BUF_MEM *b = NULL; static const char hex[17] = "0123456789ABCDEF"; int gs_doit[4]; char tmp_buf[80]; #ifdef CHARSET_EBCDIC unsigned char ebcdic_buf[1024]; #endif if (buf == NULL) { if ((b = BUF_MEM_new()) == NULL) goto err; if (!BUF_MEM_grow(b, 200)) goto err; b->data[0] = '\0'; len = 200; } else if (len == 0) { return NULL; } if (a == NULL) { if (b) { buf = b->data; OPENSSL_free(b); } strncpy(buf, "NO X509_NAME", len); buf[len - 1] = '\0'; return buf; } len--; l = 0; for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { ne = sk_X509_NAME_ENTRY_value(a->entries, i); n = OBJ_obj2nid(ne->object); if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) { i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object); s = tmp_buf; } l1 = strlen(s); type = ne->value->type; num = ne->value->length; if (num > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } q = ne->value->data; #ifdef CHARSET_EBCDIC if (type == V_ASN1_GENERALSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_PRINTABLESTRING || type == V_ASN1_TELETEXSTRING || type == V_ASN1_IA5STRING) { if (num > (int)sizeof(ebcdic_buf)) num = sizeof(ebcdic_buf); ascii2ebcdic(ebcdic_buf, q, num); q = ebcdic_buf; } #endif if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) { gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0; for (j = 0; j < num; j++) if (q[j] != 0) gs_doit[j & 3] = 1; if (gs_doit[0] | gs_doit[1] | gs_doit[2]) gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; else { gs_doit[0] = gs_doit[1] = gs_doit[2] = 0; gs_doit[3] = 1; } } else gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; for (l2 = j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; l2++; #ifndef CHARSET_EBCDIC if ((q[j] < ' ') || (q[j] > '~')) l2 += 3; #else if ((os_toascii[q[j]] < os_toascii[' ']) || (os_toascii[q[j]] > os_toascii['~'])) l2 += 3; #endif } lold = l; l += 1 + l1 + 1 + l2; if (l > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } if (b != NULL) { if (!BUF_MEM_grow(b, l + 1)) goto err; p = &(b->data[lold]); } else if (l > len) { break; } else p = &(buf[lold]); *(p++) = '/'; memcpy(p, s, (unsigned int)l1); p += l1; *(p++) = '='; #ifndef CHARSET_EBCDIC q = ne->value->data; #endif for (j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; #ifndef CHARSET_EBCDIC n = q[j]; if ((n < ' ') || (n > '~')) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = n; #else n = os_toascii[q[j]]; if ((n < os_toascii[' ']) || (n > os_toascii['~'])) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = q[j]; #endif } *p = '\0'; } if (b != NULL) { p = b->data; OPENSSL_free(b); } else p = buf; if (i == 0) *p = '\0'; return (p); err: X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE); end: BUF_MEM_free(b); return (NULL); } crypto/x509v3/v3_alt.c:97: error: BUFFER_OVERRUN_L3 Offset added: [200, 256] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace crypto/x509v3/v3_alt.c:97:9: Call 95. 96. case GEN_DIRNAME: 97. X509_NAME_oneline(gen->d.dirn, oline, 256); ^ 98. X509V3_add_value("DirName", oline, &ret); 99. break; crypto/x509/x509_obj.c:25:1: <Offset trace> 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: Parameter `len` 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: <Length trace> 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: Parameter `*buf` 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:56:9: Array access: Offset added: [200, 256] Size: [1, 2147483644] by call to `X509_NAME_oneline` 54. OPENSSL_free(b); 55. } 56. strncpy(buf, "NO X509_NAME", len); ^ 57. buf[len - 1] = '\0'; 58. return buf;
https://github.com/openssl/openssl/blob/cdb2a60347f988037d29adc7e4415e9c66c8a5a5/crypto/x509/x509_obj.c/#L56
d2a_code_trace_data_43164
static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, long max) { const unsigned char *p = *pp; unsigned long ret = 0; unsigned long i; if (max-- < 1) return 0; if (*p == 0x80) { *inf = 1; ret = 0; p++; } else { *inf = 0; i = *p & 0x7f; if (*(p++) & 0x80) { if (max < (long)i + 1) return 0; while (i && *p == 0) { p++; i--; } if (i > sizeof(long)) return 0; while (i-- > 0) { ret <<= 8L; ret |= *(p++); } } else ret = i; } if (ret > LONG_MAX) return 0; *pp = p; *rl = (long)ret; return 1; } crypto/ct/ct_log.c:185: error: BUFFER_OVERRUN_L3 Offset: [2, +oo] Size: [1, +oo] by call to `CTLOG_new_from_base64`. Showing all 30 steps of the trace crypto/ct/ct_log.c:185:11: Call 183. } 184. 185. ret = CTLOG_new_from_base64(pkey_base64, description); ^ 186. if (ret == NULL) { 187. CTerr(CT_F_CTLOG_NEW_FROM_CONF, CT_R_LOG_CONF_INVALID); crypto/ct/ct_b64.c:167:1: Parameter `pkey_base64->strlen` 165. } 166. 167. > CTLOG *CTLOG_new_from_base64(const char *pkey_base64, const char *name) 168. { 169. unsigned char *pkey_der = NULL; crypto/ct/ct_b64.c:170:24: Call 168. { 169. unsigned char *pkey_der = NULL; 170. int pkey_der_len = ct_base64_decode(pkey_base64, &pkey_der); ^ 171. const unsigned char *p; 172. EVP_PKEY *pkey = NULL; crypto/ct/ct_b64.c:73:1: Parameter `**out` 71. * the caller. Do not provide a pre-allocated string in |out|. 72. */ 73. > static int ct_base64_decode(const char *in, unsigned char **out) 74. { 75. size_t inlen = strlen(in); crypto/ct/ct_b64.c:180:5: Assignment 178. } 179. 180. p = pkey_der; ^ 181. pkey = d2i_PUBKEY(NULL, &p, pkey_der_len); 182. OPENSSL_free(pkey_der); crypto/ct/ct_b64.c:181:12: Call 179. 180. p = pkey_der; 181. pkey = d2i_PUBKEY(NULL, &p, pkey_der_len); ^ 182. OPENSSL_free(pkey_der); 183. if (pkey == NULL) { crypto/x509/x_pubkey.c:191:1: Parameter `**pp` 189. */ 190. 191. > EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, long length) 192. { 193. X509_PUBKEY *xpk; crypto/x509/x_pubkey.c:196:5: Assignment 194. EVP_PKEY *pktmp; 195. const unsigned char *q; 196. q = *pp; ^ 197. xpk = d2i_X509_PUBKEY(NULL, &q, length); 198. if (!xpk) crypto/x509/x_pubkey.c:197:11: Call 195. const unsigned char *q; 196. q = *pp; 197. xpk = d2i_X509_PUBKEY(NULL, &q, length); ^ 198. if (!xpk) 199. return NULL; crypto/x509/x_pubkey.c:101:1: Parameter `**in` 99. } ASN1_SEQUENCE_END_cb(X509_PUBKEY, X509_PUBKEY) 100. 101. > IMPLEMENT_ASN1_FUNCTIONS(X509_PUBKEY) 102. 103. int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) crypto/x509/x_pubkey.c:101:1: Call 99. } ASN1_SEQUENCE_END_cb(X509_PUBKEY, X509_PUBKEY) 100. 101. > IMPLEMENT_ASN1_FUNCTIONS(X509_PUBKEY) 102. 103. int X509_PUBKEY_set(X509_PUBKEY **x, EVP_PKEY *pkey) crypto/asn1/tasn_dec.c:143:1: Parameter `**in` 141. */ 142. 143. > ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, 144. const unsigned char **in, long len, 145. const ASN1_ITEM *it) crypto/asn1/tasn_dec.c:152:9: Call 150. pval = &ptmpval; 151. asn1_tlc_clear_nc(&c); 152. if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) ^ 153. return *pval; 154. return NULL; crypto/asn1/tasn_dec.c:157:1: Parameter `**in` 155. } 156. 157. > int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, 158. const ASN1_ITEM *it, 159. int tag, int aclass, char opt, ASN1_TLC *ctx) crypto/asn1/tasn_dec.c:162:10: Call 160. { 161. int rv; 162. rv = asn1_item_embed_d2i(pval, in, len, it, tag, aclass, opt, ctx); ^ 163. if (rv <= 0) 164. ASN1_item_ex_free(pval, it); crypto/asn1/tasn_dec.c:173:1: Parameter `**in` 171. */ 172. 173. > static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in, 174. long len, const ASN1_ITEM *it, 175. int tag, int aclass, char opt, ASN1_TLC *ctx) crypto/asn1/tasn_dec.c:217:9: Assignment 215. 216. case ASN1_ITYPE_MSTRING: 217. p = *in; ^ 218. /* Just read in tag and class */ 219. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, crypto/asn1/tasn_dec.c:219:15: Call 217. p = *in; 218. /* Just read in tag and class */ 219. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, ^ 220. &p, len, -1, 0, 1, ctx); 221. if (!ret) { crypto/asn1/tasn_dec.c:1096:1: Parameter `**in` 1094. */ 1095. 1096. > static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, 1097. char *inf, char *cst, 1098. const unsigned char **in, long len, crypto/asn1/tasn_dec.c:1105:5: Assignment 1103. long plen; 1104. const unsigned char *p, *q; 1105. p = *in; ^ 1106. q = p; 1107. crypto/asn1/tasn_dec.c:1115:13: Call 1113. p += ctx->hdrlen; 1114. } else { 1115. i = ASN1_get_object(&p, &plen, &ptag, &pclass, len); ^ 1116. if (ctx) { 1117. ctx->ret = i; crypto/asn1/asn1_lib.c:91:1: Parameter `**pp` 89. } 90. 91. > int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, 92. int *pclass, long omax) 93. { crypto/asn1/asn1_lib.c:96:5: Assignment 94. int i, ret; 95. long l; 96. const unsigned char *p = *pp; ^ 97. int tag, xclass, inf; 98. long max = omax; crypto/asn1/asn1_lib.c:125:9: Assignment 123. } else { 124. tag = i; 125. p++; ^ 126. if (--max == 0) 127. goto err; crypto/asn1/asn1_lib.c:131:10: Call 129. *ptag = tag; 130. *pclass = xclass; 131. if (!asn1_get_length(&p, &inf, plength, max)) ^ 132. goto err; 133. crypto/asn1/asn1_lib.c:152:1: <Length trace> 150. } 151. 152. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, 153. long max) 154. { crypto/asn1/asn1_lib.c:152:1: Parameter `**pp` 150. } 151. 152. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, 153. long max) 154. { crypto/asn1/asn1_lib.c:155:5: Assignment 153. long max) 154. { 155. const unsigned char *p = *pp; ^ 156. unsigned long ret = 0; 157. unsigned long i; crypto/asn1/asn1_lib.c:168:15: Assignment 166. *inf = 0; 167. i = *p & 0x7f; 168. if (*(p++) & 0x80) { ^ 169. if (max < (long)i + 1) 170. return 0; crypto/asn1/asn1_lib.c:172:25: Array access: Offset: [2, +oo] Size: [1, +oo] by call to `CTLOG_new_from_base64` 170. return 0; 171. /* Skip leading zeroes */ 172. while (i && *p == 0) { ^ 173. p++; 174. i--;
https://github.com/openssl/openssl/blob/79c7f74d6cefd5d32fa20e69195ad3de834ce065/crypto/asn1/asn1_lib.c/#L172
d2a_code_trace_data_43165
SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, float lumaSharpen, float chromaSharpen, float chromaHShift, float chromaVShift, int verbose) { SwsFilter *filter= av_malloc(sizeof(SwsFilter)); if (lumaGBlur!=0.0){ filter->lumH= sws_getGaussianVec(lumaGBlur, 3.0); filter->lumV= sws_getGaussianVec(lumaGBlur, 3.0); }else{ filter->lumH= sws_getIdentityVec(); filter->lumV= sws_getIdentityVec(); } if (chromaGBlur!=0.0){ filter->chrH= sws_getGaussianVec(chromaGBlur, 3.0); filter->chrV= sws_getGaussianVec(chromaGBlur, 3.0); }else{ filter->chrH= sws_getIdentityVec(); filter->chrV= sws_getIdentityVec(); } if (chromaSharpen!=0.0){ SwsVector *id= sws_getIdentityVec(); sws_scaleVec(filter->chrH, -chromaSharpen); sws_scaleVec(filter->chrV, -chromaSharpen); sws_addVec(filter->chrH, id); sws_addVec(filter->chrV, id); sws_freeVec(id); } if (lumaSharpen!=0.0){ SwsVector *id= sws_getIdentityVec(); sws_scaleVec(filter->lumH, -lumaSharpen); sws_scaleVec(filter->lumV, -lumaSharpen); sws_addVec(filter->lumH, id); sws_addVec(filter->lumV, id); sws_freeVec(id); } if (chromaHShift != 0.0) sws_shiftVec(filter->chrH, (int)(chromaHShift+0.5)); if (chromaVShift != 0.0) sws_shiftVec(filter->chrV, (int)(chromaVShift+0.5)); sws_normalizeVec(filter->chrH, 1.0); sws_normalizeVec(filter->chrV, 1.0); sws_normalizeVec(filter->lumH, 1.0); sws_normalizeVec(filter->lumV, 1.0); if (verbose) sws_printVec2(filter->chrH, NULL, AV_LOG_DEBUG); if (verbose) sws_printVec2(filter->lumH, NULL, AV_LOG_DEBUG); return filter; } libswscale/swscale.c:2838: error: Null Dereference pointer `filter` last assigned on line 2835 could be null and is dereferenced at line 2838, column 9. libswscale/swscale.c:2830:1: start of procedure sws_getDefaultFilter() 2828. #endif 2829. 2830. SwsFilter *sws_getDefaultFilter(float lumaGBlur, float chromaGBlur, ^ 2831. float lumaSharpen, float chromaSharpen, 2832. float chromaHShift, float chromaVShift, libswscale/swscale.c:2835:5: 2833. int verbose) 2834. { 2835. SwsFilter *filter= av_malloc(sizeof(SwsFilter)); ^ 2836. 2837. if (lumaGBlur!=0.0){ libavutil/mem.c:47:1: start of procedure av_malloc() 45. linker will do it automatically. */ 46. 47. void *av_malloc(unsigned int size) ^ 48. { 49. void *ptr = NULL; libavutil/mem.c:49:5: 47. void *av_malloc(unsigned int size) 48. { 49. void *ptr = NULL; ^ 50. #if CONFIG_MEMALIGN_HACK 51. long diff; libavutil/mem.c:55:8: Taking false branch 53. 54. /* let's disallow possible ambiguous cases */ 55. if(size > (INT_MAX-16) ) ^ 56. return NULL; 57. libavutil/mem.c:66:9: Taking true branch 64. ((char*)ptr)[-1]= diff; 65. #elif HAVE_POSIX_MEMALIGN 66. if (posix_memalign(&ptr,16,size)) ^ 67. ptr = NULL; 68. #elif HAVE_MEMALIGN libavutil/mem.c:67:9: 65. #elif HAVE_POSIX_MEMALIGN 66. if (posix_memalign(&ptr,16,size)) 67. ptr = NULL; ^ 68. #elif HAVE_MEMALIGN 69. ptr = memalign(16,size); libavutil/mem.c:99:5: 97. ptr = malloc(size); 98. #endif 99. return ptr; ^ 100. } 101. libavutil/mem.c:100:1: return from a call to av_malloc 98. #endif 99. return ptr; 100. } ^ 101. 102. void *av_realloc(void *ptr, unsigned int size) libswscale/swscale.c:2837:9: Taking true branch 2835. SwsFilter *filter= av_malloc(sizeof(SwsFilter)); 2836. 2837. if (lumaGBlur!=0.0){ ^ 2838. filter->lumH= sws_getGaussianVec(lumaGBlur, 3.0); 2839. filter->lumV= sws_getGaussianVec(lumaGBlur, 3.0); libswscale/swscale.c:2838:9: Skipping sws_getGaussianVec(): empty list of specs 2836. 2837. if (lumaGBlur!=0.0){ 2838. filter->lumH= sws_getGaussianVec(lumaGBlur, 3.0); ^ 2839. filter->lumV= sws_getGaussianVec(lumaGBlur, 3.0); 2840. }else{
https://github.com/libav/libav/blob/184bc53db4fded8857af09cee2adc7197940deb7/libswscale/swscale.c/#L2838
d2a_code_trace_data_43166
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dh/dh_check.c:49: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end`. Showing all 10 steps of the trace crypto/dh/dh_check.c:32:5: Call 30. if (ctx == NULL) 31. goto err; 32. BN_CTX_start(ctx); ^ 33. tmp = BN_CTX_get(ctx); 34. if (tmp == NULL) crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/dh/dh_check.c:49:9: Call 47. err: 48. if (ctx != NULL) { 49. BN_CTX_end(ctx); ^ 50. BN_CTX_free(ctx); 51. } crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.indexes` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:271:1: <Offset trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `st->depth` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: <Length trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `*st->indexes` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:273:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end` 271. static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; ^ 274. } 275.
https://github.com/openssl/openssl/blob/6f8950a3cc466a7e2660dd9d7c8e9d11f47643ed/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_43167
static ngx_int_t ngx_resolver_copy(ngx_resolver_t *r, ngx_str_t *name, u_char *buf, u_char *src, u_char *last) { char *err; u_char *p, *dst; ssize_t len; ngx_uint_t i, n; p = src; len = -1; for (i = 0; i < 128; i++) { n = *p++; if (n == 0) { goto done; } if (n & 0xc0) { n = ((n & 0x3f) << 8) + *p; p = &buf[n]; } else { len += 1 + n; p = &p[n]; } if (p >= last) { err = "name is out of response"; goto invalid; } } err = "compression pointers loop"; invalid: ngx_log_error(r->log_level, r->log, 0, err); return NGX_ERROR; done: if (name == NULL) { return NGX_OK; } dst = ngx_resolver_alloc(r, len); if (dst == NULL) { return NGX_ERROR; } name->data = dst; n = *src++; for ( ;; ) { if (n != 0xc0) { ngx_memcpy(dst, src, n); dst += n; src += n; n = *src++; if (n != 0) { *dst++ = '.'; } } else { n = ((n & 0x3f) << 8) + *src; src = &buf[n]; n = *src++; } if (n == 0) { name->len = dst - name->data; return NGX_OK; } } } src/core/ngx_resolver.c:1923: error: Buffer Overrun S2 Offset: [min(1, `*src`), +oo] Size: [0, +oo]. src/core/ngx_resolver.c:1852:1: <Length trace> 1850. 1851. 1852. static ngx_int_t ^ 1853. ngx_resolver_copy(ngx_resolver_t *r, ngx_str_t *name, u_char *buf, u_char *src, 1854. u_char *last) src/core/ngx_resolver.c:1852:1: Parameter `*src` 1850. 1851. 1852. static ngx_int_t ^ 1853. ngx_resolver_copy(ngx_resolver_t *r, ngx_str_t *name, u_char *buf, u_char *src, 1854. u_char *last) src/core/ngx_resolver.c:1912:5: Assignment 1910. name->data = dst; 1911. 1912. n = *src++; ^ 1913. 1914. for ( ;; ) { src/core/ngx_resolver.c:1917:13: Assignment 1915. if (n != 0xc0) { 1916. ngx_memcpy(dst, src, n); 1917. dst += n; ^ 1918. src += n; 1919. src/core/ngx_resolver.c:1923:17: Array access: Offset: [min(1, *src), +oo] Size: [0, +oo] 1921. 1922. if (n != 0) { 1923. *dst++ = '.'; ^ 1924. } 1925.
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_resolver.c/#L1923
d2a_code_trace_data_43168
int test_mod_mul(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b, *c, *d, *e; int i, j; a = BN_new(); b = BN_new(); c = BN_new(); d = BN_new(); e = BN_new(); BN_one(a); BN_one(b); BN_zero(c); if (BN_mod_mul(e, a, b, c, ctx)) { fprintf(stderr, "BN_mod_mul with zero modulus succeeded!\n"); return 0; } for (j = 0; j < 3; j++) { BN_bntest_rand(c, 1024, 0, 0); for (i = 0; i < num0; i++) { BN_bntest_rand(a, 475 + i * 10, 0, 0); BN_bntest_rand(b, 425 + i * 11, 0, 0); a->neg = rand_neg(); b->neg = rand_neg(); if (!BN_mod_mul(e, a, b, c, ctx)) { unsigned long l; while ((l = ERR_get_error())) fprintf(stderr, "ERROR:%s\n", ERR_error_string(l, NULL)); EXIT(1); } if (bp != NULL) { if (!results) { BN_print(bp, a); BIO_puts(bp, " * "); BN_print(bp, b); BIO_puts(bp, " % "); BN_print(bp, c); if ((a->neg ^ b->neg) && !BN_is_zero(e)) { BIO_puts(bp, " + "); BN_print(bp, c); } BIO_puts(bp, " - "); } BN_print(bp, e); BIO_puts(bp, "\n"); } BN_mul(d, a, b, ctx); BN_sub(d, d, e); BN_div(a, b, d, c, ctx); if (!BN_is_zero(b)) { fprintf(stderr, "Modulo multiply test failed!\n"); ERR_print_errors_fp(stderr); return 0; } } } BN_free(a); BN_free(b); BN_free(c); BN_free(d); BN_free(e); return (1); } test/bntest.c:921: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 913, column 9 is not reachable after line 921, column 17. Showing all 143 steps of the trace test/bntest.c:906:1: start of procedure test_mod_mul() 904. } 905. 906. > int test_mod_mul(BIO *bp, BN_CTX *ctx) 907. { 908. BIGNUM *a, *b, *c, *d, *e; test/bntest.c:911:5: 909. int i, j; 910. 911. > a = BN_new(); 912. b = BN_new(); 913. c = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:912:5: 910. 911. a = BN_new(); 912. > b = BN_new(); 913. c = BN_new(); 914. d = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:913:5: 911. a = BN_new(); 912. b = BN_new(); 913. > c = BN_new(); 914. d = BN_new(); 915. e = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:914:5: 912. b = BN_new(); 913. c = BN_new(); 914. > d = BN_new(); 915. e = BN_new(); 916. crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:915:5: 913. c = BN_new(); 914. d = BN_new(); 915. > e = BN_new(); 916. 917. BN_one(a); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:917:5: 915. e = BN_new(); 916. 917. > BN_one(a); 918. BN_one(b); 919. BN_zero(c); crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is true 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:918:5: 916. 917. BN_one(a); 918. > BN_one(b); 919. BN_zero(c); 920. if (BN_mod_mul(e, a, b, c, ctx)) { crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is true 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:919:5: 917. BN_one(a); 918. BN_one(b); 919. > BN_zero(c); 920. if (BN_mod_mul(e, a, b, c, ctx)) { 921. fprintf(stderr, "BN_mod_mul with zero modulus succeeded!\n"); crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is false 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:920:9: Taking true branch 918. BN_one(b); 919. BN_zero(c); 920. if (BN_mod_mul(e, a, b, c, ctx)) { ^ 921. fprintf(stderr, "BN_mod_mul with zero modulus succeeded!\n"); 922. return 0; test/bntest.c:921:9: 919. BN_zero(c); 920. if (BN_mod_mul(e, a, b, c, ctx)) { 921. > fprintf(stderr, "BN_mod_mul with zero modulus succeeded!\n"); 922. return 0; 923. }
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L921
d2a_code_trace_data_43169
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) { bn_check_top(b); if (a == b) return a; if (bn_wexpand(a, b->top) == NULL) return NULL; if (b->top > 0) memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); a->neg = b->neg; a->top = b->top; a->flags |= b->flags & BN_FLG_FIXED_TOP; bn_check_top(a); return a; } apps/ecparam.c:286: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `EC_GROUP_check`. Showing all 24 steps of the trace apps/ecparam.c:241:17: Call 239. } 240. 241. group = EC_GROUP_new_by_curve_name(nid); ^ 242. if (group == NULL) { 243. BIO_printf(bio_err, "unable to create curve (%s)\n", curve_name); crypto/ec/ec_curve.c:3131:19: Call 3129. for (i = 0; i < curve_list_length; i++) 3130. if (curve_list[i].nid == nid) { 3131. ret = ec_group_new_from_data(curve_list[i]); ^ 3132. break; 3133. } crypto/ec/ec_curve.c:3042:14: Call 3040. params += seed_len; /* skip seed */ 3041. 3042. if ((p = BN_bin2bn(params + 0 * param_len, param_len, NULL)) == NULL ^ 3043. || (a = BN_bin2bn(params + 1 * param_len, param_len, NULL)) == NULL 3044. || (b = BN_bin2bn(params + 2 * param_len, param_len, NULL)) == NULL) { crypto/bn/bn_lib.c:374:1: Parameter `ret->top` 372. } 373. 374. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) 375. { 376. unsigned int i, m; apps/ecparam.c:286:14: Call 284. if (check) { 285. BIO_printf(bio_err, "checking elliptic curve parameters: "); 286. if (!EC_GROUP_check(group, NULL)) { ^ 287. BIO_printf(bio_err, "failed\n"); 288. ERR_print_errors(bio_err); crypto/ec/ec_check.c:23:1: Parameter `group->order->top` 21. } 22. 23. > int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx) 24. { 25. int ret = 0; crypto/ec/ec_check.c:69:9: Call 67. if (order == NULL) 68. goto err; 69. if (BN_is_zero(order)) { ^ 70. ECerr(EC_F_EC_GROUP_CHECK, EC_R_UNDEFINED_ORDER); 71. goto err; crypto/bn/bn_lib.c:866:1: Parameter `a->top` 864. } 865. 866. > int BN_is_zero(const BIGNUM *a) 867. { 868. return a->top == 0; crypto/ec/ec_check.c:74:10: Call 72. } 73. 74. if (!EC_POINT_mul(group, point, order, NULL, NULL, ctx)) ^ 75. goto err; 76. if (!EC_POINT_is_at_infinity(group, point)) { crypto/ec/ec_lib.c:971:1: Parameter `g_scalar->top` 969. } 970. 971. > int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, 972. const EC_POINT *point, const BIGNUM *p_scalar, BN_CTX *ctx) 973. { crypto/ec/ec_lib.c:982:12: Call 980. scalars[0] = p_scalar; 981. 982. return EC_POINTs_mul(group, r, g_scalar, ^ 983. (point != NULL 984. && p_scalar != NULL), points, scalars, ctx); crypto/ec/ec_lib.c:933:1: Parameter `scalar->top` 931. */ 932. 933. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 934. size_t num, const EC_POINT *points[], 935. const BIGNUM *scalars[], BN_CTX *ctx) crypto/ec/ec_lib.c:965:15: Call 963. else 964. /* use default */ 965. ret = ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx); ^ 966. 967. BN_CTX_free(new_ctx); crypto/ec/ec_mult.c:410:1: Parameter `scalar->top` 408. * in the addition if scalar != NULL 409. */ 410. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 411. size_t num, const EC_POINT *points[], const BIGNUM *scalars[], 412. BN_CTX *ctx) crypto/ec/ec_mult.c:453:20: Call 451. * always call the ladder version. 452. */ 453. return ec_scalar_mul_ladder(group, r, scalar, NULL, ctx); ^ 454. } 455. if ((scalar == NULL) && (num == 1) && (scalars[0] != group->order)) { crypto/ec/ec_mult.c:139:1: Parameter `scalar->top` 137. * Returns 1 on success, 0 otherwise. 138. */ 139. > int ec_scalar_mul_ladder(const EC_GROUP *group, EC_POINT *r, 140. const BIGNUM *scalar, const EC_POINT *point, 141. BN_CTX *ctx) crypto/ec/ec_mult.c:215:10: Call 213. } 214. 215. if (!BN_copy(k, scalar)) { ^ 216. ECerr(EC_F_EC_SCALAR_MUL_LADDER, ERR_R_BN_LIB); 217. goto err; crypto/bn/bn_lib.c:281:1: <Offset trace> 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:281:1: Parameter `b->top` 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:281:1: <Length trace> 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:281:1: Parameter `*a->d` 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:287:9: Call 285. if (a == b) 286. return a; 287. if (bn_wexpand(a, b->top) == NULL) ^ 288. return NULL; 289. crypto/bn/bn_lib.c:962:1: Parameter `*a->d` 960. } 961. 962. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 963. { 964. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:291:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `EC_GROUP_check` 289. 290. if (b->top > 0) 291. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); ^ 292. 293. a->neg = b->neg;
https://github.com/openssl/openssl/blob/3051bf2afab7ac8b7b9c64e68755d1addd2fb8ff/crypto/bn/bn_lib.c/#L291
d2a_code_trace_data_43170
static int x509_certify(X509_STORE *ctx, const char *CAfile, const EVP_MD *digest, X509 *x, X509 *xca, EVP_PKEY *pkey, STACK_OF(OPENSSL_STRING) *sigopts, const char *serialfile, int create, int days, int clrext, CONF *conf, const char *section, ASN1_INTEGER *sno, int reqfile, int preserve_dates) { int ret = 0; ASN1_INTEGER *bs = NULL; X509_STORE_CTX *xsc = NULL; EVP_PKEY *upkey; upkey = X509_get0_pubkey(xca); if (upkey == NULL) { BIO_printf(bio_err, "Error obtaining CA X509 public key\n"); goto end; } EVP_PKEY_copy_parameters(upkey, pkey); xsc = X509_STORE_CTX_new(); if (xsc == NULL || !X509_STORE_CTX_init(xsc, ctx, x, NULL)) { BIO_printf(bio_err, "Error initialising X509 store\n"); goto end; } if (sno) bs = sno; else if ((bs = x509_load_serial(CAfile, serialfile, create)) == NULL) goto end; X509_STORE_CTX_set_cert(xsc, x); X509_STORE_CTX_set_flags(xsc, X509_V_FLAG_CHECK_SS_SIGNATURE); if (!reqfile && X509_verify_cert(xsc) <= 0) goto end; if (!X509_check_private_key(xca, pkey)) { BIO_printf(bio_err, "CA certificate and CA private key do not match\n"); goto end; } if (!X509_set_issuer_name(x, X509_get_subject_name(xca))) goto end; if (!X509_set_serialNumber(x, bs)) goto end; if (!preserve_dates && !set_cert_times(x, NULL, NULL, days)) goto end; if (clrext) { while (X509_get_ext_count(x) > 0) X509_delete_ext(x, 0); } if (conf != NULL) { X509V3_CTX ctx2; X509_set_version(x, 2); X509V3_set_ctx(&ctx2, xca, x, NULL, NULL, 0); X509V3_set_nconf(&ctx2, conf); if (!X509V3_EXT_add_nconf(conf, &ctx2, section, x)) goto end; } if (!do_X509_sign(x, pkey, digest, sigopts)) goto end; ret = 1; end: X509_STORE_CTX_free(xsc); if (!ret) ERR_print_errors(bio_err); if (!sno) ASN1_INTEGER_free(bs); return ret; } apps/x509.c:1018: error: MEMORY_LEAK memory dynamically allocated by call to `X509_STORE_CTX_new()` at line 967, column 11 is not reachable after line 1018, column 5. Showing all 108 steps of the trace apps/x509.c:948:1: start of procedure x509_certify() 946. } 947. 948. > static int x509_certify(X509_STORE *ctx, const char *CAfile, const EVP_MD *digest, 949. X509 *x, X509 *xca, EVP_PKEY *pkey, 950. STACK_OF(OPENSSL_STRING) *sigopts, apps/x509.c:955:5: 953. ASN1_INTEGER *sno, int reqfile, int preserve_dates) 954. { 955. > int ret = 0; 956. ASN1_INTEGER *bs = NULL; 957. X509_STORE_CTX *xsc = NULL; apps/x509.c:956:5: 954. { 955. int ret = 0; 956. > ASN1_INTEGER *bs = NULL; 957. X509_STORE_CTX *xsc = NULL; 958. EVP_PKEY *upkey; apps/x509.c:957:5: 955. int ret = 0; 956. ASN1_INTEGER *bs = NULL; 957. > X509_STORE_CTX *xsc = NULL; 958. EVP_PKEY *upkey; 959. apps/x509.c:960:5: 958. EVP_PKEY *upkey; 959. 960. > upkey = X509_get0_pubkey(xca); 961. if (upkey == NULL) { 962. BIO_printf(bio_err, "Error obtaining CA X509 public key\n"); crypto/x509/x509_cmp.c:264:1: start of procedure X509_get0_pubkey() 262. } 263. 264. > EVP_PKEY *X509_get0_pubkey(const X509 *x) 265. { 266. if (x == NULL) crypto/x509/x509_cmp.c:266:9: Taking false branch 264. EVP_PKEY *X509_get0_pubkey(const X509 *x) 265. { 266. if (x == NULL) ^ 267. return NULL; 268. return X509_PUBKEY_get0(x->cert_info.key); crypto/x509/x509_cmp.c:268:5: 266. if (x == NULL) 267. return NULL; 268. > return X509_PUBKEY_get0(x->cert_info.key); 269. } 270. crypto/x509/x_pubkey.c:140:1: start of procedure X509_PUBKEY_get0() 138. } 139. 140. > EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key) 141. { 142. EVP_PKEY *ret = NULL; crypto/x509/x_pubkey.c:142:5: 140. EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key) 141. { 142. > EVP_PKEY *ret = NULL; 143. 144. if (key == NULL || key->public_key == NULL) crypto/x509/x_pubkey.c:144:9: Taking false branch 142. EVP_PKEY *ret = NULL; 143. 144. if (key == NULL || key->public_key == NULL) ^ 145. return NULL; 146. crypto/x509/x_pubkey.c:144:24: Taking false branch 142. EVP_PKEY *ret = NULL; 143. 144. if (key == NULL || key->public_key == NULL) ^ 145. return NULL; 146. crypto/x509/x_pubkey.c:147:9: Taking true branch 145. return NULL; 146. 147. if (key->pkey != NULL) ^ 148. return key->pkey; 149. crypto/x509/x_pubkey.c:148:9: 146. 147. if (key->pkey != NULL) 148. > return key->pkey; 149. 150. /* crypto/x509/x_pubkey.c:166:1: return from a call to X509_PUBKEY_get0 164. 165. return NULL; 166. > } 167. 168. EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) crypto/x509/x509_cmp.c:269:1: return from a call to X509_get0_pubkey 267. return NULL; 268. return X509_PUBKEY_get0(x->cert_info.key); 269. > } 270. 271. EVP_PKEY *X509_get_pubkey(X509 *x) apps/x509.c:961:9: Taking false branch 959. 960. upkey = X509_get0_pubkey(xca); 961. if (upkey == NULL) { ^ 962. BIO_printf(bio_err, "Error obtaining CA X509 public key\n"); 963. goto end; apps/x509.c:965:5: 963. goto end; 964. } 965. > EVP_PKEY_copy_parameters(upkey, pkey); 966. 967. xsc = X509_STORE_CTX_new(); crypto/evp/p_lib.c:74:1: start of procedure EVP_PKEY_copy_parameters() 72. } 73. 74. > int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from) 75. { 76. if (to->type == EVP_PKEY_NONE) { crypto/evp/p_lib.c:76:9: Taking false branch 74. int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from) 75. { 76. if (to->type == EVP_PKEY_NONE) { ^ 77. if (EVP_PKEY_set_type(to, from->type) == 0) 78. return 0; crypto/evp/p_lib.c:79:16: Taking true branch 77. if (EVP_PKEY_set_type(to, from->type) == 0) 78. return 0; 79. } else if (to->type != from->type) { ^ 80. EVPerr(EVP_F_EVP_PKEY_COPY_PARAMETERS, EVP_R_DIFFERENT_KEY_TYPES); 81. goto err; crypto/evp/p_lib.c:80:9: Skipping ERR_put_error(): empty list of specs 78. return 0; 79. } else if (to->type != from->type) { 80. EVPerr(EVP_F_EVP_PKEY_COPY_PARAMETERS, EVP_R_DIFFERENT_KEY_TYPES); ^ 81. goto err; 82. } crypto/evp/p_lib.c:98:2: 96. if (from->ameth && from->ameth->param_copy) 97. return from->ameth->param_copy(to, from); 98. > err: 99. return 0; 100. } crypto/evp/p_lib.c:99:5: 97. return from->ameth->param_copy(to, from); 98. err: 99. > return 0; 100. } 101. crypto/evp/p_lib.c:100:1: return from a call to EVP_PKEY_copy_parameters 98. err: 99. return 0; 100. > } 101. 102. int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey) apps/x509.c:967:5: 965. EVP_PKEY_copy_parameters(upkey, pkey); 966. 967. > xsc = X509_STORE_CTX_new(); 968. if (xsc == NULL || !X509_STORE_CTX_init(xsc, ctx, x, NULL)) { 969. BIO_printf(bio_err, "Error initialising X509 store\n"); crypto/x509/x509_vfy.c:2151:1: start of procedure X509_STORE_CTX_new() 2149. } 2150. 2151. > X509_STORE_CTX *X509_STORE_CTX_new(void) 2152. { 2153. X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); crypto/x509/x509_vfy.c:2153:5: 2151. X509_STORE_CTX *X509_STORE_CTX_new(void) 2152. { 2153. > X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); 2154. 2155. if (ctx == NULL) { crypto/mem.c:221:1: start of procedure CRYPTO_zalloc() 219. } 220. 221. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 222. { 223. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:223:5: 221. void *CRYPTO_zalloc(size_t num, const char *file, int line) 222. { 223. > void *ret = CRYPTO_malloc(num, file, line); 224. 225. FAILTEST(); crypto/mem.c:192:1: start of procedure CRYPTO_malloc() 190. #endif 191. 192. > void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. void *ret = NULL; crypto/mem.c:194:5: 192. void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. > void *ret = NULL; 195. 196. INCREMENT(malloc_count); crypto/mem.c:197:9: Taking false branch 195. 196. INCREMENT(malloc_count); 197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 198. return malloc_impl(num, file, line); 199. crypto/mem.c:200:9: Taking false branch 198. return malloc_impl(num, file, line); 199. 200. if (num == 0) ^ 201. return NULL; 202. crypto/mem.c:204:5: 202. 203. FAILTEST(); 204. > allow_customize = 0; 205. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 206. if (call_malloc_debug) { crypto/mem.c:214:5: 212. } 213. #else 214. > (void)(file); (void)(line); 215. ret = malloc(num); 216. #endif crypto/mem.c:214:19: 212. } 213. #else 214. > (void)(file); (void)(line); 215. ret = malloc(num); 216. #endif crypto/mem.c:215:5: 213. #else 214. (void)(file); (void)(line); 215. > ret = malloc(num); 216. #endif 217. crypto/mem.c:218:5: 216. #endif 217. 218. > return ret; 219. } 220. crypto/mem.c:219:1: return from a call to CRYPTO_malloc 217. 218. return ret; 219. > } 220. 221. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:226:9: Taking true branch 224. 225. FAILTEST(); 226. if (ret != NULL) ^ 227. memset(ret, 0, num); 228. return ret; crypto/mem.c:227:9: 225. FAILTEST(); 226. if (ret != NULL) 227. > memset(ret, 0, num); 228. return ret; 229. } crypto/mem.c:228:5: 226. if (ret != NULL) 227. memset(ret, 0, num); 228. > return ret; 229. } 230. crypto/mem.c:229:1: return from a call to CRYPTO_zalloc 227. memset(ret, 0, num); 228. return ret; 229. > } 230. 231. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/x509/x509_vfy.c:2155:9: Taking false branch 2153. X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); 2154. 2155. if (ctx == NULL) { ^ 2156. X509err(X509_F_X509_STORE_CTX_NEW, ERR_R_MALLOC_FAILURE); 2157. return NULL; crypto/x509/x509_vfy.c:2159:5: 2157. return NULL; 2158. } 2159. > return ctx; 2160. } 2161. crypto/x509/x509_vfy.c:2160:1: return from a call to X509_STORE_CTX_new 2158. } 2159. return ctx; 2160. > } 2161. 2162. void X509_STORE_CTX_free(X509_STORE_CTX *ctx) apps/x509.c:968:9: Taking false branch 966. 967. xsc = X509_STORE_CTX_new(); 968. if (xsc == NULL || !X509_STORE_CTX_init(xsc, ctx, x, NULL)) { ^ 969. BIO_printf(bio_err, "Error initialising X509 store\n"); 970. goto end; apps/x509.c:968:25: Taking false branch 966. 967. xsc = X509_STORE_CTX_new(); 968. if (xsc == NULL || !X509_STORE_CTX_init(xsc, ctx, x, NULL)) { ^ 969. BIO_printf(bio_err, "Error initialising X509 store\n"); 970. goto end; apps/x509.c:972:9: Taking true branch 970. goto end; 971. } 972. if (sno) ^ 973. bs = sno; 974. else if ((bs = x509_load_serial(CAfile, serialfile, create)) == NULL) apps/x509.c:973:9: 971. } 972. if (sno) 973. > bs = sno; 974. else if ((bs = x509_load_serial(CAfile, serialfile, create)) == NULL) 975. goto end; apps/x509.c:981:5: 979. * certificate request in which case it is not. 980. */ 981. > X509_STORE_CTX_set_cert(xsc, x); 982. X509_STORE_CTX_set_flags(xsc, X509_V_FLAG_CHECK_SS_SIGNATURE); 983. if (!reqfile && X509_verify_cert(xsc) <= 0) crypto/x509/x509_vfy.c:2060:1: start of procedure X509_STORE_CTX_set_cert() 2058. } 2059. 2060. > void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx, X509 *x) 2061. { 2062. ctx->cert = x; crypto/x509/x509_vfy.c:2062:5: 2060. void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx, X509 *x) 2061. { 2062. > ctx->cert = x; 2063. } 2064. crypto/x509/x509_vfy.c:2063:1: return from a call to X509_STORE_CTX_set_cert 2061. { 2062. ctx->cert = x; 2063. > } 2064. 2065. void X509_STORE_CTX_set0_crls(X509_STORE_CTX *ctx, STACK_OF(X509_CRL) *sk) apps/x509.c:982:5: 980. */ 981. X509_STORE_CTX_set_cert(xsc, x); 982. > X509_STORE_CTX_set_flags(xsc, X509_V_FLAG_CHECK_SS_SIGNATURE); 983. if (!reqfile && X509_verify_cert(xsc) <= 0) 984. goto end; crypto/x509/x509_vfy.c:2351:1: start of procedure X509_STORE_CTX_set_flags() 2349. } 2350. 2351. > void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags) 2352. { 2353. X509_VERIFY_PARAM_set_flags(ctx->param, flags); crypto/x509/x509_vfy.c:2353:5: 2351. void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags) 2352. { 2353. > X509_VERIFY_PARAM_set_flags(ctx->param, flags); 2354. } 2355. crypto/x509/x509_vpm.c:271:1: start of procedure X509_VERIFY_PARAM_set_flags() 269. } 270. 271. > int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags) 272. { 273. param->flags |= flags; crypto/x509/x509_vpm.c:273:5: 271. int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags) 272. { 273. > param->flags |= flags; 274. if (flags & X509_V_FLAG_POLICY_MASK) 275. param->flags |= X509_V_FLAG_POLICY_CHECK; crypto/x509/x509_vpm.c:274:9: Taking false branch 272. { 273. param->flags |= flags; 274. if (flags & X509_V_FLAG_POLICY_MASK) ^ 275. param->flags |= X509_V_FLAG_POLICY_CHECK; 276. return 1; crypto/x509/x509_vpm.c:276:5: 274. if (flags & X509_V_FLAG_POLICY_MASK) 275. param->flags |= X509_V_FLAG_POLICY_CHECK; 276. > return 1; 277. } 278. crypto/x509/x509_vpm.c:277:1: return from a call to X509_VERIFY_PARAM_set_flags 275. param->flags |= X509_V_FLAG_POLICY_CHECK; 276. return 1; 277. > } 278. 279. int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param, crypto/x509/x509_vfy.c:2354:1: return from a call to X509_STORE_CTX_set_flags 2352. { 2353. X509_VERIFY_PARAM_set_flags(ctx->param, flags); 2354. > } 2355. 2356. void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags, apps/x509.c:983:10: Taking true branch 981. X509_STORE_CTX_set_cert(xsc, x); 982. X509_STORE_CTX_set_flags(xsc, X509_V_FLAG_CHECK_SS_SIGNATURE); 983. if (!reqfile && X509_verify_cert(xsc) <= 0) ^ 984. goto end; 985. apps/x509.c:983:21: 981. X509_STORE_CTX_set_cert(xsc, x); 982. X509_STORE_CTX_set_flags(xsc, X509_V_FLAG_CHECK_SS_SIGNATURE); 983. > if (!reqfile && X509_verify_cert(xsc) <= 0) 984. goto end; 985. crypto/x509/x509_vfy.c:253:1: start of procedure X509_verify_cert() 251. } 252. 253. > int X509_verify_cert(X509_STORE_CTX *ctx) 254. { 255. SSL_DANE *dane = ctx->dane; crypto/x509/x509_vfy.c:255:5: 253. int X509_verify_cert(X509_STORE_CTX *ctx) 254. { 255. > SSL_DANE *dane = ctx->dane; 256. int ret; 257. crypto/x509/x509_vfy.c:258:9: Taking false branch 256. int ret; 257. 258. if (ctx->cert == NULL) { ^ 259. X509err(X509_F_X509_VERIFY_CERT, X509_R_NO_CERT_SET_FOR_US_TO_VERIFY); 260. ctx->error = X509_V_ERR_INVALID_CALL; crypto/x509/x509_vfy.c:264:9: Taking false branch 262. } 263. 264. if (ctx->chain != NULL) { ^ 265. /* 266. * This X509_STORE_CTX has already been used to verify a cert. We crypto/x509/x509_vfy.c:278:10: 276. * the first entry is in place 277. */ 278. > if (((ctx->chain = sk_X509_new_null()) == NULL) || 279. (!sk_X509_push(ctx->chain, ctx->cert))) { 280. X509err(X509_F_X509_VERIFY_CERT, ERR_R_MALLOC_FAILURE); include/openssl/x509.h:99:1: start of procedure sk_X509_new_null() 97. typedef struct x509_cinf_st X509_CINF; 98. 99. > DEFINE_STACK_OF(X509) 100. 101. /* This is used for a table of trust checking functions */ crypto/stack/stack.c:112:1: start of procedure OPENSSL_sk_new_null() 110. } 111. 112. > OPENSSL_STACK *OPENSSL_sk_new_null(void) 113. { 114. return OPENSSL_sk_new_reserve(NULL, 0); crypto/stack/stack.c:114:5: Skipping OPENSSL_sk_new_reserve(): empty list of specs 112. OPENSSL_STACK *OPENSSL_sk_new_null(void) 113. { 114. return OPENSSL_sk_new_reserve(NULL, 0); ^ 115. } 116. crypto/stack/stack.c:115:1: return from a call to OPENSSL_sk_new_null 113. { 114. return OPENSSL_sk_new_reserve(NULL, 0); 115. > } 116. 117. OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc c) include/openssl/x509.h:99:1: return from a call to sk_X509_new_null 97. typedef struct x509_cinf_st X509_CINF; 98. 99. > DEFINE_STACK_OF(X509) 100. 101. /* This is used for a table of trust checking functions */ crypto/x509/x509_vfy.c:278:10: Taking false branch 276. * the first entry is in place 277. */ 278. if (((ctx->chain = sk_X509_new_null()) == NULL) || ^ 279. (!sk_X509_push(ctx->chain, ctx->cert))) { 280. X509err(X509_F_X509_VERIFY_CERT, ERR_R_MALLOC_FAILURE); crypto/x509/x509_vfy.c:279:11: 277. */ 278. if (((ctx->chain = sk_X509_new_null()) == NULL) || 279. > (!sk_X509_push(ctx->chain, ctx->cert))) { 280. X509err(X509_F_X509_VERIFY_CERT, ERR_R_MALLOC_FAILURE); 281. ctx->error = X509_V_ERR_OUT_OF_MEM; include/openssl/x509.h:99:1: start of procedure sk_X509_push() 97. typedef struct x509_cinf_st X509_CINF; 98. 99. > DEFINE_STACK_OF(X509) 100. 101. /* This is used for a table of trust checking functions */ crypto/stack/stack.c:321:1: start of procedure OPENSSL_sk_push() 319. } 320. 321. > int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data) 322. { 323. if (st == NULL) crypto/stack/stack.c:323:9: Taking false branch 321. int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data) 322. { 323. if (st == NULL) ^ 324. return -1; 325. return OPENSSL_sk_insert(st, data, st->num); crypto/stack/stack.c:325:5: 323. if (st == NULL) 324. return -1; 325. > return OPENSSL_sk_insert(st, data, st->num); 326. } 327. crypto/stack/stack.c:232:1: start of procedure OPENSSL_sk_insert() 230. } 231. 232. > int OPENSSL_sk_insert(OPENSSL_STACK *st, const void *data, int loc) 233. { 234. if (st == NULL || st->num == max_nodes) crypto/stack/stack.c:234:9: Taking false branch 232. int OPENSSL_sk_insert(OPENSSL_STACK *st, const void *data, int loc) 233. { 234. if (st == NULL || st->num == max_nodes) ^ 235. return 0; 236. crypto/stack/stack.c:234:23: Taking true branch 232. int OPENSSL_sk_insert(OPENSSL_STACK *st, const void *data, int loc) 233. { 234. if (st == NULL || st->num == max_nodes) ^ 235. return 0; 236. crypto/stack/stack.c:235:9: 233. { 234. if (st == NULL || st->num == max_nodes) 235. > return 0; 236. 237. if (!sk_reserve(st, 1, 0)) crypto/stack/stack.c:250:1: return from a call to OPENSSL_sk_insert 248. st->sorted = 0; 249. return st->num; 250. > } 251. 252. static ossl_inline void *internal_delete(OPENSSL_STACK *st, int loc) crypto/stack/stack.c:326:1: return from a call to OPENSSL_sk_push 324. return -1; 325. return OPENSSL_sk_insert(st, data, st->num); 326. > } 327. 328. int OPENSSL_sk_unshift(OPENSSL_STACK *st, const void *data) include/openssl/x509.h:99:1: return from a call to sk_X509_push 97. typedef struct x509_cinf_st X509_CINF; 98. 99. > DEFINE_STACK_OF(X509) 100. 101. /* This is used for a table of trust checking functions */ crypto/x509/x509_vfy.c:279:11: Taking true branch 277. */ 278. if (((ctx->chain = sk_X509_new_null()) == NULL) || 279. (!sk_X509_push(ctx->chain, ctx->cert))) { ^ 280. X509err(X509_F_X509_VERIFY_CERT, ERR_R_MALLOC_FAILURE); 281. ctx->error = X509_V_ERR_OUT_OF_MEM; crypto/x509/x509_vfy.c:280:9: Skipping ERR_put_error(): empty list of specs 278. if (((ctx->chain = sk_X509_new_null()) == NULL) || 279. (!sk_X509_push(ctx->chain, ctx->cert))) { 280. X509err(X509_F_X509_VERIFY_CERT, ERR_R_MALLOC_FAILURE); ^ 281. ctx->error = X509_V_ERR_OUT_OF_MEM; 282. return -1; crypto/x509/x509_vfy.c:281:9: 279. (!sk_X509_push(ctx->chain, ctx->cert))) { 280. X509err(X509_F_X509_VERIFY_CERT, ERR_R_MALLOC_FAILURE); 281. > ctx->error = X509_V_ERR_OUT_OF_MEM; 282. return -1; 283. } crypto/x509/x509_vfy.c:282:9: 280. X509err(X509_F_X509_VERIFY_CERT, ERR_R_MALLOC_FAILURE); 281. ctx->error = X509_V_ERR_OUT_OF_MEM; 282. > return -1; 283. } 284. X509_up_ref(ctx->cert); crypto/x509/x509_vfy.c:305:1: return from a call to X509_verify_cert 303. ctx->error = X509_V_ERR_UNSPECIFIED; 304. return ret; 305. > } 306. 307. /* apps/x509.c:983:21: Taking true branch 981. X509_STORE_CTX_set_cert(xsc, x); 982. X509_STORE_CTX_set_flags(xsc, X509_V_FLAG_CHECK_SS_SIGNATURE); 983. if (!reqfile && X509_verify_cert(xsc) <= 0) ^ 984. goto end; 985. apps/x509.c:1017:2: 1015. goto end; 1016. ret = 1; 1017. > end: 1018. X509_STORE_CTX_free(xsc); 1019. if (!ret) apps/x509.c:1018:5: 1016. ret = 1; 1017. end: 1018. > X509_STORE_CTX_free(xsc); 1019. if (!ret) 1020. ERR_print_errors(bio_err); crypto/x509/x509_vfy.c:2162:1: start of procedure X509_STORE_CTX_free() 2160. } 2161. 2162. > void X509_STORE_CTX_free(X509_STORE_CTX *ctx) 2163. { 2164. if (ctx == NULL) crypto/x509/x509_vfy.c:2164:9: Taking false branch 2162. void X509_STORE_CTX_free(X509_STORE_CTX *ctx) 2163. { 2164. if (ctx == NULL) ^ 2165. return; 2166. crypto/x509/x509_vfy.c:2167:5: Skipping X509_STORE_CTX_cleanup(): empty list of specs 2165. return; 2166. 2167. X509_STORE_CTX_cleanup(ctx); ^ 2168. OPENSSL_free(ctx); 2169. } crypto/x509/x509_vfy.c:2168:5: 2166. 2167. X509_STORE_CTX_cleanup(ctx); 2168. > OPENSSL_free(ctx); 2169. } 2170. crypto/mem.c:289:1: start of procedure CRYPTO_free() 287. } 288. 289. > void CRYPTO_free(void *str, const char *file, int line) 290. { 291. INCREMENT(free_count); crypto/mem.c:292:9: Taking true branch 290. { 291. INCREMENT(free_count); 292. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 293. free_impl(str, file, line); 294. return; crypto/mem.c:292:30: Taking true branch 290. { 291. INCREMENT(free_count); 292. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 293. free_impl(str, file, line); 294. return; crypto/mem.c:293:9: Skipping __function_pointer__(): unresolved function pointer 291. INCREMENT(free_count); 292. if (free_impl != NULL && free_impl != &CRYPTO_free) { 293. free_impl(str, file, line); ^ 294. return; 295. } crypto/mem.c:294:9: 292. if (free_impl != NULL && free_impl != &CRYPTO_free) { 293. free_impl(str, file, line); 294. > return; 295. } 296. crypto/mem.c:308:1: return from a call to CRYPTO_free 306. free(str); 307. #endif 308. > } 309. 310. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/x509/x509_vfy.c:2169:1: return from a call to X509_STORE_CTX_free 2167. X509_STORE_CTX_cleanup(ctx); 2168. OPENSSL_free(ctx); 2169. > } 2170. 2171. int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509,
https://github.com/openssl/openssl/blob/dab2cd68e7cc304c9b1a4e7cee18a98711771a53/apps/x509.c/#L1018
d2a_code_trace_data_43171
EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md) { ssl_clear_hash_ctx(hash); *hash = EVP_MD_CTX_new(); if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { EVP_MD_CTX_free(*hash); *hash = NULL; return NULL; } return *hash; } ssl/ssl_lib.c:4238: error: MEMORY_LEAK memory dynamically allocated to `*hash` by call to `EVP_MD_CTX_new()` at line 4235, column 13 is not reachable after line 4238, column 9. Showing all 49 steps of the trace ssl/ssl_lib.c:4232:1: start of procedure ssl_replace_hash() 4230. */ 4231. 4232. > EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md) 4233. { 4234. ssl_clear_hash_ctx(hash); ssl/ssl_lib.c:4234:5: 4232. EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md) 4233. { 4234. > ssl_clear_hash_ctx(hash); 4235. *hash = EVP_MD_CTX_new(); 4236. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ssl/ssl_lib.c:4244:1: start of procedure ssl_clear_hash_ctx() 4242. } 4243. 4244. > void ssl_clear_hash_ctx(EVP_MD_CTX **hash) 4245. { 4246. ssl/ssl_lib.c:4247:5: 4245. { 4246. 4247. > EVP_MD_CTX_free(*hash); 4248. *hash = NULL; 4249. } crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_free() 47. } 48. 49. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 50. { 51. EVP_MD_CTX_reset(ctx); crypto/evp/digest.c:51:5: Skipping EVP_MD_CTX_reset(): empty list of specs 49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 50. { 51. EVP_MD_CTX_reset(ctx); ^ 52. OPENSSL_free(ctx); 53. } crypto/evp/digest.c:52:5: 50. { 51. EVP_MD_CTX_reset(ctx); 52. > OPENSSL_free(ctx); 53. } 54. crypto/mem.c:286:1: start of procedure CRYPTO_free() 284. } 285. 286. > void CRYPTO_free(void *str, const char *file, int line) 287. { 288. INCREMENT(free_count); crypto/mem.c:289:9: Taking false branch 287. { 288. INCREMENT(free_count); 289. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 290. free_impl(str, file, line); 291. return; crypto/mem.c:303:5: 301. } 302. #else 303. > free(str); 304. #endif 305. } crypto/mem.c:305:1: return from a call to CRYPTO_free 303. free(str); 304. #endif 305. > } 306. 307. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/evp/digest.c:53:1: return from a call to EVP_MD_CTX_free 51. EVP_MD_CTX_reset(ctx); 52. OPENSSL_free(ctx); 53. > } 54. 55. int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) ssl/ssl_lib.c:4248:5: 4246. 4247. EVP_MD_CTX_free(*hash); 4248. > *hash = NULL; 4249. } 4250. ssl/ssl_lib.c:4249:1: return from a call to ssl_clear_hash_ctx 4247. EVP_MD_CTX_free(*hash); 4248. *hash = NULL; 4249. > } 4250. 4251. /* Retrieve handshake hashes */ ssl/ssl_lib.c:4235:5: 4233. { 4234. ssl_clear_hash_ctx(hash); 4235. > *hash = EVP_MD_CTX_new(); 4236. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { 4237. EVP_MD_CTX_free(*hash); crypto/evp/digest.c:44:1: start of procedure EVP_MD_CTX_new() 42. } 43. 44. > EVP_MD_CTX *EVP_MD_CTX_new(void) 45. { 46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); crypto/evp/digest.c:46:5: 44. EVP_MD_CTX *EVP_MD_CTX_new(void) 45. { 46. > return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 47. } 48. crypto/mem.c:218:1: start of procedure CRYPTO_zalloc() 216. } 217. 218. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 219. { 220. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:220:5: 218. void *CRYPTO_zalloc(size_t num, const char *file, int line) 219. { 220. > void *ret = CRYPTO_malloc(num, file, line); 221. 222. FAILTEST(); crypto/mem.c:189:1: start of procedure CRYPTO_malloc() 187. #endif 188. 189. > void *CRYPTO_malloc(size_t num, const char *file, int line) 190. { 191. void *ret = NULL; crypto/mem.c:191:5: 189. void *CRYPTO_malloc(size_t num, const char *file, int line) 190. { 191. > void *ret = NULL; 192. 193. INCREMENT(malloc_count); crypto/mem.c:194:9: Taking false branch 192. 193. INCREMENT(malloc_count); 194. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 195. return malloc_impl(num, file, line); 196. crypto/mem.c:197:9: Taking false branch 195. return malloc_impl(num, file, line); 196. 197. if (num == 0) ^ 198. return NULL; 199. crypto/mem.c:201:5: 199. 200. FAILTEST(); 201. > allow_customize = 0; 202. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 203. if (call_malloc_debug) { crypto/mem.c:211:5: 209. } 210. #else 211. > (void)(file); (void)(line); 212. ret = malloc(num); 213. #endif crypto/mem.c:211:19: 209. } 210. #else 211. > (void)(file); (void)(line); 212. ret = malloc(num); 213. #endif crypto/mem.c:212:5: 210. #else 211. (void)(file); (void)(line); 212. > ret = malloc(num); 213. #endif 214. crypto/mem.c:215:5: 213. #endif 214. 215. > return ret; 216. } 217. crypto/mem.c:216:1: return from a call to CRYPTO_malloc 214. 215. return ret; 216. > } 217. 218. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:223:9: Taking true branch 221. 222. FAILTEST(); 223. if (ret != NULL) ^ 224. memset(ret, 0, num); 225. return ret; crypto/mem.c:224:9: 222. FAILTEST(); 223. if (ret != NULL) 224. > memset(ret, 0, num); 225. return ret; 226. } crypto/mem.c:225:5: 223. if (ret != NULL) 224. memset(ret, 0, num); 225. > return ret; 226. } 227. crypto/mem.c:226:1: return from a call to CRYPTO_zalloc 224. memset(ret, 0, num); 225. return ret; 226. > } 227. 228. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/evp/digest.c:47:1: return from a call to EVP_MD_CTX_new 45. { 46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 47. > } 48. 49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) ssl/ssl_lib.c:4236:9: Taking false branch 4234. ssl_clear_hash_ctx(hash); 4235. *hash = EVP_MD_CTX_new(); 4236. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ^ 4237. EVP_MD_CTX_free(*hash); 4238. *hash = NULL; ssl/ssl_lib.c:4236:27: Taking true branch 4234. ssl_clear_hash_ctx(hash); 4235. *hash = EVP_MD_CTX_new(); 4236. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ^ 4237. EVP_MD_CTX_free(*hash); 4238. *hash = NULL; ssl/ssl_lib.c:4236:33: Taking true branch 4234. ssl_clear_hash_ctx(hash); 4235. *hash = EVP_MD_CTX_new(); 4236. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ^ 4237. EVP_MD_CTX_free(*hash); 4238. *hash = NULL; ssl/ssl_lib.c:4237:9: 4235. *hash = EVP_MD_CTX_new(); 4236. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { 4237. > EVP_MD_CTX_free(*hash); 4238. *hash = NULL; 4239. return NULL; crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_free() 47. } 48. 49. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 50. { 51. EVP_MD_CTX_reset(ctx); crypto/evp/digest.c:51:5: Skipping EVP_MD_CTX_reset(): empty list of specs 49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 50. { 51. EVP_MD_CTX_reset(ctx); ^ 52. OPENSSL_free(ctx); 53. } crypto/evp/digest.c:52:5: 50. { 51. EVP_MD_CTX_reset(ctx); 52. > OPENSSL_free(ctx); 53. } 54. crypto/mem.c:286:1: start of procedure CRYPTO_free() 284. } 285. 286. > void CRYPTO_free(void *str, const char *file, int line) 287. { 288. INCREMENT(free_count); crypto/mem.c:289:9: Taking true branch 287. { 288. INCREMENT(free_count); 289. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 290. free_impl(str, file, line); 291. return; crypto/mem.c:289:30: Taking true branch 287. { 288. INCREMENT(free_count); 289. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 290. free_impl(str, file, line); 291. return; crypto/mem.c:290:9: Skipping __function_pointer__(): unresolved function pointer 288. INCREMENT(free_count); 289. if (free_impl != NULL && free_impl != &CRYPTO_free) { 290. free_impl(str, file, line); ^ 291. return; 292. } crypto/mem.c:291:9: 289. if (free_impl != NULL && free_impl != &CRYPTO_free) { 290. free_impl(str, file, line); 291. > return; 292. } 293. crypto/mem.c:305:1: return from a call to CRYPTO_free 303. free(str); 304. #endif 305. > } 306. 307. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/evp/digest.c:53:1: return from a call to EVP_MD_CTX_free 51. EVP_MD_CTX_reset(ctx); 52. OPENSSL_free(ctx); 53. > } 54. 55. int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) ssl/ssl_lib.c:4238:9: 4236. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { 4237. EVP_MD_CTX_free(*hash); 4238. > *hash = NULL; 4239. return NULL; 4240. }
https://github.com/openssl/openssl/blob/fce78bd4ede74d4fa7bd1c8195d8f7bc9403bd4c/ssl/ssl_lib.c/#L4238
d2a_code_trace_data_43172
static ASN1_STRING *bn_to_asn1_string(const BIGNUM *bn, ASN1_STRING *ai, int atype) { ASN1_INTEGER *ret; int len; if (ai == NULL) { ret = ASN1_STRING_type_new(atype); } else { ret = ai; ret->type = atype; } if (ret == NULL) { ASN1err(ASN1_F_BN_TO_ASN1_STRING, ERR_R_NESTED_ASN1_ERROR); goto err; } if (BN_is_negative(bn) && !BN_is_zero(bn)) ret->type |= V_ASN1_NEG_INTEGER; len = BN_num_bytes(bn); if (len == 0) len = 1; if (ASN1_STRING_set(ret, NULL, len) == 0) { ASN1err(ASN1_F_BN_TO_ASN1_STRING, ERR_R_MALLOC_FAILURE); goto err; } if (BN_is_zero(bn)) ret->data[0] = 0; else len = BN_bn2bin(bn, ret->data); ret->length = len; return ret; err: if (ret != ai) ASN1_INTEGER_free(ret); return (NULL); } crypto/asn1/a_int.c:545: error: NULL_DEREFERENCE pointer `null` is dereferenced by call to `ASN1_STRING_set()` at line 545, column 9. Showing all 78 steps of the trace crypto/asn1/a_int.c:519:1: start of procedure bn_to_asn1_string() 517. } 518. 519. > static ASN1_STRING *bn_to_asn1_string(const BIGNUM *bn, ASN1_STRING *ai, 520. int atype) 521. { crypto/asn1/a_int.c:525:9: Taking true branch 523. int len; 524. 525. if (ai == NULL) { ^ 526. ret = ASN1_STRING_type_new(atype); 527. } else { crypto/asn1/a_int.c:526:9: 524. 525. if (ai == NULL) { 526. > ret = ASN1_STRING_type_new(atype); 527. } else { 528. ret = ai; crypto/asn1/asn1_lib.c:349:1: start of procedure ASN1_STRING_type_new() 347. } 348. 349. > ASN1_STRING *ASN1_STRING_type_new(int type) 350. { 351. ASN1_STRING *ret; crypto/asn1/asn1_lib.c:353:5: 351. ASN1_STRING *ret; 352. 353. > ret = OPENSSL_zalloc(sizeof(*ret)); 354. if (ret == NULL) { 355. ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/asn1/asn1_lib.c:354:9: Taking false branch 352. 353. ret = OPENSSL_zalloc(sizeof(*ret)); 354. if (ret == NULL) { ^ 355. ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE); 356. return (NULL); crypto/asn1/asn1_lib.c:358:5: 356. return (NULL); 357. } 358. > ret->type = type; 359. return (ret); 360. } crypto/asn1/asn1_lib.c:359:5: 357. } 358. ret->type = type; 359. > return (ret); 360. } 361. crypto/asn1/asn1_lib.c:360:1: return from a call to ASN1_STRING_type_new 358. ret->type = type; 359. return (ret); 360. > } 361. 362. void ASN1_STRING_free(ASN1_STRING *a) crypto/asn1/a_int.c:532:9: Taking false branch 530. } 531. 532. if (ret == NULL) { ^ 533. ASN1err(ASN1_F_BN_TO_ASN1_STRING, ERR_R_NESTED_ASN1_ERROR); 534. goto err; crypto/asn1/a_int.c:537:9: 535. } 536. 537. > if (BN_is_negative(bn) && !BN_is_zero(bn)) 538. ret->type |= V_ASN1_NEG_INTEGER; 539. crypto/bn/bn_lib.c:919:1: start of procedure BN_is_negative() 917. } 918. 919. > int BN_is_negative(const BIGNUM *a) 920. { 921. return (a->neg != 0); crypto/bn/bn_lib.c:921:13: Condition is true 919. int BN_is_negative(const BIGNUM *a) 920. { 921. return (a->neg != 0); ^ 922. } 923. crypto/bn/bn_lib.c:921:5: 919. int BN_is_negative(const BIGNUM *a) 920. { 921. > return (a->neg != 0); 922. } 923. crypto/bn/bn_lib.c:922:1: return from a call to BN_is_negative 920. { 921. return (a->neg != 0); 922. > } 923. 924. int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, crypto/asn1/a_int.c:537:9: Taking true branch 535. } 536. 537. if (BN_is_negative(bn) && !BN_is_zero(bn)) ^ 538. ret->type |= V_ASN1_NEG_INTEGER; 539. crypto/asn1/a_int.c:537:32: 535. } 536. 537. > if (BN_is_negative(bn) && !BN_is_zero(bn)) 538. ret->type |= V_ASN1_NEG_INTEGER; 539. crypto/bn/bn_lib.c:899:1: start of procedure BN_is_zero() 897. } 898. 899. > int BN_is_zero(const BIGNUM *a) 900. { 901. return a->top == 0; crypto/bn/bn_lib.c:901:12: Condition is false 899. int BN_is_zero(const BIGNUM *a) 900. { 901. return a->top == 0; ^ 902. } 903. crypto/bn/bn_lib.c:901:5: 899. int BN_is_zero(const BIGNUM *a) 900. { 901. > return a->top == 0; 902. } 903. crypto/bn/bn_lib.c:902:1: return from a call to BN_is_zero 900. { 901. return a->top == 0; 902. > } 903. 904. int BN_is_one(const BIGNUM *a) crypto/asn1/a_int.c:537:32: Taking true branch 535. } 536. 537. if (BN_is_negative(bn) && !BN_is_zero(bn)) ^ 538. ret->type |= V_ASN1_NEG_INTEGER; 539. crypto/asn1/a_int.c:538:9: 536. 537. if (BN_is_negative(bn) && !BN_is_zero(bn)) 538. > ret->type |= V_ASN1_NEG_INTEGER; 539. 540. len = BN_num_bytes(bn); crypto/asn1/a_int.c:540:5: 538. ret->type |= V_ASN1_NEG_INTEGER; 539. 540. > len = BN_num_bytes(bn); 541. 542. if (len == 0) crypto/bn/bn_lib.c:215:1: start of procedure BN_num_bits() 213. } 214. 215. > int BN_num_bits(const BIGNUM *a) 216. { 217. int i = a->top - 1; crypto/bn/bn_lib.c:217:5: 215. int BN_num_bits(const BIGNUM *a) 216. { 217. > int i = a->top - 1; 218. bn_check_top(a); 219. crypto/bn/bn_lib.c:220:9: 218. bn_check_top(a); 219. 220. > if (BN_is_zero(a)) 221. return 0; 222. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); crypto/bn/bn_lib.c:899:1: start of procedure BN_is_zero() 897. } 898. 899. > int BN_is_zero(const BIGNUM *a) 900. { 901. return a->top == 0; crypto/bn/bn_lib.c:901:12: Condition is false 899. int BN_is_zero(const BIGNUM *a) 900. { 901. return a->top == 0; ^ 902. } 903. crypto/bn/bn_lib.c:901:5: 899. int BN_is_zero(const BIGNUM *a) 900. { 901. > return a->top == 0; 902. } 903. crypto/bn/bn_lib.c:902:1: return from a call to BN_is_zero 900. { 901. return a->top == 0; 902. > } 903. 904. int BN_is_one(const BIGNUM *a) crypto/bn/bn_lib.c:220:9: Taking false branch 218. bn_check_top(a); 219. 220. if (BN_is_zero(a)) ^ 221. return 0; 222. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); crypto/bn/bn_lib.c:222:5: Skipping BN_num_bits_word(): empty list of specs 220. if (BN_is_zero(a)) 221. return 0; 222. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); ^ 223. } 224. crypto/bn/bn_lib.c:223:1: return from a call to BN_num_bits 221. return 0; 222. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); 223. > } 224. 225. static void bn_free_d(BIGNUM *a) crypto/asn1/a_int.c:542:9: Taking false branch 540. len = BN_num_bytes(bn); 541. 542. if (len == 0) ^ 543. len = 1; 544. crypto/asn1/a_int.c:545:9: 543. len = 1; 544. 545. > if (ASN1_STRING_set(ret, NULL, len) == 0) { 546. ASN1err(ASN1_F_BN_TO_ASN1_STRING, ERR_R_MALLOC_FAILURE); 547. goto err; crypto/asn1/asn1_lib.c:308:1: start of procedure ASN1_STRING_set() 306. } 307. 308. > int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) 309. { 310. unsigned char *c; crypto/asn1/asn1_lib.c:311:5: 309. { 310. unsigned char *c; 311. > const char *data = _data; 312. 313. if (len < 0) { crypto/asn1/asn1_lib.c:313:9: Taking false branch 311. const char *data = _data; 312. 313. if (len < 0) { ^ 314. if (data == NULL) 315. return (0); crypto/asn1/asn1_lib.c:319:10: Taking false branch 317. len = strlen(data); 318. } 319. if ((str->length < len) || (str->data == NULL)) { ^ 320. c = str->data; 321. str->data = OPENSSL_realloc(c, len + 1); crypto/asn1/asn1_lib.c:319:33: Taking true branch 317. len = strlen(data); 318. } 319. if ((str->length < len) || (str->data == NULL)) { ^ 320. c = str->data; 321. str->data = OPENSSL_realloc(c, len + 1); crypto/asn1/asn1_lib.c:320:9: 318. } 319. if ((str->length < len) || (str->data == NULL)) { 320. > c = str->data; 321. str->data = OPENSSL_realloc(c, len + 1); 322. if (str->data == NULL) { crypto/asn1/asn1_lib.c:321:9: 319. if ((str->length < len) || (str->data == NULL)) { 320. c = str->data; 321. > str->data = OPENSSL_realloc(c, len + 1); 322. if (str->data == NULL) { 323. ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE); crypto/mem.c:166:1: start of procedure CRYPTO_realloc() 164. } 165. 166. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) 167. { 168. if (str == NULL) crypto/mem.c:168:9: Taking true branch 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) 167. { 168. if (str == NULL) ^ 169. return CRYPTO_malloc(num, file, line); 170. crypto/mem.c:169:9: 167. { 168. if (str == NULL) 169. > return CRYPTO_malloc(num, file, line); 170. 171. if (num == 0) { crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:191:1: return from a call to CRYPTO_realloc 189. return realloc(str, num); 190. 191. > } 192. 193. void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num, crypto/asn1/asn1_lib.c:322:13: Taking false branch 320. c = str->data; 321. str->data = OPENSSL_realloc(c, len + 1); 322. if (str->data == NULL) { ^ 323. ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE); 324. str->data = c; crypto/asn1/asn1_lib.c:328:5: 326. } 327. } 328. > str->length = len; 329. if (data != NULL) { 330. memcpy(str->data, data, len); crypto/asn1/asn1_lib.c:329:9: Taking true branch 327. } 328. str->length = len; 329. if (data != NULL) { ^ 330. memcpy(str->data, data, len); 331. /* an allowance for strings :-) */ crypto/asn1/asn1_lib.c:330:9: 328. str->length = len; 329. if (data != NULL) { 330. > memcpy(str->data, data, len); 331. /* an allowance for strings :-) */ 332. str->data[len] = '\0'; crypto/asn1/asn1_lib.c:332:9: 330. memcpy(str->data, data, len); 331. /* an allowance for strings :-) */ 332. > str->data[len] = '\0'; 333. } 334. return (1); crypto/asn1/asn1_lib.c:334:5: 332. str->data[len] = '\0'; 333. } 334. > return (1); 335. } 336. crypto/asn1/asn1_lib.c:335:1: return from a call to ASN1_STRING_set 333. } 334. return (1); 335. > } 336. 337. void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/asn1/a_int.c/#L545
d2a_code_trace_data_43173
void ngx_md5_update(ngx_md5_t *ctx, const void *data, size_t size) { size_t used, free; used = (size_t) (ctx->bytes & 0x3f); ctx->bytes += size; if (used) { free = 64 - used; if (size < free) { ngx_memcpy(&ctx->buffer[used], data, size); return; } ngx_memcpy(&ctx->buffer[used], data, free); data = (u_char *) data + free; size -= free; (void) ngx_md5_body(ctx, ctx->buffer, 64); } if (size >= 64) { data = ngx_md5_body(ctx, data, size & ~(size_t) 0x3f); size &= 0x3f; } ngx_memcpy(ctx->buffer, data, size); } src/http/ngx_http_file_cache.c:1282: error: Integer Overflow L2 ([1, 128] - [1, 63]):unsigned64 by call to `ngx_http_file_cache_vary`. src/http/ngx_http_file_cache.c:1276:13: Assignment 1274. if (c->vary.len > NGX_HTTP_CACHE_VARY_LEN) { 1275. /* should not happen */ 1276. c->vary.len = NGX_HTTP_CACHE_VARY_LEN; ^ 1277. } 1278. src/http/ngx_http_file_cache.c:1282:9: Call 1280. ngx_memcpy(h->vary, c->vary.data, c->vary.len); 1281. 1282. ngx_http_file_cache_vary(r, c->vary.data, c->vary.len, c->variant); ^ 1283. ngx_memcpy(h->variant, c->variant, NGX_HTTP_CACHE_KEY_LEN); 1284. } src/http/ngx_http_file_cache.c:1054:1: Array declaration 1052. 1053. 1054. static void ^ 1055. ngx_http_file_cache_vary(ngx_http_request_t *r, u_char *vary, size_t len, 1056. u_char *hash) src/http/ngx_http_file_cache.c:1071:5: Assignment 1069. ngx_strlow(buf, vary, len); 1070. 1071. p = buf; ^ 1072. last = buf + len; 1073. src/http/ngx_http_file_cache.c:1082:9: Assignment 1080. while (p < last && *p != ',' && *p != ' ') { p++; } 1081. 1082. name.len = p - name.data; ^ 1083. 1084. if (name.len == 0) { src/http/ngx_http_file_cache.c:1091:9: Call 1089. "http file cache vary: %V", &name); 1090. 1091. ngx_md5_update(&md5, name.data, name.len); ^ 1092. ngx_md5_update(&md5, (u_char *) ":", sizeof(":") - 1); 1093. src/core/ngx_md5.c:30:1: <LHS trace> 28. 29. 30. void ^ 31. ngx_md5_update(ngx_md5_t *ctx, const void *data, size_t size) 32. { src/core/ngx_md5.c:30:1: Parameter `size` 28. 29. 30. void ^ 31. ngx_md5_update(ngx_md5_t *ctx, const void *data, size_t size) 32. { src/core/ngx_md5.c:30:1: <RHS trace> 28. 29. 30. void ^ 31. ngx_md5_update(ngx_md5_t *ctx, const void *data, size_t size) 32. { src/core/ngx_md5.c:30:1: Parameter `size` 28. 29. 30. void ^ 31. ngx_md5_update(ngx_md5_t *ctx, const void *data, size_t size) 32. { src/core/ngx_md5.c:48:9: Binary operation: ([1, 128] - [1, 63]):unsigned64 by call to `ngx_http_file_cache_vary` 46. ngx_memcpy(&ctx->buffer[used], data, free); 47. data = (u_char *) data + free; 48. size -= free; ^ 49. (void) ngx_md5_body(ctx, ctx->buffer, 64); 50. }
https://github.com/nginx/nginx/blob/5544756296e5abaecb5f640753d6de939b701035/src/core/ngx_md5.c/#L48
d2a_code_trace_data_43174
void ff_lsp2polyf(const double *lsp, double *f, int lp_half_order) { int i, j; f[0] = 1.0; f[1] = -2 * lsp[0]; lsp -= 2; for(i=2; i<=lp_half_order; i++) { double val = -2 * lsp[2*i]; f[i] = val * f[i-1] + 2*f[i-2]; for(j=i-1; j>1; j--) f[j] += f[j-1] * val + f[j-2]; f[1] += val; } } libavcodec/lsp.c:131: error: Buffer Overrun L3 Offset: [1, +oo] (⇐ 1 + [0, +oo]) Size: [0, +oo] by call to `ff_lsp2polyf`. libavcodec/lsp.c:120:1: Parameter `lp_order` 118. } 119. 120. void ff_amrwb_lsp2lpc(const double *lsp, float *lp, int lp_order) ^ 121. { 122. int lp_half_order = lp_order >> 1; libavcodec/lsp.c:122:5: Assignment 120. void ff_amrwb_lsp2lpc(const double *lsp, float *lp, int lp_order) 121. { 122. int lp_half_order = lp_order >> 1; ^ 123. double buf[lp_half_order + 1]; 124. double pa[lp_half_order + 1]; libavcodec/lsp.c:131:5: Call 129. 130. ff_lsp2polyf(lsp , pa, lp_half_order ); 131. ff_lsp2polyf(lsp + 1, qa, lp_half_order - 1); ^ 132. 133. for (i = 1, j = lp_order - 1; i < lp_half_order; i++, j--) { libavcodec/lsp.c:165:1: <Offset trace> 163. } 164. 165. void ff_lsp2polyf(const double *lsp, double *f, int lp_half_order) ^ 166. { 167. int i, j; libavcodec/lsp.c:165:1: Parameter `lp_half_order` 163. } 164. 165. void ff_lsp2polyf(const double *lsp, double *f, int lp_half_order) ^ 166. { 167. int i, j; libavcodec/lsp.c:165:1: <Length trace> 163. } 164. 165. void ff_lsp2polyf(const double *lsp, double *f, int lp_half_order) ^ 166. { 167. int i, j; libavcodec/lsp.c:165:1: Parameter `*f` 163. } 164. 165. void ff_lsp2polyf(const double *lsp, double *f, int lp_half_order) ^ 166. { 167. int i, j; libavcodec/lsp.c:175:33: Array access: Offset: [1, +oo] (⇐ 1 + [0, +oo]) Size: [0, +oo] by call to `ff_lsp2polyf` 173. { 174. double val = -2 * lsp[2*i]; 175. f[i] = val * f[i-1] + 2*f[i-2]; ^ 176. for(j=i-1; j>1; j--) 177. f[j] += f[j-1] * val + f[j-2];
https://github.com/libav/libav/blob/539ff40c2d685508c62f040693df0f0facda39ff/libavcodec/lsp.c/#L175
d2a_code_trace_data_43175
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } if (allocbytes != NULL) *allocbytes = WPACKET_get_curr(pkt); return 1; } ssl/statem/statem_lib.c:257: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 6]):unsigned64 by call to `WPACKET_sub_memcpy__`. Showing all 14 steps of the trace ssl/statem/statem_lib.c:172:1: Parameter `pkt->written` 170. } 171. 172. > int tls_construct_cert_verify(SSL *s, WPACKET *pkt) 173. { 174. EVP_PKEY *pkey = NULL; ssl/statem/statem_lib.c:257:10: Call 255. #endif 256. 257. if (!WPACKET_sub_memcpy_u16(pkt, sig, siglen)) { ^ 258. SSLerr(SSL_F_TLS_CONSTRUCT_CERT_VERIFY, ERR_R_INTERNAL_ERROR); 259. goto err; ssl/packet.c:371:10: Call 369. size_t lenbytes) 370. { 371. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) ^ 372. || !WPACKET_memcpy(pkt, src, len) 373. || !WPACKET_close(pkt)) ssl/packet.c:275:1: Parameter `pkt->buf->length` 273. } 274. 275. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 276. { 277. WPACKET_SUB *sub; ssl/packet.c:372:17: Call 370. { 371. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) 372. || !WPACKET_memcpy(pkt, src, len) ^ 373. || !WPACKET_close(pkt)) 374. return 0; ssl/packet.c:353:1: Parameter `pkt->written` 351. } 352. 353. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) 354. { 355. unsigned char *dest; ssl/packet.c:360:10: Call 358. return 1; 359. 360. if (!WPACKET_allocate_bytes(pkt, len, &dest)) ^ 361. return 0; 362. ssl/packet.c:15:1: Parameter `pkt->written` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ssl/packet.c:17:10: Call 15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ^ 18. return 0; 19. ssl/packet.c:39:1: <LHS trace> 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: Parameter `pkt->buf->length` 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: <RHS trace> 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: Parameter `len` 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:49:36: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 6]):unsigned64 by call to `WPACKET_sub_memcpy__` 47. return 0; 48. 49. if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) { ^ 50. size_t newlen; 51. size_t reflen;
https://github.com/openssl/openssl/blob/d2b53fcdef9e7b482ff1e2d5f305ae798f3d1be2/ssl/packet.c/#L49
d2a_code_trace_data_43176
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } crypto/bn/bn_gf2m.c:735: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_priv_rand`. Showing all 19 steps of the trace crypto/bn/bn_gf2m.c:735:14: Call 733. /* generate blinding value */ 734. do { 735. if (!BN_priv_rand(b, BN_num_bits(p) - 1, ^ 736. BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY)) 737. goto err; crypto/bn/bn_rand.c:123:12: Call 121. int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom) 122. { 123. return bnrand(PRIVATE, rnd, bits, top, bottom, NULL); ^ 124. } 125. crypto/bn/bn_rand.c:23:1: Parameter `rnd->top` 21. } BNRAND_FLAG; 22. 23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, 24. BN_CTX *ctx) 25. { crypto/bn/bn_gf2m.c:735:14: Call 733. /* generate blinding value */ 734. do { 735. if (!BN_priv_rand(b, BN_num_bits(p) - 1, ^ 736. BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY)) 737. goto err; crypto/bn/bn_rand.c:121:1: Parameter `*rnd->d` 119. } 120. 121. > int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom) 122. { 123. return bnrand(PRIVATE, rnd, bits, top, bottom, NULL); crypto/bn/bn_rand.c:123:12: Call 121. int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom) 122. { 123. return bnrand(PRIVATE, rnd, bits, top, bottom, NULL); ^ 124. } 125. crypto/bn/bn_rand.c:23:1: Parameter `*rnd->d` 21. } BNRAND_FLAG; 22. 23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, 24. BN_CTX *ctx) 25. { crypto/bn/bn_rand.c:33:9: Call 31. if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY) 32. goto toosmall; 33. BN_zero(rnd); ^ 34. return 1; 35. } crypto/bn/bn_lib.c:361:1: Parameter `*a->d` 359. } 360. 361. > int BN_set_word(BIGNUM *a, BN_ULONG w) 362. { 363. bn_check_top(a); crypto/bn/bn_lib.c:364:9: Call 362. { 363. bn_check_top(a); 364. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 365. return 0; 366. a->neg = 0; crypto/bn/bn_lcl.h:660:1: Parameter `*a->d` 658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 659. 660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 661. { 662. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_lcl.h:668:12: Call 666. return a; 667. 668. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2); ^ 669. } 670. crypto/bn/bn_lib.c:245:1: Parameter `*b->d` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `*b->d` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_priv_rand` 230. assert(b->top <= words); 231. if (b->top > 0) 232. memcpy(a, b->d, sizeof(*a) * b->top); ^ 233. 234. return a;
https://github.com/openssl/openssl/blob/bd01733fdd9a5a0acdc72cf5c6601d37e8ddd801/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_43177
int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; pkt->written += len; pkt->curr += len; return 1; } ssl/t1_lib.c:1077: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + `s->tlsext_hostname->strlen` + 27]):unsigned64 by call to `WPACKET_start_sub_packet_len__`. Showing all 10 steps of the trace ssl/t1_lib.c:1076:21: Call 1074. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_srp) 1075. /* Sub-packet for SRP extension */ 1076. || !WPACKET_start_sub_packet_u16(pkt) ^ 1077. || !WPACKET_start_sub_packet_u8(pkt) 1078. /* login must not be zero...internal error if so */ ssl/packet.c:205:1: Parameter `pkt->buf->length` 203. } 204. 205. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 206. { 207. WPACKET_SUB *sub; ssl/t1_lib.c:1077:21: Call 1075. /* Sub-packet for SRP extension */ 1076. || !WPACKET_start_sub_packet_u16(pkt) 1077. || !WPACKET_start_sub_packet_u8(pkt) ^ 1078. /* login must not be zero...internal error if so */ 1079. || !WPACKET_set_flags(pkt, WPACKET_FLAGS_NON_ZERO_LENGTH) ssl/packet.c:205:1: Parameter `pkt->written` 203. } 204. 205. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 206. { 207. WPACKET_SUB *sub; ssl/packet.c:229:10: Call 227. } 228. 229. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 230. return 0; 231. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */ ssl/packet.c:15:1: <LHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `pkt->buf->length` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: <RHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `len` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:25:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + pkt->written + s->tlsext_hostname->strlen + 27]):unsigned64 by call to `WPACKET_start_sub_packet_len__` 23. return 0; 24. 25. if (pkt->buf->length - pkt->written < len) { ^ 26. size_t newlen; 27. size_t reflen;
https://github.com/openssl/openssl/blob/a6972f346248fbc37e42056bb943fae0896a2967/ssl/packet.c/#L25
d2a_code_trace_data_43178
static void contract(LHASH *lh) { LHASH_NODE **n,*n1,*np; np=lh->b[lh->p+lh->pmax-1]; lh->b[lh->p+lh->pmax-1]=NULL; if (lh->p == 0) { n=(LHASH_NODE **)Realloc(lh->b, (unsigned int)(sizeof(LHASH_NODE *)*lh->pmax)); if (n == NULL) { lh->error++; return; } lh->num_contract_reallocs++; lh->num_alloc_nodes/=2; lh->pmax/=2; lh->p=lh->pmax-1; lh->b=n; } else lh->p--; lh->num_nodes--; lh->num_contracts++; n1=lh->b[(int)lh->p]; if (n1 == NULL) lh->b[(int)lh->p]=np; else { while (n1->next != NULL) n1=n1->next; n1->next=np; } } ssl/s3_pkt.c:768: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `ssl3_get_record`. Showing all 15 steps of the trace ssl/s3_pkt.c:707:1: Parameter `s->ctx->sessions->p` 705. * none of our business 706. */ 707. > int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len) 708. { 709. int al,i,j,ret; ssl/s3_pkt.c:768:7: Call 766. if ((rr->length == 0) || (s->rstate == SSL_ST_READ_BODY)) 767. { 768. ret=ssl3_get_record(s); ^ 769. if (ret <= 0) return(ret); 770. } ssl/s3_pkt.c:231:1: Parameter `s->ctx->sessions->p` 229. */ 230. /* used only by ssl3_read_bytes */ 231. > static int ssl3_get_record(SSL *s) 232. { 233. int ssl_major,ssl_minor,al; ssl/s3_pkt.c:431:2: Call 429. return(1); 430. f_err: 431. ssl3_send_alert(s,SSL3_AL_FATAL,al); ^ 432. err: 433. return(ret); ssl/s3_pkt.c:1144:1: Parameter `s->ctx->sessions->p` 1142. } 1143. 1144. > void ssl3_send_alert(SSL *s, int level, int desc) 1145. { 1146. /* Map tls/ssl alert value to correct one */ ssl/s3_pkt.c:1151:3: Call 1149. /* If a fatal one, remove from cache */ 1150. if ((level == 2) && (s->session != NULL)) 1151. SSL_CTX_remove_session(s->ctx,s->session); ^ 1152. 1153. s->s3->alert_dispatch=1; ssl/ssl_sess.c:413:1: Parameter `ctx->sessions->p` 411. } 412. 413. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 414. { 415. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:415:9: Call 413. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 414. { 415. return remove_session_lock(ctx, c, 1); ^ 416. } 417. ssl/ssl_sess.c:418:1: Parameter `ctx->sessions->p` 416. } 417. 418. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 419. { 420. SSL_SESSION *r; ssl/ssl_sess.c:426:20: Call 424. { 425. if(lck) CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX); 426. r=(SSL_SESSION *)lh_delete(ctx->sessions,c); ^ 427. if (r != NULL) 428. { crypto/lhash/lhash.c:217:1: Parameter `lh->pmax` 215. } 216. 217. > void *lh_delete(LHASH *lh, void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:243:3: Call 241. if ((lh->num_nodes > MIN_NODES) && 242. (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes))) 243. contract(lh); ^ 244. 245. return(ret); crypto/lhash/lhash.c:352:1: <LHS trace> 350. } 351. 352. > static void contract(LHASH *lh) 353. { 354. LHASH_NODE **n,*n1,*np; crypto/lhash/lhash.c:352:1: Parameter `lh->p` 350. } 351. 352. > static void contract(LHASH *lh) 353. { 354. LHASH_NODE **n,*n1,*np; crypto/lhash/lhash.c:356:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `ssl3_get_record` 354. LHASH_NODE **n,*n1,*np; 355. 356. np=lh->b[lh->p+lh->pmax-1]; ^ 357. lh->b[lh->p+lh->pmax-1]=NULL; /* 24/07-92 - eay - weird but :-( */ 358. if (lh->p == 0)
https://github.com/openssl/openssl/blob/1c890fa86415d7f739509701e213a2093fe53438/crypto/lhash/lhash.c/#L356
d2a_code_trace_data_43179
static void unpack_input(const unsigned char *input, unsigned int *output) { unsigned int outbuffer[28]; unsigned short inbuffer[10]; unsigned int x; unsigned int *ptr; for (x=0;x<20;x+=2) inbuffer[x/2]=(input[x]<<8)+input[x+1]; ptr=outbuffer; *(ptr++)=27; *(ptr++)=(inbuffer[0]>>10)&0x3f; *(ptr++)=(inbuffer[0]>>5)&0x1f; *(ptr++)=inbuffer[0]&0x1f; *(ptr++)=(inbuffer[1]>>12)&0xf; *(ptr++)=(inbuffer[1]>>8)&0xf; *(ptr++)=(inbuffer[1]>>5)&7; *(ptr++)=(inbuffer[1]>>2)&7; *(ptr++)=((inbuffer[1]<<1)&6)|((inbuffer[2]>>15)&1); *(ptr++)=(inbuffer[2]>>12)&7; *(ptr++)=(inbuffer[2]>>10)&3; *(ptr++)=(inbuffer[2]>>5)&0x1f; *(ptr++)=((inbuffer[2]<<2)&0x7c)|((inbuffer[3]>>14)&3); *(ptr++)=(inbuffer[3]>>6)&0xff; *(ptr++)=((inbuffer[3]<<1)&0x7e)|((inbuffer[4]>>15)&1); *(ptr++)=(inbuffer[4]>>8)&0x7f; *(ptr++)=(inbuffer[4]>>1)&0x7f; *(ptr++)=((inbuffer[4]<<7)&0x80)|((inbuffer[5]>>9)&0x7f); *(ptr++)=(inbuffer[5]>>2)&0x7f; *(ptr++)=((inbuffer[5]<<5)&0x60)|((inbuffer[6]>>11)&0x1f); *(ptr++)=(inbuffer[6]>>4)&0x7f; *(ptr++)=((inbuffer[6]<<4)&0xf0)|((inbuffer[7]>>12)&0xf); *(ptr++)=(inbuffer[7]>>5)&0x7f; *(ptr++)=((inbuffer[7]<<2)&0x7c)|((inbuffer[8]>>14)&3); *(ptr++)=(inbuffer[8]>>7)&0x7f; *(ptr++)=((inbuffer[8]<<1)&0xfe)|((inbuffer[9]>>15)&1); *(ptr++)=(inbuffer[9]>>8)&0x7f; *(ptr++)=(inbuffer[9]>>1)&0x7f; *(output++)=outbuffer[11]; for (x=1;x<11;*(output++)=outbuffer[x++]); ptr=outbuffer+12; for (x=0;x<16;x+=4) { *(output++)=ptr[x]; *(output++)=ptr[x+2]; *(output++)=ptr[x+3]; *(output++)=ptr[x+1]; } } libavcodec/ra144.c:271: error: Uninitialized Value The value read from inbuffer[_] was never initialized. libavcodec/ra144.c:271:3: 269. *(ptr++)=(inbuffer[0]>>5)&0x1f; 270. *(ptr++)=inbuffer[0]&0x1f; 271. *(ptr++)=(inbuffer[1]>>12)&0xf; ^ 272. *(ptr++)=(inbuffer[1]>>8)&0xf; 273. *(ptr++)=(inbuffer[1]>>5)&7;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ra144.c/#L271
d2a_code_trace_data_43180
static void unpack_input(const unsigned char *input, unsigned int *output) { unsigned int outbuffer[28]; unsigned short inbuffer[10]; unsigned int x; unsigned int *ptr; for (x=0;x<20;x+=2) inbuffer[x/2]=(input[x]<<8)+input[x+1]; ptr=outbuffer; *(ptr++)=27; *(ptr++)=(inbuffer[0]>>10)&0x3f; *(ptr++)=(inbuffer[0]>>5)&0x1f; *(ptr++)=inbuffer[0]&0x1f; *(ptr++)=(inbuffer[1]>>12)&0xf; *(ptr++)=(inbuffer[1]>>8)&0xf; *(ptr++)=(inbuffer[1]>>5)&7; *(ptr++)=(inbuffer[1]>>2)&7; *(ptr++)=((inbuffer[1]<<1)&6)|((inbuffer[2]>>15)&1); *(ptr++)=(inbuffer[2]>>12)&7; *(ptr++)=(inbuffer[2]>>10)&3; *(ptr++)=(inbuffer[2]>>5)&0x1f; *(ptr++)=((inbuffer[2]<<2)&0x7c)|((inbuffer[3]>>14)&3); *(ptr++)=(inbuffer[3]>>6)&0xff; *(ptr++)=((inbuffer[3]<<1)&0x7e)|((inbuffer[4]>>15)&1); *(ptr++)=(inbuffer[4]>>8)&0x7f; *(ptr++)=(inbuffer[4]>>1)&0x7f; *(ptr++)=((inbuffer[4]<<7)&0x80)|((inbuffer[5]>>9)&0x7f); *(ptr++)=(inbuffer[5]>>2)&0x7f; *(ptr++)=((inbuffer[5]<<5)&0x60)|((inbuffer[6]>>11)&0x1f); *(ptr++)=(inbuffer[6]>>4)&0x7f; *(ptr++)=((inbuffer[6]<<4)&0xf0)|((inbuffer[7]>>12)&0xf); *(ptr++)=(inbuffer[7]>>5)&0x7f; *(ptr++)=((inbuffer[7]<<2)&0x7c)|((inbuffer[8]>>14)&3); *(ptr++)=(inbuffer[8]>>7)&0x7f; *(ptr++)=((inbuffer[8]<<1)&0xfe)|((inbuffer[9]>>15)&1); *(ptr++)=(inbuffer[9]>>8)&0x7f; *(ptr++)=(inbuffer[9]>>1)&0x7f; *(output++)=outbuffer[11]; for (x=1;x<11;*(output++)=outbuffer[x++]); ptr=outbuffer+12; for (x=0;x<16;x+=4) { *(output++)=ptr[x]; *(output++)=ptr[x+2]; *(output++)=ptr[x+3]; *(output++)=ptr[x+1]; } } libavcodec/ra144.c:274: error: Uninitialized Value The value read from inbuffer[_] was never initialized. libavcodec/ra144.c:274:3: 272. *(ptr++)=(inbuffer[1]>>8)&0xf; 273. *(ptr++)=(inbuffer[1]>>5)&7; 274. *(ptr++)=(inbuffer[1]>>2)&7; ^ 275. *(ptr++)=((inbuffer[1]<<1)&6)|((inbuffer[2]>>15)&1); 276. *(ptr++)=(inbuffer[2]>>12)&7;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ra144.c/#L274
d2a_code_trace_data_43181
static int kek_unwrap_key(unsigned char *out, size_t *outlen, const unsigned char *in, size_t inlen, EVP_CIPHER_CTX *ctx) { size_t blocklen = EVP_CIPHER_CTX_block_size(ctx); unsigned char *tmp; int outl, rv = 0; if (inlen < 2 * blocklen) { return 0; } if (inlen % blocklen) { return 0; } if ((tmp = OPENSSL_malloc(inlen)) == NULL) { CMSerr(CMS_F_KEK_UNWRAP_KEY, ERR_R_MALLOC_FAILURE); return 0; } if (!EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, &outl, in + inlen - 2 * blocklen, blocklen * 2) || !EVP_DecryptUpdate(ctx, tmp, &outl, tmp + inlen - blocklen, blocklen) || !EVP_DecryptUpdate(ctx, tmp, &outl, in, inlen - blocklen) || !EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, NULL) || !EVP_DecryptUpdate(ctx, tmp, &outl, tmp, inlen)) goto err; if (((tmp[1] ^ tmp[4]) & (tmp[2] ^ tmp[5]) & (tmp[3] ^ tmp[6])) != 0xff) { goto err; } if (inlen < (size_t)(tmp[0] - 4)) { goto err; } *outlen = (size_t)tmp[0]; memcpy(out, tmp + 4, *outlen); rv = 1; err: OPENSSL_clear_free(tmp, inlen); return rv; } crypto/cms/cms_env.c:867: error: BUFFER_OVERRUN_L3 Offset added: [4, +oo] (⇐ 4 + [0, +oo]) Size: [1, +oo] by call to `CMS_RecipientInfo_encrypt`. Showing all 17 steps of the trace crypto/cms/cms_env.c:867:13: Call 865. for (i = 0; i < sk_CMS_RecipientInfo_num(rinfos); i++) { 866. ri = sk_CMS_RecipientInfo_value(rinfos, i); 867. if (CMS_RecipientInfo_encrypt(cms, ri) <= 0) { ^ 868. CMSerr(CMS_F_CMS_ENVELOPEDDATA_INIT_BIO, 869. CMS_R_ERROR_SETTING_RECIPIENTINFO); crypto/cms/cms_env.c:758:1: Parameter `ri->d.pwri->encryptedKey->length` 756. } 757. 758. > int CMS_RecipientInfo_encrypt(const CMS_ContentInfo *cms, CMS_RecipientInfo *ri) 759. { 760. switch (ri->type) { crypto/cms/cms_env.c:867:13: Call 865. for (i = 0; i < sk_CMS_RecipientInfo_num(rinfos); i++) { 866. ri = sk_CMS_RecipientInfo_value(rinfos, i); 867. if (CMS_RecipientInfo_encrypt(cms, ri) <= 0) { ^ 868. CMSerr(CMS_F_CMS_ENVELOPEDDATA_INIT_BIO, 869. CMS_R_ERROR_SETTING_RECIPIENTINFO); crypto/cms/cms_env.c:758:1: Parameter `ri->d.pwri->encryptedKey->length` 756. } 757. 758. > int CMS_RecipientInfo_encrypt(const CMS_ContentInfo *cms, CMS_RecipientInfo *ri) 759. { 760. switch (ri->type) { crypto/cms/cms_env.c:771:16: Call 769. 770. case CMS_RECIPINFO_PASS: 771. return cms_RecipientInfo_pwri_crypt(cms, ri, 1); ^ 772. 773. default: crypto/cms/cms_pwri.c:276:1: Parameter `ri->d.pwri->encryptedKey->length` 274. /* Encrypt/Decrypt content key in PWRI recipient info */ 275. 276. > int cms_RecipientInfo_pwri_crypt(const CMS_ContentInfo *cms, CMS_RecipientInfo *ri, 277. int en_de) 278. { crypto/cms/cms_pwri.c:369:14: Call 367. goto err; 368. } 369. if (!kek_unwrap_key(key, &keylen, ^ 370. pwri->encryptedKey->data, 371. pwri->encryptedKey->length, kekctx)) { crypto/cms/cms_pwri.c:211:13: <Offset trace> 209. || !EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, NULL) 210. /* Decrypt again */ 211. || !EVP_DecryptUpdate(ctx, tmp, &outl, tmp, inlen)) ^ 212. goto err; 213. /* Check check bytes */ crypto/cms/cms_pwri.c:211:13: Call 209. || !EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, NULL) 210. /* Decrypt again */ 211. || !EVP_DecryptUpdate(ctx, tmp, &outl, tmp, inlen)) ^ 212. goto err; 213. /* Check check bytes */ crypto/evp/evp_enc.c:443:1: Parameter `ctx->buf[*]` 441. } 442. 443. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 444. const unsigned char *in, int inl) 445. { crypto/cms/cms_pwri.c:222:5: Assignment 220. goto err; 221. } 222. *outlen = (size_t)tmp[0]; ^ 223. memcpy(out, tmp + 4, *outlen); 224. rv = 1; crypto/cms/cms_pwri.c:176:1: <Length trace> 174. */ 175. 176. > static int kek_unwrap_key(unsigned char *out, size_t *outlen, 177. const unsigned char *in, size_t inlen, 178. EVP_CIPHER_CTX *ctx) crypto/cms/cms_pwri.c:176:1: Parameter `inlen` 174. */ 175. 176. > static int kek_unwrap_key(unsigned char *out, size_t *outlen, 177. const unsigned char *in, size_t inlen, 178. EVP_CIPHER_CTX *ctx) crypto/cms/cms_pwri.c:191:16: Call 189. return 0; 190. } 191. if ((tmp = OPENSSL_malloc(inlen)) == NULL) { ^ 192. CMSerr(CMS_F_KEK_UNWRAP_KEY, ERR_R_MALLOC_FAILURE); 193. return 0; crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/cms/cms_pwri.c:191:10: Assignment 189. return 0; 190. } 191. if ((tmp = OPENSSL_malloc(inlen)) == NULL) { ^ 192. CMSerr(CMS_F_KEK_UNWRAP_KEY, ERR_R_MALLOC_FAILURE); 193. return 0; crypto/cms/cms_pwri.c:223:5: Array access: Offset added: [4, +oo] (⇐ 4 + [0, +oo]) Size: [1, +oo] by call to `CMS_RecipientInfo_encrypt` 221. } 222. *outlen = (size_t)tmp[0]; 223. memcpy(out, tmp + 4, *outlen); ^ 224. rv = 1; 225. err:
https://github.com/openssl/openssl/blob/bcf082d130a413a728a382bd6e6bfdbf2cedba45/crypto/cms/cms_pwri.c/#L223
d2a_code_trace_data_43182
static void opt_output_file(void *optctx, const char *filename) { OptionsContext *o = optctx; AVFormatContext *oc; int i, err; AVOutputFormat *file_oformat; OutputStream *ost; InputStream *ist; if (!strcmp(filename, "-")) filename = "pipe:"; oc = avformat_alloc_context(); if (!oc) { print_error(filename, AVERROR(ENOMEM)); exit_program(1); } if (o->format) { file_oformat = av_guess_format(o->format, NULL, NULL); if (!file_oformat) { av_log(NULL, AV_LOG_FATAL, "Requested output format '%s' is not a suitable output format\n", o->format); exit_program(1); } } else { file_oformat = av_guess_format(NULL, filename, NULL); if (!file_oformat) { av_log(NULL, AV_LOG_FATAL, "Unable to find a suitable output format for '%s'\n", filename); exit_program(1); } } oc->oformat = file_oformat; av_strlcpy(oc->filename, filename, sizeof(oc->filename)); if (!strcmp(file_oformat->name, "ffm") && av_strstart(filename, "http:", NULL)) { int err = read_avserver_streams(o, oc, filename); if (err < 0) { print_error(filename, err); exit_program(1); } } else if (!o->nb_stream_maps) { #define NEW_STREAM(type, index)\ if (index >= 0) {\ ost = new_ ## type ## _stream(o, oc);\ ost->source_index = index;\ ost->sync_ist = &input_streams[index];\ input_streams[index].discard = 0;\ } if (!o->video_disable && oc->oformat->video_codec != CODEC_ID_NONE) { int area = 0, idx = -1; for (i = 0; i < nb_input_streams; i++) { ist = &input_streams[i]; if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && ist->st->codec->width * ist->st->codec->height > area) { area = ist->st->codec->width * ist->st->codec->height; idx = i; } } NEW_STREAM(video, idx); } if (!o->audio_disable && oc->oformat->audio_codec != CODEC_ID_NONE) { int channels = 0, idx = -1; for (i = 0; i < nb_input_streams; i++) { ist = &input_streams[i]; if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO && ist->st->codec->channels > channels) { channels = ist->st->codec->channels; idx = i; } } NEW_STREAM(audio, idx); } if (!o->subtitle_disable && oc->oformat->subtitle_codec != CODEC_ID_NONE) { for (i = 0; i < nb_input_streams; i++) if (input_streams[i].st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) { NEW_STREAM(subtitle, i); break; } } } else { for (i = 0; i < o->nb_stream_maps; i++) { StreamMap *map = &o->stream_maps[i]; if (map->disabled) continue; ist = &input_streams[input_files[map->file_index].ist_index + map->stream_index]; switch (ist->st->codec->codec_type) { case AVMEDIA_TYPE_VIDEO: ost = new_video_stream(o, oc); break; case AVMEDIA_TYPE_AUDIO: ost = new_audio_stream(o, oc); break; case AVMEDIA_TYPE_SUBTITLE: ost = new_subtitle_stream(o, oc); break; case AVMEDIA_TYPE_DATA: ost = new_data_stream(o, oc); break; case AVMEDIA_TYPE_ATTACHMENT: ost = new_attachment_stream(o, oc); break; default: av_log(NULL, AV_LOG_FATAL, "Cannot map stream #%d:%d - unsupported type.\n", map->file_index, map->stream_index); exit_program(1); } ost->source_index = input_files[map->file_index].ist_index + map->stream_index; ost->sync_ist = &input_streams[input_files[map->sync_file_index].ist_index + map->sync_stream_index]; ist->discard = 0; } } for (i = 0; i < o->nb_attachments; i++) { AVIOContext *pb; uint8_t *attachment; const char *p; int64_t len; if ((err = avio_open(&pb, o->attachments[i], AVIO_FLAG_READ)) < 0) { av_log(NULL, AV_LOG_FATAL, "Could not open attachment file %s.\n", o->attachments[i]); exit_program(1); } if ((len = avio_size(pb)) <= 0) { av_log(NULL, AV_LOG_FATAL, "Could not get size of the attachment %s.\n", o->attachments[i]); exit_program(1); } if (!(attachment = av_malloc(len))) { av_log(NULL, AV_LOG_FATAL, "Attachment %s too large to fit into memory.\n", o->attachments[i]); exit_program(1); } avio_read(pb, attachment, len); ost = new_attachment_stream(o, oc); ost->stream_copy = 0; ost->source_index = -1; ost->attachment_filename = o->attachments[i]; ost->st->codec->extradata = attachment; ost->st->codec->extradata_size = len; p = strrchr(o->attachments[i], '/'); av_dict_set(&ost->st->metadata, "filename", (p && *p) ? p + 1 : o->attachments[i], AV_DICT_DONT_OVERWRITE); avio_close(pb); } output_files = grow_array(output_files, sizeof(*output_files), &nb_output_files, nb_output_files + 1); output_files[nb_output_files - 1].ctx = oc; output_files[nb_output_files - 1].ost_index = nb_output_streams - oc->nb_streams; output_files[nb_output_files - 1].recording_time = o->recording_time; output_files[nb_output_files - 1].start_time = o->start_time; output_files[nb_output_files - 1].limit_filesize = o->limit_filesize; av_dict_copy(&output_files[nb_output_files - 1].opts, format_opts, 0); if (oc->oformat->flags & AVFMT_NEEDNUMBER) { if (!av_filename_number_test(oc->filename)) { print_error(oc->filename, AVERROR(EINVAL)); exit_program(1); } } if (!(oc->oformat->flags & AVFMT_NOFILE)) { assert_file_overwrite(filename); if ((err = avio_open(&oc->pb, filename, AVIO_FLAG_WRITE)) < 0) { print_error(filename, err); exit_program(1); } } if (o->mux_preload) { uint8_t buf[64]; snprintf(buf, sizeof(buf), "%d", (int)(o->mux_preload*AV_TIME_BASE)); av_dict_set(&output_files[nb_output_files - 1].opts, "preload", buf, 0); } oc->max_delay = (int)(o->mux_max_delay * AV_TIME_BASE); oc->flags |= AVFMT_FLAG_NONBLOCK; if (o->chapters_input_file >= nb_input_files) { if (o->chapters_input_file == INT_MAX) { o->chapters_input_file = -1; for (i = 0; i < nb_input_files; i++) if (input_files[i].ctx->nb_chapters) { o->chapters_input_file = i; break; } } else { av_log(NULL, AV_LOG_FATAL, "Invalid input file index %d in chapter mapping.\n", o->chapters_input_file); exit_program(1); } } if (o->chapters_input_file >= 0) copy_chapters(&input_files[o->chapters_input_file], &output_files[nb_output_files - 1], !o->metadata_chapters_manual); for (i = 0; i < o->nb_meta_data_maps; i++) { AVFormatContext *files[2]; AVDictionary **meta[2]; int j; #define METADATA_CHECK_INDEX(index, nb_elems, desc)\ if ((index) < 0 || (index) >= (nb_elems)) {\ av_log(NULL, AV_LOG_FATAL, "Invalid %s index %d while processing metadata maps\n",\ (desc), (index));\ exit_program(1);\ } int in_file_index = o->meta_data_maps[i][1].file; if (in_file_index < 0) continue; METADATA_CHECK_INDEX(in_file_index, nb_input_files, "input file") files[0] = oc; files[1] = input_files[in_file_index].ctx; for (j = 0; j < 2; j++) { MetadataMap *map = &o->meta_data_maps[i][j]; switch (map->type) { case 'g': meta[j] = &files[j]->metadata; break; case 's': METADATA_CHECK_INDEX(map->index, files[j]->nb_streams, "stream") meta[j] = &files[j]->streams[map->index]->metadata; break; case 'c': METADATA_CHECK_INDEX(map->index, files[j]->nb_chapters, "chapter") meta[j] = &files[j]->chapters[map->index]->metadata; break; case 'p': METADATA_CHECK_INDEX(map->index, files[j]->nb_programs, "program") meta[j] = &files[j]->programs[map->index]->metadata; break; } } av_dict_copy(meta[0], *meta[1], AV_DICT_DONT_OVERWRITE); } if (!o->metadata_global_manual && nb_input_files) av_dict_copy(&oc->metadata, input_files[0].ctx->metadata, AV_DICT_DONT_OVERWRITE); if (!o->metadata_streams_manual) for (i = output_files[nb_output_files - 1].ost_index; i < nb_output_streams; i++) { InputStream *ist; if (output_streams[i].source_index < 0) continue; ist = &input_streams[output_streams[i].source_index]; av_dict_copy(&output_streams[i].st->metadata, ist->st->metadata, AV_DICT_DONT_OVERWRITE); } for (i = 0; i < o->nb_metadata; i++) { AVDictionary **m; char type, *val; int index = 0; val = strchr(o->metadata[i].u.str, '='); if (!val) { av_log(NULL, AV_LOG_FATAL, "No '=' character in metadata string %s.\n", o->metadata[i].u.str); exit_program(1); } *val++ = 0; parse_meta_type(o->metadata[i].specifier, &type, &index); switch (type) { case 'g': m = &oc->metadata; break; case 's': if (index < 0 || index >= oc->nb_streams) { av_log(NULL, AV_LOG_FATAL, "Invalid stream index %d in metadata specifier.\n", index); exit_program(1); } m = &oc->streams[index]->metadata; break; case 'c': if (index < 0 || index >= oc->nb_chapters) { av_log(NULL, AV_LOG_FATAL, "Invalid chapter index %d in metadata specifier.\n", index); exit_program(1); } m = &oc->chapters[index]->metadata; break; default: av_log(NULL, AV_LOG_FATAL, "Invalid metadata specifier %s.\n", o->metadata[i].specifier); exit_program(1); } av_dict_set(m, o->metadata[i].u.str, *val ? val : NULL, 0); } reset_options(o); } avconv.c:3531: error: Null Dereference pointer `oc` last assigned on line 3510 could be null and is dereferenced at line 3531, column 5. avconv.c:3498:1: start of procedure opt_output_file() 3496. } 3497. 3498. static void opt_output_file(void *optctx, const char *filename) ^ 3499. { 3500. OptionsContext *o = optctx; avconv.c:3500:5: 3498. static void opt_output_file(void *optctx, const char *filename) 3499. { 3500. OptionsContext *o = optctx; ^ 3501. AVFormatContext *oc; 3502. int i, err; avconv.c:3507:10: Taking true branch 3505. InputStream *ist; 3506. 3507. if (!strcmp(filename, "-")) ^ 3508. filename = "pipe:"; 3509. avconv.c:3508:9: 3506. 3507. if (!strcmp(filename, "-")) 3508. filename = "pipe:"; ^ 3509. 3510. oc = avformat_alloc_context(); avconv.c:3510:5: 3508. filename = "pipe:"; 3509. 3510. oc = avformat_alloc_context(); ^ 3511. if (!oc) { 3512. print_error(filename, AVERROR(ENOMEM)); libavformat/options.c:127:1: start of procedure avformat_alloc_context() 125. } 126. 127. AVFormatContext *avformat_alloc_context(void) ^ 128. { 129. AVFormatContext *ic; libavformat/options.c:130:5: 128. { 129. AVFormatContext *ic; 130. ic = av_malloc(sizeof(AVFormatContext)); ^ 131. if (!ic) return ic; 132. avformat_get_context_defaults(ic); libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) ^ 73. return NULL; 74. libavutil/mem.c:83:9: Taking false branch 81. ((char*)ptr)[-1]= diff; 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,32,size)) ^ 84. ptr = NULL; 85. #elif HAVE_MEMALIGN libavutil/mem.c:114:5: 112. ptr = malloc(size); 113. #endif 114. return ptr; ^ 115. } 116. libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavformat/options.c:131:10: Taking true branch 129. AVFormatContext *ic; 130. ic = av_malloc(sizeof(AVFormatContext)); 131. if (!ic) return ic; ^ 132. avformat_get_context_defaults(ic); 133. return ic; libavformat/options.c:131:14: 129. AVFormatContext *ic; 130. ic = av_malloc(sizeof(AVFormatContext)); 131. if (!ic) return ic; ^ 132. avformat_get_context_defaults(ic); 133. return ic; libavformat/options.c:134:1: return from a call to avformat_alloc_context 132. avformat_get_context_defaults(ic); 133. return ic; 134. } ^ 135. 136. const AVClass *avformat_get_class(void) avconv.c:3511:10: Taking true branch 3509. 3510. oc = avformat_alloc_context(); 3511. if (!oc) { ^ 3512. print_error(filename, AVERROR(ENOMEM)); 3513. exit_program(1); avconv.c:3512:9: 3510. oc = avformat_alloc_context(); 3511. if (!oc) { 3512. print_error(filename, AVERROR(ENOMEM)); ^ 3513. exit_program(1); 3514. } cmdutils.c:435:1: start of procedure print_error() 433. } 434. 435. void print_error(const char *filename, int err) ^ 436. { 437. char errbuf[128]; cmdutils.c:438:5: 436. { 437. char errbuf[128]; 438. const char *errbuf_ptr = errbuf; ^ 439. 440. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) cmdutils.c:440:9: Taking true branch 438. const char *errbuf_ptr = errbuf; 439. 440. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) ^ 441. errbuf_ptr = strerror(AVUNERROR(err)); 442. av_log(NULL, AV_LOG_ERROR, "%s: %s\n", filename, errbuf_ptr); cmdutils.c:441:9: Skipping strerror(): method has no implementation 439. 440. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) 441. errbuf_ptr = strerror(AVUNERROR(err)); ^ 442. av_log(NULL, AV_LOG_ERROR, "%s: %s\n", filename, errbuf_ptr); 443. } cmdutils.c:442:5: Skipping av_log(): empty list of specs 440. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) 441. errbuf_ptr = strerror(AVUNERROR(err)); 442. av_log(NULL, AV_LOG_ERROR, "%s: %s\n", filename, errbuf_ptr); ^ 443. } 444. cmdutils.c:443:1: return from a call to print_error 441. errbuf_ptr = strerror(AVUNERROR(err)); 442. av_log(NULL, AV_LOG_ERROR, "%s: %s\n", filename, errbuf_ptr); 443. } ^ 444. 445. static int warned_cfg = 0; avconv.c:3513:9: Skipping exit_program(): empty list of specs 3511. if (!oc) { 3512. print_error(filename, AVERROR(ENOMEM)); 3513. exit_program(1); ^ 3514. } 3515. avconv.c:3516:9: Taking true branch 3514. } 3515. 3516. if (o->format) { ^ 3517. file_oformat = av_guess_format(o->format, NULL, NULL); 3518. if (!file_oformat) { avconv.c:3517:9: Skipping av_guess_format(): empty list of specs 3515. 3516. if (o->format) { 3517. file_oformat = av_guess_format(o->format, NULL, NULL); ^ 3518. if (!file_oformat) { 3519. av_log(NULL, AV_LOG_FATAL, "Requested output format '%s' is not a suitable output format\n", o->format); avconv.c:3518:14: Taking false branch 3516. if (o->format) { 3517. file_oformat = av_guess_format(o->format, NULL, NULL); 3518. if (!file_oformat) { ^ 3519. av_log(NULL, AV_LOG_FATAL, "Requested output format '%s' is not a suitable output format\n", o->format); 3520. exit_program(1); avconv.c:3531:5: 3529. } 3530. 3531. oc->oformat = file_oformat; ^ 3532. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); 3533.
https://github.com/libav/libav/blob/e551a6f49a13f2e992c42bc00a8b45ad636e52ad/avconv.c/#L3531
d2a_code_trace_data_43183
int OPENSSL_SA_set(OPENSSL_SA *sa, ossl_uintmax_t posn, void *val) { int i, level = 1; ossl_uintmax_t n = posn; void **p; if (sa == NULL) return 0; for (level = 1; level < SA_BLOCK_MAX_LEVELS; level++) if ((n >>= OPENSSL_SA_BLOCK_BITS) == 0) break; for (;sa->levels < level; sa->levels++) { p = alloc_node(); if (p == NULL) return 0; p[0] = sa->nodes; sa->nodes = p; } if (sa->top < posn) sa->top = posn; p = sa->nodes; for (level = sa->levels - 1; level > 0; level--) { i = (posn >> (OPENSSL_SA_BLOCK_BITS * level)) & SA_BLOCK_MASK; if (p[i] == NULL && (p[i] = alloc_node()) == NULL) return 0; p = p[i]; } p += posn & SA_BLOCK_MASK; if (val == NULL && *p != NULL) sa->nelem--; else if (val != NULL && *p == NULL) sa->nelem++; *p = val; return 1; } test/property_test.c:243: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `ossl_method_store_add`. Showing all 12 steps of the trace test/property_test.c:243:14: Call 241. 242. for (i = 0; i < OSSL_NELEM(impls); i++) 243. if (!TEST_true(ossl_method_store_add(store, NULL, impls[i].nid, ^ 244. impls[i].prop, impls[i].impl, 245. NULL, NULL))) { crypto/property/property.c:166:1: Parameter `store->algs->nelem` 164. } 165. 166. > int ossl_method_store_add(OSSL_METHOD_STORE *store, const OSSL_PROVIDER *prov, 167. int nid, const char *properties, void *method, 168. int (*method_up_ref)(void *), test/property_test.c:243:14: Call 241. 242. for (i = 0; i < OSSL_NELEM(impls); i++) 243. if (!TEST_true(ossl_method_store_add(store, NULL, impls[i].nid, ^ 244. impls[i].prop, impls[i].impl, 245. NULL, NULL))) { crypto/property/property.c:166:1: Parameter `store->algs->nelem` 164. } 165. 166. > int ossl_method_store_add(OSSL_METHOD_STORE *store, const OSSL_PROVIDER *prov, 167. int nid, const char *properties, void *method, 168. int (*method_up_ref)(void *), crypto/property/property.c:215:14: Call 213. goto err; 214. alg->nid = nid; 215. if (!ossl_method_store_insert(store, alg)) ^ 216. goto err; 217. } crypto/property/property.c:161:1: Parameter `store->algs->nelem` 159. } 160. 161. > static int ossl_method_store_insert(OSSL_METHOD_STORE *store, ALGORITHM *alg) 162. { 163. return ossl_sa_ALGORITHM_set(store->algs, alg->nid, alg); crypto/property/property.c:163:16: Call 161. static int ossl_method_store_insert(OSSL_METHOD_STORE *store, ALGORITHM *alg) 162. { 163. return ossl_sa_ALGORITHM_set(store->algs, alg->nid, alg); ^ 164. } 165. crypto/property/property.c:67:1: Parameter `sa->nelem` 65. } IMPL_CACHE_FLUSH; 66. 67. > DEFINE_SPARSE_ARRAY_OF(ALGORITHM); 68. 69. static void ossl_method_cache_flush(OSSL_METHOD_STORE *store, int nid); crypto/property/property.c:67:1: Call 65. } IMPL_CACHE_FLUSH; 66. 67. > DEFINE_SPARSE_ARRAY_OF(ALGORITHM); 68. 69. static void ossl_method_cache_flush(OSSL_METHOD_STORE *store, int nid); crypto/sparse_array.c:183:1: <LHS trace> 181. } 182. 183. > int OPENSSL_SA_set(OPENSSL_SA *sa, ossl_uintmax_t posn, void *val) 184. { 185. int i, level = 1; crypto/sparse_array.c:183:1: Parameter `sa->nelem` 181. } 182. 183. > int OPENSSL_SA_set(OPENSSL_SA *sa, ossl_uintmax_t posn, void *val) 184. { 185. int i, level = 1; crypto/sparse_array.c:215:9: Binary operation: ([0, +oo] - 1):unsigned64 by call to `ossl_method_store_add` 213. p += posn & SA_BLOCK_MASK; 214. if (val == NULL && *p != NULL) 215. sa->nelem--; ^ 216. else if (val != NULL && *p == NULL) 217. sa->nelem++;
https://github.com/openssl/openssl/blob/2d9007587c5072a513c84f22db7be55767b4c63d/crypto/sparse_array.c/#L215
d2a_code_trace_data_43184
static int estimate_best_b_count(MpegEncContext *s){ AVCodec *codec= avcodec_find_encoder(s->avctx->codec_id); AVCodecContext *c= avcodec_alloc_context(); AVFrame input[FF_MAX_B_FRAMES+2]; const int scale= s->avctx->brd_scale; int i, j, out_size, p_lambda, b_lambda, lambda2; int outbuf_size= s->width * s->height; uint8_t *outbuf= av_malloc(outbuf_size); int64_t best_rd= INT64_MAX; int best_b_count= -1; assert(scale>=0 && scale <=3); p_lambda= s->last_lambda_for[FF_P_TYPE]; b_lambda= s->last_lambda_for[FF_B_TYPE]; if(!b_lambda) b_lambda= p_lambda; lambda2= (b_lambda*b_lambda + (1<<FF_LAMBDA_SHIFT)/2 ) >> FF_LAMBDA_SHIFT; c->width = s->width >> scale; c->height= s->height>> scale; c->flags= CODEC_FLAG_QSCALE | CODEC_FLAG_PSNR | CODEC_FLAG_INPUT_PRESERVED ; c->flags|= s->avctx->flags & CODEC_FLAG_QPEL; c->mb_decision= s->avctx->mb_decision; c->me_cmp= s->avctx->me_cmp; c->mb_cmp= s->avctx->mb_cmp; c->me_sub_cmp= s->avctx->me_sub_cmp; c->pix_fmt = PIX_FMT_YUV420P; c->time_base= s->avctx->time_base; c->max_b_frames= s->max_b_frames; if (avcodec_open(c, codec) < 0) return -1; for(i=0; i<s->max_b_frames+2; i++){ int ysize= c->width*c->height; int csize= (c->width/2)*(c->height/2); Picture pre_input, *pre_input_ptr= i ? s->input_picture[i-1] : s->next_picture_ptr; avcodec_get_frame_defaults(&input[i]); input[i].data[0]= av_malloc(ysize + 2*csize); input[i].data[1]= input[i].data[0] + ysize; input[i].data[2]= input[i].data[1] + csize; input[i].linesize[0]= c->width; input[i].linesize[1]= input[i].linesize[2]= c->width/2; if(pre_input_ptr && (!i || s->input_picture[i-1])) { pre_input= *pre_input_ptr; if(pre_input.type != FF_BUFFER_TYPE_SHARED && i) { pre_input.data[0]+=INPLACE_OFFSET; pre_input.data[1]+=INPLACE_OFFSET; pre_input.data[2]+=INPLACE_OFFSET; } s->dsp.shrink[scale](input[i].data[0], input[i].linesize[0], pre_input.data[0], pre_input.linesize[0], c->width, c->height); s->dsp.shrink[scale](input[i].data[1], input[i].linesize[1], pre_input.data[1], pre_input.linesize[1], c->width>>1, c->height>>1); s->dsp.shrink[scale](input[i].data[2], input[i].linesize[2], pre_input.data[2], pre_input.linesize[2], c->width>>1, c->height>>1); } } for(j=0; j<s->max_b_frames+1; j++){ int64_t rd=0; if(!s->input_picture[j]) break; c->error[0]= c->error[1]= c->error[2]= 0; input[0].pict_type= FF_I_TYPE; input[0].quality= 1 * FF_QP2LAMBDA; out_size = avcodec_encode_video(c, outbuf, outbuf_size, &input[0]); for(i=0; i<s->max_b_frames+1; i++){ int is_p= i % (j+1) == j || i==s->max_b_frames; input[i+1].pict_type= is_p ? FF_P_TYPE : FF_B_TYPE; input[i+1].quality= is_p ? p_lambda : b_lambda; out_size = avcodec_encode_video(c, outbuf, outbuf_size, &input[i+1]); rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3); } while(out_size){ out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL); rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3); } rd += c->error[0] + c->error[1] + c->error[2]; if(rd < best_rd){ best_rd= rd; best_b_count= j; } } av_freep(&outbuf); avcodec_close(c); av_freep(&c); for(i=0; i<s->max_b_frames+2; i++){ av_freep(&input[i].data[0]); } return best_b_count; } libavcodec/mpegvideo_enc.c:973: error: Null Dereference pointer `c` last assigned on line 956 could be null and is dereferenced at line 973, column 5. libavcodec/mpegvideo_enc.c:954:1: start of procedure estimate_best_b_count() 952. } 953. 954. static int estimate_best_b_count(MpegEncContext *s){ ^ 955. AVCodec *codec= avcodec_find_encoder(s->avctx->codec_id); 956. AVCodecContext *c= avcodec_alloc_context(); libavcodec/mpegvideo_enc.c:955:5: Skipping avcodec_find_encoder(): empty list of specs 953. 954. static int estimate_best_b_count(MpegEncContext *s){ 955. AVCodec *codec= avcodec_find_encoder(s->avctx->codec_id); ^ 956. AVCodecContext *c= avcodec_alloc_context(); 957. AVFrame input[FF_MAX_B_FRAMES+2]; libavcodec/mpegvideo_enc.c:956:5: 954. static int estimate_best_b_count(MpegEncContext *s){ 955. AVCodec *codec= avcodec_find_encoder(s->avctx->codec_id); 956. AVCodecContext *c= avcodec_alloc_context(); ^ 957. AVFrame input[FF_MAX_B_FRAMES+2]; 958. const int scale= s->avctx->brd_scale; libavcodec/options.c:515:1: start of procedure avcodec_alloc_context() 513. } 514. 515. AVCodecContext *avcodec_alloc_context(void){ ^ 516. return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN); 517. } libavcodec/options.c:516:5: 514. 515. AVCodecContext *avcodec_alloc_context(void){ 516. return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN); ^ 517. } 518. libavcodec/options.c:501:1: start of procedure avcodec_alloc_context2() 499. } 500. 501. AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){ ^ 502. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); 503. libavcodec/options.c:502:5: 500. 501. AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){ 502. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); ^ 503. 504. if(avctx==NULL) return NULL; libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(FF_INTERNAL_MEM_TYPE size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(FF_INTERNAL_MEM_TYPE size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-16) ) ^ 73. return NULL; 74. libavutil/mem.c:83:9: Taking false branch 81. ((char*)ptr)[-1]= diff; 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,16,size)) ^ 84. ptr = NULL; 85. #elif HAVE_MEMALIGN libavutil/mem.c:116:5: 114. ptr = malloc(size); 115. #endif 116. return ptr; ^ 117. } 118. libavutil/mem.c:117:1: return from a call to av_malloc 115. #endif 116. return ptr; 117. } ^ 118. 119. void *av_realloc(void *ptr, FF_INTERNAL_MEM_TYPE size) libavcodec/options.c:504:8: Taking true branch 502. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); 503. 504. if(avctx==NULL) return NULL; ^ 505. 506. avcodec_get_context_defaults2(avctx, codec_type); libavcodec/options.c:504:21: 502. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); 503. 504. if(avctx==NULL) return NULL; ^ 505. 506. avcodec_get_context_defaults2(avctx, codec_type); libavcodec/options.c:509:1: return from a call to avcodec_alloc_context2 507. 508. return avctx; 509. } ^ 510. 511. void avcodec_get_context_defaults(AVCodecContext *s){ libavcodec/options.c:517:1: return from a call to avcodec_alloc_context 515. AVCodecContext *avcodec_alloc_context(void){ 516. return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN); 517. } ^ 518. 519. int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src) libavcodec/mpegvideo_enc.c:958:5: 956. AVCodecContext *c= avcodec_alloc_context(); 957. AVFrame input[FF_MAX_B_FRAMES+2]; 958. const int scale= s->avctx->brd_scale; ^ 959. int i, j, out_size, p_lambda, b_lambda, lambda2; 960. int outbuf_size= s->width * s->height; //FIXME libavcodec/mpegvideo_enc.c:960:5: 958. const int scale= s->avctx->brd_scale; 959. int i, j, out_size, p_lambda, b_lambda, lambda2; 960. int outbuf_size= s->width * s->height; //FIXME ^ 961. uint8_t *outbuf= av_malloc(outbuf_size); 962. int64_t best_rd= INT64_MAX; libavcodec/mpegvideo_enc.c:961:5: 959. int i, j, out_size, p_lambda, b_lambda, lambda2; 960. int outbuf_size= s->width * s->height; //FIXME 961. uint8_t *outbuf= av_malloc(outbuf_size); ^ 962. int64_t best_rd= INT64_MAX; 963. int best_b_count= -1; libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(FF_INTERNAL_MEM_TYPE size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(FF_INTERNAL_MEM_TYPE size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-16) ) ^ 73. return NULL; 74. libavutil/mem.c:83:9: Taking false branch 81. ((char*)ptr)[-1]= diff; 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,16,size)) ^ 84. ptr = NULL; 85. #elif HAVE_MEMALIGN libavutil/mem.c:116:5: 114. ptr = malloc(size); 115. #endif 116. return ptr; ^ 117. } 118. libavutil/mem.c:117:1: return from a call to av_malloc 115. #endif 116. return ptr; 117. } ^ 118. 119. void *av_realloc(void *ptr, FF_INTERNAL_MEM_TYPE size) libavcodec/mpegvideo_enc.c:962:5: 960. int outbuf_size= s->width * s->height; //FIXME 961. uint8_t *outbuf= av_malloc(outbuf_size); 962. int64_t best_rd= INT64_MAX; ^ 963. int best_b_count= -1; 964. libavcodec/mpegvideo_enc.c:963:5: 961. uint8_t *outbuf= av_malloc(outbuf_size); 962. int64_t best_rd= INT64_MAX; 963. int best_b_count= -1; ^ 964. 965. assert(scale>=0 && scale <=3); libavcodec/mpegvideo_enc.c:965:5: 963. int best_b_count= -1; 964. 965. assert(scale>=0 && scale <=3); ^ 966. 967. // emms_c(); libavcodec/mpegvideo_enc.c:968:5: 966. 967. // emms_c(); 968. p_lambda= s->last_lambda_for[FF_P_TYPE]; //s->next_picture_ptr->quality; ^ 969. b_lambda= s->last_lambda_for[FF_B_TYPE]; //p_lambda *FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; 970. if(!b_lambda) b_lambda= p_lambda; //FIXME we should do this somewhere else libavcodec/mpegvideo_enc.c:969:5: 967. // emms_c(); 968. p_lambda= s->last_lambda_for[FF_P_TYPE]; //s->next_picture_ptr->quality; 969. b_lambda= s->last_lambda_for[FF_B_TYPE]; //p_lambda *FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; ^ 970. if(!b_lambda) b_lambda= p_lambda; //FIXME we should do this somewhere else 971. lambda2= (b_lambda*b_lambda + (1<<FF_LAMBDA_SHIFT)/2 ) >> FF_LAMBDA_SHIFT; libavcodec/mpegvideo_enc.c:970:9: Taking false branch 968. p_lambda= s->last_lambda_for[FF_P_TYPE]; //s->next_picture_ptr->quality; 969. b_lambda= s->last_lambda_for[FF_B_TYPE]; //p_lambda *FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; 970. if(!b_lambda) b_lambda= p_lambda; //FIXME we should do this somewhere else ^ 971. lambda2= (b_lambda*b_lambda + (1<<FF_LAMBDA_SHIFT)/2 ) >> FF_LAMBDA_SHIFT; 972. libavcodec/mpegvideo_enc.c:971:5: 969. b_lambda= s->last_lambda_for[FF_B_TYPE]; //p_lambda *FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; 970. if(!b_lambda) b_lambda= p_lambda; //FIXME we should do this somewhere else 971. lambda2= (b_lambda*b_lambda + (1<<FF_LAMBDA_SHIFT)/2 ) >> FF_LAMBDA_SHIFT; ^ 972. 973. c->width = s->width >> scale; libavcodec/mpegvideo_enc.c:973:5: 971. lambda2= (b_lambda*b_lambda + (1<<FF_LAMBDA_SHIFT)/2 ) >> FF_LAMBDA_SHIFT; 972. 973. c->width = s->width >> scale; ^ 974. c->height= s->height>> scale; 975. c->flags= CODEC_FLAG_QSCALE | CODEC_FLAG_PSNR | CODEC_FLAG_INPUT_PRESERVED /*| CODEC_FLAG_EMU_EDGE*/;
https://github.com/libav/libav/blob/2d777bb7a20041ac0564ffef85bf40619af8ccd1/libavcodec/mpegvideo_enc.c/#L973
d2a_code_trace_data_43185
static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) { int64_t total_size = 0; MOV_atom_t a; int i; int err = 0; a.offset = atom.offset; if (atom.size < 0) atom.size = INT64_MAX; while(((total_size + 8) < atom.size) && !url_feof(pb) && !err) { a.size = atom.size; a.type=0; if(atom.size >= 8) { a.size = get_be32(pb); a.type = get_le32(pb); } total_size += 8; a.offset += 8; dprintf(c->fc, "type: %08x %.4s sz: %"PRIx64" %"PRIx64" %"PRIx64"\n", a.type, (char*)&a.type, a.size, atom.size, total_size); if (a.size == 1) { a.size = get_be64(pb) - 8; a.offset += 8; total_size += 8; } if (a.size == 0) { a.size = atom.size - total_size; if (a.size <= 8) break; } a.size -= 8; if(a.size < 0) break; a.size = FFMIN(a.size, atom.size - total_size); for (i = 0; mov_default_parse_table[i].type != 0 && mov_default_parse_table[i].type != a.type; i++) ; if (mov_default_parse_table[i].type == 0) { url_fskip(pb, a.size); } else { offset_t start_pos = url_ftell(pb); int64_t left; err = mov_default_parse_table[i].parse(c, pb, a); if (url_is_streamed(pb) && c->found_moov && c->found_mdat) break; left = a.size - url_ftell(pb) + start_pos; if (left > 0) url_fskip(pb, left); } a.offset += a.size; total_size += a.size; } if (!err && total_size < atom.size && atom.size < 0x7ffff) url_fskip(pb, atom.size - total_size); return err; } libavformat/mov.c:193: error: Integer Overflow L2 ([-oo, -1+max(9223372036854775807, `atom.size`)] + 8):signed64. libavformat/mov.c:168:1: <LHS trace> 166. static const MOVParseTableEntry mov_default_parse_table[]; 167. 168. static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) ^ 169. { 170. int64_t total_size = 0; libavformat/mov.c:168:1: Parameter `atom.size` 166. static const MOVParseTableEntry mov_default_parse_table[]; 167. 168. static int mov_read_default(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom) ^ 169. { 170. int64_t total_size = 0; libavformat/mov.c:186:9: Assignment 184. a.type = get_le32(pb); 185. } 186. total_size += 8; ^ 187. a.offset += 8; 188. dprintf(c->fc, "type: %08x %.4s sz: %"PRIx64" %"PRIx64" %"PRIx64"\n", libavformat/mov.c:193:13: Binary operation: ([-oo, -1+max(9223372036854775807, atom.size)] + 8):signed64 191. a.size = get_be64(pb) - 8; 192. a.offset += 8; 193. total_size += 8; ^ 194. } 195. if (a.size == 0) {
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/mov.c/#L193
d2a_code_trace_data_43186
static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){ int x, y; int_fast16_t sample_buffer[2][w+6]; int_fast16_t *sample[2]= {sample_buffer[0]+3, sample_buffer[1]+3}; s->run_index=0; memset(sample_buffer, 0, sizeof(sample_buffer)); for(y=0; y<h; y++){ int_fast16_t *temp= sample[0]; sample[0]= sample[1]; sample[1]= temp; sample[1][-1]= sample[0][0 ]; sample[0][ w]= sample[0][w-1]; decode_line(s, w, sample, plane_index, 8); for(x=0; x<w; x++){ src[x + stride*y]= sample[1][x]; } } } libavcodec/ffv1.c:789: error: Buffer Overrun L1 Offset: [3, `w` + 3] (⇐ [3, 4] + [0, `w` - 1]) Size: 2. libavcodec/ffv1.c:768:1: <Offset trace> 766. } 767. 768. static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){ ^ 769. int x, y; 770. int_fast16_t sample_buffer[2][w+6]; libavcodec/ffv1.c:768:1: Parameter `w` 766. } 767. 768. static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){ ^ 769. int x, y; 770. int_fast16_t sample_buffer[2][w+6]; libavcodec/ffv1.c:770:32: <Length trace> 768. static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){ 769. int x, y; 770. int_fast16_t sample_buffer[2][w+6]; ^ 771. int_fast16_t *sample[2]= {sample_buffer[0]+3, sample_buffer[1]+3}; 772. libavcodec/ffv1.c:770:32: Array declaration 768. static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){ 769. int x, y; 770. int_fast16_t sample_buffer[2][w+6]; ^ 771. int_fast16_t *sample[2]= {sample_buffer[0]+3, sample_buffer[1]+3}; 772. libavcodec/ffv1.c:771:30: Assignment 769. int x, y; 770. int_fast16_t sample_buffer[2][w+6]; 771. int_fast16_t *sample[2]= {sample_buffer[0]+3, sample_buffer[1]+3}; ^ 772. 773. s->run_index=0; libavcodec/ffv1.c:789:32: Array access: Offset: [3, w + 3] (⇐ [3, 4] + [0, w - 1]) Size: 2 787. decode_line(s, w, sample, plane_index, 8); 788. for(x=0; x<w; x++){ 789. src[x + stride*y]= sample[1][x]; ^ 790. } 791. //STOP_TIMER("decode-line")}
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ffv1.c/#L789
d2a_code_trace_data_43187
static void h264_luma_dc_dequant_idct_c(DCTELEM *block, int qp, int qmul){ #define stride 16 int i; int temp[16]; static const int x_offset[4]={0, 1*stride, 4* stride, 5*stride}; static const int y_offset[4]={0, 2*stride, 8* stride, 10*stride}; for(i=0; i<4; i++){ const int offset= y_offset[i]; const int z0= block[offset+stride*0] + block[offset+stride*4]; const int z1= block[offset+stride*0] - block[offset+stride*4]; const int z2= block[offset+stride*1] - block[offset+stride*5]; const int z3= block[offset+stride*1] + block[offset+stride*5]; temp[4*i+0]= z0+z3; temp[4*i+1]= z1+z2; temp[4*i+2]= z1-z2; temp[4*i+3]= z0-z3; } for(i=0; i<4; i++){ const int offset= x_offset[i]; const int z0= temp[4*0+i] + temp[4*2+i]; const int z1= temp[4*0+i] - temp[4*2+i]; const int z2= temp[4*1+i] - temp[4*3+i]; const int z3= temp[4*1+i] + temp[4*3+i]; block[stride*0 +offset]= ((((z0 + z3)*qmul + 128 ) >> 8)); block[stride*2 +offset]= ((((z1 + z2)*qmul + 128 ) >> 8)); block[stride*8 +offset]= ((((z1 - z2)*qmul + 128 ) >> 8)); block[stride*10+offset]= ((((z0 - z3)*qmul + 128 ) >> 8)); } } libavcodec/h264.c:1490: error: Uninitialized Value The value read from temp[_] was never initialized. libavcodec/h264.c:1490:9: 1488. const int z1= temp[4*0+i] - temp[4*2+i]; 1489. const int z2= temp[4*1+i] - temp[4*3+i]; 1490. const int z3= temp[4*1+i] + temp[4*3+i]; ^ 1491. 1492. block[stride*0 +offset]= ((((z0 + z3)*qmul + 128 ) >> 8)); //FIXME think about merging this into decode_resdual
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L1490
d2a_code_trace_data_43188
CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name) { CTLOG *ret = CTLOG_new_null(); if (ret == NULL) return NULL; ret->name = OPENSSL_strdup(name); if (ret->name == NULL) { CTerr(CT_F_CTLOG_NEW, ERR_R_MALLOC_FAILURE); goto err; } ret->public_key = public_key; if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1) goto err; return ret; err: CTLOG_free(ret); return NULL; } crypto/ct/ct_log.c:254: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_strdup()` at line 242, column 17 is not reachable after line 254, column 5. Showing all 68 steps of the trace crypto/ct/ct_log.c:235:1: start of procedure CTLOG_new() 233. * Copies the name. 234. */ 235. > CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name) 236. { 237. CTLOG *ret = CTLOG_new_null(); crypto/ct/ct_log.c:237:5: 235. CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name) 236. { 237. > CTLOG *ret = CTLOG_new_null(); 238. 239. if (ret == NULL) crypto/ct/ct_log.c:258:1: start of procedure CTLOG_new_null() 256. } 257. 258. > CTLOG *CTLOG_new_null(void) 259. { 260. CTLOG *ret = OPENSSL_zalloc(sizeof(*ret)); crypto/ct/ct_log.c:260:5: 258. CTLOG *CTLOG_new_null(void) 259. { 260. > CTLOG *ret = OPENSSL_zalloc(sizeof(*ret)); 261. 262. if (ret == NULL) crypto/mem.c:98:1: start of procedure CRYPTO_zalloc() 96. } 97. 98. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 99. { 100. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:100:5: 98. void *CRYPTO_zalloc(size_t num, const char *file, int line) 99. { 100. > void *ret = CRYPTO_malloc(num, file, line); 101. 102. if (ret != NULL) crypto/mem.c:71:1: start of procedure CRYPTO_malloc() 69. } 70. 71. > void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. void *ret = NULL; crypto/mem.c:73:5: 71. void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. > void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:75:9: Taking false branch 73. void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 76. return malloc_impl(num, file, line); 77. crypto/mem.c:78:9: Taking false branch 76. return malloc_impl(num, file, line); 77. 78. if (num <= 0) ^ 79. return NULL; 80. crypto/mem.c:81:5: 79. return NULL; 80. 81. > allow_customize = 0; 82. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 83. if (call_malloc_debug) { crypto/mem.c:91:5: 89. } 90. #else 91. > osslargused(file); osslargused(line); 92. ret = malloc(num); 93. #endif crypto/mem.c:91:24: 89. } 90. #else 91. > osslargused(file); osslargused(line); 92. ret = malloc(num); 93. #endif crypto/mem.c:92:5: 90. #else 91. osslargused(file); osslargused(line); 92. > ret = malloc(num); 93. #endif 94. crypto/mem.c:95:5: 93. #endif 94. 95. > return ret; 96. } 97. crypto/mem.c:96:1: return from a call to CRYPTO_malloc 94. 95. return ret; 96. > } 97. 98. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:102:9: Taking true branch 100. void *ret = CRYPTO_malloc(num, file, line); 101. 102. if (ret != NULL) ^ 103. memset(ret, 0, num); 104. return ret; crypto/mem.c:103:9: 101. 102. if (ret != NULL) 103. > memset(ret, 0, num); 104. return ret; 105. } crypto/mem.c:104:5: 102. if (ret != NULL) 103. memset(ret, 0, num); 104. > return ret; 105. } 106. crypto/mem.c:105:1: return from a call to CRYPTO_zalloc 103. memset(ret, 0, num); 104. return ret; 105. > } 106. 107. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/ct/ct_log.c:262:9: Taking false branch 260. CTLOG *ret = OPENSSL_zalloc(sizeof(*ret)); 261. 262. if (ret == NULL) ^ 263. CTerr(CT_F_CTLOG_NEW_NULL, ERR_R_MALLOC_FAILURE); 264. crypto/ct/ct_log.c:265:5: 263. CTerr(CT_F_CTLOG_NEW_NULL, ERR_R_MALLOC_FAILURE); 264. 265. > return ret; 266. } 267. crypto/ct/ct_log.c:266:1: return from a call to CTLOG_new_null 264. 265. return ret; 266. > } 267. 268. /* Frees CT log and associated structures */ crypto/ct/ct_log.c:239:9: Taking false branch 237. CTLOG *ret = CTLOG_new_null(); 238. 239. if (ret == NULL) ^ 240. return NULL; 241. crypto/ct/ct_log.c:242:5: 240. return NULL; 241. 242. > ret->name = OPENSSL_strdup(name); 243. if (ret->name == NULL) { 244. CTerr(CT_F_CTLOG_NEW, ERR_R_MALLOC_FAILURE); crypto/o_str.c:28:1: start of procedure CRYPTO_strdup() 26. } 27. 28. > char *CRYPTO_strdup(const char *str, const char* file, int line) 29. { 30. char *ret; crypto/o_str.c:33:9: Taking false branch 31. size_t size; 32. 33. if (str == NULL) ^ 34. return NULL; 35. size = strlen(str) + 1; crypto/o_str.c:35:5: 33. if (str == NULL) 34. return NULL; 35. > size = strlen(str) + 1; 36. ret = CRYPTO_malloc(size, file, line); 37. if (ret != NULL) crypto/o_str.c:36:5: 34. return NULL; 35. size = strlen(str) + 1; 36. > ret = CRYPTO_malloc(size, file, line); 37. if (ret != NULL) 38. memcpy(ret, str, size); crypto/mem.c:71:1: start of procedure CRYPTO_malloc() 69. } 70. 71. > void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. void *ret = NULL; crypto/mem.c:73:5: 71. void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. > void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:75:9: Taking false branch 73. void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 76. return malloc_impl(num, file, line); 77. crypto/mem.c:78:9: Taking false branch 76. return malloc_impl(num, file, line); 77. 78. if (num <= 0) ^ 79. return NULL; 80. crypto/mem.c:81:5: 79. return NULL; 80. 81. > allow_customize = 0; 82. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 83. if (call_malloc_debug) { crypto/mem.c:91:5: 89. } 90. #else 91. > osslargused(file); osslargused(line); 92. ret = malloc(num); 93. #endif crypto/mem.c:91:24: 89. } 90. #else 91. > osslargused(file); osslargused(line); 92. ret = malloc(num); 93. #endif crypto/mem.c:92:5: 90. #else 91. osslargused(file); osslargused(line); 92. > ret = malloc(num); 93. #endif 94. crypto/mem.c:95:5: 93. #endif 94. 95. > return ret; 96. } 97. crypto/mem.c:96:1: return from a call to CRYPTO_malloc 94. 95. return ret; 96. > } 97. 98. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/o_str.c:37:9: Taking true branch 35. size = strlen(str) + 1; 36. ret = CRYPTO_malloc(size, file, line); 37. if (ret != NULL) ^ 38. memcpy(ret, str, size); 39. return ret; crypto/o_str.c:38:9: 36. ret = CRYPTO_malloc(size, file, line); 37. if (ret != NULL) 38. > memcpy(ret, str, size); 39. return ret; 40. } crypto/o_str.c:39:5: 37. if (ret != NULL) 38. memcpy(ret, str, size); 39. > return ret; 40. } 41. crypto/o_str.c:40:1: return from a call to CRYPTO_strdup 38. memcpy(ret, str, size); 39. return ret; 40. > } 41. 42. char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line) crypto/ct/ct_log.c:243:9: Taking false branch 241. 242. ret->name = OPENSSL_strdup(name); 243. if (ret->name == NULL) { ^ 244. CTerr(CT_F_CTLOG_NEW, ERR_R_MALLOC_FAILURE); 245. goto err; crypto/ct/ct_log.c:248:5: 246. } 247. 248. > ret->public_key = public_key; 249. if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1) 250. goto err; crypto/ct/ct_log.c:249:9: 247. 248. ret->public_key = public_key; 249. > if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1) 250. goto err; 251. crypto/ct/ct_log.c:73:1: start of procedure ct_v1_log_id_from_pkey() 71. 72. /* Converts a log's public key into a SHA256 log ID */ 73. > static int ct_v1_log_id_from_pkey(EVP_PKEY *pkey, 74. unsigned char log_id[CT_V1_HASHLEN]) 75. { crypto/ct/ct_log.c:76:5: 74. unsigned char log_id[CT_V1_HASHLEN]) 75. { 76. > int ret = 0; 77. unsigned char *pkey_der = NULL; 78. int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der); crypto/ct/ct_log.c:77:5: 75. { 76. int ret = 0; 77. > unsigned char *pkey_der = NULL; 78. int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der); 79. crypto/ct/ct_log.c:78:5: 76. int ret = 0; 77. unsigned char *pkey_der = NULL; 78. > int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der); 79. 80. if (pkey_der_len <= 0) { crypto/x509/x_pubkey.c:202:1: start of procedure i2d_PUBKEY() 200. } 201. 202. > int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp) 203. { 204. X509_PUBKEY *xpk = NULL; crypto/x509/x_pubkey.c:204:5: 202. int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp) 203. { 204. > X509_PUBKEY *xpk = NULL; 205. int ret; 206. if (!a) crypto/x509/x_pubkey.c:206:10: Taking true branch 204. X509_PUBKEY *xpk = NULL; 205. int ret; 206. if (!a) ^ 207. return 0; 208. if (!X509_PUBKEY_set(&xpk, a)) crypto/x509/x_pubkey.c:207:9: 205. int ret; 206. if (!a) 207. > return 0; 208. if (!X509_PUBKEY_set(&xpk, a)) 209. return 0; crypto/x509/x_pubkey.c:213:1: return from a call to i2d_PUBKEY 211. X509_PUBKEY_free(xpk); 212. return ret; 213. > } 214. 215. /* crypto/ct/ct_log.c:80:9: Taking true branch 78. int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der); 79. 80. if (pkey_der_len <= 0) { ^ 81. CTerr(CT_F_CT_V1_LOG_ID_FROM_PKEY, CT_R_LOG_KEY_INVALID); 82. goto err; crypto/ct/ct_log.c:81:9: Skipping ERR_put_error(): empty list of specs 79. 80. if (pkey_der_len <= 0) { 81. CTerr(CT_F_CT_V1_LOG_ID_FROM_PKEY, CT_R_LOG_KEY_INVALID); ^ 82. goto err; 83. } crypto/ct/ct_log.c:87:1: 85. SHA256(pkey_der, pkey_der_len, log_id); 86. ret = 1; 87. > err: 88. OPENSSL_free(pkey_der); 89. return ret; crypto/ct/ct_log.c:88:5: 86. ret = 1; 87. err: 88. > OPENSSL_free(pkey_der); 89. return ret; 90. } crypto/mem.c:163:1: start of procedure CRYPTO_free() 161. } 162. 163. > void CRYPTO_free(void *str, const char *file, int line) 164. { 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { crypto/mem.c:165:9: Taking false branch 163. void CRYPTO_free(void *str, const char *file, int line) 164. { 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 166. free_impl(str, file, line); 167. return; crypto/mem.c:179:5: 177. } 178. #else 179. > free(str); 180. #endif 181. } crypto/mem.c:181:1: return from a call to CRYPTO_free 179. free(str); 180. #endif 181. > } 182. 183. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/ct/ct_log.c:89:5: 87. err: 88. OPENSSL_free(pkey_der); 89. > return ret; 90. } 91. crypto/ct/ct_log.c:90:1: return from a call to ct_v1_log_id_from_pkey 88. OPENSSL_free(pkey_der); 89. return ret; 90. > } 91. 92. CTLOG_STORE *CTLOG_STORE_new(void) crypto/ct/ct_log.c:249:9: Taking true branch 247. 248. ret->public_key = public_key; 249. if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1) ^ 250. goto err; 251. crypto/ct/ct_log.c:253:1: 251. 252. return ret; 253. > err: 254. CTLOG_free(ret); 255. return NULL; crypto/ct/ct_log.c:254:5: Skipping CTLOG_free(): empty list of specs 252. return ret; 253. err: 254. CTLOG_free(ret); ^ 255. return NULL; 256. }
https://github.com/openssl/openssl/blob/b2de11c58b57e7f0d58c6f8a1d4177705650647e/crypto/ct/ct_log.c/#L254
d2a_code_trace_data_43189
static int ra144_decode_frame(AVCodecContext * avctx, void *vdata, int *data_size, const uint8_t *buf, int buf_size) { static const uint8_t sizes[10] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2}; unsigned int refl_rms[4]; uint16_t block_coefs[4][30]; unsigned int lpc_refl[10]; int i, j; int16_t *data = vdata; unsigned int energy; RA144Context *ractx = avctx->priv_data; GetBitContext gb; if (*data_size < 2*160) return -1; if(buf_size < 20) { av_log(avctx, AV_LOG_ERROR, "Frame too small (%d bytes). Truncated file?\n", buf_size); *data_size = 0; return buf_size; } init_get_bits(&gb, buf, 20 * 8); for (i=0; i<10; i++) lpc_refl[i] = lpc_refl_cb[i][get_bits(&gb, sizes[i])]; eval_coefs(ractx->lpc_coef[0], lpc_refl); ractx->lpc_refl_rms[0] = rms(lpc_refl); energy = energy_tab[get_bits(&gb, 5)]; refl_rms[0] = interp(ractx, block_coefs[0], 1, 1, ractx->old_energy); refl_rms[1] = interp(ractx, block_coefs[1], 2, energy <= ractx->old_energy, t_sqrt(energy*ractx->old_energy) >> 12); refl_rms[2] = interp(ractx, block_coefs[2], 3, 0, energy); refl_rms[3] = rescale_rms(ractx->lpc_refl_rms[0], energy); int_to_int16(block_coefs[3], ractx->lpc_coef[0]); for (i=0; i < 4; i++) { do_output_subblock(ractx, block_coefs[i], refl_rms[i], &gb); for (j=0; j < BLOCKSIZE; j++) *data++ = av_clip_int16(ractx->curr_sblock[j + 10] << 2); } ractx->old_energy = energy; ractx->lpc_refl_rms[1] = ractx->lpc_refl_rms[0]; FFSWAP(unsigned int *, ractx->lpc_coef[0], ractx->lpc_coef[1]); *data_size = 2*160; return 20; } libavcodec/ra144.c:310: error: Null Dereference pointer `&gb->buffer` last assigned on line 307 could be null and is dereferenced by call to `get_bits()` at line 310, column 38. libavcodec/ra144.c:284:1: start of procedure ra144_decode_frame() 282. 283. /** Uncompress one block (20 bytes -> 160*2 bytes). */ 284. static int ra144_decode_frame(AVCodecContext * avctx, void *vdata, ^ 285. int *data_size, const uint8_t *buf, int buf_size) 286. { libavcodec/ra144.c:287:5: 285. int *data_size, const uint8_t *buf, int buf_size) 286. { 287. static const uint8_t sizes[10] = {6, 5, 5, 4, 4, 3, 3, 3, 3, 2}; ^ 288. unsigned int refl_rms[4]; // RMS of the reflection coefficients 289. uint16_t block_coefs[4][30]; // LPC coefficients of each sub-block libavcodec/ra144.c:292:5: 290. unsigned int lpc_refl[10]; // LPC reflection coefficients of the frame 291. int i, j; 292. int16_t *data = vdata; ^ 293. unsigned int energy; 294. libavcodec/ra144.c:295:5: 293. unsigned int energy; 294. 295. RA144Context *ractx = avctx->priv_data; ^ 296. GetBitContext gb; 297. libavcodec/ra144.c:298:9: Taking false branch 296. GetBitContext gb; 297. 298. if (*data_size < 2*160) ^ 299. return -1; 300. libavcodec/ra144.c:301:8: Taking false branch 299. return -1; 300. 301. if(buf_size < 20) { ^ 302. av_log(avctx, AV_LOG_ERROR, 303. "Frame too small (%d bytes). Truncated file?\n", buf_size); libavcodec/ra144.c:307:5: 305. return buf_size; 306. } 307. init_get_bits(&gb, buf, 20 * 8); ^ 308. 309. for (i=0; i<10; i++) libavcodec/bitstream.h:745:1: start of procedure init_get_bits() 743. * @param bit_size the size of the buffer in bits 744. */ 745. static inline void init_get_bits(GetBitContext *s, ^ 746. const uint8_t *buffer, int bit_size) 747. { libavcodec/bitstream.h:748:5: 746. const uint8_t *buffer, int bit_size) 747. { 748. int buffer_size= (bit_size+7)>>3; ^ 749. if(buffer_size < 0 || bit_size < 0) { 750. buffer_size = bit_size = 0; libavcodec/bitstream.h:749:8: Taking true branch 747. { 748. int buffer_size= (bit_size+7)>>3; 749. if(buffer_size < 0 || bit_size < 0) { ^ 750. buffer_size = bit_size = 0; 751. buffer = NULL; libavcodec/bitstream.h:750:9: 748. int buffer_size= (bit_size+7)>>3; 749. if(buffer_size < 0 || bit_size < 0) { 750. buffer_size = bit_size = 0; ^ 751. buffer = NULL; 752. } libavcodec/bitstream.h:751:9: 749. if(buffer_size < 0 || bit_size < 0) { 750. buffer_size = bit_size = 0; 751. buffer = NULL; ^ 752. } 753. libavcodec/bitstream.h:754:5: 752. } 753. 754. s->buffer= buffer; ^ 755. s->size_in_bits= bit_size; 756. s->buffer_end= buffer + buffer_size; libavcodec/bitstream.h:755:5: 753. 754. s->buffer= buffer; 755. s->size_in_bits= bit_size; ^ 756. s->buffer_end= buffer + buffer_size; 757. #ifdef ALT_BITSTREAM_READER libavcodec/bitstream.h:756:5: 754. s->buffer= buffer; 755. s->size_in_bits= bit_size; 756. s->buffer_end= buffer + buffer_size; ^ 757. #ifdef ALT_BITSTREAM_READER 758. s->index=0; libavcodec/bitstream.h:758:5: 756. s->buffer_end= buffer + buffer_size; 757. #ifdef ALT_BITSTREAM_READER 758. s->index=0; ^ 759. #elif defined LIBMPEG2_BITSTREAM_READER 760. s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1)); libavcodec/bitstream.h:768:1: return from a call to init_get_bits 766. skip_bits_long(s, 0); 767. #endif 768. } ^ 769. 770. static inline void align_get_bits(GetBitContext *s) libavcodec/ra144.c:309:10: 307. init_get_bits(&gb, buf, 20 * 8); 308. 309. for (i=0; i<10; i++) ^ 310. lpc_refl[i] = lpc_refl_cb[i][get_bits(&gb, sizes[i])]; 311. libavcodec/ra144.c:309:15: Loop condition is true. Entering loop body 307. init_get_bits(&gb, buf, 20 * 8); 308. 309. for (i=0; i<10; i++) ^ 310. lpc_refl[i] = lpc_refl_cb[i][get_bits(&gb, sizes[i])]; 311. libavcodec/ra144.c:310:9: 308. 309. for (i=0; i<10; i++) 310. lpc_refl[i] = lpc_refl_cb[i][get_bits(&gb, sizes[i])]; ^ 311. 312. eval_coefs(ractx->lpc_coef[0], lpc_refl); libavcodec/bitstream.h:642:1: start of procedure get_bits() 640. * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't 641. */ 642. static inline unsigned int get_bits(GetBitContext *s, int n){ ^ 643. register int tmp; 644. OPEN_READER(re, s) libavcodec/bitstream.h:644:5: 642. static inline unsigned int get_bits(GetBitContext *s, int n){ 643. register int tmp; 644. OPEN_READER(re, s) ^ 645. UPDATE_CACHE(re, s) 646. tmp= SHOW_UBITS(re, s, n); libavcodec/bitstream.h:645:5: 643. register int tmp; 644. OPEN_READER(re, s) 645. UPDATE_CACHE(re, s) ^ 646. tmp= SHOW_UBITS(re, s, n); 647. LAST_SKIP_BITS(re, s, n)
https://github.com/libav/libav/blob/0885770455c32180001b2ce05d181abe8deaf06d/libavcodec/ra144.c/#L310
d2a_code_trace_data_43190
static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, OPENSSL_LH_DOALL_FUNC func, OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) { int i; OPENSSL_LH_NODE *a, *n; if (lh == NULL) return; for (i = lh->num_nodes - 1; i >= 0; i--) { a = lh->b[i]; while (a != NULL) { n = a->next; if (use_arg) func_arg(a->data, arg); else func(a->data); a = n; } } } apps/s_server.c:2007: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `SSL_CTX_free`. Showing all 15 steps of the trace apps/s_server.c:1958:14: Call 1956. srp_callback_parm.login = NULL; 1957. if ((ret = 1958. SRP_VBASE_init(srp_callback_parm.vb, ^ 1959. srp_verifier_file)) != SRP_NO_ERROR) { 1960. BIO_printf(bio_err, crypto/srp/srp_vfy.c:448:5: Call 446. SRP_user_pwd_free(user_pwd); 447. 448. TXT_DB_free(tmpdb); ^ 449. BIO_free_all(in); 450. crypto/txt_db/txt_db.c:265:1: Parameter `(*db->index)->num_nodes` 263. } 264. 265. > void TXT_DB_free(TXT_DB *db) 266. { 267. int i, n; apps/s_server.c:2007:5: Call 2005. ret = 0; 2006. end: 2007. SSL_CTX_free(ctx); ^ 2008. set_keylog_file(NULL, NULL); 2009. X509_free(s_cert); ssl/ssl_lib.c:2582:1: Parameter `a->sessions->num_nodes` 2580. } 2581. 2582. > void SSL_CTX_free(SSL_CTX *a) 2583. { 2584. int i; ssl/ssl_lib.c:2608:9: Call 2606. */ 2607. if (a->sessions != NULL) 2608. SSL_CTX_flush_sessions(a, 0); ^ 2609. 2610. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:1013:1: Parameter `s->sessions->num_nodes` 1011. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1012. 1013. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 1014. { 1015. unsigned long i; ssl/ssl_sess.c:1026:5: Call 1024. i = lh_SSL_SESSION_get_down_load(s->sessions); 1025. lh_SSL_SESSION_set_down_load(s->sessions, 0); 1026. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp); ^ 1027. lh_SSL_SESSION_set_down_load(s->sessions, i); 1028. CRYPTO_THREAD_unlock(s->lock); ssl/ssl_sess.c:1011:1: Parameter `lh->num_nodes` 1009. } 1010. 1011. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1012. 1013. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) ssl/ssl_sess.c:1011:1: Call 1009. } 1010. 1011. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1012. 1013. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) crypto/lhash/lhash.c:182:1: Parameter `lh->num_nodes` 180. } 181. 182. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); crypto/lhash/lhash.c:184:5: Call 182. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); ^ 185. } 186. crypto/lhash/lhash.c:150:1: <LHS trace> 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:150:1: Parameter `lh->num_nodes` 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:164:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `SSL_CTX_free` 162. * memory leaks otherwise 163. */ 164. for (i = lh->num_nodes - 1; i >= 0; i--) { ^ 165. a = lh->b[i]; 166. while (a != NULL) {
https://github.com/openssl/openssl/blob/68a55f3b451060c747986aeffa322d32c770dd62/crypto/lhash/lhash.c/#L164
d2a_code_trace_data_43191
static void qmf_32_subbands(DCAContext * s, int chans, float samples_in[32][8], float *samples_out, float scale, float bias) { const float *prCoeff; int i, j, k; float praXin[33], *raXin = &praXin[1]; float *subband_fir_hist = s->subband_fir_hist[chans]; float *subband_fir_hist2 = s->subband_fir_noidea[chans]; int chindex = 0, subindex; praXin[0] = 0.0; if (!s->multirate_inter) prCoeff = fir_32bands_nonperfect; else prCoeff = fir_32bands_perfect; for (subindex = 0; subindex < 8; subindex++) { float t1, t2, sum[16], diff[16]; for (i = 0; i < s->subband_activity[chans]; i++) raXin[i] = samples_in[i][subindex]; for (; i < 32; i++) raXin[i] = 0.0; for (j = 0, k = 0; k < 16; k++) { t1 = 0.0; t2 = 0.0; for (i = 0; i < 16; i++, j++){ t1 += (raXin[2 * i] + raXin[2 * i + 1]) * cos_mod[j]; t2 += (raXin[2 * i] + raXin[2 * i - 1]) * cos_mod[j + 256]; } sum[k] = t1 + t2; diff[k] = t1 - t2; } j = 512; for (k = 0; k < 16; k++) subband_fir_hist[k] = cos_mod[j++] * sum[k]; for (k = 0; k < 16; k++) subband_fir_hist[32-k-1] = cos_mod[j++] * diff[k]; for (k = 31, i = 0; i < 32; i++, k--) for (j = 0; j < 512; j += 64){ subband_fir_hist2[i] += prCoeff[i+j] * ( subband_fir_hist[i+j] - subband_fir_hist[j+k]); subband_fir_hist2[i+32] += prCoeff[i+j+32]*(-subband_fir_hist[i+j] - subband_fir_hist[j+k]); } for (i = 0; i < 32; i++) samples_out[chindex++] = subband_fir_hist2[i] * scale + bias; memmove(&subband_fir_hist[32], &subband_fir_hist[0], (512 - 32) * sizeof(float)); memmove(&subband_fir_hist2[0], &subband_fir_hist2[32], 32 * sizeof(float)); memset(&subband_fir_hist2[32], 0, 32 * sizeof(float)); } } libavcodec/dca.c:1181: error: Buffer Overrun L2 Offset: [-oo, 541+max(5, `avctx->priv_data->prim_channels`)] (⇐ [0, -1+max(5, `avctx->priv_data->prim_channels`)] + [-oo, 542]) Size: 5 by call to `dca_decode_block`. libavcodec/dca.c:1143:1: Parameter `avctx->priv_data->prim_channels` 1141. * FIXME add arguments 1142. */ 1143. static int dca_decode_frame(AVCodecContext * avctx, ^ 1144. void *data, int *data_size, 1145. const uint8_t * buf, int buf_size) libavcodec/dca.c:1161:9: Call 1159. 1160. init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8); 1161. if (dca_parse_frame_header(s) < 0) { ^ 1162. //seems like the frame is corrupt, try with the next one 1163. *data_size=0; libavcodec/dca.c:227:1: Parameter `s->prim_channels` 225. } 226. 227. static int dca_parse_frame_header(DCAContext * s) ^ 228. { 229. int i, j; libavcodec/dca.c:1181:9: Call 1179. *data_size = 0; 1180. for (i = 0; i < (s->sample_blocks / 8); i++) { 1181. dca_decode_block(s); ^ 1182. s->dsp.float_to_int16(s->tsamples, s->samples, 256 * channels); 1183. /* interleave samples */ libavcodec/dca.c:1055:1: Parameter `s->prim_channels` 1053. */ 1054. 1055. static int dca_decode_block(DCAContext * s) ^ 1056. { 1057. libavcodec/dca.c:1078:9: Call 1076. av_log(s->avctx, AV_LOG_DEBUG, "DSYNC dca_subsubframe\n"); 1077. #endif 1078. if (dca_subsubframe(s)) ^ 1079. return -1; 1080. libavcodec/dca.c:848:1: Parameter `s->prim_channels` 846. static const uint8_t abits_levels[7] = { 3, 5, 7, 9, 13, 17, 25 }; 847. 848. static int dca_subsubframe(DCAContext * s) ^ 849. { 850. int k, l; libavcodec/dca.c:992:10: Call 990. /* static float pcm_to_double[8] = 991. {32768.0, 32768.0, 524288.0, 524288.0, 0, 8388608.0, 8388608.0};*/ 992. qmf_32_subbands(s, k, subband_samples[k], &s->samples[256 * k], ^ 993. 2.0 / 3 /*pcm_to_double[s->source_pcm_res] */ , 994. 0 /*s->bias */ ); libavcodec/dca.c:705:14: <Offset trace> 703. 704. /* Multiply by filter coefficients */ 705. for (k = 31, i = 0; i < 32; i++, k--) ^ 706. for (j = 0; j < 512; j += 64){ 707. subband_fir_hist2[i] += prCoeff[i+j] * ( subband_fir_hist[i+j] - subband_fir_hist[j+k]); libavcodec/dca.c:705:14: Assignment 703. 704. /* Multiply by filter coefficients */ 705. for (k = 31, i = 0; i < 32; i++, k--) ^ 706. for (j = 0; j < 512; j += 64){ 707. subband_fir_hist2[i] += prCoeff[i+j] * ( subband_fir_hist[i+j] - subband_fir_hist[j+k]); libavcodec/dca.c:653:1: <Length trace> 651. } 652. 653. static void qmf_32_subbands(DCAContext * s, int chans, ^ 654. float samples_in[32][8], float *samples_out, 655. float scale, float bias) libavcodec/dca.c:653:1: Parameter `chans` 651. } 652. 653. static void qmf_32_subbands(DCAContext * s, int chans, ^ 654. float samples_in[32][8], float *samples_out, 655. float scale, float bias) libavcodec/dca.c:661:5: Assignment 659. float praXin[33], *raXin = &praXin[1]; 660. 661. float *subband_fir_hist = s->subband_fir_hist[chans]; ^ 662. float *subband_fir_hist2 = s->subband_fir_noidea[chans]; 663. libavcodec/dca.c:707:86: Array access: Offset: [-oo, 541+max(5, avctx->priv_data->prim_channels)] (⇐ [0, -1+max(5, avctx->priv_data->prim_channels)] + [-oo, 542]) Size: 5 by call to `dca_decode_block` 705. for (k = 31, i = 0; i < 32; i++, k--) 706. for (j = 0; j < 512; j += 64){ 707. subband_fir_hist2[i] += prCoeff[i+j] * ( subband_fir_hist[i+j] - subband_fir_hist[j+k]); ^ 708. subband_fir_hist2[i+32] += prCoeff[i+j+32]*(-subband_fir_hist[i+j] - subband_fir_hist[j+k]); 709. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dca.c/#L707
d2a_code_trace_data_43192
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; return 1; } ssl/statem/statem_clnt.c:2255: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 2]):unsigned64 by call to `WPACKET_sub_allocate_bytes__`. Showing all 12 steps of the trace ssl/statem/statem_clnt.c:2235:1: Parameter `pkt->written` 2233. } 2234. 2235. > static int tls_construct_cke_dhe(SSL *s, WPACKET *pkt, int *al) 2236. { 2237. #ifndef OPENSSL_NO_DH ssl/statem/statem_clnt.c:2255:10: Call 2253. /* send off the data */ 2254. DH_get0_key(dh_clnt, &pub_key, NULL); 2255. if (!WPACKET_sub_allocate_bytes_u16(pkt, BN_num_bytes(pub_key), &keybytes)) ^ 2256. goto err; 2257. ssl/packet.c:28:10: Call 26. unsigned char **allocbytes, size_t lenbytes) 27. { 28. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) ^ 29. || !WPACKET_allocate_bytes(pkt, len, allocbytes) 30. || !WPACKET_close(pkt)) ssl/packet.c:224:1: Parameter `pkt->buf->length` 222. } 223. 224. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 225. { 226. WPACKET_SUB *sub; ssl/packet.c:29:17: Call 27. { 28. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) 29. || !WPACKET_allocate_bytes(pkt, len, allocbytes) ^ 30. || !WPACKET_close(pkt)) 31. return 0; ssl/packet.c:15:1: Parameter `pkt->written` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ssl/packet.c:17:10: Call 15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ^ 18. return 0; 19. ssl/packet.c:36:1: <LHS trace> 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: Parameter `pkt->buf->length` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: <RHS trace> 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: Parameter `len` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:46:9: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 2]):unsigned64 by call to `WPACKET_sub_allocate_bytes__` 44. return 0; 45. 46. if (pkt->buf->length - pkt->written < len) { ^ 47. size_t newlen; 48. size_t reflen;
https://github.com/openssl/openssl/blob/e4e1aa903e624044d3319622fc50222f1b2c7328/ssl/packet.c/#L46
d2a_code_trace_data_43193
int dct_quantize_trellis_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow){ const int *qmat; const uint8_t *scantable= s->intra_scantable.scantable; const uint8_t *perm_scantable= s->intra_scantable.permutated; int max=0; unsigned int threshold1, threshold2; int bias=0; int run_tab[65]; int level_tab[65]; int score_tab[65]; int survivor[65]; int survivor_count; int last_run=0; int last_level=0; int last_score= 0; int last_i; int coeff[2][64]; int coeff_count[64]; int qmul, qadd, start_i, last_non_zero, i, dc; const int esc_length= s->ac_esc_length; uint8_t * length; uint8_t * last_length; const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6); s->dsp.fdct (block); if(s->dct_error_sum) s->denoise_dct(s, block); qmul= qscale*16; qadd= ((qscale-1)|1)*8; if (s->mb_intra) { int q; if (!s->h263_aic) { if (n < 4) q = s->y_dc_scale; else q = s->c_dc_scale; q = q << 3; } else{ q = 1 << 3; qadd=0; } block[0] = (block[0] + (q >> 1)) / q; start_i = 1; last_non_zero = 0; qmat = s->q_intra_matrix[qscale]; if(s->mpeg_quant || s->out_format == FMT_MPEG1) bias= 1<<(QMAT_SHIFT-1); length = s->intra_ac_vlc_length; last_length= s->intra_ac_vlc_last_length; } else { start_i = 0; last_non_zero = -1; qmat = s->q_inter_matrix[qscale]; length = s->inter_ac_vlc_length; last_length= s->inter_ac_vlc_last_length; } last_i= start_i; threshold1= (1<<QMAT_SHIFT) - bias - 1; threshold2= (threshold1<<1); for(i=63; i>=start_i; i--) { const int j = scantable[i]; int level = block[j] * qmat[j]; if(((unsigned)(level+threshold1))>threshold2){ last_non_zero = i; break; } } for(i=start_i; i<=last_non_zero; i++) { const int j = scantable[i]; int level = block[j] * qmat[j]; if(((unsigned)(level+threshold1))>threshold2){ if(level>0){ level= (bias + level)>>QMAT_SHIFT; coeff[0][i]= level; coeff[1][i]= level-1; }else{ level= (bias - level)>>QMAT_SHIFT; coeff[0][i]= -level; coeff[1][i]= -level+1; } coeff_count[i]= FFMIN(level, 2); assert(coeff_count[i]); max |=level; }else{ coeff[0][i]= (level>>31)|1; coeff_count[i]= 1; } } *overflow= s->max_qcoeff < max; if(last_non_zero < start_i){ memset(block + start_i, 0, (64-start_i)*sizeof(DCTELEM)); return last_non_zero; } score_tab[start_i]= 0; survivor[0]= start_i; survivor_count= 1; for(i=start_i; i<=last_non_zero; i++){ int level_index, j, zero_distoration; int dct_coeff= FFABS(block[ scantable[i] ]); int best_score=256*256*256*120; if ( s->dsp.fdct == fdct_ifast #ifndef FAAN_POSTSCALE || s->dsp.fdct == ff_faandct #endif ) dct_coeff= (dct_coeff*inv_aanscales[ scantable[i] ]) >> 12; zero_distoration= dct_coeff*dct_coeff; for(level_index=0; level_index < coeff_count[i]; level_index++){ int distoration; int level= coeff[level_index][i]; const int alevel= FFABS(level); int unquant_coeff; assert(level); if(s->out_format == FMT_H263){ unquant_coeff= alevel*qmul + qadd; }else{ j= s->dsp.idct_permutation[ scantable[i] ]; if(s->mb_intra){ unquant_coeff = (int)( alevel * qscale * s->intra_matrix[j]) >> 3; unquant_coeff = (unquant_coeff - 1) | 1; }else{ unquant_coeff = ((( alevel << 1) + 1) * qscale * ((int) s->inter_matrix[j])) >> 4; unquant_coeff = (unquant_coeff - 1) | 1; } unquant_coeff<<= 3; } distoration= (unquant_coeff - dct_coeff) * (unquant_coeff - dct_coeff) - zero_distoration; level+=64; if((level&(~127)) == 0){ for(j=survivor_count-1; j>=0; j--){ int run= i - survivor[j]; int score= distoration + length[UNI_AC_ENC_INDEX(run, level)]*lambda; score += score_tab[i-run]; if(score < best_score){ best_score= score; run_tab[i+1]= run; level_tab[i+1]= level-64; } } if(s->out_format == FMT_H263){ for(j=survivor_count-1; j>=0; j--){ int run= i - survivor[j]; int score= distoration + last_length[UNI_AC_ENC_INDEX(run, level)]*lambda; score += score_tab[i-run]; if(score < last_score){ last_score= score; last_run= run; last_level= level-64; last_i= i+1; } } } }else{ distoration += esc_length*lambda; for(j=survivor_count-1; j>=0; j--){ int run= i - survivor[j]; int score= distoration + score_tab[i-run]; if(score < best_score){ best_score= score; run_tab[i+1]= run; level_tab[i+1]= level-64; } } if(s->out_format == FMT_H263){ for(j=survivor_count-1; j>=0; j--){ int run= i - survivor[j]; int score= distoration + score_tab[i-run]; if(score < last_score){ last_score= score; last_run= run; last_level= level-64; last_i= i+1; } } } } } score_tab[i+1]= best_score; if(last_non_zero <= 27){ for(; survivor_count; survivor_count--){ if(score_tab[ survivor[survivor_count-1] ] <= best_score) break; } }else{ for(; survivor_count; survivor_count--){ if(score_tab[ survivor[survivor_count-1] ] <= best_score + lambda) break; } } survivor[ survivor_count++ ]= i+1; } if(s->out_format != FMT_H263){ last_score= 256*256*256*120; for(i= survivor[0]; i<=last_non_zero + 1; i++){ int score= score_tab[i]; if(i) score += lambda*2; if(score < last_score){ last_score= score; last_i= i; last_level= level_tab[i]; last_run= run_tab[i]; } } } s->coded_score[n] = last_score; dc= FFABS(block[0]); last_non_zero= last_i - 1; memset(block + start_i, 0, (64-start_i)*sizeof(DCTELEM)); if(last_non_zero < start_i) return last_non_zero; if(last_non_zero == 0 && start_i == 0){ int best_level= 0; int best_score= dc * dc; for(i=0; i<coeff_count[0]; i++){ int level= coeff[i][0]; int alevel= FFABS(level); int unquant_coeff, score, distortion; if(s->out_format == FMT_H263){ unquant_coeff= (alevel*qmul + qadd)>>3; }else{ unquant_coeff = ((( alevel << 1) + 1) * qscale * ((int) s->inter_matrix[0])) >> 4; unquant_coeff = (unquant_coeff - 1) | 1; } unquant_coeff = (unquant_coeff + 4) >> 3; unquant_coeff<<= 3 + 3; distortion= (unquant_coeff - dc) * (unquant_coeff - dc); level+=64; if((level&(~127)) == 0) score= distortion + last_length[UNI_AC_ENC_INDEX(0, level)]*lambda; else score= distortion + esc_length*lambda; if(score < best_score){ best_score= score; best_level= level - 64; } } block[0]= best_level; s->coded_score[n] = best_score - dc*dc; if(best_level == 0) return -1; else return last_non_zero; } i= last_i; assert(last_level); block[ perm_scantable[last_non_zero] ]= last_level; i -= last_run + 1; for(; i>start_i; i -= run_tab[i] + 1){ block[ perm_scantable[i-1] ]= level_tab[i]; } return last_non_zero; } libavcodec/mpegvideo_enc.c:3253: error: Uninitialized Value The value read from run_tab[_] was never initialized. libavcodec/mpegvideo_enc.c:3253:22: 3251. i -= last_run + 1; 3252. 3253. for(; i>start_i; i -= run_tab[i] + 1){ ^ 3254. block[ perm_scantable[i-1] ]= level_tab[i]; 3255. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo_enc.c/#L3253
d2a_code_trace_data_43194
int test_mod_mul(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b, *c, *d, *e; int i, j; a = BN_new(); b = BN_new(); c = BN_new(); d = BN_new(); e = BN_new(); BN_one(a); BN_one(b); BN_zero(c); if (BN_mod_mul(e, a, b, c, ctx)) { fprintf(stderr, "BN_mod_mul with zero modulus succeeded!\n"); return 0; } for (j = 0; j < 3; j++) { BN_bntest_rand(c, 1024, 0, 0); for (i = 0; i < num0; i++) { BN_bntest_rand(a, 475 + i * 10, 0, 0); BN_bntest_rand(b, 425 + i * 11, 0, 0); a->neg = rand_neg(); b->neg = rand_neg(); if (!BN_mod_mul(e, a, b, c, ctx)) { unsigned long l; while ((l = ERR_get_error())) fprintf(stderr, "ERROR:%s\n", ERR_error_string(l, NULL)); EXIT(1); } if (bp != NULL) { if (!results) { BN_print(bp, a); BIO_puts(bp, " * "); BN_print(bp, b); BIO_puts(bp, " % "); BN_print(bp, c); if ((a->neg ^ b->neg) && !BN_is_zero(e)) { BIO_puts(bp, " + "); BN_print(bp, c); } BIO_puts(bp, " - "); } BN_print(bp, e); BIO_puts(bp, "\n"); } BN_mul(d, a, b, ctx); BN_sub(d, d, e); BN_div(a, b, d, c, ctx); if (!BN_is_zero(b)) { fprintf(stderr, "Modulo multiply test failed!\n"); ERR_print_errors_fp(stderr); return 0; } } } BN_free(a); BN_free(b); BN_free(c); BN_free(d); BN_free(e); return (1); } test/bntest.c:911: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 905, column 9 is not reachable after line 911, column 17. Showing all 143 steps of the trace test/bntest.c:896:1: start of procedure test_mod_mul() 894. } 895. 896. > int test_mod_mul(BIO *bp, BN_CTX *ctx) 897. { 898. BIGNUM *a, *b, *c, *d, *e; test/bntest.c:901:5: 899. int i, j; 900. 901. > a = BN_new(); 902. b = BN_new(); 903. c = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:902:5: 900. 901. a = BN_new(); 902. > b = BN_new(); 903. c = BN_new(); 904. d = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:903:5: 901. a = BN_new(); 902. b = BN_new(); 903. > c = BN_new(); 904. d = BN_new(); 905. e = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:904:5: 902. b = BN_new(); 903. c = BN_new(); 904. > d = BN_new(); 905. e = BN_new(); 906. crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:905:5: 903. c = BN_new(); 904. d = BN_new(); 905. > e = BN_new(); 906. 907. BN_one(a); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:907:5: 905. e = BN_new(); 906. 907. > BN_one(a); 908. BN_one(b); 909. BN_zero(c); crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is true 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:908:5: 906. 907. BN_one(a); 908. > BN_one(b); 909. BN_zero(c); 910. if (BN_mod_mul(e, a, b, c, ctx)) { crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is true 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:909:5: 907. BN_one(a); 908. BN_one(b); 909. > BN_zero(c); 910. if (BN_mod_mul(e, a, b, c, ctx)) { 911. fprintf(stderr, "BN_mod_mul with zero modulus succeeded!\n"); crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is false 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:910:9: Taking true branch 908. BN_one(b); 909. BN_zero(c); 910. if (BN_mod_mul(e, a, b, c, ctx)) { ^ 911. fprintf(stderr, "BN_mod_mul with zero modulus succeeded!\n"); 912. return 0; test/bntest.c:911:9: 909. BN_zero(c); 910. if (BN_mod_mul(e, a, b, c, ctx)) { 911. > fprintf(stderr, "BN_mod_mul with zero modulus succeeded!\n"); 912. return 0; 913. }
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L911
d2a_code_trace_data_43195
static int opt_vstats(const char *opt, const char *arg) { char filename[40]; time_t today2 = time(NULL); struct tm *today = localtime(&today2); snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, today->tm_sec); return opt_vstats_file(opt, filename); } avconv.c:4296: error: Null Dereference pointer `today` last assigned on line 4294 could be null and is dereferenced at line 4296, column 69. avconv.c:4290:1: start of procedure opt_vstats() 4288. } 4289. 4290. static int opt_vstats(const char *opt, const char *arg) ^ 4291. { 4292. char filename[40]; avconv.c:4293:5: 4291. { 4292. char filename[40]; 4293. time_t today2 = time(NULL); ^ 4294. struct tm *today = localtime(&today2); 4295. avconv.c:4294:5: 4292. char filename[40]; 4293. time_t today2 = time(NULL); 4294. struct tm *today = localtime(&today2); ^ 4295. 4296. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, avconv.c:4296:5: 4294. struct tm *today = localtime(&today2); 4295. 4296. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, ^ 4297. today->tm_sec); 4298. return opt_vstats_file(opt, filename);
https://github.com/libav/libav/blob/e1e369049e3d2f88eed6ed38eb3dd704681c7f1a/avconv.c/#L4296
d2a_code_trace_data_43196
static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr, int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], int ref_mv_scale, int flags, int size, int h) { MotionEstContext * const c= &s->me; int best[2]={0, 0}; int d; int dmin; int map_generation; int penalty_factor; const int ref_mv_stride= s->mb_stride; const int ref_mv_xy= s->mb_x + s->mb_y*ref_mv_stride; me_cmp_func cmpf, chroma_cmpf; LOAD_COMMON LOAD_COMMON2 if(c->pre_pass){ penalty_factor= c->pre_penalty_factor; cmpf= s->dsp.me_pre_cmp[size]; chroma_cmpf= s->dsp.me_pre_cmp[size+1]; }else{ penalty_factor= c->penalty_factor; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; } map_generation= update_map_generation(c); assert(cmpf); dmin= cmp(s, 0, 0, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags); map[0]= map_generation; score_map[0]= dmin; if((s->pict_type == FF_B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0) dmin += (mv_penalty[pred_x] + mv_penalty[pred_y])*penalty_factor; if (s->first_slice_line) { CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) }else{ if(dmin<((h*h*s->avctx->mv0_threshold)>>8) && ( P_LEFT[0] |P_LEFT[1] |P_TOP[0] |P_TOP[1] |P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){ *mx_ptr= 0; *my_ptr= 0; c->skip=1; return dmin; } CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift) CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift) CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) } if(dmin>h*h*4){ if(c->pre_pass){ CHECK_CLIPPED_MV((last_mv[ref_mv_xy-1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy-1][1]*ref_mv_scale + (1<<15))>>16) if(!s->first_slice_line) CHECK_CLIPPED_MV((last_mv[ref_mv_xy-ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy-ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) }else{ CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) if(s->mb_y+1<s->end_mb_y) CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) } } if(c->avctx->last_predictor_count){ const int count= c->avctx->last_predictor_count; const int xstart= FFMAX(0, s->mb_x - count); const int ystart= FFMAX(0, s->mb_y - count); const int xend= FFMIN(s->mb_width , s->mb_x + count + 1); const int yend= FFMIN(s->mb_height, s->mb_y + count + 1); int mb_y; for(mb_y=ystart; mb_y<yend; mb_y++){ int mb_x; for(mb_x=xstart; mb_x<xend; mb_x++){ const int xy= mb_x + 1 + (mb_y + 1)*ref_mv_stride; int mx= (last_mv[xy][0]*ref_mv_scale + (1<<15))>>16; int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16; if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue; CHECK_MV(mx,my) } } } dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); *mx_ptr= best[0]; *my_ptr= best[1]; return dmin; } libavcodec/motion_est_template.c:1059: error: Uninitialized Value The value read from ymax was never initialized. libavcodec/motion_est_template.c:1059:9: 1057. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1) 1058. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1) 1059. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) ) ^ 1060. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) ) 1061. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1059
d2a_code_trace_data_43197
static int build_chain(X509_STORE_CTX *ctx) { struct dane_st *dane = (struct dane_st *)ctx->dane; int num = sk_X509_num(ctx->chain); X509 *cert = sk_X509_value(ctx->chain, num - 1); int ss = cert_self_signed(cert); STACK_OF(X509) *sktmp = NULL; unsigned int search; int may_trusted = 0; int may_alternate = 0; int trust = X509_TRUST_UNTRUSTED; int alt_untrusted = 0; int depth; int ok = 0; int i; OPENSSL_assert(num == 1 && ctx->num_untrusted == num); #define S_DOUNTRUSTED (1 << 0) #define S_DOTRUSTED (1 << 1) #define S_DOALTERNATE (1 << 2) search = (ctx->untrusted != NULL) ? S_DOUNTRUSTED : 0; if (DANETLS_HAS_PKIX(dane) || !DANETLS_HAS_DANE(dane)) { if (search == 0 || ctx->param->flags & X509_V_FLAG_TRUSTED_FIRST) search |= S_DOTRUSTED; else if (!(ctx->param->flags & X509_V_FLAG_NO_ALT_CHAINS)) may_alternate = 1; may_trusted = 1; } if (ctx->untrusted && (sktmp = sk_X509_dup(ctx->untrusted)) == NULL) { X509err(X509_F_BUILD_CHAIN, ERR_R_MALLOC_FAILURE); return 0; } if (DANETLS_ENABLED(dane) && dane->certs != NULL) { for (i = 0; i < sk_X509_num(dane->certs); ++i) { if (!sk_X509_push(sktmp, sk_X509_value(dane->certs, i))) { sk_X509_free(sktmp); X509err(X509_F_BUILD_CHAIN, ERR_R_MALLOC_FAILURE); return 0; } } } if (ctx->param->depth > INT_MAX/2) ctx->param->depth = INT_MAX/2; depth = ctx->param->depth + 1; while (search != 0) { X509 *x; X509 *xtmp = NULL; if ((search & S_DOTRUSTED) != 0) { STACK_OF(X509) *hide = ctx->chain; i = num = sk_X509_num(ctx->chain); if ((search & S_DOALTERNATE) != 0) { i = alt_untrusted; } x = sk_X509_value(ctx->chain, i-1); ctx->chain = NULL; ok = (depth < num) ? 0 : ctx->get_issuer(&xtmp, ctx, x); ctx->chain = hide; if (ok < 0) { trust = X509_TRUST_REJECTED; search = 0; continue; } if (ok > 0) { if ((search & S_DOALTERNATE) != 0) { OPENSSL_assert(num > i && i > 0 && ss == 0); search &= ~S_DOALTERNATE; for (; num > i; --num) X509_free(sk_X509_pop(ctx->chain)); ctx->num_untrusted = num; if (DANETLS_ENABLED(dane) && dane->mdpth >= ctx->num_untrusted) { dane->mdpth = -1; X509_free(dane->mcert); dane->mcert = NULL; } if (DANETLS_ENABLED(dane) && dane->pdpth >= ctx->num_untrusted) dane->pdpth = -1; } if (ss == 0) { if (!sk_X509_push(ctx->chain, x = xtmp)) { X509_free(xtmp); X509err(X509_F_BUILD_CHAIN, ERR_R_MALLOC_FAILURE); trust = X509_TRUST_REJECTED; search = 0; continue; } ss = cert_self_signed(x); } else if (num == ctx->num_untrusted) { if (X509_cmp(x, xtmp) != 0) { X509_free(xtmp); ok = 0; } else { X509_free(x); ctx->num_untrusted = --num; (void) sk_X509_set(ctx->chain, num, x = xtmp); } } if (ok) { OPENSSL_assert(ctx->num_untrusted <= num); search &= ~S_DOUNTRUSTED; switch (trust = check_trust(ctx, num)) { case X509_TRUST_TRUSTED: case X509_TRUST_REJECTED: search = 0; continue; } if (ss == 0) continue; } } if ((search & S_DOUNTRUSTED) == 0) { if ((search & S_DOALTERNATE) != 0 && --alt_untrusted > 0) continue; if (!may_alternate || (search & S_DOALTERNATE) != 0 || ctx->num_untrusted < 2) break; search |= S_DOALTERNATE; alt_untrusted = ctx->num_untrusted - 1; ss = 0; } } if ((search & S_DOUNTRUSTED) != 0) { num = sk_X509_num(ctx->chain); OPENSSL_assert(num == ctx->num_untrusted); x = sk_X509_value(ctx->chain, num-1); xtmp = (depth < num) ? NULL : find_issuer(ctx, sktmp, x); if (xtmp == NULL) { search &= ~S_DOUNTRUSTED; if (may_trusted) search |= S_DOTRUSTED; continue; } if (!sk_X509_push(ctx->chain, x = xtmp)) { X509err(X509_F_BUILD_CHAIN, ERR_R_MALLOC_FAILURE); trust = X509_TRUST_REJECTED; search = 0; continue; } X509_up_ref(x); ++ctx->num_untrusted; ss = cert_self_signed(xtmp); (void) sk_X509_delete_ptr(sktmp, x); switch (trust = check_dane_issuer(ctx, ctx->num_untrusted - 1)) { case X509_TRUST_TRUSTED: case X509_TRUST_REJECTED: search = 0; continue; } } } sk_X509_free(sktmp); num = sk_X509_num(ctx->chain); if (num <= depth) { if (trust == X509_TRUST_UNTRUSTED && DANETLS_HAS_DANE_TA(dane)) trust = check_dane_pkeys(ctx); if (trust == X509_TRUST_UNTRUSTED && num == ctx->num_untrusted) trust = check_trust(ctx, num); } switch (trust) { case X509_TRUST_TRUSTED: return 1; case X509_TRUST_REJECTED: return 0; case X509_TRUST_UNTRUSTED: default: num = sk_X509_num(ctx->chain); ctx->current_cert = sk_X509_value(ctx->chain, num - 1); ctx->error_depth = num-1; if (num > depth) ctx->error = X509_V_ERR_CERT_CHAIN_TOO_LONG; else if (DANETLS_ENABLED(dane) && (!DANETLS_HAS_PKIX(dane) || dane->pdpth >= 0)) ctx->error = X509_V_ERR_CERT_UNTRUSTED; else if (ss && sk_X509_num(ctx->chain) == 1) ctx->error = X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT; else if (ss) ctx->error = X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN; else if (ctx->num_untrusted == num) ctx->error = X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY; else ctx->error = X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT; if (DANETLS_ENABLED(dane)) dane_reset(dane); return ctx->verify_cb(0, ctx); } } crypto/x509/x509_vfy.c:2695: error: NULL_DEREFERENCE pointer `cert` last assigned on line 2694 could be null and is dereferenced by call to `cert_self_signed()` at line 2695, column 14. Showing all 20 steps of the trace crypto/x509/x509_vfy.c:2690:1: start of procedure build_chain() 2688. } 2689. 2690. > static int build_chain(X509_STORE_CTX *ctx) 2691. { 2692. struct dane_st *dane = (struct dane_st *)ctx->dane; crypto/x509/x509_vfy.c:2692:5: 2690. static int build_chain(X509_STORE_CTX *ctx) 2691. { 2692. > struct dane_st *dane = (struct dane_st *)ctx->dane; 2693. int num = sk_X509_num(ctx->chain); 2694. X509 *cert = sk_X509_value(ctx->chain, num - 1); crypto/x509/x509_vfy.c:2693:5: 2691. { 2692. struct dane_st *dane = (struct dane_st *)ctx->dane; 2693. > int num = sk_X509_num(ctx->chain); 2694. X509 *cert = sk_X509_value(ctx->chain, num - 1); 2695. int ss = cert_self_signed(cert); include/openssl/x509.h:169:1: start of procedure sk_X509_num() 167. typedef struct x509_cinf_st X509_CINF; 168. 169. > DEFINE_STACK_OF(X509) 170. 171. /* This is used for a table of trust checking functions */ crypto/stack/stack.c:316:1: start of procedure sk_num() 314. } 315. 316. > int sk_num(const _STACK *st) 317. { 318. if (st == NULL) crypto/stack/stack.c:318:9: Taking true branch 316. int sk_num(const _STACK *st) 317. { 318. if (st == NULL) ^ 319. return -1; 320. return st->num; crypto/stack/stack.c:319:9: 317. { 318. if (st == NULL) 319. > return -1; 320. return st->num; 321. } crypto/stack/stack.c:321:1: return from a call to sk_num 319. return -1; 320. return st->num; 321. > } 322. 323. void *sk_value(const _STACK *st, int i) include/openssl/x509.h:169:1: return from a call to sk_X509_num 167. typedef struct x509_cinf_st X509_CINF; 168. 169. > DEFINE_STACK_OF(X509) 170. 171. /* This is used for a table of trust checking functions */ crypto/x509/x509_vfy.c:2694:5: 2692. struct dane_st *dane = (struct dane_st *)ctx->dane; 2693. int num = sk_X509_num(ctx->chain); 2694. > X509 *cert = sk_X509_value(ctx->chain, num - 1); 2695. int ss = cert_self_signed(cert); 2696. STACK_OF(X509) *sktmp = NULL; include/openssl/x509.h:169:1: start of procedure sk_X509_value() 167. typedef struct x509_cinf_st X509_CINF; 168. 169. > DEFINE_STACK_OF(X509) 170. 171. /* This is used for a table of trust checking functions */ crypto/stack/stack.c:323:1: start of procedure sk_value() 321. } 322. 323. > void *sk_value(const _STACK *st, int i) 324. { 325. if (!st || (i < 0) || (i >= st->num)) crypto/stack/stack.c:325:10: Taking true branch 323. void *sk_value(const _STACK *st, int i) 324. { 325. if (!st || (i < 0) || (i >= st->num)) ^ 326. return NULL; 327. return st->data[i]; crypto/stack/stack.c:326:9: 324. { 325. if (!st || (i < 0) || (i >= st->num)) 326. > return NULL; 327. return st->data[i]; 328. } crypto/stack/stack.c:328:1: return from a call to sk_value 326. return NULL; 327. return st->data[i]; 328. > } 329. 330. void *sk_set(_STACK *st, int i, void *value) include/openssl/x509.h:169:1: return from a call to sk_X509_value 167. typedef struct x509_cinf_st X509_CINF; 168. 169. > DEFINE_STACK_OF(X509) 170. 171. /* This is used for a table of trust checking functions */ crypto/x509/x509_vfy.c:2695:5: 2693. int num = sk_X509_num(ctx->chain); 2694. X509 *cert = sk_X509_value(ctx->chain, num - 1); 2695. > int ss = cert_self_signed(cert); 2696. STACK_OF(X509) *sktmp = NULL; 2697. unsigned int search; crypto/x509/x509_vfy.c:154:1: start of procedure cert_self_signed() 152. 153. /* Return 1 is a certificate is self signed */ 154. > static int cert_self_signed(X509 *x) 155. { 156. /* crypto/x509/x509_vfy.c:161:5: Skipping X509_check_purpose(): empty list of specs 159. * parse errors, rather than memory pressure! 160. */ 161. X509_check_purpose(x, -1, 0); ^ 162. if (x->ex_flags & EXFLAG_SS) 163. return 1; crypto/x509/x509_vfy.c:162:9: 160. */ 161. X509_check_purpose(x, -1, 0); 162. > if (x->ex_flags & EXFLAG_SS) 163. return 1; 164. else
https://github.com/openssl/openssl/blob/0daccd4dc1f1ac62181738a91714f35472e50f3c/crypto/x509/x509_vfy.c/#L2695
d2a_code_trace_data_43198
static int epzs_motion_search4(MpegEncContext * s, int *mx_ptr, int *my_ptr, int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], int ref_mv_scale) { MotionEstContext * const c= &s->me; int best[2]={0, 0}; int d, dmin; int map_generation; const int penalty_factor= c->penalty_factor; const int size=1; const int h=8; const int ref_mv_stride= s->mb_stride; const int ref_mv_xy= s->mb_x + s->mb_y *ref_mv_stride; me_cmp_func cmpf, chroma_cmpf; LOAD_COMMON int flags= c->flags; LOAD_COMMON2 cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; map_generation= update_map_generation(c); dmin = 1000000; if (s->first_slice_line) { CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift) }else{ CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift) CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift) CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift) CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) } if(dmin>64*4){ CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) if(s->mb_y+1<s->end_mb_y) CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) } dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); *mx_ptr= best[0]; *my_ptr= best[1]; return dmin; } libavcodec/motion_est_template.c:1174: error: Uninitialized Value The value read from xmin was never initialized. libavcodec/motion_est_template.c:1174:9: 1172. } 1173. if(dmin>64*4){ 1174. CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, ^ 1175. (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) 1176. if(s->mb_y+1<s->end_mb_y) //FIXME replace at least with last_slice_line
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1174
d2a_code_trace_data_43199
static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, OPENSSL_LH_DOALL_FUNC func, OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) { int i; OPENSSL_LH_NODE *a, *n; if (lh == NULL) return; for (i = lh->num_nodes - 1; i >= 0; i--) { a = lh->b[i]; while (a != NULL) { n = a->next; if (use_arg) func_arg(a->data, arg); else func(a->data); a = n; } } } ssl/ssl_lib.c:998: error: INTEGER_OVERFLOW_L2 ([0, max(0, `s->initial_ctx->sessions->num_nodes`)] - 1):unsigned32 by call to `SSL_CTX_free`. Showing all 13 steps of the trace ssl/ssl_lib.c:958:1: Parameter `s->initial_ctx->sessions->num_nodes` 956. } 957. 958. > void SSL_free(SSL *s) 959. { 960. int i; ssl/ssl_lib.c:998:5: Call 996. 997. OPENSSL_free(s->ext.hostname); 998. SSL_CTX_free(s->initial_ctx); ^ 999. #ifndef OPENSSL_NO_EC 1000. OPENSSL_free(s->ext.ecpointformats); ssl/ssl_lib.c:2568:1: Parameter `a->sessions->num_nodes` 2566. } 2567. 2568. > void SSL_CTX_free(SSL_CTX *a) 2569. { 2570. int i; ssl/ssl_lib.c:2594:9: Call 2592. */ 2593. if (a->sessions != NULL) 2594. SSL_CTX_flush_sessions(a, 0); ^ 2595. 2596. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:1003:1: Parameter `s->sessions->num_nodes` 1001. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1002. 1003. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 1004. { 1005. unsigned long i; ssl/ssl_sess.c:1016:5: Call 1014. i = lh_SSL_SESSION_get_down_load(s->sessions); 1015. lh_SSL_SESSION_set_down_load(s->sessions, 0); 1016. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp); ^ 1017. lh_SSL_SESSION_set_down_load(s->sessions, i); 1018. CRYPTO_THREAD_unlock(s->lock); ssl/ssl_sess.c:1001:1: Parameter `lh->num_nodes` 999. } 1000. 1001. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1002. 1003. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) ssl/ssl_sess.c:1001:1: Call 999. } 1000. 1001. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1002. 1003. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) crypto/lhash/lhash.c:182:1: Parameter `lh->num_nodes` 180. } 181. 182. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); crypto/lhash/lhash.c:184:5: Call 182. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); ^ 185. } 186. crypto/lhash/lhash.c:150:1: <LHS trace> 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:150:1: Parameter `lh->num_nodes` 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:164:10: Binary operation: ([0, max(0, s->initial_ctx->sessions->num_nodes)] - 1):unsigned32 by call to `SSL_CTX_free` 162. * memory leaks otherwise 163. */ 164. for (i = lh->num_nodes - 1; i >= 0; i--) { ^ 165. a = lh->b[i]; 166. while (a != NULL) {
https://github.com/openssl/openssl/blob/f61c5ca6ca183bf0a51651857e3efb02a98889ad/crypto/lhash/lhash.c/#L164
d2a_code_trace_data_43200
static int check_cert(X509_STORE_CTX *ctx) { X509_CRL *crl = NULL, *dcrl = NULL; X509 *x; int ok, cnum; cnum = ctx->error_depth; x = sk_X509_value(ctx->chain, cnum); ctx->current_cert = x; ctx->current_issuer = NULL; ctx->current_crl_score = 0; ctx->current_reasons = 0; while (ctx->current_reasons != CRLDP_ALL_REASONS) { if (ctx->get_crl) ok = ctx->get_crl(ctx, &crl, x); else ok = get_crl_delta(ctx, &crl, &dcrl, x); if(!ok) { ctx->error = X509_V_ERR_UNABLE_TO_GET_CRL; ok = ctx->verify_cb(0, ctx); goto err; } ctx->current_crl = crl; ok = ctx->check_crl(ctx, crl); if (!ok) goto err; if (dcrl) { ok = ctx->check_crl(ctx, dcrl); if (!ok) goto err; ok = ctx->cert_crl(ctx, dcrl, x); if (!ok) goto err; } else ok = 1; if (ok != 2) { ok = ctx->cert_crl(ctx, crl, x); if (!ok) goto err; } X509_CRL_free(crl); X509_CRL_free(dcrl); crl = NULL; dcrl = NULL; } err: X509_CRL_free(crl); X509_CRL_free(dcrl); ctx->current_crl = NULL; return ok; } crypto/x509/x509_vfy.c:756: error: NULL_DEREFERENCE pointer `x` last assigned on line 745 could be null and is dereferenced by call to `get_crl_delta()` at line 756, column 9. Showing all 25 steps of the trace crypto/x509/x509_vfy.c:739:1: start of procedure check_cert() 737. } 738. 739. > static int check_cert(X509_STORE_CTX *ctx) 740. { 741. X509_CRL *crl = NULL, *dcrl = NULL; crypto/x509/x509_vfy.c:741:2: 739. static int check_cert(X509_STORE_CTX *ctx) 740. { 741. > X509_CRL *crl = NULL, *dcrl = NULL; 742. X509 *x; 743. int ok, cnum; crypto/x509/x509_vfy.c:744:2: 742. X509 *x; 743. int ok, cnum; 744. > cnum = ctx->error_depth; 745. x = sk_X509_value(ctx->chain, cnum); 746. ctx->current_cert = x; crypto/x509/x509_vfy.c:745:6: Condition is true 743. int ok, cnum; 744. cnum = ctx->error_depth; 745. x = sk_X509_value(ctx->chain, cnum); ^ 746. ctx->current_cert = x; 747. ctx->current_issuer = NULL; crypto/x509/x509_vfy.c:745:2: 743. int ok, cnum; 744. cnum = ctx->error_depth; 745. > x = sk_X509_value(ctx->chain, cnum); 746. ctx->current_cert = x; 747. ctx->current_issuer = NULL; crypto/stack/stack.c:300:1: start of procedure sk_value() 298. } 299. 300. > void *sk_value(const _STACK *st, int i) 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; crypto/stack/stack.c:302:6: Taking false branch 300. void *sk_value(const _STACK *st, int i) 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 303. return st->data[i]; 304. } crypto/stack/stack.c:302:13: Taking false branch 300. void *sk_value(const _STACK *st, int i) 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 303. return st->data[i]; 304. } crypto/stack/stack.c:302:24: Taking true branch 300. void *sk_value(const _STACK *st, int i) 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 303. return st->data[i]; 304. } crypto/stack/stack.c:302:39: 300. void *sk_value(const _STACK *st, int i) 301. { 302. > if(!st || (i < 0) || (i >= st->num)) return NULL; 303. return st->data[i]; 304. } crypto/stack/stack.c:304:1: return from a call to sk_value 302. if(!st || (i < 0) || (i >= st->num)) return NULL; 303. return st->data[i]; 304. > } 305. 306. void *sk_set(_STACK *st, int i, void *value) crypto/x509/x509_vfy.c:746:2: 744. cnum = ctx->error_depth; 745. x = sk_X509_value(ctx->chain, cnum); 746. > ctx->current_cert = x; 747. ctx->current_issuer = NULL; 748. ctx->current_crl_score = 0; crypto/x509/x509_vfy.c:747:2: 745. x = sk_X509_value(ctx->chain, cnum); 746. ctx->current_cert = x; 747. > ctx->current_issuer = NULL; 748. ctx->current_crl_score = 0; 749. ctx->current_reasons = 0; crypto/x509/x509_vfy.c:748:2: 746. ctx->current_cert = x; 747. ctx->current_issuer = NULL; 748. > ctx->current_crl_score = 0; 749. ctx->current_reasons = 0; 750. while (ctx->current_reasons != CRLDP_ALL_REASONS) crypto/x509/x509_vfy.c:749:2: 747. ctx->current_issuer = NULL; 748. ctx->current_crl_score = 0; 749. > ctx->current_reasons = 0; 750. while (ctx->current_reasons != CRLDP_ALL_REASONS) 751. { crypto/x509/x509_vfy.c:750:9: Loop condition is true. Entering loop body 748. ctx->current_crl_score = 0; 749. ctx->current_reasons = 0; 750. while (ctx->current_reasons != CRLDP_ALL_REASONS) ^ 751. { 752. /* Try to retrieve relevant CRL */ crypto/x509/x509_vfy.c:753:7: Taking false branch 751. { 752. /* Try to retrieve relevant CRL */ 753. if (ctx->get_crl) ^ 754. ok = ctx->get_crl(ctx, &crl, x); 755. else crypto/x509/x509_vfy.c:756:4: 754. ok = ctx->get_crl(ctx, &crl, x); 755. else 756. > ok = get_crl_delta(ctx, &crl, &dcrl, x); 757. /* If error looking up CRL, nothing we can do except 758. * notify callback crypto/x509/x509_vfy.c:1339:1: start of procedure get_crl_delta() 1337. */ 1338. 1339. > static int get_crl_delta(X509_STORE_CTX *ctx, 1340. X509_CRL **pcrl, X509_CRL **pdcrl, X509 *x) 1341. { crypto/x509/x509_vfy.c:1343:2: 1341. { 1342. int ok; 1343. > X509 *issuer = NULL; 1344. int crl_score = 0; 1345. unsigned int reasons; crypto/x509/x509_vfy.c:1344:2: 1342. int ok; 1343. X509 *issuer = NULL; 1344. > int crl_score = 0; 1345. unsigned int reasons; 1346. X509_CRL *crl = NULL, *dcrl = NULL; crypto/x509/x509_vfy.c:1346:2: 1344. int crl_score = 0; 1345. unsigned int reasons; 1346. > X509_CRL *crl = NULL, *dcrl = NULL; 1347. STACK_OF(X509_CRL) *skcrl; 1348. X509_NAME *nm = X509_get_issuer_name(x); crypto/x509/x509_vfy.c:1348:2: 1346. X509_CRL *crl = NULL, *dcrl = NULL; 1347. STACK_OF(X509_CRL) *skcrl; 1348. > X509_NAME *nm = X509_get_issuer_name(x); 1349. reasons = ctx->current_reasons; 1350. ok = get_crl_sk(ctx, &crl, &dcrl, crypto/x509/x509_cmp.c:130:1: start of procedure X509_get_issuer_name() 128. #endif 129. 130. > X509_NAME *X509_get_issuer_name(X509 *a) 131. { 132. return(a->cert_info->issuer); crypto/x509/x509_cmp.c:132:2: 130. X509_NAME *X509_get_issuer_name(X509 *a) 131. { 132. > return(a->cert_info->issuer); 133. } 134.
https://github.com/openssl/openssl/blob/bbb19418e672007590c65a12aa24e1b59927b2cc/crypto/x509/x509_vfy.c/#L756
d2a_code_trace_data_43201
static int ogg_new_buf(struct ogg *ogg, int idx) { struct ogg_stream *os = ogg->streams + idx; uint8_t *nb = av_malloc(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE); int size = os->bufpos - os->pstart; if(os->buf){ memcpy(nb, os->buf + os->pstart, size); av_free(os->buf); } os->buf = nb; os->bufpos = size; os->pstart = 0; return 0; } libavformat/oggdec.c:191: error: Null Dereference pointer `nb` last assigned on line 188 could be null and is dereferenced by call to `memcpy()` at line 191, column 9. libavformat/oggdec.c:185:1: start of procedure ogg_new_buf() 183. } 184. 185. static int ogg_new_buf(struct ogg *ogg, int idx) ^ 186. { 187. struct ogg_stream *os = ogg->streams + idx; libavformat/oggdec.c:187:5: 185. static int ogg_new_buf(struct ogg *ogg, int idx) 186. { 187. struct ogg_stream *os = ogg->streams + idx; ^ 188. uint8_t *nb = av_malloc(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE); 189. int size = os->bufpos - os->pstart; libavformat/oggdec.c:188:5: 186. { 187. struct ogg_stream *os = ogg->streams + idx; 188. uint8_t *nb = av_malloc(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE); ^ 189. int size = os->bufpos - os->pstart; 190. if(os->buf){ libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking true branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) ^ 73. return NULL; 74. libavutil/mem.c:73:9: 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) 73. return NULL; ^ 74. 75. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavformat/oggdec.c:189:5: 187. struct ogg_stream *os = ogg->streams + idx; 188. uint8_t *nb = av_malloc(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE); 189. int size = os->bufpos - os->pstart; ^ 190. if(os->buf){ 191. memcpy(nb, os->buf + os->pstart, size); libavformat/oggdec.c:190:8: Taking true branch 188. uint8_t *nb = av_malloc(os->bufsize + FF_INPUT_BUFFER_PADDING_SIZE); 189. int size = os->bufpos - os->pstart; 190. if(os->buf){ ^ 191. memcpy(nb, os->buf + os->pstart, size); 192. av_free(os->buf); libavformat/oggdec.c:191:9: 189. int size = os->bufpos - os->pstart; 190. if(os->buf){ 191. memcpy(nb, os->buf + os->pstart, size); ^ 192. av_free(os->buf); 193. }
https://github.com/libav/libav/blob/ef0d779706c77ca9007527bd8d41e9400682f4e4/libavformat/oggdec.c/#L191
d2a_code_trace_data_43202
static void ngx_http_set_keepalive(ngx_http_request_t *r) { int tcp_nodelay; ngx_int_t i; ngx_buf_t *b, *f; ngx_event_t *rev, *wev; ngx_connection_t *c; ngx_http_connection_t *hc; ngx_http_core_srv_conf_t *cscf; ngx_http_core_loc_conf_t *clcf; c = r->connection; rev = c->read; clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "set http keepalive handler"); if (r->discard_body) { r->write_event_handler = ngx_http_request_empty_handler; r->lingering_time = ngx_time() + (time_t) (clcf->lingering_time / 1000); ngx_add_timer(rev, clcf->lingering_timeout); return; } c->log->action = "closing request"; hc = r->http_connection; b = r->header_in; if (b->pos < b->last) { if (b != c->buffer) { cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); if (hc->free == NULL) { hc->free = ngx_palloc(c->pool, cscf->large_client_header_buffers.num * sizeof(ngx_buf_t *)); if (hc->free == NULL) { ngx_http_close_request(r, 0); return; } } for (i = 0; i < hc->nbusy - 1; i++) { f = hc->busy[i]; hc->free[hc->nfree++] = f; f->pos = f->start; f->last = f->start; } hc->busy[0] = b; hc->nbusy = 1; } } r->keepalive = 0; ngx_http_free_request(r, 0); c->data = hc; ngx_add_timer(rev, clcf->keepalive_timeout); if (ngx_handle_read_event(rev, 0) != NGX_OK) { ngx_http_close_connection(c); return; } wev = c->write; wev->handler = ngx_http_empty_handler; if (b->pos < b->last) { ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "pipelined request"); hc->pipeline = 1; c->log->action = "reading client pipelined request line"; rev->handler = ngx_http_init_request; ngx_post_event(rev, &ngx_posted_events); return; } hc->pipeline = 0; if (ngx_pfree(c->pool, r) == NGX_OK) { hc->request = NULL; } b = c->buffer; if (ngx_pfree(c->pool, b->start) == NGX_OK) { b->pos = NULL; } else { b->pos = b->start; b->last = b->start; } ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, "hc free: %p %d", hc->free, hc->nfree); if (hc->free) { for (i = 0; i < hc->nfree; i++) { ngx_pfree(c->pool, hc->free[i]->start); hc->free[i] = NULL; } hc->nfree = 0; } ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, "hc busy: %p %d", hc->busy, hc->nbusy); if (hc->busy) { for (i = 0; i < hc->nbusy; i++) { ngx_pfree(c->pool, hc->busy[i]->start); hc->busy[i] = NULL; } hc->nbusy = 0; } #if (NGX_HTTP_SSL) if (c->ssl) { ngx_ssl_free_buffer(c); } #endif rev->handler = ngx_http_keepalive_handler; if (wev->active && (ngx_event_flags & NGX_USE_LEVEL_EVENT)) { if (ngx_del_event(wev, NGX_WRITE_EVENT, 0) != NGX_OK) { ngx_http_close_connection(c); return; } } c->log->action = "keepalive"; if (c->tcp_nopush == NGX_TCP_NOPUSH_SET) { if (ngx_tcp_push(c->fd) == -1) { ngx_connection_error(c, ngx_socket_errno, ngx_tcp_push_n " failed"); ngx_http_close_connection(c); return; } c->tcp_nopush = NGX_TCP_NOPUSH_UNSET; tcp_nodelay = ngx_tcp_nodelay_and_tcp_nopush ? 1 : 0; } else { tcp_nodelay = 1; } if (tcp_nodelay && clcf->tcp_nodelay && c->tcp_nodelay == NGX_TCP_NODELAY_UNSET) { ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "tcp_nodelay"); if (setsockopt(c->fd, IPPROTO_TCP, TCP_NODELAY, (const void *) &tcp_nodelay, sizeof(int)) == -1) { #if (NGX_SOLARIS) c->log_error = NGX_ERROR_IGNORE_EINVAL; #endif ngx_connection_error(c, ngx_socket_errno, "setsockopt(TCP_NODELAY) failed"); c->log_error = NGX_ERROR_INFO; ngx_http_close_connection(c); return; } c->tcp_nodelay = NGX_TCP_NODELAY_SET; } #if 0 r->http_state = NGX_HTTP_KEEPALIVE_STATE; #endif c->idle = 1; ngx_reusable_connection(c, 1); if (rev->ready) { ngx_post_event(rev, &ngx_posted_events); } } src/http/ngx_http_request.c:1145: error: Buffer Overrun L3 Offset: [2, +oo] Size: [0, +oo] by call to `ngx_http_process_request_header`. src/http/ngx_http_request.c:1143:13: Assignment 1141. r->request_length += r->header_in->pos - r->header_name_start; 1142. 1143. r->http_state = NGX_HTTP_PROCESS_REQUEST_STATE; ^ 1144. 1145. rc = ngx_http_process_request_header(r); src/http/ngx_http_request.c:1145:18: Call 1143. r->http_state = NGX_HTTP_PROCESS_REQUEST_STATE; 1144. 1145. rc = ngx_http_process_request_header(r); ^ 1146. 1147. if (rc != NGX_OK) { src/http/ngx_http_request.c:1570:1: Parameter `r->http_connection->nfree` 1568. 1569. 1570. static ngx_int_t ^ 1571. ngx_http_process_request_header(ngx_http_request_t *r) 1572. { src/http/ngx_http_request.c:1580:9: Call 1578. ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, 1579. "client sent HTTP/1.1 request without \"Host\" header"); 1580. ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); ^ 1581. return NGX_ERROR; 1582. } src/http/ngx_http_request.c:2010:1: Parameter `r->http_connection->nfree` 2008. 2009. 2010. void ^ 2011. ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc) 2012. { src/http/ngx_http_request.c:2195:5: Call 2193. } 2194. 2195. ngx_http_finalize_connection(r); ^ 2196. } 2197. src/http/ngx_http_request.c:2259:1: Parameter `r->http_connection->nfree` 2257. 2258. 2259. static void ^ 2260. ngx_http_finalize_connection(ngx_http_request_t *r) 2261. { src/http/ngx_http_request.c:2287:9: Call 2285. && clcf->keepalive_timeout > 0) 2286. { 2287. ngx_http_set_keepalive(r); ^ 2288. return; 2289. } src/http/ngx_http_request.c:2526:1: <Offset trace> 2524. 2525. 2526. static void ^ 2527. ngx_http_set_keepalive(ngx_http_request_t *r) 2528. { src/http/ngx_http_request.c:2526:1: Parameter `r->http_connection->nfree` 2524. 2525. 2526. static void ^ 2527. ngx_http_set_keepalive(ngx_http_request_t *r) 2528. { src/http/ngx_http_request.c:2526:1: <Length trace> 2524. 2525. 2526. static void ^ 2527. ngx_http_set_keepalive(ngx_http_request_t *r) 2528. { src/http/ngx_http_request.c:2526:1: Parameter `*r->http_connection->free` 2524. 2525. 2526. static void ^ 2527. ngx_http_set_keepalive(ngx_http_request_t *r) 2528. { src/http/ngx_http_request.c:2585:17: Array access: Offset: [2, +oo] Size: [0, +oo] by call to `ngx_http_process_request_header` 2583. for (i = 0; i < hc->nbusy - 1; i++) { 2584. f = hc->busy[i]; 2585. hc->free[hc->nfree++] = f; ^ 2586. f->pos = f->start; 2587. f->last = f->start;
https://github.com/nginx/nginx/blob/d281d0ba8b779b591e96ef237ff149e3d521264f/src/http/ngx_http_request.c/#L2585
d2a_code_trace_data_43203
static int encode_thread(AVCodecContext *c, void *arg){ MpegEncContext *s= arg; int mb_x, mb_y, pdif = 0; int i, j; MpegEncContext best_s, backup_s; uint8_t bit_buf[2][MAX_MB_BYTES]; uint8_t bit_buf2[2][MAX_MB_BYTES]; uint8_t bit_buf_tex[2][MAX_MB_BYTES]; PutBitContext pb[2], pb2[2], tex_pb[2]; ff_check_alignment(); for(i=0; i<2; i++){ init_put_bits(&pb [i], bit_buf [i], MAX_MB_BYTES); init_put_bits(&pb2 [i], bit_buf2 [i], MAX_MB_BYTES); init_put_bits(&tex_pb[i], bit_buf_tex[i], MAX_MB_BYTES); } s->last_bits= put_bits_count(&s->pb); s->mv_bits=0; s->misc_bits=0; s->i_tex_bits=0; s->p_tex_bits=0; s->i_count=0; s->f_count=0; s->b_count=0; s->skip_count=0; for(i=0; i<3; i++){ s->last_dc[i] = 128 << s->intra_dc_precision; s->current_picture.error[i] = 0; } s->mb_skip_run = 0; memset(s->last_mv, 0, sizeof(s->last_mv)); s->last_mv_dir = 0; switch(s->codec_id){ case CODEC_ID_H263: case CODEC_ID_H263P: case CODEC_ID_FLV1: if (ENABLE_H263_ENCODER || ENABLE_H263P_ENCODER || ENABLE_FLV_ENCODER) s->gob_index = ff_h263_get_gob_height(s); break; case CODEC_ID_MPEG4: if(ENABLE_MPEG4_ENCODER && s->partitioned_frame) ff_mpeg4_init_partitions(s); break; } s->resync_mb_x=0; s->resync_mb_y=0; s->first_slice_line = 1; s->ptr_lastgob = s->pb.buf; for(mb_y= s->start_mb_y; mb_y < s->end_mb_y; mb_y++) { s->mb_x=0; s->mb_y= mb_y; ff_set_qscale(s, s->qscale); ff_init_block_index(s); for(mb_x=0; mb_x < s->mb_width; mb_x++) { int xy= mb_y*s->mb_stride + mb_x; int mb_type= s->mb_type[xy]; int dmin= INT_MAX; int dir; if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < MAX_MB_BYTES){ av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); return -1; } if(s->data_partitioning){ if( s->pb2 .buf_end - s->pb2 .buf - (put_bits_count(&s-> pb2)>>3) < MAX_MB_BYTES || s->tex_pb.buf_end - s->tex_pb.buf - (put_bits_count(&s->tex_pb )>>3) < MAX_MB_BYTES){ av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); return -1; } } s->mb_x = mb_x; s->mb_y = mb_y; ff_update_block_index(s); if(ENABLE_H261_ENCODER && s->codec_id == CODEC_ID_H261){ ff_h261_reorder_mb_index(s); xy= s->mb_y*s->mb_stride + s->mb_x; mb_type= s->mb_type[xy]; } if(s->rtp_mode){ int current_packet_size, is_gob_start; current_packet_size= ((put_bits_count(&s->pb)+7)>>3) - (s->ptr_lastgob - s->pb.buf); is_gob_start= s->avctx->rtp_payload_size && current_packet_size >= s->avctx->rtp_payload_size && mb_y + mb_x>0; if(s->start_mb_y == mb_y && mb_y > 0 && mb_x==0) is_gob_start=1; switch(s->codec_id){ case CODEC_ID_H263: case CODEC_ID_H263P: if(!s->h263_slice_structured) if(s->mb_x || s->mb_y%s->gob_index) is_gob_start=0; break; case CODEC_ID_MPEG2VIDEO: if(s->mb_x==0 && s->mb_y!=0) is_gob_start=1; case CODEC_ID_MPEG1VIDEO: if(s->mb_skip_run) is_gob_start=0; break; } if(is_gob_start){ if(s->start_mb_y != mb_y || mb_x!=0){ write_slice_end(s); if(ENABLE_MPEG4_ENCODER && s->codec_id==CODEC_ID_MPEG4 && s->partitioned_frame){ ff_mpeg4_init_partitions(s); } } assert((put_bits_count(&s->pb)&7) == 0); current_packet_size= pbBufPtr(&s->pb) - s->ptr_lastgob; if(s->avctx->error_rate && s->resync_mb_x + s->resync_mb_y > 0){ int r= put_bits_count(&s->pb)/8 + s->picture_number + 16 + s->mb_x + s->mb_y; int d= 100 / s->avctx->error_rate; if(r % d == 0){ current_packet_size=0; #ifndef ALT_BITSTREAM_WRITER s->pb.buf_ptr= s->ptr_lastgob; #endif assert(pbBufPtr(&s->pb) == s->ptr_lastgob); } } if (s->avctx->rtp_callback){ int number_mb = (mb_y - s->resync_mb_y)*s->mb_width + mb_x - s->resync_mb_x; s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, current_packet_size, number_mb); } switch(s->codec_id){ case CODEC_ID_MPEG4: if (ENABLE_MPEG4_ENCODER) { ff_mpeg4_encode_video_packet_header(s); ff_mpeg4_clean_buffers(s); } break; case CODEC_ID_MPEG1VIDEO: case CODEC_ID_MPEG2VIDEO: if (ENABLE_MPEG1VIDEO_ENCODER || ENABLE_MPEG2VIDEO_ENCODER) { ff_mpeg1_encode_slice_header(s); ff_mpeg1_clean_buffers(s); } break; case CODEC_ID_H263: case CODEC_ID_H263P: if (ENABLE_H263_ENCODER || ENABLE_H263P_ENCODER) h263_encode_gob_header(s, mb_y); break; } if(s->flags&CODEC_FLAG_PASS1){ int bits= put_bits_count(&s->pb); s->misc_bits+= bits - s->last_bits; s->last_bits= bits; } s->ptr_lastgob += current_packet_size; s->first_slice_line=1; s->resync_mb_x=mb_x; s->resync_mb_y=mb_y; } } if( (s->resync_mb_x == s->mb_x) && s->resync_mb_y+1 == s->mb_y){ s->first_slice_line=0; } s->mb_skipped=0; s->dquant=0; if(mb_type & (mb_type-1) || (s->flags & CODEC_FLAG_QP_RD)){ int next_block=0; int pb_bits_count, pb2_bits_count, tex_pb_bits_count; copy_context_before_encode(&backup_s, s, -1); backup_s.pb= s->pb; best_s.data_partitioning= s->data_partitioning; best_s.partitioned_frame= s->partitioned_frame; if(s->data_partitioning){ backup_s.pb2= s->pb2; backup_s.tex_pb= s->tex_pb; } if(mb_type&CANDIDATE_MB_TYPE_INTER){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = s->p_mv_table[xy][0]; s->mv[0][0][1] = s->p_mv_table[xy][1]; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER, pb, pb2, tex_pb, &dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]); } if(mb_type&CANDIDATE_MB_TYPE_INTER_I){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(i=0; i<2; i++){ j= s->field_select[0][i] = s->p_field_select_table[i][xy]; s->mv[0][i][0] = s->p_field_mv_table[i][j][xy][0]; s->mv[0][i][1] = s->p_field_mv_table[i][j][xy][1]; } encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER_I, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(mb_type&CANDIDATE_MB_TYPE_SKIPPED){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = 0; s->mv[0][0][1] = 0; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_SKIPPED, pb, pb2, tex_pb, &dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]); } if(mb_type&CANDIDATE_MB_TYPE_INTER4V){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_8X8; s->mb_intra= 0; for(i=0; i<4; i++){ s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0]; s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1]; } encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER4V, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(mb_type&CANDIDATE_MB_TYPE_FORWARD){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = s->b_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_forw_mv_table[xy][1]; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_FORWARD, pb, pb2, tex_pb, &dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]); } if(mb_type&CANDIDATE_MB_TYPE_BACKWARD){ s->mv_dir = MV_DIR_BACKWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[1][0][0] = s->b_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_back_mv_table[xy][1]; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BACKWARD, pb, pb2, tex_pb, &dmin, &next_block, s->mv[1][0][0], s->mv[1][0][1]); } if(mb_type&CANDIDATE_MB_TYPE_BIDIR){ s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = s->b_bidir_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_bidir_forw_mv_table[xy][1]; s->mv[1][0][0] = s->b_bidir_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_bidir_back_mv_table[xy][1]; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BIDIR, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(mb_type&CANDIDATE_MB_TYPE_FORWARD_I){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(i=0; i<2; i++){ j= s->field_select[0][i] = s->b_field_select_table[0][i][xy]; s->mv[0][i][0] = s->b_field_mv_table[0][i][j][xy][0]; s->mv[0][i][1] = s->b_field_mv_table[0][i][j][xy][1]; } encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_FORWARD_I, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(mb_type&CANDIDATE_MB_TYPE_BACKWARD_I){ s->mv_dir = MV_DIR_BACKWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(i=0; i<2; i++){ j= s->field_select[1][i] = s->b_field_select_table[1][i][xy]; s->mv[1][i][0] = s->b_field_mv_table[1][i][j][xy][0]; s->mv[1][i][1] = s->b_field_mv_table[1][i][j][xy][1]; } encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BACKWARD_I, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(mb_type&CANDIDATE_MB_TYPE_BIDIR_I){ s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(dir=0; dir<2; dir++){ for(i=0; i<2; i++){ j= s->field_select[dir][i] = s->b_field_select_table[dir][i][xy]; s->mv[dir][i][0] = s->b_field_mv_table[dir][i][j][xy][0]; s->mv[dir][i][1] = s->b_field_mv_table[dir][i][j][xy][1]; } } encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BIDIR_I, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(mb_type&CANDIDATE_MB_TYPE_INTRA){ s->mv_dir = 0; s->mv_type = MV_TYPE_16X16; s->mb_intra= 1; s->mv[0][0][0] = 0; s->mv[0][0][1] = 0; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTRA, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); if(s->h263_pred || s->h263_aic){ if(best_s.mb_intra) s->mbintra_table[mb_x + mb_y*s->mb_stride]=1; else ff_clean_intra_table_entries(s); } } if((s->flags & CODEC_FLAG_QP_RD) && dmin < INT_MAX){ if(best_s.mv_type==MV_TYPE_16X16){ const int last_qp= backup_s.qscale; int qpi, qp, dc[6]; DCTELEM ac[6][16]; const int mvdir= (best_s.mv_dir&MV_DIR_BACKWARD) ? 1 : 0; static const int dquant_tab[4]={-1,1,-2,2}; assert(backup_s.dquant == 0); s->mv_dir= best_s.mv_dir; s->mv_type = MV_TYPE_16X16; s->mb_intra= best_s.mb_intra; s->mv[0][0][0] = best_s.mv[0][0][0]; s->mv[0][0][1] = best_s.mv[0][0][1]; s->mv[1][0][0] = best_s.mv[1][0][0]; s->mv[1][0][1] = best_s.mv[1][0][1]; qpi = s->pict_type == FF_B_TYPE ? 2 : 0; for(; qpi<4; qpi++){ int dquant= dquant_tab[qpi]; qp= last_qp + dquant; if(qp < s->avctx->qmin || qp > s->avctx->qmax) continue; backup_s.dquant= dquant; if(s->mb_intra && s->dc_val[0]){ for(i=0; i<6; i++){ dc[i]= s->dc_val[0][ s->block_index[i] ]; memcpy(ac[i], s->ac_val[0][s->block_index[i]], sizeof(DCTELEM)*16); } } encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER , pb, pb2, tex_pb, &dmin, &next_block, s->mv[mvdir][0][0], s->mv[mvdir][0][1]); if(best_s.qscale != qp){ if(s->mb_intra && s->dc_val[0]){ for(i=0; i<6; i++){ s->dc_val[0][ s->block_index[i] ]= dc[i]; memcpy(s->ac_val[0][s->block_index[i]], ac[i], sizeof(DCTELEM)*16); } } } } } } if(ENABLE_MPEG4_ENCODER && mb_type&CANDIDATE_MB_TYPE_DIRECT){ int mx= s->b_direct_mv_table[xy][0]; int my= s->b_direct_mv_table[xy][1]; backup_s.dquant = 0; s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; s->mb_intra= 0; ff_mpeg4_set_direct_mv(s, mx, my); encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_DIRECT, pb, pb2, tex_pb, &dmin, &next_block, mx, my); } if(ENABLE_MPEG4_ENCODER && mb_type&CANDIDATE_MB_TYPE_DIRECT0){ backup_s.dquant = 0; s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; s->mb_intra= 0; ff_mpeg4_set_direct_mv(s, 0, 0); encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_DIRECT, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(!best_s.mb_intra && s->flags2&CODEC_FLAG2_SKIP_RD){ int coded=0; for(i=0; i<6; i++) coded |= s->block_last_index[i]; if(coded){ int mx,my; memcpy(s->mv, best_s.mv, sizeof(s->mv)); if(ENABLE_MPEG4_ENCODER && best_s.mv_dir & MV_DIRECT){ mx=my=0; ff_mpeg4_set_direct_mv(s, mx, my); }else if(best_s.mv_dir&MV_DIR_BACKWARD){ mx= s->mv[1][0][0]; my= s->mv[1][0][1]; }else{ mx= s->mv[0][0][0]; my= s->mv[0][0][1]; } s->mv_dir= best_s.mv_dir; s->mv_type = best_s.mv_type; s->mb_intra= 0; backup_s.dquant= 0; s->skipdct=1; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER , pb, pb2, tex_pb, &dmin, &next_block, mx, my); s->skipdct=0; } } s->current_picture.qscale_table[xy]= best_s.qscale; copy_context_after_encode(s, &best_s, -1); pb_bits_count= put_bits_count(&s->pb); flush_put_bits(&s->pb); ff_copy_bits(&backup_s.pb, bit_buf[next_block^1], pb_bits_count); s->pb= backup_s.pb; if(s->data_partitioning){ pb2_bits_count= put_bits_count(&s->pb2); flush_put_bits(&s->pb2); ff_copy_bits(&backup_s.pb2, bit_buf2[next_block^1], pb2_bits_count); s->pb2= backup_s.pb2; tex_pb_bits_count= put_bits_count(&s->tex_pb); flush_put_bits(&s->tex_pb); ff_copy_bits(&backup_s.tex_pb, bit_buf_tex[next_block^1], tex_pb_bits_count); s->tex_pb= backup_s.tex_pb; } s->last_bits= put_bits_count(&s->pb); if (ENABLE_ANY_H263_ENCODER && s->out_format == FMT_H263 && s->pict_type!=FF_B_TYPE) ff_h263_update_motion_val(s); if(next_block==0){ s->dsp.put_pixels_tab[0][0](s->dest[0], s->rd_scratchpad , s->linesize ,16); s->dsp.put_pixels_tab[1][0](s->dest[1], s->rd_scratchpad + 16*s->linesize , s->uvlinesize, 8); s->dsp.put_pixels_tab[1][0](s->dest[2], s->rd_scratchpad + 16*s->linesize + 8, s->uvlinesize, 8); } if(s->avctx->mb_decision == FF_MB_DECISION_BITS) MPV_decode_mb(s, s->block); } else { int motion_x = 0, motion_y = 0; s->mv_type=MV_TYPE_16X16; switch(mb_type){ case CANDIDATE_MB_TYPE_INTRA: s->mv_dir = 0; s->mb_intra= 1; motion_x= s->mv[0][0][0] = 0; motion_y= s->mv[0][0][1] = 0; break; case CANDIDATE_MB_TYPE_INTER: s->mv_dir = MV_DIR_FORWARD; s->mb_intra= 0; motion_x= s->mv[0][0][0] = s->p_mv_table[xy][0]; motion_y= s->mv[0][0][1] = s->p_mv_table[xy][1]; break; case CANDIDATE_MB_TYPE_INTER_I: s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(i=0; i<2; i++){ j= s->field_select[0][i] = s->p_field_select_table[i][xy]; s->mv[0][i][0] = s->p_field_mv_table[i][j][xy][0]; s->mv[0][i][1] = s->p_field_mv_table[i][j][xy][1]; } break; case CANDIDATE_MB_TYPE_INTER4V: s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_8X8; s->mb_intra= 0; for(i=0; i<4; i++){ s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0]; s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1]; } break; case CANDIDATE_MB_TYPE_DIRECT: if (ENABLE_MPEG4_ENCODER) { s->mv_dir = MV_DIR_FORWARD|MV_DIR_BACKWARD|MV_DIRECT; s->mb_intra= 0; motion_x=s->b_direct_mv_table[xy][0]; motion_y=s->b_direct_mv_table[xy][1]; ff_mpeg4_set_direct_mv(s, motion_x, motion_y); } break; case CANDIDATE_MB_TYPE_DIRECT0: if (ENABLE_MPEG4_ENCODER) { s->mv_dir = MV_DIR_FORWARD|MV_DIR_BACKWARD|MV_DIRECT; s->mb_intra= 0; ff_mpeg4_set_direct_mv(s, 0, 0); } break; case CANDIDATE_MB_TYPE_BIDIR: s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mb_intra= 0; s->mv[0][0][0] = s->b_bidir_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_bidir_forw_mv_table[xy][1]; s->mv[1][0][0] = s->b_bidir_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_bidir_back_mv_table[xy][1]; break; case CANDIDATE_MB_TYPE_BACKWARD: s->mv_dir = MV_DIR_BACKWARD; s->mb_intra= 0; motion_x= s->mv[1][0][0] = s->b_back_mv_table[xy][0]; motion_y= s->mv[1][0][1] = s->b_back_mv_table[xy][1]; break; case CANDIDATE_MB_TYPE_FORWARD: s->mv_dir = MV_DIR_FORWARD; s->mb_intra= 0; motion_x= s->mv[0][0][0] = s->b_forw_mv_table[xy][0]; motion_y= s->mv[0][0][1] = s->b_forw_mv_table[xy][1]; break; case CANDIDATE_MB_TYPE_FORWARD_I: s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(i=0; i<2; i++){ j= s->field_select[0][i] = s->b_field_select_table[0][i][xy]; s->mv[0][i][0] = s->b_field_mv_table[0][i][j][xy][0]; s->mv[0][i][1] = s->b_field_mv_table[0][i][j][xy][1]; } break; case CANDIDATE_MB_TYPE_BACKWARD_I: s->mv_dir = MV_DIR_BACKWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(i=0; i<2; i++){ j= s->field_select[1][i] = s->b_field_select_table[1][i][xy]; s->mv[1][i][0] = s->b_field_mv_table[1][i][j][xy][0]; s->mv[1][i][1] = s->b_field_mv_table[1][i][j][xy][1]; } break; case CANDIDATE_MB_TYPE_BIDIR_I: s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(dir=0; dir<2; dir++){ for(i=0; i<2; i++){ j= s->field_select[dir][i] = s->b_field_select_table[dir][i][xy]; s->mv[dir][i][0] = s->b_field_mv_table[dir][i][j][xy][0]; s->mv[dir][i][1] = s->b_field_mv_table[dir][i][j][xy][1]; } } break; default: av_log(s->avctx, AV_LOG_ERROR, "illegal MB type\n"); } encode_mb(s, motion_x, motion_y); s->last_mv_dir = s->mv_dir; if (ENABLE_ANY_H263_ENCODER && s->out_format == FMT_H263 && s->pict_type!=FF_B_TYPE) ff_h263_update_motion_val(s); MPV_decode_mb(s, s->block); } if(s->mb_intra ){ s->p_mv_table[xy][0]=0; s->p_mv_table[xy][1]=0; } if(s->flags&CODEC_FLAG_PSNR){ int w= 16; int h= 16; if(s->mb_x*16 + 16 > s->width ) w= s->width - s->mb_x*16; if(s->mb_y*16 + 16 > s->height) h= s->height- s->mb_y*16; s->current_picture.error[0] += sse( s, s->new_picture.data[0] + s->mb_x*16 + s->mb_y*s->linesize*16, s->dest[0], w, h, s->linesize); s->current_picture.error[1] += sse( s, s->new_picture.data[1] + s->mb_x*8 + s->mb_y*s->uvlinesize*8, s->dest[1], w>>1, h>>1, s->uvlinesize); s->current_picture.error[2] += sse( s, s->new_picture .data[2] + s->mb_x*8 + s->mb_y*s->uvlinesize*8, s->dest[2], w>>1, h>>1, s->uvlinesize); } if(s->loop_filter){ if(ENABLE_ANY_H263_ENCODER && s->out_format == FMT_H263) ff_h263_loop_filter(s); } } } if (ENABLE_MSMPEG4_ENCODER && s->msmpeg4_version && s->msmpeg4_version<4 && s->pict_type == FF_I_TYPE) msmpeg4_encode_ext_header(s); write_slice_end(s); if (s->avctx->rtp_callback) { int number_mb = (mb_y - s->resync_mb_y)*s->mb_width - s->resync_mb_x; pdif = pbBufPtr(&s->pb) - s->ptr_lastgob; emms_c(); s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, pdif, number_mb); } return 0; } libavcodec/mpegvideo_enc.c:2405: error: Uninitialized Value The value read from best_s.mv_dir was never initialized. libavcodec/mpegvideo_enc.c:2405:52: 2403. int mx,my; 2404. memcpy(s->mv, best_s.mv, sizeof(s->mv)); 2405. if(ENABLE_MPEG4_ENCODER && best_s.mv_dir & MV_DIRECT){ ^ 2406. mx=my=0; //FIXME find the one we actually used 2407. ff_mpeg4_set_direct_mv(s, mx, my);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo_enc.c/#L2405
d2a_code_trace_data_43204
static inline void idct4row(int16_t *row) { int c0, c1, c2, c3, a0, a1, a2, a3; a0 = row[0]; a1 = row[1]; a2 = row[2]; a3 = row[3]; c0 = (a0 + a2)*R3 + (1 << (R_SHIFT - 1)); c2 = (a0 - a2)*R3 + (1 << (R_SHIFT - 1)); c1 = a1 * R1 + a3 * R2; c3 = a1 * R2 - a3 * R1; row[0]= (c0 + c1) >> R_SHIFT; row[1]= (c2 + c3) >> R_SHIFT; row[2]= (c2 - c3) >> R_SHIFT; row[3]= (c0 - c1) >> R_SHIFT; } libavcodec/wmv2.c:97: error: Buffer Overrun L1 Offset: [8, 64] (⇐ [5, 61] + 3) Size: 6 by call to `wmv2_add_block`. libavcodec/wmv2.c:97:5: Call 95. 96. wmv2_add_block(w, block1[4], dest_cb, s->uvlinesize, 4); 97. wmv2_add_block(w, block1[5], dest_cr, s->uvlinesize, 5); ^ 98. } 99. libavcodec/wmv2.c:57:1: Parameter `n` 55. } 56. 57. static void wmv2_add_block(Wmv2Context *w, int16_t *block1, ^ 58. uint8_t *dst, int stride, int n) 59. { libavcodec/wmv2.c:74:13: Call 72. case 2: 73. ff_simple_idct48_add(dst, stride, block1); 74. ff_simple_idct48_add(dst + 4, stride, w->abt_block2[n]); ^ 75. s->bdsp.clear_block(w->abt_block2[n]); 76. break; libavcodec/simple_idct.c:191:1: Parameter `*block` 189. } 190. 191. void ff_simple_idct48_add(uint8_t *dest, ptrdiff_t line_size, int16_t *block) ^ 192. { 193. int i; libavcodec/simple_idct.c:197:9: Call 195. /* IDCT4 on each line */ 196. for(i=0; i<8; i++) { 197. idct4row(block + i*8); ^ 198. } 199. libavcodec/simple_idct.c:158:1: <Length trace> 156. #define R3 R_FIX(0.5) 157. #define R_SHIFT 11 158. static inline void idct4row(int16_t *row) ^ 159. { 160. int c0, c1, c2, c3, a0, a1, a2, a3; libavcodec/simple_idct.c:158:1: Parameter `*row` 156. #define R3 R_FIX(0.5) 157. #define R_SHIFT 11 158. static inline void idct4row(int16_t *row) ^ 159. { 160. int c0, c1, c2, c3, a0, a1, a2, a3; libavcodec/simple_idct.c:165:10: Array access: Offset: [8, 64] (⇐ [5, 61] + 3) Size: 6 by call to `wmv2_add_block` 163. a1 = row[1]; 164. a2 = row[2]; 165. a3 = row[3]; ^ 166. c0 = (a0 + a2)*R3 + (1 << (R_SHIFT - 1)); 167. c2 = (a0 - a2)*R3 + (1 << (R_SHIFT - 1));
https://github.com/libav/libav/blob/2ec9fa5ec60dcd10e1cb10d8b4e4437e634ea428/libavcodec/simple_idct.c/#L165
d2a_code_trace_data_43205
static int opt_vstats(const char *opt, const char *arg) { char filename[40]; time_t today2 = time(NULL); struct tm *today = localtime(&today2); snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, today->tm_sec); return opt_vstats_file(opt, filename); } ffmpeg.c:4173: error: Null Dereference pointer `today` last assigned on line 4171 could be null and is dereferenced at line 4173, column 69. ffmpeg.c:4167:1: start of procedure opt_vstats() 4165. } 4166. 4167. static int opt_vstats(const char *opt, const char *arg) ^ 4168. { 4169. char filename[40]; ffmpeg.c:4170:5: 4168. { 4169. char filename[40]; 4170. time_t today2 = time(NULL); ^ 4171. struct tm *today = localtime(&today2); 4172. ffmpeg.c:4171:5: 4169. char filename[40]; 4170. time_t today2 = time(NULL); 4171. struct tm *today = localtime(&today2); ^ 4172. 4173. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, ffmpeg.c:4173:5: 4171. struct tm *today = localtime(&today2); 4172. 4173. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, ^ 4174. today->tm_sec); 4175. return opt_vstats_file(opt, filename);
https://github.com/libav/libav/blob/eb97dbb05a990266b04830ea8e179e0428656b98/ffmpeg.c/#L4173
d2a_code_trace_data_43206
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) { int line_size; int sample_size = av_get_bytes_per_sample(sample_fmt); int planar = av_sample_fmt_is_planar(sample_fmt); if (!sample_size || nb_samples <= 0 || nb_channels <= 0) return AVERROR(EINVAL); if (!align) { if (nb_samples > INT_MAX - 31) return AVERROR(EINVAL); align = 1; nb_samples = FFALIGN(nb_samples, 32); } if (nb_channels > INT_MAX / align || (int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size) return AVERROR(EINVAL); line_size = planar ? FFALIGN(nb_samples * sample_size, align) : FFALIGN(nb_samples * sample_size * nb_channels, align); if (linesize) *linesize = line_size; return planar ? line_size * nb_channels : line_size; } libavcodec/webp.c:600: error: Integer Overflow L2 ([1, 2147483616] + 32):signed32 by call to `av_frame_get_buffer`. libavcodec/webp.c:600:15: Call 598. ret = ff_thread_get_buffer(s->avctx, &pt, 0); 599. } else 600. ret = av_frame_get_buffer(img->frame, 1); ^ 601. if (ret < 0) 602. return ret; libavutil/frame.c:161:1: Parameter `frame->nb_samples` 159. } 160. 161. int av_frame_get_buffer(AVFrame *frame, int align) ^ 162. { 163. if (frame->format < 0) libavutil/frame.c:169:16: Call 167. return get_video_buffer(frame, align); 168. else if (frame->nb_samples > 0 && frame->channel_layout) 169. return get_audio_buffer(frame, align); ^ 170. 171. return AVERROR(EINVAL); libavutil/frame.c:112:1: Parameter `frame->nb_samples` 110. } 111. 112. static int get_audio_buffer(AVFrame *frame, int align) ^ 113. { 114. int channels = av_get_channel_layout_nb_channels(frame->channel_layout); libavutil/frame.c:120:15: Call 118. 119. if (!frame->linesize[0]) { 120. ret = av_samples_get_buffer_size(&frame->linesize[0], channels, ^ 121. frame->nb_samples, frame->format, 122. align); libavutil/samplefmt.c:108:1: <LHS trace> 106. } 107. 108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, ^ 109. enum AVSampleFormat sample_fmt, int align) 110. { libavutil/samplefmt.c:108:1: Parameter `nb_samples` 106. } 107. 108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, ^ 109. enum AVSampleFormat sample_fmt, int align) 110. { libavutil/samplefmt.c:124:9: Binary operation: ([1, 2147483616] + 32):signed32 by call to `av_frame_get_buffer` 122. return AVERROR(EINVAL); 123. align = 1; 124. nb_samples = FFALIGN(nb_samples, 32); ^ 125. } 126.
https://github.com/libav/libav/blob/0e830094ad0dc251613a0aa3234d9c5c397e02e6/libavutil/samplefmt.c/#L124
d2a_code_trace_data_43207
static int module_init(CONF_MODULE *pmod, char *name, char *value, const CONF *cnf) { int ret = 1; int init_called = 0; CONF_IMODULE *imod = NULL; imod = OPENSSL_malloc(sizeof(*imod)); if (imod == NULL) goto err; imod->pmod = pmod; imod->name = OPENSSL_strdup(name); imod->value = OPENSSL_strdup(value); imod->usr_data = NULL; if (!imod->name || !imod->value) goto memerr; if (pmod->init) { ret = pmod->init(imod, cnf); init_called = 1; if (ret <= 0) goto err; } if (initialized_modules == NULL) { initialized_modules = sk_CONF_IMODULE_new_null(); if (!initialized_modules) { CONFerr(CONF_F_MODULE_INIT, ERR_R_MALLOC_FAILURE); goto err; } } if (!sk_CONF_IMODULE_push(initialized_modules, imod)) { CONFerr(CONF_F_MODULE_INIT, ERR_R_MALLOC_FAILURE); goto err; } pmod->links++; return ret; err: if (pmod->finish && init_called) pmod->finish(imod); memerr: if (imod) { OPENSSL_free(imod->name); OPENSSL_free(imod->value); OPENSSL_free(imod); } return -1; } crypto/conf/conf_mod.c:352: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_strdup()` at line 343, column 18 is not reachable after line 352, column 15. Showing all 55 steps of the trace crypto/conf/conf_mod.c:330:1: start of procedure module_init() 328. 329. /* initialize a module */ 330. > static int module_init(CONF_MODULE *pmod, char *name, char *value, 331. const CONF *cnf) 332. { crypto/conf/conf_mod.c:333:5: 331. const CONF *cnf) 332. { 333. > int ret = 1; 334. int init_called = 0; 335. CONF_IMODULE *imod = NULL; crypto/conf/conf_mod.c:334:5: 332. { 333. int ret = 1; 334. > int init_called = 0; 335. CONF_IMODULE *imod = NULL; 336. crypto/conf/conf_mod.c:335:5: 333. int ret = 1; 334. int init_called = 0; 335. > CONF_IMODULE *imod = NULL; 336. 337. /* Otherwise add initialized module to list */ crypto/conf/conf_mod.c:338:5: 336. 337. /* Otherwise add initialized module to list */ 338. > imod = OPENSSL_malloc(sizeof(*imod)); 339. if (imod == NULL) 340. goto err; crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/conf/conf_mod.c:339:9: Taking false branch 337. /* Otherwise add initialized module to list */ 338. imod = OPENSSL_malloc(sizeof(*imod)); 339. if (imod == NULL) ^ 340. goto err; 341. crypto/conf/conf_mod.c:342:5: 340. goto err; 341. 342. > imod->pmod = pmod; 343. imod->name = OPENSSL_strdup(name); 344. imod->value = OPENSSL_strdup(value); crypto/conf/conf_mod.c:343:5: 341. 342. imod->pmod = pmod; 343. > imod->name = OPENSSL_strdup(name); 344. imod->value = OPENSSL_strdup(value); 345. imod->usr_data = NULL; crypto/o_str.c:121:1: start of procedure CRYPTO_strdup() 119. } 120. 121. > char *CRYPTO_strdup(const char *str, const char* file, int line) 122. { 123. char *ret; crypto/o_str.c:125:9: Taking false branch 123. char *ret; 124. 125. if (str == NULL) ^ 126. return NULL; 127. ret = CRYPTO_malloc(strlen(str) + 1, file, line); crypto/o_str.c:127:5: 125. if (str == NULL) 126. return NULL; 127. > ret = CRYPTO_malloc(strlen(str) + 1, file, line); 128. if (ret != NULL) 129. strcpy(ret, str); crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/o_str.c:128:9: Taking true branch 126. return NULL; 127. ret = CRYPTO_malloc(strlen(str) + 1, file, line); 128. if (ret != NULL) ^ 129. strcpy(ret, str); 130. return ret; crypto/o_str.c:129:9: 127. ret = CRYPTO_malloc(strlen(str) + 1, file, line); 128. if (ret != NULL) 129. > strcpy(ret, str); 130. return ret; 131. } crypto/o_str.c:130:5: 128. if (ret != NULL) 129. strcpy(ret, str); 130. > return ret; 131. } 132. crypto/o_str.c:131:1: return from a call to CRYPTO_strdup 129. strcpy(ret, str); 130. return ret; 131. > } 132. 133. char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line) crypto/conf/conf_mod.c:344:5: 342. imod->pmod = pmod; 343. imod->name = OPENSSL_strdup(name); 344. > imod->value = OPENSSL_strdup(value); 345. imod->usr_data = NULL; 346. crypto/o_str.c:121:1: start of procedure CRYPTO_strdup() 119. } 120. 121. > char *CRYPTO_strdup(const char *str, const char* file, int line) 122. { 123. char *ret; crypto/o_str.c:125:9: Taking false branch 123. char *ret; 124. 125. if (str == NULL) ^ 126. return NULL; 127. ret = CRYPTO_malloc(strlen(str) + 1, file, line); crypto/o_str.c:127:5: 125. if (str == NULL) 126. return NULL; 127. > ret = CRYPTO_malloc(strlen(str) + 1, file, line); 128. if (ret != NULL) 129. strcpy(ret, str); crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/o_str.c:128:9: Taking true branch 126. return NULL; 127. ret = CRYPTO_malloc(strlen(str) + 1, file, line); 128. if (ret != NULL) ^ 129. strcpy(ret, str); 130. return ret; crypto/o_str.c:129:9: 127. ret = CRYPTO_malloc(strlen(str) + 1, file, line); 128. if (ret != NULL) 129. > strcpy(ret, str); 130. return ret; 131. } crypto/o_str.c:130:5: 128. if (ret != NULL) 129. strcpy(ret, str); 130. > return ret; 131. } 132. crypto/o_str.c:131:1: return from a call to CRYPTO_strdup 129. strcpy(ret, str); 130. return ret; 131. > } 132. 133. char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line) crypto/conf/conf_mod.c:345:5: 343. imod->name = OPENSSL_strdup(name); 344. imod->value = OPENSSL_strdup(value); 345. > imod->usr_data = NULL; 346. 347. if (!imod->name || !imod->value) crypto/conf/conf_mod.c:347:10: Taking false branch 345. imod->usr_data = NULL; 346. 347. if (!imod->name || !imod->value) ^ 348. goto memerr; 349. crypto/conf/conf_mod.c:347:25: Taking false branch 345. imod->usr_data = NULL; 346. 347. if (!imod->name || !imod->value) ^ 348. goto memerr; 349. crypto/conf/conf_mod.c:351:9: Taking true branch 349. 350. /* Try to initialize module */ 351. if (pmod->init) { ^ 352. ret = pmod->init(imod, cnf); 353. init_called = 1; crypto/conf/conf_mod.c:352:9: Skipping __function_pointer__(): unresolved function pointer 350. /* Try to initialize module */ 351. if (pmod->init) { 352. ret = pmod->init(imod, cnf); ^ 353. init_called = 1; 354. /* Error occurred, exit */
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/conf/conf_mod.c/#L352
d2a_code_trace_data_43208
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; bn_check_top(b); if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } crypto/ec/ecdsa_ossl.c:162: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_set_word`. Showing all 21 steps of the trace crypto/ec/ecdsa_ossl.c:83:10: Call 81. /* Preallocate space */ 82. order_bits = BN_num_bits(order); 83. if (!BN_set_bit(k, order_bits) ^ 84. || !BN_set_bit(r, order_bits) 85. || !BN_set_bit(X, order_bits)) crypto/bn/bn_lib.c:616:1: Parameter `a->top` 614. } 615. 616. > int BN_set_bit(BIGNUM *a, int n) 617. { 618. int i, j, k; crypto/ec/ecdsa_ossl.c:162:14: Call 160. * order must be prime and use Fermat's Little Theorem instead. 161. */ 162. if (!BN_set_word(X, 2)) { ^ 163. ECerr(EC_F_ECDSA_SIGN_SETUP, ERR_R_BN_LIB); 164. goto err; crypto/bn/bn_lib.c:387:1: Parameter `a->top` 385. } 386. 387. > int BN_set_word(BIGNUM *a, BN_ULONG w) 388. { 389. bn_check_top(a); crypto/bn/bn_lib.c:390:9: Call 388. { 389. bn_check_top(a); 390. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 391. return 0; 392. a->neg = 0; crypto/bn/bn_lcl.h:651:1: Parameter `a->top` 649. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 650. 651. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 652. { 653. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_lcl.h:659:12: Call 657. return a; 658. 659. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2); ^ 660. } 661. crypto/bn/bn_lib.c:273:1: Parameter `b->top` 271. */ 272. 273. > BIGNUM *bn_expand2(BIGNUM *b, int words) 274. { 275. bn_check_top(b); crypto/bn/bn_lib.c:278:23: Call 276. 277. if (words > b->dmax) { 278. BN_ULONG *a = bn_expand_internal(b, words); ^ 279. if (!a) 280. return NULL; crypto/bn/bn_lib.c:235:1: <Offset trace> 233. /* This is used by bn_expand2() */ 234. /* The caller MUST check that words > b->dmax before calling this */ 235. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 236. { 237. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:235:1: Parameter `b->top` 233. /* This is used by bn_expand2() */ 234. /* The caller MUST check that words > b->dmax before calling this */ 235. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 236. { 237. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:235:1: <Length trace> 233. /* This is used by bn_expand2() */ 234. /* The caller MUST check that words > b->dmax before calling this */ 235. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 236. { 237. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:235:1: Parameter `words` 233. /* This is used by bn_expand2() */ 234. /* The caller MUST check that words > b->dmax before calling this */ 235. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 236. { 237. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:252:13: Call 250. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 251. else 252. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 253. if (a == NULL) { 254. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/mem.c:218:1: Parameter `num` 216. } 217. 218. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 219. { 220. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:220:17: Call 218. void *CRYPTO_zalloc(size_t num, const char *file, int line) 219. { 220. void *ret = CRYPTO_malloc(num, file, line); ^ 221. 222. FAILTEST(); crypto/mem.c:198:9: Assignment 196. 197. if (num == 0) 198. return NULL; ^ 199. 200. FAILTEST(); crypto/mem.c:220:5: Assignment 218. void *CRYPTO_zalloc(size_t num, const char *file, int line) 219. { 220. void *ret = CRYPTO_malloc(num, file, line); ^ 221. 222. FAILTEST(); crypto/mem.c:225:5: Assignment 223. if (ret != NULL) 224. memset(ret, 0, num); 225. return ret; ^ 226. } 227. crypto/bn/bn_lib.c:252:9: Assignment 250. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 251. else 252. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 253. if (a == NULL) { 254. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:260:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_set_word` 258. assert(b->top <= words); 259. if (b->top > 0) 260. memcpy(a, b->d, sizeof(*a) * b->top); ^ 261. 262. return a;
https://github.com/openssl/openssl/blob/b741fcd2ddc4e94faee75a47c241fa136854c81f/crypto/bn/bn_lib.c/#L260
d2a_code_trace_data_43209
static int mov_write_ctts_tag(AVIOContext *pb, MOVTrack *track) { MOVStts *ctts_entries; uint32_t entries = 0; uint32_t atom_size; int i; ctts_entries = av_malloc((track->entry + 1) * sizeof(*ctts_entries)); ctts_entries[0].count = 1; ctts_entries[0].duration = track->cluster[0].cts; for (i=1; i<track->entry; i++) { if (track->cluster[i].cts == ctts_entries[entries].duration) { ctts_entries[entries].count++; } else { entries++; ctts_entries[entries].duration = track->cluster[i].cts; ctts_entries[entries].count = 1; } } entries++; atom_size = 16 + (entries * 8); avio_wb32(pb, atom_size); ffio_wfourcc(pb, "ctts"); avio_wb32(pb, 0); avio_wb32(pb, entries); for (i=0; i<entries; i++) { avio_wb32(pb, ctts_entries[i].count); avio_wb32(pb, ctts_entries[i].duration); } av_free(ctts_entries); return atom_size; } libavformat/movenc.c:921: error: Null Dereference pointer `ctts_entries` last assigned on line 920 could be null and is dereferenced at line 921, column 5. libavformat/movenc.c:913:1: start of procedure mov_write_ctts_tag() 911. } 912. 913. static int mov_write_ctts_tag(AVIOContext *pb, MOVTrack *track) ^ 914. { 915. MOVStts *ctts_entries; libavformat/movenc.c:916:5: 914. { 915. MOVStts *ctts_entries; 916. uint32_t entries = 0; ^ 917. uint32_t atom_size; 918. int i; libavformat/movenc.c:920:5: 918. int i; 919. 920. ctts_entries = av_malloc((track->entry + 1) * sizeof(*ctts_entries)); /* worst case */ ^ 921. ctts_entries[0].count = 1; 922. ctts_entries[0].duration = track->cluster[0].cts; libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking true branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) ^ 73. return NULL; 74. libavutil/mem.c:73:9: 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) 73. return NULL; ^ 74. 75. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavformat/movenc.c:921:5: 919. 920. ctts_entries = av_malloc((track->entry + 1) * sizeof(*ctts_entries)); /* worst case */ 921. ctts_entries[0].count = 1; ^ 922. ctts_entries[0].duration = track->cluster[0].cts; 923. for (i=1; i<track->entry; i++) {
https://github.com/libav/libav/blob/0884dd5a1b87aff6c8a06e6492dece5cef8f3978/libavformat/movenc.c/#L921
d2a_code_trace_data_43210
static void close_connection(HTTPContext *c) { HTTPContext **cp, *c1; int i, nb_streams; AVFormatContext *ctx; URLContext *h; AVStream *st; cp = &first_http_ctx; while ((*cp) != NULL) { c1 = *cp; if (c1 == c) *cp = c->next; else cp = &c1->next; } for(c1 = first_http_ctx; c1 != NULL; c1 = c1->next) { if (c1->rtsp_c == c) c1->rtsp_c = NULL; } if (c->fd >= 0) closesocket(c->fd); if (c->fmt_in) { for(i=0;i<c->fmt_in->nb_streams;i++) { st = c->fmt_in->streams[i]; if (st->codec->codec) avcodec_close(st->codec); } av_close_input_file(c->fmt_in); } nb_streams = 0; if (c->stream) nb_streams = c->stream->nb_streams; for(i=0;i<nb_streams;i++) { ctx = c->rtp_ctx[i]; if (ctx) { av_write_trailer(ctx); av_metadata_free(&ctx->metadata); av_free(ctx->streams[0]); av_free(ctx); } h = c->rtp_handles[i]; if (h) url_close(h); } ctx = &c->fmt_ctx; if (!c->last_packet_sent && c->state == HTTPSTATE_SEND_DATA_TRAILER) { if (ctx->oformat) { if (avio_open_dyn_buf(&ctx->pb) >= 0) { av_write_trailer(ctx); av_freep(&c->pb_buffer); avio_close_dyn_buf(ctx->pb, &c->pb_buffer); } } } for(i=0; i<ctx->nb_streams; i++) av_free(ctx->streams[i]); if (c->stream && !c->post && c->stream->stream_type == STREAM_TYPE_LIVE) current_bandwidth -= c->stream->bandwidth; if (c->state == HTTPSTATE_RECEIVE_DATA && c->stream) { c->stream->feed_opened = 0; close(c->feed_fd); } av_freep(&c->pb_buffer); av_freep(&c->packet_buffer); av_free(c->buffer); av_free(c); nb_connections--; } ffserver.c:3291: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `close_connection`. ffserver.c:3291:5: Call 3289. 3290. /* abort the session */ 3291. close_connection(rtp_c); ^ 3292. } 3293. ffserver.c:811:1: <LHS trace> 809. } 810. 811. static void close_connection(HTTPContext *c) ^ 812. { 813. HTTPContext **cp, *c1; ffserver.c:811:1: Global `nb_connections` 809. } 810. 811. static void close_connection(HTTPContext *c) ^ 812. { 813. HTTPContext **cp, *c1; ffserver.c:895:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `close_connection` 893. av_free(c->buffer); 894. av_free(c); 895. nb_connections--; ^ 896. } 897.
https://github.com/libav/libav/blob/e2d7dc87df0c1e261e4a3fe082d192a7a798d4d5/ffserver.c/#L895
d2a_code_trace_data_43211
static void compute_scale_factors(unsigned char scale_code[SBLIMIT], unsigned char scale_factors[SBLIMIT][3], int sb_samples[3][12][SBLIMIT], int sblimit) { int *p, vmax, v, n, i, j, k, code; int index, d1, d2; unsigned char *sf = &scale_factors[0][0]; for(j=0;j<sblimit;j++) { for(i=0;i<3;i++) { p = &sb_samples[i][0][j]; vmax = abs(*p); for(k=1;k<12;k++) { p += SBLIMIT; v = abs(*p); if (v > vmax) vmax = v; } if (vmax > 0) { n = av_log2(vmax); index = (21 - n) * 3 - 3; if (index >= 0) { while (vmax <= scale_factor_table[index+1]) index++; } else { index = 0; } } else { index = 62; } #if 0 printf("%2d:%d in=%x %x %d\n", j, i, vmax, scale_factor_table[index], index); #endif assert(index >=0 && index <= 63); sf[i] = index; } d1 = scale_diff_table[sf[0] - sf[1] + 64]; d2 = scale_diff_table[sf[1] - sf[2] + 64]; switch(d1 * 5 + d2) { case 0*5+0: case 0*5+4: case 3*5+4: case 4*5+0: case 4*5+4: code = 0; break; case 0*5+1: case 0*5+2: case 4*5+1: case 4*5+2: code = 3; sf[2] = sf[1]; break; case 0*5+3: case 4*5+3: code = 3; sf[1] = sf[2]; break; case 1*5+0: case 1*5+4: case 2*5+4: code = 1; sf[1] = sf[0]; break; case 1*5+1: case 1*5+2: case 2*5+0: case 2*5+1: case 2*5+2: code = 2; sf[1] = sf[2] = sf[0]; break; case 2*5+3: case 3*5+3: code = 2; sf[0] = sf[1] = sf[2]; break; case 3*5+0: case 3*5+1: case 3*5+2: code = 2; sf[0] = sf[2] = sf[1]; break; case 1*5+3: code = 2; if (sf[0] > sf[2]) sf[0] = sf[2]; sf[1] = sf[2] = sf[0]; break; default: assert(0); code = 0; } #if 0 printf("%d: %2d %2d %2d %d %d -> %d\n", j, sf[0], sf[1], sf[2], d1, d2, code); #endif scale_code[j] = code; sf += 3; } } libavcodec/mpegaudioenc.c:385: error: Buffer Overrun L1 Offset: [32, +oo] Size: 32. libavcodec/mpegaudioenc.c:369:1: <Length trace> 367. } 368. 369. static void compute_scale_factors(unsigned char scale_code[SBLIMIT], ^ 370. unsigned char scale_factors[SBLIMIT][3], 371. int sb_samples[3][12][SBLIMIT], libavcodec/mpegaudioenc.c:369:1: Parameter `(*sb_samples)[*][*]` 367. } 368. 369. static void compute_scale_factors(unsigned char scale_code[SBLIMIT], ^ 370. unsigned char scale_factors[SBLIMIT][3], 371. int sb_samples[3][12][SBLIMIT], libavcodec/mpegaudioenc.c:381:13: Assignment 379. for(i=0;i<3;i++) { 380. /* find the max absolute value */ 381. p = &sb_samples[i][0][j]; ^ 382. vmax = abs(*p); 383. for(k=1;k<12;k++) { libavcodec/mpegaudioenc.c:384:17: Assignment 382. vmax = abs(*p); 383. for(k=1;k<12;k++) { 384. p += SBLIMIT; ^ 385. v = abs(*p); 386. if (v > vmax) libavcodec/mpegaudioenc.c:385:25: Array access: Offset: [32, +oo] Size: 32 383. for(k=1;k<12;k++) { 384. p += SBLIMIT; 385. v = abs(*p); ^ 386. if (v > vmax) 387. vmax = v;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudioenc.c/#L385
d2a_code_trace_data_43212
int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len) { int al,i,j,n,ret; SSL3_RECORD *rr; void (*cb)()=NULL; BIO *bio; if (s->s3->rbuf.buf == NULL) if (!ssl3_setup_buffers(s)) return(-1); if ((type != SSL3_RT_APPLICATION_DATA) && (type != SSL3_RT_HANDSHAKE) && type) { SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_INTERNAL_ERROR); return -1; } if ((type == SSL3_RT_HANDSHAKE) && (s->s3->handshake_fragment_len > 0)) { unsigned char *src = s->s3->handshake_fragment; unsigned char *dst = buf; n = 0; while ((len > 0) && (s->s3->handshake_fragment_len > 0)) { *dst++ = *src++; len--; s->s3->handshake_fragment_len--; n++; } for (i = 0; i < s->s3->handshake_fragment_len; i++) s->s3->handshake_fragment[i] = *src++; ssl3_finish_mac(s, buf, n); return n; } if (!s->in_handshake && SSL_in_init(s)) { i=s->handshake_func(s); if (i < 0) return(i); if (i == 0) { SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE); return(-1); } } start: s->rwstate=SSL_NOTHING; rr = &(s->s3->rrec); if ((rr->length == 0) || (s->rstate == SSL_ST_READ_BODY)) { ret=ssl3_get_record(s); if (ret <= 0) return(ret); } if (s->s3->change_cipher_spec && (rr->type != SSL3_RT_HANDSHAKE)) { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_DATA_BETWEEN_CCS_AND_FINISHED); goto err; } if (s->shutdown & SSL_RECEIVED_SHUTDOWN) { rr->length=0; s->rwstate=SSL_NOTHING; return(0); } if (type == rr->type) { if (SSL_in_init(s) && (type == SSL3_RT_APPLICATION_DATA) && (s->enc_read_ctx == NULL)) { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_APP_DATA_IN_HANDSHAKE); goto f_err; } if (len <= 0) return(len); if ((unsigned int)len > rr->length) n=rr->length; else n=len; memcpy(buf,&(rr->data[rr->off]),(unsigned int)n); rr->length-=n; rr->off+=n; if (rr->length == 0) { s->rstate=SSL_ST_READ_HEADER; rr->off=0; } if (type == SSL3_RT_HANDSHAKE) ssl3_finish_mac(s,buf,n); return(n); } { int dest_maxlen = 0; unsigned char *dest; int *dest_len; if (rr->type == SSL3_RT_HANDSHAKE) { dest_maxlen = sizeof s->s3->handshake_fragment; dest = s->s3->handshake_fragment; dest_len = &s->s3->handshake_fragment_len; } else if (rr->type == SSL3_RT_ALERT) { dest_maxlen = sizeof s->s3->alert_fragment; dest = s->s3->alert_fragment; dest_len = &s->s3->alert_fragment_len; } if (dest_maxlen > 0) { n = dest_maxlen - *dest_len; if (rr->length < n) n = rr->length; while (n-- > 0) { dest[(*dest_len)++] = rr->data[rr->off++]; rr->length--; } if (*dest_len < dest_maxlen) goto start; } } if ((!s->server) && (s->s3->handshake_fragment_len >= 4) && (s->s3->handshake_fragment[0] == SSL3_MT_HELLO_REQUEST) && (s->session != NULL) && (s->session->cipher != NULL)) { s->s3->handshake_fragment_len = 0; if ((s->s3->handshake_fragment[1] != 0) || (s->s3->handshake_fragment[2] != 0) || (s->s3->handshake_fragment[3] != 0)) { al=SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_BAD_HELLO_REQUEST); goto err; } if (SSL_is_init_finished(s) && !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS) && !s->s3->renegotiate) { ssl3_renegotiate(s); if (ssl3_renegotiate_check(s)) { n=s->handshake_func(s); if (n < 0) return(n); if (n == 0) { SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE); return(-1); } } } goto start; } if (s->s3->alert_fragment_len >= 2) { i = s->s3->alert_fragment[0]; n = s->s3->alert_fragment[1]; s->s3->alert_fragment_len = 0; if (s->info_callback != NULL) cb=s->info_callback; else if (s->ctx->info_callback != NULL) cb=s->ctx->info_callback; if (cb != NULL) { j=(i<<8)|n; cb(s,SSL_CB_READ_ALERT,j); } if (i == 1) { s->s3->warn_alert=n; if (n == SSL_AD_CLOSE_NOTIFY) { s->shutdown|=SSL_RECEIVED_SHUTDOWN; return(0); } } else if (i == 2) { char tmp[16]; s->rwstate=SSL_NOTHING; s->s3->fatal_alert=n; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_AD_REASON_OFFSET+n); sprintf(tmp,"%d",n); ERR_add_error_data(2,"SSL alert number ",tmp); s->shutdown|=SSL_RECEIVED_SHUTDOWN; SSL_CTX_remove_session(s->ctx,s->session); return(0); } else { al=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_UNKNOWN_ALERT_TYPE); goto f_err; } goto start; } if (s->shutdown & SSL_SENT_SHUTDOWN) { s->rwstate=SSL_NOTHING; rr->length=0; return(0); } if (rr->type == SSL3_RT_CHANGE_CIPHER_SPEC) { if ( (rr->length != 1) || (rr->off != 0) || (rr->data[0] != SSL3_MT_CCS)) { i=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_BAD_CHANGE_CIPHER_SPEC); goto err; } rr->length=0; s->s3->change_cipher_spec=1; if (!do_change_cipher_spec(s)) goto err; else goto start; } if ((s->s3->handshake_fragment_len >= 4) && !s->in_handshake) { if (((s->state&SSL_ST_MASK) == SSL_ST_OK) && !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS)) { s->state=SSL_ST_BEFORE|(s->server) ?SSL_ST_ACCEPT :SSL_ST_CONNECT; s->new_session=1; } n=s->handshake_func(s); if (n < 0) return(n); if (n == 0) { SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE); return(-1); } s->rwstate=SSL_READING; bio=SSL_get_rbio(s); BIO_clear_retry_flags(bio); BIO_set_retry_read(bio); return(-1); } switch (rr->type) { default: #ifndef NO_TLS if (s->version == TLS1_VERSION) { goto start; } #endif al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_UNEXPECTED_RECORD); goto f_err; case SSL3_RT_CHANGE_CIPHER_SPEC: case SSL3_RT_ALERT: case SSL3_RT_HANDSHAKE: al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_INTERNAL_ERROR); goto f_err; case SSL3_RT_APPLICATION_DATA: if (s->s3->in_read_app_data && (s->s3->total_renegotiations != 0) && (( (s->state & SSL_ST_CONNECT) && (s->state >= SSL3_ST_CW_CLNT_HELLO_A) && (s->state <= SSL3_ST_CR_SRVR_HELLO_A) ) || ( (s->state & SSL_ST_ACCEPT) && (s->state <= SSL3_ST_SW_HELLO_REQ_A) && (s->state >= SSL3_ST_SR_CLNT_HELLO_A) ) )) { s->s3->in_read_app_data=0; return(-1); } else { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES,SSL_R_UNEXPECTED_RECORD); goto f_err; } } f_err: ssl3_send_alert(s,SSL3_AL_FATAL,al); err: return(-1); } ssl/s3_pkt.c:863: error: UNINITIALIZED_VALUE The value read from *dest_len was never initialized. Showing all 1 steps of the trace ssl/s3_pkt.c:863:10: 861. while (n-- > 0) 862. { 863. > dest[(*dest_len)++] = rr->data[rr->off++]; 864. rr->length--; 865. }
https://github.com/openssl/openssl/blob/dab6f09573742df94c4767663565aca3863f8173/ssl/s3_pkt.c/#L863
d2a_code_trace_data_43213
int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *x, int vfy) { int rv, start_idx, i; if (x == NULL) { x = sk_X509_value(sk, 0); start_idx = 1; } else start_idx = 0; rv = ssl_security_cert(s, NULL, x, vfy, 1); if (rv != 1) return rv; for (i = start_idx; i < sk_X509_num(sk); i++) { x = sk_X509_value(sk, i); rv = ssl_security_cert(s, NULL, x, vfy, 0); if (rv != 1) return rv; } return 1; } ssl/t1_lib.c:4320: error: NULL_DEREFERENCE pointer `null` is dereferenced by call to `ssl_security_cert()` at line 4320, column 10. Showing all 4 steps of the trace ssl/t1_lib.c:4311:1: start of procedure ssl_security_cert_chain() 4309. */ 4310. 4311. > int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *x, int vfy) 4312. { 4313. int rv, start_idx, i; ssl/t1_lib.c:4314:9: Taking false branch 4312. { 4313. int rv, start_idx, i; 4314. if (x == NULL) { ^ 4315. x = sk_X509_value(sk, 0); 4316. start_idx = 1; ssl/t1_lib.c:4318:9: 4316. start_idx = 1; 4317. } else 4318. > start_idx = 0; 4319. 4320. rv = ssl_security_cert(s, NULL, x, vfy, 1); ssl/t1_lib.c:4320:5: 4318. start_idx = 0; 4319. 4320. > rv = ssl_security_cert(s, NULL, x, vfy, 1); 4321. if (rv != 1) 4322. return rv;
https://github.com/openssl/openssl/blob/e29c73c93b88a4b7f492c7c8c7343223e7548612/ssl/t1_lib.c/#L4320
d2a_code_trace_data_43214
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ec2_smpl.c:600: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end`. Showing all 10 steps of the trace crypto/ec/ec2_smpl.c:585:5: Call 583. } 584. 585. BN_CTX_start(ctx); ^ 586. aX = BN_CTX_get(ctx); 587. aY = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/ec/ec2_smpl.c:600:5: Call 598. 599. err: 600. BN_CTX_end(ctx); ^ 601. BN_CTX_free(new_ctx); 602. return ret; crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_43215
static ossl_inline void packet_forward(PACKET *pkt, size_t len) { pkt->curr += len; pkt->remaining -= len; } test/packettest.c:293: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `PACKET_forward`. Showing all 10 steps of the trace test/packettest.c:292:10: Call 290. PACKET pkt; 291. 292. if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN)) ^ 293. || !TEST_true(PACKET_forward(&pkt, 1)) 294. || !TEST_true(PACKET_get_bytes(&pkt, &byte, 1)) ssl/packet_locl.h:72:8: Parameter `pkt->remaining` 70. * is being used. 71. */ 72. __owur static ossl_inline int PACKET_buf_init(PACKET *pkt, ^ 73. const unsigned char *buf, 74. size_t len) test/packettest.c:293:17: Call 291. 292. if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN)) 293. || !TEST_true(PACKET_forward(&pkt, 1)) ^ 294. || !TEST_true(PACKET_get_bytes(&pkt, &byte, 1)) 295. || !TEST_uchar_eq(byte[0], 4) ssl/packet_locl.h:467:8: Parameter `len` 465. 466. /* Move the current reading position forward |len| bytes */ 467. __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len) ^ 468. { 469. if (PACKET_remaining(pkt) < len) ssl/packet_locl.h:472:5: Call 470. return 0; 471. 472. packet_forward(pkt, len); ^ 473. 474. return 1; ssl/packet_locl.h:33:1: <LHS trace> 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: Parameter `pkt->remaining` 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: <RHS trace> 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: Parameter `len` 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:36:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `PACKET_forward` 34. { 35. pkt->curr += len; 36. pkt->remaining -= len; ^ 37. } 38.
https://github.com/openssl/openssl/blob/424aa352458486d67e1e9cd3d3990dc06a60ba4a/ssl/packet_locl.h/#L36
d2a_code_trace_data_43216
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } apps/s_client.c:258: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_exp`. Showing all 23 steps of the trace apps/s_client.c:252:9: Call 250. int ret = 251. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && 252. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 && ^ 253. p != NULL && BN_rshift1(p, N) && 254. /* p = (N-1)/2 */ crypto/bn/bn_prime.c:194:1: Parameter `ctx_passed->stack.depth` 192. } 193. 194. > int BN_is_prime_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 195. BN_GENCB *cb) 196. { crypto/bn/bn_prime.c:197:12: Call 195. BN_GENCB *cb) 196. { 197. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb); ^ 198. } 199. crypto/bn/bn_prime.c:200:1: Parameter `ctx_passed->stack.depth` 198. } 199. 200. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 201. int do_trial_division, BN_GENCB *cb) 202. { apps/s_client.c:258:9: Call 256. r != NULL && 257. /* verify g^((N-1)/2) == -1 (mod N) */ 258. BN_mod_exp(r, g, p, N, bn_ctx) && ^ 259. BN_add_word(r, 1) && BN_cmp(r, N) == 0; 260. crypto/bn/bn_exp.c:90:1: Parameter `ctx->stack.depth` 88. } 89. 90. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 91. BN_CTX *ctx) 92. { crypto/bn/bn_exp.c:155:15: Call 153. #ifdef RECP_MUL_MOD 154. { 155. ret = BN_mod_exp_recp(r, a, p, m, ctx); ^ 156. } 157. #else crypto/bn/bn_exp.c:167:1: Parameter `ctx->stack.depth` 165. } 166. 167. > int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 168. const BIGNUM *m, BN_CTX *ctx) 169. { crypto/bn/bn_exp.c:195:5: Call 193. } 194. 195. BN_CTX_start(ctx); ^ 196. aa = BN_CTX_get(ctx); 197. val[0] = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_exp.c:214:10: Call 212. } 213. 214. if (!BN_nnmod(val[0], a, m, ctx)) ^ 215. goto err; /* 1 */ 216. if (BN_is_zero(val[0])) { crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:193:5: Call 191. } 192. 193. BN_CTX_start(ctx); ^ 194. tmp = BN_CTX_get(ctx); 195. snum = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:416:5: Call 414. if (no_branch) 415. bn_correct_top(res); 416. BN_CTX_end(ctx); ^ 417. return (1); 418. err: crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.indexes` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:271:1: <Offset trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `st->depth` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: <Length trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `*st->indexes` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:273:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_exp` 271. static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; ^ 274. } 275.
https://github.com/openssl/openssl/blob/748e85308ef4f3e672975b3604ea2d76424fa404/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_43217
static inline void shuffle_bytes_2103_c(const uint8_t *src, uint8_t *dst, int src_size) { int idx = 15 - src_size; const uint8_t *s = src - idx; uint8_t *d = dst - idx; for (; idx < 15; idx += 4) { register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00; v &= 0xff00ff; *(uint32_t *)&d[idx] = (v >> 16) + g + (v << 16); } } libswscale/rgb2rgb_template.c:346: error: Integer Overflow L2 ([0, 255+min(4278255360, `*src`)] + [0, 1095233372160]):signed32. libswscale/rgb2rgb_template.c:336:1: <LHS trace> 334. } 335. 336. static inline void shuffle_bytes_2103_c(const uint8_t *src, uint8_t *dst, ^ 337. int src_size) 338. { libswscale/rgb2rgb_template.c:336:1: Parameter `*src` 334. } 335. 336. static inline void shuffle_bytes_2103_c(const uint8_t *src, uint8_t *dst, ^ 337. int src_size) 338. { libswscale/rgb2rgb_template.c:344:9: Assignment 342. 343. for (; idx < 15; idx += 4) { 344. register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00; ^ 345. v &= 0xff00ff; 346. *(uint32_t *)&d[idx] = (v >> 16) + g + (v << 16); libswscale/rgb2rgb_template.c:344:9: Assignment 342. 343. for (; idx < 15; idx += 4) { 344. register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00; ^ 345. v &= 0xff00ff; 346. *(uint32_t *)&d[idx] = (v >> 16) + g + (v << 16); libswscale/rgb2rgb_template.c:336:1: <RHS trace> 334. } 335. 336. static inline void shuffle_bytes_2103_c(const uint8_t *src, uint8_t *dst, ^ 337. int src_size) 338. { libswscale/rgb2rgb_template.c:336:1: Parameter `*src` 334. } 335. 336. static inline void shuffle_bytes_2103_c(const uint8_t *src, uint8_t *dst, ^ 337. int src_size) 338. { libswscale/rgb2rgb_template.c:344:9: Assignment 342. 343. for (; idx < 15; idx += 4) { 344. register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00; ^ 345. v &= 0xff00ff; 346. *(uint32_t *)&d[idx] = (v >> 16) + g + (v << 16); libswscale/rgb2rgb_template.c:345:9: Assignment 343. for (; idx < 15; idx += 4) { 344. register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00; 345. v &= 0xff00ff; ^ 346. *(uint32_t *)&d[idx] = (v >> 16) + g + (v << 16); 347. } libswscale/rgb2rgb_template.c:346:9: Binary operation: ([0, 255+min(4278255360, *src)] + [0, 1095233372160]):signed32 344. register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00; 345. v &= 0xff00ff; 346. *(uint32_t *)&d[idx] = (v >> 16) + g + (v << 16); ^ 347. } 348. }
https://github.com/libav/libav/blob/0ad522afb3a3b3d22402ecb82dd4609f7655031b/libswscale/rgb2rgb_template.c/#L346
d2a_code_trace_data_43218
ngx_err_t ngx_create_full_path(u_char *dir, ngx_uint_t access) { u_char *p, ch; ngx_err_t err; for (p = dir + 1; *p; p++) { ch = *p; if (ch != '/') { continue; } *p = '\0'; if (ngx_create_dir(dir, access) == NGX_FILE_ERROR) { err = ngx_errno; if (err != NGX_EEXIST) { return err; } } *p = '/'; } return 0; } src/http/ngx_http_upstream.c:2568: error: Buffer Overrun L3 Offset: [1, +oo] Size: [0, +oo] by call to `ngx_ext_rename_file`. src/http/ngx_http_upstream.c:2553:9: Call 2551. if (u->conf->store_lengths == NULL) { 2552. 2553. ngx_http_map_uri_to_path(r, &path, &root, 0); ^ 2554. 2555. } else { src/http/ngx_http_core_module.c:1670:1: Parameter `*path->data` 1668. 1669. 1670. u_char * ^ 1671. ngx_http_map_uri_to_path(ngx_http_request_t *r, ngx_str_t *path, 1672. size_t *root_length, size_t reserved) src/http/ngx_http_upstream.c:2568:12: Call 2566. tf->file.name.data, path.data); 2567. 2568. (void) ngx_ext_rename_file(&tf->file.name, &path, &ext); ^ 2569. } 2570. src/core/ngx_file.c:526:1: Parameter `*to->data` 524. 525. 526. ngx_int_t ^ 527. ngx_ext_rename_file(ngx_str_t *src, ngx_str_t *to, ngx_ext_rename_file_t *ext) 528. { src/core/ngx_file.c:565:15: Call 563. } 564. 565. err = ngx_create_full_path(to->data, ngx_dir_access(ext->path_access)); ^ 566. 567. if (err) { src/core/ngx_file.c:185:1: <Length trace> 183. 184. 185. ngx_err_t ^ 186. ngx_create_full_path(u_char *dir, ngx_uint_t access) 187. { src/core/ngx_file.c:185:1: Parameter `*dir` 183. 184. 185. ngx_err_t ^ 186. ngx_create_full_path(u_char *dir, ngx_uint_t access) 187. { src/core/ngx_file.c:191:10: Assignment 189. ngx_err_t err; 190. 191. for (p = dir + 1; *p; p++) { ^ 192. ch = *p; 193. src/core/ngx_file.c:191:23: Array access: Offset: [1, +oo] Size: [0, +oo] by call to `ngx_ext_rename_file` 189. ngx_err_t err; 190. 191. for (p = dir + 1; *p; p++) { ^ 192. ch = *p; 193.
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_file.c/#L191
d2a_code_trace_data_43219
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } if (allocbytes != NULL) *allocbytes = WPACKET_get_curr(pkt); return 1; } ssl/statem/extensions_srvr.c:881: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 4]):unsigned64 by call to `WPACKET_start_sub_packet_len__`. Showing all 12 steps of the trace ssl/statem/extensions_srvr.c:880:10: Call 878. return 1; 879. 880. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_early_data) ^ 881. || !WPACKET_start_sub_packet_u16(pkt) 882. || !WPACKET_close(pkt)) { ssl/packet.c:312:1: Parameter `pkt->buf->length` 310. } 311. 312. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 313. { 314. unsigned char *data; ssl/statem/extensions_srvr.c:881:17: Call 879. 880. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_early_data) 881. || !WPACKET_start_sub_packet_u16(pkt) ^ 882. || !WPACKET_close(pkt)) { 883. SSLerr(SSL_F_TLS_CONSTRUCT_STOC_EARLY_DATA, ERR_R_INTERNAL_ERROR); ssl/packet.c:275:1: Parameter `pkt->written` 273. } 274. 275. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 276. { 277. WPACKET_SUB *sub; ssl/packet.c:299:10: Call 297. } 298. 299. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 300. return 0; 301. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */ ssl/packet.c:15:1: Parameter `pkt->written` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ssl/packet.c:17:10: Call 15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ^ 18. return 0; 19. ssl/packet.c:39:1: <LHS trace> 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: Parameter `pkt->buf->length` 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: <RHS trace> 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: Parameter `len` 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:49:36: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 4]):unsigned64 by call to `WPACKET_start_sub_packet_len__` 47. return 0; 48. 49. if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) { ^ 50. size_t newlen; 51. size_t reflen;
https://github.com/openssl/openssl/blob/538bea6c8184670a8d1608ef288a4e1813dcefa6/ssl/packet.c/#L49
d2a_code_trace_data_43220
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_chk.c:157: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_mul`. Showing all 27 steps of the trace crypto/rsa/rsa_chk.c:84:9: Call 82. 83. /* q prime? */ 84. if (BN_is_prime_ex(key->q, BN_prime_checks, NULL, cb) != 1) { ^ 85. ret = 0; 86. RSAerr(RSA_F_RSA_CHECK_KEY_EX, RSA_R_Q_NOT_PRIME); crypto/bn/bn_prime.c:183:12: Call 181. BN_GENCB *cb) 182. { 183. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb); ^ 184. } 185. crypto/bn/bn_prime.c:187:1: Parameter `ctx_passed->stack.depth` 185. 186. /* See FIPS 186-4 C.3.1 Miller Rabin Probabilistic Primality Test. */ 187. > int BN_is_prime_fasttest_ex(const BIGNUM *w, int checks, BN_CTX *ctx_passed, 188. int do_trial_division, BN_GENCB *cb) 189. { crypto/rsa/rsa_chk.c:99:10: Call 97. 98. /* n = p*q * r_3...r_i? */ 99. if (!BN_mul(i, key->p, key->q, ctx)) { ^ 100. ret = -1; 101. goto err; crypto/bn/bn_mul.c:497:1: Parameter `ctx->stack.depth` 495. #endif /* BN_RECURSION */ 496. 497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); crypto/bn/bn_mul.c:499:15: Call 497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); ^ 500. 501. bn_correct_top(r); crypto/bn/bn_mul.c:507:1: Parameter `ctx->stack.depth` 505. } 506. 507. > int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 508. { 509. int ret = 0; crypto/rsa/rsa_chk.c:157:10: Call 155. goto err; 156. } 157. if (!BN_mod_mul(i, key->d, key->e, k, ctx)) { ^ 158. ret = -1; 159. goto err; crypto/bn/bn_mod.c:193:1: Parameter `ctx->stack.depth` 191. 192. /* slow but works */ 193. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 194. BN_CTX *ctx) 195. { crypto/bn/bn_mod.c:203:5: Call 201. bn_check_top(m); 202. 203. BN_CTX_start(ctx); ^ 204. if ((t = BN_CTX_get(ctx)) == NULL) 205. goto err; crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_mod.c:204:14: Call 202. 203. BN_CTX_start(ctx); 204. if ((t = BN_CTX_get(ctx)) == NULL) ^ 205. goto err; 206. if (a == b) { crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_mod.c:207:14: Call 205. goto err; 206. if (a == b) { 207. if (!BN_sqr(t, a, ctx)) ^ 208. goto err; 209. } else { crypto/bn/bn_sqr.c:17:1: Parameter `ctx->stack.depth` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int ret = bn_sqr_fixed_top(r, a, ctx); crypto/bn/bn_sqr.c:19:15: Call 17. int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int ret = bn_sqr_fixed_top(r, a, ctx); ^ 20. 21. bn_correct_top(r); crypto/bn/bn_sqr.c:27:1: Parameter `ctx->stack.depth` 25. } 26. 27. > int bn_sqr_fixed_top(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 28. { 29. int max, al; crypto/bn/bn_sqr.c:42:5: Call 40. } 41. 42. BN_CTX_start(ctx); ^ 43. rr = (a != r) ? r : BN_CTX_get(ctx); 44. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_sqr.c:44:11: Call 42. BN_CTX_start(ctx); 43. rr = (a != r) ? r : BN_CTX_get(ctx); 44. tmp = BN_CTX_get(ctx); ^ 45. if (rr == NULL || tmp == NULL) 46. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_sqr.c:104:5: Call 102. bn_check_top(rr); 103. bn_check_top(tmp); 104. BN_CTX_end(ctx); ^ 105. return ret; 106. } crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <LHS trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_mul` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_43221
char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) { X509_NAME_ENTRY *ne; int i; int n, lold, l, l1, l2, num, j, type; const char *s; char *p; unsigned char *q; BUF_MEM *b = NULL; static const char hex[17] = "0123456789ABCDEF"; int gs_doit[4]; char tmp_buf[80]; #ifdef CHARSET_EBCDIC unsigned char ebcdic_buf[1024]; #endif if (buf == NULL) { if ((b = BUF_MEM_new()) == NULL) goto err; if (!BUF_MEM_grow(b, 200)) goto err; b->data[0] = '\0'; len = 200; } else if (len == 0) { return NULL; } if (a == NULL) { if (b) { buf = b->data; OPENSSL_free(b); } strncpy(buf, "NO X509_NAME", len); buf[len - 1] = '\0'; return buf; } len--; l = 0; for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { ne = sk_X509_NAME_ENTRY_value(a->entries, i); n = OBJ_obj2nid(ne->object); if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) { i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object); s = tmp_buf; } l1 = strlen(s); type = ne->value->type; num = ne->value->length; q = ne->value->data; #ifdef CHARSET_EBCDIC if (type == V_ASN1_GENERALSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_PRINTABLESTRING || type == V_ASN1_TELETEXSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_IA5STRING) { ascii2ebcdic(ebcdic_buf, q, (num > (int)sizeof(ebcdic_buf)) ? (int)sizeof(ebcdic_buf) : num); q = ebcdic_buf; } #endif if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) { gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0; for (j = 0; j < num; j++) if (q[j] != 0) gs_doit[j & 3] = 1; if (gs_doit[0] | gs_doit[1] | gs_doit[2]) gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; else { gs_doit[0] = gs_doit[1] = gs_doit[2] = 0; gs_doit[3] = 1; } } else gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; for (l2 = j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; l2++; #ifndef CHARSET_EBCDIC if ((q[j] < ' ') || (q[j] > '~')) l2 += 3; #else if ((os_toascii[q[j]] < os_toascii[' ']) || (os_toascii[q[j]] > os_toascii['~'])) l2 += 3; #endif } lold = l; l += 1 + l1 + 1 + l2; if (b != NULL) { if (!BUF_MEM_grow(b, l + 1)) goto err; p = &(b->data[lold]); } else if (l > len) { break; } else p = &(buf[lold]); *(p++) = '/'; memcpy(p, s, (unsigned int)l1); p += l1; *(p++) = '='; #ifndef CHARSET_EBCDIC q = ne->value->data; #endif for (j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; #ifndef CHARSET_EBCDIC n = q[j]; if ((n < ' ') || (n > '~')) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = n; #else n = os_toascii[q[j]]; if ((n < os_toascii[' ']) || (n > os_toascii['~'])) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = q[j]; #endif } *p = '\0'; } if (b != NULL) { p = b->data; OPENSSL_free(b); } else p = buf; if (i == 0) *p = '\0'; return (p); err: X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE); BUF_MEM_free(b); return (NULL); } apps/x509.c:762: error: BUFFER_OVERRUN_L3 Offset added: [200, 256] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace apps/x509.c:762:17: Call 760. int len; 761. 762. X509_NAME_oneline(X509_get_subject_name(x), buf, sizeof buf); ^ 763. BIO_printf(out, "/*\n" 764. " * Subject: %s\n", buf); crypto/x509/x509_obj.c:66:1: <Offset trace> 64. #include "internal/x509_int.h" 65. 66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 67. { 68. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:66:1: Parameter `len` 64. #include "internal/x509_int.h" 65. 66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 67. { 68. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:66:1: <Length trace> 64. #include "internal/x509_int.h" 65. 66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 67. { 68. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:66:1: Parameter `*buf` 64. #include "internal/x509_int.h" 65. 66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 67. { 68. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:97:9: Array access: Offset added: [200, 256] Size: [1, 2147483644] by call to `X509_NAME_oneline` 95. OPENSSL_free(b); 96. } 97. strncpy(buf, "NO X509_NAME", len); ^ 98. buf[len - 1] = '\0'; 99. return buf;
https://github.com/openssl/openssl/blob/b33d1141b6dcce947708b984c5e9e91dad3d675d/crypto/x509/x509_obj.c/#L97
d2a_code_trace_data_43222
static void contract(LHASH *lh) { LHASH_NODE **n,*n1,*np; np=lh->b[lh->p+lh->pmax-1]; lh->b[lh->p+lh->pmax-1]=NULL; if (lh->p == 0) { n=(LHASH_NODE **)OPENSSL_realloc(lh->b, (unsigned int)(sizeof(LHASH_NODE *)*lh->pmax)); if (n == NULL) { lh->error++; return; } lh->num_contract_reallocs++; lh->num_alloc_nodes/=2; lh->pmax/=2; lh->p=lh->pmax-1; lh->b=n; } else lh->p--; lh->num_nodes--; lh->num_contracts++; n1=lh->b[(int)lh->p]; if (n1 == NULL) lh->b[(int)lh->p]=np; else { while (n1->next != NULL) n1=n1->next; n1->next=np; } } ssl/s3_clnt.c:277: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `ssl3_get_server_hello`. Showing all 17 steps of the trace ssl/s3_clnt.c:180:1: Parameter `s->ctx->sessions->p` 178. ssl3_get_client_method) 179. 180. > int ssl3_connect(SSL *s) 181. { 182. BUF_MEM *buf=NULL; ssl/s3_clnt.c:277:8: Call 275. case SSL3_ST_CR_SRVR_HELLO_A: 276. case SSL3_ST_CR_SRVR_HELLO_B: 277. ret=ssl3_get_server_hello(s); ^ 278. if (ret <= 0) goto end; 279. ssl/s3_clnt.c:658:1: Parameter `s->ctx->sessions->p` 656. } 657. 658. > int ssl3_get_server_hello(SSL *s) 659. { 660. STACK_OF(SSL_CIPHER) *sk; ssl/s3_clnt.c:834:7: Call 832. goto f_err; 833. } 834. if (ssl_check_serverhello_tlsext(s) <= 0) ^ 835. { 836. SSLerr(SSL_F_SSL3_CONNECT,SSL_R_SERVERHELLO_TLSEXT); ssl/t1_lib.c:795:1: Parameter `s->ctx->sessions->p` 793. } 794. 795. > int ssl_check_serverhello_tlsext(SSL *s) 796. { 797. int ret=SSL_TLSEXT_ERR_NOACK; ssl/t1_lib.c:844:4: Call 842. { 843. case SSL_TLSEXT_ERR_ALERT_FATAL: 844. ssl3_send_alert(s,SSL3_AL_FATAL,al); ^ 845. return -1; 846. ssl/s3_pkt.c:1317:1: Parameter `s->ctx->sessions->p` 1315. } 1316. 1317. > void ssl3_send_alert(SSL *s, int level, int desc) 1318. { 1319. /* Map tls/ssl alert value to correct one */ ssl/s3_pkt.c:1326:3: Call 1324. /* If a fatal one, remove from cache */ 1325. if ((level == 2) && (s->session != NULL)) 1326. SSL_CTX_remove_session(s->ctx,s->session); ^ 1327. 1328. s->s3->alert_dispatch=1; ssl/ssl_sess.c:614:1: Parameter `ctx->sessions->p` 612. } 613. 614. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 615. { 616. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:616:9: Call 614. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 615. { 616. return remove_session_lock(ctx, c, 1); ^ 617. } 618. ssl/ssl_sess.c:619:1: Parameter `ctx->sessions->pmax` 617. } 618. 619. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 620. { 621. SSL_SESSION *r; ssl/ssl_sess.c:630:21: Call 628. { 629. ret=1; 630. r=(SSL_SESSION *)lh_delete(ctx->sessions,c); ^ 631. SSL_SESSION_list_remove(ctx,c); 632. } crypto/lhash/lhash.c:217:1: Parameter `lh->pmax` 215. } 216. 217. > void *lh_delete(LHASH *lh, const void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:243:3: Call 241. if ((lh->num_nodes > MIN_NODES) && 242. (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes))) 243. contract(lh); ^ 244. 245. return(ret); crypto/lhash/lhash.c:364:1: <LHS trace> 362. } 363. 364. > static void contract(LHASH *lh) 365. { 366. LHASH_NODE **n,*n1,*np; crypto/lhash/lhash.c:364:1: Parameter `lh->p` 362. } 363. 364. > static void contract(LHASH *lh) 365. { 366. LHASH_NODE **n,*n1,*np; crypto/lhash/lhash.c:368:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `ssl3_get_server_hello` 366. LHASH_NODE **n,*n1,*np; 367. 368. np=lh->b[lh->p+lh->pmax-1]; ^ 369. lh->b[lh->p+lh->pmax-1]=NULL; /* 24/07-92 - eay - weird but :-( */ 370. if (lh->p == 0)
https://github.com/openssl/openssl/blob/02756aa8ba36af6e718d7a07c4e6bd8ad12e7ba1/crypto/lhash/lhash.c/#L368
d2a_code_trace_data_43223
static int newpass_p12(PKCS12 *p12, char *oldpass, char *newpass) { STACK *asafes, *newsafes, *bags; int i, bagnid, pbe_nid, pbe_iter, pbe_saltlen; PKCS7 *p7, *p7new; ASN1_OCTET_STRING *p12_data_tmp = NULL, *macnew = NULL; unsigned char mac[EVP_MAX_MD_SIZE]; unsigned int maclen; if (!(asafes = M_PKCS12_unpack_authsafes(p12))) return 0; if(!(newsafes = sk_new(NULL))) return 0; for (i = 0; i < sk_num (asafes); i++) { p7 = (PKCS7 *) sk_value(asafes, i); bagnid = OBJ_obj2nid(p7->type); if (bagnid == NID_pkcs7_data) { bags = M_PKCS12_unpack_p7data(p7); } else if (bagnid == NID_pkcs7_encrypted) { bags = M_PKCS12_unpack_p7encdata(p7, oldpass, -1); alg_get(p7->d.encrypted->enc_data->algorithm, &pbe_nid, &pbe_iter, &pbe_saltlen); } else continue; if (!bags) { sk_pop_free(asafes, (void(*)(void *)) PKCS7_free); return 0; } if (!newpass_bags(bags, oldpass, newpass)) { sk_pop_free(bags, (void(*)(void *)) PKCS12_SAFEBAG_free); sk_pop_free(asafes, (void(*)(void *)) PKCS7_free); return 0; } if (bagnid == NID_pkcs7_data) p7new = PKCS12_pack_p7data(bags); else p7new = PKCS12_pack_p7encdata(pbe_nid, newpass, -1, NULL, pbe_saltlen, pbe_iter, bags); sk_pop_free(bags, (void(*)(void *)) PKCS12_SAFEBAG_free); if(!p7new) { sk_pop_free(asafes, (void(*)(void *)) PKCS7_free); return 0; } sk_push(newsafes, (char *)p7new); } sk_pop_free(asafes, (void(*)(void *)) PKCS7_free); p12_data_tmp = p12->authsafes->d.data; if(!(p12->authsafes->d.data = ASN1_OCTET_STRING_new())) goto saferr; if(!M_PKCS12_pack_authsafes(p12, newsafes)) goto saferr; if(!PKCS12_gen_mac(p12, newpass, -1, mac, &maclen)) goto saferr; if(!(macnew = ASN1_OCTET_STRING_new())) goto saferr; if(!ASN1_OCTET_STRING_set(macnew, mac, maclen)) goto saferr; ASN1_OCTET_STRING_free(p12->mac->dinfo->digest); p12->mac->dinfo->digest = macnew; ASN1_OCTET_STRING_free(p12_data_tmp); return 1; saferr: ASN1_OCTET_STRING_free(p12->authsafes->d.data); ASN1_OCTET_STRING_free(macnew); p12->authsafes->d.data = p12_data_tmp; return 0; } crypto/pkcs12/p12_npas.c:136: error: UNINITIALIZED_VALUE The value read from pbe_saltlen was never initialized. Showing all 1 steps of the trace crypto/pkcs12/p12_npas.c:136:16: 134. /* Repack bag in same form with new password */ 135. if (bagnid == NID_pkcs7_data) p7new = PKCS12_pack_p7data(bags); 136. > else p7new = PKCS12_pack_p7encdata(pbe_nid, newpass, -1, NULL, 137. pbe_saltlen, pbe_iter, bags); 138. sk_pop_free(bags, (void(*)(void *)) PKCS12_SAFEBAG_free);
https://github.com/openssl/openssl/blob/0e1c06128adbfd2d88dc304db2262140bad045fd/crypto/pkcs12/p12_npas.c/#L136
d2a_code_trace_data_43224
int dtls1_do_write(SSL *s, int type) { int ret; size_t written; size_t curr_mtu; int retry = 1; size_t len, frag_off, mac_size, blocksize, used_len; if (!dtls1_query_mtu(s)) return -1; if (s->d1->mtu < dtls1_min_mtu(s)) return -1; if (s->init_off == 0 && type == SSL3_RT_HANDSHAKE) OPENSSL_assert(s->init_num == s->d1->w_msg_hdr.msg_len + DTLS1_HM_HEADER_LENGTH); if (s->write_hash) { if (s->enc_write_ctx && (EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(s->enc_write_ctx)) & EVP_CIPH_FLAG_AEAD_CIPHER) != 0) mac_size = 0; else mac_size = EVP_MD_CTX_size(s->write_hash); } else mac_size = 0; if (s->enc_write_ctx && (EVP_CIPHER_CTX_mode(s->enc_write_ctx) == EVP_CIPH_CBC_MODE)) blocksize = 2 * EVP_CIPHER_CTX_block_size(s->enc_write_ctx); else blocksize = 0; frag_off = 0; s->rwstate = SSL_NOTHING; while (s->init_num > 0) { if (type == SSL3_RT_HANDSHAKE && s->init_off != 0) { if (frag_off > 0) { if (s->init_off <= DTLS1_HM_HEADER_LENGTH) { return -1; } s->init_off -= DTLS1_HM_HEADER_LENGTH; s->init_num += DTLS1_HM_HEADER_LENGTH; } else { frag_off = s->d1->w_msg_hdr.frag_off; } } used_len = BIO_wpending(s->wbio) + DTLS1_RT_HEADER_LENGTH + mac_size + blocksize; if (s->d1->mtu > used_len) curr_mtu = s->d1->mtu - used_len; else curr_mtu = 0; if (curr_mtu <= DTLS1_HM_HEADER_LENGTH) { ret = BIO_flush(s->wbio); if (ret <= 0) { s->rwstate = SSL_WRITING; return ret; } used_len = DTLS1_RT_HEADER_LENGTH + mac_size + blocksize; if (s->d1->mtu > used_len + DTLS1_HM_HEADER_LENGTH) { curr_mtu = s->d1->mtu - used_len; } else { return -1; } } if (((unsigned int)s->init_num) > curr_mtu) len = curr_mtu; else len = s->init_num; if (type == SSL3_RT_HANDSHAKE) { if (len < DTLS1_HM_HEADER_LENGTH) { return -1; } dtls1_fix_message_header(s, frag_off, len - DTLS1_HM_HEADER_LENGTH); dtls1_write_message_header(s, (unsigned char *)&s->init_buf-> data[s->init_off]); } ret = dtls1_write_bytes(s, type, &s->init_buf->data[s->init_off], len, &written); if (ret < 0) { if (retry && BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_MTU_EXCEEDED, 0, NULL) > 0) { if (!(SSL_get_options(s) & SSL_OP_NO_QUERY_MTU)) { if (!dtls1_query_mtu(s)) return -1; retry = 0; } else return -1; } else { return (-1); } } else { OPENSSL_assert(len == written); if (type == SSL3_RT_HANDSHAKE && !s->d1->retransmitting) { unsigned char *p = (unsigned char *)&s->init_buf->data[s->init_off]; const struct hm_header_st *msg_hdr = &s->d1->w_msg_hdr; size_t xlen; if (frag_off == 0 && s->version != DTLS1_BAD_VER) { *p++ = msg_hdr->type; l2n3(msg_hdr->msg_len, p); s2n(msg_hdr->seq, p); l2n3(0, p); l2n3(msg_hdr->msg_len, p); p -= DTLS1_HM_HEADER_LENGTH; xlen = written; } else { p += DTLS1_HM_HEADER_LENGTH; xlen = written - DTLS1_HM_HEADER_LENGTH; } if (!ssl3_finish_mac(s, p, xlen)) return -1; } if (written == s->init_num) { if (s->msg_callback) s->msg_callback(1, s->version, type, s->init_buf->data, (size_t)(s->init_off + s->init_num), s, s->msg_callback_arg); s->init_off = 0; s->init_num = 0; return 1; } s->init_off += written; s->init_num -= written; written -= DTLS1_HM_HEADER_LENGTH; frag_off += written; dtls1_fix_message_header(s, frag_off, 0); } } return 0; } ssl/statem/statem_dtls.c:288: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 12):unsigned64. Showing all 4 steps of the trace ssl/statem/statem_dtls.c:110:1: <LHS trace> 108. * SSL3_RT_CHANGE_CIPHER_SPEC) 109. */ 110. > int dtls1_do_write(SSL *s, int type) 111. { 112. int ret; ssl/statem/statem_dtls.c:110:1: Parameter `s->init_num` 108. * SSL3_RT_CHANGE_CIPHER_SPEC) 109. */ 110. > int dtls1_do_write(SSL *s, int type) 111. { 112. int ret; ssl/statem/statem_dtls.c:213:13: Assignment 211. */ 212. if (((unsigned int)s->init_num) > curr_mtu) 213. len = curr_mtu; ^ 214. else 215. len = s->init_num; ssl/statem/statem_dtls.c:288:21: Binary operation: ([0, +oo] - 12):unsigned64 286. } else { 287. p += DTLS1_HM_HEADER_LENGTH; 288. xlen = written - DTLS1_HM_HEADER_LENGTH; ^ 289. } 290.
https://github.com/openssl/openssl/blob/bd79bcb42bab120575fc398692b7b61b1c5e6ed2/ssl/statem/statem_dtls.c/#L288
d2a_code_trace_data_43225
int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) { char *v; int gmt = 0; int i; int y = 0, M = 0, d = 0, h = 0, m = 0, s = 0; char *f = NULL; int f_len = 0; i = tm->length; v = (char *)tm->data; if (i < 12) goto err; if (v[i - 1] == 'Z') gmt = 1; for (i = 0; i < 12; i++) if ((v[i] > '9') || (v[i] < '0')) goto err; y = (v[0] - '0') * 1000 + (v[1] - '0') * 100 + (v[2] - '0') * 10 + (v[3] - '0'); M = (v[4] - '0') * 10 + (v[5] - '0'); if ((M > 12) || (M < 1)) goto err; d = (v[6] - '0') * 10 + (v[7] - '0'); h = (v[8] - '0') * 10 + (v[9] - '0'); m = (v[10] - '0') * 10 + (v[11] - '0'); if (tm->length >= 14 && (v[12] >= '0') && (v[12] <= '9') && (v[13] >= '0') && (v[13] <= '9')) { s = (v[12] - '0') * 10 + (v[13] - '0'); if (tm->length >= 15 && v[14] == '.') { int l = tm->length; f = &v[14]; f_len = 1; while (14 + f_len < l && f[f_len] >= '0' && f[f_len] <= '9') ++f_len; } } if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s", mon[M - 1], d, h, m, s, f_len, f, y, (gmt) ? " GMT" : "") <= 0) return (0); else return (1); err: BIO_write(bp, "Bad time value", 14); return (0); } crypto/ocsp/ocsp_prn.c:237: error: BUFFER_OVERRUN_L3 Offset: [-529, +oo] Size: 12 by call to `ASN1_GENERALIZEDTIME_print`. Showing all 11 steps of the trace crypto/ocsp/ocsp_prn.c:216:16: Call 214. 215. i = ASN1_STRING_length(rb->response); 216. if (!(br = OCSP_response_get1_basic(o))) ^ 217. goto err; 218. rd = br->tbsResponseData; crypto/ocsp/ocsp_cl.c:203:1: Parameter `*resp->responseBytes->response->data` 201. */ 202. 203. > OCSP_BASICRESP *OCSP_response_get1_basic(OCSP_RESPONSE *resp) 204. { 205. OCSP_RESPBYTES *rb; crypto/ocsp/ocsp_prn.c:219:9: Call 217. goto err; 218. rd = br->tbsResponseData; 219. l = ASN1_INTEGER_get(rd->version); ^ 220. if (BIO_printf(bp, "\n Version: %lu (0x%lx)\n", l + 1, l) <= 0) 221. goto err; crypto/asn1/a_int.c:378:1: Parameter `*a->data` 376. } 377. 378. > long ASN1_INTEGER_get(const ASN1_INTEGER *a) 379. { 380. int neg = 0, i; crypto/ocsp/ocsp_prn.c:237:10: Call 235. if (BIO_printf(bp, "\n Produced At: ") <= 0) 236. goto err; 237. if (!ASN1_GENERALIZEDTIME_print(bp, rd->producedAt)) ^ 238. goto err; 239. if (BIO_printf(bp, "\n Responses:\n") <= 0) crypto/asn1/t_x509.c:407:1: <Offset trace> 405. }; 406. 407. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 408. { 409. char *v; crypto/asn1/t_x509.c:407:1: Parameter `*tm->data` 405. }; 406. 407. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 408. { 409. char *v; crypto/asn1/t_x509.c:428:5: Assignment 426. y = (v[0] - '0') * 1000 + (v[1] - '0') * 100 427. + (v[2] - '0') * 10 + (v[3] - '0'); 428. M = (v[4] - '0') * 10 + (v[5] - '0'); ^ 429. if ((M > 12) || (M < 1)) 430. goto err; crypto/asn1/t_x509.c:402:1: <Length trace> 400. } 401. 402. > static const char *mon[12] = { 403. "Jan", "Feb", "Mar", "Apr", "May", "Jun", 404. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" crypto/asn1/t_x509.c:402:1: Array declaration 400. } 401. 402. > static const char *mon[12] = { 403. "Jan", "Feb", "Mar", "Apr", "May", "Jun", 404. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" crypto/asn1/t_x509.c:449:20: Array access: Offset: [-529, +oo] Size: 12 by call to `ASN1_GENERALIZEDTIME_print` 447. 448. if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s", 449. mon[M - 1], d, h, m, s, f_len, f, y, ^ 450. (gmt) ? " GMT" : "") <= 0) 451. return (0);
https://github.com/openssl/openssl/blob/9c46f4b9cd4912b61cb546c48b678488d7f26ed6/crypto/asn1/t_x509.c/#L449
d2a_code_trace_data_43226
static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func, LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg) { int i; LHASH_NODE *a,*n; if (lh == NULL) return; for (i=lh->num_nodes-1; i>=0; i--) { a=lh->b[i]; while (a != NULL) { n=a->next; if(use_arg) func_arg(a->data,arg); else func(a->data); a=n; } } } ssl/ssl_lib.c:582: error: INTEGER_OVERFLOW_L2 ([0, max(0, `s->ctx->sessions->num_nodes`)] - 1):unsigned32 by call to `SSL_CTX_free`. Showing all 11 steps of the trace ssl/ssl_lib.c:499:1: Parameter `s->ctx->sessions->num_nodes` 497. } 498. 499. > void SSL_free(SSL *s) 500. { 501. int i; ssl/ssl_lib.c:582:14: Call 580. if (s->method != NULL) s->method->ssl_free(s); 581. 582. if (s->ctx) SSL_CTX_free(s->ctx); ^ 583. 584. #ifndef OPENSSL_NO_KRB5 ssl/ssl_lib.c:1665:1: Parameter `a->sessions->num_nodes` 1663. #endif 1664. 1665. > void SSL_CTX_free(SSL_CTX *a) 1666. { 1667. int i; ssl/ssl_lib.c:1697:3: Call 1695. */ 1696. if (a->sessions != NULL) 1697. SSL_CTX_flush_sessions(a,0); ^ 1698. 1699. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:921:1: Parameter `s->sessions->num_nodes` 919. static IMPLEMENT_LHASH_DOALL_ARG_FN(timeout, SSL_SESSION, TIMEOUT_PARAM) 920. 921. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 922. { 923. unsigned long i; ssl/ssl_sess.c:933:2: Call 931. i=CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load; 932. CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load=0; 933. lh_SSL_SESSION_doall_arg(tp.cache, LHASH_DOALL_ARG_FN(timeout), ^ 934. TIMEOUT_PARAM, &tp); 935. CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load=i; crypto/lhash/lhash.c:305:1: Parameter `lh->num_nodes` 303. } 304. 305. > void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg) 306. { 307. doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg); crypto/lhash/lhash.c:307:2: Call 305. void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg) 306. { 307. doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg); ^ 308. } 309. crypto/lhash/lhash.c:270:1: <LHS trace> 268. } 269. 270. > static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func, 271. LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg) 272. { crypto/lhash/lhash.c:270:1: Parameter `lh->num_nodes` 268. } 269. 270. > static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func, 271. LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg) 272. { crypto/lhash/lhash.c:281:7: Binary operation: ([0, max(0, s->ctx->sessions->num_nodes)] - 1):unsigned32 by call to `SSL_CTX_free` 279. /* reverse the order so we search from 'top to bottom' 280. * We were having memory leaks otherwise */ 281. for (i=lh->num_nodes-1; i>=0; i--) ^ 282. { 283. a=lh->b[i];
https://github.com/openssl/openssl/blob/7c3908dd191e1e5178a42069f15ceec17708c329/crypto/lhash/lhash.c/#L281
d2a_code_trace_data_43227
static ossl_inline void packet_forward(PACKET *pkt, size_t len) { pkt->curr += len; pkt->remaining -= len; } ssl/t1_lib.c:1849: error: INTEGER_OVERFLOW_L2 ([2, +oo] - 18):unsigned64 by call to `PACKET_get_bytes`. Showing all 9 steps of the trace ssl/t1_lib.c:1846:9: Assignment 1844. 1845. if (TLS1_get_client_version(s) >= TLS1_2_VERSION) { 1846. const size_t len1 = sizeof(kSafariExtensionsBlock); ^ 1847. const size_t len2 = sizeof(kSafariTLS12ExtensionsBlock); 1848. ssl/t1_lib.c:1849:14: Call 1847. const size_t len2 = sizeof(kSafariTLS12ExtensionsBlock); 1848. 1849. if (!PACKET_get_bytes(&tmppkt, &eblock1, len1) ^ 1850. || !PACKET_get_bytes(&tmppkt, &eblock2, len2) 1851. || PACKET_remaining(&tmppkt)) ssl/packet_locl.h:344:8: Parameter `len` 342. * freed 343. */ 344. __owur static ossl_inline int PACKET_get_bytes(PACKET *pkt, ^ 345. const unsigned char **data, 346. size_t len) ssl/packet_locl.h:351:5: Call 349. return 0; 350. 351. packet_forward(pkt, len); ^ 352. 353. return 1; ssl/packet_locl.h:81:1: <LHS trace> 79. 80. /* Internal unchecked shorthand; don't use outside this file. */ 81. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 82. { 83. pkt->curr += len; ssl/packet_locl.h:81:1: Parameter `pkt->remaining` 79. 80. /* Internal unchecked shorthand; don't use outside this file. */ 81. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 82. { 83. pkt->curr += len; ssl/packet_locl.h:81:1: <RHS trace> 79. 80. /* Internal unchecked shorthand; don't use outside this file. */ 81. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 82. { 83. pkt->curr += len; ssl/packet_locl.h:81:1: Parameter `len` 79. 80. /* Internal unchecked shorthand; don't use outside this file. */ 81. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 82. { 83. pkt->curr += len; ssl/packet_locl.h:84:5: Binary operation: ([2, +oo] - 18):unsigned64 by call to `PACKET_get_bytes` 82. { 83. pkt->curr += len; 84. pkt->remaining -= len; ^ 85. } 86.
https://github.com/openssl/openssl/blob/d6c2587967f93f2f9c226bda9139ae427698f20f/ssl/packet_locl.h/#L84
d2a_code_trace_data_43228
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ecdsa/ecs_ossl.c:404: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_inverse`. Showing all 20 steps of the trace crypto/ecdsa/ecs_ossl.c:377:2: Call 375. return -1; 376. } 377. BN_CTX_start(ctx); ^ 378. order = BN_CTX_get(ctx); 379. u1 = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/ecdsa/ecs_ossl.c:404:7: Call 402. } 403. /* calculate tmp1 = inv(S) mod order */ 404. if (!BN_mod_inverse(u2, sig->s, order, ctx)) ^ 405. { 406. ECDSAerr(ECDSA_F_ECDSA_DO_VERIFY, ERR_R_BN_LIB); crypto/bn/bn_gcd.c:209:1: Parameter `ctx->stack.depth` 207. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); 208. 209. > BIGNUM *BN_mod_inverse(BIGNUM *in, 210. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 211. { crypto/bn/bn_gcd.c:218:10: Call 216. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) 217. { 218. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 219. } 220. crypto/bn/bn_gcd.c:507:1: Parameter `ctx->stack.depth` 505. * It does not contain branches that may leak sensitive information. 506. */ 507. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 508. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 509. { crypto/bn/bn_gcd.c:519:2: Call 517. bn_check_top(n); 518. 519. BN_CTX_start(ctx); ^ 520. A = BN_CTX_get(ctx); 521. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gcd.c:548:8: Call 546. pB = &local_B; 547. BN_with_flags(pB, B, BN_FLG_CONSTTIME); 548. if (!BN_nnmod(B, pB, A, ctx)) goto err; ^ 549. } 550. sign = -1; crypto/bn/bn_mod.c:127:1: Parameter `ctx->stack.depth` 125. 126. 127. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 128. { 129. /* like BN_mod, but returns non-negative remainder crypto/bn/bn_mod.c:132:8: Call 130. * (i.e., 0 <= r < |d| always holds) */ 131. 132. if (!(BN_mod(r,m,d,ctx))) ^ 133. return 0; 134. if (!r->neg) crypto/bn/bn_div.c:181:1: Parameter `ctx->stack.depth` 179. * If 'dv' or 'rm' is NULL, the respective value is not returned. 180. */ 181. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 182. BN_CTX *ctx) 183. { crypto/bn/bn_div.c:226:2: Call 224. } 225. 226. BN_CTX_start(ctx); ^ 227. tmp=BN_CTX_get(ctx); 228. snum=BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:441:2: Call 439. } 440. if (no_branch) bn_correct_top(res); 441. BN_CTX_end(ctx); ^ 442. return(1); 443. err: crypto/bn/bn_ctx.c:270:1: Parameter `ctx->stack.depth` 268. } 269. 270. > void BN_CTX_end(BN_CTX *ctx) 271. { 272. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:277:21: Call 275. else 276. { 277. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 278. /* Does this stack frame have anything to release? */ 279. if(fp < ctx->used) crypto/bn/bn_ctx.c:351:1: <LHS trace> 349. } 350. 351. > static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:351:1: Parameter `st->depth` 349. } 350. 351. > static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:353:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_inverse` 351. static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; ^ 354. } 355.
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/bn/bn_ctx.c/#L353
d2a_code_trace_data_43229
static void do_video_stats(AVFormatContext *os, AVOutputStream *ost, int frame_size) { AVCodecContext *enc; int frame_number; double ti1, bitrate, avg_bitrate; if (!vstats_file) { vstats_file = fopen(vstats_filename, "w"); if (!vstats_file) { perror("fopen"); ffmpeg_exit(1); } } enc = ost->st->codec; if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { frame_number = ost->frame_number; fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA); if (enc->flags&CODEC_FLAG_PSNR) fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0]/(enc->width*enc->height*255.0*255.0))); fprintf(vstats_file,"f_size= %6d ", frame_size); ti1 = ost->sync_opts * av_q2d(enc->time_base); if (ti1 < 0.01) ti1 = 0.01; bitrate = (frame_size * 8) / av_q2d(enc->time_base) / 1000.0; avg_bitrate = (double)(video_size * 8) / ti1 / 1000.0; fprintf(vstats_file, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ", (double)video_size / 1024, ti1, bitrate, avg_bitrate); fprintf(vstats_file, "type= %c\n", av_get_picture_type_char(enc->coded_frame->pict_type)); } } ffmpeg.c:1270: error: Null Dereference pointer `vstats_file` last assigned on line 1260 could be null and is dereferenced by call to `fprintf()` at line 1270, column 9. ffmpeg.c:1251:1: start of procedure do_video_stats() 1249. } 1250. 1251. static void do_video_stats(AVFormatContext *os, AVOutputStream *ost, ^ 1252. int frame_size) 1253. { ffmpeg.c:1259:10: Taking true branch 1257. 1258. /* this is executed just the first time do_video_stats is called */ 1259. if (!vstats_file) { ^ 1260. vstats_file = fopen(vstats_filename, "w"); 1261. if (!vstats_file) { ffmpeg.c:1260:9: 1258. /* this is executed just the first time do_video_stats is called */ 1259. if (!vstats_file) { 1260. vstats_file = fopen(vstats_filename, "w"); ^ 1261. if (!vstats_file) { 1262. perror("fopen"); ffmpeg.c:1261:14: Taking true branch 1259. if (!vstats_file) { 1260. vstats_file = fopen(vstats_filename, "w"); 1261. if (!vstats_file) { ^ 1262. perror("fopen"); 1263. ffmpeg_exit(1); ffmpeg.c:1262:13: 1260. vstats_file = fopen(vstats_filename, "w"); 1261. if (!vstats_file) { 1262. perror("fopen"); ^ 1263. ffmpeg_exit(1); 1264. } ffmpeg.c:1263:13: Skipping ffmpeg_exit(): empty list of specs 1261. if (!vstats_file) { 1262. perror("fopen"); 1263. ffmpeg_exit(1); ^ 1264. } 1265. } ffmpeg.c:1267:5: 1265. } 1266. 1267. enc = ost->st->codec; ^ 1268. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { 1269. frame_number = ost->frame_number; ffmpeg.c:1268:9: Taking true branch 1266. 1267. enc = ost->st->codec; 1268. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { ^ 1269. frame_number = ost->frame_number; 1270. fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA); ffmpeg.c:1269:9: 1267. enc = ost->st->codec; 1268. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { 1269. frame_number = ost->frame_number; ^ 1270. fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA); 1271. if (enc->flags&CODEC_FLAG_PSNR) ffmpeg.c:1270:9: 1268. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { 1269. frame_number = ost->frame_number; 1270. fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA); ^ 1271. if (enc->flags&CODEC_FLAG_PSNR) 1272. fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0]/(enc->width*enc->height*255.0*255.0)));
https://github.com/libav/libav/blob/b568d6d94bda607e4ebb35be68181a8c2a9f5c50/ffmpeg.c/#L1270
d2a_code_trace_data_43230
void avfilter_unref_buffer(AVFilterBufferRef *ref) { if(!(--ref->buf->refcount)) ref->buf->free(ref->buf); av_free(ref->video); av_free(ref); } libavfilter/vf_pad.c:266: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer`. libavfilter/vf_pad.c:266:5: Call 264. { 265. avfilter_end_frame(link->dst->outputs[0]); 266. avfilter_unref_buffer(link->cur_buf); ^ 267. } 268. libavfilter/avfilter.c:61:1: <LHS trace> 59. } 60. 61. void avfilter_unref_buffer(AVFilterBufferRef *ref) ^ 62. { 63. if(!(--ref->buf->refcount)) libavfilter/avfilter.c:61:1: Parameter `ref->buf->refcount` 59. } 60. 61. void avfilter_unref_buffer(AVFilterBufferRef *ref) ^ 62. { 63. if(!(--ref->buf->refcount)) libavfilter/avfilter.c:63:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer` 61. void avfilter_unref_buffer(AVFilterBufferRef *ref) 62. { 63. if(!(--ref->buf->refcount)) ^ 64. ref->buf->free(ref->buf); 65. av_free(ref->video);
https://github.com/libav/libav/blob/ad0d70c964f852a18e9ab8124f0e7aa8876cac6e/libavfilter/avfilter.c/#L63
d2a_code_trace_data_43231
int ssl3_get_cert_verify(SSL *s) { EVP_PKEY *pkey=NULL; unsigned char *p; int al,ok,ret=0; long n; int type=0,i,j; X509 *peer; const EVP_MD *md = NULL; EVP_MD_CTX mctx; EVP_MD_CTX_init(&mctx); n=s->method->ssl_get_message(s, SSL3_ST_SR_CERT_VRFY_A, SSL3_ST_SR_CERT_VRFY_B, -1, 516, &ok); if (!ok) return((int)n); if (s->session->peer != NULL) { peer=s->session->peer; pkey=X509_get_pubkey(peer); type=X509_certificate_type(peer,pkey); } else { peer=NULL; pkey=NULL; } if (s->s3->tmp.message_type != SSL3_MT_CERTIFICATE_VERIFY) { s->s3->tmp.reuse_message=1; if ((peer != NULL) && (type & EVP_PKT_SIGN)) { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_MISSING_VERIFY_MESSAGE); goto f_err; } ret=1; goto end; } if (peer == NULL) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_NO_CLIENT_CERT_RECEIVED); al=SSL_AD_UNEXPECTED_MESSAGE; goto f_err; } if (!(type & EVP_PKT_SIGN)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE); al=SSL_AD_ILLEGAL_PARAMETER; goto f_err; } if (s->s3->change_cipher_spec) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_CCS_RECEIVED_EARLY); al=SSL_AD_UNEXPECTED_MESSAGE; goto f_err; } p=(unsigned char *)s->init_msg; if (n==64 && (pkey->type==NID_id_GostR3410_94 || pkey->type == NID_id_GostR3410_2001) ) { i=64; } else { if (SSL_USE_SIGALGS(s)) { int rv = tls12_check_peer_sigalg(&md, s, p, pkey); if (rv == -1) { al = SSL_AD_INTERNAL_ERROR; goto f_err; } else if (rv == 0) { al = SSL_AD_DECODE_ERROR; goto f_err; } #ifdef SSL_DEBUG fprintf(stderr, "USING TLSv1.2 HASH %s\n", EVP_MD_name(md)); #endif p += 2; n -= 2; } n2s(p,i); n-=2; if (i > n) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_LENGTH_MISMATCH); al=SSL_AD_DECODE_ERROR; goto f_err; } } j=EVP_PKEY_size(pkey); if ((i > j) || (n > j) || (n <= 0)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_WRONG_SIGNATURE_SIZE); al=SSL_AD_DECODE_ERROR; goto f_err; } if (SSL_USE_SIGALGS(s)) { long hdatalen = 0; void *hdata; hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata); if (hdatalen <= 0) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR); al=SSL_AD_INTERNAL_ERROR; goto f_err; } #ifdef SSL_DEBUG fprintf(stderr, "Using TLS 1.2 with client verify alg %s\n", EVP_MD_name(md)); #endif if (!EVP_VerifyInit_ex(&mctx, md, NULL) || !EVP_VerifyUpdate(&mctx, hdata, hdatalen)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_EVP_LIB); al=SSL_AD_INTERNAL_ERROR; goto f_err; } if (EVP_VerifyFinal(&mctx, p , i, pkey) <= 0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_SIGNATURE); goto f_err; } } else #ifndef OPENSSL_NO_RSA if (pkey->type == EVP_PKEY_RSA) { i=RSA_verify(NID_md5_sha1, s->s3->tmp.cert_verify_md, MD5_DIGEST_LENGTH+SHA_DIGEST_LENGTH, p, i, pkey->pkey.rsa); if (i < 0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_RSA_DECRYPT); goto f_err; } if (i == 0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_RSA_SIGNATURE); goto f_err; } } else #endif #ifndef OPENSSL_NO_DSA if (pkey->type == EVP_PKEY_DSA) { j=DSA_verify(pkey->save_type, &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]), SHA_DIGEST_LENGTH,p,i,pkey->pkey.dsa); if (j <= 0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_DSA_SIGNATURE); goto f_err; } } else #endif #ifndef OPENSSL_NO_ECDSA if (pkey->type == EVP_PKEY_EC) { j=ECDSA_verify(pkey->save_type, &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]), SHA_DIGEST_LENGTH,p,i,pkey->pkey.ec); if (j <= 0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE); goto f_err; } } else #endif if (pkey->type == NID_id_GostR3410_94 || pkey->type == NID_id_GostR3410_2001) { unsigned char signature[64]; int idx; EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new(pkey,NULL); EVP_PKEY_verify_init(pctx); if (i!=64) { fprintf(stderr,"GOST signature length is %d",i); } for (idx=0;idx<64;idx++) { signature[63-idx]=p[idx]; } j=EVP_PKEY_verify(pctx,signature,64,s->s3->tmp.cert_verify_md,32); EVP_PKEY_CTX_free(pctx); if (j<=0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE); goto f_err; } } else { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,ERR_R_INTERNAL_ERROR); al=SSL_AD_UNSUPPORTED_CERTIFICATE; goto f_err; } ret=1; if (0) { f_err: ssl3_send_alert(s,SSL3_AL_FATAL,al); } end: if (s->s3->handshake_buffer) { BIO_free(s->s3->handshake_buffer); s->s3->handshake_buffer = NULL; s->s3->flags &= ~TLS1_FLAGS_KEEP_HANDSHAKE; } EVP_MD_CTX_cleanup(&mctx); EVP_PKEY_free(pkey); return(ret); } ssl/s3_srvr.c:3109: error: NULL_DEREFERENCE pointer `pkey` last assigned on line 3061 could be null and is dereferenced at line 3109, column 16. Showing all 27 steps of the trace ssl/s3_srvr.c:3037:1: start of procedure ssl3_get_cert_verify() 3035. } 3036. 3037. > int ssl3_get_cert_verify(SSL *s) 3038. { 3039. EVP_PKEY *pkey=NULL; ssl/s3_srvr.c:3039:2: 3037. int ssl3_get_cert_verify(SSL *s) 3038. { 3039. > EVP_PKEY *pkey=NULL; 3040. unsigned char *p; 3041. int al,ok,ret=0; ssl/s3_srvr.c:3041:2: 3039. EVP_PKEY *pkey=NULL; 3040. unsigned char *p; 3041. > int al,ok,ret=0; 3042. long n; 3043. int type=0,i,j; ssl/s3_srvr.c:3043:2: 3041. int al,ok,ret=0; 3042. long n; 3043. > int type=0,i,j; 3044. X509 *peer; 3045. const EVP_MD *md = NULL; ssl/s3_srvr.c:3045:2: 3043. int type=0,i,j; 3044. X509 *peer; 3045. > const EVP_MD *md = NULL; 3046. EVP_MD_CTX mctx; 3047. EVP_MD_CTX_init(&mctx); ssl/s3_srvr.c:3047:2: 3045. const EVP_MD *md = NULL; 3046. EVP_MD_CTX mctx; 3047. > EVP_MD_CTX_init(&mctx); 3048. 3049. n=s->method->ssl_get_message(s, crypto/evp/digest.c:120:1: start of procedure EVP_MD_CTX_init() 118. #endif 119. 120. > void EVP_MD_CTX_init(EVP_MD_CTX *ctx) 121. { 122. memset(ctx,'\0',sizeof *ctx); crypto/evp/digest.c:122:2: 120. void EVP_MD_CTX_init(EVP_MD_CTX *ctx) 121. { 122. > memset(ctx,'\0',sizeof *ctx); 123. } 124. crypto/evp/digest.c:123:2: return from a call to EVP_MD_CTX_init 121. { 122. memset(ctx,'\0',sizeof *ctx); 123. } ^ 124. 125. EVP_MD_CTX *EVP_MD_CTX_create(void) ssl/s3_srvr.c:3049:2: Skipping __function_pointer__(): unresolved function pointer 3047. EVP_MD_CTX_init(&mctx); 3048. 3049. n=s->method->ssl_get_message(s, ^ 3050. SSL3_ST_SR_CERT_VRFY_A, 3051. SSL3_ST_SR_CERT_VRFY_B, ssl/s3_srvr.c:3056:7: Taking false branch 3054. &ok); 3055. 3056. if (!ok) return((int)n); ^ 3057. 3058. if (s->session->peer != NULL) ssl/s3_srvr.c:3058:6: Taking true branch 3056. if (!ok) return((int)n); 3057. 3058. if (s->session->peer != NULL) ^ 3059. { 3060. peer=s->session->peer; ssl/s3_srvr.c:3060:3: 3058. if (s->session->peer != NULL) 3059. { 3060. > peer=s->session->peer; 3061. pkey=X509_get_pubkey(peer); 3062. type=X509_certificate_type(peer,pkey); ssl/s3_srvr.c:3061:3: 3059. { 3060. peer=s->session->peer; 3061. > pkey=X509_get_pubkey(peer); 3062. type=X509_certificate_type(peer,pkey); 3063. } crypto/x509/x509_cmp.c:313:1: start of procedure X509_get_pubkey() 311. } 312. 313. > EVP_PKEY *X509_get_pubkey(X509 *x) 314. { 315. if ((x == NULL) || (x->cert_info == NULL)) crypto/x509/x509_cmp.c:315:7: Taking false branch 313. EVP_PKEY *X509_get_pubkey(X509 *x) 314. { 315. if ((x == NULL) || (x->cert_info == NULL)) ^ 316. return(NULL); 317. return(X509_PUBKEY_get(x->cert_info->key)); crypto/x509/x509_cmp.c:315:22: Taking true branch 313. EVP_PKEY *X509_get_pubkey(X509 *x) 314. { 315. if ((x == NULL) || (x->cert_info == NULL)) ^ 316. return(NULL); 317. return(X509_PUBKEY_get(x->cert_info->key)); crypto/x509/x509_cmp.c:316:3: 314. { 315. if ((x == NULL) || (x->cert_info == NULL)) 316. > return(NULL); 317. return(X509_PUBKEY_get(x->cert_info->key)); 318. } crypto/x509/x509_cmp.c:318:2: return from a call to X509_get_pubkey 316. return(NULL); 317. return(X509_PUBKEY_get(x->cert_info->key)); 318. } ^ 319. 320. ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x) ssl/s3_srvr.c:3062:3: Skipping X509_certificate_type(): empty list of specs 3060. peer=s->session->peer; 3061. pkey=X509_get_pubkey(peer); 3062. type=X509_certificate_type(peer,pkey); ^ 3063. } 3064. else ssl/s3_srvr.c:3070:6: Taking false branch 3068. } 3069. 3070. if (s->s3->tmp.message_type != SSL3_MT_CERTIFICATE_VERIFY) ^ 3071. { 3072. s->s3->tmp.reuse_message=1; ssl/s3_srvr.c:3083:6: Taking false branch 3081. } 3082. 3083. if (peer == NULL) ^ 3084. { 3085. SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_NO_CLIENT_CERT_RECEIVED); ssl/s3_srvr.c:3090:8: Taking false branch 3088. } 3089. 3090. if (!(type & EVP_PKT_SIGN)) ^ 3091. { 3092. SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE); ssl/s3_srvr.c:3097:6: Taking false branch 3095. } 3096. 3097. if (s->s3->change_cipher_spec) ^ 3098. { 3099. SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_CCS_RECEIVED_EARLY); ssl/s3_srvr.c:3105:2: 3103. 3104. /* we now have a signature that we need to verify */ 3105. > p=(unsigned char *)s->init_msg; 3106. /* Check for broken implementations of GOST ciphersuites */ 3107. /* If key is GOST and n is exactly 64, it is bare ssl/s3_srvr.c:3109:6: Taking true branch 3107. /* If key is GOST and n is exactly 64, it is bare 3108. * signature without length field */ 3109. if (n==64 && (pkey->type==NID_id_GostR3410_94 || ^ 3110. pkey->type == NID_id_GostR3410_2001) ) 3111. { ssl/s3_srvr.c:3109:16: 3107. /* If key is GOST and n is exactly 64, it is bare 3108. * signature without length field */ 3109. > if (n==64 && (pkey->type==NID_id_GostR3410_94 || 3110. pkey->type == NID_id_GostR3410_2001) ) 3111. {
https://github.com/openssl/openssl/blob/cbb67448277232c8403f96edad4931c4203e7746/ssl/s3_srvr.c/#L3109
d2a_code_trace_data_43232
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) { int i, j, max; const BN_ULONG *ap; BN_ULONG *rp; max = n * 2; ap = a; rp = r; rp[0] = rp[max - 1] = 0; rp++; j = n; if (--j > 0) { ap++; rp[j] = bn_mul_words(rp, ap, j, ap[-1]); rp += 2; } for (i = n - 2; i > 0; i--) { j--; ap++; rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]); rp += 2; } bn_add_words(r, r, r, max); bn_sqr_words(tmp, a, n); bn_add_words(r, r, tmp, max); } test/srptest.c:150: error: BUFFER_OVERRUN_L3 Offset: [31, +oo] Size: [0, 8388607] by call to `SRP_create_verifier_BN`. Showing all 23 steps of the trace test/srptest.c:150:10: Call 148. BN_hex2bn(&s, "BEB25379D1A8581EB5A727673A2441EE"); 149. /* Set up server's password entry */ 150. if (!TEST_true(SRP_create_verifier_BN("alice", "password123", &s, &v, GN->N, ^ 151. GN->g))) 152. goto err; crypto/srp/srp_vfy.c:633:1: Parameter `g->top` 631. * BIGNUMS. 632. */ 633. > int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, 634. BIGNUM **verifier, const BIGNUM *N, 635. const BIGNUM *g) crypto/srp/srp_vfy.c:664:10: Call 662. goto err; 663. 664. if (!BN_mod_exp(*verifier, g, x, N, bn_ctx)) { ^ 665. BN_clear_free(*verifier); 666. goto err; crypto/bn/bn_exp.c:91:1: Parameter `a->top` 89. } 90. 91. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 92. BN_CTX *ctx) 93. { crypto/bn/bn_exp.c:144:19: Call 142. } else 143. # endif 144. ret = BN_mod_exp_mont(r, a, p, m, ctx, NULL); ^ 145. } else 146. #endif crypto/bn/bn_exp.c:294:1: Parameter `a->top` 292. } 293. 294. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 295. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 296. { crypto/bn/bn_exp.c:306:16: Call 304. 305. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { 306. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 307. } 308. crypto/bn/bn_exp.c:594:1: Parameter `a->top` 592. * http://www.daemonology.net/hyperthreading-considered-harmful/) 593. */ 594. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 595. const BIGNUM *m, BN_CTX *ctx, 596. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:751:17: Call 749. if (!BN_to_montgomery(&am, &am, mont, ctx)) 750. goto err; 751. } else if (!BN_to_montgomery(&am, a, mont, ctx)) ^ 752. goto err; 753. crypto/bn/bn_lib.c:877:1: Parameter `a->top` 875. } 876. 877. > int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 878. BN_CTX *ctx) 879. { crypto/bn/bn_lib.c:880:12: Call 878. BN_CTX *ctx) 879. { 880. return BN_mod_mul_montgomery(r, a, &(mont->RR), mont, ctx); ^ 881. } 882. crypto/bn/bn_mont.c:26:1: Parameter `a->top` 24. #endif 25. 26. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 27. BN_MONT_CTX *mont, BN_CTX *ctx) 28. { crypto/bn/bn_mont.c:53:14: Call 51. bn_check_top(tmp); 52. if (a == b) { 53. if (!BN_sqr(tmp, a, ctx)) ^ 54. goto err; 55. } else { crypto/bn/bn_sqr.c:17:1: Parameter `a->top` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int max, al; crypto/bn/bn_sqr.c:25:5: Assignment 23. bn_check_top(a); 24. 25. al = a->top; ^ 26. if (al <= 0) { 27. r->top = 0; crypto/bn/bn_sqr.c:74:17: Call 72. if (bn_wexpand(tmp, max) == NULL) 73. goto err; 74. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 75. } 76. } crypto/bn/bn_sqr.c:105:1: <Offset trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `n` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:111:5: Assignment 109. BN_ULONG *rp; 110. 111. max = n * 2; ^ 112. ap = a; 113. rp = r; crypto/bn/bn_sqr.c:105:1: <Length trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `*r` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:113:5: Assignment 111. max = n * 2; 112. ap = a; 113. rp = r; ^ 114. rp[0] = rp[max - 1] = 0; 115. rp++; crypto/bn/bn_sqr.c:114:13: Array access: Offset: [31, +oo] Size: [0, 8388607] by call to `SRP_create_verifier_BN` 112. ap = a; 113. rp = r; 114. rp[0] = rp[max - 1] = 0; ^ 115. rp++; 116. j = n;
https://github.com/openssl/openssl/blob/6ea3bca427b3e759939a63555821d0c4678dd79c/crypto/bn/bn_sqr.c/#L114
d2a_code_trace_data_43233
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } engines/ccgost/gost2001.c:226: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_mul`. Showing all 20 steps of the trace engines/ccgost/gost2001.c:225:4: Call 223. #endif 224. if (BN_is_zero(e)) BN_one(e); 225. v=BN_mod_inverse(v,e,order,ctx); ^ 226. BN_mod_mul(z1,sig->s,v,order,ctx); 227. BN_sub(tmp,order,sig->r); crypto/bn/bn_gcd.c:209:1: Parameter `ctx->stack.depth` 207. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); 208. 209. > BIGNUM *BN_mod_inverse(BIGNUM *in, 210. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 211. { crypto/bn/bn_gcd.c:224:2: Call 222. bn_check_top(n); 223. 224. BN_CTX_start(ctx); ^ 225. A = BN_CTX_get(ctx); 226. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gcd.c:498:2: Call 496. err: 497. if ((ret == NULL) && (in == NULL)) BN_free(R); 498. BN_CTX_end(ctx); ^ 499. bn_check_top(ret); 500. return(ret); crypto/bn/bn_ctx.c:270:1: Parameter `ctx->stack.depth` 268. } 269. 270. > void BN_CTX_end(BN_CTX *ctx) 271. { 272. CTXDBG_ENTRY("BN_CTX_end", ctx); engines/ccgost/gost2001.c:226:2: Call 224. if (BN_is_zero(e)) BN_one(e); 225. v=BN_mod_inverse(v,e,order,ctx); 226. BN_mod_mul(z1,sig->s,v,order,ctx); ^ 227. BN_sub(tmp,order,sig->r); 228. BN_mod_mul(z2,tmp,v,order,ctx); crypto/bn/bn_mod.c:178:1: Parameter `ctx->stack.depth` 176. 177. /* slow but works */ 178. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 179. BN_CTX *ctx) 180. { crypto/bn/bn_mod.c:188:2: Call 186. bn_check_top(m); 187. 188. BN_CTX_start(ctx); ^ 189. if ((t = BN_CTX_get(ctx)) == NULL) goto err; 190. if (a == b) crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mod.c:193:10: Call 191. { if (!BN_sqr(t,a,ctx)) goto err; } 192. else 193. { if (!BN_mul(t,a,b,ctx)) goto err; } ^ 194. if (!BN_nnmod(r,t,m,ctx)) goto err; 195. bn_check_top(r); crypto/bn/bn_mul.c:943:1: Parameter `ctx->stack.depth` 941. #endif /* BN_RECURSION */ 942. 943. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 944. { 945. int ret=0; crypto/bn/bn_mul.c:974:2: Call 972. top=al+bl; 973. 974. BN_CTX_start(ctx); ^ 975. if ((r == a) || (r == b)) 976. { crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mul.c:1100:2: Call 1098. err: 1099. bn_check_top(r); 1100. BN_CTX_end(ctx); ^ 1101. return(ret); 1102. } crypto/bn/bn_ctx.c:270:1: Parameter `ctx->stack.depth` 268. } 269. 270. > void BN_CTX_end(BN_CTX *ctx) 271. { 272. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:277:21: Call 275. else 276. { 277. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 278. /* Does this stack frame have anything to release? */ 279. if(fp < ctx->used) crypto/bn/bn_ctx.c:351:1: <LHS trace> 349. } 350. 351. > static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:351:1: Parameter `st->depth` 349. } 350. 351. > static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:353:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_mul` 351. static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; ^ 354. } 355.
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/bn/bn_ctx.c/#L353
d2a_code_trace_data_43234
static void png_filter_row(DSPContext *dsp, uint8_t *dst, int filter_type, uint8_t *src, uint8_t *last, int size, int bpp) { int i, p, r, g, b, a; switch(filter_type) { case PNG_FILTER_VALUE_NONE: memcpy(dst, src, size); break; case PNG_FILTER_VALUE_SUB: for(i = 0; i < bpp; i++) { dst[i] = src[i]; } if(bpp == 4) { p = *(int*)dst; for(; i < size; i+=bpp) { int s = *(int*)(src+i); p = ((s&0x7f7f7f7f) + (p&0x7f7f7f7f)) ^ ((s^p)&0x80808080); *(int*)(dst+i) = p; } } else { #define OP_SUB(x,s,l) x+s UNROLL_FILTER(OP_SUB); } break; case PNG_FILTER_VALUE_UP: dsp->add_bytes_l2(dst, src, last, size); break; case PNG_FILTER_VALUE_AVG: for(i = 0; i < bpp; i++) { p = (last[i] >> 1); dst[i] = p + src[i]; } #define OP_AVG(x,s,l) (((x + l) >> 1) + s) & 0xff UNROLL_FILTER(OP_AVG); break; case PNG_FILTER_VALUE_PAETH: for(i = 0; i < bpp; i++) { p = last[i]; dst[i] = p + src[i]; } if(bpp > 1 && size > 4) { int w = bpp==4 ? size : size-3; dsp->add_png_paeth_prediction(dst+i, src+i, last+i, w-i, bpp); i = w; } ff_add_png_paeth_prediction(dst+i, src+i, last+i, size-i, bpp); break; } } libavcodec/pngdec.c:530: error: Integer Overflow L2 ([0, 2139062143] + [0, 2139062143]):signed32 by call to `png_decode_idat`. libavcodec/pngdec.c:406:11: Unknown value from: inflateInit_ 404. s->zstream.zfree = ff_png_zfree; 405. s->zstream.opaque = NULL; 406. ret = inflateInit(&s->zstream); ^ 407. if (ret != Z_OK) 408. return -1; libavcodec/pngdec.c:530:17: Call 528. } 529. s->state |= PNG_IDAT; 530. if (png_decode_idat(s, length) < 0) ^ 531. goto fail; 532. /* skip crc */ libavcodec/pngdec.c:353:1: Parameter `*s->crow_buf` 351. } 352. 353. static int png_decode_idat(PNGDecContext *s, int length) ^ 354. { 355. int ret; libavcodec/pngdec.c:371:17: Call 369. if (s->zstream.avail_out == 0) { 370. if (!(s->state & PNG_ALLIMAGE)) { 371. png_handle_row(s); ^ 372. } 373. s->zstream.avail_out = s->crow_size; libavcodec/pngdec.c:276:1: Parameter `*s->crow_buf` 274. 275. /* process exactly one decompressed row */ 276. static void png_handle_row(PNGDecContext *s) ^ 277. { 278. uint8_t *ptr, *last_row; libavcodec/pngdec.c:285:13: Call 283. /* need to swap bytes correctly for RGB_ALPHA */ 284. if (s->color_type == PNG_COLOR_TYPE_RGB_ALPHA) { 285. png_filter_row(&s->dsp, s->tmp_row, s->crow_buf[0], s->crow_buf + 1, ^ 286. s->last_row, s->row_size, s->bpp); 287. convert_to_rgb32(ptr, s->tmp_row, s->width, s->filter_type == PNG_FILTER_TYPE_LOCO); libavcodec/pngdec.c:185:1: <LHS trace> 183. 184. /* NOTE: 'dst' can be equal to 'last' */ 185. static void png_filter_row(DSPContext *dsp, uint8_t *dst, int filter_type, ^ 186. uint8_t *src, uint8_t *last, int size, int bpp) 187. { libavcodec/pngdec.c:185:1: Parameter `*src` 183. 184. /* NOTE: 'dst' can be equal to 'last' */ 185. static void png_filter_row(DSPContext *dsp, uint8_t *dst, int filter_type, ^ 186. uint8_t *src, uint8_t *last, int size, int bpp) 187. { libavcodec/pngdec.c:201:17: Assignment 199. p = *(int*)dst; 200. for(; i < size; i+=bpp) { 201. int s = *(int*)(src+i); ^ 202. p = ((s&0x7f7f7f7f) + (p&0x7f7f7f7f)) ^ ((s^p)&0x80808080); 203. *(int*)(dst+i) = p; libavcodec/pngdec.c:185:1: <RHS trace> 183. 184. /* NOTE: 'dst' can be equal to 'last' */ 185. static void png_filter_row(DSPContext *dsp, uint8_t *dst, int filter_type, ^ 186. uint8_t *src, uint8_t *last, int size, int bpp) 187. { libavcodec/pngdec.c:185:1: Parameter `*dst` 183. 184. /* NOTE: 'dst' can be equal to 'last' */ 185. static void png_filter_row(DSPContext *dsp, uint8_t *dst, int filter_type, ^ 186. uint8_t *src, uint8_t *last, int size, int bpp) 187. { libavcodec/pngdec.c:199:13: Assignment 197. } 198. if(bpp == 4) { 199. p = *(int*)dst; ^ 200. for(; i < size; i+=bpp) { 201. int s = *(int*)(src+i); libavcodec/pngdec.c:202:17: Binary operation: ([0, 2139062143] + [0, 2139062143]):signed32 by call to `png_decode_idat` 200. for(; i < size; i+=bpp) { 201. int s = *(int*)(src+i); 202. p = ((s&0x7f7f7f7f) + (p&0x7f7f7f7f)) ^ ((s^p)&0x80808080); ^ 203. *(int*)(dst+i) = p; 204. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/pngdec.c/#L202
d2a_code_trace_data_43235
static av_cold int output_configure(AACContext *ac, enum ChannelPosition che_pos[4][MAX_ELEM_ID], enum ChannelPosition new_che_pos[4][MAX_ELEM_ID], int channel_config, enum OCStatus oc_type) { AVCodecContext *avctx = ac->avctx; int i, type, channels = 0, ret; if (new_che_pos != che_pos) memcpy(che_pos, new_che_pos, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0])); if (channel_config) { for (i = 0; i < tags_per_config[channel_config]; i++) { if ((ret = che_configure(ac, che_pos, aac_channel_layout_map[channel_config - 1][i][0], aac_channel_layout_map[channel_config - 1][i][1], &channels))) return ret; } memset(ac->tag_che_map, 0, 4 * MAX_ELEM_ID * sizeof(ac->che[0][0])); avctx->channel_layout = aac_channel_layout[channel_config - 1]; } else { for (i = 0; i < MAX_ELEM_ID; i++) { for (type = 0; type < 4; type++) { if ((ret = che_configure(ac, che_pos, type, i, &channels))) return ret; } } memcpy(ac->tag_che_map, ac->che, 4 * MAX_ELEM_ID * sizeof(ac->che[0][0])); avctx->channel_layout = 0; } avctx->channels = channels; ac->output_configured = oc_type; return 0; } libavcodec/aacdec.c:254: error: Buffer Overrun L3 Offset added: 512 Size: [0, +oo]. libavcodec/aacdec.c:214:1: <Length trace> 212. * @return Returns error status. 0 - OK, !0 - error 213. */ 214. static av_cold int output_configure(AACContext *ac, ^ 215. enum ChannelPosition che_pos[4][MAX_ELEM_ID], 216. enum ChannelPosition new_che_pos[4][MAX_ELEM_ID], libavcodec/aacdec.c:214:1: Parameter `ac->che[*]` 212. * @return Returns error status. 0 - OK, !0 - error 213. */ 214. static av_cold int output_configure(AACContext *ac, ^ 215. enum ChannelPosition che_pos[4][MAX_ELEM_ID], 216. enum ChannelPosition new_che_pos[4][MAX_ELEM_ID], libavcodec/aacdec.c:254:9: Array access: Offset added: 512 Size: [0, +oo] 252. } 253. 254. memcpy(ac->tag_che_map, ac->che, 4 * MAX_ELEM_ID * sizeof(ac->che[0][0])); ^ 255. 256. avctx->channel_layout = 0;
https://github.com/libav/libav/blob/1c69c79f2b11627cb50f1bc571de97ad8cbfefb7/libavcodec/aacdec.c/#L254
d2a_code_trace_data_43236
static int nss_keylog_int(const char *prefix, SSL *ssl, const uint8_t *parameter_1, size_t parameter_1_len, const uint8_t *parameter_2, size_t parameter_2_len) { char *out = NULL; char *cursor = NULL; size_t out_len = 0; size_t i; size_t prefix_len; if (ssl->ctx->keylog_callback == NULL) return 1; prefix_len = strlen(prefix); out_len = prefix_len + (2*parameter_1_len) + (2*parameter_2_len) + 3; if ((out = cursor = OPENSSL_malloc(out_len)) == NULL) { SSLerr(SSL_F_NSS_KEYLOG_INT, ERR_R_MALLOC_FAILURE); return 0; } strcpy(cursor, prefix); cursor += prefix_len; *cursor++ = ' '; for (i = 0; i < parameter_1_len; i++) { sprintf(cursor, "%02x", parameter_1[i]); cursor += 2; } *cursor++ = ' '; for (i = 0; i < parameter_2_len; i++) { sprintf(cursor, "%02x", parameter_2[i]); cursor += 2; } *cursor = '\0'; ssl->ctx->keylog_callback(ssl, (const char *)out); OPENSSL_free(out); return 1; } ssl/statem/statem_clnt.c:2538: error: BUFFER_OVERRUN_L3 Offset: 3 Size: [1, 118] by call to `ssl_log_rsa_client_key_exchange`. Showing all 13 steps of the trace ssl/statem/statem_clnt.c:2488:5: Assignment 2486. } 2487. 2488. pmslen = SSL_MAX_MASTER_KEY_LENGTH; ^ 2489. pms = OPENSSL_malloc(pmslen); 2490. if (pms == NULL) { ssl/statem/statem_clnt.c:2538:10: Call 2536. 2537. /* Log the premaster secret, if logging is enabled. */ 2538. if (!ssl_log_rsa_client_key_exchange(s, encdata, enclen, pms, pmslen)) ^ 2539. goto err; 2540. ssl/ssl_lib.c:4410:1: Parameter `premaster_len` 4408. } 4409. 4410. > int ssl_log_rsa_client_key_exchange(SSL *ssl, 4411. const uint8_t *encrypted_premaster, 4412. size_t encrypted_premaster_len, ssl/ssl_lib.c:4422:12: Call 4420. 4421. /* We only want the first 8 bytes of the encrypted premaster as a tag. */ 4422. return nss_keylog_int("RSA", ^ 4423. ssl, 4424. encrypted_premaster, ssl/ssl_lib.c:4358:1: <Offset trace> 4356. } 4357. 4358. > static int nss_keylog_int(const char *prefix, 4359. SSL *ssl, 4360. const uint8_t *parameter_1, ssl/ssl_lib.c:4358:1: Parameter `prefix->strlen` 4356. } 4357. 4358. > static int nss_keylog_int(const char *prefix, 4359. SSL *ssl, 4360. const uint8_t *parameter_1, ssl/ssl_lib.c:4358:1: <Length trace> 4356. } 4357. 4358. > static int nss_keylog_int(const char *prefix, 4359. SSL *ssl, 4360. const uint8_t *parameter_1, ssl/ssl_lib.c:4358:1: Parameter `parameter_2_len` 4356. } 4357. 4358. > static int nss_keylog_int(const char *prefix, 4359. SSL *ssl, 4360. const uint8_t *parameter_1, ssl/ssl_lib.c:4382:5: Assignment 4380. */ 4381. prefix_len = strlen(prefix); 4382. out_len = prefix_len + (2*parameter_1_len) + (2*parameter_2_len) + 3; ^ 4383. if ((out = cursor = OPENSSL_malloc(out_len)) == NULL) { 4384. SSLerr(SSL_F_NSS_KEYLOG_INT, ERR_R_MALLOC_FAILURE); ssl/ssl_lib.c:4383:25: Call 4381. prefix_len = strlen(prefix); 4382. out_len = prefix_len + (2*parameter_1_len) + (2*parameter_2_len) + 3; 4383. if ((out = cursor = OPENSSL_malloc(out_len)) == NULL) { ^ 4384. SSLerr(SSL_F_NSS_KEYLOG_INT, ERR_R_MALLOC_FAILURE); 4385. return 0; crypto/mem.c:166:9: Assignment 164. 165. if (num <= 0) 166. return NULL; ^ 167. 168. FAILTEST(); ssl/ssl_lib.c:4383:16: Assignment 4381. prefix_len = strlen(prefix); 4382. out_len = prefix_len + (2*parameter_1_len) + (2*parameter_2_len) + 3; 4383. if ((out = cursor = OPENSSL_malloc(out_len)) == NULL) { ^ 4384. SSLerr(SSL_F_NSS_KEYLOG_INT, ERR_R_MALLOC_FAILURE); 4385. return 0; ssl/ssl_lib.c:4388:5: Array access: Offset: 3 Size: [1, 118] by call to `ssl_log_rsa_client_key_exchange` 4386. } 4387. 4388. strcpy(cursor, prefix); ^ 4389. cursor += prefix_len; 4390. *cursor++ = ' ';
https://github.com/openssl/openssl/blob/6f8950a3cc466a7e2660dd9d7c8e9d11f47643ed/ssl/ssl_lib.c/#L4388
d2a_code_trace_data_43237
void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) { unsigned long hash; OPENSSL_LH_NODE *nn, **rn; void *ret; lh->error = 0; rn = getrn(lh, data, &hash); if (*rn == NULL) { lh->num_no_delete++; return (NULL); } else { nn = *rn; *rn = nn->next; ret = nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))) contract(lh); return (ret); } test/sslcorrupttest.c:173: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `SSL_free`. Showing all 16 steps of the trace test/sslcorrupttest.c:148:17: Call 146. 147. if (!TEST_ptr(ctx = SSL_CTX_new(TLS_server_method())) 148. || !TEST_ptr(ssl = SSL_new(ctx)) ^ 149. || !TEST_ptr(sk_ciphers = SSL_get1_supported_ciphers(ssl))) 150. goto err; ssl/ssl_lib.c:494:1: Parameter `ctx->sessions->num_items` 492. } 493. 494. > SSL *SSL_new(SSL_CTX *ctx) 495. { 496. SSL *s; test/sslcorrupttest.c:173:5: Call 171. err: 172. sk_SSL_CIPHER_free(sk_ciphers); 173. SSL_free(ssl); ^ 174. SSL_CTX_free(ctx); 175. ssl/ssl_lib.c:942:1: Parameter `s->session_ctx->sessions->num_items` 940. } 941. 942. > void SSL_free(SSL *s) 943. { 944. int i; ssl/ssl_lib.c:973:9: Call 971. /* Make the next call work :-) */ 972. if (s->session != NULL) { 973. ssl_clear_bad_session(s); ^ 974. SSL_SESSION_free(s->session); 975. } ssl/ssl_sess.c:1043:1: Parameter `s->session_ctx->sessions->num_items` 1041. } 1042. 1043. > int ssl_clear_bad_session(SSL *s) 1044. { 1045. if ((s->session != NULL) && ssl/ssl_sess.c:1048:9: Call 1046. !(s->shutdown & SSL_SENT_SHUTDOWN) && 1047. !(SSL_in_init(s) || SSL_in_before(s))) { 1048. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 1049. return (1); 1050. } else ssl/ssl_sess.c:707:1: Parameter `ctx->sessions->num_items` 705. } 706. 707. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 708. { 709. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:709:12: Call 707. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 708. { 709. return remove_session_lock(ctx, c, 1); ^ 710. } 711. ssl/ssl_sess.c:712:1: Parameter `ctx->sessions->num_items` 710. } 711. 712. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 713. { 714. SSL_SESSION *r; ssl/ssl_sess.c:722:17: Call 720. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 721. ret = 1; 722. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 723. SSL_SESSION_list_remove(ctx, c); 724. } ssl/ssl_locl.h:696:1: Parameter `lh->num_items` 694. } TLSEXT_INDEX; 695. 696. > DEFINE_LHASH_OF(SSL_SESSION); 697. /* Needed in ssl_cert.c */ 698. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:696:1: Call 694. } TLSEXT_INDEX; 695. 696. > DEFINE_LHASH_OF(SSL_SESSION); 697. /* Needed in ssl_cert.c */ 698. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:106:1: <LHS trace> 104. } 105. 106. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 107. { 108. unsigned long hash; crypto/lhash/lhash.c:106:1: Parameter `lh->num_items` 104. } 105. 106. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 107. { 108. unsigned long hash; crypto/lhash/lhash.c:126:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `SSL_free` 124. } 125. 126. lh->num_items--; ^ 127. if ((lh->num_nodes > MIN_NODES) && 128. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
https://github.com/openssl/openssl/blob/25ffeb11ea86bdc76db150c504550602a9acc9bc/crypto/lhash/lhash.c/#L126
d2a_code_trace_data_43238
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } crypto/ec/ecp_smpl.c:723: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_mod_add_quick`. Showing all 23 steps of the trace crypto/ec/ecp_smpl.c:656:14: Call 654. /* n1, n2 */ 655. if (b->Z_is_one) { 656. if (!BN_copy(n1, a->X)) ^ 657. goto end; 658. if (!BN_copy(n2, a->Y)) crypto/bn/bn_lib.c:281:1: Parameter `a->top` 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/ec/ecp_smpl.c:723:10: Call 721. 722. /* 'n7', 'n8' */ 723. if (!BN_mod_add_quick(n1, n1, n3, p)) ^ 724. goto end; 725. if (!BN_mod_add_quick(n2, n2, n4, p)) crypto/bn/bn_mod.c:94:1: Parameter `r->top` 92. } 93. 94. > int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 95. const BIGNUM *m) 96. { crypto/bn/bn_mod.c:97:15: Call 95. const BIGNUM *m) 96. { 97. int ret = bn_mod_add_fixed_top(r, a, b, m); ^ 98. 99. if (ret) crypto/bn/bn_mod.c:48:1: Parameter `r->top` 46. * move depending on whether or not subtraction borrowed. 47. */ 48. > int bn_mod_add_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 49. const BIGNUM *m) 50. { crypto/bn/bn_mod.c:56:9: Call 54. const BN_ULONG *ap, *bp; 55. 56. if (bn_wexpand(r, mtop) == NULL) ^ 57. return 0; 58. crypto/bn/bn_lib.c:948:1: Parameter `a->top` 946. } 947. 948. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:950:37: Call 948. BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 951. } 952. crypto/bn/bn_lib.c:245:1: Parameter `b->top` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `words` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:224:13: Call 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/mem.c:228:1: Parameter `num` 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:17: Call 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/mem.c:230:5: Assignment 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:235:5: Assignment 233. if (ret != NULL) 234. memset(ret, 0, num); 235. return ret; ^ 236. } 237. crypto/bn/bn_lib.c:224:9: Assignment 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_mod_add_quick` 230. assert(b->top <= words); 231. if (b->top > 0) 232. memcpy(a, b->d, sizeof(*a) * b->top); ^ 233. 234. return a;
https://github.com/openssl/openssl/blob/793f19e47c69558e39c702da75c27e0509baf379/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_43239
EVP_MD *EVP_MD_meth_dup(const EVP_MD *md) { EVP_MD *to = EVP_MD_meth_new(md->type, md->pkey_type); if (md != NULL) memcpy(to, md, sizeof(*to)); return to; } crypto/evp/evp_lib.c:327: error: NULL_DEREFERENCE pointer `to` last assigned on line 325 could be null and is dereferenced by call to `memcpy()` at line 327, column 9. Showing all 23 steps of the trace crypto/evp/evp_lib.c:323:1: start of procedure EVP_MD_meth_dup() 321. return md; 322. } 323. > EVP_MD *EVP_MD_meth_dup(const EVP_MD *md) 324. { 325. EVP_MD *to = EVP_MD_meth_new(md->type, md->pkey_type); crypto/evp/evp_lib.c:325:5: 323. EVP_MD *EVP_MD_meth_dup(const EVP_MD *md) 324. { 325. > EVP_MD *to = EVP_MD_meth_new(md->type, md->pkey_type); 326. if (md != NULL) 327. memcpy(to, md, sizeof(*to)); crypto/evp/evp_lib.c:314:1: start of procedure EVP_MD_meth_new() 312. } 313. 314. > EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type) 315. { 316. EVP_MD *md = (EVP_MD *)OPENSSL_zalloc(sizeof(EVP_MD)); crypto/evp/evp_lib.c:316:5: 314. EVP_MD *EVP_MD_meth_new(int md_type, int pkey_type) 315. { 316. > EVP_MD *md = (EVP_MD *)OPENSSL_zalloc(sizeof(EVP_MD)); 317. if (md != NULL) { 318. md->type = md_type; crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking false branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/evp/evp_lib.c:317:9: Taking false branch 315. { 316. EVP_MD *md = (EVP_MD *)OPENSSL_zalloc(sizeof(EVP_MD)); 317. if (md != NULL) { ^ 318. md->type = md_type; 319. md->pkey_type = pkey_type; crypto/evp/evp_lib.c:321:5: 319. md->pkey_type = pkey_type; 320. } 321. > return md; 322. } 323. EVP_MD *EVP_MD_meth_dup(const EVP_MD *md) crypto/evp/evp_lib.c:322:1: return from a call to EVP_MD_meth_new 320. } 321. return md; 322. > } 323. EVP_MD *EVP_MD_meth_dup(const EVP_MD *md) 324. { crypto/evp/evp_lib.c:326:9: Taking true branch 324. { 325. EVP_MD *to = EVP_MD_meth_new(md->type, md->pkey_type); 326. if (md != NULL) ^ 327. memcpy(to, md, sizeof(*to)); 328. return to; crypto/evp/evp_lib.c:327:9: 325. EVP_MD *to = EVP_MD_meth_new(md->type, md->pkey_type); 326. if (md != NULL) 327. > memcpy(to, md, sizeof(*to)); 328. return to; 329. }
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/evp/evp_lib.c/#L327
d2a_code_trace_data_43240
void bn_correct_top(BIGNUM *a) { BN_ULONG *ftl; int tmp_top = a->top; if (tmp_top > 0) { for (ftl = &(a->d[tmp_top]); tmp_top > 0; tmp_top--) { ftl--; if (*ftl != 0) break; } a->top = tmp_top; } if (a->top == 0) a->neg = 0; bn_pollute(a); } crypto/bn/bn_mont.c:56: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mul`. Showing all 14 steps of the trace crypto/bn/bn_mont.c:47:11: Call 45. 46. BN_CTX_start(ctx); 47. tmp = BN_CTX_get(ctx); ^ 48. if (tmp == NULL) 49. goto err; crypto/bn/bn_ctx.c:229:5: Call 227. } 228. /* OK, make sure the returned bignum is "zero" */ 229. BN_zero(ret); ^ 230. ctx->used++; 231. CTXDBG_RET(ctx, ret); crypto/bn/bn_lib.c:463:1: Parameter `*a->d` 461. } 462. 463. > int BN_set_word(BIGNUM *a, BN_ULONG w) 464. { 465. bn_check_top(a); crypto/bn/bn_lib.c:466:9: Call 464. { 465. bn_check_top(a); 466. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 467. return (0); 468. a->neg = 0; crypto/bn/bn_lcl.h:676:1: Parameter `*a->d` 674. int bn_probable_prime_dh_coprime(BIGNUM *rnd, int bits, BN_CTX *ctx); 675. 676. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 677. { 678. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_mont.c:56:14: Call 54. goto err; 55. } else { 56. if (!BN_mul(tmp, a, b, ctx)) ^ 57. goto err; 58. } crypto/bn/bn_mul.c:879:13: Assignment 877. if (bn_wexpand(rr, 16) == NULL) 878. goto err; 879. rr->top = 16; ^ 880. bn_mul_comba8(rr->d, a->d, b->d); 881. goto end; crypto/bn/bn_mul.c:972:5: Call 970. end: 971. #endif 972. bn_correct_top(rr); ^ 973. if (r != rr && BN_copy(r, rr) == NULL) 974. goto err; crypto/bn/bn_lib.c:1021:1: <Offset trace> 1019. } 1020. 1021. > void bn_correct_top(BIGNUM *a) 1022. { 1023. BN_ULONG *ftl; crypto/bn/bn_lib.c:1021:1: Parameter `a->top` 1019. } 1020. 1021. > void bn_correct_top(BIGNUM *a) 1022. { 1023. BN_ULONG *ftl; crypto/bn/bn_lib.c:1024:5: Assignment 1022. { 1023. BN_ULONG *ftl; 1024. int tmp_top = a->top; ^ 1025. 1026. if (tmp_top > 0) { crypto/bn/bn_lib.c:1021:1: <Length trace> 1019. } 1020. 1021. > void bn_correct_top(BIGNUM *a) 1022. { 1023. BN_ULONG *ftl; crypto/bn/bn_lib.c:1021:1: Parameter `*a->d` 1019. } 1020. 1021. > void bn_correct_top(BIGNUM *a) 1022. { 1023. BN_ULONG *ftl; crypto/bn/bn_lib.c:1027:14: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mul` 1025. 1026. if (tmp_top > 0) { 1027. for (ftl = &(a->d[tmp_top]); tmp_top > 0; tmp_top--) { ^ 1028. ftl--; 1029. if (*ftl != 0)
https://github.com/openssl/openssl/blob/d7c42d71ba407a4b3c26ed58263ae225976bbac3/crypto/bn/bn_lib.c/#L1027
d2a_code_trace_data_43241
static int tta_read_header(AVFormatContext *s, AVFormatParameters *ap) { TTAContext *c = s->priv_data; AVStream *st; int i, channels, bps, samplerate, datalen, framelen; uint64_t framepos; if (get_le32(s->pb) != ff_get_fourcc("TTA1")) return -1; url_fskip(s->pb, 2); channels = get_le16(s->pb); bps = get_le16(s->pb); samplerate = get_le32(s->pb); if(samplerate <= 0 || samplerate > 1000000){ av_log(s, AV_LOG_ERROR, "nonsense samplerate\n"); return -1; } datalen = get_le32(s->pb); if(datalen < 0){ av_log(s, AV_LOG_ERROR, "nonsense datalen\n"); return -1; } url_fskip(s->pb, 4); framelen = samplerate*256/245; c->totalframes = datalen / framelen + ((datalen % framelen) ? 1 : 0); c->currentframe = 0; if(c->totalframes >= UINT_MAX/sizeof(uint32_t)){ av_log(s, AV_LOG_ERROR, "totalframes too large\n"); return -1; } st = av_new_stream(s, 0); if (!st) return AVERROR(ENOMEM); av_set_pts_info(st, 64, 1, samplerate); st->start_time = 0; st->duration = datalen; framepos = url_ftell(s->pb) + 4*c->totalframes + 4; for (i = 0; i < c->totalframes; i++) { uint32_t size = get_le32(s->pb); av_add_index_entry(st, framepos, i*framelen, size, 0, AVINDEX_KEYFRAME); framepos += size; } url_fskip(s->pb, 4); st->codec->codec_type = CODEC_TYPE_AUDIO; st->codec->codec_id = CODEC_ID_TTA; st->codec->channels = channels; st->codec->sample_rate = samplerate; st->codec->bits_per_sample = bps; st->codec->extradata_size = url_ftell(s->pb); if(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE <= (unsigned)st->codec->extradata_size){ av_log(s, AV_LOG_ERROR, "extradata_size too large\n"); return -1; } st->codec->extradata = av_mallocz(st->codec->extradata_size+FF_INPUT_BUFFER_PADDING_SIZE); url_fseek(s->pb, 0, SEEK_SET); get_buffer(s->pb, st->codec->extradata, st->codec->extradata_size); return 0; } libavformat/tta.c:80: error: Integer Overflow L2 (4 × [-oo, 1073741822]):signed32. libavformat/tta.c:55:15: <RHS trace> 53. } 54. 55. datalen = get_le32(s->pb); ^ 56. if(datalen < 0){ 57. av_log(s, AV_LOG_ERROR, "nonsense datalen\n"); libavformat/tta.c:55:15: Call 53. } 54. 55. datalen = get_le32(s->pb); ^ 56. if(datalen < 0){ 57. av_log(s, AV_LOG_ERROR, "nonsense datalen\n"); libavformat/aviobuf.c:446:11: Call 444. { 445. unsigned int val; 446. val = get_le16(s); ^ 447. val |= get_le16(s) << 16; 448. return val; libavformat/aviobuf.c:430:11: Call 428. { 429. unsigned int val; 430. val = get_byte(s); ^ 431. val |= get_byte(s) << 8; 432. return val; libavformat/aviobuf.c:348:13: Assignment 346. return *s->buf_ptr++; 347. else 348. return 0; ^ 349. } 350. } libavformat/aviobuf.c:430:5: Assignment 428. { 429. unsigned int val; 430. val = get_byte(s); ^ 431. val |= get_byte(s) << 8; 432. return val; libavformat/aviobuf.c:431:5: Assignment 429. unsigned int val; 430. val = get_byte(s); 431. val |= get_byte(s) << 8; ^ 432. return val; 433. } libavformat/aviobuf.c:432:5: Assignment 430. val = get_byte(s); 431. val |= get_byte(s) << 8; 432. return val; ^ 433. } 434. libavformat/aviobuf.c:446:5: Assignment 444. { 445. unsigned int val; 446. val = get_le16(s); ^ 447. val |= get_le16(s) << 16; 448. return val; libavformat/aviobuf.c:447:5: Assignment 445. unsigned int val; 446. val = get_le16(s); 447. val |= get_le16(s) << 16; ^ 448. return val; 449. } libavformat/aviobuf.c:448:5: Assignment 446. val = get_le16(s); 447. val |= get_le16(s) << 16; 448. return val; ^ 449. } 450. libavformat/tta.c:55:5: Assignment 53. } 54. 55. datalen = get_le32(s->pb); ^ 56. if(datalen < 0){ 57. av_log(s, AV_LOG_ERROR, "nonsense datalen\n"); libavformat/tta.c:64:5: Assignment 62. 63. framelen = samplerate*256/245; 64. c->totalframes = datalen / framelen + ((datalen % framelen) ? 1 : 0); ^ 65. c->currentframe = 0; 66. libavformat/tta.c:80:5: Binary operation: (4 × [-oo, 1073741822]):signed32 78. st->duration = datalen; 79. 80. framepos = url_ftell(s->pb) + 4*c->totalframes + 4; ^ 81. 82. for (i = 0; i < c->totalframes; i++) {
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/tta.c/#L80
d2a_code_trace_data_43242
u_char * ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) { u_char *p, zero, *last; int d; float f, scale; size_t len, slen; int64_t i64; uint64_t ui64; ngx_msec_t ms; ngx_uint_t width, sign, hex, max_width, frac_width, i; ngx_str_t *v; ngx_variable_value_t *vv; if (max == 0) { return buf; } last = buf + max; while (*fmt && buf < last) { if (*fmt == '%') { i64 = 0; ui64 = 0; zero = (u_char) ((*++fmt == '0') ? '0' : ' '); width = 0; sign = 1; hex = 0; max_width = 0; frac_width = 0; slen = (size_t) -1; while (*fmt >= '0' && *fmt <= '9') { width = width * 10 + *fmt++ - '0'; } for ( ;; ) { switch (*fmt) { case 'u': sign = 0; fmt++; continue; case 'm': max_width = 1; fmt++; continue; case 'X': hex = 2; sign = 0; fmt++; continue; case 'x': hex = 1; sign = 0; fmt++; continue; case '.': fmt++; while (*fmt >= '0' && *fmt <= '9') { frac_width = frac_width * 10 + *fmt++ - '0'; } break; case '*': slen = va_arg(args, size_t); fmt++; continue; default: break; } break; } switch (*fmt) { case 'V': v = va_arg(args, ngx_str_t *); len = v->len; len = (buf + len < last) ? len : (size_t) (last - buf); buf = ngx_cpymem(buf, v->data, len); fmt++; continue; case 'v': vv = va_arg(args, ngx_variable_value_t *); len = vv->len; len = (buf + len < last) ? len : (size_t) (last - buf); buf = ngx_cpymem(buf, vv->data, len); fmt++; continue; case 's': p = va_arg(args, u_char *); if (slen == (size_t) -1) { while (*p && buf < last) { *buf++ = *p++; } } else { len = (buf + slen < last) ? slen : (size_t) (last - buf); buf = ngx_cpymem(buf, p, len); } fmt++; continue; case 'O': i64 = (int64_t) va_arg(args, off_t); sign = 1; break; case 'P': i64 = (int64_t) va_arg(args, ngx_pid_t); sign = 1; break; case 'T': i64 = (int64_t) va_arg(args, time_t); sign = 1; break; case 'M': ms = (ngx_msec_t) va_arg(args, ngx_msec_t); if ((ngx_msec_int_t) ms == -1) { sign = 1; i64 = -1; } else { sign = 0; ui64 = (uint64_t) ms; } break; case 'z': if (sign) { i64 = (int64_t) va_arg(args, ssize_t); } else { ui64 = (uint64_t) va_arg(args, size_t); } break; case 'i': if (sign) { i64 = (int64_t) va_arg(args, ngx_int_t); } else { ui64 = (uint64_t) va_arg(args, ngx_uint_t); } if (max_width) { width = NGX_INT_T_LEN; } break; case 'd': if (sign) { i64 = (int64_t) va_arg(args, int); } else { ui64 = (uint64_t) va_arg(args, u_int); } break; case 'l': if (sign) { i64 = (int64_t) va_arg(args, long); } else { ui64 = (uint64_t) va_arg(args, u_long); } break; case 'D': if (sign) { i64 = (int64_t) va_arg(args, int32_t); } else { ui64 = (uint64_t) va_arg(args, uint32_t); } break; case 'L': if (sign) { i64 = va_arg(args, int64_t); } else { ui64 = va_arg(args, uint64_t); } break; case 'A': if (sign) { i64 = (int64_t) va_arg(args, ngx_atomic_int_t); } else { ui64 = (uint64_t) va_arg(args, ngx_atomic_uint_t); } if (max_width) { width = NGX_ATOMIC_T_LEN; } break; case 'f': f = (float) va_arg(args, double); if (f < 0) { *buf++ = '-'; f = -f; } ui64 = (int64_t) f; buf = ngx_sprintf_num(buf, last, ui64, zero, 0, width); if (frac_width) { if (buf < last) { *buf++ = '.'; } scale = 1.0; for (i = 0; i < frac_width; i++) { scale *= 10.0; } ui64 = (uint64_t) ((f - (int64_t) ui64) * scale); buf = ngx_sprintf_num(buf, last, ui64, '0', 0, frac_width); } fmt++; continue; #if !(NGX_WIN32) case 'r': i64 = (int64_t) va_arg(args, rlim_t); sign = 1; break; #endif case 'p': ui64 = (uintptr_t) va_arg(args, void *); hex = 2; sign = 0; zero = '0'; width = NGX_PTR_SIZE * 2; break; case 'c': d = va_arg(args, int); *buf++ = (u_char) (d & 0xff); fmt++; continue; case 'Z': *buf++ = '\0'; fmt++; continue; case 'N': #if (NGX_WIN32) *buf++ = CR; #endif *buf++ = LF; fmt++; continue; case '%': *buf++ = '%'; fmt++; continue; default: *buf++ = *fmt++; continue; } if (sign) { if (i64 < 0) { *buf++ = '-'; ui64 = (uint64_t) -i64; } else { ui64 = (uint64_t) i64; } } buf = ngx_sprintf_num(buf, last, ui64, zero, hex, width); fmt++; } else { *buf++ = *fmt++; } } return buf; } src/http/ngx_http.c:1256: error: Buffer Overrun L2 Offset: [0, 4048] Size: 2048 by call to `ngx_log_error_core`. src/http/ngx_http.c:1247:13: Call 1245. /* the address is already in the address list */ 1246. 1247. if (ngx_http_add_names(cf, cscf, &addr[i]) != NGX_OK) { ^ 1248. return NGX_ERROR; 1249. } src/http/ngx_http.c:1360:16: Call 1358. "name: %V", &server_names[i].name); 1359. 1360. name = ngx_array_push(&addr->names); ^ 1361. if (name == NULL) { 1362. return NGX_ERROR; src/core/ngx_array.c:52:1: Parameter `a->size` 50. 51. 52. void * ^ 53. ngx_array_push(ngx_array_t *a) 54. { src/core/ngx_array.c:75:13: Assignment 73. */ 74. 75. p->d.last += a->size; ^ 76. a->nalloc++; 77. src/http/ngx_http.c:1256:17: Call 1254. 1255. if (addr[i].default_server) { 1256. ngx_log_error(NGX_LOG_ERR, cf->log, 0, ^ 1257. "the duplicate default server in %s:%ui", 1258. listen->file_name, listen->line); src/core/ngx_log.c:67:1: Array declaration 65. #if (NGX_HAVE_VARIADIC_MACROS) 66. 67. void ^ 68. ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, 69. const char *fmt, ...) src/core/ngx_log.c:88:5: Assignment 86. } 87. 88. last = errstr + NGX_MAX_ERROR_STR; ^ 89. 90. ngx_memcpy(errstr, ngx_cached_err_log_time.data, src/core/ngx_log.c:133:13: Call 131. ? " (%d: " : " (%Xd: ", err); 132. #else 133. p = ngx_snprintf(p, last - p, " (%d: ", err); ^ 134. #endif 135. src/core/ngx_string.c:109:1: Parameter `max` 107. 108. 109. u_char * ngx_cdecl ^ 110. ngx_snprintf(u_char *buf, size_t max, const char *fmt, ...) 111. { src/core/ngx_string.c:116:9: Call 114. 115. va_start(args, fmt); 116. p = ngx_vsnprintf(buf, max, fmt, args); ^ 117. va_end(args); 118. src/core/ngx_string.c:123:1: <Length trace> 121. 122. 123. u_char * ^ 124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) 125. { src/core/ngx_string.c:123:1: Parameter `*buf` 121. 122. 123. u_char * ^ 124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) 125. { src/core/ngx_string.c:244:25: Array access: Offset: [0, 4048] Size: 2048 by call to `ngx_log_error_core` 242. if (slen == (size_t) -1) { 243. while (*p && buf < last) { 244. *buf++ = *p++; ^ 245. } 246.
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_string.c/#L244
d2a_code_trace_data_43243
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) { int i, nw, lb, rb; BN_ULONG *t, *f; BN_ULONG l; bn_check_top(r); bn_check_top(a); if (n < 0) { BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT); return 0; } nw = n / BN_BITS2; if (bn_wexpand(r, a->top + nw + 1) == NULL) return (0); r->neg = a->neg; lb = n % BN_BITS2; rb = BN_BITS2 - lb; f = a->d; t = r->d; t[a->top + nw] = 0; if (lb == 0) for (i = a->top - 1; i >= 0; i--) t[nw + i] = f[i]; else for (i = a->top - 1; i >= 0; i--) { l = f[i]; t[nw + i + 1] |= (l >> rb) & BN_MASK2; t[nw + i] = (l << lb) & BN_MASK2; } memset(t, 0, sizeof(*t) * nw); r->top = a->top + nw + 1; bn_correct_top(r); bn_check_top(r); return (1); } test/ectest.c:214: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `EC_POINT_set_compressed_coordinates_GFp`. Showing all 20 steps of the trace test/ectest.c:171:13: Call 169. || !TEST_ptr(a = BN_new()) 170. || !TEST_ptr(b = BN_new()) 171. || !TEST_true(BN_hex2bn(&p, "17")) ^ 172. || !TEST_true(BN_hex2bn(&a, "1")) 173. || !TEST_true(BN_hex2bn(&b, "1")) crypto/bn/bn_print.c:126:1: Parameter `(*bn)->top` 124. } 125. 126. > int BN_hex2bn(BIGNUM **bn, const char *a) 127. { 128. BIGNUM *ret = NULL; test/ectest.c:214:13: Call 212. || !TEST_ptr(yplusone = BN_new()) 213. || !TEST_true(BN_hex2bn(&x, "D")) 214. || !TEST_true(EC_POINT_set_compressed_coordinates_GFp(group, Q, x, 1, ^ 215. ctx))) 216. goto err; crypto/ec/ec_oct.c:23:1: Parameter `x->top` 21. #include "ec_lcl.h" 22. 23. > int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, 24. EC_POINT *point, const BIGNUM *x, 25. int y_bit, BN_CTX *ctx) crypto/ec/ec_oct.c:40:20: Call 38. if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) { 39. if (group->meth->field_type == NID_X9_62_prime_field) 40. return ec_GFp_simple_set_compressed_coordinates(group, point, x, ^ 41. y_bit, ctx); 42. else crypto/ec/ecp_oct.c:21:1: Parameter `x_->top` 19. #include "ec_lcl.h" 20. 21. > int ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group, 22. EC_POINT *point, 23. const BIGNUM *x_, int y_bit, crypto/ec/ecp_oct.c:56:10: Call 54. 55. /* tmp1 := x^3 */ 56. if (!BN_nnmod(x, x_, group->field, ctx)) ^ 57. goto err; 58. if (group->meth->field_decode == 0) { crypto/bn/bn_mod.c:13:1: Parameter `m->top` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:140:1: Parameter `num->top` 138. * If 'dv' or 'rm' is NULL, the respective value is not returned. 139. */ 140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 141. BN_CTX *ctx) 142. { crypto/bn/bn_div.c:210:11: Call 208. sdiv->neg = 0; 209. norm_shift += BN_BITS2; 210. if (!(BN_lshift(snum, num, norm_shift))) ^ 211. goto err; 212. snum->neg = 0; crypto/bn/bn_shift.c:83:1: <Offset trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `n` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:5: Assignment 95. } 96. 97. nw = n / BN_BITS2; ^ 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) 99. return (0); crypto/bn/bn_shift.c:83:1: <Length trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `*r->d` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:98:9: Call 96. 97. nw = n / BN_BITS2; 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 99. return (0); 100. r->neg = a->neg; crypto/bn/bn_lib.c:948:1: Parameter `*a->d` 946. } 947. 948. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:104:5: Assignment 102. rb = BN_BITS2 - lb; 103. f = a->d; 104. t = r->d; ^ 105. t[a->top + nw] = 0; 106. if (lb == 0) crypto/bn/bn_shift.c:112:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `EC_POINT_set_compressed_coordinates_GFp` 110. for (i = a->top - 1; i >= 0; i--) { 111. l = f[i]; 112. t[nw + i + 1] |= (l >> rb) & BN_MASK2; ^ 113. t[nw + i] = (l << lb) & BN_MASK2; 114. }
https://github.com/openssl/openssl/blob/7671342e550ed2de676b23c79d0e7f45a381c76e/crypto/bn/bn_shift.c/#L112
d2a_code_trace_data_43244
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_sp800_56b_check.c:228: error: INTEGER_OVERFLOW_L2 ([0, 3+max(0, `ctx->stack.depth`)] - 1):unsigned32 by call to `BN_div`. Showing all 33 steps of the trace crypto/rsa/rsa_sp800_56b_check.c:220:1: Parameter `ctx->stack.depth` 218. 219. /* return LCM(p-1, q-1) */ 220. > int rsa_get_lcm(BN_CTX *ctx, const BIGNUM *p, const BIGNUM *q, 221. BIGNUM *lcm, BIGNUM *gcd, BIGNUM *p1, BIGNUM *q1, 222. BIGNUM *p1q1) crypto/rsa/rsa_sp800_56b_check.c:226:15: Call 224. return BN_sub(p1, p, BN_value_one()) /* p-1 */ 225. && BN_sub(q1, q, BN_value_one()) /* q-1 */ 226. && BN_mul(p1q1, p1, q1, ctx) /* (p-1)(q-1) */ ^ 227. && BN_gcd(gcd, p1, q1, ctx) 228. && BN_div(lcm, NULL, p1q1, gcd, ctx); /* LCM((p-1, q-1)) */ crypto/bn/bn_mul.c:497:1: Parameter `ctx->stack.depth` 495. #endif /* BN_RECURSION */ 496. 497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); crypto/bn/bn_mul.c:499:15: Call 497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); ^ 500. 501. bn_correct_top(r); crypto/bn/bn_mul.c:507:1: Parameter `ctx->stack.depth` 505. } 506. 507. > int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 508. { 509. int ret = 0; crypto/rsa/rsa_sp800_56b_check.c:227:15: Call 225. && BN_sub(q1, q, BN_value_one()) /* q-1 */ 226. && BN_mul(p1q1, p1, q1, ctx) /* (p-1)(q-1) */ 227. && BN_gcd(gcd, p1, q1, ctx) ^ 228. && BN_div(lcm, NULL, p1q1, gcd, ctx); /* LCM((p-1, q-1)) */ 229. } crypto/bn/bn_gcd.c:15:1: Parameter `ctx->stack.depth` 13. static BIGNUM *euclid(BIGNUM *a, BIGNUM *b); 14. 15. > int BN_gcd(BIGNUM *r, const BIGNUM *in_a, const BIGNUM *in_b, BN_CTX *ctx) 16. { 17. BIGNUM *a, *b, *t; crypto/bn/bn_gcd.c:23:5: Call 21. bn_check_top(in_b); 22. 23. BN_CTX_start(ctx); ^ 24. a = BN_CTX_get(ctx); 25. b = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gcd.c:24:9: Call 22. 23. BN_CTX_start(ctx); 24. a = BN_CTX_get(ctx); ^ 25. b = BN_CTX_get(ctx); 26. if (b == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:25:9: Call 23. BN_CTX_start(ctx); 24. a = BN_CTX_get(ctx); 25. b = BN_CTX_get(ctx); ^ 26. if (b == NULL) 27. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:49:5: Call 47. ret = 1; 48. err: 49. BN_CTX_end(ctx); ^ 50. bn_check_top(r); 51. return ret; crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/rsa/rsa_sp800_56b_check.c:228:15: Call 226. && BN_mul(p1q1, p1, q1, ctx) /* (p-1)(q-1) */ 227. && BN_gcd(gcd, p1, q1, ctx) 228. && BN_div(lcm, NULL, p1q1, gcd, ctx); /* LCM((p-1, q-1)) */ ^ 229. } 230. crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth` 207. * If 'dv' or 'rm' is NULL, the respective value is not returned. 208. */ 209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 210. BN_CTX *ctx) 211. { crypto/bn/bn_div.c:229:11: Call 227. } 228. 229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx); ^ 230. 231. if (ret) { crypto/bn/bn_div.c:264:1: Parameter `ctx->stack.depth` 262. * divisor's length is considered public; 263. */ 264. > int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, 265. const BIGNUM *divisor, BN_CTX *ctx) 266. { crypto/bn/bn_div.c:280:5: Call 278. bn_check_top(rm); 279. 280. BN_CTX_start(ctx); ^ 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_div.c:282:11: Call 280. BN_CTX_start(ctx); 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); ^ 283. snum = BN_CTX_get(ctx); 284. sdiv = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_div.c:283:12: Call 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); 283. snum = BN_CTX_get(ctx); ^ 284. sdiv = BN_CTX_get(ctx); 285. if (sdiv == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_div.c:284:12: Call 282. tmp = BN_CTX_get(ctx); 283. snum = BN_CTX_get(ctx); 284. sdiv = BN_CTX_get(ctx); ^ 285. if (sdiv == NULL) 286. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_div.c:450:5: Call 448. if (rm != NULL) 449. bn_rshift_fixed_top(rm, snum, norm_shift); 450. BN_CTX_end(ctx); ^ 451. return 1; 452. err: crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <LHS trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Binary operation: ([0, 3+max(0, ctx->stack.depth)] - 1):unsigned32 by call to `BN_div` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_43245
static int opt_preset(const char *opt, const char *arg) { FILE *f=NULL; char filename[1000], tmp[1000], tmp2[1000], line[1000]; char *codec_name = *opt == 'v' ? video_codec_name : *opt == 'a' ? audio_codec_name : subtitle_codec_name; if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { fprintf(stderr, "File for preset '%s' not found\n", arg); ffmpeg_exit(1); } while(!feof(f)){ int e= fscanf(f, "%999[^\n]\n", line) - 1; if(line[0] == '#' && !e) continue; e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2; if(e){ fprintf(stderr, "%s: Invalid syntax: '%s'\n", filename, line); ffmpeg_exit(1); } if(!strcmp(tmp, "acodec")){ opt_audio_codec(tmp, tmp2); }else if(!strcmp(tmp, "vcodec")){ opt_video_codec(tmp, tmp2); }else if(!strcmp(tmp, "scodec")){ opt_subtitle_codec(tmp, tmp2); }else if(!strcmp(tmp, "dcodec")){ opt_data_codec(tmp, tmp2); }else if(opt_default(tmp, tmp2) < 0){ fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2); ffmpeg_exit(1); } } fclose(f); return 0; } ffmpeg.c:4239: error: Null Dereference pointer `f` last assigned on line 4234 could be null and is dereferenced by call to `feof()` at line 4239, column 12. ffmpeg.c:4226:1: start of procedure opt_preset() 4224. } 4225. 4226. static int opt_preset(const char *opt, const char *arg) ^ 4227. { 4228. FILE *f=NULL; ffmpeg.c:4228:5: 4226. static int opt_preset(const char *opt, const char *arg) 4227. { 4228. FILE *f=NULL; ^ 4229. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4230. char *codec_name = *opt == 'v' ? video_codec_name : ffmpeg.c:4230:24: Condition is false 4228. FILE *f=NULL; 4229. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4230. char *codec_name = *opt == 'v' ? video_codec_name : ^ 4231. *opt == 'a' ? audio_codec_name : 4232. subtitle_codec_name; ffmpeg.c:4231:24: Condition is false 4229. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4230. char *codec_name = *opt == 'v' ? video_codec_name : 4231. *opt == 'a' ? audio_codec_name : ^ 4232. subtitle_codec_name; 4233. ffmpeg.c:4230:24: 4228. FILE *f=NULL; 4229. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4230. char *codec_name = *opt == 'v' ? video_codec_name : ^ 4231. *opt == 'a' ? audio_codec_name : 4232. subtitle_codec_name; ffmpeg.c:4230:5: 4228. FILE *f=NULL; 4229. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4230. char *codec_name = *opt == 'v' ? video_codec_name : ^ 4231. *opt == 'a' ? audio_codec_name : 4232. subtitle_codec_name; ffmpeg.c:4234:64: Condition is false 4232. subtitle_codec_name; 4233. 4234. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { ^ 4235. fprintf(stderr, "File for preset '%s' not found\n", arg); 4236. ffmpeg_exit(1); ffmpeg.c:4234:11: Taking true branch 4232. subtitle_codec_name; 4233. 4234. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { ^ 4235. fprintf(stderr, "File for preset '%s' not found\n", arg); 4236. ffmpeg_exit(1); ffmpeg.c:4235:9: 4233. 4234. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { 4235. fprintf(stderr, "File for preset '%s' not found\n", arg); ^ 4236. ffmpeg_exit(1); 4237. } ffmpeg.c:4236:9: Skipping ffmpeg_exit(): empty list of specs 4234. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { 4235. fprintf(stderr, "File for preset '%s' not found\n", arg); 4236. ffmpeg_exit(1); ^ 4237. } 4238. ffmpeg.c:4239:12: 4237. } 4238. 4239. while(!feof(f)){ ^ 4240. int e= fscanf(f, "%999[^\n]\n", line) - 1; 4241. if(line[0] == '#' && !e)
https://github.com/libav/libav/blob/a6286bda0956bfe15b4e1a9f96e1689666e1d866/ffmpeg.c/#L4239
d2a_code_trace_data_43246
void ssl3_cbc_copy_mac(unsigned char *out, const SSL3_RECORD *rec, unsigned md_size) { #if defined(CBC_MAC_ROTATE_IN_PLACE) unsigned char rotated_mac_buf[64 + EVP_MAX_MD_SIZE]; unsigned char *rotated_mac; #else unsigned char rotated_mac[EVP_MAX_MD_SIZE]; #endif unsigned mac_end = rec->length; unsigned mac_start = mac_end - md_size; unsigned scan_start = 0; unsigned i, j; unsigned div_spoiler; unsigned rotate_offset; OPENSSL_assert(rec->orig_len >= md_size); OPENSSL_assert(md_size <= EVP_MAX_MD_SIZE); #if defined(CBC_MAC_ROTATE_IN_PLACE) rotated_mac = rotated_mac_buf + ((0 - (size_t)rotated_mac_buf) & 63); #endif if (rec->orig_len > md_size + 255 + 1) scan_start = rec->orig_len - (md_size + 255 + 1); div_spoiler = md_size >> 1; div_spoiler <<= (sizeof(div_spoiler) - 1) * 8; rotate_offset = (div_spoiler + mac_start - scan_start) % md_size; memset(rotated_mac, 0, md_size); for (i = scan_start, j = 0; i < rec->orig_len; i++) { unsigned char mac_started = constant_time_ge_8(i, mac_start); unsigned char mac_ended = constant_time_ge_8(i, mac_end); unsigned char b = rec->data[i]; rotated_mac[j++] |= b & mac_started & ~mac_ended; j &= constant_time_lt(j, md_size); } #if defined(CBC_MAC_ROTATE_IN_PLACE) j = 0; for (i = 0; i < md_size; i++) { ((volatile unsigned char *)rotated_mac)[rotate_offset ^ 32]; out[j++] = rotated_mac[rotate_offset++]; rotate_offset &= constant_time_lt(rotate_offset, md_size); } #else memset(out, 0, md_size); rotate_offset = md_size - rotate_offset; rotate_offset &= constant_time_lt(rotate_offset, md_size); for (i = 0; i < md_size; i++) { for (j = 0; j < md_size; j++) out[j] |= rotated_mac[i] & constant_time_eq_8(j, rotate_offset); rotate_offset++; rotate_offset &= constant_time_lt(rotate_offset, md_size); } #endif } ssl/record/rec_layer_d1.c:286: error: INTEGER_OVERFLOW_L2 ([0, 17728] - [256, 320]):unsigned32 by call to `dtls1_process_record`. Showing all 10 steps of the trace ssl/record/rec_layer_d1.c:229:1: Parameter `s->rlayer.rrec.length` 227. &((s)->rlayer.d->unprocessed_rcds)) 228. 229. > int dtls1_process_buffered_records(SSL *s) 230. { 231. pitem *item; ssl/record/rec_layer_d1.c:286:31: Call 284. } 285. 286. if (!replayok || !dtls1_process_record(s, bitmap)) { ^ 287. /* dump this record */ 288. rr->length = 0; ssl/record/ssl3_record.c:1276:1: Parameter `s->rlayer.rrec.length` 1274. } 1275. 1276. > int dtls1_process_record(SSL *s, DTLS1_BITMAP *bitmap) 1277. { 1278. int i, al; ssl/record/ssl3_record.c:1315:5: Assignment 1313. /* decrypt in place in 'rr->input' */ 1314. rr->data = rr->input; 1315. rr->orig_len = rr->length; ^ 1316. 1317. enc_err = s->method->ssl3_enc->enc(s, rr, 1, 0); ssl/record/ssl3_record.c:1372:13: Call 1370. */ 1371. mac = mac_tmp; 1372. ssl3_cbc_copy_mac(mac_tmp, rr, mac_size); ^ 1373. rr->length -= mac_size; 1374. } else { ssl/record/ssl3_record.c:1199:1: <LHS trace> 1197. #define CBC_MAC_ROTATE_IN_PLACE 1198. 1199. > void ssl3_cbc_copy_mac(unsigned char *out, 1200. const SSL3_RECORD *rec, unsigned md_size) 1201. { ssl/record/ssl3_record.c:1199:1: Parameter `md_size` 1197. #define CBC_MAC_ROTATE_IN_PLACE 1198. 1199. > void ssl3_cbc_copy_mac(unsigned char *out, 1200. const SSL3_RECORD *rec, unsigned md_size) 1201. { ssl/record/ssl3_record.c:1199:1: <RHS trace> 1197. #define CBC_MAC_ROTATE_IN_PLACE 1198. 1199. > void ssl3_cbc_copy_mac(unsigned char *out, 1200. const SSL3_RECORD *rec, unsigned md_size) 1201. { ssl/record/ssl3_record.c:1199:1: Parameter `md_size` 1197. #define CBC_MAC_ROTATE_IN_PLACE 1198. 1199. > void ssl3_cbc_copy_mac(unsigned char *out, 1200. const SSL3_RECORD *rec, unsigned md_size) 1201. { ssl/record/ssl3_record.c:1232:9: Binary operation: ([0, 17728] - [256, 320]):unsigned32 by call to `dtls1_process_record` 1230. /* This information is public so it's safe to branch based on it. */ 1231. if (rec->orig_len > md_size + 255 + 1) 1232. scan_start = rec->orig_len - (md_size + 255 + 1); ^ 1233. /* 1234. * div_spoiler contains a multiple of md_size that is used to cause the
https://github.com/openssl/openssl/blob/1fb9fdc3027b27d8eb6a1e6a846435b070980770/ssl/record/ssl3_record.c/#L1232
d2a_code_trace_data_43247
int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; if (pkt->buf->length > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = (pkt->buf->length == 0) ? DEFAULT_BUF_SIZE : pkt->buf->length * 2; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; pkt->written += len; pkt->curr += len; return 1; } ssl/t1_lib.c:1057: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + 10]):unsigned64 by call to `WPACKET_start_sub_packet_len`. Showing all 10 steps of the trace ssl/t1_lib.c:1055:14: Call 1053. if (s->tlsext_hostname != NULL) { 1054. /* Add TLS extension servername to the Client Hello message */ 1055. if (!WPACKET_put_bytes(pkt, TLSEXT_TYPE_server_name, 2) ^ 1056. /* Sub-packet for server_name extension */ 1057. || !WPACKET_start_sub_packet_u16(pkt) ssl/packet.c:226:1: Parameter `pkt->buf->length` 224. } 225. 226. > int WPACKET_put_bytes(WPACKET *pkt, unsigned int val, size_t size) 227. { 228. unsigned char *data; ssl/t1_lib.c:1057:21: Call 1055. if (!WPACKET_put_bytes(pkt, TLSEXT_TYPE_server_name, 2) 1056. /* Sub-packet for server_name extension */ 1057. || !WPACKET_start_sub_packet_u16(pkt) ^ 1058. /* Sub-packet for servername list (always 1 hostname)*/ 1059. || !WPACKET_start_sub_packet_u16(pkt) ssl/packet.c:190:1: Parameter `pkt->written` 188. } 189. 190. > int WPACKET_start_sub_packet_len(WPACKET *pkt, size_t lenbytes) 191. { 192. WPACKET_SUB *sub; ssl/packet.c:214:10: Call 212. } 213. 214. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 215. return 0; 216. sub->packet_len = lenchars - (unsigned char *)pkt->buf->data; ssl/packet.c:15:1: <LHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `pkt->buf->length` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: <RHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `len` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:25:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + pkt->written + 10]):unsigned64 by call to `WPACKET_start_sub_packet_len` 23. return 0; 24. 25. if (pkt->buf->length - pkt->written < len) { ^ 26. size_t newlen; 27.
https://github.com/openssl/openssl/blob/c0f9e23c6b8d1076796987d5a84557d410682d85/ssl/packet.c/#L25
d2a_code_trace_data_43248
static int flv_write_header(AVFormatContext *s) { ByteIOContext *pb = s->pb; FLVContext *flv = s->priv_data; int i, width, height, samplerate, samplesize, channels, audiocodecid, videocodecid; double framerate = 0.0; int metadata_size_pos, data_size; flv->hasAudio = 0; flv->hasVideo = 0; for(i=0; i<s->nb_streams; i++){ AVCodecContext *enc = s->streams[i]->codec; if (enc->codec_type == CODEC_TYPE_VIDEO) { width = enc->width; height = enc->height; if (s->streams[i]->r_frame_rate.den && s->streams[i]->r_frame_rate.num) { framerate = av_q2d(s->streams[i]->r_frame_rate); } else { framerate = 1/av_q2d(s->streams[i]->codec->time_base); } flv->hasVideo=1; videocodecid = enc->codec_tag; if(videocodecid == 0) { av_log(enc, AV_LOG_ERROR, "video codec not compatible with flv\n"); return -1; } } else { flv->hasAudio=1; samplerate = enc->sample_rate; channels = enc->channels; audiocodecid = enc->codec_tag; samplesize = (enc->codec_id == CODEC_ID_PCM_S8) ? 8 : 16; if(get_audio_flags(enc)<0) return -1; } av_set_pts_info(s->streams[i], 24, 1, 1000); } put_tag(pb,"FLV"); put_byte(pb,1); put_byte(pb, FLV_HEADER_FLAG_HASAUDIO * flv->hasAudio + FLV_HEADER_FLAG_HASVIDEO * flv->hasVideo); put_be32(pb,9); put_be32(pb,0); for(i=0; i<s->nb_streams; i++){ if(s->streams[i]->codec->codec_tag == 5){ put_byte(pb,8); put_be24(pb,0); put_be24(pb,0); put_be32(pb,0); put_be32(pb,11); flv->reserved=5; } } put_byte(pb, 18); metadata_size_pos= url_ftell(pb); put_be24(pb, 0); put_be24(pb, 0); put_be32(pb, 0); put_byte(pb, AMF_DATA_TYPE_STRING); put_amf_string(pb, "onMetaData"); put_byte(pb, AMF_DATA_TYPE_MIXEDARRAY); put_be32(pb, 5*flv->hasVideo + 4*flv->hasAudio + 2); put_amf_string(pb, "duration"); flv->duration_offset= url_ftell(pb); put_amf_double(pb, 0); if(flv->hasVideo){ put_amf_string(pb, "width"); put_amf_double(pb, width); put_amf_string(pb, "height"); put_amf_double(pb, height); put_amf_string(pb, "videodatarate"); put_amf_double(pb, s->bit_rate / 1024.0); put_amf_string(pb, "framerate"); put_amf_double(pb, framerate); put_amf_string(pb, "videocodecid"); put_amf_double(pb, videocodecid); } if(flv->hasAudio){ put_amf_string(pb, "audiosamplerate"); put_amf_double(pb, samplerate); put_amf_string(pb, "audiosamplesize"); put_amf_double(pb, samplesize); put_amf_string(pb, "stereo"); put_amf_bool(pb, (channels == 2)); put_amf_string(pb, "audiocodecid"); put_amf_double(pb, audiocodecid); } put_amf_string(pb, "filesize"); flv->filesize_offset= url_ftell(pb); put_amf_double(pb, 0); put_amf_string(pb, ""); put_byte(pb, AMF_END_OF_OBJECT); data_size= url_ftell(pb) - metadata_size_pos - 10; url_fseek(pb, metadata_size_pos, SEEK_SET); put_be24(pb, data_size); url_fseek(pb, data_size + 10 - 3, SEEK_CUR); put_be32(pb, data_size + 11); return 0; } libavformat/flvenc.c:235: error: Uninitialized Value The value read from audiocodecid was never initialized. libavformat/flvenc.c:235:9: 233. 234. put_amf_string(pb, "audiocodecid"); 235. put_amf_double(pb, audiocodecid); ^ 236. } 237.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/flvenc.c/#L235
d2a_code_trace_data_43249
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dh/dh_key.c:230: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set_locked`. Showing all 26 steps of the trace crypto/dh/dh_key.c:219:2: Call 217. ctx = BN_CTX_new(); 218. if (ctx == NULL) goto err; 219. BN_CTX_start(ctx); ^ 220. tmp = BN_CTX_get(ctx); 221. crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/dh/dh_key.c:230:10: Call 228. if (dh->flags & DH_FLAG_CACHE_MONT_P) 229. { 230. mont = BN_MONT_CTX_set_locked(&dh->method_mont_p, ^ 231. CRYPTO_LOCK_DH, dh->p, ctx); 232. if ((dh->flags & DH_FLAG_NO_EXP_CONSTTIME) == 0) crypto/bn/bn_mont.c:478:1: Parameter `ctx->stack.depth` 476. } 477. 478. > BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock, 479. const BIGNUM *mod, BN_CTX *ctx) 480. { crypto/bn/bn_mont.c:494:16: Call 492. { 493. ret = BN_MONT_CTX_new(); 494. if (ret && !BN_MONT_CTX_set(ret, mod, ctx)) ^ 495. BN_MONT_CTX_free(ret); 496. else crypto/bn/bn_mont.c:355:1: Parameter `ctx->stack.depth` 353. } 354. 355. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 356. { 357. int ret = 0; crypto/bn/bn_mont.c:360:2: Call 358. BIGNUM *Ri,*R; 359. 360. BN_CTX_start(ctx); ^ 361. if((Ri = BN_CTX_get(ctx)) == NULL) goto err; 362. R= &(mont->RR); /* grab RR as a temp */ crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mont.c:421:8: Call 419. tmod.top = buf[0] != 0 ? 1 : 0; 420. /* Ri = R^-1 mod N*/ 421. if ((BN_mod_inverse(Ri,R,&tmod,ctx)) == NULL) ^ 422. goto err; 423. if (!BN_lshift(Ri,Ri,BN_BITS2)) goto err; /* R*Ri */ crypto/bn/bn_gcd.c:209:1: Parameter `ctx->stack.depth` 207. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); 208. 209. > BIGNUM *BN_mod_inverse(BIGNUM *in, 210. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 211. { crypto/bn/bn_gcd.c:218:10: Call 216. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) 217. { 218. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 219. } 220. crypto/bn/bn_gcd.c:507:1: Parameter `ctx->stack.depth` 505. * It does not contain branches that may leak sensitive information. 506. */ 507. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 508. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 509. { crypto/bn/bn_gcd.c:519:2: Call 517. bn_check_top(n); 518. 519. BN_CTX_start(ctx); ^ 520. A = BN_CTX_get(ctx); 521. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gcd.c:548:8: Call 546. pB = &local_B; 547. BN_with_flags(pB, B, BN_FLG_CONSTTIME); 548. if (!BN_nnmod(B, pB, A, ctx)) goto err; ^ 549. } 550. sign = -1; crypto/bn/bn_mod.c:127:1: Parameter `ctx->stack.depth` 125. 126. 127. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 128. { 129. /* like BN_mod, but returns non-negative remainder crypto/bn/bn_mod.c:132:8: Call 130. * (i.e., 0 <= r < |d| always holds) */ 131. 132. if (!(BN_mod(r,m,d,ctx))) ^ 133. return 0; 134. if (!r->neg) crypto/bn/bn_div.c:181:1: Parameter `ctx->stack.depth` 179. * If 'dv' or 'rm' is NULL, the respective value is not returned. 180. */ 181. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 182. BN_CTX *ctx) 183. { crypto/bn/bn_div.c:226:2: Call 224. } 225. 226. BN_CTX_start(ctx); ^ 227. tmp=BN_CTX_get(ctx); 228. snum=BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:441:2: Call 439. } 440. if (no_branch) bn_correct_top(res); 441. BN_CTX_end(ctx); ^ 442. return(1); 443. err: crypto/bn/bn_ctx.c:270:1: Parameter `ctx->stack.depth` 268. } 269. 270. > void BN_CTX_end(BN_CTX *ctx) 271. { 272. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:277:21: Call 275. else 276. { 277. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 278. /* Does this stack frame have anything to release? */ 279. if(fp < ctx->used) crypto/bn/bn_ctx.c:351:1: <LHS trace> 349. } 350. 351. > static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:351:1: Parameter `st->depth` 349. } 350. 351. > static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:353:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set_locked` 351. static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; ^ 354. } 355.
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/bn/bn_ctx.c/#L353
d2a_code_trace_data_43250
static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr, int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], int ref_mv_scale, int flags, int size, int h) { MotionEstContext * const c= &s->me; int best[2]={0, 0}; int d; int dmin; int map_generation; int penalty_factor; const int ref_mv_stride= s->mb_stride; const int ref_mv_xy= s->mb_x + s->mb_y*ref_mv_stride; me_cmp_func cmpf, chroma_cmpf; LOAD_COMMON LOAD_COMMON2 if(c->pre_pass){ penalty_factor= c->pre_penalty_factor; cmpf= s->dsp.me_pre_cmp[size]; chroma_cmpf= s->dsp.me_pre_cmp[size+1]; }else{ penalty_factor= c->penalty_factor; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; } map_generation= update_map_generation(c); assert(cmpf); dmin= cmp(s, 0, 0, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags); map[0]= map_generation; score_map[0]= dmin; if((s->pict_type == FF_B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0) dmin += (mv_penalty[pred_x] + mv_penalty[pred_y])*penalty_factor; if (s->first_slice_line) { CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) }else{ if(dmin<((h*h*s->avctx->mv0_threshold)>>8) && ( P_LEFT[0] |P_LEFT[1] |P_TOP[0] |P_TOP[1] |P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){ *mx_ptr= 0; *my_ptr= 0; c->skip=1; return dmin; } CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift) CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift) CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) } if(dmin>h*h*4){ if(c->pre_pass){ CHECK_CLIPPED_MV((last_mv[ref_mv_xy-1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy-1][1]*ref_mv_scale + (1<<15))>>16) if(!s->first_slice_line) CHECK_CLIPPED_MV((last_mv[ref_mv_xy-ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy-ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) }else{ CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) if(s->mb_y+1<s->end_mb_y) CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) } } if(c->avctx->last_predictor_count){ const int count= c->avctx->last_predictor_count; const int xstart= FFMAX(0, s->mb_x - count); const int ystart= FFMAX(0, s->mb_y - count); const int xend= FFMIN(s->mb_width , s->mb_x + count + 1); const int yend= FFMIN(s->mb_height, s->mb_y + count + 1); int mb_y; for(mb_y=ystart; mb_y<yend; mb_y++){ int mb_x; for(mb_x=xstart; mb_x<xend; mb_x++){ const int xy= mb_x + 1 + (mb_y + 1)*ref_mv_stride; int mx= (last_mv[xy][0]*ref_mv_scale + (1<<15))>>16; int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16; if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue; CHECK_MV(mx,my) } } } dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); *mx_ptr= best[0]; *my_ptr= best[1]; return dmin; } libavcodec/motion_est_template.c:1043: error: Uninitialized Value The value read from ymax was never initialized. libavcodec/motion_est_template.c:1043:9: 1041. /* first line */ 1042. if (s->first_slice_line) { 1043. CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) ^ 1044. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, 1045. (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1043
d2a_code_trace_data_43251
static int parse_oct(const char *t[], PROPERTY_DEFINITION *res) { const char *s = *t; int64_t v = 0; if (*s == '9' || *s == '8' || !ossl_isdigit(*s)) return 0; do { v = (v << 3) + (*s - '0'); } while (ossl_isdigit(*++s) && *s != '9' && *s != '8'); if (!ossl_isspace(*s) && *s != '\0' && *s != ',') { PROPerr(PROP_F_PARSE_OCT, PROP_R_NOT_AN_OCTAL_DIGIT); return 0; } *t = skip_space(s); res->type = PROPERTY_TYPE_NUMBER; res->v.int_val = v; return 1; } test/property_test.c:350: error: BUFFER_OVERRUN_L3 Offset: [2, +oo] (⇐ [1, +oo] + 1) Size: [1, 50] by call to `ossl_method_store_add`. Showing all 23 steps of the trace test/property_test.c:333:1: Array declaration 331. } 332. 333. > static int test_query_cache_stochastic(void) 334. { 335. const int max = 10000, tail = 10; test/property_test.c:350:14: Call 348. v[i] = 2 * i; 349. BIO_snprintf(buf, sizeof(buf), "n=%d\n", i); 350. if (!TEST_true(ossl_method_store_add(store, i, buf, "abc", NULL)) ^ 351. || !TEST_true(ossl_method_store_cache_set(store, i, buf, v + i)) 352. || !TEST_true(ossl_method_store_cache_set(store, i, "n=1234", crypto/property/property.c:176:1: Parameter `*properties` 174. } 175. 176. > int ossl_method_store_add(OSSL_METHOD_STORE *store, 177. int nid, const char *properties, 178. void *method, void (*method_destruct)(void *)) crypto/property/property.c:205:28: Call 203. ossl_method_cache_flush(store, nid); 204. if ((impl->properties = ossl_prop_defn_get(store->ctx, properties)) == NULL) { 205. impl->properties = ossl_parse_property(store->ctx, properties); ^ 206. if (impl->properties == NULL) 207. goto err; crypto/property/property_parse.c:322:1: Parameter `*defn` 320. } 321. 322. > OSSL_PROPERTY_LIST *ossl_parse_property(OPENSSL_CTX *ctx, const char *defn) 323. { 324. PROPERTY_DEFINITION *prop = NULL; crypto/property/property_parse.c:327:5: Assignment 325. OSSL_PROPERTY_LIST *res = NULL; 326. STACK_OF(PROPERTY_DEFINITION) *sk; 327. const char *s = defn; ^ 328. int done; 329. crypto/property/property_parse.c:333:9: Call 331. return NULL; 332. 333. s = skip_space(s); ^ 334. done = *s == '\0'; 335. while (!done) { crypto/property/property_parse.c:52:1: Parameter `*s` 50. DEFINE_STACK_OF(PROPERTY_DEFINITION) 51. 52. > static const char *skip_space(const char *s) 53. { 54. while (ossl_isspace(*s)) crypto/property/property_parse.c:56:5: Assignment 54. while (ossl_isspace(*s)) 55. s++; 56. return s; ^ 57. } 58. crypto/property/property_parse.c:333:5: Assignment 331. return NULL; 332. 333. s = skip_space(s); ^ 334. done = *s == '\0'; 335. while (!done) { crypto/property/property_parse.c:341:14: Call 339. memset(&prop->v, 0, sizeof(prop->v)); 340. prop->optional = 0; 341. if (!parse_name(ctx, &s, 1, &prop->name_idx)) ^ 342. goto err; 343. prop->oper = PROPERTY_OPER_EQ; crypto/property/property_parse.c:83:1: Parameter `**t` 81. } 82. 83. > static int parse_name(OPENSSL_CTX *ctx, const char *t[], int create, 84. OSSL_PROPERTY_IDX *idx) 85. { crypto/property/property_parse.c:348:13: Call 346. goto err; 347. } 348. if (match_ch(&s, '=')) { ^ 349. if (!parse_value(ctx, &s, prop, 1)) { 350. PROPerr(PROP_F_OSSL_PARSE_PROPERTY, PROP_R_NO_VALUE); crypto/property/property_parse.c:59:1: Parameter `**t` 57. } 58. 59. > static int match_ch(const char *t[], char m) 60. { 61. const char *s = *t; crypto/property/property_parse.c:349:18: Call 347. } 348. if (match_ch(&s, '=')) { 349. if (!parse_value(ctx, &s, prop, 1)) { ^ 350. PROPerr(PROP_F_OSSL_PARSE_PROPERTY, PROP_R_NO_VALUE); 351. goto err; crypto/property/property_parse.c:247:1: Parameter `**t` 245. } 246. 247. > static int parse_value(OPENSSL_CTX *ctx, const char *t[], 248. PROPERTY_DEFINITION *res, int create) 249. { crypto/property/property_parse.c:250:5: Assignment 248. PROPERTY_DEFINITION *res, int create) 249. { 250. const char *s = *t; ^ 251. int r = 0; 252. crypto/property/property_parse.c:267:9: Assignment 265. r = parse_hex(&s, res); 266. } else if (*s == '0' && ossl_isdigit(s[1])) { 267. s++; ^ 268. r = parse_oct(&s, res); 269. } else if (ossl_isdigit(*s)) { crypto/property/property_parse.c:268:13: Call 266. } else if (*s == '0' && ossl_isdigit(s[1])) { 267. s++; 268. r = parse_oct(&s, res); ^ 269. } else if (ossl_isdigit(*s)) { 270. return parse_number(t, res); crypto/property/property_parse.c:166:1: <Length trace> 164. } 165. 166. > static int parse_oct(const char *t[], PROPERTY_DEFINITION *res) 167. { 168. const char *s = *t; crypto/property/property_parse.c:166:1: Parameter `**t` 164. } 165. 166. > static int parse_oct(const char *t[], PROPERTY_DEFINITION *res) 167. { 168. const char *s = *t; crypto/property/property_parse.c:168:5: Assignment 166. static int parse_oct(const char *t[], PROPERTY_DEFINITION *res) 167. { 168. const char *s = *t; ^ 169. int64_t v = 0; 170. crypto/property/property_parse.c:175:14: Array access: Offset: [2, +oo] (⇐ [1, +oo] + 1) Size: [1, 50] by call to `ossl_method_store_add` 173. do { 174. v = (v << 3) + (*s - '0'); 175. } while (ossl_isdigit(*++s) && *s != '9' && *s != '8'); ^ 176. if (!ossl_isspace(*s) && *s != '\0' && *s != ',') { 177. PROPerr(PROP_F_PARSE_OCT, PROP_R_NOT_AN_OCTAL_DIGIT);
https://github.com/openssl/openssl/blob/bddf965d29cb4a9c4d6eeb94aa96dfa47d0cfa5d/crypto/property/property_parse.c/#L175
d2a_code_trace_data_43252
static inline void refill_32(BitstreamContext *bc) { if (bc->ptr >= bc->buffer_end) return; #ifdef BITSTREAM_READER_LE bc->bits = (uint64_t)AV_RL32(bc->ptr) << bc->bits_left | bc->bits; #else bc->bits = bc->bits | (uint64_t)AV_RB32(bc->ptr) << (32 - bc->bits_left); #endif bc->ptr += 4; bc->bits_left += 32; } libavcodec/takdec.c:435: error: Integer Overflow L2 (32 - [-1+min(64, `s->bc.bits_left`), -1+max(64, `s->bc.bits_left`)]):unsigned32 by call to `bitstream_read`. libavcodec/takdec.c:422:1: Parameter `s->bc.bits_left` 420. } 421. 422. static int decode_subframe(TAKDecContext *s, int32_t *decoded, ^ 423. int subframe_size, int prev_subframe_size) 424. { libavcodec/takdec.c:432:10: Call 430. memset(filter, 0, MAX_PREDICTORS * sizeof(*filter)); 431. 432. if (!bitstream_read_bit(bc)) ^ 433. return decode_residues(s, decoded, subframe_size); 434. libavcodec/bitstream.h:145:1: Parameter `bc->bits_left` 143. 144. /* Return one bit from the buffer. */ 145. static inline unsigned bitstream_read_bit(BitstreamContext *bc) ^ 146. { 147. if (!bc->bits_left) libavcodec/bitstream.h:150:12: Call 148. refill_64(bc); 149. 150. return get_val(bc, 1); ^ 151. } 152. libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Assignment 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret; libavcodec/takdec.c:435:36: Call 433. return decode_residues(s, decoded, subframe_size); 434. 435. filter_order = predictor_sizes[bitstream_read(bc, 4)]; ^ 436. 437. if (prev_subframe_size > 0 && bitstream_read_bit(bc)) { libavcodec/bitstream.h:183:1: Parameter `n` 181. 182. /* Return n bits from the buffer. n has to be in the 0-32 range. */ 183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n) ^ 184. { 185. if (!n) libavcodec/bitstream.h:189:9: Call 187. 188. if (n > bc->bits_left) { 189. refill_32(bc); ^ 190. if (bc->bits_left < 32) 191. bc->bits_left = n; libavcodec/bitstream.h:60:1: <RHS trace> 58. } 59. 60. static inline void refill_32(BitstreamContext *bc) ^ 61. { 62. if (bc->ptr >= bc->buffer_end) libavcodec/bitstream.h:60:1: Parameter `bc->bits_left` 58. } 59. 60. static inline void refill_32(BitstreamContext *bc) ^ 61. { 62. if (bc->ptr >= bc->buffer_end) libavcodec/bitstream.h:68:5: Binary operation: (32 - [-1+min(64, s->bc.bits_left), -1+max(64, s->bc.bits_left)]):unsigned32 by call to `bitstream_read` 66. bc->bits = (uint64_t)AV_RL32(bc->ptr) << bc->bits_left | bc->bits; 67. #else 68. bc->bits = bc->bits | (uint64_t)AV_RB32(bc->ptr) << (32 - bc->bits_left); ^ 69. #endif 70. bc->ptr += 4;
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L68
d2a_code_trace_data_43253
int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, const char *dir) { DIR *d; struct dirent *dstruct; int ret = 0; CRYPTO_w_lock(CRYPTO_LOCK_READDIR); d = opendir(dir); if(!d) { SYSerr(SYS_F_OPENDIR, get_last_sys_error()); ERR_add_error_data(3, "opendir('", dir, "')"); SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK, ERR_R_SYS_LIB); goto err; } while((dstruct=readdir(d))) { char buf[1024]; int r; if(strlen(dir)+strlen(dstruct->d_name)+2 > sizeof buf) { SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG); goto err; } r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name); if (r <= 0 || r >= sizeof buf) goto err; if(!SSL_add_file_cert_subjects_to_stack(stack,buf)) goto err; } ret = 1; err: CRYPTO_w_unlock(CRYPTO_LOCK_READDIR); return ret; } ssl/ssl_cert.c:773: error: RESOURCE_LEAK resource acquired to `ret` by call to `opendir()` at line 745, column 6 is not released after line 773, column 2. Showing all 13 steps of the trace ssl/ssl_cert.c:737:1: start of procedure SSL_add_dir_cert_subjects_to_stack() 735. #ifndef OPENSSL_SYS_MACINTOSH_CLASSIC /* XXXXX: Better scheme needed! */ 736. 737. > int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, 738. const char *dir) 739. { ssl/ssl_cert.c:742:2: 740. DIR *d; 741. struct dirent *dstruct; 742. > int ret = 0; 743. 744. CRYPTO_w_lock(CRYPTO_LOCK_READDIR); ssl/ssl_cert.c:744:2: 742. int ret = 0; 743. 744. > CRYPTO_w_lock(CRYPTO_LOCK_READDIR); 745. d = opendir(dir); 746. crypto/cryptlib.c:379:1: start of procedure CRYPTO_lock() 377. } 378. 379. > void CRYPTO_lock(int mode, int type, const char *file, int line) 380. { 381. #ifdef LOCK_DEBUG crypto/cryptlib.c:404:6: Taking false branch 402. } 403. #endif 404. if (type < 0) ^ 405. { 406. struct CRYPTO_dynlock_value *pointer crypto/cryptlib.c:417:7: Taking true branch 415. } 416. else 417. if (locking_callback != NULL) ^ 418. locking_callback(mode,type,file,line); 419. } crypto/cryptlib.c:418:4: Skipping __function_pointer__(): unresolved function pointer 416. else 417. if (locking_callback != NULL) 418. locking_callback(mode,type,file,line); ^ 419. } 420. crypto/cryptlib.c:404:2: 402. } 403. #endif 404. > if (type < 0) 405. { 406. struct CRYPTO_dynlock_value *pointer crypto/cryptlib.c:419:2: return from a call to CRYPTO_lock 417. if (locking_callback != NULL) 418. locking_callback(mode,type,file,line); 419. } ^ 420. 421. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, ssl/ssl_cert.c:745:2: 743. 744. CRYPTO_w_lock(CRYPTO_LOCK_READDIR); 745. > d = opendir(dir); 746. 747. /* Note that a side effect is that the CAs will be sorted by name */ ssl/ssl_cert.c:748:6: Taking false branch 746. 747. /* Note that a side effect is that the CAs will be sorted by name */ 748. if(!d) ^ 749. { 750. SYSerr(SYS_F_OPENDIR, get_last_sys_error()); ssl/ssl_cert.c:756:9: Loop condition is false. Leaving loop 754. } 755. 756. while((dstruct=readdir(d))) ^ 757. { 758. char buf[1024]; ssl/ssl_cert.c:773:2: 771. goto err; 772. } 773. > ret = 1; 774. 775. err:
https://github.com/openssl/openssl/blob/4bf4bc784f12bcdc3a3e772f85f6d33f5eccdab3/ssl/ssl_cert.c/#L773