id
stringlengths
25
25
content
stringlengths
649
72.1k
max_stars_repo_path
stringlengths
91
133
d2a_code_trace_data_43354
static void quantize_lpc_coefs(double *lpc_in, int order, int precision, int32_t *lpc_out, int *shift, int max_shift, int zero_shift) { int i; double cmax, error; int32_t qmax; int sh; qmax = (1 << (precision - 1)) - 1; cmax = 0.0; for(i=0; i<order; i++) { cmax= FFMAX(cmax, fabs(lpc_in[i])); } if(cmax * (1 << max_shift) < 1.0) { *shift = zero_shift; memset(lpc_out, 0, sizeof(int32_t) * order); return; } sh = max_shift; while((cmax * (1 << sh) > qmax) && (sh > 0)) { sh--; } if(sh == 0 && cmax > qmax) { double scale = ((double)qmax) / cmax; for(i=0; i<order; i++) { lpc_in[i] *= scale; } } error=0; for(i=0; i<order; i++) { error -= lpc_in[i] * (1 << sh); lpc_out[i] = av_clip(lrintf(error), -qmax, qmax); error -= lpc_out[i]; } *shift = sh; } libavcodec/ra144enc.c:463: error: Buffer Overrun L2 Offset: [9, 18] (⇐ 9 + [0, 9]) Size: 10 by call to `ff_lpc_calc_coefs`. libavcodec/ra144enc.c:422:1: Array declaration 420. 421. 422. static int ra144_encode_frame(AVCodecContext *avctx, uint8_t *frame, ^ 423. int buf_size, void *data) 424. { libavcodec/ra144enc.c:463:5: Call 461. 32)]; 462. 463. ff_lpc_calc_coefs(&ractx->lpc_ctx, lpc_data, NBLOCKS * BLOCKSIZE, LPC_ORDER, ^ 464. LPC_ORDER, 16, lpc_coefs, shift, FF_LPC_TYPE_LEVINSON, 465. 0, ORDER_METHOD_EST, 12, 0); libavcodec/lpc.c:155:1: Parameter `max_order` 153. * see #FFLPCType for details 154. */ 155. int ff_lpc_calc_coefs(LPCContext *s, ^ 156. const int32_t *samples, int blocksize, int min_order, 157. int max_order, int precision, libavcodec/lpc.c:234:13: Call 232. } else { 233. for(i=min_order-1; i<max_order; i++) { 234. quantize_lpc_coefs(lpc[i], i+1, precision, coefs[i], &shift[i], max_shift, zero_shift); ^ 235. } 236. } libavcodec/lpc.c:86:1: <Offset trace> 84. * Quantize LPC coefficients 85. */ 86. static void quantize_lpc_coefs(double *lpc_in, int order, int precision, ^ 87. int32_t *lpc_out, int *shift, int max_shift, int zero_shift) 88. { libavcodec/lpc.c:86:1: Parameter `order` 84. * Quantize LPC coefficients 85. */ 86. static void quantize_lpc_coefs(double *lpc_in, int order, int precision, ^ 87. int32_t *lpc_out, int *shift, int max_shift, int zero_shift) 88. { libavcodec/lpc.c:86:1: <Length trace> 84. * Quantize LPC coefficients 85. */ 86. static void quantize_lpc_coefs(double *lpc_in, int order, int precision, ^ 87. int32_t *lpc_out, int *shift, int max_shift, int zero_shift) 88. { libavcodec/lpc.c:86:1: Parameter `*lpc_out` 84. * Quantize LPC coefficients 85. */ 86. static void quantize_lpc_coefs(double *lpc_in, int order, int precision, ^ 87. int32_t *lpc_out, int *shift, int max_shift, int zero_shift) 88. { libavcodec/lpc.c:129:9: Array access: Offset: [9, 18] (⇐ 9 + [0, 9]) Size: 10 by call to `ff_lpc_calc_coefs` 127. for(i=0; i<order; i++) { 128. error -= lpc_in[i] * (1 << sh); 129. lpc_out[i] = av_clip(lrintf(error), -qmax, qmax); ^ 130. error -= lpc_out[i]; 131. }
https://github.com/libav/libav/blob/96c1e6d40d389eeb628840030dfe340d762a7ac8/libavcodec/lpc.c/#L129
d2a_code_trace_data_43355
static int append_buf(char **buf, int *size, const char *s) { const int expand = 256; int len = strlen(s) + 1; char *p = *buf; if (p == NULL) { *size = ((len + expand - 1) / expand) * expand; p = *buf = app_malloc(*size, "engine buffer"); } else { const int blen = strlen(p); if (blen > 0) len += 2 + blen; if (len > *size) { *size = ((len + expand - 1) / expand) * expand; p = OPENSSL_realloc(p, *size); if (p == NULL) { OPENSSL_free(*buf); *buf = NULL; return 0; } *buf = p; } if (blen > 0) { p += blen; *p++ = ','; *p++ = ' '; } } strcpy(p, s); return 1; } apps/engine.c:286: error: BUFFER_OVERRUN_L3 Offset: [2, +oo] Size: [1, +oo] by call to `append_buf`. Showing all 12 steps of the trace apps/engine.c:284:9: Call 282. if (OSSL_STORE_LOADER_get0_engine(loader) == ctx->engine) { 283. char buf[256]; 284. BIO_snprintf(buf, sizeof(buf), "STORE(%s)", ^ 285. OSSL_STORE_LOADER_get0_scheme(loader)); 286. if (!append_buf(ctx->cap_buf, ctx->cap_size, buf)) crypto/bio/b_print.c:902:11: Call 900. va_start(args, format); 901. 902. ret = BIO_vsnprintf(buf, n, format, args); ^ 903. 904. va_end(args); crypto/bio/b_print.c:913:9: Call 911. int truncated; 912. 913. if(!_dopr(&buf, NULL, &n, &retlen, &truncated, format, args)) ^ 914. return -1; 915. crypto/bio/b_print.c:114:21: Call 112. state = DP_S_FLAGS; 113. else 114. if(!doapr_outch(sbuffer, buffer, &currlen, maxlen, ch)) ^ 115. return 0; 116. ch = *format++; crypto/bio/b_print.c:804:1: Parameter `*maxlen` 802. #define BUFFER_INC 1024 803. 804. > static int 805. doapr_outch(char **sbuffer, 806. char **buffer, size_t *currlen, size_t *maxlen, int c) apps/engine.c:286:14: Call 284. BIO_snprintf(buf, sizeof(buf), "STORE(%s)", 285. OSSL_STORE_LOADER_get0_scheme(loader)); 286. if (!append_buf(ctx->cap_buf, ctx->cap_size, buf)) ^ 287. ctx->ok = 0; 288. } apps/engine.c:49:1: <Length trace> 47. }; 48. 49. > static int append_buf(char **buf, int *size, const char *s) 50. { 51. const int expand = 256; apps/engine.c:49:1: Parameter `**buf` 47. }; 48. 49. > static int append_buf(char **buf, int *size, const char *s) 50. { 51. const int expand = 256; apps/engine.c:53:5: Assignment 51. const int expand = 256; 52. int len = strlen(s) + 1; 53. char *p = *buf; ^ 54. 55. if (p == NULL) { apps/engine.c:76:13: Assignment 74. 75. if (blen > 0) { 76. p += blen; ^ 77. *p++ = ','; 78. *p++ = ' '; apps/engine.c:77:14: Assignment 75. if (blen > 0) { 76. p += blen; 77. *p++ = ','; ^ 78. *p++ = ' '; 79. } apps/engine.c:78:13: Array access: Offset: [2, +oo] Size: [1, +oo] by call to `append_buf` 76. p += blen; 77. *p++ = ','; 78. *p++ = ' '; ^ 79. } 80. }
https://github.com/openssl/openssl/blob/de2f409ef9de775df6db2c7de69b7bb0df21e380/apps/engine.c/#L78
d2a_code_trace_data_43356
static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr, int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], int ref_mv_scale, int flags, int size, int h) { MotionEstContext * const c= &s->me; int best[2]={0, 0}; int d; int dmin; int map_generation; int penalty_factor; const int ref_mv_stride= s->mb_stride; const int ref_mv_xy= s->mb_x + s->mb_y*ref_mv_stride; me_cmp_func cmpf, chroma_cmpf; LOAD_COMMON LOAD_COMMON2 if(c->pre_pass){ penalty_factor= c->pre_penalty_factor; cmpf= s->dsp.me_pre_cmp[size]; chroma_cmpf= s->dsp.me_pre_cmp[size+1]; }else{ penalty_factor= c->penalty_factor; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; } map_generation= update_map_generation(c); assert(cmpf); dmin= cmp(s, 0, 0, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags); map[0]= map_generation; score_map[0]= dmin; if((s->pict_type == FF_B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0) dmin += (mv_penalty[pred_x] + mv_penalty[pred_y])*penalty_factor; if (s->first_slice_line) { CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) }else{ if(dmin<((h*h*s->avctx->mv0_threshold)>>8) && ( P_LEFT[0] |P_LEFT[1] |P_TOP[0] |P_TOP[1] |P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){ *mx_ptr= 0; *my_ptr= 0; c->skip=1; return dmin; } CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift) CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift) CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) } if(dmin>h*h*4){ if(c->pre_pass){ CHECK_CLIPPED_MV((last_mv[ref_mv_xy-1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy-1][1]*ref_mv_scale + (1<<15))>>16) if(!s->first_slice_line) CHECK_CLIPPED_MV((last_mv[ref_mv_xy-ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy-ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) }else{ CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) if(s->mb_y+1<s->end_mb_y) CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) } } if(c->avctx->last_predictor_count){ const int count= c->avctx->last_predictor_count; const int xstart= FFMAX(0, s->mb_x - count); const int ystart= FFMAX(0, s->mb_y - count); const int xend= FFMIN(s->mb_width , s->mb_x + count + 1); const int yend= FFMIN(s->mb_height, s->mb_y + count + 1); int mb_y; for(mb_y=ystart; mb_y<yend; mb_y++){ int mb_x; for(mb_x=xstart; mb_x<xend; mb_x++){ const int xy= mb_x + 1 + (mb_y + 1)*ref_mv_stride; int mx= (last_mv[xy][0]*ref_mv_scale + (1<<15))>>16; int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16; if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue; CHECK_MV(mx,my) } } } dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); *mx_ptr= best[0]; *my_ptr= best[1]; return dmin; } libavcodec/motion_est_template.c:1043: error: Uninitialized Value The value read from ymin was never initialized. libavcodec/motion_est_template.c:1043:9: 1041. /* first line */ 1042. if (s->first_slice_line) { 1043. CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) ^ 1044. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, 1045. (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1043
d2a_code_trace_data_43357
static int ssl_add_cert_to_buf(BUF_MEM *buf, unsigned long *l, X509 *x) { int n; unsigned char *p; n = i2d_X509(x, NULL); if (n < 0 || !BUF_MEM_grow_clean(buf, (int)(n + (*l) + 3))) { SSLerr(SSL_F_SSL_ADD_CERT_TO_BUF, ERR_R_BUF_LIB); return 0; } p = (unsigned char *)&(buf->data[*l]); l2n3(n, p); n = i2d_X509(x, &p); if (n < 0) { SSLerr(SSL_F_SSL_ADD_CERT_TO_BUF, ERR_R_BUF_LIB); return 0; } *l += n + 3; return 1; } ssl/statem/statem_lib.c:256: error: BUFFER_OVERRUN_S2 Offset: [`s->method->ssl3_enc->hhlen` + 3, +oo] Size: [1, 2147483644] by call to `ssl_add_cert_chain`. Showing all 12 steps of the trace ssl/statem/statem_lib.c:251:1: Parameter `s->method->ssl3_enc->hhlen` 249. } 250. 251. > unsigned long ssl3_output_cert_chain(SSL *s, CERT_PKEY *cpk) 252. { 253. unsigned char *p; ssl/statem/statem_lib.c:254:5: Assignment 252. { 253. unsigned char *p; 254. unsigned long l = 3 + SSL_HM_HEADER_LENGTH(s); ^ 255. 256. if (!ssl_add_cert_chain(s, cpk, &l)) ssl/statem/statem_lib.c:256:10: Call 254. unsigned long l = 3 + SSL_HM_HEADER_LENGTH(s); 255. 256. if (!ssl_add_cert_chain(s, cpk, &l)) ^ 257. return 0; 258. ssl/ssl_cert.c:771:1: Parameter `*l` 769. 770. /* Add certificate chain to internal SSL BUF_MEM structure */ 771. > int ssl_add_cert_chain(SSL *s, CERT_PKEY *cpk, unsigned long *l) 772. { 773. BUF_MEM *buf = s->init_buf; ssl/ssl_cert.c:844:18: Call 842. x = sk_X509_value(chain, i); 843. 844. if (!ssl_add_cert_to_buf(buf, l, x)) { ^ 845. X509_STORE_CTX_free(xs_ctx); 846. return 0; ssl/ssl_cert.c:747:1: <Offset trace> 745. /* Add a certificate to a BUF_MEM structure */ 746. 747. > static int ssl_add_cert_to_buf(BUF_MEM *buf, unsigned long *l, X509 *x) 748. { 749. int n; ssl/ssl_cert.c:747:1: Parameter `*l` 745. /* Add a certificate to a BUF_MEM structure */ 746. 747. > static int ssl_add_cert_to_buf(BUF_MEM *buf, unsigned long *l, X509 *x) 748. { 749. int n; ssl/ssl_cert.c:747:1: <Length trace> 745. /* Add a certificate to a BUF_MEM structure */ 746. 747. > static int ssl_add_cert_to_buf(BUF_MEM *buf, unsigned long *l, X509 *x) 748. { 749. int n; ssl/ssl_cert.c:747:1: Parameter `*buf->data` 745. /* Add a certificate to a BUF_MEM structure */ 746. 747. > static int ssl_add_cert_to_buf(BUF_MEM *buf, unsigned long *l, X509 *x) 748. { 749. int n; ssl/ssl_cert.c:753:19: Call 751. 752. n = i2d_X509(x, NULL); 753. if (n < 0 || !BUF_MEM_grow_clean(buf, (int)(n + (*l) + 3))) { ^ 754. SSLerr(SSL_F_SSL_ADD_CERT_TO_BUF, ERR_R_BUF_LIB); 755. return 0; crypto/buffer/buffer.c:109:1: Parameter `*str->data` 107. } 108. 109. > size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len) 110. { 111. char *ret; ssl/ssl_cert.c:757:5: Array access: Offset: [s->method->ssl3_enc->hhlen + 3, +oo] Size: [1, 2147483644] by call to `ssl_add_cert_chain` 755. return 0; 756. } 757. p = (unsigned char *)&(buf->data[*l]); ^ 758. l2n3(n, p); 759. n = i2d_X509(x, &p);
https://github.com/openssl/openssl/blob/0685b15a68db1cd24678432f38b88f217495cbb9/ssl/ssl_cert.c/#L757
d2a_code_trace_data_43358
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:1060: error: Uninitialized Value The value read from xmin was never initialized. libavcodec/motion_est_template.c:1060:9: 1058. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1) 1059. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) ) 1060. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) ) ^ 1061. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, 1062. (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1060
d2a_code_trace_data_43359
static int init_output_stream_streamcopy(OutputStream *ost) { OutputFile *of = output_files[ost->file_index]; InputStream *ist = get_input_stream(ost); AVCodecParameters *par_dst = ost->st->codecpar; AVCodecParameters *par_src = ist->st->codecpar; AVRational sar; int i; uint64_t extra_size; extra_size = (uint64_t)par_src->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE; if (extra_size > INT_MAX) { return AVERROR(EINVAL); } ost->st->disposition = ist->st->disposition; par_dst->codec_id = par_src->codec_id; par_dst->codec_type = par_src->codec_type; if (!par_dst->codec_tag) { if (!of->ctx->oformat->codec_tag || av_codec_get_id (of->ctx->oformat->codec_tag, par_src->codec_tag) == par_dst->codec_id || av_codec_get_tag(of->ctx->oformat->codec_tag, par_src->codec_id) <= 0) par_dst->codec_tag = par_src->codec_tag; } par_dst->bit_rate = par_src->bit_rate; par_dst->field_order = par_src->field_order; par_dst->chroma_location = par_src->chroma_location; if (par_src->extradata) { par_dst->extradata = av_mallocz(extra_size); if (!par_dst->extradata) { return AVERROR(ENOMEM); } memcpy(par_dst->extradata, par_src->extradata, par_src->extradata_size); par_dst->extradata_size = par_src->extradata_size; } ost->st->time_base = ist->st->time_base; if (ist->st->nb_side_data) { ost->st->side_data = av_realloc_array(NULL, ist->st->nb_side_data, sizeof(*ist->st->side_data)); if (!ost->st->side_data) return AVERROR(ENOMEM); for (i = 0; i < ist->st->nb_side_data; i++) { const AVPacketSideData *sd_src = &ist->st->side_data[i]; AVPacketSideData *sd_dst = &ost->st->side_data[i]; sd_dst->data = av_malloc(sd_src->size); if (!sd_dst->data) return AVERROR(ENOMEM); memcpy(sd_dst->data, sd_src->data, sd_src->size); sd_dst->size = sd_src->size; sd_dst->type = sd_src->type; ost->st->nb_side_data++; } } ost->parser = av_parser_init(par_dst->codec_id); ost->parser_avctx = avcodec_alloc_context3(NULL); if (!ost->parser_avctx) return AVERROR(ENOMEM); switch (par_dst->codec_type) { case AVMEDIA_TYPE_AUDIO: if (audio_volume != 256) { av_log(NULL, AV_LOG_FATAL, "-acodec copy and -vol are incompatible (frames are not decoded)\n"); exit_program(1); } par_dst->channel_layout = par_src->channel_layout; par_dst->sample_rate = par_src->sample_rate; par_dst->channels = par_src->channels; par_dst->block_align = par_src->block_align; break; case AVMEDIA_TYPE_VIDEO: par_dst->format = par_src->format; par_dst->width = par_src->width; par_dst->height = par_src->height; if (ost->frame_aspect_ratio) sar = av_d2q(ost->frame_aspect_ratio * par_dst->height / par_dst->width, 255); else if (ist->st->sample_aspect_ratio.num) sar = ist->st->sample_aspect_ratio; else sar = par_src->sample_aspect_ratio; ost->st->sample_aspect_ratio = par_dst->sample_aspect_ratio = sar; break; case AVMEDIA_TYPE_SUBTITLE: par_dst->width = par_src->width; par_dst->height = par_src->height; break; case AVMEDIA_TYPE_DATA: case AVMEDIA_TYPE_ATTACHMENT: break; default: abort(); } return 0; } avconv.c:1813: error: Null Dereference pointer `ist` last assigned on line 1811 could be null and is dereferenced at line 1813, column 34. avconv.c:1808:1: start of procedure init_output_stream_streamcopy() 1806. } 1807. 1808. static int init_output_stream_streamcopy(OutputStream *ost) ^ 1809. { 1810. OutputFile *of = output_files[ost->file_index]; avconv.c:1810:5: 1808. static int init_output_stream_streamcopy(OutputStream *ost) 1809. { 1810. OutputFile *of = output_files[ost->file_index]; ^ 1811. InputStream *ist = get_input_stream(ost); 1812. AVCodecParameters *par_dst = ost->st->codecpar; avconv.c:1811:5: 1809. { 1810. OutputFile *of = output_files[ost->file_index]; 1811. InputStream *ist = get_input_stream(ost); ^ 1812. AVCodecParameters *par_dst = ost->st->codecpar; 1813. AVCodecParameters *par_src = ist->st->codecpar; avconv.c:1699:1: start of procedure get_input_stream() 1697. } 1698. 1699. static InputStream *get_input_stream(OutputStream *ost) ^ 1700. { 1701. if (ost->source_index >= 0) avconv.c:1701:9: Taking false branch 1699. static InputStream *get_input_stream(OutputStream *ost) 1700. { 1701. if (ost->source_index >= 0) ^ 1702. return input_streams[ost->source_index]; 1703. avconv.c:1704:9: Taking true branch 1702. return input_streams[ost->source_index]; 1703. 1704. if (ost->filter) { ^ 1705. FilterGraph *fg = ost->filter->graph; 1706. int i; avconv.c:1705:9: 1703. 1704. if (ost->filter) { 1705. FilterGraph *fg = ost->filter->graph; ^ 1706. int i; 1707. avconv.c:1708:14: 1706. int i; 1707. 1708. for (i = 0; i < fg->nb_inputs; i++) ^ 1709. if (fg->inputs[i]->ist->dec_ctx->codec_type == ost->enc_ctx->codec_type) 1710. return fg->inputs[i]->ist; avconv.c:1708:21: Loop condition is true. Entering loop body 1706. int i; 1707. 1708. for (i = 0; i < fg->nb_inputs; i++) ^ 1709. if (fg->inputs[i]->ist->dec_ctx->codec_type == ost->enc_ctx->codec_type) 1710. return fg->inputs[i]->ist; avconv.c:1709:17: Taking false branch 1707. 1708. for (i = 0; i < fg->nb_inputs; i++) 1709. if (fg->inputs[i]->ist->dec_ctx->codec_type == ost->enc_ctx->codec_type) ^ 1710. return fg->inputs[i]->ist; 1711. } avconv.c:1708:40: 1706. int i; 1707. 1708. for (i = 0; i < fg->nb_inputs; i++) ^ 1709. if (fg->inputs[i]->ist->dec_ctx->codec_type == ost->enc_ctx->codec_type) 1710. return fg->inputs[i]->ist; avconv.c:1708:21: Loop condition is false. Leaving loop 1706. int i; 1707. 1708. for (i = 0; i < fg->nb_inputs; i++) ^ 1709. if (fg->inputs[i]->ist->dec_ctx->codec_type == ost->enc_ctx->codec_type) 1710. return fg->inputs[i]->ist; avconv.c:1713:5: 1711. } 1712. 1713. return NULL; ^ 1714. } 1715. avconv.c:1714:1: return from a call to get_input_stream 1712. 1713. return NULL; 1714. } ^ 1715. 1716. /* open the muxer when all the streams are initialized */ avconv.c:1812:5: 1810. OutputFile *of = output_files[ost->file_index]; 1811. InputStream *ist = get_input_stream(ost); 1812. AVCodecParameters *par_dst = ost->st->codecpar; ^ 1813. AVCodecParameters *par_src = ist->st->codecpar; 1814. AVRational sar; avconv.c:1813:5: 1811. InputStream *ist = get_input_stream(ost); 1812. AVCodecParameters *par_dst = ost->st->codecpar; 1813. AVCodecParameters *par_src = ist->st->codecpar; ^ 1814. AVRational sar; 1815. int i;
https://github.com/libav/libav/blob/82b7525173f20702a8cbc26ebedbf4b69b8fecec/avconv.c/#L1813
d2a_code_trace_data_43360
static int early_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_early_get0_ext(s, TLSEXT_TYPE_server_name, &p, &remaining) || remaining <= 2) return 0; len = (*(p++) << 1); 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++) << 1); 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:195: error: NULL_DEREFERENCE pointer `ex_data` last assigned on line 147 could be null and is dereferenced at line 195, column 9. Showing all 29 steps of the trace test/handshake_helper.c:142:1: start of procedure early_select_server_ctx() 140. } 141. 142. > static int early_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: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:154:10: Taking false branch 152. * was written, so parsing the normal case is a bit complex. 153. */ 154. if (!SSL_early_get0_ext(s, TLSEXT_TYPE_server_name, &p, &remaining) || ^ 155. remaining <= 2) 156. return 0; test/handshake_helper.c:155:9: Taking false branch 153. */ 154. if (!SSL_early_get0_ext(s, TLSEXT_TYPE_server_name, &p, &remaining) || 155. remaining <= 2) ^ 156. return 0; 157. /* Extract the length of the supplied list of names. */ test/handshake_helper.c:158:5: 156. return 0; 157. /* Extract the length of the supplied list of names. */ 158. > len = (*(p++) << 1); 159. len += *(p++); 160. if (len + 2 != remaining) test/handshake_helper.c:159:5: 157. /* Extract the length of the supplied list of names. */ 158. len = (*(p++) << 1); 159. > len += *(p++); 160. if (len + 2 != remaining) 161. return 0; test/handshake_helper.c:160:9: Taking false branch 158. len = (*(p++) << 1); 159. len += *(p++); 160. if (len + 2 != remaining) ^ 161. return 0; 162. remaining = len; test/handshake_helper.c:162:5: 160. if (len + 2 != remaining) 161. return 0; 162. > remaining = len; 163. /* 164. * The list in practice only has a single element, so we only consider test/handshake_helper.c:167:9: Taking false branch 165. * the first one. 166. */ 167. if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name) ^ 168. return 0; 169. remaining--; test/handshake_helper.c:167:27: Taking false branch 165. * the first one. 166. */ 167. if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name) ^ 168. return 0; 169. remaining--; test/handshake_helper.c:169:5: 167. if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name) 168. return 0; 169. > remaining--; 170. /* Now we can finally pull out the byte array with the actual hostname. */ 171. if (remaining <= 2) test/handshake_helper.c:171:9: Taking false branch 169. remaining--; 170. /* Now we can finally pull out the byte array with the actual hostname. */ 171. if (remaining <= 2) ^ 172. return 0; 173. len = (*(p++) << 1); test/handshake_helper.c:173:5: 171. if (remaining <= 2) 172. return 0; 173. > len = (*(p++) << 1); 174. len += *(p++); 175. if (len + 2 > remaining) test/handshake_helper.c:174:5: 172. return 0; 173. len = (*(p++) << 1); 174. > len += *(p++); 175. if (len + 2 > remaining) 176. return 0; test/handshake_helper.c:175:9: Taking false branch 173. len = (*(p++) << 1); 174. len += *(p++); 175. if (len + 2 > remaining) ^ 176. return 0; 177. remaining = len; test/handshake_helper.c:177:5: 175. if (len + 2 > remaining) 176. return 0; 177. > remaining = len; 178. servername = (const char *)p; 179. test/handshake_helper.c:178:5: 176. return 0; 177. remaining = len; 178. > servername = (const char *)p; 179. 180. if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) { test/handshake_helper.c:180:9: Taking true branch 178. servername = (const char *)p; 179. 180. if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) { ^ 181. SSL_CTX *new_ctx = arg; 182. SSL_set_SSL_CTX(s, new_ctx); test/handshake_helper.c:180:37: Taking false branch 178. servername = (const char *)p; 179. 180. if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) { ^ 181. SSL_CTX *new_ctx = arg; 182. SSL_set_SSL_CTX(s, new_ctx); test/handshake_helper.c:193:16: Taking true branch 191. ex_data->servername = SSL_TEST_SERVERNAME_SERVER2; 192. return 1; 193. } else if (len == strlen("server1") && ^ 194. strncmp(servername, "server1", len) == 0) { 195. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; test/handshake_helper.c:194:16: Taking true branch 192. return 1; 193. } else if (len == strlen("server1") && 194. strncmp(servername, "server1", len) == 0) { ^ 195. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 196. return 1; test/handshake_helper.c:195:9: 193. } else if (len == strlen("server1") && 194. strncmp(servername, "server1", len) == 0) { 195. > ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 196. return 1; 197. } else if (ignore) {
https://github.com/openssl/openssl/blob/0f5df0f1037590de12cc11eeab26fe29bf3f16a3/test/handshake_helper.c/#L195
d2a_code_trace_data_43361
static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, const EVP_MD *dgst, STACK_OF(OPENSSL_STRING) *sigopts, STACK_OF(CONF_VALUE) *policy, CA_DB *db, BIGNUM *serial, char *subj, unsigned long chtype, int multirdn, int email_dn, char *startdate, char *enddate, long days, int batch, int verbose, X509_REQ *req, char *ext_sect, CONF *lconf, unsigned long certopt, unsigned long nameopt, int default_op, int ext_copy, int selfsign) { X509_NAME *name = NULL, *CAname = NULL, *subject = NULL, *dn_subject = NULL; ASN1_UTCTIME *tm, *tmptm; ASN1_STRING *str, *str2; ASN1_OBJECT *obj; X509 *ret = NULL; X509_NAME_ENTRY *ne; X509_NAME_ENTRY *tne, *push; EVP_PKEY *pktmp; int ok = -1, i, j, last, nid; const char *p; CONF_VALUE *cv; OPENSSL_STRING row[DB_NUMBER]; OPENSSL_STRING *irow = NULL; OPENSSL_STRING *rrow = NULL; char buf[25]; tmptm = ASN1_UTCTIME_new(); if (tmptm == NULL) { BIO_printf(bio_err, "malloc error\n"); return (0); } for (i = 0; i < DB_NUMBER; i++) row[i] = NULL; if (subj) { X509_NAME *n = parse_name(subj, chtype, multirdn); if (!n) { ERR_print_errors(bio_err); goto end; } X509_REQ_set_subject_name(req, n); X509_NAME_free(n); } if (default_op) BIO_printf(bio_err, "The Subject's Distinguished Name is as follows\n"); name = X509_REQ_get_subject_name(req); for (i = 0; i < X509_NAME_entry_count(name); i++) { ne = X509_NAME_get_entry(name, i); str = X509_NAME_ENTRY_get_data(ne); obj = X509_NAME_ENTRY_get_object(ne); if (msie_hack) { nid = OBJ_obj2nid(X509_NAME_ENTRY_get_object(ne)); if (str->type == V_ASN1_UNIVERSALSTRING) ASN1_UNIVERSALSTRING_to_string(str); if ((str->type == V_ASN1_IA5STRING) && (nid != NID_pkcs9_emailAddress)) str->type = V_ASN1_T61STRING; if ((nid == NID_pkcs9_emailAddress) && (str->type == V_ASN1_PRINTABLESTRING)) str->type = V_ASN1_IA5STRING; } if ((OBJ_obj2nid(obj) == NID_pkcs9_emailAddress) && (!email_dn)) continue; if ((OBJ_obj2nid(obj) == NID_pkcs9_emailAddress) && (str->type != V_ASN1_IA5STRING)) { BIO_printf(bio_err, "\nemailAddress type needs to be of type IA5STRING\n"); goto end; } if ((str->type != V_ASN1_BMPSTRING) && (str->type != V_ASN1_UTF8STRING)) { j = ASN1_PRINTABLE_type(str->data, str->length); if (((j == V_ASN1_T61STRING) && (str->type != V_ASN1_T61STRING)) || ((j == V_ASN1_IA5STRING) && (str->type == V_ASN1_PRINTABLESTRING))) { BIO_printf(bio_err, "\nThe string contains characters that are illegal for the ASN.1 type\n"); goto end; } } if (default_op) old_entry_print(obj, str); } if ((subject = X509_NAME_new()) == NULL) { BIO_printf(bio_err, "Memory allocation failure\n"); goto end; } if (selfsign) CAname = X509_NAME_dup(name); else CAname = X509_NAME_dup(X509_get_subject_name(x509)); if (CAname == NULL) goto end; str = str2 = NULL; for (i = 0; i < sk_CONF_VALUE_num(policy); i++) { cv = sk_CONF_VALUE_value(policy, i); if ((j = OBJ_txt2nid(cv->name)) == NID_undef) { BIO_printf(bio_err, "%s:unknown object type in 'policy' configuration\n", cv->name); goto end; } obj = OBJ_nid2obj(j); last = -1; for (;;) { j = X509_NAME_get_index_by_OBJ(name, obj, last); if (j < 0) { if (last != -1) break; tne = NULL; } else { tne = X509_NAME_get_entry(name, j); } last = j; push = NULL; if (strcmp(cv->value, "optional") == 0) { if (tne != NULL) push = tne; } else if (strcmp(cv->value, "supplied") == 0) { if (tne == NULL) { BIO_printf(bio_err, "The %s field needed to be supplied and was missing\n", cv->name); goto end; } else push = tne; } else if (strcmp(cv->value, "match") == 0) { int last2; if (tne == NULL) { BIO_printf(bio_err, "The mandatory %s field was missing\n", cv->name); goto end; } last2 = -1; again2: j = X509_NAME_get_index_by_OBJ(CAname, obj, last2); if ((j < 0) && (last2 == -1)) { BIO_printf(bio_err, "The %s field does not exist in the CA certificate,\nthe 'policy' is misconfigured\n", cv->name); goto end; } if (j >= 0) { push = X509_NAME_get_entry(CAname, j); str = X509_NAME_ENTRY_get_data(tne); str2 = X509_NAME_ENTRY_get_data(push); last2 = j; if (ASN1_STRING_cmp(str, str2) != 0) goto again2; } if (j < 0) { BIO_printf(bio_err, "The %s field needed to be the same in the\nCA certificate (%s) and the request (%s)\n", cv->name, ((str2 == NULL) ? "NULL" : (char *)str2->data), ((str == NULL) ? "NULL" : (char *)str->data)); goto end; } } else { BIO_printf(bio_err, "%s:invalid type in 'policy' configuration\n", cv->value); goto end; } if (push != NULL) { if (!X509_NAME_add_entry(subject, push, -1, 0)) { X509_NAME_ENTRY_free(push); BIO_printf(bio_err, "Memory allocation failure\n"); goto end; } } if (j < 0) break; } } if (preserve) { X509_NAME_free(subject); subject = X509_NAME_dup(name); if (subject == NULL) goto end; } if (verbose) BIO_printf(bio_err, "The subject name appears to be ok, checking data base for clashes\n"); if (email_dn) dn_subject = subject; else { X509_NAME_ENTRY *tmpne; if ((dn_subject = X509_NAME_dup(subject)) == NULL) { BIO_printf(bio_err, "Memory allocation failure\n"); goto end; } while ((i = X509_NAME_get_index_by_NID(dn_subject, NID_pkcs9_emailAddress, -1)) >= 0) { tmpne = X509_NAME_get_entry(dn_subject, i); X509_NAME_delete_entry(dn_subject, i); X509_NAME_ENTRY_free(tmpne); } } if (BN_is_zero(serial)) row[DB_serial] = BUF_strdup("00"); else row[DB_serial] = BN_bn2hex(serial); if (row[DB_serial] == NULL) { BIO_printf(bio_err, "Memory allocation failure\n"); goto end; } if (db->attributes.unique_subject) { OPENSSL_STRING *crow = row; rrow = TXT_DB_get_by_index(db->db, DB_name, crow); if (rrow != NULL) { BIO_printf(bio_err, "ERROR:There is already a certificate for %s\n", row[DB_name]); } } if (rrow == NULL) { rrow = TXT_DB_get_by_index(db->db, DB_serial, row); if (rrow != NULL) { BIO_printf(bio_err, "ERROR:Serial number %s has already been issued,\n", row[DB_serial]); BIO_printf(bio_err, " check the database/serial_file for corruption\n"); } } if (rrow != NULL) { BIO_printf(bio_err, "The matching entry has the following details\n"); if (rrow[DB_type][0] == 'E') p = "Expired"; else if (rrow[DB_type][0] == 'R') p = "Revoked"; else if (rrow[DB_type][0] == 'V') p = "Valid"; else p = "\ninvalid type, Data base error\n"; BIO_printf(bio_err, "Type :%s\n", p);; if (rrow[DB_type][0] == 'R') { p = rrow[DB_exp_date]; if (p == NULL) p = "undef"; BIO_printf(bio_err, "Was revoked on:%s\n", p); } p = rrow[DB_exp_date]; if (p == NULL) p = "undef"; BIO_printf(bio_err, "Expires on :%s\n", p); p = rrow[DB_serial]; if (p == NULL) p = "undef"; BIO_printf(bio_err, "Serial Number :%s\n", p); p = rrow[DB_file]; if (p == NULL) p = "undef"; BIO_printf(bio_err, "File name :%s\n", p); p = rrow[DB_name]; if (p == NULL) p = "undef"; BIO_printf(bio_err, "Subject Name :%s\n", p); ok = -1; goto end; } if (verbose) BIO_printf(bio_err, "Everything appears to be ok, creating and signing the certificate\n"); if ((ret = X509_new()) == NULL) goto end; #ifdef X509_V3 if (!X509_set_version(ret, 2)) goto end; #endif if (BN_to_ASN1_INTEGER(serial, X509_get_serialNumber(ret)) == NULL) goto end; if (selfsign) { if (!X509_set_issuer_name(ret, subject)) goto end; } else { if (!X509_set_issuer_name(ret, X509_get_subject_name(x509))) goto end; } if (strcmp(startdate, "today") == 0) X509_gmtime_adj(X509_get_notBefore(ret), 0); else ASN1_TIME_set_string(X509_get_notBefore(ret), startdate); if (enddate == NULL) X509_time_adj_ex(X509_get_notAfter(ret), days, 0, NULL); else { int tdays; ASN1_TIME_set_string(X509_get_notAfter(ret), enddate); ASN1_TIME_diff(&tdays, NULL, NULL, X509_get_notAfter(ret)); days = tdays; } if (!X509_set_subject_name(ret, subject)) goto end; pktmp = X509_REQ_get_pubkey(req); i = X509_set_pubkey(ret, pktmp); EVP_PKEY_free(pktmp); if (!i) goto end; if (ext_sect) { X509V3_CTX ctx; X509_set_version(ret, 2); if (selfsign) X509V3_set_ctx(&ctx, ret, ret, req, NULL, 0); else X509V3_set_ctx(&ctx, x509, ret, req, NULL, 0); if (extconf) { if (verbose) BIO_printf(bio_err, "Extra configuration file found\n"); X509V3_set_nconf(&ctx, extconf); if (!X509V3_EXT_add_nconf(extconf, &ctx, ext_sect, ret)) { BIO_printf(bio_err, "ERROR: adding extensions in section %s\n", ext_sect); ERR_print_errors(bio_err); goto end; } if (verbose) BIO_printf(bio_err, "Successfully added extensions from file.\n"); } else if (ext_sect) { X509V3_set_nconf(&ctx, lconf); if (!X509V3_EXT_add_nconf(lconf, &ctx, ext_sect, ret)) { BIO_printf(bio_err, "ERROR: adding extensions in section %s\n", ext_sect); ERR_print_errors(bio_err); goto end; } if (verbose) BIO_printf(bio_err, "Successfully added extensions from config\n"); } } if (!copy_extensions(ret, req, ext_copy)) { BIO_printf(bio_err, "ERROR: adding extensions from request\n"); ERR_print_errors(bio_err); goto end; } if (email_dn == 0) { if (!X509_set_subject_name(ret, dn_subject)) goto end; } if (!default_op) { BIO_printf(bio_err, "Certificate Details:\n"); certopt |= X509_FLAG_NO_SIGDUMP | X509_FLAG_NO_SIGNAME; X509_print_ex(bio_err, ret, nameopt, certopt); } BIO_printf(bio_err, "Certificate is to be certified until "); ASN1_TIME_print(bio_err, X509_get_notAfter(ret)); if (days) BIO_printf(bio_err, " (%ld days)", days); BIO_printf(bio_err, "\n"); if (!batch) { BIO_printf(bio_err, "Sign the certificate? [y/n]:"); (void)BIO_flush(bio_err); buf[0] = '\0'; if (!fgets(buf, sizeof(buf) - 1, stdin)) { BIO_printf(bio_err, "CERTIFICATE WILL NOT BE CERTIFIED: I/O error\n"); ok = 0; goto end; } if (!((buf[0] == 'y') || (buf[0] == 'Y'))) { BIO_printf(bio_err, "CERTIFICATE WILL NOT BE CERTIFIED\n"); ok = 0; goto end; } } pktmp = X509_get_pubkey(ret); if (EVP_PKEY_missing_parameters(pktmp) && !EVP_PKEY_missing_parameters(pkey)) EVP_PKEY_copy_parameters(pktmp, pkey); EVP_PKEY_free(pktmp); if (!do_X509_sign(ret, pkey, dgst, sigopts)) goto end; row[DB_type] = app_malloc(2, "row db type"); tm = X509_get_notAfter(ret); row[DB_exp_date] = app_malloc(tm->length + 1, "row expdate"); memcpy(row[DB_exp_date], tm->data, tm->length); row[DB_exp_date][tm->length] = '\0'; row[DB_rev_date] = NULL; row[DB_file] = app_malloc(8, "row file"); row[DB_name] = X509_NAME_oneline(X509_get_subject_name(ret), NULL, 0); if ((row[DB_type] == NULL) || (row[DB_exp_date] == NULL) || (row[DB_file] == NULL) || (row[DB_name] == NULL)) { BIO_printf(bio_err, "Memory allocation failure\n"); goto end; } BUF_strlcpy(row[DB_file], "unknown", 8); row[DB_type][0] = 'V'; row[DB_type][1] = '\0'; irow = app_malloc(sizeof(*irow) * (DB_NUMBER + 1), "row space"); for (i = 0; i < DB_NUMBER; i++) { irow[i] = row[i]; row[i] = NULL; } irow[DB_NUMBER] = NULL; if (!TXT_DB_insert(db->db, irow)) { BIO_printf(bio_err, "failed to update database\n"); BIO_printf(bio_err, "TXT_DB error number %ld\n", db->db->error); goto end; } ok = 1; end: for (i = 0; i < DB_NUMBER; i++) OPENSSL_free(row[i]); X509_NAME_free(CAname); X509_NAME_free(subject); if (dn_subject != subject) X509_NAME_free(dn_subject); ASN1_UTCTIME_free(tmptm); if (ok <= 0) X509_free(ret); else *xret = ret; return (ok); } apps/ca.c:1500: error: NULL_DEREFERENCE pointer `str` last assigned on line 1493 could be null and is dereferenced at line 1500, column 17. Showing all 95 steps of the trace apps/ca.c:1440:1: start of procedure do_body() 1438. } 1439. 1440. > static int do_body(X509 **xret, EVP_PKEY *pkey, X509 *x509, 1441. const EVP_MD *dgst, STACK_OF(OPENSSL_STRING) *sigopts, 1442. STACK_OF(CONF_VALUE) *policy, CA_DB *db, BIGNUM *serial, apps/ca.c:1449:5: 1447. int default_op, int ext_copy, int selfsign) 1448. { 1449. > X509_NAME *name = NULL, *CAname = NULL, *subject = NULL, *dn_subject = 1450. NULL; 1451. ASN1_UTCTIME *tm, *tmptm; apps/ca.c:1454:5: 1452. ASN1_STRING *str, *str2; 1453. ASN1_OBJECT *obj; 1454. > X509 *ret = NULL; 1455. X509_NAME_ENTRY *ne; 1456. X509_NAME_ENTRY *tne, *push; apps/ca.c:1458:5: 1456. X509_NAME_ENTRY *tne, *push; 1457. EVP_PKEY *pktmp; 1458. > int ok = -1, i, j, last, nid; 1459. const char *p; 1460. CONF_VALUE *cv; apps/ca.c:1462:5: 1460. CONF_VALUE *cv; 1461. OPENSSL_STRING row[DB_NUMBER]; 1462. > OPENSSL_STRING *irow = NULL; 1463. OPENSSL_STRING *rrow = NULL; 1464. char buf[25]; apps/ca.c:1463:5: 1461. OPENSSL_STRING row[DB_NUMBER]; 1462. OPENSSL_STRING *irow = NULL; 1463. > OPENSSL_STRING *rrow = NULL; 1464. char buf[25]; 1465. apps/ca.c:1466:5: 1464. char buf[25]; 1465. 1466. > tmptm = ASN1_UTCTIME_new(); 1467. if (tmptm == NULL) { 1468. BIO_printf(bio_err, "malloc error\n"); crypto/asn1/tasn_typ.c:86:1: start of procedure ASN1_UTCTIME_new() 84. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_IA5STRING) 85. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALSTRING) 86. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UTCTIME) 87. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALIZEDTIME) 88. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_VISIBLESTRING) crypto/asn1/tasn_typ.c:86:1: return from a call to ASN1_UTCTIME_new 84. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_IA5STRING) 85. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALSTRING) 86. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UTCTIME) 87. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALIZEDTIME) 88. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_VISIBLESTRING) apps/ca.c:1467:9: Taking false branch 1465. 1466. tmptm = ASN1_UTCTIME_new(); 1467. if (tmptm == NULL) { ^ 1468. BIO_printf(bio_err, "malloc error\n"); 1469. return (0); apps/ca.c:1472:10: 1470. } 1471. 1472. > for (i = 0; i < DB_NUMBER; i++) 1473. row[i] = NULL; 1474. apps/ca.c:1472:17: Loop condition is true. Entering loop body 1470. } 1471. 1472. for (i = 0; i < DB_NUMBER; i++) ^ 1473. row[i] = NULL; 1474. apps/ca.c:1473:9: 1471. 1472. for (i = 0; i < DB_NUMBER; i++) 1473. > row[i] = NULL; 1474. 1475. if (subj) { apps/ca.c:1472:32: 1470. } 1471. 1472. > for (i = 0; i < DB_NUMBER; i++) 1473. row[i] = NULL; 1474. apps/ca.c:1472:17: Loop condition is false. Leaving loop 1470. } 1471. 1472. for (i = 0; i < DB_NUMBER; i++) ^ 1473. row[i] = NULL; 1474. apps/ca.c:1475:9: Taking true branch 1473. row[i] = NULL; 1474. 1475. if (subj) { ^ 1476. X509_NAME *n = parse_name(subj, chtype, multirdn); 1477. apps/ca.c:1476:9: Skipping parse_name(): empty list of specs 1474. 1475. if (subj) { 1476. X509_NAME *n = parse_name(subj, chtype, multirdn); ^ 1477. 1478. if (!n) { apps/ca.c:1478:14: Taking false branch 1476. X509_NAME *n = parse_name(subj, chtype, multirdn); 1477. 1478. if (!n) { ^ 1479. ERR_print_errors(bio_err); 1480. goto end; apps/ca.c:1482:9: 1480. goto end; 1481. } 1482. > X509_REQ_set_subject_name(req, n); 1483. X509_NAME_free(n); 1484. } crypto/x509/x509rset.c:75:1: start of procedure X509_REQ_set_subject_name() 73. } 74. 75. > int X509_REQ_set_subject_name(X509_REQ *x, X509_NAME *name) 76. { 77. if ((x == NULL) || (x->req_info == NULL)) crypto/x509/x509rset.c:77:10: Taking false branch 75. int X509_REQ_set_subject_name(X509_REQ *x, X509_NAME *name) 76. { 77. if ((x == NULL) || (x->req_info == NULL)) ^ 78. return (0); 79. x->req_info->enc.modified = 1; crypto/x509/x509rset.c:77:25: Taking false branch 75. int X509_REQ_set_subject_name(X509_REQ *x, X509_NAME *name) 76. { 77. if ((x == NULL) || (x->req_info == NULL)) ^ 78. return (0); 79. x->req_info->enc.modified = 1; crypto/x509/x509rset.c:79:5: 77. if ((x == NULL) || (x->req_info == NULL)) 78. return (0); 79. > x->req_info->enc.modified = 1; 80. return (X509_NAME_set(&x->req_info->subject, name)); 81. } crypto/x509/x509rset.c:80:5: 78. return (0); 79. x->req_info->enc.modified = 1; 80. > return (X509_NAME_set(&x->req_info->subject, name)); 81. } 82. crypto/x509/x_name.c:501:1: start of procedure X509_NAME_set() 499. } 500. 501. > int X509_NAME_set(X509_NAME **xn, X509_NAME *name) 502. { 503. X509_NAME *in; crypto/x509/x_name.c:505:10: Taking false branch 503. X509_NAME *in; 504. 505. if (!xn || !name) ^ 506. return (0); 507. crypto/x509/x_name.c:505:17: Taking false branch 503. X509_NAME *in; 504. 505. if (!xn || !name) ^ 506. return (0); 507. crypto/x509/x_name.c:508:9: Taking false branch 506. return (0); 507. 508. if (*xn != name) { ^ 509. in = X509_NAME_dup(name); 510. if (in != NULL) { crypto/x509/x_name.c:515:13: Condition is true 513. } 514. } 515. return (*xn != NULL); ^ 516. } crypto/x509/x_name.c:515:5: 513. } 514. } 515. > return (*xn != NULL); 516. } crypto/x509/x_name.c:516:1: return from a call to X509_NAME_set 514. } 515. return (*xn != NULL); 516. > } crypto/x509/x509rset.c:81:1: return from a call to X509_REQ_set_subject_name 79. x->req_info->enc.modified = 1; 80. return (X509_NAME_set(&x->req_info->subject, name)); 81. > } 82. 83. int X509_REQ_set_pubkey(X509_REQ *x, EVP_PKEY *pkey) apps/ca.c:1483:9: 1481. } 1482. X509_REQ_set_subject_name(req, n); 1483. > X509_NAME_free(n); 1484. } 1485. crypto/x509/x_name.c:130:1: start of procedure X509_NAME_free() 128. IMPLEMENT_EXTERN_ASN1(X509_NAME, V_ASN1_SEQUENCE, x509_name_ff) 129. 130. > IMPLEMENT_ASN1_FUNCTIONS(X509_NAME) 131. 132. IMPLEMENT_ASN1_DUP_FUNCTION(X509_NAME) crypto/asn1/tasn_fre.c:68:1: start of procedure ASN1_item_free() 66. /* Free up an ASN1 structure */ 67. 68. > void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it) 69. { 70. ASN1_item_ex_free(&val, it); crypto/asn1/tasn_fre.c:70:5: Skipping ASN1_item_ex_free(): empty list of specs 68. void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it) 69. { 70. ASN1_item_ex_free(&val, it); ^ 71. } 72. crypto/asn1/tasn_fre.c:71:1: return from a call to ASN1_item_free 69. { 70. ASN1_item_ex_free(&val, it); 71. > } 72. 73. void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it) crypto/x509/x_name.c:130:1: return from a call to X509_NAME_free 128. IMPLEMENT_EXTERN_ASN1(X509_NAME, V_ASN1_SEQUENCE, x509_name_ff) 129. 130. > IMPLEMENT_ASN1_FUNCTIONS(X509_NAME) 131. 132. IMPLEMENT_ASN1_DUP_FUNCTION(X509_NAME) apps/ca.c:1486:9: Taking false branch 1484. } 1485. 1486. if (default_op) ^ 1487. BIO_printf(bio_err, 1488. "The Subject's Distinguished Name is as follows\n"); apps/ca.c:1490:5: 1488. "The Subject's Distinguished Name is as follows\n"); 1489. 1490. > name = X509_REQ_get_subject_name(req); 1491. for (i = 0; i < X509_NAME_entry_count(name); i++) { 1492. ne = X509_NAME_get_entry(name, i); crypto/x509/x509_req.c:313:1: start of procedure X509_REQ_get_subject_name() 311. } 312. 313. > X509_NAME *X509_REQ_get_subject_name(X509_REQ *req) 314. { 315. return req->req_info->subject; crypto/x509/x509_req.c:315:5: 313. X509_NAME *X509_REQ_get_subject_name(X509_REQ *req) 314. { 315. > return req->req_info->subject; 316. } crypto/x509/x509_req.c:316:1: return from a call to X509_REQ_get_subject_name 314. { 315. return req->req_info->subject; 316. > } apps/ca.c:1491:10: 1489. 1490. name = X509_REQ_get_subject_name(req); 1491. > for (i = 0; i < X509_NAME_entry_count(name); i++) { 1492. ne = X509_NAME_get_entry(name, i); 1493. str = X509_NAME_ENTRY_get_data(ne); apps/ca.c:1491:17: 1489. 1490. name = X509_REQ_get_subject_name(req); 1491. > for (i = 0; i < X509_NAME_entry_count(name); i++) { 1492. ne = X509_NAME_get_entry(name, i); 1493. str = X509_NAME_ENTRY_get_data(ne); crypto/x509/x509name.c:96:1: start of procedure X509_NAME_entry_count() 94. } 95. 96. > int X509_NAME_entry_count(X509_NAME *name) 97. { 98. if (name == NULL) crypto/x509/x509name.c:98:9: Taking false branch 96. int X509_NAME_entry_count(X509_NAME *name) 97. { 98. if (name == NULL) ^ 99. return (0); 100. return (sk_X509_NAME_ENTRY_num(name->entries)); crypto/x509/x509name.c:100:13: Condition is true 98. if (name == NULL) 99. return (0); 100. return (sk_X509_NAME_ENTRY_num(name->entries)); ^ 101. } 102. crypto/x509/x509name.c:100:5: 98. if (name == NULL) 99. return (0); 100. > return (sk_X509_NAME_ENTRY_num(name->entries)); 101. } 102. crypto/stack/stack.c:317:1: start of procedure sk_num() 315. } 316. 317. > int sk_num(const _STACK *st) 318. { 319. if (st == NULL) crypto/stack/stack.c:319:9: Taking false branch 317. int sk_num(const _STACK *st) 318. { 319. if (st == NULL) ^ 320. return -1; 321. return st->num; crypto/stack/stack.c:321:5: 319. if (st == NULL) 320. return -1; 321. > return st->num; 322. } 323. crypto/stack/stack.c:322:1: return from a call to sk_num 320. return -1; 321. return st->num; 322. > } 323. 324. void *sk_value(const _STACK *st, int i) crypto/x509/x509name.c:101:1: return from a call to X509_NAME_entry_count 99. return (0); 100. return (sk_X509_NAME_ENTRY_num(name->entries)); 101. > } 102. 103. int X509_NAME_get_index_by_NID(X509_NAME *name, int nid, int lastpos) apps/ca.c:1491:17: Loop condition is true. Entering loop body 1489. 1490. name = X509_REQ_get_subject_name(req); 1491. for (i = 0; i < X509_NAME_entry_count(name); i++) { ^ 1492. ne = X509_NAME_get_entry(name, i); 1493. str = X509_NAME_ENTRY_get_data(ne); apps/ca.c:1492:9: 1490. name = X509_REQ_get_subject_name(req); 1491. for (i = 0; i < X509_NAME_entry_count(name); i++) { 1492. > ne = X509_NAME_get_entry(name, i); 1493. str = X509_NAME_ENTRY_get_data(ne); 1494. obj = X509_NAME_ENTRY_get_object(ne); crypto/x509/x509name.c:134:1: start of procedure X509_NAME_get_entry() 132. } 133. 134. > X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc) 135. { 136. if (name == NULL || sk_X509_NAME_ENTRY_num(name->entries) <= loc crypto/x509/x509name.c:136:9: Taking false branch 134. X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc) 135. { 136. if (name == NULL || sk_X509_NAME_ENTRY_num(name->entries) <= loc ^ 137. || loc < 0) 138. return (NULL); crypto/x509/x509name.c:136:25: Condition is true 134. X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc) 135. { 136. if (name == NULL || sk_X509_NAME_ENTRY_num(name->entries) <= loc ^ 137. || loc < 0) 138. return (NULL); crypto/stack/stack.c:317:1: start of procedure sk_num() 315. } 316. 317. > int sk_num(const _STACK *st) 318. { 319. if (st == NULL) crypto/stack/stack.c:319:9: Taking false branch 317. int sk_num(const _STACK *st) 318. { 319. if (st == NULL) ^ 320. return -1; 321. return st->num; crypto/stack/stack.c:321:5: 319. if (st == NULL) 320. return -1; 321. > return st->num; 322. } 323. crypto/stack/stack.c:322:1: return from a call to sk_num 320. return -1; 321. return st->num; 322. > } 323. 324. void *sk_value(const _STACK *st, int i) crypto/x509/x509name.c:136:25: Taking false branch 134. X509_NAME_ENTRY *X509_NAME_get_entry(X509_NAME *name, int loc) 135. { 136. if (name == NULL || sk_X509_NAME_ENTRY_num(name->entries) <= loc ^ 137. || loc < 0) 138. return (NULL); crypto/x509/x509name.c:137:12: Taking false branch 135. { 136. if (name == NULL || sk_X509_NAME_ENTRY_num(name->entries) <= loc 137. || loc < 0) ^ 138. return (NULL); 139. else crypto/x509/x509name.c:140:17: Condition is true 138. return (NULL); 139. else 140. return (sk_X509_NAME_ENTRY_value(name->entries, loc)); ^ 141. } 142. crypto/x509/x509name.c:140:9: 138. return (NULL); 139. else 140. > return (sk_X509_NAME_ENTRY_value(name->entries, loc)); 141. } 142. 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/x509/x509name.c:141:1: return from a call to X509_NAME_get_entry 139. else 140. return (sk_X509_NAME_ENTRY_value(name->entries, loc)); 141. > } 142. 143. X509_NAME_ENTRY *X509_NAME_delete_entry(X509_NAME *name, int loc) apps/ca.c:1493:9: 1491. for (i = 0; i < X509_NAME_entry_count(name); i++) { 1492. ne = X509_NAME_get_entry(name, i); 1493. > str = X509_NAME_ENTRY_get_data(ne); 1494. obj = X509_NAME_ENTRY_get_object(ne); 1495. crypto/x509/x509name.c:392:1: start of procedure X509_NAME_ENTRY_get_data() 390. } 391. 392. > ASN1_STRING *X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne) 393. { 394. if (ne == NULL) crypto/x509/x509name.c:394:9: Taking true branch 392. ASN1_STRING *X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne) 393. { 394. if (ne == NULL) ^ 395. return (NULL); 396. return (ne->value); crypto/x509/x509name.c:395:9: 393. { 394. if (ne == NULL) 395. > return (NULL); 396. return (ne->value); 397. } crypto/x509/x509name.c:397:1: return from a call to X509_NAME_ENTRY_get_data 395. return (NULL); 396. return (ne->value); 397. > } 398. 399. int X509_NAME_ENTRY_set(const X509_NAME_ENTRY *ne) apps/ca.c:1494:9: 1492. ne = X509_NAME_get_entry(name, i); 1493. str = X509_NAME_ENTRY_get_data(ne); 1494. > obj = X509_NAME_ENTRY_get_object(ne); 1495. 1496. if (msie_hack) { crypto/x509/x509name.c:385:1: start of procedure X509_NAME_ENTRY_get_object() 383. } 384. 385. > ASN1_OBJECT *X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne) 386. { 387. if (ne == NULL) crypto/x509/x509name.c:387:9: Taking true branch 385. ASN1_OBJECT *X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne) 386. { 387. if (ne == NULL) ^ 388. return (NULL); 389. return (ne->object); crypto/x509/x509name.c:388:9: 386. { 387. if (ne == NULL) 388. > return (NULL); 389. return (ne->object); 390. } crypto/x509/x509name.c:390:1: return from a call to X509_NAME_ENTRY_get_object 388. return (NULL); 389. return (ne->object); 390. > } 391. 392. ASN1_STRING *X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne) apps/ca.c:1496:13: Taking true branch 1494. obj = X509_NAME_ENTRY_get_object(ne); 1495. 1496. if (msie_hack) { ^ 1497. /* assume all type should be strings */ 1498. nid = OBJ_obj2nid(X509_NAME_ENTRY_get_object(ne)); apps/ca.c:1498:13: 1496. if (msie_hack) { 1497. /* assume all type should be strings */ 1498. > nid = OBJ_obj2nid(X509_NAME_ENTRY_get_object(ne)); 1499. 1500. if (str->type == V_ASN1_UNIVERSALSTRING) crypto/x509/x509name.c:385:1: start of procedure X509_NAME_ENTRY_get_object() 383. } 384. 385. > ASN1_OBJECT *X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne) 386. { 387. if (ne == NULL) crypto/x509/x509name.c:387:9: Taking true branch 385. ASN1_OBJECT *X509_NAME_ENTRY_get_object(X509_NAME_ENTRY *ne) 386. { 387. if (ne == NULL) ^ 388. return (NULL); 389. return (ne->object); crypto/x509/x509name.c:388:9: 386. { 387. if (ne == NULL) 388. > return (NULL); 389. return (ne->object); 390. } crypto/x509/x509name.c:390:1: return from a call to X509_NAME_ENTRY_get_object 388. return (NULL); 389. return (ne->object); 390. > } 391. 392. ASN1_STRING *X509_NAME_ENTRY_get_data(X509_NAME_ENTRY *ne) crypto/objects/obj_dat.c:390:1: start of procedure OBJ_obj2nid() 388. IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj); 389. 390. > int OBJ_obj2nid(const ASN1_OBJECT *a) 391. { 392. const unsigned int *op; crypto/objects/obj_dat.c:395:9: Taking true branch 393. ADDED_OBJ ad, *adp; 394. 395. if (a == NULL) ^ 396. return (NID_undef); 397. if (a->nid != 0) crypto/objects/obj_dat.c:396:9: 394. 395. if (a == NULL) 396. > return (NID_undef); 397. if (a->nid != 0) 398. return (a->nid); crypto/objects/obj_dat.c:414:1: return from a call to OBJ_obj2nid 412. return (NID_undef); 413. return (nid_objs[*op].nid); 414. > } 415. 416. /* apps/ca.c:1500:17: 1498. nid = OBJ_obj2nid(X509_NAME_ENTRY_get_object(ne)); 1499. 1500. > if (str->type == V_ASN1_UNIVERSALSTRING) 1501. ASN1_UNIVERSALSTRING_to_string(str); 1502.
https://github.com/openssl/openssl/blob/0f81f5f78c06bd69a96deb66cd30e50a67310ef2/apps/ca.c/#L1500
d2a_code_trace_data_43362
static int opt_metadata(const char *opt, const char *arg) { char *mid= strchr(arg, '='); if(!mid){ fprintf(stderr, "Missing =\n"); ffmpeg_exit(1); } *mid++= 0; metadata_count++; metadata= av_realloc(metadata, sizeof(*metadata)*metadata_count); metadata[metadata_count-1].key = av_strdup(arg); metadata[metadata_count-1].value= av_strdup(mid); return 0; } ffmpeg.c:2881: error: Null Dereference pointer `mid` last assigned on line 2881 could be null and is dereferenced at line 2881, column 5. ffmpeg.c:2873:1: start of procedure opt_metadata() 2871. } 2872. 2873. static int opt_metadata(const char *opt, const char *arg) ^ 2874. { 2875. char *mid= strchr(arg, '='); ffmpeg.c:2875:5: 2873. static int opt_metadata(const char *opt, const char *arg) 2874. { 2875. char *mid= strchr(arg, '='); ^ 2876. 2877. if(!mid){ ffmpeg.c:2877:9: Taking true branch 2875. char *mid= strchr(arg, '='); 2876. 2877. if(!mid){ ^ 2878. fprintf(stderr, "Missing =\n"); 2879. ffmpeg_exit(1); ffmpeg.c:2878:9: 2876. 2877. if(!mid){ 2878. fprintf(stderr, "Missing =\n"); ^ 2879. ffmpeg_exit(1); 2880. } ffmpeg.c:2879:9: Skipping ffmpeg_exit(): empty list of specs 2877. if(!mid){ 2878. fprintf(stderr, "Missing =\n"); 2879. ffmpeg_exit(1); ^ 2880. } 2881. *mid++= 0; ffmpeg.c:2881:5: 2879. ffmpeg_exit(1); 2880. } 2881. *mid++= 0; ^ 2882. 2883. metadata_count++;
https://github.com/libav/libav/blob/ad0d70c964f852a18e9ab8124f0e7aa8876cac6e/ffmpeg.c/#L2881
d2a_code_trace_data_43363
static void opt_input_ts_scale(const char *arg) { unsigned int stream; double scale; char *p; stream = strtol(arg, &p, 0); if (*p) p++; scale= strtod(p, &p); if(stream >= MAX_STREAMS) ffmpeg_exit(1); input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); input_files_ts_scale[nb_input_files][stream]= scale; } ffmpeg.c:2913: error: Null Dereference pointer `input_files_ts_scale[nb_input_files]` last assigned on line 2912 could be null and is dereferenced at line 2913, column 5. ffmpeg.c:2898:1: start of procedure opt_input_ts_scale() 2896. } 2897. 2898. static void opt_input_ts_scale(const char *arg) ^ 2899. { 2900. unsigned int stream; ffmpeg.c:2904:5: 2902. char *p; 2903. 2904. stream = strtol(arg, &p, 0); ^ 2905. if (*p) 2906. p++; ffmpeg.c:2905:9: Taking false branch 2903. 2904. stream = strtol(arg, &p, 0); 2905. if (*p) ^ 2906. p++; 2907. scale= strtod(p, &p); ffmpeg.c:2907:5: 2905. if (*p) 2906. p++; 2907. scale= strtod(p, &p); ^ 2908. 2909. if(stream >= MAX_STREAMS) ffmpeg.c:2909:8: Taking true branch 2907. scale= strtod(p, &p); 2908. 2909. if(stream >= MAX_STREAMS) ^ 2910. ffmpeg_exit(1); 2911. ffmpeg.c:2910:9: Skipping ffmpeg_exit(): empty list of specs 2908. 2909. if(stream >= MAX_STREAMS) 2910. ffmpeg_exit(1); ^ 2911. 2912. input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); ffmpeg.c:2912:5: 2910. ffmpeg_exit(1); 2911. 2912. input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); ^ 2913. input_files_ts_scale[nb_input_files][stream]= scale; 2914. } ffmpeg.c:566:1: start of procedure grow_array() 564. 565. /* similar to ff_dynarray_add() and av_fast_realloc() */ 566. static void *grow_array(void *array, int elem_size, int *size, int new_size) ^ 567. { 568. if (new_size >= INT_MAX / elem_size) { ffmpeg.c:568:9: Taking true branch 566. static void *grow_array(void *array, int elem_size, int *size, int new_size) 567. { 568. if (new_size >= INT_MAX / elem_size) { ^ 569. fprintf(stderr, "Array too big.\n"); 570. ffmpeg_exit(1); ffmpeg.c:569:9: 567. { 568. if (new_size >= INT_MAX / elem_size) { 569. fprintf(stderr, "Array too big.\n"); ^ 570. ffmpeg_exit(1); 571. } ffmpeg.c:570:9: Skipping ffmpeg_exit(): empty list of specs 568. if (new_size >= INT_MAX / elem_size) { 569. fprintf(stderr, "Array too big.\n"); 570. ffmpeg_exit(1); ^ 571. } 572. if (*size < new_size) { ffmpeg.c:572:9: Taking true branch 570. ffmpeg_exit(1); 571. } 572. if (*size < new_size) { ^ 573. uint8_t *tmp = av_realloc(array, new_size*elem_size); 574. if (!tmp) { ffmpeg.c:573:9: 571. } 572. if (*size < new_size) { 573. uint8_t *tmp = av_realloc(array, new_size*elem_size); ^ 574. if (!tmp) { 575. fprintf(stderr, "Could not alloc buffer.\n"); libavutil/mem.c:119:1: start of procedure av_realloc() 117. } 118. 119. void *av_realloc(void *ptr, unsigned int size) ^ 120. { 121. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:126:8: Taking true branch 124. 125. /* let's disallow possible ambiguous cases */ 126. if(size > (INT_MAX-16) ) ^ 127. return NULL; 128. libavutil/mem.c:127:9: 125. /* let's disallow possible ambiguous cases */ 126. if(size > (INT_MAX-16) ) 127. return NULL; ^ 128. 129. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:137:1: return from a call to av_realloc 135. return realloc(ptr, size); 136. #endif 137. } ^ 138. 139. void av_free(void *ptr) ffmpeg.c:574:14: Taking true branch 572. if (*size < new_size) { 573. uint8_t *tmp = av_realloc(array, new_size*elem_size); 574. if (!tmp) { ^ 575. fprintf(stderr, "Could not alloc buffer.\n"); 576. ffmpeg_exit(1); ffmpeg.c:575:13: 573. uint8_t *tmp = av_realloc(array, new_size*elem_size); 574. if (!tmp) { 575. fprintf(stderr, "Could not alloc buffer.\n"); ^ 576. ffmpeg_exit(1); 577. } ffmpeg.c:576:13: Skipping ffmpeg_exit(): empty list of specs 574. if (!tmp) { 575. fprintf(stderr, "Could not alloc buffer.\n"); 576. ffmpeg_exit(1); ^ 577. } 578. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); ffmpeg.c:578:9: 576. ffmpeg_exit(1); 577. } 578. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); ^ 579. *size = new_size; 580. return tmp; ffmpeg.c:579:9: 577. } 578. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); 579. *size = new_size; ^ 580. return tmp; 581. } ffmpeg.c:580:9: 578. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); 579. *size = new_size; 580. return tmp; ^ 581. } 582. return array; ffmpeg.c:583:1: return from a call to grow_array 581. } 582. return array; 583. } ^ 584. 585. static void choose_sample_fmt(AVStream *st, AVCodec *codec) ffmpeg.c:2913:5: 2911. 2912. input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); 2913. input_files_ts_scale[nb_input_files][stream]= scale; ^ 2914. } 2915.
https://github.com/libav/libav/blob/eced8fa02ea237abd9c6a6e9287bb7524addb8f4/ffmpeg.c/#L2913
d2a_code_trace_data_43364
static int sab_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; Minima minima[MAX_SAB_SIZE]; const int minima_count= FFABS(c->dia_size); int i, j; 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(j=i=0; i<ME_MAP_SIZE && j<MAX_SAB_SIZE; i++){ uint32_t key= map[i]; key += (1<<(ME_MAP_MV_BITS-1)) + (1<<(2*ME_MAP_MV_BITS-1)); if((key&((-1)<<(2*ME_MAP_MV_BITS))) != map_generation) continue; minima[j].height= score_map[i]; minima[j].x= key & ((1<<ME_MAP_MV_BITS)-1); key>>=ME_MAP_MV_BITS; minima[j].y= key & ((1<<ME_MAP_MV_BITS)-1); minima[j].x-= (1<<(ME_MAP_MV_BITS-1)); minima[j].y-= (1<<(ME_MAP_MV_BITS-1)); if( minima[j].x > xmax || minima[j].x < xmin || minima[j].y > ymax || minima[j].y < ymin) continue; minima[j].checked=0; if(minima[j].x || minima[j].y) minima[j].height+= (mv_penalty[((minima[j].x)<<shift)-pred_x] + mv_penalty[((minima[j].y)<<shift)-pred_y])*penalty_factor; j++; } qsort(minima, j, sizeof(Minima), minima_cmp); for(; j<minima_count; j++){ minima[j].height=256*256*256*64; minima[j].checked=0; minima[j].x= minima[j].y=0; } for(i=0; i<minima_count; i++){ const int x= minima[i].x; const int y= minima[i].y; int d; if(minima[i].checked) continue; if( x >= xmax || x <= xmin || y >= ymax || y <= ymin) continue; SAB_CHECK_MV(x-1, y) SAB_CHECK_MV(x+1, y) SAB_CHECK_MV(x , y-1) SAB_CHECK_MV(x , y+1) minima[i].checked= 1; } best[0]= minima[0].x; best[1]= minima[0].y; dmin= minima[0].height; if( best[0] < xmax && best[0] > xmin && best[1] < ymax && best[1] > ymin){ int d; CHECK_MV(best[0]-1, best[1]) CHECK_MV(best[0]+1, best[1]) CHECK_MV(best[0], best[1]-1) CHECK_MV(best[0], best[1]+1) } return dmin; } libavcodec/motion_est_template.c:890: error: Uninitialized Value The value read from ymax was never initialized. libavcodec/motion_est_template.c:890:9: 888. CHECK_MV(best[0]-1, best[1]) 889. CHECK_MV(best[0]+1, best[1]) 890. CHECK_MV(best[0], best[1]-1) ^ 891. CHECK_MV(best[0], best[1]+1) 892. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L890
d2a_code_trace_data_43365
static void unpack_roq_cell(roq_cell *cell, uint8_t u[4*3]) { memcpy(u , cell->y, 4); memset(u+4, cell->u, 4); memset(u+8, cell->v, 4); } libavcodec/roqvideoenc.c:80: error: Buffer Overrun L3 Offset added: 4 Size: [0, +oo]. libavcodec/roqvideoenc.c:78:1: <Length trace> 76. 77. /* Macroblock support functions */ 78. static void unpack_roq_cell(roq_cell *cell, uint8_t u[4*3]) ^ 79. { 80. memcpy(u , cell->y, 4); libavcodec/roqvideoenc.c:78:1: Parameter `cell->y[*]` 76. 77. /* Macroblock support functions */ 78. static void unpack_roq_cell(roq_cell *cell, uint8_t u[4*3]) ^ 79. { 80. memcpy(u , cell->y, 4); libavcodec/roqvideoenc.c:80:5: Array access: Offset added: 4 Size: [0, +oo] 78. static void unpack_roq_cell(roq_cell *cell, uint8_t u[4*3]) 79. { 80. memcpy(u , cell->y, 4); ^ 81. memset(u+4, cell->u, 4); 82. memset(u+8, cell->v, 4);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/roqvideoenc.c/#L80
d2a_code_trace_data_43366
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/ec_internal_test.c:174: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `group_field_tests`. Showing all 11 steps of the trace test/ec_internal_test.c:174:13: Call 172. if (!TEST_ptr(group = EC_GROUP_new_by_curve_name(nid)) 173. || !TEST_ptr(ctx = BN_CTX_new()) 174. || !group_field_tests(group, ctx)) ^ 175. goto err; 176. test/ec_internal_test.c:28:5: Call 26. return 1; 27. 28. BN_CTX_start(ctx); ^ 29. a = BN_CTX_get(ctx); 30. b = 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); test/ec_internal_test.c:65:5: Call 63. ret = 1; 64. err: 65. BN_CTX_end(ctx); ^ 66. return ret; 67. } 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 `group_field_tests` 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_43367
static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) { unsigned char *buf = NULL; int ret = 0, bit, bytes, mask; time_t tim; if (bits == 0) { if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY) goto toosmall; BN_zero(rnd); return 1; } if (bits < 0 || (bits == 1 && top > 0)) goto toosmall; bytes = (bits + 7) / 8; bit = (bits - 1) % 8; mask = 0xff << (bit + 1); buf = OPENSSL_malloc(bytes); if (buf == NULL) { BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); goto err; } time(&tim); RAND_add(&tim, sizeof(tim), 0.0); if (RAND_bytes(buf, bytes) <= 0) goto err; if (pseudorand == 2) { int i; unsigned char c; for (i = 0; i < bytes; i++) { if (RAND_bytes(&c, 1) <= 0) goto err; if (c >= 128 && i > 0) buf[i] = buf[i - 1]; else if (c < 42) buf[i] = 0; else if (c < 84) buf[i] = 255; } } if (top >= 0) { if (top) { if (bit == 0) { buf[0] = 1; buf[1] |= 0x80; } else { buf[0] |= (3 << (bit - 1)); } } else { buf[0] |= (1 << bit); } } buf[0] &= ~mask; if (bottom) buf[bytes - 1] |= 1; if (!BN_bin2bn(buf, bytes, rnd)) goto err; ret = 1; err: OPENSSL_clear_free(buf, bytes); bn_check_top(rnd); return (ret); toosmall: BNerr(BN_F_BNRAND, BN_R_BITS_TOO_SMALL); return 0; } test/ectest.c:971: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_pseudo_rand`. Showing all 14 steps of the trace test/ectest.c:971:14: Call 969. goto err; 970. 971. if (!TEST_true(BN_pseudo_rand(y, BN_num_bits(y), 0, 0)) ^ 972. || !TEST_true(BN_add(z, z, y))) 973. 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. } test/ectest.c:971:14: Call 969. goto err; 970. 971. if (!TEST_true(BN_pseudo_rand(y, BN_num_bits(y), 0, 0)) ^ 972. || !TEST_true(BN_add(z, z, y))) 973. goto err; crypto/bn/bn_rand.c:101:1: Parameter `bits` 99. } 100. 101. > int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom) 102. { 103. return bnrand(1, rnd, bits, top, bottom); crypto/bn/bn_rand.c:103:12: Call 101. int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom) 102. { 103. return bnrand(1, rnd, bits, top, bottom); ^ 104. } 105. crypto/bn/bn_rand.c:56:14: <Offset trace> 54. unsigned char c; 55. 56. for (i = 0; i < bytes; i++) { ^ 57. if (RAND_bytes(&c, 1) <= 0) 58. goto err; crypto/bn/bn_rand.c:56:14: Assignment 54. unsigned char c; 55. 56. for (i = 0; i < bytes; i++) { ^ 57. if (RAND_bytes(&c, 1) <= 0) 58. goto err; crypto/bn/bn_rand.c:17:1: <Length trace> 15. #include <openssl/sha.h> 16. 17. > static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) 18. { 19. unsigned char *buf = NULL; crypto/bn/bn_rand.c:17:1: Parameter `bits` 15. #include <openssl/sha.h> 16. 17. > static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) 18. { 19. unsigned char *buf = NULL; crypto/bn/bn_rand.c:32:5: Assignment 30. goto toosmall; 31. 32. bytes = (bits + 7) / 8; ^ 33. bit = (bits - 1) % 8; 34. mask = 0xff << (bit + 1); crypto/bn/bn_rand.c:36:11: Call 34. mask = 0xff << (bit + 1); 35. 36. buf = OPENSSL_malloc(bytes); ^ 37. if (buf == NULL) { 38. BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); crypto/mem.c:166:9: Assignment 164. 165. if (num == 0) 166. return NULL; ^ 167. 168. FAILTEST(); crypto/bn/bn_rand.c:36:5: Assignment 34. mask = 0xff << (bit + 1); 35. 36. buf = OPENSSL_malloc(bytes); ^ 37. if (buf == NULL) { 38. BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); crypto/bn/bn_rand.c:82:9: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_pseudo_rand` 80. buf[0] &= ~mask; 81. if (bottom) /* set bottom bit if requested */ 82. buf[bytes - 1] |= 1; ^ 83. if (!BN_bin2bn(buf, bytes, rnd)) 84. goto err;
https://github.com/openssl/openssl/blob/7671342e550ed2de676b23c79d0e7f45a381c76e/crypto/bn/bn_rand.c/#L82
d2a_code_trace_data_43368
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); } apps/s_client.c:312: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `srp_Verify_N_and_g`. Showing all 34 steps of the trace apps/s_client.c:293:9: Call 291. BIO_printf(bio_err, "SRP parameters:\n"); 292. BIO_printf(bio_err, "\tN="); 293. BN_print(bio_err, N); ^ 294. BIO_printf(bio_err, "\n\tg="); 295. BN_print(bio_err, g); crypto/bn/bn_print.c:296:1: Parameter `a->top` 294. # endif 295. 296. > int BN_print(BIO *bp, const BIGNUM *a) 297. { 298. int i, j, v, z = 0; apps/s_client.c:295:9: Call 293. BN_print(bio_err, N); 294. BIO_printf(bio_err, "\n\tg="); 295. BN_print(bio_err, g); ^ 296. BIO_printf(bio_err, "\n"); 297. } crypto/bn/bn_print.c:296:1: Parameter `a->top` 294. # endif 295. 296. > int BN_print(BIO *bp, const BIGNUM *a) 297. { 298. int i, j, v, z = 0; apps/s_client.c:299:9: Call 297. } 298. 299. if (SRP_check_known_gN_param(g, N)) ^ 300. return 1; 301. crypto/srp/srp_lib.c:296:1: Parameter `g->top` 294. * from the ietf-tls-srp draft version 8 295. */ 296. > char *SRP_check_known_gN_param(const BIGNUM *g, const BIGNUM *N) 297. { 298. size_t i; apps/s_client.c:312:13: Call 310. * has already been tested. 311. */ 312. if (BN_num_bits(g) <= BN_BITS && srp_Verify_N_and_g(N, g)) ^ 313. return 1; 314. } 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:920:1: Parameter `a->top` 918. } 919. 920. > int BN_is_zero(const BIGNUM *a) 921. { 922. return a->top == 0; apps/s_client.c:312:42: Call 310. * has already been tested. 311. */ 312. if (BN_num_bits(g) <= BN_BITS && srp_Verify_N_and_g(N, g)) ^ 313. return 1; 314. } apps/s_client.c:245:1: Parameter `g->top` 243. # define SRP_NUMBER_ITERATIONS_FOR_PRIME 64 244. 245. > static int srp_Verify_N_and_g(const BIGNUM *N, const BIGNUM *g) 246. { 247. BN_CTX *bn_ctx = BN_CTX_new(); apps/s_client.c:258:9: Call 256. r != NULL && 257. /* verify g^((N-1)/2) == -1 (mod N) */ 258. BN_mod_exp(r, g, p, N, bn_ctx) && ^ 259. BN_add_word(r, 1) && BN_cmp(r, N) == 0; 260. crypto/bn/bn_exp.c:90:1: Parameter `a->top` 88. } 89. 90. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 91. BN_CTX *ctx) 92. { crypto/bn/bn_exp.c:150:19: Call 148. } else 149. # endif 150. ret = BN_mod_exp_mont(r, a, p, m, ctx, NULL); ^ 151. } else 152. #endif crypto/bn/bn_exp.c:300:1: Parameter `a->top` 298. } 299. 300. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 301. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 302. { crypto/bn/bn_exp.c:312:16: Call 310. 311. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { 312. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 313. } 314. crypto/bn/bn_exp.c:600:1: Parameter `a->top` 598. * http://www.daemonology.net/hyperthreading-considered-harmful/) 599. */ 600. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 601. const BIGNUM *m, BN_CTX *ctx, 602. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:757:17: Call 755. if (!BN_to_montgomery(&am, &am, mont, ctx)) 756. goto err; 757. } else if (!BN_to_montgomery(&am, a, mont, ctx)) ^ 758. goto err; 759. crypto/bn/bn_lib.c:945:1: Parameter `a->top` 943. } 944. 945. > int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 946. BN_CTX *ctx) 947. { crypto/bn/bn_lib.c:948:12: Call 946. BN_CTX *ctx) 947. { 948. return BN_mod_mul_montgomery(r, a, &(mont->RR), mont, ctx); ^ 949. } 950. 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:104:1: <Offset trace> 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:104:1: Parameter `n` 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:115:5: Assignment 113. rp[0] = rp[max - 1] = 0; 114. rp++; 115. j = n; ^ 116. 117. if (--j > 0) { crypto/bn/bn_sqr.c:117:9: Assignment 115. j = n; 116. 117. if (--j > 0) { ^ 118. ap++; 119. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); crypto/bn/bn_sqr.c:104:1: <Length trace> 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:104:1: Parameter `*r` 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:112:5: Assignment 110. max = n * 2; 111. ap = a; 112. rp = r; ^ 113. rp[0] = rp[max - 1] = 0; 114. rp++; crypto/bn/bn_sqr.c:114:5: Assignment 112. rp = r; 113. rp[0] = rp[max - 1] = 0; 114. rp++; ^ 115. j = n; 116. crypto/bn/bn_sqr.c:119:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `srp_Verify_N_and_g` 117. if (--j > 0) { 118. ap++; 119. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); ^ 120. rp += 2; 121. }
https://github.com/openssl/openssl/blob/4973a60cb92dc121fc09246bff3815afc0f8ab9a/crypto/bn/bn_sqr.c/#L119
d2a_code_trace_data_43369
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); } apps/s_server.c:2057: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `SSL_clear`. Showing all 16 steps of the trace apps/s_server.c:2042:15: Call 2040. 2041. if (con == NULL) { 2042. con = SSL_new(ctx); ^ 2043. 2044. if (s_tlsextdebug) { ssl/ssl_lib.c:518:1: Parameter `ctx->sessions->num_items` 516. } 517. 518. > SSL *SSL_new(SSL_CTX *ctx) 519. { 520. SSL *s; apps/s_server.c:2057:10: Call 2055. } 2056. } 2057. if (!SSL_clear(con)) { ^ 2058. BIO_printf(bio_err, "Error clearing SSL connection\n"); 2059. ret = -1; ssl/ssl_lib.c:440:1: Parameter `s->initial_ctx->sessions->num_items` 438. } 439. 440. > int SSL_clear(SSL *s) 441. { 442. if (s->method == NULL) { ssl/ssl_lib.c:447:9: Call 445. } 446. 447. if (ssl_clear_bad_session(s)) { ^ 448. SSL_SESSION_free(s->session); 449. s->session = NULL; ssl/ssl_sess.c:986:1: Parameter `s->initial_ctx->sessions->num_items` 984. } 985. 986. > int ssl_clear_bad_session(SSL *s) 987. { 988. if ((s->session != NULL) && ssl/ssl_sess.c:991:9: Call 989. !(s->shutdown & SSL_SENT_SHUTDOWN) && 990. !(SSL_in_init(s) || SSL_in_before(s))) { 991. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 992. return (1); 993. } else ssl/ssl_sess.c:693:1: Parameter `ctx->sessions->num_items` 691. } 692. 693. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 694. { 695. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:695:12: Call 693. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 694. { 695. return remove_session_lock(ctx, c, 1); ^ 696. } 697. ssl/ssl_sess.c:698:1: Parameter `ctx->sessions->num_items` 696. } 697. 698. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 699. { 700. SSL_SESSION *r; ssl/ssl_sess.c:708:17: Call 706. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 707. ret = 1; 708. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 709. SSL_SESSION_list_remove(ctx, c); 710. } ssl/ssl_locl.h:581:1: Parameter `lh->num_items` 579. }; 580. 581. > DEFINE_LHASH_OF(SSL_SESSION); 582. /* Needed in ssl_cert.c */ 583. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:581:1: Call 579. }; 580. 581. > DEFINE_LHASH_OF(SSL_SESSION); 582. /* Needed in ssl_cert.c */ 583. 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, +oo] - 1):unsigned64 by call to `SSL_clear` 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/2dca984babedf93c560aba54da3f4c9222ee0d12/crypto/lhash/lhash.c/#L123
d2a_code_trace_data_43370
AP_DECLARE(apr_status_t) ap_rgetline_core(char **s, apr_size_t n, apr_size_t *read, request_rec *r, int flags, apr_bucket_brigade *bb) { apr_status_t rv; apr_bucket *e; apr_size_t bytes_handled = 0, current_alloc = 0; char *pos, *last_char = *s; int do_alloc = (*s == NULL), saw_eos = 0; int fold = flags & AP_GETLINE_FOLD; int crlf = flags & AP_GETLINE_CRLF; if (!n) { *read = 0; return APR_BADARG; } if (last_char) *last_char = '\0'; for (;;) { apr_brigade_cleanup(bb); rv = ap_get_brigade(r->proto_input_filters, bb, AP_MODE_GETLINE, APR_BLOCK_READ, 0); if (rv != APR_SUCCESS) { goto cleanup; } if (APR_BRIGADE_EMPTY(bb)) { rv = APR_EGENERAL; goto cleanup; } for (e = APR_BRIGADE_FIRST(bb); e != APR_BRIGADE_SENTINEL(bb); e = APR_BUCKET_NEXT(e)) { const char *str; apr_size_t len; if (APR_BUCKET_IS_EOS(e)) { saw_eos = 1; break; } rv = apr_bucket_read(e, &str, &len, APR_BLOCK_READ); if (rv != APR_SUCCESS) { goto cleanup; } if (len == 0) { continue; } if (n < bytes_handled + len) { rv = APR_ENOSPC; goto cleanup; } if (do_alloc) { if (!*s) { current_alloc = len; *s = apr_palloc(r->pool, current_alloc + 1); } else if (bytes_handled + len > current_alloc) { apr_size_t new_size = current_alloc * 2; char *new_buffer; if (bytes_handled + len > new_size) { new_size = (bytes_handled + len) * 2; } new_buffer = apr_palloc(r->pool, new_size + 1); memcpy(new_buffer, *s, bytes_handled); current_alloc = new_size; *s = new_buffer; } } pos = *s + bytes_handled; memcpy(pos, str, len); last_char = pos + len - 1; bytes_handled += len; } if (last_char && (*last_char == APR_ASCII_LF)) { break; } } if (last_char > *s && last_char[-1] == APR_ASCII_CR) { last_char--; } else if (crlf) { rv = APR_EINVAL; goto cleanup; } bytes_handled = last_char - *s; if (fold && bytes_handled && !saw_eos) { for (;;) { const char *str; apr_size_t len; char c; apr_brigade_cleanup(bb); rv = ap_get_brigade(r->proto_input_filters, bb, AP_MODE_SPECULATIVE, APR_BLOCK_READ, 1); if (rv != APR_SUCCESS) { goto cleanup; } if (APR_BRIGADE_EMPTY(bb)) { break; } e = APR_BRIGADE_FIRST(bb); if (APR_BUCKET_IS_EOS(e)) { break; } rv = apr_bucket_read(e, &str, &len, APR_BLOCK_READ); if (rv != APR_SUCCESS) { apr_brigade_cleanup(bb); goto cleanup; } c = *str; if (c == APR_ASCII_BLANK || c == APR_ASCII_TAB) { if (bytes_handled >= n) { rv = APR_ENOSPC; goto cleanup; } else { apr_size_t next_size, next_len; char *tmp; if (do_alloc) { tmp = NULL; } else { tmp = last_char; } next_size = n - bytes_handled; rv = ap_rgetline_core(&tmp, next_size, &next_len, r, 0, bb); if (rv != APR_SUCCESS) { goto cleanup; } if (do_alloc && next_len > 0) { char *new_buffer; apr_size_t new_size = bytes_handled + next_len + 1; new_buffer = apr_palloc(r->pool, new_size); memcpy(new_buffer, *s, bytes_handled); memcpy(new_buffer + bytes_handled, tmp, next_len); *s = new_buffer; } last_char += next_len; bytes_handled += next_len; } } else { break; } } } cleanup: if (bytes_handled >= n) { bytes_handled = n - 1; } if (*s) { (*s)[bytes_handled] = '\0'; } *read = bytes_handled; if (rv != APR_SUCCESS) { return rv; } if (strlen(*s) < bytes_handled) { return APR_EINVAL; } return APR_SUCCESS; } server/protocol.c:452: error: UNINITIALIZED_VALUE The value read from rv was never initialized. server/protocol.c:452:9: 450. *read = bytes_handled; 451. 452. if (rv != APR_SUCCESS) { ^ 453. return rv; 454. }
https://github.com/apache/httpd/blob/81af07c707b365c9a3fd7f98adc86d02e90275e1/server/protocol.c/#L452
d2a_code_trace_data_43371
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:500: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_GF2m_mod_mul`. Showing all 18 steps of the trace test/bntest.c:500:13: Call 498. BN_bntest_rand(d, 1024, 0, 0); 499. for (j = 0; j < 2; j++) { 500. BN_GF2m_mod_mul(e, a, c, b[j], ctx); ^ 501. BN_GF2m_add(f, a, d); 502. BN_GF2m_mod_mul(g, f, c, b[j], ctx); crypto/bn/bn_gf2m.c:473:1: Parameter `ctx->stack.depth` 471. * BN_GF2m_mod_mul_arr function. 472. */ 473. > int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 474. const BIGNUM *p, BN_CTX *ctx) 475. { test/bntest.c:502:13: Call 500. BN_GF2m_mod_mul(e, a, c, b[j], ctx); 501. BN_GF2m_add(f, a, d); 502. BN_GF2m_mod_mul(g, f, c, b[j], ctx); ^ 503. BN_GF2m_mod_mul(h, d, c, b[j], ctx); 504. BN_GF2m_add(f, e, g); crypto/bn/bn_gf2m.c:473:1: Parameter `ctx->stack.depth` 471. * BN_GF2m_mod_mul_arr function. 472. */ 473. > int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 474. const BIGNUM *p, BN_CTX *ctx) 475. { test/bntest.c:503:13: Call 501. BN_GF2m_add(f, a, d); 502. BN_GF2m_mod_mul(g, f, c, b[j], ctx); 503. BN_GF2m_mod_mul(h, d, c, b[j], ctx); ^ 504. BN_GF2m_add(f, e, g); 505. BN_GF2m_add(f, f, h); crypto/bn/bn_gf2m.c:473:1: Parameter `ctx->stack.depth` 471. * BN_GF2m_mod_mul_arr function. 472. */ 473. > int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 474. const BIGNUM *p, BN_CTX *ctx) 475. { test/bntest.c:500:13: Call 498. BN_bntest_rand(d, 1024, 0, 0); 499. for (j = 0; j < 2; j++) { 500. BN_GF2m_mod_mul(e, a, c, b[j], ctx); ^ 501. BN_GF2m_add(f, a, d); 502. BN_GF2m_mod_mul(g, f, c, b[j], ctx); crypto/bn/bn_gf2m.c:473:1: Parameter `ctx->stack.depth` 471. * BN_GF2m_mod_mul_arr function. 472. */ 473. > int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 474. const BIGNUM *p, BN_CTX *ctx) 475. { crypto/bn/bn_gf2m.c:489:11: Call 487. goto err; 488. } 489. ret = BN_GF2m_mod_mul_arr(r, a, b, arr, ctx); ^ 490. bn_check_top(r); 491. err: crypto/bn/bn_gf2m.c:418:1: Parameter `ctx->stack.depth` 416. * the result in r. r could be a or b; a could be b. 417. */ 418. > int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 419. const int p[], BN_CTX *ctx) 420. { crypto/bn/bn_gf2m.c:432:5: Call 430. } 431. 432. BN_CTX_start(ctx); ^ 433. if ((s = BN_CTX_get(ctx)) == NULL) 434. 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_gf2m.c:462:5: Call 460. 461. err: 462. BN_CTX_end(ctx); ^ 463. return ret; 464. } crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.depth` 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: <LHS 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:273:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_GF2m_mod_mul` 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/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_43372
void av_close_input_stream(AVFormatContext *s) { int i; AVStream *st; if (s->cur_st && s->cur_st->parser) av_free_packet(&s->cur_pkt); if (s->iformat->read_close) s->iformat->read_close(s); for(i=0;i<s->nb_streams;i++) { st = s->streams[i]; if (st->parser) { av_parser_close(st->parser); } av_free(st->index_entries); av_free(st->codec->extradata); av_free(st->codec); av_free(st->filename); av_free(st); } for(i=s->nb_programs-1; i>=0; i--) { av_freep(&s->programs[i]->provider_name); av_freep(&s->programs[i]->name); av_freep(&s->programs[i]->stream_index); av_freep(&s->programs[i]); } flush_packet_queue(s); av_freep(&s->priv_data); av_free(s); } ffserver.c:3330: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `av_close_input_file`. ffserver.c:3311:33: Unknown value from: strcmp 3309. /* open stream */ 3310. stream->ap_in = av_mallocz(sizeof(AVFormatParameters)); 3311. if (stream->fmt && !strcmp(stream->fmt->name, "rtp")) { ^ 3312. /* specific case : if transport stream output to RTP, 3313. we use a raw transport stream reader */ ffserver.c:3330:21: Call 3328. http_log("Could not find codec parameters from '%s'", 3329. stream->feed_filename); 3330. av_close_input_file(infile); ^ 3331. goto fail; 3332. } libavformat/utils.c:2152:1: Parameter `s->nb_programs` 2150. } 2151. 2152. void av_close_input_file(AVFormatContext *s) ^ 2153. { 2154. ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb; libavformat/utils.c:2155:5: Call 2153. { 2154. ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb; 2155. av_close_input_stream(s); ^ 2156. if (pb) 2157. url_fclose(pb); libavformat/utils.c:2118:1: <LHS trace> 2116. } 2117. 2118. void av_close_input_stream(AVFormatContext *s) ^ 2119. { 2120. int i; libavformat/utils.c:2118:1: Parameter `s->nb_programs` 2116. } 2117. 2118. void av_close_input_stream(AVFormatContext *s) ^ 2119. { 2120. int i; libavformat/utils.c:2141:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `av_close_input_file` 2139. av_free(st); 2140. } 2141. for(i=s->nb_programs-1; i>=0; i--) { ^ 2142. av_freep(&s->programs[i]->provider_name); 2143. av_freep(&s->programs[i]->name);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/utils.c/#L2141
d2a_code_trace_data_43373
static 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/t1_lib.c:3035: error: INTEGER_OVERFLOW_L2 (0 - [-oo, 32]):unsigned64 by call to `EVP_DecryptUpdate`. Showing all 8 steps of the trace ssl/t1_lib.c:3035:25: Call 3033. eticklen -= 16 + EVP_CIPHER_CTX_iv_length(ctx); 3034. sdec = OPENSSL_malloc(eticklen); 3035. if (sdec == NULL || EVP_DecryptUpdate(ctx, sdec, &slen, p, ^ 3036. (int)eticklen) <= 0) { 3037. EVP_CIPHER_CTX_free(ctx); crypto/evp/evp_enc.c:419:1: Parameter `ctx->cipher->block_size` 417. } 418. 419. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 420. const unsigned char *in, int inl) 421. { crypto/evp/evp_enc.c:446:16: Call 444. 445. if (ctx->flags & EVP_CIPH_NO_PADDING) 446. return EVP_EncryptUpdate(ctx, out, outl, in, inl); ^ 447. 448. b = ctx->cipher->block_size; crypto/evp/evp_enc.c:294:1: Parameter `inl` 292. } 293. 294. > int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 295. const unsigned char *in, int inl) 296. { crypto/evp/evp_enc.c:345:17: Call 343. inl -= j; 344. in += j; 345. if (is_partially_overlapping(out, in, bl)) { ^ 346. EVPerr(EVP_F_EVP_ENCRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING); 347. return 0; crypto/evp/evp_enc.c:279:1: <RHS trace> 277. #endif 278. 279. > static int is_partially_overlapping(const void *ptr1, const void *ptr2, 280. int len) 281. { crypto/evp/evp_enc.c:279:1: Parameter `len` 277. #endif 278. 279. > static int is_partially_overlapping(const void *ptr1, const void *ptr2, 280. int len) 281. { crypto/evp/evp_enc.c:289:50: Binary operation: (0 - [-oo, 32]):unsigned64 by call to `EVP_DecryptUpdate` 287. */ 288. int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | 289. (diff > (0 - (PTRDIFF_T)len))); ^ 290. assert(!overlapped); 291. return overlapped;
https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/crypto/evp/evp_enc.c/#L289
d2a_code_trace_data_43374
static ngx_int_t ngx_http_variable_server_addr(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data) { ngx_str_t s; u_char addr[NGX_SOCKADDR_STRLEN]; s.len = NGX_SOCKADDR_STRLEN; s.data = addr; if (ngx_http_server_addr(r, &s) != NGX_OK) { return NGX_ERROR; } s.data = ngx_pnalloc(r->pool, s.len); if (s.data == NULL) { return NGX_ERROR; } ngx_memcpy(s.data, addr, s.len); v->len = s.len; v->valid = 1; v->no_cacheable = 0; v->not_found = 0; v->data = s.data; return NGX_OK; } src/http/ngx_http_variables.c:944: error: Buffer Overrun L3 Offset added: [0, 51] Size: [0, 51]. src/http/ngx_http_variables.c:932:5: <Offset trace> 930. u_char addr[NGX_SOCKADDR_STRLEN]; 931. 932. s.len = NGX_SOCKADDR_STRLEN; ^ 933. s.data = addr; 934. src/http/ngx_http_variables.c:932:5: Assignment 930. u_char addr[NGX_SOCKADDR_STRLEN]; 931. 932. s.len = NGX_SOCKADDR_STRLEN; ^ 933. s.data = addr; 934. src/http/ngx_http_variables.c:935:9: Call 933. s.data = addr; 934. 935. if (ngx_http_server_addr(r, &s) != NGX_OK) { ^ 936. return NGX_ERROR; 937. } src/http/ngx_http_core_module.c:1813:1: Parameter `s->len` 1811. 1812. 1813. ngx_int_t ^ 1814. ngx_http_server_addr(ngx_http_request_t *r, ngx_str_t *s) 1815. { src/http/ngx_http_variables.c:932:5: <Length trace> 930. u_char addr[NGX_SOCKADDR_STRLEN]; 931. 932. s.len = NGX_SOCKADDR_STRLEN; ^ 933. s.data = addr; 934. src/http/ngx_http_variables.c:932:5: Assignment 930. u_char addr[NGX_SOCKADDR_STRLEN]; 931. 932. s.len = NGX_SOCKADDR_STRLEN; ^ 933. s.data = addr; 934. src/http/ngx_http_variables.c:935:9: Call 933. s.data = addr; 934. 935. if (ngx_http_server_addr(r, &s) != NGX_OK) { ^ 936. return NGX_ERROR; 937. } src/http/ngx_http_core_module.c:1813:1: Parameter `s->len` 1811. 1812. 1813. ngx_int_t ^ 1814. ngx_http_server_addr(ngx_http_request_t *r, ngx_str_t *s) 1815. { src/http/ngx_http_variables.c:939:14: Call 937. } 938. 939. s.data = ngx_pnalloc(r->pool, s.len); ^ 940. if (s.data == NULL) { 941. 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/http/ngx_http_variables.c:939:5: Assignment 937. } 938. 939. s.data = ngx_pnalloc(r->pool, s.len); ^ 940. if (s.data == NULL) { 941. return NGX_ERROR; src/http/ngx_http_variables.c:944:5: Array access: Offset added: [0, 51] Size: [0, 51] 942. } 943. 944. ngx_memcpy(s.data, addr, s.len); ^ 945. 946. v->len = s.len;
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/http/ngx_http_variables.c/#L944
d2a_code_trace_data_43375
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:1044: error: Uninitialized Value The value read from ymin was never initialized. libavcodec/motion_est_template.c:1044:9: 1042. if (s->first_slice_line) { 1043. CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) 1044. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, ^ 1045. (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) 1046. }else{
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1044
d2a_code_trace_data_43376
int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx) { BIGNUM *t; int i; if ((nbits < 1024) || (nbits & 0xff)) return 0; nbits >>= 1; if (!BN_rand(Xp, nbits, BN_RAND_TOP_TWO, BN_RAND_BOTTOM_ANY)) goto err; BN_CTX_start(ctx); t = BN_CTX_get(ctx); for (i = 0; i < 1000; i++) { if (!BN_rand(Xq, nbits, BN_RAND_TOP_TWO, BN_RAND_BOTTOM_ANY)) goto err; BN_sub(t, Xp, Xq); if (BN_num_bits(t) > (nbits - 100)) break; } BN_CTX_end(ctx); if (i < 1000) return 1; return 0; err: BN_CTX_end(ctx); return 0; } crypto/bn/bn_x931p.c:187: error: NULL_DEREFERENCE pointer `t` last assigned on line 180 could be null and is dereferenced by call to `BN_num_bits()` at line 187, column 13. Showing all 32 steps of the trace crypto/bn/bn_x931p.c:160:1: start of procedure BN_X931_generate_Xpq() 158. */ 159. 160. > int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx) 161. { 162. BIGNUM *t; crypto/bn/bn_x931p.c:168:10: Taking false branch 166. * ... 167. */ 168. if ((nbits < 1024) || (nbits & 0xff)) ^ 169. return 0; 170. nbits >>= 1; crypto/bn/bn_x931p.c:168:28: Taking false branch 166. * ... 167. */ 168. if ((nbits < 1024) || (nbits & 0xff)) ^ 169. return 0; 170. nbits >>= 1; crypto/bn/bn_x931p.c:170:5: 168. if ((nbits < 1024) || (nbits & 0xff)) 169. return 0; 170. > nbits >>= 1; 171. /* 172. * The random value Xp must be between sqrt(2) * 2^(nbits-1) and 2^nbits crypto/bn/bn_x931p.c:176:10: 174. * exceeded. 175. */ 176. > if (!BN_rand(Xp, nbits, BN_RAND_TOP_TWO, BN_RAND_BOTTOM_ANY)) 177. goto err; 178. crypto/bn/bn_rand.c:93:1: start of procedure BN_rand() 91. } 92. 93. > int BN_rand(BIGNUM *rnd, int bits, int top, int bottom) 94. { 95. return bnrand(0, rnd, bits, top, bottom); crypto/bn/bn_rand.c:95:5: Skipping bnrand(): empty list of specs 93. int BN_rand(BIGNUM *rnd, int bits, int top, int bottom) 94. { 95. return bnrand(0, rnd, bits, top, bottom); ^ 96. } 97. crypto/bn/bn_rand.c:96:1: return from a call to BN_rand 94. { 95. return bnrand(0, rnd, bits, top, bottom); 96. > } 97. 98. int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom) crypto/bn/bn_x931p.c:176:10: Taking false branch 174. * exceeded. 175. */ 176. if (!BN_rand(Xp, nbits, BN_RAND_TOP_TWO, BN_RAND_BOTTOM_ANY)) ^ 177. goto err; 178. crypto/bn/bn_x931p.c:179:5: 177. goto err; 178. 179. > BN_CTX_start(ctx); 180. t = BN_CTX_get(ctx); 181. crypto/bn/bn_ctx.c:181:1: start of procedure BN_CTX_start() 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_ctx.c:185:9: Taking false branch 183. CTXDBG_ENTRY("BN_CTX_start", ctx); 184. /* If we're already overflowing ... */ 185. if (ctx->err_stack || ctx->too_many) ^ 186. ctx->err_stack++; 187. /* (Try to) get a new frame pointer */ crypto/bn/bn_ctx.c:185:27: Taking true branch 183. CTXDBG_ENTRY("BN_CTX_start", ctx); 184. /* If we're already overflowing ... */ 185. if (ctx->err_stack || ctx->too_many) ^ 186. ctx->err_stack++; 187. /* (Try to) get a new frame pointer */ crypto/bn/bn_ctx.c:186:9: 184. /* If we're already overflowing ... */ 185. if (ctx->err_stack || ctx->too_many) 186. > ctx->err_stack++; 187. /* (Try to) get a new frame pointer */ 188. else if (!BN_STACK_push(&ctx->stack, ctx->used)) { crypto/bn/bn_ctx.c:185:5: 183. CTXDBG_ENTRY("BN_CTX_start", ctx); 184. /* If we're already overflowing ... */ 185. > if (ctx->err_stack || ctx->too_many) 186. ctx->err_stack++; 187. /* (Try to) get a new frame pointer */ crypto/bn/bn_ctx.c:193:1: return from a call to BN_CTX_start 191. } 192. CTXDBG_EXIT(ctx); 193. > } 194. 195. void BN_CTX_end(BN_CTX *ctx) crypto/bn/bn_x931p.c:180:5: 178. 179. BN_CTX_start(ctx); 180. > t = BN_CTX_get(ctx); 181. 182. for (i = 0; i < 1000; i++) { crypto/bn/bn_ctx.c:212:1: start of procedure BN_CTX_get() 210. } 211. 212. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 213. { 214. BIGNUM *ret; crypto/bn/bn_ctx.c:217:9: Taking true branch 215. 216. CTXDBG_ENTRY("BN_CTX_get", ctx); 217. if (ctx->err_stack || ctx->too_many) ^ 218. return NULL; 219. if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) { crypto/bn/bn_ctx.c:218:9: 216. CTXDBG_ENTRY("BN_CTX_get", ctx); 217. if (ctx->err_stack || ctx->too_many) 218. > return NULL; 219. if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) { 220. /* crypto/bn/bn_ctx.c:233:1: return from a call to BN_CTX_get 231. CTXDBG_RET(ctx, ret); 232. return ret; 233. > } 234. 235. /************/ crypto/bn/bn_x931p.c:182:10: 180. t = BN_CTX_get(ctx); 181. 182. > for (i = 0; i < 1000; i++) { 183. if (!BN_rand(Xq, nbits, BN_RAND_TOP_TWO, BN_RAND_BOTTOM_ANY)) 184. goto err; crypto/bn/bn_x931p.c:182:17: Loop condition is true. Entering loop body 180. t = BN_CTX_get(ctx); 181. 182. for (i = 0; i < 1000; i++) { ^ 183. if (!BN_rand(Xq, nbits, BN_RAND_TOP_TWO, BN_RAND_BOTTOM_ANY)) 184. goto err; crypto/bn/bn_x931p.c:183:14: 181. 182. for (i = 0; i < 1000; i++) { 183. > if (!BN_rand(Xq, nbits, BN_RAND_TOP_TWO, BN_RAND_BOTTOM_ANY)) 184. goto err; 185. /* Check that |Xp - Xq| > 2^(nbits - 100) */ crypto/bn/bn_rand.c:93:1: start of procedure BN_rand() 91. } 92. 93. > int BN_rand(BIGNUM *rnd, int bits, int top, int bottom) 94. { 95. return bnrand(0, rnd, bits, top, bottom); crypto/bn/bn_rand.c:95:5: Skipping bnrand(): empty list of specs 93. int BN_rand(BIGNUM *rnd, int bits, int top, int bottom) 94. { 95. return bnrand(0, rnd, bits, top, bottom); ^ 96. } 97. crypto/bn/bn_rand.c:96:1: return from a call to BN_rand 94. { 95. return bnrand(0, rnd, bits, top, bottom); 96. > } 97. 98. int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom) crypto/bn/bn_x931p.c:183:14: Taking false branch 181. 182. for (i = 0; i < 1000; i++) { 183. if (!BN_rand(Xq, nbits, BN_RAND_TOP_TWO, BN_RAND_BOTTOM_ANY)) ^ 184. goto err; 185. /* Check that |Xp - Xq| > 2^(nbits - 100) */ crypto/bn/bn_x931p.c:186:9: Skipping BN_sub(): empty list of specs 184. goto err; 185. /* Check that |Xp - Xq| > 2^(nbits - 100) */ 186. BN_sub(t, Xp, Xq); ^ 187. if (BN_num_bits(t) > (nbits - 100)) 188. break; crypto/bn/bn_x931p.c:187:13: 185. /* Check that |Xp - Xq| > 2^(nbits - 100) */ 186. BN_sub(t, Xp, Xq); 187. > if (BN_num_bits(t) > (nbits - 100)) 188. break; 189. } crypto/bn/bn_lib.c:161:1: start of procedure BN_num_bits() 159. } 160. 161. > int BN_num_bits(const BIGNUM *a) 162. { 163. int i = a->top - 1; crypto/bn/bn_lib.c:163:5: 161. int BN_num_bits(const BIGNUM *a) 162. { 163. > int i = a->top - 1; 164. bn_check_top(a); 165.
https://github.com/openssl/openssl/blob/c6231e9c7baec688792e043d12508e608545fffb/crypto/bn/bn_x931p.c/#L187
d2a_code_trace_data_43377
static av_cold int vp3_decode_init(AVCodecContext *avctx) { Vp3DecodeContext *s = avctx->priv_data; int i, inter, plane; int c_width; int c_height; int y_superblock_count; int c_superblock_count; if (avctx->codec_tag == MKTAG('V','P','3','0')) s->version = 0; else s->version = 1; s->avctx = avctx; s->width = (avctx->width + 15) & 0xFFFFFFF0; s->height = (avctx->height + 15) & 0xFFFFFFF0; avctx->pix_fmt = PIX_FMT_YUV420P; if(avctx->idct_algo==FF_IDCT_AUTO) avctx->idct_algo=FF_IDCT_VP3; dsputil_init(&s->dsp, avctx); ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct); s->quality_index = -1; s->y_superblock_width = (s->width + 31) / 32; s->y_superblock_height = (s->height + 31) / 32; y_superblock_count = s->y_superblock_width * s->y_superblock_height; c_width = s->width / 2; c_height = s->height / 2; s->c_superblock_width = (c_width + 31) / 32; s->c_superblock_height = (c_height + 31) / 32; c_superblock_count = s->c_superblock_width * s->c_superblock_height; s->superblock_count = y_superblock_count + (c_superblock_count * 2); s->u_superblock_start = y_superblock_count; s->v_superblock_start = s->u_superblock_start + c_superblock_count; s->superblock_coding = av_malloc(s->superblock_count); s->macroblock_width = (s->width + 15) / 16; s->macroblock_height = (s->height + 15) / 16; s->macroblock_count = s->macroblock_width * s->macroblock_height; s->fragment_width = s->width / FRAGMENT_PIXELS; s->fragment_height = s->height / FRAGMENT_PIXELS; s->fragment_count = s->fragment_width * s->fragment_height * 3 / 2; s->fragment_start[1] = s->fragment_width * s->fragment_height; s->fragment_start[2] = s->fragment_width * s->fragment_height * 5 / 4; debug_init(" Y plane: %d x %d\n", s->width, s->height); debug_init(" C plane: %d x %d\n", c_width, c_height); debug_init(" Y superblocks: %d x %d, %d total\n", s->y_superblock_width, s->y_superblock_height, y_superblock_count); debug_init(" C superblocks: %d x %d, %d total\n", s->c_superblock_width, s->c_superblock_height, c_superblock_count); debug_init(" total superblocks = %d, U starts @ %d, V starts @ %d\n", s->superblock_count, s->u_superblock_start, s->v_superblock_start); debug_init(" macroblocks: %d x %d, %d total\n", s->macroblock_width, s->macroblock_height, s->macroblock_count); debug_init(" %d fragments, %d x %d, u starts @ %d, v starts @ %d\n", s->fragment_count, s->fragment_width, s->fragment_height, s->fragment_start[1], s->fragment_start[2]); s->all_fragments = av_malloc(s->fragment_count * sizeof(Vp3Fragment)); s->coeffs = av_malloc(s->fragment_count * sizeof(Coeff) * 65); s->coded_fragment_list = av_malloc(s->fragment_count * sizeof(int)); s->pixel_addresses_initialized = 0; if (!s->theora_tables) { for (i = 0; i < 64; i++) { s->coded_dc_scale_factor[i] = vp31_dc_scale_factor[i]; s->coded_ac_scale_factor[i] = vp31_ac_scale_factor[i]; s->base_matrix[0][i] = vp31_intra_y_dequant[i]; s->base_matrix[1][i] = vp31_intra_c_dequant[i]; s->base_matrix[2][i] = vp31_inter_dequant[i]; s->filter_limit_values[i] = vp31_filter_limit_values[i]; } for(inter=0; inter<2; inter++){ for(plane=0; plane<3; plane++){ s->qr_count[inter][plane]= 1; s->qr_size [inter][plane][0]= 63; s->qr_base [inter][plane][0]= s->qr_base [inter][plane][1]= 2*inter + (!!plane)*!inter; } } for (i = 0; i < 16; i++) { init_vlc(&s->dc_vlc[i], 5, 32, &dc_bias[i][0][1], 4, 2, &dc_bias[i][0][0], 4, 2, 0); init_vlc(&s->ac_vlc_1[i], 5, 32, &ac_bias_0[i][0][1], 4, 2, &ac_bias_0[i][0][0], 4, 2, 0); init_vlc(&s->ac_vlc_2[i], 5, 32, &ac_bias_1[i][0][1], 4, 2, &ac_bias_1[i][0][0], 4, 2, 0); init_vlc(&s->ac_vlc_3[i], 5, 32, &ac_bias_2[i][0][1], 4, 2, &ac_bias_2[i][0][0], 4, 2, 0); init_vlc(&s->ac_vlc_4[i], 5, 32, &ac_bias_3[i][0][1], 4, 2, &ac_bias_3[i][0][0], 4, 2, 0); } } else { for (i = 0; i < 16; i++) { init_vlc(&s->dc_vlc[i], 5, 32, &s->huffman_table[i][0][1], 4, 2, &s->huffman_table[i][0][0], 4, 2, 0); init_vlc(&s->ac_vlc_1[i], 5, 32, &s->huffman_table[i+16][0][1], 4, 2, &s->huffman_table[i+16][0][0], 4, 2, 0); init_vlc(&s->ac_vlc_2[i], 5, 32, &s->huffman_table[i+16*2][0][1], 4, 2, &s->huffman_table[i+16*2][0][0], 4, 2, 0); init_vlc(&s->ac_vlc_3[i], 5, 32, &s->huffman_table[i+16*3][0][1], 4, 2, &s->huffman_table[i+16*3][0][0], 4, 2, 0); init_vlc(&s->ac_vlc_4[i], 5, 32, &s->huffman_table[i+16*4][0][1], 4, 2, &s->huffman_table[i+16*4][0][0], 4, 2, 0); } } init_vlc(&s->superblock_run_length_vlc, 6, 34, &superblock_run_length_vlc_table[0][1], 4, 2, &superblock_run_length_vlc_table[0][0], 4, 2, 0); init_vlc(&s->fragment_run_length_vlc, 5, 30, &fragment_run_length_vlc_table[0][1], 4, 2, &fragment_run_length_vlc_table[0][0], 4, 2, 0); init_vlc(&s->mode_code_vlc, 3, 8, &mode_code_vlc_table[0][1], 2, 1, &mode_code_vlc_table[0][0], 2, 1, 0); init_vlc(&s->motion_vector_vlc, 6, 63, &motion_vector_vlc_table[0][1], 2, 1, &motion_vector_vlc_table[0][0], 2, 1, 0); s->superblock_fragments = av_malloc(s->superblock_count * 16 * sizeof(int)); s->superblock_macroblocks = av_malloc(s->superblock_count * 4 * sizeof(int)); s->macroblock_fragments = av_malloc(s->macroblock_count * 6 * sizeof(int)); s->macroblock_coding = av_malloc(s->macroblock_count + 1); init_block_mapping(s); for (i = 0; i < 3; i++) { s->current_frame.data[i] = NULL; s->last_frame.data[i] = NULL; s->golden_frame.data[i] = NULL; } return 0; } libavcodec/vp3.c:1980: error: Integer Overflow L2 ([0, 4294967280] + 15):signed32. libavcodec/vp3.c:1936:1: <LHS trace> 1934. * This is the ffmpeg/libavcodec API init function. 1935. */ 1936. static av_cold int vp3_decode_init(AVCodecContext *avctx) ^ 1937. { 1938. Vp3DecodeContext *s = avctx->priv_data; libavcodec/vp3.c:1936:1: Parameter `avctx->width` 1934. * This is the ffmpeg/libavcodec API init function. 1935. */ 1936. static av_cold int vp3_decode_init(AVCodecContext *avctx) ^ 1937. { 1938. Vp3DecodeContext *s = avctx->priv_data; libavcodec/vp3.c:1951:5: Assignment 1949. 1950. s->avctx = avctx; 1951. s->width = (avctx->width + 15) & 0xFFFFFFF0; ^ 1952. s->height = (avctx->height + 15) & 0xFFFFFFF0; 1953. avctx->pix_fmt = PIX_FMT_YUV420P; libavcodec/vp3.c:1980:5: Binary operation: ([0, 4294967280] + 15):signed32 1978. s->superblock_coding = av_malloc(s->superblock_count); 1979. 1980. s->macroblock_width = (s->width + 15) / 16; ^ 1981. s->macroblock_height = (s->height + 15) / 16; 1982. s->macroblock_count = s->macroblock_width * s->macroblock_height;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vp3.c/#L1980
d2a_code_trace_data_43378
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/takdec.c:752: error: Integer Overflow L2 ([1, 2147483616] + 32):signed32 by call to `av_samples_get_buffer_size`. libavcodec/takdec.c:688:16: Call 686. bitstream_init8(bc, pkt->data, pkt->size); 687. 688. if ((ret = ff_tak_decode_frame_header(avctx, bc, &s->ti, 0)) < 0) ^ 689. return ret; 690. libavcodec/tak.c:124:1: Parameter `ti->frame_samples` 122. } 123. 124. int ff_tak_decode_frame_header(AVCodecContext *avctx, BitstreamContext *bc, ^ 125. TAKStreamInfo *ti, int log_level_offset) 126. { libavcodec/takdec.c:744:21: Assignment 742. avctx->channels = s->ti.channels; 743. 744. s->nb_samples = s->ti.last_frame_samples ? s->ti.last_frame_samples ^ 745. : s->ti.frame_samples; 746. libavcodec/takdec.c:744:5: Assignment 742. avctx->channels = s->ti.channels; 743. 744. s->nb_samples = s->ti.last_frame_samples ? s->ti.last_frame_samples ^ 745. : s->ti.frame_samples; 746. libavcodec/takdec.c:752:24: Call 750. 751. if (avctx->bits_per_coded_sample <= 16) { 752. int buf_size = av_samples_get_buffer_size(NULL, avctx->channels, ^ 753. s->nb_samples, 754. AV_SAMPLE_FMT_S32P, 0); 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_samples_get_buffer_size` 122. return AVERROR(EINVAL); 123. align = 1; 124. nb_samples = FFALIGN(nb_samples, 32); ^ 125. } 126.
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavutil/samplefmt.c/#L124
d2a_code_trace_data_43379
ngx_int_t ngx_http_internal_redirect(ngx_http_request_t *r, ngx_str_t *uri, ngx_str_t *args) { ngx_http_core_srv_conf_t *cscf; r->uri_changes--; if (r->uri_changes == 0) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "rewrite or internal redirection cycle " "while internal redirect to \"%V\"", uri); ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); return NGX_DONE; } r->uri = *uri; if (args) { r->args = *args; } else { r->args.len = 0; r->args.data = NULL; } ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "internal redirect: \"%V?%V\"", uri, &r->args); if (ngx_http_set_exten(r) != NGX_OK) { ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); return NGX_DONE; } ngx_memzero(r->ctx, sizeof(void *) * ngx_http_max_module); cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); r->loc_conf = cscf->ctx->loc_conf; ngx_http_update_location_config(r); #if (NGX_HTTP_CACHE) r->cache = NULL; #endif r->internal = 1; ngx_http_handler(r); return NGX_DONE; } src/http/ngx_http_upstream.c:1675: error: Integer Overflow L2 ([0, `r->uri_changes`] - 1):unsigned32 by call to `ngx_http_internal_redirect`. src/http/ngx_http_upstream.c:1612:1: Parameter `r->uri_changes` 1610. 1611. 1612. static ngx_int_t ^ 1613. ngx_http_upstream_process_headers(ngx_http_request_t *r, ngx_http_upstream_t *u) 1614. { src/http/ngx_http_upstream.c:1626:9: Call 1624. if (u->headers_in.x_accel_redirect) { 1625. 1626. ngx_http_upstream_finalize_request(r, u, NGX_DECLINED); ^ 1627. 1628. part = &u->headers_in.headers.part; src/http/ngx_http_upstream.c:2710:1: Parameter `r->uri_changes` 2708. 2709. 2710. static void ^ 2711. ngx_http_upstream_finalize_request(ngx_http_request_t *r, 2712. ngx_http_upstream_t *u, ngx_int_t rc) src/http/ngx_http_upstream.c:1675:9: Call 1673. r->valid_unparsed_uri = 0; 1674. 1675. ngx_http_internal_redirect(r, uri, &args); ^ 1676. return NGX_DONE; 1677. } src/http/ngx_http_core_module.c:2165:1: <LHS trace> 2163. 2164. 2165. ngx_int_t ^ 2166. ngx_http_internal_redirect(ngx_http_request_t *r, 2167. ngx_str_t *uri, ngx_str_t *args) src/http/ngx_http_core_module.c:2165:1: Parameter `r->uri_changes` 2163. 2164. 2165. ngx_int_t ^ 2166. ngx_http_internal_redirect(ngx_http_request_t *r, 2167. ngx_str_t *uri, ngx_str_t *args) src/http/ngx_http_core_module.c:2171:5: Binary operation: ([0, r->uri_changes] - 1):unsigned32 by call to `ngx_http_internal_redirect` 2169. ngx_http_core_srv_conf_t *cscf; 2170. 2171. r->uri_changes--; ^ 2172. 2173. if (r->uri_changes == 0) {
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/http/ngx_http_core_module.c/#L2171
d2a_code_trace_data_43380
static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) { int j; size_t len; const char *s, *ss, *p; if (dir == NULL || !*dir) { X509err(X509_F_ADD_CERT_DIR, X509_R_INVALID_DIRECTORY); return 0; } s = dir; p = s; do { if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) { BY_DIR_ENTRY *ent; ss = s; s = p + 1; len = p - ss; if (len == 0) continue; for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) { ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j); if (strlen(ent->dir) == len && strncmp(ent->dir, ss, len) == 0) break; } if (j < sk_BY_DIR_ENTRY_num(ctx->dirs)) continue; if (ctx->dirs == NULL) { ctx->dirs = sk_BY_DIR_ENTRY_new_null(); if (!ctx->dirs) { X509err(X509_F_ADD_CERT_DIR, ERR_R_MALLOC_FAILURE); return 0; } } ent = OPENSSL_malloc(sizeof(*ent)); if (ent == NULL) return 0; ent->dir_type = type; ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp); ent->dir = OPENSSL_strndup(ss, len); if (ent->dir == NULL || ent->hashes == NULL) { by_dir_entry_free(ent); return 0; } if (!sk_BY_DIR_ENTRY_push(ctx->dirs, ent)) { by_dir_entry_free(ent); return 0; } } } while (*p++ != '\0'); return 1; } crypto/x509/by_dir.c:193: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_strndup()` at line 191, column 24 is not reachable after line 193, column 17. Showing all 96 steps of the trace crypto/x509/by_dir.c:151:1: start of procedure add_cert_dir() 149. } 150. 151. > static int add_cert_dir(BY_DIR *ctx, const char *dir, int type) 152. { 153. int j; crypto/x509/by_dir.c:157:9: Taking false branch 155. const char *s, *ss, *p; 156. 157. if (dir == NULL || !*dir) { ^ 158. X509err(X509_F_ADD_CERT_DIR, X509_R_INVALID_DIRECTORY); 159. return 0; crypto/x509/by_dir.c:157:25: Taking false branch 155. const char *s, *ss, *p; 156. 157. if (dir == NULL || !*dir) { ^ 158. X509err(X509_F_ADD_CERT_DIR, X509_R_INVALID_DIRECTORY); 159. return 0; crypto/x509/by_dir.c:162:5: 160. } 161. 162. > s = dir; 163. p = s; 164. do { crypto/x509/by_dir.c:163:5: 161. 162. s = dir; 163. > p = s; 164. do { 165. if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) { crypto/x509/by_dir.c:165:14: Taking true branch 163. p = s; 164. do { 165. if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) { ^ 166. BY_DIR_ENTRY *ent; 167. ss = s; crypto/x509/by_dir.c:167:13: 165. if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) { 166. BY_DIR_ENTRY *ent; 167. > ss = s; 168. s = p + 1; 169. len = p - ss; crypto/x509/by_dir.c:168:13: 166. BY_DIR_ENTRY *ent; 167. ss = s; 168. > s = p + 1; 169. len = p - ss; 170. if (len == 0) crypto/x509/by_dir.c:169:13: 167. ss = s; 168. s = p + 1; 169. > len = p - ss; 170. if (len == 0) 171. continue; crypto/x509/by_dir.c:170:17: Taking false branch 168. s = p + 1; 169. len = p - ss; 170. if (len == 0) ^ 171. continue; 172. for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) { crypto/x509/by_dir.c:172:18: 170. if (len == 0) 171. continue; 172. > for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) { 173. ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j); 174. if (strlen(ent->dir) == len && strncmp(ent->dir, ss, len) == 0) crypto/x509/by_dir.c:172:25: 170. if (len == 0) 171. continue; 172. > for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) { 173. ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j); 174. if (strlen(ent->dir) == len && strncmp(ent->dir, ss, len) == 0) crypto/x509/x509_lcl.h:142:1: start of procedure sk_BY_DIR_ENTRY_num() 140. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 141. DEFINE_STACK_OF(BY_DIR_HASH) 142. > DEFINE_STACK_OF(BY_DIR_ENTRY) 143. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 144. DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) crypto/stack/stack.c:277:1: start of procedure OPENSSL_sk_num() 275. } 276. 277. > int OPENSSL_sk_num(const OPENSSL_STACK *st) 278. { 279. if (st == NULL) crypto/stack/stack.c:279:9: Taking true branch 277. int OPENSSL_sk_num(const OPENSSL_STACK *st) 278. { 279. if (st == NULL) ^ 280. return -1; 281. return st->num; crypto/stack/stack.c:280:9: 278. { 279. if (st == NULL) 280. > return -1; 281. return st->num; 282. } crypto/stack/stack.c:282:1: return from a call to OPENSSL_sk_num 280. return -1; 281. return st->num; 282. > } 283. 284. void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i) crypto/x509/x509_lcl.h:142:1: return from a call to sk_BY_DIR_ENTRY_num 140. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 141. DEFINE_STACK_OF(BY_DIR_HASH) 142. > DEFINE_STACK_OF(BY_DIR_ENTRY) 143. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 144. DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) crypto/x509/by_dir.c:172:25: Loop condition is false. Leaving loop 170. if (len == 0) 171. continue; 172. for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) { ^ 173. ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j); 174. if (strlen(ent->dir) == len && strncmp(ent->dir, ss, len) == 0) crypto/x509/by_dir.c:177:17: 175. break; 176. } 177. > if (j < sk_BY_DIR_ENTRY_num(ctx->dirs)) 178. continue; 179. if (ctx->dirs == NULL) { crypto/x509/x509_lcl.h:142:1: start of procedure sk_BY_DIR_ENTRY_num() 140. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 141. DEFINE_STACK_OF(BY_DIR_HASH) 142. > DEFINE_STACK_OF(BY_DIR_ENTRY) 143. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 144. DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) crypto/stack/stack.c:277:1: start of procedure OPENSSL_sk_num() 275. } 276. 277. > int OPENSSL_sk_num(const OPENSSL_STACK *st) 278. { 279. if (st == NULL) crypto/stack/stack.c:279:9: Taking true branch 277. int OPENSSL_sk_num(const OPENSSL_STACK *st) 278. { 279. if (st == NULL) ^ 280. return -1; 281. return st->num; crypto/stack/stack.c:280:9: 278. { 279. if (st == NULL) 280. > return -1; 281. return st->num; 282. } crypto/stack/stack.c:282:1: return from a call to OPENSSL_sk_num 280. return -1; 281. return st->num; 282. > } 283. 284. void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i) crypto/x509/x509_lcl.h:142:1: return from a call to sk_BY_DIR_ENTRY_num 140. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 141. DEFINE_STACK_OF(BY_DIR_HASH) 142. > DEFINE_STACK_OF(BY_DIR_ENTRY) 143. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 144. DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) crypto/x509/by_dir.c:177:17: Taking false branch 175. break; 176. } 177. if (j < sk_BY_DIR_ENTRY_num(ctx->dirs)) ^ 178. continue; 179. if (ctx->dirs == NULL) { crypto/x509/by_dir.c:179:17: Taking true branch 177. if (j < sk_BY_DIR_ENTRY_num(ctx->dirs)) 178. continue; 179. if (ctx->dirs == NULL) { ^ 180. ctx->dirs = sk_BY_DIR_ENTRY_new_null(); 181. if (!ctx->dirs) { crypto/x509/by_dir.c:180:17: 178. continue; 179. if (ctx->dirs == NULL) { 180. > ctx->dirs = sk_BY_DIR_ENTRY_new_null(); 181. if (!ctx->dirs) { 182. X509err(X509_F_ADD_CERT_DIR, ERR_R_MALLOC_FAILURE); crypto/x509/x509_lcl.h:142:1: start of procedure sk_BY_DIR_ENTRY_new_null() 140. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 141. DEFINE_STACK_OF(BY_DIR_HASH) 142. > DEFINE_STACK_OF(BY_DIR_ENTRY) 143. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 144. DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) crypto/stack/stack.c:99:1: start of procedure OPENSSL_sk_new_null() 97. } 98. 99. > OPENSSL_STACK *OPENSSL_sk_new_null(void) 100. { 101. return OPENSSL_sk_new((OPENSSL_sk_compfunc)NULL); crypto/stack/stack.c:101:5: Skipping OPENSSL_sk_new(): empty list of specs 99. OPENSSL_STACK *OPENSSL_sk_new_null(void) 100. { 101. return OPENSSL_sk_new((OPENSSL_sk_compfunc)NULL); ^ 102. } 103. crypto/stack/stack.c:102:1: return from a call to OPENSSL_sk_new_null 100. { 101. return OPENSSL_sk_new((OPENSSL_sk_compfunc)NULL); 102. > } 103. 104. OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc c) crypto/x509/x509_lcl.h:142:1: return from a call to sk_BY_DIR_ENTRY_new_null 140. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 141. DEFINE_STACK_OF(BY_DIR_HASH) 142. > DEFINE_STACK_OF(BY_DIR_ENTRY) 143. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; 144. DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY) crypto/x509/by_dir.c:181:22: Taking false branch 179. if (ctx->dirs == NULL) { 180. ctx->dirs = sk_BY_DIR_ENTRY_new_null(); 181. if (!ctx->dirs) { ^ 182. X509err(X509_F_ADD_CERT_DIR, ERR_R_MALLOC_FAILURE); 183. return 0; crypto/x509/by_dir.c:186:13: 184. } 185. } 186. > ent = OPENSSL_malloc(sizeof(*ent)); 187. if (ent == NULL) 188. return 0; 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 true 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:174:32: Taking true 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:175:9: Skipping __function_pointer__(): unresolved function pointer 173. 174. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) 175. return malloc_impl(num, file, line); ^ 176. 177. if (num == 0) 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/x509/by_dir.c:187:17: Taking false branch 185. } 186. ent = OPENSSL_malloc(sizeof(*ent)); 187. if (ent == NULL) ^ 188. return 0; 189. ent->dir_type = type; crypto/x509/by_dir.c:189:13: 187. if (ent == NULL) 188. return 0; 189. > ent->dir_type = type; 190. ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp); 191. ent->dir = OPENSSL_strndup(ss, len); crypto/x509/by_dir.c:190:13: 188. return 0; 189. ent->dir_type = type; 190. > ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp); 191. ent->dir = OPENSSL_strndup(ss, len); 192. if (ent->dir == NULL || ent->hashes == NULL) { crypto/x509/x509_lcl.h:141:1: start of procedure sk_BY_DIR_HASH_new() 139. typedef struct lookup_dir_hashes_st BY_DIR_HASH; 140. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 141. > DEFINE_STACK_OF(BY_DIR_HASH) 142. DEFINE_STACK_OF(BY_DIR_ENTRY) 143. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; crypto/x509/x509_lcl.h:141:1: return from a call to sk_BY_DIR_HASH_new 139. typedef struct lookup_dir_hashes_st BY_DIR_HASH; 140. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 141. > DEFINE_STACK_OF(BY_DIR_HASH) 142. DEFINE_STACK_OF(BY_DIR_ENTRY) 143. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; crypto/x509/by_dir.c:191:13: 189. ent->dir_type = type; 190. ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp); 191. > ent->dir = OPENSSL_strndup(ss, len); 192. if (ent->dir == NULL || ent->hashes == NULL) { 193. by_dir_entry_free(ent); crypto/o_str.c:39:1: start of procedure CRYPTO_strndup() 37. } 38. 39. > char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line) 40. { 41. size_t maxlen; crypto/o_str.c:44:9: Taking false branch 42. char *ret; 43. 44. if (str == NULL) ^ 45. return NULL; 46. crypto/o_str.c:47:5: 45. return NULL; 46. 47. > maxlen = OPENSSL_strnlen(str, s); 48. 49. ret = CRYPTO_malloc(maxlen + 1, file, line); crypto/o_str.c:72:1: start of procedure OPENSSL_strnlen() 70. } 71. 72. > size_t OPENSSL_strnlen(const char *str, size_t maxlen) 73. { 74. const char *p; crypto/o_str.c:76:10: 74. const char *p; 75. 76. > for (p = str; maxlen-- != 0 && *p != '\0'; ++p) ; 77. 78. return p - str; crypto/o_str.c:76:19: Loop condition is true. Entering loop body 74. const char *p; 75. 76. for (p = str; maxlen-- != 0 && *p != '\0'; ++p) ; ^ 77. 78. return p - str; crypto/o_str.c:76:36: Loop condition is true. Entering loop body 74. const char *p; 75. 76. for (p = str; maxlen-- != 0 && *p != '\0'; ++p) ; ^ 77. 78. return p - str; crypto/o_str.c:76:48: 74. const char *p; 75. 76. > for (p = str; maxlen-- != 0 && *p != '\0'; ++p) ; 77. 78. return p - str; crypto/o_str.c:76:19: Loop condition is true. Entering loop body 74. const char *p; 75. 76. for (p = str; maxlen-- != 0 && *p != '\0'; ++p) ; ^ 77. 78. return p - str; crypto/o_str.c:76:36: Loop condition is false. Leaving loop 74. const char *p; 75. 76. for (p = str; maxlen-- != 0 && *p != '\0'; ++p) ; ^ 77. 78. return p - str; crypto/o_str.c:78:5: 76. for (p = str; maxlen-- != 0 && *p != '\0'; ++p) ; 77. 78. > return p - str; 79. } 80. crypto/o_str.c:79:1: return from a call to OPENSSL_strnlen 77. 78. return p - str; 79. > } 80. 81. size_t OPENSSL_strlcpy(char *dst, const char *src, size_t size) crypto/o_str.c:49:5: 47. maxlen = OPENSSL_strnlen(str, s); 48. 49. > ret = CRYPTO_malloc(maxlen + 1, file, line); 50. if (ret) { 51. memcpy(ret, str, maxlen); 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/o_str.c:50:9: Taking true branch 48. 49. ret = CRYPTO_malloc(maxlen + 1, file, line); 50. if (ret) { ^ 51. memcpy(ret, str, maxlen); 52. ret[maxlen] = '\0'; crypto/o_str.c:51:9: 49. ret = CRYPTO_malloc(maxlen + 1, file, line); 50. if (ret) { 51. > memcpy(ret, str, maxlen); 52. ret[maxlen] = '\0'; 53. } crypto/o_str.c:52:9: 50. if (ret) { 51. memcpy(ret, str, maxlen); 52. > ret[maxlen] = '\0'; 53. } 54. return ret; crypto/o_str.c:54:5: 52. ret[maxlen] = '\0'; 53. } 54. > return ret; 55. } 56. crypto/o_str.c:55:1: return from a call to CRYPTO_strndup 53. } 54. return ret; 55. > } 56. 57. void *CRYPTO_memdup(const void *data, size_t siz, const char* file, int line) crypto/x509/by_dir.c:192:17: Taking false branch 190. ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp); 191. ent->dir = OPENSSL_strndup(ss, len); 192. if (ent->dir == NULL || ent->hashes == NULL) { ^ 193. by_dir_entry_free(ent); 194. return 0; crypto/x509/by_dir.c:192:37: Taking true branch 190. ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp); 191. ent->dir = OPENSSL_strndup(ss, len); 192. if (ent->dir == NULL || ent->hashes == NULL) { ^ 193. by_dir_entry_free(ent); 194. return 0; crypto/x509/by_dir.c:193:17: 191. ent->dir = OPENSSL_strndup(ss, len); 192. if (ent->dir == NULL || ent->hashes == NULL) { 193. > by_dir_entry_free(ent); 194. return 0; 195. } crypto/x509/by_dir.c:133:1: start of procedure by_dir_entry_free() 131. } 132. 133. > static void by_dir_entry_free(BY_DIR_ENTRY *ent) 134. { 135. OPENSSL_free(ent->dir); crypto/x509/by_dir.c:135:5: 133. static void by_dir_entry_free(BY_DIR_ENTRY *ent) 134. { 135. > OPENSSL_free(ent->dir); 136. sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free); 137. OPENSSL_free(ent); 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/by_dir.c:136:5: 134. { 135. OPENSSL_free(ent->dir); 136. > sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free); 137. OPENSSL_free(ent); 138. } crypto/x509/x509_lcl.h:141:1: start of procedure sk_BY_DIR_HASH_pop_free() 139. typedef struct lookup_dir_hashes_st BY_DIR_HASH; 140. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 141. > DEFINE_STACK_OF(BY_DIR_HASH) 142. DEFINE_STACK_OF(BY_DIR_ENTRY) 143. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; crypto/x509/x509_lcl.h:141:1: return from a call to sk_BY_DIR_HASH_pop_free 139. typedef struct lookup_dir_hashes_st BY_DIR_HASH; 140. typedef struct lookup_dir_entry_st BY_DIR_ENTRY; 141. > DEFINE_STACK_OF(BY_DIR_HASH) 142. DEFINE_STACK_OF(BY_DIR_ENTRY) 143. typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY; crypto/x509/by_dir.c:137:5: 135. OPENSSL_free(ent->dir); 136. sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free); 137. > OPENSSL_free(ent); 138. } 139. 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 false 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:281:5: 279. } 280. #else 281. > free(str); 282. #endif 283. } 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/by_dir.c:138:1: return from a call to by_dir_entry_free 136. sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free); 137. OPENSSL_free(ent); 138. > } 139. 140. static void free_dir(X509_LOOKUP *lu)
https://github.com/openssl/openssl/blob/53a73768a7f17dba012615ea79960d724b310856/crypto/x509/by_dir.c/#L193
d2a_code_trace_data_43381
size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) { int len = strlen(dst); va_list vl; va_start(vl, fmt); len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); va_end(vl); return len; } libavformat/icecast.c:86: error: Integer Overflow R2 ([0, +oo] + [0, +oo]):signed32 by call to `av_strlcatf`. libavformat/icecast.c:68:1: Parameter `buf->strlen` 66. 67. 68. static char *cat_header(char buf[], const char key[], const char value[]) ^ 69. { 70. if (NOT_EMPTY(value)) { libavformat/icecast.c:86:9: Call 84. *buf = '\0'; 85. 86. av_strlcatf(buf, len, "%s: %s\r\n", key, value); ^ 87. } 88. return buf; libavutil/avstring.c:99:1: <LHS trace> 97. } 98. 99. size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) ^ 100. { 101. int len = strlen(dst); libavutil/avstring.c:99:1: Parameter `size` 97. } 98. 99. size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) ^ 100. { 101. int len = strlen(dst); libavutil/avstring.c:105:12: <RHS trace> 103. 104. va_start(vl, fmt); 105. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); ^ 106. va_end(vl); 107. libavutil/avstring.c:105:12: Risky value from: vsnprintf 103. 104. va_start(vl, fmt); 105. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); ^ 106. va_end(vl); 107. libavutil/avstring.c:105:5: Binary operation: ([0, +oo] + [0, +oo]):signed32 by call to `av_strlcatf` 103. 104. va_start(vl, fmt); 105. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); ^ 106. va_end(vl); 107.
https://github.com/libav/libav/blob/eb9244f20210fd420fb9b3c98126f9cae525d1cc/libavutil/avstring.c/#L105
d2a_code_trace_data_43382
static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts) { InputStream *ist = s->opaque; const enum AVPixelFormat *p; int ret; for (p = pix_fmts; *p != -1; p++) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p); const HWAccel *hwaccel; if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) break; hwaccel = get_hwaccel(*p); if (!hwaccel || (ist->active_hwaccel_id && ist->active_hwaccel_id != hwaccel->id) || (ist->hwaccel_id != HWACCEL_AUTO && ist->hwaccel_id != hwaccel->id)) continue; ret = hwaccel->init(s); if (ret < 0) { if (ist->hwaccel_id == hwaccel->id) { av_log(NULL, AV_LOG_FATAL, "%s hwaccel requested for input stream #%d:%d, " "but cannot be initialized.\n", hwaccel->name, ist->file_index, ist->st->index); return AV_PIX_FMT_NONE; } continue; } if (ist->hw_frames_ctx) { s->hw_frames_ctx = av_buffer_ref(ist->hw_frames_ctx); if (!s->hw_frames_ctx) return AV_PIX_FMT_NONE; } ist->active_hwaccel_id = hwaccel->id; ist->hwaccel_pix_fmt = *p; break; } return *p; } avconv.c:1609: error: Null Dereference pointer `desc` last assigned on line 1606 could be null and is dereferenced at line 1609, column 15. avconv.c:1599:1: start of procedure get_format() 1597. } 1598. 1599. static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts) ^ 1600. { 1601. InputStream *ist = s->opaque; avconv.c:1601:5: 1599. static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts) 1600. { 1601. InputStream *ist = s->opaque; ^ 1602. const enum AVPixelFormat *p; 1603. int ret; avconv.c:1605:10: 1603. int ret; 1604. 1605. for (p = pix_fmts; *p != -1; p++) { ^ 1606. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p); 1607. const HWAccel *hwaccel; avconv.c:1605:24: Loop condition is true. Entering loop body 1603. int ret; 1604. 1605. for (p = pix_fmts; *p != -1; p++) { ^ 1606. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p); 1607. const HWAccel *hwaccel; avconv.c:1606:9: 1604. 1605. for (p = pix_fmts; *p != -1; p++) { 1606. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p); ^ 1607. const HWAccel *hwaccel; 1608. libavutil/pixdesc.c:1744:1: start of procedure av_pix_fmt_desc_get() 1742. } 1743. 1744. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) ^ 1745. { 1746. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) libavutil/pixdesc.c:1746:9: Taking false branch 1744. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1745. { 1746. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1747. return NULL; 1748. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1746:24: Taking true branch 1744. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1745. { 1746. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1747. return NULL; 1748. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1747:9: 1745. { 1746. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) 1747. return NULL; ^ 1748. return &av_pix_fmt_descriptors[pix_fmt]; 1749. } libavutil/pixdesc.c:1749:1: return from a call to av_pix_fmt_desc_get 1747. return NULL; 1748. return &av_pix_fmt_descriptors[pix_fmt]; 1749. } ^ 1750. 1751. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) avconv.c:1609:15: 1607. const HWAccel *hwaccel; 1608. 1609. if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) ^ 1610. break; 1611.
https://github.com/libav/libav/blob/82b7525173f20702a8cbc26ebedbf4b69b8fecec/avconv.c/#L1609
d2a_code_trace_data_43383
static int write_record(BIO *b, size_t len, int rectype, int recversion) { unsigned char header[SSL3_RT_HEADER_LENGTH]; size_t written; unsigned char buf[256]; memset(buf, 0, sizeof(buf)); header[0] = rectype; header[1] = (recversion >> 8) & 0xff; header[2] = recversion & 0xff; header[3] = (len >> 8) & 0xff; header[4] = len & 0xff; if (!BIO_write_ex(b, header, SSL3_RT_HEADER_LENGTH, &written) || written != SSL3_RT_HEADER_LENGTH) return 0; while (len > 0) { size_t outlen; if (len > sizeof(buf)) outlen = sizeof(buf); else outlen = len; if (!BIO_write_ex(b, buf, outlen, &written) || written != outlen) return 0; len -= outlen; } return 1; } test/recordlentest.c:58: error: INTEGER_OVERFLOW_L2 ([1, `len`] - [1, 256]):unsigned64. Showing all 5 steps of the trace test/recordlentest.c:28:1: <LHS trace> 26. #define TOTAL_RECORD_OVERFLOW_TESTS 6 27. 28. > static int write_record(BIO *b, size_t len, int rectype, int recversion) 29. { 30. unsigned char header[SSL3_RT_HEADER_LENGTH]; test/recordlentest.c:28:1: Parameter `len` 26. #define TOTAL_RECORD_OVERFLOW_TESTS 6 27. 28. > static int write_record(BIO *b, size_t len, int rectype, int recversion) 29. { 30. unsigned char header[SSL3_RT_HEADER_LENGTH]; test/recordlentest.c:50:13: <RHS trace> 48. 49. if (len > sizeof(buf)) 50. outlen = sizeof(buf); ^ 51. else 52. outlen = len; test/recordlentest.c:50:13: Assignment 48. 49. if (len > sizeof(buf)) 50. outlen = sizeof(buf); ^ 51. else 52. outlen = len; test/recordlentest.c:58:9: Binary operation: ([1, len] - [1, 256]):unsigned64 56. return 0; 57. 58. len -= outlen; ^ 59. } 60.
https://github.com/openssl/openssl/blob/ee6d9dfb39ff90a31027c51b80362d274918e3dd/test/recordlentest.c/#L58
d2a_code_trace_data_43384
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:1802: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mul`. Showing all 10 steps of the trace test/bntest.c:1802:10: Call 1800. BN_set_negative(a, 1); 1801. BN_zero(b); 1802. if (!BN_mul(c, a, b, ctx)) ^ 1803. goto err; 1804. if (!BN_is_zero(c) || BN_is_negative(c)) { crypto/bn/bn_mul.c:828:1: Parameter `ctx->stack.depth` 826. #endif /* BN_RECURSION */ 827. 828. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 829. { 830. int ret = 0; crypto/bn/bn_mul.c:854:5: Call 852. top = al + bl; 853. 854. BN_CTX_start(ctx); ^ 855. if ((r == a) || (r == b)) { 856. if ((rr = BN_CTX_get(ctx)) == NULL) 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_mul.c:979:5: Call 977. err: 978. bn_check_top(r); 979. BN_CTX_end(ctx); ^ 980. return (ret); 981. } crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.depth` 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: <LHS 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:273:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mul` 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/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_43385
ngx_int_t ngx_http_internal_redirect(ngx_http_request_t *r, ngx_str_t *uri, ngx_str_t *args) { ngx_http_core_srv_conf_t *cscf; r->uri_changes--; if (r->uri_changes == 0) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "rewrite or internal redirection cycle " "while internally redirecting to \"%V\"", uri); r->main->count++; ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); return NGX_DONE; } r->uri = *uri; if (args) { r->args = *args; } else { ngx_str_null(&r->args); } ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "internal redirect: \"%V?%V\"", uri, &r->args); ngx_http_set_exten(r); ngx_memzero(r->ctx, sizeof(void *) * ngx_http_max_module); cscf = ngx_http_get_module_srv_conf(r, ngx_http_core_module); r->loc_conf = cscf->ctx->loc_conf; ngx_http_update_location_config(r); #if (NGX_HTTP_CACHE) r->cache = NULL; #endif r->internal = 1; r->valid_unparsed_uri = 0; r->add_uri_to_alias = 0; r->main->count++; ngx_http_handler(r); return NGX_DONE; } src/http/ngx_http_core_module.c:1287: error: Integer Overflow L2 ([0, `r->uri_changes`] - 1):unsigned32 by call to `ngx_http_finalize_request`. src/http/ngx_http_core_module.c:1161:1: Parameter `r->uri_changes` 1159. 1160. 1161. ngx_int_t ^ 1162. ngx_http_core_try_files_phase(ngx_http_request_t *r, 1163. ngx_http_phase_handler_t *ph) src/http/ngx_http_core_module.c:1287:13: Call 1285. } 1286. 1287. ngx_http_finalize_request(r, NGX_DONE); ^ 1288. return NGX_OK; 1289. } src/http/ngx_http_request.c:1912:1: Parameter `r->uri_changes` 1910. 1911. 1912. void ^ 1913. ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc) 1914. { src/http/ngx_http_request.c:1951:13: Call 1949. || c->error) 1950. { 1951. if (ngx_http_post_action(r) == NGX_OK) { ^ 1952. return; 1953. } src/http/ngx_http_request.c:2920:1: Parameter `r->uri_changes` 2918. 2919. 2920. static ngx_int_t ^ 2921. ngx_http_post_action(ngx_http_request_t *r) 2922. { src/http/ngx_http_request.c:2943:9: Call 2941. 2942. if (clcf->post_action.data[0] == '/') { 2943. ngx_http_internal_redirect(r, &clcf->post_action, NULL); ^ 2944. 2945. } else { src/http/ngx_http_core_module.c:2464:1: <LHS trace> 2462. 2463. 2464. ngx_int_t ^ 2465. ngx_http_internal_redirect(ngx_http_request_t *r, 2466. ngx_str_t *uri, ngx_str_t *args) src/http/ngx_http_core_module.c:2464:1: Parameter `r->uri_changes` 2462. 2463. 2464. ngx_int_t ^ 2465. ngx_http_internal_redirect(ngx_http_request_t *r, 2466. ngx_str_t *uri, ngx_str_t *args) src/http/ngx_http_core_module.c:2470:5: Binary operation: ([0, r->uri_changes] - 1):unsigned32 by call to `ngx_http_finalize_request` 2468. ngx_http_core_srv_conf_t *cscf; 2469. 2470. r->uri_changes--; ^ 2471. 2472. if (r->uri_changes == 0) {
https://github.com/nginx/nginx/blob/1b0ad6ee72179fef479bfae7c8c4bfd5ac834c29/src/http/ngx_http_core_module.c/#L2470
d2a_code_trace_data_43386
int BN_hex2bn(BIGNUM **bn, const char *a) { BIGNUM *ret = NULL; BN_ULONG l = 0; int neg = 0, h, m, i, j, k, c; int num; if ((a == NULL) || (*a == '\0')) return (0); if (*a == '-') { neg = 1; a++; } for (i = 0; i <= (INT_MAX/4) && isxdigit((unsigned char)a[i]); i++) continue; if (i == 0 || i > INT_MAX/4) goto err; num = i + neg; if (bn == NULL) return (num); if (*bn == NULL) { if ((ret = BN_new()) == NULL) return (0); } else { ret = *bn; BN_zero(ret); } if (bn_expand(ret, i * 4) == NULL) goto err; j = i; m = 0; h = 0; while (j > 0) { m = ((BN_BYTES * 2) <= j) ? (BN_BYTES * 2) : j; l = 0; for (;;) { c = a[j - m]; k = OPENSSL_hexchar2int(c); if (k < 0) k = 0; l = (l << 4) | k; if (--m <= 0) { ret->d[h++] = l; break; } } j -= (BN_BYTES * 2); } ret->top = h; bn_correct_top(ret); *bn = ret; bn_check_top(ret); if (ret->top != 0) ret->neg = neg; return (num); err: if (*bn == NULL) BN_free(ret); return (0); } test/bntest.c:1677: error: BUFFER_OVERRUN_L2 Offset: [-13, 536870914] (⇐ [2, 4] + [-15, 536870910]) Size: 7 by call to `BN_asc2bn`. Showing all 10 steps of the trace test/bntest.c:1677:10: Call 1675. goto err; 1676. 1677. if (!TEST_true(BN_asc2bn(&bn, "0x1234")) ^ 1678. || !TEST_BN_eq_word(bn, 0x1234) 1679. || !TEST_BN_ge_zero(bn)) crypto/bn/bn_print.c:267:1: Parameter `*a` 265. } 266. 267. > int BN_asc2bn(BIGNUM **bn, const char *a) 268. { 269. const char *p = a; crypto/bn/bn_print.c:269:5: Assignment 267. int BN_asc2bn(BIGNUM **bn, const char *a) 268. { 269. const char *p = a; ^ 270. 271. if (*p == '-') crypto/bn/bn_print.c:275:14: Call 273. 274. if (p[0] == '0' && (p[1] == 'X' || p[1] == 'x')) { 275. if (!BN_hex2bn(bn, p + 2)) ^ 276. return 0; 277. } else { crypto/bn/bn_print.c:139:10: <Offset trace> 137. } 138. 139. for (i = 0; i <= (INT_MAX/4) && isxdigit((unsigned char)a[i]); i++) ^ 140. continue; 141. crypto/bn/bn_print.c:139:10: Assignment 137. } 138. 139. for (i = 0; i <= (INT_MAX/4) && isxdigit((unsigned char)a[i]); i++) ^ 140. continue; 141. crypto/bn/bn_print.c:162:5: Assignment 160. goto err; 161. 162. j = i; /* least significant 'hex' */ ^ 163. m = 0; 164. h = 0; crypto/bn/bn_print.c:124:1: <Length trace> 122. } 123. 124. > int BN_hex2bn(BIGNUM **bn, const char *a) 125. { 126. BIGNUM *ret = NULL; crypto/bn/bn_print.c:124:1: Parameter `*a` 122. } 123. 124. > int BN_hex2bn(BIGNUM **bn, const char *a) 125. { 126. BIGNUM *ret = NULL; crypto/bn/bn_print.c:169:17: Array access: Offset: [-13, 536870914] (⇐ [2, 4] + [-15, 536870910]) Size: 7 by call to `BN_asc2bn` 167. l = 0; 168. for (;;) { 169. c = a[j - m]; ^ 170. k = OPENSSL_hexchar2int(c); 171. if (k < 0)
https://github.com/openssl/openssl/blob/3f97052392cb10fca5309212bf720685262ad4a6/crypto/bn/bn_print.c/#L169
d2a_code_trace_data_43387
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_blind.c:157: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul`. Showing all 20 steps of the trace crypto/bn/bn_blind.c:134:1: Parameter `ctx->stack.depth` 132. } 133. 134. > int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx) 135. { 136. int ret = 1; crypto/bn/bn_blind.c:157:15: Call 155. ret = BN_mod_mul_montgomery(n, n, b->A, b->m_ctx, ctx); 156. else 157. ret = BN_mod_mul(n, n, b->A, b->mod, ctx); ^ 158. 159. return ret; crypto/bn/bn_mod.c:193:1: Parameter `ctx->stack.depth` 191. 192. /* slow but works */ 193. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 194. BN_CTX *ctx) 195. { crypto/bn/bn_mod.c:203:5: Call 201. bn_check_top(m); 202. 203. BN_CTX_start(ctx); ^ 204. if ((t = BN_CTX_get(ctx)) == NULL) 205. goto err; crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_mod.c:204:14: Call 202. 203. BN_CTX_start(ctx); 204. if ((t = BN_CTX_get(ctx)) == NULL) ^ 205. goto err; 206. if (a == b) { crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_mod.c: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 `ctx->stack.depth` 495. #endif /* BN_RECURSION */ 496. 497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); crypto/bn/bn_mul.c:499:15: Call 497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); ^ 500. 501. bn_correct_top(r); crypto/bn/bn_mul.c:533:5: Call 531. top = al + bl; 532. 533. BN_CTX_start(ctx); ^ 534. if ((r == a) || (r == b)) { 535. if ((rr = BN_CTX_get(ctx)) == 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/bn/bn_mul.c:618:5: Call 616. err: 617. bn_check_top(r); 618. BN_CTX_end(ctx); ^ 619. return ret; 620. } 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` 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_43388
PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, EVP_CIPHER *cipher, int flags) { PKCS7 *p7; BIO *p7bio = NULL; int i; X509 *x509; if(!(p7 = PKCS7_new())) { PKCS7err(PKCS7_F_PKCS7_ENCRYPT,ERR_R_MALLOC_FAILURE); return NULL; } PKCS7_set_type(p7, NID_pkcs7_enveloped); if(!PKCS7_set_cipher(p7, cipher)) { PKCS7err(PKCS7_F_PKCS7_ENCRYPT,PKCS7_R_ERROR_SETTING_CIPHER); goto err; } for(i = 0; i < sk_X509_num(certs); i++) { x509 = sk_X509_value(certs, i); if(!PKCS7_add_recipient(p7, x509)) { PKCS7err(PKCS7_F_PKCS7_ENCRYPT, PKCS7_R_ERROR_ADDING_RECIPIENT); goto err; } } if(!(p7bio = PKCS7_dataInit(p7, NULL))) { PKCS7err(PKCS7_F_PKCS7_ENCRYPT,ERR_R_MALLOC_FAILURE); goto err; } SMIME_crlf_copy(in, p7bio, flags); BIO_flush(p7bio); if (!PKCS7_dataFinal(p7,p7bio)) { PKCS7err(PKCS7_F_PKCS7_ENCRYPT,PKCS7_R_PKCS7_DATAFINAL_ERROR); goto err; } BIO_free_all(p7bio); return p7; err: BIO_free(p7bio); PKCS7_free(p7); return NULL; } crypto/pkcs7/pk7_smime.c:346: error: NULL_DEREFERENCE pointer `p7->d.enveloped` last assigned on line 345 could be null and is dereferenced by call to `PKCS7_set_cipher()` at line 346, column 6. Showing all 47 steps of the trace crypto/pkcs7/pk7_smime.c:333:1: start of procedure PKCS7_encrypt() 331. /* Build a complete PKCS#7 enveloped data */ 332. 333. > PKCS7 *PKCS7_encrypt(STACK_OF(X509) *certs, BIO *in, EVP_CIPHER *cipher, 334. int flags) 335. { crypto/pkcs7/pk7_smime.c:337:2: 335. { 336. PKCS7 *p7; 337. > BIO *p7bio = NULL; 338. int i; 339. X509 *x509; crypto/pkcs7/pk7_smime.c:340:7: Taking false branch 338. int i; 339. X509 *x509; 340. if(!(p7 = PKCS7_new())) { ^ 341. PKCS7err(PKCS7_F_PKCS7_ENCRYPT,ERR_R_MALLOC_FAILURE); 342. return NULL; crypto/pkcs7/pk7_smime.c:345:2: 343. } 344. 345. > PKCS7_set_type(p7, NID_pkcs7_enveloped); 346. if(!PKCS7_set_cipher(p7, cipher)) { 347. PKCS7err(PKCS7_F_PKCS7_ENCRYPT,PKCS7_R_ERROR_SETTING_CIPHER); crypto/pkcs7/pk7_lib.c:143:1: start of procedure PKCS7_set_type() 141. } 142. 143. > int PKCS7_set_type(PKCS7 *p7, int type) 144. { 145. ASN1_OBJECT *obj; crypto/pkcs7/pk7_lib.c:147:2: Skipping PKCS7_content_free(): empty list of specs 145. ASN1_OBJECT *obj; 146. 147. PKCS7_content_free(p7); ^ 148. obj=OBJ_nid2obj(type); /* will not fail */ 149. crypto/pkcs7/pk7_lib.c:148:2: 146. 147. PKCS7_content_free(p7); 148. > obj=OBJ_nid2obj(type); /* will not fail */ 149. 150. switch (type) crypto/objects/obj_dat.c:262:1: start of procedure OBJ_nid2obj() 260. } 261. 262. > ASN1_OBJECT *OBJ_nid2obj(int n) 263. { 264. ADDED_OBJ ad,*adp; crypto/objects/obj_dat.c:267:7: Taking true branch 265. ASN1_OBJECT ob; 266. 267. if ((n >= 0) && (n < NUM_NID)) ^ 268. { 269. if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) crypto/objects/obj_dat.c:267:19: Taking true branch 265. ASN1_OBJECT ob; 266. 267. if ((n >= 0) && (n < NUM_NID)) ^ 268. { 269. if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) crypto/objects/obj_dat.c:269:8: Taking true branch 267. if ((n >= 0) && (n < NUM_NID)) 268. { 269. if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) ^ 270. { 271. OBJerr(OBJ_F_OBJ_NID2OBJ,OBJ_R_UNKNOWN_NID); crypto/objects/obj_dat.c:269:28: Taking true branch 267. if ((n >= 0) && (n < NUM_NID)) 268. { 269. if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) ^ 270. { 271. OBJerr(OBJ_F_OBJ_NID2OBJ,OBJ_R_UNKNOWN_NID); crypto/objects/obj_dat.c:271:4: 269. if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) 270. { 271. > OBJerr(OBJ_F_OBJ_NID2OBJ,OBJ_R_UNKNOWN_NID); 272. return(NULL); 273. } crypto/err/err.c:353:1: start of procedure ERR_put_error() 351. /********************************************************/ 352. 353. > void ERR_put_error(int lib, int func, int reason, const char *file, 354. int line) 355. { crypto/err/err.c:377:2: Skipping ERR_get_state(): empty list of specs 375. } 376. #endif 377. es=ERR_get_state(); ^ 378. 379. es->top=(es->top+1)%ERR_NUM_ERRORS; crypto/err/err.c:379:2: 377. es=ERR_get_state(); 378. 379. > es->top=(es->top+1)%ERR_NUM_ERRORS; 380. if (es->top == es->bottom) 381. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS; crypto/err/err.c:380:6: Taking false branch 378. 379. es->top=(es->top+1)%ERR_NUM_ERRORS; 380. if (es->top == es->bottom) ^ 381. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS; 382. es->err_buffer[es->top]=ERR_PACK(lib,func,reason); crypto/err/err.c:382:2: 380. if (es->top == es->bottom) 381. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS; 382. > es->err_buffer[es->top]=ERR_PACK(lib,func,reason); 383. es->err_file[es->top]=file; 384. es->err_line[es->top]=line; crypto/err/err.c:383:2: 381. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS; 382. es->err_buffer[es->top]=ERR_PACK(lib,func,reason); 383. > es->err_file[es->top]=file; 384. es->err_line[es->top]=line; 385. err_clear_data(es,es->top); crypto/err/err.c:384:2: 382. es->err_buffer[es->top]=ERR_PACK(lib,func,reason); 383. es->err_file[es->top]=file; 384. > es->err_line[es->top]=line; 385. err_clear_data(es,es->top); 386. } crypto/err/err.c:385:2: Taking true branch 383. es->err_file[es->top]=file; 384. es->err_line[es->top]=line; 385. err_clear_data(es,es->top); ^ 386. } 387. crypto/err/err.c:385:2: Taking false branch 383. es->err_file[es->top]=file; 384. es->err_line[es->top]=line; 385. err_clear_data(es,es->top); ^ 386. } 387. crypto/err/err.c:386:2: return from a call to ERR_put_error 384. es->err_line[es->top]=line; 385. err_clear_data(es,es->top); 386. } ^ 387. 388. void ERR_clear_error(void) crypto/objects/obj_dat.c:272:4: 270. { 271. OBJerr(OBJ_F_OBJ_NID2OBJ,OBJ_R_UNKNOWN_NID); 272. > return(NULL); 273. } 274. return((ASN1_OBJECT *)&(nid_objs[n])); crypto/objects/obj_dat.c:292:2: return from a call to OBJ_nid2obj 290. } 291. } 292. } ^ 293. 294. const char *OBJ_nid2sn(int n) crypto/pkcs7/pk7_lib.c:150:2: 148. obj=OBJ_nid2obj(type); /* will not fail */ 149. 150. > switch (type) 151. { 152. case NID_pkcs7_signed: crypto/pkcs7/pk7_lib.c:152:2: Switch condition is false. Skipping switch case 150. switch (type) 151. { 152. case NID_pkcs7_signed: ^ 153. p7->type=obj; 154. if ((p7->d.sign=PKCS7_SIGNED_new()) == NULL) crypto/pkcs7/pk7_lib.c:158:2: Switch condition is false. Skipping switch case 156. ASN1_INTEGER_set(p7->d.sign->version,1); 157. break; 158. case NID_pkcs7_data: ^ 159. p7->type=obj; 160. if ((p7->d.data=M_ASN1_OCTET_STRING_new()) == NULL) crypto/pkcs7/pk7_lib.c:163:2: Switch condition is false. Skipping switch case 161. goto err; 162. break; 163. case NID_pkcs7_signedAndEnveloped: ^ 164. p7->type=obj; 165. if ((p7->d.signed_and_enveloped=PKCS7_SIGN_ENVELOPE_new()) crypto/pkcs7/pk7_lib.c:169:2: Switch condition is true. Entering switch case 167. ASN1_INTEGER_set(p7->d.signed_and_enveloped->version,1); 168. break; 169. case NID_pkcs7_enveloped: ^ 170. p7->type=obj; 171. if ((p7->d.enveloped=PKCS7_ENVELOPE_new()) crypto/pkcs7/pk7_lib.c:170:3: 168. break; 169. case NID_pkcs7_enveloped: 170. > p7->type=obj; 171. if ((p7->d.enveloped=PKCS7_ENVELOPE_new()) 172. == NULL) goto err; crypto/pkcs7/pk7_lib.c:171:7: Taking true branch 169. case NID_pkcs7_enveloped: 170. p7->type=obj; 171. if ((p7->d.enveloped=PKCS7_ENVELOPE_new()) ^ 172. == NULL) goto err; 173. ASN1_INTEGER_set(p7->d.enveloped->version,0); crypto/pkcs7/pk7_lib.c:188:1: 186. } 187. return(1); 188. > err: 189. return(0); 190. } crypto/pkcs7/pk7_lib.c:189:2: 187. return(1); 188. err: 189. > return(0); 190. } 191. crypto/pkcs7/pk7_lib.c:190:2: return from a call to PKCS7_set_type 188. err: 189. return(0); 190. } ^ 191. 192. int PKCS7_add_signer(PKCS7 *p7, PKCS7_SIGNER_INFO *psi) crypto/pkcs7/pk7_smime.c:346:6: 344. 345. PKCS7_set_type(p7, NID_pkcs7_enveloped); 346. > if(!PKCS7_set_cipher(p7, cipher)) { 347. PKCS7err(PKCS7_F_PKCS7_ENCRYPT,PKCS7_R_ERROR_SETTING_CIPHER); 348. goto err; crypto/pkcs7/pk7_lib.c:438:1: start of procedure PKCS7_set_cipher() 436. } 437. 438. > int PKCS7_set_cipher(PKCS7 *p7, const EVP_CIPHER *cipher) 439. { 440. int i; crypto/pkcs7/pk7_lib.c:444:2: 442. PKCS7_ENC_CONTENT *ec; 443. 444. > i=OBJ_obj2nid(p7->type); 445. switch (i) 446. { crypto/objects/obj_dat.c:358:1: start of procedure OBJ_obj2nid() 356. } 357. 358. > int OBJ_obj2nid(ASN1_OBJECT *a) 359. { 360. ASN1_OBJECT **op; crypto/objects/obj_dat.c:363:6: Taking false branch 361. ADDED_OBJ ad,*adp; 362. 363. if (a == NULL) ^ 364. return(NID_undef); 365. if (a->nid != 0) crypto/objects/obj_dat.c:365:6: Taking true branch 363. if (a == NULL) 364. return(NID_undef); 365. if (a->nid != 0) ^ 366. return(a->nid); 367. crypto/objects/obj_dat.c:366:3: 364. return(NID_undef); 365. if (a->nid != 0) 366. > return(a->nid); 367. 368. if (added != NULL) crypto/objects/obj_dat.c:380:2: return from a call to OBJ_obj2nid 378. return(NID_undef); 379. return((*op)->nid); 380. } ^ 381. 382. /* Convert an object name into an ASN1_OBJECT crypto/pkcs7/pk7_lib.c:445:2: 443. 444. i=OBJ_obj2nid(p7->type); 445. > switch (i) 446. { 447. case NID_pkcs7_signedAndEnveloped: crypto/pkcs7/pk7_lib.c:447:2: Switch condition is false. Skipping switch case 445. switch (i) 446. { 447. case NID_pkcs7_signedAndEnveloped: ^ 448. ec=p7->d.signed_and_enveloped->enc_data; 449. break; crypto/pkcs7/pk7_lib.c:450:2: Switch condition is true. Entering switch case 448. ec=p7->d.signed_and_enveloped->enc_data; 449. break; 450. case NID_pkcs7_enveloped: ^ 451. ec=p7->d.enveloped->enc_data; 452. break; crypto/pkcs7/pk7_lib.c:451:3: 449. break; 450. case NID_pkcs7_enveloped: 451. > ec=p7->d.enveloped->enc_data; 452. break; 453. default:
https://github.com/openssl/openssl/blob/615513ba5294e03b451f33bc46c714c5efa28916/crypto/pkcs7/pk7_smime.c/#L346
d2a_code_trace_data_43389
static void qmf_32_subbands(DCAContext * s, int chans, float samples_in[32][8], float *samples_out, float scale, float bias) { const float *prCoeff; int i, j; DECLARE_ALIGNED_16(float, raXin[32]); int hist_index= s->hist_index[chans]; float *subband_fir_hist2 = s->subband_fir_noidea[chans]; int subindex; scale *= sqrt(1/8.0); if (!s->multirate_inter) prCoeff = fir_32bands_nonperfect; else prCoeff = fir_32bands_perfect; for (subindex = 0; subindex < 8; subindex++) { float *subband_fir_hist = s->subband_fir_hist[chans] + hist_index; for (i = 0; i < s->subband_activity[chans]; i++){ if((i-1)&2) raXin[i] = -samples_in[i][subindex]; else raXin[i] = samples_in[i][subindex]; } for (; i < 32; i++) raXin[i] = 0.0; ff_imdct_half(&s->imdct, subband_fir_hist, raXin); for (i = 0; i < 16; i++){ float a= subband_fir_hist2[i ]; float b= subband_fir_hist2[i+16]; float c= 0; float d= 0; for (j = 0; j < 512-hist_index; j += 64){ a += prCoeff[i+j ]*(-subband_fir_hist[15-i+j]); b += prCoeff[i+j+16]*( subband_fir_hist[ i+j]); c += prCoeff[i+j+32]*( subband_fir_hist[16+i+j]); d += prCoeff[i+j+48]*( subband_fir_hist[31-i+j]); } for ( ; j < 512; j += 64){ a += prCoeff[i+j ]*(-subband_fir_hist[15-i+j-512]); b += prCoeff[i+j+16]*( subband_fir_hist[ i+j-512]); c += prCoeff[i+j+32]*( subband_fir_hist[16+i+j-512]); d += prCoeff[i+j+48]*( subband_fir_hist[31-i+j-512]); } samples_out[i ] = a * scale + bias; samples_out[i+16] = b * scale + bias; subband_fir_hist2[i ] = c; subband_fir_hist2[i+16] = d; } samples_out+= 32; hist_index = (hist_index-32)&511; } s->hist_index[chans]= hist_index; } libavcodec/dca.c:1182: error: Buffer Overrun L2 Offset: [0, 14+max(5, `avctx->priv_data->prim_channels`)] (⇐ [0, -1+max(5, `avctx->priv_data->prim_channels`)] + [0, 15]) Size: 5 by call to `dca_decode_block`. libavcodec/dca.c:1137:1: Parameter `avctx->priv_data->prim_channels` 1135. * FIXME add arguments 1136. */ 1137. static int dca_decode_frame(AVCodecContext * avctx, ^ 1138. void *data, int *data_size, 1139. const uint8_t * buf, int buf_size) libavcodec/dca.c:1155:9: Call 1153. 1154. init_get_bits(&s->gb, s->dca_buffer, s->dca_buffer_size * 8); 1155. if (dca_parse_frame_header(s) < 0) { ^ 1156. //seems like the frame is corrupt, try with the next one 1157. *data_size=0; libavcodec/dca.c:226:1: Parameter `s->prim_channels` 224. } 225. 226. static int dca_parse_frame_header(DCAContext * s) ^ 227. { 228. int i, j; libavcodec/dca.c:1182:9: Call 1180. *data_size = 256 / 8 * s->sample_blocks * sizeof(int16_t) * channels; 1181. for (i = 0; i < (s->sample_blocks / 8); i++) { 1182. dca_decode_block(s); ^ 1183. s->dsp.float_to_int16_interleave(samples, s->samples_chanptr, 256, channels); 1184. samples += 256 * channels; libavcodec/dca.c:1049:1: Parameter `s->prim_channels` 1047. */ 1048. 1049. static int dca_decode_block(DCAContext * s) ^ 1050. { 1051. libavcodec/dca.c:1072:9: Call 1070. av_log(s->avctx, AV_LOG_DEBUG, "DSYNC dca_subsubframe\n"); 1071. #endif 1072. if (dca_subsubframe(s)) ^ 1073. return -1; 1074. libavcodec/dca.c:842:1: Parameter `s->prim_channels` 840. static const uint8_t abits_levels[7] = { 3, 5, 7, 9, 13, 17, 25 }; 841. 842. static int dca_subsubframe(DCAContext * s) ^ 843. { 844. int k, l; libavcodec/dca.c:986:10: Call 984. /* static float pcm_to_double[8] = 985. {32768.0, 32768.0, 524288.0, 524288.0, 0, 8388608.0, 8388608.0};*/ 986. qmf_32_subbands(s, k, subband_samples[k], &s->samples[256 * k], ^ 987. M_SQRT1_2 /*pcm_to_double[s->source_pcm_res] */ , 988. 0 /*s->bias */ ); libavcodec/dca.c:687:14: <Offset trace> 685. 686. /* Multiply by filter coefficients */ 687. for (i = 0; i < 16; i++){ ^ 688. float a= subband_fir_hist2[i ]; 689. float b= subband_fir_hist2[i+16]; libavcodec/dca.c:687:14: Assignment 685. 686. /* Multiply by filter coefficients */ 687. for (i = 0; i < 16; i++){ ^ 688. float a= subband_fir_hist2[i ]; 689. float b= subband_fir_hist2[i+16]; libavcodec/dca.c:652:1: <Length trace> 650. } 651. 652. static void qmf_32_subbands(DCAContext * s, int chans, ^ 653. float samples_in[32][8], float *samples_out, 654. float scale, float bias) libavcodec/dca.c:652:1: Parameter `chans` 650. } 651. 652. static void qmf_32_subbands(DCAContext * s, int chans, ^ 653. float samples_in[32][8], float *samples_out, 654. float scale, float bias) libavcodec/dca.c:661:5: Assignment 659. 660. int hist_index= s->hist_index[chans]; 661. float *subband_fir_hist2 = s->subband_fir_noidea[chans]; ^ 662. 663. int subindex; libavcodec/dca.c:688:22: Array access: Offset: [0, 14+max(5, avctx->priv_data->prim_channels)] (⇐ [0, -1+max(5, avctx->priv_data->prim_channels)] + [0, 15]) Size: 5 by call to `dca_decode_block` 686. /* Multiply by filter coefficients */ 687. for (i = 0; i < 16; i++){ 688. float a= subband_fir_hist2[i ]; ^ 689. float b= subband_fir_hist2[i+16]; 690. float c= 0;
https://github.com/libav/libav/blob/f0319383436e1abc3fc1464fe4e5f4dc40db3419/libavcodec/dca.c/#L688
d2a_code_trace_data_43390
void ff_draw_horiz_band(MpegEncContext *s, int y, int h){ const int field_pic= s->picture_structure != PICT_FRAME; if(field_pic){ h <<= 1; y <<= 1; } if (!s->avctx->hwaccel && !(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) && s->unrestricted_mv && s->current_picture.f.reference && !s->intra_only && !(s->flags&CODEC_FLAG_EMU_EDGE)) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); int sides = 0, edge_h; int hshift = desc->log2_chroma_w; int vshift = desc->log2_chroma_h; if (y==0) sides |= EDGE_TOP; if (y + h >= s->v_edge_pos) sides |= EDGE_BOTTOM; edge_h= FFMIN(h, s->v_edge_pos - y); s->dsp.draw_edges(s->current_picture_ptr->f.data[0] + y *s->linesize, s->linesize, s->h_edge_pos, edge_h, EDGE_WIDTH, EDGE_WIDTH, sides); s->dsp.draw_edges(s->current_picture_ptr->f.data[1] + (y>>vshift)*s->uvlinesize, s->uvlinesize, s->h_edge_pos>>hshift, edge_h>>vshift, EDGE_WIDTH>>hshift, EDGE_WIDTH>>vshift, sides); s->dsp.draw_edges(s->current_picture_ptr->f.data[2] + (y>>vshift)*s->uvlinesize, s->uvlinesize, s->h_edge_pos>>hshift, edge_h>>vshift, EDGE_WIDTH>>hshift, EDGE_WIDTH>>vshift, sides); } h= FFMIN(h, s->avctx->height - y); if(field_pic && s->first_field && !(s->avctx->slice_flags&SLICE_FLAG_ALLOW_FIELD)) return; if (s->avctx->draw_horiz_band) { AVFrame *src; int offset[AV_NUM_DATA_POINTERS]; int i; if(s->pict_type==AV_PICTURE_TYPE_B || s->low_delay || (s->avctx->slice_flags&SLICE_FLAG_CODED_ORDER)) src = &s->current_picture_ptr->f; else if(s->last_picture_ptr) src = &s->last_picture_ptr->f; else return; if(s->pict_type==AV_PICTURE_TYPE_B && s->picture_structure == PICT_FRAME && s->out_format != FMT_H264){ for (i = 0; i < AV_NUM_DATA_POINTERS; i++) offset[i] = 0; }else{ offset[0]= y * s->linesize; offset[1]= offset[2]= (y >> s->chroma_y_shift) * s->uvlinesize; for (i = 3; i < AV_NUM_DATA_POINTERS; i++) offset[i] = 0; } emms_c(); s->avctx->draw_horiz_band(s->avctx, src, offset, y, s->picture_structure, h); } } libavcodec/mpegvideo.c:2395: error: Null Dereference pointer `desc` last assigned on line 2393 could be null and is dereferenced at line 2395, column 22. libavcodec/mpegvideo.c:2380:1: start of procedure ff_draw_horiz_band() 2378. * @param h is the normal height, this will be reduced automatically if needed for the last row 2379. */ 2380. void ff_draw_horiz_band(MpegEncContext *s, int y, int h){ ^ 2381. const int field_pic= s->picture_structure != PICT_FRAME; 2382. if(field_pic){ libavcodec/mpegvideo.c:2381:26: Condition is true 2379. */ 2380. void ff_draw_horiz_band(MpegEncContext *s, int y, int h){ 2381. const int field_pic= s->picture_structure != PICT_FRAME; ^ 2382. if(field_pic){ 2383. h <<= 1; libavcodec/mpegvideo.c:2381:5: 2379. */ 2380. void ff_draw_horiz_band(MpegEncContext *s, int y, int h){ 2381. const int field_pic= s->picture_structure != PICT_FRAME; ^ 2382. if(field_pic){ 2383. h <<= 1; libavcodec/mpegvideo.c:2382:8: Taking true branch 2380. void ff_draw_horiz_band(MpegEncContext *s, int y, int h){ 2381. const int field_pic= s->picture_structure != PICT_FRAME; 2382. if(field_pic){ ^ 2383. h <<= 1; 2384. y <<= 1; libavcodec/mpegvideo.c:2383:9: 2381. const int field_pic= s->picture_structure != PICT_FRAME; 2382. if(field_pic){ 2383. h <<= 1; ^ 2384. y <<= 1; 2385. } libavcodec/mpegvideo.c:2384:9: 2382. if(field_pic){ 2383. h <<= 1; 2384. y <<= 1; ^ 2385. } 2386. libavcodec/mpegvideo.c:2387:10: Taking true branch 2385. } 2386. 2387. if (!s->avctx->hwaccel ^ 2388. && !(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) 2389. && s->unrestricted_mv libavcodec/mpegvideo.c:2388:13: Taking true branch 2386. 2387. if (!s->avctx->hwaccel 2388. && !(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) ^ 2389. && s->unrestricted_mv 2390. && s->current_picture.f.reference libavcodec/mpegvideo.c:2389:11: Taking true branch 2387. if (!s->avctx->hwaccel 2388. && !(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) 2389. && s->unrestricted_mv ^ 2390. && s->current_picture.f.reference 2391. && !s->intra_only libavcodec/mpegvideo.c:2390:11: Taking true branch 2388. && !(s->avctx->codec->capabilities&CODEC_CAP_HWACCEL_VDPAU) 2389. && s->unrestricted_mv 2390. && s->current_picture.f.reference ^ 2391. && !s->intra_only 2392. && !(s->flags&CODEC_FLAG_EMU_EDGE)) { libavcodec/mpegvideo.c:2391:12: Taking true branch 2389. && s->unrestricted_mv 2390. && s->current_picture.f.reference 2391. && !s->intra_only ^ 2392. && !(s->flags&CODEC_FLAG_EMU_EDGE)) { 2393. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); libavcodec/mpegvideo.c:2392:13: Taking true branch 2390. && s->current_picture.f.reference 2391. && !s->intra_only 2392. && !(s->flags&CODEC_FLAG_EMU_EDGE)) { ^ 2393. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); 2394. int sides = 0, edge_h; libavcodec/mpegvideo.c:2393:9: 2391. && !s->intra_only 2392. && !(s->flags&CODEC_FLAG_EMU_EDGE)) { 2393. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); ^ 2394. int sides = 0, edge_h; 2395. int hshift = desc->log2_chroma_w; libavutil/pixdesc.c:1434:1: start of procedure av_pix_fmt_desc_get() 1432. } 1433. 1434. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) ^ 1435. { 1436. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) libavutil/pixdesc.c:1436:9: Taking false branch 1434. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1435. { 1436. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1437. return NULL; 1438. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1436:24: Taking true branch 1434. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1435. { 1436. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1437. return NULL; 1438. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1437:9: 1435. { 1436. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) 1437. return NULL; ^ 1438. return &av_pix_fmt_descriptors[pix_fmt]; 1439. } libavutil/pixdesc.c:1439:1: return from a call to av_pix_fmt_desc_get 1437. return NULL; 1438. return &av_pix_fmt_descriptors[pix_fmt]; 1439. } ^ 1440. 1441. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) libavcodec/mpegvideo.c:2394:9: 2392. && !(s->flags&CODEC_FLAG_EMU_EDGE)) { 2393. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); 2394. int sides = 0, edge_h; ^ 2395. int hshift = desc->log2_chroma_w; 2396. int vshift = desc->log2_chroma_h; libavcodec/mpegvideo.c:2395:9: 2393. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); 2394. int sides = 0, edge_h; 2395. int hshift = desc->log2_chroma_w; ^ 2396. int vshift = desc->log2_chroma_h; 2397. if (y==0) sides |= EDGE_TOP;
https://github.com/libav/libav/blob/45635885e44cb7adce35ac19279d48c1ef6c4779/libavcodec/mpegvideo.c/#L2395
d2a_code_trace_data_43391
static inline void mc_dir_part(AVSContext *h, AVFrame *pic, int chroma_height,int delta,int list,uint8_t *dest_y, uint8_t *dest_cb,uint8_t *dest_cr,int src_x_offset, int src_y_offset,qpel_mc_func *qpix_op, h264_chroma_mc_func chroma_op,cavs_vector *mv) { const int mx= mv->x + src_x_offset*8; const int my= mv->y + src_y_offset*8; const int luma_xy= (mx&3) + ((my&3)<<2); uint8_t * src_y = pic->data[0] + (mx >> 2) + (my >> 2) * h->l_stride; uint8_t * src_cb = pic->data[1] + (mx >> 3) + (my >> 3) * h->c_stride; uint8_t * src_cr = pic->data[2] + (mx >> 3) + (my >> 3) * h->c_stride; int extra_width = 0; int extra_height= extra_width; int emu=0; const int full_mx= mx>>2; const int full_my= my>>2; const int pic_width = 16*h->mb_width; const int pic_height = 16*h->mb_height; if (!pic->data[0]) return; if(mx&7) extra_width -= 3; if(my&7) extra_height -= 3; if( full_mx < 0-extra_width || full_my < 0-extra_height || full_mx + 16 > pic_width + extra_width || full_my + 16 > pic_height + extra_height){ h->vdsp.emulated_edge_mc(h->edge_emu_buffer, src_y - 2 - 2*h->l_stride, h->l_stride, 16+5, 16+5 , full_mx-2, full_my-2, pic_width, pic_height); src_y= h->edge_emu_buffer + 2 + 2*h->l_stride; emu=1; } qpix_op[luma_xy](dest_y, src_y, h->l_stride); if(emu){ h->vdsp.emulated_edge_mc(h->edge_emu_buffer, src_cb, h->c_stride, 9, 9 , (mx>>3), (my>>3), pic_width>>1, pic_height>>1); src_cb= h->edge_emu_buffer; } chroma_op(dest_cb, src_cb, h->c_stride, chroma_height, mx&7, my&7); if(emu){ h->vdsp.emulated_edge_mc(h->edge_emu_buffer, src_cr, h->c_stride, 9, 9 , (mx>>3), (my>>3), pic_width>>1, pic_height>>1); src_cr= h->edge_emu_buffer; } chroma_op(dest_cr, src_cr, h->c_stride, chroma_height, mx&7, my&7); } libavcodec/cavs.c:471: error: Buffer Overrun L2 Offset: [1, 16] (⇐ 1 + [0, 15]) Size: 2 by call to `mc_part_std`. libavcodec/cavs.c:463:1: Parameter `h->cdsp.put_cavs_qpel_pixels_tab[*]` 461. } 462. 463. void ff_cavs_inter(AVSContext *h, enum cavs_mb mb_type) { ^ 464. if(ff_cavs_partition_flags[mb_type] == 0){ // 16x16 465. mc_part_std(h, 8, 0, h->cy, h->cu, h->cv, 0, 0, libavcodec/cavs.c:471:9: Call 469. h->dsp.avg_h264_chroma_pixels_tab[0],&h->mv[MV_FWD_X0]); 470. }else{ 471. mc_part_std(h, 4, 0, h->cy, h->cu, h->cv, 0, 0, ^ 472. h->cdsp.put_cavs_qpel_pixels_tab[1], 473. h->dsp.put_h264_chroma_pixels_tab[1], libavcodec/cavs.c:430:1: Parameter `*qpix_put` 428. } 429. 430. static inline void mc_part_std(AVSContext *h,int chroma_height,int delta, ^ 431. uint8_t *dest_y,uint8_t *dest_cb,uint8_t *dest_cr, 432. int x_offset, int y_offset,qpel_mc_func *qpix_put, libavcodec/cavs.c:436:5: Assignment 434. h264_chroma_mc_func chroma_avg, cavs_vector *mv) 435. { 436. qpel_mc_func *qpix_op= qpix_put; ^ 437. h264_chroma_mc_func chroma_op= chroma_put; 438. libavcodec/cavs.c:447:9: Call 445. if(mv->ref >= 0){ 446. AVFrame *ref = h->DPB[mv->ref].f; 447. mc_dir_part(h, ref, chroma_height, delta, 0, ^ 448. dest_y, dest_cb, dest_cr, x_offset, y_offset, 449. qpix_op, chroma_op, mv); libavcodec/cavs.c:378:1: <Offset trace> 376. ****************************************************************************/ 377. 378. static inline void mc_dir_part(AVSContext *h, AVFrame *pic, ^ 379. int chroma_height,int delta,int list,uint8_t *dest_y, 380. uint8_t *dest_cb,uint8_t *dest_cr,int src_x_offset, libavcodec/cavs.c:378:1: Parameter `src_x_offset` 376. ****************************************************************************/ 377. 378. static inline void mc_dir_part(AVSContext *h, AVFrame *pic, ^ 379. int chroma_height,int delta,int list,uint8_t *dest_y, 380. uint8_t *dest_cb,uint8_t *dest_cr,int src_x_offset, libavcodec/cavs.c:384:5: Assignment 382. h264_chroma_mc_func chroma_op,cavs_vector *mv) 383. { 384. const int mx= mv->x + src_x_offset*8; ^ 385. const int my= mv->y + src_y_offset*8; 386. const int luma_xy= (mx&3) + ((my&3)<<2); libavcodec/cavs.c:386:5: Assignment 384. const int mx= mv->x + src_x_offset*8; 385. const int my= mv->y + src_y_offset*8; 386. const int luma_xy= (mx&3) + ((my&3)<<2); ^ 387. uint8_t * src_y = pic->data[0] + (mx >> 2) + (my >> 2) * h->l_stride; 388. uint8_t * src_cb = pic->data[1] + (mx >> 3) + (my >> 3) * h->c_stride; libavcodec/cavs.c:378:1: <Length trace> 376. ****************************************************************************/ 377. 378. static inline void mc_dir_part(AVSContext *h, AVFrame *pic, ^ 379. int chroma_height,int delta,int list,uint8_t *dest_y, 380. uint8_t *dest_cb,uint8_t *dest_cr,int src_x_offset, libavcodec/cavs.c:378:1: Parameter `*qpix_op` 376. ****************************************************************************/ 377. 378. static inline void mc_dir_part(AVSContext *h, AVFrame *pic, ^ 379. int chroma_height,int delta,int list,uint8_t *dest_y, 380. uint8_t *dest_cb,uint8_t *dest_cr,int src_x_offset, libavcodec/cavs.c:413:5: Array access: Offset: [1, 16] (⇐ 1 + [0, 15]) Size: 2 by call to `mc_part_std` 411. } 412. 413. qpix_op[luma_xy](dest_y, src_y, h->l_stride); //FIXME try variable height perhaps? ^ 414. 415. if(emu){
https://github.com/libav/libav/blob/c76daa89ab91ebbd9e29d289d207bf88213255ae/libavcodec/cavs.c/#L413
d2a_code_trace_data_43392
static int seq_parse_frame_data(SeqDemuxContext *seq, ByteIOContext *pb) { unsigned int offset_table[4], buffer_num[4]; TiertexSeqFrameBuffer *seq_buffer; int i, e, err; seq->current_frame_offs += SEQ_FRAME_SIZE; url_fseek(pb, seq->current_frame_offs, SEEK_SET); seq->current_audio_data_offs = get_le16(pb); if (seq->current_audio_data_offs != 0) { seq->current_audio_data_size = SEQ_AUDIO_BUFFER_SIZE * 2; } else { seq->current_audio_data_size = 0; } seq->current_pal_data_offs = get_le16(pb); if (seq->current_pal_data_offs != 0) { seq->current_pal_data_size = 768; } else { seq->current_pal_data_size = 0; } for (i = 0; i < 4; i++) buffer_num[i] = get_byte(pb); for (i = 0; i < 4; i++) offset_table[i] = get_le16(pb); for (i = 0; i < 3; i++) { if (offset_table[i] != 0) { for (e = i + 1; e < 4 && offset_table[e] == 0; e++); err = seq_fill_buffer(seq, pb, buffer_num[1 + i], offset_table[i], offset_table[e] - offset_table[i]); if (err != 0) return err; } } if (buffer_num[0] != 255) { if (buffer_num[0] >= SEQ_NUM_FRAME_BUFFERS) return AVERROR_INVALIDDATA; seq_buffer = &seq->frame_buffers[buffer_num[0]]; seq->current_video_data_size = seq_buffer->fill_size; seq->current_video_data_ptr = seq_buffer->data; seq_buffer->fill_size = 0; } else { seq->current_video_data_size = 0; seq->current_video_data_ptr = 0; } return 0; } libavformat/tiertexseq.c:161: error: Buffer Overrun L2 Offset: [1, 4] Size: 4. libavformat/tiertexseq.c:156:10: <Offset trace> 154. offset_table[i] = get_le16(pb); 155. 156. for (i = 0; i < 3; i++) { ^ 157. if (offset_table[i] != 0) { 158. for (e = i + 1; e < 4 && offset_table[e] == 0; e++); libavformat/tiertexseq.c:156:10: Assignment 154. offset_table[i] = get_le16(pb); 155. 156. for (i = 0; i < 3; i++) { ^ 157. if (offset_table[i] != 0) { 158. for (e = i + 1; e < 4 && offset_table[e] == 0; e++); libavformat/tiertexseq.c:158:18: Assignment 156. for (i = 0; i < 3; i++) { 157. if (offset_table[i] != 0) { 158. for (e = i + 1; e < 4 && offset_table[e] == 0; e++); ^ 159. err = seq_fill_buffer(seq, pb, buffer_num[1 + i], 160. offset_table[i], libavformat/tiertexseq.c:124:1: <Length trace> 122. } 123. 124. static int seq_parse_frame_data(SeqDemuxContext *seq, ByteIOContext *pb) ^ 125. { 126. unsigned int offset_table[4], buffer_num[4]; libavformat/tiertexseq.c:124:1: Array declaration 122. } 123. 124. static int seq_parse_frame_data(SeqDemuxContext *seq, ByteIOContext *pb) ^ 125. { 126. unsigned int offset_table[4], buffer_num[4]; libavformat/tiertexseq.c:161:15: Array access: Offset: [1, 4] Size: 4 159. err = seq_fill_buffer(seq, pb, buffer_num[1 + i], 160. offset_table[i], 161. offset_table[e] - offset_table[i]); ^ 162. if (err != 0) 163. return err;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/tiertexseq.c/#L161
d2a_code_trace_data_43393
size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len) { unsigned int M = (ctx->nonce.c[0] >> 3) & 7; M *= 2; M += 2; if (len < M) return 0; memcpy(tag, ctx->cmac.c, M); return M; } crypto/evp/e_aes.c:2178: error: BUFFER_OVERRUN_L3 Offset added: [2, 16] Size: [0, +oo] by call to `CRYPTO_ccm128_tag`. Showing all 6 steps of the trace crypto/evp/e_aes.c:2178:17: Call 2176. !CRYPTO_ccm128_decrypt(ccm, in, out, len)) { 2177. unsigned char tag[16]; 2178. if (CRYPTO_ccm128_tag(ccm, tag, cctx->M)) { ^ 2179. if (!CRYPTO_memcmp(tag, EVP_CIPHER_CTX_buf_noconst(ctx), 2180. cctx->M)) crypto/modes/ccm128.c:469:1: <Offset trace> 467. } 468. 469. > size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len) 470. { 471. unsigned int M = (ctx->nonce.c[0] >> 3) & 7; /* the M parameter */ crypto/modes/ccm128.c:469:1: Parameter `len` 467. } 468. 469. > size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len) 470. { 471. unsigned int M = (ctx->nonce.c[0] >> 3) & 7; /* the M parameter */ crypto/modes/ccm128.c:469:1: <Length trace> 467. } 468. 469. > size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len) 470. { 471. unsigned int M = (ctx->nonce.c[0] >> 3) & 7; /* the M parameter */ crypto/modes/ccm128.c:469:1: Parameter `ctx->cmac.c[*]` 467. } 468. 469. > size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len) 470. { 471. unsigned int M = (ctx->nonce.c[0] >> 3) & 7; /* the M parameter */ crypto/modes/ccm128.c:477:5: Array access: Offset added: [2, 16] Size: [0, +oo] by call to `CRYPTO_ccm128_tag` 475. if (len < M) 476. return 0; 477. memcpy(tag, ctx->cmac.c, M); ^ 478. return M; 479. }
https://github.com/openssl/openssl/blob/ac33c5a477568127ad99b1260a8978477de50e36/crypto/modes/ccm128.c/#L477
d2a_code_trace_data_43394
static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, int motion_y, int mb_block_height, int mb_block_count) { int16_t weight[8][64]; DCTELEM orig[8][64]; const int mb_x= s->mb_x; const int mb_y= s->mb_y; int i; int skip_dct[8]; int dct_offset = s->linesize*8; uint8_t *ptr_y, *ptr_cb, *ptr_cr; int wrap_y, wrap_c; for(i=0; i<mb_block_count; i++) skip_dct[i]=s->skipdct; if(s->adaptive_quant){ const int last_qp= s->qscale; const int mb_xy= mb_x + mb_y*s->mb_stride; s->lambda= s->lambda_table[mb_xy]; update_qscale(s); if(!(s->flags&CODEC_FLAG_QP_RD)){ s->qscale= s->current_picture_ptr->qscale_table[mb_xy]; s->dquant= s->qscale - last_qp; if(s->out_format==FMT_H263){ s->dquant= av_clip(s->dquant, -2, 2); if(s->codec_id==CODEC_ID_MPEG4){ if(!s->mb_intra){ if(s->pict_type == FF_B_TYPE){ if(s->dquant&1 || s->mv_dir&MV_DIRECT) s->dquant= 0; } if(s->mv_type==MV_TYPE_8X8) s->dquant=0; } } } } ff_set_qscale(s, last_qp + s->dquant); }else if(s->flags&CODEC_FLAG_QP_RD) ff_set_qscale(s, s->qscale + s->dquant); wrap_y = s->linesize; wrap_c = s->uvlinesize; ptr_y = s->new_picture.data[0] + (mb_y * 16 * wrap_y) + mb_x * 16; ptr_cb = s->new_picture.data[1] + (mb_y * mb_block_height * wrap_c) + mb_x * 8; ptr_cr = s->new_picture.data[2] + (mb_y * mb_block_height * wrap_c) + mb_x * 8; if(mb_x*16+16 > s->width || mb_y*16+16 > s->height){ uint8_t *ebuf= s->edge_emu_buffer + 32; ff_emulated_edge_mc(ebuf , ptr_y , wrap_y,16,16,mb_x*16,mb_y*16, s->width , s->height); ptr_y= ebuf; ff_emulated_edge_mc(ebuf+18*wrap_y , ptr_cb, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1); ptr_cb= ebuf+18*wrap_y; ff_emulated_edge_mc(ebuf+18*wrap_y+8, ptr_cr, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1); ptr_cr= ebuf+18*wrap_y+8; } if (s->mb_intra) { if(s->flags&CODEC_FLAG_INTERLACED_DCT){ int progressive_score, interlaced_score; s->interlaced_dct=0; progressive_score= s->dsp.ildct_cmp[4](s, ptr_y , NULL, wrap_y, 8) +s->dsp.ildct_cmp[4](s, ptr_y + wrap_y*8, NULL, wrap_y, 8) - 400; if(progressive_score > 0){ interlaced_score = s->dsp.ildct_cmp[4](s, ptr_y , NULL, wrap_y*2, 8) +s->dsp.ildct_cmp[4](s, ptr_y + wrap_y , NULL, wrap_y*2, 8); if(progressive_score > interlaced_score){ s->interlaced_dct=1; dct_offset= wrap_y; wrap_y<<=1; if (s->chroma_format == CHROMA_422) wrap_c<<=1; } } } s->dsp.get_pixels(s->block[0], ptr_y , wrap_y); s->dsp.get_pixels(s->block[1], ptr_y + 8, wrap_y); s->dsp.get_pixels(s->block[2], ptr_y + dct_offset , wrap_y); s->dsp.get_pixels(s->block[3], ptr_y + dct_offset + 8, wrap_y); if(s->flags&CODEC_FLAG_GRAY){ skip_dct[4]= 1; skip_dct[5]= 1; }else{ s->dsp.get_pixels(s->block[4], ptr_cb, wrap_c); s->dsp.get_pixels(s->block[5], ptr_cr, wrap_c); if(!s->chroma_y_shift){ s->dsp.get_pixels(s->block[6], ptr_cb + (dct_offset>>1), wrap_c); s->dsp.get_pixels(s->block[7], ptr_cr + (dct_offset>>1), wrap_c); } } }else{ op_pixels_func (*op_pix)[4]; qpel_mc_func (*op_qpix)[16]; uint8_t *dest_y, *dest_cb, *dest_cr; dest_y = s->dest[0]; dest_cb = s->dest[1]; dest_cr = s->dest[2]; if ((!s->no_rounding) || s->pict_type==FF_B_TYPE){ op_pix = s->dsp.put_pixels_tab; op_qpix= s->dsp.put_qpel_pixels_tab; }else{ op_pix = s->dsp.put_no_rnd_pixels_tab; op_qpix= s->dsp.put_no_rnd_qpel_pixels_tab; } if (s->mv_dir & MV_DIR_FORWARD) { MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.data, op_pix, op_qpix); op_pix = s->dsp.avg_pixels_tab; op_qpix= s->dsp.avg_qpel_pixels_tab; } if (s->mv_dir & MV_DIR_BACKWARD) { MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.data, op_pix, op_qpix); } if(s->flags&CODEC_FLAG_INTERLACED_DCT){ int progressive_score, interlaced_score; s->interlaced_dct=0; progressive_score= s->dsp.ildct_cmp[0](s, dest_y , ptr_y , wrap_y, 8) +s->dsp.ildct_cmp[0](s, dest_y + wrap_y*8, ptr_y + wrap_y*8, wrap_y, 8) - 400; if(s->avctx->ildct_cmp == FF_CMP_VSSE) progressive_score -= 400; if(progressive_score>0){ interlaced_score = s->dsp.ildct_cmp[0](s, dest_y , ptr_y , wrap_y*2, 8) +s->dsp.ildct_cmp[0](s, dest_y + wrap_y , ptr_y + wrap_y , wrap_y*2, 8); if(progressive_score > interlaced_score){ s->interlaced_dct=1; dct_offset= wrap_y; wrap_y<<=1; if (s->chroma_format == CHROMA_422) wrap_c<<=1; } } } s->dsp.diff_pixels(s->block[0], ptr_y , dest_y , wrap_y); s->dsp.diff_pixels(s->block[1], ptr_y + 8, dest_y + 8, wrap_y); s->dsp.diff_pixels(s->block[2], ptr_y + dct_offset , dest_y + dct_offset , wrap_y); s->dsp.diff_pixels(s->block[3], ptr_y + dct_offset + 8, dest_y + dct_offset + 8, wrap_y); if(s->flags&CODEC_FLAG_GRAY){ skip_dct[4]= 1; skip_dct[5]= 1; }else{ s->dsp.diff_pixels(s->block[4], ptr_cb, dest_cb, wrap_c); s->dsp.diff_pixels(s->block[5], ptr_cr, dest_cr, wrap_c); if(!s->chroma_y_shift){ s->dsp.diff_pixels(s->block[6], ptr_cb + (dct_offset>>1), dest_cb + (dct_offset>>1), wrap_c); s->dsp.diff_pixels(s->block[7], ptr_cr + (dct_offset>>1), dest_cr + (dct_offset>>1), wrap_c); } } if(s->current_picture.mc_mb_var[s->mb_stride*mb_y+ mb_x]<2*s->qscale*s->qscale){ if(s->dsp.sad[1](NULL, ptr_y , dest_y , wrap_y, 8) < 20*s->qscale) skip_dct[0]= 1; if(s->dsp.sad[1](NULL, ptr_y + 8, dest_y + 8, wrap_y, 8) < 20*s->qscale) skip_dct[1]= 1; if(s->dsp.sad[1](NULL, ptr_y +dct_offset , dest_y +dct_offset , wrap_y, 8) < 20*s->qscale) skip_dct[2]= 1; if(s->dsp.sad[1](NULL, ptr_y +dct_offset+ 8, dest_y +dct_offset+ 8, wrap_y, 8) < 20*s->qscale) skip_dct[3]= 1; if(s->dsp.sad[1](NULL, ptr_cb , dest_cb , wrap_c, 8) < 20*s->qscale) skip_dct[4]= 1; if(s->dsp.sad[1](NULL, ptr_cr , dest_cr , wrap_c, 8) < 20*s->qscale) skip_dct[5]= 1; if(!s->chroma_y_shift){ if(s->dsp.sad[1](NULL, ptr_cb +(dct_offset>>1), dest_cb +(dct_offset>>1), wrap_c, 8) < 20*s->qscale) skip_dct[6]= 1; if(s->dsp.sad[1](NULL, ptr_cr +(dct_offset>>1), dest_cr +(dct_offset>>1), wrap_c, 8) < 20*s->qscale) skip_dct[7]= 1; } } } if(s->avctx->quantizer_noise_shaping){ if(!skip_dct[0]) get_visual_weight(weight[0], ptr_y , wrap_y); if(!skip_dct[1]) get_visual_weight(weight[1], ptr_y + 8, wrap_y); if(!skip_dct[2]) get_visual_weight(weight[2], ptr_y + dct_offset , wrap_y); if(!skip_dct[3]) get_visual_weight(weight[3], ptr_y + dct_offset + 8, wrap_y); if(!skip_dct[4]) get_visual_weight(weight[4], ptr_cb , wrap_c); if(!skip_dct[5]) get_visual_weight(weight[5], ptr_cr , wrap_c); if(!s->chroma_y_shift){ if(!skip_dct[6]) get_visual_weight(weight[6], ptr_cb + (dct_offset>>1), wrap_c); if(!skip_dct[7]) get_visual_weight(weight[7], ptr_cr + (dct_offset>>1), wrap_c); } memcpy(orig[0], s->block[0], sizeof(DCTELEM)*64*mb_block_count); } assert(s->out_format!=FMT_MJPEG || s->qscale==8); { for(i=0;i<mb_block_count;i++) { if(!skip_dct[i]){ int overflow; s->block_last_index[i] = s->dct_quantize(s, s->block[i], i, s->qscale, &overflow); if (overflow) clip_coeffs(s, s->block[i], s->block_last_index[i]); }else s->block_last_index[i]= -1; } if(s->avctx->quantizer_noise_shaping){ for(i=0;i<mb_block_count;i++) { if(!skip_dct[i]){ s->block_last_index[i] = dct_quantize_refine(s, s->block[i], weight[i], orig[i], i, s->qscale); } } } if(s->luma_elim_threshold && !s->mb_intra) for(i=0; i<4; i++) dct_single_coeff_elimination(s, i, s->luma_elim_threshold); if(s->chroma_elim_threshold && !s->mb_intra) for(i=4; i<mb_block_count; i++) dct_single_coeff_elimination(s, i, s->chroma_elim_threshold); if(s->flags & CODEC_FLAG_CBP_RD){ for(i=0;i<mb_block_count;i++) { if(s->block_last_index[i] == -1) s->coded_score[i]= INT_MAX/256; } } } if((s->flags&CODEC_FLAG_GRAY) && s->mb_intra){ s->block_last_index[4]= s->block_last_index[5]= 0; s->block[4][0]= s->block[5][0]= (1024 + s->c_dc_scale/2)/ s->c_dc_scale; } if(s->alternate_scan && s->dct_quantize != dct_quantize_c){ for(i=0; i<mb_block_count; i++){ int j; if(s->block_last_index[i]>0){ for(j=63; j>0; j--){ if(s->block[i][ s->intra_scantable.permutated[j] ]) break; } s->block_last_index[i]= j; } } } switch(s->codec_id){ case CODEC_ID_MPEG1VIDEO: case CODEC_ID_MPEG2VIDEO: if (ENABLE_MPEG1VIDEO_ENCODER || ENABLE_MPEG2VIDEO_ENCODER) mpeg1_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_MPEG4: if (ENABLE_MPEG4_ENCODER) mpeg4_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_MSMPEG4V2: case CODEC_ID_MSMPEG4V3: case CODEC_ID_WMV1: if (ENABLE_MSMPEG4_ENCODER) msmpeg4_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_WMV2: if (ENABLE_WMV2_ENCODER) ff_wmv2_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_H261: if (ENABLE_H261_ENCODER) ff_h261_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_H263: case CODEC_ID_H263P: case CODEC_ID_FLV1: case CODEC_ID_RV10: case CODEC_ID_RV20: if (ENABLE_H263_ENCODER || ENABLE_H263P_ENCODER || ENABLE_FLV_ENCODER || ENABLE_RV10_ENCODER || ENABLE_RV20_ENCODER) h263_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_MJPEG: if (ENABLE_MJPEG_ENCODER) ff_mjpeg_encode_mb(s, s->block); break; default: assert(0); } } libavcodec/mpegvideo_enc.c:1655: error: Uninitialized Value The value read from skip_dct[_] was never initialized. libavcodec/mpegvideo_enc.c:1655:17: 1653. { 1654. for(i=0;i<mb_block_count;i++) { 1655. if(!skip_dct[i]){ ^ 1656. int overflow; 1657. s->block_last_index[i] = s->dct_quantize(s, s->block[i], i, s->qscale, &overflow);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo_enc.c/#L1655
d2a_code_trace_data_43395
static char * ngx_http_geo_add_range(ngx_conf_t *cf, ngx_http_geo_conf_ctx_t *ctx, in_addr_t start, in_addr_t end) { in_addr_t n; ngx_uint_t h, i, s, e; ngx_array_t *a; ngx_http_geo_range_t *range; for (n = start; n <= end; n += 0x10000) { h = n >> 16; if (n == start) { s = n & 0xffff; } else { s = 0; } if ((n | 0xffff) > end) { e = end & 0xffff; } else { e = 0xffff; } a = (ngx_array_t *) ctx->high->low[h].ranges; if (a == NULL) { a = ngx_array_create(ctx->temp_pool, 64, sizeof(ngx_http_geo_range_t)); if (a == NULL) { return NGX_CONF_ERROR; } ctx->high->low[h].ranges = (ngx_http_geo_range_t *) a; } i = a->nelts; range = a->elts; while (i) { i--; if (e < (ngx_uint_t) range[i].start) { continue; } if (s > (ngx_uint_t) range[i].end) { range = ngx_array_push(a); if (range == NULL) { return NGX_CONF_ERROR; } range = a->elts; ngx_memcpy(&range[i + 2], &range[i + 1], (a->nelts - 2 - i) * sizeof(ngx_http_geo_range_t)); range[i + 1].start = (u_short) s; range[i + 1].end = (u_short) e; range[i + 1].value = ctx->value; goto next; } if (s == (ngx_uint_t) range[i].start && e == (ngx_uint_t) range[i].end) { ngx_conf_log_error(NGX_LOG_WARN, cf, 0, "duplicate range \"%V\", value: \"%v\", old value: \"%v\"", ctx->net, ctx->value, range[i].value); range[i].value = ctx->value; goto next; } if (s > (ngx_uint_t) range[i].start && e < (ngx_uint_t) range[i].end) { range = ngx_array_push(a); if (range == NULL) { return NGX_CONF_ERROR; } range = ngx_array_push(a); if (range == NULL) { return NGX_CONF_ERROR; } range = a->elts; ngx_memcpy(&range[i + 3], &range[i + 1], (a->nelts - 3 - i) * sizeof(ngx_http_geo_range_t)); range[i + 2].start = (u_short) (e + 1); range[i + 2].end = range[i].end; range[i + 2].value = range[i].value; range[i + 1].start = (u_short) s; range[i + 1].end = (u_short) e; range[i + 1].value = ctx->value; range[i].end = (u_short) (s - 1); goto next; } if (s == (ngx_uint_t) range[i].start && e < (ngx_uint_t) range[i].end) { range = ngx_array_push(a); if (range == NULL) { return NGX_CONF_ERROR; } range = a->elts; ngx_memcpy(&range[i + 1], &range[i], (a->nelts - 1 - i) * sizeof(ngx_http_geo_range_t)); range[i + 1].start = (u_short) (e + 1); range[i].start = (u_short) s; range[i].end = (u_short) e; range[i].value = ctx->value; goto next; } if (s > (ngx_uint_t) range[i].start && e == (ngx_uint_t) range[i].end) { range = ngx_array_push(a); if (range == NULL) { return NGX_CONF_ERROR; } range = a->elts; ngx_memcpy(&range[i + 2], &range[i + 1], (a->nelts - 2 - i) * sizeof(ngx_http_geo_range_t)); range[i + 1].start = (u_short) s; range[i + 1].end = (u_short) e; range[i + 1].value = ctx->value; range[i].end = (u_short) (s - 1); goto next; } s = (ngx_uint_t) range[i].start; e = (ngx_uint_t) range[i].end; ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "range \"%V\" overlaps \"%d.%d.%d.%d-%d.%d.%d.%d\"", ctx->net, h >> 8, h & 0xff, s >> 8, s & 0xff, h >> 8, h & 0xff, e >> 8, e & 0xff); return NGX_CONF_ERROR; } range = ngx_array_push(a); if (range == NULL) { return NGX_CONF_ERROR; } range->start = (u_short) s; range->end = (u_short) e; range->value = ctx->value; next: continue; } return NGX_CONF_OK; } src/http/modules/ngx_http_geo_module.c:643: error: Integer Overflow L2 ([0, +oo] - 1):unsigned64. src/http/modules/ngx_http_geo_module.c:545:17: <LHS trace> 543. 544. if (a == NULL) { 545. a = ngx_array_create(ctx->temp_pool, 64, ^ 546. sizeof(ngx_http_geo_range_t)); 547. if (a == NULL) { src/http/modules/ngx_http_geo_module.c:545:17: Call 543. 544. if (a == NULL) { 545. a = ngx_array_create(ctx->temp_pool, 64, ^ 546. sizeof(ngx_http_geo_range_t)); 547. if (a == NULL) { src/core/ngx_array.c:26:5: Assignment 24. } 25. 26. a->nelts = 0; ^ 27. a->size = size; 28. a->nalloc = n; src/http/modules/ngx_http_geo_module.c:643:17: Binary operation: ([0, +oo] - 1):unsigned64 641. range = a->elts; 642. 643. ngx_memcpy(&range[i + 1], &range[i], ^ 644. (a->nelts - 1 - i) * sizeof(ngx_http_geo_range_t)); 645.
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/http/modules/ngx_http_geo_module.c/#L643
d2a_code_trace_data_43396
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/mpc8.c:129: error: Integer Overflow L2 ([1, +oo] - 5):unsigned32 by call to `bitstream_read`. libavcodec/mpc8.c:129:19: Call 127. 128. bitstream_skip(&bc, 3); // sample rate 129. c->maxbands = bitstream_read(&bc, 5) + 1; ^ 130. channels = bitstream_read(&bc, 4) + 1; 131. if (channels > 2) { libavcodec/bitstream.h:183:1: Parameter `n` 181. 182. /* Return n bits from the buffer. n has to be in the 0-32 range. */ 183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n) ^ 184. { 185. if (!n) libavcodec/bitstream.h:194:12: Call 192. } 193. 194. return get_val(bc, n); ^ 195. } 196. 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: ([1, +oo] - 5):unsigned32 by call to `bitstream_read` 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_43397
int BN_hex2bn(BIGNUM **bn, const char *a) { BIGNUM *ret = NULL; BN_ULONG l = 0; int neg = 0, h, m, i, j, k, c; int num; if ((a == NULL) || (*a == '\0')) return (0); if (*a == '-') { neg = 1; a++; } for (i = 0; i <= (INT_MAX/4) && isxdigit((unsigned char)a[i]); i++) continue; if (i == 0 || i > INT_MAX/4) goto err; num = i + neg; if (bn == NULL) return (num); if (*bn == NULL) { if ((ret = BN_new()) == NULL) return (0); } else { ret = *bn; BN_zero(ret); } if (bn_expand(ret, i * 4) == NULL) goto err; j = i; m = 0; h = 0; while (j > 0) { m = ((BN_BYTES * 2) <= j) ? (BN_BYTES * 2) : j; l = 0; for (;;) { c = a[j - m]; k = OPENSSL_hexchar2int(c); if (k < 0) k = 0; l = (l << 4) | k; if (--m <= 0) { ret->d[h++] = l; break; } } j -= (BN_BYTES * 2); } ret->top = h; bn_correct_top(ret); *bn = ret; bn_check_top(ret); if (ret->top != 0) ret->neg = neg; return (num); err: if (*bn == NULL) BN_free(ret); return (0); } test/bntest.c:1639: error: BUFFER_OVERRUN_L2 Offset: [2, 536870915] (⇐ [2, 4] + [0, 536870911]) Size: 7 by call to `BN_asc2bn`. Showing all 9 steps of the trace test/bntest.c:1639:10: Call 1637. } 1638. 1639. if (!BN_asc2bn(&bn, "0x1234") ^ 1640. || !BN_is_word(bn, 0x1234) || BN_is_negative(bn)) { 1641. fprintf(stderr, "BN_asc2bn(0x1234) gave a bad result.\n"); crypto/bn/bn_print.c:269:1: Parameter `*a` 267. } 268. 269. > int BN_asc2bn(BIGNUM **bn, const char *a) 270. { 271. const char *p = a; crypto/bn/bn_print.c:271:5: Assignment 269. int BN_asc2bn(BIGNUM **bn, const char *a) 270. { 271. const char *p = a; ^ 272. 273. if (*p == '-') crypto/bn/bn_print.c:277:14: Call 275. 276. if (p[0] == '0' && (p[1] == 'X' || p[1] == 'x')) { 277. if (!BN_hex2bn(bn, p + 2)) ^ 278. return 0; 279. } else { crypto/bn/bn_print.c:141:10: <Offset trace> 139. } 140. 141. for (i = 0; i <= (INT_MAX/4) && isxdigit((unsigned char)a[i]); i++) ^ 142. continue; 143. crypto/bn/bn_print.c:141:10: Assignment 139. } 140. 141. for (i = 0; i <= (INT_MAX/4) && isxdigit((unsigned char)a[i]); i++) ^ 142. continue; 143. crypto/bn/bn_print.c:126:1: <Length trace> 124. } 125. 126. > int BN_hex2bn(BIGNUM **bn, const char *a) 127. { 128. BIGNUM *ret = NULL; crypto/bn/bn_print.c:126:1: Parameter `*a` 124. } 125. 126. > int BN_hex2bn(BIGNUM **bn, const char *a) 127. { 128. BIGNUM *ret = NULL; crypto/bn/bn_print.c:141:37: Array access: Offset: [2, 536870915] (⇐ [2, 4] + [0, 536870911]) Size: 7 by call to `BN_asc2bn` 139. } 140. 141. for (i = 0; i <= (INT_MAX/4) && isxdigit((unsigned char)a[i]); i++) ^ 142. continue; 143.
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_print.c/#L141
d2a_code_trace_data_43398
void curve448_scalar_halve(curve448_scalar_t out, const curve448_scalar_t a) { c448_word_t mask = 0 - (a->limb[0] & 1); c448_dword_t chain = 0; unsigned int i; for (i = 0; i < C448_SCALAR_LIMBS; i++) { chain = (chain + a->limb[i]) + (sc_p->limb[i] & mask); out->limb[i] = (c448_word_t)chain; chain >>= C448_WORD_BITS; } for (i = 0; i < C448_SCALAR_LIMBS - 1; i++) out->limb[i] = out->limb[i] >> 1 | out->limb[i + 1] << (WBITS - 1); out->limb[i] = out->limb[i] >> 1 | (c448_word_t)(chain << (WBITS - 1)); } crypto/ec/curve448/eddsa.c:119: error: INTEGER_OVERFLOW_L2 (0 - [0, 1]):unsigned32 by call to `curve448_scalar_halve`. Showing all 6 steps of the trace crypto/ec/curve448/eddsa.c:107:5: Call 105. clamp(secret_scalar_ser); 106. 107. curve448_scalar_decode_long(secret_scalar, secret_scalar_ser, ^ 108. sizeof(secret_scalar_ser)); 109. crypto/ec/curve448/scalar.c:174:1: Parameter `s->limb[*]` 172. } 173. 174. > void curve448_scalar_decode_long(curve448_scalar_t s, 175. const unsigned char *ser, size_t ser_len) 176. { crypto/ec/curve448/eddsa.c:119:9: Call 117. */ 118. for (c = 1; c < C448_EDDSA_ENCODE_RATIO; c <<= 1) 119. curve448_scalar_halve(secret_scalar, secret_scalar); ^ 120. 121. curve448_precomputed_scalarmul(p, curve448_precomputed_base, secret_scalar); crypto/ec/curve448/scalar.c:222:1: <RHS trace> 220. } 221. 222. > void curve448_scalar_halve(curve448_scalar_t out, const curve448_scalar_t a) 223. { 224. c448_word_t mask = 0 - (a->limb[0] & 1); crypto/ec/curve448/scalar.c:222:1: Parameter `a->limb[*]` 220. } 221. 222. > void curve448_scalar_halve(curve448_scalar_t out, const curve448_scalar_t a) 223. { 224. c448_word_t mask = 0 - (a->limb[0] & 1); crypto/ec/curve448/scalar.c:224:5: Binary operation: (0 - [0, 1]):unsigned32 by call to `curve448_scalar_halve` 222. void curve448_scalar_halve(curve448_scalar_t out, const curve448_scalar_t a) 223. { 224. c448_word_t mask = 0 - (a->limb[0] & 1); ^ 225. c448_dword_t chain = 0; 226. unsigned int i;
https://github.com/openssl/openssl/blob/0cdcdacc337005e08a906b2e07d4e44e3ee48138/crypto/ec/curve448/scalar.c/#L224
d2a_code_trace_data_43399
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/rsa_sp800_56b_test.c:459: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mul`. Showing all 12 steps of the trace test/rsa_sp800_56b_test.c:459:14: Call 457. /* check p */ 458. && TEST_true(BN_sub_word(p, 2)) 459. && TEST_true(BN_mul(n, p, q, ctx)) ^ 460. && TEST_false(rsa_sp800_56b_check_keypair(key, NULL, -1, 2048)) 461. && TEST_true(BN_add_word(p, 2)) crypto/bn/bn_mul.c:497:1: Parameter `ctx->stack.depth` 495. #endif /* BN_RECURSION */ 496. 497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); crypto/bn/bn_mul.c:499:15: Call 497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); ^ 500. 501. bn_correct_top(r); crypto/bn/bn_mul.c:507:1: Parameter `ctx->stack.depth` 505. } 506. 507. > int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 508. { 509. int ret = 0; crypto/bn/bn_mul.c:533:5: Call 531. top = al + bl; 532. 533. BN_CTX_start(ctx); ^ 534. if ((r == a) || (r == b)) { 535. if ((rr = BN_CTX_get(ctx)) == NULL) 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_mul.c:618:5: Call 616. err: 617. bn_check_top(r); 618. BN_CTX_end(ctx); ^ 619. return ret; 620. } crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <LHS trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mul` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_43400
void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size) { void **p = ptr; if (min_size < *size) return; min_size= FFMAX(17*min_size/16 + 32, min_size); av_free(*p); *p = av_malloc(min_size); if (!*p) min_size = 0; *size= min_size; } libavcodec/utils.c:91: error: Integer Overflow L2 ([0, 313594649253062377455] + 32):unsigned64 by call to `av_fast_malloc`. libavcodec/utils.c:83:1: Parameter `min_size` 81. } 82. 83. void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size) ^ 84. { 85. void **p = ptr; libavcodec/utils.c:91:5: Call 89. return; 90. } 91. av_fast_malloc(p, size, min_size + FF_INPUT_BUFFER_PADDING_SIZE); ^ 92. if (*size) 93. memset((uint8_t *)*p + min_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); libavcodec/utils.c:71:1: <LHS trace> 69. } 70. 71. void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size) ^ 72. { 73. void **p = ptr; libavcodec/utils.c:71:1: Parameter `min_size` 69. } 70. 71. void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size) ^ 72. { 73. void **p = ptr; libavcodec/utils.c:76:15: Binary operation: ([0, 313594649253062377455] + 32):unsigned64 by call to `av_fast_malloc` 74. if (min_size < *size) 75. return; 76. min_size= FFMAX(17*min_size/16 + 32, min_size); ^ 77. av_free(*p); 78. *p = av_malloc(min_size);
https://github.com/libav/libav/blob/0880503fbbd68bf6b1352488944020e3ec35c2e4/libavcodec/utils.c/#L76
d2a_code_trace_data_43401
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:3155: error: Uninitialized Value The value read from is_intra[_] was never initialized. libavcodec/vc1.c:3155:17: 3153. } 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. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vc1.c/#L3155
d2a_code_trace_data_43402
HANDSHAKE_RESULT *do_handshake(SSL_CTX *server_ctx, SSL_CTX *server2_ctx, SSL_CTX *client_ctx, const SSL_TEST_CTX *test_ctx) { SSL *server, *client; BIO *client_to_server, *server_to_client; HANDSHAKE_EX_DATA server_ex_data, client_ex_data; CTX_DATA client_ctx_data, server_ctx_data, server2_ctx_data; HANDSHAKE_RESULT *ret = HANDSHAKE_RESULT_new(); int client_turn = 1; peer_status_t client_status = PEER_RETRY, server_status = PEER_RETRY; handshake_status_t status = HANDSHAKE_RETRY; unsigned char* tick = NULL; size_t tick_len = 0; SSL_SESSION* sess = NULL; const unsigned char *proto = NULL; unsigned int proto_len = 0; memset(&server_ctx_data, 0, sizeof(server_ctx_data)); memset(&server2_ctx_data, 0, sizeof(server2_ctx_data)); memset(&client_ctx_data, 0, sizeof(client_ctx_data)); configure_handshake_ctx(server_ctx, server2_ctx, client_ctx, test_ctx, &server_ctx_data, &server2_ctx_data, &client_ctx_data); server = SSL_new(server_ctx); client = SSL_new(client_ctx); OPENSSL_assert(server != NULL && client != NULL); configure_handshake_ssl(server, client, test_ctx); memset(&server_ex_data, 0, sizeof(server_ex_data)); memset(&client_ex_data, 0, sizeof(client_ex_data)); ret->result = SSL_TEST_INTERNAL_ERROR; client_to_server = BIO_new(BIO_s_mem()); server_to_client = BIO_new(BIO_s_mem()); OPENSSL_assert(client_to_server != NULL && server_to_client != NULL); BIO_set_nbio(client_to_server, 1); BIO_set_nbio(server_to_client, 1); SSL_set_connect_state(client); SSL_set_accept_state(server); SSL_set_bio(client, server_to_client, client_to_server); OPENSSL_assert(BIO_up_ref(server_to_client) > 0); OPENSSL_assert(BIO_up_ref(client_to_server) > 0); SSL_set_bio(server, client_to_server, server_to_client); ex_data_idx = SSL_get_ex_new_index(0, "ex data", NULL, NULL, NULL); OPENSSL_assert(ex_data_idx >= 0); OPENSSL_assert(SSL_set_ex_data(server, ex_data_idx, &server_ex_data) == 1); OPENSSL_assert(SSL_set_ex_data(client, ex_data_idx, &client_ex_data) == 1); SSL_set_info_callback(server, &info_cb); SSL_set_info_callback(client, &info_cb); for(;;) { if (client_turn) { client_status = do_handshake_step(client); status = handshake_status(client_status, server_status, 1 ); } else { server_status = do_handshake_step(server); status = handshake_status(server_status, client_status, 0 ); } switch (status) { case HANDSHAKE_SUCCESS: ret->result = SSL_TEST_SUCCESS; goto err; case CLIENT_ERROR: ret->result = SSL_TEST_CLIENT_FAIL; goto err; case SERVER_ERROR: ret->result = SSL_TEST_SERVER_FAIL; goto err; case INTERNAL_ERROR: ret->result = SSL_TEST_INTERNAL_ERROR; goto err; case HANDSHAKE_RETRY: client_turn ^= 1; break; } } err: ret->server_alert_sent = server_ex_data.alert_sent; ret->server_alert_received = client_ex_data.alert_received; ret->client_alert_sent = client_ex_data.alert_sent; ret->client_alert_received = server_ex_data.alert_received; ret->server_protocol = SSL_version(server); ret->client_protocol = SSL_version(client); ret->servername = server_ex_data.servername; if ((sess = SSL_get0_session(client)) != NULL) SSL_SESSION_get0_ticket(sess, &tick, &tick_len); if (tick == NULL || tick_len == 0) ret->session_ticket = SSL_TEST_SESSION_TICKET_NO; else ret->session_ticket = SSL_TEST_SESSION_TICKET_YES; ret->session_ticket_do_not_call = server_ex_data.session_ticket_do_not_call; SSL_get0_next_proto_negotiated(client, &proto, &proto_len); ret->client_npn_negotiated = dup_str(proto, proto_len); SSL_get0_next_proto_negotiated(server, &proto, &proto_len); ret->server_npn_negotiated = dup_str(proto, proto_len); SSL_get0_alpn_selected(client, &proto, &proto_len); ret->client_alpn_negotiated = dup_str(proto, proto_len); SSL_get0_alpn_selected(server, &proto, &proto_len); ret->server_alpn_negotiated = dup_str(proto, proto_len); ctx_data_free_data(&server_ctx_data); ctx_data_free_data(&server2_ctx_data); ctx_data_free_data(&client_ctx_data); SSL_free(server); SSL_free(client); return ret; } test/handshake_helper.c:604: error: UNINITIALIZED_VALUE The value read from server_ex_data.session_ticket_do_not_call was never initialized. Showing all 1 steps of the trace test/handshake_helper.c:604:5: 602. else 603. ret->session_ticket = SSL_TEST_SESSION_TICKET_YES; 604. > ret->session_ticket_do_not_call = server_ex_data.session_ticket_do_not_call; 605. 606. SSL_get0_next_proto_negotiated(client, &proto, &proto_len);
https://github.com/openssl/openssl/blob/70c22888c1648fe8652e77107f3c74bf2212de36/test/handshake_helper.c/#L604
d2a_code_trace_data_43403
void avfilter_unref_buffer(AVFilterBufferRef *ref) { if (!ref) return; if (!(--ref->buf->refcount)) ref->buf->free(ref->buf); if (ref->extended_data != ref->data) av_freep(&ref->extended_data); av_free(ref->video); av_free(ref->audio); av_free(ref); } avconv.c:1572: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer`. avconv.c:1564:39: Call 1562. avfilter_copy_buf_props(filtered_frame, picref); 1563. if (picref->pts != AV_NOPTS_VALUE) { 1564. filtered_frame->pts = av_rescale_q(picref->pts, ^ 1565. ost->filter->filter->inputs[0]->time_base, 1566. ost->st->codec->time_base) - libavutil/mathematics.c:143:12: Call 141. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) 142. { 143. return av_rescale_q_rnd(a, bq, cq, AV_ROUND_NEAR_INF); ^ 144. } 145. libavutil/mathematics.c:138:12: Call 136. int64_t b= bq.num * (int64_t)cq.den; 137. int64_t c= cq.num * (int64_t)bq.den; 138. return av_rescale_rnd(a, b, c, rnd); ^ 139. } 140. libavutil/mathematics.c:83:39: Unknown value from: av_rescale_rnd 81. assert((unsigned)rnd<=5 && rnd!=4); 82. 83. if(a<0 && a != INT64_MIN) return -av_rescale_rnd(-a, b, c, rnd ^ ((rnd>>1)&1)); ^ 84. 85. if(rnd==AV_ROUND_NEAR_INF) r= c/2; libavutil/mathematics.c:83:31: Assignment 81. assert((unsigned)rnd<=5 && rnd!=4); 82. 83. if(a<0 && a != INT64_MIN) return -av_rescale_rnd(-a, b, c, rnd ^ ((rnd>>1)&1)); ^ 84. 85. if(rnd==AV_ROUND_NEAR_INF) r= c/2; libavutil/mathematics.c:138:5: Assignment 136. int64_t b= bq.num * (int64_t)cq.den; 137. int64_t c= cq.num * (int64_t)bq.den; 138. return av_rescale_rnd(a, b, c, rnd); ^ 139. } 140. libavutil/mathematics.c:143:5: Assignment 141. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) 142. { 143. return av_rescale_q_rnd(a, bq, cq, AV_ROUND_NEAR_INF); ^ 144. } 145. avconv.c:1564:17: Assignment 1562. avfilter_copy_buf_props(filtered_frame, picref); 1563. if (picref->pts != AV_NOPTS_VALUE) { 1564. filtered_frame->pts = av_rescale_q(picref->pts, ^ 1565. ost->filter->filter->inputs[0]->time_base, 1566. ost->st->codec->time_base) - avconv.c:1572:21: Call 1570. 1571. if (of->start_time && filtered_frame->pts < 0) { 1572. avfilter_unref_buffer(picref); ^ 1573. continue; 1574. } libavfilter/buffer.c:74:1: <LHS trace> 72. } 73. 74. void avfilter_unref_buffer(AVFilterBufferRef *ref) ^ 75. { 76. if (!ref) libavfilter/buffer.c:74:1: Parameter `ref->buf->refcount` 72. } 73. 74. void avfilter_unref_buffer(AVFilterBufferRef *ref) ^ 75. { 76. if (!ref) libavfilter/buffer.c:78:11: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer` 76. if (!ref) 77. return; 78. if (!(--ref->buf->refcount)) ^ 79. ref->buf->free(ref->buf); 80. if (ref->extended_data != ref->data)
https://github.com/libav/libav/blob/54bf88e65fe2d87a41abcbee33392725ebe2f0a0/libavfilter/buffer.c/#L78
d2a_code_trace_data_43404
void avfilter_unref_buffer(AVFilterBufferRef *ref) { if(!(--ref->buf->refcount)) ref->buf->free(ref->buf); av_free(ref->video); av_free(ref); } libavfilter/vf_unsharp.c:205: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer`. libavfilter/vf_unsharp.c:205:5: Call 203. unsharpen(out->data[2], in->data[2], out->linesize[2], in->linesize[2], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), &unsharp->chroma); 204. 205. avfilter_unref_buffer(in); ^ 206. avfilter_draw_slice(link->dst->outputs[0], 0, link->h, 1); 207. avfilter_end_frame(link->dst->outputs[0]); libavfilter/avfilter.c:61:1: <LHS trace> 59. } 60. 61. void avfilter_unref_buffer(AVFilterBufferRef *ref) ^ 62. { 63. if(!(--ref->buf->refcount)) libavfilter/avfilter.c:61:1: Parameter `ref->buf->refcount` 59. } 60. 61. void avfilter_unref_buffer(AVFilterBufferRef *ref) ^ 62. { 63. if(!(--ref->buf->refcount)) libavfilter/avfilter.c:63:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer` 61. void avfilter_unref_buffer(AVFilterBufferRef *ref) 62. { 63. if(!(--ref->buf->refcount)) ^ 64. ref->buf->free(ref->buf); 65. av_free(ref->video);
https://github.com/libav/libav/blob/ad0d70c964f852a18e9ab8124f0e7aa8876cac6e/libavfilter/avfilter.c/#L63
d2a_code_trace_data_43405
void avfilter_unref_buffer(AVFilterBufferRef *ref) { if(!(--ref->buf->refcount)) ref->buf->free(ref->buf); av_free(ref->video); av_free(ref); } ffmpeg.c:1781: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer`. ffmpeg.c:1781:17: Call 1779. ist->out_video_filter && avfilter_poll_frame(ist->out_video_filter->inputs[0]); 1780. if(ist->picref) 1781. avfilter_unref_buffer(ist->picref); ^ 1782. } 1783. #endif libavfilter/avfilter.c:61:1: Parameter `ref->buf->refcount` 59. } 60. 61. void avfilter_unref_buffer(AVFilterBufferRef *ref) ^ 62. { 63. if(!(--ref->buf->refcount)) libavfilter/avfilter.c:63:10: Assignment 61. void avfilter_unref_buffer(AVFilterBufferRef *ref) 62. { 63. if(!(--ref->buf->refcount)) ^ 64. ref->buf->free(ref->buf); 65. av_free(ref->video); ffmpeg.c:1781:17: Call 1779. ist->out_video_filter && avfilter_poll_frame(ist->out_video_filter->inputs[0]); 1780. if(ist->picref) 1781. avfilter_unref_buffer(ist->picref); ^ 1782. } 1783. #endif libavfilter/avfilter.c:61:1: <LHS trace> 59. } 60. 61. void avfilter_unref_buffer(AVFilterBufferRef *ref) ^ 62. { 63. if(!(--ref->buf->refcount)) libavfilter/avfilter.c:61:1: Parameter `ref->buf->refcount` 59. } 60. 61. void avfilter_unref_buffer(AVFilterBufferRef *ref) ^ 62. { 63. if(!(--ref->buf->refcount)) libavfilter/avfilter.c:63:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer` 61. void avfilter_unref_buffer(AVFilterBufferRef *ref) 62. { 63. if(!(--ref->buf->refcount)) ^ 64. ref->buf->free(ref->buf); 65. av_free(ref->video);
https://github.com/libav/libav/blob/ad0d70c964f852a18e9ab8124f0e7aa8876cac6e/libavfilter/avfilter.c/#L63
d2a_code_trace_data_43406
void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) { unsigned long hash; OPENSSL_LH_NODE *nn, **rn; void *ret; lh->error = 0; rn = getrn(lh, data, &hash); if (*rn == NULL) { lh->num_no_delete++; return (NULL); } else { nn = *rn; *rn = nn->next; ret = nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))) contract(lh); return (ret); } ssl/ssl_lib.c:678: error: INTEGER_OVERFLOW_L2 ([0, max(0, `ctx->sessions->num_items`)] - 1):unsigned64 by call to `SSL_free`. Showing all 15 steps of the trace ssl/ssl_lib.c:522:1: Parameter `ctx->sessions->num_items` 520. } 521. 522. > SSL *SSL_new(SSL_CTX *ctx) 523. { 524. SSL *s; ssl/ssl_lib.c:678:5: Call 676. return s; 677. err: 678. SSL_free(s); ^ 679. SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE); 680. return NULL; ssl/ssl_lib.c:968:1: Parameter `s->session_ctx->sessions->num_items` 966. } 967. 968. > void SSL_free(SSL *s) 969. { 970. int i; ssl/ssl_lib.c:999:9: Call 997. /* Make the next call work :-) */ 998. if (s->session != NULL) { 999. ssl_clear_bad_session(s); ^ 1000. SSL_SESSION_free(s->session); 1001. } ssl/ssl_sess.c:1049:1: Parameter `s->session_ctx->sessions->num_items` 1047. } 1048. 1049. > int ssl_clear_bad_session(SSL *s) 1050. { 1051. if ((s->session != NULL) && ssl/ssl_sess.c:1054:9: Call 1052. !(s->shutdown & SSL_SENT_SHUTDOWN) && 1053. !(SSL_in_init(s) || SSL_in_before(s))) { 1054. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 1055. return (1); 1056. } else ssl/ssl_sess.c:725:1: Parameter `ctx->sessions->num_items` 723. } 724. 725. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 726. { 727. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:727:12: Call 725. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 726. { 727. return remove_session_lock(ctx, c, 1); ^ 728. } 729. ssl/ssl_sess.c:730:1: Parameter `ctx->sessions->num_items` 728. } 729. 730. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 731. { 732. SSL_SESSION *r; ssl/ssl_sess.c:740:17: Call 738. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 739. ret = 1; 740. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 741. SSL_SESSION_list_remove(ctx, c); 742. } ssl/ssl_locl.h:721:1: Parameter `lh->num_items` 719. } TLSEXT_INDEX; 720. 721. > DEFINE_LHASH_OF(SSL_SESSION); 722. /* Needed in ssl_cert.c */ 723. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:721:1: Call 719. } TLSEXT_INDEX; 720. 721. > DEFINE_LHASH_OF(SSL_SESSION); 722. /* Needed in ssl_cert.c */ 723. 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, ctx->sessions->num_items)] - 1):unsigned64 by call to `SSL_free` 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/7f7eb90b8ac55997c5c825bb3ebcfe28611e06f5/crypto/lhash/lhash.c/#L123
d2a_code_trace_data_43407
static int vp3_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; Vp3DecodeContext *s = avctx->priv_data; GetBitContext gb; int i; init_get_bits(&gb, buf, buf_size * 8); if (s->theora && get_bits1(&gb)) { av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n"); return -1; } s->keyframe = !get_bits1(&gb); if (!s->theora) skip_bits(&gb, 1); for (i = 0; i < 3; i++) s->last_qps[i] = s->qps[i]; s->nqps=0; do{ s->qps[s->nqps++]= get_bits(&gb, 6); } while(s->theora >= 0x030200 && s->nqps<3 && get_bits1(&gb)); for (i = s->nqps; i < 3; i++) s->qps[i] = -1; if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, " VP3 %sframe #%d: Q index = %d\n", s->keyframe?"key":"", avctx->frame_number+1, s->qps[0]); s->skip_loop_filter = !s->filter_limit_values[s->qps[0]] || avctx->skip_loop_filter >= (s->keyframe ? AVDISCARD_ALL : AVDISCARD_NONKEY); if (s->qps[0] != s->last_qps[0]) init_loop_filter(s); for (i = 0; i < s->nqps; i++) if (s->qps[i] != s->last_qps[i] || s->qps[0] != s->last_qps[0]) init_dequantizer(s, i); if (avctx->skip_frame >= AVDISCARD_NONKEY && !s->keyframe) return buf_size; s->current_frame.reference = 3; s->current_frame.pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; if (ff_thread_get_buffer(avctx, &s->current_frame) < 0) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); goto error; } if (!s->edge_emu_buffer) s->edge_emu_buffer = av_malloc(9*FFABS(s->current_frame.linesize[0])); if (s->keyframe) { if (!s->theora) { skip_bits(&gb, 4); skip_bits(&gb, 4); if (s->version) { s->version = get_bits(&gb, 5); if (avctx->frame_number == 0) av_log(s->avctx, AV_LOG_DEBUG, "VP version: %d\n", s->version); } } if (s->version || s->theora) { if (get_bits1(&gb)) av_log(s->avctx, AV_LOG_ERROR, "Warning, unsupported keyframe coding type?!\n"); skip_bits(&gb, 2); } } else { if (!s->golden_frame.data[0]) { av_log(s->avctx, AV_LOG_WARNING, "vp3: first frame not a keyframe\n"); s->golden_frame.reference = 3; s->golden_frame.pict_type = AV_PICTURE_TYPE_I; if (ff_thread_get_buffer(avctx, &s->golden_frame) < 0) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); goto error; } s->last_frame = s->golden_frame; s->last_frame.type = FF_BUFFER_TYPE_COPY; ff_thread_report_progress(&s->last_frame, INT_MAX, 0); } } memset(s->all_fragments, 0, s->fragment_count * sizeof(Vp3Fragment)); ff_thread_finish_setup(avctx); if (unpack_superblocks(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_superblocks\n"); goto error; } if (unpack_modes(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_modes\n"); goto error; } if (unpack_vectors(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_vectors\n"); goto error; } if (unpack_block_qpis(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_block_qpis\n"); goto error; } if (unpack_dct_coeffs(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_dct_coeffs\n"); goto error; } for (i = 0; i < 3; i++) { int height = s->height >> (i && s->chroma_y_shift); if (s->flipped_image) s->data_offset[i] = 0; else s->data_offset[i] = (height-1) * s->current_frame.linesize[i]; } s->last_slice_end = 0; for (i = 0; i < s->c_superblock_height; i++) render_slice(s, i); for (i = 0; i < 3; i++) { int row = (s->height >> (3+(i && s->chroma_y_shift))) - 1; apply_loop_filter(s, i, row, row+1); } vp3_draw_horiz_band(s, s->avctx->height); *data_size=sizeof(AVFrame); *(AVFrame*)data= s->current_frame; if (!HAVE_THREADS || !(s->avctx->active_thread_type&FF_THREAD_FRAME)) update_frames(avctx); return buf_size; error: ff_thread_report_progress(&s->current_frame, INT_MAX, 0); if (!HAVE_THREADS || !(s->avctx->active_thread_type&FF_THREAD_FRAME)) avctx->release_buffer(avctx, &s->current_frame); return -1; } libavcodec/vp3.c:1866: error: Null Dereference pointer `&gb->buffer` last assigned on line 1858 could be null and is dereferenced by call to `get_bits1()` at line 1866, column 20. libavcodec/vp3.c:1848:1: start of procedure vp3_decode_frame() 1846. * This is the ffmpeg/libavcodec API frame decode function. 1847. */ 1848. static int vp3_decode_frame(AVCodecContext *avctx, ^ 1849. void *data, int *data_size, 1850. AVPacket *avpkt) libavcodec/vp3.c:1852:5: 1850. AVPacket *avpkt) 1851. { 1852. const uint8_t *buf = avpkt->data; ^ 1853. int buf_size = avpkt->size; 1854. Vp3DecodeContext *s = avctx->priv_data; libavcodec/vp3.c:1853:5: 1851. { 1852. const uint8_t *buf = avpkt->data; 1853. int buf_size = avpkt->size; ^ 1854. Vp3DecodeContext *s = avctx->priv_data; 1855. GetBitContext gb; libavcodec/vp3.c:1854:5: 1852. const uint8_t *buf = avpkt->data; 1853. int buf_size = avpkt->size; 1854. Vp3DecodeContext *s = avctx->priv_data; ^ 1855. GetBitContext gb; 1856. int i; libavcodec/vp3.c:1858:5: 1856. int i; 1857. 1858. init_get_bits(&gb, buf, buf_size * 8); ^ 1859. 1860. if (s->theora && 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/vp3.c:1860:9: Taking false branch 1858. init_get_bits(&gb, buf, buf_size * 8); 1859. 1860. if (s->theora && get_bits1(&gb)) ^ 1861. { 1862. av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n"); libavcodec/vp3.c:1866:20: 1864. } 1865. 1866. s->keyframe = !get_bits1(&gb); ^ 1867. if (!s->theora) 1868. skip_bits(&gb, 1); 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/33684b9c12b74c0140fb91e8150263db4a48d55e/libavcodec/vp3.c/#L1866
d2a_code_trace_data_43408
static int EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount) { static const char module[] = "EstimateStripByteCounts"; TIFFDirEntry *dp; TIFFDirectory *td = &tif->tif_dir; uint32 strip; if (td->td_stripbytecount) _TIFFfree(td->td_stripbytecount); td->td_stripbytecount = (uint64*) _TIFFCheckMalloc(tif, td->td_nstrips, sizeof (uint64), "for \"StripByteCounts\" array"); if( td->td_stripbytecount == NULL ) return -1; if (td->td_compression != COMPRESSION_NONE) { uint64 space; uint64 filesize; uint16 n; filesize = TIFFGetFileSize(tif); if (!(tif->tif_flags&TIFF_BIGTIFF)) space=sizeof(TIFFHeaderClassic)+2+dircount*12+4; else space=sizeof(TIFFHeaderBig)+8+dircount*20+8; for (dp = dir, n = dircount; n > 0; n--, dp++) { uint32 typewidth = TIFFDataWidth((TIFFDataType) dp->tdir_type); uint64 datasize; typewidth = TIFFDataWidth((TIFFDataType) dp->tdir_type); if (typewidth == 0) { TIFFErrorExt(tif->tif_clientdata, module, "Cannot determine size of unknown tag type %d", dp->tdir_type); return -1; } datasize=(uint64)typewidth*dp->tdir_count; if (!(tif->tif_flags&TIFF_BIGTIFF)) { if (datasize<=4) datasize=0; } else { if (datasize<=8) datasize=0; } space+=datasize; } space = filesize - space; if (td->td_planarconfig == PLANARCONFIG_SEPARATE) space /= td->td_samplesperpixel; for (strip = 0; strip < td->td_nstrips; strip++) td->td_stripbytecount[strip] = space; strip--; if (td->td_stripoffset[strip]+td->td_stripbytecount[strip] > filesize) td->td_stripbytecount[strip] = filesize - td->td_stripoffset[strip]; } else if (isTiled(tif)) { uint64 bytespertile = TIFFTileSize64(tif); for (strip = 0; strip < td->td_nstrips; strip++) td->td_stripbytecount[strip] = bytespertile; } else { uint64 rowbytes = TIFFScanlineSize64(tif); uint32 rowsperstrip = td->td_imagelength/td->td_stripsperimage; for (strip = 0; strip < td->td_nstrips; strip++) td->td_stripbytecount[strip] = rowbytes * rowsperstrip; } TIFFSetFieldBit(tif, FIELD_STRIPBYTECOUNTS); if (!TIFFFieldSet(tif, FIELD_ROWSPERSTRIP)) td->td_rowsperstrip = td->td_imagelength; return 1; } contrib/addtiffo/tif_overview.c:836: error: Buffer Overrun L3 Offset: [-1, +oo] Size: [0, +oo] by call to `TIFFCreateOvrCache`. contrib/addtiffo/tif_overview.c:827:22: Call 825. } 826. 827. nDirOffset = TIFF_WriteOverview( hTIFF, nOXSize, nOYSize, ^ 828. nBitsPerPixel, nPlanarConfig, 829. nSamples, nOBlockXSize, nOBlockYSize, contrib/addtiffo/tif_overview.c:146:9: Call 144. /* Write directory, and return byte offset. */ 145. /* -------------------------------------------------------------------- */ 146. if( TIFFWriteCheck( hTIFF, bTiled, "TIFFBuildOverviews" ) == 0 ) ^ 147. return 0; 148. libtiff/tif_write.c:488:1: Parameter `*tif->tif_dir.td_stripoffset` 486. * that important information is not changed. 487. */ 488. int ^ 489. TIFFWriteCheck(TIFF* tif, int tiles, const char* module) 490. { contrib/addtiffo/tif_overview.c:836:25: Call 834. nHorSubsampling, nVerSubsampling ); 835. 836. papoRawBIs[i] = TIFFCreateOvrCache( hTIFF, nDirOffset ); ^ 837. } 838. contrib/addtiffo/tif_ovrcache.c:43:1: Parameter `*hTIFF->tif_dir.td_stripoffset` 41. /************************************************************************/ 42. 43. TIFFOvrCache *TIFFCreateOvrCache( TIFF *hTIFF, toff_t nDirOffset ) ^ 44. 45. { contrib/addtiffo/tif_ovrcache.c:57:5: Call 55. /* -------------------------------------------------------------------- */ 56. nBaseDirOffset = TIFFCurrentDirOffset( psCache->hTIFF ); 57. TIFFSetSubDirectory( hTIFF, nDirOffset ); ^ 58. 59. TIFFGetField( hTIFF, TIFFTAG_IMAGEWIDTH, &(psCache->nXSize) ); libtiff/tif_dir.c:1384:1: Parameter `*tif->tif_dir.td_stripoffset` 1382. * the SubIFD tag (e.g. thumbnail images). 1383. */ 1384. int ^ 1385. TIFFSetSubDirectory(TIFF* tif, uint64 diroff) 1386. { libtiff/tif_dir.c:1393:10: Call 1391. */ 1392. tif->tif_dirnumber = 0; 1393. return (TIFFReadDirectory(tif)); ^ 1394. } 1395. libtiff/tif_dirread.c:3418:2: Call 3416. /* free any old stuff and reinit */ 3417. TIFFFreeDirectory(tif); 3418. TIFFDefaultDirectory(tif); ^ 3419. /* 3420. * Electronic Arts writes gray-scale TIFF files libtiff/tif_dir.c:1147:2: Assignment 1145. td->td_threshholding = THRESHHOLD_BILEVEL; 1146. td->td_orientation = ORIENTATION_TOPLEFT; 1147. td->td_samplesperpixel = 1; ^ 1148. td->td_rowsperstrip = (uint32) -1; 1149. td->td_tilewidth = 0; libtiff/tif_dirread.c:3832:8: Call 3830. "\"%s\" field, calculating from imagelength", 3831. TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name); 3832. if (EstimateStripByteCounts(tif, dir, dircount) < 0) ^ 3833. goto bad; 3834. /* libtiff/tif_dirread.c:4163:1: <Offset trace> 4161. } 4162. 4163. static int ^ 4164. EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount) 4165. { libtiff/tif_dirread.c:4163:1: Parameter `tif->tif_dir.td_nstrips` 4161. } 4162. 4163. static int ^ 4164. EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount) 4165. { libtiff/tif_dirread.c:4226:3: Assignment 4224. * of data in the strip and trim this number back accordingly. 4225. */ 4226. strip--; ^ 4227. if (td->td_stripoffset[strip]+td->td_stripbytecount[strip] > filesize) 4228. td->td_stripbytecount[strip] = filesize - td->td_stripoffset[strip]; libtiff/tif_dirread.c:4163:1: <Length trace> 4161. } 4162. 4163. static int ^ 4164. EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount) 4165. { libtiff/tif_dirread.c:4163:1: Parameter `*tif->tif_dir.td_stripoffset` 4161. } 4162. 4163. static int ^ 4164. EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount) 4165. { libtiff/tif_dirread.c:4227:7: Array access: Offset: [-1, +oo] Size: [0, +oo] by call to `TIFFCreateOvrCache` 4225. */ 4226. strip--; 4227. if (td->td_stripoffset[strip]+td->td_stripbytecount[strip] > filesize) ^ 4228. td->td_stripbytecount[strip] = filesize - td->td_stripoffset[strip]; 4229. } else if (isTiled(tif)) {
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_dirread.c/#L4227
d2a_code_trace_data_43409
STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, ASN1_BIT_STRING *bits, STACK_OF(CONF_VALUE) *ret) { BIT_STRING_BITNAME *bnam; for (bnam = method->usr_data; bnam->lname; bnam++) { if (ASN1_BIT_STRING_get_bit(bits, bnam->bitnum)) X509V3_add_value(bnam->lname, NULL, &ret); } return ret; } crypto/x509v3/v3_bitst.c:103: error: NULL_DEREFERENCE pointer `null` is dereferenced by call to `X509V3_add_value()` at line 103, column 13. Showing all 106 steps of the trace crypto/x509v3/v3_bitst.c:96:1: start of procedure i2v_ASN1_BIT_STRING() 94. EXT_BITSTRING(NID_key_usage, key_usage_type_table); 95. 96. > STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, 97. ASN1_BIT_STRING *bits, 98. STACK_OF(CONF_VALUE) *ret) crypto/x509v3/v3_bitst.c:101:10: 99. { 100. BIT_STRING_BITNAME *bnam; 101. > for (bnam = method->usr_data; bnam->lname; bnam++) { 102. if (ASN1_BIT_STRING_get_bit(bits, bnam->bitnum)) 103. X509V3_add_value(bnam->lname, NULL, &ret); crypto/x509v3/v3_bitst.c:101:35: Loop condition is true. Entering loop body 99. { 100. BIT_STRING_BITNAME *bnam; 101. for (bnam = method->usr_data; bnam->lname; bnam++) { ^ 102. if (ASN1_BIT_STRING_get_bit(bits, bnam->bitnum)) 103. X509V3_add_value(bnam->lname, NULL, &ret); crypto/x509v3/v3_bitst.c:102:13: 100. BIT_STRING_BITNAME *bnam; 101. for (bnam = method->usr_data; bnam->lname; bnam++) { 102. > if (ASN1_BIT_STRING_get_bit(bits, bnam->bitnum)) 103. X509V3_add_value(bnam->lname, NULL, &ret); 104. } crypto/asn1/a_bitstr.c:223:1: start of procedure ASN1_BIT_STRING_get_bit() 221. } 222. 223. > int ASN1_BIT_STRING_get_bit(const ASN1_BIT_STRING *a, int n) 224. { 225. int w, v; crypto/asn1/a_bitstr.c:227:5: 225. int w, v; 226. 227. > w = n / 8; 228. v = 1 << (7 - (n & 0x07)); 229. if ((a == NULL) || (a->length < (w + 1)) || (a->data == NULL)) crypto/asn1/a_bitstr.c:228:5: 226. 227. w = n / 8; 228. > v = 1 << (7 - (n & 0x07)); 229. if ((a == NULL) || (a->length < (w + 1)) || (a->data == NULL)) 230. return (0); crypto/asn1/a_bitstr.c:229:10: Taking false branch 227. w = n / 8; 228. v = 1 << (7 - (n & 0x07)); 229. if ((a == NULL) || (a->length < (w + 1)) || (a->data == NULL)) ^ 230. return (0); 231. return ((a->data[w] & v) != 0); crypto/asn1/a_bitstr.c:229:25: Taking false branch 227. w = n / 8; 228. v = 1 << (7 - (n & 0x07)); 229. if ((a == NULL) || (a->length < (w + 1)) || (a->data == NULL)) ^ 230. return (0); 231. return ((a->data[w] & v) != 0); crypto/asn1/a_bitstr.c:229:50: Taking false branch 227. w = n / 8; 228. v = 1 << (7 - (n & 0x07)); 229. if ((a == NULL) || (a->length < (w + 1)) || (a->data == NULL)) ^ 230. return (0); 231. return ((a->data[w] & v) != 0); crypto/asn1/a_bitstr.c:231:13: Condition is true 229. if ((a == NULL) || (a->length < (w + 1)) || (a->data == NULL)) 230. return (0); 231. return ((a->data[w] & v) != 0); ^ 232. } 233. crypto/asn1/a_bitstr.c:231:5: 229. if ((a == NULL) || (a->length < (w + 1)) || (a->data == NULL)) 230. return (0); 231. > return ((a->data[w] & v) != 0); 232. } 233. crypto/asn1/a_bitstr.c:232:1: return from a call to ASN1_BIT_STRING_get_bit 230. return (0); 231. return ((a->data[w] & v) != 0); 232. > } 233. 234. /* crypto/x509v3/v3_bitst.c:102:13: Taking true branch 100. BIT_STRING_BITNAME *bnam; 101. for (bnam = method->usr_data; bnam->lname; bnam++) { 102. if (ASN1_BIT_STRING_get_bit(bits, bnam->bitnum)) ^ 103. X509V3_add_value(bnam->lname, NULL, &ret); 104. } crypto/x509v3/v3_bitst.c:103:13: 101. for (bnam = method->usr_data; bnam->lname; bnam++) { 102. if (ASN1_BIT_STRING_get_bit(bits, bnam->bitnum)) 103. > X509V3_add_value(bnam->lname, NULL, &ret); 104. } 105. return ret; crypto/x509v3/v3_utl.c:83:1: start of procedure X509V3_add_value() 81. /* Add a CONF_VALUE name value pair to stack */ 82. 83. > int X509V3_add_value(const char *name, const char *value, 84. STACK_OF(CONF_VALUE) **extlist) 85. { crypto/x509v3/v3_utl.c:86:5: 84. STACK_OF(CONF_VALUE) **extlist) 85. { 86. > CONF_VALUE *vtmp = NULL; 87. char *tname = NULL, *tvalue = NULL; 88. crypto/x509v3/v3_utl.c:87:5: 85. { 86. CONF_VALUE *vtmp = NULL; 87. > char *tname = NULL, *tvalue = NULL; 88. 89. if (name && (tname = OPENSSL_strdup(name)) == NULL) crypto/x509v3/v3_utl.c:89:9: Taking true branch 87. char *tname = NULL, *tvalue = NULL; 88. 89. if (name && (tname = OPENSSL_strdup(name)) == NULL) ^ 90. goto err; 91. if (value && (tvalue = OPENSSL_strdup(value)) == NULL) crypto/x509v3/v3_utl.c:89:17: 87. char *tname = NULL, *tvalue = NULL; 88. 89. > if (name && (tname = OPENSSL_strdup(name)) == NULL) 90. goto err; 91. if (value && (tvalue = OPENSSL_strdup(value)) == NULL) crypto/o_str.c:121:1: start of procedure CRYPTO_strdup() 119. } 120. 121. > char *CRYPTO_strdup(const char *str, const char* file, int line) 122. { 123. char *ret; crypto/o_str.c:125:9: Taking false branch 123. char *ret; 124. 125. if (str == NULL) ^ 126. return NULL; 127. ret = CRYPTO_malloc(strlen(str) + 1, file, line); crypto/o_str.c:127:5: 125. if (str == NULL) 126. return NULL; 127. > ret = CRYPTO_malloc(strlen(str) + 1, file, line); 128. if (ret != NULL) 129. strcpy(ret, str); crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/o_str.c:128:9: Taking true branch 126. return NULL; 127. ret = CRYPTO_malloc(strlen(str) + 1, file, line); 128. if (ret != NULL) ^ 129. strcpy(ret, str); 130. return ret; crypto/o_str.c:129:9: 127. ret = CRYPTO_malloc(strlen(str) + 1, file, line); 128. if (ret != NULL) 129. > strcpy(ret, str); 130. return ret; 131. } crypto/o_str.c:130:5: 128. if (ret != NULL) 129. strcpy(ret, str); 130. > return ret; 131. } 132. crypto/o_str.c:131:1: return from a call to CRYPTO_strdup 129. strcpy(ret, str); 130. return ret; 131. > } 132. 133. char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line) crypto/x509v3/v3_utl.c:89:17: Taking false branch 87. char *tname = NULL, *tvalue = NULL; 88. 89. if (name && (tname = OPENSSL_strdup(name)) == NULL) ^ 90. goto err; 91. if (value && (tvalue = OPENSSL_strdup(value)) == NULL) crypto/x509v3/v3_utl.c:91:9: Taking true branch 89. if (name && (tname = OPENSSL_strdup(name)) == NULL) 90. goto err; 91. if (value && (tvalue = OPENSSL_strdup(value)) == NULL) ^ 92. goto err; 93. if ((vtmp = OPENSSL_malloc(sizeof(*vtmp))) == NULL) crypto/x509v3/v3_utl.c:91:18: 89. if (name && (tname = OPENSSL_strdup(name)) == NULL) 90. goto err; 91. > if (value && (tvalue = OPENSSL_strdup(value)) == NULL) 92. goto err; 93. if ((vtmp = OPENSSL_malloc(sizeof(*vtmp))) == NULL) crypto/o_str.c:121:1: start of procedure CRYPTO_strdup() 119. } 120. 121. > char *CRYPTO_strdup(const char *str, const char* file, int line) 122. { 123. char *ret; crypto/o_str.c:125:9: Taking false branch 123. char *ret; 124. 125. if (str == NULL) ^ 126. return NULL; 127. ret = CRYPTO_malloc(strlen(str) + 1, file, line); crypto/o_str.c:127:5: 125. if (str == NULL) 126. return NULL; 127. > ret = CRYPTO_malloc(strlen(str) + 1, file, line); 128. if (ret != NULL) 129. strcpy(ret, str); crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/o_str.c:128:9: Taking true branch 126. return NULL; 127. ret = CRYPTO_malloc(strlen(str) + 1, file, line); 128. if (ret != NULL) ^ 129. strcpy(ret, str); 130. return ret; crypto/o_str.c:129:9: 127. ret = CRYPTO_malloc(strlen(str) + 1, file, line); 128. if (ret != NULL) 129. > strcpy(ret, str); 130. return ret; 131. } crypto/o_str.c:130:5: 128. if (ret != NULL) 129. strcpy(ret, str); 130. > return ret; 131. } 132. crypto/o_str.c:131:1: return from a call to CRYPTO_strdup 129. strcpy(ret, str); 130. return ret; 131. > } 132. 133. char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line) crypto/x509v3/v3_utl.c:91:18: Taking false branch 89. if (name && (tname = OPENSSL_strdup(name)) == NULL) 90. goto err; 91. if (value && (tvalue = OPENSSL_strdup(value)) == NULL) ^ 92. goto err; 93. if ((vtmp = OPENSSL_malloc(sizeof(*vtmp))) == NULL) crypto/x509v3/v3_utl.c:93:9: 91. if (value && (tvalue = OPENSSL_strdup(value)) == NULL) 92. goto err; 93. > if ((vtmp = OPENSSL_malloc(sizeof(*vtmp))) == NULL) 94. goto err; 95. if (*extlist == NULL && (*extlist = sk_CONF_VALUE_new_null()) == 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/x509v3/v3_utl.c:93:9: Taking false branch 91. if (value && (tvalue = OPENSSL_strdup(value)) == NULL) 92. goto err; 93. if ((vtmp = OPENSSL_malloc(sizeof(*vtmp))) == NULL) ^ 94. goto err; 95. if (*extlist == NULL && (*extlist = sk_CONF_VALUE_new_null()) == NULL) crypto/x509v3/v3_utl.c:95:9: Taking false branch 93. if ((vtmp = OPENSSL_malloc(sizeof(*vtmp))) == NULL) 94. goto err; 95. if (*extlist == NULL && (*extlist = sk_CONF_VALUE_new_null()) == NULL) ^ 96. goto err; 97. vtmp->section = NULL; crypto/x509v3/v3_utl.c:97:5: 95. if (*extlist == NULL && (*extlist = sk_CONF_VALUE_new_null()) == NULL) 96. goto err; 97. > vtmp->section = NULL; 98. vtmp->name = tname; 99. vtmp->value = tvalue; crypto/x509v3/v3_utl.c:98:5: 96. goto err; 97. vtmp->section = NULL; 98. > vtmp->name = tname; 99. vtmp->value = tvalue; 100. if (!sk_CONF_VALUE_push(*extlist, vtmp)) crypto/x509v3/v3_utl.c:99:5: 97. vtmp->section = NULL; 98. vtmp->name = tname; 99. > vtmp->value = tvalue; 100. if (!sk_CONF_VALUE_push(*extlist, vtmp)) 101. goto err; crypto/x509v3/v3_utl.c:100:10: 98. vtmp->name = tname; 99. vtmp->value = tvalue; 100. > if (!sk_CONF_VALUE_push(*extlist, vtmp)) 101. goto err; 102. return 1; include/openssl/conf.h:80:1: start of procedure sk_CONF_VALUE_push() 78. } CONF_VALUE; 79. 80. > DEFINE_STACK_OF(CONF_VALUE) 81. DECLARE_LHASH_OF(CONF_VALUE); 82. crypto/stack/stack.c:259:1: start of procedure sk_push() 257. } 258. 259. > int sk_push(_STACK *st, void *data) 260. { 261. return (sk_insert(st, data, st->num)); crypto/stack/stack.c:261:5: 259. int sk_push(_STACK *st, void *data) 260. { 261. > return (sk_insert(st, data, st->num)); 262. } 263. crypto/stack/stack.c:167:1: start of procedure sk_insert() 165. } 166. 167. > int sk_insert(_STACK *st, void *data, int loc) 168. { 169. char **s; crypto/stack/stack.c:171:9: Taking false branch 169. char **s; 170. 171. if (st == NULL) ^ 172. return 0; 173. if (st->num_alloc <= st->num + 1) { crypto/stack/stack.c:173:9: Taking true branch 171. if (st == NULL) 172. return 0; 173. if (st->num_alloc <= st->num + 1) { ^ 174. s = OPENSSL_realloc((char *)st->data, 175. (unsigned int)sizeof(char *) * st->num_alloc * 2); crypto/stack/stack.c:174:9: 172. return 0; 173. if (st->num_alloc <= st->num + 1) { 174. > s = OPENSSL_realloc((char *)st->data, 175. (unsigned int)sizeof(char *) * st->num_alloc * 2); 176. if (s == NULL) crypto/mem.c:166:1: start of procedure CRYPTO_realloc() 164. } 165. 166. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) 167. { 168. if (str == NULL) crypto/mem.c:168:9: Taking true branch 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) 167. { 168. if (str == NULL) ^ 169. return CRYPTO_malloc(num, file, line); 170. crypto/mem.c:169:9: 167. { 168. if (str == NULL) 169. > return CRYPTO_malloc(num, file, line); 170. 171. if (num == 0) { crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:191:1: return from a call to CRYPTO_realloc 189. return realloc(str, num); 190. 191. > } 192. 193. void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num, crypto/stack/stack.c:176:13: Taking false branch 174. s = OPENSSL_realloc((char *)st->data, 175. (unsigned int)sizeof(char *) * st->num_alloc * 2); 176. if (s == NULL) ^ 177. return (0); 178. st->data = s; crypto/stack/stack.c:178:9: 176. if (s == NULL) 177. return (0); 178. > st->data = s; 179. st->num_alloc *= 2; 180. } crypto/stack/stack.c:179:9: 177. return (0); 178. st->data = s; 179. > st->num_alloc *= 2; 180. } 181. if ((loc >= (int)st->num) || (loc < 0)) crypto/stack/stack.c:181:10: Taking true branch 179. st->num_alloc *= 2; 180. } 181. if ((loc >= (int)st->num) || (loc < 0)) ^ 182. st->data[st->num] = data; 183. else { crypto/stack/stack.c:182:9: 180. } 181. if ((loc >= (int)st->num) || (loc < 0)) 182. > st->data[st->num] = data; 183. else { 184. memmove(&(st->data[loc + 1]), crypto/stack/stack.c:188:5: 186. st->data[loc] = data; 187. } 188. > st->num++; 189. st->sorted = 0; 190. return (st->num); crypto/stack/stack.c:189:5: 187. } 188. st->num++; 189. > st->sorted = 0; 190. return (st->num); 191. } crypto/stack/stack.c:190:5: 188. st->num++; 189. st->sorted = 0; 190. > return (st->num); 191. } 192. crypto/stack/stack.c:191:1: return from a call to sk_insert 189. st->sorted = 0; 190. return (st->num); 191. > } 192. 193. void *sk_delete_ptr(_STACK *st, void *p) crypto/stack/stack.c:262:1: return from a call to sk_push 260. { 261. return (sk_insert(st, data, st->num)); 262. > } 263. 264. int sk_unshift(_STACK *st, void *data) include/openssl/conf.h:80:1: return from a call to sk_CONF_VALUE_push 78. } CONF_VALUE; 79. 80. > DEFINE_STACK_OF(CONF_VALUE) 81. DECLARE_LHASH_OF(CONF_VALUE); 82. crypto/x509v3/v3_utl.c:100:10: Taking false branch 98. vtmp->name = tname; 99. vtmp->value = tvalue; 100. if (!sk_CONF_VALUE_push(*extlist, vtmp)) ^ 101. goto err; 102. return 1; crypto/x509v3/v3_utl.c:102:5: 100. if (!sk_CONF_VALUE_push(*extlist, vtmp)) 101. goto err; 102. > return 1; 103. err: 104. X509V3err(X509V3_F_X509V3_ADD_VALUE, ERR_R_MALLOC_FAILURE); crypto/x509v3/v3_utl.c:109:1: return from a call to X509V3_add_value 107. OPENSSL_free(tvalue); 108. return 0; 109. > } 110. 111. int X509V3_add_value_uchar(const char *name, const unsigned char *value,
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/x509v3/v3_bitst.c/#L103
d2a_code_trace_data_43410
SSL *SSL_new(SSL_CTX *ctx) { SSL *s; if (ctx == NULL) { SSLerr(SSL_F_SSL_NEW, SSL_R_NULL_SSL_CTX); return (NULL); } if (ctx->method == NULL) { SSLerr(SSL_F_SSL_NEW, SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION); return (NULL); } s = OPENSSL_zalloc(sizeof(*s)); if (s == NULL) goto err; s->lock = CRYPTO_THREAD_lock_new(); if (s->lock == NULL) { SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE); OPENSSL_free(s); return NULL; } RECORD_LAYER_init(&s->rlayer, s); s->options = ctx->options; s->dane.flags = ctx->dane.flags; s->min_proto_version = ctx->min_proto_version; s->max_proto_version = ctx->max_proto_version; s->mode = ctx->mode; s->max_cert_list = ctx->max_cert_list; s->references = 1; s->cert = ssl_cert_dup(ctx->cert); if (s->cert == NULL) goto err; RECORD_LAYER_set_read_ahead(&s->rlayer, ctx->read_ahead); s->msg_callback = ctx->msg_callback; s->msg_callback_arg = ctx->msg_callback_arg; s->verify_mode = ctx->verify_mode; s->not_resumable_session_cb = ctx->not_resumable_session_cb; s->sid_ctx_length = ctx->sid_ctx_length; OPENSSL_assert(s->sid_ctx_length <= sizeof s->sid_ctx); memcpy(&s->sid_ctx, &ctx->sid_ctx, sizeof(s->sid_ctx)); s->verify_callback = ctx->default_verify_callback; s->generate_session_id = ctx->generate_session_id; s->param = X509_VERIFY_PARAM_new(); if (s->param == NULL) goto err; X509_VERIFY_PARAM_inherit(s->param, ctx->param); s->quiet_shutdown = ctx->quiet_shutdown; s->max_send_fragment = ctx->max_send_fragment; s->split_send_fragment = ctx->split_send_fragment; s->max_pipelines = ctx->max_pipelines; if (s->max_pipelines > 1) RECORD_LAYER_set_read_ahead(&s->rlayer, 1); if (ctx->default_read_buf_len > 0) SSL_set_default_read_buffer_len(s, ctx->default_read_buf_len); SSL_CTX_up_ref(ctx); s->ctx = ctx; s->tlsext_debug_cb = 0; s->tlsext_debug_arg = NULL; s->tlsext_ticket_expected = 0; s->tlsext_status_type = ctx->tlsext_status_type; s->tlsext_status_expected = 0; s->tlsext_ocsp_ids = NULL; s->tlsext_ocsp_exts = NULL; s->tlsext_ocsp_resp = NULL; s->tlsext_ocsp_resplen = -1; SSL_CTX_up_ref(ctx); s->initial_ctx = ctx; # ifndef OPENSSL_NO_EC if (ctx->tlsext_ecpointformatlist) { s->tlsext_ecpointformatlist = OPENSSL_memdup(ctx->tlsext_ecpointformatlist, ctx->tlsext_ecpointformatlist_length); if (!s->tlsext_ecpointformatlist) goto err; s->tlsext_ecpointformatlist_length = ctx->tlsext_ecpointformatlist_length; } if (ctx->tlsext_ellipticcurvelist) { s->tlsext_ellipticcurvelist = OPENSSL_memdup(ctx->tlsext_ellipticcurvelist, ctx->tlsext_ellipticcurvelist_length); if (!s->tlsext_ellipticcurvelist) goto err; s->tlsext_ellipticcurvelist_length = ctx->tlsext_ellipticcurvelist_length; } # endif # ifndef OPENSSL_NO_NEXTPROTONEG s->next_proto_negotiated = NULL; # endif if (s->ctx->alpn_client_proto_list) { s->alpn_client_proto_list = OPENSSL_malloc(s->ctx->alpn_client_proto_list_len); if (s->alpn_client_proto_list == NULL) goto err; memcpy(s->alpn_client_proto_list, s->ctx->alpn_client_proto_list, s->ctx->alpn_client_proto_list_len); s->alpn_client_proto_list_len = s->ctx->alpn_client_proto_list_len; } s->verified_chain = NULL; s->verify_result = X509_V_OK; s->default_passwd_callback = ctx->default_passwd_callback; s->default_passwd_callback_userdata = ctx->default_passwd_callback_userdata; s->method = ctx->method; if (!s->method->ssl_new(s)) goto err; s->server = (ctx->method->ssl_accept == ssl_undefined_function) ? 0 : 1; if (!SSL_clear(s)) goto err; if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL, s, &s->ex_data)) goto err; #ifndef OPENSSL_NO_PSK s->psk_client_callback = ctx->psk_client_callback; s->psk_server_callback = ctx->psk_server_callback; #endif s->job = NULL; #ifndef OPENSSL_NO_CT if (!SSL_set_ct_validation_callback(s, ctx->ct_validation_callback, ctx->ct_validation_callback_arg)) goto err; #endif return s; err: SSL_free(s); SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE); return NULL; } ssl/ssl_lib.c:546: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_THREAD_lock_new()` at line 539, column 15 is not reachable after line 546, column 5. Showing all 46 steps of the trace ssl/ssl_lib.c:522:1: start of procedure SSL_new() 520. } 521. 522. > SSL *SSL_new(SSL_CTX *ctx) 523. { 524. SSL *s; ssl/ssl_lib.c:526:9: Taking false branch 524. SSL *s; 525. 526. if (ctx == NULL) { ^ 527. SSLerr(SSL_F_SSL_NEW, SSL_R_NULL_SSL_CTX); 528. return (NULL); ssl/ssl_lib.c:530:9: Taking false branch 528. return (NULL); 529. } 530. if (ctx->method == NULL) { ^ 531. SSLerr(SSL_F_SSL_NEW, SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION); 532. return (NULL); ssl/ssl_lib.c:535:5: 533. } 534. 535. > s = OPENSSL_zalloc(sizeof(*s)); 536. if (s == NULL) 537. goto err; 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) ssl/ssl_lib.c:536:9: Taking false branch 534. 535. s = OPENSSL_zalloc(sizeof(*s)); 536. if (s == NULL) ^ 537. goto err; 538. ssl/ssl_lib.c:539:5: 537. goto err; 538. 539. > s->lock = CRYPTO_THREAD_lock_new(); 540. if (s->lock == NULL) { 541. SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE); crypto/threads_pthread.c:14:1: start of procedure CRYPTO_THREAD_lock_new() 12. #if defined(OPENSSL_THREADS) && !defined(CRYPTO_TDEBUG) && !defined(OPENSSL_SYS_WINDOWS) 13. 14. > CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void) 15. { 16. CRYPTO_RWLOCK *lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t)); crypto/threads_pthread.c:16:5: 14. CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void) 15. { 16. > CRYPTO_RWLOCK *lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t)); 17. if (lock == NULL) 18. return NULL; crypto/mem.c:98:1: start of procedure CRYPTO_zalloc() 96. } 97. 98. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 99. { 100. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:100:5: 98. void *CRYPTO_zalloc(size_t num, const char *file, int line) 99. { 100. > void *ret = CRYPTO_malloc(num, file, line); 101. 102. if (ret != NULL) crypto/mem.c:71:1: start of procedure CRYPTO_malloc() 69. } 70. 71. > void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. void *ret = NULL; crypto/mem.c:73:5: 71. void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. > void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:75:9: Taking false branch 73. void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 76. return malloc_impl(num, file, line); 77. crypto/mem.c:78:9: Taking false branch 76. return malloc_impl(num, file, line); 77. 78. if (num <= 0) ^ 79. return NULL; 80. crypto/mem.c:81:5: 79. return NULL; 80. 81. > allow_customize = 0; 82. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 83. if (call_malloc_debug) { crypto/mem.c:91:5: 89. } 90. #else 91. > osslargused(file); osslargused(line); 92. ret = malloc(num); 93. #endif crypto/mem.c:91:24: 89. } 90. #else 91. > osslargused(file); osslargused(line); 92. ret = malloc(num); 93. #endif crypto/mem.c:92:5: 90. #else 91. osslargused(file); osslargused(line); 92. > ret = malloc(num); 93. #endif 94. crypto/mem.c:95:5: 93. #endif 94. 95. > return ret; 96. } 97. crypto/mem.c:96:1: return from a call to CRYPTO_malloc 94. 95. return ret; 96. > } 97. 98. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:102:9: Taking true branch 100. void *ret = CRYPTO_malloc(num, file, line); 101. 102. if (ret != NULL) ^ 103. memset(ret, 0, num); 104. return ret; crypto/mem.c:103:9: 101. 102. if (ret != NULL) 103. > memset(ret, 0, num); 104. return ret; 105. } crypto/mem.c:104:5: 102. if (ret != NULL) 103. memset(ret, 0, num); 104. > return ret; 105. } 106. crypto/mem.c:105:1: return from a call to CRYPTO_zalloc 103. memset(ret, 0, num); 104. return ret; 105. > } 106. 107. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/threads_pthread.c:17:9: Taking false branch 15. { 16. CRYPTO_RWLOCK *lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t)); 17. if (lock == NULL) ^ 18. return NULL; 19. crypto/threads_pthread.c:20:9: Taking false branch 18. return NULL; 19. 20. if (pthread_rwlock_init(lock, NULL) != 0) { ^ 21. OPENSSL_free(lock); 22. return NULL; crypto/threads_pthread.c:25:5: 23. } 24. 25. > return lock; 26. } 27. crypto/threads_pthread.c:26:1: return from a call to CRYPTO_THREAD_lock_new 24. 25. return lock; 26. > } 27. 28. int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock) ssl/ssl_lib.c:540:9: Taking false branch 538. 539. s->lock = CRYPTO_THREAD_lock_new(); 540. if (s->lock == NULL) { ^ 541. SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE); 542. OPENSSL_free(s); ssl/ssl_lib.c:546:5: Skipping RECORD_LAYER_init(): empty list of specs 544. } 545. 546. RECORD_LAYER_init(&s->rlayer, s); ^ 547. 548. s->options = ctx->options;
https://github.com/openssl/openssl/blob/3307000d9852acac98ebc1b82cacc9b14240d798/ssl/ssl_lib.c/#L546
d2a_code_trace_data_43411
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/recordlentest.c:180: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `SSL_free`. Showing all 17 steps of the trace test/recordlentest.c:121:10: Call 119. } 120. 121. if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, ^ 122. NULL, NULL))) 123. goto end; test/ssltestlib.c:559:15: Call 557. if (*sssl != NULL) 558. serverssl = *sssl; 559. else if (!TEST_ptr(serverssl = SSL_new(serverctx))) ^ 560. goto error; 561. if (*cssl != NULL) ssl/ssl_lib.c:522:1: Parameter `ctx->sessions->num_items` 520. } 521. 522. > SSL *SSL_new(SSL_CTX *ctx) 523. { 524. SSL *s; test/recordlentest.c:180:5: Call 178. 179. end: 180. SSL_free(serverssl); ^ 181. SSL_free(clientssl); 182. SSL_CTX_free(sctx); ssl/ssl_lib.c:968:1: Parameter `s->session_ctx->sessions->num_items` 966. } 967. 968. > void SSL_free(SSL *s) 969. { 970. int i; ssl/ssl_lib.c:999:9: Call 997. /* Make the next call work :-) */ 998. if (s->session != NULL) { 999. ssl_clear_bad_session(s); ^ 1000. SSL_SESSION_free(s->session); 1001. } ssl/ssl_sess.c:1049:1: Parameter `s->session_ctx->sessions->num_items` 1047. } 1048. 1049. > int ssl_clear_bad_session(SSL *s) 1050. { 1051. if ((s->session != NULL) && ssl/ssl_sess.c:1054:9: Call 1052. !(s->shutdown & SSL_SENT_SHUTDOWN) && 1053. !(SSL_in_init(s) || SSL_in_before(s))) { 1054. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 1055. return (1); 1056. } else ssl/ssl_sess.c:725:1: Parameter `ctx->sessions->num_items` 723. } 724. 725. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 726. { 727. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:727:12: Call 725. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 726. { 727. return remove_session_lock(ctx, c, 1); ^ 728. } 729. ssl/ssl_sess.c:730:1: Parameter `ctx->sessions->num_items` 728. } 729. 730. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 731. { 732. SSL_SESSION *r; ssl/ssl_sess.c:740:17: Call 738. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 739. ret = 1; 740. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 741. SSL_SESSION_list_remove(ctx, c); 742. } ssl/ssl_locl.h:721:1: Parameter `lh->num_items` 719. } TLSEXT_INDEX; 720. 721. > DEFINE_LHASH_OF(SSL_SESSION); 722. /* Needed in ssl_cert.c */ 723. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:721:1: Call 719. } TLSEXT_INDEX; 720. 721. > DEFINE_LHASH_OF(SSL_SESSION); 722. /* Needed in ssl_cert.c */ 723. 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, +oo] - 1):unsigned64 by call to `SSL_free` 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/7f7eb90b8ac55997c5c825bb3ebcfe28611e06f5/crypto/lhash/lhash.c/#L123
d2a_code_trace_data_43412
void *lh_delete(LHASH *lh, const void *data) { unsigned long hash; LHASH_NODE *nn,**rn; const 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((void *)ret); } ssl/s3_clnt.c:234: error: INTEGER_OVERFLOW_L2 ([0, `s->ctx->sessions->num_items`] - 1):unsigned64 by call to `ssl3_check_cert_and_algorithm`. Showing all 17 steps of the trace ssl/s3_clnt.c:106:1: Parameter `s->ctx->sessions->num_items` 104. } 105. 106. > int ssl3_connect(SSL *s) 107. { 108. BUF_MEM *buf; ssl/s3_clnt.c:227:8: Call 225. case SSL3_ST_CR_KEY_EXCH_A: 226. case SSL3_ST_CR_KEY_EXCH_B: 227. ret=ssl3_get_key_exchange(s); ^ 228. if (ret <= 0) goto end; 229. s->state=SSL3_ST_CR_CERT_REQ_A; ssl/s3_clnt.c:870:1: Parameter `s->ctx->sessions->num_items` 868. } 869. 870. > static int ssl3_get_key_exchange(SSL *s) 871. { 872. #ifndef OPENSSL_NO_RSA ssl/s3_clnt.c:889:4: Call 887. /* use same message size as in ssl3_get_certificate_request() 888. * as ServerKeyExchange message may be skipped */ 889. n=ssl3_get_message(s, ^ 890. SSL3_ST_CR_KEY_EXCH_A, 891. SSL3_ST_CR_KEY_EXCH_B, ssl/s3_both.c:337:1: Parameter `s->ctx->sessions->num_items` 335. * the body is read in state 'stn'. 336. */ 337. > long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok) 338. { 339. unsigned char *p; ssl/s3_clnt.c:234:9: Call 232. /* at this point we check that we have the 233. * required stuff from the server */ 234. if (!ssl3_check_cert_and_algorithm(s)) ^ 235. { 236. ret= -1; ssl/s3_clnt.c:1792:1: Parameter `s->ctx->sessions->num_items` 1790. #define has_bits(i,m) (((i)&(m)) == (m)) 1791. 1792. > static int ssl3_check_cert_and_algorithm(SSL *s) 1793. { 1794. int i,idx; ssl/s3_clnt.c:1909:2: Call 1907. return(1); 1908. f_err: 1909. ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_HANDSHAKE_FAILURE); ^ 1910. err: 1911. return(0); ssl/s3_pkt.c:1155:1: Parameter `s->ctx->sessions->num_items` 1153. } 1154. 1155. > void ssl3_send_alert(SSL *s, int level, int desc) 1156. { 1157. /* Map tls/ssl alert value to correct one */ ssl/s3_pkt.c:1162:3: Call 1160. /* If a fatal one, remove from cache */ 1161. if ((level == 2) && (s->session != NULL)) 1162. SSL_CTX_remove_session(s->ctx,s->session); ^ 1163. 1164. s->s3->alert_dispatch=1; ssl/ssl_sess.c:468:1: Parameter `ctx->sessions->num_items` 466. } 467. 468. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 469. { 470. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:470:9: Call 468. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 469. { 470. return remove_session_lock(ctx, c, 1); ^ 471. } 472. ssl/ssl_sess.c:473:1: Parameter `ctx->sessions->num_items` 471. } 472. 473. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 474. { 475. SSL_SESSION *r; ssl/ssl_sess.c:481:20: Call 479. { 480. if(lck) CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX); 481. r=(SSL_SESSION *)lh_delete(ctx->sessions,c); ^ 482. if (r != NULL) 483. { 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, s->ctx->sessions->num_items] - 1):unsigned64 by call to `ssl3_check_cert_and_algorithm` 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/9e09eebf94c933686077a1b1b2d60248acb9ba67/crypto/lhash/lhash.c/#L240
d2a_code_trace_data_43413
void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, MPA_INT *window, int *dither_state, OUT_INT *samples, int incr, int32_t sb_samples[SBLIMIT]) { int32_t tmp[32]; register MPA_INT *synth_buf; register const MPA_INT *w, *w2, *p; int j, offset, v; OUT_INT *samples2; #if FRAC_BITS <= 15 int sum, sum2; #else int64_t sum, sum2; #endif dct32(tmp, sb_samples); offset = *synth_buf_offset; synth_buf = synth_buf_ptr + offset; for(j=0;j<32;j++) { v = tmp[j]; #if FRAC_BITS <= 15 v = av_clip_int16(v); #endif synth_buf[j] = v; } memcpy(synth_buf + 512, synth_buf, 32 * sizeof(MPA_INT)); samples2 = samples + 31 * incr; w = window; w2 = window + 31; sum = *dither_state; p = synth_buf + 16; SUM8(sum, +=, w, p); p = synth_buf + 48; SUM8(sum, -=, w + 32, p); *samples = round_sample(&sum); samples += incr; w++; for(j=1;j<16;j++) { sum2 = 0; p = synth_buf + 16 + j; SUM8P2(sum, +=, sum2, -=, w, w2, p); p = synth_buf + 48 - j; SUM8P2(sum, -=, sum2, -=, w + 32, w2 + 32, p); *samples = round_sample(&sum); samples += incr; sum += sum2; *samples2 = round_sample(&sum); samples2 -= incr; w++; w2--; } p = synth_buf + 32; SUM8(sum, -=, w + 32, p); *samples = round_sample(&sum); *dither_state= sum; offset = (offset - 32) & 511; *synth_buf_offset = offset; } libavcodec/mpc.c:60: error: Buffer Overrun L2 Offset: [417+min(0, `c->synth_buf_offset[*]`), 432+max(511, `c->synth_buf_offset[*]`)] (⇐ [33+min(0, `c->synth_buf_offset[*]`), 48+max(511, `c->synth_buf_offset[*]`)] + 384) Size: 2 by call to `ff_mpa_synth_filter`. libavcodec/mpc.c:51:1: Parameter `c->synth_buf[*]` 49. * Process decoded Musepack data and produce PCM 50. */ 51. static void mpc_synth(MPCContext *c, int16_t *out) ^ 52. { 53. int dither_state = 0; libavcodec/mpc.c:60:13: Call 58. samples_ptr = samples + ch; 59. for(i = 0; i < SAMPLES_PER_BAND; i++) { 60. ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]), ^ 61. mpa_window, &dither_state, 62. samples_ptr, 2, libavcodec/mpegaudiodec.c:906:9: <Length trace> 904. /* we calculate two samples at the same time to avoid one memory 905. access per two sample */ 906. for(j=1;j<16;j++) { ^ 907. sum2 = 0; 908. p = synth_buf + 16 + j; libavcodec/mpegaudiodec.c:906:9: Assignment 904. /* we calculate two samples at the same time to avoid one memory 905. access per two sample */ 906. for(j=1;j<16;j++) { ^ 907. sum2 = 0; 908. p = synth_buf + 16 + j; libavcodec/mpegaudiodec.c:910:9: Assignment 908. p = synth_buf + 16 + j; 909. SUM8P2(sum, +=, sum2, -=, w, w2, p); 910. p = synth_buf + 48 - j; ^ 911. SUM8P2(sum, -=, sum2, -=, w + 32, w2 + 32, p); 912. libavcodec/mpegaudiodec.c:911:9: Array access: Offset: [417+min(0, c->synth_buf_offset[*]), 432+max(511, c->synth_buf_offset[*])] (⇐ [33+min(0, c->synth_buf_offset[*]), 48+max(511, c->synth_buf_offset[*])] + 384) Size: 2 by call to `ff_mpa_synth_filter` 909. SUM8P2(sum, +=, sum2, -=, w, w2, p); 910. p = synth_buf + 48 - j; 911. SUM8P2(sum, -=, sum2, -=, w + 32, w2 + 32, p); ^ 912. 913. *samples = round_sample(&sum);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L911
d2a_code_trace_data_43414
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/sslapitest.c:1257: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `SSL_free`. Showing all 19 steps of the trace test/sslapitest.c:1095:10: Call 1093. numnewsesstick = 2; 1094. 1095. if (!TEST_true(create_ssl_ctx_pair(TLS_server_method(), TLS_client_method(), ^ 1096. TLS1_VERSION, 0, 1097. &sctx, &cctx, cert, privkey))) test/ssltestlib.c:619:10: Call 617. SSL_CTX *clientctx = NULL; 618. 619. if (!TEST_ptr(serverctx = SSL_CTX_new(sm)) ^ 620. || (cctx != NULL && !TEST_ptr(clientctx = SSL_CTX_new(cm)))) 621. goto err; ssl/ssl_lib.c:2942:21: Call 2940. goto err; 2941. 2942. ret->sessions = lh_SSL_SESSION_new(ssl_session_hash, ssl_session_cmp); ^ 2943. if (ret->sessions == NULL) 2944. goto err; ssl/ssl_locl.h:736:1: Call 734. } TLSEXT_INDEX; 735. 736. > DEFINE_LHASH_OF(SSL_SESSION); 737. /* Needed in ssl_cert.c */ 738. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:63:5: Assignment 61. ret->comp = ((c == NULL) ? (OPENSSL_LH_COMPFUNC)strcmp : c); 62. ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h); 63. ret->num_nodes = MIN_NODES / 2; ^ 64. ret->num_alloc_nodes = MIN_NODES; 65. ret->pmax = MIN_NODES / 2; test/sslapitest.c:1257:5: Call 1255. 1256. SSL_free(serverssl1); 1257. SSL_free(clientssl1); ^ 1258. serverssl1 = clientssl1 = NULL; 1259. SSL_free(serverssl2); ssl/ssl_lib.c:1134:1: Parameter `s->ctx->sessions->num_nodes` 1132. } 1133. 1134. > void SSL_free(SSL *s) 1135. { 1136. int i; ssl/ssl_lib.c:1209:5: Call 1207. s->method->ssl_free(s); 1208. 1209. SSL_CTX_free(s->ctx); ^ 1210. 1211. ASYNC_WAIT_CTX_free(s->waitctx); ssl/ssl_lib.c:3103:1: Parameter `a->sessions->num_nodes` 3101. } 3102. 3103. > void SSL_CTX_free(SSL_CTX *a) 3104. { 3105. int i; ssl/ssl_lib.c:3129:9: Call 3127. */ 3128. if (a->sessions != NULL) 3129. SSL_CTX_flush_sessions(a, 0); ^ 3130. 3131. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:1106:1: Parameter `s->sessions->num_nodes` 1104. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1105. 1106. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 1107. { 1108. unsigned long i; ssl/ssl_sess.c:1119:5: Call 1117. i = lh_SSL_SESSION_get_down_load(s->sessions); 1118. lh_SSL_SESSION_set_down_load(s->sessions, 0); 1119. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp); ^ 1120. lh_SSL_SESSION_set_down_load(s->sessions, i); 1121. CRYPTO_THREAD_unlock(s->lock); ssl/ssl_sess.c:1104:1: Parameter `lh->num_nodes` 1102. } 1103. 1104. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1105. 1106. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) ssl/ssl_sess.c:1104:1: Call 1102. } 1103. 1104. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1105. 1106. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) crypto/lhash/lhash.c:209:1: Parameter `lh->num_nodes` 207. } 208. 209. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 210. { 211. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); crypto/lhash/lhash.c:211:5: Call 209. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 210. { 211. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); ^ 212. } 213. crypto/lhash/lhash.c:177:1: <LHS trace> 175. } 176. 177. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 178. OPENSSL_LH_DOALL_FUNC func, 179. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:177:1: Parameter `lh->num_nodes` 175. } 176. 177. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 178. OPENSSL_LH_DOALL_FUNC func, 179. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:191:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `SSL_free` 189. * memory leaks otherwise 190. */ 191. for (i = lh->num_nodes - 1; i >= 0; i--) { ^ 192. a = lh->b[i]; 193. while (a != NULL) {
https://github.com/openssl/openssl/blob/6e94b5aecd619afd25e3dc25902952b1b3194edf/crypto/lhash/lhash.c/#L191
d2a_code_trace_data_43415
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); } crypto/asn1/d2i_pu.c:115: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `o2i_ECPublicKey`. Showing all 26 steps of the trace crypto/asn1/d2i_pu.c:115:14: Call 113. #ifndef OPENSSL_NO_EC 114. case EVP_PKEY_EC: 115. if (!o2i_ECPublicKey(&ret->pkey.ec, pp, length)) { ^ 116. ASN1err(ASN1_F_D2I_PUBLICKEY, ERR_R_ASN1_LIB); 117. goto err; crypto/ec/ec_asn1.c:1233:1: Parameter `(*a)->group->field->top` 1231. } 1232. 1233. > EC_KEY *o2i_ECPublicKey(EC_KEY **a, const unsigned char **in, long len) 1234. { 1235. EC_KEY *ret = NULL; crypto/ec/ec_asn1.c:1250:10: Call 1248. return 0; 1249. } 1250. if (!EC_POINT_oct2point(ret->group, ret->pub_key, *in, len, NULL)) { ^ 1251. ECerr(EC_F_O2I_ECPUBLICKEY, ERR_R_EC_LIB); 1252. return 0; crypto/ec/ec_oct.c:166:1: Parameter `group->field->top` 164. } 165. 166. > int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point, 167. const unsigned char *buf, size_t len, BN_CTX *ctx) 168. { crypto/ec/ec_oct.c:188:20: Call 186. } 187. #else 188. return ec_GF2m_simple_oct2point(group, point, buf, len, ctx); ^ 189. #endif 190. } crypto/ec/ec2_oct.c:294:1: Parameter `group->field->top` 292. * simple implementation only uses affine coordinates. 293. */ 294. > int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point, 295. const unsigned char *buf, size_t len, 296. BN_CTX *ctx) crypto/ec/ec2_oct.c:363:14: Call 361. 362. if (form == POINT_CONVERSION_COMPRESSED) { 363. if (!EC_POINT_set_compressed_coordinates_GF2m ^ 364. (group, point, x, y_bit, ctx)) 365. goto err; crypto/ec/ec_oct.c:107:1: Parameter `group->field->top` 105. 106. #ifndef OPENSSL_NO_EC2M 107. > int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, 108. EC_POINT *point, const BIGNUM *x, 109. int y_bit, BN_CTX *ctx) crypto/ec/ec_oct.c:124:20: Call 122. if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) { 123. if (group->meth->field_type == NID_X9_62_prime_field) 124. return ec_GFp_simple_set_compressed_coordinates(group, point, x, ^ 125. y_bit, ctx); 126. else crypto/ec/ecp_oct.c:71:1: Parameter `group->field->top` 69. #include "ec_lcl.h" 70. 71. > int ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group, 72. EC_POINT *point, 73. const BIGNUM *x_, int y_bit, crypto/ec/ecp_oct.c:106:10: Call 104. 105. /* tmp1 := x^3 */ 106. if (!BN_nnmod(x, x_, group->field, ctx)) ^ 107. goto err; 108. if (group->meth->field_decode == 0) { crypto/bn/bn_mod.c:119:1: Parameter `d->top` 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:254:31: Call 252. 253. /* First we normalise the numbers */ 254. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 255. if (!(BN_lshift(sdiv, divisor, norm_shift))) 256. goto err; crypto/bn/bn_lib.c:221:9: Assignment 219. 220. if (BN_is_zero(a)) 221. return 0; ^ 222. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); 223. } crypto/bn/bn_div.c:254:5: Assignment 252. 253. /* First we normalise the numbers */ 254. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 255. if (!(BN_lshift(sdiv, divisor, norm_shift))) 256. goto err; crypto/bn/bn_div.c:255:11: Call 253. /* First we normalise the numbers */ 254. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); 255. if (!(BN_lshift(sdiv, divisor, norm_shift))) ^ 256. goto err; 257. sdiv->neg = 0; crypto/bn/bn_shift.c:130:1: <Offset trace> 128. } 129. 130. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 131. { 132. int i, nw, lb, rb; crypto/bn/bn_shift.c:130:1: Parameter `n` 128. } 129. 130. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 131. { 132. int i, nw, lb, rb; crypto/bn/bn_shift.c:145:5: Assignment 143. 144. r->neg = a->neg; 145. nw = n / BN_BITS2; ^ 146. if (bn_wexpand(r, a->top + nw + 1) == NULL) 147. return (0); crypto/bn/bn_shift.c:130:1: <Length trace> 128. } 129. 130. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 131. { 132. int i, nw, lb, rb; crypto/bn/bn_shift.c:130:1: Parameter `*r->d` 128. } 129. 130. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 131. { 132. int i, nw, lb, rb; crypto/bn/bn_shift.c:146:9: Call 144. r->neg = a->neg; 145. nw = n / BN_BITS2; 146. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 147. return (0); 148. lb = n % BN_BITS2; crypto/bn/bn_lib.c:995:1: Parameter `*a->d` 993. } 994. 995. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 996. { 997. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:151:5: Assignment 149. rb = BN_BITS2 - lb; 150. f = a->d; 151. t = r->d; ^ 152. t[a->top + nw] = 0; 153. if (lb == 0) crypto/bn/bn_shift.c:159:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `o2i_ECPublicKey` 157. for (i = a->top - 1; i >= 0; i--) { 158. l = f[i]; 159. t[nw + i + 1] |= (l >> rb) & BN_MASK2; ^ 160. t[nw + i] = (l << lb) & BN_MASK2; 161. }
https://github.com/openssl/openssl/blob/bb56561adbb6d2728b05e2df08c0575c38a46249/crypto/bn/bn_shift.c/#L159
d2a_code_trace_data_43416
static ossl_inline size_t constant_time_lt_s(size_t a, size_t b) { return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b))); } ssl/record/ssl3_record.c:1433: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [1, 64]):unsigned64 by call to `ssl3_cbc_copy_mac`. Showing all 10 steps of the trace ssl/record/ssl3_record.c:1308:1: Parameter `s->rlayer.rrec.length` 1306. } 1307. 1308. > int dtls1_process_record(SSL *s, DTLS1_BITMAP *bitmap) 1309. { 1310. int i, al; ssl/record/ssl3_record.c:1348:5: Assignment 1346. /* decrypt in place in 'rr->input' */ 1347. rr->data = rr->input; 1348. rr->orig_len = rr->length; ^ 1349. 1350. if (SSL_USE_ETM(s) && s->read_hash) { ssl/record/ssl3_record.c:1433:13: Call 1431. */ 1432. mac = mac_tmp; 1433. ssl3_cbc_copy_mac(mac_tmp, rr, mac_size); ^ 1434. rr->length -= mac_size; 1435. } else { ssl/record/ssl3_record.c:1231:1: Parameter `md_size` 1229. #define CBC_MAC_ROTATE_IN_PLACE 1230. 1231. > void ssl3_cbc_copy_mac(unsigned char *out, 1232. const SSL3_RECORD *rec, size_t md_size) 1233. { ssl/record/ssl3_record.c:1293:26: Call 1291. ((volatile unsigned char *)rotated_mac)[rotate_offset ^ 32]; 1292. out[j++] = rotated_mac[rotate_offset++]; 1293. rotate_offset &= constant_time_lt_s(rotate_offset, md_size); ^ 1294. } 1295. #else include/internal/constant_time_locl.h:117:1: <LHS trace> 115. } 116. 117. > static ossl_inline size_t constant_time_lt_s(size_t a, size_t b) 118. { 119. return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b))); include/internal/constant_time_locl.h:117:1: Parameter `a` 115. } 116. 117. > static ossl_inline size_t constant_time_lt_s(size_t a, size_t b) 118. { 119. return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b))); include/internal/constant_time_locl.h:117:1: <RHS trace> 115. } 116. 117. > static ossl_inline size_t constant_time_lt_s(size_t a, size_t b) 118. { 119. return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b))); include/internal/constant_time_locl.h:117:1: Parameter `b` 115. } 116. 117. > static ossl_inline size_t constant_time_lt_s(size_t a, size_t b) 118. { 119. return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b))); include/internal/constant_time_locl.h:119:12: Binary operation: ([0, +oo] - [1, 64]):unsigned64 by call to `ssl3_cbc_copy_mac` 117. static ossl_inline size_t constant_time_lt_s(size_t a, size_t b) 118. { 119. return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b))); ^ 120. } 121.
https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/include/internal/constant_time_locl.h/#L119
d2a_code_trace_data_43417
static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; MSS2Context *ctx = avctx->priv_data; MSS12Context *c = &ctx->c; AVFrame *frame = data; GetBitContext gb; GetByteContext gB; ArithCoder acoder; int keyframe, has_wmv9, has_mv, is_rle, is_555, ret; Rectangle wmv9rects[MAX_WMV9_RECTANGLES], *r; int used_rects = 0, i, implicit_rect = 0, av_uninit(wmv9_mask); av_assert0(FF_INPUT_BUFFER_PADDING_SIZE >= ARITH2_PADDING + (MIN_CACHE_BITS + 7) / 8); init_get_bits(&gb, buf, buf_size * 8); if (keyframe = get_bits1(&gb)) skip_bits(&gb, 7); has_wmv9 = get_bits1(&gb); has_mv = keyframe ? 0 : get_bits1(&gb); is_rle = get_bits1(&gb); is_555 = is_rle && get_bits1(&gb); if (c->slice_split > 0) ctx->split_position = c->slice_split; else if (c->slice_split < 0) { if (get_bits1(&gb)) { if (get_bits1(&gb)) { if (get_bits1(&gb)) ctx->split_position = get_bits(&gb, 16); else ctx->split_position = get_bits(&gb, 12); } else ctx->split_position = get_bits(&gb, 8) << 4; } else { if (keyframe) ctx->split_position = avctx->height / 2; } } else ctx->split_position = avctx->height; if (c->slice_split && (ctx->split_position < 1 - is_555 || ctx->split_position > avctx->height - 1)) return AVERROR_INVALIDDATA; align_get_bits(&gb); buf += get_bits_count(&gb) >> 3; buf_size -= get_bits_count(&gb) >> 3; if (buf_size < 1) return AVERROR_INVALIDDATA; if (is_555 && (has_wmv9 || has_mv || c->slice_split && ctx->split_position)) return AVERROR_INVALIDDATA; avctx->pix_fmt = is_555 ? AV_PIX_FMT_RGB555 : AV_PIX_FMT_RGB24; if (ctx->last_pic->format != avctx->pix_fmt) av_frame_unref(ctx->last_pic); if (has_wmv9) { bytestream2_init(&gB, buf, buf_size + ARITH2_PADDING); arith2_init(&acoder, &gB); implicit_rect = !arith2_get_bit(&acoder); while (arith2_get_bit(&acoder)) { if (used_rects == MAX_WMV9_RECTANGLES) return AVERROR_INVALIDDATA; r = &wmv9rects[used_rects]; if (!used_rects) r->x = arith2_get_number(&acoder, avctx->width); else r->x = arith2_get_number(&acoder, avctx->width - wmv9rects[used_rects - 1].x) + wmv9rects[used_rects - 1].x; r->y = arith2_get_number(&acoder, avctx->height); r->w = arith2_get_number(&acoder, avctx->width - r->x) + 1; r->h = arith2_get_number(&acoder, avctx->height - r->y) + 1; used_rects++; } if (implicit_rect && used_rects) { av_log(avctx, AV_LOG_ERROR, "implicit_rect && used_rects > 0\n"); return AVERROR_INVALIDDATA; } if (implicit_rect) { wmv9rects[0].x = 0; wmv9rects[0].y = 0; wmv9rects[0].w = avctx->width; wmv9rects[0].h = avctx->height; used_rects = 1; } for (i = 0; i < used_rects; i++) { if (!implicit_rect && arith2_get_bit(&acoder)) { av_log(avctx, AV_LOG_ERROR, "Unexpected grandchildren\n"); return AVERROR_INVALIDDATA; } if (!i) { wmv9_mask = arith2_get_bit(&acoder) - 1; if (!wmv9_mask) wmv9_mask = arith2_get_number(&acoder, 256); } wmv9rects[i].coded = arith2_get_number(&acoder, 2); } buf += arith2_get_consumed_bytes(&acoder); buf_size -= arith2_get_consumed_bytes(&acoder); if (buf_size < 1) return AVERROR_INVALIDDATA; } c->mvX = c->mvY = 0; if (keyframe && !is_555) { if ((i = decode_pal_v2(c, buf, buf_size)) < 0) return AVERROR_INVALIDDATA; buf += i; buf_size -= i; } else if (has_mv) { buf += 4; buf_size -= 4; if (buf_size < 1) return AVERROR_INVALIDDATA; c->mvX = AV_RB16(buf - 4) - avctx->width; c->mvY = AV_RB16(buf - 2) - avctx->height; } if (c->mvX < 0 || c->mvY < 0) { FFSWAP(uint8_t *, c->pal_pic, c->last_pal_pic); if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } if (ctx->last_pic->data[0]) { av_assert0(frame->linesize[0] == ctx->last_pic->linesize[0]); c->last_rgb_pic = ctx->last_pic->data[0] + ctx->last_pic->linesize[0] * (avctx->height - 1); } else { av_log(avctx, AV_LOG_ERROR, "Missing keyframe\n"); return AVERROR_INVALIDDATA; } } else { if ((ret = ff_reget_buffer(avctx, ctx->last_pic)) < 0) { av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return ret; } if ((ret = av_frame_ref(frame, ctx->last_pic)) < 0) return ret; c->last_rgb_pic = NULL; } c->rgb_pic = frame->data[0] + frame->linesize[0] * (avctx->height - 1); c->rgb_stride = -frame->linesize[0]; frame->key_frame = keyframe; frame->pict_type = keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; if (is_555) { bytestream2_init(&gB, buf, buf_size); if (decode_555(&gB, (uint16_t *)c->rgb_pic, c->rgb_stride >> 1, keyframe, avctx->width, avctx->height)) return AVERROR_INVALIDDATA; buf_size -= bytestream2_tell(&gB); } else { if (keyframe) { c->corrupted = 0; ff_mss12_slicecontext_reset(&ctx->sc[0]); if (c->slice_split) ff_mss12_slicecontext_reset(&ctx->sc[1]); } if (is_rle) { init_get_bits(&gb, buf, buf_size * 8); if (ret = decode_rle(&gb, c->pal_pic, c->pal_stride, c->rgb_pic, c->rgb_stride, c->pal, keyframe, ctx->split_position, 0, avctx->width, avctx->height)) return ret; align_get_bits(&gb); if (c->slice_split) if (ret = decode_rle(&gb, c->pal_pic, c->pal_stride, c->rgb_pic, c->rgb_stride, c->pal, keyframe, ctx->split_position, 1, avctx->width, avctx->height)) return ret; align_get_bits(&gb); buf += get_bits_count(&gb) >> 3; buf_size -= get_bits_count(&gb) >> 3; } else if (!implicit_rect || wmv9_mask != -1) { if (c->corrupted) return AVERROR_INVALIDDATA; bytestream2_init(&gB, buf, buf_size + ARITH2_PADDING); arith2_init(&acoder, &gB); c->keyframe = keyframe; if (c->corrupted = ff_mss12_decode_rect(&ctx->sc[0], &acoder, 0, 0, avctx->width, ctx->split_position)) return AVERROR_INVALIDDATA; buf += arith2_get_consumed_bytes(&acoder); buf_size -= arith2_get_consumed_bytes(&acoder); if (c->slice_split) { if (buf_size < 1) return AVERROR_INVALIDDATA; bytestream2_init(&gB, buf, buf_size + ARITH2_PADDING); arith2_init(&acoder, &gB); if (c->corrupted = ff_mss12_decode_rect(&ctx->sc[1], &acoder, 0, ctx->split_position, avctx->width, avctx->height - ctx->split_position)) return AVERROR_INVALIDDATA; buf += arith2_get_consumed_bytes(&acoder); buf_size -= arith2_get_consumed_bytes(&acoder); } } else memset(c->pal_pic, 0, c->pal_stride * avctx->height); } if (has_wmv9) { for (i = 0; i < used_rects; i++) { int x = wmv9rects[i].x; int y = wmv9rects[i].y; int w = wmv9rects[i].w; int h = wmv9rects[i].h; if (wmv9rects[i].coded) { int WMV9codedFrameSize; if (buf_size < 4 || !(WMV9codedFrameSize = AV_RL24(buf))) return AVERROR_INVALIDDATA; if (ret = decode_wmv9(avctx, buf + 3, buf_size - 3, x, y, w, h, wmv9_mask)) return ret; buf += WMV9codedFrameSize + 3; buf_size -= WMV9codedFrameSize + 3; } else { uint8_t *dst = c->rgb_pic + y * c->rgb_stride + x * 3; if (wmv9_mask != -1) { ctx->dsp.mss2_gray_fill_masked(dst, c->rgb_stride, wmv9_mask, c->pal_pic + y * c->pal_stride + x, c->pal_stride, w, h); } else { do { memset(dst, 0x80, w * 3); dst += c->rgb_stride; } while (--h); } } } } if (buf_size) av_log(avctx, AV_LOG_WARNING, "buffer not fully consumed\n"); if (c->mvX < 0 || c->mvY < 0) { av_frame_unref(ctx->last_pic); ret = av_frame_ref(ctx->last_pic, frame); if (ret < 0) return ret; } *got_frame = 1; return avpkt->size; } libavcodec/mss2.c:482: error: Null Dereference pointer `&gb->buffer` last assigned on line 480 could be null and is dereferenced by call to `get_bits1()` at line 482, column 20. libavcodec/mss2.c:460:1: start of procedure mss2_decode_frame() 458. #define ARITH2_PADDING 2 459. 460. static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ^ 461. AVPacket *avpkt) 462. { libavcodec/mss2.c:463:5: 461. AVPacket *avpkt) 462. { 463. const uint8_t *buf = avpkt->data; ^ 464. int buf_size = avpkt->size; 465. MSS2Context *ctx = avctx->priv_data; libavcodec/mss2.c:464:5: 462. { 463. const uint8_t *buf = avpkt->data; 464. int buf_size = avpkt->size; ^ 465. MSS2Context *ctx = avctx->priv_data; 466. MSS12Context *c = &ctx->c; libavcodec/mss2.c:465:5: 463. const uint8_t *buf = avpkt->data; 464. int buf_size = avpkt->size; 465. MSS2Context *ctx = avctx->priv_data; ^ 466. MSS12Context *c = &ctx->c; 467. AVFrame *frame = data; libavcodec/mss2.c:466:5: 464. int buf_size = avpkt->size; 465. MSS2Context *ctx = avctx->priv_data; 466. MSS12Context *c = &ctx->c; ^ 467. AVFrame *frame = data; 468. GetBitContext gb; libavcodec/mss2.c:467:5: 465. MSS2Context *ctx = avctx->priv_data; 466. MSS12Context *c = &ctx->c; 467. AVFrame *frame = data; ^ 468. GetBitContext gb; 469. GetByteContext gB; libavcodec/mss2.c:475:5: 473. 474. Rectangle wmv9rects[MAX_WMV9_RECTANGLES], *r; 475. int used_rects = 0, i, implicit_rect = 0, av_uninit(wmv9_mask); ^ 476. 477. av_assert0(FF_INPUT_BUFFER_PADDING_SIZE >= libavcodec/mss2.c:477:5: Taking false branch 475. int used_rects = 0, i, implicit_rect = 0, av_uninit(wmv9_mask); 476. 477. av_assert0(FF_INPUT_BUFFER_PADDING_SIZE >= ^ 478. ARITH2_PADDING + (MIN_CACHE_BITS + 7) / 8); 479. libavcodec/mss2.c:477:5: Loop condition is false. Leaving loop 475. int used_rects = 0, i, implicit_rect = 0, av_uninit(wmv9_mask); 476. 477. av_assert0(FF_INPUT_BUFFER_PADDING_SIZE >= ^ 478. ARITH2_PADDING + (MIN_CACHE_BITS + 7) / 8); 479. libavcodec/mss2.c:480:5: 478. ARITH2_PADDING + (MIN_CACHE_BITS + 7) / 8); 479. 480. init_get_bits(&gb, buf, buf_size * 8); ^ 481. 482. if (keyframe = get_bits1(&gb)) libavcodec/get_bits.h:375:1: start of procedure init_get_bits() 373. * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow. 374. */ 375. static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer, ^ 376. int bit_size) 377. { libavcodec/get_bits.h:379:5: 377. { 378. int buffer_size; 379. int ret = 0; ^ 380. 381. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { libavcodec/get_bits.h:381:9: Taking true branch 379. int ret = 0; 380. 381. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { ^ 382. buffer_size = bit_size = 0; 383. buffer = NULL; libavcodec/get_bits.h:382:9: 380. 381. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { 382. buffer_size = bit_size = 0; ^ 383. buffer = NULL; 384. ret = AVERROR_INVALIDDATA; libavcodec/get_bits.h:383:9: 381. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { 382. buffer_size = bit_size = 0; 383. buffer = NULL; ^ 384. ret = AVERROR_INVALIDDATA; 385. } libavcodec/get_bits.h:384:9: 382. buffer_size = bit_size = 0; 383. buffer = NULL; 384. ret = AVERROR_INVALIDDATA; ^ 385. } 386. libavcodec/get_bits.h:387:5: 385. } 386. 387. buffer_size = (bit_size + 7) >> 3; ^ 388. 389. s->buffer = buffer; libavcodec/get_bits.h:389:5: 387. buffer_size = (bit_size + 7) >> 3; 388. 389. s->buffer = buffer; ^ 390. s->size_in_bits = bit_size; 391. #if !UNCHECKED_BITSTREAM_READER libavcodec/get_bits.h:390:5: 388. 389. s->buffer = buffer; 390. s->size_in_bits = bit_size; ^ 391. #if !UNCHECKED_BITSTREAM_READER 392. s->size_in_bits_plus8 = bit_size + 8; libavcodec/get_bits.h:392:5: 390. s->size_in_bits = bit_size; 391. #if !UNCHECKED_BITSTREAM_READER 392. s->size_in_bits_plus8 = bit_size + 8; ^ 393. #endif 394. s->buffer_end = buffer + buffer_size; libavcodec/get_bits.h:394:5: 392. s->size_in_bits_plus8 = bit_size + 8; 393. #endif 394. s->buffer_end = buffer + buffer_size; ^ 395. s->index = 0; 396. libavcodec/get_bits.h:395:5: 393. #endif 394. s->buffer_end = buffer + buffer_size; 395. s->index = 0; ^ 396. 397. return ret; libavcodec/get_bits.h:397:5: 395. s->index = 0; 396. 397. return ret; ^ 398. } 399. libavcodec/get_bits.h:398:1: return from a call to init_get_bits 396. 397. return ret; 398. } ^ 399. 400. /** libavcodec/mss2.c:482:9: 480. init_get_bits(&gb, buf, buf_size * 8); 481. 482. if (keyframe = get_bits1(&gb)) ^ 483. skip_bits(&gb, 7); 484. has_wmv9 = get_bits1(&gb); libavcodec/get_bits.h:271:1: start of procedure get_bits1() 269. } 270. 271. static inline unsigned int get_bits1(GetBitContext *s) ^ 272. { 273. unsigned int index = s->index; libavcodec/get_bits.h:273:5: 271. static inline unsigned int get_bits1(GetBitContext *s) 272. { 273. unsigned int index = s->index; ^ 274. uint8_t result = s->buffer[index >> 3]; 275. #ifdef BITSTREAM_READER_LE libavcodec/get_bits.h:274:5: 272. { 273. unsigned int index = s->index; 274. uint8_t result = s->buffer[index >> 3]; ^ 275. #ifdef BITSTREAM_READER_LE 276. result >>= index & 7;
https://github.com/libav/libav/blob/d6d767d93e532246cacf3567e6bcad76a821f838/libavcodec/mss2.c/#L482
d2a_code_trace_data_43418
static int decrypt_init(AVFormatContext *s, ID3v2ExtraMeta *em, uint8_t *header) { OMAContext *oc = s->priv_data; ID3v2ExtraMetaGEOB *geob = NULL; uint8_t *gdata; oc->encrypted = 1; av_log(s, AV_LOG_INFO, "File is encrypted\n"); while (em) { if (!strcmp(em->tag, "GEOB") && (geob = em->data) && (!strcmp(geob->description, "OMG_LSI") || !strcmp(geob->description, "OMG_BKLSI"))) { break; } em = em->next; } if (!em) { av_log(s, AV_LOG_ERROR, "No encryption header found\n"); return -1; } if (geob->datasize < 64) { av_log(s, AV_LOG_ERROR, "Invalid GEOB data size: %u\n", geob->datasize); return -1; } gdata = geob->data; if (AV_RB16(gdata) != 1) av_log(s, AV_LOG_WARNING, "Unknown version in encryption header\n"); oc->k_size = AV_RB16(&gdata[2]); oc->e_size = AV_RB16(&gdata[4]); oc->i_size = AV_RB16(&gdata[6]); oc->s_size = AV_RB16(&gdata[8]); if (memcmp(&gdata[OMA_ENC_HEADER_SIZE], "KEYRING ", 12)) { av_log(s, AV_LOG_ERROR, "Invalid encryption header\n"); return -1; } oc->rid = AV_RB32(&gdata[OMA_ENC_HEADER_SIZE + 28]); av_log(s, AV_LOG_DEBUG, "RID: %.8x\n", oc->rid); memcpy(oc->iv, &header[0x58], 8); hex_log(s, AV_LOG_DEBUG, "IV", oc->iv, 8); hex_log(s, AV_LOG_DEBUG, "CBC-MAC", &gdata[OMA_ENC_HEADER_SIZE + oc->k_size + oc->e_size + oc->i_size], 8); if (s->keylen > 0) { kset(s, s->key, s->key, s->keylen); } if (!memcmp(oc->r_val, (const uint8_t[8]){0}, 8) || rprobe(s, gdata, oc->r_val) < 0 && nprobe(s, gdata, geob->datasize, oc->n_val) < 0) { int i; for (i = 0; i < FF_ARRAY_ELEMS(leaf_table); i += 2) { uint8_t buf[16]; AV_WL64(buf, leaf_table[i]); AV_WL64(&buf[8], leaf_table[i + 1]); kset(s, buf, buf, 16); if (!rprobe(s, gdata, oc->r_val) || !nprobe(s, gdata, geob->datasize, oc->n_val)) break; } if (i >= sizeof(leaf_table)) { av_log(s, AV_LOG_ERROR, "Invalid key\n"); return -1; } } av_des_init(&oc->av_des, oc->m_val, 64, 0); av_des_crypt(&oc->av_des, oc->e_val, &gdata[OMA_ENC_HEADER_SIZE + 40], 1, NULL, 0); hex_log(s, AV_LOG_DEBUG, "EK", oc->e_val, 8); av_des_init(&oc->av_des, oc->e_val, 64, 1); return 0; } libavformat/omadec.c:246: error: Buffer Overrun L2 Offset: [1, 6] Size: 6. libavformat/omadec.c:243:14: <Offset trace> 241. nprobe(s, gdata, geob->datasize, oc->n_val) < 0) { 242. int i; 243. for (i = 0; i < FF_ARRAY_ELEMS(leaf_table); i += 2) { ^ 244. uint8_t buf[16]; 245. AV_WL64(buf, leaf_table[i]); libavformat/omadec.c:243:14: Assignment 241. nprobe(s, gdata, geob->datasize, oc->n_val) < 0) { 242. int i; 243. for (i = 0; i < FF_ARRAY_ELEMS(leaf_table); i += 2) { ^ 244. uint8_t buf[16]; 245. AV_WL64(buf, leaf_table[i]); libavformat/omadec.c:53:1: <Length trace> 51. 52. 53. static const uint64_t leaf_table[] = { ^ 54. 0xd79e8283acea4620, 0x7a9762f445afd0d8, 55. 0x354d60a60b8c79f1, 0x584e1cde00b07aee, libavformat/omadec.c:53:1: Array declaration 51. 52. 53. static const uint64_t leaf_table[] = { ^ 54. 0xd79e8283acea4620, 0x7a9762f445afd0d8, 55. 0x354d60a60b8c79f1, 0x584e1cde00b07aee, libavformat/omadec.c:246:30: Array access: Offset: [1, 6] Size: 6 244. uint8_t buf[16]; 245. AV_WL64(buf, leaf_table[i]); 246. AV_WL64(&buf[8], leaf_table[i + 1]); ^ 247. kset(s, buf, buf, 16); 248. if (!rprobe(s, gdata, oc->r_val) ||
https://github.com/libav/libav/blob/b963f021b603509b5159873de4919dec441d0782/libavformat/omadec.c/#L246
d2a_code_trace_data_43419
int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len) { SHA_LONG64 l; unsigned char *p = c->u.p; const unsigned char *data = (const unsigned char *)_data; if (len == 0) return 1; l = (c->Nl + (((SHA_LONG64) len) << 3)) & U64(0xffffffffffffffff); if (l < c->Nl) c->Nh++; if (sizeof(len) >= 8) c->Nh += (((SHA_LONG64) len) >> 61); c->Nl = l; if (c->num != 0) { size_t n = sizeof(c->u) - c->num; if (len < n) { memcpy(p + c->num, data, len), c->num += (unsigned int)len; return 1; } else { memcpy(p + c->num, data, n), c->num = 0; len -= n, data += n; sha512_block_data_order(c, p, 1); } } if (len >= sizeof(c->u)) { #ifndef SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA if ((size_t)data % sizeof(c->u.d[0]) != 0) while (len >= sizeof(c->u)) memcpy(p, data, sizeof(c->u)), sha512_block_data_order(c, p, 1), len -= sizeof(c->u), data += sizeof(c->u); else #endif sha512_block_data_order(c, data, len / sizeof(c->u)), data += len, len %= sizeof(c->u), data -= len; } if (len != 0) memcpy(p, data, len), c->num = (int)len; return 1; } crypto/ec/curve25519.c:4661: error: INTEGER_OVERFLOW_L2 (128 - [1, 253]):unsigned64 by call to `SHA512_Update`. Showing all 10 steps of the trace crypto/ec/curve25519.c:4658:3: Call 4656. memcpy(scopy, signature + 32, 32); 4657. 4658. SHA512_Init(&hash_ctx); ^ 4659. SHA512_Update(&hash_ctx, signature, 32); 4660. SHA512_Update(&hash_ctx, public_key, 32); crypto/sha/sha512.c:94:5: Assignment 92. c->Nl = 0; 93. c->Nh = 0; 94. c->num = 0; ^ 95. c->md_len = SHA512_DIGEST_LENGTH; 96. return 1; crypto/ec/curve25519.c:4659:3: Call 4657. 4658. SHA512_Init(&hash_ctx); 4659. SHA512_Update(&hash_ctx, signature, 32); ^ 4660. SHA512_Update(&hash_ctx, public_key, 32); 4661. SHA512_Update(&hash_ctx, message, message_len); crypto/sha/sha512.c:188:1: Parameter `c->num` 186. } 187. 188. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len) 189. { 190. SHA_LONG64 l; crypto/ec/curve25519.c:4660:3: Call 4658. SHA512_Init(&hash_ctx); 4659. SHA512_Update(&hash_ctx, signature, 32); 4660. SHA512_Update(&hash_ctx, public_key, 32); ^ 4661. SHA512_Update(&hash_ctx, message, message_len); 4662. SHA512_Final(h, &hash_ctx); crypto/sha/sha512.c:188:1: Parameter `c->num` 186. } 187. 188. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len) 189. { 190. SHA_LONG64 l; crypto/ec/curve25519.c:4661:3: Call 4659. SHA512_Update(&hash_ctx, signature, 32); 4660. SHA512_Update(&hash_ctx, public_key, 32); 4661. SHA512_Update(&hash_ctx, message, message_len); ^ 4662. SHA512_Final(h, &hash_ctx); 4663. crypto/sha/sha512.c:188:1: <RHS trace> 186. } 187. 188. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len) 189. { 190. SHA_LONG64 l; crypto/sha/sha512.c:188:1: Parameter `c->num` 186. } 187. 188. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len) 189. { 190. SHA_LONG64 l; crypto/sha/sha512.c:205:9: Binary operation: (128 - [1, 253]):unsigned64 by call to `SHA512_Update` 203. 204. if (c->num != 0) { 205. size_t n = sizeof(c->u) - c->num; ^ 206. 207. if (len < n) {
https://github.com/openssl/openssl/blob/04dec1ab34df70c1588d42cc394e8fa8b5f3191c/crypto/sha/sha512.c/#L205
d2a_code_trace_data_43420
static int encode_bitstream(FlashSVContext *s, AVFrame *p, uint8_t *buf, int buf_size, int block_width, int block_height, uint8_t *previous_frame, int *I_frame) { PutBitContext pb; int h_blocks, v_blocks, h_part, v_part, i, j; int buf_pos, res; int pred_blocks = 0; init_put_bits(&pb, buf, buf_size * 8); put_bits(&pb, 4, block_width / 16 - 1); put_bits(&pb, 12, s->image_width); put_bits(&pb, 4, block_height / 16 - 1); put_bits(&pb, 12, s->image_height); flush_put_bits(&pb); buf_pos = 4; h_blocks = s->image_width / block_width; h_part = s->image_width % block_width; v_blocks = s->image_height / block_height; v_part = s->image_height % block_height; for (j = 0; j < v_blocks + (v_part ? 1 : 0); j++) { int y_pos = j * block_height; int cur_blk_height = (j < v_blocks) ? block_height : v_part; for (i = 0; i < h_blocks + (h_part ? 1 : 0); i++) { int x_pos = i * block_width; int cur_blk_width = (i < h_blocks) ? block_width : h_part; int ret = Z_OK; uint8_t *ptr = buf + buf_pos; res = copy_region_enc(p->data[0], s->tmpblock, s->image_height - (y_pos + cur_blk_height + 1), x_pos, cur_blk_height, cur_blk_width, p->linesize[0], previous_frame); if (res || *I_frame) { unsigned long zsize = 3 * block_width * block_height; ret = compress2(ptr + 2, &zsize, s->tmpblock, 3 * cur_blk_width * cur_blk_height, 9); if (ret != Z_OK) av_log(s->avctx, AV_LOG_ERROR, "error while compressing block %dx%d\n", i, j); bytestream_put_be16(&ptr, zsize); buf_pos += zsize + 2; av_dlog(s->avctx, "buf_pos = %d\n", buf_pos); } else { pred_blocks++; bytestream_put_be16(&ptr, 0); buf_pos += 2; } } } if (pred_blocks) *I_frame = 0; else *I_frame = 1; return buf_pos; } libavcodec/flashsvenc.c:139: error: Null Dereference pointer `&pb->buf_ptr` last assigned on line 134 could be null and is dereferenced by call to `put_bits()` at line 139, column 5. libavcodec/flashsvenc.c:124:1: start of procedure encode_bitstream() 122. 123. 124. static int encode_bitstream(FlashSVContext *s, AVFrame *p, uint8_t *buf, ^ 125. int buf_size, int block_width, int block_height, 126. uint8_t *previous_frame, int *I_frame) libavcodec/flashsvenc.c:132:5: 130. int h_blocks, v_blocks, h_part, v_part, i, j; 131. int buf_pos, res; 132. int pred_blocks = 0; ^ 133. 134. init_put_bits(&pb, buf, buf_size * 8); libavcodec/flashsvenc.c:134:5: 132. int pred_blocks = 0; 133. 134. init_put_bits(&pb, buf, buf_size * 8); ^ 135. 136. put_bits(&pb, 4, block_width / 16 - 1); libavcodec/put_bits.h:52:1: start of procedure init_put_bits() 50. * @param buffer_size the size in bytes of buffer 51. */ 52. static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size) ^ 53. { 54. if(buffer_size < 0) { libavcodec/put_bits.h:54:8: Taking true branch 52. static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size) 53. { 54. if(buffer_size < 0) { ^ 55. buffer_size = 0; 56. buffer = NULL; libavcodec/put_bits.h:55:9: 53. { 54. if(buffer_size < 0) { 55. buffer_size = 0; ^ 56. buffer = NULL; 57. } libavcodec/put_bits.h:56:9: 54. if(buffer_size < 0) { 55. buffer_size = 0; 56. buffer = NULL; ^ 57. } 58. libavcodec/put_bits.h:59:5: 57. } 58. 59. s->size_in_bits= 8*buffer_size; ^ 60. s->buf = buffer; 61. s->buf_end = s->buf + buffer_size; libavcodec/put_bits.h:60:5: 58. 59. s->size_in_bits= 8*buffer_size; 60. s->buf = buffer; ^ 61. s->buf_end = s->buf + buffer_size; 62. s->buf_ptr = s->buf; libavcodec/put_bits.h:61:5: 59. s->size_in_bits= 8*buffer_size; 60. s->buf = buffer; 61. s->buf_end = s->buf + buffer_size; ^ 62. s->buf_ptr = s->buf; 63. s->bit_left=32; libavcodec/put_bits.h:62:5: 60. s->buf = buffer; 61. s->buf_end = s->buf + buffer_size; 62. s->buf_ptr = s->buf; ^ 63. s->bit_left=32; 64. s->bit_buf=0; libavcodec/put_bits.h:63:5: 61. s->buf_end = s->buf + buffer_size; 62. s->buf_ptr = s->buf; 63. s->bit_left=32; ^ 64. s->bit_buf=0; 65. } libavcodec/put_bits.h:64:5: 62. s->buf_ptr = s->buf; 63. s->bit_left=32; 64. s->bit_buf=0; ^ 65. } 66. libavcodec/put_bits.h:65:1: return from a call to init_put_bits 63. s->bit_left=32; 64. s->bit_buf=0; 65. } ^ 66. 67. /** libavcodec/flashsvenc.c:136:5: 134. init_put_bits(&pb, buf, buf_size * 8); 135. 136. put_bits(&pb, 4, block_width / 16 - 1); ^ 137. put_bits(&pb, 12, s->image_width); 138. put_bits(&pb, 4, block_height / 16 - 1); libavcodec/put_bits.h:128:1: start of procedure put_bits() 126. * Use put_bits32 to write 32 bits. 127. */ 128. static inline void put_bits(PutBitContext *s, int n, unsigned int value) ^ 129. { 130. unsigned int bit_buf; libavcodec/put_bits.h:134:5: 132. 133. // printf("put_bits=%d %x\n", n, value); 134. assert(n <= 31 && value < (1U << n)); ^ 135. 136. bit_buf = s->bit_buf; libavcodec/put_bits.h:136:5: 134. assert(n <= 31 && value < (1U << n)); 135. 136. bit_buf = s->bit_buf; ^ 137. bit_left = s->bit_left; 138. libavcodec/put_bits.h:137:5: 135. 136. bit_buf = s->bit_buf; 137. bit_left = s->bit_left; ^ 138. 139. // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf); libavcodec/put_bits.h:151:9: Taking true branch 149. bit_left-=n; 150. #else 151. if (n < bit_left) { ^ 152. bit_buf = (bit_buf<<n) | value; 153. bit_left-=n; libavcodec/put_bits.h:152:9: 150. #else 151. if (n < bit_left) { 152. bit_buf = (bit_buf<<n) | value; ^ 153. bit_left-=n; 154. } else { libavcodec/put_bits.h:153:9: 151. if (n < bit_left) { 152. bit_buf = (bit_buf<<n) | value; 153. bit_left-=n; ^ 154. } else { 155. bit_buf<<=bit_left; libavcodec/put_bits.h:165:5: 163. #endif 164. 165. s->bit_buf = bit_buf; ^ 166. s->bit_left = bit_left; 167. } libavcodec/put_bits.h:166:5: 164. 165. s->bit_buf = bit_buf; 166. s->bit_left = bit_left; ^ 167. } 168. libavcodec/put_bits.h:167:1: return from a call to put_bits 165. s->bit_buf = bit_buf; 166. s->bit_left = bit_left; 167. } ^ 168. 169. static inline void put_sbits(PutBitContext *pb, int n, int32_t value) libavcodec/flashsvenc.c:137:5: 135. 136. put_bits(&pb, 4, block_width / 16 - 1); 137. put_bits(&pb, 12, s->image_width); ^ 138. put_bits(&pb, 4, block_height / 16 - 1); 139. put_bits(&pb, 12, s->image_height); libavcodec/put_bits.h:128:1: start of procedure put_bits() 126. * Use put_bits32 to write 32 bits. 127. */ 128. static inline void put_bits(PutBitContext *s, int n, unsigned int value) ^ 129. { 130. unsigned int bit_buf; libavcodec/put_bits.h:134:5: 132. 133. // printf("put_bits=%d %x\n", n, value); 134. assert(n <= 31 && value < (1U << n)); ^ 135. 136. bit_buf = s->bit_buf; libavcodec/put_bits.h:136:5: 134. assert(n <= 31 && value < (1U << n)); 135. 136. bit_buf = s->bit_buf; ^ 137. bit_left = s->bit_left; 138. libavcodec/put_bits.h:137:5: 135. 136. bit_buf = s->bit_buf; 137. bit_left = s->bit_left; ^ 138. 139. // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf); libavcodec/put_bits.h:151:9: Taking true branch 149. bit_left-=n; 150. #else 151. if (n < bit_left) { ^ 152. bit_buf = (bit_buf<<n) | value; 153. bit_left-=n; libavcodec/put_bits.h:152:9: 150. #else 151. if (n < bit_left) { 152. bit_buf = (bit_buf<<n) | value; ^ 153. bit_left-=n; 154. } else { libavcodec/put_bits.h:153:9: 151. if (n < bit_left) { 152. bit_buf = (bit_buf<<n) | value; 153. bit_left-=n; ^ 154. } else { 155. bit_buf<<=bit_left; libavcodec/put_bits.h:165:5: 163. #endif 164. 165. s->bit_buf = bit_buf; ^ 166. s->bit_left = bit_left; 167. } libavcodec/put_bits.h:166:5: 164. 165. s->bit_buf = bit_buf; 166. s->bit_left = bit_left; ^ 167. } 168. libavcodec/put_bits.h:167:1: return from a call to put_bits 165. s->bit_buf = bit_buf; 166. s->bit_left = bit_left; 167. } ^ 168. 169. static inline void put_sbits(PutBitContext *pb, int n, int32_t value) libavcodec/flashsvenc.c:138:5: 136. put_bits(&pb, 4, block_width / 16 - 1); 137. put_bits(&pb, 12, s->image_width); 138. put_bits(&pb, 4, block_height / 16 - 1); ^ 139. put_bits(&pb, 12, s->image_height); 140. flush_put_bits(&pb); libavcodec/put_bits.h:128:1: start of procedure put_bits() 126. * Use put_bits32 to write 32 bits. 127. */ 128. static inline void put_bits(PutBitContext *s, int n, unsigned int value) ^ 129. { 130. unsigned int bit_buf; libavcodec/put_bits.h:134:5: 132. 133. // printf("put_bits=%d %x\n", n, value); 134. assert(n <= 31 && value < (1U << n)); ^ 135. 136. bit_buf = s->bit_buf; libavcodec/put_bits.h:136:5: 134. assert(n <= 31 && value < (1U << n)); 135. 136. bit_buf = s->bit_buf; ^ 137. bit_left = s->bit_left; 138. libavcodec/put_bits.h:137:5: 135. 136. bit_buf = s->bit_buf; 137. bit_left = s->bit_left; ^ 138. 139. // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf); libavcodec/put_bits.h:151:9: Taking true branch 149. bit_left-=n; 150. #else 151. if (n < bit_left) { ^ 152. bit_buf = (bit_buf<<n) | value; 153. bit_left-=n; libavcodec/put_bits.h:152:9: 150. #else 151. if (n < bit_left) { 152. bit_buf = (bit_buf<<n) | value; ^ 153. bit_left-=n; 154. } else { libavcodec/put_bits.h:153:9: 151. if (n < bit_left) { 152. bit_buf = (bit_buf<<n) | value; 153. bit_left-=n; ^ 154. } else { 155. bit_buf<<=bit_left; libavcodec/put_bits.h:165:5: 163. #endif 164. 165. s->bit_buf = bit_buf; ^ 166. s->bit_left = bit_left; 167. } libavcodec/put_bits.h:166:5: 164. 165. s->bit_buf = bit_buf; 166. s->bit_left = bit_left; ^ 167. } 168. libavcodec/put_bits.h:167:1: return from a call to put_bits 165. s->bit_buf = bit_buf; 166. s->bit_left = bit_left; 167. } ^ 168. 169. static inline void put_sbits(PutBitContext *pb, int n, int32_t value) libavcodec/flashsvenc.c:139:5: 137. put_bits(&pb, 12, s->image_width); 138. put_bits(&pb, 4, block_height / 16 - 1); 139. put_bits(&pb, 12, s->image_height); ^ 140. flush_put_bits(&pb); 141. buf_pos = 4; libavcodec/put_bits.h:128:1: start of procedure put_bits() 126. * Use put_bits32 to write 32 bits. 127. */ 128. static inline void put_bits(PutBitContext *s, int n, unsigned int value) ^ 129. { 130. unsigned int bit_buf; libavcodec/put_bits.h:134:5: 132. 133. // printf("put_bits=%d %x\n", n, value); 134. assert(n <= 31 && value < (1U << n)); ^ 135. 136. bit_buf = s->bit_buf; libavcodec/put_bits.h:136:5: 134. assert(n <= 31 && value < (1U << n)); 135. 136. bit_buf = s->bit_buf; ^ 137. bit_left = s->bit_left; 138. libavcodec/put_bits.h:137:5: 135. 136. bit_buf = s->bit_buf; 137. bit_left = s->bit_left; ^ 138. 139. // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf); libavcodec/put_bits.h:151:9: Taking false branch 149. bit_left-=n; 150. #else 151. if (n < bit_left) { ^ 152. bit_buf = (bit_buf<<n) | value; 153. bit_left-=n; libavcodec/put_bits.h:155:9: 153. bit_left-=n; 154. } else { 155. bit_buf<<=bit_left; ^ 156. bit_buf |= value >> (n - bit_left); 157. AV_WB32(s->buf_ptr, bit_buf); libavcodec/put_bits.h:156:9: 154. } else { 155. bit_buf<<=bit_left; 156. bit_buf |= value >> (n - bit_left); ^ 157. AV_WB32(s->buf_ptr, bit_buf); 158. //printf("bitbuf = %08x\n", bit_buf); libavcodec/put_bits.h:157:9: 155. bit_buf<<=bit_left; 156. bit_buf |= value >> (n - bit_left); 157. AV_WB32(s->buf_ptr, bit_buf); ^ 158. //printf("bitbuf = %08x\n", bit_buf); 159. s->buf_ptr+=4;
https://github.com/libav/libav/blob/577fed3b7cef50d9d0f2e8a4b2f215129da49b4e/libavcodec/flashsvenc.c/#L139
d2a_code_trace_data_43421
int BN_hex2bn(BIGNUM **bn, const char *a) { BIGNUM *ret = NULL; BN_ULONG l = 0; int neg = 0, h, m, i, j, k, c; int num; if ((a == NULL) || (*a == '\0')) return (0); if (*a == '-') { neg = 1; a++; } for (i = 0; isxdigit((unsigned char)a[i]); i++) ; num = i + neg; if (bn == NULL) return (num); if (*bn == NULL) { if ((ret = BN_new()) == NULL) return (0); } else { ret = *bn; BN_zero(ret); } if (bn_expand(ret, i * 4) == NULL) goto err; j = i; m = 0; h = 0; while (j > 0) { m = ((BN_BYTES * 2) <= j) ? (BN_BYTES * 2) : j; l = 0; for (;;) { c = a[j - m]; if ((c >= '0') && (c <= '9')) k = c - '0'; else if ((c >= 'a') && (c <= 'f')) k = c - 'a' + 10; else if ((c >= 'A') && (c <= 'F')) k = c - 'A' + 10; else k = 0; l = (l << 4) | k; if (--m <= 0) { ret->d[h++] = l; break; } } j -= (BN_BYTES * 2); } ret->top = h; bn_correct_top(ret); ret->neg = neg; *bn = ret; bn_check_top(ret); return (num); err: if (*bn == NULL) BN_free(ret); return (0); } crypto/ec/ectest.c:1082: error: BUFFER_OVERRUN_L3 Offset: [-15, +oo] (⇐ [0, 1] + [-15, +oo]) Size: 2 by call to `BN_hex2bn`. Showing all 7 steps of the trace crypto/ec/ectest.c:1082:10: Call 1080. if (!BN_hex2bn(&p, "13")) 1081. ABORT; 1082. if (!BN_hex2bn(&a, "3")) ^ 1083. ABORT; 1084. if (!BN_hex2bn(&b, "1")) crypto/bn/bn_print.c:187:10: <Offset trace> 185. } 186. 187. for (i = 0; isxdigit((unsigned char)a[i]); i++) ; ^ 188. 189. num = i + neg; crypto/bn/bn_print.c:187:10: Assignment 185. } 186. 187. for (i = 0; isxdigit((unsigned char)a[i]); i++) ; ^ 188. 189. num = i + neg; crypto/bn/bn_print.c:206:5: Assignment 204. goto err; 205. 206. j = i; /* least significant 'hex' */ ^ 207. m = 0; 208. h = 0; crypto/bn/bn_print.c:172:1: <Length trace> 170. } 171. 172. > int BN_hex2bn(BIGNUM **bn, const char *a) 173. { 174. BIGNUM *ret = NULL; crypto/bn/bn_print.c:172:1: Parameter `*a` 170. } 171. 172. > int BN_hex2bn(BIGNUM **bn, const char *a) 173. { 174. BIGNUM *ret = NULL; crypto/bn/bn_print.c:213:17: Array access: Offset: [-15, +oo] (⇐ [0, 1] + [-15, +oo]) Size: 2 by call to `BN_hex2bn` 211. l = 0; 212. for (;;) { 213. c = a[j - m]; ^ 214. if ((c >= '0') && (c <= '9')) 215. k = c - '0';
https://github.com/openssl/openssl/blob/9c46f4b9cd4912b61cb546c48b678488d7f26ed6/crypto/bn/bn_print.c/#L213
d2a_code_trace_data_43422
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_d1.c:286: error: INTEGER_OVERFLOW_L2 ([0, max(0, `s->initial_ctx->sessions->num_items`)] - 1):unsigned64 by call to `dtls1_process_record`. Showing all 15 steps of the trace ssl/record/rec_layer_d1.c:229:1: Parameter `s->initial_ctx->sessions->num_items` 227. &((s)->rlayer.d->unprocessed_rcds)) 228. 229. > int dtls1_process_buffered_records(SSL *s) 230. { 231. pitem *item; ssl/record/rec_layer_d1.c:286:31: Call 284. } 285. 286. if (!replayok || !dtls1_process_record(s, bitmap)) { ^ 287. /* dump this record */ 288. rr->length = 0; ssl/record/ssl3_record.c:1276:1: Parameter `s->initial_ctx->sessions->num_items` 1274. } 1275. 1276. > int dtls1_process_record(SSL *s, DTLS1_BITMAP *bitmap) 1277. { 1278. int i, al; ssl/record/ssl3_record.c:1439:5: Call 1437. 1438. f_err: 1439. ssl3_send_alert(s, SSL3_AL_FATAL, al); ^ 1440. err: 1441. return (0); 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:697:1: Parameter `ctx->sessions->num_items` 695. } 696. 697. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 698. { 699. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:699:12: Call 697. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 698. { 699. return remove_session_lock(ctx, c, 1); ^ 700. } 701. ssl/ssl_sess.c:702:1: Parameter `ctx->sessions->num_items` 700. } 701. 702. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 703. { 704. SSL_SESSION *r; ssl/ssl_sess.c:712:17: Call 710. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 711. ret = 1; 712. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 713. SSL_SESSION_list_remove(ctx, c); 714. } ssl/ssl_locl.h:595:1: Parameter `lh->num_items` 593. }; 594. 595. > DEFINE_LHASH_OF(SSL_SESSION); 596. /* Needed in ssl_cert.c */ 597. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:595:1: Call 593. }; 594. 595. > DEFINE_LHASH_OF(SSL_SESSION); 596. /* Needed in ssl_cert.c */ 597. 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 `dtls1_process_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/1fb9fdc3027b27d8eb6a1e6a846435b070980770/crypto/lhash/lhash.c/#L123
d2a_code_trace_data_43423
int av_fifo_size(AVFifoBuffer *f) { return (uint32_t)(f->wndx - f->rndx); } avconv.c:782: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `poll_filter`. avconv.c:785:13: Call 783. 784. if (ret == AVERROR_EOF) { 785. finish_output_stream(ost); ^ 786. ret = 0; 787. } else if (ret == AVERROR(EAGAIN)) avconv.c:739:5: Assignment 737. int i; 738. 739. ost->finished = 1; ^ 740. 741. if (of->shortest) { avconv.c:782:15: Call 780. break; 781. 782. ret = poll_filter(ost); ^ 783. 784. if (ret == AVERROR_EOF) { avconv.c:671:1: Parameter `ost->muxing_queue->rndx` 669. * Read one frame for lavfi output for ost and encode it. 670. */ 671. static int poll_filter(OutputStream *ost) ^ 672. { 673. OutputFile *of = output_files[ost->file_index]; avconv.c:717:9: Call 715. ost->enc_ctx->sample_aspect_ratio = filtered_frame->sample_aspect_ratio; 716. 717. do_video_out(of, ost, filtered_frame, &frame_size); ^ 718. if (vstats_filename && frame_size) 719. do_video_stats(ost, frame_size); avconv.c:523:1: Parameter `ost->muxing_queue->rndx` 521. } 522. 523. static void do_video_out(OutputFile *of, ^ 524. OutputStream *ost, 525. AVFrame *in_picture, avconv.c:595:9: Call 593. goto error; 594. 595. output_packet(of, &pkt, ost); ^ 596. *frame_size = pkt.size; 597. avconv.c:360:1: Parameter `ost->muxing_queue->rndx` 358. } 359. 360. static void output_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost) ^ 361. { 362. int ret = 0; avconv.c:390:17: Call 388. idx++; 389. } else 390. write_packet(of, pkt, ost); ^ 391. } 392. } else avconv.c:276:1: Parameter `ost->muxing_queue->rndx` 274. } 275. 276. static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost) ^ 277. { 278. AVFormatContext *s = of->ctx; avconv.c:286:28: Call 284. /* the muxer is not initialized yet, buffer the packet */ 285. if (!av_fifo_space(ost->muxing_queue)) { 286. int new_size = FFMIN(2 * av_fifo_size(ost->muxing_queue), ^ 287. ost->max_muxing_queue_size); 288. if (new_size <= av_fifo_size(ost->muxing_queue)) { libavutil/fifo.c:52:1: <LHS trace> 50. } 51. 52. int av_fifo_size(AVFifoBuffer *f) ^ 53. { 54. return (uint32_t)(f->wndx - f->rndx); libavutil/fifo.c:52:1: Parameter `f->wndx` 50. } 51. 52. int av_fifo_size(AVFifoBuffer *f) ^ 53. { 54. return (uint32_t)(f->wndx - f->rndx); libavutil/fifo.c:52:1: <RHS trace> 50. } 51. 52. int av_fifo_size(AVFifoBuffer *f) ^ 53. { 54. return (uint32_t)(f->wndx - f->rndx); libavutil/fifo.c:52:1: Parameter `f->rndx` 50. } 51. 52. int av_fifo_size(AVFifoBuffer *f) ^ 53. { 54. return (uint32_t)(f->wndx - f->rndx); libavutil/fifo.c:54:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `poll_filter` 52. int av_fifo_size(AVFifoBuffer *f) 53. { 54. return (uint32_t)(f->wndx - f->rndx); ^ 55. } 56.
https://github.com/libav/libav/blob/bd31c61cf94d01dbe1051cf65874e7b2c0ac5454/libavutil/fifo.c/#L54
d2a_code_trace_data_43424
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:1064: error: Uninitialized Value The value read from ymin was never initialized. libavcodec/motion_est_template.c:1064:9: 1062. (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) 1063. CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift) 1064. CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift) ^ 1065. CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) 1066. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1064
d2a_code_trace_data_43425
static int tls_curve_allowed(SSL *s, const unsigned char *curve, int op) { const tls_curve_info *cinfo; if (curve[0]) return 1; if ((curve[1] < 1) || ((size_t)curve[1] > OSSL_NELEM(nid_list))) return 0; cinfo = &nid_list[curve[1] - 1]; # ifdef OPENSSL_NO_EC2M if (cinfo->flags & TLS_CURVE_CHAR2) return 0; # endif return ssl_security(s, op, cinfo->secbits, cinfo->nid, (void *)curve); } ssl/t1_lib.c:529: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: 29 by call to `tls_curve_allowed`. Showing all 7 steps of the trace ssl/t1_lib.c:277:1: Array declaration 275. 276. /* The default curves */ 277. > static const unsigned char eccurves_default[] = { 278. 0, 29, /* X25519 (29) */ 279. /* Prefer P-256 which has the fastest and most secure implementations. */ ssl/t1_lib.c:529:22: Call 527. for (j = 0; j < num_supp; j++, tsupp += 2) { 528. if (pref[0] == tsupp[0] && pref[1] == tsupp[1]) { 529. if (!tls_curve_allowed(s, pref, SSL_SECOP_CURVE_SHARED)) ^ 530. continue; 531. if (nmatch == k) { ssl/t1_lib.c:419:1: <Offset trace> 417. 418. /* See if curve is allowed by security callback */ 419. > static int tls_curve_allowed(SSL *s, const unsigned char *curve, int op) 420. { 421. const tls_curve_info *cinfo; ssl/t1_lib.c:419:1: Parameter `*curve` 417. 418. /* See if curve is allowed by security callback */ 419. > static int tls_curve_allowed(SSL *s, const unsigned char *curve, int op) 420. { 421. const tls_curve_info *cinfo; ssl/t1_lib.c:237:1: <Length trace> 235. */ 236. 237. > static const tls_curve_info nid_list[] = { 238. {NID_sect163k1, 80, TLS_CURVE_CHAR2}, /* sect163k1 (1) */ 239. {NID_sect163r1, 80, TLS_CURVE_CHAR2}, /* sect163r1 (2) */ ssl/t1_lib.c:237:1: Array declaration 235. */ 236. 237. > static const tls_curve_info nid_list[] = { 238. {NID_sect163k1, 80, TLS_CURVE_CHAR2}, /* sect163k1 (1) */ 239. {NID_sect163r1, 80, TLS_CURVE_CHAR2}, /* sect163r1 (2) */ ssl/t1_lib.c:426:5: Array access: Offset: [-1, +oo] Size: 29 by call to `tls_curve_allowed` 424. if ((curve[1] < 1) || ((size_t)curve[1] > OSSL_NELEM(nid_list))) 425. return 0; 426. cinfo = &nid_list[curve[1] - 1]; ^ 427. # ifdef OPENSSL_NO_EC2M 428. if (cinfo->flags & TLS_CURVE_CHAR2)
https://github.com/openssl/openssl/blob/0421c00e56cad9bdce5c1df4d406b7fc799bf6ad/ssl/t1_lib.c/#L426
d2a_code_trace_data_43426
DH *ssl_get_auto_dh(SSL *s) { int dh_secbits = 80; if (s->cert->dh_tmp_auto == 2) return DH_get_1024_160(); if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) { if (s->s3->tmp.new_cipher->strength_bits == 256) dh_secbits = 128; else dh_secbits = 80; } else { CERT_PKEY *cpk = ssl_get_server_send_pkey(s); dh_secbits = EVP_PKEY_security_bits(cpk->privatekey); } if (dh_secbits >= 128) { DH *dhp = DH_new(); BIGNUM *p, *g; if (dhp == NULL) return NULL; g = BN_new(); if (g != NULL) BN_set_word(g, 2); if (dh_secbits >= 192) p = BN_get_rfc3526_prime_8192(NULL); else p = BN_get_rfc3526_prime_3072(NULL); if (p == NULL || g == NULL || !DH_set0_pqg(dhp, p, NULL, g)) { DH_free(dhp); BN_free(p); BN_free(g); return NULL; } return dhp; } if (dh_secbits >= 112) return DH_get_2048_224(); return DH_get_1024_160(); } ssl/t1_lib.c:2200: error: NULL_DEREFERENCE pointer `cpk` last assigned on line 2199 could be null and is dereferenced at line 2200, column 45. Showing all 30 steps of the trace ssl/t1_lib.c:2188:1: start of procedure ssl_get_auto_dh() 2186. 2187. #ifndef OPENSSL_NO_DH 2188. > DH *ssl_get_auto_dh(SSL *s) 2189. { 2190. int dh_secbits = 80; ssl/t1_lib.c:2190:5: 2188. DH *ssl_get_auto_dh(SSL *s) 2189. { 2190. > int dh_secbits = 80; 2191. if (s->cert->dh_tmp_auto == 2) 2192. return DH_get_1024_160(); ssl/t1_lib.c:2191:9: Taking false branch 2189. { 2190. int dh_secbits = 80; 2191. if (s->cert->dh_tmp_auto == 2) ^ 2192. return DH_get_1024_160(); 2193. if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) { ssl/t1_lib.c:2193:9: Taking false branch 2191. if (s->cert->dh_tmp_auto == 2) 2192. return DH_get_1024_160(); 2193. if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) { ^ 2194. if (s->s3->tmp.new_cipher->strength_bits == 256) 2195. dh_secbits = 128; ssl/t1_lib.c:2199:9: 2197. dh_secbits = 80; 2198. } else { 2199. > CERT_PKEY *cpk = ssl_get_server_send_pkey(s); 2200. dh_secbits = EVP_PKEY_security_bits(cpk->privatekey); 2201. } ssl/ssl_lib.c:2850:1: start of procedure ssl_get_server_send_pkey() 2848. } 2849. 2850. > CERT_PKEY *ssl_get_server_send_pkey(SSL *s) 2851. { 2852. CERT *c; ssl/ssl_lib.c:2855:5: 2853. int i; 2854. 2855. > c = s->cert; 2856. if (!s->s3 || !s->s3->tmp.new_cipher) 2857. return NULL; ssl/ssl_lib.c:2856:10: Taking false branch 2854. 2855. c = s->cert; 2856. if (!s->s3 || !s->s3->tmp.new_cipher) ^ 2857. return NULL; 2858. ssl_set_masks(s); ssl/ssl_lib.c:2856:20: Taking false branch 2854. 2855. c = s->cert; 2856. if (!s->s3 || !s->s3->tmp.new_cipher) ^ 2857. return NULL; 2858. ssl_set_masks(s); ssl/ssl_lib.c:2858:5: Skipping ssl_set_masks(): empty list of specs 2856. if (!s->s3 || !s->s3->tmp.new_cipher) 2857. return NULL; 2858. ssl_set_masks(s); ^ 2859. 2860. i = ssl_get_server_cert_index(s); ssl/ssl_lib.c:2860:5: 2858. ssl_set_masks(s); 2859. 2860. > i = ssl_get_server_cert_index(s); 2861. 2862. /* This may or may not be an error. */ ssl/ssl_lib.c:2823:1: start of procedure ssl_get_server_cert_index() 2821. #endif 2822. 2823. > static int ssl_get_server_cert_index(const SSL *s) 2824. { 2825. int idx; ssl/ssl_lib.c:2832:5: 2830. * forces the use of an RSA cert. This will need to change. 2831. */ 2832. > idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher); 2833. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509) 2834. idx = SSL_PKEY_RSA_SIGN; ssl/ssl_ciph.c:1893:1: start of procedure ssl_cipher_get_cert_index() 1891. 1892. /* For a cipher return the index corresponding to the certificate type */ 1893. > int ssl_cipher_get_cert_index(const SSL_CIPHER *c) 1894. { 1895. uint32_t alg_a; ssl/ssl_ciph.c:1897:5: 1895. uint32_t alg_a; 1896. 1897. > alg_a = c->algorithm_auth; 1898. 1899. if (alg_a & SSL_aECDSA) ssl/ssl_ciph.c:1899:9: Taking false branch 1897. alg_a = c->algorithm_auth; 1898. 1899. if (alg_a & SSL_aECDSA) ^ 1900. return SSL_PKEY_ECC; 1901. else if (alg_a & SSL_aDSS) ssl/ssl_ciph.c:1901:14: Taking false branch 1899. if (alg_a & SSL_aECDSA) 1900. return SSL_PKEY_ECC; 1901. else if (alg_a & SSL_aDSS) ^ 1902. return SSL_PKEY_DSA_SIGN; 1903. else if (alg_a & SSL_aRSA) ssl/ssl_ciph.c:1903:14: Taking true branch 1901. else if (alg_a & SSL_aDSS) 1902. return SSL_PKEY_DSA_SIGN; 1903. else if (alg_a & SSL_aRSA) ^ 1904. return SSL_PKEY_RSA_ENC; 1905. else if (alg_a & SSL_aGOST12) ssl/ssl_ciph.c:1904:9: 1902. return SSL_PKEY_DSA_SIGN; 1903. else if (alg_a & SSL_aRSA) 1904. > return SSL_PKEY_RSA_ENC; 1905. else if (alg_a & SSL_aGOST12) 1906. return SSL_PKEY_GOST_EC; ssl/ssl_ciph.c:1911:1: return from a call to ssl_cipher_get_cert_index 1909. 1910. return -1; 1911. > } 1912. 1913. const SSL_CIPHER *ssl_get_cipher_by_char(SSL *ssl, const unsigned char *ptr) ssl/ssl_lib.c:2833:9: Taking true branch 2831. */ 2832. idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher); 2833. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509) ^ 2834. idx = SSL_PKEY_RSA_SIGN; 2835. if (idx == SSL_PKEY_GOST_EC) { ssl/ssl_lib.c:2833:37: Taking false branch 2831. */ 2832. idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher); 2833. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509) ^ 2834. idx = SSL_PKEY_RSA_SIGN; 2835. if (idx == SSL_PKEY_GOST_EC) { ssl/ssl_lib.c:2835:9: Taking false branch 2833. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509) 2834. idx = SSL_PKEY_RSA_SIGN; 2835. if (idx == SSL_PKEY_GOST_EC) { ^ 2836. if (s->cert->pkeys[SSL_PKEY_GOST12_512].x509) 2837. idx = SSL_PKEY_GOST12_512; ssl/ssl_lib.c:2845:9: Taking false branch 2843. idx = -1; 2844. } 2845. if (idx == -1) ^ 2846. SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR); 2847. return idx; ssl/ssl_lib.c:2847:5: 2845. if (idx == -1) 2846. SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR); 2847. > return idx; 2848. } 2849. ssl/ssl_lib.c:2848:1: return from a call to ssl_get_server_cert_index 2846. SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR); 2847. return idx; 2848. > } 2849. 2850. CERT_PKEY *ssl_get_server_send_pkey(SSL *s) ssl/ssl_lib.c:2863:9: Taking true branch 2861. 2862. /* This may or may not be an error. */ 2863. if (i < 0) ^ 2864. return NULL; 2865. ssl/ssl_lib.c:2864:9: 2862. /* This may or may not be an error. */ 2863. if (i < 0) 2864. > return NULL; 2865. 2866. /* May be NULL. */ ssl/ssl_lib.c:2868:1: return from a call to ssl_get_server_send_pkey 2866. /* May be NULL. */ 2867. return &c->pkeys[i]; 2868. > } 2869. 2870. EVP_PKEY *ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *cipher, ssl/t1_lib.c:2200:9: 2198. } else { 2199. CERT_PKEY *cpk = ssl_get_server_send_pkey(s); 2200. > dh_secbits = EVP_PKEY_security_bits(cpk->privatekey); 2201. } 2202.
https://github.com/openssl/openssl/blob/e3bc1305ec97d4ad4ab05fa59a288e92df2b2025/ssl/t1_lib.c/#L2200
d2a_code_trace_data_43427
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/s3_enc.c:768: error: INTEGER_OVERFLOW_L2 ([-51, +oo] - 1):unsigned32 by call to `ssl3_cbc_digest_record`. Showing all 6 steps of the trace ssl/s3_enc.c:705:1: Parameter `ssl->s3->rrec.type` 703. } 704. 705. > int n_ssl3_mac(SSL *ssl, unsigned char *md, int send) 706. { 707. SSL3_RECORD *rec; ssl/s3_enc.c:738:2: Assignment 736. 737. /* kludge: ssl3_cbc_remove_padding passes padding length in rec->type */ 738. orig_len = rec->length+md_size+((unsigned int)rec->type>>8); ^ 739. rec->type &= 0xff; 740. ssl/s3_enc.c:768:3: Call 766. header[j++] = rec->length & 0xff; 767. 768. ssl3_cbc_digest_record( ^ 769. hash, 770. md, &md_size, ssl/s3_cbc.c:479:4: <LHS trace> 477. md_final_raw = tls1_md5_final_raw; 478. md_transform = (void(*)(void *ctx, const unsigned char *block)) MD5_Transform; 479. md_size = 16; ^ 480. sslv3_pad_length = 48; 481. length_is_big_endian = 0; ssl/s3_cbc.c:479:4: Assignment 477. md_final_raw = tls1_md5_final_raw; 478. md_transform = (void(*)(void *ctx, const unsigned char *block)) MD5_Transform; 479. md_size = 16; ^ 480. sslv3_pad_length = 48; 481. length_is_big_endian = 0; ssl/s3_cbc.c:569:2: Binary operation: ([-51, +oo] - 1):unsigned32 by call to `ssl3_cbc_digest_record` 567. /* max_mac_bytes contains the maximum bytes of bytes in the MAC, including 568. * |header|, assuming that there's no padding. */ 569. max_mac_bytes = len - md_size - 1; ^ 570. /* num_blocks is the maximum number of hash blocks. */ 571. num_blocks = (max_mac_bytes + 1 + md_length_size + md_block_size - 1) / md_block_size;
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/ssl/s3_cbc.c/#L569
d2a_code_trace_data_43428
void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) { unsigned long hash; OPENSSL_LH_NODE *nn, **rn; void *ret; lh->error = 0; rn = getrn(lh, data, &hash); if (*rn == NULL) { lh->num_no_delete++; return (NULL); } else { nn = *rn; *rn = nn->next; ret = nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))) contract(lh); return (ret); } ssl/ssl_lib.c:3149: error: INTEGER_OVERFLOW_L2 ([0, max(0, `s->ctx->sessions->num_items`)] - 1):unsigned64 by call to `SSL_free`. Showing all 17 steps of the trace ssl/ssl_lib.c:3029:1: Parameter `s->ctx->sessions->num_items` 3027. } 3028. 3029. > SSL *SSL_dup(SSL *s) 3030. { 3031. STACK_OF(X509_NAME) *sk; ssl/ssl_lib.c:3045:16: Call 3043. * Otherwise, copy configuration state, and session if set. 3044. */ 3045. if ((ret = SSL_new(SSL_get_SSL_CTX(s))) == NULL) ^ 3046. return (NULL); 3047. ssl/ssl_lib.c:518:1: Parameter `ctx->sessions->num_items` 516. } 517. 518. > SSL *SSL_new(SSL_CTX *ctx) 519. { 520. SSL *s; ssl/ssl_lib.c:3149:5: Call 3147. 3148. err: 3149. SSL_free(ret); ^ 3150. return NULL; 3151. } ssl/ssl_lib.c:926:1: Parameter `s->initial_ctx->sessions->num_items` 924. } 925. 926. > void SSL_free(SSL *s) 927. { 928. int i; ssl/ssl_lib.c:963:9: Call 961. /* Make the next call work :-) */ 962. if (s->session != NULL) { 963. ssl_clear_bad_session(s); ^ 964. SSL_SESSION_free(s->session); 965. } ssl/ssl_sess.c:986:1: Parameter `s->initial_ctx->sessions->num_items` 984. } 985. 986. > int ssl_clear_bad_session(SSL *s) 987. { 988. if ((s->session != NULL) && ssl/ssl_sess.c:991:9: Call 989. !(s->shutdown & SSL_SENT_SHUTDOWN) && 990. !(SSL_in_init(s) || SSL_in_before(s))) { 991. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 992. return (1); 993. } else ssl/ssl_sess.c:693:1: Parameter `ctx->sessions->num_items` 691. } 692. 693. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 694. { 695. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:695:12: Call 693. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 694. { 695. return remove_session_lock(ctx, c, 1); ^ 696. } 697. ssl/ssl_sess.c:698:1: Parameter `ctx->sessions->num_items` 696. } 697. 698. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 699. { 700. SSL_SESSION *r; ssl/ssl_sess.c:708:17: Call 706. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 707. ret = 1; 708. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 709. SSL_SESSION_list_remove(ctx, c); 710. } ssl/ssl_locl.h:581:1: Parameter `lh->num_items` 579. }; 580. 581. > DEFINE_LHASH_OF(SSL_SESSION); 582. /* Needed in ssl_cert.c */ 583. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:581:1: Call 579. }; 580. 581. > DEFINE_LHASH_OF(SSL_SESSION); 582. /* Needed in ssl_cert.c */ 583. 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->ctx->sessions->num_items)] - 1):unsigned64 by call to `SSL_free` 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/2dca984babedf93c560aba54da3f4c9222ee0d12/crypto/lhash/lhash.c/#L123
d2a_code_trace_data_43429
static ossl_inline void packet_forward(PACKET *pkt, size_t len) { pkt->curr += len; pkt->remaining -= len; } test/sslapitest.c:4610: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 5):unsigned64 by call to `PACKET_forward`. Showing all 10 steps of the trace test/sslapitest.c:4608:10: Call 4606. memset(&pkt3, 0, sizeof(pkt3)); 4607. 4608. if (!TEST_true( PACKET_buf_init( &pkt, data, len ) ) ^ 4609. /* Skip the record header */ 4610. || !PACKET_forward(&pkt, SSL3_RT_HEADER_LENGTH) ssl/packet_locl.h:68:8: Parameter `pkt->remaining` 66. * is being used. 67. */ 68. __owur static ossl_inline int PACKET_buf_init(PACKET *pkt, ^ 69. const unsigned char *buf, 70. size_t len) test/sslapitest.c:4610:17: Call 4608. if (!TEST_true( PACKET_buf_init( &pkt, data, len ) ) 4609. /* Skip the record header */ 4610. || !PACKET_forward(&pkt, SSL3_RT_HEADER_LENGTH) ^ 4611. /* Skip the handshake message header */ 4612. || !TEST_true(PACKET_forward(&pkt, SSL3_HM_HEADER_LENGTH)) ssl/packet_locl.h:463:8: Parameter `len` 461. 462. /* Move the current reading position forward |len| bytes */ 463. __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len) ^ 464. { 465. if (PACKET_remaining(pkt) < len) ssl/packet_locl.h:468:5: Call 466. return 0; 467. 468. packet_forward(pkt, len); ^ 469. 470. return 1; ssl/packet_locl.h:29:1: <LHS trace> 27. 28. /* Internal unchecked shorthand; don't use outside this file. */ 29. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 30. { 31. pkt->curr += len; ssl/packet_locl.h:29:1: Parameter `pkt->remaining` 27. 28. /* Internal unchecked shorthand; don't use outside this file. */ 29. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 30. { 31. pkt->curr += len; ssl/packet_locl.h:29:1: <RHS trace> 27. 28. /* Internal unchecked shorthand; don't use outside this file. */ 29. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 30. { 31. pkt->curr += len; ssl/packet_locl.h:29:1: Parameter `len` 27. 28. /* Internal unchecked shorthand; don't use outside this file. */ 29. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 30. { 31. pkt->curr += len; ssl/packet_locl.h:32:5: Binary operation: ([0, +oo] - 5):unsigned64 by call to `PACKET_forward` 30. { 31. pkt->curr += len; 32. pkt->remaining -= len; ^ 33. } 34.
https://github.com/openssl/openssl/blob/2e6b615f795e8ca8ae830a00079c4ea064eaae42/ssl/packet_locl.h/#L32
d2a_code_trace_data_43430
static int int_x509_param_set_hosts(X509_VERIFY_PARAM_ID *id, int mode, const unsigned char *name, size_t namelen) { char *copy; if (namelen == 0) namelen = name ? strlen((char *)name) : 0; else if (name && memchr(name, '\0', namelen > 1 ? namelen-1 : namelen)) return 0; if (name && name[namelen-1] == '\0') --namelen; if (mode == SET_HOST && id->hosts) { string_stack_free(id->hosts); id->hosts = NULL; } if (name == NULL || namelen == 0) return 1; copy = BUF_strndup((char *)name, namelen); if (copy == NULL) return 0; if (id->hosts == NULL && (id->hosts = sk_OPENSSL_STRING_new_null()) == NULL) { OPENSSL_free(copy); return 0; } if (!sk_OPENSSL_STRING_push(id->hosts, copy)) { OPENSSL_free(copy); if (sk_OPENSSL_STRING_num(id->hosts) == 0) { sk_OPENSSL_STRING_free(id->hosts); id->hosts = NULL; } return 0; } return 1; } crypto/x509/x509_vpm.c:93: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64. Showing all 3 steps of the trace crypto/x509/x509_vpm.c:80:1: <LHS trace> 78. #define string_stack_free(sk) sk_OPENSSL_STRING_pop_free(sk, str_free) 79. 80. > static int int_x509_param_set_hosts(X509_VERIFY_PARAM_ID *id, int mode, 81. const unsigned char *name, size_t namelen) 82. { crypto/x509/x509_vpm.c:80:1: Parameter `namelen` 78. #define string_stack_free(sk) sk_OPENSSL_STRING_pop_free(sk, str_free) 79. 80. > static int int_x509_param_set_hosts(X509_VERIFY_PARAM_ID *id, int mode, 81. const unsigned char *name, size_t namelen) 82. { crypto/x509/x509_vpm.c:93:14: Binary operation: ([0, +oo] - 1):unsigned64 91. else if (name && memchr(name, '\0', namelen > 1 ? namelen-1 : namelen)) 92. return 0; 93. if (name && name[namelen-1] == '\0') ^ 94. --namelen; 95.
https://github.com/openssl/openssl/blob/eef1827f89ebb82d3bcb5391fa15e05061bab4b2/crypto/x509/x509_vpm.c/#L93
d2a_code_trace_data_43431
static ChannelElement *get_che(AACContext *ac, int type, int elem_id) { int err_printed = 0; while (ac->tags_seen_this_frame[type][elem_id] && elem_id < MAX_ELEM_ID) { if (ac->output_configured < OC_LOCKED && !err_printed) { av_log(ac->avccontext, AV_LOG_WARNING, "Duplicate channel tag found, attempting to remap.\n"); err_printed = 1; } elem_id++; } if (elem_id == MAX_ELEM_ID) return NULL; ac->tags_seen_this_frame[type][elem_id] = 1; if (ac->tag_che_map[type][elem_id]) { return ac->tag_che_map[type][elem_id]; } if (ac->tags_mapped >= tags_per_config[ac->m4ac.chan_config]) { return NULL; } switch (ac->m4ac.chan_config) { case 7: if (ac->tags_mapped == 3 && type == TYPE_CPE) { ac->tags_mapped++; return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][2]; } case 6: if (ac->tags_mapped == tags_per_config[ac->m4ac.chan_config] - 1 && (type == TYPE_LFE || type == TYPE_SCE)) { ac->tags_mapped++; return ac->tag_che_map[type][elem_id] = ac->che[TYPE_LFE][0]; } case 5: if (ac->tags_mapped == 2 && type == TYPE_CPE) { ac->tags_mapped++; return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][1]; } case 4: if (ac->tags_mapped == 2 && ac->m4ac.chan_config == 4 && type == TYPE_SCE) { ac->tags_mapped++; return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][1]; } case 3: case 2: if (ac->tags_mapped == (ac->m4ac.chan_config != 2) && type == TYPE_CPE) { ac->tags_mapped++; return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][0]; } else if (ac->m4ac.chan_config == 2) { return NULL; } case 1: if (!ac->tags_mapped && type == TYPE_SCE) { ac->tags_mapped++; return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][0]; } default: return NULL; } } libavcodec/aac.c:121: error: Buffer Overrun L2 Offset: [`elem_id`, max(16, `elem_id`)] Size: 16. libavcodec/aac.c:114:1: <Offset trace> 112. static const char overread_err[] = "Input buffer exhausted before END element found\n"; 113. 114. static ChannelElement *get_che(AACContext *ac, int type, int elem_id) ^ 115. { 116. /* Some buggy encoders appear to set all elem_ids to zero and rely on libavcodec/aac.c:114:1: Parameter `elem_id` 112. static const char overread_err[] = "Input buffer exhausted before END element found\n"; 113. 114. static ChannelElement *get_che(AACContext *ac, int type, int elem_id) ^ 115. { 116. /* Some buggy encoders appear to set all elem_ids to zero and rely on libavcodec/aac.c:114:1: <Length trace> 112. static const char overread_err[] = "Input buffer exhausted before END element found\n"; 113. 114. static ChannelElement *get_che(AACContext *ac, int type, int elem_id) ^ 115. { 116. /* Some buggy encoders appear to set all elem_ids to zero and rely on libavcodec/aac.c:114:1: Parameter `ac->tags_seen_this_frame[*][*]` 112. static const char overread_err[] = "Input buffer exhausted before END element found\n"; 113. 114. static ChannelElement *get_che(AACContext *ac, int type, int elem_id) ^ 115. { 116. /* Some buggy encoders appear to set all elem_ids to zero and rely on libavcodec/aac.c:121:12: Array access: Offset: [elem_id, max(16, elem_id)] Size: 16 119. */ 120. int err_printed = 0; 121. while (ac->tags_seen_this_frame[type][elem_id] && elem_id < MAX_ELEM_ID) { ^ 122. if (ac->output_configured < OC_LOCKED && !err_printed) { 123. av_log(ac->avccontext, AV_LOG_WARNING, "Duplicate channel tag found, attempting to remap.\n");
https://github.com/libav/libav/blob/76561924cf3d9789653dc72d696f119862616891/libavcodec/aac.c/#L121
d2a_code_trace_data_43432
int dct_quantize_trellis_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow){ const int *qmat; const uint8_t *scantable= s->intra_scantable.scantable; const uint8_t *perm_scantable= s->intra_scantable.permutated; int max=0; unsigned int threshold1, threshold2; int bias=0; int run_tab[65]; int level_tab[65]; int score_tab[65]; int survivor[65]; int survivor_count; int last_run=0; int last_level=0; int last_score= 0; int last_i; int coeff[2][64]; int coeff_count[64]; int qmul, qadd, start_i, last_non_zero, i, dc; const int esc_length= s->ac_esc_length; uint8_t * length; uint8_t * last_length; const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6); s->dsp.fdct (block); if(s->dct_error_sum) s->denoise_dct(s, block); qmul= qscale*16; qadd= ((qscale-1)|1)*8; if (s->mb_intra) { int q; if (!s->h263_aic) { if (n < 4) q = s->y_dc_scale; else q = s->c_dc_scale; q = q << 3; } else{ q = 1 << 3; qadd=0; } block[0] = (block[0] + (q >> 1)) / q; start_i = 1; last_non_zero = 0; qmat = s->q_intra_matrix[qscale]; if(s->mpeg_quant || s->out_format == FMT_MPEG1) bias= 1<<(QMAT_SHIFT-1); length = s->intra_ac_vlc_length; last_length= s->intra_ac_vlc_last_length; } else { start_i = 0; last_non_zero = -1; qmat = s->q_inter_matrix[qscale]; length = s->inter_ac_vlc_length; last_length= s->inter_ac_vlc_last_length; } last_i= start_i; threshold1= (1<<QMAT_SHIFT) - bias - 1; threshold2= (threshold1<<1); for(i=63; i>=start_i; i--) { const int j = scantable[i]; int level = block[j] * qmat[j]; if(((unsigned)(level+threshold1))>threshold2){ last_non_zero = i; break; } } for(i=start_i; i<=last_non_zero; i++) { const int j = scantable[i]; int level = block[j] * qmat[j]; if(((unsigned)(level+threshold1))>threshold2){ if(level>0){ level= (bias + level)>>QMAT_SHIFT; coeff[0][i]= level; coeff[1][i]= level-1; }else{ level= (bias - level)>>QMAT_SHIFT; coeff[0][i]= -level; coeff[1][i]= -level+1; } coeff_count[i]= FFMIN(level, 2); assert(coeff_count[i]); max |=level; }else{ coeff[0][i]= (level>>31)|1; coeff_count[i]= 1; } } *overflow= s->max_qcoeff < max; if(last_non_zero < start_i){ memset(block + start_i, 0, (64-start_i)*sizeof(DCTELEM)); return last_non_zero; } score_tab[start_i]= 0; survivor[0]= start_i; survivor_count= 1; for(i=start_i; i<=last_non_zero; i++){ int level_index, j, zero_distoration; int dct_coeff= FFABS(block[ scantable[i] ]); int best_score=256*256*256*120; if ( s->dsp.fdct == fdct_ifast #ifndef FAAN_POSTSCALE || s->dsp.fdct == ff_faandct #endif ) dct_coeff= (dct_coeff*inv_aanscales[ scantable[i] ]) >> 12; zero_distoration= dct_coeff*dct_coeff; for(level_index=0; level_index < coeff_count[i]; level_index++){ int distoration; int level= coeff[level_index][i]; const int alevel= FFABS(level); int unquant_coeff; assert(level); if(s->out_format == FMT_H263){ unquant_coeff= alevel*qmul + qadd; }else{ j= s->dsp.idct_permutation[ scantable[i] ]; if(s->mb_intra){ unquant_coeff = (int)( alevel * qscale * s->intra_matrix[j]) >> 3; unquant_coeff = (unquant_coeff - 1) | 1; }else{ unquant_coeff = ((( alevel << 1) + 1) * qscale * ((int) s->inter_matrix[j])) >> 4; unquant_coeff = (unquant_coeff - 1) | 1; } unquant_coeff<<= 3; } distoration= (unquant_coeff - dct_coeff) * (unquant_coeff - dct_coeff) - zero_distoration; level+=64; if((level&(~127)) == 0){ for(j=survivor_count-1; j>=0; j--){ int run= i - survivor[j]; int score= distoration + length[UNI_AC_ENC_INDEX(run, level)]*lambda; score += score_tab[i-run]; if(score < best_score){ best_score= score; run_tab[i+1]= run; level_tab[i+1]= level-64; } } if(s->out_format == FMT_H263){ for(j=survivor_count-1; j>=0; j--){ int run= i - survivor[j]; int score= distoration + last_length[UNI_AC_ENC_INDEX(run, level)]*lambda; score += score_tab[i-run]; if(score < last_score){ last_score= score; last_run= run; last_level= level-64; last_i= i+1; } } } }else{ distoration += esc_length*lambda; for(j=survivor_count-1; j>=0; j--){ int run= i - survivor[j]; int score= distoration + score_tab[i-run]; if(score < best_score){ best_score= score; run_tab[i+1]= run; level_tab[i+1]= level-64; } } if(s->out_format == FMT_H263){ for(j=survivor_count-1; j>=0; j--){ int run= i - survivor[j]; int score= distoration + score_tab[i-run]; if(score < last_score){ last_score= score; last_run= run; last_level= level-64; last_i= i+1; } } } } } score_tab[i+1]= best_score; if(last_non_zero <= 27){ for(; survivor_count; survivor_count--){ if(score_tab[ survivor[survivor_count-1] ] <= best_score) break; } }else{ for(; survivor_count; survivor_count--){ if(score_tab[ survivor[survivor_count-1] ] <= best_score + lambda) break; } } survivor[ survivor_count++ ]= i+1; } if(s->out_format != FMT_H263){ last_score= 256*256*256*120; for(i= survivor[0]; i<=last_non_zero + 1; i++){ int score= score_tab[i]; if(i) score += lambda*2; if(score < last_score){ last_score= score; last_i= i; last_level= level_tab[i]; last_run= run_tab[i]; } } } s->coded_score[n] = last_score; dc= FFABS(block[0]); last_non_zero= last_i - 1; memset(block + start_i, 0, (64-start_i)*sizeof(DCTELEM)); if(last_non_zero < start_i) return last_non_zero; if(last_non_zero == 0 && start_i == 0){ int best_level= 0; int best_score= dc * dc; for(i=0; i<coeff_count[0]; i++){ int level= coeff[i][0]; int alevel= FFABS(level); int unquant_coeff, score, distortion; if(s->out_format == FMT_H263){ unquant_coeff= (alevel*qmul + qadd)>>3; }else{ unquant_coeff = ((( alevel << 1) + 1) * qscale * ((int) s->inter_matrix[0])) >> 4; unquant_coeff = (unquant_coeff - 1) | 1; } unquant_coeff = (unquant_coeff + 4) >> 3; unquant_coeff<<= 3 + 3; distortion= (unquant_coeff - dc) * (unquant_coeff - dc); level+=64; if((level&(~127)) == 0) score= distortion + last_length[UNI_AC_ENC_INDEX(0, level)]*lambda; else score= distortion + esc_length*lambda; if(score < best_score){ best_score= score; best_level= level - 64; } } block[0]= best_level; s->coded_score[n] = best_score - dc*dc; if(best_level == 0) return -1; else return last_non_zero; } i= last_i; assert(last_level); block[ perm_scantable[last_non_zero] ]= last_level; i -= last_run + 1; for(; i>start_i; i -= run_tab[i] + 1){ block[ perm_scantable[i-1] ]= level_tab[i]; } return last_non_zero; } libavcodec/mpegvideo_enc.c:3217: error: Uninitialized Value The value read from coeff_count[_] was never initialized. libavcodec/mpegvideo_enc.c:3217:18: 3215. int best_score= dc * dc; 3216. 3217. for(i=0; i<coeff_count[0]; i++){ ^ 3218. int level= coeff[i][0]; 3219. int alevel= FFABS(level);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo_enc.c/#L3217
d2a_code_trace_data_43433
static void encode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){ int x,y,i; const int ring_size= s->avctx->context_model ? 3 : 2; int_fast16_t sample_buffer[ring_size][w+6], *sample[ring_size]; s->run_index=0; memset(sample_buffer, 0, sizeof(sample_buffer)); for(y=0; y<h; y++){ for(i=0; i<ring_size; i++) sample[i]= sample_buffer[(h+i-y)%ring_size]+3; sample[0][-1]= sample[1][0 ]; sample[1][ w]= sample[1][w-1]; for(x=0; x<w; x++){ sample[0][x]= src[x + stride*y]; } encode_line(s, w, sample, plane_index, 8); } } libavcodec/ffv1.c:446: error: Buffer Overrun L3 Offset: [0, 2] Size: [2, 3]. libavcodec/ffv1.c:445:13: <Offset trace> 443. 444. for(y=0; y<h; y++){ 445. for(i=0; i<ring_size; i++) ^ 446. sample[i]= sample_buffer[(h+i-y)%ring_size]+3; 447. libavcodec/ffv1.c:445:13: Assignment 443. 444. for(y=0; y<h; y++){ 445. for(i=0; i<ring_size; i++) ^ 446. sample[i]= sample_buffer[(h+i-y)%ring_size]+3; 447. libavcodec/ffv1.c:438:26: <Length trace> 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: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:446:13: Array access: Offset: [0, 2] Size: [2, 3] 444. for(y=0; y<h; y++){ 445. for(i=0; i<ring_size; i++) 446. sample[i]= sample_buffer[(h+i-y)%ring_size]+3; ^ 447. 448. sample[0][-1]= sample[1][0 ];
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ffv1.c/#L446
d2a_code_trace_data_43434
PUT_STR16(be, avio_wb16) libavformat/aviobuf.c:306: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32. libavformat/aviobuf.c:306:1: <LHS trace> 304. 305. PUT_STR16(le, avio_wl16) 306. PUT_STR16(be, avio_wb16) ^ 307. 308. #undef PUT_STR16 libavformat/aviobuf.c:306:1: Parameter `*str` 304. 305. PUT_STR16(le, avio_wl16) 306. PUT_STR16(be, avio_wb16) ^ 307. 308. #undef PUT_STR16 libavformat/aviobuf.c:306:1: Assignment 304. 305. PUT_STR16(le, avio_wl16) 306. PUT_STR16(be, avio_wb16) ^ 307. 308. #undef PUT_STR16 libavformat/aviobuf.c:306:1: Assignment 304. 305. PUT_STR16(le, avio_wl16) 306. PUT_STR16(be, avio_wb16) ^ 307. 308. #undef PUT_STR16 libavformat/aviobuf.c:306:1: Binary operation: ([0, +oo] - 1):unsigned32 304. 305. PUT_STR16(le, avio_wl16) 306. PUT_STR16(be, avio_wb16) ^ 307. 308. #undef PUT_STR16
https://github.com/libav/libav/blob/252d6200c36e7eaa79f8d5205b7d731179e94897/libavformat/aviobuf.c/#L306
d2a_code_trace_data_43435
static inline void skip_remaining(BitstreamContext *bc, unsigned n) { #ifdef BITSTREAM_READER_LE bc->bits >>= n; #else bc->bits <<= n; #endif bc->bits_left -= n; } libavcodec/tak.c:137: error: Integer Overflow L2 ([0, +oo] - 2):unsigned32 by call to `bitstream_skip`. libavcodec/tak.c:136:34: Call 134. 135. if (ti->flags & TAK_FRAME_FLAG_IS_LAST) { 136. ti->last_frame_samples = bitstream_read(bc, TAK_FRAME_HEADER_SAMPLE_COUNT_BITS) + 1; ^ 137. bitstream_skip(bc, 2); 138. } else { 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/tak.c:137:9: Call 135. if (ti->flags & TAK_FRAME_FLAG_IS_LAST) { 136. ti->last_frame_samples = bitstream_read(bc, TAK_FRAME_HEADER_SAMPLE_COUNT_BITS) + 1; 137. bitstream_skip(bc, 2); ^ 138. } else { 139. ti->last_frame_samples = 0; libavcodec/bitstream.h:241:1: Parameter `n` 239. 240. /* Skip n bits in the buffer. */ 241. static inline void bitstream_skip(BitstreamContext *bc, unsigned n) ^ 242. { 243. if (n <= bc->bits_left) libavcodec/bitstream.h:244:9: Call 242. { 243. if (n <= bc->bits_left) 244. skip_remaining(bc, n); ^ 245. else { 246. n -= bc->bits_left; libavcodec/bitstream.h:230:1: <LHS trace> 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:230:1: Parameter `bc->bits_left` 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:230:1: <RHS trace> 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:230:1: Parameter `n` 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:237:5: Binary operation: ([0, +oo] - 2):unsigned32 by call to `bitstream_skip` 235. bc->bits <<= n; 236. #endif 237. bc->bits_left -= n; ^ 238. } 239.
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L237
d2a_code_trace_data_43436
void av_close_input_stream(AVFormatContext *s) { int i; AVStream *st; if (s->cur_st && s->cur_st->parser) av_free_packet(&s->cur_pkt); if (s->iformat->read_close) s->iformat->read_close(s); for(i=0;i<s->nb_streams;i++) { st = s->streams[i]; if (st->parser) { av_parser_close(st->parser); } av_free(st->index_entries); av_free(st->codec->extradata); av_free(st->codec); av_free(st->filename); av_free(st); } for(i=s->nb_programs-1; i>=0; i--) { av_freep(&s->programs[i]->provider_name); av_freep(&s->programs[i]->name); av_freep(&s->programs[i]->stream_index); av_freep(&s->programs[i]); } flush_packet_queue(s); av_freep(&s->priv_data); av_free(s); } vhook/watermark.c:242: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `get_watermark_picture`. vhook/watermark.c:232:9: Call 230. // img_convert parameters are 2 first destination, then 4 source 231. // sws_scale parameters are context, 4 first source, then 2 destination 232. sws_scale(ci->toRGB_convert_ctx, ^ 233. picture->data, picture->linesize, 0, src_height, 234. picture1.data, picture1.linesize); libavcodec/imgresample.c:599:1: Parameter `(*ctx->resampling_ctx->line_buf).*.strlen` 597. } 598. 599. int sws_scale(struct SwsContext *ctx, uint8_t* src[], int srcStride[], ^ 600. int srcSliceY, int srcSliceH, uint8_t* dst[], int dstStride[]) 601. { vhook/watermark.c:242:13: Call 240. 241. // Get me next frame 242. if (0 > get_watermark_picture(ci, 0)) { ^ 243. return; 244. } vhook/watermark.c:454:1: Parameter `ci->pFormatCtx->nb_programs` 452. * 0 = ok, -1 = error 453. ****************************************************************************/ 454. int get_watermark_picture(ContextInfo *ci, int cleanup) ^ 455. { 456. if (1 == ci->is_done && 0 == cleanup) return 0; vhook/watermark.c:645:13: Call 643. // Close the video file 644. if (0 != ci->pFormatCtx) { 645. av_close_input_file(ci->pFormatCtx); ^ 646. ci->pFormatCtx = 0; 647. } libavformat/utils.c:2152:1: Parameter `s->nb_programs` 2150. } 2151. 2152. void av_close_input_file(AVFormatContext *s) ^ 2153. { 2154. ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb; libavformat/utils.c:2155:5: Call 2153. { 2154. ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb; 2155. av_close_input_stream(s); ^ 2156. if (pb) 2157. url_fclose(pb); libavformat/utils.c:2118:1: <LHS trace> 2116. } 2117. 2118. void av_close_input_stream(AVFormatContext *s) ^ 2119. { 2120. int i; libavformat/utils.c:2118:1: Parameter `s->nb_programs` 2116. } 2117. 2118. void av_close_input_stream(AVFormatContext *s) ^ 2119. { 2120. int i; libavformat/utils.c:2141:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `get_watermark_picture` 2139. av_free(st); 2140. } 2141. for(i=s->nb_programs-1; i>=0; i--) { ^ 2142. av_freep(&s->programs[i]->provider_name); 2143. av_freep(&s->programs[i]->name);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/utils.c/#L2141
d2a_code_trace_data_43437
void ngx_strlow(u_char *dst, u_char *src, size_t n) { while (n--) { *dst = ngx_tolower(*src); dst++; src++; } } src/http/ngx_http_core_module.c:3649: error: Buffer Overrun L3 Offset: [1, +oo] Size: [0, +oo] by call to `ngx_http_script_compile`. src/http/ngx_http_core_module.c:3562:1: Parameter `conf->root.data` 3560. 3561. 3562. static char * ^ 3563. ngx_http_core_root(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) 3564. { src/http/ngx_http_core_module.c:3649:13: Call 3647. sc.complete_values = 1; 3648. 3649. if (ngx_http_script_compile(&sc) != NGX_OK) { ^ 3650. return NGX_CONF_ERROR; 3651. } src/http/ngx_http_script.c:229:1: Parameter `*sc->source->data` 227. 228. 229. ngx_int_t ^ 230. ngx_http_script_compile(ngx_http_script_compile_t *sc) 231. { src/http/ngx_http_script.c:284:17: Assignment 282. } 283. 284. name.data = &sc->source->data[i]; ^ 285. 286. } else { src/http/ngx_http_script.c:324:17: Call 322. sc->variables++; 323. 324. if (ngx_http_script_add_var_code(sc, &name) != NGX_OK) { ^ 325. return NGX_ERROR; 326. } src/http/ngx_http_script.c:657:1: Parameter `*name->data` 655. 656. 657. static ngx_int_t ^ 658. ngx_http_script_add_var_code(ngx_http_script_compile_t *sc, ngx_str_t *name) 659. { src/http/ngx_http_script.c:663:13: Call 661. ngx_http_script_var_code_t *code; 662. 663. index = ngx_http_get_variable_index(sc->cf, name); ^ 664. 665. if (index == NGX_ERROR) { src/http/ngx_http_variables.c:322:1: Parameter `*name->data` 320. 321. 322. ngx_int_t ^ 323. ngx_http_get_variable_index(ngx_conf_t *cf, ngx_str_t *name) 324. { src/http/ngx_http_variables.c:364:5: Call 362. } 363. 364. ngx_strlow(v->name.data, name->data, name->len); ^ 365. 366. v->set_handler = NULL; src/core/ngx_string.c:15:1: <Length trace> 13. 14. 15. void ^ 16. ngx_strlow(u_char *dst, u_char *src, size_t n) 17. { src/core/ngx_string.c:15:1: Parameter `*src` 13. 14. 15. void ^ 16. ngx_strlow(u_char *dst, u_char *src, size_t n) 17. { src/core/ngx_string.c:19:16: Array access: Offset: [1, +oo] Size: [0, +oo] by call to `ngx_http_script_compile` 17. { 18. while (n--) { 19. *dst = ngx_tolower(*src); ^ 20. dst++; 21. src++;
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_string.c/#L19
d2a_code_trace_data_43438
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:1075: error: Uninitialized Value The value read from xmax was never initialized. libavcodec/motion_est_template.c:1075:13: 1073. (last_mv[ref_mv_xy-ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) 1074. }else{ 1075. CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, ^ 1076. (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) 1077. if(s->mb_y+1<s->end_mb_y) //FIXME replace at least with last_slice_line
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1075
d2a_code_trace_data_43439
void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) { #ifdef POLY1305_ASM poly1305_blocks_f poly1305_blocks_p = ctx->func.blocks; #endif size_t rem, num; if ((num = ctx->num)) { rem = POLY1305_BLOCK_SIZE - num; if (len >= rem) { memcpy(ctx->data + num, inp, rem); poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 1); inp += rem; len -= rem; } else { memcpy(ctx->data + num, inp, len); ctx->num = num + len; return; } } rem = len % POLY1305_BLOCK_SIZE; len -= rem; if (len >= POLY1305_BLOCK_SIZE) { poly1305_blocks(ctx->opaque, inp, len, 1); inp += len; } if (rem) memcpy(ctx->data, inp, rem); ctx->num = rem; } crypto/evp/e_chacha20_poly1305.c:274: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [2-max(1, `ctx->cipher_data->num`), 15]):unsigned64 by call to `Poly1305_Update`. Showing all 7 steps of the trace crypto/evp/e_chacha20_poly1305.c:233:1: Parameter `len` 231. } 232. 233. > static int chacha20_poly1305_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 234. const unsigned char *in, size_t len) 235. { crypto/evp/e_chacha20_poly1305.c:274:17: Call 272. if (ctx->encrypt) { /* plaintext */ 273. chacha_cipher(ctx, out, in, plen); 274. Poly1305_Update(POLY1305_ctx(actx), out, plen); ^ 275. in += plen; 276. out += plen; crypto/poly1305/poly1305.c:466:1: <LHS trace> 464. #endif 465. 466. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) 467. { 468. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:466:1: Parameter `len` 464. #endif 465. 466. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) 467. { 468. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:466:1: <RHS trace> 464. #endif 465. 466. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) 467. { 468. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:466:1: Parameter `len` 464. #endif 465. 466. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) 467. { 468. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:485:13: Binary operation: ([0, +oo] - [2-max(1, ctx->cipher_data->num), 15]):unsigned64 by call to `Poly1305_Update` 483. poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 1); 484. inp += rem; 485. len -= rem; ^ 486. } else { 487. /* Still not enough data to process a block. */
https://github.com/openssl/openssl/blob/740b2b9a6cf31b02916a4d18f868e8a95934c083/crypto/poly1305/poly1305.c/#L485
d2a_code_trace_data_43440
static void new_subtitle_stream(AVFormatContext *oc, int file_idx) { AVStream *st; AVOutputStream *ost; AVCodec *codec=NULL; AVCodecContext *subtitle_enc; enum CodecID codec_id = CODEC_ID_NONE; 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){ if (subtitle_codec_name) { 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); } else { codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_SUBTITLE); codec = avcodec_find_encoder(codec_id); } } 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 (oc->oformat->flags & AVFMT_GLOBALHEADER) { subtitle_enc->flags |= CODEC_FLAG_GLOBAL_HEADER; avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->flags |= CODEC_FLAG_GLOBAL_HEADER; } if (subtitle_stream_copy) { st->stream_copy = 1; } else { subtitle_enc->codec_id = codec_id; 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:3622: error: Null Dereference pointer `st` last assigned on line 3616 could be null and is dereferenced at line 3622, column 20. ffmpeg.c:3608:1: start of procedure new_subtitle_stream() 3606. } 3607. 3608. static void new_subtitle_stream(AVFormatContext *oc, int file_idx) ^ 3609. { 3610. AVStream *st; ffmpeg.c:3612:5: 3610. AVStream *st; 3611. AVOutputStream *ost; 3612. AVCodec *codec=NULL; ^ 3613. AVCodecContext *subtitle_enc; 3614. enum CodecID codec_id = CODEC_ID_NONE; ffmpeg.c:3614:5: 3612. AVCodec *codec=NULL; 3613. AVCodecContext *subtitle_enc; 3614. enum CodecID codec_id = CODEC_ID_NONE; ^ 3615. 3616. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); ffmpeg.c:3616:28: Condition is true 3614. enum CodecID codec_id = CODEC_ID_NONE; 3615. 3616. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); ^ 3617. if (!st) { 3618. fprintf(stderr, "Could not alloc stream\n"); ffmpeg.c:3616:5: 3614. enum CodecID codec_id = CODEC_ID_NONE; 3615. 3616. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); ^ 3617. if (!st) { 3618. fprintf(stderr, "Could not alloc stream\n"); libavformat/utils.c:2586:1: start of procedure av_new_stream() 2584. } 2585. 2586. AVStream *av_new_stream(AVFormatContext *s, int id) ^ 2587. { 2588. AVStream *st; libavformat/utils.c:2592:9: Taking true branch 2590. AVStream **streams; 2591. 2592. if (s->nb_streams >= INT_MAX/sizeof(*streams)) ^ 2593. return NULL; 2594. streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams)); libavformat/utils.c:2593:9: 2591. 2592. if (s->nb_streams >= INT_MAX/sizeof(*streams)) 2593. return NULL; ^ 2594. streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams)); 2595. if (!streams) libavformat/utils.c:2635:1: return from a call to av_new_stream 2633. s->streams[s->nb_streams++] = st; 2634. return st; 2635. } ^ 2636. 2637. AVProgram *av_new_program(AVFormatContext *ac, int id) ffmpeg.c:3617:10: Taking true branch 3615. 3616. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); 3617. if (!st) { ^ 3618. fprintf(stderr, "Could not alloc stream\n"); 3619. ffmpeg_exit(1); ffmpeg.c:3618:9: 3616. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); 3617. if (!st) { 3618. fprintf(stderr, "Could not alloc stream\n"); ^ 3619. ffmpeg_exit(1); 3620. } ffmpeg.c:3619:9: Skipping ffmpeg_exit(): empty list of specs 3617. if (!st) { 3618. fprintf(stderr, "Could not alloc stream\n"); 3619. ffmpeg_exit(1); ^ 3620. } 3621. ost = new_output_stream(oc, file_idx); ffmpeg.c:3621:5: Skipping new_output_stream(): empty list of specs 3619. ffmpeg_exit(1); 3620. } 3621. ost = new_output_stream(oc, file_idx); ^ 3622. subtitle_enc = st->codec; 3623. output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); ffmpeg.c:3622:5: 3620. } 3621. ost = new_output_stream(oc, file_idx); 3622. subtitle_enc = st->codec; ^ 3623. output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); 3624. if(!subtitle_stream_copy){
https://github.com/libav/libav/blob/d0005d347d0831c904630fe70408c9fd4eec18e8/ffmpeg.c/#L3622
d2a_code_trace_data_43441
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/sslapitest.c:4447: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `SSL_free`. Showing all 17 steps of the trace test/sslapitest.c:4431:10: Call 4429. } 4430. 4431. if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, ^ 4432. NULL, NULL)) 4433. || !TEST_true(create_ssl_connection(serverssl, clientssl, test/ssltestlib.c:576:15: Call 574. if (*sssl != NULL) 575. serverssl = *sssl; 576. else if (!TEST_ptr(serverssl = SSL_new(serverctx))) ^ 577. goto error; 578. if (*cssl != NULL) ssl/ssl_lib.c:668:1: Parameter `ctx->sessions->num_items` 666. } 667. 668. > SSL *SSL_new(SSL_CTX *ctx) 669. { 670. SSL *s; test/sslapitest.c:4447:5: Call 4445. 4446. end: 4447. SSL_free(serverssl); ^ 4448. SSL_free(clientssl); 4449. SSL_CTX_free(sctx); ssl/ssl_lib.c:1124:1: Parameter `s->session_ctx->sessions->num_items` 1122. } 1123. 1124. > void SSL_free(SSL *s) 1125. { 1126. int i; ssl/ssl_lib.c:1155:9: Call 1153. /* Make the next call work :-) */ 1154. if (s->session != NULL) { 1155. ssl_clear_bad_session(s); ^ 1156. SSL_SESSION_free(s->session); 1157. } ssl/ssl_sess.c:1134:1: Parameter `s->session_ctx->sessions->num_items` 1132. } 1133. 1134. > int ssl_clear_bad_session(SSL *s) 1135. { 1136. if ((s->session != NULL) && ssl/ssl_sess.c:1139:9: Call 1137. !(s->shutdown & SSL_SENT_SHUTDOWN) && 1138. !(SSL_in_init(s) || SSL_in_before(s))) { 1139. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 1140. return 1; 1141. } else ssl/ssl_sess.c:751:1: Parameter `ctx->sessions->num_items` 749. } 750. 751. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 752. { 753. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:753:12: Call 751. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 752. { 753. return remove_session_lock(ctx, c, 1); ^ 754. } 755. ssl/ssl_sess.c:756:1: Parameter `ctx->sessions->num_items` 754. } 755. 756. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 757. { 758. SSL_SESSION *r; ssl/ssl_sess.c:766:17: Call 764. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) != NULL) { 765. ret = 1; 766. r = lh_SSL_SESSION_delete(ctx->sessions, r); ^ 767. SSL_SESSION_list_remove(ctx, r); 768. } ssl/ssl_locl.h:732:1: Parameter `lh->num_items` 730. } TLSEXT_INDEX; 731. 732. > DEFINE_LHASH_OF(SSL_SESSION); 733. /* Needed in ssl_cert.c */ 734. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:732:1: Call 730. } TLSEXT_INDEX; 731. 732. > DEFINE_LHASH_OF(SSL_SESSION); 733. /* Needed in ssl_cert.c */ 734. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:119:1: <LHS trace> 117. } 118. 119. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 120. { 121. unsigned long hash; crypto/lhash/lhash.c:119:1: Parameter `lh->num_items` 117. } 118. 119. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 120. { 121. unsigned long hash; crypto/lhash/lhash.c:139:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `SSL_free` 137. } 138. 139. lh->num_items--; ^ 140. if ((lh->num_nodes > MIN_NODES) && 141. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
https://github.com/openssl/openssl/blob/148796291e47ad402ddfd1bbe6f34a2652657ec2/crypto/lhash/lhash.c/#L139
d2a_code_trace_data_43442
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; bn_check_top(b); if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } test/bntest.c:2167: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_set_word`. Showing all 22 steps of the trace test/bntest.c:2167:14: Call 2165. 2166. for (trial = 0; trial <= 1; ++trial) { 2167. if (!TEST_true(BN_set_word(r, not_primes[i])) ^ 2168. || !TEST_false(BN_is_prime_fasttest_ex(r, 1, ctx, trial, NULL))) 2169. goto err; crypto/bn/bn_lib.c:367:15: Assignment 365. a->neg = 0; 366. a->d[0] = w; 367. a->top = (w ? 1 : 0); ^ 368. bn_check_top(a); 369. return 1; crypto/bn/bn_lib.c:367:5: Assignment 365. a->neg = 0; 366. a->d[0] = w; 367. a->top = (w ? 1 : 0); ^ 368. bn_check_top(a); 369. return 1; test/bntest.c:2167:14: Call 2165. 2166. for (trial = 0; trial <= 1; ++trial) { 2167. if (!TEST_true(BN_set_word(r, not_primes[i])) ^ 2168. || !TEST_false(BN_is_prime_fasttest_ex(r, 1, ctx, trial, NULL))) 2169. goto err; crypto/bn/bn_lib.c:360:1: Parameter `a->top` 358. } 359. 360. > int BN_set_word(BIGNUM *a, BN_ULONG w) 361. { 362. bn_check_top(a); crypto/bn/bn_lib.c:363:9: Call 361. { 362. bn_check_top(a); 363. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 364. return 0; 365. a->neg = 0; crypto/bn/bn_lcl.h:651:1: Parameter `a->top` 649. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 650. 651. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 652. { 653. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_lcl.h:659:12: Call 657. return a; 658. 659. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2); ^ 660. } 661. crypto/bn/bn_lib.c:246:1: Parameter `b->top` 244. */ 245. 246. > BIGNUM *bn_expand2(BIGNUM *b, int words) 247. { 248. bn_check_top(b); crypto/bn/bn_lib.c:251:23: Call 249. 250. if (words > b->dmax) { 251. BN_ULONG *a = bn_expand_internal(b, words); ^ 252. if (!a) 253. return NULL; crypto/bn/bn_lib.c:208:1: <Offset trace> 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:208:1: Parameter `b->top` 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:208:1: <Length trace> 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:208:1: Parameter `words` 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:225:13: Call 223. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 224. else 225. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 226. if (a == NULL) { 227. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/mem.c:228:1: Parameter `num` 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:17: Call 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/mem.c:230:5: Assignment 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:235:5: Assignment 233. if (ret != NULL) 234. memset(ret, 0, num); 235. return ret; ^ 236. } 237. crypto/bn/bn_lib.c:225:9: Assignment 223. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 224. else 225. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 226. if (a == NULL) { 227. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:233:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_set_word` 231. assert(b->top <= words); 232. if (b->top > 0) 233. memcpy(a, b->d, sizeof(*a) * b->top); ^ 234. 235. return a;
https://github.com/openssl/openssl/blob/b48d4397b8ee4256f0b0a115eb99f27ae89995e0/crypto/bn/bn_lib.c/#L233
d2a_code_trace_data_43443
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/hmac/hmac.c:136: error: USE_AFTER_FREE call to `HMAC_Init_ex()` eventually accesses memory that was invalidated by call to `free()` on line 135 indirectly during the call to `HMAC_CTX_reset()`. Showing all 18 steps of the trace crypto/hmac/hmac.c:132:1: invalidation part of the trace starts here 130. 131. #if OPENSSL_API_COMPAT < 0x10100000L 132. > int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md) 133. { 134. if (key && md) crypto/hmac/hmac.c:132:1: parameter `ctx` of HMAC_Init 130. 131. #if OPENSSL_API_COMPAT < 0x10100000L 132. > int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md) 133. { 134. if (key && md) crypto/hmac/hmac.c:135:9: when calling `HMAC_CTX_reset` here 133. { 134. if (key && md) 135. HMAC_CTX_reset(ctx); ^ 136. return HMAC_Init_ex(ctx, key, len, md, NULL); 137. } crypto/hmac/hmac.c:205:1: parameter `ctx` of HMAC_CTX_reset 203. } 204. 205. > int HMAC_CTX_reset(HMAC_CTX *ctx) 206. { 207. hmac_ctx_cleanup(ctx); crypto/hmac/hmac.c:207:5: when calling `hmac_ctx_cleanup` here 205. int HMAC_CTX_reset(HMAC_CTX *ctx) 206. { 207. hmac_ctx_cleanup(ctx); ^ 208. if (ctx->i_ctx == NULL) 209. ctx->i_ctx = EVP_MD_CTX_new(); crypto/hmac/hmac.c:184:1: parameter `ctx` of hmac_ctx_cleanup 182. } 183. 184. > static void hmac_ctx_cleanup(HMAC_CTX *ctx) 185. { 186. EVP_MD_CTX_reset(ctx->i_ctx); crypto/hmac/hmac.c:188:5: when calling `EVP_MD_CTX_reset` here 186. EVP_MD_CTX_reset(ctx->i_ctx); 187. EVP_MD_CTX_reset(ctx->o_ctx); 188. EVP_MD_CTX_reset(ctx->md_ctx); ^ 189. ctx->md = NULL; 190. ctx->key_length = 0; 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/hmac/hmac.c:132:1: use-after-lifetime part of the trace starts here 130. 131. #if OPENSSL_API_COMPAT < 0x10100000L 132. > int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md) 133. { 134. if (key && md) crypto/hmac/hmac.c:132:1: parameter `ctx` of HMAC_Init 130. 131. #if OPENSSL_API_COMPAT < 0x10100000L 132. > int HMAC_Init(HMAC_CTX *ctx, const void *key, int len, const EVP_MD *md) 133. { 134. if (key && md) crypto/hmac/hmac.c:136:12: when calling `HMAC_Init_ex` here 134. if (key && md) 135. HMAC_CTX_reset(ctx); 136. return HMAC_Init_ex(ctx, key, len, md, NULL); ^ 137. } 138. #endif 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_43444
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; if (num > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } q = ne->value->data; #ifdef CHARSET_EBCDIC if (type == V_ASN1_GENERALSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_PRINTABLESTRING || type == V_ASN1_TELETEXSTRING || type == V_ASN1_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 (l > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } if (b != NULL) { if (!BUF_MEM_grow(b, l + 1)) goto err; p = &(b->data[lold]); } else if (l > len) { break; } else p = &(buf[lold]); *(p++) = '/'; memcpy(p, s, (unsigned int)l1); p += l1; *(p++) = '='; #ifndef CHARSET_EBCDIC q = ne->value->data; #endif for (j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; #ifndef CHARSET_EBCDIC n = q[j]; if ((n < ' ') || (n > '~')) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = n; #else n = os_toascii[q[j]]; if ((n < os_toascii[' ']) || (n > os_toascii['~'])) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = q[j]; #endif } *p = '\0'; } if (b != NULL) { p = b->data; OPENSSL_free(b); } else p = buf; if (i == 0) *p = '\0'; return (p); err: X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE); end: BUF_MEM_free(b); return (NULL); } crypto/x509v3/v3_alt.c:146: error: BUFFER_OVERRUN_L3 Offset added: [200, 256] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace crypto/x509v3/v3_alt.c:146:9: Call 144. 145. case GEN_DIRNAME: 146. X509_NAME_oneline(gen->d.dirn, oline, 256); ^ 147. X509V3_add_value("DirName", oline, &ret); 148. break; crypto/x509/x509_obj.c:73:1: <Offset trace> 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:73:1: Parameter `len` 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:73:1: <Length trace> 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:73:1: Parameter `*buf` 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:104:9: Array access: Offset added: [200, 256] Size: [1, 2147483644] by call to `X509_NAME_oneline` 102. OPENSSL_free(b); 103. } 104. strncpy(buf, "NO X509_NAME", len); ^ 105. buf[len - 1] = '\0'; 106. return buf;
https://github.com/openssl/openssl/blob/24c2cd3967ed23acc0bd31a3781c4525e2e42a2c/crypto/x509/x509_obj.c/#L104
d2a_code_trace_data_43445
int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; pkt->written += len; pkt->curr += len; return 1; } ssl/t1_lib.c:1441: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `s->s3->previous_server_finished_len` + `pkt->written` + 21]):unsigned64 by call to `WPACKET_start_sub_packet_len__`. Showing all 10 steps of the trace ssl/t1_lib.c:1440:14: Call 1438. tls1_get_formatlist(s, &plist, &plistlen); 1439. 1440. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats) ^ 1441. || !WPACKET_start_sub_packet_u16(pkt) 1442. || !WPACKET_sub_memcpy_u8(pkt, plist, plistlen) ssl/packet.c:242:1: Parameter `pkt->buf->length` 240. } 241. 242. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 243. { 244. unsigned char *data; ssl/t1_lib.c:1441:21: Call 1439. 1440. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats) 1441. || !WPACKET_start_sub_packet_u16(pkt) ^ 1442. || !WPACKET_sub_memcpy_u8(pkt, plist, plistlen) 1443. || !WPACKET_close(pkt)) { ssl/packet.c:205:1: Parameter `pkt->written` 203. } 204. 205. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 206. { 207. WPACKET_SUB *sub; ssl/packet.c:229:10: Call 227. } 228. 229. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 230. return 0; 231. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */ ssl/packet.c:15:1: <LHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `pkt->buf->length` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: <RHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `len` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:25:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + s->s3->previous_server_finished_len + pkt->written + 21]):unsigned64 by call to `WPACKET_start_sub_packet_len__` 23. return 0; 24. 25. if (pkt->buf->length - pkt->written < len) { ^ 26. size_t newlen; 27. size_t reflen;
https://github.com/openssl/openssl/blob/7507e73d409b8f3046d6efcc3f4c0b6208b59b64/ssl/packet.c/#L25
d2a_code_trace_data_43446
static OSSL_PROVIDER *provider_new(const char *name, OSSL_provider_init_fn *init_function) { OSSL_PROVIDER *prov = NULL; if ((prov = OPENSSL_zalloc(sizeof(*prov))) == NULL #ifndef HAVE_ATOMICS || (prov->refcnt_lock = CRYPTO_THREAD_lock_new()) == NULL #endif || !ossl_provider_upref(prov) || (prov->name = OPENSSL_strdup(name)) == NULL) { ossl_provider_free(prov); CRYPTOerr(CRYPTO_F_PROVIDER_NEW, ERR_R_MALLOC_FAILURE); return NULL; } prov->init_function = init_function; return prov; } crypto/provider_core.c:184: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_zalloc()` at line 178, column 17 is not reachable after line 184, column 9. Showing all 48 steps of the trace crypto/provider_core.c:173:1: start of procedure provider_new() 171. */ 172. 173. > static OSSL_PROVIDER *provider_new(const char *name, 174. OSSL_provider_init_fn *init_function) 175. { crypto/provider_core.c:176:5: 174. OSSL_provider_init_fn *init_function) 175. { 176. > OSSL_PROVIDER *prov = NULL; 177. 178. if ((prov = OPENSSL_zalloc(sizeof(*prov))) == NULL crypto/provider_core.c:178:9: 176. OSSL_PROVIDER *prov = NULL; 177. 178. > if ((prov = OPENSSL_zalloc(sizeof(*prov))) == NULL 179. #ifndef HAVE_ATOMICS 180. || (prov->refcnt_lock = CRYPTO_THREAD_lock_new()) == NULL crypto/mem.c:228:1: start of procedure CRYPTO_zalloc() 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:5: 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. > void *ret = CRYPTO_malloc(num, file, line); 231. 232. FAILTEST(); crypto/mem.c: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. #if !defined(OPENSSL_NO_CRYPTO_MDEBUG) && !defined(FIPS_MODE) 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) crypto/mem.c:233:9: Taking true branch 231. 232. FAILTEST(); 233. if (ret != NULL) ^ 234. memset(ret, 0, num); 235. return ret; crypto/mem.c:234:9: 232. FAILTEST(); 233. if (ret != NULL) 234. > memset(ret, 0, num); 235. return ret; 236. } crypto/mem.c:235:5: 233. if (ret != NULL) 234. memset(ret, 0, num); 235. > return ret; 236. } 237. crypto/mem.c:236:1: return from a call to CRYPTO_zalloc 234. memset(ret, 0, num); 235. return ret; 236. > } 237. 238. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/provider_core.c:178:9: Taking false branch 176. OSSL_PROVIDER *prov = NULL; 177. 178. if ((prov = OPENSSL_zalloc(sizeof(*prov))) == NULL ^ 179. #ifndef HAVE_ATOMICS 180. || (prov->refcnt_lock = CRYPTO_THREAD_lock_new()) == NULL crypto/provider_core.c:182:13: 180. || (prov->refcnt_lock = CRYPTO_THREAD_lock_new()) == NULL 181. #endif 182. > || !ossl_provider_upref(prov) /* +1 One reference to be returned */ 183. || (prov->name = OPENSSL_strdup(name)) == NULL) { 184. ossl_provider_free(prov); crypto/provider_core.c:193:1: start of procedure ossl_provider_upref() 191. } 192. 193. > int ossl_provider_upref(OSSL_PROVIDER *prov) 194. { 195. int ref = 0; crypto/provider_core.c:195:5: 193. int ossl_provider_upref(OSSL_PROVIDER *prov) 194. { 195. > int ref = 0; 196. 197. if (CRYPTO_UP_REF(&prov->refcnt, &ref, prov->refcnt_lock) <= 0) crypto/provider_core.c:197:9: 195. int ref = 0; 196. 197. > if (CRYPTO_UP_REF(&prov->refcnt, &ref, prov->refcnt_lock) <= 0) 198. return 0; 199. return ref; include/internal/refcount.h:33:1: start of procedure CRYPTO_UP_REF() 31. typedef _Atomic int CRYPTO_REF_COUNT; 32. 33. > static inline int CRYPTO_UP_REF(_Atomic int *val, int *ret, void *lock) 34. { 35. *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1; include/internal/refcount.h:35:5: 33. static inline int CRYPTO_UP_REF(_Atomic int *val, int *ret, void *lock) 34. { 35. > *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1; 36. return 1; 37. } include/internal/refcount.h:36:5: 34. { 35. *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1; 36. > return 1; 37. } 38. include/internal/refcount.h:37:1: return from a call to CRYPTO_UP_REF 35. *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1; 36. return 1; 37. > } 38. 39. /* crypto/provider_core.c:197:9: Taking false branch 195. int ref = 0; 196. 197. if (CRYPTO_UP_REF(&prov->refcnt, &ref, prov->refcnt_lock) <= 0) ^ 198. return 0; 199. return ref; crypto/provider_core.c:199:5: 197. if (CRYPTO_UP_REF(&prov->refcnt, &ref, prov->refcnt_lock) <= 0) 198. return 0; 199. > return ref; 200. } 201. crypto/provider_core.c:200:1: return from a call to ossl_provider_upref 198. return 0; 199. return ref; 200. > } 201. 202. OSSL_PROVIDER *ossl_provider_new(OPENSSL_CTX *libctx, const char *name, crypto/provider_core.c:182:13: Taking false branch 180. || (prov->refcnt_lock = CRYPTO_THREAD_lock_new()) == NULL 181. #endif 182. || !ossl_provider_upref(prov) /* +1 One reference to be returned */ ^ 183. || (prov->name = OPENSSL_strdup(name)) == NULL) { 184. ossl_provider_free(prov); crypto/provider_core.c:183:12: 181. #endif 182. || !ossl_provider_upref(prov) /* +1 One reference to be returned */ 183. > || (prov->name = OPENSSL_strdup(name)) == NULL) { 184. ossl_provider_free(prov); 185. CRYPTOerr(CRYPTO_F_PROVIDER_NEW, ERR_R_MALLOC_FAILURE); crypto/o_str.c:27:1: start of procedure CRYPTO_strdup() 25. } 26. 27. > char *CRYPTO_strdup(const char *str, const char* file, int line) 28. { 29. char *ret; crypto/o_str.c:31:9: Taking false branch 29. char *ret; 30. 31. if (str == NULL) ^ 32. return NULL; 33. ret = CRYPTO_malloc(strlen(str) + 1, file, line); crypto/o_str.c:33:5: 31. if (str == NULL) 32. return NULL; 33. > ret = CRYPTO_malloc(strlen(str) + 1, file, line); 34. if (ret != NULL) 35. strcpy(ret, str); 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 true 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:197:32: Taking true 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:198:9: Skipping __function_pointer__(): unresolved function pointer 196. INCREMENT(malloc_count); 197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) 198. return malloc_impl(num, file, line); ^ 199. 200. if (num == 0) 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) crypto/o_str.c:34:9: Taking false branch 32. return NULL; 33. ret = CRYPTO_malloc(strlen(str) + 1, file, line); 34. if (ret != NULL) ^ 35. strcpy(ret, str); 36. return ret; crypto/o_str.c:36:5: 34. if (ret != NULL) 35. strcpy(ret, str); 36. > return ret; 37. } 38. crypto/o_str.c:37:1: return from a call to CRYPTO_strdup 35. strcpy(ret, str); 36. return ret; 37. > } 38. 39. char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line) crypto/provider_core.c:183:12: Taking true branch 181. #endif 182. || !ossl_provider_upref(prov) /* +1 One reference to be returned */ 183. || (prov->name = OPENSSL_strdup(name)) == NULL) { ^ 184. ossl_provider_free(prov); 185. CRYPTOerr(CRYPTO_F_PROVIDER_NEW, ERR_R_MALLOC_FAILURE); crypto/provider_core.c:184:9: Skipping ossl_provider_free(): empty list of specs 182. || !ossl_provider_upref(prov) /* +1 One reference to be returned */ 183. || (prov->name = OPENSSL_strdup(name)) == NULL) { 184. ossl_provider_free(prov); ^ 185. CRYPTOerr(CRYPTO_F_PROVIDER_NEW, ERR_R_MALLOC_FAILURE); 186. return NULL;
https://github.com/openssl/openssl/blob/37ca204b96b036f949b8bc8389c1f8e806e1cbec/crypto/provider_core.c/#L184
d2a_code_trace_data_43447
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; bn_check_top(b); if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return (NULL); } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return (NULL); } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } crypto/bn/bn_prime.c:221: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_pseudo_rand_range`. Showing all 25 steps of the trace crypto/bn/bn_prime.c:197:10: Call 195. 196. /* compute A1 := a - 1 */ 197. if (!BN_copy(A1, a)) ^ 198. goto err; 199. if (!BN_sub_word(A1, 1)) crypto/bn/bn_lib.c:323:1: Parameter `a->top` 321. } 322. 323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 324. { 325. bn_check_top(b); crypto/bn/bn_prime.c:221:14: Call 219. 220. for (i = 0; i < checks; i++) { 221. if (!BN_pseudo_rand_range(check, A1)) ^ 222. goto err; 223. if (!BN_add_word(check, 1)) crypto/bn/bn_rand.c:182:1: Parameter `r->top` 180. } 181. 182. > int BN_pseudo_rand_range(BIGNUM *r, const BIGNUM *range) 183. { 184. return bn_rand_range(1, r, range); crypto/bn/bn_rand.c:184:12: Call 182. int BN_pseudo_rand_range(BIGNUM *r, const BIGNUM *range) 183. { 184. return bn_rand_range(1, r, range); ^ 185. } 186. crypto/bn/bn_rand.c:112:1: Parameter `r->top` 110. 111. /* random number r: 0 <= r < range */ 112. > static int bn_rand_range(int pseudo, BIGNUM *r, const BIGNUM *range) 113. { 114. int (*bn_rand) (BIGNUM *, int, int, int) = crypto/bn/bn_rand.c:129:9: Call 127. 128. if (n == 1) 129. BN_zero(r); ^ 130. else if (!BN_is_bit_set(range, n - 2) && !BN_is_bit_set(range, n - 3)) { 131. /* crypto/bn/bn_lib.c:395:1: Parameter `a->top` 393. } 394. 395. > int BN_set_word(BIGNUM *a, BN_ULONG w) 396. { 397. bn_check_top(a); crypto/bn/bn_lib.c:398:9: Call 396. { 397. bn_check_top(a); 398. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 399. return (0); 400. a->neg = 0; crypto/bn/bn_lcl.h:660:1: Parameter `a->top` 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:284:1: Parameter `b->top` 282. */ 283. 284. > BIGNUM *bn_expand2(BIGNUM *b, int words) 285. { 286. bn_check_top(b); crypto/bn/bn_lib.c:289:23: Call 287. 288. if (words > b->dmax) { 289. BN_ULONG *a = bn_expand_internal(b, words); ^ 290. if (!a) 291. return NULL; crypto/bn/bn_lib.c:246:1: <Offset trace> 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:246:1: Parameter `b->top` 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:246:1: <Length trace> 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:246:1: Parameter `words` 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:263:13: Call 261. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 262. else 263. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 264. if (a == NULL) { 265. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/mem.c:186:1: Parameter `num` 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:17: Call 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:166:9: Assignment 164. 165. if (num == 0) 166. return NULL; ^ 167. 168. FAILTEST(); crypto/mem.c:188:5: Assignment 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:193:5: Assignment 191. if (ret != NULL) 192. memset(ret, 0, num); 193. return ret; ^ 194. } 195. crypto/bn/bn_lib.c:263:9: Assignment 261. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 262. else 263. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 264. if (a == NULL) { 265. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:271:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_pseudo_rand_range` 269. assert(b->top <= words); 270. if (b->top > 0) 271. memcpy(a, b->d, sizeof(*a) * b->top); ^ 272. 273. return a;
https://github.com/openssl/openssl/blob/757264207ad8650a89ea903d48ad89f61d56ea9c/crypto/bn/bn_lib.c/#L271
d2a_code_trace_data_43448
static void opt_input_ts_scale(const char *arg) { unsigned int stream; double scale; char *p; stream = strtol(arg, &p, 0); if (*p) p++; scale= strtod(p, &p); if(stream >= MAX_STREAMS) ffmpeg_exit(1); input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); input_files_ts_scale[nb_input_files][stream]= scale; } ffmpeg.c:3057: error: Null Dereference pointer `input_files_ts_scale[nb_input_files]` last assigned on line 3056 could be null and is dereferenced at line 3057, column 5. ffmpeg.c:3042:1: start of procedure opt_input_ts_scale() 3040. } 3041. 3042. static void opt_input_ts_scale(const char *arg) ^ 3043. { 3044. unsigned int stream; ffmpeg.c:3048:5: 3046. char *p; 3047. 3048. stream = strtol(arg, &p, 0); ^ 3049. if (*p) 3050. p++; ffmpeg.c:3049:9: Taking true branch 3047. 3048. stream = strtol(arg, &p, 0); 3049. if (*p) ^ 3050. p++; 3051. scale= strtod(p, &p); ffmpeg.c:3050:9: 3048. stream = strtol(arg, &p, 0); 3049. if (*p) 3050. p++; ^ 3051. scale= strtod(p, &p); 3052. ffmpeg.c:3051:5: 3049. if (*p) 3050. p++; 3051. scale= strtod(p, &p); ^ 3052. 3053. if(stream >= MAX_STREAMS) ffmpeg.c:3053:8: Taking true branch 3051. scale= strtod(p, &p); 3052. 3053. if(stream >= MAX_STREAMS) ^ 3054. ffmpeg_exit(1); 3055. ffmpeg.c:3054:9: Skipping ffmpeg_exit(): empty list of specs 3052. 3053. if(stream >= MAX_STREAMS) 3054. ffmpeg_exit(1); ^ 3055. 3056. input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); ffmpeg.c:3056:5: 3054. ffmpeg_exit(1); 3055. 3056. input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); ^ 3057. input_files_ts_scale[nb_input_files][stream]= scale; 3058. } ffmpeg.c:561:1: start of procedure grow_array() 559. 560. /* similar to ff_dynarray_add() and av_fast_realloc() */ 561. static void *grow_array(void *array, int elem_size, int *size, int new_size) ^ 562. { 563. if (new_size >= INT_MAX / elem_size) { ffmpeg.c:563:9: Taking true branch 561. static void *grow_array(void *array, int elem_size, int *size, int new_size) 562. { 563. if (new_size >= INT_MAX / elem_size) { ^ 564. fprintf(stderr, "Array too big.\n"); 565. ffmpeg_exit(1); ffmpeg.c:564:9: 562. { 563. if (new_size >= INT_MAX / elem_size) { 564. fprintf(stderr, "Array too big.\n"); ^ 565. ffmpeg_exit(1); 566. } ffmpeg.c:565:9: Skipping ffmpeg_exit(): empty list of specs 563. if (new_size >= INT_MAX / elem_size) { 564. fprintf(stderr, "Array too big.\n"); 565. ffmpeg_exit(1); ^ 566. } 567. if (*size < new_size) { ffmpeg.c:567:9: Taking true branch 565. ffmpeg_exit(1); 566. } 567. if (*size < new_size) { ^ 568. uint8_t *tmp = av_realloc(array, new_size*elem_size); 569. if (!tmp) { ffmpeg.c:568:9: 566. } 567. if (*size < new_size) { 568. uint8_t *tmp = av_realloc(array, new_size*elem_size); ^ 569. if (!tmp) { 570. fprintf(stderr, "Could not alloc buffer.\n"); libavutil/mem.c:119:1: start of procedure av_realloc() 117. } 118. 119. void *av_realloc(void *ptr, FF_INTERNAL_MEM_TYPE size) ^ 120. { 121. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:126:8: Taking false branch 124. 125. /* let's disallow possible ambiguous cases */ 126. if(size > (INT_MAX-16) ) ^ 127. return NULL; 128. libavutil/mem.c:135:5: 133. return (char*)realloc((char*)ptr - diff, size + diff) + diff; 134. #else 135. return realloc(ptr, size); ^ 136. #endif 137. } libavutil/mem.c:137:1: return from a call to av_realloc 135. return realloc(ptr, size); 136. #endif 137. } ^ 138. 139. void av_free(void *ptr) ffmpeg.c:569:14: Taking true branch 567. if (*size < new_size) { 568. uint8_t *tmp = av_realloc(array, new_size*elem_size); 569. if (!tmp) { ^ 570. fprintf(stderr, "Could not alloc buffer.\n"); 571. ffmpeg_exit(1); ffmpeg.c:570:13: 568. uint8_t *tmp = av_realloc(array, new_size*elem_size); 569. if (!tmp) { 570. fprintf(stderr, "Could not alloc buffer.\n"); ^ 571. ffmpeg_exit(1); 572. } ffmpeg.c:571:13: Skipping ffmpeg_exit(): empty list of specs 569. if (!tmp) { 570. fprintf(stderr, "Could not alloc buffer.\n"); 571. ffmpeg_exit(1); ^ 572. } 573. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); ffmpeg.c:573:9: 571. ffmpeg_exit(1); 572. } 573. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); ^ 574. *size = new_size; 575. return tmp; ffmpeg.c:574:9: 572. } 573. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); 574. *size = new_size; ^ 575. return tmp; 576. } ffmpeg.c:575:9: 573. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); 574. *size = new_size; 575. return tmp; ^ 576. } 577. return array; ffmpeg.c:578:1: return from a call to grow_array 576. } 577. return array; 578. } ^ 579. 580. static void choose_sample_fmt(AVStream *st, AVCodec *codec) ffmpeg.c:3057:5: 3055. 3056. input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); 3057. input_files_ts_scale[nb_input_files][stream]= scale; ^ 3058. } 3059.
https://github.com/libav/libav/blob/f4c79d1e0b2e797012304db57903e4091b0c2d7c/ffmpeg.c/#L3057
d2a_code_trace_data_43449
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_ossl.c:684: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `bn_mul_mont_fixed_top`. Showing all 60 steps of the trace crypto/rsa/rsa_ossl.c:591:1: Parameter `ctx->stack.depth` 589. } 590. 591. > static int rsa_ossl_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) 592. { 593. BIGNUM *r1, *m1, *vrfy, *r2, *m[RSA_MAX_PRIME_NUM - 2]; crypto/rsa/rsa_ossl.c:597:5: Call 595. RSA_PRIME_INFO *pinfo; 596. 597. BN_CTX_start(ctx); ^ 598. 599. r1 = 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/rsa/rsa_ossl.c:599:10: Call 597. BN_CTX_start(ctx); 598. 599. r1 = BN_CTX_get(ctx); ^ 600. r2 = BN_CTX_get(ctx); 601. m1 = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/rsa/rsa_ossl.c:600:10: Call 598. 599. r1 = BN_CTX_get(ctx); 600. r2 = BN_CTX_get(ctx); ^ 601. m1 = BN_CTX_get(ctx); 602. vrfy = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/rsa/rsa_ossl.c:601:10: Call 599. r1 = BN_CTX_get(ctx); 600. r2 = BN_CTX_get(ctx); 601. m1 = BN_CTX_get(ctx); ^ 602. vrfy = BN_CTX_get(ctx); 603. if (vrfy == 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/rsa/rsa_ossl.c:602:12: Call 600. r2 = BN_CTX_get(ctx); 601. m1 = BN_CTX_get(ctx); 602. vrfy = BN_CTX_get(ctx); ^ 603. if (vrfy == NULL) 604. 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/rsa/rsa_ossl.c:662:14: Call 660. */ 661. if (/* m1 = I moq q */ 662. !bn_from_mont_fixed_top(m1, I, rsa->_method_mod_q, ctx) ^ 663. || !bn_to_mont_fixed_top(m1, m1, rsa->_method_mod_q, ctx) 664. /* m1 = m1^dmq1 mod q */ crypto/bn/bn_mont.c:174:1: Parameter `ctx->stack.depth` 172. } 173. 174. > int bn_from_mont_fixed_top(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont, 175. BN_CTX *ctx) 176. { crypto/bn/bn_mont.c:181:5: Call 179. BIGNUM *t; 180. 181. BN_CTX_start(ctx); ^ 182. if ((t = BN_CTX_get(ctx)) && BN_copy(t, a)) { 183. retn = bn_from_montgomery_word(ret, t, mont); 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_mont.c:182:14: Call 180. 181. BN_CTX_start(ctx); 182. if ((t = BN_CTX_get(ctx)) && BN_copy(t, a)) { ^ 183. retn = bn_from_montgomery_word(ret, t, mont); 184. } 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_mont.c:185:5: Call 183. retn = bn_from_montgomery_word(ret, t, mont); 184. } 185. BN_CTX_end(ctx); ^ 186. #else /* !MONT_WORD */ 187. BIGNUM *t1, *t2; crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/rsa/rsa_ossl.c:663:17: Call 661. if (/* m1 = I moq q */ 662. !bn_from_mont_fixed_top(m1, I, rsa->_method_mod_q, ctx) 663. || !bn_to_mont_fixed_top(m1, m1, rsa->_method_mod_q, ctx) ^ 664. /* m1 = m1^dmq1 mod q */ 665. || !BN_mod_exp_mont_consttime(m1, m1, rsa->dmq1, rsa->q, ctx, crypto/bn/bn_mont.c:222:1: Parameter `ctx->stack.depth` 220. } 221. 222. > int bn_to_mont_fixed_top(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 223. BN_CTX *ctx) 224. { crypto/bn/bn_mont.c:225:12: Call 223. BN_CTX *ctx) 224. { 225. return bn_mul_mont_fixed_top(r, a, &(mont->RR), mont, ctx); ^ 226. } 227. crypto/bn/bn_mont.c:37:1: Parameter `ctx->stack.depth` 35. } 36. 37. > int bn_mul_mont_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 38. BN_MONT_CTX *mont, BN_CTX *ctx) 39. { crypto/rsa/rsa_ossl.c:665:17: Call 663. || !bn_to_mont_fixed_top(m1, m1, rsa->_method_mod_q, ctx) 664. /* m1 = m1^dmq1 mod q */ 665. || !BN_mod_exp_mont_consttime(m1, m1, rsa->dmq1, rsa->q, ctx, ^ 666. rsa->_method_mod_q) 667. /* r1 = I mod p */ crypto/bn/bn_exp.c:592:1: Parameter `ctx->stack.depth` 590. * http://www.daemonology.net/hyperthreading-considered-harmful/) 591. */ 592. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 593. const BIGNUM *m, BN_CTX *ctx, 594. BN_MONT_CTX *in_mont) crypto/rsa/rsa_ossl.c:668:17: Call 666. rsa->_method_mod_q) 667. /* r1 = I mod p */ 668. || !bn_from_mont_fixed_top(r1, I, rsa->_method_mod_p, ctx) ^ 669. || !bn_to_mont_fixed_top(r1, r1, rsa->_method_mod_p, ctx) 670. /* r1 = r1^dmp1 mod p */ crypto/bn/bn_mont.c:174:1: Parameter `ctx->stack.depth` 172. } 173. 174. > int bn_from_mont_fixed_top(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont, 175. BN_CTX *ctx) 176. { crypto/bn/bn_mont.c:181:5: Call 179. BIGNUM *t; 180. 181. BN_CTX_start(ctx); ^ 182. if ((t = BN_CTX_get(ctx)) && BN_copy(t, a)) { 183. retn = bn_from_montgomery_word(ret, t, mont); 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_mont.c:182:14: Call 180. 181. BN_CTX_start(ctx); 182. if ((t = BN_CTX_get(ctx)) && BN_copy(t, a)) { ^ 183. retn = bn_from_montgomery_word(ret, t, mont); 184. } 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_mont.c:185:5: Call 183. retn = bn_from_montgomery_word(ret, t, mont); 184. } 185. BN_CTX_end(ctx); ^ 186. #else /* !MONT_WORD */ 187. BIGNUM *t1, *t2; crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/rsa/rsa_ossl.c:669:17: Call 667. /* r1 = I mod p */ 668. || !bn_from_mont_fixed_top(r1, I, rsa->_method_mod_p, ctx) 669. || !bn_to_mont_fixed_top(r1, r1, rsa->_method_mod_p, ctx) ^ 670. /* r1 = r1^dmp1 mod p */ 671. || !BN_mod_exp_mont_consttime(r1, r1, rsa->dmp1, rsa->p, ctx, crypto/bn/bn_mont.c:222:1: Parameter `ctx->stack.depth` 220. } 221. 222. > int bn_to_mont_fixed_top(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 223. BN_CTX *ctx) 224. { crypto/bn/bn_mont.c:225:12: Call 223. BN_CTX *ctx) 224. { 225. return bn_mul_mont_fixed_top(r, a, &(mont->RR), mont, ctx); ^ 226. } 227. crypto/bn/bn_mont.c:37:1: Parameter `ctx->stack.depth` 35. } 36. 37. > int bn_mul_mont_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 38. BN_MONT_CTX *mont, BN_CTX *ctx) 39. { crypto/rsa/rsa_ossl.c:671:17: Call 669. || !bn_to_mont_fixed_top(r1, r1, rsa->_method_mod_p, ctx) 670. /* r1 = r1^dmp1 mod p */ 671. || !BN_mod_exp_mont_consttime(r1, r1, rsa->dmp1, rsa->p, ctx, ^ 672. rsa->_method_mod_p) 673. /* r1 = (r1 - m1) mod p */ crypto/bn/bn_exp.c:592:1: Parameter `ctx->stack.depth` 590. * http://www.daemonology.net/hyperthreading-considered-harmful/) 591. */ 592. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 593. const BIGNUM *m, BN_CTX *ctx, 594. BN_MONT_CTX *in_mont) crypto/rsa/rsa_ossl.c:683:17: Call 681. 682. /* r1 = r1 * iqmp mod p */ 683. || !bn_to_mont_fixed_top(r1, r1, rsa->_method_mod_p, ctx) ^ 684. || !bn_mul_mont_fixed_top(r1, r1, rsa->iqmp, rsa->_method_mod_p, 685. ctx) crypto/bn/bn_mont.c:222:1: Parameter `ctx->stack.depth` 220. } 221. 222. > int bn_to_mont_fixed_top(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 223. BN_CTX *ctx) 224. { crypto/bn/bn_mont.c:225:12: Call 223. BN_CTX *ctx) 224. { 225. return bn_mul_mont_fixed_top(r, a, &(mont->RR), mont, ctx); ^ 226. } 227. crypto/bn/bn_mont.c:37:1: Parameter `ctx->stack.depth` 35. } 36. 37. > int bn_mul_mont_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 38. BN_MONT_CTX *mont, BN_CTX *ctx) 39. { crypto/rsa/rsa_ossl.c:684:17: Call 682. /* r1 = r1 * iqmp mod p */ 683. || !bn_to_mont_fixed_top(r1, r1, rsa->_method_mod_p, ctx) 684. || !bn_mul_mont_fixed_top(r1, r1, rsa->iqmp, rsa->_method_mod_p, ^ 685. ctx) 686. /* r0 = r1 * q + m1 */ crypto/bn/bn_mont.c:37:1: Parameter `ctx->stack.depth` 35. } 36. 37. > int bn_mul_mont_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 38. BN_MONT_CTX *mont, BN_CTX *ctx) 39. { crypto/bn/bn_mont.c:60:5: Call 58. return 0; 59. 60. BN_CTX_start(ctx); ^ 61. tmp = BN_CTX_get(ctx); 62. if (tmp == NULL) 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_mont.c:61:11: Call 59. 60. BN_CTX_start(ctx); 61. tmp = BN_CTX_get(ctx); ^ 62. if (tmp == NULL) 63. 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_mont.c:67:14: Call 65. bn_check_top(tmp); 66. if (a == b) { 67. if (!bn_sqr_fixed_top(tmp, a, ctx)) ^ 68. goto err; 69. } else { crypto/bn/bn_sqr.c:42:5: Call 40. } 41. 42. BN_CTX_start(ctx); ^ 43. rr = (a != r) ? r : BN_CTX_get(ctx); 44. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_sqr.c:104:5: Call 102. bn_check_top(rr); 103. bn_check_top(tmp); 104. BN_CTX_end(ctx); ^ 105. return ret; 106. } crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.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_mul_mont_fixed_top` 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_43450
static int mac_test_init(struct evp_test *t, const char *alg) { int type; struct mac_data *mdat; if (strcmp(alg, "HMAC") == 0) type = EVP_PKEY_HMAC; else if (strcmp(alg, "CMAC") == 0) type = EVP_PKEY_CMAC; else return 0; mdat = OPENSSL_malloc(sizeof(*mdat)); mdat->type = type; mdat->alg = NULL; mdat->key = NULL; mdat->input = NULL; mdat->output = NULL; t->data = mdat; return 1; } test/evp_test.c:1035: error: NULL_DEREFERENCE pointer `mdat` last assigned on line 1034 could be null and is dereferenced at line 1035, column 5. Showing all 14 steps of the trace test/evp_test.c:1023:1: start of procedure mac_test_init() 1021. }; 1022. 1023. > static int mac_test_init(struct evp_test *t, const char *alg) 1024. { 1025. int type; test/evp_test.c:1027:9: Taking true branch 1025. int type; 1026. struct mac_data *mdat; 1027. if (strcmp(alg, "HMAC") == 0) ^ 1028. type = EVP_PKEY_HMAC; 1029. else if (strcmp(alg, "CMAC") == 0) test/evp_test.c:1028:9: 1026. struct mac_data *mdat; 1027. if (strcmp(alg, "HMAC") == 0) 1028. > type = EVP_PKEY_HMAC; 1029. else if (strcmp(alg, "CMAC") == 0) 1030. type = EVP_PKEY_CMAC; test/evp_test.c:1034:5: 1032. return 0; 1033. 1034. > mdat = OPENSSL_malloc(sizeof(*mdat)); 1035. mdat->type = type; 1036. mdat->alg = 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) test/evp_test.c:1035:5: 1033. 1034. mdat = OPENSSL_malloc(sizeof(*mdat)); 1035. > mdat->type = type; 1036. mdat->alg = NULL; 1037. mdat->key = NULL;
https://github.com/openssl/openssl/blob/928623825cc59e272e2031cd3f07c5b7bbd605d4/test/evp_test.c/#L1035
d2a_code_trace_data_43451
off_t ngx_parse_offset(ngx_str_t *line) { u_char unit; off_t offset; size_t len; ngx_int_t scale; len = line->len; unit = line->data[len - 1]; switch (unit) { case 'K': case 'k': len--; scale = 1024; break; case 'M': case 'm': len--; scale = 1024 * 1024; break; case 'G': case 'g': len--; scale = 1024 * 1024 * 1024; break; default: scale = 1; } offset = ngx_atoof(line->data, len); if (offset == NGX_ERROR) { return NGX_ERROR; } offset *= scale; return offset; } src/core/ngx_conf_file.c:1220: error: Integer Overflow L2 ([0, +oo] - 1):unsigned64 by call to `ngx_parse_offset`. src/core/ngx_conf_file.c:1220:11: Call 1218. value = cf->args->elts; 1219. 1220. *op = ngx_parse_offset(&value[1]); ^ 1221. if (*op == (off_t) NGX_ERROR) { 1222. return "invalid value"; src/core/ngx_parse.c:50:1: <LHS trace> 48. 49. 50. off_t ^ 51. ngx_parse_offset(ngx_str_t *line) 52. { src/core/ngx_parse.c:50:1: Parameter `line->len` 48. 49. 50. off_t ^ 51. ngx_parse_offset(ngx_str_t *line) 52. { src/core/ngx_parse.c:58:5: Assignment 56. ngx_int_t scale; 57. 58. len = line->len; ^ 59. unit = line->data[len - 1]; 60. src/core/ngx_parse.c:59:12: Binary operation: ([0, +oo] - 1):unsigned64 by call to `ngx_parse_offset` 57. 58. len = line->len; 59. unit = line->data[len - 1]; ^ 60. 61. switch (unit) {
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_parse.c/#L59
d2a_code_trace_data_43452
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/snow.c:1841: error: Buffer Overrun L1 Offset: 8 Size: 4 by call to `ff_epzs_motion_search`. libavcodec/snow.c:1841:20: Call 1839. init_ref(c, current_data, s->last_picture[ref].data, NULL, block_w*x, block_w*y, 0); 1840. 1841. ref_score= ff_epzs_motion_search(&s->m, &ref_mx, &ref_my, P, 0, /*ref_index*/ 0, last_mv, ^ 1842. (1<<16)>>shift, level-LOG2_MB_SIZE+4, block_w); 1843. 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:978:16: Call 976. MotionEstContext * const c= &s->me; 977. if(c->dia_size==-1) 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); libavcodec/motion_est_template.c:599:1: Parameter `ref_index` 597. } 598. 599. static int funny_diamond_search(MpegEncContext * s, int *best, int dmin, ^ 600. int src_index, int ref_index, int const penalty_factor, 601. int size, int h, int flags) libavcodec/motion_est_template.c:629:13: Call 627. int d; 628. 629. CHECK_MV(x + dir , y + dia_size - dir); ^ 630. CHECK_MV(x + dia_size - dir, y - dir ); 631. CHECK_MV(x - dir , y - dia_size + dir); 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 Size: 4 by call to `ff_epzs_motion_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_43453
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dh/dh_gen.c:126: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end`. Showing all 10 steps of the trace crypto/dh/dh_gen.c:68:5: Call 66. if (ctx == NULL) 67. goto err; 68. BN_CTX_start(ctx); ^ 69. t1 = BN_CTX_get(ctx); 70. t2 = 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/dh/dh_gen.c:126:9: Call 124. 125. if (ctx != NULL) { 126. BN_CTX_end(ctx); ^ 127. BN_CTX_free(ctx); 128. } crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268