id
stringlengths
25
25
content
stringlengths
649
72.1k
max_stars_repo_path
stringlengths
91
133
d2a_code_trace_data_44854
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:1344: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_exp`. Showing all 18 steps of the trace test/bntest.c:1344:10: Call 1342. goto err; 1343. 1344. if (!BN_mod_exp(ret, a, e, m, ctx) ^ 1345. || !equalBN("A ^ E (mod M)", mod_exp, ret)) 1346. goto err; crypto/bn/bn_exp.c:91:1: Parameter `ctx->stack.depth` 89. } 90. 91. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 92. BN_CTX *ctx) 93. { crypto/bn/bn_exp.c:156:15: Call 154. #ifdef RECP_MUL_MOD 155. { 156. ret = BN_mod_exp_recp(r, a, p, m, ctx); ^ 157. } 158. #else crypto/bn/bn_exp.c:168:1: Parameter `ctx->stack.depth` 166. } 167. 168. > int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 169. const BIGNUM *m, BN_CTX *ctx) 170. { crypto/bn/bn_exp.c:196:5: Call 194. } 195. 196. BN_CTX_start(ctx); ^ 197. aa = BN_CTX_get(ctx); 198. val[0] = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_exp.c:215:10: Call 213. } 214. 215. if (!BN_nnmod(val[0], a, m, ctx)) ^ 216. goto err; /* 1 */ 217. if (BN_is_zero(val[0])) { crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:140:1: Parameter `ctx->stack.depth` 138. * If 'dv' or 'rm' is NULL, the respective value is not returned. 139. */ 140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 141. BN_CTX *ctx) 142. { crypto/bn/bn_div.c:193:5: Call 191. } 192. 193. BN_CTX_start(ctx); ^ 194. tmp = BN_CTX_get(ctx); 195. snum = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:416:5: Call 414. if (no_branch) 415. bn_correct_top(res); 416. BN_CTX_end(ctx); ^ 417. return (1); 418. err: crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.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_mod_exp` 271. static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; ^ 274. } 275.
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_44855
static void vp5_parse_coeff(VP56Context *s) { VP56RangeCoder *c = &s->c; VP56Model *model = s->modelp; uint8_t *permute = s->scantable.permutated; uint8_t *model1, *model2; int coeff, sign, coeff_idx; int b, i, cg, idx, ctx, ctx_last; int pt = 0; for (b=0; b<6; b++) { int ct = 1; if (b > 3) pt = 1; ctx = 6*s->coeff_ctx[vp56_b6to4[b]][0] + s->above_blocks[s->above_block_idx[b]].not_null_dc; model1 = model->coeff_dccv[pt]; model2 = model->coeff_dcct[pt][ctx]; coeff_idx = 0; for (;;) { if (vp56_rac_get_prob(c, model2[0])) { if (vp56_rac_get_prob(c, model2[2])) { if (vp56_rac_get_prob(c, model2[3])) { s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 4; idx = vp56_rac_get_tree(c, vp56_pc_tree, model1); sign = vp56_rac_get(c); coeff = vp56_coeff_bias[idx+5]; for (i=vp56_coeff_bit_length[idx]; i>=0; i--) coeff += vp56_rac_get_prob(c, vp56_coeff_parse_table[idx][i]) << i; } else { if (vp56_rac_get_prob(c, model2[4])) { coeff = 3 + vp56_rac_get_prob(c, model1[5]); s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 3; } else { coeff = 2; s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 2; } sign = vp56_rac_get(c); } ct = 2; } else { ct = 1; s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 1; sign = vp56_rac_get(c); coeff = 1; } coeff = (coeff ^ -sign) + sign; if (coeff_idx) coeff *= s->dequant_ac; s->block_coeff[b][permute[coeff_idx]] = coeff; } else { if (ct && !vp56_rac_get_prob(c, model2[1])) break; ct = 0; s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 0; } coeff_idx++; if (coeff_idx >= 64) break; cg = vp5_coeff_groups[coeff_idx]; ctx = s->coeff_ctx[vp56_b6to4[b]][coeff_idx]; model1 = model->coeff_ract[pt][ct][cg]; model2 = cg > 2 ? model1 : model->coeff_acct[pt][ct][cg][ctx]; } ctx_last = FFMIN(s->coeff_ctx_last[vp56_b6to4[b]], 24); s->coeff_ctx_last[vp56_b6to4[b]] = coeff_idx; if (coeff_idx < ctx_last) for (i=coeff_idx; i<=ctx_last; i++) s->coeff_ctx[vp56_b6to4[b]][i] = 5; s->above_blocks[s->above_block_idx[b]].not_null_dc = s->coeff_ctx[vp56_b6to4[b]][0]; } } libavcodec/vp5.c:240: error: Buffer Overrun L2 Offset: [0, max(64, `s->coeff_ctx_last[*]`)] Size: 64. libavcodec/vp5.c:188:9: <Offset trace> 186. model2 = model->coeff_dcct[pt][ctx]; 187. 188. coeff_idx = 0; ^ 189. for (;;) { 190. if (vp56_rac_get_prob(c, model2[0])) { libavcodec/vp5.c:188:9: Assignment 186. model2 = model->coeff_dcct[pt][ctx]; 187. 188. coeff_idx = 0; ^ 189. for (;;) { 190. if (vp56_rac_get_prob(c, model2[0])) { libavcodec/vp5.c:168:1: <Length trace> 166. } 167. 168. static void vp5_parse_coeff(VP56Context *s) ^ 169. { 170. VP56RangeCoder *c = &s->c; libavcodec/vp5.c:168:1: Parameter `s->coeff_ctx[*][*]` 166. } 167. 168. static void vp5_parse_coeff(VP56Context *s) ^ 169. { 170. VP56RangeCoder *c = &s->c; libavcodec/vp5.c:240:17: Array access: Offset: [0, max(64, s->coeff_ctx_last[*])] Size: 64 238. if (coeff_idx < ctx_last) 239. for (i=coeff_idx; i<=ctx_last; i++) 240. s->coeff_ctx[vp56_b6to4[b]][i] = 5; ^ 241. s->above_blocks[s->above_block_idx[b]].not_null_dc = s->coeff_ctx[vp56_b6to4[b]][0]; 242. }
https://github.com/libav/libav/blob/dbc2424baa5aa4c72026d167f0678f2374620f44/libavcodec/vp5.c/#L240
d2a_code_trace_data_44856
static inline void decode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){ PlaneContext * const p= &s->plane[plane_index]; RangeCoder * const c= &s->c; int x; int run_count=0; int run_mode=0; int run_index= s->run_index; for(x=0; x<w; x++){ int diff, context, sign; context= get_context(s, sample[1] + x, sample[0] + x, sample[1] + x); if(context < 0){ context= -context; sign=1; }else sign=0; if(s->ac){ diff= get_symbol(c, p->state[context], 1); }else{ if(context == 0 && run_mode==0) run_mode=1; if(run_mode){ if(run_count==0 && run_mode==1){ if(get_bits1(&s->gb)){ run_count = 1<<log2_run[run_index]; if(x + run_count <= w) run_index++; }else{ if(log2_run[run_index]) run_count = get_bits(&s->gb, log2_run[run_index]); else run_count=0; if(run_index) run_index--; run_mode=2; } } run_count--; if(run_count < 0){ run_mode=0; run_count=0; diff= get_vlc_symbol(&s->gb, &p->vlc_state[context], bits); if(diff>=0) diff++; }else diff=0; }else diff= get_vlc_symbol(&s->gb, &p->vlc_state[context], bits); } if(sign) diff= -diff; sample[1][x]= (predict(sample[1] + x, sample[0] + x) + diff) & ((1<<bits)-1); } s->run_index= run_index; } libavcodec/ffv1.c:816: error: Buffer Overrun L2 Offset: [1, 3] (⇐ [0, 2] + 1) Size: 3 by call to `decode_line`. libavcodec/ffv1.c:795:1: Array declaration 793. } 794. 795. static void decode_rgb_frame(FFV1Context *s, uint32_t *src, int w, int h, int stride){ ^ 796. int x, y, p; 797. int_fast16_t sample_buffer[3][2][w+6]; libavcodec/ffv1.c:816:13: Call 814. sample[p][1][-1]= sample[p][0][0 ]; 815. sample[p][0][ w]= sample[p][0][w-1]; 816. decode_line(s, w, sample[p], FFMIN(p, 1), 9); ^ 817. } 818. for(x=0; x<w; x++){ libavcodec/ffv1.c:711:1: <Length trace> 709. } 710. 711. static inline void decode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){ ^ 712. PlaneContext * const p= &s->plane[plane_index]; 713. RangeCoder * const c= &s->c; libavcodec/ffv1.c:711:1: Parameter `*sample` 709. } 710. 711. static inline void decode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){ ^ 712. PlaneContext * const p= &s->plane[plane_index]; 713. RangeCoder * const c= &s->c; libavcodec/ffv1.c:722:33: Array access: Offset: [1, 3] (⇐ [0, 2] + 1) Size: 3 by call to `decode_line` 720. int diff, context, sign; 721. 722. context= get_context(s, sample[1] + x, sample[0] + x, sample[1] + x); ^ 723. if(context < 0){ 724. context= -context;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ffv1.c/#L722
d2a_code_trace_data_44857
static void ngx_http_init_request(ngx_event_t *rev) { ngx_time_t *tp; ngx_uint_t i; ngx_connection_t *c; ngx_http_request_t *r; struct sockaddr_in *sin; ngx_http_port_t *port; ngx_http_in_addr_t *addr; ngx_http_log_ctx_t *ctx; ngx_http_addr_conf_t *addr_conf; ngx_http_connection_t *hc; ngx_http_core_srv_conf_t *cscf; ngx_http_core_loc_conf_t *clcf; ngx_http_core_main_conf_t *cmcf; #if (NGX_HAVE_INET6) struct sockaddr_in6 *sin6; ngx_http_in6_addr_t *addr6; #endif #if (NGX_STAT_STUB) ngx_atomic_fetch_add(ngx_stat_reading, -1); #endif c = rev->data; if (rev->timedout) { ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT, "client timed out"); ngx_http_close_connection(c); return; } hc = c->data; if (hc == NULL) { hc = ngx_pcalloc(c->pool, sizeof(ngx_http_connection_t)); if (hc == NULL) { ngx_http_close_connection(c); return; } } r = hc->request; if (r) { ngx_memzero(r, sizeof(ngx_http_request_t)); r->pipeline = hc->pipeline; if (hc->nbusy) { r->header_in = hc->busy[0]; } } else { r = ngx_pcalloc(c->pool, sizeof(ngx_http_request_t)); if (r == NULL) { ngx_http_close_connection(c); return; } hc->request = r; } c->data = r; r->http_connection = hc; c->sent = 0; r->signature = NGX_HTTP_MODULE; port = c->listening->servers; r->connection = c; if (port->naddrs > 1) { if (ngx_http_server_addr(r, NULL) != NGX_OK) { ngx_http_close_connection(c); return; } switch (c->local_sockaddr->sa_family) { #if (NGX_HAVE_INET6) case AF_INET6: sin6 = (struct sockaddr_in6 *) c->local_sockaddr; addr6 = (ngx_http_in6_addr_t *) port->addrs; for (i = 0; i < port->naddrs - 1; i++) { if (ngx_memcmp(&addr6[i].addr6, &sin6->sin6_addr, 16) == 0) { break; } } addr_conf = &addr6[i].conf; break; #endif default: sin = (struct sockaddr_in *) c->local_sockaddr; addr = port->addrs; for (i = 0; i < port->naddrs - 1; i++) { if (addr[i].addr == sin->sin_addr.s_addr) { break; } } addr_conf = &addr[i].conf; break; } } else { switch (c->local_sockaddr->sa_family) { #if (NGX_HAVE_INET6) case AF_INET6: addr6 = (ngx_http_in6_addr_t *) port->addrs; addr_conf = &addr6[0].conf; break; #endif default: addr = port->addrs; addr_conf = &addr[0].conf; break; } } r->virtual_names = addr_conf->virtual_names; cscf = addr_conf->core_srv_conf; r->main_conf = cscf->ctx->main_conf; r->srv_conf = cscf->ctx->srv_conf; r->loc_conf = cscf->ctx->loc_conf; rev->handler = ngx_http_process_request_line; #if (NGX_HTTP_SSL) { ngx_http_ssl_srv_conf_t *sscf; sscf = ngx_http_get_module_srv_conf(r, ngx_http_ssl_module); if (sscf->enable || addr_conf->ssl) { if (c->ssl == NULL) { c->log->action = "SSL handshaking"; if (addr_conf->ssl && sscf->ssl.ctx == NULL) { ngx_log_error(NGX_LOG_ERR, c->log, 0, "no \"ssl_certificate\" is defined " "in server listening on SSL port"); ngx_http_close_connection(c); return; } if (ngx_ssl_create_connection(&sscf->ssl, c, NGX_SSL_BUFFER) != NGX_OK) { ngx_http_close_connection(c); return; } rev->handler = ngx_http_ssl_handshake; } r->main_filter_need_in_memory = 1; } } #endif clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); c->log->file = clcf->err_log->file; if (!(c->log->log_level & NGX_LOG_DEBUG_CONNECTION)) { c->log->log_level = clcf->err_log->log_level; } if (c->buffer == NULL) { c->buffer = ngx_create_temp_buf(c->pool, cscf->client_header_buffer_size); if (c->buffer == NULL) { ngx_http_close_connection(c); return; } } if (r->header_in == NULL) { r->header_in = c->buffer; } r->pool = ngx_create_pool(cscf->request_pool_size, c->log); if (r->pool == NULL) { ngx_http_close_connection(c); return; } if (ngx_list_init(&r->headers_out.headers, r->pool, 20, sizeof(ngx_table_elt_t)) != NGX_OK) { ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); return; } r->ctx = ngx_pcalloc(r->pool, sizeof(void *) * ngx_http_max_module); if (r->ctx == NULL) { ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); return; } cmcf = ngx_http_get_module_main_conf(r, ngx_http_core_module); r->variables = ngx_pcalloc(r->pool, cmcf->variables.nelts * sizeof(ngx_http_variable_value_t)); if (r->variables == NULL) { ngx_http_close_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR); return; } c->single_connection = 1; c->destroyed = 0; r->main = r; tp = ngx_timeofday(); r->start_sec = tp->sec; r->start_msec = tp->msec; r->method = NGX_HTTP_UNKNOWN; r->headers_in.content_length_n = -1; r->headers_in.keep_alive_n = -1; r->headers_out.content_length_n = -1; r->headers_out.last_modified_time = -1; r->uri_changes = NGX_HTTP_MAX_URI_CHANGES + 1; r->subrequests = NGX_HTTP_MAX_SUBREQUESTS + 1; r->http_state = NGX_HTTP_READING_REQUEST_STATE; ctx = c->log->data; ctx->request = r; ctx->current_request = r; r->log_handler = ngx_http_log_error_handler; #if (NGX_STAT_STUB) ngx_atomic_fetch_add(ngx_stat_reading, 1); r->stat_reading = 1; ngx_atomic_fetch_add(ngx_stat_requests, 1); #endif rev->handler(rev); } src/http/ngx_http_request.c:346: error: Integer Overflow L2 ([0, +oo] - 1):unsigned64. src/http/ngx_http_request.c:313:13: <LHS trace> 311. */ 312. 313. if (ngx_http_server_addr(r, NULL) != NGX_OK) { ^ 314. ngx_http_close_connection(c); 315. return; src/http/ngx_http_request.c:313:13: Call 311. */ 312. 313. if (ngx_http_server_addr(r, NULL) != NGX_OK) { ^ 314. ngx_http_close_connection(c); 315. return; src/http/ngx_http_core_module.c:1856:29: Call 1854. } 1855. 1856. c->local_sockaddr = ngx_palloc(r->connection->pool, len); ^ 1857. if (c->local_sockaddr == NULL) { 1858. return NGX_ERROR; src/core/ngx_palloc.c:114:1: Parameter `size` 112. 113. 114. void * ^ 115. ngx_palloc(ngx_pool_t *pool, size_t size) 116. { src/http/ngx_http_request.c:346:25: Binary operation: ([0, +oo] - 1):unsigned64 344. /* the last address is "*" */ 345. 346. for (i = 0; i < port->naddrs - 1; i++) { ^ 347. if (addr[i].addr == sin->sin_addr.s_addr) { 348. break;
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/http/ngx_http_request.c/#L346
d2a_code_trace_data_44858
static int dct_quantize_refine(MpegEncContext *s, DCTELEM *block, int16_t *weight, DCTELEM *orig, int n, int qscale){ int16_t rem[64]; DECLARE_ALIGNED_16(DCTELEM, d1[64]); const int *qmat; const uint8_t *scantable= s->intra_scantable.scantable; const uint8_t *perm_scantable= s->intra_scantable.permutated; int run_tab[65]; int prev_run=0; int prev_level=0; int qmul, qadd, start_i, last_non_zero, i, dc; uint8_t * length; uint8_t * last_length; int lambda; int rle_index, run, q = 1, sum; #ifdef REFINE_STATS static int count=0; static int after_last=0; static int to_zero=0; static int from_zero=0; static int raise=0; static int lower=0; static int messed_sign=0; #endif if(basis[0][0] == 0) build_basis(s->dsp.idct_permutation); qmul= qscale*2; qadd= (qscale-1)|1; if (s->mb_intra) { if (!s->h263_aic) { if (n < 4) q = s->y_dc_scale; else q = s->c_dc_scale; } else{ q = 1; qadd=0; } q <<= RECON_SHIFT-3; dc= block[0]*q; start_i = 1; qmat = s->q_intra_matrix[qscale]; length = s->intra_ac_vlc_length; last_length= s->intra_ac_vlc_last_length; } else { dc= 0; start_i = 0; qmat = s->q_inter_matrix[qscale]; length = s->inter_ac_vlc_length; last_length= s->inter_ac_vlc_last_length; } last_non_zero = s->block_last_index[n]; #ifdef REFINE_STATS {START_TIMER #endif dc += (1<<(RECON_SHIFT-1)); for(i=0; i<64; i++){ rem[i]= dc - (orig[i]<<RECON_SHIFT); } #ifdef REFINE_STATS STOP_TIMER("memset rem[]")} #endif sum=0; for(i=0; i<64; i++){ int one= 36; int qns=4; int w; w= FFABS(weight[i]) + qns*one; w= 15 + (48*qns*one + w/2)/w; weight[i] = w; assert(w>0); assert(w<(1<<6)); sum += w*w; } lambda= sum*(uint64_t)s->lambda2 >> (FF_LAMBDA_SHIFT - 6 + 6 + 6 + 6); #ifdef REFINE_STATS {START_TIMER #endif run=0; rle_index=0; for(i=start_i; i<=last_non_zero; i++){ int j= perm_scantable[i]; const int level= block[j]; int coeff; if(level){ if(level<0) coeff= qmul*level - qadd; else coeff= qmul*level + qadd; run_tab[rle_index++]=run; run=0; s->dsp.add_8x8basis(rem, basis[j], coeff); }else{ run++; } } #ifdef REFINE_STATS if(last_non_zero>0){ STOP_TIMER("init rem[]") } } {START_TIMER #endif for(;;){ int best_score=s->dsp.try_8x8basis(rem, weight, basis[0], 0); int best_coeff=0; int best_change=0; int run2, best_unquant_change=0, analyze_gradient; #ifdef REFINE_STATS {START_TIMER #endif analyze_gradient = last_non_zero > 2 || s->avctx->quantizer_noise_shaping >= 3; if(analyze_gradient){ #ifdef REFINE_STATS {START_TIMER #endif for(i=0; i<64; i++){ int w= weight[i]; d1[i] = (rem[i]*w*w + (1<<(RECON_SHIFT+12-1)))>>(RECON_SHIFT+12); } #ifdef REFINE_STATS STOP_TIMER("rem*w*w")} {START_TIMER #endif s->dsp.fdct(d1); #ifdef REFINE_STATS STOP_TIMER("dct")} #endif } if(start_i){ const int level= block[0]; int change, old_coeff; assert(s->mb_intra); old_coeff= q*level; for(change=-1; change<=1; change+=2){ int new_level= level + change; int score, new_coeff; new_coeff= q*new_level; if(new_coeff >= 2048 || new_coeff < 0) continue; score= s->dsp.try_8x8basis(rem, weight, basis[0], new_coeff - old_coeff); if(score<best_score){ best_score= score; best_coeff= 0; best_change= change; best_unquant_change= new_coeff - old_coeff; } } } run=0; rle_index=0; run2= run_tab[rle_index++]; prev_level=0; prev_run=0; for(i=start_i; i<64; i++){ int j= perm_scantable[i]; const int level= block[j]; int change, old_coeff; if(s->avctx->quantizer_noise_shaping < 3 && i > last_non_zero + 1) break; if(level){ if(level<0) old_coeff= qmul*level - qadd; else old_coeff= qmul*level + qadd; run2= run_tab[rle_index++]; }else{ old_coeff=0; run2--; assert(run2>=0 || i >= last_non_zero ); } for(change=-1; change<=1; change+=2){ int new_level= level + change; int score, new_coeff, unquant_change; score=0; if(s->avctx->quantizer_noise_shaping < 2 && FFABS(new_level) > FFABS(level)) continue; if(new_level){ if(new_level<0) new_coeff= qmul*new_level - qadd; else new_coeff= qmul*new_level + qadd; if(new_coeff >= 2048 || new_coeff <= -2048) continue; if(level){ if(level < 63 && level > -63){ if(i < last_non_zero) score += length[UNI_AC_ENC_INDEX(run, new_level+64)] - length[UNI_AC_ENC_INDEX(run, level+64)]; else score += last_length[UNI_AC_ENC_INDEX(run, new_level+64)] - last_length[UNI_AC_ENC_INDEX(run, level+64)]; } }else{ assert(FFABS(new_level)==1); if(analyze_gradient){ int g= d1[ scantable[i] ]; if(g && (g^new_level) >= 0) continue; } if(i < last_non_zero){ int next_i= i + run2 + 1; int next_level= block[ perm_scantable[next_i] ] + 64; if(next_level&(~127)) next_level= 0; if(next_i < last_non_zero) score += length[UNI_AC_ENC_INDEX(run, 65)] + length[UNI_AC_ENC_INDEX(run2, next_level)] - length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)]; else score += length[UNI_AC_ENC_INDEX(run, 65)] + last_length[UNI_AC_ENC_INDEX(run2, next_level)] - last_length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)]; }else{ score += last_length[UNI_AC_ENC_INDEX(run, 65)]; if(prev_level){ score += length[UNI_AC_ENC_INDEX(prev_run, prev_level)] - last_length[UNI_AC_ENC_INDEX(prev_run, prev_level)]; } } } }else{ new_coeff=0; assert(FFABS(level)==1); if(i < last_non_zero){ int next_i= i + run2 + 1; int next_level= block[ perm_scantable[next_i] ] + 64; if(next_level&(~127)) next_level= 0; if(next_i < last_non_zero) score += length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)] - length[UNI_AC_ENC_INDEX(run2, next_level)] - length[UNI_AC_ENC_INDEX(run, 65)]; else score += last_length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)] - last_length[UNI_AC_ENC_INDEX(run2, next_level)] - length[UNI_AC_ENC_INDEX(run, 65)]; }else{ score += -last_length[UNI_AC_ENC_INDEX(run, 65)]; if(prev_level){ score += last_length[UNI_AC_ENC_INDEX(prev_run, prev_level)] - length[UNI_AC_ENC_INDEX(prev_run, prev_level)]; } } } score *= lambda; unquant_change= new_coeff - old_coeff; assert((score < 100*lambda && score > -100*lambda) || lambda==0); score+= s->dsp.try_8x8basis(rem, weight, basis[j], unquant_change); if(score<best_score){ best_score= score; best_coeff= i; best_change= change; best_unquant_change= unquant_change; } } if(level){ prev_level= level + 64; if(prev_level&(~127)) prev_level= 0; prev_run= run; run=0; }else{ run++; } } #ifdef REFINE_STATS STOP_TIMER("iterative step")} #endif if(best_change){ int j= perm_scantable[ best_coeff ]; block[j] += best_change; if(best_coeff > last_non_zero){ last_non_zero= best_coeff; assert(block[j]); #ifdef REFINE_STATS after_last++; #endif }else{ #ifdef REFINE_STATS if(block[j]){ if(block[j] - best_change){ if(FFABS(block[j]) > FFABS(block[j] - best_change)){ raise++; }else{ lower++; } }else{ from_zero++; } }else{ to_zero++; } #endif for(; last_non_zero>=start_i; last_non_zero--){ if(block[perm_scantable[last_non_zero]]) break; } } #ifdef REFINE_STATS count++; if(256*256*256*64 % count == 0){ printf("after_last:%d to_zero:%d from_zero:%d raise:%d lower:%d sign:%d xyp:%d/%d/%d\n", after_last, to_zero, from_zero, raise, lower, messed_sign, s->mb_x, s->mb_y, s->picture_number); } #endif run=0; rle_index=0; for(i=start_i; i<=last_non_zero; i++){ int j= perm_scantable[i]; const int level= block[j]; if(level){ run_tab[rle_index++]=run; run=0; }else{ run++; } } s->dsp.add_8x8basis(rem, basis[j], best_unquant_change); }else{ break; } } #ifdef REFINE_STATS if(last_non_zero>0){ STOP_TIMER("iterative search") } } #endif return last_non_zero; } libavcodec/mpegvideo_enc.c:1754: error: Buffer Overrun L2 Offset: [0, 70] (⇐ [0, 7] + [0, 63]) Size: 8 by call to `encode_mb_internal`. libavcodec/mpegvideo_enc.c:1754:41: Call 1752. { 1753. if (s->chroma_format == CHROMA_420) encode_mb_internal(s, motion_x, motion_y, 8, 6); 1754. else encode_mb_internal(s, motion_x, motion_y, 16, 8); ^ 1755. } 1756. libavcodec/mpegvideo_enc.c:1457:1: Array declaration 1455. } 1456. 1457. static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, int motion_y, int mb_block_height, int mb_block_count) ^ 1458. { 1459. int16_t weight[8][64]; libavcodec/mpegvideo_enc.c:1668:46: Call 1666. for(i=0;i<mb_block_count;i++) { 1667. if(!skip_dct[i]){ 1668. s->block_last_index[i] = dct_quantize_refine(s, s->block[i], weight[i], orig[i], i, s->qscale); ^ 1669. } 1670. } libavcodec/mpegvideo_enc.c:3349:9: <Offset trace> 3347. #endif 3348. dc += (1<<(RECON_SHIFT-1)); 3349. for(i=0; i<64; i++){ ^ 3350. rem[i]= dc - (orig[i]<<RECON_SHIFT); //FIXME use orig dirrectly instead of copying to rem[] 3351. } libavcodec/mpegvideo_enc.c:3349:9: Assignment 3347. #endif 3348. dc += (1<<(RECON_SHIFT-1)); 3349. for(i=0; i<64; i++){ ^ 3350. rem[i]= dc - (orig[i]<<RECON_SHIFT); //FIXME use orig dirrectly instead of copying to rem[] 3351. } libavcodec/mpegvideo_enc.c:3282:1: <Length trace> 3280. } 3281. 3282. static int dct_quantize_refine(MpegEncContext *s, //FIXME breaks denoise? ^ 3283. DCTELEM *block, int16_t *weight, DCTELEM *orig, 3284. int n, int qscale){ libavcodec/mpegvideo_enc.c:3282:1: Parameter `*orig` 3280. } 3281. 3282. static int dct_quantize_refine(MpegEncContext *s, //FIXME breaks denoise? ^ 3283. DCTELEM *block, int16_t *weight, DCTELEM *orig, 3284. int n, int qscale){ libavcodec/mpegvideo_enc.c:3350:23: Array access: Offset: [0, 70] (⇐ [0, 7] + [0, 63]) Size: 8 by call to `encode_mb_internal` 3348. dc += (1<<(RECON_SHIFT-1)); 3349. for(i=0; i<64; i++){ 3350. rem[i]= dc - (orig[i]<<RECON_SHIFT); //FIXME use orig dirrectly instead of copying to rem[] ^ 3351. } 3352. #ifdef REFINE_STATS
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo_enc.c/#L3350
d2a_code_trace_data_44859
static int ts_compute_imprint(BIO *data, TS_TST_INFO *tst_info, X509_ALGOR **md_alg, unsigned char **imprint, unsigned *imprint_len) { TS_MSG_IMPRINT *msg_imprint = tst_info->msg_imprint; X509_ALGOR *md_alg_resp = msg_imprint->hash_algo; const EVP_MD *md; EVP_MD_CTX *md_ctx = NULL; unsigned char buffer[4096]; int length; *md_alg = NULL; *imprint = NULL; if ((*md_alg = X509_ALGOR_dup(md_alg_resp)) == NULL) goto err; if ((md = EVP_get_digestbyobj((*md_alg)->algorithm)) == NULL) { TSerr(TS_F_TS_COMPUTE_IMPRINT, TS_R_UNSUPPORTED_MD_ALGORITHM); goto err; } length = EVP_MD_size(md); if (length < 0) goto err; *imprint_len = length; if ((*imprint = OPENSSL_malloc(*imprint_len)) == NULL) { TSerr(TS_F_TS_COMPUTE_IMPRINT, ERR_R_MALLOC_FAILURE); goto err; } md_ctx = EVP_MD_CTX_new(); if (md_ctx == NULL) { TSerr(TS_F_TS_COMPUTE_IMPRINT, ERR_R_MALLOC_FAILURE); goto err; } if (!EVP_DigestInit(md_ctx, md)) goto err; while ((length = BIO_read(data, buffer, sizeof(buffer))) > 0) { if (!EVP_DigestUpdate(md_ctx, buffer, length)) goto err; } if (!EVP_DigestFinal(md_ctx, *imprint, NULL)) goto err; EVP_MD_CTX_free(md_ctx); return 1; err: EVP_MD_CTX_free(md_ctx); X509_ALGOR_free(*md_alg); OPENSSL_free(*imprint); *imprint_len = 0; *imprint = 0; return 0; } crypto/ts/ts_rsp_verify.c:572: error: NULL_DEREFERENCE pointer `md_ctx` last assigned on line 533 could be null and is dereferenced by call to `EVP_MD_CTX_free()` at line 572, column 5. Showing all 17 steps of the trace crypto/ts/ts_rsp_verify.c:526:1: start of procedure ts_compute_imprint() 524. } 525. 526. > static int ts_compute_imprint(BIO *data, TS_TST_INFO *tst_info, 527. X509_ALGOR **md_alg, 528. unsigned char **imprint, unsigned *imprint_len) crypto/ts/ts_rsp_verify.c:530:5: 528. unsigned char **imprint, unsigned *imprint_len) 529. { 530. > TS_MSG_IMPRINT *msg_imprint = tst_info->msg_imprint; 531. X509_ALGOR *md_alg_resp = msg_imprint->hash_algo; 532. const EVP_MD *md; crypto/ts/ts_rsp_verify.c:531:5: 529. { 530. TS_MSG_IMPRINT *msg_imprint = tst_info->msg_imprint; 531. > X509_ALGOR *md_alg_resp = msg_imprint->hash_algo; 532. const EVP_MD *md; 533. EVP_MD_CTX *md_ctx = NULL; crypto/ts/ts_rsp_verify.c:533:5: 531. X509_ALGOR *md_alg_resp = msg_imprint->hash_algo; 532. const EVP_MD *md; 533. > EVP_MD_CTX *md_ctx = NULL; 534. unsigned char buffer[4096]; 535. int length; crypto/ts/ts_rsp_verify.c:537:5: 535. int length; 536. 537. > *md_alg = NULL; 538. *imprint = NULL; 539. crypto/ts/ts_rsp_verify.c:538:5: 536. 537. *md_alg = NULL; 538. > *imprint = NULL; 539. 540. if ((*md_alg = X509_ALGOR_dup(md_alg_resp)) == NULL) crypto/ts/ts_rsp_verify.c:540:9: 538. *imprint = NULL; 539. 540. > if ((*md_alg = X509_ALGOR_dup(md_alg_resp)) == NULL) 541. goto err; 542. if ((md = EVP_get_digestbyobj((*md_alg)->algorithm)) == NULL) { crypto/asn1/x_algor.c:77:1: start of procedure X509_ALGOR_dup() 75. IMPLEMENT_ASN1_FUNCTIONS(X509_ALGOR) 76. IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(X509_ALGORS, X509_ALGORS, X509_ALGORS) 77. > IMPLEMENT_ASN1_DUP_FUNCTION(X509_ALGOR) 78. 79. int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval) crypto/asn1/a_dup.c:98:1: start of procedure ASN1_item_dup() 96. */ 97. 98. > void *ASN1_item_dup(const ASN1_ITEM *it, void *x) 99. { 100. unsigned char *b = NULL; crypto/asn1/a_dup.c:100:5: 98. void *ASN1_item_dup(const ASN1_ITEM *it, void *x) 99. { 100. > unsigned char *b = NULL; 101. const unsigned char *p; 102. long i; crypto/asn1/a_dup.c:105:9: Taking true branch 103. void *ret; 104. 105. if (x == NULL) ^ 106. return (NULL); 107. crypto/asn1/a_dup.c:106:9: 104. 105. if (x == NULL) 106. > return (NULL); 107. 108. i = ASN1_item_i2d(x, &b, it); crypto/asn1/a_dup.c:117:1: return from a call to ASN1_item_dup 115. OPENSSL_free(b); 116. return (ret); 117. > } crypto/asn1/x_algor.c:77:1: return from a call to X509_ALGOR_dup 75. IMPLEMENT_ASN1_FUNCTIONS(X509_ALGOR) 76. IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(X509_ALGORS, X509_ALGORS, X509_ALGORS) 77. > IMPLEMENT_ASN1_DUP_FUNCTION(X509_ALGOR) 78. 79. int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval) crypto/ts/ts_rsp_verify.c:540:9: Taking true branch 538. *imprint = NULL; 539. 540. if ((*md_alg = X509_ALGOR_dup(md_alg_resp)) == NULL) ^ 541. goto err; 542. if ((md = EVP_get_digestbyobj((*md_alg)->algorithm)) == NULL) { crypto/ts/ts_rsp_verify.c:571:2: 569. 570. return 1; 571. > err: 572. EVP_MD_CTX_free(md_ctx); 573. X509_ALGOR_free(*md_alg); crypto/ts/ts_rsp_verify.c:572:5: 570. return 1; 571. err: 572. > EVP_MD_CTX_free(md_ctx); 573. X509_ALGOR_free(*md_alg); 574. OPENSSL_free(*imprint);
https://github.com/openssl/openssl/blob/e29c73c93b88a4b7f492c7c8c7343223e7548612/crypto/ts/ts_rsp_verify.c/#L572
d2a_code_trace_data_44860
int ASN1_STRING_to_UTF8(unsigned char **out, ASN1_STRING *in) { ASN1_STRING stmp, *str = &stmp; int mbflag, type, ret; if(!in) return -1; type = in->type; if((type < 0) || (type > 30)) return -1; mbflag = tag2nbyte[type]; if(mbflag == -1) return -1; mbflag |= MBSTRING_FLAG; stmp.data = NULL; ret = ASN1_mbstring_copy(&str, in->data, in->length, mbflag, B_ASN1_UTF8STRING); if(ret < 0) return ret; *out = stmp.data; return stmp.length; } crypto/asn1/a_strex.c:557: error: UNINITIALIZED_VALUE The value read from stmp.length was never initialized. Showing all 1 steps of the trace crypto/asn1/a_strex.c:557:2: 555. if(ret < 0) return ret; 556. *out = stmp.data; 557. > return stmp.length; 558. }
https://github.com/openssl/openssl/blob/4c8f79a33e8efe5302700389edb4d574f2228765/crypto/asn1/a_strex.c/#L557
d2a_code_trace_data_44861
static inline void refill_32(BitstreamContext *bc) { if (bc->ptr >= bc->buffer_end) return; #ifdef BITSTREAM_READER_LE bc->bits = (uint64_t)AV_RL32(bc->ptr) << bc->bits_left | bc->bits; #else bc->bits = bc->bits | (uint64_t)AV_RB32(bc->ptr) << (32 - bc->bits_left); #endif bc->ptr += 4; bc->bits_left += 32; } libavcodec/takdec.c:370: error: Integer Overflow L2 (32 - [-1+min(64, `bc->bits_left`), -1+max(64, `bc->bits_left`)]):unsigned32 by call to `bitstream_read`. libavcodec/takdec.c:367:1: Parameter `bc->bits_left` 365. } 366. 367. static int bits_esc4(BitstreamContext *bc) ^ 368. { 369. if (bitstream_read_bit(bc)) libavcodec/takdec.c:369:9: Call 367. static int bits_esc4(BitstreamContext *bc) 368. { 369. if (bitstream_read_bit(bc)) ^ 370. return bitstream_read(bc, 4) + 1; 371. else libavcodec/bitstream.h:145:1: Parameter `bc->bits_left` 143. 144. /* Return one bit from the buffer. */ 145. static inline unsigned bitstream_read_bit(BitstreamContext *bc) ^ 146. { 147. if (!bc->bits_left) libavcodec/bitstream.h:150:12: Call 148. refill_64(bc); 149. 150. return get_val(bc, 1); ^ 151. } 152. libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Assignment 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret; libavcodec/takdec.c:370:16: Call 368. { 369. if (bitstream_read_bit(bc)) 370. return bitstream_read(bc, 4) + 1; ^ 371. else 372. return 0; libavcodec/bitstream.h:183:1: Parameter `n` 181. 182. /* Return n bits from the buffer. n has to be in the 0-32 range. */ 183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n) ^ 184. { 185. if (!n) libavcodec/bitstream.h:189:9: Call 187. 188. if (n > bc->bits_left) { 189. refill_32(bc); ^ 190. if (bc->bits_left < 32) 191. bc->bits_left = n; libavcodec/bitstream.h:60:1: <RHS trace> 58. } 59. 60. static inline void refill_32(BitstreamContext *bc) ^ 61. { 62. if (bc->ptr >= bc->buffer_end) libavcodec/bitstream.h:60:1: Parameter `bc->bits_left` 58. } 59. 60. static inline void refill_32(BitstreamContext *bc) ^ 61. { 62. if (bc->ptr >= bc->buffer_end) libavcodec/bitstream.h:68:5: Binary operation: (32 - [-1+min(64, bc->bits_left), -1+max(64, bc->bits_left)]):unsigned32 by call to `bitstream_read` 66. bc->bits = (uint64_t)AV_RL32(bc->ptr) << bc->bits_left | bc->bits; 67. #else 68. bc->bits = bc->bits | (uint64_t)AV_RB32(bc->ptr) << (32 - bc->bits_left); ^ 69. #endif 70. bc->ptr += 4;
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L68
d2a_code_trace_data_44862
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); } ssl/tls_srp.c:294: error: BUFFER_OVERRUN_L3 Offset: [2, 15] (⇐ 1 + [1, 14]) Size: [0, 8388607] by call to `SRP_Calc_server_key`. Showing all 26 steps of the trace ssl/tls_srp.c:284:1: Parameter `s->srp_ctx.A->top` 282. } 283. 284. > int srp_generate_server_master_secret(SSL *s) 285. { 286. BIGNUM *K = NULL, *u = NULL; ssl/tls_srp.c:290:10: Call 288. unsigned char *tmp = NULL; 289. 290. if (!SRP_Verify_A_mod_N(s->srp_ctx.A, s->srp_ctx.N)) ^ 291. goto err; 292. if ((u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) == NULL) crypto/srp/srp_lib.c:233:1: Parameter `A->top` 231. } 232. 233. > int SRP_Verify_A_mod_N(const BIGNUM *A, const BIGNUM *N) 234. { 235. /* Checks if A % N == 0 */ crypto/srp/srp_lib.c:236:12: Call 234. { 235. /* Checks if A % N == 0 */ 236. return SRP_Verify_B_mod_N(A, N); ^ 237. } 238. crypto/srp/srp_lib.c:212:1: Parameter `B->top` 210. } 211. 212. > int SRP_Verify_B_mod_N(const BIGNUM *B, const BIGNUM *N) 213. { 214. BIGNUM *r; ssl/tls_srp.c:292:14: Call 290. if (!SRP_Verify_A_mod_N(s->srp_ctx.A, s->srp_ctx.N)) 291. goto err; 292. if ((u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) == NULL) ^ 293. goto err; 294. if ((K = SRP_Calc_server_key(s->srp_ctx.A, s->srp_ctx.v, u, s->srp_ctx.b, crypto/srp/srp_lib.c:47:1: Parameter `A->top` 45. } 46. 47. > BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N) 48. { 49. /* k = SHA1(PAD(A) || PAD(B) ) -- tls-srp draft 8 */ crypto/srp/srp_lib.c:50:12: Call 48. { 49. /* k = SHA1(PAD(A) || PAD(B) ) -- tls-srp draft 8 */ 50. return srp_Calc_xy(A, B, N); ^ 51. } 52. crypto/srp/srp_lib.c:19:1: Parameter `x->top` 17. /* calculate = SHA1(PAD(x) || PAD(y)) */ 18. 19. > static BIGNUM *srp_Calc_xy(const BIGNUM *x, const BIGNUM *y, const BIGNUM *N) 20. { 21. unsigned char digest[SHA_DIGEST_LENGTH]; ssl/tls_srp.c:294:14: Call 292. if ((u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) == NULL) 293. goto err; 294. if ((K = SRP_Calc_server_key(s->srp_ctx.A, s->srp_ctx.v, u, s->srp_ctx.b, ^ 295. s->srp_ctx.N)) == NULL) 296. goto err; crypto/srp/srp_lib.c:53:1: Parameter `A->top` 51. } 52. 53. > BIGNUM *SRP_Calc_server_key(const BIGNUM *A, const BIGNUM *v, const BIGNUM *u, 54. const BIGNUM *b, const BIGNUM *N) 55. { crypto/srp/srp_lib.c:69:10: Call 67. if (!BN_mod_exp(tmp, v, u, N, bn_ctx)) 68. goto err; 69. if (!BN_mod_mul(tmp, A, tmp, N, bn_ctx)) ^ 70. goto err; 71. crypto/bn/bn_mod.c:73:1: Parameter `a->top` 71. 72. /* slow but works */ 73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 74. BN_CTX *ctx) 75. { crypto/bn/bn_mod.c:87:14: Call 85. goto err; 86. if (a == b) { 87. if (!BN_sqr(t, a, ctx)) ^ 88. goto err; 89. } 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:60:13: Call 58. if (al < BN_SQR_RECURSIVE_SIZE_NORMAL) { 59. BN_ULONG t[BN_SQR_RECURSIVE_SIZE_NORMAL * 2]; 60. bn_sqr_normal(rr->d, a->d, al, t); ^ 61. } else { 62. int j, k; 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: [2, 15] (⇐ 1 + [1, 14]) Size: [0, 8388607] by call to `SRP_Calc_server_key` 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/b90506e995d44dee0ef4dd0324b56b59154256c2/crypto/bn/bn_sqr.c/#L119
d2a_code_trace_data_44863
static void unpack_input(const unsigned char *input, unsigned int *output) { unsigned int outbuffer[28]; unsigned short inbuffer[10]; unsigned int x; unsigned int *ptr; for (x=0;x<20;x+=2) inbuffer[x/2]=(input[x]<<8)+input[x+1]; ptr=outbuffer; *(ptr++)=27; *(ptr++)=(inbuffer[0]>>10)&0x3f; *(ptr++)=(inbuffer[0]>>5)&0x1f; *(ptr++)=inbuffer[0]&0x1f; *(ptr++)=(inbuffer[1]>>12)&0xf; *(ptr++)=(inbuffer[1]>>8)&0xf; *(ptr++)=(inbuffer[1]>>5)&7; *(ptr++)=(inbuffer[1]>>2)&7; *(ptr++)=((inbuffer[1]<<1)&6)|((inbuffer[2]>>15)&1); *(ptr++)=(inbuffer[2]>>12)&7; *(ptr++)=(inbuffer[2]>>10)&3; *(ptr++)=(inbuffer[2]>>5)&0x1f; *(ptr++)=((inbuffer[2]<<2)&0x7c)|((inbuffer[3]>>14)&3); *(ptr++)=(inbuffer[3]>>6)&0xff; *(ptr++)=((inbuffer[3]<<1)&0x7e)|((inbuffer[4]>>15)&1); *(ptr++)=(inbuffer[4]>>8)&0x7f; *(ptr++)=(inbuffer[4]>>1)&0x7f; *(ptr++)=((inbuffer[4]<<7)&0x80)|((inbuffer[5]>>9)&0x7f); *(ptr++)=(inbuffer[5]>>2)&0x7f; *(ptr++)=((inbuffer[5]<<5)&0x60)|((inbuffer[6]>>11)&0x1f); *(ptr++)=(inbuffer[6]>>4)&0x7f; *(ptr++)=((inbuffer[6]<<4)&0xf0)|((inbuffer[7]>>12)&0xf); *(ptr++)=(inbuffer[7]>>5)&0x7f; *(ptr++)=((inbuffer[7]<<2)&0x7c)|((inbuffer[8]>>14)&3); *(ptr++)=(inbuffer[8]>>7)&0x7f; *(ptr++)=((inbuffer[8]<<1)&0xfe)|((inbuffer[9]>>15)&1); *(ptr++)=(inbuffer[9]>>8)&0x7f; *(ptr++)=(inbuffer[9]>>1)&0x7f; *(output++)=outbuffer[11]; for (x=1;x<11;*(output++)=outbuffer[x++]); ptr=outbuffer+12; for (x=0;x<16;x+=4) { *(output++)=ptr[x]; *(output++)=ptr[x+2]; *(output++)=ptr[x+3]; *(output++)=ptr[x+1]; } } libavcodec/ra144.c:286: error: Uninitialized Value The value read from inbuffer[_] was never initialized. libavcodec/ra144.c:286:3: 284. *(ptr++)=((inbuffer[4]<<7)&0x80)|((inbuffer[5]>>9)&0x7f); 285. *(ptr++)=(inbuffer[5]>>2)&0x7f; 286. *(ptr++)=((inbuffer[5]<<5)&0x60)|((inbuffer[6]>>11)&0x1f); ^ 287. *(ptr++)=(inbuffer[6]>>4)&0x7f; 288. *(ptr++)=((inbuffer[6]<<4)&0xf0)|((inbuffer[7]>>12)&0xf);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ra144.c/#L286
d2a_code_trace_data_44864
int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) { char *v; int gmt = 0; int i; int y = 0, M = 0, d = 0, h = 0, m = 0, s = 0; char *f = NULL; int f_len = 0; i = tm->length; v = (char *)tm->data; if (i < 12) goto err; if (v[i - 1] == 'Z') gmt = 1; for (i = 0; i < 12; i++) if ((v[i] > '9') || (v[i] < '0')) goto err; y = (v[0] - '0') * 1000 + (v[1] - '0') * 100 + (v[2] - '0') * 10 + (v[3] - '0'); M = (v[4] - '0') * 10 + (v[5] - '0'); if ((M > 12) || (M < 1)) goto err; d = (v[6] - '0') * 10 + (v[7] - '0'); h = (v[8] - '0') * 10 + (v[9] - '0'); m = (v[10] - '0') * 10 + (v[11] - '0'); if (tm->length >= 14 && (v[12] >= '0') && (v[12] <= '9') && (v[13] >= '0') && (v[13] <= '9')) { s = (v[12] - '0') * 10 + (v[13] - '0'); if (tm->length >= 15 && v[14] == '.') { int l = tm->length; f = &v[14]; f_len = 1; while (14 + f_len < l && f[f_len] >= '0' && f[f_len] <= '9') ++f_len; } } if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s", _asn1_mon[M - 1], d, h, m, s, f_len, f, y, (gmt) ? " GMT" : "") <= 0) return (0); else return (1); err: BIO_write(bp, "Bad time value", 14); return (0); } crypto/ocsp/v3_ocsp.c:198: error: BUFFER_OVERRUN_L3 Offset: [-529, +oo] Size: 12 by call to `ASN1_GENERALIZEDTIME_print`. Showing all 7 steps of the trace crypto/ocsp/v3_ocsp.c:198:10: Call 196. if (BIO_printf(bp, "%*s", ind, "") <= 0) 197. return 0; 198. if (!ASN1_GENERALIZEDTIME_print(bp, cutoff)) ^ 199. return 0; 200. return 1; crypto/asn1/a_gentm.c:266:1: <Offset trace> 264. }; 265. 266. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 267. { 268. char *v; crypto/asn1/a_gentm.c:266:1: Parameter `*tm->data` 264. }; 265. 266. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 267. { 268. char *v; crypto/asn1/a_gentm.c:287:5: Assignment 285. y = (v[0] - '0') * 1000 + (v[1] - '0') * 100 286. + (v[2] - '0') * 10 + (v[3] - '0'); 287. M = (v[4] - '0') * 10 + (v[5] - '0'); ^ 288. if ((M > 12) || (M < 1)) 289. goto err; crypto/asn1/a_gentm.c:261:1: <Length trace> 259. } 260. 261. > const char *_asn1_mon[12] = { 262. "Jan", "Feb", "Mar", "Apr", "May", "Jun", 263. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" crypto/asn1/a_gentm.c:261:1: Array declaration 259. } 260. 261. > const char *_asn1_mon[12] = { 262. "Jan", "Feb", "Mar", "Apr", "May", "Jun", 263. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" crypto/asn1/a_gentm.c:308:20: Array access: Offset: [-529, +oo] Size: 12 by call to `ASN1_GENERALIZEDTIME_print` 306. 307. if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s", 308. _asn1_mon[M - 1], d, h, m, s, f_len, f, y, ^ 309. (gmt) ? " GMT" : "") <= 0) 310. return (0);
https://github.com/openssl/openssl/blob/01b7851aa27aa144372f5484da916be042d9aa4f/crypto/asn1/a_gentm.c/#L308
d2a_code_trace_data_44865
static ossl_inline uint32_t constant_time_is_zero_32(uint32_t a) { return constant_time_msb_32(~a & (a - 1)); } crypto/ec/curve448/f_generic.c:167: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `constant_time_is_zero_32`. Showing all 5 steps of the trace crypto/ec/curve448/f_generic.c:158:5: Assignment 156. { 157. gf c; 158. mask_t ret = 0; ^ 159. unsigned int i; 160. crypto/ec/curve448/f_generic.c:167:12: Call 165. ret |= c->limb[LIMBPERM(i)]; 166. 167. return word_is_zero(ret); ^ 168. } 169. include/internal/constant_time_locl.h:183:1: <LHS trace> 181. } 182. 183. > static ossl_inline uint32_t constant_time_is_zero_32(uint32_t a) 184. { 185. return constant_time_msb_32(~a & (a - 1)); include/internal/constant_time_locl.h:183:1: Parameter `a` 181. } 182. 183. > static ossl_inline uint32_t constant_time_is_zero_32(uint32_t a) 184. { 185. return constant_time_msb_32(~a & (a - 1)); include/internal/constant_time_locl.h:185:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `constant_time_is_zero_32` 183. static ossl_inline uint32_t constant_time_is_zero_32(uint32_t a) 184. { 185. return constant_time_msb_32(~a & (a - 1)); ^ 186. } 187.
https://github.com/openssl/openssl/blob/a7232276fef30a63070fd9dbb53d3820d3761d5b/include/internal/constant_time_locl.h/#L185
d2a_code_trace_data_44866
static void opt_output_file(const char *filename) { AVFormatContext *oc; int err, use_video, use_audio, use_subtitle; int input_has_video, input_has_audio, input_has_subtitle; AVFormatParameters params, *ap = &params; AVOutputFormat *file_oformat; if (!strcmp(filename, "-")) filename = "pipe:"; oc = avformat_alloc_context(); if (!oc) { print_error(filename, AVERROR(ENOMEM)); av_exit(1); } if (last_asked_format) { file_oformat = av_guess_format(last_asked_format, NULL, NULL); if (!file_oformat) { fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format); av_exit(1); } last_asked_format = NULL; } else { file_oformat = av_guess_format(NULL, filename, NULL); if (!file_oformat) { fprintf(stderr, "Unable to find a suitable output format for '%s'\n", filename); av_exit(1); } } oc->oformat = file_oformat; av_strlcpy(oc->filename, filename, sizeof(oc->filename)); if (!strcmp(file_oformat->name, "ffm") && av_strstart(filename, "http:", NULL)) { int err = read_ffserver_streams(oc, filename); if (err < 0) { print_error(filename, err); av_exit(1); } } else { use_video = file_oformat->video_codec != CODEC_ID_NONE || video_stream_copy || video_codec_name; use_audio = file_oformat->audio_codec != CODEC_ID_NONE || audio_stream_copy || audio_codec_name; use_subtitle = file_oformat->subtitle_codec != CODEC_ID_NONE || subtitle_stream_copy || subtitle_codec_name; if (nb_input_files > 0) { check_audio_video_sub_inputs(&input_has_video, &input_has_audio, &input_has_subtitle); if (!input_has_video) use_video = 0; if (!input_has_audio) use_audio = 0; if (!input_has_subtitle) use_subtitle = 0; } if (audio_disable) { use_audio = 0; } if (video_disable) { use_video = 0; } if (subtitle_disable) { use_subtitle = 0; } if (use_video) { new_video_stream(oc); } if (use_audio) { new_audio_stream(oc); } if (use_subtitle) { new_subtitle_stream(oc); } oc->timestamp = recording_timestamp; for(; metadata_count>0; metadata_count--){ av_metadata_set2(&oc->metadata, metadata[metadata_count-1].key, metadata[metadata_count-1].value, 0); } av_metadata_conv(oc, oc->oformat->metadata_conv, NULL); } output_files[nb_output_files++] = oc; if (oc->oformat->flags & AVFMT_NEEDNUMBER) { if (!av_filename_number_test(oc->filename)) { print_error(oc->filename, AVERROR_NUMEXPECTED); av_exit(1); } } if (!(oc->oformat->flags & AVFMT_NOFILE)) { if (!file_overwrite && (strchr(filename, ':') == NULL || filename[1] == ':' || av_strstart(filename, "file:", NULL))) { if (url_exist(filename)) { if (!using_stdin) { fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename); fflush(stderr); if (!read_yesno()) { fprintf(stderr, "Not overwriting - exiting\n"); av_exit(1); } } else { fprintf(stderr,"File '%s' already exists. Exiting.\n", filename); av_exit(1); } } } if ((err = url_fopen(&oc->pb, filename, URL_WRONLY)) < 0) { print_error(filename, err); av_exit(1); } } memset(ap, 0, sizeof(*ap)); if (av_set_parameters(oc, ap) < 0) { fprintf(stderr, "%s: Invalid encoding parameters\n", oc->filename); av_exit(1); } oc->preload= (int)(mux_preload*AV_TIME_BASE); oc->max_delay= (int)(mux_max_delay*AV_TIME_BASE); oc->loop_output = loop_output; oc->flags |= AVFMT_FLAG_NONBLOCK; set_context_opts(oc, avformat_opts, AV_OPT_FLAG_ENCODING_PARAM); memset(streamid_map, 0, sizeof(streamid_map)); } ffmpeg.c:3692: error: Null Dereference pointer `file_oformat` last assigned on line 3681 could be null and is dereferenced at line 3692, column 17. ffmpeg.c:3656:1: start of procedure opt_output_file() 3654. } 3655. 3656. static void opt_output_file(const char *filename) ^ 3657. { 3658. AVFormatContext *oc; ffmpeg.c:3661:5: 3659. int err, use_video, use_audio, use_subtitle; 3660. int input_has_video, input_has_audio, input_has_subtitle; 3661. AVFormatParameters params, *ap = &params; ^ 3662. AVOutputFormat *file_oformat; 3663. ffmpeg.c:3664:10: Taking false branch 3662. AVOutputFormat *file_oformat; 3663. 3664. if (!strcmp(filename, "-")) ^ 3665. filename = "pipe:"; 3666. ffmpeg.c:3667:5: 3665. filename = "pipe:"; 3666. 3667. oc = avformat_alloc_context(); ^ 3668. if (!oc) { 3669. print_error(filename, AVERROR(ENOMEM)); libavformat/options.c:81:1: start of procedure avformat_alloc_context() 79. } 80. 81. AVFormatContext *avformat_alloc_context(void) ^ 82. { 83. AVFormatContext *ic; libavformat/options.c:84:5: 82. { 83. AVFormatContext *ic; 84. ic = av_malloc(sizeof(AVFormatContext)); ^ 85. if (!ic) return ic; 86. avformat_get_context_defaults(ic); libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(unsigned int size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(unsigned int size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-16) ) ^ 73. return NULL; 74. libavutil/mem.c:83:9: Taking false branch 81. ((char*)ptr)[-1]= diff; 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,16,size)) ^ 84. ptr = NULL; 85. #elif HAVE_MEMALIGN libavutil/mem.c:116:5: 114. ptr = malloc(size); 115. #endif 116. return ptr; ^ 117. } 118. libavutil/mem.c:117:1: return from a call to av_malloc 115. #endif 116. return ptr; 117. } ^ 118. 119. void *av_realloc(void *ptr, unsigned int size) libavformat/options.c:85:10: Taking false branch 83. AVFormatContext *ic; 84. ic = av_malloc(sizeof(AVFormatContext)); 85. if (!ic) return ic; ^ 86. avformat_get_context_defaults(ic); 87. ic->av_class = &av_format_context_class; libavformat/options.c:86:5: Skipping avformat_get_context_defaults(): empty list of specs 84. ic = av_malloc(sizeof(AVFormatContext)); 85. if (!ic) return ic; 86. avformat_get_context_defaults(ic); ^ 87. ic->av_class = &av_format_context_class; 88. return ic; libavformat/options.c:87:5: 85. if (!ic) return ic; 86. avformat_get_context_defaults(ic); 87. ic->av_class = &av_format_context_class; ^ 88. return ic; 89. } libavformat/options.c:88:5: 86. avformat_get_context_defaults(ic); 87. ic->av_class = &av_format_context_class; 88. return ic; ^ 89. } 90. libavformat/options.c:89:1: return from a call to avformat_alloc_context 87. ic->av_class = &av_format_context_class; 88. return ic; 89. } ^ 90. 91. #if LIBAVFORMAT_VERSION_MAJOR < 53 ffmpeg.c:3668:10: Taking false branch 3666. 3667. oc = avformat_alloc_context(); 3668. if (!oc) { ^ 3669. print_error(filename, AVERROR(ENOMEM)); 3670. av_exit(1); ffmpeg.c:3673:9: Taking false branch 3671. } 3672. 3673. if (last_asked_format) { ^ 3674. file_oformat = av_guess_format(last_asked_format, NULL, NULL); 3675. if (!file_oformat) { ffmpeg.c:3681:9: Skipping av_guess_format(): empty list of specs 3679. last_asked_format = NULL; 3680. } else { 3681. file_oformat = av_guess_format(NULL, filename, NULL); ^ 3682. if (!file_oformat) { 3683. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", ffmpeg.c:3682:14: Taking true branch 3680. } else { 3681. file_oformat = av_guess_format(NULL, filename, NULL); 3682. if (!file_oformat) { ^ 3683. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", 3684. filename); ffmpeg.c:3683:13: 3681. file_oformat = av_guess_format(NULL, filename, NULL); 3682. if (!file_oformat) { 3683. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", ^ 3684. filename); 3685. av_exit(1); ffmpeg.c:3685:13: Skipping av_exit(): empty list of specs 3683. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", 3684. filename); 3685. av_exit(1); ^ 3686. } 3687. } ffmpeg.c:3689:5: 3687. } 3688. 3689. oc->oformat = file_oformat; ^ 3690. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); 3691. ffmpeg.c:3690:5: 3688. 3689. oc->oformat = file_oformat; 3690. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); ^ 3691. 3692. if (!strcmp(file_oformat->name, "ffm") && libavutil/avstring.c:64:1: start of procedure av_strlcpy() 62. } 63. 64. size_t av_strlcpy(char *dst, const char *src, size_t size) ^ 65. { 66. size_t len = 0; libavutil/avstring.c:66:5: 64. size_t av_strlcpy(char *dst, const char *src, size_t size) 65. { 66. size_t len = 0; ^ 67. while (++len < size && *src) 68. *dst++ = *src++; libavutil/avstring.c:67:12: Loop condition is true. Entering loop body 65. { 66. size_t len = 0; 67. while (++len < size && *src) ^ 68. *dst++ = *src++; 69. if (len <= size) libavutil/avstring.c:67:28: Loop condition is false. Leaving loop 65. { 66. size_t len = 0; 67. while (++len < size && *src) ^ 68. *dst++ = *src++; 69. if (len <= size) libavutil/avstring.c:69:9: Taking true branch 67. while (++len < size && *src) 68. *dst++ = *src++; 69. if (len <= size) ^ 70. *dst = 0; 71. return len + strlen(src) - 1; libavutil/avstring.c:70:9: 68. *dst++ = *src++; 69. if (len <= size) 70. *dst = 0; ^ 71. return len + strlen(src) - 1; 72. } libavutil/avstring.c:71:5: 69. if (len <= size) 70. *dst = 0; 71. return len + strlen(src) - 1; ^ 72. } 73. libavutil/avstring.c:72:1: return from a call to av_strlcpy 70. *dst = 0; 71. return len + strlen(src) - 1; 72. } ^ 73. 74. size_t av_strlcat(char *dst, const char *src, size_t size) ffmpeg.c:3692:10: 3690. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); 3691. 3692. if (!strcmp(file_oformat->name, "ffm") && ^ 3693. av_strstart(filename, "http:", NULL)) { 3694. /* special case for files sent to ffserver: we get the stream
https://github.com/libav/libav/blob/66b84e4ab2fc96222dab32173d84f4a403129deb/ffmpeg.c/#L3692
d2a_code_trace_data_44867
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_sp800_56b_check.c:276: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_gcd`. Showing all 14 steps of the trace crypto/rsa/rsa_sp800_56b_check.c:276:10: Call 274. * The modulus has no factors smaller than 752. 275. */ 276. if (!BN_gcd(gcd, rsa->n, bn_get0_small_factors(), ctx) || !BN_is_one(gcd)) { ^ 277. RSAerr(RSA_F_RSA_SP800_56B_CHECK_PUBLIC, RSA_R_INVALID_MODULUS); 278. goto err; crypto/bn/bn_gcd.c:15:1: Parameter `ctx->stack.depth` 13. static BIGNUM *euclid(BIGNUM *a, BIGNUM *b); 14. 15. > int BN_gcd(BIGNUM *r, const BIGNUM *in_a, const BIGNUM *in_b, BN_CTX *ctx) 16. { 17. BIGNUM *a, *b, *t; crypto/bn/bn_gcd.c:23:5: Call 21. bn_check_top(in_b); 22. 23. BN_CTX_start(ctx); ^ 24. a = BN_CTX_get(ctx); 25. b = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gcd.c:24:9: Call 22. 23. BN_CTX_start(ctx); 24. a = BN_CTX_get(ctx); ^ 25. b = BN_CTX_get(ctx); 26. if (b == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:25:9: Call 23. BN_CTX_start(ctx); 24. a = BN_CTX_get(ctx); 25. b = BN_CTX_get(ctx); ^ 26. if (b == NULL) 27. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:49:5: Call 47. ret = 1; 48. err: 49. BN_CTX_end(ctx); ^ 50. bn_check_top(r); 51. return ret; crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/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_gcd` 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_44868
static void tls1_lookup_sigalg(int *phash_nid, int *psign_nid, int *psignhash_nid, const unsigned char *data) { int sign_nid, hash_nid; if (!phash_nid && !psign_nid && !psignhash_nid) return; if (phash_nid || psignhash_nid) { hash_nid = tls12_find_nid(data[0], tls12_md, sizeof(tls12_md)/sizeof(tls12_lookup)); if (phash_nid) *phash_nid = hash_nid; } if (psign_nid || psignhash_nid) { sign_nid = tls12_find_nid(data[1], tls12_sig, sizeof(tls12_sig)/sizeof(tls12_lookup)); if (psign_nid) *psign_nid = sign_nid; } if (psignhash_nid) { if (sign_nid && hash_nid) OBJ_find_sigid_by_algs(psignhash_nid, hash_nid, sign_nid); else *psignhash_nid = NID_undef; } } ssl/t1_lib.c:2921: error: UNINITIALIZED_VALUE The value read from sign_nid was never initialized. Showing all 1 steps of the trace ssl/t1_lib.c:2921:7: 2919. if (psignhash_nid) 2920. { 2921. > if (sign_nid && hash_nid) 2922. OBJ_find_sigid_by_algs(psignhash_nid, 2923. hash_nid, sign_nid);
https://github.com/openssl/openssl/blob/be681e123c3582f7bef18ed41b5ffa4793e8c4f7/ssl/t1_lib.c/#L2921
d2a_code_trace_data_44869
int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags){ AVInputFormat *avif= s->iformat; int64_t pos_min, pos_max, pos, pos_limit; int64_t ts_min, ts_max, ts; int index; AVStream *st; if (stream_index < 0) return -1; #ifdef DEBUG_SEEK av_log(s, AV_LOG_DEBUG, "read_seek: %d %"PRId64"\n", stream_index, target_ts); #endif ts_max= ts_min= AV_NOPTS_VALUE; pos_limit= -1; st= s->streams[stream_index]; if(st->index_entries){ AVIndexEntry *e; index= av_index_search_timestamp(st, target_ts, flags | AVSEEK_FLAG_BACKWARD); index= FFMAX(index, 0); e= &st->index_entries[index]; if(e->timestamp <= target_ts || e->pos == e->min_distance){ pos_min= e->pos; ts_min= e->timestamp; #ifdef DEBUG_SEEK av_log(s, AV_LOG_DEBUG, "using cached pos_min=0x%"PRIx64" dts_min=%"PRId64"\n", pos_min,ts_min); #endif }else{ assert(index==0); } index= av_index_search_timestamp(st, target_ts, flags & ~AVSEEK_FLAG_BACKWARD); assert(index < st->nb_index_entries); if(index >= 0){ e= &st->index_entries[index]; assert(e->timestamp >= target_ts); pos_max= e->pos; ts_max= e->timestamp; pos_limit= pos_max - e->min_distance; #ifdef DEBUG_SEEK av_log(s, AV_LOG_DEBUG, "using cached pos_max=0x%"PRIx64" pos_limit=0x%"PRIx64" dts_max=%"PRId64"\n", pos_max,pos_limit, ts_max); #endif } } pos= av_gen_search(s, stream_index, target_ts, pos_min, pos_max, pos_limit, ts_min, ts_max, flags, &ts, avif->read_timestamp); if(pos<0) return -1; url_fseek(s->pb, pos, SEEK_SET); av_update_cur_dts(s, st, ts); return 0; } libavformat/utils.c:1179: error: Uninitialized Value The value read from pos_min was never initialized. libavformat/utils.c:1179:10: 1177. } 1178. 1179. pos= av_gen_search(s, stream_index, target_ts, pos_min, pos_max, pos_limit, ts_min, ts_max, flags, &ts, avif->read_timestamp); ^ 1180. if(pos<0) 1181. return -1;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/utils.c/#L1179
d2a_code_trace_data_44870
static ossl_inline void packet_forward(PACKET *pkt, size_t len) { pkt->curr += len; pkt->remaining -= len; } ssl/statem/statem_srvr.c:991: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, 32]):unsigned64 by call to `PACKET_copy_bytes`. Showing all 10 steps of the trace ssl/statem/statem_srvr.c:988:25: Assignment 986. 987. /* Load the client random and compression list. */ 988. challenge_len = challenge_len > sizeof(clienthello.random) ^ 989. ? sizeof(clienthello.random) : challenge_len; 990. memset(clienthello.random, 0, sizeof(clienthello.random)); ssl/statem/statem_srvr.c:988:9: Assignment 986. 987. /* Load the client random and compression list. */ 988. challenge_len = challenge_len > sizeof(clienthello.random) ^ 989. ? sizeof(clienthello.random) : challenge_len; 990. memset(clienthello.random, 0, sizeof(clienthello.random)); ssl/statem/statem_srvr.c:991:14: Call 989. ? sizeof(clienthello.random) : challenge_len; 990. memset(clienthello.random, 0, sizeof(clienthello.random)); 991. if (!PACKET_copy_bytes(&challenge, ^ 992. clienthello.random + sizeof(clienthello.random) - 993. challenge_len, challenge_len) ssl/packet_locl.h:379:8: Parameter `len` 377. * The caller is responsible for ensuring that |data| can hold |len| bytes. 378. */ 379. __owur static ossl_inline int PACKET_copy_bytes(PACKET *pkt, ^ 380. unsigned char *data, size_t len) 381. { ssl/packet_locl.h:385:5: Call 383. return 0; 384. 385. packet_forward(pkt, len); ^ 386. 387. return 1; ssl/packet_locl.h:33:1: <LHS trace> 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: Parameter `pkt->remaining` 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: <RHS trace> 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: Parameter `len` 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:36:5: Binary operation: ([0, +oo] - [0, 32]):unsigned64 by call to `PACKET_copy_bytes` 34. { 35. pkt->curr += len; 36. pkt->remaining -= len; ^ 37. } 38.
https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/ssl/packet_locl.h/#L36
d2a_code_trace_data_44871
void ff_MPV_frame_end(MpegEncContext *s) { int i; #if FF_API_XVMC FF_DISABLE_DEPRECATION_WARNINGS if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) { ff_xvmc_field_end(s); } else FF_ENABLE_DEPRECATION_WARNINGS #endif if ((s->er.error_count || s->encoding) && !s->avctx->hwaccel && s->unrestricted_mv && s->current_picture.reference && !s->intra_only && !(s->flags & CODEC_FLAG_EMU_EDGE)) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); int hshift = desc->log2_chroma_w; int vshift = desc->log2_chroma_h; s->dsp.draw_edges(s->current_picture.f.data[0], s->linesize, s->h_edge_pos, s->v_edge_pos, EDGE_WIDTH, EDGE_WIDTH, EDGE_TOP | EDGE_BOTTOM); s->dsp.draw_edges(s->current_picture.f.data[1], s->uvlinesize, s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_TOP | EDGE_BOTTOM); s->dsp.draw_edges(s->current_picture.f.data[2], s->uvlinesize, s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_TOP | EDGE_BOTTOM); } emms_c(); s->last_pict_type = s->pict_type; s->last_lambda_for [s->pict_type] = s->current_picture_ptr->f.quality; if (s->pict_type!= AV_PICTURE_TYPE_B) { s->last_non_b_pict_type = s->pict_type; } #if 0 for (i = 0; i < MAX_PICTURE_COUNT; i++) { if (s->picture[i].f.data[0] == s->current_picture.f.data[0]) { s->picture[i] = s->current_picture; break; } } assert(i < MAX_PICTURE_COUNT); #endif if (s->encoding) { for (i = 0; i < MAX_PICTURE_COUNT; i++) { if (!s->picture[i].reference) ff_mpeg_unref_picture(s, &s->picture[i]); } } #if 0 memset(&s->last_picture, 0, sizeof(Picture)); memset(&s->next_picture, 0, sizeof(Picture)); memset(&s->current_picture, 0, sizeof(Picture)); #endif s->avctx->coded_frame = &s->current_picture_ptr->f; if (s->current_picture.reference) ff_thread_report_progress(&s->current_picture_ptr->tf, INT_MAX, 0); } libavcodec/mpegvideo.c:1721: error: Null Dereference pointer `desc` last assigned on line 1720 could be null and is dereferenced at line 1721, column 22. libavcodec/mpegvideo.c:1701:1: start of procedure ff_MPV_frame_end() 1699. /* generic function for encode/decode called after a 1700. * frame has been coded/decoded. */ 1701. void ff_MPV_frame_end(MpegEncContext *s) ^ 1702. { 1703. int i; libavcodec/mpegvideo.c:1709:9: Taking false branch 1707. /* redraw edges for the frame if decoding didn't complete */ 1708. // just to make sure that all data is rendered. 1709. if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) { ^ 1710. ff_xvmc_field_end(s); 1711. } else libavcodec/mpegvideo.c:1714:10: Taking false branch 1712. FF_ENABLE_DEPRECATION_WARNINGS 1713. #endif /* FF_API_XVMC */ 1714. if ((s->er.error_count || s->encoding) && ^ 1715. !s->avctx->hwaccel && 1716. s->unrestricted_mv && libavcodec/mpegvideo.c:1714:31: Taking true branch 1712. FF_ENABLE_DEPRECATION_WARNINGS 1713. #endif /* FF_API_XVMC */ 1714. if ((s->er.error_count || s->encoding) && ^ 1715. !s->avctx->hwaccel && 1716. s->unrestricted_mv && libavcodec/mpegvideo.c:1715:10: Taking true branch 1713. #endif /* FF_API_XVMC */ 1714. if ((s->er.error_count || s->encoding) && 1715. !s->avctx->hwaccel && ^ 1716. s->unrestricted_mv && 1717. s->current_picture.reference && libavcodec/mpegvideo.c:1716:9: Taking true branch 1714. if ((s->er.error_count || s->encoding) && 1715. !s->avctx->hwaccel && 1716. s->unrestricted_mv && ^ 1717. s->current_picture.reference && 1718. !s->intra_only && libavcodec/mpegvideo.c:1717:9: Taking true branch 1715. !s->avctx->hwaccel && 1716. s->unrestricted_mv && 1717. s->current_picture.reference && ^ 1718. !s->intra_only && 1719. !(s->flags & CODEC_FLAG_EMU_EDGE)) { libavcodec/mpegvideo.c:1718:10: Taking true branch 1716. s->unrestricted_mv && 1717. s->current_picture.reference && 1718. !s->intra_only && ^ 1719. !(s->flags & CODEC_FLAG_EMU_EDGE)) { 1720. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); libavcodec/mpegvideo.c:1719:11: Taking true branch 1717. s->current_picture.reference && 1718. !s->intra_only && 1719. !(s->flags & CODEC_FLAG_EMU_EDGE)) { ^ 1720. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); 1721. int hshift = desc->log2_chroma_w; libavcodec/mpegvideo.c:1720:9: 1718. !s->intra_only && 1719. !(s->flags & CODEC_FLAG_EMU_EDGE)) { 1720. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); ^ 1721. int hshift = desc->log2_chroma_w; 1722. int vshift = desc->log2_chroma_h; libavutil/pixdesc.c:1507:1: start of procedure av_pix_fmt_desc_get() 1505. } 1506. 1507. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) ^ 1508. { 1509. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) libavutil/pixdesc.c:1509:9: Taking false branch 1507. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1508. { 1509. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1510. return NULL; 1511. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1509:24: Taking true branch 1507. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1508. { 1509. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1510. return NULL; 1511. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1510:9: 1508. { 1509. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) 1510. return NULL; ^ 1511. return &av_pix_fmt_descriptors[pix_fmt]; 1512. } libavutil/pixdesc.c:1512:1: return from a call to av_pix_fmt_desc_get 1510. return NULL; 1511. return &av_pix_fmt_descriptors[pix_fmt]; 1512. } ^ 1513. 1514. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) libavcodec/mpegvideo.c:1721:9: 1719. !(s->flags & CODEC_FLAG_EMU_EDGE)) { 1720. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); 1721. int hshift = desc->log2_chroma_w; ^ 1722. int vshift = desc->log2_chroma_h; 1723. s->dsp.draw_edges(s->current_picture.f.data[0], s->linesize,
https://github.com/libav/libav/blob/01f6df01b6fdc2d71b82370374cde4bf102928c7/libavcodec/mpegvideo.c/#L1721
d2a_code_trace_data_44872
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:748: error: Integer Overflow L2 ([1, 2147483616] + 32):signed32 by call to `av_samples_get_buffer_size`. libavcodec/takdec.c:684:16: Call 682. init_get_bits(gb, pkt->data, pkt->size * 8); 683. 684. if ((ret = ff_tak_decode_frame_header(avctx, gb, &s->ti, 0)) < 0) ^ 685. return ret; 686. libavcodec/tak.c:121:1: Parameter `ti->frame_samples` 119. } 120. 121. int ff_tak_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb, ^ 122. TAKStreamInfo *ti, int log_level_offset) 123. { libavcodec/takdec.c:740:21: Assignment 738. avctx->channels = s->ti.channels; 739. 740. s->nb_samples = s->ti.last_frame_samples ? s->ti.last_frame_samples ^ 741. : s->ti.frame_samples; 742. libavcodec/takdec.c:740:5: Assignment 738. avctx->channels = s->ti.channels; 739. 740. s->nb_samples = s->ti.last_frame_samples ? s->ti.last_frame_samples ^ 741. : s->ti.frame_samples; 742. libavcodec/takdec.c:748:24: Call 746. 747. if (avctx->bits_per_coded_sample <= 16) { 748. int buf_size = av_samples_get_buffer_size(NULL, avctx->channels, ^ 749. s->nb_samples, 750. 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/0e830094ad0dc251613a0aa3234d9c5c397e02e6/libavutil/samplefmt.c/#L124
d2a_code_trace_data_44873
static rgbConvFn findRgbConvFn(SwsContext *c) { const enum AVPixelFormat srcFormat = c->srcFormat; const enum AVPixelFormat dstFormat = c->dstFormat; const int srcId = c->srcFormatBpp; const int dstId = c->dstFormatBpp; rgbConvFn conv = NULL; const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(srcFormat); const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(dstFormat); #define IS_NOT_NE(bpp, desc) \ (((bpp + 7) >> 3) == 2 && \ (!(desc->flags & AV_PIX_FMT_FLAG_BE) != !HAVE_BIGENDIAN)) if (IS_NOT_NE(srcId, desc_src) || IS_NOT_NE(dstId, desc_dst)) return NULL; #define CONV_IS(src, dst) (srcFormat == AV_PIX_FMT_##src && dstFormat == AV_PIX_FMT_##dst) if (isRGBA32(srcFormat) && isRGBA32(dstFormat)) { if ( CONV_IS(ABGR, RGBA) || CONV_IS(ARGB, BGRA) || CONV_IS(BGRA, ARGB) || CONV_IS(RGBA, ABGR)) conv = shuffle_bytes_3210; else if (CONV_IS(ABGR, ARGB) || CONV_IS(ARGB, ABGR)) conv = shuffle_bytes_0321; else if (CONV_IS(ABGR, BGRA) || CONV_IS(ARGB, RGBA)) conv = shuffle_bytes_1230; else if (CONV_IS(BGRA, RGBA) || CONV_IS(RGBA, BGRA)) conv = shuffle_bytes_2103; else if (CONV_IS(BGRA, ABGR) || CONV_IS(RGBA, ARGB)) conv = shuffle_bytes_3012; } else if ((isBGRinInt(srcFormat) && isBGRinInt(dstFormat)) || (isRGBinInt(srcFormat) && isRGBinInt(dstFormat))) { switch (srcId | (dstId << 16)) { case 0x000F000C: conv = rgb12to15; break; case 0x000F0010: conv = rgb16to15; break; case 0x000F0018: conv = rgb24to15; break; case 0x000F0020: conv = rgb32to15; break; case 0x0010000F: conv = rgb15to16; break; case 0x00100018: conv = rgb24to16; break; case 0x00100020: conv = rgb32to16; break; case 0x0018000F: conv = rgb15to24; break; case 0x00180010: conv = rgb16to24; break; case 0x00180020: conv = rgb32to24; break; case 0x0020000F: conv = rgb15to32; break; case 0x00200010: conv = rgb16to32; break; case 0x00200018: conv = rgb24to32; break; } } else if ((isBGRinInt(srcFormat) && isRGBinInt(dstFormat)) || (isRGBinInt(srcFormat) && isBGRinInt(dstFormat))) { switch (srcId | (dstId << 16)) { case 0x000C000C: conv = rgb12tobgr12; break; case 0x000F000F: conv = rgb15tobgr15; break; case 0x000F0010: conv = rgb16tobgr15; break; case 0x000F0018: conv = rgb24tobgr15; break; case 0x000F0020: conv = rgb32tobgr15; break; case 0x0010000F: conv = rgb15tobgr16; break; case 0x00100010: conv = rgb16tobgr16; break; case 0x00100018: conv = rgb24tobgr16; break; case 0x00100020: conv = rgb32tobgr16; break; case 0x0018000F: conv = rgb15tobgr24; break; case 0x00180010: conv = rgb16tobgr24; break; case 0x00180018: conv = rgb24tobgr24; break; case 0x00180020: conv = rgb32tobgr24; break; case 0x0020000F: conv = rgb15tobgr32; break; case 0x00200010: conv = rgb16tobgr32; break; case 0x00200018: conv = rgb24tobgr32; break; } } return conv; } libswscale/swscale_unscaled.c:568: error: Null Dereference pointer `desc_src` last assigned on line 560 could be null and is dereferenced at line 568, column 9. libswscale/swscale_unscaled.c:553:1: start of procedure findRgbConvFn() 551. /* {RGB,BGR}{15,16,24,32,32_1} -> {RGB,BGR}{15,16,24,32} */ 552. typedef void (* rgbConvFn) (const uint8_t *, uint8_t *, int); 553. static rgbConvFn findRgbConvFn(SwsContext *c) ^ 554. { 555. const enum AVPixelFormat srcFormat = c->srcFormat; libswscale/swscale_unscaled.c:555:5: 553. static rgbConvFn findRgbConvFn(SwsContext *c) 554. { 555. const enum AVPixelFormat srcFormat = c->srcFormat; ^ 556. const enum AVPixelFormat dstFormat = c->dstFormat; 557. const int srcId = c->srcFormatBpp; libswscale/swscale_unscaled.c:556:5: 554. { 555. const enum AVPixelFormat srcFormat = c->srcFormat; 556. const enum AVPixelFormat dstFormat = c->dstFormat; ^ 557. const int srcId = c->srcFormatBpp; 558. const int dstId = c->dstFormatBpp; libswscale/swscale_unscaled.c:557:5: 555. const enum AVPixelFormat srcFormat = c->srcFormat; 556. const enum AVPixelFormat dstFormat = c->dstFormat; 557. const int srcId = c->srcFormatBpp; ^ 558. const int dstId = c->dstFormatBpp; 559. rgbConvFn conv = NULL; libswscale/swscale_unscaled.c:558:5: 556. const enum AVPixelFormat dstFormat = c->dstFormat; 557. const int srcId = c->srcFormatBpp; 558. const int dstId = c->dstFormatBpp; ^ 559. rgbConvFn conv = NULL; 560. const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(srcFormat); libswscale/swscale_unscaled.c:559:5: 557. const int srcId = c->srcFormatBpp; 558. const int dstId = c->dstFormatBpp; 559. rgbConvFn conv = NULL; ^ 560. const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(srcFormat); 561. const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(dstFormat); libswscale/swscale_unscaled.c:560:5: 558. const int dstId = c->dstFormatBpp; 559. rgbConvFn conv = NULL; 560. const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(srcFormat); ^ 561. const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(dstFormat); 562. libavutil/pixdesc.c:1468:1: start of procedure av_pix_fmt_desc_get() 1466. } 1467. 1468. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) ^ 1469. { 1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) libavutil/pixdesc.c:1470:9: Taking false branch 1468. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1469. { 1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1471. return NULL; 1472. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1470:24: Taking true branch 1468. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1469. { 1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1471. return NULL; 1472. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1471:9: 1469. { 1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) 1471. return NULL; ^ 1472. return &av_pix_fmt_descriptors[pix_fmt]; 1473. } libavutil/pixdesc.c:1473:1: return from a call to av_pix_fmt_desc_get 1471. return NULL; 1472. return &av_pix_fmt_descriptors[pix_fmt]; 1473. } ^ 1474. 1475. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) libswscale/swscale_unscaled.c:561:5: 559. rgbConvFn conv = NULL; 560. const AVPixFmtDescriptor *desc_src = av_pix_fmt_desc_get(srcFormat); 561. const AVPixFmtDescriptor *desc_dst = av_pix_fmt_desc_get(dstFormat); ^ 562. 563. #define IS_NOT_NE(bpp, desc) \ libavutil/pixdesc.c:1468:1: start of procedure av_pix_fmt_desc_get() 1466. } 1467. 1468. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) ^ 1469. { 1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) libavutil/pixdesc.c:1470:9: Taking false branch 1468. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1469. { 1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1471. return NULL; 1472. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1470:24: Taking true branch 1468. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1469. { 1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1471. return NULL; 1472. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1471:9: 1469. { 1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) 1471. return NULL; ^ 1472. return &av_pix_fmt_descriptors[pix_fmt]; 1473. } libavutil/pixdesc.c:1473:1: return from a call to av_pix_fmt_desc_get 1471. return NULL; 1472. return &av_pix_fmt_descriptors[pix_fmt]; 1473. } ^ 1474. 1475. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) libswscale/swscale_unscaled.c:568:9: Taking true branch 566. 567. /* if this is non-native rgb444/555/565, don't handle it here. */ 568. if (IS_NOT_NE(srcId, desc_src) || IS_NOT_NE(dstId, desc_dst)) ^ 569. return NULL; 570.
https://github.com/libav/libav/blob/0a14fefd68cc18ce3252edff8a05ee9b3945b694/libswscale/swscale_unscaled.c/#L568
d2a_code_trace_data_44874
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { if (!ossl_assert(pkt->subs != NULL && len != 0)) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } if (allocbytes != NULL) *allocbytes = WPACKET_get_curr(pkt); return 1; } ssl/statem/extensions_clnt.c:76: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 4]):unsigned64 by call to `WPACKET_put_bytes__`. Showing all 12 steps of the trace ssl/statem/extensions_clnt.c:75:17: Call 73. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_max_fragment_length) 74. /* Sub-packet for Max Fragment Length extension (1 byte) */ 75. || !WPACKET_start_sub_packet_u16(pkt) ^ 76. || !WPACKET_put_bytes_u8(pkt, s->ext.max_fragment_len_mode) 77. || !WPACKET_close(pkt)) { ssl/packet.c:270:1: Parameter `pkt->buf->length` 268. } 269. 270. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 271. { 272. WPACKET_SUB *sub; ssl/statem/extensions_clnt.c:76:17: Call 74. /* Sub-packet for Max Fragment Length extension (1 byte) */ 75. || !WPACKET_start_sub_packet_u16(pkt) 76. || !WPACKET_put_bytes_u8(pkt, s->ext.max_fragment_len_mode) ^ 77. || !WPACKET_close(pkt)) { 78. SSLerr(SSL_F_TLS_CONSTRUCT_CTOS_MAXFRAGMENTLEN, ERR_R_INTERNAL_ERROR); ssl/packet.c:306:1: Parameter `pkt->written` 304. } 305. 306. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 307. { 308. unsigned char *data; ssl/packet.c:312:17: Call 310. /* Internal API, so should not fail */ 311. if (!ossl_assert(size <= sizeof(unsigned int)) 312. || !WPACKET_allocate_bytes(pkt, size, &data) ^ 313. || !put_value(data, val, size)) 314. return 0; ssl/packet.c:15:1: Parameter `pkt->written` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ssl/packet.c:17:10: Call 15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ^ 18. return 0; 19. ssl/packet.c:39:1: <LHS trace> 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: Parameter `pkt->buf->length` 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: <RHS trace> 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: Parameter `len` 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:48:36: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 4]):unsigned64 by call to `WPACKET_put_bytes__` 46. return 0; 47. 48. if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) { ^ 49. size_t newlen; 50. size_t reflen;
https://github.com/openssl/openssl/blob/9f5671c7e9f30dfa53b1a2b553f234c2761ceb66/ssl/packet.c/#L48
d2a_code_trace_data_44875
static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, long max) { const unsigned char *p = *pp; unsigned long ret = 0; unsigned long i; if (max-- < 1) return 0; if (*p == 0x80) { *inf = 1; ret = 0; p++; } else { *inf = 0; i = *p & 0x7f; if (*(p++) & 0x80) { if (max < (long)i + 1) return 0; while (i && *p == 0) { p++; i--; } if (i > sizeof(long)) return 0; while (i-- > 0) { ret <<= 8L; ret |= *(p++); } } else ret = i; } if (ret > LONG_MAX) return 0; *pp = p; *rl = (long)ret; return 1; } crypto/pem/pem_pkey.c:215: error: BUFFER_OVERRUN_L3 Offset: [2, +oo] Size: [1, +oo] by call to `d2i_DHxparams`. Showing all 29 steps of the trace crypto/pem/pem_pkey.c:210:10: Call 208. DH *ret = NULL; 209. 210. if (!PEM_bytes_read_bio(&data, &len, &nm, PEM_STRING_DHPARAMS, bp, cb, u)) ^ 211. return NULL; 212. p = data; crypto/pem/pem_lib.c:288:1: Parameter `**pdata` 286. } 287. 288. > int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, 289. const char *name, BIO *bp, pem_password_cb *cb, 290. void *u) { crypto/pem/pem_lib.c:291:12: Call 289. const char *name, BIO *bp, pem_password_cb *cb, 290. void *u) { 291. return pem_bytes_read_bio_flags(pdata, plen, pnm, name, bp, cb, u, ^ 292. PEM_FLAG_EAY_COMPATIBLE); 293. } crypto/pem/pem_lib.c:245:1: Parameter `**pdata` 243. } 244. 245. > static int pem_bytes_read_bio_flags(unsigned char **pdata, long *plen, 246. char **pnm, const char *name, BIO *bp, 247. pem_password_cb *cb, void *u, crypto/pem/pem_pkey.c:212:5: Assignment 210. if (!PEM_bytes_read_bio(&data, &len, &nm, PEM_STRING_DHPARAMS, bp, cb, u)) 211. return NULL; 212. p = data; ^ 213. 214. if (strcmp(nm, PEM_STRING_DHXPARAMS) == 0) crypto/pem/pem_pkey.c:215:15: Call 213. 214. if (strcmp(nm, PEM_STRING_DHXPARAMS) == 0) 215. ret = d2i_DHxparams(x, &p, len); ^ 216. else 217. ret = d2i_DHparams(x, &p, len); crypto/dh/dh_asn1.c:81:1: Parameter `**pp` 79. /* Application public function: read in X9.42 DH parameters into DH structure */ 80. 81. > DH *d2i_DHxparams(DH **a, const unsigned char **pp, long length) 82. { 83. int_dhx942_dh *dhx = NULL; crypto/dh/dh_asn1.c:88:11: Call 86. if (dh == NULL) 87. return NULL; 88. dhx = d2i_int_dhx(NULL, pp, length); ^ 89. if (dhx == NULL) { 90. DH_free(dh); crypto/dh/dh_asn1.c:77:1: Parameter `**in` 75. int i2d_int_dhx(const int_dhx942_dh *a, unsigned char **pp); 76. 77. > IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(int_dhx942_dh, DHxparams, int_dhx) 78. 79. /* Application public function: read in X9.42 DH parameters into DH structure */ crypto/dh/dh_asn1.c:77:1: Call 75. int i2d_int_dhx(const int_dhx942_dh *a, unsigned char **pp); 76. 77. > IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(int_dhx942_dh, DHxparams, int_dhx) 78. 79. /* Application public function: read in X9.42 DH parameters into DH structure */ crypto/asn1/tasn_dec.c:95:1: Parameter `**in` 93. */ 94. 95. > ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, 96. const unsigned char **in, long len, 97. const ASN1_ITEM *it) crypto/asn1/tasn_dec.c:104:9: Call 102. pval = &ptmpval; 103. asn1_tlc_clear_nc(&c); 104. if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) ^ 105. return *pval; 106. return NULL; crypto/asn1/tasn_dec.c:109:1: Parameter `**in` 107. } 108. 109. > int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, 110. const ASN1_ITEM *it, 111. int tag, int aclass, char opt, ASN1_TLC *ctx) crypto/asn1/tasn_dec.c:114:10: Call 112. { 113. int rv; 114. rv = asn1_item_embed_d2i(pval, in, len, it, tag, aclass, opt, ctx); ^ 115. if (rv <= 0) 116. ASN1_item_ex_free(pval, it); crypto/asn1/tasn_dec.c:125:1: Parameter `**in` 123. */ 124. 125. > static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in, 126. long len, const ASN1_ITEM *it, 127. int tag, int aclass, char opt, ASN1_TLC *ctx) crypto/asn1/tasn_dec.c:169:9: Assignment 167. 168. case ASN1_ITYPE_MSTRING: 169. p = *in; ^ 170. /* Just read in tag and class */ 171. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, crypto/asn1/tasn_dec.c:171:15: Call 169. p = *in; 170. /* Just read in tag and class */ 171. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, ^ 172. &p, len, -1, 0, 1, ctx); 173. if (!ret) { crypto/asn1/tasn_dec.c:1060:1: Parameter `**in` 1058. */ 1059. 1060. > static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, 1061. char *inf, char *cst, 1062. const unsigned char **in, long len, crypto/asn1/tasn_dec.c:1069:5: Assignment 1067. long plen; 1068. const unsigned char *p, *q; 1069. p = *in; ^ 1070. q = p; 1071. crypto/asn1/tasn_dec.c:1079:13: Call 1077. p += ctx->hdrlen; 1078. } else { 1079. i = ASN1_get_object(&p, &plen, &ptag, &pclass, len); ^ 1080. if (ctx) { 1081. ctx->ret = i; crypto/asn1/asn1_lib.c:44:1: Parameter `**pp` 42. } 43. 44. > int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, 45. int *pclass, long omax) 46. { crypto/asn1/asn1_lib.c:49:5: Assignment 47. int i, ret; 48. long l; 49. const unsigned char *p = *pp; ^ 50. int tag, xclass, inf; 51. long max = omax; crypto/asn1/asn1_lib.c:78:9: Assignment 76. } else { 77. tag = i; 78. p++; ^ 79. if (--max == 0) 80. goto err; crypto/asn1/asn1_lib.c:84:10: Call 82. *ptag = tag; 83. *pclass = xclass; 84. if (!asn1_get_length(&p, &inf, plength, max)) ^ 85. goto err; 86. crypto/asn1/asn1_lib.c:105:1: <Length trace> 103. } 104. 105. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, 106. long max) 107. { crypto/asn1/asn1_lib.c:105:1: Parameter `**pp` 103. } 104. 105. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, 106. long max) 107. { crypto/asn1/asn1_lib.c:108:5: Assignment 106. long max) 107. { 108. const unsigned char *p = *pp; ^ 109. unsigned long ret = 0; 110. unsigned long i; crypto/asn1/asn1_lib.c:121:15: Assignment 119. *inf = 0; 120. i = *p & 0x7f; 121. if (*(p++) & 0x80) { ^ 122. if (max < (long)i + 1) 123. return 0; crypto/asn1/asn1_lib.c:125:25: Array access: Offset: [2, +oo] Size: [1, +oo] by call to `d2i_DHxparams` 123. return 0; 124. /* Skip leading zeroes */ 125. while (i && *p == 0) { ^ 126. p++; 127. i--;
https://github.com/openssl/openssl/blob/7671342e550ed2de676b23c79d0e7f45a381c76e/crypto/asn1/asn1_lib.c/#L125
d2a_code_trace_data_44876
static void contract(OPENSSL_LHASH *lh) { OPENSSL_LH_NODE **n, *n1, *np; np = lh->b[lh->p + lh->pmax - 1]; lh->b[lh->p + lh->pmax - 1] = NULL; if (lh->p == 0) { n = OPENSSL_realloc(lh->b, (unsigned int)(sizeof(OPENSSL_LH_NODE *) * lh->pmax)); if (n == NULL) { lh->error++; return; } lh->num_contract_reallocs++; lh->num_alloc_nodes /= 2; lh->pmax /= 2; lh->p = lh->pmax - 1; lh->b = n; } else lh->p--; lh->num_nodes--; lh->num_contracts++; n1 = lh->b[(int)lh->p]; if (n1 == NULL) lh->b[(int)lh->p] = np; else { while (n1->next != NULL) n1 = n1->next; n1->next = np; } } crypto/property/property_string.c:34: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `OPENSSL_LH_delete`. Showing all 10 steps of the trace crypto/property/property_string.c:34:1: Parameter `lh->pmax` 32. } PROPERTY_STRING; 33. 34. > DEFINE_LHASH_OF(PROPERTY_STRING); 35. typedef LHASH_OF(PROPERTY_STRING) PROP_TABLE; 36. crypto/property/property_string.c:34:1: Call 32. } PROPERTY_STRING; 33. 34. > DEFINE_LHASH_OF(PROPERTY_STRING); 35. typedef LHASH_OF(PROPERTY_STRING) PROP_TABLE; 36. crypto/lhash/lhash.c:136:1: Parameter `lh->pmax` 134. } 135. 136. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 137. { 138. unsigned long hash; crypto/lhash/lhash.c:159:9: Call 157. if ((lh->num_nodes > MIN_NODES) && 158. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))) 159. contract(lh); ^ 160. 161. return ret; crypto/lhash/lhash.c:268:1: <Offset trace> 266. } 267. 268. > static void contract(OPENSSL_LHASH *lh) 269. { 270. OPENSSL_LH_NODE **n, *n1, *np; crypto/lhash/lhash.c:268:1: Parameter `lh->p` 266. } 267. 268. > static void contract(OPENSSL_LHASH *lh) 269. { 270. OPENSSL_LH_NODE **n, *n1, *np; crypto/lhash/lhash.c:288:9: Assignment 286. lh->b = n; 287. } else 288. lh->p--; ^ 289. 290. lh->num_nodes--; crypto/lhash/lhash.c:268:1: <Length trace> 266. } 267. 268. > static void contract(OPENSSL_LHASH *lh) 269. { 270. OPENSSL_LH_NODE **n, *n1, *np; crypto/lhash/lhash.c:268:1: Parameter `*lh->b` 266. } 267. 268. > static void contract(OPENSSL_LHASH *lh) 269. { 270. OPENSSL_LH_NODE **n, *n1, *np; crypto/lhash/lhash.c:293:10: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `OPENSSL_LH_delete` 291. lh->num_contracts++; 292. 293. n1 = lh->b[(int)lh->p]; ^ 294. if (n1 == NULL) 295. lh->b[(int)lh->p] = np;
https://github.com/openssl/openssl/blob/4460ad90af0338abe31286f29b36baf2e41abf19/crypto/lhash/lhash.c/#L293
d2a_code_trace_data_44877
static int init_context_frame(MpegEncContext *s) { int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y; s->mb_width = (s->width + 15) / 16; s->mb_stride = s->mb_width + 1; s->b8_stride = s->mb_width * 2 + 1; mb_array_size = s->mb_height * s->mb_stride; mv_table_size = (s->mb_height + 2) * s->mb_stride + 1; s->h_edge_pos = s->mb_width * 16; s->v_edge_pos = s->mb_height * 16; s->mb_num = s->mb_width * s->mb_height; s->block_wrap[0] = s->block_wrap[1] = s->block_wrap[2] = s->block_wrap[3] = s->b8_stride; s->block_wrap[4] = s->block_wrap[5] = s->mb_stride; y_size = s->b8_stride * (2 * s->mb_height + 1); c_size = s->mb_stride * (s->mb_height + 1); yc_size = y_size + 2 * c_size; FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int), fail); for (y = 0; y < s->mb_height; y++) for (x = 0; x < s->mb_width; x++) s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride; s->mb_index2xy[s->mb_height * s->mb_width] = (s->mb_height - 1) * s->mb_stride + s->mb_width; if (s->encoding) { FF_ALLOCZ_OR_GOTO(s->avctx, s->p_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->b_forw_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->b_back_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_forw_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_back_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->b_direct_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail); s->p_mv_table = s->p_mv_table_base + s->mb_stride + 1; s->b_forw_mv_table = s->b_forw_mv_table_base + s->mb_stride + 1; s->b_back_mv_table = s->b_back_mv_table_base + s->mb_stride + 1; s->b_bidir_forw_mv_table = s->b_bidir_forw_mv_table_base + s->mb_stride + 1; s->b_bidir_back_mv_table = s->b_bidir_back_mv_table_base + s->mb_stride + 1; s->b_direct_mv_table = s->b_direct_mv_table_base + s->mb_stride + 1; FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_type, mb_array_size * sizeof(uint16_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->lambda_table, mb_array_size * sizeof(int), fail); FF_ALLOC_OR_GOTO(s->avctx, s->cplx_tab, mb_array_size * sizeof(float), fail); FF_ALLOC_OR_GOTO(s->avctx, s->bits_tab, mb_array_size * sizeof(float), fail); } if (s->codec_id == AV_CODEC_ID_MPEG4 || (s->flags & CODEC_FLAG_INTERLACED_ME)) { for (i = 0; i < 2; i++) { int j, k; for (j = 0; j < 2; j++) { for (k = 0; k < 2; k++) { FF_ALLOCZ_OR_GOTO(s->avctx, s->b_field_mv_table_base[i][j][k], mv_table_size * 2 * sizeof(int16_t), fail); s->b_field_mv_table[i][j][k] = s->b_field_mv_table_base[i][j][k] + s->mb_stride + 1; } FF_ALLOCZ_OR_GOTO(s->avctx, s->b_field_select_table [i][j], mb_array_size * 2 * sizeof(uint8_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_mv_table_base[i][j], mv_table_size * 2 * sizeof(int16_t), fail); s->p_field_mv_table[i][j] = s->p_field_mv_table_base[i][j] + s->mb_stride + 1; } FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_select_table[i], mb_array_size * 2 * sizeof(uint8_t), fail); } } if (s->out_format == FMT_H263) { FF_ALLOCZ_OR_GOTO(s->avctx, s->coded_block_base, y_size, fail); s->coded_block = s->coded_block_base + s->b8_stride + 1; FF_ALLOCZ_OR_GOTO(s->avctx, s->cbp_table, mb_array_size * sizeof(uint8_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->pred_dir_table, mb_array_size * sizeof(uint8_t), fail); } if (s->h263_pred || s->h263_plus || !s->encoding) { FF_ALLOCZ_OR_GOTO(s->avctx, s->dc_val_base, yc_size * sizeof(int16_t), fail); s->dc_val[0] = s->dc_val_base + s->b8_stride + 1; s->dc_val[1] = s->dc_val_base + y_size + s->mb_stride + 1; s->dc_val[2] = s->dc_val[1] + c_size; for (i = 0; i < yc_size; i++) s->dc_val_base[i] = 1024; } FF_ALLOCZ_OR_GOTO(s->avctx, s->mbintra_table, mb_array_size, fail); memset(s->mbintra_table, 1, mb_array_size); FF_ALLOCZ_OR_GOTO(s->avctx, s->mbskip_table, mb_array_size + 2, fail); return init_er(s); fail: return AVERROR(ENOMEM); } libavcodec/mpegvideo.c:1117: error: Null Dereference pointer `s->mb_index2xy` last assigned on line 1111 could be null and is dereferenced at line 1117, column 5. libavcodec/mpegvideo.c:1083:1: start of procedure init_context_frame() 1081. * Initialize and allocates MpegEncContext fields dependent on the resolution. 1082. */ 1083. static int init_context_frame(MpegEncContext *s) ^ 1084. { 1085. int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y; libavcodec/mpegvideo.c:1087:5: 1085. int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y; 1086. 1087. s->mb_width = (s->width + 15) / 16; ^ 1088. s->mb_stride = s->mb_width + 1; 1089. s->b8_stride = s->mb_width * 2 + 1; libavcodec/mpegvideo.c:1088:5: 1086. 1087. s->mb_width = (s->width + 15) / 16; 1088. s->mb_stride = s->mb_width + 1; ^ 1089. s->b8_stride = s->mb_width * 2 + 1; 1090. mb_array_size = s->mb_height * s->mb_stride; libavcodec/mpegvideo.c:1089:5: 1087. s->mb_width = (s->width + 15) / 16; 1088. s->mb_stride = s->mb_width + 1; 1089. s->b8_stride = s->mb_width * 2 + 1; ^ 1090. mb_array_size = s->mb_height * s->mb_stride; 1091. mv_table_size = (s->mb_height + 2) * s->mb_stride + 1; libavcodec/mpegvideo.c:1090:5: 1088. s->mb_stride = s->mb_width + 1; 1089. s->b8_stride = s->mb_width * 2 + 1; 1090. mb_array_size = s->mb_height * s->mb_stride; ^ 1091. mv_table_size = (s->mb_height + 2) * s->mb_stride + 1; 1092. libavcodec/mpegvideo.c:1091:5: 1089. s->b8_stride = s->mb_width * 2 + 1; 1090. mb_array_size = s->mb_height * s->mb_stride; 1091. mv_table_size = (s->mb_height + 2) * s->mb_stride + 1; ^ 1092. 1093. /* set default edge pos, will be overriden libavcodec/mpegvideo.c:1095:5: 1093. /* set default edge pos, will be overriden 1094. * in decode_header if needed */ 1095. s->h_edge_pos = s->mb_width * 16; ^ 1096. s->v_edge_pos = s->mb_height * 16; 1097. libavcodec/mpegvideo.c:1096:5: 1094. * in decode_header if needed */ 1095. s->h_edge_pos = s->mb_width * 16; 1096. s->v_edge_pos = s->mb_height * 16; ^ 1097. 1098. s->mb_num = s->mb_width * s->mb_height; libavcodec/mpegvideo.c:1098:5: 1096. s->v_edge_pos = s->mb_height * 16; 1097. 1098. s->mb_num = s->mb_width * s->mb_height; ^ 1099. 1100. s->block_wrap[0] = libavcodec/mpegvideo.c:1100:5: 1098. s->mb_num = s->mb_width * s->mb_height; 1099. 1100. s->block_wrap[0] = ^ 1101. s->block_wrap[1] = 1102. s->block_wrap[2] = libavcodec/mpegvideo.c:1104:5: 1102. s->block_wrap[2] = 1103. s->block_wrap[3] = s->b8_stride; 1104. s->block_wrap[4] = ^ 1105. s->block_wrap[5] = s->mb_stride; 1106. libavcodec/mpegvideo.c:1107:5: 1105. s->block_wrap[5] = s->mb_stride; 1106. 1107. y_size = s->b8_stride * (2 * s->mb_height + 1); ^ 1108. c_size = s->mb_stride * (s->mb_height + 1); 1109. yc_size = y_size + 2 * c_size; libavcodec/mpegvideo.c:1108:5: 1106. 1107. y_size = s->b8_stride * (2 * s->mb_height + 1); 1108. c_size = s->mb_stride * (s->mb_height + 1); ^ 1109. yc_size = y_size + 2 * c_size; 1110. libavcodec/mpegvideo.c:1109:5: 1107. y_size = s->b8_stride * (2 * s->mb_height + 1); 1108. c_size = s->mb_stride * (s->mb_height + 1); 1109. yc_size = y_size + 2 * c_size; ^ 1110. 1111. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int), libavcodec/mpegvideo.c:1111:5: 1109. yc_size = y_size + 2 * c_size; 1110. 1111. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int), ^ 1112. fail); // error ressilience code looks cleaner with this 1113. for (y = 0; y < s->mb_height; y++) libavutil/mem.c:205:1: start of procedure av_mallocz() 203. } 204. 205. void *av_mallocz(size_t size) ^ 206. { 207. void *ptr = av_malloc(size); libavutil/mem.c:207:5: 205. void *av_mallocz(size_t size) 206. { 207. void *ptr = av_malloc(size); ^ 208. if (ptr) 209. memset(ptr, 0, size); libavutil/mem.c:62:1: start of procedure av_malloc() 60. * linker will do it automatically. */ 61. 62. void *av_malloc(size_t size) ^ 63. { 64. void *ptr = NULL; libavutil/mem.c:64:5: 62. void *av_malloc(size_t size) 63. { 64. void *ptr = NULL; ^ 65. #if CONFIG_MEMALIGN_HACK 66. long diff; libavutil/mem.c:70:9: Taking true branch 68. 69. /* let's disallow possibly ambiguous cases */ 70. if (size > (INT_MAX - 32) || !size) ^ 71. return NULL; 72. libavutil/mem.c:71:9: 69. /* let's disallow possibly ambiguous cases */ 70. if (size > (INT_MAX - 32) || !size) 71. return NULL; ^ 72. 73. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavutil/mem.c:208:9: Taking false branch 206. { 207. void *ptr = av_malloc(size); 208. if (ptr) ^ 209. memset(ptr, 0, size); 210. return ptr; libavutil/mem.c:210:5: 208. if (ptr) 209. memset(ptr, 0, size); 210. return ptr; ^ 211. } 212. libavutil/mem.c:211:1: return from a call to av_mallocz 209. memset(ptr, 0, size); 210. return ptr; 211. } ^ 212. 213. char *av_strdup(const char *s) libavcodec/mpegvideo.c:1111:5: Taking true branch 1109. yc_size = y_size + 2 * c_size; 1110. 1111. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int), ^ 1112. fail); // error ressilience code looks cleaner with this 1113. for (y = 0; y < s->mb_height; y++) libavcodec/mpegvideo.c:1111:5: Taking false branch 1109. yc_size = y_size + 2 * c_size; 1110. 1111. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int), ^ 1112. fail); // error ressilience code looks cleaner with this 1113. for (y = 0; y < s->mb_height; y++) libavcodec/mpegvideo.c:1113:10: 1111. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int), 1112. fail); // error ressilience code looks cleaner with this 1113. for (y = 0; y < s->mb_height; y++) ^ 1114. for (x = 0; x < s->mb_width; x++) 1115. s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride; libavcodec/mpegvideo.c:1113:17: Loop condition is false. Leaving loop 1111. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int), 1112. fail); // error ressilience code looks cleaner with this 1113. for (y = 0; y < s->mb_height; y++) ^ 1114. for (x = 0; x < s->mb_width; x++) 1115. s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride; libavcodec/mpegvideo.c:1117:5: 1115. s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride; 1116. 1117. s->mb_index2xy[s->mb_height * s->mb_width] = ^ 1118. (s->mb_height - 1) * s->mb_stride + s->mb_width; // FIXME really needed? 1119.
https://github.com/libav/libav/blob/d6d767d93e532246cacf3567e6bcad76a821f838/libavcodec/mpegvideo.c/#L1117
d2a_code_trace_data_44878
static void flush_encoders(OutputStream *ost_table, int nb_ostreams) { int i, ret; for (i = 0; i < nb_ostreams; i++) { OutputStream *ost = &ost_table[i]; AVCodecContext *enc = ost->st->codec; AVFormatContext *os = output_files[ost->file_index].ctx; int stop_encoding = 0; if (!ost->encoding_needed) continue; if (ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO && enc->frame_size <= 1) continue; if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE) && enc->codec->id == CODEC_ID_RAWVIDEO) continue; for (;;) { AVPacket pkt; int fifo_bytes, got_packet; av_init_packet(&pkt); pkt.data = NULL; pkt.size = 0; switch (ost->st->codec->codec_type) { case AVMEDIA_TYPE_AUDIO: fifo_bytes = av_fifo_size(ost->fifo); if (fifo_bytes > 0) { int frame_bytes = fifo_bytes; av_fifo_generic_read(ost->fifo, audio_buf, fifo_bytes, NULL); if (!(enc->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME)) { frame_bytes = enc->frame_size * enc->channels * av_get_bytes_per_sample(enc->sample_fmt); if (allocated_audio_buf_size < frame_bytes) exit_program(1); generate_silence(audio_buf+fifo_bytes, enc->sample_fmt, frame_bytes - fifo_bytes); } encode_audio_frame(os, ost, audio_buf, frame_bytes); } else { if (encode_audio_frame(os, ost, NULL, 0) == 0) { stop_encoding = 1; break; } } break; case AVMEDIA_TYPE_VIDEO: ret = avcodec_encode_video2(enc, &pkt, NULL, &got_packet); if (ret < 0) { av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n"); exit_program(1); } video_size += ret; if (ost->logfile && enc->stats_out) { fprintf(ost->logfile, "%s", enc->stats_out); } if (!got_packet) { stop_encoding = 1; break; } if (pkt.pts != AV_NOPTS_VALUE) pkt.pts = av_rescale_q(pkt.pts, enc->time_base, ost->st->time_base); if (pkt.dts != AV_NOPTS_VALUE) pkt.dts = av_rescale_q(pkt.dts, enc->time_base, ost->st->time_base); write_frame(os, &pkt, ost); break; default: stop_encoding = 1; } if (stop_encoding) break; } } } avconv.c:1709: error: Null Dereference pointer `null` is dereferenced by call to `avcodec_encode_video2()` at line 1709, column 23. avconv.c:1656:1: start of procedure flush_encoders() 1654. } 1655. 1656. static void flush_encoders(OutputStream *ost_table, int nb_ostreams) ^ 1657. { 1658. int i, ret; avconv.c:1660:10: 1658. int i, ret; 1659. 1660. for (i = 0; i < nb_ostreams; i++) { ^ 1661. OutputStream *ost = &ost_table[i]; 1662. AVCodecContext *enc = ost->st->codec; avconv.c:1660:17: Loop condition is true. Entering loop body 1658. int i, ret; 1659. 1660. for (i = 0; i < nb_ostreams; i++) { ^ 1661. OutputStream *ost = &ost_table[i]; 1662. AVCodecContext *enc = ost->st->codec; avconv.c:1661:9: 1659. 1660. for (i = 0; i < nb_ostreams; i++) { 1661. OutputStream *ost = &ost_table[i]; ^ 1662. AVCodecContext *enc = ost->st->codec; 1663. AVFormatContext *os = output_files[ost->file_index].ctx; avconv.c:1662:9: 1660. for (i = 0; i < nb_ostreams; i++) { 1661. OutputStream *ost = &ost_table[i]; 1662. AVCodecContext *enc = ost->st->codec; ^ 1663. AVFormatContext *os = output_files[ost->file_index].ctx; 1664. int stop_encoding = 0; avconv.c:1663:9: 1661. OutputStream *ost = &ost_table[i]; 1662. AVCodecContext *enc = ost->st->codec; 1663. AVFormatContext *os = output_files[ost->file_index].ctx; ^ 1664. int stop_encoding = 0; 1665. avconv.c:1664:9: 1662. AVCodecContext *enc = ost->st->codec; 1663. AVFormatContext *os = output_files[ost->file_index].ctx; 1664. int stop_encoding = 0; ^ 1665. 1666. if (!ost->encoding_needed) avconv.c:1666:14: Taking false branch 1664. int stop_encoding = 0; 1665. 1666. if (!ost->encoding_needed) ^ 1667. continue; 1668. avconv.c:1669:13: Taking false branch 1667. continue; 1668. 1669. if (ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO && enc->frame_size <= 1) ^ 1670. continue; 1671. if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE) && enc->codec->id == CODEC_ID_RAWVIDEO) avconv.c:1671:13: Taking true branch 1669. if (ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO && enc->frame_size <= 1) 1670. continue; 1671. if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE) && enc->codec->id == CODEC_ID_RAWVIDEO) ^ 1672. continue; 1673. avconv.c:1671:66: Taking true branch 1669. if (ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO && enc->frame_size <= 1) 1670. continue; 1671. if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE) && enc->codec->id == CODEC_ID_RAWVIDEO) ^ 1672. continue; 1673. avconv.c:1671:108: Taking false branch 1669. if (ost->st->codec->codec_type == AVMEDIA_TYPE_AUDIO && enc->frame_size <= 1) 1670. continue; 1671. if (ost->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && (os->oformat->flags & AVFMT_RAWPICTURE) && enc->codec->id == CODEC_ID_RAWVIDEO) ^ 1672. continue; 1673. avconv.c:1733:9: Loop condition is true. Entering loop body 1731. if (stop_encoding) 1732. break; 1733. } ^ 1734. } 1735. } avconv.c:1677:13: 1675. AVPacket pkt; 1676. int fifo_bytes, got_packet; 1677. av_init_packet(&pkt); ^ 1678. pkt.data = NULL; 1679. pkt.size = 0; libavcodec/avpacket.c:46:1: start of procedure av_init_packet() 44. } 45. 46. void av_init_packet(AVPacket *pkt) ^ 47. { 48. pkt->pts = AV_NOPTS_VALUE; libavcodec/avpacket.c:48:5: 46. void av_init_packet(AVPacket *pkt) 47. { 48. pkt->pts = AV_NOPTS_VALUE; ^ 49. pkt->dts = AV_NOPTS_VALUE; 50. pkt->pos = -1; libavcodec/avpacket.c:49:5: 47. { 48. pkt->pts = AV_NOPTS_VALUE; 49. pkt->dts = AV_NOPTS_VALUE; ^ 50. pkt->pos = -1; 51. pkt->duration = 0; libavcodec/avpacket.c:50:5: 48. pkt->pts = AV_NOPTS_VALUE; 49. pkt->dts = AV_NOPTS_VALUE; 50. pkt->pos = -1; ^ 51. pkt->duration = 0; 52. pkt->convergence_duration = 0; libavcodec/avpacket.c:51:5: 49. pkt->dts = AV_NOPTS_VALUE; 50. pkt->pos = -1; 51. pkt->duration = 0; ^ 52. pkt->convergence_duration = 0; 53. pkt->flags = 0; libavcodec/avpacket.c:52:5: 50. pkt->pos = -1; 51. pkt->duration = 0; 52. pkt->convergence_duration = 0; ^ 53. pkt->flags = 0; 54. pkt->stream_index = 0; libavcodec/avpacket.c:53:5: 51. pkt->duration = 0; 52. pkt->convergence_duration = 0; 53. pkt->flags = 0; ^ 54. pkt->stream_index = 0; 55. pkt->destruct= NULL; libavcodec/avpacket.c:54:5: 52. pkt->convergence_duration = 0; 53. pkt->flags = 0; 54. pkt->stream_index = 0; ^ 55. pkt->destruct= NULL; 56. pkt->side_data = NULL; libavcodec/avpacket.c:55:5: 53. pkt->flags = 0; 54. pkt->stream_index = 0; 55. pkt->destruct= NULL; ^ 56. pkt->side_data = NULL; 57. pkt->side_data_elems = 0; libavcodec/avpacket.c:56:5: 54. pkt->stream_index = 0; 55. pkt->destruct= NULL; 56. pkt->side_data = NULL; ^ 57. pkt->side_data_elems = 0; 58. } libavcodec/avpacket.c:57:5: 55. pkt->destruct= NULL; 56. pkt->side_data = NULL; 57. pkt->side_data_elems = 0; ^ 58. } 59. libavcodec/avpacket.c:58:1: return from a call to av_init_packet 56. pkt->side_data = NULL; 57. pkt->side_data_elems = 0; 58. } ^ 59. 60. int av_new_packet(AVPacket *pkt, int size) avconv.c:1678:13: 1676. int fifo_bytes, got_packet; 1677. av_init_packet(&pkt); 1678. pkt.data = NULL; ^ 1679. pkt.size = 0; 1680. avconv.c:1679:13: 1677. av_init_packet(&pkt); 1678. pkt.data = NULL; 1679. pkt.size = 0; ^ 1680. 1681. switch (ost->st->codec->codec_type) { avconv.c:1681:13: 1679. pkt.size = 0; 1680. 1681. switch (ost->st->codec->codec_type) { ^ 1682. case AVMEDIA_TYPE_AUDIO: 1683. fifo_bytes = av_fifo_size(ost->fifo); avconv.c:1682:13: Switch condition is false. Skipping switch case 1680. 1681. switch (ost->st->codec->codec_type) { 1682. case AVMEDIA_TYPE_AUDIO: ^ 1683. fifo_bytes = av_fifo_size(ost->fifo); 1684. if (fifo_bytes > 0) { avconv.c:1708:13: Switch condition is true. Entering switch case 1706. } 1707. break; 1708. case AVMEDIA_TYPE_VIDEO: ^ 1709. ret = avcodec_encode_video2(enc, &pkt, NULL, &got_packet); 1710. if (ret < 0) { avconv.c:1709:17: 1707. break; 1708. case AVMEDIA_TYPE_VIDEO: 1709. ret = avcodec_encode_video2(enc, &pkt, NULL, &got_packet); ^ 1710. if (ret < 0) { 1711. av_log(NULL, AV_LOG_FATAL, "Video encoding failed\n"); libavcodec/utils.c:1085:1: start of procedure avcodec_encode_video2() 1083. #endif 1084. 1085. int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx, ^ 1086. AVPacket *avpkt, 1087. const AVFrame *frame, libavcodec/utils.c:1091:25: Condition is true 1089. { 1090. int ret; 1091. int user_packet = !!avpkt->data; ^ 1092. 1093. if (!(avctx->codec->capabilities & CODEC_CAP_DELAY) && !frame) { libavcodec/utils.c:1091:23: 1089. { 1090. int ret; 1091. int user_packet = !!avpkt->data; ^ 1092. 1093. if (!(avctx->codec->capabilities & CODEC_CAP_DELAY) && !frame) { libavcodec/utils.c:1091:5: 1089. { 1090. int ret; 1091. int user_packet = !!avpkt->data; ^ 1092. 1093. if (!(avctx->codec->capabilities & CODEC_CAP_DELAY) && !frame) { libavcodec/utils.c:1093:11: Taking false branch 1091. int user_packet = !!avpkt->data; 1092. 1093. if (!(avctx->codec->capabilities & CODEC_CAP_DELAY) && !frame) { ^ 1094. av_init_packet(avpkt); 1095. avpkt->size = 0; libavcodec/utils.c:1100:9: 1098. } 1099. 1100. if (av_image_check_size(avctx->width, avctx->height, 0, avctx)) ^ 1101. return AVERROR(EINVAL); 1102. libavutil/imgutils.c:215:1: start of procedure av_image_check_size() 213. static const AVClass imgutils_class = { "IMGUTILS", av_default_item_name, NULL, LIBAVUTIL_VERSION_INT, offsetof(ImgUtils, log_offset), offsetof(ImgUtils, log_ctx) }; 214. 215. int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx) ^ 216. { 217. ImgUtils imgutils = { &imgutils_class, log_offset, log_ctx }; libavutil/imgutils.c:217:5: 215. int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx) 216. { 217. ImgUtils imgutils = { &imgutils_class, log_offset, log_ctx }; ^ 218. 219. if ((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8) libavutil/imgutils.c:219:9: Taking true branch 217. ImgUtils imgutils = { &imgutils_class, log_offset, log_ctx }; 218. 219. if ((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8) ^ 220. return 0; 221. libavutil/imgutils.c:219:21: Taking true branch 217. ImgUtils imgutils = { &imgutils_class, log_offset, log_ctx }; 218. 219. if ((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8) ^ 220. return 0; 221. libavutil/imgutils.c:219:33: Taking true branch 217. ImgUtils imgutils = { &imgutils_class, log_offset, log_ctx }; 218. 219. if ((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8) ^ 220. return 0; 221. libavutil/imgutils.c:220:9: 218. 219. if ((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8) 220. return 0; ^ 221. 222. av_log(&imgutils, AV_LOG_ERROR, "Picture size %ux%u is invalid\n", w, h); libavutil/imgutils.c:224:1: return from a call to av_image_check_size 222. av_log(&imgutils, AV_LOG_ERROR, "Picture size %ux%u is invalid\n", w, h); 223. return AVERROR(EINVAL); 224. } ^ 225. 226. void av_image_copy_plane(uint8_t *dst, int dst_linesize, libavcodec/utils.c:1100:9: Taking false branch 1098. } 1099. 1100. if (av_image_check_size(avctx->width, avctx->height, 0, avctx)) ^ 1101. return AVERROR(EINVAL); 1102. libavcodec/utils.c:1103:5: Taking false branch 1101. return AVERROR(EINVAL); 1102. 1103. av_assert0(avctx->codec->encode2); ^ 1104. 1105. *got_packet_ptr = 0; libavcodec/utils.c:1103:5: Loop condition is false. Leaving loop 1101. return AVERROR(EINVAL); 1102. 1103. av_assert0(avctx->codec->encode2); ^ 1104. 1105. *got_packet_ptr = 0; libavcodec/utils.c:1105:5: 1103. av_assert0(avctx->codec->encode2); 1104. 1105. *got_packet_ptr = 0; ^ 1106. ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr); 1107. if (!ret) { libavcodec/utils.c:1106:5: Skipping __function_pointer__(): unresolved function pointer 1104. 1105. *got_packet_ptr = 0; 1106. ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr); ^ 1107. if (!ret) { 1108. if (!*got_packet_ptr) libavcodec/utils.c:1107:10: Taking true branch 1105. *got_packet_ptr = 0; 1106. ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr); 1107. if (!ret) { ^ 1108. if (!*got_packet_ptr) 1109. avpkt->size = 0; libavcodec/utils.c:1108:14: Taking false branch 1106. ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr); 1107. if (!ret) { 1108. if (!*got_packet_ptr) ^ 1109. avpkt->size = 0; 1110. else if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) libavcodec/utils.c:1110:20: Taking false branch 1108. if (!*got_packet_ptr) 1109. avpkt->size = 0; 1110. else if (!(avctx->codec->capabilities & CODEC_CAP_DELAY)) ^ 1111. avpkt->pts = avpkt->dts = frame->pts; 1112. } libavcodec/utils.c:1114:10: Taking true branch 1112. } 1113. 1114. if (!ret) ^ 1115. avctx->frame_number++; 1116. libavcodec/utils.c:1115:9: 1113. 1114. if (!ret) 1115. avctx->frame_number++; ^ 1116. 1117. emms_c(); libavcodec/utils.c:1118:5: 1116. 1117. emms_c(); 1118. return ret; ^ 1119. } 1120. libavcodec/utils.c:1119:1: return from a call to avcodec_encode_video2 1117. emms_c(); 1118. return ret; 1119. } ^ 1120. 1121. int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
https://github.com/libav/libav/blob/ba605cef7961ee699c893d1a3b5c9730f0a37b6c/avconv.c/#L1709
d2a_code_trace_data_44879
int ff_rm_retrieve_cache (AVFormatContext *s, AVIOContext *pb, AVStream *st, RMStream *ast, AVPacket *pkt) { RMDemuxContext *rm = s->priv_data; assert (rm->audio_pkt_cnt > 0); if (ast->deint_id == DEINT_ID_VBRF || ast->deint_id == DEINT_ID_VBRS) av_get_packet(pb, pkt, ast->sub_packet_lengths[ast->sub_packet_cnt - rm->audio_pkt_cnt]); else { av_new_packet(pkt, st->codec->block_align); memcpy(pkt->data, ast->pkt.data + st->codec->block_align * (ast->sub_packet_h * ast->audio_framesize / st->codec->block_align - rm->audio_pkt_cnt), st->codec->block_align); } rm->audio_pkt_cnt--; if ((pkt->pts = ast->audiotimestamp) != AV_NOPTS_VALUE) { ast->audiotimestamp = AV_NOPTS_VALUE; pkt->flags = AV_PKT_FLAG_KEY; } else pkt->flags = 0; pkt->stream_index = st->index; return rm->audio_pkt_cnt; } libavformat/rmdec.c:839: error: Null Dereference pointer `pkt->data` last assigned on line 838 could be null and is dereferenced by call to `memcpy()` at line 839, column 9. libavformat/rmdec.c:826:1: start of procedure ff_rm_retrieve_cache() 824. } 825. 826. int ^ 827. ff_rm_retrieve_cache (AVFormatContext *s, AVIOContext *pb, 828. AVStream *st, RMStream *ast, AVPacket *pkt) libavformat/rmdec.c:830:5: 828. AVStream *st, RMStream *ast, AVPacket *pkt) 829. { 830. RMDemuxContext *rm = s->priv_data; ^ 831. 832. assert (rm->audio_pkt_cnt > 0); libavformat/rmdec.c:832:5: 830. RMDemuxContext *rm = s->priv_data; 831. 832. assert (rm->audio_pkt_cnt > 0); ^ 833. 834. if (ast->deint_id == DEINT_ID_VBRF || libavformat/rmdec.c:834:9: Taking false branch 832. assert (rm->audio_pkt_cnt > 0); 833. 834. if (ast->deint_id == DEINT_ID_VBRF || ^ 835. ast->deint_id == DEINT_ID_VBRS) 836. av_get_packet(pb, pkt, ast->sub_packet_lengths[ast->sub_packet_cnt - rm->audio_pkt_cnt]); libavformat/rmdec.c:835:9: Taking false branch 833. 834. if (ast->deint_id == DEINT_ID_VBRF || 835. ast->deint_id == DEINT_ID_VBRS) ^ 836. av_get_packet(pb, pkt, ast->sub_packet_lengths[ast->sub_packet_cnt - rm->audio_pkt_cnt]); 837. else { libavformat/rmdec.c:838:9: 836. av_get_packet(pb, pkt, ast->sub_packet_lengths[ast->sub_packet_cnt - rm->audio_pkt_cnt]); 837. else { 838. av_new_packet(pkt, st->codec->block_align); ^ 839. memcpy(pkt->data, ast->pkt.data + st->codec->block_align * //FIXME avoid this 840. (ast->sub_packet_h * ast->audio_framesize / st->codec->block_align - rm->audio_pkt_cnt), libavcodec/avpacket.c:60:1: start of procedure av_new_packet() 58. } 59. 60. int av_new_packet(AVPacket *pkt, int size) ^ 61. { 62. uint8_t *data= NULL; libavcodec/avpacket.c:62:5: 60. int av_new_packet(AVPacket *pkt, int size) 61. { 62. uint8_t *data= NULL; ^ 63. if((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) 64. data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); libavcodec/avpacket.c:63:8: Taking true branch 61. { 62. uint8_t *data= NULL; 63. if((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) ^ 64. data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); 65. if (data){ libavcodec/avpacket.c:64:9: 62. uint8_t *data= NULL; 63. if((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) 64. data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); ^ 65. if (data){ 66. memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking true branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) ^ 73. return NULL; 74. libavutil/mem.c:73:9: 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) 73. return NULL; ^ 74. 75. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavcodec/avpacket.c:65:9: Taking false branch 63. if((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) 64. data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); 65. if (data){ ^ 66. memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); 67. }else libavcodec/avpacket.c:68:9: 66. memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); 67. }else 68. size=0; ^ 69. 70. av_init_packet(pkt); libavcodec/avpacket.c:70:5: 68. size=0; 69. 70. av_init_packet(pkt); ^ 71. pkt->data = data; 72. pkt->size = size; libavcodec/avpacket.c:46:1: start of procedure av_init_packet() 44. } 45. 46. void av_init_packet(AVPacket *pkt) ^ 47. { 48. pkt->pts = AV_NOPTS_VALUE; libavcodec/avpacket.c:48:5: 46. void av_init_packet(AVPacket *pkt) 47. { 48. pkt->pts = AV_NOPTS_VALUE; ^ 49. pkt->dts = AV_NOPTS_VALUE; 50. pkt->pos = -1; libavcodec/avpacket.c:49:5: 47. { 48. pkt->pts = AV_NOPTS_VALUE; 49. pkt->dts = AV_NOPTS_VALUE; ^ 50. pkt->pos = -1; 51. pkt->duration = 0; libavcodec/avpacket.c:50:5: 48. pkt->pts = AV_NOPTS_VALUE; 49. pkt->dts = AV_NOPTS_VALUE; 50. pkt->pos = -1; ^ 51. pkt->duration = 0; 52. pkt->convergence_duration = 0; libavcodec/avpacket.c:51:5: 49. pkt->dts = AV_NOPTS_VALUE; 50. pkt->pos = -1; 51. pkt->duration = 0; ^ 52. pkt->convergence_duration = 0; 53. pkt->flags = 0; libavcodec/avpacket.c:52:5: 50. pkt->pos = -1; 51. pkt->duration = 0; 52. pkt->convergence_duration = 0; ^ 53. pkt->flags = 0; 54. pkt->stream_index = 0; libavcodec/avpacket.c:53:5: 51. pkt->duration = 0; 52. pkt->convergence_duration = 0; 53. pkt->flags = 0; ^ 54. pkt->stream_index = 0; 55. pkt->destruct= NULL; libavcodec/avpacket.c:54:5: 52. pkt->convergence_duration = 0; 53. pkt->flags = 0; 54. pkt->stream_index = 0; ^ 55. pkt->destruct= NULL; 56. pkt->side_data = NULL; libavcodec/avpacket.c:55:5: 53. pkt->flags = 0; 54. pkt->stream_index = 0; 55. pkt->destruct= NULL; ^ 56. pkt->side_data = NULL; 57. pkt->side_data_elems = 0; libavcodec/avpacket.c:56:5: 54. pkt->stream_index = 0; 55. pkt->destruct= NULL; 56. pkt->side_data = NULL; ^ 57. pkt->side_data_elems = 0; 58. } libavcodec/avpacket.c:57:5: 55. pkt->destruct= NULL; 56. pkt->side_data = NULL; 57. pkt->side_data_elems = 0; ^ 58. } 59. libavcodec/avpacket.c:58:1: return from a call to av_init_packet 56. pkt->side_data = NULL; 57. pkt->side_data_elems = 0; 58. } ^ 59. 60. int av_new_packet(AVPacket *pkt, int size) libavcodec/avpacket.c:71:5: 69. 70. av_init_packet(pkt); 71. pkt->data = data; ^ 72. pkt->size = size; 73. pkt->destruct = av_destruct_packet; libavcodec/avpacket.c:72:5: 70. av_init_packet(pkt); 71. pkt->data = data; 72. pkt->size = size; ^ 73. pkt->destruct = av_destruct_packet; 74. if(!data) libavcodec/avpacket.c:73:5: 71. pkt->data = data; 72. pkt->size = size; 73. pkt->destruct = av_destruct_packet; ^ 74. if(!data) 75. return AVERROR(ENOMEM); libavcodec/avpacket.c:74:9: Taking true branch 72. pkt->size = size; 73. pkt->destruct = av_destruct_packet; 74. if(!data) ^ 75. return AVERROR(ENOMEM); 76. return 0; libavcodec/avpacket.c:75:9: 73. pkt->destruct = av_destruct_packet; 74. if(!data) 75. return AVERROR(ENOMEM); ^ 76. return 0; 77. } libavcodec/avpacket.c:77:1: return from a call to av_new_packet 75. return AVERROR(ENOMEM); 76. return 0; 77. } ^ 78. 79. void av_shrink_packet(AVPacket *pkt, int size) libavformat/rmdec.c:839:9: 837. else { 838. av_new_packet(pkt, st->codec->block_align); 839. memcpy(pkt->data, ast->pkt.data + st->codec->block_align * //FIXME avoid this ^ 840. (ast->sub_packet_h * ast->audio_framesize / st->codec->block_align - rm->audio_pkt_cnt), 841. st->codec->block_align);
https://github.com/libav/libav/blob/2f6528537fdd88820f3a4683d5e595d7b3a62689/libavformat/rmdec.c/#L839
d2a_code_trace_data_44880
int ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str) { ASN1_TIME t; struct tm tm; int rv = 0; t.length = strlen(str); t.data = (unsigned char *)str; t.flags = ASN1_STRING_FLAG_X509_TIME; t.type = V_ASN1_UTCTIME; if (!ASN1_TIME_check(&t)) { t.type = V_ASN1_GENERALIZEDTIME; if (!ASN1_TIME_check(&t)) goto out; } if (s != NULL && t.type == V_ASN1_GENERALIZEDTIME) { if (!asn1_generalizedtime_to_tm(&tm, &t)) goto out; if (tm.tm_year >= 50 && tm.tm_year < 150) { t.length -= 2; t.data = OPENSSL_zalloc(t.length + 1); if (t.data == NULL) goto out; memcpy(t.data, str + 2, t.length); t.type = V_ASN1_UTCTIME; } } if (s == NULL || ASN1_STRING_copy((ASN1_STRING *)s, (ASN1_STRING *)&t)) rv = 1; if (t.data != (unsigned char *)str) OPENSSL_free(t.data); out: return rv; } apps/ca.c:809: error: BUFFER_OVERRUN_L3 Offset added: [-2, +oo] Size: [1, +oo] by call to `ASN1_TIME_set_string_X509`. Showing all 23 steps of the trace apps/ca.c:774:22: Call 772. BIO_printf(bio_err, "policy is %s\n", policy); 773. 774. serialfile = lookup_conf(conf, section, ENV_SERIAL); ^ 775. if (serialfile == NULL) 776. goto end; apps/ca.c:1243:9: Call 1241. char *entry = NCONF_get_string(conf, section, tag); 1242. if (entry == NULL) 1243. BIO_printf(bio_err, "variable lookup failed for %s::%s\n", section, tag); ^ 1244. return entry; 1245. } crypto/bio/b_print.c:856:11: Call 854. va_start(args, format); 855. 856. ret = BIO_vprintf(bio, format, args); ^ 857. 858. va_end(args); crypto/bio/b_print.c:875:10: Call 873. 874. dynbuf = NULL; 875. if (!_dopr(&hugebufp, &dynbuf, &hugebufsize, &retlen, &ignored, format, ^ 876. args)) { 877. OPENSSL_free(dynbuf); 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/ca.c:809:35: Call 807. ERR_clear_error(); 808. } 809. if (startdate != NULL && !ASN1_TIME_set_string_X509(NULL, startdate)) { ^ 810. BIO_printf(bio_err, 811. "start date is invalid, it should be YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ\n"); crypto/asn1/a_time.c:132:1: <Offset trace> 130. } 131. 132. > int ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str) 133. { 134. ASN1_TIME t; crypto/asn1/a_time.c:132:1: Parameter `str->strlen` 130. } 131. 132. > int ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str) 133. { 134. ASN1_TIME t; crypto/asn1/a_time.c:138:5: Assignment 136. int rv = 0; 137. 138. t.length = strlen(str); ^ 139. t.data = (unsigned char *)str; 140. t.flags = ASN1_STRING_FLAG_X509_TIME; crypto/asn1/a_time.c:168:13: Assignment 166. goto out; 167. if (tm.tm_year >= 50 && tm.tm_year < 150) { 168. t.length -= 2; ^ 169. /* 170. * it's OK to let original t.data go since that's assigned crypto/asn1/a_time.c:132:1: <Length trace> 130. } 131. 132. > int ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str) 133. { 134. ASN1_TIME t; crypto/asn1/a_time.c:132:1: Parameter `str->strlen` 130. } 131. 132. > int ASN1_TIME_set_string_X509(ASN1_TIME *s, const char *str) 133. { 134. ASN1_TIME t; crypto/asn1/a_time.c:138:5: Assignment 136. int rv = 0; 137. 138. t.length = strlen(str); ^ 139. t.data = (unsigned char *)str; 140. t.flags = ASN1_STRING_FLAG_X509_TIME; crypto/asn1/a_time.c:168:13: Assignment 166. goto out; 167. if (tm.tm_year >= 50 && tm.tm_year < 150) { 168. t.length -= 2; ^ 169. /* 170. * it's OK to let original t.data go since that's assigned crypto/asn1/a_time.c:174:22: Call 172. * new t.data would be freed after ASN1_STRING_copy is done. 173. */ 174. t.data = OPENSSL_zalloc(t.length + 1); ^ 175. if (t.data == NULL) 176. goto out; 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/asn1/a_time.c:174:13: Assignment 172. * new t.data would be freed after ASN1_STRING_copy is done. 173. */ 174. t.data = OPENSSL_zalloc(t.length + 1); ^ 175. if (t.data == NULL) 176. goto out; crypto/asn1/a_time.c:177:13: Array access: Offset added: [-2, +oo] Size: [1, +oo] by call to `ASN1_TIME_set_string_X509` 175. if (t.data == NULL) 176. goto out; 177. memcpy(t.data, str + 2, t.length); ^ 178. t.type = V_ASN1_UTCTIME; 179. }
https://github.com/openssl/openssl/blob/2234212c3dde887e0b7fa08277d035cd132e2cce/crypto/asn1/a_time.c/#L177
d2a_code_trace_data_44881
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dsa/dsa_key.c:114: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_exp`. Showing all 18 steps of the trace crypto/dsa/dsa_key.c:114:14: Call 112. } 113. 114. if (!BN_mod_exp(pub_key, dsa->g, prk, dsa->p, ctx)) { ^ 115. BN_free(local_prk); 116. goto err; crypto/bn/bn_exp.c:191:1: Parameter `ctx->stack.depth` 189. } 190. 191. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 192. BN_CTX *ctx) 193. { crypto/bn/bn_exp.c:256:15: Call 254. #ifdef RECP_MUL_MOD 255. { 256. ret = BN_mod_exp_recp(r, a, p, m, ctx); ^ 257. } 258. #else crypto/bn/bn_exp.c:268:1: Parameter `ctx->stack.depth` 266. } 267. 268. > int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 269. const BIGNUM *m, BN_CTX *ctx) 270. { crypto/bn/bn_exp.c:291:5: Call 289. } 290. 291. BN_CTX_start(ctx); ^ 292. aa = BN_CTX_get(ctx); 293. val[0] = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_exp.c:310:10: Call 308. } 309. 310. if (!BN_nnmod(val[0], a, m, ctx)) ^ 311. goto err; /* 1 */ 312. if (BN_is_zero(val[0])) { crypto/bn/bn_mod.c:119:1: Parameter `ctx->stack.depth` 117. #include "bn_lcl.h" 118. 119. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 120. { 121. /* crypto/bn/bn_mod.c:126:11: Call 124. */ 125. 126. if (!(BN_mod(r, m, d, ctx))) ^ 127. return 0; 128. if (!r->neg) crypto/bn/bn_div.c:189:1: Parameter `ctx->stack.depth` 187. * If 'dv' or 'rm' is NULL, the respective value is not returned. 188. */ 189. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 190. BN_CTX *ctx) 191. { crypto/bn/bn_div.c:242:5: Call 240. } 241. 242. BN_CTX_start(ctx); ^ 243. tmp = BN_CTX_get(ctx); 244. snum = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:469:5: Call 467. if (no_branch) 468. bn_correct_top(res); 469. BN_CTX_end(ctx); ^ 470. return (1); 471. err: crypto/bn/bn_ctx.c:250:1: Parameter `ctx->stack.depth` 248. } 249. 250. > void BN_CTX_end(BN_CTX *ctx) 251. { 252. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:256:27: Call 254. ctx->err_stack--; 255. else { 256. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 257. /* Does this stack frame have anything to release? */ 258. if (fp < ctx->used) crypto/bn/bn_ctx.c:326:1: <LHS trace> 324. } 325. 326. > static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:326:1: Parameter `st->depth` 324. } 325. 326. > static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:328:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_exp` 326. static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; ^ 329. } 330.
https://github.com/openssl/openssl/blob/e113c9c59dcb419dd00525cec431edb854a6c897/crypto/bn/bn_ctx.c/#L328
d2a_code_trace_data_44882
static int vp3_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; Vp3DecodeContext *s = avctx->priv_data; GetBitContext gb; int i, ret; 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.f->pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; if (ff_thread_get_buffer(avctx, &s->current_frame, AV_GET_BUFFER_FLAG_REF) < 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.f->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.f->data[0]) { av_log(s->avctx, AV_LOG_WARNING, "vp3: first frame not a keyframe\n"); s->golden_frame.f->pict_type = AV_PICTURE_TYPE_I; if (ff_thread_get_buffer(avctx, &s->golden_frame, AV_GET_BUFFER_FLAG_REF) < 0) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); goto error; } ff_thread_release_buffer(avctx, &s->last_frame); if ((ret = ff_thread_ref_frame(&s->last_frame, &s->golden_frame)) < 0) goto error; 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.f->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); if ((ret = av_frame_ref(data, s->current_frame.f)) < 0) return ret; *got_frame = 1; if (!HAVE_THREADS || !(s->avctx->active_thread_type & FF_THREAD_FRAME)) { ret = update_frames(avctx); if (ret < 0) return ret; } 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)) av_frame_unref(s->current_frame.f); return -1; } libavcodec/vp3.c:1998: error: Null Dereference pointer `&gb->buffer` last assigned on line 1990 could be null and is dereferenced by call to `get_bits1()` at line 1998, column 20. libavcodec/vp3.c:1980:1: start of procedure vp3_decode_frame() 1978. } 1979. 1980. static int vp3_decode_frame(AVCodecContext *avctx, ^ 1981. void *data, int *got_frame, 1982. AVPacket *avpkt) libavcodec/vp3.c:1984:5: 1982. AVPacket *avpkt) 1983. { 1984. const uint8_t *buf = avpkt->data; ^ 1985. int buf_size = avpkt->size; 1986. Vp3DecodeContext *s = avctx->priv_data; libavcodec/vp3.c:1985:5: 1983. { 1984. const uint8_t *buf = avpkt->data; 1985. int buf_size = avpkt->size; ^ 1986. Vp3DecodeContext *s = avctx->priv_data; 1987. GetBitContext gb; libavcodec/vp3.c:1986:5: 1984. const uint8_t *buf = avpkt->data; 1985. int buf_size = avpkt->size; 1986. Vp3DecodeContext *s = avctx->priv_data; ^ 1987. GetBitContext gb; 1988. int i, ret; libavcodec/vp3.c:1990:5: 1988. int i, ret; 1989. 1990. init_get_bits(&gb, buf, buf_size * 8); ^ 1991. 1992. if (s->theora && get_bits1(&gb)) { libavcodec/get_bits.h:376:1: start of procedure init_get_bits() 374. * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow. 375. */ 376. static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer, ^ 377. int bit_size) 378. { libavcodec/get_bits.h:380:5: 378. { 379. int buffer_size; 380. int ret = 0; ^ 381. 382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { libavcodec/get_bits.h:382:9: Taking true branch 380. int ret = 0; 381. 382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { ^ 383. bit_size = 0; 384. buffer = NULL; libavcodec/get_bits.h:383:9: 381. 382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { 383. bit_size = 0; ^ 384. buffer = NULL; 385. ret = AVERROR_INVALIDDATA; libavcodec/get_bits.h:384:9: 382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { 383. bit_size = 0; 384. buffer = NULL; ^ 385. ret = AVERROR_INVALIDDATA; 386. } libavcodec/get_bits.h:385:9: 383. bit_size = 0; 384. buffer = NULL; 385. ret = AVERROR_INVALIDDATA; ^ 386. } 387. libavcodec/get_bits.h:388:5: 386. } 387. 388. buffer_size = (bit_size + 7) >> 3; ^ 389. 390. s->buffer = buffer; libavcodec/get_bits.h:390:5: 388. buffer_size = (bit_size + 7) >> 3; 389. 390. s->buffer = buffer; ^ 391. s->size_in_bits = bit_size; 392. #if !UNCHECKED_BITSTREAM_READER libavcodec/get_bits.h:391:5: 389. 390. s->buffer = buffer; 391. s->size_in_bits = bit_size; ^ 392. #if !UNCHECKED_BITSTREAM_READER 393. s->size_in_bits_plus8 = bit_size + 8; libavcodec/get_bits.h:393:5: 391. s->size_in_bits = bit_size; 392. #if !UNCHECKED_BITSTREAM_READER 393. s->size_in_bits_plus8 = bit_size + 8; ^ 394. #endif 395. s->buffer_end = buffer + buffer_size; libavcodec/get_bits.h:395:5: 393. s->size_in_bits_plus8 = bit_size + 8; 394. #endif 395. s->buffer_end = buffer + buffer_size; ^ 396. s->index = 0; 397. libavcodec/get_bits.h:396:5: 394. #endif 395. s->buffer_end = buffer + buffer_size; 396. s->index = 0; ^ 397. 398. return ret; libavcodec/get_bits.h:398:5: 396. s->index = 0; 397. 398. return ret; ^ 399. } 400. libavcodec/get_bits.h:399:1: return from a call to init_get_bits 397. 398. return ret; 399. } ^ 400. 401. /** libavcodec/vp3.c:1992:9: Taking false branch 1990. init_get_bits(&gb, buf, buf_size * 8); 1991. 1992. if (s->theora && get_bits1(&gb)) { ^ 1993. av_log(avctx, AV_LOG_ERROR, 1994. "Header packet passed to frame decoder, skipping\n"); libavcodec/vp3.c:1998:20: 1996. } 1997. 1998. s->keyframe = !get_bits1(&gb); ^ 1999. if (!s->theora) 2000. skip_bits(&gb, 1); libavcodec/get_bits.h:272:1: start of procedure get_bits1() 270. } 271. 272. static inline unsigned int get_bits1(GetBitContext *s) ^ 273. { 274. unsigned int index = s->index; libavcodec/get_bits.h:274:5: 272. static inline unsigned int get_bits1(GetBitContext *s) 273. { 274. unsigned int index = s->index; ^ 275. uint8_t result = s->buffer[index >> 3]; 276. #ifdef BITSTREAM_READER_LE libavcodec/get_bits.h:275:5: 273. { 274. unsigned int index = s->index; 275. uint8_t result = s->buffer[index >> 3]; ^ 276. #ifdef BITSTREAM_READER_LE 277. result >>= index & 7;
https://github.com/libav/libav/blob/77ab341c0c6cdf2bd437bb48d429e797d1e60da2/libavcodec/vp3.c/#L1998
d2a_code_trace_data_44883
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:785: error: INTEGER_OVERFLOW_L2 ([-51, +oo] - 1):unsigned32 by call to `ssl3_cbc_digest_record`. Showing all 5 steps of the trace ssl/s3_enc.c:726:1: Parameter `ssl->s3->rrec.orig_len` 724. } 725. 726. > int n_ssl3_mac(SSL *ssl, unsigned char *md, int send) 727. { 728. SSL3_RECORD *rec; ssl/s3_enc.c:785:3: Call 783. header[j++] = rec->length & 0xff; 784. 785. ssl3_cbc_digest_record( ^ 786. hash, 787. md, &md_size, ssl/s3_cbc.c:476:4: <LHS trace> 474. md_final_raw = tls1_md5_final_raw; 475. md_transform = (void(*)(void *ctx, const unsigned char *block)) MD5_Transform; 476. md_size = 16; ^ 477. sslv3_pad_length = 48; 478. length_is_big_endian = 0; ssl/s3_cbc.c:476:4: Assignment 474. md_final_raw = tls1_md5_final_raw; 475. md_transform = (void(*)(void *ctx, const unsigned char *block)) MD5_Transform; 476. md_size = 16; ^ 477. sslv3_pad_length = 48; 478. length_is_big_endian = 0; ssl/s3_cbc.c:566:2: Binary operation: ([-51, +oo] - 1):unsigned32 by call to `ssl3_cbc_digest_record` 564. /* max_mac_bytes contains the maximum bytes of bytes in the MAC, including 565. * |header|, assuming that there's no padding. */ 566. max_mac_bytes = len - md_size - 1; ^ 567. /* num_blocks is the maximum number of hash blocks. */ 568. num_blocks = (max_mac_bytes + 1 + md_length_size + md_block_size - 1) / md_block_size;
https://github.com/openssl/openssl/blob/f93a41877d8d7a287debb7c63d7b646abaaf269c/ssl/s3_cbc.c/#L566
d2a_code_trace_data_44884
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_blind.c:344: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_inverse`. Showing all 19 steps of the trace crypto/bn/bn_blind.c:306:1: Parameter `ctx->stack.depth` 304. } 305. 306. > BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, 307. const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, 308. int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, crypto/bn/bn_blind.c:344:7: Call 342. do { 343. if (!BN_rand_range(ret->A, ret->mod)) goto err; 344. if (BN_mod_inverse(ret->Ai, ret->A, ret->mod, ctx) == NULL) ^ 345. { 346. /* this should almost never happen for good RSA keys */ crypto/bn/bn_gcd.c:209:1: Parameter `ctx->stack.depth` 207. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); 208. 209. > BIGNUM *BN_mod_inverse(BIGNUM *in, 210. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 211. { crypto/bn/bn_gcd.c:218:10: Call 216. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) 217. { 218. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 219. } 220. crypto/bn/bn_gcd.c:507:1: Parameter `ctx->stack.depth` 505. * It does not contain branches that may leak sensitive information. 506. */ 507. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 508. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 509. { crypto/bn/bn_gcd.c:519:2: Call 517. bn_check_top(n); 518. 519. BN_CTX_start(ctx); ^ 520. A = BN_CTX_get(ctx); 521. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gcd.c:548:8: Call 546. pB = &local_B; 547. BN_with_flags(pB, B, BN_FLG_CONSTTIME); 548. if (!BN_nnmod(B, pB, A, ctx)) goto err; ^ 549. } 550. sign = -1; crypto/bn/bn_mod.c:127:1: Parameter `ctx->stack.depth` 125. 126. 127. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 128. { 129. /* like BN_mod, but returns non-negative remainder crypto/bn/bn_mod.c:132:8: Call 130. * (i.e., 0 <= r < |d| always holds) */ 131. 132. if (!(BN_mod(r,m,d,ctx))) ^ 133. return 0; 134. if (!r->neg) crypto/bn/bn_div.c:181:1: Parameter `ctx->stack.depth` 179. * If 'dv' or 'rm' is NULL, the respective value is not returned. 180. */ 181. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 182. BN_CTX *ctx) 183. { crypto/bn/bn_div.c:226:2: Call 224. } 225. 226. BN_CTX_start(ctx); ^ 227. tmp=BN_CTX_get(ctx); 228. snum=BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:441:2: Call 439. } 440. if (no_branch) bn_correct_top(res); 441. BN_CTX_end(ctx); ^ 442. return(1); 443. err: crypto/bn/bn_ctx.c:270:1: Parameter `ctx->stack.depth` 268. } 269. 270. > void BN_CTX_end(BN_CTX *ctx) 271. { 272. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:277:21: Call 275. else 276. { 277. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 278. /* Does this stack frame have anything to release? */ 279. if(fp < ctx->used) crypto/bn/bn_ctx.c:351:1: <LHS trace> 349. } 350. 351. > static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:351:1: Parameter `st->depth` 349. } 350. 351. > static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:353:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_inverse` 351. static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; ^ 354. } 355.
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/bn/bn_ctx.c/#L353
d2a_code_trace_data_44885
int asn1_time_to_tm(struct tm *tm, const ASN1_TIME *d) { static const int min[9] = { 0, 0, 1, 1, 0, 0, 0, 0, 0 }; static const int max[9] = { 99, 99, 12, 31, 23, 59, 59, 12, 59 }; static const int mdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; char *a; int n, i, i2, l, o, min_l = 11, strict = 0, end = 6, btz = 5, md; struct tm tmp; #if defined(CHARSET_EBCDIC) const char upper_z = 0x5A, num_zero = 0x30, period = 0x2E, minus = 0x2D, plus = 0x2B; #else const char upper_z = 'Z', num_zero = '0', period = '.', minus = '-', plus = '+'; #endif if (d->type == V_ASN1_UTCTIME) { if (d->flags & ASN1_STRING_FLAG_X509_TIME) { min_l = 13; strict = 1; } } else if (d->type == V_ASN1_GENERALIZEDTIME) { end = 7; btz = 6; if (d->flags & ASN1_STRING_FLAG_X509_TIME) { min_l = 15; strict = 1; } else { min_l = 13; } } else { return 0; } l = d->length; a = (char *)d->data; o = 0; memset(&tmp, 0, sizeof(tmp)); if (l < min_l) goto err; for (i = 0; i < end; i++) { if (!strict && (i == btz) && ((a[o] == upper_z) || (a[o] == plus) || (a[o] == minus))) { i++; break; } if (!ascii_isdigit(a[o])) goto err; n = a[o] - num_zero; if (++o == l) goto err; if (!ascii_isdigit(a[o])) goto err; n = (n * 10) + a[o] - num_zero; if (++o == l) goto err; i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i; if ((n < min[i2]) || (n > max[i2])) goto err; switch (i2) { case 0: tmp.tm_year = n * 100 - 1900; break; case 1: if (d->type == V_ASN1_UTCTIME) tmp.tm_year = n < 50 ? n + 100 : n; else tmp.tm_year += n; break; case 2: tmp.tm_mon = n - 1; break; case 3: if (tmp.tm_mon == 1) { md = mdays[1] + leap_year(tmp.tm_year + 1900); } else { md = mdays[tmp.tm_mon]; } if (n > md) goto err; tmp.tm_mday = n; determine_days(&tmp); break; case 4: tmp.tm_hour = n; break; case 5: tmp.tm_min = n; break; case 6: tmp.tm_sec = n; break; } } if (d->type == V_ASN1_GENERALIZEDTIME && a[o] == period) { if (strict) goto err; if (++o == l) goto err; i = o; while ((o < l) && ascii_isdigit(a[o])) o++; if (i == o) goto err; if (o == l) goto err; } if (a[o] == upper_z) { o++; } else if (!strict && ((a[o] == plus) || (a[o] == minus))) { int offsign = a[o] == minus ? 1 : -1; int offset = 0; o++; if (o + 4 != l) goto err; for (i = end; i < end + 2; i++) { if (!ascii_isdigit(a[o])) goto err; n = a[o] - num_zero; o++; if (!ascii_isdigit(a[o])) goto err; n = (n * 10) + a[o] - num_zero; i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i; if ((n < min[i2]) || (n > max[i2])) goto err; if (tm != NULL) { if (i == end) offset = n * 3600; else if (i == end + 1) offset += n * 60; } o++; } if (offset && !OPENSSL_gmtime_adj(&tmp, 0, offset * offsign)) goto err; } else { goto err; } if (o == l) { if (tm != NULL) *tm = tmp; return 1; } err: return 0; } crypto/asn1/a_time.c:238: error: BUFFER_OVERRUN_L2 Offset: [6, 9] Size: 9. Showing all 7 steps of the trace crypto/asn1/a_time.c:80:5: <Offset trace> 78. static const int mdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 79. char *a; 80. int n, i, i2, l, o, min_l = 11, strict = 0, end = 6, btz = 5, md; ^ 81. struct tm tmp; 82. #if defined(CHARSET_EBCDIC) crypto/asn1/a_time.c:80:5: Assignment 78. static const int mdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 79. char *a; 80. int n, i, i2, l, o, min_l = 11, strict = 0, end = 6, btz = 5, md; ^ 81. struct tm tmp; 82. #if defined(CHARSET_EBCDIC) crypto/asn1/a_time.c:237:18: Assignment 235. goto err; 236. n = (n * 10) + a[o] - num_zero; 237. i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i; ^ 238. if ((n < min[i2]) || (n > max[i2])) 239. goto err; crypto/asn1/a_time.c:237:13: Assignment 235. goto err; 236. n = (n * 10) + a[o] - num_zero; 237. i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i; ^ 238. if ((n < min[i2]) || (n > max[i2])) 239. goto err; crypto/asn1/a_time.c:77:5: <Length trace> 75. { 76. static const int min[9] = { 0, 0, 1, 1, 0, 0, 0, 0, 0 }; 77. static const int max[9] = { 99, 99, 12, 31, 23, 59, 59, 12, 59 }; ^ 78. static const int mdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 79. char *a; crypto/asn1/a_time.c:77:5: Array declaration 75. { 76. static const int min[9] = { 0, 0, 1, 1, 0, 0, 0, 0, 0 }; 77. static const int max[9] = { 99, 99, 12, 31, 23, 59, 59, 12, 59 }; ^ 78. static const int mdays[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; 79. char *a; crypto/asn1/a_time.c:238:39: Array access: Offset: [6, 9] Size: 9 236. n = (n * 10) + a[o] - num_zero; 237. i2 = (d->type == V_ASN1_UTCTIME) ? i + 1 : i; 238. if ((n < min[i2]) || (n > max[i2])) ^ 239. goto err; 240. /* if tm is NULL, no need to adjust */
https://github.com/openssl/openssl/blob/d95422761116791966dcd0dd7035b46795482482/crypto/asn1/a_time.c/#L238
d2a_code_trace_data_44886
static int estimate_best_b_count(MpegEncContext *s) { AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id); AVCodecContext *c = avcodec_alloc_context3(NULL); const int scale = s->avctx->brd_scale; int i, j, out_size, p_lambda, b_lambda, lambda2; int64_t best_rd = INT64_MAX; int best_b_count = -1; assert(scale >= 0 && scale <= 3); p_lambda = s->last_lambda_for[AV_PICTURE_TYPE_P]; b_lambda = s->last_lambda_for[AV_PICTURE_TYPE_B]; if (!b_lambda) b_lambda = p_lambda; lambda2 = (b_lambda * b_lambda + (1 << FF_LAMBDA_SHIFT) / 2) >> FF_LAMBDA_SHIFT; c->width = s->width >> scale; c->height = s->height >> scale; c->flags = CODEC_FLAG_QSCALE | CODEC_FLAG_PSNR; c->flags |= s->avctx->flags & CODEC_FLAG_QPEL; c->mb_decision = s->avctx->mb_decision; c->me_cmp = s->avctx->me_cmp; c->mb_cmp = s->avctx->mb_cmp; c->me_sub_cmp = s->avctx->me_sub_cmp; c->pix_fmt = AV_PIX_FMT_YUV420P; c->time_base = s->avctx->time_base; c->max_b_frames = s->max_b_frames; if (avcodec_open2(c, codec, NULL) < 0) return -1; for (i = 0; i < s->max_b_frames + 2; i++) { Picture pre_input, *pre_input_ptr = i ? s->input_picture[i - 1] : s->next_picture_ptr; if (pre_input_ptr && (!i || s->input_picture[i - 1])) { pre_input = *pre_input_ptr; if (!pre_input.shared && i) { pre_input.f->data[0] += INPLACE_OFFSET; pre_input.f->data[1] += INPLACE_OFFSET; pre_input.f->data[2] += INPLACE_OFFSET; } s->dsp.shrink[scale](s->tmp_frames[i]->data[0], s->tmp_frames[i]->linesize[0], pre_input.f->data[0], pre_input.f->linesize[0], c->width, c->height); s->dsp.shrink[scale](s->tmp_frames[i]->data[1], s->tmp_frames[i]->linesize[1], pre_input.f->data[1], pre_input.f->linesize[1], c->width >> 1, c->height >> 1); s->dsp.shrink[scale](s->tmp_frames[i]->data[2], s->tmp_frames[i]->linesize[2], pre_input.f->data[2], pre_input.f->linesize[2], c->width >> 1, c->height >> 1); } } for (j = 0; j < s->max_b_frames + 1; j++) { int64_t rd = 0; if (!s->input_picture[j]) break; c->error[0] = c->error[1] = c->error[2] = 0; s->tmp_frames[0]->pict_type = AV_PICTURE_TYPE_I; s->tmp_frames[0]->quality = 1 * FF_QP2LAMBDA; out_size = encode_frame(c, s->tmp_frames[0]); for (i = 0; i < s->max_b_frames + 1; i++) { int is_p = i % (j + 1) == j || i == s->max_b_frames; s->tmp_frames[i + 1]->pict_type = is_p ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_B; s->tmp_frames[i + 1]->quality = is_p ? p_lambda : b_lambda; out_size = encode_frame(c, s->tmp_frames[i + 1]); rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3); } while (out_size) { out_size = encode_frame(c, NULL); rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3); } rd += c->error[0] + c->error[1] + c->error[2]; if (rd < best_rd) { best_rd = rd; best_b_count = j; } } avcodec_close(c); av_freep(&c); return best_b_count; } libavcodec/mpegvideo_enc.c:1109: error: Null Dereference pointer `c` last assigned on line 1091 could be null and is dereferenced at line 1109, column 5. libavcodec/mpegvideo_enc.c:1088:1: start of procedure estimate_best_b_count() 1086. } 1087. 1088. static int estimate_best_b_count(MpegEncContext *s) ^ 1089. { 1090. AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id); libavcodec/mpegvideo_enc.c:1090:5: 1088. static int estimate_best_b_count(MpegEncContext *s) 1089. { 1090. AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id); ^ 1091. AVCodecContext *c = avcodec_alloc_context3(NULL); 1092. const int scale = s->avctx->brd_scale; libavcodec/utils.c:1752:1: start of procedure avcodec_find_encoder() 1750. } 1751. 1752. AVCodec *avcodec_find_encoder(enum AVCodecID id) ^ 1753. { 1754. return find_encdec(id, 1); libavcodec/utils.c:1754:5: Skipping find_encdec(): empty list of specs 1752. AVCodec *avcodec_find_encoder(enum AVCodecID id) 1753. { 1754. return find_encdec(id, 1); ^ 1755. } 1756. libavcodec/utils.c:1755:1: return from a call to avcodec_find_encoder 1753. { 1754. return find_encdec(id, 1); 1755. } ^ 1756. 1757. AVCodec *avcodec_find_encoder_by_name(const char *name) libavcodec/mpegvideo_enc.c:1091:5: 1089. { 1090. AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id); 1091. AVCodecContext *c = avcodec_alloc_context3(NULL); ^ 1092. const int scale = s->avctx->brd_scale; 1093. int i, j, out_size, p_lambda, b_lambda, lambda2; libavcodec/options.c:124:1: start of procedure avcodec_alloc_context3() 122. } 123. 124. AVCodecContext *avcodec_alloc_context3(const AVCodec *codec) ^ 125. { 126. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); libavcodec/options.c:126:5: 124. AVCodecContext *avcodec_alloc_context3(const AVCodec *codec) 125. { 126. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); ^ 127. 128. if(avctx==NULL) return NULL; libavutil/mem.c:62:1: start of procedure av_malloc() 60. * linker will do it automatically. */ 61. 62. void *av_malloc(size_t size) ^ 63. { 64. void *ptr = NULL; libavutil/mem.c:64:5: 62. void *av_malloc(size_t size) 63. { 64. void *ptr = NULL; ^ 65. #if CONFIG_MEMALIGN_HACK 66. long diff; libavutil/mem.c:70:9: Taking false branch 68. 69. /* let's disallow possibly ambiguous cases */ 70. if (size > (INT_MAX - 32) || !size) ^ 71. return NULL; 72. libavutil/mem.c:70:35: Taking false branch 68. 69. /* let's disallow possibly ambiguous cases */ 70. if (size > (INT_MAX - 32) || !size) ^ 71. return NULL; 72. libavutil/mem.c:81:9: Taking false branch 79. ((char *)ptr)[-1] = diff; 80. #elif HAVE_POSIX_MEMALIGN 81. if (posix_memalign(&ptr, 32, size)) ^ 82. ptr = NULL; 83. #elif HAVE_ALIGNED_MALLOC libavutil/mem.c:114:5: 112. ptr = malloc(size); 113. #endif 114. return ptr; ^ 115. } 116. libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavcodec/options.c:128:8: Taking true branch 126. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); 127. 128. if(avctx==NULL) return NULL; ^ 129. 130. if(avcodec_get_context_defaults3(avctx, codec) < 0){ libavcodec/options.c:128:21: 126. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); 127. 128. if(avctx==NULL) return NULL; ^ 129. 130. if(avcodec_get_context_defaults3(avctx, codec) < 0){ libavcodec/options.c:136:1: return from a call to avcodec_alloc_context3 134. 135. return avctx; 136. } ^ 137. 138. void avcodec_free_context(AVCodecContext **pavctx) libavcodec/mpegvideo_enc.c:1092:5: 1090. AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id); 1091. AVCodecContext *c = avcodec_alloc_context3(NULL); 1092. const int scale = s->avctx->brd_scale; ^ 1093. int i, j, out_size, p_lambda, b_lambda, lambda2; 1094. int64_t best_rd = INT64_MAX; libavcodec/mpegvideo_enc.c:1094:5: 1092. const int scale = s->avctx->brd_scale; 1093. int i, j, out_size, p_lambda, b_lambda, lambda2; 1094. int64_t best_rd = INT64_MAX; ^ 1095. int best_b_count = -1; 1096. libavcodec/mpegvideo_enc.c:1095:5: 1093. int i, j, out_size, p_lambda, b_lambda, lambda2; 1094. int64_t best_rd = INT64_MAX; 1095. int best_b_count = -1; ^ 1096. 1097. assert(scale >= 0 && scale <= 3); libavcodec/mpegvideo_enc.c:1097:5: 1095. int best_b_count = -1; 1096. 1097. assert(scale >= 0 && scale <= 3); ^ 1098. 1099. //emms_c(); libavcodec/mpegvideo_enc.c:1101:5: 1099. //emms_c(); 1100. //s->next_picture_ptr->quality; 1101. p_lambda = s->last_lambda_for[AV_PICTURE_TYPE_P]; ^ 1102. //p_lambda * FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; 1103. b_lambda = s->last_lambda_for[AV_PICTURE_TYPE_B]; libavcodec/mpegvideo_enc.c:1103:5: 1101. p_lambda = s->last_lambda_for[AV_PICTURE_TYPE_P]; 1102. //p_lambda * FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; 1103. b_lambda = s->last_lambda_for[AV_PICTURE_TYPE_B]; ^ 1104. if (!b_lambda) // FIXME we should do this somewhere else 1105. b_lambda = p_lambda; libavcodec/mpegvideo_enc.c:1104:10: Taking false branch 1102. //p_lambda * FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; 1103. b_lambda = s->last_lambda_for[AV_PICTURE_TYPE_B]; 1104. if (!b_lambda) // FIXME we should do this somewhere else ^ 1105. b_lambda = p_lambda; 1106. lambda2 = (b_lambda * b_lambda + (1 << FF_LAMBDA_SHIFT) / 2) >> libavcodec/mpegvideo_enc.c:1106:5: 1104. if (!b_lambda) // FIXME we should do this somewhere else 1105. b_lambda = p_lambda; 1106. lambda2 = (b_lambda * b_lambda + (1 << FF_LAMBDA_SHIFT) / 2) >> ^ 1107. FF_LAMBDA_SHIFT; 1108. libavcodec/mpegvideo_enc.c:1109:5: 1107. FF_LAMBDA_SHIFT; 1108. 1109. c->width = s->width >> scale; ^ 1110. c->height = s->height >> scale; 1111. c->flags = CODEC_FLAG_QSCALE | CODEC_FLAG_PSNR;
https://github.com/libav/libav/blob/641e57230b460bef52c88e61087d97c223910bea/libavcodec/mpegvideo_enc.c/#L1109
d2a_code_trace_data_44887
static int init_context_frame(MpegEncContext *s) { int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y; s->mb_width = (s->width + 15) / 16; s->mb_stride = s->mb_width + 1; s->b8_stride = s->mb_width * 2 + 1; s->b4_stride = s->mb_width * 4 + 1; mb_array_size = s->mb_height * s->mb_stride; mv_table_size = (s->mb_height + 2) * s->mb_stride + 1; s->h_edge_pos = s->mb_width * 16; s->v_edge_pos = s->mb_height * 16; s->mb_num = s->mb_width * s->mb_height; s->block_wrap[0] = s->block_wrap[1] = s->block_wrap[2] = s->block_wrap[3] = s->b8_stride; s->block_wrap[4] = s->block_wrap[5] = s->mb_stride; y_size = s->b8_stride * (2 * s->mb_height + 1); c_size = s->mb_stride * (s->mb_height + 1); yc_size = y_size + 2 * c_size; FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int), fail); for (y = 0; y < s->mb_height; y++) for (x = 0; x < s->mb_width; x++) s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride; s->mb_index2xy[s->mb_height * s->mb_width] = (s->mb_height - 1) * s->mb_stride + s->mb_width; if (s->encoding) { FF_ALLOCZ_OR_GOTO(s->avctx, s->p_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->b_forw_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->b_back_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_forw_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_back_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->b_direct_mv_table_base, mv_table_size * 2 * sizeof(int16_t), fail); s->p_mv_table = s->p_mv_table_base + s->mb_stride + 1; s->b_forw_mv_table = s->b_forw_mv_table_base + s->mb_stride + 1; s->b_back_mv_table = s->b_back_mv_table_base + s->mb_stride + 1; s->b_bidir_forw_mv_table = s->b_bidir_forw_mv_table_base + s->mb_stride + 1; s->b_bidir_back_mv_table = s->b_bidir_back_mv_table_base + s->mb_stride + 1; s->b_direct_mv_table = s->b_direct_mv_table_base + s->mb_stride + 1; FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_type, mb_array_size * sizeof(uint16_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->lambda_table, mb_array_size * sizeof(int), fail); FF_ALLOC_OR_GOTO(s->avctx, s->cplx_tab, mb_array_size * sizeof(float), fail); FF_ALLOC_OR_GOTO(s->avctx, s->bits_tab, mb_array_size * sizeof(float), fail); } if (s->codec_id == AV_CODEC_ID_MPEG4 || (s->flags & CODEC_FLAG_INTERLACED_ME)) { for (i = 0; i < 2; i++) { int j, k; for (j = 0; j < 2; j++) { for (k = 0; k < 2; k++) { FF_ALLOCZ_OR_GOTO(s->avctx, s->b_field_mv_table_base[i][j][k], mv_table_size * 2 * sizeof(int16_t), fail); s->b_field_mv_table[i][j][k] = s->b_field_mv_table_base[i][j][k] + s->mb_stride + 1; } FF_ALLOCZ_OR_GOTO(s->avctx, s->b_field_select_table [i][j], mb_array_size * 2 * sizeof(uint8_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_mv_table_base[i][j], mv_table_size * 2 * sizeof(int16_t), fail); s->p_field_mv_table[i][j] = s->p_field_mv_table_base[i][j] + s->mb_stride + 1; } FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_select_table[i], mb_array_size * 2 * sizeof(uint8_t), fail); } } if (s->out_format == FMT_H263) { FF_ALLOCZ_OR_GOTO(s->avctx, s->coded_block_base, y_size, fail); s->coded_block = s->coded_block_base + s->b8_stride + 1; FF_ALLOCZ_OR_GOTO(s->avctx, s->cbp_table, mb_array_size * sizeof(uint8_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->pred_dir_table, mb_array_size * sizeof(uint8_t), fail); } if (s->h263_pred || s->h263_plus || !s->encoding) { FF_ALLOCZ_OR_GOTO(s->avctx, s->dc_val_base, yc_size * sizeof(int16_t), fail); s->dc_val[0] = s->dc_val_base + s->b8_stride + 1; s->dc_val[1] = s->dc_val_base + y_size + s->mb_stride + 1; s->dc_val[2] = s->dc_val[1] + c_size; for (i = 0; i < yc_size; i++) s->dc_val_base[i] = 1024; } FF_ALLOCZ_OR_GOTO(s->avctx, s->mbintra_table, mb_array_size, fail); memset(s->mbintra_table, 1, mb_array_size); FF_ALLOCZ_OR_GOTO(s->avctx, s->mbskip_table, mb_array_size + 2, fail); return init_er(s); fail: return AVERROR(ENOMEM); } libavcodec/mpegvideo.c:1080: error: Null Dereference pointer `s->mb_index2xy` last assigned on line 1074 could be null and is dereferenced at line 1080, column 5. libavcodec/mpegvideo.c:1045:1: start of procedure init_context_frame() 1043. * Initialize and allocates MpegEncContext fields dependent on the resolution. 1044. */ 1045. static int init_context_frame(MpegEncContext *s) ^ 1046. { 1047. int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y; libavcodec/mpegvideo.c:1049:5: 1047. int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y; 1048. 1049. s->mb_width = (s->width + 15) / 16; ^ 1050. s->mb_stride = s->mb_width + 1; 1051. s->b8_stride = s->mb_width * 2 + 1; libavcodec/mpegvideo.c:1050:5: 1048. 1049. s->mb_width = (s->width + 15) / 16; 1050. s->mb_stride = s->mb_width + 1; ^ 1051. s->b8_stride = s->mb_width * 2 + 1; 1052. s->b4_stride = s->mb_width * 4 + 1; libavcodec/mpegvideo.c:1051:5: 1049. s->mb_width = (s->width + 15) / 16; 1050. s->mb_stride = s->mb_width + 1; 1051. s->b8_stride = s->mb_width * 2 + 1; ^ 1052. s->b4_stride = s->mb_width * 4 + 1; 1053. mb_array_size = s->mb_height * s->mb_stride; libavcodec/mpegvideo.c:1052:5: 1050. s->mb_stride = s->mb_width + 1; 1051. s->b8_stride = s->mb_width * 2 + 1; 1052. s->b4_stride = s->mb_width * 4 + 1; ^ 1053. mb_array_size = s->mb_height * s->mb_stride; 1054. mv_table_size = (s->mb_height + 2) * s->mb_stride + 1; libavcodec/mpegvideo.c:1053:5: 1051. s->b8_stride = s->mb_width * 2 + 1; 1052. s->b4_stride = s->mb_width * 4 + 1; 1053. mb_array_size = s->mb_height * s->mb_stride; ^ 1054. mv_table_size = (s->mb_height + 2) * s->mb_stride + 1; 1055. libavcodec/mpegvideo.c:1054:5: 1052. s->b4_stride = s->mb_width * 4 + 1; 1053. mb_array_size = s->mb_height * s->mb_stride; 1054. mv_table_size = (s->mb_height + 2) * s->mb_stride + 1; ^ 1055. 1056. /* set default edge pos, will be overriden libavcodec/mpegvideo.c:1058:5: 1056. /* set default edge pos, will be overriden 1057. * in decode_header if needed */ 1058. s->h_edge_pos = s->mb_width * 16; ^ 1059. s->v_edge_pos = s->mb_height * 16; 1060. libavcodec/mpegvideo.c:1059:5: 1057. * in decode_header if needed */ 1058. s->h_edge_pos = s->mb_width * 16; 1059. s->v_edge_pos = s->mb_height * 16; ^ 1060. 1061. s->mb_num = s->mb_width * s->mb_height; libavcodec/mpegvideo.c:1061:5: 1059. s->v_edge_pos = s->mb_height * 16; 1060. 1061. s->mb_num = s->mb_width * s->mb_height; ^ 1062. 1063. s->block_wrap[0] = libavcodec/mpegvideo.c:1063:5: 1061. s->mb_num = s->mb_width * s->mb_height; 1062. 1063. s->block_wrap[0] = ^ 1064. s->block_wrap[1] = 1065. s->block_wrap[2] = libavcodec/mpegvideo.c:1067:5: 1065. s->block_wrap[2] = 1066. s->block_wrap[3] = s->b8_stride; 1067. s->block_wrap[4] = ^ 1068. s->block_wrap[5] = s->mb_stride; 1069. libavcodec/mpegvideo.c:1070:5: 1068. s->block_wrap[5] = s->mb_stride; 1069. 1070. y_size = s->b8_stride * (2 * s->mb_height + 1); ^ 1071. c_size = s->mb_stride * (s->mb_height + 1); 1072. yc_size = y_size + 2 * c_size; libavcodec/mpegvideo.c:1071:5: 1069. 1070. y_size = s->b8_stride * (2 * s->mb_height + 1); 1071. c_size = s->mb_stride * (s->mb_height + 1); ^ 1072. yc_size = y_size + 2 * c_size; 1073. libavcodec/mpegvideo.c:1072:5: 1070. y_size = s->b8_stride * (2 * s->mb_height + 1); 1071. c_size = s->mb_stride * (s->mb_height + 1); 1072. yc_size = y_size + 2 * c_size; ^ 1073. 1074. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int), libavcodec/mpegvideo.c:1074:5: 1072. yc_size = y_size + 2 * c_size; 1073. 1074. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int), ^ 1075. fail); // error ressilience code looks cleaner with this 1076. for (y = 0; y < s->mb_height; y++) libavutil/mem.c:205:1: start of procedure av_mallocz() 203. } 204. 205. void *av_mallocz(size_t size) ^ 206. { 207. void *ptr = av_malloc(size); libavutil/mem.c:207:5: 205. void *av_mallocz(size_t size) 206. { 207. void *ptr = av_malloc(size); ^ 208. if (ptr) 209. memset(ptr, 0, size); libavutil/mem.c:62:1: start of procedure av_malloc() 60. * linker will do it automatically. */ 61. 62. void *av_malloc(size_t size) ^ 63. { 64. void *ptr = NULL; libavutil/mem.c:64:5: 62. void *av_malloc(size_t size) 63. { 64. void *ptr = NULL; ^ 65. #if CONFIG_MEMALIGN_HACK 66. long diff; libavutil/mem.c:70:9: Taking true branch 68. 69. /* let's disallow possibly ambiguous cases */ 70. if (size > (INT_MAX - 32) || !size) ^ 71. return NULL; 72. libavutil/mem.c:71:9: 69. /* let's disallow possibly ambiguous cases */ 70. if (size > (INT_MAX - 32) || !size) 71. return NULL; ^ 72. 73. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavutil/mem.c:208:9: Taking false branch 206. { 207. void *ptr = av_malloc(size); 208. if (ptr) ^ 209. memset(ptr, 0, size); 210. return ptr; libavutil/mem.c:210:5: 208. if (ptr) 209. memset(ptr, 0, size); 210. return ptr; ^ 211. } 212. libavutil/mem.c:211:1: return from a call to av_mallocz 209. memset(ptr, 0, size); 210. return ptr; 211. } ^ 212. 213. char *av_strdup(const char *s) libavcodec/mpegvideo.c:1074:5: Taking true branch 1072. yc_size = y_size + 2 * c_size; 1073. 1074. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int), ^ 1075. fail); // error ressilience code looks cleaner with this 1076. for (y = 0; y < s->mb_height; y++) libavcodec/mpegvideo.c:1074:5: Taking false branch 1072. yc_size = y_size + 2 * c_size; 1073. 1074. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int), ^ 1075. fail); // error ressilience code looks cleaner with this 1076. for (y = 0; y < s->mb_height; y++) libavcodec/mpegvideo.c:1076:10: 1074. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int), 1075. fail); // error ressilience code looks cleaner with this 1076. for (y = 0; y < s->mb_height; y++) ^ 1077. for (x = 0; x < s->mb_width; x++) 1078. s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride; libavcodec/mpegvideo.c:1076:17: Loop condition is false. Leaving loop 1074. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int), 1075. fail); // error ressilience code looks cleaner with this 1076. for (y = 0; y < s->mb_height; y++) ^ 1077. for (x = 0; x < s->mb_width; x++) 1078. s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride; libavcodec/mpegvideo.c:1080:5: 1078. s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride; 1079. 1080. s->mb_index2xy[s->mb_height * s->mb_width] = ^ 1081. (s->mb_height - 1) * s->mb_stride + s->mb_width; // FIXME really needed? 1082.
https://github.com/libav/libav/blob/fffca3d278c2a2422c2f61f21c5a9d5f690d328e/libavcodec/mpegvideo.c/#L1080
d2a_code_trace_data_44888
static void do_video_stats(AVFormatContext *os, AVOutputStream *ost, int frame_size) { AVCodecContext *enc; int frame_number; double ti1, bitrate, avg_bitrate; if (!vstats_file) { vstats_file = fopen(vstats_filename, "w"); if (!vstats_file) { perror("fopen"); ffmpeg_exit(1); } } enc = ost->st->codec; if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { frame_number = ost->frame_number; fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA); if (enc->flags&CODEC_FLAG_PSNR) fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0]/(enc->width*enc->height*255.0*255.0))); fprintf(vstats_file,"f_size= %6d ", frame_size); ti1 = ost->sync_opts * av_q2d(enc->time_base); if (ti1 < 0.01) ti1 = 0.01; bitrate = (frame_size * 8) / av_q2d(enc->time_base) / 1000.0; avg_bitrate = (double)(video_size * 8) / ti1 / 1000.0; fprintf(vstats_file, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ", (double)video_size / 1024, ti1, bitrate, avg_bitrate); fprintf(vstats_file,"type= %c\n", av_get_pict_type_char(enc->coded_frame->pict_type)); } } ffmpeg.c:1316: error: Null Dereference pointer `vstats_file` last assigned on line 1306 could be null and is dereferenced by call to `fprintf()` at line 1316, column 9. ffmpeg.c:1297:1: start of procedure do_video_stats() 1295. } 1296. 1297. static void do_video_stats(AVFormatContext *os, AVOutputStream *ost, ^ 1298. int frame_size) 1299. { ffmpeg.c:1305:10: Taking true branch 1303. 1304. /* this is executed just the first time do_video_stats is called */ 1305. if (!vstats_file) { ^ 1306. vstats_file = fopen(vstats_filename, "w"); 1307. if (!vstats_file) { ffmpeg.c:1306:9: 1304. /* this is executed just the first time do_video_stats is called */ 1305. if (!vstats_file) { 1306. vstats_file = fopen(vstats_filename, "w"); ^ 1307. if (!vstats_file) { 1308. perror("fopen"); ffmpeg.c:1307:14: Taking true branch 1305. if (!vstats_file) { 1306. vstats_file = fopen(vstats_filename, "w"); 1307. if (!vstats_file) { ^ 1308. perror("fopen"); 1309. ffmpeg_exit(1); ffmpeg.c:1308:13: 1306. vstats_file = fopen(vstats_filename, "w"); 1307. if (!vstats_file) { 1308. perror("fopen"); ^ 1309. ffmpeg_exit(1); 1310. } ffmpeg.c:1309:13: Skipping ffmpeg_exit(): empty list of specs 1307. if (!vstats_file) { 1308. perror("fopen"); 1309. ffmpeg_exit(1); ^ 1310. } 1311. } ffmpeg.c:1313:5: 1311. } 1312. 1313. enc = ost->st->codec; ^ 1314. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { 1315. frame_number = ost->frame_number; ffmpeg.c:1314:9: Taking true branch 1312. 1313. enc = ost->st->codec; 1314. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { ^ 1315. frame_number = ost->frame_number; 1316. fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA); ffmpeg.c:1315:9: 1313. enc = ost->st->codec; 1314. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { 1315. frame_number = ost->frame_number; ^ 1316. fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA); 1317. if (enc->flags&CODEC_FLAG_PSNR) ffmpeg.c:1316:9: 1314. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { 1315. frame_number = ost->frame_number; 1316. fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA); ^ 1317. if (enc->flags&CODEC_FLAG_PSNR) 1318. fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0]/(enc->width*enc->height*255.0*255.0)));
https://github.com/libav/libav/blob/2d777bb7a20041ac0564ffef85bf40619af8ccd1/ffmpeg.c/#L1316
d2a_code_trace_data_44889
void *lh_delete(LHASH *lh, const void *data) { unsigned long hash; LHASH_NODE *nn,**rn; void *ret; lh->error=0; rn=getrn(lh,data,&hash); if (*rn == NULL) { lh->num_no_delete++; return(NULL); } else { nn= *rn; *rn=nn->next; ret=nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes))) contract(lh); return(ret); } ssl/s3_clnt.c:277: error: INTEGER_OVERFLOW_L2 ([0, `s->ctx->sessions->num_items`] - 1):unsigned64 by call to `ssl3_get_server_hello`. Showing all 15 steps of the trace ssl/s3_clnt.c:180:1: Parameter `s->ctx->sessions->num_items` 178. ssl3_get_client_method) 179. 180. > int ssl3_connect(SSL *s) 181. { 182. BUF_MEM *buf=NULL; ssl/s3_clnt.c:277:8: Call 275. case SSL3_ST_CR_SRVR_HELLO_A: 276. case SSL3_ST_CR_SRVR_HELLO_B: 277. ret=ssl3_get_server_hello(s); ^ 278. if (ret <= 0) goto end; 279. ssl/s3_clnt.c:658:1: Parameter `s->ctx->sessions->num_items` 656. } 657. 658. > int ssl3_get_server_hello(SSL *s) 659. { 660. STACK_OF(SSL_CIPHER) *sk; ssl/s3_clnt.c:834:7: Call 832. goto f_err; 833. } 834. if (ssl_check_serverhello_tlsext(s) <= 0) ^ 835. { 836. SSLerr(SSL_F_SSL3_CONNECT,SSL_R_SERVERHELLO_TLSEXT); ssl/t1_lib.c:795:1: Parameter `s->ctx->sessions->num_items` 793. } 794. 795. > int ssl_check_serverhello_tlsext(SSL *s) 796. { 797. int ret=SSL_TLSEXT_ERR_NOACK; ssl/t1_lib.c:844:4: Call 842. { 843. case SSL_TLSEXT_ERR_ALERT_FATAL: 844. ssl3_send_alert(s,SSL3_AL_FATAL,al); ^ 845. return -1; 846. ssl/s3_pkt.c:1317:1: Parameter `s->ctx->sessions->num_items` 1315. } 1316. 1317. > void ssl3_send_alert(SSL *s, int level, int desc) 1318. { 1319. /* Map tls/ssl alert value to correct one */ ssl/s3_pkt.c:1326:3: Call 1324. /* If a fatal one, remove from cache */ 1325. if ((level == 2) && (s->session != NULL)) 1326. SSL_CTX_remove_session(s->ctx,s->session); ^ 1327. 1328. s->s3->alert_dispatch=1; ssl/ssl_sess.c:614:1: Parameter `ctx->sessions->num_items` 612. } 613. 614. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 615. { 616. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:616:9: Call 614. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 615. { 616. return remove_session_lock(ctx, c, 1); ^ 617. } 618. ssl/ssl_sess.c:619:1: Parameter `ctx->sessions->num_items` 617. } 618. 619. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 620. { 621. SSL_SESSION *r; ssl/ssl_sess.c:630:21: Call 628. { 629. ret=1; 630. r=(SSL_SESSION *)lh_delete(ctx->sessions,c); ^ 631. SSL_SESSION_list_remove(ctx,c); 632. } crypto/lhash/lhash.c:217:1: <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_get_server_hello` 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/02756aa8ba36af6e718d7a07c4e6bd8ad12e7ba1/crypto/lhash/lhash.c/#L240
d2a_code_trace_data_44890
static void BN_POOL_release(BN_POOL *p, unsigned int num) { unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE; p->used -= num; while (num--) { bn_check_top(p->current->vals + offset); if (offset == 0) { offset = BN_CTX_POOL_SIZE - 1; p->current = p->current->prev; } else offset--; } } crypto/rsa/rsa_sp800_56b_check.c:63: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_mul`. Showing all 19 steps of the trace crypto/rsa/rsa_sp800_56b_check.c:60:14: Call 58. && BN_is_one(r) 59. /* (e) 1 = (dQ . e) mod (q - 1) */ 60. && BN_mod_mul(r, rsa->dmq1, rsa->e, q1, ctx) ^ 61. && BN_is_one(r) 62. /* (f) 1 = (qInv . q) mod p */ crypto/bn/bn_mod.c:218:5: Call 216. ret = 1; 217. err: 218. BN_CTX_end(ctx); ^ 219. return ret; 220. } crypto/bn/bn_ctx.c:185:1: Parameter `ctx->pool.used` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/rsa/rsa_sp800_56b_check.c:63:14: Call 61. && BN_is_one(r) 62. /* (f) 1 = (qInv . q) mod p */ 63. && BN_mod_mul(r, rsa->iqmp, rsa->q, rsa->p, ctx) ^ 64. && BN_is_one(r); 65. BN_clear(p1); crypto/bn/bn_mod.c:193:1: Parameter `ctx->pool.used` 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: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->pool.used` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_mod.c:207:14: Call 205. goto err; 206. if (a == b) { 207. if (!BN_sqr(t, a, ctx)) ^ 208. goto err; 209. } else { crypto/bn/bn_sqr.c:17:1: Parameter `ctx->pool.used` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int ret = bn_sqr_fixed_top(r, a, ctx); crypto/bn/bn_sqr.c:19:15: Call 17. int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int ret = bn_sqr_fixed_top(r, a, ctx); ^ 20. 21. bn_correct_top(r); crypto/bn/bn_sqr.c:27:1: Parameter `ctx->pool.used` 25. } 26. 27. > int bn_sqr_fixed_top(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 28. { 29. int max, al; crypto/bn/bn_sqr.c:44:11: Call 42. BN_CTX_start(ctx); 43. rr = (a != r) ? r : BN_CTX_get(ctx); 44. tmp = BN_CTX_get(ctx); ^ 45. if (rr == NULL || tmp == NULL) 46. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->pool.used` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_sqr.c:104:5: Call 102. bn_check_top(rr); 103. bn_check_top(tmp); 104. BN_CTX_end(ctx); ^ 105. return ret; 106. } crypto/bn/bn_ctx.c:185:1: Parameter `ctx->pool.used` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:194:13: Call 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) 194. BN_POOL_release(&ctx->pool, ctx->used - fp); ^ 195. ctx->used = fp; 196. /* Unjam "too_many" in case "get" had failed */ crypto/bn/bn_ctx.c:338:1: <LHS trace> 336. } 337. 338. > static void BN_POOL_release(BN_POOL *p, unsigned int num) 339. { 340. unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE; crypto/bn/bn_ctx.c:338:1: Parameter `p->used` 336. } 337. 338. > static void BN_POOL_release(BN_POOL *p, unsigned int num) 339. { 340. unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE; crypto/bn/bn_ctx.c:340:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_mul` 338. static void BN_POOL_release(BN_POOL *p, unsigned int num) 339. { 340. unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE; ^ 341. 342. p->used -= num;
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_ctx.c/#L340
d2a_code_trace_data_44891
int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, size_t num, const EC_POINT *points[], const BIGNUM *scalars[], BN_CTX *ctx) { const EC_POINT *generator = NULL; EC_POINT *tmp = NULL; size_t totalnum; size_t blocksize = 0, numblocks = 0; size_t pre_points_per_block = 0; size_t i, j; int k; int r_is_inverted = 0; int r_is_at_infinity = 1; size_t *wsize = NULL; signed char **wNAF = NULL; size_t *wNAF_len = NULL; size_t max_len = 0; size_t num_val; EC_POINT **val = NULL; EC_POINT **v; EC_POINT ***val_sub = NULL; const EC_PRE_COMP *pre_comp = NULL; int num_scalar = 0; int ret = 0; if (!BN_is_zero(group->order) && !BN_is_zero(group->cofactor)) { if ((scalar != group->order) && (scalar != NULL) && (num == 0)) { return ec_scalar_mul_ladder(group, r, scalar, NULL, ctx); } if ((scalar == NULL) && (num == 1) && (scalars[0] != group->order)) { return ec_scalar_mul_ladder(group, r, scalars[0], points[0], ctx); } } if (scalar != NULL) { generator = EC_GROUP_get0_generator(group); if (generator == NULL) { ECerr(EC_F_EC_WNAF_MUL, EC_R_UNDEFINED_GENERATOR); goto err; } pre_comp = group->pre_comp.ec; if (pre_comp && pre_comp->numblocks && (EC_POINT_cmp(group, generator, pre_comp->points[0], ctx) == 0)) { blocksize = pre_comp->blocksize; numblocks = (BN_num_bits(scalar) / blocksize) + 1; if (numblocks > pre_comp->numblocks) numblocks = pre_comp->numblocks; pre_points_per_block = (size_t)1 << (pre_comp->w - 1); if (pre_comp->num != (pre_comp->numblocks * pre_points_per_block)) { ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR); goto err; } } else { pre_comp = NULL; numblocks = 1; num_scalar = 1; } } totalnum = num + numblocks; wsize = OPENSSL_malloc(totalnum * sizeof(wsize[0])); wNAF_len = OPENSSL_malloc(totalnum * sizeof(wNAF_len[0])); wNAF = OPENSSL_malloc((totalnum + 1) * sizeof(wNAF[0])); val_sub = OPENSSL_malloc(totalnum * sizeof(val_sub[0])); if (wNAF != NULL) wNAF[0] = NULL; if (wsize == NULL || wNAF_len == NULL || wNAF == NULL || val_sub == NULL) { ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE); goto err; } num_val = 0; for (i = 0; i < num + num_scalar; i++) { size_t bits; bits = i < num ? BN_num_bits(scalars[i]) : BN_num_bits(scalar); wsize[i] = EC_window_bits_for_scalar_size(bits); num_val += (size_t)1 << (wsize[i] - 1); wNAF[i + 1] = NULL; wNAF[i] = bn_compute_wNAF((i < num ? scalars[i] : scalar), wsize[i], &wNAF_len[i]); if (wNAF[i] == NULL) goto err; if (wNAF_len[i] > max_len) max_len = wNAF_len[i]; } if (numblocks) { if (pre_comp == NULL) { if (num_scalar != 1) { ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR); goto err; } } else { signed char *tmp_wNAF = NULL; size_t tmp_len = 0; if (num_scalar != 0) { ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR); goto err; } wsize[num] = pre_comp->w; tmp_wNAF = bn_compute_wNAF(scalar, wsize[num], &tmp_len); if (!tmp_wNAF) goto err; if (tmp_len <= max_len) { numblocks = 1; totalnum = num + 1; wNAF[num] = tmp_wNAF; wNAF[num + 1] = NULL; wNAF_len[num] = tmp_len; val_sub[num] = pre_comp->points; } else { signed char *pp; EC_POINT **tmp_points; if (tmp_len < numblocks * blocksize) { numblocks = (tmp_len + blocksize - 1) / blocksize; if (numblocks > pre_comp->numblocks) { ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR); OPENSSL_free(tmp_wNAF); goto err; } totalnum = num + numblocks; } pp = tmp_wNAF; tmp_points = pre_comp->points; for (i = num; i < totalnum; i++) { if (i < totalnum - 1) { wNAF_len[i] = blocksize; if (tmp_len < blocksize) { ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR); OPENSSL_free(tmp_wNAF); goto err; } tmp_len -= blocksize; } else wNAF_len[i] = tmp_len; wNAF[i + 1] = NULL; wNAF[i] = OPENSSL_malloc(wNAF_len[i]); if (wNAF[i] == NULL) { ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE); OPENSSL_free(tmp_wNAF); goto err; } memcpy(wNAF[i], pp, wNAF_len[i]); if (wNAF_len[i] > max_len) max_len = wNAF_len[i]; if (*tmp_points == NULL) { ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR); OPENSSL_free(tmp_wNAF); goto err; } val_sub[i] = tmp_points; tmp_points += pre_points_per_block; pp += blocksize; } OPENSSL_free(tmp_wNAF); } } } val = OPENSSL_malloc((num_val + 1) * sizeof(val[0])); if (val == NULL) { ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE); goto err; } val[num_val] = NULL; v = val; for (i = 0; i < num + num_scalar; i++) { val_sub[i] = v; for (j = 0; j < ((size_t)1 << (wsize[i] - 1)); j++) { *v = EC_POINT_new(group); if (*v == NULL) goto err; v++; } } if (!(v == val + num_val)) { ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR); goto err; } if ((tmp = EC_POINT_new(group)) == NULL) goto err; for (i = 0; i < num + num_scalar; i++) { if (i < num) { if (!EC_POINT_copy(val_sub[i][0], points[i])) goto err; } else { if (!EC_POINT_copy(val_sub[i][0], generator)) goto err; } if (wsize[i] > 1) { if (!EC_POINT_dbl(group, tmp, val_sub[i][0], ctx)) goto err; for (j = 1; j < ((size_t)1 << (wsize[i] - 1)); j++) { if (!EC_POINT_add (group, val_sub[i][j], val_sub[i][j - 1], tmp, ctx)) goto err; } } } if (!EC_POINTs_make_affine(group, num_val, val, ctx)) goto err; r_is_at_infinity = 1; for (k = max_len - 1; k >= 0; k--) { if (!r_is_at_infinity) { if (!EC_POINT_dbl(group, r, r, ctx)) goto err; } for (i = 0; i < totalnum; i++) { if (wNAF_len[i] > (size_t)k) { int digit = wNAF[i][k]; int is_neg; if (digit) { is_neg = digit < 0; if (is_neg) digit = -digit; if (is_neg != r_is_inverted) { if (!r_is_at_infinity) { if (!EC_POINT_invert(group, r, ctx)) goto err; } r_is_inverted = !r_is_inverted; } if (r_is_at_infinity) { if (!EC_POINT_copy(r, val_sub[i][digit >> 1])) goto err; r_is_at_infinity = 0; } else { if (!EC_POINT_add (group, r, r, val_sub[i][digit >> 1], ctx)) goto err; } } } } } if (r_is_at_infinity) { if (!EC_POINT_set_to_infinity(group, r)) goto err; } else { if (r_is_inverted) if (!EC_POINT_invert(group, r, ctx)) goto err; } ret = 1; err: EC_POINT_free(tmp); OPENSSL_free(wsize); OPENSSL_free(wNAF_len); if (wNAF != NULL) { signed char **w; for (w = wNAF; *w != NULL; w++) OPENSSL_free(*w); OPENSSL_free(wNAF); } if (val != NULL) { for (v = val; *v != NULL; v++) EC_POINT_clear_free(*v); OPENSSL_free(val); } OPENSSL_free(val_sub); return ret; } test/ectest.c:1140: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `EC_GROUP_check`. Showing all 10 steps of the trace test/ectest.c:1140:10: Call 1138. return 0; 1139. } 1140. if (!TEST_true(EC_GROUP_check(group, NULL))) { ^ 1141. TEST_info("EC_GROUP_check() failed with curve %s\n", OBJ_nid2sn(nid)); 1142. EC_GROUP_free(group); crypto/ec/ec_check.c:23:1: Parameter `group->pre_comp.ec->w` 21. } 22. 23. > int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx) 24. { 25. #ifdef FIPS_MODE crypto/ec/ec_check.c:81:10: Call 79. } 80. 81. if (!EC_POINT_mul(group, point, order, NULL, NULL, ctx)) ^ 82. goto err; 83. if (!EC_POINT_is_at_infinity(group, point)) { crypto/ec/ec_lib.c:971:1: Parameter `group->pre_comp.ec->w` 969. } 970. 971. > int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, 972. const EC_POINT *point, const BIGNUM *p_scalar, BN_CTX *ctx) 973. { crypto/ec/ec_lib.c:982:12: Call 980. scalars[0] = p_scalar; 981. 982. return EC_POINTs_mul(group, r, g_scalar, ^ 983. (point != NULL 984. && p_scalar != NULL), points, scalars, ctx); crypto/ec/ec_lib.c:933:1: Parameter `group->pre_comp.ec->w` 931. */ 932. 933. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 934. size_t num, const EC_POINT *points[], 935. const BIGNUM *scalars[], BN_CTX *ctx) crypto/ec/ec_lib.c:965:15: Call 963. else 964. /* use default */ 965. ret = ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx); ^ 966. 967. BN_CTX_free(new_ctx); crypto/ec/ec_mult.c:410:1: <LHS trace> 408. * in the addition if scalar != NULL 409. */ 410. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 411. size_t num, const EC_POINT *points[], const BIGNUM *scalars[], 412. BN_CTX *ctx) crypto/ec/ec_mult.c:410:1: Parameter `group->pre_comp.ec->w` 408. * in the addition if scalar != NULL 409. */ 410. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 411. size_t num, const EC_POINT *points[], const BIGNUM *scalars[], 412. BN_CTX *ctx) crypto/ec/ec_mult.c:494:13: Binary operation: ([0, +oo] - 1):unsigned64 by call to `EC_GROUP_check` 492. numblocks = pre_comp->numblocks; 493. 494. pre_points_per_block = (size_t)1 << (pre_comp->w - 1); ^ 495. 496. /* check that pre_comp looks sane */
https://github.com/openssl/openssl/blob/b11327929294cf825e4759d97af6f174bd6b081c/crypto/ec/ec_mult.c/#L494
d2a_code_trace_data_44892
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { if (!ossl_assert(pkt->subs != NULL && len != 0)) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } if (allocbytes != NULL) *allocbytes = WPACKET_get_curr(pkt); return 1; } ssl/statem/extensions_srvr.c:845: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 4]):unsigned64 by call to `WPACKET_put_bytes__`. Showing all 12 steps of the trace ssl/statem/extensions_srvr.c:844:10: Call 842. return EXT_RETURN_NOT_SENT; 843. 844. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_server_name) ^ 845. || !WPACKET_put_bytes_u16(pkt, 0)) { 846. SSLerr(SSL_F_TLS_CONSTRUCT_STOC_SERVER_NAME, ERR_R_INTERNAL_ERROR); ssl/packet.c:306:1: Parameter `pkt->buf->length` 304. } 305. 306. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 307. { 308. unsigned char *data; ssl/statem/extensions_srvr.c:845:17: Call 843. 844. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_server_name) 845. || !WPACKET_put_bytes_u16(pkt, 0)) { ^ 846. SSLerr(SSL_F_TLS_CONSTRUCT_STOC_SERVER_NAME, ERR_R_INTERNAL_ERROR); 847. return EXT_RETURN_FAIL; ssl/packet.c:306:1: Parameter `pkt->written` 304. } 305. 306. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 307. { 308. unsigned char *data; ssl/packet.c:312:17: Call 310. /* Internal API, so should not fail */ 311. if (!ossl_assert(size <= sizeof(unsigned int)) 312. || !WPACKET_allocate_bytes(pkt, size, &data) ^ 313. || !put_value(data, val, size)) 314. return 0; ssl/packet.c:15:1: Parameter `pkt->written` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ssl/packet.c:17:10: Call 15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ^ 18. return 0; 19. ssl/packet.c:39:1: <LHS trace> 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: Parameter `pkt->buf->length` 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: <RHS trace> 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: Parameter `len` 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:48:36: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 4]):unsigned64 by call to `WPACKET_put_bytes__` 46. return 0; 47. 48. if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) { ^ 49. size_t newlen; 50. size_t reflen;
https://github.com/openssl/openssl/blob/7f7eb90b8ac55997c5c825bb3ebcfe28611e06f5/ssl/packet.c/#L48
d2a_code_trace_data_44893
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 && ossl_isxdigit(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/sm2_internal_test.c:214: error: BUFFER_OVERRUN_L2 Offset: [-15, 536870911] (⇐ [0, 1] + [-15, 536870910]) Size: 2 by call to `create_EC_group`. Showing all 9 steps of the trace test/sm2_internal_test.c:214:9: Call 212. int testresult = 0; 213. EC_GROUP *test_group = 214. create_EC_group ^ 215. ("8542D69E4C044F18E8B92435BF6FF7DE457283915C45517D722EDB8B08F1DFC3", 216. "787968B4FA32C3FD2417842E73BBFEFF2F3C848B6831D7E0EC65228B3937E498", test/sm2_internal_test.c:79:1: Parameter `*cof_hex` 77. } 78. 79. > static EC_GROUP *create_EC_group(const char *p_hex, const char *a_hex, 80. const char *b_hex, const char *x_hex, 81. const char *y_hex, const char *order_hex, test/sm2_internal_test.c:115:17: Call 113. 114. if (!TEST_true(BN_hex2bn(&order, order_hex)) 115. || !TEST_true(BN_hex2bn(&cof, cof_hex)) ^ 116. || !TEST_true(EC_GROUP_set_generator(group, generator, order, cof))) 117. goto done; crypto/bn/bn_print.c:141:10: <Offset trace> 139. } 140. 141. for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++) ^ 142. continue; 143. crypto/bn/bn_print.c:141:10: Assignment 139. } 140. 141. for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++) ^ 142. continue; 143. crypto/bn/bn_print.c:164:5: Assignment 162. goto err; 163. 164. j = i; /* least significant 'hex' */ ^ 165. m = 0; 166. h = 0; 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:171:17: Array access: Offset: [-15, 536870911] (⇐ [0, 1] + [-15, 536870910]) Size: 2 by call to `create_EC_group` 169. l = 0; 170. for (;;) { 171. c = a[j - m]; ^ 172. k = OPENSSL_hexchar2int(c); 173. if (k < 0)
https://github.com/openssl/openssl/blob/eaf39a9fe6f55feb5251e235069e02f7f50d9a49/crypto/bn/bn_print.c/#L171
d2a_code_trace_data_44894
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:1960: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_exp`. Showing all 18 steps of the trace test/bntest.c:1960:10: Call 1958. BN_zero(zero); 1959. 1960. if (!BN_mod_exp(r, a, zero, BN_value_one(), NULL) ^ 1961. || !BN_is_zero(r) 1962. || !BN_mod_exp_mont(r, a, zero, BN_value_one(), NULL, NULL) crypto/bn/bn_exp.c:91:1: Parameter `ctx->stack.depth` 89. } 90. 91. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 92. BN_CTX *ctx) 93. { crypto/bn/bn_exp.c:156:15: Call 154. #ifdef RECP_MUL_MOD 155. { 156. ret = BN_mod_exp_recp(r, a, p, m, ctx); ^ 157. } 158. #else crypto/bn/bn_exp.c:168:1: Parameter `ctx->stack.depth` 166. } 167. 168. > int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 169. const BIGNUM *m, BN_CTX *ctx) 170. { crypto/bn/bn_exp.c:196:5: Call 194. } 195. 196. BN_CTX_start(ctx); ^ 197. aa = BN_CTX_get(ctx); 198. val[0] = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_exp.c:215:10: Call 213. } 214. 215. if (!BN_nnmod(val[0], a, m, ctx)) ^ 216. goto err; /* 1 */ 217. if (BN_is_zero(val[0])) { crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:140:1: Parameter `ctx->stack.depth` 138. * If 'dv' or 'rm' is NULL, the respective value is not returned. 139. */ 140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 141. BN_CTX *ctx) 142. { crypto/bn/bn_div.c:193:5: Call 191. } 192. 193. BN_CTX_start(ctx); ^ 194. tmp = BN_CTX_get(ctx); 195. snum = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:416:5: Call 414. if (no_branch) 415. bn_correct_top(res); 416. BN_CTX_end(ctx); ^ 417. return (1); 418. err: crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.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_mod_exp` 271. static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; ^ 274. } 275.
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_44895
static int decode_header(SnowContext *s){ int plane_index; uint8_t kstate[32]; memset(kstate, MID_STATE, sizeof(kstate)); s->keyframe= get_rac(&s->c, kstate); if(s->keyframe || s->always_reset){ reset_contexts(s); s->spatial_decomposition_type= s->qlog= s->qbias= s->mv_scale= s->block_max_depth= 0; } if(s->keyframe){ s->version= get_symbol(&s->c, s->header_state, 0); if(s->version>0){ av_log(s->avctx, AV_LOG_ERROR, "version %d not supported", s->version); return -1; } s->always_reset= get_rac(&s->c, s->header_state); s->temporal_decomposition_type= get_symbol(&s->c, s->header_state, 0); s->temporal_decomposition_count= get_symbol(&s->c, s->header_state, 0); s->spatial_decomposition_count= get_symbol(&s->c, s->header_state, 0); s->colorspace_type= get_symbol(&s->c, s->header_state, 0); s->chroma_h_shift= get_symbol(&s->c, s->header_state, 0); s->chroma_v_shift= get_symbol(&s->c, s->header_state, 0); s->spatial_scalability= get_rac(&s->c, s->header_state); s->max_ref_frames= get_symbol(&s->c, s->header_state, 0)+1; decode_qlogs(s); } if(!s->keyframe){ if(get_rac(&s->c, s->header_state)){ for(plane_index=0; plane_index<2; plane_index++){ int htaps, i, sum=0; Plane *p= &s->plane[plane_index]; p->diag_mc= get_rac(&s->c, s->header_state); htaps= get_symbol(&s->c, s->header_state, 0)*2 + 2; if((unsigned)htaps > HTAPS_MAX || htaps==0) return -1; p->htaps= htaps; for(i= htaps/2; i; i--){ p->hcoeff[i]= get_symbol(&s->c, s->header_state, 0) * (1-2*(i&1)); sum += p->hcoeff[i]; } p->hcoeff[0]= 32-sum; } s->plane[2].diag_mc= s->plane[1].diag_mc; s->plane[2].htaps = s->plane[1].htaps; memcpy(s->plane[2].hcoeff, s->plane[1].hcoeff, sizeof(s->plane[1].hcoeff)); } if(get_rac(&s->c, s->header_state)){ s->spatial_decomposition_count= get_symbol(&s->c, s->header_state, 0); decode_qlogs(s); } } s->spatial_decomposition_type+= get_symbol(&s->c, s->header_state, 1); if(s->spatial_decomposition_type > 1){ av_log(s->avctx, AV_LOG_ERROR, "spatial_decomposition_type %d not supported", s->spatial_decomposition_type); return -1; } s->qlog += get_symbol(&s->c, s->header_state, 1); s->mv_scale += get_symbol(&s->c, s->header_state, 1); s->qbias += get_symbol(&s->c, s->header_state, 1); s->block_max_depth+= get_symbol(&s->c, s->header_state, 1); if(s->block_max_depth > 1 || s->block_max_depth < 0){ av_log(s->avctx, AV_LOG_ERROR, "block_max_depth= %d is too large", s->block_max_depth); s->block_max_depth= 0; return -1; } return 0; } libavcodec/snow.c:3606: error: Buffer Overrun L3 Offset added: 4 Size: [0, +oo]. libavcodec/snow.c:3553:1: <Length trace> 3551. } 3552. 3553. static int decode_header(SnowContext *s){ ^ 3554. int plane_index; 3555. uint8_t kstate[32]; libavcodec/snow.c:3553:1: Parameter `s->plane[*].hcoeff[*]` 3551. } 3552. 3553. static int decode_header(SnowContext *s){ ^ 3554. int plane_index; 3555. uint8_t kstate[32]; libavcodec/snow.c:3606:13: Array access: Offset added: 4 Size: [0, +oo] 3604. s->plane[2].diag_mc= s->plane[1].diag_mc; 3605. s->plane[2].htaps = s->plane[1].htaps; 3606. memcpy(s->plane[2].hcoeff, s->plane[1].hcoeff, sizeof(s->plane[1].hcoeff)); ^ 3607. } 3608. if(get_rac(&s->c, s->header_state)){
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/snow.c/#L3606
d2a_code_trace_data_44896
static ngx_int_t ngx_parse_unix_domain_url(ngx_pool_t *pool, ngx_url_t *u) { #if (NGX_HAVE_UNIX_DOMAIN) u_char *path, *uri, *last; size_t len; struct sockaddr_un *saun; len = u->url.len; path = u->url.data; path += 5; len -= 5; if (u->uri_part) { last = path + len; uri = ngx_strlchr(path, last, ':'); if (uri) { len = uri - path; uri++; u->uri.len = last - uri; u->uri.data = uri; } } if (len == 0) { u->err = "no path in the unix domain socket"; return NGX_ERROR; } u->host.len = len++; u->host.data = path; if (len > sizeof(saun->sun_path)) { u->err = "too long path in the unix domain socket"; return NGX_ERROR; } u->socklen = sizeof(struct sockaddr_un); saun = (struct sockaddr_un *) &u->sockaddr; saun->sun_family = AF_UNIX; (void) ngx_cpystrn((u_char *) saun->sun_path, path, len); u->addrs = ngx_pcalloc(pool, sizeof(ngx_peer_addr_t)); if (u->addrs == NULL) { return NGX_ERROR; } saun = ngx_pcalloc(pool, sizeof(struct sockaddr_un)); if (saun == NULL) { return NGX_ERROR; } u->family = AF_UNIX; u->naddrs = 1; saun->sun_family = AF_UNIX; (void) ngx_cpystrn((u_char *) saun->sun_path, path, len); u->addrs[0].sockaddr = (struct sockaddr *) saun; u->addrs[0].socklen = sizeof(struct sockaddr_un); u->addrs[0].name.len = len + 4; u->addrs[0].name.data = u->url.data; return NGX_OK; #else u->err = "the unix domain sockets are not supported on this platform"; return NGX_ERROR; #endif } src/http/modules/ngx_http_proxy_module.c:694: error: Integer Overflow L2 ([0, +oo] - 5):unsigned64 by call to `ngx_parse_url`. src/http/modules/ngx_http_proxy_module.c:653:9: Call 651. ngx_http_upstream_t *u; 652. 653. if (ngx_http_script_run(r, &proxy, plcf->proxy_lengths->elts, 0, ^ 654. plcf->proxy_values->elts) 655. == NULL) src/http/ngx_http_script.c:384:1: Parameter `len` 382. 383. 384. u_char * ^ 385. ngx_http_script_run(ngx_http_request_t *r, ngx_str_t *value, 386. void *code_lengths, size_t len, void *code_values) src/http/ngx_http_script.c:415:5: Assignment 413. 414. 415. value->len = len; ^ 416. value->data = ngx_pnalloc(r->pool, len); 417. if (value->data == NULL) { src/http/modules/ngx_http_proxy_module.c:688:5: Assignment 686. ngx_memzero(&url, sizeof(ngx_url_t)); 687. 688. url.url.len = proxy.len - add; ^ 689. url.url.data = proxy.data + add; 690. url.default_port = port; src/http/modules/ngx_http_proxy_module.c:694:9: Call 692. url.no_resolve = 1; 693. 694. if (ngx_parse_url(r->pool, &url) != NGX_OK) { ^ 695. if (url.err) { 696. ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, src/core/ngx_inet.c:285:1: Parameter `u->url.len` 283. 284. 285. ngx_int_t ^ 286. ngx_parse_url(ngx_pool_t *pool, ngx_url_t *u) 287. { src/core/ngx_inet.c:293:16: Call 291. 292. if (ngx_strncasecmp(p, (u_char *) "unix:", 5) == 0) { 293. return ngx_parse_unix_domain_url(pool, u); ^ 294. } 295. src/core/ngx_inet.c:309:1: <LHS trace> 307. 308. 309. static ngx_int_t ^ 310. ngx_parse_unix_domain_url(ngx_pool_t *pool, ngx_url_t *u) 311. { src/core/ngx_inet.c:309:1: Parameter `u->url.len` 307. 308. 309. static ngx_int_t ^ 310. ngx_parse_unix_domain_url(ngx_pool_t *pool, ngx_url_t *u) 311. { src/core/ngx_inet.c:317:5: Assignment 315. struct sockaddr_un *saun; 316. 317. len = u->url.len; ^ 318. path = u->url.data; 319. src/core/ngx_inet.c:321:5: Binary operation: ([0, +oo] - 5):unsigned64 by call to `ngx_parse_url` 319. 320. path += 5; 321. len -= 5; ^ 322. 323. if (u->uri_part) {
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_inet.c/#L321
d2a_code_trace_data_44897
int dtls1_buffer_message(SSL *s, int is_ccs) { pitem *item; hm_fragment *frag; unsigned char seq64be[8]; OPENSSL_assert(s->init_off == 0); frag = dtls1_hm_fragment_new(s->init_num, 0); if (frag == NULL) return 0; memcpy(frag->fragment, s->init_buf->data, s->init_num); if (is_ccs) { OPENSSL_assert(s->d1->w_msg_hdr.msg_len + ((s->version==DTLS1_BAD_VER)?3:DTLS1_CCS_HEADER_LENGTH) == (unsigned int)s->init_num); } else { OPENSSL_assert(s->d1->w_msg_hdr.msg_len + DTLS1_HM_HEADER_LENGTH == (unsigned int)s->init_num); } frag->msg_header.msg_len = s->d1->w_msg_hdr.msg_len; frag->msg_header.seq = s->d1->w_msg_hdr.seq; frag->msg_header.type = s->d1->w_msg_hdr.type; frag->msg_header.frag_off = 0; frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len; frag->msg_header.is_ccs = is_ccs; frag->msg_header.saved_retransmit_state.enc_write_ctx = s->enc_write_ctx; frag->msg_header.saved_retransmit_state.write_hash = s->write_hash; frag->msg_header.saved_retransmit_state.compress = s->compress; frag->msg_header.saved_retransmit_state.session = s->session; frag->msg_header.saved_retransmit_state.epoch = DTLS_RECORD_LAYER_get_w_epoch(&s->rlayer); memset(seq64be, 0, sizeof(seq64be)); seq64be[6] = (unsigned char)(dtls1_get_queue_priority(frag->msg_header.seq, frag->msg_header.is_ccs) >> 8); seq64be[7] = (unsigned char)(dtls1_get_queue_priority(frag->msg_header.seq, frag->msg_header.is_ccs)); item = pitem_new(seq64be, frag); if (item == NULL) { dtls1_hm_fragment_free(frag); return 0; } pqueue_insert(s->d1->sent_messages, item); return 1; } ssl/statem/statem_dtls.c:1151: error: MEMORY_LEAK memory dynamically allocated by call to `dtls1_hm_fragment_new()` at line 1104, column 12 is not reachable after line 1151, column 5. Showing all 80 steps of the trace ssl/statem/statem_dtls.c:1092:1: start of procedure dtls1_buffer_message() 1090. } 1091. 1092. > int dtls1_buffer_message(SSL *s, int is_ccs) 1093. { 1094. pitem *item; ssl/statem/statem_dtls.c:1102:5: Condition is true 1100. * serialized 1101. */ 1102. OPENSSL_assert(s->init_off == 0); ^ 1103. 1104. frag = dtls1_hm_fragment_new(s->init_num, 0); ssl/statem/statem_dtls.c:1104:5: 1102. OPENSSL_assert(s->init_off == 0); 1103. 1104. > frag = dtls1_hm_fragment_new(s->init_num, 0); 1105. if (frag == NULL) 1106. return 0; ssl/statem/statem_dtls.c:163:1: start of procedure dtls1_hm_fragment_new() 161. static int dtls_get_reassembled_message(SSL *s, long *len); 162. 163. > static hm_fragment *dtls1_hm_fragment_new(unsigned long frag_len, 164. int reassembly) 165. { ssl/statem/statem_dtls.c:166:5: 164. int reassembly) 165. { 166. > hm_fragment *frag = NULL; 167. unsigned char *buf = NULL; 168. unsigned char *bitmask = NULL; ssl/statem/statem_dtls.c:167:5: 165. { 166. hm_fragment *frag = NULL; 167. > unsigned char *buf = NULL; 168. unsigned char *bitmask = NULL; 169. ssl/statem/statem_dtls.c:168:5: 166. hm_fragment *frag = NULL; 167. unsigned char *buf = NULL; 168. > unsigned char *bitmask = NULL; 169. 170. frag = OPENSSL_malloc(sizeof(*frag)); ssl/statem/statem_dtls.c:170:5: 168. unsigned char *bitmask = NULL; 169. 170. > frag = OPENSSL_malloc(sizeof(*frag)); 171. if (frag == NULL) 172. return 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) ssl/statem/statem_dtls.c:171:9: Taking false branch 169. 170. frag = OPENSSL_malloc(sizeof(*frag)); 171. if (frag == NULL) ^ 172. return NULL; 173. ssl/statem/statem_dtls.c:174:9: Taking true branch 172. return NULL; 173. 174. if (frag_len) { ^ 175. buf = OPENSSL_malloc(frag_len); 176. if (buf == NULL) { ssl/statem/statem_dtls.c:175:9: 173. 174. if (frag_len) { 175. > buf = OPENSSL_malloc(frag_len); 176. if (buf == NULL) { 177. OPENSSL_free(frag); 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) ssl/statem/statem_dtls.c:176:13: Taking false branch 174. if (frag_len) { 175. buf = OPENSSL_malloc(frag_len); 176. if (buf == NULL) { ^ 177. OPENSSL_free(frag); 178. return NULL; ssl/statem/statem_dtls.c:183:5: 181. 182. /* zero length fragment gets zero frag->fragment */ 183. > frag->fragment = buf; 184. 185. /* Initialize reassembly bitmask if necessary */ ssl/statem/statem_dtls.c:186:9: Taking false branch 184. 185. /* Initialize reassembly bitmask if necessary */ 186. if (reassembly) { ^ 187. bitmask = OPENSSL_zalloc(RSMBLY_BITMASK_SIZE(frag_len)); 188. if (bitmask == NULL) { ssl/statem/statem_dtls.c:195:5: 193. } 194. 195. > frag->reassembly = bitmask; 196. 197. return frag; ssl/statem/statem_dtls.c:197:5: 195. frag->reassembly = bitmask; 196. 197. > return frag; 198. } 199. ssl/statem/statem_dtls.c:198:1: return from a call to dtls1_hm_fragment_new 196. 197. return frag; 198. > } 199. 200. void dtls1_hm_fragment_free(hm_fragment *frag) ssl/statem/statem_dtls.c:1105:9: Taking false branch 1103. 1104. frag = dtls1_hm_fragment_new(s->init_num, 0); 1105. if (frag == NULL) ^ 1106. return 0; 1107. ssl/statem/statem_dtls.c:1108:5: 1106. return 0; 1107. 1108. > memcpy(frag->fragment, s->init_buf->data, s->init_num); 1109. 1110. if (is_ccs) { ssl/statem/statem_dtls.c:1110:9: Taking true branch 1108. memcpy(frag->fragment, s->init_buf->data, s->init_num); 1109. 1110. if (is_ccs) { ^ 1111. /* For DTLS1_BAD_VER the header length is non-standard */ 1112. OPENSSL_assert(s->d1->w_msg_hdr.msg_len + ssl/statem/statem_dtls.c:1112:9: Condition is false 1110. if (is_ccs) { 1111. /* For DTLS1_BAD_VER the header length is non-standard */ 1112. OPENSSL_assert(s->d1->w_msg_hdr.msg_len + ^ 1113. ((s->version==DTLS1_BAD_VER)?3:DTLS1_CCS_HEADER_LENGTH) 1114. == (unsigned int)s->init_num); ssl/statem/statem_dtls.c:1112:9: Condition is true 1110. if (is_ccs) { 1111. /* For DTLS1_BAD_VER the header length is non-standard */ 1112. OPENSSL_assert(s->d1->w_msg_hdr.msg_len + ^ 1113. ((s->version==DTLS1_BAD_VER)?3:DTLS1_CCS_HEADER_LENGTH) 1114. == (unsigned int)s->init_num); ssl/statem/statem_dtls.c:1120:5: 1118. } 1119. 1120. > frag->msg_header.msg_len = s->d1->w_msg_hdr.msg_len; 1121. frag->msg_header.seq = s->d1->w_msg_hdr.seq; 1122. frag->msg_header.type = s->d1->w_msg_hdr.type; ssl/statem/statem_dtls.c:1121:5: 1119. 1120. frag->msg_header.msg_len = s->d1->w_msg_hdr.msg_len; 1121. > frag->msg_header.seq = s->d1->w_msg_hdr.seq; 1122. frag->msg_header.type = s->d1->w_msg_hdr.type; 1123. frag->msg_header.frag_off = 0; ssl/statem/statem_dtls.c:1122:5: 1120. frag->msg_header.msg_len = s->d1->w_msg_hdr.msg_len; 1121. frag->msg_header.seq = s->d1->w_msg_hdr.seq; 1122. > frag->msg_header.type = s->d1->w_msg_hdr.type; 1123. frag->msg_header.frag_off = 0; 1124. frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len; ssl/statem/statem_dtls.c:1123:5: 1121. frag->msg_header.seq = s->d1->w_msg_hdr.seq; 1122. frag->msg_header.type = s->d1->w_msg_hdr.type; 1123. > frag->msg_header.frag_off = 0; 1124. frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len; 1125. frag->msg_header.is_ccs = is_ccs; ssl/statem/statem_dtls.c:1124:5: 1122. frag->msg_header.type = s->d1->w_msg_hdr.type; 1123. frag->msg_header.frag_off = 0; 1124. > frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len; 1125. frag->msg_header.is_ccs = is_ccs; 1126. ssl/statem/statem_dtls.c:1125:5: 1123. frag->msg_header.frag_off = 0; 1124. frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len; 1125. > frag->msg_header.is_ccs = is_ccs; 1126. 1127. /* save current state */ ssl/statem/statem_dtls.c:1128:5: 1126. 1127. /* save current state */ 1128. > frag->msg_header.saved_retransmit_state.enc_write_ctx = s->enc_write_ctx; 1129. frag->msg_header.saved_retransmit_state.write_hash = s->write_hash; 1130. frag->msg_header.saved_retransmit_state.compress = s->compress; ssl/statem/statem_dtls.c:1129:5: 1127. /* save current state */ 1128. frag->msg_header.saved_retransmit_state.enc_write_ctx = s->enc_write_ctx; 1129. > frag->msg_header.saved_retransmit_state.write_hash = s->write_hash; 1130. frag->msg_header.saved_retransmit_state.compress = s->compress; 1131. frag->msg_header.saved_retransmit_state.session = s->session; ssl/statem/statem_dtls.c:1130:5: 1128. frag->msg_header.saved_retransmit_state.enc_write_ctx = s->enc_write_ctx; 1129. frag->msg_header.saved_retransmit_state.write_hash = s->write_hash; 1130. > frag->msg_header.saved_retransmit_state.compress = s->compress; 1131. frag->msg_header.saved_retransmit_state.session = s->session; 1132. frag->msg_header.saved_retransmit_state.epoch = ssl/statem/statem_dtls.c:1131:5: 1129. frag->msg_header.saved_retransmit_state.write_hash = s->write_hash; 1130. frag->msg_header.saved_retransmit_state.compress = s->compress; 1131. > frag->msg_header.saved_retransmit_state.session = s->session; 1132. frag->msg_header.saved_retransmit_state.epoch = 1133. DTLS_RECORD_LAYER_get_w_epoch(&s->rlayer); ssl/statem/statem_dtls.c:1132:5: 1130. frag->msg_header.saved_retransmit_state.compress = s->compress; 1131. frag->msg_header.saved_retransmit_state.session = s->session; 1132. > frag->msg_header.saved_retransmit_state.epoch = 1133. DTLS_RECORD_LAYER_get_w_epoch(&s->rlayer); 1134. ssl/statem/statem_dtls.c:1135:5: 1133. DTLS_RECORD_LAYER_get_w_epoch(&s->rlayer); 1134. 1135. > memset(seq64be, 0, sizeof(seq64be)); 1136. seq64be[6] = 1137. (unsigned ssl/statem/statem_dtls.c:1136:5: 1134. 1135. memset(seq64be, 0, sizeof(seq64be)); 1136. > seq64be[6] = 1137. (unsigned 1138. char)(dtls1_get_queue_priority(frag->msg_header.seq, ssl/statem/statem_dtls.c:1052:1: start of procedure dtls1_get_queue_priority() 1050. } 1051. 1052. > int dtls1_get_queue_priority(unsigned short seq, int is_ccs) 1053. { 1054. /* ssl/statem/statem_dtls.c:1064:5: 1062. * priority queues) and fits in the unsigned short variable. 1063. */ 1064. > return seq * 2 - is_ccs; 1065. } 1066. ssl/statem/statem_dtls.c:1065:1: return from a call to dtls1_get_queue_priority 1063. */ 1064. return seq * 2 - is_ccs; 1065. > } 1066. 1067. int dtls1_retransmit_buffered_messages(SSL *s) ssl/statem/statem_dtls.c:1140:5: 1138. char)(dtls1_get_queue_priority(frag->msg_header.seq, 1139. frag->msg_header.is_ccs) >> 8); 1140. > seq64be[7] = 1141. (unsigned 1142. char)(dtls1_get_queue_priority(frag->msg_header.seq, ssl/statem/statem_dtls.c:1052:1: start of procedure dtls1_get_queue_priority() 1050. } 1051. 1052. > int dtls1_get_queue_priority(unsigned short seq, int is_ccs) 1053. { 1054. /* ssl/statem/statem_dtls.c:1064:5: 1062. * priority queues) and fits in the unsigned short variable. 1063. */ 1064. > return seq * 2 - is_ccs; 1065. } 1066. ssl/statem/statem_dtls.c:1065:1: return from a call to dtls1_get_queue_priority 1063. */ 1064. return seq * 2 - is_ccs; 1065. > } 1066. 1067. int dtls1_retransmit_buffered_messages(SSL *s) ssl/statem/statem_dtls.c:1145:5: 1143. frag->msg_header.is_ccs)); 1144. 1145. > item = pitem_new(seq64be, frag); 1146. if (item == NULL) { 1147. dtls1_hm_fragment_free(frag); crypto/pqueue/pqueue.c:69:1: start of procedure pitem_new() 67. } pqueue_s; 68. 69. > pitem *pitem_new(unsigned char *prio64be, void *data) 70. { 71. pitem *item = OPENSSL_malloc(sizeof(*item)); crypto/pqueue/pqueue.c:71:5: 69. pitem *pitem_new(unsigned char *prio64be, void *data) 70. { 71. > pitem *item = OPENSSL_malloc(sizeof(*item)); 72. if (item == NULL) 73. return 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/pqueue/pqueue.c:72:9: Taking false branch 70. { 71. pitem *item = OPENSSL_malloc(sizeof(*item)); 72. if (item == NULL) ^ 73. return NULL; 74. crypto/pqueue/pqueue.c:75:5: 73. return NULL; 74. 75. > memcpy(item->priority, prio64be, sizeof(item->priority)); 76. 77. item->data = data; crypto/pqueue/pqueue.c:77:5: 75. memcpy(item->priority, prio64be, sizeof(item->priority)); 76. 77. > item->data = data; 78. item->next = NULL; 79. crypto/pqueue/pqueue.c:78:5: 76. 77. item->data = data; 78. > item->next = NULL; 79. 80. return item; crypto/pqueue/pqueue.c:80:5: 78. item->next = NULL; 79. 80. > return item; 81. } 82. crypto/pqueue/pqueue.c:81:1: return from a call to pitem_new 79. 80. return item; 81. > } 82. 83. void pitem_free(pitem *item) ssl/statem/statem_dtls.c:1146:9: Taking false branch 1144. 1145. item = pitem_new(seq64be, frag); 1146. if (item == NULL) { ^ 1147. dtls1_hm_fragment_free(frag); 1148. return 0; ssl/statem/statem_dtls.c:1151:5: Skipping pqueue_insert(): empty list of specs 1149. } 1150. 1151. pqueue_insert(s->d1->sent_messages, item); ^ 1152. return 1; 1153. }
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/ssl/statem/statem_dtls.c/#L1151
d2a_code_trace_data_44898
static void dequant_lsps(double *lsps, int num, const uint16_t *values, const uint16_t *sizes, int n_stages, const uint8_t *table, const double *mul_q, const double *base_q) { int n, m; memset(lsps, 0, num * sizeof(*lsps)); for (n = 0; n < n_stages; n++) { const uint8_t *t_off = &table[values[n] * num]; double base = base_q[n], mul = mul_q[n]; for (m = 0; m < num; m++) lsps[m] += base + mul * t_off[m]; table += sizes[n] * num; } } libavcodec/wmavoice.c:1789: error: Buffer Overrun L2 Offset: [2, 11] (⇐ 2 + [0, 9]) Size: 3 by call to `dequant_lsp10r`. libavcodec/wmavoice.c:1734:1: Array declaration 1732. * fully parse the superframe 1733. */ 1734. static int synth_superframe(AVCodecContext *ctx, AVFrame *frame, ^ 1735. int *got_frame_ptr) 1736. { libavcodec/wmavoice.c:1789:13: Call 1787. 1788. if (s->lsps == 10) { 1789. dequant_lsp10r(gb, lsps[2], prev_lsps, a1, a2, s->lsp_q_mode); ^ 1790. } else /* s->lsps == 16 */ 1791. dequant_lsp16r(gb, lsps[2], prev_lsps, a1, a2, s->lsp_q_mode); libavcodec/wmavoice.c:881:1: Parameter `*i_lsps` 879. * generate LSPs for the other frames from them (residual coding). 880. */ 881. static void dequant_lsp10r(GetBitContext *gb, ^ 882. double *i_lsps, const double *old, 883. double *a1, double *a2, int q_mode) libavcodec/wmavoice.c:897:5: Call 895. int n; 896. 897. dequant_lsp10i(gb, i_lsps); ^ 898. 899. interpol = get_bits(gb, 5); libavcodec/wmavoice.c:855:1: Parameter `*lsps` 853. * Parse 10 independently-coded LSPs. 854. */ 855. static void dequant_lsp10i(GetBitContext *gb, double *lsps) ^ 856. { 857. static const uint16_t vec_sizes[4] = { 256, 64, 32, 32 }; libavcodec/wmavoice.c:873:5: Call 871. v[3] = get_bits(gb, 5); 872. 873. dequant_lsps(lsps, 10, v, vec_sizes, 4, wmavoice_dq_lsp10i, ^ 874. mul_lsf, base_lsf); 875. } libavcodec/wmavoice.c:823:1: <Offset trace> 821. * @param base_q base (lowest) LSF values 822. */ 823. static void dequant_lsps(double *lsps, int num, ^ 824. const uint16_t *values, 825. const uint16_t *sizes, libavcodec/wmavoice.c:823:1: Parameter `num` 821. * @param base_q base (lowest) LSF values 822. */ 823. static void dequant_lsps(double *lsps, int num, ^ 824. const uint16_t *values, 825. const uint16_t *sizes, libavcodec/wmavoice.c:823:1: <Length trace> 821. * @param base_q base (lowest) LSF values 822. */ 823. static void dequant_lsps(double *lsps, int num, ^ 824. const uint16_t *values, 825. const uint16_t *sizes, libavcodec/wmavoice.c:823:1: Parameter `*lsps` 821. * @param base_q base (lowest) LSF values 822. */ 823. static void dequant_lsps(double *lsps, int num, ^ 824. const uint16_t *values, 825. const uint16_t *sizes, libavcodec/wmavoice.c:838:13: Array access: Offset: [2, 11] (⇐ 2 + [0, 9]) Size: 3 by call to `dequant_lsp10r` 836. 837. for (m = 0; m < num; m++) 838. lsps[m] += base + mul * t_off[m]; ^ 839. 840. table += sizes[n] * num;
https://github.com/libav/libav/blob/c6507946d428ee082676d5917fbb3eb0d1d7eb2e/libavcodec/wmavoice.c/#L838
d2a_code_trace_data_44899
static int cb_server_alpn(SSL *s, const unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg) { unsigned char *protos; unsigned short protos_len; protos = next_protos_parse(&protos_len, alpn_server); if (protos == NULL) { fprintf(stderr, "failed to parser ALPN server protocol string: %s\n", alpn_server); abort(); } if (SSL_select_next_proto ((unsigned char **)out, outlen, protos, protos_len, in, inlen) != OPENSSL_NPN_NEGOTIATED) { OPENSSL_free(protos); return SSL_TLSEXT_ERR_NOACK; } alpn_selected = OPENSSL_malloc(*outlen); memcpy(alpn_selected, *out, *outlen); *out = alpn_selected; OPENSSL_free(protos); return SSL_TLSEXT_ERR_OK; } test/ssltest.c:442: error: NULL_DEREFERENCE pointer `alpn_selected` last assigned on line 441 could be null and is dereferenced by call to `memcpy()` at line 442, column 5. Showing all 15 steps of the trace test/ssltest.c:416:1: start of procedure cb_server_alpn() 414. } 415. 416. > static int cb_server_alpn(SSL *s, const unsigned char **out, 417. unsigned char *outlen, const unsigned char *in, 418. unsigned int inlen, void *arg) test/ssltest.c:423:5: Skipping next_protos_parse(): empty list of specs 421. unsigned short protos_len; 422. 423. protos = next_protos_parse(&protos_len, alpn_server); ^ 424. if (protos == NULL) { 425. fprintf(stderr, "failed to parser ALPN server protocol string: %s\n", test/ssltest.c:424:9: Taking false branch 422. 423. protos = next_protos_parse(&protos_len, alpn_server); 424. if (protos == NULL) { ^ 425. fprintf(stderr, "failed to parser ALPN server protocol string: %s\n", 426. alpn_server); test/ssltest.c:430:9: Taking false branch 428. } 429. 430. if (SSL_select_next_proto ^ 431. ((unsigned char **)out, outlen, protos, protos_len, in, 432. inlen) != OPENSSL_NPN_NEGOTIATED) { test/ssltest.c:441:5: 439. * verify_alpn. 440. */ 441. > alpn_selected = OPENSSL_malloc(*outlen); 442. memcpy(alpn_selected, *out, *outlen); 443. *out = alpn_selected; 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/ssltest.c:442:5: 440. */ 441. alpn_selected = OPENSSL_malloc(*outlen); 442. > memcpy(alpn_selected, *out, *outlen); 443. *out = alpn_selected; 444.
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/ssltest.c/#L442
d2a_code_trace_data_44900
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) { int i, nw, lb, rb; BN_ULONG *t, *f; BN_ULONG l; bn_check_top(r); bn_check_top(a); if (n < 0) { BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT); return 0; } r->neg = a->neg; nw = n / BN_BITS2; if (bn_wexpand(r, a->top + nw + 1) == NULL) return (0); lb = n % BN_BITS2; rb = BN_BITS2 - lb; f = a->d; t = r->d; t[a->top + nw] = 0; if (lb == 0) for (i = a->top - 1; i >= 0; i--) t[nw + i] = f[i]; else for (i = a->top - 1; i >= 0; i--) { l = f[i]; t[nw + i + 1] |= (l >> rb) & BN_MASK2; t[nw + i] = (l << lb) & BN_MASK2; } memset(t, 0, sizeof(*t) * nw); r->top = a->top + nw + 1; bn_correct_top(r); bn_check_top(r); return (1); } test/bntest.c:1789: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_generate_prime_ex`. Showing all 20 steps of the trace test/bntest.c:1781:18: Call 1779. unsigned primes[8] = { 2, 3, 5, 7, 11, 13, 17, 19 }; 1780. 1781. if (!BN_set_word(p, primes[i])) ^ 1782. goto err; 1783. } else { crypto/bn/bn_lib.c:463:1: Parameter `a->top` 461. } 462. 463. > int BN_set_word(BIGNUM *a, BN_ULONG w) 464. { 465. bn_check_top(a); test/bntest.c:1789:18: Call 1787. goto err; 1788. 1789. if (!BN_generate_prime_ex(p, 256, 0, a, r, &cb)) ^ 1790. goto err; 1791. putc('\n', stderr); crypto/bn/bn_prime.c:101:1: Parameter `add->top` 99. } 100. 101. > int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, 102. const BIGNUM *add, const BIGNUM *rem, BN_GENCB *cb) 103. { crypto/bn/bn_prime.c:142:18: Call 140. goto err; 141. } else { 142. if (!bn_probable_prime_dh(ret, bits, add, rem, ctx)) ^ 143. goto err; 144. } crypto/bn/bn_prime.c:494:1: Parameter `add->top` 492. } 493. 494. > int bn_probable_prime_dh(BIGNUM *rnd, int bits, 495. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx) 496. { crypto/bn/bn_prime.c:509:10: Call 507. /* we need ((rnd-rem) % add) == 0 */ 508. 509. if (!BN_mod(t1, rnd, add, ctx)) ^ 510. goto err; 511. if (!BN_sub(rnd, rnd, t1)) crypto/bn/bn_div.c:205:31: Call 203. 204. /* First we normalise the numbers */ 205. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 206. if (!(BN_lshift(sdiv, divisor, norm_shift))) 207. goto err; crypto/bn/bn_lib.c:167:9: Assignment 165. 166. if (BN_is_zero(a)) 167. return 0; ^ 168. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); 169. } crypto/bn/bn_div.c:205:5: Assignment 203. 204. /* First we normalise the numbers */ 205. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 206. if (!(BN_lshift(sdiv, divisor, norm_shift))) 207. goto err; crypto/bn/bn_div.c:206:11: Call 204. /* First we normalise the numbers */ 205. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); 206. if (!(BN_lshift(sdiv, divisor, norm_shift))) ^ 207. goto err; 208. sdiv->neg = 0; crypto/bn/bn_shift.c:81:1: <Offset trace> 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:81:1: Parameter `n` 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:96:5: Assignment 94. 95. r->neg = a->neg; 96. nw = n / BN_BITS2; ^ 97. if (bn_wexpand(r, a->top + nw + 1) == NULL) 98. return (0); crypto/bn/bn_shift.c:81:1: <Length trace> 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:81:1: Parameter `*r->d` 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:9: Call 95. r->neg = a->neg; 96. nw = n / BN_BITS2; 97. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 98. return (0); 99. lb = n % BN_BITS2; crypto/bn/bn_lib.c:1016:1: Parameter `*a->d` 1014. } 1015. 1016. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 1017. { 1018. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:102:5: Assignment 100. rb = BN_BITS2 - lb; 101. f = a->d; 102. t = r->d; ^ 103. t[a->top + nw] = 0; 104. if (lb == 0) crypto/bn/bn_shift.c:110:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_generate_prime_ex` 108. for (i = a->top - 1; i >= 0; i--) { 109. l = f[i]; 110. t[nw + i + 1] |= (l >> rb) & BN_MASK2; ^ 111. t[nw + i] = (l << lb) & BN_MASK2; 112. }
https://github.com/openssl/openssl/blob/b3618f44a7b8504bfb0a64e8a33e6b8e56d4d516/crypto/bn/bn_shift.c/#L110
d2a_code_trace_data_44901
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_chk.c:130: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mul`. Showing all 19 steps of the trace crypto/rsa/rsa_chk.c:84:9: Call 82. 83. /* q prime? */ 84. if (BN_is_prime_ex(key->q, BN_prime_checks, NULL, cb) != 1) { ^ 85. ret = 0; 86. RSAerr(RSA_F_RSA_CHECK_KEY_EX, RSA_R_Q_NOT_PRIME); crypto/bn/bn_prime.c:183:12: Call 181. BN_GENCB *cb) 182. { 183. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb); ^ 184. } 185. crypto/bn/bn_prime.c:187:1: Parameter `ctx_passed->stack.depth` 185. 186. /* See FIPS 186-4 C.3.1 Miller Rabin Probabilistic Primality Test. */ 187. > int BN_is_prime_fasttest_ex(const BIGNUM *w, int checks, BN_CTX *ctx_passed, 188. int do_trial_division, BN_GENCB *cb) 189. { crypto/rsa/rsa_chk.c:99:10: Call 97. 98. /* n = p*q * r_3...r_i? */ 99. if (!BN_mul(i, key->p, key->q, ctx)) { ^ 100. ret = -1; 101. goto err; crypto/bn/bn_mul.c:497:1: Parameter `ctx->stack.depth` 495. #endif /* BN_RECURSION */ 496. 497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); crypto/bn/bn_mul.c:499:15: Call 497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); ^ 500. 501. bn_correct_top(r); crypto/bn/bn_mul.c:507:1: Parameter `ctx->stack.depth` 505. } 506. 507. > int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 508. { 509. int ret = 0; crypto/rsa/rsa_chk.c:130:10: Call 128. 129. /* now compute k = \lambda(n) = LCM(i, j, r_3 - 1...) */ 130. if (!BN_mul(l, i, j, ctx)) { ^ 131. ret = -1; 132. goto err; crypto/bn/bn_mul.c:497:1: Parameter `ctx->stack.depth` 495. #endif /* BN_RECURSION */ 496. 497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); crypto/bn/bn_mul.c:499:15: Call 497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); ^ 500. 501. bn_correct_top(r); crypto/bn/bn_mul.c:507:1: Parameter `ctx->stack.depth` 505. } 506. 507. > int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 508. { 509. int ret = 0; crypto/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_44902
u_char * ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) { u_char *p, zero, *last; int d; float f, scale; size_t len, slen; int64_t i64; uint64_t ui64; ngx_msec_t ms; ngx_uint_t width, sign, hex, max_width, frac_width, i; ngx_str_t *v; ngx_variable_value_t *vv; if (max == 0) { return buf; } last = buf + max; while (*fmt && buf < last) { if (*fmt == '%') { i64 = 0; ui64 = 0; zero = (u_char) ((*++fmt == '0') ? '0' : ' '); width = 0; sign = 1; hex = 0; max_width = 0; frac_width = 0; slen = (size_t) -1; while (*fmt >= '0' && *fmt <= '9') { width = width * 10 + *fmt++ - '0'; } for ( ;; ) { switch (*fmt) { case 'u': sign = 0; fmt++; continue; case 'm': max_width = 1; fmt++; continue; case 'X': hex = 2; sign = 0; fmt++; continue; case 'x': hex = 1; sign = 0; fmt++; continue; case '.': fmt++; while (*fmt >= '0' && *fmt <= '9') { frac_width = frac_width * 10 + *fmt++ - '0'; } break; case '*': slen = va_arg(args, size_t); fmt++; continue; default: break; } break; } switch (*fmt) { case 'V': v = va_arg(args, ngx_str_t *); len = v->len; len = (buf + len < last) ? len : (size_t) (last - buf); buf = ngx_cpymem(buf, v->data, len); fmt++; continue; case 'v': vv = va_arg(args, ngx_variable_value_t *); len = vv->len; len = (buf + len < last) ? len : (size_t) (last - buf); buf = ngx_cpymem(buf, vv->data, len); fmt++; continue; case 's': p = va_arg(args, u_char *); if (slen == (size_t) -1) { while (*p && buf < last) { *buf++ = *p++; } } else { len = (buf + slen < last) ? slen : (size_t) (last - buf); buf = ngx_cpymem(buf, p, len); } fmt++; continue; case 'O': i64 = (int64_t) va_arg(args, off_t); sign = 1; break; case 'P': i64 = (int64_t) va_arg(args, ngx_pid_t); sign = 1; break; case 'T': i64 = (int64_t) va_arg(args, time_t); sign = 1; break; case 'M': ms = (ngx_msec_t) va_arg(args, ngx_msec_t); if ((ngx_msec_int_t) ms == -1) { sign = 1; i64 = -1; } else { sign = 0; ui64 = (uint64_t) ms; } break; case 'z': if (sign) { i64 = (int64_t) va_arg(args, ssize_t); } else { ui64 = (uint64_t) va_arg(args, size_t); } break; case 'i': if (sign) { i64 = (int64_t) va_arg(args, ngx_int_t); } else { ui64 = (uint64_t) va_arg(args, ngx_uint_t); } if (max_width) { width = NGX_INT_T_LEN; } break; case 'd': if (sign) { i64 = (int64_t) va_arg(args, int); } else { ui64 = (uint64_t) va_arg(args, u_int); } break; case 'l': if (sign) { i64 = (int64_t) va_arg(args, long); } else { ui64 = (uint64_t) va_arg(args, u_long); } break; case 'D': if (sign) { i64 = (int64_t) va_arg(args, int32_t); } else { ui64 = (uint64_t) va_arg(args, uint32_t); } break; case 'L': if (sign) { i64 = va_arg(args, int64_t); } else { ui64 = va_arg(args, uint64_t); } break; case 'A': if (sign) { i64 = (int64_t) va_arg(args, ngx_atomic_int_t); } else { ui64 = (uint64_t) va_arg(args, ngx_atomic_uint_t); } if (max_width) { width = NGX_ATOMIC_T_LEN; } break; case 'f': f = (float) va_arg(args, double); if (f < 0) { *buf++ = '-'; f = -f; } ui64 = (int64_t) f; buf = ngx_sprintf_num(buf, last, ui64, zero, 0, width); if (frac_width) { if (buf < last) { *buf++ = '.'; } scale = 1.0; for (i = 0; i < frac_width; i++) { scale *= 10.0; } ui64 = (uint64_t) ((f - (int64_t) ui64) * scale); buf = ngx_sprintf_num(buf, last, ui64, '0', 0, frac_width); } fmt++; continue; #if !(NGX_WIN32) case 'r': i64 = (int64_t) va_arg(args, rlim_t); sign = 1; break; #endif case 'p': ui64 = (uintptr_t) va_arg(args, void *); hex = 2; sign = 0; zero = '0'; width = NGX_PTR_SIZE * 2; break; case 'c': d = va_arg(args, int); *buf++ = (u_char) (d & 0xff); fmt++; continue; case 'Z': *buf++ = '\0'; fmt++; continue; case 'N': #if (NGX_WIN32) *buf++ = CR; #endif *buf++ = LF; fmt++; continue; case '%': *buf++ = '%'; fmt++; continue; default: *buf++ = *fmt++; continue; } if (sign) { if (i64 < 0) { *buf++ = '-'; ui64 = (uint64_t) -i64; } else { ui64 = (uint64_t) i64; } } buf = ngx_sprintf_num(buf, last, ui64, zero, hex, width); fmt++; } else { *buf++ = *fmt++; } } return buf; } src/http/modules/ngx_http_fastcgi_module.c:1541: error: Buffer Overrun L2 Offset: [0, 4048] Size: 2048 by call to `ngx_log_error_core`. src/http/modules/ngx_http_fastcgi_module.c:1573:9: Unknown value from: __infer_skip 1571. } 1572. 1573. ngx_memzero(b, sizeof(ngx_buf_t)); ^ 1574. 1575. b->pos = f->pos; src/http/modules/ngx_http_fastcgi_module.c:1541:17: Call 1539. } 1540. 1541. ngx_log_error(NGX_LOG_ERR, p->log, 0, ^ 1542. "FastCGI sent in stderr: \"%V\"", &line); 1543. src/core/ngx_log.c:67:1: Array declaration 65. #if (NGX_HAVE_VARIADIC_MACROS) 66. 67. void ^ 68. ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, 69. const char *fmt, ...) src/core/ngx_log.c:88:5: Assignment 86. } 87. 88. last = errstr + NGX_MAX_ERROR_STR; ^ 89. 90. ngx_memcpy(errstr, ngx_cached_err_log_time.data, src/core/ngx_log.c:133:13: Call 131. ? " (%d: " : " (%Xd: ", err); 132. #else 133. p = ngx_snprintf(p, last - p, " (%d: ", err); ^ 134. #endif 135. src/core/ngx_string.c:109:1: Parameter `max` 107. 108. 109. u_char * ngx_cdecl ^ 110. ngx_snprintf(u_char *buf, size_t max, const char *fmt, ...) 111. { src/core/ngx_string.c:116:9: Call 114. 115. va_start(args, fmt); 116. p = ngx_vsnprintf(buf, max, fmt, args); ^ 117. va_end(args); 118. src/core/ngx_string.c:123:1: <Length trace> 121. 122. 123. u_char * ^ 124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) 125. { src/core/ngx_string.c:123:1: Parameter `*buf` 121. 122. 123. u_char * ^ 124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) 125. { src/core/ngx_string.c:244:25: Array access: Offset: [0, 4048] Size: 2048 by call to `ngx_log_error_core` 242. if (slen == (size_t) -1) { 243. while (*p && buf < last) { 244. *buf++ = *p++; ^ 245. } 246.
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_string.c/#L244
d2a_code_trace_data_44903
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:1578: error: BUFFER_OVERRUN_L2 Offset: [0, 536870912] (⇐ [0, 1] + [0, 536870911]) Size: 2 by call to `parseBN`. Showing all 8 steps of the trace test/bntest.c:1578:11: Call 1576. int ret, st = 0; 1577. 1578. ret = parseBN(&bn, "0"); ^ 1579. if (ret != 1 || !BN_is_zero(bn) || BN_is_negative(bn)) { 1580. fprintf(stderr, "BN_hex2bn(0) gave a bad result.\n"); test/bntest.c:92:1: Parameter `*in` 90. * Parse BIGNUM, return number of bytes parsed. 91. */ 92. > static int parseBN(BIGNUM **out, const char *in) 93. { 94. *out = NULL; test/bntest.c:95:12: Call 93. { 94. *out = NULL; 95. return BN_hex2bn(out, in); ^ 96. } 97. 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: [0, 536870912] (⇐ [0, 1] + [0, 536870911]) Size: 2 by call to `parseBN` 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_44904
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:3053: error: INTEGER_OVERFLOW_L2 ([0, max(0, `s->ctx->sessions->num_items`)] - 1):unsigned64 by call to `SSL_copy_session_id`. Showing all 19 steps of the trace ssl/ssl_lib.c: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:3053:14: Call 3051. * session-id, SSL_METHOD, sid_ctx, and 'cert' 3052. */ 3053. if (!SSL_copy_session_id(ret, s)) ^ 3054. goto err; 3055. } else { ssl/ssl_lib.c:1292:1: Parameter `t->initial_ctx->sessions->num_items` 1290. * modify. We need to be able to read f without being hassled 1291. */ 1292. > int SSL_copy_session_id(SSL *t, const SSL *f) 1293. { 1294. int i; ssl/ssl_lib.c:1296:10: Call 1294. int i; 1295. /* Do we need to to SSL locking? */ 1296. if (!SSL_set_session(t, SSL_get_session(f))) { ^ 1297. return 0; 1298. } ssl/ssl_sess.c:777:1: Parameter `s->initial_ctx->sessions->num_items` 775. } 776. 777. > int SSL_set_session(SSL *s, SSL_SESSION *session) 778. { 779. ssl_clear_bad_session(s); ssl/ssl_sess.c:779:5: Call 777. int SSL_set_session(SSL *s, SSL_SESSION *session) 778. { 779. ssl_clear_bad_session(s); ^ 780. if (s->ctx->method != s->method) { 781. if (!SSL_set_ssl_method(s, s->ctx->method)) 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_copy_session_id` 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_44905
static av_cold int pcm_encode_init(AVCodecContext *avctx) { avctx->frame_size = 0; switch(avctx->codec->id) { case CODEC_ID_PCM_ALAW: pcm_alaw_tableinit(); break; case CODEC_ID_PCM_MULAW: pcm_ulaw_tableinit(); break; default: break; } avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id); avctx->block_align = avctx->channels * avctx->bits_per_coded_sample/8; avctx->coded_frame= avcodec_alloc_frame(); avctx->coded_frame->key_frame= 1; return 0; } libavcodec/pcm.c:52: error: Null Dereference pointer `avctx->coded_frame` last assigned on line 51 could be null and is dereferenced at line 52, column 5. libavcodec/pcm.c:35:1: start of procedure pcm_encode_init() 33. #define MAX_CHANNELS 64 34. 35. static av_cold int pcm_encode_init(AVCodecContext *avctx) ^ 36. { 37. avctx->frame_size = 0; libavcodec/pcm.c:37:5: 35. static av_cold int pcm_encode_init(AVCodecContext *avctx) 36. { 37. avctx->frame_size = 0; ^ 38. switch(avctx->codec->id) { 39. case CODEC_ID_PCM_ALAW: libavcodec/pcm.c:38:5: 36. { 37. avctx->frame_size = 0; 38. switch(avctx->codec->id) { ^ 39. case CODEC_ID_PCM_ALAW: 40. pcm_alaw_tableinit(); libavcodec/pcm.c:39:5: Switch condition is false. Skipping switch case 37. avctx->frame_size = 0; 38. switch(avctx->codec->id) { 39. case CODEC_ID_PCM_ALAW: ^ 40. pcm_alaw_tableinit(); 41. break; libavcodec/pcm.c:42:5: Switch condition is false. Skipping switch case 40. pcm_alaw_tableinit(); 41. break; 42. case CODEC_ID_PCM_MULAW: ^ 43. pcm_ulaw_tableinit(); 44. break; libavcodec/pcm.c:49:5: 47. } 48. 49. avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id); ^ 50. avctx->block_align = avctx->channels * avctx->bits_per_coded_sample/8; 51. avctx->coded_frame= avcodec_alloc_frame(); libavcodec/utils.c:1612:1: start of procedure av_get_bits_per_sample() 1610. #endif 1611. 1612. int av_get_bits_per_sample(enum CodecID codec_id){ ^ 1613. switch(codec_id){ 1614. case CODEC_ID_ADPCM_SBPRO_2: libavcodec/utils.c:1613:5: 1611. 1612. int av_get_bits_per_sample(enum CodecID codec_id){ 1613. switch(codec_id){ ^ 1614. case CODEC_ID_ADPCM_SBPRO_2: 1615. return 2; libavcodec/utils.c:1614:5: Switch condition is false. Skipping switch case 1612. int av_get_bits_per_sample(enum CodecID codec_id){ 1613. switch(codec_id){ 1614. case CODEC_ID_ADPCM_SBPRO_2: ^ 1615. return 2; 1616. case CODEC_ID_ADPCM_SBPRO_3: libavcodec/utils.c:1616:5: Switch condition is false. Skipping switch case 1614. case CODEC_ID_ADPCM_SBPRO_2: 1615. return 2; 1616. case CODEC_ID_ADPCM_SBPRO_3: ^ 1617. return 3; 1618. case CODEC_ID_ADPCM_SBPRO_4: libavcodec/utils.c:1618:5: Switch condition is false. Skipping switch case 1616. case CODEC_ID_ADPCM_SBPRO_3: 1617. return 3; 1618. case CODEC_ID_ADPCM_SBPRO_4: ^ 1619. case CODEC_ID_ADPCM_CT: 1620. case CODEC_ID_ADPCM_IMA_APC: libavcodec/utils.c:1619:5: Switch condition is false. Skipping switch case 1617. return 3; 1618. case CODEC_ID_ADPCM_SBPRO_4: 1619. case CODEC_ID_ADPCM_CT: ^ 1620. case CODEC_ID_ADPCM_IMA_APC: 1621. case CODEC_ID_ADPCM_IMA_WAV: libavcodec/utils.c:1620:5: Switch condition is false. Skipping switch case 1618. case CODEC_ID_ADPCM_SBPRO_4: 1619. case CODEC_ID_ADPCM_CT: 1620. case CODEC_ID_ADPCM_IMA_APC: ^ 1621. case CODEC_ID_ADPCM_IMA_WAV: 1622. case CODEC_ID_ADPCM_IMA_QT: libavcodec/utils.c:1621:5: Switch condition is false. Skipping switch case 1619. case CODEC_ID_ADPCM_CT: 1620. case CODEC_ID_ADPCM_IMA_APC: 1621. case CODEC_ID_ADPCM_IMA_WAV: ^ 1622. case CODEC_ID_ADPCM_IMA_QT: 1623. case CODEC_ID_ADPCM_SWF: libavcodec/utils.c:1622:5: Switch condition is false. Skipping switch case 1620. case CODEC_ID_ADPCM_IMA_APC: 1621. case CODEC_ID_ADPCM_IMA_WAV: 1622. case CODEC_ID_ADPCM_IMA_QT: ^ 1623. case CODEC_ID_ADPCM_SWF: 1624. case CODEC_ID_ADPCM_MS: libavcodec/utils.c:1623:5: Switch condition is false. Skipping switch case 1621. case CODEC_ID_ADPCM_IMA_WAV: 1622. case CODEC_ID_ADPCM_IMA_QT: 1623. case CODEC_ID_ADPCM_SWF: ^ 1624. case CODEC_ID_ADPCM_MS: 1625. case CODEC_ID_ADPCM_YAMAHA: libavcodec/utils.c:1624:5: Switch condition is false. Skipping switch case 1622. case CODEC_ID_ADPCM_IMA_QT: 1623. case CODEC_ID_ADPCM_SWF: 1624. case CODEC_ID_ADPCM_MS: ^ 1625. case CODEC_ID_ADPCM_YAMAHA: 1626. case CODEC_ID_ADPCM_G722: libavcodec/utils.c:1625:5: Switch condition is false. Skipping switch case 1623. case CODEC_ID_ADPCM_SWF: 1624. case CODEC_ID_ADPCM_MS: 1625. case CODEC_ID_ADPCM_YAMAHA: ^ 1626. case CODEC_ID_ADPCM_G722: 1627. return 4; libavcodec/utils.c:1626:5: Switch condition is false. Skipping switch case 1624. case CODEC_ID_ADPCM_MS: 1625. case CODEC_ID_ADPCM_YAMAHA: 1626. case CODEC_ID_ADPCM_G722: ^ 1627. return 4; 1628. case CODEC_ID_PCM_ALAW: libavcodec/utils.c:1628:5: Switch condition is false. Skipping switch case 1626. case CODEC_ID_ADPCM_G722: 1627. return 4; 1628. case CODEC_ID_PCM_ALAW: ^ 1629. case CODEC_ID_PCM_MULAW: 1630. case CODEC_ID_PCM_S8: libavcodec/utils.c:1629:5: Switch condition is false. Skipping switch case 1627. return 4; 1628. case CODEC_ID_PCM_ALAW: 1629. case CODEC_ID_PCM_MULAW: ^ 1630. case CODEC_ID_PCM_S8: 1631. case CODEC_ID_PCM_U8: libavcodec/utils.c:1630:5: Switch condition is false. Skipping switch case 1628. case CODEC_ID_PCM_ALAW: 1629. case CODEC_ID_PCM_MULAW: 1630. case CODEC_ID_PCM_S8: ^ 1631. case CODEC_ID_PCM_U8: 1632. case CODEC_ID_PCM_ZORK: libavcodec/utils.c:1631:5: Switch condition is false. Skipping switch case 1629. case CODEC_ID_PCM_MULAW: 1630. case CODEC_ID_PCM_S8: 1631. case CODEC_ID_PCM_U8: ^ 1632. case CODEC_ID_PCM_ZORK: 1633. return 8; libavcodec/utils.c:1632:5: Switch condition is false. Skipping switch case 1630. case CODEC_ID_PCM_S8: 1631. case CODEC_ID_PCM_U8: 1632. case CODEC_ID_PCM_ZORK: ^ 1633. return 8; 1634. case CODEC_ID_PCM_S16BE: libavcodec/utils.c:1634:5: Switch condition is false. Skipping switch case 1632. case CODEC_ID_PCM_ZORK: 1633. return 8; 1634. case CODEC_ID_PCM_S16BE: ^ 1635. case CODEC_ID_PCM_S16LE: 1636. case CODEC_ID_PCM_S16LE_PLANAR: libavcodec/utils.c:1635:5: Switch condition is false. Skipping switch case 1633. return 8; 1634. case CODEC_ID_PCM_S16BE: 1635. case CODEC_ID_PCM_S16LE: ^ 1636. case CODEC_ID_PCM_S16LE_PLANAR: 1637. case CODEC_ID_PCM_U16BE: libavcodec/utils.c:1636:5: Switch condition is false. Skipping switch case 1634. case CODEC_ID_PCM_S16BE: 1635. case CODEC_ID_PCM_S16LE: 1636. case CODEC_ID_PCM_S16LE_PLANAR: ^ 1637. case CODEC_ID_PCM_U16BE: 1638. case CODEC_ID_PCM_U16LE: libavcodec/utils.c:1637:5: Switch condition is false. Skipping switch case 1635. case CODEC_ID_PCM_S16LE: 1636. case CODEC_ID_PCM_S16LE_PLANAR: 1637. case CODEC_ID_PCM_U16BE: ^ 1638. case CODEC_ID_PCM_U16LE: 1639. return 16; libavcodec/utils.c:1638:5: Switch condition is false. Skipping switch case 1636. case CODEC_ID_PCM_S16LE_PLANAR: 1637. case CODEC_ID_PCM_U16BE: 1638. case CODEC_ID_PCM_U16LE: ^ 1639. return 16; 1640. case CODEC_ID_PCM_S24DAUD: libavcodec/utils.c:1640:5: Switch condition is false. Skipping switch case 1638. case CODEC_ID_PCM_U16LE: 1639. return 16; 1640. case CODEC_ID_PCM_S24DAUD: ^ 1641. case CODEC_ID_PCM_S24BE: 1642. case CODEC_ID_PCM_S24LE: libavcodec/utils.c:1641:5: Switch condition is false. Skipping switch case 1639. return 16; 1640. case CODEC_ID_PCM_S24DAUD: 1641. case CODEC_ID_PCM_S24BE: ^ 1642. case CODEC_ID_PCM_S24LE: 1643. case CODEC_ID_PCM_U24BE: libavcodec/utils.c:1642:5: Switch condition is false. Skipping switch case 1640. case CODEC_ID_PCM_S24DAUD: 1641. case CODEC_ID_PCM_S24BE: 1642. case CODEC_ID_PCM_S24LE: ^ 1643. case CODEC_ID_PCM_U24BE: 1644. case CODEC_ID_PCM_U24LE: libavcodec/utils.c:1643:5: Switch condition is false. Skipping switch case 1641. case CODEC_ID_PCM_S24BE: 1642. case CODEC_ID_PCM_S24LE: 1643. case CODEC_ID_PCM_U24BE: ^ 1644. case CODEC_ID_PCM_U24LE: 1645. return 24; libavcodec/utils.c:1644:5: Switch condition is false. Skipping switch case 1642. case CODEC_ID_PCM_S24LE: 1643. case CODEC_ID_PCM_U24BE: 1644. case CODEC_ID_PCM_U24LE: ^ 1645. return 24; 1646. case CODEC_ID_PCM_S32BE: libavcodec/utils.c:1646:5: Switch condition is false. Skipping switch case 1644. case CODEC_ID_PCM_U24LE: 1645. return 24; 1646. case CODEC_ID_PCM_S32BE: ^ 1647. case CODEC_ID_PCM_S32LE: 1648. case CODEC_ID_PCM_U32BE: libavcodec/utils.c:1647:5: Switch condition is false. Skipping switch case 1645. return 24; 1646. case CODEC_ID_PCM_S32BE: 1647. case CODEC_ID_PCM_S32LE: ^ 1648. case CODEC_ID_PCM_U32BE: 1649. case CODEC_ID_PCM_U32LE: libavcodec/utils.c:1648:5: Switch condition is false. Skipping switch case 1646. case CODEC_ID_PCM_S32BE: 1647. case CODEC_ID_PCM_S32LE: 1648. case CODEC_ID_PCM_U32BE: ^ 1649. case CODEC_ID_PCM_U32LE: 1650. case CODEC_ID_PCM_F32BE: libavcodec/utils.c:1649:5: Switch condition is false. Skipping switch case 1647. case CODEC_ID_PCM_S32LE: 1648. case CODEC_ID_PCM_U32BE: 1649. case CODEC_ID_PCM_U32LE: ^ 1650. case CODEC_ID_PCM_F32BE: 1651. case CODEC_ID_PCM_F32LE: libavcodec/utils.c:1650:5: Switch condition is false. Skipping switch case 1648. case CODEC_ID_PCM_U32BE: 1649. case CODEC_ID_PCM_U32LE: 1650. case CODEC_ID_PCM_F32BE: ^ 1651. case CODEC_ID_PCM_F32LE: 1652. return 32; libavcodec/utils.c:1651:5: Switch condition is false. Skipping switch case 1649. case CODEC_ID_PCM_U32LE: 1650. case CODEC_ID_PCM_F32BE: 1651. case CODEC_ID_PCM_F32LE: ^ 1652. return 32; 1653. case CODEC_ID_PCM_F64BE: libavcodec/utils.c:1653:5: Switch condition is false. Skipping switch case 1651. case CODEC_ID_PCM_F32LE: 1652. return 32; 1653. case CODEC_ID_PCM_F64BE: ^ 1654. case CODEC_ID_PCM_F64LE: 1655. return 64; libavcodec/utils.c:1654:5: Switch condition is false. Skipping switch case 1652. return 32; 1653. case CODEC_ID_PCM_F64BE: 1654. case CODEC_ID_PCM_F64LE: ^ 1655. return 64; 1656. default: libavcodec/utils.c:1657:9: 1655. return 64; 1656. default: 1657. return 0; ^ 1658. } 1659. } libavcodec/utils.c:1659:1: return from a call to av_get_bits_per_sample 1657. return 0; 1658. } 1659. } ^ 1660. 1661. #if FF_API_OLD_SAMPLE_FMT libavcodec/pcm.c:50:5: 48. 49. avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id); 50. avctx->block_align = avctx->channels * avctx->bits_per_coded_sample/8; ^ 51. avctx->coded_frame= avcodec_alloc_frame(); 52. avctx->coded_frame->key_frame= 1; libavcodec/pcm.c:51:5: 49. avctx->bits_per_coded_sample = av_get_bits_per_sample(avctx->codec->id); 50. avctx->block_align = avctx->channels * avctx->bits_per_coded_sample/8; 51. avctx->coded_frame= avcodec_alloc_frame(); ^ 52. avctx->coded_frame->key_frame= 1; 53. libavcodec/utils.c:618:1: start of procedure avcodec_alloc_frame() 616. } 617. 618. AVFrame *avcodec_alloc_frame(void){ ^ 619. AVFrame *pic= av_malloc(sizeof(AVFrame)); 620. libavcodec/utils.c:619:5: 617. 618. AVFrame *avcodec_alloc_frame(void){ 619. AVFrame *pic= av_malloc(sizeof(AVFrame)); ^ 620. 621. if(pic==NULL) return NULL; libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) ^ 73. return NULL; 74. libavutil/mem.c:83:9: Taking false branch 81. ((char*)ptr)[-1]= diff; 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,32,size)) ^ 84. ptr = NULL; 85. #elif HAVE_MEMALIGN libavutil/mem.c:114:5: 112. ptr = malloc(size); 113. #endif 114. return ptr; ^ 115. } 116. libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavcodec/utils.c:621:8: Taking true branch 619. AVFrame *pic= av_malloc(sizeof(AVFrame)); 620. 621. if(pic==NULL) return NULL; ^ 622. 623. avcodec_get_frame_defaults(pic); libavcodec/utils.c:621:19: 619. AVFrame *pic= av_malloc(sizeof(AVFrame)); 620. 621. if(pic==NULL) return NULL; ^ 622. 623. avcodec_get_frame_defaults(pic); libavcodec/utils.c:626:1: return from a call to avcodec_alloc_frame 624. 625. return pic; 626. } ^ 627. 628. #if FF_API_AVCODEC_OPEN libavcodec/pcm.c:52:5: 50. avctx->block_align = avctx->channels * avctx->bits_per_coded_sample/8; 51. avctx->coded_frame= avcodec_alloc_frame(); 52. avctx->coded_frame->key_frame= 1; ^ 53. 54. return 0;
https://github.com/libav/libav/blob/02e7dbf5adc6aa702472010c33aec9bfd904702f/libavcodec/pcm.c/#L52
d2a_code_trace_data_44906
void TIFFSwabArrayOfDouble(double* dp, tmsize_t n) { register unsigned char *cp; register unsigned char t; assert(sizeof(double)==8); while (n-- > 0) { cp = (unsigned char *)dp; t = cp[7]; cp[7] = cp[0]; cp[0] = t; t = cp[6]; cp[6] = cp[1]; cp[1] = t; t = cp[5]; cp[5] = cp[2]; cp[2] = t; t = cp[4]; cp[4] = cp[3]; cp[3] = t; dp++; } } tools/gif2tiff.c:510: error: Buffer Overrun L3 Offset: [7, +oo] (⇐ [0, +oo] + 7) Size: [0, +oo] by call to `TIFFClose`. tools/gif2tiff.c:504:17: Call 502. TIFFSetField(tif, TIFFTAG_ORIENTATION, ORIENTATION_TOPLEFT); 503. strip = 0; 504. stripsize = TIFFStripSize(tif); ^ 505. for (row=0; row<height; row += rowsperstrip) { 506. if (TIFFWriteEncodedStrip(tif, strip, newras+row*width, stripsize) < 0) libtiff/tif_strip.c:235:1: Parameter `tif->tif_dir.td_samplesperpixel` 233. return (TIFFVStripSize64(tif, rps)); 234. } 235. tmsize_t ^ 236. TIFFStripSize(TIFF* tif) 237. { libtiff/tif_strip.c:241:4: Call 239. uint64 m; 240. tmsize_t n; 241. m=TIFFStripSize64(tif); ^ 242. n=(tmsize_t)m; 243. if ((uint64)n!=m) libtiff/tif_strip.c:226:1: Parameter `tif->tif_dir.td_samplesperpixel` 224. * to hold the strip. 225. */ 226. uint64 ^ 227. TIFFStripSize64(TIFF* tif) 228. { libtiff/tif_strip.c:233:10: Call 231. if (rps > td->td_imagelength) 232. rps = td->td_imagelength; 233. return (TIFFVStripSize64(tif, rps)); ^ 234. } 235. tmsize_t libtiff/tif_strip.c:103:1: Parameter `tif->tif_dir.td_samplesperpixel` 101. * Compute the # bytes in a variable height, row-aligned strip. 102. */ 103. uint64 ^ 104. TIFFVStripSize64(TIFF* tif, uint32 nrows) 105. { tools/gif2tiff.c:510:5: Call 508. strip++; 509. } 510. TIFFClose(tif); ^ 511. 512. _TIFFfree(newras); libtiff/tif_close.c:122:1: Parameter `tif->tif_dir.td_samplesperpixel` 120. */ 121. 122. void ^ 123. TIFFClose(TIFF* tif) 124. { libtiff/tif_close.c:128:2: Call 126. thandle_t fd = tif->tif_clientdata; 127. 128. TIFFCleanup(tif); ^ 129. (void) (*closeproc)(fd); 130. } libtiff/tif_close.c:46:1: Parameter `tif->tif_dir.td_samplesperpixel` 44. */ 45. 46. void ^ 47. TIFFCleanup(TIFF* tif) 48. { libtiff/tif_close.c:53:3: Call 51. */ 52. if (tif->tif_mode != O_RDONLY) 53. TIFFFlush(tif); ^ 54. (*tif->tif_cleanup)(tif); 55. TIFFFreeDirectory(tif); libtiff/tif_flush.c:32:1: Parameter `tif->tif_dir.td_samplesperpixel` 30. #include "tiffiop.h" 31. 32. int ^ 33. TIFFFlush(TIFF* tif) 34. { libtiff/tif_flush.c:83:13: Call 81. 82. if ((tif->tif_flags & (TIFF_DIRTYDIRECT|TIFF_DIRTYSTRIP)) 83. && !TIFFWriteDirectory(tif)) ^ 84. return (0); 85. libtiff/tif_dirwrite.c:163:1: Parameter `tif->tif_dir.td_samplesperpixel` 161. * storage that's been changed. 162. */ 163. int ^ 164. TIFFWriteDirectory(TIFF* tif) 165. { libtiff/tif_dirwrite.c:166:9: Call 164. TIFFWriteDirectory(TIFF* tif) 165. { 166. return TIFFWriteDirectorySec(tif,TRUE,TRUE,NULL); ^ 167. } 168. libtiff/tif_dirwrite.c:345:1: Parameter `tif->tif_dir.td_samplesperpixel` 343. } 344. 345. static int ^ 346. TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff) 347. { libtiff/tif_dirwrite.c:555:10: Call 553. if (TIFFFieldSet(tif,FIELD_SMINSAMPLEVALUE)) 554. { 555. if (!TIFFWriteDirectoryTagSampleformatPerSample(tif,&ndir,dir,TIFFTAG_SMINSAMPLEVALUE,tif->tif_dir.td_sminsamplevalue)) ^ 556. goto bad; 557. } libtiff/tif_dirwrite.c:897:1: Parameter `tif->tif_dir.td_samplesperpixel` 895. } 896. 897. static int ^ 898. TIFFWriteDirectoryTagSampleformatPerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, double value) 899. { libtiff/tif_dirwrite.c:906:12: Call 904. return(TIFFWriteDirectoryTagFloatPerSample(tif,ndir,dir,tag,(float)value)); 905. else 906. return(TIFFWriteDirectoryTagDoublePerSample(tif,ndir,dir,tag,value)); ^ 907. case SAMPLEFORMAT_INT: 908. if (tif->tif_dir.td_bitspersample<=8) libtiff/tif_dirwrite.c:1394:1: Parameter `tif->tif_dir.td_samplesperpixel` 1392. } 1393. 1394. static int TIFFWriteDirectoryTagDoublePerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, double value) ^ 1395. { 1396. static const char module[] = "TIFFWriteDirectoryTagDoublePerSample"; libtiff/tif_dirwrite.c:1406:4: Call 1404. return(1); 1405. } 1406. m=_TIFFmalloc(tif->tif_dir.td_samplesperpixel*sizeof(double)); ^ 1407. if (m==NULL) 1408. { libtiff/tif_unix.c:253:1: Parameter `s` 251. #endif 252. 253. void* ^ 254. _TIFFmalloc(tmsize_t s) 255. { libtiff/tif_unix.c:256:10: Array declaration 254. _TIFFmalloc(tmsize_t s) 255. { 256. return (malloc((size_t) s)); ^ 257. } 258. libtiff/tif_unix.c:256:2: Assignment 254. _TIFFmalloc(tmsize_t s) 255. { 256. return (malloc((size_t) s)); ^ 257. } 258. libtiff/tif_dirwrite.c:1406:2: Assignment 1404. return(1); 1405. } 1406. m=_TIFFmalloc(tif->tif_dir.td_samplesperpixel*sizeof(double)); ^ 1407. if (m==NULL) 1408. { libtiff/tif_dirwrite.c:1414:4: Call 1412. for (na=m, nb=0; nb<tif->tif_dir.td_samplesperpixel; na++, nb++) 1413. *na=value; 1414. o=TIFFWriteDirectoryTagCheckedDoubleArray(tif,ndir,dir,tag,tif->tif_dir.td_samplesperpixel,m); ^ 1415. _TIFFfree(m); 1416. return(o); libtiff/tif_dirwrite.c:2138:1: Parameter `*value` 2136. #endif 2137. 2138. static int ^ 2139. TIFFWriteDirectoryTagCheckedDoubleArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, double* value) 2140. { libtiff/tif_dirwrite.c:2145:3: Call 2143. TIFFCvtNativeToIEEEDouble(tif,count,&value); 2144. if (tif->tif_flags&TIFF_SWAB) 2145. TIFFSwabArrayOfDouble(value,count); ^ 2146. return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_DOUBLE,count,count*8,value)); 2147. } libtiff/tif_swab.c:183:1: <Length trace> 181. 182. #ifndef TIFFSwabArrayOfDouble 183. void ^ 184. TIFFSwabArrayOfDouble(double* dp, tmsize_t n) 185. { libtiff/tif_swab.c:183:1: Parameter `*dp` 181. 182. #ifndef TIFFSwabArrayOfDouble 183. void ^ 184. TIFFSwabArrayOfDouble(double* dp, tmsize_t n) 185. { libtiff/tif_swab.c:191:3: Assignment 189. /* XXX unroll loop some */ 190. while (n-- > 0) { 191. cp = (unsigned char *)dp; ^ 192. t = cp[7]; cp[7] = cp[0]; cp[0] = t; 193. t = cp[6]; cp[6] = cp[1]; cp[1] = t; libtiff/tif_swab.c:192:7: Array access: Offset: [7, +oo] (⇐ [0, +oo] + 7) Size: [0, +oo] by call to `TIFFClose` 190. while (n-- > 0) { 191. cp = (unsigned char *)dp; 192. t = cp[7]; cp[7] = cp[0]; cp[0] = t; ^ 193. t = cp[6]; cp[6] = cp[1]; cp[1] = t; 194. t = cp[5]; cp[5] = cp[2]; cp[2] = t;
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_swab.c/#L192
d2a_code_trace_data_44907
void avformat_free_context(AVFormatContext *s) { int i; AVStream *st; av_opt_free(s); if (s->iformat && s->iformat->priv_class && s->priv_data) av_opt_free(s->priv_data); for(i=0;i<s->nb_streams;i++) { st = s->streams[i]; if (st->parser) { av_parser_close(st->parser); } if (st->attached_pic.data) av_free_packet(&st->attached_pic); av_dict_free(&st->metadata); av_free(st->index_entries); av_free(st->codec->extradata); av_free(st->codec->subtitle_header); av_free(st->codec); av_free(st->priv_data); av_free(st->info); av_free(st); } for(i=s->nb_programs-1; i>=0; i--) { av_dict_free(&s->programs[i]->metadata); av_freep(&s->programs[i]->stream_index); av_freep(&s->programs[i]); } av_freep(&s->programs); av_freep(&s->priv_data); while(s->nb_chapters--) { av_dict_free(&s->chapters[s->nb_chapters]->metadata); av_free(s->chapters[s->nb_chapters]); } av_freep(&s->chapters); av_dict_free(&s->metadata); av_freep(&s->streams); av_free(s); } libavformat/segment.c:293: error: Integer Overflow L1 ([-oo, 0] - 1):unsigned32 by call to `avformat_free_context`. libavformat/segment.c:289:15: Call 287. close_null_ctx(oc->pb); 288. } else { 289. ret = segment_end(oc, 1); ^ 290. } 291. if (seg->list) libavformat/segment.c:111:1: Parameter `*oc->packet_buffer->next` 109. } 110. 111. static int segment_end(AVFormatContext *oc, int write_trailer) ^ 112. { 113. int ret = 0; libavformat/segment.c:117:9: Call 115. av_write_frame(oc, NULL); /* Flush any buffered data (fragmented mp4) */ 116. if (write_trailer) 117. av_write_trailer(oc); ^ 118. avio_close(oc->pb); 119. libavformat/mux.c:565:1: Parameter `*s->packet_buffer->next` 563. } 564. 565. int av_write_trailer(AVFormatContext *s) ^ 566. { 567. int ret, i; libavformat/mux.c:571:15: Call 569. for (;; ) { 570. AVPacket pkt; 571. ret = interleave_packet(s, &pkt, NULL, 1); ^ 572. if (ret < 0) //FIXME cleanup needed for ret<0 ? 573. goto fail; libavformat/mux.c:513:1: Parameter `*s->packet_buffer->next` 511. * < 0 if an error occurred 512. */ 513. static int interleave_packet(AVFormatContext *s, AVPacket *out, AVPacket *in, int flush) ^ 514. { 515. if (s->oformat->interleave_packet) { libavformat/segment.c:293:5: Call 291. if (seg->list) 292. avio_close(seg->pb); 293. avformat_free_context(oc); ^ 294. return ret; 295. } libavformat/utils.c:2623:1: <LHS trace> 2621. } 2622. 2623. void avformat_free_context(AVFormatContext *s) ^ 2624. { 2625. int i; libavformat/utils.c:2623:1: Parameter `s->nb_chapters` 2621. } 2622. 2623. void avformat_free_context(AVFormatContext *s) ^ 2624. { 2625. int i; libavformat/utils.c:2656:11: Binary operation: ([-oo, 0] - 1):unsigned32 by call to `avformat_free_context` 2654. av_freep(&s->programs); 2655. av_freep(&s->priv_data); 2656. while(s->nb_chapters--) { ^ 2657. av_dict_free(&s->chapters[s->nb_chapters]->metadata); 2658. av_free(s->chapters[s->nb_chapters]);
https://github.com/libav/libav/blob/a7329e5fc22433dfeaf7af22fb40fe3cada21385/libavformat/utils.c/#L2656
d2a_code_trace_data_44908
static int var_diamond_search(MpegEncContext * s, int *best, int dmin, int src_index, int ref_index, int const penalty_factor, int size, int h, int flags) { MotionEstContext * const c= &s->me; me_cmp_func cmpf, chroma_cmpf; int dia_size; LOAD_COMMON LOAD_COMMON2 int map_generation= c->map_generation; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; for(dia_size=1; dia_size<=c->dia_size; dia_size++){ int dir, start, end; const int x= best[0]; const int y= best[1]; start= FFMAX(0, y + dia_size - ymax); end = FFMIN(dia_size, xmax - x + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x + dir , y + dia_size - dir); } start= FFMAX(0, x + dia_size - xmax); end = FFMIN(dia_size, y - ymin + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x + dia_size - dir, y - dir ); } start= FFMAX(0, -y + dia_size + ymin ); end = FFMIN(dia_size, x - xmin + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x - dir , y - dia_size + dir); } start= FFMAX(0, -x + dia_size + xmin ); end = FFMIN(dia_size, ymax - y + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x - dia_size + dir, y + dir ); } if(x!=best[0] || y!=best[1]) dia_size=0; #if 0 { int dx, dy, i; static int stats[8*8]; dx= FFABS(x-best[0]); dy= FFABS(y-best[1]); stats[dy*8 + dx] ++; if(256*256*256*64 % (stats[0]+1)==0){ for(i=0; i<64; i++){ if((i&7)==0) printf("\n"); printf("%6d ", stats[i]); } printf("\n"); } } #endif } return dmin; } libavcodec/motion_est_template.c:921: error: Uninitialized Value The value read from ymax was never initialized. libavcodec/motion_est_template.c:921:13: 919. 920. //check(x + dir,y + dia_size - dir,0, a0) 921. CHECK_MV(x + dir , y + dia_size - dir); ^ 922. } 923.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L921
d2a_code_trace_data_44909
void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){ int i; InternalBuffer *buf, *last; AVCodecInternal *avci = s->internal; assert(s->codec_type == AVMEDIA_TYPE_VIDEO); assert(pic->type==FF_BUFFER_TYPE_INTERNAL); assert(avci->buffer_count); if (avci->buffer) { buf = NULL; for (i = 0; i < avci->buffer_count; i++) { buf = &avci->buffer[i]; if (buf->data[0] == pic->data[0]) break; } assert(i < avci->buffer_count); avci->buffer_count--; last = &avci->buffer[avci->buffer_count]; if (buf != last) FFSWAP(InternalBuffer, *buf, *last); } for (i = 0; i < AV_NUM_DATA_POINTERS; i++) { pic->data[i]=NULL; } if(s->debug&FF_DEBUG_BUFFERS) av_log(s, AV_LOG_DEBUG, "default_release_buffer called on pic %p, %d " "buffers used\n", pic, avci->buffer_count); } libavcodec/utils.c:505: error: Null Dereference pointer `buf` last assigned on line 494 could be null and is dereferenced at line 505, column 13. libavcodec/utils.c:483:1: start of procedure avcodec_default_release_buffer() 481. } 482. 483. void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){ ^ 484. int i; 485. InternalBuffer *buf, *last; libavcodec/utils.c:486:5: 484. int i; 485. InternalBuffer *buf, *last; 486. AVCodecInternal *avci = s->internal; ^ 487. 488. assert(s->codec_type == AVMEDIA_TYPE_VIDEO); libavcodec/utils.c:488:5: 486. AVCodecInternal *avci = s->internal; 487. 488. assert(s->codec_type == AVMEDIA_TYPE_VIDEO); ^ 489. 490. assert(pic->type==FF_BUFFER_TYPE_INTERNAL); libavcodec/utils.c:490:5: 488. assert(s->codec_type == AVMEDIA_TYPE_VIDEO); 489. 490. assert(pic->type==FF_BUFFER_TYPE_INTERNAL); ^ 491. assert(avci->buffer_count); 492. libavcodec/utils.c:491:5: 489. 490. assert(pic->type==FF_BUFFER_TYPE_INTERNAL); 491. assert(avci->buffer_count); ^ 492. 493. if (avci->buffer) { libavcodec/utils.c:493:9: Taking true branch 491. assert(avci->buffer_count); 492. 493. if (avci->buffer) { ^ 494. buf = NULL; /* avoids warning */ 495. for (i = 0; i < avci->buffer_count; i++) { //just 3-5 checks so is not worth to optimize libavcodec/utils.c:494:9: 492. 493. if (avci->buffer) { 494. buf = NULL; /* avoids warning */ ^ 495. for (i = 0; i < avci->buffer_count; i++) { //just 3-5 checks so is not worth to optimize 496. buf = &avci->buffer[i]; libavcodec/utils.c:495:14: 493. if (avci->buffer) { 494. buf = NULL; /* avoids warning */ 495. for (i = 0; i < avci->buffer_count; i++) { //just 3-5 checks so is not worth to optimize ^ 496. buf = &avci->buffer[i]; 497. if (buf->data[0] == pic->data[0]) libavcodec/utils.c:495:21: Loop condition is false. Leaving loop 493. if (avci->buffer) { 494. buf = NULL; /* avoids warning */ 495. for (i = 0; i < avci->buffer_count; i++) { //just 3-5 checks so is not worth to optimize ^ 496. buf = &avci->buffer[i]; 497. if (buf->data[0] == pic->data[0]) libavcodec/utils.c:500:9: 498. break; 499. } 500. assert(i < avci->buffer_count); ^ 501. avci->buffer_count--; 502. last = &avci->buffer[avci->buffer_count]; libavcodec/utils.c:501:9: 499. } 500. assert(i < avci->buffer_count); 501. avci->buffer_count--; ^ 502. last = &avci->buffer[avci->buffer_count]; 503. libavcodec/utils.c:502:9: 500. assert(i < avci->buffer_count); 501. avci->buffer_count--; 502. last = &avci->buffer[avci->buffer_count]; ^ 503. 504. if (buf != last) libavcodec/utils.c:504:13: Taking true branch 502. last = &avci->buffer[avci->buffer_count]; 503. 504. if (buf != last) ^ 505. FFSWAP(InternalBuffer, *buf, *last); 506. } libavcodec/utils.c:505:13: 503. 504. if (buf != last) 505. FFSWAP(InternalBuffer, *buf, *last); ^ 506. } 507.
https://github.com/libav/libav/blob/2a216ca2ef29282cac9003a716b469b8c80c0a15/libavcodec/utils.c/#L505
d2a_code_trace_data_44910
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_exp.c:1096: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `bn_mul_mont_fixed_top`. Showing all 18 steps of the trace 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/bn/bn_exp.c:636:5: Call 634. } 635. 636. BN_CTX_start(ctx); ^ 637. 638. /* crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_exp.c:757:10: Call 755. 756. /* prepare a^1 in Montgomery domain */ 757. if (!bn_to_mont_fixed_top(&am, a, mont, ctx)) ^ 758. goto err; 759. 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/bn/bn_exp.c:1096:18: Call 1094. 1095. /* Multiply the result into the intermediate result */ 1096. if (!bn_mul_mont_fixed_top(&tmp, &tmp, &am, mont, ctx)) ^ 1097. goto err; 1098. } 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.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_mont.c:83:5: Call 81. ret = 1; 82. err: 83. BN_CTX_end(ctx); ^ 84. return ret; 85. } 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_44911
static void old_print_object_header(const char *name) { char *str, *p; if (!strcmp(name, "tags")) return; str = p = av_strdup(name); if (!str) return; while (*p) { *p = av_toupper(*p); p++; } avio_printf(probe_out, "[%s]\n", str); av_freep(&str); } avprobe.c:354: error: Memory Leak memory dynamically allocated by call to `av_strdup()` at line 345, column 15 is not reachable after line 354, column 5. avprobe.c:338:1: start of procedure old_print_object_header() 336. * old-style pseudo-INI 337. */ 338. static void old_print_object_header(const char *name) ^ 339. { 340. char *str, *p; avprobe.c:342:10: Taking false branch 340. char *str, *p; 341. 342. if (!strcmp(name, "tags")) ^ 343. return; 344. avprobe.c:345:5: 343. return; 344. 345. str = p = av_strdup(name); ^ 346. if (!str) 347. return; libavutil/mem.c:219:1: start of procedure av_strdup() 217. } 218. 219. char *av_strdup(const char *s) ^ 220. { 221. char *ptr = NULL; libavutil/mem.c:221:5: 219. char *av_strdup(const char *s) 220. { 221. char *ptr = NULL; ^ 222. if (s) { 223. int len = strlen(s) + 1; libavutil/mem.c:222:9: Taking true branch 220. { 221. char *ptr = NULL; 222. if (s) { ^ 223. int len = strlen(s) + 1; 224. ptr = av_realloc(NULL, len); libavutil/mem.c:223:9: 221. char *ptr = NULL; 222. if (s) { 223. int len = strlen(s) + 1; ^ 224. ptr = av_realloc(NULL, len); 225. if (ptr) libavutil/mem.c:224:9: 222. if (s) { 223. int len = strlen(s) + 1; 224. ptr = av_realloc(NULL, len); ^ 225. if (ptr) 226. memcpy(ptr, s, len); libavutil/mem.c:117:1: start of procedure av_realloc() 115. } 116. 117. void *av_realloc(void *ptr, size_t size) ^ 118. { 119. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:124:9: Taking false branch 122. 123. /* let's disallow possibly ambiguous cases */ 124. if (size > (INT_MAX - 16)) ^ 125. return NULL; 126. libavutil/mem.c:136:5: 134. return _aligned_realloc(ptr, size, 32); 135. #else 136. return realloc(ptr, size); ^ 137. #endif 138. } libavutil/mem.c:138:1: return from a call to av_realloc 136. return realloc(ptr, size); 137. #endif 138. } ^ 139. 140. int av_reallocp(void *ptr, size_t size) libavutil/mem.c:225:13: Taking true branch 223. int len = strlen(s) + 1; 224. ptr = av_realloc(NULL, len); 225. if (ptr) ^ 226. memcpy(ptr, s, len); 227. } libavutil/mem.c:226:13: 224. ptr = av_realloc(NULL, len); 225. if (ptr) 226. memcpy(ptr, s, len); ^ 227. } 228. return ptr; libavutil/mem.c:228:5: 226. memcpy(ptr, s, len); 227. } 228. return ptr; ^ 229. } 230. libavutil/mem.c:229:1: return from a call to av_strdup 227. } 228. return ptr; 229. } ^ 230. 231. char *av_strndup(const char *s, size_t len) avprobe.c:346:10: Taking false branch 344. 345. str = p = av_strdup(name); 346. if (!str) ^ 347. return; 348. while (*p) { avprobe.c:348:12: Loop condition is true. Entering loop body 346. if (!str) 347. return; 348. while (*p) { ^ 349. *p = av_toupper(*p); 350. p++; avprobe.c:349:9: 347. return; 348. while (*p) { 349. *p = av_toupper(*p); ^ 350. p++; 351. } libavutil/avstring.h:182:1: start of procedure av_toupper() 180. * Locale-independent conversion of ASCII characters to uppercase. 181. */ 182. static inline av_const int av_toupper(int c) ^ 183. { 184. if (c >= 'a' && c <= 'z') libavutil/avstring.h:184:9: Taking false branch 182. static inline av_const int av_toupper(int c) 183. { 184. if (c >= 'a' && c <= 'z') ^ 185. c ^= 0x20; 186. return c; libavutil/avstring.h:186:5: 184. if (c >= 'a' && c <= 'z') 185. c ^= 0x20; 186. return c; ^ 187. } 188. libavutil/avstring.h:187:1: return from a call to av_toupper 185. c ^= 0x20; 186. return c; 187. } ^ 188. 189. /** avprobe.c:350:9: 348. while (*p) { 349. *p = av_toupper(*p); 350. p++; ^ 351. } 352. avprobe.c:348:12: Loop condition is false. Leaving loop 346. if (!str) 347. return; 348. while (*p) { ^ 349. *p = av_toupper(*p); 350. p++; avprobe.c:353:5: 351. } 352. 353. avio_printf(probe_out, "[%s]\n", str); ^ 354. av_freep(&str); 355. } libavformat/aviobuf.c:963:1: start of procedure avio_printf() 961. } 962. 963. int avio_printf(AVIOContext *s, const char *fmt, ...) ^ 964. { 965. va_list ap; libavformat/aviobuf.c:969:5: 967. int ret; 968. 969. va_start(ap, fmt); ^ 970. ret = vsnprintf(buf, sizeof(buf), fmt, ap); 971. va_end(ap); libavformat/aviobuf.c:970:5: 968. 969. va_start(ap, fmt); 970. ret = vsnprintf(buf, sizeof(buf), fmt, ap); ^ 971. va_end(ap); 972. avio_write(s, buf, strlen(buf)); libavformat/aviobuf.c:971:5: 969. va_start(ap, fmt); 970. ret = vsnprintf(buf, sizeof(buf), fmt, ap); 971. va_end(ap); ^ 972. avio_write(s, buf, strlen(buf)); 973. return ret; libavformat/aviobuf.c:972:5: Skipping avio_write(): empty list of specs 970. ret = vsnprintf(buf, sizeof(buf), fmt, ap); 971. va_end(ap); 972. avio_write(s, buf, strlen(buf)); ^ 973. return ret; 974. } libavformat/aviobuf.c:973:5: 971. va_end(ap); 972. avio_write(s, buf, strlen(buf)); 973. return ret; ^ 974. } 975. libavformat/aviobuf.c:974:1: return from a call to avio_printf 972. avio_write(s, buf, strlen(buf)); 973. return ret; 974. } ^ 975. 976. int avio_pause(AVIOContext *s, int pause) avprobe.c:354:5: Skipping av_freep(): empty list of specs 352. 353. avio_printf(probe_out, "[%s]\n", str); 354. av_freep(&str); ^ 355. } 356.
https://github.com/libav/libav/blob/8e757716c61e0563a63829e30b02d5ba2a422ad6/avprobe.c/#L354
d2a_code_trace_data_44912
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/dtlstest.c:89: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `SSL_free`. Showing all 17 steps of the trace test/dtlstest.c:64:10: Call 62. 63. /* BIO is freed by create_ssl_connection on error */ 64. if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl1, &clientssl1, ^ 65. NULL, c_to_s_fbio))) 66. goto end; test/ssltestlib.c:580:21: Call 578. 579. if (*sssl == NULL) 580. serverssl = SSL_new(serverctx); ^ 581. else 582. serverssl = *sssl; ssl/ssl_lib.c:521:1: Parameter `ctx->sessions->num_nodes` 519. } 520. 521. > SSL *SSL_new(SSL_CTX *ctx) 522. { 523. SSL *s; test/dtlstest.c:89:5: Call 87. testresult = 1; 88. end: 89. SSL_free(serverssl1); ^ 90. SSL_free(clientssl1); 91. SSL_CTX_free(sctx); ssl/ssl_lib.c:963:1: Parameter `s->ctx->sessions->num_nodes` 961. } 962. 963. > void SSL_free(SSL *s) 964. { 965. int i; ssl/ssl_lib.c:1030:5: Call 1028. RECORD_LAYER_release(&s->rlayer); 1029. 1030. SSL_CTX_free(s->ctx); ^ 1031. 1032. ASYNC_WAIT_CTX_free(s->waitctx); ssl/ssl_lib.c:2780:1: Parameter `a->sessions->num_nodes` 2778. } 2779. 2780. > void SSL_CTX_free(SSL_CTX *a) 2781. { 2782. int i; ssl/ssl_lib.c:2806:9: Call 2804. */ 2805. if (a->sessions != NULL) 2806. SSL_CTX_flush_sessions(a, 0); ^ 2807. 2808. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:1021:1: Parameter `s->sessions->num_nodes` 1019. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1020. 1021. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 1022. { 1023. unsigned long i; ssl/ssl_sess.c:1034:5: Call 1032. i = lh_SSL_SESSION_get_down_load(s->sessions); 1033. lh_SSL_SESSION_set_down_load(s->sessions, 0); 1034. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp); ^ 1035. lh_SSL_SESSION_set_down_load(s->sessions, i); 1036. CRYPTO_THREAD_unlock(s->lock); ssl/ssl_sess.c:1019:1: Parameter `lh->num_nodes` 1017. } 1018. 1019. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1020. 1021. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) ssl/ssl_sess.c:1019:1: Call 1017. } 1018. 1019. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1020. 1021. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) crypto/lhash/lhash.c:182:1: Parameter `lh->num_nodes` 180. } 181. 182. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); crypto/lhash/lhash.c:184:5: Call 182. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); ^ 185. } 186. crypto/lhash/lhash.c:150:1: <LHS trace> 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:150:1: Parameter `lh->num_nodes` 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:164:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `SSL_free` 162. * memory leaks otherwise 163. */ 164. for (i = lh->num_nodes - 1; i >= 0; i--) { ^ 165. a = lh->b[i]; 166. while (a != NULL) {
https://github.com/openssl/openssl/blob/fe55c4a20f79c77c64a082c5df2c5e8a61317162/crypto/lhash/lhash.c/#L164
d2a_code_trace_data_44913
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dsa/dsa_ossl.c:95: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul`. Showing all 17 steps of the trace crypto/dsa/dsa_ossl.c:81:10: Call 79. goto err; 80. redo: 81. if (!dsa_sign_setup(dsa, ctx, &kinv, &ret->r, dgst, dlen)) ^ 82. goto err; 83. crypto/dsa/dsa_ossl.c:133:1: Parameter `ctx_in->stack.depth` 131. } 132. 133. > static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, 134. BIGNUM **kinvp, BIGNUM **rp, 135. const unsigned char *dgst, int dlen) crypto/dsa/dsa_ossl.c:95:10: Call 93. 94. /* Compute s = inv(k) (m + xr) mod q */ 95. if (!BN_mod_mul(xr, dsa->priv_key, ret->r, dsa->q, ctx)) ^ 96. goto err; /* s = xr */ 97. if (!BN_add(ret->s, xr, m)) crypto/bn/bn_mod.c:73:1: Parameter `ctx->stack.depth` 71. 72. /* slow but works */ 73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 74. BN_CTX *ctx) 75. { crypto/bn/bn_mod.c:83:5: Call 81. bn_check_top(m); 82. 83. BN_CTX_start(ctx); ^ 84. if ((t = BN_CTX_get(ctx)) == NULL) 85. 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_mod.c:90:14: Call 88. goto err; 89. } else { 90. if (!BN_mul(t, a, b, ctx)) ^ 91. goto err; 92. } crypto/bn/bn_mul.c:855:5: Call 853. top = al + bl; 854. 855. BN_CTX_start(ctx); ^ 856. if ((r == a) || (r == b)) { 857. if ((rr = BN_CTX_get(ctx)) == NULL) crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/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.indexes` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:271:1: <Offset trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `st->depth` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: <Length trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `*st->indexes` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:273:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_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/69588edbaa424beb71c6a9b1be416588232cb78c/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_44914
MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt) { EVP_PKEY *pkey = NULL; unsigned char *sig, *data; int al, ret = MSG_PROCESS_ERROR; int type = 0, i, j; unsigned int len; X509 *peer; const EVP_MD *md = NULL; EVP_MD_CTX mctx; EVP_MD_CTX_init(&mctx); peer = s->session->peer; pkey = X509_get_pubkey(peer); type = X509_certificate_type(peer, pkey); if (!(type & EVP_PKT_SIGN)) { SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE); al = SSL_AD_ILLEGAL_PARAMETER; goto f_err; } if (PACKET_remaining(pkt) == 64 && pkey->type == NID_id_GostR3410_2001) { len = 64; } else { if (SSL_USE_SIGALGS(s)) { int rv; if (!PACKET_get_bytes(pkt, &sig, 2)) { al = SSL_AD_DECODE_ERROR; goto f_err; } rv = tls12_check_peer_sigalg(&md, s, sig, pkey); if (rv == -1) { al = SSL_AD_INTERNAL_ERROR; goto f_err; } else if (rv == 0) { al = SSL_AD_DECODE_ERROR; goto f_err; } #ifdef SSL_DEBUG fprintf(stderr, "USING TLSv1.2 HASH %s\n", EVP_MD_name(md)); #endif } if (!PACKET_get_net_2(pkt, &len)) { SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_LENGTH_MISMATCH); al = SSL_AD_DECODE_ERROR; goto f_err; } } j = EVP_PKEY_size(pkey); if (((int)len > j) || ((int)PACKET_remaining(pkt) > j) || (PACKET_remaining(pkt) == 0)) { SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_WRONG_SIGNATURE_SIZE); al = SSL_AD_DECODE_ERROR; goto f_err; } if (!PACKET_get_bytes(pkt, &data, len)) { SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_LENGTH_MISMATCH); al = SSL_AD_DECODE_ERROR; goto f_err; } if (SSL_USE_SIGALGS(s) || pkey->type == NID_id_GostR3410_2001 || pkey->type == NID_id_GostR3410_2012_256 || pkey->type == NID_id_GostR3410_2012_512) { long hdatalen = 0; void *hdata; hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata); if (hdatalen <= 0) { SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_INTERNAL_ERROR); al = SSL_AD_INTERNAL_ERROR; goto f_err; } #ifdef SSL_DEBUG fprintf(stderr, "Using TLS 1.2 with client verify alg %s\n", EVP_MD_name(md)); #endif if (!SSL_USE_SIGALGS(s)) { int dgst_nid; if (EVP_PKEY_get_default_digest_nid(pkey, &dgst_nid) <= 0 || (md = EVP_get_digestbynid(dgst_nid)) == NULL) { SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_INTERNAL_ERROR); al = SSL_AD_INTERNAL_ERROR; goto f_err; } } if (!EVP_VerifyInit_ex(&mctx, md, NULL) || !EVP_VerifyUpdate(&mctx, hdata, hdatalen)) { SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_EVP_LIB); al = SSL_AD_INTERNAL_ERROR; goto f_err; } if (pkey->type == NID_id_GostR3410_2001 || pkey->type == NID_id_GostR3410_2012_256 || pkey->type == NID_id_GostR3410_2012_512) { unsigned int j1, j2; for (j1 = len - 1, j2 = 0; j2 < len/2; j2++, j1--) { char c = data[j2]; data[j2] = data[j1]; data[j1] = c; } } if (EVP_VerifyFinal(&mctx, data, len, pkey) <= 0) { al = SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_BAD_SIGNATURE); goto f_err; } } else #ifndef OPENSSL_NO_RSA if (pkey->type == EVP_PKEY_RSA) { i = RSA_verify(NID_md5_sha1, s->s3->tmp.cert_verify_md, MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH, data, len, pkey->pkey.rsa); if (i < 0) { al = SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_BAD_RSA_DECRYPT); goto f_err; } if (i == 0) { al = SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_BAD_RSA_SIGNATURE); goto f_err; } } else #endif #ifndef OPENSSL_NO_DSA if (pkey->type == EVP_PKEY_DSA) { j = DSA_verify(pkey->save_type, &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]), SHA_DIGEST_LENGTH, data, len, pkey->pkey.dsa); if (j <= 0) { al = SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_BAD_DSA_SIGNATURE); goto f_err; } } else #endif #ifndef OPENSSL_NO_EC if (pkey->type == EVP_PKEY_EC) { j = ECDSA_verify(pkey->save_type, &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]), SHA_DIGEST_LENGTH, data, len, pkey->pkey.ec); if (j <= 0) { al = SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE); goto f_err; } } else #endif { SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_INTERNAL_ERROR); al = SSL_AD_UNSUPPORTED_CERTIFICATE; goto f_err; } ret = MSG_PROCESS_CONTINUE_PROCESSING; if (0) { f_err: ssl3_send_alert(s, SSL3_AL_FATAL, al); ossl_statem_set_error(s); } BIO_free(s->s3->handshake_buffer); s->s3->handshake_buffer = NULL; EVP_MD_CTX_cleanup(&mctx); EVP_PKEY_free(pkey); return ret; } ssl/statem/statem_srvr.c:3062: error: NULL_DEREFERENCE pointer `pkey` last assigned on line 3047 could be null and is dereferenced at line 3062, column 40. Showing all 23 steps of the trace ssl/statem/statem_srvr.c:3034:1: start of procedure tls_process_cert_verify() 3032. } 3033. 3034. > MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt) 3035. { 3036. EVP_PKEY *pkey = NULL; ssl/statem/statem_srvr.c:3036:5: 3034. MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt) 3035. { 3036. > EVP_PKEY *pkey = NULL; 3037. unsigned char *sig, *data; 3038. int al, ret = MSG_PROCESS_ERROR; ssl/statem/statem_srvr.c:3038:5: 3036. EVP_PKEY *pkey = NULL; 3037. unsigned char *sig, *data; 3038. > int al, ret = MSG_PROCESS_ERROR; 3039. int type = 0, i, j; 3040. unsigned int len; ssl/statem/statem_srvr.c:3039:5: 3037. unsigned char *sig, *data; 3038. int al, ret = MSG_PROCESS_ERROR; 3039. > int type = 0, i, j; 3040. unsigned int len; 3041. X509 *peer; ssl/statem/statem_srvr.c:3042:5: 3040. unsigned int len; 3041. X509 *peer; 3042. > const EVP_MD *md = NULL; 3043. EVP_MD_CTX mctx; 3044. EVP_MD_CTX_init(&mctx); ssl/statem/statem_srvr.c:3044:5: 3042. const EVP_MD *md = NULL; 3043. EVP_MD_CTX mctx; 3044. > EVP_MD_CTX_init(&mctx); 3045. 3046. peer = s->session->peer; crypto/evp/digest.c:120:1: start of procedure EVP_MD_CTX_init() 118. #endif 119. 120. > void EVP_MD_CTX_init(EVP_MD_CTX *ctx) 121. { 122. memset(ctx, 0, sizeof(*ctx)); crypto/evp/digest.c:122:5: 120. void EVP_MD_CTX_init(EVP_MD_CTX *ctx) 121. { 122. > memset(ctx, 0, sizeof(*ctx)); 123. } 124. crypto/evp/digest.c:123:1: return from a call to EVP_MD_CTX_init 121. { 122. memset(ctx, 0, sizeof(*ctx)); 123. > } 124. 125. EVP_MD_CTX *EVP_MD_CTX_create(void) ssl/statem/statem_srvr.c:3046:5: 3044. EVP_MD_CTX_init(&mctx); 3045. 3046. > peer = s->session->peer; 3047. pkey = X509_get_pubkey(peer); 3048. type = X509_certificate_type(peer, pkey); ssl/statem/statem_srvr.c:3047:5: 3045. 3046. peer = s->session->peer; 3047. > pkey = X509_get_pubkey(peer); 3048. type = X509_certificate_type(peer, pkey); 3049. crypto/x509/x509_cmp.c:305:1: start of procedure X509_get_pubkey() 303. } 304. 305. > EVP_PKEY *X509_get_pubkey(X509 *x) 306. { 307. if (x == NULL) crypto/x509/x509_cmp.c:307:9: Taking true branch 305. EVP_PKEY *X509_get_pubkey(X509 *x) 306. { 307. if (x == NULL) ^ 308. return (NULL); 309. return (X509_PUBKEY_get(x->cert_info.key)); crypto/x509/x509_cmp.c:308:9: 306. { 307. if (x == NULL) 308. > return (NULL); 309. return (X509_PUBKEY_get(x->cert_info.key)); 310. } crypto/x509/x509_cmp.c:310:1: return from a call to X509_get_pubkey 308. return (NULL); 309. return (X509_PUBKEY_get(x->cert_info.key)); 310. > } 311. 312. ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x) ssl/statem/statem_srvr.c:3048:5: Skipping X509_certificate_type(): empty list of specs 3046. peer = s->session->peer; 3047. pkey = X509_get_pubkey(peer); 3048. type = X509_certificate_type(peer, pkey); ^ 3049. 3050. if (!(type & EVP_PKT_SIGN)) { ssl/statem/statem_srvr.c:3050:11: Taking false branch 3048. type = X509_certificate_type(peer, pkey); 3049. 3050. if (!(type & EVP_PKT_SIGN)) { ^ 3051. SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, 3052. SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE); ssl/statem/statem_srvr.c:3062:9: 3060. * length field (CryptoPro implementations at least till CSP 4.0) 3061. */ 3062. > if (PACKET_remaining(pkt) == 64 && pkey->type == NID_id_GostR3410_2001) { 3063. len = 64; 3064. } else { ssl/packet_locl.h:89:1: start of procedure PACKET_remaining() 87. * Returns the number of bytes remaining to be read in the PACKET 88. */ 89. > static inline size_t PACKET_remaining(const PACKET *pkt) 90. { 91. return pkt->remaining; ssl/packet_locl.h:91:5: 89. static inline size_t PACKET_remaining(const PACKET *pkt) 90. { 91. > return pkt->remaining; 92. } 93. ssl/packet_locl.h:92:1: return from a call to PACKET_remaining 90. { 91. return pkt->remaining; 92. > } 93. 94. /* ssl/statem/statem_srvr.c:3062:9: Taking true branch 3060. * length field (CryptoPro implementations at least till CSP 4.0) 3061. */ 3062. if (PACKET_remaining(pkt) == 64 && pkey->type == NID_id_GostR3410_2001) { ^ 3063. len = 64; 3064. } else { ssl/statem/statem_srvr.c:3062:40: 3060. * length field (CryptoPro implementations at least till CSP 4.0) 3061. */ 3062. > if (PACKET_remaining(pkt) == 64 && pkey->type == NID_id_GostR3410_2001) { 3063. len = 64; 3064. } else {
https://github.com/openssl/openssl/blob/de17db915e26452819692fd837d788d52b8dd48a/ssl/statem/statem_srvr.c/#L3062
d2a_code_trace_data_44915
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:198: error: USE_AFTER_FREE call to `EVP_MD_CTX_free()` eventually accesses memory that was invalidated by call to `free()` on line 197 indirectly during the call to `hmac_ctx_cleanup()`. Showing all 16 steps of the trace crypto/hmac/hmac.c:194:1: invalidation part of the trace starts here 192. } 193. 194. > void HMAC_CTX_free(HMAC_CTX *ctx) 195. { 196. if (ctx != NULL) { crypto/hmac/hmac.c:194:1: parameter `ctx` of HMAC_CTX_free 192. } 193. 194. > void HMAC_CTX_free(HMAC_CTX *ctx) 195. { 196. if (ctx != NULL) { crypto/hmac/hmac.c:197:9: when calling `hmac_ctx_cleanup` here 195. { 196. if (ctx != NULL) { 197. hmac_ctx_cleanup(ctx); ^ 198. EVP_MD_CTX_free(ctx->i_ctx); 199. EVP_MD_CTX_free(ctx->o_ctx); 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:186:5: when calling `EVP_MD_CTX_reset` here 184. static void hmac_ctx_cleanup(HMAC_CTX *ctx) 185. { 186. EVP_MD_CTX_reset(ctx->i_ctx); ^ 187. EVP_MD_CTX_reset(ctx->o_ctx); 188. EVP_MD_CTX_reset(ctx->md_ctx); 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:194:1: use-after-lifetime part of the trace starts here 192. } 193. 194. > void HMAC_CTX_free(HMAC_CTX *ctx) 195. { 196. if (ctx != NULL) { crypto/hmac/hmac.c:194:1: parameter `ctx` of HMAC_CTX_free 192. } 193. 194. > void HMAC_CTX_free(HMAC_CTX *ctx) 195. { 196. if (ctx != NULL) { crypto/hmac/hmac.c:198:9: when calling `EVP_MD_CTX_free` here 196. if (ctx != NULL) { 197. hmac_ctx_cleanup(ctx); 198. EVP_MD_CTX_free(ctx->i_ctx); ^ 199. EVP_MD_CTX_free(ctx->o_ctx); 200. EVP_MD_CTX_free(ctx->md_ctx); 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_44916
void avformat_close_input(AVFormatContext **ps) { AVFormatContext *s = *ps; AVIOContext *pb = s->pb; if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) || (s->flags & AVFMT_FLAG_CUSTOM_IO)) pb = NULL; flush_packet_queue(s); if (s->iformat) { if (s->iformat->read_close) s->iformat->read_close(s); } avformat_free_context(s); *ps = NULL; avio_close(pb); } libavformat/utils.c:2559: error: Null Dereference pointer `pb` last assigned on line 2546 could be null and is dereferenced by call to `avio_close()` at line 2559, column 5. libavformat/utils.c:2539:1: start of procedure avformat_close_input() 2537. } 2538. 2539. void avformat_close_input(AVFormatContext **ps) ^ 2540. { 2541. AVFormatContext *s = *ps; libavformat/utils.c:2541:5: 2539. void avformat_close_input(AVFormatContext **ps) 2540. { 2541. AVFormatContext *s = *ps; ^ 2542. AVIOContext *pb = s->pb; 2543. libavformat/utils.c:2542:5: 2540. { 2541. AVFormatContext *s = *ps; 2542. AVIOContext *pb = s->pb; ^ 2543. 2544. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) || libavformat/utils.c:2544:10: Taking true branch 2542. AVIOContext *pb = s->pb; 2543. 2544. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) || ^ 2545. (s->flags & AVFMT_FLAG_CUSTOM_IO)) 2546. pb = NULL; libavformat/utils.c:2544:24: Taking false branch 2542. AVIOContext *pb = s->pb; 2543. 2544. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) || ^ 2545. (s->flags & AVFMT_FLAG_CUSTOM_IO)) 2546. pb = NULL; libavformat/utils.c:2545:10: Taking true branch 2543. 2544. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) || 2545. (s->flags & AVFMT_FLAG_CUSTOM_IO)) ^ 2546. pb = NULL; 2547. libavformat/utils.c:2546:9: 2544. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) || 2545. (s->flags & AVFMT_FLAG_CUSTOM_IO)) 2546. pb = NULL; ^ 2547. 2548. flush_packet_queue(s); libavformat/utils.c:2548:5: Skipping flush_packet_queue(): empty list of specs 2546. pb = NULL; 2547. 2548. flush_packet_queue(s); ^ 2549. 2550. if (s->iformat) { libavformat/utils.c:2550:9: Taking true branch 2548. flush_packet_queue(s); 2549. 2550. if (s->iformat) { ^ 2551. if (s->iformat->read_close) 2552. s->iformat->read_close(s); libavformat/utils.c:2551:13: Taking true branch 2549. 2550. if (s->iformat) { 2551. if (s->iformat->read_close) ^ 2552. s->iformat->read_close(s); 2553. } libavformat/utils.c:2552:13: Skipping __function_pointer__(): unresolved function pointer 2550. if (s->iformat) { 2551. if (s->iformat->read_close) 2552. s->iformat->read_close(s); ^ 2553. } 2554. libavformat/utils.c:2555:5: Skipping avformat_free_context(): empty list of specs 2553. } 2554. 2555. avformat_free_context(s); ^ 2556. 2557. *ps = NULL; libavformat/utils.c:2557:5: 2555. avformat_free_context(s); 2556. 2557. *ps = NULL; ^ 2558. 2559. avio_close(pb); libavformat/utils.c:2559:5: 2557. *ps = NULL; 2558. 2559. avio_close(pb); ^ 2560. } 2561. libavformat/aviobuf.c:794:1: start of procedure avio_close() 792. } 793. 794. int avio_close(AVIOContext *s) ^ 795. { 796. URLContext *h; libavformat/aviobuf.c:798:10: Taking false branch 796. URLContext *h; 797. 798. if (!s) ^ 799. return 0; 800. libavformat/aviobuf.c:801:5: 799. return 0; 800. 801. avio_flush(s); ^ 802. h = s->opaque; 803. av_freep(&s->buffer); libavformat/aviobuf.c:180:1: start of procedure avio_flush() 178. } 179. 180. void avio_flush(AVIOContext *s) ^ 181. { 182. flush_buffer(s); libavformat/aviobuf.c:182:5: 180. void avio_flush(AVIOContext *s) 181. { 182. flush_buffer(s); ^ 183. s->must_flush = 0; 184. } libavformat/aviobuf.c:124:1: start of procedure flush_buffer() 122. } 123. 124. static void flush_buffer(AVIOContext *s) ^ 125. { 126. if (s->buf_ptr > s->buffer) { libavformat/aviobuf.c:126:9: 124. static void flush_buffer(AVIOContext *s) 125. { 126. if (s->buf_ptr > s->buffer) { ^ 127. if (s->write_packet && !s->error) { 128. int ret = s->write_packet(s->opaque, s->buffer,
https://github.com/libav/libav/blob/d7b3ee9a3a03ab88d61a5895fbdbc6689f4dd671/libavformat/utils.c/#L2559
d2a_code_trace_data_44917
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } crypto/ec/ecp_smpl.c:850: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_mod_add_quick`. Showing all 18 steps of the trace crypto/ec/ecp_smpl.c:823:10: Call 821. 822. BN_CTX_start(ctx); 823. n0 = BN_CTX_get(ctx); ^ 824. n1 = BN_CTX_get(ctx); 825. n2 = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:229:5: Call 227. } 228. /* OK, make sure the returned bignum is "zero" */ 229. BN_zero(ret); ^ 230. ctx->used++; 231. CTXDBG_RET(ctx, ret); crypto/bn/bn_lib.c:366:15: Assignment 364. a->neg = 0; 365. a->d[0] = w; 366. a->top = (w ? 1 : 0); ^ 367. a->flags &= ~BN_FLG_FIXED_TOP; 368. bn_check_top(a); crypto/bn/bn_lib.c:366:5: Assignment 364. a->neg = 0; 365. a->d[0] = w; 366. a->top = (w ? 1 : 0); ^ 367. a->flags &= ~BN_FLG_FIXED_TOP; 368. bn_check_top(a); crypto/ec/ecp_smpl.c:850:14: Call 848. if (!field_sqr(group, n1, a->Z, ctx)) 849. goto err; 850. if (!BN_mod_add_quick(n0, a->X, n1, p)) ^ 851. goto err; 852. if (!BN_mod_sub_quick(n2, a->X, n1, p)) crypto/bn/bn_mod.c:94:1: Parameter `*r->d` 92. } 93. 94. > int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 95. const BIGNUM *m) 96. { crypto/bn/bn_mod.c:97:15: Call 95. const BIGNUM *m) 96. { 97. int ret = bn_mod_add_fixed_top(r, a, b, m); ^ 98. 99. if (ret) crypto/bn/bn_mod.c:48:1: Parameter `*r->d` 46. * move depending on whether or not subtraction borrowed. 47. */ 48. > int bn_mod_add_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 49. const BIGNUM *m) 50. { crypto/bn/bn_mod.c:56:9: Call 54. const BN_ULONG *ap, *bp; 55. 56. if (bn_wexpand(r, mtop) == NULL) ^ 57. return 0; 58. crypto/bn/bn_lib.c:948:1: Parameter `*a->d` 946. } 947. 948. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:950:37: Call 948. BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 951. } 952. crypto/bn/bn_lib.c:245:1: Parameter `*b->d` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `*b->d` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_mod_add_quick` 230. assert(b->top <= words); 231. if (b->top > 0) 232. memcpy(a, b->d, sizeof(*a) * b->top); ^ 233. 234. return a;
https://github.com/openssl/openssl/blob/793f19e47c69558e39c702da75c27e0509baf379/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_44918
static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func, LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg) { int i; LHASH_NODE *a,*n; if (lh == NULL) return; for (i=lh->num_nodes-1; i>=0; i--) { a=lh->b[i]; while (a != NULL) { n=a->next; if(use_arg) func_arg(a->data,arg); else func(a->data); a=n; } } } apps/ocsp.c:1417: error: INTEGER_OVERFLOW_L2 ([0, 8] - 1):unsigned32 by call to `SSL_CTX_free`. Showing all 13 steps of the trace apps/ocsp.c:1392:9: Call 1390. BIO *sbio; 1391. #if !defined(OPENSSL_NO_SSL2) && !defined(OPENSSL_NO_SSL3) 1392. ctx = SSL_CTX_new(SSLv23_client_method()); ^ 1393. #elif !defined(OPENSSL_NO_SSL3) 1394. ctx = SSL_CTX_new(SSLv3_client_method()); ssl/ssl_lib.c:1759:16: Call 1757. ret->app_verify_cookie_cb=0; 1758. 1759. ret->sessions=lh_SSL_SESSION_new(); ^ 1760. if (ret->sessions == NULL) goto err; 1761. ret->cert_store=X509_STORE_new(); crypto/lhash/lhash.c:127:2: Assignment 125. ret->comp=((c == NULL)?(LHASH_COMP_FN_TYPE)strcmp:c); 126. ret->hash=((h == NULL)?(LHASH_HASH_FN_TYPE)lh_strhash:h); 127. ret->num_nodes=MIN_NODES/2; ^ 128. ret->num_alloc_nodes=MIN_NODES; 129. ret->p=0; apps/ocsp.c:1417:3: Call 1415. BIO_free_all(cbio); 1416. if (ctx) 1417. SSL_CTX_free(ctx); ^ 1418. return resp; 1419. } ssl/ssl_lib.c:1899:1: Parameter `a->sessions->num_nodes` 1897. #endif 1898. 1899. > void SSL_CTX_free(SSL_CTX *a) 1900. { 1901. int i; ssl/ssl_lib.c:1931:3: Call 1929. */ 1930. if (a->sessions != NULL) 1931. SSL_CTX_flush_sessions(a,0); ^ 1932. 1933. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:985:1: Parameter `s->sessions->num_nodes` 983. static IMPLEMENT_LHASH_DOALL_ARG_FN(timeout, SSL_SESSION, TIMEOUT_PARAM) 984. 985. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 986. { 987. unsigned long i; ssl/ssl_sess.c:997:2: Call 995. i=CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load; 996. CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load=0; 997. lh_SSL_SESSION_doall_arg(tp.cache, LHASH_DOALL_ARG_FN(timeout), ^ 998. TIMEOUT_PARAM, &tp); 999. CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load=i; crypto/lhash/lhash.c:305:1: Parameter `lh->num_nodes` 303. } 304. 305. > void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg) 306. { 307. doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg); crypto/lhash/lhash.c:307:2: Call 305. void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg) 306. { 307. doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg); ^ 308. } 309. crypto/lhash/lhash.c:270:1: <LHS trace> 268. } 269. 270. > static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func, 271. LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg) 272. { crypto/lhash/lhash.c:270:1: Parameter `lh->num_nodes` 268. } 269. 270. > static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func, 271. LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg) 272. { crypto/lhash/lhash.c:281:7: Binary operation: ([0, 8] - 1):unsigned32 by call to `SSL_CTX_free` 279. /* reverse the order so we search from 'top to bottom' 280. * We were having memory leaks otherwise */ 281. for (i=lh->num_nodes-1; i>=0; i--) ^ 282. { 283. a=lh->b[i];
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/lhash/lhash.c/#L281
d2a_code_trace_data_44919
int index_index(CA_DB *db) { if (!TXT_DB_create_index(db->db, DB_serial, NULL, LHASH_HASH_FN(index_serial), LHASH_COMP_FN(index_serial))) { BIO_printf(bio_err, "error creating serial number index:(%ld,%ld,%ld)\n", db->db->error, db->db->arg1, db->db->arg2); return 0; } if (db->attributes.unique_subject && !TXT_DB_create_index(db->db, DB_name, index_name_qual, LHASH_HASH_FN(index_name), LHASH_COMP_FN(index_name))) { BIO_printf(bio_err, "error creating name index:(%ld,%ld,%ld)\n", db->db->error, db->db->arg1, db->db->arg2); return 0; } return 1; } apps/apps.c:1624: error: MEMORY_LEAK memory dynamically allocated by call to `TXT_DB_create_index()` at line 1614, column 10 is not reachable after line 1624, column 13. Showing all 137 steps of the trace apps/apps.c:1612:1: start of procedure index_index() 1610. } 1611. 1612. > int index_index(CA_DB *db) 1613. { 1614. if (!TXT_DB_create_index(db->db, DB_serial, NULL, apps/apps.c:1614:10: 1612. int index_index(CA_DB *db) 1613. { 1614. > if (!TXT_DB_create_index(db->db, DB_serial, NULL, 1615. LHASH_HASH_FN(index_serial), 1616. LHASH_COMP_FN(index_serial))) { crypto/txt_db/txt_db.c:196:1: start of procedure TXT_DB_create_index() 194. } 195. 196. > int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *), 197. LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp) 198. { crypto/txt_db/txt_db.c:203:9: Taking false branch 201. int i, n; 202. 203. if (field >= db->num_fields) { ^ 204. db->error = DB_ERROR_INDEX_OUT_OF_RANGE; 205. return (0); crypto/txt_db/txt_db.c:208:9: 206. } 207. /* FIXME: we lose type checking at this point */ 208. > if ((idx = (LHASH_OF(OPENSSL_STRING) *)lh_new(hash, cmp)) == NULL) { 209. db->error = DB_ERROR_MALLOC; 210. return (0); crypto/lhash/lhash.c:113:1: start of procedure lh_new() 111. static LHASH_NODE **getrn(_LHASH *lh, const void *data, unsigned long *rhash); 112. 113. > _LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c) 114. { 115. _LHASH *ret; crypto/lhash/lhash.c:117:9: 115. _LHASH *ret; 116. 117. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) 118. goto err0; 119. if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL) crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/lhash/lhash.c:117:9: Taking false branch 115. _LHASH *ret; 116. 117. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) ^ 118. goto err0; 119. if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL) crypto/lhash/lhash.c:119:9: 117. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) 118. goto err0; 119. > if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL) 120. goto err1; 121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/lhash/lhash.c:119:9: Taking false branch 117. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) 118. goto err0; 119. if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL) ^ 120. goto err1; 121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c); crypto/lhash/lhash.c:121:19: Condition is false 119. if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL) 120. goto err1; 121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c); ^ 122. ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h); 123. ret->num_nodes = MIN_NODES / 2; crypto/lhash/lhash.c:121:18: 119. if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL) 120. goto err1; 121. > ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c); 122. ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h); 123. ret->num_nodes = MIN_NODES / 2; crypto/lhash/lhash.c:121:5: 119. if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL) 120. goto err1; 121. > ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c); 122. ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h); 123. ret->num_nodes = MIN_NODES / 2; crypto/lhash/lhash.c:122:19: Condition is false 120. goto err1; 121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c); 122. ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h); ^ 123. ret->num_nodes = MIN_NODES / 2; 124. ret->num_alloc_nodes = MIN_NODES; crypto/lhash/lhash.c:122:18: 120. goto err1; 121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c); 122. > ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h); 123. ret->num_nodes = MIN_NODES / 2; 124. ret->num_alloc_nodes = MIN_NODES; crypto/lhash/lhash.c:122:5: 120. goto err1; 121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c); 122. > ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h); 123. ret->num_nodes = MIN_NODES / 2; 124. ret->num_alloc_nodes = MIN_NODES; crypto/lhash/lhash.c:123:5: 121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c); 122. ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h); 123. > ret->num_nodes = MIN_NODES / 2; 124. ret->num_alloc_nodes = MIN_NODES; 125. ret->pmax = MIN_NODES / 2; crypto/lhash/lhash.c:124:5: 122. ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h); 123. ret->num_nodes = MIN_NODES / 2; 124. > ret->num_alloc_nodes = MIN_NODES; 125. ret->pmax = MIN_NODES / 2; 126. ret->up_load = UP_LOAD; crypto/lhash/lhash.c:125:5: 123. ret->num_nodes = MIN_NODES / 2; 124. ret->num_alloc_nodes = MIN_NODES; 125. > ret->pmax = MIN_NODES / 2; 126. ret->up_load = UP_LOAD; 127. ret->down_load = DOWN_LOAD; crypto/lhash/lhash.c:126:5: 124. ret->num_alloc_nodes = MIN_NODES; 125. ret->pmax = MIN_NODES / 2; 126. > ret->up_load = UP_LOAD; 127. ret->down_load = DOWN_LOAD; 128. return (ret); crypto/lhash/lhash.c:127:5: 125. ret->pmax = MIN_NODES / 2; 126. ret->up_load = UP_LOAD; 127. > ret->down_load = DOWN_LOAD; 128. return (ret); 129. crypto/lhash/lhash.c:128:5: 126. ret->up_load = UP_LOAD; 127. ret->down_load = DOWN_LOAD; 128. > return (ret); 129. 130. err1: crypto/lhash/lhash.c:134:1: return from a call to lh_new 132. err0: 133. return (NULL); 134. > } 135. 136. void lh_free(_LHASH *lh) crypto/txt_db/txt_db.c:208:9: Taking false branch 206. } 207. /* FIXME: we lose type checking at this point */ 208. if ((idx = (LHASH_OF(OPENSSL_STRING) *)lh_new(hash, cmp)) == NULL) { ^ 209. db->error = DB_ERROR_MALLOC; 210. return (0); crypto/txt_db/txt_db.c:212:5: 210. return (0); 211. } 212. > n = sk_OPENSSL_PSTRING_num(db->data); 213. for (i = 0; i < n; i++) { 214. r = sk_OPENSSL_PSTRING_value(db->data, i); include/openssl/txt_db.h:80:1: start of procedure sk_OPENSSL_PSTRING_num() 78. 79. typedef OPENSSL_STRING *OPENSSL_PSTRING; 80. > DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING) 81. 82. typedef struct txt_db_st { 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 true branch 317. int sk_num(const _STACK *st) 318. { 319. if (st == NULL) ^ 320. return -1; 321. return st->num; crypto/stack/stack.c:320:9: 318. { 319. if (st == NULL) 320. > return -1; 321. return st->num; 322. } 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) include/openssl/txt_db.h:80:1: return from a call to sk_OPENSSL_PSTRING_num 78. 79. typedef OPENSSL_STRING *OPENSSL_PSTRING; 80. > DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING) 81. 82. typedef struct txt_db_st { crypto/txt_db/txt_db.c:213:10: 211. } 212. n = sk_OPENSSL_PSTRING_num(db->data); 213. > for (i = 0; i < n; i++) { 214. r = sk_OPENSSL_PSTRING_value(db->data, i); 215. if ((qual != NULL) && (qual(r) == 0)) crypto/txt_db/txt_db.c:213:17: Loop condition is false. Leaving loop 211. } 212. n = sk_OPENSSL_PSTRING_num(db->data); 213. for (i = 0; i < n; i++) { ^ 214. r = sk_OPENSSL_PSTRING_value(db->data, i); 215. if ((qual != NULL) && (qual(r) == 0)) crypto/txt_db/txt_db.c:225:5: Condition is true 223. } 224. } 225. lh_OPENSSL_STRING_free(db->index[field]); ^ 226. db->index[field] = idx; 227. db->qual[field] = qual; crypto/txt_db/txt_db.c:226:5: 224. } 225. lh_OPENSSL_STRING_free(db->index[field]); 226. > db->index[field] = idx; 227. db->qual[field] = qual; 228. return (1); crypto/txt_db/txt_db.c:227:5: 225. lh_OPENSSL_STRING_free(db->index[field]); 226. db->index[field] = idx; 227. > db->qual[field] = qual; 228. return (1); 229. } crypto/txt_db/txt_db.c:228:5: 226. db->index[field] = idx; 227. db->qual[field] = qual; 228. > return (1); 229. } 230. crypto/txt_db/txt_db.c:229:1: return from a call to TXT_DB_create_index 227. db->qual[field] = qual; 228. return (1); 229. > } 230. 231. long TXT_DB_write(BIO *out, TXT_DB *db) apps/apps.c:1614:10: Taking false branch 1612. int index_index(CA_DB *db) 1613. { 1614. if (!TXT_DB_create_index(db->db, DB_serial, NULL, ^ 1615. LHASH_HASH_FN(index_serial), 1616. LHASH_COMP_FN(index_serial))) { apps/apps.c:1623:9: Taking true branch 1621. } 1622. 1623. if (db->attributes.unique_subject ^ 1624. && !TXT_DB_create_index(db->db, DB_name, index_name_qual, 1625. LHASH_HASH_FN(index_name), apps/apps.c:1624:13: 1622. 1623. if (db->attributes.unique_subject 1624. > && !TXT_DB_create_index(db->db, DB_name, index_name_qual, 1625. LHASH_HASH_FN(index_name), 1626. LHASH_COMP_FN(index_name))) { crypto/txt_db/txt_db.c:196:1: start of procedure TXT_DB_create_index() 194. } 195. 196. > int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *), 197. LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp) 198. { crypto/txt_db/txt_db.c:203:9: Taking false branch 201. int i, n; 202. 203. if (field >= db->num_fields) { ^ 204. db->error = DB_ERROR_INDEX_OUT_OF_RANGE; 205. return (0); crypto/txt_db/txt_db.c:208:9: 206. } 207. /* FIXME: we lose type checking at this point */ 208. > if ((idx = (LHASH_OF(OPENSSL_STRING) *)lh_new(hash, cmp)) == NULL) { 209. db->error = DB_ERROR_MALLOC; 210. return (0); crypto/lhash/lhash.c:113:1: start of procedure lh_new() 111. static LHASH_NODE **getrn(_LHASH *lh, const void *data, unsigned long *rhash); 112. 113. > _LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c) 114. { 115. _LHASH *ret; crypto/lhash/lhash.c:117:9: 115. _LHASH *ret; 116. 117. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) 118. goto err0; 119. if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL) crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/lhash/lhash.c:117:9: Taking false branch 115. _LHASH *ret; 116. 117. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) ^ 118. goto err0; 119. if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL) crypto/lhash/lhash.c:119:9: 117. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) 118. goto err0; 119. > if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL) 120. goto err1; 121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/lhash/lhash.c:119:9: Taking false branch 117. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) 118. goto err0; 119. if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL) ^ 120. goto err1; 121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c); crypto/lhash/lhash.c:121:19: Condition is false 119. if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL) 120. goto err1; 121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c); ^ 122. ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h); 123. ret->num_nodes = MIN_NODES / 2; crypto/lhash/lhash.c:121:18: 119. if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL) 120. goto err1; 121. > ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c); 122. ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h); 123. ret->num_nodes = MIN_NODES / 2; crypto/lhash/lhash.c:121:5: 119. if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL) 120. goto err1; 121. > ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c); 122. ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h); 123. ret->num_nodes = MIN_NODES / 2; crypto/lhash/lhash.c:122:19: Condition is false 120. goto err1; 121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c); 122. ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h); ^ 123. ret->num_nodes = MIN_NODES / 2; 124. ret->num_alloc_nodes = MIN_NODES; crypto/lhash/lhash.c:122:18: 120. goto err1; 121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c); 122. > ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h); 123. ret->num_nodes = MIN_NODES / 2; 124. ret->num_alloc_nodes = MIN_NODES; crypto/lhash/lhash.c:122:5: 120. goto err1; 121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c); 122. > ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h); 123. ret->num_nodes = MIN_NODES / 2; 124. ret->num_alloc_nodes = MIN_NODES; crypto/lhash/lhash.c:123:5: 121. ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c); 122. ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h); 123. > ret->num_nodes = MIN_NODES / 2; 124. ret->num_alloc_nodes = MIN_NODES; 125. ret->pmax = MIN_NODES / 2; crypto/lhash/lhash.c:124:5: 122. ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h); 123. ret->num_nodes = MIN_NODES / 2; 124. > ret->num_alloc_nodes = MIN_NODES; 125. ret->pmax = MIN_NODES / 2; 126. ret->up_load = UP_LOAD; crypto/lhash/lhash.c:125:5: 123. ret->num_nodes = MIN_NODES / 2; 124. ret->num_alloc_nodes = MIN_NODES; 125. > ret->pmax = MIN_NODES / 2; 126. ret->up_load = UP_LOAD; 127. ret->down_load = DOWN_LOAD; crypto/lhash/lhash.c:126:5: 124. ret->num_alloc_nodes = MIN_NODES; 125. ret->pmax = MIN_NODES / 2; 126. > ret->up_load = UP_LOAD; 127. ret->down_load = DOWN_LOAD; 128. return (ret); crypto/lhash/lhash.c:127:5: 125. ret->pmax = MIN_NODES / 2; 126. ret->up_load = UP_LOAD; 127. > ret->down_load = DOWN_LOAD; 128. return (ret); 129. crypto/lhash/lhash.c:128:5: 126. ret->up_load = UP_LOAD; 127. ret->down_load = DOWN_LOAD; 128. > return (ret); 129. 130. err1: crypto/lhash/lhash.c:134:1: return from a call to lh_new 132. err0: 133. return (NULL); 134. > } 135. 136. void lh_free(_LHASH *lh) crypto/txt_db/txt_db.c:208:9: Taking false branch 206. } 207. /* FIXME: we lose type checking at this point */ 208. if ((idx = (LHASH_OF(OPENSSL_STRING) *)lh_new(hash, cmp)) == NULL) { ^ 209. db->error = DB_ERROR_MALLOC; 210. return (0); crypto/txt_db/txt_db.c:212:5: 210. return (0); 211. } 212. > n = sk_OPENSSL_PSTRING_num(db->data); 213. for (i = 0; i < n; i++) { 214. r = sk_OPENSSL_PSTRING_value(db->data, i); include/openssl/txt_db.h:80:1: start of procedure sk_OPENSSL_PSTRING_num() 78. 79. typedef OPENSSL_STRING *OPENSSL_PSTRING; 80. > DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING) 81. 82. typedef struct txt_db_st { 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 true branch 317. int sk_num(const _STACK *st) 318. { 319. if (st == NULL) ^ 320. return -1; 321. return st->num; crypto/stack/stack.c:320:9: 318. { 319. if (st == NULL) 320. > return -1; 321. return st->num; 322. } 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) include/openssl/txt_db.h:80:1: return from a call to sk_OPENSSL_PSTRING_num 78. 79. typedef OPENSSL_STRING *OPENSSL_PSTRING; 80. > DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING) 81. 82. typedef struct txt_db_st { crypto/txt_db/txt_db.c:213:10: 211. } 212. n = sk_OPENSSL_PSTRING_num(db->data); 213. > for (i = 0; i < n; i++) { 214. r = sk_OPENSSL_PSTRING_value(db->data, i); 215. if ((qual != NULL) && (qual(r) == 0)) crypto/txt_db/txt_db.c:213:17: Loop condition is false. Leaving loop 211. } 212. n = sk_OPENSSL_PSTRING_num(db->data); 213. for (i = 0; i < n; i++) { ^ 214. r = sk_OPENSSL_PSTRING_value(db->data, i); 215. if ((qual != NULL) && (qual(r) == 0)) crypto/txt_db/txt_db.c:225:5: Condition is true 223. } 224. } 225. lh_OPENSSL_STRING_free(db->index[field]); ^ 226. db->index[field] = idx; 227. db->qual[field] = qual; crypto/txt_db/txt_db.c:226:5: 224. } 225. lh_OPENSSL_STRING_free(db->index[field]); 226. > db->index[field] = idx; 227. db->qual[field] = qual; 228. return (1); crypto/txt_db/txt_db.c:227:5: 225. lh_OPENSSL_STRING_free(db->index[field]); 226. db->index[field] = idx; 227. > db->qual[field] = qual; 228. return (1); 229. } crypto/txt_db/txt_db.c:228:5: 226. db->index[field] = idx; 227. db->qual[field] = qual; 228. > return (1); 229. } 230. crypto/txt_db/txt_db.c:229:1: return from a call to TXT_DB_create_index 227. db->qual[field] = qual; 228. return (1); 229. > } 230. 231. long TXT_DB_write(BIO *out, TXT_DB *db)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/apps/apps.c/#L1624
d2a_code_trace_data_44920
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:546: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_GF2m_mod_sqr`. Showing all 16 steps of the trace test/bntest.c:546:13: Call 544. BN_bntest_rand(a, 1024, 0, 0); 545. for (j = 0; j < 2; j++) { 546. BN_GF2m_mod_sqr(c, a, b[j], ctx); ^ 547. BN_copy(d, a); 548. BN_GF2m_mod_mul(d, a, d, b[j], ctx); crypto/bn/bn_gf2m.c:532:1: Parameter `ctx->stack.depth` 530. * use the BN_GF2m_mod_sqr_arr function. 531. */ 532. > int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) 533. { 534. int ret = 0; test/bntest.c:548:13: Call 546. BN_GF2m_mod_sqr(c, a, b[j], ctx); 547. BN_copy(d, a); 548. BN_GF2m_mod_mul(d, a, d, b[j], ctx); ^ 549. BN_GF2m_add(d, c, d); 550. /* Test that a*a = a^2. */ 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:546:13: Call 544. BN_bntest_rand(a, 1024, 0, 0); 545. for (j = 0; j < 2; j++) { 546. BN_GF2m_mod_sqr(c, a, b[j], ctx); ^ 547. BN_copy(d, a); 548. BN_GF2m_mod_mul(d, a, d, b[j], ctx); crypto/bn/bn_gf2m.c:532:1: Parameter `ctx->stack.depth` 530. * use the BN_GF2m_mod_sqr_arr function. 531. */ 532. > int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) 533. { 534. int ret = 0; crypto/bn/bn_gf2m.c:547:11: Call 545. goto err; 546. } 547. ret = BN_GF2m_mod_sqr_arr(r, a, arr, ctx); ^ 548. bn_check_top(r); 549. err: crypto/bn/bn_gf2m.c:497:1: Parameter `ctx->stack.depth` 495. 496. /* Square a, reduce the result mod p, and store it in a. r could be a. */ 497. > int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[], 498. BN_CTX *ctx) 499. { crypto/bn/bn_gf2m.c:504:5: Call 502. 503. bn_check_top(a); 504. BN_CTX_start(ctx); ^ 505. if ((s = BN_CTX_get(ctx)) == NULL) 506. 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:522:5: Call 520. ret = 1; 521. err: 522. BN_CTX_end(ctx); ^ 523. return ret; 524. } 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_sqr` 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_44921
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/ssltest_old.c:2845: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_bin2bn`. Showing all 14 steps of the trace test/ssltest_old.c:2844:9: Call 2842. if ((dh = DH_new()) == NULL) 2843. return NULL; 2844. p = BN_bin2bn(dh512_p, sizeof(dh512_p), NULL); ^ 2845. g = BN_bin2bn(dh512_g, sizeof(dh512_g), NULL); 2846. if ((p == NULL) || (g == NULL) || !DH_set0_pqg(dh, p, NULL, g)) { crypto/bn/bn_lib.c:407:1: Parameter `*ret->d` 405. } 406. 407. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) 408. { 409. unsigned int i, m; test/ssltest_old.c:2845:9: Call 2843. return NULL; 2844. p = BN_bin2bn(dh512_p, sizeof(dh512_p), NULL); 2845. g = BN_bin2bn(dh512_g, sizeof(dh512_g), NULL); ^ 2846. if ((p == NULL) || (g == NULL) || !DH_set0_pqg(dh, p, NULL, g)) { 2847. DH_free(dh); crypto/bn/bn_lib.c:407:1: Parameter `*ret->d` 405. } 406. 407. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) 408. { 409. unsigned int i, m; crypto/bn/bn_lib.c:429:9: Call 427. i = ((n - 1) / BN_BYTES) + 1; 428. m = ((n - 1) % (BN_BYTES)); 429. if (bn_wexpand(ret, (int)i) == NULL) { ^ 430. BN_free(bn); 431. return NULL; crypto/bn/bn_lib.c:948:1: Parameter `*a->d` 946. } 947. 948. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:950:37: Call 948. BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 951. } 952. crypto/bn/bn_lib.c:284:1: Parameter `*b->d` 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 `*b->d` 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:271:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_bin2bn` 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/c784a838e0947fcca761ee62def7d077dc06d37f/crypto/bn/bn_lib.c/#L271
d2a_code_trace_data_44922
static int var_diamond_search(MpegEncContext * s, int *best, int dmin, int src_index, int ref_index, int const penalty_factor, int size, int h, int flags) { MotionEstContext * const c= &s->me; me_cmp_func cmpf, chroma_cmpf; int dia_size; LOAD_COMMON LOAD_COMMON2 int map_generation= c->map_generation; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; for(dia_size=1; dia_size<=c->dia_size; dia_size++){ int dir, start, end; const int x= best[0]; const int y= best[1]; start= FFMAX(0, y + dia_size - ymax); end = FFMIN(dia_size, xmax - x + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x + dir , y + dia_size - dir); } start= FFMAX(0, x + dia_size - xmax); end = FFMIN(dia_size, y - ymin + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x + dia_size - dir, y - dir ); } start= FFMAX(0, -y + dia_size + ymin ); end = FFMIN(dia_size, x - xmin + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x - dir , y - dia_size + dir); } start= FFMAX(0, -x + dia_size + xmin ); end = FFMIN(dia_size, ymax - y + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x - dia_size + dir, y + dir ); } if(x!=best[0] || y!=best[1]) dia_size=0; #if 0 { int dx, dy, i; static int stats[8*8]; dx= FFABS(x-best[0]); dy= FFABS(y-best[1]); stats[dy*8 + dx] ++; if(256*256*256*64 % (stats[0]+1)==0){ for(i=0; i<64; i++){ if((i&7)==0) printf("\n"); printf("%6d ", stats[i]); } printf("\n"); } } #endif } return dmin; } libavcodec/motion_est_template.c:939: error: Uninitialized Value The value read from ymax was never initialized. libavcodec/motion_est_template.c:939:13: 937. 938. //check(x - dir,y - dia_size + dir,0, a2) 939. CHECK_MV(x - dir , y - dia_size + dir); ^ 940. } 941.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L939
d2a_code_trace_data_44923
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/statem/extensions.c:1127: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: 29 by call to `check_in_list`. Showing all 9 steps of the trace ssl/t1_lib.c:176:1: Array declaration 174. 175. /* The default curves */ 176. > static const unsigned char eccurves_default[] = { 177. 0, 29, /* X25519 (29) */ 178. 0, 23, /* secp256r1 (23) */ ssl/statem/extensions.c:1127:21: Call 1125. group_id = bytestogroup(pcurvestmp); 1126. 1127. if (check_in_list(s, group_id, clntcurves, clnt_num_curves, 1)) ^ 1128. break; 1129. } ssl/statem/statem_lib.c:1922:1: Parameter `*groups` 1920. */ 1921. #ifndef OPENSSL_NO_EC 1922. > int check_in_list(SSL *s, unsigned int group_id, const unsigned char *groups, 1923. size_t num_groups, int checkallow) 1924. { ssl/statem/statem_lib.c:1935:24: Call 1933. if (group_id == share_id 1934. && (!checkallow 1935. || tls_curve_allowed(s, groups, SSL_SECOP_CURVE_CHECK))) { ^ 1936. return 1; 1937. } ssl/t1_lib.c:268:1: <Offset trace> 266. 267. /* See if curve is allowed by security callback */ 268. > int tls_curve_allowed(SSL *s, const unsigned char *curve, int op) 269. { 270. const tls_curve_info *cinfo; ssl/t1_lib.c:268:1: Parameter `*curve` 266. 267. /* See if curve is allowed by security callback */ 268. > int tls_curve_allowed(SSL *s, const unsigned char *curve, int op) 269. { 270. const tls_curve_info *cinfo; ssl/t1_lib.c:137:1: <Length trace> 135. * table: the index of each entry is one less than the TLS curve id. 136. */ 137. > static const tls_curve_info nid_list[] = { 138. {NID_sect163k1, 80, TLS_CURVE_CHAR2}, /* sect163k1 (1) */ 139. {NID_sect163r1, 80, TLS_CURVE_CHAR2}, /* sect163r1 (2) */ ssl/t1_lib.c:137:1: Array declaration 135. * table: the index of each entry is one less than the TLS curve id. 136. */ 137. > static const tls_curve_info nid_list[] = { 138. {NID_sect163k1, 80, TLS_CURVE_CHAR2}, /* sect163k1 (1) */ 139. {NID_sect163r1, 80, TLS_CURVE_CHAR2}, /* sect163r1 (2) */ ssl/t1_lib.c:275:5: Array access: Offset: [-1, +oo] Size: 29 by call to `check_in_list` 273. if ((curve[1] < 1) || ((size_t)curve[1] > OSSL_NELEM(nid_list))) 274. return 0; 275. cinfo = &nid_list[curve[1] - 1]; ^ 276. # ifdef OPENSSL_NO_EC2M 277. if (cinfo->flags & TLS_CURVE_CHAR2)
https://github.com/openssl/openssl/blob/3fd5ece39b59d938d0cc84b8e5148d19044d15cf/ssl/t1_lib.c/#L275
d2a_code_trace_data_44924
static int transcode(AVFormatContext **output_files, int nb_output_files, InputFile *input_files, int nb_input_files, StreamMap *stream_maps, int nb_stream_maps) { int ret = 0, i, j, k, n, nb_ostreams = 0; AVFormatContext *is, *os; AVCodecContext *codec, *icodec; OutputStream *ost, **ost_table = NULL; InputStream *ist; char error[1024]; int want_sdp = 1; uint8_t no_packet[MAX_FILES]={0}; int no_packet_count=0; if (rate_emu) for (i = 0; i < nb_input_streams; i++) input_streams[i].start = av_gettime(); nb_ostreams = 0; for(i=0;i<nb_output_files;i++) { os = output_files[i]; if (!os->nb_streams && !(os->oformat->flags & AVFMT_NOSTREAMS)) { av_dump_format(output_files[i], i, output_files[i]->filename, 1); fprintf(stderr, "Output file #%d does not contain any stream\n", i); ret = AVERROR(EINVAL); goto fail; } nb_ostreams += os->nb_streams; } if (nb_stream_maps > 0 && nb_stream_maps != nb_ostreams) { fprintf(stderr, "Number of stream maps must match number of output streams\n"); ret = AVERROR(EINVAL); goto fail; } for(i=0;i<nb_stream_maps;i++) { int fi = stream_maps[i].file_index; int si = stream_maps[i].stream_index; if (fi < 0 || fi > nb_input_files - 1 || si < 0 || si > input_files[fi].ctx->nb_streams - 1) { fprintf(stderr,"Could not find input stream #%d.%d\n", fi, si); ret = AVERROR(EINVAL); goto fail; } fi = stream_maps[i].sync_file_index; si = stream_maps[i].sync_stream_index; if (fi < 0 || fi > nb_input_files - 1 || si < 0 || si > input_files[fi].ctx->nb_streams - 1) { fprintf(stderr,"Could not find sync stream #%d.%d\n", fi, si); ret = AVERROR(EINVAL); goto fail; } } ost_table = av_mallocz(sizeof(OutputStream *) * nb_ostreams); if (!ost_table) goto fail; n = 0; for(k=0;k<nb_output_files;k++) { os = output_files[k]; for(i=0;i<os->nb_streams;i++,n++) { int found; ost = ost_table[n] = output_streams_for_file[k][i]; if (nb_stream_maps > 0) { ost->source_index = input_files[stream_maps[n].file_index].ist_index + stream_maps[n].stream_index; if (input_streams[ost->source_index].st->codec->codec_type != ost->st->codec->codec_type) { int i= ost->file_index; av_dump_format(output_files[i], i, output_files[i]->filename, 1); fprintf(stderr, "Codec type mismatch for mapping #%d.%d -> #%d.%d\n", stream_maps[n].file_index, stream_maps[n].stream_index, ost->file_index, ost->index); exit_program(1); } } else { int best_nb_frames=-1; found = 0; for (j = 0; j < nb_input_streams; j++) { int skip=0; ist = &input_streams[j]; if(opt_programid){ int pi,si; AVFormatContext *f = input_files[ist->file_index].ctx; skip=1; for(pi=0; pi<f->nb_programs; pi++){ AVProgram *p= f->programs[pi]; if(p->id == opt_programid) for(si=0; si<p->nb_stream_indexes; si++){ if(f->streams[ p->stream_index[si] ] == ist->st) skip=0; } } } if (ist->discard && ist->st->discard != AVDISCARD_ALL && !skip && ist->st->codec->codec_type == ost->st->codec->codec_type) { if(best_nb_frames < ist->st->codec_info_nb_frames){ best_nb_frames= ist->st->codec_info_nb_frames; ost->source_index = j; found = 1; } } } if (!found) { if(! opt_programid) { for (j = 0; j < nb_input_streams; j++) { ist = &input_streams[j]; if ( ist->st->codec->codec_type == ost->st->codec->codec_type && ist->st->discard != AVDISCARD_ALL) { ost->source_index = j; found = 1; } } } if (!found) { int i= ost->file_index; av_dump_format(output_files[i], i, output_files[i]->filename, 1); fprintf(stderr, "Could not find input stream matching output stream #%d.%d\n", ost->file_index, ost->index); exit_program(1); } } } ist = &input_streams[ost->source_index]; ist->discard = 0; ost->sync_ist = (nb_stream_maps > 0) ? &input_streams[input_files[stream_maps[n].sync_file_index].ist_index + stream_maps[n].sync_stream_index] : ist; } } for(i=0;i<nb_ostreams;i++) { ost = ost_table[i]; os = output_files[ost->file_index]; ist = &input_streams[ost->source_index]; codec = ost->st->codec; icodec = ist->st->codec; if (metadata_streams_autocopy) av_dict_copy(&ost->st->metadata, ist->st->metadata, AV_DICT_DONT_OVERWRITE); ost->st->disposition = ist->st->disposition; codec->bits_per_raw_sample= icodec->bits_per_raw_sample; codec->chroma_sample_location = icodec->chroma_sample_location; if (ost->st->stream_copy) { uint64_t extra_size = (uint64_t)icodec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE; if (extra_size > INT_MAX) goto fail; codec->codec_id = icodec->codec_id; codec->codec_type = icodec->codec_type; if(!codec->codec_tag){ if( !os->oformat->codec_tag || av_codec_get_id (os->oformat->codec_tag, icodec->codec_tag) == codec->codec_id || av_codec_get_tag(os->oformat->codec_tag, icodec->codec_id) <= 0) codec->codec_tag = icodec->codec_tag; } codec->bit_rate = icodec->bit_rate; codec->rc_max_rate = icodec->rc_max_rate; codec->rc_buffer_size = icodec->rc_buffer_size; codec->extradata= av_mallocz(extra_size); if (!codec->extradata) goto fail; memcpy(codec->extradata, icodec->extradata, icodec->extradata_size); codec->extradata_size= icodec->extradata_size; if(!copy_tb && av_q2d(icodec->time_base)*icodec->ticks_per_frame > av_q2d(ist->st->time_base) && av_q2d(ist->st->time_base) < 1.0/500){ codec->time_base = icodec->time_base; codec->time_base.num *= icodec->ticks_per_frame; av_reduce(&codec->time_base.num, &codec->time_base.den, codec->time_base.num, codec->time_base.den, INT_MAX); }else codec->time_base = ist->st->time_base; switch(codec->codec_type) { case AVMEDIA_TYPE_AUDIO: if(audio_volume != 256) { fprintf(stderr,"-acodec copy and -vol are incompatible (frames are not decoded)\n"); exit_program(1); } codec->channel_layout = icodec->channel_layout; codec->sample_rate = icodec->sample_rate; codec->channels = icodec->channels; codec->frame_size = icodec->frame_size; codec->audio_service_type = icodec->audio_service_type; codec->block_align= icodec->block_align; if(codec->block_align == 1 && codec->codec_id == CODEC_ID_MP3) codec->block_align= 0; if(codec->codec_id == CODEC_ID_AC3) codec->block_align= 0; break; case AVMEDIA_TYPE_VIDEO: codec->pix_fmt = icodec->pix_fmt; codec->width = icodec->width; codec->height = icodec->height; codec->has_b_frames = icodec->has_b_frames; if (!codec->sample_aspect_ratio.num) { codec->sample_aspect_ratio = ost->st->sample_aspect_ratio = ist->st->sample_aspect_ratio.num ? ist->st->sample_aspect_ratio : ist->st->codec->sample_aspect_ratio.num ? ist->st->codec->sample_aspect_ratio : (AVRational){0, 1}; } break; case AVMEDIA_TYPE_SUBTITLE: codec->width = icodec->width; codec->height = icodec->height; break; case AVMEDIA_TYPE_DATA: break; default: abort(); } } else { if (!ost->enc) ost->enc = avcodec_find_encoder(ost->st->codec->codec_id); switch(codec->codec_type) { case AVMEDIA_TYPE_AUDIO: ost->fifo= av_fifo_alloc(1024); if(!ost->fifo) goto fail; ost->reformat_pair = MAKE_SFMT_PAIR(AV_SAMPLE_FMT_NONE,AV_SAMPLE_FMT_NONE); if (!codec->sample_rate) { codec->sample_rate = icodec->sample_rate; if (icodec->lowres) codec->sample_rate >>= icodec->lowres; } choose_sample_rate(ost->st, ost->enc); codec->time_base = (AVRational){1, codec->sample_rate}; if (codec->sample_fmt == AV_SAMPLE_FMT_NONE) codec->sample_fmt = icodec->sample_fmt; choose_sample_fmt(ost->st, ost->enc); if (!codec->channels) codec->channels = icodec->channels; codec->channel_layout = icodec->channel_layout; if (av_get_channel_layout_nb_channels(codec->channel_layout) != codec->channels) codec->channel_layout = 0; ost->audio_resample = codec->sample_rate != icodec->sample_rate || audio_sync_method > 1; icodec->request_channels = codec->channels; ist->decoding_needed = 1; ost->encoding_needed = 1; ost->resample_sample_fmt = icodec->sample_fmt; ost->resample_sample_rate = icodec->sample_rate; ost->resample_channels = icodec->channels; break; case AVMEDIA_TYPE_VIDEO: if (codec->pix_fmt == PIX_FMT_NONE) codec->pix_fmt = icodec->pix_fmt; choose_pixel_fmt(ost->st, ost->enc); if (ost->st->codec->pix_fmt == PIX_FMT_NONE) { fprintf(stderr, "Video pixel format is unknown, stream cannot be encoded\n"); exit_program(1); } if (!codec->width || !codec->height) { codec->width = icodec->width; codec->height = icodec->height; } ost->video_resample = codec->width != icodec->width || codec->height != icodec->height || codec->pix_fmt != icodec->pix_fmt; if (ost->video_resample) { #if !CONFIG_AVFILTER avcodec_get_frame_defaults(&ost->pict_tmp); if(avpicture_alloc((AVPicture*)&ost->pict_tmp, codec->pix_fmt, codec->width, codec->height)) { fprintf(stderr, "Cannot allocate temp picture, check pix fmt\n"); exit_program(1); } ost->img_resample_ctx = sws_getContext( icodec->width, icodec->height, icodec->pix_fmt, codec->width, codec->height, codec->pix_fmt, ost->sws_flags, NULL, NULL, NULL); if (ost->img_resample_ctx == NULL) { fprintf(stderr, "Cannot get resampling context\n"); exit_program(1); } #endif codec->bits_per_raw_sample= 0; } ost->resample_height = icodec->height; ost->resample_width = icodec->width; ost->resample_pix_fmt= icodec->pix_fmt; ost->encoding_needed = 1; ist->decoding_needed = 1; if (!ost->frame_rate.num) ost->frame_rate = ist->st->r_frame_rate.num ? ist->st->r_frame_rate : (AVRational){25,1}; if (ost->enc && ost->enc->supported_framerates && !force_fps) { int idx = av_find_nearest_q_idx(ost->frame_rate, ost->enc->supported_framerates); ost->frame_rate = ost->enc->supported_framerates[idx]; } codec->time_base = (AVRational){ost->frame_rate.den, ost->frame_rate.num}; #if CONFIG_AVFILTER if (configure_video_filters(ist, ost)) { fprintf(stderr, "Error opening filters!\n"); exit(1); } #endif break; case AVMEDIA_TYPE_SUBTITLE: ost->encoding_needed = 1; ist->decoding_needed = 1; break; default: abort(); break; } if (ost->encoding_needed && (codec->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2))) { char logfilename[1024]; FILE *f; snprintf(logfilename, sizeof(logfilename), "%s-%d.log", pass_logfilename_prefix ? pass_logfilename_prefix : DEFAULT_PASS_LOGFILENAME_PREFIX, i); if (codec->flags & CODEC_FLAG_PASS1) { f = fopen(logfilename, "wb"); if (!f) { fprintf(stderr, "Cannot write log file '%s' for pass-1 encoding: %s\n", logfilename, strerror(errno)); exit_program(1); } ost->logfile = f; } else { char *logbuffer; size_t logbuffer_size; if (read_file(logfilename, &logbuffer, &logbuffer_size) < 0) { fprintf(stderr, "Error reading log file '%s' for pass-2 encoding\n", logfilename); exit_program(1); } codec->stats_in = logbuffer; } } } if(codec->codec_type == AVMEDIA_TYPE_VIDEO){ int size= codec->width * codec->height; bit_buffer_size= FFMAX(bit_buffer_size, 6*size + 200); } } if (!bit_buffer) bit_buffer = av_malloc(bit_buffer_size); if (!bit_buffer) { fprintf(stderr, "Cannot allocate %d bytes output buffer\n", bit_buffer_size); ret = AVERROR(ENOMEM); goto fail; } for(i=0;i<nb_ostreams;i++) { ost = ost_table[i]; if (ost->encoding_needed) { AVCodec *codec = ost->enc; AVCodecContext *dec = input_streams[ost->source_index].st->codec; if (!codec) { snprintf(error, sizeof(error), "Encoder (codec id %d) not found for output stream #%d.%d", ost->st->codec->codec_id, ost->file_index, ost->index); ret = AVERROR(EINVAL); goto dump_format; } if (dec->subtitle_header) { ost->st->codec->subtitle_header = av_malloc(dec->subtitle_header_size); if (!ost->st->codec->subtitle_header) { ret = AVERROR(ENOMEM); goto dump_format; } memcpy(ost->st->codec->subtitle_header, dec->subtitle_header, dec->subtitle_header_size); ost->st->codec->subtitle_header_size = dec->subtitle_header_size; } if (avcodec_open2(ost->st->codec, codec, &ost->opts) < 0) { snprintf(error, sizeof(error), "Error while opening encoder for output stream #%d.%d - maybe incorrect parameters such as bit_rate, rate, width or height", ost->file_index, ost->index); ret = AVERROR(EINVAL); goto dump_format; } assert_codec_experimental(ost->st->codec, 1); assert_avoptions(ost->opts); if (ost->st->codec->bit_rate && ost->st->codec->bit_rate < 1000) av_log(NULL, AV_LOG_WARNING, "The bitrate parameter is set too low." "It takes bits/s as argument, not kbits/s\n"); extra_size += ost->st->codec->extradata_size; } } for (i = 0; i < nb_input_streams; i++) { ist = &input_streams[i]; if (ist->decoding_needed) { AVCodec *codec = ist->dec; if (!codec) codec = avcodec_find_decoder(ist->st->codec->codec_id); if (!codec) { snprintf(error, sizeof(error), "Decoder (codec id %d) not found for input stream #%d.%d", ist->st->codec->codec_id, ist->file_index, ist->st->index); ret = AVERROR(EINVAL); goto dump_format; } for (j = 0; j < nb_ostreams; j++) { ost = ost_table[j]; if (ost->source_index == i) { update_sample_fmt(ist->st->codec, codec, ost->st->codec); break; } } if (avcodec_open2(ist->st->codec, codec, &ist->opts) < 0) { snprintf(error, sizeof(error), "Error while opening decoder for input stream #%d.%d", ist->file_index, ist->st->index); ret = AVERROR(EINVAL); goto dump_format; } assert_codec_experimental(ist->st->codec, 0); assert_avoptions(ost->opts); } } for (i = 0; i < nb_input_streams; i++) { AVStream *st; ist = &input_streams[i]; st= ist->st; ist->pts = st->avg_frame_rate.num ? - st->codec->has_b_frames*AV_TIME_BASE / av_q2d(st->avg_frame_rate) : 0; ist->next_pts = AV_NOPTS_VALUE; init_pts_correction(&ist->pts_ctx); ist->is_start = 1; } for (i=0;i<nb_meta_data_maps;i++) { AVFormatContext *files[2]; AVDictionary **meta[2]; int j; #define METADATA_CHECK_INDEX(index, nb_elems, desc)\ if ((index) < 0 || (index) >= (nb_elems)) {\ snprintf(error, sizeof(error), "Invalid %s index %d while processing metadata maps\n",\ (desc), (index));\ ret = AVERROR(EINVAL);\ goto dump_format;\ } int out_file_index = meta_data_maps[i][0].file; int in_file_index = meta_data_maps[i][1].file; if (in_file_index < 0 || out_file_index < 0) continue; METADATA_CHECK_INDEX(out_file_index, nb_output_files, "output file") METADATA_CHECK_INDEX(in_file_index, nb_input_files, "input file") files[0] = output_files[out_file_index]; files[1] = input_files[in_file_index].ctx; for (j = 0; j < 2; j++) { MetadataMap *map = &meta_data_maps[i][j]; switch (map->type) { case 'g': meta[j] = &files[j]->metadata; break; case 's': METADATA_CHECK_INDEX(map->index, files[j]->nb_streams, "stream") meta[j] = &files[j]->streams[map->index]->metadata; break; case 'c': METADATA_CHECK_INDEX(map->index, files[j]->nb_chapters, "chapter") meta[j] = &files[j]->chapters[map->index]->metadata; break; case 'p': METADATA_CHECK_INDEX(map->index, files[j]->nb_programs, "program") meta[j] = &files[j]->programs[map->index]->metadata; break; } } av_dict_copy(meta[0], *meta[1], AV_DICT_DONT_OVERWRITE); } if (metadata_global_autocopy) { for (i = 0; i < nb_output_files; i++) av_dict_copy(&output_files[i]->metadata, input_files[0].ctx->metadata, AV_DICT_DONT_OVERWRITE); } for (i = 0; i < nb_chapter_maps; i++) { int infile = chapter_maps[i].in_file; int outfile = chapter_maps[i].out_file; if (infile < 0 || outfile < 0) continue; if (infile >= nb_input_files) { snprintf(error, sizeof(error), "Invalid input file index %d in chapter mapping.\n", infile); ret = AVERROR(EINVAL); goto dump_format; } if (outfile >= nb_output_files) { snprintf(error, sizeof(error), "Invalid output file index %d in chapter mapping.\n",outfile); ret = AVERROR(EINVAL); goto dump_format; } copy_chapters(infile, outfile); } if (!nb_chapter_maps) for (i = 0; i < nb_input_files; i++) { if (!input_files[i].ctx->nb_chapters) continue; for (j = 0; j < nb_output_files; j++) if ((ret = copy_chapters(i, j)) < 0) goto dump_format; break; } for(i=0;i<nb_output_files;i++) { os = output_files[i]; if (avformat_write_header(os, &output_opts[i]) < 0) { snprintf(error, sizeof(error), "Could not write header for output file #%d (incorrect codec parameters ?)", i); ret = AVERROR(EINVAL); goto dump_format; } assert_avoptions(output_opts[i]); if (strcmp(output_files[i]->oformat->name, "rtp")) { want_sdp = 0; } } dump_format: for(i=0;i<nb_output_files;i++) { av_dump_format(output_files[i], i, output_files[i]->filename, 1); } if (verbose >= 0) { fprintf(stderr, "Stream mapping:\n"); for(i=0;i<nb_ostreams;i++) { ost = ost_table[i]; fprintf(stderr, " Stream #%d.%d -> #%d.%d", input_streams[ost->source_index].file_index, input_streams[ost->source_index].st->index, ost->file_index, ost->index); if (ost->sync_ist != &input_streams[ost->source_index]) fprintf(stderr, " [sync #%d.%d]", ost->sync_ist->file_index, ost->sync_ist->st->index); fprintf(stderr, "\n"); } } if (ret) { fprintf(stderr, "%s\n", error); goto fail; } if (want_sdp) { print_sdp(output_files, nb_output_files); } if (verbose >= 0) fprintf(stderr, "Press ctrl-c to stop encoding\n"); term_init(); timer_start = av_gettime(); for(; received_sigterm == 0;) { int file_index, ist_index; AVPacket pkt; double ipts_min; double opts_min; redo: ipts_min= 1e100; opts_min= 1e100; file_index = -1; for(i=0;i<nb_ostreams;i++) { double ipts, opts; ost = ost_table[i]; os = output_files[ost->file_index]; ist = &input_streams[ost->source_index]; if(ist->is_past_recording_time || no_packet[ist->file_index]) continue; opts = ost->st->pts.val * av_q2d(ost->st->time_base); ipts = (double)ist->pts; if (!input_files[ist->file_index].eof_reached){ if(ipts < ipts_min) { ipts_min = ipts; if(input_sync ) file_index = ist->file_index; } if(opts < opts_min) { opts_min = opts; if(!input_sync) file_index = ist->file_index; } } if(ost->frame_number >= max_frames[ost->st->codec->codec_type]){ file_index= -1; break; } } if (file_index < 0) { if(no_packet_count){ no_packet_count=0; memset(no_packet, 0, sizeof(no_packet)); usleep(10000); continue; } break; } if (limit_filesize != 0 && limit_filesize <= avio_tell(output_files[0]->pb)) break; is = input_files[file_index].ctx; ret= av_read_frame(is, &pkt); if(ret == AVERROR(EAGAIN)){ no_packet[file_index]=1; no_packet_count++; continue; } if (ret < 0) { input_files[file_index].eof_reached = 1; if (opt_shortest) break; else continue; } no_packet_count=0; memset(no_packet, 0, sizeof(no_packet)); if (do_pkt_dump) { av_pkt_dump_log2(NULL, AV_LOG_DEBUG, &pkt, do_hex_dump, is->streams[pkt.stream_index]); } if (pkt.stream_index >= input_files[file_index].ctx->nb_streams) goto discard_packet; ist_index = input_files[file_index].ist_index + pkt.stream_index; ist = &input_streams[ist_index]; if (ist->discard) goto discard_packet; if (pkt.dts != AV_NOPTS_VALUE) pkt.dts += av_rescale_q(input_files[ist->file_index].ts_offset, AV_TIME_BASE_Q, ist->st->time_base); if (pkt.pts != AV_NOPTS_VALUE) pkt.pts += av_rescale_q(input_files[ist->file_index].ts_offset, AV_TIME_BASE_Q, ist->st->time_base); if (ist->ts_scale) { if(pkt.pts != AV_NOPTS_VALUE) pkt.pts *= ist->ts_scale; if(pkt.dts != AV_NOPTS_VALUE) pkt.dts *= ist->ts_scale; } if (pkt.dts != AV_NOPTS_VALUE && ist->next_pts != AV_NOPTS_VALUE && (is->iformat->flags & AVFMT_TS_DISCONT)) { int64_t pkt_dts= av_rescale_q(pkt.dts, ist->st->time_base, AV_TIME_BASE_Q); int64_t delta= pkt_dts - ist->next_pts; if((FFABS(delta) > 1LL*dts_delta_threshold*AV_TIME_BASE || pkt_dts+1<ist->pts)&& !copy_ts){ input_files[ist->file_index].ts_offset -= delta; if (verbose > 2) fprintf(stderr, "timestamp discontinuity %"PRId64", new offset= %"PRId64"\n", delta, input_files[ist->file_index].ts_offset); pkt.dts-= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base); if(pkt.pts != AV_NOPTS_VALUE) pkt.pts-= av_rescale_q(delta, AV_TIME_BASE_Q, ist->st->time_base); } } if (recording_time != INT64_MAX && av_compare_ts(pkt.pts, ist->st->time_base, recording_time + start_time, (AVRational){1, 1000000}) >= 0) { ist->is_past_recording_time = 1; goto discard_packet; } if (output_packet(ist, ist_index, ost_table, nb_ostreams, &pkt) < 0) { if (verbose >= 0) fprintf(stderr, "Error while decoding stream #%d.%d\n", ist->file_index, ist->st->index); if (exit_on_error) exit_program(1); av_free_packet(&pkt); goto redo; } discard_packet: av_free_packet(&pkt); print_report(output_files, ost_table, nb_ostreams, 0); } for (i = 0; i < nb_input_streams; i++) { ist = &input_streams[i]; if (ist->decoding_needed) { output_packet(ist, i, ost_table, nb_ostreams, NULL); } } term_exit(); for(i=0;i<nb_output_files;i++) { os = output_files[i]; av_write_trailer(os); } print_report(output_files, ost_table, nb_ostreams, 1); for(i=0;i<nb_ostreams;i++) { ost = ost_table[i]; if (ost->encoding_needed) { av_freep(&ost->st->codec->stats_in); avcodec_close(ost->st->codec); } #if CONFIG_AVFILTER avfilter_graph_free(&ost->graph); #endif } for (i = 0; i < nb_input_streams; i++) { ist = &input_streams[i]; if (ist->decoding_needed) { avcodec_close(ist->st->codec); } } ret = 0; fail: av_freep(&bit_buffer); if (ost_table) { for(i=0;i<nb_ostreams;i++) { ost = ost_table[i]; if (ost) { if (ost->st->stream_copy) av_freep(&ost->st->codec->extradata); if (ost->logfile) { fclose(ost->logfile); ost->logfile = NULL; } av_fifo_free(ost->fifo); av_freep(&ost->st->codec->subtitle_header); av_free(ost->pict_tmp.data[0]); av_free(ost->forced_kf_pts); if (ost->video_resample) sws_freeContext(ost->img_resample_ctx); if (ost->resample) audio_resample_close(ost->resample); if (ost->reformat_ctx) av_audio_convert_free(ost->reformat_ctx); av_dict_free(&ost->opts); av_free(ost); } } av_free(ost_table); } return ret; } ffmpeg.c:4399: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `transcode`. ffmpeg.c:4383:9: Unknown value from: fprintf 4381. if(nb_output_files <= 0 && nb_input_files == 0) { 4382. show_usage(); 4383. fprintf(stderr, "Use -h to get full help or, even better, run 'man ffmpeg'\n"); ^ 4384. exit_program(1); 4385. } ffmpeg.c:4399:9: Call 4397. 4398. ti = getutime(); 4399. if (transcode(output_files, nb_output_files, input_files, nb_input_files, ^ 4400. stream_maps, nb_stream_maps) < 0) 4401. exit_program(1); ffmpeg.c:1927:1: <LHS trace> 1925. * The following code is the main loop of the file converter 1926. */ 1927. static int transcode(AVFormatContext **output_files, ^ 1928. int nb_output_files, 1929. InputFile *input_files, ffmpeg.c:1927:1: Parameter `input_files->ctx->nb_streams` 1925. * The following code is the main loop of the file converter 1926. */ 1927. static int transcode(AVFormatContext **output_files, ^ 1928. int nb_output_files, 1929. InputFile *input_files, ffmpeg.c:1971:23: Binary operation: ([0, +oo] - 1):unsigned32 by call to `transcode` 1969. 1970. if (fi < 0 || fi > nb_input_files - 1 || 1971. si < 0 || si > input_files[fi].ctx->nb_streams - 1) { ^ 1972. fprintf(stderr,"Could not find input stream #%d.%d\n", fi, si); 1973. ret = AVERROR(EINVAL);
https://github.com/libav/libav/blob/609a2fa1faa82da2451191170ce1807c9a1ba8a8/ffmpeg.c/#L1971
d2a_code_trace_data_44925
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:743: error: INTEGER_OVERFLOW_L2 ([0, max(0, `s->initial_ctx->sessions->num_items`)] - 1):unsigned64 by call to `SSL_CTX_remove_session`. Showing all 11 steps of the trace ssl/record/rec_layer_d1.c:298:1: Parameter `s->initial_ctx->sessions->num_items` 296. * none of our business 297. */ 298. > int dtls1_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf, 299. int len, int peek) 300. { ssl/record/rec_layer_d1.c:743:13: Call 741. ERR_add_error_data(2, "SSL alert number ", tmp); 742. s->shutdown |= SSL_RECEIVED_SHUTDOWN; 743. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 744. return (0); 745. } else { ssl/ssl_sess.c:691:1: Parameter `ctx->sessions->num_items` 689. } 690. 691. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 692. { 693. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:693:12: Call 691. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 692. { 693. return remove_session_lock(ctx, c, 1); ^ 694. } 695. ssl/ssl_sess.c:696:1: Parameter `ctx->sessions->num_items` 694. } 695. 696. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 697. { 698. SSL_SESSION *r; ssl/ssl_sess.c:706:17: Call 704. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 705. ret = 1; 706. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 707. SSL_SESSION_list_remove(ctx, c); 708. } 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->initial_ctx->sessions->num_items)] - 1):unsigned64 by call to `SSL_CTX_remove_session` 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/2a7de0fd5d9baf946ef4d2c51096b04dd47a8143/crypto/lhash/lhash.c/#L123
d2a_code_trace_data_44926
CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name) { CTLOG *ret = OPENSSL_zalloc(sizeof(*ret)); if (ret == NULL) { CTerr(CT_F_CTLOG_NEW, ERR_R_MALLOC_FAILURE); return NULL; } ret->name = OPENSSL_strdup(name); if (ret->name == NULL) { CTerr(CT_F_CTLOG_NEW, ERR_R_MALLOC_FAILURE); goto err; } if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1) goto err; ret->public_key = public_key; return ret; err: CTLOG_free(ret); return NULL; } crypto/ct/ct_log.c:258: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_strdup()` at line 246, column 17 is not reachable after line 258, column 5. Showing all 83 steps of the trace crypto/ct/ct_log.c:237:1: start of procedure CTLOG_new() 235. * Copies the name. 236. */ 237. > CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name) 238. { 239. CTLOG *ret = OPENSSL_zalloc(sizeof(*ret)); crypto/ct/ct_log.c:239:5: 237. CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name) 238. { 239. > CTLOG *ret = OPENSSL_zalloc(sizeof(*ret)); 240. 241. if (ret == NULL) { crypto/mem.c:198:1: start of procedure CRYPTO_zalloc() 196. } 197. 198. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 199. { 200. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:200:5: 198. void *CRYPTO_zalloc(size_t num, const char *file, int line) 199. { 200. > void *ret = CRYPTO_malloc(num, file, line); 201. 202. FAILTEST(); crypto/mem.c:170:1: start of procedure CRYPTO_malloc() 168. #endif 169. 170. > void *CRYPTO_malloc(size_t num, const char *file, int line) 171. { 172. void *ret = NULL; crypto/mem.c:172:5: 170. void *CRYPTO_malloc(size_t num, const char *file, int line) 171. { 172. > void *ret = NULL; 173. 174. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:174:9: Taking false branch 172. void *ret = NULL; 173. 174. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 175. return malloc_impl(num, file, line); 176. crypto/mem.c:177:9: Taking false branch 175. return malloc_impl(num, file, line); 176. 177. if (num == 0) ^ 178. return NULL; 179. crypto/mem.c:181:5: 179. 180. FAILTEST(); 181. > allow_customize = 0; 182. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 183. if (call_malloc_debug) { crypto/mem.c:191:5: 189. } 190. #else 191. > (void)(file); (void)(line); 192. ret = malloc(num); 193. #endif crypto/mem.c:191:19: 189. } 190. #else 191. > (void)(file); (void)(line); 192. ret = malloc(num); 193. #endif crypto/mem.c:192:5: 190. #else 191. (void)(file); (void)(line); 192. > ret = malloc(num); 193. #endif 194. crypto/mem.c:195:5: 193. #endif 194. 195. > return ret; 196. } 197. crypto/mem.c:196:1: return from a call to CRYPTO_malloc 194. 195. return ret; 196. > } 197. 198. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:203:9: Taking true branch 201. 202. FAILTEST(); 203. if (ret != NULL) ^ 204. memset(ret, 0, num); 205. return ret; crypto/mem.c:204:9: 202. FAILTEST(); 203. if (ret != NULL) 204. > memset(ret, 0, num); 205. return ret; 206. } crypto/mem.c:205:5: 203. if (ret != NULL) 204. memset(ret, 0, num); 205. > return ret; 206. } 207. crypto/mem.c:206:1: return from a call to CRYPTO_zalloc 204. memset(ret, 0, num); 205. return ret; 206. > } 207. 208. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/ct/ct_log.c:241:9: Taking false branch 239. CTLOG *ret = OPENSSL_zalloc(sizeof(*ret)); 240. 241. if (ret == NULL) { ^ 242. CTerr(CT_F_CTLOG_NEW, ERR_R_MALLOC_FAILURE); 243. return NULL; crypto/ct/ct_log.c:246:5: 244. } 245. 246. > ret->name = OPENSSL_strdup(name); 247. if (ret->name == NULL) { 248. CTerr(CT_F_CTLOG_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:32:9: Taking false branch 30. size_t size; 31. 32. if (str == NULL) ^ 33. return NULL; 34. size = strlen(str) + 1; crypto/o_str.c:34:5: 32. if (str == NULL) 33. return NULL; 34. > size = strlen(str) + 1; 35. ret = CRYPTO_malloc(size, file, line); 36. if (ret != NULL) crypto/o_str.c:35:5: 33. return NULL; 34. size = strlen(str) + 1; 35. > ret = CRYPTO_malloc(size, file, line); 36. if (ret != NULL) 37. memcpy(ret, str, size); 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:36:9: Taking true branch 34. size = strlen(str) + 1; 35. ret = CRYPTO_malloc(size, file, line); 36. if (ret != NULL) ^ 37. memcpy(ret, str, size); 38. return ret; crypto/o_str.c:37:9: 35. ret = CRYPTO_malloc(size, file, line); 36. if (ret != NULL) 37. > memcpy(ret, str, size); 38. return ret; 39. } crypto/o_str.c:38:5: 36. if (ret != NULL) 37. memcpy(ret, str, size); 38. > return ret; 39. } 40. crypto/o_str.c:39:1: return from a call to CRYPTO_strdup 37. memcpy(ret, str, size); 38. return ret; 39. > } 40. 41. char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line) crypto/ct/ct_log.c:247:9: Taking false branch 245. 246. ret->name = OPENSSL_strdup(name); 247. if (ret->name == NULL) { ^ 248. CTerr(CT_F_CTLOG_NEW, ERR_R_MALLOC_FAILURE); 249. goto err; crypto/ct/ct_log.c:252:9: 250. } 251. 252. > if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1) 253. goto err; 254. crypto/ct/ct_log.c:73:1: start of procedure ct_v1_log_id_from_pkey() 71. 72. /* Converts a log's public key into a SHA256 log ID */ 73. > static int ct_v1_log_id_from_pkey(EVP_PKEY *pkey, 74. unsigned char log_id[CT_V1_HASHLEN]) 75. { crypto/ct/ct_log.c:76:5: 74. unsigned char log_id[CT_V1_HASHLEN]) 75. { 76. > int ret = 0; 77. unsigned char *pkey_der = NULL; 78. int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der); crypto/ct/ct_log.c:77:5: 75. { 76. int ret = 0; 77. > unsigned char *pkey_der = NULL; 78. int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der); 79. crypto/ct/ct_log.c:78:5: 76. int ret = 0; 77. unsigned char *pkey_der = NULL; 78. > int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der); 79. 80. if (pkey_der_len <= 0) { crypto/x509/x_pubkey.c:202:1: start of procedure i2d_PUBKEY() 200. } 201. 202. > int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp) 203. { 204. X509_PUBKEY *xpk = NULL; crypto/x509/x_pubkey.c:204:5: 202. int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp) 203. { 204. > X509_PUBKEY *xpk = NULL; 205. int ret; 206. if (!a) crypto/x509/x_pubkey.c:206:10: Taking true branch 204. X509_PUBKEY *xpk = NULL; 205. int ret; 206. if (!a) ^ 207. return 0; 208. if (!X509_PUBKEY_set(&xpk, a)) crypto/x509/x_pubkey.c:207:9: 205. int ret; 206. if (!a) 207. > return 0; 208. if (!X509_PUBKEY_set(&xpk, a)) 209. return 0; crypto/x509/x_pubkey.c:213:1: return from a call to i2d_PUBKEY 211. X509_PUBKEY_free(xpk); 212. return ret; 213. > } 214. 215. /* crypto/ct/ct_log.c:80:9: Taking true branch 78. int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der); 79. 80. if (pkey_der_len <= 0) { ^ 81. CTerr(CT_F_CT_V1_LOG_ID_FROM_PKEY, CT_R_LOG_KEY_INVALID); 82. goto err; crypto/ct/ct_log.c:81:9: Skipping ERR_put_error(): empty list of specs 79. 80. if (pkey_der_len <= 0) { 81. CTerr(CT_F_CT_V1_LOG_ID_FROM_PKEY, CT_R_LOG_KEY_INVALID); ^ 82. goto err; 83. } crypto/ct/ct_log.c:87:1: 85. SHA256(pkey_der, pkey_der_len, log_id); 86. ret = 1; 87. > err: 88. OPENSSL_free(pkey_der); 89. return ret; crypto/ct/ct_log.c:88:5: 86. ret = 1; 87. err: 88. > OPENSSL_free(pkey_der); 89. return ret; 90. } crypto/mem.c: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/ct/ct_log.c:89:5: 87. err: 88. OPENSSL_free(pkey_der); 89. > return ret; 90. } 91. crypto/ct/ct_log.c:90:1: return from a call to ct_v1_log_id_from_pkey 88. OPENSSL_free(pkey_der); 89. return ret; 90. > } 91. 92. CTLOG_STORE *CTLOG_STORE_new(void) crypto/ct/ct_log.c:252:9: Taking true branch 250. } 251. 252. if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1) ^ 253. goto err; 254. crypto/ct/ct_log.c:257:1: 255. ret->public_key = public_key; 256. return ret; 257. > err: 258. CTLOG_free(ret); 259. return NULL; crypto/ct/ct_log.c:258:5: 256. return ret; 257. err: 258. > CTLOG_free(ret); 259. return NULL; 260. } crypto/ct/ct_log.c:263:1: start of procedure CTLOG_free() 261. 262. /* Frees CT log and associated structures */ 263. > void CTLOG_free(CTLOG *log) 264. { 265. if (log != NULL) { crypto/ct/ct_log.c:265:9: Taking true branch 263. void CTLOG_free(CTLOG *log) 264. { 265. if (log != NULL) { ^ 266. OPENSSL_free(log->name); 267. EVP_PKEY_free(log->public_key); crypto/ct/ct_log.c:266:9: 264. { 265. if (log != NULL) { 266. > OPENSSL_free(log->name); 267. EVP_PKEY_free(log->public_key); 268. OPENSSL_free(log); 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/ct/ct_log.c:267:9: 265. if (log != NULL) { 266. OPENSSL_free(log->name); 267. > EVP_PKEY_free(log->public_key); 268. OPENSSL_free(log); 269. } crypto/evp/p_lib.c:418:1: start of procedure EVP_PKEY_free() 416. } 417. 418. > void EVP_PKEY_free(EVP_PKEY *x) 419. { 420. int i; crypto/evp/p_lib.c:422:9: Taking true branch 420. int i; 421. 422. if (x == NULL) ^ 423. return; 424. crypto/evp/p_lib.c:423:9: 421. 422. if (x == NULL) 423. > return; 424. 425. CRYPTO_DOWN_REF(&x->references, &i, x->lock); crypto/evp/p_lib.c:434:1: return from a call to EVP_PKEY_free 432. sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free); 433. OPENSSL_free(x); 434. > } 435. 436. static void EVP_PKEY_free_it(EVP_PKEY *x) crypto/ct/ct_log.c:268:9: 266. OPENSSL_free(log->name); 267. EVP_PKEY_free(log->public_key); 268. > OPENSSL_free(log); 269. } 270. } 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/ct/ct_log.c:265:5: 263. void CTLOG_free(CTLOG *log) 264. { 265. > if (log != NULL) { 266. OPENSSL_free(log->name); 267. EVP_PKEY_free(log->public_key); crypto/ct/ct_log.c:270:1: return from a call to CTLOG_free 268. OPENSSL_free(log); 269. } 270. > } 271. 272. const char *CTLOG_get0_name(const CTLOG *log)
https://github.com/openssl/openssl/blob/d3c3dfc5778ab2cca0d25c5959c8b814a334addb/crypto/ct/ct_log.c/#L258
d2a_code_trace_data_44927
static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, long max) { const unsigned char *p = *pp; unsigned long ret = 0; unsigned long i; if (max-- < 1) return 0; if (*p == 0x80) { *inf = 1; ret = 0; p++; } else { *inf = 0; i = *p & 0x7f; if (*(p++) & 0x80) { if (max < (long)i + 1) return 0; while (i && *p == 0) { p++; i--; } if (i > sizeof(long)) return 0; while (i-- > 0) { ret <<= 8L; ret |= *(p++); } } else ret = i; } if (ret > LONG_MAX) return 0; *pp = p; *rl = (long)ret; return 1; } crypto/pem/pem_pkey.c:42: error: BUFFER_OVERRUN_L3 Offset: [2, +oo] Size: [1, +oo] by call to `d2i_PKCS8_PRIV_KEY_INFO`. Showing all 27 steps of the trace crypto/pem/pem_pkey.c:35:10: Call 33. EVP_PKEY *ret = NULL; 34. 35. if (!PEM_bytes_read_bio_secmem(&data, &len, &nm, PEM_STRING_EVP_PKEY, bp, ^ 36. cb, u)) 37. return NULL; crypto/pem/pem_lib.c:295:1: Parameter `**pdata` 293. } 294. 295. > int PEM_bytes_read_bio_secmem(unsigned char **pdata, long *plen, char **pnm, 296. const char *name, BIO *bp, pem_password_cb *cb, 297. void *u) { crypto/pem/pem_lib.c:298:12: Call 296. const char *name, BIO *bp, pem_password_cb *cb, 297. void *u) { 298. return pem_bytes_read_bio_flags(pdata, plen, pnm, name, bp, cb, u, ^ 299. PEM_FLAG_SECURE | PEM_FLAG_EAY_COMPATIBLE); 300. } crypto/pem/pem_lib.c:245:1: Parameter `**pdata` 243. } 244. 245. > static int pem_bytes_read_bio_flags(unsigned char **pdata, long *plen, 246. char **pnm, const char *name, BIO *bp, 247. pem_password_cb *cb, void *u, crypto/pem/pem_pkey.c:38:5: Assignment 36. cb, u)) 37. return NULL; 38. p = data; ^ 39. 40. if (strcmp(nm, PEM_STRING_PKCS8INF) == 0) { crypto/pem/pem_pkey.c:42:17: Call 40. if (strcmp(nm, PEM_STRING_PKCS8INF) == 0) { 41. PKCS8_PRIV_KEY_INFO *p8inf; 42. p8inf = d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, len); ^ 43. if (!p8inf) 44. goto p8err; crypto/asn1/p8_pkey.c:36:1: Parameter `**in` 34. } ASN1_SEQUENCE_END_cb(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) 35. 36. > IMPLEMENT_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO) 37. 38. int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj, crypto/asn1/p8_pkey.c:36:1: Call 34. } ASN1_SEQUENCE_END_cb(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) 35. 36. > IMPLEMENT_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO) 37. 38. int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj, crypto/asn1/tasn_dec.c:95:1: Parameter `**in` 93. */ 94. 95. > ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, 96. const unsigned char **in, long len, 97. const ASN1_ITEM *it) crypto/asn1/tasn_dec.c:104:9: Call 102. pval = &ptmpval; 103. asn1_tlc_clear_nc(&c); 104. if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) ^ 105. return *pval; 106. return NULL; crypto/asn1/tasn_dec.c:109:1: Parameter `**in` 107. } 108. 109. > int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, 110. const ASN1_ITEM *it, 111. int tag, int aclass, char opt, ASN1_TLC *ctx) crypto/asn1/tasn_dec.c:114:10: Call 112. { 113. int rv; 114. rv = asn1_item_embed_d2i(pval, in, len, it, tag, aclass, opt, ctx); ^ 115. if (rv <= 0) 116. ASN1_item_ex_free(pval, it); crypto/asn1/tasn_dec.c:125:1: Parameter `**in` 123. */ 124. 125. > static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in, 126. long len, const ASN1_ITEM *it, 127. int tag, int aclass, char opt, ASN1_TLC *ctx) crypto/asn1/tasn_dec.c:169:9: Assignment 167. 168. case ASN1_ITYPE_MSTRING: 169. p = *in; ^ 170. /* Just read in tag and class */ 171. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, crypto/asn1/tasn_dec.c:171:15: Call 169. p = *in; 170. /* Just read in tag and class */ 171. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, ^ 172. &p, len, -1, 0, 1, ctx); 173. if (!ret) { crypto/asn1/tasn_dec.c:1060:1: Parameter `**in` 1058. */ 1059. 1060. > static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, 1061. char *inf, char *cst, 1062. const unsigned char **in, long len, crypto/asn1/tasn_dec.c:1069:5: Assignment 1067. long plen; 1068. const unsigned char *p, *q; 1069. p = *in; ^ 1070. q = p; 1071. crypto/asn1/tasn_dec.c:1079:13: Call 1077. p += ctx->hdrlen; 1078. } else { 1079. i = ASN1_get_object(&p, &plen, &ptag, &pclass, len); ^ 1080. if (ctx) { 1081. ctx->ret = i; crypto/asn1/asn1_lib.c:44:1: Parameter `**pp` 42. } 43. 44. > int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, 45. int *pclass, long omax) 46. { crypto/asn1/asn1_lib.c:49:5: Assignment 47. int i, ret; 48. long l; 49. const unsigned char *p = *pp; ^ 50. int tag, xclass, inf; 51. long max = omax; crypto/asn1/asn1_lib.c:78:9: Assignment 76. } else { 77. tag = i; 78. p++; ^ 79. if (--max == 0) 80. goto err; crypto/asn1/asn1_lib.c:84:10: Call 82. *ptag = tag; 83. *pclass = xclass; 84. if (!asn1_get_length(&p, &inf, plength, max)) ^ 85. goto err; 86. crypto/asn1/asn1_lib.c:105:1: <Length trace> 103. } 104. 105. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, 106. long max) 107. { crypto/asn1/asn1_lib.c:105:1: Parameter `**pp` 103. } 104. 105. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, 106. long max) 107. { crypto/asn1/asn1_lib.c:108:5: Assignment 106. long max) 107. { 108. const unsigned char *p = *pp; ^ 109. unsigned long ret = 0; 110. unsigned long i; crypto/asn1/asn1_lib.c:121:15: Assignment 119. *inf = 0; 120. i = *p & 0x7f; 121. if (*(p++) & 0x80) { ^ 122. if (max < (long)i + 1) 123. return 0; crypto/asn1/asn1_lib.c:125:25: Array access: Offset: [2, +oo] Size: [1, +oo] by call to `d2i_PKCS8_PRIV_KEY_INFO` 123. return 0; 124. /* Skip leading zeroes */ 125. while (i && *p == 0) { ^ 126. p++; 127. i--;
https://github.com/openssl/openssl/blob/fa3ed5b2c2b508a6444124fdf12ecbb4898007ed/crypto/asn1/asn1_lib.c/#L125
d2a_code_trace_data_44928
static int check_cert(X509_STORE_CTX *ctx) { X509_CRL *crl = NULL, *dcrl = NULL; X509 *x; int ok, cnum; cnum = ctx->error_depth; x = sk_X509_value(ctx->chain, cnum); ctx->current_cert = x; ctx->current_issuer = NULL; ctx->current_reasons = 0; while (ctx->current_reasons != CRLDP_ALL_REASONS) { if (ctx->get_crl) ok = ctx->get_crl(ctx, &crl, x); else ok = get_crl_delta(ctx, &crl, &dcrl, x); if(!ok) { ctx->error = X509_V_ERR_UNABLE_TO_GET_CRL; ok = ctx->verify_cb(0, ctx); goto err; } ctx->current_crl = crl; ok = ctx->check_crl(ctx, crl); if (!ok) goto err; if (dcrl) { ok = ctx->check_crl(ctx, dcrl); if (!ok) goto err; ok = ctx->cert_crl(ctx, dcrl, x); if (!ok) goto err; } else ok = 1; if (ok != 2) { ok = ctx->cert_crl(ctx, crl, x); if (!ok) goto err; } X509_CRL_free(crl); X509_CRL_free(dcrl); crl = NULL; dcrl = NULL; } err: X509_CRL_free(crl); X509_CRL_free(dcrl); ctx->current_crl = NULL; return ok; } crypto/x509/x509_vfy.c:753: error: UNINITIALIZED_VALUE The value read from ok was never initialized. Showing all 1 steps of the trace crypto/x509/x509_vfy.c:753:2: 751. 752. ctx->current_crl = NULL; 753. > return ok; 754. 755. }
https://github.com/openssl/openssl/blob/d43c4497ce1611373c3a3e5b433dfde4907d1a69/crypto/x509/x509_vfy.c/#L753
d2a_code_trace_data_44929
static int append_entry(HLSContext *hls, int64_t duration) { ListEntry *en = av_malloc(sizeof(*en)); if (!en) return AVERROR(ENOMEM); av_strlcpy(en->name, av_basename(hls->avf->filename), sizeof(en->name)); en->duration = duration; en->next = NULL; if (!hls->list) hls->list = en; else hls->end_list->next = en; hls->end_list = en; if (hls->nb_entries >= hls->size) { en = hls->list; hls->list = en->next; av_free(en); } else hls->nb_entries++; hls->sequence++; return 0; } libavformat/hlsenc.c:502: error: Use After Free call to `append_entry()` eventually accesses memory that was invalidated by call to `free()` on line 500 indirectly during the call to `avformat_free_context()`. libavformat/hlsenc.c:493:1: invalidation part of the trace starts here 491. } 492. 493. static int hls_write_trailer(struct AVFormatContext *s) ^ 494. { 495. HLSContext *hls = s->priv_data; libavformat/hlsenc.c:493:1: parameter `s` of hls_write_trailer 491. } 492. 493. static int hls_write_trailer(struct AVFormatContext *s) ^ 494. { 495. HLSContext *hls = s->priv_data; libavformat/hlsenc.c:495:5: assigned 493. static int hls_write_trailer(struct AVFormatContext *s) 494. { 495. HLSContext *hls = s->priv_data; ^ 496. AVFormatContext *oc = hls->avf; 497. libavformat/hlsenc.c:496:5: assigned 494. { 495. HLSContext *hls = s->priv_data; 496. AVFormatContext *oc = hls->avf; ^ 497. 498. av_write_trailer(oc); libavformat/hlsenc.c:500:5: when calling `avformat_free_context` here 498. av_write_trailer(oc); 499. ff_format_io_close(s, &oc->pb); 500. avformat_free_context(oc); ^ 501. av_free(hls->basename); 502. append_entry(hls, hls->duration); libavformat/utils.c:2705:1: parameter `s` of avformat_free_context 2703. } 2704. 2705. void avformat_free_context(AVFormatContext *s) ^ 2706. { 2707. int i; libavformat/utils.c:2734:5: when calling `av_free` here 2732. av_freep(&s->streams); 2733. av_freep(&s->internal); 2734. av_free(s); ^ 2735. } 2736. libavutil/mem.c:170:1: parameter `ptr` of av_free 168. } 169. 170. void av_free(void *ptr) ^ 171. { 172. #if HAVE_ALIGNED_MALLOC libavutil/mem.c:175:5: was invalidated by call to `free()` 173. _aligned_free(ptr); 174. #else 175. free(ptr); ^ 176. #endif 177. } libavformat/hlsenc.c:493:1: use-after-lifetime part of the trace starts here 491. } 492. 493. static int hls_write_trailer(struct AVFormatContext *s) ^ 494. { 495. HLSContext *hls = s->priv_data; libavformat/hlsenc.c:493:1: parameter `s` of hls_write_trailer 491. } 492. 493. static int hls_write_trailer(struct AVFormatContext *s) ^ 494. { 495. HLSContext *hls = s->priv_data; libavformat/hlsenc.c:495:5: assigned 493. static int hls_write_trailer(struct AVFormatContext *s) 494. { 495. HLSContext *hls = s->priv_data; ^ 496. AVFormatContext *oc = hls->avf; 497. libavformat/hlsenc.c:502:5: when calling `append_entry` here 500. avformat_free_context(oc); 501. av_free(hls->basename); 502. append_entry(hls, hls->duration); ^ 503. hls_window(s, 1); 504. libavformat/hlsenc.c:203:1: parameter `hls` of append_entry 201. } 202. 203. static int append_entry(HLSContext *hls, int64_t duration) ^ 204. { 205. ListEntry *en = av_malloc(sizeof(*en)); libavformat/hlsenc.c:210:26: invalid access occurs here 208. return AVERROR(ENOMEM); 209. 210. av_strlcpy(en->name, av_basename(hls->avf->filename), sizeof(en->name)); ^ 211. 212. en->duration = duration;
https://github.com/libav/libav/blob/d0c84c41d33ffd270d5f9fe0290e08341397fdee/libavformat/hlsenc.c/#L210
d2a_code_trace_data_44930
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; return 1; } ssl/statem/statem_clnt.c:2409: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 8]):unsigned64 by call to `WPACKET_sub_memcpy__`. Showing all 14 steps of the trace ssl/statem/statem_clnt.c:2407:10: Call 2405. } 2406. 2407. if (!WPACKET_put_bytes_u8(pkt, V_ASN1_SEQUENCE | V_ASN1_CONSTRUCTED) ^ 2408. || (msglen >= 0x80 && !WPACKET_put_bytes_u8(pkt, 0x81)) 2409. || !WPACKET_sub_memcpy_u8(pkt, tmp, msglen)) { ssl/packet.c:261:1: Parameter `pkt->buf->length` 259. } 260. 261. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 262. { 263. unsigned char *data; ssl/statem/statem_clnt.c:2409:17: Call 2407. if (!WPACKET_put_bytes_u8(pkt, V_ASN1_SEQUENCE | V_ASN1_CONSTRUCTED) 2408. || (msglen >= 0x80 && !WPACKET_put_bytes_u8(pkt, 0x81)) 2409. || !WPACKET_sub_memcpy_u8(pkt, tmp, msglen)) { ^ 2410. *al = SSL_AD_INTERNAL_ERROR; 2411. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_GOST, ERR_R_INTERNAL_ERROR); ssl/packet.c:317:1: Parameter `pkt->written` 315. } 316. 317. > int WPACKET_sub_memcpy__(WPACKET *pkt, const void *src, size_t len, 318. size_t lenbytes) 319. { ssl/packet.c:320:10: Call 318. size_t lenbytes) 319. { 320. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) ^ 321. || !WPACKET_memcpy(pkt, src, len) 322. || !WPACKET_close(pkt)) ssl/packet.c:224:1: Parameter `pkt->written` 222. } 223. 224. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 225. { 226. WPACKET_SUB *sub; ssl/packet.c:248:10: Call 246. } 247. 248. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 249. return 0; 250. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */ ssl/packet.c:15:1: Parameter `pkt->written` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ssl/packet.c:17:10: Call 15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ^ 18. return 0; 19. ssl/packet.c:36:1: <LHS trace> 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: Parameter `pkt->buf->length` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: <RHS trace> 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: Parameter `len` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:46:9: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 8]):unsigned64 by call to `WPACKET_sub_memcpy__` 44. return 0; 45. 46. if (pkt->buf->length - pkt->written < len) { ^ 47. size_t newlen; 48. size_t reflen;
https://github.com/openssl/openssl/blob/e4e1aa903e624044d3319622fc50222f1b2c7328/ssl/packet.c/#L46
d2a_code_trace_data_44931
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:586: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_GF2m_mod_inv`. Showing all 18 steps of the trace test/bntest.c:586:13: Call 584. BN_bntest_rand(a, 512, 0, 0); 585. for (j = 0; j < 2; j++) { 586. BN_GF2m_mod_inv(c, a, b[j], ctx); ^ 587. BN_GF2m_mod_mul(d, a, c, b[j], ctx); 588. /* Test that ((1/a)*a) = 1. */ crypto/bn/bn_gf2m.c:560:1: Parameter `ctx->stack.depth` 558. * Curve Cryptography Over Binary Fields". 559. */ 560. > int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) 561. { 562. BIGNUM *b, *c = NULL, *u = NULL, *v = NULL, *tmp; crypto/bn/bn_gf2m.c:568:5: Call 566. bn_check_top(p); 567. 568. BN_CTX_start(ctx); ^ 569. 570. if ((b = 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_gf2m.c:724:5: Call 722. bn_correct_top(v); 723. # endif 724. BN_CTX_end(ctx); ^ 725. return ret; 726. } 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); test/bntest.c:587:13: Call 585. for (j = 0; j < 2; j++) { 586. BN_GF2m_mod_inv(c, a, b[j], ctx); 587. BN_GF2m_mod_mul(d, a, c, b[j], ctx); ^ 588. /* Test that ((1/a)*a) = 1. */ 589. if (!BN_is_one(d)) { 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:586:13: Call 584. BN_bntest_rand(a, 512, 0, 0); 585. for (j = 0; j < 2; j++) { 586. BN_GF2m_mod_inv(c, a, b[j], ctx); ^ 587. BN_GF2m_mod_mul(d, a, c, b[j], ctx); 588. /* Test that ((1/a)*a) = 1. */ crypto/bn/bn_gf2m.c:560:1: Parameter `ctx->stack.depth` 558. * Curve Cryptography Over Binary Fields". 559. */ 560. > int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) 561. { 562. BIGNUM *b, *c = NULL, *u = NULL, *v = NULL, *tmp; crypto/bn/bn_gf2m.c:568:5: Call 566. bn_check_top(p); 567. 568. BN_CTX_start(ctx); ^ 569. 570. if ((b = 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_gf2m.c:724:5: Call 722. bn_correct_top(v); 723. # endif 724. BN_CTX_end(ctx); ^ 725. return ret; 726. } 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_inv` 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_44932
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:674: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_GF2m_mod_mul`. Showing all 24 steps of the trace test/bntest.c:672:13: Call 670. BN_bntest_rand(d, 512, 0, 0); 671. for (j = 0; j < 2; j++) { 672. BN_GF2m_mod_exp(e, a, c, b[j], ctx); ^ 673. BN_GF2m_mod_exp(f, a, d, b[j], ctx); 674. BN_GF2m_mod_mul(e, e, f, b[j], ctx); crypto/bn/bn_gf2m.c:955:1: Parameter `ctx->stack.depth` 953. * for best performance, use the BN_GF2m_mod_exp_arr function. 954. */ 955. > int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 956. const BIGNUM *p, BN_CTX *ctx) 957. { test/bntest.c:673:13: Call 671. for (j = 0; j < 2; j++) { 672. BN_GF2m_mod_exp(e, a, c, b[j], ctx); 673. BN_GF2m_mod_exp(f, a, d, b[j], ctx); ^ 674. BN_GF2m_mod_mul(e, e, f, b[j], ctx); 675. BN_add(f, c, d); crypto/bn/bn_gf2m.c:955:1: Parameter `ctx->stack.depth` 953. * for best performance, use the BN_GF2m_mod_exp_arr function. 954. */ 955. > int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 956. const BIGNUM *p, BN_CTX *ctx) 957. { test/bntest.c:674:13: Call 672. BN_GF2m_mod_exp(e, a, c, b[j], ctx); 673. BN_GF2m_mod_exp(f, a, d, b[j], ctx); 674. BN_GF2m_mod_mul(e, e, f, b[j], ctx); ^ 675. BN_add(f, c, d); 676. BN_GF2m_mod_exp(f, a, f, 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:676:13: Call 674. BN_GF2m_mod_mul(e, e, f, b[j], ctx); 675. BN_add(f, c, d); 676. BN_GF2m_mod_exp(f, a, f, b[j], ctx); ^ 677. BN_GF2m_add(f, e, f); 678. /* Test that a^(c+d)=a^c*a^d. */ crypto/bn/bn_gf2m.c:955:1: Parameter `ctx->stack.depth` 953. * for best performance, use the BN_GF2m_mod_exp_arr function. 954. */ 955. > int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 956. const BIGNUM *p, BN_CTX *ctx) 957. { test/bntest.c:672:13: Call 670. BN_bntest_rand(d, 512, 0, 0); 671. for (j = 0; j < 2; j++) { 672. BN_GF2m_mod_exp(e, a, c, b[j], ctx); ^ 673. BN_GF2m_mod_exp(f, a, d, b[j], ctx); 674. BN_GF2m_mod_mul(e, e, f, b[j], ctx); crypto/bn/bn_gf2m.c:955:1: Parameter `ctx->stack.depth` 953. * for best performance, use the BN_GF2m_mod_exp_arr function. 954. */ 955. > int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 956. const BIGNUM *p, BN_CTX *ctx) 957. { test/bntest.c:673:13: Call 671. for (j = 0; j < 2; j++) { 672. BN_GF2m_mod_exp(e, a, c, b[j], ctx); 673. BN_GF2m_mod_exp(f, a, d, b[j], ctx); ^ 674. BN_GF2m_mod_mul(e, e, f, b[j], ctx); 675. BN_add(f, c, d); crypto/bn/bn_gf2m.c:955:1: Parameter `ctx->stack.depth` 953. * for best performance, use the BN_GF2m_mod_exp_arr function. 954. */ 955. > int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 956. const BIGNUM *p, BN_CTX *ctx) 957. { test/bntest.c:674:13: Call 672. BN_GF2m_mod_exp(e, a, c, b[j], ctx); 673. BN_GF2m_mod_exp(f, a, d, b[j], ctx); 674. BN_GF2m_mod_mul(e, e, f, b[j], ctx); ^ 675. BN_add(f, c, d); 676. BN_GF2m_mod_exp(f, a, f, 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_44933
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/exptest.c:159: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_div`. Showing all 11 steps of the trace test/exptest.c:159:10: Call 157. BN_rand(m, NUM_BITS + c, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD); 158. 159. if (!TEST_true(BN_mod(a, a, m, ctx)) ^ 160. || !TEST_true(BN_mod(b, b, m, ctx)) 161. || !TEST_true(BN_mod_exp_mont(r_mont, a, b, m, ctx, NULL)) crypto/bn/bn_div.c:193:5: Call 191. } 192. 193. BN_CTX_start(ctx); ^ 194. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 195. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:413:5: Call 411. if (no_branch) 412. bn_correct_top(res); 413. BN_CTX_end(ctx); ^ 414. return (1); 415. err: crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.indexes` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:271:1: <Offset trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `st->depth` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: <Length trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `*st->indexes` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:273:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_div` 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/c784a838e0947fcca761ee62def7d077dc06d37f/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_44934
int tls13_enc(SSL *s, SSL3_RECORD *recs, size_t n_recs, int sending) { EVP_CIPHER_CTX *ctx; unsigned char iv[EVP_MAX_IV_LENGTH]; size_t ivlen, taglen, offset, loop; unsigned char *staticiv; unsigned char *seq; int lenu, lenf; SSL3_RECORD *rec = &recs[0]; uint32_t alg_enc; if (n_recs != 1) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS13_ENC, ERR_R_INTERNAL_ERROR); return -1; } if (sending) { ctx = s->enc_write_ctx; staticiv = s->write_iv; seq = RECORD_LAYER_get_write_sequence(&s->rlayer); } else { ctx = s->enc_read_ctx; staticiv = s->read_iv; seq = RECORD_LAYER_get_read_sequence(&s->rlayer); } if (ctx == NULL) { memmove(rec->data, rec->input, rec->length); rec->input = rec->data; return 1; } ivlen = EVP_CIPHER_CTX_iv_length(ctx); if (s->early_data_state == SSL_EARLY_DATA_WRITING || s->early_data_state == SSL_EARLY_DATA_WRITE_RETRY) { if (s->session != NULL && s->session->ext.max_early_data > 0) { alg_enc = s->session->cipher->algorithm_enc; } else { if (!ossl_assert(s->psksession != NULL && s->psksession->ext.max_early_data > 0)) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS13_ENC, ERR_R_INTERNAL_ERROR); return -1; } alg_enc = s->psksession->cipher->algorithm_enc; } } else { if (!ossl_assert(s->s3->tmp.new_cipher != NULL)) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS13_ENC, ERR_R_INTERNAL_ERROR); return -1; } alg_enc = s->s3->tmp.new_cipher->algorithm_enc; } if (alg_enc & SSL_AESCCM) { if (alg_enc & (SSL_AES128CCM8 | SSL_AES256CCM8)) taglen = EVP_CCM8_TLS_TAG_LEN; else taglen = EVP_CCM_TLS_TAG_LEN; if (sending && EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, taglen, NULL) <= 0) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS13_ENC, ERR_R_INTERNAL_ERROR); return -1; } } else if (alg_enc & SSL_AESGCM) { taglen = EVP_GCM_TLS_TAG_LEN; } else if (alg_enc & SSL_CHACHA20) { taglen = EVP_CHACHAPOLY_TLS_TAG_LEN; } else { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS13_ENC, ERR_R_INTERNAL_ERROR); return -1; } if (!sending) { if (rec->length < taglen + 1) return 0; rec->length -= taglen; } if (ivlen < SEQ_NUM_SIZE) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS13_ENC, ERR_R_INTERNAL_ERROR); return -1; } offset = ivlen - SEQ_NUM_SIZE; memcpy(iv, staticiv, offset); for (loop = 0; loop < SEQ_NUM_SIZE; loop++) iv[offset + loop] = staticiv[offset + loop] ^ seq[loop]; for (loop = SEQ_NUM_SIZE; loop > 0; loop--) { ++seq[loop - 1]; if (seq[loop - 1] != 0) break; } if (loop == 0) { return -1; } if (EVP_CipherInit_ex(ctx, NULL, NULL, NULL, iv, sending) <= 0 || (!sending && EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, taglen, rec->data + rec->length) <= 0) || EVP_CipherUpdate(ctx, rec->data, &lenu, rec->input, (unsigned int)rec->length) <= 0 || EVP_CipherFinal_ex(ctx, rec->data + lenu, &lenf) <= 0 || (size_t)(lenu + lenf) != rec->length) { return -1; } if (sending) { if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, taglen, rec->data + rec->length) <= 0) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS13_ENC, ERR_R_INTERNAL_ERROR); return -1; } rec->length += taglen; } return 1; } ssl/record/rec_layer_s3.c:985: error: INTEGER_OVERFLOW_L2 ([9, +oo] - [8, 16]):unsigned64 by call to `tls13_enc`. Showing all 8 steps of the trace ssl/record/rec_layer_s3.c:644:1: Parameter `*pipelens` 642. } 643. 644. > int do_ssl3_write(SSL *s, int type, const unsigned char *buf, 645. size_t *pipelens, size_t numpipes, 646. int create_empty_fragment, size_t *written) ssl/record/rec_layer_s3.c:864:9: Assignment 862. /* lets setup the record stuff. */ 863. SSL3_RECORD_set_data(thiswr, compressdata); 864. SSL3_RECORD_set_length(thiswr, pipelens[j]); ^ 865. SSL3_RECORD_set_input(thiswr, (unsigned char *)&buf[totlen]); 866. totlen += pipelens[j]; ssl/record/rec_layer_s3.c:985:13: Call 983. * send early data - so we need to use the tls13enc function. 984. */ 985. if (tls13_enc(s, wr, numpipes, 1) < 1) { ^ 986. if (!ossl_statem_in_error(s)) { 987. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_DO_SSL3_WRITE, ssl/record/ssl3_record_tls13.c:25:1: <LHS trace> 23. * an internal error occurred. 24. */ 25. > int tls13_enc(SSL *s, SSL3_RECORD *recs, size_t n_recs, int sending) 26. { 27. EVP_CIPHER_CTX *ctx; ssl/record/ssl3_record_tls13.c:25:1: Parameter `recs->length` 23. * an internal error occurred. 24. */ 25. > int tls13_enc(SSL *s, SSL3_RECORD *recs, size_t n_recs, int sending) 26. { 27. EVP_CIPHER_CTX *ctx; ssl/record/ssl3_record_tls13.c:25:1: <RHS trace> 23. * an internal error occurred. 24. */ 25. > int tls13_enc(SSL *s, SSL3_RECORD *recs, size_t n_recs, int sending) 26. { 27. EVP_CIPHER_CTX *ctx; ssl/record/ssl3_record_tls13.c:25:1: Parameter `recs->length` 23. * an internal error occurred. 24. */ 25. > int tls13_enc(SSL *s, SSL3_RECORD *recs, size_t n_recs, int sending) 26. { 27. EVP_CIPHER_CTX *ctx; ssl/record/ssl3_record_tls13.c:116:9: Binary operation: ([9, +oo] - [8, 16]):unsigned64 by call to `tls13_enc` 114. if (rec->length < taglen + 1) 115. return 0; 116. rec->length -= taglen; ^ 117. } 118.
https://github.com/openssl/openssl/blob/a8ea8018fa187e22fb4989450b550589e20f62c2/ssl/record/ssl3_record_tls13.c/#L116
d2a_code_trace_data_44935
IMPLEMENT_new_ctx(ecb, ECB, 128) providers/common/ciphers/aes.c:288: error: NULL_DEREFERENCE pointer `ctx` last assigned on line 288 could be null and is dereferenced at line 288, column 1. Showing all 18 steps of the trace providers/common/ciphers/aes.c:288:1: start of procedure aes_128_ecb_newctx() 286. IMPLEMENT_new_ctx(ecb, ECB, 256) 287. IMPLEMENT_new_ctx(ecb, ECB, 192) 288. > IMPLEMENT_new_ctx(ecb, ECB, 128) 289. 290. /* CBC */ 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 false branch 231. 232. FAILTEST(); 233. if (ret != NULL) ^ 234. memset(ret, 0, num); 235. return ret; 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) providers/common/ciphers/aes.c:288:1: 286. IMPLEMENT_new_ctx(ecb, ECB, 256) 287. IMPLEMENT_new_ctx(ecb, ECB, 192) 288. > IMPLEMENT_new_ctx(ecb, ECB, 128) 289. 290. /* CBC */
https://github.com/openssl/openssl/blob/f79858ac4d90a450d0620d1ecb713bc35d7d9f8d/providers/common/ciphers/aes.c/#L288
d2a_code_trace_data_44936
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); } ssl/statem/statem_clnt.c:1625: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `EC_KEY_oct2key`. Showing all 26 steps of the trace ssl/statem/statem_clnt.c:1625:13: Call 1623. } 1624. 1625. if (EC_KEY_oct2key(EVP_PKEY_get0_EC_KEY(s->s3->peer_tmp), ^ 1626. PACKET_data(&encoded_pt), 1627. PACKET_remaining(&encoded_pt), NULL) == 0) { crypto/ec/ec_key.c:540:1: Parameter `key->group->field->top` 538. } 539. 540. > int EC_KEY_oct2key(EC_KEY *key, const unsigned char *buf, size_t len, 541. BN_CTX *ctx) 542. { crypto/ec/ec_key.c:549:12: Call 547. if (key->pub_key == NULL) 548. return 0; 549. return EC_POINT_oct2point(key->group, key->pub_key, buf, len, ctx); ^ 550. } 551. crypto/ec/ec_oct.c:165:1: Parameter `group->field->top` 163. } 164. 165. > int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point, 166. const unsigned char *buf, size_t len, BN_CTX *ctx) 167. { crypto/ec/ec_oct.c:187:20: Call 185. } 186. #else 187. return ec_GF2m_simple_oct2point(group, point, buf, len, ctx); ^ 188. #endif 189. } crypto/ec/ec2_oct.c:293:1: Parameter `group->field->top` 291. * simple implementation only uses affine coordinates. 292. */ 293. > int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point, 294. const unsigned char *buf, size_t len, 295. BN_CTX *ctx) crypto/ec/ec2_oct.c:362:14: Call 360. 361. if (form == POINT_CONVERSION_COMPRESSED) { 362. if (!EC_POINT_set_compressed_coordinates_GF2m ^ 363. (group, point, x, y_bit, ctx)) 364. goto err; crypto/ec/ec_oct.c:106:1: Parameter `group->field->top` 104. 105. #ifndef OPENSSL_NO_EC2M 106. > int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, 107. EC_POINT *point, const BIGNUM *x, 108. int y_bit, BN_CTX *ctx) crypto/ec/ec_oct.c:123:20: Call 121. if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) { 122. if (group->meth->field_type == NID_X9_62_prime_field) 123. return ec_GFp_simple_set_compressed_coordinates(group, point, x, ^ 124. y_bit, ctx); 125. else crypto/ec/ecp_oct.c:70:1: Parameter `group->field->top` 68. #include "ec_lcl.h" 69. 70. > int ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group, 71. EC_POINT *point, 72. const BIGNUM *x_, int y_bit, crypto/ec/ecp_oct.c:105:10: Call 103. 104. /* tmp1 := x^3 */ 105. if (!BN_nnmod(x, x_, group->field, ctx)) ^ 106. goto err; 107. if (group->meth->field_decode == 0) { crypto/bn/bn_mod.c:118:1: Parameter `d->top` 116. #include "bn_lcl.h" 117. 118. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 119. { 120. /* crypto/bn/bn_mod.c:125:11: Call 123. */ 124. 125. if (!(BN_mod(r, m, d, ctx))) ^ 126. return 0; 127. if (!r->neg) crypto/bn/bn_div.c:253:31: Call 251. 252. /* First we normalise the numbers */ 253. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 254. if (!(BN_lshift(sdiv, divisor, norm_shift))) 255. goto err; crypto/bn/bn_lib.c:220:9: Assignment 218. 219. if (BN_is_zero(a)) 220. return 0; ^ 221. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); 222. } crypto/bn/bn_div.c:253:5: Assignment 251. 252. /* First we normalise the numbers */ 253. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 254. if (!(BN_lshift(sdiv, divisor, norm_shift))) 255. goto err; crypto/bn/bn_div.c:254:11: Call 252. /* First we normalise the numbers */ 253. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); 254. if (!(BN_lshift(sdiv, divisor, norm_shift))) ^ 255. goto err; 256. sdiv->neg = 0; crypto/bn/bn_shift.c:129:1: <Offset trace> 127. } 128. 129. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 130. { 131. int i, nw, lb, rb; crypto/bn/bn_shift.c:129:1: Parameter `n` 127. } 128. 129. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 130. { 131. int i, nw, lb, rb; crypto/bn/bn_shift.c:144:5: Assignment 142. 143. r->neg = a->neg; 144. nw = n / BN_BITS2; ^ 145. if (bn_wexpand(r, a->top + nw + 1) == NULL) 146. return (0); crypto/bn/bn_shift.c:129:1: <Length trace> 127. } 128. 129. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 130. { 131. int i, nw, lb, rb; crypto/bn/bn_shift.c:129:1: Parameter `*r->d` 127. } 128. 129. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 130. { 131. int i, nw, lb, rb; crypto/bn/bn_shift.c:145:9: Call 143. r->neg = a->neg; 144. nw = n / BN_BITS2; 145. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 146. return (0); 147. lb = n % BN_BITS2; crypto/bn/bn_lib.c:1071:1: Parameter `*a->d` 1069. } 1070. 1071. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 1072. { 1073. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:150:5: Assignment 148. rb = BN_BITS2 - lb; 149. f = a->d; 150. t = r->d; ^ 151. t[a->top + nw] = 0; 152. if (lb == 0) crypto/bn/bn_shift.c:158:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `EC_KEY_oct2key` 156. for (i = a->top - 1; i >= 0; i--) { 157. l = f[i]; 158. t[nw + i + 1] |= (l >> rb) & BN_MASK2; ^ 159. t[nw + i] = (l << lb) & BN_MASK2; 160. }
https://github.com/openssl/openssl/blob/e51511ce497884ebf680714271ec96416e600622/crypto/bn/bn_shift.c/#L158
d2a_code_trace_data_44937
void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){ int i; InternalBuffer *buf, *last; AVCodecInternal *avci = s->internal; assert(pic->type==FF_BUFFER_TYPE_INTERNAL); assert(avci->buffer_count); if (avci->buffer) { buf = NULL; for (i = 0; i < avci->buffer_count; i++) { buf = &avci->buffer[i]; if (buf->data[0] == pic->data[0]) break; } assert(i < avci->buffer_count); avci->buffer_count--; last = &avci->buffer[avci->buffer_count]; FFSWAP(InternalBuffer, *buf, *last); } for(i=0; i<4; i++){ pic->data[i]=NULL; } if(s->debug&FF_DEBUG_BUFFERS) av_log(s, AV_LOG_DEBUG, "default_release_buffer called on pic %p, %d " "buffers used\n", pic, avci->buffer_count); } libavcodec/utils.c:387: error: Null Dereference pointer `buf` last assigned on line 377 could be null and is dereferenced at line 387, column 9. libavcodec/utils.c:368:1: start of procedure avcodec_default_release_buffer() 366. } 367. 368. void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){ ^ 369. int i; 370. InternalBuffer *buf, *last; libavcodec/utils.c:371:5: 369. int i; 370. InternalBuffer *buf, *last; 371. AVCodecInternal *avci = s->internal; ^ 372. 373. assert(pic->type==FF_BUFFER_TYPE_INTERNAL); libavcodec/utils.c:373:5: 371. AVCodecInternal *avci = s->internal; 372. 373. assert(pic->type==FF_BUFFER_TYPE_INTERNAL); ^ 374. assert(avci->buffer_count); 375. libavcodec/utils.c:374:5: 372. 373. assert(pic->type==FF_BUFFER_TYPE_INTERNAL); 374. assert(avci->buffer_count); ^ 375. 376. if (avci->buffer) { libavcodec/utils.c:376:9: Taking true branch 374. assert(avci->buffer_count); 375. 376. if (avci->buffer) { ^ 377. buf = NULL; /* avoids warning */ 378. for (i = 0; i < avci->buffer_count; i++) { //just 3-5 checks so is not worth to optimize libavcodec/utils.c:377:9: 375. 376. if (avci->buffer) { 377. buf = NULL; /* avoids warning */ ^ 378. for (i = 0; i < avci->buffer_count; i++) { //just 3-5 checks so is not worth to optimize 379. buf = &avci->buffer[i]; libavcodec/utils.c:378:14: 376. if (avci->buffer) { 377. buf = NULL; /* avoids warning */ 378. for (i = 0; i < avci->buffer_count; i++) { //just 3-5 checks so is not worth to optimize ^ 379. buf = &avci->buffer[i]; 380. if (buf->data[0] == pic->data[0]) libavcodec/utils.c:378:21: Loop condition is false. Leaving loop 376. if (avci->buffer) { 377. buf = NULL; /* avoids warning */ 378. for (i = 0; i < avci->buffer_count; i++) { //just 3-5 checks so is not worth to optimize ^ 379. buf = &avci->buffer[i]; 380. if (buf->data[0] == pic->data[0]) libavcodec/utils.c:383:9: 381. break; 382. } 383. assert(i < avci->buffer_count); ^ 384. avci->buffer_count--; 385. last = &avci->buffer[avci->buffer_count]; libavcodec/utils.c:384:9: 382. } 383. assert(i < avci->buffer_count); 384. avci->buffer_count--; ^ 385. last = &avci->buffer[avci->buffer_count]; 386. libavcodec/utils.c:385:9: 383. assert(i < avci->buffer_count); 384. avci->buffer_count--; 385. last = &avci->buffer[avci->buffer_count]; ^ 386. 387. FFSWAP(InternalBuffer, *buf, *last); libavcodec/utils.c:387:9: 385. last = &avci->buffer[avci->buffer_count]; 386. 387. FFSWAP(InternalBuffer, *buf, *last); ^ 388. } 389.
https://github.com/libav/libav/blob/f3a29b750a5979ae6847879fba758faf1fae88d0/libavcodec/utils.c/#L387
d2a_code_trace_data_44938
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/dsa/dsa_ossl.c:208: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_div`. Showing all 13 steps of the trace crypto/dsa/dsa_ossl.c:133:1: Parameter `(*rp)->top` 131. } 132. 133. > static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, 134. BIGNUM **kinvp, BIGNUM **rp, 135. const unsigned char *dgst, int dlen) crypto/dsa/dsa_ossl.c:208:10: Call 206. 207. 208. if (!BN_mod(r, r, dsa->q, ctx)) ^ 209. goto err; 210. crypto/bn/bn_div.c:140:1: Parameter `num->top` 138. * If 'dv' or 'rm' is NULL, the respective value is not returned. 139. */ 140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 141. BN_CTX *ctx) 142. { crypto/bn/bn_div.c:210:11: Call 208. sdiv->neg = 0; 209. norm_shift += BN_BITS2; 210. if (!(BN_lshift(snum, num, norm_shift))) ^ 211. goto err; 212. snum->neg = 0; crypto/bn/bn_shift.c:81:1: <Offset trace> 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:81:1: Parameter `n` 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:96:5: Assignment 94. 95. r->neg = a->neg; 96. nw = n / BN_BITS2; ^ 97. if (bn_wexpand(r, a->top + nw + 1) == NULL) 98. return (0); crypto/bn/bn_shift.c:81:1: <Length trace> 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:81:1: Parameter `*r->d` 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:9: Call 95. r->neg = a->neg; 96. nw = n / BN_BITS2; 97. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 98. return (0); 99. lb = n % BN_BITS2; crypto/bn/bn_lib.c:1014:1: Parameter `*a->d` 1012. } 1013. 1014. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 1015. { 1016. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:102:5: Assignment 100. rb = BN_BITS2 - lb; 101. f = a->d; 102. t = r->d; ^ 103. t[a->top + nw] = 0; 104. if (lb == 0) crypto/bn/bn_shift.c:110:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_div` 108. for (i = a->top - 1; i >= 0; i--) { 109. l = f[i]; 110. t[nw + i + 1] |= (l >> rb) & BN_MASK2; ^ 111. t[nw + i] = (l << lb) & BN_MASK2; 112. }
https://github.com/openssl/openssl/blob/ec772a817afc0f788c38006f623204a7d76221ec/crypto/bn/bn_shift.c/#L110
d2a_code_trace_data_44939
static dav_error * dav_validate_resource_state(apr_pool_t *p, const dav_resource *resource, dav_lockdb *lockdb, const dav_if_header *if_header, int flags, dav_buffer *pbuf, request_rec *r) { dav_error *err; const char *uri; const char *etag; const dav_hooks_locks *locks_hooks = (lockdb ? lockdb->hooks : NULL); const dav_if_header *ifhdr_scan; dav_if_state_list *state_list; dav_lock *lock_list; dav_lock *lock; int num_matched; int num_that_apply; int seen_locktoken; apr_size_t uri_len; const char *reason = NULL; if (lockdb == NULL) { lock_list = NULL; } else { if ((err = dav_lock_query(lockdb, resource, &lock_list)) != NULL) { return dav_push_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, "The locks could not be queried for " "verification against a possible \"If:\" " "header.", err); } } if (flags & DAV_LOCKSCOPE_EXCLUSIVE) { if (lock_list != NULL) { return dav_new_error(p, HTTP_LOCKED, 0, 0, "Existing lock(s) on the requested resource " "prevent an exclusive lock."); } seen_locktoken = 1; } else if (flags & DAV_LOCKSCOPE_SHARED) { for (lock = lock_list; lock != NULL; lock = lock->next) { if (lock->scope == DAV_LOCKSCOPE_EXCLUSIVE) { return dav_new_error(p, HTTP_LOCKED, 0, 0, "The requested resource is already " "locked exclusively."); } } seen_locktoken = 1; } else { seen_locktoken = (lock_list == NULL); } if (if_header == NULL) { if (seen_locktoken) return NULL; return dav_new_error(p, HTTP_LOCKED, 0, 0, "This resource is locked and an \"If:\" header " "was not supplied to allow access to the " "resource."); } if (lock_list == NULL && if_header->dummy_header) { if (flags & DAV_VALIDATE_IS_PARENT) return NULL; return dav_new_error(p, HTTP_BAD_REQUEST, 0, 0, "The locktoken specified in the \"Lock-Token:\" " "header is invalid because this resource has no " "outstanding locks."); } uri = resource->uri; uri_len = strlen(uri); if (uri[uri_len - 1] == '/') { dav_set_bufsize(p, pbuf, uri_len); memcpy(pbuf->buf, uri, uri_len); pbuf->buf[--uri_len] = '\0'; uri = pbuf->buf; } etag = (*resource->hooks->getetag)(resource); num_that_apply = 0; for (ifhdr_scan = if_header; ifhdr_scan != NULL; ifhdr_scan = ifhdr_scan->next) { if (ifhdr_scan->uri != NULL && (uri_len != ifhdr_scan->uri_len || memcmp(uri, ifhdr_scan->uri, uri_len) != 0)) { continue; } ++num_that_apply; for (state_list = ifhdr_scan->state; state_list != NULL; state_list = state_list->next) { switch(state_list->type) { case dav_if_etag: { const char *given_etag, *current_etag; int mismatch; if (state_list->etag[0] == 'W' && state_list->etag[1] == '/') { given_etag = state_list->etag + 2; } else { given_etag = state_list->etag; } if (etag[0] == 'W' && etag[1] == '/') { current_etag = etag + 2; } else { current_etag = etag; } mismatch = strcmp(given_etag, current_etag); if (state_list->condition == DAV_IF_COND_NORMAL && mismatch) { reason = "an entity-tag was specified, but the resource's " "actual ETag does not match."; goto state_list_failed; } else if (state_list->condition == DAV_IF_COND_NOT && !mismatch) { reason = "an entity-tag was specified using the \"Not\" form, " "but the resource's actual ETag matches the provided " "entity-tag."; goto state_list_failed; } break; } case dav_if_opaquelock: if (lockdb == NULL) { if (state_list->condition == DAV_IF_COND_NOT) { continue; } reason = "a State-token was supplied, but a lock database " "is not available for to provide the required lock."; goto state_list_failed; } num_matched = 0; for (lock = lock_list; lock != NULL; lock = lock->next) { if ((*locks_hooks->compare_locktoken)(state_list->locktoken, lock->locktoken)) { continue; } seen_locktoken = 1; if (state_list->condition == DAV_IF_COND_NOT) { reason = "a State-token was supplied, which used a " "\"Not\" condition. The State-token was found " "in the locks on this resource"; goto state_list_failed; } if (lock->auth_user && (!r->user || strcmp(lock->auth_user, r->user))) { const char *errmsg; errmsg = apr_pstrcat(p, "User \"", r->user, "\" submitted a locktoken created " "by user \"", lock->auth_user, "\".", NULL); return dav_new_error(p, HTTP_FORBIDDEN, 0, 0, errmsg); } num_matched = 1; break; } if (num_matched == 0 && state_list->condition == DAV_IF_COND_NORMAL) { reason = "a State-token was supplied, but it was not found " "in the locks on this resource."; goto state_list_failed; } break; case dav_if_unknown: if (state_list->condition == DAV_IF_COND_NORMAL) { reason = "an unknown state token was supplied"; goto state_list_failed; } break; } } if (seen_locktoken) { return NULL; } break; state_list_failed: ; } if (ifhdr_scan == NULL) { if (num_that_apply == 0) { if (seen_locktoken) return NULL; if (dav_find_submitted_locktoken(if_header, lock_list, locks_hooks)) { return NULL; } return dav_new_error(p, HTTP_LOCKED, 0 , 0, "This resource is locked and the \"If:\" " "header did not specify one of the " "locktokens for this resource's lock(s)."); } if (if_header->dummy_header) { return dav_new_error(p, HTTP_BAD_REQUEST, 0, 0, "The locktoken specified in the " "\"Lock-Token:\" header did not specify one " "of this resource's locktoken(s)."); } if (reason == NULL) { return dav_new_error(p, HTTP_PRECONDITION_FAILED, 0, 0, "The preconditions specified by the \"If:\" " "header did not match this resource."); } return dav_new_error(p, HTTP_PRECONDITION_FAILED, 0, 0, apr_psprintf(p, "The precondition(s) specified by " "the \"If:\" header did not match " "this resource. At least one " "failure is because: %s", reason)); } if (dav_find_submitted_locktoken(if_header, lock_list, locks_hooks)) { return NULL; } if (if_header->dummy_header) { return dav_new_error(p, HTTP_BAD_REQUEST, 0, 0, "The locktoken specified in the " "\"Lock-Token:\" header did not specify one " "of this resource's locktoken(s)."); } return dav_new_error(p, HTTP_LOCKED, 1 , 0, "This resource is locked and the \"If:\" header " "did not specify one of the " "locktokens for this resource's lock(s)."); } modules/dav/main/mod_dav.c:3089: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `dav_validate_request`. modules/dav/main/mod_dav.c:3064:16: Unknown value from: non-const function 3062. * writing into the database. 3063. */ 3064. if ((err = (*locks_hooks->open_lockdb)(r, 0, 0, &lockdb)) != NULL) { ^ 3065. /* ### add a higher-level description? */ 3066. return dav_handle_err(r, err, NULL); modules/dav/main/mod_dav.c:3080:22: Call 3078. } 3079. 3080. resource_state = dav_get_resource_state(r, resource); ^ 3081. 3082. /* modules/dav/main/util_lock.c:676:1: Parameter `resource->exists` 674. ** Returns DAV_RESOURCE_ERROR if an error occurs. 675. */ 676. DAV_DECLARE(int) dav_get_resource_state(request_rec *r, ^ 677. const dav_resource *resource) 678. { modules/dav/main/mod_dav.c:3089:16: Call 3087. * validate the parent resource's conditions. 3088. */ 3089. if ((err = dav_validate_request(r, resource, depth, NULL, &multi_response, ^ 3090. (resource_state == DAV_RESOURCE_NULL 3091. ? DAV_VALIDATE_PARENT modules/dav/main/util.c:1455:1: Parameter `resource->uri->strlen` 1453. ** error is necessary, response will point to it, else NULL. 1454. */ 1455. DAV_DECLARE(dav_error *) dav_validate_request(request_rec *r, ^ 1456. dav_resource *resource, 1457. int depth, modules/dav/main/util.c:1586:15: Call 1584. } 1585. else { 1586. err = dav_validate_resource_state(r->pool, resource, lockdb, ^ 1587. if_header, flags, &work_buf, r); 1588. } modules/dav/main/util.c:802:1: <LHS trace> 800. * Returns NULL if path/uri meets if-header and lock requirements 801. */ 802. static dav_error * dav_validate_resource_state(apr_pool_t *p, ^ 803. const dav_resource *resource, 804. dav_lockdb *lockdb, modules/dav/main/util.c:802:1: Parameter `resource->uri->strlen` 800. * Returns NULL if path/uri meets if-header and lock requirements 801. */ 802. static dav_error * dav_validate_resource_state(apr_pool_t *p, ^ 803. const dav_resource *resource, 804. dav_lockdb *lockdb, modules/dav/main/util.c:988:5: Assignment 986. */ 987. uri = resource->uri; 988. uri_len = strlen(uri); ^ 989. if (uri[uri_len - 1] == '/') { 990. dav_set_bufsize(p, pbuf, uri_len); modules/dav/main/util.c:989:9: Binary operation: ([0, +oo] - 1):unsigned64 by call to `dav_validate_request` 987. uri = resource->uri; 988. uri_len = strlen(uri); 989. if (uri[uri_len - 1] == '/') { ^ 990. dav_set_bufsize(p, pbuf, uri_len); 991. memcpy(pbuf->buf, uri, uri_len);
https://github.com/apache/httpd/blob/8b2ec33ac5d314be345814db08e194ffeda6beb0/modules/dav/main/util.c/#L989
d2a_code_trace_data_44940
static int ssl_cipher_process_rulestr(const char *rule_str, CIPHER_ORDER **head_p, CIPHER_ORDER **tail_p, const SSL_CIPHER **ca_list, CERT *c) { uint32_t alg_mkey, alg_auth, alg_enc, alg_mac, algo_strength; int min_tls; const char *l, *buf; int j, multi, found, rule, retval, ok, buflen; uint32_t cipher_id = 0; char ch; retval = 1; l = rule_str; for (;;) { ch = *l; if (ch == '\0') break; if (ch == '-') { rule = CIPHER_DEL; l++; } else if (ch == '+') { rule = CIPHER_ORD; l++; } else if (ch == '!') { rule = CIPHER_KILL; l++; } else if (ch == '@') { rule = CIPHER_SPECIAL; l++; } else { rule = CIPHER_ADD; } if (ITEM_SEP(ch)) { l++; continue; } alg_mkey = 0; alg_auth = 0; alg_enc = 0; alg_mac = 0; min_tls = 0; algo_strength = 0; for (;;) { ch = *l; buf = l; buflen = 0; #ifndef CHARSET_EBCDIC while (((ch >= 'A') && (ch <= 'Z')) || ((ch >= '0') && (ch <= '9')) || ((ch >= 'a') && (ch <= 'z')) || (ch == '-') || (ch == '.') || (ch == '=')) #else while (isalnum(ch) || (ch == '-') || (ch == '.') || (ch == '=')) #endif { ch = *(++l); buflen++; } if (buflen == 0) { SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR, SSL_R_INVALID_COMMAND); retval = found = 0; l++; break; } if (rule == CIPHER_SPECIAL) { found = 0; break; } if (ch == '+') { multi = 1; l++; } else multi = 0; j = found = 0; cipher_id = 0; while (ca_list[j]) { if (strncmp(buf, ca_list[j]->name, buflen) == 0 && (ca_list[j]->name[buflen] == '\0')) { found = 1; break; } else j++; } if (!found) break; if (ca_list[j]->algorithm_mkey) { if (alg_mkey) { alg_mkey &= ca_list[j]->algorithm_mkey; if (!alg_mkey) { found = 0; break; } } else alg_mkey = ca_list[j]->algorithm_mkey; } if (ca_list[j]->algorithm_auth) { if (alg_auth) { alg_auth &= ca_list[j]->algorithm_auth; if (!alg_auth) { found = 0; break; } } else alg_auth = ca_list[j]->algorithm_auth; } if (ca_list[j]->algorithm_enc) { if (alg_enc) { alg_enc &= ca_list[j]->algorithm_enc; if (!alg_enc) { found = 0; break; } } else alg_enc = ca_list[j]->algorithm_enc; } if (ca_list[j]->algorithm_mac) { if (alg_mac) { alg_mac &= ca_list[j]->algorithm_mac; if (!alg_mac) { found = 0; break; } } else alg_mac = ca_list[j]->algorithm_mac; } if (ca_list[j]->algo_strength & SSL_STRONG_MASK) { if (algo_strength & SSL_STRONG_MASK) { algo_strength &= (ca_list[j]->algo_strength & SSL_STRONG_MASK) | ~SSL_STRONG_MASK; if (!(algo_strength & SSL_STRONG_MASK)) { found = 0; break; } } else algo_strength = ca_list[j]->algo_strength & SSL_STRONG_MASK; } if (ca_list[j]->algo_strength & SSL_DEFAULT_MASK) { if (algo_strength & SSL_DEFAULT_MASK) { algo_strength &= (ca_list[j]->algo_strength & SSL_DEFAULT_MASK) | ~SSL_DEFAULT_MASK; if (!(algo_strength & SSL_DEFAULT_MASK)) { found = 0; break; } } else algo_strength |= ca_list[j]->algo_strength & SSL_DEFAULT_MASK; } if (ca_list[j]->valid) { cipher_id = ca_list[j]->id; } else { if (ca_list[j]->min_tls) { if (min_tls != 0 && min_tls != ca_list[j]->min_tls) { found = 0; break; } else { min_tls = ca_list[j]->min_tls; } } } if (!multi) break; } if (rule == CIPHER_SPECIAL) { ok = 0; if ((buflen == 8) && strncmp(buf, "STRENGTH", 8) == 0) ok = ssl_cipher_strength_sort(head_p, tail_p); else if (buflen == 10 && strncmp(buf, "SECLEVEL=", 9) == 0) { int level = buf[9] - '0'; if (level < 0 || level > 5) { SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR, SSL_R_INVALID_COMMAND); } else { c->sec_level = level; ok = 1; } } else SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR, SSL_R_INVALID_COMMAND); if (ok == 0) retval = 0; while ((*l != '\0') && !ITEM_SEP(*l)) l++; } else if (found) { ssl_cipher_apply_rule(cipher_id, alg_mkey, alg_auth, alg_enc, alg_mac, min_tls, algo_strength, rule, -1, head_p, tail_p); } else { while ((*l != '\0') && !ITEM_SEP(*l)) l++; } if (*l == '\0') break; } return (retval); } test/cipherlist_test.c:198: error: BUFFER_OVERRUN_L1 Offset: [9, +oo] (⇐ [0, +oo] + 9) Size: 8 by call to `SSL_CTX_set_cipher_list`. Showing all 13 steps of the trace test/cipherlist_test.c:198:10: Call 196. if (fixture == NULL) 197. return 0; 198. if (!TEST_true(SSL_CTX_set_cipher_list(fixture->server, "DEFAULT")) ^ 199. || !TEST_true(SSL_CTX_set_cipher_list(fixture->client, "DEFAULT"))) 200. tear_down(fixture); ssl/ssl_lib.c:2276:1: Parameter `*str` 2274. 2275. /** specify the ciphers to be used by default by the SSL_CTX */ 2276. > int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str) 2277. { 2278. STACK_OF(SSL_CIPHER) *sk; ssl/ssl_lib.c:2280:10: Call 2278. STACK_OF(SSL_CIPHER) *sk; 2279. 2280. sk = ssl_create_cipher_list(ctx->method, &ctx->cipher_list, ^ 2281. &ctx->cipher_list_by_id, str, ctx->cert); 2282. /* ssl/ssl_ciph.c:1258:1: Parameter `*rule_str` 1256. #endif 1257. 1258. > STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method, STACK_OF(SSL_CIPHER) 1259. **cipher_list, STACK_OF(SSL_CIPHER) 1260. **cipher_list_by_id, ssl/ssl_ciph.c:1276:10: Call 1274. return NULL; 1275. #ifndef OPENSSL_NO_EC 1276. if (!check_suiteb_cipher_list(ssl_method, c, &rule_str)) ^ 1277. return NULL; 1278. #endif ssl/ssl_ciph.c:1204:1: Parameter `**prule_str` 1202. 1203. #ifndef OPENSSL_NO_EC 1204. > static int check_suiteb_cipher_list(const SSL_METHOD *meth, CERT *c, 1205. const char **prule_str) 1206. { ssl/ssl_ciph.c:1429:5: Assignment 1427. */ 1428. ok = 1; 1429. rule_p = rule_str; ^ 1430. if (strncmp(rule_str, "DEFAULT", 7) == 0) { 1431. ok = ssl_cipher_process_rulestr(SSL_DEFAULT_CIPHER_LIST, ssl/ssl_ciph.c:1439:14: Call 1437. 1438. if (ok && (strlen(rule_p) > 0)) 1439. ok = ssl_cipher_process_rulestr(rule_p, &head, &tail, ca_list, c); ^ 1440. 1441. OPENSSL_free(ca_list); /* Not needed anymore */ ssl/ssl_ciph.c:948:1: <Length trace> 946. } 947. 948. > static int ssl_cipher_process_rulestr(const char *rule_str, 949. CIPHER_ORDER **head_p, 950. CIPHER_ORDER **tail_p, ssl/ssl_ciph.c:948:1: Parameter `*rule_str` 946. } 947. 948. > static int ssl_cipher_process_rulestr(const char *rule_str, 949. CIPHER_ORDER **head_p, 950. CIPHER_ORDER **tail_p, ssl/ssl_ciph.c:961:5: Assignment 959. 960. retval = 1; 961. l = rule_str; ^ 962. for (;;) { 963. ch = *l; ssl/ssl_ciph.c:997:13: Assignment 995. for (;;) { 996. ch = *l; 997. buf = l; ^ 998. buflen = 0; 999. #ifndef CHARSET_EBCDIC ssl/ssl_ciph.c:1167:29: Array access: Offset: [9, +oo] (⇐ [0, +oo] + 9) Size: 8 by call to `SSL_CTX_set_cipher_list` 1165. ok = ssl_cipher_strength_sort(head_p, tail_p); 1166. else if (buflen == 10 && strncmp(buf, "SECLEVEL=", 9) == 0) { 1167. int level = buf[9] - '0'; ^ 1168. if (level < 0 || level > 5) { 1169. SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR,
https://github.com/openssl/openssl/blob/25ffeb11ea86bdc76db150c504550602a9acc9bc/ssl/ssl_ciph.c/#L1167
d2a_code_trace_data_44941
void *lh_delete(LHASH *lh, void *data) { unsigned long hash; LHASH_NODE *nn,**rn; void *ret; lh->error=0; rn=getrn(lh,data,&hash); if (*rn == NULL) { lh->num_no_delete++; return(NULL); } else { nn= *rn; *rn=nn->next; ret=nn->data; 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/s3_both.c:372: error: INTEGER_OVERFLOW_L2 ([0, `s->ctx->sessions->num_items`] - 1):unsigned64 by call to `ssl3_send_alert`. Showing all 11 steps of the trace ssl/s3_both.c:264:1: Parameter `s->ctx->sessions->num_items` 262. * the body is read in state 'stn'. 263. */ 264. > long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok) 265. { 266. unsigned char *p; ssl/s3_both.c:372:2: Call 370. return s->init_num; 371. f_err: 372. ssl3_send_alert(s,SSL3_AL_FATAL,al); ^ 373. err: 374. *ok=0; ssl/s3_pkt.c:1142:1: Parameter `s->ctx->sessions->num_items` 1140. } 1141. 1142. > void ssl3_send_alert(SSL *s, int level, int desc) 1143. { 1144. /* Map tls/ssl alert value to correct one */ ssl/s3_pkt.c:1149:3: Call 1147. /* If a fatal one, remove from cache */ 1148. if ((level == 2) && (s->session != NULL)) 1149. SSL_CTX_remove_session(s->ctx,s->session); ^ 1150. 1151. s->s3->alert_dispatch=1; ssl/ssl_sess.c:413:1: Parameter `ctx->sessions->num_items` 411. } 412. 413. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 414. { 415. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:415:9: Call 413. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 414. { 415. return remove_session_lock(ctx, c, 1); ^ 416. } 417. ssl/ssl_sess.c:418:1: Parameter `ctx->sessions->num_items` 416. } 417. 418. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 419. { 420. SSL_SESSION *r; ssl/ssl_sess.c:426:20: Call 424. { 425. if(lck) CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX); 426. r=(SSL_SESSION *)lh_delete(ctx->sessions,c); ^ 427. if (r != NULL) 428. { crypto/lhash/lhash.c:217:1: <LHS trace> 215. } 216. 217. > void *lh_delete(LHASH *lh, 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, 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_send_alert` 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/dab6f09573742df94c4767663565aca3863f8173/crypto/lhash/lhash.c/#L240
d2a_code_trace_data_44942
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; return 1; } ssl/statem/statem_clnt.c:2438: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 2]):unsigned64 by call to `WPACKET_sub_allocate_bytes__`. Showing all 12 steps of the trace ssl/statem/statem_clnt.c:2432:1: Parameter `pkt->written` 2430. } 2431. 2432. > static int tls_construct_cke_srp(SSL *s, WPACKET *pkt, int *al) 2433. { 2434. #ifndef OPENSSL_NO_SRP ssl/statem/statem_clnt.c:2438:17: Call 2436. 2437. if (s->srp_ctx.A == NULL 2438. || !WPACKET_sub_allocate_bytes_u16(pkt, BN_num_bytes(s->srp_ctx.A), ^ 2439. &abytes)) { 2440. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_SRP, ERR_R_INTERNAL_ERROR); ssl/packet.c:28:10: Call 26. unsigned char **allocbytes, size_t lenbytes) 27. { 28. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) ^ 29. || !WPACKET_allocate_bytes(pkt, len, allocbytes) 30. || !WPACKET_close(pkt)) ssl/packet.c:224:1: Parameter `pkt->buf->length` 222. } 223. 224. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 225. { 226. WPACKET_SUB *sub; ssl/packet.c:29:17: Call 27. { 28. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) 29. || !WPACKET_allocate_bytes(pkt, len, allocbytes) ^ 30. || !WPACKET_close(pkt)) 31. return 0; ssl/packet.c:15:1: Parameter `pkt->written` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ssl/packet.c:17:10: Call 15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ^ 18. return 0; 19. ssl/packet.c:36:1: <LHS trace> 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: Parameter `pkt->buf->length` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: <RHS trace> 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: Parameter `len` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:46:9: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 2]):unsigned64 by call to `WPACKET_sub_allocate_bytes__` 44. return 0; 45. 46. if (pkt->buf->length - pkt->written < len) { ^ 47. size_t newlen; 48. size_t reflen;
https://github.com/openssl/openssl/blob/e4e1aa903e624044d3319622fc50222f1b2c7328/ssl/packet.c/#L46
d2a_code_trace_data_44943
ssize_t ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain) { u_char *prev; ssize_t n, size; ngx_err_t err; ngx_array_t vec; ngx_event_t *rev; struct iovec *iov, iovs[NGX_IOVS]; prev = NULL; iov = NULL; size = 0; vec.elts = iovs; vec.nelts = 0; vec.size = sizeof(struct iovec); vec.nalloc = NGX_IOVS; vec.pool = c->pool; while (chain) { if (prev == chain->buf->last) { iov->iov_len += chain->buf->end - chain->buf->last; } else { iov = ngx_array_push(&vec); if (iov == NULL) { return NGX_ERROR; } iov->iov_base = (void *) chain->buf->last; iov->iov_len = chain->buf->end - chain->buf->last; } size += chain->buf->end - chain->buf->last; prev = chain->buf->end; chain = chain->next; } ngx_log_debug2(NGX_LOG_DEBUG_EVENT, c->log, 0, "readv: %d:%d", vec.nelts, iov->iov_len); rev = c->read; do { n = readv(c->fd, (struct iovec *) vec.elts, vec.nelts); if (n == 0) { rev->ready = 0; rev->eof = 1; return n; } else if (n > 0) { if (n < size && !(ngx_event_flags & NGX_USE_GREEDY_EVENT)) { rev->ready = 0; } return n; } err = ngx_socket_errno; if (err == NGX_EAGAIN || err == NGX_EINTR) { ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, err, "readv() not ready"); n = NGX_AGAIN; } else { n = ngx_connection_error(c, err, "readv() failed"); break; } } while (err == NGX_EINTR); rev->ready = 0; if (n == NGX_ERROR){ c->read->error = 1; } return n; } src/os/unix/ngx_readv_chain.c:194: error: Null Dereference pointer `iov` last assigned on line 181 could be null and is dereferenced at line 194, column 13. src/os/unix/ngx_readv_chain.c:170:1: start of procedure ngx_readv_chain() 168. #else /* ! NGX_HAVE_KQUEUE */ 169. 170. ssize_t ^ 171. ngx_readv_chain(ngx_connection_t *c, ngx_chain_t *chain) 172. { src/os/unix/ngx_readv_chain.c:180:5: 178. struct iovec *iov, iovs[NGX_IOVS]; 179. 180. prev = NULL; ^ 181. iov = NULL; 182. size = 0; src/os/unix/ngx_readv_chain.c:181:5: 179. 180. prev = NULL; 181. iov = NULL; ^ 182. size = 0; 183. src/os/unix/ngx_readv_chain.c:182:5: 180. prev = NULL; 181. iov = NULL; 182. size = 0; ^ 183. 184. vec.elts = iovs; src/os/unix/ngx_readv_chain.c:184:5: 182. size = 0; 183. 184. vec.elts = iovs; ^ 185. vec.nelts = 0; 186. vec.size = sizeof(struct iovec); src/os/unix/ngx_readv_chain.c:185:5: 183. 184. vec.elts = iovs; 185. vec.nelts = 0; ^ 186. vec.size = sizeof(struct iovec); 187. vec.nalloc = NGX_IOVS; src/os/unix/ngx_readv_chain.c:186:5: 184. vec.elts = iovs; 185. vec.nelts = 0; 186. vec.size = sizeof(struct iovec); ^ 187. vec.nalloc = NGX_IOVS; 188. vec.pool = c->pool; src/os/unix/ngx_readv_chain.c:187:5: 185. vec.nelts = 0; 186. vec.size = sizeof(struct iovec); 187. vec.nalloc = NGX_IOVS; ^ 188. vec.pool = c->pool; 189. src/os/unix/ngx_readv_chain.c:188:5: 186. vec.size = sizeof(struct iovec); 187. vec.nalloc = NGX_IOVS; 188. vec.pool = c->pool; ^ 189. 190. /* coalesce the neighbouring bufs */ src/os/unix/ngx_readv_chain.c:192:12: Loop condition is true. Entering loop body 190. /* coalesce the neighbouring bufs */ 191. 192. while (chain) { ^ 193. if (prev == chain->buf->last) { 194. iov->iov_len += chain->buf->end - chain->buf->last; src/os/unix/ngx_readv_chain.c:193:13: Taking true branch 191. 192. while (chain) { 193. if (prev == chain->buf->last) { ^ 194. iov->iov_len += chain->buf->end - chain->buf->last; 195. src/os/unix/ngx_readv_chain.c:194:13: 192. while (chain) { 193. if (prev == chain->buf->last) { 194. iov->iov_len += chain->buf->end - chain->buf->last; ^ 195. 196. } else {
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/os/unix/ngx_readv_chain.c/#L194
d2a_code_trace_data_44944
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } crypto/ec/ecp_mont.c:235: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_sub`. Showing all 18 steps of the trace crypto/ec/ecp_mont.c:229:14: Call 227. 228. BN_CTX_start(ctx); 229. if ((e = BN_CTX_get(ctx)) == NULL) ^ 230. goto err; 231. crypto/bn/bn_ctx.c:229:5: Call 227. } 228. /* OK, make sure the returned bignum is "zero" */ 229. BN_zero(ret); ^ 230. ctx->used++; 231. CTXDBG_RET(ctx, ret); crypto/bn/bn_lib.c:366:15: Assignment 364. a->neg = 0; 365. a->d[0] = w; 366. a->top = (w ? 1 : 0); ^ 367. a->flags &= ~BN_FLG_FIXED_TOP; 368. bn_check_top(a); crypto/bn/bn_lib.c:366:5: Assignment 364. a->neg = 0; 365. a->d[0] = w; 366. a->top = (w ? 1 : 0); ^ 367. a->flags &= ~BN_FLG_FIXED_TOP; 368. bn_check_top(a); crypto/ec/ecp_mont.c:235:10: Call 233. if (!BN_set_word(e, 2)) 234. goto err; 235. if (!BN_sub(e, group->field, e)) ^ 236. goto err; 237. /*- crypto/bn/bn_add.c:45:1: Parameter `*r->d` 43. 44. /* signed sub of b from a. */ 45. > int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 46. { 47. int ret, r_neg, cmp_res; crypto/bn/bn_add.c:59:19: Call 57. if (cmp_res > 0) { 58. r_neg = a->neg; 59. ret = BN_usub(r, a, b); ^ 60. } else if (cmp_res < 0) { 61. r_neg = !b->neg; crypto/bn/bn_add.c:125:1: Parameter `*r->d` 123. 124. /* unsigned subtraction of b from a, a must be larger than b. */ 125. > int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 126. { 127. int max, min, dif; crypto/bn/bn_add.c:143:9: Call 141. } 142. 143. if (bn_wexpand(r, max) == NULL) ^ 144. return 0; 145. crypto/bn/bn_lib.c:939:1: Parameter `*a->d` 937. } 938. 939. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 940. { 941. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:941:37: Call 939. BIGNUM *bn_wexpand(BIGNUM *a, int words) 940. { 941. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 942. } 943. crypto/bn/bn_lib.c:245:1: Parameter `*b->d` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `*b->d` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_sub` 230. assert(b->top <= words); 231. if (b->top > 0) 232. memcpy(a, b->d, sizeof(*a) * b->top); ^ 233. 234. return a;
https://github.com/openssl/openssl/blob/8f58ede09572dcc6a7e6c01280dd348240199568/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_44945
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: [199, 255] 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:105:9: Array access: Offset: [199, 255] Size: [1, 2147483644] by call to `X509_NAME_oneline` 103. } 104. strncpy(buf, "NO X509_NAME", len); 105. buf[len - 1] = '\0'; ^ 106. return buf; 107. }
https://github.com/openssl/openssl/blob/24c2cd3967ed23acc0bd31a3781c4525e2e42a2c/crypto/x509/x509_obj.c/#L105
d2a_code_trace_data_44946
static inline void FUNC(idctSparseColAdd)(pixel *dest, ptrdiff_t line_size, int16_t *col) { int a0, a1, a2, a3, b0, b1, b2, b3; IDCT_COLS; dest[0] = av_clip_pixel(dest[0] + ((a0 + b0) >> COL_SHIFT)); dest += line_size; dest[0] = av_clip_pixel(dest[0] + ((a1 + b1) >> COL_SHIFT)); dest += line_size; dest[0] = av_clip_pixel(dest[0] + ((a2 + b2) >> COL_SHIFT)); dest += line_size; dest[0] = av_clip_pixel(dest[0] + ((a3 + b3) >> COL_SHIFT)); dest += line_size; dest[0] = av_clip_pixel(dest[0] + ((a3 - b3) >> COL_SHIFT)); dest += line_size; dest[0] = av_clip_pixel(dest[0] + ((a2 - b2) >> COL_SHIFT)); dest += line_size; dest[0] = av_clip_pixel(dest[0] + ((a1 - b1) >> COL_SHIFT)); dest += line_size; dest[0] = av_clip_pixel(dest[0] + ((a0 - b0) >> COL_SHIFT)); } libavcodec/wmv2.c:97: error: Buffer Overrun L1 Offset: [61, 64] (⇐ [5, 8] + 56) Size: 6 by call to `wmv2_add_block`. libavcodec/wmv2.c:97:5: Call 95. 96. wmv2_add_block(w, block1[4], dest_cb, s->uvlinesize, 4); 97. wmv2_add_block(w, block1[5], dest_cr, s->uvlinesize, 5); ^ 98. } 99. libavcodec/wmv2.c:57:1: Parameter `n` 55. } 56. 57. static void wmv2_add_block(Wmv2Context *w, int16_t *block1, ^ 58. uint8_t *dst, int stride, int n) 59. { libavcodec/wmv2.c:74:13: Call 72. case 2: 73. ff_simple_idct48_add(dst, stride, block1); 74. ff_simple_idct48_add(dst + 4, stride, w->abt_block2[n]); ^ 75. s->bdsp.clear_block(w->abt_block2[n]); 76. break; libavcodec/simple_idct.c:191:1: Parameter `*block` 189. } 190. 191. void ff_simple_idct48_add(uint8_t *dest, ptrdiff_t line_size, int16_t *block) ^ 192. { 193. int i; libavcodec/simple_idct.c:202:9: Call 200. /* IDCT8 and store */ 201. for(i=0; i<4; i++){ 202. idctSparseColAdd_8(dest + i, line_size, block + i); ^ 203. } 204. } libavcodec/simple_idct_template.c:249:1: <Length trace> 247. } 248. 249. static inline void FUNC(idctSparseColAdd)(pixel *dest, ptrdiff_t line_size, ^ 250. int16_t *col) 251. { libavcodec/simple_idct_template.c:249:1: Parameter `*col` 247. } 248. 249. static inline void FUNC(idctSparseColAdd)(pixel *dest, ptrdiff_t line_size, ^ 250. int16_t *col) 251. { libavcodec/simple_idct_template.c:254:5: Array access: Offset: [61, 64] (⇐ [5, 8] + 56) Size: 6 by call to `wmv2_add_block` 252. int a0, a1, a2, a3, b0, b1, b2, b3; 253. 254. IDCT_COLS; ^ 255. 256. dest[0] = av_clip_pixel(dest[0] + ((a0 + b0) >> COL_SHIFT));
https://github.com/libav/libav/blob/2ec9fa5ec60dcd10e1cb10d8b4e4437e634ea428/libavcodec/simple_idct_template.c/#L254
d2a_code_trace_data_44947
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:1212: error: INTEGER_OVERFLOW_L2 (0 - [-oo, 32]):unsigned64 by call to `EVP_DecryptUpdate`. Showing all 7 steps of the trace ssl/t1_lib.c:1212:25: Call 1210. eticklen -= 16 + EVP_CIPHER_CTX_iv_length(ctx); 1211. sdec = OPENSSL_malloc(eticklen); 1212. if (sdec == NULL || EVP_DecryptUpdate(ctx, sdec, &slen, p, ^ 1213. (int)eticklen) <= 0) { 1214. EVP_CIPHER_CTX_free(ctx); crypto/evp/evp_enc.c:416:1: Parameter `ctx->cipher->block_size` 414. } 415. 416. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 417. const unsigned char *in, int inl) 418. { crypto/evp/evp_enc.c:422:5: Assignment 420. unsigned int b; 421. 422. b = ctx->cipher->block_size; ^ 423. 424. if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) { crypto/evp/evp_enc.c:452:16: Call 450. /* see comment about PTRDIFF_T comparison above */ 451. if (((PTRDIFF_T)out == (PTRDIFF_T)in) 452. || is_partially_overlapping(out, in, b)) { ^ 453. EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING); 454. return 0; crypto/evp/evp_enc.c:279:1: <RHS trace> 277. #endif 278. 279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 280. { 281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:279:1: Parameter `len` 277. #endif 278. 279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 280. { 281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:288:50: Binary operation: (0 - [-oo, 32]):unsigned64 by call to `EVP_DecryptUpdate` 286. */ 287. int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | 288. (diff > (0 - (PTRDIFF_T)len))); ^ 289. assert(!overlapped); 290. return overlapped;
https://github.com/openssl/openssl/blob/7141ba31969d0b378d08104a51f8f99b9187b9d5/crypto/evp/evp_enc.c/#L288
d2a_code_trace_data_44948
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/exptest.c:167: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_div`. Showing all 10 steps of the trace test/exptest.c:167:5: Call 165. BN_rand(m, NUM_BITS + c, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD); 166. 167. BN_mod(a, a, m, ctx); ^ 168. BN_mod(b, b, m, ctx); 169. crypto/bn/bn_div.c:140:1: Parameter `ctx->stack.depth` 138. * If 'dv' or 'rm' is NULL, the respective value is not returned. 139. */ 140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 141. BN_CTX *ctx) 142. { crypto/bn/bn_div.c:193:5: Call 191. } 192. 193. BN_CTX_start(ctx); ^ 194. tmp = BN_CTX_get(ctx); 195. snum = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:416:5: Call 414. if (no_branch) 415. bn_correct_top(res); 416. BN_CTX_end(ctx); ^ 417. return (1); 418. err: crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.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_div` 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/b6e3250671654e0344127be9dd49b3fb4a82f94b/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_44949
int ASYNC_WAIT_CTX_clear_fd(ASYNC_WAIT_CTX *ctx, const void *key) { struct fd_lookup_st *curr, *prev; curr = ctx->fds; prev = NULL; while (curr != NULL) { if (curr->del == 1) { curr = curr->next; continue; } if (curr->key == key) { if (curr->add == 1) { if (ctx->fds == curr) { ctx->fds = curr->next; } else { prev->next = curr->next; } OPENSSL_free(curr); ctx->numadd--; return 1; } curr->del = 1; ctx->numdel++; return 1; } prev = curr; curr = curr->next; } return 0; } test/asynctest.c:68: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `ASYNC_WAIT_CTX_clear_fd`. Showing all 6 steps of the trace test/asynctest.c:63:10: Call 61. 62. /* Second case: one fd added */ 63. if (!ASYNC_WAIT_CTX_set_wait_fd(waitctx, waitctx, MAGIC_WAIT_FD, NULL, NULL)) ^ 64. return 0; 65. ASYNC_pause_job(); crypto/async/async_wait.c:43:1: Parameter `ctx->numadd` 41. OPENSSL_free(ctx); 42. } 43. > int ASYNC_WAIT_CTX_set_wait_fd(ASYNC_WAIT_CTX *ctx, const void *key, 44. OSSL_ASYNC_FD fd, void *custom_data, 45. void (*cleanup)(ASYNC_WAIT_CTX *, const void *, test/asynctest.c:68:10: Call 66. 67. /* Third case: all fd removed */ 68. if (!ASYNC_WAIT_CTX_clear_fd(waitctx, waitctx)) ^ 69. return 0; 70. ASYNC_pause_job(); crypto/async/async_wait.c:139:1: <LHS trace> 137. } 138. 139. > int ASYNC_WAIT_CTX_clear_fd(ASYNC_WAIT_CTX *ctx, const void *key) 140. { 141. struct fd_lookup_st *curr, *prev; crypto/async/async_wait.c:139:1: Parameter `ctx->numadd` 137. } 138. 139. > int ASYNC_WAIT_CTX_clear_fd(ASYNC_WAIT_CTX *ctx, const void *key) 140. { 141. struct fd_lookup_st *curr, *prev; crypto/async/async_wait.c:164:17: Binary operation: ([0, +oo] - 1):unsigned64 by call to `ASYNC_WAIT_CTX_clear_fd` 162. */ 163. OPENSSL_free(curr); 164. ctx->numadd--; ^ 165. return 1; 166. }
https://github.com/openssl/openssl/blob/219aa86cb04e1bfc9c156fab18da2f767502afb2/crypto/async/async_wait.c/#L164
d2a_code_trace_data_44950
static void cpStripToTile(uint8* out, uint8* in, uint32 rows, uint32 cols, int outskew, int inskew) { while (rows-- > 0) { uint32 j = cols; while (j-- > 0) *out++ = *in++; out += outskew; in += inskew; } } tools/tiffcp.c:1073: error: Integer Overflow L2 ([0, `cols`] - 1):unsigned32. tools/tiffcp.c:1067:1: <LHS trace> 1065. } 1066. 1067. static void ^ 1068. cpStripToTile(uint8* out, uint8* in, 1069. uint32 rows, uint32 cols, int outskew, int inskew) tools/tiffcp.c:1067:1: Parameter `cols` 1065. } 1066. 1067. static void ^ 1068. cpStripToTile(uint8* out, uint8* in, 1069. uint32 rows, uint32 cols, int outskew, int inskew) tools/tiffcp.c:1072:3: Assignment 1070. { 1071. while (rows-- > 0) { 1072. uint32 j = cols; ^ 1073. while (j-- > 0) 1074. *out++ = *in++; tools/tiffcp.c:1073:10: Binary operation: ([0, cols] - 1):unsigned32 1071. while (rows-- > 0) { 1072. uint32 j = cols; 1073. while (j-- > 0) ^ 1074. *out++ = *in++; 1075. out += outskew;
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/tools/tiffcp.c/#L1073
d2a_code_trace_data_44951
static void JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 skiplength) { if ((uint32)skiplength<=data->bufferbytesleft) { data->buffercurrentbyte+=skiplength; data->bufferbytesleft-=skiplength; } else { uint16 m; m=skiplength-data->bufferbytesleft; if (m<=data->filebytesleft) { data->bufferbytesleft=0; data->fileoffset+=m; data->filebytesleft-=m; data->filepositioned=0; } else { data->bufferbytesleft=0; data->filebytesleft=0; } } } libtiff/tif_jpeg.c:812: error: Integer Overflow L2 ([0, +oo] - [-oo, 7]):unsigned64 by call to `JPEGFixupTagsSubsamplingSkip`. libtiff/tif_jpeg.c:743:1: Parameter `data->bufferbytesleft` 741. } 742. 743. static int ^ 744. JPEGFixupTagsSubsamplingSec(struct JPEGFixupTagsSubsamplingData* data) 745. { libtiff/tif_jpeg.c:752:9: Call 750. while (1) 751. { 752. if (!JPEGFixupTagsSubsamplingReadByte(data,&m)) ^ 753. return(0); 754. if (m==255) libtiff/tif_jpeg.c:855:1: Parameter `data->bufferbytesleft` 853. } 854. 855. static int ^ 856. JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result) 857. { libtiff/tif_jpeg.c:759:9: Call 757. while (1) 758. { 759. if (!JPEGFixupTagsSubsamplingReadByte(data,&m)) ^ 760. return(0); 761. if (m!=255) libtiff/tif_jpeg.c:855:1: Parameter `data->bufferbytesleft` 853. } 854. 855. static int ^ 856. JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result) 857. { libtiff/tif_jpeg.c:808:11: Call 806. uint8 p; 807. uint8 ph,pv; 808. if (!JPEGFixupTagsSubsamplingReadWord(data,&n)) ^ 809. return(0); 810. if (n!=8+data->tif->tif_dir.td_samplesperpixel*3) libtiff/tif_jpeg.c:885:1: Parameter `data->bufferbytesleft` 883. } 884. 885. static int ^ 886. JPEGFixupTagsSubsamplingReadWord(struct JPEGFixupTagsSubsamplingData* data, uint16* result) 887. { libtiff/tif_jpeg.c:890:7: Call 888. uint8 ma; 889. uint8 mb; 890. if (!JPEGFixupTagsSubsamplingReadByte(data,&ma)) ^ 891. return(0); 892. if (!JPEGFixupTagsSubsamplingReadByte(data,&mb)) libtiff/tif_jpeg.c:855:1: Parameter `data->bufferbytesleft` 853. } 854. 855. static int ^ 856. JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result) 857. { libtiff/tif_jpeg.c:812:6: Call 810. if (n!=8+data->tif->tif_dir.td_samplesperpixel*3) 811. return(0); 812. JPEGFixupTagsSubsamplingSkip(data,7); ^ 813. if (!JPEGFixupTagsSubsamplingReadByte(data,&p)) 814. return(0); libtiff/tif_jpeg.c:898:1: <LHS trace> 896. } 897. 898. static void ^ 899. JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 skiplength) 900. { libtiff/tif_jpeg.c:898:1: Parameter `data->filebytesleft` 896. } 897. 898. static void ^ 899. JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 skiplength) 900. { libtiff/tif_jpeg.c:898:1: <RHS trace> 896. } 897. 898. static void ^ 899. JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 skiplength) 900. { libtiff/tif_jpeg.c:898:1: Parameter `data->filebytesleft` 896. } 897. 898. static void ^ 899. JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 skiplength) 900. { libtiff/tif_jpeg.c:914:4: Binary operation: ([0, +oo] - [-oo, 7]):unsigned64 by call to `JPEGFixupTagsSubsamplingSkip` 912. data->bufferbytesleft=0; 913. data->fileoffset+=m; 914. data->filebytesleft-=m; ^ 915. data->filepositioned=0; 916. }
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_jpeg.c/#L914
d2a_code_trace_data_44952
static void unpack_input(const unsigned char *input, unsigned int *output) { unsigned int outbuffer[28]; unsigned short inbuffer[10]; unsigned int x; unsigned int *ptr; for (x=0;x<20;x+=2) inbuffer[x/2]=(input[x]<<8)+input[x+1]; ptr=outbuffer; *(ptr++)=27; *(ptr++)=(inbuffer[0]>>10)&0x3f; *(ptr++)=(inbuffer[0]>>5)&0x1f; *(ptr++)=inbuffer[0]&0x1f; *(ptr++)=(inbuffer[1]>>12)&0xf; *(ptr++)=(inbuffer[1]>>8)&0xf; *(ptr++)=(inbuffer[1]>>5)&7; *(ptr++)=(inbuffer[1]>>2)&7; *(ptr++)=((inbuffer[1]<<1)&6)|((inbuffer[2]>>15)&1); *(ptr++)=(inbuffer[2]>>12)&7; *(ptr++)=(inbuffer[2]>>10)&3; *(ptr++)=(inbuffer[2]>>5)&0x1f; *(ptr++)=((inbuffer[2]<<2)&0x7c)|((inbuffer[3]>>14)&3); *(ptr++)=(inbuffer[3]>>6)&0xff; *(ptr++)=((inbuffer[3]<<1)&0x7e)|((inbuffer[4]>>15)&1); *(ptr++)=(inbuffer[4]>>8)&0x7f; *(ptr++)=(inbuffer[4]>>1)&0x7f; *(ptr++)=((inbuffer[4]<<7)&0x80)|((inbuffer[5]>>9)&0x7f); *(ptr++)=(inbuffer[5]>>2)&0x7f; *(ptr++)=((inbuffer[5]<<5)&0x60)|((inbuffer[6]>>11)&0x1f); *(ptr++)=(inbuffer[6]>>4)&0x7f; *(ptr++)=((inbuffer[6]<<4)&0xf0)|((inbuffer[7]>>12)&0xf); *(ptr++)=(inbuffer[7]>>5)&0x7f; *(ptr++)=((inbuffer[7]<<2)&0x7c)|((inbuffer[8]>>14)&3); *(ptr++)=(inbuffer[8]>>7)&0x7f; *(ptr++)=((inbuffer[8]<<1)&0xfe)|((inbuffer[9]>>15)&1); *(ptr++)=(inbuffer[9]>>8)&0x7f; *(ptr++)=(inbuffer[9]>>1)&0x7f; *(output++)=outbuffer[11]; for (x=1;x<11;*(output++)=outbuffer[x++]); ptr=outbuffer+12; for (x=0;x<16;x+=4) { *(output++)=ptr[x]; *(output++)=ptr[x+2]; *(output++)=ptr[x+3]; *(output++)=ptr[x+1]; } } libavcodec/ra144.c:290: error: Uninitialized Value The value read from inbuffer[_] was never initialized. libavcodec/ra144.c:290:3: 288. *(ptr++)=((inbuffer[6]<<4)&0xf0)|((inbuffer[7]>>12)&0xf); 289. *(ptr++)=(inbuffer[7]>>5)&0x7f; 290. *(ptr++)=((inbuffer[7]<<2)&0x7c)|((inbuffer[8]>>14)&3); ^ 291. *(ptr++)=(inbuffer[8]>>7)&0x7f; 292. *(ptr++)=((inbuffer[8]<<1)&0xfe)|((inbuffer[9]>>15)&1);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ra144.c/#L290
d2a_code_trace_data_44953
static int fill_default_ref_list(H264Context *h){ MpegEncContext * const s = &h->s; int i; int smallest_poc_greater_than_current = -1; int structure_sel; Picture sorted_short_ref[32]; Picture field_entry_list[2][32]; Picture *frame_list[2]; if (FIELD_PICTURE) { structure_sel = PICT_FRAME; frame_list[0] = field_entry_list[0]; frame_list[1] = field_entry_list[1]; } else { structure_sel = 0; frame_list[0] = h->default_ref_list[0]; frame_list[1] = h->default_ref_list[1]; } if(h->slice_type==FF_B_TYPE){ int list; int len[2]; int short_len[2]; int out_i; int limit= INT_MIN; for(out_i=0; out_i<h->short_ref_count; out_i++){ int best_i=INT_MIN; int best_poc=INT_MAX; for(i=0; i<h->short_ref_count; i++){ const int poc= h->short_ref[i]->poc; if(poc > limit && poc < best_poc){ best_poc= poc; best_i= i; } } assert(best_i != INT_MIN); limit= best_poc; sorted_short_ref[out_i]= *h->short_ref[best_i]; tprintf(h->s.avctx, "sorted poc: %d->%d poc:%d fn:%d\n", best_i, out_i, sorted_short_ref[out_i].poc, sorted_short_ref[out_i].frame_num); if (-1 == smallest_poc_greater_than_current) { if (h->short_ref[best_i]->poc >= s->current_picture_ptr->poc) { smallest_poc_greater_than_current = out_i; } } } tprintf(h->s.avctx, "current poc: %d, smallest_poc_greater_than_current: %d\n", s->current_picture_ptr->poc, smallest_poc_greater_than_current); for(list=0; list<2; list++){ int index = 0; int j= -99; int step= list ? -1 : 1; for(i=0; i<h->short_ref_count && index < h->ref_count[list]; i++, j+=step) { int sel; while(j<0 || j>= h->short_ref_count){ if(j != -99 && step == (list ? -1 : 1)) return -1; step = -step; j= smallest_poc_greater_than_current + (step>>1); } sel = sorted_short_ref[j].reference | structure_sel; if(sel != PICT_FRAME) continue; frame_list[list][index ]= sorted_short_ref[j]; frame_list[list][index++].pic_id= sorted_short_ref[j].frame_num; } short_len[list] = index; for(i = 0; i < 16 && index < h->ref_count[ list ]; i++){ int sel; if(h->long_ref[i] == NULL) continue; sel = h->long_ref[i]->reference | structure_sel; if(sel != PICT_FRAME) continue; frame_list[ list ][index ]= *h->long_ref[i]; frame_list[ list ][index++].pic_id= i; } len[list] = index; } for(list=0; list<2; list++){ if (FIELD_PICTURE) len[list] = split_field_ref_list(h->default_ref_list[list], h->ref_count[list], frame_list[list], len[list], s->picture_structure, short_len[list]); if(list && len[0] > 1 && len[0] == len[1]) for(i=0; h->default_ref_list[0][i].data[0] == h->default_ref_list[1][i].data[0]; i++) if(i == len[0]){ FFSWAP(Picture, h->default_ref_list[1][0], h->default_ref_list[1][1]); break; } if(len[list] < h->ref_count[ list ]) memset(&h->default_ref_list[list][len[list]], 0, sizeof(Picture)*(h->ref_count[ list ] - len[list])); } }else{ int index=0; int short_len; for(i=0; i<h->short_ref_count; i++){ int sel; sel = h->short_ref[i]->reference | structure_sel; if(sel != PICT_FRAME) continue; frame_list[0][index ]= *h->short_ref[i]; frame_list[0][index++].pic_id= h->short_ref[i]->frame_num; } short_len = index; for(i = 0; i < 16; i++){ int sel; if(h->long_ref[i] == NULL) continue; sel = h->long_ref[i]->reference | structure_sel; if(sel != PICT_FRAME) continue; frame_list[0][index ]= *h->long_ref[i]; frame_list[0][index++].pic_id= i; } if (FIELD_PICTURE) index = split_field_ref_list(h->default_ref_list[0], h->ref_count[0], frame_list[0], index, s->picture_structure, short_len); if(index < h->ref_count[0]) memset(&h->default_ref_list[0][index], 0, sizeof(Picture)*(h->ref_count[0] - index)); } #ifdef TRACE for (i=0; i<h->ref_count[0]; i++) { tprintf(h->s.avctx, "List0: %s fn:%d 0x%p\n", (h->default_ref_list[0][i].long_ref ? "LT" : "ST"), h->default_ref_list[0][i].pic_id, h->default_ref_list[0][i].data[0]); } if(h->slice_type==FF_B_TYPE){ for (i=0; i<h->ref_count[1]; i++) { tprintf(h->s.avctx, "List1: %s fn:%d 0x%p\n", (h->default_ref_list[1][i].long_ref ? "LT" : "ST"), h->default_ref_list[1][i].pic_id, h->default_ref_list[1][i].data[0]); } } #endif return 0; } libavcodec/h264.c:2940: error: Uninitialized Value The value read from len[_] was never initialized. libavcodec/h264.c:2940:24: 2938. if(list && len[0] > 1 && len[0] == len[1]) 2939. for(i=0; h->default_ref_list[0][i].data[0] == h->default_ref_list[1][i].data[0]; i++) 2940. if(i == len[0]){ ^ 2941. FFSWAP(Picture, h->default_ref_list[1][0], h->default_ref_list[1][1]); 2942. break;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L2940