id
stringlengths
25
25
content
stringlengths
649
72.1k
max_stars_repo_path
stringlengths
91
133
d2a_code_trace_data_42854
DECLAREContigPutFunc(putRGBUAcontig8bittile) { int samplesperpixel = img->samplesperpixel; (void) y; fromskew *= samplesperpixel; while (h-- > 0) { uint32 r, g, b, a; uint8* m; for (x = w; x-- > 0;) { a = pp[3]; m = img->UaToAa+(a<<8); r = m[pp[0]]; g = m[pp[1]]; b = m[pp[2]]; *cp++ = PACK4(r,g,b,a); pp += samplesperpixel; } cp += toskew; pp += fromskew; } } libtiff/tif_getimage.c:1279: error: Integer Overflow L2 ([0, `h`] - 1):unsigned32. libtiff/tif_getimage.c:1274:1: <LHS trace> 1272. * (known to have Map == NULL) 1273. */ 1274. DECLAREContigPutFunc(putRGBUAcontig8bittile) ^ 1275. { 1276. int samplesperpixel = img->samplesperpixel; libtiff/tif_getimage.c:1274:1: Parameter `h` 1272. * (known to have Map == NULL) 1273. */ 1274. DECLAREContigPutFunc(putRGBUAcontig8bittile) ^ 1275. { 1276. int samplesperpixel = img->samplesperpixel; libtiff/tif_getimage.c:1279:9: Binary operation: ([0, h] - 1):unsigned32 1277. (void) y; 1278. fromskew *= samplesperpixel; 1279. while (h-- > 0) { ^ 1280. uint32 r, g, b, a; 1281. uint8* m;
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_getimage.c/#L1279
d2a_code_trace_data_42855
int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len) { SHA_LONG64 l; unsigned char *p = c->u.p; const unsigned char *data = (const unsigned char *)_data; if (len == 0) return 1; l = (c->Nl + (((SHA_LONG64) len) << 3)) & U64(0xffffffffffffffff); if (l < c->Nl) c->Nh++; if (sizeof(len) >= 8) c->Nh += (((SHA_LONG64) len) >> 61); c->Nl = l; if (c->num != 0) { size_t n = sizeof(c->u) - c->num; if (len < n) { memcpy(p + c->num, data, len), c->num += (unsigned int)len; return 1; } else { memcpy(p + c->num, data, n), c->num = 0; len -= n, data += n; sha512_block_data_order(c, p, 1); } } if (len >= sizeof(c->u)) { #ifndef SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA if ((size_t)data % sizeof(c->u.d[0]) != 0) while (len >= sizeof(c->u)) memcpy(p, data, sizeof(c->u)), sha512_block_data_order(c, p, 1), len -= sizeof(c->u), data += sizeof(c->u); else #endif sha512_block_data_order(c, data, len / sizeof(c->u)), data += len, len %= sizeof(c->u), data -= len; } if (len != 0) memcpy(p, data, len), c->num = (int)len; return 1; } crypto/ec/curve25519.c:4660: error: INTEGER_OVERFLOW_L2 (32 - [1, 127]):unsigned64 by call to `SHA512_Update`. Showing all 10 steps of the trace crypto/ec/curve25519.c:4658:3: Call 4656. memcpy(scopy, signature + 32, 32); 4657. 4658. SHA512_Init(&hash_ctx); ^ 4659. SHA512_Update(&hash_ctx, signature, 32); 4660. SHA512_Update(&hash_ctx, public_key, 32); crypto/sha/sha512.c:94:5: Assignment 92. c->Nl = 0; 93. c->Nh = 0; 94. c->num = 0; ^ 95. c->md_len = SHA512_DIGEST_LENGTH; 96. return 1; crypto/ec/curve25519.c:4659:3: Call 4657. 4658. SHA512_Init(&hash_ctx); 4659. SHA512_Update(&hash_ctx, signature, 32); ^ 4660. SHA512_Update(&hash_ctx, public_key, 32); 4661. SHA512_Update(&hash_ctx, message, message_len); crypto/sha/sha512.c:188:1: Parameter `c->num` 186. } 187. 188. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len) 189. { 190. SHA_LONG64 l; crypto/ec/curve25519.c:4660:3: Call 4658. SHA512_Init(&hash_ctx); 4659. SHA512_Update(&hash_ctx, signature, 32); 4660. SHA512_Update(&hash_ctx, public_key, 32); ^ 4661. SHA512_Update(&hash_ctx, message, message_len); 4662. SHA512_Final(h, &hash_ctx); crypto/sha/sha512.c:188:1: <LHS trace> 186. } 187. 188. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len) 189. { 190. SHA_LONG64 l; crypto/sha/sha512.c:188:1: Parameter `len` 186. } 187. 188. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len) 189. { 190. SHA_LONG64 l; crypto/sha/sha512.c:188:1: <RHS trace> 186. } 187. 188. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len) 189. { 190. SHA_LONG64 l; crypto/sha/sha512.c:188:1: Parameter `len` 186. } 187. 188. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len) 189. { 190. SHA_LONG64 l; crypto/sha/sha512.c:212:13: Binary operation: (32 - [1, 127]):unsigned64 by call to `SHA512_Update` 210. } else { 211. memcpy(p + c->num, data, n), c->num = 0; 212. len -= n, data += n; ^ 213. sha512_block_data_order(c, p, 1); 214. }
https://github.com/openssl/openssl/blob/04dec1ab34df70c1588d42cc394e8fa8b5f3191c/crypto/sha/sha512.c/#L212
d2a_code_trace_data_42856
static int decode_header_trees(SmackVContext *smk) { GetBitContext gb; int mmap_size, mclr_size, full_size, type_size; mmap_size = AV_RL32(smk->avctx->extradata); mclr_size = AV_RL32(smk->avctx->extradata + 4); full_size = AV_RL32(smk->avctx->extradata + 8); type_size = AV_RL32(smk->avctx->extradata + 12); init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8); if(!get_bits1(&gb)) { av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n"); smk->mmap_tbl = av_malloc(sizeof(int) * 2); smk->mmap_tbl[0] = 0; smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1; } else { if (smacker_decode_header_tree(smk, &gb, &smk->mmap_tbl, smk->mmap_last, mmap_size)) return -1; } if(!get_bits1(&gb)) { av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n"); smk->mclr_tbl = av_malloc(sizeof(int) * 2); smk->mclr_tbl[0] = 0; smk->mclr_last[0] = smk->mclr_last[1] = smk->mclr_last[2] = 1; } else { if (smacker_decode_header_tree(smk, &gb, &smk->mclr_tbl, smk->mclr_last, mclr_size)) return -1; } if(!get_bits1(&gb)) { av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n"); smk->full_tbl = av_malloc(sizeof(int) * 2); smk->full_tbl[0] = 0; smk->full_last[0] = smk->full_last[1] = smk->full_last[2] = 1; } else { if (smacker_decode_header_tree(smk, &gb, &smk->full_tbl, smk->full_last, full_size)) return -1; } if(!get_bits1(&gb)) { av_log(smk->avctx, AV_LOG_INFO, "Skipping TYPE tree\n"); smk->type_tbl = av_malloc(sizeof(int) * 2); smk->type_tbl[0] = 0; smk->type_last[0] = smk->type_last[1] = smk->type_last[2] = 1; } else { if (smacker_decode_header_tree(smk, &gb, &smk->type_tbl, smk->type_last, type_size)) return -1; } return 0; } libavcodec/smacker.c:310: error: Null Dereference pointer `smk->full_tbl` last assigned on line 309 could be null and is dereferenced at line 310, column 9. libavcodec/smacker.c:278:1: start of procedure decode_header_trees() 276. } 277. 278. static int decode_header_trees(SmackVContext *smk) { ^ 279. GetBitContext gb; 280. int mmap_size, mclr_size, full_size, type_size; libavcodec/smacker.c:282:5: 280. int mmap_size, mclr_size, full_size, type_size; 281. 282. mmap_size = AV_RL32(smk->avctx->extradata); ^ 283. mclr_size = AV_RL32(smk->avctx->extradata + 4); 284. full_size = AV_RL32(smk->avctx->extradata + 8); libavcodec/smacker.c:283:5: 281. 282. mmap_size = AV_RL32(smk->avctx->extradata); 283. mclr_size = AV_RL32(smk->avctx->extradata + 4); ^ 284. full_size = AV_RL32(smk->avctx->extradata + 8); 285. type_size = AV_RL32(smk->avctx->extradata + 12); libavcodec/smacker.c:284:5: 282. mmap_size = AV_RL32(smk->avctx->extradata); 283. mclr_size = AV_RL32(smk->avctx->extradata + 4); 284. full_size = AV_RL32(smk->avctx->extradata + 8); ^ 285. type_size = AV_RL32(smk->avctx->extradata + 12); 286. libavcodec/smacker.c:285:5: 283. mclr_size = AV_RL32(smk->avctx->extradata + 4); 284. full_size = AV_RL32(smk->avctx->extradata + 8); 285. type_size = AV_RL32(smk->avctx->extradata + 12); ^ 286. 287. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8); libavcodec/smacker.c:287:5: 285. type_size = AV_RL32(smk->avctx->extradata + 12); 286. 287. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8); ^ 288. 289. if(!get_bits1(&gb)) { libavcodec/get_bits.h:383:1: start of procedure init_get_bits() 381. * responsible for checking for the buffer end yourself (take advantage of the padding)! 382. */ 383. static inline void init_get_bits(GetBitContext *s, ^ 384. const uint8_t *buffer, int bit_size) 385. { libavcodec/get_bits.h:386:5: 384. const uint8_t *buffer, int bit_size) 385. { 386. int buffer_size = (bit_size+7)>>3; ^ 387. if (buffer_size < 0 || bit_size < 0) { 388. buffer_size = bit_size = 0; libavcodec/get_bits.h:387:9: Taking false 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:387:28: Taking false 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:392:5: 390. } 391. 392. s->buffer = buffer; ^ 393. s->size_in_bits = bit_size; 394. s->buffer_end = buffer + buffer_size; libavcodec/get_bits.h:393:5: 391. 392. s->buffer = buffer; 393. s->size_in_bits = bit_size; ^ 394. s->buffer_end = buffer + buffer_size; 395. #ifdef ALT_BITSTREAM_READER libavcodec/get_bits.h:394:5: 392. s->buffer = buffer; 393. s->size_in_bits = bit_size; 394. s->buffer_end = buffer + buffer_size; ^ 395. #ifdef ALT_BITSTREAM_READER 396. s->index = 0; libavcodec/get_bits.h:396:5: 394. s->buffer_end = buffer + buffer_size; 395. #ifdef ALT_BITSTREAM_READER 396. s->index = 0; ^ 397. #elif defined A32_BITSTREAM_READER 398. s->buffer_ptr = (uint32_t*)((intptr_t)buffer & ~3); libavcodec/get_bits.h:402:1: return from a call to init_get_bits 400. skip_bits_long(s, 0); 401. #endif 402. } ^ 403. 404. static inline void align_get_bits(GetBitContext *s) libavcodec/smacker.c:289:9: 287. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8); 288. 289. if(!get_bits1(&gb)) { ^ 290. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n"); 291. smk->mmap_tbl = av_malloc(sizeof(int) * 2); libavcodec/get_bits.h:303:1: start of procedure get_bits1() 301. } 302. 303. static inline unsigned int get_bits1(GetBitContext *s){ ^ 304. #ifdef ALT_BITSTREAM_READER 305. unsigned int index = s->index; libavcodec/get_bits.h:305:5: 303. static inline unsigned int get_bits1(GetBitContext *s){ 304. #ifdef ALT_BITSTREAM_READER 305. unsigned int index = s->index; ^ 306. uint8_t result = s->buffer[index>>3]; 307. #ifdef ALT_BITSTREAM_READER_LE libavcodec/get_bits.h:306:5: 304. #ifdef ALT_BITSTREAM_READER 305. unsigned int index = s->index; 306. uint8_t result = s->buffer[index>>3]; ^ 307. #ifdef ALT_BITSTREAM_READER_LE 308. result >>= index & 7; libavcodec/get_bits.h:308:5: 306. uint8_t result = s->buffer[index>>3]; 307. #ifdef ALT_BITSTREAM_READER_LE 308. result >>= index & 7; ^ 309. result &= 1; 310. #else libavcodec/get_bits.h:309:5: 307. #ifdef ALT_BITSTREAM_READER_LE 308. result >>= index & 7; 309. result &= 1; ^ 310. #else 311. result <<= index & 7; libavcodec/get_bits.h:314:5: 312. result >>= 8 - 1; 313. #endif 314. index++; ^ 315. s->index = index; 316. libavcodec/get_bits.h:315:5: 313. #endif 314. index++; 315. s->index = index; ^ 316. 317. return result; libavcodec/get_bits.h:317:5: 315. s->index = index; 316. 317. return result; ^ 318. #else 319. return get_bits(s, 1); libavcodec/get_bits.h:321:1: return from a call to get_bits1 319. return get_bits(s, 1); 320. #endif 321. } ^ 322. 323. static inline unsigned int show_bits1(GetBitContext *s){ libavcodec/smacker.c:289:9: Taking true branch 287. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8); 288. 289. if(!get_bits1(&gb)) { ^ 290. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n"); 291. smk->mmap_tbl = av_malloc(sizeof(int) * 2); libavcodec/smacker.c:290:9: Skipping av_log(): empty list of specs 288. 289. if(!get_bits1(&gb)) { 290. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n"); ^ 291. smk->mmap_tbl = av_malloc(sizeof(int) * 2); 292. smk->mmap_tbl[0] = 0; libavcodec/smacker.c:291:9: 289. if(!get_bits1(&gb)) { 290. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n"); 291. smk->mmap_tbl = av_malloc(sizeof(int) * 2); ^ 292. smk->mmap_tbl[0] = 0; 293. smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 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/smacker.c:292:9: 290. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n"); 291. smk->mmap_tbl = av_malloc(sizeof(int) * 2); 292. smk->mmap_tbl[0] = 0; ^ 293. smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1; 294. } else { libavcodec/smacker.c:293:9: 291. smk->mmap_tbl = av_malloc(sizeof(int) * 2); 292. smk->mmap_tbl[0] = 0; 293. smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1; ^ 294. } else { 295. if (smacker_decode_header_tree(smk, &gb, &smk->mmap_tbl, smk->mmap_last, mmap_size)) libavcodec/smacker.c:298:9: 296. return -1; 297. } 298. if(!get_bits1(&gb)) { ^ 299. av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n"); 300. smk->mclr_tbl = av_malloc(sizeof(int) * 2); libavcodec/get_bits.h:303:1: start of procedure get_bits1() 301. } 302. 303. static inline unsigned int get_bits1(GetBitContext *s){ ^ 304. #ifdef ALT_BITSTREAM_READER 305. unsigned int index = s->index; libavcodec/get_bits.h:305:5: 303. static inline unsigned int get_bits1(GetBitContext *s){ 304. #ifdef ALT_BITSTREAM_READER 305. unsigned int index = s->index; ^ 306. uint8_t result = s->buffer[index>>3]; 307. #ifdef ALT_BITSTREAM_READER_LE libavcodec/get_bits.h:306:5: 304. #ifdef ALT_BITSTREAM_READER 305. unsigned int index = s->index; 306. uint8_t result = s->buffer[index>>3]; ^ 307. #ifdef ALT_BITSTREAM_READER_LE 308. result >>= index & 7; libavcodec/get_bits.h:308:5: 306. uint8_t result = s->buffer[index>>3]; 307. #ifdef ALT_BITSTREAM_READER_LE 308. result >>= index & 7; ^ 309. result &= 1; 310. #else libavcodec/get_bits.h:309:5: 307. #ifdef ALT_BITSTREAM_READER_LE 308. result >>= index & 7; 309. result &= 1; ^ 310. #else 311. result <<= index & 7; libavcodec/get_bits.h:314:5: 312. result >>= 8 - 1; 313. #endif 314. index++; ^ 315. s->index = index; 316. libavcodec/get_bits.h:315:5: 313. #endif 314. index++; 315. s->index = index; ^ 316. 317. return result; libavcodec/get_bits.h:317:5: 315. s->index = index; 316. 317. return result; ^ 318. #else 319. return get_bits(s, 1); libavcodec/get_bits.h:321:1: return from a call to get_bits1 319. return get_bits(s, 1); 320. #endif 321. } ^ 322. 323. static inline unsigned int show_bits1(GetBitContext *s){ libavcodec/smacker.c:298:9: Taking true branch 296. return -1; 297. } 298. if(!get_bits1(&gb)) { ^ 299. av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n"); 300. smk->mclr_tbl = av_malloc(sizeof(int) * 2); libavcodec/smacker.c:299:9: Skipping av_log(): empty list of specs 297. } 298. if(!get_bits1(&gb)) { 299. av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n"); ^ 300. smk->mclr_tbl = av_malloc(sizeof(int) * 2); 301. smk->mclr_tbl[0] = 0; libavcodec/smacker.c:300:9: 298. if(!get_bits1(&gb)) { 299. av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n"); 300. smk->mclr_tbl = av_malloc(sizeof(int) * 2); ^ 301. smk->mclr_tbl[0] = 0; 302. smk->mclr_last[0] = smk->mclr_last[1] = smk->mclr_last[2] = 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/smacker.c:301:9: 299. av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n"); 300. smk->mclr_tbl = av_malloc(sizeof(int) * 2); 301. smk->mclr_tbl[0] = 0; ^ 302. smk->mclr_last[0] = smk->mclr_last[1] = smk->mclr_last[2] = 1; 303. } else { libavcodec/smacker.c:302:9: 300. smk->mclr_tbl = av_malloc(sizeof(int) * 2); 301. smk->mclr_tbl[0] = 0; 302. smk->mclr_last[0] = smk->mclr_last[1] = smk->mclr_last[2] = 1; ^ 303. } else { 304. if (smacker_decode_header_tree(smk, &gb, &smk->mclr_tbl, smk->mclr_last, mclr_size)) libavcodec/smacker.c:307:9: 305. return -1; 306. } 307. if(!get_bits1(&gb)) { ^ 308. av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n"); 309. smk->full_tbl = av_malloc(sizeof(int) * 2); libavcodec/get_bits.h:303:1: start of procedure get_bits1() 301. } 302. 303. static inline unsigned int get_bits1(GetBitContext *s){ ^ 304. #ifdef ALT_BITSTREAM_READER 305. unsigned int index = s->index; libavcodec/get_bits.h:305:5: 303. static inline unsigned int get_bits1(GetBitContext *s){ 304. #ifdef ALT_BITSTREAM_READER 305. unsigned int index = s->index; ^ 306. uint8_t result = s->buffer[index>>3]; 307. #ifdef ALT_BITSTREAM_READER_LE libavcodec/get_bits.h:306:5: 304. #ifdef ALT_BITSTREAM_READER 305. unsigned int index = s->index; 306. uint8_t result = s->buffer[index>>3]; ^ 307. #ifdef ALT_BITSTREAM_READER_LE 308. result >>= index & 7; libavcodec/get_bits.h:308:5: 306. uint8_t result = s->buffer[index>>3]; 307. #ifdef ALT_BITSTREAM_READER_LE 308. result >>= index & 7; ^ 309. result &= 1; 310. #else libavcodec/get_bits.h:309:5: 307. #ifdef ALT_BITSTREAM_READER_LE 308. result >>= index & 7; 309. result &= 1; ^ 310. #else 311. result <<= index & 7; libavcodec/get_bits.h:314:5: 312. result >>= 8 - 1; 313. #endif 314. index++; ^ 315. s->index = index; 316. libavcodec/get_bits.h:315:5: 313. #endif 314. index++; 315. s->index = index; ^ 316. 317. return result; libavcodec/get_bits.h:317:5: 315. s->index = index; 316. 317. return result; ^ 318. #else 319. return get_bits(s, 1); libavcodec/get_bits.h:321:1: return from a call to get_bits1 319. return get_bits(s, 1); 320. #endif 321. } ^ 322. 323. static inline unsigned int show_bits1(GetBitContext *s){ libavcodec/smacker.c:307:9: Taking true branch 305. return -1; 306. } 307. if(!get_bits1(&gb)) { ^ 308. av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n"); 309. smk->full_tbl = av_malloc(sizeof(int) * 2); libavcodec/smacker.c:308:9: Skipping av_log(): empty list of specs 306. } 307. if(!get_bits1(&gb)) { 308. av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n"); ^ 309. smk->full_tbl = av_malloc(sizeof(int) * 2); 310. smk->full_tbl[0] = 0; libavcodec/smacker.c:309:9: 307. if(!get_bits1(&gb)) { 308. av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n"); 309. smk->full_tbl = av_malloc(sizeof(int) * 2); ^ 310. smk->full_tbl[0] = 0; 311. smk->full_last[0] = smk->full_last[1] = smk->full_last[2] = 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 true 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:84:9: 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,32,size)) 84. ptr = NULL; ^ 85. #elif HAVE_MEMALIGN 86. ptr = memalign(32,size); 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/smacker.c:310:9: 308. av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n"); 309. smk->full_tbl = av_malloc(sizeof(int) * 2); 310. smk->full_tbl[0] = 0; ^ 311. smk->full_last[0] = smk->full_last[1] = smk->full_last[2] = 1; 312. } else {
https://github.com/libav/libav/blob/d7d2f0e63c8187d531168256a0ce2aac21d5fce6/libavcodec/smacker.c/#L310
d2a_code_trace_data_42857
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *A, *a = NULL; const BN_ULONG *B; int i; 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 = A = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = A = OPENSSL_zalloc(words * sizeof(*a)); if (A == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return (NULL); } #if 1 B = b->d; if (B != NULL) { for (i = b->top >> 2; i > 0; i--, A += 4, B += 4) { BN_ULONG a0, a1, a2, a3; a0 = B[0]; a1 = B[1]; a2 = B[2]; a3 = B[3]; A[0] = a0; A[1] = a1; A[2] = a2; A[3] = a3; } switch (b->top & 3) { case 3: A[2] = B[2]; case 2: A[1] = B[1]; case 1: A[0] = B[0]; case 0: ; } } #else memset(A, 0, sizeof(*A) * words); memcpy(A, b->d, sizeof(b->d[0]) * b->top); #endif return (a); } test/ecdsatest.c:418: error: BUFFER_OVERRUN_L3 Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, 8388607] by call to `BN_bin2bn`. Showing all 13 steps of the trace test/ecdsatest.c:417:28: Call 415. if (modified_sig == NULL) 416. goto builtin_err; 417. if (((modified_r = BN_bin2bn(raw_buf, bn_len, NULL)) == NULL) ^ 418. || ((modified_s = BN_bin2bn(raw_buf + bn_len, bn_len, NULL)) == NULL) 419. || !ECDSA_SIG_set0(modified_sig, modified_r, modified_s)) { crypto/bn/bn_lib.c:475:1: Parameter `*ret->d` 473. } 474. 475. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) 476. { 477. unsigned int i, m; test/ecdsatest.c:418:31: Call 416. goto builtin_err; 417. if (((modified_r = BN_bin2bn(raw_buf, bn_len, NULL)) == NULL) 418. || ((modified_s = BN_bin2bn(raw_buf + bn_len, bn_len, NULL)) == NULL) ^ 419. || !ECDSA_SIG_set0(modified_sig, modified_r, modified_s)) { 420. BN_free(modified_r); crypto/bn/bn_lib.c:475:1: Parameter `*ret->d` 473. } 474. 475. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) 476. { 477. unsigned int i, m; crypto/bn/bn_lib.c:497:9: Call 495. i = ((n - 1) / BN_BYTES) + 1; 496. m = ((n - 1) % (BN_BYTES)); 497. if (bn_wexpand(ret, (int)i) == NULL) { ^ 498. BN_free(bn); 499. return NULL; crypto/bn/bn_lib.c:1016:1: Parameter `*a->d` 1014. } 1015. 1016. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 1017. { 1018. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:1018:37: Call 1016. BIGNUM *bn_wexpand(BIGNUM *a, int words) 1017. { 1018. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 1019. } 1020. crypto/bn/bn_lib.c:323:1: Parameter `*b->d` 321. */ 322. 323. > BIGNUM *bn_expand2(BIGNUM *b, int words) 324. { 325. bn_check_top(b); crypto/bn/bn_lib.c:328:23: Call 326. 327. if (words > b->dmax) { 328. BN_ULONG *a = bn_expand_internal(b, words); ^ 329. if (!a) 330. return 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, *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, *a = NULL; crypto/bn/bn_lib.c:272:5: Assignment 270. 271. #if 1 272. B = b->d; ^ 273. /* Check if the previous number needs to be copied */ 274. if (B != NULL) { crypto/bn/bn_lib.c:289:18: Array access: Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, 8388607] by call to `BN_bin2bn` 287. a1 = B[1]; 288. a2 = B[2]; 289. a3 = B[3]; ^ 290. A[0] = a0; 291. A[1] = a1;
https://github.com/openssl/openssl/blob/69588edbaa424beb71c6a9b1be416588232cb78c/crypto/bn/bn_lib.c/#L289
d2a_code_trace_data_42858
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) { int i, nw, lb, rb; BN_ULONG *t, *f; BN_ULONG l; bn_check_top(r); bn_check_top(a); if (n < 0) { BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT); return 0; } nw = n / BN_BITS2; if (bn_wexpand(r, a->top + nw + 1) == NULL) return (0); r->neg = a->neg; lb = n % BN_BITS2; rb = BN_BITS2 - lb; f = a->d; t = r->d; t[a->top + nw] = 0; if (lb == 0) for (i = a->top - 1; i >= 0; i--) t[nw + i] = f[i]; else for (i = a->top - 1; i >= 0; i--) { l = f[i]; t[nw + i + 1] |= (l >> rb) & BN_MASK2; t[nw + i] = (l << lb) & BN_MASK2; } memset(t, 0, sizeof(*t) * nw); r->top = a->top + nw + 1; bn_correct_top(r); bn_check_top(r); return (1); } test/srptest.c:69: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `SRP_create_verifier_BN`. Showing all 20 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:747:14: Call 745. /* prepare a^1 in Montgomery domain */ 746. if (a->neg || BN_ucmp(a, m) >= 0) { 747. if (!BN_mod(&am, a, m, ctx)) ^ 748. goto err; 749. if (!BN_to_montgomery(&am, &am, mont, ctx)) crypto/bn/bn_div.c:140:1: Parameter `num->top` 138. * If 'dv' or 'rm' is NULL, the respective value is not returned. 139. */ 140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 141. BN_CTX *ctx) 142. { crypto/bn/bn_div.c:210:11: Call 208. sdiv->neg = 0; 209. norm_shift += BN_BITS2; 210. if (!(BN_lshift(snum, num, norm_shift))) ^ 211. goto err; 212. snum->neg = 0; crypto/bn/bn_shift.c:83:1: <Offset trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `n` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:5: Assignment 95. } 96. 97. nw = n / BN_BITS2; ^ 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) 99. return (0); crypto/bn/bn_shift.c:83:1: <Length trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `*r->d` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:98:9: Call 96. 97. nw = n / BN_BITS2; 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 99. return (0); 100. r->neg = a->neg; crypto/bn/bn_lib.c:948:1: Parameter `*a->d` 946. } 947. 948. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:104:5: Assignment 102. rb = BN_BITS2 - lb; 103. f = a->d; 104. t = r->d; ^ 105. t[a->top + nw] = 0; 106. if (lb == 0) crypto/bn/bn_shift.c:112:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `SRP_create_verifier_BN` 110. for (i = a->top - 1; i >= 0; i--) { 111. l = f[i]; 112. t[nw + i + 1] |= (l >> rb) & BN_MASK2; ^ 113. t[nw + i] = (l << lb) & BN_MASK2; 114. }
https://github.com/openssl/openssl/blob/b66411f6cda6970c01283ddde6d8063c57b3b7d9/crypto/bn/bn_shift.c/#L112
d2a_code_trace_data_42859
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/ectest.c:214: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `EC_POINT_set_compressed_coordinates_GFp`. Showing all 25 steps of the trace test/ectest.c:171:13: Call 169. || !TEST_ptr(a = BN_new()) 170. || !TEST_ptr(b = BN_new()) 171. || !TEST_true(BN_hex2bn(&p, "17")) ^ 172. || !TEST_true(BN_hex2bn(&a, "1")) 173. || !TEST_true(BN_hex2bn(&b, "1")) crypto/bn/bn_print.c:126:1: Parameter `(*bn)->top` 124. } 125. 126. > int BN_hex2bn(BIGNUM **bn, const char *a) 127. { 128. BIGNUM *ret = NULL; test/ectest.c:214:13: Call 212. || !TEST_ptr(yplusone = BN_new()) 213. || !TEST_true(BN_hex2bn(&x, "D")) 214. || !TEST_true(EC_POINT_set_compressed_coordinates_GFp(group, Q, x, 1, ^ 215. ctx))) 216. goto err; crypto/ec/ec_oct.c:23:1: Parameter `x->top` 21. #include "ec_lcl.h" 22. 23. > int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, 24. EC_POINT *point, const BIGNUM *x, 25. int y_bit, BN_CTX *ctx) crypto/ec/ec_oct.c:40:20: Call 38. if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) { 39. if (group->meth->field_type == NID_X9_62_prime_field) 40. return ec_GFp_simple_set_compressed_coordinates(group, point, x, ^ 41. y_bit, ctx); 42. else crypto/ec/ecp_oct.c:42:12: Call 40. 41. BN_CTX_start(ctx); 42. tmp1 = BN_CTX_get(ctx); ^ 43. tmp2 = BN_CTX_get(ctx); 44. x = 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:395:1: Parameter `*a->d` 393. } 394. 395. > int BN_set_word(BIGNUM *a, BN_ULONG w) 396. { 397. bn_check_top(a); crypto/bn/bn_lib.c:398:9: Call 396. { 397. bn_check_top(a); 398. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 399. return (0); 400. a->neg = 0; crypto/bn/bn_lcl.h:660:1: Parameter `*a->d` 658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 659. 660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 661. { 662. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/ec/ecp_oct.c:65:14: Call 63. goto err; 64. } else { 65. if (!BN_mod_sqr(tmp2, x_, group->field, ctx)) ^ 66. goto err; 67. if (!BN_mod_mul(tmp1, tmp2, x_, group->field, ctx)) crypto/bn/bn_mod.c:102:1: Parameter `*r->d` 100. } 101. 102. > int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx) 103. { 104. if (!BN_sqr(r, a, ctx)) crypto/bn/bn_mod.c:104:10: Call 102. int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx) 103. { 104. if (!BN_sqr(r, a, ctx)) ^ 105. return 0; 106. /* r->neg == 0, thus we don't need BN_nnmod */ crypto/bn/bn_sqr.c:17:1: Parameter `a->top` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int max, al; crypto/bn/bn_sqr.c:25:5: Assignment 23. bn_check_top(a); 24. 25. al = a->top; ^ 26. if (al <= 0) { 27. r->top = 0; crypto/bn/bn_sqr.c:74:17: Call 72. if (bn_wexpand(tmp, max) == NULL) 73. goto err; 74. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 75. } 76. } crypto/bn/bn_sqr.c:105:1: <Offset trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `n` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:116:5: Assignment 114. rp[0] = rp[max - 1] = 0; 115. rp++; 116. j = n; ^ 117. 118. if (--j > 0) { crypto/bn/bn_sqr.c:118:9: Assignment 116. j = n; 117. 118. if (--j > 0) { ^ 119. ap++; 120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); crypto/bn/bn_sqr.c:105:1: <Length trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `*r` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:113:5: Assignment 111. max = n * 2; 112. ap = a; 113. rp = r; ^ 114. rp[0] = rp[max - 1] = 0; 115. rp++; crypto/bn/bn_sqr.c:115:5: Assignment 113. rp = r; 114. rp[0] = rp[max - 1] = 0; 115. rp++; ^ 116. j = n; 117. crypto/bn/bn_sqr.c:120:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `EC_POINT_set_compressed_coordinates_GFp` 118. if (--j > 0) { 119. ap++; 120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); ^ 121. rp += 2; 122. }
https://github.com/openssl/openssl/blob/7671342e550ed2de676b23c79d0e7f45a381c76e/crypto/bn/bn_sqr.c/#L120
d2a_code_trace_data_42860
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dh/dh_check.c:97: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_exp`. Showing all 20 steps of the trace crypto/dh/dh_check.c:83:2: Call 81. ctx=BN_CTX_new(); 82. if (ctx == NULL) goto err; 83. BN_CTX_start(ctx); ^ 84. t1=BN_CTX_get(ctx); 85. t2=BN_CTX_get(ctx); crypto/bn/bn_ctx.c:257:1: Parameter `ctx->stack.depth` 255. } 256. 257. > void BN_CTX_start(BN_CTX *ctx) 258. { 259. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/dh/dh_check.c:97:9: Call 95. { 96. /* Check g^q == 1 mod p */ 97. if (!BN_mod_exp(t1, dh->g, dh->q, dh->p, ctx)) ^ 98. goto err; 99. if (!BN_is_one(t1)) crypto/bn/bn_exp.c:177:1: Parameter `ctx->stack.depth` 175. 176. 177. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 178. BN_CTX *ctx) 179. { crypto/bn/bn_exp.c:242:9: Call 240. #endif 241. #ifdef RECP_MUL_MOD 242. { ret=BN_mod_exp_recp(r,a,p,m,ctx); } ^ 243. #else 244. { ret=BN_mod_exp_simple(r,a,p,m,ctx); } crypto/bn/bn_exp.c:252:1: Parameter `ctx->stack.depth` 250. 251. 252. > int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 253. const BIGNUM *m, BN_CTX *ctx) 254. { crypto/bn/bn_exp.c:277:2: Call 275. } 276. 277. BN_CTX_start(ctx); ^ 278. aa = BN_CTX_get(ctx); 279. val[0] = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:257:1: Parameter `ctx->stack.depth` 255. } 256. 257. > void BN_CTX_start(BN_CTX *ctx) 258. { 259. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_exp.c:295:7: Call 293. } 294. 295. if (!BN_nnmod(val[0],a,m,ctx)) goto err; /* 1 */ ^ 296. if (BN_is_zero(val[0])) 297. { crypto/bn/bn_mod.c:129:1: Parameter `ctx->stack.depth` 127. 128. 129. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 130. { 131. /* like BN_mod, but returns non-negative remainder crypto/bn/bn_mod.c:134:8: Call 132. * (i.e., 0 <= r < |d| always holds) */ 133. 134. if (!(BN_mod(r,m,d,ctx))) ^ 135. return 0; 136. if (!r->neg) crypto/bn/bn_div.c:183:1: Parameter `ctx->stack.depth` 181. * If 'dv' or 'rm' is NULL, the respective value is not returned. 182. */ 183. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 184. BN_CTX *ctx) 185. { crypto/bn/bn_div.c:228:2: Call 226. } 227. 228. BN_CTX_start(ctx); ^ 229. tmp=BN_CTX_get(ctx); 230. snum=BN_CTX_get(ctx); crypto/bn/bn_ctx.c:257:1: Parameter `ctx->stack.depth` 255. } 256. 257. > void BN_CTX_start(BN_CTX *ctx) 258. { 259. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:443:2: Call 441. } 442. if (no_branch) bn_correct_top(res); 443. BN_CTX_end(ctx); ^ 444. return(1); 445. err: crypto/bn/bn_ctx.c:272:1: Parameter `ctx->stack.depth` 270. } 271. 272. > void BN_CTX_end(BN_CTX *ctx) 273. { 274. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:279:21: Call 277. else 278. { 279. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 280. /* Does this stack frame have anything to release? */ 281. if(fp < ctx->used) crypto/bn/bn_ctx.c:353:1: <LHS trace> 351. } 352. 353. > static unsigned int BN_STACK_pop(BN_STACK *st) 354. { 355. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:353:1: Parameter `st->depth` 351. } 352. 353. > static unsigned int BN_STACK_pop(BN_STACK *st) 354. { 355. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:355:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_exp` 353. static unsigned int BN_STACK_pop(BN_STACK *st) 354. { 355. return st->indexes[--(st->depth)]; ^ 356. } 357.
https://github.com/openssl/openssl/blob/a7c71d8955fc5b9231858ddad0ee050f2b5238b3/crypto/bn/bn_ctx.c/#L355
d2a_code_trace_data_42861
static void new_audio_stream(AVFormatContext *oc) { AVStream *st; AVCodecContext *audio_enc; enum CodecID codec_id; st = av_new_stream(oc, oc->nb_streams); if (!st) { fprintf(stderr, "Could not alloc stream\n"); av_exit(1); } avcodec_get_context_defaults2(st->codec, 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:3491: error: Null Dereference pointer `st` last assigned on line 3486 could be null and is dereferenced at line 3491, column 35. ffmpeg.c:3480:1: start of procedure new_audio_stream() 3478. } 3479. 3480. static void new_audio_stream(AVFormatContext *oc) ^ 3481. { 3482. AVStream *st; ffmpeg.c:3486:5: 3484. enum CodecID codec_id; 3485. 3486. st = av_new_stream(oc, oc->nb_streams); ^ 3487. if (!st) { 3488. fprintf(stderr, "Could not alloc stream\n"); libavformat/utils.c:2465:1: start of procedure av_new_stream() 2463. } 2464. 2465. AVStream *av_new_stream(AVFormatContext *s, int id) ^ 2466. { 2467. AVStream *st; libavformat/utils.c:2470:9: Taking true branch 2468. int i; 2469. 2470. if (s->nb_streams >= MAX_STREAMS) ^ 2471. return NULL; 2472. libavformat/utils.c:2471:9: 2469. 2470. if (s->nb_streams >= MAX_STREAMS) 2471. return NULL; ^ 2472. 2473. st = av_mallocz(sizeof(AVStream)); libavformat/utils.c:2505:1: return from a call to av_new_stream 2503. s->streams[s->nb_streams++] = st; 2504. return st; 2505. } ^ 2506. 2507. AVProgram *av_new_program(AVFormatContext *ac, int id) ffmpeg.c:3487:10: Taking true branch 3485. 3486. st = av_new_stream(oc, oc->nb_streams); 3487. if (!st) { ^ 3488. fprintf(stderr, "Could not alloc stream\n"); 3489. av_exit(1); ffmpeg.c:3488:9: 3486. st = av_new_stream(oc, oc->nb_streams); 3487. if (!st) { 3488. fprintf(stderr, "Could not alloc stream\n"); ^ 3489. av_exit(1); 3490. } ffmpeg.c:3489:9: Skipping av_exit(): empty list of specs 3487. if (!st) { 3488. fprintf(stderr, "Could not alloc stream\n"); 3489. av_exit(1); ^ 3490. } 3491. avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_AUDIO); ffmpeg.c:3491:5: 3489. av_exit(1); 3490. } 3491. avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_AUDIO); ^ 3492. 3493. bitstream_filters[nb_output_files][oc->nb_streams - 1]= audio_bitstream_filters;
https://github.com/libav/libav/blob/27241cbffe180fc92f9f519c6ea7957fc4b3b0c9/ffmpeg.c/#L3491
d2a_code_trace_data_42862
int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) { PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | (diff > (0 - (PTRDIFF_T)len))); assert(!overlapped); return overlapped; } crypto/evp/bio_enc.c:201: error: INTEGER_OVERFLOW_L2 (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate`. Showing all 9 steps of the trace crypto/evp/bio_enc.c:201:18: Call 199. if (i > ENC_MIN_CHUNK) 200. i = ENC_MIN_CHUNK; 201. if (!EVP_CipherUpdate(ctx->cipher, ^ 202. ctx->buf, &ctx->buf_len, 203. ctx->read_start, i)) { crypto/evp/evp_enc.c:205:1: Parameter `ctx->cipher->block_size` 203. } 204. 205. > int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 206. const unsigned char *in, int inl) 207. { crypto/evp/evp_enc.c:211:16: Call 209. return EVP_EncryptUpdate(ctx, out, outl, in, inl); 210. else 211. return EVP_DecryptUpdate(ctx, out, outl, in, inl); ^ 212. } 213. crypto/evp/evp_enc.c:416:1: Parameter `ctx->cipher->block_size` 414. } 415. 416. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 417. const unsigned char *in, int inl) 418. { crypto/evp/evp_enc.c:422:5: Assignment 420. unsigned int b; 421. 422. b = ctx->cipher->block_size; ^ 423. 424. if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) { crypto/evp/evp_enc.c:452:16: Call 450. /* see comment about PTRDIFF_T comparison above */ 451. if (((PTRDIFF_T)out == (PTRDIFF_T)in) 452. || is_partially_overlapping(out, in, b)) { ^ 453. EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING); 454. return 0; crypto/evp/evp_enc.c:279:1: <RHS trace> 277. #endif 278. 279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 280. { 281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:279:1: Parameter `len` 277. #endif 278. 279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 280. { 281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:288:50: Binary operation: (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate` 286. */ 287. int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | 288. (diff > (0 - (PTRDIFF_T)len))); ^ 289. assert(!overlapped); 290. return overlapped;
https://github.com/openssl/openssl/blob/7141ba31969d0b378d08104a51f8f99b9187b9d5/crypto/evp/evp_enc.c/#L288
d2a_code_trace_data_42863
static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id) { EVP_PKEY_CTX *ret; const EVP_PKEY_METHOD *pmeth; if (id == -1) { if (!pkey || !pkey->ameth) return NULL; id = pkey->ameth->pkey_id; } #ifndef OPENSSL_NO_ENGINE if (pkey && pkey->engine) e = pkey->engine; if (e) { if (!ENGINE_init(e)) { EVPerr(EVP_F_INT_CTX_NEW, ERR_R_ENGINE_LIB); return NULL; } } else e = ENGINE_get_pkey_meth_engine(id); if (e) pmeth = ENGINE_get_pkey_meth(e, id); else #endif pmeth = EVP_PKEY_meth_find(id); if (pmeth == NULL) { EVPerr(EVP_F_INT_CTX_NEW, EVP_R_UNSUPPORTED_ALGORITHM); return NULL; } ret = OPENSSL_zalloc(sizeof(*ret)); if (ret == NULL) { #ifndef OPENSSL_NO_ENGINE ENGINE_finish(e); #endif EVPerr(EVP_F_INT_CTX_NEW, ERR_R_MALLOC_FAILURE); return NULL; } ret->engine = e; ret->pmeth = pmeth; ret->operation = EVP_PKEY_OP_UNDEFINED; ret->pkey = pkey; if (pkey) EVP_PKEY_up_ref(pkey); if (pmeth->init) { if (pmeth->init(ret) <= 0) { EVP_PKEY_CTX_free(ret); return NULL; } } return ret; } crypto/evp/pmeth_lib.c:184: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_zalloc()` at line 167, column 11 is not reachable after line 184, column 13. Showing all 86 steps of the trace crypto/evp/pmeth_lib.c:130:1: start of procedure int_ctx_new() 128. } 129. 130. > static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id) 131. { 132. EVP_PKEY_CTX *ret; crypto/evp/pmeth_lib.c:134:9: Taking true branch 132. EVP_PKEY_CTX *ret; 133. const EVP_PKEY_METHOD *pmeth; 134. if (id == -1) { ^ 135. if (!pkey || !pkey->ameth) 136. return NULL; crypto/evp/pmeth_lib.c:135:14: Taking false branch 133. const EVP_PKEY_METHOD *pmeth; 134. if (id == -1) { 135. if (!pkey || !pkey->ameth) ^ 136. return NULL; 137. id = pkey->ameth->pkey_id; crypto/evp/pmeth_lib.c:135:23: Taking false branch 133. const EVP_PKEY_METHOD *pmeth; 134. if (id == -1) { 135. if (!pkey || !pkey->ameth) ^ 136. return NULL; 137. id = pkey->ameth->pkey_id; crypto/evp/pmeth_lib.c:137:9: 135. if (!pkey || !pkey->ameth) 136. return NULL; 137. > id = pkey->ameth->pkey_id; 138. } 139. #ifndef OPENSSL_NO_ENGINE crypto/evp/pmeth_lib.c:140:9: Taking true branch 138. } 139. #ifndef OPENSSL_NO_ENGINE 140. if (pkey && pkey->engine) ^ 141. e = pkey->engine; 142. /* Try to find an ENGINE which implements this method */ crypto/evp/pmeth_lib.c:140:17: Taking false branch 138. } 139. #ifndef OPENSSL_NO_ENGINE 140. if (pkey && pkey->engine) ^ 141. e = pkey->engine; 142. /* Try to find an ENGINE which implements this method */ crypto/evp/pmeth_lib.c:143:9: Taking false branch 141. e = pkey->engine; 142. /* Try to find an ENGINE which implements this method */ 143. if (e) { ^ 144. if (!ENGINE_init(e)) { 145. EVPerr(EVP_F_INT_CTX_NEW, ERR_R_ENGINE_LIB); crypto/evp/pmeth_lib.c:149:9: 147. } 148. } else 149. > e = ENGINE_get_pkey_meth_engine(id); 150. 151. /* crypto/engine/tb_pkmeth.c:109:1: start of procedure ENGINE_get_pkey_meth_engine() 107. * references) for a given pkey_meth 'nid' 108. */ 109. > ENGINE *ENGINE_get_pkey_meth_engine(int nid) 110. { 111. return engine_table_select(&pkey_meth_table, nid); crypto/engine/tb_pkmeth.c:111:5: 109. ENGINE *ENGINE_get_pkey_meth_engine(int nid) 110. { 111. > return engine_table_select(&pkey_meth_table, nid); 112. } 113. crypto/engine/eng_table.c:233:1: start of procedure engine_table_select() 231. /* return a functional reference for a given 'nid' */ 232. #ifndef ENGINE_TABLE_DEBUG 233. > ENGINE *engine_table_select(ENGINE_TABLE **table, int nid) 234. #else 235. ENGINE *engine_table_select_tmp(ENGINE_TABLE **table, int nid, const char *f, crypto/engine/eng_table.c:239:5: 237. #endif 238. { 239. > ENGINE *ret = NULL; 240. ENGINE_PILE tmplate, *fnd = NULL; 241. int initres, loop = 0; crypto/engine/eng_table.c:240:5: 238. { 239. ENGINE *ret = NULL; 240. > ENGINE_PILE tmplate, *fnd = NULL; 241. int initres, loop = 0; 242. crypto/engine/eng_table.c:241:5: 239. ENGINE *ret = NULL; 240. ENGINE_PILE tmplate, *fnd = NULL; 241. > int initres, loop = 0; 242. 243. if (!(*table)) { crypto/engine/eng_table.c:243:11: 241. int initres, loop = 0; 242. 243. > if (!(*table)) { 244. #ifdef ENGINE_TABLE_DEBUG 245. fprintf(stderr, "engine_table_dbg: %s:%d, nid=%d, nothing " crypto/engine/eng_table.c:243:10: Taking true branch 241. int initres, loop = 0; 242. 243. if (!(*table)) { ^ 244. #ifdef ENGINE_TABLE_DEBUG 245. fprintf(stderr, "engine_table_dbg: %s:%d, nid=%d, nothing " crypto/engine/eng_table.c:248:9: 246. "registered!\n", f, l, nid); 247. #endif 248. > return NULL; 249. } 250. ERR_set_mark(); crypto/engine/eng_table.c:329:1: return from a call to engine_table_select 327. ERR_pop_to_mark(); 328. return ret; 329. > } 330. 331. /* Table enumeration */ crypto/engine/tb_pkmeth.c:112:1: return from a call to ENGINE_get_pkey_meth_engine 110. { 111. return engine_table_select(&pkey_meth_table, nid); 112. > } 113. 114. /* Obtains a pkey_meth implementation from an ENGINE functional reference */ crypto/evp/pmeth_lib.c:156:9: Taking false branch 154. */ 155. 156. if (e) ^ 157. pmeth = ENGINE_get_pkey_meth(e, id); 158. else crypto/evp/pmeth_lib.c:160:9: 158. else 159. #endif 160. > pmeth = EVP_PKEY_meth_find(id); 161. 162. if (pmeth == NULL) { crypto/evp/pmeth_lib.c:111:1: start of procedure EVP_PKEY_meth_find() 109. pmeth); 110. 111. > const EVP_PKEY_METHOD *EVP_PKEY_meth_find(int type) 112. { 113. EVP_PKEY_METHOD tmp; crypto/evp/pmeth_lib.c:114:5: 112. { 113. EVP_PKEY_METHOD tmp; 114. > const EVP_PKEY_METHOD *t = &tmp, **ret; 115. tmp.pkey_id = type; 116. if (app_pkey_methods) { crypto/evp/pmeth_lib.c:115:5: 113. EVP_PKEY_METHOD tmp; 114. const EVP_PKEY_METHOD *t = &tmp, **ret; 115. > tmp.pkey_id = type; 116. if (app_pkey_methods) { 117. int idx; crypto/evp/pmeth_lib.c:116:9: Taking true branch 114. const EVP_PKEY_METHOD *t = &tmp, **ret; 115. tmp.pkey_id = type; 116. if (app_pkey_methods) { ^ 117. int idx; 118. idx = sk_EVP_PKEY_METHOD_find(app_pkey_methods, &tmp); crypto/evp/pmeth_lib.c:118:9: 116. if (app_pkey_methods) { 117. int idx; 118. > idx = sk_EVP_PKEY_METHOD_find(app_pkey_methods, &tmp); 119. if (idx >= 0) 120. return sk_EVP_PKEY_METHOD_value(app_pkey_methods, idx); crypto/include/internal/evp_int.h:122:1: start of procedure sk_EVP_PKEY_METHOD_find() 120. } /* EVP_PKEY_METHOD */ ; 121. 122. > DEFINE_STACK_OF_CONST(EVP_PKEY_METHOD) 123. 124. void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx); crypto/stack/stack.c:248:1: start of procedure sk_find() 246. } 247. 248. > int sk_find(_STACK *st, void *data) 249. { 250. return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH); crypto/stack/stack.c:250:5: 248. int sk_find(_STACK *st, void *data) 249. { 250. > return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH); 251. } 252. crypto/stack/stack.c:224:1: start of procedure internal_find() 222. } 223. 224. > static int internal_find(_STACK *st, void *data, int ret_val_options) 225. { 226. const void *const *r; crypto/stack/stack.c:229:9: Taking false branch 227. int i; 228. 229. if (st == NULL) ^ 230. return -1; 231. crypto/stack/stack.c:232:9: Taking true branch 230. return -1; 231. 232. if (st->comp == NULL) { ^ 233. for (i = 0; i < st->num; i++) 234. if (st->data[i] == data) crypto/stack/stack.c:233:14: 231. 232. if (st->comp == NULL) { 233. > for (i = 0; i < st->num; i++) 234. if (st->data[i] == data) 235. return (i); crypto/stack/stack.c:233:21: Loop condition is true. Entering loop body 231. 232. if (st->comp == NULL) { 233. for (i = 0; i < st->num; i++) ^ 234. if (st->data[i] == data) 235. return (i); crypto/stack/stack.c:234:17: Taking true branch 232. if (st->comp == NULL) { 233. for (i = 0; i < st->num; i++) 234. if (st->data[i] == data) ^ 235. return (i); 236. return (-1); crypto/stack/stack.c:235:17: 233. for (i = 0; i < st->num; i++) 234. if (st->data[i] == data) 235. > return (i); 236. return (-1); 237. } crypto/stack/stack.c:246:1: return from a call to internal_find 244. return (-1); 245. return (int)((char **)r - st->data); 246. > } 247. 248. int sk_find(_STACK *st, void *data) crypto/stack/stack.c:251:1: return from a call to sk_find 249. { 250. return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH); 251. > } 252. 253. int sk_find_ex(_STACK *st, void *data) crypto/include/internal/evp_int.h:122:1: return from a call to sk_EVP_PKEY_METHOD_find 120. } /* EVP_PKEY_METHOD */ ; 121. 122. > DEFINE_STACK_OF_CONST(EVP_PKEY_METHOD) 123. 124. void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx); crypto/evp/pmeth_lib.c:119:13: Taking true branch 117. int idx; 118. idx = sk_EVP_PKEY_METHOD_find(app_pkey_methods, &tmp); 119. if (idx >= 0) ^ 120. return sk_EVP_PKEY_METHOD_value(app_pkey_methods, idx); 121. } crypto/evp/pmeth_lib.c:120:13: 118. idx = sk_EVP_PKEY_METHOD_find(app_pkey_methods, &tmp); 119. if (idx >= 0) 120. > return sk_EVP_PKEY_METHOD_value(app_pkey_methods, idx); 121. } 122. ret = OBJ_bsearch_pmeth(&t, standard_methods, crypto/include/internal/evp_int.h:122:1: start of procedure sk_EVP_PKEY_METHOD_value() 120. } /* EVP_PKEY_METHOD */ ; 121. 122. > DEFINE_STACK_OF_CONST(EVP_PKEY_METHOD) 123. 124. void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx); crypto/stack/stack.c:323:1: start of procedure sk_value() 321. } 322. 323. > void *sk_value(const _STACK *st, int i) 324. { 325. if (!st || (i < 0) || (i >= st->num)) crypto/stack/stack.c:325:10: Taking false branch 323. void *sk_value(const _STACK *st, int i) 324. { 325. if (!st || (i < 0) || (i >= st->num)) ^ 326. return NULL; 327. return st->data[i]; crypto/stack/stack.c:325:17: Taking false branch 323. void *sk_value(const _STACK *st, int i) 324. { 325. if (!st || (i < 0) || (i >= st->num)) ^ 326. return NULL; 327. return st->data[i]; crypto/stack/stack.c:325:28: Taking false branch 323. void *sk_value(const _STACK *st, int i) 324. { 325. if (!st || (i < 0) || (i >= st->num)) ^ 326. return NULL; 327. return st->data[i]; crypto/stack/stack.c:327:5: 325. if (!st || (i < 0) || (i >= st->num)) 326. return NULL; 327. > return st->data[i]; 328. } 329. crypto/stack/stack.c:328:1: return from a call to sk_value 326. return NULL; 327. return st->data[i]; 328. > } 329. 330. void *sk_set(_STACK *st, int i, void *value) crypto/include/internal/evp_int.h:122:1: return from a call to sk_EVP_PKEY_METHOD_value 120. } /* EVP_PKEY_METHOD */ ; 121. 122. > DEFINE_STACK_OF_CONST(EVP_PKEY_METHOD) 123. 124. void evp_pkey_set_cb_translate(BN_GENCB *cb, EVP_PKEY_CTX *ctx); crypto/evp/pmeth_lib.c:128:1: return from a call to EVP_PKEY_meth_find 126. return NULL; 127. return *ret; 128. > } 129. 130. static EVP_PKEY_CTX *int_ctx_new(EVP_PKEY *pkey, ENGINE *e, int id) crypto/evp/pmeth_lib.c:162:9: Taking false branch 160. pmeth = EVP_PKEY_meth_find(id); 161. 162. if (pmeth == NULL) { ^ 163. EVPerr(EVP_F_INT_CTX_NEW, EVP_R_UNSUPPORTED_ALGORITHM); 164. return NULL; crypto/evp/pmeth_lib.c:167:5: 165. } 166. 167. > ret = OPENSSL_zalloc(sizeof(*ret)); 168. if (ret == NULL) { 169. #ifndef OPENSSL_NO_ENGINE crypto/mem.c:146:1: start of procedure CRYPTO_zalloc() 144. } 145. 146. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 147. { 148. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:148:5: 146. void *CRYPTO_zalloc(size_t num, const char *file, int line) 147. { 148. > void *ret = CRYPTO_malloc(num, file, line); 149. 150. if (ret != NULL) crypto/mem.c:119:1: start of procedure CRYPTO_malloc() 117. } 118. 119. > void *CRYPTO_malloc(size_t num, const char *file, int line) 120. { 121. void *ret = NULL; crypto/mem.c:121:5: 119. void *CRYPTO_malloc(size_t num, const char *file, int line) 120. { 121. > void *ret = NULL; 122. 123. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:123:9: Taking false branch 121. void *ret = NULL; 122. 123. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 124. return malloc_impl(num, file, line); 125. crypto/mem.c:126:9: Taking false branch 124. return malloc_impl(num, file, line); 125. 126. if (num <= 0) ^ 127. return NULL; 128. crypto/mem.c:129:5: 127. return NULL; 128. 129. > allow_customize = 0; 130. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 131. if (call_malloc_debug) { crypto/mem.c:139:5: 137. } 138. #else 139. > osslargused(file); osslargused(line); 140. ret = malloc(num); 141. #endif crypto/mem.c:139:24: 137. } 138. #else 139. > osslargused(file); osslargused(line); 140. ret = malloc(num); 141. #endif crypto/mem.c:140:5: 138. #else 139. osslargused(file); osslargused(line); 140. > ret = malloc(num); 141. #endif 142. crypto/mem.c:143:5: 141. #endif 142. 143. > return ret; 144. } 145. crypto/mem.c:144:1: return from a call to CRYPTO_malloc 142. 143. return ret; 144. > } 145. 146. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:150:9: Taking true branch 148. void *ret = CRYPTO_malloc(num, file, line); 149. 150. if (ret != NULL) ^ 151. memset(ret, 0, num); 152. return ret; crypto/mem.c:151:9: 149. 150. if (ret != NULL) 151. > memset(ret, 0, num); 152. return ret; 153. } crypto/mem.c:152:5: 150. if (ret != NULL) 151. memset(ret, 0, num); 152. > return ret; 153. } 154. crypto/mem.c:153:1: return from a call to CRYPTO_zalloc 151. memset(ret, 0, num); 152. return ret; 153. > } 154. 155. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/evp/pmeth_lib.c:168:9: Taking false branch 166. 167. ret = OPENSSL_zalloc(sizeof(*ret)); 168. if (ret == NULL) { ^ 169. #ifndef OPENSSL_NO_ENGINE 170. ENGINE_finish(e); crypto/evp/pmeth_lib.c:175:5: 173. return NULL; 174. } 175. > ret->engine = e; 176. ret->pmeth = pmeth; 177. ret->operation = EVP_PKEY_OP_UNDEFINED; crypto/evp/pmeth_lib.c:176:5: 174. } 175. ret->engine = e; 176. > ret->pmeth = pmeth; 177. ret->operation = EVP_PKEY_OP_UNDEFINED; 178. ret->pkey = pkey; crypto/evp/pmeth_lib.c:177:5: 175. ret->engine = e; 176. ret->pmeth = pmeth; 177. > ret->operation = EVP_PKEY_OP_UNDEFINED; 178. ret->pkey = pkey; 179. if (pkey) crypto/evp/pmeth_lib.c:178:5: 176. ret->pmeth = pmeth; 177. ret->operation = EVP_PKEY_OP_UNDEFINED; 178. > ret->pkey = pkey; 179. if (pkey) 180. EVP_PKEY_up_ref(pkey); crypto/evp/pmeth_lib.c:179:9: Taking true branch 177. ret->operation = EVP_PKEY_OP_UNDEFINED; 178. ret->pkey = pkey; 179. if (pkey) ^ 180. EVP_PKEY_up_ref(pkey); 181. crypto/evp/pmeth_lib.c:180:9: 178. ret->pkey = pkey; 179. if (pkey) 180. > EVP_PKEY_up_ref(pkey); 181. 182. if (pmeth->init) { crypto/evp/p_lib.c:208:1: start of procedure EVP_PKEY_up_ref() 206. } 207. 208. > void EVP_PKEY_up_ref(EVP_PKEY *pkey) 209. { 210. int i; crypto/evp/p_lib.c:211:5: 209. { 210. int i; 211. > CRYPTO_atomic_add(&pkey->references, 1, &i, pkey->lock); 212. } 213. crypto/threads_pthread.c:151:1: start of procedure CRYPTO_atomic_add() 149. } 150. 151. > int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock) 152. { 153. #ifdef __ATOMIC_RELAXED crypto/threads_pthread.c:154:5: 152. { 153. #ifdef __ATOMIC_RELAXED 154. > *ret = __atomic_add_fetch(val, amount, __ATOMIC_RELAXED); 155. #else 156. if (!CRYPTO_THREAD_write_lock(lock)) crypto/threads_pthread.c:166:5: 164. #endif 165. 166. > return 1; 167. } 168. crypto/threads_pthread.c:167:1: return from a call to CRYPTO_atomic_add 165. 166. return 1; 167. > } 168. 169. #endif crypto/evp/p_lib.c:212:1: return from a call to EVP_PKEY_up_ref 210. int i; 211. CRYPTO_atomic_add(&pkey->references, 1, &i, pkey->lock); 212. > } 213. 214. /* crypto/evp/pmeth_lib.c:182:9: Taking true branch 180. EVP_PKEY_up_ref(pkey); 181. 182. if (pmeth->init) { ^ 183. if (pmeth->init(ret) <= 0) { 184. EVP_PKEY_CTX_free(ret); crypto/evp/pmeth_lib.c:183:13: Taking true branch 181. 182. if (pmeth->init) { 183. if (pmeth->init(ret) <= 0) { ^ 184. EVP_PKEY_CTX_free(ret); 185. return NULL; crypto/evp/pmeth_lib.c:184:13: Skipping EVP_PKEY_CTX_free(): empty list of specs 182. if (pmeth->init) { 183. if (pmeth->init(ret) <= 0) { 184. EVP_PKEY_CTX_free(ret); ^ 185. return NULL; 186. }
https://github.com/openssl/openssl/blob/91056e72693b4ee8cb5339d9091871ffc3b6f776/crypto/evp/pmeth_lib.c/#L184
d2a_code_trace_data_42864
static void new_subtitle_stream(AVFormatContext *oc) { AVStream *st; AVCodecContext *subtitle_enc; st = av_new_stream(oc, oc->nb_streams); if (!st) { fprintf(stderr, "Could not alloc stream\n"); av_exit(1); } avcodec_get_context_defaults2(st->codec, CODEC_TYPE_SUBTITLE); bitstream_filters[nb_output_files][oc->nb_streams - 1]= subtitle_bitstream_filters; subtitle_bitstream_filters= NULL; subtitle_enc = st->codec; subtitle_enc->codec_type = CODEC_TYPE_SUBTITLE; if (subtitle_stream_copy) { st->stream_copy = 1; } else { set_context_opts(avctx_opts[CODEC_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM); subtitle_enc->codec_id = find_codec_or_die(subtitle_codec_name, CODEC_TYPE_SUBTITLE, 1); output_codecs[nb_ocodecs] = avcodec_find_encoder_by_name(subtitle_codec_name); } nb_ocodecs++; if (subtitle_language) { av_metadata_set(&st->metadata, "language", subtitle_language); av_free(subtitle_language); subtitle_language = NULL; } subtitle_disable = 0; av_freep(&subtitle_codec_name); subtitle_stream_copy = 0; } ffmpeg.c:3187: error: Null Dereference pointer `st` last assigned on line 3182 could be null and is dereferenced at line 3187, column 35. ffmpeg.c:3177:1: start of procedure new_subtitle_stream() 3175. } 3176. 3177. static void new_subtitle_stream(AVFormatContext *oc) ^ 3178. { 3179. AVStream *st; ffmpeg.c:3182:5: 3180. AVCodecContext *subtitle_enc; 3181. 3182. st = av_new_stream(oc, oc->nb_streams); ^ 3183. if (!st) { 3184. fprintf(stderr, "Could not alloc stream\n"); libavformat/utils.c:2344:1: start of procedure av_new_stream() 2342. } 2343. 2344. AVStream *av_new_stream(AVFormatContext *s, int id) ^ 2345. { 2346. AVStream *st; libavformat/utils.c:2349:9: Taking true branch 2347. int i; 2348. 2349. if (s->nb_streams >= MAX_STREAMS) ^ 2350. return NULL; 2351. libavformat/utils.c:2350:9: 2348. 2349. if (s->nb_streams >= MAX_STREAMS) 2350. return NULL; ^ 2351. 2352. st = av_mallocz(sizeof(AVStream)); libavformat/utils.c:2383:1: return from a call to av_new_stream 2381. s->streams[s->nb_streams++] = st; 2382. return st; 2383. } ^ 2384. 2385. AVProgram *av_new_program(AVFormatContext *ac, int id) ffmpeg.c:3183:10: Taking true branch 3181. 3182. st = av_new_stream(oc, oc->nb_streams); 3183. if (!st) { ^ 3184. fprintf(stderr, "Could not alloc stream\n"); 3185. av_exit(1); ffmpeg.c:3184:9: 3182. st = av_new_stream(oc, oc->nb_streams); 3183. if (!st) { 3184. fprintf(stderr, "Could not alloc stream\n"); ^ 3185. av_exit(1); 3186. } ffmpeg.c:3185:9: Skipping av_exit(): empty list of specs 3183. if (!st) { 3184. fprintf(stderr, "Could not alloc stream\n"); 3185. av_exit(1); ^ 3186. } 3187. avcodec_get_context_defaults2(st->codec, CODEC_TYPE_SUBTITLE); ffmpeg.c:3187:5: 3185. av_exit(1); 3186. } 3187. avcodec_get_context_defaults2(st->codec, CODEC_TYPE_SUBTITLE); ^ 3188. 3189. bitstream_filters[nb_output_files][oc->nb_streams - 1]= subtitle_bitstream_filters;
https://github.com/libav/libav/blob/9aaa2077e5879b153d2ce6bea2e42f0c349a083f/ffmpeg.c/#L3187
d2a_code_trace_data_42865
static inline void pred_direct_motion(H264Context * const h, int *mb_type){ MpegEncContext * const s = &h->s; const int mb_xy = s->mb_x + s->mb_y*s->mb_stride; const int b8_xy = 2*s->mb_x + 2*s->mb_y*h->b8_stride; const int b4_xy = 4*s->mb_x + 4*s->mb_y*h->b_stride; const int mb_type_col = h->ref_list[1][0].mb_type[mb_xy]; const int16_t (*l1mv0)[2] = (const int16_t (*)[2]) &h->ref_list[1][0].motion_val[0][b4_xy]; const int16_t (*l1mv1)[2] = (const int16_t (*)[2]) &h->ref_list[1][0].motion_val[1][b4_xy]; const int8_t *l1ref0 = &h->ref_list[1][0].ref_index[0][b8_xy]; const int8_t *l1ref1 = &h->ref_list[1][0].ref_index[1][b8_xy]; const int is_b8x8 = IS_8X8(*mb_type); unsigned int sub_mb_type; int i8, i4; #define MB_TYPE_16x16_OR_INTRA (MB_TYPE_16x16|MB_TYPE_INTRA4x4|MB_TYPE_INTRA16x16|MB_TYPE_INTRA_PCM) if(IS_8X8(mb_type_col) && !h->sps.direct_8x8_inference_flag){ sub_mb_type = MB_TYPE_8x8|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; *mb_type = MB_TYPE_8x8|MB_TYPE_L0L1; }else if(!is_b8x8 && (mb_type_col & MB_TYPE_16x16_OR_INTRA)){ sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; *mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; }else{ sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; *mb_type = MB_TYPE_8x8|MB_TYPE_L0L1; } if(!is_b8x8) *mb_type |= MB_TYPE_DIRECT2; if(MB_FIELD) *mb_type |= MB_TYPE_INTERLACED; tprintf(s->avctx, "mb_type = %08x, sub_mb_type = %08x, is_b8x8 = %d, mb_type_col = %08x\n", *mb_type, sub_mb_type, is_b8x8, mb_type_col); if(h->direct_spatial_mv_pred){ int ref[2]; int mv[2][2]; int list; for(list=0; list<2; list++){ int refa = h->ref_cache[list][scan8[0] - 1]; int refb = h->ref_cache[list][scan8[0] - 8]; int refc = h->ref_cache[list][scan8[0] - 8 + 4]; if(refc == -2) refc = h->ref_cache[list][scan8[0] - 8 - 1]; ref[list] = refa; if(ref[list] < 0 || (refb < ref[list] && refb >= 0)) ref[list] = refb; if(ref[list] < 0 || (refc < ref[list] && refc >= 0)) ref[list] = refc; if(ref[list] < 0) ref[list] = -1; } if(ref[0] < 0 && ref[1] < 0){ ref[0] = ref[1] = 0; mv[0][0] = mv[0][1] = mv[1][0] = mv[1][1] = 0; }else{ for(list=0; list<2; list++){ if(ref[list] >= 0) pred_motion(h, 0, 4, list, ref[list], &mv[list][0], &mv[list][1]); else mv[list][0] = mv[list][1] = 0; } } if(ref[1] < 0){ if(!is_b8x8) *mb_type &= ~MB_TYPE_L1; sub_mb_type &= ~MB_TYPE_L1; }else if(ref[0] < 0){ if(!is_b8x8) *mb_type &= ~MB_TYPE_L0; sub_mb_type &= ~MB_TYPE_L0; } if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col)){ int pair_xy = s->mb_x + (s->mb_y&~1)*s->mb_stride; int mb_types_col[2]; int b8_stride = h->b8_stride; int b4_stride = h->b_stride; *mb_type = (*mb_type & ~MB_TYPE_16x16) | MB_TYPE_8x8; if(IS_INTERLACED(*mb_type)){ mb_types_col[0] = h->ref_list[1][0].mb_type[pair_xy]; mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy+s->mb_stride]; if(s->mb_y&1){ l1ref0 -= 2*b8_stride; l1ref1 -= 2*b8_stride; l1mv0 -= 4*b4_stride; l1mv1 -= 4*b4_stride; } b8_stride *= 3; b4_stride *= 6; }else{ int cur_poc = s->current_picture_ptr->poc; int *col_poc = h->ref_list[1]->field_poc; int col_parity = FFABS(col_poc[0] - cur_poc) >= FFABS(col_poc[1] - cur_poc); int dy = 2*col_parity - (s->mb_y&1); mb_types_col[0] = mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy + col_parity*s->mb_stride]; l1ref0 += dy*b8_stride; l1ref1 += dy*b8_stride; l1mv0 += 2*dy*b4_stride; l1mv1 += 2*dy*b4_stride; b8_stride = 0; } for(i8=0; i8<4; i8++){ int x8 = i8&1; int y8 = i8>>1; int xy8 = x8+y8*b8_stride; int xy4 = 3*x8+y8*b4_stride; int a=0, b=0; if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) continue; h->sub_mb_type[i8] = sub_mb_type; fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1); fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1); if(!IS_INTRA(mb_types_col[y8]) && ( (l1ref0[xy8] == 0 && FFABS(l1mv0[xy4][0]) <= 1 && FFABS(l1mv0[xy4][1]) <= 1) || (l1ref0[xy8] < 0 && l1ref1[xy8] == 0 && FFABS(l1mv1[xy4][0]) <= 1 && FFABS(l1mv1[xy4][1]) <= 1))){ if(ref[0] > 0) a= pack16to32(mv[0][0],mv[0][1]); if(ref[1] > 0) b= pack16to32(mv[1][0],mv[1][1]); }else{ a= pack16to32(mv[0][0],mv[0][1]); b= pack16to32(mv[1][0],mv[1][1]); } fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, a, 4); fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, b, 4); } }else if(IS_16X16(*mb_type)){ int a=0, b=0; fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, (uint8_t)ref[0], 1); fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, (uint8_t)ref[1], 1); if(!IS_INTRA(mb_type_col) && ( (l1ref0[0] == 0 && FFABS(l1mv0[0][0]) <= 1 && FFABS(l1mv0[0][1]) <= 1) || (l1ref0[0] < 0 && l1ref1[0] == 0 && FFABS(l1mv1[0][0]) <= 1 && FFABS(l1mv1[0][1]) <= 1 && (h->x264_build>33 || !h->x264_build)))){ if(ref[0] > 0) a= pack16to32(mv[0][0],mv[0][1]); if(ref[1] > 0) b= pack16to32(mv[1][0],mv[1][1]); }else{ a= pack16to32(mv[0][0],mv[0][1]); b= pack16to32(mv[1][0],mv[1][1]); } fill_rectangle(&h->mv_cache[0][scan8[0]], 4, 4, 8, a, 4); fill_rectangle(&h->mv_cache[1][scan8[0]], 4, 4, 8, b, 4); }else{ for(i8=0; i8<4; i8++){ const int x8 = i8&1; const int y8 = i8>>1; if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) continue; h->sub_mb_type[i8] = sub_mb_type; fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mv[0][0],mv[0][1]), 4); fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mv[1][0],mv[1][1]), 4); fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1); fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1); if(!IS_INTRA(mb_type_col) && ( l1ref0[x8 + y8*h->b8_stride] == 0 || (l1ref0[x8 + y8*h->b8_stride] < 0 && l1ref1[x8 + y8*h->b8_stride] == 0 && (h->x264_build>33 || !h->x264_build)))){ const int16_t (*l1mv)[2]= l1ref0[x8 + y8*h->b8_stride] == 0 ? l1mv0 : l1mv1; if(IS_SUB_8X8(sub_mb_type)){ const int16_t *mv_col = l1mv[x8*3 + y8*3*h->b_stride]; if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){ if(ref[0] == 0) fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4); if(ref[1] == 0) fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4); } }else for(i4=0; i4<4; i4++){ const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*h->b_stride]; if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){ if(ref[0] == 0) *(uint32_t*)h->mv_cache[0][scan8[i8*4+i4]] = 0; if(ref[1] == 0) *(uint32_t*)h->mv_cache[1][scan8[i8*4+i4]] = 0; } } } } } }else{ const int *map_col_to_list0[2] = {h->map_col_to_list0[0], h->map_col_to_list0[1]}; const int *dist_scale_factor = h->dist_scale_factor; if(FRAME_MBAFF){ if(IS_INTERLACED(*mb_type)){ map_col_to_list0[0] = h->map_col_to_list0_field[0]; map_col_to_list0[1] = h->map_col_to_list0_field[1]; dist_scale_factor = h->dist_scale_factor_field; } if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col)){ const int pair_xy = s->mb_x + (s->mb_y&~1)*s->mb_stride; int mb_types_col[2]; int y_shift; *mb_type = MB_TYPE_8x8|MB_TYPE_L0L1 | (is_b8x8 ? 0 : MB_TYPE_DIRECT2) | (*mb_type & MB_TYPE_INTERLACED); sub_mb_type = MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2|MB_TYPE_16x16; if(IS_INTERLACED(*mb_type)){ mb_types_col[0] = h->ref_list[1][0].mb_type[pair_xy]; mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy+s->mb_stride]; if(s->mb_y&1){ l1ref0 -= 2*h->b8_stride; l1ref1 -= 2*h->b8_stride; l1mv0 -= 4*h->b_stride; l1mv1 -= 4*h->b_stride; } y_shift = 0; if( (mb_types_col[0] & MB_TYPE_16x16_OR_INTRA) && (mb_types_col[1] & MB_TYPE_16x16_OR_INTRA) && !is_b8x8) *mb_type |= MB_TYPE_16x8; else *mb_type |= MB_TYPE_8x8; }else{ int dy = (s->mb_y&1) ? 1 : 2; mb_types_col[0] = mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy+s->mb_stride]; l1ref0 += dy*h->b8_stride; l1ref1 += dy*h->b8_stride; l1mv0 += 2*dy*h->b_stride; l1mv1 += 2*dy*h->b_stride; y_shift = 2; if((mb_types_col[0] & (MB_TYPE_16x16_OR_INTRA|MB_TYPE_16x8)) && !is_b8x8) *mb_type |= MB_TYPE_16x16; else *mb_type |= MB_TYPE_8x8; } for(i8=0; i8<4; i8++){ const int x8 = i8&1; const int y8 = i8>>1; int ref0, scale; const int16_t (*l1mv)[2]= l1mv0; if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) continue; h->sub_mb_type[i8] = sub_mb_type; fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, 0, 1); if(IS_INTRA(mb_types_col[y8])){ fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, 0, 1); fill_rectangle(&h-> mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4); fill_rectangle(&h-> mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4); continue; } ref0 = l1ref0[x8 + (y8*2>>y_shift)*h->b8_stride]; if(ref0 >= 0) ref0 = map_col_to_list0[0][ref0*2>>y_shift]; else{ ref0 = map_col_to_list0[1][l1ref1[x8 + (y8*2>>y_shift)*h->b8_stride]*2>>y_shift]; l1mv= l1mv1; } scale = dist_scale_factor[ref0]; fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1); { const int16_t *mv_col = l1mv[x8*3 + (y8*6>>y_shift)*h->b_stride]; int my_col = (mv_col[1]<<y_shift)/2; int mx = (scale * mv_col[0] + 128) >> 8; int my = (scale * my_col + 128) >> 8; fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mx,my), 4); fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mx-mv_col[0],my-my_col), 4); } } return; } } if(IS_16X16(*mb_type)){ int ref, mv0, mv1; fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, 0, 1); if(IS_INTRA(mb_type_col)){ ref=mv0=mv1=0; }else{ const int ref0 = l1ref0[0] >= 0 ? map_col_to_list0[0][l1ref0[0]] : map_col_to_list0[1][l1ref1[0]]; const int scale = dist_scale_factor[ref0]; const int16_t *mv_col = l1ref0[0] >= 0 ? l1mv0[0] : l1mv1[0]; int mv_l0[2]; mv_l0[0] = (scale * mv_col[0] + 128) >> 8; mv_l0[1] = (scale * mv_col[1] + 128) >> 8; ref= ref0; mv0= pack16to32(mv_l0[0],mv_l0[1]); mv1= pack16to32(mv_l0[0]-mv_col[0],mv_l0[1]-mv_col[1]); } fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, ref, 1); fill_rectangle(&h-> mv_cache[0][scan8[0]], 4, 4, 8, mv0, 4); fill_rectangle(&h-> mv_cache[1][scan8[0]], 4, 4, 8, mv1, 4); }else{ for(i8=0; i8<4; i8++){ const int x8 = i8&1; const int y8 = i8>>1; int ref0, scale; const int16_t (*l1mv)[2]= l1mv0; if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) continue; h->sub_mb_type[i8] = sub_mb_type; fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, 0, 1); if(IS_INTRA(mb_type_col)){ fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, 0, 1); fill_rectangle(&h-> mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4); fill_rectangle(&h-> mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4); continue; } ref0 = l1ref0[x8 + y8*h->b8_stride]; if(ref0 >= 0) ref0 = map_col_to_list0[0][ref0]; else{ ref0 = map_col_to_list0[1][l1ref1[x8 + y8*h->b8_stride]]; l1mv= l1mv1; } scale = dist_scale_factor[ref0]; fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1); if(IS_SUB_8X8(sub_mb_type)){ const int16_t *mv_col = l1mv[x8*3 + y8*3*h->b_stride]; int mx = (scale * mv_col[0] + 128) >> 8; int my = (scale * mv_col[1] + 128) >> 8; fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mx,my), 4); fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mx-mv_col[0],my-mv_col[1]), 4); }else for(i4=0; i4<4; i4++){ const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*h->b_stride]; int16_t *mv_l0 = h->mv_cache[0][scan8[i8*4+i4]]; mv_l0[0] = (scale * mv_col[0] + 128) >> 8; mv_l0[1] = (scale * mv_col[1] + 128) >> 8; *(uint32_t*)h->mv_cache[1][scan8[i8*4+i4]] = pack16to32(mv_l0[0]-mv_col[0],mv_l0[1]-mv_col[1]); } } } } } libavcodec/h264.c:1098: error: Uninitialized Value The value read from ref[_] was never initialized. libavcodec/h264.c:1098:13: 1096. int a=0, b=0; 1097. 1098. fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, (uint8_t)ref[0], 1); ^ 1099. fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, (uint8_t)ref[1], 1); 1100. if(!IS_INTRA(mb_type_col)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L1098
d2a_code_trace_data_42866
static int eckey_param2type(int *pptype, void **ppval, EC_KEY *ec_key) { const EC_GROUP *group; int nid; if (ec_key == NULL || (group = EC_KEY_get0_group(ec_key)) == NULL) { ECerr(EC_F_ECKEY_PARAM2TYPE, EC_R_MISSING_PARAMETERS); return 0; } if (EC_GROUP_get_asn1_flag(group) && (nid = EC_GROUP_get_curve_name(group))) { *ppval = OBJ_nid2obj(nid); *pptype = V_ASN1_OBJECT; } else { ASN1_STRING *pstr = NULL; pstr = ASN1_STRING_new(); if (pstr == NULL) return 0; pstr->length = i2d_ECParameters(ec_key, &pstr->data); if (pstr->length <= 0) { ASN1_STRING_free(pstr); ECerr(EC_F_ECKEY_PARAM2TYPE, ERR_R_EC_LIB); return 0; } *ppval = pstr; *pptype = V_ASN1_SEQUENCE; } return 1; } crypto/ec/ec_ameth.c:97: error: MEMORY_LEAK memory dynamically allocated by call to `ASN1_STRING_new()` at line 92, column 16 is not reachable after line 97, column 13. Showing all 76 steps of the trace crypto/ec/ec_ameth.c:75:1: start of procedure eckey_param2type() 73. #endif 74. 75. > static int eckey_param2type(int *pptype, void **ppval, EC_KEY *ec_key) 76. { 77. const EC_GROUP *group; crypto/ec/ec_ameth.c:79:9: Taking false branch 77. const EC_GROUP *group; 78. int nid; 79. if (ec_key == NULL || (group = EC_KEY_get0_group(ec_key)) == NULL) { ^ 80. ECerr(EC_F_ECKEY_PARAM2TYPE, EC_R_MISSING_PARAMETERS); 81. return 0; crypto/ec/ec_ameth.c:79:27: 77. const EC_GROUP *group; 78. int nid; 79. > if (ec_key == NULL || (group = EC_KEY_get0_group(ec_key)) == NULL) { 80. ECerr(EC_F_ECKEY_PARAM2TYPE, EC_R_MISSING_PARAMETERS); 81. return 0; crypto/ec/ec_key.c:450:1: start of procedure EC_KEY_get0_group() 448. } 449. 450. > const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key) 451. { 452. return key->group; crypto/ec/ec_key.c:452:5: 450. const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key) 451. { 452. > return key->group; 453. } 454. crypto/ec/ec_key.c:453:1: return from a call to EC_KEY_get0_group 451. { 452. return key->group; 453. > } 454. 455. int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group) crypto/ec/ec_ameth.c:79:27: Taking false branch 77. const EC_GROUP *group; 78. int nid; 79. if (ec_key == NULL || (group = EC_KEY_get0_group(ec_key)) == NULL) { ^ 80. ECerr(EC_F_ECKEY_PARAM2TYPE, EC_R_MISSING_PARAMETERS); 81. return 0; crypto/ec/ec_ameth.c:83:9: 81. return 0; 82. } 83. > if (EC_GROUP_get_asn1_flag(group) 84. && (nid = EC_GROUP_get_curve_name(group))) 85. /* we have a 'named curve' => just set the OID */ crypto/ec/ec_lib.c:345:1: start of procedure EC_GROUP_get_asn1_flag() 343. } 344. 345. > int EC_GROUP_get_asn1_flag(const EC_GROUP *group) 346. { 347. return group->asn1_flag; crypto/ec/ec_lib.c:347:5: 345. int EC_GROUP_get_asn1_flag(const EC_GROUP *group) 346. { 347. > return group->asn1_flag; 348. } 349. crypto/ec/ec_lib.c:348:1: return from a call to EC_GROUP_get_asn1_flag 346. { 347. return group->asn1_flag; 348. > } 349. 350. void EC_GROUP_set_point_conversion_form(EC_GROUP *group, crypto/ec/ec_ameth.c:83:9: Taking false branch 81. return 0; 82. } 83. if (EC_GROUP_get_asn1_flag(group) ^ 84. && (nid = EC_GROUP_get_curve_name(group))) 85. /* we have a 'named curve' => just set the OID */ crypto/ec/ec_ameth.c:91:9: 89. } else { /* explicit parameters */ 90. 91. > ASN1_STRING *pstr = NULL; 92. pstr = ASN1_STRING_new(); 93. if (pstr == NULL) crypto/ec/ec_ameth.c:92:9: 90. 91. ASN1_STRING *pstr = NULL; 92. > pstr = ASN1_STRING_new(); 93. if (pstr == NULL) 94. return 0; crypto/asn1/asn1_lib.c:344:1: start of procedure ASN1_STRING_new() 342. } 343. 344. > ASN1_STRING *ASN1_STRING_new(void) 345. { 346. return (ASN1_STRING_type_new(V_ASN1_OCTET_STRING)); crypto/asn1/asn1_lib.c:346:5: 344. ASN1_STRING *ASN1_STRING_new(void) 345. { 346. > return (ASN1_STRING_type_new(V_ASN1_OCTET_STRING)); 347. } 348. crypto/asn1/asn1_lib.c:349:1: start of procedure ASN1_STRING_type_new() 347. } 348. 349. > ASN1_STRING *ASN1_STRING_type_new(int type) 350. { 351. ASN1_STRING *ret; crypto/asn1/asn1_lib.c:353:5: 351. ASN1_STRING *ret; 352. 353. > ret = OPENSSL_zalloc(sizeof(*ret)); 354. if (ret == NULL) { 355. ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/asn1/asn1_lib.c:354:9: Taking false branch 352. 353. ret = OPENSSL_zalloc(sizeof(*ret)); 354. if (ret == NULL) { ^ 355. ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE); 356. return (NULL); crypto/asn1/asn1_lib.c:358:5: 356. return (NULL); 357. } 358. > ret->type = type; 359. return (ret); 360. } crypto/asn1/asn1_lib.c:359:5: 357. } 358. ret->type = type; 359. > return (ret); 360. } 361. crypto/asn1/asn1_lib.c:360:1: return from a call to ASN1_STRING_type_new 358. ret->type = type; 359. return (ret); 360. > } 361. 362. void ASN1_STRING_free(ASN1_STRING *a) crypto/asn1/asn1_lib.c:347:1: return from a call to ASN1_STRING_new 345. { 346. return (ASN1_STRING_type_new(V_ASN1_OCTET_STRING)); 347. > } 348. 349. ASN1_STRING *ASN1_STRING_type_new(int type) crypto/ec/ec_ameth.c:93:13: Taking false branch 91. ASN1_STRING *pstr = NULL; 92. pstr = ASN1_STRING_new(); 93. if (pstr == NULL) ^ 94. return 0; 95. pstr->length = i2d_ECParameters(ec_key, &pstr->data); crypto/ec/ec_ameth.c:95:9: 93. if (pstr == NULL) 94. return 0; 95. > pstr->length = i2d_ECParameters(ec_key, &pstr->data); 96. if (pstr->length <= 0) { 97. ASN1_STRING_free(pstr); crypto/ec/ec_asn1.c:1194:1: start of procedure i2d_ECParameters() 1192. } 1193. 1194. > int i2d_ECParameters(EC_KEY *a, unsigned char **out) 1195. { 1196. if (a == NULL) { crypto/ec/ec_asn1.c:1196:9: Taking false branch 1194. int i2d_ECParameters(EC_KEY *a, unsigned char **out) 1195. { 1196. if (a == NULL) { ^ 1197. ECerr(EC_F_I2D_ECPARAMETERS, ERR_R_PASSED_NULL_PARAMETER); 1198. return 0; crypto/ec/ec_asn1.c:1200:5: 1198. return 0; 1199. } 1200. > return i2d_ECPKParameters(a->group, out); 1201. } 1202. crypto/ec/ec_asn1.c:970:1: start of procedure i2d_ECPKParameters() 968. } 969. 970. > int i2d_ECPKParameters(const EC_GROUP *a, unsigned char **out) 971. { 972. int ret = 0; crypto/ec/ec_asn1.c:972:5: 970. int i2d_ECPKParameters(const EC_GROUP *a, unsigned char **out) 971. { 972. > int ret = 0; 973. ECPKPARAMETERS *tmp = ec_asn1_group2pkparameters(a, NULL); 974. if (tmp == NULL) { crypto/ec/ec_asn1.c:973:5: Skipping ec_asn1_group2pkparameters(): empty list of specs 971. { 972. int ret = 0; 973. ECPKPARAMETERS *tmp = ec_asn1_group2pkparameters(a, NULL); ^ 974. if (tmp == NULL) { 975. ECerr(EC_F_I2D_ECPKPARAMETERS, EC_R_GROUP2PKPARAMETERS_FAILURE); crypto/ec/ec_asn1.c:974:9: Taking false branch 972. int ret = 0; 973. ECPKPARAMETERS *tmp = ec_asn1_group2pkparameters(a, NULL); 974. if (tmp == NULL) { ^ 975. ECerr(EC_F_I2D_ECPKPARAMETERS, EC_R_GROUP2PKPARAMETERS_FAILURE); 976. return 0; crypto/ec/ec_asn1.c:978:9: 976. return 0; 977. } 978. > if ((ret = i2d_ECPKPARAMETERS(tmp, out)) == 0) { 979. ECerr(EC_F_I2D_ECPKPARAMETERS, EC_R_I2D_ECPKPARAMETERS_FAILURE); 980. ECPKPARAMETERS_free(tmp); crypto/ec/ec_asn1.c:267:1: start of procedure i2d_ECPKPARAMETERS() 265. DECLARE_ASN1_FUNCTIONS_const(ECPKPARAMETERS) 266. DECLARE_ASN1_ENCODE_FUNCTIONS_const(ECPKPARAMETERS, ECPKPARAMETERS) 267. > IMPLEMENT_ASN1_FUNCTIONS_const(ECPKPARAMETERS) 268. 269. ASN1_SEQUENCE(EC_PRIVATEKEY) = { crypto/asn1/tasn_enc.c:92:1: start of procedure ASN1_item_i2d() 90. } 91. 92. > int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it) 93. { 94. return asn1_item_flags_i2d(val, out, it, 0); crypto/asn1/tasn_enc.c:94:5: 92. int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it) 93. { 94. > return asn1_item_flags_i2d(val, out, it, 0); 95. } 96. crypto/asn1/tasn_enc.c:104:1: start of procedure asn1_item_flags_i2d() 102. */ 103. 104. > static int asn1_item_flags_i2d(ASN1_VALUE *val, unsigned char **out, 105. const ASN1_ITEM *it, int flags) 106. { crypto/asn1/tasn_enc.c:107:9: Taking true branch 105. const ASN1_ITEM *it, int flags) 106. { 107. if (out && !*out) { ^ 108. unsigned char *p, *buf; 109. int len; crypto/asn1/tasn_enc.c:107:17: Taking false branch 105. const ASN1_ITEM *it, int flags) 106. { 107. if (out && !*out) { ^ 108. unsigned char *p, *buf; 109. int len; crypto/asn1/tasn_enc.c:122:5: Skipping ASN1_item_ex_i2d(): empty list of specs 120. } 121. 122. return ASN1_item_ex_i2d(&val, out, it, -1, flags); ^ 123. } 124. crypto/asn1/tasn_enc.c:123:1: return from a call to asn1_item_flags_i2d 121. 122. return ASN1_item_ex_i2d(&val, out, it, -1, flags); 123. > } 124. 125. /* crypto/asn1/tasn_enc.c:95:1: return from a call to ASN1_item_i2d 93. { 94. return asn1_item_flags_i2d(val, out, it, 0); 95. > } 96. 97. /* crypto/ec/ec_asn1.c:267:1: return from a call to i2d_ECPKPARAMETERS 265. DECLARE_ASN1_FUNCTIONS_const(ECPKPARAMETERS) 266. DECLARE_ASN1_ENCODE_FUNCTIONS_const(ECPKPARAMETERS, ECPKPARAMETERS) 267. > IMPLEMENT_ASN1_FUNCTIONS_const(ECPKPARAMETERS) 268. 269. ASN1_SEQUENCE(EC_PRIVATEKEY) = { crypto/ec/ec_asn1.c:978:9: Taking false branch 976. return 0; 977. } 978. if ((ret = i2d_ECPKPARAMETERS(tmp, out)) == 0) { ^ 979. ECerr(EC_F_I2D_ECPKPARAMETERS, EC_R_I2D_ECPKPARAMETERS_FAILURE); 980. ECPKPARAMETERS_free(tmp); crypto/ec/ec_asn1.c:983:5: 981. return 0; 982. } 983. > ECPKPARAMETERS_free(tmp); 984. return (ret); 985. } crypto/ec/ec_asn1.c:267:1: start of procedure ECPKPARAMETERS_free() 265. DECLARE_ASN1_FUNCTIONS_const(ECPKPARAMETERS) 266. DECLARE_ASN1_ENCODE_FUNCTIONS_const(ECPKPARAMETERS, ECPKPARAMETERS) 267. > IMPLEMENT_ASN1_FUNCTIONS_const(ECPKPARAMETERS) 268. 269. ASN1_SEQUENCE(EC_PRIVATEKEY) = { crypto/asn1/tasn_fre.c:71:1: start of procedure ASN1_item_free() 69. /* Free up an ASN1 structure */ 70. 71. > void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it) 72. { 73. asn1_item_embed_free(&val, it, 0); crypto/asn1/tasn_fre.c:73:5: Skipping asn1_item_embed_free(): empty list of specs 71. void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it) 72. { 73. asn1_item_embed_free(&val, it, 0); ^ 74. } 75. crypto/asn1/tasn_fre.c:74:1: return from a call to ASN1_item_free 72. { 73. asn1_item_embed_free(&val, it, 0); 74. > } 75. 76. void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it) crypto/ec/ec_asn1.c:267:1: return from a call to ECPKPARAMETERS_free 265. DECLARE_ASN1_FUNCTIONS_const(ECPKPARAMETERS) 266. DECLARE_ASN1_ENCODE_FUNCTIONS_const(ECPKPARAMETERS, ECPKPARAMETERS) 267. > IMPLEMENT_ASN1_FUNCTIONS_const(ECPKPARAMETERS) 268. 269. ASN1_SEQUENCE(EC_PRIVATEKEY) = { crypto/ec/ec_asn1.c:984:5: 982. } 983. ECPKPARAMETERS_free(tmp); 984. > return (ret); 985. } 986. crypto/ec/ec_asn1.c:985:1: return from a call to i2d_ECPKParameters 983. ECPKPARAMETERS_free(tmp); 984. return (ret); 985. > } 986. 987. /* some EC_KEY functions */ crypto/ec/ec_asn1.c:1201:1: return from a call to i2d_ECParameters 1199. } 1200. return i2d_ECPKParameters(a->group, out); 1201. > } 1202. 1203. EC_KEY *d2i_ECParameters(EC_KEY **a, const unsigned char **in, long len) crypto/ec/ec_ameth.c:96:13: Taking true branch 94. return 0; 95. pstr->length = i2d_ECParameters(ec_key, &pstr->data); 96. if (pstr->length <= 0) { ^ 97. ASN1_STRING_free(pstr); 98. ECerr(EC_F_ECKEY_PARAM2TYPE, ERR_R_EC_LIB); crypto/ec/ec_ameth.c:97:13: 95. pstr->length = i2d_ECParameters(ec_key, &pstr->data); 96. if (pstr->length <= 0) { 97. > ASN1_STRING_free(pstr); 98. ECerr(EC_F_ECKEY_PARAM2TYPE, ERR_R_EC_LIB); 99. return 0; crypto/asn1/asn1_lib.c:362:1: start of procedure ASN1_STRING_free() 360. } 361. 362. > void ASN1_STRING_free(ASN1_STRING *a) 363. { 364. if (a == NULL) crypto/asn1/asn1_lib.c:364:9: Taking false branch 362. void ASN1_STRING_free(ASN1_STRING *a) 363. { 364. if (a == NULL) ^ 365. return; 366. if (!(a->flags & ASN1_STRING_FLAG_NDEF)) crypto/asn1/asn1_lib.c:366:11: Taking false branch 364. if (a == NULL) 365. return; 366. if (!(a->flags & ASN1_STRING_FLAG_NDEF)) ^ 367. OPENSSL_free(a->data); 368. if (!(a->flags & ASN1_STRING_FLAG_EMBED)) crypto/asn1/asn1_lib.c:368:11: Taking false branch 366. if (!(a->flags & ASN1_STRING_FLAG_NDEF)) 367. OPENSSL_free(a->data); 368. if (!(a->flags & ASN1_STRING_FLAG_EMBED)) ^ 369. OPENSSL_free(a); 370. } crypto/asn1/asn1_lib.c:368:5: 366. if (!(a->flags & ASN1_STRING_FLAG_NDEF)) 367. OPENSSL_free(a->data); 368. > if (!(a->flags & ASN1_STRING_FLAG_EMBED)) 369. OPENSSL_free(a); 370. } crypto/asn1/asn1_lib.c:370:1: return from a call to ASN1_STRING_free 368. if (!(a->flags & ASN1_STRING_FLAG_EMBED)) 369. OPENSSL_free(a); 370. > } 371. 372. void ASN1_STRING_clear_free(ASN1_STRING *a)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/ec/ec_ameth.c/#L97
d2a_code_trace_data_42867
static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont) { BIGNUM *n; BN_ULONG *ap, *np, *rp, n0, v, carry; int nl, max, i; n = &(mont->N); nl = n->top; if (nl == 0) { ret->top = 0; return (1); } max = (2 * nl); if (bn_wexpand(r, max) == NULL) return (0); r->neg ^= n->neg; np = n->d; rp = r->d; i = max - r->top; if (i) memset(&rp[r->top], 0, sizeof(*rp) * i); r->top = max; n0 = mont->n0[0]; for (carry = 0, i = 0; i < nl; i++, rp++) { v = bn_mul_add_words(rp, np, nl, (rp[0] * n0) & BN_MASK2); v = (v + carry + rp[nl]) & BN_MASK2; carry |= (v != rp[nl]); carry &= (v <= rp[nl]); rp[nl] = v; } if (bn_wexpand(ret, nl) == NULL) return (0); ret->top = nl; ret->neg = r->neg; rp = ret->d; ap = &(r->d[nl]); # define BRANCH_FREE 1 # if BRANCH_FREE { BN_ULONG *nrp; size_t m; v = bn_sub_words(rp, ap, np, nl) - carry; m = (0 - (size_t)v); nrp = (BN_ULONG *)(((PTR_SIZE_INT) rp & ~m) | ((PTR_SIZE_INT) ap & m)); for (i = 0, nl -= 4; i < nl; i += 4) { BN_ULONG t1, t2, t3, t4; t1 = nrp[i + 0]; t2 = nrp[i + 1]; t3 = nrp[i + 2]; ap[i + 0] = 0; t4 = nrp[i + 3]; ap[i + 1] = 0; rp[i + 0] = t1; ap[i + 2] = 0; rp[i + 1] = t2; ap[i + 3] = 0; rp[i + 2] = t3; rp[i + 3] = t4; } for (nl += 4; i < nl; i++) rp[i] = nrp[i], ap[i] = 0; } # else if (bn_sub_words(rp, ap, np, nl) - carry) memcpy(rp, ap, nl * sizeof(BN_ULONG)); # endif bn_correct_top(r); bn_correct_top(ret); bn_check_top(ret); return (1); } crypto/dh/dh_check.c:165: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mod_exp`. Showing all 18 steps of the trace crypto/dh/dh_check.c:153:11: Call 151. goto err; 152. BN_CTX_start(ctx); 153. tmp = BN_CTX_get(ctx); ^ 154. if (tmp == NULL || !BN_set_word(tmp, 1)) 155. goto err; crypto/bn/bn_ctx.c:283:5: Call 281. } 282. /* OK, make sure the returned bignum is "zero" */ 283. BN_zero(ret); ^ 284. ctx->used++; 285. CTXDBG_RET(ctx, ret); crypto/bn/bn_lib.c:520:1: Parameter `*a->d` 518. } 519. 520. > int BN_set_word(BIGNUM *a, BN_ULONG w) 521. { 522. bn_check_top(a); crypto/dh/dh_check.c:165:14: Call 163. if (dh->q != NULL) { 164. /* Check pub_key^q == 1 mod p */ 165. if (!BN_mod_exp(tmp, pub_key, dh->q, dh->p, ctx)) ^ 166. goto err; 167. if (!BN_is_one(tmp)) crypto/bn/bn_exp.c:190:1: Parameter `*r->d` 188. } 189. 190. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 191. BN_CTX *ctx) 192. { crypto/bn/bn_exp.c:247:19: Call 245. && (BN_get_flags(p, BN_FLG_CONSTTIME) == 0)) { 246. BN_ULONG A = a->d[0]; 247. ret = BN_mod_exp_mont_word(r, A, p, m, ctx, NULL); ^ 248. } else 249. # endif crypto/bn/bn_exp.c:1151:1: Parameter `*rr->d` 1149. } 1150. 1151. > int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p, 1152. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 1153. { crypto/bn/bn_exp.c:1286:14: Call 1284. goto err; 1285. } else { 1286. if (!BN_from_montgomery(rr, r, mont, ctx)) ^ 1287. goto err; 1288. } crypto/bn/bn_mont.c:267:1: Parameter `*ret->d` 265. #endif /* MONT_WORD */ 266. 267. > int BN_from_montgomery(BIGNUM *ret, const BIGNUM *a, BN_MONT_CTX *mont, 268. BN_CTX *ctx) 269. { crypto/bn/bn_mont.c:276:16: Call 274. BN_CTX_start(ctx); 275. if ((t = BN_CTX_get(ctx)) && BN_copy(t, a)) 276. retn = BN_from_montgomery_word(ret, t, mont); ^ 277. BN_CTX_end(ctx); 278. #else /* !MONT_WORD */ crypto/bn/bn_mont.c:236:14: <Offset trace> 234. (BN_ULONG *)(((PTR_SIZE_INT) rp & ~m) | ((PTR_SIZE_INT) ap & m)); 235. 236. for (i = 0, nl -= 4; i < nl; i += 4) { ^ 237. BN_ULONG t1, t2, t3, t4; 238. crypto/bn/bn_mont.c:236:14: Assignment 234. (BN_ULONG *)(((PTR_SIZE_INT) rp & ~m) | ((PTR_SIZE_INT) ap & m)); 235. 236. for (i = 0, nl -= 4; i < nl; i += 4) { ^ 237. BN_ULONG t1, t2, t3, t4; 238. crypto/bn/bn_mont.c:176:1: <Length trace> 174. 175. #ifdef MONT_WORD 176. > static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont) 177. { 178. BIGNUM *n; crypto/bn/bn_mont.c:176:1: Parameter `*ret->d` 174. 175. #ifdef MONT_WORD 176. > static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont) 177. { 178. BIGNUM *n; crypto/bn/bn_mont.c:213:9: Call 211. } 212. 213. if (bn_wexpand(ret, nl) == NULL) ^ 214. return (0); 215. ret->top = nl; crypto/bn/bn_lib.c:985:1: Parameter `*a->d` 983. } 984. 985. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 986. { 987. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_mont.c:218:5: Assignment 216. ret->neg = r->neg; 217. 218. rp = ret->d; ^ 219. ap = &(r->d[nl]); 220. crypto/bn/bn_mont.c:247:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mod_exp` 245. rp[i + 0] = t1; 246. ap[i + 2] = 0; 247. rp[i + 1] = t2; ^ 248. ap[i + 3] = 0; 249. rp[i + 2] = t3;
https://github.com/openssl/openssl/blob/c10d1bc81cb047cbd53f8cc430632b6a4a70252d/crypto/bn/bn_mont.c/#L247
d2a_code_trace_data_42868
int ssl3_cbc_remove_padding(SSL3_RECORD *rec, size_t block_size, size_t mac_size) { size_t padding_length; size_t good; const size_t overhead = 1 + mac_size; if (overhead > rec->length) return 0; padding_length = rec->data[rec->length - 1]; good = constant_time_ge_s(rec->length, padding_length + overhead); good &= constant_time_ge_s(block_size, padding_length + 1); rec->length -= good & (padding_length + 1); return constant_time_select_int_s(good, 1, -1); } ssl/record/ssl3_record.c:649: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `ssl3_cbc_remove_padding`. Showing all 5 steps of the trace ssl/record/ssl3_record.c:578:1: Parameter `inrecs->length` 576. * occurred. 577. */ 578. > int ssl3_enc(SSL *s, SSL3_RECORD *inrecs, size_t n_recs, int send) 579. { 580. SSL3_RECORD *rec; ssl/record/ssl3_record.c:649:20: Call 647. } 648. if ((bs != 1) && !send) 649. return ssl3_cbc_remove_padding(rec, bs, mac_size); ^ 650. } 651. return (1); ssl/record/ssl3_record.c:1111:1: <LHS trace> 1109. * -1: otherwise. 1110. */ 1111. > int ssl3_cbc_remove_padding(SSL3_RECORD *rec, 1112. size_t block_size, size_t mac_size) 1113. { ssl/record/ssl3_record.c:1111:1: Parameter `rec->length` 1109. * -1: otherwise. 1110. */ 1111. > int ssl3_cbc_remove_padding(SSL3_RECORD *rec, 1112. size_t block_size, size_t mac_size) 1113. { ssl/record/ssl3_record.c:1124:22: Binary operation: ([0, +oo] - 1):unsigned64 by call to `ssl3_cbc_remove_padding` 1122. return 0; 1123. 1124. padding_length = rec->data[rec->length - 1]; ^ 1125. good = constant_time_ge_s(rec->length, padding_length + overhead); 1126. /* SSLv3 requires that the padding is minimal. */
https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/ssl/record/ssl3_record.c/#L1124
d2a_code_trace_data_42869
void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len) { CRYPTO_gcm128_finish(ctx, NULL, 0); memcpy(tag, ctx->Xi.c, len <= sizeof(ctx->Xi.c) ? len : sizeof(ctx->Xi.c)); } crypto/evp/e_aes.c:1772: error: BUFFER_OVERRUN_L3 Offset added: 16 Size: [0, +oo] by call to `CRYPTO_gcm128_tag`. Showing all 7 steps of the trace crypto/evp/e_aes.c:1772:9: Call 1770. return 0; 1771. } 1772. CRYPTO_gcm128_tag(&gctx->gcm, EVP_CIPHER_CTX_buf_noconst(ctx), 16); ^ 1773. gctx->taglen = 16; 1774. /* Don't reuse the IV */ crypto/modes/gcm128.c:1697:12: <Offset trace> 1695. CRYPTO_gcm128_finish(ctx, NULL, 0); 1696. memcpy(tag, ctx->Xi.c, 1697. len <= sizeof(ctx->Xi.c) ? len : sizeof(ctx->Xi.c)); ^ 1698. } 1699. crypto/modes/gcm128.c:1697:12: Assignment 1695. CRYPTO_gcm128_finish(ctx, NULL, 0); 1696. memcpy(tag, ctx->Xi.c, 1697. len <= sizeof(ctx->Xi.c) ? len : sizeof(ctx->Xi.c)); ^ 1698. } 1699. crypto/modes/gcm128.c:1695:5: <Length trace> 1693. void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len) 1694. { 1695. CRYPTO_gcm128_finish(ctx, NULL, 0); ^ 1696. memcpy(tag, ctx->Xi.c, 1697. len <= sizeof(ctx->Xi.c) ? len : sizeof(ctx->Xi.c)); crypto/modes/gcm128.c:1695:5: Call 1693. void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len) 1694. { 1695. CRYPTO_gcm128_finish(ctx, NULL, 0); ^ 1696. memcpy(tag, ctx->Xi.c, 1697. len <= sizeof(ctx->Xi.c) ? len : sizeof(ctx->Xi.c)); crypto/modes/gcm128.c:1649:1: Parameter `ctx->Xi.c[*]` 1647. } 1648. 1649. > int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag, 1650. size_t len) 1651. { crypto/modes/gcm128.c:1696:5: Array access: Offset added: 16 Size: [0, +oo] by call to `CRYPTO_gcm128_tag` 1694. { 1695. CRYPTO_gcm128_finish(ctx, NULL, 0); 1696. memcpy(tag, ctx->Xi.c, ^ 1697. len <= sizeof(ctx->Xi.c) ? len : sizeof(ctx->Xi.c)); 1698. }
https://github.com/openssl/openssl/blob/ac33c5a477568127ad99b1260a8978477de50e36/crypto/modes/gcm128.c/#L1696
d2a_code_trace_data_42870
int TIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s) { TIFFDirectory *td = &tif->tif_dir; if (x >= td->td_imagewidth) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Col out of range, max %lu", (unsigned long) x, (unsigned long) (td->td_imagewidth - 1)); return (0); } if (y >= td->td_imagelength) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Row out of range, max %lu", (unsigned long) y, (unsigned long) (td->td_imagelength - 1)); return (0); } if (z >= td->td_imagedepth) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Depth out of range, max %lu", (unsigned long) z, (unsigned long) (td->td_imagedepth - 1)); return (0); } if (td->td_planarconfig == PLANARCONFIG_SEPARATE && s >= td->td_samplesperpixel) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Sample out of range, max %lu", (unsigned long) s, (unsigned long) (td->td_samplesperpixel - 1)); return (0); } return (1); } libtiff/tif_getimage.c:618: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `TIFFReadTile`. libtiff/tif_getimage.c:618:10: Call 616. for (col = 0; col < w; col += tw) 617. { 618. if (TIFFReadTile(tif, buf, col+img->col_offset, ^ 619. row+img->row_offset, 0, 0)!=(tmsize_t)(-1) && img->stoponerr) 620. { libtiff/tif_read.c:415:1: Parameter `tif->tif_dir.td_imagewidth` 413. * tile is selected by the (x,y,z,s) coordinates. 414. */ 415. tmsize_t ^ 416. TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s) 417. { libtiff/tif_getimage.c:618:10: Call 616. for (col = 0; col < w; col += tw) 617. { 618. if (TIFFReadTile(tif, buf, col+img->col_offset, ^ 619. row+img->row_offset, 0, 0)!=(tmsize_t)(-1) && img->stoponerr) 620. { libtiff/tif_read.c:415:1: Parameter `tif->tif_dir.td_imagewidth` 413. * tile is selected by the (x,y,z,s) coordinates. 414. */ 415. tmsize_t ^ 416. TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s) 417. { libtiff/tif_read.c:418:33: Call 416. TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s) 417. { 418. if (!TIFFCheckRead(tif, 1) || !TIFFCheckTile(tif, x, y, z, s)) ^ 419. return ((tmsize_t)(-1)); 420. return (TIFFReadEncodedTile(tif, libtiff/tif_tile.c:100:1: <LHS trace> 98. * against the image bounds. 99. */ 100. int ^ 101. TIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s) 102. { libtiff/tif_tile.c:100:1: Parameter `x` 98. * against the image bounds. 99. */ 100. int ^ 101. TIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s) 102. { libtiff/tif_tile.c:106:3: Binary operation: ([0, +oo] - 1):unsigned32 by call to `TIFFReadTile` 104. 105. if (x >= td->td_imagewidth) { 106. TIFFErrorExt(tif->tif_clientdata, tif->tif_name, ^ 107. "%lu: Col out of range, max %lu", 108. (unsigned long) x,
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_tile.c/#L106
d2a_code_trace_data_42871
static int get_name(BIO *bp, char **name, unsigned int flags) { char *linebuf; int ret = 0; size_t len; linebuf = pem_malloc(LINESIZE + 1, flags); if (linebuf == NULL) { PEMerr(PEM_F_GET_NAME, ERR_R_MALLOC_FAILURE); return 0; } do { len = BIO_gets(bp, linebuf, LINESIZE); if (len <= 0) { PEMerr(PEM_F_GET_NAME, PEM_R_NO_START_LINE); goto err; } len = sanitize_line(linebuf, len, flags & ~PEM_FLAG_ONLY_B64); } while (strncmp(linebuf, beginstr, BEGINLEN) != 0 || len < TAILLEN || strncmp(linebuf + len - TAILLEN, tailstr, TAILLEN) != 0); linebuf[len - TAILLEN] = '\0'; len = len - BEGINLEN - TAILLEN + 1; *name = pem_malloc(len, flags); if (*name == NULL) { PEMerr(PEM_F_GET_NAME, ERR_R_MALLOC_FAILURE); goto err; } memcpy(*name, linebuf + BEGINLEN, len); ret = 1; err: pem_free(linebuf, flags); return ret; } crypto/pem/pem_lib.c:774: error: BUFFER_OVERRUN_L3 Offset added: [-10, 241] Size: [1, 241]. Showing all 30 steps of the trace crypto/pem/pem_lib.c:753:15: <Offset trace> 751. 752. do { 753. len = BIO_gets(bp, linebuf, LINESIZE); ^ 754. 755. if (len <= 0) { crypto/pem/pem_lib.c:753:15: Call 751. 752. do { 753. len = BIO_gets(bp, linebuf, LINESIZE); ^ 754. 755. if (len <= 0) { crypto/bio/bio_lib.c:438:9: Assignment 436. if ((b == NULL) || (b->method == NULL) || (b->method->bgets == NULL)) { 437. BIOerr(BIO_F_BIO_GETS, BIO_R_UNSUPPORTED_METHOD); 438. return (-2); ^ 439. } 440. crypto/pem/pem_lib.c:753:9: Assignment 751. 752. do { 753. len = BIO_gets(bp, linebuf, LINESIZE); ^ 754. 755. if (len <= 0) { crypto/pem/pem_lib.c:761:15: Call 759. 760. /* Strip trailing garbage and standardize ending. */ 761. len = sanitize_line(linebuf, len, flags & ~PEM_FLAG_ONLY_B64); ^ 762. 763. /* Allow leading empty or non-matching lines. */ crypto/pem/pem_lib.c:695:1: Parameter `len` 693. #define isb64(c) (isalnum(c) || (c) == '+' || (c) == '/' || (c) == '=') 694. 695. > static int sanitize_line(char *linebuf, int len, unsigned int flags) 696. { 697. int i; crypto/pem/pem_lib.c:704:9: Assignment 702. len--; 703. /* Go back to whitespace before applying uniform line ending. */ 704. len++; ^ 705. } else if (flags & PEM_FLAG_ONLY_B64) { 706. for (i = 0; i < len; ++i) { crypto/pem/pem_lib.c:723:13: Assignment 721. } 722. /* The caller allocated LINESIZE+1, so this is safe. */ 723. linebuf[len++] = '\n'; ^ 724. linebuf[len] = '\0'; 725. return len; crypto/pem/pem_lib.c:725:5: Assignment 723. linebuf[len++] = '\n'; 724. linebuf[len] = '\0'; 725. return len; ^ 726. } 727. crypto/pem/pem_lib.c:761:9: Assignment 759. 760. /* Strip trailing garbage and standardize ending. */ 761. len = sanitize_line(linebuf, len, flags & ~PEM_FLAG_ONLY_B64); ^ 762. 763. /* Allow leading empty or non-matching lines. */ crypto/pem/pem_lib.c:768:5: Assignment 766. || strncmp(linebuf + len - TAILLEN, tailstr, TAILLEN) != 0); 767. linebuf[len - TAILLEN] = '\0'; 768. len = len - BEGINLEN - TAILLEN + 1; ^ 769. *name = pem_malloc(len, flags); 770. if (*name == NULL) { crypto/pem/pem_lib.c:753:15: <Length trace> 751. 752. do { 753. len = BIO_gets(bp, linebuf, LINESIZE); ^ 754. 755. if (len <= 0) { crypto/pem/pem_lib.c:753:15: Call 751. 752. do { 753. len = BIO_gets(bp, linebuf, LINESIZE); ^ 754. 755. if (len <= 0) { crypto/bio/bio_lib.c:438:9: Assignment 436. if ((b == NULL) || (b->method == NULL) || (b->method->bgets == NULL)) { 437. BIOerr(BIO_F_BIO_GETS, BIO_R_UNSUPPORTED_METHOD); 438. return (-2); ^ 439. } 440. crypto/pem/pem_lib.c:753:9: Assignment 751. 752. do { 753. len = BIO_gets(bp, linebuf, LINESIZE); ^ 754. 755. if (len <= 0) { crypto/pem/pem_lib.c:761:15: Call 759. 760. /* Strip trailing garbage and standardize ending. */ 761. len = sanitize_line(linebuf, len, flags & ~PEM_FLAG_ONLY_B64); ^ 762. 763. /* Allow leading empty or non-matching lines. */ crypto/pem/pem_lib.c:695:1: Parameter `len` 693. #define isb64(c) (isalnum(c) || (c) == '+' || (c) == '/' || (c) == '=') 694. 695. > static int sanitize_line(char *linebuf, int len, unsigned int flags) 696. { 697. int i; crypto/pem/pem_lib.c:704:9: Assignment 702. len--; 703. /* Go back to whitespace before applying uniform line ending. */ 704. len++; ^ 705. } else if (flags & PEM_FLAG_ONLY_B64) { 706. for (i = 0; i < len; ++i) { crypto/pem/pem_lib.c:723:13: Assignment 721. } 722. /* The caller allocated LINESIZE+1, so this is safe. */ 723. linebuf[len++] = '\n'; ^ 724. linebuf[len] = '\0'; 725. return len; crypto/pem/pem_lib.c:725:5: Assignment 723. linebuf[len++] = '\n'; 724. linebuf[len] = '\0'; 725. return len; ^ 726. } 727. crypto/pem/pem_lib.c:761:9: Assignment 759. 760. /* Strip trailing garbage and standardize ending. */ 761. len = sanitize_line(linebuf, len, flags & ~PEM_FLAG_ONLY_B64); ^ 762. 763. /* Allow leading empty or non-matching lines. */ crypto/pem/pem_lib.c:768:5: Assignment 766. || strncmp(linebuf + len - TAILLEN, tailstr, TAILLEN) != 0); 767. linebuf[len - TAILLEN] = '\0'; 768. len = len - BEGINLEN - TAILLEN + 1; ^ 769. *name = pem_malloc(len, flags); 770. if (*name == NULL) { crypto/pem/pem_lib.c:769:13: Call 767. linebuf[len - TAILLEN] = '\0'; 768. len = len - BEGINLEN - TAILLEN + 1; 769. *name = pem_malloc(len, flags); ^ 770. if (*name == NULL) { 771. PEMerr(PEM_F_GET_NAME, ERR_R_MALLOC_FAILURE); crypto/pem/pem_lib.c:239:1: Parameter `num` 237. } 238. 239. > static void *pem_malloc(int num, unsigned int flags) 240. { 241. return (flags & PEM_FLAG_SECURE) ? OPENSSL_secure_malloc(num) crypto/pem/pem_lib.c:242:40: Call 240. { 241. return (flags & PEM_FLAG_SECURE) ? OPENSSL_secure_malloc(num) 242. : OPENSSL_malloc(num); ^ 243. } 244. crypto/mem.c:166:9: Assignment 164. 165. if (num == 0) 166. return NULL; ^ 167. 168. FAILTEST(); crypto/pem/pem_lib.c:241:12: Assignment 239. static void *pem_malloc(int num, unsigned int flags) 240. { 241. return (flags & PEM_FLAG_SECURE) ? OPENSSL_secure_malloc(num) ^ 242. : OPENSSL_malloc(num); 243. } crypto/pem/pem_lib.c:241:5: Assignment 239. static void *pem_malloc(int num, unsigned int flags) 240. { 241. return (flags & PEM_FLAG_SECURE) ? OPENSSL_secure_malloc(num) ^ 242. : OPENSSL_malloc(num); 243. } crypto/pem/pem_lib.c:769:5: Assignment 767. linebuf[len - TAILLEN] = '\0'; 768. len = len - BEGINLEN - TAILLEN + 1; 769. *name = pem_malloc(len, flags); ^ 770. if (*name == NULL) { 771. PEMerr(PEM_F_GET_NAME, ERR_R_MALLOC_FAILURE); crypto/pem/pem_lib.c:774:5: Array access: Offset added: [-10, 241] Size: [1, 241] 772. goto err; 773. } 774. memcpy(*name, linebuf + BEGINLEN, len); ^ 775. ret = 1; 776.
https://github.com/openssl/openssl/blob/7671342e550ed2de676b23c79d0e7f45a381c76e/crypto/pem/pem_lib.c/#L774
d2a_code_trace_data_42872
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:437: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `bitstream_read_bit`. libavcodec/takdec.c:435:36: Call 433. return decode_residues(s, decoded, subframe_size); 434. 435. filter_order = predictor_sizes[bitstream_read(bc, 4)]; ^ 436. 437. if (prev_subframe_size > 0 && bitstream_read_bit(bc)) { libavcodec/bitstream.h:183:1: Parameter `bc->bits_left` 181. 182. /* Return n bits from the buffer. n has to be in the 0-32 range. */ 183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n) ^ 184. { 185. if (!n) libavcodec/takdec.c:437:35: Call 435. filter_order = predictor_sizes[bitstream_read(bc, 4)]; 436. 437. if (prev_subframe_size > 0 && bitstream_read_bit(bc)) { ^ 438. if (filter_order > prev_subframe_size) 439. return AVERROR_INVALIDDATA; libavcodec/bitstream.h:145:1: Parameter `bc->bits_left` 143. 144. /* Return one bit from the buffer. */ 145. static inline unsigned bitstream_read_bit(BitstreamContext *bc) ^ 146. { 147. if (!bc->bits_left) libavcodec/bitstream.h:150:12: Call 148. refill_64(bc); 149. 150. return get_val(bc, 1); ^ 151. } 152. libavcodec/bitstream.h:130:1: <LHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `bc->bits_left` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: <RHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `bitstream_read_bit` 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret;
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L139
d2a_code_trace_data_42873
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dsa/dsa_ossl.c:126: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_mul`. Showing all 16 steps of the trace crypto/dsa/dsa_ossl.c:92:10: Call 90. 91. redo: 92. if (!dsa_sign_setup(dsa, ctx, &kinv, &ret->r, dgst, dlen)) ^ 93. goto err; 94. crypto/dsa/dsa_ossl.c:175:1: Parameter `ctx_in->stack.depth` 173. } 174. 175. > static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, 176. BIGNUM **kinvp, BIGNUM **rp, 177. const unsigned char *dgst, int dlen) crypto/dsa/dsa_ossl.c:126:10: Call 124. 125. /* tmp := blind * priv_key * r mod q */ 126. if (!BN_mod_mul(tmp, blind, dsa->priv_key, dsa->q, ctx)) ^ 127. goto err; 128. if (!BN_mod_mul(tmp, tmp, ret->r, dsa->q, ctx)) crypto/bn/bn_mod.c:73:1: Parameter `ctx->stack.depth` 71. 72. /* slow but works */ 73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 74. BN_CTX *ctx) 75. { crypto/bn/bn_mod.c:83:5: Call 81. bn_check_top(m); 82. 83. BN_CTX_start(ctx); ^ 84. if ((t = BN_CTX_get(ctx)) == NULL) 85. goto err; crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mod.c:90:14: Call 88. goto err; 89. } else { 90. if (!BN_mul(t, a, b, ctx)) ^ 91. goto err; 92. } crypto/bn/bn_mul.c: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 = 0; crypto/bn/bn_mul.c:523:5: Call 521. top = al + bl; 522. 523. BN_CTX_start(ctx); ^ 524. if ((r == a) || (r == b)) { 525. if ((rr = BN_CTX_get(ctx)) == NULL) crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mul.c:608:5: Call 606. err: 607. bn_check_top(r); 608. BN_CTX_end(ctx); ^ 609. return ret; 610. } crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.depth` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:274:1: <LHS trace> 272. } 273. 274. > static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:274:1: Parameter `st->depth` 272. } 273. 274. > static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:276:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_mul` 274. static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; ^ 277. } 278.
https://github.com/openssl/openssl/blob/a766aab93a282774e63ba918d0bb1c6680a5f292/crypto/bn/bn_ctx.c/#L276
d2a_code_trace_data_42874
DECLAREcpFunc(cpSeparate2ContigByRow) { tsize_t scanlinesizein = TIFFScanlineSize(in); tsize_t scanlinesizeout = TIFFScanlineSize(out); tdata_t inbuf; tdata_t outbuf; register uint8 *inp, *outp; register uint32 n; uint32 row; tsample_t s; inbuf = _TIFFmalloc(scanlinesizein); outbuf = _TIFFmalloc(scanlinesizeout); if (!inbuf || !outbuf) return 0; _TIFFmemset(inbuf, 0, scanlinesizein); _TIFFmemset(outbuf, 0, scanlinesizeout); for (row = 0; row < imagelength; row++) { for (s = 0; s < spp; s++) { if (TIFFReadScanline(in, inbuf, row, s) < 0 && !ignore) { TIFFError(TIFFFileName(in), "Error, can't read scanline %lu", (unsigned long) row); goto bad; } inp = (uint8*)inbuf; outp = ((uint8*)outbuf) + s; for (n = imagewidth; n-- > 0;) { *outp = *inp++; outp += spp; } } if (TIFFWriteScanline(out, outbuf, row, 0) < 0) { TIFFError(TIFFFileName(out), "Error, can't write scanline %lu", (unsigned long) row); goto bad; } } if (inbuf) _TIFFfree(inbuf); if (outbuf) _TIFFfree(outbuf); return 1; bad: if (inbuf) _TIFFfree(inbuf); if (outbuf) _TIFFfree(outbuf); return 0; } tools/tiffcp.c:1115: error: Memory Leak memory dynamically allocated by call to `_TIFFmalloc()` at line 1113, column 10 is not reachable after line 1115, column 17. tools/tiffcp.c:1102:1: start of procedure cpSeparate2ContigByRow() 1100. * Separate -> contig by row. 1101. */ 1102. DECLAREcpFunc(cpSeparate2ContigByRow) ^ 1103. { 1104. tsize_t scanlinesizein = TIFFScanlineSize(in); tools/tiffcp.c:1104:2: 1102. DECLAREcpFunc(cpSeparate2ContigByRow) 1103. { 1104. tsize_t scanlinesizein = TIFFScanlineSize(in); ^ 1105. tsize_t scanlinesizeout = TIFFScanlineSize(out); 1106. tdata_t inbuf; libtiff/tif_strip.c:321:1: start of procedure TIFFScanlineSize() 319. return(scanline_size); 320. } 321. tmsize_t ^ 322. TIFFScanlineSize(TIFF* tif) 323. { libtiff/tif_strip.c:324:2: 322. TIFFScanlineSize(TIFF* tif) 323. { 324. static const char module[] = "TIFFScanlineSize"; ^ 325. uint64 m; 326. tmsize_t n; libtiff/tif_strip.c:327:2: Skipping TIFFScanlineSize64(): empty list of specs 325. uint64 m; 326. tmsize_t n; 327. m=TIFFScanlineSize64(tif); ^ 328. n=(tmsize_t)m; 329. if ((uint64)n!=m) libtiff/tif_strip.c:328:2: 326. tmsize_t n; 327. m=TIFFScanlineSize64(tif); 328. n=(tmsize_t)m; ^ 329. if ((uint64)n!=m) 330. { libtiff/tif_strip.c:329:6: Taking false branch 327. m=TIFFScanlineSize64(tif); 328. n=(tmsize_t)m; 329. if ((uint64)n!=m) ^ 330. { 331. TIFFErrorExt(tif->tif_clientdata,module,"Integer arithmetic overflow"); libtiff/tif_strip.c:334:2: 332. n=0; 333. } 334. return(n); ^ 335. } 336. libtiff/tif_strip.c:335:1: return from a call to TIFFScanlineSize 333. } 334. return(n); 335. } ^ 336. 337. /* tools/tiffcp.c:1105:2: 1103. { 1104. tsize_t scanlinesizein = TIFFScanlineSize(in); 1105. tsize_t scanlinesizeout = TIFFScanlineSize(out); ^ 1106. tdata_t inbuf; 1107. tdata_t outbuf; libtiff/tif_strip.c:321:1: start of procedure TIFFScanlineSize() 319. return(scanline_size); 320. } 321. tmsize_t ^ 322. TIFFScanlineSize(TIFF* tif) 323. { libtiff/tif_strip.c:324:2: 322. TIFFScanlineSize(TIFF* tif) 323. { 324. static const char module[] = "TIFFScanlineSize"; ^ 325. uint64 m; 326. tmsize_t n; libtiff/tif_strip.c:327:2: Skipping TIFFScanlineSize64(): empty list of specs 325. uint64 m; 326. tmsize_t n; 327. m=TIFFScanlineSize64(tif); ^ 328. n=(tmsize_t)m; 329. if ((uint64)n!=m) libtiff/tif_strip.c:328:2: 326. tmsize_t n; 327. m=TIFFScanlineSize64(tif); 328. n=(tmsize_t)m; ^ 329. if ((uint64)n!=m) 330. { libtiff/tif_strip.c:329:6: Taking false branch 327. m=TIFFScanlineSize64(tif); 328. n=(tmsize_t)m; 329. if ((uint64)n!=m) ^ 330. { 331. TIFFErrorExt(tif->tif_clientdata,module,"Integer arithmetic overflow"); libtiff/tif_strip.c:334:2: 332. n=0; 333. } 334. return(n); ^ 335. } 336. libtiff/tif_strip.c:335:1: return from a call to TIFFScanlineSize 333. } 334. return(n); 335. } ^ 336. 337. /* tools/tiffcp.c:1113:2: 1111. tsample_t s; 1112. 1113. inbuf = _TIFFmalloc(scanlinesizein); ^ 1114. outbuf = _TIFFmalloc(scanlinesizeout); 1115. if (!inbuf || !outbuf) libtiff/tif_unix.c:253:1: start of procedure _TIFFmalloc() 251. #endif 252. 253. void* ^ 254. _TIFFmalloc(tmsize_t s) 255. { libtiff/tif_unix.c:256:2: 254. _TIFFmalloc(tmsize_t s) 255. { 256. return (malloc((size_t) s)); ^ 257. } 258. libtiff/tif_unix.c:257:1: return from a call to _TIFFmalloc 255. { 256. return (malloc((size_t) s)); 257. } ^ 258. 259. void tools/tiffcp.c:1114:2: 1112. 1113. inbuf = _TIFFmalloc(scanlinesizein); 1114. outbuf = _TIFFmalloc(scanlinesizeout); ^ 1115. if (!inbuf || !outbuf) 1116. return 0; libtiff/tif_unix.c:253:1: start of procedure _TIFFmalloc() 251. #endif 252. 253. void* ^ 254. _TIFFmalloc(tmsize_t s) 255. { libtiff/tif_unix.c:256:2: 254. _TIFFmalloc(tmsize_t s) 255. { 256. return (malloc((size_t) s)); ^ 257. } 258. libtiff/tif_unix.c:257:1: return from a call to _TIFFmalloc 255. { 256. return (malloc((size_t) s)); 257. } ^ 258. 259. void tools/tiffcp.c:1115:7: Taking false branch 1113. inbuf = _TIFFmalloc(scanlinesizein); 1114. outbuf = _TIFFmalloc(scanlinesizeout); 1115. if (!inbuf || !outbuf) ^ 1116. return 0; 1117. _TIFFmemset(inbuf, 0, scanlinesizein); tools/tiffcp.c:1115:17: Taking true branch 1113. inbuf = _TIFFmalloc(scanlinesizein); 1114. outbuf = _TIFFmalloc(scanlinesizeout); 1115. if (!inbuf || !outbuf) ^ 1116. return 0; 1117. _TIFFmemset(inbuf, 0, scanlinesizein);
https://gitlab.com/libtiff/libtiff/blob/b69a1998bedfabc32cd541408bffdef05bd01e45/tools/tiffcp.c/#L1115
d2a_code_trace_data_42875
char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) { const X509_NAME_ENTRY *ne; int i; int n, lold, l, l1, l2, num, j, type; const char *s; char *p; unsigned char *q; BUF_MEM *b = NULL; static const char hex[17] = "0123456789ABCDEF"; int gs_doit[4]; char tmp_buf[80]; #ifdef CHARSET_EBCDIC unsigned char ebcdic_buf[1024]; #endif if (buf == NULL) { if ((b = BUF_MEM_new()) == NULL) goto err; if (!BUF_MEM_grow(b, 200)) goto err; b->data[0] = '\0'; len = 200; } else if (len == 0) { return NULL; } if (a == NULL) { if (b) { buf = b->data; OPENSSL_free(b); } strncpy(buf, "NO X509_NAME", len); buf[len - 1] = '\0'; return buf; } len--; l = 0; for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { ne = sk_X509_NAME_ENTRY_value(a->entries, i); n = OBJ_obj2nid(ne->object); if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) { i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object); s = tmp_buf; } l1 = strlen(s); type = ne->value->type; num = ne->value->length; if (num > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } q = ne->value->data; #ifdef CHARSET_EBCDIC if (type == V_ASN1_GENERALSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_PRINTABLESTRING || type == V_ASN1_TELETEXSTRING || type == V_ASN1_IA5STRING) { if (num > (int)sizeof(ebcdic_buf)) num = sizeof(ebcdic_buf); ascii2ebcdic(ebcdic_buf, q, num); q = ebcdic_buf; } #endif if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) { gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0; for (j = 0; j < num; j++) if (q[j] != 0) gs_doit[j & 3] = 1; if (gs_doit[0] | gs_doit[1] | gs_doit[2]) gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; else { gs_doit[0] = gs_doit[1] = gs_doit[2] = 0; gs_doit[3] = 1; } } else gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; for (l2 = j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; l2++; #ifndef CHARSET_EBCDIC if ((q[j] < ' ') || (q[j] > '~')) l2 += 3; #else if ((os_toascii[q[j]] < os_toascii[' ']) || (os_toascii[q[j]] > os_toascii['~'])) l2 += 3; #endif } lold = l; l += 1 + l1 + 1 + l2; if (l > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } if (b != NULL) { if (!BUF_MEM_grow(b, l + 1)) goto err; p = &(b->data[lold]); } else if (l > len) { break; } else p = &(buf[lold]); *(p++) = '/'; memcpy(p, s, (unsigned int)l1); p += l1; *(p++) = '='; #ifndef CHARSET_EBCDIC q = ne->value->data; #endif for (j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; #ifndef CHARSET_EBCDIC n = q[j]; if ((n < ' ') || (n > '~')) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = n; #else n = os_toascii[q[j]]; if ((n < os_toascii[' ']) || (n > os_toascii['~'])) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = q[j]; #endif } *p = '\0'; } if (b != NULL) { p = b->data; OPENSSL_free(b); } else p = buf; if (i == 0) *p = '\0'; return (p); err: X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE); end: BUF_MEM_free(b); return (NULL); } crypto/x509v3/v3_alt.c:97: error: BUFFER_OVERRUN_L3 Offset: [199, 255] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace crypto/x509v3/v3_alt.c:97:9: Call 95. 96. case GEN_DIRNAME: 97. X509_NAME_oneline(gen->d.dirn, oline, 256); ^ 98. X509V3_add_value("DirName", oline, &ret); 99. break; crypto/x509/x509_obj.c:25:1: <Offset trace> 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: Parameter `len` 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: <Length trace> 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: Parameter `*buf` 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c: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_42876
int ossl_init_thread_start(uint64_t opts) { struct thread_local_inits_st *locals = ossl_init_get_thread_local(1); if (locals == NULL) return 0; if (opts & OPENSSL_INIT_THREAD_ASYNC) { #ifdef OPENSSL_INIT_DEBUG fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: " "marking thread for async\n"); #endif locals->async = 1; } if (opts & OPENSSL_INIT_THREAD_ERR_STATE) { #ifdef OPENSSL_INIT_DEBUG fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: " "marking thread for err_state\n"); #endif locals->err_state = 1; } return 1; } crypto/init.c:382: error: MEMORY_LEAK memory dynamically allocated to `locals` by call to `ossl_init_get_thread_local()` at line 369, column 44 is not reachable after line 382, column 9. Showing all 37 steps of the trace crypto/init.c:367:1: start of procedure ossl_init_thread_start() 365. } 366. 367. > int ossl_init_thread_start(uint64_t opts) 368. { 369. struct thread_local_inits_st *locals = ossl_init_get_thread_local(1); crypto/init.c:369:5: 367. int ossl_init_thread_start(uint64_t opts) 368. { 369. > struct thread_local_inits_st *locals = ossl_init_get_thread_local(1); 370. 371. if (locals == NULL) crypto/init.c:85:1: start of procedure ossl_init_get_thread_local() 83. } 84. 85. > static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc) 86. { 87. struct thread_local_inits_st *local = crypto/init.c:87:5: 85. static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc) 86. { 87. > struct thread_local_inits_st *local = 88. CRYPTO_THREAD_get_local(&threadstopkey); 89. crypto/threads_pthread.c:120:1: start of procedure CRYPTO_THREAD_get_local() 118. } 119. 120. > void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key) 121. { 122. return pthread_getspecific(*key); crypto/threads_pthread.c:122:5: Skipping pthread_getspecific(): method has no implementation 120. void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key) 121. { 122. return pthread_getspecific(*key); ^ 123. } 124. crypto/threads_pthread.c:123:1: return from a call to CRYPTO_THREAD_get_local 121. { 122. return pthread_getspecific(*key); 123. > } 124. 125. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) crypto/init.c:90:9: Taking true branch 88. CRYPTO_THREAD_get_local(&threadstopkey); 89. 90. if (local == NULL && alloc) { ^ 91. local = OPENSSL_zalloc(sizeof *local); 92. CRYPTO_THREAD_set_local(&threadstopkey, local); crypto/init.c:90:26: Taking true branch 88. CRYPTO_THREAD_get_local(&threadstopkey); 89. 90. if (local == NULL && alloc) { ^ 91. local = OPENSSL_zalloc(sizeof *local); 92. CRYPTO_THREAD_set_local(&threadstopkey, local); crypto/init.c:91:9: 89. 90. if (local == NULL && alloc) { 91. > local = OPENSSL_zalloc(sizeof *local); 92. CRYPTO_THREAD_set_local(&threadstopkey, local); 93. } crypto/mem.c:146:1: start of procedure CRYPTO_zalloc() 144. } 145. 146. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 147. { 148. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:148:5: 146. void *CRYPTO_zalloc(size_t num, const char *file, int line) 147. { 148. > void *ret = CRYPTO_malloc(num, file, line); 149. 150. if (ret != NULL) crypto/mem.c:119:1: start of procedure CRYPTO_malloc() 117. } 118. 119. > void *CRYPTO_malloc(size_t num, const char *file, int line) 120. { 121. void *ret = NULL; crypto/mem.c:121:5: 119. void *CRYPTO_malloc(size_t num, const char *file, int line) 120. { 121. > void *ret = NULL; 122. 123. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:123:9: Taking false branch 121. void *ret = NULL; 122. 123. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 124. return malloc_impl(num, file, line); 125. crypto/mem.c:126:9: Taking false branch 124. return malloc_impl(num, file, line); 125. 126. if (num <= 0) ^ 127. return NULL; 128. crypto/mem.c:129:5: 127. return NULL; 128. 129. > allow_customize = 0; 130. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 131. if (call_malloc_debug) { crypto/mem.c:139:5: 137. } 138. #else 139. > osslargused(file); osslargused(line); 140. ret = malloc(num); 141. #endif crypto/mem.c:139:24: 137. } 138. #else 139. > osslargused(file); osslargused(line); 140. ret = malloc(num); 141. #endif crypto/mem.c:140:5: 138. #else 139. osslargused(file); osslargused(line); 140. > ret = malloc(num); 141. #endif 142. crypto/mem.c:143:5: 141. #endif 142. 143. > return ret; 144. } 145. crypto/mem.c:144:1: return from a call to CRYPTO_malloc 142. 143. return ret; 144. > } 145. 146. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:150:9: Taking true branch 148. void *ret = CRYPTO_malloc(num, file, line); 149. 150. if (ret != NULL) ^ 151. memset(ret, 0, num); 152. return ret; crypto/mem.c:151:9: 149. 150. if (ret != NULL) 151. > memset(ret, 0, num); 152. return ret; 153. } crypto/mem.c:152:5: 150. if (ret != NULL) 151. memset(ret, 0, num); 152. > return ret; 153. } 154. crypto/mem.c:153:1: return from a call to CRYPTO_zalloc 151. memset(ret, 0, num); 152. return ret; 153. > } 154. 155. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/init.c:92:9: 90. if (local == NULL && alloc) { 91. local = OPENSSL_zalloc(sizeof *local); 92. > CRYPTO_THREAD_set_local(&threadstopkey, local); 93. } 94. if (!alloc) { crypto/threads_pthread.c:125:1: start of procedure CRYPTO_THREAD_set_local() 123. } 124. 125. > int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) 126. { 127. if (pthread_setspecific(*key, val) != 0) crypto/threads_pthread.c:127:9: Taking true branch 125. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) 126. { 127. if (pthread_setspecific(*key, val) != 0) ^ 128. return 0; 129. crypto/threads_pthread.c:128:9: 126. { 127. if (pthread_setspecific(*key, val) != 0) 128. > return 0; 129. 130. return 1; crypto/threads_pthread.c:131:1: return from a call to CRYPTO_THREAD_set_local 129. 130. return 1; 131. > } 132. 133. int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key) crypto/init.c:94:10: Taking false branch 92. CRYPTO_THREAD_set_local(&threadstopkey, local); 93. } 94. if (!alloc) { ^ 95. CRYPTO_THREAD_set_local(&threadstopkey, NULL); 96. } crypto/init.c:98:5: 96. } 97. 98. > return local; 99. } 100. crypto/init.c:99:1: return from a call to ossl_init_get_thread_local 97. 98. return local; 99. > } 100. 101. typedef struct ossl_init_stop_st OPENSSL_INIT_STOP; crypto/init.c:371:9: Taking false branch 369. struct thread_local_inits_st *locals = ossl_init_get_thread_local(1); 370. 371. if (locals == NULL) ^ 372. return 0; 373. crypto/init.c:374:9: Taking false branch 372. return 0; 373. 374. if (opts & OPENSSL_INIT_THREAD_ASYNC) { ^ 375. #ifdef OPENSSL_INIT_DEBUG 376. fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: " crypto/init.c:382:9: Taking false branch 380. } 381. 382. if (opts & OPENSSL_INIT_THREAD_ERR_STATE) { ^ 383. #ifdef OPENSSL_INIT_DEBUG 384. fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "
https://github.com/openssl/openssl/blob/6457615ac82d688a965c9b2cce9611e0559635be/crypto/init.c/#L382
d2a_code_trace_data_42877
static void sdp_parse_fmtp_config_h264(AVStream * stream, h264_rtp_extra_data * h264_data, char *attr, char *value) { AVCodecContext *codec = stream->codec; assert(codec->codec_id == CODEC_ID_H264); assert(h264_data != NULL); if (!strcmp(attr, "packetization-mode")) { av_log(NULL, AV_LOG_DEBUG, "H.264/RTP Packetization Mode: %d\n", atoi(value)); h264_data->packetization_mode = atoi(value); if (h264_data->packetization_mode > 1) av_log(stream, AV_LOG_ERROR, "H.264/RTP Interleaved RTP mode is not supported yet."); } else if (!strcmp(attr, "profile-level-id")) { if (strlen(value) == 6) { char buffer[3]; uint8_t profile_idc; uint8_t profile_iop; uint8_t level_idc; buffer[0] = value[0]; buffer[1] = value[1]; buffer[2] = '\0'; profile_idc = strtol(buffer, NULL, 16); buffer[0] = value[2]; buffer[1] = value[3]; profile_iop = strtol(buffer, NULL, 16); buffer[0] = value[4]; buffer[1] = value[5]; level_idc = strtol(buffer, NULL, 16); av_log(NULL, AV_LOG_DEBUG, "H.264/RTP Profile IDC: %x Profile IOP: %x Level: %x\n", profile_idc, profile_iop, level_idc); h264_data->profile_idc = profile_idc; h264_data->profile_iop = profile_iop; h264_data->level_idc = level_idc; } } else if (!strcmp(attr, "sprop-parameter-sets")) { uint8_t start_sequence[]= { 0, 0, 1 }; codec->extradata_size= 0; codec->extradata= NULL; while (*value) { char base64packet[1024]; uint8_t decoded_packet[1024]; uint32_t packet_size; char *dst = base64packet; while (*value && *value != ',' && (dst - base64packet) < sizeof(base64packet) - 1) { *dst++ = *value++; } *dst++ = '\0'; if (*value == ',') value++; packet_size= av_base64_decode(decoded_packet, base64packet, sizeof(decoded_packet)); if (packet_size) { uint8_t *dest= av_malloc(packet_size+sizeof(start_sequence)+codec->extradata_size); if(dest) { if(codec->extradata_size) { memcpy(dest, codec->extradata, codec->extradata_size); av_free(codec->extradata); } memcpy(dest+codec->extradata_size, start_sequence, sizeof(start_sequence)); memcpy(dest+codec->extradata_size+sizeof(start_sequence), decoded_packet, packet_size); codec->extradata= dest; codec->extradata_size+= sizeof(start_sequence)+packet_size; } else { av_log(NULL, AV_LOG_ERROR, "H.264/RTP Unable to allocate memory for extradata!"); } } } av_log(NULL, AV_LOG_DEBUG, "H.264/RTP Extradata set to %p (size: %d)!", codec->extradata, codec->extradata_size); } } libavformat/rtp_h264.c:148: error: Buffer Overrun L3 Offset added: [-1, +oo] Size: 1024. libavformat/rtp_h264.c:135:26: <Offset trace> 133. value++; 134. 135. packet_size= av_base64_decode(decoded_packet, base64packet, sizeof(decoded_packet)); ^ 136. if (packet_size) { 137. uint8_t *dest= av_malloc(packet_size+sizeof(start_sequence)+codec->extradata_size); libavformat/rtp_h264.c:135:26: Call 133. value++; 134. 135. packet_size= av_base64_decode(decoded_packet, base64packet, sizeof(decoded_packet)); ^ 136. if (packet_size) { 137. uint8_t *dest= av_malloc(packet_size+sizeof(start_sequence)+codec->extradata_size); libavutil/base64.c:55:13: Assignment 53. unsigned int index= in[i]-43; 54. if (index>=(sizeof(map2)/sizeof(map2[0])) || map2[index] == 0xff) 55. return -1; ^ 56. v = (v << 6) + map2[index]; 57. if (i & 3) { libavformat/rtp_h264.c:135:13: Assignment 133. value++; 134. 135. packet_size= av_base64_decode(decoded_packet, base64packet, sizeof(decoded_packet)); ^ 136. if (packet_size) { 137. uint8_t *dest= av_malloc(packet_size+sizeof(start_sequence)+codec->extradata_size); libavformat/rtp_h264.c:72:1: <Length trace> 70. 71. /* ---------------- private code */ 72. static void sdp_parse_fmtp_config_h264(AVStream * stream, ^ 73. h264_rtp_extra_data * h264_data, 74. char *attr, char *value) libavformat/rtp_h264.c:72:1: Array declaration 70. 71. /* ---------------- private code */ 72. static void sdp_parse_fmtp_config_h264(AVStream * stream, ^ 73. h264_rtp_extra_data * h264_data, 74. char *attr, char *value) libavformat/rtp_h264.c:148:21: Array access: Offset added: [-1, +oo] Size: 1024 146. 147. memcpy(dest+codec->extradata_size, start_sequence, sizeof(start_sequence)); 148. memcpy(dest+codec->extradata_size+sizeof(start_sequence), decoded_packet, packet_size); ^ 149. 150. codec->extradata= dest;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/rtp_h264.c/#L148
d2a_code_trace_data_42878
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) { int line_size; int sample_size = av_get_bytes_per_sample(sample_fmt); int planar = av_sample_fmt_is_planar(sample_fmt); if (!sample_size || nb_samples <= 0 || nb_channels <= 0) return AVERROR(EINVAL); if (!align) { if (nb_samples > INT_MAX - 31) return AVERROR(EINVAL); align = 1; nb_samples = FFALIGN(nb_samples, 32); } if (nb_channels > INT_MAX / align || (int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size) return AVERROR(EINVAL); line_size = planar ? FFALIGN(nb_samples * sample_size, align) : FFALIGN(nb_samples * sample_size * nb_channels, align); if (linesize) *linesize = line_size; return planar ? line_size * nb_channels : line_size; } libavresample/audio_data.c:301: error: Integer Overflow L2 ([1+max(0, `dst->nb_samples`), 2147483616] + 32):signed32 by call to `ff_audio_data_realloc`. libavresample/audio_data.c:269:1: Parameter `src_offset` 267. } 268. 269. int ff_audio_data_combine(AudioData *dst, int dst_offset, AudioData *src, ^ 270. int src_offset, int nb_samples) 271. { libavresample/audio_data.c:301:11: Call 299. 300. /* reallocate output if necessary */ 301. ret = ff_audio_data_realloc(dst, dst->nb_samples + nb_samples); ^ 302. if (ret < 0) { 303. av_log(dst, AV_LOG_ERROR, "error reallocating dst\n"); libavresample/audio_data.c:153:1: Parameter `nb_samples` 151. } 152. 153. int ff_audio_data_realloc(AudioData *a, int nb_samples) ^ 154. { 155. int ret, new_buf_size, plane_size, p; libavresample/audio_data.c:165:20: Call 163. return AVERROR(EINVAL); 164. 165. new_buf_size = av_samples_get_buffer_size(&plane_size, ^ 166. a->allocated_channels, nb_samples, 167. a->sample_fmt, 0); libavutil/samplefmt.c:108:1: <LHS trace> 106. } 107. 108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, ^ 109. enum AVSampleFormat sample_fmt, int align) 110. { libavutil/samplefmt.c:108:1: Parameter `nb_samples` 106. } 107. 108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, ^ 109. enum AVSampleFormat sample_fmt, int align) 110. { libavutil/samplefmt.c:124:9: Binary operation: ([1+max(0, dst->nb_samples), 2147483616] + 32):signed32 by call to `ff_audio_data_realloc` 122. return AVERROR(EINVAL); 123. align = 1; 124. nb_samples = FFALIGN(nb_samples, 32); ^ 125. } 126.
https://github.com/libav/libav/blob/0e830094ad0dc251613a0aa3234d9c5c397e02e6/libavutil/samplefmt.c/#L124
d2a_code_trace_data_42879
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: [80+min(0, `c->synth_buf_offset[*]`), 81+max(511, `c->synth_buf_offset[*]`)] (⇐ [16+min(0, `c->synth_buf_offset[*]`), 17+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:896:5: Assignment 894. 895. sum = *dither_state; 896. p = synth_buf + 16; ^ 897. SUM8(sum, +=, w, p); 898. p = synth_buf + 48; libavcodec/mpegaudiodec.c:897:5: Array access: Offset: [80+min(0, c->synth_buf_offset[*]), 81+max(511, c->synth_buf_offset[*])] (⇐ [16+min(0, c->synth_buf_offset[*]), 17+max(511, c->synth_buf_offset[*])] + 64) Size: 2 by call to `ff_mpa_synth_filter` 895. sum = *dither_state; 896. p = synth_buf + 16; 897. SUM8(sum, +=, w, p); ^ 898. p = synth_buf + 48; 899. SUM8(sum, -=, w + 32, p);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L897
d2a_code_trace_data_42880
int pem_check_suffix(const char *pem_str, const char *suffix) { int pem_len = strlen(pem_str); int suffix_len = strlen(suffix); const char *p; if (suffix_len + 1 >= pem_len) return 0; p = pem_str + pem_len - suffix_len; if (strcmp(p, suffix)) return 0; p--; if (*p != ' ') return 0; return p - pem_str; } crypto/pem/pem_pkey.c:128: error: BUFFER_OVERRUN_L3 Offset: [-11, +oo] Size: [1, 241] by call to `pem_check_suffix`. Showing all 10 steps of the trace crypto/pem/pem_pkey.c:123:10: Call 121. EVP_PKEY *ret = NULL; 122. 123. if (!PEM_bytes_read_bio(&data, &len, &nm, PEM_STRING_PARAMETERS, ^ 124. bp, 0, NULL)) 125. return NULL; crypto/pem/pem_lib.c:291:12: Call 289. const char *name, BIO *bp, pem_password_cb *cb, 290. void *u) { 291. return pem_bytes_read_bio_flags(pdata, plen, pnm, name, bp, cb, u, ^ 292. PEM_FLAG_EAY_COMPATIBLE); 293. } crypto/pem/pem_lib.c:260:14: Call 258. pem_free(header, flags); 259. pem_free(data, flags); 260. if (!PEM_read_bio_ex(bp, &nm, &header, &data, &len, flags)) { ^ 261. if (ERR_GET_REASON(ERR_peek_error()) == PEM_R_NO_START_LINE) 262. ERR_add_error_data(2, "Expecting: ", name); crypto/pem/pem_lib.c:958:5: Assignment 956. } 957. BIO_read(headerB, *header, headerlen); 958. (*header)[headerlen] = '\0'; ^ 959. BIO_read(dataB, *data, len); 960. *len_out = len; crypto/pem/pem_pkey.c:128:17: Call 126. p = data; 127. 128. if ((slen = pem_check_suffix(nm, "PARAMETERS")) > 0) { ^ 129. ret = EVP_PKEY_new(); 130. if (ret == NULL) crypto/pem/pem_lib.c:985:1: <Length trace> 983. */ 984. 985. > int pem_check_suffix(const char *pem_str, const char *suffix) 986. { 987. int pem_len = strlen(pem_str); crypto/pem/pem_lib.c:985:1: Parameter `*pem_str` 983. */ 984. 985. > int pem_check_suffix(const char *pem_str, const char *suffix) 986. { 987. int pem_len = strlen(pem_str); crypto/pem/pem_lib.c:992:5: Assignment 990. if (suffix_len + 1 >= pem_len) 991. return 0; 992. p = pem_str + pem_len - suffix_len; ^ 993. if (strcmp(p, suffix)) 994. return 0; crypto/pem/pem_lib.c:995:5: Assignment 993. if (strcmp(p, suffix)) 994. return 0; 995. p--; ^ 996. if (*p != ' ') 997. return 0; crypto/pem/pem_lib.c:996:9: Array access: Offset: [-11, +oo] Size: [1, 241] by call to `pem_check_suffix` 994. return 0; 995. p--; 996. if (*p != ' ') ^ 997. return 0; 998. return p - pem_str;
https://github.com/openssl/openssl/blob/7671342e550ed2de676b23c79d0e7f45a381c76e/crypto/pem/pem_lib.c/#L996
d2a_code_trace_data_42881
void ssl3_cbc_digest_record(const EVP_MD_CTX *ctx, unsigned char *md_out, size_t *md_out_size, const unsigned char header[13], const unsigned char *data, size_t data_plus_mac_size, size_t data_plus_mac_plus_padding_size, const unsigned char *mac_secret, unsigned mac_secret_length, char is_sslv3) { union { double align; unsigned char c[sizeof(LARGEST_DIGEST_CTX)]; } md_state; void (*md_final_raw) (void *ctx, unsigned char *md_out); void (*md_transform) (void *ctx, const unsigned char *block); unsigned md_size, md_block_size = 64; unsigned sslv3_pad_length = 40, header_length, variance_blocks, len, max_mac_bytes, num_blocks, num_starting_blocks, k, mac_end_offset, c, index_a, index_b; unsigned int bits; unsigned char length_bytes[MAX_HASH_BIT_COUNT_BYTES]; unsigned char hmac_pad[MAX_HASH_BLOCK_SIZE]; unsigned char first_block[MAX_HASH_BLOCK_SIZE]; unsigned char mac_out[EVP_MAX_MD_SIZE]; unsigned i, j, md_out_size_u; EVP_MD_CTX md_ctx; unsigned md_length_size = 8; char length_is_big_endian = 1; int ret; OPENSSL_assert(data_plus_mac_plus_padding_size < 1024 * 1024); switch (EVP_MD_CTX_type(ctx)) { case NID_md5: MD5_Init((MD5_CTX *)md_state.c); md_final_raw = tls1_md5_final_raw; md_transform = (void (*)(void *ctx, const unsigned char *block))MD5_Transform; md_size = 16; sslv3_pad_length = 48; length_is_big_endian = 0; break; case NID_sha1: SHA1_Init((SHA_CTX *)md_state.c); md_final_raw = tls1_sha1_final_raw; md_transform = (void (*)(void *ctx, const unsigned char *block))SHA1_Transform; md_size = 20; break; case NID_sha224: SHA224_Init((SHA256_CTX *)md_state.c); md_final_raw = tls1_sha256_final_raw; md_transform = (void (*)(void *ctx, const unsigned char *block))SHA256_Transform; md_size = 224 / 8; break; case NID_sha256: SHA256_Init((SHA256_CTX *)md_state.c); md_final_raw = tls1_sha256_final_raw; md_transform = (void (*)(void *ctx, const unsigned char *block))SHA256_Transform; md_size = 32; break; case NID_sha384: SHA384_Init((SHA512_CTX *)md_state.c); md_final_raw = tls1_sha512_final_raw; md_transform = (void (*)(void *ctx, const unsigned char *block))SHA512_Transform; md_size = 384 / 8; md_block_size = 128; md_length_size = 16; break; case NID_sha512: SHA512_Init((SHA512_CTX *)md_state.c); md_final_raw = tls1_sha512_final_raw; md_transform = (void (*)(void *ctx, const unsigned char *block))SHA512_Transform; md_size = 64; md_block_size = 128; md_length_size = 16; break; default: OPENSSL_assert(0); if (md_out_size) *md_out_size = -1; return; } OPENSSL_assert(md_length_size <= MAX_HASH_BIT_COUNT_BYTES); OPENSSL_assert(md_block_size <= MAX_HASH_BLOCK_SIZE); OPENSSL_assert(md_size <= EVP_MAX_MD_SIZE); header_length = 13; if (is_sslv3) { header_length = mac_secret_length + sslv3_pad_length + 8 + 1 + 2 ; } variance_blocks = is_sslv3 ? 2 : 6; len = data_plus_mac_plus_padding_size + header_length; max_mac_bytes = len - md_size - 1; num_blocks = (max_mac_bytes + 1 + md_length_size + md_block_size - 1) / md_block_size; num_starting_blocks = 0; k = 0; mac_end_offset = data_plus_mac_size + header_length - md_size; c = mac_end_offset % md_block_size; index_a = mac_end_offset / md_block_size; index_b = (mac_end_offset + md_length_size) / md_block_size; if (num_blocks > variance_blocks + (is_sslv3 ? 1 : 0)) { num_starting_blocks = num_blocks - variance_blocks; k = md_block_size * num_starting_blocks; } bits = 8 * mac_end_offset; if (!is_sslv3) { bits += 8 * md_block_size; memset(hmac_pad, 0, md_block_size); OPENSSL_assert(mac_secret_length <= sizeof(hmac_pad)); memcpy(hmac_pad, mac_secret, mac_secret_length); for (i = 0; i < md_block_size; i++) hmac_pad[i] ^= 0x36; md_transform(md_state.c, hmac_pad); } if (length_is_big_endian) { memset(length_bytes, 0, md_length_size - 4); length_bytes[md_length_size - 4] = (unsigned char)(bits >> 24); length_bytes[md_length_size - 3] = (unsigned char)(bits >> 16); length_bytes[md_length_size - 2] = (unsigned char)(bits >> 8); length_bytes[md_length_size - 1] = (unsigned char)bits; } else { memset(length_bytes, 0, md_length_size); length_bytes[md_length_size - 5] = (unsigned char)(bits >> 24); length_bytes[md_length_size - 6] = (unsigned char)(bits >> 16); length_bytes[md_length_size - 7] = (unsigned char)(bits >> 8); length_bytes[md_length_size - 8] = (unsigned char)bits; } if (k > 0) { if (is_sslv3) { unsigned overhang = header_length - md_block_size; md_transform(md_state.c, header); memcpy(first_block, header + md_block_size, overhang); memcpy(first_block + overhang, data, md_block_size - overhang); md_transform(md_state.c, first_block); for (i = 1; i < k / md_block_size - 1; i++) md_transform(md_state.c, data + md_block_size * i - overhang); } else { memcpy(first_block, header, 13); memcpy(first_block + 13, data, md_block_size - 13); md_transform(md_state.c, first_block); for (i = 1; i < k / md_block_size; i++) md_transform(md_state.c, data + md_block_size * i - 13); } } memset(mac_out, 0, sizeof(mac_out)); for (i = num_starting_blocks; i <= num_starting_blocks + variance_blocks; i++) { unsigned char block[MAX_HASH_BLOCK_SIZE]; unsigned char is_block_a = constant_time_eq_8(i, index_a); unsigned char is_block_b = constant_time_eq_8(i, index_b); for (j = 0; j < md_block_size; j++) { unsigned char b = 0, is_past_c, is_past_cp1; if (k < header_length) b = header[k]; else if (k < data_plus_mac_plus_padding_size + header_length) b = data[k - header_length]; k++; is_past_c = is_block_a & constant_time_ge_8(j, c); is_past_cp1 = is_block_a & constant_time_ge_8(j, c + 1); b = constant_time_select_8(is_past_c, 0x80, b); b = b & ~is_past_cp1; b &= ~is_block_b | is_block_a; if (j >= md_block_size - md_length_size) { b = constant_time_select_8(is_block_b, length_bytes[j - (md_block_size - md_length_size)], b); } block[j] = b; } md_transform(md_state.c, block); md_final_raw(md_state.c, block); for (j = 0; j < md_size; j++) mac_out[j] |= block[j] & is_block_b; } EVP_MD_CTX_init(&md_ctx); EVP_DigestInit_ex(&md_ctx, ctx->digest, NULL ); if (is_sslv3) { memset(hmac_pad, 0x5c, sslv3_pad_length); EVP_DigestUpdate(&md_ctx, mac_secret, mac_secret_length); EVP_DigestUpdate(&md_ctx, hmac_pad, sslv3_pad_length); EVP_DigestUpdate(&md_ctx, mac_out, md_size); } else { for (i = 0; i < md_block_size; i++) hmac_pad[i] ^= 0x6a; EVP_DigestUpdate(&md_ctx, hmac_pad, md_block_size); EVP_DigestUpdate(&md_ctx, mac_out, md_size); } ret = EVP_DigestFinal(&md_ctx, md_out, &md_out_size_u); if (ret && md_out_size) *md_out_size = md_out_size_u; EVP_MD_CTX_cleanup(&md_ctx); } ssl/record/ssl3_record.c:824: error: INTEGER_OVERFLOW_L2 ([13, +oo] - [16, 64]):unsigned32 by call to `ssl3_cbc_digest_record`. Showing all 8 steps of the trace ssl/record/ssl3_record.c:765:1: Parameter `ssl->rlayer.rrec.orig_len` 763. } 764. 765. > int n_ssl3_mac(SSL *ssl, unsigned char *md, int send) 766. { 767. SSL3_RECORD *rec; ssl/record/ssl3_record.c:824:9: Call 822. 823. /* Final param == is SSLv3 */ 824. ssl3_cbc_digest_record(hash, ^ 825. md, &md_size, 826. header, rec->input, ssl/s3_cbc.c:176:1: <LHS trace> 174. * padding too. ) 175. */ 176. > void ssl3_cbc_digest_record(const EVP_MD_CTX *ctx, 177. unsigned char *md_out, 178. size_t *md_out_size, ssl/s3_cbc.c:176:1: Parameter `data_plus_mac_plus_padding_size` 174. * padding too. ) 175. */ 176. > void ssl3_cbc_digest_record(const EVP_MD_CTX *ctx, 177. unsigned char *md_out, 178. size_t *md_out_size, ssl/s3_cbc.c:310:5: Assignment 308. * (SSLv3) 309. */ 310. len = data_plus_mac_plus_padding_size + header_length; ^ 311. /* 312. * max_mac_bytes contains the maximum bytes of bytes in the MAC, ssl/s3_cbc.c:224:9: <RHS trace> 222. md_transform = 223. (void (*)(void *ctx, const unsigned char *block))MD5_Transform; 224. md_size = 16; ^ 225. sslv3_pad_length = 48; 226. length_is_big_endian = 0; ssl/s3_cbc.c:224:9: Assignment 222. md_transform = 223. (void (*)(void *ctx, const unsigned char *block))MD5_Transform; 224. md_size = 16; ^ 225. sslv3_pad_length = 48; 226. length_is_big_endian = 0; ssl/s3_cbc.c:315:5: Binary operation: ([13, +oo] - [16, 64]):unsigned32 by call to `ssl3_cbc_digest_record` 313. * including * |header|, assuming that there's no padding. 314. */ 315. max_mac_bytes = len - md_size - 1; ^ 316. /* num_blocks is the maximum number of hash blocks. */ 317. num_blocks =
https://github.com/openssl/openssl/blob/747e16398d704a667cc99f8a0b1912c36b7de52d/ssl/s3_cbc.c/#L315
d2a_code_trace_data_42882
void RAND_add(const void *buf, int num, double randomness) { const RAND_METHOD *meth = RAND_get_rand_method(); if (meth->add != NULL) meth->add(buf, num, randomness); } crypto/rand/rand_lib.c:782: error: NULL_DEREFERENCE pointer `meth` last assigned on line 780 could be null and is dereferenced at line 782, column 9. Showing all 14 steps of the trace crypto/rand/rand_lib.c:778:1: start of procedure RAND_add() 776. } 777. 778. > void RAND_add(const void *buf, int num, double randomness) 779. { 780. const RAND_METHOD *meth = RAND_get_rand_method(); crypto/rand/rand_lib.c:780:5: 778. void RAND_add(const void *buf, int num, double randomness) 779. { 780. > const RAND_METHOD *meth = RAND_get_rand_method(); 781. 782. if (meth->add != 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:782:9: 780. const RAND_METHOD *meth = RAND_get_rand_method(); 781. 782. > if (meth->add != NULL) 783. meth->add(buf, num, randomness); 784. }
https://github.com/openssl/openssl/blob/92ebf6c4c21ff4b41ba1fd69af74b2039e138114/crypto/rand/rand_lib.c/#L782
d2a_code_trace_data_42883
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:888: error: Uninitialized Value The value read from ymax was never initialized. libavcodec/motion_est_template.c:888:9: 886. int d; 887. //ensure that the refernece samples for hpel refinement are in the map 888. CHECK_MV(best[0]-1, best[1]) ^ 889. CHECK_MV(best[0]+1, best[1]) 890. CHECK_MV(best[0], best[1]-1)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L888
d2a_code_trace_data_42884
static int ct_base64_decode(const char *in, unsigned char **out) { size_t inlen = strlen(in); int outlen; unsigned char *outbuf = NULL; if (inlen == 0) { *out = NULL; return 0; } outlen = (inlen / 4) * 3; outbuf = OPENSSL_malloc(outlen); if (outbuf == NULL) { CTerr(CT_F_CT_BASE64_DECODE, ERR_R_MALLOC_FAILURE); goto err; } outlen = EVP_DecodeBlock(outbuf, (unsigned char *)in, inlen); if (outlen < 0) { CTerr(CT_F_CT_BASE64_DECODE, CT_R_BASE64_DECODE_ERROR); goto err; } while (in[--inlen] == '=') { --outlen; } *out = outbuf; return outlen; err: OPENSSL_free(outbuf); return -1; } test/ct_test.c:458: error: INTEGER_OVERFLOW_L1 ([-oo, 0] - 1):unsigned64 by call to `SCT_new_from_base64`. Showing all 8 steps of the trace test/ct_test.c:450:5: Array declaration 448. const char log_id[] = "3xwuwRUAlFJHqWFoMl3cXHlZ6PfG04j8AC4LvT9012Q="; 449. const uint64_t timestamp = 1; 450. const char extensions[] = ""; ^ 451. const char signature[] = "BAMARzBAMiBIL2dRrzXbplQ2vh/WZA89v5pBQpSVkkUwKI+j5" 452. "eI+BgIhAOTtwNs6xXKx4vXoq2poBlOYfc9BAn3+/6EFUZ2J7b8I"; test/ct_test.c:458:10: Call 456. 457. fixture.sct_list = sk_SCT_new_null(); 458. if (!TEST_ptr(sct = SCT_new_from_base64(SCT_VERSION_V1, log_id, ^ 459. CT_LOG_ENTRY_TYPE_X509, timestamp, 460. extensions, signature))) crypto/ct/ct_b64.c:60:1: Parameter `extensions_base64->strlen` 58. } 59. 60. > SCT *SCT_new_from_base64(unsigned char version, const char *logid_base64, 61. ct_log_entry_type_t entry_type, uint64_t timestamp, 62. const char *extensions_base64, crypto/ct/ct_b64.c:93:14: Call 91. dec = NULL; 92. 93. declen = ct_base64_decode(extensions_base64, &dec); ^ 94. if (declen < 0) { 95. CTerr(CT_F_SCT_NEW_FROM_BASE64, X509_R_BASE64_DECODE_ERROR); crypto/ct/ct_b64.c:24:1: <LHS trace> 22. * the caller. Do not provide a pre-allocated string in |out|. 23. */ 24. > static int ct_base64_decode(const char *in, unsigned char **out) 25. { 26. size_t inlen = strlen(in); crypto/ct/ct_b64.c:24:1: Parameter `in->strlen` 22. * the caller. Do not provide a pre-allocated string in |out|. 23. */ 24. > static int ct_base64_decode(const char *in, unsigned char **out) 25. { 26. size_t inlen = strlen(in); crypto/ct/ct_b64.c:26:5: Assignment 24. static int ct_base64_decode(const char *in, unsigned char **out) 25. { 26. size_t inlen = strlen(in); ^ 27. int outlen; 28. unsigned char *outbuf = NULL; crypto/ct/ct_b64.c:49:12: Binary operation: ([-oo, 0] - 1):unsigned64 by call to `SCT_new_from_base64` 47. 48. /* Subtract padding bytes from |outlen| */ 49. while (in[--inlen] == '=') { ^ 50. --outlen; 51. }
https://github.com/openssl/openssl/blob/424aa352458486d67e1e9cd3d3990dc06a60ba4a/crypto/ct/ct_b64.c/#L49
d2a_code_trace_data_42885
int BN_rshift(BIGNUM *r, const BIGNUM *a, int n) { int i, j, nw, lb, rb; BN_ULONG *t, *f; BN_ULONG l, tmp; bn_check_top(r); bn_check_top(a); if (n < 0) { BNerr(BN_F_BN_RSHIFT, BN_R_INVALID_SHIFT); return 0; } nw = n / BN_BITS2; rb = n % BN_BITS2; lb = BN_BITS2 - rb; if (nw >= a->top || a->top == 0) { BN_zero(r); return (1); } i = (BN_num_bits(a) - n + (BN_BITS2 - 1)) / BN_BITS2; if (r != a) { if (bn_wexpand(r, i) == NULL) return (0); r->neg = a->neg; } else { if (n == 0) return 1; } f = &(a->d[nw]); t = r->d; j = a->top - nw; r->top = i; if (rb == 0) { for (i = j; i != 0; i--) *(t++) = *(f++); } else { l = *(f++); for (i = j - 1; i != 0; i--) { tmp = (l >> rb) & BN_MASK2; l = *(f++); *(t++) = (tmp | (l << lb)) & BN_MASK2; } if ((l = (l >> rb) & BN_MASK2)) *(t) = l; } if (!r->top) r->neg = 0; bn_check_top(r); return (1); } test/bntest.c:1814: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_div`. Showing all 14 steps of the trace test/bntest.c:1791:10: Call 1789. 1790. /* Test that BN_mul never gives negative zero. */ 1791. if (!TEST_true(BN_set_word(a, 1))) ^ 1792. goto err; 1793. BN_set_negative(a, 1); crypto/bn/bn_lib.c:395:1: Parameter `*a->d` 393. } 394. 395. > int BN_set_word(BIGNUM *a, BN_ULONG w) 396. { 397. bn_check_top(a); crypto/bn/bn_lib.c:398:9: Call 396. { 397. bn_check_top(a); 398. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 399. return (0); 400. a->neg = 0; crypto/bn/bn_lcl.h:660:1: Parameter `*a->d` 658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 659. 660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 661. { 662. if (bits > (INT_MAX - BN_BITS2 + 1)) test/bntest.c:1814:14: Call 1812. goto err; 1813. BN_set_negative(numerator, 1); 1814. if (!TEST_true(BN_div(a, b, numerator, denominator, ctx)) ^ 1815. || !TEST_BN_eq_zero(a) 1816. || !TEST_BN_ge_zero(a)) crypto/bn/bn_div.c:140:1: Parameter `*dv->d` 138. * If 'dv' or 'rm' is NULL, the respective value is not returned. 139. */ 140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 141. BN_CTX *ctx) 142. { crypto/bn/bn_div.c:257:10: Call 255. 256. /* Setup to 'res' */ 257. if (!bn_wexpand(res, (loop + 1))) ^ 258. goto err; 259. res->neg = (num->neg ^ divisor->neg); crypto/bn/bn_lib.c:948:1: Parameter `*a->d` 946. } 947. 948. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_div.c:409:9: Call 407. */ 408. int neg = num->neg; 409. BN_rshift(rm, snum, norm_shift); ^ 410. if (!BN_is_zero(rm)) 411. rm->neg = neg; crypto/bn/bn_shift.c:122:1: <Length trace> 120. } 121. 122. > int BN_rshift(BIGNUM *r, const BIGNUM *a, int n) 123. { 124. int i, j, nw, lb, rb; crypto/bn/bn_shift.c:122:1: Parameter `*a->d` 120. } 121. 122. > int BN_rshift(BIGNUM *r, const BIGNUM *a, int n) 123. { 124. int i, j, nw, lb, rb; crypto/bn/bn_shift.c:153:5: Assignment 151. } 152. 153. f = &(a->d[nw]); ^ 154. t = r->d; 155. j = a->top - nw; crypto/bn/bn_shift.c:162:15: Assignment 160. *(t++) = *(f++); 161. } else { 162. l = *(f++); ^ 163. for (i = j - 1; i != 0; i--) { 164. tmp = (l >> rb) & BN_MASK2; crypto/bn/bn_shift.c:165:17: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_div` 163. for (i = j - 1; i != 0; i--) { 164. tmp = (l >> rb) & BN_MASK2; 165. l = *(f++); ^ 166. *(t++) = (tmp | (l << lb)) & BN_MASK2; 167. }
https://github.com/openssl/openssl/blob/3f97052392cb10fca5309212bf720685262ad4a6/crypto/bn/bn_shift.c/#L165
d2a_code_trace_data_42886
static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, const int16_t bS[7], int bsi, int qp ) { const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8); int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset; int alpha = alpha_table[index_a]; int beta = beta_table[qp - qp_bd_offset + h->slice_beta_offset]; if (alpha ==0 || beta == 0) return; if( bS[0] < 4 ) { int8_t tc[4]; tc[0] = tc0_table[index_a][bS[0*bsi]]; tc[1] = tc0_table[index_a][bS[1*bsi]]; tc[2] = tc0_table[index_a][bS[2*bsi]]; tc[3] = tc0_table[index_a][bS[3*bsi]]; h->h264dsp.h264_h_loop_filter_luma_mbaff(pix, stride, alpha, beta, tc); } else { h->h264dsp.h264_h_loop_filter_luma_mbaff_intra(pix, stride, alpha, beta); } } libavcodec/h264_loopfilter.c:717: error: Buffer Overrun L2 Offset: [1, 4] Size: 4 by call to `filter_mb_mbaff_edgev`. libavcodec/h264_loopfilter.c:684:21: Assignment 682. 683. if( IS_INTRA( mbn_type ) ) 684. bS[i] = 4; ^ 685. else{ 686. bS[i] = 1 + !!(h->non_zero_count_cache[12+8*(i>>1)] | libavcodec/h264_loopfilter.c:717:21: Call 715. if (chroma){ 716. if (CHROMA444) { 717. filter_mb_mbaff_edgev ( h, img_cb, uvlinesize, bS , 1, bqp[0] ); ^ 718. filter_mb_mbaff_edgev ( h, img_cb + 8*uvlinesize, uvlinesize, bS+4, 1, bqp[1] ); 719. filter_mb_mbaff_edgev ( h, img_cr, uvlinesize, bS , 1, rqp[0] ); libavcodec/h264_loopfilter.c:140:1: <Offset trace> 138. } 139. 140. static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, const int16_t bS[7], int bsi, int qp ) { ^ 141. const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8); 142. int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset; libavcodec/h264_loopfilter.c:140:1: Parameter `*bS` 138. } 139. 140. static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, const int16_t bS[7], int bsi, int qp ) { ^ 141. const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8); 142. int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset; libavcodec/h264_loopfilter.c:73:1: <Length trace> 71. 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 72. }; 73. static const uint8_t tc0_table[52*3][4] = { ^ 74. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, 75. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, libavcodec/h264_loopfilter.c:73:1: Array declaration 71. 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 72. }; 73. static const uint8_t tc0_table[52*3][4] = { ^ 74. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, 75. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, libavcodec/h264_loopfilter.c:149:17: Array access: Offset: [1, 4] Size: 4 by call to `filter_mb_mbaff_edgev` 147. if( bS[0] < 4 ) { 148. int8_t tc[4]; 149. tc[0] = tc0_table[index_a][bS[0*bsi]]; ^ 150. tc[1] = tc0_table[index_a][bS[1*bsi]]; 151. tc[2] = tc0_table[index_a][bS[2*bsi]];
https://github.com/libav/libav/blob/ecf026f1aa8ffe170b5b8c577cae56a405ebafc8/libavcodec/h264_loopfilter.c/#L149
d2a_code_trace_data_42887
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:1223: error: Null Dereference pointer `buf` last assigned on line 1220 could be null and is dereferenced by call to `memcpy()` at line 1223, column 5. libavcodec/imgconvert.c:1214:1: start of procedure deinterlace_bottom_field_inplace() 1212. } 1213. 1214. static void deinterlace_bottom_field_inplace(uint8_t *src1, int src_wrap, ^ 1215. int width, int height) 1216. { libavcodec/imgconvert.c:1220:5: 1218. int y; 1219. uint8_t *buf; 1220. buf = (uint8_t*)av_malloc(width); ^ 1221. 1222. src_m1 = src1; libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(unsigned int size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(unsigned int size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking true branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-16) ) ^ 73. return NULL; 74. libavutil/mem.c:73:9: 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-16) ) 73. return NULL; ^ 74. 75. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:117:1: return from a call to av_malloc 115. #endif 116. return ptr; 117. } ^ 118. 119. void *av_realloc(void *ptr, unsigned int size) libavcodec/imgconvert.c:1222:5: 1220. buf = (uint8_t*)av_malloc(width); 1221. 1222. src_m1 = src1; ^ 1223. memcpy(buf,src_m1,width); 1224. src_0=&src_m1[src_wrap]; libavcodec/imgconvert.c:1223:5: 1221. 1222. src_m1 = src1; 1223. memcpy(buf,src_m1,width); ^ 1224. src_0=&src_m1[src_wrap]; 1225. src_p1=&src_0[src_wrap];
https://github.com/libav/libav/blob/c22b4468a6e87ccaf1630d83f12f6817f9e7eff7/libavcodec/imgconvert.c/#L1223
d2a_code_trace_data_42888
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:599: error: NULL_DEREFERENCE pointer `x` last assigned on line 581 could be null and is dereferenced by call to `X509_check_ca()` at line 599, column 9. Showing all 26 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 false 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:591:8: Taking false branch 589. if (!ok) goto end; 590. } 591. if (!allow_proxy_certs && (x->ex_flags & EXFLAG_PROXY)) ^ 592. { 593. ctx->error = X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED; crypto/x509/x509_vfy.c:599:3: 597. if (!ok) goto end; 598. } 599. > ret = X509_check_ca(x); 600. switch(must_be_ca) 601. { crypto/x509v3/v3_purp.c:538:1: start of procedure X509_check_ca() 536. } 537. 538. > int X509_check_ca(X509 *x) 539. { 540. if(!(x->ex_flags & EXFLAG_SET)) { crypto/x509v3/v3_purp.c:540:7: 538. int X509_check_ca(X509 *x) 539. { 540. > if(!(x->ex_flags & EXFLAG_SET)) { 541. CRYPTO_w_lock(CRYPTO_LOCK_X509); 542. x509v3_cache_extensions(x);
https://github.com/openssl/openssl/blob/2dac2667d1ec0ffd9f5609cc07f7e1221624e152/crypto/x509/x509_vfy.c/#L599
d2a_code_trace_data_42889
int ossl_init_thread_start(uint64_t opts) { struct thread_local_inits_st *locals = ossl_init_get_thread_local(1); if (locals == NULL) return 0; if (opts & OPENSSL_INIT_THREAD_ASYNC) { #ifdef OPENSSL_INIT_DEBUG fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: " "marking thread for async\n"); #endif locals->async = 1; } if (opts & OPENSSL_INIT_THREAD_ERR_STATE) { #ifdef OPENSSL_INIT_DEBUG fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: " "marking thread for err_state\n"); #endif locals->err_state = 1; } return 1; } crypto/init.c:388: error: MEMORY_LEAK memory dynamically allocated by call to `ossl_init_get_thread_local()` at line 370, column 44 is not reachable after line 388, column 9. Showing all 38 steps of the trace crypto/init.c:368:1: start of procedure ossl_init_thread_start() 366. } 367. 368. > int ossl_init_thread_start(uint64_t opts) 369. { 370. struct thread_local_inits_st *locals = ossl_init_get_thread_local(1); crypto/init.c:370:5: 368. int ossl_init_thread_start(uint64_t opts) 369. { 370. > struct thread_local_inits_st *locals = ossl_init_get_thread_local(1); 371. 372. if (locals == NULL) crypto/init.c:86:1: start of procedure ossl_init_get_thread_local() 84. } 85. 86. > static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc) 87. { 88. struct thread_local_inits_st *local = crypto/init.c:88:5: 86. static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc) 87. { 88. > struct thread_local_inits_st *local = 89. CRYPTO_THREAD_get_local(&threadstopkey); 90. crypto/threads_pthread.c:120:1: start of procedure CRYPTO_THREAD_get_local() 118. } 119. 120. > void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key) 121. { 122. return pthread_getspecific(*key); crypto/threads_pthread.c:122:5: Skipping pthread_getspecific(): method has no implementation 120. void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key) 121. { 122. return pthread_getspecific(*key); ^ 123. } 124. crypto/threads_pthread.c:123:1: return from a call to CRYPTO_THREAD_get_local 121. { 122. return pthread_getspecific(*key); 123. > } 124. 125. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) crypto/init.c:91:9: Taking true branch 89. CRYPTO_THREAD_get_local(&threadstopkey); 90. 91. if (local == NULL && alloc) { ^ 92. local = OPENSSL_zalloc(sizeof *local); 93. CRYPTO_THREAD_set_local(&threadstopkey, local); crypto/init.c:91:26: Taking true branch 89. CRYPTO_THREAD_get_local(&threadstopkey); 90. 91. if (local == NULL && alloc) { ^ 92. local = OPENSSL_zalloc(sizeof *local); 93. CRYPTO_THREAD_set_local(&threadstopkey, local); crypto/init.c:92:9: 90. 91. if (local == NULL && alloc) { 92. > local = OPENSSL_zalloc(sizeof *local); 93. CRYPTO_THREAD_set_local(&threadstopkey, local); 94. } crypto/mem.c:146:1: start of procedure CRYPTO_zalloc() 144. } 145. 146. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 147. { 148. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:148:5: 146. void *CRYPTO_zalloc(size_t num, const char *file, int line) 147. { 148. > void *ret = CRYPTO_malloc(num, file, line); 149. 150. if (ret != NULL) crypto/mem.c:119:1: start of procedure CRYPTO_malloc() 117. } 118. 119. > void *CRYPTO_malloc(size_t num, const char *file, int line) 120. { 121. void *ret = NULL; crypto/mem.c:121:5: 119. void *CRYPTO_malloc(size_t num, const char *file, int line) 120. { 121. > void *ret = NULL; 122. 123. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:123:9: Taking false branch 121. void *ret = NULL; 122. 123. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 124. return malloc_impl(num, file, line); 125. crypto/mem.c:126:9: Taking false branch 124. return malloc_impl(num, file, line); 125. 126. if (num <= 0) ^ 127. return NULL; 128. crypto/mem.c:129:5: 127. return NULL; 128. 129. > allow_customize = 0; 130. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 131. if (call_malloc_debug) { crypto/mem.c:139:5: 137. } 138. #else 139. > osslargused(file); osslargused(line); 140. ret = malloc(num); 141. #endif crypto/mem.c:139:24: 137. } 138. #else 139. > osslargused(file); osslargused(line); 140. ret = malloc(num); 141. #endif crypto/mem.c:140:5: 138. #else 139. osslargused(file); osslargused(line); 140. > ret = malloc(num); 141. #endif 142. crypto/mem.c:143:5: 141. #endif 142. 143. > return ret; 144. } 145. crypto/mem.c:144:1: return from a call to CRYPTO_malloc 142. 143. return ret; 144. > } 145. 146. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:150:9: Taking true branch 148. void *ret = CRYPTO_malloc(num, file, line); 149. 150. if (ret != NULL) ^ 151. memset(ret, 0, num); 152. return ret; crypto/mem.c:151:9: 149. 150. if (ret != NULL) 151. > memset(ret, 0, num); 152. return ret; 153. } crypto/mem.c:152:5: 150. if (ret != NULL) 151. memset(ret, 0, num); 152. > return ret; 153. } 154. crypto/mem.c:153:1: return from a call to CRYPTO_zalloc 151. memset(ret, 0, num); 152. return ret; 153. > } 154. 155. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/init.c:93:9: 91. if (local == NULL && alloc) { 92. local = OPENSSL_zalloc(sizeof *local); 93. > CRYPTO_THREAD_set_local(&threadstopkey, local); 94. } 95. if (!alloc) { crypto/threads_pthread.c:125:1: start of procedure CRYPTO_THREAD_set_local() 123. } 124. 125. > int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) 126. { 127. if (pthread_setspecific(*key, val) != 0) crypto/threads_pthread.c:127:9: Taking true branch 125. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) 126. { 127. if (pthread_setspecific(*key, val) != 0) ^ 128. return 0; 129. crypto/threads_pthread.c:128:9: 126. { 127. if (pthread_setspecific(*key, val) != 0) 128. > return 0; 129. 130. return 1; crypto/threads_pthread.c:131:1: return from a call to CRYPTO_THREAD_set_local 129. 130. return 1; 131. > } 132. 133. int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key) crypto/init.c:95:10: Taking false branch 93. CRYPTO_THREAD_set_local(&threadstopkey, local); 94. } 95. if (!alloc) { ^ 96. CRYPTO_THREAD_set_local(&threadstopkey, NULL); 97. } crypto/init.c:99:5: 97. } 98. 99. > return local; 100. } 101. crypto/init.c:100:1: return from a call to ossl_init_get_thread_local 98. 99. return local; 100. > } 101. 102. typedef struct ossl_init_stop_st OPENSSL_INIT_STOP; crypto/init.c:372:9: Taking false branch 370. struct thread_local_inits_st *locals = ossl_init_get_thread_local(1); 371. 372. if (locals == NULL) ^ 373. return 0; 374. crypto/init.c:375:9: Taking false branch 373. return 0; 374. 375. if (opts & OPENSSL_INIT_THREAD_ASYNC) { ^ 376. #ifdef OPENSSL_INIT_DEBUG 377. fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: " crypto/init.c:383:9: Taking true branch 381. } 382. 383. if (opts & OPENSSL_INIT_THREAD_ERR_STATE) { ^ 384. #ifdef OPENSSL_INIT_DEBUG 385. fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: " crypto/init.c:388:9: 386. "marking thread for err_state\n"); 387. #endif 388. > locals->err_state = 1; 389. } 390.
https://github.com/openssl/openssl/blob/5968d11a7a28103610c054c6a57c852bbe0f3b51/crypto/init.c/#L388
d2a_code_trace_data_42890
static enum SUB_STATE_RETURN write_state_machine(SSL *s) { STATEM *st = &s->statem; int ret; enum WRITE_TRAN (*transition)(SSL *s); enum WORK_STATE (*pre_work)(SSL *s, enum WORK_STATE wst); enum WORK_STATE (*post_work)(SSL *s, enum WORK_STATE wst); int (*construct_message)(SSL *s); void (*cb) (const SSL *ssl, int type, int val) = NULL; if (s->info_callback != NULL) cb = s->info_callback; else if (s->ctx->info_callback != NULL) cb = s->ctx->info_callback; if(s->server) { transition = NULL; pre_work = NULL; post_work = NULL; construct_message = NULL; } else { transition = NULL; pre_work = NULL; post_work = NULL; construct_message = NULL; } while(1) { switch(st->write_state) { case WRITE_STATE_TRANSITION: if (cb != NULL) { if (s->server) cb(s, SSL_CB_ACCEPT_LOOP, 1); else cb(s, SSL_CB_CONNECT_LOOP, 1); } switch(transition(s)) { case WRITE_TRAN_CONTINUE: st->write_state = WRITE_STATE_PRE_WORK; st->write_state_work = WORK_MORE_A; break; case WRITE_TRAN_FINISHED: return SUB_STATE_FINISHED; break; default: return SUB_STATE_ERROR; } break; case WRITE_STATE_PRE_WORK: switch(st->write_state_work = pre_work(s, st->write_state_work)) { default: return SUB_STATE_ERROR; case WORK_FINISHED_CONTINUE: st->write_state = WRITE_STATE_SEND; break; case WORK_FINISHED_STOP: return SUB_STATE_END_HANDSHAKE; } if(construct_message(s) == 0) return SUB_STATE_ERROR; case WRITE_STATE_SEND: if (SSL_IS_DTLS(s) && st->use_timer) { dtls1_start_timer(s); } ret = statem_do_write(s); if (ret <= 0) { return SUB_STATE_ERROR; } st->write_state = WRITE_STATE_POST_WORK; st->write_state_work = WORK_MORE_A; case WRITE_STATE_POST_WORK: switch(st->write_state_work = post_work(s, st->write_state_work)) { default: return SUB_STATE_ERROR; case WORK_FINISHED_CONTINUE: st->write_state = WRITE_STATE_TRANSITION; break; case WORK_FINISHED_STOP: return SUB_STATE_END_HANDSHAKE; } break; default: return SUB_STATE_ERROR; } } } ssl/statem.c:643: error: NULL_DEREFERENCE pointer `transition` last assigned on line 621 could be null and is dereferenced at line 643, column 20. Showing all 18 steps of the trace ssl/statem.c:604:1: start of procedure write_state_machine() 602. * result in an NBIO event. 603. */ 604. > static enum SUB_STATE_RETURN write_state_machine(SSL *s) 605. { 606. STATEM *st = &s->statem; ssl/statem.c:606:5: 604. static enum SUB_STATE_RETURN write_state_machine(SSL *s) 605. { 606. > STATEM *st = &s->statem; 607. int ret; 608. enum WRITE_TRAN (*transition)(SSL *s); ssl/statem.c:612:5: 610. enum WORK_STATE (*post_work)(SSL *s, enum WORK_STATE wst); 611. int (*construct_message)(SSL *s); 612. > void (*cb) (const SSL *ssl, int type, int val) = NULL; 613. 614. if (s->info_callback != NULL) ssl/statem.c:614:9: Taking false branch 612. void (*cb) (const SSL *ssl, int type, int val) = NULL; 613. 614. if (s->info_callback != NULL) ^ 615. cb = s->info_callback; 616. else if (s->ctx->info_callback != NULL) ssl/statem.c:616:14: Taking true branch 614. if (s->info_callback != NULL) 615. cb = s->info_callback; 616. else if (s->ctx->info_callback != NULL) ^ 617. cb = s->ctx->info_callback; 618. ssl/statem.c:617:9: 615. cb = s->info_callback; 616. else if (s->ctx->info_callback != NULL) 617. > cb = s->ctx->info_callback; 618. 619. if(s->server) { ssl/statem.c:619:8: Taking true branch 617. cb = s->ctx->info_callback; 618. 619. if(s->server) { ^ 620. /* TODO: Fill these in later when we've implemented them */ 621. transition = NULL; ssl/statem.c:621:9: 619. if(s->server) { 620. /* TODO: Fill these in later when we've implemented them */ 621. > transition = NULL; 622. pre_work = NULL; 623. post_work = NULL; ssl/statem.c:622:9: 620. /* TODO: Fill these in later when we've implemented them */ 621. transition = NULL; 622. > pre_work = NULL; 623. post_work = NULL; 624. construct_message = NULL; ssl/statem.c:623:9: 621. transition = NULL; 622. pre_work = NULL; 623. > post_work = NULL; 624. construct_message = NULL; 625. } else { ssl/statem.c:624:9: 622. pre_work = NULL; 623. post_work = NULL; 624. > construct_message = NULL; 625. } else { 626. /* TODO: Fill these in later when we've implemented them */ ssl/statem.c:633:11: Loop condition is true. Entering loop body 631. } 632. 633. while(1) { ^ 634. switch(st->write_state) { 635. case WRITE_STATE_TRANSITION: ssl/statem.c:634:9: 632. 633. while(1) { 634. > switch(st->write_state) { 635. case WRITE_STATE_TRANSITION: 636. if (cb != NULL) { ssl/statem.c:635:9: Switch condition is true. Entering switch case 633. while(1) { 634. switch(st->write_state) { 635. case WRITE_STATE_TRANSITION: ^ 636. if (cb != NULL) { 637. /* Notify callback of an impending state change */ ssl/statem.c:636:17: Taking true branch 634. switch(st->write_state) { 635. case WRITE_STATE_TRANSITION: 636. if (cb != NULL) { ^ 637. /* Notify callback of an impending state change */ 638. if (s->server) ssl/statem.c:638:21: Taking true branch 636. if (cb != NULL) { 637. /* Notify callback of an impending state change */ 638. if (s->server) ^ 639. cb(s, SSL_CB_ACCEPT_LOOP, 1); 640. else ssl/statem.c:639:21: Skipping __function_pointer__(): unresolved function pointer 637. /* Notify callback of an impending state change */ 638. if (s->server) 639. cb(s, SSL_CB_ACCEPT_LOOP, 1); ^ 640. else 641. cb(s, SSL_CB_CONNECT_LOOP, 1); ssl/statem.c:643:13: 641. cb(s, SSL_CB_CONNECT_LOOP, 1); 642. } 643. > switch(transition(s)) { 644. case WRITE_TRAN_CONTINUE: 645. st->write_state = WRITE_STATE_PRE_WORK;
https://github.com/openssl/openssl/blob/f8e0a5573820bd7318782d4954c6643ff7e58102/ssl/statem.c/#L643
d2a_code_trace_data_42891
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:264: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_div`. Showing all 15 steps of the trace test/bntest.c:264:9: Call 262. a->neg = rand_neg(); 263. b->neg = rand_neg(); 264. BN_mod(c, a, b, ctx); ^ 265. BN_div(d, e, a, b, ctx); 266. BN_sub(e, e, c); crypto/bn/bn_div.c:140:1: Parameter `ctx->stack.depth` 138. * If 'dv' or 'rm' is NULL, the respective value is not returned. 139. */ 140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 141. BN_CTX *ctx) 142. { test/bntest.c:265:9: Call 263. b->neg = rand_neg(); 264. BN_mod(c, a, b, ctx); 265. BN_div(d, e, a, b, ctx); ^ 266. BN_sub(e, e, c); 267. if (!TEST_BN_eq_zero(e)) crypto/bn/bn_div.c:140:1: Parameter `ctx->stack.depth` 138. * If 'dv' or 'rm' is NULL, the respective value is not returned. 139. */ 140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 141. BN_CTX *ctx) 142. { test/bntest.c:264:9: Call 262. a->neg = rand_neg(); 263. b->neg = rand_neg(); 264. BN_mod(c, a, b, ctx); ^ 265. BN_div(d, e, a, b, ctx); 266. BN_sub(e, e, c); crypto/bn/bn_div.c:193:5: Call 191. } 192. 193. BN_CTX_start(ctx); ^ 194. tmp = BN_CTX_get(ctx); 195. snum = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:416:5: Call 414. if (no_branch) 415. bn_correct_top(res); 416. BN_CTX_end(ctx); ^ 417. return (1); 418. err: crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.indexes` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:271:1: <Offset trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `st->depth` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: <Length trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `*st->indexes` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:273:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_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/3f97052392cb10fca5309212bf720685262ad4a6/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_42892
static int cert_status_cb(SSL *s, void *arg) { tlsextstatusctx *srctx = arg; BIO *err = srctx->err; char *host, *port, *path; int use_ssl; unsigned char *rspder = NULL; int rspderlen; STACK_OF(OPENSSL_STRING) *aia = NULL; X509 *x = NULL; X509_STORE_CTX inctx; X509_OBJECT obj; OCSP_REQUEST *req = NULL; OCSP_RESPONSE *resp = NULL; OCSP_CERTID *id = NULL; STACK_OF(X509_EXTENSION) *exts; int ret = SSL_TLSEXT_ERR_NOACK; int i; #if 0 STACK_OF(OCSP_RESPID) *ids; SSL_get_tlsext_status_ids(s, &ids); BIO_printf(err, "cert_status: received %d ids\n", sk_OCSP_RESPID_num(ids)); #endif if (srctx->verbose) BIO_puts(err, "cert_status: callback called\n"); x = SSL_get_certificate(s); aia = X509_get1_ocsp(x); if (aia) { if (!OCSP_parse_url(sk_OPENSSL_STRING_value(aia, 0), &host, &port, &path, &use_ssl)) { BIO_puts(err, "cert_status: can't parse AIA URL\n"); goto err; } if (srctx->verbose) BIO_printf(err, "cert_status: AIA URL: %s\n", sk_OPENSSL_STRING_value(aia, 0)); } else { if (!srctx->host) { BIO_puts(srctx->err, "cert_status: no AIA and no default responder URL\n"); goto done; } host = srctx->host; path = srctx->path; port = srctx->port; use_ssl = srctx->use_ssl; } if (!X509_STORE_CTX_init(&inctx, SSL_CTX_get_cert_store(SSL_get_SSL_CTX(s)), NULL, NULL)) goto err; if (X509_STORE_get_by_subject(&inctx,X509_LU_X509, X509_get_issuer_name(x),&obj) <= 0) { BIO_puts(err, "cert_status: Can't retrieve issuer certificate.\n"); X509_STORE_CTX_cleanup(&inctx); goto done; } req = OCSP_REQUEST_new(); if (!req) goto err; id = OCSP_cert_to_id(NULL, x, obj.data.x509); X509_free(obj.data.x509); X509_STORE_CTX_cleanup(&inctx); if (!id) goto err; if (!OCSP_request_add0_id(req, id)) goto err; id = NULL; SSL_get_tlsext_status_exts(s, &exts); for (i = 0; i < sk_X509_EXTENSION_num(exts); i++) { X509_EXTENSION *ext = sk_X509_EXTENSION_value(exts, i); if (!OCSP_REQUEST_add_ext(req, ext, -1)) goto err; } resp = process_responder(err, req, host, path, port, use_ssl, NULL, srctx->timeout); if (!resp) { BIO_puts(err, "cert_status: error querying responder\n"); goto done; } rspderlen = i2d_OCSP_RESPONSE(resp, &rspder); if (rspderlen <= 0) goto err; SSL_set_tlsext_status_ocsp_resp(s, rspder, rspderlen); if (srctx->verbose) { BIO_puts(err, "cert_status: ocsp response sent:\n"); OCSP_RESPONSE_print(err, resp, 2); } ret = SSL_TLSEXT_ERR_OK; done: if (ret != SSL_TLSEXT_ERR_OK) ERR_print_errors(err); if (aia) { OPENSSL_free(host); OPENSSL_free(path); OPENSSL_free(port); X509_email_free(aia); } if (id) OCSP_CERTID_free(id); if (req) OCSP_REQUEST_free(req); if (resp) OCSP_RESPONSE_free(resp); return ret; err: ret = SSL_TLSEXT_ERR_ALERT_FATAL; goto done; } apps/s_server.c:820: error: NULL_DEREFERENCE pointer `x` last assigned on line 819 could be null and is dereferenced by call to `X509_get1_ocsp()` at line 820, column 8. Showing all 31 steps of the trace apps/s_server.c:793:1: start of procedure cert_status_cb() 791. */ 792. 793. > static int cert_status_cb(SSL *s, void *arg) 794. { 795. tlsextstatusctx *srctx = arg; apps/s_server.c:795:2: 793. static int cert_status_cb(SSL *s, void *arg) 794. { 795. > tlsextstatusctx *srctx = arg; 796. BIO *err = srctx->err; 797. char *host, *port, *path; apps/s_server.c:796:2: 794. { 795. tlsextstatusctx *srctx = arg; 796. > BIO *err = srctx->err; 797. char *host, *port, *path; 798. int use_ssl; apps/s_server.c:799:2: 797. char *host, *port, *path; 798. int use_ssl; 799. > unsigned char *rspder = NULL; 800. int rspderlen; 801. STACK_OF(OPENSSL_STRING) *aia = NULL; apps/s_server.c:801:2: 799. unsigned char *rspder = NULL; 800. int rspderlen; 801. > STACK_OF(OPENSSL_STRING) *aia = NULL; 802. X509 *x = NULL; 803. X509_STORE_CTX inctx; apps/s_server.c:802:2: 800. int rspderlen; 801. STACK_OF(OPENSSL_STRING) *aia = NULL; 802. > X509 *x = NULL; 803. X509_STORE_CTX inctx; 804. X509_OBJECT obj; apps/s_server.c:805:2: 803. X509_STORE_CTX inctx; 804. X509_OBJECT obj; 805. > OCSP_REQUEST *req = NULL; 806. OCSP_RESPONSE *resp = NULL; 807. OCSP_CERTID *id = NULL; apps/s_server.c:806:2: 804. X509_OBJECT obj; 805. OCSP_REQUEST *req = NULL; 806. > OCSP_RESPONSE *resp = NULL; 807. OCSP_CERTID *id = NULL; 808. STACK_OF(X509_EXTENSION) *exts; apps/s_server.c:807:2: 805. OCSP_REQUEST *req = NULL; 806. OCSP_RESPONSE *resp = NULL; 807. > OCSP_CERTID *id = NULL; 808. STACK_OF(X509_EXTENSION) *exts; 809. int ret = SSL_TLSEXT_ERR_NOACK; apps/s_server.c:809:2: 807. OCSP_CERTID *id = NULL; 808. STACK_OF(X509_EXTENSION) *exts; 809. > int ret = SSL_TLSEXT_ERR_NOACK; 810. int i; 811. #if 0 apps/s_server.c:816:6: Taking true branch 814. BIO_printf(err, "cert_status: received %d ids\n", sk_OCSP_RESPID_num(ids)); 815. #endif 816. if (srctx->verbose) ^ 817. BIO_puts(err, "cert_status: callback called\n"); 818. /* Build up OCSP query from server certificate */ apps/s_server.c:817:3: 815. #endif 816. if (srctx->verbose) 817. > BIO_puts(err, "cert_status: callback called\n"); 818. /* Build up OCSP query from server certificate */ 819. x = SSL_get_certificate(s); crypto/bio/bio_lib.c:257:1: start of procedure BIO_puts() 255. } 256. 257. > int BIO_puts(BIO *b, const char *in) 258. { 259. int i; crypto/bio/bio_lib.c:262:7: Taking false branch 260. long (*cb)(BIO *,int,const char *,int,long,long); 261. 262. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) ^ 263. { 264. BIOerr(BIO_F_BIO_PUTS,BIO_R_UNSUPPORTED_METHOD); crypto/bio/bio_lib.c:262:22: Taking false branch 260. long (*cb)(BIO *,int,const char *,int,long,long); 261. 262. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) ^ 263. { 264. BIOerr(BIO_F_BIO_PUTS,BIO_R_UNSUPPORTED_METHOD); crypto/bio/bio_lib.c:262:45: Taking false branch 260. long (*cb)(BIO *,int,const char *,int,long,long); 261. 262. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) ^ 263. { 264. BIOerr(BIO_F_BIO_PUTS,BIO_R_UNSUPPORTED_METHOD); crypto/bio/bio_lib.c:268:2: 266. } 267. 268. > cb=b->callback; 269. 270. if ((cb != NULL) && crypto/bio/bio_lib.c:270:7: Taking false branch 268. cb=b->callback; 269. 270. if ((cb != NULL) && ^ 271. ((i=(int)cb(b,BIO_CB_PUTS,in,0,0L,1L)) <= 0)) 272. return(i); crypto/bio/bio_lib.c:274:7: Taking false branch 272. return(i); 273. 274. if (!b->init) ^ 275. { 276. BIOerr(BIO_F_BIO_PUTS,BIO_R_UNINITIALIZED); crypto/bio/bio_lib.c:280:2: Skipping __function_pointer__(): unresolved function pointer 278. } 279. 280. i=b->method->bputs(b,in); ^ 281. 282. if (i > 0) b->num_write+=(unsigned long)i; crypto/bio/bio_lib.c:282:6: Taking true branch 280. i=b->method->bputs(b,in); 281. 282. if (i > 0) b->num_write+=(unsigned long)i; ^ 283. 284. if (cb != NULL) crypto/bio/bio_lib.c:282:13: 280. i=b->method->bputs(b,in); 281. 282. > if (i > 0) b->num_write+=(unsigned long)i; 283. 284. if (cb != NULL) crypto/bio/bio_lib.c:284:6: Taking false branch 282. if (i > 0) b->num_write+=(unsigned long)i; 283. 284. if (cb != NULL) ^ 285. i=(int)cb(b,BIO_CB_PUTS|BIO_CB_RETURN,in,0, 286. 0L,(long)i); crypto/bio/bio_lib.c:287:2: 285. i=(int)cb(b,BIO_CB_PUTS|BIO_CB_RETURN,in,0, 286. 0L,(long)i); 287. > return(i); 288. } 289. crypto/bio/bio_lib.c:288:2: return from a call to BIO_puts 286. 0L,(long)i); 287. return(i); 288. } ^ 289. 290. int BIO_gets(BIO *b, char *in, int inl) apps/s_server.c:819:2: 817. BIO_puts(err, "cert_status: callback called\n"); 818. /* Build up OCSP query from server certificate */ 819. > x = SSL_get_certificate(s); 820. aia = X509_get1_ocsp(x); 821. if (aia) ssl/ssl_lib.c:2879:1: start of procedure SSL_get_certificate() 2877. 2878. /* Fix this function so that it takes an optional type parameter */ 2879. > X509 *SSL_get_certificate(const SSL *s) 2880. { 2881. if (s->cert != NULL) ssl/ssl_lib.c:2881:6: Taking false branch 2879. X509 *SSL_get_certificate(const SSL *s) 2880. { 2881. if (s->cert != NULL) ^ 2882. return(s->cert->key->x509); 2883. else ssl/ssl_lib.c:2884:3: 2882. return(s->cert->key->x509); 2883. else 2884. > return(NULL); 2885. } 2886. ssl/ssl_lib.c:2885:2: return from a call to SSL_get_certificate 2883. else 2884. return(NULL); 2885. } ^ 2886. 2887. /* Fix this function so that it takes an optional type parameter */ apps/s_server.c:820:2: 818. /* Build up OCSP query from server certificate */ 819. x = SSL_get_certificate(s); 820. > aia = X509_get1_ocsp(x); 821. if (aia) 822. {
https://github.com/openssl/openssl/blob/1c16fd1f033816c98b96a41691625c0c2788e805/apps/s_server.c/#L820
d2a_code_trace_data_42893
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { if (!ossl_assert(pkt->subs != NULL && len != 0)) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } if (allocbytes != NULL) *allocbytes = WPACKET_get_curr(pkt); return 1; } ssl/statem/extensions_srvr.c:979: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 6]):unsigned64 by call to `tls_construct_cert_status_body`. Showing all 14 steps of the trace ssl/statem/extensions_srvr.c:969:17: Call 967. 968. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_status_request) 969. || !WPACKET_start_sub_packet_u16(pkt)) { ^ 970. SSLerr(SSL_F_TLS_CONSTRUCT_STOC_STATUS_REQUEST, ERR_R_INTERNAL_ERROR); 971. return EXT_RETURN_FAIL; ssl/packet.c:270:1: Parameter `pkt->buf->length` 268. } 269. 270. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 271. { 272. WPACKET_SUB *sub; ssl/statem/extensions_srvr.c:979:30: Call 977. * separate message 978. */ 979. if ((SSL_IS_TLS13(s) && !tls_construct_cert_status_body(s, pkt)) ^ 980. || !WPACKET_close(pkt)) { 981. SSLerr(SSL_F_TLS_CONSTRUCT_STOC_STATUS_REQUEST, ERR_R_INTERNAL_ERROR); ssl/statem/statem_srvr.c:3557:1: Parameter `pkt->written` 3555. * create a separate message. Returns 1 on success or 0 on failure. 3556. */ 3557. > int tls_construct_cert_status_body(SSL *s, WPACKET *pkt) 3558. { 3559. if (!WPACKET_put_bytes_u8(pkt, s->ext.status_type) ssl/statem/statem_srvr.c:3559:10: Call 3557. int tls_construct_cert_status_body(SSL *s, WPACKET *pkt) 3558. { 3559. if (!WPACKET_put_bytes_u8(pkt, s->ext.status_type) ^ 3560. || !WPACKET_sub_memcpy_u24(pkt, s->ext.ocsp.resp, 3561. s->ext.ocsp.resp_len)) { 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 + 6]):unsigned64 by call to `tls_construct_cert_status_body` 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_42894
static in_addr_t * ngx_resolver_rotate(ngx_resolver_t *r, in_addr_t *src, ngx_uint_t n) { void *dst, *p; ngx_uint_t j; dst = ngx_resolver_alloc(r, n * sizeof(in_addr_t)); j = ngx_random() % n; if (j == 0) { ngx_memcpy(dst, src, n * sizeof(in_addr_t)); return dst; } p = ngx_cpymem(dst, &src[j], (n - j) * sizeof(in_addr_t)); ngx_memcpy(p, src, j * sizeof(in_addr_t)); return dst; } src/core/ngx_resolver.c:2154: error: Null Dereference pointer `dst` last assigned on line 2145 could be null and is dereferenced by call to `memcpy()` at line 2154, column 9. src/core/ngx_resolver.c:2139:1: start of procedure ngx_resolver_rotate() 2137. 2138. 2139. static in_addr_t * ^ 2140. ngx_resolver_rotate(ngx_resolver_t *r, in_addr_t *src, ngx_uint_t n) 2141. { src/core/ngx_resolver.c:2145:5: 2143. ngx_uint_t j; 2144. 2145. dst = ngx_resolver_alloc(r, n * sizeof(in_addr_t)); ^ 2146. 2147. j = ngx_random() % n; src/core/ngx_resolver.c:2074:1: start of procedure ngx_resolver_alloc() 2072. 2073. 2074. static void * ^ 2075. ngx_resolver_alloc(ngx_resolver_t *r, size_t size) 2076. { src/core/ngx_resolver.c:2081:5: 2079. /* lock alloc mutex */ 2080. 2081. p = ngx_alloc(size, r->log); ^ 2082. 2083. /* unlock alloc mutex */ src/os/unix/ngx_alloc.c:17:1: start of procedure ngx_alloc() 15. 16. 17. void * ^ 18. ngx_alloc(size_t size, ngx_log_t *log) 19. { src/os/unix/ngx_alloc.c:22:5: 20. void *p; 21. 22. p = malloc(size); ^ 23. if (p == NULL) { 24. ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, src/os/unix/ngx_alloc.c:23:9: Taking true branch 21. 22. p = malloc(size); 23. if (p == NULL) { ^ 24. ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, 25. "malloc(%uz) failed", size); src/os/unix/ngx_alloc.c:24:9: Taking true branch 22. p = malloc(size); 23. if (p == NULL) { 24. ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, ^ 25. "malloc(%uz) failed", size); 26. } src/os/unix/ngx_alloc.c:30:5: 28. ngx_log_debug2(NGX_LOG_DEBUG_ALLOC, log, 0, "malloc: %p:%uz", p, size); 29. 30. return p; ^ 31. } 32. src/os/unix/ngx_alloc.c:31:1: return from a call to ngx_alloc 29. 30. return p; 31. } ^ 32. 33. src/core/ngx_resolver.c:2085:5: 2083. /* unlock alloc mutex */ 2084. 2085. return p; ^ 2086. } 2087. src/core/ngx_resolver.c:2086:1: return from a call to ngx_resolver_alloc 2084. 2085. return p; 2086. } ^ 2087. 2088. src/core/ngx_resolver.c:2147:5: 2145. dst = ngx_resolver_alloc(r, n * sizeof(in_addr_t)); 2146. 2147. j = ngx_random() % n; ^ 2148. 2149. if (j == 0) { src/core/ngx_resolver.c:2149:9: Taking false branch 2147. j = ngx_random() % n; 2148. 2149. if (j == 0) { ^ 2150. ngx_memcpy(dst, src, n * sizeof(in_addr_t)); 2151. return dst; src/core/ngx_resolver.c:2154:5: 2152. } 2153. 2154. p = ngx_cpymem(dst, &src[j], (n - j) * sizeof(in_addr_t)); ^ 2155. ngx_memcpy(p, src, j * sizeof(in_addr_t)); 2156.
https://github.com/nginx/nginx/blob/74ad4494a66d7ea5201c37f6628707404df723fe/src/core/ngx_resolver.c/#L2154
d2a_code_trace_data_42895
DECLAREContigPutFunc(put1bitcmaptile) { uint32** PALmap = img->PALmap; (void) x; (void) y; fromskew /= 8; while (h-- > 0) { uint32* bw; UNROLL8(w, bw = PALmap[*pp++], *cp++ = *bw++); cp += toskew; pp += fromskew; } } libtiff/tif_getimage.c:1129: error: Integer Overflow L2 ([0, `h`] - 1):unsigned32. libtiff/tif_getimage.c:1123:1: <LHS trace> 1121. * 1-bit palette => colormap/RGB 1122. */ 1123. DECLAREContigPutFunc(put1bitcmaptile) ^ 1124. { 1125. uint32** PALmap = img->PALmap; libtiff/tif_getimage.c:1123:1: Parameter `h` 1121. * 1-bit palette => colormap/RGB 1122. */ 1123. DECLAREContigPutFunc(put1bitcmaptile) ^ 1124. { 1125. uint32** PALmap = img->PALmap; libtiff/tif_getimage.c:1129:12: Binary operation: ([0, h] - 1):unsigned32 1127. (void) x; (void) y; 1128. fromskew /= 8; 1129. while (h-- > 0) { ^ 1130. uint32* bw; 1131. UNROLL8(w, bw = PALmap[*pp++], *cp++ = *bw++);
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_getimage.c/#L1129
d2a_code_trace_data_42896
static void fmtfp(char **sbuffer, char **buffer, size_t *currlen, size_t *maxlen, LDOUBLE fvalue, int min, int max, int flags) { int signvalue = 0; LDOUBLE ufvalue; char iconvert[20]; char fconvert[20]; int iplace = 0; int fplace = 0; int padlen = 0; int zpadlen = 0; int caps = 0; long intpart; long fracpart; long max10; if (max < 0) max = 6; ufvalue = abs_val(fvalue); if (fvalue < 0) signvalue = '-'; else if (flags & DP_F_PLUS) signvalue = '+'; else if (flags & DP_F_SPACE) signvalue = ' '; intpart = (long)ufvalue; if (max > 9) max = 9; max10 = roundv(pow_10(max)); fracpart = roundv(pow_10(max) * (ufvalue - intpart)); if (fracpart >= max10) { intpart++; fracpart -= max10; } do { iconvert[iplace++] = (caps ? "0123456789ABCDEF" : "0123456789abcdef")[intpart % 10]; intpart = (intpart / 10); } while (intpart && (iplace < (int)sizeof(iconvert))); if (iplace == sizeof iconvert) iplace--; iconvert[iplace] = 0; do { fconvert[fplace++] = (caps ? "0123456789ABCDEF" : "0123456789abcdef")[fracpart % 10]; fracpart = (fracpart / 10); } while (fplace < max); if (fplace == sizeof fconvert) fplace--; fconvert[fplace] = 0; padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0); zpadlen = max - fplace; if (zpadlen < 0) zpadlen = 0; if (padlen < 0) padlen = 0; if (flags & DP_F_MINUS) padlen = -padlen; if ((flags & DP_F_ZERO) && (padlen > 0)) { if (signvalue) { doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue); --padlen; signvalue = 0; } while (padlen > 0) { doapr_outch(sbuffer, buffer, currlen, maxlen, '0'); --padlen; } } while (padlen > 0) { doapr_outch(sbuffer, buffer, currlen, maxlen, ' '); --padlen; } if (signvalue) doapr_outch(sbuffer, buffer, currlen, maxlen, signvalue); while (iplace > 0) doapr_outch(sbuffer, buffer, currlen, maxlen, iconvert[--iplace]); if (max > 0 || (flags & DP_F_NUM)) { doapr_outch(sbuffer, buffer, currlen, maxlen, '.'); while (fplace > 0) doapr_outch(sbuffer, buffer, currlen, maxlen, fconvert[--fplace]); } while (zpadlen > 0) { doapr_outch(sbuffer, buffer, currlen, maxlen, '0'); --zpadlen; } while (padlen < 0) { doapr_outch(sbuffer, buffer, currlen, maxlen, ' '); ++padlen; } } crypto/bio/b_print.c:634: error: BUFFER_OVERRUN_L3 Offset: [-9, 9] Size: 17. Showing all 11 steps of the trace crypto/bio/b_print.c:581:1: <Offset trace> 579. } 580. 581. > static void 582. fmtfp(char **sbuffer, 583. char **buffer, crypto/bio/b_print.c:581:1: Parameter `fvalue` 579. } 580. 581. > static void 582. fmtfp(char **sbuffer, 583. char **buffer, crypto/bio/b_print.c:602:15: Call 600. if (max < 0) 601. max = 6; 602. ufvalue = abs_val(fvalue); ^ 603. if (fvalue < 0) 604. signvalue = '-'; crypto/bio/b_print.c:553:1: Parameter `value` 551. } 552. 553. > static LDOUBLE abs_val(LDOUBLE value) 554. { 555. LDOUBLE result = value; crypto/bio/b_print.c:555:5: Assignment 553. static LDOUBLE abs_val(LDOUBLE value) 554. { 555. LDOUBLE result = value; ^ 556. if (value < 0) 557. result = -value; crypto/bio/b_print.c:558:5: Assignment 556. if (value < 0) 557. result = -value; 558. return result; ^ 559. } 560. crypto/bio/b_print.c:602:5: Assignment 600. if (max < 0) 601. max = 6; 602. ufvalue = abs_val(fvalue); ^ 603. if (fvalue < 0) 604. signvalue = '-'; crypto/bio/b_print.c:610:5: Assignment 608. signvalue = ' '; 609. 610. intpart = (long)ufvalue; ^ 611. 612. /* crypto/bio/b_print.c:634:14: <Length trace> 632. do { 633. iconvert[iplace++] = 634. (caps ? "0123456789ABCDEF" : "0123456789abcdef")[intpart % 10]; ^ 635. intpart = (intpart / 10); 636. } while (intpart && (iplace < (int)sizeof(iconvert))); crypto/bio/b_print.c:634:14: Array declaration 632. do { 633. iconvert[iplace++] = 634. (caps ? "0123456789ABCDEF" : "0123456789abcdef")[intpart % 10]; ^ 635. intpart = (intpart / 10); 636. } while (intpart && (iplace < (int)sizeof(iconvert))); crypto/bio/b_print.c:634:13: Array access: Offset: [-9, 9] Size: 17 632. do { 633. iconvert[iplace++] = 634. (caps ? "0123456789ABCDEF" : "0123456789abcdef")[intpart % 10]; ^ 635. intpart = (intpart / 10); 636. } while (intpart && (iplace < (int)sizeof(iconvert)));
https://github.com/openssl/openssl/blob/9c46f4b9cd4912b61cb546c48b678488d7f26ed6/crypto/bio/b_print.c/#L634
d2a_code_trace_data_42897
static void doapr_outch(char **sbuffer, char **buffer, size_t *currlen, size_t *maxlen, int c) { assert(*sbuffer != NULL || buffer != NULL); if (buffer) { while (*currlen >= *maxlen) { if (*buffer == NULL) { if (*maxlen == 0) *maxlen = 1024; *buffer = OPENSSL_malloc(*maxlen); if(!*buffer) { return; } if (*currlen > 0) { assert(*sbuffer != NULL); memcpy(*buffer, *sbuffer, *currlen); } *sbuffer = NULL; } else { *maxlen += 1024; *buffer = OPENSSL_realloc(*buffer, *maxlen); if(!*buffer) { return; } } } assert(*sbuffer != NULL || *buffer != NULL); } if (*currlen < *maxlen) { if (*sbuffer) (*sbuffer)[(*currlen)++] = (char)c; else (*buffer)[(*currlen)++] = (char)c; } return; } crypto/bio/bio_cb.c:107: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] (⇐ [-1, 2147483647] + [0, +oo]) Size: 256 by call to `BIO_snprintf`. Showing all 14 steps of the trace crypto/bio/bio_cb.c:66:1: Array declaration 64. #include <openssl/err.h> 65. 66. > long BIO_debug_callback(BIO *bio, int cmd, const char *argp, 67. int argi, long argl, long ret) 68. { crypto/bio/bio_cb.c:81:5: Assignment 79. len = BIO_snprintf(buf,sizeof buf,"BIO[%p]: ",(void *)bio); 80. 81. p = buf + len; ^ 82. p_maxlen = sizeof(buf) - len; 83. crypto/bio/bio_cb.c:107:9: Call 105. break; 106. case BIO_CB_PUTS: 107. BIO_snprintf(p, p_maxlen, "puts() - %s\n", bio->method->name); ^ 108. break; 109. case BIO_CB_GETS: crypto/bio/b_print.c:794:1: Parameter `*buf` 792. * function should be renamed, but to what?) 793. */ 794. > int BIO_snprintf(char *buf, size_t n, const char *format, ...) 795. { 796. va_list args; crypto/bio/b_print.c:801:11: Call 799. va_start(args, format); 800. 801. ret = BIO_vsnprintf(buf, n, format, args); ^ 802. 803. va_end(args); crypto/bio/b_print.c:807:1: Parameter `*buf` 805. } 806. 807. > int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args) 808. { 809. size_t retlen; crypto/bio/b_print.c:812:5: Call 810. int truncated; 811. 812. _dopr(&buf, NULL, &n, &retlen, &truncated, format, args); ^ 813. 814. if (truncated) crypto/bio/b_print.c:168:1: Parameter `*maxlen` 166. #define OSSL_MAX(p,q) ((p >= q) ? p : q) 167. 168. > static void 169. _dopr(char **sbuffer, 170. char **buffer, crypto/bio/b_print.c:199:17: Call 197. state = DP_S_FLAGS; 198. else 199. doapr_outch(sbuffer, buffer, &currlen, maxlen, ch); ^ 200. ch = *format++; 201. break; crypto/bio/b_print.c:703:1: <Offset trace> 701. } 702. 703. > static void 704. doapr_outch(char **sbuffer, 705. char **buffer, size_t *currlen, size_t *maxlen, int c) crypto/bio/b_print.c:703:1: Parameter `*maxlen` 701. } 702. 703. > static void 704. doapr_outch(char **sbuffer, 705. char **buffer, size_t *currlen, size_t *maxlen, int c) crypto/bio/b_print.c:703:1: <Length trace> 701. } 702. 703. > static void 704. doapr_outch(char **sbuffer, 705. char **buffer, size_t *currlen, size_t *maxlen, int c) crypto/bio/b_print.c:703:1: Parameter `**sbuffer` 701. } 702. 703. > static void 704. doapr_outch(char **sbuffer, 705. char **buffer, size_t *currlen, size_t *maxlen, int c) crypto/bio/b_print.c:740:13: Array access: Offset: [-1, +oo] (⇐ [-1, 2147483647] + [0, +oo]) Size: 256 by call to `BIO_snprintf` 738. if (*currlen < *maxlen) { 739. if (*sbuffer) 740. (*sbuffer)[(*currlen)++] = (char)c; ^ 741. else 742. (*buffer)[(*currlen)++] = (char)c;
https://github.com/openssl/openssl/blob/ac5a110621ca48f0bebd5b4d76d081de403da29e/crypto/bio/b_print.c/#L740
d2a_code_trace_data_42898
static unsigned int fixup_vorbis_headers(AVFormatContext * as, struct oggvorbis_private *priv, uint8_t **buf) { int i,offset, len; unsigned char *ptr; len = priv->len[0] + priv->len[1] + priv->len[2]; ptr = *buf = av_mallocz(len + len/255 + 64); ptr[0] = 2; offset = 1; offset += av_xiphlacing(&ptr[offset], priv->len[0]); offset += av_xiphlacing(&ptr[offset], priv->len[1]); for (i = 0; i < 3; i++) { memcpy(&ptr[offset], priv->packet[i], priv->len[i]); offset += priv->len[i]; av_freep(&priv->packet[i]); } *buf = av_realloc(*buf, offset + FF_INPUT_BUFFER_PADDING_SIZE); return offset; } libavformat/oggparsevorbis.c:177: error: Null Dereference pointer `ptr` last assigned on line 175 could be null and is dereferenced at line 177, column 5. libavformat/oggparsevorbis.c:167:1: start of procedure fixup_vorbis_headers() 165. 166. 167. static unsigned int ^ 168. fixup_vorbis_headers(AVFormatContext * as, struct oggvorbis_private *priv, 169. uint8_t **buf) libavformat/oggparsevorbis.c:174:5: 172. unsigned char *ptr; 173. 174. len = priv->len[0] + priv->len[1] + priv->len[2]; ^ 175. ptr = *buf = av_mallocz(len + len/255 + 64); 176. libavformat/oggparsevorbis.c:175:5: 173. 174. len = priv->len[0] + priv->len[1] + priv->len[2]; 175. ptr = *buf = av_mallocz(len + len/255 + 64); ^ 176. 177. ptr[0] = 2; libavutil/mem.c:156:1: start of procedure av_mallocz() 154. } 155. 156. void *av_mallocz(FF_INTERNAL_MEM_TYPE size) ^ 157. { 158. void *ptr = av_malloc(size); libavutil/mem.c:158:5: 156. void *av_mallocz(FF_INTERNAL_MEM_TYPE size) 157. { 158. void *ptr = av_malloc(size); ^ 159. if (ptr) 160. memset(ptr, 0, size); libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(FF_INTERNAL_MEM_TYPE size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(FF_INTERNAL_MEM_TYPE size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking true branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-16) ) ^ 73. return NULL; 74. libavutil/mem.c:73:9: 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-16) ) 73. return NULL; ^ 74. 75. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:117:1: return from a call to av_malloc 115. #endif 116. return ptr; 117. } ^ 118. 119. void *av_realloc(void *ptr, FF_INTERNAL_MEM_TYPE size) libavutil/mem.c:159:9: Taking false branch 157. { 158. void *ptr = av_malloc(size); 159. if (ptr) ^ 160. memset(ptr, 0, size); 161. return ptr; libavutil/mem.c:161:5: 159. if (ptr) 160. memset(ptr, 0, size); 161. return ptr; ^ 162. } 163. libavutil/mem.c:162:1: return from a call to av_mallocz 160. memset(ptr, 0, size); 161. return ptr; 162. } ^ 163. 164. char *av_strdup(const char *s) libavformat/oggparsevorbis.c:177:5: 175. ptr = *buf = av_mallocz(len + len/255 + 64); 176. 177. ptr[0] = 2; ^ 178. offset = 1; 179. offset += av_xiphlacing(&ptr[offset], priv->len[0]);
https://github.com/libav/libav/blob/47fdf00a77e82a0e30422ed08d5b295e9ae8d506/libavformat/oggparsevorbis.c/#L177
d2a_code_trace_data_42899
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:244: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_mod_exp`. Showing all 26 steps of the trace apps/s_client.c:231:1: Parameter `N->top` 229. # define SRP_NUMBER_ITERATIONS_FOR_PRIME 64 230. 231. > static int srp_Verify_N_and_g(const BIGNUM *N, const BIGNUM *g) 232. { 233. BN_CTX *bn_ctx = BN_CTX_new(); apps/s_client.c:237:53: Call 235. BIGNUM *r = BN_new(); 236. int ret = 237. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && ^ 238. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 && 239. p != NULL && BN_rshift1(p, N) && crypto/bn/bn_lib.c:867:1: Parameter `a->top` 865. } 866. 867. > int BN_is_odd(const BIGNUM *a) 868. { 869. return (a->top > 0) && (a->d[0] & 1); apps/s_client.c:238:9: Call 236. int ret = 237. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && 238. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 && ^ 239. p != NULL && BN_rshift1(p, N) && 240. /* p = (N-1)/2 */ crypto/bn/bn_prime.c:147:1: Parameter `a->top` 145. } 146. 147. > int BN_is_prime_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 148. BN_GENCB *cb) 149. { crypto/bn/bn_prime.c:150:12: Call 148. BN_GENCB *cb) 149. { 150. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb); ^ 151. } 152. crypto/bn/bn_prime.c:153:1: Parameter `a->top` 151. } 152. 153. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 154. int do_trial_division, BN_GENCB *cb) 155. { crypto/bn/bn_prime.c:162:9: Call 160. BN_MONT_CTX *mont = NULL; 161. 162. if (BN_cmp(a, BN_value_one()) <= 0) ^ 163. return 0; 164. crypto/bn/bn_lib.c:577:1: Parameter `a->top` 575. } 576. 577. > int BN_cmp(const BIGNUM *a, const BIGNUM *b) 578. { 579. int i; apps/s_client.c:239:22: Call 237. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && 238. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 && 239. p != NULL && BN_rshift1(p, N) && ^ 240. /* p = (N-1)/2 */ 241. 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:852:1: Parameter `a->top` 850. } 851. 852. > int BN_is_zero(const BIGNUM *a) 853. { 854. return a->top == 0; apps/s_client.c:244:9: Call 242. r != NULL && 243. /* verify g^((N-1)/2) == -1 (mod N) */ 244. BN_mod_exp(r, g, p, N, bn_ctx) && ^ 245. BN_add_word(r, 1) && BN_cmp(r, N) == 0; 246. crypto/bn/bn_exp.c:91:1: Parameter `m->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:136:9: Call 134. 135. #ifdef MONT_MUL_MOD 136. if (BN_is_odd(m)) { ^ 137. # ifdef MONT_EXP_WORD 138. if (a->top == 1 && !a->neg crypto/bn/bn_lib.c:867:1: Parameter `a->top` 865. } 866. 867. > int BN_is_odd(const BIGNUM *a) 868. { 869. 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:198:14: Call 196. if (m->neg) { 197. /* ignore sign of 'm' */ 198. if (!BN_copy(aa, m)) ^ 199. goto err; 200. aa->neg = 0; crypto/bn/bn_lib.c:323:1: <Offset trace> 321. } 322. 323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 324. { 325. bn_check_top(b); crypto/bn/bn_lib.c:323:1: Parameter `b->top` 321. } 322. 323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 324. { 325. bn_check_top(b); crypto/bn/bn_lib.c:323:1: <Length trace> 321. } 322. 323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 324. { 325. bn_check_top(b); 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:333:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_mod_exp` 331. 332. if (b->top > 0) 333. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); ^ 334. 335. a->top = b->top;
https://github.com/openssl/openssl/blob/757264207ad8650a89ea903d48ad89f61d56ea9c/crypto/bn/bn_lib.c/#L333
d2a_code_trace_data_42900
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:2532: error: NULL_DEREFERENCE pointer `f` last assigned on line 2531 could be null and is dereferenced by call to `fgets()` at line 2532, column 9. Showing all 9 steps of the trace apps/speed.c:2495:1: start of procedure do_multi() 2493. 2494. #ifdef HAVE_FORK 2495. > static int do_multi(int multi) 2496. { 2497. int n; apps/speed.c:2500:2: 2498. int fd[2]; 2499. int *fds; 2500. > static char sep[]=":"; 2501. 2502. fds=malloc(multi*sizeof *fds); apps/speed.c:2502:2: 2500. static char sep[]=":"; 2501. 2502. > fds=malloc(multi*sizeof *fds); 2503. for(n=0 ; n < multi ; ++n) 2504. { apps/speed.c:2503:6: 2501. 2502. fds=malloc(multi*sizeof *fds); 2503. > for(n=0 ; n < multi ; ++n) 2504. { 2505. pipe(fd); apps/speed.c:2503:12: Loop condition is false. Leaving loop 2501. 2502. fds=malloc(multi*sizeof *fds); 2503. for(n=0 ; n < multi ; ++n) ^ 2504. { 2505. pipe(fd); apps/speed.c:2525:6: 2523. 2524. /* for now, assume the pipe is long enough to take all the output */ 2525. > for(n=0 ; n < multi ; ++n) 2526. { 2527. FILE *f; apps/speed.c:2525:12: Loop condition is true. Entering loop body 2523. 2524. /* for now, assume the pipe is long enough to take all the output */ 2525. for(n=0 ; n < multi ; ++n) ^ 2526. { 2527. FILE *f; apps/speed.c:2531:3: 2529. char *p; 2530. 2531. > f=fdopen(fds[n],"r"); 2532. while(fgets(buf,sizeof buf,f)) 2533. { apps/speed.c:2532:9: 2530. 2531. f=fdopen(fds[n],"r"); 2532. > while(fgets(buf,sizeof buf,f)) 2533. { 2534. p=strchr(buf,'\n');
https://github.com/openssl/openssl/blob/03ddbdd9b99ea60d0967b831ffc1fe93ae7f9792/apps/speed.c/#L2532
d2a_code_trace_data_42901
int RAND_poll(void) { int ret = 0; RAND_POOL *pool = NULL; const RAND_METHOD *meth = RAND_get_rand_method(); if (meth == RAND_OpenSSL()) { RAND_DRBG *drbg = RAND_DRBG_get0_master(); if (drbg == NULL) return 0; rand_drbg_lock(drbg); ret = rand_drbg_restart(drbg, NULL, 0, 0); rand_drbg_unlock(drbg); return ret; } else { pool = rand_pool_new(RAND_DRBG_STRENGTH, (RAND_DRBG_STRENGTH + 7) / 8, RAND_POOL_MAX_LENGTH); if (pool == NULL) return 0; if (rand_pool_acquire_entropy(pool) == 0) goto err; if (meth->add == NULL || meth->add(rand_pool_buffer(pool), rand_pool_length(pool), (rand_pool_entropy(pool) / 8.0)) == 0) goto err; ret = 1; } err: rand_pool_free(pool); return ret; } crypto/rand/rand_lib.c:402: error: NULL_DEREFERENCE pointer `meth` last assigned on line 376 could be null and is dereferenced at line 402, column 13. Showing all 24 steps of the trace crypto/rand/rand_lib.c:370:1: start of procedure RAND_poll() 368. * configurable via the --with-rand-seed configure option. 369. */ 370. > int RAND_poll(void) 371. { 372. int ret = 0; crypto/rand/rand_lib.c:372:5: 370. int RAND_poll(void) 371. { 372. > int ret = 0; 373. 374. RAND_POOL *pool = NULL; crypto/rand/rand_lib.c:374:5: 372. int ret = 0; 373. 374. > RAND_POOL *pool = NULL; 375. 376. const RAND_METHOD *meth = RAND_get_rand_method(); crypto/rand/rand_lib.c:376:5: 374. RAND_POOL *pool = NULL; 375. 376. > const RAND_METHOD *meth = RAND_get_rand_method(); 377. 378. if (meth == RAND_OpenSSL()) { crypto/rand/rand_lib.c:726:1: start of procedure RAND_get_rand_method() 724. } 725. 726. > const RAND_METHOD *RAND_get_rand_method(void) 727. { 728. const RAND_METHOD *tmp_meth = NULL; crypto/rand/rand_lib.c:728:5: 726. const RAND_METHOD *RAND_get_rand_method(void) 727. { 728. > const RAND_METHOD *tmp_meth = NULL; 729. 730. if (!RUN_ONCE(&rand_init, do_rand_init)) crypto/rand/rand_lib.c:730:10: 728. const RAND_METHOD *tmp_meth = NULL; 729. 730. > if (!RUN_ONCE(&rand_init, do_rand_init)) 731. return NULL; 732. 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:730:10: Condition is false 728. const RAND_METHOD *tmp_meth = NULL; 729. 730. if (!RUN_ONCE(&rand_init, do_rand_init)) ^ 731. return NULL; 732. crypto/rand/rand_lib.c:730:10: Taking true branch 728. const RAND_METHOD *tmp_meth = NULL; 729. 730. if (!RUN_ONCE(&rand_init, do_rand_init)) ^ 731. return NULL; 732. crypto/rand/rand_lib.c:731:9: 729. 730. if (!RUN_ONCE(&rand_init, do_rand_init)) 731. > return NULL; 732. 733. CRYPTO_THREAD_write_lock(rand_meth_lock); crypto/rand/rand_lib.c:754:1: return from a call to RAND_get_rand_method 752. CRYPTO_THREAD_unlock(rand_meth_lock); 753. return tmp_meth; 754. > } 755. 756. #ifndef OPENSSL_NO_ENGINE crypto/rand/rand_lib.c:378:9: 376. const RAND_METHOD *meth = RAND_get_rand_method(); 377. 378. > if (meth == RAND_OpenSSL()) { 379. /* fill random pool and seed the master DRBG */ 380. RAND_DRBG *drbg = RAND_DRBG_get0_master(); crypto/rand/drbg_lib.c:1232:1: start of procedure RAND_OpenSSL() 1230. }; 1231. 1232. > RAND_METHOD *RAND_OpenSSL(void) 1233. { 1234. return &rand_meth; crypto/rand/drbg_lib.c:1234:5: 1232. RAND_METHOD *RAND_OpenSSL(void) 1233. { 1234. > return &rand_meth; 1235. } crypto/rand/drbg_lib.c:1235:1: return from a call to RAND_OpenSSL 1233. { 1234. return &rand_meth; 1235. > } crypto/rand/rand_lib.c:378:9: Taking false branch 376. const RAND_METHOD *meth = RAND_get_rand_method(); 377. 378. if (meth == RAND_OpenSSL()) { ^ 379. /* fill random pool and seed the master DRBG */ 380. RAND_DRBG *drbg = RAND_DRBG_get0_master(); crypto/rand/rand_lib.c:393:9: Skipping rand_pool_new(): empty list of specs 391. } else { 392. /* fill random pool and seed the current legacy RNG */ 393. pool = rand_pool_new(RAND_DRBG_STRENGTH, ^ 394. (RAND_DRBG_STRENGTH + 7) / 8, 395. RAND_POOL_MAX_LENGTH); crypto/rand/rand_lib.c:396:13: Taking false branch 394. (RAND_DRBG_STRENGTH + 7) / 8, 395. RAND_POOL_MAX_LENGTH); 396. if (pool == NULL) ^ 397. return 0; 398. crypto/rand/rand_lib.c:399:13: Taking false branch 397. return 0; 398. 399. if (rand_pool_acquire_entropy(pool) == 0) ^ 400. goto err; 401. crypto/rand/rand_lib.c:402:13: 400. goto err; 401. 402. > if (meth->add == NULL 403. || meth->add(rand_pool_buffer(pool), 404. rand_pool_length(pool),
https://github.com/openssl/openssl/blob/9bba2c4c97a5fc5aea9e24223eebb85a15817e74/crypto/rand/rand_lib.c/#L402
d2a_code_trace_data_42902
static ossl_inline void packet_forward(PACKET *pkt, size_t len) { pkt->curr += len; pkt->remaining -= len; } test/sslapitest.c:4612: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 4):unsigned64 by call to `PACKET_forward`. Showing all 12 steps of the trace test/sslapitest.c:4608:10: Call 4606. memset(&pkt3, 0, sizeof(pkt3)); 4607. 4608. if (!TEST_true( PACKET_buf_init( &pkt, data, len ) ) ^ 4609. /* Skip the record header */ 4610. || !PACKET_forward(&pkt, SSL3_RT_HEADER_LENGTH) ssl/packet_locl.h:68:8: Parameter `pkt->remaining` 66. * is being used. 67. */ 68. __owur static ossl_inline int PACKET_buf_init(PACKET *pkt, ^ 69. const unsigned char *buf, 70. size_t len) test/sslapitest.c:4610:17: Call 4608. if (!TEST_true( PACKET_buf_init( &pkt, data, len ) ) 4609. /* Skip the record header */ 4610. || !PACKET_forward(&pkt, SSL3_RT_HEADER_LENGTH) ^ 4611. /* Skip the handshake message header */ 4612. || !TEST_true(PACKET_forward(&pkt, SSL3_HM_HEADER_LENGTH)) ssl/packet_locl.h:463:8: Parameter `len` 461. 462. /* Move the current reading position forward |len| bytes */ 463. __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len) ^ 464. { 465. if (PACKET_remaining(pkt) < len) test/sslapitest.c:4612:17: Call 4610. || !PACKET_forward(&pkt, SSL3_RT_HEADER_LENGTH) 4611. /* Skip the handshake message header */ 4612. || !TEST_true(PACKET_forward(&pkt, SSL3_HM_HEADER_LENGTH)) ^ 4613. /* Skip client version and random */ 4614. || !TEST_true(PACKET_forward(&pkt, CLIENT_VERSION_LEN ssl/packet_locl.h:463:8: Parameter `len` 461. 462. /* Move the current reading position forward |len| bytes */ 463. __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len) ^ 464. { 465. if (PACKET_remaining(pkt) < len) ssl/packet_locl.h:468:5: Call 466. return 0; 467. 468. packet_forward(pkt, len); ^ 469. 470. return 1; ssl/packet_locl.h:29:1: <LHS trace> 27. 28. /* Internal unchecked shorthand; don't use outside this file. */ 29. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 30. { 31. pkt->curr += len; ssl/packet_locl.h:29:1: Parameter `pkt->remaining` 27. 28. /* Internal unchecked shorthand; don't use outside this file. */ 29. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 30. { 31. pkt->curr += len; ssl/packet_locl.h:29:1: <RHS trace> 27. 28. /* Internal unchecked shorthand; don't use outside this file. */ 29. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 30. { 31. pkt->curr += len; ssl/packet_locl.h:29:1: Parameter `len` 27. 28. /* Internal unchecked shorthand; don't use outside this file. */ 29. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 30. { 31. pkt->curr += len; ssl/packet_locl.h:32:5: Binary operation: ([0, +oo] - 4):unsigned64 by call to `PACKET_forward` 30. { 31. pkt->curr += len; 32. pkt->remaining -= len; ^ 33. } 34.
https://github.com/openssl/openssl/blob/2e6b615f795e8ca8ae830a00079c4ea064eaae42/ssl/packet_locl.h/#L32
d2a_code_trace_data_42903
TXT_DB *TXT_DB_read(BIO *in, int num) { TXT_DB *ret = NULL; int esc = 0; long ln = 0; int i, add, n; int size = BUFSIZE; int offset = 0; char *p, *f; OPENSSL_STRING *pp; BUF_MEM *buf = NULL; if ((buf = BUF_MEM_new()) == NULL) goto err; if (!BUF_MEM_grow(buf, size)) goto err; if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) goto err; ret->num_fields = num; ret->index = NULL; ret->qual = NULL; if ((ret->data = sk_OPENSSL_PSTRING_new_null()) == NULL) goto err; if ((ret->index = OPENSSL_malloc(sizeof(*ret->index) * num)) == NULL) goto err; if ((ret->qual = OPENSSL_malloc(sizeof(*(ret->qual)) * num)) == NULL) goto err; for (i = 0; i < num; i++) { ret->index[i] = NULL; ret->qual[i] = NULL; } add = (num + 1) * sizeof(char *); buf->data[size - 1] = '\0'; offset = 0; for (;;) { if (offset != 0) { size += BUFSIZE; if (!BUF_MEM_grow_clean(buf, size)) goto err; } buf->data[offset] = '\0'; BIO_gets(in, &(buf->data[offset]), size - offset); ln++; if (buf->data[offset] == '\0') break; if ((offset == 0) && (buf->data[0] == '#')) continue; i = strlen(&(buf->data[offset])); offset += i; if (buf->data[offset - 1] != '\n') continue; else { buf->data[offset - 1] = '\0'; if ((p = OPENSSL_malloc(add + offset)) == NULL) goto err; offset = 0; } pp = (char **)p; p += add; n = 0; pp[n++] = p; i = 0; f = buf->data; esc = 0; for (;;) { if (*f == '\0') break; if (*f == '\t') { if (esc) p--; else { *(p++) = '\0'; f++; if (n >= num) break; pp[n++] = p; continue; } } esc = (*f == '\\'); *(p++) = *(f++); } *(p++) = '\0'; if ((n != num) || (*f != '\0')) { OPENSSL_free(pp); ret->error = DB_ERROR_WRONG_NUM_FIELDS; goto err; } pp[n] = p; if (!sk_OPENSSL_PSTRING_push(ret->data, pp)) { OPENSSL_free(pp); goto err; } } BUF_MEM_free(buf); return ret; err: BUF_MEM_free(buf); if (ret != NULL) { sk_OPENSSL_PSTRING_free(ret->data); OPENSSL_free(ret->index); OPENSSL_free(ret->qual); OPENSSL_free(ret); } return NULL; } test/sslapitest.c:3849: error: BUFFER_OVERRUN_L3 Offset: [55, +oo] Size: [1, +oo] by call to `TXT_DB_read`. Showing all 6 steps of the trace test/sslapitest.c:3849:10: Call 3847. * in it! 3848. */ 3849. db = TXT_DB_read(dummy, DB_NUMBER); ^ 3850. if (!TEST_ptr(db)) 3851. goto end; crypto/txt_db/txt_db.c:20:1: <Length trace> 18. #define BUFSIZE 512 19. 20. > TXT_DB *TXT_DB_read(BIO *in, int num) 21. { 22. TXT_DB *ret = NULL; crypto/txt_db/txt_db.c:20:1: Parameter `num` 18. #define BUFSIZE 512 19. 20. > TXT_DB *TXT_DB_read(BIO *in, int num) 21. { 22. TXT_DB *ret = NULL; crypto/txt_db/txt_db.c:53:5: Assignment 51. } 52. 53. add = (num + 1) * sizeof(char *); ^ 54. buf->data[size - 1] = '\0'; 55. offset = 0; crypto/txt_db/txt_db.c:80:9: Assignment 78. } 79. pp = (char **)p; 80. p += add; ^ 81. n = 0; 82. pp[n++] = p; crypto/txt_db/txt_db.c:103:13: Array access: Offset: [55, +oo] Size: [1, +oo] by call to `TXT_DB_read` 101. } 102. esc = (*f == '\\'); 103. *(p++) = *(f++); ^ 104. } 105. *(p++) = '\0';
https://github.com/openssl/openssl/blob/a8ca496ddb532d7f7dc356fd2b026697388d2384/crypto/txt_db/txt_db.c/#L103
d2a_code_trace_data_42904
int tls13_export_keying_material(SSL *s, unsigned char *out, size_t olen, const char *label, size_t llen, const unsigned char *context, size_t contextlen, int use_context) { unsigned char exportsecret[EVP_MAX_MD_SIZE]; static const unsigned char exporterlabel[] = "exporter"; unsigned char hash[EVP_MAX_MD_SIZE], data[EVP_MAX_MD_SIZE]; const EVP_MD *md = ssl_handshake_md(s); EVP_MD_CTX *ctx = EVP_MD_CTX_new(); unsigned int hashsize, datalen; int ret = 0; if (ctx == NULL || !ossl_statem_export_allowed(s)) goto err; if (!use_context) contextlen = 0; if (EVP_DigestInit_ex(ctx, md, NULL) <= 0 || EVP_DigestUpdate(ctx, context, contextlen) <= 0 || EVP_DigestFinal_ex(ctx, hash, &hashsize) <= 0 || EVP_DigestInit_ex(ctx, md, NULL) <= 0 || EVP_DigestFinal_ex(ctx, data, &datalen) <= 0 || !tls13_hkdf_expand(s, md, s->exporter_master_secret, (const unsigned char *)label, llen, data, datalen, exportsecret, hashsize) || !tls13_hkdf_expand(s, md, exportsecret, exporterlabel, sizeof(exporterlabel) - 1, hash, hashsize, out, olen)) goto err; ret = 1; err: EVP_MD_CTX_free(ctx); return ret; } ssl/tls13_enc.c:745: error: MEMORY_LEAK memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 720, column 23 is not reachable after line 745, column 5. Showing all 51 steps of the trace ssl/tls13_enc.c:711:1: start of procedure tls13_export_keying_material() 709. } 710. 711. > int tls13_export_keying_material(SSL *s, unsigned char *out, size_t olen, 712. const char *label, size_t llen, 713. const unsigned char *context, ssl/tls13_enc.c:717:5: 715. { 716. unsigned char exportsecret[EVP_MAX_MD_SIZE]; 717. > static const unsigned char exporterlabel[] = "exporter"; 718. unsigned char hash[EVP_MAX_MD_SIZE], data[EVP_MAX_MD_SIZE]; 719. const EVP_MD *md = ssl_handshake_md(s); ssl/tls13_enc.c:719:5: 717. static const unsigned char exporterlabel[] = "exporter"; 718. unsigned char hash[EVP_MAX_MD_SIZE], data[EVP_MAX_MD_SIZE]; 719. > const EVP_MD *md = ssl_handshake_md(s); 720. EVP_MD_CTX *ctx = EVP_MD_CTX_new(); 721. unsigned int hashsize, datalen; test/tls13secretstest.c:171:1: start of procedure ssl_handshake_md() 169. } 170. 171. > const EVP_MD *ssl_handshake_md(SSL *s) 172. { 173. return EVP_sha256(); test/tls13secretstest.c:173:5: 171. const EVP_MD *ssl_handshake_md(SSL *s) 172. { 173. > return EVP_sha256(); 174. } 175. crypto/evp/m_sha1.c:177:1: start of procedure EVP_sha256() 175. }; 176. 177. > const EVP_MD *EVP_sha256(void) 178. { 179. return &sha256_md; crypto/evp/m_sha1.c:179:5: 177. const EVP_MD *EVP_sha256(void) 178. { 179. > return &sha256_md; 180. } 181. crypto/evp/m_sha1.c:180:1: return from a call to EVP_sha256 178. { 179. return &sha256_md; 180. > } 181. 182. static int init512_224(EVP_MD_CTX *ctx) test/tls13secretstest.c:174:1: return from a call to ssl_handshake_md 172. { 173. return EVP_sha256(); 174. > } 175. 176. void RECORD_LAYER_reset_read_sequence(RECORD_LAYER *rl) ssl/tls13_enc.c:720:5: 718. unsigned char hash[EVP_MAX_MD_SIZE], data[EVP_MAX_MD_SIZE]; 719. const EVP_MD *md = ssl_handshake_md(s); 720. > EVP_MD_CTX *ctx = EVP_MD_CTX_new(); 721. unsigned int hashsize, datalen; 722. int ret = 0; crypto/evp/digest.c:44:1: start of procedure EVP_MD_CTX_new() 42. } 43. 44. > EVP_MD_CTX *EVP_MD_CTX_new(void) 45. { 46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); crypto/evp/digest.c:46:5: 44. EVP_MD_CTX *EVP_MD_CTX_new(void) 45. { 46. > return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 47. } 48. crypto/mem.c: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/evp/digest.c:47:1: return from a call to EVP_MD_CTX_new 45. { 46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 47. > } 48. 49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) ssl/tls13_enc.c:722:5: 720. EVP_MD_CTX *ctx = EVP_MD_CTX_new(); 721. unsigned int hashsize, datalen; 722. > int ret = 0; 723. 724. if (ctx == NULL || !ossl_statem_export_allowed(s)) ssl/tls13_enc.c:724:9: Taking false branch 722. int ret = 0; 723. 724. if (ctx == NULL || !ossl_statem_export_allowed(s)) ^ 725. goto err; 726. ssl/tls13_enc.c:724:25: 722. int ret = 0; 723. 724. > if (ctx == NULL || !ossl_statem_export_allowed(s)) 725. goto err; 726. test/tls13secretstest.c:215:1: start of procedure ossl_statem_export_allowed() 213. } 214. 215. > int ossl_statem_export_allowed(SSL *s) 216. { 217. return 1; test/tls13secretstest.c:217:5: 215. int ossl_statem_export_allowed(SSL *s) 216. { 217. > return 1; 218. } 219. test/tls13secretstest.c:218:1: return from a call to ossl_statem_export_allowed 216. { 217. return 1; 218. > } 219. 220. int ossl_statem_export_early_allowed(SSL *s) ssl/tls13_enc.c:724:25: Taking false branch 722. int ret = 0; 723. 724. if (ctx == NULL || !ossl_statem_export_allowed(s)) ^ 725. goto err; 726. ssl/tls13_enc.c:727:10: Taking false branch 725. goto err; 726. 727. if (!use_context) ^ 728. contextlen = 0; 729. ssl/tls13_enc.c:730:9: Taking true branch 728. contextlen = 0; 729. 730. if (EVP_DigestInit_ex(ctx, md, NULL) <= 0 ^ 731. || EVP_DigestUpdate(ctx, context, contextlen) <= 0 732. || EVP_DigestFinal_ex(ctx, hash, &hashsize) <= 0 ssl/tls13_enc.c:744:2: 742. 743. ret = 1; 744. > err: 745. EVP_MD_CTX_free(ctx); 746. return ret; ssl/tls13_enc.c:745:5: 743. ret = 1; 744. err: 745. > EVP_MD_CTX_free(ctx); 746. return ret; 747. } crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_free() 47. } 48. 49. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 50. { 51. EVP_MD_CTX_reset(ctx); crypto/evp/digest.c:51:5: Skipping EVP_MD_CTX_reset(): empty list of specs 49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 50. { 51. EVP_MD_CTX_reset(ctx); ^ 52. OPENSSL_free(ctx); 53. } crypto/evp/digest.c:52:5: 50. { 51. EVP_MD_CTX_reset(ctx); 52. > OPENSSL_free(ctx); 53. } 54. crypto/mem.c:295:1: start of procedure CRYPTO_free() 293. } 294. 295. > void CRYPTO_free(void *str, const char *file, int line) 296. { 297. INCREMENT(free_count); crypto/mem.c:298:9: Taking true branch 296. { 297. INCREMENT(free_count); 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 299. free_impl(str, file, line); 300. return; crypto/mem.c:298:30: Taking true branch 296. { 297. INCREMENT(free_count); 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 299. free_impl(str, file, line); 300. return; crypto/mem.c:299:9: Skipping __function_pointer__(): unresolved function pointer 297. INCREMENT(free_count); 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { 299. free_impl(str, file, line); ^ 300. return; 301. } crypto/mem.c:300:9: 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { 299. free_impl(str, file, line); 300. > return; 301. } 302. crypto/mem.c:314:1: return from a call to CRYPTO_free 312. free(str); 313. #endif 314. > } 315. 316. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/evp/digest.c:53:1: return from a call to EVP_MD_CTX_free 51. EVP_MD_CTX_reset(ctx); 52. OPENSSL_free(ctx); 53. > } 54. 55. int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
https://github.com/openssl/openssl/blob/fbccfedf9bb0840e6c2db54b66ac511b85a3f587/ssl/tls13_enc.c/#L745
d2a_code_trace_data_42905
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:535: error: Integer Overflow L2 ([1, +oo] - 6):unsigned32 by call to `bitstream_read`. libavcodec/takdec.c:535:32: Call 533. prev = 0; 534. for (; i < nb_subframes - 1; i++) { 535. int subframe_end = bitstream_read(bc, 6) * s->subframe_scale; ^ 536. if (subframe_end <= prev) 537. return AVERROR_INVALIDDATA; 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] - 6):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_42906
static int stream_reqbody_read(proxy_http_req_t *req, apr_bucket_brigade *bb, int nonblocking) { request_rec *r = req->r; proxy_conn_rec *p_conn = req->backend; apr_bucket_alloc_t *bucket_alloc = req->bucket_alloc; apr_read_type_e block = nonblocking ? APR_NONBLOCK_READ : APR_BLOCK_READ; apr_status_t status; int rv; for (;;) { status = ap_get_brigade(r->input_filters, bb, AP_MODE_READBYTES, block, HUGE_STRING_LEN); if (block == APR_BLOCK_READ || (!APR_STATUS_IS_EAGAIN(status) && (status != APR_SUCCESS || !APR_BRIGADE_EMPTY(bb)))) { break; } apr_brigade_cleanup(bb); rv = ap_proxy_pass_brigade(bucket_alloc, r, p_conn, req->origin, bb, 1); if (rv != OK) { return rv; } block = APR_BLOCK_READ; } if (status != APR_SUCCESS) { conn_rec *c = r->connection; ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(02608) "read request body failed to %pI (%s)" " from %s (%s)", p_conn->addr, p_conn->hostname ? p_conn->hostname: "", c->client_ip, c->remote_host ? c->remote_host: ""); return ap_map_http_request_error(status, HTTP_BAD_REQUEST); } return OK; } modules/proxy/mod_proxy_http.c:295: error: UNINITIALIZED_VALUE The value read from status was never initialized. modules/proxy/mod_proxy_http.c:295:9: 293. if (status != APR_SUCCESS) { 294. conn_rec *c = r->connection; 295. ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(02608) ^ 296. "read request body failed to %pI (%s)" 297. " from %s (%s)", p_conn->addr,
https://github.com/apache/httpd/blob/04b4d0f94f75bdcc6338baf129b08c9c6c6ce87e/modules/proxy/mod_proxy_http.c/#L295
d2a_code_trace_data_42907
static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest, X509 *x, X509 *xca, EVP_PKEY *pkey, char *serialfile, int create, int days, int clrext, CONF *conf, char *section, ASN1_INTEGER *sno) { int ret=0; ASN1_INTEGER *bs=NULL; X509_STORE_CTX xsc; EVP_PKEY *upkey; upkey = X509_get_pubkey(xca); EVP_PKEY_copy_parameters(upkey,pkey); EVP_PKEY_free(upkey); if(!X509_STORE_CTX_init(&xsc,ctx,x,NULL)) { BIO_printf(bio_err,"Error initialising X509 store\n"); goto end; } if (sno) bs = sno; else if (!(bs = x509_load_serial(CAfile, serialfile, create))) goto end; X509_STORE_CTX_set_cert(&xsc,x); X509_STORE_CTX_set_flags(&xsc, X509_V_FLAG_CHECK_SS_SIGNATURE); if (!reqfile && X509_verify_cert(&xsc) <= 0) goto end; if (!X509_check_private_key(xca,pkey)) { BIO_printf(bio_err,"CA certificate and CA private key do not match\n"); goto end; } if (!X509_set_issuer_name(x,X509_get_subject_name(xca))) goto end; if (!X509_set_serialNumber(x,bs)) goto end; if (X509_gmtime_adj(X509_get_notBefore(x),0L) == NULL) goto end; if (X509_time_adj_ex(X509_get_notAfter(x),days, 0, NULL) == NULL) goto end; if (clrext) { while (X509_get_ext_count(x) > 0) X509_delete_ext(x, 0); } if (conf) { X509V3_CTX ctx2; X509_set_version(x,2); X509V3_set_ctx(&ctx2, xca, x, NULL, NULL, 0); X509V3_set_nconf(&ctx2, conf); if (!X509V3_EXT_add_nconf(conf, &ctx2, section, x)) goto end; } if (!X509_sign(x,pkey,digest)) goto end; ret=1; end: X509_STORE_CTX_cleanup(&xsc); if (!ret) ERR_print_errors(bio_err); if (!sno) ASN1_INTEGER_free(bs); return ret; } apps/x509.c:1145: error: NULL_DEREFERENCE pointer `upkey` last assigned on line 1144 could be null and is dereferenced by call to `EVP_PKEY_copy_parameters()` at line 1145, column 2. Showing all 19 steps of the trace apps/x509.c:1135:1: start of procedure x509_certify() 1133. } 1134. 1135. > static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest, 1136. X509 *x, X509 *xca, EVP_PKEY *pkey, char *serialfile, int create, 1137. int days, int clrext, CONF *conf, char *section, ASN1_INTEGER *sno) apps/x509.c:1139:2: 1137. int days, int clrext, CONF *conf, char *section, ASN1_INTEGER *sno) 1138. { 1139. > int ret=0; 1140. ASN1_INTEGER *bs=NULL; 1141. X509_STORE_CTX xsc; apps/x509.c:1140:2: 1138. { 1139. int ret=0; 1140. > ASN1_INTEGER *bs=NULL; 1141. X509_STORE_CTX xsc; 1142. EVP_PKEY *upkey; apps/x509.c:1144:2: 1142. EVP_PKEY *upkey; 1143. 1144. > upkey = X509_get_pubkey(xca); 1145. EVP_PKEY_copy_parameters(upkey,pkey); 1146. EVP_PKEY_free(upkey); crypto/x509/x509_cmp.c:296:1: start of procedure X509_get_pubkey() 294. } 295. 296. > EVP_PKEY *X509_get_pubkey(X509 *x) 297. { 298. if ((x == NULL) || (x->cert_info == NULL)) crypto/x509/x509_cmp.c:298:7: Taking false branch 296. EVP_PKEY *X509_get_pubkey(X509 *x) 297. { 298. if ((x == NULL) || (x->cert_info == NULL)) ^ 299. return(NULL); 300. return(X509_PUBKEY_get(x->cert_info->key)); crypto/x509/x509_cmp.c:298:22: Taking false branch 296. EVP_PKEY *X509_get_pubkey(X509 *x) 297. { 298. if ((x == NULL) || (x->cert_info == NULL)) ^ 299. return(NULL); 300. return(X509_PUBKEY_get(x->cert_info->key)); crypto/x509/x509_cmp.c:300:2: 298. if ((x == NULL) || (x->cert_info == NULL)) 299. return(NULL); 300. > return(X509_PUBKEY_get(x->cert_info->key)); 301. } 302. crypto/asn1/x_pubkey.c:133:1: start of procedure X509_PUBKEY_get() 131. } 132. 133. > EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) 134. { 135. EVP_PKEY *ret=NULL; crypto/asn1/x_pubkey.c:135:2: 133. EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) 134. { 135. > EVP_PKEY *ret=NULL; 136. 137. if (key == NULL) goto error; crypto/asn1/x_pubkey.c:137:6: Taking false branch 135. EVP_PKEY *ret=NULL; 136. 137. if (key == NULL) goto error; ^ 138. 139. if (key->pkey != NULL) crypto/asn1/x_pubkey.c:139:6: Taking false branch 137. if (key == NULL) goto error; 138. 139. if (key->pkey != NULL) ^ 140. { 141. CRYPTO_add(&key->pkey->references, 1, CRYPTO_LOCK_EVP_PKEY); crypto/asn1/x_pubkey.c:145:6: Taking true branch 143. } 144. 145. if (key->public_key == NULL) goto error; ^ 146. 147. if ((ret = EVP_PKEY_new()) == NULL) crypto/asn1/x_pubkey.c:179:2: 177. return ret; 178. 179. > error: 180. if (ret != NULL) 181. EVP_PKEY_free(ret); crypto/asn1/x_pubkey.c:180:6: Taking false branch 178. 179. error: 180. if (ret != NULL) ^ 181. EVP_PKEY_free(ret); 182. return(NULL); crypto/asn1/x_pubkey.c:182:2: 180. if (ret != NULL) 181. EVP_PKEY_free(ret); 182. > return(NULL); 183. } 184. crypto/asn1/x_pubkey.c:183:2: return from a call to X509_PUBKEY_get 181. EVP_PKEY_free(ret); 182. return(NULL); 183. } ^ 184. 185. /* Now two pseudo ASN1 routines that take an EVP_PKEY structure crypto/x509/x509_cmp.c:301:2: return from a call to X509_get_pubkey 299. return(NULL); 300. return(X509_PUBKEY_get(x->cert_info->key)); 301. } ^ 302. 303. ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x) apps/x509.c:1145:2: 1143. 1144. upkey = X509_get_pubkey(xca); 1145. > EVP_PKEY_copy_parameters(upkey,pkey); 1146. EVP_PKEY_free(upkey); 1147.
https://github.com/openssl/openssl/blob/1b31b5ad560b16e2fe1cad54a755e3e6b5e778a3/apps/x509.c/#L1145
d2a_code_trace_data_42908
void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){ int i; InternalBuffer *buf, *last; assert(pic->type==FF_BUFFER_TYPE_INTERNAL); assert(s->internal_buffer_count); if(s->internal_buffer){ buf = NULL; for(i=0; i<s->internal_buffer_count; i++){ buf= &((InternalBuffer*)s->internal_buffer)[i]; if(buf->data[0] == pic->data[0]) break; } assert(i < s->internal_buffer_count); s->internal_buffer_count--; last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count]; FFSWAP(InternalBuffer, *buf, *last); } for(i=0; i<4; i++){ pic->data[i]=NULL; } if(s->debug&FF_DEBUG_BUFFERS) av_log(s, AV_LOG_DEBUG, "default_release_buffer called on pic %p, %d buffers used\n", pic, s->internal_buffer_count); } libavcodec/utils.c:377: error: Null Dereference pointer `buf` last assigned on line 367 could be null and is dereferenced at line 377, column 5. libavcodec/utils.c:359:1: start of procedure avcodec_default_release_buffer() 357. } 358. 359. void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){ ^ 360. int i; 361. InternalBuffer *buf, *last; libavcodec/utils.c:363:5: 361. InternalBuffer *buf, *last; 362. 363. assert(pic->type==FF_BUFFER_TYPE_INTERNAL); ^ 364. assert(s->internal_buffer_count); 365. libavcodec/utils.c:364:5: 362. 363. assert(pic->type==FF_BUFFER_TYPE_INTERNAL); 364. assert(s->internal_buffer_count); ^ 365. 366. if(s->internal_buffer){ libavcodec/utils.c:366:8: Taking true branch 364. assert(s->internal_buffer_count); 365. 366. if(s->internal_buffer){ ^ 367. buf = NULL; /* avoids warning */ 368. for(i=0; i<s->internal_buffer_count; i++){ //just 3-5 checks so is not worth to optimize libavcodec/utils.c:367:5: 365. 366. if(s->internal_buffer){ 367. buf = NULL; /* avoids warning */ ^ 368. for(i=0; i<s->internal_buffer_count; i++){ //just 3-5 checks so is not worth to optimize 369. buf= &((InternalBuffer*)s->internal_buffer)[i]; libavcodec/utils.c:368:9: 366. if(s->internal_buffer){ 367. buf = NULL; /* avoids warning */ 368. for(i=0; i<s->internal_buffer_count; i++){ //just 3-5 checks so is not worth to optimize ^ 369. buf= &((InternalBuffer*)s->internal_buffer)[i]; 370. if(buf->data[0] == pic->data[0]) libavcodec/utils.c:368:14: Loop condition is false. Leaving loop 366. if(s->internal_buffer){ 367. buf = NULL; /* avoids warning */ 368. for(i=0; i<s->internal_buffer_count; i++){ //just 3-5 checks so is not worth to optimize ^ 369. buf= &((InternalBuffer*)s->internal_buffer)[i]; 370. if(buf->data[0] == pic->data[0]) libavcodec/utils.c:373:5: 371. break; 372. } 373. assert(i < s->internal_buffer_count); ^ 374. s->internal_buffer_count--; 375. last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count]; libavcodec/utils.c:374:5: 372. } 373. assert(i < s->internal_buffer_count); 374. s->internal_buffer_count--; ^ 375. last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count]; 376. libavcodec/utils.c:375:5: 373. assert(i < s->internal_buffer_count); 374. s->internal_buffer_count--; 375. last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count]; ^ 376. 377. FFSWAP(InternalBuffer, *buf, *last); libavcodec/utils.c:377:5: 375. last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count]; 376. 377. FFSWAP(InternalBuffer, *buf, *last); ^ 378. } 379.
https://github.com/libav/libav/blob/e2542dcc6e94d86b8b844f6ab0ce32ed329d39ee/libavcodec/utils.c/#L377
d2a_code_trace_data_42909
int test_mod_exp(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b, *c, *d, *e; int i; a = BN_new(); b = BN_new(); c = BN_new(); d = BN_new(); e = BN_new(); BN_one(a); BN_one(b); BN_zero(c); if (BN_mod_exp(d, a, b, c, ctx)) { fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n"); return 0; } BN_bntest_rand(c, 30, 0, 1); for (i = 0; i < num2; i++) { BN_bntest_rand(a, 20 + i * 5, 0, 0); BN_bntest_rand(b, 2 + i, 0, 0); if (!BN_mod_exp(d, a, b, c, ctx)) return (0); if (bp != NULL) { if (!results) { BN_print(bp, a); BIO_puts(bp, " ^ "); BN_print(bp, b); BIO_puts(bp, " % "); BN_print(bp, c); BIO_puts(bp, " - "); } BN_print(bp, d); BIO_puts(bp, "\n"); } BN_exp(e, a, b, ctx); BN_sub(e, e, d); BN_div(a, b, e, c, ctx); if (!BN_is_zero(b)) { fprintf(stderr, "Modulo exponentiation test failed!\n"); return 0; } } BN_hex2bn(&a, "050505050505"); BN_hex2bn(&b, "02"); BN_hex2bn(&c, "4141414141414141414141274141414141414141414141414141414141414141" "4141414141414141414141414141414141414141414141414141414141414141" "4141414141414141414141800000000000000000000000000000000000000000" "0000000000000000000000000000000000000000000000000000000000000000" "0000000000000000000000000000000000000000000000000000000000000000" "0000000000000000000000000000000000000000000000000000000001"); BN_mod_exp(d, a, b, c, ctx); BN_mul(e, a, a, ctx); if (BN_cmp(d, e)) { fprintf(stderr, "BN_mod_exp and BN_mul produce different results!\n"); return 0; } BN_free(a); BN_free(b); BN_free(c); BN_free(d); BN_free(e); return (1); } test/bntest.c:1040: error: MEMORY_LEAK memory dynamically allocated to `a` by call to `BN_new()` at line 974, column 9 is not reachable after line 1040, column 1. Showing all 145 steps of the trace test/bntest.c:969:1: start of procedure test_mod_exp() 967. } 968. 969. > int test_mod_exp(BIO *bp, BN_CTX *ctx) 970. { 971. BIGNUM *a, *b, *c, *d, *e; test/bntest.c:974:5: 972. int i; 973. 974. > a = BN_new(); 975. b = BN_new(); 976. 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:975:5: 973. 974. a = BN_new(); 975. > b = BN_new(); 976. c = BN_new(); 977. 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:976:5: 974. a = BN_new(); 975. b = BN_new(); 976. > c = BN_new(); 977. d = BN_new(); 978. 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:977:5: 975. b = BN_new(); 976. c = BN_new(); 977. > d = BN_new(); 978. e = BN_new(); 979. 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:978:5: 976. c = BN_new(); 977. d = BN_new(); 978. > e = BN_new(); 979. 980. BN_one(a); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:980:5: 978. e = BN_new(); 979. 980. > BN_one(a); 981. BN_one(b); 982. BN_zero(c); crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is true 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:981:5: 979. 980. BN_one(a); 981. > BN_one(b); 982. BN_zero(c); 983. if (BN_mod_exp(d, a, b, c, ctx)) { crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is true 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:982:5: 980. BN_one(a); 981. BN_one(b); 982. > BN_zero(c); 983. if (BN_mod_exp(d, a, b, c, ctx)) { 984. fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n"); crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is false 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:983:9: Taking true branch 981. BN_one(b); 982. BN_zero(c); 983. if (BN_mod_exp(d, a, b, c, ctx)) { ^ 984. fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n"); 985. return 0; test/bntest.c:984:9: 982. BN_zero(c); 983. if (BN_mod_exp(d, a, b, c, ctx)) { 984. > fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n"); 985. return 0; 986. } test/bntest.c:985:9: 983. if (BN_mod_exp(d, a, b, c, ctx)) { 984. fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n"); 985. > return 0; 986. } 987. test/bntest.c:1040:1: return from a call to test_mod_exp 1038. BN_free(e); 1039. return (1); 1040. > } 1041. 1042. int test_mod_exp_mont_consttime(BIO *bp, BN_CTX *ctx)
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L1040
d2a_code_trace_data_42910
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:267: error: Integer Overflow L2 ([1, +oo] - 5):unsigned32 by call to `bitstream_read`. libavcodec/takdec.c:267:43: Call 265. if (scale_bits > 0) { 266. if (scale_bits == 7) { 267. scale_bits += bitstream_read(bc, 5); ^ 268. if (scale_bits > 29) 269. return AVERROR_INVALIDDATA; libavcodec/bitstream.h:183:1: Parameter `n` 181. 182. /* Return n bits from the buffer. n has to be in the 0-32 range. */ 183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n) ^ 184. { 185. if (!n) libavcodec/bitstream.h:194:12: Call 192. } 193. 194. return get_val(bc, n); ^ 195. } 196. libavcodec/bitstream.h:130:1: <LHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `bc->bits_left` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: <RHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Binary operation: ([1, +oo] - 5):unsigned32 by call to `bitstream_read` 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret;
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L139
d2a_code_trace_data_42911
static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt) { #ifndef OPENSSL_NO_RSA unsigned char *encdata = NULL; EVP_PKEY *pkey = NULL; EVP_PKEY_CTX *pctx = NULL; size_t enclen; unsigned char *pms = NULL; size_t pmslen = 0; if (s->session->peer == NULL) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); return 0; } pkey = X509_get0_pubkey(s->session->peer); if (EVP_PKEY_get0_RSA(pkey) == NULL) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); return 0; } pmslen = SSL_MAX_MASTER_KEY_LENGTH; pms = OPENSSL_malloc(pmslen); if (pms == NULL) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_MALLOC_FAILURE); return 0; } pms[0] = s->client_version >> 8; pms[1] = s->client_version & 0xff; if (ssl_randbytes(s, pms + 2, (int)(pmslen - 2)) <= 0) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_MALLOC_FAILURE); goto err; } if (s->version > SSL3_VERSION && !WPACKET_start_sub_packet_u16(pkt)) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); goto err; } pctx = EVP_PKEY_CTX_new(pkey, NULL); if (pctx == NULL || EVP_PKEY_encrypt_init(pctx) <= 0 || EVP_PKEY_encrypt(pctx, NULL, &enclen, pms, pmslen) <= 0) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_EVP_LIB); goto err; } if (!WPACKET_allocate_bytes(pkt, enclen, &encdata) || EVP_PKEY_encrypt(pctx, encdata, &enclen, pms, pmslen) <= 0) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, SSL_R_BAD_RSA_ENCRYPT); goto err; } EVP_PKEY_CTX_free(pctx); pctx = NULL; if (s->version > SSL3_VERSION && !WPACKET_close(pkt)) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); goto err; } if (!ssl_log_rsa_client_key_exchange(s, encdata, enclen, pms, pmslen)) { goto err; } s->s3->tmp.pms = pms; s->s3->tmp.pmslen = pmslen; return 1; err: OPENSSL_clear_free(pms, pmslen); EVP_PKEY_CTX_free(pctx); return 0; #else SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); return 0; #endif } ssl/statem/statem_clnt.c:2911: error: NULL_DEREFERENCE pointer `pkey` last assigned on line 2910 could be null and is dereferenced by call to `EVP_PKEY_get0_RSA()` at line 2911, column 9. Showing all 30 steps of the trace ssl/statem/statem_clnt.c:2891:1: start of procedure tls_construct_cke_rsa() 2889. } 2890. 2891. > static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt) 2892. { 2893. #ifndef OPENSSL_NO_RSA ssl/statem/statem_clnt.c:2894:5: 2892. { 2893. #ifndef OPENSSL_NO_RSA 2894. > unsigned char *encdata = NULL; 2895. EVP_PKEY *pkey = NULL; 2896. EVP_PKEY_CTX *pctx = NULL; ssl/statem/statem_clnt.c:2895:5: 2893. #ifndef OPENSSL_NO_RSA 2894. unsigned char *encdata = NULL; 2895. > EVP_PKEY *pkey = NULL; 2896. EVP_PKEY_CTX *pctx = NULL; 2897. size_t enclen; ssl/statem/statem_clnt.c:2896:5: 2894. unsigned char *encdata = NULL; 2895. EVP_PKEY *pkey = NULL; 2896. > EVP_PKEY_CTX *pctx = NULL; 2897. size_t enclen; 2898. unsigned char *pms = NULL; ssl/statem/statem_clnt.c:2898:5: 2896. EVP_PKEY_CTX *pctx = NULL; 2897. size_t enclen; 2898. > unsigned char *pms = NULL; 2899. size_t pmslen = 0; 2900. ssl/statem/statem_clnt.c:2899:5: 2897. size_t enclen; 2898. unsigned char *pms = NULL; 2899. > size_t pmslen = 0; 2900. 2901. if (s->session->peer == NULL) { ssl/statem/statem_clnt.c:2901:9: Taking false branch 2899. size_t pmslen = 0; 2900. 2901. if (s->session->peer == NULL) { ^ 2902. /* 2903. * We should always have a server certificate with SSL_kRSA. ssl/statem/statem_clnt.c:2910:5: 2908. } 2909. 2910. > pkey = X509_get0_pubkey(s->session->peer); 2911. if (EVP_PKEY_get0_RSA(pkey) == NULL) { 2912. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, crypto/x509/x509_cmp.c:264:1: start of procedure X509_get0_pubkey() 262. } 263. 264. > EVP_PKEY *X509_get0_pubkey(const X509 *x) 265. { 266. if (x == NULL) crypto/x509/x509_cmp.c:266:9: Taking false branch 264. EVP_PKEY *X509_get0_pubkey(const X509 *x) 265. { 266. if (x == NULL) ^ 267. return NULL; 268. return X509_PUBKEY_get0(x->cert_info.key); crypto/x509/x509_cmp.c:268:5: 266. if (x == NULL) 267. return NULL; 268. > return X509_PUBKEY_get0(x->cert_info.key); 269. } 270. crypto/x509/x_pubkey.c:140:1: start of procedure X509_PUBKEY_get0() 138. } 139. 140. > EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key) 141. { 142. EVP_PKEY *ret = NULL; crypto/x509/x_pubkey.c:142:5: 140. EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key) 141. { 142. > EVP_PKEY *ret = NULL; 143. 144. if (key == NULL || key->public_key == NULL) crypto/x509/x_pubkey.c:144:9: Taking false branch 142. EVP_PKEY *ret = NULL; 143. 144. if (key == NULL || key->public_key == NULL) ^ 145. return NULL; 146. crypto/x509/x_pubkey.c:144:24: Taking false branch 142. EVP_PKEY *ret = NULL; 143. 144. if (key == NULL || key->public_key == NULL) ^ 145. return NULL; 146. crypto/x509/x_pubkey.c:147:9: Taking false branch 145. return NULL; 146. 147. if (key->pkey != NULL) ^ 148. return key->pkey; 149. crypto/x509/x_pubkey.c:158:5: 156. * in the queue. 157. */ 158. > x509_pubkey_decode(&ret, key); 159. /* If decode doesn't fail something bad happened */ 160. if (ret != NULL) { crypto/x509/x_pubkey.c:103:1: start of procedure x509_pubkey_decode() 101. 102. 103. > static int x509_pubkey_decode(EVP_PKEY **ppkey, X509_PUBKEY *key) 104. { 105. EVP_PKEY *pkey = EVP_PKEY_new(); crypto/x509/x_pubkey.c:105:5: Skipping EVP_PKEY_new(): empty list of specs 103. static int x509_pubkey_decode(EVP_PKEY **ppkey, X509_PUBKEY *key) 104. { 105. EVP_PKEY *pkey = EVP_PKEY_new(); ^ 106. 107. if (pkey == NULL) { crypto/x509/x_pubkey.c:107:9: Taking true branch 105. EVP_PKEY *pkey = EVP_PKEY_new(); 106. 107. if (pkey == NULL) { ^ 108. X509err(X509_F_X509_PUBKEY_DECODE, ERR_R_MALLOC_FAILURE); 109. return -1; crypto/x509/x_pubkey.c:108:9: Skipping ERR_put_error(): empty list of specs 106. 107. if (pkey == NULL) { 108. X509err(X509_F_X509_PUBKEY_DECODE, ERR_R_MALLOC_FAILURE); ^ 109. return -1; 110. } crypto/x509/x_pubkey.c:109:9: 107. if (pkey == NULL) { 108. X509err(X509_F_X509_PUBKEY_DECODE, ERR_R_MALLOC_FAILURE); 109. > return -1; 110. } 111. crypto/x509/x_pubkey.c:138:1: return from a call to x509_pubkey_decode 136. EVP_PKEY_free(pkey); 137. return 0; 138. > } 139. 140. EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key) crypto/x509/x_pubkey.c:160:9: Taking false branch 158. x509_pubkey_decode(&ret, key); 159. /* If decode doesn't fail something bad happened */ 160. if (ret != NULL) { ^ 161. X509err(X509_F_X509_PUBKEY_GET0, ERR_R_INTERNAL_ERROR); 162. EVP_PKEY_free(ret); crypto/x509/x_pubkey.c:165:5: 163. } 164. 165. > return NULL; 166. } 167. crypto/x509/x_pubkey.c:166:1: return from a call to X509_PUBKEY_get0 164. 165. return NULL; 166. > } 167. 168. EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) crypto/x509/x509_cmp.c:269:1: return from a call to X509_get0_pubkey 267. return NULL; 268. return X509_PUBKEY_get0(x->cert_info.key); 269. > } 270. 271. EVP_PKEY *X509_get_pubkey(X509 *x) ssl/statem/statem_clnt.c:2911:9: 2909. 2910. pkey = X509_get0_pubkey(s->session->peer); 2911. > if (EVP_PKEY_get0_RSA(pkey) == NULL) { 2912. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA, 2913. ERR_R_INTERNAL_ERROR); crypto/evp/p_lib.c:311:1: start of procedure EVP_PKEY_get0_RSA() 309. } 310. 311. > RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey) 312. { 313. if (pkey->type != EVP_PKEY_RSA) { crypto/evp/p_lib.c:313:9: 311. RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey) 312. { 313. > if (pkey->type != EVP_PKEY_RSA) { 314. EVPerr(EVP_F_EVP_PKEY_GET0_RSA, EVP_R_EXPECTING_AN_RSA_KEY); 315. return NULL;
https://github.com/openssl/openssl/blob/e43e6b1951de931ca500c6964496e76651332f5e/ssl/statem/statem_clnt.c/#L2911
d2a_code_trace_data_42912
static int parse_icy(HTTPContext *s, const char *tag, const char *p) { int len = 4 + strlen(p) + strlen(tag); int is_first = !s->icy_metadata_headers; int ret; if (s->icy_metadata_headers) len += strlen(s->icy_metadata_headers); if ((ret = av_reallocp(&s->icy_metadata_headers, len)) < 0) return ret; if (is_first) *s->icy_metadata_headers = '\0'; av_strlcatf(s->icy_metadata_headers, len, "%s: %s\n", tag, p); return 0; } libavformat/http.c:419: error: Null Dereference pointer `s->icy_metadata_headers` last assigned on line 415 could be null and is dereferenced at line 419, column 9. libavformat/http.c:406:1: start of procedure parse_icy() 404. 405. // Concat all Icy- header lines 406. static int parse_icy(HTTPContext *s, const char *tag, const char *p) ^ 407. { 408. int len = 4 + strlen(p) + strlen(tag); libavformat/http.c:408:5: 406. static int parse_icy(HTTPContext *s, const char *tag, const char *p) 407. { 408. int len = 4 + strlen(p) + strlen(tag); ^ 409. int is_first = !s->icy_metadata_headers; 410. int ret; libavformat/http.c:409:21: Condition is false 407. { 408. int len = 4 + strlen(p) + strlen(tag); 409. int is_first = !s->icy_metadata_headers; ^ 410. int ret; 411. libavformat/http.c:409:20: 407. { 408. int len = 4 + strlen(p) + strlen(tag); 409. int is_first = !s->icy_metadata_headers; ^ 410. int ret; 411. libavformat/http.c:409:5: 407. { 408. int len = 4 + strlen(p) + strlen(tag); 409. int is_first = !s->icy_metadata_headers; ^ 410. int ret; 411. libavformat/http.c:412:9: Taking false branch 410. int ret; 411. 412. if (s->icy_metadata_headers) ^ 413. len += strlen(s->icy_metadata_headers); 414. libavformat/http.c:415:9: 413. len += strlen(s->icy_metadata_headers); 414. 415. if ((ret = av_reallocp(&s->icy_metadata_headers, len)) < 0) ^ 416. return ret; 417. 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 true branch 143. void *ret; 144. 145. if (!size) { ^ 146. av_freep(ptr); 147. return 0; libavutil/mem.c:146:9: 144. 145. if (!size) { 146. av_freep(ptr); ^ 147. return 0; 148. } libavutil/mem.c:198:1: start of procedure av_freep() 196. } 197. 198. void av_freep(void *arg) ^ 199. { 200. void **ptr = (void **)arg; libavutil/mem.c:200:5: 198. void av_freep(void *arg) 199. { 200. void **ptr = (void **)arg; ^ 201. av_free(*ptr); 202. *ptr = NULL; libavutil/mem.c:201:5: 199. { 200. void **ptr = (void **)arg; 201. av_free(*ptr); ^ 202. *ptr = NULL; 203. } libavutil/mem.c:186:1: start of procedure av_free() 184. } 185. 186. void av_free(void *ptr) ^ 187. { 188. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:194:5: 192. _aligned_free(ptr); 193. #else 194. free(ptr); ^ 195. #endif 196. } libavutil/mem.c:196:1: return from a call to av_free 194. free(ptr); 195. #endif 196. } ^ 197. 198. void av_freep(void *arg) libavutil/mem.c:202:5: 200. void **ptr = (void **)arg; 201. av_free(*ptr); 202. *ptr = NULL; ^ 203. } 204. libavutil/mem.c:203:1: return from a call to av_freep 201. av_free(*ptr); 202. *ptr = NULL; 203. } ^ 204. 205. void *av_mallocz(size_t size) libavutil/mem.c:147:9: 145. if (!size) { 146. av_freep(ptr); 147. return 0; ^ 148. } 149. ret = av_realloc(*ptrptr, size); 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/http.c:415:9: Taking false branch 413. len += strlen(s->icy_metadata_headers); 414. 415. if ((ret = av_reallocp(&s->icy_metadata_headers, len)) < 0) ^ 416. return ret; 417. libavformat/http.c:418:9: Taking true branch 416. return ret; 417. 418. if (is_first) ^ 419. *s->icy_metadata_headers = '\0'; 420. libavformat/http.c:419:9: 417. 418. if (is_first) 419. *s->icy_metadata_headers = '\0'; ^ 420. 421. av_strlcatf(s->icy_metadata_headers, len, "%s: %s\n", tag, p);
https://github.com/libav/libav/blob/436ced244fadcde2c0b925627920e84b25482542/libavformat/http.c/#L419
d2a_code_trace_data_42913
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:208: 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:208:9: Call 206. int testresult = 1; 207. EC_GROUP *test_group = 208. create_EC_group ^ 209. ("8542D69E4C044F18E8B92435BF6FF7DE457283915C45517D722EDB8B08F1DFC3", 210. "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_42914
static int verify_alpn(SSL *client, SSL *server) { const unsigned char *client_proto, *server_proto; unsigned int client_proto_len = 0, server_proto_len = 0; SSL_get0_alpn_selected(client, &client_proto, &client_proto_len); SSL_get0_alpn_selected(server, &server_proto, &server_proto_len); OPENSSL_free(alpn_selected); alpn_selected = NULL; if (client_proto_len != server_proto_len) { BIO_printf(bio_stdout, "ALPN selected protocols differ!\n"); goto err; } if (client_proto != NULL && memcmp(client_proto, server_proto, client_proto_len) != 0) { BIO_printf(bio_stdout, "ALPN selected protocols differ!\n"); goto err; } if (client_proto_len > 0 && alpn_expected == NULL) { BIO_printf(bio_stdout, "ALPN unexpectedly negotiated\n"); goto err; } if (alpn_expected != NULL && (client_proto_len != strlen(alpn_expected) || memcmp(client_proto, alpn_expected, client_proto_len) != 0)) { BIO_printf(bio_stdout, "ALPN selected protocols not equal to expected protocol: %s\n", alpn_expected); goto err; } return 0; err: BIO_printf(bio_stdout, "ALPN results: client: '"); BIO_write(bio_stdout, client_proto, client_proto_len); BIO_printf(bio_stdout, "', server: '"); BIO_write(bio_stdout, server_proto, server_proto_len); BIO_printf(bio_stdout, "'\n"); BIO_printf(bio_stdout, "ALPN configured: client: '%s', server: '%s'\n", alpn_client, alpn_server); return -1; } test/ssltest.c:465: error: NULL_DEREFERENCE pointer `server_proto` last assigned on line 454 could be null and is dereferenced by call to `memcmp()` at line 465, column 9. Showing all 28 steps of the trace test/ssltest.c:449:1: start of procedure verify_alpn() 447. } 448. 449. > static int verify_alpn(SSL *client, SSL *server) 450. { 451. const unsigned char *client_proto, *server_proto; test/ssltest.c:452:5: 450. { 451. const unsigned char *client_proto, *server_proto; 452. > unsigned int client_proto_len = 0, server_proto_len = 0; 453. SSL_get0_alpn_selected(client, &client_proto, &client_proto_len); 454. SSL_get0_alpn_selected(server, &server_proto, &server_proto_len); test/ssltest.c:453:5: 451. const unsigned char *client_proto, *server_proto; 452. unsigned int client_proto_len = 0, server_proto_len = 0; 453. > SSL_get0_alpn_selected(client, &client_proto, &client_proto_len); 454. SSL_get0_alpn_selected(server, &server_proto, &server_proto_len); 455. ssl/ssl_lib.c:2179:1: start of procedure SSL_get0_alpn_selected() 2177. * respond with a negotiated protocol then |*len| will be zero. 2178. */ 2179. > void SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data, 2180. unsigned *len) 2181. { ssl/ssl_lib.c:2182:5: 2180. unsigned *len) 2181. { 2182. > *data = NULL; 2183. if (ssl->s3) 2184. *data = ssl->s3->alpn_selected; ssl/ssl_lib.c:2183:9: Taking true branch 2181. { 2182. *data = NULL; 2183. if (ssl->s3) ^ 2184. *data = ssl->s3->alpn_selected; 2185. if (*data == NULL) ssl/ssl_lib.c:2184:9: 2182. *data = NULL; 2183. if (ssl->s3) 2184. > *data = ssl->s3->alpn_selected; 2185. if (*data == NULL) 2186. *len = 0; ssl/ssl_lib.c:2185:9: Taking false branch 2183. if (ssl->s3) 2184. *data = ssl->s3->alpn_selected; 2185. if (*data == NULL) ^ 2186. *len = 0; 2187. else ssl/ssl_lib.c:2188:9: 2186. *len = 0; 2187. else 2188. > *len = ssl->s3->alpn_selected_len; 2189. } 2190. ssl/ssl_lib.c:2185:5: 2183. if (ssl->s3) 2184. *data = ssl->s3->alpn_selected; 2185. > if (*data == NULL) 2186. *len = 0; 2187. else ssl/ssl_lib.c:2189:1: return from a call to SSL_get0_alpn_selected 2187. else 2188. *len = ssl->s3->alpn_selected_len; 2189. > } 2190. 2191. test/ssltest.c:454:5: 452. unsigned int client_proto_len = 0, server_proto_len = 0; 453. SSL_get0_alpn_selected(client, &client_proto, &client_proto_len); 454. > SSL_get0_alpn_selected(server, &server_proto, &server_proto_len); 455. 456. OPENSSL_free(alpn_selected); ssl/ssl_lib.c:2179:1: start of procedure SSL_get0_alpn_selected() 2177. * respond with a negotiated protocol then |*len| will be zero. 2178. */ 2179. > void SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data, 2180. unsigned *len) 2181. { ssl/ssl_lib.c:2182:5: 2180. unsigned *len) 2181. { 2182. > *data = NULL; 2183. if (ssl->s3) 2184. *data = ssl->s3->alpn_selected; ssl/ssl_lib.c:2183:9: Taking true branch 2181. { 2182. *data = NULL; 2183. if (ssl->s3) ^ 2184. *data = ssl->s3->alpn_selected; 2185. if (*data == NULL) ssl/ssl_lib.c:2184:9: 2182. *data = NULL; 2183. if (ssl->s3) 2184. > *data = ssl->s3->alpn_selected; 2185. if (*data == NULL) 2186. *len = 0; ssl/ssl_lib.c:2185:9: Taking true branch 2183. if (ssl->s3) 2184. *data = ssl->s3->alpn_selected; 2185. if (*data == NULL) ^ 2186. *len = 0; 2187. else ssl/ssl_lib.c:2186:9: 2184. *data = ssl->s3->alpn_selected; 2185. if (*data == NULL) 2186. > *len = 0; 2187. else 2188. *len = ssl->s3->alpn_selected_len; ssl/ssl_lib.c:2185:5: 2183. if (ssl->s3) 2184. *data = ssl->s3->alpn_selected; 2185. > if (*data == NULL) 2186. *len = 0; 2187. else ssl/ssl_lib.c:2189:1: return from a call to SSL_get0_alpn_selected 2187. else 2188. *len = ssl->s3->alpn_selected_len; 2189. > } 2190. 2191. test/ssltest.c:456:5: 454. SSL_get0_alpn_selected(server, &server_proto, &server_proto_len); 455. 456. > OPENSSL_free(alpn_selected); 457. alpn_selected = NULL; 458. 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) test/ssltest.c:457:5: 455. 456. OPENSSL_free(alpn_selected); 457. > alpn_selected = NULL; 458. 459. if (client_proto_len != server_proto_len) { test/ssltest.c:459:9: Taking false branch 457. alpn_selected = NULL; 458. 459. if (client_proto_len != server_proto_len) { ^ 460. BIO_printf(bio_stdout, "ALPN selected protocols differ!\n"); 461. goto err; test/ssltest.c:464:9: Taking true branch 462. } 463. 464. if (client_proto != NULL && ^ 465. memcmp(client_proto, server_proto, client_proto_len) != 0) { 466. BIO_printf(bio_stdout, "ALPN selected protocols differ!\n"); test/ssltest.c:465:9: 463. 464. if (client_proto != NULL && 465. > memcmp(client_proto, server_proto, client_proto_len) != 0) { 466. BIO_printf(bio_stdout, "ALPN selected protocols differ!\n"); 467. goto err;
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/ssltest.c/#L465
d2a_code_trace_data_42915
static char * ngx_http_map(ngx_conf_t *cf, ngx_command_t *dummy, void *conf) { u_char *data; size_t len; ngx_int_t rv; ngx_str_t *value, v; ngx_uint_t i, key; ngx_http_map_conf_ctx_t *ctx; ngx_http_complex_value_t cv, *cvp; ngx_http_variable_value_t *var, **vp; ngx_http_compile_complex_value_t ccv; ctx = cf->ctx; value = cf->args->elts; if (cf->args->nelts == 1 && ngx_strcmp(value[0].data, "hostnames") == 0) { ctx->hostnames = 1; return NGX_CONF_OK; } else if (cf->args->nelts != 2) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid number of the map parameters"); return NGX_CONF_ERROR; } if (ngx_strcmp(value[0].data, "include") == 0) { return ngx_conf_include(cf, dummy, conf); } key = 0; for (i = 0; i < value[1].len; i++) { key = ngx_hash(key, value[1].data[i]); } key %= ctx->keys.hsize; vp = ctx->values_hash[key].elts; if (vp) { for (i = 0; i < ctx->values_hash[key].nelts; i++) { if (vp[i]->valid) { data = vp[i]->data; len = vp[i]->len; } else { cvp = (ngx_http_complex_value_t *) vp[i]->data; data = cvp->value.data; len = cvp->value.len; } if (value[1].len != len) { continue; } if (ngx_strncmp(value[1].data, data, len) == 0) { var = vp[i]; goto found; } } } else { if (ngx_array_init(&ctx->values_hash[key], cf->pool, 4, sizeof(ngx_http_variable_value_t *)) != NGX_OK) { return NGX_CONF_ERROR; } } var = ngx_palloc(ctx->keys.pool, sizeof(ngx_http_variable_value_t)); if (var == NULL) { return NGX_CONF_ERROR; } v.len = value[1].len; v.data = ngx_pstrdup(ctx->keys.pool, &value[1]); if (v.data == NULL) { return NGX_CONF_ERROR; } ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t)); ccv.cf = ctx->cf; ccv.value = &v; ccv.complex_value = &cv; if (ngx_http_compile_complex_value(&ccv) != NGX_OK) { return NGX_CONF_ERROR; } if (cv.lengths != NULL) { cvp = ngx_palloc(ctx->keys.pool, sizeof(ngx_http_complex_value_t)); if (cvp == NULL) { return NGX_CONF_ERROR; } *cvp = cv; var->len = 0; var->data = (u_char *) cvp; var->valid = 0; } else { var->len = v.len; var->data = v.data; var->valid = 1; } var->no_cacheable = 0; var->not_found = 0; vp = ngx_array_push(&ctx->values_hash[key]); if (vp == NULL) { return NGX_CONF_ERROR; } *vp = var; found: if (ngx_strcmp(value[0].data, "default") == 0) { if (ctx->default_value) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "duplicate default map parameter"); return NGX_CONF_ERROR; } ctx->default_value = var; return NGX_CONF_OK; } #if (NGX_PCRE) if (value[0].len && value[0].data[0] == '~') { ngx_regex_compile_t rc; ngx_http_map_regex_t *regex; u_char errstr[NGX_MAX_CONF_ERRSTR]; regex = ngx_array_push(&ctx->regexes); if (regex == NULL) { return NGX_CONF_ERROR; } value[0].len--; value[0].data++; ngx_memzero(&rc, sizeof(ngx_regex_compile_t)); if (value[0].data[0] == '*') { value[0].len--; value[0].data++; rc.options = NGX_REGEX_CASELESS; } rc.pattern = value[0]; rc.err.len = NGX_MAX_CONF_ERRSTR; rc.err.data = errstr; regex->regex = ngx_http_regex_compile(ctx->cf, &rc); if (regex->regex == NULL) { return NGX_CONF_ERROR; } regex->value = var; return NGX_CONF_OK; } #endif if (value[0].len && value[0].data[0] == '\\') { value[0].len--; value[0].data++; } rv = ngx_hash_add_key(&ctx->keys, &value[0], var, (ctx->hostnames) ? NGX_HASH_WILDCARD_KEY : 0); if (rv == NGX_OK) { return NGX_CONF_OK; } if (rv == NGX_DECLINED) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid hostname or wildcard \"%V\"", &value[0]); } if (rv == NGX_BUSY) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "conflicting parameter \"%V\"", &value[0]); } return NGX_CONF_ERROR; } src/http/modules/ngx_http_map_module.c:531: error: Integer Overflow L2 ([0, +oo] - 1):unsigned64. src/http/modules/ngx_http_map_module.c:409:10: <LHS trace> 407. key = 0; 408. 409. for (i = 0; i < value[1].len; i++) { ^ 410. key = ngx_hash(key, value[1].data[i]); 411. } src/http/modules/ngx_http_map_module.c:409:10: Assignment 407. key = 0; 408. 409. for (i = 0; i < value[1].len; i++) { ^ 410. key = ngx_hash(key, value[1].data[i]); 411. } src/http/modules/ngx_http_map_module.c:525:9: Assignment 523. } 524. 525. value[0].len--; ^ 526. value[0].data++; 527. src/http/modules/ngx_http_map_module.c:531:13: Binary operation: ([0, +oo] - 1):unsigned64 529. 530. if (value[0].data[0] == '*') { 531. value[0].len--; ^ 532. value[0].data++; 533. rc.options = NGX_REGEX_CASELESS;
https://github.com/nginx/nginx/blob/cbf6ca98bc3f839ab3519ac45807c3c8ae6deb84/src/http/modules/ngx_http_map_module.c/#L531
d2a_code_trace_data_42916
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:1076: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + `s->tlsext_hostname->strlen` + 25]):unsigned64 by call to `WPACKET_start_sub_packet_len__`. Showing all 10 steps of the trace ssl/t1_lib.c:1074:14: Call 1072. /* Add SRP username if there is one */ 1073. if (s->srp_ctx.login != NULL) { 1074. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_srp) ^ 1075. /* Sub-packet for SRP extension */ 1076. || !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:1076:21: Call 1074. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_srp) 1075. /* Sub-packet for SRP extension */ 1076. || !WPACKET_start_sub_packet_u16(pkt) ^ 1077. || !WPACKET_start_sub_packet_u8(pkt) 1078. /* login must not be zero...internal error if so */ ssl/packet.c:205:1: Parameter `pkt->written` 203. } 204. 205. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 206. { 207. WPACKET_SUB *sub; ssl/packet.c:229:10: Call 227. } 228. 229. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 230. return 0; 231. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */ ssl/packet.c:15:1: <LHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `pkt->buf->length` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: <RHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `len` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:25:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + pkt->written + s->tlsext_hostname->strlen + 25]):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_42917
static void contract(LHASH *lh) { LHASH_NODE **n,*n1,*np; np=lh->b[lh->p+lh->pmax-1]; lh->b[lh->p+lh->pmax-1]=NULL; if (lh->p == 0) { n=(LHASH_NODE **)Realloc(lh->b, (unsigned int)(sizeof(LHASH_NODE *)*lh->pmax)); if (n == NULL) { lh->error++; return; } lh->num_contract_reallocs++; lh->num_alloc_nodes/=2; lh->pmax/=2; lh->p=lh->pmax-1; lh->b=n; } else lh->p--; lh->num_nodes--; lh->num_contracts++; n1=lh->b[(int)lh->p]; if (n1 == NULL) lh->b[(int)lh->p]=np; else { while (n1->next != NULL) n1=n1->next; n1->next=np; } } ssl/s3_pkt.c:952: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `SSL_CTX_remove_session`. Showing all 11 steps of the trace ssl/s3_pkt.c:710:1: Parameter `s->ctx->sessions->p` 708. * none of our business 709. */ 710. > int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len) 711. { 712. int al,i,j,n,ret; ssl/s3_pkt.c:952:4: Call 950. ERR_add_error_data(2,"SSL alert number ",tmp); 951. s->shutdown|=SSL_RECEIVED_SHUTDOWN; 952. SSL_CTX_remove_session(s->ctx,s->session); ^ 953. return(0); 954. } ssl/ssl_sess.c:413:1: Parameter `ctx->sessions->p` 411. } 412. 413. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 414. { 415. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:415:9: Call 413. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 414. { 415. return remove_session_lock(ctx, c, 1); ^ 416. } 417. ssl/ssl_sess.c:418:1: Parameter `ctx->sessions->p` 416. } 417. 418. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 419. { 420. SSL_SESSION *r; ssl/ssl_sess.c:426:20: Call 424. { 425. if(lck) CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX); 426. r=(SSL_SESSION *)lh_delete(ctx->sessions,c); ^ 427. if (r != NULL) 428. { crypto/lhash/lhash.c:217:1: Parameter `lh->pmax` 215. } 216. 217. > void *lh_delete(LHASH *lh, void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:243:3: Call 241. if ((lh->num_nodes > MIN_NODES) && 242. (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes))) 243. contract(lh); ^ 244. 245. return(ret); crypto/lhash/lhash.c:352:1: <LHS trace> 350. } 351. 352. > static void contract(LHASH *lh) 353. { 354. LHASH_NODE **n,*n1,*np; crypto/lhash/lhash.c:352:1: Parameter `lh->p` 350. } 351. 352. > static void contract(LHASH *lh) 353. { 354. LHASH_NODE **n,*n1,*np; crypto/lhash/lhash.c:356:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `SSL_CTX_remove_session` 354. LHASH_NODE **n,*n1,*np; 355. 356. np=lh->b[lh->p+lh->pmax-1]; ^ 357. lh->b[lh->p+lh->pmax-1]=NULL; /* 24/07-92 - eay - weird but :-( */ 358. if (lh->p == 0)
https://github.com/openssl/openssl/blob/dab6f09573742df94c4767663565aca3863f8173/crypto/lhash/lhash.c/#L356
d2a_code_trace_data_42918
int test_gf2m_mod_inv(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b[2], *c, *d; int i, j, ret = 0; int p0[] = { 163, 7, 6, 3, 0, -1 }; int p1[] = { 193, 15, 0, -1 }; a = BN_new(); b[0] = BN_new(); b[1] = BN_new(); c = BN_new(); d = BN_new(); BN_GF2m_arr2poly(p0, b[0]); BN_GF2m_arr2poly(p1, b[1]); for (i = 0; i < num0; i++) { BN_bntest_rand(a, 512, 0, 0); for (j = 0; j < 2; j++) { BN_GF2m_mod_inv(c, a, b[j], ctx); BN_GF2m_mod_mul(d, a, c, b[j], ctx); if (!BN_is_one(d)) { fprintf(stderr, "GF(2^m) modular inversion test failed!\n"); goto err; } } } ret = 1; err: BN_free(a); BN_free(b[0]); BN_free(b[1]); BN_free(c); BN_free(d); return ret; } test/bntest.c:1433: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 1410, column 9 is not reachable after line 1433, column 5. Showing all 133 steps of the trace test/bntest.c:1403:1: start of procedure test_gf2m_mod_inv() 1401. } 1402. 1403. > int test_gf2m_mod_inv(BIO *bp, BN_CTX *ctx) 1404. { 1405. BIGNUM *a, *b[2], *c, *d; test/bntest.c:1406:5: 1404. { 1405. BIGNUM *a, *b[2], *c, *d; 1406. > int i, j, ret = 0; 1407. int p0[] = { 163, 7, 6, 3, 0, -1 }; 1408. int p1[] = { 193, 15, 0, -1 }; test/bntest.c:1407:5: 1405. BIGNUM *a, *b[2], *c, *d; 1406. int i, j, ret = 0; 1407. > int p0[] = { 163, 7, 6, 3, 0, -1 }; 1408. int p1[] = { 193, 15, 0, -1 }; 1409. test/bntest.c:1408:5: 1406. int i, j, ret = 0; 1407. int p0[] = { 163, 7, 6, 3, 0, -1 }; 1408. > int p1[] = { 193, 15, 0, -1 }; 1409. 1410. a = BN_new(); test/bntest.c:1410:5: 1408. int p1[] = { 193, 15, 0, -1 }; 1409. 1410. > a = BN_new(); 1411. b[0] = BN_new(); 1412. b[1] = 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:1411:5: 1409. 1410. a = BN_new(); 1411. > b[0] = BN_new(); 1412. b[1] = BN_new(); 1413. 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:1412:5: 1410. a = BN_new(); 1411. b[0] = BN_new(); 1412. > b[1] = BN_new(); 1413. c = BN_new(); 1414. 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:1413:5: 1411. b[0] = BN_new(); 1412. b[1] = BN_new(); 1413. > c = BN_new(); 1414. d = BN_new(); 1415. 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:1414:5: 1412. b[1] = BN_new(); 1413. c = BN_new(); 1414. > d = BN_new(); 1415. 1416. BN_GF2m_arr2poly(p0, b[0]); 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:1416:5: Skipping BN_GF2m_arr2poly(): empty list of specs 1414. d = BN_new(); 1415. 1416. BN_GF2m_arr2poly(p0, b[0]); ^ 1417. BN_GF2m_arr2poly(p1, b[1]); 1418. test/bntest.c:1417:5: Skipping BN_GF2m_arr2poly(): empty list of specs 1415. 1416. BN_GF2m_arr2poly(p0, b[0]); 1417. BN_GF2m_arr2poly(p1, b[1]); ^ 1418. 1419. for (i = 0; i < num0; i++) { test/bntest.c:1419:10: 1417. BN_GF2m_arr2poly(p1, b[1]); 1418. 1419. > for (i = 0; i < num0; i++) { 1420. BN_bntest_rand(a, 512, 0, 0); 1421. for (j = 0; j < 2; j++) { test/bntest.c:1419:17: Loop condition is false. Leaving loop 1417. BN_GF2m_arr2poly(p1, b[1]); 1418. 1419. for (i = 0; i < num0; i++) { ^ 1420. BN_bntest_rand(a, 512, 0, 0); 1421. for (j = 0; j < 2; j++) { test/bntest.c:1431:5: 1429. } 1430. } 1431. > ret = 1; 1432. err: 1433. BN_free(a); test/bntest.c:1432:2: 1430. } 1431. ret = 1; 1432. > err: 1433. BN_free(a); 1434. BN_free(b[0]); test/bntest.c:1433:5: 1431. ret = 1; 1432. err: 1433. > BN_free(a); 1434. BN_free(b[0]); 1435. BN_free(b[1]); 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/#L1433
d2a_code_trace_data_42919
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:13: 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_42920
int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *xx, const int p[], BN_CTX *ctx) { BIGNUM *field; int ret = 0; 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_inv(r, xx, field, ctx); bn_check_top(r); err: BN_CTX_end(ctx); return ret; } crypto/bn/bn_gf2m.c:818: error: MEMORY_LEAK memory dynamically allocated by call to `BN_CTX_start()` at line 812, column 5 is not reachable after line 818, column 11. Showing all 57 steps of the trace crypto/bn/bn_gf2m.c:805:1: start of procedure BN_GF2m_mod_inv_arr() 803. * use the BN_GF2m_mod_inv function. 804. */ 805. > int BN_GF2m_mod_inv_arr(BIGNUM *r, const BIGNUM *xx, const int p[], 806. BN_CTX *ctx) 807. { crypto/bn/bn_gf2m.c:809:5: 807. { 808. BIGNUM *field; 809. > int ret = 0; 810. 811. bn_check_top(xx); crypto/bn/bn_gf2m.c:812:5: 810. 811. bn_check_top(xx); 812. > BN_CTX_start(ctx); 813. if ((field = BN_CTX_get(ctx)) == NULL) 814. 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:813:9: 811. bn_check_top(xx); 812. BN_CTX_start(ctx); 813. > if ((field = BN_CTX_get(ctx)) == NULL) 814. goto err; 815. 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:813:9: Taking false branch 811. bn_check_top(xx); 812. BN_CTX_start(ctx); 813. if ((field = BN_CTX_get(ctx)) == NULL) ^ 814. goto err; 815. if (!BN_GF2m_arr2poly(p, field)) crypto/bn/bn_gf2m.c:815:10: Taking false branch 813. if ((field = BN_CTX_get(ctx)) == NULL) 814. goto err; 815. if (!BN_GF2m_arr2poly(p, field)) ^ 816. goto err; 817. crypto/bn/bn_gf2m.c:818:5: Skipping BN_GF2m_mod_inv(): empty list of specs 816. goto err; 817. 818. ret = BN_GF2m_mod_inv(r, xx, field, ctx); ^ 819. bn_check_top(r); 820.
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/bn/bn_gf2m.c/#L818
d2a_code_trace_data_42921
static inline int get_p_cbp(MpegEncContext * s, DCTELEM block[6][64], int motion_x, int motion_y){ int cbp, i; if(s->flags & CODEC_FLAG_CBP_RD){ int best_cbpy_score= INT_MAX; int best_cbpc_score= INT_MAX; int cbpc = (-1), cbpy= (-1); const int offset= (s->mv_type==MV_TYPE_16X16 ? 0 : 16) + (s->dquant ? 8 : 0); const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6); for(i=0; i<4; i++){ int score= inter_MCBPC_bits[i + offset] * lambda; if(i&1) score += s->coded_score[5]; if(i&2) score += s->coded_score[4]; if(score < best_cbpc_score){ best_cbpc_score= score; cbpc= i; } } for(i=0; i<16; i++){ int score= cbpy_tab[i ^ 0xF][1] * lambda; if(i&1) score += s->coded_score[3]; if(i&2) score += s->coded_score[2]; if(i&4) score += s->coded_score[1]; if(i&8) score += s->coded_score[0]; if(score < best_cbpy_score){ best_cbpy_score= score; cbpy= i; } } cbp= cbpc + 4*cbpy; if ((motion_x | motion_y | s->dquant) == 0 && s->mv_type==MV_TYPE_16X16){ if(best_cbpy_score + best_cbpc_score + 2*lambda >= 0) cbp= 0; } for (i = 0; i < 6; i++) { if (s->block_last_index[i] >= 0 && ((cbp >> (5 - i))&1)==0 ){ s->block_last_index[i]= -1; memset(s->block[i], 0, sizeof(DCTELEM)*64); } } }else{ cbp= 0; for (i = 0; i < 6; i++) { if (s->block_last_index[i] >= 0) cbp |= 1 << (5 - i); } } return cbp; } libavcodec/h263.c:806: error: Integer Overflow L1 (4294967294 + [0, 2⋅`s->lambda2`]):signed32. libavcodec/h263.c:775:9: <LHS trace> 773. 774. if(s->flags & CODEC_FLAG_CBP_RD){ 775. int best_cbpy_score= INT_MAX; ^ 776. int best_cbpc_score= INT_MAX; 777. int cbpc = (-1), cbpy= (-1); libavcodec/h263.c:775:9: Assignment 773. 774. if(s->flags & CODEC_FLAG_CBP_RD){ 775. int best_cbpy_score= INT_MAX; ^ 776. int best_cbpc_score= INT_MAX; 777. int cbpc = (-1), cbpy= (-1); libavcodec/h263.c:769:1: <RHS trace> 767. } 768. 769. static inline int get_p_cbp(MpegEncContext * s, ^ 770. DCTELEM block[6][64], 771. int motion_x, int motion_y){ libavcodec/h263.c:769:1: Parameter `s->lambda2` 767. } 768. 769. static inline int get_p_cbp(MpegEncContext * s, ^ 770. DCTELEM block[6][64], 771. int motion_x, int motion_y){ libavcodec/h263.c:779:9: Assignment 777. int cbpc = (-1), cbpy= (-1); 778. const int offset= (s->mv_type==MV_TYPE_16X16 ? 0 : 16) + (s->dquant ? 8 : 0); 779. const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6); ^ 780. 781. for(i=0; i<4; i++){ libavcodec/h263.c:806:16: Binary operation: (4294967294 + [0, 2⋅s->lambda2]):signed32 804. cbp= cbpc + 4*cbpy; 805. if ((motion_x | motion_y | s->dquant) == 0 && s->mv_type==MV_TYPE_16X16){ 806. if(best_cbpy_score + best_cbpc_score + 2*lambda >= 0) ^ 807. cbp= 0; 808. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h263.c/#L806
d2a_code_trace_data_42922
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:500: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_mul`. Showing all 19 steps of the trace test/bntest.c:500:13: Call 498. BN_bntest_rand(d, 1024, 0, 0); 499. for (j = 0; j < 2; j++) { 500. BN_GF2m_mod_mul(e, a, c, b[j], ctx); ^ 501. BN_GF2m_add(f, a, d); 502. BN_GF2m_mod_mul(g, f, c, b[j], ctx); crypto/bn/bn_gf2m.c:473:1: Parameter `ctx->stack.depth` 471. * BN_GF2m_mod_mul_arr function. 472. */ 473. > int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 474. const BIGNUM *p, BN_CTX *ctx) 475. { test/bntest.c:502:13: Call 500. BN_GF2m_mod_mul(e, a, c, b[j], ctx); 501. BN_GF2m_add(f, a, d); 502. BN_GF2m_mod_mul(g, f, c, b[j], ctx); ^ 503. BN_GF2m_mod_mul(h, d, c, b[j], ctx); 504. BN_GF2m_add(f, e, g); crypto/bn/bn_gf2m.c:473:1: Parameter `ctx->stack.depth` 471. * BN_GF2m_mod_mul_arr function. 472. */ 473. > int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 474. const BIGNUM *p, BN_CTX *ctx) 475. { test/bntest.c:503:13: Call 501. BN_GF2m_add(f, a, d); 502. BN_GF2m_mod_mul(g, f, c, b[j], ctx); 503. BN_GF2m_mod_mul(h, d, c, b[j], ctx); ^ 504. BN_GF2m_add(f, e, g); 505. BN_GF2m_add(f, f, h); crypto/bn/bn_gf2m.c:473:1: Parameter `ctx->stack.depth` 471. * BN_GF2m_mod_mul_arr function. 472. */ 473. > int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 474. const BIGNUM *p, BN_CTX *ctx) 475. { test/bntest.c:500:13: Call 498. BN_bntest_rand(d, 1024, 0, 0); 499. for (j = 0; j < 2; j++) { 500. BN_GF2m_mod_mul(e, a, c, b[j], ctx); ^ 501. BN_GF2m_add(f, a, d); 502. BN_GF2m_mod_mul(g, f, c, b[j], ctx); crypto/bn/bn_gf2m.c:473:1: Parameter `ctx->stack.depth` 471. * BN_GF2m_mod_mul_arr function. 472. */ 473. > int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 474. const BIGNUM *p, BN_CTX *ctx) 475. { crypto/bn/bn_gf2m.c:489:11: Call 487. goto err; 488. } 489. ret = BN_GF2m_mod_mul_arr(r, a, b, arr, ctx); ^ 490. bn_check_top(r); 491. err: crypto/bn/bn_gf2m.c:432:5: Call 430. } 431. 432. BN_CTX_start(ctx); ^ 433. if ((s = BN_CTX_get(ctx)) == NULL) 434. goto err; crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gf2m.c:462:5: Call 460. 461. err: 462. BN_CTX_end(ctx); ^ 463. return ret; 464. } crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.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_mul` 271. static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; ^ 274. } 275.
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_42923
static int JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result) { if (data->bufferbytesleft==0) { uint32 m; if (data->filebytesleft==0) return(0); if (!data->filepositioned) { TIFFSeekFile(data->tif,data->fileoffset,SEEK_SET); data->filepositioned=1; } m=data->buffersize; if ((uint64)m>data->filebytesleft) m=(uint32)data->filebytesleft; assert(m<0x80000000UL); if (TIFFReadFile(data->tif,data->buffer,(tmsize_t)m)!=(tmsize_t)m) return(0); data->buffercurrentbyte=data->buffer; data->bufferbytesleft=m; data->fileoffset+=m; data->filebytesleft-=m; } *result=*data->buffercurrentbyte; data->buffercurrentbyte++; data->bufferbytesleft--; return(1); } libtiff/tif_jpeg.c:792: error: Integer Overflow L2 ([1, +oo] - [0, 2147483647]):unsigned64 by call to `JPEGFixupTagsSubsamplingReadWord`. libtiff/tif_jpeg.c:743:1: Parameter `data->filebytesleft` 741. } 742. 743. static int ^ 744. JPEGFixupTagsSubsamplingSec(struct JPEGFixupTagsSubsamplingData* data) 745. { libtiff/tif_jpeg.c:752:9: Call 750. while (1) 751. { 752. if (!JPEGFixupTagsSubsamplingReadByte(data,&m)) ^ 753. return(0); 754. if (m==255) libtiff/tif_jpeg.c:855:1: Parameter `data->filebytesleft` 853. } 854. 855. static int ^ 856. JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result) 857. { libtiff/tif_jpeg.c:759:9: Call 757. while (1) 758. { 759. if (!JPEGFixupTagsSubsamplingReadByte(data,&m)) ^ 760. return(0); 761. if (m!=255) libtiff/tif_jpeg.c:855:1: Parameter `data->filebytesleft` 853. } 854. 855. static int ^ 856. JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result) 857. { libtiff/tif_jpeg.c:792:11: Call 790. { 791. uint16 n; 792. if (!JPEGFixupTagsSubsamplingReadWord(data,&n)) ^ 793. return(0); 794. if (n<2) libtiff/tif_jpeg.c:885:1: Parameter `data->filebytesleft` 883. } 884. 885. static int ^ 886. JPEGFixupTagsSubsamplingReadWord(struct JPEGFixupTagsSubsamplingData* data, uint16* result) 887. { libtiff/tif_jpeg.c:890:7: Call 888. uint8 ma; 889. uint8 mb; 890. if (!JPEGFixupTagsSubsamplingReadByte(data,&ma)) ^ 891. return(0); 892. if (!JPEGFixupTagsSubsamplingReadByte(data,&mb)) libtiff/tif_jpeg.c:855:1: <LHS trace> 853. } 854. 855. static int ^ 856. JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result) 857. { libtiff/tif_jpeg.c:855:1: Parameter `data->filebytesleft` 853. } 854. 855. static int ^ 856. JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result) 857. { libtiff/tif_jpeg.c:872:7: <RHS trace> 870. m=(uint32)data->filebytesleft; 871. assert(m<0x80000000UL); 872. if (TIFFReadFile(data->tif,data->buffer,(tmsize_t)m)!=(tmsize_t)m) ^ 873. return(0); 874. data->buffercurrentbyte=data->buffer; libtiff/tif_jpeg.c:872:7: Unknown value from: non-const function 870. m=(uint32)data->filebytesleft; 871. assert(m<0x80000000UL); 872. if (TIFFReadFile(data->tif,data->buffer,(tmsize_t)m)!=(tmsize_t)m) ^ 873. return(0); 874. data->buffercurrentbyte=data->buffer; libtiff/tif_jpeg.c:877:3: Binary operation: ([1, +oo] - [0, 2147483647]):unsigned64 by call to `JPEGFixupTagsSubsamplingReadWord` 875. data->bufferbytesleft=m; 876. data->fileoffset+=m; 877. data->filebytesleft-=m; ^ 878. } 879. *result=*data->buffercurrentbyte;
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_jpeg.c/#L877
d2a_code_trace_data_42924
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:436: 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:435:10: Call 433. return EXT_RETURN_NOT_SENT; 434. 435. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_signed_certificate_timestamp) ^ 436. || !WPACKET_put_bytes_u16(pkt, 0)) { 437. SSLerr(SSL_F_TLS_CONSTRUCT_CTOS_SCT, 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:436:17: Call 434. 435. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_signed_certificate_timestamp) 436. || !WPACKET_put_bytes_u16(pkt, 0)) { ^ 437. SSLerr(SSL_F_TLS_CONSTRUCT_CTOS_SCT, ERR_R_INTERNAL_ERROR); 438. 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_42925
static inline void refill_32(BitstreamContext *bc) { if (bc->ptr >= bc->buffer_end) return; #ifdef BITSTREAM_READER_LE bc->bits = (uint64_t)AV_RL32(bc->ptr) << bc->bits_left | bc->bits; #else bc->bits = bc->bits | (uint64_t)AV_RB32(bc->ptr) << (32 - bc->bits_left); #endif bc->ptr += 4; bc->bits_left += 32; } libavcodec/mpc7.c:193: error: Integer Overflow L2 (32 - [0, `bc->bits_left` + 95]):unsigned32 by call to `bitstream_read`. libavcodec/mpc7.c:189:1: Parameter `bc->bits_left` 187. } 188. 189. static int get_scale_idx(BitstreamContext *bc, int ref) ^ 190. { 191. int t = bitstream_read_vlc(bc, dscf_vlc.table, MPC7_DSCF_BITS, 1) - 7; libavcodec/mpc7.c:191:13: Call 189. static int get_scale_idx(BitstreamContext *bc, int ref) 190. { 191. int t = bitstream_read_vlc(bc, dscf_vlc.table, MPC7_DSCF_BITS, 1) - 7; ^ 192. if (t == 8) 193. return bitstream_read(bc, 6); libavcodec/bitstream.h:313:1: Parameter `(*table)[*]` 311. * If the VLC code is invalid and max_depth > 1, then the number of bits removed 312. * is undefined. */ 313. static inline int bitstream_read_vlc(BitstreamContext *bc, VLC_TYPE (*table)[2], ^ 314. int bits, int max_depth) 315. { libavcodec/bitstream.h:319:5: Assignment 317. unsigned idx = bitstream_peek(bc, bits); 318. int code = table[idx][0]; 319. int n = table[idx][1]; ^ 320. 321. if (max_depth > 1 && n < 0) { libavcodec/bitstream.h:329:5: Call 327. } 328. } 329. skip_remaining(bc, n); ^ 330. 331. return code; libavcodec/bitstream.h:230:1: Parameter `n` 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:237:5: Assignment 235. bc->bits <<= n; 236. #endif 237. bc->bits_left -= n; ^ 238. } 239. libavcodec/mpc7.c:193:16: Call 191. int t = bitstream_read_vlc(bc, dscf_vlc.table, MPC7_DSCF_BITS, 1) - 7; 192. if (t == 8) 193. return bitstream_read(bc, 6); ^ 194. return av_clip_uintp2(ref + t, 7); 195. } libavcodec/bitstream.h:183:1: Parameter `n` 181. 182. /* Return n bits from the buffer. n has to be in the 0-32 range. */ 183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n) ^ 184. { 185. if (!n) libavcodec/bitstream.h:189:9: Call 187. 188. if (n > bc->bits_left) { 189. refill_32(bc); ^ 190. if (bc->bits_left < 32) 191. bc->bits_left = n; libavcodec/bitstream.h:60:1: <RHS trace> 58. } 59. 60. static inline void refill_32(BitstreamContext *bc) ^ 61. { 62. if (bc->ptr >= bc->buffer_end) libavcodec/bitstream.h:60:1: Parameter `bc->bits_left` 58. } 59. 60. static inline void refill_32(BitstreamContext *bc) ^ 61. { 62. if (bc->ptr >= bc->buffer_end) libavcodec/bitstream.h:68:5: Binary operation: (32 - [0, bc->bits_left + 95]):unsigned32 by call to `bitstream_read` 66. bc->bits = (uint64_t)AV_RL32(bc->ptr) << bc->bits_left | bc->bits; 67. #else 68. bc->bits = bc->bits | (uint64_t)AV_RB32(bc->ptr) << (32 - bc->bits_left); ^ 69. #endif 70. bc->ptr += 4;
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L68
d2a_code_trace_data_42926
static int ssl_cipher_process_rulestr(const char *rule_str, CIPHER_ORDER **head_p, CIPHER_ORDER **tail_p, const SSL_CIPHER **ca_list, CERT *c) { uint32_t alg_mkey, alg_auth, alg_enc, alg_mac, algo_strength; int min_tls; const char *l, *buf; int j, multi, found, rule, retval, ok, buflen; uint32_t cipher_id = 0; char ch; retval = 1; l = rule_str; for ( ; ; ) { ch = *l; if (ch == '\0') break; if (ch == '-') { rule = CIPHER_DEL; l++; } else if (ch == '+') { rule = CIPHER_ORD; l++; } else if (ch == '!') { rule = CIPHER_KILL; l++; } else if (ch == '@') { rule = CIPHER_SPECIAL; l++; } else { rule = CIPHER_ADD; } if (ITEM_SEP(ch)) { l++; continue; } alg_mkey = 0; alg_auth = 0; alg_enc = 0; alg_mac = 0; min_tls = 0; algo_strength = 0; for (;;) { ch = *l; buf = l; buflen = 0; #ifndef CHARSET_EBCDIC while (((ch >= 'A') && (ch <= 'Z')) || ((ch >= '0') && (ch <= '9')) || ((ch >= 'a') && (ch <= 'z')) || (ch == '-') || (ch == '.') || (ch == '=')) #else while (isalnum((unsigned char)ch) || (ch == '-') || (ch == '.') || (ch == '=')) #endif { ch = *(++l); buflen++; } if (buflen == 0) { SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR, SSL_R_INVALID_COMMAND); retval = found = 0; l++; break; } if (rule == CIPHER_SPECIAL) { found = 0; break; } if (ch == '+') { multi = 1; l++; } else { multi = 0; } j = found = 0; cipher_id = 0; while (ca_list[j]) { if (strncmp(buf, ca_list[j]->name, buflen) == 0 && (ca_list[j]->name[buflen] == '\0')) { found = 1; break; } else j++; } if (!found) break; if (ca_list[j]->algorithm_mkey) { if (alg_mkey) { alg_mkey &= ca_list[j]->algorithm_mkey; if (!alg_mkey) { found = 0; break; } } else { alg_mkey = ca_list[j]->algorithm_mkey; } } if (ca_list[j]->algorithm_auth) { if (alg_auth) { alg_auth &= ca_list[j]->algorithm_auth; if (!alg_auth) { found = 0; break; } } else { alg_auth = ca_list[j]->algorithm_auth; } } if (ca_list[j]->algorithm_enc) { if (alg_enc) { alg_enc &= ca_list[j]->algorithm_enc; if (!alg_enc) { found = 0; break; } } else { alg_enc = ca_list[j]->algorithm_enc; } } if (ca_list[j]->algorithm_mac) { if (alg_mac) { alg_mac &= ca_list[j]->algorithm_mac; if (!alg_mac) { found = 0; break; } } else { alg_mac = ca_list[j]->algorithm_mac; } } if (ca_list[j]->algo_strength & SSL_STRONG_MASK) { if (algo_strength & SSL_STRONG_MASK) { algo_strength &= (ca_list[j]->algo_strength & SSL_STRONG_MASK) | ~SSL_STRONG_MASK; if (!(algo_strength & SSL_STRONG_MASK)) { found = 0; break; } } else { algo_strength = ca_list[j]->algo_strength & SSL_STRONG_MASK; } } if (ca_list[j]->algo_strength & SSL_DEFAULT_MASK) { if (algo_strength & SSL_DEFAULT_MASK) { algo_strength &= (ca_list[j]->algo_strength & SSL_DEFAULT_MASK) | ~SSL_DEFAULT_MASK; if (!(algo_strength & SSL_DEFAULT_MASK)) { found = 0; break; } } else { algo_strength |= ca_list[j]->algo_strength & SSL_DEFAULT_MASK; } } if (ca_list[j]->valid) { cipher_id = ca_list[j]->id; } else { if (ca_list[j]->min_tls) { if (min_tls != 0 && min_tls != ca_list[j]->min_tls) { found = 0; break; } else { min_tls = ca_list[j]->min_tls; } } } if (!multi) break; } if (rule == CIPHER_SPECIAL) { ok = 0; if ((buflen == 8) && strncmp(buf, "STRENGTH", 8) == 0) { ok = ssl_cipher_strength_sort(head_p, tail_p); } else if (buflen == 10 && strncmp(buf, "SECLEVEL=", 9) == 0) { int level = buf[9] - '0'; if (level < 0 || level > 5) { SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR, SSL_R_INVALID_COMMAND); } else { c->sec_level = level; ok = 1; } } else { SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR, SSL_R_INVALID_COMMAND); } if (ok == 0) retval = 0; while ((*l != '\0') && !ITEM_SEP(*l)) l++; } else if (found) { ssl_cipher_apply_rule(cipher_id, alg_mkey, alg_auth, alg_enc, alg_mac, min_tls, algo_strength, rule, -1, head_p, tail_p); } else { while ((*l != '\0') && !ITEM_SEP(*l)) l++; } if (*l == '\0') break; } return retval; } test/clienthellotest.c:102: error: BUFFER_OVERRUN_L1 Offset: [9, +oo] (⇐ [0, +oo] + 9) Size: 1 by call to `SSL_CTX_set_cipher_list`. Showing all 13 steps of the trace test/clienthellotest.c:102:14: Call 100. * that is too long for this test we use a restricted ciphersuite list 101. */ 102. if (!TEST_true(SSL_CTX_set_cipher_list(ctx, ""))) ^ 103. goto end; 104. /* Fall through */ ssl/ssl_lib.c:2511:1: Parameter `*str` 2509. 2510. /** specify the ciphers to be used by default by the SSL_CTX */ 2511. > int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str) 2512. { 2513. STACK_OF(SSL_CIPHER) *sk; ssl/ssl_lib.c:2515:10: Call 2513. STACK_OF(SSL_CIPHER) *sk; 2514. 2515. sk = ssl_create_cipher_list(ctx->method, ctx->tls13_ciphersuites, ^ 2516. &ctx->cipher_list, &ctx->cipher_list_by_id, str, 2517. ctx->cert); ssl/ssl_ciph.c:1403:1: Parameter `*rule_str` 1401. } 1402. 1403. > STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method, 1404. STACK_OF(SSL_CIPHER) *tls13_ciphersuites, 1405. STACK_OF(SSL_CIPHER) **cipher_list, ssl/ssl_ciph.c:1423:10: Call 1421. return NULL; 1422. #ifndef OPENSSL_NO_EC 1423. if (!check_suiteb_cipher_list(ssl_method, c, &rule_str)) ^ 1424. return NULL; 1425. #endif ssl/ssl_ciph.c:1223:1: Parameter `**prule_str` 1221. 1222. #ifndef OPENSSL_NO_EC 1223. > static int check_suiteb_cipher_list(const SSL_METHOD *meth, CERT *c, 1224. const char **prule_str) 1225. { ssl/ssl_ciph.c:1572:5: Assignment 1570. */ 1571. ok = 1; 1572. rule_p = rule_str; ^ 1573. if (strncmp(rule_str, "DEFAULT", 7) == 0) { 1574. ok = ssl_cipher_process_rulestr(SSL_DEFAULT_CIPHER_LIST, ssl/ssl_ciph.c:1582:14: Call 1580. 1581. if (ok && (strlen(rule_p) > 0)) 1582. ok = ssl_cipher_process_rulestr(rule_p, &head, &tail, ca_list, c); ^ 1583. 1584. OPENSSL_free(ca_list); /* Not needed anymore */ ssl/ssl_ciph.c:958:1: <Length trace> 956. } 957. 958. > static int ssl_cipher_process_rulestr(const char *rule_str, 959. CIPHER_ORDER **head_p, 960. CIPHER_ORDER **tail_p, ssl/ssl_ciph.c:958:1: Parameter `*rule_str` 956. } 957. 958. > static int ssl_cipher_process_rulestr(const char *rule_str, 959. CIPHER_ORDER **head_p, 960. CIPHER_ORDER **tail_p, ssl/ssl_ciph.c:971:5: Assignment 969. 970. retval = 1; 971. l = rule_str; ^ 972. for ( ; ; ) { 973. ch = *l; ssl/ssl_ciph.c:1007:13: Assignment 1005. for (;;) { 1006. ch = *l; 1007. buf = l; ^ 1008. buflen = 0; 1009. #ifndef CHARSET_EBCDIC ssl/ssl_ciph.c:1185:29: Array access: Offset: [9, +oo] (⇐ [0, +oo] + 9) Size: 1 by call to `SSL_CTX_set_cipher_list` 1183. ok = ssl_cipher_strength_sort(head_p, tail_p); 1184. } else if (buflen == 10 && strncmp(buf, "SECLEVEL=", 9) == 0) { 1185. int level = buf[9] - '0'; ^ 1186. if (level < 0 || level > 5) { 1187. SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR,
https://github.com/openssl/openssl/blob/4845aeba4c49e1bd65259a5014d7e3ab38657d42/ssl/ssl_ciph.c/#L1185
d2a_code_trace_data_42927
int ssl_check_clienthello_tlsext_late(SSL *s) { int ret = SSL_TLSEXT_ERR_OK; int al; if ((s->tlsext_status_type != -1) && s->ctx && s->ctx->tlsext_status_cb) { int r; CERT_PKEY *certpkey; certpkey = ssl_get_server_send_pkey(s); if (certpkey == NULL) { s->tlsext_status_expected = 0; return 1; } s->cert->key = certpkey; r = s->ctx->tlsext_status_cb(s, s->ctx->tlsext_status_arg); switch (r) { case SSL_TLSEXT_ERR_NOACK: s->tlsext_status_expected = 0; break; case SSL_TLSEXT_ERR_OK: if (s->tlsext_ocsp_resp) s->tlsext_status_expected = 1; else s->tlsext_status_expected = 0; break; case SSL_TLSEXT_ERR_ALERT_FATAL: ret = SSL_TLSEXT_ERR_ALERT_FATAL; al = SSL_AD_INTERNAL_ERROR; goto err; } } else s->tlsext_status_expected = 0; err: switch (ret) { case SSL_TLSEXT_ERR_ALERT_FATAL: ssl3_send_alert(s,SSL3_AL_FATAL,al); return -1; case SSL_TLSEXT_ERR_ALERT_WARNING: ssl3_send_alert(s,SSL3_AL_WARNING,al); return 1; default: return 1; } } ssl/t1_lib.c:1928: error: UNINITIALIZED_VALUE The value read from al was never initialized. Showing all 1 steps of the trace ssl/t1_lib.c:1928:4: 1926. 1927. case SSL_TLSEXT_ERR_ALERT_WARNING: 1928. > ssl3_send_alert(s,SSL3_AL_WARNING,al); 1929. return 1; 1930.
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/ssl/t1_lib.c/#L1928
d2a_code_trace_data_42928
static int createImageSection(uint32 sectsize, unsigned char **sect_buff_ptr) { unsigned char *sect_buff = NULL; unsigned char *new_buff = NULL; static uint32 prev_sectsize = 0; sect_buff = *sect_buff_ptr; if (!sect_buff) { sect_buff = (unsigned char *)_TIFFmalloc(sectsize); *sect_buff_ptr = sect_buff; _TIFFmemset(sect_buff, 0, sectsize); } else { if (prev_sectsize < sectsize) { new_buff = _TIFFrealloc(sect_buff, sectsize); if (!new_buff) { free (sect_buff); sect_buff = (unsigned char *)_TIFFmalloc(sectsize); } else sect_buff = new_buff; _TIFFmemset(sect_buff, 0, sectsize); } } if (!sect_buff) { TIFFError("createImageSection", "Unable to allocate/reallocate section buffer"); return (-1); } prev_sectsize = sectsize; *sect_buff_ptr = sect_buff; return (0); } tools/tiffcrop.c:7175: error: Null Dereference pointer `sect_buff` last assigned on line 7173 could be null and is dereferenced by call to `_TIFFmemset()` at line 7175, column 5. tools/tiffcrop.c:7162:1: start of procedure createImageSection() 7160. 7161. /* Create a buffer to write one section at a time */ 7162. static int ^ 7163. createImageSection(uint32 sectsize, unsigned char **sect_buff_ptr) 7164. { tools/tiffcrop.c:7165:3: 7163. createImageSection(uint32 sectsize, unsigned char **sect_buff_ptr) 7164. { 7165. unsigned char *sect_buff = NULL; ^ 7166. unsigned char *new_buff = NULL; 7167. static uint32 prev_sectsize = 0; tools/tiffcrop.c:7166:3: 7164. { 7165. unsigned char *sect_buff = NULL; 7166. unsigned char *new_buff = NULL; ^ 7167. static uint32 prev_sectsize = 0; 7168. tools/tiffcrop.c:7167:3: 7165. unsigned char *sect_buff = NULL; 7166. unsigned char *new_buff = NULL; 7167. static uint32 prev_sectsize = 0; ^ 7168. 7169. sect_buff = *sect_buff_ptr; tools/tiffcrop.c:7169:3: 7167. static uint32 prev_sectsize = 0; 7168. 7169. sect_buff = *sect_buff_ptr; ^ 7170. 7171. if (!sect_buff) tools/tiffcrop.c:7171:8: Taking true branch 7169. sect_buff = *sect_buff_ptr; 7170. 7171. if (!sect_buff) ^ 7172. { 7173. sect_buff = (unsigned char *)_TIFFmalloc(sectsize); tools/tiffcrop.c:7173:5: 7171. if (!sect_buff) 7172. { 7173. sect_buff = (unsigned char *)_TIFFmalloc(sectsize); ^ 7174. *sect_buff_ptr = sect_buff; 7175. _TIFFmemset(sect_buff, 0, sectsize); libtiff/tif_unix.c:253:1: start of procedure _TIFFmalloc() 251. #endif 252. 253. void* ^ 254. _TIFFmalloc(tmsize_t s) 255. { libtiff/tif_unix.c:256:2: 254. _TIFFmalloc(tmsize_t s) 255. { 256. return (malloc((size_t) s)); ^ 257. } 258. libtiff/tif_unix.c:257:1: return from a call to _TIFFmalloc 255. { 256. return (malloc((size_t) s)); 257. } ^ 258. 259. void tools/tiffcrop.c:7174:5: 7172. { 7173. sect_buff = (unsigned char *)_TIFFmalloc(sectsize); 7174. *sect_buff_ptr = sect_buff; ^ 7175. _TIFFmemset(sect_buff, 0, sectsize); 7176. } tools/tiffcrop.c:7175:5: 7173. sect_buff = (unsigned char *)_TIFFmalloc(sectsize); 7174. *sect_buff_ptr = sect_buff; 7175. _TIFFmemset(sect_buff, 0, sectsize); ^ 7176. } 7177. else libtiff/tif_unix.c:271:1: start of procedure _TIFFmemset() 269. } 270. 271. void ^ 272. _TIFFmemset(void* p, int v, tmsize_t c) 273. { libtiff/tif_unix.c:274:2: 272. _TIFFmemset(void* p, int v, tmsize_t c) 273. { 274. memset(p, v, (size_t) c); ^ 275. } 276. libtiff/tif_unix.c:275:1: return from a call to _TIFFmemset 273. { 274. memset(p, v, (size_t) c); 275. } ^ 276. 277. void
https://gitlab.com/libtiff/libtiff/blob/b69a1998bedfabc32cd541408bffdef05bd01e45/tools/tiffcrop.c/#L7175
d2a_code_trace_data_42929
static void prime_field_tests(void) { BN_CTX *ctx = NULL; BIGNUM *p, *a, *b; EC_GROUP *group; EC_GROUP *P_160 = NULL, *P_192 = NULL, *P_224 = NULL, *P_256 = NULL, *P_384 = NULL, *P_521 = NULL; EC_POINT *P, *Q, *R; BIGNUM *x, *y, *z; unsigned char buf[100]; size_t i, len; int k; ctx = BN_CTX_new(); if (!ctx) ABORT; p = BN_new(); a = BN_new(); b = BN_new(); if (!p || !a || !b) ABORT; if (!BN_hex2bn(&p, "17")) ABORT; if (!BN_hex2bn(&a, "1")) ABORT; if (!BN_hex2bn(&b, "1")) ABORT; group = EC_GROUP_new(EC_GFp_mont_method()); if (!group) ABORT; if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT; { EC_GROUP *tmp; tmp = EC_GROUP_new(EC_GROUP_method_of(group)); if (!tmp) ABORT; if (!EC_GROUP_copy(tmp, group)) ABORT; EC_GROUP_free(group); group = tmp; } if (!EC_GROUP_get_curve_GFp(group, p, a, b, ctx)) ABORT; fprintf(stdout, "Curve defined by Weierstrass equation\n y^2 = x^3 + a*x + b (mod 0x"); BN_print_fp(stdout, p); fprintf(stdout, ")\n a = 0x"); BN_print_fp(stdout, a); fprintf(stdout, "\n b = 0x"); BN_print_fp(stdout, b); fprintf(stdout, "\n"); P = EC_POINT_new(group); Q = EC_POINT_new(group); R = EC_POINT_new(group); if (!P || !Q || !R) ABORT; if (!EC_POINT_set_to_infinity(group, P)) ABORT; if (!EC_POINT_is_at_infinity(group, P)) ABORT; buf[0] = 0; if (!EC_POINT_oct2point(group, Q, buf, 1, ctx)) ABORT; if (!EC_POINT_add(group, P, P, Q, ctx)) ABORT; if (!EC_POINT_is_at_infinity(group, P)) ABORT; x = BN_new(); y = BN_new(); z = BN_new(); if (!x || !y || !z) ABORT; if (!BN_hex2bn(&x, "D")) ABORT; if (!EC_POINT_set_compressed_coordinates_GFp(group, Q, x, 1, ctx)) ABORT; if (EC_POINT_is_on_curve(group, Q, ctx) <= 0) { if (!EC_POINT_get_affine_coordinates_GFp(group, Q, x, y, ctx)) ABORT; fprintf(stderr, "Point is not on curve: x = 0x"); BN_print_fp(stderr, x); fprintf(stderr, ", y = 0x"); BN_print_fp(stderr, y); fprintf(stderr, "\n"); ABORT; } fprintf(stdout, "A cyclic subgroup:\n"); k = 100; do { if (k-- == 0) ABORT; if (EC_POINT_is_at_infinity(group, P)) fprintf(stdout, " point at infinity\n"); else { if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT; fprintf(stdout, " x = 0x"); BN_print_fp(stdout, x); fprintf(stdout, ", y = 0x"); BN_print_fp(stdout, y); fprintf(stdout, "\n"); } if (!EC_POINT_copy(R, P)) ABORT; if (!EC_POINT_add(group, P, P, Q, ctx)) ABORT; } while (!EC_POINT_is_at_infinity(group, P)); if (!EC_POINT_add(group, P, Q, R, ctx)) ABORT; if (!EC_POINT_is_at_infinity(group, P)) ABORT; len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_COMPRESSED, buf, sizeof buf, ctx); if (len == 0) ABORT; if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT; if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT; fprintf(stdout, "Generator as octet string, compressed form:\n "); for (i = 0; i < len; i++) fprintf(stdout, "%02X", buf[i]); len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_UNCOMPRESSED, buf, sizeof buf, ctx); if (len == 0) ABORT; if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT; if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT; fprintf(stdout, "\nGenerator as octet string, uncompressed form:\n "); for (i = 0; i < len; i++) fprintf(stdout, "%02X", buf[i]); len = EC_POINT_point2oct(group, Q, POINT_CONVERSION_HYBRID, buf, sizeof buf, ctx); if (len == 0) ABORT; if (!EC_POINT_oct2point(group, P, buf, len, ctx)) ABORT; if (0 != EC_POINT_cmp(group, P, Q, ctx)) ABORT; fprintf(stdout, "\nGenerator as octet string, hybrid form:\n "); for (i = 0; i < len; i++) fprintf(stdout, "%02X", buf[i]); if (!EC_POINT_get_Jprojective_coordinates_GFp(group, R, x, y, z, ctx)) ABORT; fprintf(stdout, "\nA representation of the inverse of that generator in\nJacobian projective coordinates:\n X = 0x"); BN_print_fp(stdout, x); fprintf(stdout, ", Y = 0x"); BN_print_fp(stdout, y); fprintf(stdout, ", Z = 0x"); BN_print_fp(stdout, z); fprintf(stdout, "\n"); if (!EC_POINT_invert(group, P, ctx)) ABORT; if (0 != EC_POINT_cmp(group, P, R, ctx)) ABORT; if (!BN_hex2bn(&p, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF")) ABORT; if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT; if (!BN_hex2bn(&a, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC")) ABORT; if (!BN_hex2bn(&b, "1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45")) ABORT; if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT; if (!BN_hex2bn(&x, "4A96B5688EF573284664698968C38BB913CBFC82")) ABORT; if (!BN_hex2bn(&y, "23a628553168947d59dcc912042351377ac5fb32")) ABORT; if (!EC_POINT_set_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT; if (EC_POINT_is_on_curve(group, P, ctx) <= 0) ABORT; if (!BN_hex2bn(&z, "0100000000000000000001F4C8F927AED3CA752257")) ABORT; if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT; if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT; fprintf(stdout, "\nSEC2 curve secp160r1 -- Generator:\n x = 0x"); BN_print_fp(stdout, x); fprintf(stdout, "\n y = 0x"); BN_print_fp(stdout, y); fprintf(stdout, "\n"); if (!BN_hex2bn(&z, "23a628553168947d59dcc912042351377ac5fb32")) ABORT; if (0 != BN_cmp(y, z)) ABORT; fprintf(stdout, "verify degree ..."); if (EC_GROUP_get_degree(group) != 160) ABORT; fprintf(stdout, " ok\n"); group_order_tests(group); if ((P_160 = EC_GROUP_new(EC_GROUP_method_of(group))) == NULL) ABORT; if (!EC_GROUP_copy(P_160, group)) ABORT; if (!BN_hex2bn(&p, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF")) ABORT; if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT; if (!BN_hex2bn(&a, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC")) ABORT; if (!BN_hex2bn(&b, "64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1")) ABORT; if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT; if (!BN_hex2bn(&x, "188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012")) ABORT; if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx)) ABORT; if (EC_POINT_is_on_curve(group, P, ctx) <= 0) ABORT; if (!BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831")) ABORT; if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT; if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT; fprintf(stdout, "\nNIST curve P-192 -- Generator:\n x = 0x"); BN_print_fp(stdout, x); fprintf(stdout, "\n y = 0x"); BN_print_fp(stdout, y); fprintf(stdout, "\n"); if (!BN_hex2bn(&z, "07192B95FFC8DA78631011ED6B24CDD573F977A11E794811")) ABORT; if (0 != BN_cmp(y, z)) ABORT; fprintf(stdout, "verify degree ..."); if (EC_GROUP_get_degree(group) != 192) ABORT; fprintf(stdout, " ok\n"); group_order_tests(group); if ((P_192 = EC_GROUP_new(EC_GROUP_method_of(group))) == NULL) ABORT; if (!EC_GROUP_copy(P_192, group)) ABORT; if (!BN_hex2bn (&p, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001")) ABORT; if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT; if (!BN_hex2bn (&a, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE")) ABORT; if (!BN_hex2bn (&b, "B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4")) ABORT; if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT; if (!BN_hex2bn (&x, "B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21")) ABORT; if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 0, ctx)) ABORT; if (EC_POINT_is_on_curve(group, P, ctx) <= 0) ABORT; if (!BN_hex2bn (&z, "FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D")) ABORT; if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT; if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT; fprintf(stdout, "\nNIST curve P-224 -- Generator:\n x = 0x"); BN_print_fp(stdout, x); fprintf(stdout, "\n y = 0x"); BN_print_fp(stdout, y); fprintf(stdout, "\n"); if (!BN_hex2bn (&z, "BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34")) ABORT; if (0 != BN_cmp(y, z)) ABORT; fprintf(stdout, "verify degree ..."); if (EC_GROUP_get_degree(group) != 224) ABORT; fprintf(stdout, " ok\n"); group_order_tests(group); if ((P_224 = EC_GROUP_new(EC_GROUP_method_of(group))) == NULL) ABORT; if (!EC_GROUP_copy(P_224, group)) ABORT; if (!BN_hex2bn (&p, "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF")) ABORT; if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT; if (!BN_hex2bn (&a, "FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC")) ABORT; if (!BN_hex2bn (&b, "5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B")) ABORT; if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT; if (!BN_hex2bn (&x, "6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296")) ABORT; if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx)) ABORT; if (EC_POINT_is_on_curve(group, P, ctx) <= 0) ABORT; if (!BN_hex2bn(&z, "FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E" "84F3B9CAC2FC632551")) ABORT; if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT; if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT; fprintf(stdout, "\nNIST curve P-256 -- Generator:\n x = 0x"); BN_print_fp(stdout, x); fprintf(stdout, "\n y = 0x"); BN_print_fp(stdout, y); fprintf(stdout, "\n"); if (!BN_hex2bn (&z, "4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5")) ABORT; if (0 != BN_cmp(y, z)) ABORT; fprintf(stdout, "verify degree ..."); if (EC_GROUP_get_degree(group) != 256) ABORT; fprintf(stdout, " ok\n"); group_order_tests(group); if ((P_256 = EC_GROUP_new(EC_GROUP_method_of(group))) == NULL) ABORT; if (!EC_GROUP_copy(P_256, group)) ABORT; if (!BN_hex2bn(&p, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" "FFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF")) ABORT; if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT; if (!BN_hex2bn(&a, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" "FFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC")) ABORT; if (!BN_hex2bn(&b, "B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141" "120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF")) ABORT; if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT; if (!BN_hex2bn(&x, "AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B" "9859F741E082542A385502F25DBF55296C3A545E3872760AB7")) ABORT; if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 1, ctx)) ABORT; if (EC_POINT_is_on_curve(group, P, ctx) <= 0) ABORT; if (!BN_hex2bn(&z, "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" "FFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973")) ABORT; if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT; if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT; fprintf(stdout, "\nNIST curve P-384 -- Generator:\n x = 0x"); BN_print_fp(stdout, x); fprintf(stdout, "\n y = 0x"); BN_print_fp(stdout, y); fprintf(stdout, "\n"); if (!BN_hex2bn(&z, "3617DE4A96262C6F5D9E98BF9292DC29F8F41DBD289A14" "7CE9DA3113B5F0B8C00A60B1CE1D7E819D7A431D7C90EA0E5F")) ABORT; if (0 != BN_cmp(y, z)) ABORT; fprintf(stdout, "verify degree ..."); if (EC_GROUP_get_degree(group) != 384) ABORT; fprintf(stdout, " ok\n"); group_order_tests(group); if ((P_384 = EC_GROUP_new(EC_GROUP_method_of(group))) == NULL) ABORT; if (!EC_GROUP_copy(P_384, group)) ABORT; if (!BN_hex2bn(&p, "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" "FFFFFFFFFFFFFFFFFFFFFFFFFFFF")) ABORT; if (1 != BN_is_prime_ex(p, BN_prime_checks, ctx, NULL)) ABORT; if (!BN_hex2bn(&a, "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" "FFFFFFFFFFFFFFFFFFFFFFFFFFFC")) ABORT; if (!BN_hex2bn(&b, "051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B" "315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573" "DF883D2C34F1EF451FD46B503F00")) ABORT; if (!EC_GROUP_set_curve_GFp(group, p, a, b, ctx)) ABORT; if (!BN_hex2bn(&x, "C6858E06B70404E9CD9E3ECB662395B4429C648139053F" "B521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B" "3C1856A429BF97E7E31C2E5BD66")) ABORT; if (!EC_POINT_set_compressed_coordinates_GFp(group, P, x, 0, ctx)) ABORT; if (EC_POINT_is_on_curve(group, P, ctx) <= 0) ABORT; if (!BN_hex2bn(&z, "1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" "FFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5" "C9B8899C47AEBB6FB71E91386409")) ABORT; if (!EC_GROUP_set_generator(group, P, z, BN_value_one())) ABORT; if (!EC_POINT_get_affine_coordinates_GFp(group, P, x, y, ctx)) ABORT; fprintf(stdout, "\nNIST curve P-521 -- Generator:\n x = 0x"); BN_print_fp(stdout, x); fprintf(stdout, "\n y = 0x"); BN_print_fp(stdout, y); fprintf(stdout, "\n"); if (!BN_hex2bn(&z, "11839296A789A3BC0045C8A5FB42C7D1BD998F54449579" "B446817AFBD17273E662C97EE72995EF42640C550B9013FAD0761353C" "7086A272C24088BE94769FD16650")) ABORT; if (0 != BN_cmp(y, z)) ABORT; fprintf(stdout, "verify degree ..."); if (EC_GROUP_get_degree(group) != 521) ABORT; fprintf(stdout, " ok\n"); group_order_tests(group); if ((P_521 = EC_GROUP_new(EC_GROUP_method_of(group))) == NULL) ABORT; if (!EC_GROUP_copy(P_521, group)) ABORT; if (!EC_POINT_copy(Q, P)) ABORT; if (EC_POINT_is_at_infinity(group, Q)) ABORT; if (!EC_POINT_dbl(group, P, P, ctx)) ABORT; if (EC_POINT_is_on_curve(group, P, ctx) <= 0) ABORT; if (!EC_POINT_invert(group, Q, ctx)) ABORT; if (!EC_POINT_add(group, R, P, Q, ctx)) ABORT; if (!EC_POINT_add(group, R, R, Q, ctx)) ABORT; if (!EC_POINT_is_at_infinity(group, R)) ABORT; { const EC_POINT *points[4]; const BIGNUM *scalars[4]; BIGNUM *scalar3; if (EC_POINT_is_at_infinity(group, Q)) ABORT; points[0] = Q; points[1] = Q; points[2] = Q; points[3] = Q; if (!EC_GROUP_get_order(group, z, ctx)) ABORT; if (!BN_add(y, z, BN_value_one())) ABORT; if (BN_is_odd(y)) ABORT; if (!BN_rshift1(y, y)) ABORT; scalars[0] = y; scalars[1] = y; fprintf(stdout, "combined multiplication ..."); fflush(stdout); if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) ABORT; if (!EC_POINTs_mul(group, R, z, 2, points, scalars, ctx)) ABORT; if (0 != EC_POINT_cmp(group, P, R, ctx)) ABORT; if (0 != EC_POINT_cmp(group, R, Q, ctx)) ABORT; fprintf(stdout, "."); fflush(stdout); if (!BN_pseudo_rand(y, BN_num_bits(y), 0, 0)) ABORT; if (!BN_add(z, z, y)) ABORT; BN_set_negative(z, 1); scalars[0] = y; scalars[1] = z; if (!EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) ABORT; if (!EC_POINT_is_at_infinity(group, P)) ABORT; fprintf(stdout, "."); fflush(stdout); if (!BN_pseudo_rand(x, BN_num_bits(y) - 1, 0, 0)) ABORT; if (!BN_add(z, x, y)) ABORT; BN_set_negative(z, 1); scalars[0] = x; scalars[1] = y; scalars[2] = z; scalar3 = BN_new(); if (!scalar3) ABORT; BN_zero(scalar3); scalars[3] = scalar3; if (!EC_POINTs_mul(group, P, NULL, 4, points, scalars, ctx)) ABORT; if (!EC_POINT_is_at_infinity(group, P)) ABORT; fprintf(stdout, " ok\n\n"); BN_free(scalar3); } BN_CTX_free(ctx); BN_free(p); BN_free(a); BN_free(b); EC_GROUP_free(group); EC_POINT_free(P); EC_POINT_free(Q); EC_POINT_free(R); BN_free(x); BN_free(y); BN_free(z); EC_GROUP_free(P_160); EC_GROUP_free(P_192); EC_GROUP_free(P_224); EC_GROUP_free(P_256); EC_GROUP_free(P_384); EC_GROUP_free(P_521); } test/ectest.c:256: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 248, column 9 is not reachable after line 256, column 10. Showing all 107 steps of the trace test/ectest.c:229:1: start of procedure prime_field_tests() 227. } 228. 229. > static void prime_field_tests(void) 230. { 231. BN_CTX *ctx = NULL; test/ectest.c:231:5: 229. static void prime_field_tests(void) 230. { 231. > BN_CTX *ctx = NULL; 232. BIGNUM *p, *a, *b; 233. EC_GROUP *group; test/ectest.c:234:5: 232. BIGNUM *p, *a, *b; 233. EC_GROUP *group; 234. > EC_GROUP *P_160 = NULL, *P_192 = NULL, *P_224 = NULL, *P_256 = 235. NULL, *P_384 = NULL, *P_521 = NULL; 236. EC_POINT *P, *Q, *R; test/ectest.c:242:5: 240. int k; 241. 242. > ctx = BN_CTX_new(); 243. if (!ctx) 244. ABORT; crypto/bn/bn_ctx.c:189:1: start of procedure BN_CTX_new() 187. 188. 189. > BN_CTX *BN_CTX_new(void) 190. { 191. BN_CTX *ret; crypto/bn/bn_ctx.c:193:9: 191. BN_CTX *ret; 192. 193. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE); 195. return NULL; crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_ctx.c:193:9: Taking false branch 191. BN_CTX *ret; 192. 193. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE); 195. return NULL; crypto/bn/bn_ctx.c:198:5: 196. } 197. /* Initialise the structure */ 198. > BN_POOL_init(&ret->pool); 199. BN_STACK_init(&ret->stack); 200. return ret; crypto/bn/bn_ctx.c:335:1: start of procedure BN_POOL_init() 333. /***********/ 334. 335. > static void BN_POOL_init(BN_POOL *p) 336. { 337. p->head = p->current = p->tail = NULL; crypto/bn/bn_ctx.c:337:5: 335. static void BN_POOL_init(BN_POOL *p) 336. { 337. > p->head = p->current = p->tail = NULL; 338. p->used = p->size = 0; 339. } crypto/bn/bn_ctx.c:338:5: 336. { 337. p->head = p->current = p->tail = NULL; 338. > p->used = p->size = 0; 339. } 340. crypto/bn/bn_ctx.c:339:1: return from a call to BN_POOL_init 337. p->head = p->current = p->tail = NULL; 338. p->used = p->size = 0; 339. > } 340. 341. static void BN_POOL_finish(BN_POOL *p) crypto/bn/bn_ctx.c:199:5: 197. /* Initialise the structure */ 198. BN_POOL_init(&ret->pool); 199. > BN_STACK_init(&ret->stack); 200. return ret; 201. } crypto/bn/bn_ctx.c:294:1: start of procedure BN_STACK_init() 292. /************/ 293. 294. > static void BN_STACK_init(BN_STACK *st) 295. { 296. st->indexes = NULL; crypto/bn/bn_ctx.c:296:5: 294. static void BN_STACK_init(BN_STACK *st) 295. { 296. > st->indexes = NULL; 297. st->depth = st->size = 0; 298. } crypto/bn/bn_ctx.c:297:5: 295. { 296. st->indexes = NULL; 297. > st->depth = st->size = 0; 298. } 299. crypto/bn/bn_ctx.c:298:1: return from a call to BN_STACK_init 296. st->indexes = NULL; 297. st->depth = st->size = 0; 298. > } 299. 300. static void BN_STACK_finish(BN_STACK *st) crypto/bn/bn_ctx.c:200:5: 198. BN_POOL_init(&ret->pool); 199. BN_STACK_init(&ret->stack); 200. > return ret; 201. } 202. crypto/bn/bn_ctx.c:201:1: return from a call to BN_CTX_new 199. BN_STACK_init(&ret->stack); 200. return ret; 201. > } 202. 203. BN_CTX *BN_CTX_secure_new(void) test/ectest.c:243:10: Taking false branch 241. 242. ctx = BN_CTX_new(); 243. if (!ctx) ^ 244. ABORT; 245. test/ectest.c:246:5: 244. ABORT; 245. 246. > p = BN_new(); 247. a = BN_new(); 248. b = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/ectest.c:247:5: 245. 246. p = BN_new(); 247. > a = BN_new(); 248. b = BN_new(); 249. if (!p || !a || !b) crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/ectest.c:248:5: 246. p = BN_new(); 247. a = BN_new(); 248. > b = BN_new(); 249. if (!p || !a || !b) 250. ABORT; crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/ectest.c:249:10: Taking false branch 247. a = BN_new(); 248. b = BN_new(); 249. if (!p || !a || !b) ^ 250. ABORT; 251. test/ectest.c:249:16: Taking false branch 247. a = BN_new(); 248. b = BN_new(); 249. if (!p || !a || !b) ^ 250. ABORT; 251. test/ectest.c:249:22: Taking false branch 247. a = BN_new(); 248. b = BN_new(); 249. if (!p || !a || !b) ^ 250. ABORT; 251. test/ectest.c:252:10: Taking false branch 250. ABORT; 251. 252. if (!BN_hex2bn(&p, "17")) ^ 253. ABORT; 254. if (!BN_hex2bn(&a, "1")) test/ectest.c:254:10: Taking false branch 252. if (!BN_hex2bn(&p, "17")) 253. ABORT; 254. if (!BN_hex2bn(&a, "1")) ^ 255. ABORT; 256. if (!BN_hex2bn(&b, "1")) test/ectest.c:256:10: Skipping BN_hex2bn(): empty list of specs 254. if (!BN_hex2bn(&a, "1")) 255. ABORT; 256. if (!BN_hex2bn(&b, "1")) ^ 257. ABORT; 258.
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/ectest.c/#L256
d2a_code_trace_data_42930
void ff_MPV_frame_end(MpegEncContext *s) { int i; if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) { ff_xvmc_field_end(s); } else if ((s->error_count || s->encoding) && !s->avctx->hwaccel && !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) && s->unrestricted_mv && s->current_picture.f.reference && !s->intra_only && !(s->flags & CODEC_FLAG_EMU_EDGE)) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); int hshift = desc->log2_chroma_w; int vshift = desc->log2_chroma_h; s->dsp.draw_edges(s->current_picture.f.data[0], s->linesize, s->h_edge_pos, s->v_edge_pos, EDGE_WIDTH, EDGE_WIDTH, EDGE_TOP | EDGE_BOTTOM); s->dsp.draw_edges(s->current_picture.f.data[1], s->uvlinesize, s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_TOP | EDGE_BOTTOM); s->dsp.draw_edges(s->current_picture.f.data[2], s->uvlinesize, s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_TOP | EDGE_BOTTOM); } emms_c(); s->last_pict_type = s->pict_type; s->last_lambda_for [s->pict_type] = s->current_picture_ptr->f.quality; if (s->pict_type!= AV_PICTURE_TYPE_B) { s->last_non_b_pict_type = s->pict_type; } #if 0 for (i = 0; i < MAX_PICTURE_COUNT; i++) { if (s->picture[i].f.data[0] == s->current_picture.f.data[0]) { s->picture[i] = s->current_picture; break; } } assert(i < MAX_PICTURE_COUNT); #endif if (s->encoding) { for (i = 0; i < s->picture_count; i++) { if (s->picture[i].f.data[0] && !s->picture[i].f.reference ) { free_frame_buffer(s, &s->picture[i]); } } } #if 0 memset(&s->last_picture, 0, sizeof(Picture)); memset(&s->next_picture, 0, sizeof(Picture)); memset(&s->current_picture, 0, sizeof(Picture)); #endif s->avctx->coded_frame = &s->current_picture_ptr->f; if (s->codec_id != AV_CODEC_ID_H264 && s->current_picture.f.reference) { ff_thread_report_progress(&s->current_picture_ptr->f, INT_MAX, 0); } } libavcodec/mpegvideo.c:1577: error: Null Dereference pointer `desc` last assigned on line 1576 could be null and is dereferenced at line 1577, column 21. libavcodec/mpegvideo.c:1562:1: start of procedure ff_MPV_frame_end() 1560. /* generic function for encode/decode called after a 1561. * frame has been coded/decoded. */ 1562. void ff_MPV_frame_end(MpegEncContext *s) ^ 1563. { 1564. int i; libavcodec/mpegvideo.c:1567:9: Taking false branch 1565. /* redraw edges for the frame if decoding didn't complete */ 1566. // just to make sure that all data is rendered. 1567. if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) { ^ 1568. ff_xvmc_field_end(s); 1569. } else if ((s->error_count || s->encoding) && libavcodec/mpegvideo.c:1569:16: Taking false branch 1567. if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) { 1568. ff_xvmc_field_end(s); 1569. } else if ((s->error_count || s->encoding) && ^ 1570. !s->avctx->hwaccel && 1571. !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) && libavcodec/mpegvideo.c:1569:34: Taking true branch 1567. if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) { 1568. ff_xvmc_field_end(s); 1569. } else if ((s->error_count || s->encoding) && ^ 1570. !s->avctx->hwaccel && 1571. !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) && libavcodec/mpegvideo.c:1570:16: Taking true branch 1568. ff_xvmc_field_end(s); 1569. } else if ((s->error_count || s->encoding) && 1570. !s->avctx->hwaccel && ^ 1571. !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) && 1572. s->unrestricted_mv && libavcodec/mpegvideo.c:1571:17: Taking true branch 1569. } else if ((s->error_count || s->encoding) && 1570. !s->avctx->hwaccel && 1571. !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) && ^ 1572. s->unrestricted_mv && 1573. s->current_picture.f.reference && libavcodec/mpegvideo.c:1572:15: Taking true branch 1570. !s->avctx->hwaccel && 1571. !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) && 1572. s->unrestricted_mv && ^ 1573. s->current_picture.f.reference && 1574. !s->intra_only && libavcodec/mpegvideo.c:1573:15: Taking true branch 1571. !(s->avctx->codec->capabilities & CODEC_CAP_HWACCEL_VDPAU) && 1572. s->unrestricted_mv && 1573. s->current_picture.f.reference && ^ 1574. !s->intra_only && 1575. !(s->flags & CODEC_FLAG_EMU_EDGE)) { libavcodec/mpegvideo.c:1574:16: Taking true branch 1572. s->unrestricted_mv && 1573. s->current_picture.f.reference && 1574. !s->intra_only && ^ 1575. !(s->flags & CODEC_FLAG_EMU_EDGE)) { 1576. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); libavcodec/mpegvideo.c:1575:17: Taking true branch 1573. s->current_picture.f.reference && 1574. !s->intra_only && 1575. !(s->flags & CODEC_FLAG_EMU_EDGE)) { ^ 1576. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); 1577. int hshift = desc->log2_chroma_w; libavcodec/mpegvideo.c:1576:8: 1574. !s->intra_only && 1575. !(s->flags & CODEC_FLAG_EMU_EDGE)) { 1576. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); ^ 1577. int hshift = desc->log2_chroma_w; 1578. int vshift = desc->log2_chroma_h; libavutil/pixdesc.c:1434:1: start of procedure av_pix_fmt_desc_get() 1432. } 1433. 1434. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) ^ 1435. { 1436. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) libavutil/pixdesc.c:1436:9: Taking false branch 1434. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1435. { 1436. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1437. return NULL; 1438. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1436:24: Taking true branch 1434. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1435. { 1436. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1437. return NULL; 1438. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1437:9: 1435. { 1436. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) 1437. return NULL; ^ 1438. return &av_pix_fmt_descriptors[pix_fmt]; 1439. } libavutil/pixdesc.c:1439:1: return from a call to av_pix_fmt_desc_get 1437. return NULL; 1438. return &av_pix_fmt_descriptors[pix_fmt]; 1439. } ^ 1440. 1441. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) libavcodec/mpegvideo.c:1577:8: 1575. !(s->flags & CODEC_FLAG_EMU_EDGE)) { 1576. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); 1577. int hshift = desc->log2_chroma_w; ^ 1578. int vshift = desc->log2_chroma_h; 1579. s->dsp.draw_edges(s->current_picture.f.data[0], s->linesize,
https://github.com/libav/libav/blob/45635885e44cb7adce35ac19279d48c1ef6c4779/libavcodec/mpegvideo.c/#L1577
d2a_code_trace_data_42931
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:236: 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:235:5: Call 233. curve448_scalar_t scalar1x; 234. 235. curve448_scalar_add(scalar1x, scalar, precomputed_scalarmul_adjustment); ^ 236. curve448_scalar_halve(scalar1x, scalar1x); 237. crypto/ec/curve448/scalar.c:122:1: Parameter `b->limb[*]` 120. } 121. 122. > void curve448_scalar_add(curve448_scalar_t out, const curve448_scalar_t a, 123. const curve448_scalar_t b) 124. { crypto/ec/curve448/curve448.c:236:5: Call 234. 235. curve448_scalar_add(scalar1x, scalar, precomputed_scalarmul_adjustment); 236. curve448_scalar_halve(scalar1x, scalar1x); ^ 237. 238. for (i = s; i > 0; i--) { 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_42932
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bn_internal_test.c:56: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `bn_miller_rabin_is_prime`. Showing all 66 steps of the trace test/bn_internal_test.c:56:14: Call 54. /* negative tests for different composite numbers */ 55. && TEST_true(BN_set_word(bn, composites[id])) 56. && TEST_true(bn_miller_rabin_is_prime(bn, 10, ctx, NULL, 1, &status)) ^ 57. && TEST_int_ne(status, BN_PRIMETEST_PROBABLY_PRIME); 58. crypto/bn/bn_prime.c:249:1: Parameter `ctx->stack.depth` 247. * returns 0 if there was an error, otherwise it returns 1. 248. */ 249. > int bn_miller_rabin_is_prime(const BIGNUM *w, int iterations, BN_CTX *ctx, 250. BN_GENCB *cb, int enhanced, int *status) 251. { crypto/bn/bn_prime.c:260:5: Call 258. return 0; 259. 260. BN_CTX_start(ctx); ^ 261. g = BN_CTX_get(ctx); 262. w1 = 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_prime.c:261:9: Call 259. 260. BN_CTX_start(ctx); 261. g = BN_CTX_get(ctx); ^ 262. w1 = BN_CTX_get(ctx); 263. w3 = 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_prime.c:262:10: Call 260. BN_CTX_start(ctx); 261. g = BN_CTX_get(ctx); 262. w1 = BN_CTX_get(ctx); ^ 263. w3 = BN_CTX_get(ctx); 264. x = 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_prime.c:263:10: Call 261. g = BN_CTX_get(ctx); 262. w1 = BN_CTX_get(ctx); 263. w3 = BN_CTX_get(ctx); ^ 264. x = BN_CTX_get(ctx); 265. m = 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_prime.c:264:9: Call 262. w1 = BN_CTX_get(ctx); 263. w3 = BN_CTX_get(ctx); 264. x = BN_CTX_get(ctx); ^ 265. m = BN_CTX_get(ctx); 266. z = 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_prime.c:265:9: Call 263. w3 = BN_CTX_get(ctx); 264. x = BN_CTX_get(ctx); 265. m = BN_CTX_get(ctx); ^ 266. z = BN_CTX_get(ctx); 267. b = 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_prime.c:266:9: Call 264. x = BN_CTX_get(ctx); 265. m = BN_CTX_get(ctx); 266. z = BN_CTX_get(ctx); ^ 267. b = BN_CTX_get(ctx); 268. 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_prime.c:267:9: Call 265. m = BN_CTX_get(ctx); 266. z = BN_CTX_get(ctx); 267. b = BN_CTX_get(ctx); ^ 268. 269. if (!(b != NULL crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_prime.c:292:26: Call 290. /* Montgomery setup for computations mod a */ 291. mont = BN_MONT_CTX_new(); 292. if (mont == NULL || !BN_MONT_CTX_set(mont, w, ctx)) ^ 293. goto err; 294. crypto/bn/bn_mont.c:263:1: Parameter `ctx->stack.depth` 261. } 262. 263. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 264. { 265. int i, ret = 0; crypto/bn/bn_mont.c:271:5: Call 269. return 0; 270. 271. BN_CTX_start(ctx); ^ 272. if ((Ri = BN_CTX_get(ctx)) == NULL) 273. goto err; crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_mont.c:272:15: Call 270. 271. BN_CTX_start(ctx); 272. if ((Ri = BN_CTX_get(ctx)) == NULL) ^ 273. goto err; 274. R = &(mont->RR); /* grab RR as a temp */ crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_mont.c:351:19: Call 349. if (BN_is_one(&tmod)) 350. BN_zero(Ri); 351. else if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL) ^ 352. goto err; 353. if (!BN_lshift(Ri, Ri, BN_BITS2)) crypto/bn/bn_gcd.c:124:1: Parameter `ctx->stack.depth` 122. BN_CTX *ctx); 123. 124. > BIGNUM *BN_mod_inverse(BIGNUM *in, 125. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 126. { crypto/bn/bn_gcd.c:129:10: Call 127. BIGNUM *rv; 128. int noinv; 129. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv); ^ 130. if (noinv) 131. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); crypto/bn/bn_gcd.c:135:1: Parameter `ctx->stack.depth` 133. } 134. 135. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 136. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 137. int *pnoinv) crypto/bn/bn_gcd.c:155:16: Call 153. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) 154. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) { 155. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 156. } 157. crypto/bn/bn_gcd.c:458:1: Parameter `ctx->stack.depth` 456. * not contain branches that may leak sensitive information. 457. */ 458. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 459. const BIGNUM *a, const BIGNUM *n, 460. BN_CTX *ctx) crypto/bn/bn_gcd.c:469:5: Call 467. bn_check_top(n); 468. 469. BN_CTX_start(ctx); ^ 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gcd.c:470:9: Call 468. 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); ^ 471. B = BN_CTX_get(ctx); 472. X = 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_gcd.c:471:9: Call 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); ^ 472. X = BN_CTX_get(ctx); 473. D = 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_gcd.c:472:9: Call 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); ^ 473. D = BN_CTX_get(ctx); 474. M = 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_gcd.c:473:9: Call 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); ^ 474. M = BN_CTX_get(ctx); 475. Y = 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_gcd.c:474:9: Call 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); ^ 475. Y = BN_CTX_get(ctx); 476. T = 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_gcd.c:475:9: Call 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); ^ 476. T = BN_CTX_get(ctx); 477. if (T == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:476:9: Call 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); 476. T = BN_CTX_get(ctx); ^ 477. if (T == NULL) 478. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:504:18: Call 502. bn_init(&local_B); 503. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME); 504. if (!BN_nnmod(B, &local_B, A, ctx)) ^ 505. goto err; 506. /* Ensure local_B goes out of scope before any further use of B */ crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth` 207. * If 'dv' or 'rm' is NULL, the respective value is not returned. 208. */ 209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 210. BN_CTX *ctx) 211. { crypto/bn/bn_div.c:229:11: Call 227. } 228. 229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx); ^ 230. 231. if (ret) { crypto/bn/bn_div.c:264:1: Parameter `ctx->stack.depth` 262. * divisor's length is considered public; 263. */ 264. > int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, 265. const BIGNUM *divisor, BN_CTX *ctx) 266. { crypto/bn/bn_div.c:280:5: Call 278. bn_check_top(rm); 279. 280. BN_CTX_start(ctx); ^ 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_div.c:282:11: Call 280. BN_CTX_start(ctx); 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); ^ 283. snum = BN_CTX_get(ctx); 284. sdiv = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_div.c:283:12: Call 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); 283. snum = BN_CTX_get(ctx); ^ 284. sdiv = BN_CTX_get(ctx); 285. if (sdiv == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_div.c:284:12: Call 282. tmp = BN_CTX_get(ctx); 283. snum = BN_CTX_get(ctx); 284. sdiv = BN_CTX_get(ctx); ^ 285. if (sdiv == NULL) 286. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_div.c:450:5: Call 448. if (rm != NULL) 449. bn_rshift_fixed_top(rm, snum, norm_shift); 450. BN_CTX_end(ctx); ^ 451. return 1; 452. err: crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <LHS trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `bn_miller_rabin_is_prime` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_42933
int test_sub(BIO *bp) { BIGNUM *a, *b, *c; int i; a = BN_new(); b = BN_new(); c = BN_new(); for (i = 0; i < num0 + num1; i++) { if (i < num1) { BN_bntest_rand(a, 512, 0, 0); BN_copy(b, a); if (BN_set_bit(a, i) == 0) return (0); BN_add_word(b, i); } else { BN_bntest_rand(b, 400 + i - num1, 0, 0); a->neg = rand_neg(); b->neg = rand_neg(); } BN_sub(c, a, b); if (bp != NULL) { if (!results) { BN_print(bp, a); BIO_puts(bp, " - "); BN_print(bp, b); BIO_puts(bp, " - "); } BN_print(bp, c); BIO_puts(bp, "\n"); } BN_add(c, c, b); BN_sub(c, c, a); if (!BN_is_zero(c)) { fprintf(stderr, "Subtract test failed!\n"); return 0; } } BN_free(a); BN_free(b); BN_free(c); return (1); } test/bntest.c:443: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 409, column 9 is not reachable after line 443, column 5. Showing all 82 steps of the trace test/bntest.c:404:1: start of procedure test_sub() 402. } 403. 404. > int test_sub(BIO *bp) 405. { 406. BIGNUM *a, *b, *c; test/bntest.c:409:5: 407. int i; 408. 409. > a = BN_new(); 410. b = BN_new(); 411. 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:410:5: 408. 409. a = BN_new(); 410. > b = BN_new(); 411. c = BN_new(); 412. 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:411:5: 409. a = BN_new(); 410. b = BN_new(); 411. > c = BN_new(); 412. 413. 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:413:10: 411. c = BN_new(); 412. 413. > for (i = 0; i < num0 + num1; i++) { 414. if (i < num1) { 415. BN_bntest_rand(a, 512, 0, 0); test/bntest.c:413:17: Loop condition is false. Leaving loop 411. c = BN_new(); 412. 413. for (i = 0; i < num0 + num1; i++) { ^ 414. if (i < num1) { 415. BN_bntest_rand(a, 512, 0, 0); test/bntest.c:443:5: 441. } 442. } 443. > BN_free(a); 444. BN_free(b); 445. BN_free(c); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L443
d2a_code_trace_data_42934
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) { bn_check_top(b); if (a == b) return a; if (bn_wexpand(a, b->top) == NULL) return NULL; if (b->top > 0) memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); a->neg = b->neg; a->top = b->top; a->flags |= b->flags & BN_FLG_FIXED_TOP; bn_check_top(a); return a; } apps/dhparam.c:273: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `DH_check`. Showing all 22 steps of the trace apps/dhparam.c:269:9: Call 267. 268. if (text) { 269. DHparams_print(out, dh); ^ 270. } 271. crypto/dh/dh_ameth.c:480:1: Parameter `x->q->top` 478. } 479. 480. > int DHparams_print(BIO *bp, const DH *x) 481. { 482. return do_dh_print(bp, x, 4, 0); crypto/dh/dh_ameth.c:482:12: Call 480. int DHparams_print(BIO *bp, const DH *x) 481. { 482. return do_dh_print(bp, x, 4, 0); ^ 483. } 484. crypto/dh/dh_ameth.c:267:1: Parameter `x->q->top` 265. } 266. 267. > static int do_dh_print(BIO *bp, const DH *x, int indent, int ptype) 268. { 269. int reason = ERR_R_BUF_LIB; apps/dhparam.c:273:14: Call 271. 272. if (check) { 273. if (!DH_check(dh, &i)) { ^ 274. ERR_print_errors(bio_err); 275. goto end; crypto/dh/dh_check.c:101:1: Parameter `dh->p->top` 99. } 100. 101. > int DH_check(const DH *dh, int *ret) 102. { 103. int ok = 0, r; crypto/dh/dh_check.c:121:18: Call 119. if (BN_cmp(dh->g, BN_value_one()) <= 0) 120. *ret |= DH_NOT_SUITABLE_GENERATOR; 121. else if (BN_cmp(dh->g, dh->p) >= 0) ^ 122. *ret |= DH_NOT_SUITABLE_GENERATOR; 123. else { crypto/bn/bn_lib.c:581:1: Parameter `a->top` 579. } 580. 581. > int BN_cmp(const BIGNUM *a, const BIGNUM *b) 582. { 583. int i; crypto/dh/dh_check.c:125:18: Call 123. else { 124. /* Check g^q == 1 mod p */ 125. if (!BN_mod_exp(t1, dh->g, dh->q, dh->p, ctx)) ^ 126. goto err; 127. if (!BN_is_one(t1)) 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:881:1: Parameter `a->top` 879. } 880. 881. > int BN_is_odd(const BIGNUM *a) 882. { 883. 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:281:1: <Offset trace> 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:281:1: Parameter `b->top` 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:281:1: <Length trace> 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:281:1: Parameter `*a->d` 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:287:9: Call 285. if (a == b) 286. return a; 287. if (bn_wexpand(a, b->top) == NULL) ^ 288. return NULL; 289. crypto/bn/bn_lib.c:962:1: Parameter `*a->d` 960. } 961. 962. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 963. { 964. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:291:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `DH_check` 289. 290. if (b->top > 0) 291. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); ^ 292. 293. a->neg = b->neg;
https://github.com/openssl/openssl/blob/260a16f33682a819414fcba6161708a5e6bdff50/crypto/bn/bn_lib.c/#L291
d2a_code_trace_data_42935
int test_gf2m_add(BIO *bp) { BIGNUM *a, *b, *c; int i, ret = 0; a = BN_new(); b = BN_new(); c = BN_new(); for (i = 0; i < num0; i++) { BN_rand(a, 512, 0, 0); BN_copy(b, BN_value_one()); a->neg = rand_neg(); b->neg = rand_neg(); BN_GF2m_add(c, a, b); if ((BN_is_odd(a) && BN_is_odd(c)) || (!BN_is_odd(a) && !BN_is_odd(c))) { fprintf(stderr, "GF(2^m) addition test (a) failed!\n"); goto err; } BN_GF2m_add(c, c, c); if (!BN_is_zero(c)) { fprintf(stderr, "GF(2^m) addition test (b) failed!\n"); goto err; } } ret = 1; err: BN_free(a); BN_free(b); BN_free(c); return ret; } test/bntest.c:1263: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 1238, column 9 is not reachable after line 1263, column 5. Showing all 85 steps of the trace test/bntest.c:1233:1: start of procedure test_gf2m_add() 1231. 1232. #ifndef OPENSSL_NO_EC2M 1233. > int test_gf2m_add(BIO *bp) 1234. { 1235. BIGNUM *a, *b, *c; test/bntest.c:1236:5: 1234. { 1235. BIGNUM *a, *b, *c; 1236. > int i, ret = 0; 1237. 1238. a = BN_new(); test/bntest.c:1238:5: 1236. int i, ret = 0; 1237. 1238. > a = BN_new(); 1239. b = BN_new(); 1240. 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:1239:5: 1237. 1238. a = BN_new(); 1239. > b = BN_new(); 1240. c = BN_new(); 1241. 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:1240:5: 1238. a = BN_new(); 1239. b = BN_new(); 1240. > c = BN_new(); 1241. 1242. for (i = 0; i < num0; 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:1242:10: 1240. c = BN_new(); 1241. 1242. > for (i = 0; i < num0; i++) { 1243. BN_rand(a, 512, 0, 0); 1244. BN_copy(b, BN_value_one()); test/bntest.c:1242:17: Loop condition is false. Leaving loop 1240. c = BN_new(); 1241. 1242. for (i = 0; i < num0; i++) { ^ 1243. BN_rand(a, 512, 0, 0); 1244. BN_copy(b, BN_value_one()); test/bntest.c:1261:5: 1259. } 1260. } 1261. > ret = 1; 1262. err: 1263. BN_free(a); test/bntest.c:1262:2: 1260. } 1261. ret = 1; 1262. > err: 1263. BN_free(a); 1264. BN_free(b); test/bntest.c:1263:5: 1261. ret = 1; 1262. err: 1263. > BN_free(a); 1264. BN_free(b); 1265. BN_free(c); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L1263
d2a_code_trace_data_42936
int X509_CRL_print(BIO *out, X509_CRL *x) { STACK_OF(X509_REVOKED) *rev; X509_REVOKED *r; X509_ALGOR *sig_alg; ASN1_BIT_STRING *sig; long l; int i; char *p; BIO_printf(out, "Certificate Revocation List (CRL):\n"); l = X509_CRL_get_version(x); BIO_printf(out, "%8sVersion %lu (0x%lx)\n", "", l + 1, l); X509_CRL_get0_signature(&sig, &sig_alg, x); X509_signature_print(out, sig_alg, NULL); p = X509_NAME_oneline(X509_CRL_get_issuer(x), NULL, 0); BIO_printf(out, "%8sIssuer: %s\n", "", p); OPENSSL_free(p); BIO_printf(out, "%8sLast Update: ", ""); ASN1_TIME_print(out, X509_CRL_get_lastUpdate(x)); BIO_printf(out, "\n%8sNext Update: ", ""); if (X509_CRL_get_nextUpdate(x)) ASN1_TIME_print(out, X509_CRL_get_nextUpdate(x)); else BIO_printf(out, "NONE"); BIO_printf(out, "\n"); X509V3_extensions_print(out, "CRL extensions", X509_CRL_get0_extensions(x), 0, 8); rev = X509_CRL_get_REVOKED(x); if (sk_X509_REVOKED_num(rev) > 0) BIO_printf(out, "Revoked Certificates:\n"); else BIO_printf(out, "No Revoked Certificates.\n"); for (i = 0; i < sk_X509_REVOKED_num(rev); i++) { r = sk_X509_REVOKED_value(rev, i); BIO_printf(out, " Serial Number: "); i2a_ASN1_INTEGER(out, X509_REVOKED_get0_serialNumber(r)); BIO_printf(out, "\n Revocation Date: "); ASN1_TIME_print(out, X509_REVOKED_get0_revocationDate(r)); BIO_printf(out, "\n"); X509V3_extensions_print(out, "CRL entry extensions", X509_REVOKED_get0_extensions(r), 0, 8); } X509_signature_print(out, sig_alg, sig); return 1; } crypto/x509/t_crl.c:47: error: INTEGER_OVERFLOW_L2 ([-9223372036854775808, 9223372036854775807] + 1):signed64. Showing all 7 steps of the trace crypto/x509/t_crl.c:46:9: <LHS trace> 44. 45. BIO_printf(out, "Certificate Revocation List (CRL):\n"); 46. l = X509_CRL_get_version(x); ^ 47. BIO_printf(out, "%8sVersion %lu (0x%lx)\n", "", l + 1, l); 48. X509_CRL_get0_signature(&sig, &sig_alg, x); crypto/x509/t_crl.c:46:9: Call 44. 45. BIO_printf(out, "Certificate Revocation List (CRL):\n"); 46. l = X509_CRL_get_version(x); ^ 47. BIO_printf(out, "%8sVersion %lu (0x%lx)\n", "", l + 1, l); 48. X509_CRL_get0_signature(&sig, &sig_alg, x); crypto/x509/x509cset.c:100:12: Call 98. long X509_CRL_get_version(const X509_CRL *crl) 99. { 100. return ASN1_INTEGER_get(crl->crl.version); ^ 101. } 102. crypto/asn1/a_int.c:564:9: Assignment 562. int64_t r; 563. if (a == NULL) 564. return 0; ^ 565. i = ASN1_INTEGER_get_int64(&r, a); 566. if (i == 0) crypto/x509/x509cset.c:100:5: Assignment 98. long X509_CRL_get_version(const X509_CRL *crl) 99. { 100. return ASN1_INTEGER_get(crl->crl.version); ^ 101. } 102. crypto/x509/t_crl.c:46:5: Assignment 44. 45. BIO_printf(out, "Certificate Revocation List (CRL):\n"); 46. l = X509_CRL_get_version(x); ^ 47. BIO_printf(out, "%8sVersion %lu (0x%lx)\n", "", l + 1, l); 48. X509_CRL_get0_signature(&sig, &sig_alg, x); crypto/x509/t_crl.c:47:5: Binary operation: ([-9223372036854775808, 9223372036854775807] + 1):signed64 45. BIO_printf(out, "Certificate Revocation List (CRL):\n"); 46. l = X509_CRL_get_version(x); 47. BIO_printf(out, "%8sVersion %lu (0x%lx)\n", "", l + 1, l); ^ 48. X509_CRL_get0_signature(&sig, &sig_alg, x); 49. X509_signature_print(out, sig_alg, NULL);
https://github.com/openssl/openssl/blob/cb926df2fa42bd1e396a600ff6212ee4f4e04118/crypto/x509/t_crl.c/#L47
d2a_code_trace_data_42937
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ecp_mont.c:241: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_exp_mont`. Showing all 52 steps of the trace crypto/ec/ecp_mont.c:215:1: Parameter `ctx->stack.depth` 213. * We have a Mont structure, so SCA hardening is FLT inversion. 214. */ 215. > int ec_GFp_mont_field_inv(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, 216. BN_CTX *ctx) 217. { crypto/ec/ecp_mont.c:228:5: Call 226. return 0; 227. 228. BN_CTX_start(ctx); ^ 229. if ((e = BN_CTX_get(ctx)) == NULL) 230. goto err; crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/ec/ecp_mont.c:241:10: Call 239. * No need for scatter-gather or BN_FLG_CONSTTIME. 240. */ 241. if (!BN_mod_exp_mont(r, a, e, group->field, ctx, group->field_data1)) ^ 242. goto err; 243. crypto/bn/bn_exp.c:296:1: Parameter `ctx->stack.depth` 294. } 295. 296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 297. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 298. { crypto/bn/bn_exp.c:310:16: Call 308. || BN_get_flags(a, BN_FLG_CONSTTIME) != 0 309. || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) { 310. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 311. } 312. crypto/bn/bn_exp.c:592:1: Parameter `ctx->stack.depth` 590. * http://www.daemonology.net/hyperthreading-considered-harmful/) 591. */ 592. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 593. const BIGNUM *m, BN_CTX *ctx, 594. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:636:5: Call 634. } 635. 636. BN_CTX_start(ctx); ^ 637. 638. /* crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_exp.c:647:14: Call 645. if ((mont = BN_MONT_CTX_new()) == NULL) 646. goto err; 647. if (!BN_MONT_CTX_set(mont, m, ctx)) ^ 648. goto err; 649. } crypto/bn/bn_mont.c:263:1: Parameter `ctx->stack.depth` 261. } 262. 263. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 264. { 265. int i, ret = 0; crypto/bn/bn_mont.c:271:5: Call 269. return 0; 270. 271. BN_CTX_start(ctx); ^ 272. if ((Ri = BN_CTX_get(ctx)) == NULL) 273. goto err; crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_mont.c:272:15: Call 270. 271. BN_CTX_start(ctx); 272. if ((Ri = BN_CTX_get(ctx)) == NULL) ^ 273. goto err; 274. R = &(mont->RR); /* grab RR as a temp */ crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_mont.c:351:19: Call 349. if (BN_is_one(&tmod)) 350. BN_zero(Ri); 351. else if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL) ^ 352. goto err; 353. if (!BN_lshift(Ri, Ri, BN_BITS2)) crypto/bn/bn_gcd.c:124:1: Parameter `ctx->stack.depth` 122. BN_CTX *ctx); 123. 124. > BIGNUM *BN_mod_inverse(BIGNUM *in, 125. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 126. { crypto/bn/bn_gcd.c:129:10: Call 127. BIGNUM *rv; 128. int noinv; 129. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv); ^ 130. if (noinv) 131. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); crypto/bn/bn_gcd.c:135:1: Parameter `ctx->stack.depth` 133. } 134. 135. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 136. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 137. int *pnoinv) crypto/bn/bn_gcd.c:155:16: Call 153. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) 154. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) { 155. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 156. } 157. crypto/bn/bn_gcd.c:458:1: Parameter `ctx->stack.depth` 456. * not contain branches that may leak sensitive information. 457. */ 458. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 459. const BIGNUM *a, const BIGNUM *n, 460. BN_CTX *ctx) crypto/bn/bn_gcd.c:469:5: Call 467. bn_check_top(n); 468. 469. BN_CTX_start(ctx); ^ 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gcd.c:470:9: Call 468. 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); ^ 471. B = BN_CTX_get(ctx); 472. X = 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_gcd.c:471:9: Call 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); ^ 472. X = BN_CTX_get(ctx); 473. D = 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_gcd.c:472:9: Call 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); ^ 473. D = BN_CTX_get(ctx); 474. M = 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_gcd.c:473:9: Call 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); ^ 474. M = BN_CTX_get(ctx); 475. Y = 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_gcd.c:474:9: Call 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); ^ 475. Y = BN_CTX_get(ctx); 476. T = 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_gcd.c:475:9: Call 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); ^ 476. T = BN_CTX_get(ctx); 477. if (T == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:476:9: Call 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); 476. T = BN_CTX_get(ctx); ^ 477. if (T == NULL) 478. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:504:18: Call 502. bn_init(&local_B); 503. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME); 504. if (!BN_nnmod(B, &local_B, A, ctx)) ^ 505. goto err; 506. /* Ensure local_B goes out of scope before any further use of B */ crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c: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_mod_exp_mont` 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_42938
void *lh_delete(_LHASH *lh, const void *data) { unsigned long hash; LHASH_NODE *nn,**rn; void *ret; lh->error=0; rn=getrn(lh,data,&hash); if (*rn == NULL) { lh->num_no_delete++; return(NULL); } else { nn= *rn; *rn=nn->next; ret=nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes))) contract(lh); return(ret); } ssl/s3_srvr.c:1414: error: INTEGER_OVERFLOW_L2 ([0, max(0, `s->ctx->sessions->num_items`)] - 1):unsigned64 by call to `ssl_check_clienthello_tlsext_late`. Showing all 15 steps of the trace ssl/s3_srvr.c:916:1: Parameter `s->ctx->sessions->num_items` 914. } 915. 916. > int ssl3_get_client_hello(SSL *s) 917. { 918. int i,j,ok,al,ret= -1; ssl/s3_srvr.c:1186:7: Call 1184. } 1185. } 1186. if (ssl_check_clienthello_tlsext_early(s) <= 0) { ^ 1187. SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_CLIENTHELLO_TLSEXT); 1188. goto err; ssl/t1_lib.c:1776:1: Parameter `s->ctx->sessions->num_items` 1774. } 1775. 1776. > int ssl_check_clienthello_tlsext_early(SSL *s) 1777. { 1778. int ret=SSL_TLSEXT_ERR_NOACK; ssl/s3_srvr.c:1414:7: Call 1412. if (s->version >= SSL3_VERSION) 1413. { 1414. if (ssl_check_clienthello_tlsext_late(s) <= 0) ^ 1415. { 1416. SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_CLIENTHELLO_TLSEXT); ssl/t1_lib.c:1871:1: Parameter `s->ctx->sessions->num_items` 1869. } 1870. 1871. > int ssl_check_clienthello_tlsext_late(SSL *s) 1872. { 1873. int ret = SSL_TLSEXT_ERR_OK; ssl/t1_lib.c:1924:4: Call 1922. { 1923. case SSL_TLSEXT_ERR_ALERT_FATAL: 1924. ssl3_send_alert(s,SSL3_AL_FATAL,al); ^ 1925. return -1; 1926. ssl/s3_pkt.c:1468:1: Parameter `s->ctx->sessions->num_items` 1466. } 1467. 1468. > int ssl3_send_alert(SSL *s, int level, int desc) 1469. { 1470. /* Map tls/ssl alert value to correct one */ ssl/s3_pkt.c:1477:3: Call 1475. /* If a fatal one, remove from cache */ 1476. if ((level == 2) && (s->session != NULL)) 1477. SSL_CTX_remove_session(s->ctx,s->session); ^ 1478. 1479. s->s3->alert_dispatch=1; ssl/ssl_sess.c:698:1: Parameter `ctx->sessions->num_items` 696. } 697. 698. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 699. { 700. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:700:9: Call 698. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 699. { 700. return remove_session_lock(ctx, c, 1); ^ 701. } 702. ssl/ssl_sess.c:703:1: Parameter `ctx->sessions->num_items` 701. } 702. 703. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 704. { 705. SSL_SESSION *r; ssl/ssl_sess.c:714:6: Call 712. { 713. ret=1; 714. r=lh_SSL_SESSION_delete(ctx->sessions,c); ^ 715. SSL_SESSION_list_remove(ctx,c); 716. } crypto/lhash/lhash.c:217:1: <LHS trace> 215. } 216. 217. > void *lh_delete(_LHASH *lh, const void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:217:1: Parameter `lh->num_items` 215. } 216. 217. > void *lh_delete(_LHASH *lh, const void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:240:2: Binary operation: ([0, max(0, s->ctx->sessions->num_items)] - 1):unsigned64 by call to `ssl_check_clienthello_tlsext_late` 238. } 239. 240. lh->num_items--; ^ 241. if ((lh->num_nodes > MIN_NODES) && 242. (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)))
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/lhash/lhash.c/#L240
d2a_code_trace_data_42939
int BN_rshift(BIGNUM *r, const BIGNUM *a, int n) { int i, j, nw, lb, rb; BN_ULONG *t, *f; BN_ULONG l, tmp; bn_check_top(r); bn_check_top(a); if (n < 0) { BNerr(BN_F_BN_RSHIFT, BN_R_INVALID_SHIFT); return 0; } nw = n / BN_BITS2; rb = n % BN_BITS2; lb = BN_BITS2 - rb; if (nw >= a->top || a->top == 0) { BN_zero(r); return (1); } i = (BN_num_bits(a) - n + (BN_BITS2 - 1)) / BN_BITS2; if (r != a) { r->neg = a->neg; if (bn_wexpand(r, i) == NULL) return (0); } else { if (n == 0) return 1; } f = &(a->d[nw]); t = r->d; j = a->top - nw; r->top = i; if (rb == 0) { for (i = j; i != 0; i--) *(t++) = *(f++); } else { l = *(f++); for (i = j - 1; i != 0; i--) { tmp = (l >> rb) & BN_MASK2; l = *(f++); *(t++) = (tmp | (l << lb)) & BN_MASK2; } if ((l = (l >> rb) & BN_MASK2)) *(t) = l; } bn_check_top(r); return (1); } test/bntest.c:238: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_div_recp`. Showing all 14 steps of the trace test/bntest.c:237:9: Call 235. a->neg = rand_neg(); 236. b->neg = rand_neg(); 237. BN_RECP_CTX_set(recp, b, ctx); ^ 238. BN_div_recp(d, c, a, recp, ctx); 239. BN_mul(e, d, b, ctx); crypto/bn/bn_recp.c:44:1: Parameter `*recp->Nr.d` 42. } 43. 44. > int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *d, BN_CTX *ctx) 45. { 46. if (!BN_copy(&(recp->N), d)) test/bntest.c:238:9: Call 236. b->neg = rand_neg(); 237. BN_RECP_CTX_set(recp, b, ctx); 238. BN_div_recp(d, c, a, recp, ctx); ^ 239. BN_mul(e, d, b, ctx); 240. BN_add(d, e, c); crypto/bn/bn_recp.c:90:9: Call 88. 89. BN_CTX_start(ctx); 90. a = BN_CTX_get(ctx); ^ 91. b = BN_CTX_get(ctx); 92. if (dv != NULL) crypto/bn/bn_ctx.c:229:5: Call 227. } 228. /* OK, make sure the returned bignum is "zero" */ 229. BN_zero(ret); ^ 230. ctx->used++; 231. CTXDBG_RET(ctx, ret); crypto/bn/bn_lib.c:463:1: Parameter `*a->d` 461. } 462. 463. > int BN_set_word(BIGNUM *a, BN_ULONG w) 464. { 465. bn_check_top(a); crypto/bn/bn_lib.c:466:9: Call 464. { 465. bn_check_top(a); 466. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 467. return (0); 468. a->neg = 0; crypto/bn/bn_lcl.h:676:1: Parameter `*a->d` 674. int bn_probable_prime_dh_coprime(BIGNUM *rnd, int bits, BN_CTX *ctx); 675. 676. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 677. { 678. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_recp.c:141:10: Call 139. if (!BN_mul(b, a, &(recp->Nr), ctx)) 140. goto err; 141. if (!BN_rshift(d, b, i - recp->num_bits)) ^ 142. goto err; 143. d->neg = 0; crypto/bn/bn_shift.c:120:1: <Length trace> 118. } 119. 120. > int BN_rshift(BIGNUM *r, const BIGNUM *a, int n) 121. { 122. int i, j, nw, lb, rb; crypto/bn/bn_shift.c:120:1: Parameter `*a->d` 118. } 119. 120. > int BN_rshift(BIGNUM *r, const BIGNUM *a, int n) 121. { 122. int i, j, nw, lb, rb; crypto/bn/bn_shift.c:151:5: Assignment 149. } 150. 151. f = &(a->d[nw]); ^ 152. t = r->d; 153. j = a->top - nw; crypto/bn/bn_shift.c:160:15: Assignment 158. *(t++) = *(f++); 159. } else { 160. l = *(f++); ^ 161. for (i = j - 1; i != 0; i--) { 162. tmp = (l >> rb) & BN_MASK2; crypto/bn/bn_shift.c:163:17: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_div_recp` 161. for (i = j - 1; i != 0; i--) { 162. tmp = (l >> rb) & BN_MASK2; 163. l = *(f++); ^ 164. *(t++) = (tmp | (l << lb)) & BN_MASK2; 165. }
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_shift.c/#L163
d2a_code_trace_data_42940
int ossl_init_thread_start(uint64_t opts) { struct thread_local_inits_st *locals = ossl_init_get_thread_local(1); if (locals == NULL) return 0; if (opts & OPENSSL_INIT_THREAD_ASYNC) { #ifdef OPENSSL_INIT_DEBUG fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: " "marking thread for async\n"); #endif locals->async = 1; } if (opts & OPENSSL_INIT_THREAD_ERR_STATE) { #ifdef OPENSSL_INIT_DEBUG fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: " "marking thread for err_state\n"); #endif locals->err_state = 1; } return 1; } crypto/init.c:324: error: MEMORY_LEAK memory dynamically allocated to `locals` by call to `ossl_init_get_thread_local()` at line 311, column 44 is not reachable after line 324, column 9. Showing all 37 steps of the trace crypto/init.c:309:1: start of procedure ossl_init_thread_start() 307. } 308. 309. > int ossl_init_thread_start(uint64_t opts) 310. { 311. struct thread_local_inits_st *locals = ossl_init_get_thread_local(1); crypto/init.c:311:5: 309. int ossl_init_thread_start(uint64_t opts) 310. { 311. > struct thread_local_inits_st *locals = ossl_init_get_thread_local(1); 312. 313. if (locals == NULL) crypto/init.c:37:1: start of procedure ossl_init_get_thread_local() 35. } 36. 37. > static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc) 38. { 39. struct thread_local_inits_st *local = crypto/init.c:39:5: 37. static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc) 38. { 39. > struct thread_local_inits_st *local = 40. CRYPTO_THREAD_get_local(&threadstopkey); 41. crypto/threads_pthread.c:79:1: start of procedure CRYPTO_THREAD_get_local() 77. } 78. 79. > void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key) 80. { 81. return pthread_getspecific(*key); crypto/threads_pthread.c:81:5: Skipping pthread_getspecific(): method has no implementation 79. void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key) 80. { 81. return pthread_getspecific(*key); ^ 82. } 83. crypto/threads_pthread.c:82:1: return from a call to CRYPTO_THREAD_get_local 80. { 81. return pthread_getspecific(*key); 82. > } 83. 84. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) crypto/init.c:42:9: Taking true branch 40. CRYPTO_THREAD_get_local(&threadstopkey); 41. 42. if (local == NULL && alloc) { ^ 43. local = OPENSSL_zalloc(sizeof *local); 44. CRYPTO_THREAD_set_local(&threadstopkey, local); crypto/init.c:42:26: Taking true branch 40. CRYPTO_THREAD_get_local(&threadstopkey); 41. 42. if (local == NULL && alloc) { ^ 43. local = OPENSSL_zalloc(sizeof *local); 44. CRYPTO_THREAD_set_local(&threadstopkey, local); crypto/init.c:43:9: 41. 42. if (local == NULL && alloc) { 43. > local = OPENSSL_zalloc(sizeof *local); 44. CRYPTO_THREAD_set_local(&threadstopkey, local); 45. } crypto/mem.c:98:1: start of procedure CRYPTO_zalloc() 96. } 97. 98. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 99. { 100. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:100:5: 98. void *CRYPTO_zalloc(size_t num, const char *file, int line) 99. { 100. > void *ret = CRYPTO_malloc(num, file, line); 101. 102. if (ret != NULL) crypto/mem.c:71:1: start of procedure CRYPTO_malloc() 69. } 70. 71. > void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. void *ret = NULL; crypto/mem.c:73:5: 71. void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. > void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:75:9: Taking false branch 73. void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 76. return malloc_impl(num, file, line); 77. crypto/mem.c:78:9: Taking false branch 76. return malloc_impl(num, file, line); 77. 78. if (num <= 0) ^ 79. return NULL; 80. crypto/mem.c:81:5: 79. return NULL; 80. 81. > allow_customize = 0; 82. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 83. if (call_malloc_debug) { crypto/mem.c:91:5: 89. } 90. #else 91. > osslargused(file); osslargused(line); 92. ret = malloc(num); 93. #endif crypto/mem.c:91:24: 89. } 90. #else 91. > osslargused(file); osslargused(line); 92. ret = malloc(num); 93. #endif crypto/mem.c:92:5: 90. #else 91. osslargused(file); osslargused(line); 92. > ret = malloc(num); 93. #endif 94. crypto/mem.c:95:5: 93. #endif 94. 95. > return ret; 96. } 97. crypto/mem.c:96:1: return from a call to CRYPTO_malloc 94. 95. return ret; 96. > } 97. 98. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:102:9: Taking true branch 100. void *ret = CRYPTO_malloc(num, file, line); 101. 102. if (ret != NULL) ^ 103. memset(ret, 0, num); 104. return ret; crypto/mem.c:103:9: 101. 102. if (ret != NULL) 103. > memset(ret, 0, num); 104. return ret; 105. } crypto/mem.c:104:5: 102. if (ret != NULL) 103. memset(ret, 0, num); 104. > return ret; 105. } 106. crypto/mem.c:105:1: return from a call to CRYPTO_zalloc 103. memset(ret, 0, num); 104. return ret; 105. > } 106. 107. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/init.c:44:9: 42. if (local == NULL && alloc) { 43. local = OPENSSL_zalloc(sizeof *local); 44. > CRYPTO_THREAD_set_local(&threadstopkey, local); 45. } 46. if (!alloc) { crypto/threads_pthread.c:84:1: start of procedure CRYPTO_THREAD_set_local() 82. } 83. 84. > int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) 85. { 86. if (pthread_setspecific(*key, val) != 0) crypto/threads_pthread.c:86:9: Taking true branch 84. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) 85. { 86. if (pthread_setspecific(*key, val) != 0) ^ 87. return 0; 88. crypto/threads_pthread.c:87:9: 85. { 86. if (pthread_setspecific(*key, val) != 0) 87. > return 0; 88. 89. return 1; crypto/threads_pthread.c:90:1: return from a call to CRYPTO_THREAD_set_local 88. 89. return 1; 90. > } 91. 92. int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key) crypto/init.c:46:10: Taking false branch 44. CRYPTO_THREAD_set_local(&threadstopkey, local); 45. } 46. if (!alloc) { ^ 47. CRYPTO_THREAD_set_local(&threadstopkey, NULL); 48. } crypto/init.c:50:5: 48. } 49. 50. > return local; 51. } 52. crypto/init.c:51:1: return from a call to ossl_init_get_thread_local 49. 50. return local; 51. > } 52. 53. typedef struct ossl_init_stop_st OPENSSL_INIT_STOP; crypto/init.c:313:9: Taking false branch 311. struct thread_local_inits_st *locals = ossl_init_get_thread_local(1); 312. 313. if (locals == NULL) ^ 314. return 0; 315. crypto/init.c:316:9: Taking false branch 314. return 0; 315. 316. if (opts & OPENSSL_INIT_THREAD_ASYNC) { ^ 317. #ifdef OPENSSL_INIT_DEBUG 318. fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: " crypto/init.c:324:9: Taking false branch 322. } 323. 324. if (opts & OPENSSL_INIT_THREAD_ERR_STATE) { ^ 325. #ifdef OPENSSL_INIT_DEBUG 326. fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "
https://github.com/openssl/openssl/blob/b2de11c58b57e7f0d58c6f8a1d4177705650647e/crypto/init.c/#L324
d2a_code_trace_data_42941
int ERR_set_mark(void) { ERR_STATE *es; es = ERR_get_state(); if (es == NULL) return 0; if (es->bottom == es->top) return 0; es->err_flags[es->top] |= ERR_FLAG_MARK; return 1; } crypto/err/err.c:776: error: MEMORY_LEAK memory dynamically allocated by call to `ERR_get_state()` at line 770, column 10 is not reachable after line 776, column 5. Showing all 49 steps of the trace crypto/err/err.c:766:1: start of procedure ERR_set_mark() 764. } 765. 766. > int ERR_set_mark(void) 767. { 768. ERR_STATE *es; crypto/err/err.c:770:5: 768. ERR_STATE *es; 769. 770. > es = ERR_get_state(); 771. if (es == NULL) 772. 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:771:9: Taking false branch 769. 770. es = ERR_get_state(); 771. if (es == NULL) ^ 772. return 0; 773. crypto/err/err.c:774:9: Taking false branch 772. return 0; 773. 774. if (es->bottom == es->top) ^ 775. return 0; 776. es->err_flags[es->top] |= ERR_FLAG_MARK; crypto/err/err.c:776:5: 774. if (es->bottom == es->top) 775. return 0; 776. > es->err_flags[es->top] |= ERR_FLAG_MARK; 777. return 1; 778. }
https://github.com/openssl/openssl/blob/f770d75b1cac264d6280ec7326277daff6965cbb/crypto/err/err.c/#L776
d2a_code_trace_data_42942
int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) { PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | (diff > (0 - (PTRDIFF_T)len))); assert(!overlapped); return overlapped; } crypto/evp/bio_enc.c:270: error: INTEGER_OVERFLOW_L2 (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate`. Showing all 9 steps of the trace crypto/evp/bio_enc.c:270:14: Call 268. while (inl > 0) { 269. n = (inl > ENC_BLOCK_SIZE) ? ENC_BLOCK_SIZE : inl; 270. if (!EVP_CipherUpdate(ctx->cipher, ^ 271. ctx->buf, &ctx->buf_len, 272. (const unsigned char *)in, n)) { crypto/evp/evp_enc.c:205:1: Parameter `ctx->cipher->block_size` 203. } 204. 205. > int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 206. const unsigned char *in, int inl) 207. { crypto/evp/evp_enc.c:211:16: Call 209. return EVP_EncryptUpdate(ctx, out, outl, in, inl); 210. else 211. return EVP_DecryptUpdate(ctx, out, outl, in, inl); ^ 212. } 213. crypto/evp/evp_enc.c:416:1: Parameter `ctx->cipher->block_size` 414. } 415. 416. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 417. const unsigned char *in, int inl) 418. { crypto/evp/evp_enc.c:422:5: Assignment 420. unsigned int b; 421. 422. b = ctx->cipher->block_size; ^ 423. 424. if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) { crypto/evp/evp_enc.c:452:16: Call 450. /* see comment about PTRDIFF_T comparison above */ 451. if (((PTRDIFF_T)out == (PTRDIFF_T)in) 452. || is_partially_overlapping(out, in, b)) { ^ 453. EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING); 454. return 0; crypto/evp/evp_enc.c:279:1: <RHS trace> 277. #endif 278. 279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 280. { 281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:279:1: Parameter `len` 277. #endif 278. 279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 280. { 281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:288:50: Binary operation: (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate` 286. */ 287. int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | 288. (diff > (0 - (PTRDIFF_T)len))); ^ 289. assert(!overlapped); 290. return overlapped;
https://github.com/openssl/openssl/blob/7141ba31969d0b378d08104a51f8f99b9187b9d5/crypto/evp/evp_enc.c/#L288
d2a_code_trace_data_42943
static int kek_unwrap_key(unsigned char *out, size_t *outlen, const unsigned char *in, size_t inlen, EVP_CIPHER_CTX *ctx) { size_t blocklen = EVP_CIPHER_CTX_block_size(ctx); unsigned char *tmp; int outl, rv = 0; if (inlen < 2 * blocklen) { return 0; } if (inlen % blocklen) { return 0; } if ((tmp = OPENSSL_malloc(inlen)) == NULL) { CMSerr(CMS_F_KEK_UNWRAP_KEY, ERR_R_MALLOC_FAILURE); return 0; } if (!EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, &outl, in + inlen - 2 * blocklen, blocklen * 2) || !EVP_DecryptUpdate(ctx, tmp, &outl, tmp + inlen - blocklen, blocklen) || !EVP_DecryptUpdate(ctx, tmp, &outl, in, inlen - blocklen) || !EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, NULL) || !EVP_DecryptUpdate(ctx, tmp, &outl, tmp, inlen)) goto err; if (((tmp[1] ^ tmp[4]) & (tmp[2] ^ tmp[5]) & (tmp[3] ^ tmp[6])) != 0xff) { goto err; } if (inlen < (size_t)(tmp[0] - 4)) { goto err; } *outlen = (size_t)tmp[0]; memcpy(out, tmp + 4, *outlen); rv = 1; err: OPENSSL_clear_free(tmp, inlen); return rv; } crypto/cms/cms_env.c:867: error: BUFFER_OVERRUN_L3 Offset: 6 Size: [1, +oo] by call to `CMS_RecipientInfo_encrypt`. Showing all 13 steps of the trace crypto/cms/cms_env.c:867:13: Call 865. for (i = 0; i < sk_CMS_RecipientInfo_num(rinfos); i++) { 866. ri = sk_CMS_RecipientInfo_value(rinfos, i); 867. if (CMS_RecipientInfo_encrypt(cms, ri) <= 0) { ^ 868. CMSerr(CMS_F_CMS_ENVELOPEDDATA_INIT_BIO, 869. CMS_R_ERROR_SETTING_RECIPIENTINFO); crypto/cms/cms_env.c:758:1: Parameter `ri->d.pwri->encryptedKey->length` 756. } 757. 758. > int CMS_RecipientInfo_encrypt(const CMS_ContentInfo *cms, CMS_RecipientInfo *ri) 759. { 760. switch (ri->type) { crypto/cms/cms_env.c:867:13: Call 865. for (i = 0; i < sk_CMS_RecipientInfo_num(rinfos); i++) { 866. ri = sk_CMS_RecipientInfo_value(rinfos, i); 867. if (CMS_RecipientInfo_encrypt(cms, ri) <= 0) { ^ 868. CMSerr(CMS_F_CMS_ENVELOPEDDATA_INIT_BIO, 869. CMS_R_ERROR_SETTING_RECIPIENTINFO); crypto/cms/cms_env.c:758:1: Parameter `ri->d.pwri->encryptedKey->length` 756. } 757. 758. > int CMS_RecipientInfo_encrypt(const CMS_ContentInfo *cms, CMS_RecipientInfo *ri) 759. { 760. switch (ri->type) { crypto/cms/cms_env.c:771:16: Call 769. 770. case CMS_RECIPINFO_PASS: 771. return cms_RecipientInfo_pwri_crypt(cms, ri, 1); ^ 772. 773. default: crypto/cms/cms_pwri.c:276:1: Parameter `ri->d.pwri->encryptedKey->length` 274. /* Encrypt/Decrypt content key in PWRI recipient info */ 275. 276. > int cms_RecipientInfo_pwri_crypt(const CMS_ContentInfo *cms, CMS_RecipientInfo *ri, 277. int en_de) 278. { crypto/cms/cms_pwri.c:369:14: Call 367. goto err; 368. } 369. if (!kek_unwrap_key(key, &keylen, ^ 370. pwri->encryptedKey->data, 371. pwri->encryptedKey->length, kekctx)) { crypto/cms/cms_pwri.c:176:1: <Length trace> 174. */ 175. 176. > static int kek_unwrap_key(unsigned char *out, size_t *outlen, 177. const unsigned char *in, size_t inlen, 178. EVP_CIPHER_CTX *ctx) crypto/cms/cms_pwri.c:176:1: Parameter `inlen` 174. */ 175. 176. > static int kek_unwrap_key(unsigned char *out, size_t *outlen, 177. const unsigned char *in, size_t inlen, 178. EVP_CIPHER_CTX *ctx) crypto/cms/cms_pwri.c:191:16: Call 189. return 0; 190. } 191. if ((tmp = OPENSSL_malloc(inlen)) == NULL) { ^ 192. CMSerr(CMS_F_KEK_UNWRAP_KEY, ERR_R_MALLOC_FAILURE); 193. return 0; crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/cms/cms_pwri.c:191:10: Assignment 189. return 0; 190. } 191. if ((tmp = OPENSSL_malloc(inlen)) == NULL) { ^ 192. CMSerr(CMS_F_KEK_UNWRAP_KEY, ERR_R_MALLOC_FAILURE); 193. return 0; crypto/cms/cms_pwri.c:214:60: Array access: Offset: 6 Size: [1, +oo] by call to `CMS_RecipientInfo_encrypt` 212. goto err; 213. /* Check check bytes */ 214. if (((tmp[1] ^ tmp[4]) & (tmp[2] ^ tmp[5]) & (tmp[3] ^ tmp[6])) != 0xff) { ^ 215. /* Check byte failure */ 216. goto err;
https://github.com/openssl/openssl/blob/bcf082d130a413a728a382bd6e6bfdbf2cedba45/crypto/cms/cms_pwri.c/#L214
d2a_code_trace_data_42944
static av_always_inline void dnxhd_get_pixels_4x8(DCTELEM *restrict block, const uint8_t *pixels, int line_size) { int i; for (i = 0; i < 4; i++) { block[0] = pixels[0]; block[1] = pixels[1]; block[2] = pixels[2]; block[3] = pixels[3]; block[4] = pixels[4]; block[5] = pixels[5]; block[6] = pixels[6]; block[7] = pixels[7]; pixels += line_size; block += 8; } memcpy(block , block- 8, sizeof(*block)*8); memcpy(block+ 8, block-16, sizeof(*block)*8); memcpy(block+16, block-24, sizeof(*block)*8); memcpy(block+24, block-32, sizeof(*block)*8); } libavcodec/dnxhdenc.c:415: error: Buffer Overrun L3 Offset added: [-12, +oo] (⇐ [-28, +oo] + 16) Size: 128 by call to `dnxhd_get_pixels_4x8`. libavcodec/dnxhdenc.c:401:1: Parameter `ctx->blocks[*]` 399. } 400. 401. static av_always_inline void dnxhd_get_blocks(DNXHDEncContext *ctx, int mb_x, int mb_y) ^ 402. { 403. const uint8_t *ptr_y = ctx->thread[0]->src[0] + ((mb_y << 4) * ctx->m.linesize) + (mb_x << 4); libavcodec/dnxhdenc.c:415:13: Call 413. if (mb_y+1 == ctx->m.mb_height && ctx->m.avctx->height == 1080) { 414. if (ctx->interlaced) { 415. dnxhd_get_pixels_4x8(ctx->blocks[4], ptr_y + ctx->dct_y_offset , ctx->m.linesize); ^ 416. dnxhd_get_pixels_4x8(ctx->blocks[5], ptr_y + ctx->dct_y_offset + 8, ctx->m.linesize); 417. dnxhd_get_pixels_4x8(ctx->blocks[6], ptr_u + ctx->dct_uv_offset , ctx->m.uvlinesize); libavcodec/dnxhdenc.c:380:1: <Length trace> 378. } 379. 380. static av_always_inline void dnxhd_get_pixels_4x8(DCTELEM *restrict block, const uint8_t *pixels, int line_size) ^ 381. { 382. int i; libavcodec/dnxhdenc.c:380:1: Parameter `*block` 378. } 379. 380. static av_always_inline void dnxhd_get_pixels_4x8(DCTELEM *restrict block, const uint8_t *pixels, int line_size) ^ 381. { 382. int i; libavcodec/dnxhdenc.c:398:5: Array access: Offset added: [-12, +oo] (⇐ [-28, +oo] + 16) Size: 128 by call to `dnxhd_get_pixels_4x8` 396. memcpy(block+ 8, block-16, sizeof(*block)*8); 397. memcpy(block+16, block-24, sizeof(*block)*8); 398. memcpy(block+24, block-32, sizeof(*block)*8); ^ 399. } 400.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dnxhdenc.c/#L398
d2a_code_trace_data_42945
int dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned char *priority) { DTLS1_RECORD_DATA *rdata; pitem *item; if (pqueue_size(queue->q) >= 100) return 0; rdata = OPENSSL_malloc(sizeof(*rdata)); item = pitem_new(priority, rdata); if (rdata == NULL || item == NULL) { OPENSSL_free(rdata); pitem_free(item); SSLerr(SSL_F_DTLS1_BUFFER_RECORD, ERR_R_INTERNAL_ERROR); return -1; } rdata->packet = s->rlayer.packet; rdata->packet_length = s->rlayer.packet_length; memcpy(&(rdata->rbuf), &s->rlayer.rbuf, sizeof(SSL3_BUFFER)); memcpy(&(rdata->rrec), &s->rlayer.rrec, sizeof(SSL3_RECORD)); item->data = rdata; #ifndef OPENSSL_NO_SCTP if (BIO_dgram_is_sctp(SSL_get_rbio(s)) && (SSL_get_state(s) == TLS_ST_SR_FINISHED || SSL_get_state(s) == TLS_ST_CR_FINISHED)) { BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SCTP_GET_RCVINFO, sizeof(rdata->recordinfo), &rdata->recordinfo); } #endif s->rlayer.packet = NULL; s->rlayer.packet_length = 0; memset(&s->rlayer.rbuf, 0, sizeof(s->rlayer.rbuf)); memset(&s->rlayer.rrec, 0, sizeof(s->rlayer.rrec)); if (!ssl3_setup_buffers(s)) { SSLerr(SSL_F_DTLS1_BUFFER_RECORD, ERR_R_INTERNAL_ERROR); OPENSSL_free(rdata->rbuf.buf); OPENSSL_free(rdata); pitem_free(item); return (-1); } if (pqueue_insert(queue->q, item) == NULL) { SSLerr(SSL_F_DTLS1_BUFFER_RECORD, ERR_R_INTERNAL_ERROR); OPENSSL_free(rdata->rbuf.buf); OPENSSL_free(rdata); pitem_free(item); return (-1); } return (1); } ssl/record/rec_layer_d1.c:315: error: MEMORY_LEAK memory dynamically allocated to `return` by call to `pitem_new()` at line 268, column 12 is not reachable after line 315, column 5. Showing all 54 steps of the trace ssl/record/rec_layer_d1.c:258:1: start of procedure dtls1_buffer_record() 256. } 257. 258. > int dtls1_buffer_record(SSL *s, record_pqueue *queue, unsigned char *priority) 259. { 260. DTLS1_RECORD_DATA *rdata; ssl/record/rec_layer_d1.c:264:9: 262. 263. /* Limit the size of the queue to prevent DOS attacks */ 264. > if (pqueue_size(queue->q) >= 100) 265. return 0; 266. crypto/pqueue/pqueue.c:209:1: start of procedure pqueue_size() 207. } 208. 209. > int pqueue_size(pqueue_s *pq) 210. { 211. pitem *item = pq->items; crypto/pqueue/pqueue.c:211:5: 209. int pqueue_size(pqueue_s *pq) 210. { 211. > pitem *item = pq->items; 212. int count = 0; 213. crypto/pqueue/pqueue.c:212:5: 210. { 211. pitem *item = pq->items; 212. > int count = 0; 213. 214. while (item != NULL) { crypto/pqueue/pqueue.c:214:12: Loop condition is true. Entering loop body 212. int count = 0; 213. 214. while (item != NULL) { ^ 215. count++; 216. item = item->next; crypto/pqueue/pqueue.c:215:9: 213. 214. while (item != NULL) { 215. > count++; 216. item = item->next; 217. } crypto/pqueue/pqueue.c:216:9: 214. while (item != NULL) { 215. count++; 216. > item = item->next; 217. } 218. return count; crypto/pqueue/pqueue.c:214:12: Loop condition is false. Leaving loop 212. int count = 0; 213. 214. while (item != NULL) { ^ 215. count++; 216. item = item->next; crypto/pqueue/pqueue.c:218:5: 216. item = item->next; 217. } 218. > return count; 219. } crypto/pqueue/pqueue.c:219:1: return from a call to pqueue_size 217. } 218. return count; 219. > } ssl/record/rec_layer_d1.c:264:9: Taking false branch 262. 263. /* Limit the size of the queue to prevent DOS attacks */ 264. if (pqueue_size(queue->q) >= 100) ^ 265. return 0; 266. ssl/record/rec_layer_d1.c:267:5: 265. return 0; 266. 267. > rdata = OPENSSL_malloc(sizeof(*rdata)); 268. item = pitem_new(priority, rdata); 269. if (rdata == NULL || item == NULL) { crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) ssl/record/rec_layer_d1.c:268:5: 266. 267. rdata = OPENSSL_malloc(sizeof(*rdata)); 268. > item = pitem_new(priority, rdata); 269. if (rdata == NULL || item == NULL) { 270. OPENSSL_free(rdata); crypto/pqueue/pqueue.c:69:1: start of procedure pitem_new() 67. } pqueue_s; 68. 69. > pitem *pitem_new(unsigned char *prio64be, void *data) 70. { 71. pitem *item = OPENSSL_malloc(sizeof(*item)); crypto/pqueue/pqueue.c:71:5: 69. pitem *pitem_new(unsigned char *prio64be, void *data) 70. { 71. > pitem *item = OPENSSL_malloc(sizeof(*item)); 72. if (item == NULL) 73. return NULL; crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/pqueue/pqueue.c:72:9: Taking false branch 70. { 71. pitem *item = OPENSSL_malloc(sizeof(*item)); 72. if (item == NULL) ^ 73. return NULL; 74. crypto/pqueue/pqueue.c:75:5: 73. return NULL; 74. 75. > memcpy(item->priority, prio64be, sizeof(item->priority)); 76. 77. item->data = data; crypto/pqueue/pqueue.c:77:5: 75. memcpy(item->priority, prio64be, sizeof(item->priority)); 76. 77. > item->data = data; 78. item->next = NULL; 79. crypto/pqueue/pqueue.c:78:5: 76. 77. item->data = data; 78. > item->next = NULL; 79. 80. return item; crypto/pqueue/pqueue.c:80:5: 78. item->next = NULL; 79. 80. > return item; 81. } 82. crypto/pqueue/pqueue.c:81:1: return from a call to pitem_new 79. 80. return item; 81. > } 82. 83. void pitem_free(pitem *item) ssl/record/rec_layer_d1.c:269:9: Taking false branch 267. rdata = OPENSSL_malloc(sizeof(*rdata)); 268. item = pitem_new(priority, rdata); 269. if (rdata == NULL || item == NULL) { ^ 270. OPENSSL_free(rdata); 271. pitem_free(item); ssl/record/rec_layer_d1.c:269:26: Taking false branch 267. rdata = OPENSSL_malloc(sizeof(*rdata)); 268. item = pitem_new(priority, rdata); 269. if (rdata == NULL || item == NULL) { ^ 270. OPENSSL_free(rdata); 271. pitem_free(item); ssl/record/rec_layer_d1.c:276:5: 274. } 275. 276. > rdata->packet = s->rlayer.packet; 277. rdata->packet_length = s->rlayer.packet_length; 278. memcpy(&(rdata->rbuf), &s->rlayer.rbuf, sizeof(SSL3_BUFFER)); ssl/record/rec_layer_d1.c:277:5: 275. 276. rdata->packet = s->rlayer.packet; 277. > rdata->packet_length = s->rlayer.packet_length; 278. memcpy(&(rdata->rbuf), &s->rlayer.rbuf, sizeof(SSL3_BUFFER)); 279. memcpy(&(rdata->rrec), &s->rlayer.rrec, sizeof(SSL3_RECORD)); ssl/record/rec_layer_d1.c:278:5: 276. rdata->packet = s->rlayer.packet; 277. rdata->packet_length = s->rlayer.packet_length; 278. > memcpy(&(rdata->rbuf), &s->rlayer.rbuf, sizeof(SSL3_BUFFER)); 279. memcpy(&(rdata->rrec), &s->rlayer.rrec, sizeof(SSL3_RECORD)); 280. ssl/record/rec_layer_d1.c:279:5: 277. rdata->packet_length = s->rlayer.packet_length; 278. memcpy(&(rdata->rbuf), &s->rlayer.rbuf, sizeof(SSL3_BUFFER)); 279. > memcpy(&(rdata->rrec), &s->rlayer.rrec, sizeof(SSL3_RECORD)); 280. 281. item->data = rdata; ssl/record/rec_layer_d1.c:281:5: 279. memcpy(&(rdata->rrec), &s->rlayer.rrec, sizeof(SSL3_RECORD)); 280. 281. > item->data = rdata; 282. 283. #ifndef OPENSSL_NO_SCTP ssl/record/rec_layer_d1.c:293:5: 291. #endif 292. 293. > s->rlayer.packet = NULL; 294. s->rlayer.packet_length = 0; 295. memset(&s->rlayer.rbuf, 0, sizeof(s->rlayer.rbuf)); ssl/record/rec_layer_d1.c:294:5: 292. 293. s->rlayer.packet = NULL; 294. > s->rlayer.packet_length = 0; 295. memset(&s->rlayer.rbuf, 0, sizeof(s->rlayer.rbuf)); 296. memset(&s->rlayer.rrec, 0, sizeof(s->rlayer.rrec)); ssl/record/rec_layer_d1.c:295:5: 293. s->rlayer.packet = NULL; 294. s->rlayer.packet_length = 0; 295. > memset(&s->rlayer.rbuf, 0, sizeof(s->rlayer.rbuf)); 296. memset(&s->rlayer.rrec, 0, sizeof(s->rlayer.rrec)); 297. ssl/record/rec_layer_d1.c:296:5: 294. s->rlayer.packet_length = 0; 295. memset(&s->rlayer.rbuf, 0, sizeof(s->rlayer.rbuf)); 296. > memset(&s->rlayer.rrec, 0, sizeof(s->rlayer.rrec)); 297. 298. if (!ssl3_setup_buffers(s)) { ssl/record/rec_layer_d1.c:298:10: Taking false branch 296. memset(&s->rlayer.rrec, 0, sizeof(s->rlayer.rrec)); 297. 298. if (!ssl3_setup_buffers(s)) { ^ 299. SSLerr(SSL_F_DTLS1_BUFFER_RECORD, ERR_R_INTERNAL_ERROR); 300. OPENSSL_free(rdata->rbuf.buf); ssl/record/rec_layer_d1.c:307:9: Taking false branch 305. 306. /* insert should not fail, since duplicates are dropped */ 307. if (pqueue_insert(queue->q, item) == NULL) { ^ 308. SSLerr(SSL_F_DTLS1_BUFFER_RECORD, ERR_R_INTERNAL_ERROR); 309. OPENSSL_free(rdata->rbuf.buf); ssl/record/rec_layer_d1.c:315:5: 313. } 314. 315. > return (1); 316. } 317.
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/ssl/record/rec_layer_d1.c/#L315
d2a_code_trace_data_42946
static int on2avc_read_channel_data(On2AVCContext *c, BitstreamContext *bc, int ch) { int ret; int w, b, band_idx; float *coeff_ptr; if ((ret = on2avc_decode_band_types(c, bc)) < 0) return ret; if ((ret = on2avc_decode_band_scales(c, bc)) < 0) return ret; coeff_ptr = c->coeffs[ch]; band_idx = 0; memset(coeff_ptr, 0, ON2AVC_SUBFRAME_SIZE * sizeof(*coeff_ptr)); for (w = 0; w < c->num_windows; w++) { for (b = 0; b < c->num_bands; b++) { int band_size = c->band_start[b + 1] - c->band_start[b]; int band_type = c->band_type[band_idx + b]; if (!band_type) { coeff_ptr += band_size; continue; } if (band_type < 9) on2avc_decode_quads(c, bc, coeff_ptr, band_size, band_type, c->band_scales[band_idx + b]); else on2avc_decode_pairs(c, bc, coeff_ptr, band_size, band_type, c->band_scales[band_idx + b]); coeff_ptr += band_size; } band_idx += c->num_bands; } return 0; } libavcodec/on2avc.c:891: error: Buffer Overrun L3 Offset added: [4096, +oo] (⇐ [0, +oo] + 4096) Size: [0, +oo] by call to `on2avc_decode_subframe`. libavcodec/on2avc.c:891:24: Call 889. while (bytestream2_get_bytes_left(&gb) > 2) { 890. frame_size = bytestream2_get_le16(&gb); 891. if ((ret = on2avc_decode_subframe(c, gb.buffer, frame_size, ^ 892. frame, audio_off)) < 0) 893. return ret; libavcodec/on2avc.c:799:1: Parameter `c->band_type[*].strlen` 797. } 798. 799. static int on2avc_decode_subframe(On2AVCContext *c, const uint8_t *buf, ^ 800. int buf_size, AVFrame *dst, int offset) 801. { libavcodec/on2avc.c:891:24: Call 889. while (bytestream2_get_bytes_left(&gb) > 2) { 890. frame_size = bytestream2_get_le16(&gb); 891. if ((ret = on2avc_decode_subframe(c, gb.buffer, frame_size, ^ 892. frame, audio_off)) < 0) 893. return ret; libavcodec/on2avc.c:799:1: Parameter `c->avctx->channels` 797. } 798. 799. static int on2avc_decode_subframe(On2AVCContext *c, const uint8_t *buf, ^ 800. int buf_size, AVFrame *dst, int offset) 801. { libavcodec/on2avc.c:828:20: Call 826. on2avc_read_ms_info(c, &bc); 827. for (i = 0; i < c->avctx->channels; i++) 828. if ((ret = on2avc_read_channel_data(c, &bc, i)) < 0) ^ 829. return AVERROR_INVALIDDATA; 830. if (c->avctx->channels == 2 && c->ms_present) libavcodec/on2avc.c:254:1: <Length trace> 252. } 253. 254. static int on2avc_read_channel_data(On2AVCContext *c, BitstreamContext *bc, int ch) ^ 255. { 256. int ret; libavcodec/on2avc.c:254:1: Parameter `ch` 252. } 253. 254. static int on2avc_read_channel_data(On2AVCContext *c, BitstreamContext *bc, int ch) ^ 255. { 256. int ret; libavcodec/on2avc.c:265:5: Assignment 263. return ret; 264. 265. coeff_ptr = c->coeffs[ch]; ^ 266. band_idx = 0; 267. memset(coeff_ptr, 0, ON2AVC_SUBFRAME_SIZE * sizeof(*coeff_ptr)); libavcodec/on2avc.c:267:5: Array access: Offset added: [4096, +oo] (⇐ [0, +oo] + 4096) Size: [0, +oo] by call to `on2avc_decode_subframe` 265. coeff_ptr = c->coeffs[ch]; 266. band_idx = 0; 267. memset(coeff_ptr, 0, ON2AVC_SUBFRAME_SIZE * sizeof(*coeff_ptr)); ^ 268. for (w = 0; w < c->num_windows; w++) { 269. for (b = 0; b < c->num_bands; b++) {
https://github.com/libav/libav/blob/004ea63714e31ed43326ad00d7420d104f0dab38/libavcodec/on2avc.c/#L267
d2a_code_trace_data_42947
void RAND_seed(const void *buf, int num) { const RAND_METHOD *meth = RAND_get_rand_method(); if (meth->seed != NULL) meth->seed(buf, num); } crypto/rand/rand_lib.c:786: error: NULL_DEREFERENCE pointer `meth` last assigned on line 784 could be null and is dereferenced at line 786, column 9. Showing all 14 steps of the trace crypto/rand/rand_lib.c:782:1: start of procedure RAND_seed() 780. #endif 781. 782. > void RAND_seed(const void *buf, int num) 783. { 784. const RAND_METHOD *meth = RAND_get_rand_method(); crypto/rand/rand_lib.c:784:5: 782. void RAND_seed(const void *buf, int num) 783. { 784. > const RAND_METHOD *meth = RAND_get_rand_method(); 785. 786. if (meth->seed != NULL) crypto/rand/rand_lib.c:726:1: start of procedure RAND_get_rand_method() 724. } 725. 726. > const RAND_METHOD *RAND_get_rand_method(void) 727. { 728. const RAND_METHOD *tmp_meth = NULL; crypto/rand/rand_lib.c:728:5: 726. const RAND_METHOD *RAND_get_rand_method(void) 727. { 728. > const RAND_METHOD *tmp_meth = NULL; 729. 730. if (!RUN_ONCE(&rand_init, do_rand_init)) crypto/rand/rand_lib.c:730:10: 728. const RAND_METHOD *tmp_meth = NULL; 729. 730. > if (!RUN_ONCE(&rand_init, do_rand_init)) 731. return NULL; 732. 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:730:10: Condition is false 728. const RAND_METHOD *tmp_meth = NULL; 729. 730. if (!RUN_ONCE(&rand_init, do_rand_init)) ^ 731. return NULL; 732. crypto/rand/rand_lib.c:730:10: Taking true branch 728. const RAND_METHOD *tmp_meth = NULL; 729. 730. if (!RUN_ONCE(&rand_init, do_rand_init)) ^ 731. return NULL; 732. crypto/rand/rand_lib.c:731:9: 729. 730. if (!RUN_ONCE(&rand_init, do_rand_init)) 731. > return NULL; 732. 733. CRYPTO_THREAD_write_lock(rand_meth_lock); crypto/rand/rand_lib.c:754:1: return from a call to RAND_get_rand_method 752. CRYPTO_THREAD_unlock(rand_meth_lock); 753. return tmp_meth; 754. > } 755. 756. #ifndef OPENSSL_NO_ENGINE crypto/rand/rand_lib.c:786:9: 784. const RAND_METHOD *meth = RAND_get_rand_method(); 785. 786. > if (meth->seed != NULL) 787. meth->seed(buf, num); 788. }
https://github.com/openssl/openssl/blob/9bba2c4c97a5fc5aea9e24223eebb85a15817e74/crypto/rand/rand_lib.c/#L786
d2a_code_trace_data_42948
static void parcor_to_lpc(unsigned int k, const int32_t *par, int32_t *cof) { int i, j; for (i = 0, j = k - 1; i < j; i++, j--) { int tmp1 = ((MUL64(par[k], cof[j]) + (1 << 19)) >> 20); cof[j] += ((MUL64(par[k], cof[i]) + (1 << 19)) >> 20); cof[i] += tmp1; } if (i == j) cof[i] += ((MUL64(par[k], cof[j]) + (1 << 19)) >> 20); cof[k] = par[k]; } libavcodec/alsdec.c:888: error: Integer Overflow L2 ([0, -1+max(1, `*bd->opt_order`)] - 1):unsigned32 by call to `parcor_to_lpc`. libavcodec/alsdec.c:887:14: Assignment 885. } 886. } else { 887. for (k = 0; k < opt_order; k++) ^ 888. parcor_to_lpc(k, quant_cof, lpc_cof); 889. libavcodec/alsdec.c:888:13: Call 886. } else { 887. for (k = 0; k < opt_order; k++) 888. parcor_to_lpc(k, quant_cof, lpc_cof); ^ 889. 890. // store previous samples in case that they have to be altered libavcodec/alsdec.c:481:1: <LHS trace> 479. /** Convert PARCOR coefficient k to direct filter coefficient. 480. */ 481. static void parcor_to_lpc(unsigned int k, const int32_t *par, int32_t *cof) ^ 482. { 483. int i, j; libavcodec/alsdec.c:481:1: Parameter `k` 479. /** Convert PARCOR coefficient k to direct filter coefficient. 480. */ 481. static void parcor_to_lpc(unsigned int k, const int32_t *par, int32_t *cof) ^ 482. { 483. int i, j; libavcodec/alsdec.c:485:17: Binary operation: ([0, -1+max(1, *bd->opt_order)] - 1):unsigned32 by call to `parcor_to_lpc` 483. int i, j; 484. 485. for (i = 0, j = k - 1; i < j; i++, j--) { ^ 486. int tmp1 = ((MUL64(par[k], cof[j]) + (1 << 19)) >> 20); 487. cof[j] += ((MUL64(par[k], cof[i]) + (1 << 19)) >> 20);
https://github.com/libav/libav/blob/3cf8db9447a6c77550033acea84e30be2af7ad2c/libavcodec/alsdec.c/#L485
d2a_code_trace_data_42949
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:128: error: NULL_DEREFERENCE pointer `ex_data` last assigned on line 109 could be null and is dereferenced at line 128, column 9. Showing all 40 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 true 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:118:9: 116. 117. if (strcmp(servername, "server2") == 0) { 118. > SSL_CTX *new_ctx = (SSL_CTX*)arg; 119. SSL_set_SSL_CTX(s, new_ctx); 120. /* test/handshake_helper.c:119:9: 117. if (strcmp(servername, "server2") == 0) { 118. SSL_CTX *new_ctx = (SSL_CTX*)arg; 119. > SSL_set_SSL_CTX(s, new_ctx); 120. /* 121. * Copy over all the SSL_CTX options - reasonable behavior ssl/ssl_lib.c:3585:1: start of procedure SSL_set_SSL_CTX() 3583. } 3584. 3585. > SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx) 3586. { 3587. CERT *new_cert; ssl/ssl_lib.c:3588:9: Taking false branch 3586. { 3587. CERT *new_cert; 3588. if (ssl->ctx == ctx) ^ 3589. return ssl->ctx; 3590. if (ctx == NULL) ssl/ssl_lib.c:3590:9: Taking false branch 3588. if (ssl->ctx == ctx) 3589. return ssl->ctx; 3590. if (ctx == NULL) ^ 3591. ctx = ssl->session_ctx; 3592. new_cert = ssl_cert_dup(ctx->cert); ssl/ssl_lib.c:3592:5: Skipping ssl_cert_dup(): empty list of specs 3590. if (ctx == NULL) 3591. ctx = ssl->session_ctx; 3592. new_cert = ssl_cert_dup(ctx->cert); ^ 3593. if (new_cert == NULL) { 3594. return NULL; ssl/ssl_lib.c:3593:9: Taking true branch 3591. ctx = ssl->session_ctx; 3592. new_cert = ssl_cert_dup(ctx->cert); 3593. if (new_cert == NULL) { ^ 3594. return NULL; 3595. } ssl/ssl_lib.c:3594:9: 3592. new_cert = ssl_cert_dup(ctx->cert); 3593. if (new_cert == NULL) { 3594. > return NULL; 3595. } 3596. ssl_cert_free(ssl->cert); ssl/ssl_lib.c:3623:1: return from a call to SSL_set_SSL_CTX 3621. 3622. return ssl->ctx; 3623. > } 3624. 3625. int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx) test/handshake_helper.c:125:9: 123. * contexts differ/conflict 124. */ 125. > SSL_clear_options(s, 0xFFFFFFFFL); 126. SSL_set_options(s, SSL_CTX_get_options(new_ctx)); 127. ssl/ssl_lib.c:4067:1: start of procedure SSL_clear_options() 4065. } 4066. 4067. > unsigned long SSL_clear_options(SSL *s, unsigned long op) 4068. { 4069. return s->options &= ~op; ssl/ssl_lib.c:4069:5: 4067. unsigned long SSL_clear_options(SSL *s, unsigned long op) 4068. { 4069. > return s->options &= ~op; 4070. } 4071. ssl/ssl_lib.c:4070:1: return from a call to SSL_clear_options 4068. { 4069. return s->options &= ~op; 4070. > } 4071. 4072. STACK_OF(X509) *SSL_get0_verified_chain(const SSL *s) test/handshake_helper.c:126:9: 124. */ 125. SSL_clear_options(s, 0xFFFFFFFFL); 126. > SSL_set_options(s, SSL_CTX_get_options(new_ctx)); 127. 128. ex_data->servername = SSL_TEST_SERVERNAME_SERVER2; ssl/ssl_lib.c:4042:1: start of procedure SSL_CTX_get_options() 4040. * control interface. 4041. */ 4042. > unsigned long SSL_CTX_get_options(const SSL_CTX *ctx) 4043. { 4044. return ctx->options; ssl/ssl_lib.c:4044:5: 4042. unsigned long SSL_CTX_get_options(const SSL_CTX *ctx) 4043. { 4044. > return ctx->options; 4045. } 4046. ssl/ssl_lib.c:4045:1: return from a call to SSL_CTX_get_options 4043. { 4044. return ctx->options; 4045. > } 4046. 4047. unsigned long SSL_get_options(const SSL *s) ssl/ssl_lib.c:4057:1: start of procedure SSL_set_options() 4055. } 4056. 4057. > unsigned long SSL_set_options(SSL *s, unsigned long op) 4058. { 4059. return s->options |= op; ssl/ssl_lib.c:4059:5: 4057. unsigned long SSL_set_options(SSL *s, unsigned long op) 4058. { 4059. > return s->options |= op; 4060. } 4061. ssl/ssl_lib.c:4060:1: return from a call to SSL_set_options 4058. { 4059. return s->options |= op; 4060. > } 4061. 4062. unsigned long SSL_CTX_clear_options(SSL_CTX *ctx, unsigned long op) test/handshake_helper.c:128:9: 126. SSL_set_options(s, SSL_CTX_get_options(new_ctx)); 127. 128. > ex_data->servername = SSL_TEST_SERVERNAME_SERVER2; 129. return SSL_TLSEXT_ERR_OK; 130. } else if (strcmp(servername, "server1") == 0) {
https://github.com/openssl/openssl/blob/0f5df0f1037590de12cc11eeab26fe29bf3f16a3/test/handshake_helper.c/#L128
d2a_code_trace_data_42950
static int rtsp_read_announce(AVFormatContext *s) { RTSPState *rt = s->priv_data; RTSPMessageHeader request = { 0 }; char sdp[4096]; int ret; ret = rtsp_read_request(s, &request, "ANNOUNCE"); if (ret) return ret; rt->seq++; if (strcmp(request.content_type, "application/sdp")) { av_log(s, AV_LOG_ERROR, "Unexpected content type %s\n", request.content_type); rtsp_send_reply(s, RTSP_STATUS_SERVICE, NULL, request.seq); return AVERROR_OPTION_NOT_FOUND; } if (request.content_length && request.content_length < sizeof(sdp) - 1) { if (ffurl_read_complete(rt->rtsp_hd, sdp, request.content_length) < request.content_length) { av_log(s, AV_LOG_ERROR, "Unable to get complete SDP Description in ANNOUNCE\n"); rtsp_send_reply(s, RTSP_STATUS_INTERNAL, NULL, request.seq); return AVERROR(EIO); } sdp[request.content_length] = '\0'; av_log(s, AV_LOG_VERBOSE, "SDP: %s\n", sdp); ret = ff_sdp_parse(s, sdp); if (ret) return ret; rtsp_send_reply(s, RTSP_STATUS_OK, NULL, request.seq); return 0; } av_log(s, AV_LOG_ERROR, "Content-Length header value exceeds sdp allocated buffer (4KB)\n"); rtsp_send_reply(s, RTSP_STATUS_INTERNAL, "Content-Length exceeds buffer size", request.seq); return AVERROR(EIO); } libavformat/rtspdec.c:192: error: Null Dereference pointer `null` is dereferenced by call to `rtsp_send_reply()` at line 192, column 13. libavformat/rtspdec.c:169:1: start of procedure rtsp_read_announce() 167. } 168. 169. static int rtsp_read_announce(AVFormatContext *s) ^ 170. { 171. RTSPState *rt = s->priv_data; libavformat/rtspdec.c:171:5: 169. static int rtsp_read_announce(AVFormatContext *s) 170. { 171. RTSPState *rt = s->priv_data; ^ 172. RTSPMessageHeader request = { 0 }; 173. char sdp[4096]; libavformat/rtspdec.c:172:5: 170. { 171. RTSPState *rt = s->priv_data; 172. RTSPMessageHeader request = { 0 }; ^ 173. char sdp[4096]; 174. int ret; libavformat/rtspdec.c:176:5: Skipping rtsp_read_request(): empty list of specs 174. int ret; 175. 176. ret = rtsp_read_request(s, &request, "ANNOUNCE"); ^ 177. if (ret) 178. return ret; libavformat/rtspdec.c:177:9: Taking false branch 175. 176. ret = rtsp_read_request(s, &request, "ANNOUNCE"); 177. if (ret) ^ 178. return ret; 179. rt->seq++; libavformat/rtspdec.c:179:5: 177. if (ret) 178. return ret; 179. rt->seq++; ^ 180. if (strcmp(request.content_type, "application/sdp")) { 181. av_log(s, AV_LOG_ERROR, "Unexpected content type %s\n", libavformat/rtspdec.c:180:9: Taking false branch 178. return ret; 179. rt->seq++; 180. if (strcmp(request.content_type, "application/sdp")) { ^ 181. av_log(s, AV_LOG_ERROR, "Unexpected content type %s\n", 182. request.content_type); libavformat/rtspdec.c:186:9: Taking true branch 184. return AVERROR_OPTION_NOT_FOUND; 185. } 186. if (request.content_length && request.content_length < sizeof(sdp) - 1) { ^ 187. /* Read SDP */ 188. if (ffurl_read_complete(rt->rtsp_hd, sdp, request.content_length) libavformat/rtspdec.c:186:35: Taking true branch 184. return AVERROR_OPTION_NOT_FOUND; 185. } 186. if (request.content_length && request.content_length < sizeof(sdp) - 1) { ^ 187. /* Read SDP */ 188. if (ffurl_read_complete(rt->rtsp_hd, sdp, request.content_length) libavformat/rtspdec.c:188:13: 186. if (request.content_length && request.content_length < sizeof(sdp) - 1) { 187. /* Read SDP */ 188. if (ffurl_read_complete(rt->rtsp_hd, sdp, request.content_length) ^ 189. < request.content_length) { 190. av_log(s, AV_LOG_ERROR, libavformat/avio.c:258:1: start of procedure ffurl_read_complete() 256. } 257. 258. int ffurl_read_complete(URLContext *h, unsigned char *buf, int size) ^ 259. { 260. if (!(h->flags & AVIO_FLAG_READ)) libavformat/avio.c:260:11: Taking true branch 258. int ffurl_read_complete(URLContext *h, unsigned char *buf, int size) 259. { 260. if (!(h->flags & AVIO_FLAG_READ)) ^ 261. return AVERROR(EIO); 262. return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read); libavformat/avio.c:261:9: 259. { 260. if (!(h->flags & AVIO_FLAG_READ)) 261. return AVERROR(EIO); ^ 262. return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read); 263. } libavformat/avio.c:263:1: return from a call to ffurl_read_complete 261. return AVERROR(EIO); 262. return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read); 263. } ^ 264. 265. int ffurl_write(URLContext *h, const unsigned char *buf, int size) libavformat/rtspdec.c:188:13: Taking true branch 186. if (request.content_length && request.content_length < sizeof(sdp) - 1) { 187. /* Read SDP */ 188. if (ffurl_read_complete(rt->rtsp_hd, sdp, request.content_length) ^ 189. < request.content_length) { 190. av_log(s, AV_LOG_ERROR, libavformat/rtspdec.c:190:13: Skipping av_log(): empty list of specs 188. if (ffurl_read_complete(rt->rtsp_hd, sdp, request.content_length) 189. < request.content_length) { 190. av_log(s, AV_LOG_ERROR, ^ 191. "Unable to get complete SDP Description in ANNOUNCE\n"); 192. rtsp_send_reply(s, RTSP_STATUS_INTERNAL, NULL, request.seq); libavformat/rtspdec.c:192:13: 190. av_log(s, AV_LOG_ERROR, 191. "Unable to get complete SDP Description in ANNOUNCE\n"); 192. rtsp_send_reply(s, RTSP_STATUS_INTERNAL, NULL, request.seq); ^ 193. return AVERROR(EIO); 194. } libavformat/rtspdec.c:94:1: start of procedure rtsp_send_reply() 92. } 93. 94. static int rtsp_send_reply(AVFormatContext *s, enum RTSPStatusCode code, ^ 95. const char *extracontent, uint16_t seq) 96. { libavformat/rtspdec.c:97:5: 95. const char *extracontent, uint16_t seq) 96. { 97. RTSPState *rt = s->priv_data; ^ 98. char message[4096]; 99. int index = 0; libavformat/rtspdec.c:99:5: 97. RTSPState *rt = s->priv_data; 98. char message[4096]; 99. int index = 0; ^ 100. while (status_messages[index].code) { 101. if (status_messages[index].code == code) { libavformat/rtspdec.c:100:12: Loop condition is true. Entering loop body 98. char message[4096]; 99. int index = 0; 100. while (status_messages[index].code) { ^ 101. if (status_messages[index].code == code) { 102. snprintf(message, sizeof(message), "RTSP/1.0 %d %s\r\n", libavformat/rtspdec.c:101:13: Taking false branch 99. int index = 0; 100. while (status_messages[index].code) { 101. if (status_messages[index].code == code) { ^ 102. snprintf(message, sizeof(message), "RTSP/1.0 %d %s\r\n", 103. code, status_messages[index].message); libavformat/rtspdec.c:106:9: 104. break; 105. } 106. index++; ^ 107. } 108. if (!status_messages[index].code) libavformat/rtspdec.c:100:12: Loop condition is true. Entering loop body 98. char message[4096]; 99. int index = 0; 100. while (status_messages[index].code) { ^ 101. if (status_messages[index].code == code) { 102. snprintf(message, sizeof(message), "RTSP/1.0 %d %s\r\n", libavformat/rtspdec.c:101:13: Taking false branch 99. int index = 0; 100. while (status_messages[index].code) { 101. if (status_messages[index].code == code) { ^ 102. snprintf(message, sizeof(message), "RTSP/1.0 %d %s\r\n", 103. code, status_messages[index].message); libavformat/rtspdec.c:106:9: 104. break; 105. } 106. index++; ^ 107. } 108. if (!status_messages[index].code) libavformat/rtspdec.c:100:12: Loop condition is true. Entering loop body 98. char message[4096]; 99. int index = 0; 100. while (status_messages[index].code) { ^ 101. if (status_messages[index].code == code) { 102. snprintf(message, sizeof(message), "RTSP/1.0 %d %s\r\n", libavformat/rtspdec.c:101:13: Taking false branch 99. int index = 0; 100. while (status_messages[index].code) { 101. if (status_messages[index].code == code) { ^ 102. snprintf(message, sizeof(message), "RTSP/1.0 %d %s\r\n", 103. code, status_messages[index].message); libavformat/rtspdec.c:106:9: 104. break; 105. } 106. index++; ^ 107. } 108. if (!status_messages[index].code) libavformat/rtspdec.c:100:12: Loop condition is false. Leaving loop 98. char message[4096]; 99. int index = 0; 100. while (status_messages[index].code) { ^ 101. if (status_messages[index].code == code) { 102. snprintf(message, sizeof(message), "RTSP/1.0 %d %s\r\n", libavformat/rtspdec.c:108:10: Taking true branch 106. index++; 107. } 108. if (!status_messages[index].code) ^ 109. return AVERROR(EINVAL); 110. av_strlcatf(message, sizeof(message), "CSeq: %d\r\n", seq); libavformat/rtspdec.c:109:9: 107. } 108. if (!status_messages[index].code) 109. return AVERROR(EINVAL); ^ 110. av_strlcatf(message, sizeof(message), "CSeq: %d\r\n", seq); 111. av_strlcatf(message, sizeof(message), "Server: %s\r\n", LIBAVFORMAT_IDENT); libavformat/rtspdec.c:119:1: return from a call to rtsp_send_reply 117. 118. return 0; 119. } ^ 120. 121. static inline int check_sessionid(AVFormatContext *s,
https://github.com/libav/libav/blob/0aa907cfb1bbc647ee4b6da62fac5c89d7b4d318/libavformat/rtspdec.c/#L192
d2a_code_trace_data_42951
int X509_chain_check_suiteb(int *perror_depth, X509 *x, STACK_OF(X509) *chain, unsigned long flags) { int rv, i, sign_nid; EVP_PKEY *pk = NULL; unsigned long tflags; if (!(flags & X509_V_FLAG_SUITEB_128_LOS)) return X509_V_OK; tflags = flags; if (x == NULL) { x = sk_X509_value(chain, 0); i = 1; } else i = 0; if (X509_get_version(x) != 2) { rv = X509_V_ERR_SUITE_B_INVALID_VERSION; i = 0; goto end; } pk = X509_get_pubkey(x); rv = check_suite_b(pk, -1, &tflags); if (rv != X509_V_OK) { i = 0; goto end; } for(; i < sk_X509_num(chain); i++) { sign_nid = X509_get_signature_nid(x); x = sk_X509_value(chain, i); if (X509_get_version(x) != 2) { rv = X509_V_ERR_SUITE_B_INVALID_VERSION; goto end; } EVP_PKEY_free(pk); pk = X509_get_pubkey(x); rv = check_suite_b(pk, sign_nid, &tflags); if (rv != X509_V_OK) goto end; } rv = check_suite_b(pk, X509_get_signature_nid(x), &tflags); end: if (pk) EVP_PKEY_free(pk); if (rv != X509_V_OK) { if ((rv == X509_V_ERR_SUITE_B_INVALID_SIGNATURE_ALGORITHM || rv == X509_V_ERR_SUITE_B_LOS_NOT_ALLOWED) && i) i--; if (rv == X509_V_ERR_SUITE_B_LOS_NOT_ALLOWED && flags != tflags) rv = X509_V_ERR_SUITE_B_CANNOT_SIGN_P_384_WITH_P_256; if (perror_depth) *perror_depth = i; } return rv; } crypto/x509/x509_cmp.c:420: error: NULL_DEREFERENCE pointer `x` last assigned on line 414 could be null and is dereferenced at line 420, column 6. Showing all 15 steps of the trace crypto/x509/x509_cmp.c:402:1: start of procedure X509_chain_check_suiteb() 400. } 401. 402. > int X509_chain_check_suiteb(int *perror_depth, X509 *x, STACK_OF(X509) *chain, 403. unsigned long flags) 404. { crypto/x509/x509_cmp.c:406:2: 404. { 405. int rv, i, sign_nid; 406. > EVP_PKEY *pk = NULL; 407. unsigned long tflags; 408. if (!(flags & X509_V_FLAG_SUITEB_128_LOS)) crypto/x509/x509_cmp.c:408:8: Taking false branch 406. EVP_PKEY *pk = NULL; 407. unsigned long tflags; 408. if (!(flags & X509_V_FLAG_SUITEB_128_LOS)) ^ 409. return X509_V_OK; 410. tflags = flags; crypto/x509/x509_cmp.c:410:2: 408. if (!(flags & X509_V_FLAG_SUITEB_128_LOS)) 409. return X509_V_OK; 410. > tflags = flags; 411. /* If no EE certificate passed in must be first in chain */ 412. if (x == NULL) crypto/x509/x509_cmp.c:412:6: Taking true branch 410. tflags = flags; 411. /* If no EE certificate passed in must be first in chain */ 412. if (x == NULL) ^ 413. { 414. x = sk_X509_value(chain, 0); crypto/x509/x509_cmp.c:414:7: Condition is true 412. if (x == NULL) 413. { 414. x = sk_X509_value(chain, 0); ^ 415. i = 1; 416. } crypto/x509/x509_cmp.c:414:3: 412. if (x == NULL) 413. { 414. > x = sk_X509_value(chain, 0); 415. i = 1; 416. } 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_cmp.c:415:3: 413. { 414. x = sk_X509_value(chain, 0); 415. > i = 1; 416. } 417. else crypto/x509/x509_cmp.c:420:6: 418. i = 0; 419. 420. > if (X509_get_version(x) != 2) 421. { 422. rv = X509_V_ERR_SUITE_B_INVALID_VERSION;
https://github.com/openssl/openssl/blob/cbb67448277232c8403f96edad4931c4203e7746/crypto/x509/x509_cmp.c/#L420
d2a_code_trace_data_42952
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; } test/srptest.c:177: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `SRP_create_verifier_BN`. Showing all 16 steps of the trace test/srptest.c:177:10: Call 175. BN_hex2bn(&s, "BEB25379D1A8581EB5A727673A2441EE"); 176. /* Set up server's password entry */ 177. if (!TEST_true(SRP_create_verifier_BN("alice", "password123", &s, &v, GN->N, ^ 178. GN->g))) 179. goto err; crypto/srp/srp_vfy.c:633:1: Parameter `N->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 `m->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:136:9: Call 134. 135. #ifdef MONT_MUL_MOD 136. if (BN_is_odd(m)) { ^ 137. # ifdef MONT_EXP_WORD 138. if (a->top == 1 && !a->neg crypto/bn/bn_lib.c:867:1: Parameter `a->top` 865. } 866. 867. > int BN_is_odd(const BIGNUM *a) 868. { 869. 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:198:14: Call 196. if (m->neg) { 197. /* ignore sign of 'm' */ 198. if (!BN_copy(aa, m)) ^ 199. goto err; 200. aa->neg = 0; crypto/bn/bn_lib.c:323:1: <Offset trace> 321. } 322. 323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 324. { 325. bn_check_top(b); crypto/bn/bn_lib.c:323:1: Parameter `b->top` 321. } 322. 323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 324. { 325. bn_check_top(b); crypto/bn/bn_lib.c:323:1: <Length trace> 321. } 322. 323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 324. { 325. bn_check_top(b); 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:333:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `SRP_create_verifier_BN` 331. 332. if (b->top > 0) 333. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); ^ 334. 335. a->top = b->top;
https://github.com/openssl/openssl/blob/b66411f6cda6970c01283ddde6d8063c57b3b7d9/crypto/bn/bn_lib.c/#L333
d2a_code_trace_data_42953
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dh/dh_check.c:229: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end`. Showing all 10 steps of the trace crypto/dh/dh_check.c:207:5: Call 205. if (ctx == NULL) 206. goto err; 207. BN_CTX_start(ctx); ^ 208. tmp = BN_CTX_get(ctx); 209. if (tmp == NULL || !BN_set_word(tmp, 1)) crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/dh/dh_check.c:229:9: Call 227. err: 228. if (ctx != NULL) { 229. BN_CTX_end(ctx); ^ 230. BN_CTX_free(ctx); 231. } crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268