id
stringlengths
25
25
content
stringlengths
649
72.1k
max_stars_repo_path
stringlengths
91
133
d2a_code_trace_data_44654
static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr, int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], int ref_mv_scale, int flags, int size, int h) { MotionEstContext * const c= &s->me; int best[2]={0, 0}; int d; int dmin; int map_generation; int penalty_factor; const int ref_mv_stride= s->mb_stride; const int ref_mv_xy= s->mb_x + s->mb_y*ref_mv_stride; me_cmp_func cmpf, chroma_cmpf; LOAD_COMMON LOAD_COMMON2 if(c->pre_pass){ penalty_factor= c->pre_penalty_factor; cmpf= s->dsp.me_pre_cmp[size]; chroma_cmpf= s->dsp.me_pre_cmp[size+1]; }else{ penalty_factor= c->penalty_factor; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; } map_generation= update_map_generation(c); assert(cmpf); dmin= cmp(s, 0, 0, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags); map[0]= map_generation; score_map[0]= dmin; if((s->pict_type == FF_B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0) dmin += (mv_penalty[pred_x] + mv_penalty[pred_y])*penalty_factor; if (s->first_slice_line) { CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) }else{ if(dmin<((h*h*s->avctx->mv0_threshold)>>8) && ( P_LEFT[0] |P_LEFT[1] |P_TOP[0] |P_TOP[1] |P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){ *mx_ptr= 0; *my_ptr= 0; c->skip=1; return dmin; } CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift) CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift) CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) } if(dmin>h*h*4){ if(c->pre_pass){ CHECK_CLIPPED_MV((last_mv[ref_mv_xy-1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy-1][1]*ref_mv_scale + (1<<15))>>16) if(!s->first_slice_line) CHECK_CLIPPED_MV((last_mv[ref_mv_xy-ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy-ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) }else{ CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) if(s->mb_y+1<s->end_mb_y) CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) } } if(c->avctx->last_predictor_count){ const int count= c->avctx->last_predictor_count; const int xstart= FFMAX(0, s->mb_x - count); const int ystart= FFMAX(0, s->mb_y - count); const int xend= FFMIN(s->mb_width , s->mb_x + count + 1); const int yend= FFMIN(s->mb_height, s->mb_y + count + 1); int mb_y; for(mb_y=ystart; mb_y<yend; mb_y++){ int mb_x; for(mb_x=xstart; mb_x<xend; mb_x++){ const int xy= mb_x + 1 + (mb_y + 1)*ref_mv_stride; int mx= (last_mv[xy][0]*ref_mv_scale + (1<<15))>>16; int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16; if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue; CHECK_MV(mx,my) } } } dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); *mx_ptr= best[0]; *my_ptr= best[1]; return dmin; } libavcodec/motion_est_template.c:1065: error: Uninitialized Value The value read from xmax was never initialized. libavcodec/motion_est_template.c:1065:9: 1063. CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift) 1064. CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift) 1065. CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) ^ 1066. } 1067. if(dmin>h*h*4){
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1065
d2a_code_trace_data_44655
int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; pkt->written += len; pkt->curr += len; return 1; } ssl/t1_lib.c:1103: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + `s->srp_ctx.login->strlen` + `s->tlsext_hostname->strlen` + 32]):unsigned64 by call to `WPACKET_start_sub_packet_len__`. Showing all 10 steps of the trace ssl/t1_lib.c:1101:14: Call 1099. tls1_get_formatlist(s, &pformats, &num_formats); 1100. 1101. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats) ^ 1102. /* Sub-packet for formats extension */ 1103. || !WPACKET_start_sub_packet_u16(pkt) ssl/packet.c:242:1: Parameter `pkt->buf->length` 240. } 241. 242. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 243. { 244. unsigned char *data; ssl/t1_lib.c:1103:21: Call 1101. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats) 1102. /* Sub-packet for formats extension */ 1103. || !WPACKET_start_sub_packet_u16(pkt) ^ 1104. || !WPACKET_sub_memcpy_u8(pkt, pformats, num_formats) 1105. || !WPACKET_close(pkt)) { ssl/packet.c:205:1: Parameter `pkt->written` 203. } 204. 205. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 206. { 207. WPACKET_SUB *sub; ssl/packet.c:229:10: Call 227. } 228. 229. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 230. return 0; 231. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */ ssl/packet.c:15:1: <LHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `pkt->buf->length` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: <RHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `len` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:25:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + pkt->written + s->srp_ctx.login->strlen + s->tlsext_hostname->strlen + 32]):unsigned64 by call to `WPACKET_start_sub_packet_len__` 23. return 0; 24. 25. if (pkt->buf->length - pkt->written < len) { ^ 26. size_t newlen; 27. size_t reflen;
https://github.com/openssl/openssl/blob/a6972f346248fbc37e42056bb943fae0896a2967/ssl/packet.c/#L25
d2a_code_trace_data_44656
STACK_OF(X509) *X509_STORE_CTX_get1_certs(X509_STORE_CTX *ctx, X509_NAME *nm) { int i, idx, cnt; STACK_OF(X509) *sk = NULL; X509 *x; X509_OBJECT *obj; CRYPTO_THREAD_write_lock(ctx->ctx->lock); idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt); if (idx < 0) { X509_OBJECT *xobj = X509_OBJECT_new(); CRYPTO_THREAD_unlock(ctx->ctx->lock); if (xobj == NULL) return NULL; if (!X509_STORE_CTX_get_by_subject(ctx, X509_LU_X509, nm, xobj)) { X509_OBJECT_free(xobj); return NULL; } X509_OBJECT_free(xobj); CRYPTO_THREAD_write_lock(ctx->ctx->lock); idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt); if (idx < 0) { CRYPTO_THREAD_unlock(ctx->ctx->lock); return NULL; } } sk = sk_X509_new_null(); for (i = 0; i < cnt; i++, idx++) { obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx); x = obj->data.x509; X509_up_ref(x); if (!sk_X509_push(sk, x)) { CRYPTO_THREAD_unlock(ctx->ctx->lock); X509_free(x); sk_X509_pop_free(sk, X509_free); return NULL; } } CRYPTO_THREAD_unlock(ctx->ctx->lock); return sk; } crypto/x509/x509_lu.c:502: error: NULL_DEREFERENCE pointer `obj` last assigned on line 501 could be null and is dereferenced at line 502, column 13. Showing all 25 steps of the trace crypto/x509/x509_lu.c:467:1: start of procedure X509_STORE_CTX_get1_certs() 465. } 466. 467. > STACK_OF(X509) *X509_STORE_CTX_get1_certs(X509_STORE_CTX *ctx, X509_NAME *nm) 468. { 469. int i, idx, cnt; crypto/x509/x509_lu.c:470:5: 468. { 469. int i, idx, cnt; 470. > STACK_OF(X509) *sk = NULL; 471. X509 *x; 472. X509_OBJECT *obj; crypto/x509/x509_lu.c:474:5: 472. X509_OBJECT *obj; 473. 474. > CRYPTO_THREAD_write_lock(ctx->ctx->lock); 475. idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt); 476. if (idx < 0) { crypto/threads_pthread.c:64:1: start of procedure CRYPTO_THREAD_write_lock() 62. } 63. 64. > int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock) 65. { 66. # ifdef USE_RWLOCK crypto/threads_pthread.c:67:9: Taking true branch 65. { 66. # ifdef USE_RWLOCK 67. if (pthread_rwlock_wrlock(lock) != 0) ^ 68. return 0; 69. # else crypto/threads_pthread.c:68:9: 66. # ifdef USE_RWLOCK 67. if (pthread_rwlock_wrlock(lock) != 0) 68. > return 0; 69. # else 70. if (pthread_mutex_lock(lock) != 0) crypto/threads_pthread.c:75:1: return from a call to CRYPTO_THREAD_write_lock 73. 74. return 1; 75. > } 76. 77. int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock) crypto/x509/x509_lu.c:475:5: Skipping x509_object_idx_cnt(): empty list of specs 473. 474. CRYPTO_THREAD_write_lock(ctx->ctx->lock); 475. idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt); ^ 476. if (idx < 0) { 477. /* crypto/x509/x509_lu.c:476:9: Taking false branch 474. CRYPTO_THREAD_write_lock(ctx->ctx->lock); 475. idx = x509_object_idx_cnt(ctx->ctx->objs, X509_LU_X509, nm, &cnt); 476. if (idx < 0) { ^ 477. /* 478. * Nothing found in cache: do lookup to possibly add new objects to crypto/x509/x509_lu.c:499:5: 497. } 498. 499. > sk = sk_X509_new_null(); 500. for (i = 0; i < cnt; i++, idx++) { 501. obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx); include/openssl/x509.h:99:1: start of procedure sk_X509_new_null() 97. typedef struct x509_cinf_st X509_CINF; 98. 99. > DEFINE_STACK_OF(X509) 100. 101. /* This is used for a table of trust checking functions */ crypto/stack/stack.c:112:1: start of procedure OPENSSL_sk_new_null() 110. } 111. 112. > OPENSSL_STACK *OPENSSL_sk_new_null(void) 113. { 114. return OPENSSL_sk_new_reserve(NULL, 0); crypto/stack/stack.c:114:5: Skipping OPENSSL_sk_new_reserve(): empty list of specs 112. OPENSSL_STACK *OPENSSL_sk_new_null(void) 113. { 114. return OPENSSL_sk_new_reserve(NULL, 0); ^ 115. } 116. crypto/stack/stack.c:115:1: return from a call to OPENSSL_sk_new_null 113. { 114. return OPENSSL_sk_new_reserve(NULL, 0); 115. > } 116. 117. OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc c) include/openssl/x509.h:99:1: return from a call to sk_X509_new_null 97. typedef struct x509_cinf_st X509_CINF; 98. 99. > DEFINE_STACK_OF(X509) 100. 101. /* This is used for a table of trust checking functions */ crypto/x509/x509_lu.c:500:10: 498. 499. sk = sk_X509_new_null(); 500. > for (i = 0; i < cnt; i++, idx++) { 501. obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx); 502. x = obj->data.x509; crypto/x509/x509_lu.c:500:17: Loop condition is true. Entering loop body 498. 499. sk = sk_X509_new_null(); 500. for (i = 0; i < cnt; i++, idx++) { ^ 501. obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx); 502. x = obj->data.x509; crypto/x509/x509_lu.c:501:9: 499. sk = sk_X509_new_null(); 500. for (i = 0; i < cnt; i++, idx++) { 501. > obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx); 502. x = obj->data.x509; 503. X509_up_ref(x); include/openssl/x509_vfy.h:58:1: start of procedure sk_X509_OBJECT_value() 56. 57. DEFINE_STACK_OF(X509_LOOKUP) 58. > DEFINE_STACK_OF(X509_OBJECT) 59. DEFINE_STACK_OF(X509_VERIFY_PARAM) 60. crypto/stack/stack.c:380:1: start of procedure OPENSSL_sk_value() 378. } 379. 380. > void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i) 381. { 382. if (st == NULL || i < 0 || i >= st->num) crypto/stack/stack.c:382:9: Taking true branch 380. void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i) 381. { 382. if (st == NULL || i < 0 || i >= st->num) ^ 383. return NULL; 384. return (void *)st->data[i]; crypto/stack/stack.c:383:9: 381. { 382. if (st == NULL || i < 0 || i >= st->num) 383. > return NULL; 384. return (void *)st->data[i]; 385. } crypto/stack/stack.c:385:1: return from a call to OPENSSL_sk_value 383. return NULL; 384. return (void *)st->data[i]; 385. > } 386. 387. void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data) include/openssl/x509_vfy.h:58:1: return from a call to sk_X509_OBJECT_value 56. 57. DEFINE_STACK_OF(X509_LOOKUP) 58. > DEFINE_STACK_OF(X509_OBJECT) 59. DEFINE_STACK_OF(X509_VERIFY_PARAM) 60. crypto/x509/x509_lu.c:502:9: 500. for (i = 0; i < cnt; i++, idx++) { 501. obj = sk_X509_OBJECT_value(ctx->ctx->objs, idx); 502. > x = obj->data.x509; 503. X509_up_ref(x); 504. if (!sk_X509_push(sk, x)) {
https://github.com/openssl/openssl/blob/f770d75b1cac264d6280ec7326277daff6965cbb/crypto/x509/x509_lu.c/#L502
d2a_code_trace_data_44657
IMPLEMENT_new_ctx(ofb, OFB, 128) providers/common/ciphers/aes.c:300: error: NULL_DEREFERENCE pointer `ctx` last assigned on line 300 could be null and is dereferenced at line 300, column 1. Showing all 18 steps of the trace providers/common/ciphers/aes.c:300:1: start of procedure aes_128_ofb_newctx() 298. IMPLEMENT_new_ctx(ofb, OFB, 256) 299. IMPLEMENT_new_ctx(ofb, OFB, 192) 300. > IMPLEMENT_new_ctx(ofb, OFB, 128) 301. 302. /* CFB */ 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:300:1: 298. IMPLEMENT_new_ctx(ofb, OFB, 256) 299. IMPLEMENT_new_ctx(ofb, OFB, 192) 300. > IMPLEMENT_new_ctx(ofb, OFB, 128) 301. 302. /* CFB */
https://github.com/openssl/openssl/blob/f79858ac4d90a450d0620d1ecb713bc35d7d9f8d/providers/common/ciphers/aes.c/#L300
d2a_code_trace_data_44658
PUT_STR16(le, avio_wl16) libavformat/aviobuf.c:305: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32. libavformat/aviobuf.c:305:1: <LHS trace> 303. } 304. 305. PUT_STR16(le, avio_wl16) ^ 306. PUT_STR16(be, avio_wb16) 307. libavformat/aviobuf.c:305:1: Parameter `*str` 303. } 304. 305. PUT_STR16(le, avio_wl16) ^ 306. PUT_STR16(be, avio_wb16) 307. libavformat/aviobuf.c:305:1: Assignment 303. } 304. 305. PUT_STR16(le, avio_wl16) ^ 306. PUT_STR16(be, avio_wb16) 307. libavformat/aviobuf.c:305:1: Assignment 303. } 304. 305. PUT_STR16(le, avio_wl16) ^ 306. PUT_STR16(be, avio_wb16) 307. libavformat/aviobuf.c:305:1: Binary operation: ([0, +oo] - 1):unsigned32 303. } 304. 305. PUT_STR16(le, avio_wl16) ^ 306. PUT_STR16(be, avio_wb16) 307.
https://github.com/libav/libav/blob/252d6200c36e7eaa79f8d5205b7d731179e94897/libavformat/aviobuf.c/#L305
d2a_code_trace_data_44659
int dsa_paramgen_check_g(DSA *dsa) { BN_CTX *ctx; BIGNUM *tmp; BN_MONT_CTX *mont = NULL; int rv = -1; ctx = BN_CTX_new(); if (ctx == NULL) return -1; BN_CTX_start(ctx); if (BN_cmp(dsa->g, BN_value_one()) <= 0) return 0; if (BN_cmp(dsa->g, dsa->p) >= 0) return 0; tmp = BN_CTX_get(ctx); if (!tmp) goto err; if ((mont = BN_MONT_CTX_new()) == NULL) goto err; if (!BN_MONT_CTX_set(mont, dsa->p, ctx)) goto err; if (!BN_mod_exp_mont(tmp, dsa->g, dsa->q, dsa->p, ctx, mont)) goto err; if (!BN_cmp(tmp, BN_value_one())) rv = 1; else rv = 0; err: BN_CTX_end(ctx); BN_MONT_CTX_free(mont); BN_CTX_free(ctx); return rv; } crypto/dsa/dsa_gen.c:677: error: MEMORY_LEAK memory dynamically allocated by call to `BN_MONT_CTX_new()` at line 664, column 17 is not reachable after line 677, column 5. Showing all 116 steps of the trace crypto/dsa/dsa_gen.c:647:1: start of procedure dsa_paramgen_check_g() 645. } 646. 647. > int dsa_paramgen_check_g(DSA *dsa) 648. { 649. BN_CTX *ctx; crypto/dsa/dsa_gen.c:651:5: 649. BN_CTX *ctx; 650. BIGNUM *tmp; 651. > BN_MONT_CTX *mont = NULL; 652. int rv = -1; 653. ctx = BN_CTX_new(); crypto/dsa/dsa_gen.c:652:5: 650. BIGNUM *tmp; 651. BN_MONT_CTX *mont = NULL; 652. > int rv = -1; 653. ctx = BN_CTX_new(); 654. if (ctx == NULL) crypto/dsa/dsa_gen.c:653:5: 651. BN_MONT_CTX *mont = NULL; 652. int rv = -1; 653. > ctx = BN_CTX_new(); 654. if (ctx == NULL) 655. return -1; crypto/bn/bn_ctx.c:189:1: start of procedure BN_CTX_new() 187. 188. 189. > BN_CTX *BN_CTX_new(void) 190. { 191. BN_CTX *ret; crypto/bn/bn_ctx.c:193:9: 191. BN_CTX *ret; 192. 193. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE); 195. return NULL; crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_ctx.c:193:9: Taking false branch 191. BN_CTX *ret; 192. 193. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE); 195. return NULL; crypto/bn/bn_ctx.c:198:5: 196. } 197. /* Initialise the structure */ 198. > BN_POOL_init(&ret->pool); 199. BN_STACK_init(&ret->stack); 200. return ret; crypto/bn/bn_ctx.c:335:1: start of procedure BN_POOL_init() 333. /***********/ 334. 335. > static void BN_POOL_init(BN_POOL *p) 336. { 337. p->head = p->current = p->tail = NULL; crypto/bn/bn_ctx.c:337:5: 335. static void BN_POOL_init(BN_POOL *p) 336. { 337. > p->head = p->current = p->tail = NULL; 338. p->used = p->size = 0; 339. } crypto/bn/bn_ctx.c:338:5: 336. { 337. p->head = p->current = p->tail = NULL; 338. > p->used = p->size = 0; 339. } 340. crypto/bn/bn_ctx.c:339:1: return from a call to BN_POOL_init 337. p->head = p->current = p->tail = NULL; 338. p->used = p->size = 0; 339. > } 340. 341. static void BN_POOL_finish(BN_POOL *p) crypto/bn/bn_ctx.c:199:5: 197. /* Initialise the structure */ 198. BN_POOL_init(&ret->pool); 199. > BN_STACK_init(&ret->stack); 200. return ret; 201. } crypto/bn/bn_ctx.c:294:1: start of procedure BN_STACK_init() 292. /************/ 293. 294. > static void BN_STACK_init(BN_STACK *st) 295. { 296. st->indexes = NULL; crypto/bn/bn_ctx.c:296:5: 294. static void BN_STACK_init(BN_STACK *st) 295. { 296. > st->indexes = NULL; 297. st->depth = st->size = 0; 298. } crypto/bn/bn_ctx.c:297:5: 295. { 296. st->indexes = NULL; 297. > st->depth = st->size = 0; 298. } 299. crypto/bn/bn_ctx.c:298:1: return from a call to BN_STACK_init 296. st->indexes = NULL; 297. st->depth = st->size = 0; 298. > } 299. 300. static void BN_STACK_finish(BN_STACK *st) crypto/bn/bn_ctx.c:200:5: 198. BN_POOL_init(&ret->pool); 199. BN_STACK_init(&ret->stack); 200. > return ret; 201. } 202. crypto/bn/bn_ctx.c:201:1: return from a call to BN_CTX_new 199. BN_STACK_init(&ret->stack); 200. return ret; 201. > } 202. 203. BN_CTX *BN_CTX_secure_new(void) crypto/dsa/dsa_gen.c:654:9: Taking false branch 652. int rv = -1; 653. ctx = BN_CTX_new(); 654. if (ctx == NULL) ^ 655. return -1; 656. BN_CTX_start(ctx); crypto/dsa/dsa_gen.c:656:5: 654. if (ctx == NULL) 655. return -1; 656. > BN_CTX_start(ctx); 657. if (BN_cmp(dsa->g, BN_value_one()) <= 0) 658. return 0; crypto/bn/bn_ctx.c:236:1: start of procedure BN_CTX_start() 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_ctx.c:240:9: Taking true branch 238. CTXDBG_ENTRY("BN_CTX_start", ctx); 239. /* If we're already overflowing ... */ 240. if (ctx->err_stack || ctx->too_many) ^ 241. ctx->err_stack++; 242. /* (Try to) get a new frame pointer */ crypto/bn/bn_ctx.c:241:9: 239. /* If we're already overflowing ... */ 240. if (ctx->err_stack || ctx->too_many) 241. > ctx->err_stack++; 242. /* (Try to) get a new frame pointer */ 243. else if (!BN_STACK_push(&ctx->stack, ctx->used)) { crypto/bn/bn_ctx.c:240:5: 238. CTXDBG_ENTRY("BN_CTX_start", ctx); 239. /* If we're already overflowing ... */ 240. > if (ctx->err_stack || ctx->too_many) 241. ctx->err_stack++; 242. /* (Try to) get a new frame pointer */ crypto/bn/bn_ctx.c:248:1: return from a call to BN_CTX_start 246. } 247. CTXDBG_EXIT(ctx); 248. > } 249. 250. void BN_CTX_end(BN_CTX *ctx) crypto/dsa/dsa_gen.c:657:9: 655. return -1; 656. BN_CTX_start(ctx); 657. > if (BN_cmp(dsa->g, BN_value_one()) <= 0) 658. return 0; 659. if (BN_cmp(dsa->g, dsa->p) >= 0) crypto/bn/bn_lib.c:134:1: start of procedure BN_value_one() 132. #endif 133. 134. > const BIGNUM *BN_value_one(void) 135. { 136. static const BN_ULONG data_one = 1L; crypto/bn/bn_lib.c:136:5: 134. const BIGNUM *BN_value_one(void) 135. { 136. > static const BN_ULONG data_one = 1L; 137. static const BIGNUM const_one = 138. { (BN_ULONG *)&data_one, 1, 1, 0, BN_FLG_STATIC_DATA }; crypto/bn/bn_lib.c:137:5: 135. { 136. static const BN_ULONG data_one = 1L; 137. > static const BIGNUM const_one = 138. { (BN_ULONG *)&data_one, 1, 1, 0, BN_FLG_STATIC_DATA }; 139. crypto/bn/bn_lib.c:140:5: 138. { (BN_ULONG *)&data_one, 1, 1, 0, BN_FLG_STATIC_DATA }; 139. 140. > return (&const_one); 141. } 142. crypto/bn/bn_lib.c:141:1: return from a call to BN_value_one 139. 140. return (&const_one); 141. > } 142. 143. int BN_num_bits_word(BN_ULONG l) crypto/dsa/dsa_gen.c:657:9: Taking false branch 655. return -1; 656. BN_CTX_start(ctx); 657. if (BN_cmp(dsa->g, BN_value_one()) <= 0) ^ 658. return 0; 659. if (BN_cmp(dsa->g, dsa->p) >= 0) crypto/dsa/dsa_gen.c:659:9: Taking false branch 657. if (BN_cmp(dsa->g, BN_value_one()) <= 0) 658. return 0; 659. if (BN_cmp(dsa->g, dsa->p) >= 0) ^ 660. return 0; 661. tmp = BN_CTX_get(ctx); crypto/dsa/dsa_gen.c:661:5: 659. if (BN_cmp(dsa->g, dsa->p) >= 0) 660. return 0; 661. > tmp = BN_CTX_get(ctx); 662. if (!tmp) 663. goto err; crypto/bn/bn_ctx.c:267:1: start of procedure BN_CTX_get() 265. } 266. 267. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 268. { 269. BIGNUM *ret; crypto/bn/bn_ctx.c:272:9: Taking false branch 270. 271. CTXDBG_ENTRY("BN_CTX_get", ctx); 272. if (ctx->err_stack || ctx->too_many) ^ 273. return NULL; 274. if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) { crypto/bn/bn_ctx.c:272:27: Taking false branch 270. 271. CTXDBG_ENTRY("BN_CTX_get", ctx); 272. if (ctx->err_stack || ctx->too_many) ^ 273. return NULL; 274. if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) { crypto/bn/bn_ctx.c:274:9: Taking false branch 272. if (ctx->err_stack || ctx->too_many) 273. return NULL; 274. if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) { ^ 275. /* 276. * Setting too_many prevents repeated "get" attempts from cluttering crypto/bn/bn_ctx.c:284:5: 282. } 283. /* OK, make sure the returned bignum is "zero" */ 284. > BN_zero(ret); 285. ctx->used++; 286. CTXDBG_RET(ctx, ret); crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is false 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) crypto/bn/bn_ctx.c:285:5: 283. /* OK, make sure the returned bignum is "zero" */ 284. BN_zero(ret); 285. > ctx->used++; 286. CTXDBG_RET(ctx, ret); 287. return ret; crypto/bn/bn_ctx.c:287:5: 285. ctx->used++; 286. CTXDBG_RET(ctx, ret); 287. > return ret; 288. } 289. crypto/bn/bn_ctx.c:288:1: return from a call to BN_CTX_get 286. CTXDBG_RET(ctx, ret); 287. return ret; 288. > } 289. 290. /************/ crypto/dsa/dsa_gen.c:662:10: Taking false branch 660. return 0; 661. tmp = BN_CTX_get(ctx); 662. if (!tmp) ^ 663. goto err; 664. if ((mont = BN_MONT_CTX_new()) == NULL) crypto/dsa/dsa_gen.c:664:9: 662. if (!tmp) 663. goto err; 664. > if ((mont = BN_MONT_CTX_new()) == NULL) 665. goto err; 666. if (!BN_MONT_CTX_set(mont, dsa->p, ctx)) crypto/bn/bn_mont.c:315:1: start of procedure BN_MONT_CTX_new() 313. } 314. 315. > BN_MONT_CTX *BN_MONT_CTX_new(void) 316. { 317. BN_MONT_CTX *ret; crypto/bn/bn_mont.c:319:9: 317. BN_MONT_CTX *ret; 318. 319. > if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) 320. return (NULL); 321. crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/bn/bn_mont.c:319:9: Taking false branch 317. BN_MONT_CTX *ret; 318. 319. if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) ^ 320. return (NULL); 321. crypto/bn/bn_mont.c:322:5: 320. return (NULL); 321. 322. > BN_MONT_CTX_init(ret); 323. ret->flags = BN_FLG_MALLOCED; 324. return (ret); crypto/bn/bn_mont.c:327:1: start of procedure BN_MONT_CTX_init() 325. } 326. 327. > void BN_MONT_CTX_init(BN_MONT_CTX *ctx) 328. { 329. ctx->ri = 0; crypto/bn/bn_mont.c:329:5: 327. void BN_MONT_CTX_init(BN_MONT_CTX *ctx) 328. { 329. > ctx->ri = 0; 330. bn_init(&(ctx->RR)); 331. bn_init(&(ctx->N)); crypto/bn/bn_mont.c:330:5: Skipping bn_init(): empty list of specs 328. { 329. ctx->ri = 0; 330. bn_init(&(ctx->RR)); ^ 331. bn_init(&(ctx->N)); 332. bn_init(&(ctx->Ni)); crypto/bn/bn_mont.c:331:5: Skipping bn_init(): empty list of specs 329. ctx->ri = 0; 330. bn_init(&(ctx->RR)); 331. bn_init(&(ctx->N)); ^ 332. bn_init(&(ctx->Ni)); 333. ctx->n0[0] = ctx->n0[1] = 0; crypto/bn/bn_mont.c:332:5: Skipping bn_init(): empty list of specs 330. bn_init(&(ctx->RR)); 331. bn_init(&(ctx->N)); 332. bn_init(&(ctx->Ni)); ^ 333. ctx->n0[0] = ctx->n0[1] = 0; 334. ctx->flags = 0; crypto/bn/bn_mont.c:333:5: 331. bn_init(&(ctx->N)); 332. bn_init(&(ctx->Ni)); 333. > ctx->n0[0] = ctx->n0[1] = 0; 334. ctx->flags = 0; 335. } crypto/bn/bn_mont.c:334:5: 332. bn_init(&(ctx->Ni)); 333. ctx->n0[0] = ctx->n0[1] = 0; 334. > ctx->flags = 0; 335. } 336. crypto/bn/bn_mont.c:335:1: return from a call to BN_MONT_CTX_init 333. ctx->n0[0] = ctx->n0[1] = 0; 334. ctx->flags = 0; 335. > } 336. 337. void BN_MONT_CTX_free(BN_MONT_CTX *mont) crypto/bn/bn_mont.c:323:5: 321. 322. BN_MONT_CTX_init(ret); 323. > ret->flags = BN_FLG_MALLOCED; 324. return (ret); 325. } crypto/bn/bn_mont.c:324:5: 322. BN_MONT_CTX_init(ret); 323. ret->flags = BN_FLG_MALLOCED; 324. > return (ret); 325. } 326. crypto/bn/bn_mont.c:325:1: return from a call to BN_MONT_CTX_new 323. ret->flags = BN_FLG_MALLOCED; 324. return (ret); 325. > } 326. 327. void BN_MONT_CTX_init(BN_MONT_CTX *ctx) crypto/dsa/dsa_gen.c:664:9: Taking false branch 662. if (!tmp) 663. goto err; 664. if ((mont = BN_MONT_CTX_new()) == NULL) ^ 665. goto err; 666. if (!BN_MONT_CTX_set(mont, dsa->p, ctx)) crypto/dsa/dsa_gen.c:666:10: Taking false branch 664. if ((mont = BN_MONT_CTX_new()) == NULL) 665. goto err; 666. if (!BN_MONT_CTX_set(mont, dsa->p, ctx)) ^ 667. goto err; 668. /* Work out g^q mod p */ crypto/dsa/dsa_gen.c:669:10: 667. goto err; 668. /* Work out g^q mod p */ 669. > if (!BN_mod_exp_mont(tmp, dsa->g, dsa->q, dsa->p, ctx, mont)) 670. goto err; 671. if (!BN_cmp(tmp, BN_value_one())) crypto/bn/bn_exp.c:401:1: start of procedure BN_mod_exp_mont() 399. } 400. 401. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 402. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 403. { crypto/bn/bn_exp.c:404:5: 402. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 403. { 404. > int i, j, bits, ret = 0, wstart, wend, window, wvalue; 405. int start = 1; 406. BIGNUM *d, *r; crypto/bn/bn_exp.c:405:5: 403. { 404. int i, j, bits, ret = 0, wstart, wend, window, wvalue; 405. > int start = 1; 406. BIGNUM *d, *r; 407. const BIGNUM *aa; crypto/bn/bn_exp.c:410:5: 408. /* Table of variables obtained from 'ctx' */ 409. BIGNUM *val[TABLE_SIZE]; 410. > BN_MONT_CTX *mont = NULL; 411. 412. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { crypto/bn/bn_exp.c:412:9: 410. BN_MONT_CTX *mont = NULL; 411. 412. > if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { 413. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); 414. } crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_exp.c:412:9: Taking true branch 410. BN_MONT_CTX *mont = NULL; 411. 412. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { ^ 413. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); 414. } crypto/bn/bn_exp.c:413:9: Skipping BN_mod_exp_mont_consttime(): empty list of specs 411. 412. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { 413. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 414. } 415. crypto/bn/bn_exp.c:577:1: return from a call to BN_mod_exp_mont 575. bn_check_top(rr); 576. return (ret); 577. > } 578. 579. #if defined(SPARC_T4_MONT) crypto/dsa/dsa_gen.c:669:10: Taking true branch 667. goto err; 668. /* Work out g^q mod p */ 669. if (!BN_mod_exp_mont(tmp, dsa->g, dsa->q, dsa->p, ctx, mont)) ^ 670. goto err; 671. if (!BN_cmp(tmp, BN_value_one())) crypto/dsa/dsa_gen.c:675:2: 673. else 674. rv = 0; 675. > err: 676. BN_CTX_end(ctx); 677. BN_MONT_CTX_free(mont); crypto/dsa/dsa_gen.c:676:5: 674. rv = 0; 675. err: 676. > BN_CTX_end(ctx); 677. BN_MONT_CTX_free(mont); 678. BN_CTX_free(ctx); crypto/bn/bn_ctx.c:250:1: start of procedure BN_CTX_end() 248. } 249. 250. > void BN_CTX_end(BN_CTX *ctx) 251. { 252. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:253:9: Taking true branch 251. { 252. CTXDBG_ENTRY("BN_CTX_end", ctx); 253. if (ctx->err_stack) ^ 254. ctx->err_stack--; 255. else { crypto/bn/bn_ctx.c:254:9: 252. CTXDBG_ENTRY("BN_CTX_end", ctx); 253. if (ctx->err_stack) 254. > ctx->err_stack--; 255. else { 256. unsigned int fp = BN_STACK_pop(&ctx->stack); crypto/bn/bn_ctx.c:253:5: 251. { 252. CTXDBG_ENTRY("BN_CTX_end", ctx); 253. > if (ctx->err_stack) 254. ctx->err_stack--; 255. else { crypto/bn/bn_ctx.c:265:1: return from a call to BN_CTX_end 263. } 264. CTXDBG_EXIT(ctx); 265. > } 266. 267. BIGNUM *BN_CTX_get(BN_CTX *ctx) crypto/dsa/dsa_gen.c:677:5: Skipping BN_MONT_CTX_free(): empty list of specs 675. err: 676. BN_CTX_end(ctx); 677. BN_MONT_CTX_free(mont); ^ 678. BN_CTX_free(ctx); 679. return rv;
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/dsa/dsa_gen.c/#L677
d2a_code_trace_data_44660
static void pred8x8l_horizontal_down_c(uint8_t *src, int has_topleft, int has_topright, int stride) { PREDICT_8x8_LOAD_TOP; PREDICT_8x8_LOAD_LEFT; PREDICT_8x8_LOAD_TOPLEFT; SRC(0,7)= (l6 + l7 + 1) >> 1; SRC(1,7)= (l5 + 2*l6 + l7 + 2) >> 2; SRC(0,6)=SRC(2,7)= (l5 + l6 + 1) >> 1; SRC(1,6)=SRC(3,7)= (l4 + 2*l5 + l6 + 2) >> 2; SRC(0,5)=SRC(2,6)=SRC(4,7)= (l4 + l5 + 1) >> 1; SRC(1,5)=SRC(3,6)=SRC(5,7)= (l3 + 2*l4 + l5 + 2) >> 2; SRC(0,4)=SRC(2,5)=SRC(4,6)=SRC(6,7)= (l3 + l4 + 1) >> 1; SRC(1,4)=SRC(3,5)=SRC(5,6)=SRC(7,7)= (l2 + 2*l3 + l4 + 2) >> 2; SRC(0,3)=SRC(2,4)=SRC(4,5)=SRC(6,6)= (l2 + l3 + 1) >> 1; SRC(1,3)=SRC(3,4)=SRC(5,5)=SRC(7,6)= (l1 + 2*l2 + l3 + 2) >> 2; SRC(0,2)=SRC(2,3)=SRC(4,4)=SRC(6,5)= (l1 + l2 + 1) >> 1; SRC(1,2)=SRC(3,3)=SRC(5,4)=SRC(7,5)= (l0 + 2*l1 + l2 + 2) >> 2; SRC(0,1)=SRC(2,2)=SRC(4,3)=SRC(6,4)= (l0 + l1 + 1) >> 1; SRC(1,1)=SRC(3,2)=SRC(5,3)=SRC(7,4)= (lt + 2*l0 + l1 + 2) >> 2; SRC(0,0)=SRC(2,1)=SRC(4,2)=SRC(6,3)= (lt + l0 + 1) >> 1; SRC(1,0)=SRC(3,1)=SRC(5,2)=SRC(7,3)= (l0 + 2*lt + t0 + 2) >> 2; SRC(2,0)=SRC(4,1)=SRC(6,2)= (t1 + 2*t0 + lt + 2) >> 2; SRC(3,0)=SRC(5,1)=SRC(7,2)= (t2 + 2*t1 + t0 + 2) >> 2; SRC(4,0)=SRC(6,1)= (t3 + 2*t2 + t1 + 2) >> 2; SRC(5,0)=SRC(7,1)= (t4 + 2*t3 + t2 + 2) >> 2; SRC(6,0)= (t5 + 2*t4 + t3 + 2) >> 2; SRC(7,0)= (t6 + 2*t5 + t4 + 2) >> 2; } libavcodec/h264pred.c:908: error: Uninitialized Value The value read from l7 was never initialized. libavcodec/h264pred.c:908:5: 906. PREDICT_8x8_LOAD_TOPLEFT; 907. SRC(0,7)= (l6 + l7 + 1) >> 1; 908. SRC(1,7)= (l5 + 2*l6 + l7 + 2) >> 2; ^ 909. SRC(0,6)=SRC(2,7)= (l5 + l6 + 1) >> 1; 910. SRC(1,6)=SRC(3,7)= (l4 + 2*l5 + l6 + 2) >> 2;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264pred.c/#L908
d2a_code_trace_data_44661
int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *yy, const BIGNUM *xx, const int p[], BN_CTX *ctx) { BIGNUM *field; int ret = 0; bn_check_top(yy); bn_check_top(xx); BN_CTX_start(ctx); if ((field = BN_CTX_get(ctx)) == NULL) goto err; if (!BN_GF2m_arr2poly(p, field)) goto err; ret = BN_GF2m_mod_div(r, yy, xx, field, ctx); bn_check_top(r); err: BN_CTX_end(ctx); return ret; } crypto/bn/bn_gf2m.c:967: error: MEMORY_LEAK memory dynamically allocated by call to `BN_CTX_start()` at line 961, column 5 is not reachable after line 967, column 11. Showing all 57 steps of the trace crypto/bn/bn_gf2m.c:952:1: start of procedure BN_GF2m_mod_div_arr() 950. * convenience; for best performance, use the BN_GF2m_mod_div function. 951. */ 952. > int BN_GF2m_mod_div_arr(BIGNUM *r, const BIGNUM *yy, const BIGNUM *xx, 953. const int p[], BN_CTX *ctx) 954. { crypto/bn/bn_gf2m.c:956:5: 954. { 955. BIGNUM *field; 956. > int ret = 0; 957. 958. bn_check_top(yy); crypto/bn/bn_gf2m.c:961:5: 959. bn_check_top(xx); 960. 961. > BN_CTX_start(ctx); 962. if ((field = BN_CTX_get(ctx)) == NULL) 963. goto err; crypto/bn/bn_ctx.c:236:1: start of procedure BN_CTX_start() 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_ctx.c:240:9: Taking false branch 238. CTXDBG_ENTRY("BN_CTX_start", ctx); 239. /* If we're already overflowing ... */ 240. if (ctx->err_stack || ctx->too_many) ^ 241. ctx->err_stack++; 242. /* (Try to) get a new frame pointer */ crypto/bn/bn_ctx.c:240:27: Taking false branch 238. CTXDBG_ENTRY("BN_CTX_start", ctx); 239. /* If we're already overflowing ... */ 240. if (ctx->err_stack || ctx->too_many) ^ 241. ctx->err_stack++; 242. /* (Try to) get a new frame pointer */ crypto/bn/bn_ctx.c:243:15: 241. ctx->err_stack++; 242. /* (Try to) get a new frame pointer */ 243. > else if (!BN_STACK_push(&ctx->stack, ctx->used)) { 244. BNerr(BN_F_BN_CTX_START, BN_R_TOO_MANY_TEMPORARY_VARIABLES); 245. ctx->err_stack++; crypto/bn/bn_ctx.c:307:1: start of procedure BN_STACK_push() 305. 306. 307. > static int BN_STACK_push(BN_STACK *st, unsigned int idx) 308. { 309. if (st->depth == st->size) { crypto/bn/bn_ctx.c:309:9: Taking true branch 307. static int BN_STACK_push(BN_STACK *st, unsigned int idx) 308. { 309. if (st->depth == st->size) { ^ 310. /* Need to expand */ 311. unsigned int newsize = crypto/bn/bn_ctx.c:312:13: Condition is true 310. /* Need to expand */ 311. unsigned int newsize = 312. st->size ? (st->size * 3 / 2) : BN_CTX_START_FRAMES; ^ 313. unsigned int *newitems = OPENSSL_malloc(sizeof(*newitems) * newsize); 314. if (newitems == NULL) crypto/bn/bn_ctx.c:311:9: 309. if (st->depth == st->size) { 310. /* Need to expand */ 311. > unsigned int newsize = 312. st->size ? (st->size * 3 / 2) : BN_CTX_START_FRAMES; 313. unsigned int *newitems = OPENSSL_malloc(sizeof(*newitems) * newsize); crypto/bn/bn_ctx.c:313:9: 311. unsigned int newsize = 312. st->size ? (st->size * 3 / 2) : BN_CTX_START_FRAMES; 313. > unsigned int *newitems = OPENSSL_malloc(sizeof(*newitems) * newsize); 314. if (newitems == NULL) 315. return 0; crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/bn/bn_ctx.c:314:13: Taking false branch 312. st->size ? (st->size * 3 / 2) : BN_CTX_START_FRAMES; 313. unsigned int *newitems = OPENSSL_malloc(sizeof(*newitems) * newsize); 314. if (newitems == NULL) ^ 315. return 0; 316. if (st->depth) crypto/bn/bn_ctx.c:316:13: Taking true branch 314. if (newitems == NULL) 315. return 0; 316. if (st->depth) ^ 317. memcpy(newitems, st->indexes, sizeof(*newitems) * st->depth); 318. OPENSSL_free(st->indexes); crypto/bn/bn_ctx.c:317:13: 315. return 0; 316. if (st->depth) 317. > memcpy(newitems, st->indexes, sizeof(*newitems) * st->depth); 318. OPENSSL_free(st->indexes); 319. st->indexes = newitems; crypto/bn/bn_ctx.c:318:9: 316. if (st->depth) 317. memcpy(newitems, st->indexes, sizeof(*newitems) * st->depth); 318. > OPENSSL_free(st->indexes); 319. st->indexes = newitems; 320. st->size = newsize; crypto/mem.c:234:1: start of procedure CRYPTO_free() 232. } 233. 234. > void CRYPTO_free(void *str) 235. { 236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:245:5: 243. } 244. #else 245. > free(str); 246. #endif 247. } crypto/mem.c:247:1: return from a call to CRYPTO_free 245. free(str); 246. #endif 247. > } 248. 249. void CRYPTO_clear_free(void *str, size_t num) crypto/bn/bn_ctx.c:319:9: 317. memcpy(newitems, st->indexes, sizeof(*newitems) * st->depth); 318. OPENSSL_free(st->indexes); 319. > st->indexes = newitems; 320. st->size = newsize; 321. } crypto/bn/bn_ctx.c:320:9: 318. OPENSSL_free(st->indexes); 319. st->indexes = newitems; 320. > st->size = newsize; 321. } 322. st->indexes[(st->depth)++] = idx; crypto/bn/bn_ctx.c:322:5: 320. st->size = newsize; 321. } 322. > st->indexes[(st->depth)++] = idx; 323. return 1; 324. } crypto/bn/bn_ctx.c:323:5: 321. } 322. st->indexes[(st->depth)++] = idx; 323. > return 1; 324. } 325. crypto/bn/bn_ctx.c:324:1: return from a call to BN_STACK_push 322. st->indexes[(st->depth)++] = idx; 323. return 1; 324. > } 325. 326. static unsigned int BN_STACK_pop(BN_STACK *st) crypto/bn/bn_ctx.c:243:15: Taking false branch 241. ctx->err_stack++; 242. /* (Try to) get a new frame pointer */ 243. else if (!BN_STACK_push(&ctx->stack, ctx->used)) { ^ 244. BNerr(BN_F_BN_CTX_START, BN_R_TOO_MANY_TEMPORARY_VARIABLES); 245. ctx->err_stack++; crypto/bn/bn_ctx.c:240:5: 238. CTXDBG_ENTRY("BN_CTX_start", ctx); 239. /* If we're already overflowing ... */ 240. > if (ctx->err_stack || ctx->too_many) 241. ctx->err_stack++; 242. /* (Try to) get a new frame pointer */ crypto/bn/bn_ctx.c:248:1: return from a call to BN_CTX_start 246. } 247. CTXDBG_EXIT(ctx); 248. > } 249. 250. void BN_CTX_end(BN_CTX *ctx) crypto/bn/bn_gf2m.c:962:9: 960. 961. BN_CTX_start(ctx); 962. > if ((field = BN_CTX_get(ctx)) == NULL) 963. goto err; 964. if (!BN_GF2m_arr2poly(p, field)) crypto/bn/bn_ctx.c:267:1: start of procedure BN_CTX_get() 265. } 266. 267. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 268. { 269. BIGNUM *ret; crypto/bn/bn_ctx.c:272:9: Taking false branch 270. 271. CTXDBG_ENTRY("BN_CTX_get", ctx); 272. if (ctx->err_stack || ctx->too_many) ^ 273. return NULL; 274. if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) { crypto/bn/bn_ctx.c:272:27: Taking false branch 270. 271. CTXDBG_ENTRY("BN_CTX_get", ctx); 272. if (ctx->err_stack || ctx->too_many) ^ 273. return NULL; 274. if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) { crypto/bn/bn_ctx.c:274:9: Taking false branch 272. if (ctx->err_stack || ctx->too_many) 273. return NULL; 274. if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) { ^ 275. /* 276. * Setting too_many prevents repeated "get" attempts from cluttering crypto/bn/bn_ctx.c:284:5: 282. } 283. /* OK, make sure the returned bignum is "zero" */ 284. > BN_zero(ret); 285. ctx->used++; 286. CTXDBG_RET(ctx, ret); crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is false 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) crypto/bn/bn_ctx.c:285:5: 283. /* OK, make sure the returned bignum is "zero" */ 284. BN_zero(ret); 285. > ctx->used++; 286. CTXDBG_RET(ctx, ret); 287. return ret; crypto/bn/bn_ctx.c:287:5: 285. ctx->used++; 286. CTXDBG_RET(ctx, ret); 287. > return ret; 288. } 289. crypto/bn/bn_ctx.c:288:1: return from a call to BN_CTX_get 286. CTXDBG_RET(ctx, ret); 287. return ret; 288. > } 289. 290. /************/ crypto/bn/bn_gf2m.c:962:9: Taking false branch 960. 961. BN_CTX_start(ctx); 962. if ((field = BN_CTX_get(ctx)) == NULL) ^ 963. goto err; 964. if (!BN_GF2m_arr2poly(p, field)) crypto/bn/bn_gf2m.c:964:10: Taking false branch 962. if ((field = BN_CTX_get(ctx)) == NULL) 963. goto err; 964. if (!BN_GF2m_arr2poly(p, field)) ^ 965. goto err; 966. crypto/bn/bn_gf2m.c:967:5: Skipping BN_GF2m_mod_div(): empty list of specs 965. goto err; 966. 967. ret = BN_GF2m_mod_div(r, yy, xx, field, ctx); ^ 968. bn_check_top(r); 969.
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/bn/bn_gf2m.c/#L967
d2a_code_trace_data_44662
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/x509/x509_cmp.c:90: error: BUFFER_OVERRUN_L3 Offset added: [0, 200] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace crypto/x509/x509_cmp.c:90:9: Call 88. if (ctx == NULL) 89. goto err; 90. f = X509_NAME_oneline(a->cert_info.issuer, NULL, 0); ^ 91. if (!EVP_DigestInit_ex(ctx, EVP_md5(), NULL)) 92. goto err; crypto/x509/x509_obj.c:73:1: <Offset trace> 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:73:1: Parameter `len` 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:73:1: <Length trace> 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:73:1: Parameter `*buf` 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:104:9: Array access: Offset added: [0, 200] Size: [1, 2147483644] by call to `X509_NAME_oneline` 102. OPENSSL_free(b); 103. } 104. strncpy(buf, "NO X509_NAME", len); ^ 105. buf[len - 1] = '\0'; 106. return buf;
https://github.com/openssl/openssl/blob/24c2cd3967ed23acc0bd31a3781c4525e2e42a2c/crypto/x509/x509_obj.c/#L104
d2a_code_trace_data_44663
static int check_chain_extensions(X509_STORE_CTX *ctx) { #ifdef OPENSSL_NO_CHAIN_VERIFY return 1; #else int i, ok=0, must_be_ca, plen = 0; X509 *x; int (*cb)(int xok,X509_STORE_CTX *xctx); int proxy_path_length = 0; int purpose; int allow_proxy_certs; cb=ctx->verify_cb; must_be_ca = -1; if (ctx->parent) { allow_proxy_certs = 0; purpose = X509_PURPOSE_CRL_SIGN; } else { allow_proxy_certs = !!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS); if (getenv("OPENSSL_ALLOW_PROXY_CERTS")) allow_proxy_certs = 1; purpose = ctx->param->purpose; } for (i = 0; i < ctx->last_untrusted; i++) { int ret; x = sk_X509_value(ctx->chain, i); if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) && (x->ex_flags & EXFLAG_CRITICAL)) { ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION; ctx->error_depth = i; ctx->current_cert = x; ok=cb(0,ctx); if (!ok) goto end; } if (!allow_proxy_certs && (x->ex_flags & EXFLAG_PROXY)) { ctx->error = X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED; ctx->error_depth = i; ctx->current_cert = x; ok=cb(0,ctx); if (!ok) goto end; } ret = X509_check_ca(x); switch(must_be_ca) { case -1: if ((ctx->param->flags & X509_V_FLAG_X509_STRICT) && (ret != 1) && (ret != 0)) { ret = 0; ctx->error = X509_V_ERR_INVALID_CA; } else ret = 1; break; case 0: if (ret != 0) { ret = 0; ctx->error = X509_V_ERR_INVALID_NON_CA; } else ret = 1; break; default: if ((ret == 0) || ((ctx->param->flags & X509_V_FLAG_X509_STRICT) && (ret != 1))) { ret = 0; ctx->error = X509_V_ERR_INVALID_CA; } else ret = 1; break; } if (ret == 0) { ctx->error_depth = i; ctx->current_cert = x; ok=cb(0,ctx); if (!ok) goto end; } if (ctx->param->purpose > 0) { ret = X509_check_purpose(x, purpose, must_be_ca > 0); if ((ret == 0) || ((ctx->param->flags & X509_V_FLAG_X509_STRICT) && (ret != 1))) { ctx->error = X509_V_ERR_INVALID_PURPOSE; ctx->error_depth = i; ctx->current_cert = x; ok=cb(0,ctx); if (!ok) goto end; } } if ((i > 1) && !(x->ex_flags & EXFLAG_SI) && (x->ex_pathlen != -1) && (plen > (x->ex_pathlen + proxy_path_length + 1))) { ctx->error = X509_V_ERR_PATH_LENGTH_EXCEEDED; ctx->error_depth = i; ctx->current_cert = x; ok=cb(0,ctx); if (!ok) goto end; } if (!(x->ex_flags & EXFLAG_SI)) plen++; if (x->ex_flags & EXFLAG_PROXY) { if (x->ex_pcpathlen != -1 && i > x->ex_pcpathlen) { ctx->error = X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED; ctx->error_depth = i; ctx->current_cert = x; ok=cb(0,ctx); if (!ok) goto end; } proxy_path_length++; must_be_ca = 0; } else must_be_ca = 1; } ok = 1; end: return ok; #endif } crypto/x509/x509_vfy.c:583: error: NULL_DEREFERENCE pointer `x` last assigned on line 581 could be null and is dereferenced at line 583, column 8. Showing all 23 steps of the trace crypto/x509/x509_vfy.c:537:1: start of procedure check_chain_extensions() 535. */ 536. 537. > static int check_chain_extensions(X509_STORE_CTX *ctx) 538. { 539. #ifdef OPENSSL_NO_CHAIN_VERIFY crypto/x509/x509_vfy.c:542:2: 540. return 1; 541. #else 542. > int i, ok=0, must_be_ca, plen = 0; 543. X509 *x; 544. int (*cb)(int xok,X509_STORE_CTX *xctx); crypto/x509/x509_vfy.c:545:2: 543. X509 *x; 544. int (*cb)(int xok,X509_STORE_CTX *xctx); 545. > int proxy_path_length = 0; 546. int purpose; 547. int allow_proxy_certs; crypto/x509/x509_vfy.c:548:2: 546. int purpose; 547. int allow_proxy_certs; 548. > cb=ctx->verify_cb; 549. 550. /* must_be_ca can have 1 of 3 values: crypto/x509/x509_vfy.c:558:2: 556. all certificates in the chain except the leaf certificate. 557. */ 558. > must_be_ca = -1; 559. 560. /* CRL path validation */ crypto/x509/x509_vfy.c:561:6: Taking false branch 559. 560. /* CRL path validation */ 561. if (ctx->parent) ^ 562. { 563. allow_proxy_certs = 0; crypto/x509/x509_vfy.c:569:7: Condition is true 567. { 568. allow_proxy_certs = 569. !!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS); ^ 570. /* A hack to keep people who don't want to modify their 571. software happy */ crypto/x509/x509_vfy.c:569:4: 567. { 568. allow_proxy_certs = 569. > !!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS); 570. /* A hack to keep people who don't want to modify their 571. software happy */ crypto/x509/x509_vfy.c:568:3: 566. else 567. { 568. > allow_proxy_certs = 569. !!(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS); 570. /* A hack to keep people who don't want to modify their crypto/x509/x509_vfy.c:572:7: Taking false branch 570. /* A hack to keep people who don't want to modify their 571. software happy */ 572. if (getenv("OPENSSL_ALLOW_PROXY_CERTS")) ^ 573. allow_proxy_certs = 1; 574. purpose = ctx->param->purpose; crypto/x509/x509_vfy.c:574:3: 572. if (getenv("OPENSSL_ALLOW_PROXY_CERTS")) 573. allow_proxy_certs = 1; 574. > purpose = ctx->param->purpose; 575. } 576. crypto/x509/x509_vfy.c:578:7: 576. 577. /* Check all untrusted certificates */ 578. > for (i = 0; i < ctx->last_untrusted; i++) 579. { 580. int ret; crypto/x509/x509_vfy.c:578:14: Loop condition is true. Entering loop body 576. 577. /* Check all untrusted certificates */ 578. for (i = 0; i < ctx->last_untrusted; i++) ^ 579. { 580. int ret; crypto/x509/x509_vfy.c:581:7: Condition is true 579. { 580. int ret; 581. x = sk_X509_value(ctx->chain, i); ^ 582. if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) 583. && (x->ex_flags & EXFLAG_CRITICAL)) crypto/x509/x509_vfy.c:581:3: 579. { 580. int ret; 581. > x = sk_X509_value(ctx->chain, i); 582. if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) 583. && (x->ex_flags & EXFLAG_CRITICAL)) crypto/stack/stack.c:300:1: start of procedure sk_value() 298. } 299. 300. > void *sk_value(const _STACK *st, int i) 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; crypto/stack/stack.c:302:6: Taking false branch 300. void *sk_value(const _STACK *st, int i) 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 303. return st->data[i]; 304. } crypto/stack/stack.c:302:13: Taking false branch 300. void *sk_value(const _STACK *st, int i) 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 303. return st->data[i]; 304. } crypto/stack/stack.c:302:24: Taking true branch 300. void *sk_value(const _STACK *st, int i) 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 303. return st->data[i]; 304. } crypto/stack/stack.c:302:39: 300. void *sk_value(const _STACK *st, int i) 301. { 302. > if(!st || (i < 0) || (i >= st->num)) return NULL; 303. return st->data[i]; 304. } crypto/stack/stack.c:304:1: return from a call to sk_value 302. if(!st || (i < 0) || (i >= st->num)) return NULL; 303. return st->data[i]; 304. > } 305. 306. void *sk_set(_STACK *st, int i, void *value) crypto/x509/x509_vfy.c:582:9: Taking true branch 580. int ret; 581. x = sk_X509_value(ctx->chain, i); 582. if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) ^ 583. && (x->ex_flags & EXFLAG_CRITICAL)) 584. { crypto/x509/x509_vfy.c:583:8: 581. x = sk_X509_value(ctx->chain, i); 582. if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) 583. > && (x->ex_flags & EXFLAG_CRITICAL)) 584. { 585. ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION;
https://github.com/openssl/openssl/blob/2dac2667d1ec0ffd9f5609cc07f7e1221624e152/crypto/x509/x509_vfy.c/#L583
d2a_code_trace_data_44664
static ossl_inline void packet_forward(PACKET *pkt, size_t len) { pkt->curr += len; pkt->remaining -= len; } test/packettest.c:125: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 247):unsigned64 by call to `PACKET_forward`. Showing all 14 steps of the trace test/packettest.c:122:10: Call 120. PACKET pkt; 121. 122. if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN)) ^ 123. || !TEST_true(PACKET_get_net_4(&pkt, &i)) 124. || !TEST_ulong_eq(i, 0x02040608UL) ssl/packet_locl.h:72:8: Parameter `pkt->remaining` 70. * is being used. 71. */ 72. __owur static ossl_inline int PACKET_buf_init(PACKET *pkt, ^ 73. const unsigned char *buf, 74. size_t len) test/packettest.c:123:17: Call 121. 122. if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN)) 123. || !TEST_true(PACKET_get_net_4(&pkt, &i)) ^ 124. || !TEST_ulong_eq(i, 0x02040608UL) 125. || !TEST_true(PACKET_forward(&pkt, BUF_LEN - 8)) ssl/packet_locl.h:236:8: Parameter `pkt->remaining` 234. /* Equivalent of n2l */ 235. /* Get 4 bytes in network order from |pkt| and store the value in |*data| */ 236. __owur static ossl_inline int PACKET_get_net_4(PACKET *pkt, unsigned long *data) ^ 237. { 238. if (!PACKET_peek_net_4(pkt, data)) ssl/packet_locl.h:238:10: Call 236. __owur static ossl_inline int PACKET_get_net_4(PACKET *pkt, unsigned long *data) 237. { 238. if (!PACKET_peek_net_4(pkt, data)) ^ 239. return 0; 240. ssl/packet_locl.h:220:8: Parameter `pkt->remaining` 218. * |*data| 219. */ 220. __owur static ossl_inline int PACKET_peek_net_4(const PACKET *pkt, ^ 221. unsigned long *data) 222. { test/packettest.c:125:17: Call 123. || !TEST_true(PACKET_get_net_4(&pkt, &i)) 124. || !TEST_ulong_eq(i, 0x02040608UL) 125. || !TEST_true(PACKET_forward(&pkt, BUF_LEN - 8)) ^ 126. || !TEST_true(PACKET_get_net_4(&pkt, &i)) 127. || !TEST_ulong_eq(i, 0xf8fafcfeUL) ssl/packet_locl.h:467:8: Parameter `len` 465. 466. /* Move the current reading position forward |len| bytes */ 467. __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len) ^ 468. { 469. if (PACKET_remaining(pkt) < len) ssl/packet_locl.h:472:5: Call 470. return 0; 471. 472. packet_forward(pkt, len); ^ 473. 474. return 1; ssl/packet_locl.h:33:1: <LHS trace> 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: Parameter `pkt->remaining` 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: <RHS trace> 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: Parameter `len` 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:36:5: Binary operation: ([0, +oo] - 247):unsigned64 by call to `PACKET_forward` 34. { 35. pkt->curr += len; 36. pkt->remaining -= len; ^ 37. } 38.
https://github.com/openssl/openssl/blob/424aa352458486d67e1e9cd3d3990dc06a60ba4a/ssl/packet_locl.h/#L36
d2a_code_trace_data_44665
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) { bn_check_top(b); if (a == b) return a; if (bn_wexpand(a, b->top) == NULL) return NULL; if (b->top > 0) memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); a->top = b->top; a->neg = b->neg; bn_check_top(a); return a; } apps/s_client.c:287: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_mod_exp`. Showing all 28 steps of the trace apps/s_client.c:274:1: Parameter `N->top` 272. # define SRP_NUMBER_ITERATIONS_FOR_PRIME 64 273. 274. > static int srp_Verify_N_and_g(const BIGNUM *N, const BIGNUM *g) 275. { 276. BN_CTX *bn_ctx = BN_CTX_new(); apps/s_client.c:280:53: Call 278. BIGNUM *r = BN_new(); 279. int ret = 280. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && ^ 281. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 && 282. p != NULL && BN_rshift1(p, N) && crypto/bn/bn_lib.c:860:1: Parameter `a->top` 858. } 859. 860. > int BN_is_odd(const BIGNUM *a) 861. { 862. return (a->top > 0) && (a->d[0] & 1); apps/s_client.c:281:9: Call 279. int ret = 280. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && 281. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 && ^ 282. p != NULL && BN_rshift1(p, N) && 283. /* p = (N-1)/2 */ crypto/bn/bn_prime.c:145:1: Parameter `a->top` 143. } 144. 145. > int BN_is_prime_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 146. BN_GENCB *cb) 147. { crypto/bn/bn_prime.c:148:12: Call 146. BN_GENCB *cb) 147. { 148. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb); ^ 149. } 150. crypto/bn/bn_prime.c:151:1: Parameter `a->top` 149. } 150. 151. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 152. int do_trial_division, BN_GENCB *cb) 153. { crypto/bn/bn_prime.c:161:9: Call 159. 160. /* Take care of the really small primes 2 & 3 */ 161. if (BN_is_word(a, 2) || BN_is_word(a, 3)) ^ 162. return 1; 163. crypto/bn/bn_lib.c:855:1: Parameter `a->top` 853. } 854. 855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); crypto/bn/bn_lib.c:857:12: Call 855. int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); ^ 858. } 859. crypto/bn/bn_lib.c:840:1: Parameter `a->top` 838. } 839. 840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w) 841. { 842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0)); apps/s_client.c:282:22: Call 280. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && 281. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 && 282. p != NULL && BN_rshift1(p, N) && ^ 283. /* p = (N-1)/2 */ 284. BN_is_prime_ex(p, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 && crypto/bn/bn_shift.c:54:9: Call 52. bn_check_top(a); 53. 54. if (BN_is_zero(a)) { ^ 55. BN_zero(r); 56. return 1; crypto/bn/bn_lib.c:845:1: Parameter `a->top` 843. } 844. 845. > int BN_is_zero(const BIGNUM *a) 846. { 847. return a->top == 0; apps/s_client.c:287:9: Call 285. r != NULL && 286. /* verify g^((N-1)/2) == -1 (mod N) */ 287. BN_mod_exp(r, g, p, N, bn_ctx) && ^ 288. BN_add_word(r, 1) && BN_cmp(r, N) == 0; 289. crypto/bn/bn_exp.c:89:1: Parameter `m->top` 87. } 88. 89. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 90. BN_CTX *ctx) 91. { crypto/bn/bn_exp.c:134:9: Call 132. 133. #ifdef MONT_MUL_MOD 134. if (BN_is_odd(m)) { ^ 135. # ifdef MONT_EXP_WORD 136. if (a->top == 1 && !a->neg crypto/bn/bn_lib.c:860:1: Parameter `a->top` 858. } 859. 860. > int BN_is_odd(const BIGNUM *a) 861. { 862. return (a->top > 0) && (a->d[0] & 1); crypto/bn/bn_exp.c:149:15: Call 147. #ifdef RECP_MUL_MOD 148. { 149. ret = BN_mod_exp_recp(r, a, p, m, ctx); ^ 150. } 151. #else crypto/bn/bn_exp.c:161:1: Parameter `m->top` 159. } 160. 161. > int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 162. const BIGNUM *m, BN_CTX *ctx) 163. { crypto/bn/bn_exp.c:200:14: Call 198. if (m->neg) { 199. /* ignore sign of 'm' */ 200. if (!BN_copy(aa, m)) ^ 201. goto err; 202. aa->neg = 0; crypto/bn/bn_lib.c:285:1: <Offset trace> 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_lib.c:285:1: Parameter `b->top` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_lib.c:285:1: <Length trace> 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_lib.c:285:1: Parameter `*a->d` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_lib.c:291:9: Call 289. if (a == b) 290. return a; 291. if (bn_wexpand(a, b->top) == NULL) ^ 292. return NULL; 293. crypto/bn/bn_lib.c:941:1: Parameter `*a->d` 939. } 940. 941. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 942. { 943. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:295:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_mod_exp` 293. 294. if (b->top > 0) 295. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); ^ 296. 297. a->top = b->top;
https://github.com/openssl/openssl/blob/b48d4397b8ee4256f0b0a115eb99f27ae89995e0/crypto/bn/bn_lib.c/#L295
d2a_code_trace_data_44666
char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) { X509_NAME_ENTRY *ne; int i; int n, lold, l, l1, l2, num, j, type; const char *s; char *p; unsigned char *q; BUF_MEM *b = NULL; static const char hex[17] = "0123456789ABCDEF"; int gs_doit[4]; char tmp_buf[80]; #ifdef CHARSET_EBCDIC unsigned char ebcdic_buf[1024]; #endif if (buf == NULL) { if ((b = BUF_MEM_new()) == NULL) goto err; if (!BUF_MEM_grow(b, 200)) goto err; b->data[0] = '\0'; len = 200; } else if (len == 0) { return NULL; } if (a == NULL) { if (b) { buf = b->data; OPENSSL_free(b); } strncpy(buf, "NO X509_NAME", len); buf[len - 1] = '\0'; return buf; } len--; l = 0; for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { ne = sk_X509_NAME_ENTRY_value(a->entries, i); n = OBJ_obj2nid(ne->object); if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) { i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object); s = tmp_buf; } l1 = strlen(s); type = ne->value->type; num = ne->value->length; q = ne->value->data; #ifdef CHARSET_EBCDIC if (type == V_ASN1_GENERALSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_PRINTABLESTRING || type == V_ASN1_TELETEXSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_IA5STRING) { ascii2ebcdic(ebcdic_buf, q, (num > (int)sizeof(ebcdic_buf)) ? (int)sizeof(ebcdic_buf) : num); q = ebcdic_buf; } #endif if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) { gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0; for (j = 0; j < num; j++) if (q[j] != 0) gs_doit[j & 3] = 1; if (gs_doit[0] | gs_doit[1] | gs_doit[2]) gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; else { gs_doit[0] = gs_doit[1] = gs_doit[2] = 0; gs_doit[3] = 1; } } else gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; for (l2 = j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; l2++; #ifndef CHARSET_EBCDIC if ((q[j] < ' ') || (q[j] > '~')) l2 += 3; #else if ((os_toascii[q[j]] < os_toascii[' ']) || (os_toascii[q[j]] > os_toascii['~'])) l2 += 3; #endif } lold = l; l += 1 + l1 + 1 + l2; if (b != NULL) { if (!BUF_MEM_grow(b, l + 1)) goto err; p = &(b->data[lold]); } else if (l > len) { break; } else p = &(buf[lold]); *(p++) = '/'; memcpy(p, s, (unsigned int)l1); p += l1; *(p++) = '='; #ifndef CHARSET_EBCDIC q = ne->value->data; #endif for (j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; #ifndef CHARSET_EBCDIC n = q[j]; if ((n < ' ') || (n > '~')) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = n; #else n = os_toascii[q[j]]; if ((n < os_toascii[' ']) || (n > os_toascii['~'])) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = q[j]; #endif } *p = '\0'; } if (b != NULL) { p = b->data; OPENSSL_free(b); } else p = buf; if (i == 0) *p = '\0'; return (p); err: X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE); BUF_MEM_free(b); return (NULL); } crypto/x509/x509_cmp.c:90: error: BUFFER_OVERRUN_L3 Offset added: [0, 200] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace crypto/x509/x509_cmp.c:90:9: Call 88. if (ctx == NULL) 89. goto err; 90. f = X509_NAME_oneline(a->cert_info.issuer, NULL, 0); ^ 91. if (!EVP_DigestInit_ex(ctx, EVP_md5(), NULL)) 92. goto err; crypto/x509/x509_obj.c:66:1: <Offset trace> 64. #include "internal/x509_int.h" 65. 66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 67. { 68. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:66:1: Parameter `len` 64. #include "internal/x509_int.h" 65. 66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 67. { 68. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:66:1: <Length trace> 64. #include "internal/x509_int.h" 65. 66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 67. { 68. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:66:1: Parameter `*buf` 64. #include "internal/x509_int.h" 65. 66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 67. { 68. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:97:9: Array access: Offset added: [0, 200] Size: [1, 2147483644] by call to `X509_NAME_oneline` 95. OPENSSL_free(b); 96. } 97. strncpy(buf, "NO X509_NAME", len); ^ 98. buf[len - 1] = '\0'; 99. return buf;
https://github.com/openssl/openssl/blob/b33d1141b6dcce947708b984c5e9e91dad3d675d/crypto/x509/x509_obj.c/#L97
d2a_code_trace_data_44667
static ossl_inline unsigned int constant_time_is_zero(unsigned int a) { return constant_time_msb(~a & (a - 1)); } test/constant_time_test.c:71: error: INTEGER_OVERFLOW_L1 (0 - 1):unsigned32 by call to `constant_time_is_zero_8`. Showing all 7 steps of the trace test/constant_time_test.c:69:1: Parameter `a` 67. } 68. 69. > static int test_is_zero_8(unsigned int a) 70. { 71. if (a == 0 && !TEST_uint_eq(constant_time_is_zero_8(a), CONSTTIME_TRUE_8)) test/constant_time_test.c:71:20: Call 69. static int test_is_zero_8(unsigned int a) 70. { 71. if (a == 0 && !TEST_uint_eq(constant_time_is_zero_8(a), CONSTTIME_TRUE_8)) ^ 72. return 0; 73. if (a != 0 && !TEST_uint_eq(constant_time_is_zero_8(a), CONSTTIME_FALSE_8)) include/internal/constant_time_locl.h:160:1: Parameter `a` 158. } 159. 160. > static ossl_inline unsigned char constant_time_is_zero_8(unsigned int a) 161. { 162. return (unsigned char)(constant_time_is_zero(a)); include/internal/constant_time_locl.h:162:28: Call 160. static ossl_inline unsigned char constant_time_is_zero_8(unsigned int a) 161. { 162. return (unsigned char)(constant_time_is_zero(a)); ^ 163. } 164. include/internal/constant_time_locl.h:150:1: <LHS trace> 148. } 149. 150. > static ossl_inline unsigned int constant_time_is_zero(unsigned int a) 151. { 152. return constant_time_msb(~a & (a - 1)); include/internal/constant_time_locl.h:150:1: Parameter `a` 148. } 149. 150. > static ossl_inline unsigned int constant_time_is_zero(unsigned int a) 151. { 152. return constant_time_msb(~a & (a - 1)); include/internal/constant_time_locl.h:152:12: Binary operation: (0 - 1):unsigned32 by call to `constant_time_is_zero_8` 150. static ossl_inline unsigned int constant_time_is_zero(unsigned int a) 151. { 152. return constant_time_msb(~a & (a - 1)); ^ 153. } 154.
https://github.com/openssl/openssl/blob/f3ab6c16c424054c8d6d2c152744dcbaf41c3232/include/internal/constant_time_locl.h/#L152
d2a_code_trace_data_44668
void curve448_scalar_halve(curve448_scalar_t out, const curve448_scalar_t a) { c448_word_t mask = 0 - (a->limb[0] & 1); c448_dword_t chain = 0; unsigned int i; for (i = 0; i < C448_SCALAR_LIMBS; i++) { chain = (chain + a->limb[i]) + (sc_p->limb[i] & mask); out->limb[i] = (c448_word_t)chain; chain >>= C448_WORD_BITS; } for (i = 0; i < C448_SCALAR_LIMBS - 1; i++) out->limb[i] = out->limb[i] >> 1 | out->limb[i + 1] << (WBITS - 1); out->limb[i] = out->limb[i] >> 1 | (c448_word_t)(chain << (WBITS - 1)); } crypto/ec/curve448/eddsa.c:192: error: INTEGER_OVERFLOW_L2 (0 - [0, 1]):unsigned32 by call to `curve448_scalar_halve`. Showing all 5 steps of the trace crypto/ec/curve448/eddsa.c:184:9: Unknown value from: OPENSSL_cleanse 182. goto err; 183. curve448_scalar_decode_long(nonce_scalar, nonce, sizeof(nonce)); 184. OPENSSL_cleanse(nonce, sizeof(nonce)); ^ 185. } 186. crypto/ec/curve448/eddsa.c:192:9: Call 190. curve448_point_t p; 191. 192. curve448_scalar_halve(nonce_scalar_2, nonce_scalar); ^ 193. for (c = 2; c < C448_EDDSA_ENCODE_RATIO; c <<= 1) { 194. curve448_scalar_halve(nonce_scalar_2, nonce_scalar_2); crypto/ec/curve448/scalar.c:222:1: <RHS trace> 220. } 221. 222. > void curve448_scalar_halve(curve448_scalar_t out, const curve448_scalar_t a) 223. { 224. c448_word_t mask = 0 - (a->limb[0] & 1); crypto/ec/curve448/scalar.c:222:1: Parameter `a->limb[*]` 220. } 221. 222. > void curve448_scalar_halve(curve448_scalar_t out, const curve448_scalar_t a) 223. { 224. c448_word_t mask = 0 - (a->limb[0] & 1); crypto/ec/curve448/scalar.c:224:5: Binary operation: (0 - [0, 1]):unsigned32 by call to `curve448_scalar_halve` 222. void curve448_scalar_halve(curve448_scalar_t out, const curve448_scalar_t a) 223. { 224. c448_word_t mask = 0 - (a->limb[0] & 1); ^ 225. c448_dword_t chain = 0; 226. unsigned int i;
https://github.com/openssl/openssl/blob/0cdcdacc337005e08a906b2e07d4e44e3ee48138/crypto/ec/curve448/scalar.c/#L224
d2a_code_trace_data_44669
static int check_cert(X509_STORE_CTX *ctx) { X509_CRL *crl = NULL, *dcrl = NULL; X509 *x; int ok, cnum; unsigned int last_reasons; cnum = ctx->error_depth; x = sk_X509_value(ctx->chain, cnum); ctx->current_cert = x; ctx->current_issuer = NULL; ctx->current_crl_score = 0; ctx->current_reasons = 0; while (ctx->current_reasons != CRLDP_ALL_REASONS) { last_reasons = ctx->current_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; if (last_reasons == ctx->current_reasons) { ctx->error = X509_V_ERR_UNABLE_TO_GET_CRL; ok = ctx->verify_cb(0, ctx); goto err; } } err: X509_CRL_free(crl); X509_CRL_free(dcrl); ctx->current_crl = NULL; return ok; } crypto/x509/x509_vfy.c:856: error: NULL_DEREFERENCE pointer `x` last assigned on line 844 could be null and is dereferenced by call to `get_crl_delta()` at line 856, column 9. Showing all 26 steps of the trace crypto/x509/x509_vfy.c:837:1: start of procedure check_cert() 835. } 836. 837. > static int check_cert(X509_STORE_CTX *ctx) 838. { 839. X509_CRL *crl = NULL, *dcrl = NULL; crypto/x509/x509_vfy.c:839:2: 837. static int check_cert(X509_STORE_CTX *ctx) 838. { 839. > X509_CRL *crl = NULL, *dcrl = NULL; 840. X509 *x; 841. int ok, cnum; crypto/x509/x509_vfy.c:843:2: 841. int ok, cnum; 842. unsigned int last_reasons; 843. > cnum = ctx->error_depth; 844. x = sk_X509_value(ctx->chain, cnum); 845. ctx->current_cert = x; crypto/x509/x509_vfy.c:844:6: Condition is true 842. unsigned int last_reasons; 843. cnum = ctx->error_depth; 844. x = sk_X509_value(ctx->chain, cnum); ^ 845. ctx->current_cert = x; 846. ctx->current_issuer = NULL; crypto/x509/x509_vfy.c:844:2: 842. unsigned int last_reasons; 843. cnum = ctx->error_depth; 844. > x = sk_X509_value(ctx->chain, cnum); 845. ctx->current_cert = x; 846. ctx->current_issuer = NULL; crypto/stack/stack.c:300:1: start of procedure sk_value() 298. } 299. 300. > void *sk_value(const _STACK *st, int i) 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; crypto/stack/stack.c:302:6: Taking false branch 300. void *sk_value(const _STACK *st, int i) 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 303. return st->data[i]; 304. } crypto/stack/stack.c:302:13: Taking false branch 300. void *sk_value(const _STACK *st, int i) 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 303. return st->data[i]; 304. } crypto/stack/stack.c:302:24: Taking true branch 300. void *sk_value(const _STACK *st, int i) 301. { 302. if(!st || (i < 0) || (i >= st->num)) return NULL; ^ 303. return st->data[i]; 304. } crypto/stack/stack.c:302:39: 300. void *sk_value(const _STACK *st, int i) 301. { 302. > if(!st || (i < 0) || (i >= st->num)) return NULL; 303. return st->data[i]; 304. } crypto/stack/stack.c:304:1: return from a call to sk_value 302. if(!st || (i < 0) || (i >= st->num)) return NULL; 303. return st->data[i]; 304. > } 305. 306. void *sk_set(_STACK *st, int i, void *value) crypto/x509/x509_vfy.c:845:2: 843. cnum = ctx->error_depth; 844. x = sk_X509_value(ctx->chain, cnum); 845. > ctx->current_cert = x; 846. ctx->current_issuer = NULL; 847. ctx->current_crl_score = 0; crypto/x509/x509_vfy.c:846:2: 844. x = sk_X509_value(ctx->chain, cnum); 845. ctx->current_cert = x; 846. > ctx->current_issuer = NULL; 847. ctx->current_crl_score = 0; 848. ctx->current_reasons = 0; crypto/x509/x509_vfy.c:847:2: 845. ctx->current_cert = x; 846. ctx->current_issuer = NULL; 847. > ctx->current_crl_score = 0; 848. ctx->current_reasons = 0; 849. while (ctx->current_reasons != CRLDP_ALL_REASONS) crypto/x509/x509_vfy.c:848:2: 846. ctx->current_issuer = NULL; 847. ctx->current_crl_score = 0; 848. > ctx->current_reasons = 0; 849. while (ctx->current_reasons != CRLDP_ALL_REASONS) 850. { crypto/x509/x509_vfy.c:849:9: Loop condition is true. Entering loop body 847. ctx->current_crl_score = 0; 848. ctx->current_reasons = 0; 849. while (ctx->current_reasons != CRLDP_ALL_REASONS) ^ 850. { 851. last_reasons = ctx->current_reasons; crypto/x509/x509_vfy.c:851:3: 849. while (ctx->current_reasons != CRLDP_ALL_REASONS) 850. { 851. > last_reasons = ctx->current_reasons; 852. /* Try to retrieve relevant CRL */ 853. if (ctx->get_crl) crypto/x509/x509_vfy.c:853:7: Taking false branch 851. last_reasons = ctx->current_reasons; 852. /* Try to retrieve relevant CRL */ 853. if (ctx->get_crl) ^ 854. ok = ctx->get_crl(ctx, &crl, x); 855. else crypto/x509/x509_vfy.c:856:4: 854. ok = ctx->get_crl(ctx, &crl, x); 855. else 856. > ok = get_crl_delta(ctx, &crl, &dcrl, x); 857. /* If error looking up CRL, nothing we can do except 858. * notify callback crypto/x509/x509_vfy.c:1448:1: start of procedure get_crl_delta() 1446. */ 1447. 1448. > static int get_crl_delta(X509_STORE_CTX *ctx, 1449. X509_CRL **pcrl, X509_CRL **pdcrl, X509 *x) 1450. { crypto/x509/x509_vfy.c:1452:2: 1450. { 1451. int ok; 1452. > X509 *issuer = NULL; 1453. int crl_score = 0; 1454. unsigned int reasons; crypto/x509/x509_vfy.c:1453:2: 1451. int ok; 1452. X509 *issuer = NULL; 1453. > int crl_score = 0; 1454. unsigned int reasons; 1455. X509_CRL *crl = NULL, *dcrl = NULL; crypto/x509/x509_vfy.c:1455:2: 1453. int crl_score = 0; 1454. unsigned int reasons; 1455. > X509_CRL *crl = NULL, *dcrl = NULL; 1456. STACK_OF(X509_CRL) *skcrl; 1457. X509_NAME *nm = X509_get_issuer_name(x); crypto/x509/x509_vfy.c:1457:2: 1455. X509_CRL *crl = NULL, *dcrl = NULL; 1456. STACK_OF(X509_CRL) *skcrl; 1457. > X509_NAME *nm = X509_get_issuer_name(x); 1458. reasons = ctx->current_reasons; 1459. ok = get_crl_sk(ctx, &crl, &dcrl, crypto/x509/x509_cmp.c:130:1: start of procedure X509_get_issuer_name() 128. #endif 129. 130. > X509_NAME *X509_get_issuer_name(X509 *a) 131. { 132. return(a->cert_info->issuer); crypto/x509/x509_cmp.c:132:2: 130. X509_NAME *X509_get_issuer_name(X509 *a) 131. { 132. > return(a->cert_info->issuer); 133. } 134.
https://github.com/openssl/openssl/blob/2dac2667d1ec0ffd9f5609cc07f7e1221624e152/crypto/x509/x509_vfy.c/#L856
d2a_code_trace_data_44670
static void get_sample_bits(const float *buf, int *bits) { int i, j; short sbuf[128]; int bitsum = 0, last_bitsum, small_bitsum, big_bitsum; short shift, shift_saved; int max, sum, last_off, tmp; int big_off, small_off; int off; max = 0; for (i = 0; i < NELLY_FILL_LEN; i++) { max = FFMAX(max, buf[i]); } shift = -16; shift += headroom(&max); sum = 0; for (i = 0; i < NELLY_FILL_LEN; i++) { sbuf[i] = signed_shift(buf[i], shift); sbuf[i] = (3*sbuf[i])>>2; sum += sbuf[i]; } shift += 11; shift_saved = shift; sum -= NELLY_DETAIL_BITS << shift; shift += headroom(&sum); small_off = (NELLY_BASE_OFF * (sum>>16)) >> 15; shift = shift_saved - (NELLY_BASE_SHIFT+shift-31); small_off = signed_shift(small_off, shift); bitsum = sum_bits(sbuf, shift_saved, small_off); if (bitsum != NELLY_DETAIL_BITS) { shift = 0; off = bitsum - NELLY_DETAIL_BITS; for(shift=0; FFABS(off) <= 16383; shift++) off *= 2; off = (off * NELLY_BASE_OFF) >> 15; shift = shift_saved-(NELLY_BASE_SHIFT+shift-15); off = signed_shift(off, shift); for (j = 1; j < 20; j++) { last_off = small_off; small_off += off; last_bitsum = bitsum; bitsum = sum_bits(sbuf, shift_saved, small_off); if ((bitsum-NELLY_DETAIL_BITS) * (last_bitsum-NELLY_DETAIL_BITS) <= 0) break; } if (bitsum > NELLY_DETAIL_BITS) { big_off = small_off; small_off = last_off; big_bitsum=bitsum; small_bitsum=last_bitsum; } else { big_off = last_off; big_bitsum=last_bitsum; small_bitsum=bitsum; } while (bitsum != NELLY_DETAIL_BITS && j <= 19) { off = (big_off+small_off)>>1; bitsum = sum_bits(sbuf, shift_saved, off); if (bitsum > NELLY_DETAIL_BITS) { big_off=off; big_bitsum=bitsum; } else { small_off = off; small_bitsum=bitsum; } j++; } if (abs(big_bitsum-NELLY_DETAIL_BITS) >= abs(small_bitsum-NELLY_DETAIL_BITS)) { bitsum = small_bitsum; } else { small_off = big_off; bitsum = big_bitsum; } } for (i = 0; i < NELLY_FILL_LEN; i++) { tmp = sbuf[i]-small_off; tmp = ((tmp>>(shift_saved-1))+1)>>1; bits[i] = av_clip(tmp, 0, NELLY_BIT_CAP); } if (bitsum > NELLY_DETAIL_BITS) { tmp = i = 0; while (tmp < NELLY_DETAIL_BITS) { tmp += bits[i]; i++; } bits[i-1] -= tmp - NELLY_DETAIL_BITS; for(; i < NELLY_FILL_LEN; i++) bits[i] = 0; } } libavcodec/nellymoserdec.c:301: error: Buffer Overrun L3 Offset: [-1, +oo] Size: 128 by call to `get_sample_bits`. libavcodec/nellymoserdec.c:277:1: Array declaration 275. } 276. 277. void nelly_decode_block(NellyMoserDecodeContext *s, const unsigned char block[NELLY_BLOCK_LEN], float audio[NELLY_SAMPLES]) ^ 278. { 279. int i,j; libavcodec/nellymoserdec.c:301:5: Call 299. } 300. 301. get_sample_bits(buf, bits); ^ 302. 303. for (i = 0; i < 2; i++) { libavcodec/nellymoserdec.c:265:15: <Offset trace> 263. 264. if (bitsum > NELLY_DETAIL_BITS) { 265. tmp = i = 0; ^ 266. while (tmp < NELLY_DETAIL_BITS) { 267. tmp += bits[i]; libavcodec/nellymoserdec.c:265:15: Assignment 263. 264. if (bitsum > NELLY_DETAIL_BITS) { 265. tmp = i = 0; ^ 266. while (tmp < NELLY_DETAIL_BITS) { 267. tmp += bits[i]; libavcodec/nellymoserdec.c:167:1: <Length trace> 165. 166. 167. static void get_sample_bits(const float *buf, int *bits) ^ 168. { 169. int i, j; libavcodec/nellymoserdec.c:167:1: Parameter `*bits` 165. 166. 167. static void get_sample_bits(const float *buf, int *bits) ^ 168. { 169. int i, j; libavcodec/nellymoserdec.c:271:9: Array access: Offset: [-1, +oo] Size: 128 by call to `get_sample_bits` 269. } 270. 271. bits[i-1] -= tmp - NELLY_DETAIL_BITS; ^ 272. for(; i < NELLY_FILL_LEN; i++) 273. bits[i] = 0;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/nellymoserdec.c/#L271
d2a_code_trace_data_44671
void ssl3_cbc_copy_mac(unsigned char *out, const SSL3_RECORD *rec, size_t md_size) { #if defined(CBC_MAC_ROTATE_IN_PLACE) unsigned char rotated_mac_buf[64 + EVP_MAX_MD_SIZE]; unsigned char *rotated_mac; #else unsigned char rotated_mac[EVP_MAX_MD_SIZE]; #endif size_t mac_end = rec->length; size_t mac_start = mac_end - md_size; size_t scan_start = 0; size_t i, j; size_t div_spoiler; size_t rotate_offset; OPENSSL_assert(rec->orig_len >= md_size); OPENSSL_assert(md_size <= EVP_MAX_MD_SIZE); #if defined(CBC_MAC_ROTATE_IN_PLACE) rotated_mac = rotated_mac_buf + ((0 - (size_t)rotated_mac_buf) & 63); #endif if (rec->orig_len > md_size + 255 + 1) scan_start = rec->orig_len - (md_size + 255 + 1); div_spoiler = md_size >> 1; div_spoiler <<= (sizeof(div_spoiler) - 1) * 8; rotate_offset = (div_spoiler + mac_start - scan_start) % md_size; memset(rotated_mac, 0, md_size); for (i = scan_start, j = 0; i < rec->orig_len; i++) { unsigned char mac_started = constant_time_ge_8_s(i, mac_start); unsigned char mac_ended = constant_time_ge_8_s(i, mac_end); unsigned char b = rec->data[i]; rotated_mac[j++] |= b & mac_started & ~mac_ended; j &= constant_time_lt_s(j, md_size); } #if defined(CBC_MAC_ROTATE_IN_PLACE) j = 0; for (i = 0; i < md_size; i++) { ((volatile unsigned char *)rotated_mac)[rotate_offset ^ 32]; out[j++] = rotated_mac[rotate_offset++]; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); } #else memset(out, 0, md_size); rotate_offset = md_size - rotate_offset; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); for (i = 0; i < md_size; i++) { for (j = 0; j < md_size; j++) out[j] |= rotated_mac[i] & constant_time_eq_8_s(j, rotate_offset); rotate_offset++; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); } #endif } ssl/record/rec_layer_d1.c:286: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, 64]):unsigned64 by call to `dtls1_process_record`. Showing all 10 steps of the trace ssl/record/rec_layer_d1.c:229:1: Parameter `s->rlayer.rrec.length` 227. &((s)->rlayer.d->unprocessed_rcds)) 228. 229. > int dtls1_process_buffered_records(SSL *s) 230. { 231. pitem *item; ssl/record/rec_layer_d1.c:286:31: Call 284. } 285. 286. if (!replayok || !dtls1_process_record(s, bitmap)) { ^ 287. /* dump this record */ 288. rr->length = 0; ssl/record/ssl3_record.c:1308:1: Parameter `s->rlayer.rrec.length` 1306. } 1307. 1308. > int dtls1_process_record(SSL *s, DTLS1_BITMAP *bitmap) 1309. { 1310. int i, al; ssl/record/ssl3_record.c:1433:13: Call 1431. */ 1432. mac = mac_tmp; 1433. ssl3_cbc_copy_mac(mac_tmp, rr, mac_size); ^ 1434. rr->length -= mac_size; 1435. } else { ssl/record/ssl3_record.c:1231:1: <LHS trace> 1229. #define CBC_MAC_ROTATE_IN_PLACE 1230. 1231. > void ssl3_cbc_copy_mac(unsigned char *out, 1232. const SSL3_RECORD *rec, size_t md_size) 1233. { ssl/record/ssl3_record.c:1231:1: Parameter `rec->length` 1229. #define CBC_MAC_ROTATE_IN_PLACE 1230. 1231. > void ssl3_cbc_copy_mac(unsigned char *out, 1232. const SSL3_RECORD *rec, size_t md_size) 1233. { ssl/record/ssl3_record.c:1244:5: Assignment 1242. * mac_end is the index of |rec->data| just after the end of the MAC. 1243. */ 1244. size_t mac_end = rec->length; ^ 1245. size_t mac_start = mac_end - md_size; 1246. /* ssl/record/ssl3_record.c:1231:1: <RHS trace> 1229. #define CBC_MAC_ROTATE_IN_PLACE 1230. 1231. > void ssl3_cbc_copy_mac(unsigned char *out, 1232. const SSL3_RECORD *rec, size_t md_size) 1233. { ssl/record/ssl3_record.c:1231:1: Parameter `md_size` 1229. #define CBC_MAC_ROTATE_IN_PLACE 1230. 1231. > void ssl3_cbc_copy_mac(unsigned char *out, 1232. const SSL3_RECORD *rec, size_t md_size) 1233. { ssl/record/ssl3_record.c:1245:5: Binary operation: ([0, +oo] - [0, 64]):unsigned64 by call to `dtls1_process_record` 1243. */ 1244. size_t mac_end = rec->length; 1245. size_t mac_start = mac_end - md_size; ^ 1246. /* 1247. * scan_start contains the number of bytes that we can ignore because the
https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/ssl/record/ssl3_record.c/#L1245
d2a_code_trace_data_44672
void BN_CTX_end(BN_CTX *ctx) { if (ctx == NULL) return; assert(ctx->depth > 0); if (ctx->depth == 0) BN_CTX_start(ctx); ctx->too_many = 0; ctx->depth--; if (ctx->depth < BN_CTX_NUM_POS) ctx->tos = ctx->pos[ctx->depth]; } crypto/evp/evp_pkey.c:180: error: BUFFER_OVERRUN_L3 Offset: [-3, +oo] Size: 12 by call to `BN_mod_exp`. Showing all 19 steps of the trace crypto/evp/evp_pkey.c:175:15: Call 173. goto dsaerr; 174. } 175. if (!(ctx = BN_CTX_new())) { ^ 176. EVPerr(EVP_F_EVP_PKCS82PKEY,ERR_R_MALLOC_FAILURE); 177. goto dsaerr; crypto/bn/bn_ctx.c:79:2: Call 77. } 78. 79. BN_CTX_init(ret); ^ 80. ret->flags=BN_FLG_MALLOCED; 81. return(ret); crypto/bn/bn_ctx.c:89:2: Assignment 87. ctx->tos = 0; 88. ctx->flags = 0; 89. ctx->depth = 0; ^ 90. ctx->too_many = 0; 91. for (i = 0; i < BN_CTX_NUM; i++) crypto/evp/evp_pkey.c:180:8: Call 178. } 179. 180. if (!BN_mod_exp(dsa->pub_key, dsa->g, ^ 181. dsa->priv_key, dsa->p, ctx)) { 182. crypto/bn/bn_exp.c:333:1: Parameter `ctx->depth` 331. #endif /* def ATALLA */ 332. 333. > int BN_mod_exp(BIGNUM *r, BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 334. BN_CTX *ctx) 335. { crypto/bn/bn_exp.c:361:9: Call 359. #endif 360. #ifdef RECP_MUL_MOD 361. { ret=BN_mod_exp_recp(r,a,p,m,ctx); } ^ 362. #else 363. { ret=BN_mod_exp_simple(r,a,p,m,ctx); } crypto/bn/bn_exp.c:374:1: Parameter `ctx->depth` 372. 373. /* #ifdef RECP_MUL_MOD */ 374. > int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 375. const BIGNUM *m, BN_CTX *ctx) 376. { crypto/bn/bn_exp.c:391:2: Call 389. } 390. 391. BN_CTX_start(ctx); ^ 392. if ((aa = BN_CTX_get(ctx)) == NULL) goto err; 393. crypto/bn/bn_ctx.c:108:1: Parameter `ctx->depth` 106. } 107. 108. > void BN_CTX_start(BN_CTX *ctx) 109. { 110. if (ctx->depth < BN_CTX_NUM_POS) crypto/bn/bn_ctx.c:112:2: Assignment 110. if (ctx->depth < BN_CTX_NUM_POS) 111. ctx->pos[ctx->depth] = ctx->tos; 112. ctx->depth++; ^ 113. } 114. crypto/bn/bn_exp.c:392:12: Call 390. 391. BN_CTX_start(ctx); 392. if ((aa = BN_CTX_get(ctx)) == NULL) goto err; ^ 393. 394. BN_RECP_CTX_init(&recp); crypto/bn/bn_ctx.c:115:1: Parameter `ctx->depth` 113. } 114. 115. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 116. { 117. if (ctx->depth > BN_CTX_NUM_POS || ctx->tos >= BN_CTX_NUM) crypto/bn/bn_exp.c:482:2: Call 480. ret=1; 481. err: 482. BN_CTX_end(ctx); ^ 483. for (i=0; i<ts; i++) 484. BN_clear_free(&(val[i])); crypto/bn/bn_ctx.c:130:1: <Offset trace> 128. } 129. 130. > void BN_CTX_end(BN_CTX *ctx) 131. { 132. if (ctx == NULL) return; crypto/bn/bn_ctx.c:130:1: Parameter `ctx->depth` 128. } 129. 130. > void BN_CTX_end(BN_CTX *ctx) 131. { 132. if (ctx == NULL) return; crypto/bn/bn_ctx.c:141:2: Assignment 139. 140. ctx->too_many = 0; 141. ctx->depth--; ^ 142. if (ctx->depth < BN_CTX_NUM_POS) 143. ctx->tos = ctx->pos[ctx->depth]; crypto/bn/bn_ctx.c:130:1: <Length trace> 128. } 129. 130. > void BN_CTX_end(BN_CTX *ctx) 131. { 132. if (ctx == NULL) return; crypto/bn/bn_ctx.c:130:1: Parameter `ctx->pos[*]` 128. } 129. 130. > void BN_CTX_end(BN_CTX *ctx) 131. { 132. if (ctx == NULL) return; crypto/bn/bn_ctx.c:143:14: Array access: Offset: [-3, +oo] Size: 12 by call to `BN_mod_exp` 141. ctx->depth--; 142. if (ctx->depth < BN_CTX_NUM_POS) 143. ctx->tos = ctx->pos[ctx->depth]; ^ 144. }
https://github.com/openssl/openssl/blob/ae1bb4e572e02ce73d54c05ce18e872c36da2d35/crypto/bn/bn_ctx.c/#L143
d2a_code_trace_data_44673
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:1819: error: Buffer Overrun L2 Offset: [0, 6] (⇐ [0, 2] + [0, 4]) Size: 3 by call to `dequant_lsp16i`. 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:1819:17: Call 1817. dequant_lsp10i(gb, lsps[n]); 1818. } else /* s->lsps == 16 */ 1819. dequant_lsp16i(gb, lsps[n]); ^ 1820. 1821. for (m = 0; m < s->lsps; m++) libavcodec/wmavoice.c:917:1: Parameter `*lsps` 915. * Parse 16 independently-coded LSPs. 916. */ 917. static void dequant_lsp16i(GetBitContext *gb, double *lsps) ^ 918. { 919. static const uint16_t vec_sizes[5] = { 256, 64, 128, 64, 128 }; libavcodec/wmavoice.c:938:5: Call 936. v[4] = get_bits(gb, 7); 937. 938. dequant_lsps( lsps, 5, v, vec_sizes, 2, ^ 939. wmavoice_dq_lsp16i1, mul_lsf, base_lsf); 940. dequant_lsps(&lsps[5], 5, &v[2], &vec_sizes[2], 2, 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: [0, 6] (⇐ [0, 2] + [0, 4]) Size: 3 by call to `dequant_lsp16i` 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_44674
static int update_index(CA_DB *db, char **row) { char **irow; int i; irow = app_malloc(sizeof(*irow) * (DB_NUMBER + 1), "row pointers"); for (i = 0; i < DB_NUMBER; i++) { irow[i] = row[i]; row[i] = NULL; } irow[DB_NUMBER] = NULL; if (!TXT_DB_insert(db->db, irow)) { BIO_printf(bio_err, "failed to update srpvfile\n"); BIO_printf(bio_err, "TXT_DB error number %ld\n", db->db->error); OPENSSL_free(irow); return 0; } return 1; } apps/srp.c:153: error: MEMORY_LEAK memory dynamically allocated to `return` by call to `app_malloc()` at line 140, column 12 is not reachable after line 153, column 5. Showing all 25 steps of the trace apps/srp.c:135:1: start of procedure update_index() 133. } 134. 135. > static int update_index(CA_DB *db, char **row) 136. { 137. char **irow; apps/srp.c:140:5: 138. int i; 139. 140. > irow = app_malloc(sizeof(*irow) * (DB_NUMBER + 1), "row pointers"); 141. for (i = 0; i < DB_NUMBER; i++) { 142. irow[i] = row[i]; apps/apps.c:976:1: start of procedure app_malloc() 974. } 975. 976. > void* app_malloc(int sz, const char *what) 977. { 978. void *vp = OPENSSL_malloc(sz); apps/apps.c:978:5: 976. void* app_malloc(int sz, const char *what) 977. { 978. > void *vp = OPENSSL_malloc(sz); 979. 980. if (vp == 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) apps/apps.c:980:9: Taking false branch 978. void *vp = OPENSSL_malloc(sz); 979. 980. if (vp == NULL) { ^ 981. BIO_printf(bio_err, "%s: Could not allocate %d bytes for %s\n", 982. opt_getprog(), sz, what); apps/apps.c:986:5: 984. exit(1); 985. } 986. > return vp; 987. } 988. apps/apps.c:987:1: return from a call to app_malloc 985. } 986. return vp; 987. > } 988. 989. /* apps/srp.c:141:10: 139. 140. irow = app_malloc(sizeof(*irow) * (DB_NUMBER + 1), "row pointers"); 141. > for (i = 0; i < DB_NUMBER; i++) { 142. irow[i] = row[i]; 143. row[i] = NULL; apps/srp.c:141:17: Loop condition is true. Entering loop body 139. 140. irow = app_malloc(sizeof(*irow) * (DB_NUMBER + 1), "row pointers"); 141. for (i = 0; i < DB_NUMBER; i++) { ^ 142. irow[i] = row[i]; 143. row[i] = NULL; apps/srp.c:142:9: 140. irow = app_malloc(sizeof(*irow) * (DB_NUMBER + 1), "row pointers"); 141. for (i = 0; i < DB_NUMBER; i++) { 142. > irow[i] = row[i]; 143. row[i] = NULL; 144. } apps/srp.c:143:9: 141. for (i = 0; i < DB_NUMBER; i++) { 142. irow[i] = row[i]; 143. > row[i] = NULL; 144. } 145. irow[DB_NUMBER] = NULL; apps/srp.c:141:32: 139. 140. irow = app_malloc(sizeof(*irow) * (DB_NUMBER + 1), "row pointers"); 141. > for (i = 0; i < DB_NUMBER; i++) { 142. irow[i] = row[i]; 143. row[i] = NULL; apps/srp.c:141:17: Loop condition is false. Leaving loop 139. 140. irow = app_malloc(sizeof(*irow) * (DB_NUMBER + 1), "row pointers"); 141. for (i = 0; i < DB_NUMBER; i++) { ^ 142. irow[i] = row[i]; 143. row[i] = NULL; apps/srp.c:145:5: 143. row[i] = NULL; 144. } 145. > irow[DB_NUMBER] = NULL; 146. 147. if (!TXT_DB_insert(db->db, irow)) { apps/srp.c:147:10: Taking false branch 145. irow[DB_NUMBER] = NULL; 146. 147. if (!TXT_DB_insert(db->db, irow)) { ^ 148. BIO_printf(bio_err, "failed to update srpvfile\n"); 149. BIO_printf(bio_err, "TXT_DB error number %ld\n", db->db->error); apps/srp.c:153:5: 151. return 0; 152. } 153. > return 1; 154. } 155.
https://github.com/openssl/openssl/blob/fe05264e32327e33f0b0c091479affeecbf55e89/apps/srp.c/#L153
d2a_code_trace_data_44675
static inline uint64_t get_val(BitstreamContext *bc, unsigned n) { #ifdef BITSTREAM_READER_LE uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1); bc->bits >>= n; #else uint64_t ret = bc->bits >> (64 - n); bc->bits <<= n; #endif bc->bits_left -= n; return ret; } libavcodec/tak.c:133: error: Integer Overflow L2 ([1, +oo] - 21):unsigned32 by call to `bitstream_read`. libavcodec/tak.c:133:21: Call 131. 132. ti->flags = bitstream_read(bc, TAK_FRAME_HEADER_FLAGS_BITS); 133. ti->frame_num = bitstream_read(bc, TAK_FRAME_HEADER_NO_BITS); ^ 134. 135. if (ti->flags & TAK_FRAME_FLAG_IS_LAST) { libavcodec/bitstream.h:183:1: Parameter `n` 181. 182. /* Return n bits from the buffer. n has to be in the 0-32 range. */ 183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n) ^ 184. { 185. if (!n) libavcodec/bitstream.h:194:12: Call 192. } 193. 194. return get_val(bc, n); ^ 195. } 196. libavcodec/bitstream.h:130:1: <LHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `bc->bits_left` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: <RHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Binary operation: ([1, +oo] - 21):unsigned32 by call to `bitstream_read` 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret;
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L139
d2a_code_trace_data_44676
int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) { PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | (diff > (0 - (PTRDIFF_T)len))); return overlapped; } crypto/cms/cms_pwri.c:195: error: INTEGER_OVERFLOW_L2 (0 - [-oo, 32]):unsigned64 by call to `EVP_DecryptUpdate`. Showing all 7 steps of the trace crypto/cms/cms_pwri.c:195:10: Call 193. return 0; 194. /* setup IV by decrypting last two blocks */ 195. if (!EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, &outl, ^ 196. in + inlen - 2 * blocklen, blocklen * 2) 197. /* 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. 290. return overlapped;
https://github.com/openssl/openssl/blob/b1531d8e6cc95837e38b10d875ae64144c6fdf7a/crypto/evp/evp_enc.c/#L288
d2a_code_trace_data_44677
static void frame_end(MpegEncContext *s) { int i; if (s->unrestricted_mv && s->current_picture.reference && !s->intra_only) { 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 (s->encoding) { for (i = 0; i < MAX_PICTURE_COUNT; i++) { if (!s->picture[i].reference) ff_mpeg_unref_picture(s, &s->picture[i]); } } s->avctx->coded_frame = s->current_picture_ptr->f; } libavcodec/mpegvideo_enc.c:1382: error: Null Dereference pointer `desc` last assigned on line 1381 could be null and is dereferenced at line 1382, column 22. libavcodec/mpegvideo_enc.c:1374:1: start of procedure frame_end() 1372. } 1373. 1374. static void frame_end(MpegEncContext *s) ^ 1375. { 1376. int i; libavcodec/mpegvideo_enc.c:1378:9: Taking true branch 1376. int i; 1377. 1378. if (s->unrestricted_mv && ^ 1379. s->current_picture.reference && 1380. !s->intra_only) { libavcodec/mpegvideo_enc.c:1379:9: Taking true branch 1377. 1378. if (s->unrestricted_mv && 1379. s->current_picture.reference && ^ 1380. !s->intra_only) { 1381. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); libavcodec/mpegvideo_enc.c:1380:10: Taking true branch 1378. if (s->unrestricted_mv && 1379. s->current_picture.reference && 1380. !s->intra_only) { ^ 1381. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); 1382. int hshift = desc->log2_chroma_w; libavcodec/mpegvideo_enc.c:1381:9: 1379. s->current_picture.reference && 1380. !s->intra_only) { 1381. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); ^ 1382. int hshift = desc->log2_chroma_w; 1383. int vshift = desc->log2_chroma_h; libavutil/pixdesc.c:1574:1: start of procedure av_pix_fmt_desc_get() 1572. } 1573. 1574. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) ^ 1575. { 1576. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) libavutil/pixdesc.c:1576:9: Taking false branch 1574. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1575. { 1576. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1577. return NULL; 1578. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1576:24: Taking true branch 1574. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1575. { 1576. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1577. return NULL; 1578. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1577:9: 1575. { 1576. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) 1577. return NULL; ^ 1578. return &av_pix_fmt_descriptors[pix_fmt]; 1579. } libavutil/pixdesc.c:1579:1: return from a call to av_pix_fmt_desc_get 1577. return NULL; 1578. return &av_pix_fmt_descriptors[pix_fmt]; 1579. } ^ 1580. 1581. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) libavcodec/mpegvideo_enc.c:1382:9: 1380. !s->intra_only) { 1381. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); 1382. int hshift = desc->log2_chroma_w; ^ 1383. int vshift = desc->log2_chroma_h; 1384. s->dsp.draw_edges(s->current_picture.f->data[0], s->linesize,
https://github.com/libav/libav/blob/641e57230b460bef52c88e61087d97c223910bea/libavcodec/mpegvideo_enc.c/#L1382
d2a_code_trace_data_44678
static void cpSeparateBufToContigBuf(uint8* out, uint8* in, uint32 rows, uint32 cols, int outskew, int inskew, tsample_t spp, int bytes_per_sample) { while (rows-- > 0) { uint32 j = cols; while (j-- > 0) { int n = bytes_per_sample; while( n-- ) { *out++ = *in++; } out += (spp-1)*bytes_per_sample; } out += outskew; in += inskew; } } tools/tiffcp.c:1108: error: Integer Overflow L2 ([0, `cols`] - 1):unsigned32. tools/tiffcp.c:1101:1: <LHS trace> 1099. } 1100. 1101. static void ^ 1102. cpSeparateBufToContigBuf(uint8* out, uint8* in, 1103. uint32 rows, uint32 cols, int outskew, int inskew, tsample_t spp, tools/tiffcp.c:1101:1: Parameter `cols` 1099. } 1100. 1101. static void ^ 1102. cpSeparateBufToContigBuf(uint8* out, uint8* in, 1103. uint32 rows, uint32 cols, int outskew, int inskew, tsample_t spp, tools/tiffcp.c:1107:3: Assignment 1105. { 1106. while (rows-- > 0) { 1107. uint32 j = cols; ^ 1108. while (j-- > 0) { 1109. int n = bytes_per_sample; tools/tiffcp.c:1108:10: Binary operation: ([0, cols] - 1):unsigned32 1106. while (rows-- > 0) { 1107. uint32 j = cols; 1108. while (j-- > 0) { ^ 1109. int n = bytes_per_sample; 1110.
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/tools/tiffcp.c/#L1108
d2a_code_trace_data_44679
static int sab_diamond_search(MpegEncContext * s, int *best, int dmin, int src_index, int ref_index, int const penalty_factor, int size, int h, int flags) { MotionEstContext * const c= &s->me; me_cmp_func cmpf, chroma_cmpf; Minima minima[MAX_SAB_SIZE]; const int minima_count= FFABS(c->dia_size); int i, j; LOAD_COMMON LOAD_COMMON2 int map_generation= c->map_generation; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; for(j=i=0; i<ME_MAP_SIZE && j<MAX_SAB_SIZE; i++){ uint32_t key= map[i]; key += (1<<(ME_MAP_MV_BITS-1)) + (1<<(2*ME_MAP_MV_BITS-1)); if((key&((-1)<<(2*ME_MAP_MV_BITS))) != map_generation) continue; minima[j].height= score_map[i]; minima[j].x= key & ((1<<ME_MAP_MV_BITS)-1); key>>=ME_MAP_MV_BITS; minima[j].y= key & ((1<<ME_MAP_MV_BITS)-1); minima[j].x-= (1<<(ME_MAP_MV_BITS-1)); minima[j].y-= (1<<(ME_MAP_MV_BITS-1)); if( minima[j].x > xmax || minima[j].x < xmin || minima[j].y > ymax || minima[j].y < ymin) continue; minima[j].checked=0; if(minima[j].x || minima[j].y) minima[j].height+= (mv_penalty[((minima[j].x)<<shift)-pred_x] + mv_penalty[((minima[j].y)<<shift)-pred_y])*penalty_factor; j++; } qsort(minima, j, sizeof(Minima), minima_cmp); for(; j<minima_count; j++){ minima[j].height=256*256*256*64; minima[j].checked=0; minima[j].x= minima[j].y=0; } for(i=0; i<minima_count; i++){ const int x= minima[i].x; const int y= minima[i].y; int d; if(minima[i].checked) continue; if( x >= xmax || x <= xmin || y >= ymax || y <= ymin) continue; SAB_CHECK_MV(x-1, y) SAB_CHECK_MV(x+1, y) SAB_CHECK_MV(x , y-1) SAB_CHECK_MV(x , y+1) minima[i].checked= 1; } best[0]= minima[0].x; best[1]= minima[0].y; dmin= minima[0].height; if( best[0] < xmax && best[0] > xmin && best[1] < ymax && best[1] > ymin){ int d; CHECK_MV(best[0]-1, best[1]) CHECK_MV(best[0]+1, best[1]) CHECK_MV(best[0], best[1]-1) CHECK_MV(best[0], best[1]+1) } return dmin; } libavcodec/motion_est_template.c:891: error: Uninitialized Value The value read from xmin was never initialized. libavcodec/motion_est_template.c:891:9: 889. CHECK_MV(best[0]+1, best[1]) 890. CHECK_MV(best[0], best[1]-1) 891. CHECK_MV(best[0], best[1]+1) ^ 892. } 893. return dmin;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L891
d2a_code_trace_data_44680
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:257: error: BUFFER_OVERRUN_L3 Offset: [2, +oo] Size: [1, 2147483644] by call to `d2i_DHxparams`. Showing all 27 steps of the trace crypto/pem/pem_pkey.c:252:10: Call 250. DH *ret = NULL; 251. 252. if (!PEM_bytes_read_bio(&data, &len, &nm, PEM_STRING_DHPARAMS, bp, cb, u)) ^ 253. return NULL; 254. p = data; crypto/pem/pem_lib.c:270:1: Parameter `**pdata` 268. } 269. 270. > int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, 271. const char *name, BIO *bp, pem_password_cb *cb, 272. void *u) crypto/pem/pem_pkey.c:254:5: Assignment 252. if (!PEM_bytes_read_bio(&data, &len, &nm, PEM_STRING_DHPARAMS, bp, cb, u)) 253. return NULL; 254. p = data; ^ 255. 256. if (strcmp(nm, PEM_STRING_DHXPARAMS) == 0) crypto/pem/pem_pkey.c:257:15: Call 255. 256. if (strcmp(nm, PEM_STRING_DHXPARAMS) == 0) 257. ret = d2i_DHxparams(x, &p, len); ^ 258. else 259. ret = d2i_DHparams(x, &p, len); crypto/dh/dh_asn1.c:130:1: Parameter `**pp` 128. /* Application public function: read in X9.42 DH parameters into DH structure */ 129. 130. > DH *d2i_DHxparams(DH **a, const unsigned char **pp, long length) 131. { 132. int_dhx942_dh *dhx = NULL; crypto/dh/dh_asn1.c:137:11: Call 135. if (dh == NULL) 136. return NULL; 137. dhx = d2i_int_dhx(NULL, pp, length); ^ 138. if (dhx == NULL) { 139. DH_free(dh); crypto/dh/dh_asn1.c:126:1: Parameter `**in` 124. int i2d_int_dhx(const int_dhx942_dh *a, unsigned char **pp); 125. 126. > IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(int_dhx942_dh, DHxparams, int_dhx) 127. 128. /* Application public function: read in X9.42 DH parameters into DH structure */ crypto/dh/dh_asn1.c:126:1: Call 124. int i2d_int_dhx(const int_dhx942_dh *a, unsigned char **pp); 125. 126. > IMPLEMENT_ASN1_ENCODE_FUNCTIONS_const_fname(int_dhx942_dh, DHxparams, int_dhx) 127. 128. /* Application public function: read in X9.42 DH parameters into DH structure */ crypto/asn1/tasn_dec.c:143:1: Parameter `**in` 141. */ 142. 143. > ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, 144. const unsigned char **in, long len, 145. const ASN1_ITEM *it) crypto/asn1/tasn_dec.c:152:9: Call 150. pval = &ptmpval; 151. asn1_tlc_clear_nc(&c); 152. if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) ^ 153. return *pval; 154. return NULL; crypto/asn1/tasn_dec.c:157:1: Parameter `**in` 155. } 156. 157. > int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, 158. const ASN1_ITEM *it, 159. int tag, int aclass, char opt, ASN1_TLC *ctx) crypto/asn1/tasn_dec.c:162:10: Call 160. { 161. int rv; 162. rv = asn1_item_embed_d2i(pval, in, len, it, tag, aclass, opt, ctx); ^ 163. if (rv <= 0) 164. ASN1_item_ex_free(pval, it); crypto/asn1/tasn_dec.c:173:1: Parameter `**in` 171. */ 172. 173. > static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in, 174. long len, const ASN1_ITEM *it, 175. int tag, int aclass, char opt, ASN1_TLC *ctx) crypto/asn1/tasn_dec.c:217:9: Assignment 215. 216. case ASN1_ITYPE_MSTRING: 217. p = *in; ^ 218. /* Just read in tag and class */ 219. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, crypto/asn1/tasn_dec.c:219:15: Call 217. p = *in; 218. /* Just read in tag and class */ 219. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, ^ 220. &p, len, -1, 0, 1, ctx); 221. if (!ret) { crypto/asn1/tasn_dec.c:1096:1: Parameter `**in` 1094. */ 1095. 1096. > static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, 1097. char *inf, char *cst, 1098. const unsigned char **in, long len, crypto/asn1/tasn_dec.c:1105:5: Assignment 1103. long plen; 1104. const unsigned char *p, *q; 1105. p = *in; ^ 1106. q = p; 1107. crypto/asn1/tasn_dec.c:1115:13: Call 1113. p += ctx->hdrlen; 1114. } else { 1115. i = ASN1_get_object(&p, &plen, &ptag, &pclass, len); ^ 1116. if (ctx) { 1117. ctx->ret = i; crypto/asn1/asn1_lib.c:91:1: Parameter `**pp` 89. } 90. 91. > int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, 92. int *pclass, long omax) 93. { crypto/asn1/asn1_lib.c:96:5: Assignment 94. int i, ret; 95. long l; 96. const unsigned char *p = *pp; ^ 97. int tag, xclass, inf; 98. long max = omax; crypto/asn1/asn1_lib.c:125:9: Assignment 123. } else { 124. tag = i; 125. p++; ^ 126. if (--max == 0) 127. goto err; crypto/asn1/asn1_lib.c:131:10: Call 129. *ptag = tag; 130. *pclass = xclass; 131. if (!asn1_get_length(&p, &inf, plength, max)) ^ 132. goto err; 133. crypto/asn1/asn1_lib.c:152:1: <Length trace> 150. } 151. 152. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, 153. long max) 154. { crypto/asn1/asn1_lib.c:152:1: Parameter `**pp` 150. } 151. 152. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, 153. long max) 154. { crypto/asn1/asn1_lib.c:155:5: Assignment 153. long max) 154. { 155. const unsigned char *p = *pp; ^ 156. unsigned long ret = 0; 157. unsigned long i; crypto/asn1/asn1_lib.c:168:15: Assignment 166. *inf = 0; 167. i = *p & 0x7f; 168. if (*(p++) & 0x80) { ^ 169. if (max < (long)i + 1) 170. return 0; crypto/asn1/asn1_lib.c:172:25: Array access: Offset: [2, +oo] Size: [1, 2147483644] by call to `d2i_DHxparams` 170. return 0; 171. /* Skip leading zeroes */ 172. while (i && *p == 0) { ^ 173. p++; 174. i--;
https://github.com/openssl/openssl/blob/79c7f74d6cefd5d32fa20e69195ad3de834ce065/crypto/asn1/asn1_lib.c/#L172
d2a_code_trace_data_44681
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/servername_test.c:209: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `SSL_free`. Showing all 17 steps of the trace test/servername_test.c:191:17: Call 189. TLS1_VERSION, 0, 190. &sctx, &cctx, cert, privkey)) 191. || !TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, ^ 192. NULL, NULL))) 193. goto end; test/ssltestlib.c:790:15: Call 788. if (*sssl != NULL) 789. serverssl = *sssl; 790. else if (!TEST_ptr(serverssl = SSL_new(serverctx))) ^ 791. goto error; 792. if (*cssl != NULL) ssl/ssl_lib.c:672:1: Parameter `ctx->sessions->num_nodes` 670. } 671. 672. > SSL *SSL_new(SSL_CTX *ctx) 673. { 674. SSL *s; test/servername_test.c:209:5: Call 207. testresult = 1; 208. end: 209. SSL_free(serverssl); ^ 210. SSL_free(clientssl); 211. SSL_CTX_free(sctx); ssl/ssl_lib.c:1134:1: Parameter `s->ctx->sessions->num_nodes` 1132. } 1133. 1134. > void SSL_free(SSL *s) 1135. { 1136. int i; ssl/ssl_lib.c:1209:5: Call 1207. s->method->ssl_free(s); 1208. 1209. SSL_CTX_free(s->ctx); ^ 1210. 1211. ASYNC_WAIT_CTX_free(s->waitctx); ssl/ssl_lib.c:3103:1: Parameter `a->sessions->num_nodes` 3101. } 3102. 3103. > void SSL_CTX_free(SSL_CTX *a) 3104. { 3105. int i; ssl/ssl_lib.c:3129:9: Call 3127. */ 3128. if (a->sessions != NULL) 3129. SSL_CTX_flush_sessions(a, 0); ^ 3130. 3131. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:1106:1: Parameter `s->sessions->num_nodes` 1104. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1105. 1106. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 1107. { 1108. unsigned long i; ssl/ssl_sess.c:1119:5: Call 1117. i = lh_SSL_SESSION_get_down_load(s->sessions); 1118. lh_SSL_SESSION_set_down_load(s->sessions, 0); 1119. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp); ^ 1120. lh_SSL_SESSION_set_down_load(s->sessions, i); 1121. CRYPTO_THREAD_unlock(s->lock); ssl/ssl_sess.c:1104:1: Parameter `lh->num_nodes` 1102. } 1103. 1104. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1105. 1106. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) ssl/ssl_sess.c:1104:1: Call 1102. } 1103. 1104. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1105. 1106. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) crypto/lhash/lhash.c:209:1: Parameter `lh->num_nodes` 207. } 208. 209. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 210. { 211. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); crypto/lhash/lhash.c:211:5: Call 209. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 210. { 211. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); ^ 212. } 213. crypto/lhash/lhash.c:177:1: <LHS trace> 175. } 176. 177. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 178. OPENSSL_LH_DOALL_FUNC func, 179. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:177:1: Parameter `lh->num_nodes` 175. } 176. 177. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 178. OPENSSL_LH_DOALL_FUNC func, 179. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:191:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `SSL_free` 189. * memory leaks otherwise 190. */ 191. for (i = lh->num_nodes - 1; i >= 0; i--) { ^ 192. a = lh->b[i]; 193. while (a != NULL) {
https://github.com/openssl/openssl/blob/6e94b5aecd619afd25e3dc25902952b1b3194edf/crypto/lhash/lhash.c/#L191
d2a_code_trace_data_44682
static ngx_int_t ngx_http_ssi_body_filter(ngx_http_request_t *r, ngx_chain_t *in) { size_t len; ngx_int_t rc; ngx_buf_t *b; ngx_uint_t i, index; ngx_chain_t *cl, **ll; ngx_table_elt_t *param; ngx_http_ssi_ctx_t *ctx, *mctx; ngx_http_ssi_block_t *bl; ngx_http_ssi_param_t *prm; ngx_http_ssi_command_t *cmd; ngx_http_ssi_loc_conf_t *slcf; ngx_http_ssi_main_conf_t *smcf; ngx_str_t *params[NGX_HTTP_SSI_MAX_PARAMS + 1]; ctx = ngx_http_get_module_ctx(r, ngx_http_ssi_filter_module); if (ctx == NULL || (in == NULL && ctx->buf == NULL && ctx->in == NULL && ctx->busy == NULL)) { return ngx_http_next_body_filter(r, in); } if (in) { if (ngx_chain_add_copy(r->pool, &ctx->in, in) != NGX_OK) { return NGX_ERROR; } } ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "http ssi filter \"%V?%V\"", &r->uri, &r->args); if (ctx->wait) { if (r != r->connection->data) { ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "http ssi filter wait \"%V?%V\" non-active", &ctx->wait->uri, &ctx->wait->args); return NGX_AGAIN; } if (ctx->wait->done) { ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "http ssi filter wait \"%V?%V\" done", &ctx->wait->uri, &ctx->wait->args); ctx->wait = NULL; } else { ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "http ssi filter wait \"%V?%V\"", &ctx->wait->uri, &ctx->wait->args); return ngx_http_next_body_filter(r, NULL); } } slcf = ngx_http_get_module_loc_conf(r, ngx_http_ssi_filter_module); while (ctx->in || ctx->buf) { if (ctx->buf == NULL) { ctx->buf = ctx->in->buf; ctx->in = ctx->in->next; ctx->pos = ctx->buf->pos; } if (ctx->state == ssi_start_state) { ctx->copy_start = ctx->pos; ctx->copy_end = ctx->pos; } b = NULL; while (ctx->pos < ctx->buf->last) { ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "saved: %uz state: %ui", ctx->saved, ctx->state); rc = ngx_http_ssi_parse(r, ctx); ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "parse: %i, looked: %uz %p-%p", rc, ctx->looked, ctx->copy_start, ctx->copy_end); if (rc == NGX_ERROR) { return rc; } if (ctx->copy_start != ctx->copy_end) { if (ctx->output) { ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "saved: %uz", ctx->saved); if (ctx->saved) { if (ctx->free) { cl = ctx->free; ctx->free = ctx->free->next; b = cl->buf; ngx_memzero(b, sizeof(ngx_buf_t)); } else { b = ngx_calloc_buf(r->pool); if (b == NULL) { return NGX_ERROR; } cl = ngx_alloc_chain_link(r->pool); if (cl == NULL) { return NGX_ERROR; } cl->buf = b; } b->memory = 1; b->pos = ngx_http_ssi_string; b->last = ngx_http_ssi_string + ctx->saved; *ctx->last_out = cl; ctx->last_out = &cl->next; ctx->saved = 0; } if (ctx->free) { cl = ctx->free; ctx->free = ctx->free->next; b = cl->buf; } else { b = ngx_alloc_buf(r->pool); if (b == NULL) { return NGX_ERROR; } cl = ngx_alloc_chain_link(r->pool); if (cl == NULL) { return NGX_ERROR; } cl->buf = b; } ngx_memcpy(b, ctx->buf, sizeof(ngx_buf_t)); b->pos = ctx->copy_start; b->last = ctx->copy_end; b->shadow = NULL; b->last_buf = 0; b->recycled = 0; if (b->in_file) { if (slcf->min_file_chunk < (size_t) (b->last - b->pos)) { b->file_last = b->file_pos + (b->last - ctx->buf->pos); b->file_pos += b->pos - ctx->buf->pos; } else { b->in_file = 0; } } cl->next = NULL; *ctx->last_out = cl; ctx->last_out = &cl->next; } else { if (ctx->block && ctx->saved + (ctx->copy_end - ctx->copy_start)) { b = ngx_create_temp_buf(r->pool, ctx->saved + (ctx->copy_end - ctx->copy_start)); if (b == NULL) { return NGX_ERROR; } if (ctx->saved) { b->last = ngx_cpymem(b->pos, ngx_http_ssi_string, ctx->saved); } b->last = ngx_cpymem(b->last, ctx->copy_start, ctx->copy_end - ctx->copy_start); cl = ngx_alloc_chain_link(r->pool); if (cl == NULL) { return NGX_ERROR; } cl->buf = b; cl->next = NULL; b = NULL; mctx = ngx_http_get_module_ctx(r->main, ngx_http_ssi_filter_module); bl = mctx->blocks->elts; for (ll = &bl[mctx->blocks->nelts - 1].bufs; *ll; ll = &(*ll)->next) { } *ll = cl; } ctx->saved = 0; } } if (ctx->state == ssi_start_state) { ctx->copy_start = ctx->pos; ctx->copy_end = ctx->pos; } else { ctx->copy_start = NULL; ctx->copy_end = NULL; } if (rc == NGX_AGAIN) { continue; } b = NULL; if (rc == NGX_OK) { smcf = ngx_http_get_module_main_conf(r, ngx_http_ssi_filter_module); cmd = ngx_hash_find(&smcf->hash, ctx->key, ctx->command.data, ctx->command.len); if (cmd == NULL) { if (ctx->output) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "invalid SSI command: \"%V\"", &ctx->command); goto ssi_error; } continue; } if (!ctx->output && !cmd->block) { if (ctx->block) { len = 5 + ctx->command.len + 4; param = ctx->params.elts; for (i = 0; i < ctx->params.nelts; i++) { len += 1 + param[i].key.len + 2 + param[i].value.len + 1; } b = ngx_create_temp_buf(r->pool, len); if (b == NULL) { return NGX_ERROR; } cl = ngx_alloc_chain_link(r->pool); if (cl == NULL) { return NGX_ERROR; } cl->buf = b; cl->next = NULL; *b->last++ = '<'; *b->last++ = '!'; *b->last++ = '-'; *b->last++ = '-'; *b->last++ = '#'; b->last = ngx_cpymem(b->last, ctx->command.data, ctx->command.len); for (i = 0; i < ctx->params.nelts; i++) { *b->last++ = ' '; b->last = ngx_cpymem(b->last, param[i].key.data, param[i].key.len); *b->last++ = '='; *b->last++ = '"'; b->last = ngx_cpymem(b->last, param[i].value.data, param[i].value.len); *b->last++ = '"'; } *b->last++ = ' '; *b->last++ = '-'; *b->last++ = '-'; *b->last++ = '>'; mctx = ngx_http_get_module_ctx(r->main, ngx_http_ssi_filter_module); bl = mctx->blocks->elts; for (ll = &bl[mctx->blocks->nelts - 1].bufs; *ll; ll = &(*ll)->next) { } *ll = cl; b = NULL; continue; } if (cmd->conditional == 0) { continue; } } if (cmd->conditional && (ctx->conditional == 0 || ctx->conditional > cmd->conditional)) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "invalid context of SSI command: \"%V\"", &ctx->command); goto ssi_error; } if (ctx->params.nelts > NGX_HTTP_SSI_MAX_PARAMS) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "too many SSI command parameters: \"%V\"", &ctx->command); goto ssi_error; } ngx_memzero(params, (NGX_HTTP_SSI_MAX_PARAMS + 1) * sizeof(ngx_str_t *)); param = ctx->params.elts; for (i = 0; i < ctx->params.nelts; i++) { for (prm = cmd->params; prm->name.len; prm++) { if (param[i].key.len != prm->name.len || ngx_strncmp(param[i].key.data, prm->name.data, prm->name.len) != 0) { continue; } if (!prm->multiple) { if (params[prm->index]) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "duplicate \"%V\" parameter " "in \"%V\" SSI command", &param[i].key, &ctx->command); goto ssi_error; } params[prm->index] = &param[i].value; break; } for (index = prm->index; params[index]; index++) { } params[index] = &param[i].value; break; } if (prm->name.len == 0) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "invalid parameter name: \"%V\" " "in \"%V\" SSI command", &param[i].key, &ctx->command); goto ssi_error; } } for (prm = cmd->params; prm->name.len; prm++) { if (prm->mandatory && params[prm->index] == 0) { ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, "mandatory \"%V\" parameter is absent " "in \"%V\" SSI command", &prm->name, &ctx->command); goto ssi_error; } } if (cmd->flush && ctx->out) { ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "ssi flush"); if (ngx_http_ssi_output(r, ctx) == NGX_ERROR) { return NGX_ERROR; } } rc = cmd->handler(r, ctx, params); if (rc == NGX_OK) { continue; } if (rc == NGX_DONE || rc == NGX_AGAIN || rc == NGX_ERROR) { ngx_http_ssi_buffered(r, ctx); return rc; } } ssi_error: if (slcf->silent_errors) { continue; } if (ctx->free) { cl = ctx->free; ctx->free = ctx->free->next; b = cl->buf; ngx_memzero(b, sizeof(ngx_buf_t)); } else { b = ngx_calloc_buf(r->pool); if (b == NULL) { return NGX_ERROR; } cl = ngx_alloc_chain_link(r->pool); if (cl == NULL) { return NGX_ERROR; } cl->buf = b; } b->memory = 1; b->pos = ctx->errmsg.data; b->last = ctx->errmsg.data + ctx->errmsg.len; cl->next = NULL; *ctx->last_out = cl; ctx->last_out = &cl->next; continue; } if (ctx->buf->last_buf || ngx_buf_in_memory(ctx->buf)) { if (b == NULL) { if (ctx->free) { cl = ctx->free; ctx->free = ctx->free->next; b = cl->buf; ngx_memzero(b, sizeof(ngx_buf_t)); } else { b = ngx_calloc_buf(r->pool); if (b == NULL) { return NGX_ERROR; } cl = ngx_alloc_chain_link(r->pool); if (cl == NULL) { return NGX_ERROR; } cl->buf = b; } b->sync = 1; cl->next = NULL; *ctx->last_out = cl; ctx->last_out = &cl->next; } b->last_buf = ctx->buf->last_buf; b->shadow = ctx->buf; if (slcf->ignore_recycled_buffers == 0) { b->recycled = ctx->buf->recycled; } } ctx->buf = NULL; ctx->saved = ctx->looked; } if (ctx->out == NULL && ctx->busy == NULL) { return NGX_OK; } return ngx_http_ssi_output(r, ctx); } src/http/modules/ngx_http_ssi_filter_module.c:579: error: Buffer Overrun L3 Offset added: [1, +oo] Size: [0, +oo]. src/http/modules/ngx_http_ssi_filter_module.c:521:25: <Offset trace> 519. ctx->last_out = &cl->next; 520. 521. ctx->saved = 0; ^ 522. } 523. src/http/modules/ngx_http_ssi_filter_module.c:521:25: Assignment 519. ctx->last_out = &cl->next; 520. 521. ctx->saved = 0; ^ 522. } 523. src/http/modules/ngx_http_ssi_filter_module.c:475:18: Call 473. "saved: %uz state: %ui", ctx->saved, ctx->state); 474. 475. rc = ngx_http_ssi_parse(r, ctx); ^ 476. 477. ngx_log_debug4(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, src/http/modules/ngx_http_ssi_filter_module.c:990:1: Parameter `ctx->saved` 988. 989. 990. static ngx_int_t ^ 991. ngx_http_ssi_parse(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx) 992. { src/http/modules/ngx_http_ssi_filter_module.c:515:25: <Length trace> 513. 514. b->memory = 1; 515. b->pos = ngx_http_ssi_string; ^ 516. b->last = ngx_http_ssi_string + ctx->saved; 517. src/http/modules/ngx_http_ssi_filter_module.c:515:25: Assignment 513. 514. b->memory = 1; 515. b->pos = ngx_http_ssi_string; ^ 516. b->last = ngx_http_ssi_string + ctx->saved; 517. src/http/modules/ngx_http_ssi_filter_module.c:579:39: Array access: Offset added: [1, +oo] Size: [0, +oo] 577. 578. if (ctx->saved) { 579. b->last = ngx_cpymem(b->pos, ngx_http_ssi_string, ^ 580. ctx->saved); 581. }
https://github.com/nginx/nginx/blob/dac90a4bff8404e8097249a1ee444b77580f43ba/src/http/modules/ngx_http_ssi_filter_module.c/#L579
d2a_code_trace_data_44683
static int vc1_decode_p_mb(VC1Context *v) { MpegEncContext *s = &v->s; GetBitContext *gb = &s->gb; int i, j; int mb_pos = s->mb_x + s->mb_y * s->mb_stride; int cbp; int mqdiff, mquant; int ttmb = v->ttfrm; int status; static const int size_table[6] = { 0, 2, 3, 4, 5, 8 }, offset_table[6] = { 0, 1, 3, 7, 15, 31 }; int mb_has_coeffs = 1; int dmv_x, dmv_y; int index, index1; int val, sign; int first_block = 1; int dst_idx, off; int skipped, fourmv; mquant = v->pq; if (v->mv_type_is_raw) fourmv = get_bits1(gb); else fourmv = v->mv_type_mb_plane[mb_pos]; if (v->skip_is_raw) skipped = get_bits1(gb); else skipped = v->s.mbskip_table[mb_pos]; s->dsp.clear_blocks(s->block[0]); if (!fourmv) { if (!skipped) { GET_MVDATA(dmv_x, dmv_y); if (s->mb_intra) { s->current_picture.motion_val[1][s->block_index[0]][0] = 0; s->current_picture.motion_val[1][s->block_index[0]][1] = 0; } s->current_picture.mb_type[mb_pos] = s->mb_intra ? MB_TYPE_INTRA : MB_TYPE_16x16; vc1_pred_mv(s, 0, dmv_x, dmv_y, 1, v->range_x, v->range_y, v->mb_type[0]); if (s->mb_intra && !mb_has_coeffs) { GET_MQUANT(); s->ac_pred = get_bits1(gb); cbp = 0; } else if (mb_has_coeffs) { if (s->mb_intra) s->ac_pred = get_bits1(gb); cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); GET_MQUANT(); } else { mquant = v->pq; cbp = 0; } s->current_picture.qscale_table[mb_pos] = mquant; if (!v->ttmbf && !s->mb_intra && mb_has_coeffs) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); if(!s->mb_intra) vc1_mc_1mv(v, 0); dst_idx = 0; for (i=0; i<6; i++) { s->dc_val[0][s->block_index[i]] = 0; dst_idx += i >> 2; val = ((cbp >> (5 - i)) & 1); off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); v->mb_type[0][s->block_index[i]] = s->mb_intra; if(s->mb_intra) { v->a_avail = v->c_avail = 0; if(i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; if(i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; vc1_decode_intra_block(v, s->block[i], i, val, mquant, (i&4)?v->codingset2:v->codingset); if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; s->dsp.vc1_inv_trans_8x8(s->block[i]); if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); if(v->pq >= 9 && v->overlap) { if(v->c_avail) s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); if(v->a_avail) s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); } } else if(val) { vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY)); if(!v->ttmbf && ttmb < 8) ttmb = -1; first_block = 0; } } } else { s->mb_intra = 0; for(i = 0; i < 6; i++) { v->mb_type[0][s->block_index[i]] = 0; s->dc_val[0][s->block_index[i]] = 0; } s->current_picture.mb_type[mb_pos] = MB_TYPE_SKIP; s->current_picture.qscale_table[mb_pos] = 0; vc1_pred_mv(s, 0, 0, 0, 1, v->range_x, v->range_y, v->mb_type[0]); vc1_mc_1mv(v, 0); return 0; } } else { if (!skipped ) { int intra_count = 0, coded_inter = 0; int is_intra[6], is_coded[6]; cbp = get_vlc2(&v->s.gb, v->cbpcy_vlc->table, VC1_CBPCY_P_VLC_BITS, 2); for (i=0; i<6; i++) { val = ((cbp >> (5 - i)) & 1); s->dc_val[0][s->block_index[i]] = 0; s->mb_intra = 0; if(i < 4) { dmv_x = dmv_y = 0; s->mb_intra = 0; mb_has_coeffs = 0; if(val) { GET_MVDATA(dmv_x, dmv_y); } vc1_pred_mv(s, i, dmv_x, dmv_y, 0, v->range_x, v->range_y, v->mb_type[0]); if(!s->mb_intra) vc1_mc_4mv_luma(v, i); intra_count += s->mb_intra; is_intra[i] = s->mb_intra; is_coded[i] = mb_has_coeffs; } if(i&4){ is_intra[i] = (intra_count >= 3); is_coded[i] = val; } if(i == 4) vc1_mc_4mv_chroma(v); v->mb_type[0][s->block_index[i]] = is_intra[i]; if(!coded_inter) coded_inter = !is_intra[i] & is_coded[i]; } if(!intra_count && !coded_inter) return 0; dst_idx = 0; GET_MQUANT(); s->current_picture.qscale_table[mb_pos] = mquant; { int intrapred = 0; for(i=0; i<6; i++) if(is_intra[i]) { if(((!s->first_slice_line || (i==2 || i==3)) && v->mb_type[0][s->block_index[i] - s->block_wrap[i]]) || ((s->mb_x || (i==1 || i==3)) && v->mb_type[0][s->block_index[i] - 1])) { intrapred = 1; break; } } if(intrapred)s->ac_pred = get_bits1(gb); else s->ac_pred = 0; } if (!v->ttmbf && coded_inter) ttmb = get_vlc2(gb, ff_vc1_ttmb_vlc[v->tt_index].table, VC1_TTMB_VLC_BITS, 2); for (i=0; i<6; i++) { dst_idx += i >> 2; off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); s->mb_intra = is_intra[i]; if (is_intra[i]) { v->a_avail = v->c_avail = 0; if(i == 2 || i == 3 || !s->first_slice_line) v->a_avail = v->mb_type[0][s->block_index[i] - s->block_wrap[i]]; if(i == 1 || i == 3 || s->mb_x) v->c_avail = v->mb_type[0][s->block_index[i] - 1]; vc1_decode_intra_block(v, s->block[i], i, is_coded[i], mquant, (i&4)?v->codingset2:v->codingset); if((i>3) && (s->flags & CODEC_FLAG_GRAY)) continue; s->dsp.vc1_inv_trans_8x8(s->block[i]); if(v->rangeredfrm) for(j = 0; j < 64; j++) s->block[i][j] <<= 1; s->dsp.put_signed_pixels_clamped(s->block[i], s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize); if(v->pq >= 9 && v->overlap) { if(v->c_avail) s->dsp.vc1_h_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); if(v->a_avail) s->dsp.vc1_v_overlap(s->dest[dst_idx] + off, s->linesize >> ((i & 4) >> 2)); } } else if(is_coded[i]) { status = vc1_decode_p_block(v, s->block[i], i, mquant, ttmb, first_block, s->dest[dst_idx] + off, (i&4)?s->uvlinesize:s->linesize, (i&4) && (s->flags & CODEC_FLAG_GRAY)); if(!v->ttmbf && ttmb < 8) ttmb = -1; first_block = 0; } } return status; } else { s->mb_intra = 0; s->current_picture.qscale_table[mb_pos] = 0; for (i=0; i<6; i++) { v->mb_type[0][s->block_index[i]] = 0; s->dc_val[0][s->block_index[i]] = 0; } for (i=0; i<4; i++) { vc1_pred_mv(s, i, 0, 0, 0, v->range_x, v->range_y, v->mb_type[0]); vc1_mc_4mv_luma(v, i); } vc1_mc_4mv_chroma(v); s->current_picture.qscale_table[mb_pos] = 0; return 0; } } return -1; } libavcodec/vc1.c:3184: error: Uninitialized Value The value read from is_intra[_] was never initialized. libavcodec/vc1.c:3184:21: 3182. off = (i & 4) ? 0 : ((i & 1) * 8 + (i & 2) * 4 * s->linesize); 3183. s->mb_intra = is_intra[i]; 3184. if (is_intra[i]) { ^ 3185. /* check if prediction blocks A and C are available */ 3186. v->a_avail = v->c_avail = 0;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vc1.c/#L3184
d2a_code_trace_data_44684
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_chk.c:92: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mul`. Showing all 25 steps of the trace crypto/rsa/rsa_chk.c:65:9: Call 63. 64. /* p prime? */ 65. if (BN_is_prime_ex(key->p, BN_prime_checks, NULL, cb) != 1) { ^ 66. ret = 0; 67. RSAerr(RSA_F_RSA_CHECK_KEY_EX, RSA_R_P_NOT_PRIME); crypto/bn/bn_prime.c:145:1: Parameter `ctx_passed->stack.depth` 143. } 144. 145. > int BN_is_prime_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 146. BN_GENCB *cb) 147. { crypto/bn/bn_prime.c:148:12: Call 146. BN_GENCB *cb) 147. { 148. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb); ^ 149. } 150. crypto/bn/bn_prime.c:151:1: Parameter `ctx_passed->stack.depth` 149. } 150. 151. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 152. int do_trial_division, BN_GENCB *cb) 153. { crypto/rsa/rsa_chk.c:71:9: Call 69. 70. /* q prime? */ 71. if (BN_is_prime_ex(key->q, BN_prime_checks, NULL, cb) != 1) { ^ 72. ret = 0; 73. RSAerr(RSA_F_RSA_CHECK_KEY_EX, RSA_R_Q_NOT_PRIME); crypto/bn/bn_prime.c:145:1: Parameter `ctx_passed->stack.depth` 143. } 144. 145. > int BN_is_prime_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 146. BN_GENCB *cb) 147. { crypto/bn/bn_prime.c:148:12: Call 146. BN_GENCB *cb) 147. { 148. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb); ^ 149. } 150. crypto/bn/bn_prime.c:151:1: Parameter `ctx_passed->stack.depth` 149. } 150. 151. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 152. int do_trial_division, BN_GENCB *cb) 153. { crypto/rsa/rsa_chk.c:86:10: Call 84. 85. /* n = p*q * r_3...r_i? */ 86. if (!BN_mul(i, key->p, key->q, ctx)) { ^ 87. ret = -1; 88. 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:92:14: Call 90. for (idx = 0; idx < ex_primes; idx++) { 91. pinfo = sk_RSA_PRIME_INFO_value(key->prime_infos, idx); 92. if (!BN_mul(i, i, pinfo->r, ctx)) { ^ 93. ret = -1; 94. 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:533:5: Call 531. top = al + bl; 532. 533. BN_CTX_start(ctx); ^ 534. if ((r == a) || (r == b)) { 535. if ((rr = BN_CTX_get(ctx)) == NULL) crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_mul.c:618:5: Call 616. err: 617. bn_check_top(r); 618. BN_CTX_end(ctx); ^ 619. return ret; 620. } crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mul` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_44685
static unsigned long get_error_values(int inc, int top, const char **file, int *line, const char **data, int *flags) { int i = 0; ERR_STATE *es; unsigned long ret; es = ERR_get_state(); if (es == NULL) return 0; if (inc && top) { if (file) *file = ""; if (line) *line = 0; if (data) *data = ""; if (flags) *flags = 0; return ERR_R_INTERNAL_ERROR; } if (es->bottom == es->top) return 0; if (top) i = es->top; else i = (es->bottom + 1) % ERR_NUM_ERRORS; ret = es->err_buffer[i]; if (inc) { es->bottom = i; es->err_buffer[i] = 0; } if (file != NULL && line != NULL) { if (es->err_file[i] == NULL) { *file = "NA"; *line = 0; } else { *file = es->err_file[i]; *line = es->err_line[i]; } } if (data == NULL) { if (inc) { err_clear_data(es, i); } } else { if (es->err_data[i] == NULL) { *data = ""; if (flags != NULL) *flags = 0; } else { *data = es->err_data[i]; if (flags != NULL) *flags = es->err_data_flags[i]; } } return ret; } crypto/err/err.c:479: error: MEMORY_LEAK memory dynamically allocated by call to `ERR_get_state()` at line 474, column 10 is not reachable after line 479, column 13. Showing all 51 steps of the trace crypto/err/err.c:466:1: start of procedure get_error_values() 464. } 465. 466. > static unsigned long get_error_values(int inc, int top, const char **file, 467. int *line, const char **data, 468. int *flags) crypto/err/err.c:470:5: 468. int *flags) 469. { 470. > int i = 0; 471. ERR_STATE *es; 472. unsigned long ret; crypto/err/err.c:474:5: 472. unsigned long ret; 473. 474. > es = ERR_get_state(); 475. if (es == NULL) 476. return 0; crypto/err/err.c:662:1: start of procedure ERR_get_state() 660. } 661. 662. > ERR_STATE *ERR_get_state(void) 663. { 664. ERR_STATE *state = NULL; crypto/err/err.c:664:5: 662. ERR_STATE *ERR_get_state(void) 663. { 664. > ERR_STATE *state = NULL; 665. 666. if (!RUN_ONCE(&err_init, err_do_init)) crypto/err/err.c:666:10: 664. ERR_STATE *state = NULL; 665. 666. > if (!RUN_ONCE(&err_init, err_do_init)) 667. return NULL; 668. crypto/threads_pthread.c:105:1: start of procedure CRYPTO_THREAD_run_once() 103. } 104. 105. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 106. { 107. if (pthread_once(once, init) != 0) crypto/threads_pthread.c:107:9: Taking false branch 105. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 106. { 107. if (pthread_once(once, init) != 0) ^ 108. return 0; 109. crypto/threads_pthread.c:110:5: 108. return 0; 109. 110. > return 1; 111. } 112. crypto/threads_pthread.c:111:1: return from a call to CRYPTO_THREAD_run_once 109. 110. return 1; 111. > } 112. 113. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)) crypto/err/err.c:666:10: Condition is true 664. ERR_STATE *state = NULL; 665. 666. if (!RUN_ONCE(&err_init, err_do_init)) ^ 667. return NULL; 668. crypto/err/err.c:666:10: Taking false branch 664. ERR_STATE *state = NULL; 665. 666. if (!RUN_ONCE(&err_init, err_do_init)) ^ 667. return NULL; 668. crypto/err/err.c:674:10: Taking false branch 672. * Needed on any platform that doesn't define OPENSSL_USE_NODELETE. 673. */ 674. if (!OPENSSL_init_crypto(0, NULL)) ^ 675. return NULL; 676. crypto/err/err.c:677:5: 675. return NULL; 676. 677. > state = CRYPTO_THREAD_get_local(&err_thread_local); 678. 679. if (state == NULL) { crypto/threads_pthread.c:121:1: start of procedure CRYPTO_THREAD_get_local() 119. } 120. 121. > void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key) 122. { 123. return pthread_getspecific(*key); crypto/threads_pthread.c:123:5: Skipping pthread_getspecific(): method has no implementation 121. void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key) 122. { 123. return pthread_getspecific(*key); ^ 124. } 125. crypto/threads_pthread.c:124:1: return from a call to CRYPTO_THREAD_get_local 122. { 123. return pthread_getspecific(*key); 124. > } 125. 126. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) crypto/err/err.c:679:9: Taking true branch 677. state = CRYPTO_THREAD_get_local(&err_thread_local); 678. 679. if (state == NULL) { ^ 680. state = OPENSSL_zalloc(sizeof(*state)); 681. if (state == NULL) crypto/err/err.c:680:9: 678. 679. if (state == NULL) { 680. > state = OPENSSL_zalloc(sizeof(*state)); 681. if (state == NULL) 682. return NULL; crypto/mem.c:228:1: start of procedure CRYPTO_zalloc() 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:5: 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. > void *ret = CRYPTO_malloc(num, file, line); 231. 232. FAILTEST(); crypto/mem.c:192:1: start of procedure CRYPTO_malloc() 190. #endif 191. 192. > void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. void *ret = NULL; crypto/mem.c:194:5: 192. void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. > void *ret = NULL; 195. 196. INCREMENT(malloc_count); crypto/mem.c:197:9: Taking false branch 195. 196. INCREMENT(malloc_count); 197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 198. return malloc_impl(num, file, line); 199. crypto/mem.c:200:9: Taking false branch 198. return malloc_impl(num, file, line); 199. 200. if (num == 0) ^ 201. return NULL; 202. crypto/mem.c:204:9: Taking true branch 202. 203. FAILTEST(); 204. if (allow_customize) { ^ 205. /* 206. * Disallow customization after the first allocation. We only set this crypto/mem.c:210:9: 208. * allocation. 209. */ 210. > allow_customize = 0; 211. } 212. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:221:5: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:221:19: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:222:5: 220. #else 221. (void)(file); (void)(line); 222. > ret = malloc(num); 223. #endif 224. crypto/mem.c:225:5: 223. #endif 224. 225. > return ret; 226. } 227. crypto/mem.c:226:1: return from a call to CRYPTO_malloc 224. 225. return ret; 226. > } 227. 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:233:9: Taking true branch 231. 232. FAILTEST(); 233. if (ret != NULL) ^ 234. memset(ret, 0, num); 235. return ret; crypto/mem.c:234:9: 232. FAILTEST(); 233. if (ret != NULL) 234. > memset(ret, 0, num); 235. return ret; 236. } crypto/mem.c:235:5: 233. if (ret != NULL) 234. memset(ret, 0, num); 235. > return ret; 236. } 237. crypto/mem.c:236:1: return from a call to CRYPTO_zalloc 234. memset(ret, 0, num); 235. return ret; 236. > } 237. 238. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/err/err.c:681:13: Taking false branch 679. if (state == NULL) { 680. state = OPENSSL_zalloc(sizeof(*state)); 681. if (state == NULL) ^ 682. return NULL; 683. crypto/err/err.c:684:14: Taking false branch 682. return NULL; 683. 684. if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE) ^ 685. || !CRYPTO_THREAD_set_local(&err_thread_local, state)) { 686. ERR_STATE_free(state); crypto/err/err.c:685:17: 683. 684. if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE) 685. > || !CRYPTO_THREAD_set_local(&err_thread_local, state)) { 686. ERR_STATE_free(state); 687. return NULL; crypto/threads_pthread.c:126:1: start of procedure CRYPTO_THREAD_set_local() 124. } 125. 126. > int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) 127. { 128. if (pthread_setspecific(*key, val) != 0) crypto/threads_pthread.c:128:9: Taking false branch 126. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) 127. { 128. if (pthread_setspecific(*key, val) != 0) ^ 129. return 0; 130. crypto/threads_pthread.c:131:5: 129. return 0; 130. 131. > return 1; 132. } 133. crypto/threads_pthread.c:132:1: return from a call to CRYPTO_THREAD_set_local 130. 131. return 1; 132. > } 133. 134. int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key) crypto/err/err.c:685:17: Taking false branch 683. 684. if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE) 685. || !CRYPTO_THREAD_set_local(&err_thread_local, state)) { ^ 686. ERR_STATE_free(state); 687. return NULL; crypto/err/err.c:691:9: Skipping OPENSSL_init_crypto(): empty list of specs 689. 690. /* Ignore failures from these */ 691. OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL); ^ 692. } 693. crypto/err/err.c:694:5: 692. } 693. 694. > return state; 695. } 696. crypto/err/err.c:695:1: return from a call to ERR_get_state 693. 694. return state; 695. > } 696. 697. int ERR_get_next_error_library(void) crypto/err/err.c:475:9: Taking false branch 473. 474. es = ERR_get_state(); 475. if (es == NULL) ^ 476. return 0; 477. crypto/err/err.c:478:9: Taking true branch 476. return 0; 477. 478. if (inc && top) { ^ 479. if (file) 480. *file = ""; crypto/err/err.c:478:16: Taking true branch 476. return 0; 477. 478. if (inc && top) { ^ 479. if (file) 480. *file = ""; crypto/err/err.c:479:13: Taking false branch 477. 478. if (inc && top) { 479. if (file) ^ 480. *file = ""; 481. if (line)
https://github.com/openssl/openssl/blob/f770d75b1cac264d6280ec7326277daff6965cbb/crypto/err/err.c/#L479
d2a_code_trace_data_44686
static int encode_test_init(EVP_TEST *t, const char *encoding) { ENCODE_DATA *edata = OPENSSL_zalloc(sizeof(*edata)); if (strcmp(encoding, "canonical") == 0) { edata->encoding = BASE64_CANONICAL_ENCODING; } else if (strcmp(encoding, "valid") == 0) { edata->encoding = BASE64_VALID_ENCODING; } else if (strcmp(encoding, "invalid") == 0) { edata->encoding = BASE64_INVALID_ENCODING; t->expected_err = OPENSSL_strdup("DECODE_ERROR"); if (t->expected_err == NULL) return 0; } else { TEST_info("Bad encoding: %s. Should be one of " "{canonical, valid, invalid}", encoding); return 0; } t->data = edata; return 1; } test/evp_test.c:1765: error: NULL_DEREFERENCE pointer `edata` last assigned on line 1760 could be null and is dereferenced at line 1765, column 9. Showing all 16 steps of the trace test/evp_test.c:1758:1: start of procedure encode_test_init() 1756. } ENCODE_DATA; 1757. 1758. > static int encode_test_init(EVP_TEST *t, const char *encoding) 1759. { 1760. ENCODE_DATA *edata = OPENSSL_zalloc(sizeof(*edata)); test/evp_test.c:1760:5: 1758. static int encode_test_init(EVP_TEST *t, const char *encoding) 1759. { 1760. > ENCODE_DATA *edata = OPENSSL_zalloc(sizeof(*edata)); 1761. 1762. if (strcmp(encoding, "canonical") == 0) { crypto/mem.c:186:1: start of procedure CRYPTO_zalloc() 184. } 185. 186. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:188:5: 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. > void *ret = CRYPTO_malloc(num, file, line); 189. 190. FAILTEST(); crypto/mem.c:158:1: start of procedure CRYPTO_malloc() 156. #endif 157. 158. > void *CRYPTO_malloc(size_t num, const char *file, int line) 159. { 160. void *ret = NULL; crypto/mem.c:160:5: 158. void *CRYPTO_malloc(size_t num, const char *file, int line) 159. { 160. > void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:162:9: Taking true branch 160. void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 163. return malloc_impl(num, file, line); 164. crypto/mem.c:162:32: Taking true branch 160. void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 163. return malloc_impl(num, file, line); 164. crypto/mem.c:163:9: Skipping __function_pointer__(): unresolved function pointer 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) 163. return malloc_impl(num, file, line); ^ 164. 165. if (num == 0) crypto/mem.c:184:1: return from a call to CRYPTO_malloc 182. 183. return ret; 184. > } 185. 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:191:9: Taking false branch 189. 190. FAILTEST(); 191. if (ret != NULL) ^ 192. memset(ret, 0, num); 193. return ret; crypto/mem.c:193:5: 191. if (ret != NULL) 192. memset(ret, 0, num); 193. > return ret; 194. } 195. crypto/mem.c:194:1: return from a call to CRYPTO_zalloc 192. memset(ret, 0, num); 193. return ret; 194. > } 195. 196. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) test/evp_test.c:1762:9: Taking false branch 1760. ENCODE_DATA *edata = OPENSSL_zalloc(sizeof(*edata)); 1761. 1762. if (strcmp(encoding, "canonical") == 0) { ^ 1763. edata->encoding = BASE64_CANONICAL_ENCODING; 1764. } else if (strcmp(encoding, "valid") == 0) { test/evp_test.c:1764:16: Taking true branch 1762. if (strcmp(encoding, "canonical") == 0) { 1763. edata->encoding = BASE64_CANONICAL_ENCODING; 1764. } else if (strcmp(encoding, "valid") == 0) { ^ 1765. edata->encoding = BASE64_VALID_ENCODING; 1766. } else if (strcmp(encoding, "invalid") == 0) { test/evp_test.c:1765:9: 1763. edata->encoding = BASE64_CANONICAL_ENCODING; 1764. } else if (strcmp(encoding, "valid") == 0) { 1765. > edata->encoding = BASE64_VALID_ENCODING; 1766. } else if (strcmp(encoding, "invalid") == 0) { 1767. edata->encoding = BASE64_INVALID_ENCODING;
https://github.com/openssl/openssl/blob/69b4c01fd26e6eb72b156ed3014522c3295a7669/test/evp_test.c/#L1765
d2a_code_trace_data_44687
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); } apps/x509.c:786: error: BUFFER_OVERRUN_L3 Offset: [-529, +oo] Size: 12 by call to `ASN1_TIME_print`. Showing all 11 steps of the trace apps/x509.c:678:17: Call 676. goto end; 677. BN_free(bnser); 678. i2a_ASN1_INTEGER(out, ser); ^ 679. ASN1_INTEGER_free(ser); 680. BIO_puts(out, "\n"); crypto/asn1/f_int.c:64:1: Parameter `*a->data` 62. #include <openssl/asn1.h> 63. 64. > int i2a_ASN1_INTEGER(BIO *bp, ASN1_INTEGER *a) 65. { 66. int i, n = 0; apps/x509.c:786:17: Call 784. } else if (startdate == i) { 785. BIO_puts(out, "notBefore="); 786. ASN1_TIME_print(out, X509_get_notBefore(x)); ^ 787. BIO_puts(out, "\n"); 788. } else if (enddate == i) { crypto/asn1/a_time.c:202:1: Parameter `*tm->data` 200. } 201. 202. > int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm) 203. { 204. if (tm->type == V_ASN1_UTCTIME) crypto/asn1/a_time.c:207:16: Call 205. return ASN1_UTCTIME_print(bp, tm); 206. if (tm->type == V_ASN1_GENERALIZEDTIME) 207. return ASN1_GENERALIZEDTIME_print(bp, tm); ^ 208. BIO_write(bp, "Bad time value", 14); 209. return (0); 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_TIME_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/39e46af6bb3f1ad7f5c0dee8e3d13e2daf9a0160/crypto/asn1/a_gentm.c/#L308
d2a_code_trace_data_44688
static int opt_streamid(OptionsContext *o, const char *opt, const char *arg) { int idx; char *p; char idx_str[16]; av_strlcpy(idx_str, arg, sizeof(idx_str)); p = strchr(idx_str, ':'); if (!p) { av_log(NULL, AV_LOG_FATAL, "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", arg, opt); exit_program(1); } *p++ = '\0'; idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX); o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1); o->streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); return 0; } avconv.c:3732: error: Null Dereference pointer `p` last assigned on line 3732 could be null and is dereferenced at line 3732, column 5. avconv.c:3718:1: start of procedure opt_streamid() 3716. 3717. /* arg format is "output-stream-index:streamid-value". */ 3718. static int opt_streamid(OptionsContext *o, const char *opt, const char *arg) ^ 3719. { 3720. int idx; avconv.c:3724:5: 3722. char idx_str[16]; 3723. 3724. av_strlcpy(idx_str, arg, sizeof(idx_str)); ^ 3725. p = strchr(idx_str, ':'); 3726. if (!p) { 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) avconv.c:3725:5: 3723. 3724. av_strlcpy(idx_str, arg, sizeof(idx_str)); 3725. p = strchr(idx_str, ':'); ^ 3726. if (!p) { 3727. av_log(NULL, AV_LOG_FATAL, avconv.c:3726:10: Taking true branch 3724. av_strlcpy(idx_str, arg, sizeof(idx_str)); 3725. p = strchr(idx_str, ':'); 3726. if (!p) { ^ 3727. av_log(NULL, AV_LOG_FATAL, 3728. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", avconv.c:3727:9: Skipping av_log(): empty list of specs 3725. p = strchr(idx_str, ':'); 3726. if (!p) { 3727. av_log(NULL, AV_LOG_FATAL, ^ 3728. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", 3729. arg, opt); avconv.c:3730:9: Skipping exit_program(): empty list of specs 3728. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", 3729. arg, opt); 3730. exit_program(1); ^ 3731. } 3732. *p++ = '\0'; avconv.c:3732:5: 3730. exit_program(1); 3731. } 3732. *p++ = '\0'; ^ 3733. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX); 3734. o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1);
https://github.com/libav/libav/blob/e1e369049e3d2f88eed6ed38eb3dd704681c7f1a/avconv.c/#L3732
d2a_code_trace_data_44689
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:627: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_div`. Showing all 25 steps of the trace test/bntest.c:627:13: Call 625. BN_bntest_rand(c, 512, 0, 0); 626. for (j = 0; j < 2; j++) { 627. BN_GF2m_mod_div(d, a, c, b[j], ctx); ^ 628. BN_GF2m_mod_mul(e, d, c, b[j], ctx); 629. BN_GF2m_mod_div(f, a, e, b[j], ctx); crypto/bn/bn_gf2m.c:760:1: Parameter `ctx->stack.depth` 758. * or y, x could equal y. 759. */ 760. > int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *y, const BIGNUM *x, 761. const BIGNUM *p, BN_CTX *ctx) 762. { crypto/bn/bn_gf2m.c:770:5: Call 768. bn_check_top(p); 769. 770. BN_CTX_start(ctx); ^ 771. xinv = BN_CTX_get(ctx); 772. if (xinv == 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:783:5: Call 781. 782. err: 783. BN_CTX_end(ctx); ^ 784. return ret; 785. } 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:628:13: Call 626. for (j = 0; j < 2; j++) { 627. BN_GF2m_mod_div(d, a, c, b[j], ctx); 628. BN_GF2m_mod_mul(e, d, c, b[j], ctx); ^ 629. BN_GF2m_mod_div(f, a, e, b[j], ctx); 630. /* Test that ((a/c)*c)/a = 1. */ 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:629:13: Call 627. BN_GF2m_mod_div(d, a, c, b[j], ctx); 628. BN_GF2m_mod_mul(e, d, c, b[j], ctx); 629. BN_GF2m_mod_div(f, a, e, b[j], ctx); ^ 630. /* Test that ((a/c)*c)/a = 1. */ 631. if (!BN_is_one(f)) { crypto/bn/bn_gf2m.c:760:1: Parameter `ctx->stack.depth` 758. * or y, x could equal y. 759. */ 760. > int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *y, const BIGNUM *x, 761. const BIGNUM *p, BN_CTX *ctx) 762. { crypto/bn/bn_gf2m.c:770:5: Call 768. bn_check_top(p); 769. 770. BN_CTX_start(ctx); ^ 771. xinv = BN_CTX_get(ctx); 772. if (xinv == 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:783:5: Call 781. 782. err: 783. BN_CTX_end(ctx); ^ 784. return ret; 785. } 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:627:13: Call 625. BN_bntest_rand(c, 512, 0, 0); 626. for (j = 0; j < 2; j++) { 627. BN_GF2m_mod_div(d, a, c, b[j], ctx); ^ 628. BN_GF2m_mod_mul(e, d, c, b[j], ctx); 629. BN_GF2m_mod_div(f, a, e, b[j], ctx); crypto/bn/bn_gf2m.c:770:5: Call 768. bn_check_top(p); 769. 770. BN_CTX_start(ctx); ^ 771. xinv = BN_CTX_get(ctx); 772. if (xinv == 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_gf2m.c:783:5: Call 781. 782. err: 783. BN_CTX_end(ctx); ^ 784. return ret; 785. } 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_GF2m_mod_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/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_44690
static ngx_int_t ngx_http_post_action(ngx_http_request_t *r) { ngx_http_core_loc_conf_t *clcf; clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); if (clcf->post_action.data == NULL) { return NGX_DECLINED; } if (r->post_action && r->uri_changes == 0) { return NGX_DECLINED; } ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "post action: \"%V\"", &clcf->post_action); r->main->count--; r->http_version = NGX_HTTP_VERSION_9; r->header_only = 1; r->post_action = 1; r->read_event_handler = ngx_http_block_reading; if (clcf->post_action.data[0] == '/') { ngx_http_internal_redirect(r, &clcf->post_action, NULL); } else { ngx_http_named_location(r, &clcf->post_action); } return NGX_OK; } src/http/ngx_http_upstream.c:875: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `ngx_http_upstream_finalize_request`. src/http/ngx_http_upstream.c:870:9: Call 868. 869. if (ctx->state) { 870. ngx_log_error(NGX_LOG_ERR, r->connection->log, 0, ^ 871. "%V could not be resolved (%i: %s)", 872. &ctx->name, ctx->state, src/core/ngx_log.c:76:1: Parameter `log->file->fd` 74. #if (NGX_HAVE_VARIADIC_MACROS) 75. 76. void ^ 77. ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, 78. const char *fmt, ...) src/http/ngx_http_upstream.c:875:9: Call 873. ngx_resolver_strerror(ctx->state)); 874. 875. ngx_http_upstream_finalize_request(r, u, NGX_HTTP_BAD_GATEWAY); ^ 876. return; 877. } src/http/ngx_http_upstream.c:2963:1: Parameter `r->main->count` 2961. 2962. 2963. static void ^ 2964. ngx_http_upstream_finalize_request(ngx_http_request_t *r, 2965. ngx_http_upstream_t *u, ngx_int_t rc) src/http/ngx_http_upstream.c:3094:5: Call 3092. } 3093. 3094. ngx_http_finalize_request(r, rc); ^ 3095. } 3096. src/http/ngx_http_request.c:1912:1: Parameter `r->main->count` 1910. 1911. 1912. void ^ 1913. ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc) 1914. { src/http/ngx_http_request.c:1951:13: Call 1949. || c->error) 1950. { 1951. if (ngx_http_post_action(r) == NGX_OK) { ^ 1952. return; 1953. } src/http/ngx_http_request.c:2920:1: <LHS trace> 2918. 2919. 2920. static ngx_int_t ^ 2921. ngx_http_post_action(ngx_http_request_t *r) 2922. { src/http/ngx_http_request.c:2920:1: Parameter `r->main->count` 2918. 2919. 2920. static ngx_int_t ^ 2921. ngx_http_post_action(ngx_http_request_t *r) 2922. { src/http/ngx_http_request.c:2938:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `ngx_http_upstream_finalize_request` 2936. "post action: \"%V\"", &clcf->post_action); 2937. 2938. r->main->count--; ^ 2939. 2940. r->http_version = NGX_HTTP_VERSION_9;
https://github.com/nginx/nginx/blob/8cb7134f49bcdded469b3e72415b96794190257e/src/http/ngx_http_request.c/#L2938
d2a_code_trace_data_44691
static int ascii_to_wc(AVIOContext *pb, const uint8_t *b) { int val; while (*b) { GET_UTF8(val, *b++, return -1;) avio_wb16(pb, val); } avio_wb16(pb, 0x00); return 0; } libavformat/movenc.c:1851: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32. libavformat/movenc.c:1847:1: <LHS trace> 1845. } 1846. 1847. static int ascii_to_wc(AVIOContext *pb, const uint8_t *b) ^ 1848. { 1849. int val; libavformat/movenc.c:1847:1: Parameter `*b` 1845. } 1846. 1847. static int ascii_to_wc(AVIOContext *pb, const uint8_t *b) ^ 1848. { 1849. int val; libavformat/movenc.c:1851:9: Assignment 1849. int val; 1850. while (*b) { 1851. GET_UTF8(val, *b++, return -1;) ^ 1852. avio_wb16(pb, val); 1853. } libavformat/movenc.c:1851:9: Assignment 1849. int val; 1850. while (*b) { 1851. GET_UTF8(val, *b++, return -1;) ^ 1852. avio_wb16(pb, val); 1853. } libavformat/movenc.c:1851:9: Binary operation: ([0, +oo] - 1):unsigned32 1849. int val; 1850. while (*b) { 1851. GET_UTF8(val, *b++, return -1;) ^ 1852. avio_wb16(pb, val); 1853. }
https://github.com/libav/libav/blob/636ced8e1dc8248a1353b416240b93d70ad03edb/libavformat/movenc.c/#L1851
d2a_code_trace_data_44692
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/t1_lib.c:1417: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 2]):unsigned64 by call to `ssl_add_serverhello_renegotiate_ext`. Showing all 14 steps of the trace ssl/t1_lib.c:1410:10: Call 1408. #endif 1409. 1410. if (!WPACKET_start_sub_packet_u16(pkt) ^ 1411. || !WPACKET_set_flags(pkt, WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH)) { 1412. SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); 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/t1_lib.c:1417:14: Call 1415. 1416. if (s->s3->send_connection_binding && 1417. !ssl_add_serverhello_renegotiate_ext(s, pkt)) { ^ 1418. SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); 1419. return 0; ssl/t1_reneg.c:53:1: Parameter `pkt->written` 51. 52. /* Add the server's renegotiation binding */ 53. > int ssl_add_serverhello_renegotiate_ext(SSL *s, WPACKET *pkt) 54. { 55. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_renegotiate) ssl/t1_reneg.c:55:10: Call 53. int ssl_add_serverhello_renegotiate_ext(SSL *s, WPACKET *pkt) 54. { 55. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_renegotiate) ^ 56. || !WPACKET_start_sub_packet_u16(pkt) 57. || !WPACKET_start_sub_packet_u8(pkt) ssl/packet.c:261:1: Parameter `pkt->written` 259. } 260. 261. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 262. { 263. unsigned char *data; ssl/packet.c:269:17: Call 267. 268. if (size > sizeof(unsigned int) 269. || !WPACKET_allocate_bytes(pkt, size, &data) ^ 270. || !put_value(data, val, size)) 271. 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 `ssl_add_serverhello_renegotiate_ext` 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_44693
static int cca_rsa_verify(int type, const unsigned char *m, unsigned int m_len, unsigned char *sigbuf, unsigned int siglen, const RSA *rsa) { long returnCode; long reasonCode; long lsiglen = siglen; long exitDataLength = 0; unsigned char exitData[8]; long ruleArrayLength = 1; unsigned char ruleArray[8] = "PKCS-1.1"; long keyTokenLength; unsigned char* keyToken = (unsigned char*)RSA_get_ex_data(rsa, hndidx); long length = SSL_SIG_LEN; long keyLength ; unsigned char *hashBuffer = NULL; X509_SIG sig; ASN1_TYPE parameter; X509_ALGOR algorithm; ASN1_OCTET_STRING digest; keyTokenLength = *(long*)keyToken; keyToken+=sizeof(long); if (type == NID_md5 || type == NID_sha1) { sig.algor = &algorithm; algorithm.algorithm = OBJ_nid2obj(type); if (!algorithm.algorithm) { CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY, CCA4758_R_UNKNOWN_ALGORITHM_TYPE); return 0; } if (!algorithm.algorithm->length) { CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY, CCA4758_R_ASN1_OID_UNKNOWN_FOR_MD); return 0; } parameter.type = V_ASN1_NULL; parameter.value.ptr = NULL; algorithm.parameter = &parameter; sig.digest = &digest; sig.digest->data = (unsigned char*)m; sig.digest->length = m_len; length = i2d_X509_SIG(&sig, NULL); } keyLength = RSA_size(rsa); if (length - RSA_PKCS1_PADDING > keyLength) { CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY, CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL); return 0; } switch (type) { case NID_md5_sha1 : if (m_len != SSL_SIG_LEN) { CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY, CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL); return 0; } hashBuffer = (unsigned char *)m; length = m_len; break; case NID_md5 : { unsigned char *ptr; ptr = hashBuffer = OPENSSL_malloc( (unsigned int)keyLength+1); if (!hashBuffer) { CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY, ERR_R_MALLOC_FAILURE); return 0; } i2d_X509_SIG(&sig, &ptr); } break; case NID_sha1 : { unsigned char *ptr; ptr = hashBuffer = OPENSSL_malloc( (unsigned int)keyLength+1); if (!hashBuffer) { CCA4758err(CCA4758_F_IBM_4758_CCA_VERIFY, ERR_R_MALLOC_FAILURE); return 0; } i2d_X509_SIG(&sig, &ptr); } break; default: return 0; } digitalSignatureVerify(&returnCode, &reasonCode, &exitDataLength, exitData, &ruleArrayLength, ruleArray, &keyTokenLength, keyToken, &length, hashBuffer, &lsiglen, sigbuf); if (type == NID_sha1 || type == NID_md5) { memset(hashBuffer, keyLength+1, 0); OPENSSL_free(hashBuffer); } return ((returnCode || reasonCode) ? 0 : 1); } crypto/engine/hw_4758_cca.c:607: error: NULL_DEREFERENCE pointer `keyToken` last assigned on line 598 could be null and is dereferenced at line 607, column 19. Showing all 22 steps of the trace crypto/engine/hw_4758_cca.c:587:1: start of procedure cca_rsa_verify() 585. #define SSL_SIG_LEN 36 586. 587. > static int cca_rsa_verify(int type, const unsigned char *m, unsigned int m_len, 588. unsigned char *sigbuf, unsigned int siglen, const RSA *rsa) 589. { crypto/engine/hw_4758_cca.c:592:2: 590. long returnCode; 591. long reasonCode; 592. > long lsiglen = siglen; 593. long exitDataLength = 0; 594. unsigned char exitData[8]; crypto/engine/hw_4758_cca.c:593:2: 591. long reasonCode; 592. long lsiglen = siglen; 593. > long exitDataLength = 0; 594. unsigned char exitData[8]; 595. long ruleArrayLength = 1; crypto/engine/hw_4758_cca.c:595:2: 593. long exitDataLength = 0; 594. unsigned char exitData[8]; 595. > long ruleArrayLength = 1; 596. unsigned char ruleArray[8] = "PKCS-1.1"; 597. long keyTokenLength; crypto/engine/hw_4758_cca.c:596:2: 594. unsigned char exitData[8]; 595. long ruleArrayLength = 1; 596. > unsigned char ruleArray[8] = "PKCS-1.1"; 597. long keyTokenLength; 598. unsigned char* keyToken = (unsigned char*)RSA_get_ex_data(rsa, hndidx); crypto/engine/hw_4758_cca.c:598:2: 596. unsigned char ruleArray[8] = "PKCS-1.1"; 597. long keyTokenLength; 598. > unsigned char* keyToken = (unsigned char*)RSA_get_ex_data(rsa, hndidx); 599. long length = SSL_SIG_LEN; 600. long keyLength ; crypto/rsa/rsa_lib.c:243:1: start of procedure RSA_get_ex_data() 241. } 242. 243. > void *RSA_get_ex_data(const RSA *r, int idx) 244. { 245. return(CRYPTO_get_ex_data(&r->ex_data,idx)); crypto/rsa/rsa_lib.c:245:2: 243. void *RSA_get_ex_data(const RSA *r, int idx) 244. { 245. > return(CRYPTO_get_ex_data(&r->ex_data,idx)); 246. } 247. crypto/ex_data.c:626:1: start of procedure CRYPTO_get_ex_data() 624. /* For a given CRYPTO_EX_DATA_ variable, get the value corresponding to a 625. * particular index in the class used by this variable */ 626. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 627. { 628. if (ad->sk == NULL) crypto/ex_data.c:628:6: Taking false branch 626. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 627. { 628. if (ad->sk == NULL) ^ 629. return(0); 630. else if (idx >= sk_num(ad->sk)) crypto/ex_data.c:630:11: 628. if (ad->sk == NULL) 629. return(0); 630. > else if (idx >= sk_num(ad->sk)) 631. return(0); 632. else crypto/stack/stack.c:301:1: start of procedure sk_num() 299. } 300. 301. > int sk_num(const STACK *st) 302. { 303. if(st == NULL) return -1; crypto/stack/stack.c:303:5: Taking false branch 301. int sk_num(const STACK *st) 302. { 303. if(st == NULL) return -1; ^ 304. return st->num; 305. } crypto/stack/stack.c:304:2: 302. { 303. if(st == NULL) return -1; 304. > return st->num; 305. } 306. crypto/stack/stack.c:305:1: return from a call to sk_num 303. if(st == NULL) return -1; 304. return st->num; 305. > } 306. 307. char *sk_value(const STACK *st, int i) crypto/ex_data.c:630:11: Taking true branch 628. if (ad->sk == NULL) 629. return(0); 630. else if (idx >= sk_num(ad->sk)) ^ 631. return(0); 632. else crypto/ex_data.c:631:3: 629. return(0); 630. else if (idx >= sk_num(ad->sk)) 631. > return(0); 632. else 633. return(sk_value(ad->sk,idx)); crypto/ex_data.c:634:2: return from a call to CRYPTO_get_ex_data 632. else 633. return(sk_value(ad->sk,idx)); 634. } ^ 635. 636. IMPLEMENT_STACK_OF(CRYPTO_EX_DATA_FUNCS) crypto/rsa/rsa_lib.c:246:2: return from a call to RSA_get_ex_data 244. { 245. return(CRYPTO_get_ex_data(&r->ex_data,idx)); 246. } ^ 247. 248. int RSA_size(const RSA *r) crypto/engine/hw_4758_cca.c:599:2: 597. long keyTokenLength; 598. unsigned char* keyToken = (unsigned char*)RSA_get_ex_data(rsa, hndidx); 599. > long length = SSL_SIG_LEN; 600. long keyLength ; 601. unsigned char *hashBuffer = NULL; crypto/engine/hw_4758_cca.c:601:2: 599. long length = SSL_SIG_LEN; 600. long keyLength ; 601. > unsigned char *hashBuffer = NULL; 602. X509_SIG sig; 603. ASN1_TYPE parameter; crypto/engine/hw_4758_cca.c:607:2: 605. ASN1_OCTET_STRING digest; 606. 607. > keyTokenLength = *(long*)keyToken; 608. keyToken+=sizeof(long); 609.
https://github.com/openssl/openssl/blob/870694b3da75d0757b400e802caea9d98510b8a4/crypto/engine/hw_4758_cca.c/#L607
d2a_code_trace_data_44694
int test_div_recp(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b, *c, *d, *e; BN_RECP_CTX *recp; int i; recp = BN_RECP_CTX_new(); a = BN_new(); b = BN_new(); c = BN_new(); d = BN_new(); e = BN_new(); for (i = 0; i < num0 + num1; i++) { if (i < num1) { BN_bntest_rand(a, 400, 0, 0); BN_copy(b, a); BN_lshift(a, a, i); BN_add_word(a, i); } else BN_bntest_rand(b, 50 + 3 * (i - num1), 0, 0); a->neg = rand_neg(); b->neg = rand_neg(); BN_RECP_CTX_set(recp, b, ctx); BN_div_recp(d, c, a, recp, ctx); if (bp != NULL) { if (!results) { BN_print(bp, a); BIO_puts(bp, " / "); BN_print(bp, b); BIO_puts(bp, " - "); } BN_print(bp, d); BIO_puts(bp, "\n"); if (!results) { BN_print(bp, a); BIO_puts(bp, " % "); BN_print(bp, b); BIO_puts(bp, " - "); } BN_print(bp, c); BIO_puts(bp, "\n"); } BN_mul(e, d, b, ctx); BN_add(d, e, c); BN_sub(d, d, a); if (!BN_is_zero(d)) { fprintf(stderr, "Reciprocal division test failed!\n"); fprintf(stderr, "a="); BN_print_fp(stderr, a); fprintf(stderr, "\nb="); BN_print_fp(stderr, b); fprintf(stderr, "\n"); return 0; } } BN_free(a); BN_free(b); BN_free(c); BN_free(d); BN_free(e); BN_RECP_CTX_free(recp); return (1); } test/bntest.c:640: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 590, column 9 is not reachable after line 640, column 5. Showing all 175 steps of the trace test/bntest.c:581:1: start of procedure test_div_recp() 579. } 580. 581. > int test_div_recp(BIO *bp, BN_CTX *ctx) 582. { 583. BIGNUM *a, *b, *c, *d, *e; test/bntest.c:587:5: 585. int i; 586. 587. > recp = BN_RECP_CTX_new(); 588. a = BN_new(); 589. b = BN_new(); crypto/bn/bn_recp.c:70:1: start of procedure BN_RECP_CTX_new() 68. } 69. 70. > BN_RECP_CTX *BN_RECP_CTX_new(void) 71. { 72. BN_RECP_CTX *ret; crypto/bn/bn_recp.c:74:9: 72. BN_RECP_CTX *ret; 73. 74. > if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) 75. return (NULL); 76. crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/bn/bn_recp.c:74:9: Taking false branch 72. BN_RECP_CTX *ret; 73. 74. if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) ^ 75. return (NULL); 76. crypto/bn/bn_recp.c:77:5: 75. return (NULL); 76. 77. > BN_RECP_CTX_init(ret); 78. ret->flags = BN_FLG_MALLOCED; 79. return (ret); crypto/bn/bn_recp.c:62:1: start of procedure BN_RECP_CTX_init() 60. #include "bn_lcl.h" 61. 62. > void BN_RECP_CTX_init(BN_RECP_CTX *recp) 63. { 64. bn_init(&(recp->N)); crypto/bn/bn_recp.c:64:5: Skipping bn_init(): empty list of specs 62. void BN_RECP_CTX_init(BN_RECP_CTX *recp) 63. { 64. bn_init(&(recp->N)); ^ 65. bn_init(&(recp->Nr)); 66. recp->num_bits = 0; crypto/bn/bn_recp.c:65:5: Skipping bn_init(): empty list of specs 63. { 64. bn_init(&(recp->N)); 65. bn_init(&(recp->Nr)); ^ 66. recp->num_bits = 0; 67. recp->flags = 0; crypto/bn/bn_recp.c:66:5: 64. bn_init(&(recp->N)); 65. bn_init(&(recp->Nr)); 66. > recp->num_bits = 0; 67. recp->flags = 0; 68. } crypto/bn/bn_recp.c:67:5: 65. bn_init(&(recp->Nr)); 66. recp->num_bits = 0; 67. > recp->flags = 0; 68. } 69. crypto/bn/bn_recp.c:68:1: return from a call to BN_RECP_CTX_init 66. recp->num_bits = 0; 67. recp->flags = 0; 68. > } 69. 70. BN_RECP_CTX *BN_RECP_CTX_new(void) crypto/bn/bn_recp.c:78:5: 76. 77. BN_RECP_CTX_init(ret); 78. > ret->flags = BN_FLG_MALLOCED; 79. return (ret); 80. } crypto/bn/bn_recp.c:79:5: 77. BN_RECP_CTX_init(ret); 78. ret->flags = BN_FLG_MALLOCED; 79. > return (ret); 80. } 81. crypto/bn/bn_recp.c:80:1: return from a call to BN_RECP_CTX_new 78. ret->flags = BN_FLG_MALLOCED; 79. return (ret); 80. > } 81. 82. void BN_RECP_CTX_free(BN_RECP_CTX *recp) test/bntest.c:588:5: 586. 587. recp = BN_RECP_CTX_new(); 588. > a = BN_new(); 589. b = BN_new(); 590. c = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:589:5: 587. recp = BN_RECP_CTX_new(); 588. a = BN_new(); 589. > b = BN_new(); 590. c = BN_new(); 591. d = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:590:5: 588. a = BN_new(); 589. b = BN_new(); 590. > c = BN_new(); 591. d = BN_new(); 592. e = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:591:5: 589. b = BN_new(); 590. c = BN_new(); 591. > d = BN_new(); 592. e = BN_new(); 593. crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:592:5: 590. c = BN_new(); 591. d = BN_new(); 592. > e = BN_new(); 593. 594. for (i = 0; i < num0 + num1; i++) { crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:594:10: 592. e = BN_new(); 593. 594. > for (i = 0; i < num0 + num1; i++) { 595. if (i < num1) { 596. BN_bntest_rand(a, 400, 0, 0); test/bntest.c:594:17: Loop condition is false. Leaving loop 592. e = BN_new(); 593. 594. for (i = 0; i < num0 + num1; i++) { ^ 595. if (i < num1) { 596. BN_bntest_rand(a, 400, 0, 0); test/bntest.c:638:5: 636. } 637. } 638. > BN_free(a); 639. BN_free(b); 640. BN_free(c); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a) test/bntest.c:639:5: 637. } 638. BN_free(a); 639. > BN_free(b); 640. BN_free(c); 641. BN_free(d); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a) test/bntest.c:640:5: 638. BN_free(a); 639. BN_free(b); 640. > BN_free(c); 641. BN_free(d); 642. BN_free(e); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L640
d2a_code_trace_data_44695
static void deinterlace_bottom_field_inplace(uint8_t *src1, int src_wrap, int width, int height) { uint8_t *src_m1, *src_0, *src_p1, *src_p2; int y; uint8_t *buf; buf = (uint8_t*)av_malloc(width); src_m1 = src1; memcpy(buf,src_m1,width); src_0=&src_m1[src_wrap]; src_p1=&src_0[src_wrap]; src_p2=&src_p1[src_wrap]; for(y=0;y<(height-2);y+=2) { deinterlace_line_inplace(buf,src_m1,src_0,src_p1,src_p2,width); src_m1 = src_p1; src_0 = src_p2; src_p1 += 2*src_wrap; src_p2 += 2*src_wrap; } deinterlace_line_inplace(buf,src_m1,src_0,src_0,src_0,width); av_free(buf); } libavcodec/imgconvert.c:2948: error: Null Dereference pointer `buf` last assigned on line 2945 could be null and is dereferenced by call to `memcpy()` at line 2948, column 5. libavcodec/imgconvert.c:2939:1: start of procedure deinterlace_bottom_field_inplace() 2937. } 2938. 2939. static void deinterlace_bottom_field_inplace(uint8_t *src1, int src_wrap, ^ 2940. int width, int height) 2941. { libavcodec/imgconvert.c:2945:5: 2943. int y; 2944. uint8_t *buf; 2945. buf = (uint8_t*)av_malloc(width); ^ 2946. 2947. src_m1 = src1; libavutil/mem.c:47:1: start of procedure av_malloc() 45. linker will do it automatically. */ 46. 47. void *av_malloc(unsigned int size) ^ 48. { 49. void *ptr = NULL; libavutil/mem.c:49:5: 47. void *av_malloc(unsigned int size) 48. { 49. void *ptr = NULL; ^ 50. #if CONFIG_MEMALIGN_HACK 51. long diff; libavutil/mem.c:55:8: Taking true branch 53. 54. /* let's disallow possible ambiguous cases */ 55. if(size > (INT_MAX-16) ) ^ 56. return NULL; 57. libavutil/mem.c:56:9: 54. /* let's disallow possible ambiguous cases */ 55. if(size > (INT_MAX-16) ) 56. return NULL; ^ 57. 58. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:100:1: return from a call to av_malloc 98. #endif 99. return ptr; 100. } ^ 101. 102. void *av_realloc(void *ptr, unsigned int size) libavcodec/imgconvert.c:2947:5: 2945. buf = (uint8_t*)av_malloc(width); 2946. 2947. src_m1 = src1; ^ 2948. memcpy(buf,src_m1,width); 2949. src_0=&src_m1[src_wrap]; libavcodec/imgconvert.c:2948:5: 2946. 2947. src_m1 = src1; 2948. memcpy(buf,src_m1,width); ^ 2949. src_0=&src_m1[src_wrap]; 2950. src_p1=&src_0[src_wrap];
https://github.com/libav/libav/blob/9aaa2077e5879b153d2ce6bea2e42f0c349a083f/libavcodec/imgconvert.c/#L2948
d2a_code_trace_data_44696
static int var_diamond_search(MpegEncContext * s, int *best, int dmin, int src_index, int ref_index, int const penalty_factor, int size, int h, int flags) { MotionEstContext * const c= &s->me; me_cmp_func cmpf, chroma_cmpf; int dia_size; LOAD_COMMON LOAD_COMMON2 int map_generation= c->map_generation; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; for(dia_size=1; dia_size<=c->dia_size; dia_size++){ int dir, start, end; const int x= best[0]; const int y= best[1]; start= FFMAX(0, y + dia_size - ymax); end = FFMIN(dia_size, xmax - x + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x + dir , y + dia_size - dir); } start= FFMAX(0, x + dia_size - xmax); end = FFMIN(dia_size, y - ymin + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x + dia_size - dir, y - dir ); } start= FFMAX(0, -y + dia_size + ymin ); end = FFMIN(dia_size, x - xmin + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x - dir , y - dia_size + dir); } start= FFMAX(0, -x + dia_size + xmin ); end = FFMIN(dia_size, ymax - y + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x - dia_size + dir, y + dir ); } if(x!=best[0] || y!=best[1]) dia_size=0; #if 0 { int dx, dy, i; static int stats[8*8]; dx= FFABS(x-best[0]); dy= FFABS(y-best[1]); stats[dy*8 + dx] ++; if(256*256*256*64 % (stats[0]+1)==0){ for(i=0; i<64; i++){ if((i&7)==0) printf("\n"); printf("%6d ", stats[i]); } printf("\n"); } } #endif } return dmin; } libavcodec/motion_est_template.c:930: error: Uninitialized Value The value read from xmax was never initialized. libavcodec/motion_est_template.c:930:13: 928. 929. //check(x + dia_size - dir, y - dir,0, a1) 930. CHECK_MV(x + dia_size - dir, y - dir ); ^ 931. } 932.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L930
d2a_code_trace_data_44697
static void print_sdp(OutputFile *output_files, int n) { char sdp[2048]; int i; AVFormatContext **avc = av_malloc(sizeof(*avc)*n); if (!avc) exit_program(1); for (i = 0; i < n; i++) avc[i] = output_files[i].ctx; av_sdp_create(avc, n, sdp, sizeof(sdp)); printf("SDP:\n%s\n", sdp); fflush(stdout); av_freep(&avc); } avconv.c:1945: error: Null Dereference pointer `avc` last assigned on line 1940 could be null and is dereferenced at line 1945, column 9. avconv.c:1936:1: start of procedure print_sdp() 1934. } 1935. 1936. static void print_sdp(OutputFile *output_files, int n) ^ 1937. { 1938. char sdp[2048]; avconv.c:1940:5: 1938. char sdp[2048]; 1939. int i; 1940. AVFormatContext **avc = av_malloc(sizeof(*avc)*n); ^ 1941. 1942. if (!avc) 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) avconv.c:1942:10: Taking true branch 1940. AVFormatContext **avc = av_malloc(sizeof(*avc)*n); 1941. 1942. if (!avc) ^ 1943. exit_program(1); 1944. for (i = 0; i < n; i++) avconv.c:1943:9: Skipping exit_program(): empty list of specs 1941. 1942. if (!avc) 1943. exit_program(1); ^ 1944. for (i = 0; i < n; i++) 1945. avc[i] = output_files[i].ctx; avconv.c:1944:10: 1942. if (!avc) 1943. exit_program(1); 1944. for (i = 0; i < n; i++) ^ 1945. avc[i] = output_files[i].ctx; 1946. avconv.c:1944:17: Loop condition is true. Entering loop body 1942. if (!avc) 1943. exit_program(1); 1944. for (i = 0; i < n; i++) ^ 1945. avc[i] = output_files[i].ctx; 1946. avconv.c:1945:9: 1943. exit_program(1); 1944. for (i = 0; i < n; i++) 1945. avc[i] = output_files[i].ctx; ^ 1946. 1947. av_sdp_create(avc, n, sdp, sizeof(sdp));
https://github.com/libav/libav/blob/e1edfbcb240cace69d92701e6910c2b03555b7d7/avconv.c/#L1945
d2a_code_trace_data_44698
int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold, ASN1_GENERALIZEDTIME **pinvtm, const char *str) { char *tmp = NULL; char *rtime_str, *reason_str = NULL, *arg_str = NULL, *p; int reason_code = -1; int ret = 0; unsigned int i; ASN1_OBJECT *hold = NULL; ASN1_GENERALIZEDTIME *comp_time = NULL; tmp = BUF_strdup(str); p = strchr(tmp, ','); rtime_str = tmp; if (p) { *p = '\0'; p++; reason_str = p; p = strchr(p, ','); if (p) { *p = '\0'; arg_str = p + 1; } } if (prevtm) { *prevtm = ASN1_UTCTIME_new(); if (!ASN1_UTCTIME_set_string(*prevtm, rtime_str)) { BIO_printf(bio_err, "invalid revocation date %s\n", rtime_str); goto err; } } if (reason_str) { for (i = 0; i < NUM_REASONS; i++) { if(!strcasecmp(reason_str, crl_reasons[i])) { reason_code = i; break; } } if (reason_code == OCSP_REVOKED_STATUS_NOSTATUS) { BIO_printf(bio_err, "invalid reason code %s\n", reason_str); goto err; } if (reason_code == 7) reason_code = OCSP_REVOKED_STATUS_REMOVEFROMCRL; else if (reason_code == 8) { if (!arg_str) { BIO_printf(bio_err, "missing hold instruction\n"); goto err; } reason_code = OCSP_REVOKED_STATUS_CERTIFICATEHOLD; hold = OBJ_txt2obj(arg_str, 0); if (!hold) { BIO_printf(bio_err, "invalid object identifier %s\n", arg_str); goto err; } if (phold) *phold = hold; } else if ((reason_code == 9) || (reason_code == 10)) { if (!arg_str) { BIO_printf(bio_err, "missing compromised time\n"); goto err; } comp_time = ASN1_GENERALIZEDTIME_new(); if (!ASN1_GENERALIZEDTIME_set_string(comp_time, arg_str)) { BIO_printf(bio_err, "invalid compromised time %s\n", arg_str); goto err; } if (reason_code == 9) reason_code = OCSP_REVOKED_STATUS_KEYCOMPROMISE; else reason_code = OCSP_REVOKED_STATUS_CACOMPROMISE; } } if (preason) *preason = reason_code; if (pinvtm) *pinvtm = comp_time; else ASN1_GENERALIZEDTIME_free(comp_time); ret = 1; err: if (tmp) OPENSSL_free(tmp); if (!phold) ASN1_OBJECT_free(hold); if (!pinvtm) ASN1_GENERALIZEDTIME_free(comp_time); return ret; } apps/ca.c:2933: error: NULL_DEREFERENCE pointer `tmp` last assigned on line 2931 could be null and is dereferenced by call to `strchr()` at line 2933, column 6. Showing all 13 steps of the trace apps/ca.c:2922:1: start of procedure unpack_revinfo() 2920. } 2921. 2922. > int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold, ASN1_GENERALIZEDTIME **pinvtm, const char *str) 2923. { 2924. char *tmp = NULL; apps/ca.c:2924:2: 2922. int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold, ASN1_GENERALIZEDTIME **pinvtm, const char *str) 2923. { 2924. > char *tmp = NULL; 2925. char *rtime_str, *reason_str = NULL, *arg_str = NULL, *p; 2926. int reason_code = -1; apps/ca.c:2925:2: 2923. { 2924. char *tmp = NULL; 2925. > char *rtime_str, *reason_str = NULL, *arg_str = NULL, *p; 2926. int reason_code = -1; 2927. int ret = 0; apps/ca.c:2926:2: 2924. char *tmp = NULL; 2925. char *rtime_str, *reason_str = NULL, *arg_str = NULL, *p; 2926. > int reason_code = -1; 2927. int ret = 0; 2928. unsigned int i; apps/ca.c:2927:2: 2925. char *rtime_str, *reason_str = NULL, *arg_str = NULL, *p; 2926. int reason_code = -1; 2927. > int ret = 0; 2928. unsigned int i; 2929. ASN1_OBJECT *hold = NULL; apps/ca.c:2929:2: 2927. int ret = 0; 2928. unsigned int i; 2929. > ASN1_OBJECT *hold = NULL; 2930. ASN1_GENERALIZEDTIME *comp_time = NULL; 2931. tmp = BUF_strdup(str); apps/ca.c:2930:2: 2928. unsigned int i; 2929. ASN1_OBJECT *hold = NULL; 2930. > ASN1_GENERALIZEDTIME *comp_time = NULL; 2931. tmp = BUF_strdup(str); 2932. apps/ca.c:2931:2: 2929. ASN1_OBJECT *hold = NULL; 2930. ASN1_GENERALIZEDTIME *comp_time = NULL; 2931. > tmp = BUF_strdup(str); 2932. 2933. p = strchr(tmp, ','); crypto/buffer/buf_str.c:65:1: start of procedure BUF_strdup() 63. #include <openssl/buffer.h> 64. 65. > char *BUF_strdup(const char *str) 66. { 67. if (str == NULL) return(NULL); crypto/buffer/buf_str.c:67:6: Taking true branch 65. char *BUF_strdup(const char *str) 66. { 67. if (str == NULL) return(NULL); ^ 68. return BUF_strndup(str, strlen(str)); 69. } crypto/buffer/buf_str.c:67:19: 65. char *BUF_strdup(const char *str) 66. { 67. > if (str == NULL) return(NULL); 68. return BUF_strndup(str, strlen(str)); 69. } crypto/buffer/buf_str.c:69:2: return from a call to BUF_strdup 67. if (str == NULL) return(NULL); 68. return BUF_strndup(str, strlen(str)); 69. } ^ 70. 71. char *BUF_strndup(const char *str, size_t siz) apps/ca.c:2933:2: 2931. tmp = BUF_strdup(str); 2932. 2933. > p = strchr(tmp, ','); 2934. 2935. rtime_str = tmp;
https://github.com/openssl/openssl/blob/24edfa9df9e6315b107b7c2d8ce0634208e8c350/apps/ca.c/#L2933
d2a_code_trace_data_44699
static int check_chain_extensions(X509_STORE_CTX *ctx) { int i, ok = 0, must_be_ca, plen = 0; X509 *x; int (*cb) (int xok, X509_STORE_CTX *xctx); int proxy_path_length = 0; int purpose; int allow_proxy_certs; cb = ctx->verify_cb; must_be_ca = -1; if (ctx->parent) { allow_proxy_certs = 0; purpose = X509_PURPOSE_CRL_SIGN; } else { allow_proxy_certs = ! !(ctx->param->flags & X509_V_FLAG_ALLOW_PROXY_CERTS); if (getenv("OPENSSL_ALLOW_PROXY_CERTS")) allow_proxy_certs = 1; purpose = ctx->param->purpose; } for (i = 0; i == 0 || i < ctx->num_untrusted; i++) { int ret; x = sk_X509_value(ctx->chain, i); if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) && (x->ex_flags & EXFLAG_CRITICAL)) { ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION; ctx->error_depth = i; ctx->current_cert = x; ok = cb(0, ctx); if (!ok) goto end; } if (!allow_proxy_certs && (x->ex_flags & EXFLAG_PROXY)) { ctx->error = X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED; ctx->error_depth = i; ctx->current_cert = x; ok = cb(0, ctx); if (!ok) goto end; } ret = X509_check_ca(x); switch (must_be_ca) { case -1: if ((ctx->param->flags & X509_V_FLAG_X509_STRICT) && (ret != 1) && (ret != 0)) { ret = 0; ctx->error = X509_V_ERR_INVALID_CA; } else ret = 1; break; case 0: if (ret != 0) { ret = 0; ctx->error = X509_V_ERR_INVALID_NON_CA; } else ret = 1; break; default: if ((ret == 0) || ((ctx->param->flags & X509_V_FLAG_X509_STRICT) && (ret != 1))) { ret = 0; ctx->error = X509_V_ERR_INVALID_CA; } else ret = 1; break; } if (ret == 0) { ctx->error_depth = i; ctx->current_cert = x; ok = cb(0, ctx); if (!ok) goto end; } if (ctx->param->purpose > 0) { ret = X509_check_purpose(x, purpose, must_be_ca > 0); if ((ret == 0) || ((ctx->param->flags & X509_V_FLAG_X509_STRICT) && (ret != 1))) { ctx->error = X509_V_ERR_INVALID_PURPOSE; ctx->error_depth = i; ctx->current_cert = x; ok = cb(0, ctx); if (!ok) goto end; } } if ((i > 1) && !(x->ex_flags & EXFLAG_SI) && (x->ex_pathlen != -1) && (plen > (x->ex_pathlen + proxy_path_length + 1))) { ctx->error = X509_V_ERR_PATH_LENGTH_EXCEEDED; ctx->error_depth = i; ctx->current_cert = x; ok = cb(0, ctx); if (!ok) goto end; } if (!(x->ex_flags & EXFLAG_SI)) plen++; if (x->ex_flags & EXFLAG_PROXY) { if (x->ex_pcpathlen != -1 && i > x->ex_pcpathlen) { ctx->error = X509_V_ERR_PROXY_PATH_LENGTH_EXCEEDED; ctx->error_depth = i; ctx->current_cert = x; ok = cb(0, ctx); if (!ok) goto end; } proxy_path_length++; must_be_ca = 0; } else must_be_ca = 1; } ok = 1; end: return ok; } crypto/x509/x509_vfy.c:422: error: NULL_DEREFERENCE pointer `x` last assigned on line 412 could be null and is dereferenced at line 422, column 36. Showing all 20 steps of the trace crypto/x509/x509_vfy.c:372:1: start of procedure check_chain_extensions() 370. */ 371. 372. > static int check_chain_extensions(X509_STORE_CTX *ctx) 373. { 374. int i, ok = 0, must_be_ca, plen = 0; crypto/x509/x509_vfy.c:374:5: 372. static int check_chain_extensions(X509_STORE_CTX *ctx) 373. { 374. > int i, ok = 0, must_be_ca, plen = 0; 375. X509 *x; 376. int (*cb) (int xok, X509_STORE_CTX *xctx); crypto/x509/x509_vfy.c:377:5: 375. X509 *x; 376. int (*cb) (int xok, X509_STORE_CTX *xctx); 377. > int proxy_path_length = 0; 378. int purpose; 379. int allow_proxy_certs; crypto/x509/x509_vfy.c:380:5: 378. int purpose; 379. int allow_proxy_certs; 380. > cb = ctx->verify_cb; 381. 382. /*- crypto/x509/x509_vfy.c:391:5: 389. * all certificates in the chain except the leaf certificate. 390. */ 391. > must_be_ca = -1; 392. 393. /* CRL path validation */ crypto/x509/x509_vfy.c:394:9: Taking true branch 392. 393. /* CRL path validation */ 394. if (ctx->parent) { ^ 395. allow_proxy_certs = 0; 396. purpose = X509_PURPOSE_CRL_SIGN; crypto/x509/x509_vfy.c:395:9: 393. /* CRL path validation */ 394. if (ctx->parent) { 395. > allow_proxy_certs = 0; 396. purpose = X509_PURPOSE_CRL_SIGN; 397. } else { crypto/x509/x509_vfy.c:396:9: 394. if (ctx->parent) { 395. allow_proxy_certs = 0; 396. > purpose = X509_PURPOSE_CRL_SIGN; 397. } else { 398. allow_proxy_certs = crypto/x509/x509_vfy.c:410:10: 408. 409. /* Check all untrusted certificates */ 410. > for (i = 0; i == 0 || i < ctx->num_untrusted; i++) { 411. int ret; 412. x = sk_X509_value(ctx->chain, i); crypto/x509/x509_vfy.c:410:17: Loop condition is true. Entering loop body 408. 409. /* Check all untrusted certificates */ 410. for (i = 0; i == 0 || i < ctx->num_untrusted; i++) { ^ 411. int ret; 412. x = sk_X509_value(ctx->chain, i); crypto/x509/x509_vfy.c:412:9: 410. for (i = 0; i == 0 || i < ctx->num_untrusted; i++) { 411. int ret; 412. > x = sk_X509_value(ctx->chain, i); 413. if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) 414. && (x->ex_flags & EXFLAG_CRITICAL)) { include/openssl/x509.h:170:1: start of procedure sk_X509_value() 168. typedef struct x509_cinf_st X509_CINF; 169. 170. > DEFINE_STACK_OF(X509) 171. 172. /* This is used for a table of trust checking functions */ crypto/stack/stack.c:324:1: start of procedure sk_value() 322. } 323. 324. > void *sk_value(const _STACK *st, int i) 325. { 326. if (!st || (i < 0) || (i >= st->num)) crypto/stack/stack.c:326:10: Taking true branch 324. void *sk_value(const _STACK *st, int i) 325. { 326. if (!st || (i < 0) || (i >= st->num)) ^ 327. return NULL; 328. return st->data[i]; crypto/stack/stack.c:327:9: 325. { 326. if (!st || (i < 0) || (i >= st->num)) 327. > return NULL; 328. return st->data[i]; 329. } crypto/stack/stack.c:329:1: return from a call to sk_value 327. return NULL; 328. return st->data[i]; 329. > } 330. 331. void *sk_set(_STACK *st, int i, void *value) include/openssl/x509.h:170:1: return from a call to sk_X509_value 168. typedef struct x509_cinf_st X509_CINF; 169. 170. > DEFINE_STACK_OF(X509) 171. 172. /* This is used for a table of trust checking functions */ crypto/x509/x509_vfy.c:413:15: Taking false branch 411. int ret; 412. x = sk_X509_value(ctx->chain, i); 413. if (!(ctx->param->flags & X509_V_FLAG_IGNORE_CRITICAL) ^ 414. && (x->ex_flags & EXFLAG_CRITICAL)) { 415. ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION; crypto/x509/x509_vfy.c:422:14: Taking true branch 420. goto end; 421. } 422. if (!allow_proxy_certs && (x->ex_flags & EXFLAG_PROXY)) { ^ 423. ctx->error = X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED; 424. ctx->error_depth = i; crypto/x509/x509_vfy.c:422:36: 420. goto end; 421. } 422. > if (!allow_proxy_certs && (x->ex_flags & EXFLAG_PROXY)) { 423. ctx->error = X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED; 424. ctx->error_depth = i;
https://github.com/openssl/openssl/blob/25be7a0feacdbd3326774f0da8aaeb966c1f57f8/crypto/x509/x509_vfy.c/#L422
d2a_code_trace_data_44700
static ossl_inline void packet_forward(PACKET *pkt, size_t len) { pkt->curr += len; pkt->remaining -= len; } test/packettest.c:140: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 4):unsigned64 by call to `PACKET_get_sub_packet`. Showing all 10 steps of the trace test/packettest.c:139:10: Call 137. unsigned long i; 138. 139. if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN)) ^ 140. || !TEST_true(PACKET_get_sub_packet(&pkt, &subpkt, 4)) 141. || !TEST_true(PACKET_get_net_4(&subpkt, &i)) ssl/packet_locl.h:72:8: Parameter `pkt->remaining` 70. * is being used. 71. */ 72. __owur static ossl_inline int PACKET_buf_init(PACKET *pkt, ^ 73. const unsigned char *buf, 74. size_t len) test/packettest.c:140:17: Call 138. 139. if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN)) 140. || !TEST_true(PACKET_get_sub_packet(&pkt, &subpkt, 4)) ^ 141. || !TEST_true(PACKET_get_net_4(&subpkt, &i)) 142. || !TEST_ulong_eq(i, 0x02040608UL) ssl/packet_locl.h:124:8: Parameter `len` 122. * original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|. 123. */ 124. __owur static ossl_inline int PACKET_get_sub_packet(PACKET *pkt, ^ 125. PACKET *subpkt, size_t len) 126. { ssl/packet_locl.h:130:5: Call 128. return 0; 129. 130. packet_forward(pkt, len); ^ 131. 132. 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] - 4):unsigned64 by call to `PACKET_get_sub_packet` 34. { 35. pkt->curr += len; 36. pkt->remaining -= len; ^ 37. } 38.
https://github.com/openssl/openssl/blob/424aa352458486d67e1e9cd3d3990dc06a60ba4a/ssl/packet_locl.h/#L36
d2a_code_trace_data_44701
static int opt_preset(const char *opt, const char *arg) { FILE *f=NULL; char filename[1000], tmp[1000], tmp2[1000], line[1000]; char *codec_name = *opt == 'v' ? video_codec_name : *opt == 'a' ? audio_codec_name : subtitle_codec_name; if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { fprintf(stderr, "File for preset '%s' not found\n", arg); ffmpeg_exit(1); } while(!feof(f)){ int e= fscanf(f, "%999[^\n]\n", line) - 1; if(line[0] == '#' && !e) continue; e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2; if(e){ fprintf(stderr, "%s: Invalid syntax: '%s'\n", filename, line); ffmpeg_exit(1); } if(!strcmp(tmp, "acodec")){ opt_audio_codec(tmp2); }else if(!strcmp(tmp, "vcodec")){ opt_video_codec(tmp2); }else if(!strcmp(tmp, "scodec")){ opt_subtitle_codec(tmp2); }else if(opt_default(tmp, tmp2) < 0){ fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2); ffmpeg_exit(1); } } fclose(f); return 0; } ffmpeg.c:4174: error: Null Dereference pointer `f` last assigned on line 4169 could be null and is dereferenced by call to `feof()` at line 4174, column 12. ffmpeg.c:4161:1: start of procedure opt_preset() 4159. } 4160. 4161. static int opt_preset(const char *opt, const char *arg) ^ 4162. { 4163. FILE *f=NULL; ffmpeg.c:4163:5: 4161. static int opt_preset(const char *opt, const char *arg) 4162. { 4163. FILE *f=NULL; ^ 4164. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4165. char *codec_name = *opt == 'v' ? video_codec_name : ffmpeg.c:4165:24: Condition is false 4163. FILE *f=NULL; 4164. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4165. char *codec_name = *opt == 'v' ? video_codec_name : ^ 4166. *opt == 'a' ? audio_codec_name : 4167. subtitle_codec_name; ffmpeg.c:4166:24: Condition is false 4164. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4165. char *codec_name = *opt == 'v' ? video_codec_name : 4166. *opt == 'a' ? audio_codec_name : ^ 4167. subtitle_codec_name; 4168. ffmpeg.c:4165:24: 4163. FILE *f=NULL; 4164. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4165. char *codec_name = *opt == 'v' ? video_codec_name : ^ 4166. *opt == 'a' ? audio_codec_name : 4167. subtitle_codec_name; ffmpeg.c:4165:5: 4163. FILE *f=NULL; 4164. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4165. char *codec_name = *opt == 'v' ? video_codec_name : ^ 4166. *opt == 'a' ? audio_codec_name : 4167. subtitle_codec_name; ffmpeg.c:4169:64: Condition is false 4167. subtitle_codec_name; 4168. 4169. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { ^ 4170. fprintf(stderr, "File for preset '%s' not found\n", arg); 4171. ffmpeg_exit(1); ffmpeg.c:4169:11: Taking true branch 4167. subtitle_codec_name; 4168. 4169. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { ^ 4170. fprintf(stderr, "File for preset '%s' not found\n", arg); 4171. ffmpeg_exit(1); ffmpeg.c:4170:9: 4168. 4169. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { 4170. fprintf(stderr, "File for preset '%s' not found\n", arg); ^ 4171. ffmpeg_exit(1); 4172. } ffmpeg.c:4171:9: Skipping ffmpeg_exit(): empty list of specs 4169. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { 4170. fprintf(stderr, "File for preset '%s' not found\n", arg); 4171. ffmpeg_exit(1); ^ 4172. } 4173. ffmpeg.c:4174:12: 4172. } 4173. 4174. while(!feof(f)){ ^ 4175. int e= fscanf(f, "%999[^\n]\n", line) - 1; 4176. if(line[0] == '#' && !e)
https://github.com/libav/libav/blob/87e4d9b252bc6fa3b982f7050013069c9dc3e05b/ffmpeg.c/#L4174
d2a_code_trace_data_44702
void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) { #ifdef POLY1305_ASM poly1305_blocks_f poly1305_blocks_p = ctx->func.blocks; #endif size_t rem, num; if ((num = ctx->num)) { rem = POLY1305_BLOCK_SIZE - num; if (len >= rem) { memcpy(ctx->data + num, inp, rem); poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 1); inp += rem; len -= rem; } else { memcpy(ctx->data + num, inp, len); ctx->num = num + len; return; } } rem = len % POLY1305_BLOCK_SIZE; len -= rem; if (len >= POLY1305_BLOCK_SIZE) { poly1305_blocks(ctx->opaque, inp, len, 1); inp += len; } if (rem) memcpy(ctx->data, inp, rem); ctx->num = rem; } crypto/evp/e_chacha20_poly1305.c:452: error: INTEGER_OVERFLOW_L2 ([-2, +oo] - [-15, 15]):unsigned64 by call to `chacha20_poly1305_cipher`. Showing all 9 steps of the trace crypto/evp/e_chacha20_poly1305.c:452:13: Call 450. actx->key.counter[3] = actx->nonce[2] ^ CHACHA_U8TOU32(aad+4); 451. actx->mac_inited = 0; 452. chacha20_poly1305_cipher(ctx, NULL, aad, EVP_AEAD_TLS1_AAD_LEN); ^ 453. return POLY1305_BLOCK_SIZE; /* tag length */ 454. } crypto/evp/e_chacha20_poly1305.c:233:1: Parameter `len` 231. } 232. 233. > static int chacha20_poly1305_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out, 234. const unsigned char *in, size_t len) 235. { crypto/evp/e_chacha20_poly1305.c:254:13: Call 252. if (in) { /* aad or text */ 253. if (out == NULL) { /* aad */ 254. Poly1305_Update(POLY1305_ctx(actx), in, len); ^ 255. actx->len.aad += len; 256. actx->aad = 1; crypto/poly1305/poly1305.c:466:1: <LHS trace> 464. #endif 465. 466. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) 467. { 468. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:466:1: Parameter `len` 464. #endif 465. 466. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) 467. { 468. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:466:1: <RHS trace> 464. #endif 465. 466. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) 467. { 468. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:466:1: Parameter `len` 464. #endif 465. 466. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) 467. { 468. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:494:5: Assignment 492. } 493. 494. rem = len % POLY1305_BLOCK_SIZE; ^ 495. len -= rem; 496. crypto/poly1305/poly1305.c:495:5: Binary operation: ([-2, +oo] - [-15, 15]):unsigned64 by call to `chacha20_poly1305_cipher` 493. 494. rem = len % POLY1305_BLOCK_SIZE; 495. len -= rem; ^ 496. 497. if (len >= POLY1305_BLOCK_SIZE) {
https://github.com/openssl/openssl/blob/740b2b9a6cf31b02916a4d18f868e8a95934c083/crypto/poly1305/poly1305.c/#L495
d2a_code_trace_data_44703
static int select_server_ctx(SSL *s, void *arg, int ignore) { const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); HANDSHAKE_EX_DATA *ex_data = (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); if (servername == NULL) { ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; return SSL_TLSEXT_ERR_NOACK; } if (strcmp(servername, "server2") == 0) { SSL_CTX *new_ctx = (SSL_CTX*)arg; SSL_set_SSL_CTX(s, new_ctx); SSL_clear_options(s, 0xFFFFFFFFL); SSL_set_options(s, SSL_CTX_get_options(new_ctx)); ex_data->servername = SSL_TEST_SERVERNAME_SERVER2; return SSL_TLSEXT_ERR_OK; } else if (strcmp(servername, "server1") == 0) { ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; return SSL_TLSEXT_ERR_OK; } else if (ignore) { ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; return SSL_TLSEXT_ERR_NOACK; } else { return SSL_TLSEXT_ERR_ALERT_FATAL; } } test/handshake_helper.c:134: error: NULL_DEREFERENCE pointer `ex_data` last assigned on line 109 could be null and is dereferenced at line 134, column 9. Showing all 22 steps of the trace test/handshake_helper.c:106:1: start of procedure select_server_ctx() 104. * An empty SNI extension also returns SSL_TSLEXT_ERR_NOACK. 105. */ 106. > static int select_server_ctx(SSL *s, void *arg, int ignore) 107. { 108. const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); test/handshake_helper.c:108:5: 106. static int select_server_ctx(SSL *s, void *arg, int ignore) 107. { 108. > const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); 109. HANDSHAKE_EX_DATA *ex_data = 110. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); ssl/ssl_lib.c:2366:1: start of procedure SSL_get_servername() 2364. */ 2365. 2366. > const char *SSL_get_servername(const SSL *s, const int type) 2367. { 2368. if (type != TLSEXT_NAMETYPE_host_name) ssl/ssl_lib.c:2368:9: Taking false branch 2366. const char *SSL_get_servername(const SSL *s, const int type) 2367. { 2368. if (type != TLSEXT_NAMETYPE_host_name) ^ 2369. return NULL; 2370. ssl/ssl_lib.c:2371:12: Condition is true 2369. return NULL; 2370. 2371. return s->session && !s->ext.hostname ? ^ 2372. s->session->ext.hostname : s->ext.hostname; 2373. } ssl/ssl_lib.c:2371:27: Condition is true 2369. return NULL; 2370. 2371. return s->session && !s->ext.hostname ? ^ 2372. s->session->ext.hostname : s->ext.hostname; 2373. } ssl/ssl_lib.c:2371:12: 2369. return NULL; 2370. 2371. > return s->session && !s->ext.hostname ? 2372. s->session->ext.hostname : s->ext.hostname; 2373. } ssl/ssl_lib.c:2371:5: 2369. return NULL; 2370. 2371. > return s->session && !s->ext.hostname ? 2372. s->session->ext.hostname : s->ext.hostname; 2373. } ssl/ssl_lib.c:2373:1: return from a call to SSL_get_servername 2371. return s->session && !s->ext.hostname ? 2372. s->session->ext.hostname : s->ext.hostname; 2373. > } 2374. 2375. int SSL_get_servername_type(const SSL *s) test/handshake_helper.c:109:5: 107. { 108. const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); 109. > HANDSHAKE_EX_DATA *ex_data = 110. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); 111. ssl/ssl_lib.c:3729:1: start of procedure SSL_get_ex_data() 3727. } 3728. 3729. > void *SSL_get_ex_data(const SSL *s, int idx) 3730. { 3731. return (CRYPTO_get_ex_data(&s->ex_data, idx)); ssl/ssl_lib.c:3731:5: 3729. void *SSL_get_ex_data(const SSL *s, int idx) 3730. { 3731. > return (CRYPTO_get_ex_data(&s->ex_data, idx)); 3732. } 3733. crypto/ex_data.c:387:1: start of procedure CRYPTO_get_ex_data() 385. * particular index in the class used by this variable 386. */ 387. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 388. { 389. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) crypto/ex_data.c:389:9: Taking true branch 387. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 388. { 389. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) ^ 390. return NULL; 391. return sk_void_value(ad->sk, idx); crypto/ex_data.c:390:9: 388. { 389. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) 390. > return NULL; 391. return sk_void_value(ad->sk, idx); 392. } crypto/ex_data.c:392:1: return from a call to CRYPTO_get_ex_data 390. return NULL; 391. return sk_void_value(ad->sk, idx); 392. > } ssl/ssl_lib.c:3732:1: return from a call to SSL_get_ex_data 3730. { 3731. return (CRYPTO_get_ex_data(&s->ex_data, idx)); 3732. > } 3733. 3734. int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg) test/handshake_helper.c:112:9: Taking false branch 110. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); 111. 112. if (servername == NULL) { ^ 113. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 114. return SSL_TLSEXT_ERR_NOACK; test/handshake_helper.c:117:9: Taking false branch 115. } 116. 117. if (strcmp(servername, "server2") == 0) { ^ 118. SSL_CTX *new_ctx = (SSL_CTX*)arg; 119. SSL_set_SSL_CTX(s, new_ctx); test/handshake_helper.c:130:16: Taking false branch 128. ex_data->servername = SSL_TEST_SERVERNAME_SERVER2; 129. return SSL_TLSEXT_ERR_OK; 130. } else if (strcmp(servername, "server1") == 0) { ^ 131. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 132. return SSL_TLSEXT_ERR_OK; test/handshake_helper.c:133:16: Taking true branch 131. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 132. return SSL_TLSEXT_ERR_OK; 133. } else if (ignore) { ^ 134. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 135. return SSL_TLSEXT_ERR_NOACK; test/handshake_helper.c:134:9: 132. return SSL_TLSEXT_ERR_OK; 133. } else if (ignore) { 134. > ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 135. return SSL_TLSEXT_ERR_NOACK; 136. } else {
https://github.com/openssl/openssl/blob/0f5df0f1037590de12cc11eeab26fe29bf3f16a3/test/handshake_helper.c/#L134
d2a_code_trace_data_44704
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ecdh_ossl.c:69: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mul`. Showing all 15 steps of the trace crypto/ec/ecdh_ossl.c:52:5: Call 50. if ((ctx = BN_CTX_new()) == NULL) 51. goto err; 52. BN_CTX_start(ctx); ^ 53. x = BN_CTX_get(ctx); 54. if (x == NULL) { crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/ec/ecdh_ossl.c:69:14: Call 67. if (EC_KEY_get_flags(ecdh) & EC_FLAG_COFACTOR_ECDH) { 68. if (!EC_GROUP_get_cofactor(group, x, NULL) || 69. !BN_mul(x, x, priv_key, ctx)) { ^ 70. ECerr(EC_F_ECDH_SIMPLE_COMPUTE_KEY, ERR_R_MALLOC_FAILURE); 71. 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:533:5: Call 531. top = al + bl; 532. 533. BN_CTX_start(ctx); ^ 534. if ((r == a) || (r == b)) { 535. if ((rr = BN_CTX_get(ctx)) == NULL) crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_mul.c:618:5: Call 616. err: 617. bn_check_top(r); 618. BN_CTX_end(ctx); ^ 619. return ret; 620. } crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mul` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_44705
int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush){ AVPacketList *pktl, **next_point, *this_pktl; int stream_count=0; int streams[MAX_STREAMS]; if(pkt){ AVStream *st= s->streams[ pkt->stream_index]; this_pktl = av_mallocz(sizeof(AVPacketList)); this_pktl->pkt= *pkt; if(pkt->destruct == av_destruct_packet) pkt->destruct= NULL; else av_dup_packet(&this_pktl->pkt); next_point = &s->packet_buffer; while(*next_point){ AVStream *st2= s->streams[ (*next_point)->pkt.stream_index]; int64_t left= st2->time_base.num * (int64_t)st ->time_base.den; int64_t right= st ->time_base.num * (int64_t)st2->time_base.den; if((*next_point)->pkt.dts * left > pkt->dts * right) break; next_point= &(*next_point)->next; } this_pktl->next= *next_point; *next_point= this_pktl; } memset(streams, 0, sizeof(streams)); pktl= s->packet_buffer; while(pktl){ if(streams[ pktl->pkt.stream_index ] == 0) stream_count++; streams[ pktl->pkt.stream_index ]++; pktl= pktl->next; } if(stream_count && (s->nb_streams == stream_count || flush)){ pktl= s->packet_buffer; *out= pktl->pkt; s->packet_buffer= pktl->next; av_freep(&pktl); return 1; }else{ av_init_packet(out); return 0; } } libavformat/utils.c:2609: error: Null Dereference pointer `this_pktl` last assigned on line 2608 could be null and is dereferenced at line 2609, column 9. libavformat/utils.c:2598:1: start of procedure av_interleave_packet_per_dts() 2596. } 2597. 2598. int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush){ ^ 2599. AVPacketList *pktl, **next_point, *this_pktl; 2600. int stream_count=0; libavformat/utils.c:2600:5: 2598. int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush){ 2599. AVPacketList *pktl, **next_point, *this_pktl; 2600. int stream_count=0; ^ 2601. int streams[MAX_STREAMS]; 2602. libavformat/utils.c:2603:8: Taking true branch 2601. int streams[MAX_STREAMS]; 2602. 2603. if(pkt){ ^ 2604. AVStream *st= s->streams[ pkt->stream_index]; 2605. libavformat/utils.c:2604:9: 2602. 2603. if(pkt){ 2604. AVStream *st= s->streams[ pkt->stream_index]; ^ 2605. 2606. // assert(pkt->destruct != av_destruct_packet); //FIXME libavformat/utils.c:2608:9: 2606. // assert(pkt->destruct != av_destruct_packet); //FIXME 2607. 2608. this_pktl = av_mallocz(sizeof(AVPacketList)); ^ 2609. this_pktl->pkt= *pkt; 2610. if(pkt->destruct == av_destruct_packet) libavutil/mem.c:132:1: start of procedure av_mallocz() 130. } 131. 132. void *av_mallocz(unsigned int size) ^ 133. { 134. void *ptr = av_malloc(size); libavutil/mem.c:134:5: 132. void *av_mallocz(unsigned int size) 133. { 134. void *ptr = av_malloc(size); ^ 135. if (ptr) 136. memset(ptr, 0, size); libavutil/mem.c:42:1: start of procedure av_malloc() 40. linker will do it automatically */ 41. 42. void *av_malloc(unsigned int size) ^ 43. { 44. void *ptr; libavutil/mem.c:50:8: Taking false branch 48. 49. /* let's disallow possible ambiguous cases */ 50. if(size > (INT_MAX-16) ) ^ 51. return NULL; 52. libavutil/mem.c:61:5: Skipping memalign(): method has no implementation 59. ((char*)ptr)[-1]= diff; 60. #elif defined (HAVE_MEMALIGN) 61. ptr = memalign(16,size); ^ 62. /* Why 64? 63. Indeed, we should align it: libavutil/mem.c:91:5: 89. ptr = malloc(size); 90. #endif 91. return ptr; ^ 92. } 93. libavutil/mem.c:92:1: return from a call to av_malloc 90. #endif 91. return ptr; 92. } ^ 93. 94. void *av_realloc(void *ptr, unsigned int size) libavutil/mem.c:135:9: Taking false branch 133. { 134. void *ptr = av_malloc(size); 135. if (ptr) ^ 136. memset(ptr, 0, size); 137. return ptr; libavutil/mem.c:137:5: 135. if (ptr) 136. memset(ptr, 0, size); 137. return ptr; ^ 138. } 139. libavutil/mem.c:138:1: return from a call to av_mallocz 136. memset(ptr, 0, size); 137. return ptr; 138. } ^ 139. 140. char *av_strdup(const char *s) libavformat/utils.c:2609:9: 2607. 2608. this_pktl = av_mallocz(sizeof(AVPacketList)); 2609. this_pktl->pkt= *pkt; ^ 2610. if(pkt->destruct == av_destruct_packet) 2611. pkt->destruct= NULL; // not shared -> must keep original from being freed
https://github.com/libav/libav/blob/beca9a286c46a67b39fde5fab62a60d0766fc5ad/libavformat/utils.c/#L2609
d2a_code_trace_data_44706
static int do_multi(int multi, int size_num) { int n; int fd[2]; int *fds; static char sep[] = ":"; fds = malloc(sizeof(*fds) * multi); for (n = 0; n < multi; ++n) { if (pipe(fd) == -1) { BIO_printf(bio_err, "pipe failure\n"); exit(1); } fflush(stdout); (void)BIO_flush(bio_err); if (fork()) { close(fd[1]); fds[n] = fd[0]; } else { close(fd[0]); close(1); if (dup(fd[1]) == -1) { BIO_printf(bio_err, "dup failed\n"); exit(1); } close(fd[1]); mr = 1; usertime = 0; free(fds); return 0; } printf("Forked child %d\n", n); } for (n = 0; n < multi; ++n) { FILE *f; char buf[1024]; char *p; f = fdopen(fds[n], "r"); while (fgets(buf, sizeof(buf), f)) { p = strchr(buf, '\n'); if (p) *p = '\0'; if (buf[0] != '+') { BIO_printf(bio_err, "Don't understand line '%s' from child %d\n", buf, n); continue; } printf("Got: %s from %d\n", buf, n); if (strncmp(buf, "+F:", 3) == 0) { int alg; int j; p = buf + 3; alg = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); for (j = 0; j < size_num; ++j) results[alg][j] += atof(sstrsep(&p, sep)); } else if (strncmp(buf, "+F2:", 4) == 0) { int k; double d; p = buf + 4; k = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); d = atof(sstrsep(&p, sep)); rsa_results[k][0] += d; d = atof(sstrsep(&p, sep)); rsa_results[k][1] += d; } # ifndef OPENSSL_NO_DSA else if (strncmp(buf, "+F3:", 4) == 0) { int k; double d; p = buf + 4; k = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); d = atof(sstrsep(&p, sep)); dsa_results[k][0] += d; d = atof(sstrsep(&p, sep)); dsa_results[k][1] += d; } # endif # ifndef OPENSSL_NO_EC else if (strncmp(buf, "+F4:", 4) == 0) { int k; double d; p = buf + 4; k = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); d = atof(sstrsep(&p, sep)); ecdsa_results[k][0] += d; d = atof(sstrsep(&p, sep)); ecdsa_results[k][1] += d; } else if (strncmp(buf, "+F5:", 4) == 0) { int k; double d; p = buf + 4; k = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); d = atof(sstrsep(&p, sep)); ecdh_results[k][0] += d; } # endif else if (strncmp(buf, "+H:", 3) == 0) { ; } else BIO_printf(bio_err, "Unknown type '%s' from child %d\n", buf, n); } fclose(f); } free(fds); return 1; } apps/speed.c:3165: error: NULL_DEREFERENCE pointer `fds` last assigned on line 3155 could be null and is dereferenced at line 3165, column 13. Showing all 19 steps of the trace apps/speed.c:3148:1: start of procedure do_multi() 3146. } 3147. 3148. > static int do_multi(int multi, int size_num) 3149. { 3150. int n; apps/speed.c:3153:5: 3151. int fd[2]; 3152. int *fds; 3153. > static char sep[] = ":"; 3154. 3155. fds = malloc(sizeof(*fds) * multi); apps/speed.c:3155:5: 3153. static char sep[] = ":"; 3154. 3155. > fds = malloc(sizeof(*fds) * multi); 3156. for (n = 0; n < multi; ++n) { 3157. if (pipe(fd) == -1) { apps/speed.c:3156:10: 3154. 3155. fds = malloc(sizeof(*fds) * multi); 3156. > for (n = 0; n < multi; ++n) { 3157. if (pipe(fd) == -1) { 3158. BIO_printf(bio_err, "pipe failure\n"); apps/speed.c:3156:17: Loop condition is true. Entering loop body 3154. 3155. fds = malloc(sizeof(*fds) * multi); 3156. for (n = 0; n < multi; ++n) { ^ 3157. if (pipe(fd) == -1) { 3158. BIO_printf(bio_err, "pipe failure\n"); apps/speed.c:3157:13: Taking false branch 3155. fds = malloc(sizeof(*fds) * multi); 3156. for (n = 0; n < multi; ++n) { 3157. if (pipe(fd) == -1) { ^ 3158. BIO_printf(bio_err, "pipe failure\n"); 3159. exit(1); apps/speed.c:3161:9: 3159. exit(1); 3160. } 3161. > fflush(stdout); 3162. (void)BIO_flush(bio_err); 3163. if (fork()) { apps/speed.c:3162:15: 3160. } 3161. fflush(stdout); 3162. > (void)BIO_flush(bio_err); 3163. if (fork()) { 3164. close(fd[1]); crypto/bio/bio_lib.c:510:1: start of procedure BIO_ctrl() 508. } 509. 510. > long BIO_ctrl(BIO *b, int cmd, long larg, void *parg) 511. { 512. long ret; crypto/bio/bio_lib.c:514:9: Taking false branch 512. long ret; 513. 514. if (b == NULL) ^ 515. return 0; 516. crypto/bio/bio_lib.c:517:10: Taking false branch 515. return 0; 516. 517. if ((b->method == NULL) || (b->method->ctrl == NULL)) { ^ 518. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); 519. return -2; crypto/bio/bio_lib.c:517:33: Taking true branch 515. return 0; 516. 517. if ((b->method == NULL) || (b->method->ctrl == NULL)) { ^ 518. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); 519. return -2; crypto/bio/bio_lib.c:518:9: Skipping ERR_put_error(): empty list of specs 516. 517. if ((b->method == NULL) || (b->method->ctrl == NULL)) { 518. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); ^ 519. return -2; 520. } crypto/bio/bio_lib.c:519:9: 517. if ((b->method == NULL) || (b->method->ctrl == NULL)) { 518. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); 519. > return -2; 520. } 521. crypto/bio/bio_lib.c:535:1: return from a call to BIO_ctrl 533. 534. return ret; 535. > } 536. 537. long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp) apps/speed.c:3162:9: 3160. } 3161. fflush(stdout); 3162. > (void)BIO_flush(bio_err); 3163. if (fork()) { 3164. close(fd[1]); apps/speed.c:3163:13: Taking true branch 3161. fflush(stdout); 3162. (void)BIO_flush(bio_err); 3163. if (fork()) { ^ 3164. close(fd[1]); 3165. fds[n] = fd[0]; apps/speed.c:3164:13: 3162. (void)BIO_flush(bio_err); 3163. if (fork()) { 3164. > close(fd[1]); 3165. fds[n] = fd[0]; 3166. } else { apps/speed.c:3165:13: 3163. if (fork()) { 3164. close(fd[1]); 3165. > fds[n] = fd[0]; 3166. } else { 3167. close(fd[0]);
https://github.com/openssl/openssl/blob/c22365b399f62af4a81e9202500cd2cbd9c23a9d/apps/speed.c/#L3165
d2a_code_trace_data_44707
BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n) { BN_ULONG t1,t2; int c=0; assert(n >= 0); if (n <= 0) return((BN_ULONG)0); #ifndef OPENSSL_SMALL_FOOTPRINT while (n&~3) { t1=a[0]; t2=b[0]; r[0]=(t1-t2-c)&BN_MASK2; if (t1 != t2) c=(t1 < t2); t1=a[1]; t2=b[1]; r[1]=(t1-t2-c)&BN_MASK2; if (t1 != t2) c=(t1 < t2); t1=a[2]; t2=b[2]; r[2]=(t1-t2-c)&BN_MASK2; if (t1 != t2) c=(t1 < t2); t1=a[3]; t2=b[3]; r[3]=(t1-t2-c)&BN_MASK2; if (t1 != t2) c=(t1 < t2); a+=4; b+=4; r+=4; n-=4; } #endif while (n) { t1=a[0]; t2=b[0]; r[0]=(t1-t2-c)&BN_MASK2; if (t1 != t2) c=(t1 < t2); a++; b++; r++; n--; } return(c); } crypto/bn/bn_exp.c:733: error: INTEGER_OVERFLOW_L2 ([0, max(4294967295, `*in_mont->RR.d`)] - [0, max(4294967295, `*in_mont->RR.d`)]):unsigned32 by call to `BN_mod_mul_montgomery`. Showing all 19 steps of the trace crypto/bn/bn_exp.c:625:1: Parameter `*in_mont->RR.d` 623. * http://www.daemonology.net/hyperthreading-considered-harmful/) 624. */ 625. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 626. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 627. { crypto/bn/bn_exp.c:733:12: Call 731. if (!BN_to_montgomery(&am,&am,mont,ctx)) goto err; 732. } 733. else if (!BN_to_montgomery(&am,a,mont,ctx)) goto err; ^ 734. 735. #if defined(OPENSSL_BN_ASM_MONT) && (defined(__sparc__) || defined(__sparc)) crypto/bn/bn_mont.c:131:1: Parameter `*b->d` 129. #endif 130. 131. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 132. BN_MONT_CTX *mont, BN_CTX *ctx) 133. { crypto/bn/bn_mont.c:163:8: Call 161. else 162. { 163. if (!BN_mul(tmp,a,b,ctx)) goto err; ^ 164. } 165. /* reduce from aRR to aR */ crypto/bn/bn_mul.c:943:1: Parameter `*b->d` 941. #endif /* BN_RECURSION */ 942. 943. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 944. { 945. int ret=0; crypto/bn/bn_mul.c:1032:5: Call 1030. if (bn_wexpand(t,k*4) == NULL) goto err; 1031. if (bn_wexpand(rr,k*4) == NULL) goto err; 1032. bn_mul_part_recursive(rr->d,a->d,b->d, ^ 1033. j,al-j,bl-j,t->d); 1034. } crypto/bn/bn_mul.c:550:1: Parameter `*b` 548. * t needs to be n*4 is size, as does r */ 549. /* tnX may not be negative but less than n */ 550. > void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n, 551. int tna, int tnb, BN_ULONG *t) 552. { crypto/bn/bn_mul.c:569:5: Call 567. /* r=(a[0]-a[1])*(b[1]-b[0]) */ 568. c1=bn_cmp_part_words(a,&(a[n]),tna,n-tna); 569. c2=bn_cmp_part_words(&(b[n]),b,tnb,tnb-n); ^ 570. neg=0; 571. switch (c1*3+c2) crypto/bn/bn_lib.c:807:1: Parameter `*b` 805. All lengths are the number of BN_ULONGs... */ 806. 807. > int bn_cmp_part_words(const BN_ULONG *a, const BN_ULONG *b, 808. int cl, int dl) 809. { crypto/bn/bn_mul.c:575:3: Call 573. case -4: 574. bn_sub_part_words(t, &(a[n]),a, tna,tna-n); /* - */ 575. bn_sub_part_words(&(t[n]),b, &(b[n]),tnb,n-tnb); /* - */ ^ 576. break; 577. case -3: crypto/bn/bn_mul.c:80:1: Parameter `*b` 78. assembler counterparts for the systems that use assembler files. */ 79. 80. > BN_ULONG bn_sub_part_words(BN_ULONG *r, 81. const BN_ULONG *a, const BN_ULONG *b, 82. int cl, int dl) crypto/bn/bn_mul.c:87:6: Call 85. 86. assert(cl >= 0); 87. c = bn_sub_words(r, a, b, cl); ^ 88. 89. if (dl == 0) crypto/bn/bn_asm.c:394:1: <LHS trace> 392. #endif /* !BN_LLONG */ 393. 394. > BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n) 395. { 396. BN_ULONG t1,t2; crypto/bn/bn_asm.c:394:1: Parameter `*a` 392. #endif /* !BN_LLONG */ 393. 394. > BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n) 395. { 396. BN_ULONG t1,t2; crypto/bn/bn_asm.c:405:3: Assignment 403. while (n&~3) 404. { 405. t1=a[0]; t2=b[0]; ^ 406. r[0]=(t1-t2-c)&BN_MASK2; 407. if (t1 != t2) c=(t1 < t2); crypto/bn/bn_asm.c:394:1: <RHS trace> 392. #endif /* !BN_LLONG */ 393. 394. > BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n) 395. { 396. BN_ULONG t1,t2; crypto/bn/bn_asm.c:394:1: Parameter `*b` 392. #endif /* !BN_LLONG */ 393. 394. > BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n) 395. { 396. BN_ULONG t1,t2; crypto/bn/bn_asm.c:405:12: Assignment 403. while (n&~3) 404. { 405. t1=a[0]; t2=b[0]; ^ 406. r[0]=(t1-t2-c)&BN_MASK2; 407. if (t1 != t2) c=(t1 < t2); crypto/bn/bn_asm.c:406:3: Binary operation: ([0, max(4294967295, *in_mont->RR.d)] - [0, max(4294967295, *in_mont->RR.d)]):unsigned32 by call to `BN_mod_mul_montgomery` 404. { 405. t1=a[0]; t2=b[0]; 406. r[0]=(t1-t2-c)&BN_MASK2; ^ 407. if (t1 != t2) c=(t1 < t2); 408. t1=a[1]; t2=b[1];
https://github.com/openssl/openssl/blob/a9d14832fd98cb0c13b53fddea39765fb259358c/crypto/bn/bn_asm.c/#L406
d2a_code_trace_data_44708
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:323: error: BUFFER_OVERRUN_L2 Offset: [0, 536870912] (⇐ [0, 1] + [0, 536870911]) Size: 2 by call to `create_EC_group`. Showing all 8 steps of the trace test/sm2_internal_test.c:323:9: Call 321. /* From draft-shen-sm2-ecdsa-02 */ 322. EC_GROUP *test_group = 323. create_EC_group ^ 324. ("8542D69E4C044F18E8B92435BF6FF7DE457283915C45517D722EDB8B08F1DFC3", 325. "787968B4FA32C3FD2417842E73BBFEFF2F3C848B6831D7E0EC65228B3937E498", test/sm2_internal_test.c:74:1: Parameter `*cof_hex` 72. } 73. 74. > static EC_GROUP *create_EC_group(const char *p_hex, const char *a_hex, 75. const char *b_hex, const char *x_hex, 76. const char *y_hex, const char *order_hex, test/sm2_internal_test.c:110:17: Call 108. 109. if (!TEST_true(BN_hex2bn(&order, order_hex)) 110. || !TEST_true(BN_hex2bn(&cof, cof_hex)) ^ 111. || !TEST_true(EC_GROUP_set_generator(group, generator, order, cof))) 112. 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: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 `create_EC_group` 139. } 140. 141. for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++) ^ 142. continue; 143.
https://github.com/openssl/openssl/blob/630fe1da888490b7dfef3fe0928b813ddff5d51a/crypto/bn/bn_print.c/#L141
d2a_code_trace_data_44709
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) { int i, j, max; const BN_ULONG *ap; BN_ULONG *rp; max = n * 2; ap = a; rp = r; rp[0] = rp[max - 1] = 0; rp++; j = n; if (--j > 0) { ap++; rp[j] = bn_mul_words(rp, ap, j, ap[-1]); rp += 2; } for (i = n - 2; i > 0; i--) { j--; ap++; rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]); rp += 2; } bn_add_words(r, r, r, max); bn_sqr_words(tmp, a, n); bn_add_words(r, r, tmp, max); } test/srptest.c:69: error: BUFFER_OVERRUN_L3 Offset: [31, +oo] Size: [0, 8388607] by call to `SRP_create_verifier_BN`. Showing all 23 steps of the trace test/srptest.c:69:10: Call 67. 68. /* Set up server's password entry */ 69. if (!TEST_true(SRP_create_verifier_BN(username, server_pass, ^ 70. &s, &v, GN->N, GN->g))) 71. goto end; crypto/srp/srp_vfy.c:633:1: Parameter `g->top` 631. * BIGNUMS. 632. */ 633. > int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, 634. BIGNUM **verifier, const BIGNUM *N, 635. const BIGNUM *g) crypto/srp/srp_vfy.c:664:10: Call 662. goto err; 663. 664. if (!BN_mod_exp(*verifier, g, x, N, bn_ctx)) { ^ 665. BN_clear_free(*verifier); 666. goto err; crypto/bn/bn_exp.c:91:1: Parameter `a->top` 89. } 90. 91. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 92. BN_CTX *ctx) 93. { crypto/bn/bn_exp.c:144:19: Call 142. } else 143. # endif 144. ret = BN_mod_exp_mont(r, a, p, m, ctx, NULL); ^ 145. } else 146. #endif crypto/bn/bn_exp.c:294:1: Parameter `a->top` 292. } 293. 294. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 295. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 296. { crypto/bn/bn_exp.c:306:16: Call 304. 305. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { 306. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 307. } 308. crypto/bn/bn_exp.c:594:1: Parameter `a->top` 592. * http://www.daemonology.net/hyperthreading-considered-harmful/) 593. */ 594. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 595. const BIGNUM *m, BN_CTX *ctx, 596. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:751:17: Call 749. if (!BN_to_montgomery(&am, &am, mont, ctx)) 750. goto err; 751. } else if (!BN_to_montgomery(&am, a, mont, ctx)) ^ 752. goto err; 753. crypto/bn/bn_lib.c:877:1: Parameter `a->top` 875. } 876. 877. > int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 878. BN_CTX *ctx) 879. { crypto/bn/bn_lib.c:880:12: Call 878. BN_CTX *ctx) 879. { 880. return BN_mod_mul_montgomery(r, a, &(mont->RR), mont, ctx); ^ 881. } 882. crypto/bn/bn_mont.c:26:1: Parameter `a->top` 24. #endif 25. 26. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 27. BN_MONT_CTX *mont, BN_CTX *ctx) 28. { crypto/bn/bn_mont.c:53:14: Call 51. bn_check_top(tmp); 52. if (a == b) { 53. if (!BN_sqr(tmp, a, ctx)) ^ 54. goto err; 55. } else { crypto/bn/bn_sqr.c:17:1: Parameter `a->top` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int max, al; crypto/bn/bn_sqr.c:25:5: Assignment 23. bn_check_top(a); 24. 25. al = a->top; ^ 26. if (al <= 0) { 27. r->top = 0; crypto/bn/bn_sqr.c:74:17: Call 72. if (bn_wexpand(tmp, max) == NULL) 73. goto err; 74. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 75. } 76. } crypto/bn/bn_sqr.c:105:1: <Offset trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `n` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:111:5: Assignment 109. BN_ULONG *rp; 110. 111. max = n * 2; ^ 112. ap = a; 113. rp = r; crypto/bn/bn_sqr.c:105:1: <Length trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `*r` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:113:5: Assignment 111. max = n * 2; 112. ap = a; 113. rp = r; ^ 114. rp[0] = rp[max - 1] = 0; 115. rp++; crypto/bn/bn_sqr.c:114:13: Array access: Offset: [31, +oo] Size: [0, 8388607] by call to `SRP_create_verifier_BN` 112. ap = a; 113. rp = r; 114. rp[0] = rp[max - 1] = 0; ^ 115. rp++; 116. j = n;
https://github.com/openssl/openssl/blob/b66411f6cda6970c01283ddde6d8063c57b3b7d9/crypto/bn/bn_sqr.c/#L114
d2a_code_trace_data_44710
static void new_audio_stream(AVFormatContext *oc) { AVStream *st; AVCodecContext *audio_enc; enum CodecID codec_id; st = av_new_stream(oc, streamid_map[oc->nb_streams]); if (!st) { fprintf(stderr, "Could not alloc stream\n"); av_exit(1); } avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_AUDIO); bitstream_filters[nb_output_files][oc->nb_streams - 1]= audio_bitstream_filters; audio_bitstream_filters= NULL; avcodec_thread_init(st->codec, thread_count); audio_enc = st->codec; audio_enc->codec_type = AVMEDIA_TYPE_AUDIO; if(audio_codec_tag) audio_enc->codec_tag= audio_codec_tag; if (oc->oformat->flags & AVFMT_GLOBALHEADER) { audio_enc->flags |= CODEC_FLAG_GLOBAL_HEADER; avcodec_opts[AVMEDIA_TYPE_AUDIO]->flags|= CODEC_FLAG_GLOBAL_HEADER; } if (audio_stream_copy) { st->stream_copy = 1; audio_enc->channels = audio_channels; audio_enc->sample_rate = audio_sample_rate; } else { AVCodec *codec; set_context_opts(audio_enc, avcodec_opts[AVMEDIA_TYPE_AUDIO], AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM); if (audio_codec_name) { codec_id = find_codec_or_die(audio_codec_name, AVMEDIA_TYPE_AUDIO, 1, audio_enc->strict_std_compliance); codec = avcodec_find_encoder_by_name(audio_codec_name); output_codecs[nb_ocodecs] = codec; } else { codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_AUDIO); codec = avcodec_find_encoder(codec_id); } audio_enc->codec_id = codec_id; if (audio_qscale > QSCALE_NONE) { audio_enc->flags |= CODEC_FLAG_QSCALE; audio_enc->global_quality = st->quality = FF_QP2LAMBDA * audio_qscale; } audio_enc->channels = audio_channels; audio_enc->sample_fmt = audio_sample_fmt; audio_enc->sample_rate = audio_sample_rate; audio_enc->channel_layout = channel_layout; if (avcodec_channel_layout_num_channels(channel_layout) != audio_channels) audio_enc->channel_layout = 0; choose_sample_fmt(st, codec); choose_sample_rate(st, codec); } nb_ocodecs++; audio_enc->time_base= (AVRational){1, audio_sample_rate}; if (audio_language) { av_metadata_set2(&st->metadata, "language", audio_language, 0); av_freep(&audio_language); } audio_disable = 0; av_freep(&audio_codec_name); audio_stream_copy = 0; } ffmpeg.c:3498: error: Null Dereference pointer `st` last assigned on line 3493 could be null and is dereferenced at line 3498, column 35. ffmpeg.c:3487:1: start of procedure new_audio_stream() 3485. } 3486. 3487. static void new_audio_stream(AVFormatContext *oc) ^ 3488. { 3489. AVStream *st; ffmpeg.c:3493:5: 3491. enum CodecID codec_id; 3492. 3493. st = av_new_stream(oc, streamid_map[oc->nb_streams]); ^ 3494. if (!st) { 3495. fprintf(stderr, "Could not alloc stream\n"); libavformat/utils.c:2500:1: start of procedure av_new_stream() 2498. } 2499. 2500. AVStream *av_new_stream(AVFormatContext *s, int id) ^ 2501. { 2502. AVStream *st; libavformat/utils.c:2505:9: Taking true branch 2503. int i; 2504. 2505. if (s->nb_streams >= MAX_STREAMS){ ^ 2506. av_log(s, AV_LOG_ERROR, "Too many streams\n"); 2507. return NULL; libavformat/utils.c:2506:9: Skipping av_log(): empty list of specs 2504. 2505. if (s->nb_streams >= MAX_STREAMS){ 2506. av_log(s, AV_LOG_ERROR, "Too many streams\n"); ^ 2507. return NULL; 2508. } libavformat/utils.c:2507:9: 2505. if (s->nb_streams >= MAX_STREAMS){ 2506. av_log(s, AV_LOG_ERROR, "Too many streams\n"); 2507. return NULL; ^ 2508. } 2509. libavformat/utils.c:2542:1: return from a call to av_new_stream 2540. s->streams[s->nb_streams++] = st; 2541. return st; 2542. } ^ 2543. 2544. AVProgram *av_new_program(AVFormatContext *ac, int id) ffmpeg.c:3494:10: Taking true branch 3492. 3493. st = av_new_stream(oc, streamid_map[oc->nb_streams]); 3494. if (!st) { ^ 3495. fprintf(stderr, "Could not alloc stream\n"); 3496. av_exit(1); ffmpeg.c:3495:9: 3493. st = av_new_stream(oc, streamid_map[oc->nb_streams]); 3494. if (!st) { 3495. fprintf(stderr, "Could not alloc stream\n"); ^ 3496. av_exit(1); 3497. } ffmpeg.c:3496:9: Skipping av_exit(): empty list of specs 3494. if (!st) { 3495. fprintf(stderr, "Could not alloc stream\n"); 3496. av_exit(1); ^ 3497. } 3498. avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_AUDIO); ffmpeg.c:3498:5: 3496. av_exit(1); 3497. } 3498. avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_AUDIO); ^ 3499. 3500. bitstream_filters[nb_output_files][oc->nb_streams - 1]= audio_bitstream_filters;
https://github.com/libav/libav/blob/66b84e4ab2fc96222dab32173d84f4a403129deb/ffmpeg.c/#L3498
d2a_code_trace_data_44711
int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x) { int rv; if (x == NULL) { SSLerr(SSL_F_SSL_CTX_USE_CERTIFICATE, ERR_R_PASSED_NULL_PARAMETER); return (0); } rv = ssl_security_cert(NULL, ctx, x, 0, 1); if (rv != 1) { SSLerr(SSL_F_SSL_CTX_USE_CERTIFICATE, rv); return 0; } return (ssl_set_cert(ctx->cert, x)); } ssl/ssl_rsa.c:357: error: NULL_DEREFERENCE pointer `null` is dereferenced by call to `ssl_security_cert()` at line 357, column 10. Showing all 3 steps of the trace ssl/ssl_rsa.c:350:1: start of procedure SSL_CTX_use_certificate() 348. } 349. 350. > int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x) 351. { 352. int rv; ssl/ssl_rsa.c:353:9: Taking false branch 351. { 352. int rv; 353. if (x == NULL) { ^ 354. SSLerr(SSL_F_SSL_CTX_USE_CERTIFICATE, ERR_R_PASSED_NULL_PARAMETER); 355. return (0); ssl/ssl_rsa.c:357:5: 355. return (0); 356. } 357. > rv = ssl_security_cert(NULL, ctx, x, 0, 1); 358. if (rv != 1) { 359. SSLerr(SSL_F_SSL_CTX_USE_CERTIFICATE, rv);
https://github.com/openssl/openssl/blob/57ce7b617c602ae8513c22daa2bda31f179edb0f/ssl/ssl_rsa.c/#L357
d2a_code_trace_data_44712
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: [31, +oo] Size: [0, 8388607] by call to `SRP_Calc_server_key`. Showing all 24 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:74:17: Call 72. if (bn_wexpand(tmp, max) == NULL) 73. goto err; 74. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 75. } 76. } crypto/bn/bn_sqr.c:104:1: <Offset trace> 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:104:1: Parameter `n` 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:110:5: Assignment 108. BN_ULONG *rp; 109. 110. max = n * 2; ^ 111. ap = a; 112. rp = r; 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:113:13: Array access: Offset: [31, +oo] Size: [0, 8388607] by call to `SRP_Calc_server_key` 111. ap = a; 112. rp = r; 113. rp[0] = rp[max - 1] = 0; ^ 114. rp++; 115. j = n;
https://github.com/openssl/openssl/blob/b90506e995d44dee0ef4dd0324b56b59154256c2/crypto/bn/bn_sqr.c/#L113
d2a_code_trace_data_44713
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; } test/ecdsatest.c:132: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_hex2bn`. Showing all 21 steps of the trace test/ecdsatest.c:132:13: Call 130. || !TEST_ptr(r = BN_new()) 131. || !TEST_ptr(s = BN_new()) 132. || !TEST_true(BN_hex2bn(&r, r_in)) ^ 133. || !TEST_true(BN_hex2bn(&s, s_in)) 134. /* swap the RNG source */ crypto/bn/bn_print.c:126:1: Parameter `(*bn)->top` 124. } 125. 126. > int BN_hex2bn(BIGNUM **bn, const char *a) 127. { 128. BIGNUM *ret = NULL; crypto/bn/bn_print.c:157:9: Call 155. } else { 156. ret = *bn; 157. BN_zero(ret); ^ 158. } 159. crypto/bn/bn_lib.c:361:1: Parameter `a->top` 359. } 360. 361. > int BN_set_word(BIGNUM *a, BN_ULONG w) 362. { 363. bn_check_top(a); crypto/bn/bn_lib.c:364:9: Call 362. { 363. bn_check_top(a); 364. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 365. return 0; 366. a->neg = 0; crypto/bn/bn_lcl.h:660:1: Parameter `a->top` 658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 659. 660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 661. { 662. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_lcl.h:668:12: Call 666. return a; 667. 668. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2); ^ 669. } 670. crypto/bn/bn_lib.c:245:1: Parameter `b->top` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `words` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:224:13: Call 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/mem.c:228:1: Parameter `num` 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:17: Call 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/mem.c:230:5: Assignment 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:235:5: Assignment 233. if (ret != NULL) 234. memset(ret, 0, num); 235. return ret; ^ 236. } 237. crypto/bn/bn_lib.c:224:9: Assignment 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_hex2bn` 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/260a16f33682a819414fcba6161708a5e6bdff50/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_44714
static int cert_status_cb(SSL *s, void *arg) { tlsextstatusctx *srctx = arg; char *host = NULL, *port = NULL, *path = NULL; int use_ssl; unsigned char *rspder = NULL; int rspderlen; STACK_OF(OPENSSL_STRING) *aia = NULL; X509 *x = NULL; X509_STORE_CTX inctx; X509_OBJECT obj; OCSP_REQUEST *req = NULL; OCSP_RESPONSE *resp = NULL; OCSP_CERTID *id = NULL; STACK_OF(X509_EXTENSION) *exts; int ret = SSL_TLSEXT_ERR_NOACK; int i; if (srctx->verbose) BIO_puts(bio_err, "cert_status: callback called\n"); x = SSL_get_certificate(s); aia = X509_get1_ocsp(x); if (aia) { if (!OCSP_parse_url(sk_OPENSSL_STRING_value(aia, 0), &host, &port, &path, &use_ssl)) { BIO_puts(bio_err, "cert_status: can't parse AIA URL\n"); goto err; } if (srctx->verbose) BIO_printf(bio_err, "cert_status: AIA URL: %s\n", sk_OPENSSL_STRING_value(aia, 0)); } else { if (!srctx->host) { BIO_puts(bio_err, "cert_status: no AIA and no default responder URL\n"); goto done; } host = srctx->host; path = srctx->path; port = srctx->port; use_ssl = srctx->use_ssl; } if (!X509_STORE_CTX_init(&inctx, SSL_CTX_get_cert_store(SSL_get_SSL_CTX(s)), NULL, NULL)) goto err; if (X509_STORE_get_by_subject(&inctx, X509_LU_X509, X509_get_issuer_name(x), &obj) <= 0) { BIO_puts(bio_err, "cert_status: Can't retrieve issuer certificate.\n"); X509_STORE_CTX_cleanup(&inctx); goto done; } req = OCSP_REQUEST_new(); if (req == NULL) goto err; id = OCSP_cert_to_id(NULL, x, obj.data.x509); X509_free(obj.data.x509); X509_STORE_CTX_cleanup(&inctx); if (!id) goto err; if (!OCSP_request_add0_id(req, id)) goto err; id = NULL; SSL_get_tlsext_status_exts(s, &exts); for (i = 0; i < sk_X509_EXTENSION_num(exts); i++) { X509_EXTENSION *ext = sk_X509_EXTENSION_value(exts, i); if (!OCSP_REQUEST_add_ext(req, ext, -1)) goto err; } resp = process_responder(req, host, path, port, use_ssl, NULL, srctx->timeout); if (!resp) { BIO_puts(bio_err, "cert_status: error querying responder\n"); goto done; } rspderlen = i2d_OCSP_RESPONSE(resp, &rspder); if (rspderlen <= 0) goto err; SSL_set_tlsext_status_ocsp_resp(s, rspder, rspderlen); if (srctx->verbose) { BIO_puts(bio_err, "cert_status: ocsp response sent:\n"); OCSP_RESPONSE_print(bio_err, resp, 2); } ret = SSL_TLSEXT_ERR_OK; done: if (ret != SSL_TLSEXT_ERR_OK) ERR_print_errors(bio_err); if (aia) { OPENSSL_free(host); OPENSSL_free(path); OPENSSL_free(port); X509_email_free(aia); } OCSP_CERTID_free(id); OCSP_REQUEST_free(req); OCSP_RESPONSE_free(resp); return ret; err: ret = SSL_TLSEXT_ERR_ALERT_FATAL; goto done; } apps/s_server.c:636: error: NULL_DEREFERENCE pointer `x` last assigned on line 635 could be null and is dereferenced by call to `X509_get1_ocsp()` at line 636, column 11. Showing all 33 steps of the trace apps/s_server.c:614:1: start of procedure cert_status_cb() 612. */ 613. 614. > static int cert_status_cb(SSL *s, void *arg) 615. { 616. tlsextstatusctx *srctx = arg; apps/s_server.c:616:5: 614. static int cert_status_cb(SSL *s, void *arg) 615. { 616. > tlsextstatusctx *srctx = arg; 617. char *host = NULL, *port = NULL, *path = NULL; 618. int use_ssl; apps/s_server.c:617:5: 615. { 616. tlsextstatusctx *srctx = arg; 617. > char *host = NULL, *port = NULL, *path = NULL; 618. int use_ssl; 619. unsigned char *rspder = NULL; apps/s_server.c:619:5: 617. char *host = NULL, *port = NULL, *path = NULL; 618. int use_ssl; 619. > unsigned char *rspder = NULL; 620. int rspderlen; 621. STACK_OF(OPENSSL_STRING) *aia = NULL; apps/s_server.c:621:5: 619. unsigned char *rspder = NULL; 620. int rspderlen; 621. > STACK_OF(OPENSSL_STRING) *aia = NULL; 622. X509 *x = NULL; 623. X509_STORE_CTX inctx; apps/s_server.c:622:5: 620. int rspderlen; 621. STACK_OF(OPENSSL_STRING) *aia = NULL; 622. > X509 *x = NULL; 623. X509_STORE_CTX inctx; 624. X509_OBJECT obj; apps/s_server.c:625:5: 623. X509_STORE_CTX inctx; 624. X509_OBJECT obj; 625. > OCSP_REQUEST *req = NULL; 626. OCSP_RESPONSE *resp = NULL; 627. OCSP_CERTID *id = NULL; apps/s_server.c:626:5: 624. X509_OBJECT obj; 625. OCSP_REQUEST *req = NULL; 626. > OCSP_RESPONSE *resp = NULL; 627. OCSP_CERTID *id = NULL; 628. STACK_OF(X509_EXTENSION) *exts; apps/s_server.c:627:5: 625. OCSP_REQUEST *req = NULL; 626. OCSP_RESPONSE *resp = NULL; 627. > OCSP_CERTID *id = NULL; 628. STACK_OF(X509_EXTENSION) *exts; 629. int ret = SSL_TLSEXT_ERR_NOACK; apps/s_server.c:629:5: 627. OCSP_CERTID *id = NULL; 628. STACK_OF(X509_EXTENSION) *exts; 629. > int ret = SSL_TLSEXT_ERR_NOACK; 630. int i; 631. apps/s_server.c:632:9: Taking true branch 630. int i; 631. 632. if (srctx->verbose) ^ 633. BIO_puts(bio_err, "cert_status: callback called\n"); 634. /* Build up OCSP query from server certificate */ apps/s_server.c:633:9: 631. 632. if (srctx->verbose) 633. > BIO_puts(bio_err, "cert_status: callback called\n"); 634. /* Build up OCSP query from server certificate */ 635. x = SSL_get_certificate(s); crypto/bio/bio_lib.c:272:1: start of procedure BIO_puts() 270. } 271. 272. > int BIO_puts(BIO *b, const char *in) 273. { 274. int i; crypto/bio/bio_lib.c:277:10: Taking false branch 275. long (*cb) (BIO *, int, const char *, int, long, long); 276. 277. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) { ^ 278. BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD); 279. return (-2); crypto/bio/bio_lib.c:277:25: Taking false branch 275. long (*cb) (BIO *, int, const char *, int, long, long); 276. 277. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) { ^ 278. BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD); 279. return (-2); crypto/bio/bio_lib.c:277:48: Taking false branch 275. long (*cb) (BIO *, int, const char *, int, long, long); 276. 277. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) { ^ 278. BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD); 279. return (-2); crypto/bio/bio_lib.c:282:5: 280. } 281. 282. > cb = b->callback; 283. 284. if ((cb != NULL) && ((i = (int)cb(b, BIO_CB_PUTS, in, 0, 0L, 1L)) <= 0)) crypto/bio/bio_lib.c:284:10: Taking false branch 282. cb = b->callback; 283. 284. if ((cb != NULL) && ((i = (int)cb(b, BIO_CB_PUTS, in, 0, 0L, 1L)) <= 0)) ^ 285. return (i); 286. crypto/bio/bio_lib.c:287:10: Taking true branch 285. return (i); 286. 287. if (!b->init) { ^ 288. BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED); 289. return (-2); crypto/bio/bio_lib.c:288:9: Skipping ERR_put_error(): empty list of specs 286. 287. if (!b->init) { 288. BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED); ^ 289. return (-2); 290. } crypto/bio/bio_lib.c:289:9: 287. if (!b->init) { 288. BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED); 289. > return (-2); 290. } 291. crypto/bio/bio_lib.c:300:1: return from a call to BIO_puts 298. i = (int)cb(b, BIO_CB_PUTS | BIO_CB_RETURN, in, 0, 0L, (long)i); 299. return (i); 300. > } 301. 302. int BIO_gets(BIO *b, char *in, int inl) apps/s_server.c:635:5: 633. BIO_puts(bio_err, "cert_status: callback called\n"); 634. /* Build up OCSP query from server certificate */ 635. > x = SSL_get_certificate(s); 636. aia = X509_get1_ocsp(x); 637. if (aia) { ssl/ssl_lib.c:3229:1: start of procedure SSL_get_certificate() 3227. } 3228. 3229. > X509 *SSL_get_certificate(const SSL *s) 3230. { 3231. if (s->cert != NULL) ssl/ssl_lib.c:3231:9: Taking false branch 3229. X509 *SSL_get_certificate(const SSL *s) 3230. { 3231. if (s->cert != NULL) ^ 3232. return (s->cert->key->x509); 3233. else ssl/ssl_lib.c:3234:9: 3232. return (s->cert->key->x509); 3233. else 3234. > return (NULL); 3235. } 3236. ssl/ssl_lib.c:3235:1: return from a call to SSL_get_certificate 3233. else 3234. return (NULL); 3235. > } 3236. 3237. EVP_PKEY *SSL_get_privatekey(const SSL *s) apps/s_server.c:636:5: 634. /* Build up OCSP query from server certificate */ 635. x = SSL_get_certificate(s); 636. > aia = X509_get1_ocsp(x); 637. if (aia) { 638. if (!OCSP_parse_url(sk_OPENSSL_STRING_value(aia, 0), crypto/x509v3/v3_utl.c:534:1: start of procedure X509_get1_ocsp() 532. } 533. 534. > STACK_OF(OPENSSL_STRING) *X509_get1_ocsp(X509 *x) 535. { 536. AUTHORITY_INFO_ACCESS *info; crypto/x509v3/v3_utl.c:537:5: 535. { 536. AUTHORITY_INFO_ACCESS *info; 537. > STACK_OF(OPENSSL_STRING) *ret = NULL; 538. int i; 539. crypto/x509v3/v3_utl.c:540:5: 538. int i; 539. 540. > info = X509_get_ext_d2i(x, NID_info_access, NULL, NULL); 541. if (!info) 542. return NULL; crypto/x509/x509_ext.c:150:1: start of procedure X509_get_ext_d2i() 148. } 149. 150. > void *X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx) 151. { 152. return X509V3_get_d2i(x->cert_info.extensions, nid, crit, idx); crypto/x509/x509_ext.c:152:5: 150. void *X509_get_ext_d2i(X509 *x, int nid, int *crit, int *idx) 151. { 152. > return X509V3_get_d2i(x->cert_info.extensions, nid, crit, idx); 153. } 154.
https://github.com/openssl/openssl/blob/507c7c0ed6cbecbe16114dbbbb9fecc5ce5863a4/apps/s_server.c/#L636
d2a_code_trace_data_44715
void gf_mul(gf_s * RESTRICT cs, const gf as, const gf bs) { const uint32_t *a = as->limb, *b = bs->limb; uint32_t *c = cs->limb; uint64_t accum0 = 0, accum1 = 0, accum2 = 0; uint32_t mask = (1 << 28) - 1; uint32_t aa[8], bb[8]; int i, j; for (i = 0; i < 8; i++) { aa[i] = a[i] + a[i + 8]; bb[i] = b[i] + b[i + 8]; } FOR_LIMB(j, 0, 8, { accum2 = 0; FOR_LIMB(i, 0, j + 1, { accum2 += widemul(a[j - i], b[i]); accum1 += widemul(aa[j - i], bb[i]); accum0 += widemul(a[8 + j - i], b[8 + i]); } ); accum1 -= accum2; accum0 += accum2; accum2 = 0; FOR_LIMB(i, j + 1, 8, { accum0 -= widemul(a[8 + j - i], b[i]); accum2 += widemul(aa[8 + j - i], bb[i]); accum1 += widemul(a[16 + j - i], b[8 + i]); } ); accum1 += accum2; accum0 += accum2; c[j] = ((uint32_t)(accum0)) & mask; c[j + 8] = ((uint32_t)(accum1)) & mask; accum0 >>= 28; accum1 >>= 28; }); accum0 += accum1; accum0 += c[8]; accum1 += c[0]; c[8] = ((uint32_t)(accum0)) & mask; c[0] = ((uint32_t)(accum1)) & mask; accum0 >>= 28; accum1 >>= 28; c[9] += ((uint32_t)(accum0)); c[1] += ((uint32_t)(accum1)); } crypto/ec/curve448/arch_32/f_impl.c:37: error: UNINITIALIZED_VALUE The value read from aa[_] was never initialized. Showing all 1 steps of the trace crypto/ec/curve448/arch_32/f_impl.c:37:5: 35. } 36. 37. > FOR_LIMB(j, 0, 8, { 38. accum2 = 0; 39. FOR_LIMB(i, 0, j + 1, {
https://github.com/openssl/openssl/blob/0cdcdacc337005e08a906b2e07d4e44e3ee48138/crypto/ec/curve448/arch_32/f_impl.c/#L37
d2a_code_trace_data_44716
u_char * ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) { u_char *p, zero, *last; int d; float f, scale; size_t len, slen; int64_t i64; uint64_t ui64; ngx_msec_t ms; ngx_uint_t width, sign, hex, max_width, frac_width, i; ngx_str_t *v; ngx_variable_value_t *vv; if (max == 0) { return buf; } last = buf + max; while (*fmt && buf < last) { if (*fmt == '%') { i64 = 0; ui64 = 0; zero = (u_char) ((*++fmt == '0') ? '0' : ' '); width = 0; sign = 1; hex = 0; max_width = 0; frac_width = 0; slen = (size_t) -1; while (*fmt >= '0' && *fmt <= '9') { width = width * 10 + *fmt++ - '0'; } for ( ;; ) { switch (*fmt) { case 'u': sign = 0; fmt++; continue; case 'm': max_width = 1; fmt++; continue; case 'X': hex = 2; sign = 0; fmt++; continue; case 'x': hex = 1; sign = 0; fmt++; continue; case '.': fmt++; while (*fmt >= '0' && *fmt <= '9') { frac_width = frac_width * 10 + *fmt++ - '0'; } break; case '*': slen = va_arg(args, size_t); fmt++; continue; default: break; } break; } switch (*fmt) { case 'V': v = va_arg(args, ngx_str_t *); len = v->len; len = (buf + len < last) ? len : (size_t) (last - buf); buf = ngx_cpymem(buf, v->data, len); fmt++; continue; case 'v': vv = va_arg(args, ngx_variable_value_t *); len = vv->len; len = (buf + len < last) ? len : (size_t) (last - buf); buf = ngx_cpymem(buf, vv->data, len); fmt++; continue; case 's': p = va_arg(args, u_char *); if (slen == (size_t) -1) { while (*p && buf < last) { *buf++ = *p++; } } else { len = (buf + slen < last) ? slen : (size_t) (last - buf); buf = ngx_cpymem(buf, p, len); } fmt++; continue; case 'O': i64 = (int64_t) va_arg(args, off_t); sign = 1; break; case 'P': i64 = (int64_t) va_arg(args, ngx_pid_t); sign = 1; break; case 'T': i64 = (int64_t) va_arg(args, time_t); sign = 1; break; case 'M': ms = (ngx_msec_t) va_arg(args, ngx_msec_t); if ((ngx_msec_int_t) ms == -1) { sign = 1; i64 = -1; } else { sign = 0; ui64 = (uint64_t) ms; } break; case 'z': if (sign) { i64 = (int64_t) va_arg(args, ssize_t); } else { ui64 = (uint64_t) va_arg(args, size_t); } break; case 'i': if (sign) { i64 = (int64_t) va_arg(args, ngx_int_t); } else { ui64 = (uint64_t) va_arg(args, ngx_uint_t); } if (max_width) { width = NGX_INT_T_LEN; } break; case 'd': if (sign) { i64 = (int64_t) va_arg(args, int); } else { ui64 = (uint64_t) va_arg(args, u_int); } break; case 'l': if (sign) { i64 = (int64_t) va_arg(args, long); } else { ui64 = (uint64_t) va_arg(args, u_long); } break; case 'D': if (sign) { i64 = (int64_t) va_arg(args, int32_t); } else { ui64 = (uint64_t) va_arg(args, uint32_t); } break; case 'L': if (sign) { i64 = va_arg(args, int64_t); } else { ui64 = va_arg(args, uint64_t); } break; case 'A': if (sign) { i64 = (int64_t) va_arg(args, ngx_atomic_int_t); } else { ui64 = (uint64_t) va_arg(args, ngx_atomic_uint_t); } if (max_width) { width = NGX_ATOMIC_T_LEN; } break; case 'f': f = (float) va_arg(args, double); if (f < 0) { *buf++ = '-'; f = -f; } ui64 = (int64_t) f; buf = ngx_sprintf_num(buf, last, ui64, zero, 0, width); if (frac_width) { if (buf < last) { *buf++ = '.'; } scale = 1.0; for (i = 0; i < frac_width; i++) { scale *= 10.0; } ui64 = (uint64_t) ((f - (int64_t) ui64) * scale); buf = ngx_sprintf_num(buf, last, ui64, '0', 0, frac_width); } fmt++; continue; #if !(NGX_WIN32) case 'r': i64 = (int64_t) va_arg(args, rlim_t); sign = 1; break; #endif case 'p': ui64 = (uintptr_t) va_arg(args, void *); hex = 2; sign = 0; zero = '0'; width = NGX_PTR_SIZE * 2; break; case 'c': d = va_arg(args, int); *buf++ = (u_char) (d & 0xff); fmt++; continue; case 'Z': *buf++ = '\0'; fmt++; continue; case 'N': #if (NGX_WIN32) *buf++ = CR; #endif *buf++ = LF; fmt++; continue; case '%': *buf++ = '%'; fmt++; continue; default: *buf++ = *fmt++; continue; } if (sign) { if (i64 < 0) { *buf++ = '-'; ui64 = (uint64_t) -i64; } else { ui64 = (uint64_t) i64; } } buf = ngx_sprintf_num(buf, last, ui64, zero, hex, width); fmt++; } else { *buf++ = *fmt++; } } return buf; } src/http/ngx_http_variables.c:1249: error: Buffer Overrun L2 Offset: [0, 65535] Size: 20 by call to `ngx_sprintf`. src/http/ngx_http_variables.c:1244:9: Call 1242. } 1243. 1244. p = ngx_pnalloc(r->pool, NGX_OFF_T_LEN); ^ 1245. if (p == NULL) { 1246. return NGX_ERROR; src/core/ngx_palloc.c:155:13: Assignment 153. 154. do { 155. m = p->d.last; ^ 156. 157. if ((size_t) (p->d.end - m) >= size) { src/core/ngx_palloc.c:160:17: Assignment 158. p->d.last = m + size; 159. 160. return m; ^ 161. } 162. src/http/ngx_http_variables.c:1244:5: Assignment 1242. } 1243. 1244. p = ngx_pnalloc(r->pool, NGX_OFF_T_LEN); ^ 1245. if (p == NULL) { 1246. return NGX_ERROR; src/http/ngx_http_variables.c:1249:14: Call 1247. } 1248. 1249. v->len = ngx_sprintf(p, "%O", sent) - p; ^ 1250. v->valid = 1; 1251. v->no_cacheable = 0; src/core/ngx_string.c:95:1: Parameter `*buf` 93. 94. 95. u_char * ngx_cdecl ^ 96. ngx_sprintf(u_char *buf, const char *fmt, ...) 97. { src/core/ngx_string.c:102:9: Call 100. 101. va_start(args, fmt); 102. p = ngx_vsnprintf(buf, /* STUB */ 65536, fmt, args); ^ 103. va_end(args); 104. src/core/ngx_string.c:123:1: <Length trace> 121. 122. 123. u_char * ^ 124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) 125. { src/core/ngx_string.c:123:1: Parameter `*buf` 121. 122. 123. u_char * ^ 124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) 125. { src/core/ngx_string.c:244:25: Array access: Offset: [0, 65535] Size: 20 by call to `ngx_sprintf` 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_44717
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; bn_check_top(b); if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return (NULL); } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return (NULL); } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } crypto/bn/bn_prime.c:197: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_copy`. Showing all 16 steps of the trace crypto/bn/bn_prime.c:190:10: Call 188. BN_CTX_start(ctx); 189. 190. A1 = BN_CTX_get(ctx); ^ 191. A1_odd = BN_CTX_get(ctx); 192. check = 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:402:15: Assignment 400. a->neg = 0; 401. a->d[0] = w; 402. a->top = (w ? 1 : 0); ^ 403. bn_check_top(a); 404. return (1); crypto/bn/bn_lib.c:402:5: Assignment 400. a->neg = 0; 401. a->d[0] = w; 402. a->top = (w ? 1 : 0); ^ 403. bn_check_top(a); 404. return (1); crypto/bn/bn_prime.c:197:10: Call 195. 196. /* compute A1 := a - 1 */ 197. if (!BN_copy(A1, a)) ^ 198. goto err; 199. if (!BN_sub_word(A1, 1)) crypto/bn/bn_lib.c:323:1: Parameter `*a->d` 321. } 322. 323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 324. { 325. bn_check_top(b); crypto/bn/bn_lib.c:329:9: Call 327. if (a == b) 328. return a; 329. if (bn_wexpand(a, b->top) == NULL) ^ 330. return NULL; 331. 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_copy` 269. assert(b->top <= words); 270. if (b->top > 0) 271. memcpy(a, b->d, sizeof(*a) * b->top); ^ 272. 273. return a;
https://github.com/openssl/openssl/blob/757264207ad8650a89ea903d48ad89f61d56ea9c/crypto/bn/bn_lib.c/#L271
d2a_code_trace_data_44718
static int at1_unpack_dequant(GetBitContext* gb, AT1SUCtx* su, float spec[AT1_SU_SAMPLES]) { int bits_used, band_num, bfu_num, i; uint8_t idwls[AT1_MAX_BFU]; uint8_t idsfs[AT1_MAX_BFU]; su->num_bfus = bfu_amount_tab1[get_bits(gb, 3)]; bits_used = su->num_bfus * 10 + 32 + bfu_amount_tab2[get_bits(gb, 2)] + (bfu_amount_tab3[get_bits(gb, 3)] << 1); for (i = 0; i < su->num_bfus; i++) idwls[i] = get_bits(gb, 4); for (i = 0; i < su->num_bfus; i++) idsfs[i] = get_bits(gb, 6); for (i = su->num_bfus; i < AT1_MAX_BFU; i++) idwls[i] = idsfs[i] = 0; for (band_num = 0; band_num < AT1_QMF_BANDS; band_num++) { for (bfu_num = bfu_bands_t[band_num]; bfu_num < bfu_bands_t[band_num+1]; bfu_num++) { int pos; int num_specs = specs_per_bfu[bfu_num]; int word_len = !!idwls[bfu_num] + idwls[bfu_num]; float scale_factor = ff_atrac_sf_table[idsfs[bfu_num]]; bits_used += word_len * num_specs; if (bits_used > AT1_SU_MAX_BITS) return -1; pos = su->log2_block_count[band_num] ? bfu_start_short[bfu_num] : bfu_start_long[bfu_num]; if (word_len) { float max_quant = 1.0 / (float)((1 << (word_len - 1)) - 1); for (i = 0; i < num_specs; i++) { spec[pos+i] = get_sbits(gb, word_len) * scale_factor * max_quant; } } else { memset(&spec[pos], 0, num_specs * sizeof(float)); } } } return 0; } libavcodec/atrac1.c:225: error: Uninitialized Value The value read from idwls[_] was never initialized. libavcodec/atrac1.c:225:31: 223. 224. int num_specs = specs_per_bfu[bfu_num]; 225. int word_len = !!idwls[bfu_num] + idwls[bfu_num]; ^ 226. float scale_factor = ff_atrac_sf_table[idsfs[bfu_num]]; 227. bits_used += word_len * num_specs; /* add number of bits consumed by current BFU */
https://github.com/libav/libav/blob/a6d1bd05c906fc7ad34fae1029a45ec3cbcc4fcc/libavcodec/atrac1.c/#L225
d2a_code_trace_data_44719
SRP_VBASE *SRP_VBASE_new(char *seed_key) { SRP_VBASE *vb = OPENSSL_malloc(sizeof(*vb)); if (vb == NULL) return NULL; if ((vb->users_pwd = sk_SRP_user_pwd_new_null()) == NULL || (vb->gN_cache = sk_SRP_gN_cache_new_null()) == NULL) { OPENSSL_free(vb); return NULL; } vb->default_g = NULL; vb->default_N = NULL; vb->seed_key = NULL; if ((seed_key != NULL) && (vb->seed_key = OPENSSL_strdup(seed_key)) == NULL) { sk_SRP_user_pwd_free(vb->users_pwd); sk_SRP_gN_cache_free(vb->gN_cache); OPENSSL_free(vb); return NULL; } return vb; } crypto/srp/srp_vfy.c:258: error: MEMORY_LEAK memory dynamically allocated by call to `sk_SRP_user_pwd_new_null()` at line 256, column 26 is not reachable after line 258, column 9. Showing all 93 steps of the trace crypto/srp/srp_vfy.c:250:1: start of procedure SRP_VBASE_new() 248. } 249. 250. > SRP_VBASE *SRP_VBASE_new(char *seed_key) 251. { 252. SRP_VBASE *vb = OPENSSL_malloc(sizeof(*vb)); crypto/srp/srp_vfy.c:252:5: 250. SRP_VBASE *SRP_VBASE_new(char *seed_key) 251. { 252. > SRP_VBASE *vb = OPENSSL_malloc(sizeof(*vb)); 253. 254. if (vb == 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/srp/srp_vfy.c:254:9: Taking false branch 252. SRP_VBASE *vb = OPENSSL_malloc(sizeof(*vb)); 253. 254. if (vb == NULL) ^ 255. return NULL; 256. if ((vb->users_pwd = sk_SRP_user_pwd_new_null()) == NULL crypto/srp/srp_vfy.c:256:9: 254. if (vb == NULL) 255. return NULL; 256. > if ((vb->users_pwd = sk_SRP_user_pwd_new_null()) == NULL 257. || (vb->gN_cache = sk_SRP_gN_cache_new_null()) == NULL) { 258. OPENSSL_free(vb); include/openssl/srp.h:97:1: start of procedure sk_SRP_user_pwd_new_null() 95. } SRP_user_pwd; 96. 97. > DEFINE_STACK_OF(SRP_user_pwd) 98. 99. typedef struct SRP_VBASE_st { crypto/stack/stack.c:145:1: start of procedure sk_new_null() 143. } 144. 145. > _STACK *sk_new_null(void) 146. { 147. return sk_new((int (*)(const void *, const void *))0); crypto/stack/stack.c:147:5: 145. _STACK *sk_new_null(void) 146. { 147. > return sk_new((int (*)(const void *, const void *))0); 148. } 149. crypto/stack/stack.c:150:1: start of procedure sk_new() 148. } 149. 150. > _STACK *sk_new(int (*c) (const void *, const void *)) 151. { 152. _STACK *ret; crypto/stack/stack.c:154:9: 152. _STACK *ret; 153. 154. > if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/stack/stack.c:154:9: Taking false branch 152. _STACK *ret; 153. 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) ^ 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) crypto/stack/stack.c:156:9: 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. > if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) 157. goto err; 158. ret->comp = c; crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/stack/stack.c:156:9: Taking false branch 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) ^ 157. goto err; 158. ret->comp = c; crypto/stack/stack.c:158:5: 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) 157. goto err; 158. > ret->comp = c; 159. ret->num_alloc = MIN_NODES; 160. return (ret); crypto/stack/stack.c:159:5: 157. goto err; 158. ret->comp = c; 159. > ret->num_alloc = MIN_NODES; 160. return (ret); 161. crypto/stack/stack.c:160:5: 158. ret->comp = c; 159. ret->num_alloc = MIN_NODES; 160. > return (ret); 161. 162. err: crypto/stack/stack.c:165:1: return from a call to sk_new 163. OPENSSL_free(ret); 164. return (NULL); 165. > } 166. 167. int sk_insert(_STACK *st, void *data, int loc) crypto/stack/stack.c:148:1: return from a call to sk_new_null 146. { 147. return sk_new((int (*)(const void *, const void *))0); 148. > } 149. 150. _STACK *sk_new(int (*c) (const void *, const void *)) include/openssl/srp.h:97:1: return from a call to sk_SRP_user_pwd_new_null 95. } SRP_user_pwd; 96. 97. > DEFINE_STACK_OF(SRP_user_pwd) 98. 99. typedef struct SRP_VBASE_st { crypto/srp/srp_vfy.c:256:9: Taking false branch 254. if (vb == NULL) 255. return NULL; 256. if ((vb->users_pwd = sk_SRP_user_pwd_new_null()) == NULL ^ 257. || (vb->gN_cache = sk_SRP_gN_cache_new_null()) == NULL) { 258. OPENSSL_free(vb); crypto/srp/srp_vfy.c:257:12: 255. return NULL; 256. if ((vb->users_pwd = sk_SRP_user_pwd_new_null()) == NULL 257. > || (vb->gN_cache = sk_SRP_gN_cache_new_null()) == NULL) { 258. OPENSSL_free(vb); 259. return NULL; include/openssl/srp.h:86:1: start of procedure sk_SRP_gN_cache_new_null() 84. 85. 86. > DEFINE_STACK_OF(SRP_gN_cache) 87. 88. typedef struct SRP_user_pwd_st { crypto/stack/stack.c:145:1: start of procedure sk_new_null() 143. } 144. 145. > _STACK *sk_new_null(void) 146. { 147. return sk_new((int (*)(const void *, const void *))0); crypto/stack/stack.c:147:5: 145. _STACK *sk_new_null(void) 146. { 147. > return sk_new((int (*)(const void *, const void *))0); 148. } 149. crypto/stack/stack.c:150:1: start of procedure sk_new() 148. } 149. 150. > _STACK *sk_new(int (*c) (const void *, const void *)) 151. { 152. _STACK *ret; crypto/stack/stack.c:154:9: 152. _STACK *ret; 153. 154. > if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking false branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/stack/stack.c:154:9: Taking true branch 152. _STACK *ret; 153. 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) ^ 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) crypto/stack/stack.c:162:2: 160. return (ret); 161. 162. > err: 163. OPENSSL_free(ret); 164. return (NULL); crypto/stack/stack.c:163:5: 161. 162. err: 163. > OPENSSL_free(ret); 164. return (NULL); 165. } crypto/mem.c:234:1: start of procedure CRYPTO_free() 232. } 233. 234. > void CRYPTO_free(void *str) 235. { 236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:245:5: 243. } 244. #else 245. > free(str); 246. #endif 247. } crypto/mem.c:247:1: return from a call to CRYPTO_free 245. free(str); 246. #endif 247. > } 248. 249. void CRYPTO_clear_free(void *str, size_t num) crypto/stack/stack.c:164:5: 162. err: 163. OPENSSL_free(ret); 164. > return (NULL); 165. } 166. crypto/stack/stack.c:165:1: return from a call to sk_new 163. OPENSSL_free(ret); 164. return (NULL); 165. > } 166. 167. int sk_insert(_STACK *st, void *data, int loc) crypto/stack/stack.c:148:1: return from a call to sk_new_null 146. { 147. return sk_new((int (*)(const void *, const void *))0); 148. > } 149. 150. _STACK *sk_new(int (*c) (const void *, const void *)) include/openssl/srp.h:86:1: return from a call to sk_SRP_gN_cache_new_null 84. 85. 86. > DEFINE_STACK_OF(SRP_gN_cache) 87. 88. typedef struct SRP_user_pwd_st { crypto/srp/srp_vfy.c:257:12: Taking true branch 255. return NULL; 256. if ((vb->users_pwd = sk_SRP_user_pwd_new_null()) == NULL 257. || (vb->gN_cache = sk_SRP_gN_cache_new_null()) == NULL) { ^ 258. OPENSSL_free(vb); 259. return NULL; crypto/srp/srp_vfy.c:258:9: 256. if ((vb->users_pwd = sk_SRP_user_pwd_new_null()) == NULL 257. || (vb->gN_cache = sk_SRP_gN_cache_new_null()) == NULL) { 258. > OPENSSL_free(vb); 259. return NULL; 260. } crypto/mem.c:234:1: start of procedure CRYPTO_free() 232. } 233. 234. > void CRYPTO_free(void *str) 235. { 236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:245:5: 243. } 244. #else 245. > free(str); 246. #endif 247. } crypto/mem.c:247:1: return from a call to CRYPTO_free 245. free(str); 246. #endif 247. > } 248. 249. void CRYPTO_clear_free(void *str, size_t num)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/srp/srp_vfy.c/#L258
d2a_code_trace_data_44720
static void h261_loop_filter_c(uint8_t *src, int stride){ int x,y,xy,yz; int temp[64]; for(x=0; x<8; x++){ temp[x ] = 4*src[x ]; temp[x + 7*8] = 4*src[x + 7*stride]; } for(y=1; y<7; y++){ for(x=0; x<8; x++){ xy = y * stride + x; yz = y * 8 + x; temp[yz] = src[xy - stride] + 2*src[xy] + src[xy + stride]; } } for(y=0; y<8; y++){ src[ y*stride] = (temp[ y*8] + 2)>>2; src[7+y*stride] = (temp[7+y*8] + 2)>>2; for(x=1; x<7; x++){ xy = y * stride + x; yz = y * 8 + x; src[xy] = (temp[yz-1] + 2*temp[yz] + temp[yz+1] + 8)>>4; } } } libavcodec/dsputil.c:2907: error: Uninitialized Value The value read from temp[_] was never initialized. libavcodec/dsputil.c:2907:9: 2905. for(y=0; y<8; y++){ 2906. src[ y*stride] = (temp[ y*8] + 2)>>2; 2907. src[7+y*stride] = (temp[7+y*8] + 2)>>2; ^ 2908. for(x=1; x<7; x++){ 2909. xy = y * stride + x;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dsputil.c/#L2907
d2a_code_trace_data_44721
static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) { SmackerContext *smk = s->priv_data; int flags; int ret; int i; int frame_size = 0; int palchange = 0; if (s->pb->eof_reached || smk->cur_frame >= smk->frames) return AVERROR_EOF; if(smk->curstream < 0) { avio_seek(s->pb, smk->nextpos, 0); frame_size = smk->frm_size[smk->cur_frame] & (~3); flags = smk->frm_flags[smk->cur_frame]; if(flags & SMACKER_PAL){ int size, sz, t, off, j, pos; uint8_t *pal = smk->pal; uint8_t oldpal[768]; memcpy(oldpal, pal, 768); size = avio_r8(s->pb); size = size * 4 - 1; frame_size -= size; frame_size--; sz = 0; pos = avio_tell(s->pb) + size; while(sz < 256){ t = avio_r8(s->pb); if(t & 0x80){ sz += (t & 0x7F) + 1; pal += ((t & 0x7F) + 1) * 3; } else if(t & 0x40){ off = avio_r8(s->pb); j = (t & 0x3F) + 1; if (off + j > 0x100) { av_log(s, AV_LOG_ERROR, "Invalid palette update, offset=%d length=%d extends beyond palette size\n", off, j); return AVERROR_INVALIDDATA; } off *= 3; while(j-- && sz < 256) { *pal++ = oldpal[off + 0]; *pal++ = oldpal[off + 1]; *pal++ = oldpal[off + 2]; sz++; off += 3; } } else { *pal++ = smk_pal[t]; *pal++ = smk_pal[avio_r8(s->pb) & 0x3F]; *pal++ = smk_pal[avio_r8(s->pb) & 0x3F]; sz++; } } avio_seek(s->pb, pos, 0); palchange |= 1; } flags >>= 1; smk->curstream = -1; for(i = 0; i < 7; i++) { if(flags & 1) { uint32_t size; int err; size = avio_rl32(s->pb) - 4; if (!size || size > frame_size) { av_log(s, AV_LOG_ERROR, "Invalid audio part size\n"); return AVERROR_INVALIDDATA; } frame_size -= size; frame_size -= 4; smk->curstream++; if ((err = av_reallocp(&smk->bufs[smk->curstream], size)) < 0) { smk->buf_sizes[smk->curstream] = 0; return err; } smk->buf_sizes[smk->curstream] = size; ret = avio_read(s->pb, smk->bufs[smk->curstream], size); if(ret != size) return AVERROR(EIO); smk->stream_id[smk->curstream] = smk->indexes[i]; } flags >>= 1; } if (frame_size < 0 || frame_size >= INT_MAX/2) return AVERROR_INVALIDDATA; if (av_new_packet(pkt, frame_size + 769)) return AVERROR(ENOMEM); if(smk->frm_size[smk->cur_frame] & 1) palchange |= 2; pkt->data[0] = palchange; memcpy(pkt->data + 1, smk->pal, 768); ret = avio_read(s->pb, pkt->data + 769, frame_size); if(ret != frame_size) return AVERROR(EIO); pkt->stream_index = smk->videoindex; pkt->pts = smk->cur_frame; pkt->size = ret + 769; smk->cur_frame++; smk->nextpos = avio_tell(s->pb); } else { if (smk->stream_id[smk->curstream] < 0) return AVERROR_INVALIDDATA; if (av_new_packet(pkt, smk->buf_sizes[smk->curstream])) return AVERROR(ENOMEM); memcpy(pkt->data, smk->bufs[smk->curstream], smk->buf_sizes[smk->curstream]); pkt->size = smk->buf_sizes[smk->curstream]; pkt->stream_index = smk->stream_id[smk->curstream]; pkt->pts = smk->aud_pts[smk->curstream]; smk->aud_pts[smk->curstream] += AV_RL32(pkt->data); smk->curstream--; } return 0; } libavformat/smacker.c:322: error: Memory Leak memory dynamically allocated by call to `av_reallocp()` at line 322, column 28 is not reachable after line 322, column 28. libavformat/smacker.c:244:1: start of procedure smacker_read_packet() 242. 243. 244. static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) ^ 245. { 246. SmackerContext *smk = s->priv_data; libavformat/smacker.c:246:5: 244. static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) 245. { 246. SmackerContext *smk = s->priv_data; ^ 247. int flags; 248. int ret; libavformat/smacker.c:250:5: 248. int ret; 249. int i; 250. int frame_size = 0; ^ 251. int palchange = 0; 252. libavformat/smacker.c:251:5: 249. int i; 250. int frame_size = 0; 251. int palchange = 0; ^ 252. 253. if (s->pb->eof_reached || smk->cur_frame >= smk->frames) libavformat/smacker.c:253:9: Taking false branch 251. int palchange = 0; 252. 253. if (s->pb->eof_reached || smk->cur_frame >= smk->frames) ^ 254. return AVERROR_EOF; 255. libavformat/smacker.c:253:31: Taking false branch 251. int palchange = 0; 252. 253. if (s->pb->eof_reached || smk->cur_frame >= smk->frames) ^ 254. return AVERROR_EOF; 255. libavformat/smacker.c:257:8: Taking true branch 255. 256. /* if we demuxed all streams, pass another frame */ 257. if(smk->curstream < 0) { ^ 258. avio_seek(s->pb, smk->nextpos, 0); 259. frame_size = smk->frm_size[smk->cur_frame] & (~3); libavformat/smacker.c:258:9: Skipping avio_seek(): empty list of specs 256. /* if we demuxed all streams, pass another frame */ 257. if(smk->curstream < 0) { 258. avio_seek(s->pb, smk->nextpos, 0); ^ 259. frame_size = smk->frm_size[smk->cur_frame] & (~3); 260. flags = smk->frm_flags[smk->cur_frame]; libavformat/smacker.c:259:9: 257. if(smk->curstream < 0) { 258. avio_seek(s->pb, smk->nextpos, 0); 259. frame_size = smk->frm_size[smk->cur_frame] & (~3); ^ 260. flags = smk->frm_flags[smk->cur_frame]; 261. /* handle palette change event */ libavformat/smacker.c:260:9: 258. avio_seek(s->pb, smk->nextpos, 0); 259. frame_size = smk->frm_size[smk->cur_frame] & (~3); 260. flags = smk->frm_flags[smk->cur_frame]; ^ 261. /* handle palette change event */ 262. if(flags & SMACKER_PAL){ libavformat/smacker.c:262:12: Taking false branch 260. flags = smk->frm_flags[smk->cur_frame]; 261. /* handle palette change event */ 262. if(flags & SMACKER_PAL){ ^ 263. int size, sz, t, off, j, pos; 264. uint8_t *pal = smk->pal; libavformat/smacker.c:306:9: 304. palchange |= 1; 305. } 306. flags >>= 1; ^ 307. smk->curstream = -1; 308. /* if audio chunks are present, put them to stack and retrieve later */ libavformat/smacker.c:307:9: 305. } 306. flags >>= 1; 307. smk->curstream = -1; ^ 308. /* if audio chunks are present, put them to stack and retrieve later */ 309. for(i = 0; i < 7; i++) { libavformat/smacker.c:309:13: 307. smk->curstream = -1; 308. /* if audio chunks are present, put them to stack and retrieve later */ 309. for(i = 0; i < 7; i++) { ^ 310. if(flags & 1) { 311. uint32_t size; libavformat/smacker.c:309:20: Loop condition is true. Entering loop body 307. smk->curstream = -1; 308. /* if audio chunks are present, put them to stack and retrieve later */ 309. for(i = 0; i < 7; i++) { ^ 310. if(flags & 1) { 311. uint32_t size; libavformat/smacker.c:310:16: Taking true branch 308. /* if audio chunks are present, put them to stack and retrieve later */ 309. for(i = 0; i < 7; i++) { 310. if(flags & 1) { ^ 311. uint32_t size; 312. int err; libavformat/smacker.c:314:17: 312. int err; 313. 314. size = avio_rl32(s->pb) - 4; ^ 315. if (!size || size > frame_size) { 316. av_log(s, AV_LOG_ERROR, "Invalid audio part size\n"); libavformat/aviobuf.c:564:1: start of procedure avio_rl32() 562. } 563. 564. unsigned int avio_rl32(AVIOContext *s) ^ 565. { 566. unsigned int val; libavformat/aviobuf.c:567:5: 565. { 566. unsigned int val; 567. val = avio_rl16(s); ^ 568. val |= avio_rl16(s) << 16; 569. return val; libavformat/aviobuf.c:548:1: start of procedure avio_rl16() 546. } 547. 548. unsigned int avio_rl16(AVIOContext *s) ^ 549. { 550. unsigned int val; libavformat/aviobuf.c:551:5: 549. { 550. unsigned int val; 551. val = avio_r8(s); ^ 552. val |= avio_r8(s) << 8; 553. return val; libavformat/aviobuf.c:443:1: start of procedure avio_r8() 441. 442. /* XXX: put an inline version */ 443. int avio_r8(AVIOContext *s) ^ 444. { 445. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:445:9: Taking false branch 443. int avio_r8(AVIOContext *s) 444. { 445. if (s->buf_ptr >= s->buf_end) ^ 446. fill_buffer(s); 447. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:447:9: Taking true branch 445. if (s->buf_ptr >= s->buf_end) 446. fill_buffer(s); 447. if (s->buf_ptr < s->buf_end) ^ 448. return *s->buf_ptr++; 449. return 0; libavformat/aviobuf.c:448:9: 446. fill_buffer(s); 447. if (s->buf_ptr < s->buf_end) 448. return *s->buf_ptr++; ^ 449. return 0; 450. } libavformat/aviobuf.c:450:1: return from a call to avio_r8 448. return *s->buf_ptr++; 449. return 0; 450. } ^ 451. 452. int avio_read(AVIOContext *s, unsigned char *buf, int size) libavformat/aviobuf.c:552:5: 550. unsigned int val; 551. val = avio_r8(s); 552. val |= avio_r8(s) << 8; ^ 553. return val; 554. } libavformat/aviobuf.c:443:1: start of procedure avio_r8() 441. 442. /* XXX: put an inline version */ 443. int avio_r8(AVIOContext *s) ^ 444. { 445. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:445:9: Taking false branch 443. int avio_r8(AVIOContext *s) 444. { 445. if (s->buf_ptr >= s->buf_end) ^ 446. fill_buffer(s); 447. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:447:9: Taking true branch 445. if (s->buf_ptr >= s->buf_end) 446. fill_buffer(s); 447. if (s->buf_ptr < s->buf_end) ^ 448. return *s->buf_ptr++; 449. return 0; libavformat/aviobuf.c:448:9: 446. fill_buffer(s); 447. if (s->buf_ptr < s->buf_end) 448. return *s->buf_ptr++; ^ 449. return 0; 450. } libavformat/aviobuf.c:450:1: return from a call to avio_r8 448. return *s->buf_ptr++; 449. return 0; 450. } ^ 451. 452. int avio_read(AVIOContext *s, unsigned char *buf, int size) libavformat/aviobuf.c:553:5: 551. val = avio_r8(s); 552. val |= avio_r8(s) << 8; 553. return val; ^ 554. } 555. libavformat/aviobuf.c:554:1: return from a call to avio_rl16 552. val |= avio_r8(s) << 8; 553. return val; 554. } ^ 555. 556. unsigned int avio_rl24(AVIOContext *s) libavformat/aviobuf.c:568:5: 566. unsigned int val; 567. val = avio_rl16(s); 568. val |= avio_rl16(s) << 16; ^ 569. return val; 570. } libavformat/aviobuf.c:548:1: start of procedure avio_rl16() 546. } 547. 548. unsigned int avio_rl16(AVIOContext *s) ^ 549. { 550. unsigned int val; libavformat/aviobuf.c:551:5: 549. { 550. unsigned int val; 551. val = avio_r8(s); ^ 552. val |= avio_r8(s) << 8; 553. return val; libavformat/aviobuf.c:443:1: start of procedure avio_r8() 441. 442. /* XXX: put an inline version */ 443. int avio_r8(AVIOContext *s) ^ 444. { 445. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:445:9: Taking false branch 443. int avio_r8(AVIOContext *s) 444. { 445. if (s->buf_ptr >= s->buf_end) ^ 446. fill_buffer(s); 447. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:447:9: Taking true branch 445. if (s->buf_ptr >= s->buf_end) 446. fill_buffer(s); 447. if (s->buf_ptr < s->buf_end) ^ 448. return *s->buf_ptr++; 449. return 0; libavformat/aviobuf.c:448:9: 446. fill_buffer(s); 447. if (s->buf_ptr < s->buf_end) 448. return *s->buf_ptr++; ^ 449. return 0; 450. } libavformat/aviobuf.c:450:1: return from a call to avio_r8 448. return *s->buf_ptr++; 449. return 0; 450. } ^ 451. 452. int avio_read(AVIOContext *s, unsigned char *buf, int size) libavformat/aviobuf.c:552:5: 550. unsigned int val; 551. val = avio_r8(s); 552. val |= avio_r8(s) << 8; ^ 553. return val; 554. } libavformat/aviobuf.c:443:1: start of procedure avio_r8() 441. 442. /* XXX: put an inline version */ 443. int avio_r8(AVIOContext *s) ^ 444. { 445. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:445:9: Taking false branch 443. int avio_r8(AVIOContext *s) 444. { 445. if (s->buf_ptr >= s->buf_end) ^ 446. fill_buffer(s); 447. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:447:9: Taking true branch 445. if (s->buf_ptr >= s->buf_end) 446. fill_buffer(s); 447. if (s->buf_ptr < s->buf_end) ^ 448. return *s->buf_ptr++; 449. return 0; libavformat/aviobuf.c:448:9: 446. fill_buffer(s); 447. if (s->buf_ptr < s->buf_end) 448. return *s->buf_ptr++; ^ 449. return 0; 450. } libavformat/aviobuf.c:450:1: return from a call to avio_r8 448. return *s->buf_ptr++; 449. return 0; 450. } ^ 451. 452. int avio_read(AVIOContext *s, unsigned char *buf, int size) libavformat/aviobuf.c:553:5: 551. val = avio_r8(s); 552. val |= avio_r8(s) << 8; 553. return val; ^ 554. } 555. libavformat/aviobuf.c:554:1: return from a call to avio_rl16 552. val |= avio_r8(s) << 8; 553. return val; 554. } ^ 555. 556. unsigned int avio_rl24(AVIOContext *s) libavformat/aviobuf.c:569:5: 567. val = avio_rl16(s); 568. val |= avio_rl16(s) << 16; 569. return val; ^ 570. } 571. libavformat/aviobuf.c:570:1: return from a call to avio_rl32 568. val |= avio_rl16(s) << 16; 569. return val; 570. } ^ 571. 572. uint64_t avio_rl64(AVIOContext *s) libavformat/smacker.c:315:22: Taking false branch 313. 314. size = avio_rl32(s->pb) - 4; 315. if (!size || size > frame_size) { ^ 316. av_log(s, AV_LOG_ERROR, "Invalid audio part size\n"); 317. return AVERROR_INVALIDDATA; libavformat/smacker.c:315:30: Taking false branch 313. 314. size = avio_rl32(s->pb) - 4; 315. if (!size || size > frame_size) { ^ 316. av_log(s, AV_LOG_ERROR, "Invalid audio part size\n"); 317. return AVERROR_INVALIDDATA; libavformat/smacker.c:319:17: 317. return AVERROR_INVALIDDATA; 318. } 319. frame_size -= size; ^ 320. frame_size -= 4; 321. smk->curstream++; libavformat/smacker.c:320:17: 318. } 319. frame_size -= size; 320. frame_size -= 4; ^ 321. smk->curstream++; 322. if ((err = av_reallocp(&smk->bufs[smk->curstream], size)) < 0) { libavformat/smacker.c:321:17: 319. frame_size -= size; 320. frame_size -= 4; 321. smk->curstream++; ^ 322. if ((err = av_reallocp(&smk->bufs[smk->curstream], size)) < 0) { 323. smk->buf_sizes[smk->curstream] = 0; libavformat/smacker.c:322:21: 320. frame_size -= 4; 321. smk->curstream++; 322. if ((err = av_reallocp(&smk->bufs[smk->curstream], size)) < 0) { ^ 323. smk->buf_sizes[smk->curstream] = 0; 324. return err; libavutil/mem.c:140:1: start of procedure av_reallocp() 138. } 139. 140. int av_reallocp(void *ptr, size_t size) ^ 141. { 142. void **ptrptr = ptr; libavutil/mem.c:142:5: 140. int av_reallocp(void *ptr, size_t size) 141. { 142. void **ptrptr = ptr; ^ 143. void *ret; 144. libavutil/mem.c:145:10: Taking false branch 143. void *ret; 144. 145. if (!size) { ^ 146. av_freep(ptr); 147. return 0; libavutil/mem.c:149:5: 147. return 0; 148. } 149. ret = av_realloc(*ptrptr, size); ^ 150. 151. if (!ret) { 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:151:10: Taking false branch 149. ret = av_realloc(*ptrptr, size); 150. 151. if (!ret) { ^ 152. av_freep(ptr); 153. return AVERROR(ENOMEM); libavutil/mem.c:156:5: 154. } 155. 156. *ptrptr = ret; ^ 157. return 0; 158. } libavutil/mem.c:157:5: 155. 156. *ptrptr = ret; 157. return 0; ^ 158. } 159. libavutil/mem.c:158:1: return from a call to av_reallocp 156. *ptrptr = ret; 157. return 0; 158. } ^ 159. 160. void *av_realloc_array(void *ptr, size_t nmemb, size_t size) libavformat/smacker.c:322:21: Taking false branch 320. frame_size -= 4; 321. smk->curstream++; 322. if ((err = av_reallocp(&smk->bufs[smk->curstream], size)) < 0) { ^ 323. smk->buf_sizes[smk->curstream] = 0; 324. return err; libavformat/smacker.c:326:17: 324. return err; 325. } 326. smk->buf_sizes[smk->curstream] = size; ^ 327. ret = avio_read(s->pb, smk->bufs[smk->curstream], size); 328. if(ret != size) libavformat/smacker.c:327:17: Skipping avio_read(): empty list of specs 325. } 326. smk->buf_sizes[smk->curstream] = size; 327. ret = avio_read(s->pb, smk->bufs[smk->curstream], size); ^ 328. if(ret != size) 329. return AVERROR(EIO); libavformat/smacker.c:328:20: Taking false branch 326. smk->buf_sizes[smk->curstream] = size; 327. ret = avio_read(s->pb, smk->bufs[smk->curstream], size); 328. if(ret != size) ^ 329. return AVERROR(EIO); 330. smk->stream_id[smk->curstream] = smk->indexes[i]; libavformat/smacker.c:330:17: 328. if(ret != size) 329. return AVERROR(EIO); 330. smk->stream_id[smk->curstream] = smk->indexes[i]; ^ 331. } 332. flags >>= 1; libavformat/smacker.c:332:13: 330. smk->stream_id[smk->curstream] = smk->indexes[i]; 331. } 332. flags >>= 1; ^ 333. } 334. if (frame_size < 0 || frame_size >= INT_MAX/2) libavformat/smacker.c:309:27: 307. smk->curstream = -1; 308. /* if audio chunks are present, put them to stack and retrieve later */ 309. for(i = 0; i < 7; i++) { ^ 310. if(flags & 1) { 311. uint32_t size; libavformat/smacker.c:309:20: Loop condition is true. Entering loop body 307. smk->curstream = -1; 308. /* if audio chunks are present, put them to stack and retrieve later */ 309. for(i = 0; i < 7; i++) { ^ 310. if(flags & 1) { 311. uint32_t size; libavformat/smacker.c:310:16: Taking true branch 308. /* if audio chunks are present, put them to stack and retrieve later */ 309. for(i = 0; i < 7; i++) { 310. if(flags & 1) { ^ 311. uint32_t size; 312. int err; libavformat/smacker.c:314:17: 312. int err; 313. 314. size = avio_rl32(s->pb) - 4; ^ 315. if (!size || size > frame_size) { 316. av_log(s, AV_LOG_ERROR, "Invalid audio part size\n"); libavformat/aviobuf.c:564:1: start of procedure avio_rl32() 562. } 563. 564. unsigned int avio_rl32(AVIOContext *s) ^ 565. { 566. unsigned int val; libavformat/aviobuf.c:567:5: 565. { 566. unsigned int val; 567. val = avio_rl16(s); ^ 568. val |= avio_rl16(s) << 16; 569. return val; libavformat/aviobuf.c:548:1: start of procedure avio_rl16() 546. } 547. 548. unsigned int avio_rl16(AVIOContext *s) ^ 549. { 550. unsigned int val; libavformat/aviobuf.c:551:5: 549. { 550. unsigned int val; 551. val = avio_r8(s); ^ 552. val |= avio_r8(s) << 8; 553. return val; libavformat/aviobuf.c:443:1: start of procedure avio_r8() 441. 442. /* XXX: put an inline version */ 443. int avio_r8(AVIOContext *s) ^ 444. { 445. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:445:9: Taking false branch 443. int avio_r8(AVIOContext *s) 444. { 445. if (s->buf_ptr >= s->buf_end) ^ 446. fill_buffer(s); 447. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:447:9: Taking true branch 445. if (s->buf_ptr >= s->buf_end) 446. fill_buffer(s); 447. if (s->buf_ptr < s->buf_end) ^ 448. return *s->buf_ptr++; 449. return 0; libavformat/aviobuf.c:448:9: 446. fill_buffer(s); 447. if (s->buf_ptr < s->buf_end) 448. return *s->buf_ptr++; ^ 449. return 0; 450. } libavformat/aviobuf.c:450:1: return from a call to avio_r8 448. return *s->buf_ptr++; 449. return 0; 450. } ^ 451. 452. int avio_read(AVIOContext *s, unsigned char *buf, int size) libavformat/aviobuf.c:552:5: 550. unsigned int val; 551. val = avio_r8(s); 552. val |= avio_r8(s) << 8; ^ 553. return val; 554. } libavformat/aviobuf.c:443:1: start of procedure avio_r8() 441. 442. /* XXX: put an inline version */ 443. int avio_r8(AVIOContext *s) ^ 444. { 445. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:445:9: Taking false branch 443. int avio_r8(AVIOContext *s) 444. { 445. if (s->buf_ptr >= s->buf_end) ^ 446. fill_buffer(s); 447. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:447:9: Taking true branch 445. if (s->buf_ptr >= s->buf_end) 446. fill_buffer(s); 447. if (s->buf_ptr < s->buf_end) ^ 448. return *s->buf_ptr++; 449. return 0; libavformat/aviobuf.c:448:9: 446. fill_buffer(s); 447. if (s->buf_ptr < s->buf_end) 448. return *s->buf_ptr++; ^ 449. return 0; 450. } libavformat/aviobuf.c:450:1: return from a call to avio_r8 448. return *s->buf_ptr++; 449. return 0; 450. } ^ 451. 452. int avio_read(AVIOContext *s, unsigned char *buf, int size) libavformat/aviobuf.c:553:5: 551. val = avio_r8(s); 552. val |= avio_r8(s) << 8; 553. return val; ^ 554. } 555. libavformat/aviobuf.c:554:1: return from a call to avio_rl16 552. val |= avio_r8(s) << 8; 553. return val; 554. } ^ 555. 556. unsigned int avio_rl24(AVIOContext *s) libavformat/aviobuf.c:568:5: 566. unsigned int val; 567. val = avio_rl16(s); 568. val |= avio_rl16(s) << 16; ^ 569. return val; 570. } libavformat/aviobuf.c:548:1: start of procedure avio_rl16() 546. } 547. 548. unsigned int avio_rl16(AVIOContext *s) ^ 549. { 550. unsigned int val; libavformat/aviobuf.c:551:5: 549. { 550. unsigned int val; 551. val = avio_r8(s); ^ 552. val |= avio_r8(s) << 8; 553. return val; libavformat/aviobuf.c:443:1: start of procedure avio_r8() 441. 442. /* XXX: put an inline version */ 443. int avio_r8(AVIOContext *s) ^ 444. { 445. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:445:9: Taking false branch 443. int avio_r8(AVIOContext *s) 444. { 445. if (s->buf_ptr >= s->buf_end) ^ 446. fill_buffer(s); 447. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:447:9: Taking true branch 445. if (s->buf_ptr >= s->buf_end) 446. fill_buffer(s); 447. if (s->buf_ptr < s->buf_end) ^ 448. return *s->buf_ptr++; 449. return 0; libavformat/aviobuf.c:448:9: 446. fill_buffer(s); 447. if (s->buf_ptr < s->buf_end) 448. return *s->buf_ptr++; ^ 449. return 0; 450. } libavformat/aviobuf.c:450:1: return from a call to avio_r8 448. return *s->buf_ptr++; 449. return 0; 450. } ^ 451. 452. int avio_read(AVIOContext *s, unsigned char *buf, int size) libavformat/aviobuf.c:552:5: 550. unsigned int val; 551. val = avio_r8(s); 552. val |= avio_r8(s) << 8; ^ 553. return val; 554. } libavformat/aviobuf.c:443:1: start of procedure avio_r8() 441. 442. /* XXX: put an inline version */ 443. int avio_r8(AVIOContext *s) ^ 444. { 445. if (s->buf_ptr >= s->buf_end) libavformat/aviobuf.c:445:9: Taking false branch 443. int avio_r8(AVIOContext *s) 444. { 445. if (s->buf_ptr >= s->buf_end) ^ 446. fill_buffer(s); 447. if (s->buf_ptr < s->buf_end) libavformat/aviobuf.c:447:9: Taking true branch 445. if (s->buf_ptr >= s->buf_end) 446. fill_buffer(s); 447. if (s->buf_ptr < s->buf_end) ^ 448. return *s->buf_ptr++; 449. return 0; libavformat/aviobuf.c:448:9: 446. fill_buffer(s); 447. if (s->buf_ptr < s->buf_end) 448. return *s->buf_ptr++; ^ 449. return 0; 450. } libavformat/aviobuf.c:450:1: return from a call to avio_r8 448. return *s->buf_ptr++; 449. return 0; 450. } ^ 451. 452. int avio_read(AVIOContext *s, unsigned char *buf, int size) libavformat/aviobuf.c:553:5: 551. val = avio_r8(s); 552. val |= avio_r8(s) << 8; 553. return val; ^ 554. } 555. libavformat/aviobuf.c:554:1: return from a call to avio_rl16 552. val |= avio_r8(s) << 8; 553. return val; 554. } ^ 555. 556. unsigned int avio_rl24(AVIOContext *s) libavformat/aviobuf.c:569:5: 567. val = avio_rl16(s); 568. val |= avio_rl16(s) << 16; 569. return val; ^ 570. } 571. libavformat/aviobuf.c:570:1: return from a call to avio_rl32 568. val |= avio_rl16(s) << 16; 569. return val; 570. } ^ 571. 572. uint64_t avio_rl64(AVIOContext *s) libavformat/smacker.c:315:22: Taking false branch 313. 314. size = avio_rl32(s->pb) - 4; 315. if (!size || size > frame_size) { ^ 316. av_log(s, AV_LOG_ERROR, "Invalid audio part size\n"); 317. return AVERROR_INVALIDDATA; libavformat/smacker.c:315:30: Taking false branch 313. 314. size = avio_rl32(s->pb) - 4; 315. if (!size || size > frame_size) { ^ 316. av_log(s, AV_LOG_ERROR, "Invalid audio part size\n"); 317. return AVERROR_INVALIDDATA; libavformat/smacker.c:319:17: 317. return AVERROR_INVALIDDATA; 318. } 319. frame_size -= size; ^ 320. frame_size -= 4; 321. smk->curstream++; libavformat/smacker.c:320:17: 318. } 319. frame_size -= size; 320. frame_size -= 4; ^ 321. smk->curstream++; 322. if ((err = av_reallocp(&smk->bufs[smk->curstream], size)) < 0) { libavformat/smacker.c:321:17: 319. frame_size -= size; 320. frame_size -= 4; 321. smk->curstream++; ^ 322. if ((err = av_reallocp(&smk->bufs[smk->curstream], size)) < 0) { 323. smk->buf_sizes[smk->curstream] = 0; libavformat/smacker.c:322:21: 320. frame_size -= 4; 321. smk->curstream++; 322. if ((err = av_reallocp(&smk->bufs[smk->curstream], size)) < 0) { ^ 323. smk->buf_sizes[smk->curstream] = 0; 324. return err; libavutil/mem.c:140:1: start of procedure av_reallocp() 138. } 139. 140. int av_reallocp(void *ptr, size_t size) ^ 141. { 142. void **ptrptr = ptr; libavutil/mem.c:142:5: 140. int av_reallocp(void *ptr, size_t size) 141. { 142. void **ptrptr = ptr; ^ 143. void *ret; 144. libavutil/mem.c:145:10: Taking false branch 143. void *ret; 144. 145. if (!size) { ^ 146. av_freep(ptr); 147. return 0; libavutil/mem.c:149:5: 147. return 0; 148. } 149. ret = av_realloc(*ptrptr, size); ^ 150. 151. if (!ret) { 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:151:10: Taking false branch 149. ret = av_realloc(*ptrptr, size); 150. 151. if (!ret) { ^ 152. av_freep(ptr); 153. return AVERROR(ENOMEM); libavutil/mem.c:156:5: 154. } 155. 156. *ptrptr = ret; ^ 157. return 0; 158. } libavutil/mem.c:157:5: 155. 156. *ptrptr = ret; 157. return 0; ^ 158. } 159. libavutil/mem.c:158:1: return from a call to av_reallocp 156. *ptrptr = ret; 157. return 0; 158. } ^ 159. 160. void *av_realloc_array(void *ptr, size_t nmemb, size_t size)
https://github.com/libav/libav/blob/f726fc21ef76a8ba3445448066f7b2a687fbca16/libavformat/smacker.c/#L322
d2a_code_trace_data_44722
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/record/rec_layer_d1.c:366: error: INTEGER_OVERFLOW_L2 ([0, max(0, `s->ctx->sessions->num_items`)] - 1):unsigned64 by call to `dtls1_process_record`. Showing all 13 steps of the trace ssl/record/rec_layer_d1.c:353:1: Parameter `s->ctx->sessions->num_items` 351. 352. 353. > int dtls1_process_buffered_records(SSL *s) 354. { 355. pitem *item; ssl/record/rec_layer_d1.c:366:18: Call 364. while (pqueue_peek(s->rlayer.d->unprocessed_rcds.q)) { 365. dtls1_get_unprocessed_record(s); 366. if (!dtls1_process_record(s)) ^ 367. return (0); 368. if (dtls1_buffer_record(s, &(s->rlayer.d->processed_rcds), ssl/record/ssl3_record.c:1199:1: Parameter `s->ctx->sessions->num_items` 1197. } 1198. 1199. > int dtls1_process_record(SSL *s) 1200. { 1201. int i, al; ssl/record/ssl3_record.c:1358:5: Call 1356. 1357. f_err: 1358. ssl3_send_alert(s, SSL3_AL_FATAL, al); ^ 1359. err: 1360. return (0); ssl/s3_msg.c:166:1: Parameter `s->ctx->sessions->num_items` 164. } 165. 166. > int ssl3_send_alert(SSL *s, int level, int desc) 167. { 168. /* Map tls/ssl alert value to correct one */ ssl/s3_msg.c:177:9: Call 175. /* If a fatal one, remove from cache */ 176. if ((level == SSL3_AL_FATAL) && (s->session != NULL)) 177. SSL_CTX_remove_session(s->ctx, s->session); ^ 178. 179. s->s3->alert_dispatch = 1; ssl/ssl_sess.c:675:1: Parameter `ctx->sessions->num_items` 673. } 674. 675. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 676. { 677. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:677:12: Call 675. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 676. { 677. return remove_session_lock(ctx, c, 1); ^ 678. } 679. ssl/ssl_sess.c:680:1: Parameter `ctx->sessions->num_items` 678. } 679. 680. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 681. { 682. SSL_SESSION *r; ssl/ssl_sess.c:690:17: Call 688. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 689. ret = 1; 690. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 691. SSL_SESSION_list_remove(ctx, c); 692. } crypto/lhash/lhash.c:211:1: <LHS trace> 209. } 210. 211. > void *lh_delete(_LHASH *lh, const void *data) 212. { 213. unsigned long hash; crypto/lhash/lhash.c:211:1: Parameter `lh->num_items` 209. } 210. 211. > void *lh_delete(_LHASH *lh, const void *data) 212. { 213. unsigned long hash; crypto/lhash/lhash.c:231:5: Binary operation: ([0, max(0, s->ctx->sessions->num_items)] - 1):unsigned64 by call to `dtls1_process_record` 229. } 230. 231. lh->num_items--; ^ 232. if ((lh->num_nodes > MIN_NODES) && 233. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
https://github.com/openssl/openssl/blob/747e16398d704a667cc99f8a0b1912c36b7de52d/crypto/lhash/lhash.c/#L231
d2a_code_trace_data_44723
int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, const unsigned char *in, int inl) { int i, j, bl; if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) { i = ctx->cipher->do_cipher(ctx, out, in, inl); if (i < 0) return 0; else *outl = i; return 1; } if (inl <= 0) { *outl = 0; return inl == 0; } if (ctx->buf_len == 0 && (inl & (ctx->block_mask)) == 0) { if (ctx->cipher->do_cipher(ctx, out, in, inl)) { *outl = inl; return 1; } else { *outl = 0; return 0; } } i = ctx->buf_len; bl = ctx->cipher->block_size; OPENSSL_assert(bl <= (int)sizeof(ctx->buf)); if (i != 0) { if (i + inl < bl) { memcpy(&(ctx->buf[i]), in, inl); ctx->buf_len += inl; *outl = 0; return 1; } else { j = bl - i; memcpy(&(ctx->buf[i]), in, j); if (!ctx->cipher->do_cipher(ctx, out, ctx->buf, bl)) return 0; inl -= j; in += j; out += bl; *outl = bl; } } else *outl = 0; i = inl & (bl - 1); inl -= i; if (inl > 0) { if (!ctx->cipher->do_cipher(ctx, out, in, inl)) return 0; *outl += inl; } if (i != 0) memcpy(ctx->buf, &(in[inl]), i); ctx->buf_len = i; return 1; } crypto/pem/pvkfmt.c:766: error: BUFFER_OVERRUN_L3 Offset added: [10, +oo] (⇐ [9, +oo] + [1, +oo]) Size: [8, +oo] by call to `do_PVK_body`. Showing all 13 steps of the trace crypto/pem/pvkfmt.c:753:10: Call 751. p = pvk_hdr; 752. 753. if (!do_PVK_header(&p, 24, 0, &saltlen, &keylen)) ^ 754. return 0; 755. buflen = (int)keylen + saltlen; crypto/pem/pvkfmt.c:609:1: Parameter `*pkeylen` 607. # ifndef OPENSSL_NO_RC4 608. 609. > static int do_PVK_header(const unsigned char **in, unsigned int length, 610. int skip_magic, 611. unsigned int *psaltlen, unsigned int *pkeylen) crypto/pem/pvkfmt.c:766:11: Call 764. goto err; 765. } 766. ret = do_PVK_body(&p, saltlen, keylen, cb, u); ^ 767. 768. err: crypto/pem/pvkfmt.c:666:1: Parameter `keylen` 664. } 665. 666. > static EVP_PKEY *do_PVK_body(const unsigned char **in, 667. unsigned int saltlen, unsigned int keylen, 668. pem_password_cb *cb, void *u) crypto/pem/pvkfmt.c:704:9: Assignment 702. goto err; 703. } 704. inlen = keylen - 8; ^ 705. q = enctmp + 8; 706. if (!EVP_DecryptInit_ex(cctx, EVP_rc4(), NULL, keybuf, NULL)) crypto/pem/pvkfmt.c:708:14: Call 706. if (!EVP_DecryptInit_ex(cctx, EVP_rc4(), NULL, keybuf, NULL)) 707. goto err; 708. if (!EVP_DecryptUpdate(cctx, q, &enctmplen, p, inlen)) ^ 709. goto err; 710. if (!EVP_DecryptFinal_ex(cctx, q + enctmplen, &enctmplen)) crypto/evp/evp_enc.c:422:1: Parameter `inl` 420. } 421. 422. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 423. const unsigned char *in, int inl) 424. { crypto/evp/evp_enc.c:444:16: Call 442. 443. if (ctx->flags & EVP_CIPH_NO_PADDING) 444. return EVP_EncryptUpdate(ctx, out, outl, in, inl); ^ 445. 446. b = ctx->cipher->block_size; crypto/evp/evp_enc.c:310:1: <Offset trace> 308. } 309. 310. > int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 311. const unsigned char *in, int inl) 312. { crypto/evp/evp_enc.c:310:1: Parameter `inl` 308. } 309. 310. > int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 311. const unsigned char *in, int inl) 312. { crypto/evp/evp_enc.c:310:1: <Length trace> 308. } 309. 310. > int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 311. const unsigned char *in, int inl) 312. { crypto/evp/evp_enc.c:310:1: Parameter `*in` 308. } 309. 310. > int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 311. const unsigned char *in, int inl) 312. { crypto/evp/evp_enc.c:343:13: Array access: Offset added: [10, +oo] (⇐ [9, +oo] + [1, +oo]) Size: [8, +oo] by call to `do_PVK_body` 341. if (i != 0) { 342. if (i + inl < bl) { 343. memcpy(&(ctx->buf[i]), in, inl); ^ 344. ctx->buf_len += inl; 345. *outl = 0;
https://github.com/openssl/openssl/blob/846ec07d904f9cc81d486db0db14fb84f61ff6e5/crypto/evp/evp_enc.c/#L343
d2a_code_trace_data_44724
static X509_STORE *create_cert_store(char *ca_path, char *ca_file) { X509_STORE *cert_ctx = NULL; X509_LOOKUP *lookup = NULL; int i; cert_ctx = X509_STORE_new(); X509_STORE_set_verify_cb(cert_ctx, verify_cb); if (ca_path) { lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_hash_dir()); if (lookup == NULL) { BIO_printf(bio_err, "memory allocation failure\n"); goto err; } i = X509_LOOKUP_add_dir(lookup, ca_path, X509_FILETYPE_PEM); if (!i) { BIO_printf(bio_err, "Error loading directory %s\n", ca_path); goto err; } } if (ca_file) { lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_file()); if (lookup == NULL) { BIO_printf(bio_err, "memory allocation failure\n"); goto err; } i = X509_LOOKUP_load_file(lookup, ca_file, X509_FILETYPE_PEM); if (!i) { BIO_printf(bio_err, "Error loading file %s\n", ca_file); goto err; } } return cert_ctx; err: X509_STORE_free(cert_ctx); return NULL; } apps/ts.c:1087: error: NULL_DEREFERENCE pointer `cert_ctx` last assigned on line 1084 could be null and is dereferenced by call to `X509_STORE_set_verify_cb()` at line 1087, column 2. Showing all 22 steps of the trace apps/ts.c:1077:1: start of procedure create_cert_store() 1075. } 1076. 1077. > static X509_STORE *create_cert_store(char *ca_path, char *ca_file) 1078. { 1079. X509_STORE *cert_ctx = NULL; apps/ts.c:1079:2: 1077. static X509_STORE *create_cert_store(char *ca_path, char *ca_file) 1078. { 1079. > X509_STORE *cert_ctx = NULL; 1080. X509_LOOKUP *lookup = NULL; 1081. int i; apps/ts.c:1080:2: 1078. { 1079. X509_STORE *cert_ctx = NULL; 1080. > X509_LOOKUP *lookup = NULL; 1081. int i; 1082. apps/ts.c:1084:2: 1082. 1083. /* Creating the X509_STORE object. */ 1084. > cert_ctx = X509_STORE_new(); 1085. 1086. /* Setting the callback for certificate chain verification. */ crypto/x509/x509_lu.c:178:1: start of procedure X509_STORE_new() 176. } 177. 178. > X509_STORE *X509_STORE_new(void) 179. { 180. X509_STORE *ret; crypto/x509/x509_lu.c:182:6: 180. X509_STORE *ret; 181. 182. > if ((ret=(X509_STORE *)OPENSSL_malloc(sizeof(X509_STORE))) == NULL) 183. return NULL; 184. ret->objs = sk_X509_OBJECT_new(x509_object_cmp); crypto/mem.c:297:1: start of procedure CRYPTO_malloc() 295. } 296. 297. > void *CRYPTO_malloc(int num, const char *file, int line) 298. { 299. void *ret = NULL; crypto/mem.c:299:2: 297. void *CRYPTO_malloc(int num, const char *file, int line) 298. { 299. > void *ret = NULL; 300. 301. if (num <= 0) return NULL; crypto/mem.c:301:6: Taking false branch 299. void *ret = NULL; 300. 301. if (num <= 0) return NULL; ^ 302. 303. allow_customize = 0; crypto/mem.c:303:2: 301. if (num <= 0) return NULL; 302. 303. > allow_customize = 0; 304. if (malloc_debug_func != NULL) 305. { crypto/mem.c:304:6: Taking false branch 302. 303. allow_customize = 0; 304. if (malloc_debug_func != NULL) ^ 305. { 306. allow_customize_debug = 0; crypto/mem.c:309:2: Skipping __function_pointer__(): unresolved function pointer 307. malloc_debug_func(NULL, num, file, line, 0); 308. } 309. ret = malloc_ex_func(num,file,line); ^ 310. #ifdef LEVITTE_DEBUG_MEM 311. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num); crypto/mem.c:313:6: Taking false branch 311. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num); 312. #endif 313. if (malloc_debug_func != NULL) ^ 314. malloc_debug_func(ret, num, file, line, 1); 315. crypto/mem.c:320:12: Taking false branch 318. * sanitisation function can't be optimised out. NB: We only do 319. * this for >2Kb so the overhead doesn't bother us. */ 320. if(ret && (num > 2048)) ^ 321. { extern unsigned char cleanse_ctr; 322. ((unsigned char *)ret)[0] = cleanse_ctr; crypto/mem.c:326:2: 324. #endif 325. 326. > return ret; 327. } 328. char *CRYPTO_strdup(const char *str, const char *file, int line) crypto/mem.c:327:2: return from a call to CRYPTO_malloc 325. 326. return ret; 327. } ^ 328. char *CRYPTO_strdup(const char *str, const char *file, int line) 329. { crypto/x509/x509_lu.c:182:6: Taking true branch 180. X509_STORE *ret; 181. 182. if ((ret=(X509_STORE *)OPENSSL_malloc(sizeof(X509_STORE))) == NULL) ^ 183. return NULL; 184. ret->objs = sk_X509_OBJECT_new(x509_object_cmp); crypto/x509/x509_lu.c:183:3: 181. 182. if ((ret=(X509_STORE *)OPENSSL_malloc(sizeof(X509_STORE))) == NULL) 183. > return NULL; 184. ret->objs = sk_X509_OBJECT_new(x509_object_cmp); 185. ret->cache=1; crypto/x509/x509_lu.c:212:2: return from a call to X509_STORE_new 210. ret->references=1; 211. return ret; 212. } ^ 213. 214. static void cleanup(X509_OBJECT *a) apps/ts.c:1087:2: 1085. 1086. /* Setting the callback for certificate chain verification. */ 1087. > X509_STORE_set_verify_cb(cert_ctx, verify_cb); 1088. 1089. /* Adding a trusted certificate directory source. */ crypto/x509/x509_lu.c:709:1: start of procedure X509_STORE_set_verify_cb() 707. } 708. 709. > void X509_STORE_set_verify_cb(X509_STORE *ctx, 710. int (*verify_cb)(int, X509_STORE_CTX *)) 711. { crypto/x509/x509_lu.c:712:2: 710. int (*verify_cb)(int, X509_STORE_CTX *)) 711. { 712. > ctx->verify_cb = verify_cb; 713. } 714.
https://github.com/openssl/openssl/blob/d674bb4bc84e6e8cf510adfe7049cb19a2c29cf8/apps/ts.c/#L1087
d2a_code_trace_data_44725
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/t1_lib.c:1101: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + `s->srp_ctx.login->strlen` + `s->tlsext_hostname->strlen` + 28]):unsigned64 by call to `WPACKET_put_bytes__`. Showing all 11 steps of the trace ssl/t1_lib.c:1016:1: Parameter `pkt->written` 1014. } 1015. 1016. > int ssl_add_clienthello_tlsext(SSL *s, WPACKET *pkt, int *al) 1017. { 1018. #ifndef OPENSSL_NO_EC ssl/t1_lib.c:1101:14: Call 1099. tls1_get_formatlist(s, &pformats, &num_formats); 1100. 1101. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats) ^ 1102. /* Sub-packet for formats extension */ 1103. || !WPACKET_start_sub_packet_u16(pkt) ssl/packet.c:261:1: Parameter `pkt->written` 259. } 260. 261. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 262. { 263. unsigned char *data; ssl/packet.c:269:17: Call 267. 268. if (size > sizeof(unsigned int) 269. || !WPACKET_allocate_bytes(pkt, size, &data) ^ 270. || !put_value(data, val, size)) 271. 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] - [0, s->s3->previous_client_finished_len + pkt->written + s->srp_ctx.login->strlen + s->tlsext_hostname->strlen + 28]):unsigned64 by call to `WPACKET_put_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_44726
static int do_multi(int multi) { int n; int fd[2]; int *fds; static char sep[]=":"; fds=malloc(multi*sizeof *fds); for(n=0 ; n < multi ; ++n) { pipe(fd); if(fork()) { close(fd[1]); fds[n]=fd[0]; } else { close(fd[0]); close(1); dup(fd[1]); close(fd[1]); mr=1; usertime=0; return 0; } printf("Forked child %d\n",n); } for(n=0 ; n < multi ; ++n) { FILE *f; char buf[1024]; char *p; f=fdopen(fds[n],"r"); while(fgets(buf,sizeof buf,f)) { p=strchr(buf,'\n'); if(p) *p='\0'; if(buf[0] != '+') { fprintf(stderr,"Don't understand line '%s' from child %d\n", buf,n); continue; } printf("Got: %s from %d\n",buf,n); if(!strncmp(buf,"+F:",3)) { int alg; int j; p=buf+3; alg=atoi(sstrsep(&p,sep)); sstrsep(&p,sep); for(j=0 ; j < SIZE_NUM ; ++j) results[alg][j]+=atof(sstrsep(&p,sep)); } else if(!strncmp(buf,"+F2:",4)) { int k; double d; p=buf+4; k=atoi(sstrsep(&p,sep)); sstrsep(&p,sep); d=atof(sstrsep(&p,sep)); if(n) rsa_results[k][0]=1/(1/rsa_results[k][0]+1/d); else rsa_results[k][0]=d; d=atof(sstrsep(&p,sep)); if(n) rsa_results[k][1]=1/(1/rsa_results[k][1]+1/d); else rsa_results[k][1]=d; } else if(!strncmp(buf,"+F2:",4)) { int k; double d; p=buf+4; k=atoi(sstrsep(&p,sep)); sstrsep(&p,sep); d=atof(sstrsep(&p,sep)); if(n) rsa_results[k][0]=1/(1/rsa_results[k][0]+1/d); else rsa_results[k][0]=d; d=atof(sstrsep(&p,sep)); if(n) rsa_results[k][1]=1/(1/rsa_results[k][1]+1/d); else rsa_results[k][1]=d; } else if(!strncmp(buf,"+F3:",4)) { int k; double d; p=buf+4; k=atoi(sstrsep(&p,sep)); sstrsep(&p,sep); d=atof(sstrsep(&p,sep)); if(n) dsa_results[k][0]=1/(1/dsa_results[k][0]+1/d); else dsa_results[k][0]=d; d=atof(sstrsep(&p,sep)); if(n) dsa_results[k][1]=1/(1/dsa_results[k][1]+1/d); else dsa_results[k][1]=d; } #ifndef OPENSSL_NO_ECDSA else if(!strncmp(buf,"+F4:",4)) { int k; double d; p=buf+4; k=atoi(sstrsep(&p,sep)); sstrsep(&p,sep); d=atof(sstrsep(&p,sep)); if(n) ecdsa_results[k][0]=1/(1/ecdsa_results[k][0]+1/d); else ecdsa_results[k][0]=d; d=atof(sstrsep(&p,sep)); if(n) ecdsa_results[k][1]=1/(1/ecdsa_results[k][1]+1/d); else ecdsa_results[k][1]=d; } #endif #ifndef OPENSSL_NO_ECDH else if(!strncmp(buf,"+F5:",4)) { int k; double d; p=buf+4; k=atoi(sstrsep(&p,sep)); sstrsep(&p,sep); d=atof(sstrsep(&p,sep)); if(n) ecdh_results[k][0]=1/(1/ecdh_results[k][0]+1/d); else ecdh_results[k][0]=d; } #endif else if(!strncmp(buf,"+H:",3)) { } else fprintf(stderr,"Unknown type '%s' from child %d\n",buf,n); } } return 1; } apps/speed.c:2414: error: MEMORY_LEAK memory dynamically allocated by call to `malloc()` at line 2403, column 6 is not reachable after line 2414, column 10. Showing all 8 steps of the trace apps/speed.c:2396:1: start of procedure do_multi() 2394. 2395. #ifdef HAVE_FORK 2396. > static int do_multi(int multi) 2397. { 2398. int n; apps/speed.c:2401:2: 2399. int fd[2]; 2400. int *fds; 2401. > static char sep[]=":"; 2402. 2403. fds=malloc(multi*sizeof *fds); apps/speed.c:2403:2: 2401. static char sep[]=":"; 2402. 2403. > fds=malloc(multi*sizeof *fds); 2404. for(n=0 ; n < multi ; ++n) 2405. { apps/speed.c:2404:6: 2402. 2403. fds=malloc(multi*sizeof *fds); 2404. > for(n=0 ; n < multi ; ++n) 2405. { 2406. pipe(fd); apps/speed.c:2404:12: Loop condition is true. Entering loop body 2402. 2403. fds=malloc(multi*sizeof *fds); 2404. for(n=0 ; n < multi ; ++n) ^ 2405. { 2406. pipe(fd); apps/speed.c:2406:3: 2404. for(n=0 ; n < multi ; ++n) 2405. { 2406. > pipe(fd); 2407. if(fork()) 2408. { apps/speed.c:2407:6: Taking false branch 2405. { 2406. pipe(fd); 2407. if(fork()) ^ 2408. { 2409. close(fd[1]); apps/speed.c:2414:4: 2412. else 2413. { 2414. > close(fd[0]); 2415. close(1); 2416. dup(fd[1]);
https://github.com/openssl/openssl/blob/a1d85309ee183c97a5ee4f8277f17d87d7786e25/apps/speed.c/#L2414
d2a_code_trace_data_44727
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:335: 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:334:10: Call 332. * for Next Protocol Negotiation 333. */ 334. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_next_proto_neg) ^ 335. || !WPACKET_put_bytes_u16(pkt, 0)) { 336. SSLerr(SSL_F_TLS_CONSTRUCT_CTOS_NPN, ERR_R_INTERNAL_ERROR); ssl/packet.c:306:1: Parameter `pkt->buf->length` 304. } 305. 306. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 307. { 308. unsigned char *data; ssl/statem/extensions_clnt.c:335:17: Call 333. */ 334. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_next_proto_neg) 335. || !WPACKET_put_bytes_u16(pkt, 0)) { ^ 336. SSLerr(SSL_F_TLS_CONSTRUCT_CTOS_NPN, ERR_R_INTERNAL_ERROR); 337. 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_44728
AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) { AVFilterBufferRef *ret = NULL; av_unused char buf[16]; FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, sizeof(buf), perms), w, h); if (link->dstpad->get_video_buffer) ret = link->dstpad->get_video_buffer(link, perms, w, h); if (!ret) ret = avfilter_default_get_video_buffer(link, perms, w, h); if (ret) ret->type = AVMEDIA_TYPE_VIDEO; FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " returning "); ff_dprintf_ref(NULL, ret, 1); return ret; } libavfilter/avfilter.c:266: error: Null Dereference pointer `ret` last assigned on line 261 could be null and is dereferenced by call to `ff_dprintf_ref()` at line 266, column 109. libavfilter/avfilter.c:249:1: start of procedure avfilter_get_video_buffer() 247. } 248. 249. AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) ^ 250. { 251. AVFilterBufferRef *ret = NULL; libavfilter/avfilter.c:251:5: 249. AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) 250. { 251. AVFilterBufferRef *ret = NULL; ^ 252. 253. av_unused char buf[16]; libavfilter/avfilter.c:254:47: 252. 253. av_unused char buf[16]; 254. FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0); ^ 255. dprintf(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, sizeof(buf), perms), w, h); 256. libavfilter/avfilter.c:238:1: start of procedure ff_dprintf_link() 236. } 237. 238. void ff_dprintf_link(void *ctx, AVFilterLink *link, int end) ^ 239. { 240. dprintf(ctx, libavfilter/avfilter.c:247:1: return from a call to ff_dprintf_link 245. link->dst ? link->dst->filter->name : "", 246. end ? "\n" : ""); 247. } ^ 248. 249. AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) libavfilter/avfilter.c:257:9: Taking true branch 255. dprintf(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, sizeof(buf), perms), w, h); 256. 257. if (link->dstpad->get_video_buffer) ^ 258. ret = link->dstpad->get_video_buffer(link, perms, w, h); 259. libavfilter/avfilter.c:258:9: Skipping __function_pointer__(): unresolved function pointer 256. 257. if (link->dstpad->get_video_buffer) 258. ret = link->dstpad->get_video_buffer(link, perms, w, h); ^ 259. 260. if (!ret) libavfilter/avfilter.c:260:10: Taking true branch 258. ret = link->dstpad->get_video_buffer(link, perms, w, h); 259. 260. if (!ret) ^ 261. ret = avfilter_default_get_video_buffer(link, perms, w, h); 262. libavfilter/avfilter.c:261:9: Skipping avfilter_default_get_video_buffer(): empty list of specs 259. 260. if (!ret) 261. ret = avfilter_default_get_video_buffer(link, perms, w, h); ^ 262. 263. if (ret) libavfilter/avfilter.c:263:9: Taking false branch 261. ret = avfilter_default_get_video_buffer(link, perms, w, h); 262. 263. if (ret) ^ 264. ret->type = AVMEDIA_TYPE_VIDEO; 265. libavfilter/avfilter.c:266:47: 264. ret->type = AVMEDIA_TYPE_VIDEO; 265. 266. FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " returning "); ff_dprintf_ref(NULL, ret, 1); ^ 267. 268. return ret; libavfilter/avfilter.c:238:1: start of procedure ff_dprintf_link() 236. } 237. 238. void ff_dprintf_link(void *ctx, AVFilterLink *link, int end) ^ 239. { 240. dprintf(ctx, libavfilter/avfilter.c:247:1: return from a call to ff_dprintf_link 245. link->dst ? link->dst->filter->name : "", 246. end ? "\n" : ""); 247. } ^ 248. 249. AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) libavfilter/avfilter.c:266:109: 264. ret->type = AVMEDIA_TYPE_VIDEO; 265. 266. FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " returning "); ff_dprintf_ref(NULL, ret, 1); ^ 267. 268. return ret; libavfilter/avfilter.c:210:1: start of procedure ff_dprintf_ref() 208. } 209. 210. void ff_dprintf_ref(void *ctx, AVFilterBufferRef *ref, int end) ^ 211. { 212. av_unused char buf[16]; libavfilter/avfilter.c:219:9: Taking false branch 217. ref->pts, ref->pos); 218. 219. if (ref->video) { ^ 220. dprintf(ctx, " a:%d/%d s:%dx%d i:%c", 221. ref->video->pixel_aspect.num, ref->video->pixel_aspect.den,
https://github.com/libav/libav/blob/4ffff36751d7ac47643f088306f7620bd16f391f/libavfilter/avfilter.c/#L266
d2a_code_trace_data_44729
static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, const int size, const int h, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ MotionEstContext * const c= &s->me; const int stride= c->stride; const int uvstride= c->uvstride; const int qpel= flags&FLAG_QPEL; const int chroma= flags&FLAG_CHROMA; const int dxy= subx + (suby<<(1+qpel)); const int hx= subx + (x<<(1+qpel)); const int hy= suby + (y<<(1+qpel)); uint8_t * const * const ref= c->ref[ref_index]; uint8_t * const * const src= c->src[src_index]; int d; if(flags&FLAG_DIRECT){ assert(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)); if(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)){ const int time_pp= s->pp_time; const int time_pb= s->pb_time; const int mask= 2*qpel+1; if(s->mv_type==MV_TYPE_8X8){ int i; for(i=0; i<4; i++){ int fx = c->direct_basis_mv[i][0] + hx; int fy = c->direct_basis_mv[i][1] + hy; int bx = hx ? fx - c->co_located_mv[i][0] : c->co_located_mv[i][0]*(time_pb - time_pp)/time_pp + ((i &1)<<(qpel+4)); int by = hy ? fy - c->co_located_mv[i][1] : c->co_located_mv[i][1]*(time_pb - time_pp)/time_pp + ((i>>1)<<(qpel+4)); int fxy= (fx&mask) + ((fy&mask)<<(qpel+1)); int bxy= (bx&mask) + ((by&mask)<<(qpel+1)); uint8_t *dst= c->temp + 8*(i&1) + 8*stride*(i>>1); if(qpel){ c->qpel_put[1][fxy](dst, ref[0] + (fx>>2) + (fy>>2)*stride, stride); c->qpel_avg[1][bxy](dst, ref[8] + (bx>>2) + (by>>2)*stride, stride); }else{ c->hpel_put[1][fxy](dst, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 8); c->hpel_avg[1][bxy](dst, ref[8] + (bx>>1) + (by>>1)*stride, stride, 8); } } }else{ int fx = c->direct_basis_mv[0][0] + hx; int fy = c->direct_basis_mv[0][1] + hy; int bx = hx ? fx - c->co_located_mv[0][0] : (c->co_located_mv[0][0]*(time_pb - time_pp)/time_pp); int by = hy ? fy - c->co_located_mv[0][1] : (c->co_located_mv[0][1]*(time_pb - time_pp)/time_pp); int fxy= (fx&mask) + ((fy&mask)<<(qpel+1)); int bxy= (bx&mask) + ((by&mask)<<(qpel+1)); if(qpel){ c->qpel_put[1][fxy](c->temp , ref[0] + (fx>>2) + (fy>>2)*stride , stride); c->qpel_put[1][fxy](c->temp + 8 , ref[0] + (fx>>2) + (fy>>2)*stride + 8 , stride); c->qpel_put[1][fxy](c->temp + 8*stride, ref[0] + (fx>>2) + (fy>>2)*stride + 8*stride, stride); c->qpel_put[1][fxy](c->temp + 8 + 8*stride, ref[0] + (fx>>2) + (fy>>2)*stride + 8 + 8*stride, stride); c->qpel_avg[1][bxy](c->temp , ref[8] + (bx>>2) + (by>>2)*stride , stride); c->qpel_avg[1][bxy](c->temp + 8 , ref[8] + (bx>>2) + (by>>2)*stride + 8 , stride); c->qpel_avg[1][bxy](c->temp + 8*stride, ref[8] + (bx>>2) + (by>>2)*stride + 8*stride, stride); c->qpel_avg[1][bxy](c->temp + 8 + 8*stride, ref[8] + (bx>>2) + (by>>2)*stride + 8 + 8*stride, stride); }else{ assert((fx>>1) + 16*s->mb_x >= -16); assert((fy>>1) + 16*s->mb_y >= -16); assert((fx>>1) + 16*s->mb_x <= s->width); assert((fy>>1) + 16*s->mb_y <= s->height); assert((bx>>1) + 16*s->mb_x >= -16); assert((by>>1) + 16*s->mb_y >= -16); assert((bx>>1) + 16*s->mb_x <= s->width); assert((by>>1) + 16*s->mb_y <= s->height); c->hpel_put[0][fxy](c->temp, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 16); c->hpel_avg[0][bxy](c->temp, ref[8] + (bx>>1) + (by>>1)*stride, stride, 16); } } d = cmp_func(s, c->temp, src[0], stride, 16); }else d= 256*256*256*32; }else{ int uvdxy; if(dxy){ if(qpel){ c->qpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride); if(chroma){ int cx= hx/2; int cy= hy/2; cx= (cx>>1)|(cx&1); cy= (cy>>1)|(cy&1); uvdxy= (cx&1) + 2*(cy&1); } }else{ c->hpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride, h); if(chroma) uvdxy= dxy | (x&1) | (2*(y&1)); } d = cmp_func(s, c->temp, src[0], stride, h); }else{ d = cmp_func(s, src[0], ref[0] + x + y*stride, stride, h); if(chroma) uvdxy= (x&1) + 2*(y&1); } if(chroma){ uint8_t * const uvtemp= c->temp + 16*stride; c->hpel_put[size+1][uvdxy](uvtemp , ref[1] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1); c->hpel_put[size+1][uvdxy](uvtemp+8, ref[2] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1); d += chroma_cmp_func(s, uvtemp , src[1], uvstride, h>>1); d += chroma_cmp_func(s, uvtemp+8, src[2], uvstride, h>>1); } } #if 0 if(full_pel){ const int index= (((y)<<ME_MAP_SHIFT) + (x))&(ME_MAP_SIZE-1); score_map[index]= d; } d += (c->mv_penalty[hx - c->pred_x] + c->mv_penalty[hy - c->pred_y])*c->penalty_factor; #endif return d; } libavcodec/motion_est.c:1129: error: Buffer Overrun L2 Offset: [2, 5] (⇐ [0, 3] + 2) Size: 4 by call to `cmp`. libavcodec/motion_est.c:1125:13: Assignment 1123. chroma_cmpf= s->dsp.sse[1]; 1124. init_mv4_ref(c); 1125. for(i=0; i<4; i++){ ^ 1126. xy= s->block_index[i]; 1127. x= p->motion_val[0][xy][0]; libavcodec/motion_est.c:1129:17: Call 1127. x= p->motion_val[0][xy][0]; 1128. y= p->motion_val[0][xy][1]; 1129. d+= cmp(s, x>>shift, y>>shift, x&mask, y&mask, 1, 8, i, i, cmpf, chroma_cmpf, flags); ^ 1130. } 1131. s->mb_type[mb_xy]=CANDIDATE_MB_TYPE_INTER4V; libavcodec/motion_est.c:108:1: <Length trace> 106. against a proposed motion-compensated prediction of that block 107. */ 108. static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, ^ 109. const int size, const int h, int ref_index, int src_index, 110. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ libavcodec/motion_est.c:108:1: Parameter `ref_index` 106. against a proposed motion-compensated prediction of that block 107. */ 108. static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, ^ 109. const int size, const int h, int ref_index, int src_index, 110. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ libavcodec/motion_est.c:119:5: Assignment 117. const int hx= subx + (x<<(1+qpel)); 118. const int hy= suby + (y<<(1+qpel)); 119. uint8_t * const * const ref= c->ref[ref_index]; ^ 120. uint8_t * const * const src= c->src[src_index]; 121. int d; libavcodec/motion_est.c:209:50: Array access: Offset: [2, 5] (⇐ [0, 3] + 2) Size: 4 by call to `cmp` 207. uint8_t * const uvtemp= c->temp + 16*stride; 208. c->hpel_put[size+1][uvdxy](uvtemp , ref[1] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1); 209. c->hpel_put[size+1][uvdxy](uvtemp+8, ref[2] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1); ^ 210. d += chroma_cmp_func(s, uvtemp , src[1], uvstride, h>>1); 211. d += chroma_cmp_func(s, uvtemp+8, src[2], uvstride, h>>1);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est.c/#L209
d2a_code_trace_data_44730
static inline void dv_encode_video_segment(DVVideoContext *s, uint8_t *dif, const uint16_t *mb_pos_ptr) { int mb_index, i, j, v; int mb_x, mb_y, c_offset, linesize; uint8_t* y_ptr; uint8_t* data; uint8_t* ptr; int do_edge_wrap; DECLARE_ALIGNED_16(DCTELEM, block[64]); EncBlockInfo enc_blks[5*6]; PutBitContext pbs[5*6]; PutBitContext* pb; EncBlockInfo* enc_blk; int vs_bit_size = 0; int qnos[5]; assert((((int)block) & 15) == 0); enc_blk = &enc_blks[0]; pb = &pbs[0]; for(mb_index = 0; mb_index < 5; mb_index++) { v = *mb_pos_ptr++; mb_x = v & 0xff; mb_y = v >> 8; if (s->sys->pix_fmt == PIX_FMT_YUV422P) { y_ptr = s->picture.data[0] + (mb_y * s->picture.linesize[0] * 8) + (mb_x * 4); } else { y_ptr = s->picture.data[0] + (mb_y * s->picture.linesize[0] * 8) + (mb_x * 8); } if (s->sys->pix_fmt == PIX_FMT_YUV420P) { c_offset = (((mb_y >> 1) * s->picture.linesize[1] * 8) + ((mb_x >> 1) * 8)); } else { c_offset = ((mb_y * s->picture.linesize[1] * 8) + ((mb_x >> 2) * 8)); } do_edge_wrap = 0; qnos[mb_index] = 15; ptr = dif + mb_index*80 + 4; for(j = 0;j < 6; j++) { int dummy = 0; if (s->sys->pix_fmt == PIX_FMT_YUV422P) { if (j == 0 || j == 2) { data = y_ptr + ((j>>1) * 8); linesize = s->picture.linesize[0]; } else if (j > 3) { data = s->picture.data[6 - j] + c_offset; linesize = s->picture.linesize[6 - j]; } else { data = 0; linesize = 0; dummy = 1; } } else { if (j < 4) { if (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x < (704 / 8)) { data = y_ptr + (j * 8); } else { data = y_ptr + ((j & 1) * 8) + ((j >> 1) * 8 * s->picture.linesize[0]); } linesize = s->picture.linesize[0]; } else { data = s->picture.data[6 - j] + c_offset; linesize = s->picture.linesize[6 - j]; if (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x >= (704 / 8)) do_edge_wrap = 1; } } if (do_edge_wrap) { uint8_t* d; DCTELEM *b = block; for (i=0;i<8;i++) { d = data + 8 * linesize; b[0] = data[0]; b[1] = data[1]; b[2] = data[2]; b[3] = data[3]; b[4] = d[0]; b[5] = d[1]; b[6] = d[2]; b[7] = d[3]; data += linesize; b += 8; } } else { if (!dummy) s->get_pixels(block, data, linesize); } if(s->avctx->flags & CODEC_FLAG_INTERLACED_DCT) enc_blk->dct_mode = dv_guess_dct_mode(block); else enc_blk->dct_mode = 0; enc_blk->area_q[0] = enc_blk->area_q[1] = enc_blk->area_q[2] = enc_blk->area_q[3] = 0; enc_blk->partial_bit_count = 0; enc_blk->partial_bit_buffer = 0; enc_blk->cur_ac = 0; if (dummy) { memset(block, 0, sizeof(block)); } else { s->fdct[enc_blk->dct_mode](block); } dv_set_class_number(block, enc_blk, enc_blk->dct_mode ? ff_zigzag248_direct : ff_zigzag_direct, enc_blk->dct_mode ? dv_weight_248 : dv_weight_88, j/4); init_put_bits(pb, ptr, block_sizes[j]/8); put_bits(pb, 9, (uint16_t)(((enc_blk->mb[0] >> 3) - 1024 + 2) >> 2)); put_bits(pb, 1, enc_blk->dct_mode); put_bits(pb, 2, enc_blk->cno); vs_bit_size += enc_blk->bit_size[0] + enc_blk->bit_size[1] + enc_blk->bit_size[2] + enc_blk->bit_size[3]; ++enc_blk; ++pb; ptr += block_sizes[j]/8; } } if (vs_total_ac_bits < vs_bit_size) dv_guess_qnos(&enc_blks[0], &qnos[0]); for (i=0; i<5; i++) { dif[i*80 + 3] = qnos[i]; } for (j=0; j<5*6; j++) dv_encode_ac(&enc_blks[j], &pbs[j], &pbs[j+1]); for (j=0; j<5*6; j+=6) { pb= &pbs[j]; for (i=0; i<6; i++) { if (enc_blks[i+j].partial_bit_count) pb=dv_encode_ac(&enc_blks[i+j], pb, &pbs[j+6]); } } pb= &pbs[0]; for (j=0; j<5*6; j++) { if (enc_blks[j].partial_bit_count) pb=dv_encode_ac(&enc_blks[j], pb, &pbs[6*5]); if (enc_blks[j].partial_bit_count) av_log(NULL, AV_LOG_ERROR, "ac bitstream overflow\n"); } for (j=0; j<5*6; j++) flush_put_bits(&pbs[j]); } libavcodec/dv.c:971: error: Buffer Overrun L2 Offset: [0, 34] Size: 30. libavcodec/dv.c:968:10: <Offset trace> 966. 967. /* Second pass over each MB space */ 968. for (j=0; j<5*6; j+=6) { ^ 969. pb= &pbs[j]; 970. for (i=0; i<6; i++) { libavcodec/dv.c:968:10: Assignment 966. 967. /* Second pass over each MB space */ 968. for (j=0; j<5*6; j+=6) { ^ 969. pb= &pbs[j]; 970. for (i=0; i<6; i++) { libavcodec/dv.c:831:1: <Length trace> 829. } 830. 831. static inline void dv_encode_video_segment(DVVideoContext *s, ^ 832. uint8_t *dif, 833. const uint16_t *mb_pos_ptr) libavcodec/dv.c:831:1: Array declaration 829. } 830. 831. static inline void dv_encode_video_segment(DVVideoContext *s, ^ 832. uint8_t *dif, 833. const uint16_t *mb_pos_ptr) libavcodec/dv.c:971:17: Array access: Offset: [0, 34] Size: 30 969. pb= &pbs[j]; 970. for (i=0; i<6; i++) { 971. if (enc_blks[i+j].partial_bit_count) ^ 972. pb=dv_encode_ac(&enc_blks[i+j], pb, &pbs[j+6]); 973. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dv.c/#L971
d2a_code_trace_data_44731
static void *v2i_IPAddrBlocks(const struct v3_ext_method *method, struct v3_ext_ctx *ctx, STACK_OF(CONF_VALUE) *values) { static const char v4addr_chars[] = "0123456789."; static const char v6addr_chars[] = "0123456789.:abcdefABCDEF"; IPAddrBlocks *addr = NULL; char *s = NULL, *t; int i; if ((addr = sk_IPAddressFamily_new(IPAddressFamily_cmp)) == NULL) { X509V3err(X509V3_F_V2I_IPADDRBLOCKS, ERR_R_MALLOC_FAILURE); return NULL; } for (i = 0; i < sk_CONF_VALUE_num(values); i++) { CONF_VALUE *val = sk_CONF_VALUE_value(values, i); unsigned char min[ADDR_RAW_BUF_LEN], max[ADDR_RAW_BUF_LEN]; unsigned afi, *safi = NULL, safi_; const char *addr_chars = NULL; int prefixlen, i1, i2, delim, length; if (!name_cmp(val->name, "IPv4")) { afi = IANA_AFI_IPV4; } else if (!name_cmp(val->name, "IPv6")) { afi = IANA_AFI_IPV6; } else if (!name_cmp(val->name, "IPv4-SAFI")) { afi = IANA_AFI_IPV4; safi = &safi_; } else if (!name_cmp(val->name, "IPv6-SAFI")) { afi = IANA_AFI_IPV6; safi = &safi_; } else { X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_EXTENSION_NAME_ERROR); X509V3_conf_err(val); goto err; } switch (afi) { case IANA_AFI_IPV4: addr_chars = v4addr_chars; break; case IANA_AFI_IPV6: addr_chars = v6addr_chars; break; } length = length_from_afi(afi); if (safi != NULL) { *safi = strtoul(val->value, &t, 0); t += strspn(t, " \t"); if (*safi > 0xFF || *t++ != ':') { X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_INVALID_SAFI); X509V3_conf_err(val); goto err; } t += strspn(t, " \t"); s = OPENSSL_strdup(t); } else { s = OPENSSL_strdup(val->value); } if (s == NULL) { X509V3err(X509V3_F_V2I_IPADDRBLOCKS, ERR_R_MALLOC_FAILURE); goto err; } if (strcmp(s, "inherit") == 0) { if (!v3_addr_add_inherit(addr, afi, safi)) { X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_INVALID_INHERITANCE); X509V3_conf_err(val); goto err; } OPENSSL_free(s); s = NULL; continue; } i1 = strspn(s, addr_chars); i2 = i1 + strspn(s + i1, " \t"); delim = s[i2++]; s[i1] = '\0'; if (a2i_ipadd(min, s) != length) { X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_INVALID_IPADDRESS); X509V3_conf_err(val); goto err; } switch (delim) { case '/': prefixlen = (int)strtoul(s + i2, &t, 10); if (t == s + i2 || *t != '\0') { X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_EXTENSION_VALUE_ERROR); X509V3_conf_err(val); goto err; } if (!v3_addr_add_prefix(addr, afi, safi, min, prefixlen)) { X509V3err(X509V3_F_V2I_IPADDRBLOCKS, ERR_R_MALLOC_FAILURE); goto err; } break; case '-': i1 = i2 + strspn(s + i2, " \t"); i2 = i1 + strspn(s + i1, addr_chars); if (i1 == i2 || s[i2] != '\0') { X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_EXTENSION_VALUE_ERROR); X509V3_conf_err(val); goto err; } if (a2i_ipadd(max, s + i1) != length) { X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_INVALID_IPADDRESS); X509V3_conf_err(val); goto err; } if (memcmp(min, max, length_from_afi(afi)) > 0) { X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_EXTENSION_VALUE_ERROR); X509V3_conf_err(val); goto err; } if (!v3_addr_add_range(addr, afi, safi, min, max)) { X509V3err(X509V3_F_V2I_IPADDRBLOCKS, ERR_R_MALLOC_FAILURE); goto err; } break; case '\0': if (!v3_addr_add_prefix(addr, afi, safi, min, length * 8)) { X509V3err(X509V3_F_V2I_IPADDRBLOCKS, ERR_R_MALLOC_FAILURE); goto err; } break; default: X509V3err(X509V3_F_V2I_IPADDRBLOCKS, X509V3_R_EXTENSION_VALUE_ERROR); X509V3_conf_err(val); goto err; } OPENSSL_free(s); s = NULL; } if (!v3_addr_canonize(addr)) goto err; return addr; err: OPENSSL_free(s); sk_IPAddressFamily_pop_free(addr, IPAddressFamily_free); return NULL; } crypto/x509v3/v3_addr.c:1091: error: MEMORY_LEAK memory dynamically allocated by call to `sk_IPAddressFamily_new()` at line 942, column 17 is not reachable after line 1091, column 10. Showing all 58 steps of the trace crypto/x509v3/v3_addr.c:932:1: start of procedure v2i_IPAddrBlocks() 930. * v2i handler for the IPAddrBlocks extension. 931. */ 932. > static void *v2i_IPAddrBlocks(const struct v3_ext_method *method, 933. struct v3_ext_ctx *ctx, 934. STACK_OF(CONF_VALUE) *values) crypto/x509v3/v3_addr.c:936:5: 934. STACK_OF(CONF_VALUE) *values) 935. { 936. > static const char v4addr_chars[] = "0123456789."; 937. static const char v6addr_chars[] = "0123456789.:abcdefABCDEF"; 938. IPAddrBlocks *addr = NULL; crypto/x509v3/v3_addr.c:937:5: 935. { 936. static const char v4addr_chars[] = "0123456789."; 937. > static const char v6addr_chars[] = "0123456789.:abcdefABCDEF"; 938. IPAddrBlocks *addr = NULL; 939. char *s = NULL, *t; crypto/x509v3/v3_addr.c:938:5: 936. static const char v4addr_chars[] = "0123456789."; 937. static const char v6addr_chars[] = "0123456789.:abcdefABCDEF"; 938. > IPAddrBlocks *addr = NULL; 939. char *s = NULL, *t; 940. int i; crypto/x509v3/v3_addr.c:939:5: 937. static const char v6addr_chars[] = "0123456789.:abcdefABCDEF"; 938. IPAddrBlocks *addr = NULL; 939. > char *s = NULL, *t; 940. int i; 941. crypto/x509v3/v3_addr.c:942:9: 940. int i; 941. 942. > if ((addr = sk_IPAddressFamily_new(IPAddressFamily_cmp)) == NULL) { 943. X509V3err(X509V3_F_V2I_IPADDRBLOCKS, ERR_R_MALLOC_FAILURE); 944. return NULL; include/openssl/x509v3.h:839:1: start of procedure sk_IPAddressFamily_new() 837. 838. typedef STACK_OF(IPAddressFamily) IPAddrBlocks; 839. > DEFINE_STACK_OF(IPAddressFamily) 840. 841. DECLARE_ASN1_FUNCTIONS(IPAddressRange) crypto/stack/stack.c:150:1: start of procedure sk_new() 148. } 149. 150. > _STACK *sk_new(int (*c) (const void *, const void *)) 151. { 152. _STACK *ret; crypto/stack/stack.c:154:9: 152. _STACK *ret; 153. 154. > if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/stack/stack.c:154:9: Taking false branch 152. _STACK *ret; 153. 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) ^ 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) crypto/stack/stack.c:156:9: 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. > if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) 157. goto err; 158. ret->comp = c; crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/stack/stack.c:156:9: Taking false branch 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) ^ 157. goto err; 158. ret->comp = c; crypto/stack/stack.c:158:5: 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) 157. goto err; 158. > ret->comp = c; 159. ret->num_alloc = MIN_NODES; 160. return (ret); crypto/stack/stack.c:159:5: 157. goto err; 158. ret->comp = c; 159. > ret->num_alloc = MIN_NODES; 160. return (ret); 161. crypto/stack/stack.c:160:5: 158. ret->comp = c; 159. ret->num_alloc = MIN_NODES; 160. > return (ret); 161. 162. err: crypto/stack/stack.c:165:1: return from a call to sk_new 163. OPENSSL_free(ret); 164. return (NULL); 165. > } 166. 167. int sk_insert(_STACK *st, void *data, int loc) include/openssl/x509v3.h:839:1: return from a call to sk_IPAddressFamily_new 837. 838. typedef STACK_OF(IPAddressFamily) IPAddrBlocks; 839. > DEFINE_STACK_OF(IPAddressFamily) 840. 841. DECLARE_ASN1_FUNCTIONS(IPAddressRange) crypto/x509v3/v3_addr.c:942:9: Taking false branch 940. int i; 941. 942. if ((addr = sk_IPAddressFamily_new(IPAddressFamily_cmp)) == NULL) { ^ 943. X509V3err(X509V3_F_V2I_IPADDRBLOCKS, ERR_R_MALLOC_FAILURE); 944. return NULL; crypto/x509v3/v3_addr.c:947:10: 945. } 946. 947. > for (i = 0; i < sk_CONF_VALUE_num(values); i++) { 948. CONF_VALUE *val = sk_CONF_VALUE_value(values, i); 949. unsigned char min[ADDR_RAW_BUF_LEN], max[ADDR_RAW_BUF_LEN]; crypto/x509v3/v3_addr.c:947:17: 945. } 946. 947. > for (i = 0; i < sk_CONF_VALUE_num(values); i++) { 948. CONF_VALUE *val = sk_CONF_VALUE_value(values, i); 949. unsigned char min[ADDR_RAW_BUF_LEN], max[ADDR_RAW_BUF_LEN]; include/openssl/conf.h:80:1: start of procedure sk_CONF_VALUE_num() 78. } CONF_VALUE; 79. 80. > DEFINE_STACK_OF(CONF_VALUE) 81. DECLARE_LHASH_OF(CONF_VALUE); 82. 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/conf.h:80:1: return from a call to sk_CONF_VALUE_num 78. } CONF_VALUE; 79. 80. > DEFINE_STACK_OF(CONF_VALUE) 81. DECLARE_LHASH_OF(CONF_VALUE); 82. crypto/x509v3/v3_addr.c:947:17: Loop condition is false. Leaving loop 945. } 946. 947. for (i = 0; i < sk_CONF_VALUE_num(values); i++) { ^ 948. CONF_VALUE *val = sk_CONF_VALUE_value(values, i); 949. unsigned char min[ADDR_RAW_BUF_LEN], max[ADDR_RAW_BUF_LEN]; crypto/x509v3/v3_addr.c:1091:10: Skipping v3_addr_canonize(): empty list of specs 1089. * Canonize the result, then we're done. 1090. */ 1091. if (!v3_addr_canonize(addr)) ^ 1092. goto err; 1093. return addr;
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/x509v3/v3_addr.c/#L1091
d2a_code_trace_data_44732
static int vp3_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; Vp3DecodeContext *s = avctx->priv_data; GetBitContext gb; int i; init_get_bits(&gb, buf, buf_size * 8); if (s->theora && get_bits1(&gb)) { av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n"); return -1; } s->keyframe = !get_bits1(&gb); if (!s->theora) skip_bits(&gb, 1); for (i = 0; i < 3; i++) s->last_qps[i] = s->qps[i]; s->nqps=0; do{ s->qps[s->nqps++]= get_bits(&gb, 6); } while(s->theora >= 0x030200 && s->nqps<3 && get_bits1(&gb)); for (i = s->nqps; i < 3; i++) s->qps[i] = -1; if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, " VP3 %sframe #%d: Q index = %d\n", s->keyframe?"key":"", avctx->frame_number+1, s->qps[0]); s->skip_loop_filter = !s->filter_limit_values[s->qps[0]] || avctx->skip_loop_filter >= (s->keyframe ? AVDISCARD_ALL : AVDISCARD_NONKEY); if (s->qps[0] != s->last_qps[0]) init_loop_filter(s); for (i = 0; i < s->nqps; i++) if (s->qps[i] != s->last_qps[i] || s->qps[0] != s->last_qps[0]) init_dequantizer(s, i); if (avctx->skip_frame >= AVDISCARD_NONKEY && !s->keyframe) return buf_size; s->current_frame.reference = 3; s->current_frame.pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; if (ff_thread_get_buffer(avctx, &s->current_frame) < 0) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); goto error; } if (!s->edge_emu_buffer) s->edge_emu_buffer = av_malloc(9*FFABS(s->current_frame.linesize[0])); if (s->keyframe) { if (!s->theora) { skip_bits(&gb, 4); skip_bits(&gb, 4); if (s->version) { s->version = get_bits(&gb, 5); if (avctx->frame_number == 0) av_log(s->avctx, AV_LOG_DEBUG, "VP version: %d\n", s->version); } } if (s->version || s->theora) { if (get_bits1(&gb)) av_log(s->avctx, AV_LOG_ERROR, "Warning, unsupported keyframe coding type?!\n"); skip_bits(&gb, 2); } } else { if (!s->golden_frame.data[0]) { av_log(s->avctx, AV_LOG_WARNING, "vp3: first frame not a keyframe\n"); s->golden_frame.reference = 3; s->golden_frame.pict_type = AV_PICTURE_TYPE_I; if (ff_thread_get_buffer(avctx, &s->golden_frame) < 0) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); goto error; } s->last_frame = s->golden_frame; s->last_frame.type = FF_BUFFER_TYPE_COPY; ff_thread_report_progress(&s->last_frame, INT_MAX, 0); } } memset(s->all_fragments, 0, s->fragment_count * sizeof(Vp3Fragment)); ff_thread_finish_setup(avctx); if (unpack_superblocks(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_superblocks\n"); goto error; } if (unpack_modes(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_modes\n"); goto error; } if (unpack_vectors(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_vectors\n"); goto error; } if (unpack_block_qpis(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_block_qpis\n"); goto error; } if (unpack_dct_coeffs(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_dct_coeffs\n"); goto error; } for (i = 0; i < 3; i++) { int height = s->height >> (i && s->chroma_y_shift); if (s->flipped_image) s->data_offset[i] = 0; else s->data_offset[i] = (height-1) * s->current_frame.linesize[i]; } s->last_slice_end = 0; for (i = 0; i < s->c_superblock_height; i++) render_slice(s, i); for (i = 0; i < 3; i++) { int row = (s->height >> (3+(i && s->chroma_y_shift))) - 1; apply_loop_filter(s, i, row, row+1); } vp3_draw_horiz_band(s, s->avctx->height); *data_size=sizeof(AVFrame); *(AVFrame*)data= s->current_frame; if (!HAVE_THREADS || !(s->avctx->active_thread_type&FF_THREAD_FRAME)) update_frames(avctx); return buf_size; error: ff_thread_report_progress(&s->current_frame, INT_MAX, 0); if (!HAVE_THREADS || !(s->avctx->active_thread_type&FF_THREAD_FRAME)) avctx->release_buffer(avctx, &s->current_frame); return -1; } libavcodec/vp3.c:1860: error: Null Dereference pointer `&gb->buffer` last assigned on line 1858 could be null and is dereferenced by call to `get_bits1()` at line 1860, column 22. libavcodec/vp3.c:1848:1: start of procedure vp3_decode_frame() 1846. * This is the ffmpeg/libavcodec API frame decode function. 1847. */ 1848. static int vp3_decode_frame(AVCodecContext *avctx, ^ 1849. void *data, int *data_size, 1850. AVPacket *avpkt) libavcodec/vp3.c:1852:5: 1850. AVPacket *avpkt) 1851. { 1852. const uint8_t *buf = avpkt->data; ^ 1853. int buf_size = avpkt->size; 1854. Vp3DecodeContext *s = avctx->priv_data; libavcodec/vp3.c:1853:5: 1851. { 1852. const uint8_t *buf = avpkt->data; 1853. int buf_size = avpkt->size; ^ 1854. Vp3DecodeContext *s = avctx->priv_data; 1855. GetBitContext gb; libavcodec/vp3.c:1854:5: 1852. const uint8_t *buf = avpkt->data; 1853. int buf_size = avpkt->size; 1854. Vp3DecodeContext *s = avctx->priv_data; ^ 1855. GetBitContext gb; 1856. int i; libavcodec/vp3.c:1858:5: 1856. int i; 1857. 1858. init_get_bits(&gb, buf, buf_size * 8); ^ 1859. 1860. if (s->theora && get_bits1(&gb)) libavcodec/get_bits.h:383:1: start of procedure init_get_bits() 381. * responsible for checking for the buffer end yourself (take advantage of the padding)! 382. */ 383. static inline void init_get_bits(GetBitContext *s, ^ 384. const uint8_t *buffer, int bit_size) 385. { libavcodec/get_bits.h:386:5: 384. const uint8_t *buffer, int bit_size) 385. { 386. int buffer_size = (bit_size+7)>>3; ^ 387. if (buffer_size < 0 || bit_size < 0) { 388. buffer_size = bit_size = 0; libavcodec/get_bits.h:387:9: Taking true branch 385. { 386. int buffer_size = (bit_size+7)>>3; 387. if (buffer_size < 0 || bit_size < 0) { ^ 388. buffer_size = bit_size = 0; 389. buffer = NULL; libavcodec/get_bits.h:388:9: 386. int buffer_size = (bit_size+7)>>3; 387. if (buffer_size < 0 || bit_size < 0) { 388. buffer_size = bit_size = 0; ^ 389. buffer = NULL; 390. } libavcodec/get_bits.h:389:9: 387. if (buffer_size < 0 || bit_size < 0) { 388. buffer_size = bit_size = 0; 389. buffer = NULL; ^ 390. } 391. libavcodec/get_bits.h:392:5: 390. } 391. 392. s->buffer = buffer; ^ 393. s->size_in_bits = bit_size; 394. s->buffer_end = buffer + buffer_size; libavcodec/get_bits.h:393:5: 391. 392. s->buffer = buffer; 393. s->size_in_bits = bit_size; ^ 394. s->buffer_end = buffer + buffer_size; 395. #ifdef ALT_BITSTREAM_READER libavcodec/get_bits.h:394:5: 392. s->buffer = buffer; 393. s->size_in_bits = bit_size; 394. s->buffer_end = buffer + buffer_size; ^ 395. #ifdef ALT_BITSTREAM_READER 396. s->index = 0; libavcodec/get_bits.h:396:5: 394. s->buffer_end = buffer + buffer_size; 395. #ifdef ALT_BITSTREAM_READER 396. s->index = 0; ^ 397. #elif defined A32_BITSTREAM_READER 398. s->buffer_ptr = (uint32_t*)((intptr_t)buffer & ~3); libavcodec/get_bits.h:402:1: return from a call to init_get_bits 400. skip_bits_long(s, 0); 401. #endif 402. } ^ 403. 404. static inline void align_get_bits(GetBitContext *s) libavcodec/vp3.c:1860:9: Taking true branch 1858. init_get_bits(&gb, buf, buf_size * 8); 1859. 1860. if (s->theora && get_bits1(&gb)) ^ 1861. { 1862. av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n"); libavcodec/vp3.c:1860:22: 1858. init_get_bits(&gb, buf, buf_size * 8); 1859. 1860. if (s->theora && get_bits1(&gb)) ^ 1861. { 1862. av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n"); libavcodec/get_bits.h:303:1: start of procedure get_bits1() 301. } 302. 303. static inline unsigned int get_bits1(GetBitContext *s){ ^ 304. #ifdef ALT_BITSTREAM_READER 305. unsigned int index = s->index; libavcodec/get_bits.h:305:5: 303. static inline unsigned int get_bits1(GetBitContext *s){ 304. #ifdef ALT_BITSTREAM_READER 305. unsigned int index = s->index; ^ 306. uint8_t result = s->buffer[index>>3]; 307. #ifdef ALT_BITSTREAM_READER_LE libavcodec/get_bits.h:306:5: 304. #ifdef ALT_BITSTREAM_READER 305. unsigned int index = s->index; 306. uint8_t result = s->buffer[index>>3]; ^ 307. #ifdef ALT_BITSTREAM_READER_LE 308. result >>= index & 7;
https://github.com/libav/libav/blob/33684b9c12b74c0140fb91e8150263db4a48d55e/libavcodec/vp3.c/#L1860
d2a_code_trace_data_44733
static inline uint64_t get_val(BitstreamContext *bc, unsigned n) { #ifdef BITSTREAM_READER_LE uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1); bc->bits >>= n; #else uint64_t ret = bc->bits >> (64 - n); bc->bits <<= n; #endif bc->bits_left -= n; return ret; } libavcodec/takdec.c:622: error: Integer Overflow L2 ([1, +oo] - 3):unsigned32 by call to `bitstream_read`. libavcodec/takdec.c:622:34: Call 620. for (i = 0; i < filter_order; i++) { 621. if (!(i & 3)) 622. code_size = 14 - bitstream_read(bc, 3); ^ 623. filter[i] = bitstream_read_signed(bc, code_size); 624. } libavcodec/bitstream.h:183:1: Parameter `n` 181. 182. /* Return n bits from the buffer. n has to be in the 0-32 range. */ 183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n) ^ 184. { 185. if (!n) libavcodec/bitstream.h:194:12: Call 192. } 193. 194. return get_val(bc, n); ^ 195. } 196. libavcodec/bitstream.h:130:1: <LHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `bc->bits_left` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: <RHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Binary operation: ([1, +oo] - 3):unsigned32 by call to `bitstream_read` 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret;
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L139
d2a_code_trace_data_44734
unsigned char *next_protos_parse(size_t *outlen, const char *in) { size_t len; unsigned char *out; size_t i, start = 0; len = strlen(in); if (len >= 65535) return NULL; out = app_malloc(strlen(in) + 1, "NPN buffer"); for (i = 0; i <= len; ++i) { if (i == len || in[i] == ',') { if (i - start > 255) { OPENSSL_free(out); return NULL; } out[start] = (unsigned char)(i - start); start = i + 1; } else { out[i + 1] = in[i]; } } *outlen = len + 1; return out; } apps/apps.c:1800: error: NULL_DEREFERENCE pointer `out` last assigned on line 1793 could be null and is dereferenced at line 1800, column 13. Showing all 25 steps of the trace apps/apps.c:1783:1: start of procedure next_protos_parse() 1781. * returns: a malloc'd buffer or NULL on failure. 1782. */ 1783. > unsigned char *next_protos_parse(size_t *outlen, const char *in) 1784. { 1785. size_t len; apps/apps.c:1787:5: 1785. size_t len; 1786. unsigned char *out; 1787. > size_t i, start = 0; 1788. 1789. len = strlen(in); apps/apps.c:1789:5: 1787. size_t i, start = 0; 1788. 1789. > len = strlen(in); 1790. if (len >= 65535) 1791. return NULL; apps/apps.c:1790:9: Taking false branch 1788. 1789. len = strlen(in); 1790. if (len >= 65535) ^ 1791. return NULL; 1792. apps/apps.c:1793:5: 1791. return NULL; 1792. 1793. > out = app_malloc(strlen(in) + 1, "NPN buffer"); 1794. for (i = 0; i <= len; ++i) { 1795. if (i == len || in[i] == ',') { test/testutil/apps_mem.c:14:1: start of procedure app_malloc() 12. /* shim that avoids sucking in too much from apps/apps.c */ 13. 14. > void* app_malloc(int sz, const char *what) 15. { 16. void *vp = OPENSSL_malloc(sz); test/testutil/apps_mem.c:16:5: 14. void* app_malloc(int sz, const char *what) 15. { 16. > void *vp = OPENSSL_malloc(sz); 17. 18. return vp; 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 false branch 202. 203. FAILTEST(); 204. if (allow_customize) { ^ 205. /* 206. * Disallow customization after the first allocation. We only set this 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) test/testutil/apps_mem.c:18:5: 16. void *vp = OPENSSL_malloc(sz); 17. 18. > return vp; 19. } test/testutil/apps_mem.c:19:1: return from a call to app_malloc 17. 18. return vp; 19. > } apps/apps.c:1794:10: 1792. 1793. out = app_malloc(strlen(in) + 1, "NPN buffer"); 1794. > for (i = 0; i <= len; ++i) { 1795. if (i == len || in[i] == ',') { 1796. if (i - start > 255) { apps/apps.c:1794:17: Loop condition is true. Entering loop body 1792. 1793. out = app_malloc(strlen(in) + 1, "NPN buffer"); 1794. for (i = 0; i <= len; ++i) { ^ 1795. if (i == len || in[i] == ',') { 1796. if (i - start > 255) { apps/apps.c:1795:13: Taking false branch 1793. out = app_malloc(strlen(in) + 1, "NPN buffer"); 1794. for (i = 0; i <= len; ++i) { 1795. if (i == len || in[i] == ',') { ^ 1796. if (i - start > 255) { 1797. OPENSSL_free(out); apps/apps.c:1795:25: Taking true branch 1793. out = app_malloc(strlen(in) + 1, "NPN buffer"); 1794. for (i = 0; i <= len; ++i) { 1795. if (i == len || in[i] == ',') { ^ 1796. if (i - start > 255) { 1797. OPENSSL_free(out); apps/apps.c:1796:17: Taking false branch 1794. for (i = 0; i <= len; ++i) { 1795. if (i == len || in[i] == ',') { 1796. if (i - start > 255) { ^ 1797. OPENSSL_free(out); 1798. return NULL; apps/apps.c:1800:13: 1798. return NULL; 1799. } 1800. > out[start] = (unsigned char)(i - start); 1801. start = i + 1; 1802. } else {
https://github.com/openssl/openssl/blob/ce506d27ab5e7d17dfe3fe649768a0d19b6c86ee/apps/apps.c/#L1800
d2a_code_trace_data_44735
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_x931g.c:161: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_X931_generate_Xpq`. Showing all 13 steps of the trace crypto/rsa/rsa_x931g.c:156:5: Call 154. goto error; 155. 156. BN_CTX_start(ctx); ^ 157. Xp = BN_CTX_get(ctx); 158. Xq = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/rsa/rsa_x931g.c:161:10: Call 159. if (Xq == NULL) 160. goto error; 161. if (!BN_X931_generate_Xpq(Xp, Xq, bits, ctx)) ^ 162. goto error; 163. crypto/bn/bn_x931p.c:179:5: Call 177. goto err; 178. 179. BN_CTX_start(ctx); ^ 180. t = BN_CTX_get(ctx); 181. if (t == 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_x931p.c:195:5: Call 193. } 194. 195. BN_CTX_end(ctx); ^ 196. 197. if (i < 1000) 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_X931_generate_Xpq` 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_44736
static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame) { AVCodecInternal *avci = avctx->internal; InternalBuffer *buf; int buf_size, ret, i, needs_extended_data; buf_size = av_samples_get_buffer_size(NULL, avctx->channels, frame->nb_samples, avctx->sample_fmt, 32); if (buf_size < 0) return AVERROR(EINVAL); needs_extended_data = av_sample_fmt_is_planar(avctx->sample_fmt) && avctx->channels > AV_NUM_DATA_POINTERS; if (!avci->buffer) { avci->buffer = av_mallocz(sizeof(InternalBuffer)); if (!avci->buffer) return AVERROR(ENOMEM); } buf = avci->buffer; if (buf->extended_data) { if (buf->extended_data[0] && buf_size > buf->audio_data_size) { av_free(buf->extended_data[0]); if (buf->extended_data != buf->data) av_free(&buf->extended_data); buf->extended_data = NULL; buf->data[0] = NULL; } if (buf->nb_channels != avctx->channels) { if (buf->extended_data != buf->data) av_free(buf->extended_data); buf->extended_data = NULL; } } if (!buf->extended_data) { if (needs_extended_data) { buf->extended_data = av_mallocz(avctx->channels * sizeof(*buf->extended_data)); if (!buf->extended_data) return AVERROR(ENOMEM); } else { buf->extended_data = buf->data; } if (buf->extended_data[0]) { ret = av_samples_fill_arrays(buf->extended_data, &buf->linesize[0], buf->extended_data[0], avctx->channels, frame->nb_samples, avctx->sample_fmt, 32); } else { ret = av_samples_alloc(buf->extended_data, &buf->linesize[0], avctx->channels, frame->nb_samples, avctx->sample_fmt, 32); } if (ret) return ret; if (needs_extended_data) { for (i = 0; i < AV_NUM_DATA_POINTERS; i++) buf->data[i] = buf->extended_data[i]; } buf->audio_data_size = buf_size; buf->nb_channels = avctx->channels; } frame->type = FF_BUFFER_TYPE_INTERNAL; frame->extended_data = buf->extended_data; frame->linesize[0] = buf->linesize[0]; memcpy(frame->data, buf->data, sizeof(frame->data)); if (avctx->pkt) frame->pkt_pts = avctx->pkt->pts; else frame->pkt_pts = AV_NOPTS_VALUE; frame->reordered_opaque = avctx->reordered_opaque; if (avctx->debug & FF_DEBUG_BUFFERS) av_log(avctx, AV_LOG_DEBUG, "default_get_buffer called on frame %p, " "internal audio buffer used\n", frame); return 0; } libavcodec/utils.c:272: error: Use After Free accessing memory that was invalidated by call to `free()` on line 271 indirectly during the call to `av_free()`. libavcodec/utils.c:258:24: invalidation part of the trace starts here 256. /* allocate InternalBuffer if needed */ 257. if (!avci->buffer) { 258. avci->buffer = av_mallocz(sizeof(InternalBuffer)); ^ 259. if (!avci->buffer) 260. return AVERROR(ENOMEM); libavcodec/utils.c:258:24: passed as argument to `av_mallocz` 256. /* allocate InternalBuffer if needed */ 257. if (!avci->buffer) { 258. avci->buffer = av_mallocz(sizeof(InternalBuffer)); ^ 259. if (!avci->buffer) 260. return AVERROR(ENOMEM); libavcodec/utils.c:258:24: return from call to `av_mallocz` 256. /* allocate InternalBuffer if needed */ 257. if (!avci->buffer) { 258. avci->buffer = av_mallocz(sizeof(InternalBuffer)); ^ 259. if (!avci->buffer) 260. return AVERROR(ENOMEM); libavcodec/utils.c:258:9: assigned 256. /* allocate InternalBuffer if needed */ 257. if (!avci->buffer) { 258. avci->buffer = av_mallocz(sizeof(InternalBuffer)); ^ 259. if (!avci->buffer) 260. return AVERROR(ENOMEM); libavcodec/utils.c:262:5: assigned 260. return AVERROR(ENOMEM); 261. } 262. buf = avci->buffer; ^ 263. 264. /* if there is a previously-used internal buffer, check its size and libavcodec/utils.c:271:17: when calling `av_free` here 269. av_free(buf->extended_data[0]); 270. if (buf->extended_data != buf->data) 271. av_free(&buf->extended_data); ^ 272. buf->extended_data = NULL; 273. buf->data[0] = NULL; libavutil/mem.c:137:1: parameter `ptr` of av_free 135. } 136. 137. void av_free(void *ptr) ^ 138. { 139. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:143:5: was invalidated by call to `free()` 141. free((char*)ptr - ((char*)ptr)[-1]); 142. #else 143. free(ptr); ^ 144. #endif 145. } libavcodec/utils.c:258:24: use-after-lifetime part of the trace starts here 256. /* allocate InternalBuffer if needed */ 257. if (!avci->buffer) { 258. avci->buffer = av_mallocz(sizeof(InternalBuffer)); ^ 259. if (!avci->buffer) 260. return AVERROR(ENOMEM); libavcodec/utils.c:258:24: passed as argument to `av_mallocz` 256. /* allocate InternalBuffer if needed */ 257. if (!avci->buffer) { 258. avci->buffer = av_mallocz(sizeof(InternalBuffer)); ^ 259. if (!avci->buffer) 260. return AVERROR(ENOMEM); libavcodec/utils.c:258:24: return from call to `av_mallocz` 256. /* allocate InternalBuffer if needed */ 257. if (!avci->buffer) { 258. avci->buffer = av_mallocz(sizeof(InternalBuffer)); ^ 259. if (!avci->buffer) 260. return AVERROR(ENOMEM); libavcodec/utils.c:258:9: assigned 256. /* allocate InternalBuffer if needed */ 257. if (!avci->buffer) { 258. avci->buffer = av_mallocz(sizeof(InternalBuffer)); ^ 259. if (!avci->buffer) 260. return AVERROR(ENOMEM); libavcodec/utils.c:262:5: assigned 260. return AVERROR(ENOMEM); 261. } 262. buf = avci->buffer; ^ 263. 264. /* if there is a previously-used internal buffer, check its size and libavcodec/utils.c:272:13: invalid access occurs here 270. if (buf->extended_data != buf->data) 271. av_free(&buf->extended_data); 272. buf->extended_data = NULL; ^ 273. buf->data[0] = NULL; 274. }
https://github.com/libav/libav/blob/9f3c77dd2a4fa4accf102c2af1f22567652b8e0f/libavcodec/utils.c/#L272
d2a_code_trace_data_44737
static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, OPENSSL_LH_DOALL_FUNC func, OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) { int i; OPENSSL_LH_NODE *a, *n; if (lh == NULL) return; for (i = lh->num_nodes - 1; i >= 0; i--) { a = lh->b[i]; while (a != NULL) { n = a->next; if (use_arg) func_arg(a->data, arg); else func(a->data); a = n; } } } test/sslapitest.c:3213: error: INTEGER_OVERFLOW_L2 ([0, 8] - 1):unsigned32 by call to `SSL_free`. Showing all 18 steps of the trace test/sslapitest.c:3176:11: Call 3174. BIO *rbio, *wbio; 3175. 3176. ctx = SSL_CTX_new(TLS_method()); ^ 3177. if (!TEST_ptr(ctx)) 3178. goto end; ssl/ssl_lib.c:2812:21: Call 2810. goto err; 2811. 2812. ret->sessions = lh_SSL_SESSION_new(ssl_session_hash, ssl_session_cmp); ^ 2813. if (ret->sessions == NULL) 2814. goto err; ssl/ssl_locl.h:713:1: Call 711. } TLSEXT_INDEX; 712. 713. > DEFINE_LHASH_OF(SSL_SESSION); 714. /* Needed in ssl_cert.c */ 715. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:54:5: Assignment 52. ret->comp = ((c == NULL) ? (OPENSSL_LH_COMPFUNC)strcmp : c); 53. ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h); 54. ret->num_nodes = MIN_NODES / 2; ^ 55. ret->num_alloc_nodes = MIN_NODES; 56. ret->pmax = MIN_NODES / 2; test/sslapitest.c:3213:5: Call 3211. 3212. end: 3213. SSL_free(con); ^ 3214. SSL_CTX_free(ctx); 3215. ssl/ssl_lib.c:1074:1: Parameter `s->ctx->sessions->num_nodes` 1072. } 1073. 1074. > void SSL_free(SSL *s) 1075. { 1076. int i; ssl/ssl_lib.c:1144:5: Call 1142. RECORD_LAYER_release(&s->rlayer); 1143. 1144. SSL_CTX_free(s->ctx); ^ 1145. 1146. ASYNC_WAIT_CTX_free(s->waitctx); ssl/ssl_lib.c:2929:1: Parameter `a->sessions->num_nodes` 2927. } 2928. 2929. > void SSL_CTX_free(SSL_CTX *a) 2930. { 2931. int i; ssl/ssl_lib.c:2955:9: Call 2953. */ 2954. if (a->sessions != NULL) 2955. SSL_CTX_flush_sessions(a, 0); ^ 2956. 2957. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:1094:1: Parameter `s->sessions->num_nodes` 1092. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1093. 1094. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 1095. { 1096. unsigned long i; ssl/ssl_sess.c:1107:5: Call 1105. i = lh_SSL_SESSION_get_down_load(s->sessions); 1106. lh_SSL_SESSION_set_down_load(s->sessions, 0); 1107. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp); ^ 1108. lh_SSL_SESSION_set_down_load(s->sessions, i); 1109. CRYPTO_THREAD_unlock(s->lock); ssl/ssl_sess.c:1092:1: Parameter `lh->num_nodes` 1090. } 1091. 1092. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1093. 1094. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) ssl/ssl_sess.c:1092:1: Call 1090. } 1091. 1092. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1093. 1094. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) crypto/lhash/lhash.c:198:1: Parameter `lh->num_nodes` 196. } 197. 198. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 199. { 200. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); crypto/lhash/lhash.c:200:5: Call 198. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 199. { 200. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); ^ 201. } 202. crypto/lhash/lhash.c:166:1: <LHS trace> 164. } 165. 166. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 167. OPENSSL_LH_DOALL_FUNC func, 168. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:166:1: Parameter `lh->num_nodes` 164. } 165. 166. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 167. OPENSSL_LH_DOALL_FUNC func, 168. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:180:10: Binary operation: ([0, 8] - 1):unsigned32 by call to `SSL_free` 178. * memory leaks otherwise 179. */ 180. for (i = lh->num_nodes - 1; i >= 0; i--) { ^ 181. a = lh->b[i]; 182. while (a != NULL) {
https://github.com/openssl/openssl/blob/9f5671c7e9f30dfa53b1a2b553f234c2761ceb66/crypto/lhash/lhash.c/#L180
d2a_code_trace_data_44738
static int vorbis_parse_audio_packet(vorbis_context *vc) { GetBitContext *gb=&vc->gb; uint_fast8_t previous_window=0,next_window=0; uint_fast8_t mode_number; uint_fast16_t blocksize; int_fast32_t i,j; uint_fast8_t no_residue[vc->audio_channels]; uint_fast8_t do_not_decode[vc->audio_channels]; vorbis_mapping *mapping; float *ch_res_ptr=vc->channel_residues; float *ch_floor_ptr=vc->channel_floors; uint_fast8_t res_chan[vc->audio_channels]; uint_fast8_t res_num=0; int_fast16_t retlen=0; uint_fast16_t saved_start=0; float fadd_bias = vc->add_bias; if (get_bits1(gb)) { av_log(vc->avccontext, AV_LOG_ERROR, "Not a Vorbis I audio packet.\n"); return -1; } if (vc->mode_count==1) { mode_number=0; } else { mode_number=get_bits(gb, ilog(vc->mode_count-1)); } vc->mode_number=mode_number; mapping=&vc->mappings[vc->modes[mode_number].mapping]; AV_DEBUG(" Mode number: %d , mapping: %d , blocktype %d \n", mode_number, vc->modes[mode_number].mapping, vc->modes[mode_number].blockflag); if (vc->modes[mode_number].blockflag) { previous_window=get_bits1(gb); next_window=get_bits1(gb); } blocksize=vc->blocksize[vc->modes[mode_number].blockflag]; memset(ch_res_ptr, 0, sizeof(float)*vc->audio_channels*blocksize/2); memset(ch_floor_ptr, 0, sizeof(float)*vc->audio_channels*blocksize/2); for(i=0;i<vc->audio_channels;++i) { vorbis_floor *floor; if (mapping->submaps>1) { floor=&vc->floors[mapping->submap_floor[mapping->mux[i]]]; } else { floor=&vc->floors[mapping->submap_floor[0]]; } no_residue[i]=floor->decode(vc, &floor->data, ch_floor_ptr); ch_floor_ptr+=blocksize/2; } for(i=mapping->coupling_steps-1;i>=0;--i) { if (!(no_residue[mapping->magnitude[i]] & no_residue[mapping->angle[i]])) { no_residue[mapping->magnitude[i]]=0; no_residue[mapping->angle[i]]=0; } } for(i=0;i<mapping->submaps;++i) { vorbis_residue *residue; uint_fast8_t ch=0; for(j=0;j<vc->audio_channels;++j) { if ((mapping->submaps==1) || (i=mapping->mux[j])) { res_chan[j]=res_num; if (no_residue[j]) { do_not_decode[ch]=1; } else { do_not_decode[ch]=0; } ++ch; ++res_num; } } residue=&vc->residues[mapping->submap_residue[i]]; vorbis_residue_decode(vc, residue, ch, do_not_decode, ch_res_ptr, blocksize/2); ch_res_ptr+=ch*blocksize/2; } for(i=mapping->coupling_steps-1;i>=0;--i) { float *mag, *ang; mag=vc->channel_residues+res_chan[mapping->magnitude[i]]*blocksize/2; ang=vc->channel_residues+res_chan[mapping->angle[i]]*blocksize/2; vc->dsp.vorbis_inverse_coupling(mag, ang, blocksize/2); } for(j=0, ch_floor_ptr=vc->channel_floors;j<vc->audio_channels;++j,ch_floor_ptr+=blocksize/2) { ch_res_ptr=vc->channel_residues+res_chan[j]*blocksize/2; vc->dsp.vector_fmul(ch_floor_ptr, ch_res_ptr, blocksize/2); } for(j=0;j<vc->audio_channels;++j) { uint_fast8_t step=vc->audio_channels; uint_fast16_t k; float *saved=vc->saved+j*vc->blocksize[1]/2; float *ret=vc->ret; const float *lwin=vc->win[1]; const float *swin=vc->win[0]; float *buf=vc->buf; float *buf_tmp=vc->buf_tmp; ch_floor_ptr=vc->channel_floors+j*blocksize/2; saved_start=vc->saved_start; vc->mdct[0].fft.imdct_calc(&vc->mdct[vc->modes[mode_number].blockflag], buf, ch_floor_ptr, buf_tmp); if (vc->modes[mode_number].blockflag) { if (previous_window) { vc->dsp.vector_fmul_add_add(ret+j, buf, lwin, saved, vc->add_bias, vc->blocksize[1]/2, step); retlen=vc->blocksize[1]/2; } else { int len = (vc->blocksize[1]-vc->blocksize[0])/4; buf += len; vc->dsp.vector_fmul_add_add(ret+j, buf, swin, saved, vc->add_bias, vc->blocksize[0]/2, step); k = vc->blocksize[0]/2*step + j; buf += vc->blocksize[0]/2; if(vc->exp_bias){ for(i=0; i<len; i++, k+=step) ((uint32_t*)ret)[k] = ((uint32_t*)buf)[i] + vc->exp_bias; } else { for(i=0; i<len; i++, k+=step) ret[k] = buf[i] + fadd_bias; } buf=vc->buf; retlen=vc->blocksize[0]/2+len; } if (next_window) { buf += vc->blocksize[1]/2; vc->dsp.vector_fmul_reverse(saved, buf, lwin, vc->blocksize[1]/2); saved_start=0; } else { saved_start=(vc->blocksize[1]-vc->blocksize[0])/4; buf += vc->blocksize[1]/2; for(i=0; i<saved_start; i++) ((uint32_t*)saved)[i] = ((uint32_t*)buf)[i] + vc->exp_bias; vc->dsp.vector_fmul_reverse(saved+saved_start, buf+saved_start, swin, vc->blocksize[0]/2); } } else { if(vc->add_bias) { for(k=j, i=0;i<saved_start;++i, k+=step) ret[k] = saved[i] + fadd_bias; } else { for(k=j, i=0;i<saved_start;++i, k+=step) ret[k] = saved[i]; } vc->dsp.vector_fmul_add_add(ret+k, buf, swin, saved+saved_start, vc->add_bias, vc->blocksize[0]/2, step); retlen=saved_start+vc->blocksize[0]/2; buf += vc->blocksize[0]/2; vc->dsp.vector_fmul_reverse(saved, buf, swin, vc->blocksize[0]/2); saved_start=0; } } vc->saved_start=saved_start; return retlen*vc->audio_channels; } libavcodec/vorbis_dec.c:1492: error: Uninitialized Value The value read from res_chan[_] was never initialized. libavcodec/vorbis_dec.c:1492:9: 1490. float *mag, *ang; 1491. 1492. mag=vc->channel_residues+res_chan[mapping->magnitude[i]]*blocksize/2; ^ 1493. ang=vc->channel_residues+res_chan[mapping->angle[i]]*blocksize/2; 1494. vc->dsp.vorbis_inverse_coupling(mag, ang, blocksize/2);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vorbis_dec.c/#L1492
d2a_code_trace_data_44739
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); } apps/ca.c:2110: error: BUFFER_OVERRUN_L3 Offset: [-1, 199] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace apps/ca.c:2110:20: Call 2108. for (i = 0; i < DB_NUMBER; i++) 2109. row[i] = NULL; 2110. row[DB_name] = X509_NAME_oneline(X509_get_subject_name(x509), NULL, 0); ^ 2111. bn = ASN1_INTEGER_to_BN(X509_get_serialNumber(x509), NULL); 2112. if (!bn) 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: [-1, 199] 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_44740
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:3258: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `dav_validate_request`. modules/dav/main/mod_dav.c:3214:21: Unknown value from: apr_pstrdup 3212. } 3213. 3214. locktoken_txt = apr_pstrdup(r->pool, const_locktoken_txt); ^ 3215. if (locktoken_txt[0] != '<') { 3216. /* ### should provide more specifics... */ modules/dav/main/mod_dav.c:3258:16: Call 3256. * validate the parent resource's conditions. 3257. */ 3258. if ((err = dav_validate_request(r, resource, 0, locktoken, ^ 3259. &multi_response, 3260. resource_state == DAV_RESOURCE_LOCK_NULL 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_44741
static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) { unsigned char *buf = NULL; int ret = 0, bit, bytes, mask; time_t tim; if (bits == 0) { if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY) goto toosmall; BN_zero(rnd); return 1; } if (bits < 0 || (bits == 1 && top > 0)) goto toosmall; bytes = (bits + 7) / 8; bit = (bits - 1) % 8; mask = 0xff << (bit + 1); buf = OPENSSL_malloc(bytes); if (buf == NULL) { BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); goto err; } time(&tim); RAND_add(&tim, sizeof(tim), 0.0); if (RAND_bytes(buf, bytes) <= 0) goto err; if (pseudorand == 2) { int i; unsigned char c; for (i = 0; i < bytes; i++) { if (RAND_bytes(&c, 1) <= 0) goto err; if (c >= 128 && i > 0) buf[i] = buf[i - 1]; else if (c < 42) buf[i] = 0; else if (c < 84) buf[i] = 255; } } if (top >= 0) { if (top) { if (bit == 0) { buf[0] = 1; buf[1] |= 0x80; } else { buf[0] |= (3 << (bit - 1)); } } else { buf[0] |= (1 << bit); } } buf[0] &= ~mask; if (bottom) buf[bytes - 1] |= 1; if (!BN_bin2bn(buf, bytes, rnd)) goto err; ret = 1; err: OPENSSL_clear_free(buf, bytes); bn_check_top(rnd); return (ret); toosmall: BNerr(BN_F_BNRAND, BN_R_BITS_TOO_SMALL); return 0; } test/bntest.c:189: error: BUFFER_OVERRUN_L3 Offset: [-1, 518] Size: [1, 519] by call to `BN_bntest_rand`. Showing all 12 steps of the trace test/bntest.c:189:13: Call 187. for (i = 0; i < NUM0 + NUM1; i++) { 188. if (i < NUM1) { 189. BN_bntest_rand(a, 512, 0, 0); ^ 190. BN_copy(b, a); 191. if (BN_set_bit(a, i) == 0) crypto/bn/bn_rand.c:106:1: Parameter `bits` 104. } 105. 106. > int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom) 107. { 108. return bnrand(2, rnd, bits, top, bottom); crypto/bn/bn_rand.c:108:12: Call 106. int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom) 107. { 108. return bnrand(2, rnd, bits, top, bottom); ^ 109. } 110. crypto/bn/bn_rand.c:56:14: <Offset trace> 54. unsigned char c; 55. 56. for (i = 0; i < bytes; i++) { ^ 57. if (RAND_bytes(&c, 1) <= 0) 58. goto err; crypto/bn/bn_rand.c:56:14: Assignment 54. unsigned char c; 55. 56. for (i = 0; i < bytes; i++) { ^ 57. if (RAND_bytes(&c, 1) <= 0) 58. goto err; crypto/bn/bn_rand.c:17:1: <Length trace> 15. #include <openssl/sha.h> 16. 17. > static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) 18. { 19. unsigned char *buf = NULL; crypto/bn/bn_rand.c:17:1: Parameter `bits` 15. #include <openssl/sha.h> 16. 17. > static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) 18. { 19. unsigned char *buf = NULL; crypto/bn/bn_rand.c:32:5: Assignment 30. goto toosmall; 31. 32. bytes = (bits + 7) / 8; ^ 33. bit = (bits - 1) % 8; 34. mask = 0xff << (bit + 1); crypto/bn/bn_rand.c:36:11: Call 34. mask = 0xff << (bit + 1); 35. 36. buf = OPENSSL_malloc(bytes); ^ 37. if (buf == NULL) { 38. BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); crypto/mem.c:79:9: Assignment 77. 78. if (num <= 0) 79. return NULL; ^ 80. 81. allow_customize = 0; crypto/bn/bn_rand.c:36:5: Assignment 34. mask = 0xff << (bit + 1); 35. 36. buf = OPENSSL_malloc(bytes); ^ 37. if (buf == NULL) { 38. BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); crypto/bn/bn_rand.c:82:9: Array access: Offset: [-1, 518] Size: [1, 519] by call to `BN_bntest_rand` 80. buf[0] &= ~mask; 81. if (bottom) /* set bottom bit if requested */ 82. buf[bytes - 1] |= 1; ^ 83. if (!BN_bin2bn(buf, bytes, rnd)) 84. goto err;
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_rand.c/#L82
d2a_code_trace_data_44742
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_exp2.c:72: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_div`. Showing all 24 steps of the trace crypto/bn/bn_exp2.c:16:1: Parameter `ctx->stack.depth` 14. #define TABLE_SIZE 32 15. 16. > int BN_mod_exp2_mont(BIGNUM *rr, const BIGNUM *a1, const BIGNUM *p1, 17. const BIGNUM *a2, const BIGNUM *p2, const BIGNUM *m, 18. BN_CTX *ctx, BN_MONT_CTX *in_mont) crypto/bn/bn_exp2.c:48:5: Call 46. bits = (bits1 > bits2) ? bits1 : bits2; 47. 48. BN_CTX_start(ctx); ^ 49. d = BN_CTX_get(ctx); 50. r = 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_exp2.c:49:9: Call 47. 48. BN_CTX_start(ctx); 49. d = BN_CTX_get(ctx); ^ 50. r = BN_CTX_get(ctx); 51. val1[0] = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_exp2.c:50:9: Call 48. BN_CTX_start(ctx); 49. d = BN_CTX_get(ctx); 50. r = BN_CTX_get(ctx); ^ 51. val1[0] = BN_CTX_get(ctx); 52. val2[0] = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_exp2.c:51:15: Call 49. d = BN_CTX_get(ctx); 50. r = BN_CTX_get(ctx); 51. val1[0] = BN_CTX_get(ctx); ^ 52. val2[0] = BN_CTX_get(ctx); 53. if (val2[0] == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_exp2.c:52:15: Call 50. r = BN_CTX_get(ctx); 51. val1[0] = BN_CTX_get(ctx); 52. val2[0] = BN_CTX_get(ctx); ^ 53. if (val2[0] == NULL) 54. 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_exp2.c:72:14: Call 70. */ 71. if (a1->neg || BN_ucmp(a1, m) >= 0) { 72. if (!BN_mod(val1[0], a1, m, ctx)) ^ 73. goto err; 74. a_mod_m = val1[0]; crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth` 207. * If 'dv' or 'rm' is NULL, the respective value is not returned. 208. */ 209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 210. BN_CTX *ctx) 211. { crypto/bn/bn_div.c:229:11: Call 227. } 228. 229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx); ^ 230. 231. if (ret) { crypto/bn/bn_div.c:280:5: Call 278. bn_check_top(rm); 279. 280. BN_CTX_start(ctx); ^ 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_div.c:450:5: Call 448. if (rm != NULL) 449. bn_rshift_fixed_top(rm, snum, norm_shift); 450. BN_CTX_end(ctx); ^ 451. return 1; 452. err: crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_div` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_44743
char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) { const X509_NAME_ENTRY *ne; int i; int n, lold, l, l1, l2, num, j, type; const char *s; char *p; unsigned char *q; BUF_MEM *b = NULL; static const char hex[17] = "0123456789ABCDEF"; int gs_doit[4]; char tmp_buf[80]; #ifdef CHARSET_EBCDIC unsigned char ebcdic_buf[1024]; #endif if (buf == NULL) { if ((b = BUF_MEM_new()) == NULL) goto err; if (!BUF_MEM_grow(b, 200)) goto err; b->data[0] = '\0'; len = 200; } else if (len == 0) { return NULL; } if (a == NULL) { if (b) { buf = b->data; OPENSSL_free(b); } strncpy(buf, "NO X509_NAME", len); buf[len - 1] = '\0'; return buf; } len--; l = 0; for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { ne = sk_X509_NAME_ENTRY_value(a->entries, i); n = OBJ_obj2nid(ne->object); if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) { i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object); s = tmp_buf; } l1 = strlen(s); type = ne->value->type; num = ne->value->length; if (num > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } q = ne->value->data; #ifdef CHARSET_EBCDIC if (type == V_ASN1_GENERALSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_PRINTABLESTRING || type == V_ASN1_TELETEXSTRING || type == V_ASN1_IA5STRING) { if (num > (int)sizeof(ebcdic_buf)) num = sizeof(ebcdic_buf); ascii2ebcdic(ebcdic_buf, q, num); q = ebcdic_buf; } #endif if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) { gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0; for (j = 0; j < num; j++) if (q[j] != 0) gs_doit[j & 3] = 1; if (gs_doit[0] | gs_doit[1] | gs_doit[2]) gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; else { gs_doit[0] = gs_doit[1] = gs_doit[2] = 0; gs_doit[3] = 1; } } else gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; for (l2 = j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; l2++; #ifndef CHARSET_EBCDIC if ((q[j] < ' ') || (q[j] > '~')) l2 += 3; #else if ((os_toascii[q[j]] < os_toascii[' ']) || (os_toascii[q[j]] > os_toascii['~'])) l2 += 3; #endif } lold = l; l += 1 + l1 + 1 + l2; if (l > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } if (b != NULL) { if (!BUF_MEM_grow(b, l + 1)) goto err; p = &(b->data[lold]); } else if (l > len) { break; } else p = &(buf[lold]); *(p++) = '/'; memcpy(p, s, (unsigned int)l1); p += l1; *(p++) = '='; #ifndef CHARSET_EBCDIC q = ne->value->data; #endif for (j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; #ifndef CHARSET_EBCDIC n = q[j]; if ((n < ' ') || (n > '~')) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = n; #else n = os_toascii[q[j]]; if ((n < os_toascii[' ']) || (n > os_toascii['~'])) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = q[j]; #endif } *p = '\0'; } if (b != NULL) { p = b->data; OPENSSL_free(b); } else p = buf; if (i == 0) *p = '\0'; return (p); err: X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE); end: BUF_MEM_free(b); return (NULL); } test/ssltest_old.c:2962: error: BUFFER_OVERRUN_L3 Offset: [199, 255] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace test/ssltest_old.c:2962:17: Call 2960. (void *)ctx, (void *)c); 2961. if (c) 2962. s = X509_NAME_oneline(X509_get_subject_name(c), buf, 256); ^ 2963. if (s != NULL) { 2964. printf("cert depth=%d %s\n", crypto/x509/x509_obj.c:25:1: <Offset trace> 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: Parameter `len` 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: <Length trace> 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: Parameter `*buf` 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:57:9: Array access: Offset: [199, 255] Size: [1, 2147483644] by call to `X509_NAME_oneline` 55. } 56. strncpy(buf, "NO X509_NAME", len); 57. buf[len - 1] = '\0'; ^ 58. return buf; 59. }
https://github.com/openssl/openssl/blob/cdb2a60347f988037d29adc7e4415e9c66c8a5a5/crypto/x509/x509_obj.c/#L57
d2a_code_trace_data_44744
static inline int pred_non_zero_count(H264Context *h, int n){ const int index8= scan8[n]; const int left= h->non_zero_count_cache[index8 - 1]; const int top = h->non_zero_count_cache[index8 - 8]; int i= left + top; if(i<64) i= (i+1)>>1; tprintf(h->s.avctx, "pred_nnz L%X T%X n%d s%d P%X\n", left, top, n, scan8[n], i&31); return i&31; } libavcodec/h264.c:4954: error: Buffer Overrun L1 Offset: 26 Size: 24 by call to `decode_residual`. libavcodec/h264.c:4954:21: Call 4952. if(cbp&0x30){ 4953. for(chroma_idx=0; chroma_idx<2; chroma_idx++) 4954. if( decode_residual(h, gb, h->mb + 256 + 16*4*chroma_idx, CHROMA_DC_BLOCK_INDEX, chroma_dc_scan, NULL, 4) < 0){ ^ 4955. return -1; 4956. } libavcodec/h264.c:4295:1: Parameter `n` 4293. * @return <0 if an error occurred 4294. */ 4295. static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff){ ^ 4296. MpegEncContext * const s = &h->s; 4297. static const int coeff_token_table_index[17]= {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3}; libavcodec/h264.c:4312:26: Call 4310. total_coeff= coeff_token>>2; 4311. }else{ 4312. total_coeff= pred_non_zero_count(h, n); ^ 4313. coeff_token= get_vlc2(gb, coeff_token_vlc[ coeff_token_table_index[total_coeff] ].table, COEFF_TOKEN_VLC_BITS, 2); 4314. total_coeff= coeff_token>>2; libavcodec/h264.c:678:1: <Offset trace> 676. * @param n block index 677. */ 678. static inline int pred_non_zero_count(H264Context *h, int n){ ^ 679. const int index8= scan8[n]; 680. const int left= h->non_zero_count_cache[index8 - 1]; libavcodec/h264.c:678:1: Parameter `n` 676. * @param n block index 677. */ 678. static inline int pred_non_zero_count(H264Context *h, int n){ ^ 679. const int index8= scan8[n]; 680. const int left= h->non_zero_count_cache[index8 - 1]; libavcodec/h264data.h:271:1: <Length trace> 269. */ 270. 271. static const uint8_t scan8[16 + 2*4]={ ^ 272. 4+1*8, 5+1*8, 4+2*8, 5+2*8, 273. 6+1*8, 7+1*8, 6+2*8, 7+2*8, libavcodec/h264data.h:271:1: Array declaration 269. */ 270. 271. static const uint8_t scan8[16 + 2*4]={ ^ 272. 4+1*8, 5+1*8, 4+2*8, 5+2*8, 273. 6+1*8, 7+1*8, 6+2*8, 7+2*8, libavcodec/h264.c:679:23: Array access: Offset: 26 Size: 24 by call to `decode_residual` 677. */ 678. static inline int pred_non_zero_count(H264Context *h, int n){ 679. const int index8= scan8[n]; ^ 680. const int left= h->non_zero_count_cache[index8 - 1]; 681. const int top = h->non_zero_count_cache[index8 - 8];
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L679
d2a_code_trace_data_44745
static OutputStream *new_output_stream(AVFormatContext *oc, int file_idx) { int idx = oc->nb_streams - 1; OutputStream *ost; output_streams_for_file[file_idx] = grow_array(output_streams_for_file[file_idx], sizeof(*output_streams_for_file[file_idx]), &nb_output_streams_for_file[file_idx], oc->nb_streams); ost = output_streams_for_file[file_idx][idx] = av_mallocz(sizeof(OutputStream)); if (!ost) { fprintf(stderr, "Could not alloc output stream\n"); ffmpeg_exit(1); } ost->file_index = file_idx; ost->index = idx; ost->sws_flags = av_get_int(sws_opts, "sws_flags", NULL); return ost; } ffmpeg.c:3739: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `new_video_stream`. ffmpeg.c:3739:43: Call 3737. oc = output_files[file_idx]; 3738. 3739. if (!strcmp(opt, "newvideo" )) new_video_stream (oc, file_idx); ^ 3740. else if (!strcmp(opt, "newaudio" )) new_audio_stream (oc, file_idx); 3741. else if (!strcmp(opt, "newsubtitle")) new_subtitle_stream(oc, file_idx); ffmpeg.c:3423:1: Global `nb_streamid_map` 3421. } 3422. 3423. static void new_video_stream(AVFormatContext *oc, int file_idx) ^ 3424. { 3425. AVStream *st; ffmpeg.c:3431:10: Call 3429. AVCodec *codec= NULL; 3430. 3431. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); ^ 3432. if (!st) { 3433. fprintf(stderr, "Could not alloc stream\n"); libavformat/utils.c:2642:1: Parameter `s->nb_streams` 2640. } 2641. 2642. AVStream *av_new_stream(AVFormatContext *s, int id) ^ 2643. { 2644. AVStream *st; ffmpeg.c:3436:11: Call 3434. ffmpeg_exit(1); 3435. } 3436. ost = new_output_stream(oc, file_idx); ^ 3437. 3438. if(!video_stream_copy){ ffmpeg.c:643:1: <LHS trace> 641. } 642. 643. static OutputStream *new_output_stream(AVFormatContext *oc, int file_idx) ^ 644. { 645. int idx = oc->nb_streams - 1; ffmpeg.c:643:1: Parameter `oc->nb_streams` 641. } 642. 643. static OutputStream *new_output_stream(AVFormatContext *oc, int file_idx) ^ 644. { 645. int idx = oc->nb_streams - 1; ffmpeg.c:645:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `new_video_stream` 643. static OutputStream *new_output_stream(AVFormatContext *oc, int file_idx) 644. { 645. int idx = oc->nb_streams - 1; ^ 646. OutputStream *ost; 647.
https://github.com/libav/libav/blob/bf2cba453244a74331238a472fe0e309f116f4d9/ffmpeg.c/#L645
d2a_code_trace_data_44746
static int mpegts_read_header(AVFormatContext *s, AVFormatParameters *ap) { MpegTSContext *ts = s->priv_data; ByteIOContext *pb = s->pb; uint8_t buf[1024]; int len; int64_t pos; if (ap) { ts->mpeg2ts_compute_pcr = ap->mpeg2ts_compute_pcr; if(ap->mpeg2ts_raw){ av_log(s, AV_LOG_ERROR, "use mpegtsraw_demuxer!\n"); return -1; } } pos = url_ftell(pb); len = get_buffer(pb, buf, sizeof(buf)); if (len != sizeof(buf)) goto fail; ts->raw_packet_size = get_packet_size(buf, sizeof(buf)); if (ts->raw_packet_size <= 0) goto fail; ts->stream = s; ts->auto_guess = 0; if (s->iformat == &mpegts_demuxer) { url_fseek(pb, pos, SEEK_SET); mpegts_scan_sdt(ts); mpegts_set_service(ts); handle_packets(ts, s->probesize); ts->auto_guess = 1; #ifdef DEBUG_SI av_log(ts->stream, AV_LOG_DEBUG, "tuning done\n"); #endif s->ctx_flags |= AVFMTCTX_NOHEADER; } else { AVStream *st; int pcr_pid, pid, nb_packets, nb_pcrs, ret, pcr_l; int64_t pcrs[2], pcr_h; int packet_count[2]; uint8_t packet[TS_PACKET_SIZE]; st = av_new_stream(s, 0); if (!st) goto fail; av_set_pts_info(st, 60, 1, 27000000); st->codec->codec_type = CODEC_TYPE_DATA; st->codec->codec_id = CODEC_ID_MPEG2TS; pcr_pid = -1; nb_pcrs = 0; nb_packets = 0; for(;;) { ret = read_packet(s->pb, packet, ts->raw_packet_size); if (ret < 0) return -1; pid = AV_RB16(packet + 1) & 0x1fff; if ((pcr_pid == -1 || pcr_pid == pid) && parse_pcr(&pcr_h, &pcr_l, packet) == 0) { pcr_pid = pid; packet_count[nb_pcrs] = nb_packets; pcrs[nb_pcrs] = pcr_h * 300 + pcr_l; nb_pcrs++; if (nb_pcrs >= 2) break; } nb_packets++; } ts->pcr_incr = (pcrs[1] - pcrs[0]) / (packet_count[1] - packet_count[0]); ts->cur_pcr = pcrs[0] - ts->pcr_incr * packet_count[0]; s->bit_rate = (TS_PACKET_SIZE * 8) * 27e6 / ts->pcr_incr; st->codec->bit_rate = s->bit_rate; st->start_time = ts->cur_pcr; #if 0 av_log(ts->stream, AV_LOG_DEBUG, "start=%0.3f pcr=%0.3f incr=%d\n", st->start_time / 1000000.0, pcrs[0] / 27e6, ts->pcr_incr); #endif } url_fseek(pb, pos, SEEK_SET); return 0; fail: return -1; } libavformat/mpegts.c:1293: error: Uninitialized Value The value read from packet_count[_] was never initialized. libavformat/mpegts.c:1293:9: 1291. /* NOTE2: it is only the bitrate of the start of the stream */ 1292. ts->pcr_incr = (pcrs[1] - pcrs[0]) / (packet_count[1] - packet_count[0]); 1293. ts->cur_pcr = pcrs[0] - ts->pcr_incr * packet_count[0]; ^ 1294. s->bit_rate = (TS_PACKET_SIZE * 8) * 27e6 / ts->pcr_incr; 1295. st->codec->bit_rate = s->bit_rate;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/mpegts.c/#L1293
d2a_code_trace_data_44747
void curve448_scalar_halve(curve448_scalar_t out, const curve448_scalar_t a) { c448_word_t mask = 0 - (a->limb[0] & 1); c448_dword_t chain = 0; unsigned int i; for (i = 0; i < C448_SCALAR_LIMBS; i++) { chain = (chain + a->limb[i]) + (sc_p->limb[i] & mask); out->limb[i] = (c448_word_t)chain; chain >>= C448_WORD_BITS; } for (i = 0; i < C448_SCALAR_LIMBS - 1; i++) out->limb[i] = out->limb[i] >> 1 | out->limb[i + 1] << (WBITS - 1); out->limb[i] = out->limb[i] >> 1 | (c448_word_t)(chain << (WBITS - 1)); } crypto/ec/curve448/curve448.c:485: error: INTEGER_OVERFLOW_L2 (0 - [0, 1]):unsigned32 by call to `curve448_scalar_halve`. Showing all 6 steps of the trace crypto/ec/curve448/curve448.c:481:5: Call 479. scalar2[X_PRIVATE_BYTES - 1] |= 1 << ((X_PRIVATE_BITS + 7) % 8); 480. 481. curve448_scalar_decode_long(the_scalar, scalar2, sizeof(scalar2)); ^ 482. 483. /* Compensate for the encoding ratio */ crypto/ec/curve448/scalar.c:173:1: Parameter `s->limb[*]` 171. } 172. 173. > void curve448_scalar_decode_long(curve448_scalar_t s, 174. const unsigned char *ser, size_t ser_len) 175. { crypto/ec/curve448/curve448.c:485:9: Call 483. /* Compensate for the encoding ratio */ 484. for (i = 1; i < X448_ENCODE_RATIO; i <<= 1) 485. curve448_scalar_halve(the_scalar, the_scalar); ^ 486. 487. curve448_precomputed_scalarmul(p, curve448_precomputed_base, the_scalar); crypto/ec/curve448/scalar.c:221:1: <RHS trace> 219. } 220. 221. > void curve448_scalar_halve(curve448_scalar_t out, const curve448_scalar_t a) 222. { 223. c448_word_t mask = 0 - (a->limb[0] & 1); crypto/ec/curve448/scalar.c:221:1: Parameter `a->limb[*]` 219. } 220. 221. > void curve448_scalar_halve(curve448_scalar_t out, const curve448_scalar_t a) 222. { 223. c448_word_t mask = 0 - (a->limb[0] & 1); crypto/ec/curve448/scalar.c:223:5: Binary operation: (0 - [0, 1]):unsigned32 by call to `curve448_scalar_halve` 221. void curve448_scalar_halve(curve448_scalar_t out, const curve448_scalar_t a) 222. { 223. c448_word_t mask = 0 - (a->limb[0] & 1); ^ 224. c448_dword_t chain = 0; 225. unsigned int i;
https://github.com/openssl/openssl/blob/a7232276fef30a63070fd9dbb53d3820d3761d5b/crypto/ec/curve448/scalar.c/#L223
d2a_code_trace_data_44748
static int estimate_best_b_count(MpegEncContext *s){ AVCodec *codec= avcodec_find_encoder(s->avctx->codec_id); AVCodecContext *c= avcodec_alloc_context(); AVFrame input[FF_MAX_B_FRAMES+2]; const int scale= s->avctx->brd_scale; int i, j, out_size, p_lambda, b_lambda, lambda2; int outbuf_size= s->width * s->height; uint8_t *outbuf= av_malloc(outbuf_size); int64_t best_rd= INT64_MAX; int best_b_count= -1; assert(scale>=0 && scale <=3); p_lambda= s->last_lambda_for[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 | CODEC_FLAG_INPUT_PRESERVED ; c->flags|= s->avctx->flags & CODEC_FLAG_QPEL; c->mb_decision= s->avctx->mb_decision; c->me_cmp= s->avctx->me_cmp; c->mb_cmp= s->avctx->mb_cmp; c->me_sub_cmp= s->avctx->me_sub_cmp; c->pix_fmt = PIX_FMT_YUV420P; c->time_base= s->avctx->time_base; c->max_b_frames= s->max_b_frames; if (avcodec_open(c, codec) < 0) return -1; for(i=0; i<s->max_b_frames+2; i++){ int ysize= c->width*c->height; int csize= (c->width/2)*(c->height/2); Picture pre_input, *pre_input_ptr= i ? s->input_picture[i-1] : s->next_picture_ptr; avcodec_get_frame_defaults(&input[i]); input[i].data[0]= av_malloc(ysize + 2*csize); input[i].data[1]= input[i].data[0] + ysize; input[i].data[2]= input[i].data[1] + csize; input[i].linesize[0]= c->width; input[i].linesize[1]= input[i].linesize[2]= c->width/2; if(pre_input_ptr && (!i || s->input_picture[i-1])) { pre_input= *pre_input_ptr; if(pre_input.type != FF_BUFFER_TYPE_SHARED && i) { pre_input.data[0]+=INPLACE_OFFSET; pre_input.data[1]+=INPLACE_OFFSET; pre_input.data[2]+=INPLACE_OFFSET; } s->dsp.shrink[scale](input[i].data[0], input[i].linesize[0], pre_input.data[0], pre_input.linesize[0], c->width, c->height); s->dsp.shrink[scale](input[i].data[1], input[i].linesize[1], pre_input.data[1], pre_input.linesize[1], c->width>>1, c->height>>1); s->dsp.shrink[scale](input[i].data[2], input[i].linesize[2], pre_input.data[2], pre_input.linesize[2], c->width>>1, c->height>>1); } } for(j=0; j<s->max_b_frames+1; j++){ int64_t rd=0; if(!s->input_picture[j]) break; c->error[0]= c->error[1]= c->error[2]= 0; input[0].pict_type= AV_PICTURE_TYPE_I; input[0].quality= 1 * FF_QP2LAMBDA; out_size = avcodec_encode_video(c, outbuf, outbuf_size, &input[0]); for(i=0; i<s->max_b_frames+1; i++){ int is_p= i % (j+1) == j || i==s->max_b_frames; input[i+1].pict_type= is_p ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_B; input[i+1].quality= is_p ? p_lambda : b_lambda; out_size = avcodec_encode_video(c, outbuf, outbuf_size, &input[i+1]); rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3); } while(out_size){ out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL); rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3); } rd += c->error[0] + c->error[1] + c->error[2]; if(rd < best_rd){ best_rd= rd; best_b_count= j; } } av_freep(&outbuf); avcodec_close(c); av_freep(&c); for(i=0; i<s->max_b_frames+2; i++){ av_freep(&input[i].data[0]); } return best_b_count; } libavcodec/mpegvideo_enc.c:966: error: Null Dereference pointer `c` last assigned on line 949 could be null and is dereferenced at line 966, column 5. libavcodec/mpegvideo_enc.c:947:1: start of procedure estimate_best_b_count() 945. } 946. 947. static int estimate_best_b_count(MpegEncContext *s){ ^ 948. AVCodec *codec= avcodec_find_encoder(s->avctx->codec_id); 949. AVCodecContext *c= avcodec_alloc_context(); libavcodec/mpegvideo_enc.c:948:5: Skipping avcodec_find_encoder(): empty list of specs 946. 947. static int estimate_best_b_count(MpegEncContext *s){ 948. AVCodec *codec= avcodec_find_encoder(s->avctx->codec_id); ^ 949. AVCodecContext *c= avcodec_alloc_context(); 950. AVFrame input[FF_MAX_B_FRAMES+2]; libavcodec/mpegvideo_enc.c:949:5: 947. static int estimate_best_b_count(MpegEncContext *s){ 948. AVCodec *codec= avcodec_find_encoder(s->avctx->codec_id); 949. AVCodecContext *c= avcodec_alloc_context(); ^ 950. AVFrame input[FF_MAX_B_FRAMES+2]; 951. const int scale= s->avctx->brd_scale; libavcodec/options.c:536:1: start of procedure avcodec_alloc_context() 534. } 535. 536. AVCodecContext *avcodec_alloc_context(void){ ^ 537. return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN); 538. } libavcodec/options.c:537:5: 535. 536. AVCodecContext *avcodec_alloc_context(void){ 537. return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN); ^ 538. } 539. libavcodec/options.c:522:1: start of procedure avcodec_alloc_context2() 520. } 521. 522. AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){ ^ 523. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); 524. libavcodec/options.c:523:5: 521. 522. AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){ 523. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); ^ 524. 525. if(avctx==NULL) return NULL; libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(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/options.c:525:8: Taking true branch 523. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); 524. 525. if(avctx==NULL) return NULL; ^ 526. 527. avcodec_get_context_defaults2(avctx, codec_type); libavcodec/options.c:525:21: 523. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); 524. 525. if(avctx==NULL) return NULL; ^ 526. 527. avcodec_get_context_defaults2(avctx, codec_type); libavcodec/options.c:530:1: return from a call to avcodec_alloc_context2 528. 529. return avctx; 530. } ^ 531. 532. void avcodec_get_context_defaults(AVCodecContext *s){ libavcodec/options.c:538:1: return from a call to avcodec_alloc_context 536. AVCodecContext *avcodec_alloc_context(void){ 537. return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN); 538. } ^ 539. 540. int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src) libavcodec/mpegvideo_enc.c:951:5: 949. AVCodecContext *c= avcodec_alloc_context(); 950. AVFrame input[FF_MAX_B_FRAMES+2]; 951. const int scale= s->avctx->brd_scale; ^ 952. int i, j, out_size, p_lambda, b_lambda, lambda2; 953. int outbuf_size= s->width * s->height; //FIXME libavcodec/mpegvideo_enc.c:953:5: 951. const int scale= s->avctx->brd_scale; 952. int i, j, out_size, p_lambda, b_lambda, lambda2; 953. int outbuf_size= s->width * s->height; //FIXME ^ 954. uint8_t *outbuf= av_malloc(outbuf_size); 955. int64_t best_rd= INT64_MAX; libavcodec/mpegvideo_enc.c:954:5: 952. int i, j, out_size, p_lambda, b_lambda, lambda2; 953. int outbuf_size= s->width * s->height; //FIXME 954. uint8_t *outbuf= av_malloc(outbuf_size); ^ 955. int64_t best_rd= INT64_MAX; 956. int best_b_count= -1; libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(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/mpegvideo_enc.c:955:5: 953. int outbuf_size= s->width * s->height; //FIXME 954. uint8_t *outbuf= av_malloc(outbuf_size); 955. int64_t best_rd= INT64_MAX; ^ 956. int best_b_count= -1; 957. libavcodec/mpegvideo_enc.c:956:5: 954. uint8_t *outbuf= av_malloc(outbuf_size); 955. int64_t best_rd= INT64_MAX; 956. int best_b_count= -1; ^ 957. 958. assert(scale>=0 && scale <=3); libavcodec/mpegvideo_enc.c:958:5: 956. int best_b_count= -1; 957. 958. assert(scale>=0 && scale <=3); ^ 959. 960. // emms_c(); libavcodec/mpegvideo_enc.c:961:5: 959. 960. // emms_c(); 961. p_lambda= s->last_lambda_for[AV_PICTURE_TYPE_P]; //s->next_picture_ptr->quality; ^ 962. b_lambda= s->last_lambda_for[AV_PICTURE_TYPE_B]; //p_lambda *FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; 963. if(!b_lambda) b_lambda= p_lambda; //FIXME we should do this somewhere else libavcodec/mpegvideo_enc.c:962:5: 960. // emms_c(); 961. p_lambda= s->last_lambda_for[AV_PICTURE_TYPE_P]; //s->next_picture_ptr->quality; 962. b_lambda= s->last_lambda_for[AV_PICTURE_TYPE_B]; //p_lambda *FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; ^ 963. if(!b_lambda) b_lambda= p_lambda; //FIXME we should do this somewhere else 964. lambda2= (b_lambda*b_lambda + (1<<FF_LAMBDA_SHIFT)/2 ) >> FF_LAMBDA_SHIFT; libavcodec/mpegvideo_enc.c:963:9: Taking false branch 961. p_lambda= s->last_lambda_for[AV_PICTURE_TYPE_P]; //s->next_picture_ptr->quality; 962. b_lambda= s->last_lambda_for[AV_PICTURE_TYPE_B]; //p_lambda *FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; 963. if(!b_lambda) b_lambda= p_lambda; //FIXME we should do this somewhere else ^ 964. lambda2= (b_lambda*b_lambda + (1<<FF_LAMBDA_SHIFT)/2 ) >> FF_LAMBDA_SHIFT; 965. libavcodec/mpegvideo_enc.c:964:5: 962. b_lambda= s->last_lambda_for[AV_PICTURE_TYPE_B]; //p_lambda *FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; 963. if(!b_lambda) b_lambda= p_lambda; //FIXME we should do this somewhere else 964. lambda2= (b_lambda*b_lambda + (1<<FF_LAMBDA_SHIFT)/2 ) >> FF_LAMBDA_SHIFT; ^ 965. 966. c->width = s->width >> scale; libavcodec/mpegvideo_enc.c:966:5: 964. lambda2= (b_lambda*b_lambda + (1<<FF_LAMBDA_SHIFT)/2 ) >> FF_LAMBDA_SHIFT; 965. 966. c->width = s->width >> scale; ^ 967. c->height= s->height>> scale; 968. c->flags= CODEC_FLAG_QSCALE | CODEC_FLAG_PSNR | CODEC_FLAG_INPUT_PRESERVED /*| CODEC_FLAG_EMU_EDGE*/;
https://github.com/libav/libav/blob/b2893ee2f8b204f3d636c25a05d1dc1dd81dfdba/libavcodec/mpegvideo_enc.c/#L966
d2a_code_trace_data_44749
int RAND_status(void) { const RAND_METHOD *meth = RAND_get_rand_method(); if (meth->status != NULL) return meth->status(); return 0; } crypto/rand/rand_lib.c:833: error: NULL_DEREFERENCE pointer `meth` last assigned on line 831 could be null and is dereferenced at line 833, column 9. Showing all 14 steps of the trace crypto/rand/rand_lib.c:829:1: start of procedure RAND_status() 827. #endif 828. 829. > int RAND_status(void) 830. { 831. const RAND_METHOD *meth = RAND_get_rand_method(); crypto/rand/rand_lib.c:831:5: 829. int RAND_status(void) 830. { 831. > const RAND_METHOD *meth = RAND_get_rand_method(); 832. 833. if (meth->status != NULL) crypto/rand/rand_lib.c:714:1: start of procedure RAND_get_rand_method() 712. } 713. 714. > const RAND_METHOD *RAND_get_rand_method(void) 715. { 716. const RAND_METHOD *tmp_meth = NULL; crypto/rand/rand_lib.c:716:5: 714. const RAND_METHOD *RAND_get_rand_method(void) 715. { 716. > const RAND_METHOD *tmp_meth = NULL; 717. 718. if (!RUN_ONCE(&rand_init, do_rand_init)) crypto/rand/rand_lib.c:718:10: 716. const RAND_METHOD *tmp_meth = NULL; 717. 718. > if (!RUN_ONCE(&rand_init, do_rand_init)) 719. return NULL; 720. crypto/threads_pthread.c:111:1: start of procedure CRYPTO_THREAD_run_once() 109. } 110. 111. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 112. { 113. if (pthread_once(once, init) != 0) crypto/threads_pthread.c:113:9: Taking true branch 111. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 112. { 113. if (pthread_once(once, init) != 0) ^ 114. return 0; 115. crypto/threads_pthread.c:114:9: 112. { 113. if (pthread_once(once, init) != 0) 114. > return 0; 115. 116. return 1; crypto/threads_pthread.c:117:1: return from a call to CRYPTO_THREAD_run_once 115. 116. return 1; 117. > } 118. 119. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)) crypto/rand/rand_lib.c:718:10: Condition is false 716. const RAND_METHOD *tmp_meth = NULL; 717. 718. if (!RUN_ONCE(&rand_init, do_rand_init)) ^ 719. return NULL; 720. crypto/rand/rand_lib.c:718:10: Taking true branch 716. const RAND_METHOD *tmp_meth = NULL; 717. 718. if (!RUN_ONCE(&rand_init, do_rand_init)) ^ 719. return NULL; 720. crypto/rand/rand_lib.c:719:9: 717. 718. if (!RUN_ONCE(&rand_init, do_rand_init)) 719. > return NULL; 720. 721. CRYPTO_THREAD_write_lock(rand_meth_lock); crypto/rand/rand_lib.c:742:1: return from a call to RAND_get_rand_method 740. CRYPTO_THREAD_unlock(rand_meth_lock); 741. return tmp_meth; 742. > } 743. 744. #ifndef OPENSSL_NO_ENGINE crypto/rand/rand_lib.c:833:9: 831. const RAND_METHOD *meth = RAND_get_rand_method(); 832. 833. > if (meth->status != NULL) 834. return meth->status(); 835. return 0;
https://github.com/openssl/openssl/blob/92ebf6c4c21ff4b41ba1fd69af74b2039e138114/crypto/rand/rand_lib.c/#L833
d2a_code_trace_data_44750
int X509_TRUST_add(int id, int flags, int (*ck) (X509_TRUST *, X509 *, int), const char *name, int arg1, void *arg2) { int idx; X509_TRUST *trtmp; flags &= ~X509_TRUST_DYNAMIC; flags |= X509_TRUST_DYNAMIC_NAME; idx = X509_TRUST_get_by_id(id); if (idx == -1) { if ((trtmp = OPENSSL_malloc(sizeof(*trtmp))) == NULL) { X509err(X509_F_X509_TRUST_ADD, ERR_R_MALLOC_FAILURE); return 0; } trtmp->flags = X509_TRUST_DYNAMIC; } else trtmp = X509_TRUST_get0(idx); if (trtmp->flags & X509_TRUST_DYNAMIC_NAME) OPENSSL_free(trtmp->name); if ((trtmp->name = OPENSSL_strdup(name)) == NULL) { X509err(X509_F_X509_TRUST_ADD, ERR_R_MALLOC_FAILURE); goto err; } trtmp->flags &= X509_TRUST_DYNAMIC; trtmp->flags |= flags; trtmp->trust = id; trtmp->check_trust = ck; trtmp->arg1 = arg1; trtmp->arg2 = arg2; if (idx == -1) { if (trtable == NULL && (trtable = sk_X509_TRUST_new(tr_cmp)) == NULL) { X509err(X509_F_X509_TRUST_ADD, ERR_R_MALLOC_FAILURE); goto err;; } if (!sk_X509_TRUST_push(trtable, trtmp)) { X509err(X509_F_X509_TRUST_ADD, ERR_R_MALLOC_FAILURE); goto err; } } return 1; err: if (idx == -1) { OPENSSL_free(trtmp->name); OPENSSL_free(trtmp); } return 0; } crypto/x509/x509_trs.c:146: error: NULL_DEREFERENCE pointer `trtmp` last assigned on line 143 could be null and is dereferenced at line 146, column 9. Showing all 36 steps of the trace crypto/x509/x509_trs.c:122:1: start of procedure X509_TRUST_add() 120. } 121. 122. > int X509_TRUST_add(int id, int flags, int (*ck) (X509_TRUST *, X509 *, int), 123. const char *name, int arg1, void *arg2) 124. { crypto/x509/x509_trs.c:130:5: 128. * This is set according to what we change: application can't set it 129. */ 130. > flags &= ~X509_TRUST_DYNAMIC; 131. /* This will always be set for application modified trust entries */ 132. flags |= X509_TRUST_DYNAMIC_NAME; crypto/x509/x509_trs.c:132:5: 130. flags &= ~X509_TRUST_DYNAMIC; 131. /* This will always be set for application modified trust entries */ 132. > flags |= X509_TRUST_DYNAMIC_NAME; 133. /* Get existing entry if any */ 134. idx = X509_TRUST_get_by_id(id); crypto/x509/x509_trs.c:134:5: 132. flags |= X509_TRUST_DYNAMIC_NAME; 133. /* Get existing entry if any */ 134. > idx = X509_TRUST_get_by_id(id); 135. /* Need a new entry */ 136. if (idx == -1) { crypto/x509/x509_trs.c:97:1: start of procedure X509_TRUST_get_by_id() 95. } 96. 97. > int X509_TRUST_get_by_id(int id) 98. { 99. X509_TRUST tmp; crypto/x509/x509_trs.c:101:10: Taking true branch 99. X509_TRUST tmp; 100. int idx; 101. if ((id >= X509_TRUST_MIN) && (id <= X509_TRUST_MAX)) ^ 102. return id - X509_TRUST_MIN; 103. tmp.trust = id; crypto/x509/x509_trs.c:101:36: Taking false branch 99. X509_TRUST tmp; 100. int idx; 101. if ((id >= X509_TRUST_MIN) && (id <= X509_TRUST_MAX)) ^ 102. return id - X509_TRUST_MIN; 103. tmp.trust = id; crypto/x509/x509_trs.c:103:5: 101. if ((id >= X509_TRUST_MIN) && (id <= X509_TRUST_MAX)) 102. return id - X509_TRUST_MIN; 103. > tmp.trust = id; 104. if (!trtable) 105. return -1; crypto/x509/x509_trs.c:104:10: Taking false branch 102. return id - X509_TRUST_MIN; 103. tmp.trust = id; 104. if (!trtable) ^ 105. return -1; 106. idx = sk_X509_TRUST_find(trtable, &tmp); crypto/x509/x509_trs.c:106:5: 104. if (!trtable) 105. return -1; 106. > idx = sk_X509_TRUST_find(trtable, &tmp); 107. if (idx == -1) 108. return -1; include/openssl/x509.h:112:1: start of procedure sk_X509_TRUST_find() 110. } X509_TRUST; 111. 112. > DEFINE_STACK_OF(X509_TRUST) 113. 114. /* standard trust ids */ crypto/stack/stack.c:270:1: start of procedure OPENSSL_sk_find() 268. } 269. 270. > int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data) 271. { 272. return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH); crypto/stack/stack.c:272:5: 270. int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data) 271. { 272. > return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH); 273. } 274. crypto/stack/stack.c:245:1: start of procedure internal_find() 243. } 244. 245. > static int internal_find(OPENSSL_STACK *st, const void *data, 246. int ret_val_options) 247. { crypto/stack/stack.c:251:9: Taking false branch 249. int i; 250. 251. if (st == NULL) ^ 252. return -1; 253. crypto/stack/stack.c:254:9: Taking true branch 252. return -1; 253. 254. if (st->comp == NULL) { ^ 255. for (i = 0; i < st->num; i++) 256. if (st->data[i] == data) crypto/stack/stack.c:255:14: 253. 254. if (st->comp == NULL) { 255. > for (i = 0; i < st->num; i++) 256. if (st->data[i] == data) 257. return (i); crypto/stack/stack.c:255:21: Loop condition is true. Entering loop body 253. 254. if (st->comp == NULL) { 255. for (i = 0; i < st->num; i++) ^ 256. if (st->data[i] == data) 257. return (i); crypto/stack/stack.c:256:17: Taking false branch 254. if (st->comp == NULL) { 255. for (i = 0; i < st->num; i++) 256. if (st->data[i] == data) ^ 257. return (i); 258. return (-1); crypto/stack/stack.c:255:34: 253. 254. if (st->comp == NULL) { 255. > for (i = 0; i < st->num; i++) 256. if (st->data[i] == data) 257. return (i); crypto/stack/stack.c:255:21: Loop condition is true. Entering loop body 253. 254. if (st->comp == NULL) { 255. for (i = 0; i < st->num; i++) ^ 256. if (st->data[i] == data) 257. return (i); crypto/stack/stack.c:256:17: Taking true branch 254. if (st->comp == NULL) { 255. for (i = 0; i < st->num; i++) 256. if (st->data[i] == data) ^ 257. return (i); 258. return (-1); crypto/stack/stack.c:257:17: 255. for (i = 0; i < st->num; i++) 256. if (st->data[i] == data) 257. > return (i); 258. return (-1); 259. } crypto/stack/stack.c:268:1: return from a call to internal_find 266. return (-1); 267. return (int)((const void **)r - st->data); 268. > } 269. 270. int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data) crypto/stack/stack.c:273:1: return from a call to OPENSSL_sk_find 271. { 272. return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH); 273. > } 274. 275. int OPENSSL_sk_find_ex(OPENSSL_STACK *st, const void *data) include/openssl/x509.h:112:1: return from a call to sk_X509_TRUST_find 110. } X509_TRUST; 111. 112. > DEFINE_STACK_OF(X509_TRUST) 113. 114. /* standard trust ids */ crypto/x509/x509_trs.c:107:9: Taking false branch 105. return -1; 106. idx = sk_X509_TRUST_find(trtable, &tmp); 107. if (idx == -1) ^ 108. return -1; 109. return idx + X509_TRUST_COUNT; crypto/x509/x509_trs.c:109:5: 107. if (idx == -1) 108. return -1; 109. > return idx + X509_TRUST_COUNT; 110. } 111. crypto/x509/x509_trs.c:110:1: return from a call to X509_TRUST_get_by_id 108. return -1; 109. return idx + X509_TRUST_COUNT; 110. > } 111. 112. int X509_TRUST_set(int *t, int trust) crypto/x509/x509_trs.c:136:9: Taking false branch 134. idx = X509_TRUST_get_by_id(id); 135. /* Need a new entry */ 136. if (idx == -1) { ^ 137. if ((trtmp = OPENSSL_malloc(sizeof(*trtmp))) == NULL) { 138. X509err(X509_F_X509_TRUST_ADD, ERR_R_MALLOC_FAILURE); crypto/x509/x509_trs.c:143:9: 141. trtmp->flags = X509_TRUST_DYNAMIC; 142. } else 143. > trtmp = X509_TRUST_get0(idx); 144. 145. /* OPENSSL_free existing name if dynamic */ crypto/x509/x509_trs.c:88:1: start of procedure X509_TRUST_get0() 86. } 87. 88. > X509_TRUST *X509_TRUST_get0(int idx) 89. { 90. if (idx < 0) crypto/x509/x509_trs.c:90:9: Taking true branch 88. X509_TRUST *X509_TRUST_get0(int idx) 89. { 90. if (idx < 0) ^ 91. return NULL; 92. if (idx < (int)X509_TRUST_COUNT) crypto/x509/x509_trs.c:91:9: 89. { 90. if (idx < 0) 91. > return NULL; 92. if (idx < (int)X509_TRUST_COUNT) 93. return trstandard + idx; crypto/x509/x509_trs.c:95:1: return from a call to X509_TRUST_get0 93. return trstandard + idx; 94. return sk_X509_TRUST_value(trtable, idx - X509_TRUST_COUNT); 95. > } 96. 97. int X509_TRUST_get_by_id(int id) crypto/x509/x509_trs.c:146:9: 144. 145. /* OPENSSL_free existing name if dynamic */ 146. > if (trtmp->flags & X509_TRUST_DYNAMIC_NAME) 147. OPENSSL_free(trtmp->name); 148. /* dup supplied name */
https://github.com/openssl/openssl/blob/2dbfa8444bdf7669a54006c4a83d1e60ba374528/crypto/x509/x509_trs.c/#L146
d2a_code_trace_data_44751
static void await_references(H264Context *h){ MpegEncContext * const s = &h->s; const int mb_xy= h->mb_xy; const int mb_type= s->current_picture.mb_type[mb_xy]; int refs[2][48]; int nrefs[2] = {0}; int ref, list; memset(refs, -1, sizeof(refs)); if(IS_16X16(mb_type)){ get_lowest_part_y(h, refs, 0, 16, 0, IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs); }else if(IS_16X8(mb_type)){ get_lowest_part_y(h, refs, 0, 8, 0, IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs); get_lowest_part_y(h, refs, 8, 8, 8, IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1), nrefs); }else if(IS_8X16(mb_type)){ get_lowest_part_y(h, refs, 0, 16, 0, IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs); get_lowest_part_y(h, refs, 4, 16, 0, IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1), nrefs); }else{ int i; assert(IS_8X8(mb_type)); for(i=0; i<4; i++){ const int sub_mb_type= h->sub_mb_type[i]; const int n= 4*i; int y_offset= (i&2)<<2; if(IS_SUB_8X8(sub_mb_type)){ get_lowest_part_y(h, refs, n , 8, y_offset, IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs); }else if(IS_SUB_8X4(sub_mb_type)){ get_lowest_part_y(h, refs, n , 4, y_offset, IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs); get_lowest_part_y(h, refs, n+2, 4, y_offset+4, IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs); }else if(IS_SUB_4X8(sub_mb_type)){ get_lowest_part_y(h, refs, n , 8, y_offset, IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs); get_lowest_part_y(h, refs, n+1, 8, y_offset, IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs); }else{ int j; assert(IS_SUB_4X4(sub_mb_type)); for(j=0; j<4; j++){ int sub_y_offset= y_offset + 2*(j&2); get_lowest_part_y(h, refs, n+j, 4, sub_y_offset, IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs); } } } } for(list=h->list_count-1; list>=0; list--){ for(ref=0; ref<48 && nrefs[list]; ref++){ int row = refs[list][ref]; if(row >= 0){ Picture *ref_pic = &h->ref_list[list][ref]; int ref_field = ref_pic->reference - 1; int ref_field_picture = ref_pic->field_picture; int pic_height = 16*s->mb_height >> ref_field_picture; row <<= MB_MBAFF; nrefs[list]--; if(!FIELD_PICTURE && ref_field_picture){ ff_thread_await_progress((AVFrame*)ref_pic, FFMIN((row >> 1) - !(row&1), pic_height-1), 1); ff_thread_await_progress((AVFrame*)ref_pic, FFMIN((row >> 1) , pic_height-1), 0); }else if(FIELD_PICTURE && !ref_field_picture){ ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row*2 + ref_field , pic_height-1), 0); }else if(FIELD_PICTURE){ ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row, pic_height-1), ref_field); }else{ ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row, pic_height-1), 0); } } } } } libavcodec/mpeg12.c:1947: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `ff_er_frame_end`. libavcodec/mpeg12.c:1947:9: Call 1945. s->current_picture_ptr->qscale_type= FF_QSCALE_TYPE_MPEG2; 1946. 1947. ff_er_frame_end(s); ^ 1948. 1949. MPV_frame_end(s); libavcodec/error_resilience.c:776:1: Parameter `s->list_count` 774. } 775. 776. void ff_er_frame_end(MpegEncContext *s){ ^ 777. int i, mb_x, mb_y, error, error_type, dc_error, mv_error, ac_error; 778. int distance; libavcodec/error_resilience.c:995:13: Call 993. s->mb_x= mb_x; 994. s->mb_y= mb_y; 995. decode_mb(s, 0/*FIXME h264 partitioned slices need this set*/); ^ 996. } 997. } libavcodec/error_resilience.c:43:1: Parameter `s->list_count` 41. #undef mb_intra 42. 43. static void decode_mb(MpegEncContext *s, int ref){ ^ 44. s->dest[0] = s->current_picture.data[0] + (s->mb_y * 16* s->linesize ) + s->mb_x * 16; 45. s->dest[1] = s->current_picture.data[1] + (s->mb_y * (16>>s->chroma_y_shift) * s->uvlinesize) + s->mb_x * (16>>s->chroma_x_shift); libavcodec/error_resilience.c:59:9: Call 57. fill_rectangle(h->mv_cache[0][ scan8[0] ], 4, 4, 8, pack16to32(s->mv[0][0][0],s->mv[0][0][1]), 4); 58. assert(!FRAME_MBAFF); 59. ff_h264_hl_decode_mb(h); ^ 60. }else{ 61. assert(ref==0); libavcodec/h264.c:1847:1: Parameter `h->list_count` 1845. } 1846. 1847. void ff_h264_hl_decode_mb(H264Context *h){ ^ 1848. MpegEncContext * const s = &h->s; 1849. const int mb_xy= h->mb_xy; libavcodec/h264.c:1854:9: Call 1852. 1853. if (is_complex) { 1854. hl_decode_mb_complex(h); ^ 1855. } else if (h->pixel_shift) { 1856. hl_decode_mb_simple_16(h); libavcodec/h264.c:1843:1: Parameter `h->list_count` 1841. * Process a macroblock; this handles edge cases, such as interlacing. 1842. */ 1843. static void av_noinline hl_decode_mb_complex(H264Context *h){ ^ 1844. hl_decode_mb_internal(h, 0, h->pixel_shift); 1845. } libavcodec/h264.c:1844:5: Call 1842. */ 1843. static void av_noinline hl_decode_mb_complex(H264Context *h){ 1844. hl_decode_mb_internal(h, 0, h->pixel_shift); ^ 1845. } 1846. libavcodec/h264.c:1541:1: Parameter `h->list_count` 1539. } 1540. 1541. static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple, int pixel_shift){ ^ 1542. MpegEncContext * const s = &h->s; 1543. const int mb_x= s->mb_x; libavcodec/h264.c:1735:17: Call 1733. }else if(is_h264){ 1734. if (pixel_shift) { 1735. hl_motion_16(h, dest_y, dest_cb, dest_cr, ^ 1736. s->me.qpel_put, s->dsp.put_h264_chroma_pixels_tab, 1737. s->me.qpel_avg, s->dsp.avg_h264_chroma_pixels_tab, libavcodec/h264.c:762:1: Parameter `h->list_count` 760. } 761. hl_motion_fn(0, 8); 762. hl_motion_fn(1, 16); ^ 763. 764. static void free_tables(H264Context *h, int free_rbsp){ libavcodec/h264.c:762:1: Call 760. } 761. hl_motion_fn(0, 8); 762. hl_motion_fn(1, 16); ^ 763. 764. static void free_tables(H264Context *h, int free_rbsp){ libavcodec/h264.c:646:1: Parameter `h->list_count` 644. } 645. 646. static av_always_inline void hl_motion(H264Context *h, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr, ^ 647. qpel_mc_func (*qpix_put)[16], h264_chroma_mc_func (*chroma_put), 648. qpel_mc_func (*qpix_avg)[16], h264_chroma_mc_func (*chroma_avg), libavcodec/h264.c:658:9: Call 656. 657. if(HAVE_PTHREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME)) 658. await_references(h); ^ 659. prefetch_motion(h, 0, pixel_shift); 660. libavcodec/h264.c:299:1: <LHS trace> 297. * @param h the H264 context 298. */ 299. static void await_references(H264Context *h){ ^ 300. MpegEncContext * const s = &h->s; 301. const int mb_xy= h->mb_xy; libavcodec/h264.c:299:1: Parameter `h->list_count` 297. * @param h the H264 context 298. */ 299. static void await_references(H264Context *h){ ^ 300. MpegEncContext * const s = &h->s; 301. const int mb_xy= h->mb_xy; libavcodec/h264.c:357:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `ff_er_frame_end` 355. } 356. 357. for(list=h->list_count-1; list>=0; list--){ ^ 358. for(ref=0; ref<48 && nrefs[list]; ref++){ 359. int row = refs[list][ref];
https://github.com/libav/libav/blob/6a9c85944427e3c4355bce67d7f677ec69527bff/libavcodec/h264.c/#L357
d2a_code_trace_data_44752
void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, MPA_INT *window, int *dither_state, OUT_INT *samples, int incr, int32_t sb_samples[SBLIMIT]) { int32_t tmp[32]; register MPA_INT *synth_buf; register const MPA_INT *w, *w2, *p; int j, offset, v; OUT_INT *samples2; #if FRAC_BITS <= 15 int sum, sum2; #else int64_t sum, sum2; #endif dct32(tmp, sb_samples); offset = *synth_buf_offset; synth_buf = synth_buf_ptr + offset; for(j=0;j<32;j++) { v = tmp[j]; #if FRAC_BITS <= 15 v = av_clip_int16(v); #endif synth_buf[j] = v; } memcpy(synth_buf + 512, synth_buf, 32 * sizeof(MPA_INT)); samples2 = samples + 31 * incr; w = window; w2 = window + 31; sum = *dither_state; p = synth_buf + 16; SUM8(sum, +=, w, p); p = synth_buf + 48; SUM8(sum, -=, w + 32, p); *samples = round_sample(&sum); samples += incr; w++; for(j=1;j<16;j++) { sum2 = 0; p = synth_buf + 16 + j; SUM8P2(sum, +=, sum2, -=, w, w2, p); p = synth_buf + 48 - j; SUM8P2(sum, -=, sum2, -=, w + 32, w2 + 32, p); *samples = round_sample(&sum); samples += incr; sum += sum2; *samples2 = round_sample(&sum); samples2 -= incr; w++; w2--; } p = synth_buf + 32; SUM8(sum, -=, w + 32, p); *samples = round_sample(&sum); *dither_state= sum; offset = (offset - 32) & 511; *synth_buf_offset = offset; } libavcodec/mpc.c:60: error: Buffer Overrun L2 Offset: [96+min(0, `c->synth_buf_offset[*]`), 97+max(511, `c->synth_buf_offset[*]`)] (⇐ [32+min(0, `c->synth_buf_offset[*]`), 33+max(511, `c->synth_buf_offset[*]`)] + 64) Size: 2 by call to `ff_mpa_synth_filter`. libavcodec/mpc.c:51:1: Parameter `c->synth_buf[*]` 49. * Process decoded Musepack data and produce PCM 50. */ 51. static void mpc_synth(MPCContext *c, int16_t *out) ^ 52. { 53. int dither_state = 0; libavcodec/mpc.c:60:13: Call 58. samples_ptr = samples + ch; 59. for(i = 0; i < SAMPLES_PER_BAND; i++) { 60. ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]), ^ 61. mpa_window, &dither_state, 62. samples_ptr, 2, libavcodec/mpegaudiodec.c:858:1: <Length trace> 856. 32 samples. */ 857. /* XXX: optimize by avoiding ring buffer usage */ 858. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ^ 859. MPA_INT *window, int *dither_state, 860. OUT_INT *samples, int incr, libavcodec/mpegaudiodec.c:858:1: Parameter `*synth_buf_ptr` 856. 32 samples. */ 857. /* XXX: optimize by avoiding ring buffer usage */ 858. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ^ 859. MPA_INT *window, int *dither_state, 860. OUT_INT *samples, int incr, libavcodec/mpegaudiodec.c:877:5: Assignment 875. 876. offset = *synth_buf_offset; 877. synth_buf = synth_buf_ptr + offset; ^ 878. 879. for(j=0;j<32;j++) { libavcodec/mpegaudiodec.c:922:5: Assignment 920. } 921. 922. p = synth_buf + 32; ^ 923. SUM8(sum, -=, w + 32, p); 924. *samples = round_sample(&sum); libavcodec/mpegaudiodec.c:923:5: Array access: Offset: [96+min(0, c->synth_buf_offset[*]), 97+max(511, c->synth_buf_offset[*])] (⇐ [32+min(0, c->synth_buf_offset[*]), 33+max(511, c->synth_buf_offset[*])] + 64) Size: 2 by call to `ff_mpa_synth_filter` 921. 922. p = synth_buf + 32; 923. SUM8(sum, -=, w + 32, p); ^ 924. *samples = round_sample(&sum); 925. *dither_state= sum;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L923
d2a_code_trace_data_44753
int ff_msmpeg4_decode_block(MpegEncContext * s, DCTELEM * block, int n, int coded, const uint8_t *scan_table) { int level, i, last, run, run_diff; int dc_pred_dir; RLTable *rl; RL_VLC_ELEM *rl_vlc; int qmul, qadd; if (s->mb_intra) { qmul=1; qadd=0; level = msmpeg4_decode_dc(s, n, &dc_pred_dir); if (level < 0){ av_log(s->avctx, AV_LOG_ERROR, "dc overflow- block: %d qscale: %d//\n", n, s->qscale); if(s->inter_intra_pred) level=0; else return -1; } if (n < 4) { rl = &rl_table[s->rl_table_index]; if(level > 256*s->y_dc_scale){ av_log(s->avctx, AV_LOG_ERROR, "dc overflow+ L qscale: %d//\n", s->qscale); if(!s->inter_intra_pred) return -1; } } else { rl = &rl_table[3 + s->rl_chroma_table_index]; if(level > 256*s->c_dc_scale){ av_log(s->avctx, AV_LOG_ERROR, "dc overflow+ C qscale: %d//\n", s->qscale); if(!s->inter_intra_pred) return -1; } } block[0] = level; run_diff = s->msmpeg4_version >= 4; i = 0; if (!coded) { goto not_coded; } if (s->ac_pred) { if (dc_pred_dir == 0) scan_table = s->intra_v_scantable.permutated; else scan_table = s->intra_h_scantable.permutated; } else { scan_table = s->intra_scantable.permutated; } rl_vlc= rl->rl_vlc[0]; } else { qmul = s->qscale << 1; qadd = (s->qscale - 1) | 1; i = -1; rl = &rl_table[3 + s->rl_table_index]; if(s->msmpeg4_version==2) run_diff = 0; else run_diff = 1; if (!coded) { s->block_last_index[n] = i; return 0; } if(!scan_table) scan_table = s->inter_scantable.permutated; rl_vlc= rl->rl_vlc[s->qscale]; } { OPEN_READER(re, &s->gb); for(;;) { UPDATE_CACHE(re, &s->gb); GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 0); if (level==0) { int cache; cache= GET_CACHE(re, &s->gb); if (s->msmpeg4_version==1 || (cache&0x80000000)==0) { if (s->msmpeg4_version==1 || (cache&0x40000000)==0) { if(s->msmpeg4_version!=1) LAST_SKIP_BITS(re, &s->gb, 2); UPDATE_CACHE(re, &s->gb); if(s->msmpeg4_version<=3){ last= SHOW_UBITS(re, &s->gb, 1); SKIP_CACHE(re, &s->gb, 1); run= SHOW_UBITS(re, &s->gb, 6); SKIP_CACHE(re, &s->gb, 6); level= SHOW_SBITS(re, &s->gb, 8); LAST_SKIP_CACHE(re, &s->gb, 8); SKIP_COUNTER(re, &s->gb, 1+6+8); }else{ int sign; last= SHOW_UBITS(re, &s->gb, 1); SKIP_BITS(re, &s->gb, 1); if(!s->esc3_level_length){ int ll; if(s->qscale<8){ ll= SHOW_UBITS(re, &s->gb, 3); SKIP_BITS(re, &s->gb, 3); if(ll==0){ if(SHOW_UBITS(re, &s->gb, 1)) av_log(s->avctx, AV_LOG_ERROR, "cool a new vlc code ,contact the ffmpeg developers and upload the file\n"); SKIP_BITS(re, &s->gb, 1); ll=8; } }else{ ll=2; while(ll<8 && SHOW_UBITS(re, &s->gb, 1)==0){ ll++; SKIP_BITS(re, &s->gb, 1); } if(ll<8) SKIP_BITS(re, &s->gb, 1); } s->esc3_level_length= ll; s->esc3_run_length= SHOW_UBITS(re, &s->gb, 2) + 3; SKIP_BITS(re, &s->gb, 2); UPDATE_CACHE(re, &s->gb); } run= SHOW_UBITS(re, &s->gb, s->esc3_run_length); SKIP_BITS(re, &s->gb, s->esc3_run_length); sign= SHOW_UBITS(re, &s->gb, 1); SKIP_BITS(re, &s->gb, 1); level= SHOW_UBITS(re, &s->gb, s->esc3_level_length); SKIP_BITS(re, &s->gb, s->esc3_level_length); if(sign) level= -level; } #if 0 { const int abs_level= FFABS(level); const int run1= run - rl->max_run[last][abs_level] - run_diff; if(abs_level<=MAX_LEVEL && run<=MAX_RUN){ if(abs_level <= rl->max_level[last][run]){ av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, vlc encoding possible\n"); return DECODING_AC_LOST; } if(abs_level <= rl->max_level[last][run]*2){ av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 1 encoding possible\n"); return DECODING_AC_LOST; } if(run1>=0 && abs_level <= rl->max_level[last][run1]){ av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 2 encoding possible\n"); return DECODING_AC_LOST; } } } #endif if (level>0) level= level * qmul + qadd; else level= level * qmul - qadd; #if 0 if(level>2048 || level<-2048){ av_log(s->avctx, AV_LOG_ERROR, "|level| overflow in 3. esc\n"); return DECODING_AC_LOST; } #endif i+= run + 1; if(last) i+=192; #ifdef ERROR_DETAILS if(run==66) av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC3 level=%d\n", level); else if((i>62 && i<192) || i>192+63) av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC3 i=%d run=%d level=%d\n", i, run, level); #endif } else { #if MIN_CACHE_BITS < 23 LAST_SKIP_BITS(re, &s->gb, 2); UPDATE_CACHE(re, &s->gb); #else SKIP_BITS(re, &s->gb, 2); #endif GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1); i+= run + rl->max_run[run>>7][level/qmul] + run_diff; level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); LAST_SKIP_BITS(re, &s->gb, 1); #ifdef ERROR_DETAILS if(run==66) av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC2 level=%d\n", level); else if((i>62 && i<192) || i>192+63) av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC2 i=%d run=%d level=%d\n", i, run, level); #endif } } else { #if MIN_CACHE_BITS < 22 LAST_SKIP_BITS(re, &s->gb, 1); UPDATE_CACHE(re, &s->gb); #else SKIP_BITS(re, &s->gb, 1); #endif GET_RL_VLC(level, run, re, &s->gb, rl_vlc, TEX_VLC_BITS, 2, 1); i+= run; level = level + rl->max_level[run>>7][(run-1)&63] * qmul; level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); LAST_SKIP_BITS(re, &s->gb, 1); #ifdef ERROR_DETAILS if(run==66) av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code in ESC1 level=%d\n", level); else if((i>62 && i<192) || i>192+63) av_log(s->avctx, AV_LOG_ERROR, "run overflow in ESC1 i=%d run=%d level=%d\n", i, run, level); #endif } } else { i+= run; level = (level ^ SHOW_SBITS(re, &s->gb, 1)) - SHOW_SBITS(re, &s->gb, 1); LAST_SKIP_BITS(re, &s->gb, 1); #ifdef ERROR_DETAILS if(run==66) av_log(s->avctx, AV_LOG_ERROR, "illegal vlc code level=%d\n", level); else if((i>62 && i<192) || i>192+63) av_log(s->avctx, AV_LOG_ERROR, "run overflow i=%d run=%d level=%d\n", i, run, level); #endif } if (i > 62){ i-= 192; if(i&(~63)){ const int left= s->gb.size_in_bits - get_bits_count(&s->gb); if(((i+192 == 64 && level/qmul==-1) || s->error_resilience<=1) && left>=0){ av_log(s->avctx, AV_LOG_ERROR, "ignoring overflow at %d %d\n", s->mb_x, s->mb_y); break; }else{ av_log(s->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n", s->mb_x, s->mb_y); return -1; } } block[scan_table[i]] = level; break; } block[scan_table[i]] = level; } CLOSE_READER(re, &s->gb); } not_coded: if (s->mb_intra) { mpeg4_pred_ac(s, block, n, dc_pred_dir); if (s->ac_pred) { i = 63; } } if(s->msmpeg4_version>=4 && i>0) i=63; s->block_last_index[n] = i; return 0; } libavcodec/msmpeg4.c:1839: error: Uninitialized Value The value read from dc_pred_dir was never initialized. libavcodec/msmpeg4.c:1839:9: 1837. not_coded: 1838. if (s->mb_intra) { 1839. mpeg4_pred_ac(s, block, n, dc_pred_dir); ^ 1840. if (s->ac_pred) { 1841. i = 63; /* XXX: not optimal */
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/msmpeg4.c/#L1839