id
stringlengths
25
25
content
stringlengths
649
72.1k
max_stars_repo_path
stringlengths
91
133
d2a_code_trace_data_45554
static inline int encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){ PlaneContext * const p= &s->plane[plane_index]; RangeCoder * const c= &s->c; int x; int run_index= s->run_index; int run_count=0; int run_mode=0; if(s->ac){ if(c->bytestream_end - c->bytestream < w*20){ av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); return -1; } }else{ if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < w*4){ av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); return -1; } } for(x=0; x<w; x++){ int diff, context; context= get_context(s, sample[0]+x, sample[1]+x, sample[2]+x); diff= sample[0][x] - predict(sample[0]+x, sample[1]+x); if(context < 0){ context = -context; diff= -diff; } diff= fold(diff, bits); if(s->ac){ put_symbol(c, p->state[context], diff, 1); }else{ if(context == 0) run_mode=1; if(run_mode){ if(diff){ while(run_count >= 1<<log2_run[run_index]){ run_count -= 1<<log2_run[run_index]; run_index++; put_bits(&s->pb, 1, 1); } put_bits(&s->pb, 1 + log2_run[run_index], run_count); if(run_index) run_index--; run_count=0; run_mode=0; if(diff>0) diff--; }else{ run_count++; } } if(run_mode == 0) put_vlc_symbol(&s->pb, &p->vlc_state[context], diff, bits); } } if(run_mode){ while(run_count >= 1<<log2_run[run_index]){ run_count -= 1<<log2_run[run_index]; run_index++; put_bits(&s->pb, 1, 1); } if(run_count) put_bits(&s->pb, 1, 1); } s->run_index= run_index; return 0; } libavcodec/ffv1.c:454: error: Buffer Overrun L3 Offset: 2 Size: [2, 3] by call to `encode_line`. libavcodec/ffv1.c:438:26: Assignment 436. static void encode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){ 437. int x,y,i; 438. const int ring_size= s->avctx->context_model ? 3 : 2; ^ 439. int_fast16_t sample_buffer[ring_size][w+6], *sample[ring_size]; 440. s->run_index=0; libavcodec/ffv1.c:438:5: Assignment 436. static void encode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){ 437. int x,y,i; 438. const int ring_size= s->avctx->context_model ? 3 : 2; ^ 439. int_fast16_t sample_buffer[ring_size][w+6], *sample[ring_size]; 440. s->run_index=0; libavcodec/ffv1.c:439:57: Array declaration 437. int x,y,i; 438. const int ring_size= s->avctx->context_model ? 3 : 2; 439. int_fast16_t sample_buffer[ring_size][w+6], *sample[ring_size]; ^ 440. s->run_index=0; 441. libavcodec/ffv1.c:454:9: Call 452. sample[0][x]= src[x + stride*y]; 453. } 454. encode_line(s, w, sample, plane_index, 8); ^ 455. //STOP_TIMER("encode line")} 456. } libavcodec/ffv1.c:358:1: <Length trace> 356. 357. #ifdef CONFIG_ENCODERS 358. static inline int encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){ ^ 359. PlaneContext * const p= &s->plane[plane_index]; 360. RangeCoder * const c= &s->c; libavcodec/ffv1.c:358:1: Parameter `*sample` 356. 357. #ifdef CONFIG_ENCODERS 358. static inline int encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){ ^ 359. PlaneContext * const p= &s->plane[plane_index]; 360. RangeCoder * const c= &s->c; libavcodec/ffv1.c:381:59: Array access: Offset: 2 Size: [2, 3] by call to `encode_line` 379. int diff, context; 380. 381. context= get_context(s, sample[0]+x, sample[1]+x, sample[2]+x); ^ 382. diff= sample[0][x] - predict(sample[0]+x, sample[1]+x); 383.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ffv1.c/#L381
d2a_code_trace_data_45555
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); if (BN_get_flags(b, BN_FLG_CONSTTIME) != 0) BN_set_flags(a, BN_FLG_CONSTTIME); a->top = b->top; a->neg = b->neg; bn_check_top(a); return a; } ssl/tls_srp.c:302: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `SRP_Calc_client_key`. Showing all 28 steps of the trace ssl/tls_srp.c:275:1: Parameter `s->srp_ctx.N->top` 273. 274. /* client side */ 275. > int srp_generate_client_master_secret(SSL *s) 276. { 277. BIGNUM *x = NULL, *u = NULL, *K = NULL; ssl/tls_srp.c:285:9: Call 283. * Checks if b % n == 0 284. */ 285. if (SRP_Verify_B_mod_N(s->srp_ctx.B, s->srp_ctx.N) == 0 ^ 286. || (u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) 287. == NULL crypto/srp/srp_lib.c:212:1: Parameter `N->top` 210. } 211. 212. > int SRP_Verify_B_mod_N(const BIGNUM *B, const BIGNUM *N) 213. { 214. BIGNUM *r; ssl/tls_srp.c:286:21: Call 284. */ 285. if (SRP_Verify_B_mod_N(s->srp_ctx.B, s->srp_ctx.N) == 0 286. || (u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) ^ 287. == NULL 288. || s->srp_ctx.SRP_give_srp_client_pwd_callback == NULL) { crypto/srp/srp_lib.c:47:1: Parameter `N->top` 45. } 46. 47. > BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N) 48. { 49. /* k = SHA1(PAD(A) || PAD(B) ) -- tls-srp draft 8 */ crypto/srp/srp_lib.c:50:12: Call 48. { 49. /* k = SHA1(PAD(A) || PAD(B) ) -- tls-srp draft 8 */ 50. return srp_Calc_xy(A, B, N); ^ 51. } 52. crypto/srp/srp_lib.c:19:1: Parameter `N->top` 17. /* calculate = SHA1(PAD(x) || PAD(y)) */ 18. 19. > static BIGNUM *srp_Calc_xy(const BIGNUM *x, const BIGNUM *y, const BIGNUM *N) 20. { 21. unsigned char digest[SHA_DIGEST_LENGTH]; crypto/srp/srp_lib.c:23:16: Call 21. unsigned char digest[SHA_DIGEST_LENGTH]; 22. unsigned char *tmp = NULL; 23. int numN = BN_num_bytes(N); ^ 24. BIGNUM *res = NULL; 25. if (x != N && BN_ucmp(x, N) >= 0) crypto/bn/bn_lib.c:166:9: Call 164. bn_check_top(a); 165. 166. if (BN_is_zero(a)) ^ 167. return 0; 168. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); crypto/bn/bn_lib.c:844:1: Parameter `a->top` 842. } 843. 844. > int BN_is_zero(const BIGNUM *a) 845. { 846. return a->top == 0; ssl/tls_srp.c:302:21: Call 300. } 301. if ((x = SRP_Calc_x(s->srp_ctx.s, s->srp_ctx.login, passwd)) == NULL 302. || (K = SRP_Calc_client_key(s->srp_ctx.N, s->srp_ctx.B, ^ 303. s->srp_ctx.g, x, 304. s->srp_ctx.a, u)) == NULL) { crypto/srp/srp_lib.c:170:1: Parameter `N->top` 168. } 169. 170. > BIGNUM *SRP_Calc_client_key(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g, 171. const BIGNUM *x, const BIGNUM *a, const BIGNUM *u) 172. { crypto/srp/srp_lib.c:185:10: Call 183. goto err; 184. 185. if (!BN_mod_exp(tmp, g, x, N, bn_ctx)) ^ 186. goto err; 187. if ((k = srp_Calc_k(N, g)) == NULL) crypto/bn/bn_exp.c:89:1: Parameter `m->top` 87. } 88. 89. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 90. BN_CTX *ctx) 91. { crypto/bn/bn_exp.c:134:9: Call 132. 133. #ifdef MONT_MUL_MOD 134. if (BN_is_odd(m)) { ^ 135. # ifdef MONT_EXP_WORD 136. if (a->top == 1 && !a->neg crypto/bn/bn_lib.c:859:1: Parameter `a->top` 857. } 858. 859. > int BN_is_odd(const BIGNUM *a) 860. { 861. return (a->top > 0) && (a->d[0] & 1); crypto/bn/bn_exp.c:149:15: Call 147. #ifdef RECP_MUL_MOD 148. { 149. ret = BN_mod_exp_recp(r, a, p, m, ctx); ^ 150. } 151. #else crypto/bn/bn_exp.c:161:1: Parameter `m->top` 159. } 160. 161. > int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 162. const BIGNUM *m, BN_CTX *ctx) 163. { crypto/bn/bn_exp.c:206:13: Call 204. goto err; 205. } else { 206. if (BN_RECP_CTX_set(&recp, m, ctx) <= 0) ^ 207. goto err; 208. } crypto/bn/bn_recp.c:44:1: Parameter `d->top` 42. } 43. 44. > int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *d, BN_CTX *ctx) 45. { 46. if (!BN_copy(&(recp->N), d)) crypto/bn/bn_recp.c:46:10: Call 44. int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *d, BN_CTX *ctx) 45. { 46. if (!BN_copy(&(recp->N), d)) ^ 47. return 0; 48. BN_zero(&(recp->Nr)); crypto/bn/bn_lib.c:312:1: <Offset trace> 310. } 311. 312. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 313. { 314. bn_check_top(b); crypto/bn/bn_lib.c:312:1: Parameter `b->top` 310. } 311. 312. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 313. { 314. bn_check_top(b); crypto/bn/bn_lib.c:312:1: <Length trace> 310. } 311. 312. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 313. { 314. bn_check_top(b); crypto/bn/bn_lib.c:312:1: Parameter `*a->d` 310. } 311. 312. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 313. { 314. bn_check_top(b); crypto/bn/bn_lib.c:318:9: Call 316. if (a == b) 317. return a; 318. if (bn_wexpand(a, b->top) == NULL) ^ 319. return NULL; 320. crypto/bn/bn_lib.c:940:1: Parameter `*a->d` 938. } 939. 940. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 941. { 942. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:322:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `SRP_Calc_client_key` 320. 321. if (b->top > 0) 322. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); ^ 323. 324. if (BN_get_flags(b, BN_FLG_CONSTTIME) != 0)
https://github.com/openssl/openssl/blob/e7d961e994620dd5dee6d80794a07fb9de1bab66/crypto/bn/bn_lib.c/#L322
d2a_code_trace_data_45556
static inline void MPV_motion(MpegEncContext *s, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, int dir, uint8_t **ref_picture, op_pixels_func (*pix_op)[4], qpel_mc_func (*qpix_op)[16]) { int dxy, mx, my, src_x, src_y, motion_x, motion_y; int mb_x, mb_y, i; uint8_t *ptr, *dest; mb_x = s->mb_x; mb_y = s->mb_y; prefetch_motion(s, ref_picture, dir); if(s->obmc && s->pict_type != FF_B_TYPE){ int16_t mv_cache[4][4][2]; const int xy= s->mb_x + s->mb_y*s->mb_stride; const int mot_stride= s->b8_stride; const int mot_xy= mb_x*2 + mb_y*2*mot_stride; assert(!s->mb_skipped); memcpy(mv_cache[1][1], s->current_picture.motion_val[0][mot_xy ], sizeof(int16_t)*4); memcpy(mv_cache[2][1], s->current_picture.motion_val[0][mot_xy+mot_stride], sizeof(int16_t)*4); memcpy(mv_cache[3][1], s->current_picture.motion_val[0][mot_xy+mot_stride], sizeof(int16_t)*4); if(mb_y==0 || IS_INTRA(s->current_picture.mb_type[xy-s->mb_stride])){ memcpy(mv_cache[0][1], mv_cache[1][1], sizeof(int16_t)*4); }else{ memcpy(mv_cache[0][1], s->current_picture.motion_val[0][mot_xy-mot_stride], sizeof(int16_t)*4); } if(mb_x==0 || IS_INTRA(s->current_picture.mb_type[xy-1])){ *(int32_t*)mv_cache[1][0]= *(int32_t*)mv_cache[1][1]; *(int32_t*)mv_cache[2][0]= *(int32_t*)mv_cache[2][1]; }else{ *(int32_t*)mv_cache[1][0]= *(int32_t*)s->current_picture.motion_val[0][mot_xy-1]; *(int32_t*)mv_cache[2][0]= *(int32_t*)s->current_picture.motion_val[0][mot_xy-1+mot_stride]; } if(mb_x+1>=s->mb_width || IS_INTRA(s->current_picture.mb_type[xy+1])){ *(int32_t*)mv_cache[1][3]= *(int32_t*)mv_cache[1][2]; *(int32_t*)mv_cache[2][3]= *(int32_t*)mv_cache[2][2]; }else{ *(int32_t*)mv_cache[1][3]= *(int32_t*)s->current_picture.motion_val[0][mot_xy+2]; *(int32_t*)mv_cache[2][3]= *(int32_t*)s->current_picture.motion_val[0][mot_xy+2+mot_stride]; } mx = 0; my = 0; for(i=0;i<4;i++) { const int x= (i&1)+1; const int y= (i>>1)+1; int16_t mv[5][2]= { {mv_cache[y][x ][0], mv_cache[y][x ][1]}, {mv_cache[y-1][x][0], mv_cache[y-1][x][1]}, {mv_cache[y][x-1][0], mv_cache[y][x-1][1]}, {mv_cache[y][x+1][0], mv_cache[y][x+1][1]}, {mv_cache[y+1][x][0], mv_cache[y+1][x][1]}}; obmc_motion(s, dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize, ref_picture[0], mb_x * 16 + (i & 1) * 8, mb_y * 16 + (i >>1) * 8, pix_op[1], mv); mx += mv[0][0]; my += mv[0][1]; } if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)) chroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], mx, my); return; } switch(s->mv_type) { case MV_TYPE_16X16: if(s->mcsel){ if(s->real_sprite_warping_points==1){ gmc1_motion(s, dest_y, dest_cb, dest_cr, ref_picture); }else{ gmc_motion(s, dest_y, dest_cb, dest_cr, ref_picture); } }else if(s->quarter_sample){ qpel_motion(s, dest_y, dest_cb, dest_cr, 0, 0, 0, ref_picture, pix_op, qpix_op, s->mv[dir][0][0], s->mv[dir][0][1], 16); }else if(ENABLE_WMV2 && s->mspel){ ff_mspel_motion(s, dest_y, dest_cb, dest_cr, ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 16); }else { mpeg_motion(s, dest_y, dest_cb, dest_cr, 0, 0, 0, ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 16); } break; case MV_TYPE_8X8: mx = 0; my = 0; if(s->quarter_sample){ for(i=0;i<4;i++) { motion_x = s->mv[dir][i][0]; motion_y = s->mv[dir][i][1]; dxy = ((motion_y & 3) << 2) | (motion_x & 3); src_x = mb_x * 16 + (motion_x >> 2) + (i & 1) * 8; src_y = mb_y * 16 + (motion_y >> 2) + (i >>1) * 8; src_x = av_clip(src_x, -16, s->width); if (src_x == s->width) dxy &= ~3; src_y = av_clip(src_y, -16, s->height); if (src_y == s->height) dxy &= ~12; ptr = ref_picture[0] + (src_y * s->linesize) + (src_x); if(s->flags&CODEC_FLAG_EMU_EDGE){ if( (unsigned)src_x > s->h_edge_pos - (motion_x&3) - 8 || (unsigned)src_y > s->v_edge_pos - (motion_y&3) - 8 ){ ff_emulated_edge_mc(s->edge_emu_buffer, ptr, s->linesize, 9, 9, src_x, src_y, s->h_edge_pos, s->v_edge_pos); ptr= s->edge_emu_buffer; } } dest = dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize; qpix_op[1][dxy](dest, ptr, s->linesize); mx += s->mv[dir][i][0]/2; my += s->mv[dir][i][1]/2; } }else{ for(i=0;i<4;i++) { hpel_motion(s, dest_y + ((i & 1) * 8) + (i >> 1) * 8 * s->linesize, ref_picture[0], 0, 0, mb_x * 16 + (i & 1) * 8, mb_y * 16 + (i >>1) * 8, s->width, s->height, s->linesize, s->h_edge_pos, s->v_edge_pos, 8, 8, pix_op[1], s->mv[dir][i][0], s->mv[dir][i][1]); mx += s->mv[dir][i][0]; my += s->mv[dir][i][1]; } } if(!ENABLE_GRAY || !(s->flags&CODEC_FLAG_GRAY)) chroma_4mv_motion(s, dest_cb, dest_cr, ref_picture, pix_op[1], mx, my); break; case MV_TYPE_FIELD: if (s->picture_structure == PICT_FRAME) { if(s->quarter_sample){ for(i=0; i<2; i++){ qpel_motion(s, dest_y, dest_cb, dest_cr, 1, i, s->field_select[dir][i], ref_picture, pix_op, qpix_op, s->mv[dir][i][0], s->mv[dir][i][1], 8); } }else{ mpeg_motion(s, dest_y, dest_cb, dest_cr, 1, 0, s->field_select[dir][0], ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 8); mpeg_motion(s, dest_y, dest_cb, dest_cr, 1, 1, s->field_select[dir][1], ref_picture, pix_op, s->mv[dir][1][0], s->mv[dir][1][1], 8); } } else { if(s->picture_structure != s->field_select[dir][0] + 1 && s->pict_type != FF_B_TYPE && !s->first_field){ ref_picture= s->current_picture_ptr->data; } mpeg_motion(s, dest_y, dest_cb, dest_cr, 0, 0, s->field_select[dir][0], ref_picture, pix_op, s->mv[dir][0][0], s->mv[dir][0][1], 16); } break; case MV_TYPE_16X8: for(i=0; i<2; i++){ uint8_t ** ref2picture; if(s->picture_structure == s->field_select[dir][i] + 1 || s->pict_type == FF_B_TYPE || s->first_field){ ref2picture= ref_picture; }else{ ref2picture= s->current_picture_ptr->data; } mpeg_motion(s, dest_y, dest_cb, dest_cr, 0, 0, s->field_select[dir][i], ref2picture, pix_op, s->mv[dir][i][0], s->mv[dir][i][1] + 16*i, 8); dest_y += 16*s->linesize; dest_cb+= (16>>s->chroma_y_shift)*s->uvlinesize; dest_cr+= (16>>s->chroma_y_shift)*s->uvlinesize; } break; case MV_TYPE_DMV: if(s->picture_structure == PICT_FRAME){ for(i=0; i<2; i++){ int j; for(j=0; j<2; j++){ mpeg_motion(s, dest_y, dest_cb, dest_cr, 1, j, j^i, ref_picture, pix_op, s->mv[dir][2*i + j][0], s->mv[dir][2*i + j][1], 8); } pix_op = s->dsp.avg_pixels_tab; } }else{ for(i=0; i<2; i++){ mpeg_motion(s, dest_y, dest_cb, dest_cr, 0, 0, s->picture_structure != i+1, ref_picture, pix_op, s->mv[dir][2*i][0],s->mv[dir][2*i][1],16); pix_op=s->dsp.avg_pixels_tab; if(!s->first_field){ ref_picture = s->current_picture_ptr->data; } } } break; default: assert(0); } } libavcodec/mpegvideo_common.h:619: error: Buffer Overrun L1 Offset added: 8 Size: 4. libavcodec/mpegvideo_common.h:597:1: <Length trace> 595. * the motion vectors are taken from s->mv and the MV type from s->mv_type 596. */ 597. static inline void MPV_motion(MpegEncContext *s, ^ 598. uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, 599. int dir, uint8_t **ref_picture, libavcodec/mpegvideo_common.h:597:1: Array declaration 595. * the motion vectors are taken from s->mv and the MV type from s->mv_type 596. */ 597. static inline void MPV_motion(MpegEncContext *s, ^ 598. uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, 599. int dir, uint8_t **ref_picture, libavcodec/mpegvideo_common.h:619:9: Array access: Offset added: 8 Size: 4 617. assert(!s->mb_skipped); 618. 619. memcpy(mv_cache[1][1], s->current_picture.motion_val[0][mot_xy ], sizeof(int16_t)*4); ^ 620. memcpy(mv_cache[2][1], s->current_picture.motion_val[0][mot_xy+mot_stride], sizeof(int16_t)*4); 621. memcpy(mv_cache[3][1], s->current_picture.motion_val[0][mot_xy+mot_stride], sizeof(int16_t)*4);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo_common.h/#L619
d2a_code_trace_data_45557
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; } r->neg = a->neg; nw = n / BN_BITS2; if (bn_wexpand(r, a->top + nw + 1) == NULL) return (0); 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/bntest.c:1692: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_generate_prime_ex`. Showing all 18 steps of the trace test/bntest.c:1692:10: Call 1690. */ 1691. 1692. if (!BN_generate_prime_ex(b, 512, 0, NULL, NULL, &cb)) ^ 1693. goto err; 1694. b->neg = rand_neg(); crypto/bn/bn_prime.c:101:1: Parameter `add->top` 99. } 100. 101. > int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, 102. const BIGNUM *add, const BIGNUM *rem, BN_GENCB *cb) 103. { crypto/bn/bn_prime.c:142:18: Call 140. goto err; 141. } else { 142. if (!bn_probable_prime_dh(ret, bits, add, rem, ctx)) ^ 143. goto err; 144. } crypto/bn/bn_prime.c:494:1: Parameter `add->top` 492. } 493. 494. > int bn_probable_prime_dh(BIGNUM *rnd, int bits, 495. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx) 496. { crypto/bn/bn_prime.c:509:10: Call 507. /* we need ((rnd-rem) % add) == 0 */ 508. 509. if (!BN_mod(t1, rnd, add, ctx)) ^ 510. goto err; 511. if (!BN_sub(rnd, rnd, t1)) crypto/bn/bn_div.c:205:31: Call 203. 204. /* First we normalise the numbers */ 205. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 206. if (!(BN_lshift(sdiv, divisor, norm_shift))) 207. goto err; crypto/bn/bn_lib.c:167:9: Assignment 165. 166. if (BN_is_zero(a)) 167. return 0; ^ 168. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); 169. } crypto/bn/bn_div.c:205:5: Assignment 203. 204. /* First we normalise the numbers */ 205. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 206. if (!(BN_lshift(sdiv, divisor, norm_shift))) 207. goto err; crypto/bn/bn_div.c:206:11: Call 204. /* First we normalise the numbers */ 205. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); 206. if (!(BN_lshift(sdiv, divisor, norm_shift))) ^ 207. goto err; 208. sdiv->neg = 0; crypto/bn/bn_shift.c:81:1: <Offset trace> 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:81:1: Parameter `n` 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:96:5: Assignment 94. 95. r->neg = a->neg; 96. nw = n / BN_BITS2; ^ 97. if (bn_wexpand(r, a->top + nw + 1) == NULL) 98. return (0); crypto/bn/bn_shift.c:81:1: <Length trace> 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:81:1: Parameter `*r->d` 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:9: Call 95. r->neg = a->neg; 96. nw = n / BN_BITS2; 97. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 98. return (0); 99. lb = n % BN_BITS2; crypto/bn/bn_lib.c:1016:1: Parameter `*a->d` 1014. } 1015. 1016. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 1017. { 1018. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:102:5: Assignment 100. rb = BN_BITS2 - lb; 101. f = a->d; 102. t = r->d; ^ 103. t[a->top + nw] = 0; 104. if (lb == 0) crypto/bn/bn_shift.c:110:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_generate_prime_ex` 108. for (i = a->top - 1; i >= 0; i--) { 109. l = f[i]; 110. t[nw + i + 1] |= (l >> rb) & BN_MASK2; ^ 111. t[nw + i] = (l << lb) & BN_MASK2; 112. }
https://github.com/openssl/openssl/blob/b3618f44a7b8504bfb0a64e8a33e6b8e56d4d516/crypto/bn/bn_shift.c/#L110
d2a_code_trace_data_45558
static ngx_int_t ngx_parse_unix_domain_url(ngx_pool_t *pool, ngx_url_t *u) { #if (NGX_HAVE_UNIX_DOMAIN) u_char *path, *uri, *last; size_t len; struct sockaddr_un *saun; len = u->url.len; path = u->url.data; path += 5; len -= 5; if (u->uri_part) { last = path + len; uri = ngx_strlchr(path, last, ':'); if (uri) { len = uri - path; uri++; u->uri.len = last - uri; u->uri.data = uri; } } if (len == 0) { u->err = "no path in the unix domain socket"; return NGX_ERROR; } u->host.len = len++; u->host.data = path; if (len > sizeof(saun->sun_path)) { u->err = "too long path in the unix domain socket"; return NGX_ERROR; } u->socklen = sizeof(struct sockaddr_un); saun = (struct sockaddr_un *) &u->sockaddr; saun->sun_family = AF_UNIX; (void) ngx_cpystrn((u_char *) saun->sun_path, path, len); u->addrs = ngx_pcalloc(pool, sizeof(ngx_peer_addr_t)); if (u->addrs == NULL) { return NGX_ERROR; } saun = ngx_pcalloc(pool, sizeof(struct sockaddr_un)); if (saun == NULL) { return NGX_ERROR; } u->family = AF_UNIX; u->naddrs = 1; saun->sun_family = AF_UNIX; (void) ngx_cpystrn((u_char *) saun->sun_path, path, len); u->addrs[0].sockaddr = (struct sockaddr *) saun; u->addrs[0].socklen = sizeof(struct sockaddr_un); u->addrs[0].name.len = len + 4; u->addrs[0].name.data = u->url.data; return NGX_OK; #else u->err = "the unix domain sockets are not supported on this platform"; return NGX_ERROR; #endif } src/http/ngx_http_core_module.c:3264: error: Integer Overflow L2 ([0, +oo] - 5):unsigned64 by call to `ngx_parse_url`. src/http/ngx_http_core_module.c:3264:9: Call 3262. u.default_port = 80; 3263. 3264. if (ngx_parse_url(cf->pool, &u) != NGX_OK) { ^ 3265. if (u.err) { 3266. ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, src/core/ngx_inet.c:285:1: Parameter `u->url.len` 283. 284. 285. ngx_int_t ^ 286. ngx_parse_url(ngx_pool_t *pool, ngx_url_t *u) 287. { src/core/ngx_inet.c:293:16: Call 291. 292. if (ngx_strncasecmp(p, (u_char *) "unix:", 5) == 0) { 293. return ngx_parse_unix_domain_url(pool, u); ^ 294. } 295. src/core/ngx_inet.c:309:1: <LHS trace> 307. 308. 309. static ngx_int_t ^ 310. ngx_parse_unix_domain_url(ngx_pool_t *pool, ngx_url_t *u) 311. { src/core/ngx_inet.c:309:1: Parameter `u->url.len` 307. 308. 309. static ngx_int_t ^ 310. ngx_parse_unix_domain_url(ngx_pool_t *pool, ngx_url_t *u) 311. { src/core/ngx_inet.c:317:5: Assignment 315. struct sockaddr_un *saun; 316. 317. len = u->url.len; ^ 318. path = u->url.data; 319. src/core/ngx_inet.c:321:5: Binary operation: ([0, +oo] - 5):unsigned64 by call to `ngx_parse_url` 319. 320. path += 5; 321. len -= 5; ^ 322. 323. if (u->uri_part) {
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_inet.c/#L321
d2a_code_trace_data_45559
static int opt_attach(OptionsContext *o, const char *opt, const char *arg) { o->attachments = grow_array(o->attachments, sizeof(*o->attachments), &o->nb_attachments, o->nb_attachments + 1); o->attachments[o->nb_attachments - 1] = arg; return 0; } avconv.c:2754: error: Null Dereference pointer `o->attachments` last assigned on line 2752 could be null and is dereferenced at line 2754, column 5. avconv.c:2750:1: start of procedure opt_attach() 2748. } 2749. 2750. static int opt_attach(OptionsContext *o, const char *opt, const char *arg) ^ 2751. { 2752. o->attachments = grow_array(o->attachments, sizeof(*o->attachments), avconv.c:2752:5: 2750. static int opt_attach(OptionsContext *o, const char *opt, const char *arg) 2751. { 2752. o->attachments = grow_array(o->attachments, sizeof(*o->attachments), ^ 2753. &o->nb_attachments, o->nb_attachments + 1); 2754. o->attachments[o->nb_attachments - 1] = arg; cmdutils.c:1056:1: start of procedure grow_array() 1054. #endif /* CONFIG_AVFILTER */ 1055. 1056. void *grow_array(void *array, int elem_size, int *size, int new_size) ^ 1057. { 1058. if (new_size >= INT_MAX / elem_size) { cmdutils.c:1058:9: Taking true branch 1056. void *grow_array(void *array, int elem_size, int *size, int new_size) 1057. { 1058. if (new_size >= INT_MAX / elem_size) { ^ 1059. av_log(NULL, AV_LOG_ERROR, "Array too big.\n"); 1060. exit_program(1); cmdutils.c:1059:9: Skipping av_log(): empty list of specs 1057. { 1058. if (new_size >= INT_MAX / elem_size) { 1059. av_log(NULL, AV_LOG_ERROR, "Array too big.\n"); ^ 1060. exit_program(1); 1061. } cmdutils.c:1060:9: Skipping exit_program(): empty list of specs 1058. if (new_size >= INT_MAX / elem_size) { 1059. av_log(NULL, AV_LOG_ERROR, "Array too big.\n"); 1060. exit_program(1); ^ 1061. } 1062. if (*size < new_size) { cmdutils.c:1062:9: Taking true branch 1060. exit_program(1); 1061. } 1062. if (*size < new_size) { ^ 1063. uint8_t *tmp = av_realloc(array, new_size*elem_size); 1064. if (!tmp) { cmdutils.c:1063:9: 1061. } 1062. if (*size < new_size) { 1063. uint8_t *tmp = av_realloc(array, new_size*elem_size); ^ 1064. if (!tmp) { 1065. av_log(NULL, AV_LOG_ERROR, "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) cmdutils.c:1064:14: Taking true branch 1062. if (*size < new_size) { 1063. uint8_t *tmp = av_realloc(array, new_size*elem_size); 1064. if (!tmp) { ^ 1065. av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\n"); 1066. exit_program(1); cmdutils.c:1065:13: Skipping av_log(): empty list of specs 1063. uint8_t *tmp = av_realloc(array, new_size*elem_size); 1064. if (!tmp) { 1065. av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\n"); ^ 1066. exit_program(1); 1067. } cmdutils.c:1066:13: Skipping exit_program(): empty list of specs 1064. if (!tmp) { 1065. av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\n"); 1066. exit_program(1); ^ 1067. } 1068. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); cmdutils.c:1068:9: 1066. exit_program(1); 1067. } 1068. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); ^ 1069. *size = new_size; 1070. return tmp; cmdutils.c:1069:9: 1067. } 1068. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); 1069. *size = new_size; ^ 1070. return tmp; 1071. } cmdutils.c:1070:9: 1068. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); 1069. *size = new_size; 1070. return tmp; ^ 1071. } 1072. return array; cmdutils.c:1073:1: return from a call to grow_array 1071. } 1072. return array; 1073. } ^ avconv.c:2754:5: 2752. o->attachments = grow_array(o->attachments, sizeof(*o->attachments), 2753. &o->nb_attachments, o->nb_attachments + 1); 2754. o->attachments[o->nb_attachments - 1] = arg; ^ 2755. return 0; 2756. }
https://github.com/libav/libav/blob/4bf3c8f226252e18de8051fd0d417c1d39857b67/avconv.c/#L2754
d2a_code_trace_data_45560
int test_sub(BIO *bp) { BIGNUM *a, *b, *c; int i; a = BN_new(); b = BN_new(); c = BN_new(); for (i = 0; i < num0 + num1; i++) { if (i < num1) { BN_bntest_rand(a, 512, 0, 0); BN_copy(b, a); if (BN_set_bit(a, i) == 0) return (0); BN_add_word(b, i); } else { BN_bntest_rand(b, 400 + i - num1, 0, 0); a->neg = rand_neg(); b->neg = rand_neg(); } BN_sub(c, a, b); if (bp != NULL) { if (!results) { BN_print(bp, a); BIO_puts(bp, " - "); BN_print(bp, b); BIO_puts(bp, " - "); } BN_print(bp, c); BIO_puts(bp, "\n"); } BN_add(c, c, b); BN_sub(c, c, a); if (!BN_is_zero(c)) { fprintf(stderr, "Subtract test failed!\n"); return 0; } } BN_free(a); BN_free(b); BN_free(c); return (1); } test/bntest.c:433: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 399, column 9 is not reachable after line 433, column 5. Showing all 82 steps of the trace test/bntest.c:394:1: start of procedure test_sub() 392. } 393. 394. > int test_sub(BIO *bp) 395. { 396. BIGNUM *a, *b, *c; test/bntest.c:399:5: 397. int i; 398. 399. > a = BN_new(); 400. b = BN_new(); 401. 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:400:5: 398. 399. a = BN_new(); 400. > b = BN_new(); 401. c = BN_new(); 402. 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:401:5: 399. a = BN_new(); 400. b = BN_new(); 401. > c = BN_new(); 402. 403. for (i = 0; i < num0 + num1; i++) { 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:403:10: 401. c = BN_new(); 402. 403. > for (i = 0; i < num0 + num1; i++) { 404. if (i < num1) { 405. BN_bntest_rand(a, 512, 0, 0); test/bntest.c:403:17: Loop condition is false. Leaving loop 401. c = BN_new(); 402. 403. for (i = 0; i < num0 + num1; i++) { ^ 404. if (i < num1) { 405. BN_bntest_rand(a, 512, 0, 0); test/bntest.c:433:5: 431. } 432. } 433. > BN_free(a); 434. BN_free(b); 435. BN_free(c); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) 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:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a)
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L433
d2a_code_trace_data_45561
static ngx_int_t ngx_http_uwsgi_create_request(ngx_http_request_t *r) { u_char ch, *lowcase_key; size_t key_len, val_len, len, allocated; ngx_uint_t i, n, hash, skip_empty, header_params; ngx_buf_t *b; ngx_chain_t *cl, *body; ngx_list_part_t *part; ngx_table_elt_t *header, **ignored; ngx_http_uwsgi_params_t *params; ngx_http_script_code_pt code; ngx_http_script_engine_t e, le; ngx_http_uwsgi_loc_conf_t *uwcf; ngx_http_script_len_code_pt lcode; len = 0; header_params = 0; ignored = NULL; uwcf = ngx_http_get_module_loc_conf(r, ngx_http_uwsgi_module); #if (NGX_HTTP_CACHE) params = r->upstream->cacheable ? &uwcf->params_cache : &uwcf->params; #else params = &uwcf->params; #endif if (params->lengths) { ngx_memzero(&le, sizeof(ngx_http_script_engine_t)); ngx_http_script_flush_no_cacheable_variables(r, params->flushes); le.flushed = 1; le.ip = params->lengths->elts; le.request = r; while (*(uintptr_t *) le.ip) { lcode = *(ngx_http_script_len_code_pt *) le.ip; key_len = lcode(&le); lcode = *(ngx_http_script_len_code_pt *) le.ip; skip_empty = lcode(&le); for (val_len = 0; *(uintptr_t *) le.ip; val_len += lcode(&le)) { lcode = *(ngx_http_script_len_code_pt *) le.ip; } le.ip += sizeof(uintptr_t); if (skip_empty && val_len == 0) { continue; } len += 2 + key_len + 2 + val_len; } } if (uwcf->upstream.pass_request_headers) { allocated = 0; lowcase_key = NULL; if (params->number) { n = 0; part = &r->headers_in.headers.part; while (part) { n += part->nelts; part = part->next; } ignored = ngx_palloc(r->pool, n * sizeof(void *)); if (ignored == NULL) { return NGX_ERROR; } } part = &r->headers_in.headers.part; header = part->elts; for (i = 0; ; i++) { if (i >= part->nelts) { if (part->next == NULL) { break; } part = part->next; header = part->elts; i = 0; } if (params->number) { if (allocated < header[i].key.len) { allocated = header[i].key.len + 16; lowcase_key = ngx_pnalloc(r->pool, allocated); if (lowcase_key == NULL) { return NGX_ERROR; } } hash = 0; for (n = 0; n < header[i].key.len; n++) { ch = header[i].key.data[n]; if (ch >= 'A' && ch <= 'Z') { ch |= 0x20; } else if (ch == '-') { ch = '_'; } hash = ngx_hash(hash, ch); lowcase_key[n] = ch; } if (ngx_hash_find(&params->hash, hash, lowcase_key, n)) { ignored[header_params++] = &header[i]; continue; } } len += 2 + sizeof("HTTP_") - 1 + header[i].key.len + 2 + header[i].value.len; } } len += uwcf->uwsgi_string.len; #if 0 if (len > 0 && len < 2) { ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, "uwsgi request is too little: %uz", len); return NGX_ERROR; } #endif if (len > 65535) { ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0, "uwsgi request is too big: %uz", len); return NGX_ERROR; } b = ngx_create_temp_buf(r->pool, len + 4); if (b == NULL) { return NGX_ERROR; } cl = ngx_alloc_chain_link(r->pool); if (cl == NULL) { return NGX_ERROR; } cl->buf = b; *b->last++ = (u_char) uwcf->modifier1; *b->last++ = (u_char) (len & 0xff); *b->last++ = (u_char) ((len >> 8) & 0xff); *b->last++ = (u_char) uwcf->modifier2; if (params->lengths) { ngx_memzero(&e, sizeof(ngx_http_script_engine_t)); e.ip = params->values->elts; e.pos = b->last; e.request = r; e.flushed = 1; le.ip = params->lengths->elts; while (*(uintptr_t *) le.ip) { lcode = *(ngx_http_script_len_code_pt *) le.ip; key_len = (u_char) lcode(&le); lcode = *(ngx_http_script_len_code_pt *) le.ip; skip_empty = lcode(&le); for (val_len = 0; *(uintptr_t *) le.ip; val_len += lcode(&le)) { lcode = *(ngx_http_script_len_code_pt *) le.ip; } le.ip += sizeof(uintptr_t); if (skip_empty && val_len == 0) { e.skip = 1; while (*(uintptr_t *) e.ip) { code = *(ngx_http_script_code_pt *) e.ip; code((ngx_http_script_engine_t *) &e); } e.ip += sizeof(uintptr_t); e.skip = 0; continue; } *e.pos++ = (u_char) (key_len & 0xff); *e.pos++ = (u_char) ((key_len >> 8) & 0xff); code = *(ngx_http_script_code_pt *) e.ip; code((ngx_http_script_engine_t *) &e); *e.pos++ = (u_char) (val_len & 0xff); *e.pos++ = (u_char) ((val_len >> 8) & 0xff); while (*(uintptr_t *) e.ip) { code = *(ngx_http_script_code_pt *) e.ip; code((ngx_http_script_engine_t *) &e); } e.ip += sizeof(uintptr_t); ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "uwsgi param: \"%*s: %*s\"", key_len, e.pos - (key_len + 2 + val_len), val_len, e.pos - val_len); } b->last = e.pos; } if (uwcf->upstream.pass_request_headers) { part = &r->headers_in.headers.part; header = part->elts; for (i = 0; ; i++) { if (i >= part->nelts) { if (part->next == NULL) { break; } part = part->next; header = part->elts; i = 0; } for (n = 0; n < header_params; n++) { if (&header[i] == ignored[n]) { goto next; } } key_len = sizeof("HTTP_") - 1 + header[i].key.len; *b->last++ = (u_char) (key_len & 0xff); *b->last++ = (u_char) ((key_len >> 8) & 0xff); b->last = ngx_cpymem(b->last, "HTTP_", sizeof("HTTP_") - 1); for (n = 0; n < header[i].key.len; n++) { ch = header[i].key.data[n]; if (ch >= 'a' && ch <= 'z') { ch &= ~0x20; } else if (ch == '-') { ch = '_'; } *b->last++ = ch; } val_len = header[i].value.len; *b->last++ = (u_char) (val_len & 0xff); *b->last++ = (u_char) ((val_len >> 8) & 0xff); b->last = ngx_copy(b->last, header[i].value.data, val_len); ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "uwsgi param: \"%*s: %*s\"", key_len, b->last - (key_len + 2 + val_len), val_len, b->last - val_len); next: continue; } } b->last = ngx_copy(b->last, uwcf->uwsgi_string.data, uwcf->uwsgi_string.len); if (r->request_body_no_buffering) { r->upstream->request_bufs = cl; } else if (uwcf->upstream.pass_request_body) { body = r->upstream->request_bufs; r->upstream->request_bufs = cl; while (body) { b = ngx_alloc_buf(r->pool); if (b == NULL) { return NGX_ERROR; } ngx_memcpy(b, body->buf, sizeof(ngx_buf_t)); cl->next = ngx_alloc_chain_link(r->pool); if (cl->next == NULL) { return NGX_ERROR; } cl = cl->next; cl->buf = b; body = body->next; } } else { r->upstream->request_bufs = cl; } cl->next = NULL; return NGX_OK; } src/http/modules/ngx_http_uwsgi_module.c:1075: error: Buffer Overrun L3 Offset added: [5, +oo] (⇐ [0, +oo] + 5) Size: [0, 65539]. src/http/modules/ngx_http_uwsgi_module.c:1075:13: <Length trace> 1073. *b->last++ = (u_char) ((key_len >> 8) & 0xff); 1074. 1075. b->last = ngx_cpymem(b->last, "HTTP_", sizeof("HTTP_") - 1); ^ 1076. for (n = 0; n < header[i].key.len; n++) { 1077. ch = header[i].key.data[n]; src/http/modules/ngx_http_uwsgi_module.c:1075:13: Assignment 1073. *b->last++ = (u_char) ((key_len >> 8) & 0xff); 1074. 1075. b->last = ngx_cpymem(b->last, "HTTP_", sizeof("HTTP_") - 1); ^ 1076. for (n = 0; n < header[i].key.len; n++) { 1077. ch = header[i].key.data[n]; src/http/modules/ngx_http_uwsgi_module.c:1075:23: Array access: Offset added: [5, +oo] (⇐ [0, +oo] + 5) Size: [0, 65539] 1073. *b->last++ = (u_char) ((key_len >> 8) & 0xff); 1074. 1075. b->last = ngx_cpymem(b->last, "HTTP_", sizeof("HTTP_") - 1); ^ 1076. for (n = 0; n < header[i].key.len; n++) { 1077. ch = header[i].key.data[n];
https://github.com/nginx/nginx/blob/b71792b11086d9df748f36d02f93d360d135cd7c/src/http/modules/ngx_http_uwsgi_module.c/#L1075
d2a_code_trace_data_45562
void *lh_delete(LHASH *lh, const void *data) { unsigned long hash; LHASH_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); } apps/ciphers.c:203: error: INTEGER_OVERFLOW_L1 (0 - 1):unsigned64 by call to `SSL_free`. Showing all 15 steps of the trace apps/ciphers.c:159:6: Call 157. OpenSSL_add_ssl_algorithms(); 158. 159. ctx=SSL_CTX_new(meth); ^ 160. if (ctx == NULL) goto err; 161. if (ciphers != NULL) { ssl/ssl_lib.c:1403:16: Call 1401. ret->app_verify_cookie_cb=0; 1402. 1403. ret->sessions=lh_new(LHASH_HASH_FN(SSL_SESSION_hash), ^ 1404. LHASH_COMP_FN(SSL_SESSION_cmp)); 1405. if (ret->sessions == NULL) goto err; crypto/lhash/lhash.c:133:2: Assignment 131. ret->up_load=UP_LOAD; 132. ret->down_load=DOWN_LOAD; 133. ret->num_items=0; ^ 134. 135. ret->num_expands=0; apps/ciphers.c:203:19: Call 201. end: 202. if (ctx != NULL) SSL_CTX_free(ctx); 203. if (ssl != NULL) SSL_free(ssl); ^ 204. if (STDout != NULL) BIO_free_all(STDout); 205. apps_shutdown(); ssl/ssl_lib.c:427:1: Parameter `s->ctx->sessions->num_items` 425. } 426. 427. > void SSL_free(SSL *s) 428. { 429. int i; ssl/ssl_lib.c:476:3: Call 474. if (s->session != NULL) 475. { 476. ssl_clear_bad_session(s); ^ 477. SSL_SESSION_free(s->session); 478. } ssl/ssl_sess.c:700:1: Parameter `s->ctx->sessions->num_items` 698. } 699. 700. > int ssl_clear_bad_session(SSL *s) 701. { 702. if ( (s->session != NULL) && ssl/ssl_sess.c:706:3: Call 704. !(SSL_in_init(s) || SSL_in_before(s))) 705. { 706. SSL_CTX_remove_session(s->ctx,s->session); ^ 707. return(1); 708. } ssl/ssl_sess.c:486:1: Parameter `ctx->sessions->num_items` 484. } 485. 486. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 487. { 488. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:488:9: Call 486. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 487. { 488. return remove_session_lock(ctx, c, 1); ^ 489. } 490. ssl/ssl_sess.c:491:1: Parameter `ctx->sessions->num_items` 489. } 490. 491. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 492. { 493. SSL_SESSION *r; ssl/ssl_sess.c:502:21: Call 500. { 501. ret=1; 502. r=(SSL_SESSION *)lh_delete(ctx->sessions,c); ^ 503. SSL_SESSION_list_remove(ctx,c); 504. } crypto/lhash/lhash.c:217:1: <LHS trace> 215. } 216. 217. > void *lh_delete(LHASH *lh, const void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:217:1: Parameter `lh->num_items` 215. } 216. 217. > void *lh_delete(LHASH *lh, const void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:240:2: Binary operation: (0 - 1):unsigned64 by call to `SSL_free` 238. } 239. 240. lh->num_items--; ^ 241. if ((lh->num_nodes > MIN_NODES) && 242. (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)))
https://github.com/openssl/openssl/blob/a761b89d2feac31acb9acf01b4a5c6694c9064db/crypto/lhash/lhash.c/#L240
d2a_code_trace_data_45563
static int load_record(SSL3_RECORD *rec, RECORD_DATA *recd, unsigned char **key, unsigned char *iv, size_t ivlen, unsigned char *seq) { unsigned char *pt = NULL, *sq = NULL, *ivtmp = NULL; size_t ptlen; *key = OPENSSL_hexstr2buf(recd->key, NULL); ivtmp = OPENSSL_hexstr2buf(recd->iv, NULL); sq = OPENSSL_hexstr2buf(recd->seq, NULL); pt = multihexstr2buf(recd->plaintext, &ptlen); if (*key == NULL || ivtmp == NULL || sq == NULL || pt == NULL) goto err; rec->data = rec->input = OPENSSL_malloc(ptlen + EVP_GCM_TLS_TAG_LEN); if (rec->data == NULL) goto err; rec->length = ptlen; memcpy(rec->data, pt, ptlen); OPENSSL_free(pt); memcpy(seq, sq, SEQ_NUM_SIZE); OPENSSL_free(sq); memcpy(iv, ivtmp, ivlen); OPENSSL_free(ivtmp); return 1; err: OPENSSL_free(*key); *key = NULL; OPENSSL_free(ivtmp); OPENSSL_free(sq); OPENSSL_free(pt); return 0; } test/tls13encryptiontest.c:330: error: BUFFER_OVERRUN_L3 Offset added: 8 Size: [1, +oo] by call to `load_record`. Showing all 9 steps of the trace test/tls13encryptiontest.c:360:14: Call 358. 359. /* Decrypt it */ 360. if (!TEST_int_eq(tls13_enc(s, &rec, 1, 0), 1)) { ^ 361. TEST_info("Failed to decrypt record %"OSSLzu"", ctr); 362. goto err; ssl/record/ssl3_record_tls13.c:24:1: Parameter `recs->data->strlen` 22. * an internal error occurred. 23. */ 24. > int tls13_enc(SSL *s, SSL3_RECORD *recs, size_t n_recs, int send) 25. { 26. EVP_CIPHER_CTX *ctx; test/tls13encryptiontest.c:330:14: Call 328. /* Load the record */ 329. ivlen = EVP_CIPHER_iv_length(ciph); 330. if (!load_record(&rec, &refdata[ctr], &key, s->read_iv, ivlen, ^ 331. RECORD_LAYER_get_read_sequence(&s->rlayer))) { 332. TEST_error("Failed loading key into EVP_CIPHER_CTX"); test/tls13encryptiontest.c:224:1: <Length trace> 222. } 223. 224. > static int load_record(SSL3_RECORD *rec, RECORD_DATA *recd, unsigned char **key, 225. unsigned char *iv, size_t ivlen, unsigned char *seq) 226. { test/tls13encryptiontest.c:224:1: Parameter `recd->seq->strlen` 222. } 223. 224. > static int load_record(SSL3_RECORD *rec, RECORD_DATA *recd, unsigned char **key, 225. unsigned char *iv, size_t ivlen, unsigned char *seq) 226. { test/tls13encryptiontest.c:232:10: Call 230. *key = OPENSSL_hexstr2buf(recd->key, NULL); 231. ivtmp = OPENSSL_hexstr2buf(recd->iv, NULL); 232. sq = OPENSSL_hexstr2buf(recd->seq, NULL); ^ 233. pt = multihexstr2buf(recd->plaintext, &ptlen); 234. crypto/o_str.c:161:9: Assignment 159. if ((hexbuf = OPENSSL_malloc(s >> 1)) == NULL) { 160. CRYPTOerr(CRYPTO_F_OPENSSL_HEXSTR2BUF, ERR_R_MALLOC_FAILURE); 161. return NULL; ^ 162. } 163. for (p = (const unsigned char *)str, q = hexbuf; *p; ) { test/tls13encryptiontest.c:232:5: Assignment 230. *key = OPENSSL_hexstr2buf(recd->key, NULL); 231. ivtmp = OPENSSL_hexstr2buf(recd->iv, NULL); 232. sq = OPENSSL_hexstr2buf(recd->seq, NULL); ^ 233. pt = multihexstr2buf(recd->plaintext, &ptlen); 234. test/tls13encryptiontest.c:246:5: Array access: Offset added: 8 Size: [1, +oo] by call to `load_record` 244. memcpy(rec->data, pt, ptlen); 245. OPENSSL_free(pt); 246. memcpy(seq, sq, SEQ_NUM_SIZE); ^ 247. OPENSSL_free(sq); 248. memcpy(iv, ivtmp, ivlen);
https://github.com/openssl/openssl/blob/3fd5ece39b59d938d0cc84b8e5148d19044d15cf/test/tls13encryptiontest.c/#L246
d2a_code_trace_data_45564
static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) { AVIContext *avi = s->priv_data; ByteIOContext *pb = s->pb; uint32_t tag, tag1, handler; int codec_type, stream_index, frame_period, bit_rate; unsigned int size, nb_frames; int i; AVStream *st; AVIStream *ast = NULL; char str_track[4]; int avih_width=0, avih_height=0; int amv_file_format=0; avi->stream_index= -1; if (get_riff(avi, pb) < 0) return -1; avi->fsize = url_fsize(pb); if(avi->fsize<=0) avi->fsize= avi->riff_end; stream_index = -1; codec_type = -1; frame_period = 0; for(;;) { if (url_feof(pb)) goto fail; tag = get_le32(pb); size = get_le32(pb); #ifdef DEBUG print_tag("tag", tag, size); #endif switch(tag) { case MKTAG('L', 'I', 'S', 'T'): tag1 = get_le32(pb); #ifdef DEBUG print_tag("list", tag1, 0); #endif if (tag1 == MKTAG('m', 'o', 'v', 'i')) { avi->movi_list = url_ftell(pb) - 4; if(size) avi->movi_end = avi->movi_list + size + (size & 1); else avi->movi_end = url_fsize(pb); #ifdef DEBUG printf("movi end=%"PRIx64"\n", avi->movi_end); #endif goto end_of_header; } break; case MKTAG('d', 'm', 'l', 'h'): avi->is_odml = 1; url_fskip(pb, size + (size & 1)); break; case MKTAG('a', 'm', 'v', 'h'): amv_file_format=1; case MKTAG('a', 'v', 'i', 'h'): frame_period = get_le32(pb); bit_rate = get_le32(pb) * 8; get_le32(pb); avi->non_interleaved |= get_le32(pb) & AVIF_MUSTUSEINDEX; url_fskip(pb, 2 * 4); get_le32(pb); get_le32(pb); avih_width=get_le32(pb); avih_height=get_le32(pb); url_fskip(pb, size - 10 * 4); break; case MKTAG('s', 't', 'r', 'h'): tag1 = get_le32(pb); handler = get_le32(pb); if(tag1 == MKTAG('p', 'a', 'd', 's')){ url_fskip(pb, size - 8); break; }else{ stream_index++; st = av_new_stream(s, stream_index); if (!st) goto fail; ast = av_mallocz(sizeof(AVIStream)); if (!ast) goto fail; st->priv_data = ast; } if(amv_file_format) tag1 = stream_index ? MKTAG('a','u','d','s') : MKTAG('v','i','d','s'); #ifdef DEBUG print_tag("strh", tag1, -1); #endif if(tag1 == MKTAG('i', 'a', 'v', 's') || tag1 == MKTAG('i', 'v', 'a', 's')){ int64_t dv_dur; if (s->nb_streams != 1) goto fail; if (handler != MKTAG('d', 'v', 's', 'd') && handler != MKTAG('d', 'v', 'h', 'd') && handler != MKTAG('d', 'v', 's', 'l')) goto fail; ast = s->streams[0]->priv_data; av_freep(&s->streams[0]->codec->extradata); av_freep(&s->streams[0]); s->nb_streams = 0; if (ENABLE_DV_DEMUXER) { avi->dv_demux = dv_init_demux(s); if (!avi->dv_demux) goto fail; } s->streams[0]->priv_data = ast; url_fskip(pb, 3 * 4); ast->scale = get_le32(pb); ast->rate = get_le32(pb); url_fskip(pb, 4); dv_dur = get_le32(pb); if (ast->scale > 0 && ast->rate > 0 && dv_dur > 0) { dv_dur *= AV_TIME_BASE; s->duration = av_rescale(dv_dur, ast->scale, ast->rate); } stream_index = s->nb_streams - 1; url_fskip(pb, size - 9*4); break; } assert(stream_index < s->nb_streams); st->codec->stream_codec_tag= handler; get_le32(pb); get_le16(pb); get_le16(pb); get_le32(pb); ast->scale = get_le32(pb); ast->rate = get_le32(pb); if(ast->scale && ast->rate){ }else if(frame_period){ ast->rate = 1000000; ast->scale = frame_period; }else{ ast->rate = 25; ast->scale = 1; } av_set_pts_info(st, 64, ast->scale, ast->rate); ast->cum_len=get_le32(pb); nb_frames = get_le32(pb); st->start_time = 0; st->duration = nb_frames; get_le32(pb); get_le32(pb); ast->sample_size = get_le32(pb); ast->cum_len *= FFMAX(1, ast->sample_size); switch(tag1) { case MKTAG('v', 'i', 'd', 's'): codec_type = CODEC_TYPE_VIDEO; ast->sample_size = 0; break; case MKTAG('a', 'u', 'd', 's'): codec_type = CODEC_TYPE_AUDIO; break; case MKTAG('t', 'x', 't', 's'): codec_type = CODEC_TYPE_DATA; break; default: av_log(s, AV_LOG_ERROR, "unknown stream type %X\n", tag1); goto fail; } ast->frame_offset= ast->cum_len; url_fskip(pb, size - 12 * 4); break; case MKTAG('s', 't', 'r', 'f'): if (stream_index >= (unsigned)s->nb_streams || avi->dv_demux) { url_fskip(pb, size); } else { st = s->streams[stream_index]; switch(codec_type) { case CODEC_TYPE_VIDEO: if(amv_file_format){ st->codec->width=avih_width; st->codec->height=avih_height; st->codec->codec_type = CODEC_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_AMV; url_fskip(pb, size); break; } get_le32(pb); st->codec->width = get_le32(pb); st->codec->height = get_le32(pb); get_le16(pb); st->codec->bits_per_sample= get_le16(pb); tag1 = get_le32(pb); get_le32(pb); get_le32(pb); get_le32(pb); get_le32(pb); get_le32(pb); if (tag1 == MKTAG('D', 'X', 'S', 'B')) { st->codec->codec_type = CODEC_TYPE_SUBTITLE; st->codec->codec_tag = tag1; st->codec->codec_id = CODEC_ID_XSUB; break; } if(size > 10*4 && size<(1<<30)){ st->codec->extradata_size= size - 10*4; st->codec->extradata= av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); get_buffer(pb, st->codec->extradata, st->codec->extradata_size); } if(st->codec->extradata_size & 1) get_byte(pb); if (st->codec->extradata_size && (st->codec->bits_per_sample <= 8)) { st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl)); #ifdef WORDS_BIGENDIAN for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++) st->codec->palctrl->palette[i] = bswap_32(((uint32_t*)st->codec->extradata)[i]); #else memcpy(st->codec->palctrl->palette, st->codec->extradata, FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)); #endif st->codec->palctrl->palette_changed = 1; } #ifdef DEBUG print_tag("video", tag1, 0); #endif st->codec->codec_type = CODEC_TYPE_VIDEO; st->codec->codec_tag = tag1; st->codec->codec_id = codec_get_id(codec_bmp_tags, tag1); st->need_parsing = AVSTREAM_PARSE_HEADERS; break; case CODEC_TYPE_AUDIO: get_wav_header(pb, st->codec, size); if(ast->sample_size && st->codec->block_align && ast->sample_size != st->codec->block_align){ av_log(s, AV_LOG_WARNING, "sample size (%d) != block align (%d)\n", ast->sample_size, st->codec->block_align); ast->sample_size= st->codec->block_align; } if (size%2) url_fskip(pb, 1); st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS; if (st->codec->codec_id == CODEC_ID_AAC && st->codec->extradata_size) st->need_parsing = AVSTREAM_PARSE_NONE; if (st->codec->stream_codec_tag == ff_get_fourcc("Axan")){ st->codec->codec_id = CODEC_ID_XAN_DPCM; st->codec->codec_tag = 0; } if (amv_file_format) st->codec->codec_id = CODEC_ID_ADPCM_IMA_AMV; break; default: st->codec->codec_type = CODEC_TYPE_DATA; st->codec->codec_id= CODEC_ID_NONE; st->codec->codec_tag= 0; url_fskip(pb, size); break; } } break; case MKTAG('i', 'n', 'd', 'x'): i= url_ftell(pb); if(!url_is_streamed(pb) && !(s->flags & AVFMT_FLAG_IGNIDX)){ read_braindead_odml_indx(s, 0); } url_fseek(pb, i+size, SEEK_SET); break; case MKTAG('v', 'p', 'r', 'p'): if(stream_index < (unsigned)s->nb_streams && size > 9*4){ AVRational active, active_aspect; st = s->streams[stream_index]; get_le32(pb); get_le32(pb); get_le32(pb); get_le32(pb); get_le32(pb); active_aspect.den= get_le16(pb); active_aspect.num= get_le16(pb); active.num = get_le32(pb); active.den = get_le32(pb); get_le32(pb); if(active_aspect.num && active_aspect.den && active.num && active.den){ st->codec->sample_aspect_ratio= av_div_q(active_aspect, active); } size -= 9*4; } url_fseek(pb, size, SEEK_CUR); break; case MKTAG('I', 'N', 'A', 'M'): avi_read_tag(pb, s->title, sizeof(s->title), size); break; case MKTAG('I', 'A', 'R', 'T'): avi_read_tag(pb, s->author, sizeof(s->author), size); break; case MKTAG('I', 'C', 'O', 'P'): avi_read_tag(pb, s->copyright, sizeof(s->copyright), size); break; case MKTAG('I', 'C', 'M', 'T'): avi_read_tag(pb, s->comment, sizeof(s->comment), size); break; case MKTAG('I', 'G', 'N', 'R'): avi_read_tag(pb, s->genre, sizeof(s->genre), size); break; case MKTAG('I', 'P', 'R', 'D'): avi_read_tag(pb, s->album, sizeof(s->album), size); break; case MKTAG('I', 'P', 'R', 'T'): avi_read_tag(pb, str_track, sizeof(str_track), size); sscanf(str_track, "%d", &s->track); break; default: if(size > 1000000){ av_log(s, AV_LOG_ERROR, "well something went wrong during header parsing, " "ill ignore it and try to continue anyway\n"); avi->movi_list = url_ftell(pb) - 4; avi->movi_end = url_fsize(pb); goto end_of_header; } size += (size & 1); url_fskip(pb, size); break; } } end_of_header: if (stream_index != s->nb_streams - 1) { fail: for(i=0;i<s->nb_streams;i++) { av_freep(&s->streams[i]->codec->extradata); av_freep(&s->streams[i]); } return -1; } if(!avi->index_loaded && !url_is_streamed(pb)) avi_load_index(s); avi->index_loaded = 1; avi->non_interleaved |= guess_ni_flag(s); if(avi->non_interleaved) clean_index(s); return 0; } libavformat/avidec.c:368: error: Integer Overflow L2 ([0, 20] - 1):unsigned32. libavformat/avidec.c:346:17: <LHS trace> 344. av_freep(&s->streams[0]->codec->extradata); 345. av_freep(&s->streams[0]); 346. s->nb_streams = 0; ^ 347. if (ENABLE_DV_DEMUXER) { 348. avi->dv_demux = dv_init_demux(s); libavformat/avidec.c:346:17: Assignment 344. av_freep(&s->streams[0]->codec->extradata); 345. av_freep(&s->streams[0]); 346. s->nb_streams = 0; ^ 347. if (ENABLE_DV_DEMUXER) { 348. avi->dv_demux = dv_init_demux(s); libavformat/avidec.c:348:37: Call 346. s->nb_streams = 0; 347. if (ENABLE_DV_DEMUXER) { 348. avi->dv_demux = dv_init_demux(s); ^ 349. if (!avi->dv_demux) 350. goto fail; libavformat/dv.c:263:1: Parameter `s->nb_streams` 261. */ 262. 263. DVDemuxContext* dv_init_demux(AVFormatContext *s) ^ 264. { 265. DVDemuxContext *c; libavformat/avidec.c:368:17: Binary operation: ([0, 20] - 1):unsigned32 366. */ 367. 368. stream_index = s->nb_streams - 1; ^ 369. url_fskip(pb, size - 9*4); 370. break;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/avidec.c/#L368
d2a_code_trace_data_45565
int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) { PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | (diff > (0 - (PTRDIFF_T)len))); return overlapped; } crypto/cms/cms_kari.c:211: error: INTEGER_OVERFLOW_L2 (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate`. Showing all 9 steps of the trace crypto/cms/cms_kari.c:211:10: Call 209. if (out == NULL) 210. goto err; 211. if (!EVP_CipherUpdate(kari->ctx, out, &outlen, in, inlen)) ^ 212. goto err; 213. *pout = out; crypto/evp/evp_enc.c:205:1: Parameter `ctx->cipher->block_size` 203. } 204. 205. > int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 206. const unsigned char *in, int inl) 207. { crypto/evp/evp_enc.c:211:16: Call 209. return EVP_EncryptUpdate(ctx, out, outl, in, inl); 210. else 211. return EVP_DecryptUpdate(ctx, out, outl, in, inl); ^ 212. } 213. crypto/evp/evp_enc.c:416:1: Parameter `ctx->cipher->block_size` 414. } 415. 416. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 417. const unsigned char *in, int inl) 418. { crypto/evp/evp_enc.c:422:5: Assignment 420. unsigned int b; 421. 422. b = ctx->cipher->block_size; ^ 423. 424. if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) { crypto/evp/evp_enc.c:452:16: Call 450. /* see comment about PTRDIFF_T comparison above */ 451. if (((PTRDIFF_T)out == (PTRDIFF_T)in) 452. || is_partially_overlapping(out, in, b)) { ^ 453. EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING); 454. return 0; crypto/evp/evp_enc.c:279:1: <RHS trace> 277. #endif 278. 279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 280. { 281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:279:1: Parameter `len` 277. #endif 278. 279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 280. { 281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:288:50: Binary operation: (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate` 286. */ 287. int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | 288. (diff > (0 - (PTRDIFF_T)len))); ^ 289. 290. return overlapped;
https://github.com/openssl/openssl/blob/b1531d8e6cc95837e38b10d875ae64144c6fdf7a/crypto/evp/evp_enc.c/#L288
d2a_code_trace_data_45566
static unsigned constant_time_ge(unsigned a, unsigned b) { a -= b; return DUPLICATE_MSB_TO_ALL(~a); } ssl/d1_pkt.c:708: error: INTEGER_OVERFLOW_L2 ([0, 17727] - [0, 17728]):unsigned32 by call to `dtls1_process_record`. Showing all 11 steps of the trace ssl/d1_pkt.c:582:4: Assignment 580. if (s->packet_length != DTLS1_RT_HEADER_LENGTH) 581. { 582. s->packet_length = 0; ^ 583. goto again; 584. } ssl/d1_pkt.c:708:7: Call 706. } 707. 708. if (!dtls1_process_record(s)) ^ 709. { 710. rr->length = 0; ssl/d1_pkt.c:375:1: Parameter `s->s3->rrec.length` 373. #endif 374. 375. > static int 376. dtls1_process_record(SSL *s) 377. { ssl/d1_pkt.c:468:4: Call 466. * */ 467. mac = mac_tmp; 468. ssl3_cbc_copy_mac(mac_tmp, rr, mac_size); ^ 469. rr->length -= mac_size; 470. } ssl/s3_cbc.c:251:1: Parameter `md_size` 249. #define CBC_MAC_ROTATE_IN_PLACE 250. 251. > void ssl3_cbc_copy_mac(unsigned char* out, 252. const SSL3_RECORD *rec, 253. unsigned md_size) ssl/s3_cbc.c:297:29: Call 295. { 296. unsigned char mac_started = constant_time_ge(i, mac_start); 297. unsigned char mac_ended = constant_time_ge(i, mac_end); ^ 298. unsigned char b = rec->data[i]; 299. rotated_mac[j++] |= b & mac_started & ~mac_ended; ssl/s3_cbc.c:87:1: <LHS trace> 85. 86. /* constant_time_ge returns 0xff if a>=b and 0x00 otherwise. */ 87. > static unsigned constant_time_ge(unsigned a, unsigned b) 88. { 89. a -= b; ssl/s3_cbc.c:87:1: Parameter `a` 85. 86. /* constant_time_ge returns 0xff if a>=b and 0x00 otherwise. */ 87. > static unsigned constant_time_ge(unsigned a, unsigned b) 88. { 89. a -= b; ssl/s3_cbc.c:87:1: <RHS trace> 85. 86. /* constant_time_ge returns 0xff if a>=b and 0x00 otherwise. */ 87. > static unsigned constant_time_ge(unsigned a, unsigned b) 88. { 89. a -= b; ssl/s3_cbc.c:87:1: Parameter `b` 85. 86. /* constant_time_ge returns 0xff if a>=b and 0x00 otherwise. */ 87. > static unsigned constant_time_ge(unsigned a, unsigned b) 88. { 89. a -= b; ssl/s3_cbc.c:89:2: Binary operation: ([0, 17727] - [0, 17728]):unsigned32 by call to `dtls1_process_record` 87. static unsigned constant_time_ge(unsigned a, unsigned b) 88. { 89. a -= b; ^ 90. return DUPLICATE_MSB_TO_ALL(~a); 91. }
https://github.com/openssl/openssl/blob/f93a41877d8d7a287debb7c63d7b646abaaf269c/ssl/s3_cbc.c/#L89
d2a_code_trace_data_45567
static int dca_subsubframe(DCAContext *s, int base_channel, int block_index) { int k, l; int subsubframe = s->current_subsubframe; const float *quant_step_table; LOCAL_ALIGNED_16(int32_t, block, [SAMPLES_PER_SUBBAND * DCA_SUBBANDS]); if (s->bit_rate_index == 0x1f) quant_step_table = ff_dca_lossless_quant_d; else quant_step_table = ff_dca_lossy_quant_d; for (k = base_channel; k < s->audio_header.prim_channels; k++) { float (*subband_samples)[8] = s->dca_chan[k].subband_samples[block_index]; float rscale[DCA_SUBBANDS]; if (get_bits_left(&s->gb) < 0) return AVERROR_INVALIDDATA; for (l = 0; l < s->audio_header.vq_start_subband[k]; l++) { int m; int abits = s->dca_chan[k].bitalloc[l]; float quant_step_size = quant_step_table[abits]; int sel = s->audio_header.quant_index_huffman[k][abits]; if (!abits) { rscale[l] = 0; memset(block + SAMPLES_PER_SUBBAND * l, 0, SAMPLES_PER_SUBBAND * sizeof(block[0])); } else { int sfi = s->dca_chan[k].transition_mode[l] && subsubframe >= s->dca_chan[k].transition_mode[l]; rscale[l] = quant_step_size * s->dca_chan[k].scale_factor[l][sfi] * s->audio_header.scalefactor_adj[k][sel]; if (abits >= 11 || !dca_smpl_bitalloc[abits].vlc[sel].table) { if (abits <= 7) { int block_code1, block_code2, size, levels, err; size = abits_sizes[abits - 1]; levels = abits_levels[abits - 1]; block_code1 = get_bits(&s->gb, size); block_code2 = get_bits(&s->gb, size); err = decode_blockcodes(block_code1, block_code2, levels, block + SAMPLES_PER_SUBBAND * l); if (err) { av_log(s->avctx, AV_LOG_ERROR, "ERROR: block code look-up failed\n"); return AVERROR_INVALIDDATA; } } else { for (m = 0; m < SAMPLES_PER_SUBBAND; m++) block[SAMPLES_PER_SUBBAND * l + m] = get_sbits(&s->gb, abits - 3); } } else { for (m = 0; m < SAMPLES_PER_SUBBAND; m++) block[SAMPLES_PER_SUBBAND * l + m] = get_bitalloc(&s->gb, &dca_smpl_bitalloc[abits], sel); } } } s->fmt_conv.int32_to_float_fmul_array8(&s->fmt_conv, subband_samples[0], block, rscale, SAMPLES_PER_SUBBAND * s->audio_header.vq_start_subband[k]); for (l = 0; l < s->audio_header.vq_start_subband[k]; l++) { int m; if (s->dca_chan[k].prediction_mode[l]) { int n; if (s->predictor_history) subband_samples[l][0] += (ff_dca_adpcm_vb[s->dca_chan[k].prediction_vq[l]][0] * s->dca_chan[k].subband_samples_hist[l][3] + ff_dca_adpcm_vb[s->dca_chan[k].prediction_vq[l]][1] * s->dca_chan[k].subband_samples_hist[l][2] + ff_dca_adpcm_vb[s->dca_chan[k].prediction_vq[l]][2] * s->dca_chan[k].subband_samples_hist[l][1] + ff_dca_adpcm_vb[s->dca_chan[k].prediction_vq[l]][3] * s->dca_chan[k].subband_samples_hist[l][0]) * (1.0f / 8192); for (m = 1; m < SAMPLES_PER_SUBBAND; m++) { float sum = ff_dca_adpcm_vb[s->dca_chan[k].prediction_vq[l]][0] * subband_samples[l][m - 1]; for (n = 2; n <= 4; n++) if (m >= n) sum += ff_dca_adpcm_vb[s->dca_chan[k].prediction_vq[l]][n - 1] * subband_samples[l][m - n]; else if (s->predictor_history) sum += ff_dca_adpcm_vb[s->dca_chan[k].prediction_vq[l]][n - 1] * s->dca_chan[k].subband_samples_hist[l][m - n + 4]; subband_samples[l][m] += sum * 1.0f / 8192; } } } for (l = 0; l < DCA_SUBBANDS; l++) AV_COPY128(s->dca_chan[k].subband_samples_hist[l], &subband_samples[l][4]); if (s->audio_header.subband_activity[k] > s->audio_header.vq_start_subband[k]) { if (!s->debug_flag & 0x01) { av_log(s->avctx, AV_LOG_DEBUG, "Stream with high frequencies VQ coding\n"); s->debug_flag |= 0x01; } s->dcadsp.decode_hf(subband_samples, s->dca_chan[k].high_freq_vq, ff_dca_high_freq_vq, subsubframe * SAMPLES_PER_SUBBAND, s->dca_chan[k].scale_factor, s->audio_header.vq_start_subband[k], s->audio_header.subband_activity[k]); } } if (s->aspf || subsubframe == s->subsubframes[s->current_subframe] - 1) { if (get_bits(&s->gb, 16) != 0xFFFF) { av_log(s->avctx, AV_LOG_ERROR, "Didn't get subframe DSYNC\n"); return AVERROR_INVALIDDATA; } } return 0; } libavcodec/dcadec.c:899: error: Buffer Overrun L3 Offset: [-2, 5] Size: 32. libavcodec/dcadec.c:893:22: <Offset trace> 891. s->dca_chan[k].subband_samples_hist[l][0]) * 892. (1.0f / 8192); 893. for (m = 1; m < SAMPLES_PER_SUBBAND; m++) { ^ 894. float sum = ff_dca_adpcm_vb[s->dca_chan[k].prediction_vq[l]][0] * 895. subband_samples[l][m - 1]; libavcodec/dcadec.c:893:22: Assignment 891. s->dca_chan[k].subband_samples_hist[l][0]) * 892. (1.0f / 8192); 893. for (m = 1; m < SAMPLES_PER_SUBBAND; m++) { ^ 894. float sum = ff_dca_adpcm_vb[s->dca_chan[k].prediction_vq[l]][0] * 895. subband_samples[l][m - 1]; libavcodec/dcadec.c:788:1: <Length trace> 786. static const uint8_t abits_levels[7] = { 3, 5, 7, 9, 13, 17, 25 }; 787. 788. static int dca_subsubframe(DCAContext *s, int base_channel, int block_index) ^ 789. { 790. int k, l; libavcodec/dcadec.c:788:1: Parameter `s->dca_chan[*].subband_samples[*][*]` 786. static const uint8_t abits_levels[7] = { 3, 5, 7, 9, 13, 17, 25 }; 787. 788. static int dca_subsubframe(DCAContext *s, int base_channel, int block_index) ^ 789. { 790. int k, l; libavcodec/dcadec.c:899:36: Array access: Offset: [-2, 5] Size: 32 897. if (m >= n) 898. sum += ff_dca_adpcm_vb[s->dca_chan[k].prediction_vq[l]][n - 1] * 899. subband_samples[l][m - n]; ^ 900. else if (s->predictor_history) 901. sum += ff_dca_adpcm_vb[s->dca_chan[k].prediction_vq[l]][n - 1] *
https://github.com/libav/libav/blob/c1aac39eaccd32dc3b74ccfcce701d3d888fbc6b/libavcodec/dcadec.c/#L899
d2a_code_trace_data_45568
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:1099: error: Uninitialized Value The value read from ymin was never initialized. libavcodec/motion_est_template.c:1099:17: 1097. 1098. if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue; 1099. CHECK_MV(mx,my) ^ 1100. } 1101. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1099
d2a_code_trace_data_45569
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:1061: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + 18]):unsigned64 by call to `WPACKET_sub_memcpy`. Showing all 12 steps of the trace ssl/t1_lib.c:1060:21: Call 1058. /* Sub-packet for servername list (always 1 hostname)*/ 1059. || !WPACKET_start_sub_packet_u16(pkt) 1060. || !WPACKET_put_bytes(pkt, TLSEXT_NAMETYPE_host_name, 1) ^ 1061. || !WPACKET_sub_memcpy(pkt, s->tlsext_hostname, 1062. strlen(s->tlsext_hostname), 2) 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:1061:21: Call 1059. || !WPACKET_start_sub_packet_u16(pkt) 1060. || !WPACKET_put_bytes(pkt, TLSEXT_NAMETYPE_host_name, 1) 1061. || !WPACKET_sub_memcpy(pkt, s->tlsext_hostname, ^ 1062. strlen(s->tlsext_hostname), 2) 1063. || !WPACKET_close(pkt) ssl/packet.c:282:1: Parameter `pkt->written` 280. } 281. 282. > int WPACKET_sub_memcpy(WPACKET *pkt, const void *src, size_t len, size_t lenbytes) 283. { 284. if (!WPACKET_start_sub_packet_len(pkt, lenbytes) ssl/packet.c:284:10: Call 282. int WPACKET_sub_memcpy(WPACKET *pkt, const void *src, size_t len, size_t lenbytes) 283. { 284. if (!WPACKET_start_sub_packet_len(pkt, lenbytes) ^ 285. || !WPACKET_memcpy(pkt, src, len) 286. || !WPACKET_close(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 + 18]):unsigned64 by call to `WPACKET_sub_memcpy` 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_45570
static int mov_write_stts_tag(ByteIOContext *pb, MOVTrack* track) { MOV_stts_t *stts_entries; uint32_t entries = -1; uint32_t atom_size; int i; if (track->enc->codec_type == CODEC_TYPE_AUDIO && !track->audio_vbr) { stts_entries = av_malloc(sizeof(*stts_entries)); stts_entries[0].count = track->sampleCount; stts_entries[0].duration = 1; entries = 1; } else { stts_entries = av_malloc(track->entry * sizeof(*stts_entries)); for (i=0; i<track->entry; i++) { int64_t duration = i + 1 == track->entry ? track->trackDuration - track->cluster[i].dts + track->cluster[0].dts : track->cluster[i+1].dts - track->cluster[i].dts; if (i && duration == stts_entries[entries].duration) { stts_entries[entries].count++; } else { entries++; stts_entries[entries].duration = duration; stts_entries[entries].count = 1; } } entries++; } atom_size = 16 + (entries * 8); put_be32(pb, atom_size); put_tag(pb, "stts"); put_be32(pb, 0); put_be32(pb, entries); for (i=0; i<entries; i++) { put_be32(pb, stts_entries[i].count); put_be32(pb, stts_entries[i].duration); } av_free(stts_entries); return atom_size; } libavformat/movenc.c:694: error: Integer Overflow L1 ([4294967295, +oo] + 1):unsigned32. libavformat/movenc.c:676:5: <LHS trace> 674. { 675. MOV_stts_t *stts_entries; 676. uint32_t entries = -1; ^ 677. uint32_t atom_size; 678. int i; libavformat/movenc.c:676:5: Assignment 674. { 675. MOV_stts_t *stts_entries; 676. uint32_t entries = -1; ^ 677. uint32_t atom_size; 678. int i; libavformat/movenc.c:694:17: Binary operation: ([4294967295, +oo] + 1):unsigned32 692. stts_entries[entries].count++; /* compress */ 693. } else { 694. entries++; ^ 695. stts_entries[entries].duration = duration; 696. stts_entries[entries].count = 1;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/movenc.c/#L694
d2a_code_trace_data_45571
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_mod.c:210: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, +oo] by call to `BN_mul`. Showing all 19 steps of the trace 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:219:5: Call 217. } 218. /* OK, make sure the returned bignum is "zero" */ 219. BN_zero(ret); ^ 220. /* clear BN_FLG_CONSTTIME if leaked from previous frames */ 221. ret->flags &= (~BN_FLG_CONSTTIME); crypto/bn/bn_lib.c:359:1: Parameter `*a->d` 357. } 358. 359. > int BN_set_word(BIGNUM *a, BN_ULONG w) 360. { 361. bn_check_top(a); crypto/bn/bn_lib.c:362:9: Call 360. { 361. bn_check_top(a); 362. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 363. return 0; 364. 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_mod.c:210:14: Call 208. goto err; 209. } else { 210. if (!BN_mul(t, a, b, ctx)) ^ 211. goto err; 212. } crypto/bn/bn_mul.c:497:1: Parameter `*r->d` 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 `*r->d` 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/bn/bn_mul.c:555:17: Call 553. # endif 554. if (al == 8) { 555. if (bn_wexpand(rr, 16) == NULL) ^ 556. goto err; 557. rr->top = 16; crypto/bn/bn_lib.c:960:1: Parameter `*a->d` 958. } 959. 960. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 961. { 962. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:962:37: Call 960. BIGNUM *bn_wexpand(BIGNUM *a, int words) 961. { 962. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 963. } 964. 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, +oo] by call to `BN_mul` 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/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_45572
static int tree_add_unmatched(X509_POLICY_LEVEL *curr, const X509_POLICY_CACHE *cache, const ASN1_OBJECT *id, X509_POLICY_NODE *node, X509_POLICY_TREE *tree) { X509_POLICY_DATA *data; if (id == NULL) id = node->data->valid_policy; data = policy_data_new(NULL, id, node_critical(node)); if (data == NULL) return 0; data->qualifier_set = cache->anyPolicy->qualifier_set; data->flags |= POLICY_DATA_FLAG_SHARED_QUALIFIERS; if (!level_add_node(curr, data, node, tree)) { policy_data_free(data); return 0; } return 1; } crypto/x509v3/pcy_tree.c:365: error: MEMORY_LEAK memory dynamically allocated to `return` by call to `policy_data_new()` at line 353, column 12 is not reachable after line 365, column 5. Showing all 85 steps of the trace crypto/x509v3/pcy_tree.c:341:1: start of procedure tree_add_unmatched() 339. */ 340. 341. > static int tree_add_unmatched(X509_POLICY_LEVEL *curr, 342. const X509_POLICY_CACHE *cache, 343. const ASN1_OBJECT *id, crypto/x509v3/pcy_tree.c:347:9: Taking true branch 345. { 346. X509_POLICY_DATA *data; 347. if (id == NULL) ^ 348. id = node->data->valid_policy; 349. /* crypto/x509v3/pcy_tree.c:348:9: 346. X509_POLICY_DATA *data; 347. if (id == NULL) 348. > id = node->data->valid_policy; 349. /* 350. * Create a new node with qualifiers from anyPolicy and id from unmatched crypto/x509v3/pcy_tree.c:353:5: 351. * node. 352. */ 353. > data = policy_data_new(NULL, id, node_critical(node)); 354. 355. if (data == NULL) crypto/x509v3/pcy_data.c:88:1: start of procedure policy_data_new() 86. */ 87. 88. > X509_POLICY_DATA *policy_data_new(POLICYINFO *policy, 89. const ASN1_OBJECT *cid, int crit) 90. { crypto/x509v3/pcy_data.c:93:10: Taking true branch 91. X509_POLICY_DATA *ret; 92. ASN1_OBJECT *id; 93. if (!policy && !cid) ^ 94. return NULL; 95. if (cid) { crypto/x509v3/pcy_data.c:93:21: Taking false branch 91. X509_POLICY_DATA *ret; 92. ASN1_OBJECT *id; 93. if (!policy && !cid) ^ 94. return NULL; 95. if (cid) { crypto/x509v3/pcy_data.c:95:9: Taking true branch 93. if (!policy && !cid) 94. return NULL; 95. if (cid) { ^ 96. id = OBJ_dup(cid); 97. if (!id) crypto/x509v3/pcy_data.c:96:9: Skipping OBJ_dup(): empty list of specs 94. return NULL; 95. if (cid) { 96. id = OBJ_dup(cid); ^ 97. if (!id) 98. return NULL; crypto/x509v3/pcy_data.c:97:14: Taking false branch 95. if (cid) { 96. id = OBJ_dup(cid); 97. if (!id) ^ 98. return NULL; 99. } else crypto/x509v3/pcy_data.c:101:5: 99. } else 100. id = NULL; 101. > ret = OPENSSL_zalloc(sizeof(*ret)); 102. if (ret == NULL) 103. 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/x509v3/pcy_data.c:102:9: Taking false branch 100. id = NULL; 101. ret = OPENSSL_zalloc(sizeof(*ret)); 102. if (ret == NULL) ^ 103. return NULL; 104. ret->expected_policy_set = sk_ASN1_OBJECT_new_null(); crypto/x509v3/pcy_data.c:104:5: 102. if (ret == NULL) 103. return NULL; 104. > ret->expected_policy_set = sk_ASN1_OBJECT_new_null(); 105. if (ret->expected_policy_set == NULL) { 106. OPENSSL_free(ret); include/openssl/asn1.h:569:1: start of procedure sk_ASN1_OBJECT_new_null() 567. DECLARE_ASN1_ITEM(ASN1_OBJECT) 568. 569. > DEFINE_STACK_OF(ASN1_OBJECT) 570. 571. ASN1_STRING *ASN1_STRING_new(void); crypto/stack/stack.c:145:1: start of procedure sk_new_null() 143. } 144. 145. > _STACK *sk_new_null(void) 146. { 147. return sk_new((int (*)(const void *, const void *))0); crypto/stack/stack.c:147:5: 145. _STACK *sk_new_null(void) 146. { 147. > return sk_new((int (*)(const void *, const void *))0); 148. } 149. crypto/stack/stack.c:150:1: start of procedure sk_new() 148. } 149. 150. > _STACK *sk_new(int (*c) (const void *, const void *)) 151. { 152. _STACK *ret; crypto/stack/stack.c:154:9: 152. _STACK *ret; 153. 154. > if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == 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/stack/stack.c:154:9: Taking false branch 152. _STACK *ret; 153. 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) ^ 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) crypto/stack/stack.c:156:9: 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. > if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) 157. goto err; 158. ret->comp = c; 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/stack/stack.c:156:9: Taking false branch 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) ^ 157. goto err; 158. ret->comp = c; crypto/stack/stack.c:158:5: 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) 157. goto err; 158. > ret->comp = c; 159. ret->num_alloc = MIN_NODES; 160. return (ret); crypto/stack/stack.c:159:5: 157. goto err; 158. ret->comp = c; 159. > ret->num_alloc = MIN_NODES; 160. return (ret); 161. crypto/stack/stack.c:160:5: 158. ret->comp = c; 159. ret->num_alloc = MIN_NODES; 160. > return (ret); 161. 162. err: crypto/stack/stack.c:165:1: return from a call to sk_new 163. OPENSSL_free(ret); 164. return (NULL); 165. > } 166. 167. int sk_insert(_STACK *st, void *data, int loc) crypto/stack/stack.c:148:1: return from a call to sk_new_null 146. { 147. return sk_new((int (*)(const void *, const void *))0); 148. > } 149. 150. _STACK *sk_new(int (*c) (const void *, const void *)) include/openssl/asn1.h:569:1: return from a call to sk_ASN1_OBJECT_new_null 567. DECLARE_ASN1_ITEM(ASN1_OBJECT) 568. 569. > DEFINE_STACK_OF(ASN1_OBJECT) 570. 571. ASN1_STRING *ASN1_STRING_new(void); crypto/x509v3/pcy_data.c:105:9: Taking false branch 103. return NULL; 104. ret->expected_policy_set = sk_ASN1_OBJECT_new_null(); 105. if (ret->expected_policy_set == NULL) { ^ 106. OPENSSL_free(ret); 107. ASN1_OBJECT_free(id); crypto/x509v3/pcy_data.c:111:9: Taking true branch 109. } 110. 111. if (crit) ^ 112. ret->flags = POLICY_DATA_FLAG_CRITICAL; 113. crypto/x509v3/pcy_data.c:112:9: 110. 111. if (crit) 112. > ret->flags = POLICY_DATA_FLAG_CRITICAL; 113. 114. if (id) crypto/x509v3/pcy_data.c:114:9: Taking true branch 112. ret->flags = POLICY_DATA_FLAG_CRITICAL; 113. 114. if (id) ^ 115. ret->valid_policy = id; 116. else { crypto/x509v3/pcy_data.c:115:9: 113. 114. if (id) 115. > ret->valid_policy = id; 116. else { 117. ret->valid_policy = policy->policyid; crypto/x509v3/pcy_data.c:121:9: Taking false branch 119. } 120. 121. if (policy) { ^ 122. ret->qualifier_set = policy->qualifiers; 123. policy->qualifiers = NULL; crypto/x509v3/pcy_data.c:126:5: 124. } 125. 126. > return ret; 127. } crypto/x509v3/pcy_data.c:127:1: return from a call to policy_data_new 125. 126. return ret; 127. > } crypto/x509v3/pcy_tree.c:355:9: Taking false branch 353. data = policy_data_new(NULL, id, node_critical(node)); 354. 355. if (data == NULL) ^ 356. return 0; 357. /* Curr may not have anyPolicy */ crypto/x509v3/pcy_tree.c:358:5: 356. return 0; 357. /* Curr may not have anyPolicy */ 358. > data->qualifier_set = cache->anyPolicy->qualifier_set; 359. data->flags |= POLICY_DATA_FLAG_SHARED_QUALIFIERS; 360. if (!level_add_node(curr, data, node, tree)) { crypto/x509v3/pcy_tree.c:359:5: 357. /* Curr may not have anyPolicy */ 358. data->qualifier_set = cache->anyPolicy->qualifier_set; 359. > data->flags |= POLICY_DATA_FLAG_SHARED_QUALIFIERS; 360. if (!level_add_node(curr, data, node, tree)) { 361. policy_data_free(data); crypto/x509v3/pcy_tree.c:360:10: Taking false branch 358. data->qualifier_set = cache->anyPolicy->qualifier_set; 359. data->flags |= POLICY_DATA_FLAG_SHARED_QUALIFIERS; 360. if (!level_add_node(curr, data, node, tree)) { ^ 361. policy_data_free(data); 362. return 0; crypto/x509v3/pcy_tree.c:365:5: 363. } 364. 365. > return 1; 366. } 367.
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/x509v3/pcy_tree.c/#L365
d2a_code_trace_data_45573
static int adpcm_decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size) { ADPCMContext *c = avctx->priv_data; ADPCMChannelStatus *cs; int n, m, channel, i; int block_predictor[2]; short *samples; short *samples_end; const uint8_t *src; int st; unsigned char last_byte = 0; unsigned char nibble; int decode_top_nibble_next = 0; int diff_channel; uint32_t samples_in_chunk; int32_t previous_left_sample, previous_right_sample; int32_t current_left_sample, current_right_sample; int32_t next_left_sample, next_right_sample; int32_t coeff1l, coeff2l, coeff1r, coeff2r; uint8_t shift_left, shift_right; int count1, count2; if (!buf_size) return 0; if(*data_size/4 < buf_size + 8) return -1; samples = data; samples_end= samples + *data_size/2; *data_size= 0; src = buf; st = avctx->channels == 2 ? 1 : 0; switch(avctx->codec->id) { case CODEC_ID_ADPCM_IMA_QT: n = (buf_size - 2); channel = c->channel; cs = &(c->status[channel]); cs->predictor = (*src++) << 8; cs->predictor |= (*src & 0x80); cs->predictor &= 0xFF80; if(cs->predictor & 0x8000) cs->predictor -= 0x10000; cs->predictor = av_clip_int16(cs->predictor); cs->step_index = (*src++) & 0x7F; if (cs->step_index > 88){ av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index); cs->step_index = 88; } cs->step = step_table[cs->step_index]; if (st && channel) samples++; for(m=32; n>0 && m>0; n--, m--) { *samples = adpcm_ima_expand_nibble(cs, src[0] & 0x0F, 3); samples += avctx->channels; *samples = adpcm_ima_expand_nibble(cs, (src[0] >> 4) & 0x0F, 3); samples += avctx->channels; src ++; } if(st) { c->channel = (channel + 1) % 2; if(channel == 1) { return src - buf; } } break; case CODEC_ID_ADPCM_IMA_WAV: if (avctx->block_align != 0 && buf_size > avctx->block_align) buf_size = avctx->block_align; for(i=0; i<avctx->channels; i++){ cs = &(c->status[i]); cs->predictor = *samples++ = (int16_t)(src[0] + (src[1]<<8)); src+=2; cs->step_index = *src++; if (cs->step_index > 88){ av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index); cs->step_index = 88; } if (*src++) av_log(avctx, AV_LOG_ERROR, "unused byte should be null but is %d!!\n", src[-1]); } while(src < buf + buf_size){ for(m=0; m<4; m++){ for(i=0; i<=st; i++) *samples++ = adpcm_ima_expand_nibble(&c->status[i], src[4*i] & 0x0F, 3); for(i=0; i<=st; i++) *samples++ = adpcm_ima_expand_nibble(&c->status[i], src[4*i] >> 4 , 3); src++; } src += 4*st; } break; case CODEC_ID_ADPCM_4XM: cs = &(c->status[0]); c->status[0].predictor= (int16_t)(src[0] + (src[1]<<8)); src+=2; if(st){ c->status[1].predictor= (int16_t)(src[0] + (src[1]<<8)); src+=2; } c->status[0].step_index= (int16_t)(src[0] + (src[1]<<8)); src+=2; if(st){ c->status[1].step_index= (int16_t)(src[0] + (src[1]<<8)); src+=2; } if (cs->step_index < 0) cs->step_index = 0; if (cs->step_index > 88) cs->step_index = 88; m= (buf_size - (src - buf))>>st; for(i=0; i<m; i++) { *samples++ = adpcm_ima_expand_nibble(&c->status[0], src[i] & 0x0F, 4); if (st) *samples++ = adpcm_ima_expand_nibble(&c->status[1], src[i+m] & 0x0F, 4); *samples++ = adpcm_ima_expand_nibble(&c->status[0], src[i] >> 4, 4); if (st) *samples++ = adpcm_ima_expand_nibble(&c->status[1], src[i+m] >> 4, 4); } src += m<<st; break; case CODEC_ID_ADPCM_MS: if (avctx->block_align != 0 && buf_size > avctx->block_align) buf_size = avctx->block_align; n = buf_size - 7 * avctx->channels; if (n < 0) return -1; block_predictor[0] = av_clip(*src++, 0, 7); block_predictor[1] = 0; if (st) block_predictor[1] = av_clip(*src++, 0, 7); c->status[0].idelta = (int16_t)((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); src+=2; if (st){ c->status[1].idelta = (int16_t)((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); src+=2; } c->status[0].coeff1 = AdaptCoeff1[block_predictor[0]]; c->status[0].coeff2 = AdaptCoeff2[block_predictor[0]]; c->status[1].coeff1 = AdaptCoeff1[block_predictor[1]]; c->status[1].coeff2 = AdaptCoeff2[block_predictor[1]]; c->status[0].sample1 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); src+=2; if (st) c->status[1].sample1 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); if (st) src+=2; c->status[0].sample2 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); src+=2; if (st) c->status[1].sample2 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00)); if (st) src+=2; *samples++ = c->status[0].sample1; if (st) *samples++ = c->status[1].sample1; *samples++ = c->status[0].sample2; if (st) *samples++ = c->status[1].sample2; for(;n>0;n--) { *samples++ = adpcm_ms_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F); *samples++ = adpcm_ms_expand_nibble(&c->status[st], src[0] & 0x0F); src ++; } break; case CODEC_ID_ADPCM_IMA_DK4: if (avctx->block_align != 0 && buf_size > avctx->block_align) buf_size = avctx->block_align; c->status[0].predictor = (int16_t)(src[0] | (src[1] << 8)); c->status[0].step_index = src[2]; src += 4; *samples++ = c->status[0].predictor; if (st) { c->status[1].predictor = (int16_t)(src[0] | (src[1] << 8)); c->status[1].step_index = src[2]; src += 4; *samples++ = c->status[1].predictor; } while (src < buf + buf_size) { *samples++ = adpcm_ima_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F, 3); if (st) *samples++ = adpcm_ima_expand_nibble(&c->status[1], src[0] & 0x0F, 3); else *samples++ = adpcm_ima_expand_nibble(&c->status[0], src[0] & 0x0F, 3); src++; } break; case CODEC_ID_ADPCM_IMA_DK3: if (avctx->block_align != 0 && buf_size > avctx->block_align) buf_size = avctx->block_align; if(buf_size + 16 > (samples_end - samples)*3/8) return -1; c->status[0].predictor = (int16_t)(src[10] | (src[11] << 8)); c->status[1].predictor = (int16_t)(src[12] | (src[13] << 8)); c->status[0].step_index = src[14]; c->status[1].step_index = src[15]; src += 16; diff_channel = c->status[1].predictor; while (1) { DK3_GET_NEXT_NIBBLE(); adpcm_ima_expand_nibble(&c->status[0], nibble, 3); DK3_GET_NEXT_NIBBLE(); adpcm_ima_expand_nibble(&c->status[1], nibble, 3); diff_channel = (diff_channel + c->status[1].predictor) / 2; *samples++ = c->status[0].predictor + c->status[1].predictor; *samples++ = c->status[0].predictor - c->status[1].predictor; DK3_GET_NEXT_NIBBLE(); adpcm_ima_expand_nibble(&c->status[0], nibble, 3); diff_channel = (diff_channel + c->status[1].predictor) / 2; *samples++ = c->status[0].predictor + c->status[1].predictor; *samples++ = c->status[0].predictor - c->status[1].predictor; } break; case CODEC_ID_ADPCM_IMA_WS: while (src < buf + buf_size) { if (st) { *samples++ = adpcm_ima_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F, 3); *samples++ = adpcm_ima_expand_nibble(&c->status[1], src[0] & 0x0F, 3); } else { *samples++ = adpcm_ima_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F, 3); *samples++ = adpcm_ima_expand_nibble(&c->status[0], src[0] & 0x0F, 3); } src++; } break; case CODEC_ID_ADPCM_XA: while (buf_size >= 128) { xa_decode(samples, src, &c->status[0], &c->status[1], avctx->channels); src += 128; samples += 28 * 8; buf_size -= 128; } break; case CODEC_ID_ADPCM_IMA_EA_EACS: samples_in_chunk = bytestream_get_le32(&src) >> (1-st); if (samples_in_chunk > buf_size-4-(8<<st)) { src += buf_size - 4; break; } for (i=0; i<=st; i++) c->status[i].step_index = bytestream_get_le32(&src); for (i=0; i<=st; i++) c->status[i].predictor = bytestream_get_le32(&src); for (; samples_in_chunk; samples_in_chunk--, src++) { *samples++ = adpcm_ima_expand_nibble(&c->status[0], *src>>4, 3); *samples++ = adpcm_ima_expand_nibble(&c->status[st], *src&0x0F, 3); } break; case CODEC_ID_ADPCM_IMA_EA_SEAD: for (; src < buf+buf_size; src++) { *samples++ = adpcm_ima_expand_nibble(&c->status[0], src[0] >> 4, 6); *samples++ = adpcm_ima_expand_nibble(&c->status[st],src[0]&0x0F, 6); } break; case CODEC_ID_ADPCM_EA: samples_in_chunk = AV_RL32(src); if (samples_in_chunk >= ((buf_size - 12) * 2)) { src += buf_size; break; } src += 4; current_left_sample = (int16_t)AV_RL16(src); src += 2; previous_left_sample = (int16_t)AV_RL16(src); src += 2; current_right_sample = (int16_t)AV_RL16(src); src += 2; previous_right_sample = (int16_t)AV_RL16(src); src += 2; for (count1 = 0; count1 < samples_in_chunk/28;count1++) { coeff1l = ea_adpcm_table[(*src >> 4) & 0x0F]; coeff2l = ea_adpcm_table[((*src >> 4) & 0x0F) + 4]; coeff1r = ea_adpcm_table[*src & 0x0F]; coeff2r = ea_adpcm_table[(*src & 0x0F) + 4]; src++; shift_left = ((*src >> 4) & 0x0F) + 8; shift_right = (*src & 0x0F) + 8; src++; for (count2 = 0; count2 < 28; count2++) { next_left_sample = (((*src & 0xF0) << 24) >> shift_left); next_right_sample = (((*src & 0x0F) << 28) >> shift_right); src++; next_left_sample = (next_left_sample + (current_left_sample * coeff1l) + (previous_left_sample * coeff2l) + 0x80) >> 8; next_right_sample = (next_right_sample + (current_right_sample * coeff1r) + (previous_right_sample * coeff2r) + 0x80) >> 8; previous_left_sample = current_left_sample; current_left_sample = av_clip_int16(next_left_sample); previous_right_sample = current_right_sample; current_right_sample = av_clip_int16(next_right_sample); *samples++ = (unsigned short)current_left_sample; *samples++ = (unsigned short)current_right_sample; } } break; case CODEC_ID_ADPCM_EA_R1: case CODEC_ID_ADPCM_EA_R2: case CODEC_ID_ADPCM_EA_R3: { const int big_endian = avctx->codec->id == CODEC_ID_ADPCM_EA_R3; int32_t previous_sample, current_sample, next_sample; int32_t coeff1, coeff2; uint8_t shift; unsigned int channel; uint16_t *samplesC; const uint8_t *srcC; samples_in_chunk = (big_endian ? bytestream_get_be32(&src) : bytestream_get_le32(&src)) / 28; if (samples_in_chunk > UINT32_MAX/(28*avctx->channels) || 28*samples_in_chunk*avctx->channels > samples_end-samples) { src += buf_size - 4; break; } for (channel=0; channel<avctx->channels; channel++) { srcC = src + (big_endian ? bytestream_get_be32(&src) : bytestream_get_le32(&src)) + (avctx->channels-channel-1) * 4; samplesC = samples + channel; if (avctx->codec->id == CODEC_ID_ADPCM_EA_R1) { current_sample = (int16_t)bytestream_get_le16(&srcC); previous_sample = (int16_t)bytestream_get_le16(&srcC); } else { current_sample = c->status[channel].predictor; previous_sample = c->status[channel].prev_sample; } for (count1=0; count1<samples_in_chunk; count1++) { if (*srcC == 0xEE) { srcC++; current_sample = (int16_t)bytestream_get_be16(&srcC); previous_sample = (int16_t)bytestream_get_be16(&srcC); for (count2=0; count2<28; count2++) { *samplesC = (int16_t)bytestream_get_be16(&srcC); samplesC += avctx->channels; } } else { coeff1 = ea_adpcm_table[ (*srcC>>4) & 0x0F ]; coeff2 = ea_adpcm_table[((*srcC>>4) & 0x0F) + 4]; shift = (*srcC++ & 0x0F) + 8; for (count2=0; count2<28; count2++) { if (count2 & 1) next_sample = ((*srcC++ & 0x0F) << 28) >> shift; else next_sample = ((*srcC & 0xF0) << 24) >> shift; next_sample += (current_sample * coeff1) + (previous_sample * coeff2); next_sample = av_clip_int16(next_sample >> 8); previous_sample = current_sample; current_sample = next_sample; *samplesC = current_sample; samplesC += avctx->channels; } } } if (avctx->codec->id != CODEC_ID_ADPCM_EA_R1) { c->status[channel].predictor = current_sample; c->status[channel].prev_sample = previous_sample; } } src = src + buf_size - (4 + 4*avctx->channels); samples += 28 * samples_in_chunk * avctx->channels; break; } case CODEC_ID_ADPCM_EA_XAS: if (samples_end-samples < 32*4*avctx->channels || buf_size < (4+15)*4*avctx->channels) { src += buf_size; break; } for (channel=0; channel<avctx->channels; channel++) { int coeff[2][4], shift[4]; short *s2, *s = &samples[channel]; for (n=0; n<4; n++, s+=32*avctx->channels) { for (i=0; i<2; i++) coeff[i][n] = ea_adpcm_table[(src[0]&0x0F)+4*i]; shift[n] = (src[2]&0x0F) + 8; for (s2=s, i=0; i<2; i++, src+=2, s2+=avctx->channels) s2[0] = (src[0]&0xF0) + (src[1]<<8); } for (m=2; m<32; m+=2) { s = &samples[m*avctx->channels + channel]; for (n=0; n<4; n++, src++, s+=32*avctx->channels) { for (s2=s, i=0; i<8; i+=4, s2+=avctx->channels) { int level = ((*src & (0xF0>>i)) << (24+i)) >> shift[n]; int pred = s2[-1*avctx->channels] * coeff[0][n] + s2[-2*avctx->channels] * coeff[1][n]; s2[0] = av_clip_int16((level + pred + 0x80) >> 8); } } } } samples += 32*4*avctx->channels; break; case CODEC_ID_ADPCM_IMA_AMV: case CODEC_ID_ADPCM_IMA_SMJPEG: c->status[0].predictor = (int16_t)bytestream_get_le16(&src); c->status[0].step_index = bytestream_get_le16(&src); if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV) src+=4; while (src < buf + buf_size) { char hi, lo; lo = *src & 0x0F; hi = (*src >> 4) & 0x0F; if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV) FFSWAP(char, hi, lo); *samples++ = adpcm_ima_expand_nibble(&c->status[0], lo, 3); *samples++ = adpcm_ima_expand_nibble(&c->status[0], hi, 3); src++; } break; case CODEC_ID_ADPCM_CT: while (src < buf + buf_size) { if (st) { *samples++ = adpcm_ct_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F); *samples++ = adpcm_ct_expand_nibble(&c->status[1], src[0] & 0x0F); } else { *samples++ = adpcm_ct_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F); *samples++ = adpcm_ct_expand_nibble(&c->status[0], src[0] & 0x0F); } src++; } break; case CODEC_ID_ADPCM_SBPRO_4: case CODEC_ID_ADPCM_SBPRO_3: case CODEC_ID_ADPCM_SBPRO_2: if (!c->status[0].step_index) { *samples++ = 128 * (*src++ - 0x80); if (st) *samples++ = 128 * (*src++ - 0x80); c->status[0].step_index = 1; } if (avctx->codec->id == CODEC_ID_ADPCM_SBPRO_4) { while (src < buf + buf_size) { *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F, 4, 0); *samples++ = adpcm_sbpro_expand_nibble(&c->status[st], src[0] & 0x0F, 4, 0); src++; } } else if (avctx->codec->id == CODEC_ID_ADPCM_SBPRO_3) { while (src < buf + buf_size && samples + 2 < samples_end) { *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], (src[0] >> 5) & 0x07, 3, 0); *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], (src[0] >> 2) & 0x07, 3, 0); *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], src[0] & 0x03, 2, 0); src++; } } else { while (src < buf + buf_size && samples + 3 < samples_end) { *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], (src[0] >> 6) & 0x03, 2, 2); *samples++ = adpcm_sbpro_expand_nibble(&c->status[st], (src[0] >> 4) & 0x03, 2, 2); *samples++ = adpcm_sbpro_expand_nibble(&c->status[0], (src[0] >> 2) & 0x03, 2, 2); *samples++ = adpcm_sbpro_expand_nibble(&c->status[st], src[0] & 0x03, 2, 2); src++; } } break; case CODEC_ID_ADPCM_SWF: { GetBitContext gb; const int *table; int k0, signmask, nb_bits, count; int size = buf_size*8; init_get_bits(&gb, buf, size); nb_bits = get_bits(&gb, 2)+2; table = swf_index_tables[nb_bits-2]; k0 = 1 << (nb_bits-2); signmask = 1 << (nb_bits-1); while (get_bits_count(&gb) <= size - 22*avctx->channels) { for (i = 0; i < avctx->channels; i++) { *samples++ = c->status[i].predictor = get_sbits(&gb, 16); c->status[i].step_index = get_bits(&gb, 6); } for (count = 0; get_bits_count(&gb) <= size - nb_bits*avctx->channels && count < 4095; count++) { int i; for (i = 0; i < avctx->channels; i++) { int delta = get_bits(&gb, nb_bits); int step = step_table[c->status[i].step_index]; long vpdiff = 0; int k = k0; do { if (delta & k) vpdiff += step; step >>= 1; k >>= 1; } while(k); vpdiff += step; if (delta & signmask) c->status[i].predictor -= vpdiff; else c->status[i].predictor += vpdiff; c->status[i].step_index += table[delta & (~signmask)]; c->status[i].step_index = av_clip(c->status[i].step_index, 0, 88); c->status[i].predictor = av_clip_int16(c->status[i].predictor); *samples++ = c->status[i].predictor; if (samples >= samples_end) { av_log(avctx, AV_LOG_ERROR, "allocated output buffer is too small\n"); return -1; } } } } src += buf_size; break; } case CODEC_ID_ADPCM_YAMAHA: while (src < buf + buf_size) { if (st) { *samples++ = adpcm_yamaha_expand_nibble(&c->status[0], src[0] & 0x0F); *samples++ = adpcm_yamaha_expand_nibble(&c->status[1], (src[0] >> 4) & 0x0F); } else { *samples++ = adpcm_yamaha_expand_nibble(&c->status[0], src[0] & 0x0F); *samples++ = adpcm_yamaha_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F); } src++; } break; case CODEC_ID_ADPCM_THP: { int table[2][16]; unsigned int samplecnt; int prev[2][2]; int ch; if (buf_size < 80) { av_log(avctx, AV_LOG_ERROR, "frame too small\n"); return -1; } src+=4; samplecnt = bytestream_get_be32(&src); for (i = 0; i < 32; i++) table[0][i] = (int16_t)bytestream_get_be16(&src); for (i = 0; i < 4; i++) prev[0][i] = (int16_t)bytestream_get_be16(&src); if (samplecnt >= (samples_end - samples) / (st + 1)) { av_log(avctx, AV_LOG_ERROR, "allocated output buffer is too small\n"); return -1; } for (ch = 0; ch <= st; ch++) { samples = (unsigned short *) data + ch; for (i = 0; i < samplecnt / 14; i++) { int index = (*src >> 4) & 7; unsigned int exp = 28 - (*src++ & 15); int factor1 = table[ch][index * 2]; int factor2 = table[ch][index * 2 + 1]; for (n = 0; n < 14; n++) { int32_t sampledat; if(n&1) sampledat= *src++ <<28; else sampledat= (*src&0xF0)<<24; sampledat = ((prev[ch][0]*factor1 + prev[ch][1]*factor2) >> 11) + (sampledat>>exp); *samples = av_clip_int16(sampledat); prev[ch][1] = prev[ch][0]; prev[ch][0] = *samples++; samples += st; } } } samples -= st; break; } default: return -1; } *data_size = (uint8_t *)samples - (uint8_t *)data; return src - buf; } libavcodec/adpcm.c:1527: error: Buffer Overrun L2 Offset: [0, 3] Size: 2. libavcodec/adpcm.c:1526:14: <Offset trace> 1524. 1525. /* Initialize the previous sample. */ 1526. for (i = 0; i < 4; i++) ^ 1527. prev[0][i] = (int16_t)bytestream_get_be16(&src); 1528. libavcodec/adpcm.c:1526:14: Assignment 1524. 1525. /* Initialize the previous sample. */ 1526. for (i = 0; i < 4; i++) ^ 1527. prev[0][i] = (int16_t)bytestream_get_be16(&src); 1528. libavcodec/adpcm.c:876:1: <Length trace> 874. } 875. 876. static int adpcm_decode_frame(AVCodecContext *avctx, ^ 877. void *data, int *data_size, 878. const uint8_t *buf, int buf_size) libavcodec/adpcm.c:876:1: Array declaration 874. } 875. 876. static int adpcm_decode_frame(AVCodecContext *avctx, ^ 877. void *data, int *data_size, 878. const uint8_t *buf, int buf_size) libavcodec/adpcm.c:1527:13: Array access: Offset: [0, 3] Size: 2 1525. /* Initialize the previous sample. */ 1526. for (i = 0; i < 4; i++) 1527. prev[0][i] = (int16_t)bytestream_get_be16(&src); ^ 1528. 1529. if (samplecnt >= (samples_end - samples) / (st + 1)) {
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/adpcm.c/#L1527
d2a_code_trace_data_45574
static int var_diamond_search(MpegEncContext * s, int *best, int dmin, int src_index, int ref_index, int const penalty_factor, int size, int h, int flags) { MotionEstContext * const c= &s->me; me_cmp_func cmpf, chroma_cmpf; int dia_size; LOAD_COMMON LOAD_COMMON2 int map_generation= c->map_generation; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; for(dia_size=1; dia_size<=c->dia_size; dia_size++){ int dir, start, end; const int x= best[0]; const int y= best[1]; start= FFMAX(0, y + dia_size - ymax); end = FFMIN(dia_size, xmax - x + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x + dir , y + dia_size - dir); } start= FFMAX(0, x + dia_size - xmax); end = FFMIN(dia_size, y - ymin + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x + dia_size - dir, y - dir ); } start= FFMAX(0, -y + dia_size + ymin ); end = FFMIN(dia_size, x - xmin + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x - dir , y - dia_size + dir); } start= FFMAX(0, -x + dia_size + xmin ); end = FFMIN(dia_size, ymax - y + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x - dia_size + dir, y + dir ); } if(x!=best[0] || y!=best[1]) dia_size=0; #if 0 { int dx, dy, i; static int stats[8*8]; dx= FFABS(x-best[0]); dy= FFABS(y-best[1]); stats[dy*8 + dx] ++; if(256*256*256*64 % (stats[0]+1)==0){ for(i=0; i<64; i++){ if((i&7)==0) printf("\n"); printf("%6d ", stats[i]); } printf("\n"); } } #endif } return dmin; } libavcodec/motion_est_template.c:930: error: Uninitialized Value The value read from ymin was never initialized. libavcodec/motion_est_template.c:930:13: 928. 929. //check(x + dia_size - dir, y - dir,0, a1) 930. CHECK_MV(x + dia_size - dir, y - dir ); ^ 931. } 932.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L930
d2a_code_trace_data_45575
static void new_video_stream(AVFormatContext *oc) { AVStream *st; AVCodecContext *video_enc; int codec_id; st = av_new_stream(oc, oc->nb_streams); if (!st) { fprintf(stderr, "Could not alloc stream\n"); exit(1); } avcodec_get_context_defaults2(st->codec, CODEC_TYPE_VIDEO); bitstream_filters[nb_output_files][oc->nb_streams - 1]= video_bitstream_filters; video_bitstream_filters= NULL; if(thread_count>1) avcodec_thread_init(st->codec, thread_count); video_enc = st->codec; if(video_codec_tag) video_enc->codec_tag= video_codec_tag; if( (video_global_header&1) || (video_global_header==0 && (oc->oformat->flags & AVFMT_GLOBALHEADER))){ video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER; avctx_opts[CODEC_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER; } if(video_global_header&2){ video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER; avctx_opts[CODEC_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER; } if (video_stream_copy) { st->stream_copy = 1; video_enc->codec_type = CODEC_TYPE_VIDEO; } else { const char *p; int i; AVCodec *codec; AVRational fps= frame_rate.num ? frame_rate : (AVRational){25,1}; codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, CODEC_TYPE_VIDEO); if (video_codec_name) codec_id = find_codec_or_die(video_codec_name, CODEC_TYPE_VIDEO, 1); video_enc->codec_id = codec_id; codec = avcodec_find_encoder(codec_id); for(i=0; i<opt_name_count; i++){ char buf[256]; const AVOption *opt; const char *str= av_get_string(avctx_opts[CODEC_TYPE_VIDEO], opt_names[i], &opt, buf, sizeof(buf)); if(str && (opt->flags & AV_OPT_FLAG_VIDEO_PARAM) && (opt->flags & AV_OPT_FLAG_ENCODING_PARAM)) av_set_string(video_enc, opt_names[i], str); } video_enc->time_base.den = fps.num; video_enc->time_base.num = fps.den; if(codec && codec->supported_framerates){ const AVRational *p= codec->supported_framerates; const AVRational *best=NULL; AVRational best_error= (AVRational){INT_MAX, 1}; for(; p->den!=0; p++){ AVRational error= av_sub_q(fps, *p); if(error.num <0) error.num *= -1; if(av_cmp_q(error, best_error) < 0){ best_error= error; best= p; } } video_enc->time_base.den= best->num; video_enc->time_base.num= best->den; } video_enc->width = frame_width + frame_padright + frame_padleft; video_enc->height = frame_height + frame_padtop + frame_padbottom; video_enc->sample_aspect_ratio = av_d2q(frame_aspect_ratio*video_enc->height/video_enc->width, 255); video_enc->pix_fmt = frame_pix_fmt; if(codec && codec->pix_fmts){ const enum PixelFormat *p= codec->pix_fmts; for(; *p!=-1; p++){ if(*p == video_enc->pix_fmt) break; } if(*p == -1) video_enc->pix_fmt = codec->pix_fmts[0]; } if (intra_only) video_enc->gop_size = 0; if (video_qscale || same_quality) { video_enc->flags |= CODEC_FLAG_QSCALE; video_enc->global_quality= st->quality = FF_QP2LAMBDA * video_qscale; } if(intra_matrix) video_enc->intra_matrix = intra_matrix; if(inter_matrix) video_enc->inter_matrix = inter_matrix; video_enc->max_qdiff = video_qdiff; video_enc->thread_count = thread_count; p= video_rc_override_string; for(i=0; p; i++){ int start, end, q; int e=sscanf(p, "%d,%d,%d", &start, &end, &q); if(e!=3){ fprintf(stderr, "error parsing rc_override\n"); exit(1); } video_enc->rc_override= av_realloc(video_enc->rc_override, sizeof(RcOverride)*(i+1)); video_enc->rc_override[i].start_frame= start; video_enc->rc_override[i].end_frame = end; if(q>0){ video_enc->rc_override[i].qscale= q; video_enc->rc_override[i].quality_factor= 1.0; } else{ video_enc->rc_override[i].qscale= 0; video_enc->rc_override[i].quality_factor= -q/100.0; } p= strchr(p, '/'); if(p) p++; } video_enc->rc_override_count=i; if (!video_enc->rc_initial_buffer_occupancy) video_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size*3/4; video_enc->me_threshold= me_threshold; video_enc->intra_dc_precision= intra_dc_precision - 8; video_enc->strict_std_compliance = strict; if (do_psnr) video_enc->flags|= CODEC_FLAG_PSNR; if (do_pass) { if (do_pass == 1) { video_enc->flags |= CODEC_FLAG_PASS1; } else { video_enc->flags |= CODEC_FLAG_PASS2; } } } video_disable = 0; av_freep(&video_codec_name); video_stream_copy = 0; } ffmpeg.c:3199: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `new_video_stream`. ffmpeg.c:3161:10: Unknown value from: strcmp 3159. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); 3160. 3161. if (!strcmp(file_oformat->name, "ffm") && ^ 3162. av_strstart(filename, "http:", NULL)) { 3163. /* special case for files sent to ffserver: we get the stream ffmpeg.c:3199:13: Call 3197. 3198. if (use_video) { 3199. new_video_stream(oc); ^ 3200. } 3201. ffmpeg.c:2838:1: <LHS trace> 2836. } 2837. 2838. static void new_video_stream(AVFormatContext *oc) ^ 2839. { 2840. AVStream *st; ffmpeg.c:2838:1: Parameter `oc->nb_streams` 2836. } 2837. 2838. static void new_video_stream(AVFormatContext *oc) ^ 2839. { 2840. AVStream *st; ffmpeg.c:2844:10: Call 2842. int codec_id; 2843. 2844. st = av_new_stream(oc, oc->nb_streams); ^ 2845. if (!st) { 2846. fprintf(stderr, "Could not alloc stream\n"); libavformat/utils.c:2160:1: Parameter `s->nb_streams` 2158. } 2159. 2160. AVStream *av_new_stream(AVFormatContext *s, int id) ^ 2161. { 2162. AVStream *st; ffmpeg.c:2850:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `new_video_stream` 2848. } 2849. avcodec_get_context_defaults2(st->codec, CODEC_TYPE_VIDEO); 2850. bitstream_filters[nb_output_files][oc->nb_streams - 1]= video_bitstream_filters; ^ 2851. video_bitstream_filters= NULL; 2852.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/ffmpeg.c/#L2850
d2a_code_trace_data_45576
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:956: error: Null Dereference pointer `ctts_entries` last assigned on line 955 could be null and is dereferenced at line 956, column 5. libavformat/movenc.c:948:1: start of procedure mov_write_ctts_tag() 946. } 947. 948. static int mov_write_ctts_tag(AVIOContext *pb, MOVTrack *track) ^ 949. { 950. MOVStts *ctts_entries; libavformat/movenc.c:951:5: 949. { 950. MOVStts *ctts_entries; 951. uint32_t entries = 0; ^ 952. uint32_t atom_size; 953. int i; libavformat/movenc.c:955:5: 953. int i; 954. 955. ctts_entries = av_malloc((track->entry + 1) * sizeof(*ctts_entries)); /* worst case */ ^ 956. ctts_entries[0].count = 1; 957. 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:956:5: 954. 955. ctts_entries = av_malloc((track->entry + 1) * sizeof(*ctts_entries)); /* worst case */ 956. ctts_entries[0].count = 1; ^ 957. ctts_entries[0].duration = track->cluster[0].cts; 958. for (i=1; i<track->entry; i++) {
https://github.com/libav/libav/blob/f53221049933627a31fb4a530c290802715ccf65/libavformat/movenc.c/#L956
d2a_code_trace_data_45577
static void put_ebml_void(ByteIOContext *pb, uint64_t size) { int64_t currentpos = url_ftell(pb); assert(size >= 2); put_ebml_id(pb, EBML_ID_VOID); if (size < 10) put_ebml_num(pb, size-1, 0); else put_ebml_num(pb, size-9, 8); while(url_ftell(pb) < currentpos + size) put_byte(pb, 0); } libavformat/matroskaenc.c:932: error: Integer Overflow L2 ([0, 9] - 1):unsigned64 by call to `mkv_write_seekhead`. libavformat/matroskaenc.c:926:15: Call 924. second_seekhead = mkv_write_seekhead(pb, mkv->cluster_seekhead); 925. 926. ret = mkv_add_seekhead_entry(mkv->main_seekhead, MATROSKA_ID_CUES , cuespos); ^ 927. if (ret < 0) return ret; 928. if (second_seekhead >= 0) { libavformat/matroskaenc.c:267:1: Parameter `seekhead->entries->segmentpos` 265. } 266. 267. static int mkv_add_seekhead_entry(mkv_seekhead *seekhead, unsigned int elementid, uint64_t filepos) ^ 268. { 269. mkv_seekhead_entry *entries = seekhead->entries; libavformat/matroskaenc.c:932:9: Call 930. if (ret < 0) return ret; 931. } 932. mkv_write_seekhead(pb, mkv->main_seekhead); ^ 933. 934. // update the duration libavformat/matroskaenc.c:295:1: Parameter `seekhead->filepos` 293. * -1 if an error occurred. 294. */ 295. static int64_t mkv_write_seekhead(ByteIOContext *pb, mkv_seekhead *seekhead) ^ 296. { 297. ebml_master metaseek, seekentry; libavformat/matroskaenc.c:323:9: Assignment 321. 322. if (seekhead->reserved_size > 0) { 323. uint64_t remaining = seekhead->filepos + seekhead->reserved_size - url_ftell(pb); ^ 324. put_ebml_void(pb, remaining); 325. url_fseek(pb, currentpos, SEEK_SET); libavformat/matroskaenc.c:324:9: Call 322. if (seekhead->reserved_size > 0) { 323. uint64_t remaining = seekhead->filepos + seekhead->reserved_size - url_ftell(pb); 324. put_ebml_void(pb, remaining); ^ 325. url_fseek(pb, currentpos, SEEK_SET); 326. libavformat/matroskaenc.c:192:1: <LHS trace> 190. * @param size The number of bytes to reserve, which must be at least 2. 191. */ 192. static void put_ebml_void(ByteIOContext *pb, uint64_t size) ^ 193. { 194. int64_t currentpos = url_ftell(pb); libavformat/matroskaenc.c:192:1: Parameter `size` 190. * @param size The number of bytes to reserve, which must be at least 2. 191. */ 192. static void put_ebml_void(ByteIOContext *pb, uint64_t size) ^ 193. { 194. int64_t currentpos = url_ftell(pb); libavformat/matroskaenc.c:203:9: Binary operation: ([0, 9] - 1):unsigned64 by call to `mkv_write_seekhead` 201. // size if possible, 1 byte otherwise 202. if (size < 10) 203. put_ebml_num(pb, size-1, 0); ^ 204. else 205. put_ebml_num(pb, size-9, 8);
https://github.com/libav/libav/blob/8ef94840236a220975173e51d4056efeba4afe2d/libavformat/matroskaenc.c/#L203
d2a_code_trace_data_45578
BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *in_ctx) { BIGNUM *e; BN_CTX *ctx; BN_BLINDING *ret = NULL; if (in_ctx == NULL) { if ((ctx = BN_CTX_new()) == NULL) return 0; } else ctx = in_ctx; BN_CTX_start(ctx); e = BN_CTX_get(ctx); if (e == NULL) { RSAerr(RSA_F_RSA_SETUP_BLINDING, ERR_R_MALLOC_FAILURE); goto err; } if (rsa->e == NULL) { e = rsa_get_public_exp(rsa->d, rsa->p, rsa->q, ctx); if (e == NULL) { RSAerr(RSA_F_RSA_SETUP_BLINDING, RSA_R_NO_PUBLIC_EXPONENT); goto err; } } else e = rsa->e; if ((RAND_status() == 0) && rsa->d != NULL && bn_get_words(rsa->d) != NULL) { RAND_add(bn_get_words(rsa->d), bn_get_dmax(rsa->d) * sizeof(BN_ULONG), 0.0); } { BIGNUM *local_n = NULL, *n; if (!(rsa->flags & RSA_FLAG_NO_CONSTTIME)) { local_n = n = BN_new(); if (local_n == NULL) { RSAerr(RSA_F_RSA_SETUP_BLINDING, ERR_R_MALLOC_FAILURE); goto err; } BN_with_flags(n, rsa->n, BN_FLG_CONSTTIME); } else { n = rsa->n; } ret = BN_BLINDING_create_param(NULL, e, n, ctx, rsa->meth->bn_mod_exp, rsa->_method_mod_n); BN_free(local_n); } if (ret == NULL) { RSAerr(RSA_F_RSA_SETUP_BLINDING, ERR_R_BN_LIB); goto err; } CRYPTO_THREADID_current(BN_BLINDING_thread_id(ret)); err: BN_CTX_end(ctx); if (ctx != in_ctx) BN_CTX_free(ctx); if (e != rsa->e) BN_free(e); return ret; } crypto/rsa/rsa_crpt.c:180: error: MEMORY_LEAK memory dynamically allocated by call to `BN_CTX_start()` at line 172, column 5 is not reachable after line 180, column 13. Showing all 89 steps of the trace crypto/rsa/rsa_crpt.c:160:1: start of procedure RSA_setup_blinding() 158. } 159. 160. > BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *in_ctx) 161. { 162. BIGNUM *e; crypto/rsa/rsa_crpt.c:164:5: 162. BIGNUM *e; 163. BN_CTX *ctx; 164. > BN_BLINDING *ret = NULL; 165. 166. if (in_ctx == NULL) { crypto/rsa/rsa_crpt.c:166:9: Taking true branch 164. BN_BLINDING *ret = NULL; 165. 166. if (in_ctx == NULL) { ^ 167. if ((ctx = BN_CTX_new()) == NULL) 168. return 0; crypto/rsa/rsa_crpt.c:167:13: 165. 166. if (in_ctx == NULL) { 167. > if ((ctx = BN_CTX_new()) == NULL) 168. return 0; 169. } else crypto/bn/bn_ctx.c:189:1: start of procedure BN_CTX_new() 187. 188. 189. > BN_CTX *BN_CTX_new(void) 190. { 191. BN_CTX *ret; crypto/bn/bn_ctx.c:193:9: 191. BN_CTX *ret; 192. 193. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE); 195. 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_ctx.c:193:9: Taking false branch 191. BN_CTX *ret; 192. 193. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE); 195. return NULL; crypto/bn/bn_ctx.c:198:5: 196. } 197. /* Initialise the structure */ 198. > BN_POOL_init(&ret->pool); 199. BN_STACK_init(&ret->stack); 200. return ret; crypto/bn/bn_ctx.c:335:1: start of procedure BN_POOL_init() 333. /***********/ 334. 335. > static void BN_POOL_init(BN_POOL *p) 336. { 337. p->head = p->current = p->tail = NULL; crypto/bn/bn_ctx.c:337:5: 335. static void BN_POOL_init(BN_POOL *p) 336. { 337. > p->head = p->current = p->tail = NULL; 338. p->used = p->size = 0; 339. } crypto/bn/bn_ctx.c:338:5: 336. { 337. p->head = p->current = p->tail = NULL; 338. > p->used = p->size = 0; 339. } 340. crypto/bn/bn_ctx.c:339:1: return from a call to BN_POOL_init 337. p->head = p->current = p->tail = NULL; 338. p->used = p->size = 0; 339. > } 340. 341. static void BN_POOL_finish(BN_POOL *p) crypto/bn/bn_ctx.c:199:5: 197. /* Initialise the structure */ 198. BN_POOL_init(&ret->pool); 199. > BN_STACK_init(&ret->stack); 200. return ret; 201. } crypto/bn/bn_ctx.c:294:1: start of procedure BN_STACK_init() 292. /************/ 293. 294. > static void BN_STACK_init(BN_STACK *st) 295. { 296. st->indexes = NULL; crypto/bn/bn_ctx.c:296:5: 294. static void BN_STACK_init(BN_STACK *st) 295. { 296. > st->indexes = NULL; 297. st->depth = st->size = 0; 298. } crypto/bn/bn_ctx.c:297:5: 295. { 296. st->indexes = NULL; 297. > st->depth = st->size = 0; 298. } 299. crypto/bn/bn_ctx.c:298:1: return from a call to BN_STACK_init 296. st->indexes = NULL; 297. st->depth = st->size = 0; 298. > } 299. 300. static void BN_STACK_finish(BN_STACK *st) crypto/bn/bn_ctx.c:200:5: 198. BN_POOL_init(&ret->pool); 199. BN_STACK_init(&ret->stack); 200. > return ret; 201. } 202. crypto/bn/bn_ctx.c:201:1: return from a call to BN_CTX_new 199. BN_STACK_init(&ret->stack); 200. return ret; 201. > } 202. 203. BN_CTX *BN_CTX_secure_new(void) crypto/rsa/rsa_crpt.c:167:13: Taking false branch 165. 166. if (in_ctx == NULL) { 167. if ((ctx = BN_CTX_new()) == NULL) ^ 168. return 0; 169. } else crypto/rsa/rsa_crpt.c:172:5: 170. ctx = in_ctx; 171. 172. > BN_CTX_start(ctx); 173. e = BN_CTX_get(ctx); 174. if (e == NULL) { crypto/bn/bn_ctx.c:236:1: start of procedure BN_CTX_start() 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_ctx.c:240:9: Taking false branch 238. CTXDBG_ENTRY("BN_CTX_start", ctx); 239. /* If we're already overflowing ... */ 240. if (ctx->err_stack || ctx->too_many) ^ 241. ctx->err_stack++; 242. /* (Try to) get a new frame pointer */ crypto/bn/bn_ctx.c:240:27: Taking false branch 238. CTXDBG_ENTRY("BN_CTX_start", ctx); 239. /* If we're already overflowing ... */ 240. if (ctx->err_stack || ctx->too_many) ^ 241. ctx->err_stack++; 242. /* (Try to) get a new frame pointer */ crypto/bn/bn_ctx.c:243:15: 241. ctx->err_stack++; 242. /* (Try to) get a new frame pointer */ 243. > else if (!BN_STACK_push(&ctx->stack, ctx->used)) { 244. BNerr(BN_F_BN_CTX_START, BN_R_TOO_MANY_TEMPORARY_VARIABLES); 245. ctx->err_stack++; crypto/bn/bn_ctx.c:307:1: start of procedure BN_STACK_push() 305. 306. 307. > static int BN_STACK_push(BN_STACK *st, unsigned int idx) 308. { 309. if (st->depth == st->size) { crypto/bn/bn_ctx.c:309:9: Taking true branch 307. static int BN_STACK_push(BN_STACK *st, unsigned int idx) 308. { 309. if (st->depth == st->size) { ^ 310. /* Need to expand */ 311. unsigned int newsize = crypto/bn/bn_ctx.c:312:13: Condition is false 310. /* Need to expand */ 311. unsigned int newsize = 312. st->size ? (st->size * 3 / 2) : BN_CTX_START_FRAMES; ^ 313. unsigned int *newitems = OPENSSL_malloc(sizeof(*newitems) * newsize); 314. if (newitems == NULL) crypto/bn/bn_ctx.c:311:9: 309. if (st->depth == st->size) { 310. /* Need to expand */ 311. > unsigned int newsize = 312. st->size ? (st->size * 3 / 2) : BN_CTX_START_FRAMES; 313. unsigned int *newitems = OPENSSL_malloc(sizeof(*newitems) * newsize); crypto/bn/bn_ctx.c:313:9: 311. unsigned int newsize = 312. st->size ? (st->size * 3 / 2) : BN_CTX_START_FRAMES; 313. > unsigned int *newitems = OPENSSL_malloc(sizeof(*newitems) * newsize); 314. if (newitems == NULL) 315. return 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/bn/bn_ctx.c:314:13: Taking false branch 312. st->size ? (st->size * 3 / 2) : BN_CTX_START_FRAMES; 313. unsigned int *newitems = OPENSSL_malloc(sizeof(*newitems) * newsize); 314. if (newitems == NULL) ^ 315. return 0; 316. if (st->depth) crypto/bn/bn_ctx.c:316:13: Taking false branch 314. if (newitems == NULL) 315. return 0; 316. if (st->depth) ^ 317. memcpy(newitems, st->indexes, sizeof(*newitems) * st->depth); 318. OPENSSL_free(st->indexes); crypto/bn/bn_ctx.c:318:9: 316. if (st->depth) 317. memcpy(newitems, st->indexes, sizeof(*newitems) * st->depth); 318. > OPENSSL_free(st->indexes); 319. st->indexes = newitems; 320. st->size = newsize; crypto/mem.c:234:1: start of procedure CRYPTO_free() 232. } 233. 234. > void CRYPTO_free(void *str) 235. { 236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:245:5: 243. } 244. #else 245. > free(str); 246. #endif 247. } crypto/mem.c:247:1: return from a call to CRYPTO_free 245. free(str); 246. #endif 247. > } 248. 249. void CRYPTO_clear_free(void *str, size_t num) crypto/bn/bn_ctx.c:319:9: 317. memcpy(newitems, st->indexes, sizeof(*newitems) * st->depth); 318. OPENSSL_free(st->indexes); 319. > st->indexes = newitems; 320. st->size = newsize; 321. } crypto/bn/bn_ctx.c:320:9: 318. OPENSSL_free(st->indexes); 319. st->indexes = newitems; 320. > st->size = newsize; 321. } 322. st->indexes[(st->depth)++] = idx; crypto/bn/bn_ctx.c:322:5: 320. st->size = newsize; 321. } 322. > st->indexes[(st->depth)++] = idx; 323. return 1; 324. } crypto/bn/bn_ctx.c:323:5: 321. } 322. st->indexes[(st->depth)++] = idx; 323. > return 1; 324. } 325. crypto/bn/bn_ctx.c:324:1: return from a call to BN_STACK_push 322. st->indexes[(st->depth)++] = idx; 323. return 1; 324. > } 325. 326. static unsigned int BN_STACK_pop(BN_STACK *st) crypto/bn/bn_ctx.c:243:15: Taking false branch 241. ctx->err_stack++; 242. /* (Try to) get a new frame pointer */ 243. else if (!BN_STACK_push(&ctx->stack, ctx->used)) { ^ 244. BNerr(BN_F_BN_CTX_START, BN_R_TOO_MANY_TEMPORARY_VARIABLES); 245. ctx->err_stack++; crypto/bn/bn_ctx.c:240:5: 238. CTXDBG_ENTRY("BN_CTX_start", ctx); 239. /* If we're already overflowing ... */ 240. > if (ctx->err_stack || ctx->too_many) 241. ctx->err_stack++; 242. /* (Try to) get a new frame pointer */ crypto/bn/bn_ctx.c:248:1: return from a call to BN_CTX_start 246. } 247. CTXDBG_EXIT(ctx); 248. > } 249. 250. void BN_CTX_end(BN_CTX *ctx) crypto/rsa/rsa_crpt.c:173:5: 171. 172. BN_CTX_start(ctx); 173. > e = BN_CTX_get(ctx); 174. if (e == NULL) { 175. RSAerr(RSA_F_RSA_SETUP_BLINDING, ERR_R_MALLOC_FAILURE); crypto/bn/bn_ctx.c:267:1: start of procedure BN_CTX_get() 265. } 266. 267. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 268. { 269. BIGNUM *ret; crypto/bn/bn_ctx.c:272:9: Taking false branch 270. 271. CTXDBG_ENTRY("BN_CTX_get", ctx); 272. if (ctx->err_stack || ctx->too_many) ^ 273. return NULL; 274. if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) { crypto/bn/bn_ctx.c:272:27: Taking false branch 270. 271. CTXDBG_ENTRY("BN_CTX_get", ctx); 272. if (ctx->err_stack || ctx->too_many) ^ 273. return NULL; 274. if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) { crypto/bn/bn_ctx.c:274:9: Taking false branch 272. if (ctx->err_stack || ctx->too_many) 273. return NULL; 274. if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) { ^ 275. /* 276. * Setting too_many prevents repeated "get" attempts from cluttering crypto/bn/bn_ctx.c:284:5: 282. } 283. /* OK, make sure the returned bignum is "zero" */ 284. > BN_zero(ret); 285. ctx->used++; 286. CTXDBG_RET(ctx, ret); 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) crypto/bn/bn_ctx.c:285:5: 283. /* OK, make sure the returned bignum is "zero" */ 284. BN_zero(ret); 285. > ctx->used++; 286. CTXDBG_RET(ctx, ret); 287. return ret; crypto/bn/bn_ctx.c:287:5: 285. ctx->used++; 286. CTXDBG_RET(ctx, ret); 287. > return ret; 288. } 289. crypto/bn/bn_ctx.c:288:1: return from a call to BN_CTX_get 286. CTXDBG_RET(ctx, ret); 287. return ret; 288. > } 289. 290. /************/ crypto/rsa/rsa_crpt.c:174:9: Taking false branch 172. BN_CTX_start(ctx); 173. e = BN_CTX_get(ctx); 174. if (e == NULL) { ^ 175. RSAerr(RSA_F_RSA_SETUP_BLINDING, ERR_R_MALLOC_FAILURE); 176. goto err; crypto/rsa/rsa_crpt.c:179:9: Taking true branch 177. } 178. 179. if (rsa->e == NULL) { ^ 180. e = rsa_get_public_exp(rsa->d, rsa->p, rsa->q, ctx); 181. if (e == NULL) { crypto/rsa/rsa_crpt.c:180:9: Skipping rsa_get_public_exp(): empty list of specs 178. 179. if (rsa->e == NULL) { 180. e = rsa_get_public_exp(rsa->d, rsa->p, rsa->q, ctx); ^ 181. if (e == NULL) { 182. RSAerr(RSA_F_RSA_SETUP_BLINDING, RSA_R_NO_PUBLIC_EXPONENT);
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/rsa/rsa_crpt.c/#L180
d2a_code_trace_data_45579
void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur, Picture *last, int y, int h, int picture_structure, int first_field, int draw_edges, int low_delay, int v_edge_pos, int h_edge_pos) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); int hshift = desc->log2_chroma_w; int vshift = desc->log2_chroma_h; const int field_pic = picture_structure != PICT_FRAME; if(field_pic){ h <<= 1; y <<= 1; } if (!avctx->hwaccel && draw_edges && cur->reference && !(avctx->flags & CODEC_FLAG_EMU_EDGE)) { int *linesize = cur->f.linesize; int sides = 0, edge_h; if (y==0) sides |= EDGE_TOP; if (y + h >= v_edge_pos) sides |= EDGE_BOTTOM; edge_h= FFMIN(h, v_edge_pos - y); dsp->draw_edges(cur->f.data[0] + y * linesize[0], linesize[0], h_edge_pos, edge_h, EDGE_WIDTH, EDGE_WIDTH, sides); dsp->draw_edges(cur->f.data[1] + (y >> vshift) * linesize[1], linesize[1], h_edge_pos >> hshift, edge_h >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, sides); dsp->draw_edges(cur->f.data[2] + (y >> vshift) * linesize[2], linesize[2], h_edge_pos >> hshift, edge_h >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, sides); } h = FFMIN(h, avctx->height - y); if(field_pic && first_field && !(avctx->slice_flags&SLICE_FLAG_ALLOW_FIELD)) return; if (avctx->draw_horiz_band) { AVFrame *src; int offset[AV_NUM_DATA_POINTERS]; int i; if(cur->f.pict_type == AV_PICTURE_TYPE_B || low_delay || (avctx->slice_flags & SLICE_FLAG_CODED_ORDER)) src = &cur->f; else if (last) src = &last->f; else return; if (cur->f.pict_type == AV_PICTURE_TYPE_B && picture_structure == PICT_FRAME && avctx->codec_id != AV_CODEC_ID_SVQ3) { for (i = 0; i < AV_NUM_DATA_POINTERS; i++) offset[i] = 0; }else{ offset[0]= y * src->linesize[0]; offset[1]= offset[2]= (y >> vshift) * src->linesize[1]; for (i = 3; i < AV_NUM_DATA_POINTERS; i++) offset[i] = 0; } emms_c(); avctx->draw_horiz_band(avctx, src, offset, y, picture_structure, h); } } libavcodec/mpegvideo.c:2235: error: Null Dereference pointer `desc` last assigned on line 2234 could be null and is dereferenced at line 2235, column 18. libavcodec/mpegvideo.c:2229:1: start of procedure ff_draw_horiz_band() 2227. * @param h is the normal height, this will be reduced automatically if needed for the last row 2228. */ 2229. void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur, ^ 2230. Picture *last, int y, int h, int picture_structure, 2231. int first_field, int draw_edges, int low_delay, libavcodec/mpegvideo.c:2234:5: 2232. int v_edge_pos, int h_edge_pos) 2233. { 2234. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); ^ 2235. int hshift = desc->log2_chroma_w; 2236. int vshift = desc->log2_chroma_h; libavutil/pixdesc.c:1507:1: start of procedure av_pix_fmt_desc_get() 1505. } 1506. 1507. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) ^ 1508. { 1509. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) libavutil/pixdesc.c:1509:9: Taking false branch 1507. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1508. { 1509. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1510. return NULL; 1511. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1509:24: Taking true branch 1507. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1508. { 1509. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1510. return NULL; 1511. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1510:9: 1508. { 1509. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) 1510. return NULL; ^ 1511. return &av_pix_fmt_descriptors[pix_fmt]; 1512. } libavutil/pixdesc.c:1512:1: return from a call to av_pix_fmt_desc_get 1510. return NULL; 1511. return &av_pix_fmt_descriptors[pix_fmt]; 1512. } ^ 1513. 1514. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) libavcodec/mpegvideo.c:2235:5: 2233. { 2234. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); 2235. int hshift = desc->log2_chroma_w; ^ 2236. int vshift = desc->log2_chroma_h; 2237. const int field_pic = picture_structure != PICT_FRAME;
https://github.com/libav/libav/blob/01f6df01b6fdc2d71b82370374cde4bf102928c7/libavcodec/mpegvideo.c/#L2235
d2a_code_trace_data_45580
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; } r->neg = a->neg; nw = n / BN_BITS2; if (bn_wexpand(r, a->top + nw + 1) == NULL) return (0); 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/bntest.c:231: error: BUFFER_OVERRUN_L3 Offset added: [0, 392] Size: [0, 67108856] by call to `BN_lshift`. Showing all 11 steps of the trace test/bntest.c:69:1: Assignment 67. } MPITEST; 68. 69. > static const int NUM0 = 100; /* number of tests */ 70. static const int NUM1 = 50; /* additional tests for some functions */ 71. static FILE *fp; test/bntest.c:231:13: Call 229. BN_bntest_rand(a, 400, 0, 0); 230. BN_copy(b, a); 231. BN_lshift(a, a, i); ^ 232. BN_add_word(a, i); 233. } else crypto/bn/bn_shift.c:81:1: <Offset trace> 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:81:1: Parameter `n` 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:96:5: Assignment 94. 95. r->neg = a->neg; 96. nw = n / BN_BITS2; ^ 97. if (bn_wexpand(r, a->top + nw + 1) == NULL) 98. return (0); crypto/bn/bn_shift.c:81:1: <Length trace> 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:81:1: Parameter `*r->d` 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:9: Call 95. r->neg = a->neg; 96. nw = n / BN_BITS2; 97. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 98. return (0); 99. lb = n % BN_BITS2; crypto/bn/bn_lib.c:1016:1: Parameter `*a->d` 1014. } 1015. 1016. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 1017. { 1018. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:102:5: Assignment 100. rb = BN_BITS2 - lb; 101. f = a->d; 102. t = r->d; ^ 103. t[a->top + nw] = 0; 104. if (lb == 0) crypto/bn/bn_shift.c:113:5: Array access: Offset added: [0, 392] Size: [0, 67108856] by call to `BN_lshift` 111. t[nw + i] = (l << lb) & BN_MASK2; 112. } 113. memset(t, 0, sizeof(*t) * nw); ^ 114. r->top = a->top + nw + 1; 115. bn_correct_top(r);
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_shift.c/#L113
d2a_code_trace_data_45581
static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, const int size, const int h, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ MotionEstContext * const c= &s->me; const int stride= c->stride; const int uvstride= c->uvstride; const int qpel= flags&FLAG_QPEL; const int chroma= flags&FLAG_CHROMA; const int dxy= subx + (suby<<(1+qpel)); const int hx= subx + (x<<(1+qpel)); const int hy= suby + (y<<(1+qpel)); uint8_t * const * const ref= c->ref[ref_index]; uint8_t * const * const src= c->src[src_index]; int d; if(flags&FLAG_DIRECT){ assert(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)); if(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)){ const int time_pp= s->pp_time; const int time_pb= s->pb_time; const int mask= 2*qpel+1; if(s->mv_type==MV_TYPE_8X8){ int i; for(i=0; i<4; i++){ int fx = c->direct_basis_mv[i][0] + hx; int fy = c->direct_basis_mv[i][1] + hy; int bx = hx ? fx - c->co_located_mv[i][0] : c->co_located_mv[i][0]*(time_pb - time_pp)/time_pp + ((i &1)<<(qpel+4)); int by = hy ? fy - c->co_located_mv[i][1] : c->co_located_mv[i][1]*(time_pb - time_pp)/time_pp + ((i>>1)<<(qpel+4)); int fxy= (fx&mask) + ((fy&mask)<<(qpel+1)); int bxy= (bx&mask) + ((by&mask)<<(qpel+1)); uint8_t *dst= c->temp + 8*(i&1) + 8*stride*(i>>1); if(qpel){ c->qpel_put[1][fxy](dst, ref[0] + (fx>>2) + (fy>>2)*stride, stride); c->qpel_avg[1][bxy](dst, ref[8] + (bx>>2) + (by>>2)*stride, stride); }else{ c->hpel_put[1][fxy](dst, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 8); c->hpel_avg[1][bxy](dst, ref[8] + (bx>>1) + (by>>1)*stride, stride, 8); } } }else{ int fx = c->direct_basis_mv[0][0] + hx; int fy = c->direct_basis_mv[0][1] + hy; int bx = hx ? fx - c->co_located_mv[0][0] : (c->co_located_mv[0][0]*(time_pb - time_pp)/time_pp); int by = hy ? fy - c->co_located_mv[0][1] : (c->co_located_mv[0][1]*(time_pb - time_pp)/time_pp); int fxy= (fx&mask) + ((fy&mask)<<(qpel+1)); int bxy= (bx&mask) + ((by&mask)<<(qpel+1)); if(qpel){ c->qpel_put[1][fxy](c->temp , ref[0] + (fx>>2) + (fy>>2)*stride , stride); c->qpel_put[1][fxy](c->temp + 8 , ref[0] + (fx>>2) + (fy>>2)*stride + 8 , stride); c->qpel_put[1][fxy](c->temp + 8*stride, ref[0] + (fx>>2) + (fy>>2)*stride + 8*stride, stride); c->qpel_put[1][fxy](c->temp + 8 + 8*stride, ref[0] + (fx>>2) + (fy>>2)*stride + 8 + 8*stride, stride); c->qpel_avg[1][bxy](c->temp , ref[8] + (bx>>2) + (by>>2)*stride , stride); c->qpel_avg[1][bxy](c->temp + 8 , ref[8] + (bx>>2) + (by>>2)*stride + 8 , stride); c->qpel_avg[1][bxy](c->temp + 8*stride, ref[8] + (bx>>2) + (by>>2)*stride + 8*stride, stride); c->qpel_avg[1][bxy](c->temp + 8 + 8*stride, ref[8] + (bx>>2) + (by>>2)*stride + 8 + 8*stride, stride); }else{ assert((fx>>1) + 16*s->mb_x >= -16); assert((fy>>1) + 16*s->mb_y >= -16); assert((fx>>1) + 16*s->mb_x <= s->width); assert((fy>>1) + 16*s->mb_y <= s->height); assert((bx>>1) + 16*s->mb_x >= -16); assert((by>>1) + 16*s->mb_y >= -16); assert((bx>>1) + 16*s->mb_x <= s->width); assert((by>>1) + 16*s->mb_y <= s->height); c->hpel_put[0][fxy](c->temp, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 16); c->hpel_avg[0][bxy](c->temp, ref[8] + (bx>>1) + (by>>1)*stride, stride, 16); } } d = cmp_func(s, c->temp, src[0], stride, 16); }else d= 256*256*256*32; }else{ int uvdxy; if(dxy){ if(qpel){ c->qpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride); if(chroma){ int cx= hx/2; int cy= hy/2; cx= (cx>>1)|(cx&1); cy= (cy>>1)|(cy&1); uvdxy= (cx&1) + 2*(cy&1); } }else{ c->hpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride, h); if(chroma) uvdxy= dxy | (x&1) | (2*(y&1)); } d = cmp_func(s, c->temp, src[0], stride, h); }else{ d = cmp_func(s, src[0], ref[0] + x + y*stride, stride, h); if(chroma) uvdxy= (x&1) + 2*(y&1); } if(chroma){ uint8_t * const uvtemp= c->temp + 16*stride; c->hpel_put[size+1][uvdxy](uvtemp , ref[1] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1); c->hpel_put[size+1][uvdxy](uvtemp+8, ref[2] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1); d += chroma_cmp_func(s, uvtemp , src[1], uvstride, h>>1); d += chroma_cmp_func(s, uvtemp+8, src[2], uvstride, h>>1); } } #if 0 if(full_pel){ const int index= (((y)<<ME_MAP_SHIFT) + (x))&(ME_MAP_SIZE-1); score_map[index]= d; } d += (c->mv_penalty[hx - c->pred_x] + c->mv_penalty[hy - c->pred_y])*c->penalty_factor; #endif return d; } libavcodec/motion_est.c:1923: error: Buffer Overrun L1 Offset: 10 (⇐ 2 + 8) Size: 4 by call to `ff_estimate_motion_b`. libavcodec/motion_est.c:1923:11: Call 1921. 1922. c->skip=0; 1923. bmin= ff_estimate_motion_b(s, mb_x, mb_y, s->b_back_mv_table, 2, s->b_code) + 2*penalty_factor; ^ 1924. //printf(" %d %d ", s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1]); 1925. libavcodec/motion_est.c:1481:1: Parameter `ref_index` 1479. } 1480. 1481. static int ff_estimate_motion_b(MpegEncContext * s, ^ 1482. int mb_x, int mb_y, int16_t (*mv_table)[2], int ref_index, int f_code) 1483. { libavcodec/motion_est.c:1556:16: Call 1554. } 1555. 1556. dmin = ff_epzs_motion_search(s, &mx, &my, P, 0, ref_index, s->p_mv_table, mv_scale, 0, 16); ^ 1557. 1558. break; libavcodec/motion_est_template.c:1116:1: Parameter `ref_index` 1114. 1115. //this function is dedicated to the braindamaged gcc 1116. inline int ff_epzs_motion_search(MpegEncContext * s, int *mx_ptr, int *my_ptr, ^ 1117. int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], 1118. int ref_mv_scale, int size, int h) libavcodec/motion_est_template.c:1123:16: Call 1121. //FIXME convert other functions in the same way if faster 1122. if(c->flags==0 && h==16 && size==0){ 1123. return epzs_motion_search_internal(s, mx_ptr, my_ptr, P, src_index, ref_index, last_mv, ref_mv_scale, 0, 0, 16); ^ 1124. // case FLAG_QPEL: 1125. // return epzs_motion_search_internal(s, mx_ptr, my_ptr, P, src_index, ref_index, last_mv, ref_mv_scale, FLAG_QPEL); libavcodec/motion_est_template.c:999:1: Parameter `ref_index` 997. optimal mv. 998. */ 999. static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr, ^ 1000. int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], 1001. int ref_mv_scale, int flags, int size, int h) libavcodec/motion_est_template.c:1105:11: Call 1103. 1104. //check(best[0],best[1],0, b0) 1105. dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); ^ 1106. 1107. //check(best[0],best[1],0, b1) libavcodec/motion_est_template.c:973:1: Parameter `ref_index` 971. } 972. 973. static av_always_inline int diamond_search(MpegEncContext * s, int *best, int dmin, ^ 974. int src_index, int ref_index, int const penalty_factor, 975. int size, int h, int flags){ libavcodec/motion_est_template.c:980:18: Call 978. return funny_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); 979. else if(c->dia_size<-1) 980. return sab_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); ^ 981. else if(c->dia_size<2) 982. return small_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); libavcodec/motion_est_template.c:809:1: Parameter `ref_index` 807. 808. #define MAX_SAB_SIZE ME_MAP_SIZE 809. static int sab_diamond_search(MpegEncContext * s, int *best, int dmin, ^ 810. int src_index, int ref_index, int const penalty_factor, 811. int size, int h, int flags) libavcodec/motion_est_template.c:872:9: Call 870. continue; 871. 872. SAB_CHECK_MV(x-1, y) ^ 873. SAB_CHECK_MV(x+1, y) 874. SAB_CHECK_MV(x , y-1) libavcodec/motion_est.c:108:1: <Length trace> 106. against a proposed motion-compensated prediction of that block 107. */ 108. static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, ^ 109. const int size, const int h, int ref_index, int src_index, 110. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ libavcodec/motion_est.c:108:1: Parameter `ref_index` 106. against a proposed motion-compensated prediction of that block 107. */ 108. static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, ^ 109. const int size, const int h, int ref_index, int src_index, 110. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ libavcodec/motion_est.c:119:5: Assignment 117. const int hx= subx + (x<<(1+qpel)); 118. const int hy= suby + (y<<(1+qpel)); 119. uint8_t * const * const ref= c->ref[ref_index]; ^ 120. uint8_t * const * const src= c->src[src_index]; 121. int d; libavcodec/motion_est.c:176:50: Array access: Offset: 10 (⇐ 2 + 8) Size: 4 by call to `ff_estimate_motion_b` 174. 175. c->hpel_put[0][fxy](c->temp, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 16); 176. c->hpel_avg[0][bxy](c->temp, ref[8] + (bx>>1) + (by>>1)*stride, stride, 16); ^ 177. } 178. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est.c/#L176
d2a_code_trace_data_45582
static int var_diamond_search(MpegEncContext * s, int *best, int dmin, int src_index, int ref_index, int const penalty_factor, int size, int h, int flags) { MotionEstContext * const c= &s->me; me_cmp_func cmpf, chroma_cmpf; int dia_size; LOAD_COMMON LOAD_COMMON2 int map_generation= c->map_generation; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; for(dia_size=1; dia_size<=c->dia_size; dia_size++){ int dir, start, end; const int x= best[0]; const int y= best[1]; start= FFMAX(0, y + dia_size - ymax); end = FFMIN(dia_size, xmax - x + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x + dir , y + dia_size - dir); } start= FFMAX(0, x + dia_size - xmax); end = FFMIN(dia_size, y - ymin + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x + dia_size - dir, y - dir ); } start= FFMAX(0, -y + dia_size + ymin ); end = FFMIN(dia_size, x - xmin + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x - dir , y - dia_size + dir); } start= FFMAX(0, -x + dia_size + xmin ); end = FFMIN(dia_size, ymax - y + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x - dia_size + dir, y + dir ); } if(x!=best[0] || y!=best[1]) dia_size=0; #if 0 { int dx, dy, i; static int stats[8*8]; dx= FFABS(x-best[0]); dy= FFABS(y-best[1]); stats[dy*8 + dx] ++; if(256*256*256*64 % (stats[0]+1)==0){ for(i=0; i<64; i++){ if((i&7)==0) printf("\n"); printf("%6d ", stats[i]); } printf("\n"); } } #endif } return dmin; } libavcodec/motion_est_template.c:943: error: Uninitialized Value The value read from ymax was never initialized. libavcodec/motion_est_template.c:943:16: 941. 942. start= FFMAX(0, -x + dia_size + xmin ); 943. end = FFMIN(dia_size, ymax - y + 1); ^ 944. for(dir= start; dir<end; dir++){ 945. int d;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L943
d2a_code_trace_data_45583
static void pred8x8l_down_left_c(uint8_t *src, int has_topleft, int has_topright, int stride) { PREDICT_8x8_LOAD_TOP; PREDICT_8x8_LOAD_TOPRIGHT; SRC(0,0)= (t0 + 2*t1 + t2 + 2) >> 2; SRC(0,1)=SRC(1,0)= (t1 + 2*t2 + t3 + 2) >> 2; SRC(0,2)=SRC(1,1)=SRC(2,0)= (t2 + 2*t3 + t4 + 2) >> 2; SRC(0,3)=SRC(1,2)=SRC(2,1)=SRC(3,0)= (t3 + 2*t4 + t5 + 2) >> 2; SRC(0,4)=SRC(1,3)=SRC(2,2)=SRC(3,1)=SRC(4,0)= (t4 + 2*t5 + t6 + 2) >> 2; SRC(0,5)=SRC(1,4)=SRC(2,3)=SRC(3,2)=SRC(4,1)=SRC(5,0)= (t5 + 2*t6 + t7 + 2) >> 2; SRC(0,6)=SRC(1,5)=SRC(2,4)=SRC(3,3)=SRC(4,2)=SRC(5,1)=SRC(6,0)= (t6 + 2*t7 + t8 + 2) >> 2; SRC(0,7)=SRC(1,6)=SRC(2,5)=SRC(3,4)=SRC(4,3)=SRC(5,2)=SRC(6,1)=SRC(7,0)= (t7 + 2*t8 + t9 + 2) >> 2; SRC(1,7)=SRC(2,6)=SRC(3,5)=SRC(4,4)=SRC(5,3)=SRC(6,2)=SRC(7,1)= (t8 + 2*t9 + t10 + 2) >> 2; SRC(2,7)=SRC(3,6)=SRC(4,5)=SRC(5,4)=SRC(6,3)=SRC(7,2)= (t9 + 2*t10 + t11 + 2) >> 2; SRC(3,7)=SRC(4,6)=SRC(5,5)=SRC(6,4)=SRC(7,3)= (t10 + 2*t11 + t12 + 2) >> 2; SRC(4,7)=SRC(5,6)=SRC(6,5)=SRC(7,4)= (t11 + 2*t12 + t13 + 2) >> 2; SRC(5,7)=SRC(6,6)=SRC(7,5)= (t12 + 2*t13 + t14 + 2) >> 2; SRC(6,7)=SRC(7,6)= (t13 + 2*t14 + t15 + 2) >> 2; SRC(7,7)= (t14 + 3*t15 + 2) >> 2; } libavcodec/h264pred.c:841: error: Uninitialized Value The value read from t7 was never initialized. libavcodec/h264pred.c:841:50: 839. SRC(0,3)=SRC(1,2)=SRC(2,1)=SRC(3,0)= (t3 + 2*t4 + t5 + 2) >> 2; 840. SRC(0,4)=SRC(1,3)=SRC(2,2)=SRC(3,1)=SRC(4,0)= (t4 + 2*t5 + t6 + 2) >> 2; 841. SRC(0,5)=SRC(1,4)=SRC(2,3)=SRC(3,2)=SRC(4,1)=SRC(5,0)= (t5 + 2*t6 + t7 + 2) >> 2; ^ 842. SRC(0,6)=SRC(1,5)=SRC(2,4)=SRC(3,3)=SRC(4,2)=SRC(5,1)=SRC(6,0)= (t6 + 2*t7 + t8 + 2) >> 2; 843. SRC(0,7)=SRC(1,6)=SRC(2,5)=SRC(3,4)=SRC(4,3)=SRC(5,2)=SRC(6,1)=SRC(7,0)= (t7 + 2*t8 + t9 + 2) >> 2;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264pred.c/#L841
d2a_code_trace_data_45584
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/lhash_test.c:161: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `lh_int_delete`. Showing all 10 steps of the trace test/lhash_test.c:98:13: Call 96. /* insert */ 97. for (i = 0; i < n_int_tests; i++) 98. if (lh_int_insert(h, int_tests + i) != NULL) { ^ 99. fprintf(stderr, "test lhash int insert %d\n", i); 100. goto end; test/lhash_test.c:34:1: Parameter `lh->num_items` 32. #endif 33. 34. > DEFINE_LHASH_OF(int); 35. 36. static int int_tests[] = { 65537, 13, 1, 3, -5, 6, 7, 4, -10, -12, -14, 22, 9, test/lhash_test.c:34:1: Call 32. #endif 33. 34. > DEFINE_LHASH_OF(int); 35. 36. static int int_tests[] = { 65537, 13, 1, 3, -5, 6, 7, 4, -10, -12, -14, 22, 9, crypto/lhash/lhash.c:70:1: Parameter `lh->num_items` 68. } 69. 70. > void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data) 71. { 72. unsigned long hash; test/lhash_test.c:161:23: Call 159. /* delete */ 160. for (i = 0; i < n_dels; i++) { 161. const int b = lh_int_delete(h, &dels[i].data) == NULL; ^ 162. if ((b ^ dels[i].null) != 0) { 163. fprintf(stderr, "test lhash int delete %d\n", i); test/lhash_test.c:34:1: Parameter `lh->num_items` 32. #endif 33. 34. > DEFINE_LHASH_OF(int); 35. 36. static int int_tests[] = { 65537, 13, 1, 3, -5, 6, 7, 4, -10, -12, -14, 22, 9, test/lhash_test.c:34:1: Call 32. #endif 33. 34. > DEFINE_LHASH_OF(int); 35. 36. static int int_tests[] = { 65537, 13, 1, 3, -5, 6, 7, 4, -10, -12, -14, 22, 9, crypto/lhash/lhash.c:103:1: <LHS trace> 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:103:1: Parameter `lh->num_items` 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:123:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `lh_int_delete` 121. } 122. 123. lh->num_items--; ^ 124. if ((lh->num_nodes > MIN_NODES) && 125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
https://github.com/openssl/openssl/blob/9998b32cb63b0bdd3d014abfa1d70e9a2c20a283/crypto/lhash/lhash.c/#L123
d2a_code_trace_data_45585
int ASN1_UTCTIME_print(BIO *bp, const ASN1_UTCTIME *tm) { const char *v; int gmt = 0; int i; int y = 0, M = 0, d = 0, h = 0, m = 0, s = 0; i = tm->length; v = (const char *)tm->data; if (i < 10) goto err; if (v[i - 1] == 'Z') gmt = 1; for (i = 0; i < 10; i++) if ((v[i] > '9') || (v[i] < '0')) goto err; y = (v[0] - '0') * 10 + (v[1] - '0'); if (y < 50) y += 100; M = (v[2] - '0') * 10 + (v[3] - '0'); if ((M > 12) || (M < 1)) goto err; d = (v[4] - '0') * 10 + (v[5] - '0'); h = (v[6] - '0') * 10 + (v[7] - '0'); m = (v[8] - '0') * 10 + (v[9] - '0'); if (tm->length >= 12 && (v[10] >= '0') && (v[10] <= '9') && (v[11] >= '0') && (v[11] <= '9')) s = (v[10] - '0') * 10 + (v[11] - '0'); if (BIO_printf(bp, "%s %2d %02d:%02d:%02d %d%s", mon[M - 1], d, h, m, s, y + 1900, (gmt) ? " GMT" : "") <= 0) return (0); else return (1); err: BIO_write(bp, "Bad time value", 14); return (0); } crypto/asn1/tasn_prn.c:546: error: BUFFER_OVERRUN_L3 Offset: [-529, +oo] Size: 12 by call to `ASN1_UTCTIME_print`. Showing all 7 steps of the trace crypto/asn1/tasn_prn.c:546:15: Call 544. 545. case V_ASN1_UTCTIME: 546. ret = ASN1_UTCTIME_print(out, str); ^ 547. break; 548. crypto/asn1/t_x509.c:459:1: <Offset trace> 457. } 458. 459. > int ASN1_UTCTIME_print(BIO *bp, const ASN1_UTCTIME *tm) 460. { 461. const char *v; crypto/asn1/t_x509.c:459:1: Parameter `*tm->data` 457. } 458. 459. > int ASN1_UTCTIME_print(BIO *bp, const ASN1_UTCTIME *tm) 460. { 461. const char *v; crypto/asn1/t_x509.c:479:5: Assignment 477. if (y < 50) 478. y += 100; 479. M = (v[2] - '0') * 10 + (v[3] - '0'); ^ 480. if ((M > 12) || (M < 1)) 481. 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:490:20: Array access: Offset: [-529, +oo] Size: 12 by call to `ASN1_UTCTIME_print` 488. 489. if (BIO_printf(bp, "%s %2d %02d:%02d:%02d %d%s", 490. mon[M - 1], d, h, m, s, y + 1900, ^ 491. (gmt) ? " GMT" : "") <= 0) 492. return (0);
https://github.com/openssl/openssl/blob/9c46f4b9cd4912b61cb546c48b678488d7f26ed6/crypto/asn1/t_x509.c/#L490
d2a_code_trace_data_45586
int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx, unsigned char *md_out, size_t *md_out_size, const unsigned char header[13], const unsigned char *data, size_t data_plus_mac_size, size_t data_plus_mac_plus_padding_size, const unsigned char *mac_secret, size_t mac_secret_length, char is_sslv3) { union { double align; unsigned char c[sizeof(LARGEST_DIGEST_CTX)]; } md_state; void (*md_final_raw) (void *ctx, unsigned char *md_out); void (*md_transform) (void *ctx, const unsigned char *block); size_t md_size, md_block_size = 64; size_t sslv3_pad_length = 40, header_length, variance_blocks, len, max_mac_bytes, num_blocks, num_starting_blocks, k, mac_end_offset, c, index_a, index_b; size_t bits; unsigned char length_bytes[MAX_HASH_BIT_COUNT_BYTES]; unsigned char hmac_pad[MAX_HASH_BLOCK_SIZE]; unsigned char first_block[MAX_HASH_BLOCK_SIZE]; unsigned char mac_out[EVP_MAX_MD_SIZE]; size_t i, j; unsigned md_out_size_u; EVP_MD_CTX *md_ctx = NULL; size_t md_length_size = 8; char length_is_big_endian = 1; int ret; OPENSSL_assert(data_plus_mac_plus_padding_size < 1024 * 1024); switch (EVP_MD_CTX_type(ctx)) { case NID_md5: if (MD5_Init((MD5_CTX *)md_state.c) <= 0) return 0; md_final_raw = tls1_md5_final_raw; md_transform = (void (*)(void *ctx, const unsigned char *block))MD5_Transform; md_size = 16; sslv3_pad_length = 48; length_is_big_endian = 0; break; case NID_sha1: if (SHA1_Init((SHA_CTX *)md_state.c) <= 0) return 0; md_final_raw = tls1_sha1_final_raw; md_transform = (void (*)(void *ctx, const unsigned char *block))SHA1_Transform; md_size = 20; break; case NID_sha224: if (SHA224_Init((SHA256_CTX *)md_state.c) <= 0) return 0; md_final_raw = tls1_sha256_final_raw; md_transform = (void (*)(void *ctx, const unsigned char *block))SHA256_Transform; md_size = 224 / 8; break; case NID_sha256: if (SHA256_Init((SHA256_CTX *)md_state.c) <= 0) return 0; md_final_raw = tls1_sha256_final_raw; md_transform = (void (*)(void *ctx, const unsigned char *block))SHA256_Transform; md_size = 32; break; case NID_sha384: if (SHA384_Init((SHA512_CTX *)md_state.c) <= 0) return 0; md_final_raw = tls1_sha512_final_raw; md_transform = (void (*)(void *ctx, const unsigned char *block))SHA512_Transform; md_size = 384 / 8; md_block_size = 128; md_length_size = 16; break; case NID_sha512: if (SHA512_Init((SHA512_CTX *)md_state.c) <= 0) return 0; md_final_raw = tls1_sha512_final_raw; md_transform = (void (*)(void *ctx, const unsigned char *block))SHA512_Transform; md_size = 64; md_block_size = 128; md_length_size = 16; break; default: OPENSSL_assert(0); if (md_out_size) *md_out_size = 0; return 0; } OPENSSL_assert(md_length_size <= MAX_HASH_BIT_COUNT_BYTES); OPENSSL_assert(md_block_size <= MAX_HASH_BLOCK_SIZE); OPENSSL_assert(md_size <= EVP_MAX_MD_SIZE); header_length = 13; if (is_sslv3) { header_length = mac_secret_length + sslv3_pad_length + 8 + 1 + 2 ; } variance_blocks = is_sslv3 ? 2 : 6; len = data_plus_mac_plus_padding_size + header_length; max_mac_bytes = len - md_size - 1; num_blocks = (max_mac_bytes + 1 + md_length_size + md_block_size - 1) / md_block_size; num_starting_blocks = 0; k = 0; mac_end_offset = data_plus_mac_size + header_length - md_size; c = mac_end_offset % md_block_size; index_a = mac_end_offset / md_block_size; index_b = (mac_end_offset + md_length_size) / md_block_size; if (num_blocks > variance_blocks + (is_sslv3 ? 1 : 0)) { num_starting_blocks = num_blocks - variance_blocks; k = md_block_size * num_starting_blocks; } bits = 8 * mac_end_offset; if (!is_sslv3) { bits += 8 * md_block_size; memset(hmac_pad, 0, md_block_size); OPENSSL_assert(mac_secret_length <= sizeof(hmac_pad)); memcpy(hmac_pad, mac_secret, mac_secret_length); for (i = 0; i < md_block_size; i++) hmac_pad[i] ^= 0x36; md_transform(md_state.c, hmac_pad); } if (length_is_big_endian) { memset(length_bytes, 0, md_length_size - 4); length_bytes[md_length_size - 4] = (unsigned char)(bits >> 24); length_bytes[md_length_size - 3] = (unsigned char)(bits >> 16); length_bytes[md_length_size - 2] = (unsigned char)(bits >> 8); length_bytes[md_length_size - 1] = (unsigned char)bits; } else { memset(length_bytes, 0, md_length_size); length_bytes[md_length_size - 5] = (unsigned char)(bits >> 24); length_bytes[md_length_size - 6] = (unsigned char)(bits >> 16); length_bytes[md_length_size - 7] = (unsigned char)(bits >> 8); length_bytes[md_length_size - 8] = (unsigned char)bits; } if (k > 0) { if (is_sslv3) { size_t overhang; if (header_length <= md_block_size) { return 0; } overhang = header_length - md_block_size; md_transform(md_state.c, header); memcpy(first_block, header + md_block_size, overhang); memcpy(first_block + overhang, data, md_block_size - overhang); md_transform(md_state.c, first_block); for (i = 1; i < k / md_block_size - 1; i++) md_transform(md_state.c, data + md_block_size * i - overhang); } else { memcpy(first_block, header, 13); memcpy(first_block + 13, data, md_block_size - 13); md_transform(md_state.c, first_block); for (i = 1; i < k / md_block_size; i++) md_transform(md_state.c, data + md_block_size * i - 13); } } memset(mac_out, 0, sizeof(mac_out)); for (i = num_starting_blocks; i <= num_starting_blocks + variance_blocks; i++) { unsigned char block[MAX_HASH_BLOCK_SIZE]; unsigned char is_block_a = constant_time_eq_8_s(i, index_a); unsigned char is_block_b = constant_time_eq_8_s(i, index_b); for (j = 0; j < md_block_size; j++) { unsigned char b = 0, is_past_c, is_past_cp1; if (k < header_length) b = header[k]; else if (k < data_plus_mac_plus_padding_size + header_length) b = data[k - header_length]; k++; is_past_c = is_block_a & constant_time_ge_8_s(j, c); is_past_cp1 = is_block_a & constant_time_ge_8_s(j, c + 1); b = constant_time_select_8(is_past_c, 0x80, b); b = b & ~is_past_cp1; b &= ~is_block_b | is_block_a; if (j >= md_block_size - md_length_size) { b = constant_time_select_8(is_block_b, length_bytes[j - (md_block_size - md_length_size)], b); } block[j] = b; } md_transform(md_state.c, block); md_final_raw(md_state.c, block); for (j = 0; j < md_size; j++) mac_out[j] |= block[j] & is_block_b; } md_ctx = EVP_MD_CTX_new(); if (md_ctx == NULL) goto err; if (EVP_DigestInit_ex(md_ctx, EVP_MD_CTX_md(ctx), NULL ) <= 0) goto err; if (is_sslv3) { memset(hmac_pad, 0x5c, sslv3_pad_length); if (EVP_DigestUpdate(md_ctx, mac_secret, mac_secret_length) <= 0 || EVP_DigestUpdate(md_ctx, hmac_pad, sslv3_pad_length) <= 0 || EVP_DigestUpdate(md_ctx, mac_out, md_size) <= 0) goto err; } else { for (i = 0; i < md_block_size; i++) hmac_pad[i] ^= 0x6a; if (EVP_DigestUpdate(md_ctx, hmac_pad, md_block_size) <= 0 || EVP_DigestUpdate(md_ctx, mac_out, md_size) <= 0) goto err; } ret = EVP_DigestFinal(md_ctx, md_out, &md_out_size_u); if (ret && md_out_size) *md_out_size = md_out_size_u; EVP_MD_CTX_free(md_ctx); return 1; err: EVP_MD_CTX_free(md_ctx); return 0; } ssl/s3_cbc.c:439: error: BUFFER_OVERRUN_L2 Offset: [-72, 79] Size: 16. Showing all 5 steps of the trace ssl/s3_cbc.c:145:5: <Offset trace> 143. void (*md_final_raw) (void *ctx, unsigned char *md_out); 144. void (*md_transform) (void *ctx, const unsigned char *block); 145. size_t md_size, md_block_size = 64; ^ 146. size_t sslv3_pad_length = 40, header_length, variance_blocks, 147. len, max_mac_bytes, num_blocks, ssl/s3_cbc.c:145:5: Assignment 143. void (*md_final_raw) (void *ctx, unsigned char *md_out); 144. void (*md_transform) (void *ctx, const unsigned char *block); 145. size_t md_size, md_block_size = 64; ^ 146. size_t sslv3_pad_length = 40, header_length, variance_blocks, 147. len, max_mac_bytes, num_blocks, ssl/s3_cbc.c:129:1: <Length trace> 127. * Returns 1 on success or 0 on error 128. */ 129. > int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx, 130. unsigned char *md_out, 131. size_t *md_out_size, ssl/s3_cbc.c:129:1: Array declaration 127. * Returns 1 on success or 0 on error 128. */ 129. > int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx, 130. unsigned char *md_out, 131. size_t *md_out_size, ssl/s3_cbc.c:439:44: Array access: Offset: [-72, 79] Size: 16 437. /* If this is index_b, write a length byte. */ 438. b = constant_time_select_8(is_block_b, 439. length_bytes[j - ^ 440. (md_block_size - 441. md_length_size)], b);
https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/ssl/s3_cbc.c/#L439
d2a_code_trace_data_45587
static int do_not_call_session_ticket_cb(SSL *s, unsigned char *key_name, unsigned char *iv, EVP_CIPHER_CTX *ctx, HMAC_CTX *hctx, int enc) { HANDSHAKE_EX_DATA *ex_data = (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); ex_data->session_ticket_do_not_call = 1; return 0; } test/handshake_helper.c:322: error: NULL_DEREFERENCE pointer `ex_data` last assigned on line 320 could be null and is dereferenced at line 322, column 5. Showing all 10 steps of the trace test/handshake_helper.c:315:1: start of procedure do_not_call_session_ticket_cb() 313. } 314. 315. > static int do_not_call_session_ticket_cb(SSL *s, unsigned char *key_name, 316. unsigned char *iv, 317. EVP_CIPHER_CTX *ctx, test/handshake_helper.c:320:5: 318. HMAC_CTX *hctx, int enc) 319. { 320. > HANDSHAKE_EX_DATA *ex_data = 321. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); 322. ex_data->session_ticket_do_not_call = 1; ssl/ssl_lib.c:3729:1: start of procedure SSL_get_ex_data() 3727. } 3728. 3729. > void *SSL_get_ex_data(const SSL *s, int idx) 3730. { 3731. return (CRYPTO_get_ex_data(&s->ex_data, idx)); ssl/ssl_lib.c:3731:5: 3729. void *SSL_get_ex_data(const SSL *s, int idx) 3730. { 3731. > return (CRYPTO_get_ex_data(&s->ex_data, idx)); 3732. } 3733. crypto/ex_data.c:387:1: start of procedure CRYPTO_get_ex_data() 385. * particular index in the class used by this variable 386. */ 387. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 388. { 389. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) crypto/ex_data.c:389:9: Taking true branch 387. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 388. { 389. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) ^ 390. return NULL; 391. return sk_void_value(ad->sk, idx); crypto/ex_data.c:390:9: 388. { 389. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) 390. > return NULL; 391. return sk_void_value(ad->sk, idx); 392. } crypto/ex_data.c:392:1: return from a call to CRYPTO_get_ex_data 390. return NULL; 391. return sk_void_value(ad->sk, idx); 392. > } ssl/ssl_lib.c:3732:1: return from a call to SSL_get_ex_data 3730. { 3731. return (CRYPTO_get_ex_data(&s->ex_data, idx)); 3732. > } 3733. 3734. int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg) test/handshake_helper.c:322:5: 320. HANDSHAKE_EX_DATA *ex_data = 321. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); 322. > ex_data->session_ticket_do_not_call = 1; 323. return 0; 324. }
https://github.com/openssl/openssl/blob/0f5df0f1037590de12cc11eeab26fe29bf3f16a3/test/handshake_helper.c/#L322
d2a_code_trace_data_45588
int RAND_status(void) { const RAND_METHOD *meth = RAND_get_rand_method(); if (meth->status != NULL) return meth->status(); return 0; } crypto/rand/rand_lib.c:830: error: NULL_DEREFERENCE pointer `meth` last assigned on line 828 could be null and is dereferenced at line 830, column 9. Showing all 6 steps of the trace crypto/rand/rand_lib.c:826:1: start of procedure RAND_status() 824. #endif 825. 826. > int RAND_status(void) 827. { 828. const RAND_METHOD *meth = RAND_get_rand_method(); crypto/rand/rand_lib.c:828:5: 826. int RAND_status(void) 827. { 828. > const RAND_METHOD *meth = RAND_get_rand_method(); 829. 830. if (meth->status != NULL) crypto/rand/rand_lib.c:686:1: start of procedure RAND_get_rand_method() 684. #endif 685. 686. > const RAND_METHOD *RAND_get_rand_method(void) 687. { 688. #ifdef FIPS_MODE crypto/rand/rand_lib.c:689:5: 687. { 688. #ifdef FIPS_MODE 689. > return NULL; 690. #else 691. const RAND_METHOD *tmp_meth = NULL; crypto/rand/rand_lib.c:718:1: return from a call to RAND_get_rand_method 716. return tmp_meth; 717. #endif 718. > } 719. 720. #if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE) crypto/rand/rand_lib.c:830:9: 828. const RAND_METHOD *meth = RAND_get_rand_method(); 829. 830. > if (meth->status != NULL) 831. return meth->status(); 832. return 0;
https://github.com/openssl/openssl/blob/2cafb1dff3ef13c470c4d2d7b1d8a1f7142d8813/crypto/rand/rand_lib.c/#L830
d2a_code_trace_data_45589
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_exp.c:1219: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_div`. Showing all 20 steps of the trace crypto/bn/bn_exp.c:1129:1: Parameter `ctx->stack.depth` 1127. } 1128. 1129. > int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p, 1130. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 1131. { crypto/bn/bn_exp.c:1189:5: Call 1187. } 1188. 1189. BN_CTX_start(ctx); ^ 1190. r = BN_CTX_get(ctx); 1191. t = 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_exp.c:1190:9: Call 1188. 1189. BN_CTX_start(ctx); 1190. r = BN_CTX_get(ctx); ^ 1191. t = BN_CTX_get(ctx); 1192. if (t == 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_exp.c:1191:9: Call 1189. BN_CTX_start(ctx); 1190. r = BN_CTX_get(ctx); 1191. t = BN_CTX_get(ctx); ^ 1192. if (t == NULL) 1193. 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_exp.c:1219:22: Call 1217. r_is_one = 0; 1218. } else { 1219. if (!BN_MOD_MUL_WORD(r, w, m)) ^ 1220. goto err; 1221. } 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: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.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); 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.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_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/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_45590
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; } } } test/cipherlist_test.c:170: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `SSL_free`. Showing all 16 steps of the trace test/cipherlist_test.c:148:10: Call 146. return 0; 147. 148. if (!TEST_ptr(ssl = SSL_new(ctx)) ^ 149. || !TEST_ptr(ciphers = SSL_get1_supported_ciphers(ssl))) 150. goto err; ssl/ssl_lib.c:494:1: Parameter `ctx->sessions->num_nodes` 492. } 493. 494. > SSL *SSL_new(SSL_CTX *ctx) 495. { 496. SSL *s; test/cipherlist_test.c:170:5: Call 168. err: 169. sk_SSL_CIPHER_free(ciphers); 170. SSL_free(ssl); ^ 171. return ret; 172. } ssl/ssl_lib.c:942:1: Parameter `s->ctx->sessions->num_nodes` 940. } 941. 942. > void SSL_free(SSL *s) 943. { 944. int i; ssl/ssl_lib.c:1011:5: Call 1009. RECORD_LAYER_release(&s->rlayer); 1010. 1011. SSL_CTX_free(s->ctx); ^ 1012. 1013. ASYNC_WAIT_CTX_free(s->waitctx); ssl/ssl_lib.c:2769:1: Parameter `a->sessions->num_nodes` 2767. } 2768. 2769. > void SSL_CTX_free(SSL_CTX *a) 2770. { 2771. int i; ssl/ssl_lib.c:2795:9: Call 2793. */ 2794. if (a->sessions != NULL) 2795. SSL_CTX_flush_sessions(a, 0); ^ 2796. 2797. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:1025:1: Parameter `s->sessions->num_nodes` 1023. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1024. 1025. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 1026. { 1027. unsigned long i; ssl/ssl_sess.c:1038:5: Call 1036. i = lh_SSL_SESSION_get_down_load(s->sessions); 1037. lh_SSL_SESSION_set_down_load(s->sessions, 0); 1038. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp); ^ 1039. lh_SSL_SESSION_set_down_load(s->sessions, i); 1040. CRYPTO_THREAD_unlock(s->lock); ssl/ssl_sess.c:1023:1: Parameter `lh->num_nodes` 1021. } 1022. 1023. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1024. 1025. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) ssl/ssl_sess.c:1023:1: Call 1021. } 1022. 1023. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1024. 1025. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) crypto/lhash/lhash.c:186:1: Parameter `lh->num_nodes` 184. } 185. 186. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 187. { 188. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); crypto/lhash/lhash.c:188:5: Call 186. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 187. { 188. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); ^ 189. } 190. crypto/lhash/lhash.c:154:1: <LHS trace> 152. } 153. 154. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 155. OPENSSL_LH_DOALL_FUNC func, 156. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:154:1: Parameter `lh->num_nodes` 152. } 153. 154. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 155. OPENSSL_LH_DOALL_FUNC func, 156. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:168:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `SSL_free` 166. * memory leaks otherwise 167. */ 168. for (i = lh->num_nodes - 1; i >= 0; i--) { ^ 169. a = lh->b[i]; 170. while (a != NULL) {
https://github.com/openssl/openssl/blob/25ffeb11ea86bdc76db150c504550602a9acc9bc/crypto/lhash/lhash.c/#L168
d2a_code_trace_data_45591
void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], const uint8_t *src_data[4], const int src_linesizes[4], enum PixelFormat pix_fmt, int width, int height) { const AVPixFmtDescriptor *desc = &av_pix_fmt_descriptors[pix_fmt]; if (desc->flags & PIX_FMT_HWACCEL) return; if (desc->flags & PIX_FMT_PAL || desc->flags & PIX_FMT_PSEUDOPAL) { av_image_copy_plane(dst_data[0], dst_linesizes[0], src_data[0], src_linesizes[0], width, height); memcpy(dst_data[1], src_data[1], 4*256); } else { int i, planes_nb = 0; for (i = 0; i < desc->nb_components; i++) planes_nb = FFMAX(planes_nb, desc->comp[i].plane + 1); for (i = 0; i < planes_nb; i++) { int h = height; int bwidth = av_image_get_linesize(pix_fmt, width, i); if (i == 1 || i == 2) { h= -((-height)>>desc->log2_chroma_h); } av_image_copy_plane(dst_data[i], dst_linesizes[i], src_data[i], src_linesizes[i], bwidth, h); } } } libavfilter/buffersrc.c:99: error: Buffer Overrun L1 Offset added: 1024 Size: 64 by call to `av_image_copy`. libavfilter/buffersrc.c:73:1: Parameter `frame->data[*]` 71. } 72. 73. int av_buffersrc_write_frame(AVFilterContext *buffer_filter, const AVFrame *frame) ^ 74. { 75. BufferSourceContext *c = buffer_filter->priv; libavfilter/buffersrc.c:99:9: Call 97. return AVERROR(ENOMEM); 98. 99. av_image_copy(buf->data, buf->linesize, frame->data, frame->linesize, ^ 100. c->pix_fmt, c->w, c->h); 101. break; libavutil/imgutils.c:238:1: <Length trace> 236. } 237. 238. void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], ^ 239. const uint8_t *src_data[4], const int src_linesizes[4], 240. enum PixelFormat pix_fmt, int width, int height) libavutil/imgutils.c:238:1: Parameter `**src_data` 236. } 237. 238. void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], ^ 239. const uint8_t *src_data[4], const int src_linesizes[4], 240. enum PixelFormat pix_fmt, int width, int height) libavutil/imgutils.c:253:9: Array access: Offset added: 1024 Size: 64 by call to `av_image_copy` 251. width, height); 252. /* copy the palette */ 253. memcpy(dst_data[1], src_data[1], 4*256); ^ 254. } else { 255. int i, planes_nb = 0;
https://github.com/libav/libav/blob/4e48aa86563279bf833b3ebcc2eaa1ff97189d91/libavutil/imgutils.c/#L253
d2a_code_trace_data_45592
int MAIN(int argc, char **argv) { int ret=1,i; int verbose=0,Verbose=0; int use_supported = 0; #ifndef OPENSSL_NO_SSL_TRACE int stdname = 0; #endif const char **pp; const char *p; int badops=0; SSL_CTX *ctx=NULL; SSL *ssl=NULL; char *ciphers=NULL; const SSL_METHOD *meth=NULL; STACK_OF(SSL_CIPHER) *sk; char buf[512]; BIO *STDout=NULL; #if !defined(OPENSSL_NO_SSL2) && !defined(OPENSSL_NO_SSL3) meth=SSLv23_server_method(); #elif !defined(OPENSSL_NO_SSL3) meth=SSLv3_server_method(); #elif !defined(OPENSSL_NO_SSL2) meth=SSLv2_server_method(); #endif apps_startup(); if (bio_err == NULL) bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); STDout=BIO_new_fp(stdout,BIO_NOCLOSE); #ifdef OPENSSL_SYS_VMS { BIO *tmpbio = BIO_new(BIO_f_linebuffer()); STDout = BIO_push(tmpbio, STDout); } #endif if (!load_config(bio_err, NULL)) goto end; argc--; argv++; while (argc >= 1) { if (strcmp(*argv,"-v") == 0) verbose=1; else if (strcmp(*argv,"-V") == 0) verbose=Verbose=1; else if (strcmp(*argv,"-s") == 0) use_supported = 1; #ifndef OPENSSL_NO_SSL_TRACE else if (strcmp(*argv,"-stdname") == 0) stdname=verbose=1; #endif #ifndef OPENSSL_NO_SSL2 else if (strcmp(*argv,"-ssl2") == 0) meth=SSLv2_client_method(); #endif #ifndef OPENSSL_NO_SSL3 else if (strcmp(*argv,"-ssl3") == 0) meth=SSLv3_client_method(); #endif #ifndef OPENSSL_NO_TLS1 else if (strcmp(*argv,"-tls1") == 0) meth=TLSv1_client_method(); #endif else if ((strncmp(*argv,"-h",2) == 0) || (strcmp(*argv,"-?") == 0)) { badops=1; break; } else { ciphers= *argv; } argc--; argv++; } if (badops) { for (pp=ciphers_usage; (*pp != NULL); pp++) BIO_printf(bio_err,"%s",*pp); goto end; } OpenSSL_add_ssl_algorithms(); ctx=SSL_CTX_new(meth); if (ctx == NULL) goto err; if (ciphers != NULL) { if(!SSL_CTX_set_cipher_list(ctx,ciphers)) { BIO_printf(bio_err, "Error in cipher list\n"); goto err; } } ssl=SSL_new(ctx); if (ssl == NULL) goto err; if (use_supported) sk=SSL_get1_supported_ciphers(ssl); else sk=SSL_get_ciphers(ssl); if (!verbose) { for (i=0; i<sk_SSL_CIPHER_num(sk); i++) { SSL_CIPHER *c = sk_SSL_CIPHER_value(sk,i); p = SSL_CIPHER_get_name(c); if (p == NULL) break; if (i != 0) BIO_printf(STDout,":"); BIO_printf(STDout,"%s",p); } BIO_printf(STDout,"\n"); } else { for (i=0; i<sk_SSL_CIPHER_num(sk); i++) { SSL_CIPHER *c; c = sk_SSL_CIPHER_value(sk,i); if (Verbose) { unsigned long id = SSL_CIPHER_get_id(c); int id0 = (int)(id >> 24); int id1 = (int)((id >> 16) & 0xffL); int id2 = (int)((id >> 8) & 0xffL); int id3 = (int)(id & 0xffL); if ((id & 0xff000000L) == 0x02000000L) BIO_printf(STDout, " 0x%02X,0x%02X,0x%02X - ", id1, id2, id3); else if ((id & 0xff000000L) == 0x03000000L) BIO_printf(STDout, " 0x%02X,0x%02X - ", id2, id3); else BIO_printf(STDout, "0x%02X,0x%02X,0x%02X,0x%02X - ", id0, id1, id2, id3); } #ifndef OPENSSL_NO_SSL_TRACE if (stdname) { const char *nm = SSL_CIPHER_standard_name(c); if (nm == NULL) nm = "UNKNOWN"; BIO_printf(STDout, "%s - ", nm); } #endif BIO_puts(STDout,SSL_CIPHER_description(c,buf,sizeof buf)); } } ret=0; if (0) { err: SSL_load_error_strings(); ERR_print_errors(bio_err); } end: if (use_supported && sk) sk_SSL_CIPHER_free(sk); if (ctx != NULL) SSL_CTX_free(ctx); if (ssl != NULL) SSL_free(ssl); if (STDout != NULL) BIO_free_all(STDout); apps_shutdown(); OPENSSL_EXIT(ret); } apps/ciphers.c:247: error: UNINITIALIZED_VALUE The value read from sk was never initialized. Showing all 1 steps of the trace apps/ciphers.c:247:23: 245. } 246. end: 247. > if (use_supported && sk) 248. sk_SSL_CIPHER_free(sk); 249. if (ctx != NULL) SSL_CTX_free(ctx);
https://github.com/openssl/openssl/blob/66f96fe2d519147097c118d4bf60704c69ed0635/apps/ciphers.c/#L247
d2a_code_trace_data_45593
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; } crypto/sm2/sm2_sign.c:234: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `EC_POINT_mul`. Showing all 19 steps of the trace crypto/sm2/sm2_sign.c:229:14: Call 227. 228. for (;;) { 229. if (!BN_priv_rand_range(k, order)) { ^ 230. SM2err(SM2_F_SM2_SIG_GEN, ERR_R_INTERNAL_ERROR); 231. goto done; crypto/bn/bn_rand.c:184:12: Call 182. int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range) 183. { 184. return bnrand_range(PRIVATE, r, range); ^ 185. } 186. crypto/bn/bn_rand.c:113:1: Parameter `r->top` 111. 112. /* random number r: 0 <= r < range */ 113. > static int bnrand_range(BNRAND_FLAG flag, BIGNUM *r, const BIGNUM *range) 114. { 115. int n; crypto/sm2/sm2_sign.c:234:14: Call 232. } 233. 234. if (!EC_POINT_mul(group, kG, k, NULL, NULL, ctx) ^ 235. || !EC_POINT_get_affine_coordinates(group, kG, x1, NULL, 236. ctx) crypto/ec/ec_lib.c:951:1: Parameter `g_scalar->top` 949. } 950. 951. > int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, 952. const EC_POINT *point, const BIGNUM *p_scalar, BN_CTX *ctx) 953. { crypto/ec/ec_lib.c:962:12: Call 960. scalars[0] = p_scalar; 961. 962. return EC_POINTs_mul(group, r, g_scalar, ^ 963. (point != NULL 964. && p_scalar != NULL), points, scalars, ctx); crypto/ec/ec_lib.c:913:1: Parameter `scalar->top` 911. */ 912. 913. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 914. size_t num, const EC_POINT *points[], 915. const BIGNUM *scalars[], BN_CTX *ctx) crypto/ec/ec_lib.c:945:15: Call 943. else 944. /* use default */ 945. ret = ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx); ^ 946. 947. 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)) { 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_POINT_mul` 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/571286b0a463b02ef2f9040a7e5d602635854832/crypto/bn/bn_lib.c/#L291
d2a_code_trace_data_45594
PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx) { STACK_OF(PKCS7_RECIP_INFO) *rsk; PKCS7_RECIP_INFO *ri; int i; i=OBJ_obj2nid(p7->type); if (i != NID_pkcs7_signedAndEnveloped) return NULL; if (p7->d.signed_and_enveloped == NULL) return NULL; rsk=p7->d.signed_and_enveloped->recipientinfo; if (rsk == NULL) return NULL; ri=sk_PKCS7_RECIP_INFO_value(rsk,0); if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL); ri=sk_PKCS7_RECIP_INFO_value(rsk,idx); return(ri->issuer_and_serial); } crypto/pkcs7/pk7_doit.c:1161: error: NULL_DEREFERENCE pointer `ri` last assigned on line 1160 could be null and is dereferenced at line 1161, column 8. Showing all 48 steps of the trace crypto/pkcs7/pk7_doit.c:1144:1: start of procedure PKCS7_get_issuer_and_serial() 1142. } 1143. 1144. > PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx) 1145. { 1146. STACK_OF(PKCS7_RECIP_INFO) *rsk; crypto/pkcs7/pk7_doit.c:1150:2: 1148. int i; 1149. 1150. > i=OBJ_obj2nid(p7->type); 1151. if (i != NID_pkcs7_signedAndEnveloped) 1152. return NULL; crypto/objects/obj_dat.c:398:1: start of procedure OBJ_obj2nid() 396. IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj); 397. 398. > int OBJ_obj2nid(const ASN1_OBJECT *a) 399. { 400. const unsigned int *op; crypto/objects/obj_dat.c:403:6: Taking false branch 401. ADDED_OBJ ad,*adp; 402. 403. if (a == NULL) ^ 404. return(NID_undef); 405. if (a->nid != 0) crypto/objects/obj_dat.c:405:6: Taking false branch 403. if (a == NULL) 404. return(NID_undef); 405. if (a->nid != 0) ^ 406. return(a->nid); 407. crypto/objects/obj_dat.c:408:6: Taking true branch 406. return(a->nid); 407. 408. if (added != NULL) ^ 409. { 410. ad.type=ADDED_DATA; crypto/objects/obj_dat.c:410:3: 408. if (added != NULL) 409. { 410. > ad.type=ADDED_DATA; 411. ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */ 412. adp=lh_ADDED_OBJ_retrieve(added,&ad); crypto/objects/obj_dat.c:411:3: 409. { 410. ad.type=ADDED_DATA; 411. > ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */ 412. adp=lh_ADDED_OBJ_retrieve(added,&ad); 413. if (adp != NULL) return (adp->obj->nid); crypto/objects/obj_dat.c:412:7: Condition is true 410. ad.type=ADDED_DATA; 411. ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */ 412. adp=lh_ADDED_OBJ_retrieve(added,&ad); ^ 413. if (adp != NULL) return (adp->obj->nid); 414. } crypto/objects/obj_dat.c:412:7: Condition is true 410. ad.type=ADDED_DATA; 411. ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */ 412. adp=lh_ADDED_OBJ_retrieve(added,&ad); ^ 413. if (adp != NULL) return (adp->obj->nid); 414. } crypto/objects/obj_dat.c:412:3: 410. ad.type=ADDED_DATA; 411. ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */ 412. > adp=lh_ADDED_OBJ_retrieve(added,&ad); 413. if (adp != NULL) return (adp->obj->nid); 414. } crypto/lhash/lhash.c:248:1: start of procedure lh_retrieve() 246. } 247. 248. > void *lh_retrieve(_LHASH *lh, const void *data) 249. { 250. unsigned long hash; crypto/lhash/lhash.c:254:2: 252. void *ret; 253. 254. > lh->error=0; 255. rn=getrn(lh,data,&hash); 256. crypto/lhash/lhash.c:255:2: Skipping getrn(): empty list of specs 253. 254. lh->error=0; 255. rn=getrn(lh,data,&hash); ^ 256. 257. if (*rn == NULL) crypto/lhash/lhash.c:257:6: Taking false branch 255. rn=getrn(lh,data,&hash); 256. 257. if (*rn == NULL) ^ 258. { 259. lh->num_retrieve_miss++; crypto/lhash/lhash.c:264:3: 262. else 263. { 264. > ret= (*rn)->data; 265. lh->num_retrieve++; 266. } crypto/lhash/lhash.c:265:3: 263. { 264. ret= (*rn)->data; 265. > lh->num_retrieve++; 266. } 267. return(ret); crypto/lhash/lhash.c:267:2: 265. lh->num_retrieve++; 266. } 267. > return(ret); 268. } 269. crypto/lhash/lhash.c:268:2: return from a call to lh_retrieve 266. } 267. return(ret); 268. } ^ 269. 270. static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func, crypto/objects/obj_dat.c:413:7: Taking true branch 411. ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */ 412. adp=lh_ADDED_OBJ_retrieve(added,&ad); 413. if (adp != NULL) return (adp->obj->nid); ^ 414. } 415. op=OBJ_bsearch_obj(&a, obj_objs, NUM_OBJ); crypto/objects/obj_dat.c:413:20: 411. ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */ 412. adp=lh_ADDED_OBJ_retrieve(added,&ad); 413. > if (adp != NULL) return (adp->obj->nid); 414. } 415. op=OBJ_bsearch_obj(&a, obj_objs, NUM_OBJ); crypto/objects/obj_dat.c:419:2: return from a call to OBJ_obj2nid 417. return(NID_undef); 418. return(nid_objs[*op].nid); 419. } ^ 420. 421. /* Convert an object name into an ASN1_OBJECT crypto/pkcs7/pk7_doit.c:1151:6: Taking false branch 1149. 1150. i=OBJ_obj2nid(p7->type); 1151. if (i != NID_pkcs7_signedAndEnveloped) ^ 1152. return NULL; 1153. if (p7->d.signed_and_enveloped == NULL) crypto/pkcs7/pk7_doit.c:1153:6: Taking false branch 1151. if (i != NID_pkcs7_signedAndEnveloped) 1152. return NULL; 1153. if (p7->d.signed_and_enveloped == NULL) ^ 1154. return NULL; 1155. rsk=p7->d.signed_and_enveloped->recipientinfo; crypto/pkcs7/pk7_doit.c:1155:2: 1153. if (p7->d.signed_and_enveloped == NULL) 1154. return NULL; 1155. > rsk=p7->d.signed_and_enveloped->recipientinfo; 1156. if (rsk == NULL) 1157. return NULL; crypto/pkcs7/pk7_doit.c:1156:6: Taking false branch 1154. return NULL; 1155. rsk=p7->d.signed_and_enveloped->recipientinfo; 1156. if (rsk == NULL) ^ 1157. return NULL; 1158. ri=sk_PKCS7_RECIP_INFO_value(rsk,0); crypto/pkcs7/pk7_doit.c:1158:5: Condition is true 1156. if (rsk == NULL) 1157. return NULL; 1158. ri=sk_PKCS7_RECIP_INFO_value(rsk,0); ^ 1159. if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL); 1160. ri=sk_PKCS7_RECIP_INFO_value(rsk,idx); crypto/pkcs7/pk7_doit.c:1158:2: 1156. if (rsk == NULL) 1157. return NULL; 1158. > ri=sk_PKCS7_RECIP_INFO_value(rsk,0); 1159. if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL); 1160. ri=sk_PKCS7_RECIP_INFO_value(rsk,idx); 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 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:303:2: 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; 303. > return st->data[i]; 304. } 305. 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/pkcs7/pk7_doit.c:1159:6: Condition is true 1157. return NULL; 1158. ri=sk_PKCS7_RECIP_INFO_value(rsk,0); 1159. if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL); ^ 1160. ri=sk_PKCS7_RECIP_INFO_value(rsk,idx); 1161. return(ri->issuer_and_serial); crypto/stack/stack.c:294:1: start of procedure sk_num() 292. } 293. 294. > int sk_num(const _STACK *st) 295. { 296. if(st == NULL) return -1; crypto/stack/stack.c:296:5: Taking false branch 294. int sk_num(const _STACK *st) 295. { 296. if(st == NULL) return -1; ^ 297. return st->num; 298. } crypto/stack/stack.c:297:2: 295. { 296. if(st == NULL) return -1; 297. > return st->num; 298. } 299. crypto/stack/stack.c:298:1: return from a call to sk_num 296. if(st == NULL) return -1; 297. return st->num; 298. > } 299. 300. void *sk_value(const _STACK *st, int i) crypto/pkcs7/pk7_doit.c:1159:6: Taking false branch 1157. return NULL; 1158. ri=sk_PKCS7_RECIP_INFO_value(rsk,0); 1159. if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL); ^ 1160. ri=sk_PKCS7_RECIP_INFO_value(rsk,idx); 1161. return(ri->issuer_and_serial); crypto/pkcs7/pk7_doit.c:1160:5: Condition is true 1158. ri=sk_PKCS7_RECIP_INFO_value(rsk,0); 1159. if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL); 1160. ri=sk_PKCS7_RECIP_INFO_value(rsk,idx); ^ 1161. return(ri->issuer_and_serial); 1162. } crypto/pkcs7/pk7_doit.c:1160:2: 1158. ri=sk_PKCS7_RECIP_INFO_value(rsk,0); 1159. if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL); 1160. > ri=sk_PKCS7_RECIP_INFO_value(rsk,idx); 1161. return(ri->issuer_and_serial); 1162. } 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 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/pkcs7/pk7_doit.c:1161:2: 1159. if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL); 1160. ri=sk_PKCS7_RECIP_INFO_value(rsk,idx); 1161. > return(ri->issuer_and_serial); 1162. } 1163.
https://github.com/openssl/openssl/blob/558ff0f0c1d87d74e70b0a70ddd67c0ff7f596ad/crypto/pkcs7/pk7_doit.c/#L1161
d2a_code_trace_data_45595
static int ssl_add_cert_chain(SSL *s, WPACKET *pkt, CERT_PKEY *cpk, int *al) { int i, chain_count; X509 *x; STACK_OF(X509) *extra_certs; STACK_OF(X509) *chain = NULL; X509_STORE *chain_store; int tmpal = SSL_AD_INTERNAL_ERROR; if (cpk == NULL || cpk->x509 == NULL) return 1; x = cpk->x509; if (cpk->chain != NULL) extra_certs = cpk->chain; else extra_certs = s->ctx->extra_certs; if ((s->mode & SSL_MODE_NO_AUTO_CHAIN) || extra_certs) chain_store = NULL; else if (s->cert->chain_store) chain_store = s->cert->chain_store; else chain_store = s->ctx->cert_store; if (chain_store != NULL) { X509_STORE_CTX *xs_ctx = X509_STORE_CTX_new(); if (xs_ctx == NULL) { SSLerr(SSL_F_SSL_ADD_CERT_CHAIN, ERR_R_MALLOC_FAILURE); goto err; } if (!X509_STORE_CTX_init(xs_ctx, chain_store, x, NULL)) { X509_STORE_CTX_free(xs_ctx); SSLerr(SSL_F_SSL_ADD_CERT_CHAIN, ERR_R_X509_LIB); goto err; } (void)X509_verify_cert(xs_ctx); ERR_clear_error(); chain = X509_STORE_CTX_get0_chain(xs_ctx); i = ssl_security_cert_chain(s, chain, NULL, 0); if (i != 1) { #if 0 SSLerr(SSL_F_SSL_ADD_CERT_CHAIN, SSL_R_EE_KEY_TOO_SMALL); SSLerr(SSL_F_SSL_ADD_CERT_CHAIN, SSL_R_CA_KEY_TOO_SMALL); SSLerr(SSL_F_SSL_ADD_CERT_CHAIN, SSL_R_CA_MD_TOO_WEAK); #endif X509_STORE_CTX_free(xs_ctx); SSLerr(SSL_F_SSL_ADD_CERT_CHAIN, i); goto err; } chain_count = sk_X509_num(chain); for (i = 0; i < chain_count; i++) { x = sk_X509_value(chain, i); if (!ssl_add_cert_to_wpacket(s, pkt, x, i, &tmpal)) { X509_STORE_CTX_free(xs_ctx); goto err; } } X509_STORE_CTX_free(xs_ctx); } else { i = ssl_security_cert_chain(s, extra_certs, x, 0); if (i != 1) { SSLerr(SSL_F_SSL_ADD_CERT_CHAIN, i); goto err; } if (!ssl_add_cert_to_wpacket(s, pkt, x, 0, &tmpal)) goto err; for (i = 0; i < sk_X509_num(extra_certs); i++) { x = sk_X509_value(extra_certs, i); if (!ssl_add_cert_to_wpacket(s, pkt, x, i + 1, &tmpal)) goto err; } } return 1; err: *al = tmpal; return 0; } ssl/statem/statem_lib.c:915: error: MEMORY_LEAK memory dynamically allocated by call to `X509_STORE_CTX_new()` at line 908, column 34 is not reachable after line 915, column 13. Showing all 49 steps of the trace ssl/statem/statem_lib.c:878:1: start of procedure ssl_add_cert_chain() 876. 877. /* Add certificate chain to provided WPACKET */ 878. > static int ssl_add_cert_chain(SSL *s, WPACKET *pkt, CERT_PKEY *cpk, int *al) 879. { 880. int i, chain_count; ssl/statem/statem_lib.c:883:5: 881. X509 *x; 882. STACK_OF(X509) *extra_certs; 883. > STACK_OF(X509) *chain = NULL; 884. X509_STORE *chain_store; 885. int tmpal = SSL_AD_INTERNAL_ERROR; ssl/statem/statem_lib.c:885:5: 883. STACK_OF(X509) *chain = NULL; 884. X509_STORE *chain_store; 885. > int tmpal = SSL_AD_INTERNAL_ERROR; 886. 887. if (cpk == NULL || cpk->x509 == NULL) ssl/statem/statem_lib.c:887:9: Taking false branch 885. int tmpal = SSL_AD_INTERNAL_ERROR; 886. 887. if (cpk == NULL || cpk->x509 == NULL) ^ 888. return 1; 889. ssl/statem/statem_lib.c:887:24: Taking false branch 885. int tmpal = SSL_AD_INTERNAL_ERROR; 886. 887. if (cpk == NULL || cpk->x509 == NULL) ^ 888. return 1; 889. ssl/statem/statem_lib.c:890:5: 888. return 1; 889. 890. > x = cpk->x509; 891. 892. /* ssl/statem/statem_lib.c:895:9: Taking false branch 893. * If we have a certificate specific chain use it, else use parent ctx. 894. */ 895. if (cpk->chain != NULL) ^ 896. extra_certs = cpk->chain; 897. else ssl/statem/statem_lib.c:898:9: 896. extra_certs = cpk->chain; 897. else 898. > extra_certs = s->ctx->extra_certs; 899. 900. if ((s->mode & SSL_MODE_NO_AUTO_CHAIN) || extra_certs) ssl/statem/statem_lib.c:900:10: Taking false branch 898. extra_certs = s->ctx->extra_certs; 899. 900. if ((s->mode & SSL_MODE_NO_AUTO_CHAIN) || extra_certs) ^ 901. chain_store = NULL; 902. else if (s->cert->chain_store) ssl/statem/statem_lib.c:900:47: Taking false branch 898. extra_certs = s->ctx->extra_certs; 899. 900. if ((s->mode & SSL_MODE_NO_AUTO_CHAIN) || extra_certs) ^ 901. chain_store = NULL; 902. else if (s->cert->chain_store) ssl/statem/statem_lib.c:902:14: Taking false branch 900. if ((s->mode & SSL_MODE_NO_AUTO_CHAIN) || extra_certs) 901. chain_store = NULL; 902. else if (s->cert->chain_store) ^ 903. chain_store = s->cert->chain_store; 904. else ssl/statem/statem_lib.c:905:9: 903. chain_store = s->cert->chain_store; 904. else 905. > chain_store = s->ctx->cert_store; 906. 907. if (chain_store != NULL) { ssl/statem/statem_lib.c:907:9: Taking true branch 905. chain_store = s->ctx->cert_store; 906. 907. if (chain_store != NULL) { ^ 908. X509_STORE_CTX *xs_ctx = X509_STORE_CTX_new(); 909. ssl/statem/statem_lib.c:908:9: 906. 907. if (chain_store != NULL) { 908. > X509_STORE_CTX *xs_ctx = X509_STORE_CTX_new(); 909. 910. if (xs_ctx == NULL) { crypto/x509/x509_vfy.c:2150:1: start of procedure X509_STORE_CTX_new() 2148. } 2149. 2150. > X509_STORE_CTX *X509_STORE_CTX_new(void) 2151. { 2152. X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); crypto/x509/x509_vfy.c:2152:5: 2150. X509_STORE_CTX *X509_STORE_CTX_new(void) 2151. { 2152. > X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); 2153. 2154. if (ctx == NULL) { crypto/mem.c:198:1: start of procedure CRYPTO_zalloc() 196. } 197. 198. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 199. { 200. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:200:5: 198. void *CRYPTO_zalloc(size_t num, const char *file, int line) 199. { 200. > void *ret = CRYPTO_malloc(num, file, line); 201. 202. FAILTEST(); crypto/mem.c:170:1: start of procedure CRYPTO_malloc() 168. #endif 169. 170. > void *CRYPTO_malloc(size_t num, const char *file, int line) 171. { 172. void *ret = NULL; crypto/mem.c:172:5: 170. void *CRYPTO_malloc(size_t num, const char *file, int line) 171. { 172. > void *ret = NULL; 173. 174. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:174:9: Taking false branch 172. void *ret = NULL; 173. 174. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 175. return malloc_impl(num, file, line); 176. crypto/mem.c:177:9: Taking false branch 175. return malloc_impl(num, file, line); 176. 177. if (num == 0) ^ 178. return NULL; 179. crypto/mem.c:181:5: 179. 180. FAILTEST(); 181. > allow_customize = 0; 182. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 183. if (call_malloc_debug) { crypto/mem.c:191:5: 189. } 190. #else 191. > (void)(file); (void)(line); 192. ret = malloc(num); 193. #endif crypto/mem.c:191:19: 189. } 190. #else 191. > (void)(file); (void)(line); 192. ret = malloc(num); 193. #endif crypto/mem.c:192:5: 190. #else 191. (void)(file); (void)(line); 192. > ret = malloc(num); 193. #endif 194. crypto/mem.c:195:5: 193. #endif 194. 195. > return ret; 196. } 197. crypto/mem.c:196:1: return from a call to CRYPTO_malloc 194. 195. return ret; 196. > } 197. 198. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:203:9: Taking true branch 201. 202. FAILTEST(); 203. if (ret != NULL) ^ 204. memset(ret, 0, num); 205. return ret; crypto/mem.c:204:9: 202. FAILTEST(); 203. if (ret != NULL) 204. > memset(ret, 0, num); 205. return ret; 206. } crypto/mem.c:205:5: 203. if (ret != NULL) 204. memset(ret, 0, num); 205. > return ret; 206. } 207. crypto/mem.c:206:1: return from a call to CRYPTO_zalloc 204. memset(ret, 0, num); 205. return ret; 206. > } 207. 208. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/x509/x509_vfy.c:2154:9: Taking false branch 2152. X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); 2153. 2154. if (ctx == NULL) { ^ 2155. X509err(X509_F_X509_STORE_CTX_NEW, ERR_R_MALLOC_FAILURE); 2156. return NULL; crypto/x509/x509_vfy.c:2158:5: 2156. return NULL; 2157. } 2158. > return ctx; 2159. } 2160. crypto/x509/x509_vfy.c:2159:1: return from a call to X509_STORE_CTX_new 2157. } 2158. return ctx; 2159. > } 2160. 2161. void X509_STORE_CTX_free(X509_STORE_CTX *ctx) ssl/statem/statem_lib.c:910:13: Taking false branch 908. X509_STORE_CTX *xs_ctx = X509_STORE_CTX_new(); 909. 910. if (xs_ctx == NULL) { ^ 911. SSLerr(SSL_F_SSL_ADD_CERT_CHAIN, ERR_R_MALLOC_FAILURE); 912. goto err; ssl/statem/statem_lib.c:914:14: Taking true branch 912. goto err; 913. } 914. if (!X509_STORE_CTX_init(xs_ctx, chain_store, x, NULL)) { ^ 915. X509_STORE_CTX_free(xs_ctx); 916. SSLerr(SSL_F_SSL_ADD_CERT_CHAIN, ERR_R_X509_LIB); ssl/statem/statem_lib.c:915:13: 913. } 914. if (!X509_STORE_CTX_init(xs_ctx, chain_store, x, NULL)) { 915. > X509_STORE_CTX_free(xs_ctx); 916. SSLerr(SSL_F_SSL_ADD_CERT_CHAIN, ERR_R_X509_LIB); 917. goto err; crypto/x509/x509_vfy.c:2161:1: start of procedure X509_STORE_CTX_free() 2159. } 2160. 2161. > void X509_STORE_CTX_free(X509_STORE_CTX *ctx) 2162. { 2163. if (ctx == NULL) crypto/x509/x509_vfy.c:2163:9: Taking false branch 2161. void X509_STORE_CTX_free(X509_STORE_CTX *ctx) 2162. { 2163. if (ctx == NULL) ^ 2164. return; 2165. crypto/x509/x509_vfy.c:2166:5: Skipping X509_STORE_CTX_cleanup(): empty list of specs 2164. return; 2165. 2166. X509_STORE_CTX_cleanup(ctx); ^ 2167. OPENSSL_free(ctx); 2168. } crypto/x509/x509_vfy.c:2167:5: 2165. 2166. X509_STORE_CTX_cleanup(ctx); 2167. > OPENSSL_free(ctx); 2168. } 2169. crypto/mem.c:265:1: start of procedure CRYPTO_free() 263. } 264. 265. > void CRYPTO_free(void *str, const char *file, int line) 266. { 267. if (free_impl != NULL && free_impl != &CRYPTO_free) { crypto/mem.c:267:9: Taking true branch 265. void CRYPTO_free(void *str, const char *file, int line) 266. { 267. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 268. free_impl(str, file, line); 269. return; crypto/mem.c:267:30: Taking true branch 265. void CRYPTO_free(void *str, const char *file, int line) 266. { 267. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 268. free_impl(str, file, line); 269. return; crypto/mem.c:268:9: Skipping __function_pointer__(): unresolved function pointer 266. { 267. if (free_impl != NULL && free_impl != &CRYPTO_free) { 268. free_impl(str, file, line); ^ 269. return; 270. } crypto/mem.c:269:9: 267. if (free_impl != NULL && free_impl != &CRYPTO_free) { 268. free_impl(str, file, line); 269. > return; 270. } 271. crypto/mem.c:283:1: return from a call to CRYPTO_free 281. free(str); 282. #endif 283. > } 284. 285. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/x509/x509_vfy.c:2168:1: return from a call to X509_STORE_CTX_free 2166. X509_STORE_CTX_cleanup(ctx); 2167. OPENSSL_free(ctx); 2168. > } 2169. 2170. int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509,
https://github.com/openssl/openssl/blob/89bc9cf682e833d44fe135c901fe75f600d871ef/ssl/statem/statem_lib.c/#L915
d2a_code_trace_data_45596
static inline uint64_t get_val(BitstreamContext *bc, unsigned n) { #ifdef BITSTREAM_READER_LE uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1); bc->bits >>= n; #else uint64_t ret = bc->bits >> (64 - n); bc->bits <<= n; #endif bc->bits_left -= n; return ret; } libavcodec/alsdec.c:1132: error: Integer Overflow L2 ([-2, +oo] - 1):unsigned32 by call to `read_decode_block`. libavcodec/alsdec.c:1131:20: Call 1129. bd[1].raw_other = bd[0].raw_samples; 1130. 1131. if ((ret = read_decode_block(ctx, &bd[0])) < 0 || ^ 1132. (ret = read_decode_block(ctx, &bd[1])) < 0) 1133. goto fail; libavcodec/alsdec.c:1017:16: Call 1015. int ret; 1016. 1017. if ((ret = read_block(ctx, bd)) < 0) ^ 1018. return ret; 1019. libavcodec/alsdec.c:976:15: Call 974. // read block type flag and read the samples accordingly 975. if (bitstream_read_bit(bc)) { 976. ret = read_var_block_data(ctx, bd); ^ 977. } else { 978. read_const_block_data(ctx, bd); libavcodec/alsdec.c:625:31: Call 623. } else { 624. if (sconf->bgmc && sconf->sb_part) 625. log2_sub_blocks = bitstream_read(bc, 2); ^ 626. else 627. log2_sub_blocks = 2 * bitstream_read_bit(bc); libavcodec/bitstream.h:183:1: Parameter `bc->bits_left` 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/alsdec.c:1132:20: Call 1130. 1131. if ((ret = read_decode_block(ctx, &bd[0])) < 0 || 1132. (ret = read_decode_block(ctx, &bd[1])) < 0) ^ 1133. goto fail; 1134. libavcodec/alsdec.c:1013:1: Parameter `ctx->bc.bits_left` 1011. /** Read and decode block data successively. 1012. */ 1013. static int read_decode_block(ALSDecContext *ctx, ALSBlockData *bd) ^ 1014. { 1015. int ret; libavcodec/alsdec.c:1017:16: Call 1015. int ret; 1016. 1017. if ((ret = read_block(ctx, bd)) < 0) ^ 1018. return ret; 1019. libavcodec/alsdec.c:968:1: Parameter `ctx->bc.bits_left` 966. /** Read the block data. 967. */ 968. static int read_block(ALSDecContext *ctx, ALSBlockData *bd) ^ 969. { 970. int ret = 0; libavcodec/alsdec.c:975:9: Call 973. *bd->shift_lsbs = 0; 974. // read block type flag and read the samples accordingly 975. if (bitstream_read_bit(bc)) { ^ 976. ret = read_var_block_data(ctx, bd); 977. } else { 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/alsdec.c:976:15: Call 974. // read block type flag and read the samples accordingly 975. if (bitstream_read_bit(bc)) { 976. ret = read_var_block_data(ctx, bd); ^ 977. } else { 978. read_const_block_data(ctx, bd); libavcodec/alsdec.c:596:1: Parameter `ctx->bc.bits_left` 594. /** Read the block data for a non-constant block 595. */ 596. static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd) ^ 597. { 598. ALSSpecificConfig *sconf = &ctx->sconf; libavcodec/alsdec.c:616:23: Call 614. 615. *bd->opt_order = 1; 616. bd->js_blocks = bitstream_read_bit(bc); ^ 617. 618. opt_order = *bd->opt_order; 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/alsdec.c:627:35: Call 625. log2_sub_blocks = bitstream_read(bc, 2); 626. else 627. log2_sub_blocks = 2 * bitstream_read_bit(bc); ^ 628. } 629. 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: <LHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `bc->bits_left` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: <RHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE 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: Binary operation: ([-2, +oo] - 1):unsigned32 by call to `read_decode_block` 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret;
https://github.com/libav/libav/blob/7ff018c1cb43a5fe5ee2049d325cdd785852067a/libavcodec/bitstream.h/#L139
d2a_code_trace_data_45597
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/srp/srp_vfy.c:730: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_mod_exp`. Showing all 18 steps of the trace crypto/srp/srp_vfy.c:715:19: Call 713. goto err; 714. 715. salttmp = BN_bin2bn(tmp2, SRP_RANDOM_SALT_LEN, NULL); ^ 716. if (salttmp == NULL) 717. goto err; crypto/bn/bn_lib.c:389:9: Assignment 387. n = len; 388. if (n == 0) { 389. ret->top = 0; ^ 390. return ret; 391. } crypto/srp/srp_vfy.c:730:10: Call 728. goto err; 729. 730. if (!BN_mod_exp(*verifier, g, x, N, bn_ctx)) { ^ 731. BN_clear_free(*verifier); 732. goto err; crypto/bn/bn_exp.c:89:1: Parameter `*r->d` 87. } 88. 89. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 90. BN_CTX *ctx) 91. { crypto/bn/bn_exp.c:141:19: Call 139. && (BN_get_flags(m, BN_FLG_CONSTTIME) == 0)) { 140. BN_ULONG A = a->d[0]; 141. ret = BN_mod_exp_mont_word(r, A, p, m, ctx, NULL); ^ 142. } else 143. # endif crypto/bn/bn_exp.c:1127:1: Parameter `*rr->d` 1125. } 1126. 1127. > int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p, 1128. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 1129. { crypto/bn/bn_exp.c:1175:13: Call 1173. if (BN_abs_is_word(m, 1)) { 1174. ret = 1; 1175. BN_zero(rr); ^ 1176. } else { 1177. ret = BN_one(rr); crypto/bn/bn_lib.c:359:1: Parameter `*a->d` 357. } 358. 359. > int BN_set_word(BIGNUM *a, BN_ULONG w) 360. { 361. bn_check_top(a); crypto/bn/bn_lib.c:362:9: Call 360. { 361. bn_check_top(a); 362. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 363. return 0; 364. 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_mod_exp` 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/ea09abc80892920ee5db4de82bed7a193b5896f0/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_45598
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_1024_160()` at line 353, column 18 is not reachable after line 367, column 9. Showing all 124 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 true. Entering 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:353:13: 351. switch (dctx->rfc5114_param) { 352. case 1: 353. > dh = DH_get_1024_160(); 354. break; 355. crypto/dh/dh_rfc5114.c:88:1: start of procedure DH_get_1024_160() 86. } 87. 88. > make_dh(1024_160) 89. make_dh(2048_224) 90. make_dh(2048_256) crypto/dh/dh_rfc5114.c:88:1: Taking false branch 86. } 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:88:1: 86. } 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:88:1: 86. } 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:88:1: Taking false branch 86. } 87. 88. > make_dh(1024_160) 89. make_dh(2048_224) 90. make_dh(2048_256) crypto/dh/dh_rfc5114.c:88:1: Taking false branch 86. } 87. 88. > make_dh(1024_160) 89. make_dh(2048_224) 90. make_dh(2048_256) crypto/dh/dh_rfc5114.c:88:1: Taking false branch 86. } 87. 88. > make_dh(1024_160) 89. make_dh(2048_224) 90. make_dh(2048_256) crypto/dh/dh_rfc5114.c:88:1: return from a call to DH_get_1024_160 86. } 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_45599
static int vc1_decode_p_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; int mqdiff, mquant; int ttmb = v->ttfrm; int status; 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 = 1; int dmv_x, dmv_y; int index, index1; int val, sign; int first_block = 1; int dst_idx, off; int skipped, fourmv; mquant = v->pq; if (v->mv_type_is_raw) fourmv = get_bits1(gb); else fourmv = v->mv_type_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]); if (!fourmv) { if (!skipped) { GET_MVDATA(dmv_x, dmv_y); if (s->mb_intra) { s->current_picture.motion_val[1][s->block_index[0]][0] = 0; s->current_picture.motion_val[1][s->block_index[0]][1] = 0; } s->current_picture.mb_type[mb_pos] = s->mb_intra ? MB_TYPE_INTRA : MB_TYPE_16x16; vc1_pred_mv(s, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0]); if (s->mb_intra && !mb_has_coeffs) { GET_MQUANT(); s->ac_pred = get_bits1(gb); cbp = 0; } else if (mb_has_coeffs) { 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(); } else { mquant = v->pq; cbp = 0; } 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); if(!s->mb_intra) vc1_mc_1mv(v, 0); 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)); if(v->pq >= 9 && v->overlap) { if(v->c_avail) s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); if(v->a_avail) s->dsp.vc1_v_overlap(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; } } } else { s->mb_intra = 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.mb_type[mb_pos] = MB_TYPE_SKIP; s->current_picture.qscale_table[mb_pos] = 0; vc1_pred_mv(s, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0]); vc1_mc_1mv(v, 0); return 0; } } else { if (!skipped ) { int intra_count = 0, coded_inter = 0; int is_intra[6], is_coded[6]; cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); for (i=0; i<6; i++) { val = ((cbp >> (5 - i)) & 1); s->dc_val[0][s->block_index[i]] = 0; s->mb_intra = 0; if(i < 4) { dmv_x = dmv_y = 0; s->mb_intra = 0; mb_has_coeffs = 0; if(val) { GET_MVDATA(dmv_x, dmv_y); } vc1_pred_mv(s, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0]); if(!s->mb_intra) vc1_mc_4mv_luma(v, i); intra_count += s->mb_intra; is_intra[i] = s->mb_intra; is_coded[i] = mb_has_coeffs; } if(i&4){ is_intra[i] = (intra_count >= 3); is_coded[i] = val; } if(i == 4) vc1_mc_4mv_chroma(v); v->mb_type[0][s->block_index[i]] = is_intra[i]; if(!coded_inter) coded_inter = !is_intra[i] & is_coded[i]; } if(!intra_count && !coded_inter) return 0; dst_idx = 0; GET_MQUANT(); s->current_picture.qscale_table[mb_pos] = mquant; { int intrapred = 0; for(i=0; i<6; i++) if(is_intra[i]) { if(((!s->first_slice_line || (i==2 || i==3)) && v->mb_type[0][s->block_index[i] - s->block_wrap[i]]) || ((s->mb_x || (i==1 || i==3)) && v->mb_type[0][s->block_index[i] - 1])) { intrapred = 1; break; } } if(intrapred)s->ac_pred = get_bits1(gb); else s->ac_pred = 0; } if (!v->ttmbf && coded_inter) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); for (i=0; i<6; i++) { dst_idx += i >> 2; off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); s->mb_intra = is_intra[i]; if (is_intra[i]) { 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, is_coded[i], 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, (i&4)?s->uvlinesize:s->linesize); if(v->pq >= 9 && v->overlap) { if(v->c_avail) s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); if(v->a_avail) s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); } } else if(is_coded[i]) { status = 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; } } return status; } else { s->mb_intra = 0; s->current_picture.qscale_table[mb_pos] = 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; } for (i=0; i<4; i++) { vc1_pred_mv(s, i, 0, 0, 0, v->range_x, v->range_y, v->mb_type[0]); vc1_mc_4mv_luma(v, i); } vc1_mc_4mv_chroma(v); s->current_picture.qscale_table[mb_pos] = 0; return 0; } } return -1; } libavcodec/vc1.c:3156: error: Uninitialized Value The value read from is_coded[_] was never initialized. libavcodec/vc1.c:3156:34: 3154. if(i == 4) vc1_mc_4mv_chroma(v); 3155. v->mb_type[0][s->block_index[i]] = is_intra[i]; 3156. if(!coded_inter) coded_inter = !is_intra[i] & is_coded[i]; ^ 3157. } 3158. // if there are no coded blocks then don't do anything more
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vc1.c/#L3156
d2a_code_trace_data_45600
DECLAREContigPutFunc(putRGBcontig16bittile) { int samplesperpixel = img->samplesperpixel; uint16 *wp = (uint16 *)pp; (void) y; fromskew *= samplesperpixel; while (h-- > 0) { for (x = w; x-- > 0;) { *cp++ = PACK(img->Bitdepth16To8[wp[0]], img->Bitdepth16To8[wp[1]], img->Bitdepth16To8[wp[2]]); wp += samplesperpixel; } cp += toskew; wp += fromskew; } } libtiff/tif_getimage.c:1305: error: Integer Overflow L2 ([0, `h`] - 1):unsigned32. libtiff/tif_getimage.c:1299:1: <LHS trace> 1297. * 16-bit packed samples => RGB 1298. */ 1299. DECLAREContigPutFunc(putRGBcontig16bittile) ^ 1300. { 1301. int samplesperpixel = img->samplesperpixel; libtiff/tif_getimage.c:1299:1: Parameter `h` 1297. * 16-bit packed samples => RGB 1298. */ 1299. DECLAREContigPutFunc(putRGBcontig16bittile) ^ 1300. { 1301. int samplesperpixel = img->samplesperpixel; libtiff/tif_getimage.c:1305:9: Binary operation: ([0, h] - 1):unsigned32 1303. (void) y; 1304. fromskew *= samplesperpixel; 1305. while (h-- > 0) { ^ 1306. for (x = w; x-- > 0;) { 1307. *cp++ = PACK(img->Bitdepth16To8[wp[0]],
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_getimage.c/#L1305
d2a_code_trace_data_45601
static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, const int size, const int h, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ MotionEstContext * const c= &s->me; const int stride= c->stride; const int uvstride= c->uvstride; const int qpel= flags&FLAG_QPEL; const int chroma= flags&FLAG_CHROMA; const int dxy= subx + (suby<<(1+qpel)); const int hx= subx + (x<<(1+qpel)); const int hy= suby + (y<<(1+qpel)); uint8_t * const * const ref= c->ref[ref_index]; uint8_t * const * const src= c->src[src_index]; int d; if(flags&FLAG_DIRECT){ assert(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)); if(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)){ const int time_pp= s->pp_time; const int time_pb= s->pb_time; const int mask= 2*qpel+1; if(s->mv_type==MV_TYPE_8X8){ int i; for(i=0; i<4; i++){ int fx = c->direct_basis_mv[i][0] + hx; int fy = c->direct_basis_mv[i][1] + hy; int bx = hx ? fx - c->co_located_mv[i][0] : c->co_located_mv[i][0]*(time_pb - time_pp)/time_pp + ((i &1)<<(qpel+4)); int by = hy ? fy - c->co_located_mv[i][1] : c->co_located_mv[i][1]*(time_pb - time_pp)/time_pp + ((i>>1)<<(qpel+4)); int fxy= (fx&mask) + ((fy&mask)<<(qpel+1)); int bxy= (bx&mask) + ((by&mask)<<(qpel+1)); uint8_t *dst= c->temp + 8*(i&1) + 8*stride*(i>>1); if(qpel){ c->qpel_put[1][fxy](dst, ref[0] + (fx>>2) + (fy>>2)*stride, stride); c->qpel_avg[1][bxy](dst, ref[8] + (bx>>2) + (by>>2)*stride, stride); }else{ c->hpel_put[1][fxy](dst, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 8); c->hpel_avg[1][bxy](dst, ref[8] + (bx>>1) + (by>>1)*stride, stride, 8); } } }else{ int fx = c->direct_basis_mv[0][0] + hx; int fy = c->direct_basis_mv[0][1] + hy; int bx = hx ? fx - c->co_located_mv[0][0] : (c->co_located_mv[0][0]*(time_pb - time_pp)/time_pp); int by = hy ? fy - c->co_located_mv[0][1] : (c->co_located_mv[0][1]*(time_pb - time_pp)/time_pp); int fxy= (fx&mask) + ((fy&mask)<<(qpel+1)); int bxy= (bx&mask) + ((by&mask)<<(qpel+1)); if(qpel){ c->qpel_put[1][fxy](c->temp , ref[0] + (fx>>2) + (fy>>2)*stride , stride); c->qpel_put[1][fxy](c->temp + 8 , ref[0] + (fx>>2) + (fy>>2)*stride + 8 , stride); c->qpel_put[1][fxy](c->temp + 8*stride, ref[0] + (fx>>2) + (fy>>2)*stride + 8*stride, stride); c->qpel_put[1][fxy](c->temp + 8 + 8*stride, ref[0] + (fx>>2) + (fy>>2)*stride + 8 + 8*stride, stride); c->qpel_avg[1][bxy](c->temp , ref[8] + (bx>>2) + (by>>2)*stride , stride); c->qpel_avg[1][bxy](c->temp + 8 , ref[8] + (bx>>2) + (by>>2)*stride + 8 , stride); c->qpel_avg[1][bxy](c->temp + 8*stride, ref[8] + (bx>>2) + (by>>2)*stride + 8*stride, stride); c->qpel_avg[1][bxy](c->temp + 8 + 8*stride, ref[8] + (bx>>2) + (by>>2)*stride + 8 + 8*stride, stride); }else{ assert((fx>>1) + 16*s->mb_x >= -16); assert((fy>>1) + 16*s->mb_y >= -16); assert((fx>>1) + 16*s->mb_x <= s->width); assert((fy>>1) + 16*s->mb_y <= s->height); assert((bx>>1) + 16*s->mb_x >= -16); assert((by>>1) + 16*s->mb_y >= -16); assert((bx>>1) + 16*s->mb_x <= s->width); assert((by>>1) + 16*s->mb_y <= s->height); c->hpel_put[0][fxy](c->temp, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 16); c->hpel_avg[0][bxy](c->temp, ref[8] + (bx>>1) + (by>>1)*stride, stride, 16); } } d = cmp_func(s, c->temp, src[0], stride, 16); }else d= 256*256*256*32; }else{ int uvdxy; if(dxy){ if(qpel){ c->qpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride); if(chroma){ int cx= hx/2; int cy= hy/2; cx= (cx>>1)|(cx&1); cy= (cy>>1)|(cy&1); uvdxy= (cx&1) + 2*(cy&1); } }else{ c->hpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride, h); if(chroma) uvdxy= dxy | (x&1) | (2*(y&1)); } d = cmp_func(s, c->temp, src[0], stride, h); }else{ d = cmp_func(s, src[0], ref[0] + x + y*stride, stride, h); if(chroma) uvdxy= (x&1) + 2*(y&1); } if(chroma){ uint8_t * const uvtemp= c->temp + 16*stride; c->hpel_put[size+1][uvdxy](uvtemp , ref[1] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1); c->hpel_put[size+1][uvdxy](uvtemp+8, ref[2] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1); d += chroma_cmp_func(s, uvtemp , src[1], uvstride, h>>1); d += chroma_cmp_func(s, uvtemp+8, src[2], uvstride, h>>1); } } #if 0 if(full_pel){ const int index= (((y)<<ME_MAP_SHIFT) + (x))&(ME_MAP_SIZE-1); score_map[index]= d; } d += (c->mv_penalty[hx - c->pred_x] + c->mv_penalty[hy - c->pred_y])*c->penalty_factor; #endif return d; } libavcodec/motion_est.c:1309: error: Buffer Overrun L1 Offset: [8, 9] (⇐ [0, 1] + 8) Size: 4 by call to `interlaced_search`. libavcodec/motion_est.c:1309:13: Call 1307. } 1308. if(mb_type == CANDIDATE_MB_TYPE_INTER_I){ 1309. interlaced_search(s, 0, s->p_field_mv_table, s->p_field_select_table, mx, my, 1); ^ 1310. } 1311. }else if(c->avctx->mb_decision > FF_MB_DECISION_SIMPLE){ libavcodec/motion_est.c:893:1: Parameter `ref_index` 891. } 892. 893. static int interlaced_search(MpegEncContext *s, int ref_index, ^ 894. int16_t (*mv_tables[2][2])[2], uint8_t *field_select_tables[2], int mx, int my, int user_field_select) 895. { libavcodec/motion_est.c:953:20: Call 951. P_MV1[1]= my / 2; 952. 953. dmin = epzs_motion_search2(s, &mx_i, &my_i, P, block, field_select+ref_index, mv_table, (1<<16)>>1); ^ 954. 955. dmin= c->sub_motion_search(s, &mx_i, &my_i, dmin, block, field_select+ref_index, size, h); libavcodec/motion_est_template.c:1191:1: Parameter `ref_index` 1189. 1190. //try to merge with above FIXME (needs PSNR test) 1191. static int epzs_motion_search2(MpegEncContext * s, ^ 1192. int *mx_ptr, int *my_ptr, int P[10][2], 1193. int src_index, int ref_index, int16_t (*last_mv)[2], libavcodec/motion_est_template.c:1219:9: Call 1217. /* first line */ 1218. if (s->first_slice_line) { 1219. CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) ^ 1220. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, 1221. (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) libavcodec/motion_est.c:108:1: <Length trace> 106. against a proposed motion-compensated prediction of that block 107. */ 108. static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, ^ 109. const int size, const int h, int ref_index, int src_index, 110. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ libavcodec/motion_est.c:108:1: Parameter `ref_index` 106. against a proposed motion-compensated prediction of that block 107. */ 108. static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, ^ 109. const int size, const int h, int ref_index, int src_index, 110. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ libavcodec/motion_est.c:119:5: Assignment 117. const int hx= subx + (x<<(1+qpel)); 118. const int hy= suby + (y<<(1+qpel)); 119. uint8_t * const * const ref= c->ref[ref_index]; ^ 120. uint8_t * const * const src= c->src[src_index]; 121. int d; libavcodec/motion_est.c:176:50: Array access: Offset: [8, 9] (⇐ [0, 1] + 8) Size: 4 by call to `interlaced_search` 174. 175. c->hpel_put[0][fxy](c->temp, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 16); 176. c->hpel_avg[0][bxy](c->temp, ref[8] + (bx>>1) + (by>>1)*stride, stride, 16); ^ 177. } 178. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est.c/#L176
d2a_code_trace_data_45602
int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) { unsigned char *dest; if (len == 0) return 1; if (!WPACKET_allocate_bytes(pkt, len, &dest)) return 0; memcpy(dest, src, len); return 1; } ssl/statem/statem_clnt.c:784: error: BUFFER_OVERRUN_S2 Offset added: [`pkt->curr` + 32, `pkt->curr` + 36] (⇐ [`pkt->curr`, `pkt->curr` + 4] + 32) Size: [1, 2147483644] by call to `WPACKET_memcpy`. Showing all 13 steps of the trace ssl/statem/statem_clnt.c:696:1: Parameter `pkt->curr` 694. } 695. 696. > int tls_construct_client_hello(SSL *s, WPACKET *pkt) 697. { 698. unsigned char *p; ssl/statem/statem_clnt.c:783:10: Call 781. * the negotiated version. 782. */ 783. if (!WPACKET_put_bytes_u16(pkt, s->client_version) ^ 784. || !WPACKET_memcpy(pkt, s->s3->client_random, SSL3_RANDOM_SIZE)) { 785. SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); ssl/packet.c:261:1: Parameter `pkt->curr` 259. } 260. 261. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 262. { 263. unsigned char *data; ssl/statem/statem_clnt.c:784:17: Call 782. */ 783. if (!WPACKET_put_bytes_u16(pkt, s->client_version) 784. || !WPACKET_memcpy(pkt, s->s3->client_random, SSL3_RANDOM_SIZE)) { ^ 785. SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); 786. return 0; ssl/packet.c:302:1: <Offset trace> 300. } 301. 302. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) 303. { 304. unsigned char *dest; ssl/packet.c:302:1: Parameter `len` 300. } 301. 302. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) 303. { 304. unsigned char *dest; ssl/packet.c:302:1: <Length trace> 300. } 301. 302. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) 303. { 304. unsigned char *dest; ssl/packet.c:302:1: Parameter `*pkt->buf->data` 300. } 301. 302. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) 303. { 304. unsigned char *dest; ssl/packet.c:309:10: Call 307. return 1; 308. 309. if (!WPACKET_allocate_bytes(pkt, len, &dest)) ^ 310. return 0; 311. ssl/packet.c:15:1: Parameter `**allocbytes` 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: Parameter `**allocbytes` 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:312:5: Array access: Offset added: [pkt->curr + 32, pkt->curr + 36] (⇐ [pkt->curr, pkt->curr + 4] + 32) Size: [1, 2147483644] by call to `WPACKET_memcpy` 310. return 0; 311. 312. memcpy(dest, src, len); ^ 313. 314. return 1;
https://github.com/openssl/openssl/blob/b90506e995d44dee0ef4dd0324b56b59154256c2/ssl/packet.c/#L312
d2a_code_trace_data_45603
void CRYPTO_free(void *str) { #ifndef OPENSSL_NO_CRYPTO_MDEBUG if (call_malloc_debug) { CRYPTO_mem_debug_free(str, 0); free(str); CRYPTO_mem_debug_free(str, 1); } else { free(str); } #else free(str); #endif } crypto/evp/digest.c:167: error: USE_AFTER_FREE call to `EVP_DigestInit_ex()` eventually accesses memory that was invalidated by call to `free()` on line 166 indirectly during the call to `EVP_MD_CTX_reset()`. Showing all 16 steps of the trace crypto/evp/digest.c:164:1: invalidation part of the trace starts here 162. } 163. 164. > int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) 165. { 166. EVP_MD_CTX_reset(ctx); crypto/evp/digest.c:164:1: parameter `ctx` of EVP_DigestInit 162. } 163. 164. > int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) 165. { 166. EVP_MD_CTX_reset(ctx); crypto/evp/digest.c:166:5: when calling `EVP_MD_CTX_reset` here 164. int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) 165. { 166. EVP_MD_CTX_reset(ctx); ^ 167. return EVP_DigestInit_ex(ctx, type, NULL); 168. } crypto/evp/digest.c:123:1: parameter `ctx` of EVP_MD_CTX_reset 121. 122. /* This call frees resources associated with the context */ 123. > int EVP_MD_CTX_reset(EVP_MD_CTX *ctx) 124. { 125. if (ctx == NULL) crypto/evp/digest.c:137:9: when calling `CRYPTO_clear_free` here 135. if (ctx->digest && ctx->digest->ctx_size && ctx->md_data 136. && !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE)) { 137. OPENSSL_clear_free(ctx->md_data, ctx->digest->ctx_size); ^ 138. } 139. EVP_PKEY_CTX_free(ctx->pctx); crypto/mem.c:249:1: parameter `str` of CRYPTO_clear_free 247. } 248. 249. > void CRYPTO_clear_free(void *str, size_t num) 250. { 251. if (str == NULL) crypto/mem.c:255:5: when calling `CRYPTO_free` here 253. if (num) 254. OPENSSL_cleanse(str, num); 255. CRYPTO_free(str); ^ 256. } crypto/mem.c:234:1: parameter `str` of CRYPTO_free 232. } 233. 234. > void CRYPTO_free(void *str) 235. { 236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:245:5: was invalidated by call to `free()` 243. } 244. #else 245. free(str); ^ 246. #endif 247. } crypto/evp/digest.c:164:1: use-after-lifetime part of the trace starts here 162. } 163. 164. > int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) 165. { 166. EVP_MD_CTX_reset(ctx); crypto/evp/digest.c:164:1: parameter `ctx` of EVP_DigestInit 162. } 163. 164. > int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) 165. { 166. EVP_MD_CTX_reset(ctx); crypto/evp/digest.c:167:12: when calling `EVP_DigestInit_ex` here 165. { 166. EVP_MD_CTX_reset(ctx); 167. return EVP_DigestInit_ex(ctx, type, NULL); ^ 168. } 169. crypto/evp/digest.c:170:1: parameter `ctx` of EVP_DigestInit_ex 168. } 169. 170. > int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl) 171. { 172. EVP_MD_CTX_clear_flags(ctx, EVP_MD_CTX_FLAG_CLEANED); crypto/evp/digest.c:229:13: when calling `CRYPTO_free` here 227. if (ctx->digest != type) { 228. if (ctx->digest && ctx->digest->ctx_size) 229. OPENSSL_free(ctx->md_data); ^ 230. ctx->digest = type; 231. if (!(ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) && type->ctx_size) { crypto/mem.c:234:1: parameter `str` of CRYPTO_free 232. } 233. 234. > void CRYPTO_free(void *str) 235. { 236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:245:5: invalid access occurs here 243. } 244. #else 245. free(str); ^ 246. #endif 247. }
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/mem.c/#L245
d2a_code_trace_data_45604
int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) { PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | (diff > (0 - (PTRDIFF_T)len))); assert(!overlapped); return overlapped; } ssl/record/ssl3_record_tls13.c:96: error: INTEGER_OVERFLOW_L2 (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate`. Showing all 9 steps of the trace ssl/record/ssl3_record_tls13.c:96:16: Call 94. /* TODO(size_t): lenu/lenf should be a size_t but EVP doesn't support it */ 95. if (EVP_CipherInit_ex(ctx, NULL, NULL, NULL, iv, send) <= 0 96. || EVP_CipherUpdate(ctx, rec->data, &lenu, rec->input, ^ 97. (unsigned int)rec->length) <= 0 98. || (!send && EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, crypto/evp/evp_enc.c:205:1: Parameter `ctx->cipher->block_size` 203. } 204. 205. > int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 206. const unsigned char *in, int inl) 207. { crypto/evp/evp_enc.c:211:16: Call 209. return EVP_EncryptUpdate(ctx, out, outl, in, inl); 210. else 211. return EVP_DecryptUpdate(ctx, out, outl, in, inl); ^ 212. } 213. crypto/evp/evp_enc.c:416:1: Parameter `ctx->cipher->block_size` 414. } 415. 416. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 417. const unsigned char *in, int inl) 418. { crypto/evp/evp_enc.c:422:5: Assignment 420. unsigned int b; 421. 422. b = ctx->cipher->block_size; ^ 423. 424. if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) { crypto/evp/evp_enc.c:452:16: Call 450. /* see comment about PTRDIFF_T comparison above */ 451. if (((PTRDIFF_T)out == (PTRDIFF_T)in) 452. || is_partially_overlapping(out, in, b)) { ^ 453. EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING); 454. return 0; crypto/evp/evp_enc.c:279:1: <RHS trace> 277. #endif 278. 279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 280. { 281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:279:1: Parameter `len` 277. #endif 278. 279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 280. { 281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:288:50: Binary operation: (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate` 286. */ 287. int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | 288. (diff > (0 - (PTRDIFF_T)len))); ^ 289. assert(!overlapped); 290. return overlapped;
https://github.com/openssl/openssl/blob/7141ba31969d0b378d08104a51f8f99b9187b9d5/crypto/evp/evp_enc.c/#L288
d2a_code_trace_data_45605
static int pkey_gost_init(EVP_PKEY_CTX *ctx) { struct gost_pmeth_data *data; EVP_PKEY *pkey = EVP_PKEY_CTX_get0_pkey(ctx); data = OPENSSL_zalloc(sizeof(*data)); if (!data) return 0; if (pkey && EVP_PKEY_get0(pkey)) { switch (EVP_PKEY_base_id(pkey)) { case NID_id_GostR3410_2001: data->sign_param_nid = EC_GROUP_get_curve_name(EC_KEY_get0_group (EVP_PKEY_get0((EVP_PKEY *)pkey))); break; default: return 0; } } EVP_PKEY_CTX_set_data(ctx, data); return 1; } engines/ccgost/gost_pmeth.c:38: error: MEMORY_LEAK memory dynamically allocated to `return` by call to `CRYPTO_zalloc()` at line 27, column 12 is not reachable after line 38, column 13. Showing all 95 steps of the trace engines/ccgost/gost_pmeth.c:22:1: start of procedure pkey_gost_init() 20. /* -----init, cleanup, copy - uniform for all algs ---------------*/ 21. /* Allocates new gost_pmeth_data structure and assigns it as data */ 22. > static int pkey_gost_init(EVP_PKEY_CTX *ctx) 23. { 24. struct gost_pmeth_data *data; engines/ccgost/gost_pmeth.c:25:5: 23. { 24. struct gost_pmeth_data *data; 25. > EVP_PKEY *pkey = EVP_PKEY_CTX_get0_pkey(ctx); 26. 27. data = OPENSSL_zalloc(sizeof(*data)); crypto/evp/pmeth_lib.c:411:1: start of procedure EVP_PKEY_CTX_get0_pkey() 409. } 410. 411. > EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx) 412. { 413. return ctx->pkey; crypto/evp/pmeth_lib.c:413:5: 411. EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx) 412. { 413. > return ctx->pkey; 414. } 415. crypto/evp/pmeth_lib.c:414:1: return from a call to EVP_PKEY_CTX_get0_pkey 412. { 413. return ctx->pkey; 414. > } 415. 416. EVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx) engines/ccgost/gost_pmeth.c:27:5: 25. EVP_PKEY *pkey = EVP_PKEY_CTX_get0_pkey(ctx); 26. 27. > data = OPENSSL_zalloc(sizeof(*data)); 28. if (!data) 29. return 0; 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) engines/ccgost/gost_pmeth.c:28:10: Taking false branch 26. 27. data = OPENSSL_zalloc(sizeof(*data)); 28. if (!data) ^ 29. return 0; 30. if (pkey && EVP_PKEY_get0(pkey)) { engines/ccgost/gost_pmeth.c:30:9: Taking true branch 28. if (!data) 29. return 0; 30. if (pkey && EVP_PKEY_get0(pkey)) { ^ 31. switch (EVP_PKEY_base_id(pkey)) { 32. case NID_id_GostR3410_2001: engines/ccgost/gost_pmeth.c:30:17: 28. if (!data) 29. return 0; 30. > if (pkey && EVP_PKEY_get0(pkey)) { 31. switch (EVP_PKEY_base_id(pkey)) { 32. case NID_id_GostR3410_2001: crypto/evp/p_lib.c:278:1: start of procedure EVP_PKEY_get0() 276. } 277. 278. > void *EVP_PKEY_get0(EVP_PKEY *pkey) 279. { 280. return pkey->pkey.ptr; crypto/evp/p_lib.c:280:5: 278. void *EVP_PKEY_get0(EVP_PKEY *pkey) 279. { 280. > return pkey->pkey.ptr; 281. } 282. crypto/evp/p_lib.c:281:1: return from a call to EVP_PKEY_get0 279. { 280. return pkey->pkey.ptr; 281. > } 282. 283. #ifndef OPENSSL_NO_RSA engines/ccgost/gost_pmeth.c:30:17: Taking true branch 28. if (!data) 29. return 0; 30. if (pkey && EVP_PKEY_get0(pkey)) { ^ 31. switch (EVP_PKEY_base_id(pkey)) { 32. case NID_id_GostR3410_2001: engines/ccgost/gost_pmeth.c:31:9: 29. return 0; 30. if (pkey && EVP_PKEY_get0(pkey)) { 31. > switch (EVP_PKEY_base_id(pkey)) { 32. case NID_id_GostR3410_2001: 33. data->sign_param_nid = crypto/evp/p_lib.c:415:1: start of procedure EVP_PKEY_base_id() 413. } 414. 415. > int EVP_PKEY_base_id(const EVP_PKEY *pkey) 416. { 417. return EVP_PKEY_type(pkey->type); crypto/evp/p_lib.c:417:5: 415. int EVP_PKEY_base_id(const EVP_PKEY *pkey) 416. { 417. > return EVP_PKEY_type(pkey->type); 418. } 419. crypto/evp/p_lib.c:393:1: start of procedure EVP_PKEY_type() 391. #endif 392. 393. > int EVP_PKEY_type(int type) 394. { 395. int ret; crypto/evp/p_lib.c:398:5: 396. const EVP_PKEY_ASN1_METHOD *ameth; 397. ENGINE *e; 398. > ameth = EVP_PKEY_asn1_find(&e, type); 399. if (ameth) 400. ret = ameth->pkey_id; crypto/asn1/ameth_lib.c:162:1: start of procedure EVP_PKEY_asn1_find() 160. */ 161. 162. > const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type) 163. { 164. const EVP_PKEY_ASN1_METHOD *t; crypto/asn1/ameth_lib.c:171:5: Loop condition is true. Entering loop body 169. break; 170. type = t->pkey_base_id; 171. } ^ 172. if (pe) { 173. #ifndef OPENSSL_NO_ENGINE crypto/asn1/ameth_lib.c:167:9: 165. 166. for (;;) { 167. > t = pkey_asn1_find(type); 168. if (!t || !(t->pkey_flags & ASN1_PKEY_ALIAS)) 169. break; crypto/asn1/ameth_lib.c:139:1: start of procedure pkey_asn1_find() 137. } 138. 139. > static const EVP_PKEY_ASN1_METHOD *pkey_asn1_find(int type) 140. { 141. EVP_PKEY_ASN1_METHOD tmp; crypto/asn1/ameth_lib.c:142:5: 140. { 141. EVP_PKEY_ASN1_METHOD tmp; 142. > const EVP_PKEY_ASN1_METHOD *t = &tmp, **ret; 143. tmp.pkey_id = type; 144. if (app_methods) { crypto/asn1/ameth_lib.c:143:5: 141. EVP_PKEY_ASN1_METHOD tmp; 142. const EVP_PKEY_ASN1_METHOD *t = &tmp, **ret; 143. > tmp.pkey_id = type; 144. if (app_methods) { 145. int idx; crypto/asn1/ameth_lib.c:144:9: Taking true branch 142. const EVP_PKEY_ASN1_METHOD *t = &tmp, **ret; 143. tmp.pkey_id = type; 144. if (app_methods) { ^ 145. int idx; 146. idx = sk_EVP_PKEY_ASN1_METHOD_find(app_methods, &tmp); crypto/asn1/ameth_lib.c:146:9: 144. if (app_methods) { 145. int idx; 146. > idx = sk_EVP_PKEY_ASN1_METHOD_find(app_methods, &tmp); 147. if (idx >= 0) 148. return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx); crypto/include/internal/asn1_int.h:107:1: start of procedure sk_EVP_PKEY_ASN1_METHOD_find() 105. } /* EVP_PKEY_ASN1_METHOD */ ; 106. 107. > DEFINE_STACK_OF_CONST(EVP_PKEY_ASN1_METHOD) 108. 109. extern const EVP_PKEY_ASN1_METHOD cmac_asn1_meth; crypto/stack/stack.c:249:1: start of procedure sk_find() 247. } 248. 249. > int sk_find(_STACK *st, void *data) 250. { 251. return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH); crypto/stack/stack.c:251:5: 249. int sk_find(_STACK *st, void *data) 250. { 251. > return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH); 252. } 253. crypto/stack/stack.c:225:1: start of procedure internal_find() 223. } 224. 225. > static int internal_find(_STACK *st, void *data, int ret_val_options) 226. { 227. const void *const *r; crypto/stack/stack.c:230:9: Taking false branch 228. int i; 229. 230. if (st == NULL) ^ 231. return -1; 232. crypto/stack/stack.c:233:9: Taking true branch 231. return -1; 232. 233. if (st->comp == NULL) { ^ 234. for (i = 0; i < st->num; i++) 235. if (st->data[i] == data) crypto/stack/stack.c:234:14: 232. 233. if (st->comp == NULL) { 234. > for (i = 0; i < st->num; i++) 235. if (st->data[i] == data) 236. return (i); crypto/stack/stack.c:234:21: Loop condition is true. Entering loop body 232. 233. if (st->comp == NULL) { 234. for (i = 0; i < st->num; i++) ^ 235. if (st->data[i] == data) 236. return (i); crypto/stack/stack.c:235:17: Taking false branch 233. if (st->comp == NULL) { 234. for (i = 0; i < st->num; i++) 235. if (st->data[i] == data) ^ 236. return (i); 237. return (-1); crypto/stack/stack.c:234:34: 232. 233. if (st->comp == NULL) { 234. > for (i = 0; i < st->num; i++) 235. if (st->data[i] == data) 236. return (i); crypto/stack/stack.c:234:21: Loop condition is true. Entering loop body 232. 233. if (st->comp == NULL) { 234. for (i = 0; i < st->num; i++) ^ 235. if (st->data[i] == data) 236. return (i); crypto/stack/stack.c:235:17: Taking true branch 233. if (st->comp == NULL) { 234. for (i = 0; i < st->num; i++) 235. if (st->data[i] == data) ^ 236. return (i); 237. return (-1); crypto/stack/stack.c:236:17: 234. for (i = 0; i < st->num; i++) 235. if (st->data[i] == data) 236. > return (i); 237. return (-1); 238. } crypto/stack/stack.c:247:1: return from a call to internal_find 245. return (-1); 246. return (int)((char **)r - st->data); 247. > } 248. 249. int sk_find(_STACK *st, void *data) crypto/stack/stack.c:252:1: return from a call to sk_find 250. { 251. return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH); 252. > } 253. 254. int sk_find_ex(_STACK *st, void *data) crypto/include/internal/asn1_int.h:107:1: return from a call to sk_EVP_PKEY_ASN1_METHOD_find 105. } /* EVP_PKEY_ASN1_METHOD */ ; 106. 107. > DEFINE_STACK_OF_CONST(EVP_PKEY_ASN1_METHOD) 108. 109. extern const EVP_PKEY_ASN1_METHOD cmac_asn1_meth; crypto/asn1/ameth_lib.c:147:13: Taking true branch 145. int idx; 146. idx = sk_EVP_PKEY_ASN1_METHOD_find(app_methods, &tmp); 147. if (idx >= 0) ^ 148. return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx); 149. } crypto/asn1/ameth_lib.c:148:13: 146. idx = sk_EVP_PKEY_ASN1_METHOD_find(app_methods, &tmp); 147. if (idx >= 0) 148. > return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx); 149. } 150. ret = OBJ_bsearch_ameth(&t, standard_methods, OSSL_NELEM(standard_methods)); crypto/include/internal/asn1_int.h:107:1: start of procedure sk_EVP_PKEY_ASN1_METHOD_value() 105. } /* EVP_PKEY_ASN1_METHOD */ ; 106. 107. > DEFINE_STACK_OF_CONST(EVP_PKEY_ASN1_METHOD) 108. 109. extern const EVP_PKEY_ASN1_METHOD cmac_asn1_meth; crypto/stack/stack.c:324:1: start of procedure sk_value() 322. } 323. 324. > void *sk_value(const _STACK *st, int i) 325. { 326. if (!st || (i < 0) || (i >= st->num)) crypto/stack/stack.c:326:10: Taking false branch 324. void *sk_value(const _STACK *st, int i) 325. { 326. if (!st || (i < 0) || (i >= st->num)) ^ 327. return NULL; 328. return st->data[i]; crypto/stack/stack.c:326:17: Taking false branch 324. void *sk_value(const _STACK *st, int i) 325. { 326. if (!st || (i < 0) || (i >= st->num)) ^ 327. return NULL; 328. return st->data[i]; crypto/stack/stack.c:326:28: Taking false branch 324. void *sk_value(const _STACK *st, int i) 325. { 326. if (!st || (i < 0) || (i >= st->num)) ^ 327. return NULL; 328. return st->data[i]; crypto/stack/stack.c:328:5: 326. if (!st || (i < 0) || (i >= st->num)) 327. return NULL; 328. > return st->data[i]; 329. } 330. crypto/stack/stack.c:329:1: return from a call to sk_value 327. return NULL; 328. return st->data[i]; 329. > } 330. 331. void *sk_set(_STACK *st, int i, void *value) crypto/include/internal/asn1_int.h:107:1: return from a call to sk_EVP_PKEY_ASN1_METHOD_value 105. } /* EVP_PKEY_ASN1_METHOD */ ; 106. 107. > DEFINE_STACK_OF_CONST(EVP_PKEY_ASN1_METHOD) 108. 109. extern const EVP_PKEY_ASN1_METHOD cmac_asn1_meth; crypto/asn1/ameth_lib.c:154:1: return from a call to pkey_asn1_find 152. return NULL; 153. return *ret; 154. > } 155. 156. /* crypto/asn1/ameth_lib.c:168:14: Taking false branch 166. for (;;) { 167. t = pkey_asn1_find(type); 168. if (!t || !(t->pkey_flags & ASN1_PKEY_ALIAS)) ^ 169. break; 170. type = t->pkey_base_id; crypto/asn1/ameth_lib.c:168:21: Taking true branch 166. for (;;) { 167. t = pkey_asn1_find(type); 168. if (!t || !(t->pkey_flags & ASN1_PKEY_ALIAS)) ^ 169. break; 170. type = t->pkey_base_id; crypto/asn1/ameth_lib.c:172:9: Taking true branch 170. type = t->pkey_base_id; 171. } 172. if (pe) { ^ 173. #ifndef OPENSSL_NO_ENGINE 174. ENGINE *e; crypto/asn1/ameth_lib.c:176:9: 174. ENGINE *e; 175. /* type will contain the final unaliased type */ 176. > e = ENGINE_get_pkey_asn1_meth_engine(type); 177. if (e) { 178. *pe = e; crypto/engine/tb_asnmth.c:118:1: start of procedure ENGINE_get_pkey_asn1_meth_engine() 116. * references) for a given pkey_asn1_meth 'nid' 117. */ 118. > ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid) 119. { 120. return engine_table_select(&pkey_asn1_meth_table, nid); crypto/engine/tb_asnmth.c:120:5: 118. ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid) 119. { 120. > return engine_table_select(&pkey_asn1_meth_table, nid); 121. } 122. crypto/engine/eng_table.c:243:1: start of procedure engine_table_select() 241. /* return a functional reference for a given 'nid' */ 242. #ifndef ENGINE_TABLE_DEBUG 243. > ENGINE *engine_table_select(ENGINE_TABLE **table, int nid) 244. #else 245. ENGINE *engine_table_select_tmp(ENGINE_TABLE **table, int nid, const char *f, crypto/engine/eng_table.c:249:5: 247. #endif 248. { 249. > ENGINE *ret = NULL; 250. ENGINE_PILE tmplate, *fnd = NULL; 251. int initres, loop = 0; crypto/engine/eng_table.c:250:5: 248. { 249. ENGINE *ret = NULL; 250. > ENGINE_PILE tmplate, *fnd = NULL; 251. int initres, loop = 0; 252. crypto/engine/eng_table.c:251:5: 249. ENGINE *ret = NULL; 250. ENGINE_PILE tmplate, *fnd = NULL; 251. > int initres, loop = 0; 252. 253. if (!(*table)) { crypto/engine/eng_table.c:253:11: 251. int initres, loop = 0; 252. 253. > if (!(*table)) { 254. #ifdef ENGINE_TABLE_DEBUG 255. fprintf(stderr, "engine_table_dbg: %s:%d, nid=%d, nothing " crypto/engine/eng_table.c:253:10: Taking true branch 251. int initres, loop = 0; 252. 253. if (!(*table)) { ^ 254. #ifdef ENGINE_TABLE_DEBUG 255. fprintf(stderr, "engine_table_dbg: %s:%d, nid=%d, nothing " crypto/engine/eng_table.c:258:9: 256. "registered!\n", f, l, nid); 257. #endif 258. > return NULL; 259. } 260. ERR_set_mark(); crypto/engine/eng_table.c:339:1: return from a call to engine_table_select 337. ERR_pop_to_mark(); 338. return ret; 339. > } 340. 341. /* Table enumeration */ crypto/engine/tb_asnmth.c:121:1: return from a call to ENGINE_get_pkey_asn1_meth_engine 119. { 120. return engine_table_select(&pkey_asn1_meth_table, nid); 121. > } 122. 123. /* crypto/asn1/ameth_lib.c:177:13: Taking false branch 175. /* type will contain the final unaliased type */ 176. e = ENGINE_get_pkey_asn1_meth_engine(type); 177. if (e) { ^ 178. *pe = e; 179. return ENGINE_get_pkey_asn1_meth(e, type); crypto/asn1/ameth_lib.c:182:9: 180. } 181. #endif 182. > *pe = NULL; 183. } 184. return t; crypto/asn1/ameth_lib.c:184:5: 182. *pe = NULL; 183. } 184. > return t; 185. } 186. crypto/asn1/ameth_lib.c:185:1: return from a call to EVP_PKEY_asn1_find 183. } 184. return t; 185. > } 186. 187. const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe, crypto/evp/p_lib.c:399:9: Taking true branch 397. ENGINE *e; 398. ameth = EVP_PKEY_asn1_find(&e, type); 399. if (ameth) ^ 400. ret = ameth->pkey_id; 401. else crypto/evp/p_lib.c:400:9: 398. ameth = EVP_PKEY_asn1_find(&e, type); 399. if (ameth) 400. > ret = ameth->pkey_id; 401. else 402. ret = NID_undef; crypto/evp/p_lib.c:404:9: Taking false branch 402. ret = NID_undef; 403. #ifndef OPENSSL_NO_ENGINE 404. if (e) ^ 405. ENGINE_finish(e); 406. #endif crypto/evp/p_lib.c:407:5: 405. ENGINE_finish(e); 406. #endif 407. > return ret; 408. } 409. crypto/evp/p_lib.c:408:1: return from a call to EVP_PKEY_type 406. #endif 407. return ret; 408. > } 409. 410. int EVP_PKEY_id(const EVP_PKEY *pkey) crypto/evp/p_lib.c:418:1: return from a call to EVP_PKEY_base_id 416. { 417. return EVP_PKEY_type(pkey->type); 418. > } 419. 420. void EVP_PKEY_free(EVP_PKEY *x) engines/ccgost/gost_pmeth.c:32:9: Switch condition is false. Skipping switch case 30. if (pkey && EVP_PKEY_get0(pkey)) { 31. switch (EVP_PKEY_base_id(pkey)) { 32. case NID_id_GostR3410_2001: ^ 33. data->sign_param_nid = 34. EC_GROUP_get_curve_name(EC_KEY_get0_group engines/ccgost/gost_pmeth.c:38:13: 36. break; 37. default: 38. > return 0; 39. } 40. }
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/engines/ccgost/gost_pmeth.c/#L38
d2a_code_trace_data_45606
static int flac_decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size) { FLACContext *s = avctx->priv_data; int tmp = 0, i, j = 0, input_buf_size = 0; int16_t *samples_16 = data; int32_t *samples_32 = data; int alloc_data_size= *data_size; *data_size=0; if (s->max_framesize == 0) { s->max_framesize= FFMAX(4, buf_size); s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize); } if (1 && s->max_framesize) { if (s->bitstream_size < 4 || AV_RL32(s->bitstream) != MKTAG('f','L','a','C')) buf_size= FFMIN(buf_size, s->max_framesize - FFMIN(s->bitstream_size, s->max_framesize)); input_buf_size= buf_size; if (s->bitstream_size + buf_size < buf_size || s->bitstream_index + s->bitstream_size + buf_size < s->bitstream_index) return -1; if (s->allocated_bitstream_size < s->bitstream_size + buf_size) s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->bitstream_size + buf_size); if (s->bitstream_index + s->bitstream_size + buf_size > s->allocated_bitstream_size) { memmove(s->bitstream, &s->bitstream[s->bitstream_index], s->bitstream_size); s->bitstream_index=0; } memcpy(&s->bitstream[s->bitstream_index + s->bitstream_size], buf, buf_size); buf= &s->bitstream[s->bitstream_index]; buf_size += s->bitstream_size; s->bitstream_size= buf_size; if (buf_size < s->max_framesize && input_buf_size) { return input_buf_size; } } init_get_bits(&s->gb, buf, buf_size*8); if (metadata_parse(s)) goto end; tmp = show_bits(&s->gb, 16); if ((tmp & 0xFFFE) != 0xFFF8) { av_log(s->avctx, AV_LOG_ERROR, "FRAME HEADER not here\n"); while (get_bits_count(&s->gb)/8+2 < buf_size && (show_bits(&s->gb, 16) & 0xFFFE) != 0xFFF8) skip_bits(&s->gb, 8); goto end; } skip_bits(&s->gb, 16); if (decode_frame(s, alloc_data_size) < 0) { av_log(s->avctx, AV_LOG_ERROR, "decode_frame() failed\n"); s->bitstream_size=0; s->bitstream_index=0; return -1; } #define DECORRELATE(left, right)\ assert(s->channels == 2);\ for (i = 0; i < s->blocksize; i++) {\ int a= s->decoded[0][i];\ int b= s->decoded[1][i];\ if (s->is32) {\ *samples_32++ = (left) << s->sample_shift;\ *samples_32++ = (right) << s->sample_shift;\ } else {\ *samples_16++ = (left) << s->sample_shift;\ *samples_16++ = (right) << s->sample_shift;\ }\ }\ break; switch (s->decorrelation) { case INDEPENDENT: for (j = 0; j < s->blocksize; j++) { for (i = 0; i < s->channels; i++) { if (s->is32) *samples_32++ = s->decoded[i][j] << s->sample_shift; else *samples_16++ = s->decoded[i][j] << s->sample_shift; } } break; case LEFT_SIDE: DECORRELATE(a,a-b) case RIGHT_SIDE: DECORRELATE(a+b,b) case MID_SIDE: DECORRELATE( (a-=b>>1) + b, a) } *data_size = s->blocksize * s->channels * (s->is32 ? 4 : 2); end: i= (get_bits_count(&s->gb)+7)/8; if (i > buf_size) { av_log(s->avctx, AV_LOG_ERROR, "overread: %d\n", i - buf_size); s->bitstream_size=0; s->bitstream_index=0; return -1; } if (s->bitstream_size) { s->bitstream_index += i; s->bitstream_size -= i; return input_buf_size; } else return i; } libavcodec/flacdec.c:618: error: Null Dereference pointer `s->bitstream` last assigned on line 614 could be null and is dereferenced at line 618, column 38. libavcodec/flacdec.c:600:1: start of procedure flac_decode_frame() 598. } 599. 600. static int flac_decode_frame(AVCodecContext *avctx, ^ 601. void *data, int *data_size, 602. const uint8_t *buf, int buf_size) libavcodec/flacdec.c:604:5: 602. const uint8_t *buf, int buf_size) 603. { 604. FLACContext *s = avctx->priv_data; ^ 605. int tmp = 0, i, j = 0, input_buf_size = 0; 606. int16_t *samples_16 = data; libavcodec/flacdec.c:605:5: 603. { 604. FLACContext *s = avctx->priv_data; 605. int tmp = 0, i, j = 0, input_buf_size = 0; ^ 606. int16_t *samples_16 = data; 607. int32_t *samples_32 = data; libavcodec/flacdec.c:606:5: 604. FLACContext *s = avctx->priv_data; 605. int tmp = 0, i, j = 0, input_buf_size = 0; 606. int16_t *samples_16 = data; ^ 607. int32_t *samples_32 = data; 608. int alloc_data_size= *data_size; libavcodec/flacdec.c:607:5: 605. int tmp = 0, i, j = 0, input_buf_size = 0; 606. int16_t *samples_16 = data; 607. int32_t *samples_32 = data; ^ 608. int alloc_data_size= *data_size; 609. libavcodec/flacdec.c:608:5: 606. int16_t *samples_16 = data; 607. int32_t *samples_32 = data; 608. int alloc_data_size= *data_size; ^ 609. 610. *data_size=0; libavcodec/flacdec.c:610:5: 608. int alloc_data_size= *data_size; 609. 610. *data_size=0; ^ 611. 612. if (s->max_framesize == 0) { libavcodec/flacdec.c:612:9: Taking true branch 610. *data_size=0; 611. 612. if (s->max_framesize == 0) { ^ 613. s->max_framesize= FFMAX(4, buf_size); // should hopefully be enough for the first header 614. s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize); libavcodec/flacdec.c:613:27: Condition is false 611. 612. if (s->max_framesize == 0) { 613. s->max_framesize= FFMAX(4, buf_size); // should hopefully be enough for the first header ^ 614. s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize); 615. } libavcodec/flacdec.c:613:9: 611. 612. if (s->max_framesize == 0) { 613. s->max_framesize= FFMAX(4, buf_size); // should hopefully be enough for the first header ^ 614. s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize); 615. } libavcodec/flacdec.c:614:9: 612. if (s->max_framesize == 0) { 613. s->max_framesize= FFMAX(4, buf_size); // should hopefully be enough for the first header 614. s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize); ^ 615. } 616. libavcodec/utils.c:69:1: start of procedure av_fast_realloc() 67. static int volatile entangled_thread_counter=0; 68. 69. void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size) ^ 70. { 71. if(min_size < *size) libavcodec/utils.c:71:8: Taking false branch 69. void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size) 70. { 71. if(min_size < *size) ^ 72. return ptr; 73. libavcodec/utils.c:74:12: Condition is false 72. return ptr; 73. 74. *size= FFMAX(17*min_size/16 + 32, min_size); ^ 75. 76. ptr= av_realloc(ptr, *size); libavcodec/utils.c:74:5: 72. return ptr; 73. 74. *size= FFMAX(17*min_size/16 + 32, min_size); ^ 75. 76. ptr= av_realloc(ptr, *size); libavcodec/utils.c:76:5: 74. *size= FFMAX(17*min_size/16 + 32, min_size); 75. 76. ptr= av_realloc(ptr, *size); ^ 77. if(!ptr) //we could set this to the unmodified min_size but this is safer if the user lost the ptr and uses NULL now 78. *size= 0; libavutil/mem.c:102:1: start of procedure av_realloc() 100. } 101. 102. void *av_realloc(void *ptr, unsigned int size) ^ 103. { 104. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:109:8: Taking true branch 107. 108. /* let's disallow possible ambiguous cases */ 109. if(size > (INT_MAX-16) ) ^ 110. return NULL; 111. libavutil/mem.c:110:9: 108. /* let's disallow possible ambiguous cases */ 109. if(size > (INT_MAX-16) ) 110. return NULL; ^ 111. 112. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:120:1: return from a call to av_realloc 118. return realloc(ptr, size); 119. #endif 120. } ^ 121. 122. void av_free(void *ptr) libavcodec/utils.c:77:9: Taking true branch 75. 76. ptr= av_realloc(ptr, *size); 77. if(!ptr) //we could set this to the unmodified min_size but this is safer if the user lost the ptr and uses NULL now ^ 78. *size= 0; 79. libavcodec/utils.c:78:9: 76. ptr= av_realloc(ptr, *size); 77. if(!ptr) //we could set this to the unmodified min_size but this is safer if the user lost the ptr and uses NULL now 78. *size= 0; ^ 79. 80. return ptr; libavcodec/utils.c:80:5: 78. *size= 0; 79. 80. return ptr; ^ 81. } 82. libavcodec/utils.c:81:1: return from a call to av_fast_realloc 79. 80. return ptr; 81. } ^ 82. 83. /* encoder management */ libavcodec/flacdec.c:617:9: Taking true branch 615. } 616. 617. if (1 && s->max_framesize) { //FIXME truncated ^ 618. if (s->bitstream_size < 4 || AV_RL32(s->bitstream) != MKTAG('f','L','a','C')) 619. buf_size= FFMIN(buf_size, s->max_framesize - FFMIN(s->bitstream_size, s->max_framesize)); libavcodec/flacdec.c:617:14: Taking true branch 615. } 616. 617. if (1 && s->max_framesize) { //FIXME truncated ^ 618. if (s->bitstream_size < 4 || AV_RL32(s->bitstream) != MKTAG('f','L','a','C')) 619. buf_size= FFMIN(buf_size, s->max_framesize - FFMIN(s->bitstream_size, s->max_framesize)); libavcodec/flacdec.c:618:13: Taking false branch 616. 617. if (1 && s->max_framesize) { //FIXME truncated 618. if (s->bitstream_size < 4 || AV_RL32(s->bitstream) != MKTAG('f','L','a','C')) ^ 619. buf_size= FFMIN(buf_size, s->max_framesize - FFMIN(s->bitstream_size, s->max_framesize)); 620. input_buf_size= buf_size; libavcodec/flacdec.c:618:38: 616. 617. if (1 && s->max_framesize) { //FIXME truncated 618. if (s->bitstream_size < 4 || AV_RL32(s->bitstream) != MKTAG('f','L','a','C')) ^ 619. buf_size= FFMIN(buf_size, s->max_framesize - FFMIN(s->bitstream_size, s->max_framesize)); 620. input_buf_size= buf_size;
https://github.com/libav/libav/blob/184bc53db4fded8857af09cee2adc7197940deb7/libavcodec/flacdec.c/#L618
d2a_code_trace_data_45607
static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, long max) { const unsigned char *p = *pp; unsigned long ret = 0; int i; if (max-- < 1) return 0; if (*p == 0x80) { *inf = 1; p++; } else { *inf = 0; i = *p & 0x7f; if (*p++ & 0x80) { if (max < i + 1) return 0; while (i > 0 && *p == 0) { p++; i--; } if (i > (int)sizeof(long)) return 0; while (i > 0) { ret <<= 8; ret |= *p++; i--; } if (ret > LONG_MAX) return 0; } else ret = i; } *pp = p; *rl = (long)ret; return 1; } crypto/ct/ct_log.c:135: 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:135:12: Call 133. } 134. 135. return CTLOG_new_from_base64(ct_log, pkey_base64, description); ^ 136. } 137. crypto/ct/ct_b64.c:135:1: Parameter `pkey_base64->strlen` 133. * -1 on internal (malloc) failure 134. */ 135. > int CTLOG_new_from_base64(CTLOG **ct_log, const char *pkey_base64, const char *name) 136. { 137. unsigned char *pkey_der = NULL; crypto/ct/ct_b64.c:147:20: Call 145. } 146. 147. pkey_der_len = ct_base64_decode(pkey_base64, &pkey_der); ^ 148. if (pkey_der_len < 0) { 149. CTerr(CT_F_CTLOG_NEW_FROM_BASE64, CT_R_LOG_CONF_INVALID_KEY); crypto/ct/ct_b64.c:24:1: Parameter `**out` 22. * the caller. Do not provide a pre-allocated string in |out|. 23. */ 24. > static int ct_base64_decode(const char *in, unsigned char **out) 25. { 26. size_t inlen = strlen(in); crypto/ct/ct_b64.c:153:5: Assignment 151. } 152. 153. p = pkey_der; ^ 154. pkey = d2i_PUBKEY(NULL, &p, pkey_der_len); 155. OPENSSL_free(pkey_der); crypto/ct/ct_b64.c:154:12: Call 152. 153. p = pkey_der; 154. pkey = d2i_PUBKEY(NULL, &p, pkey_der_len); ^ 155. OPENSSL_free(pkey_der); 156. if (pkey == NULL) { crypto/x509/x_pubkey.c:182:1: Parameter `**pp` 180. */ 181. 182. > EVP_PKEY *d2i_PUBKEY(EVP_PKEY **a, const unsigned char **pp, long length) 183. { 184. X509_PUBKEY *xpk; crypto/x509/x_pubkey.c:187:5: Assignment 185. EVP_PKEY *pktmp; 186. const unsigned char *q; 187. q = *pp; ^ 188. xpk = d2i_X509_PUBKEY(NULL, &q, length); 189. if (!xpk) crypto/x509/x_pubkey.c:188:11: Call 186. const unsigned char *q; 187. q = *pp; 188. xpk = d2i_X509_PUBKEY(NULL, &q, length); ^ 189. if (!xpk) 190. return NULL; crypto/x509/x_pubkey.c:58:1: Parameter `**in` 56. } ASN1_SEQUENCE_END_cb(X509_PUBKEY, X509_PUBKEY) 57. 58. > IMPLEMENT_ASN1_FUNCTIONS(X509_PUBKEY) 59. 60. /* TODO should better be called X509_PUBKEY_set1 */ crypto/x509/x_pubkey.c:58:1: Call 56. } ASN1_SEQUENCE_END_cb(X509_PUBKEY, X509_PUBKEY) 57. 58. > IMPLEMENT_ASN1_FUNCTIONS(X509_PUBKEY) 59. 60. /* TODO should better be called X509_PUBKEY_set1 */ crypto/asn1/tasn_dec.c:105:1: Parameter `**in` 103. */ 104. 105. > ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, 106. const unsigned char **in, long len, 107. const ASN1_ITEM *it) crypto/asn1/tasn_dec.c:114:9: Call 112. pval = &ptmpval; 113. asn1_tlc_clear_nc(&c); 114. if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) ^ 115. return *pval; 116. return NULL; crypto/asn1/tasn_dec.c:119:1: Parameter `**in` 117. } 118. 119. > int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, 120. const ASN1_ITEM *it, 121. int tag, int aclass, char opt, ASN1_TLC *ctx) crypto/asn1/tasn_dec.c:124:10: Call 122. { 123. int rv; 124. rv = asn1_item_embed_d2i(pval, in, len, it, tag, aclass, opt, ctx, 0); ^ 125. if (rv <= 0) 126. ASN1_item_ex_free(pval, it); crypto/asn1/tasn_dec.c:135:1: Parameter `**in` 133. */ 134. 135. > static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in, 136. long len, const ASN1_ITEM *it, 137. int tag, int aclass, char opt, ASN1_TLC *ctx, crypto/asn1/tasn_dec.c:185:9: Assignment 183. 184. case ASN1_ITYPE_MSTRING: 185. p = *in; ^ 186. /* Just read in tag and class */ 187. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, crypto/asn1/tasn_dec.c:187:15: Call 185. p = *in; 186. /* Just read in tag and class */ 187. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, ^ 188. &p, len, -1, 0, 1, ctx); 189. if (!ret) { crypto/asn1/tasn_dec.c:1078:1: Parameter `**in` 1076. */ 1077. 1078. > static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, 1079. char *inf, char *cst, 1080. const unsigned char **in, long len, crypto/asn1/tasn_dec.c:1087:5: Assignment 1085. long plen; 1086. const unsigned char *p, *q; 1087. p = *in; ^ 1088. q = p; 1089. crypto/asn1/tasn_dec.c:1097:13: Call 1095. p += ctx->hdrlen; 1096. } else { 1097. i = ASN1_get_object(&p, &plen, &ptag, &pclass, len); ^ 1098. if (ctx) { 1099. ctx->ret = i; crypto/asn1/asn1_lib.c:44:1: Parameter `**pp` 42. } 43. 44. > int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, 45. int *pclass, long omax) 46. { crypto/asn1/asn1_lib.c:49:5: Assignment 47. int i, ret; 48. long l; 49. const unsigned char *p = *pp; ^ 50. int tag, xclass, inf; 51. long max = omax; crypto/asn1/asn1_lib.c:78:9: Assignment 76. } else { 77. tag = i; 78. p++; ^ 79. if (--max == 0) 80. goto err; crypto/asn1/asn1_lib.c:84:10: Call 82. *ptag = tag; 83. *pclass = xclass; 84. if (!asn1_get_length(&p, &inf, plength, max)) ^ 85. goto err; 86. crypto/asn1/asn1_lib.c:112:1: <Length trace> 110. * are stored most significant digit first. 111. */ 112. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, 113. long max) 114. { crypto/asn1/asn1_lib.c:112:1: Parameter `**pp` 110. * are stored most significant digit first. 111. */ 112. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, 113. long max) 114. { crypto/asn1/asn1_lib.c:115:5: Assignment 113. long max) 114. { 115. const unsigned char *p = *pp; ^ 116. unsigned long ret = 0; 117. int i; crypto/asn1/asn1_lib.c:127:14: Assignment 125. *inf = 0; 126. i = *p & 0x7f; 127. if (*p++ & 0x80) { ^ 128. if (max < i + 1) 129. return 0; crypto/asn1/asn1_lib.c:131:29: Array access: Offset: [2, +oo] Size: [1, +oo] by call to `CTLOG_new_from_base64` 129. return 0; 130. /* Skip leading zeroes */ 131. while (i > 0 && *p == 0) { ^ 132. p++; 133. i--;
https://github.com/openssl/openssl/blob/bcf082d130a413a728a382bd6e6bfdbf2cedba45/crypto/asn1/asn1_lib.c/#L131
d2a_code_trace_data_45608
void ssl3_cbc_digest_record( const EVP_MD_CTX *ctx, unsigned char* md_out, size_t* md_out_size, const unsigned char header[13], const unsigned char *data, size_t data_plus_mac_size, size_t data_plus_mac_plus_padding_size, const unsigned char *mac_secret, unsigned mac_secret_length, char is_sslv3) { union { double align; unsigned char c[sizeof(LARGEST_DIGEST_CTX)]; } md_state; void (*md_final_raw)(void *ctx, unsigned char *md_out); void (*md_transform)(void *ctx, const unsigned char *block); unsigned md_size, md_block_size = 64; unsigned sslv3_pad_length = 40, header_length, variance_blocks, len, max_mac_bytes, num_blocks, num_starting_blocks, k, mac_end_offset, c, index_a, index_b; unsigned int bits; unsigned char length_bytes[MAX_HASH_BIT_COUNT_BYTES]; unsigned char hmac_pad[MAX_HASH_BLOCK_SIZE]; unsigned char first_block[MAX_HASH_BLOCK_SIZE]; unsigned char mac_out[EVP_MAX_MD_SIZE]; unsigned i, j, md_out_size_u; EVP_MD_CTX md_ctx; unsigned md_length_size = 8; char length_is_big_endian = 1; OPENSSL_assert(data_plus_mac_plus_padding_size < 1024*1024); switch (EVP_MD_CTX_type(ctx)) { case NID_md5: MD5_Init((MD5_CTX*)md_state.c); md_final_raw = tls1_md5_final_raw; md_transform = (void(*)(void *ctx, const unsigned char *block)) MD5_Transform; md_size = 16; sslv3_pad_length = 48; length_is_big_endian = 0; break; case NID_sha1: SHA1_Init((SHA_CTX*)md_state.c); md_final_raw = tls1_sha1_final_raw; md_transform = (void(*)(void *ctx, const unsigned char *block)) SHA1_Transform; md_size = 20; break; #ifndef OPENSSL_NO_SHA256 case NID_sha224: SHA224_Init((SHA256_CTX*)md_state.c); md_final_raw = tls1_sha256_final_raw; md_transform = (void(*)(void *ctx, const unsigned char *block)) SHA256_Transform; md_size = 224/8; break; case NID_sha256: SHA256_Init((SHA256_CTX*)md_state.c); md_final_raw = tls1_sha256_final_raw; md_transform = (void(*)(void *ctx, const unsigned char *block)) SHA256_Transform; md_size = 32; break; #endif #ifndef OPENSSL_NO_SHA512 case NID_sha384: SHA384_Init((SHA512_CTX*)md_state.c); md_final_raw = tls1_sha512_final_raw; md_transform = (void(*)(void *ctx, const unsigned char *block)) SHA512_Transform; md_size = 384/8; md_block_size = 128; md_length_size = 16; break; case NID_sha512: SHA512_Init((SHA512_CTX*)md_state.c); md_final_raw = tls1_sha512_final_raw; md_transform = (void(*)(void *ctx, const unsigned char *block)) SHA512_Transform; md_size = 64; md_block_size = 128; md_length_size = 16; break; #endif default: OPENSSL_assert(0); if (md_out_size) *md_out_size = -1; return; } OPENSSL_assert(md_length_size <= MAX_HASH_BIT_COUNT_BYTES); OPENSSL_assert(md_block_size <= MAX_HASH_BLOCK_SIZE); OPENSSL_assert(md_size <= EVP_MAX_MD_SIZE); header_length = 13; if (is_sslv3) { header_length = mac_secret_length + sslv3_pad_length + 8 + 1 + 2 ; } variance_blocks = is_sslv3 ? 2 : 6; len = data_plus_mac_plus_padding_size + header_length; max_mac_bytes = len - md_size - 1; num_blocks = (max_mac_bytes + 1 + md_length_size + md_block_size - 1) / md_block_size; num_starting_blocks = 0; k = 0; mac_end_offset = data_plus_mac_size + header_length - md_size; c = mac_end_offset % md_block_size; index_a = mac_end_offset / md_block_size; index_b = (mac_end_offset + md_length_size) / md_block_size; if (num_blocks > variance_blocks + (is_sslv3 ? 1 : 0)) { num_starting_blocks = num_blocks - variance_blocks; k = md_block_size*num_starting_blocks; } bits = 8*mac_end_offset; if (!is_sslv3) { bits += 8*md_block_size; memset(hmac_pad, 0, md_block_size); OPENSSL_assert(mac_secret_length <= sizeof(hmac_pad)); memcpy(hmac_pad, mac_secret, mac_secret_length); for (i = 0; i < md_block_size; i++) hmac_pad[i] ^= 0x36; md_transform(md_state.c, hmac_pad); } if (length_is_big_endian) { memset(length_bytes,0,md_length_size-4); length_bytes[md_length_size-4] = (unsigned char)(bits>>24); length_bytes[md_length_size-3] = (unsigned char)(bits>>16); length_bytes[md_length_size-2] = (unsigned char)(bits>>8); length_bytes[md_length_size-1] = (unsigned char)bits; } else { memset(length_bytes,0,md_length_size); length_bytes[md_length_size-5] = (unsigned char)(bits>>24); length_bytes[md_length_size-6] = (unsigned char)(bits>>16); length_bytes[md_length_size-7] = (unsigned char)(bits>>8); length_bytes[md_length_size-8] = (unsigned char)bits; } if (k > 0) { if (is_sslv3) { unsigned overhang = header_length-md_block_size; md_transform(md_state.c, header); memcpy(first_block, header + md_block_size, overhang); memcpy(first_block + overhang, data, md_block_size-overhang); md_transform(md_state.c, first_block); for (i = 1; i < k/md_block_size - 1; i++) md_transform(md_state.c, data + md_block_size*i - overhang); } else { memcpy(first_block, header, 13); memcpy(first_block+13, data, md_block_size-13); md_transform(md_state.c, first_block); for (i = 1; i < k/md_block_size; i++) md_transform(md_state.c, data + md_block_size*i - 13); } } memset(mac_out, 0, sizeof(mac_out)); for (i = num_starting_blocks; i <= num_starting_blocks+variance_blocks; i++) { unsigned char block[MAX_HASH_BLOCK_SIZE]; unsigned char is_block_a = constant_time_eq_8(i, index_a); unsigned char is_block_b = constant_time_eq_8(i, index_b); for (j = 0; j < md_block_size; j++) { unsigned char b = 0, is_past_c, is_past_cp1; if (k < header_length) b = header[k]; else if (k < data_plus_mac_plus_padding_size + header_length) b = data[k-header_length]; k++; is_past_c = is_block_a & constant_time_ge(j, c); is_past_cp1 = is_block_a & constant_time_ge(j, c+1); b = (b&~is_past_c) | (0x80&is_past_c); b = b&~is_past_cp1; b &= ~is_block_b | is_block_a; if (j >= md_block_size - md_length_size) { b = (b&~is_block_b) | (is_block_b&length_bytes[j-(md_block_size-md_length_size)]); } block[j] = b; } md_transform(md_state.c, block); md_final_raw(md_state.c, block); for (j = 0; j < md_size; j++) mac_out[j] |= block[j]&is_block_b; } EVP_MD_CTX_init(&md_ctx); EVP_DigestInit_ex(&md_ctx, ctx->digest, NULL ); if (is_sslv3) { memset(hmac_pad, 0x5c, sslv3_pad_length); EVP_DigestUpdate(&md_ctx, mac_secret, mac_secret_length); EVP_DigestUpdate(&md_ctx, hmac_pad, sslv3_pad_length); EVP_DigestUpdate(&md_ctx, mac_out, md_size); } else { for (i = 0; i < md_block_size; i++) hmac_pad[i] ^= 0x6a; EVP_DigestUpdate(&md_ctx, hmac_pad, md_block_size); EVP_DigestUpdate(&md_ctx, mac_out, md_size); } EVP_DigestFinal(&md_ctx, md_out, &md_out_size_u); if (md_out_size) *md_out_size = md_out_size_u; EVP_MD_CTX_cleanup(&md_ctx); } ssl/t1_enc.c:1037: error: INTEGER_OVERFLOW_L2 ([13, +oo] - [16, 64]):unsigned32 by call to `ssl3_cbc_digest_record`. Showing all 8 steps of the trace ssl/t1_enc.c:971:1: Parameter `ssl->s3->read_mac_secret_size` 969. } 970. 971. > int tls1_mac(SSL *ssl, unsigned char *md, int send) 972. { 973. SSL3_RECORD *rec; ssl/t1_enc.c:1037:3: Call 1035. * data we are hashing because that gives an attacker a 1036. * timing-oracle. */ 1037. ssl3_cbc_digest_record( ^ 1038. mac_ctx, 1039. md, &md_size, ssl/s3_cbc.c:433:1: <LHS trace> 431. * a padding byte and MAC. (If the padding was invalid, it might contain the 432. * padding too. ) */ 433. > void ssl3_cbc_digest_record( 434. const EVP_MD_CTX *ctx, 435. unsigned char* md_out, ssl/s3_cbc.c:433:1: Parameter `data_plus_mac_plus_padding_size` 431. * a padding byte and MAC. (If the padding was invalid, it might contain the 432. * padding too. ) */ 433. > void ssl3_cbc_digest_record( 434. const EVP_MD_CTX *ctx, 435. unsigned char* md_out, ssl/s3_cbc.c:563:2: Assignment 561. * bytes of `header' before the start of the data (TLS) or 71/75 bytes 562. * (SSLv3) */ 563. len = data_plus_mac_plus_padding_size + header_length; ^ 564. /* max_mac_bytes contains the maximum bytes of bytes in the MAC, including 565. * |header|, assuming that there's no padding. */ ssl/s3_cbc.c:476:4: <RHS trace> 474. md_final_raw = tls1_md5_final_raw; 475. md_transform = (void(*)(void *ctx, const unsigned char *block)) MD5_Transform; 476. md_size = 16; ^ 477. sslv3_pad_length = 48; 478. length_is_big_endian = 0; ssl/s3_cbc.c:476:4: Assignment 474. md_final_raw = tls1_md5_final_raw; 475. md_transform = (void(*)(void *ctx, const unsigned char *block)) MD5_Transform; 476. md_size = 16; ^ 477. sslv3_pad_length = 48; 478. length_is_big_endian = 0; ssl/s3_cbc.c:566:2: Binary operation: ([13, +oo] - [16, 64]):unsigned32 by call to `ssl3_cbc_digest_record` 564. /* max_mac_bytes contains the maximum bytes of bytes in the MAC, including 565. * |header|, assuming that there's no padding. */ 566. max_mac_bytes = len - md_size - 1; ^ 567. /* num_blocks is the maximum number of hash blocks. */ 568. num_blocks = (max_mac_bytes + 1 + md_length_size + md_block_size - 1) / md_block_size;
https://github.com/openssl/openssl/blob/f93a41877d8d7a287debb7c63d7b646abaaf269c/ssl/s3_cbc.c/#L566
d2a_code_trace_data_45609
static int cert_status_cb(SSL *s, void *arg) { tlsextstatusctx *srctx = arg; BIO *err = srctx->err; char *host, *port, *path; int use_ssl; unsigned char *rspder = NULL; int rspderlen; STACK_OF(OPENSSL_STRING) *aia = NULL; X509 *x = NULL; X509_STORE_CTX inctx; X509_OBJECT obj; OCSP_REQUEST *req = NULL; OCSP_RESPONSE *resp = NULL; OCSP_CERTID *id = NULL; STACK_OF(X509_EXTENSION) *exts; int ret = SSL_TLSEXT_ERR_NOACK; int i; #if 0 STACK_OF(OCSP_RESPID) *ids; SSL_get_tlsext_status_ids(s, &ids); BIO_printf(err, "cert_status: received %d ids\n", sk_OCSP_RESPID_num(ids)); #endif if (srctx->verbose) BIO_puts(err, "cert_status: callback called\n"); x = SSL_get_certificate(s); aia = X509_get1_ocsp(x); if (aia) { if (!OCSP_parse_url(sk_OPENSSL_STRING_value(aia, 0), &host, &port, &path, &use_ssl)) { BIO_puts(err, "cert_status: can't parse AIA URL\n"); goto err; } if (srctx->verbose) BIO_printf(err, "cert_status: AIA URL: %s\n", sk_OPENSSL_STRING_value(aia, 0)); } else { if (!srctx->host) { BIO_puts(srctx->err, "cert_status: no AIA and no default responder URL\n"); goto done; } host = srctx->host; path = srctx->path; port = srctx->port; use_ssl = srctx->use_ssl; } if (!X509_STORE_CTX_init(&inctx, SSL_CTX_get_cert_store(SSL_get_SSL_CTX(s)), NULL, NULL)) goto err; if (X509_STORE_get_by_subject(&inctx,X509_LU_X509, X509_get_issuer_name(x),&obj) <= 0) { BIO_puts(err, "cert_status: Can't retrieve issuer certificate.\n"); X509_STORE_CTX_cleanup(&inctx); goto done; } req = OCSP_REQUEST_new(); if (!req) goto err; id = OCSP_cert_to_id(NULL, x, obj.data.x509); X509_free(obj.data.x509); X509_STORE_CTX_cleanup(&inctx); if (!id) goto err; if (!OCSP_request_add0_id(req, id)) goto err; id = NULL; SSL_get_tlsext_status_exts(s, &exts); for (i = 0; i < sk_X509_EXTENSION_num(exts); i++) { X509_EXTENSION *ext = sk_X509_EXTENSION_value(exts, i); if (!OCSP_REQUEST_add_ext(req, ext, -1)) goto err; } resp = process_responder(err, req, host, path, port, use_ssl, NULL, srctx->timeout); if (!resp) { BIO_puts(err, "cert_status: error querying responder\n"); goto done; } rspderlen = i2d_OCSP_RESPONSE(resp, &rspder); if (rspderlen <= 0) goto err; SSL_set_tlsext_status_ocsp_resp(s, rspder, rspderlen); if (srctx->verbose) { BIO_puts(err, "cert_status: ocsp response sent:\n"); OCSP_RESPONSE_print(err, resp, 2); } ret = SSL_TLSEXT_ERR_OK; done: if (ret != SSL_TLSEXT_ERR_OK) ERR_print_errors(err); if (aia) { OPENSSL_free(host); OPENSSL_free(path); OPENSSL_free(port); X509_email_free(aia); } if (id) OCSP_CERTID_free(id); if (req) OCSP_REQUEST_free(req); if (resp) OCSP_RESPONSE_free(resp); return ret; err: ret = SSL_TLSEXT_ERR_ALERT_FATAL; goto done; } apps/s_server.c:823: error: NULL_DEREFERENCE pointer `x` last assigned on line 822 could be null and is dereferenced by call to `X509_get1_ocsp()` at line 823, column 8. Showing all 31 steps of the trace apps/s_server.c:796:1: start of procedure cert_status_cb() 794. */ 795. 796. > static int cert_status_cb(SSL *s, void *arg) 797. { 798. tlsextstatusctx *srctx = arg; apps/s_server.c:798:2: 796. static int cert_status_cb(SSL *s, void *arg) 797. { 798. > tlsextstatusctx *srctx = arg; 799. BIO *err = srctx->err; 800. char *host, *port, *path; apps/s_server.c:799:2: 797. { 798. tlsextstatusctx *srctx = arg; 799. > BIO *err = srctx->err; 800. char *host, *port, *path; 801. int use_ssl; apps/s_server.c:802:2: 800. char *host, *port, *path; 801. int use_ssl; 802. > unsigned char *rspder = NULL; 803. int rspderlen; 804. STACK_OF(OPENSSL_STRING) *aia = NULL; apps/s_server.c:804:2: 802. unsigned char *rspder = NULL; 803. int rspderlen; 804. > STACK_OF(OPENSSL_STRING) *aia = NULL; 805. X509 *x = NULL; 806. X509_STORE_CTX inctx; apps/s_server.c:805:2: 803. int rspderlen; 804. STACK_OF(OPENSSL_STRING) *aia = NULL; 805. > X509 *x = NULL; 806. X509_STORE_CTX inctx; 807. X509_OBJECT obj; apps/s_server.c:808:2: 806. X509_STORE_CTX inctx; 807. X509_OBJECT obj; 808. > OCSP_REQUEST *req = NULL; 809. OCSP_RESPONSE *resp = NULL; 810. OCSP_CERTID *id = NULL; apps/s_server.c:809:2: 807. X509_OBJECT obj; 808. OCSP_REQUEST *req = NULL; 809. > OCSP_RESPONSE *resp = NULL; 810. OCSP_CERTID *id = NULL; 811. STACK_OF(X509_EXTENSION) *exts; apps/s_server.c:810:2: 808. OCSP_REQUEST *req = NULL; 809. OCSP_RESPONSE *resp = NULL; 810. > OCSP_CERTID *id = NULL; 811. STACK_OF(X509_EXTENSION) *exts; 812. int ret = SSL_TLSEXT_ERR_NOACK; apps/s_server.c:812:2: 810. OCSP_CERTID *id = NULL; 811. STACK_OF(X509_EXTENSION) *exts; 812. > int ret = SSL_TLSEXT_ERR_NOACK; 813. int i; 814. #if 0 apps/s_server.c:819:6: Taking true branch 817. BIO_printf(err, "cert_status: received %d ids\n", sk_OCSP_RESPID_num(ids)); 818. #endif 819. if (srctx->verbose) ^ 820. BIO_puts(err, "cert_status: callback called\n"); 821. /* Build up OCSP query from server certificate */ apps/s_server.c:820:3: 818. #endif 819. if (srctx->verbose) 820. > BIO_puts(err, "cert_status: callback called\n"); 821. /* Build up OCSP query from server certificate */ 822. x = SSL_get_certificate(s); crypto/bio/bio_lib.c:257:1: start of procedure BIO_puts() 255. } 256. 257. > int BIO_puts(BIO *b, const char *in) 258. { 259. int i; crypto/bio/bio_lib.c:262:7: Taking false branch 260. long (*cb)(BIO *,int,const char *,int,long,long); 261. 262. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) ^ 263. { 264. BIOerr(BIO_F_BIO_PUTS,BIO_R_UNSUPPORTED_METHOD); crypto/bio/bio_lib.c:262:22: Taking false branch 260. long (*cb)(BIO *,int,const char *,int,long,long); 261. 262. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) ^ 263. { 264. BIOerr(BIO_F_BIO_PUTS,BIO_R_UNSUPPORTED_METHOD); crypto/bio/bio_lib.c:262:45: Taking false branch 260. long (*cb)(BIO *,int,const char *,int,long,long); 261. 262. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) ^ 263. { 264. BIOerr(BIO_F_BIO_PUTS,BIO_R_UNSUPPORTED_METHOD); crypto/bio/bio_lib.c:268:2: 266. } 267. 268. > cb=b->callback; 269. 270. if ((cb != NULL) && crypto/bio/bio_lib.c:270:7: Taking false branch 268. cb=b->callback; 269. 270. if ((cb != NULL) && ^ 271. ((i=(int)cb(b,BIO_CB_PUTS,in,0,0L,1L)) <= 0)) 272. return(i); crypto/bio/bio_lib.c:274:7: Taking false branch 272. return(i); 273. 274. if (!b->init) ^ 275. { 276. BIOerr(BIO_F_BIO_PUTS,BIO_R_UNINITIALIZED); crypto/bio/bio_lib.c:280:2: Skipping __function_pointer__(): unresolved function pointer 278. } 279. 280. i=b->method->bputs(b,in); ^ 281. 282. if (i > 0) b->num_write+=(unsigned long)i; crypto/bio/bio_lib.c:282:6: Taking true branch 280. i=b->method->bputs(b,in); 281. 282. if (i > 0) b->num_write+=(unsigned long)i; ^ 283. 284. if (cb != NULL) crypto/bio/bio_lib.c:282:13: 280. i=b->method->bputs(b,in); 281. 282. > if (i > 0) b->num_write+=(unsigned long)i; 283. 284. if (cb != NULL) crypto/bio/bio_lib.c:284:6: Taking false branch 282. if (i > 0) b->num_write+=(unsigned long)i; 283. 284. if (cb != NULL) ^ 285. i=(int)cb(b,BIO_CB_PUTS|BIO_CB_RETURN,in,0, 286. 0L,(long)i); crypto/bio/bio_lib.c:287:2: 285. i=(int)cb(b,BIO_CB_PUTS|BIO_CB_RETURN,in,0, 286. 0L,(long)i); 287. > return(i); 288. } 289. crypto/bio/bio_lib.c:288:2: return from a call to BIO_puts 286. 0L,(long)i); 287. return(i); 288. } ^ 289. 290. int BIO_gets(BIO *b, char *in, int inl) apps/s_server.c:822:2: 820. BIO_puts(err, "cert_status: callback called\n"); 821. /* Build up OCSP query from server certificate */ 822. > x = SSL_get_certificate(s); 823. aia = X509_get1_ocsp(x); 824. if (aia) ssl/ssl_lib.c:2879:1: start of procedure SSL_get_certificate() 2877. 2878. /* Fix this function so that it takes an optional type parameter */ 2879. > X509 *SSL_get_certificate(const SSL *s) 2880. { 2881. if (s->cert != NULL) ssl/ssl_lib.c:2881:6: Taking false branch 2879. X509 *SSL_get_certificate(const SSL *s) 2880. { 2881. if (s->cert != NULL) ^ 2882. return(s->cert->key->x509); 2883. else ssl/ssl_lib.c:2884:3: 2882. return(s->cert->key->x509); 2883. else 2884. > return(NULL); 2885. } 2886. ssl/ssl_lib.c:2885:2: return from a call to SSL_get_certificate 2883. else 2884. return(NULL); 2885. } ^ 2886. 2887. /* Fix this function so that it takes an optional type parameter */ apps/s_server.c:823:2: 821. /* Build up OCSP query from server certificate */ 822. x = SSL_get_certificate(s); 823. > aia = X509_get1_ocsp(x); 824. if (aia) 825. {
https://github.com/openssl/openssl/blob/360ef6769e97f2918ae67a2909951eb8612043ee/apps/s_server.c/#L823
d2a_code_trace_data_45610
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { if (!ossl_assert(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_clnt.c:449: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 4]):unsigned64 by call to `WPACKET_put_bytes__`. Showing all 12 steps of the trace ssl/statem/extensions_clnt.c:448:10: Call 446. X509 *x, size_t chainidx, int *al) 447. { 448. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_extended_master_secret) ^ 449. || !WPACKET_put_bytes_u16(pkt, 0)) { 450. SSLerr(SSL_F_TLS_CONSTRUCT_CTOS_EMS, ERR_R_INTERNAL_ERROR); ssl/packet.c:306:1: Parameter `pkt->buf->length` 304. } 305. 306. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 307. { 308. unsigned char *data; ssl/statem/extensions_clnt.c:449:17: Call 447. { 448. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_extended_master_secret) 449. || !WPACKET_put_bytes_u16(pkt, 0)) { ^ 450. SSLerr(SSL_F_TLS_CONSTRUCT_CTOS_EMS, ERR_R_INTERNAL_ERROR); 451. return EXT_RETURN_FAIL; ssl/packet.c:306:1: Parameter `pkt->written` 304. } 305. 306. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 307. { 308. unsigned char *data; ssl/packet.c:312:17: Call 310. /* Internal API, so should not fail */ 311. if (!ossl_assert(size <= sizeof(unsigned int)) 312. || !WPACKET_allocate_bytes(pkt, size, &data) ^ 313. || !put_value(data, val, size)) 314. 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: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:48:36: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 4]):unsigned64 by call to `WPACKET_put_bytes__` 46. return 0; 47. 48. if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) { ^ 49. size_t newlen; 50. size_t reflen;
https://github.com/openssl/openssl/blob/7f7eb90b8ac55997c5c825bb3ebcfe28611e06f5/ssl/packet.c/#L48
d2a_code_trace_data_45611
static inline uint64_t get_val(BitstreamContext *bc, unsigned n) { #ifdef BITSTREAM_READER_LE uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1); bc->bits >>= n; #else uint64_t ret = bc->bits >> (64 - n); bc->bits <<= n; #endif bc->bits_left -= n; return ret; } libavcodec/takdec.c:259: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `bitstream_read_bit`. libavcodec/takdec.c:258:17: Call 256. 257. for (i = 0; i < len; i++) { 258. int x = bitstream_read(bc, code.init); ^ 259. if (x >= code.escape && bitstream_read_bit(bc)) { 260. x |= 1 << code.init; libavcodec/bitstream.h:183:1: Parameter `bc->bits_left` 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/takdec.c:259:33: Call 257. for (i = 0; i < len; i++) { 258. int x = bitstream_read(bc, code.init); 259. if (x >= code.escape && bitstream_read_bit(bc)) { ^ 260. x |= 1 << code.init; 261. if (x >= code.aescape) { 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: <LHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `bc->bits_left` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: <RHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE 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: Binary operation: ([0, +oo] - 1):unsigned32 by call to `bitstream_read_bit` 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret;
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L139
d2a_code_trace_data_45612
static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, AVStream *st, AVPacket * pkt, uint32_t * timestamp, const uint8_t * buf, int len, int flags) { uint8_t nal = buf[0]; uint8_t type = (nal & 0x1f); int result= 0; uint8_t start_sequence[]= {0, 0, 1}; #ifdef DEBUG assert(data); assert(data->cookie == MAGIC_COOKIE); #endif assert(buf); if (type >= 1 && type <= 23) type = 1; switch (type) { case 0: case 1: av_new_packet(pkt, len+sizeof(start_sequence)); memcpy(pkt->data, start_sequence, sizeof(start_sequence)); memcpy(pkt->data+sizeof(start_sequence), buf, len); #ifdef DEBUG data->packet_types_received[nal & 0x1f]++; #endif break; case 24: buf++; len--; { int pass= 0; int total_length= 0; uint8_t *dst= NULL; for(pass= 0; pass<2; pass++) { const uint8_t *src= buf; int src_len= len; do { uint16_t nal_size = AV_RB16(src); src += 2; src_len -= 2; if (nal_size <= src_len) { if(pass==0) { total_length+= sizeof(start_sequence)+nal_size; } else { assert(dst); memcpy(dst, start_sequence, sizeof(start_sequence)); dst+= sizeof(start_sequence); memcpy(dst, src, nal_size); #ifdef DEBUG data->packet_types_received[*src & 0x1f]++; #endif dst+= nal_size; } } else { av_log(ctx, AV_LOG_ERROR, "nal size exceeds length: %d %d\n", nal_size, src_len); } src += nal_size; src_len -= nal_size; if (src_len < 0) av_log(ctx, AV_LOG_ERROR, "Consumed more bytes than we got! (%d)\n", src_len); } while (src_len > 2); if(pass==0) { av_new_packet(pkt, total_length); dst= pkt->data; } else { assert(dst-pkt->data==total_length); } } } break; case 25: case 26: case 27: case 29: av_log(ctx, AV_LOG_ERROR, "Unhandled type (%d) (See RFC for implementation details\n", type); result= -1; break; case 28: buf++; len--; { uint8_t fu_indicator = nal; uint8_t fu_header = *buf; uint8_t start_bit = fu_header >> 7; uint8_t nal_type = (fu_header & 0x1f); uint8_t reconstructed_nal; reconstructed_nal = fu_indicator & (0xe0); reconstructed_nal |= nal_type; buf++; len--; #ifdef DEBUG if (start_bit) data->packet_types_received[nal_type]++; #endif if(start_bit) { av_new_packet(pkt, sizeof(start_sequence)+sizeof(nal)+len); memcpy(pkt->data, start_sequence, sizeof(start_sequence)); pkt->data[sizeof(start_sequence)]= reconstructed_nal; memcpy(pkt->data+sizeof(start_sequence)+sizeof(nal), buf, len); } else { av_new_packet(pkt, len); memcpy(pkt->data, buf, len); } } break; case 30: case 31: default: av_log(ctx, AV_LOG_ERROR, "Undefined type (%d)", type); result= -1; break; } pkt->stream_index = st->index; return result; } libavformat/rtpdec_h264.c:193: error: Null Dereference pointer `pkt->data` last assigned on line 192 could be null and is dereferenced by call to `memcpy()` at line 193, column 9. libavformat/rtpdec_h264.c:168:1: start of procedure h264_handle_packet() 166. 167. // return 0 on packet, no more left, 1 on packet, 1 on partial packet... 168. static int h264_handle_packet(AVFormatContext *ctx, ^ 169. PayloadContext *data, 170. AVStream *st, libavformat/rtpdec_h264.c:176:5: 174. int len, int flags) 175. { 176. uint8_t nal = buf[0]; ^ 177. uint8_t type = (nal & 0x1f); 178. int result= 0; libavformat/rtpdec_h264.c:177:5: 175. { 176. uint8_t nal = buf[0]; 177. uint8_t type = (nal & 0x1f); ^ 178. int result= 0; 179. uint8_t start_sequence[]= {0, 0, 1}; libavformat/rtpdec_h264.c:178:5: 176. uint8_t nal = buf[0]; 177. uint8_t type = (nal & 0x1f); 178. int result= 0; ^ 179. uint8_t start_sequence[]= {0, 0, 1}; 180. libavformat/rtpdec_h264.c:179:5: 177. uint8_t type = (nal & 0x1f); 178. int result= 0; 179. uint8_t start_sequence[]= {0, 0, 1}; ^ 180. 181. #ifdef DEBUG libavformat/rtpdec_h264.c:185:5: 183. assert(data->cookie == MAGIC_COOKIE); 184. #endif 185. assert(buf); ^ 186. 187. if (type >= 1 && type <= 23) libavformat/rtpdec_h264.c:187:9: Taking true branch 185. assert(buf); 186. 187. if (type >= 1 && type <= 23) ^ 188. type = 1; // simplify the case. (these are all the nal types used internally by the h264 codec) 189. switch (type) { libavformat/rtpdec_h264.c:187:22: Taking true branch 185. assert(buf); 186. 187. if (type >= 1 && type <= 23) ^ 188. type = 1; // simplify the case. (these are all the nal types used internally by the h264 codec) 189. switch (type) { libavformat/rtpdec_h264.c:188:9: 186. 187. if (type >= 1 && type <= 23) 188. type = 1; // simplify the case. (these are all the nal types used internally by the h264 codec) ^ 189. switch (type) { 190. case 0: // undefined, but pass them through libavformat/rtpdec_h264.c:189:5: 187. if (type >= 1 && type <= 23) 188. type = 1; // simplify the case. (these are all the nal types used internally by the h264 codec) 189. switch (type) { ^ 190. case 0: // undefined, but pass them through 191. case 1: libavformat/rtpdec_h264.c:190:5: Switch condition is false. Skipping switch case 188. type = 1; // simplify the case. (these are all the nal types used internally by the h264 codec) 189. switch (type) { 190. case 0: // undefined, but pass them through ^ 191. case 1: 192. av_new_packet(pkt, len+sizeof(start_sequence)); libavformat/rtpdec_h264.c:191:5: Switch condition is true. Entering switch case 189. switch (type) { 190. case 0: // undefined, but pass them through 191. case 1: ^ 192. av_new_packet(pkt, len+sizeof(start_sequence)); 193. memcpy(pkt->data, start_sequence, sizeof(start_sequence)); libavformat/rtpdec_h264.c:192:9: 190. case 0: // undefined, but pass them through 191. case 1: 192. av_new_packet(pkt, len+sizeof(start_sequence)); ^ 193. memcpy(pkt->data, start_sequence, sizeof(start_sequence)); 194. memcpy(pkt->data+sizeof(start_sequence), buf, len); libavcodec/avpacket.c:49:1: start of procedure av_new_packet() 47. } 48. 49. int av_new_packet(AVPacket *pkt, int size) ^ 50. { 51. uint8_t *data= NULL; libavcodec/avpacket.c:51:5: 49. int av_new_packet(AVPacket *pkt, int size) 50. { 51. uint8_t *data= NULL; ^ 52. if((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) 53. data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); libavcodec/avpacket.c:52:8: Taking true branch 50. { 51. uint8_t *data= NULL; 52. if((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) ^ 53. data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); 54. if (data){ libavcodec/avpacket.c:53:9: 51. uint8_t *data= NULL; 52. if((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) 53. data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); ^ 54. if (data){ 55. memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); 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 true branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-16) ) ^ 73. return NULL; 74. libavutil/mem.c:73:9: 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-16) ) 73. return NULL; ^ 74. 75. #if CONFIG_MEMALIGN_HACK 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/avpacket.c:54:9: Taking false branch 52. if((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) 53. data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); 54. if (data){ ^ 55. memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); 56. }else libavcodec/avpacket.c:57:9: 55. memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); 56. }else 57. size=0; ^ 58. 59. av_init_packet(pkt); libavcodec/avpacket.c:59:5: 57. size=0; 58. 59. av_init_packet(pkt); ^ 60. pkt->data = data; 61. pkt->size = size; libavcodec/avpacket.c:37:1: start of procedure av_init_packet() 35. } 36. 37. void av_init_packet(AVPacket *pkt) ^ 38. { 39. pkt->pts = AV_NOPTS_VALUE; libavcodec/avpacket.c:39:5: 37. void av_init_packet(AVPacket *pkt) 38. { 39. pkt->pts = AV_NOPTS_VALUE; ^ 40. pkt->dts = AV_NOPTS_VALUE; 41. pkt->pos = -1; libavcodec/avpacket.c:40:5: 38. { 39. pkt->pts = AV_NOPTS_VALUE; 40. pkt->dts = AV_NOPTS_VALUE; ^ 41. pkt->pos = -1; 42. pkt->duration = 0; libavcodec/avpacket.c:41:5: 39. pkt->pts = AV_NOPTS_VALUE; 40. pkt->dts = AV_NOPTS_VALUE; 41. pkt->pos = -1; ^ 42. pkt->duration = 0; 43. pkt->convergence_duration = 0; libavcodec/avpacket.c:42:5: 40. pkt->dts = AV_NOPTS_VALUE; 41. pkt->pos = -1; 42. pkt->duration = 0; ^ 43. pkt->convergence_duration = 0; 44. pkt->flags = 0; libavcodec/avpacket.c:43:5: 41. pkt->pos = -1; 42. pkt->duration = 0; 43. pkt->convergence_duration = 0; ^ 44. pkt->flags = 0; 45. pkt->stream_index = 0; libavcodec/avpacket.c:44:5: 42. pkt->duration = 0; 43. pkt->convergence_duration = 0; 44. pkt->flags = 0; ^ 45. pkt->stream_index = 0; 46. pkt->destruct= NULL; libavcodec/avpacket.c:45:5: 43. pkt->convergence_duration = 0; 44. pkt->flags = 0; 45. pkt->stream_index = 0; ^ 46. pkt->destruct= NULL; 47. } libavcodec/avpacket.c:46:5: 44. pkt->flags = 0; 45. pkt->stream_index = 0; 46. pkt->destruct= NULL; ^ 47. } 48. libavcodec/avpacket.c:47:1: return from a call to av_init_packet 45. pkt->stream_index = 0; 46. pkt->destruct= NULL; 47. } ^ 48. 49. int av_new_packet(AVPacket *pkt, int size) libavcodec/avpacket.c:60:5: 58. 59. av_init_packet(pkt); 60. pkt->data = data; ^ 61. pkt->size = size; 62. pkt->destruct = av_destruct_packet; libavcodec/avpacket.c:61:5: 59. av_init_packet(pkt); 60. pkt->data = data; 61. pkt->size = size; ^ 62. pkt->destruct = av_destruct_packet; 63. if(!data) libavcodec/avpacket.c:62:5: 60. pkt->data = data; 61. pkt->size = size; 62. pkt->destruct = av_destruct_packet; ^ 63. if(!data) 64. return AVERROR(ENOMEM); libavcodec/avpacket.c:63:9: Taking true branch 61. pkt->size = size; 62. pkt->destruct = av_destruct_packet; 63. if(!data) ^ 64. return AVERROR(ENOMEM); 65. return 0; libavcodec/avpacket.c:64:9: 62. pkt->destruct = av_destruct_packet; 63. if(!data) 64. return AVERROR(ENOMEM); ^ 65. return 0; 66. } libavcodec/avpacket.c:66:1: return from a call to av_new_packet 64. return AVERROR(ENOMEM); 65. return 0; 66. } ^ 67. 68. void av_shrink_packet(AVPacket *pkt, int size) libavformat/rtpdec_h264.c:193:9: 191. case 1: 192. av_new_packet(pkt, len+sizeof(start_sequence)); 193. memcpy(pkt->data, start_sequence, sizeof(start_sequence)); ^ 194. memcpy(pkt->data+sizeof(start_sequence), buf, len); 195. #ifdef DEBUG
https://github.com/libav/libav/blob/3cf8db9447a6c77550033acea84e30be2af7ad2c/libavformat/rtpdec_h264.c/#L193
d2a_code_trace_data_45613
static inline void pred_direct_motion(H264Context * const h, int *mb_type){ MpegEncContext * const s = &h->s; const int mb_xy = s->mb_x + s->mb_y*s->mb_stride; const int b8_xy = 2*s->mb_x + 2*s->mb_y*h->b8_stride; const int b4_xy = 4*s->mb_x + 4*s->mb_y*h->b_stride; const int mb_type_col = h->ref_list[1][0].mb_type[mb_xy]; const int16_t (*l1mv0)[2] = (const int16_t (*)[2]) &h->ref_list[1][0].motion_val[0][b4_xy]; const int16_t (*l1mv1)[2] = (const int16_t (*)[2]) &h->ref_list[1][0].motion_val[1][b4_xy]; const int8_t *l1ref0 = &h->ref_list[1][0].ref_index[0][b8_xy]; const int8_t *l1ref1 = &h->ref_list[1][0].ref_index[1][b8_xy]; const int is_b8x8 = IS_8X8(*mb_type); unsigned int sub_mb_type; int i8, i4; #define MB_TYPE_16x16_OR_INTRA (MB_TYPE_16x16|MB_TYPE_INTRA4x4|MB_TYPE_INTRA16x16|MB_TYPE_INTRA_PCM) if(IS_8X8(mb_type_col) && !h->sps.direct_8x8_inference_flag){ sub_mb_type = MB_TYPE_8x8|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; *mb_type = MB_TYPE_8x8|MB_TYPE_L0L1; }else if(!is_b8x8 && (mb_type_col & MB_TYPE_16x16_OR_INTRA)){ sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; *mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; }else{ sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; *mb_type = MB_TYPE_8x8|MB_TYPE_L0L1; } if(!is_b8x8) *mb_type |= MB_TYPE_DIRECT2; if(MB_FIELD) *mb_type |= MB_TYPE_INTERLACED; tprintf(s->avctx, "mb_type = %08x, sub_mb_type = %08x, is_b8x8 = %d, mb_type_col = %08x\n", *mb_type, sub_mb_type, is_b8x8, mb_type_col); if(h->direct_spatial_mv_pred){ int ref[2]; int mv[2][2]; int list; for(list=0; list<2; list++){ int refa = h->ref_cache[list][scan8[0] - 1]; int refb = h->ref_cache[list][scan8[0] - 8]; int refc = h->ref_cache[list][scan8[0] - 8 + 4]; if(refc == -2) refc = h->ref_cache[list][scan8[0] - 8 - 1]; ref[list] = refa; if(ref[list] < 0 || (refb < ref[list] && refb >= 0)) ref[list] = refb; if(ref[list] < 0 || (refc < ref[list] && refc >= 0)) ref[list] = refc; if(ref[list] < 0) ref[list] = -1; } if(ref[0] < 0 && ref[1] < 0){ ref[0] = ref[1] = 0; mv[0][0] = mv[0][1] = mv[1][0] = mv[1][1] = 0; }else{ for(list=0; list<2; list++){ if(ref[list] >= 0) pred_motion(h, 0, 4, list, ref[list], &mv[list][0], &mv[list][1]); else mv[list][0] = mv[list][1] = 0; } } if(ref[1] < 0){ if(!is_b8x8) *mb_type &= ~MB_TYPE_L1; sub_mb_type &= ~MB_TYPE_L1; }else if(ref[0] < 0){ if(!is_b8x8) *mb_type &= ~MB_TYPE_L0; sub_mb_type &= ~MB_TYPE_L0; } if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col)){ int pair_xy = s->mb_x + (s->mb_y&~1)*s->mb_stride; int mb_types_col[2]; int b8_stride = h->b8_stride; int b4_stride = h->b_stride; *mb_type = (*mb_type & ~MB_TYPE_16x16) | MB_TYPE_8x8; if(IS_INTERLACED(*mb_type)){ mb_types_col[0] = h->ref_list[1][0].mb_type[pair_xy]; mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy+s->mb_stride]; if(s->mb_y&1){ l1ref0 -= 2*b8_stride; l1ref1 -= 2*b8_stride; l1mv0 -= 4*b4_stride; l1mv1 -= 4*b4_stride; } b8_stride *= 3; b4_stride *= 6; }else{ int cur_poc = s->current_picture_ptr->poc; int *col_poc = h->ref_list[1]->field_poc; int col_parity = FFABS(col_poc[0] - cur_poc) >= FFABS(col_poc[1] - cur_poc); int dy = 2*col_parity - (s->mb_y&1); mb_types_col[0] = mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy + col_parity*s->mb_stride]; l1ref0 += dy*b8_stride; l1ref1 += dy*b8_stride; l1mv0 += 2*dy*b4_stride; l1mv1 += 2*dy*b4_stride; b8_stride = 0; } for(i8=0; i8<4; i8++){ int x8 = i8&1; int y8 = i8>>1; int xy8 = x8+y8*b8_stride; int xy4 = 3*x8+y8*b4_stride; int a=0, b=0; if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) continue; h->sub_mb_type[i8] = sub_mb_type; fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1); fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1); if(!IS_INTRA(mb_types_col[y8]) && ( (l1ref0[xy8] == 0 && FFABS(l1mv0[xy4][0]) <= 1 && FFABS(l1mv0[xy4][1]) <= 1) || (l1ref0[xy8] < 0 && l1ref1[xy8] == 0 && FFABS(l1mv1[xy4][0]) <= 1 && FFABS(l1mv1[xy4][1]) <= 1))){ if(ref[0] > 0) a= pack16to32(mv[0][0],mv[0][1]); if(ref[1] > 0) b= pack16to32(mv[1][0],mv[1][1]); }else{ a= pack16to32(mv[0][0],mv[0][1]); b= pack16to32(mv[1][0],mv[1][1]); } fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, a, 4); fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, b, 4); } }else if(IS_16X16(*mb_type)){ int a=0, b=0; fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, (uint8_t)ref[0], 1); fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, (uint8_t)ref[1], 1); if(!IS_INTRA(mb_type_col) && ( (l1ref0[0] == 0 && FFABS(l1mv0[0][0]) <= 1 && FFABS(l1mv0[0][1]) <= 1) || (l1ref0[0] < 0 && l1ref1[0] == 0 && FFABS(l1mv1[0][0]) <= 1 && FFABS(l1mv1[0][1]) <= 1 && (h->x264_build>33 || !h->x264_build)))){ if(ref[0] > 0) a= pack16to32(mv[0][0],mv[0][1]); if(ref[1] > 0) b= pack16to32(mv[1][0],mv[1][1]); }else{ a= pack16to32(mv[0][0],mv[0][1]); b= pack16to32(mv[1][0],mv[1][1]); } fill_rectangle(&h->mv_cache[0][scan8[0]], 4, 4, 8, a, 4); fill_rectangle(&h->mv_cache[1][scan8[0]], 4, 4, 8, b, 4); }else{ for(i8=0; i8<4; i8++){ const int x8 = i8&1; const int y8 = i8>>1; if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) continue; h->sub_mb_type[i8] = sub_mb_type; fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mv[0][0],mv[0][1]), 4); fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mv[1][0],mv[1][1]), 4); fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1); fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1); if(!IS_INTRA(mb_type_col) && ( l1ref0[x8 + y8*h->b8_stride] == 0 || (l1ref0[x8 + y8*h->b8_stride] < 0 && l1ref1[x8 + y8*h->b8_stride] == 0 && (h->x264_build>33 || !h->x264_build)))){ const int16_t (*l1mv)[2]= l1ref0[x8 + y8*h->b8_stride] == 0 ? l1mv0 : l1mv1; if(IS_SUB_8X8(sub_mb_type)){ const int16_t *mv_col = l1mv[x8*3 + y8*3*h->b_stride]; if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){ if(ref[0] == 0) fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4); if(ref[1] == 0) fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4); } }else for(i4=0; i4<4; i4++){ const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*h->b_stride]; if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){ if(ref[0] == 0) *(uint32_t*)h->mv_cache[0][scan8[i8*4+i4]] = 0; if(ref[1] == 0) *(uint32_t*)h->mv_cache[1][scan8[i8*4+i4]] = 0; } } } } } }else{ const int *map_col_to_list0[2] = {h->map_col_to_list0[0], h->map_col_to_list0[1]}; const int *dist_scale_factor = h->dist_scale_factor; if(FRAME_MBAFF){ if(IS_INTERLACED(*mb_type)){ map_col_to_list0[0] = h->map_col_to_list0_field[0]; map_col_to_list0[1] = h->map_col_to_list0_field[1]; dist_scale_factor = h->dist_scale_factor_field; } if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col)){ const int pair_xy = s->mb_x + (s->mb_y&~1)*s->mb_stride; int mb_types_col[2]; int y_shift; *mb_type = MB_TYPE_8x8|MB_TYPE_L0L1 | (is_b8x8 ? 0 : MB_TYPE_DIRECT2) | (*mb_type & MB_TYPE_INTERLACED); sub_mb_type = MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2|MB_TYPE_16x16; if(IS_INTERLACED(*mb_type)){ mb_types_col[0] = h->ref_list[1][0].mb_type[pair_xy]; mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy+s->mb_stride]; if(s->mb_y&1){ l1ref0 -= 2*h->b8_stride; l1ref1 -= 2*h->b8_stride; l1mv0 -= 4*h->b_stride; l1mv1 -= 4*h->b_stride; } y_shift = 0; if( (mb_types_col[0] & MB_TYPE_16x16_OR_INTRA) && (mb_types_col[1] & MB_TYPE_16x16_OR_INTRA) && !is_b8x8) *mb_type |= MB_TYPE_16x8; else *mb_type |= MB_TYPE_8x8; }else{ int dy = (s->mb_y&1) ? 1 : 2; mb_types_col[0] = mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy+s->mb_stride]; l1ref0 += dy*h->b8_stride; l1ref1 += dy*h->b8_stride; l1mv0 += 2*dy*h->b_stride; l1mv1 += 2*dy*h->b_stride; y_shift = 2; if((mb_types_col[0] & (MB_TYPE_16x16_OR_INTRA|MB_TYPE_16x8)) && !is_b8x8) *mb_type |= MB_TYPE_16x16; else *mb_type |= MB_TYPE_8x8; } for(i8=0; i8<4; i8++){ const int x8 = i8&1; const int y8 = i8>>1; int ref0, scale; const int16_t (*l1mv)[2]= l1mv0; if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) continue; h->sub_mb_type[i8] = sub_mb_type; fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, 0, 1); if(IS_INTRA(mb_types_col[y8])){ fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, 0, 1); fill_rectangle(&h-> mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4); fill_rectangle(&h-> mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4); continue; } ref0 = l1ref0[x8 + (y8*2>>y_shift)*h->b8_stride]; if(ref0 >= 0) ref0 = map_col_to_list0[0][ref0*2>>y_shift]; else{ ref0 = map_col_to_list0[1][l1ref1[x8 + (y8*2>>y_shift)*h->b8_stride]*2>>y_shift]; l1mv= l1mv1; } scale = dist_scale_factor[ref0]; fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1); { const int16_t *mv_col = l1mv[x8*3 + (y8*6>>y_shift)*h->b_stride]; int my_col = (mv_col[1]<<y_shift)/2; int mx = (scale * mv_col[0] + 128) >> 8; int my = (scale * my_col + 128) >> 8; fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mx,my), 4); fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mx-mv_col[0],my-my_col), 4); } } return; } } if(IS_16X16(*mb_type)){ int ref, mv0, mv1; fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, 0, 1); if(IS_INTRA(mb_type_col)){ ref=mv0=mv1=0; }else{ const int ref0 = l1ref0[0] >= 0 ? map_col_to_list0[0][l1ref0[0]] : map_col_to_list0[1][l1ref1[0]]; const int scale = dist_scale_factor[ref0]; const int16_t *mv_col = l1ref0[0] >= 0 ? l1mv0[0] : l1mv1[0]; int mv_l0[2]; mv_l0[0] = (scale * mv_col[0] + 128) >> 8; mv_l0[1] = (scale * mv_col[1] + 128) >> 8; ref= ref0; mv0= pack16to32(mv_l0[0],mv_l0[1]); mv1= pack16to32(mv_l0[0]-mv_col[0],mv_l0[1]-mv_col[1]); } fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, ref, 1); fill_rectangle(&h-> mv_cache[0][scan8[0]], 4, 4, 8, mv0, 4); fill_rectangle(&h-> mv_cache[1][scan8[0]], 4, 4, 8, mv1, 4); }else{ for(i8=0; i8<4; i8++){ const int x8 = i8&1; const int y8 = i8>>1; int ref0, scale; const int16_t (*l1mv)[2]= l1mv0; if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) continue; h->sub_mb_type[i8] = sub_mb_type; fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, 0, 1); if(IS_INTRA(mb_type_col)){ fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, 0, 1); fill_rectangle(&h-> mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4); fill_rectangle(&h-> mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4); continue; } ref0 = l1ref0[x8 + y8*h->b8_stride]; if(ref0 >= 0) ref0 = map_col_to_list0[0][ref0]; else{ ref0 = map_col_to_list0[1][l1ref1[x8 + y8*h->b8_stride]]; l1mv= l1mv1; } scale = dist_scale_factor[ref0]; fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1); if(IS_SUB_8X8(sub_mb_type)){ const int16_t *mv_col = l1mv[x8*3 + y8*3*h->b_stride]; int mx = (scale * mv_col[0] + 128) >> 8; int my = (scale * mv_col[1] + 128) >> 8; fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mx,my), 4); fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mx-mv_col[0],my-mv_col[1]), 4); }else for(i4=0; i4<4; i4++){ const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*h->b_stride]; int16_t *mv_l0 = h->mv_cache[0][scan8[i8*4+i4]]; mv_l0[0] = (scale * mv_col[0] + 128) >> 8; mv_l0[1] = (scale * mv_col[1] + 128) >> 8; *(uint32_t*)h->mv_cache[1][scan8[i8*4+i4]] = pack16to32(mv_l0[0]-mv_col[0],mv_l0[1]-mv_col[1]); } } } } } libavcodec/h264.c:1147: error: Uninitialized Value The value read from ref[_] was never initialized. libavcodec/h264.c:1147:32: 1145. if(ref[0] == 0) 1146. *(uint32_t*)h->mv_cache[0][scan8[i8*4+i4]] = 0; 1147. if(ref[1] == 0) ^ 1148. *(uint32_t*)h->mv_cache[1][scan8[i8*4+i4]] = 0; 1149. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L1147
d2a_code_trace_data_45614
int BUF_MEM_grow_clean(BUF_MEM *str, size_t len) { char *ret; size_t n; if (str->length >= len) { memset(&str->data[len],0,str->length-len); str->length=len; return(len); } if (str->max >= len) { memset(&str->data[str->length],0,len-str->length); str->length=len; return(len); } if (len > LIMIT_BEFORE_EXPANSION) { BUFerr(BUF_F_BUF_MEM_GROW_CLEAN,ERR_R_MALLOC_FAILURE); return 0; } n=(len+3)/3*4; if (str->data == NULL) ret=OPENSSL_malloc(n); else ret=OPENSSL_realloc_clean(str->data,str->max,n); if (ret == NULL) { BUFerr(BUF_F_BUF_MEM_GROW_CLEAN,ERR_R_MALLOC_FAILURE); len=0; } else { str->data=ret; str->max=n; memset(&str->data[str->length],0,len-str->length); str->length=len; } return(len); } ssl/s3_clnt.c:428: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 10):unsigned64 by call to `ssl3_send_client_certificate`. Showing all 13 steps of the trace ssl/s3_clnt.c:186:1: Parameter `s->init_buf->length` 184. ssl3_get_client_method) 185. 186. > int ssl3_connect(SSL *s) 187. { 188. BUF_MEM *buf=NULL; ssl/s3_clnt.c:428:8: Call 426. case SSL3_ST_CW_CERT_C: 427. case SSL3_ST_CW_CERT_D: 428. ret=ssl3_send_client_certificate(s); ^ 429. if (ret <= 0) goto end; 430. s->state=SSL3_ST_CW_KEY_EXCH_A; ssl/s3_clnt.c:3301:1: Parameter `s->init_buf->length` 3299. } 3300. 3301. > int ssl3_send_client_certificate(SSL *s) 3302. { 3303. X509 *x509=NULL; ssl/s3_clnt.c:3383:8: Call 3381. { 3382. s->state=SSL3_ST_CW_CERT_D; 3383. if (!ssl3_output_cert_chain(s, ^ 3384. (s->s3->tmp.cert_req == 2)?NULL:s->cert->key)) 3385. { ssl/s3_both.c:323:1: Parameter `s->init_buf->length` 321. } 322. 323. > unsigned long ssl3_output_cert_chain(SSL *s, CERT_PKEY *cpk) 324. { 325. unsigned char *p; ssl/s3_both.c:328:7: Call 326. unsigned long l = 3 + SSL_HM_HEADER_LENGTH(s); 327. 328. if (!ssl_add_cert_chain(s, cpk, &l)) ^ 329. return 0; 330. ssl/ssl_cert.c:1114:1: Parameter `s->init_buf->length` 1112. 1113. /* Add certificate chain to internal SSL BUF_MEM strcuture */ 1114. > int ssl_add_cert_chain(SSL *s, CERT_PKEY *cpk, unsigned long *l) 1115. { 1116. BUF_MEM *buf = s->init_buf; ssl/ssl_cert.c:1124:7: Call 1122. 1123. /* TLSv1 sends a chain with nothing in it, instead of an alert */ 1124. if (!BUF_MEM_grow_clean(buf,10)) ^ 1125. { 1126. SSLerr(SSL_F_SSL_ADD_CERT_CHAIN,ERR_R_BUF_LIB); crypto/buffer/buffer.c:139:1: <LHS trace> 137. } 138. 139. > int BUF_MEM_grow_clean(BUF_MEM *str, size_t len) 140. { 141. char *ret; crypto/buffer/buffer.c:139:1: Parameter `len` 137. } 138. 139. > int BUF_MEM_grow_clean(BUF_MEM *str, size_t len) 140. { 141. char *ret; crypto/buffer/buffer.c:139:1: <RHS trace> 137. } 138. 139. > int BUF_MEM_grow_clean(BUF_MEM *str, size_t len) 140. { 141. char *ret; crypto/buffer/buffer.c:139:1: Parameter `len` 137. } 138. 139. > int BUF_MEM_grow_clean(BUF_MEM *str, size_t len) 140. { 141. char *ret; crypto/buffer/buffer.c:146:3: Binary operation: ([0, +oo] - 10):unsigned64 by call to `ssl3_send_client_certificate` 144. if (str->length >= len) 145. { 146. memset(&str->data[len],0,str->length-len); ^ 147. str->length=len; 148. return(len);
https://github.com/openssl/openssl/blob/66f96fe2d519147097c118d4bf60704c69ed0635/crypto/buffer/buffer.c/#L146
d2a_code_trace_data_45615
static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vstream, const char *key, unsigned int max_pos, int depth) { AVCodecContext *acodec, *vcodec; ByteIOContext *ioc; AMFDataType amf_type; char str_val[256]; double num_val; num_val = 0; ioc = s->pb; amf_type = get_byte(ioc); switch(amf_type) { case AMF_DATA_TYPE_NUMBER: num_val = av_int2dbl(get_be64(ioc)); break; case AMF_DATA_TYPE_BOOL: num_val = get_byte(ioc); break; case AMF_DATA_TYPE_STRING: if(amf_get_string(ioc, str_val, sizeof(str_val)) < 0) return -1; break; case AMF_DATA_TYPE_OBJECT: { unsigned int keylen; while(url_ftell(ioc) < max_pos - 2 && (keylen = get_be16(ioc))) { url_fskip(ioc, keylen); if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0) return -1; } if(get_byte(ioc) != AMF_END_OF_OBJECT) return -1; } break; case AMF_DATA_TYPE_NULL: case AMF_DATA_TYPE_UNDEFINED: case AMF_DATA_TYPE_UNSUPPORTED: break; case AMF_DATA_TYPE_MIXEDARRAY: url_fskip(ioc, 4); while(url_ftell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) { if(amf_parse_object(s, astream, vstream, str_val, max_pos, depth + 1) < 0) return -1; } if(get_byte(ioc) != AMF_END_OF_OBJECT) return -1; break; case AMF_DATA_TYPE_ARRAY: { unsigned int arraylen, i; arraylen = get_be32(ioc); for(i = 0; i < arraylen && url_ftell(ioc) < max_pos - 1; i++) { if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0) return -1; } } break; case AMF_DATA_TYPE_DATE: url_fskip(ioc, 8 + 2); break; default: return -1; } if(depth == 1 && key) { acodec = astream ? astream->codec : NULL; vcodec = vstream ? vstream->codec : NULL; if(amf_type == AMF_DATA_TYPE_BOOL) { if(!strcmp(key, "stereo") && acodec) acodec->channels = num_val > 0 ? 2 : 1; } else if(amf_type == AMF_DATA_TYPE_NUMBER) { if(!strcmp(key, "duration")) s->duration = num_val * AV_TIME_BASE; else if(!strcmp(key, "audiocodecid") && acodec && 0 <= (int)num_val) flv_set_audio_codec(s, astream, (int)num_val << FLV_AUDIO_CODECID_OFFSET); else if(!strcmp(key, "videocodecid") && vcodec && 0 <= (int)num_val) flv_set_video_codec(s, vstream, (int)num_val); else if(!strcmp(key, "audiosamplesize") && acodec && 0 < (int)num_val) { acodec->bits_per_sample = num_val; if(num_val == 8 && (acodec->codec_id == CODEC_ID_PCM_S16BE || acodec->codec_id == CODEC_ID_PCM_S16LE)) acodec->codec_id = CODEC_ID_PCM_S8; } else if(!strcmp(key, "audiosamplerate") && acodec && num_val >= 0) { if (!acodec->sample_rate) { switch((int)num_val) { case 44000: acodec->sample_rate = 44100 ; break; case 22000: acodec->sample_rate = 22050 ; break; case 11000: acodec->sample_rate = 11025 ; break; case 5000 : acodec->sample_rate = 5512 ; break; default : acodec->sample_rate = num_val; } } } } } return 0; } libavformat/flvdec.c:308: error: Integer Overflow L2 ([0, +oo] - 2):unsigned32 by call to `flv_read_metabody`. libavformat/flvdec.c:286:12: Call 284. url_fskip(s->pb, 4); /* size of previous packet */ 285. type = get_byte(s->pb); 286. size = get_be24(s->pb); ^ 287. pts = get_be24(s->pb); 288. pts |= get_byte(s->pb) << 24; libavformat/aviobuf.c:470:11: Call 468. { 469. unsigned int val; 470. val = get_be16(s) << 8; ^ 471. val |= get_byte(s); 472. return val; libavformat/aviobuf.c:462:11: Call 460. { 461. unsigned int val; 462. val = get_byte(s) << 8; ^ 463. val |= get_byte(s); 464. return val; libavformat/aviobuf.c:348:13: Assignment 346. return *s->buf_ptr++; 347. else 348. return 0; ^ 349. } 350. } libavformat/aviobuf.c:462:5: Assignment 460. { 461. unsigned int val; 462. val = get_byte(s) << 8; ^ 463. val |= get_byte(s); 464. return val; libavformat/aviobuf.c:463:5: Assignment 461. unsigned int val; 462. val = get_byte(s) << 8; 463. val |= get_byte(s); ^ 464. return val; 465. } libavformat/aviobuf.c:464:5: Assignment 462. val = get_byte(s) << 8; 463. val |= get_byte(s); 464. return val; ^ 465. } 466. libavformat/aviobuf.c:470:5: Assignment 468. { 469. unsigned int val; 470. val = get_be16(s) << 8; ^ 471. val |= get_byte(s); 472. return val; libavformat/aviobuf.c:471:5: Assignment 469. unsigned int val; 470. val = get_be16(s) << 8; 471. val |= get_byte(s); ^ 472. return val; 473. } libavformat/aviobuf.c:472:5: Assignment 470. val = get_be16(s) << 8; 471. val |= get_byte(s); 472. return val; ^ 473. } 474. unsigned int get_be32(ByteIOContext *s) libavformat/flvdec.c:286:5: Assignment 284. url_fskip(s->pb, 4); /* size of previous packet */ 285. type = get_byte(s->pb); 286. size = get_be24(s->pb); ^ 287. pts = get_be24(s->pb); 288. pts |= get_byte(s->pb) << 24; libavformat/flvdec.c:298:5: Assignment 296. continue; 297. 298. next= size + url_ftell(s->pb); ^ 299. 300. if (type == FLV_TAG_TYPE_AUDIO) { libavformat/flvdec.c:308:13: Call 306. } else { 307. if (type == FLV_TAG_TYPE_META && size > 13+1+4) 308. flv_read_metabody(s, next); ^ 309. else /* skip packet */ 310. av_log(s, AV_LOG_ERROR, "skipping flv packet: type %d, size %d, flags %d\n", type, size, flags); libavformat/flvdec.c:206:1: Parameter `next_pos` 204. } 205. 206. static int flv_read_metabody(AVFormatContext *s, unsigned int next_pos) { ^ 207. AMFDataType type; 208. AVStream *stream, *astream, *vstream; libavformat/flvdec.c:231:8: Call 229. 230. //parse the second object (we want a mixed array) 231. if(amf_parse_object(s, astream, vstream, buffer, next_pos, 0) < 0) ^ 232. return -1; 233. libavformat/flvdec.c:104:1: <LHS trace> 102. } 103. 104. static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vstream, const char *key, unsigned int max_pos, int depth) { ^ 105. AVCodecContext *acodec, *vcodec; 106. ByteIOContext *ioc; libavformat/flvdec.c:104:1: Parameter `max_pos` 102. } 103. 104. static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vstream, const char *key, unsigned int max_pos, int depth) { ^ 105. AVCodecContext *acodec, *vcodec; 106. ByteIOContext *ioc; libavformat/flvdec.c:128:19: Binary operation: ([0, +oo] - 2):unsigned32 by call to `flv_read_metabody` 126. unsigned int keylen; 127. 128. while(url_ftell(ioc) < max_pos - 2 && (keylen = get_be16(ioc))) { ^ 129. url_fskip(ioc, keylen); //skip key string 130. if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/flvdec.c/#L128
d2a_code_trace_data_45616
int ssl3_cbc_copy_mac(unsigned char *out, const SSL3_RECORD *rec, size_t 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 size_t mac_end = rec->length; size_t mac_start = mac_end - md_size; size_t in_mac; size_t scan_start = 0; size_t i, j; size_t rotate_offset; if (!ossl_assert(rec->orig_len >= md_size && md_size <= EVP_MAX_MD_SIZE)) return 0; #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); in_mac = 0; rotate_offset = 0; memset(rotated_mac, 0, md_size); for (i = scan_start, j = 0; i < rec->orig_len; i++) { size_t mac_started = constant_time_eq_s(i, mac_start); size_t mac_ended = constant_time_lt_s(i, mac_end); unsigned char b = rec->data[i]; in_mac |= mac_started; in_mac &= mac_ended; rotate_offset |= j & mac_started; rotated_mac[j++] |= b & in_mac; j &= constant_time_lt_s(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_s(rotate_offset, md_size); } #else memset(out, 0, md_size); rotate_offset = md_size - rotate_offset; rotate_offset &= constant_time_lt_s(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_s(j, rotate_offset); rotate_offset++; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); } #endif return 1; } ssl/record/rec_layer_d1.c:282: error: INTEGER_OVERFLOW_L2 ([0, 17728] - [256, 17984]):unsigned64 by call to `dtls1_process_record`. Showing all 10 steps of the trace ssl/record/rec_layer_d1.c:224:1: Parameter `s->rlayer.rrec.length` 222. &((s)->rlayer.d->unprocessed_rcds)) 223. 224. > int dtls1_process_buffered_records(SSL *s) 225. { 226. pitem *item; ssl/record/rec_layer_d1.c:282:31: Call 280. } 281. 282. if (!replayok || !dtls1_process_record(s, bitmap)) { ^ 283. if (ossl_statem_in_error(s)) { 284. /* dtls1_process_record called SSLfatal() */ ssl/record/ssl3_record.c:1553:1: Parameter `s->rlayer.rrec.length` 1551. } 1552. 1553. > int dtls1_process_record(SSL *s, DTLS1_BITMAP *bitmap) 1554. { 1555. int i; ssl/record/ssl3_record.c:1593:5: Assignment 1591. /* decrypt in place in 'rr->input' */ 1592. rr->data = rr->input; 1593. rr->orig_len = rr->length; ^ 1594. 1595. if (SSL_READ_ETM(s) && s->read_hash) { ssl/record/ssl3_record.c:1689:18: Call 1687. */ 1688. mac = mac_tmp; 1689. if (!ssl3_cbc_copy_mac(mac_tmp, rr, mac_size)) { ^ 1690. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_DTLS1_PROCESS_RECORD, 1691. ERR_R_INTERNAL_ERROR); ssl/record/ssl3_record.c:1478:1: <LHS trace> 1476. #define CBC_MAC_ROTATE_IN_PLACE 1477. 1478. > int ssl3_cbc_copy_mac(unsigned char *out, 1479. const SSL3_RECORD *rec, size_t md_size) 1480. { ssl/record/ssl3_record.c:1478:1: Parameter `md_size` 1476. #define CBC_MAC_ROTATE_IN_PLACE 1477. 1478. > int ssl3_cbc_copy_mac(unsigned char *out, 1479. const SSL3_RECORD *rec, size_t md_size) 1480. { ssl/record/ssl3_record.c:1478:1: <RHS trace> 1476. #define CBC_MAC_ROTATE_IN_PLACE 1477. 1478. > int ssl3_cbc_copy_mac(unsigned char *out, 1479. const SSL3_RECORD *rec, size_t md_size) 1480. { ssl/record/ssl3_record.c:1478:1: Parameter `md_size` 1476. #define CBC_MAC_ROTATE_IN_PLACE 1477. 1478. > int ssl3_cbc_copy_mac(unsigned char *out, 1479. const SSL3_RECORD *rec, size_t md_size) 1480. { ssl/record/ssl3_record.c:1512:9: Binary operation: ([0, 17728] - [256, 17984]):unsigned64 by call to `dtls1_process_record` 1510. /* This information is public so it's safe to branch based on it. */ 1511. if (rec->orig_len > md_size + 255 + 1) 1512. scan_start = rec->orig_len - (md_size + 255 + 1); ^ 1513. 1514. in_mac = 0;
https://github.com/openssl/openssl/blob/a8ea8018fa187e22fb4989450b550589e20f62c2/ssl/record/ssl3_record.c/#L1512
d2a_code_trace_data_45617
static int rand_bytes(unsigned char *buf, int num) { static volatile int stirred_pool = 0; int i, j, k; size_t num_ceil, st_idx, st_num; int ok; long md_c[2]; unsigned char local_md[SHA_DIGEST_LENGTH]; EVP_MD_CTX *m; OSSL_RAND_STATE *sp = &global_state; #ifndef GETPID_IS_MEANINGLESS pid_t curr_pid = getpid(); #endif time_t curr_time = time(NULL); int do_stir_pool = 0; #ifdef OPENSSL_SYS_WIN32 FILETIME tv; # ifdef _WIN32_WCE SYSTEMTIME t; GetSystemTime(&t); SystemTimeToFileTime(&t, &tv); # else GetSystemTimeAsFileTime(&tv); # endif #elif defined(OPENSSL_SYS_VXWORKS) struct timespec tv; clock_gettime(CLOCK_REALTIME, &ts); #elif defined(OPENSSL_SYS_DSPBIOS) unsigned long long tv, OPENSSL_rdtsc(); tv = OPENSSL_rdtsc(); #else struct timeval tv; gettimeofday(&tv, NULL); #endif #ifdef PREDICT if (rand_predictable) { unsigned char val = 1; for (i = 0; i < num; i++) buf[i] = val++; return (1); } #endif if (num <= 0) return 1; m = EVP_MD_CTX_new(); if (m == NULL) goto err_mem; num_ceil = (1 + (num - 1) / (SHA_DIGEST_LENGTH / 2)) * (SHA_DIGEST_LENGTH / 2); if (!RUN_ONCE(&ossl_rand_init, do_ossl_rand_init)) goto err_mem; CRYPTO_THREAD_write_lock(rand_lock); ASYNC_block_pause(); CRYPTO_THREAD_write_lock(rand_tmp_lock); locking_threadid = CRYPTO_THREAD_get_current_id(); CRYPTO_THREAD_unlock(rand_tmp_lock); crypto_lock_rand = 1; if (!initialized) { RAND_poll(); initialized = 1; } if (!stirred_pool) do_stir_pool = 1; ok = (randomness >= RANDOMNESS_NEEDED); if (!ok) { randomness -= num; if (randomness < 0) randomness = 0; } if (do_stir_pool) { int n = STATE_SIZE; while (n > 0) { #if SHA_DIGEST_LENGTH > 20 # error "Please adjust DUMMY_SEED." #endif #define DUMMY_SEED "...................." rand_add(DUMMY_SEED, SHA_DIGEST_LENGTH, 0.0); n -= SHA_DIGEST_LENGTH; } if (ok) stirred_pool = 1; } st_idx = sp->index; st_num = sp->num; md_c[0] = sp->md_count[0]; md_c[1] = sp->md_count[1]; memcpy(local_md, sp->md, sizeof sp->md); sp->index += num_ceil; if (sp->index > sp->num) sp->index %= sp->num; sp->md_count[0] += 1; crypto_lock_rand = 0; ASYNC_unblock_pause(); CRYPTO_THREAD_unlock(rand_lock); while (num > 0) { j = (num >= SHA_DIGEST_LENGTH / 2) ? SHA_DIGEST_LENGTH / 2 : num; num -= j; if (!EVP_DigestInit_ex(m, EVP_sha1(), NULL)) goto err; #ifndef GETPID_IS_MEANINGLESS if (curr_pid) { if (!EVP_DigestUpdate(m, (unsigned char *)&curr_pid, sizeof curr_pid)) goto err; curr_pid = 0; } #endif if (curr_time) { if (!EVP_DigestUpdate(m, (unsigned char *)&curr_time, sizeof curr_time)) goto err; if (!EVP_DigestUpdate(m, (unsigned char *)&tv, sizeof tv)) goto err; curr_time = 0; if (!rand_hw_seed(m)) goto err; } if (!EVP_DigestUpdate(m, local_md, SHA_DIGEST_LENGTH)) goto err; if (!EVP_DigestUpdate(m, (unsigned char *)md_c, sizeof(md_c))) goto err; k = (st_idx + SHA_DIGEST_LENGTH / 2) - st_num; if (k > 0) { if (!EVP_DigestUpdate(m, &sp->state[st_idx], SHA_DIGEST_LENGTH / 2 - k)) goto err; if (!EVP_DigestUpdate(m, &sp->state[0], k)) goto err; } else if (!EVP_DigestUpdate(m, &sp->state[st_idx], SHA_DIGEST_LENGTH / 2)) goto err; if (!EVP_DigestFinal_ex(m, local_md, NULL)) goto err; for (i = 0; i < SHA_DIGEST_LENGTH / 2; i++) { sp->state[st_idx++] ^= local_md[i]; if (st_idx >= st_num) st_idx = 0; if (i < j) *(buf++) = local_md[i + SHA_DIGEST_LENGTH / 2]; } } if (!EVP_DigestInit_ex(m, EVP_sha1(), NULL) || !EVP_DigestUpdate(m, (unsigned char *)md_c, sizeof(md_c)) || !EVP_DigestUpdate(m, local_md, SHA_DIGEST_LENGTH)) goto err; CRYPTO_THREAD_write_lock(rand_lock); ASYNC_block_pause(); if (!EVP_DigestUpdate(m, sp->md, sizeof(sp->md)) || !EVP_DigestFinal_ex(m, sp->md, NULL)) { CRYPTO_THREAD_unlock(rand_lock); goto err; } ASYNC_unblock_pause(); CRYPTO_THREAD_unlock(rand_lock); EVP_MD_CTX_free(m); if (ok) return (1); RANDerr(RAND_F_RAND_BYTES, RAND_R_PRNG_NOT_SEEDED); ERR_add_error_data(1, "You need to read the OpenSSL FAQ, " "https://www.openssl.org/docs/faq.html"); return (0); err: RANDerr(RAND_F_RAND_BYTES, ERR_R_EVP_LIB); EVP_MD_CTX_free(m); return 0; err_mem: RANDerr(RAND_F_RAND_BYTES, ERR_R_MALLOC_FAILURE); EVP_MD_CTX_free(m); return 0; } crypto/rand/ossl_rand.c:507: error: MEMORY_LEAK memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 313, column 9 is not reachable after line 507, column 5. Showing all 50 steps of the trace crypto/rand/ossl_rand.c:264:1: start of procedure rand_bytes() 262. } 263. 264. > static int rand_bytes(unsigned char *buf, int num) 265. { 266. static volatile int stirred_pool = 0; crypto/rand/ossl_rand.c:266:5: 264. static int rand_bytes(unsigned char *buf, int num) 265. { 266. > static volatile int stirred_pool = 0; 267. int i, j, k; 268. size_t num_ceil, st_idx, st_num; crypto/rand/ossl_rand.c:273:5: 271. unsigned char local_md[SHA_DIGEST_LENGTH]; 272. EVP_MD_CTX *m; 273. > OSSL_RAND_STATE *sp = &global_state; 274. #ifndef GETPID_IS_MEANINGLESS 275. pid_t curr_pid = getpid(); crypto/rand/ossl_rand.c:275:5: 273. OSSL_RAND_STATE *sp = &global_state; 274. #ifndef GETPID_IS_MEANINGLESS 275. > pid_t curr_pid = getpid(); 276. #endif 277. time_t curr_time = time(NULL); crypto/rand/ossl_rand.c:277:5: 275. pid_t curr_pid = getpid(); 276. #endif 277. > time_t curr_time = time(NULL); 278. int do_stir_pool = 0; 279. /* time value for various platforms */ crypto/rand/ossl_rand.c:278:5: 276. #endif 277. time_t curr_time = time(NULL); 278. > int do_stir_pool = 0; 279. /* time value for various platforms */ 280. #ifdef OPENSSL_SYS_WIN32 crypto/rand/ossl_rand.c:297:5: 295. #else 296. struct timeval tv; 297. > gettimeofday(&tv, NULL); 298. #endif 299. crypto/rand/ossl_rand.c:310:9: Taking false branch 308. #endif 309. 310. if (num <= 0) ^ 311. return 1; 312. crypto/rand/ossl_rand.c:313:5: 311. return 1; 312. 313. > m = EVP_MD_CTX_new(); 314. if (m == NULL) 315. goto err_mem; 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:197:1: start of procedure CRYPTO_zalloc() 195. } 196. 197. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 198. { 199. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:199:5: 197. void *CRYPTO_zalloc(size_t num, const char *file, int line) 198. { 199. > void *ret = CRYPTO_malloc(num, file, line); 200. 201. FAILTEST(); crypto/mem.c:169:1: start of procedure CRYPTO_malloc() 167. #endif 168. 169. > void *CRYPTO_malloc(size_t num, const char *file, int line) 170. { 171. void *ret = NULL; crypto/mem.c:171:5: 169. void *CRYPTO_malloc(size_t num, const char *file, int line) 170. { 171. > void *ret = NULL; 172. 173. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:173:9: Taking false branch 171. void *ret = NULL; 172. 173. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 174. return malloc_impl(num, file, line); 175. crypto/mem.c:176:9: Taking false branch 174. return malloc_impl(num, file, line); 175. 176. if (num == 0) ^ 177. return NULL; 178. crypto/mem.c:180:5: 178. 179. FAILTEST(); 180. > allow_customize = 0; 181. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 182. if (call_malloc_debug) { crypto/mem.c:190:5: 188. } 189. #else 190. > osslargused(file); osslargused(line); 191. ret = malloc(num); 192. #endif crypto/mem.c:190:24: 188. } 189. #else 190. > osslargused(file); osslargused(line); 191. ret = malloc(num); 192. #endif crypto/mem.c:191:5: 189. #else 190. osslargused(file); osslargused(line); 191. > ret = malloc(num); 192. #endif 193. crypto/mem.c:194:5: 192. #endif 193. 194. > return ret; 195. } 196. crypto/mem.c:195:1: return from a call to CRYPTO_malloc 193. 194. return ret; 195. > } 196. 197. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:202:9: Taking true branch 200. 201. FAILTEST(); 202. if (ret != NULL) ^ 203. memset(ret, 0, num); 204. return ret; crypto/mem.c:203:9: 201. FAILTEST(); 202. if (ret != NULL) 203. > memset(ret, 0, num); 204. return ret; 205. } crypto/mem.c:204:5: 202. if (ret != NULL) 203. memset(ret, 0, num); 204. > return ret; 205. } 206. crypto/mem.c:205:1: return from a call to CRYPTO_zalloc 203. memset(ret, 0, num); 204. return ret; 205. > } 206. 207. 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) crypto/rand/ossl_rand.c:314:9: Taking false branch 312. 313. m = EVP_MD_CTX_new(); 314. if (m == NULL) ^ 315. goto err_mem; 316. crypto/rand/ossl_rand.c:318:5: 316. 317. /* round upwards to multiple of SHA_DIGEST_LENGTH/2 */ 318. > num_ceil = 319. (1 + (num - 1) / (SHA_DIGEST_LENGTH / 2)) * (SHA_DIGEST_LENGTH / 2); 320. crypto/rand/ossl_rand.c:339:10: 337. */ 338. 339. > if (!RUN_ONCE(&ossl_rand_init, do_ossl_rand_init)) 340. goto err_mem; 341. crypto/threads_pthread.c:105:1: start of procedure CRYPTO_THREAD_run_once() 103. } 104. 105. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 106. { 107. if (pthread_once(once, init) != 0) crypto/threads_pthread.c:107:9: Taking false branch 105. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 106. { 107. if (pthread_once(once, init) != 0) ^ 108. return 0; 109. crypto/threads_pthread.c:110:5: 108. return 0; 109. 110. > return 1; 111. } 112. crypto/threads_pthread.c:111:1: return from a call to CRYPTO_THREAD_run_once 109. 110. return 1; 111. > } 112. 113. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)) crypto/rand/ossl_rand.c:339:10: Condition is true 337. */ 338. 339. if (!RUN_ONCE(&ossl_rand_init, do_ossl_rand_init)) ^ 340. goto err_mem; 341. crypto/rand/ossl_rand.c:339:10: Taking true branch 337. */ 338. 339. if (!RUN_ONCE(&ossl_rand_init, do_ossl_rand_init)) ^ 340. goto err_mem; 341. crypto/rand/ossl_rand.c:505:2: 503. EVP_MD_CTX_free(m); 504. return 0; 505. > err_mem: 506. RANDerr(RAND_F_RAND_BYTES, ERR_R_MALLOC_FAILURE); 507. EVP_MD_CTX_free(m); crypto/rand/ossl_rand.c:506:5: Skipping ERR_put_error(): empty list of specs 504. return 0; 505. err_mem: 506. RANDerr(RAND_F_RAND_BYTES, ERR_R_MALLOC_FAILURE); ^ 507. EVP_MD_CTX_free(m); 508. return 0; crypto/rand/ossl_rand.c:507:5: 505. err_mem: 506. RANDerr(RAND_F_RAND_BYTES, ERR_R_MALLOC_FAILURE); 507. > EVP_MD_CTX_free(m); 508. return 0; 509. 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:264:1: start of procedure CRYPTO_free() 262. } 263. 264. > void CRYPTO_free(void *str, const char *file, int line) 265. { 266. if (free_impl != NULL && free_impl != &CRYPTO_free) { crypto/mem.c:266:9: Taking true branch 264. void CRYPTO_free(void *str, const char *file, int line) 265. { 266. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 267. free_impl(str, file, line); 268. return; crypto/mem.c:266:30: Taking true branch 264. void CRYPTO_free(void *str, const char *file, int line) 265. { 266. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 267. free_impl(str, file, line); 268. return; crypto/mem.c:267:9: Skipping __function_pointer__(): unresolved function pointer 265. { 266. if (free_impl != NULL && free_impl != &CRYPTO_free) { 267. free_impl(str, file, line); ^ 268. return; 269. } crypto/mem.c:268:9: 266. if (free_impl != NULL && free_impl != &CRYPTO_free) { 267. free_impl(str, file, line); 268. > return; 269. } 270. crypto/mem.c:282:1: return from a call to CRYPTO_free 280. free(str); 281. #endif 282. > } 283. 284. 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)
https://github.com/openssl/openssl/blob/12fb8c3d2dd00f3d4f1b084385403d26ed64a596/crypto/rand/ossl_rand.c/#L507
d2a_code_trace_data_45618
static inline unsigned int constant_time_ge(unsigned int a, unsigned int b) { unsigned int ge; ge = ~((a ^ b) | (a - b)); ge |= a & ~b; return constant_time_msb(ge); } ssl/s3_cbc.c:180: error: INTEGER_OVERFLOW_L2 ([0, `*rec->data`] - [0, 254]):unsigned32 by call to `constant_time_ge_8`. Showing all 9 steps of the trace ssl/s3_cbc.c:111:1: Parameter `rec->length` 109. * 1: if the padding was valid 110. * -1: otherwise. */ 111. > int tls1_cbc_remove_padding(const SSL* s, 112. SSL3_RECORD *rec, 113. unsigned block_size, ssl/s3_cbc.c:180:24: Call 178. for (i = 0; i < to_check; i++) 179. { 180. unsigned char mask = constant_time_ge_8(padding_length, i); ^ 181. unsigned char b = rec->data[rec->length-1-i]; 182. /* The final |padding_length+1| bytes should all have the value crypto/constant_time_locl.h:140:1: Parameter `a` 138. } 139. 140. > static inline unsigned char constant_time_ge_8(unsigned int a, unsigned int b) 141. { 142. return (unsigned char)(constant_time_ge(a, b)); crypto/constant_time_locl.h:142:25: Call 140. static inline unsigned char constant_time_ge_8(unsigned int a, unsigned int b) 141. { 142. return (unsigned char)(constant_time_ge(a, b)); ^ 143. } 144. crypto/constant_time_locl.h:130:1: <LHS trace> 128. } 129. 130. > static inline unsigned int constant_time_ge(unsigned int a, unsigned int b) 131. { 132. unsigned int ge; crypto/constant_time_locl.h:130:1: Parameter `a` 128. } 129. 130. > static inline unsigned int constant_time_ge(unsigned int a, unsigned int b) 131. { 132. unsigned int ge; crypto/constant_time_locl.h:130:1: <RHS trace> 128. } 129. 130. > static inline unsigned int constant_time_ge(unsigned int a, unsigned int b) 131. { 132. unsigned int ge; crypto/constant_time_locl.h:130:1: Parameter `b` 128. } 129. 130. > static inline unsigned int constant_time_ge(unsigned int a, unsigned int b) 131. { 132. unsigned int ge; crypto/constant_time_locl.h:134:2: Binary operation: ([0, *rec->data] - [0, 254]):unsigned32 by call to `constant_time_ge_8` 132. unsigned int ge; 133. /* Case 1: msb(a) == msb(b). a >= b iff the MSB of a - b is not set.*/ 134. ge = ~((a ^ b) | (a - b)); ^ 135. /* Case 2: msb(a) != msb(b). a >= b iff the MSB of a is set. */ 136. ge |= a & ~b;
https://github.com/openssl/openssl/blob/360928b7d0f16dde70e26841bbf9e1af727e8b8f/crypto/constant_time_locl.h/#L134
d2a_code_trace_data_45619
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/srp/srp_lib.c:105: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_exp`. Showing all 31 steps of the trace crypto/srp/srp_lib.c:105:10: Call 103. /* B = g**b + k*v */ 104. 105. if (!BN_mod_exp(gb, g, b, N, bn_ctx) ^ 106. || (k = srp_Calc_k(N, g)) == NULL 107. || !BN_mod_mul(kv, v, k, N, bn_ctx) crypto/bn/bn_exp.c:89:1: Parameter `ctx->stack.depth` 87. } 88. 89. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 90. BN_CTX *ctx) 91. { crypto/bn/bn_exp.c:149:15: Call 147. #ifdef RECP_MUL_MOD 148. { 149. ret = BN_mod_exp_recp(r, a, p, m, ctx); ^ 150. } 151. #else crypto/bn/bn_exp.c:161:1: Parameter `ctx->stack.depth` 159. } 160. 161. > int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 162. const BIGNUM *m, BN_CTX *ctx) 163. { crypto/bn/bn_exp.c:191:5: Call 189. } 190. 191. BN_CTX_start(ctx); ^ 192. aa = BN_CTX_get(ctx); 193. val[0] = 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_exp.c:192:10: Call 190. 191. BN_CTX_start(ctx); 192. aa = BN_CTX_get(ctx); ^ 193. val[0] = BN_CTX_get(ctx); 194. if (val[0] == 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_exp.c:193:14: Call 191. BN_CTX_start(ctx); 192. aa = BN_CTX_get(ctx); 193. val[0] = BN_CTX_get(ctx); ^ 194. if (val[0] == NULL) 195. 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_exp.c:210:10: Call 208. } 209. 210. if (!BN_nnmod(val[0], a, m, ctx)) ^ 211. goto err; /* 1 */ 212. 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: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_exp.c:220:14: Call 218. window = BN_window_bits_for_exponent_size(bits); 219. if (window > 1) { 220. if (!BN_mod_mul_reciprocal(aa, val[0], val[0], &recp, ctx)) ^ 221. goto err; /* 2 */ 222. j = 1 << (window - 1); crypto/bn/bn_recp.c:55:1: Parameter `ctx->stack.depth` 53. } 54. 55. > int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y, 56. BN_RECP_CTX *recp, BN_CTX *ctx) 57. { crypto/bn/bn_recp.c:62:5: Call 60. const BIGNUM *ca; 61. 62. BN_CTX_start(ctx); ^ 63. if ((a = BN_CTX_get(ctx)) == NULL) 64. 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_recp.c:63:14: Call 61. 62. BN_CTX_start(ctx); 63. if ((a = BN_CTX_get(ctx)) == NULL) ^ 64. goto err; 65. if (y != 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_recp.c:77:11: Call 75. ca = x; /* Just do the mod */ 76. 77. ret = BN_div_recp(NULL, r, ca, recp, ctx); ^ 78. err: 79. BN_CTX_end(ctx); crypto/bn/bn_recp.c:90:5: Call 88. BIGNUM *a, *b, *d, *r; 89. 90. BN_CTX_start(ctx); ^ 91. d = (dv != NULL) ? dv : BN_CTX_get(ctx); 92. r = (rem != NULL) ? rem : 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/bn/bn_recp.c:101:13: Call 99. BN_zero(d); 100. if (!BN_copy(r, m)) { 101. BN_CTX_end(ctx); ^ 102. return 0; 103. } 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_mod_exp` 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_45620
static void old_print_object_footer(const char *name) { char *str, *p; if (!strcmp(name, "tags")) return; str = p = av_strdup(name); if (!str) return; while (*p) { *p = av_toupper(*p); p++; } avio_printf(probe_out, "[/%s]\n", str); av_freep(&str); } avprobe.c:372: error: Memory Leak memory dynamically allocated by call to `av_strdup()` at line 363, column 15 is not reachable after line 372, column 5. avprobe.c:356:1: start of procedure old_print_object_footer() 354. } 355. 356. static void old_print_object_footer(const char *name) ^ 357. { 358. char *str, *p; avprobe.c:360:10: Taking false branch 358. char *str, *p; 359. 360. if (!strcmp(name, "tags")) ^ 361. return; 362. avprobe.c:363:5: 361. return; 362. 363. str = p = av_strdup(name); ^ 364. if (!str) 365. return; libavutil/mem.c:219:1: start of procedure av_strdup() 217. } 218. 219. char *av_strdup(const char *s) ^ 220. { 221. char *ptr = NULL; libavutil/mem.c:221:5: 219. char *av_strdup(const char *s) 220. { 221. char *ptr = NULL; ^ 222. if (s) { 223. int len = strlen(s) + 1; libavutil/mem.c:222:9: Taking true branch 220. { 221. char *ptr = NULL; 222. if (s) { ^ 223. int len = strlen(s) + 1; 224. ptr = av_realloc(NULL, len); libavutil/mem.c:223:9: 221. char *ptr = NULL; 222. if (s) { 223. int len = strlen(s) + 1; ^ 224. ptr = av_realloc(NULL, len); 225. if (ptr) libavutil/mem.c:224:9: 222. if (s) { 223. int len = strlen(s) + 1; 224. ptr = av_realloc(NULL, len); ^ 225. if (ptr) 226. memcpy(ptr, s, len); 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:9: Taking false branch 122. 123. /* let's disallow possibly ambiguous cases */ 124. if (size > (INT_MAX - 16)) ^ 125. return NULL; 126. libavutil/mem.c:136:5: 134. return _aligned_realloc(ptr, size, 32); 135. #else 136. return realloc(ptr, size); ^ 137. #endif 138. } libavutil/mem.c:138:1: return from a call to av_realloc 136. return realloc(ptr, size); 137. #endif 138. } ^ 139. 140. int av_reallocp(void *ptr, size_t size) libavutil/mem.c:225:13: Taking true branch 223. int len = strlen(s) + 1; 224. ptr = av_realloc(NULL, len); 225. if (ptr) ^ 226. memcpy(ptr, s, len); 227. } libavutil/mem.c:226:13: 224. ptr = av_realloc(NULL, len); 225. if (ptr) 226. memcpy(ptr, s, len); ^ 227. } 228. return ptr; libavutil/mem.c:228:5: 226. memcpy(ptr, s, len); 227. } 228. return ptr; ^ 229. } 230. libavutil/mem.c:229:1: return from a call to av_strdup 227. } 228. return ptr; 229. } ^ 230. 231. char *av_strndup(const char *s, size_t len) avprobe.c:364:10: Taking false branch 362. 363. str = p = av_strdup(name); 364. if (!str) ^ 365. return; 366. while (*p) { avprobe.c:366:12: Loop condition is true. Entering loop body 364. if (!str) 365. return; 366. while (*p) { ^ 367. *p = av_toupper(*p); 368. p++; avprobe.c:367:9: 365. return; 366. while (*p) { 367. *p = av_toupper(*p); ^ 368. p++; 369. } libavutil/avstring.h:182:1: start of procedure av_toupper() 180. * Locale-independent conversion of ASCII characters to uppercase. 181. */ 182. static inline av_const int av_toupper(int c) ^ 183. { 184. if (c >= 'a' && c <= 'z') libavutil/avstring.h:184:9: Taking false branch 182. static inline av_const int av_toupper(int c) 183. { 184. if (c >= 'a' && c <= 'z') ^ 185. c ^= 0x20; 186. return c; libavutil/avstring.h:186:5: 184. if (c >= 'a' && c <= 'z') 185. c ^= 0x20; 186. return c; ^ 187. } 188. libavutil/avstring.h:187:1: return from a call to av_toupper 185. c ^= 0x20; 186. return c; 187. } ^ 188. 189. /** avprobe.c:368:9: 366. while (*p) { 367. *p = av_toupper(*p); 368. p++; ^ 369. } 370. avprobe.c:366:12: Loop condition is false. Leaving loop 364. if (!str) 365. return; 366. while (*p) { ^ 367. *p = av_toupper(*p); 368. p++; avprobe.c:371:5: 369. } 370. 371. avio_printf(probe_out, "[/%s]\n", str); ^ 372. av_freep(&str); 373. } libavformat/aviobuf.c:963:1: start of procedure avio_printf() 961. } 962. 963. int avio_printf(AVIOContext *s, const char *fmt, ...) ^ 964. { 965. va_list ap; libavformat/aviobuf.c:969:5: 967. int ret; 968. 969. va_start(ap, fmt); ^ 970. ret = vsnprintf(buf, sizeof(buf), fmt, ap); 971. va_end(ap); libavformat/aviobuf.c:970:5: 968. 969. va_start(ap, fmt); 970. ret = vsnprintf(buf, sizeof(buf), fmt, ap); ^ 971. va_end(ap); 972. avio_write(s, buf, strlen(buf)); libavformat/aviobuf.c:971:5: 969. va_start(ap, fmt); 970. ret = vsnprintf(buf, sizeof(buf), fmt, ap); 971. va_end(ap); ^ 972. avio_write(s, buf, strlen(buf)); 973. return ret; libavformat/aviobuf.c:972:5: Skipping avio_write(): empty list of specs 970. ret = vsnprintf(buf, sizeof(buf), fmt, ap); 971. va_end(ap); 972. avio_write(s, buf, strlen(buf)); ^ 973. return ret; 974. } libavformat/aviobuf.c:973:5: 971. va_end(ap); 972. avio_write(s, buf, strlen(buf)); 973. return ret; ^ 974. } 975. libavformat/aviobuf.c:974:1: return from a call to avio_printf 972. avio_write(s, buf, strlen(buf)); 973. return ret; 974. } ^ 975. 976. int avio_pause(AVIOContext *s, int pause) avprobe.c:372:5: Skipping av_freep(): empty list of specs 370. 371. avio_printf(probe_out, "[/%s]\n", str); 372. av_freep(&str); ^ 373. } 374.
https://github.com/libav/libav/blob/7a6cf2771414c7ab8bca0811d589f6091a6e2b71/avprobe.c/#L372
d2a_code_trace_data_45621
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:212: error: Uninitialized Value The value read from height was never initialized. libavformat/flvenc.c:212:9: 210. 211. put_amf_string(pb, "height"); 212. put_amf_double(pb, height); ^ 213. 214. put_amf_string(pb, "videodatarate");
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/flvenc.c/#L212
d2a_code_trace_data_45622
static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt) { #ifndef OPENSSL_NO_RSA unsigned char *encdata = NULL; EVP_PKEY *pkey = NULL; EVP_PKEY_CTX *pctx = NULL; size_t enclen; unsigned char *pms = NULL; size_t pmslen = 0; if (s->session->peer == NULL) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); return 0; } pkey = X509_get0_pubkey(s->session->peer); if (EVP_PKEY_get0_RSA(pkey) == NULL) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); return 0; } pmslen = SSL_MAX_MASTER_KEY_LENGTH; pms = OPENSSL_malloc(pmslen); if (pms == NULL) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_MALLOC_FAILURE); return 0; } pms[0] = s->client_version >> 8; pms[1] = s->client_version & 0xff; if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_MALLOC_FAILURE); goto err; } if (s->version > SSL3_VERSION && !WPACKET_start_sub_packet_u16(pkt)) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); goto err; } pctx = EVP_PKEY_CTX_new(pkey, NULL); if (pctx == NULL || EVP_PKEY_encrypt_init(pctx) <= 0 || EVP_PKEY_encrypt(pctx, NULL, &enclen, pms, pmslen) <= 0) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_EVP_LIB); goto err; } if (!WPACKET_allocate_bytes(pkt, enclen, &encdata) || EVP_PKEY_encrypt(pctx, encdata, &enclen, pms, pmslen) <= 0) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, SSL_R_BAD_RSA_ENCRYPT); goto err; } EVP_PKEY_CTX_free(pctx); pctx = NULL; if (s->version > SSL3_VERSION && !WPACKET_close(pkt)) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); goto err; } if (!ssl_log_rsa_client_key_exchange(s, encdata, enclen, pms, pmslen)) { goto err; } s->s3->tmp.pms = pms; s->s3->tmp.pmslen = pmslen; return 1; err: OPENSSL_clear_free(pms, pmslen); EVP_PKEY_CTX_free(pctx); return 0; #else SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); return 0; #endif } ssl/statem/statem_clnt.c:2974: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_malloc()` at line 2918, column 11 is not reachable after line 2974, column 5. Showing all 67 steps of the trace ssl/statem/statem_clnt.c:2891:1: start of procedure tls_construct_cke_rsa() 2889. } 2890. 2891. > static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt) 2892. { 2893. #ifndef OPENSSL_NO_RSA ssl/statem/statem_clnt.c:2894:5: 2892. { 2893. #ifndef OPENSSL_NO_RSA 2894. > unsigned char *encdata = NULL; 2895. EVP_PKEY *pkey = NULL; 2896. EVP_PKEY_CTX *pctx = NULL; ssl/statem/statem_clnt.c:2895:5: 2893. #ifndef OPENSSL_NO_RSA 2894. unsigned char *encdata = NULL; 2895. > EVP_PKEY *pkey = NULL; 2896. EVP_PKEY_CTX *pctx = NULL; 2897. size_t enclen; ssl/statem/statem_clnt.c:2896:5: 2894. unsigned char *encdata = NULL; 2895. EVP_PKEY *pkey = NULL; 2896. > EVP_PKEY_CTX *pctx = NULL; 2897. size_t enclen; 2898. unsigned char *pms = NULL; ssl/statem/statem_clnt.c:2898:5: 2896. EVP_PKEY_CTX *pctx = NULL; 2897. size_t enclen; 2898. > unsigned char *pms = NULL; 2899. size_t pmslen = 0; 2900. ssl/statem/statem_clnt.c:2899:5: 2897. size_t enclen; 2898. unsigned char *pms = NULL; 2899. > size_t pmslen = 0; 2900. 2901. if (s->session->peer == NULL) { ssl/statem/statem_clnt.c:2901:9: Taking false branch 2899. size_t pmslen = 0; 2900. 2901. if (s->session->peer == NULL) { ^ 2902. /* 2903. * We should always have a server certificate with SSL_kRSA. ssl/statem/statem_clnt.c:2910:5: 2908. } 2909. 2910. > pkey = X509_get0_pubkey(s->session->peer); 2911. if (EVP_PKEY_get0_RSA(pkey) == NULL) { 2912. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, 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) ssl/statem/statem_clnt.c:2911:9: 2909. 2910. pkey = X509_get0_pubkey(s->session->peer); 2911. > if (EVP_PKEY_get0_RSA(pkey) == NULL) { 2912. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, 2913. ERR_R_INTERNAL_ERROR); crypto/evp/p_lib.c:407:1: start of procedure EVP_PKEY_get0_RSA() 405. } 406. 407. > RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey) 408. { 409. if (pkey->type != EVP_PKEY_RSA) { crypto/evp/p_lib.c:409:9: Taking false branch 407. RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey) 408. { 409. if (pkey->type != EVP_PKEY_RSA) { ^ 410. EVPerr(EVP_F_EVP_PKEY_GET0_RSA, EVP_R_EXPECTING_AN_RSA_KEY); 411. return NULL; crypto/evp/p_lib.c:413:5: 411. return NULL; 412. } 413. > return pkey->pkey.rsa; 414. } 415. crypto/evp/p_lib.c:414:1: return from a call to EVP_PKEY_get0_RSA 412. } 413. return pkey->pkey.rsa; 414. > } 415. 416. RSA *EVP_PKEY_get1_RSA(EVP_PKEY *pkey) ssl/statem/statem_clnt.c:2911:9: Taking false branch 2909. 2910. pkey = X509_get0_pubkey(s->session->peer); 2911. if (EVP_PKEY_get0_RSA(pkey) == NULL) { ^ 2912. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, 2913. ERR_R_INTERNAL_ERROR); ssl/statem/statem_clnt.c:2917:5: 2915. } 2916. 2917. > pmslen = SSL_MAX_MASTER_KEY_LENGTH; 2918. pms = OPENSSL_malloc(pmslen); 2919. if (pms == NULL) { ssl/statem/statem_clnt.c:2918:5: 2916. 2917. pmslen = SSL_MAX_MASTER_KEY_LENGTH; 2918. > pms = OPENSSL_malloc(pmslen); 2919. if (pms == NULL) { 2920. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, 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:9: Taking true branch 202. 203. FAILTEST(); 204. if (allow_customize) { ^ 205. /* 206. * Disallow customization after the first allocation. We only set this crypto/mem.c:210:9: 208. * allocation. 209. */ 210. > allow_customize = 0; 211. } 212. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:221:5: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:221:19: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:222:5: 220. #else 221. (void)(file); (void)(line); 222. > ret = malloc(num); 223. #endif 224. crypto/mem.c:225:5: 223. #endif 224. 225. > return ret; 226. } 227. crypto/mem.c:226:1: return from a call to CRYPTO_malloc 224. 225. return ret; 226. > } 227. 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) ssl/statem/statem_clnt.c:2919:9: Taking false branch 2917. pmslen = SSL_MAX_MASTER_KEY_LENGTH; 2918. pms = OPENSSL_malloc(pmslen); 2919. if (pms == NULL) { ^ 2920. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, 2921. ERR_R_MALLOC_FAILURE); ssl/statem/statem_clnt.c:2925:5: 2923. } 2924. 2925. > pms[0] = s->client_version >> 8; 2926. pms[1] = s->client_version & 0xff; 2927. /* TODO(size_t): Convert this function */ ssl/statem/statem_clnt.c:2926:5: 2924. 2925. pms[0] = s->client_version >> 8; 2926. > pms[1] = s->client_version & 0xff; 2927. /* TODO(size_t): Convert this function */ 2928. if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) { ssl/statem/statem_clnt.c:2928:9: Taking false branch 2926. pms[1] = s->client_version & 0xff; 2927. /* TODO(size_t): Convert this function */ 2928. if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) { ^ 2929. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, 2930. ERR_R_MALLOC_FAILURE); ssl/statem/statem_clnt.c:2935:9: Taking true branch 2933. 2934. /* Fix buf for TLS and beyond */ 2935. if (s->version > SSL3_VERSION && !WPACKET_start_sub_packet_u16(pkt)) { ^ 2936. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, 2937. ERR_R_INTERNAL_ERROR); ssl/statem/statem_clnt.c:2935:39: 2933. 2934. /* Fix buf for TLS and beyond */ 2935. > if (s->version > SSL3_VERSION && !WPACKET_start_sub_packet_u16(pkt)) { 2936. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, 2937. ERR_R_INTERNAL_ERROR); ssl/packet.c:270:1: start of procedure WPACKET_start_sub_packet_len__() 268. } 269. 270. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 271. { 272. WPACKET_SUB *sub; ssl/packet.c:276:10: Condition is false 274. 275. /* Internal API, so should not fail */ 276. if (!ossl_assert(pkt->subs != NULL)) ^ 277. return 0; 278. ssl/packet.c:276:10: Taking true branch 274. 275. /* Internal API, so should not fail */ 276. if (!ossl_assert(pkt->subs != NULL)) ^ 277. return 0; 278. ssl/packet.c:277:9: 275. /* Internal API, so should not fail */ 276. if (!ossl_assert(pkt->subs != NULL)) 277. > return 0; 278. 279. sub = OPENSSL_zalloc(sizeof(*sub)); ssl/packet.c:299:1: return from a call to WPACKET_start_sub_packet_len__ 297. 298. return 1; 299. > } 300. 301. int WPACKET_start_sub_packet(WPACKET *pkt) ssl/statem/statem_clnt.c:2935:39: Taking true branch 2933. 2934. /* Fix buf for TLS and beyond */ 2935. if (s->version > SSL3_VERSION && !WPACKET_start_sub_packet_u16(pkt)) { ^ 2936. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, 2937. ERR_R_INTERNAL_ERROR); ssl/statem/statem_clnt.c:2936:9: 2934. /* Fix buf for TLS and beyond */ 2935. if (s->version > SSL3_VERSION && !WPACKET_start_sub_packet_u16(pkt)) { 2936. > SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, 2937. ERR_R_INTERNAL_ERROR); 2938. goto err; test/tls13secretstest.c:210:1: start of procedure ossl_statem_fatal() 208. } 209. 210. > void ossl_statem_fatal(SSL *s, int al, int func, int reason, const char *file, 211. int line) 212. { test/tls13secretstest.c:213:1: return from a call to ossl_statem_fatal 211. int line) 212. { 213. > } 214. 215. int ossl_statem_export_allowed(SSL *s) ssl/statem/statem_clnt.c:2973:2: 2971. 2972. return 1; 2973. > err: 2974. OPENSSL_clear_free(pms, pmslen); 2975. EVP_PKEY_CTX_free(pctx); ssl/statem/statem_clnt.c:2974:5: 2972. return 1; 2973. err: 2974. > OPENSSL_clear_free(pms, pmslen); 2975. EVP_PKEY_CTX_free(pctx); 2976. crypto/mem.c:316:1: start of procedure CRYPTO_clear_free() 314. } 315. 316. > void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) 317. { 318. if (str == NULL) crypto/mem.c:318:9: Taking false branch 316. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) 317. { 318. if (str == NULL) ^ 319. return; 320. if (num) crypto/mem.c:320:9: Taking true branch 318. if (str == NULL) 319. return; 320. if (num) ^ 321. OPENSSL_cleanse(str, num); 322. CRYPTO_free(str, file, line); crypto/mem.c:321:9: Skipping OPENSSL_cleanse(): method has no implementation 319. return; 320. if (num) 321. OPENSSL_cleanse(str, num); ^ 322. CRYPTO_free(str, file, line); 323. } crypto/mem.c:322:5: 320. if (num) 321. OPENSSL_cleanse(str, num); 322. > CRYPTO_free(str, file, line); 323. } crypto/mem.c:295:1: start of procedure CRYPTO_free() 293. } 294. 295. > void CRYPTO_free(void *str, const char *file, int line) 296. { 297. INCREMENT(free_count); crypto/mem.c:298:9: Taking true branch 296. { 297. INCREMENT(free_count); 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 299. free_impl(str, file, line); 300. return; crypto/mem.c:298:30: Taking true branch 296. { 297. INCREMENT(free_count); 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 299. free_impl(str, file, line); 300. return; crypto/mem.c:299:9: Skipping __function_pointer__(): unresolved function pointer 297. INCREMENT(free_count); 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { 299. free_impl(str, file, line); ^ 300. return; 301. } crypto/mem.c:300:9: 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { 299. free_impl(str, file, line); 300. > return; 301. } 302. crypto/mem.c:314:1: return from a call to CRYPTO_free 312. free(str); 313. #endif 314. > } 315. 316. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/mem.c:323:1: return from a call to CRYPTO_clear_free 321. OPENSSL_cleanse(str, num); 322. CRYPTO_free(str, file, line); 323. > }
https://github.com/openssl/openssl/blob/98c03302fb7b855647aa14022f61f5fb272e514a/ssl/statem/statem_clnt.c/#L2974
d2a_code_trace_data_45623
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); } crypto/x509/t_crl.c:99: error: BUFFER_OVERRUN_L3 Offset added: [0, 200] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace crypto/x509/t_crl.c:99:9: Call 97. X509_CRL_get0_signature(&sig, &sig_alg, x); 98. X509_signature_print(out, sig_alg, NULL); 99. p = X509_NAME_oneline(X509_CRL_get_issuer(x), NULL, 0); ^ 100. BIO_printf(out, "%8sIssuer: %s\n", "", p); 101. OPENSSL_free(p); 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: [0, 200] 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_45624
static void new_video_stream(AVFormatContext *oc) { AVStream *st; AVCodecContext *video_enc; int codec_id; st = av_new_stream(oc, oc->nb_streams); if (!st) { fprintf(stderr, "Could not alloc stream\n"); av_exit(1); } avcodec_get_context_defaults2(st->codec, CODEC_TYPE_VIDEO); bitstream_filters[nb_output_files][oc->nb_streams - 1]= video_bitstream_filters; video_bitstream_filters= NULL; if(thread_count>1) avcodec_thread_init(st->codec, thread_count); video_enc = st->codec; if(video_codec_tag) video_enc->codec_tag= video_codec_tag; if( (video_global_header&1) || (video_global_header==0 && (oc->oformat->flags & AVFMT_GLOBALHEADER))){ video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER; avctx_opts[CODEC_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER; } if(video_global_header&2){ video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER; avctx_opts[CODEC_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER; } if (video_stream_copy) { st->stream_copy = 1; video_enc->codec_type = CODEC_TYPE_VIDEO; video_enc->sample_aspect_ratio = st->sample_aspect_ratio = av_d2q(frame_aspect_ratio*frame_height/frame_width, 255); } else { const char *p; int i; AVCodec *codec; AVRational fps= frame_rate.num ? frame_rate : (AVRational){25,1}; if (video_codec_name) { codec_id = find_codec_or_die(video_codec_name, CODEC_TYPE_VIDEO, 1); codec = avcodec_find_encoder_by_name(video_codec_name); output_codecs[nb_ocodecs] = codec; } else { codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, CODEC_TYPE_VIDEO); codec = avcodec_find_encoder(codec_id); } video_enc->codec_id = codec_id; set_context_opts(video_enc, avctx_opts[CODEC_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM); if (codec && codec->supported_framerates && !force_fps) fps = codec->supported_framerates[av_find_nearest_q_idx(fps, codec->supported_framerates)]; video_enc->time_base.den = fps.num; video_enc->time_base.num = fps.den; video_enc->width = frame_width + frame_padright + frame_padleft; video_enc->height = frame_height + frame_padtop + frame_padbottom; video_enc->sample_aspect_ratio = av_d2q(frame_aspect_ratio*video_enc->height/video_enc->width, 255); video_enc->pix_fmt = frame_pix_fmt; st->sample_aspect_ratio = video_enc->sample_aspect_ratio; if(codec && codec->pix_fmts){ const enum PixelFormat *p= codec->pix_fmts; for(; *p!=-1; p++){ if(*p == video_enc->pix_fmt) break; } if(*p == -1) video_enc->pix_fmt = codec->pix_fmts[0]; } if (intra_only) video_enc->gop_size = 0; if (video_qscale || same_quality) { video_enc->flags |= CODEC_FLAG_QSCALE; video_enc->global_quality= st->quality = FF_QP2LAMBDA * video_qscale; } if(intra_matrix) video_enc->intra_matrix = intra_matrix; if(inter_matrix) video_enc->inter_matrix = inter_matrix; video_enc->thread_count = thread_count; p= video_rc_override_string; for(i=0; p; i++){ int start, end, q; int e=sscanf(p, "%d,%d,%d", &start, &end, &q); if(e!=3){ fprintf(stderr, "error parsing rc_override\n"); av_exit(1); } video_enc->rc_override= av_realloc(video_enc->rc_override, sizeof(RcOverride)*(i+1)); video_enc->rc_override[i].start_frame= start; video_enc->rc_override[i].end_frame = end; if(q>0){ video_enc->rc_override[i].qscale= q; video_enc->rc_override[i].quality_factor= 1.0; } else{ video_enc->rc_override[i].qscale= 0; video_enc->rc_override[i].quality_factor= -q/100.0; } p= strchr(p, '/'); if(p) p++; } video_enc->rc_override_count=i; if (!video_enc->rc_initial_buffer_occupancy) video_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size*3/4; video_enc->me_threshold= me_threshold; video_enc->intra_dc_precision= intra_dc_precision - 8; if (do_psnr) video_enc->flags|= CODEC_FLAG_PSNR; if (do_pass) { if (do_pass == 1) { video_enc->flags |= CODEC_FLAG_PASS1; } else { video_enc->flags |= CODEC_FLAG_PASS2; } } } nb_ocodecs++; video_disable = 0; av_freep(&video_codec_name); video_stream_copy = 0; } ffmpeg.c:2965: error: Null Dereference pointer `st` last assigned on line 2960 could be null and is dereferenced at line 2965, column 35. ffmpeg.c:2954:1: start of procedure new_video_stream() 2952. } 2953. 2954. static void new_video_stream(AVFormatContext *oc) ^ 2955. { 2956. AVStream *st; ffmpeg.c:2960:5: 2958. int codec_id; 2959. 2960. st = av_new_stream(oc, oc->nb_streams); ^ 2961. if (!st) { 2962. fprintf(stderr, "Could not alloc stream\n"); libavformat/utils.c:2344:1: start of procedure av_new_stream() 2342. } 2343. 2344. AVStream *av_new_stream(AVFormatContext *s, int id) ^ 2345. { 2346. AVStream *st; libavformat/utils.c:2349:9: Taking true branch 2347. int i; 2348. 2349. if (s->nb_streams >= MAX_STREAMS) ^ 2350. return NULL; 2351. libavformat/utils.c:2350:9: 2348. 2349. if (s->nb_streams >= MAX_STREAMS) 2350. return NULL; ^ 2351. 2352. st = av_mallocz(sizeof(AVStream)); libavformat/utils.c:2383:1: return from a call to av_new_stream 2381. s->streams[s->nb_streams++] = st; 2382. return st; 2383. } ^ 2384. 2385. AVProgram *av_new_program(AVFormatContext *ac, int id) ffmpeg.c:2961:10: Taking true branch 2959. 2960. st = av_new_stream(oc, oc->nb_streams); 2961. if (!st) { ^ 2962. fprintf(stderr, "Could not alloc stream\n"); 2963. av_exit(1); ffmpeg.c:2962:9: 2960. st = av_new_stream(oc, oc->nb_streams); 2961. if (!st) { 2962. fprintf(stderr, "Could not alloc stream\n"); ^ 2963. av_exit(1); 2964. } ffmpeg.c:2963:9: Skipping av_exit(): empty list of specs 2961. if (!st) { 2962. fprintf(stderr, "Could not alloc stream\n"); 2963. av_exit(1); ^ 2964. } 2965. avcodec_get_context_defaults2(st->codec, CODEC_TYPE_VIDEO); ffmpeg.c:2965:5: 2963. av_exit(1); 2964. } 2965. avcodec_get_context_defaults2(st->codec, CODEC_TYPE_VIDEO); ^ 2966. bitstream_filters[nb_output_files][oc->nb_streams - 1]= video_bitstream_filters; 2967. video_bitstream_filters= NULL;
https://github.com/libav/libav/blob/9aaa2077e5879b153d2ce6bea2e42f0c349a083f/ffmpeg.c/#L2965
d2a_code_trace_data_45625
static int read_sl_header(PESContext *pes, SLConfigDescr *sl, const uint8_t *buf, int buf_size) { GetBitContext gb; int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0; int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0; int dts_flag = -1, cts_flag = -1; int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE; init_get_bits(&gb, buf, buf_size*8); if (sl->use_au_start) au_start_flag = get_bits1(&gb); if (sl->use_au_end) au_end_flag = get_bits1(&gb); if (!sl->use_au_start && !sl->use_au_end) au_start_flag = au_end_flag = 1; if (sl->ocr_len > 0) ocr_flag = get_bits1(&gb); if (sl->use_idle) idle_flag = get_bits1(&gb); if (sl->use_padding) padding_flag = get_bits1(&gb); if (padding_flag) padding_bits = get_bits(&gb, 3); if (!idle_flag && (!padding_flag || padding_bits != 0)) { if (sl->packet_seq_num_len) skip_bits_long(&gb, sl->packet_seq_num_len); if (sl->degr_prior_len) if (get_bits1(&gb)) skip_bits(&gb, sl->degr_prior_len); if (ocr_flag) skip_bits_long(&gb, sl->ocr_len); if (au_start_flag) { if (sl->use_rand_acc_pt) get_bits1(&gb); if (sl->au_seq_num_len > 0) skip_bits_long(&gb, sl->au_seq_num_len); if (sl->use_timestamps) { dts_flag = get_bits1(&gb); cts_flag = get_bits1(&gb); } } if (sl->inst_bitrate_len) inst_bitrate_flag = get_bits1(&gb); if (dts_flag == 1) dts = get_bits64(&gb, sl->timestamp_len); if (cts_flag == 1) cts = get_bits64(&gb, sl->timestamp_len); if (sl->au_len > 0) skip_bits_long(&gb, sl->au_len); if (inst_bitrate_flag) skip_bits_long(&gb, sl->inst_bitrate_len); } if (dts != AV_NOPTS_VALUE) pes->dts = dts; if (cts != AV_NOPTS_VALUE) pes->pts = cts; if (sl->timestamp_len && sl->timestamp_res) avpriv_set_pts_info(pes->st, sl->timestamp_len, 1, sl->timestamp_res); return (get_bits_count(&gb) + 7) >> 3; } libavformat/mpegts.c:700: error: Null Dereference pointer `&gb->buffer` last assigned on line 689 could be null and is dereferenced by call to `get_bits1()` at line 700, column 21. libavformat/mpegts.c:682:1: start of procedure read_sl_header() 680. } 681. 682. static int read_sl_header(PESContext *pes, SLConfigDescr *sl, const uint8_t *buf, int buf_size) ^ 683. { 684. GetBitContext gb; libavformat/mpegts.c:685:5: 683. { 684. GetBitContext gb; 685. int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0; ^ 686. int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0; 687. int dts_flag = -1, cts_flag = -1; libavformat/mpegts.c:686:5: 684. GetBitContext gb; 685. int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0; 686. int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0; ^ 687. int dts_flag = -1, cts_flag = -1; 688. int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE; libavformat/mpegts.c:687:5: 685. int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0; 686. int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0; 687. int dts_flag = -1, cts_flag = -1; ^ 688. int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE; 689. init_get_bits(&gb, buf, buf_size*8); libavformat/mpegts.c:688:5: 686. int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0; 687. int dts_flag = -1, cts_flag = -1; 688. int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE; ^ 689. init_get_bits(&gb, buf, buf_size*8); 690. libavformat/mpegts.c:689:5: 687. int dts_flag = -1, cts_flag = -1; 688. int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE; 689. init_get_bits(&gb, buf, buf_size*8); ^ 690. 691. if (sl->use_au_start) libavcodec/get_bits.h:352:1: start of procedure init_get_bits() 350. * @param bit_size the size of the buffer in bits 351. */ 352. static inline void init_get_bits(GetBitContext *s, const uint8_t *buffer, ^ 353. int bit_size) 354. { libavcodec/get_bits.h:355:5: 353. int bit_size) 354. { 355. int buffer_size = (bit_size+7)>>3; ^ 356. if (buffer_size < 0 || bit_size < 0) { 357. buffer_size = bit_size = 0; libavcodec/get_bits.h:356:9: Taking true branch 354. { 355. int buffer_size = (bit_size+7)>>3; 356. if (buffer_size < 0 || bit_size < 0) { ^ 357. buffer_size = bit_size = 0; 358. buffer = NULL; libavcodec/get_bits.h:357:9: 355. int buffer_size = (bit_size+7)>>3; 356. if (buffer_size < 0 || bit_size < 0) { 357. buffer_size = bit_size = 0; ^ 358. buffer = NULL; 359. } libavcodec/get_bits.h:358:9: 356. if (buffer_size < 0 || bit_size < 0) { 357. buffer_size = bit_size = 0; 358. buffer = NULL; ^ 359. } 360. libavcodec/get_bits.h:361:5: 359. } 360. 361. s->buffer = buffer; ^ 362. s->size_in_bits = bit_size; 363. #if !UNCHECKED_BITSTREAM_READER libavcodec/get_bits.h:362:5: 360. 361. s->buffer = buffer; 362. s->size_in_bits = bit_size; ^ 363. #if !UNCHECKED_BITSTREAM_READER 364. s->size_in_bits_plus8 = bit_size + 8; libavcodec/get_bits.h:364:5: 362. s->size_in_bits = bit_size; 363. #if !UNCHECKED_BITSTREAM_READER 364. s->size_in_bits_plus8 = bit_size + 8; ^ 365. #endif 366. s->buffer_end = buffer + buffer_size; libavcodec/get_bits.h:366:5: 364. s->size_in_bits_plus8 = bit_size + 8; 365. #endif 366. s->buffer_end = buffer + buffer_size; ^ 367. s->index = 0; 368. } libavcodec/get_bits.h:367:5: 365. #endif 366. s->buffer_end = buffer + buffer_size; 367. s->index = 0; ^ 368. } 369. libavcodec/get_bits.h:368:1: return from a call to init_get_bits 366. s->buffer_end = buffer + buffer_size; 367. s->index = 0; 368. } ^ 369. 370. static inline void align_get_bits(GetBitContext *s) libavformat/mpegts.c:691:9: Taking false branch 689. init_get_bits(&gb, buf, buf_size*8); 690. 691. if (sl->use_au_start) ^ 692. au_start_flag = get_bits1(&gb); 693. if (sl->use_au_end) libavformat/mpegts.c:693:9: Taking false branch 691. if (sl->use_au_start) 692. au_start_flag = get_bits1(&gb); 693. if (sl->use_au_end) ^ 694. au_end_flag = get_bits1(&gb); 695. if (!sl->use_au_start && !sl->use_au_end) libavformat/mpegts.c:695:10: Taking true branch 693. if (sl->use_au_end) 694. au_end_flag = get_bits1(&gb); 695. if (!sl->use_au_start && !sl->use_au_end) ^ 696. au_start_flag = au_end_flag = 1; 697. if (sl->ocr_len > 0) libavformat/mpegts.c:695:31: Taking true branch 693. if (sl->use_au_end) 694. au_end_flag = get_bits1(&gb); 695. if (!sl->use_au_start && !sl->use_au_end) ^ 696. au_start_flag = au_end_flag = 1; 697. if (sl->ocr_len > 0) libavformat/mpegts.c:696:9: 694. au_end_flag = get_bits1(&gb); 695. if (!sl->use_au_start && !sl->use_au_end) 696. au_start_flag = au_end_flag = 1; ^ 697. if (sl->ocr_len > 0) 698. ocr_flag = get_bits1(&gb); libavformat/mpegts.c:697:9: Taking false branch 695. if (!sl->use_au_start && !sl->use_au_end) 696. au_start_flag = au_end_flag = 1; 697. if (sl->ocr_len > 0) ^ 698. ocr_flag = get_bits1(&gb); 699. if (sl->use_idle) libavformat/mpegts.c:699:9: Taking true branch 697. if (sl->ocr_len > 0) 698. ocr_flag = get_bits1(&gb); 699. if (sl->use_idle) ^ 700. idle_flag = get_bits1(&gb); 701. if (sl->use_padding) libavformat/mpegts.c:700:9: 698. ocr_flag = get_bits1(&gb); 699. if (sl->use_idle) 700. idle_flag = get_bits1(&gb); ^ 701. if (sl->use_padding) 702. padding_flag = get_bits1(&gb); libavcodec/get_bits.h:268:1: start of procedure get_bits1() 266. } 267. 268. static inline unsigned int get_bits1(GetBitContext *s) ^ 269. { 270. unsigned int index = s->index; libavcodec/get_bits.h:270:5: 268. static inline unsigned int get_bits1(GetBitContext *s) 269. { 270. unsigned int index = s->index; ^ 271. uint8_t result = s->buffer[index>>3]; 272. #ifdef BITSTREAM_READER_LE libavcodec/get_bits.h:271:5: 269. { 270. unsigned int index = s->index; 271. uint8_t result = s->buffer[index>>3]; ^ 272. #ifdef BITSTREAM_READER_LE 273. result >>= index & 7;
https://github.com/libav/libav/blob/e5356ebf2216918ad6351d4caa8b58c881c4b0ea/libavformat/mpegts.c/#L700
d2a_code_trace_data_45626
static int do_multi(int multi) { int n; int fd[2]; int *fds; static char sep[] = ":"; fds = malloc(sizeof(*fds) * multi); for (n = 0; n < multi; ++n) { if (pipe(fd) == -1) { BIO_printf(bio_err, "pipe failure\n"); exit(1); } fflush(stdout); (void)BIO_flush(bio_err); if (fork()) { close(fd[1]); fds[n] = fd[0]; } else { close(fd[0]); close(1); if (dup(fd[1]) == -1) { BIO_printf(bio_err, "dup failed\n"); exit(1); } close(fd[1]); mr = 1; usertime = 0; free(fds); return 0; } printf("Forked child %d\n", n); } for (n = 0; n < multi; ++n) { FILE *f; char buf[1024]; char *p; f = fdopen(fds[n], "r"); while (fgets(buf, sizeof buf, f)) { p = strchr(buf, '\n'); if (p) *p = '\0'; if (buf[0] != '+') { BIO_printf(bio_err, "Don't understand line '%s' from child %d\n", buf, n); continue; } printf("Got: %s from %d\n", buf, n); if (strncmp(buf, "+F:", 3) == 0) { int alg; int j; p = buf + 3; alg = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); for (j = 0; j < SIZE_NUM; ++j) results[alg][j] += atof(sstrsep(&p, sep)); } else if (strncmp(buf, "+F2:", 4) == 0) { int k; double d; p = buf + 4; k = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); d = atof(sstrsep(&p, sep)); if (n) rsa_results[k][0] = 1 / (1 / rsa_results[k][0] + 1 / d); else rsa_results[k][0] = d; d = atof(sstrsep(&p, sep)); if (n) rsa_results[k][1] = 1 / (1 / rsa_results[k][1] + 1 / d); else rsa_results[k][1] = d; } # ifndef OPENSSL_NO_DSA else if (strncmp(buf, "+F3:", 4) == 0) { int k; double d; p = buf + 4; k = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); d = atof(sstrsep(&p, sep)); if (n) dsa_results[k][0] = 1 / (1 / dsa_results[k][0] + 1 / d); else dsa_results[k][0] = d; d = atof(sstrsep(&p, sep)); if (n) dsa_results[k][1] = 1 / (1 / dsa_results[k][1] + 1 / d); else dsa_results[k][1] = d; } # endif # ifndef OPENSSL_NO_EC else if (strncmp(buf, "+F4:", 4) == 0) { int k; double d; p = buf + 4; k = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); d = atof(sstrsep(&p, sep)); if (n) ecdsa_results[k][0] = 1 / (1 / ecdsa_results[k][0] + 1 / d); else ecdsa_results[k][0] = d; d = atof(sstrsep(&p, sep)); if (n) ecdsa_results[k][1] = 1 / (1 / ecdsa_results[k][1] + 1 / d); else ecdsa_results[k][1] = d; } # endif # ifndef OPENSSL_NO_EC else if (strncmp(buf, "+F5:", 4) == 0) { int k; double d; p = buf + 4; k = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); d = atof(sstrsep(&p, sep)); if (n) ecdh_results[k][0] = 1 / (1 / ecdh_results[k][0] + 1 / d); else ecdh_results[k][0] = d; } # endif else if (strncmp(buf, "+H:", 3) == 0) { ; } else BIO_printf(bio_err, "Unknown type '%s' from child %d\n", buf, n); } fclose(f); } free(fds); return 1; } apps/speed.c:2955: error: NULL_DEREFERENCE pointer `fds` last assigned on line 2945 could be null and is dereferenced at line 2955, column 13. Showing all 19 steps of the trace apps/speed.c:2938:1: start of procedure do_multi() 2936. } 2937. 2938. > static int do_multi(int multi) 2939. { 2940. int n; apps/speed.c:2943:5: 2941. int fd[2]; 2942. int *fds; 2943. > static char sep[] = ":"; 2944. 2945. fds = malloc(sizeof(*fds) * multi); apps/speed.c:2945:5: 2943. static char sep[] = ":"; 2944. 2945. > fds = malloc(sizeof(*fds) * multi); 2946. for (n = 0; n < multi; ++n) { 2947. if (pipe(fd) == -1) { apps/speed.c:2946:10: 2944. 2945. fds = malloc(sizeof(*fds) * multi); 2946. > for (n = 0; n < multi; ++n) { 2947. if (pipe(fd) == -1) { 2948. BIO_printf(bio_err, "pipe failure\n"); apps/speed.c:2946:17: Loop condition is true. Entering loop body 2944. 2945. fds = malloc(sizeof(*fds) * multi); 2946. for (n = 0; n < multi; ++n) { ^ 2947. if (pipe(fd) == -1) { 2948. BIO_printf(bio_err, "pipe failure\n"); apps/speed.c:2947:13: Taking false branch 2945. fds = malloc(sizeof(*fds) * multi); 2946. for (n = 0; n < multi; ++n) { 2947. if (pipe(fd) == -1) { ^ 2948. BIO_printf(bio_err, "pipe failure\n"); 2949. exit(1); apps/speed.c:2951:9: 2949. exit(1); 2950. } 2951. > fflush(stdout); 2952. (void)BIO_flush(bio_err); 2953. if (fork()) { apps/speed.c:2952:15: 2950. } 2951. fflush(stdout); 2952. > (void)BIO_flush(bio_err); 2953. if (fork()) { 2954. close(fd[1]); crypto/bio/bio_lib.c:359:1: start of procedure BIO_ctrl() 357. } 358. 359. > long BIO_ctrl(BIO *b, int cmd, long larg, void *parg) 360. { 361. long ret; crypto/bio/bio_lib.c:364:9: Taking false branch 362. long (*cb) (BIO *, int, const char *, int, long, long); 363. 364. if (b == NULL) ^ 365. return (0); 366. crypto/bio/bio_lib.c:367:10: Taking false branch 365. return (0); 366. 367. if ((b->method == NULL) || (b->method->ctrl == NULL)) { ^ 368. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); 369. return (-2); crypto/bio/bio_lib.c:367:33: Taking true branch 365. return (0); 366. 367. if ((b->method == NULL) || (b->method->ctrl == NULL)) { ^ 368. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); 369. return (-2); crypto/bio/bio_lib.c:368:9: Skipping ERR_put_error(): empty list of specs 366. 367. if ((b->method == NULL) || (b->method->ctrl == NULL)) { 368. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); ^ 369. return (-2); 370. } crypto/bio/bio_lib.c:369:9: 367. if ((b->method == NULL) || (b->method->ctrl == NULL)) { 368. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); 369. > return (-2); 370. } 371. crypto/bio/bio_lib.c:383:1: return from a call to BIO_ctrl 381. ret = cb(b, BIO_CB_CTRL | BIO_CB_RETURN, parg, cmd, larg, ret); 382. return (ret); 383. > } 384. 385. long BIO_callback_ctrl(BIO *b, int cmd, apps/speed.c:2952:9: 2950. } 2951. fflush(stdout); 2952. > (void)BIO_flush(bio_err); 2953. if (fork()) { 2954. close(fd[1]); apps/speed.c:2953:13: Taking true branch 2951. fflush(stdout); 2952. (void)BIO_flush(bio_err); 2953. if (fork()) { ^ 2954. close(fd[1]); 2955. fds[n] = fd[0]; apps/speed.c:2954:13: 2952. (void)BIO_flush(bio_err); 2953. if (fork()) { 2954. > close(fd[1]); 2955. fds[n] = fd[0]; 2956. } else { apps/speed.c:2955:13: 2953. if (fork()) { 2954. close(fd[1]); 2955. > fds[n] = fd[0]; 2956. } else { 2957. close(fd[0]);
https://github.com/openssl/openssl/blob/91056e72693b4ee8cb5339d9091871ffc3b6f776/apps/speed.c/#L2955
d2a_code_trace_data_45627
int tls_construct_client_verify(SSL *s) { unsigned char *p; EVP_PKEY *pkey; const EVP_MD *md = s->s3->tmp.md[s->cert->key - s->cert->pkeys]; EVP_MD_CTX *mctx; unsigned u = 0; unsigned long n = 0; long hdatalen = 0; void *hdata; mctx = EVP_MD_CTX_new(); if (mctx == NULL) { SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_MALLOC_FAILURE); goto err; } p = ssl_handshake_start(s); pkey = s->cert->key->privatekey; hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata); if (hdatalen <= 0) { SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_INTERNAL_ERROR); goto err; } if (SSL_USE_SIGALGS(s)) { if (!tls12_get_sigandhash(p, pkey, md)) { SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_INTERNAL_ERROR); goto err; } p += 2; n = 2; } #ifdef SSL_DEBUG fprintf(stderr, "Using client alg %s\n", EVP_MD_name(md)); #endif if (!EVP_SignInit_ex(mctx, md, NULL) || !EVP_SignUpdate(mctx, hdata, hdatalen) || (s->version == SSL3_VERSION && !EVP_MD_CTX_ctrl(mctx, EVP_CTRL_SSL3_MASTER_SECRET, s->session->master_key_length, s->session->master_key)) || !EVP_SignFinal(mctx, p + 2, &u, pkey)) { SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_EVP_LIB); goto err; } #ifndef OPENSSL_NO_GOST { int pktype = EVP_PKEY_id(pkey); if (pktype == NID_id_GostR3410_2001 || pktype == NID_id_GostR3410_2012_256 || pktype == NID_id_GostR3410_2012_512) BUF_reverse(p + 2, NULL, u); } #endif s2n(u, p); n += u + 2; if (!ssl3_digest_cached_records(s, 0)) goto err; if (!ssl_set_handshake_header(s, SSL3_MT_CERTIFICATE_VERIFY, n)) { SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_INTERNAL_ERROR); goto err; } EVP_MD_CTX_free(mctx); return 1; err: EVP_MD_CTX_free(mctx); return 0; } ssl/statem/statem_clnt.c:2686: error: MEMORY_LEAK memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 2628, column 12 is not reachable after line 2686, column 5. Showing all 50 steps of the trace ssl/statem/statem_clnt.c:2617:1: start of procedure tls_construct_client_verify() 2615. } 2616. 2617. > int tls_construct_client_verify(SSL *s) 2618. { 2619. unsigned char *p; ssl/statem/statem_clnt.c:2621:5: 2619. unsigned char *p; 2620. EVP_PKEY *pkey; 2621. > const EVP_MD *md = s->s3->tmp.md[s->cert->key - s->cert->pkeys]; 2622. EVP_MD_CTX *mctx; 2623. unsigned u = 0; ssl/statem/statem_clnt.c:2623:5: 2621. const EVP_MD *md = s->s3->tmp.md[s->cert->key - s->cert->pkeys]; 2622. EVP_MD_CTX *mctx; 2623. > unsigned u = 0; 2624. unsigned long n = 0; 2625. long hdatalen = 0; ssl/statem/statem_clnt.c:2624:5: 2622. EVP_MD_CTX *mctx; 2623. unsigned u = 0; 2624. > unsigned long n = 0; 2625. long hdatalen = 0; 2626. void *hdata; ssl/statem/statem_clnt.c:2625:5: 2623. unsigned u = 0; 2624. unsigned long n = 0; 2625. > long hdatalen = 0; 2626. void *hdata; 2627. ssl/statem/statem_clnt.c:2628:5: 2626. void *hdata; 2627. 2628. > mctx = EVP_MD_CTX_new(); 2629. if (mctx == NULL) { 2630. SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_MALLOC_FAILURE); 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: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/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/statem/statem_clnt.c:2629:9: Taking false branch 2627. 2628. mctx = EVP_MD_CTX_new(); 2629. if (mctx == NULL) { ^ 2630. SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_MALLOC_FAILURE); 2631. goto err; ssl/statem/statem_clnt.c:2634:5: 2632. } 2633. 2634. > p = ssl_handshake_start(s); 2635. pkey = s->cert->key->privatekey; 2636. ssl/statem/statem_clnt.c:2635:5: 2633. 2634. p = ssl_handshake_start(s); 2635. > pkey = s->cert->key->privatekey; 2636. 2637. hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata); ssl/statem/statem_clnt.c:2637:5: 2635. pkey = s->cert->key->privatekey; 2636. 2637. > hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata); 2638. if (hdatalen <= 0) { 2639. SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_INTERNAL_ERROR); crypto/bio/bio_lib.c:327:1: start of procedure BIO_ctrl() 325. } 326. 327. > long BIO_ctrl(BIO *b, int cmd, long larg, void *parg) 328. { 329. long ret; crypto/bio/bio_lib.c:332:9: Taking false branch 330. long (*cb) (BIO *, int, const char *, int, long, long); 331. 332. if (b == NULL) ^ 333. return (0); 334. crypto/bio/bio_lib.c:335:10: Taking false branch 333. return (0); 334. 335. if ((b->method == NULL) || (b->method->ctrl == NULL)) { ^ 336. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); 337. return (-2); crypto/bio/bio_lib.c:335:33: Taking true branch 333. return (0); 334. 335. if ((b->method == NULL) || (b->method->ctrl == NULL)) { ^ 336. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); 337. return (-2); crypto/bio/bio_lib.c:336:9: Skipping ERR_put_error(): empty list of specs 334. 335. if ((b->method == NULL) || (b->method->ctrl == NULL)) { 336. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); ^ 337. return (-2); 338. } crypto/bio/bio_lib.c:337:9: 335. if ((b->method == NULL) || (b->method->ctrl == NULL)) { 336. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); 337. > return (-2); 338. } 339. crypto/bio/bio_lib.c:351:1: return from a call to BIO_ctrl 349. ret = cb(b, BIO_CB_CTRL | BIO_CB_RETURN, parg, cmd, larg, ret); 350. return (ret); 351. > } 352. 353. long BIO_callback_ctrl(BIO *b, int cmd, ssl/statem/statem_clnt.c:2638:9: Taking true branch 2636. 2637. hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata); 2638. if (hdatalen <= 0) { ^ 2639. SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_INTERNAL_ERROR); 2640. goto err; ssl/statem/statem_clnt.c:2639:9: Skipping ERR_put_error(): empty list of specs 2637. hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata); 2638. if (hdatalen <= 0) { 2639. SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_INTERNAL_ERROR); ^ 2640. goto err; 2641. } ssl/statem/statem_clnt.c:2685:2: 2683. EVP_MD_CTX_free(mctx); 2684. return 1; 2685. > err: 2686. EVP_MD_CTX_free(mctx); 2687. return 0; ssl/statem/statem_clnt.c:2686:5: 2684. return 1; 2685. err: 2686. > EVP_MD_CTX_free(mctx); 2687. return 0; 2688. } 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: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 true 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:165:30: Taking true 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:166:9: Skipping __function_pointer__(): unresolved function pointer 164. { 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { 166. free_impl(str, file, line); ^ 167. return; 168. } crypto/mem.c:167:9: 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { 166. free_impl(str, file, line); 167. > return; 168. } 169. 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/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)
https://github.com/openssl/openssl/blob/869d0a37cfa7cfdbd42026d2b75d14cdc64e81e0/ssl/statem/statem_clnt.c/#L2686
d2a_code_trace_data_45628
static void char2_field_tests(void) { BN_CTX *ctx = NULL; BIGNUM *p, *a, *b; EC_GROUP *group; EC_GROUP *C2_K163 = NULL, *C2_K233 = NULL, *C2_K283 = NULL, *C2_K409 = NULL, *C2_K571 = NULL; EC_GROUP *C2_B163 = NULL, *C2_B233 = NULL, *C2_B283 = NULL, *C2_B409 = NULL, *C2_B571 = NULL; EC_POINT *P, *Q, *R; BIGNUM *x, *y, *z, *cof; unsigned char buf[100]; size_t i, len; int k; ctx = BN_CTX_new(); if (!ctx) ABORT; p = BN_new(); a = BN_new(); b = BN_new(); if (!p || !a || !b) ABORT; if (!BN_hex2bn(&p, "13")) ABORT; if (!BN_hex2bn(&a, "3")) ABORT; if (!BN_hex2bn(&b, "1")) ABORT; group = EC_GROUP_new(EC_GF2m_simple_method()); if (!group) ABORT; if (!EC_GROUP_set_curve_GF2m(group, p, a, b, ctx)) ABORT; { EC_GROUP *tmp; tmp = EC_GROUP_new(EC_GROUP_method_of(group)); if (!tmp) ABORT; if (!EC_GROUP_copy(tmp, group)) ABORT; EC_GROUP_free(group); group = tmp; } if (!EC_GROUP_get_curve_GF2m(group, p, a, b, ctx)) ABORT; fprintf(stdout, "Curve defined by Weierstrass equation\n y^2 + x*y = x^3 + a*x^2 + b (mod 0x"); BN_print_fp(stdout, p); fprintf(stdout, ")\n a = 0x"); BN_print_fp(stdout, a); fprintf(stdout, "\n b = 0x"); BN_print_fp(stdout, b); fprintf(stdout, "\n(0x... means binary polynomial)\n"); P = EC_POINT_new(group); Q = EC_POINT_new(group); R = EC_POINT_new(group); if (!P || !Q || !R) ABORT; if (!EC_POINT_set_to_infinity(group, P)) ABORT; if (!EC_POINT_is_at_infinity(group, P)) ABORT; buf[0] = 0; if (!EC_POINT_oct2point(group, Q, buf, 1, ctx)) ABORT; if (!EC_POINT_add(group, P, P, Q, ctx)) ABORT; if (!EC_POINT_is_at_infinity(group, P)) ABORT; x = BN_new(); y = BN_new(); z = BN_new(); cof = BN_new(); if (!x || !y || !z || !cof) ABORT; if (!BN_hex2bn(&x, "6")) ABORT; # ifdef OPENSSL_EC_BIN_PT_COMP if (!EC_POINT_set_compressed_coordinates_GF2m(group, Q, x, 1, ctx)) ABORT; # else if (!BN_hex2bn(&y, "8")) ABORT; if (!EC_POINT_set_affine_coordinates_GF2m(group, Q, x, y, ctx)) ABORT; # endif if (EC_POINT_is_on_curve(group, Q, ctx) <= 0) { # ifdef OPENSSL_EC_BIN_PT_COMP if (!EC_POINT_get_affine_coordinates_GF2m(group, Q, x, y, ctx)) ABORT; # endif fprintf(stderr, "Point is not on curve: x = 0x"); BN_print_fp(stderr, x); fprintf(stderr, ", y = 0x"); BN_print_fp(stderr, y); fprintf(stderr, "\n"); ABORT; } fprintf(stdout, "A cyclic subgroup:\n"); k = 100; do { if (k-- == 0) ABORT; if (EC_POINT_is_at_infinity(group, P)) fprintf(stdout, " point at infinity\n"); else { if (!EC_POINT_get_affine_coordinates_GF2m(group, P, x, y, ctx)) ABORT; fprintf(stdout, " x = 0x"); BN_print_fp(stdout, x); fprintf(stdout, ", y = 0x"); BN_print_fp(stdout, y); fprintf(stdout, "\n"); } if (!EC_POINT_copy(R, P)) ABORT; if (!EC_POINT_add(group, P, P, Q, ctx)) ABORT; } while (!EC_POINT_is_at_infinity(group, P)); if (!EC_POINT_add(group, P, Q, R, ctx)) ABORT; if (!EC_POINT_is_at_infinity(group, P)) ABORT; # ifdef OPENSSL_EC_BIN_PT_COMP len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_COMPRESSED, buf, sizeof buf, ctx); if (len == 0) ABORT; if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT; if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT; fprintf(stdout, "Generator as octet string, compressed form:\n "); for (i = 0; i < len; i++) fprintf(stdout, "%02X", buf[i]); # endif len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_UNCOMPRESSED, buf, sizeof buf, ctx); if (len == 0) ABORT; if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT; if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT; fprintf(stdout, "\nGenerator as octet string, uncompressed form:\n "); for (i = 0; i < len; i++) fprintf(stdout, "%02X", buf[i]); # ifdef OPENSSL_EC_BIN_PT_COMP len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_HYBRID, buf, sizeof buf, ctx); if (len == 0) ABORT; if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT; if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT; fprintf(stdout, "\nGenerator as octet string, hybrid form:\n "); for (i = 0; i < len; i++) fprintf(stdout, "%02X", buf[i]); # endif fprintf(stdout, "\n"); if (!EC_POINT_invert(group, P, ctx)) ABORT; if (0 != EC_POINT_cmp(group, P, R, ctx)) ABORT; CHAR2_CURVE_TEST ("NIST curve K-163", "0800000000000000000000000000000000000000C9", "1", "1", "02FE13C0537BBC11ACAA07D793DE4E6D5E5C94EEE8", "0289070FB05D38FF58321F2E800536D538CCDAA3D9", 1, "04000000000000000000020108A2E0CC0D99F8A5EF", "2", 163, C2_K163); CHAR2_CURVE_TEST ("NIST curve B-163", "0800000000000000000000000000000000000000C9", "1", "020A601907B8C953CA1481EB10512F78744A3205FD", "03F0EBA16286A2D57EA0991168D4994637E8343E36", "00D51FBC6C71A0094FA2CDD545B11C5C0C797324F1", 1, "040000000000000000000292FE77E70C12A4234C33", "2", 163, C2_B163); CHAR2_CURVE_TEST ("NIST curve K-233", "020000000000000000000000000000000000000004000000000000000001", "0", "1", "017232BA853A7E731AF129F22FF4149563A419C26BF50A4C9D6EEFAD6126", "01DB537DECE819B7F70F555A67C427A8CD9BF18AEB9B56E0C11056FAE6A3", 0, "008000000000000000000000000000069D5BB915BCD46EFB1AD5F173ABDF", "4", 233, C2_K233); CHAR2_CURVE_TEST ("NIST curve B-233", "020000000000000000000000000000000000000004000000000000000001", "000000000000000000000000000000000000000000000000000000000001", "0066647EDE6C332C7F8C0923BB58213B333B20E9CE4281FE115F7D8F90AD", "00FAC9DFCBAC8313BB2139F1BB755FEF65BC391F8B36F8F8EB7371FD558B", "01006A08A41903350678E58528BEBF8A0BEFF867A7CA36716F7E01F81052", 1, "01000000000000000000000000000013E974E72F8A6922031D2603CFE0D7", "2", 233, C2_B233); CHAR2_CURVE_TEST ("NIST curve K-283", "0800000000000000000000000000000000000000000000000000000000000000000010A1", "0", "1", "0503213F78CA44883F1A3B8162F188E553CD265F23C1567A16876913B0C2AC2458492836", "01CCDA380F1C9E318D90F95D07E5426FE87E45C0E8184698E45962364E34116177DD2259", 0, "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE9AE2ED07577265DFF7F94451E061E163C61", "4", 283, C2_K283); CHAR2_CURVE_TEST ("NIST curve B-283", "0800000000000000000000000000000000000000000000000000000000000000000010A1", "000000000000000000000000000000000000000000000000000000000000000000000001", "027B680AC8B8596DA5A4AF8A19A0303FCA97FD7645309FA2A581485AF6263E313B79A2F5", "05F939258DB7DD90E1934F8C70B0DFEC2EED25B8557EAC9C80E2E198F8CDBECD86B12053", "03676854FE24141CB98FE6D4B20D02B4516FF702350EDDB0826779C813F0DF45BE8112F4", 1, "03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEF90399660FC938A90165B042A7CEFADB307", "2", 283, C2_B283); CHAR2_CURVE_TEST ("NIST curve K-409", "02000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000001", "0", "1", "0060F05F658F49C1AD3AB1890F7184210EFD0987E307C84C27ACCFB8F9F67CC2C460189EB5AAAA62EE222EB1B35540CFE9023746", "01E369050B7C4E42ACBA1DACBF04299C3460782F918EA427E6325165E9EA10E3DA5F6C42E9C55215AA9CA27A5863EC48D8E0286B", 1, "007FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE5F83B2D4EA20400EC4557D5ED3E3E7CA5B4B5C83B8E01E5FCF", "4", 409, C2_K409); CHAR2_CURVE_TEST ("NIST curve B-409", "02000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000001", "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", "0021A5C2C8EE9FEB5C4B9A753B7B476B7FD6422EF1F3DD674761FA99D6AC27C8A9A197B272822F6CD57A55AA4F50AE317B13545F", "015D4860D088DDB3496B0C6064756260441CDE4AF1771D4DB01FFE5B34E59703DC255A868A1180515603AEAB60794E54BB7996A7", "0061B1CFAB6BE5F32BBFA78324ED106A7636B9C5A7BD198D0158AA4F5488D08F38514F1FDF4B4F40D2181B3681C364BA0273C706", 1, "010000000000000000000000000000000000000000000000000001E2AAD6A612F33307BE5FA47C3C9E052F838164CD37D9A21173", "2", 409, C2_B409); CHAR2_CURVE_TEST ("NIST curve K-571", "80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000425", "0", "1", "026EB7A859923FBC82189631F8103FE4AC9CA2970012D5D46024804801841CA44370958493B205E647DA304DB4CEB08CBBD1BA39494776FB988B47174DCA88C7E2945283A01C8972", "0349DC807F4FBF374F4AEADE3BCA95314DD58CEC9F307A54FFC61EFC006D8A2C9D4979C0AC44AEA74FBEBBB9F772AEDCB620B01A7BA7AF1B320430C8591984F601CD4C143EF1C7A3", 0, "020000000000000000000000000000000000000000000000000000000000000000000000131850E1F19A63E4B391A8DB917F4138B630D84BE5D639381E91DEB45CFE778F637C1001", "4", 571, C2_K571); CHAR2_CURVE_TEST ("NIST curve B-571", "80000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000425", "000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001", "02F40E7E2221F295DE297117B7F3D62F5C6A97FFCB8CEFF1CD6BA8CE4A9A18AD84FFABBD8EFA59332BE7AD6756A66E294AFD185A78FF12AA520E4DE739BACA0C7FFEFF7F2955727A", "0303001D34B856296C16C0D40D3CD7750A93D1D2955FA80AA5F40FC8DB7B2ABDBDE53950F4C0D293CDD711A35B67FB1499AE60038614F1394ABFA3B4C850D927E1E7769C8EEC2D19", "037BF27342DA639B6DCCFFFEB73D69D78C6C27A6009CBBCA1980F8533921E8A684423E43BAB08A576291AF8F461BB2A8B3531D2F0485C19B16E2F1516E23DD3C1A4827AF1B8AC15B", 1, "03FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFE661CE18FF55987308059B186823851EC7DD9CA1161DE93D5174D66E8382E9BB2FE84E47", "2", 571, C2_B571); if (!EC_POINT_copy(Q, P)) ABORT; if (EC_POINT_is_at_infinity(group, Q)) ABORT; if (!EC_POINT_dbl(group, P, P, ctx)) ABORT; if (EC_POINT_is_on_curve(group, P, ctx) <= 0) ABORT; if (!EC_POINT_invert(group, Q, ctx)) ABORT; if (!EC_POINT_add(group, R, P, Q, ctx)) ABORT; if (!EC_POINT_add(group, R, R, Q, ctx)) ABORT; if (!EC_POINT_is_at_infinity(group, R)) ABORT; { const EC_POINT *points[3]; const BIGNUM *scalars[3]; if (EC_POINT_is_at_infinity(group, Q)) ABORT; points[0] = Q; points[1] = Q; points[2] = Q; if (!BN_add(y, z, BN_value_one())) ABORT; if (BN_is_odd(y)) ABORT; if (!BN_rshift1(y, y)) ABORT; scalars[0] = y; scalars[1] = y; fprintf(stdout, "combined multiplication ..."); fflush(stdout); if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) ABORT; if (!EC_POINTs_mul(group, R, z, 2, points, scalars, ctx)) ABORT; if (0 != EC_POINT_cmp(group, P, R, ctx)) ABORT; if (0 != EC_POINT_cmp(group, R, Q, ctx)) ABORT; fprintf(stdout, "."); fflush(stdout); if (!BN_pseudo_rand(y, BN_num_bits(y), 0, 0)) ABORT; if (!BN_add(z, z, y)) ABORT; BN_set_negative(z, 1); scalars[0] = y; scalars[1] = z; if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) ABORT; if (!EC_POINT_is_at_infinity(group, P)) ABORT; fprintf(stdout, "."); fflush(stdout); if (!BN_pseudo_rand(x, BN_num_bits(y) - 1, 0, 0)) ABORT; if (!BN_add(z, x, y)) ABORT; BN_set_negative(z, 1); scalars[0] = x; scalars[1] = y; scalars[2] = z; if (!EC_POINTs_mul(group, P, NULL, 3, points, scalars, ctx)) ABORT; if (!EC_POINT_is_at_infinity(group, P)) ABORT; fprintf(stdout, " ok\n\n"); } BN_CTX_free(ctx); BN_free(p); BN_free(a); BN_free(b); EC_GROUP_free(group); EC_POINT_free(P); EC_POINT_free(Q); EC_POINT_free(R); BN_free(x); BN_free(y); BN_free(z); BN_free(cof); EC_GROUP_free(C2_K163); EC_GROUP_free(C2_B163); EC_GROUP_free(C2_K233); EC_GROUP_free(C2_B233); EC_GROUP_free(C2_K283); EC_GROUP_free(C2_B283); EC_GROUP_free(C2_K409); EC_GROUP_free(C2_B409); EC_GROUP_free(C2_K571); EC_GROUP_free(C2_B571); } test/ectest.c:951: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 944, column 9 is not reachable after line 951, column 10. Showing all 107 steps of the trace test/ectest.c:924:1: start of procedure char2_field_tests() 922. # ifndef OPENSSL_NO_EC2M 923. 924. > static void char2_field_tests(void) 925. { 926. BN_CTX *ctx = NULL; test/ectest.c:926:5: 924. static void char2_field_tests(void) 925. { 926. > BN_CTX *ctx = NULL; 927. BIGNUM *p, *a, *b; 928. EC_GROUP *group; test/ectest.c:929:5: 927. BIGNUM *p, *a, *b; 928. EC_GROUP *group; 929. > EC_GROUP *C2_K163 = NULL, *C2_K233 = NULL, *C2_K283 = NULL, *C2_K409 = 930. NULL, *C2_K571 = NULL; 931. EC_GROUP *C2_B163 = NULL, *C2_B233 = NULL, *C2_B283 = NULL, *C2_B409 = test/ectest.c:931:5: 929. EC_GROUP *C2_K163 = NULL, *C2_K233 = NULL, *C2_K283 = NULL, *C2_K409 = 930. NULL, *C2_K571 = NULL; 931. > EC_GROUP *C2_B163 = NULL, *C2_B233 = NULL, *C2_B283 = NULL, *C2_B409 = 932. NULL, *C2_B571 = NULL; 933. EC_POINT *P, *Q, *R; test/ectest.c:939:5: 937. int k; 938. 939. > ctx = BN_CTX_new(); 940. if (!ctx) 941. ABORT; crypto/bn/bn_ctx.c:189:1: start of procedure BN_CTX_new() 187. 188. 189. > BN_CTX *BN_CTX_new(void) 190. { 191. BN_CTX *ret; crypto/bn/bn_ctx.c:193:9: 191. BN_CTX *ret; 192. 193. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE); 195. 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_ctx.c:193:9: Taking false branch 191. BN_CTX *ret; 192. 193. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE); 195. return NULL; crypto/bn/bn_ctx.c:198:5: 196. } 197. /* Initialise the structure */ 198. > BN_POOL_init(&ret->pool); 199. BN_STACK_init(&ret->stack); 200. return ret; crypto/bn/bn_ctx.c:335:1: start of procedure BN_POOL_init() 333. /***********/ 334. 335. > static void BN_POOL_init(BN_POOL *p) 336. { 337. p->head = p->current = p->tail = NULL; crypto/bn/bn_ctx.c:337:5: 335. static void BN_POOL_init(BN_POOL *p) 336. { 337. > p->head = p->current = p->tail = NULL; 338. p->used = p->size = 0; 339. } crypto/bn/bn_ctx.c:338:5: 336. { 337. p->head = p->current = p->tail = NULL; 338. > p->used = p->size = 0; 339. } 340. crypto/bn/bn_ctx.c:339:1: return from a call to BN_POOL_init 337. p->head = p->current = p->tail = NULL; 338. p->used = p->size = 0; 339. > } 340. 341. static void BN_POOL_finish(BN_POOL *p) crypto/bn/bn_ctx.c:199:5: 197. /* Initialise the structure */ 198. BN_POOL_init(&ret->pool); 199. > BN_STACK_init(&ret->stack); 200. return ret; 201. } crypto/bn/bn_ctx.c:294:1: start of procedure BN_STACK_init() 292. /************/ 293. 294. > static void BN_STACK_init(BN_STACK *st) 295. { 296. st->indexes = NULL; crypto/bn/bn_ctx.c:296:5: 294. static void BN_STACK_init(BN_STACK *st) 295. { 296. > st->indexes = NULL; 297. st->depth = st->size = 0; 298. } crypto/bn/bn_ctx.c:297:5: 295. { 296. st->indexes = NULL; 297. > st->depth = st->size = 0; 298. } 299. crypto/bn/bn_ctx.c:298:1: return from a call to BN_STACK_init 296. st->indexes = NULL; 297. st->depth = st->size = 0; 298. > } 299. 300. static void BN_STACK_finish(BN_STACK *st) crypto/bn/bn_ctx.c:200:5: 198. BN_POOL_init(&ret->pool); 199. BN_STACK_init(&ret->stack); 200. > return ret; 201. } 202. crypto/bn/bn_ctx.c:201:1: return from a call to BN_CTX_new 199. BN_STACK_init(&ret->stack); 200. return ret; 201. > } 202. 203. BN_CTX *BN_CTX_secure_new(void) test/ectest.c:940:10: Taking false branch 938. 939. ctx = BN_CTX_new(); 940. if (!ctx) ^ 941. ABORT; 942. test/ectest.c:943:5: 941. ABORT; 942. 943. > p = BN_new(); 944. a = BN_new(); 945. b = 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/ectest.c:944:5: 942. 943. p = BN_new(); 944. > a = BN_new(); 945. b = BN_new(); 946. if (!p || !a || !b) 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/ectest.c:945:5: 943. p = BN_new(); 944. a = BN_new(); 945. > b = BN_new(); 946. if (!p || !a || !b) 947. ABORT; 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/ectest.c:946:10: Taking false branch 944. a = BN_new(); 945. b = BN_new(); 946. if (!p || !a || !b) ^ 947. ABORT; 948. test/ectest.c:946:16: Taking false branch 944. a = BN_new(); 945. b = BN_new(); 946. if (!p || !a || !b) ^ 947. ABORT; 948. test/ectest.c:946:22: Taking false branch 944. a = BN_new(); 945. b = BN_new(); 946. if (!p || !a || !b) ^ 947. ABORT; 948. test/ectest.c:949:10: Taking false branch 947. ABORT; 948. 949. if (!BN_hex2bn(&p, "13")) ^ 950. ABORT; 951. if (!BN_hex2bn(&a, "3")) test/ectest.c:951:10: Skipping BN_hex2bn(): empty list of specs 949. if (!BN_hex2bn(&p, "13")) 950. ABORT; 951. if (!BN_hex2bn(&a, "3")) ^ 952. ABORT; 953. if (!BN_hex2bn(&b, "1"))
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/ectest.c/#L951
d2a_code_trace_data_45629
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); } crypto/dh/dh_check.c:166: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_is_prime_ex`. Showing all 51 steps of the trace crypto/dh/dh_check.c:136:14: Call 134. *ret |= DH_CHECK_Q_NOT_PRIME; 135. /* Check p == 1 mod q i.e. q divides p - 1 */ 136. if (!BN_div(t1, t2, dh->p, dh->q, ctx)) ^ 137. goto err; 138. if (!BN_is_one(t2)) crypto/bn/bn_div.c:137:1: Parameter `dv->top` 135. * If 'dv' or 'rm' is NULL, the respective value is not returned. 136. */ 137. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 138. BN_CTX *ctx) 139. { crypto/dh/dh_check.c:166:13: Call 164. if (!BN_rshift1(t1, dh->p)) 165. goto err; 166. r = BN_is_prime_ex(t1, BN_prime_checks, ctx, NULL); ^ 167. if (r < 0) 168. goto err; crypto/bn/bn_prime.c:145:1: Parameter `a->top` 143. } 144. 145. > int BN_is_prime_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 146. BN_GENCB *cb) 147. { crypto/bn/bn_prime.c:148:12: Call 146. BN_GENCB *cb) 147. { 148. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb); ^ 149. } 150. crypto/bn/bn_prime.c:151:1: Parameter `a->top` 149. } 150. 151. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 152. int do_trial_division, BN_GENCB *cb) 153. { crypto/bn/bn_prime.c:161:9: Call 159. 160. /* Take care of the really small primes 2 & 3 */ 161. if (BN_is_word(a, 2) || BN_is_word(a, 3)) ^ 162. return 1; 163. crypto/bn/bn_lib.c:855:1: Parameter `a->top` 853. } 854. 855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); crypto/bn/bn_lib.c:857:12: Call 855. int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); ^ 858. } 859. crypto/bn/bn_lib.c:840:1: Parameter `a->top` 838. } 839. 840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w) 841. { 842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0)); crypto/bn/bn_prime.c:161:29: Call 159. 160. /* Take care of the really small primes 2 & 3 */ 161. if (BN_is_word(a, 2) || BN_is_word(a, 3)) ^ 162. return 1; 163. crypto/bn/bn_lib.c:855:1: Parameter `a->top` 853. } 854. 855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); crypto/bn/bn_lib.c:857:12: Call 855. int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); ^ 858. } 859. crypto/bn/bn_lib.c:840:1: Parameter `a->top` 838. } 839. 840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w) 841. { 842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0)); crypto/bn/bn_prime.c:165:10: Call 163. 164. /* Check odd and bigger than 1 */ 165. if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0) ^ 166. return 0; 167. crypto/bn/bn_lib.c:860:1: Parameter `a->top` 858. } 859. 860. > int BN_is_odd(const BIGNUM *a) 861. { 862. return (a->top > 0) && (a->d[0] & 1); crypto/bn/bn_prime.c:165:26: Call 163. 164. /* Check odd and bigger than 1 */ 165. if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0) ^ 166. return 0; 167. crypto/bn/bn_lib.c:542:1: Parameter `a->top` 540. } 541. 542. > int BN_cmp(const BIGNUM *a, const BIGNUM *b) 543. { 544. int i; crypto/bn/bn_prime.c:198:10: Call 196. 197. /* compute A1 := a - 1 */ 198. if (!BN_copy(A1, a) || !BN_sub_word(A1, 1)) ^ 199. goto err; 200. /* compute A3 := a - 3 */ crypto/bn/bn_lib.c:285:1: Parameter `b->top` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_prime.c:201:10: Call 199. goto err; 200. /* compute A3 := a - 3 */ 201. if (!BN_copy(A3, a) || !BN_sub_word(A3, 3)) ^ 202. goto err; 203. crypto/bn/bn_lib.c:285:1: Parameter `b->top` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_prime.c:215:10: Call 213. if (mont == NULL) 214. goto err; 215. if (!BN_MONT_CTX_set(mont, a, ctx)) ^ 216. goto err; 217. crypto/bn/bn_mont.c:238:9: Call 236. BIGNUM *Ri, *R; 237. 238. if (BN_is_zero(mod)) ^ 239. return 0; 240. crypto/bn/bn_lib.c:845:1: Parameter `a->top` 843. } 844. 845. > int BN_is_zero(const BIGNUM *a) 846. { 847. return a->top == 0; crypto/bn/bn_prime.c:223:13: Call 221. goto err; 222. 223. j = witness(check, a, A1, A1_odd, k, ctx, mont); ^ 224. if (j == -1) 225. goto err; crypto/bn/bn_prime.c:245:1: Parameter `a->top` 243. } 244. 245. > static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1, 246. const BIGNUM *a1_odd, int k, BN_CTX *ctx, 247. BN_MONT_CTX *mont) crypto/bn/bn_prime.c:249:10: Call 247. BN_MONT_CTX *mont) 248. { 249. if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */ ^ 250. return -1; 251. if (BN_is_one(w)) crypto/bn/bn_exp.c:296:1: Parameter `m->top` 294. } 295. 296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 297. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 298. { crypto/bn/bn_exp.c:310:16: Call 308. || BN_get_flags(a, BN_FLG_CONSTTIME) != 0 309. || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) { 310. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 311. } 312. crypto/bn/bn_exp.c:745:14: Assignment 743. /* 2^(top*BN_BITS2) - m */ 744. tmp.d[0] = (0 - m->d[0]) & BN_MASK2; 745. for (i = 1; i < top; i++) ^ 746. tmp.d[i] = (~m->d[i]) & BN_MASK2; 747. tmp.top = top; crypto/bn/bn_exp.c:1062:14: Call 1060. bits -= window0; 1061. wvalue = bn_get_bits(p, bits) & wmask; 1062. if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&tmp, top, powerbuf, wvalue, ^ 1063. window)) 1064. goto err; crypto/bn/bn_exp.c:520:1: Parameter `top` 518. } 519. 520. > static int MOD_EXP_CTIME_COPY_FROM_PREBUF(BIGNUM *b, int top, 521. unsigned char *buf, int idx, 522. int window) crypto/bn/bn_exp.c:577:5: Assignment 575. } 576. 577. b->top = top; ^ 578. bn_correct_top(b); 579. return 1; crypto/bn/bn_exp.c:578:5: Call 576. 577. b->top = top; 578. bn_correct_top(b); ^ 579. return 1; 580. } crypto/bn/bn_lib.c:946:1: Parameter `a->top` 944. } 945. 946. > void bn_correct_top(BIGNUM *a) 947. { 948. BN_ULONG *ftl; crypto/bn/bn_exp.c:1075:22: Call 1073. /* Square the result window-size times */ 1074. for (i = 0; i < window; i++) 1075. if (!BN_mod_mul_montgomery(&tmp, &tmp, &tmp, mont, ctx)) ^ 1076. goto err; 1077. 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:116:5: Assignment 114. rp[0] = rp[max - 1] = 0; 115. rp++; 116. j = n; ^ 117. 118. if (--j > 0) { crypto/bn/bn_sqr.c:118:9: Assignment 116. j = n; 117. 118. if (--j > 0) { ^ 119. ap++; 120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); 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:115:5: Assignment 113. rp = r; 114. rp[0] = rp[max - 1] = 0; 115. rp++; ^ 116. j = n; 117. crypto/bn/bn_sqr.c:120:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_is_prime_ex` 118. if (--j > 0) { 119. ap++; 120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); ^ 121. rp += 2; 122. }
https://github.com/openssl/openssl/blob/b48d4397b8ee4256f0b0a115eb99f27ae89995e0/crypto/bn/bn_sqr.c/#L120
d2a_code_trace_data_45630
static int mxf_write_header(AVFormatContext *s) { MXFContext *mxf = s->priv_data; int i; uint8_t present[sizeof(mxf_essence_container_uls)/ sizeof(*mxf_essence_container_uls)] = {0}; for (i = 0; i < s->nb_streams; i++) { AVStream *st = s->streams[i]; MXFStreamContext *sc = av_mallocz(sizeof(*sc)); if (!sc) return AVERROR(ENOMEM); st->priv_data = sc; if (st->codec->codec_type == CODEC_TYPE_VIDEO) av_set_pts_info(st, 64, 1, st->codec->time_base.den); else if (st->codec->codec_type == CODEC_TYPE_AUDIO) av_set_pts_info(st, 64, 1, st->codec->sample_rate); sc->duration = -1; sc->index = mxf_get_essence_container_ul_index(st->codec->codec_id); if (sc->index == -1) { av_log(s, AV_LOG_ERROR, "track %d: could not find essence container ul, " "codec not currently supported in container\n", i); return -1; } if (st->codec->codec_id == CODEC_ID_MPEG2VIDEO) { if (st->codec->profile == FF_PROFILE_UNKNOWN || st->codec->level == FF_LEVEL_UNKNOWN) { av_log(s, AV_LOG_ERROR, "track %d: profile and level must be set for mpeg-2\n", i); return -1; } sc->codec_ul = mxf_get_mpeg2_codec_ul(st->codec); if (!sc->codec_ul) { av_log(s, AV_LOG_ERROR, "track %d: could not find codec ul for mpeg-2, " "unsupported profile/level\n", i); return -1; } } else sc->codec_ul = &mxf_essence_container_uls[sc->index].codec_ul; if (!present[sc->index]) { mxf->essence_containers_indices[mxf->essence_container_count++] = sc->index; present[sc->index] = 1; } else present[sc->index]++; memcpy(sc->track_essence_element_key, mxf_essence_container_uls[sc->index].element_ul, 15); sc->track_essence_element_key[15] = present[sc->index]; PRINT_KEY(s, "track essence element key", sc->track_essence_element_key); } mxf_write_partition(s, 1, header_open_partition_key, 1); return 0; } libavformat/mxfenc.c:793: error: Buffer Overrun L3 Offset: [-1, 2] Size: 3. libavformat/mxfenc.c:773:21: <Offset trace> 771. sc->duration = -1; 772. 773. sc->index = mxf_get_essence_container_ul_index(st->codec->codec_id); ^ 774. if (sc->index == -1) { 775. av_log(s, AV_LOG_ERROR, "track %d: could not find essence container ul, " libavformat/mxfenc.c:773:21: Call 771. sc->duration = -1; 772. 773. sc->index = mxf_get_essence_container_ul_index(st->codec->codec_id); ^ 774. if (sc->index == -1) { 775. av_log(s, AV_LOG_ERROR, "track %d: could not find essence container ul, " libavformat/mxfenc.c:214:5: Assignment 212. if (mxf_essence_container_uls[i].id == id) 213. return i; 214. return -1; ^ 215. } 216. libavformat/mxfenc.c:773:9: Assignment 771. sc->duration = -1; 772. 773. sc->index = mxf_get_essence_container_ul_index(st->codec->codec_id); ^ 774. if (sc->index == -1) { 775. av_log(s, AV_LOG_ERROR, "track %d: could not find essence container ul, " libavformat/mxfenc.c:59:1: <Length trace> 57. static void mxf_write_mpegvideo_desc(AVFormatContext *s, AVStream *st); 58. 59. static const MXFContainerEssenceEntry mxf_essence_container_uls[] = { ^ 60. { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0x60,0x01 }, 61. { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x15,0x01,0x05,0x00 }, libavformat/mxfenc.c:59:1: Array declaration 57. static void mxf_write_mpegvideo_desc(AVFormatContext *s, AVStream *st); 58. 59. static const MXFContainerEssenceEntry mxf_essence_container_uls[] = { ^ 60. { { 0x06,0x0E,0x2B,0x34,0x04,0x01,0x01,0x02,0x0D,0x01,0x03,0x01,0x02,0x04,0x60,0x01 }, 61. { 0x06,0x0E,0x2B,0x34,0x01,0x02,0x01,0x01,0x0D,0x01,0x03,0x01,0x15,0x01,0x05,0x00 }, libavformat/mxfenc.c:793:13: Array access: Offset: [-1, 2] Size: 3 791. } 792. } else 793. sc->codec_ul = &mxf_essence_container_uls[sc->index].codec_ul; ^ 794. 795. if (!present[sc->index]) {
https://github.com/libav/libav/blob/f0319383436e1abc3fc1464fe4e5f4dc40db3419/libavformat/mxfenc.c/#L793
d2a_code_trace_data_45631
int ssl3_cbc_copy_mac(unsigned char *out, const SSL3_RECORD *rec, size_t 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 size_t mac_end = rec->length; size_t mac_start = mac_end - md_size; size_t in_mac; size_t scan_start = 0; size_t i, j; size_t rotate_offset; if (!ossl_assert(rec->orig_len >= md_size && md_size <= EVP_MAX_MD_SIZE)) return 0; #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); in_mac = 0; rotate_offset = 0; memset(rotated_mac, 0, md_size); for (i = scan_start, j = 0; i < rec->orig_len; i++) { size_t mac_started = constant_time_eq_s(i, mac_start); size_t mac_ended = constant_time_lt_s(i, mac_end); unsigned char b = rec->data[i]; in_mac |= mac_started; in_mac &= mac_ended; rotate_offset |= j & mac_started; rotated_mac[j++] |= b & in_mac; j &= constant_time_lt_s(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_s(rotate_offset, md_size); } #else memset(out, 0, md_size); rotate_offset = md_size - rotate_offset; rotate_offset &= constant_time_lt_s(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_s(j, rotate_offset); rotate_offset++; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); } #endif return 1; } ssl/record/rec_layer_d1.c:282: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, 17728]):unsigned64 by call to `dtls1_process_record`. Showing all 10 steps of the trace ssl/record/rec_layer_d1.c:224:1: Parameter `s->rlayer.rrec.length` 222. &((s)->rlayer.d->unprocessed_rcds)) 223. 224. > int dtls1_process_buffered_records(SSL *s) 225. { 226. pitem *item; ssl/record/rec_layer_d1.c:282:31: Call 280. } 281. 282. if (!replayok || !dtls1_process_record(s, bitmap)) { ^ 283. if (ossl_statem_in_error(s)) { 284. /* dtls1_process_record called SSLfatal() */ ssl/record/ssl3_record.c:1553:1: Parameter `s->rlayer.rrec.length` 1551. } 1552. 1553. > int dtls1_process_record(SSL *s, DTLS1_BITMAP *bitmap) 1554. { 1555. int i; ssl/record/ssl3_record.c:1689:18: Call 1687. */ 1688. mac = mac_tmp; 1689. if (!ssl3_cbc_copy_mac(mac_tmp, rr, mac_size)) { ^ 1690. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_DTLS1_PROCESS_RECORD, 1691. ERR_R_INTERNAL_ERROR); ssl/record/ssl3_record.c:1478:1: <LHS trace> 1476. #define CBC_MAC_ROTATE_IN_PLACE 1477. 1478. > int ssl3_cbc_copy_mac(unsigned char *out, 1479. const SSL3_RECORD *rec, size_t md_size) 1480. { ssl/record/ssl3_record.c:1478:1: Parameter `rec->length` 1476. #define CBC_MAC_ROTATE_IN_PLACE 1477. 1478. > int ssl3_cbc_copy_mac(unsigned char *out, 1479. const SSL3_RECORD *rec, size_t md_size) 1480. { ssl/record/ssl3_record.c:1491:5: Assignment 1489. * mac_end is the index of |rec->data| just after the end of the MAC. 1490. */ 1491. size_t mac_end = rec->length; ^ 1492. size_t mac_start = mac_end - md_size; 1493. size_t in_mac; ssl/record/ssl3_record.c:1478:1: <RHS trace> 1476. #define CBC_MAC_ROTATE_IN_PLACE 1477. 1478. > int ssl3_cbc_copy_mac(unsigned char *out, 1479. const SSL3_RECORD *rec, size_t md_size) 1480. { ssl/record/ssl3_record.c:1478:1: Parameter `md_size` 1476. #define CBC_MAC_ROTATE_IN_PLACE 1477. 1478. > int ssl3_cbc_copy_mac(unsigned char *out, 1479. const SSL3_RECORD *rec, size_t md_size) 1480. { ssl/record/ssl3_record.c:1492:5: Binary operation: ([0, +oo] - [0, 17728]):unsigned64 by call to `dtls1_process_record` 1490. */ 1491. size_t mac_end = rec->length; 1492. size_t mac_start = mac_end - md_size; ^ 1493. size_t in_mac; 1494. /*
https://github.com/openssl/openssl/blob/a8ea8018fa187e22fb4989450b550589e20f62c2/ssl/record/ssl3_record.c/#L1492
d2a_code_trace_data_45632
DECLAREContigPutFunc(put16bitbwtile) { int samplesperpixel = img->samplesperpixel; uint32** BWmap = img->BWmap; (void) y; while (h-- > 0) { uint16 *wp = (uint16 *) pp; for (x = w; x-- > 0;) { *cp++ = BWmap[*wp >> 8][0]; pp += 2 * samplesperpixel; wp += samplesperpixel; } cp += toskew; pp += fromskew; } } libtiff/tif_getimage.c:1166: error: Integer Overflow L2 ([0, `h`] - 1):unsigned32. libtiff/tif_getimage.c:1160:1: <LHS trace> 1158. * 16-bit greyscale => colormap/RGB 1159. */ 1160. DECLAREContigPutFunc(put16bitbwtile) ^ 1161. { 1162. int samplesperpixel = img->samplesperpixel; libtiff/tif_getimage.c:1160:1: Parameter `h` 1158. * 16-bit greyscale => colormap/RGB 1159. */ 1160. DECLAREContigPutFunc(put16bitbwtile) ^ 1161. { 1162. int samplesperpixel = img->samplesperpixel; libtiff/tif_getimage.c:1166:12: Binary operation: ([0, h] - 1):unsigned32 1164. 1165. (void) y; 1166. while (h-- > 0) { ^ 1167. uint16 *wp = (uint16 *) pp; 1168.
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_getimage.c/#L1166
d2a_code_trace_data_45633
static void ape_parse_tag(AVFormatContext *s) { ByteIOContext *pb = s->pb; int file_size = url_fsize(pb); uint32_t val, fields, tag_bytes; uint8_t buf[8]; int i; if (file_size < APE_TAG_FOOTER_BYTES) return; url_fseek(pb, file_size - APE_TAG_FOOTER_BYTES, SEEK_SET); get_buffer(pb, buf, 8); if (strncmp(buf, "APETAGEX", 8)) { av_log(NULL, AV_LOG_ERROR, "Invalid APE Tags\n"); return; } val = get_le32(pb); if (val > APE_TAG_VERSION) { av_log(NULL, AV_LOG_ERROR, "Unsupported tag version. (>=%d)\n", APE_TAG_VERSION); return; } tag_bytes = get_le32(pb); if (tag_bytes - APE_TAG_FOOTER_BYTES > (1024 * 1024 * 16)) { av_log(NULL, AV_LOG_ERROR, "Tag size is way too big\n"); return; } fields = get_le32(pb); if (fields > 65536) { av_log(NULL, AV_LOG_ERROR, "Too many tag fields (%d)\n", fields); return; } val = get_le32(pb); if (val & APE_TAG_FLAG_IS_HEADER) { av_log(NULL, AV_LOG_ERROR, "APE Tag is a header\n"); return; } if (val & APE_TAG_FLAG_CONTAINS_HEADER) tag_bytes += 2*APE_TAG_FOOTER_BYTES; url_fseek(pb, file_size - tag_bytes, SEEK_SET); for (i=0; i<fields; i++) ape_tag_read_field(s); #if ENABLE_DEBUG av_log(NULL, AV_LOG_DEBUG, "\nAPE Tags:\n\n"); av_log(NULL, AV_LOG_DEBUG, "title = %s\n", s->title); av_log(NULL, AV_LOG_DEBUG, "author = %s\n", s->author); av_log(NULL, AV_LOG_DEBUG, "copyright = %s\n", s->copyright); av_log(NULL, AV_LOG_DEBUG, "comment = %s\n", s->comment); av_log(NULL, AV_LOG_DEBUG, "album = %s\n", s->album); av_log(NULL, AV_LOG_DEBUG, "year = %d\n", s->year); av_log(NULL, AV_LOG_DEBUG, "track = %d\n", s->track); av_log(NULL, AV_LOG_DEBUG, "genre = %s\n", s->genre); #endif } libavformat/ape.c:190: error: Integer Overflow L2 ([32, +oo] - [-oo, 16777312]):unsigned32. libavformat/ape.c:147:21: <LHS trace> 145. { 146. ByteIOContext *pb = s->pb; 147. int file_size = url_fsize(pb); ^ 148. uint32_t val, fields, tag_bytes; 149. uint8_t buf[8]; libavformat/ape.c:147:21: Call 145. { 146. ByteIOContext *pb = s->pb; 147. int file_size = url_fsize(pb); ^ 148. uint32_t val, fields, tag_bytes; 149. uint8_t buf[8]; libavformat/aviobuf.c:194:9: Assignment 192. 193. if(!s) 194. return AVERROR(EINVAL); ^ 195. 196. if (!s->seek) libavformat/ape.c:147:5: Assignment 145. { 146. ByteIOContext *pb = s->pb; 147. int file_size = url_fsize(pb); ^ 148. uint32_t val, fields, tag_bytes; 149. uint8_t buf[8]; libavformat/ape.c:169:17: <RHS trace> 167. } 168. 169. tag_bytes = get_le32(pb); /* tag size */ ^ 170. if (tag_bytes - APE_TAG_FOOTER_BYTES > (1024 * 1024 * 16)) { 171. av_log(NULL, AV_LOG_ERROR, "Tag size is way too big\n"); libavformat/ape.c:169:17: Call 167. } 168. 169. tag_bytes = get_le32(pb); /* tag size */ ^ 170. if (tag_bytes - APE_TAG_FOOTER_BYTES > (1024 * 1024 * 16)) { 171. av_log(NULL, AV_LOG_ERROR, "Tag size is way too big\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/ape.c:169:5: Assignment 167. } 168. 169. tag_bytes = get_le32(pb); /* tag size */ ^ 170. if (tag_bytes - APE_TAG_FOOTER_BYTES > (1024 * 1024 * 16)) { 171. av_log(NULL, AV_LOG_ERROR, "Tag size is way too big\n"); libavformat/ape.c:190:5: Binary operation: ([32, +oo] - [-oo, 16777312]):unsigned32 188. tag_bytes += 2*APE_TAG_FOOTER_BYTES; 189. 190. url_fseek(pb, file_size - tag_bytes, SEEK_SET); ^ 191. 192. for (i=0; i<fields; i++)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/ape.c/#L190
d2a_code_trace_data_45634
static int client_hello_select_server_ctx(SSL *s, void *arg, int ignore) { const char *servername; const unsigned char *p; size_t len, remaining; HANDSHAKE_EX_DATA *ex_data = (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); if (!SSL_client_hello_get0_ext(s, TLSEXT_TYPE_server_name, &p, &remaining) || remaining <= 2) return 0; len = (*(p++) << 8); len += *(p++); if (len + 2 != remaining) return 0; remaining = len; if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name) return 0; remaining--; if (remaining <= 2) return 0; len = (*(p++) << 8); len += *(p++); if (len + 2 > remaining) return 0; remaining = len; servername = (const char *)p; if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) { SSL_CTX *new_ctx = arg; SSL_set_SSL_CTX(s, new_ctx); SSL_clear_options(s, 0xFFFFFFFFL); SSL_set_options(s, SSL_CTX_get_options(new_ctx)); ex_data->servername = SSL_TEST_SERVERNAME_SERVER2; return 1; } else if (len == strlen("server1") && strncmp(servername, "server1", len) == 0) { ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; return 1; } else if (ignore) { ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; return 1; } return 0; } test/handshake_helper.c:196: error: NULL_DEREFERENCE pointer `ex_data` last assigned on line 147 could be null and is dereferenced at line 196, column 9. Showing all 28 steps of the trace test/handshake_helper.c:142:1: start of procedure client_hello_select_server_ctx() 140. } 141. 142. > static int client_hello_select_server_ctx(SSL *s, void *arg, int ignore) 143. { 144. const char *servername; test/handshake_helper.c:147:5: 145. const unsigned char *p; 146. size_t len, remaining; 147. > HANDSHAKE_EX_DATA *ex_data = 148. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); 149. ssl/ssl_lib.c:4014:1: start of procedure SSL_get_ex_data() 4012. } 4013. 4014. > void *SSL_get_ex_data(const SSL *s, int idx) 4015. { 4016. return CRYPTO_get_ex_data(&s->ex_data, idx); ssl/ssl_lib.c:4016:5: 4014. void *SSL_get_ex_data(const SSL *s, int idx) 4015. { 4016. > return CRYPTO_get_ex_data(&s->ex_data, idx); 4017. } 4018. crypto/ex_data.c:393:1: start of procedure CRYPTO_get_ex_data() 391. * particular index in the class used by this variable 392. */ 393. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 394. { 395. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) crypto/ex_data.c:395:9: Taking true branch 393. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 394. { 395. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) ^ 396. return NULL; 397. return sk_void_value(ad->sk, idx); crypto/ex_data.c:396:9: 394. { 395. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) 396. > return NULL; 397. return sk_void_value(ad->sk, idx); 398. } crypto/ex_data.c:398:1: return from a call to CRYPTO_get_ex_data 396. return NULL; 397. return sk_void_value(ad->sk, idx); 398. > } ssl/ssl_lib.c:4017:1: return from a call to SSL_get_ex_data 4015. { 4016. return CRYPTO_get_ex_data(&s->ex_data, idx); 4017. > } 4018. 4019. int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg) test/handshake_helper.c:154:10: Taking false branch 152. * was written, so parsing the normal case is a bit complex. 153. */ 154. if (!SSL_client_hello_get0_ext(s, TLSEXT_TYPE_server_name, &p, ^ 155. &remaining) || 156. remaining <= 2) test/handshake_helper.c:156:9: Taking false branch 154. if (!SSL_client_hello_get0_ext(s, TLSEXT_TYPE_server_name, &p, 155. &remaining) || 156. remaining <= 2) ^ 157. return 0; 158. /* Extract the length of the supplied list of names. */ test/handshake_helper.c:159:5: 157. return 0; 158. /* Extract the length of the supplied list of names. */ 159. > len = (*(p++) << 8); 160. len += *(p++); 161. if (len + 2 != remaining) test/handshake_helper.c:160:5: 158. /* Extract the length of the supplied list of names. */ 159. len = (*(p++) << 8); 160. > len += *(p++); 161. if (len + 2 != remaining) 162. return 0; test/handshake_helper.c:161:9: Taking false branch 159. len = (*(p++) << 8); 160. len += *(p++); 161. if (len + 2 != remaining) ^ 162. return 0; 163. remaining = len; test/handshake_helper.c:163:5: 161. if (len + 2 != remaining) 162. return 0; 163. > remaining = len; 164. /* 165. * The list in practice only has a single element, so we only consider test/handshake_helper.c:168:9: Taking false branch 166. * the first one. 167. */ 168. if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name) ^ 169. return 0; 170. remaining--; test/handshake_helper.c:168:27: Taking false branch 166. * the first one. 167. */ 168. if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name) ^ 169. return 0; 170. remaining--; test/handshake_helper.c:170:5: 168. if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name) 169. return 0; 170. > remaining--; 171. /* Now we can finally pull out the byte array with the actual hostname. */ 172. if (remaining <= 2) test/handshake_helper.c:172:9: Taking false branch 170. remaining--; 171. /* Now we can finally pull out the byte array with the actual hostname. */ 172. if (remaining <= 2) ^ 173. return 0; 174. len = (*(p++) << 8); test/handshake_helper.c:174:5: 172. if (remaining <= 2) 173. return 0; 174. > len = (*(p++) << 8); 175. len += *(p++); 176. if (len + 2 > remaining) test/handshake_helper.c:175:5: 173. return 0; 174. len = (*(p++) << 8); 175. > len += *(p++); 176. if (len + 2 > remaining) 177. return 0; test/handshake_helper.c:176:9: Taking false branch 174. len = (*(p++) << 8); 175. len += *(p++); 176. if (len + 2 > remaining) ^ 177. return 0; 178. remaining = len; test/handshake_helper.c:178:5: 176. if (len + 2 > remaining) 177. return 0; 178. > remaining = len; 179. servername = (const char *)p; 180. test/handshake_helper.c:179:5: 177. return 0; 178. remaining = len; 179. > servername = (const char *)p; 180. 181. if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) { test/handshake_helper.c:181:9: Taking false branch 179. servername = (const char *)p; 180. 181. if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) { ^ 182. SSL_CTX *new_ctx = arg; 183. SSL_set_SSL_CTX(s, new_ctx); test/handshake_helper.c:194:16: Taking true branch 192. ex_data->servername = SSL_TEST_SERVERNAME_SERVER2; 193. return 1; 194. } else if (len == strlen("server1") && ^ 195. strncmp(servername, "server1", len) == 0) { 196. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; test/handshake_helper.c:195:16: Taking true branch 193. return 1; 194. } else if (len == strlen("server1") && 195. strncmp(servername, "server1", len) == 0) { ^ 196. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 197. return 1; test/handshake_helper.c:196:9: 194. } else if (len == strlen("server1") && 195. strncmp(servername, "server1", len) == 0) { 196. > ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 197. return 1; 198. } else if (ignore) {
https://github.com/openssl/openssl/blob/e43e6b1951de931ca500c6964496e76651332f5e/test/handshake_helper.c/#L196
d2a_code_trace_data_45635
static int TIFFWriteDirectoryTagData(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint16 datatype, uint32 count, uint32 datalength, void* data) { static const char module[] = "TIFFWriteDirectoryTagData"; uint32 m; m=0; while (m<(*ndir)) { assert(dir[m].tdir_tag!=tag); if (dir[m].tdir_tag>tag) break; m++; } if (m<(*ndir)) { uint32 n; for (n=*ndir; n>m; n--) dir[n]=dir[n-1]; } dir[m].tdir_tag=tag; dir[m].tdir_type=datatype; dir[m].tdir_count=count; dir[m].tdir_offset.toff_long8 = 0; if (datalength<=((tif->tif_flags&TIFF_BIGTIFF)?0x8U:0x4U)) _TIFFmemcpy(&dir[m].tdir_offset,data,datalength); else { uint64 na,nb; na=tif->tif_dataoff; nb=na+datalength; if (!(tif->tif_flags&TIFF_BIGTIFF)) nb=(uint32)nb; if ((nb<na)||(nb<datalength)) { TIFFErrorExt(tif->tif_clientdata,module,"Maximum TIFF file size exceeded"); return(0); } if (!SeekOK(tif,na)) { TIFFErrorExt(tif->tif_clientdata,module,"IO error writing tag data"); return(0); } assert(datalength<0x80000000UL); if (!WriteOK(tif,data,(tmsize_t)datalength)) { TIFFErrorExt(tif->tif_clientdata,module,"IO error writing tag data"); return(0); } tif->tif_dataoff=nb; if (tif->tif_dataoff&1) tif->tif_dataoff++; if (!(tif->tif_flags&TIFF_BIGTIFF)) { uint32 o; o=(uint32)na; if (tif->tif_flags&TIFF_SWAB) TIFFSwabLong(&o); _TIFFmemcpy(&dir[m].tdir_offset,&o,4); } else { dir[m].tdir_offset.toff_long8 = na; if (tif->tif_flags&TIFF_SWAB) TIFFSwabLong8(&dir[m].tdir_offset.toff_long8); } } (*ndir)++; return(1); } libtiff/tif_dirwrite.c:621: error: Buffer Overrun L3 Offset: [1, +oo] Size: [0, +oo] by call to `TIFFWriteDirectoryTagAscii`. libtiff/tif_dirwrite.c:400:2: Assignment 398. tif->tif_flags &= ~(TIFF_BEENWRITING|TIFF_BUFFERSETUP); 399. } 400. dir=NULL; ^ 401. dirmem=NULL; 402. dirsize=0; libtiff/tif_dirwrite.c:621:15: Call 619. TIFFGetField(tif,o->field_tag,&pb); 620. pa=(uint32)(strlen(pb)); 621. if (!TIFFWriteDirectoryTagAscii(tif,&ndir,dir,o->field_tag,pa,pb)) ^ 622. goto bad; 623. } libtiff/tif_dirwrite.c:926:1: Parameter `*dir` 924. } 925. 926. static int ^ 927. TIFFWriteDirectoryTagAscii(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, char* value) 928. { libtiff/tif_dirwrite.c:934:9: Call 932. return(1); 933. } 934. return(TIFFWriteDirectoryTagCheckedAscii(tif,ndir,dir,tag,count,value)); ^ 935. } 936. libtiff/tif_dirwrite.c:1773:1: Parameter `*dir` 1771. } 1772. 1773. static int ^ 1774. TIFFWriteDirectoryTagCheckedAscii(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, char* value) 1775. { libtiff/tif_dirwrite.c:1777:9: Call 1775. { 1776. assert(sizeof(char)==1); 1777. return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_ASCII,count,count,value)); ^ 1778. } 1779. libtiff/tif_dirwrite.c:2170:1: <Offset trace> 2168. } 2169. 2170. static int ^ 2171. TIFFWriteDirectoryTagData(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint16 datatype, uint32 count, uint32 datalength, void* data) 2172. { libtiff/tif_dirwrite.c:2170:1: Parameter `*ndir` 2168. } 2169. 2170. static int ^ 2171. TIFFWriteDirectoryTagData(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint16 datatype, uint32 count, uint32 datalength, void* data) 2172. { libtiff/tif_dirwrite.c:2170:1: <Length trace> 2168. } 2169. 2170. static int ^ 2171. TIFFWriteDirectoryTagData(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint16 datatype, uint32 count, uint32 datalength, void* data) 2172. { libtiff/tif_dirwrite.c:2170:1: Parameter `*dir` 2168. } 2169. 2170. static int ^ 2171. TIFFWriteDirectoryTagData(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint16 datatype, uint32 count, uint32 datalength, void* data) 2172. { libtiff/tif_dirwrite.c:2187:4: Array access: Offset: [1, +oo] Size: [0, +oo] by call to `TIFFWriteDirectoryTagAscii` 2185. uint32 n; 2186. for (n=*ndir; n>m; n--) 2187. dir[n]=dir[n-1]; ^ 2188. } 2189. dir[m].tdir_tag=tag;
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_dirwrite.c/#L2187
d2a_code_trace_data_45636
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:3781: error: MEMORY_LEAK memory dynamically allocated to `*hash` by call to `EVP_MD_CTX_new()` at line 3778, column 13 is not reachable after line 3781, column 9. Showing all 49 steps of the trace ssl/ssl_lib.c:3775:1: start of procedure ssl_replace_hash() 3773. */ 3774. 3775. > EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md) 3776. { 3777. ssl_clear_hash_ctx(hash); ssl/ssl_lib.c:3777:5: 3775. EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md) 3776. { 3777. > ssl_clear_hash_ctx(hash); 3778. *hash = EVP_MD_CTX_new(); 3779. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ssl/ssl_lib.c:3787:1: start of procedure ssl_clear_hash_ctx() 3785. } 3786. 3787. > void ssl_clear_hash_ctx(EVP_MD_CTX **hash) 3788. { 3789. ssl/ssl_lib.c:3790:5: 3788. { 3789. 3790. > EVP_MD_CTX_free(*hash); 3791. *hash = NULL; 3792. } 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:253:1: start of procedure CRYPTO_free() 251. } 252. 253. > void CRYPTO_free(void *str, const char *file, int line) 254. { 255. if (free_impl != NULL && free_impl != &CRYPTO_free) { crypto/mem.c:255:9: Taking false branch 253. void CRYPTO_free(void *str, const char *file, int line) 254. { 255. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 256. free_impl(str, file, line); 257. return; crypto/mem.c:269:5: 267. } 268. #else 269. > free(str); 270. #endif 271. } crypto/mem.c:271:1: return from a call to CRYPTO_free 269. free(str); 270. #endif 271. > } 272. 273. 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:3791:5: 3789. 3790. EVP_MD_CTX_free(*hash); 3791. > *hash = NULL; 3792. } 3793. ssl/ssl_lib.c:3792:1: return from a call to ssl_clear_hash_ctx 3790. EVP_MD_CTX_free(*hash); 3791. *hash = NULL; 3792. > } 3793. 3794. /* Retrieve handshake hashes */ ssl/ssl_lib.c:3778:5: 3776. { 3777. ssl_clear_hash_ctx(hash); 3778. > *hash = EVP_MD_CTX_new(); 3779. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { 3780. 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:186:1: start of procedure CRYPTO_zalloc() 184. } 185. 186. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:188:5: 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. > void *ret = CRYPTO_malloc(num, file, line); 189. 190. FAILTEST(); crypto/mem.c:158:1: start of procedure CRYPTO_malloc() 156. #endif 157. 158. > void *CRYPTO_malloc(size_t num, const char *file, int line) 159. { 160. void *ret = NULL; crypto/mem.c:160:5: 158. void *CRYPTO_malloc(size_t num, const char *file, int line) 159. { 160. > void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:162:9: Taking false branch 160. void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 163. return malloc_impl(num, file, line); 164. crypto/mem.c:165:9: Taking false branch 163. return malloc_impl(num, file, line); 164. 165. if (num == 0) ^ 166. return NULL; 167. crypto/mem.c:169:5: 167. 168. FAILTEST(); 169. > allow_customize = 0; 170. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 171. if (call_malloc_debug) { crypto/mem.c:179:5: 177. } 178. #else 179. > osslargused(file); osslargused(line); 180. ret = malloc(num); 181. #endif crypto/mem.c:179:24: 177. } 178. #else 179. > osslargused(file); osslargused(line); 180. ret = malloc(num); 181. #endif crypto/mem.c:180:5: 178. #else 179. osslargused(file); osslargused(line); 180. > ret = malloc(num); 181. #endif 182. crypto/mem.c:183:5: 181. #endif 182. 183. > return ret; 184. } 185. crypto/mem.c:184:1: return from a call to CRYPTO_malloc 182. 183. return ret; 184. > } 185. 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:191:9: Taking true branch 189. 190. FAILTEST(); 191. if (ret != NULL) ^ 192. memset(ret, 0, num); 193. return ret; crypto/mem.c:192:9: 190. FAILTEST(); 191. if (ret != NULL) 192. > memset(ret, 0, num); 193. return ret; 194. } crypto/mem.c:193:5: 191. if (ret != NULL) 192. memset(ret, 0, num); 193. > return ret; 194. } 195. crypto/mem.c:194:1: return from a call to CRYPTO_zalloc 192. memset(ret, 0, num); 193. return ret; 194. > } 195. 196. 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:3779:9: Taking false branch 3777. ssl_clear_hash_ctx(hash); 3778. *hash = EVP_MD_CTX_new(); 3779. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ^ 3780. EVP_MD_CTX_free(*hash); 3781. *hash = NULL; ssl/ssl_lib.c:3779:27: Taking true branch 3777. ssl_clear_hash_ctx(hash); 3778. *hash = EVP_MD_CTX_new(); 3779. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ^ 3780. EVP_MD_CTX_free(*hash); 3781. *hash = NULL; ssl/ssl_lib.c:3779:33: Taking true branch 3777. ssl_clear_hash_ctx(hash); 3778. *hash = EVP_MD_CTX_new(); 3779. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ^ 3780. EVP_MD_CTX_free(*hash); 3781. *hash = NULL; ssl/ssl_lib.c:3780:9: 3778. *hash = EVP_MD_CTX_new(); 3779. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { 3780. > EVP_MD_CTX_free(*hash); 3781. *hash = NULL; 3782. 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:253:1: start of procedure CRYPTO_free() 251. } 252. 253. > void CRYPTO_free(void *str, const char *file, int line) 254. { 255. if (free_impl != NULL && free_impl != &CRYPTO_free) { crypto/mem.c:255:9: Taking true branch 253. void CRYPTO_free(void *str, const char *file, int line) 254. { 255. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 256. free_impl(str, file, line); 257. return; crypto/mem.c:255:30: Taking true branch 253. void CRYPTO_free(void *str, const char *file, int line) 254. { 255. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 256. free_impl(str, file, line); 257. return; crypto/mem.c:256:9: Skipping __function_pointer__(): unresolved function pointer 254. { 255. if (free_impl != NULL && free_impl != &CRYPTO_free) { 256. free_impl(str, file, line); ^ 257. return; 258. } crypto/mem.c:257:9: 255. if (free_impl != NULL && free_impl != &CRYPTO_free) { 256. free_impl(str, file, line); 257. > return; 258. } 259. crypto/mem.c:271:1: return from a call to CRYPTO_free 269. free(str); 270. #endif 271. > } 272. 273. 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:3781:9: 3779. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { 3780. EVP_MD_CTX_free(*hash); 3781. > *hash = NULL; 3782. return NULL; 3783. }
https://github.com/openssl/openssl/blob/b169c0ec40408566270fb638bcbfab01a0d2dc60/ssl/ssl_lib.c/#L3781
d2a_code_trace_data_45637
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/core/ngx_inet.c:558: error: Buffer Overrun L3 Offset: [0, 65535] Size: [6, +oo] by call to `ngx_inet_resolve_host`. src/core/ngx_inet.c:502:9: Assignment 500. 501. if (len == 1 && *host == '*') { 502. len = 0; ^ 503. } 504. src/core/ngx_inet.c:505:5: Assignment 503. } 504. 505. u->host.len = len; ^ 506. u->host.data = host; 507. src/core/ngx_inet.c:558:9: Call 556. } 557. 558. if (ngx_inet_resolve_host(pool, u) != NGX_OK) { ^ 559. return NGX_ERROR; 560. } src/core/ngx_inet.c:688:1: Parameter `u->host.len` 686. 687. 688. ngx_int_t ^ 689. ngx_inet_resolve_host(ngx_pool_t *pool, ngx_url_t *u) 690. { src/core/ngx_inet.c:790:13: Call 788. u->addrs[0].socklen = sizeof(struct sockaddr_in); 789. 790. p = ngx_pnalloc(pool, u->host.len + sizeof(":65535") - 1); ^ 791. if (p == NULL) { 792. return NGX_ERROR; src/core/ngx_palloc.c:155:13: Assignment 153. 154. do { 155. m = p->d.last; ^ 156. 157. if ((size_t) (p->d.end - m) >= size) { src/core/ngx_palloc.c:160:17: Assignment 158. p->d.last = m + size; 159. 160. return m; ^ 161. } 162. src/core/ngx_inet.c:790:9: Assignment 788. u->addrs[0].socklen = sizeof(struct sockaddr_in); 789. 790. p = ngx_pnalloc(pool, u->host.len + sizeof(":65535") - 1); ^ 791. if (p == NULL) { 792. return NGX_ERROR; src/core/ngx_inet.c:795:32: Call 793. } 794. 795. u->addrs[0].name.len = ngx_sprintf(p, "%V:%d", ^ 796. &u->host, ntohs(port)) - p; 797. u->addrs[0].name.data = p; src/core/ngx_string.c:95:1: Parameter `*buf` 93. 94. 95. u_char * ngx_cdecl ^ 96. ngx_sprintf(u_char *buf, const char *fmt, ...) 97. { src/core/ngx_string.c:102:9: Call 100. 101. va_start(args, fmt); 102. p = ngx_vsnprintf(buf, /* STUB */ 65536, fmt, args); ^ 103. va_end(args); 104. 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, 65535] Size: [6, +oo] by call to `ngx_inet_resolve_host` 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_45638
static int decode_header_trees(SmackVContext *smk) { GetBitContext gb; int mmap_size, mclr_size, full_size, type_size; mmap_size = AV_RL32(smk->avctx->extradata); mclr_size = AV_RL32(smk->avctx->extradata + 4); full_size = AV_RL32(smk->avctx->extradata + 8); type_size = AV_RL32(smk->avctx->extradata + 12); init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8); if(!get_bits1(&gb)) { av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n"); smk->mmap_tbl = av_malloc(sizeof(int) * 2); smk->mmap_tbl[0] = 0; smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1; } else { if (smacker_decode_header_tree(smk, &gb, &smk->mmap_tbl, smk->mmap_last, mmap_size)) return -1; } if(!get_bits1(&gb)) { av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n"); smk->mclr_tbl = av_malloc(sizeof(int) * 2); smk->mclr_tbl[0] = 0; smk->mclr_last[0] = smk->mclr_last[1] = smk->mclr_last[2] = 1; } else { if (smacker_decode_header_tree(smk, &gb, &smk->mclr_tbl, smk->mclr_last, mclr_size)) return -1; } if(!get_bits1(&gb)) { av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n"); smk->full_tbl = av_malloc(sizeof(int) * 2); smk->full_tbl[0] = 0; smk->full_last[0] = smk->full_last[1] = smk->full_last[2] = 1; } else { if (smacker_decode_header_tree(smk, &gb, &smk->full_tbl, smk->full_last, full_size)) return -1; } if(!get_bits1(&gb)) { av_log(smk->avctx, AV_LOG_INFO, "Skipping TYPE tree\n"); smk->type_tbl = av_malloc(sizeof(int) * 2); smk->type_tbl[0] = 0; smk->type_last[0] = smk->type_last[1] = smk->type_last[2] = 1; } else { if (smacker_decode_header_tree(smk, &gb, &smk->type_tbl, smk->type_last, type_size)) return -1; } return 0; } libavcodec/smacker.c:289: error: Null Dereference pointer `&gb->buffer` last assigned on line 287 could be null and is dereferenced by call to `get_bits1()` at line 289, column 9. libavcodec/smacker.c:278:1: start of procedure decode_header_trees() 276. } 277. 278. static int decode_header_trees(SmackVContext *smk) { ^ 279. GetBitContext gb; 280. int mmap_size, mclr_size, full_size, type_size; libavcodec/smacker.c:282:5: 280. int mmap_size, mclr_size, full_size, type_size; 281. 282. mmap_size = AV_RL32(smk->avctx->extradata); ^ 283. mclr_size = AV_RL32(smk->avctx->extradata + 4); 284. full_size = AV_RL32(smk->avctx->extradata + 8); libavcodec/smacker.c:283:5: 281. 282. mmap_size = AV_RL32(smk->avctx->extradata); 283. mclr_size = AV_RL32(smk->avctx->extradata + 4); ^ 284. full_size = AV_RL32(smk->avctx->extradata + 8); 285. type_size = AV_RL32(smk->avctx->extradata + 12); libavcodec/smacker.c:284:5: 282. mmap_size = AV_RL32(smk->avctx->extradata); 283. mclr_size = AV_RL32(smk->avctx->extradata + 4); 284. full_size = AV_RL32(smk->avctx->extradata + 8); ^ 285. type_size = AV_RL32(smk->avctx->extradata + 12); 286. libavcodec/smacker.c:285:5: 283. mclr_size = AV_RL32(smk->avctx->extradata + 4); 284. full_size = AV_RL32(smk->avctx->extradata + 8); 285. type_size = AV_RL32(smk->avctx->extradata + 12); ^ 286. 287. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8); libavcodec/smacker.c:287:5: 285. type_size = AV_RL32(smk->avctx->extradata + 12); 286. 287. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8); ^ 288. 289. if(!get_bits1(&gb)) { libavcodec/get_bits.h:383:1: start of procedure init_get_bits() 381. * responsible for checking for the buffer end yourself (take advantage of the padding)! 382. */ 383. static inline void init_get_bits(GetBitContext *s, ^ 384. const uint8_t *buffer, int bit_size) 385. { libavcodec/get_bits.h:386:5: 384. const uint8_t *buffer, int bit_size) 385. { 386. int buffer_size = (bit_size+7)>>3; ^ 387. if (buffer_size < 0 || bit_size < 0) { 388. buffer_size = bit_size = 0; libavcodec/get_bits.h:387:9: Taking true branch 385. { 386. int buffer_size = (bit_size+7)>>3; 387. if (buffer_size < 0 || bit_size < 0) { ^ 388. buffer_size = bit_size = 0; 389. buffer = NULL; libavcodec/get_bits.h:388:9: 386. int buffer_size = (bit_size+7)>>3; 387. if (buffer_size < 0 || bit_size < 0) { 388. buffer_size = bit_size = 0; ^ 389. buffer = NULL; 390. } libavcodec/get_bits.h:389:9: 387. if (buffer_size < 0 || bit_size < 0) { 388. buffer_size = bit_size = 0; 389. buffer = NULL; ^ 390. } 391. libavcodec/get_bits.h:392:5: 390. } 391. 392. s->buffer = buffer; ^ 393. s->size_in_bits = bit_size; 394. s->buffer_end = buffer + buffer_size; libavcodec/get_bits.h:393:5: 391. 392. s->buffer = buffer; 393. s->size_in_bits = bit_size; ^ 394. s->buffer_end = buffer + buffer_size; 395. #ifdef ALT_BITSTREAM_READER libavcodec/get_bits.h:394:5: 392. s->buffer = buffer; 393. s->size_in_bits = bit_size; 394. s->buffer_end = buffer + buffer_size; ^ 395. #ifdef ALT_BITSTREAM_READER 396. s->index = 0; libavcodec/get_bits.h:396:5: 394. s->buffer_end = buffer + buffer_size; 395. #ifdef ALT_BITSTREAM_READER 396. s->index = 0; ^ 397. #elif defined A32_BITSTREAM_READER 398. s->buffer_ptr = (uint32_t*)((intptr_t)buffer & ~3); libavcodec/get_bits.h:402:1: return from a call to init_get_bits 400. skip_bits_long(s, 0); 401. #endif 402. } ^ 403. 404. static inline void align_get_bits(GetBitContext *s) libavcodec/smacker.c:289:9: 287. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8); 288. 289. if(!get_bits1(&gb)) { ^ 290. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n"); 291. smk->mmap_tbl = av_malloc(sizeof(int) * 2); libavcodec/get_bits.h:303:1: start of procedure get_bits1() 301. } 302. 303. static inline unsigned int get_bits1(GetBitContext *s){ ^ 304. #ifdef ALT_BITSTREAM_READER 305. unsigned int index = s->index; libavcodec/get_bits.h:305:5: 303. static inline unsigned int get_bits1(GetBitContext *s){ 304. #ifdef ALT_BITSTREAM_READER 305. unsigned int index = s->index; ^ 306. uint8_t result = s->buffer[index>>3]; 307. #ifdef ALT_BITSTREAM_READER_LE libavcodec/get_bits.h:306:5: 304. #ifdef ALT_BITSTREAM_READER 305. unsigned int index = s->index; 306. uint8_t result = s->buffer[index>>3]; ^ 307. #ifdef ALT_BITSTREAM_READER_LE 308. result >>= index & 7;
https://github.com/libav/libav/blob/d7d2f0e63c8187d531168256a0ce2aac21d5fce6/libavcodec/smacker.c/#L289
d2a_code_trace_data_45639
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dsa/dsa_ossl.c:376: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_inverse`. Showing all 20 steps of the trace crypto/dsa/dsa_ossl.c:376:10: Call 374. * Calculate W = inv(S) mod Q save W in u2 375. */ 376. if ((BN_mod_inverse(u2, sig->s, dsa->q, ctx)) == NULL) ^ 377. goto err; 378. crypto/bn/bn_gcd.c:226:1: Parameter `ctx->stack.depth` 224. BN_CTX *ctx); 225. 226. > BIGNUM *BN_mod_inverse(BIGNUM *in, 227. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 228. { crypto/bn/bn_gcd.c:231:10: Call 229. BIGNUM *rv; 230. int noinv; 231. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv); ^ 232. if (noinv) 233. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); crypto/bn/bn_gcd.c:237:1: Parameter `ctx->stack.depth` 235. } 236. 237. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 238. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 239. int *pnoinv) crypto/bn/bn_gcd.c:250:16: Call 248. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) 249. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) { 250. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 251. } 252. crypto/bn/bn_gcd.c:557:1: Parameter `ctx->stack.depth` 555. * not contain branches that may leak sensitive information. 556. */ 557. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 558. const BIGNUM *a, const BIGNUM *n, 559. BN_CTX *ctx) crypto/bn/bn_gcd.c:568:5: Call 566. bn_check_top(n); 567. 568. BN_CTX_start(ctx); ^ 569. A = BN_CTX_get(ctx); 570. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gcd.c:603:18: Call 601. BN_init(&local_B); 602. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME); 603. if (!BN_nnmod(B, &local_B, A, ctx)) ^ 604. goto err; 605. /* Ensure local_B goes out of scope before any further use of B */ crypto/bn/bn_mod.c:119:1: Parameter `ctx->stack.depth` 117. #include "bn_lcl.h" 118. 119. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 120. { 121. /* crypto/bn/bn_mod.c:126:11: Call 124. */ 125. 126. if (!(BN_mod(r, m, d, ctx))) ^ 127. return 0; 128. if (!r->neg) crypto/bn/bn_div.c:189:1: Parameter `ctx->stack.depth` 187. * If 'dv' or 'rm' is NULL, the respective value is not returned. 188. */ 189. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 190. BN_CTX *ctx) 191. { crypto/bn/bn_div.c:242:5: Call 240. } 241. 242. BN_CTX_start(ctx); ^ 243. tmp = BN_CTX_get(ctx); 244. snum = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:469:5: Call 467. if (no_branch) 468. bn_correct_top(res); 469. BN_CTX_end(ctx); ^ 470. return (1); 471. err: crypto/bn/bn_ctx.c:250:1: Parameter `ctx->stack.depth` 248. } 249. 250. > void BN_CTX_end(BN_CTX *ctx) 251. { 252. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:256:27: Call 254. ctx->err_stack--; 255. else { 256. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 257. /* Does this stack frame have anything to release? */ 258. if (fp < ctx->used) crypto/bn/bn_ctx.c:326:1: <LHS trace> 324. } 325. 326. > static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:326:1: Parameter `st->depth` 324. } 325. 326. > static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:328:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_inverse` 326. static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; ^ 329. } 330.
https://github.com/openssl/openssl/blob/e113c9c59dcb419dd00525cec431edb854a6c897/crypto/bn/bn_ctx.c/#L328
d2a_code_trace_data_45640
static void new_subtitle_stream(AVFormatContext *oc, int file_idx) { AVStream *st; AVOutputStream *ost; AVCodec *codec=NULL; AVCodecContext *subtitle_enc; st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); if (!st) { fprintf(stderr, "Could not alloc stream\n"); ffmpeg_exit(1); } ost = new_output_stream(oc, file_idx); subtitle_enc = st->codec; output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); if(!subtitle_stream_copy){ subtitle_enc->codec_id = find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 1, avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->strict_std_compliance); codec= output_codecs[nb_output_codecs-1] = avcodec_find_encoder_by_name(subtitle_codec_name); } avcodec_get_context_defaults3(st->codec, codec); ost->bitstream_filters = subtitle_bitstream_filters; subtitle_bitstream_filters= NULL; subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE; if(subtitle_codec_tag) subtitle_enc->codec_tag= subtitle_codec_tag; if (subtitle_stream_copy) { st->stream_copy = 1; } else { set_context_opts(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM, codec); } if (subtitle_language) { av_metadata_set2(&st->metadata, "language", subtitle_language, 0); av_freep(&subtitle_language); } subtitle_disable = 0; av_freep(&subtitle_codec_name); subtitle_stream_copy = 0; } ffmpeg.c:3475: error: Null Dereference pointer `st` last assigned on line 3469 could be null and is dereferenced at line 3475, column 20. ffmpeg.c:3462:1: start of procedure new_subtitle_stream() 3460. } 3461. 3462. static void new_subtitle_stream(AVFormatContext *oc, int file_idx) ^ 3463. { 3464. AVStream *st; ffmpeg.c:3466:5: 3464. AVStream *st; 3465. AVOutputStream *ost; 3466. AVCodec *codec=NULL; ^ 3467. AVCodecContext *subtitle_enc; 3468. ffmpeg.c:3469:28: Condition is true 3467. AVCodecContext *subtitle_enc; 3468. 3469. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); ^ 3470. if (!st) { 3471. fprintf(stderr, "Could not alloc stream\n"); ffmpeg.c:3469:5: 3467. AVCodecContext *subtitle_enc; 3468. 3469. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); ^ 3470. if (!st) { 3471. fprintf(stderr, "Could not alloc stream\n"); libavformat/utils.c:2517:1: start of procedure av_new_stream() 2515. } 2516. 2517. AVStream *av_new_stream(AVFormatContext *s, int id) ^ 2518. { 2519. AVStream *st; libavformat/utils.c:2523:9: Taking true branch 2521. 2522. #if FF_API_MAX_STREAMS 2523. if (s->nb_streams >= MAX_STREAMS){ ^ 2524. av_log(s, AV_LOG_ERROR, "Too many streams\n"); 2525. return NULL; libavformat/utils.c:2524:9: Skipping av_log(): empty list of specs 2522. #if FF_API_MAX_STREAMS 2523. if (s->nb_streams >= MAX_STREAMS){ 2524. av_log(s, AV_LOG_ERROR, "Too many streams\n"); ^ 2525. return NULL; 2526. } libavformat/utils.c:2525:9: 2523. if (s->nb_streams >= MAX_STREAMS){ 2524. av_log(s, AV_LOG_ERROR, "Too many streams\n"); 2525. return NULL; ^ 2526. } 2527. #else libavformat/utils.c:2574:1: return from a call to av_new_stream 2572. s->streams[s->nb_streams++] = st; 2573. return st; 2574. } ^ 2575. 2576. AVProgram *av_new_program(AVFormatContext *ac, int id) ffmpeg.c:3470:10: Taking true branch 3468. 3469. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); 3470. if (!st) { ^ 3471. fprintf(stderr, "Could not alloc stream\n"); 3472. ffmpeg_exit(1); ffmpeg.c:3471:9: 3469. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); 3470. if (!st) { 3471. fprintf(stderr, "Could not alloc stream\n"); ^ 3472. ffmpeg_exit(1); 3473. } ffmpeg.c:3472:9: Skipping ffmpeg_exit(): empty list of specs 3470. if (!st) { 3471. fprintf(stderr, "Could not alloc stream\n"); 3472. ffmpeg_exit(1); ^ 3473. } 3474. ost = new_output_stream(oc, file_idx); ffmpeg.c:3474:5: Skipping new_output_stream(): empty list of specs 3472. ffmpeg_exit(1); 3473. } 3474. ost = new_output_stream(oc, file_idx); ^ 3475. subtitle_enc = st->codec; 3476. output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); ffmpeg.c:3475:5: 3473. } 3474. ost = new_output_stream(oc, file_idx); 3475. subtitle_enc = st->codec; ^ 3476. output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); 3477. if(!subtitle_stream_copy){
https://github.com/libav/libav/blob/eced8fa02ea237abd9c6a6e9287bb7524addb8f4/ffmpeg.c/#L3475
d2a_code_trace_data_45641
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:4063: error: NULL_DEREFERENCE pointer `null` is dereferenced by call to `ssl_security_cert()` at line 4063, column 10. Showing all 4 steps of the trace ssl/t1_lib.c:4054:1: start of procedure ssl_security_cert_chain() 4052. */ 4053. 4054. > int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *x, int vfy) 4055. { 4056. int rv, start_idx, i; ssl/t1_lib.c:4057:9: Taking false branch 4055. { 4056. int rv, start_idx, i; 4057. if (x == NULL) { ^ 4058. x = sk_X509_value(sk, 0); 4059. start_idx = 1; ssl/t1_lib.c:4061:9: 4059. start_idx = 1; 4060. } else 4061. > start_idx = 0; 4062. 4063. rv = ssl_security_cert(s, NULL, x, vfy, 1); ssl/t1_lib.c:4063:5: 4061. start_idx = 0; 4062. 4063. > rv = ssl_security_cert(s, NULL, x, vfy, 1); 4064. if (rv != 1) 4065. return rv;
https://github.com/openssl/openssl/blob/70c22888c1648fe8652e77107f3c74bf2212de36/ssl/t1_lib.c/#L4063
d2a_code_trace_data_45642
int asn1_time_to_tm(struct tm *tm, const ASN1_TIME *d) { static const int min[9] = { 0, 0, 1, 1, 0, 0, 0, 0, 0 }; static const int max[9] = { 99, 99, 12, 31, 23, 59, 59, 12, 59 }; static const int mdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; char *a; int n, i, i2, l, o, min_l = 11, strict = 0, end = 6, btz = 5, md; struct tm tmp; if (d->type == V_ASN1_UTCTIME) { if (d->flags & ASN1_STRING_FLAG_X509_TIME) { min_l = 13; strict = 1; } } else if (d->type == V_ASN1_GENERALIZEDTIME) { end = 7; btz = 6; if (d->flags & ASN1_STRING_FLAG_X509_TIME) { min_l = 15; strict = 1; } else { min_l = 13; } } else { return 0; } l = d->length; a = (char *)d->data; o = 0; memset(&tmp, 0, sizeof(tmp)); if (l < min_l) goto err; for (i = 0; i < end; i++) { if (!strict && (i == btz) && ((a[o] == 'Z') || (a[o] == '+') || (a[o] == '-'))) { i++; break; } if ((a[o] < '0') || (a[o] > '9')) goto err; n = a[o] - '0'; if (++o == l) goto err; if ((a[o] < '0') || (a[o] > '9')) goto err; n = (n * 10) + a[o] - '0'; if (++o == l) goto err; i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i; if ((n < min[i2]) || (n > max[i2])) goto err; switch (i2) { case 0: tmp.tm_year = n * 100 - 1900; break; case 1: if (d->type == V_ASN1_UTCTIME) tmp.tm_year = n < 50 ? n + 100 : n; else tmp.tm_year += n; break; case 2: tmp.tm_mon = n - 1; break; case 3: if (tmp.tm_mon == 1) { md = mdays[1] + leap_year(tmp.tm_year + 1900); } else { md = mdays[tmp.tm_mon]; } if (n > md) goto err; tmp.tm_mday = n; break; case 4: tmp.tm_hour = n; break; case 5: tmp.tm_min = n; break; case 6: tmp.tm_sec = n; break; } } if (d->type == V_ASN1_GENERALIZEDTIME && a[o] == '.') { if (strict) goto err; if (++o == l) goto err; i = o; while ((o < l) && (a[o] >= '0') && (a[o] <= '9')) o++; if (i == o) goto err; if (o == l) goto err; } if (a[o] == 'Z') { o++; } else if (!strict && ((a[o] == '+') || (a[o] == '-'))) { int offsign = a[o] == '-' ? 1 : -1; int offset = 0; o++; if (o + 4 != l) goto err; for (i = end; i < end + 2; i++) { if ((a[o] < '0') || (a[o] > '9')) goto err; n = a[o] - '0'; o++; if ((a[o] < '0') || (a[o] > '9')) goto err; n = (n * 10) + a[o] - '0'; i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i; if ((n < min[i2]) || (n > max[i2])) goto err; if (tm != NULL) { if (i == end) offset = n * 3600; else if (i == end + 1) offset += n * 60; } o++; } if (offset && !OPENSSL_gmtime_adj(&tmp, 0, offset * offsign)) goto err; } else { goto err; } if (o == l) { if (tm != NULL) *tm = tmp; return 1; } err: return 0; } crypto/asn1/a_time.c:193: error: BUFFER_OVERRUN_L2 Offset: [6, 9] Size: 9. Showing all 7 steps of the trace crypto/asn1/a_time.c:40:5: <Offset trace> 38. static const int mdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 39. char *a; 40. int n, i, i2, l, o, min_l = 11, strict = 0, end = 6, btz = 5, md; ^ 41. struct tm tmp; 42. crypto/asn1/a_time.c:40:5: Assignment 38. static const int mdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 39. char *a; 40. int n, i, i2, l, o, min_l = 11, strict = 0, end = 6, btz = 5, md; ^ 41. struct tm tmp; 42. crypto/asn1/a_time.c:192:18: Assignment 190. goto err; 191. n = (n * 10) + a[o] - '0'; 192. i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i; ^ 193. if ((n < min[i2]) || (n > max[i2])) 194. goto err; crypto/asn1/a_time.c:192:13: Assignment 190. goto err; 191. n = (n * 10) + a[o] - '0'; 192. i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i; ^ 193. if ((n < min[i2]) || (n > max[i2])) 194. goto err; crypto/asn1/a_time.c:36:5: <Length trace> 34. int asn1_time_to_tm(struct tm *tm, const ASN1_TIME *d) 35. { 36. static const int min[9] = { 0, 0, 1, 1, 0, 0, 0, 0, 0 }; ^ 37. static const int max[9] = { 99, 99, 12, 31, 23, 59, 59, 12, 59 }; 38. static const int mdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; crypto/asn1/a_time.c:36:5: Array declaration 34. int asn1_time_to_tm(struct tm *tm, const ASN1_TIME *d) 35. { 36. static const int min[9] = { 0, 0, 1, 1, 0, 0, 0, 0, 0 }; ^ 37. static const int max[9] = { 99, 99, 12, 31, 23, 59, 59, 12, 59 }; 38. static const int mdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; crypto/asn1/a_time.c:193:22: Array access: Offset: [6, 9] Size: 9 191. n = (n * 10) + a[o] - '0'; 192. i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i; 193. if ((n < min[i2]) || (n > max[i2])) ^ 194. goto err; 195. /* if tm is NULL, no need to adjust */
https://github.com/openssl/openssl/blob/3d0f1cb9fdd630c6c920bc97bf496538717e7705/crypto/asn1/a_time.c/#L193
d2a_code_trace_data_45643
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_prime.c:217: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_MONT_CTX_set`. Showing all 28 steps of the trace crypto/bn/bn_prime.c:153:1: Parameter `ctx_passed->stack.depth` 151. } 152. 153. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 154. int do_trial_division, BN_GENCB *cb) 155. { crypto/bn/bn_prime.c:188:5: Call 186. else if ((ctx = BN_CTX_new()) == NULL) 187. goto err; 188. BN_CTX_start(ctx); ^ 189. 190. A1 = 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_prime.c:217:10: Call 215. if (mont == NULL) 216. goto err; 217. if (!BN_MONT_CTX_set(mont, a, ctx)) ^ 218. goto err; 219. crypto/bn/bn_mont.c:247:1: Parameter `ctx->stack.depth` 245. } 246. 247. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 248. { 249. int ret = 0; crypto/bn/bn_mont.c:255:5: Call 253. return 0; 254. 255. BN_CTX_start(ctx); ^ 256. if ((Ri = BN_CTX_get(ctx)) == NULL) 257. goto err; 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_mont.c:326:14: Call 324. tmod.top = buf[0] != 0 ? 1 : 0; 325. /* Ri = R^-1 mod N */ 326. if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL) ^ 327. goto err; 328. if (!BN_lshift(Ri, Ri, BN_BITS2)) crypto/bn/bn_gcd.c:124:1: Parameter `ctx->stack.depth` 122. BN_CTX *ctx); 123. 124. > BIGNUM *BN_mod_inverse(BIGNUM *in, 125. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 126. { crypto/bn/bn_gcd.c:129:10: Call 127. BIGNUM *rv; 128. int noinv; 129. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv); ^ 130. if (noinv) 131. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); crypto/bn/bn_gcd.c:135:1: Parameter `ctx->stack.depth` 133. } 134. 135. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 136. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 137. int *pnoinv) crypto/bn/bn_gcd.c:148:16: Call 146. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) 147. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) { 148. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 149. } 150. crypto/bn/bn_gcd.c:451:1: Parameter `ctx->stack.depth` 449. * not contain branches that may leak sensitive information. 450. */ 451. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 452. const BIGNUM *a, const BIGNUM *n, 453. BN_CTX *ctx) crypto/bn/bn_gcd.c:462:5: Call 460. bn_check_top(n); 461. 462. BN_CTX_start(ctx); ^ 463. A = BN_CTX_get(ctx); 464. B = 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_gcd.c:497:18: Call 495. bn_init(&local_B); 496. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME); 497. if (!BN_nnmod(B, &local_B, A, ctx)) ^ 498. goto err; 499. /* Ensure local_B goes out of scope before any further use of B */ 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_MONT_CTX_set` 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/757264207ad8650a89ea903d48ad89f61d56ea9c/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_45644
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); } apps/ca.c:2074: error: BUFFER_OVERRUN_L3 Offset: [-529, +oo] Size: 12 by call to `X509_print_ex`. Showing all 13 steps of the trace apps/ca.c:2064:14: Call 2062. /* Set the right value for the noemailDN option */ 2063. if (email_dn == 0) { 2064. if (!X509_set_subject_name(ret, dn_subject)) ^ 2065. goto err; 2066. } crypto/x509/x509_set.c:106:1: Parameter `*x->cert_info->subject` 104. } 105. 106. > int X509_set_subject_name(X509 *x, X509_NAME *name) 107. { 108. if ((x == NULL) || (x->cert_info == NULL)) apps/ca.c:2074:9: Call 2072. */ 2073. certopt |= X509_FLAG_NO_SIGDUMP | X509_FLAG_NO_SIGNAME; 2074. X509_print_ex(bio_err, ret, nameopt, certopt); ^ 2075. } 2076. crypto/asn1/t_x509.c:105:1: Parameter `*x->cert_info->validity->notBefore->data` 103. } 104. 105. > int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, 106. unsigned long cflag) 107. { crypto/asn1/t_x509.c:185:14: Call 183. if (BIO_write(bp, " Not Before: ", 24) <= 0) 184. goto err; 185. if (!ASN1_TIME_print(bp, X509_get_notBefore(x))) ^ 186. goto err; 187. if (BIO_write(bp, "\n Not After : ", 25) <= 0) crypto/asn1/t_x509.c:384:1: Parameter `*tm->data` 382. } 383. 384. > int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm) 385. { 386. if (tm->type == V_ASN1_UTCTIME) crypto/asn1/t_x509.c:389:16: Call 387. return ASN1_UTCTIME_print(bp, tm); 388. if (tm->type == V_ASN1_GENERALIZEDTIME) 389. return ASN1_GENERALIZEDTIME_print(bp, tm); ^ 390. BIO_write(bp, "Bad time value", 14); 391. return (0); crypto/asn1/t_x509.c:399:1: <Offset trace> 397. }; 398. 399. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 400. { 401. char *v; crypto/asn1/t_x509.c:399:1: Parameter `*tm->data` 397. }; 398. 399. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 400. { 401. char *v; crypto/asn1/t_x509.c:420:5: Assignment 418. y = (v[0] - '0') * 1000 + (v[1] - '0') * 100 419. + (v[2] - '0') * 10 + (v[3] - '0'); 420. M = (v[4] - '0') * 10 + (v[5] - '0'); ^ 421. if ((M > 12) || (M < 1)) 422. goto err; crypto/asn1/t_x509.c:394:1: <Length trace> 392. } 393. 394. > static const char *mon[12] = { 395. "Jan", "Feb", "Mar", "Apr", "May", "Jun", 396. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" crypto/asn1/t_x509.c:394:1: Array declaration 392. } 393. 394. > static const char *mon[12] = { 395. "Jan", "Feb", "Mar", "Apr", "May", "Jun", 396. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" crypto/asn1/t_x509.c:441:20: Array access: Offset: [-529, +oo] Size: 12 by call to `X509_print_ex` 439. 440. if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s", 441. mon[M - 1], d, h, m, s, f_len, f, y, ^ 442. (gmt) ? " GMT" : "") <= 0) 443. return (0);
https://github.com/openssl/openssl/blob/79a578b90244b890c8a6a8fc26c03943da71c054/crypto/asn1/t_x509.c/#L441
d2a_code_trace_data_45645
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/record/rec_layer_s3.c:1075: error: INTEGER_OVERFLOW_L2 ([0, max(0, `s->initial_ctx->sessions->num_items`)] - 1):unsigned64 by call to `ssl3_get_record`. Showing all 15 steps of the trace ssl/record/rec_layer_s3.c:994:1: Parameter `s->initial_ctx->sessions->num_items` 992. * none of our business 993. */ 994. > int ssl3_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf, 995. size_t len, int peek, size_t *readbytes) 996. { ssl/record/rec_layer_s3.c:1075:19: Call 1073. /* get new records if necessary */ 1074. if (num_recs == 0) { 1075. ret = ssl3_get_record(s); ^ 1076. if (ret <= 0) 1077. return ret; ssl/record/ssl3_record.c:125:1: Parameter `s->initial_ctx->sessions->num_items` 123. */ 124. /* used only by ssl3_read_bytes */ 125. > int ssl3_get_record(SSL *s) 126. { 127. int ssl_major, ssl_minor, al; ssl/record/ssl3_record.c:520:5: Call 518. 519. f_err: 520. ssl3_send_alert(s, SSL3_AL_FATAL, al); ^ 521. err: 522. return ret; ssl/s3_msg.c:63:1: Parameter `s->initial_ctx->sessions->num_items` 61. } 62. 63. > int ssl3_send_alert(SSL *s, int level, int desc) 64. { 65. /* Map tls/ssl alert value to correct one */ ssl/s3_msg.c:74:9: Call 72. /* If a fatal one, remove from cache */ 73. if ((level == SSL3_AL_FATAL) && (s->session != NULL)) 74. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 75. 76. s->s3->alert_dispatch = 1; ssl/ssl_sess.c:698:1: Parameter `ctx->sessions->num_items` 696. } 697. 698. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 699. { 700. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:700:12: Call 698. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 699. { 700. return remove_session_lock(ctx, c, 1); ^ 701. } 702. ssl/ssl_sess.c:703:1: Parameter `ctx->sessions->num_items` 701. } 702. 703. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 704. { 705. SSL_SESSION *r; ssl/ssl_sess.c:713:17: Call 711. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 712. ret = 1; 713. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 714. SSL_SESSION_list_remove(ctx, c); 715. } ssl/ssl_locl.h:598:1: Parameter `lh->num_items` 596. }; 597. 598. > DEFINE_LHASH_OF(SSL_SESSION); 599. /* Needed in ssl_cert.c */ 600. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:598:1: Call 596. }; 597. 598. > DEFINE_LHASH_OF(SSL_SESSION); 599. /* Needed in ssl_cert.c */ 600. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:103:1: <LHS trace> 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:103:1: Parameter `lh->num_items` 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:123:5: Binary operation: ([0, max(0, s->initial_ctx->sessions->num_items)] - 1):unsigned64 by call to `ssl3_get_record` 121. } 122. 123. lh->num_items--; ^ 124. if ((lh->num_nodes > MIN_NODES) && 125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/crypto/lhash/lhash.c/#L123
d2a_code_trace_data_45646
void av_free(void *ptr) { #if CONFIG_MEMALIGN_HACK if (ptr) free((char *)ptr - ((char *)ptr)[-1]); #elif HAVE_ALIGNED_MALLOC _aligned_free(ptr); #else free(ptr); #endif } libavfilter/graphparser.c:474: error: Use After Free call to `avfilter_free()` eventually accesses memory that was invalidated by call to `free()` on line 474 indirectly during the call to `avfilter_free()`. libavfilter/graphparser.c:418:1: invalidation part of the trace starts here 416. } 417. 418. int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, ^ 419. AVFilterInOut **inputs, 420. AVFilterInOut **outputs) libavfilter/graphparser.c:418:1: parameter `graph` of avfilter_graph_parse2 416. } 417. 418. int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, ^ 419. AVFilterInOut **inputs, 420. AVFilterInOut **outputs) libavfilter/graphparser.c:474:9: when calling `avfilter_free` here 472. fail: 473. while (graph->nb_filters) 474. avfilter_free(graph->filters[0]); ^ 475. av_freep(&graph->filters); 476. avfilter_inout_free(&open_inputs); libavfilter/avfilter.c:491:1: parameter `filter` of avfilter_free 489. } 490. 491. void avfilter_free(AVFilterContext *filter) ^ 492. { 493. int i; libavfilter/avfilter.c:518:5: when calling `av_free` here 516. av_freep(&filter->priv); 517. av_freep(&filter->internal); 518. av_free(filter); ^ 519. } 520. libavutil/mem.c:190:1: parameter `ptr` of av_free 188. } 189. 190. void av_free(void *ptr) ^ 191. { 192. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:198:5: was invalidated by call to `free()` 196. _aligned_free(ptr); 197. #else 198. free(ptr); ^ 199. #endif 200. } libavfilter/graphparser.c:418:1: use-after-lifetime part of the trace starts here 416. } 417. 418. int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, ^ 419. AVFilterInOut **inputs, 420. AVFilterInOut **outputs) libavfilter/graphparser.c:418:1: parameter `graph` of avfilter_graph_parse2 416. } 417. 418. int avfilter_graph_parse2(AVFilterGraph *graph, const char *filters, ^ 419. AVFilterInOut **inputs, 420. AVFilterInOut **outputs) libavfilter/graphparser.c:474:9: when calling `avfilter_free` here 472. fail: 473. while (graph->nb_filters) 474. avfilter_free(graph->filters[0]); ^ 475. av_freep(&graph->filters); 476. avfilter_inout_free(&open_inputs); libavfilter/avfilter.c:491:1: parameter `filter` of avfilter_free 489. } 490. 491. void avfilter_free(AVFilterContext *filter) ^ 492. { 493. int i; libavfilter/avfilter.c:518:5: when calling `av_free` here 516. av_freep(&filter->priv); 517. av_freep(&filter->internal); 518. av_free(filter); ^ 519. } 520. libavutil/mem.c:190:1: parameter `ptr` of av_free 188. } 189. 190. void av_free(void *ptr) ^ 191. { 192. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:198:5: invalid access occurs here 196. _aligned_free(ptr); 197. #else 198. free(ptr); ^ 199. #endif 200. }
https://github.com/libav/libav/blob/95a41311ac3a44773cc4dc407408aca35b1f8e26/libavutil/mem.c/#L198
d2a_code_trace_data_45647
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:1057: error: Uninitialized Value The value read from xmax was never initialized. libavcodec/motion_est_template.c:1057:9: 1055. } 1056. CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift) 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) )
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1057
d2a_code_trace_data_45648
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/motionpixels.c:319: error: Integer Overflow L2 ([1, 2147483616] + 32):signed32 by call to `av_frame_ref`. libavcodec/motionpixels.c:280:5: Unknown value from: non-const function 278. if (!mp->bswapbuf) 279. return AVERROR(ENOMEM); 280. mp->bdsp.bswap_buf((uint32_t *) mp->bswapbuf, (const uint32_t *) buf, ^ 281. buf_size / 4); 282. if (buf_size & 3) libavcodec/motionpixels.c:319:16: Call 317. 318. end: 319. if ((ret = av_frame_ref(data, mp->frame)) < 0) ^ 320. return ret; 321. *got_frame = 1; libavutil/frame.c:190:1: Parameter `src->nb_samples` 188. } 189. 190. int av_frame_ref(AVFrame *dst, const AVFrame *src) ^ 191. { 192. int i, ret = 0; libavutil/frame.c:198:5: Assignment 196. dst->height = src->height; 197. dst->channel_layout = src->channel_layout; 198. dst->nb_samples = src->nb_samples; ^ 199. 200. ret = av_frame_copy_props(dst, src); libavutil/frame.c:206:15: Call 204. /* duplicate the frame data if it's not refcounted */ 205. if (!src->buf[0]) { 206. ret = av_frame_get_buffer(dst, 32); ^ 207. if (ret < 0) 208. return ret; libavutil/frame.c:177:1: Parameter `frame->nb_samples` 175. } 176. 177. int av_frame_get_buffer(AVFrame *frame, int align) ^ 178. { 179. if (frame->format < 0) libavutil/frame.c:185:16: Call 183. return get_video_buffer(frame, align); 184. else if (frame->nb_samples > 0 && frame->channel_layout) 185. return get_audio_buffer(frame, align); ^ 186. 187. return AVERROR(EINVAL); libavutil/frame.c:128:1: Parameter `frame->nb_samples` 126. } 127. 128. static int get_audio_buffer(AVFrame *frame, int align) ^ 129. { 130. int channels = av_get_channel_layout_nb_channels(frame->channel_layout); libavutil/frame.c:136:15: Call 134. 135. if (!frame->linesize[0]) { 136. ret = av_samples_get_buffer_size(&frame->linesize[0], channels, ^ 137. frame->nb_samples, frame->format, 138. 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_ref` 122. return AVERROR(EINVAL); 123. align = 1; 124. nb_samples = FFALIGN(nb_samples, 32); ^ 125. } 126.
https://github.com/libav/libav/blob/e121ac634ba324a318f4a97f978dcfb48da6b735/libavutil/samplefmt.c/#L124
d2a_code_trace_data_45649
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_exp.c:225: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul_reciprocal`. Showing all 38 steps of the trace crypto/bn/bn_exp.c:161:1: Parameter `ctx->stack.depth` 159. } 160. 161. > int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 162. const BIGNUM *m, BN_CTX *ctx) 163. { crypto/bn/bn_exp.c:191:5: Call 189. } 190. 191. BN_CTX_start(ctx); ^ 192. aa = BN_CTX_get(ctx); 193. val[0] = 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_exp.c:192:10: Call 190. 191. BN_CTX_start(ctx); 192. aa = BN_CTX_get(ctx); ^ 193. val[0] = BN_CTX_get(ctx); 194. if (val[0] == 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_exp.c:193:14: Call 191. BN_CTX_start(ctx); 192. aa = BN_CTX_get(ctx); 193. val[0] = BN_CTX_get(ctx); ^ 194. if (val[0] == NULL) 195. 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_exp.c:210:10: Call 208. } 209. 210. if (!BN_nnmod(val[0], a, m, ctx)) ^ 211. goto err; /* 1 */ 212. 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: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_exp.c:220:14: Call 218. window = BN_window_bits_for_exponent_size(bits); 219. if (window > 1) { 220. if (!BN_mod_mul_reciprocal(aa, val[0], val[0], &recp, ctx)) ^ 221. goto err; /* 2 */ 222. j = 1 << (window - 1); crypto/bn/bn_recp.c:55:1: Parameter `ctx->stack.depth` 53. } 54. 55. > int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y, 56. BN_RECP_CTX *recp, BN_CTX *ctx) 57. { crypto/bn/bn_recp.c:62:5: Call 60. const BIGNUM *ca; 61. 62. BN_CTX_start(ctx); ^ 63. if ((a = BN_CTX_get(ctx)) == NULL) 64. 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_recp.c:63:14: Call 61. 62. BN_CTX_start(ctx); 63. if ((a = BN_CTX_get(ctx)) == NULL) ^ 64. goto err; 65. if (y != 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_recp.c:79:5: Call 77. ret = BN_div_recp(NULL, r, ca, recp, ctx); 78. err: 79. BN_CTX_end(ctx); ^ 80. bn_check_top(r); 81. 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/bn/bn_exp.c:224:28: Call 222. j = 1 << (window - 1); 223. for (i = 1; i < j; i++) { 224. if (((val[i] = BN_CTX_get(ctx)) == NULL) || ^ 225. !BN_mod_mul_reciprocal(val[i], val[i - 1], aa, &recp, ctx)) 226. 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_exp.c:225:18: Call 223. for (i = 1; i < j; i++) { 224. if (((val[i] = BN_CTX_get(ctx)) == NULL) || 225. !BN_mod_mul_reciprocal(val[i], val[i - 1], aa, &recp, ctx)) ^ 226. goto err; 227. } crypto/bn/bn_recp.c:55:1: Parameter `ctx->stack.depth` 53. } 54. 55. > int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y, 56. BN_RECP_CTX *recp, BN_CTX *ctx) 57. { crypto/bn/bn_recp.c:62:5: Call 60. const BIGNUM *ca; 61. 62. BN_CTX_start(ctx); ^ 63. if ((a = BN_CTX_get(ctx)) == NULL) 64. 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_recp.c:63:14: Call 61. 62. BN_CTX_start(ctx); 63. if ((a = BN_CTX_get(ctx)) == NULL) ^ 64. goto err; 65. if (y != 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_recp.c:77:11: Call 75. ca = x; /* Just do the mod */ 76. 77. ret = BN_div_recp(NULL, r, ca, recp, ctx); ^ 78. err: 79. BN_CTX_end(ctx); crypto/bn/bn_recp.c:90:5: Call 88. BIGNUM *a, *b, *d, *r; 89. 90. BN_CTX_start(ctx); ^ 91. d = (dv != NULL) ? dv : BN_CTX_get(ctx); 92. r = (rem != NULL) ? rem : 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/bn/bn_recp.c:101:13: Call 99. BN_zero(d); 100. if (!BN_copy(r, m)) { 101. BN_CTX_end(ctx); ^ 102. return 0; 103. } 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_mod_mul_reciprocal` 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_45650
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ecdh_ossl.c:117: 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/ecdh_ossl.c:52:5: Call 50. if ((ctx = BN_CTX_new()) == NULL) 51. goto err; 52. BN_CTX_start(ctx); ^ 53. x = BN_CTX_get(ctx); 54. if (x == NULL) { 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/ecdh_ossl.c:117:9: Call 115. EC_POINT_clear_free(tmp); 116. if (ctx) 117. BN_CTX_end(ctx); ^ 118. BN_CTX_free(ctx); 119. OPENSSL_free(buf); 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/529586085e38487d45974817d4f3ff40f30e19f6/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_45651
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:959: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `SSL_CTX_remove_session`. Showing all 11 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:959:4: Call 957. ERR_add_error_data(2,"SSL alert number ",tmp); 958. s->shutdown|=SSL_RECEIVED_SHUTDOWN; 959. SSL_CTX_remove_session(s->ctx,s->session); ^ 960. return(0); 961. } 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 `SSL_CTX_remove_session` 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_45652
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_smime.c:720: error: BUFFER_OVERRUN_L3 Offset added: [4, +oo] (⇐ 4 + [0, +oo]) Size: [1, +oo] by call to `CMS_RecipientInfo_decrypt`. Showing all 17 steps of the trace crypto/cms/cms_smime.c:720:13: Call 718. continue; 719. CMS_RecipientInfo_set0_password(ri, pass, passlen); 720. r = CMS_RecipientInfo_decrypt(cms, ri); ^ 721. CMS_RecipientInfo_set0_password(ri, NULL, 0); 722. if (r > 0) crypto/cms/cms_env.c:739:1: Parameter `ri->d.pwri->encryptedKey->length` 737. } 738. 739. > int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri) 740. { 741. switch (ri->type) { crypto/cms/cms_smime.c:720:13: Call 718. continue; 719. CMS_RecipientInfo_set0_password(ri, pass, passlen); 720. r = CMS_RecipientInfo_decrypt(cms, ri); ^ 721. CMS_RecipientInfo_set0_password(ri, NULL, 0); 722. if (r > 0) crypto/cms/cms_env.c:739:1: Parameter `ri->d.pwri->encryptedKey->length` 737. } 738. 739. > int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri) 740. { 741. switch (ri->type) { crypto/cms/cms_env.c:749:16: Call 747. 748. case CMS_RECIPINFO_PASS: 749. return cms_RecipientInfo_pwri_crypt(cms, ri, 0); ^ 750. 751. 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_decrypt` 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_45653
static void fill_decode_caches(H264Context *h, int mb_type){ MpegEncContext * const s = &h->s; int topleft_xy, top_xy, topright_xy, left_xy[2]; int topleft_type, top_type, topright_type, left_type[2]; const uint8_t * left_block= h->left_block; int i; topleft_xy = h->topleft_mb_xy ; top_xy = h->top_mb_xy ; topright_xy = h->topright_mb_xy; left_xy[0] = h->left_mb_xy[0] ; left_xy[1] = h->left_mb_xy[1] ; topleft_type = h->topleft_type ; top_type = h->top_type ; topright_type= h->topright_type ; left_type[0] = h->left_type[0] ; left_type[1] = h->left_type[1] ; if(!IS_SKIP(mb_type)){ if(IS_INTRA(mb_type)){ int type_mask= h->pps.constrained_intra_pred ? IS_INTRA(-1) : -1; h->topleft_samples_available= h->top_samples_available= h->left_samples_available= 0xFFFF; h->topright_samples_available= 0xEEEA; if(!(top_type & type_mask)){ h->topleft_samples_available= 0xB3FF; h->top_samples_available= 0x33FF; h->topright_samples_available= 0x26EA; } if(IS_INTERLACED(mb_type) != IS_INTERLACED(left_type[0])){ if(IS_INTERLACED(mb_type)){ if(!(left_type[0] & type_mask)){ h->topleft_samples_available&= 0xDFFF; h->left_samples_available&= 0x5FFF; } if(!(left_type[1] & type_mask)){ h->topleft_samples_available&= 0xFF5F; h->left_samples_available&= 0xFF5F; } }else{ int left_typei = h->slice_table[left_xy[0] + s->mb_stride ] == h->slice_num ? s->current_picture.mb_type[left_xy[0] + s->mb_stride] : 0; assert(left_xy[0] == left_xy[1]); if(!((left_typei & type_mask) && (left_type[0] & type_mask))){ h->topleft_samples_available&= 0xDF5F; h->left_samples_available&= 0x5F5F; } } }else{ if(!(left_type[0] & type_mask)){ h->topleft_samples_available&= 0xDF5F; h->left_samples_available&= 0x5F5F; } } if(!(topleft_type & type_mask)) h->topleft_samples_available&= 0x7FFF; if(!(topright_type & type_mask)) h->topright_samples_available&= 0xFBFF; if(IS_INTRA4x4(mb_type)){ if(IS_INTRA4x4(top_type)){ AV_COPY32(h->intra4x4_pred_mode_cache+4+8*0, h->intra4x4_pred_mode + h->mb2br_xy[top_xy]); }else{ h->intra4x4_pred_mode_cache[4+8*0]= h->intra4x4_pred_mode_cache[5+8*0]= h->intra4x4_pred_mode_cache[6+8*0]= h->intra4x4_pred_mode_cache[7+8*0]= 2 - 3*!(top_type & type_mask); } for(i=0; i<2; i++){ if(IS_INTRA4x4(left_type[i])){ int8_t *mode= h->intra4x4_pred_mode + h->mb2br_xy[left_xy[i]]; h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= mode[6-left_block[0+2*i]]; h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= mode[6-left_block[1+2*i]]; }else{ h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= 2 - 3*!(left_type[i] & type_mask); } } } } if(top_type){ AV_COPY32(&h->non_zero_count_cache[4+8*0], &h->non_zero_count[top_xy][4+3*8]); h->non_zero_count_cache[1+8*0]= h->non_zero_count[top_xy][1+1*8]; h->non_zero_count_cache[2+8*0]= h->non_zero_count[top_xy][2+1*8]; h->non_zero_count_cache[1+8*3]= h->non_zero_count[top_xy][1+2*8]; h->non_zero_count_cache[2+8*3]= h->non_zero_count[top_xy][2+2*8]; }else { h->non_zero_count_cache[1+8*0]= h->non_zero_count_cache[2+8*0]= h->non_zero_count_cache[1+8*3]= h->non_zero_count_cache[2+8*3]= AV_WN32A(&h->non_zero_count_cache[4+8*0], CABAC && !IS_INTRA(mb_type) ? 0 : 0x40404040); } for (i=0; i<2; i++) { if(left_type[i]){ h->non_zero_count_cache[3+8*1 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[8+0+2*i]]; h->non_zero_count_cache[3+8*2 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[8+1+2*i]]; h->non_zero_count_cache[0+8*1 + 8*i]= h->non_zero_count[left_xy[i]][left_block[8+4+2*i]]; h->non_zero_count_cache[0+8*4 + 8*i]= h->non_zero_count[left_xy[i]][left_block[8+5+2*i]]; }else{ h->non_zero_count_cache[3+8*1 + 2*8*i]= h->non_zero_count_cache[3+8*2 + 2*8*i]= h->non_zero_count_cache[0+8*1 + 8*i]= h->non_zero_count_cache[0+8*4 + 8*i]= CABAC && !IS_INTRA(mb_type) ? 0 : 64; } } if( CABAC ) { if(top_type) { h->top_cbp = h->cbp_table[top_xy]; } else if(IS_INTRA(mb_type)) { h->top_cbp = 0x1CF; } else { h->top_cbp = 0x00F; } if (left_type[0]) { h->left_cbp = h->cbp_table[left_xy[0]] & 0x1f0; } else if(IS_INTRA(mb_type)) { h->left_cbp = 0x1CF; } else { h->left_cbp = 0x00F; } if (left_type[0]) { h->left_cbp |= ((h->cbp_table[left_xy[0]]>>((left_block[0]&(~1))+1))&0x1) << 1; } if (left_type[1]) { h->left_cbp |= ((h->cbp_table[left_xy[1]]>>((left_block[2]&(~1))+1))&0x1) << 3; } } } #if 1 if(IS_INTER(mb_type) || (IS_DIRECT(mb_type) && h->direct_spatial_mv_pred)){ int list; for(list=0; list<h->list_count; list++){ if(!USES_LIST(mb_type, list)){ continue; } assert(!(IS_DIRECT(mb_type) && !h->direct_spatial_mv_pred)); h->mv_cache_clean[list]= 0; if(USES_LIST(top_type, list)){ const int b_xy= h->mb2b_xy[top_xy] + 3*h->b_stride; const int b8_xy= h->mb2b8_xy[top_xy] + h->b8_stride; AV_COPY128(h->mv_cache[list][scan8[0] + 0 - 1*8], s->current_picture.motion_val[list][b_xy + 0]); h->ref_cache[list][scan8[0] + 0 - 1*8]= h->ref_cache[list][scan8[0] + 1 - 1*8]= s->current_picture.ref_index[list][b8_xy + 0]; h->ref_cache[list][scan8[0] + 2 - 1*8]= h->ref_cache[list][scan8[0] + 3 - 1*8]= s->current_picture.ref_index[list][b8_xy + 1]; }else{ AV_ZERO128(h->mv_cache[list][scan8[0] + 0 - 1*8]); AV_WN32A(&h->ref_cache[list][scan8[0] + 0 - 1*8], ((top_type ? LIST_NOT_USED : PART_NOT_AVAILABLE)&0xFF)*0x01010101); } for(i=0; i<2; i++){ int cache_idx = scan8[0] - 1 + i*2*8; if(USES_LIST(left_type[i], list)){ const int b_xy= h->mb2b_xy[left_xy[i]] + 3; const int b8_xy= h->mb2b8_xy[left_xy[i]] + 1; AV_COPY32(h->mv_cache[list][cache_idx ], s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[0+i*2]]); AV_COPY32(h->mv_cache[list][cache_idx+8], s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[1+i*2]]); h->ref_cache[list][cache_idx ]= s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[0+i*2]>>1)]; h->ref_cache[list][cache_idx+8]= s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[1+i*2]>>1)]; }else{ AV_ZERO32(h->mv_cache [list][cache_idx ]); AV_ZERO32(h->mv_cache [list][cache_idx+8]); h->ref_cache[list][cache_idx ]= h->ref_cache[list][cache_idx+8]= (left_type[i]) ? LIST_NOT_USED : PART_NOT_AVAILABLE; } } if(USES_LIST(topleft_type, list)){ const int b_xy = h->mb2b_xy [topleft_xy] + 3 + h->b_stride + (h->topleft_partition & 2*h->b_stride); const int b8_xy= h->mb2b8_xy[topleft_xy] + 1 + (h->topleft_partition & h->b8_stride); AV_COPY32(h->mv_cache[list][scan8[0] - 1 - 1*8], s->current_picture.motion_val[list][b_xy]); h->ref_cache[list][scan8[0] - 1 - 1*8]= s->current_picture.ref_index[list][b8_xy]; }else{ AV_ZERO32(h->mv_cache[list][scan8[0] - 1 - 1*8]); h->ref_cache[list][scan8[0] - 1 - 1*8]= topleft_type ? LIST_NOT_USED : PART_NOT_AVAILABLE; } if(USES_LIST(topright_type, list)){ const int b_xy= h->mb2b_xy[topright_xy] + 3*h->b_stride; const int b8_xy= h->mb2b8_xy[topright_xy] + h->b8_stride; AV_COPY32(h->mv_cache[list][scan8[0] + 4 - 1*8], s->current_picture.motion_val[list][b_xy]); h->ref_cache[list][scan8[0] + 4 - 1*8]= s->current_picture.ref_index[list][b8_xy]; }else{ AV_ZERO32(h->mv_cache [list][scan8[0] + 4 - 1*8]); h->ref_cache[list][scan8[0] + 4 - 1*8]= topright_type ? LIST_NOT_USED : PART_NOT_AVAILABLE; } if((mb_type&(MB_TYPE_SKIP|MB_TYPE_DIRECT2)) && !FRAME_MBAFF) continue; if(!(mb_type&(MB_TYPE_SKIP|MB_TYPE_DIRECT2))) { h->ref_cache[list][scan8[5 ]+1] = h->ref_cache[list][scan8[7 ]+1] = h->ref_cache[list][scan8[13]+1] = h->ref_cache[list][scan8[4 ]] = h->ref_cache[list][scan8[12]] = PART_NOT_AVAILABLE; AV_ZERO32(h->mv_cache [list][scan8[5 ]+1]); AV_ZERO32(h->mv_cache [list][scan8[7 ]+1]); AV_ZERO32(h->mv_cache [list][scan8[13]+1]); AV_ZERO32(h->mv_cache [list][scan8[4 ]]); AV_ZERO32(h->mv_cache [list][scan8[12]]); if( CABAC ) { if(USES_LIST(top_type, list)){ const int b_xy= h->mb2br_xy[top_xy]; AV_COPY64(h->mvd_cache[list][scan8[0] + 0 - 1*8], h->mvd_table[list][b_xy + 0]); }else{ AV_ZERO64(h->mvd_cache[list][scan8[0] + 0 - 1*8]); } if(USES_LIST(left_type[0], list)){ const int b_xy= h->mb2br_xy[left_xy[0]] + 6; AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 0*8], h->mvd_table[list][b_xy - left_block[0]]); AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 1*8], h->mvd_table[list][b_xy - left_block[1]]); }else{ AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 0*8]); AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 1*8]); } if(USES_LIST(left_type[1], list)){ const int b_xy= h->mb2br_xy[left_xy[1]] + 6; AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 2*8], h->mvd_table[list][b_xy - left_block[2]]); AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 3*8], h->mvd_table[list][b_xy - left_block[3]]); }else{ AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 2*8]); AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 3*8]); } AV_ZERO16(h->mvd_cache [list][scan8[5 ]+1]); AV_ZERO16(h->mvd_cache [list][scan8[7 ]+1]); AV_ZERO16(h->mvd_cache [list][scan8[13]+1]); AV_ZERO16(h->mvd_cache [list][scan8[4 ]]); AV_ZERO16(h->mvd_cache [list][scan8[12]]); if(h->slice_type_nos == FF_B_TYPE){ fill_rectangle(&h->direct_cache[scan8[0]], 4, 4, 8, MB_TYPE_16x16>>1, 1); if(IS_DIRECT(top_type)){ AV_WN32A(&h->direct_cache[scan8[0] - 1*8], 0x01010101*(MB_TYPE_DIRECT2>>1)); }else if(IS_8X8(top_type)){ int b8_xy = 4*top_xy; h->direct_cache[scan8[0] + 0 - 1*8]= h->direct_table[b8_xy + 2]; h->direct_cache[scan8[0] + 2 - 1*8]= h->direct_table[b8_xy + 3]; }else{ AV_WN32A(&h->direct_cache[scan8[0] - 1*8], 0x01010101*(MB_TYPE_16x16>>1)); } if(IS_DIRECT(left_type[0])) h->direct_cache[scan8[0] - 1 + 0*8]= MB_TYPE_DIRECT2>>1; else if(IS_8X8(left_type[0])) h->direct_cache[scan8[0] - 1 + 0*8]= h->direct_table[4*left_xy[0] + 1 + (left_block[0]&~1)]; else h->direct_cache[scan8[0] - 1 + 0*8]= MB_TYPE_16x16>>1; if(IS_DIRECT(left_type[1])) h->direct_cache[scan8[0] - 1 + 2*8]= MB_TYPE_DIRECT2>>1; else if(IS_8X8(left_type[1])) h->direct_cache[scan8[0] - 1 + 2*8]= h->direct_table[4*left_xy[1] + 1 + (left_block[2]&~1)]; else h->direct_cache[scan8[0] - 1 + 2*8]= MB_TYPE_16x16>>1; } } } if(FRAME_MBAFF){ #define MAP_MVS\ MAP_F2F(scan8[0] - 1 - 1*8, topleft_type)\ MAP_F2F(scan8[0] + 0 - 1*8, top_type)\ MAP_F2F(scan8[0] + 1 - 1*8, top_type)\ MAP_F2F(scan8[0] + 2 - 1*8, top_type)\ MAP_F2F(scan8[0] + 3 - 1*8, top_type)\ MAP_F2F(scan8[0] + 4 - 1*8, topright_type)\ MAP_F2F(scan8[0] - 1 + 0*8, left_type[0])\ MAP_F2F(scan8[0] - 1 + 1*8, left_type[0])\ MAP_F2F(scan8[0] - 1 + 2*8, left_type[1])\ MAP_F2F(scan8[0] - 1 + 3*8, left_type[1]) if(MB_FIELD){ #define MAP_F2F(idx, mb_type)\ if(!IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0){\ h->ref_cache[list][idx] <<= 1;\ h->mv_cache[list][idx][1] /= 2;\ h->mvd_cache[list][idx][1] >>=1;\ } MAP_MVS #undef MAP_F2F }else{ #define MAP_F2F(idx, mb_type)\ if(IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0){\ h->ref_cache[list][idx] >>= 1;\ h->mv_cache[list][idx][1] <<= 1;\ h->mvd_cache[list][idx][1] <<= 1;\ } MAP_MVS #undef MAP_F2F } } } } #endif h->neighbor_transform_size= !!IS_8x8DCT(top_type) + !!IS_8x8DCT(left_type[0]); } libavcodec/h264_cabac.c:1345: error: Buffer Overrun L2 Offset: [1, 6] (⇐ [0, 3] + [1, 3]) Size: 4 by call to `fill_decode_caches`. libavcodec/h264_cabac.c:1239:5: Call 1237. h->prev_mb_skipped = 0; 1238. 1239. fill_decode_neighbors(h, -(MB_FIELD)); ^ 1240. 1241. if( h->slice_type_nos == FF_B_TYPE ) { libavcodec/h264.h:759:5: Array declaration 757. const int mb_xy= h->mb_xy; 758. int topleft_xy, top_xy, topright_xy, left_xy[2]; 759. static const uint8_t left_block_options[4][16]={ ^ 760. {0,1,2,3,7,10,8,11,7+0*8, 7+1*8, 7+2*8, 7+3*8, 2+0*8, 2+3*8, 2+1*8, 2+2*8}, 761. {2,2,3,3,8,11,8,11,7+2*8, 7+2*8, 7+3*8, 7+3*8, 2+1*8, 2+2*8, 2+1*8, 2+2*8}, libavcodec/h264.h:776:5: Assignment 774. topright_xy= top_xy + 1; 775. left_xy[1] = left_xy[0] = mb_xy-1; 776. h->left_block = left_block_options[0]; ^ 777. if(FRAME_MBAFF){ 778. const int left_mb_field_flag = IS_INTERLACED(s->current_picture.mb_type[mb_xy-1]); libavcodec/h264_cabac.c:1345:5: Call 1343. } 1344. 1345. fill_decode_caches(h, mb_type); ^ 1346. 1347. if( IS_INTRA( mb_type ) ) { libavcodec/h264.h:896:21: <Offset trace> 894. h->intra4x4_pred_mode_cache[7+8*0]= 2 - 3*!(top_type & type_mask); 895. } 896. for(i=0; i<2; i++){ ^ 897. if(IS_INTRA4x4(left_type[i])){ 898. int8_t *mode= h->intra4x4_pred_mode + h->mb2br_xy[left_xy[i]]; libavcodec/h264.h:896:21: Assignment 894. h->intra4x4_pred_mode_cache[7+8*0]= 2 - 3*!(top_type & type_mask); 895. } 896. for(i=0; i<2; i++){ ^ 897. if(IS_INTRA4x4(left_type[i])){ 898. int8_t *mode= h->intra4x4_pred_mode + h->mb2br_xy[left_xy[i]]; libavcodec/h264.h:824:1: <Length trace> 822. } 823. 824. static void fill_decode_caches(H264Context *h, int mb_type){ ^ 825. MpegEncContext * const s = &h->s; 826. int topleft_xy, top_xy, topright_xy, left_xy[2]; libavcodec/h264.h:824:1: Parameter `*h->left_block` 822. } 823. 824. static void fill_decode_caches(H264Context *h, int mb_type){ ^ 825. MpegEncContext * const s = &h->s; 826. int topleft_xy, top_xy, topright_xy, left_xy[2]; libavcodec/h264.h:828:5: Assignment 826. int topleft_xy, top_xy, topright_xy, left_xy[2]; 827. int topleft_type, top_type, topright_type, left_type[2]; 828. const uint8_t * left_block= h->left_block; ^ 829. int i; 830. libavcodec/h264.h:900:76: Array access: Offset: [1, 6] (⇐ [0, 3] + [1, 3]) Size: 4 by call to `fill_decode_caches` 898. int8_t *mode= h->intra4x4_pred_mode + h->mb2br_xy[left_xy[i]]; 899. h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= mode[6-left_block[0+2*i]]; 900. h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= mode[6-left_block[1+2*i]]; ^ 901. }else{ 902. h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]=
https://github.com/libav/libav/blob/479e1e617078476f14598cd62769b4c9ca4025e2/libavcodec/h264.h/#L900