id
stringlengths
25
25
content
stringlengths
649
72.1k
max_stars_repo_path
stringlengths
91
133
d2a_code_trace_data_41854
static av_always_inline int check_block(SnowContext *s, int mb_x, int mb_y, int p[3], int intra, const uint8_t *obmc_edged, int *best_rd){ const int b_stride= s->b_width << s->block_max_depth; BlockNode *block= &s->block[mb_x + mb_y * b_stride]; BlockNode backup= *block; int rd, index, value; assert(mb_x>=0 && mb_y>=0); assert(mb_x<b_stride); if(intra){ block->color[0] = p[0]; block->color[1] = p[1]; block->color[2] = p[2]; block->type |= BLOCK_INTRA; }else{ index= (p[0] + 31*p[1]) & (ME_CACHE_SIZE-1); value= s->me_cache_generation + (p[0]>>10) + (p[1]<<6) + (block->ref<<12); if(s->me_cache[index] == value) return 0; s->me_cache[index]= value; block->mx= p[0]; block->my= p[1]; block->type &= ~BLOCK_INTRA; } rd= get_block_rd(s, mb_x, mb_y, 0, obmc_edged); if(rd < *best_rd){ *best_rd= rd; return 1; }else{ *block= backup; return 0; } } libavcodec/snow.c:2985: error: Buffer Overrun L1 Offset: 2 Size: 2 by call to `check_block`. libavcodec/snow.c:2983:1: Array declaration 2981. /* special case for int[2] args we discard afterwards, 2982. * fixes compilation problem with gcc 2.95 */ 2983. static av_always_inline int check_block_inter(SnowContext *s, int mb_x, int mb_y, int p0, int p1, const uint8_t *obmc_edged, int *best_rd){ ^ 2984. int p[2] = {p0, p1}; 2985. return check_block(s, mb_x, mb_y, p, 0, obmc_edged, best_rd); libavcodec/snow.c:2985:12: Call 2983. static av_always_inline int check_block_inter(SnowContext *s, int mb_x, int mb_y, int p0, int p1, const uint8_t *obmc_edged, int *best_rd){ 2984. int p[2] = {p0, p1}; 2985. return check_block(s, mb_x, mb_y, p, 0, obmc_edged, best_rd); ^ 2986. } 2987. libavcodec/snow.c:2943:1: <Length trace> 2941. } 2942. 2943. static av_always_inline int check_block(SnowContext *s, int mb_x, int mb_y, int p[3], int intra, const uint8_t *obmc_edged, int *best_rd){ ^ 2944. const int b_stride= s->b_width << s->block_max_depth; 2945. BlockNode *block= &s->block[mb_x + mb_y * b_stride]; libavcodec/snow.c:2943:1: Parameter `*p` 2941. } 2942. 2943. static av_always_inline int check_block(SnowContext *s, int mb_x, int mb_y, int p[3], int intra, const uint8_t *obmc_edged, int *best_rd){ ^ 2944. const int b_stride= s->b_width << s->block_max_depth; 2945. BlockNode *block= &s->block[mb_x + mb_y * b_stride]; libavcodec/snow.c:2955:27: Array access: Offset: 2 Size: 2 by call to `check_block` 2953. block->color[0] = p[0]; 2954. block->color[1] = p[1]; 2955. block->color[2] = p[2]; ^ 2956. block->type |= BLOCK_INTRA; 2957. }else{
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/snow.c/#L2955
d2a_code_trace_data_41855
static void drbg_cleanup(void) { DRBG_CTX *dctx = RAND_DRBG_get_default(); CRYPTO_THREAD_write_lock(dctx->lock); RAND_DRBG_uninstantiate(dctx); CRYPTO_THREAD_unlock(dctx->lock); } crypto/rand/drbg_rand.c:431: error: NULL_DEREFERENCE pointer `dctx` last assigned on line 429 could be null and is dereferenced at line 431, column 30. Showing all 13 steps of the trace crypto/rand/drbg_rand.c:427:1: start of procedure drbg_cleanup() 425. } 426. 427. > static void drbg_cleanup(void) 428. { 429. DRBG_CTX *dctx = RAND_DRBG_get_default(); crypto/rand/drbg_rand.c:429:5: 427. static void drbg_cleanup(void) 428. { 429. > DRBG_CTX *dctx = RAND_DRBG_get_default(); 430. 431. CRYPTO_THREAD_write_lock(dctx->lock); crypto/rand/drbg_rand.c:384:1: start of procedure RAND_DRBG_get_default() 382. */ 383. 384. > DRBG_CTX *RAND_DRBG_get_default(void) 385. { 386. if (!RUN_ONCE(&ossl_drbg_init, do_ossl_drbg_init)) crypto/rand/drbg_rand.c:386:10: 384. DRBG_CTX *RAND_DRBG_get_default(void) 385. { 386. > if (!RUN_ONCE(&ossl_drbg_init, do_ossl_drbg_init)) 387. return NULL; 388. return &ossl_drbg; 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 true 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:108:9: 106. { 107. if (pthread_once(once, init) != 0) 108. > return 0; 109. 110. return 1; crypto/threads_pthread.c:111:1: return from a call to CRYPTO_THREAD_run_once 109. 110. return 1; 111. > } 112. 113. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)) crypto/rand/drbg_rand.c:386:10: Condition is false 384. DRBG_CTX *RAND_DRBG_get_default(void) 385. { 386. if (!RUN_ONCE(&ossl_drbg_init, do_ossl_drbg_init)) ^ 387. return NULL; 388. return &ossl_drbg; crypto/rand/drbg_rand.c:386:10: Taking true branch 384. DRBG_CTX *RAND_DRBG_get_default(void) 385. { 386. if (!RUN_ONCE(&ossl_drbg_init, do_ossl_drbg_init)) ^ 387. return NULL; 388. return &ossl_drbg; crypto/rand/drbg_rand.c:387:9: 385. { 386. if (!RUN_ONCE(&ossl_drbg_init, do_ossl_drbg_init)) 387. > return NULL; 388. return &ossl_drbg; 389. } crypto/rand/drbg_rand.c:389:1: return from a call to RAND_DRBG_get_default 387. return NULL; 388. return &ossl_drbg; 389. > } 390. 391. static int drbg_bytes(unsigned char *out, int count) crypto/rand/drbg_rand.c:431:5: 429. DRBG_CTX *dctx = RAND_DRBG_get_default(); 430. 431. > CRYPTO_THREAD_write_lock(dctx->lock); 432. RAND_DRBG_uninstantiate(dctx); 433. CRYPTO_THREAD_unlock(dctx->lock);
https://github.com/openssl/openssl/blob/12fb8c3d2dd00f3d4f1b084385403d26ed64a596/crypto/rand/drbg_rand.c/#L431
d2a_code_trace_data_41856
int ctr_generate(RAND_DRBG *drbg, unsigned char *out, size_t outlen, const unsigned char *adin, size_t adinlen) { RAND_DRBG_CTR *ctr = &drbg->ctr; if (adin != NULL && adinlen != 0) { ctr_update(drbg, adin, adinlen, NULL, 0, NULL, 0); if (drbg->flags & RAND_DRBG_FLAG_CTR_USE_DF) { adin = NULL; adinlen = 1; } } else { adinlen = 0; } for ( ; ; ) { inc_128(ctr); if (outlen < 16) { AES_encrypt(ctr->V, ctr->K, &ctr->ks); memcpy(out, ctr->K, outlen); break; } AES_encrypt(ctr->V, out, &ctr->ks); out += 16; outlen -= 16; if (outlen == 0) break; } ctr_update(drbg, adin, adinlen, NULL, 0, NULL, 0); return 1; } ssl/statem/statem_srvr.c:3546: error: BUFFER_OVERRUN_L3 Offset added: [1, 4] Size: [0, +oo] by call to `ssl_randbytes`. Showing all 10 steps of the trace ssl/statem/statem_srvr.c:3546:13: Call 3544. 3545. if (SSL_IS_TLS13(s)) { 3546. if (ssl_randbytes(s, age_add_u.age_add_c, sizeof(age_add_u)) <= 0) { ^ 3547. SSLfatal(s, SSL_AD_INTERNAL_ERROR, 3548. SSL_F_TLS_CONSTRUCT_NEW_SESSION_TICKET, ssl/ssl_lib.c:5172:1: Parameter `size` 5170. } 5171. 5172. > int ssl_randbytes(SSL *s, unsigned char *rnd, size_t size) 5173. { 5174. if (s->drbg != NULL) { ssl/ssl_lib.c:5187:17: Call 5185. * here. 5186. */ 5187. return RAND_DRBG_generate(s->drbg, rnd, size, 0, NULL, 0); ^ 5188. } 5189. return RAND_bytes(rnd, (int)size); crypto/rand/drbg_lib.c:363:1: Parameter `outlen` 361. * 362. */ 363. > int RAND_DRBG_generate(RAND_DRBG *drbg, unsigned char *out, size_t outlen, 364. int prediction_resistance, 365. const unsigned char *adin, size_t adinlen) crypto/rand/drbg_lib.c:409:10: Call 407. } 408. 409. if (!ctr_generate(drbg, out, outlen, adin, adinlen)) { ^ 410. drbg->state = DRBG_ERROR; 411. RANDerr(RAND_F_RAND_DRBG_GENERATE, RAND_R_GENERATE_ERROR); crypto/rand/drbg_rand.c:266:1: <Offset trace> 264. } 265. 266. > int ctr_generate(RAND_DRBG *drbg, 267. unsigned char *out, size_t outlen, 268. const unsigned char *adin, size_t adinlen) crypto/rand/drbg_rand.c:266:1: Parameter `outlen` 264. } 265. 266. > int ctr_generate(RAND_DRBG *drbg, 267. unsigned char *out, size_t outlen, 268. const unsigned char *adin, size_t adinlen) crypto/rand/drbg_rand.c:266:1: <Length trace> 264. } 265. 266. > int ctr_generate(RAND_DRBG *drbg, 267. unsigned char *out, size_t outlen, 268. const unsigned char *adin, size_t adinlen) crypto/rand/drbg_rand.c:266:1: Parameter `drbg->ctr.K[*]` 264. } 265. 266. > int ctr_generate(RAND_DRBG *drbg, 267. unsigned char *out, size_t outlen, 268. const unsigned char *adin, size_t adinlen) crypto/rand/drbg_rand.c:288:13: Array access: Offset added: [1, 4] Size: [0, +oo] by call to `ssl_randbytes` 286. /* Use K as temp space as it will be updated */ 287. AES_encrypt(ctr->V, ctr->K, &ctr->ks); 288. memcpy(out, ctr->K, outlen); ^ 289. break; 290. }
https://github.com/openssl/openssl/blob/e7d961e994620dd5dee6d80794a07fb9de1bab66/crypto/rand/drbg_rand.c/#L288
d2a_code_trace_data_41857
static void opt_output_file(const char *filename) { AVFormatContext *oc; int err, use_video, use_audio, use_subtitle; int input_has_video, input_has_audio, input_has_subtitle; AVFormatParameters params, *ap = &params; AVOutputFormat *file_oformat; if (!strcmp(filename, "-")) filename = "pipe:"; oc = avformat_alloc_context(); if (!oc) { print_error(filename, AVERROR(ENOMEM)); ffmpeg_exit(1); } if (last_asked_format) { file_oformat = av_guess_format(last_asked_format, NULL, NULL); if (!file_oformat) { fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format); ffmpeg_exit(1); } last_asked_format = NULL; } else { file_oformat = av_guess_format(NULL, filename, NULL); if (!file_oformat) { fprintf(stderr, "Unable to find a suitable output format for '%s'\n", filename); ffmpeg_exit(1); } } oc->oformat = file_oformat; av_strlcpy(oc->filename, filename, sizeof(oc->filename)); if (!strcmp(file_oformat->name, "ffm") && av_strstart(filename, "http:", NULL)) { int err = read_ffserver_streams(oc, filename); if (err < 0) { print_error(filename, err); ffmpeg_exit(1); } } else { use_video = file_oformat->video_codec != CODEC_ID_NONE || video_stream_copy || video_codec_name; use_audio = file_oformat->audio_codec != CODEC_ID_NONE || audio_stream_copy || audio_codec_name; use_subtitle = file_oformat->subtitle_codec != CODEC_ID_NONE || subtitle_stream_copy || subtitle_codec_name; if (nb_input_files > 0) { check_audio_video_sub_inputs(&input_has_video, &input_has_audio, &input_has_subtitle); if (!input_has_video) use_video = 0; if (!input_has_audio) use_audio = 0; if (!input_has_subtitle) use_subtitle = 0; } if (audio_disable) { use_audio = 0; } if (video_disable) { use_video = 0; } if (subtitle_disable) { use_subtitle = 0; } if (use_video) { new_video_stream(oc); } if (use_audio) { new_audio_stream(oc); } if (use_subtitle) { new_subtitle_stream(oc); } oc->timestamp = recording_timestamp; for(; metadata_count>0; metadata_count--){ av_metadata_set2(&oc->metadata, metadata[metadata_count-1].key, metadata[metadata_count-1].value, 0); } av_metadata_conv(oc, oc->oformat->metadata_conv, NULL); } output_files[nb_output_files++] = oc; if (oc->oformat->flags & AVFMT_NEEDNUMBER) { if (!av_filename_number_test(oc->filename)) { print_error(oc->filename, AVERROR_NUMEXPECTED); ffmpeg_exit(1); } } if (!(oc->oformat->flags & AVFMT_NOFILE)) { if (!file_overwrite && (strchr(filename, ':') == NULL || filename[1] == ':' || av_strstart(filename, "file:", NULL))) { if (url_exist(filename)) { if (!using_stdin) { fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename); fflush(stderr); if (!read_yesno()) { fprintf(stderr, "Not overwriting - exiting\n"); ffmpeg_exit(1); } } else { fprintf(stderr,"File '%s' already exists. Exiting.\n", filename); ffmpeg_exit(1); } } } if ((err = url_fopen(&oc->pb, filename, URL_WRONLY)) < 0) { print_error(filename, err); ffmpeg_exit(1); } } memset(ap, 0, sizeof(*ap)); if (av_set_parameters(oc, ap) < 0) { fprintf(stderr, "%s: Invalid encoding parameters\n", oc->filename); ffmpeg_exit(1); } oc->preload= (int)(mux_preload*AV_TIME_BASE); oc->max_delay= (int)(mux_max_delay*AV_TIME_BASE); oc->loop_output = loop_output; oc->flags |= AVFMT_FLAG_NONBLOCK; set_context_opts(oc, avformat_opts, AV_OPT_FLAG_ENCODING_PARAM); memset(streamid_map, 0, sizeof(streamid_map)); } ffmpeg.c:3692: error: Null Dereference pointer `oc` last assigned on line 3670 could be null and is dereferenced at line 3692, column 5. ffmpeg.c:3659:1: start of procedure opt_output_file() 3657. } 3658. 3659. static void opt_output_file(const char *filename) ^ 3660. { 3661. AVFormatContext *oc; ffmpeg.c:3664:5: 3662. int err, use_video, use_audio, use_subtitle; 3663. int input_has_video, input_has_audio, input_has_subtitle; 3664. AVFormatParameters params, *ap = &params; ^ 3665. AVOutputFormat *file_oformat; 3666. ffmpeg.c:3667:10: Taking false branch 3665. AVOutputFormat *file_oformat; 3666. 3667. if (!strcmp(filename, "-")) ^ 3668. filename = "pipe:"; 3669. ffmpeg.c:3670:5: 3668. filename = "pipe:"; 3669. 3670. oc = avformat_alloc_context(); ^ 3671. if (!oc) { 3672. print_error(filename, AVERROR(ENOMEM)); libavformat/options.c:81:1: start of procedure avformat_alloc_context() 79. } 80. 81. AVFormatContext *avformat_alloc_context(void) ^ 82. { 83. AVFormatContext *ic; libavformat/options.c:84:5: 82. { 83. AVFormatContext *ic; 84. ic = av_malloc(sizeof(AVFormatContext)); ^ 85. if (!ic) return ic; 86. avformat_get_context_defaults(ic); libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(unsigned int size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(unsigned int size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-16) ) ^ 73. return NULL; 74. libavutil/mem.c:83:9: Taking false branch 81. ((char*)ptr)[-1]= diff; 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,16,size)) ^ 84. ptr = NULL; 85. #elif HAVE_MEMALIGN libavutil/mem.c:116:5: 114. ptr = malloc(size); 115. #endif 116. return ptr; ^ 117. } 118. libavutil/mem.c:117:1: return from a call to av_malloc 115. #endif 116. return ptr; 117. } ^ 118. 119. void *av_realloc(void *ptr, unsigned int size) libavformat/options.c:85:10: Taking true branch 83. AVFormatContext *ic; 84. ic = av_malloc(sizeof(AVFormatContext)); 85. if (!ic) return ic; ^ 86. avformat_get_context_defaults(ic); 87. ic->av_class = &av_format_context_class; libavformat/options.c:85:14: 83. AVFormatContext *ic; 84. ic = av_malloc(sizeof(AVFormatContext)); 85. if (!ic) return ic; ^ 86. avformat_get_context_defaults(ic); 87. ic->av_class = &av_format_context_class; libavformat/options.c:89:1: return from a call to avformat_alloc_context 87. ic->av_class = &av_format_context_class; 88. return ic; 89. } ^ 90. 91. #if LIBAVFORMAT_VERSION_MAJOR < 53 ffmpeg.c:3671:10: Taking true branch 3669. 3670. oc = avformat_alloc_context(); 3671. if (!oc) { ^ 3672. print_error(filename, AVERROR(ENOMEM)); 3673. ffmpeg_exit(1); ffmpeg.c:3672:9: 3670. oc = avformat_alloc_context(); 3671. if (!oc) { 3672. print_error(filename, AVERROR(ENOMEM)); ^ 3673. ffmpeg_exit(1); 3674. } cmdutils.c:294:1: start of procedure print_error() 292. } 293. 294. void print_error(const char *filename, int err) ^ 295. { 296. char errbuf[128]; cmdutils.c:297:5: 295. { 296. char errbuf[128]; 297. const char *errbuf_ptr = errbuf; ^ 298. 299. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) cmdutils.c:299:9: 297. const char *errbuf_ptr = errbuf; 298. 299. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) ^ 300. errbuf_ptr = strerror(AVUNERROR(err)); 301. fprintf(stderr, "%s: %s\n", filename, errbuf_ptr); libavutil/error.c:22:1: start of procedure av_strerror() 20. #include "avstring.h" 21. 22. int av_strerror(int errnum, char *errbuf, size_t errbuf_size) ^ 23. { 24. int ret = 0; libavutil/error.c:24:5: 22. int av_strerror(int errnum, char *errbuf, size_t errbuf_size) 23. { 24. int ret = 0; ^ 25. const char *errstr = NULL; 26. libavutil/error.c:25:5: 23. { 24. int ret = 0; 25. const char *errstr = NULL; ^ 26. 27. switch (errnum) { libavutil/error.c:27:5: 25. const char *errstr = NULL; 26. 27. switch (errnum) { ^ 28. case AVERROR_EOF: errstr = "End of file"; break; 29. case AVERROR_INVALIDDATA: errstr = "Invalid data found when processing input"; break; libavutil/error.c:28:5: Switch condition is false. Skipping switch case 26. 27. switch (errnum) { 28. case AVERROR_EOF: errstr = "End of file"; break; ^ 29. case AVERROR_INVALIDDATA: errstr = "Invalid data found when processing input"; break; 30. case AVERROR_NUMEXPECTED: errstr = "Number syntax expected in filename"; break; libavutil/error.c:29:5: Switch condition is false. Skipping switch case 27. switch (errnum) { 28. case AVERROR_EOF: errstr = "End of file"; break; 29. case AVERROR_INVALIDDATA: errstr = "Invalid data found when processing input"; break; ^ 30. case AVERROR_NUMEXPECTED: errstr = "Number syntax expected in filename"; break; 31. case AVERROR_PATCHWELCOME: errstr = "Not yet implemented in FFmpeg, patches welcome"; break; libavutil/error.c:30:5: Switch condition is false. Skipping switch case 28. case AVERROR_EOF: errstr = "End of file"; break; 29. case AVERROR_INVALIDDATA: errstr = "Invalid data found when processing input"; break; 30. case AVERROR_NUMEXPECTED: errstr = "Number syntax expected in filename"; break; ^ 31. case AVERROR_PATCHWELCOME: errstr = "Not yet implemented in FFmpeg, patches welcome"; break; 32. } libavutil/error.c:31:5: Switch condition is false. Skipping switch case 29. case AVERROR_INVALIDDATA: errstr = "Invalid data found when processing input"; break; 30. case AVERROR_NUMEXPECTED: errstr = "Number syntax expected in filename"; break; 31. case AVERROR_PATCHWELCOME: errstr = "Not yet implemented in FFmpeg, patches welcome"; break; ^ 32. } 33. libavutil/error.c:34:9: Taking false branch 32. } 33. 34. if (errstr) { ^ 35. av_strlcpy(errbuf, errstr, errbuf_size); 36. } else { libavutil/error.c:38:9: 36. } else { 37. #if HAVE_STRERROR_R 38. ret = strerror_r(AVUNERROR(errnum), errbuf, errbuf_size); ^ 39. #else 40. ret = -1; libavutil/error.c:42:13: Taking false branch 40. ret = -1; 41. #endif 42. if (ret < 0) ^ 43. snprintf(errbuf, errbuf_size, "Error number %d occurred", errnum); 44. } libavutil/error.c:46:5: 44. } 45. 46. return ret; ^ 47. } libavutil/error.c:47:1: return from a call to av_strerror 45. 46. return ret; 47. } ^ cmdutils.c:299:9: Taking false branch 297. const char *errbuf_ptr = errbuf; 298. 299. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) ^ 300. errbuf_ptr = strerror(AVUNERROR(err)); 301. fprintf(stderr, "%s: %s\n", filename, errbuf_ptr); cmdutils.c:301:5: 299. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) 300. errbuf_ptr = strerror(AVUNERROR(err)); 301. fprintf(stderr, "%s: %s\n", filename, errbuf_ptr); ^ 302. } 303. cmdutils.c:302:1: return from a call to print_error 300. errbuf_ptr = strerror(AVUNERROR(err)); 301. fprintf(stderr, "%s: %s\n", filename, errbuf_ptr); 302. } ^ 303. 304. static int warned_cfg = 0; ffmpeg.c:3673:9: Skipping ffmpeg_exit(): empty list of specs 3671. if (!oc) { 3672. print_error(filename, AVERROR(ENOMEM)); 3673. ffmpeg_exit(1); ^ 3674. } 3675. ffmpeg.c:3676:9: Taking true branch 3674. } 3675. 3676. if (last_asked_format) { ^ 3677. file_oformat = av_guess_format(last_asked_format, NULL, NULL); 3678. if (!file_oformat) { ffmpeg.c:3677:9: Skipping av_guess_format(): empty list of specs 3675. 3676. if (last_asked_format) { 3677. file_oformat = av_guess_format(last_asked_format, NULL, NULL); ^ 3678. if (!file_oformat) { 3679. fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format); ffmpeg.c:3678:14: Taking false branch 3676. if (last_asked_format) { 3677. file_oformat = av_guess_format(last_asked_format, NULL, NULL); 3678. if (!file_oformat) { ^ 3679. fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format); 3680. ffmpeg_exit(1); ffmpeg.c:3682:9: 3680. ffmpeg_exit(1); 3681. } 3682. last_asked_format = NULL; ^ 3683. } else { 3684. file_oformat = av_guess_format(NULL, filename, NULL); ffmpeg.c:3692:5: 3690. } 3691. 3692. oc->oformat = file_oformat; ^ 3693. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); 3694.
https://github.com/libav/libav/blob/ad0d70c964f852a18e9ab8124f0e7aa8876cac6e/ffmpeg.c/#L3692
d2a_code_trace_data_41858
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/sslapitest.c:3897: error: BUFFER_OVERRUN_L3 Offset: [31, +oo] Size: [0, 8388607] by call to `SRP_create_verifier_BN`. Showing all 23 steps of the trace test/sslapitest.c:3897:10: Call 3895. goto end; 3896. 3897. if (!TEST_true(SRP_create_verifier_BN(userid, password, &salt, &verifier, ^ 3898. lgN->N, lgN->g))) 3899. goto end; crypto/srp/srp_vfy.c:662:1: Parameter `g->top` 660. * BIGNUMS. 661. */ 662. > int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, 663. BIGNUM **verifier, const BIGNUM *N, 664. const BIGNUM *g) crypto/srp/srp_vfy.c:693:10: Call 691. goto err; 692. 693. if (!BN_mod_exp(*verifier, g, x, N, bn_ctx)) { ^ 694. BN_clear_free(*verifier); 695. goto err; crypto/bn/bn_exp.c:89:1: Parameter `a->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: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:296:1: Parameter `a->top` 294. } 295. 296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 297. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 298. { crypto/bn/bn_exp.c:310:16: Call 308. || BN_get_flags(a, BN_FLG_CONSTTIME) != 0 309. || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) { 310. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 311. } 312. crypto/bn/bn_exp.c:598:1: Parameter `a->top` 596. * http://www.daemonology.net/hyperthreading-considered-harmful/) 597. */ 598. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 599. const BIGNUM *m, BN_CTX *ctx, 600. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:761:17: Call 759. if (!BN_to_montgomery(&am, &am, mont, ctx)) 760. goto err; 761. } else if (!BN_to_montgomery(&am, a, mont, ctx)) ^ 762. goto err; 763. crypto/bn/bn_lib.c:839:1: Parameter `a->top` 837. } 838. 839. > int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 840. BN_CTX *ctx) 841. { crypto/bn/bn_lib.c:842:12: Call 840. BN_CTX *ctx) 841. { 842. return BN_mod_mul_montgomery(r, a, &(mont->RR), mont, ctx); ^ 843. } 844. crypto/bn/bn_mont.c:26:1: Parameter `a->top` 24. #endif 25. 26. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 27. BN_MONT_CTX *mont, BN_CTX *ctx) 28. { crypto/bn/bn_mont.c:53:14: Call 51. bn_check_top(tmp); 52. if (a == b) { 53. if (!BN_sqr(tmp, a, ctx)) ^ 54. goto err; 55. } else { crypto/bn/bn_sqr.c:17:1: Parameter `a->top` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int max, al; crypto/bn/bn_sqr.c:25:5: Assignment 23. bn_check_top(a); 24. 25. al = a->top; ^ 26. if (al <= 0) { 27. r->top = 0; crypto/bn/bn_sqr.c:74:17: Call 72. if (bn_wexpand(tmp, max) == NULL) 73. goto err; 74. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 75. } 76. } crypto/bn/bn_sqr.c:105:1: <Offset trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `n` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:111:5: Assignment 109. BN_ULONG *rp; 110. 111. max = n * 2; ^ 112. ap = a; 113. rp = r; crypto/bn/bn_sqr.c:105:1: <Length trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `*r` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:113:5: Assignment 111. max = n * 2; 112. ap = a; 113. rp = r; ^ 114. rp[0] = rp[max - 1] = 0; 115. rp++; crypto/bn/bn_sqr.c:114:13: Array access: Offset: [31, +oo] Size: [0, 8388607] by call to `SRP_create_verifier_BN` 112. ap = a; 113. rp = r; 114. rp[0] = rp[max - 1] = 0; ^ 115. rp++; 116. j = n;
https://github.com/openssl/openssl/blob/a8ca496ddb532d7f7dc356fd2b026697388d2384/crypto/bn/bn_sqr.c/#L114
d2a_code_trace_data_41859
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/sslapitest.c:3897: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `SRP_create_verifier_BN`. Showing all 25 steps of the trace test/sslapitest.c:3897:10: Call 3895. goto end; 3896. 3897. if (!TEST_true(SRP_create_verifier_BN(userid, password, &salt, &verifier, ^ 3898. lgN->N, lgN->g))) 3899. goto end; crypto/srp/srp_vfy.c:662:1: Parameter `g->top` 660. * BIGNUMS. 661. */ 662. > int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, 663. BIGNUM **verifier, const BIGNUM *N, 664. const BIGNUM *g) crypto/srp/srp_vfy.c:693:10: Call 691. goto err; 692. 693. if (!BN_mod_exp(*verifier, g, x, N, bn_ctx)) { ^ 694. BN_clear_free(*verifier); 695. goto err; crypto/bn/bn_exp.c:89:1: Parameter `a->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: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:296:1: Parameter `a->top` 294. } 295. 296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 297. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 298. { crypto/bn/bn_exp.c:310:16: Call 308. || BN_get_flags(a, BN_FLG_CONSTTIME) != 0 309. || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) { 310. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 311. } 312. crypto/bn/bn_exp.c:598:1: Parameter `a->top` 596. * http://www.daemonology.net/hyperthreading-considered-harmful/) 597. */ 598. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 599. const BIGNUM *m, BN_CTX *ctx, 600. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:761:17: Call 759. if (!BN_to_montgomery(&am, &am, mont, ctx)) 760. goto err; 761. } else if (!BN_to_montgomery(&am, a, mont, ctx)) ^ 762. goto err; 763. crypto/bn/bn_lib.c:839:1: Parameter `a->top` 837. } 838. 839. > int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 840. BN_CTX *ctx) 841. { crypto/bn/bn_lib.c:842:12: Call 840. BN_CTX *ctx) 841. { 842. return BN_mod_mul_montgomery(r, a, &(mont->RR), mont, ctx); ^ 843. } 844. crypto/bn/bn_mont.c:26:1: Parameter `a->top` 24. #endif 25. 26. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 27. BN_MONT_CTX *mont, BN_CTX *ctx) 28. { crypto/bn/bn_mont.c:53:14: Call 51. bn_check_top(tmp); 52. if (a == b) { 53. if (!BN_sqr(tmp, a, ctx)) ^ 54. goto err; 55. } else { crypto/bn/bn_sqr.c:17:1: Parameter `a->top` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int max, al; crypto/bn/bn_sqr.c:25:5: Assignment 23. bn_check_top(a); 24. 25. al = a->top; ^ 26. if (al <= 0) { 27. r->top = 0; crypto/bn/bn_sqr.c:74:17: Call 72. if (bn_wexpand(tmp, max) == NULL) 73. goto err; 74. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 75. } 76. } crypto/bn/bn_sqr.c:105:1: <Offset trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `n` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:116:5: Assignment 114. rp[0] = rp[max - 1] = 0; 115. rp++; 116. j = n; ^ 117. 118. if (--j > 0) { crypto/bn/bn_sqr.c:118:9: Assignment 116. j = n; 117. 118. if (--j > 0) { ^ 119. ap++; 120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); crypto/bn/bn_sqr.c:105:1: <Length trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `*r` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:113:5: Assignment 111. max = n * 2; 112. ap = a; 113. rp = r; ^ 114. rp[0] = rp[max - 1] = 0; 115. rp++; crypto/bn/bn_sqr.c:115:5: Assignment 113. rp = r; 114. rp[0] = rp[max - 1] = 0; 115. rp++; ^ 116. j = n; 117. crypto/bn/bn_sqr.c:120:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `SRP_create_verifier_BN` 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/a8ca496ddb532d7f7dc356fd2b026697388d2384/crypto/bn/bn_sqr.c/#L120
d2a_code_trace_data_41860
EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md) { ssl_clear_hash_ctx(hash); *hash = EVP_MD_CTX_new(); if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { EVP_MD_CTX_free(*hash); *hash = NULL; return NULL; } return *hash; } ssl/ssl_lib.c:4359: error: MEMORY_LEAK memory dynamically allocated to `*hash` by call to `EVP_MD_CTX_new()` at line 4356, column 13 is not reachable after line 4359, column 9. Showing all 50 steps of the trace ssl/ssl_lib.c:4353:1: start of procedure ssl_replace_hash() 4351. */ 4352. 4353. > EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md) 4354. { 4355. ssl_clear_hash_ctx(hash); ssl/ssl_lib.c:4355:5: 4353. EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md) 4354. { 4355. > ssl_clear_hash_ctx(hash); 4356. *hash = EVP_MD_CTX_new(); 4357. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ssl/ssl_lib.c:4365:1: start of procedure ssl_clear_hash_ctx() 4363. } 4364. 4365. > void ssl_clear_hash_ctx(EVP_MD_CTX **hash) 4366. { 4367. ssl/ssl_lib.c:4368:5: 4366. { 4367. 4368. > EVP_MD_CTX_free(*hash); 4369. *hash = NULL; 4370. } 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 false 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:312:5: 310. } 311. #else 312. > free(str); 313. #endif 314. } 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) ssl/ssl_lib.c:4369:5: 4367. 4368. EVP_MD_CTX_free(*hash); 4369. > *hash = NULL; 4370. } 4371. ssl/ssl_lib.c:4370:1: return from a call to ssl_clear_hash_ctx 4368. EVP_MD_CTX_free(*hash); 4369. *hash = NULL; 4370. > } 4371. 4372. /* Retrieve handshake hashes */ ssl/ssl_lib.c:4356:5: 4354. { 4355. ssl_clear_hash_ctx(hash); 4356. > *hash = EVP_MD_CTX_new(); 4357. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { 4358. EVP_MD_CTX_free(*hash); crypto/evp/digest.c:44:1: start of procedure EVP_MD_CTX_new() 42. } 43. 44. > EVP_MD_CTX *EVP_MD_CTX_new(void) 45. { 46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); crypto/evp/digest.c:46:5: 44. EVP_MD_CTX *EVP_MD_CTX_new(void) 45. { 46. > return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 47. } 48. crypto/mem.c: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/ssl_lib.c:4357:9: Taking false branch 4355. ssl_clear_hash_ctx(hash); 4356. *hash = EVP_MD_CTX_new(); 4357. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ^ 4358. EVP_MD_CTX_free(*hash); 4359. *hash = NULL; ssl/ssl_lib.c:4357:27: Taking true branch 4355. ssl_clear_hash_ctx(hash); 4356. *hash = EVP_MD_CTX_new(); 4357. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ^ 4358. EVP_MD_CTX_free(*hash); 4359. *hash = NULL; ssl/ssl_lib.c:4357:33: Taking true branch 4355. ssl_clear_hash_ctx(hash); 4356. *hash = EVP_MD_CTX_new(); 4357. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ^ 4358. EVP_MD_CTX_free(*hash); 4359. *hash = NULL; ssl/ssl_lib.c:4358:9: 4356. *hash = EVP_MD_CTX_new(); 4357. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { 4358. > EVP_MD_CTX_free(*hash); 4359. *hash = NULL; 4360. return NULL; crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_free() 47. } 48. 49. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 50. { 51. EVP_MD_CTX_reset(ctx); crypto/evp/digest.c:51:5: Skipping EVP_MD_CTX_reset(): empty list of specs 49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 50. { 51. EVP_MD_CTX_reset(ctx); ^ 52. OPENSSL_free(ctx); 53. } crypto/evp/digest.c:52:5: 50. { 51. EVP_MD_CTX_reset(ctx); 52. > OPENSSL_free(ctx); 53. } 54. crypto/mem.c: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) ssl/ssl_lib.c:4359:9: 4357. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { 4358. EVP_MD_CTX_free(*hash); 4359. > *hash = NULL; 4360. return NULL; 4361. }
https://github.com/openssl/openssl/blob/c22365b399f62af4a81e9202500cd2cbd9c23a9d/ssl/ssl_lib.c/#L4359
d2a_code_trace_data_41861
static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, const int size, const int h, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ MotionEstContext * const c= &s->me; const int stride= c->stride; const int uvstride= c->uvstride; const int qpel= flags&FLAG_QPEL; const int chroma= flags&FLAG_CHROMA; const int dxy= subx + (suby<<(1+qpel)); const int hx= subx + (x<<(1+qpel)); const int hy= suby + (y<<(1+qpel)); uint8_t * const * const ref= c->ref[ref_index]; uint8_t * const * const src= c->src[src_index]; int d; if(flags&FLAG_DIRECT){ assert(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)); if(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)){ const int time_pp= s->pp_time; const int time_pb= s->pb_time; const int mask= 2*qpel+1; if(s->mv_type==MV_TYPE_8X8){ int i; for(i=0; i<4; i++){ int fx = c->direct_basis_mv[i][0] + hx; int fy = c->direct_basis_mv[i][1] + hy; int bx = hx ? fx - c->co_located_mv[i][0] : c->co_located_mv[i][0]*(time_pb - time_pp)/time_pp + ((i &1)<<(qpel+4)); int by = hy ? fy - c->co_located_mv[i][1] : c->co_located_mv[i][1]*(time_pb - time_pp)/time_pp + ((i>>1)<<(qpel+4)); int fxy= (fx&mask) + ((fy&mask)<<(qpel+1)); int bxy= (bx&mask) + ((by&mask)<<(qpel+1)); uint8_t *dst= c->temp + 8*(i&1) + 8*stride*(i>>1); if(qpel){ c->qpel_put[1][fxy](dst, ref[0] + (fx>>2) + (fy>>2)*stride, stride); c->qpel_avg[1][bxy](dst, ref[8] + (bx>>2) + (by>>2)*stride, stride); }else{ c->hpel_put[1][fxy](dst, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 8); c->hpel_avg[1][bxy](dst, ref[8] + (bx>>1) + (by>>1)*stride, stride, 8); } } }else{ int fx = c->direct_basis_mv[0][0] + hx; int fy = c->direct_basis_mv[0][1] + hy; int bx = hx ? fx - c->co_located_mv[0][0] : (c->co_located_mv[0][0]*(time_pb - time_pp)/time_pp); int by = hy ? fy - c->co_located_mv[0][1] : (c->co_located_mv[0][1]*(time_pb - time_pp)/time_pp); int fxy= (fx&mask) + ((fy&mask)<<(qpel+1)); int bxy= (bx&mask) + ((by&mask)<<(qpel+1)); if(qpel){ c->qpel_put[1][fxy](c->temp , ref[0] + (fx>>2) + (fy>>2)*stride , stride); c->qpel_put[1][fxy](c->temp + 8 , ref[0] + (fx>>2) + (fy>>2)*stride + 8 , stride); c->qpel_put[1][fxy](c->temp + 8*stride, ref[0] + (fx>>2) + (fy>>2)*stride + 8*stride, stride); c->qpel_put[1][fxy](c->temp + 8 + 8*stride, ref[0] + (fx>>2) + (fy>>2)*stride + 8 + 8*stride, stride); c->qpel_avg[1][bxy](c->temp , ref[8] + (bx>>2) + (by>>2)*stride , stride); c->qpel_avg[1][bxy](c->temp + 8 , ref[8] + (bx>>2) + (by>>2)*stride + 8 , stride); c->qpel_avg[1][bxy](c->temp + 8*stride, ref[8] + (bx>>2) + (by>>2)*stride + 8*stride, stride); c->qpel_avg[1][bxy](c->temp + 8 + 8*stride, ref[8] + (bx>>2) + (by>>2)*stride + 8 + 8*stride, stride); }else{ assert((fx>>1) + 16*s->mb_x >= -16); assert((fy>>1) + 16*s->mb_y >= -16); assert((fx>>1) + 16*s->mb_x <= s->width); assert((fy>>1) + 16*s->mb_y <= s->height); assert((bx>>1) + 16*s->mb_x >= -16); assert((by>>1) + 16*s->mb_y >= -16); assert((bx>>1) + 16*s->mb_x <= s->width); assert((by>>1) + 16*s->mb_y <= s->height); c->hpel_put[0][fxy](c->temp, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 16); c->hpel_avg[0][bxy](c->temp, ref[8] + (bx>>1) + (by>>1)*stride, stride, 16); } } d = cmp_func(s, c->temp, src[0], stride, 16); }else d= 256*256*256*32; }else{ int uvdxy; if(dxy){ if(qpel){ c->qpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride); if(chroma){ int cx= hx/2; int cy= hy/2; cx= (cx>>1)|(cx&1); cy= (cy>>1)|(cy&1); uvdxy= (cx&1) + 2*(cy&1); } }else{ c->hpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride, h); if(chroma) uvdxy= dxy | (x&1) | (2*(y&1)); } d = cmp_func(s, c->temp, src[0], stride, h); }else{ d = cmp_func(s, src[0], ref[0] + x + y*stride, stride, h); if(chroma) uvdxy= (x&1) + 2*(y&1); } if(chroma){ uint8_t * const uvtemp= c->temp + 16*stride; c->hpel_put[size+1][uvdxy](uvtemp , ref[1] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1); c->hpel_put[size+1][uvdxy](uvtemp+8, ref[2] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1); d += chroma_cmp_func(s, uvtemp , src[1], uvstride, h>>1); d += chroma_cmp_func(s, uvtemp+8, src[2], uvstride, h>>1); } } #if 0 if(full_pel){ const int index= (((y)<<ME_MAP_SHIFT) + (x))&(ME_MAP_SIZE-1); score_map[index]= d; } d += (c->mv_penalty[hx - c->pred_x] + c->mv_penalty[hy - c->pred_y])*c->penalty_factor; #endif return d; } libavcodec/motion_est.c:1938: error: Buffer Overrun L1 Offset: [10, 11] (⇐ [2, 3] + 8) Size: 4 by call to `interlaced_search`. libavcodec/motion_est.c:1938:16: Call 1936. s->b_forw_mv_table[xy][0], s->b_forw_mv_table[xy][1], 0); 1937. c->current_mv_penalty= c->mv_penalty[s->b_code] + MAX_MV; 1938. bimin= interlaced_search(s, 2, ^ 1939. s->b_field_mv_table[1], s->b_field_select_table[1], 1940. s->b_back_mv_table[xy][0], s->b_back_mv_table[xy][1], 0); libavcodec/motion_est.c:893:1: Parameter `ref_index` 891. } 892. 893. static int interlaced_search(MpegEncContext *s, int ref_index, ^ 894. int16_t (*mv_tables[2][2])[2], uint8_t *field_select_tables[2], int mx, int my, int user_field_select) 895. { libavcodec/motion_est.c:953:20: Call 951. P_MV1[1]= my / 2; 952. 953. dmin = epzs_motion_search2(s, &mx_i, &my_i, P, block, field_select+ref_index, mv_table, (1<<16)>>1); ^ 954. 955. dmin= c->sub_motion_search(s, &mx_i, &my_i, dmin, block, field_select+ref_index, size, h); libavcodec/motion_est_template.c:1191:1: Parameter `ref_index` 1189. 1190. //try to merge with above FIXME (needs PSNR test) 1191. static int epzs_motion_search2(MpegEncContext * s, ^ 1192. int *mx_ptr, int *my_ptr, int P[10][2], 1193. int src_index, int ref_index, int16_t (*last_mv)[2], libavcodec/motion_est_template.c:1241:11: Call 1239. } 1240. 1241. dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); ^ 1242. 1243. *mx_ptr= best[0]; libavcodec/motion_est_template.c:973:1: Parameter `ref_index` 971. } 972. 973. static av_always_inline int diamond_search(MpegEncContext * s, int *best, int dmin, ^ 974. int src_index, int ref_index, int const penalty_factor, 975. int size, int h, int flags){ libavcodec/motion_est_template.c:980:18: Call 978. return funny_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); 979. else if(c->dia_size<-1) 980. return sab_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); ^ 981. else if(c->dia_size<2) 982. return small_diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); libavcodec/motion_est_template.c:809:1: Parameter `ref_index` 807. 808. #define MAX_SAB_SIZE ME_MAP_SIZE 809. static int sab_diamond_search(MpegEncContext * s, int *best, int dmin, ^ 810. int src_index, int ref_index, int const penalty_factor, 811. int size, int h, int flags) libavcodec/motion_est_template.c:872:9: Call 870. continue; 871. 872. SAB_CHECK_MV(x-1, y) ^ 873. SAB_CHECK_MV(x+1, y) 874. SAB_CHECK_MV(x , y-1) libavcodec/motion_est.c:108:1: <Length trace> 106. against a proposed motion-compensated prediction of that block 107. */ 108. static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, ^ 109. const int size, const int h, int ref_index, int src_index, 110. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ libavcodec/motion_est.c:108:1: Parameter `ref_index` 106. against a proposed motion-compensated prediction of that block 107. */ 108. static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, ^ 109. const int size, const int h, int ref_index, int src_index, 110. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ libavcodec/motion_est.c:119:5: Assignment 117. const int hx= subx + (x<<(1+qpel)); 118. const int hy= suby + (y<<(1+qpel)); 119. uint8_t * const * const ref= c->ref[ref_index]; ^ 120. uint8_t * const * const src= c->src[src_index]; 121. int d; libavcodec/motion_est.c:176:50: Array access: Offset: [10, 11] (⇐ [2, 3] + 8) Size: 4 by call to `interlaced_search` 174. 175. c->hpel_put[0][fxy](c->temp, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 16); 176. c->hpel_avg[0][bxy](c->temp, ref[8] + (bx>>1) + (by>>1)*stride, stride, 16); ^ 177. } 178. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est.c/#L176
d2a_code_trace_data_41862
static void opt_output_file(void *optctx, const char *filename) { OptionsContext *o = optctx; AVFormatContext *oc; int i, err; AVOutputFormat *file_oformat; OutputStream *ost; InputStream *ist; if (!strcmp(filename, "-")) filename = "pipe:"; oc = avformat_alloc_context(); if (!oc) { print_error(filename, AVERROR(ENOMEM)); exit_program(1); } if (o->format) { file_oformat = av_guess_format(o->format, NULL, NULL); if (!file_oformat) { av_log(NULL, AV_LOG_FATAL, "Requested output format '%s' is not a suitable output format\n", o->format); exit_program(1); } } else { file_oformat = av_guess_format(NULL, filename, NULL); if (!file_oformat) { av_log(NULL, AV_LOG_FATAL, "Unable to find a suitable output format for '%s'\n", filename); exit_program(1); } } oc->oformat = file_oformat; oc->interrupt_callback = int_cb; av_strlcpy(oc->filename, filename, sizeof(oc->filename)); if (!o->nb_stream_maps) { #define NEW_STREAM(type, index)\ if (index >= 0) {\ ost = new_ ## type ## _stream(o, oc);\ ost->source_index = index;\ ost->sync_ist = &input_streams[index];\ input_streams[index].discard = 0;\ } if (!o->video_disable && oc->oformat->video_codec != CODEC_ID_NONE) { int area = 0, idx = -1; for (i = 0; i < nb_input_streams; i++) { ist = &input_streams[i]; if (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO && ist->st->codec->width * ist->st->codec->height > area) { area = ist->st->codec->width * ist->st->codec->height; idx = i; } } NEW_STREAM(video, idx); } if (!o->audio_disable && oc->oformat->audio_codec != CODEC_ID_NONE) { int channels = 0, idx = -1; for (i = 0; i < nb_input_streams; i++) { ist = &input_streams[i]; if (ist->st->codec->codec_type == AVMEDIA_TYPE_AUDIO && ist->st->codec->channels > channels) { channels = ist->st->codec->channels; idx = i; } } NEW_STREAM(audio, idx); } if (!o->subtitle_disable && oc->oformat->subtitle_codec != CODEC_ID_NONE) { for (i = 0; i < nb_input_streams; i++) if (input_streams[i].st->codec->codec_type == AVMEDIA_TYPE_SUBTITLE) { NEW_STREAM(subtitle, i); break; } } } else { for (i = 0; i < o->nb_stream_maps; i++) { StreamMap *map = &o->stream_maps[i]; if (map->disabled) continue; ist = &input_streams[input_files[map->file_index].ist_index + map->stream_index]; switch (ist->st->codec->codec_type) { case AVMEDIA_TYPE_VIDEO: ost = new_video_stream(o, oc); break; case AVMEDIA_TYPE_AUDIO: ost = new_audio_stream(o, oc); break; case AVMEDIA_TYPE_SUBTITLE: ost = new_subtitle_stream(o, oc); break; case AVMEDIA_TYPE_DATA: ost = new_data_stream(o, oc); break; case AVMEDIA_TYPE_ATTACHMENT: ost = new_attachment_stream(o, oc); break; default: av_log(NULL, AV_LOG_FATAL, "Cannot map stream #%d:%d - unsupported type.\n", map->file_index, map->stream_index); exit_program(1); } ost->source_index = input_files[map->file_index].ist_index + map->stream_index; ost->sync_ist = &input_streams[input_files[map->sync_file_index].ist_index + map->sync_stream_index]; ist->discard = 0; } } for (i = 0; i < o->nb_attachments; i++) { AVIOContext *pb; uint8_t *attachment; const char *p; int64_t len; if ((err = avio_open2(&pb, o->attachments[i], AVIO_FLAG_READ, &int_cb, NULL)) < 0) { av_log(NULL, AV_LOG_FATAL, "Could not open attachment file %s.\n", o->attachments[i]); exit_program(1); } if ((len = avio_size(pb)) <= 0) { av_log(NULL, AV_LOG_FATAL, "Could not get size of the attachment %s.\n", o->attachments[i]); exit_program(1); } if (!(attachment = av_malloc(len))) { av_log(NULL, AV_LOG_FATAL, "Attachment %s too large to fit into memory.\n", o->attachments[i]); exit_program(1); } avio_read(pb, attachment, len); ost = new_attachment_stream(o, oc); ost->stream_copy = 0; ost->source_index = -1; ost->attachment_filename = o->attachments[i]; ost->st->codec->extradata = attachment; ost->st->codec->extradata_size = len; p = strrchr(o->attachments[i], '/'); av_dict_set(&ost->st->metadata, "filename", (p && *p) ? p + 1 : o->attachments[i], AV_DICT_DONT_OVERWRITE); avio_close(pb); } output_files = grow_array(output_files, sizeof(*output_files), &nb_output_files, nb_output_files + 1); output_files[nb_output_files - 1].ctx = oc; output_files[nb_output_files - 1].ost_index = nb_output_streams - oc->nb_streams; output_files[nb_output_files - 1].recording_time = o->recording_time; output_files[nb_output_files - 1].start_time = o->start_time; output_files[nb_output_files - 1].limit_filesize = o->limit_filesize; av_dict_copy(&output_files[nb_output_files - 1].opts, format_opts, 0); if (oc->oformat->flags & AVFMT_NEEDNUMBER) { if (!av_filename_number_test(oc->filename)) { print_error(oc->filename, AVERROR(EINVAL)); exit_program(1); } } if (!(oc->oformat->flags & AVFMT_NOFILE)) { assert_file_overwrite(filename); if ((err = avio_open2(&oc->pb, filename, AVIO_FLAG_WRITE, &oc->interrupt_callback, &output_files[nb_output_files - 1].opts)) < 0) { print_error(filename, err); exit_program(1); } } if (o->mux_preload) { uint8_t buf[64]; snprintf(buf, sizeof(buf), "%d", (int)(o->mux_preload*AV_TIME_BASE)); av_dict_set(&output_files[nb_output_files - 1].opts, "preload", buf, 0); } oc->max_delay = (int)(o->mux_max_delay * AV_TIME_BASE); oc->flags |= AVFMT_FLAG_NONBLOCK; for (i = 0; i < o->nb_metadata_map; i++) { char *p; int in_file_index = strtol(o->metadata_map[i].u.str, &p, 0); if (in_file_index < 0) continue; if (in_file_index >= nb_input_files) { av_log(NULL, AV_LOG_FATAL, "Invalid input file index %d while processing metadata maps\n", in_file_index); exit_program(1); } copy_metadata(o->metadata_map[i].specifier, *p ? p + 1 : p, oc, input_files[in_file_index].ctx, o); } if (o->chapters_input_file >= nb_input_files) { if (o->chapters_input_file == INT_MAX) { o->chapters_input_file = -1; for (i = 0; i < nb_input_files; i++) if (input_files[i].ctx->nb_chapters) { o->chapters_input_file = i; break; } } else { av_log(NULL, AV_LOG_FATAL, "Invalid input file index %d in chapter mapping.\n", o->chapters_input_file); exit_program(1); } } if (o->chapters_input_file >= 0) copy_chapters(&input_files[o->chapters_input_file], &output_files[nb_output_files - 1], !o->metadata_chapters_manual); if (!o->metadata_global_manual && nb_input_files) av_dict_copy(&oc->metadata, input_files[0].ctx->metadata, AV_DICT_DONT_OVERWRITE); if (!o->metadata_streams_manual) for (i = output_files[nb_output_files - 1].ost_index; i < nb_output_streams; i++) { InputStream *ist; if (output_streams[i].source_index < 0) continue; ist = &input_streams[output_streams[i].source_index]; av_dict_copy(&output_streams[i].st->metadata, ist->st->metadata, AV_DICT_DONT_OVERWRITE); } for (i = 0; i < o->nb_metadata; i++) { AVDictionary **m; char type, *val; const char *stream_spec; int index = 0, j, ret; val = strchr(o->metadata[i].u.str, '='); if (!val) { av_log(NULL, AV_LOG_FATAL, "No '=' character in metadata string %s.\n", o->metadata[i].u.str); exit_program(1); } *val++ = 0; parse_meta_type(o->metadata[i].specifier, &type, &index, &stream_spec); if (type == 's') { for (j = 0; j < oc->nb_streams; j++) { if ((ret = check_stream_specifier(oc, oc->streams[j], stream_spec)) > 0) { av_dict_set(&oc->streams[j]->metadata, o->metadata[i].u.str, *val ? val : NULL, 0); } else if (ret < 0) exit_program(1); } printf("ret %d, stream_spec %s\n", ret, stream_spec); } else { switch (type) { case 'g': m = &oc->metadata; break; case 'c': if (index < 0 || index >= oc->nb_chapters) { av_log(NULL, AV_LOG_FATAL, "Invalid chapter index %d in metadata specifier.\n", index); exit_program(1); } m = &oc->chapters[index]->metadata; break; default: av_log(NULL, AV_LOG_FATAL, "Invalid metadata specifier %s.\n", o->metadata[i].specifier); exit_program(1); } av_dict_set(m, o->metadata[i].u.str, *val ? val : NULL, 0); } } reset_options(o); } avconv.c:3614: error: Null Dereference pointer `oc` last assigned on line 3593 could be null and is dereferenced at line 3614, column 5. avconv.c:3581:1: start of procedure opt_output_file() 3579. } 3580. 3581. static void opt_output_file(void *optctx, const char *filename) ^ 3582. { 3583. OptionsContext *o = optctx; avconv.c:3583:5: 3581. static void opt_output_file(void *optctx, const char *filename) 3582. { 3583. OptionsContext *o = optctx; ^ 3584. AVFormatContext *oc; 3585. int i, err; avconv.c:3590:10: Taking true branch 3588. InputStream *ist; 3589. 3590. if (!strcmp(filename, "-")) ^ 3591. filename = "pipe:"; 3592. avconv.c:3591:9: 3589. 3590. if (!strcmp(filename, "-")) 3591. filename = "pipe:"; ^ 3592. 3593. oc = avformat_alloc_context(); avconv.c:3593:5: 3591. filename = "pipe:"; 3592. 3593. oc = avformat_alloc_context(); ^ 3594. if (!oc) { 3595. print_error(filename, AVERROR(ENOMEM)); libavformat/options.c:141:1: start of procedure avformat_alloc_context() 139. } 140. 141. AVFormatContext *avformat_alloc_context(void) ^ 142. { 143. AVFormatContext *ic; libavformat/options.c:144:5: 142. { 143. AVFormatContext *ic; 144. ic = av_malloc(sizeof(AVFormatContext)); ^ 145. if (!ic) return ic; 146. avformat_get_context_defaults(ic); libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(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) libavformat/options.c:145:10: Taking true branch 143. AVFormatContext *ic; 144. ic = av_malloc(sizeof(AVFormatContext)); 145. if (!ic) return ic; ^ 146. avformat_get_context_defaults(ic); 147. return ic; libavformat/options.c:145:14: 143. AVFormatContext *ic; 144. ic = av_malloc(sizeof(AVFormatContext)); 145. if (!ic) return ic; ^ 146. avformat_get_context_defaults(ic); 147. return ic; libavformat/options.c:148:1: return from a call to avformat_alloc_context 146. avformat_get_context_defaults(ic); 147. return ic; 148. } ^ 149. 150. const AVClass *avformat_get_class(void) avconv.c:3594:10: Taking true branch 3592. 3593. oc = avformat_alloc_context(); 3594. if (!oc) { ^ 3595. print_error(filename, AVERROR(ENOMEM)); 3596. exit_program(1); avconv.c:3595:9: 3593. oc = avformat_alloc_context(); 3594. if (!oc) { 3595. print_error(filename, AVERROR(ENOMEM)); ^ 3596. exit_program(1); 3597. } cmdutils.c:436:1: start of procedure print_error() 434. } 435. 436. void print_error(const char *filename, int err) ^ 437. { 438. char errbuf[128]; cmdutils.c:439:5: 437. { 438. char errbuf[128]; 439. const char *errbuf_ptr = errbuf; ^ 440. 441. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) cmdutils.c:441:9: Taking true branch 439. const char *errbuf_ptr = errbuf; 440. 441. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) ^ 442. errbuf_ptr = strerror(AVUNERROR(err)); 443. av_log(NULL, AV_LOG_ERROR, "%s: %s\n", filename, errbuf_ptr); cmdutils.c:442:9: Skipping strerror(): method has no implementation 440. 441. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) 442. errbuf_ptr = strerror(AVUNERROR(err)); ^ 443. av_log(NULL, AV_LOG_ERROR, "%s: %s\n", filename, errbuf_ptr); 444. } cmdutils.c:443:5: Skipping av_log(): empty list of specs 441. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) 442. errbuf_ptr = strerror(AVUNERROR(err)); 443. av_log(NULL, AV_LOG_ERROR, "%s: %s\n", filename, errbuf_ptr); ^ 444. } 445. cmdutils.c:444:1: return from a call to print_error 442. errbuf_ptr = strerror(AVUNERROR(err)); 443. av_log(NULL, AV_LOG_ERROR, "%s: %s\n", filename, errbuf_ptr); 444. } ^ 445. 446. static int warned_cfg = 0; avconv.c:3596:9: Skipping exit_program(): empty list of specs 3594. if (!oc) { 3595. print_error(filename, AVERROR(ENOMEM)); 3596. exit_program(1); ^ 3597. } 3598. avconv.c:3599:9: Taking true branch 3597. } 3598. 3599. if (o->format) { ^ 3600. file_oformat = av_guess_format(o->format, NULL, NULL); 3601. if (!file_oformat) { avconv.c:3600:9: Skipping av_guess_format(): empty list of specs 3598. 3599. if (o->format) { 3600. file_oformat = av_guess_format(o->format, NULL, NULL); ^ 3601. if (!file_oformat) { 3602. av_log(NULL, AV_LOG_FATAL, "Requested output format '%s' is not a suitable output format\n", o->format); avconv.c:3601:14: Taking false branch 3599. if (o->format) { 3600. file_oformat = av_guess_format(o->format, NULL, NULL); 3601. if (!file_oformat) { ^ 3602. av_log(NULL, AV_LOG_FATAL, "Requested output format '%s' is not a suitable output format\n", o->format); 3603. exit_program(1); avconv.c:3614:5: 3612. } 3613. 3614. oc->oformat = file_oformat; ^ 3615. oc->interrupt_callback = int_cb; 3616. av_strlcpy(oc->filename, filename, sizeof(oc->filename));
https://github.com/libav/libav/blob/4bf3c8f226252e18de8051fd0d417c1d39857b67/avconv.c/#L3614
d2a_code_trace_data_41863
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dh/dh_check.c:165: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_exp`. Showing all 21 steps of the trace crypto/dh/dh_check.c:152:5: Call 150. if (ctx == NULL) 151. goto err; 152. BN_CTX_start(ctx); ^ 153. tmp = BN_CTX_get(ctx); 154. if (tmp == NULL || !BN_set_word(tmp, 1)) crypto/bn/bn_ctx.c:235:1: Parameter `ctx->stack.depth` 233. } 234. 235. > void BN_CTX_start(BN_CTX *ctx) 236. { 237. CTXDBG_ENTRY("BN_CTX_start", ctx); 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 `ctx->stack.depth` 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:255:15: Call 253. #ifdef RECP_MUL_MOD 254. { 255. ret = BN_mod_exp_recp(r, a, p, m, ctx); ^ 256. } 257. #else crypto/bn/bn_exp.c:267:1: Parameter `ctx->stack.depth` 265. } 266. 267. > int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 268. const BIGNUM *m, BN_CTX *ctx) 269. { crypto/bn/bn_exp.c:295:5: Call 293. } 294. 295. BN_CTX_start(ctx); ^ 296. aa = BN_CTX_get(ctx); 297. val[0] = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:235:1: Parameter `ctx->stack.depth` 233. } 234. 235. > void BN_CTX_start(BN_CTX *ctx) 236. { 237. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_exp.c:314:10: Call 312. } 313. 314. if (!BN_nnmod(val[0], a, m, ctx)) ^ 315. goto err; /* 1 */ 316. if (BN_is_zero(val[0])) { crypto/bn/bn_mod.c:118:1: Parameter `ctx->stack.depth` 116. #include "bn_lcl.h" 117. 118. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 119. { 120. /* crypto/bn/bn_mod.c:125:11: Call 123. */ 124. 125. if (!(BN_mod(r, m, d, ctx))) ^ 126. return 0; 127. if (!r->neg) crypto/bn/bn_div.c:241:5: Call 239. } 240. 241. BN_CTX_start(ctx); ^ 242. tmp = BN_CTX_get(ctx); 243. snum = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:235:1: Parameter `*ctx->stack.indexes` 233. } 234. 235. > void BN_CTX_start(BN_CTX *ctx) 236. { 237. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:468:5: Call 466. if (no_branch) 467. bn_correct_top(res); 468. BN_CTX_end(ctx); ^ 469. return (1); 470. err: crypto/bn/bn_ctx.c:249:1: Parameter `*ctx->stack.indexes` 247. } 248. 249. > void BN_CTX_end(BN_CTX *ctx) 250. { 251. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:255:27: Call 253. ctx->err_stack--; 254. else { 255. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 256. /* Does this stack frame have anything to release? */ 257. if (fp < ctx->used) crypto/bn/bn_ctx.c:325:1: <Offset trace> 323. } 324. 325. > static unsigned int BN_STACK_pop(BN_STACK *st) 326. { 327. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:325:1: Parameter `st->depth` 323. } 324. 325. > static unsigned int BN_STACK_pop(BN_STACK *st) 326. { 327. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:325:1: <Length trace> 323. } 324. 325. > static unsigned int BN_STACK_pop(BN_STACK *st) 326. { 327. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:325:1: Parameter `*st->indexes` 323. } 324. 325. > static unsigned int BN_STACK_pop(BN_STACK *st) 326. { 327. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:327:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_exp` 325. static unsigned int BN_STACK_pop(BN_STACK *st) 326. { 327. return st->indexes[--(st->depth)]; ^ 328. } 329.
https://github.com/openssl/openssl/blob/c10d1bc81cb047cbd53f8cc430632b6a4a70252d/crypto/bn/bn_ctx.c/#L327
d2a_code_trace_data_41864
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; } tmp = OPENSSL_malloc(inlen); if (tmp == NULL) return 0; if (!EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, &outl, in + inlen - 2 * blocklen, blocklen * 2) || !EVP_DecryptUpdate(ctx, tmp, &outl, tmp + inlen - blocklen, blocklen) || !EVP_DecryptUpdate(ctx, tmp, &outl, in, inlen - blocklen) || !EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, NULL) || !EVP_DecryptUpdate(ctx, tmp, &outl, tmp, inlen)) goto err; if (((tmp[1] ^ tmp[4]) & (tmp[2] ^ tmp[5]) & (tmp[3] ^ tmp[6])) != 0xff) { goto err; } if (inlen < (size_t)(tmp[0] - 4)) { goto err; } *outlen = (size_t)tmp[0]; memcpy(out, tmp + 4, *outlen); rv = 1; err: OPENSSL_clear_free(tmp, inlen); return rv; } crypto/cms/cms_smime.c:763: error: BUFFER_OVERRUN_L3 Offset added: [4, +oo] (⇐ 4 + [0, +oo]) Size: [1, +oo] by call to `CMS_RecipientInfo_decrypt`. Showing all 16 steps of the trace crypto/cms/cms_smime.c:763:13: Call 761. continue; 762. CMS_RecipientInfo_set0_password(ri, pass, passlen); 763. r = CMS_RecipientInfo_decrypt(cms, ri); ^ 764. CMS_RecipientInfo_set0_password(ri, NULL, 0); 765. if (r > 0) crypto/cms/cms_env.c:782:1: Parameter `ri->d.pwri->encryptedKey->length` 780. } 781. 782. > int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri) 783. { 784. switch (ri->type) { crypto/cms/cms_smime.c:763:13: Call 761. continue; 762. CMS_RecipientInfo_set0_password(ri, pass, passlen); 763. r = CMS_RecipientInfo_decrypt(cms, ri); ^ 764. CMS_RecipientInfo_set0_password(ri, NULL, 0); 765. if (r > 0) crypto/cms/cms_env.c:782:1: Parameter `ri->d.pwri->encryptedKey->length` 780. } 781. 782. > int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri) 783. { 784. switch (ri->type) { crypto/cms/cms_env.c:792:16: Call 790. 791. case CMS_RECIPINFO_PASS: 792. return cms_RecipientInfo_pwri_crypt(cms, ri, 0); ^ 793. 794. default: crypto/cms/cms_pwri.c:320:1: Parameter `ri->d.pwri->encryptedKey->length` 318. /* Encrypt/Decrypt content key in PWRI recipient info */ 319. 320. > int cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri, 321. int en_de) 322. { crypto/cms/cms_pwri.c:409:14: Call 407. goto err; 408. } 409. if (!kek_unwrap_key(key, &keylen, ^ 410. pwri->encryptedKey->data, 411. pwri->encryptedKey->length, kekctx)) { crypto/cms/cms_pwri.c:221:1: <Offset trace> 219. */ 220. 221. > static int kek_unwrap_key(unsigned char *out, size_t *outlen, 222. const unsigned char *in, size_t inlen, 223. EVP_CIPHER_CTX *ctx) crypto/cms/cms_pwri.c:221:1: Parameter `inlen` 219. */ 220. 221. > static int kek_unwrap_key(unsigned char *out, size_t *outlen, 222. const unsigned char *in, size_t inlen, 223. EVP_CIPHER_CTX *ctx) crypto/cms/cms_pwri.c:266:5: Assignment 264. goto err; 265. } 266. *outlen = (size_t)tmp[0]; ^ 267. memcpy(out, tmp + 4, *outlen); 268. rv = 1; crypto/cms/cms_pwri.c:221:1: <Length trace> 219. */ 220. 221. > static int kek_unwrap_key(unsigned char *out, size_t *outlen, 222. const unsigned char *in, size_t inlen, 223. EVP_CIPHER_CTX *ctx) crypto/cms/cms_pwri.c:221:1: Parameter `inlen` 219. */ 220. 221. > static int kek_unwrap_key(unsigned char *out, size_t *outlen, 222. const unsigned char *in, size_t inlen, 223. EVP_CIPHER_CTX *ctx) crypto/cms/cms_pwri.c:236:11: Call 234. return 0; 235. } 236. tmp = OPENSSL_malloc(inlen); ^ 237. if (tmp == NULL) 238. return 0; crypto/mem.c:125:9: Assignment 123. 124. if (num <= 0) 125. return NULL; ^ 126. 127. allow_customize = 0; crypto/cms/cms_pwri.c:236:5: Assignment 234. return 0; 235. } 236. tmp = OPENSSL_malloc(inlen); ^ 237. if (tmp == NULL) 238. return 0; crypto/cms/cms_pwri.c:267:5: Array access: Offset added: [4, +oo] (⇐ 4 + [0, +oo]) Size: [1, +oo] by call to `CMS_RecipientInfo_decrypt` 265. } 266. *outlen = (size_t)tmp[0]; 267. memcpy(out, tmp + 4, *outlen); ^ 268. rv = 1; 269. err:
https://github.com/openssl/openssl/blob/846ec07d904f9cc81d486db0db14fb84f61ff6e5/crypto/cms/cms_pwri.c/#L267
d2a_code_trace_data_41865
void *lh_delete(_LHASH *lh, const void *data) { unsigned long hash; LHASH_NODE *nn, **rn; void *ret; lh->error = 0; rn = getrn(lh, data, &hash); if (*rn == NULL) { lh->num_no_delete++; return (NULL); } else { nn = *rn; *rn = nn->next; ret = nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))) contract(lh); return (ret); } ssl/record/ssl3_record.c:1548: error: INTEGER_OVERFLOW_L2 ([0, max(0, `s->ctx->sessions->num_items`)] - 1):unsigned64 by call to `dtls1_process_record`. Showing all 15 steps of the trace ssl/record/ssl3_record.c:1382:1: Parameter `s->ctx->sessions->num_items` 1380. */ 1381. /* used only by dtls1_read_bytes */ 1382. > int dtls1_get_record(SSL *s) 1383. { 1384. int ssl_major, ssl_minor; ssl/record/ssl3_record.c:1398:9: Call 1396. * This is a non-blocking operation. 1397. */ 1398. if (dtls1_process_buffered_records(s) < 0) ^ 1399. return -1; 1400. ssl/record/rec_layer_d1.c:353:1: Parameter `s->ctx->sessions->num_items` 351. 352. 353. > int dtls1_process_buffered_records(SSL *s) 354. { 355. pitem *item; ssl/record/ssl3_record.c:1548:10: Call 1546. } 1547. 1548. if (!dtls1_process_record(s)) { ^ 1549. rr->length = 0; 1550. RECORD_LAYER_reset_packet_length(&s->rlayer); /* dump this record */ ssl/record/ssl3_record.c:1199:1: Parameter `s->ctx->sessions->num_items` 1197. } 1198. 1199. > int dtls1_process_record(SSL *s) 1200. { 1201. int i, al; ssl/record/ssl3_record.c:1358:5: Call 1356. 1357. f_err: 1358. ssl3_send_alert(s, SSL3_AL_FATAL, al); ^ 1359. err: 1360. return (0); ssl/s3_msg.c:166:1: Parameter `s->ctx->sessions->num_items` 164. } 165. 166. > int ssl3_send_alert(SSL *s, int level, int desc) 167. { 168. /* Map tls/ssl alert value to correct one */ ssl/s3_msg.c:177:9: Call 175. /* If a fatal one, remove from cache */ 176. if ((level == SSL3_AL_FATAL) && (s->session != NULL)) 177. SSL_CTX_remove_session(s->ctx, s->session); ^ 178. 179. s->s3->alert_dispatch = 1; ssl/ssl_sess.c:675:1: Parameter `ctx->sessions->num_items` 673. } 674. 675. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 676. { 677. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:677:12: Call 675. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 676. { 677. return remove_session_lock(ctx, c, 1); ^ 678. } 679. ssl/ssl_sess.c:680:1: Parameter `ctx->sessions->num_items` 678. } 679. 680. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 681. { 682. SSL_SESSION *r; ssl/ssl_sess.c:690:17: Call 688. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 689. ret = 1; 690. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 691. SSL_SESSION_list_remove(ctx, c); 692. } crypto/lhash/lhash.c:211:1: <LHS trace> 209. } 210. 211. > void *lh_delete(_LHASH *lh, const void *data) 212. { 213. unsigned long hash; crypto/lhash/lhash.c:211:1: Parameter `lh->num_items` 209. } 210. 211. > void *lh_delete(_LHASH *lh, const void *data) 212. { 213. unsigned long hash; crypto/lhash/lhash.c:231:5: Binary operation: ([0, max(0, s->ctx->sessions->num_items)] - 1):unsigned64 by call to `dtls1_process_record` 229. } 230. 231. lh->num_items--; ^ 232. if ((lh->num_nodes > MIN_NODES) && 233. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
https://github.com/openssl/openssl/blob/747e16398d704a667cc99f8a0b1912c36b7de52d/crypto/lhash/lhash.c/#L231
d2a_code_trace_data_41866
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_both.c:372: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `ssl3_send_alert`. Showing all 13 steps of the trace ssl/s3_both.c:264:1: Parameter `s->ctx->sessions->p` 262. * the body is read in state 'stn'. 263. */ 264. > long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok) 265. { 266. unsigned char *p; ssl/s3_both.c:372:2: Call 370. return s->init_num; 371. f_err: 372. ssl3_send_alert(s,SSL3_AL_FATAL,al); ^ 373. err: 374. *ok=0; ssl/s3_pkt.c:1142:1: Parameter `s->ctx->sessions->p` 1140. } 1141. 1142. > void ssl3_send_alert(SSL *s, int level, int desc) 1143. { 1144. /* Map tls/ssl alert value to correct one */ ssl/s3_pkt.c:1149:3: Call 1147. /* If a fatal one, remove from cache */ 1148. if ((level == 2) && (s->session != NULL)) 1149. SSL_CTX_remove_session(s->ctx,s->session); ^ 1150. 1151. s->s3->alert_dispatch=1; ssl/ssl_sess.c:413:1: Parameter `ctx->sessions->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 `ssl3_send_alert` 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_41867
void fcrypt_body(DES_LONG *out, des_key_schedule ks, DES_LONG Eswap0, DES_LONG Eswap1) { register DES_LONG l,r,t,u; #ifdef DES_PTR register const unsigned char *des_SP=(const unsigned char *)des_SPtrans; #endif register DES_LONG *s; register int j; register DES_LONG E0,E1; l=0; r=0; s=(DES_LONG *)ks; E0=Eswap0; E1=Eswap1; for (j=0; j<25; j++) { #ifdef DES_UNROLL register int i; for (i=0; i<32; i+=8) { D_ENCRYPT(l,r,i+0); D_ENCRYPT(r,l,i+2); D_ENCRYPT(l,r,i+4); D_ENCRYPT(r,l,i+6); } #else D_ENCRYPT(l,r, 0); D_ENCRYPT(r,l, 2); D_ENCRYPT(l,r, 4); D_ENCRYPT(r,l, 6); D_ENCRYPT(l,r, 8); D_ENCRYPT(r,l,10); D_ENCRYPT(l,r,12); D_ENCRYPT(r,l,14); D_ENCRYPT(l,r,16); D_ENCRYPT(r,l,18); D_ENCRYPT(l,r,20); D_ENCRYPT(r,l,22); D_ENCRYPT(l,r,24); D_ENCRYPT(r,l,26); D_ENCRYPT(l,r,28); D_ENCRYPT(r,l,30); #endif t=l; l=r; r=t; } l=ROTATE(l,3)&0xffffffffL; r=ROTATE(r,3)&0xffffffffL; PERM_OP(l,r,t, 1,0x55555555L); PERM_OP(r,l,t, 8,0x00ff00ffL); PERM_OP(l,r,t, 2,0x33333333L); PERM_OP(r,l,t,16,0x0000ffffL); PERM_OP(l,r,t, 4,0x0f0f0f0fL); out[0]=r; out[1]=l; } crypto/des/fcrypt.c:155: error: BUFFER_OVERRUN_L1 Offset: 31 Size: 16 by call to `fcrypt_body`. Showing all 6 steps of the trace crypto/des/fcrypt.c:110:1: Array declaration 108. 109. 110. > char *des_fcrypt(const char *buf, const char *salt, char *ret) 111. { 112. unsigned int i,j,x,y; crypto/des/fcrypt.c:155:2: Call 153. 154. des_set_key_unchecked(&key,ks); 155. fcrypt_body(&(out[0]),ks,Eswap0,Eswap1); ^ 156. 157. ll=out[0]; l2c(ll,b); crypto/des/fcrypt_b.c:80:1: <Length trace> 78. (a)=(a)^(t)^(t>>(16-(n))))\ 79. 80. > void fcrypt_body(DES_LONG *out, des_key_schedule ks, DES_LONG Eswap0, 81. DES_LONG Eswap1) 82. { crypto/des/fcrypt_b.c:80:1: Parameter `*ks` 78. (a)=(a)^(t)^(t>>(16-(n))))\ 79. 80. > void fcrypt_body(DES_LONG *out, des_key_schedule ks, DES_LONG Eswap0, 81. DES_LONG Eswap1) 82. { crypto/des/fcrypt_b.c:94:2: Assignment 92. r=0; 93. 94. s=(DES_LONG *)ks; ^ 95. E0=Eswap0; 96. E1=Eswap1; crypto/des/fcrypt_b.c:126:3: Array access: Offset: 31 Size: 16 by call to `fcrypt_body` 124. D_ENCRYPT(r,l,26); /* 14 */ 125. D_ENCRYPT(l,r,28); /* 15 */ 126. D_ENCRYPT(r,l,30); /* 16 */ ^ 127. #endif 128.
https://github.com/openssl/openssl/blob/97025c5fc03976c3d1b7e40551fdf1f7ca87edca/crypto/des/fcrypt_b.c/#L126
d2a_code_trace_data_41868
static void new_data_stream(AVFormatContext *oc, int file_idx) { AVStream *st; AVOutputStream *ost; AVCodec *codec=NULL; AVCodecContext *data_enc; st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); if (!st) { fprintf(stderr, "Could not alloc stream\n"); ffmpeg_exit(1); } ost = new_output_stream(oc, file_idx); data_enc = st->codec; output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); if (!data_stream_copy) { fprintf(stderr, "Data stream encoding not supported yet (only streamcopy)\n"); ffmpeg_exit(1); } avcodec_get_context_defaults3(st->codec, codec); data_enc->codec_type = AVMEDIA_TYPE_DATA; if (data_codec_tag) data_enc->codec_tag= data_codec_tag; if (oc->oformat->flags & AVFMT_GLOBALHEADER) { data_enc->flags |= CODEC_FLAG_GLOBAL_HEADER; avcodec_opts[AVMEDIA_TYPE_DATA]->flags |= CODEC_FLAG_GLOBAL_HEADER; } if (data_stream_copy) { st->stream_copy = 1; } data_disable = 0; av_freep(&data_codec_name); data_stream_copy = 0; } ffmpeg.c:3650: error: Null Dereference pointer `st` last assigned on line 3644 could be null and is dereferenced at line 3650, column 16. ffmpeg.c:3637:1: start of procedure new_data_stream() 3635. } 3636. 3637. static void new_data_stream(AVFormatContext *oc, int file_idx) ^ 3638. { 3639. AVStream *st; ffmpeg.c:3641:5: 3639. AVStream *st; 3640. AVOutputStream *ost; 3641. AVCodec *codec=NULL; ^ 3642. AVCodecContext *data_enc; 3643. ffmpeg.c:3644:28: Condition is true 3642. AVCodecContext *data_enc; 3643. 3644. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); ^ 3645. if (!st) { 3646. fprintf(stderr, "Could not alloc stream\n"); ffmpeg.c:3644:5: 3642. AVCodecContext *data_enc; 3643. 3644. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); ^ 3645. if (!st) { 3646. fprintf(stderr, "Could not alloc stream\n"); libavformat/utils.c:2588:1: start of procedure av_new_stream() 2586. } 2587. 2588. AVStream *av_new_stream(AVFormatContext *s, int id) ^ 2589. { 2590. AVStream *st; libavformat/utils.c:2594:9: Taking true branch 2592. AVStream **streams; 2593. 2594. if (s->nb_streams >= INT_MAX/sizeof(*streams)) ^ 2595. return NULL; 2596. streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams)); libavformat/utils.c:2595:9: 2593. 2594. if (s->nb_streams >= INT_MAX/sizeof(*streams)) 2595. return NULL; ^ 2596. streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams)); 2597. if (!streams) libavformat/utils.c:2637:1: return from a call to av_new_stream 2635. s->streams[s->nb_streams++] = st; 2636. return st; 2637. } ^ 2638. 2639. AVProgram *av_new_program(AVFormatContext *ac, int id) ffmpeg.c:3645:10: Taking true branch 3643. 3644. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); 3645. if (!st) { ^ 3646. fprintf(stderr, "Could not alloc stream\n"); 3647. ffmpeg_exit(1); ffmpeg.c:3646:9: 3644. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); 3645. if (!st) { 3646. fprintf(stderr, "Could not alloc stream\n"); ^ 3647. ffmpeg_exit(1); 3648. } ffmpeg.c:3647:9: Skipping ffmpeg_exit(): empty list of specs 3645. if (!st) { 3646. fprintf(stderr, "Could not alloc stream\n"); 3647. ffmpeg_exit(1); ^ 3648. } 3649. ost = new_output_stream(oc, file_idx); ffmpeg.c:3649:5: Skipping new_output_stream(): empty list of specs 3647. ffmpeg_exit(1); 3648. } 3649. ost = new_output_stream(oc, file_idx); ^ 3650. data_enc = st->codec; 3651. output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); ffmpeg.c:3650:5: 3648. } 3649. ost = new_output_stream(oc, file_idx); 3650. data_enc = st->codec; ^ 3651. output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); 3652. if (!data_stream_copy) {
https://github.com/libav/libav/blob/41e21e4db623ebd77f431a6f30cf21d62d9e1f33/ffmpeg.c/#L3650
d2a_code_trace_data_41869
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/wavpack.c:313: error: Integer Overflow L2 (32 - [0, max(63, `bc->bits_left`)]):unsigned32 by call to `bitstream_read`. libavcodec/wavpack.c:291:1: Parameter `bc->bits_left` 289. } 290. 291. static int wv_get_value(WavpackFrameContext *ctx, BitstreamContext *bc, ^ 292. int channel, int *last) 293. { libavcodec/wavpack.c:309:17: Call 307. } 308. } else { 309. t = get_unary_0_33(bc); ^ 310. if (t >= 2) { 311. if (bitstream_bits_left(bc) < t - 1) libavcodec/unary.h:47:1: Parameter `bc->bits_left` 45. * @return Unary length/index 46. */ 47. static inline int get_unary_0_33(BitstreamContext *bc) ^ 48. { 49. return get_unary(bc, 0, 33); libavcodec/unary.h:49:12: Call 47. static inline int get_unary_0_33(BitstreamContext *bc) 48. { 49. return get_unary(bc, 0, 33); ^ 50. } 51. libavcodec/unary.h:33:1: Parameter `bc->bits_left` 31. * @return Unary length/index 32. */ 33. static inline int get_unary(BitstreamContext *bc, int stop, int len) ^ 34. { 35. int i; libavcodec/wavpack.c:313:21: Call 311. if (bitstream_bits_left(bc) < t - 1) 312. goto error; 313. t = bitstream_read(bc, t - 1) | (1 << (t - 1)); ^ 314. } else { 315. if (bitstream_bits_left(bc) < 0) libavcodec/bitstream.h:183:1: Parameter `n` 181. 182. /* Return n bits from the buffer. n has to be in the 0-32 range. */ 183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n) ^ 184. { 185. if (!n) libavcodec/bitstream.h:189:9: Call 187. 188. if (n > bc->bits_left) { 189. refill_32(bc); ^ 190. if (bc->bits_left < 32) 191. bc->bits_left = n; libavcodec/bitstream.h:60:1: <RHS trace> 58. } 59. 60. static inline void refill_32(BitstreamContext *bc) ^ 61. { 62. if (bc->ptr >= bc->buffer_end) libavcodec/bitstream.h:60:1: Parameter `bc->bits_left` 58. } 59. 60. static inline void refill_32(BitstreamContext *bc) ^ 61. { 62. if (bc->ptr >= bc->buffer_end) libavcodec/bitstream.h:68:5: Binary operation: (32 - [0, max(63, bc->bits_left)]):unsigned32 by call to `bitstream_read` 66. bc->bits = (uint64_t)AV_RL32(bc->ptr) << bc->bits_left | bc->bits; 67. #else 68. bc->bits = bc->bits | (uint64_t)AV_RB32(bc->ptr) << (32 - bc->bits_left); ^ 69. #endif 70. bc->ptr += 4;
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L68
d2a_code_trace_data_41870
PUT_HEVC_QPEL_HV(2, 1) libavcodec/hevcdsp_template.c:983: error: Buffer Overrun L3 Offset: [-64, +oo] (⇐ [0, +oo] + [-64, -61]) Size: 4544 by call to `put_hevc_qpel_h2v1_9`. libavcodec/hevcdsp_template.c:983:1: Call 981. QPEL(12) 982. QPEL(8) 983. QPEL(4) ^ 984. 985. static inline void FUNC(put_hevc_epel_pixels)(int16_t *dst, ptrdiff_t dststride, libavcodec/hevcdsp_template.c:904:1: <Offset trace> 902. PUT_HEVC_QPEL_HV(1, 2) 903. PUT_HEVC_QPEL_HV(1, 3) 904. PUT_HEVC_QPEL_HV(2, 1) ^ 905. PUT_HEVC_QPEL_HV(2, 2) 906. PUT_HEVC_QPEL_HV(2, 3) libavcodec/hevcdsp_template.c:904:1: Assignment 902. PUT_HEVC_QPEL_HV(1, 2) 903. PUT_HEVC_QPEL_HV(1, 3) 904. PUT_HEVC_QPEL_HV(2, 1) ^ 905. PUT_HEVC_QPEL_HV(2, 2) 906. PUT_HEVC_QPEL_HV(2, 3) libavcodec/hevcdsp_template.c:904:1: <Length trace> 902. PUT_HEVC_QPEL_HV(1, 2) 903. PUT_HEVC_QPEL_HV(1, 3) 904. PUT_HEVC_QPEL_HV(2, 1) ^ 905. PUT_HEVC_QPEL_HV(2, 2) 906. PUT_HEVC_QPEL_HV(2, 3) libavcodec/hevcdsp_template.c:904:1: Array declaration 902. PUT_HEVC_QPEL_HV(1, 2) 903. PUT_HEVC_QPEL_HV(1, 3) 904. PUT_HEVC_QPEL_HV(2, 1) ^ 905. PUT_HEVC_QPEL_HV(2, 2) 906. PUT_HEVC_QPEL_HV(2, 3) libavcodec/hevcdsp_template.c:904:1: Assignment 902. PUT_HEVC_QPEL_HV(1, 2) 903. PUT_HEVC_QPEL_HV(1, 3) 904. PUT_HEVC_QPEL_HV(2, 1) ^ 905. PUT_HEVC_QPEL_HV(2, 2) 906. PUT_HEVC_QPEL_HV(2, 3) libavcodec/hevcdsp_template.c:904:1: Array access: Offset: [-64, +oo] (⇐ [0, +oo] + [-64, -61]) Size: 4544 by call to `put_hevc_qpel_h2v1_9` 902. PUT_HEVC_QPEL_HV(1, 2) 903. PUT_HEVC_QPEL_HV(1, 3) 904. PUT_HEVC_QPEL_HV(2, 1) ^ 905. PUT_HEVC_QPEL_HV(2, 2) 906. PUT_HEVC_QPEL_HV(2, 3)
https://github.com/libav/libav/blob/688417399c69aadd4c287bdb0dec82ef8799011c/libavcodec/hevcdsp_template.c/#L904
d2a_code_trace_data_41871
static int build_chain(X509_STORE_CTX *ctx) { SSL_DANE *dane = ctx->dane; int num = sk_X509_num(ctx->chain); X509 *cert = sk_X509_value(ctx->chain, num - 1); int ss = cert_self_signed(cert); STACK_OF(X509) *sktmp = NULL; unsigned int search; int may_trusted = 0; int may_alternate = 0; int trust = X509_TRUST_UNTRUSTED; int alt_untrusted = 0; int depth; int ok = 0; int i; OPENSSL_assert(num == 1 && ctx->num_untrusted == num); #define S_DOUNTRUSTED (1 << 0) #define S_DOTRUSTED (1 << 1) #define S_DOALTERNATE (1 << 2) search = (ctx->untrusted != NULL) ? S_DOUNTRUSTED : 0; if (DANETLS_HAS_PKIX(dane) || !DANETLS_HAS_DANE(dane)) { if (search == 0 || ctx->param->flags & X509_V_FLAG_TRUSTED_FIRST) search |= S_DOTRUSTED; else if (!(ctx->param->flags & X509_V_FLAG_NO_ALT_CHAINS)) may_alternate = 1; may_trusted = 1; } if (ctx->untrusted && (sktmp = sk_X509_dup(ctx->untrusted)) == NULL) { X509err(X509_F_BUILD_CHAIN, ERR_R_MALLOC_FAILURE); ctx->error = X509_V_ERR_OUT_OF_MEM; return 0; } if (DANETLS_ENABLED(dane) && dane->certs != NULL) { if (sktmp == NULL && (sktmp = sk_X509_new_null()) == NULL) { X509err(X509_F_BUILD_CHAIN, ERR_R_MALLOC_FAILURE); ctx->error = X509_V_ERR_OUT_OF_MEM; return 0; } for (i = 0; i < sk_X509_num(dane->certs); ++i) { if (!sk_X509_push(sktmp, sk_X509_value(dane->certs, i))) { sk_X509_free(sktmp); X509err(X509_F_BUILD_CHAIN, ERR_R_MALLOC_FAILURE); ctx->error = X509_V_ERR_OUT_OF_MEM; return 0; } } } if (ctx->param->depth > INT_MAX/2) ctx->param->depth = INT_MAX/2; depth = ctx->param->depth + 1; while (search != 0) { X509 *x; X509 *xtmp = NULL; if ((search & S_DOTRUSTED) != 0) { i = num = sk_X509_num(ctx->chain); if ((search & S_DOALTERNATE) != 0) { i = alt_untrusted; } x = sk_X509_value(ctx->chain, i-1); ok = (depth < num) ? 0 : get_issuer(&xtmp, ctx, x); if (ok < 0) { trust = X509_TRUST_REJECTED; ctx->error = X509_V_ERR_STORE_LOOKUP; search = 0; continue; } if (ok > 0) { if ((search & S_DOALTERNATE) != 0) { OPENSSL_assert(num > i && i > 0 && ss == 0); search &= ~S_DOALTERNATE; for (; num > i; --num) X509_free(sk_X509_pop(ctx->chain)); ctx->num_untrusted = num; if (DANETLS_ENABLED(dane) && dane->mdpth >= ctx->num_untrusted) { dane->mdpth = -1; X509_free(dane->mcert); dane->mcert = NULL; } if (DANETLS_ENABLED(dane) && dane->pdpth >= ctx->num_untrusted) dane->pdpth = -1; } if (ss == 0) { if (!sk_X509_push(ctx->chain, x = xtmp)) { X509_free(xtmp); X509err(X509_F_BUILD_CHAIN, ERR_R_MALLOC_FAILURE); trust = X509_TRUST_REJECTED; ctx->error = X509_V_ERR_OUT_OF_MEM; search = 0; continue; } ss = cert_self_signed(x); } else if (num == ctx->num_untrusted) { if (X509_cmp(x, xtmp) != 0) { X509_free(xtmp); ok = 0; } else { X509_free(x); ctx->num_untrusted = --num; (void) sk_X509_set(ctx->chain, num, x = xtmp); } } if (ok) { OPENSSL_assert(ctx->num_untrusted <= num); search &= ~S_DOUNTRUSTED; switch (trust = check_trust(ctx, num)) { case X509_TRUST_TRUSTED: case X509_TRUST_REJECTED: search = 0; continue; } if (ss == 0) continue; } } if ((search & S_DOUNTRUSTED) == 0) { if ((search & S_DOALTERNATE) != 0 && --alt_untrusted > 0) continue; if (!may_alternate || (search & S_DOALTERNATE) != 0 || ctx->num_untrusted < 2) break; search |= S_DOALTERNATE; alt_untrusted = ctx->num_untrusted - 1; ss = 0; } } if ((search & S_DOUNTRUSTED) != 0) { num = sk_X509_num(ctx->chain); OPENSSL_assert(num == ctx->num_untrusted); x = sk_X509_value(ctx->chain, num-1); xtmp = (ss || depth < num) ? NULL : find_issuer(ctx, sktmp, x); if (xtmp == NULL) { search &= ~S_DOUNTRUSTED; if (may_trusted) search |= S_DOTRUSTED; continue; } (void) sk_X509_delete_ptr(sktmp, xtmp); if (!sk_X509_push(ctx->chain, xtmp)) { X509err(X509_F_BUILD_CHAIN, ERR_R_MALLOC_FAILURE); trust = X509_TRUST_REJECTED; ctx->error = X509_V_ERR_OUT_OF_MEM; search = 0; continue; } X509_up_ref(x = xtmp); ++ctx->num_untrusted; ss = cert_self_signed(xtmp); switch (trust = check_dane_issuer(ctx, ctx->num_untrusted - 1)) { case X509_TRUST_TRUSTED: case X509_TRUST_REJECTED: search = 0; continue; } } } sk_X509_free(sktmp); num = sk_X509_num(ctx->chain); if (num <= depth) { if (trust == X509_TRUST_UNTRUSTED && DANETLS_HAS_DANE_TA(dane)) trust = check_dane_pkeys(ctx); if (trust == X509_TRUST_UNTRUSTED && num == ctx->num_untrusted) trust = check_trust(ctx, num); } switch (trust) { case X509_TRUST_TRUSTED: return 1; case X509_TRUST_REJECTED: return 0; case X509_TRUST_UNTRUSTED: default: num = sk_X509_num(ctx->chain); if (num > depth) return verify_cb_cert(ctx, NULL, num-1, X509_V_ERR_CERT_CHAIN_TOO_LONG); if (DANETLS_ENABLED(dane) && (!DANETLS_HAS_PKIX(dane) || dane->pdpth >= 0)) return verify_cb_cert(ctx, NULL, num-1, X509_V_ERR_DANE_NO_MATCH); if (ss && sk_X509_num(ctx->chain) == 1) return verify_cb_cert(ctx, NULL, num-1, X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT); if (ss) return verify_cb_cert(ctx, NULL, num-1, X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN); if (ctx->num_untrusted < num) return verify_cb_cert(ctx, NULL, num-1, X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT); return verify_cb_cert(ctx, NULL, num-1, X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY); } } crypto/x509/x509_vfy.c:2817: error: NULL_DEREFERENCE pointer `cert` last assigned on line 2816 could be null and is dereferenced by call to `cert_self_signed()` at line 2817, column 14. Showing all 21 steps of the trace crypto/x509/x509_vfy.c:2812:1: start of procedure build_chain() 2810. } 2811. 2812. > static int build_chain(X509_STORE_CTX *ctx) 2813. { 2814. SSL_DANE *dane = ctx->dane; crypto/x509/x509_vfy.c:2814:5: 2812. static int build_chain(X509_STORE_CTX *ctx) 2813. { 2814. > SSL_DANE *dane = ctx->dane; 2815. int num = sk_X509_num(ctx->chain); 2816. X509 *cert = sk_X509_value(ctx->chain, num - 1); crypto/x509/x509_vfy.c:2815:5: 2813. { 2814. SSL_DANE *dane = ctx->dane; 2815. > int num = sk_X509_num(ctx->chain); 2816. X509 *cert = sk_X509_value(ctx->chain, num - 1); 2817. int ss = cert_self_signed(cert); include/openssl/x509.h:98:1: start of procedure sk_X509_num() 96. typedef struct x509_cinf_st X509_CINF; 97. 98. > DEFINE_STACK_OF(X509) 99. 100. /* This is used for a table of trust checking functions */ crypto/stack/stack.c:265:1: start of procedure OPENSSL_sk_num() 263. } 264. 265. > int OPENSSL_sk_num(const OPENSSL_STACK *st) 266. { 267. if (st == NULL) crypto/stack/stack.c:267:9: Taking true branch 265. int OPENSSL_sk_num(const OPENSSL_STACK *st) 266. { 267. if (st == NULL) ^ 268. return -1; 269. return st->num; crypto/stack/stack.c:268:9: 266. { 267. if (st == NULL) 268. > return -1; 269. return st->num; 270. } crypto/stack/stack.c:270:1: return from a call to OPENSSL_sk_num 268. return -1; 269. return st->num; 270. > } 271. 272. void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i) include/openssl/x509.h:98:1: return from a call to sk_X509_num 96. typedef struct x509_cinf_st X509_CINF; 97. 98. > DEFINE_STACK_OF(X509) 99. 100. /* This is used for a table of trust checking functions */ crypto/x509/x509_vfy.c:2816:5: 2814. SSL_DANE *dane = ctx->dane; 2815. int num = sk_X509_num(ctx->chain); 2816. > X509 *cert = sk_X509_value(ctx->chain, num - 1); 2817. int ss = cert_self_signed(cert); 2818. STACK_OF(X509) *sktmp = NULL; include/openssl/x509.h:98:1: start of procedure sk_X509_value() 96. typedef struct x509_cinf_st X509_CINF; 97. 98. > DEFINE_STACK_OF(X509) 99. 100. /* This is used for a table of trust checking functions */ crypto/stack/stack.c:272:1: start of procedure OPENSSL_sk_value() 270. } 271. 272. > void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i) 273. { 274. if (st == NULL || i < 0 || i >= st->num) crypto/stack/stack.c:274:9: Taking true branch 272. void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i) 273. { 274. if (st == NULL || i < 0 || i >= st->num) ^ 275. return NULL; 276. return st->data[i]; crypto/stack/stack.c:275:9: 273. { 274. if (st == NULL || i < 0 || i >= st->num) 275. > return NULL; 276. return st->data[i]; 277. } crypto/stack/stack.c:277:1: return from a call to OPENSSL_sk_value 275. return NULL; 276. return st->data[i]; 277. > } 278. 279. void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, void *value) include/openssl/x509.h:98:1: return from a call to sk_X509_value 96. typedef struct x509_cinf_st X509_CINF; 97. 98. > DEFINE_STACK_OF(X509) 99. 100. /* This is used for a table of trust checking functions */ crypto/x509/x509_vfy.c:2817:5: 2815. int num = sk_X509_num(ctx->chain); 2816. X509 *cert = sk_X509_value(ctx->chain, num - 1); 2817. > int ss = cert_self_signed(cert); 2818. STACK_OF(X509) *sktmp = NULL; 2819. unsigned int search; crypto/x509/x509_vfy.c:108:1: start of procedure cert_self_signed() 106. 107. /* Return 1 is a certificate is self signed */ 108. > static int cert_self_signed(X509 *x) 109. { 110. /* crypto/x509/x509_vfy.c:115:5: 113. * parse errors, rather than memory pressure! 114. */ 115. > X509_check_purpose(x, -1, 0); 116. if (x->ex_flags & EXFLAG_SS) 117. return 1; crypto/x509v3/v3_purp.c:77:1: start of procedure X509_check_purpose() 75. * things. 76. */ 77. > int X509_check_purpose(X509 *x, int id, int ca) 78. { 79. int idx; crypto/x509v3/v3_purp.c:81:11: 79. int idx; 80. const X509_PURPOSE *pt; 81. > if (!(x->ex_flags & EXFLAG_SET)) { 82. CRYPTO_THREAD_write_lock(x->lock); 83. x509v3_cache_extensions(x);
https://github.com/openssl/openssl/blob/3307000d9852acac98ebc1b82cacc9b14240d798/crypto/x509/x509_vfy.c/#L2817
d2a_code_trace_data_41872
char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) { const X509_NAME_ENTRY *ne; int i; int n, lold, l, l1, l2, num, j, type; const char *s; char *p; unsigned char *q; BUF_MEM *b = NULL; static const char hex[17] = "0123456789ABCDEF"; int gs_doit[4]; char tmp_buf[80]; #ifdef CHARSET_EBCDIC unsigned char ebcdic_buf[1024]; #endif if (buf == NULL) { if ((b = BUF_MEM_new()) == NULL) goto err; if (!BUF_MEM_grow(b, 200)) goto err; b->data[0] = '\0'; len = 200; } else if (len == 0) { return NULL; } if (a == NULL) { if (b) { buf = b->data; OPENSSL_free(b); } strncpy(buf, "NO X509_NAME", len); buf[len - 1] = '\0'; return buf; } len--; l = 0; for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { ne = sk_X509_NAME_ENTRY_value(a->entries, i); n = OBJ_obj2nid(ne->object); if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) { i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object); s = tmp_buf; } l1 = strlen(s); type = ne->value->type; num = ne->value->length; if (num > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } q = ne->value->data; #ifdef CHARSET_EBCDIC if (type == V_ASN1_GENERALSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_PRINTABLESTRING || type == V_ASN1_TELETEXSTRING || type == V_ASN1_IA5STRING) { if (num > (int)sizeof(ebcdic_buf)) num = sizeof(ebcdic_buf); ascii2ebcdic(ebcdic_buf, q, num); q = ebcdic_buf; } #endif if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) { gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0; for (j = 0; j < num; j++) if (q[j] != 0) gs_doit[j & 3] = 1; if (gs_doit[0] | gs_doit[1] | gs_doit[2]) gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; else { gs_doit[0] = gs_doit[1] = gs_doit[2] = 0; gs_doit[3] = 1; } } else gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; for (l2 = j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; l2++; #ifndef CHARSET_EBCDIC if ((q[j] < ' ') || (q[j] > '~')) l2 += 3; #else if ((os_toascii[q[j]] < os_toascii[' ']) || (os_toascii[q[j]] > os_toascii['~'])) l2 += 3; #endif } lold = l; l += 1 + l1 + 1 + l2; if (l > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } if (b != NULL) { if (!BUF_MEM_grow(b, l + 1)) goto err; p = &(b->data[lold]); } else if (l > len) { break; } else p = &(buf[lold]); *(p++) = '/'; memcpy(p, s, (unsigned int)l1); p += l1; *(p++) = '='; #ifndef CHARSET_EBCDIC q = ne->value->data; #endif for (j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; #ifndef CHARSET_EBCDIC n = q[j]; if ((n < ' ') || (n > '~')) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = n; #else n = os_toascii[q[j]]; if ((n < os_toascii[' ']) || (n > os_toascii['~'])) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = q[j]; #endif } *p = '\0'; } if (b != NULL) { p = b->data; OPENSSL_free(b); } else p = buf; if (i == 0) *p = '\0'; return (p); err: X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE); end: BUF_MEM_free(b); return (NULL); } test/ssltest_old.c:2962: error: BUFFER_OVERRUN_L3 Offset added: [200, 256] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace test/ssltest_old.c:2962:17: Call 2960. (void *)ctx, (void *)c); 2961. if (c) 2962. s = X509_NAME_oneline(X509_get_subject_name(c), buf, 256); ^ 2963. if (s != NULL) { 2964. printf("cert depth=%d %s\n", crypto/x509/x509_obj.c:25:1: <Offset trace> 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: Parameter `len` 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: <Length trace> 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: Parameter `*buf` 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:56:9: Array access: Offset added: [200, 256] Size: [1, 2147483644] by call to `X509_NAME_oneline` 54. OPENSSL_free(b); 55. } 56. strncpy(buf, "NO X509_NAME", len); ^ 57. buf[len - 1] = '\0'; 58. return buf;
https://github.com/openssl/openssl/blob/cdb2a60347f988037d29adc7e4415e9c66c8a5a5/crypto/x509/x509_obj.c/#L56
d2a_code_trace_data_41873
void gf_mul(gf_s * RESTRICT cs, const gf as, const gf bs) { const uint32_t *a = as->limb, *b = bs->limb; uint32_t *c = cs->limb; uint64_t accum0 = 0, accum1 = 0, accum2 = 0; uint32_t mask = (1 << 28) - 1; uint32_t aa[8], bb[8]; int i, j; for (i = 0; i < 8; i++) { aa[i] = a[i] + a[i + 8]; bb[i] = b[i] + b[i + 8]; } FOR_LIMB(j, 0, 8, { accum2 = 0; FOR_LIMB(i, 0, j + 1, { accum2 += widemul(a[j - i], b[i]); accum1 += widemul(aa[j - i], bb[i]); accum0 += widemul(a[8 + j - i], b[8 + i]); } ); accum1 -= accum2; accum0 += accum2; accum2 = 0; FOR_LIMB(i, j + 1, 8, { accum0 -= widemul(a[8 + j - i], b[i]); accum2 += widemul(aa[8 + j - i], bb[i]); accum1 += widemul(a[16 + j - i], b[8 + i]); } ); accum1 += accum2; accum0 += accum2; c[j] = ((uint32_t)(accum0)) & mask; c[j + 8] = ((uint32_t)(accum1)) & mask; accum0 >>= 28; accum1 >>= 28; }); accum0 += accum1; accum0 += c[8]; accum1 += c[0]; c[8] = ((uint32_t)(accum0)) & mask; c[0] = ((uint32_t)(accum1)) & mask; accum0 >>= 28; accum1 >>= 28; c[9] += ((uint32_t)(accum0)); c[1] += ((uint32_t)(accum1)); } crypto/ec/curve448/arch_32/f_impl.c:37: error: UNINITIALIZED_VALUE The value read from bb[_] was never initialized. Showing all 1 steps of the trace crypto/ec/curve448/arch_32/f_impl.c:37:5: 35. } 36. 37. > FOR_LIMB(j, 0, 8, { 38. accum2 = 0; 39. FOR_LIMB(i, 0, j + 1, {
https://github.com/openssl/openssl/blob/0cdcdacc337005e08a906b2e07d4e44e3ee48138/crypto/ec/curve448/arch_32/f_impl.c/#L37
d2a_code_trace_data_41874
int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, size_t len, size_t *written) { int i; SSL3_BUFFER *wb = s->rlayer.wbuf; size_t currbuf = 0; size_t tmpwrit = 0; if ((s->rlayer.wpend_tot > len) || ((s->rlayer.wpend_buf != buf) && !(s->mode & SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER)) || (s->rlayer.wpend_type != type)) { SSLerr(SSL_F_SSL3_WRITE_PENDING, SSL_R_BAD_WRITE_RETRY); return -1; } for (;;) { if (SSL3_BUFFER_get_left(&wb[currbuf]) == 0 && currbuf < s->rlayer.numwpipes - 1) { currbuf++; continue; } clear_sys_error(); if (s->wbio != NULL) { s->rwstate = SSL_WRITING; i = BIO_write(s->wbio, (char *) &(SSL3_BUFFER_get_buf(&wb[currbuf]) [SSL3_BUFFER_get_offset(&wb[currbuf])]), (unsigned int)SSL3_BUFFER_get_left(&wb[currbuf])); if (i >= 0) tmpwrit = i; } else { SSLerr(SSL_F_SSL3_WRITE_PENDING, SSL_R_BIO_NOT_SET); i = -1; } if (i > 0 && tmpwrit == SSL3_BUFFER_get_left(&wb[currbuf])) { SSL3_BUFFER_set_left(&wb[currbuf], 0); SSL3_BUFFER_add_offset(&wb[currbuf], tmpwrit); if (currbuf + 1 < s->rlayer.numwpipes) continue; s->rwstate = SSL_NOTHING; *written = s->rlayer.wpend_ret; return 1; } else if (i <= 0) { if (SSL_IS_DTLS(s)) { SSL3_BUFFER_set_left(&wb[currbuf], 0); } return (i); } SSL3_BUFFER_add_offset(&wb[currbuf], tmpwrit); SSL3_BUFFER_sub_left(&wb[currbuf], tmpwrit); } } ssl/record/rec_layer_d1.c:400: error: INTEGER_OVERFLOW_L2 ([0, max(1, `s->rlayer.numwpipes`)] - 1):unsigned64 by call to `dtls1_handle_timeout`. Showing all 17 steps of the trace ssl/record/rec_layer_d1.c:331:1: Parameter `s->rlayer.numwpipes` 329. * none of our business 330. */ 331. > int dtls1_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf, 332. size_t len, int peek, size_t *readbytes) 333. { ssl/record/rec_layer_d1.c:400:9: Call 398. 399. /* Check for timeout */ 400. if (dtls1_handle_timeout(s) > 0) ^ 401. goto start; 402. ssl/d1_lib.c:369:1: Parameter `s->rlayer.numwpipes` 367. } 368. 369. > int dtls1_handle_timeout(SSL *s) 370. { 371. /* if no timer is expired, don't do anything */ ssl/d1_lib.c:387:12: Call 385. 386. dtls1_start_timer(s); 387. return dtls1_retransmit_buffered_messages(s); ^ 388. } 389. ssl/statem/statem_dtls.c:958:1: Parameter `s->rlayer.numwpipes` 956. } 957. 958. > int dtls1_retransmit_buffered_messages(SSL *s) 959. { 960. pqueue *sent = s->d1->sent_messages; ssl/statem/statem_dtls.c:970:13: Call 968. for (item = pqueue_next(&iter); item != NULL; item = pqueue_next(&iter)) { 969. frag = (hm_fragment *)item->data; 970. if (dtls1_retransmit_message(s, (unsigned short) ^ 971. dtls1_get_queue_priority 972. (frag->msg_header.seq, ssl/statem/statem_dtls.c:1047:1: Parameter `s->rlayer.numwpipes` 1045. } 1046. 1047. > int dtls1_retransmit_message(SSL *s, unsigned short seq, int *found) 1048. { 1049. int ret; ssl/statem/statem_dtls.c:1104:11: Call 1102. saved_retransmit_state.epoch); 1103. 1104. ret = dtls1_do_write(s, frag->msg_header.is_ccs ? ^ 1105. SSL3_RT_CHANGE_CIPHER_SPEC : SSL3_RT_HANDSHAKE); 1106. ssl/statem/statem_dtls.c:109:1: Parameter `s->rlayer.numwpipes` 107. * SSL3_RT_CHANGE_CIPHER_SPEC) 108. */ 109. > int dtls1_do_write(SSL *s, int type) 110. { 111. int ret; ssl/statem/statem_dtls.c:239:15: Call 237. } 238. 239. ret = dtls1_write_bytes(s, type, &s->init_buf->data[s->init_off], len, ^ 240. &written); 241. if (ret < 0) { ssl/record/rec_layer_d1.c:730:1: Parameter `s->rlayer.numwpipes` 728. * not all data has been sent or non-blocking IO. 729. */ 730. > int dtls1_write_bytes(SSL *s, int type, const void *buf, size_t len, 731. size_t *written) 732. { ssl/record/rec_layer_d1.c:740:9: Call 738. } 739. s->rwstate = SSL_NOTHING; 740. i = do_dtls1_write(s, type, buf, len, 0, written); ^ 741. return i; 742. } ssl/record/rec_layer_d1.c:744:1: Parameter `s->rlayer.numwpipes` 742. } 743. 744. > int do_dtls1_write(SSL *s, int type, const unsigned char *buf, 745. size_t len, int create_empty_fragment, size_t *written) 746. { ssl/record/rec_layer_d1.c:936:12: Call 934. 935. /* we now just need to write the buffer */ 936. return ssl3_write_pending(s, type, buf, len, written); ^ 937. err: 938. return -1; ssl/record/rec_layer_s3.c:1058:1: <LHS trace> 1056. * Return values are as per SSL_write() 1057. */ 1058. > int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, size_t len, 1059. size_t *written) 1060. { ssl/record/rec_layer_s3.c:1058:1: Parameter `s->rlayer.numwpipes` 1056. * Return values are as per SSL_write() 1057. */ 1058. > int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, size_t len, 1059. size_t *written) 1060. { ssl/record/rec_layer_s3.c:1077:16: Binary operation: ([0, max(1, s->rlayer.numwpipes)] - 1):unsigned64 by call to `dtls1_handle_timeout` 1075. /* Loop until we find a buffer we haven't written out yet */ 1076. if (SSL3_BUFFER_get_left(&wb[currbuf]) == 0 1077. && currbuf < s->rlayer.numwpipes - 1) { ^ 1078. currbuf++; 1079. continue;
https://github.com/openssl/openssl/blob/7f7eb90b8ac55997c5c825bb3ebcfe28611e06f5/ssl/record/rec_layer_s3.c/#L1077
d2a_code_trace_data_41875
static int parse_ffconfig(const char *filename) { FILE *f; char line[1024]; char cmd[64]; char arg[1024]; const char *p; int val, errors, line_num; FFStream **last_stream, *stream, *redirect; FFStream **last_feed, *feed; AVCodecContext audio_enc, video_enc; int audio_id, video_id; f = fopen(filename, "r"); if (!f) { perror(filename); return -1; } errors = 0; line_num = 0; first_stream = NULL; last_stream = &first_stream; first_feed = NULL; last_feed = &first_feed; stream = NULL; feed = NULL; redirect = NULL; audio_id = CODEC_ID_NONE; video_id = CODEC_ID_NONE; for(;;) { if (fgets(line, sizeof(line), f) == NULL) break; line_num++; p = line; while (isspace(*p)) p++; if (*p == '\0' || *p == '#') continue; get_arg(cmd, sizeof(cmd), &p); if (!strcasecmp(cmd, "Port")) { get_arg(arg, sizeof(arg), &p); val = atoi(arg); if (val < 1 || val > 65536) { fprintf(stderr, "%s:%d: Invalid port: %s\n", filename, line_num, arg); errors++; } my_http_addr.sin_port = htons(val); } else if (!strcasecmp(cmd, "BindAddress")) { get_arg(arg, sizeof(arg), &p); if (resolve_host(&my_http_addr.sin_addr, arg) != 0) { fprintf(stderr, "%s:%d: Invalid host/IP address: %s\n", filename, line_num, arg); errors++; } } else if (!strcasecmp(cmd, "NoDaemon")) { ffserver_daemon = 0; } else if (!strcasecmp(cmd, "RTSPPort")) { get_arg(arg, sizeof(arg), &p); val = atoi(arg); if (val < 1 || val > 65536) { fprintf(stderr, "%s:%d: Invalid port: %s\n", filename, line_num, arg); errors++; } my_rtsp_addr.sin_port = htons(atoi(arg)); } else if (!strcasecmp(cmd, "RTSPBindAddress")) { get_arg(arg, sizeof(arg), &p); if (resolve_host(&my_rtsp_addr.sin_addr, arg) != 0) { fprintf(stderr, "%s:%d: Invalid host/IP address: %s\n", filename, line_num, arg); errors++; } } else if (!strcasecmp(cmd, "MaxClients")) { get_arg(arg, sizeof(arg), &p); val = atoi(arg); if (val < 1 || val > HTTP_MAX_CONNECTIONS) { fprintf(stderr, "%s:%d: Invalid MaxClients: %s\n", filename, line_num, arg); errors++; } else { nb_max_connections = val; } } else if (!strcasecmp(cmd, "MaxBandwidth")) { get_arg(arg, sizeof(arg), &p); val = atoi(arg); if (val < 10 || val > 100000) { fprintf(stderr, "%s:%d: Invalid MaxBandwidth: %s\n", filename, line_num, arg); errors++; } else max_bandwidth = val; } else if (!strcasecmp(cmd, "CustomLog")) { get_arg(logfilename, sizeof(logfilename), &p); } else if (!strcasecmp(cmd, "<Feed")) { char *q; if (stream || feed) { fprintf(stderr, "%s:%d: Already in a tag\n", filename, line_num); } else { feed = av_mallocz(sizeof(FFStream)); *last_stream = feed; last_stream = &feed->next; *last_feed = feed; last_feed = &feed->next_feed; get_arg(feed->filename, sizeof(feed->filename), &p); q = strrchr(feed->filename, '>'); if (*q) *q = '\0'; feed->fmt = guess_format("ffm", NULL, NULL); snprintf(feed->feed_filename, sizeof(feed->feed_filename), "/tmp/%s.ffm", feed->filename); feed->feed_max_size = 5 * 1024 * 1024; feed->is_feed = 1; feed->feed = feed; } } else if (!strcasecmp(cmd, "Launch")) { if (feed) { int i; feed->child_argv = av_mallocz(64 * sizeof(char *)); for (i = 0; i < 62; i++) { get_arg(arg, sizeof(arg), &p); if (!arg[0]) break; feed->child_argv[i] = av_strdup(arg); } feed->child_argv[i] = av_malloc(30 + strlen(feed->filename)); snprintf(feed->child_argv[i], 30+strlen(feed->filename), "http://%s:%d/%s", (my_http_addr.sin_addr.s_addr == INADDR_ANY) ? "127.0.0.1" : inet_ntoa(my_http_addr.sin_addr), ntohs(my_http_addr.sin_port), feed->filename); if (ffserver_debug) { int j; fprintf(stdout, "Launch commandline: "); for (j = 0; j <= i; j++) fprintf(stdout, "%s ", feed->child_argv[j]); fprintf(stdout, "\n"); } } } else if (!strcasecmp(cmd, "ReadOnlyFile")) { if (feed) { get_arg(feed->feed_filename, sizeof(feed->feed_filename), &p); feed->readonly = 1; } else if (stream) { get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p); } } else if (!strcasecmp(cmd, "File")) { if (feed) { get_arg(feed->feed_filename, sizeof(feed->feed_filename), &p); } else if (stream) get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p); } else if (!strcasecmp(cmd, "FileMaxSize")) { if (feed) { char *p1; double fsize; get_arg(arg, sizeof(arg), &p); p1 = arg; fsize = strtod(p1, &p1); switch(toupper(*p1)) { case 'K': fsize *= 1024; break; case 'M': fsize *= 1024 * 1024; break; case 'G': fsize *= 1024 * 1024 * 1024; break; } feed->feed_max_size = (int64_t)fsize; } } else if (!strcasecmp(cmd, "</Feed>")) { if (!feed) { fprintf(stderr, "%s:%d: No corresponding <Feed> for </Feed>\n", filename, line_num); errors++; } feed = NULL; } else if (!strcasecmp(cmd, "<Stream")) { char *q; if (stream || feed) { fprintf(stderr, "%s:%d: Already in a tag\n", filename, line_num); } else { stream = av_mallocz(sizeof(FFStream)); *last_stream = stream; last_stream = &stream->next; get_arg(stream->filename, sizeof(stream->filename), &p); q = strrchr(stream->filename, '>'); if (*q) *q = '\0'; stream->fmt = guess_stream_format(NULL, stream->filename, NULL); memset(&audio_enc, 0, sizeof(AVCodecContext)); memset(&video_enc, 0, sizeof(AVCodecContext)); audio_id = CODEC_ID_NONE; video_id = CODEC_ID_NONE; if (stream->fmt) { audio_id = stream->fmt->audio_codec; video_id = stream->fmt->video_codec; } } } else if (!strcasecmp(cmd, "Feed")) { get_arg(arg, sizeof(arg), &p); if (stream) { FFStream *sfeed; sfeed = first_feed; while (sfeed != NULL) { if (!strcmp(sfeed->filename, arg)) break; sfeed = sfeed->next_feed; } if (!sfeed) fprintf(stderr, "%s:%d: feed '%s' not defined\n", filename, line_num, arg); else stream->feed = sfeed; } } else if (!strcasecmp(cmd, "Format")) { get_arg(arg, sizeof(arg), &p); if (!strcmp(arg, "status")) { stream->stream_type = STREAM_TYPE_STATUS; stream->fmt = NULL; } else { stream->stream_type = STREAM_TYPE_LIVE; if (!strcmp(arg, "jpeg")) strcpy(arg, "mjpeg"); stream->fmt = guess_stream_format(arg, NULL, NULL); if (!stream->fmt) { fprintf(stderr, "%s:%d: Unknown Format: %s\n", filename, line_num, arg); errors++; } } if (stream->fmt) { audio_id = stream->fmt->audio_codec; video_id = stream->fmt->video_codec; } } else if (!strcasecmp(cmd, "InputFormat")) { get_arg(arg, sizeof(arg), &p); stream->ifmt = av_find_input_format(arg); if (!stream->ifmt) { fprintf(stderr, "%s:%d: Unknown input format: %s\n", filename, line_num, arg); } } else if (!strcasecmp(cmd, "FaviconURL")) { if (stream && stream->stream_type == STREAM_TYPE_STATUS) { get_arg(stream->feed_filename, sizeof(stream->feed_filename), &p); } else { fprintf(stderr, "%s:%d: FaviconURL only permitted for status streams\n", filename, line_num); errors++; } } else if (!strcasecmp(cmd, "Author")) { if (stream) get_arg(stream->author, sizeof(stream->author), &p); } else if (!strcasecmp(cmd, "Comment")) { if (stream) get_arg(stream->comment, sizeof(stream->comment), &p); } else if (!strcasecmp(cmd, "Copyright")) { if (stream) get_arg(stream->copyright, sizeof(stream->copyright), &p); } else if (!strcasecmp(cmd, "Title")) { if (stream) get_arg(stream->title, sizeof(stream->title), &p); } else if (!strcasecmp(cmd, "Preroll")) { get_arg(arg, sizeof(arg), &p); if (stream) stream->prebuffer = atof(arg) * 1000; } else if (!strcasecmp(cmd, "StartSendOnKey")) { if (stream) stream->send_on_key = 1; } else if (!strcasecmp(cmd, "AudioCodec")) { get_arg(arg, sizeof(arg), &p); audio_id = opt_audio_codec(arg); if (audio_id == CODEC_ID_NONE) { fprintf(stderr, "%s:%d: Unknown AudioCodec: %s\n", filename, line_num, arg); errors++; } } else if (!strcasecmp(cmd, "VideoCodec")) { get_arg(arg, sizeof(arg), &p); video_id = opt_video_codec(arg); if (video_id == CODEC_ID_NONE) { fprintf(stderr, "%s:%d: Unknown VideoCodec: %s\n", filename, line_num, arg); errors++; } } else if (!strcasecmp(cmd, "MaxTime")) { get_arg(arg, sizeof(arg), &p); if (stream) stream->max_time = atof(arg) * 1000; } else if (!strcasecmp(cmd, "AudioBitRate")) { get_arg(arg, sizeof(arg), &p); if (stream) audio_enc.bit_rate = atoi(arg) * 1000; } else if (!strcasecmp(cmd, "AudioChannels")) { get_arg(arg, sizeof(arg), &p); if (stream) audio_enc.channels = atoi(arg); } else if (!strcasecmp(cmd, "AudioSampleRate")) { get_arg(arg, sizeof(arg), &p); if (stream) audio_enc.sample_rate = atoi(arg); } else if (!strcasecmp(cmd, "AudioQuality")) { get_arg(arg, sizeof(arg), &p); if (stream) { } } else if (!strcasecmp(cmd, "VideoBitRateRange")) { if (stream) { int minrate, maxrate; get_arg(arg, sizeof(arg), &p); if (sscanf(arg, "%d-%d", &minrate, &maxrate) == 2) { video_enc.rc_min_rate = minrate * 1000; video_enc.rc_max_rate = maxrate * 1000; } else { fprintf(stderr, "%s:%d: Incorrect format for VideoBitRateRange -- should be <min>-<max>: %s\n", filename, line_num, arg); errors++; } } } else if (!strcasecmp(cmd, "Debug")) { if (stream) { get_arg(arg, sizeof(arg), &p); video_enc.debug = strtol(arg,0,0); } } else if (!strcasecmp(cmd, "Strict")) { if (stream) { get_arg(arg, sizeof(arg), &p); video_enc.strict_std_compliance = atoi(arg); } } else if (!strcasecmp(cmd, "VideoBufferSize")) { if (stream) { get_arg(arg, sizeof(arg), &p); video_enc.rc_buffer_size = atoi(arg) * 8*1024; } } else if (!strcasecmp(cmd, "VideoBitRateTolerance")) { if (stream) { get_arg(arg, sizeof(arg), &p); video_enc.bit_rate_tolerance = atoi(arg) * 1000; } } else if (!strcasecmp(cmd, "VideoBitRate")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.bit_rate = atoi(arg) * 1000; } } else if (!strcasecmp(cmd, "VideoSize")) { get_arg(arg, sizeof(arg), &p); if (stream) { av_parse_video_frame_size(&video_enc.width, &video_enc.height, arg); if ((video_enc.width % 16) != 0 || (video_enc.height % 16) != 0) { fprintf(stderr, "%s:%d: Image size must be a multiple of 16\n", filename, line_num); errors++; } } } else if (!strcasecmp(cmd, "VideoFrameRate")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.time_base.num= DEFAULT_FRAME_RATE_BASE; video_enc.time_base.den = (int)(strtod(arg, NULL) * video_enc.time_base.num); } } else if (!strcasecmp(cmd, "VideoGopSize")) { get_arg(arg, sizeof(arg), &p); if (stream) video_enc.gop_size = atoi(arg); } else if (!strcasecmp(cmd, "VideoIntraOnly")) { if (stream) video_enc.gop_size = 1; } else if (!strcasecmp(cmd, "VideoHighQuality")) { if (stream) video_enc.mb_decision = FF_MB_DECISION_BITS; } else if (!strcasecmp(cmd, "Video4MotionVector")) { if (stream) { video_enc.mb_decision = FF_MB_DECISION_BITS; video_enc.flags |= CODEC_FLAG_4MV; } } else if (!strcasecmp(cmd, "VideoTag")) { get_arg(arg, sizeof(arg), &p); if ((strlen(arg) == 4) && stream) video_enc.codec_tag = ff_get_fourcc(arg); } else if (!strcasecmp(cmd, "BitExact")) { if (stream) video_enc.flags |= CODEC_FLAG_BITEXACT; } else if (!strcasecmp(cmd, "DctFastint")) { if (stream) video_enc.dct_algo = FF_DCT_FASTINT; } else if (!strcasecmp(cmd, "IdctSimple")) { if (stream) video_enc.idct_algo = FF_IDCT_SIMPLE; } else if (!strcasecmp(cmd, "Qscale")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.flags |= CODEC_FLAG_QSCALE; video_enc.global_quality = FF_QP2LAMBDA * atoi(arg); } } else if (!strcasecmp(cmd, "VideoQDiff")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.max_qdiff = atoi(arg); if (video_enc.max_qdiff < 1 || video_enc.max_qdiff > 31) { fprintf(stderr, "%s:%d: VideoQDiff out of range\n", filename, line_num); errors++; } } } else if (!strcasecmp(cmd, "VideoQMax")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.qmax = atoi(arg); if (video_enc.qmax < 1 || video_enc.qmax > 31) { fprintf(stderr, "%s:%d: VideoQMax out of range\n", filename, line_num); errors++; } } } else if (!strcasecmp(cmd, "VideoQMin")) { get_arg(arg, sizeof(arg), &p); if (stream) { video_enc.qmin = atoi(arg); if (video_enc.qmin < 1 || video_enc.qmin > 31) { fprintf(stderr, "%s:%d: VideoQMin out of range\n", filename, line_num); errors++; } } } else if (!strcasecmp(cmd, "LumaElim")) { get_arg(arg, sizeof(arg), &p); if (stream) video_enc.luma_elim_threshold = atoi(arg); } else if (!strcasecmp(cmd, "ChromaElim")) { get_arg(arg, sizeof(arg), &p); if (stream) video_enc.chroma_elim_threshold = atoi(arg); } else if (!strcasecmp(cmd, "LumiMask")) { get_arg(arg, sizeof(arg), &p); if (stream) video_enc.lumi_masking = atof(arg); } else if (!strcasecmp(cmd, "DarkMask")) { get_arg(arg, sizeof(arg), &p); if (stream) video_enc.dark_masking = atof(arg); } else if (!strcasecmp(cmd, "NoVideo")) { video_id = CODEC_ID_NONE; } else if (!strcasecmp(cmd, "NoAudio")) { audio_id = CODEC_ID_NONE; } else if (!strcasecmp(cmd, "ACL")) { IPAddressACL acl; get_arg(arg, sizeof(arg), &p); if (strcasecmp(arg, "allow") == 0) acl.action = IP_ALLOW; else if (strcasecmp(arg, "deny") == 0) acl.action = IP_DENY; else { fprintf(stderr, "%s:%d: ACL action '%s' is not ALLOW or DENY\n", filename, line_num, arg); errors++; } get_arg(arg, sizeof(arg), &p); if (resolve_host(&acl.first, arg) != 0) { fprintf(stderr, "%s:%d: ACL refers to invalid host or ip address '%s'\n", filename, line_num, arg); errors++; } else acl.last = acl.first; get_arg(arg, sizeof(arg), &p); if (arg[0]) { if (resolve_host(&acl.last, arg) != 0) { fprintf(stderr, "%s:%d: ACL refers to invalid host or ip address '%s'\n", filename, line_num, arg); errors++; } } if (!errors) { IPAddressACL *nacl = av_mallocz(sizeof(*nacl)); IPAddressACL **naclp = 0; acl.next = 0; *nacl = acl; if (stream) naclp = &stream->acl; else if (feed) naclp = &feed->acl; else { fprintf(stderr, "%s:%d: ACL found not in <stream> or <feed>\n", filename, line_num); errors++; } if (naclp) { while (*naclp) naclp = &(*naclp)->next; *naclp = nacl; } } } else if (!strcasecmp(cmd, "RTSPOption")) { get_arg(arg, sizeof(arg), &p); if (stream) { av_freep(&stream->rtsp_option); stream->rtsp_option = av_strdup(arg); } } else if (!strcasecmp(cmd, "MulticastAddress")) { get_arg(arg, sizeof(arg), &p); if (stream) { if (resolve_host(&stream->multicast_ip, arg) != 0) { fprintf(stderr, "%s:%d: Invalid host/IP address: %s\n", filename, line_num, arg); errors++; } stream->is_multicast = 1; stream->loop = 1; } } else if (!strcasecmp(cmd, "MulticastPort")) { get_arg(arg, sizeof(arg), &p); if (stream) stream->multicast_port = atoi(arg); } else if (!strcasecmp(cmd, "MulticastTTL")) { get_arg(arg, sizeof(arg), &p); if (stream) stream->multicast_ttl = atoi(arg); } else if (!strcasecmp(cmd, "NoLoop")) { if (stream) stream->loop = 0; } else if (!strcasecmp(cmd, "</Stream>")) { if (!stream) { fprintf(stderr, "%s:%d: No corresponding <Stream> for </Stream>\n", filename, line_num); errors++; } if (stream->feed && stream->fmt && strcmp(stream->fmt->name, "ffm") != 0) { if (audio_id != CODEC_ID_NONE) { audio_enc.codec_type = CODEC_TYPE_AUDIO; audio_enc.codec_id = audio_id; add_codec(stream, &audio_enc); } if (video_id != CODEC_ID_NONE) { video_enc.codec_type = CODEC_TYPE_VIDEO; video_enc.codec_id = video_id; add_codec(stream, &video_enc); } } stream = NULL; } else if (!strcasecmp(cmd, "<Redirect")) { char *q; if (stream || feed || redirect) { fprintf(stderr, "%s:%d: Already in a tag\n", filename, line_num); errors++; } else { redirect = av_mallocz(sizeof(FFStream)); *last_stream = redirect; last_stream = &redirect->next; get_arg(redirect->filename, sizeof(redirect->filename), &p); q = strrchr(redirect->filename, '>'); if (*q) *q = '\0'; redirect->stream_type = STREAM_TYPE_REDIRECT; } } else if (!strcasecmp(cmd, "URL")) { if (redirect) get_arg(redirect->feed_filename, sizeof(redirect->feed_filename), &p); } else if (!strcasecmp(cmd, "</Redirect>")) { if (!redirect) { fprintf(stderr, "%s:%d: No corresponding <Redirect> for </Redirect>\n", filename, line_num); errors++; } if (!redirect->feed_filename[0]) { fprintf(stderr, "%s:%d: No URL found for <Redirect>\n", filename, line_num); errors++; } redirect = NULL; } else if (!strcasecmp(cmd, "LoadModule")) { get_arg(arg, sizeof(arg), &p); #ifdef HAVE_DLOPEN load_module(arg); #else fprintf(stderr, "%s:%d: Module support not compiled into this version: '%s'\n", filename, line_num, arg); errors++; #endif } else { fprintf(stderr, "%s:%d: Incorrect keyword: '%s'\n", filename, line_num, cmd); errors++; } } fclose(f); if (errors) return -1; else return 0; } ffserver.c:4093: error: Uninitialized Value The value read from video_enc.flags was never initialized. ffserver.c:4093:17: 4091. get_arg(arg, sizeof(arg), &p); 4092. if (stream) { 4093. video_enc.flags |= CODEC_FLAG_QSCALE; ^ 4094. video_enc.global_quality = FF_QP2LAMBDA * atoi(arg); 4095. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/ffserver.c/#L4093
d2a_code_trace_data_41876
unsigned char *next_protos_parse(size_t *outlen, const char *in) { size_t len; unsigned char *out; size_t i, start = 0; len = strlen(in); if (len >= 65535) return NULL; out = app_malloc(strlen(in) + 1, "NPN buffer"); for (i = 0; i <= len; ++i) { if (i == len || in[i] == ',') { if (i - start > 255) { OPENSSL_free(out); return NULL; } out[start] = i - start; start = i + 1; } else { out[i + 1] = in[i]; } } *outlen = len + 1; return out; } apps/s_server.c:1624: error: BUFFER_OVERRUN_L3 Offset: [1, 65535] Size: [1, +oo] by call to `next_protos_parse`. Showing all 17 steps of the trace apps/s_server.c:1592:18: Call 1590. } 1591. 1592. s_cert = load_cert(s_cert_file, s_cert_format, ^ 1593. "server certificate file"); 1594. apps/apps.c:626:9: Call 624. if (format == FORMAT_HTTP) { 625. #if !defined(OPENSSL_NO_OCSP) && !defined(OPENSSL_NO_SOCK) 626. load_cert_crl_http(file, &x, NULL); ^ 627. #endif 628. return x; apps/apps.c:578:10: Call 576. OCSP_REQ_CTX *rctx = NULL; 577. int use_ssl, rv = 0; 578. if (!OCSP_parse_url(url, &host, &port, &path, &use_ssl)) ^ 579. goto err; 580. if (use_ssl) { crypto/ocsp/ocsp_lib.c:139:5: Assignment 137. goto parse_err; 138. 139. *(p++) = '\0'; ^ 140. 141. if (strcmp(buf, "http") == 0) { apps/s_server.c:1624:27: Call 1622. #if !defined(OPENSSL_NO_NEXTPROTONEG) 1623. if (next_proto_neg_in) { 1624. next_proto.data = next_protos_parse(&next_proto.len, next_proto_neg_in); ^ 1625. if (next_proto.data == NULL) 1626. goto end; apps/apps.c:1919:10: <Offset trace> 1917. 1918. out = app_malloc(strlen(in) + 1, "NPN buffer"); 1919. for (i = 0; i <= len; ++i) { ^ 1920. if (i == len || in[i] == ',') { 1921. if (i - start > 255) { apps/apps.c:1919:10: Assignment 1917. 1918. out = app_malloc(strlen(in) + 1, "NPN buffer"); 1919. for (i = 0; i <= len; ++i) { ^ 1920. if (i == len || in[i] == ',') { 1921. if (i - start > 255) { apps/apps.c:1908:1: <Length trace> 1906. * returns: a malloc'd buffer or NULL on failure. 1907. */ 1908. > unsigned char *next_protos_parse(size_t *outlen, const char *in) 1909. { 1910. size_t len; apps/apps.c:1908:1: Parameter `in->strlen` 1906. * returns: a malloc'd buffer or NULL on failure. 1907. */ 1908. > unsigned char *next_protos_parse(size_t *outlen, const char *in) 1909. { 1910. size_t len; apps/apps.c:1918:11: Call 1916. return NULL; 1917. 1918. out = app_malloc(strlen(in) + 1, "NPN buffer"); ^ 1919. for (i = 0; i <= len; ++i) { 1920. if (i == len || in[i] == ',') { apps/apps.c:935:1: Parameter `sz` 933. } 934. 935. > void* app_malloc(int sz, const char *what) 936. { 937. void *vp = OPENSSL_malloc(sz); apps/apps.c:937:16: Call 935. void* app_malloc(int sz, const char *what) 936. { 937. void *vp = OPENSSL_malloc(sz); ^ 938. 939. if (vp == NULL) { crypto/mem.c:166:9: Assignment 164. 165. if (num == 0) 166. return NULL; ^ 167. 168. FAILTEST(); apps/apps.c:937:5: Assignment 935. void* app_malloc(int sz, const char *what) 936. { 937. void *vp = OPENSSL_malloc(sz); ^ 938. 939. if (vp == NULL) { apps/apps.c:945:5: Assignment 943. exit(1); 944. } 945. return vp; ^ 946. } 947. apps/apps.c:1918:5: Assignment 1916. return NULL; 1917. 1918. out = app_malloc(strlen(in) + 1, "NPN buffer"); ^ 1919. for (i = 0; i <= len; ++i) { 1920. if (i == len || in[i] == ',') { apps/apps.c:1928:13: Array access: Offset: [1, 65535] Size: [1, +oo] by call to `next_protos_parse` 1926. start = i + 1; 1927. } else { 1928. out[i + 1] = in[i]; ^ 1929. } 1930. }
https://github.com/openssl/openssl/blob/2234212c3dde887e0b7fa08277d035cd132e2cce/apps/apps.c/#L1928
d2a_code_trace_data_41877
AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask) { AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef)); *ret = *ref; if (ref->type == AVMEDIA_TYPE_VIDEO) { ret->video = av_malloc(sizeof(AVFilterBufferRefVideoProps)); *ret->video = *ref->video; } ret->perms &= pmask; ret->buf->refcount ++; return ret; } libavfilter/avfilter.c:54: error: Null Dereference pointer `ret->video` last assigned on line 53 could be null and is dereferenced at line 54, column 9. libavfilter/avfilter.c:48:1: start of procedure avfilter_ref_buffer() 46. #define link_spad(link) link->src->output_pads[link->srcpad] 47. 48. AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask) ^ 49. { 50. AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef)); libavfilter/avfilter.c:50:5: 48. AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask) 49. { 50. AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef)); ^ 51. *ret = *ref; 52. if (ref->type == AVMEDIA_TYPE_VIDEO) { libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(unsigned int size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(unsigned int size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-16) ) ^ 73. return NULL; 74. libavutil/mem.c:83:9: Taking false branch 81. ((char*)ptr)[-1]= diff; 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,16,size)) ^ 84. ptr = NULL; 85. #elif HAVE_MEMALIGN libavutil/mem.c:116:5: 114. ptr = malloc(size); 115. #endif 116. return ptr; ^ 117. } 118. libavutil/mem.c:117:1: return from a call to av_malloc 115. #endif 116. return ptr; 117. } ^ 118. 119. void *av_realloc(void *ptr, unsigned int size) libavfilter/avfilter.c:51:5: 49. { 50. AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef)); 51. *ret = *ref; ^ 52. if (ref->type == AVMEDIA_TYPE_VIDEO) { 53. ret->video = av_malloc(sizeof(AVFilterBufferRefVideoProps)); libavfilter/avfilter.c:52:9: Taking true branch 50. AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef)); 51. *ret = *ref; 52. if (ref->type == AVMEDIA_TYPE_VIDEO) { ^ 53. ret->video = av_malloc(sizeof(AVFilterBufferRefVideoProps)); 54. *ret->video = *ref->video; libavfilter/avfilter.c:53:9: 51. *ret = *ref; 52. if (ref->type == AVMEDIA_TYPE_VIDEO) { 53. ret->video = av_malloc(sizeof(AVFilterBufferRefVideoProps)); ^ 54. *ret->video = *ref->video; 55. } libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(unsigned int size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(unsigned int size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-16) ) ^ 73. return NULL; 74. libavutil/mem.c:83:9: Taking true branch 81. ((char*)ptr)[-1]= diff; 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,16,size)) ^ 84. ptr = NULL; 85. #elif HAVE_MEMALIGN libavutil/mem.c:84:9: 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,16,size)) 84. ptr = NULL; ^ 85. #elif HAVE_MEMALIGN 86. ptr = memalign(16,size); libavutil/mem.c:116:5: 114. ptr = malloc(size); 115. #endif 116. return ptr; ^ 117. } 118. libavutil/mem.c:117:1: return from a call to av_malloc 115. #endif 116. return ptr; 117. } ^ 118. 119. void *av_realloc(void *ptr, unsigned int size) libavfilter/avfilter.c:54:9: 52. if (ref->type == AVMEDIA_TYPE_VIDEO) { 53. ret->video = av_malloc(sizeof(AVFilterBufferRefVideoProps)); 54. *ret->video = *ref->video; ^ 55. } 56. ret->perms &= pmask;
https://github.com/libav/libav/blob/ad0d70c964f852a18e9ab8124f0e7aa8876cac6e/libavfilter/avfilter.c/#L54
d2a_code_trace_data_41878
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/statem_srvr.c:3769: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `pkt->written` + 17]):unsigned64 by call to `WPACKET_start_sub_packet_len__`. Showing all 12 steps of the trace ssl/statem/statem_srvr.c:3751:10: Call 3749. * timeout. 3750. */ 3751. if (!WPACKET_put_bytes_u32(pkt, ^ 3752. (s->hit && !SSL_IS_TLS13(s)) 3753. ? 0 : s->session->timeout)) { ssl/packet.c:309:1: Parameter `pkt->buf->length` 307. } 308. 309. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 310. { 311. unsigned char *data; ssl/statem/statem_srvr.c:3769:10: Call 3767. 3768. /* Start the sub-packet for the actual ticket data */ 3769. if (!WPACKET_start_sub_packet_u16(pkt)) { ^ 3770. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_CREATE_TICKET_PREQUEL, 3771. ERR_R_INTERNAL_ERROR); ssl/packet.c:272:1: Parameter `pkt->written` 270. } 271. 272. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 273. { 274. WPACKET_SUB *sub; ssl/packet.c:296:10: Call 294. } 295. 296. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 297. return 0; 298. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */ ssl/packet.c:16:1: Parameter `pkt->written` 14. #define DEFAULT_BUF_SIZE 256 15. 16. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 17. { 18. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ssl/packet.c:18:10: Call 16. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 17. { 18. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ^ 19. return 0; 20. ssl/packet.c:40:1: <LHS trace> 38. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 39. 40. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 41. { 42. /* Internal API, so should not fail */ ssl/packet.c:40:1: Parameter `pkt->buf->length` 38. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 39. 40. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 41. { 42. /* Internal API, so should not fail */ ssl/packet.c:40:1: <RHS trace> 38. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 39. 40. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 41. { 42. /* Internal API, so should not fail */ ssl/packet.c:40:1: Parameter `len` 38. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 39. 40. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 41. { 42. /* Internal API, so should not fail */ ssl/packet.c:49:36: Binary operation: ([0, +oo] - [0, pkt->written + 17]):unsigned64 by call to `WPACKET_start_sub_packet_len__` 47. return 0; 48. 49. if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) { ^ 50. size_t newlen; 51. size_t reflen;
https://github.com/openssl/openssl/blob/41145c35bfee8f2b0822288fcb23a807d06d8e89/ssl/packet.c/#L49
d2a_code_trace_data_41879
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) { if (pipe(fd) == -1) { fprintf(stderr, "pipe failure\n"); exit(1); } fflush(stdout); fflush(stderr); if(fork()) { close(fd[1]); fds[n]=fd[0]; } else { close(fd[0]); close(1); if (dup(fd[1]) == -1) { fprintf(stderr, "dup failed\n"); exit(1); } close(fd[1]); mr=1; usertime=0; free(fds); return 0; } printf("Forked child %d\n",n); } for(n=0 ; n < multi ; ++n) { FILE *f; char buf[1024]; char *p; f=fdopen(fds[n],"r"); while(fgets(buf,sizeof buf,f)) { p=strchr(buf,'\n'); if(p) *p='\0'; if(buf[0] != '+') { 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; } #ifndef OPENSSL_NO_DSA 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; } #endif #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); } fclose(f); } free(fds); return 1; } apps/speed.c:2788: error: NULL_DEREFERENCE pointer `f` last assigned on line 2787 could be null and is dereferenced by call to `fgets()` at line 2788, column 9. Showing all 36 steps of the trace apps/speed.c:2740:1: start of procedure do_multi() 2738. } 2739. 2740. > static int do_multi(int multi) 2741. { 2742. int n; apps/speed.c:2745:2: 2743. int fd[2]; 2744. int *fds; 2745. > static char sep[]=":"; 2746. 2747. fds=malloc(multi*sizeof *fds); apps/speed.c:2747:2: 2745. static char sep[]=":"; 2746. 2747. > fds=malloc(multi*sizeof *fds); 2748. for(n=0 ; n < multi ; ++n) 2749. { apps/speed.c:2748:6: 2746. 2747. fds=malloc(multi*sizeof *fds); 2748. > for(n=0 ; n < multi ; ++n) 2749. { 2750. if (pipe(fd) == -1) apps/speed.c:2748:12: Loop condition is true. Entering loop body 2746. 2747. fds=malloc(multi*sizeof *fds); 2748. for(n=0 ; n < multi ; ++n) ^ 2749. { 2750. if (pipe(fd) == -1) apps/speed.c:2750:7: Taking false branch 2748. for(n=0 ; n < multi ; ++n) 2749. { 2750. if (pipe(fd) == -1) ^ 2751. { 2752. fprintf(stderr, "pipe failure\n"); apps/speed.c:2755:3: 2753. exit(1); 2754. } 2755. > fflush(stdout); 2756. fflush(stderr); 2757. if(fork()) apps/speed.c:2756:3: 2754. } 2755. fflush(stdout); 2756. > fflush(stderr); 2757. if(fork()) 2758. { apps/speed.c:2757:6: Taking true branch 2755. fflush(stdout); 2756. fflush(stderr); 2757. if(fork()) ^ 2758. { 2759. close(fd[1]); apps/speed.c:2759:4: 2757. if(fork()) 2758. { 2759. > close(fd[1]); 2760. fds[n]=fd[0]; 2761. } apps/speed.c:2760:4: 2758. { 2759. close(fd[1]); 2760. > fds[n]=fd[0]; 2761. } 2762. else apps/speed.c:2777:3: 2775. return 0; 2776. } 2777. > printf("Forked child %d\n",n); 2778. } 2779. apps/speed.c:2748:24: 2746. 2747. fds=malloc(multi*sizeof *fds); 2748. > for(n=0 ; n < multi ; ++n) 2749. { 2750. if (pipe(fd) == -1) apps/speed.c:2748:12: Loop condition is true. Entering loop body 2746. 2747. fds=malloc(multi*sizeof *fds); 2748. for(n=0 ; n < multi ; ++n) ^ 2749. { 2750. if (pipe(fd) == -1) apps/speed.c:2750:7: Taking false branch 2748. for(n=0 ; n < multi ; ++n) 2749. { 2750. if (pipe(fd) == -1) ^ 2751. { 2752. fprintf(stderr, "pipe failure\n"); apps/speed.c:2755:3: 2753. exit(1); 2754. } 2755. > fflush(stdout); 2756. fflush(stderr); 2757. if(fork()) apps/speed.c:2756:3: 2754. } 2755. fflush(stdout); 2756. > fflush(stderr); 2757. if(fork()) 2758. { apps/speed.c:2757:6: Taking true branch 2755. fflush(stdout); 2756. fflush(stderr); 2757. if(fork()) ^ 2758. { 2759. close(fd[1]); apps/speed.c:2759:4: 2757. if(fork()) 2758. { 2759. > close(fd[1]); 2760. fds[n]=fd[0]; 2761. } apps/speed.c:2760:4: 2758. { 2759. close(fd[1]); 2760. > fds[n]=fd[0]; 2761. } 2762. else apps/speed.c:2777:3: 2775. return 0; 2776. } 2777. > printf("Forked child %d\n",n); 2778. } 2779. apps/speed.c:2748:24: 2746. 2747. fds=malloc(multi*sizeof *fds); 2748. > for(n=0 ; n < multi ; ++n) 2749. { 2750. if (pipe(fd) == -1) apps/speed.c:2748:12: Loop condition is true. Entering loop body 2746. 2747. fds=malloc(multi*sizeof *fds); 2748. for(n=0 ; n < multi ; ++n) ^ 2749. { 2750. if (pipe(fd) == -1) apps/speed.c:2750:7: Taking false branch 2748. for(n=0 ; n < multi ; ++n) 2749. { 2750. if (pipe(fd) == -1) ^ 2751. { 2752. fprintf(stderr, "pipe failure\n"); apps/speed.c:2755:3: 2753. exit(1); 2754. } 2755. > fflush(stdout); 2756. fflush(stderr); 2757. if(fork()) apps/speed.c:2756:3: 2754. } 2755. fflush(stdout); 2756. > fflush(stderr); 2757. if(fork()) 2758. { apps/speed.c:2757:6: Taking true branch 2755. fflush(stdout); 2756. fflush(stderr); 2757. if(fork()) ^ 2758. { 2759. close(fd[1]); apps/speed.c:2759:4: 2757. if(fork()) 2758. { 2759. > close(fd[1]); 2760. fds[n]=fd[0]; 2761. } apps/speed.c:2760:4: 2758. { 2759. close(fd[1]); 2760. > fds[n]=fd[0]; 2761. } 2762. else apps/speed.c:2777:3: 2775. return 0; 2776. } 2777. > printf("Forked child %d\n",n); 2778. } 2779. apps/speed.c:2748:24: 2746. 2747. fds=malloc(multi*sizeof *fds); 2748. > for(n=0 ; n < multi ; ++n) 2749. { 2750. if (pipe(fd) == -1) apps/speed.c:2748:12: Loop condition is false. Leaving loop 2746. 2747. fds=malloc(multi*sizeof *fds); 2748. for(n=0 ; n < multi ; ++n) ^ 2749. { 2750. if (pipe(fd) == -1) apps/speed.c:2781:6: 2779. 2780. /* for now, assume the pipe is long enough to take all the output */ 2781. > for(n=0 ; n < multi ; ++n) 2782. { 2783. FILE *f; apps/speed.c:2781:12: Loop condition is true. Entering loop body 2779. 2780. /* for now, assume the pipe is long enough to take all the output */ 2781. for(n=0 ; n < multi ; ++n) ^ 2782. { 2783. FILE *f; apps/speed.c:2787:3: 2785. char *p; 2786. 2787. > f=fdopen(fds[n],"r"); 2788. while(fgets(buf,sizeof buf,f)) 2789. { apps/speed.c:2788:9: 2786. 2787. f=fdopen(fds[n],"r"); 2788. > while(fgets(buf,sizeof buf,f)) 2789. { 2790. p=strchr(buf,'\n');
https://github.com/openssl/openssl/blob/7e965dcc3812ac6ec4d1413c5ea3224be6486c8f/apps/speed.c/#L2788
d2a_code_trace_data_41880
static int SM2_sig_verify(const EC_KEY *key, const ECDSA_SIG *sig, const BIGNUM *e) { int ret = 0; const EC_GROUP *group = EC_KEY_get0_group(key); const BIGNUM *order = EC_GROUP_get0_order(group); BN_CTX *ctx = NULL; EC_POINT *pt = NULL; BIGNUM *t = NULL; BIGNUM *x1 = NULL; const BIGNUM *r = NULL; const BIGNUM *s = NULL; ctx = BN_CTX_new(); if (ctx == NULL) goto done; pt = EC_POINT_new(group); if (pt == NULL) goto done; BN_CTX_start(ctx); t = BN_CTX_get(ctx); x1 = BN_CTX_get(ctx); if (x1 == NULL) goto done; ECDSA_SIG_get0(sig, &r, &s); if (BN_cmp(r, BN_value_one()) < 0) goto done; if (BN_cmp(s, BN_value_one()) < 0) goto done; if (BN_cmp(order, r) <= 0) goto done; if (BN_cmp(order, s) <= 0) goto done; if (BN_mod_add(t, r, s, order, ctx) == 0) goto done; if (BN_is_zero(t) == 1) goto done; if (EC_POINT_mul(group, pt, s, EC_KEY_get0_public_key(key), t, ctx) == 0) goto done; if (EC_POINT_get_affine_coordinates_GFp(group, pt, x1, NULL, ctx) == 0) goto done; if (BN_mod_add(t, e, x1, order, ctx) == 0) goto done; if (BN_cmp(r, t) == 0) ret = 1; done: EC_POINT_free(pt); BN_CTX_free(ctx); return ret; } crypto/sm2/sm2_sign.c:222: error: NULL_DEREFERENCE pointer `ctx` last assigned on line 165 could be null and is dereferenced by call to `BN_CTX_free()` at line 222, column 5. Showing all 40 steps of the trace crypto/sm2/sm2_sign.c:151:1: start of procedure SM2_sig_verify() 149. } 150. 151. > static 152. int SM2_sig_verify(const EC_KEY *key, const ECDSA_SIG *sig, const BIGNUM *e) 153. { crypto/sm2/sm2_sign.c:154:5: 152. int SM2_sig_verify(const EC_KEY *key, const ECDSA_SIG *sig, const BIGNUM *e) 153. { 154. > int ret = 0; 155. const EC_GROUP *group = EC_KEY_get0_group(key); 156. const BIGNUM *order = EC_GROUP_get0_order(group); crypto/sm2/sm2_sign.c:155:5: 153. { 154. int ret = 0; 155. > const EC_GROUP *group = EC_KEY_get0_group(key); 156. const BIGNUM *order = EC_GROUP_get0_order(group); 157. BN_CTX *ctx = NULL; crypto/ec/ec_key.c:419:1: start of procedure EC_KEY_get0_group() 417. } 418. 419. > const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key) 420. { 421. return key->group; crypto/ec/ec_key.c:421:5: 419. const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key) 420. { 421. > return key->group; 422. } 423. crypto/ec/ec_key.c:422:1: return from a call to EC_KEY_get0_group 420. { 421. return key->group; 422. > } 423. 424. int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group) crypto/sm2/sm2_sign.c:156:5: 154. int ret = 0; 155. const EC_GROUP *group = EC_KEY_get0_group(key); 156. > const BIGNUM *order = EC_GROUP_get0_order(group); 157. BN_CTX *ctx = NULL; 158. EC_POINT *pt = NULL; crypto/ec/ec_lib.c:328:1: start of procedure EC_GROUP_get0_order() 326. } 327. 328. > const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group) 329. { 330. return group->order; crypto/ec/ec_lib.c:330:5: 328. const BIGNUM *EC_GROUP_get0_order(const EC_GROUP *group) 329. { 330. > return group->order; 331. } 332. crypto/ec/ec_lib.c:331:1: return from a call to EC_GROUP_get0_order 329. { 330. return group->order; 331. > } 332. 333. int EC_GROUP_order_bits(const EC_GROUP *group) crypto/sm2/sm2_sign.c:157:5: 155. const EC_GROUP *group = EC_KEY_get0_group(key); 156. const BIGNUM *order = EC_GROUP_get0_order(group); 157. > BN_CTX *ctx = NULL; 158. EC_POINT *pt = NULL; 159. crypto/sm2/sm2_sign.c:158:5: 156. const BIGNUM *order = EC_GROUP_get0_order(group); 157. BN_CTX *ctx = NULL; 158. > EC_POINT *pt = NULL; 159. 160. BIGNUM *t = NULL; crypto/sm2/sm2_sign.c:160:5: 158. EC_POINT *pt = NULL; 159. 160. > BIGNUM *t = NULL; 161. BIGNUM *x1 = NULL; 162. const BIGNUM *r = NULL; crypto/sm2/sm2_sign.c:161:5: 159. 160. BIGNUM *t = NULL; 161. > BIGNUM *x1 = NULL; 162. const BIGNUM *r = NULL; 163. const BIGNUM *s = NULL; crypto/sm2/sm2_sign.c:162:5: 160. BIGNUM *t = NULL; 161. BIGNUM *x1 = NULL; 162. > const BIGNUM *r = NULL; 163. const BIGNUM *s = NULL; 164. crypto/sm2/sm2_sign.c:163:5: 161. BIGNUM *x1 = NULL; 162. const BIGNUM *r = NULL; 163. > const BIGNUM *s = NULL; 164. 165. ctx = BN_CTX_new(); crypto/sm2/sm2_sign.c:165:5: Skipping BN_CTX_new(): empty list of specs 163. const BIGNUM *s = NULL; 164. 165. ctx = BN_CTX_new(); ^ 166. if (ctx == NULL) 167. goto done; crypto/sm2/sm2_sign.c:166:9: Taking true branch 164. 165. ctx = BN_CTX_new(); 166. if (ctx == NULL) ^ 167. goto done; 168. pt = EC_POINT_new(group); crypto/sm2/sm2_sign.c:220:2: 218. ret = 1; 219. 220. > done: 221. EC_POINT_free(pt); 222. BN_CTX_free(ctx); crypto/sm2/sm2_sign.c:221:5: 219. 220. done: 221. > EC_POINT_free(pt); 222. BN_CTX_free(ctx); 223. return ret; crypto/ec/ec_lib.c:581:1: start of procedure EC_POINT_free() 579. } 580. 581. > void EC_POINT_free(EC_POINT *point) 582. { 583. if (!point) crypto/ec/ec_lib.c:583:10: Taking true branch 581. void EC_POINT_free(EC_POINT *point) 582. { 583. if (!point) ^ 584. return; 585. crypto/ec/ec_lib.c:584:9: 582. { 583. if (!point) 584. > return; 585. 586. if (point->meth->point_finish != 0) crypto/ec/ec_lib.c:589:1: return from a call to EC_POINT_free 587. point->meth->point_finish(point); 588. OPENSSL_free(point); 589. > } 590. 591. void EC_POINT_clear_free(EC_POINT *point) crypto/sm2/sm2_sign.c:222:5: 220. done: 221. EC_POINT_free(pt); 222. > BN_CTX_free(ctx); 223. return ret; 224. } crypto/bn/bn_ctx.c:157:1: start of procedure BN_CTX_free() 155. } 156. 157. > void BN_CTX_free(BN_CTX *ctx) 158. { 159. #ifdef BN_CTX_DEBUG crypto/bn/bn_ctx.c:174:5: 172. } 173. #endif 174. > BN_STACK_finish(&ctx->stack); 175. BN_POOL_finish(&ctx->pool); 176. OPENSSL_free(ctx); crypto/bn/bn_ctx.c:243:1: start of procedure BN_STACK_finish() 241. } 242. 243. > static void BN_STACK_finish(BN_STACK *st) 244. { 245. OPENSSL_free(st->indexes); crypto/bn/bn_ctx.c:245:5: 243. static void BN_STACK_finish(BN_STACK *st) 244. { 245. > OPENSSL_free(st->indexes); 246. st->indexes = NULL; 247. } 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/bn/bn_ctx.c:246:5: 244. { 245. OPENSSL_free(st->indexes); 246. > st->indexes = NULL; 247. } 248. crypto/bn/bn_ctx.c:247:1: return from a call to BN_STACK_finish 245. OPENSSL_free(st->indexes); 246. st->indexes = NULL; 247. > } 248. 249. crypto/bn/bn_ctx.c:175:5: 173. #endif 174. BN_STACK_finish(&ctx->stack); 175. > BN_POOL_finish(&ctx->pool); 176. OPENSSL_free(ctx); 177. } crypto/bn/bn_ctx.c:284:1: start of procedure BN_POOL_finish() 282. } 283. 284. > static void BN_POOL_finish(BN_POOL *p) 285. { 286. unsigned int loop; crypto/bn/bn_ctx.c:289:12: Loop condition is false. Leaving loop 287. BIGNUM *bn; 288. 289. while (p->head) { ^ 290. for (loop = 0, bn = p->head->vals; loop++ < BN_CTX_POOL_SIZE; bn++) 291. if (bn->d)
https://github.com/openssl/openssl/blob/98c03302fb7b855647aa14022f61f5fb272e514a/crypto/sm2/sm2_sign.c/#L222
d2a_code_trace_data_41881
YUV2RGBFUNC(yuva2rgba_c, uint32_t, 1) LOADCHROMA(0); PUTRGBA(dst_1, py_1, pa_1, 0, 24); PUTRGBA(dst_2, py_2, pa_2, 0, 24); LOADCHROMA(1); PUTRGBA(dst_2, py_2, pa_1, 1, 24); PUTRGBA(dst_1, py_1, pa_2, 1, 24); LOADCHROMA(2); PUTRGBA(dst_1, py_1, pa_1, 2, 24); PUTRGBA(dst_2, py_2, pa_2, 2, 24); LOADCHROMA(3); PUTRGBA(dst_2, py_2, pa_1, 3, 24); PUTRGBA(dst_1, py_1, pa_2, 3, 24); pa_1 += 8; \ pa_2 += 8; \ ENDYUV2RGBLINE(8) LOADCHROMA(0); PUTRGBA(dst_1, py_1, pa_1, 0, 24); PUTRGBA(dst_2, py_2, pa_2, 0, 24); LOADCHROMA(1); PUTRGBA(dst_2, py_2, pa_1, 1, 24); PUTRGBA(dst_1, py_1, pa_2, 1, 24); ENDYUV2RGBFUNC() libswscale/yuv2rgb.c:266: error: Uninitialized Value The value read from pa_2 was never initialized. libswscale/yuv2rgb.c:266:5: 264. PUTRGBA(dst_1, py_1, pa_2, 3, 24); 265. pa_1 += 8; \ 266. pa_2 += 8; \ ^ 267. ENDYUV2RGBLINE(8) 268. LOADCHROMA(0);
https://github.com/libav/libav/blob/0ad522afb3a3b3d22402ecb82dd4609f7655031b/libswscale/yuv2rgb.c/#L266
d2a_code_trace_data_41882
void CRYPTO_free(void *str, const char *file, int line) { if (free_impl != NULL && free_impl != &CRYPTO_free) { free_impl(str, file, line); return; } #ifndef OPENSSL_NO_CRYPTO_MDEBUG if (call_malloc_debug) { CRYPTO_mem_debug_free(str, 0, file, line); free(str); CRYPTO_mem_debug_free(str, 1, file, line); } else { free(str); } #else free(str); #endif } test/bntest.c:2231: error: USE_AFTER_FREE call to `clearstanza()` eventually accesses memory that was invalidated by call to `free()` on line 2231 indirectly during the call to `clearstanza()`. Showing all 16 steps of the trace test/bntest.c:2223:5: invalidation part of the trace starts here 2221. 2222. /* Read test file. */ 2223. memset(&s, 0, sizeof(s)); ^ 2224. while (!feof(fp) && readstanza(&s, &linesread)) { 2225. if (s.numpairs == 0) test/bntest.c:2223:5: variable `s` accessed here 2221. 2222. /* Read test file. */ 2223. memset(&s, 0, sizeof(s)); ^ 2224. while (!feof(fp) && readstanza(&s, &linesread)) { 2225. if (s.numpairs == 0) test/bntest.c:2231:9: when calling `clearstanza` here 2229. errcnt++; 2230. } 2231. clearstanza(&s); ^ 2232. s.start = linesread; 2233. } test/bntest.c:2177:1: parameter `s` of clearstanza 2175. } 2176. 2177. > static void clearstanza(STANZA *s) 2178. { 2179. PAIR *pp = s->pairs; test/bntest.c:2179:5: assigned 2177. static void clearstanza(STANZA *s) 2178. { 2179. PAIR *pp = s->pairs; ^ 2180. int i = s->numpairs; 2181. int start = s->start; test/bntest.c:2184:9: when calling `CRYPTO_free` here 2182. 2183. for ( ; --i >= 0; pp++) { 2184. OPENSSL_free(pp->key); ^ 2185. OPENSSL_free(pp->value); 2186. } crypto/mem.c:253:1: parameter `str` of CRYPTO_free 251. } 252. 253. > void CRYPTO_free(void *str, const char *file, int line) 254. { 255. if (free_impl != NULL && free_impl != &CRYPTO_free) { crypto/mem.c:269:5: was invalidated by call to `free()` 267. } 268. #else 269. free(str); ^ 270. #endif 271. } test/bntest.c:2223:5: use-after-lifetime part of the trace starts here 2221. 2222. /* Read test file. */ 2223. memset(&s, 0, sizeof(s)); ^ 2224. while (!feof(fp) && readstanza(&s, &linesread)) { 2225. if (s.numpairs == 0) test/bntest.c:2223:5: variable `s` accessed here 2221. 2222. /* Read test file. */ 2223. memset(&s, 0, sizeof(s)); ^ 2224. while (!feof(fp) && readstanza(&s, &linesread)) { 2225. if (s.numpairs == 0) test/bntest.c:2231:9: when calling `clearstanza` here 2229. errcnt++; 2230. } 2231. clearstanza(&s); ^ 2232. s.start = linesread; 2233. } test/bntest.c:2177:1: parameter `s` of clearstanza 2175. } 2176. 2177. > static void clearstanza(STANZA *s) 2178. { 2179. PAIR *pp = s->pairs; test/bntest.c:2179:5: assigned 2177. static void clearstanza(STANZA *s) 2178. { 2179. PAIR *pp = s->pairs; ^ 2180. int i = s->numpairs; 2181. int start = s->start; test/bntest.c:2184:9: when calling `CRYPTO_free` here 2182. 2183. for ( ; --i >= 0; pp++) { 2184. OPENSSL_free(pp->key); ^ 2185. OPENSSL_free(pp->value); 2186. } crypto/mem.c:253:1: parameter `str` of CRYPTO_free 251. } 252. 253. > void CRYPTO_free(void *str, const char *file, int line) 254. { 255. if (free_impl != NULL && free_impl != &CRYPTO_free) { crypto/mem.c:269:5: invalid access occurs here 267. } 268. #else 269. free(str); ^ 270. #endif 271. }
https://github.com/openssl/openssl/blob/8ccc237720d59cdf249c2c901d19f1fec739e66e/crypto/mem.c/#L269
d2a_code_trace_data_41883
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/mpc7.c:193: error: Integer Overflow L2 ([1, +oo] - 6):unsigned32 by call to `bitstream_read`. 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: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_41884
static void truespeech_read_frame(TSContext *dec, const uint8_t *input) { uint32_t t; t = AV_RL32(input); input += 4; dec->flag = t & 1; dec->vector[0] = ts_codebook[0][(t >> 1) & 0x1F]; dec->vector[1] = ts_codebook[1][(t >> 6) & 0x1F]; dec->vector[2] = ts_codebook[2][(t >> 11) & 0xF]; dec->vector[3] = ts_codebook[3][(t >> 15) & 0xF]; dec->vector[4] = ts_codebook[4][(t >> 19) & 0xF]; dec->vector[5] = ts_codebook[5][(t >> 23) & 0x7]; dec->vector[6] = ts_codebook[6][(t >> 26) & 0x7]; dec->vector[7] = ts_codebook[7][(t >> 29) & 0x7]; t = AV_RL32(input); input += 4; dec->offset2[0] = (t >> 0) & 0x7F; dec->offset2[1] = (t >> 7) & 0x7F; dec->offset2[2] = (t >> 14) & 0x7F; dec->offset2[3] = (t >> 21) & 0x7F; dec->offset1[0] = ((t >> 28) & 0xF) << 4; t = AV_RL32(input); input += 4; dec->pulseval[0] = (t >> 0) & 0x3FFF; dec->pulseval[1] = (t >> 14) & 0x3FFF; dec->offset1[1] = (t >> 28) & 0x0F; t = AV_RL32(input); input += 4; dec->pulseval[2] = (t >> 0) & 0x3FFF; dec->pulseval[3] = (t >> 14) & 0x3FFF; dec->offset1[1] |= ((t >> 28) & 0x0F) << 4; t = AV_RL32(input); input += 4; dec->pulsepos[0] = (t >> 4) & 0x7FFFFFF; dec->pulseoff[0] = (t >> 0) & 0xF; dec->offset1[0] |= (t >> 31) & 1; t = AV_RL32(input); input += 4; dec->pulsepos[1] = (t >> 4) & 0x7FFFFFF; dec->pulseoff[1] = (t >> 0) & 0xF; dec->offset1[0] |= ((t >> 31) & 1) << 1; t = AV_RL32(input); input += 4; dec->pulsepos[2] = (t >> 4) & 0x7FFFFFF; dec->pulseoff[2] = (t >> 0) & 0xF; dec->offset1[0] |= ((t >> 31) & 1) << 2; t = AV_RL32(input); input += 4; dec->pulsepos[3] = (t >> 4) & 0x7FFFFFF; dec->pulseoff[3] = (t >> 0) & 0xF; dec->offset1[0] |= ((t >> 31) & 1) << 3; } libavcodec/truespeech.c:70: error: Buffer Overrun L2 Offset: [0, 31] Size: 8. libavcodec/truespeech.c:60:1: <Offset trace> 58. } 59. 60. static void truespeech_read_frame(TSContext *dec, const uint8_t *input) ^ 61. { 62. uint32_t t; libavcodec/truespeech.c:60:1: Parameter `*input` 58. } 59. 60. static void truespeech_read_frame(TSContext *dec, const uint8_t *input) ^ 61. { 62. uint32_t t; libavcodec/truespeech.c:65:5: Assignment 63. 64. /* first dword */ 65. t = AV_RL32(input); ^ 66. input += 4; 67. libavcodec/truespeech_data.h:69:1: <Length trace> 67. }; 68. 69. static const int16_t *ts_codebook[8] = { ^ 70. ts_cb_0, ts_cb_1, ts_cb_2, ts_cb_3, ts_cb_4, ts_cb_5, ts_cb_6, ts_cb_7 71. }; libavcodec/truespeech_data.h:69:1: Array declaration 67. }; 68. 69. static const int16_t *ts_codebook[8] = { ^ 70. ts_cb_0, ts_cb_1, ts_cb_2, ts_cb_3, ts_cb_4, ts_cb_5, ts_cb_6, ts_cb_7 71. }; libavcodec/truespeech.c:70:22: Array access: Offset: [0, 31] Size: 8 68. dec->flag = t & 1; 69. 70. dec->vector[0] = ts_codebook[0][(t >> 1) & 0x1F]; ^ 71. dec->vector[1] = ts_codebook[1][(t >> 6) & 0x1F]; 72. dec->vector[2] = ts_codebook[2][(t >> 11) & 0xF];
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/truespeech.c/#L70
d2a_code_trace_data_41885
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; bn_check_top(b); if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return (NULL); } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return (NULL); } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } test/testutil/tests.c:632: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_set_word`. Showing all 19 steps of the trace test/testutil/tests.c:632:5: Call 630. return 1; 631. bw = BN_new(); 632. BN_set_word(bw, w); ^ 633. test_fail_bignum_message(NULL, file, line, "BIGNUM", bns, ws, "==", a, bw); 634. BN_free(bw); crypto/bn/bn_lib.c:395:1: Parameter `a->top` 393. } 394. 395. > int BN_set_word(BIGNUM *a, BN_ULONG w) 396. { 397. bn_check_top(a); crypto/bn/bn_lib.c:398:9: Call 396. { 397. bn_check_top(a); 398. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 399. return (0); 400. a->neg = 0; crypto/bn/bn_lcl.h:660:1: Parameter `a->top` 658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 659. 660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 661. { 662. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_lcl.h:668:12: Call 666. return a; 667. 668. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2); ^ 669. } 670. crypto/bn/bn_lib.c:284:1: Parameter `b->top` 282. */ 283. 284. > BIGNUM *bn_expand2(BIGNUM *b, int words) 285. { 286. bn_check_top(b); crypto/bn/bn_lib.c:289:23: Call 287. 288. if (words > b->dmax) { 289. BN_ULONG *a = bn_expand_internal(b, words); ^ 290. if (!a) 291. return NULL; crypto/bn/bn_lib.c:246:1: <Offset trace> 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:246:1: Parameter `b->top` 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:246:1: <Length trace> 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:246:1: Parameter `words` 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:263:13: Call 261. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 262. else 263. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 264. if (a == NULL) { 265. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/mem.c:186:1: Parameter `num` 184. } 185. 186. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:188:17: Call 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. void *ret = CRYPTO_malloc(num, file, line); ^ 189. 190. FAILTEST(); crypto/mem.c:166:9: Assignment 164. 165. if (num == 0) 166. return NULL; ^ 167. 168. FAILTEST(); crypto/mem.c:188:5: Assignment 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. void *ret = CRYPTO_malloc(num, file, line); ^ 189. 190. FAILTEST(); crypto/mem.c:193:5: Assignment 191. if (ret != NULL) 192. memset(ret, 0, num); 193. return ret; ^ 194. } 195. crypto/bn/bn_lib.c:263:9: Assignment 261. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 262. else 263. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 264. if (a == NULL) { 265. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:271:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_set_word` 269. assert(b->top <= words); 270. if (b->top > 0) 271. memcpy(a, b->d, sizeof(*a) * b->top); ^ 272. 273. return a;
https://github.com/openssl/openssl/blob/3f97052392cb10fca5309212bf720685262ad4a6/crypto/bn/bn_lib.c/#L271
d2a_code_trace_data_41886
static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr, int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], int ref_mv_scale, int flags, int size, int h) { MotionEstContext * const c= &s->me; int best[2]={0, 0}; int d; int dmin; int map_generation; int penalty_factor; const int ref_mv_stride= s->mb_stride; const int ref_mv_xy= s->mb_x + s->mb_y*ref_mv_stride; me_cmp_func cmpf, chroma_cmpf; LOAD_COMMON LOAD_COMMON2 if(c->pre_pass){ penalty_factor= c->pre_penalty_factor; cmpf= s->dsp.me_pre_cmp[size]; chroma_cmpf= s->dsp.me_pre_cmp[size+1]; }else{ penalty_factor= c->penalty_factor; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; } map_generation= update_map_generation(c); assert(cmpf); dmin= cmp(s, 0, 0, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags); map[0]= map_generation; score_map[0]= dmin; if((s->pict_type == FF_B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0) dmin += (mv_penalty[pred_x] + mv_penalty[pred_y])*penalty_factor; if (s->first_slice_line) { CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) }else{ if(dmin<((h*h*s->avctx->mv0_threshold)>>8) && ( P_LEFT[0] |P_LEFT[1] |P_TOP[0] |P_TOP[1] |P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){ *mx_ptr= 0; *my_ptr= 0; c->skip=1; return dmin; } CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift) CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift) CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) } if(dmin>h*h*4){ if(c->pre_pass){ CHECK_CLIPPED_MV((last_mv[ref_mv_xy-1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy-1][1]*ref_mv_scale + (1<<15))>>16) if(!s->first_slice_line) CHECK_CLIPPED_MV((last_mv[ref_mv_xy-ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy-ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) }else{ CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) if(s->mb_y+1<s->end_mb_y) CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) } } if(c->avctx->last_predictor_count){ const int count= c->avctx->last_predictor_count; const int xstart= FFMAX(0, s->mb_x - count); const int ystart= FFMAX(0, s->mb_y - count); const int xend= FFMIN(s->mb_width , s->mb_x + count + 1); const int yend= FFMIN(s->mb_height, s->mb_y + count + 1); int mb_y; for(mb_y=ystart; mb_y<yend; mb_y++){ int mb_x; for(mb_x=xstart; mb_x<xend; mb_x++){ const int xy= mb_x + 1 + (mb_y + 1)*ref_mv_stride; int mx= (last_mv[xy][0]*ref_mv_scale + (1<<15))>>16; int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16; if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue; CHECK_MV(mx,my) } } } dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); *mx_ptr= best[0]; *my_ptr= best[1]; return dmin; } libavcodec/motion_est_template.c:1065: error: Uninitialized Value The value read from ymin was never initialized. libavcodec/motion_est_template.c:1065:9: 1063. CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift) 1064. CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift) 1065. CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) ^ 1066. } 1067. if(dmin>h*h*4){
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1065
d2a_code_trace_data_41887
void ff_lsp2polyf(const double *lsp, double *f, int lp_half_order) { int i, j; f[0] = 1.0; f[1] = -2 * lsp[0]; lsp -= 2; for(i=2; i<=lp_half_order; i++) { double val = -2 * lsp[2*i]; f[i] = val * f[i-1] + 2*f[i-2]; for(j=i-1; j>1; j--) f[j] += f[j-1] * val + f[j-2]; f[1] += val; } } libavcodec/lsp.c:130: error: Buffer Overrun L3 Offset: [1, +oo] Size: [0, +oo] by call to `ff_lsp2polyf`. libavcodec/lsp.c:120:1: Parameter `lp_order` 118. } 119. 120. void ff_amrwb_lsp2lpc(const double *lsp, float *lp, int lp_order) ^ 121. { 122. int lp_half_order = lp_order >> 1; libavcodec/lsp.c:122:5: Assignment 120. void ff_amrwb_lsp2lpc(const double *lsp, float *lp, int lp_order) 121. { 122. int lp_half_order = lp_order >> 1; ^ 123. double buf[lp_half_order + 1]; 124. double pa[lp_half_order + 1]; libavcodec/lsp.c:130:5: Call 128. qa[-1] = 0.0; 129. 130. ff_lsp2polyf(lsp , pa, lp_half_order ); ^ 131. ff_lsp2polyf(lsp + 1, qa, lp_half_order - 1); 132. libavcodec/lsp.c:165:1: <Offset trace> 163. } 164. 165. void ff_lsp2polyf(const double *lsp, double *f, int lp_half_order) ^ 166. { 167. int i, j; libavcodec/lsp.c:165:1: Parameter `lp_half_order` 163. } 164. 165. void ff_lsp2polyf(const double *lsp, double *f, int lp_half_order) ^ 166. { 167. int i, j; libavcodec/lsp.c:165:1: <Length trace> 163. } 164. 165. void ff_lsp2polyf(const double *lsp, double *f, int lp_half_order) ^ 166. { 167. int i, j; libavcodec/lsp.c:165:1: Parameter `*f` 163. } 164. 165. void ff_lsp2polyf(const double *lsp, double *f, int lp_half_order) ^ 166. { 167. int i, j; libavcodec/lsp.c:175:22: Array access: Offset: [1, +oo] Size: [0, +oo] by call to `ff_lsp2polyf` 173. { 174. double val = -2 * lsp[2*i]; 175. f[i] = val * f[i-1] + 2*f[i-2]; ^ 176. for(j=i-1; j>1; j--) 177. f[j] += f[j-1] * val + f[j-2];
https://github.com/libav/libav/blob/539ff40c2d685508c62f040693df0f0facda39ff/libavcodec/lsp.c/#L175
d2a_code_trace_data_41888
u_char * ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) { u_char *p, zero, *last; int d; float f, scale; size_t len, slen; int64_t i64; uint64_t ui64; ngx_msec_t ms; ngx_uint_t width, sign, hex, max_width, frac_width, i; ngx_str_t *v; ngx_variable_value_t *vv; if (max == 0) { return buf; } last = buf + max; while (*fmt && buf < last) { if (*fmt == '%') { i64 = 0; ui64 = 0; zero = (u_char) ((*++fmt == '0') ? '0' : ' '); width = 0; sign = 1; hex = 0; max_width = 0; frac_width = 0; slen = (size_t) -1; while (*fmt >= '0' && *fmt <= '9') { width = width * 10 + *fmt++ - '0'; } for ( ;; ) { switch (*fmt) { case 'u': sign = 0; fmt++; continue; case 'm': max_width = 1; fmt++; continue; case 'X': hex = 2; sign = 0; fmt++; continue; case 'x': hex = 1; sign = 0; fmt++; continue; case '.': fmt++; while (*fmt >= '0' && *fmt <= '9') { frac_width = frac_width * 10 + *fmt++ - '0'; } break; case '*': slen = va_arg(args, size_t); fmt++; continue; default: break; } break; } switch (*fmt) { case 'V': v = va_arg(args, ngx_str_t *); len = v->len; len = (buf + len < last) ? len : (size_t) (last - buf); buf = ngx_cpymem(buf, v->data, len); fmt++; continue; case 'v': vv = va_arg(args, ngx_variable_value_t *); len = vv->len; len = (buf + len < last) ? len : (size_t) (last - buf); buf = ngx_cpymem(buf, vv->data, len); fmt++; continue; case 's': p = va_arg(args, u_char *); if (slen == (size_t) -1) { while (*p && buf < last) { *buf++ = *p++; } } else { len = (buf + slen < last) ? slen : (size_t) (last - buf); buf = ngx_cpymem(buf, p, len); } fmt++; continue; case 'O': i64 = (int64_t) va_arg(args, off_t); sign = 1; break; case 'P': i64 = (int64_t) va_arg(args, ngx_pid_t); sign = 1; break; case 'T': i64 = (int64_t) va_arg(args, time_t); sign = 1; break; case 'M': ms = (ngx_msec_t) va_arg(args, ngx_msec_t); if ((ngx_msec_int_t) ms == -1) { sign = 1; i64 = -1; } else { sign = 0; ui64 = (uint64_t) ms; } break; case 'z': if (sign) { i64 = (int64_t) va_arg(args, ssize_t); } else { ui64 = (uint64_t) va_arg(args, size_t); } break; case 'i': if (sign) { i64 = (int64_t) va_arg(args, ngx_int_t); } else { ui64 = (uint64_t) va_arg(args, ngx_uint_t); } if (max_width) { width = NGX_INT_T_LEN; } break; case 'd': if (sign) { i64 = (int64_t) va_arg(args, int); } else { ui64 = (uint64_t) va_arg(args, u_int); } break; case 'l': if (sign) { i64 = (int64_t) va_arg(args, long); } else { ui64 = (uint64_t) va_arg(args, u_long); } break; case 'D': if (sign) { i64 = (int64_t) va_arg(args, int32_t); } else { ui64 = (uint64_t) va_arg(args, uint32_t); } break; case 'L': if (sign) { i64 = va_arg(args, int64_t); } else { ui64 = va_arg(args, uint64_t); } break; case 'A': if (sign) { i64 = (int64_t) va_arg(args, ngx_atomic_int_t); } else { ui64 = (uint64_t) va_arg(args, ngx_atomic_uint_t); } if (max_width) { width = NGX_ATOMIC_T_LEN; } break; case 'f': f = (float) va_arg(args, double); if (f < 0) { *buf++ = '-'; f = -f; } ui64 = (int64_t) f; buf = ngx_sprintf_num(buf, last, ui64, zero, 0, width); if (frac_width) { if (buf < last) { *buf++ = '.'; } scale = 1.0; for (i = 0; i < frac_width; i++) { scale *= 10.0; } ui64 = (uint64_t) ((f - (int64_t) ui64) * scale); buf = ngx_sprintf_num(buf, last, ui64, '0', 0, frac_width); } fmt++; continue; #if !(NGX_WIN32) case 'r': i64 = (int64_t) va_arg(args, rlim_t); sign = 1; break; #endif case 'p': ui64 = (uintptr_t) va_arg(args, void *); hex = 2; sign = 0; zero = '0'; width = NGX_PTR_SIZE * 2; break; case 'c': d = va_arg(args, int); *buf++ = (u_char) (d & 0xff); fmt++; continue; case 'Z': *buf++ = '\0'; fmt++; continue; case 'N': #if (NGX_WIN32) *buf++ = CR; #endif *buf++ = LF; fmt++; continue; case '%': *buf++ = '%'; fmt++; continue; default: *buf++ = *fmt++; continue; } if (sign) { if (i64 < 0) { *buf++ = '-'; ui64 = (uint64_t) -i64; } else { ui64 = (uint64_t) i64; } } buf = ngx_sprintf_num(buf, last, ui64, zero, hex, width); fmt++; } else { *buf++ = *fmt++; } } return buf; } src/http/ngx_http_request.c:1302: error: Buffer Overrun L2 Offset: [0, 4048] Size: 2048 by call to `ngx_log_error_core`. src/http/ngx_http_request.c:1302:9: Call 1300. 1301. if (len <= 0) { 1302. ngx_log_error(NGX_LOG_INFO, r->connection->log, 0, ^ 1303. "client sent invalid host header"); 1304. ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST); src/core/ngx_log.c:67:1: Array declaration 65. #if (NGX_HAVE_VARIADIC_MACROS) 66. 67. void ^ 68. ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, 69. const char *fmt, ...) src/core/ngx_log.c:88:5: Assignment 86. } 87. 88. last = errstr + NGX_MAX_ERROR_STR; ^ 89. 90. ngx_memcpy(errstr, ngx_cached_err_log_time.data, src/core/ngx_log.c:133:13: Call 131. ? " (%d: " : " (%Xd: ", err); 132. #else 133. p = ngx_snprintf(p, last - p, " (%d: ", err); ^ 134. #endif 135. src/core/ngx_string.c:109:1: Parameter `max` 107. 108. 109. u_char * ngx_cdecl ^ 110. ngx_snprintf(u_char *buf, size_t max, const char *fmt, ...) 111. { src/core/ngx_string.c:116:9: Call 114. 115. va_start(args, fmt); 116. p = ngx_vsnprintf(buf, max, fmt, args); ^ 117. va_end(args); 118. src/core/ngx_string.c:123:1: <Length trace> 121. 122. 123. u_char * ^ 124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) 125. { src/core/ngx_string.c:123:1: Parameter `*buf` 121. 122. 123. u_char * ^ 124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) 125. { src/core/ngx_string.c:244:25: Array access: Offset: [0, 4048] Size: 2048 by call to `ngx_log_error_core` 242. if (slen == (size_t) -1) { 243. while (*p && buf < last) { 244. *buf++ = *p++; ^ 245. } 246.
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_string.c/#L244
d2a_code_trace_data_41889
static int client_hello_select_server_ctx(SSL *s, void *arg, int ignore) { const char *servername; const unsigned char *p; size_t len, remaining; HANDSHAKE_EX_DATA *ex_data = (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); if (!SSL_client_hello_get0_ext(s, TLSEXT_TYPE_server_name, &p, &remaining) || remaining <= 2) return 0; len = (*(p++) << 8); len += *(p++); if (len + 2 != remaining) return 0; remaining = len; if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name) return 0; remaining--; if (remaining <= 2) return 0; len = (*(p++) << 8); len += *(p++); if (len + 2 > remaining) return 0; remaining = len; servername = (const char *)p; if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) { SSL_CTX *new_ctx = arg; SSL_set_SSL_CTX(s, new_ctx); SSL_clear_options(s, 0xFFFFFFFFL); SSL_set_options(s, SSL_CTX_get_options(new_ctx)); ex_data->servername = SSL_TEST_SERVERNAME_SERVER2; return 1; } else if (len == strlen("server1") && strncmp(servername, "server1", len) == 0) { ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; return 1; } else if (ignore) { ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; return 1; } return 0; } test/handshake_helper.c:194: error: NULL_DEREFERENCE pointer `ex_data` last assigned on line 145 could be null and is dereferenced at line 194, column 9. Showing all 28 steps of the trace test/handshake_helper.c:140:1: start of procedure client_hello_select_server_ctx() 138. } 139. 140. > static int client_hello_select_server_ctx(SSL *s, void *arg, int ignore) 141. { 142. const char *servername; test/handshake_helper.c:145:5: 143. const unsigned char *p; 144. size_t len, remaining; 145. > HANDSHAKE_EX_DATA *ex_data = 146. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); 147. ssl/ssl_lib.c:3889:1: start of procedure SSL_get_ex_data() 3887. } 3888. 3889. > void *SSL_get_ex_data(const SSL *s, int idx) 3890. { 3891. return (CRYPTO_get_ex_data(&s->ex_data, idx)); ssl/ssl_lib.c:3891:5: 3889. void *SSL_get_ex_data(const SSL *s, int idx) 3890. { 3891. > return (CRYPTO_get_ex_data(&s->ex_data, idx)); 3892. } 3893. crypto/ex_data.c:394:1: start of procedure CRYPTO_get_ex_data() 392. * particular index in the class used by this variable 393. */ 394. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 395. { 396. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) crypto/ex_data.c:396:9: Taking true branch 394. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 395. { 396. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) ^ 397. return NULL; 398. return sk_void_value(ad->sk, idx); crypto/ex_data.c:397:9: 395. { 396. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) 397. > return NULL; 398. return sk_void_value(ad->sk, idx); 399. } crypto/ex_data.c:399:1: return from a call to CRYPTO_get_ex_data 397. return NULL; 398. return sk_void_value(ad->sk, idx); 399. > } ssl/ssl_lib.c:3892:1: return from a call to SSL_get_ex_data 3890. { 3891. return (CRYPTO_get_ex_data(&s->ex_data, idx)); 3892. > } 3893. 3894. int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg) test/handshake_helper.c:152:10: Taking false branch 150. * was written, so parsing the normal case is a bit complex. 151. */ 152. if (!SSL_client_hello_get0_ext(s, TLSEXT_TYPE_server_name, &p, ^ 153. &remaining) || 154. remaining <= 2) test/handshake_helper.c:154:9: Taking false branch 152. if (!SSL_client_hello_get0_ext(s, TLSEXT_TYPE_server_name, &p, 153. &remaining) || 154. remaining <= 2) ^ 155. return 0; 156. /* Extract the length of the supplied list of names. */ test/handshake_helper.c:157:5: 155. return 0; 156. /* Extract the length of the supplied list of names. */ 157. > len = (*(p++) << 8); 158. len += *(p++); 159. if (len + 2 != remaining) test/handshake_helper.c:158:5: 156. /* Extract the length of the supplied list of names. */ 157. len = (*(p++) << 8); 158. > len += *(p++); 159. if (len + 2 != remaining) 160. return 0; test/handshake_helper.c:159:9: Taking false branch 157. len = (*(p++) << 8); 158. len += *(p++); 159. if (len + 2 != remaining) ^ 160. return 0; 161. remaining = len; test/handshake_helper.c:161:5: 159. if (len + 2 != remaining) 160. return 0; 161. > remaining = len; 162. /* 163. * The list in practice only has a single element, so we only consider test/handshake_helper.c:166:9: Taking false branch 164. * the first one. 165. */ 166. if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name) ^ 167. return 0; 168. remaining--; test/handshake_helper.c:166:27: Taking false branch 164. * the first one. 165. */ 166. if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name) ^ 167. return 0; 168. remaining--; test/handshake_helper.c:168:5: 166. if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name) 167. return 0; 168. > remaining--; 169. /* Now we can finally pull out the byte array with the actual hostname. */ 170. if (remaining <= 2) test/handshake_helper.c:170:9: Taking false branch 168. remaining--; 169. /* Now we can finally pull out the byte array with the actual hostname. */ 170. if (remaining <= 2) ^ 171. return 0; 172. len = (*(p++) << 8); test/handshake_helper.c:172:5: 170. if (remaining <= 2) 171. return 0; 172. > len = (*(p++) << 8); 173. len += *(p++); 174. if (len + 2 > remaining) test/handshake_helper.c:173:5: 171. return 0; 172. len = (*(p++) << 8); 173. > len += *(p++); 174. if (len + 2 > remaining) 175. return 0; test/handshake_helper.c:174:9: Taking false branch 172. len = (*(p++) << 8); 173. len += *(p++); 174. if (len + 2 > remaining) ^ 175. return 0; 176. remaining = len; test/handshake_helper.c:176:5: 174. if (len + 2 > remaining) 175. return 0; 176. > remaining = len; 177. servername = (const char *)p; 178. test/handshake_helper.c:177:5: 175. return 0; 176. remaining = len; 177. > servername = (const char *)p; 178. 179. if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) { test/handshake_helper.c:179:9: Taking false branch 177. servername = (const char *)p; 178. 179. if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) { ^ 180. SSL_CTX *new_ctx = arg; 181. SSL_set_SSL_CTX(s, new_ctx); test/handshake_helper.c:192:16: Taking true branch 190. ex_data->servername = SSL_TEST_SERVERNAME_SERVER2; 191. return 1; 192. } else if (len == strlen("server1") && ^ 193. strncmp(servername, "server1", len) == 0) { 194. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; test/handshake_helper.c:193:16: Taking true branch 191. return 1; 192. } else if (len == strlen("server1") && 193. strncmp(servername, "server1", len) == 0) { ^ 194. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 195. return 1; test/handshake_helper.c:194:9: 192. } else if (len == strlen("server1") && 193. strncmp(servername, "server1", len) == 0) { 194. > ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 195. return 1; 196. } else if (ignore) {
https://github.com/openssl/openssl/blob/f1b97da1fd90cf3935eafedc8df0d0165cb75f2f/test/handshake_helper.c/#L194
d2a_code_trace_data_41890
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/exptest.c:159: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_div`. Showing all 13 steps of the trace test/exptest.c:159:10: Call 157. BN_rand(m, NUM_BITS + c, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD); 158. 159. if (!TEST_true(BN_mod(a, a, m, ctx)) ^ 160. || !TEST_true(BN_mod(b, b, m, ctx)) 161. || !TEST_true(BN_mod_exp_mont(r_mont, a, b, m, ctx, NULL)) crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth` 207. * If 'dv' or 'rm' is NULL, the respective value is not returned. 208. */ 209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 210. BN_CTX *ctx) 211. { crypto/bn/bn_div.c:229:11: Call 227. } 228. 229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx); ^ 230. 231. if (ret) { crypto/bn/bn_div.c:280:5: Call 278. bn_check_top(rm); 279. 280. BN_CTX_start(ctx); ^ 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_div.c:450:5: Call 448. if (rm != NULL) 449. bn_rshift_fixed_top(rm, snum, norm_shift); 450. BN_CTX_end(ctx); ^ 451. return 1; 452. err: crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_div` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_41891
static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){ int x, y; int_fast16_t sample_buffer[2][w+6]; int_fast16_t *sample[2]= {sample_buffer[0]+3, sample_buffer[1]+3}; s->run_index=0; memset(sample_buffer, 0, sizeof(sample_buffer)); for(y=0; y<h; y++){ int_fast16_t *temp= sample[0]; sample[0]= sample[1]; sample[1]= temp; sample[1][-1]= sample[0][0 ]; sample[0][ w]= sample[0][w-1]; decode_line(s, w, sample, plane_index, 8); for(x=0; x<w; x++){ src[x + stride*y]= sample[1][x]; } } } libavcodec/ffv1.c:783: error: Buffer Overrun L1 Offset: [3, 4] Size: 2. libavcodec/ffv1.c:770:32: <Length trace> 768. static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){ 769. int x, y; 770. int_fast16_t sample_buffer[2][w+6]; ^ 771. int_fast16_t *sample[2]= {sample_buffer[0]+3, sample_buffer[1]+3}; 772. libavcodec/ffv1.c:770:32: Array declaration 768. static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){ 769. int x, y; 770. int_fast16_t sample_buffer[2][w+6]; ^ 771. int_fast16_t *sample[2]= {sample_buffer[0]+3, sample_buffer[1]+3}; 772. libavcodec/ffv1.c:771:30: Assignment 769. int x, y; 770. int_fast16_t sample_buffer[2][w+6]; 771. int_fast16_t *sample[2]= {sample_buffer[0]+3, sample_buffer[1]+3}; ^ 772. 773. s->run_index=0; libavcodec/ffv1.c:783:24: Array access: Offset: [3, 4] Size: 2 781. sample[1]= temp; 782. 783. sample[1][-1]= sample[0][0 ]; ^ 784. sample[0][ w]= sample[0][w-1]; 785.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ffv1.c/#L783
d2a_code_trace_data_41892
static void frame_end(MpegEncContext *s) { int i; if (s->unrestricted_mv && s->current_picture.reference && !s->intra_only) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); int hshift = desc->log2_chroma_w; int vshift = desc->log2_chroma_h; s->dsp.draw_edges(s->current_picture.f->data[0], s->linesize, s->h_edge_pos, s->v_edge_pos, EDGE_WIDTH, EDGE_WIDTH, EDGE_TOP | EDGE_BOTTOM); s->dsp.draw_edges(s->current_picture.f->data[1], s->uvlinesize, s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_TOP | EDGE_BOTTOM); s->dsp.draw_edges(s->current_picture.f->data[2], s->uvlinesize, s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_TOP | EDGE_BOTTOM); } emms_c(); s->last_pict_type = s->pict_type; s->last_lambda_for [s->pict_type] = s->current_picture_ptr->f->quality; if (s->pict_type!= AV_PICTURE_TYPE_B) s->last_non_b_pict_type = s->pict_type; if (s->encoding) { for (i = 0; i < MAX_PICTURE_COUNT; i++) { if (!s->picture[i].reference) ff_mpeg_unref_picture(s, &s->picture[i]); } } s->avctx->coded_frame = s->current_picture_ptr->f; } libavcodec/mpegvideo_enc.c:1372: error: Null Dereference pointer `desc` last assigned on line 1371 could be null and is dereferenced at line 1372, column 22. libavcodec/mpegvideo_enc.c:1364:1: start of procedure frame_end() 1362. } 1363. 1364. static void frame_end(MpegEncContext *s) ^ 1365. { 1366. int i; libavcodec/mpegvideo_enc.c:1368:9: Taking true branch 1366. int i; 1367. 1368. if (s->unrestricted_mv && ^ 1369. s->current_picture.reference && 1370. !s->intra_only) { libavcodec/mpegvideo_enc.c:1369:9: Taking true branch 1367. 1368. if (s->unrestricted_mv && 1369. s->current_picture.reference && ^ 1370. !s->intra_only) { 1371. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); libavcodec/mpegvideo_enc.c:1370:10: Taking true branch 1368. if (s->unrestricted_mv && 1369. s->current_picture.reference && 1370. !s->intra_only) { ^ 1371. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); 1372. int hshift = desc->log2_chroma_w; libavcodec/mpegvideo_enc.c:1371:9: 1369. s->current_picture.reference && 1370. !s->intra_only) { 1371. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); ^ 1372. int hshift = desc->log2_chroma_w; 1373. int vshift = desc->log2_chroma_h; libavutil/pixdesc.c:1574:1: start of procedure av_pix_fmt_desc_get() 1572. } 1573. 1574. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) ^ 1575. { 1576. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) libavutil/pixdesc.c:1576:9: Taking false branch 1574. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1575. { 1576. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1577. return NULL; 1578. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1576:24: Taking true branch 1574. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1575. { 1576. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1577. return NULL; 1578. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1577:9: 1575. { 1576. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) 1577. return NULL; ^ 1578. return &av_pix_fmt_descriptors[pix_fmt]; 1579. } libavutil/pixdesc.c:1579:1: return from a call to av_pix_fmt_desc_get 1577. return NULL; 1578. return &av_pix_fmt_descriptors[pix_fmt]; 1579. } ^ 1580. 1581. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) libavcodec/mpegvideo_enc.c:1372:9: 1370. !s->intra_only) { 1371. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); 1372. int hshift = desc->log2_chroma_w; ^ 1373. int vshift = desc->log2_chroma_h; 1374. s->dsp.draw_edges(s->current_picture.f->data[0], s->linesize,
https://github.com/libav/libav/blob/d6d767d93e532246cacf3567e6bcad76a821f838/libavcodec/mpegvideo_enc.c/#L1372
d2a_code_trace_data_41893
static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st) { RTSPState *rt = s->priv_data; AVStream *st = NULL; if (rtsp_st->stream_index >= 0) st = s->streams[rtsp_st->stream_index]; if (!st) s->ctx_flags |= AVFMTCTX_NOHEADER; if (s->oformat && CONFIG_RTSP_MUXER) { rtsp_st->transport_priv = ff_rtp_chain_mux_open(s, st, rtsp_st->rtp_handle, RTSP_TCP_MAX_PACKET_SIZE); rtsp_st->rtp_handle = NULL; } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index, rtsp_st->dynamic_protocol_context, rtsp_st->dynamic_handler); else if (CONFIG_RTPDEC) rtsp_st->transport_priv = rtp_parse_open(s, st, rtsp_st->rtp_handle, rtsp_st->sdp_payload_type, (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP || !s->max_delay) ? 0 : RTP_REORDER_QUEUE_DEFAULT_SIZE); if (!rtsp_st->transport_priv) { return AVERROR(ENOMEM); } else if (rt->transport != RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) { if (rtsp_st->dynamic_handler) { rtp_parse_set_dynamic_protocol(rtsp_st->transport_priv, rtsp_st->dynamic_protocol_context, rtsp_st->dynamic_handler); } } return 0; } libavformat/rtsp.c:529: error: Null Dereference pointer `st` last assigned on line 514 could be null and is dereferenced at line 529, column 56. libavformat/rtsp.c:511:1: start of procedure rtsp_open_transport_ctx() 509. } 510. 511. static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st) ^ 512. { 513. RTSPState *rt = s->priv_data; libavformat/rtsp.c:513:5: 511. static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st) 512. { 513. RTSPState *rt = s->priv_data; ^ 514. AVStream *st = NULL; 515. libavformat/rtsp.c:514:5: 512. { 513. RTSPState *rt = s->priv_data; 514. AVStream *st = NULL; ^ 515. 516. /* open the RTP context */ libavformat/rtsp.c:517:9: Taking false branch 515. 516. /* open the RTP context */ 517. if (rtsp_st->stream_index >= 0) ^ 518. st = s->streams[rtsp_st->stream_index]; 519. if (!st) libavformat/rtsp.c:519:10: Taking true branch 517. if (rtsp_st->stream_index >= 0) 518. st = s->streams[rtsp_st->stream_index]; 519. if (!st) ^ 520. s->ctx_flags |= AVFMTCTX_NOHEADER; 521. libavformat/rtsp.c:520:9: 518. st = s->streams[rtsp_st->stream_index]; 519. if (!st) 520. s->ctx_flags |= AVFMTCTX_NOHEADER; ^ 521. 522. if (s->oformat && CONFIG_RTSP_MUXER) { libavformat/rtsp.c:522:9: Taking false branch 520. s->ctx_flags |= AVFMTCTX_NOHEADER; 521. 522. if (s->oformat && CONFIG_RTSP_MUXER) { ^ 523. rtsp_st->transport_priv = ff_rtp_chain_mux_open(s, st, 524. rtsp_st->rtp_handle, libavformat/rtsp.c:528:16: Taking true branch 526. /* Ownership of rtp_handle is passed to the rtp mux context */ 527. rtsp_st->rtp_handle = NULL; 528. } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) ^ 529. rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index, 530. rtsp_st->dynamic_protocol_context, libavformat/rtsp.c:528:55: Taking true branch 526. /* Ownership of rtp_handle is passed to the rtp mux context */ 527. rtsp_st->rtp_handle = NULL; 528. } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) ^ 529. rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index, 530. rtsp_st->dynamic_protocol_context, libavformat/rtsp.c:529:9: 527. rtsp_st->rtp_handle = NULL; 528. } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) 529. rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index, ^ 530. rtsp_st->dynamic_protocol_context, 531. rtsp_st->dynamic_handler);
https://github.com/libav/libav/blob/3cf8db9447a6c77550033acea84e30be2af7ad2c/libavformat/rtsp.c/#L529
d2a_code_trace_data_41894
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); } crypto/bn/bn_lib.c:346: error: BUFFER_OVERRUN_L3 Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, 8388607]. Showing all 10 steps of the trace crypto/bn/bn_lib.c:299:1: <Length trace> 297. /* This is used by bn_expand2() */ 298. /* The caller MUST check that words > b->dmax before calling this */ 299. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 300. { 301. BN_ULONG *A, *a = NULL; crypto/bn/bn_lib.c:299:1: Parameter `words` 297. /* This is used by bn_expand2() */ 298. /* The caller MUST check that words > b->dmax before calling this */ 299. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 300. { 301. BN_ULONG *A, *a = NULL; crypto/bn/bn_lib.c:318:17: Call 316. a = A = OPENSSL_secure_zalloc(words * sizeof(*a)); 317. else 318. a = A = OPENSSL_zalloc(words * sizeof(*a)); ^ 319. if (A == NULL) { 320. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/mem.c:156:1: Parameter `num` 154. } 155. 156. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 157. { 158. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:158:17: Call 156. void *CRYPTO_zalloc(size_t num, const char *file, int line) 157. { 158. void *ret = CRYPTO_malloc(num, file, line); ^ 159. 160. if (ret != NULL) crypto/mem.c:124:9: Assignment 122. 123. if (num <= 0) 124. return NULL; ^ 125. 126. allow_customize = 0; crypto/mem.c:158:5: Assignment 156. void *CRYPTO_zalloc(size_t num, const char *file, int line) 157. { 158. void *ret = CRYPTO_malloc(num, file, line); ^ 159. 160. if (ret != NULL) crypto/mem.c:162:5: Assignment 160. if (ret != NULL) 161. memset(ret, 0, num); 162. return ret; ^ 163. } 164. crypto/bn/bn_lib.c:318:13: Assignment 316. a = A = OPENSSL_secure_zalloc(words * sizeof(*a)); 317. else 318. a = A = OPENSSL_zalloc(words * sizeof(*a)); ^ 319. if (A == NULL) { 320. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:346:13: Array access: Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, 8388607] 344. A[1] = a1; 345. A[2] = a2; 346. A[3] = a3; ^ 347. } 348. /*
https://github.com/openssl/openssl/blob/c10d1bc81cb047cbd53f8cc430632b6a4a70252d/crypto/bn/bn_lib.c/#L346
d2a_code_trace_data_41895
static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st) { RTSPState *rt = s->priv_data; AVStream *st = NULL; if (rtsp_st->stream_index >= 0) st = s->streams[rtsp_st->stream_index]; if (!st) s->ctx_flags |= AVFMTCTX_NOHEADER; if (s->oformat && CONFIG_RTSP_MUXER) { rtsp_st->transport_priv = ff_rtp_chain_mux_open(s, st, rtsp_st->rtp_handle, RTSP_TCP_MAX_PACKET_SIZE); rtsp_st->rtp_handle = NULL; } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index, rtsp_st->dynamic_protocol_context, rtsp_st->dynamic_handler); else if (CONFIG_RTPDEC) rtsp_st->transport_priv = rtp_parse_open(s, st, rtsp_st->rtp_handle, rtsp_st->sdp_payload_type, (rt->lower_transport == RTSP_LOWER_TRANSPORT_TCP || !s->max_delay) ? 0 : RTP_REORDER_QUEUE_DEFAULT_SIZE); if (!rtsp_st->transport_priv) { return AVERROR(ENOMEM); } else if (rt->transport != RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) { if (rtsp_st->dynamic_handler) { rtp_parse_set_dynamic_protocol(rtsp_st->transport_priv, rtsp_st->dynamic_protocol_context, rtsp_st->dynamic_handler); } } return 0; } libavformat/rtsp.c:526: error: Null Dereference pointer `st` last assigned on line 511 could be null and is dereferenced at line 526, column 56. libavformat/rtsp.c:508:1: start of procedure rtsp_open_transport_ctx() 506. } 507. 508. static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st) ^ 509. { 510. RTSPState *rt = s->priv_data; libavformat/rtsp.c:510:5: 508. static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st) 509. { 510. RTSPState *rt = s->priv_data; ^ 511. AVStream *st = NULL; 512. libavformat/rtsp.c:511:5: 509. { 510. RTSPState *rt = s->priv_data; 511. AVStream *st = NULL; ^ 512. 513. /* open the RTP context */ libavformat/rtsp.c:514:9: Taking false branch 512. 513. /* open the RTP context */ 514. if (rtsp_st->stream_index >= 0) ^ 515. st = s->streams[rtsp_st->stream_index]; 516. if (!st) libavformat/rtsp.c:516:10: Taking true branch 514. if (rtsp_st->stream_index >= 0) 515. st = s->streams[rtsp_st->stream_index]; 516. if (!st) ^ 517. s->ctx_flags |= AVFMTCTX_NOHEADER; 518. libavformat/rtsp.c:517:9: 515. st = s->streams[rtsp_st->stream_index]; 516. if (!st) 517. s->ctx_flags |= AVFMTCTX_NOHEADER; ^ 518. 519. if (s->oformat && CONFIG_RTSP_MUXER) { libavformat/rtsp.c:519:9: Taking false branch 517. s->ctx_flags |= AVFMTCTX_NOHEADER; 518. 519. if (s->oformat && CONFIG_RTSP_MUXER) { ^ 520. rtsp_st->transport_priv = ff_rtp_chain_mux_open(s, st, 521. rtsp_st->rtp_handle, libavformat/rtsp.c:525:16: Taking true branch 523. /* Ownership of rtp_handle is passed to the rtp mux context */ 524. rtsp_st->rtp_handle = NULL; 525. } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) ^ 526. rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index, 527. rtsp_st->dynamic_protocol_context, libavformat/rtsp.c:525:55: Taking true branch 523. /* Ownership of rtp_handle is passed to the rtp mux context */ 524. rtsp_st->rtp_handle = NULL; 525. } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) ^ 526. rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index, 527. rtsp_st->dynamic_protocol_context, libavformat/rtsp.c:526:9: 524. rtsp_st->rtp_handle = NULL; 525. } else if (rt->transport == RTSP_TRANSPORT_RDT && CONFIG_RTPDEC) 526. rtsp_st->transport_priv = ff_rdt_parse_open(s, st->index, ^ 527. rtsp_st->dynamic_protocol_context, 528. rtsp_st->dynamic_handler);
https://github.com/libav/libav/blob/eced8fa02ea237abd9c6a6e9287bb7524addb8f4/libavformat/rtsp.c/#L526
d2a_code_trace_data_41896
static int cert_status_cb(SSL *s, void *arg) { tlsextstatusctx *srctx = arg; char *host = NULL, *port = NULL, *path = NULL; int use_ssl; unsigned char *rspder = NULL; int rspderlen; STACK_OF(OPENSSL_STRING) *aia = NULL; X509 *x = NULL; X509_STORE_CTX inctx; X509_OBJECT obj; OCSP_REQUEST *req = NULL; OCSP_RESPONSE *resp = NULL; OCSP_CERTID *id = NULL; STACK_OF(X509_EXTENSION) *exts; int ret = SSL_TLSEXT_ERR_NOACK; int i; if (srctx->verbose) BIO_puts(bio_err, "cert_status: callback called\n"); x = SSL_get_certificate(s); aia = X509_get1_ocsp(x); if (aia) { if (!OCSP_parse_url(sk_OPENSSL_STRING_value(aia, 0), &host, &port, &path, &use_ssl)) { BIO_puts(bio_err, "cert_status: can't parse AIA URL\n"); goto err; } if (srctx->verbose) BIO_printf(bio_err, "cert_status: AIA URL: %s\n", sk_OPENSSL_STRING_value(aia, 0)); } else { if (!srctx->host) { BIO_puts(bio_err, "cert_status: no AIA and no default responder URL\n"); goto done; } host = srctx->host; path = srctx->path; port = srctx->port; use_ssl = srctx->use_ssl; } if (!X509_STORE_CTX_init(&inctx, SSL_CTX_get_cert_store(SSL_get_SSL_CTX(s)), NULL, NULL)) goto err; if (X509_STORE_get_by_subject(&inctx, X509_LU_X509, X509_get_issuer_name(x), &obj) <= 0) { BIO_puts(bio_err, "cert_status: Can't retrieve issuer certificate.\n"); X509_STORE_CTX_cleanup(&inctx); goto done; } req = OCSP_REQUEST_new(); if (req == NULL) goto err; id = OCSP_cert_to_id(NULL, x, obj.data.x509); X509_free(obj.data.x509); X509_STORE_CTX_cleanup(&inctx); if (!id) goto err; if (!OCSP_request_add0_id(req, id)) goto err; id = NULL; SSL_get_tlsext_status_exts(s, &exts); for (i = 0; i < sk_X509_EXTENSION_num(exts); i++) { X509_EXTENSION *ext = sk_X509_EXTENSION_value(exts, i); if (!OCSP_REQUEST_add_ext(req, ext, -1)) goto err; } resp = process_responder(req, host, path, port, use_ssl, NULL, srctx->timeout); if (!resp) { BIO_puts(bio_err, "cert_status: error querying responder\n"); goto done; } rspderlen = i2d_OCSP_RESPONSE(resp, &rspder); if (rspderlen <= 0) goto err; SSL_set_tlsext_status_ocsp_resp(s, rspder, rspderlen); if (srctx->verbose) { BIO_puts(bio_err, "cert_status: ocsp response sent:\n"); OCSP_RESPONSE_print(bio_err, resp, 2); } ret = SSL_TLSEXT_ERR_OK; done: if (ret != SSL_TLSEXT_ERR_OK) ERR_print_errors(bio_err); if (aia) { OPENSSL_free(host); OPENSSL_free(path); OPENSSL_free(port); X509_email_free(aia); } OCSP_CERTID_free(id); OCSP_REQUEST_free(req); OCSP_RESPONSE_free(resp); return ret; err: ret = SSL_TLSEXT_ERR_ALERT_FATAL; goto done; } apps/s_server.c:642: error: NULL_DEREFERENCE pointer `x` last assigned on line 641 could be null and is dereferenced by call to `X509_get1_ocsp()` at line 642, column 11. Showing all 31 steps of the trace apps/s_server.c:620:1: start of procedure cert_status_cb() 618. */ 619. 620. > static int cert_status_cb(SSL *s, void *arg) 621. { 622. tlsextstatusctx *srctx = arg; apps/s_server.c:622:5: 620. static int cert_status_cb(SSL *s, void *arg) 621. { 622. > tlsextstatusctx *srctx = arg; 623. char *host = NULL, *port = NULL, *path = NULL; 624. int use_ssl; apps/s_server.c:623:5: 621. { 622. tlsextstatusctx *srctx = arg; 623. > char *host = NULL, *port = NULL, *path = NULL; 624. int use_ssl; 625. unsigned char *rspder = NULL; apps/s_server.c:625:5: 623. char *host = NULL, *port = NULL, *path = NULL; 624. int use_ssl; 625. > unsigned char *rspder = NULL; 626. int rspderlen; 627. STACK_OF(OPENSSL_STRING) *aia = NULL; apps/s_server.c:627:5: 625. unsigned char *rspder = NULL; 626. int rspderlen; 627. > STACK_OF(OPENSSL_STRING) *aia = NULL; 628. X509 *x = NULL; 629. X509_STORE_CTX inctx; apps/s_server.c:628:5: 626. int rspderlen; 627. STACK_OF(OPENSSL_STRING) *aia = NULL; 628. > X509 *x = NULL; 629. X509_STORE_CTX inctx; 630. X509_OBJECT obj; apps/s_server.c:631:5: 629. X509_STORE_CTX inctx; 630. X509_OBJECT obj; 631. > OCSP_REQUEST *req = NULL; 632. OCSP_RESPONSE *resp = NULL; 633. OCSP_CERTID *id = NULL; apps/s_server.c:632:5: 630. X509_OBJECT obj; 631. OCSP_REQUEST *req = NULL; 632. > OCSP_RESPONSE *resp = NULL; 633. OCSP_CERTID *id = NULL; 634. STACK_OF(X509_EXTENSION) *exts; apps/s_server.c:633:5: 631. OCSP_REQUEST *req = NULL; 632. OCSP_RESPONSE *resp = NULL; 633. > OCSP_CERTID *id = NULL; 634. STACK_OF(X509_EXTENSION) *exts; 635. int ret = SSL_TLSEXT_ERR_NOACK; apps/s_server.c:635:5: 633. OCSP_CERTID *id = NULL; 634. STACK_OF(X509_EXTENSION) *exts; 635. > int ret = SSL_TLSEXT_ERR_NOACK; 636. int i; 637. apps/s_server.c:638:9: Taking true branch 636. int i; 637. 638. if (srctx->verbose) ^ 639. BIO_puts(bio_err, "cert_status: callback called\n"); 640. /* Build up OCSP query from server certificate */ apps/s_server.c:639:9: 637. 638. if (srctx->verbose) 639. > BIO_puts(bio_err, "cert_status: callback called\n"); 640. /* Build up OCSP query from server certificate */ 641. x = SSL_get_certificate(s); crypto/bio/bio_lib.c:252:1: start of procedure BIO_puts() 250. } 251. 252. > int BIO_puts(BIO *b, const char *in) 253. { 254. int i; crypto/bio/bio_lib.c:257:10: Taking false branch 255. long (*cb) (BIO *, int, const char *, int, long, long); 256. 257. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) { ^ 258. BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD); 259. return (-2); crypto/bio/bio_lib.c:257:25: Taking false branch 255. long (*cb) (BIO *, int, const char *, int, long, long); 256. 257. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) { ^ 258. BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD); 259. return (-2); crypto/bio/bio_lib.c:257:48: Taking false branch 255. long (*cb) (BIO *, int, const char *, int, long, long); 256. 257. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) { ^ 258. BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD); 259. return (-2); crypto/bio/bio_lib.c:262:5: 260. } 261. 262. > cb = b->callback; 263. 264. if ((cb != NULL) && ((i = (int)cb(b, BIO_CB_PUTS, in, 0, 0L, 1L)) <= 0)) crypto/bio/bio_lib.c:264:10: Taking false branch 262. cb = b->callback; 263. 264. if ((cb != NULL) && ((i = (int)cb(b, BIO_CB_PUTS, in, 0, 0L, 1L)) <= 0)) ^ 265. return (i); 266. crypto/bio/bio_lib.c:267:10: Taking false branch 265. return (i); 266. 267. if (!b->init) { ^ 268. BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED); 269. return (-2); crypto/bio/bio_lib.c:272:5: Skipping __function_pointer__(): unresolved function pointer 270. } 271. 272. i = b->method->bputs(b, in); ^ 273. 274. if (i > 0) crypto/bio/bio_lib.c:274:9: Taking true branch 272. i = b->method->bputs(b, in); 273. 274. if (i > 0) ^ 275. b->num_write += (uint64_t)i; 276. crypto/bio/bio_lib.c:275:9: 273. 274. if (i > 0) 275. > b->num_write += (uint64_t)i; 276. 277. if (cb != NULL) crypto/bio/bio_lib.c:277:9: Taking false branch 275. b->num_write += (uint64_t)i; 276. 277. if (cb != NULL) ^ 278. i = (int)cb(b, BIO_CB_PUTS | BIO_CB_RETURN, in, 0, 0L, (long)i); 279. return (i); crypto/bio/bio_lib.c:279:5: 277. if (cb != NULL) 278. i = (int)cb(b, BIO_CB_PUTS | BIO_CB_RETURN, in, 0, 0L, (long)i); 279. > return (i); 280. } 281. crypto/bio/bio_lib.c:280:1: return from a call to BIO_puts 278. i = (int)cb(b, BIO_CB_PUTS | BIO_CB_RETURN, in, 0, 0L, (long)i); 279. return (i); 280. > } 281. 282. int BIO_gets(BIO *b, char *in, int inl) apps/s_server.c:641:5: 639. BIO_puts(bio_err, "cert_status: callback called\n"); 640. /* Build up OCSP query from server certificate */ 641. > x = SSL_get_certificate(s); 642. aia = X509_get1_ocsp(x); 643. if (aia) { ssl/ssl_lib.c:2756:1: start of procedure SSL_get_certificate() 2754. } 2755. 2756. > X509 *SSL_get_certificate(const SSL *s) 2757. { 2758. if (s->cert != NULL) ssl/ssl_lib.c:2758:9: Taking false branch 2756. X509 *SSL_get_certificate(const SSL *s) 2757. { 2758. if (s->cert != NULL) ^ 2759. return (s->cert->key->x509); 2760. else ssl/ssl_lib.c:2761:9: 2759. return (s->cert->key->x509); 2760. else 2761. > return (NULL); 2762. } 2763. ssl/ssl_lib.c:2762:1: return from a call to SSL_get_certificate 2760. else 2761. return (NULL); 2762. > } 2763. 2764. EVP_PKEY *SSL_get_privatekey(const SSL *s) apps/s_server.c:642:5: 640. /* Build up OCSP query from server certificate */ 641. x = SSL_get_certificate(s); 642. > aia = X509_get1_ocsp(x); 643. if (aia) { 644. if (!OCSP_parse_url(sk_OPENSSL_STRING_value(aia, 0),
https://github.com/openssl/openssl/blob/5705e05037938623f701092ec84dae90d191091c/apps/s_server.c/#L642
d2a_code_trace_data_41897
char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) { X509_NAME_ENTRY *ne; int i; int n, lold, l, l1, l2, num, j, type; const char *s; char *p; unsigned char *q; BUF_MEM *b = NULL; static const char hex[17] = "0123456789ABCDEF"; int gs_doit[4]; char tmp_buf[80]; #ifdef CHARSET_EBCDIC unsigned char ebcdic_buf[1024]; #endif if (buf == NULL) { if ((b = BUF_MEM_new()) == NULL) goto err; if (!BUF_MEM_grow(b, 200)) goto err; b->data[0] = '\0'; len = 200; } else if (len == 0) { return NULL; } if (a == NULL) { if (b) { buf = b->data; OPENSSL_free(b); } strncpy(buf, "NO X509_NAME", len); buf[len - 1] = '\0'; return buf; } len--; l = 0; for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { ne = sk_X509_NAME_ENTRY_value(a->entries, i); n = OBJ_obj2nid(ne->object); if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) { i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object); s = tmp_buf; } l1 = strlen(s); type = ne->value->type; num = ne->value->length; if (num > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } q = ne->value->data; #ifdef CHARSET_EBCDIC if (type == V_ASN1_GENERALSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_PRINTABLESTRING || type == V_ASN1_TELETEXSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_IA5STRING) { ascii2ebcdic(ebcdic_buf, q, (num > (int)sizeof(ebcdic_buf)) ? (int)sizeof(ebcdic_buf) : num); q = ebcdic_buf; } #endif if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) { gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0; for (j = 0; j < num; j++) if (q[j] != 0) gs_doit[j & 3] = 1; if (gs_doit[0] | gs_doit[1] | gs_doit[2]) gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; else { gs_doit[0] = gs_doit[1] = gs_doit[2] = 0; gs_doit[3] = 1; } } else gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; for (l2 = j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; l2++; #ifndef CHARSET_EBCDIC if ((q[j] < ' ') || (q[j] > '~')) l2 += 3; #else if ((os_toascii[q[j]] < os_toascii[' ']) || (os_toascii[q[j]] > os_toascii['~'])) l2 += 3; #endif } lold = l; l += 1 + l1 + 1 + l2; if (l > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } if (b != NULL) { if (!BUF_MEM_grow(b, l + 1)) goto err; p = &(b->data[lold]); } else if (l > len) { break; } else p = &(buf[lold]); *(p++) = '/'; memcpy(p, s, (unsigned int)l1); p += l1; *(p++) = '='; #ifndef CHARSET_EBCDIC q = ne->value->data; #endif for (j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; #ifndef CHARSET_EBCDIC n = q[j]; if ((n < ' ') || (n > '~')) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = n; #else n = os_toascii[q[j]]; if ((n < os_toascii[' ']) || (n > os_toascii['~'])) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = q[j]; #endif } *p = '\0'; } if (b != NULL) { p = b->data; OPENSSL_free(b); } else p = buf; if (i == 0) *p = '\0'; return (p); err: X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE); end: BUF_MEM_free(b); return (NULL); } apps/apps.c:257: error: BUFFER_OVERRUN_L3 Offset: [-1, 199] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace apps/apps.c:257:9: Call 255. char *p; 256. 257. p = X509_NAME_oneline(X509_get_subject_name(x), NULL, 0); ^ 258. BIO_puts(out, "subject="); 259. BIO_puts(out, p); crypto/x509/x509_obj.c:73:1: <Offset trace> 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:73:1: Parameter `len` 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:73:1: <Length trace> 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:73:1: Parameter `*buf` 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:105:9: Array access: Offset: [-1, 199] Size: [1, 2147483644] by call to `X509_NAME_oneline` 103. } 104. strncpy(buf, "NO X509_NAME", len); 105. buf[len - 1] = '\0'; ^ 106. return buf; 107. }
https://github.com/openssl/openssl/blob/24c2cd3967ed23acc0bd31a3781c4525e2e42a2c/crypto/x509/x509_obj.c/#L105
d2a_code_trace_data_41898
int ec_precompute_mont_data(EC_GROUP *group) { BN_CTX *ctx = BN_CTX_new(); int ret = 0; BN_MONT_CTX_free(group->mont_data); group->mont_data = NULL; if (ctx == NULL) goto err; group->mont_data = BN_MONT_CTX_new(); if (group->mont_data == NULL) goto err; if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)) { BN_MONT_CTX_free(group->mont_data); group->mont_data = NULL; goto err; } ret = 1; err: BN_CTX_free(ctx); return ret; } crypto/ec/ec_lib.c:1083: error: MEMORY_LEAK memory dynamically allocated to `group->mont_data` by call to `BN_MONT_CTX_new()` at line 1077, column 24 is not reachable after line 1083, column 9. Showing all 65 steps of the trace crypto/ec/ec_lib.c:1066:1: start of procedure ec_precompute_mont_data() 1064. * returns one on success. On error it returns zero. 1065. */ 1066. > int ec_precompute_mont_data(EC_GROUP *group) 1067. { 1068. BN_CTX *ctx = BN_CTX_new(); crypto/ec/ec_lib.c:1068:5: 1066. int ec_precompute_mont_data(EC_GROUP *group) 1067. { 1068. > BN_CTX *ctx = BN_CTX_new(); 1069. int ret = 0; 1070. crypto/bn/bn_ctx.c:189:1: start of procedure BN_CTX_new() 187. 188. 189. > BN_CTX *BN_CTX_new(void) 190. { 191. BN_CTX *ret; crypto/bn/bn_ctx.c:193:9: 191. BN_CTX *ret; 192. 193. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE); 195. return NULL; crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_ctx.c:193:9: Taking false branch 191. BN_CTX *ret; 192. 193. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE); 195. return NULL; crypto/bn/bn_ctx.c:198:5: 196. } 197. /* Initialise the structure */ 198. > BN_POOL_init(&ret->pool); 199. BN_STACK_init(&ret->stack); 200. return ret; crypto/bn/bn_ctx.c:335:1: start of procedure BN_POOL_init() 333. /***********/ 334. 335. > static void BN_POOL_init(BN_POOL *p) 336. { 337. p->head = p->current = p->tail = NULL; crypto/bn/bn_ctx.c:337:5: 335. static void BN_POOL_init(BN_POOL *p) 336. { 337. > p->head = p->current = p->tail = NULL; 338. p->used = p->size = 0; 339. } crypto/bn/bn_ctx.c:338:5: 336. { 337. p->head = p->current = p->tail = NULL; 338. > p->used = p->size = 0; 339. } 340. crypto/bn/bn_ctx.c:339:1: return from a call to BN_POOL_init 337. p->head = p->current = p->tail = NULL; 338. p->used = p->size = 0; 339. > } 340. 341. static void BN_POOL_finish(BN_POOL *p) crypto/bn/bn_ctx.c:199:5: 197. /* Initialise the structure */ 198. BN_POOL_init(&ret->pool); 199. > BN_STACK_init(&ret->stack); 200. return ret; 201. } crypto/bn/bn_ctx.c:294:1: start of procedure BN_STACK_init() 292. /************/ 293. 294. > static void BN_STACK_init(BN_STACK *st) 295. { 296. st->indexes = NULL; crypto/bn/bn_ctx.c:296:5: 294. static void BN_STACK_init(BN_STACK *st) 295. { 296. > st->indexes = NULL; 297. st->depth = st->size = 0; 298. } crypto/bn/bn_ctx.c:297:5: 295. { 296. st->indexes = NULL; 297. > st->depth = st->size = 0; 298. } 299. crypto/bn/bn_ctx.c:298:1: return from a call to BN_STACK_init 296. st->indexes = NULL; 297. st->depth = st->size = 0; 298. > } 299. 300. static void BN_STACK_finish(BN_STACK *st) crypto/bn/bn_ctx.c:200:5: 198. BN_POOL_init(&ret->pool); 199. BN_STACK_init(&ret->stack); 200. > return ret; 201. } 202. crypto/bn/bn_ctx.c:201:1: return from a call to BN_CTX_new 199. BN_STACK_init(&ret->stack); 200. return ret; 201. > } 202. 203. BN_CTX *BN_CTX_secure_new(void) crypto/ec/ec_lib.c:1069:5: 1067. { 1068. BN_CTX *ctx = BN_CTX_new(); 1069. > int ret = 0; 1070. 1071. BN_MONT_CTX_free(group->mont_data); crypto/ec/ec_lib.c:1071:5: Skipping BN_MONT_CTX_free(): empty list of specs 1069. int ret = 0; 1070. 1071. BN_MONT_CTX_free(group->mont_data); ^ 1072. group->mont_data = NULL; 1073. crypto/ec/ec_lib.c:1072:5: 1070. 1071. BN_MONT_CTX_free(group->mont_data); 1072. > group->mont_data = NULL; 1073. 1074. if (ctx == NULL) crypto/ec/ec_lib.c:1074:9: Taking false branch 1072. group->mont_data = NULL; 1073. 1074. if (ctx == NULL) ^ 1075. goto err; 1076. crypto/ec/ec_lib.c:1077:5: 1075. goto err; 1076. 1077. > group->mont_data = BN_MONT_CTX_new(); 1078. if (group->mont_data == NULL) 1079. goto err; crypto/bn/bn_mont.c:315:1: start of procedure BN_MONT_CTX_new() 313. } 314. 315. > BN_MONT_CTX *BN_MONT_CTX_new(void) 316. { 317. BN_MONT_CTX *ret; crypto/bn/bn_mont.c:319:9: 317. BN_MONT_CTX *ret; 318. 319. > if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) 320. return (NULL); 321. crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/bn/bn_mont.c:319:9: Taking false branch 317. BN_MONT_CTX *ret; 318. 319. if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) ^ 320. return (NULL); 321. crypto/bn/bn_mont.c:322:5: 320. return (NULL); 321. 322. > BN_MONT_CTX_init(ret); 323. ret->flags = BN_FLG_MALLOCED; 324. return (ret); crypto/bn/bn_mont.c:327:1: start of procedure BN_MONT_CTX_init() 325. } 326. 327. > void BN_MONT_CTX_init(BN_MONT_CTX *ctx) 328. { 329. ctx->ri = 0; crypto/bn/bn_mont.c:329:5: 327. void BN_MONT_CTX_init(BN_MONT_CTX *ctx) 328. { 329. > ctx->ri = 0; 330. bn_init(&(ctx->RR)); 331. bn_init(&(ctx->N)); crypto/bn/bn_mont.c:330:5: Skipping bn_init(): empty list of specs 328. { 329. ctx->ri = 0; 330. bn_init(&(ctx->RR)); ^ 331. bn_init(&(ctx->N)); 332. bn_init(&(ctx->Ni)); crypto/bn/bn_mont.c:331:5: Skipping bn_init(): empty list of specs 329. ctx->ri = 0; 330. bn_init(&(ctx->RR)); 331. bn_init(&(ctx->N)); ^ 332. bn_init(&(ctx->Ni)); 333. ctx->n0[0] = ctx->n0[1] = 0; crypto/bn/bn_mont.c:332:5: Skipping bn_init(): empty list of specs 330. bn_init(&(ctx->RR)); 331. bn_init(&(ctx->N)); 332. bn_init(&(ctx->Ni)); ^ 333. ctx->n0[0] = ctx->n0[1] = 0; 334. ctx->flags = 0; crypto/bn/bn_mont.c:333:5: 331. bn_init(&(ctx->N)); 332. bn_init(&(ctx->Ni)); 333. > ctx->n0[0] = ctx->n0[1] = 0; 334. ctx->flags = 0; 335. } crypto/bn/bn_mont.c:334:5: 332. bn_init(&(ctx->Ni)); 333. ctx->n0[0] = ctx->n0[1] = 0; 334. > ctx->flags = 0; 335. } 336. crypto/bn/bn_mont.c:335:1: return from a call to BN_MONT_CTX_init 333. ctx->n0[0] = ctx->n0[1] = 0; 334. ctx->flags = 0; 335. > } 336. 337. void BN_MONT_CTX_free(BN_MONT_CTX *mont) crypto/bn/bn_mont.c:323:5: 321. 322. BN_MONT_CTX_init(ret); 323. > ret->flags = BN_FLG_MALLOCED; 324. return (ret); 325. } crypto/bn/bn_mont.c:324:5: 322. BN_MONT_CTX_init(ret); 323. ret->flags = BN_FLG_MALLOCED; 324. > return (ret); 325. } 326. crypto/bn/bn_mont.c:325:1: return from a call to BN_MONT_CTX_new 323. ret->flags = BN_FLG_MALLOCED; 324. return (ret); 325. > } 326. 327. void BN_MONT_CTX_init(BN_MONT_CTX *ctx) crypto/ec/ec_lib.c:1078:9: Taking false branch 1076. 1077. group->mont_data = BN_MONT_CTX_new(); 1078. if (group->mont_data == NULL) ^ 1079. goto err; 1080. crypto/ec/ec_lib.c:1081:10: Taking true branch 1079. goto err; 1080. 1081. if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)) { ^ 1082. BN_MONT_CTX_free(group->mont_data); 1083. group->mont_data = NULL; crypto/ec/ec_lib.c:1082:9: Skipping BN_MONT_CTX_free(): empty list of specs 1080. 1081. if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)) { 1082. BN_MONT_CTX_free(group->mont_data); ^ 1083. group->mont_data = NULL; 1084. goto err; crypto/ec/ec_lib.c:1083:9: 1081. if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)) { 1082. BN_MONT_CTX_free(group->mont_data); 1083. > group->mont_data = NULL; 1084. goto err; 1085. }
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/ec/ec_lib.c/#L1083
d2a_code_trace_data_41899
static ossl_inline void packet_forward(PACKET *pkt, size_t len) { pkt->curr += len; pkt->remaining -= len; } test/packettest.c:296: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 252):unsigned64 by call to `PACKET_forward`. Showing all 16 steps of the trace test/packettest.c:292:10: Call 290. PACKET pkt; 291. 292. if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN)) ^ 293. || !TEST_true(PACKET_forward(&pkt, 1)) 294. || !TEST_true(PACKET_get_bytes(&pkt, &byte, 1)) ssl/packet_locl.h:72:8: Parameter `pkt->remaining` 70. * is being used. 71. */ 72. __owur static ossl_inline int PACKET_buf_init(PACKET *pkt, ^ 73. const unsigned char *buf, 74. size_t len) test/packettest.c:293:17: Call 291. 292. if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN)) 293. || !TEST_true(PACKET_forward(&pkt, 1)) ^ 294. || !TEST_true(PACKET_get_bytes(&pkt, &byte, 1)) 295. || !TEST_uchar_eq(byte[0], 4) ssl/packet_locl.h:467:8: Parameter `len` 465. 466. /* Move the current reading position forward |len| bytes */ 467. __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len) ^ 468. { 469. if (PACKET_remaining(pkt) < len) test/packettest.c:294:17: Call 292. if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN)) 293. || !TEST_true(PACKET_forward(&pkt, 1)) 294. || !TEST_true(PACKET_get_bytes(&pkt, &byte, 1)) ^ 295. || !TEST_uchar_eq(byte[0], 4) 296. || !TEST_true(PACKET_forward(&pkt, BUF_LEN - 3)) ssl/packet_locl.h:350:8: Parameter `pkt->remaining` 348. * freed 349. */ 350. __owur static ossl_inline int PACKET_get_bytes(PACKET *pkt, ^ 351. const unsigned char **data, 352. size_t len) ssl/packet_locl.h:354:10: Call 352. size_t len) 353. { 354. if (!PACKET_peek_bytes(pkt, data, len)) ^ 355. return 0; 356. ssl/packet_locl.h:332:8: Parameter `len` 330. * underlying buffer gets freed 331. */ 332. __owur static ossl_inline int PACKET_peek_bytes(const PACKET *pkt, ^ 333. const unsigned char **data, 334. size_t len) test/packettest.c:296:17: Call 294. || !TEST_true(PACKET_get_bytes(&pkt, &byte, 1)) 295. || !TEST_uchar_eq(byte[0], 4) 296. || !TEST_true(PACKET_forward(&pkt, BUF_LEN - 3)) ^ 297. || !TEST_true(PACKET_get_bytes(&pkt, &byte, 1)) 298. || !TEST_uchar_eq(byte[0], 0xfe)) ssl/packet_locl.h:467:8: Parameter `len` 465. 466. /* Move the current reading position forward |len| bytes */ 467. __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len) ^ 468. { 469. if (PACKET_remaining(pkt) < len) ssl/packet_locl.h:472:5: Call 470. return 0; 471. 472. packet_forward(pkt, len); ^ 473. 474. return 1; ssl/packet_locl.h:33:1: <LHS trace> 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: Parameter `pkt->remaining` 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: <RHS trace> 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: Parameter `len` 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:36:5: Binary operation: ([0, +oo] - 252):unsigned64 by call to `PACKET_forward` 34. { 35. pkt->curr += len; 36. pkt->remaining -= len; ^ 37. } 38.
https://github.com/openssl/openssl/blob/424aa352458486d67e1e9cd3d3990dc06a60ba4a/ssl/packet_locl.h/#L36
d2a_code_trace_data_41900
static inline unsigned int constant_time_lt(unsigned int a, unsigned int b) { return constant_time_msb(a ^ ((a ^ b) | ((a - b) ^ b))); } ssl/record/rec_layer_d1.c:366: error: INTEGER_OVERFLOW_L2 ([0, 17727] - [0, 17728]):unsigned32 by call to `dtls1_process_record`. Showing all 15 steps of the trace ssl/record/rec_layer_d1.c:353:1: Parameter `s->rlayer.rrec.length` 351. 352. 353. > int dtls1_process_buffered_records(SSL *s) 354. { 355. pitem *item; ssl/record/rec_layer_d1.c:366:18: Call 364. while (pqueue_peek(s->rlayer.d->unprocessed_rcds.q)) { 365. dtls1_get_unprocessed_record(s); 366. if (!dtls1_process_record(s)) ^ 367. return (0); 368. if (dtls1_buffer_record(s, &(s->rlayer.d->processed_rcds), ssl/record/ssl3_record.c:1199:1: Parameter `s->rlayer.rrec.length` 1197. } 1198. 1199. > int dtls1_process_record(SSL *s) 1200. { 1201. int i, al; ssl/record/ssl3_record.c:1295:13: Call 1293. */ 1294. mac = mac_tmp; 1295. ssl3_cbc_copy_mac(mac_tmp, rr, mac_size); ^ 1296. rr->length -= mac_size; 1297. } else { ssl/record/ssl3_record.c:1122:1: Parameter `md_size` 1120. #define CBC_MAC_ROTATE_IN_PLACE 1121. 1122. > void ssl3_cbc_copy_mac(unsigned char *out, 1123. const SSL3_RECORD *rec, unsigned md_size) 1124. { ssl/record/ssl3_record.c:1171:35: Call 1169. for (i = scan_start, j = 0; i < rec->orig_len; i++) { 1170. unsigned char mac_started = constant_time_ge_8(i, mac_start); 1171. unsigned char mac_ended = constant_time_ge_8(i, mac_end); ^ 1172. unsigned char b = rec->data[i]; 1173. rotated_mac[j++] |= b & mac_started & ~mac_ended; crypto/constant_time_locl.h:153:1: Parameter `a` 151. } 152. 153. > static inline unsigned char constant_time_ge_8(unsigned int a, unsigned int b) 154. { 155. return (unsigned char)(constant_time_ge(a, b)); crypto/constant_time_locl.h:155:28: Call 153. static inline unsigned char constant_time_ge_8(unsigned int a, unsigned int b) 154. { 155. return (unsigned char)(constant_time_ge(a, b)); ^ 156. } 157. crypto/constant_time_locl.h:148:1: Parameter `a` 146. } 147. 148. > static inline unsigned int constant_time_ge(unsigned int a, unsigned int b) 149. { 150. return ~constant_time_lt(a, b); crypto/constant_time_locl.h:150:13: Call 148. static inline unsigned int constant_time_ge(unsigned int a, unsigned int b) 149. { 150. return ~constant_time_lt(a, b); ^ 151. } 152. crypto/constant_time_locl.h:138:1: <LHS trace> 136. } 137. 138. > static inline unsigned int constant_time_lt(unsigned int a, unsigned int b) 139. { 140. return constant_time_msb(a ^ ((a ^ b) | ((a - b) ^ b))); crypto/constant_time_locl.h:138:1: Parameter `a` 136. } 137. 138. > static inline unsigned int constant_time_lt(unsigned int a, unsigned int b) 139. { 140. return constant_time_msb(a ^ ((a ^ b) | ((a - b) ^ b))); crypto/constant_time_locl.h:138:1: <RHS trace> 136. } 137. 138. > static inline unsigned int constant_time_lt(unsigned int a, unsigned int b) 139. { 140. return constant_time_msb(a ^ ((a ^ b) | ((a - b) ^ b))); crypto/constant_time_locl.h:138:1: Parameter `b` 136. } 137. 138. > static inline unsigned int constant_time_lt(unsigned int a, unsigned int b) 139. { 140. return constant_time_msb(a ^ ((a ^ b) | ((a - b) ^ b))); crypto/constant_time_locl.h:140:12: Binary operation: ([0, 17727] - [0, 17728]):unsigned32 by call to `dtls1_process_record` 138. static inline unsigned int constant_time_lt(unsigned int a, unsigned int b) 139. { 140. return constant_time_msb(a ^ ((a ^ b) | ((a - b) ^ b))); ^ 141. } 142.
https://github.com/openssl/openssl/blob/747e16398d704a667cc99f8a0b1912c36b7de52d/crypto/constant_time_locl.h/#L140
d2a_code_trace_data_41901
static void truespeech_correlate_filter(TSContext *dec) { int16_t tmp[8]; int i, j; for(i = 0; i < 8; i++){ if(i > 0){ memcpy(tmp, dec->cvector, i * 2); for(j = 0; j < i; j++) dec->cvector[j] = ((tmp[i - j - 1] * dec->vector[i]) + (dec->cvector[j] << 15) + 0x4000) >> 15; } dec->cvector[i] = (8 - dec->vector[i]) >> 3; } for(i = 0; i < 8; i++) dec->cvector[i] = (dec->cvector[i] * ts_230[i]) >> 15; dec->filtval = dec->vector[0]; } libavcodec/truespeech.c:159: error: Buffer Overrun L3 Offset: [-6, 6] Size: 8. libavcodec/truespeech.c:155:9: <Offset trace> 153. int i, j; 154. 155. for(i = 0; i < 8; i++){ ^ 156. if(i > 0){ 157. memcpy(tmp, dec->cvector, i * 2); libavcodec/truespeech.c:155:9: Assignment 153. int i, j; 154. 155. for(i = 0; i < 8; i++){ ^ 156. if(i > 0){ 157. memcpy(tmp, dec->cvector, i * 2); libavcodec/truespeech.c:150:1: <Length trace> 148. } 149. 150. static void truespeech_correlate_filter(TSContext *dec) ^ 151. { 152. int16_t tmp[8]; libavcodec/truespeech.c:150:1: Array declaration 148. } 149. 150. static void truespeech_correlate_filter(TSContext *dec) ^ 151. { 152. int16_t tmp[8]; libavcodec/truespeech.c:159:37: Array access: Offset: [-6, 6] Size: 8 157. memcpy(tmp, dec->cvector, i * 2); 158. for(j = 0; j < i; j++) 159. dec->cvector[j] = ((tmp[i - j - 1] * dec->vector[i]) + ^ 160. (dec->cvector[j] << 15) + 0x4000) >> 15; 161. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/truespeech.c/#L159
d2a_code_trace_data_41902
static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p, char *passwd, BIO *out, int quiet, int table, int reverse, size_t pw_maxlen, passwd_modes mode) { char *hash = NULL; assert(salt_p != NULL); assert(salt_malloc_p != NULL); if (!passed_salt) { # ifndef OPENSSL_NO_DES if (mode == passwd_crypt) { if (*salt_malloc_p == NULL) *salt_p = *salt_malloc_p = app_malloc(3, "salt buffer"); if (RAND_bytes((unsigned char *)*salt_p, 2) <= 0) goto end; (*salt_p)[0] = cov_2char[(*salt_p)[0] & 0x3f]; (*salt_p)[1] = cov_2char[(*salt_p)[1] & 0x3f]; (*salt_p)[2] = 0; # ifdef CHARSET_EBCDIC ascii2ebcdic(*salt_p, *salt_p, 2); # endif } # endif # ifndef NO_MD5CRYPT_1 if (mode == passwd_md5 || mode == passwd_apr1 || mode == passwd_aixmd5) { int i; if (*salt_malloc_p == NULL) *salt_p = *salt_malloc_p = app_malloc(9, "salt buffer"); if (RAND_bytes((unsigned char *)*salt_p, 8) <= 0) goto end; for (i = 0; i < 8; i++) (*salt_p)[i] = cov_2char[(*salt_p)[i] & 0x3f]; (*salt_p)[8] = 0; } # endif # ifndef NO_SHACRYPT if (mode == passwd_sha256 || mode == passwd_sha512) { int i; if (*salt_malloc_p == NULL) *salt_p = *salt_malloc_p = app_malloc(17, "salt buffer"); if (RAND_bytes((unsigned char *)*salt_p, 16) <= 0) goto end; for (i = 0; i < 16; i++) (*salt_p)[i] = cov_2char[(*salt_p)[i] & 0x3f]; (*salt_p)[16] = 0; } # endif } assert(*salt_p != NULL); if ((strlen(passwd) > pw_maxlen)) { if (!quiet) BIO_printf(bio_err, "Warning: truncating password to %u characters\n", (unsigned)pw_maxlen); passwd[pw_maxlen] = 0; } assert(strlen(passwd) <= pw_maxlen); # ifndef OPENSSL_NO_DES if (mode == passwd_crypt) hash = DES_crypt(passwd, *salt_p); # endif # ifndef NO_MD5CRYPT_1 if (mode == passwd_md5 || mode == passwd_apr1) hash = md5crypt(passwd, (mode == passwd_md5 ? "1" : "apr1"), *salt_p); if (mode == passwd_aixmd5) hash = md5crypt(passwd, "", *salt_p); # endif # ifndef NO_SHACRYPT if (mode == passwd_sha256 || mode == passwd_sha512) hash = shacrypt(passwd, (mode == passwd_sha256 ? "5" : "6"), *salt_p); # endif assert(hash != NULL); if (table && !reverse) BIO_printf(out, "%s\t%s\n", passwd, hash); else if (table && reverse) BIO_printf(out, "%s\t%s\n", hash, passwd); else BIO_printf(out, "%s\n", hash); return 1; end: return 0; } apps/passwd.c:280: error: BUFFER_OVERRUN_L3 Offset: 16 Size: [3, 17] by call to `do_passwd`. Showing all 5 steps of the trace apps/passwd.c:101:5: Assignment 99. { 100. BIO *in = NULL; 101. char *infile = NULL, *salt = NULL, *passwd = NULL, **passwds = NULL; ^ 102. char *salt_malloc = NULL, *passwd_malloc = NULL, *prog; 103. OPTION_CHOICE o; apps/passwd.c:280:18: Call 278. do { /* loop over list of passwords */ 279. passwd = *passwds++; 280. if (!do_passwd(passed_salt, &salt, &salt_malloc, passwd, bio_out, ^ 281. quiet, table, reverse, pw_maxlen, mode)) 282. goto end; apps/passwd.c:744:1: <Length trace> 742. # endif 743. 744. > static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p, 745. char *passwd, BIO *out, int quiet, int table, 746. int reverse, size_t pw_maxlen, passwd_modes mode) apps/passwd.c:744:1: Parameter `**salt_p` 742. # endif 743. 744. > static int do_passwd(int passed_salt, char **salt_p, char **salt_malloc_p, 745. char *passwd, BIO *out, int quiet, int table, 746. int reverse, size_t pw_maxlen, passwd_modes mode) apps/passwd.c:797:13: Array access: Offset: 16 Size: [3, 17] by call to `do_passwd` 795. for (i = 0; i < 16; i++) 796. (*salt_p)[i] = cov_2char[(*salt_p)[i] & 0x3f]; /* 6 bits */ 797. (*salt_p)[16] = 0; ^ 798. } 799. # endif /* !NO_SHACRYPT */
https://github.com/openssl/openssl/blob/f1b8b0010a5cdd76d1284ea47e9b5995dcd6f089/apps/passwd.c/#L797
d2a_code_trace_data_41903
u_char * ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) { u_char *p, zero, *last; int d; float f, scale; size_t len, slen; int64_t i64; uint64_t ui64; ngx_msec_t ms; ngx_uint_t width, sign, hex, max_width, frac_width, i; ngx_str_t *v; ngx_variable_value_t *vv; if (max == 0) { return buf; } last = buf + max; while (*fmt && buf < last) { if (*fmt == '%') { i64 = 0; ui64 = 0; zero = (u_char) ((*++fmt == '0') ? '0' : ' '); width = 0; sign = 1; hex = 0; max_width = 0; frac_width = 0; slen = (size_t) -1; while (*fmt >= '0' && *fmt <= '9') { width = width * 10 + *fmt++ - '0'; } for ( ;; ) { switch (*fmt) { case 'u': sign = 0; fmt++; continue; case 'm': max_width = 1; fmt++; continue; case 'X': hex = 2; sign = 0; fmt++; continue; case 'x': hex = 1; sign = 0; fmt++; continue; case '.': fmt++; while (*fmt >= '0' && *fmt <= '9') { frac_width = frac_width * 10 + *fmt++ - '0'; } break; case '*': slen = va_arg(args, size_t); fmt++; continue; default: break; } break; } switch (*fmt) { case 'V': v = va_arg(args, ngx_str_t *); len = v->len; len = (buf + len < last) ? len : (size_t) (last - buf); buf = ngx_cpymem(buf, v->data, len); fmt++; continue; case 'v': vv = va_arg(args, ngx_variable_value_t *); len = vv->len; len = (buf + len < last) ? len : (size_t) (last - buf); buf = ngx_cpymem(buf, vv->data, len); fmt++; continue; case 's': p = va_arg(args, u_char *); if (slen == (size_t) -1) { while (*p && buf < last) { *buf++ = *p++; } } else { len = (buf + slen < last) ? slen : (size_t) (last - buf); buf = ngx_cpymem(buf, p, len); } fmt++; continue; case 'O': i64 = (int64_t) va_arg(args, off_t); sign = 1; break; case 'P': i64 = (int64_t) va_arg(args, ngx_pid_t); sign = 1; break; case 'T': i64 = (int64_t) va_arg(args, time_t); sign = 1; break; case 'M': ms = (ngx_msec_t) va_arg(args, ngx_msec_t); if ((ngx_msec_int_t) ms == -1) { sign = 1; i64 = -1; } else { sign = 0; ui64 = (uint64_t) ms; } break; case 'z': if (sign) { i64 = (int64_t) va_arg(args, ssize_t); } else { ui64 = (uint64_t) va_arg(args, size_t); } break; case 'i': if (sign) { i64 = (int64_t) va_arg(args, ngx_int_t); } else { ui64 = (uint64_t) va_arg(args, ngx_uint_t); } if (max_width) { width = NGX_INT_T_LEN; } break; case 'd': if (sign) { i64 = (int64_t) va_arg(args, int); } else { ui64 = (uint64_t) va_arg(args, u_int); } break; case 'l': if (sign) { i64 = (int64_t) va_arg(args, long); } else { ui64 = (uint64_t) va_arg(args, u_long); } break; case 'D': if (sign) { i64 = (int64_t) va_arg(args, int32_t); } else { ui64 = (uint64_t) va_arg(args, uint32_t); } break; case 'L': if (sign) { i64 = va_arg(args, int64_t); } else { ui64 = va_arg(args, uint64_t); } break; case 'A': if (sign) { i64 = (int64_t) va_arg(args, ngx_atomic_int_t); } else { ui64 = (uint64_t) va_arg(args, ngx_atomic_uint_t); } if (max_width) { width = NGX_ATOMIC_T_LEN; } break; case 'f': f = (float) va_arg(args, double); if (f < 0) { *buf++ = '-'; f = -f; } ui64 = (int64_t) f; buf = ngx_sprintf_num(buf, last, ui64, zero, 0, width); if (frac_width) { if (buf < last) { *buf++ = '.'; } scale = 1.0; for (i = 0; i < frac_width; i++) { scale *= 10.0; } ui64 = (uint64_t) ((f - (int64_t) ui64) * scale); buf = ngx_sprintf_num(buf, last, ui64, '0', 0, frac_width); } fmt++; continue; #if !(NGX_WIN32) case 'r': i64 = (int64_t) va_arg(args, rlim_t); sign = 1; break; #endif case 'p': ui64 = (uintptr_t) va_arg(args, void *); hex = 2; sign = 0; zero = '0'; width = NGX_PTR_SIZE * 2; break; case 'c': d = va_arg(args, int); *buf++ = (u_char) (d & 0xff); fmt++; continue; case 'Z': *buf++ = '\0'; fmt++; continue; case 'N': #if (NGX_WIN32) *buf++ = CR; #endif *buf++ = LF; fmt++; continue; case '%': *buf++ = '%'; fmt++; continue; default: *buf++ = *fmt++; continue; } if (sign) { if (i64 < 0) { *buf++ = '-'; ui64 = (uint64_t) -i64; } else { ui64 = (uint64_t) i64; } } buf = ngx_sprintf_num(buf, last, ui64, zero, hex, width); fmt++; } else { *buf++ = *fmt++; } } return buf; } src/http/ngx_http_request.c:1491: error: Buffer Overrun L2 Offset: [0, 4048] Size: 2048 by call to `ngx_log_error_core`. src/http/ngx_http_request.c:1491:9: Call 1489. 1490. if (r->plain_http) { 1491. ngx_log_error(NGX_LOG_INFO, c->log, 0, ^ 1492. "client sent plain HTTP request to HTTPS port"); 1493. ngx_http_finalize_request(r, NGX_HTTP_TO_HTTPS); src/core/ngx_log.c:67:1: Array declaration 65. #if (NGX_HAVE_VARIADIC_MACROS) 66. 67. void ^ 68. ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, 69. const char *fmt, ...) src/core/ngx_log.c:88:5: Assignment 86. } 87. 88. last = errstr + NGX_MAX_ERROR_STR; ^ 89. 90. ngx_memcpy(errstr, ngx_cached_err_log_time.data, src/core/ngx_log.c:133:13: Call 131. ? " (%d: " : " (%Xd: ", err); 132. #else 133. p = ngx_snprintf(p, last - p, " (%d: ", err); ^ 134. #endif 135. src/core/ngx_string.c:109:1: Parameter `max` 107. 108. 109. u_char * ngx_cdecl ^ 110. ngx_snprintf(u_char *buf, size_t max, const char *fmt, ...) 111. { src/core/ngx_string.c:116:9: Call 114. 115. va_start(args, fmt); 116. p = ngx_vsnprintf(buf, max, fmt, args); ^ 117. va_end(args); 118. src/core/ngx_string.c:123:1: <Length trace> 121. 122. 123. u_char * ^ 124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) 125. { src/core/ngx_string.c:123:1: Parameter `*buf` 121. 122. 123. u_char * ^ 124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) 125. { src/core/ngx_string.c:244:25: Array access: Offset: [0, 4048] Size: 2048 by call to `ngx_log_error_core` 242. if (slen == (size_t) -1) { 243. while (*p && buf < last) { 244. *buf++ = *p++; ^ 245. } 246.
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_string.c/#L244
d2a_code_trace_data_41904
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:1394: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_sqr`. Showing all 14 steps of the trace test/bntest.c:1375:1: Parameter `ctx->stack.depth` 1373. } 1374. 1375. > int test_gf2m_mod_sqr(BIO *bp, BN_CTX *ctx) 1376. { 1377. BIGNUM *a, *b[2], *c, *d; test/bntest.c:1394:13: Call 1392. BN_bntest_rand(a, 1024, 0, 0); 1393. for (j = 0; j < 2; j++) { 1394. BN_GF2m_mod_sqr(c, a, b[j], ctx); ^ 1395. BN_copy(d, a); 1396. BN_GF2m_mod_mul(d, a, d, b[j], ctx); crypto/bn/bn_gf2m.c:532:1: Parameter `ctx->stack.depth` 530. * use the BN_GF2m_mod_sqr_arr function. 531. */ 532. > int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) 533. { 534. int ret = 0; crypto/bn/bn_gf2m.c:547:11: Call 545. goto err; 546. } 547. ret = BN_GF2m_mod_sqr_arr(r, a, arr, ctx); ^ 548. bn_check_top(r); 549. err: crypto/bn/bn_gf2m.c:504:5: Call 502. 503. bn_check_top(a); 504. BN_CTX_start(ctx); ^ 505. if ((s = BN_CTX_get(ctx)) == NULL) 506. goto err; crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gf2m.c:522:5: Call 520. ret = 1; 521. err: 522. BN_CTX_end(ctx); ^ 523. return ret; 524. } crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.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_sqr` 271. static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; ^ 274. } 275.
https://github.com/openssl/openssl/blob/b3618f44a7b8504bfb0a64e8a33e6b8e56d4d516/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_41905
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) { bn_check_top(b); if (a == b) return a; if (bn_wexpand(a, b->top) == NULL) return NULL; if (b->top > 0) memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); if (BN_get_flags(b, BN_FLG_CONSTTIME) != 0) BN_set_flags(a, BN_FLG_CONSTTIME); a->top = b->top; a->neg = b->neg; bn_check_top(a); return a; } test/rsa_mp_test.c:205: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `RSA_check_key_ex`. Showing all 15 steps of the trace test/rsa_mp_test.c:201:12: Call 199. if (!TEST_ptr(key)) 200. goto err; 201. clen = key2048p3(key); ^ 202. if (!TEST_int_eq(clen, 256)) 203. goto err; test/rsa_mp_test.c:136:10: Call 134. int rv = 256; /* public key length */ 135. 136. if (!TEST_int_eq(RSA_set0_key(key, ^ 137. BN_bin2bn(n, sizeof(n) - 1, NULL), 138. BN_bin2bn(e, sizeof(e) - 1, NULL), crypto/bn/bn_lib.c:399:1: Parameter `ret->top` 397. } 398. 399. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) 400. { 401. unsigned int i, m; test/rsa_mp_test.c:205:10: Call 203. goto err; 204. 205. if (!TEST_true(RSA_check_key_ex(key, NULL))) ^ 206. goto err; 207. crypto/rsa/rsa_chk.c:19:1: Parameter `key->d->top` 17. } 18. 19. > int RSA_check_key_ex(const RSA *key, BN_GENCB *cb) 20. { 21. BIGNUM *i, *j, *k, *l, *m; crypto/rsa/rsa_chk.c:160:14: Call 158. goto err; 159. } 160. if (!BN_mod(j, key->d, i, ctx)) { ^ 161. ret = -1; 162. goto err; crypto/bn/bn_div.c:137:1: Parameter `num->top` 135. * If 'dv' or 'rm' is NULL, the respective value is not returned. 136. */ 137. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 138. BN_CTX *ctx) 139. { crypto/bn/bn_div.c:182:17: Call 180. if (!no_branch && BN_ucmp(num, divisor) < 0) { 181. if (rm != NULL) { 182. if (BN_copy(rm, num) == NULL) ^ 183. return 0; 184. } crypto/bn/bn_lib.c:312:1: <Offset trace> 310. } 311. 312. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 313. { 314. bn_check_top(b); crypto/bn/bn_lib.c:312:1: Parameter `b->top` 310. } 311. 312. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 313. { 314. bn_check_top(b); crypto/bn/bn_lib.c:312:1: <Length trace> 310. } 311. 312. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 313. { 314. bn_check_top(b); crypto/bn/bn_lib.c:312:1: Parameter `*a->d` 310. } 311. 312. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 313. { 314. bn_check_top(b); crypto/bn/bn_lib.c:318:9: Call 316. if (a == b) 317. return a; 318. if (bn_wexpand(a, b->top) == NULL) ^ 319. return NULL; 320. crypto/bn/bn_lib.c:940:1: Parameter `*a->d` 938. } 939. 940. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 941. { 942. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:322:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `RSA_check_key_ex` 320. 321. if (b->top > 0) 322. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); ^ 323. 324. if (BN_get_flags(b, BN_FLG_CONSTTIME) != 0)
https://github.com/openssl/openssl/blob/92b1b9a8871530f26ef7df972111297ffa721be2/crypto/bn/bn_lib.c/#L322
d2a_code_trace_data_41906
void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) { unsigned long hash; OPENSSL_LH_NODE *nn, **rn; void *ret; lh->error = 0; rn = getrn(lh, data, &hash); if (*rn == NULL) { lh->num_no_delete++; return NULL; } else { nn = *rn; *rn = nn->next; ret = nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))) contract(lh); return ret; } ssl/ssl_lib.c:3806: error: INTEGER_OVERFLOW_L2 ([0, max(0, `s->ctx->sessions->num_items`)] - 1):unsigned64 by call to `SSL_free`. Showing all 17 steps of the trace ssl/ssl_lib.c:3693:1: Parameter `s->ctx->sessions->num_items` 3691. } 3692. 3693. > SSL *SSL_dup(SSL *s) 3694. { 3695. SSL *ret; ssl/ssl_lib.c:3707:16: Call 3705. * Otherwise, copy configuration state, and session if set. 3706. */ 3707. if ((ret = SSL_new(SSL_get_SSL_CTX(s))) == NULL) ^ 3708. return NULL; 3709. ssl/ssl_lib.c:671:1: Parameter `ctx->sessions->num_items` 669. } 670. 671. > SSL *SSL_new(SSL_CTX *ctx) 672. { 673. SSL *s; ssl/ssl_lib.c:3806:5: Call 3804. 3805. err: 3806. SSL_free(ret); ^ 3807. return NULL; 3808. } ssl/ssl_lib.c:1133:1: Parameter `s->session_ctx->sessions->num_items` 1131. } 1132. 1133. > void SSL_free(SSL *s) 1134. { 1135. int i; ssl/ssl_lib.c:1164:9: Call 1162. /* Make the next call work :-) */ 1163. if (s->session != NULL) { 1164. ssl_clear_bad_session(s); ^ 1165. SSL_SESSION_free(s->session); 1166. } ssl/ssl_sess.c:1124:1: Parameter `s->session_ctx->sessions->num_items` 1122. } 1123. 1124. > int ssl_clear_bad_session(SSL *s) 1125. { 1126. if ((s->session != NULL) && ssl/ssl_sess.c:1129:9: Call 1127. !(s->shutdown & SSL_SENT_SHUTDOWN) && 1128. !(SSL_in_init(s) || SSL_in_before(s))) { 1129. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 1130. return 1; 1131. } else ssl/ssl_sess.c:742:1: Parameter `ctx->sessions->num_items` 740. } 741. 742. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 743. { 744. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:744:12: Call 742. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 743. { 744. return remove_session_lock(ctx, c, 1); ^ 745. } 746. ssl/ssl_sess.c:747:1: Parameter `ctx->sessions->num_items` 745. } 746. 747. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 748. { 749. SSL_SESSION *r; ssl/ssl_sess.c:757:17: Call 755. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) != NULL) { 756. ret = 1; 757. r = lh_SSL_SESSION_delete(ctx->sessions, r); ^ 758. SSL_SESSION_list_remove(ctx, r); 759. } ssl/ssl_locl.h:732:1: Parameter `lh->num_items` 730. } TLSEXT_INDEX; 731. 732. > DEFINE_LHASH_OF(SSL_SESSION); 733. /* Needed in ssl_cert.c */ 734. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:732:1: Call 730. } TLSEXT_INDEX; 731. 732. > DEFINE_LHASH_OF(SSL_SESSION); 733. /* Needed in ssl_cert.c */ 734. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:128:1: <LHS trace> 126. } 127. 128. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 129. { 130. unsigned long hash; crypto/lhash/lhash.c:128:1: Parameter `lh->num_items` 126. } 127. 128. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 129. { 130. unsigned long hash; crypto/lhash/lhash.c:148:5: Binary operation: ([0, max(0, s->ctx->sessions->num_items)] - 1):unsigned64 by call to `SSL_free` 146. } 147. 148. lh->num_items--; ^ 149. if ((lh->num_nodes > MIN_NODES) && 150. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
https://github.com/openssl/openssl/blob/6e68dae85a8f91944370125561c7ec0d5da46c20/crypto/lhash/lhash.c/#L148
d2a_code_trace_data_41907
char *make_config_name() { const char *t=X509_get_default_cert_area(); char *p; p=OPENSSL_malloc(strlen(t)+strlen(OPENSSL_CONF)+2); strcpy(p,t); #ifndef OPENSSL_SYS_VMS strcat(p,"/"); #endif strcat(p,OPENSSL_CONF); return p; } apps/apps.c:1402: error: NULL_DEREFERENCE pointer `p` last assigned on line 1401 could be null and is dereferenced by call to `strcpy()` at line 1402, column 2. Showing all 20 steps of the trace apps/apps.c:1396:1: start of procedure make_config_name() 1394. } 1395. 1396. > char *make_config_name() 1397. { 1398. const char *t=X509_get_default_cert_area(); apps/apps.c:1398:2: 1396. char *make_config_name() 1397. { 1398. > const char *t=X509_get_default_cert_area(); 1399. char *p; 1400. crypto/x509/x509_def.c:67:1: start of procedure X509_get_default_cert_area() 65. { return(X509_PRIVATE_DIR); } 66. 67. > const char *X509_get_default_cert_area(void) 68. { return(X509_CERT_AREA); } 69. crypto/x509/x509_def.c:68:4: 66. 67. const char *X509_get_default_cert_area(void) 68. > { return(X509_CERT_AREA); } 69. 70. const char *X509_get_default_cert_dir(void) crypto/x509/x509_def.c:68:28: return from a call to X509_get_default_cert_area 66. 67. const char *X509_get_default_cert_area(void) 68. { return(X509_CERT_AREA); } ^ 69. 70. const char *X509_get_default_cert_dir(void) apps/apps.c:1401:2: 1399. char *p; 1400. 1401. > p=OPENSSL_malloc(strlen(t)+strlen(OPENSSL_CONF)+2); 1402. strcpy(p,t); 1403. #ifndef OPENSSL_SYS_VMS crypto/mem.c:291:1: start of procedure CRYPTO_malloc() 289. } 290. 291. > void *CRYPTO_malloc(int num, const char *file, int line) 292. { 293. void *ret = NULL; crypto/mem.c:293:2: 291. void *CRYPTO_malloc(int num, const char *file, int line) 292. { 293. > void *ret = NULL; 294. extern unsigned char cleanse_ctr; 295. crypto/mem.c:296:6: Taking false branch 294. extern unsigned char cleanse_ctr; 295. 296. if (num < 0) return NULL; ^ 297. 298. allow_customize = 0; crypto/mem.c:298:2: 296. if (num < 0) return NULL; 297. 298. > allow_customize = 0; 299. if (malloc_debug_func != NULL) 300. { crypto/mem.c:299:6: Taking true branch 297. 298. allow_customize = 0; 299. if (malloc_debug_func != NULL) ^ 300. { 301. allow_customize_debug = 0; crypto/mem.c:301:3: 299. if (malloc_debug_func != NULL) 300. { 301. > allow_customize_debug = 0; 302. malloc_debug_func(NULL, num, file, line, 0); 303. } crypto/mem.c:302:3: Skipping __function_pointer__(): unresolved function pointer 300. { 301. allow_customize_debug = 0; 302. malloc_debug_func(NULL, num, file, line, 0); ^ 303. } 304. ret = malloc_ex_func(num,file,line); crypto/mem.c:304:2: Skipping __function_pointer__(): unresolved function pointer 302. malloc_debug_func(NULL, num, file, line, 0); 303. } 304. ret = malloc_ex_func(num,file,line); ^ 305. #ifdef LEVITTE_DEBUG_MEM 306. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num); crypto/mem.c:308:6: Taking true branch 306. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num); 307. #endif 308. if (malloc_debug_func != NULL) ^ 309. malloc_debug_func(ret, num, file, line, 1); 310. crypto/mem.c:309:3: Skipping __function_pointer__(): unresolved function pointer 307. #endif 308. if (malloc_debug_func != NULL) 309. malloc_debug_func(ret, num, file, line, 1); ^ 310. 311. /* Create a dependency on the value of 'cleanse_ctr' so our memory crypto/mem.c:314:12: Taking false branch 312. * sanitisation function can't be optimised out. NB: We only do 313. * this for >2Kb so the overhead doesn't bother us. */ 314. if(ret && (num > 2048)) ^ 315. ((unsigned char *)ret)[0] = cleanse_ctr; 316. crypto/mem.c:317:2: 315. ((unsigned char *)ret)[0] = cleanse_ctr; 316. 317. > return ret; 318. } 319. crypto/mem.c:318:2: return from a call to CRYPTO_malloc 316. 317. return ret; 318. } ^ 319. 320. void *CRYPTO_realloc(void *str, int num, const char *file, int line) apps/apps.c:1402:2: 1400. 1401. p=OPENSSL_malloc(strlen(t)+strlen(OPENSSL_CONF)+2); 1402. > strcpy(p,t); 1403. #ifndef OPENSSL_SYS_VMS 1404. strcat(p,"/");
https://github.com/openssl/openssl/blob/03ddbdd9b99ea60d0967b831ffc1fe93ae7f9792/apps/apps.c/#L1402
d2a_code_trace_data_41908
void av_close_input_stream(AVFormatContext *s) { int i; AVStream *st; if (s->cur_st && s->cur_st->parser) av_free_packet(&s->cur_pkt); if (s->iformat->read_close) s->iformat->read_close(s); for(i=0;i<s->nb_streams;i++) { st = s->streams[i]; if (st->parser) { av_parser_close(st->parser); } av_free(st->index_entries); av_free(st->codec->extradata); av_free(st->codec); av_free(st->filename); av_free(st); } for(i=s->nb_programs-1; i>=0; i--) { av_freep(&s->programs[i]->provider_name); av_freep(&s->programs[i]->name); av_freep(&s->programs[i]->stream_index); av_freep(&s->programs[i]); } flush_packet_queue(s); av_freep(&s->priv_data); av_free(s); } vhook/watermark.c:175: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `get_watermark_picture`. vhook/watermark.c:144:17: Unknown value from: getopt 142. ci->thrB = 0x80; 143. 144. while ((c = getopt(argc, argv, "f:m:t:")) > 0) { ^ 145. switch (c) { 146. case 'f': vhook/watermark.c:175:12: Call 173. 174. av_register_all(); 175. return get_watermark_picture(ci, 0); ^ 176. } 177. vhook/watermark.c:454:1: Parameter `ci->pFormatCtx->nb_programs` 452. * 0 = ok, -1 = error 453. ****************************************************************************/ 454. int get_watermark_picture(ContextInfo *ci, int cleanup) ^ 455. { 456. if (1 == ci->is_done && 0 == cleanup) return 0; vhook/watermark.c:645:13: Call 643. // Close the video file 644. if (0 != ci->pFormatCtx) { 645. av_close_input_file(ci->pFormatCtx); ^ 646. ci->pFormatCtx = 0; 647. } libavformat/utils.c:2152:1: Parameter `s->nb_programs` 2150. } 2151. 2152. void av_close_input_file(AVFormatContext *s) ^ 2153. { 2154. ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb; libavformat/utils.c:2155:5: Call 2153. { 2154. ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb; 2155. av_close_input_stream(s); ^ 2156. if (pb) 2157. url_fclose(pb); libavformat/utils.c:2118:1: <LHS trace> 2116. } 2117. 2118. void av_close_input_stream(AVFormatContext *s) ^ 2119. { 2120. int i; libavformat/utils.c:2118:1: Parameter `s->nb_programs` 2116. } 2117. 2118. void av_close_input_stream(AVFormatContext *s) ^ 2119. { 2120. int i; libavformat/utils.c:2141:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `get_watermark_picture` 2139. av_free(st); 2140. } 2141. for(i=s->nb_programs-1; i>=0; i--) { ^ 2142. av_freep(&s->programs[i]->provider_name); 2143. av_freep(&s->programs[i]->name);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/utils.c/#L2141
d2a_code_trace_data_41909
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_chk.c:99: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mul`. Showing all 15 steps of the trace crypto/rsa/rsa_chk.c:84:9: Call 82. 83. /* q prime? */ 84. if (BN_is_prime_ex(key->q, BN_prime_checks, NULL, cb) != 1) { ^ 85. ret = 0; 86. RSAerr(RSA_F_RSA_CHECK_KEY_EX, RSA_R_Q_NOT_PRIME); crypto/bn/bn_prime.c:183:12: Call 181. BN_GENCB *cb) 182. { 183. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb); ^ 184. } 185. crypto/bn/bn_prime.c:187:1: Parameter `ctx_passed->stack.depth` 185. 186. /* See FIPS 186-4 C.3.1 Miller Rabin Probabilistic Primality Test. */ 187. > int BN_is_prime_fasttest_ex(const BIGNUM *w, int checks, BN_CTX *ctx_passed, 188. int do_trial_division, BN_GENCB *cb) 189. { crypto/rsa/rsa_chk.c:99:10: Call 97. 98. /* n = p*q * r_3...r_i? */ 99. if (!BN_mul(i, key->p, key->q, ctx)) { ^ 100. ret = -1; 101. goto err; crypto/bn/bn_mul.c:497:1: Parameter `ctx->stack.depth` 495. #endif /* BN_RECURSION */ 496. 497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); crypto/bn/bn_mul.c:499:15: Call 497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); ^ 500. 501. bn_correct_top(r); crypto/bn/bn_mul.c:507:1: Parameter `ctx->stack.depth` 505. } 506. 507. > int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 508. { 509. int ret = 0; crypto/bn/bn_mul.c:533:5: Call 531. top = al + bl; 532. 533. BN_CTX_start(ctx); ^ 534. if ((r == a) || (r == b)) { 535. if ((rr = BN_CTX_get(ctx)) == NULL) crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_mul.c:618:5: Call 616. err: 617. bn_check_top(r); 618. BN_CTX_end(ctx); ^ 619. return ret; 620. } crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <LHS trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mul` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_41910
static int expand(OPENSSL_LHASH *lh) { OPENSSL_LH_NODE **n, **n1, **n2, *np; unsigned int p, i, j; unsigned long hash, nni; lh->num_nodes++; lh->num_expands++; p = (int)lh->p++; n1 = &(lh->b[p]); n2 = &(lh->b[p + (int)lh->pmax]); *n2 = NULL; nni = lh->num_alloc_nodes; for (np = *n1; np != NULL;) { hash = np->hash; if ((hash % nni) != p) { *n1 = (*n1)->next; np->next = *n2; *n2 = np; } else n1 = &((*n1)->next); np = *n1; } if ((lh->p) >= lh->pmax) { j = (int)lh->num_alloc_nodes * 2; n = OPENSSL_realloc(lh->b, (int)(sizeof(OPENSSL_LH_NODE *) * j)); if (n == NULL) { lh->error++; lh->num_nodes--; lh->p = 0; return 0; } for (i = (int)lh->num_alloc_nodes; i < j; i++) n[i] = NULL; lh->pmax = lh->num_alloc_nodes; lh->num_alloc_nodes = j; lh->num_expand_reallocs++; lh->p = 0; lh->b = n; } return 1; } crypto/txt_db/txt_db.c:171: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] Size: [1, +oo] by call to `lh_OPENSSL_STRING_insert`. Showing all 16 steps of the trace crypto/txt_db/txt_db.c:162:44: Call 160. } 161. /* FIXME: we lose type checking at this point */ 162. if ((idx = (LHASH_OF(OPENSSL_STRING) *)OPENSSL_LH_new(hash, cmp)) == NULL) { ^ 163. db->error = DB_ERROR_MALLOC; 164. return (0); crypto/lhash/lhash.c:38:5: Assignment 36. ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h); 37. ret->num_nodes = MIN_NODES / 2; 38. ret->num_alloc_nodes = MIN_NODES; ^ 39. ret->pmax = MIN_NODES / 2; 40. ret->up_load = UP_LOAD; crypto/txt_db/txt_db.c:171:18: Call 169. if ((qual != NULL) && (qual(r) == 0)) 170. continue; 171. if ((k = lh_OPENSSL_STRING_insert(idx, r)) != NULL) { ^ 172. db->error = DB_ERROR_INDEX_CLASH; 173. db->arg1 = sk_OPENSSL_PSTRING_find(db->data, k); include/openssl/lhash.h:197:1: Parameter `lh->num_alloc_nodes` 195. LHASH_OF(type) 196. 197. > DEFINE_LHASH_OF(OPENSSL_STRING); 198. DEFINE_LHASH_OF(OPENSSL_CSTRING); 199. include/openssl/lhash.h:197:1: Call 195. LHASH_OF(type) 196. 197. > DEFINE_LHASH_OF(OPENSSL_STRING); 198. DEFINE_LHASH_OF(OPENSSL_CSTRING); 199. crypto/lhash/lhash.c:70:1: Parameter `lh->num_alloc_nodes` 68. } 69. 70. > void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data) 71. { 72. unsigned long hash; crypto/lhash/lhash.c:77:77: Call 75. 76. lh->error = 0; 77. if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh)) ^ 78. return NULL; /* 'lh->error++' already done in 'expand' */ 79. crypto/lhash/lhash.c:187:1: <Offset trace> 185. } 186. 187. > static int expand(OPENSSL_LHASH *lh) 188. { 189. OPENSSL_LH_NODE **n, **n1, **n2, *np; crypto/lhash/lhash.c:187:1: Parameter `lh->num_alloc_nodes` 185. } 186. 187. > static int expand(OPENSSL_LHASH *lh) 188. { 189. OPENSSL_LH_NODE **n, **n1, **n2, *np; crypto/lhash/lhash.c:213:9: Assignment 211. 212. if ((lh->p) >= lh->pmax) { 213. j = (int)lh->num_alloc_nodes * 2; ^ 214. n = OPENSSL_realloc(lh->b, (int)(sizeof(OPENSSL_LH_NODE *) * j)); 215. if (n == NULL) { crypto/lhash/lhash.c:187:1: <Length trace> 185. } 186. 187. > static int expand(OPENSSL_LHASH *lh) 188. { 189. OPENSSL_LH_NODE **n, **n1, **n2, *np; crypto/lhash/lhash.c:187:1: Parameter `*lh->b` 185. } 186. 187. > static int expand(OPENSSL_LHASH *lh) 188. { 189. OPENSSL_LH_NODE **n, **n1, **n2, *np; crypto/lhash/lhash.c:214:13: Call 212. if ((lh->p) >= lh->pmax) { 213. j = (int)lh->num_alloc_nodes * 2; 214. n = OPENSSL_realloc(lh->b, (int)(sizeof(OPENSSL_LH_NODE *) * j)); ^ 215. if (n == NULL) { 216. lh->error++; crypto/mem.c:207:9: Assignment 205. if (num == 0) { 206. CRYPTO_free(str, file, line); 207. return NULL; ^ 208. } 209. crypto/lhash/lhash.c:214:9: Assignment 212. if ((lh->p) >= lh->pmax) { 213. j = (int)lh->num_alloc_nodes * 2; 214. n = OPENSSL_realloc(lh->b, (int)(sizeof(OPENSSL_LH_NODE *) * j)); ^ 215. if (n == NULL) { 216. lh->error++; crypto/lhash/lhash.c:222:13: Array access: Offset: [16, +oo] Size: [1, +oo] by call to `lh_OPENSSL_STRING_insert` 220. } 221. for (i = (int)lh->num_alloc_nodes; i < j; i++) /* 26/02/92 eay */ 222. n[i] = NULL; /* 02/03/92 eay */ ^ 223. lh->pmax = lh->num_alloc_nodes; 224. lh->num_alloc_nodes = j;
https://github.com/openssl/openssl/blob/1b8f19379a521ec11ce37e12316dd3edc0acfb82/crypto/lhash/lhash.c/#L222
d2a_code_trace_data_41911
static int TIFFStartTile(TIFF* tif, uint32 tile) { TIFFDirectory *td = &tif->tif_dir; if ((tif->tif_flags & TIFF_CODERSETUP) == 0) { if (!(*tif->tif_setupdecode)(tif)) return (0); tif->tif_flags |= TIFF_CODERSETUP; } tif->tif_curtile = tile; tif->tif_row = (tile % TIFFhowmany_32(td->td_imagewidth, td->td_tilewidth)) * td->td_tilelength; tif->tif_col = (tile % TIFFhowmany_32(td->td_imagelength, td->td_tilelength)) * td->td_tilewidth; tif->tif_flags &= ~TIFF_BUF4WRITE; if (tif->tif_flags&TIFF_NOREADRAW) { tif->tif_rawcp = NULL; tif->tif_rawcc = 0; } else { tif->tif_rawcp = tif->tif_rawdata; tif->tif_rawcc = (tmsize_t)td->td_stripbytecount[tile]; } return ((*tif->tif_predecode)(tif, (uint16)(tile/td->td_stripsperimage))); } tools/tiffcrop.c:751: error: Integer Overflow L2 ([0, `in->tif_dir.td_tilewidth`] - 1):unsigned32 by call to `TIFFReadTile`. tools/tiffcrop.c:725:1: Parameter `in->tif_dir.td_tilewidth` 723. }; 724. 725. static int readContigTilesIntoBuffer (TIFF* in, uint8* buf, ^ 726. uint32 imagelength, 727. uint32 imagewidth, tools/tiffcrop.c:731:32: Call 729. { 730. int status = 1; 731. tdata_t tilebuf = _TIFFmalloc(TIFFTileSize(in)); ^ 732. uint32 imagew = TIFFScanlineSize(in); 733. uint32 tilew = TIFFTileRowSize(in); libtiff/tif_tile.c:274:1: Parameter `tif->tif_dir.td_tilewidth` 272. return (TIFFVTileSize64(tif, tif->tif_dir.td_tilelength)); 273. } 274. tmsize_t ^ 275. TIFFTileSize(TIFF* tif) 276. { libtiff/tif_tile.c:280:4: Call 278. uint64 m; 279. tmsize_t n; 280. m=TIFFTileSize64(tif); ^ 281. n=(tmsize_t)m; 282. if ((uint64)n!=m) libtiff/tif_tile.c:269:1: Parameter `tif->tif_dir.td_tilewidth` 267. * Compute the # bytes in a row-aligned tile. 268. */ 269. uint64 ^ 270. TIFFTileSize64(TIFF* tif) 271. { libtiff/tif_tile.c:272:10: Call 270. TIFFTileSize64(TIFF* tif) 271. { 272. return (TIFFVTileSize64(tif, tif->tif_dir.td_tilelength)); ^ 273. } 274. tmsize_t libtiff/tif_tile.c:203:1: Parameter `tif->tif_dir.td_tilewidth` 201. * Compute the # bytes in a variable length, row-aligned tile. 202. */ 203. uint64 ^ 204. TIFFVTileSize64(TIFF* tif, uint32 nrows) 205. { tools/tiffcrop.c:733:18: Call 731. tdata_t tilebuf = _TIFFmalloc(TIFFTileSize(in)); 732. uint32 imagew = TIFFScanlineSize(in); 733. uint32 tilew = TIFFTileRowSize(in); ^ 734. int iskew = imagew - tilew; 735. uint8* bufp = (uint8*) buf; libtiff/tif_tile.c:184:1: Parameter `tif->tif_dir.td_tilewidth` 182. return (TIFFhowmany8_64(rowsize)); 183. } 184. tmsize_t ^ 185. TIFFTileRowSize(TIFF* tif) 186. { libtiff/tif_tile.c:190:4: Call 188. uint64 m; 189. tmsize_t n; 190. m=TIFFTileRowSize64(tif); ^ 191. n=(tmsize_t)m; 192. if ((uint64)n!=m) libtiff/tif_tile.c:169:1: Parameter `tif->tif_dir.td_tilewidth` 167. * Compute the # bytes in each row of a tile. 168. */ 169. uint64 ^ 170. TIFFTileRowSize64(TIFF* tif) 171. { tools/tiffcrop.c:751:8: Call 749. 750. for (col = 0; col < imagewidth; col += tw) { 751. if (TIFFReadTile(in, tilebuf, col, row, 0, 0) < 0 ^ 752. && !ignore) { 753. TIFFError(TIFFFileName(in), libtiff/tif_read.c:415:1: Parameter `tif->tif_dir.td_tilewidth` 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:420:10: Call 418. if (!TIFFCheckRead(tif, 1) || !TIFFCheckTile(tif, x, y, z, s)) 419. return ((tmsize_t)(-1)); 420. return (TIFFReadEncodedTile(tif, ^ 421. TIFFComputeTile(tif, x, y, z, s), buf, (tmsize_t)(-1))); 422. } libtiff/tif_read.c:428:1: Parameter `tif->tif_dir.td_tilewidth` 426. * amount into the user-supplied buffer. 427. */ 428. tmsize_t ^ 429. TIFFReadEncodedTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size) 430. { libtiff/tif_read.c:447:6: Call 445. else if (size > tilesize) 446. size = tilesize; 447. if (TIFFFillTile(tif, tile) && (*tif->tif_decodetile)(tif, ^ 448. (uint8*) buf, size, (uint16)(tile/td->td_stripsperimage))) { 449. (*tif->tif_postdecode)(tif, (uint8*) buf, size); libtiff/tif_read.c:568:1: Parameter `tif->tif_dir.td_tilewidth` 566. * expanded, as necessary, to hold the tile's data. 567. */ 568. int ^ 569. TIFFFillTile(TIFF* tif, uint32 tile) 570. { libtiff/tif_read.c:657:10: Call 655. } 656. } 657. return (TIFFStartTile(tif, tile)); ^ 658. } 659. libtiff/tif_read.c:737:1: <LHS trace> 735. * tile has just been read in. 736. */ 737. static int ^ 738. TIFFStartTile(TIFF* tif, uint32 tile) 739. { libtiff/tif_read.c:737:1: Parameter `tif->tif_dir.td_tilewidth` 735. * tile has just been read in. 736. */ 737. static int ^ 738. TIFFStartTile(TIFF* tif, uint32 tile) 739. { libtiff/tif_read.c:748:2: Binary operation: ([0, in->tif_dir.td_tilewidth] - 1):unsigned32 by call to `TIFFReadTile` 746. } 747. tif->tif_curtile = tile; 748. tif->tif_row = ^ 749. (tile % TIFFhowmany_32(td->td_imagewidth, td->td_tilewidth)) * 750. td->td_tilelength;
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_read.c/#L748
d2a_code_trace_data_41912
void BN_consttime_swap(BN_ULONG condition, BIGNUM *a, BIGNUM *b, int nwords) { BN_ULONG t; int i; bn_wcheck_size(a, nwords); bn_wcheck_size(b, nwords); assert(a != b); assert((condition & (condition - 1)) == 0); assert(sizeof(BN_ULONG) >= sizeof(int)); condition = ((condition - 1) >> (BN_BITS2 - 1)) - 1; t = (a->top ^ b->top) & condition; a->top ^= t; b->top ^= t; t = (a->neg ^ b->neg) & condition; a->neg ^= t; b->neg ^= t; t = ((a->flags ^ b->flags) & BN_FLG_CONSTTIME) & condition; a->flags ^= t; b->flags ^= t; #define BN_CONSTTIME_SWAP(ind) \ do { \ t = (a->d[ind] ^ b->d[ind]) & condition; \ a->d[ind] ^= t; \ b->d[ind] ^= t; \ } while (0) switch (nwords) { default: for (i = 10; i < nwords; i++) BN_CONSTTIME_SWAP(i); case 10: BN_CONSTTIME_SWAP(9); case 9: BN_CONSTTIME_SWAP(8); case 8: BN_CONSTTIME_SWAP(7); case 7: BN_CONSTTIME_SWAP(6); case 6: BN_CONSTTIME_SWAP(5); case 5: BN_CONSTTIME_SWAP(4); case 4: BN_CONSTTIME_SWAP(3); case 3: BN_CONSTTIME_SWAP(2); case 2: BN_CONSTTIME_SWAP(1); case 1: BN_CONSTTIME_SWAP(0); } #undef BN_CONSTTIME_SWAP } crypto/ec/ec_mult.c:344: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `BN_consttime_swap`. Showing all 7 steps of the trace crypto/ec/ec_mult.c:343:16: Call 341. 342. for (i = cardinality_bits - 1; i >= 0; i--) { 343. kbit = BN_is_bit_set(k, i) ^ pbit; ^ 344. EC_POINT_CSWAP(kbit, r, s, group_top, Z_is_one); 345. crypto/bn/bn_lib.c:642:9: Assignment 640. bn_check_top(a); 641. if (n < 0) 642. return 0; ^ 643. i = n / BN_BITS2; 644. j = n % BN_BITS2; crypto/ec/ec_mult.c:343:9: Assignment 341. 342. for (i = cardinality_bits - 1; i >= 0; i--) { 343. kbit = BN_is_bit_set(k, i) ^ pbit; ^ 344. EC_POINT_CSWAP(kbit, r, s, group_top, Z_is_one); 345. crypto/ec/ec_mult.c:344:9: Call 342. for (i = cardinality_bits - 1; i >= 0; i--) { 343. kbit = BN_is_bit_set(k, i) ^ pbit; 344. EC_POINT_CSWAP(kbit, r, s, group_top, Z_is_one); ^ 345. 346. /* Perform a single step of the Montgomery ladder */ crypto/bn/bn_lib.c:734:1: <LHS trace> 732. * a and b cannot be the same number 733. */ 734. > void BN_consttime_swap(BN_ULONG condition, BIGNUM *a, BIGNUM *b, int nwords) 735. { 736. BN_ULONG t; crypto/bn/bn_lib.c:734:1: Parameter `condition` 732. * a and b cannot be the same number 733. */ 734. > void BN_consttime_swap(BN_ULONG condition, BIGNUM *a, BIGNUM *b, int nwords) 735. { 736. BN_ULONG t; crypto/bn/bn_lib.c:746:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `BN_consttime_swap` 744. assert(sizeof(BN_ULONG) >= sizeof(int)); 745. 746. condition = ((condition - 1) >> (BN_BITS2 - 1)) - 1; ^ 747. 748. t = (a->top ^ b->top) & condition;
https://github.com/openssl/openssl/blob/66b0bca887eb4ad1f5758e56c45905fb3fc36667/crypto/bn/bn_lib.c/#L746
d2a_code_trace_data_41913
int BN_num_bits(const BIGNUM *a) { int i = a->top - 1; bn_check_top(a); if (BN_is_zero(a)) return 0; return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); } crypto/bn/bn_mont.c:428: error: BUFFER_OVERRUN_L3 Offset: [-1, 0] Size: 2 by call to `BN_mod_inverse`. Showing all 13 steps of the trace crypto/bn/bn_mont.c:352:1: Array declaration 350. } 351. 352. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 353. { 354. int ret = 0; crypto/bn/bn_mont.c:371:9: Assignment 369. 370. BN_init(&tmod); 371. tmod.d = buf; ^ 372. tmod.dmax = 2; 373. tmod.neg = 0; crypto/bn/bn_mont.c:428:14: Call 426. tmod.top = buf[0] != 0 ? 1 : 0; 427. /* Ri = R^-1 mod N */ 428. if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL) ^ 429. goto err; 430. if (!BN_lshift(Ri, Ri, BN_BITS2)) crypto/bn/bn_gcd.c:226:1: Parameter `*n->d` 224. BN_CTX *ctx); 225. 226. > BIGNUM *BN_mod_inverse(BIGNUM *in, 227. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 228. { crypto/bn/bn_gcd.c:231:10: Call 229. BIGNUM *rv; 230. int noinv; 231. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv); ^ 232. if (noinv) 233. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); crypto/bn/bn_gcd.c:237:1: Parameter `*n->d` 235. } 236. 237. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 238. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 239. int *pnoinv) crypto/bn/bn_gcd.c:294:26: Call 292. */ 293. 294. if (BN_is_odd(n) && (BN_num_bits(n) <= (BN_BITS <= 32 ? 450 : 2048))) { ^ 295. /* 296. * Binary inversion algorithm; requires odd modulus. This is faster crypto/bn/bn_lib.c:216:1: <Offset trace> 214. } 215. 216. > int BN_num_bits(const BIGNUM *a) 217. { 218. int i = a->top - 1; crypto/bn/bn_lib.c:216:1: Parameter `a->top` 214. } 215. 216. > int BN_num_bits(const BIGNUM *a) 217. { 218. int i = a->top - 1; crypto/bn/bn_lib.c:218:5: Assignment 216. int BN_num_bits(const BIGNUM *a) 217. { 218. int i = a->top - 1; ^ 219. bn_check_top(a); 220. crypto/bn/bn_lib.c:216:1: <Length trace> 214. } 215. 216. > int BN_num_bits(const BIGNUM *a) 217. { 218. int i = a->top - 1; crypto/bn/bn_lib.c:216:1: Parameter `*a->d` 214. } 215. 216. > int BN_num_bits(const BIGNUM *a) 217. { 218. int i = a->top - 1; crypto/bn/bn_lib.c:223:47: Array access: Offset: [-1, 0] Size: 2 by call to `BN_mod_inverse` 221. if (BN_is_zero(a)) 222. return 0; 223. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); ^ 224. } 225.
https://github.com/openssl/openssl/blob/9c46f4b9cd4912b61cb546c48b678488d7f26ed6/crypto/bn/bn_lib.c/#L223
d2a_code_trace_data_41914
static int do_multi(int multi) { int n; int fd[2]; int *fds; static char sep[] = ":"; fds = malloc(sizeof(*fds) * multi); for (n = 0; n < multi; ++n) { if (pipe(fd) == -1) { BIO_printf(bio_err, "pipe failure\n"); exit(1); } fflush(stdout); (void)BIO_flush(bio_err); if (fork()) { close(fd[1]); fds[n] = fd[0]; } else { close(fd[0]); close(1); if (dup(fd[1]) == -1) { BIO_printf(bio_err, "dup failed\n"); exit(1); } close(fd[1]); mr = 1; usertime = 0; free(fds); return 0; } printf("Forked child %d\n", n); } for (n = 0; n < multi; ++n) { FILE *f; char buf[1024]; char *p; f = fdopen(fds[n], "r"); while (fgets(buf, sizeof buf, f)) { p = strchr(buf, '\n'); if (p) *p = '\0'; if (buf[0] != '+') { BIO_printf(bio_err, "Don't understand line '%s' from child %d\n", buf, n); continue; } printf("Got: %s from %d\n", buf, n); if (strncmp(buf, "+F:", 3) == 0) { int alg; int j; p = buf + 3; alg = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); for (j = 0; j < SIZE_NUM; ++j) results[alg][j] += atof(sstrsep(&p, sep)); } else if (strncmp(buf, "+F2:", 4) == 0) { int k; double d; p = buf + 4; k = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); d = atof(sstrsep(&p, sep)); if (n) rsa_results[k][0] = 1 / (1 / rsa_results[k][0] + 1 / d); else rsa_results[k][0] = d; d = atof(sstrsep(&p, sep)); if (n) rsa_results[k][1] = 1 / (1 / rsa_results[k][1] + 1 / d); else rsa_results[k][1] = d; } # ifndef OPENSSL_NO_DSA else if (strncmp(buf, "+F3:", 4) == 0) { int k; double d; p = buf + 4; k = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); d = atof(sstrsep(&p, sep)); if (n) dsa_results[k][0] = 1 / (1 / dsa_results[k][0] + 1 / d); else dsa_results[k][0] = d; d = atof(sstrsep(&p, sep)); if (n) dsa_results[k][1] = 1 / (1 / dsa_results[k][1] + 1 / d); else dsa_results[k][1] = d; } # endif # ifndef OPENSSL_NO_EC else if (strncmp(buf, "+F4:", 4) == 0) { int k; double d; p = buf + 4; k = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); d = atof(sstrsep(&p, sep)); if (n) ecdsa_results[k][0] = 1 / (1 / ecdsa_results[k][0] + 1 / d); else ecdsa_results[k][0] = d; d = atof(sstrsep(&p, sep)); if (n) ecdsa_results[k][1] = 1 / (1 / ecdsa_results[k][1] + 1 / d); else ecdsa_results[k][1] = d; } # endif # ifndef OPENSSL_NO_EC else if (strncmp(buf, "+F5:", 4) == 0) { int k; double d; p = buf + 4; k = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); d = atof(sstrsep(&p, sep)); if (n) ecdh_results[k][0] = 1 / (1 / ecdh_results[k][0] + 1 / d); else ecdh_results[k][0] = d; } # endif else if (strncmp(buf, "+H:", 3) == 0) { ; } else BIO_printf(bio_err, "Unknown type '%s' from child %d\n", buf, n); } fclose(f); } free(fds); return 1; } apps/speed.c:2953: error: NULL_DEREFERENCE pointer `fds` last assigned on line 2943 could be null and is dereferenced at line 2953, column 13. Showing all 19 steps of the trace apps/speed.c:2936:1: start of procedure do_multi() 2934. } 2935. 2936. > static int do_multi(int multi) 2937. { 2938. int n; apps/speed.c:2941:5: 2939. int fd[2]; 2940. int *fds; 2941. > static char sep[] = ":"; 2942. 2943. fds = malloc(sizeof(*fds) * multi); apps/speed.c:2943:5: 2941. static char sep[] = ":"; 2942. 2943. > fds = malloc(sizeof(*fds) * multi); 2944. for (n = 0; n < multi; ++n) { 2945. if (pipe(fd) == -1) { apps/speed.c:2944:10: 2942. 2943. fds = malloc(sizeof(*fds) * multi); 2944. > for (n = 0; n < multi; ++n) { 2945. if (pipe(fd) == -1) { 2946. BIO_printf(bio_err, "pipe failure\n"); apps/speed.c:2944:17: Loop condition is true. Entering loop body 2942. 2943. fds = malloc(sizeof(*fds) * multi); 2944. for (n = 0; n < multi; ++n) { ^ 2945. if (pipe(fd) == -1) { 2946. BIO_printf(bio_err, "pipe failure\n"); apps/speed.c:2945:13: Taking false branch 2943. fds = malloc(sizeof(*fds) * multi); 2944. for (n = 0; n < multi; ++n) { 2945. if (pipe(fd) == -1) { ^ 2946. BIO_printf(bio_err, "pipe failure\n"); 2947. exit(1); apps/speed.c:2949:9: 2947. exit(1); 2948. } 2949. > fflush(stdout); 2950. (void)BIO_flush(bio_err); 2951. if (fork()) { apps/speed.c:2950:15: 2948. } 2949. fflush(stdout); 2950. > (void)BIO_flush(bio_err); 2951. if (fork()) { 2952. close(fd[1]); crypto/bio/bio_lib.c:359:1: start of procedure BIO_ctrl() 357. } 358. 359. > long BIO_ctrl(BIO *b, int cmd, long larg, void *parg) 360. { 361. long ret; crypto/bio/bio_lib.c:364:9: Taking false branch 362. long (*cb) (BIO *, int, const char *, int, long, long); 363. 364. if (b == NULL) ^ 365. return (0); 366. crypto/bio/bio_lib.c:367:10: Taking false branch 365. return (0); 366. 367. if ((b->method == NULL) || (b->method->ctrl == NULL)) { ^ 368. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); 369. return (-2); crypto/bio/bio_lib.c:367:33: Taking true branch 365. return (0); 366. 367. if ((b->method == NULL) || (b->method->ctrl == NULL)) { ^ 368. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); 369. return (-2); crypto/bio/bio_lib.c:368:9: Skipping ERR_put_error(): empty list of specs 366. 367. if ((b->method == NULL) || (b->method->ctrl == NULL)) { 368. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); ^ 369. return (-2); 370. } crypto/bio/bio_lib.c:369:9: 367. if ((b->method == NULL) || (b->method->ctrl == NULL)) { 368. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); 369. > return (-2); 370. } 371. crypto/bio/bio_lib.c:383:1: return from a call to BIO_ctrl 381. ret = cb(b, BIO_CB_CTRL | BIO_CB_RETURN, parg, cmd, larg, ret); 382. return (ret); 383. > } 384. 385. long BIO_callback_ctrl(BIO *b, int cmd, apps/speed.c:2950:9: 2948. } 2949. fflush(stdout); 2950. > (void)BIO_flush(bio_err); 2951. if (fork()) { 2952. close(fd[1]); apps/speed.c:2951:13: Taking true branch 2949. fflush(stdout); 2950. (void)BIO_flush(bio_err); 2951. if (fork()) { ^ 2952. close(fd[1]); 2953. fds[n] = fd[0]; apps/speed.c:2952:13: 2950. (void)BIO_flush(bio_err); 2951. if (fork()) { 2952. > close(fd[1]); 2953. fds[n] = fd[0]; 2954. } else { apps/speed.c:2953:13: 2951. if (fork()) { 2952. close(fd[1]); 2953. > fds[n] = fd[0]; 2954. } else { 2955. close(fd[0]);
https://github.com/openssl/openssl/blob/507c7c0ed6cbecbe16114dbbbb9fecc5ce5863a4/apps/speed.c/#L2953
d2a_code_trace_data_41915
static ossl_inline void packet_forward(PACKET *pkt, size_t len) { pkt->curr += len; pkt->remaining -= len; } ssl/ssl_lib.c:4487: error: INTEGER_OVERFLOW_L2 ([1, +oo] - [2, 3]):unsigned64 by call to `bytes_to_cipher_list`. Showing all 12 steps of the trace ssl/ssl_lib.c:4485:10: Call 4483. PACKET pkt; 4484. 4485. if (!PACKET_buf_init(&pkt, bytes, len)) ^ 4486. return 0; 4487. return bytes_to_cipher_list(s, &pkt, sk, scsvs, isv2format, &alert); ssl/packet_locl.h:72:8: Parameter `pkt->remaining` 70. * is being used. 71. */ 72. __owur static ossl_inline int PACKET_buf_init(PACKET *pkt, ^ 73. const unsigned char *buf, 74. size_t len) ssl/ssl_lib.c:4487:12: Call 4485. if (!PACKET_buf_init(&pkt, bytes, len)) 4486. return 0; 4487. return bytes_to_cipher_list(s, &pkt, sk, scsvs, isv2format, &alert); ^ 4488. } 4489. ssl/ssl_lib.c:4490:1: Parameter `cipher_suites->remaining` 4488. } 4489. 4490. > int bytes_to_cipher_list(SSL *s, PACKET *cipher_suites, 4491. STACK_OF(SSL_CIPHER) **skp, 4492. STACK_OF(SSL_CIPHER) **scsvs_out, ssl/ssl_lib.c:4525:12: Call 4523. } 4524. 4525. while (PACKET_copy_bytes(cipher_suites, cipher, n)) { ^ 4526. /* 4527. * SSLv3 ciphers wrapped in an SSLv2-compatible ClientHello have the ssl/packet_locl.h:379:8: Parameter `len` 377. * The caller is responsible for ensuring that |data| can hold |len| bytes. 378. */ 379. __owur static ossl_inline int PACKET_copy_bytes(PACKET *pkt, ^ 380. unsigned char *data, size_t len) 381. { ssl/packet_locl.h:385:5: Call 383. return 0; 384. 385. packet_forward(pkt, len); ^ 386. 387. return 1; ssl/packet_locl.h:33:1: <LHS trace> 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: Parameter `pkt->remaining` 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: <RHS trace> 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: Parameter `len` 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:36:5: Binary operation: ([1, +oo] - [2, 3]):unsigned64 by call to `bytes_to_cipher_list` 34. { 35. pkt->curr += len; 36. pkt->remaining -= len; ^ 37. } 38.
https://github.com/openssl/openssl/blob/ddf972583439346cbaa99031fe8d3116018ba711/ssl/packet_locl.h/#L36
d2a_code_trace_data_41916
int OPENSSL_SA_set(OPENSSL_SA *sa, ossl_uintmax_t posn, void *val) { int i, level = 1; ossl_uintmax_t n = posn; void **p; if (sa == NULL) return 0; for (level = 1; level < SA_BLOCK_MAX_LEVELS; level++) if ((n >>= OPENSSL_SA_BLOCK_BITS) == 0) break; for (;sa->levels < level; sa->levels++) { p = alloc_node(); if (p == NULL) return 0; p[0] = sa->nodes; sa->nodes = p; } if (sa->top < posn) sa->top = posn; p = sa->nodes; for (level = sa->levels - 1; level > 0; level--) { i = (posn >> (OPENSSL_SA_BLOCK_BITS * level)) & SA_BLOCK_MASK; if (p[i] == NULL && (p[i] = alloc_node()) == NULL) return 0; p = p[i]; } p += posn & SA_BLOCK_MASK; if (val == NULL && *p != NULL) sa->nelem--; else if (val != NULL && *p == NULL) sa->nelem++; *p = val; return 1; } test/property_test.c:339: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `ossl_method_store_add`. Showing all 12 steps of the trace test/property_test.c:339:14: Call 337. v[i] = 2 * i; 338. BIO_snprintf(buf, sizeof(buf), "n=%d\n", i); 339. if (!TEST_true(ossl_method_store_add(store, i, buf, "abc", NULL)) ^ 340. || !TEST_true(ossl_method_store_cache_set(store, i, buf, v + i)) 341. || !TEST_true(ossl_method_store_cache_set(store, i, "n=1234", crypto/property/property.c:187:1: Parameter `store->algs->nelem` 185. } 186. 187. > int ossl_method_store_add(OSSL_METHOD_STORE *store, 188. int nid, const char *properties, 189. void *method, void (*method_destruct)(void *)) test/property_test.c:339:14: Call 337. v[i] = 2 * i; 338. BIO_snprintf(buf, sizeof(buf), "n=%d\n", i); 339. if (!TEST_true(ossl_method_store_add(store, i, buf, "abc", NULL)) ^ 340. || !TEST_true(ossl_method_store_cache_set(store, i, buf, v + i)) 341. || !TEST_true(ossl_method_store_cache_set(store, i, "n=1234", crypto/property/property.c:187:1: Parameter `store->algs->nelem` 185. } 186. 187. > int ossl_method_store_add(OSSL_METHOD_STORE *store, 188. int nid, const char *properties, 189. void *method, void (*method_destruct)(void *)) crypto/property/property.c:228:14: Call 226. goto err; 227. alg->nid = nid; 228. if (!ossl_method_store_insert(store, alg)) ^ 229. goto err; 230. } crypto/property/property.c:182:1: Parameter `store->algs->nelem` 180. } 181. 182. > static int ossl_method_store_insert(OSSL_METHOD_STORE *store, ALGORITHM *alg) 183. { 184. return ossl_sa_ALGORITHM_set(store->algs, alg->nid, alg); crypto/property/property.c:184:16: Call 182. static int ossl_method_store_insert(OSSL_METHOD_STORE *store, ALGORITHM *alg) 183. { 184. return ossl_sa_ALGORITHM_set(store->algs, alg->nid, alg); ^ 185. } 186. crypto/property/property.c:65:1: Parameter `sa->nelem` 63. } IMPL_CACHE_FLUSH; 64. 65. > DEFINE_SPARSE_ARRAY_OF(ALGORITHM); 66. 67. static void ossl_method_cache_flush(OSSL_METHOD_STORE *store, int nid); crypto/property/property.c:65:1: Call 63. } IMPL_CACHE_FLUSH; 64. 65. > DEFINE_SPARSE_ARRAY_OF(ALGORITHM); 66. 67. static void ossl_method_cache_flush(OSSL_METHOD_STORE *store, int nid); crypto/sparse_array.c:183:1: <LHS trace> 181. } 182. 183. > int OPENSSL_SA_set(OPENSSL_SA *sa, ossl_uintmax_t posn, void *val) 184. { 185. int i, level = 1; crypto/sparse_array.c:183:1: Parameter `sa->nelem` 181. } 182. 183. > int OPENSSL_SA_set(OPENSSL_SA *sa, ossl_uintmax_t posn, void *val) 184. { 185. int i, level = 1; crypto/sparse_array.c:215:9: Binary operation: ([0, +oo] - 1):unsigned64 by call to `ossl_method_store_add` 213. p += posn & SA_BLOCK_MASK; 214. if (val == NULL && *p != NULL) 215. sa->nelem--; ^ 216. else if (val != NULL && *p == NULL) 217. sa->nelem++;
https://github.com/openssl/openssl/blob/8ab53b193a8e95bb2998744bc184146eb1ddcc23/crypto/sparse_array.c/#L215
d2a_code_trace_data_41917
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; bn_check_top(b); if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return (NULL); } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return (NULL); } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } test/bntest.c:1795: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, +oo] by call to `BN_mul`. Showing all 16 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:1795:10: Call 1793. BN_set_negative(a, 1); 1794. BN_zero(b); 1795. if (!TEST_true(BN_mul(c, a, b, ctx))) ^ 1796. goto err; 1797. if (!TEST_BN_eq_zero(c) crypto/bn/bn_mul.c:495:1: Parameter `*r->d` 493. #endif /* BN_RECURSION */ 494. 495. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 496. { 497. int ret = 0; crypto/bn/bn_mul.c:543:17: Call 541. # endif 542. if (al == 8) { 543. if (bn_wexpand(rr, 16) == NULL) ^ 544. goto err; 545. rr->top = 16; crypto/bn/bn_lib.c:948:1: Parameter `*a->d` 946. } 947. 948. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:950:37: Call 948. BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 951. } 952. crypto/bn/bn_lib.c:284:1: Parameter `*b->d` 282. */ 283. 284. > BIGNUM *bn_expand2(BIGNUM *b, int words) 285. { 286. bn_check_top(b); crypto/bn/bn_lib.c:289:23: Call 287. 288. if (words > b->dmax) { 289. BN_ULONG *a = bn_expand_internal(b, words); ^ 290. if (!a) 291. return NULL; crypto/bn/bn_lib.c:246:1: <Offset trace> 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:246:1: Parameter `b->top` 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:246:1: <Length trace> 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:246:1: Parameter `*b->d` 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:271:9: Array access: Offset added: [8, +oo] Size: [0, +oo] by call to `BN_mul` 269. assert(b->top <= words); 270. if (b->top > 0) 271. memcpy(a, b->d, sizeof(*a) * b->top); ^ 272. 273. return a;
https://github.com/openssl/openssl/blob/3f97052392cb10fca5309212bf720685262ad4a6/crypto/bn/bn_lib.c/#L271
d2a_code_trace_data_41918
static ossl_inline unsigned int constant_time_is_zero(unsigned int a) { return constant_time_msb(~a & (a - 1)); } crypto/rsa/rsa_pk1.c:202: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `constant_time_is_zero`. Showing all 6 steps of the trace crypto/rsa/rsa_pk1.c:154:1: Parameter `*from` 152. } 153. 154. > int RSA_padding_check_PKCS1_type_2(unsigned char *to, int tlen, 155. const unsigned char *from, int flen, 156. int num) crypto/rsa/rsa_pk1.c:193:9: Assignment 191. flen -= 1 & mask; 192. from -= 1 & mask; 193. *--em = *from & mask; ^ 194. } 195. crypto/rsa/rsa_pk1.c:202:32: Call 200. found_zero_byte = 0; 201. for (i = 2; i < num; i++) { 202. unsigned int equals0 = constant_time_is_zero(em[i]); ^ 203. 204. zero_index = constant_time_select_int(~found_zero_byte & equals0, include/internal/constant_time_locl.h:164:1: <LHS trace> 162. } 163. 164. > static ossl_inline unsigned int constant_time_is_zero(unsigned int a) 165. { 166. return constant_time_msb(~a & (a - 1)); include/internal/constant_time_locl.h:164:1: Parameter `a` 162. } 163. 164. > static ossl_inline unsigned int constant_time_is_zero(unsigned int a) 165. { 166. return constant_time_msb(~a & (a - 1)); include/internal/constant_time_locl.h:166:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `constant_time_is_zero` 164. static ossl_inline unsigned int constant_time_is_zero(unsigned int a) 165. { 166. return constant_time_msb(~a & (a - 1)); ^ 167. } 168.
https://github.com/openssl/openssl/blob/4c2883a9bf59c5ee31e8e2e101b3894a16c06950/include/internal/constant_time_locl.h/#L166
d2a_code_trace_data_41919
static dav_error * dav_validate_resource_state(apr_pool_t *p, const dav_resource *resource, dav_lockdb *lockdb, const dav_if_header *if_header, int flags, dav_buffer *pbuf, request_rec *r) { dav_error *err; const char *uri; const char *etag; const dav_hooks_locks *locks_hooks = (lockdb ? lockdb->hooks : NULL); const dav_if_header *ifhdr_scan; dav_if_state_list *state_list; dav_lock *lock_list; dav_lock *lock; int num_matched; int num_that_apply; int seen_locktoken; apr_size_t uri_len; const char *reason = NULL; if (lockdb == NULL) { lock_list = NULL; } else { if ((err = dav_lock_query(lockdb, resource, &lock_list)) != NULL) { return dav_push_error(p, HTTP_INTERNAL_SERVER_ERROR, 0, "The locks could not be queried for " "verification against a possible \"If:\" " "header.", err); } } if (flags & DAV_LOCKSCOPE_EXCLUSIVE) { if (lock_list != NULL) { return dav_new_error(p, HTTP_LOCKED, 0, 0, "Existing lock(s) on the requested resource " "prevent an exclusive lock."); } seen_locktoken = 1; } else if (flags & DAV_LOCKSCOPE_SHARED) { for (lock = lock_list; lock != NULL; lock = lock->next) { if (lock->scope == DAV_LOCKSCOPE_EXCLUSIVE) { return dav_new_error(p, HTTP_LOCKED, 0, 0, "The requested resource is already " "locked exclusively."); } } seen_locktoken = 1; } else { seen_locktoken = (lock_list == NULL); } if (if_header == NULL) { if (seen_locktoken) return NULL; return dav_new_error(p, HTTP_LOCKED, 0, 0, "This resource is locked and an \"If:\" header " "was not supplied to allow access to the " "resource."); } if (lock_list == NULL && if_header->dummy_header) { if (flags & DAV_VALIDATE_IS_PARENT) return NULL; return dav_new_error(p, HTTP_BAD_REQUEST, 0, 0, "The locktoken specified in the \"Lock-Token:\" " "header is invalid because this resource has no " "outstanding locks."); } uri = resource->uri; uri_len = strlen(uri); if (uri[uri_len - 1] == '/') { dav_set_bufsize(p, pbuf, uri_len); memcpy(pbuf->buf, uri, uri_len); pbuf->buf[--uri_len] = '\0'; uri = pbuf->buf; } etag = (*resource->hooks->getetag)(resource); num_that_apply = 0; for (ifhdr_scan = if_header; ifhdr_scan != NULL; ifhdr_scan = ifhdr_scan->next) { if (ifhdr_scan->uri != NULL && (uri_len != ifhdr_scan->uri_len || memcmp(uri, ifhdr_scan->uri, uri_len) != 0)) { continue; } ++num_that_apply; for (state_list = ifhdr_scan->state; state_list != NULL; state_list = state_list->next) { switch(state_list->type) { case dav_if_etag: { const char *given_etag, *current_etag; int mismatch; if (state_list->etag[0] == 'W' && state_list->etag[1] == '/') { given_etag = state_list->etag + 2; } else { given_etag = state_list->etag; } if (etag[0] == 'W' && etag[1] == '/') { current_etag = etag + 2; } else { current_etag = etag; } mismatch = strcmp(given_etag, current_etag); if (state_list->condition == DAV_IF_COND_NORMAL && mismatch) { reason = "an entity-tag was specified, but the resource's " "actual ETag does not match."; goto state_list_failed; } else if (state_list->condition == DAV_IF_COND_NOT && !mismatch) { reason = "an entity-tag was specified using the \"Not\" form, " "but the resource's actual ETag matches the provided " "entity-tag."; goto state_list_failed; } break; } case dav_if_opaquelock: if (lockdb == NULL) { if (state_list->condition == DAV_IF_COND_NOT) { continue; } reason = "a State-token was supplied, but a lock database " "is not available for to provide the required lock."; goto state_list_failed; } num_matched = 0; for (lock = lock_list; lock != NULL; lock = lock->next) { if ((*locks_hooks->compare_locktoken)(state_list->locktoken, lock->locktoken)) { continue; } seen_locktoken = 1; if (state_list->condition == DAV_IF_COND_NOT) { reason = "a State-token was supplied, which used a " "\"Not\" condition. The State-token was found " "in the locks on this resource"; goto state_list_failed; } if (lock->auth_user && (!r->user || strcmp(lock->auth_user, r->user))) { const char *errmsg; errmsg = apr_pstrcat(p, "User \"", r->user, "\" submitted a locktoken created " "by user \"", lock->auth_user, "\".", NULL); return dav_new_error(p, HTTP_FORBIDDEN, 0, 0, errmsg); } num_matched = 1; break; } if (num_matched == 0 && state_list->condition == DAV_IF_COND_NORMAL) { reason = "a State-token was supplied, but it was not found " "in the locks on this resource."; goto state_list_failed; } break; case dav_if_unknown: if (state_list->condition == DAV_IF_COND_NORMAL) { reason = "an unknown state token was supplied"; goto state_list_failed; } break; } } if (seen_locktoken) { return NULL; } break; state_list_failed: ; } if (ifhdr_scan == NULL) { if (num_that_apply == 0) { if (seen_locktoken) return NULL; if (dav_find_submitted_locktoken(if_header, lock_list, locks_hooks)) { return NULL; } return dav_new_error(p, HTTP_LOCKED, 0 , 0, "This resource is locked and the \"If:\" " "header did not specify one of the " "locktokens for this resource's lock(s)."); } if (if_header->dummy_header) { return dav_new_error(p, HTTP_BAD_REQUEST, 0, 0, "The locktoken specified in the " "\"Lock-Token:\" header did not specify one " "of this resource's locktoken(s)."); } if (reason == NULL) { return dav_new_error(p, HTTP_PRECONDITION_FAILED, 0, 0, "The preconditions specified by the \"If:\" " "header did not match this resource."); } return dav_new_error(p, HTTP_PRECONDITION_FAILED, 0, 0, apr_psprintf(p, "The precondition(s) specified by " "the \"If:\" header did not match " "this resource. At least one " "failure is because: %s", reason)); } if (dav_find_submitted_locktoken(if_header, lock_list, locks_hooks)) { return NULL; } if (if_header->dummy_header) { return dav_new_error(p, HTTP_BAD_REQUEST, 0, 0, "The locktoken specified in the " "\"Lock-Token:\" header did not specify one " "of this resource's locktoken(s)."); } return dav_new_error(p, HTTP_LOCKED, 1 , 0, "This resource is locked and the \"If:\" header " "did not specify one of the " "locktokens for this resource's lock(s)."); } modules/dav/main/mod_dav.c:2790: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `dav_validate_request`. modules/dav/main/mod_dav.c:2733:18: Call 2731. 2732. /* get and parse the Depth header value. "0" and "infinity" are legal. */ 2733. if ((depth = dav_get_depth(r, DAV_INFINITY)) < 0) { ^ 2734. /* dav_get_depth() supplies additional information for the 2735. * default message. */ modules/dav/main/mod_dav.c:641:25: Unknown value from: apr_table_get 639. DAV_DECLARE(int) dav_get_depth(request_rec *r, int def_depth) 640. { 641. const char *depth = apr_table_get(r->headers_in, "Depth"); ^ 642. 643. if (depth == NULL) { modules/dav/main/mod_dav.c:2790:16: Call 2788. * (see dav_method_delete() for more information) 2789. */ 2790. if ((err = dav_validate_request(lookup.rnew, resnew, DAV_INFINITY, NULL, ^ 2791. &multi_response, 2792. DAV_VALIDATE_PARENT modules/dav/main/util.c:1455:1: Parameter `resource->uri->strlen` 1453. ** error is necessary, response will point to it, else NULL. 1454. */ 1455. DAV_DECLARE(dav_error *) dav_validate_request(request_rec *r, ^ 1456. dav_resource *resource, 1457. int depth, modules/dav/main/util.c:1586:15: Call 1584. } 1585. else { 1586. err = dav_validate_resource_state(r->pool, resource, lockdb, ^ 1587. if_header, flags, &work_buf, r); 1588. } modules/dav/main/util.c:802:1: <LHS trace> 800. * Returns NULL if path/uri meets if-header and lock requirements 801. */ 802. static dav_error * dav_validate_resource_state(apr_pool_t *p, ^ 803. const dav_resource *resource, 804. dav_lockdb *lockdb, modules/dav/main/util.c:802:1: Parameter `resource->uri->strlen` 800. * Returns NULL if path/uri meets if-header and lock requirements 801. */ 802. static dav_error * dav_validate_resource_state(apr_pool_t *p, ^ 803. const dav_resource *resource, 804. dav_lockdb *lockdb, modules/dav/main/util.c:988:5: Assignment 986. */ 987. uri = resource->uri; 988. uri_len = strlen(uri); ^ 989. if (uri[uri_len - 1] == '/') { 990. dav_set_bufsize(p, pbuf, uri_len); modules/dav/main/util.c:989:9: Binary operation: ([0, +oo] - 1):unsigned64 by call to `dav_validate_request` 987. uri = resource->uri; 988. uri_len = strlen(uri); 989. if (uri[uri_len - 1] == '/') { ^ 990. dav_set_bufsize(p, pbuf, uri_len); 991. memcpy(pbuf->buf, uri, uri_len);
https://github.com/apache/httpd/blob/8b2ec33ac5d314be345814db08e194ffeda6beb0/modules/dav/main/util.c/#L989
d2a_code_trace_data_41920
static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, long max) { const unsigned char *p = *pp; unsigned long ret = 0; unsigned long i; if (max-- < 1) return 0; if (*p == 0x80) { *inf = 1; ret = 0; p++; } else { *inf = 0; i = *p & 0x7f; if (*(p++) & 0x80) { if (max < (long)i + 1) return 0; while (i && *p == 0) { p++; i--; } if (i > sizeof(long)) return 0; while (i-- > 0) { ret <<= 8L; ret |= *(p++); } } else ret = i; } if (ret > LONG_MAX) return 0; *pp = p; *rl = (long)ret; return 1; } crypto/pem/pem_pkey.c:41: error: BUFFER_OVERRUN_L3 Offset: [2, +oo] Size: [1, +oo] by call to `d2i_PKCS8_PRIV_KEY_INFO`. Showing all 27 steps of the trace crypto/pem/pem_pkey.c:35:10: Call 33. EVP_PKEY *ret = NULL; 34. 35. if (!PEM_bytes_read_bio(&data, &len, &nm, PEM_STRING_EVP_PKEY, bp, cb, u)) ^ 36. return NULL; 37. p = data; crypto/pem/pem_lib.c:288:1: Parameter `**pdata` 286. } 287. 288. > int PEM_bytes_read_bio(unsigned char **pdata, long *plen, char **pnm, 289. const char *name, BIO *bp, pem_password_cb *cb, 290. void *u) { crypto/pem/pem_lib.c:291:12: Call 289. const char *name, BIO *bp, pem_password_cb *cb, 290. void *u) { 291. return pem_bytes_read_bio_flags(pdata, plen, pnm, name, bp, cb, u, ^ 292. PEM_FLAG_EAY_COMPATIBLE); 293. } crypto/pem/pem_lib.c:245:1: Parameter `**pdata` 243. } 244. 245. > static int pem_bytes_read_bio_flags(unsigned char **pdata, long *plen, 246. char **pnm, const char *name, BIO *bp, 247. pem_password_cb *cb, void *u, crypto/pem/pem_pkey.c:37:5: Assignment 35. if (!PEM_bytes_read_bio(&data, &len, &nm, PEM_STRING_EVP_PKEY, bp, cb, u)) 36. return NULL; 37. p = data; ^ 38. 39. if (strcmp(nm, PEM_STRING_PKCS8INF) == 0) { crypto/pem/pem_pkey.c:41:17: Call 39. if (strcmp(nm, PEM_STRING_PKCS8INF) == 0) { 40. PKCS8_PRIV_KEY_INFO *p8inf; 41. p8inf = d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, len); ^ 42. if (!p8inf) 43. goto p8err; crypto/asn1/p8_pkey.c:36:1: Parameter `**in` 34. } ASN1_SEQUENCE_END_cb(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) 35. 36. > IMPLEMENT_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO) 37. 38. int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj, crypto/asn1/p8_pkey.c:36:1: Call 34. } ASN1_SEQUENCE_END_cb(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO) 35. 36. > IMPLEMENT_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO) 37. 38. int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj, crypto/asn1/tasn_dec.c:95:1: Parameter `**in` 93. */ 94. 95. > ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, 96. const unsigned char **in, long len, 97. const ASN1_ITEM *it) crypto/asn1/tasn_dec.c:104:9: Call 102. pval = &ptmpval; 103. asn1_tlc_clear_nc(&c); 104. if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) ^ 105. return *pval; 106. return NULL; crypto/asn1/tasn_dec.c:109:1: Parameter `**in` 107. } 108. 109. > int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, 110. const ASN1_ITEM *it, 111. int tag, int aclass, char opt, ASN1_TLC *ctx) crypto/asn1/tasn_dec.c:114:10: Call 112. { 113. int rv; 114. rv = asn1_item_embed_d2i(pval, in, len, it, tag, aclass, opt, ctx); ^ 115. if (rv <= 0) 116. ASN1_item_ex_free(pval, it); crypto/asn1/tasn_dec.c:125:1: Parameter `**in` 123. */ 124. 125. > static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in, 126. long len, const ASN1_ITEM *it, 127. int tag, int aclass, char opt, ASN1_TLC *ctx) crypto/asn1/tasn_dec.c:169:9: Assignment 167. 168. case ASN1_ITYPE_MSTRING: 169. p = *in; ^ 170. /* Just read in tag and class */ 171. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, crypto/asn1/tasn_dec.c:171:15: Call 169. p = *in; 170. /* Just read in tag and class */ 171. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, ^ 172. &p, len, -1, 0, 1, ctx); 173. if (!ret) { crypto/asn1/tasn_dec.c:1060:1: Parameter `**in` 1058. */ 1059. 1060. > static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, 1061. char *inf, char *cst, 1062. const unsigned char **in, long len, crypto/asn1/tasn_dec.c:1069:5: Assignment 1067. long plen; 1068. const unsigned char *p, *q; 1069. p = *in; ^ 1070. q = p; 1071. crypto/asn1/tasn_dec.c:1079:13: Call 1077. p += ctx->hdrlen; 1078. } else { 1079. i = ASN1_get_object(&p, &plen, &ptag, &pclass, len); ^ 1080. if (ctx) { 1081. ctx->ret = i; crypto/asn1/asn1_lib.c:44:1: Parameter `**pp` 42. } 43. 44. > int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, 45. int *pclass, long omax) 46. { crypto/asn1/asn1_lib.c:49:5: Assignment 47. int i, ret; 48. long l; 49. const unsigned char *p = *pp; ^ 50. int tag, xclass, inf; 51. long max = omax; crypto/asn1/asn1_lib.c:78:9: Assignment 76. } else { 77. tag = i; 78. p++; ^ 79. if (--max == 0) 80. goto err; crypto/asn1/asn1_lib.c:84:10: Call 82. *ptag = tag; 83. *pclass = xclass; 84. if (!asn1_get_length(&p, &inf, plength, max)) ^ 85. goto err; 86. crypto/asn1/asn1_lib.c:105:1: <Length trace> 103. } 104. 105. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, 106. long max) 107. { crypto/asn1/asn1_lib.c:105:1: Parameter `**pp` 103. } 104. 105. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, 106. long max) 107. { crypto/asn1/asn1_lib.c:108:5: Assignment 106. long max) 107. { 108. const unsigned char *p = *pp; ^ 109. unsigned long ret = 0; 110. unsigned long i; crypto/asn1/asn1_lib.c:121:15: Assignment 119. *inf = 0; 120. i = *p & 0x7f; 121. if (*(p++) & 0x80) { ^ 122. if (max < (long)i + 1) 123. return 0; crypto/asn1/asn1_lib.c:125:25: Array access: Offset: [2, +oo] Size: [1, +oo] by call to `d2i_PKCS8_PRIV_KEY_INFO` 123. return 0; 124. /* Skip leading zeroes */ 125. while (i && *p == 0) { ^ 126. p++; 127. i--;
https://github.com/openssl/openssl/blob/7671342e550ed2de676b23c79d0e7f45a381c76e/crypto/asn1/asn1_lib.c/#L125
d2a_code_trace_data_41921
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; } crypto/sm2/sm2_crypt.c:329: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `EC_POINT_mul`. Showing all 27 steps of the trace crypto/sm2/sm2_crypt.c:329:17: Call 327. if (!EC_POINT_set_affine_coordinates_GFp(group, C1, sm2_ctext->C1x, 328. sm2_ctext->C1y, ctx) 329. || !EC_POINT_mul(group, C1, NULL, C1, EC_KEY_get0_private_key(key), ^ 330. ctx) 331. || !EC_POINT_get_affine_coordinates_GFp(group, C1, x2, y2, ctx)) { crypto/ec/ec_lib.c:929:1: Parameter `group->order->top` 927. } 928. 929. > int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, 930. const EC_POINT *point, const BIGNUM *p_scalar, BN_CTX *ctx) 931. { crypto/ec/ec_lib.c:940:12: Call 938. scalars[0] = p_scalar; 939. 940. return EC_POINTs_mul(group, r, g_scalar, ^ 941. (point != NULL 942. && p_scalar != NULL), points, scalars, ctx); crypto/ec/ec_lib.c:918:1: Parameter `group->order->top` 916. */ 917. 918. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 919. size_t num, const EC_POINT *points[], 920. const BIGNUM *scalars[], BN_CTX *ctx) crypto/ec/ec_lib.c:924:16: Call 922. if (group->meth->mul == 0) 923. /* use default */ 924. return ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx); ^ 925. 926. return group->meth->mul(group, r, scalar, num, points, scalars, ctx); crypto/ec/ec_mult.c:342:1: Parameter `group->order->top` 340. * in the addition if scalar != NULL 341. */ 342. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 343. size_t num, const EC_POINT *points[], const BIGNUM *scalars[], 344. BN_CTX *ctx) crypto/ec/ec_mult.c:393:16: Call 391. * constant time version. 392. */ 393. return ec_mul_consttime(group, r, scalar, NULL, ctx); ^ 394. } 395. if ((scalar == NULL) && (num == 1)) { crypto/ec/ec_mult.c:131:1: Parameter `group->order->top` 129. * Returns 1 on success, 0 otherwise. 130. */ 131. > static int ec_mul_consttime(const EC_GROUP *group, EC_POINT *r, 132. const BIGNUM *scalar, const EC_POINT *point, 133. BN_CTX *ctx) crypto/ec/ec_mult.c:147:18: Call 145. BN_CTX_start(ctx); 146. 147. order_bits = BN_num_bits(group->order); ^ 148. 149. s = EC_POINT_new(group); crypto/bn/bn_lib.c:139:9: Call 137. bn_check_top(a); 138. 139. if (BN_is_zero(a)) ^ 140. return 0; 141. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); crypto/bn/bn_lib.c:845:1: Parameter `a->top` 843. } 844. 845. > int BN_is_zero(const BIGNUM *a) 846. { 847. return a->top == 0; crypto/ec/ec_mult.c:189:14: Call 187. * constant-timeness 188. */ 189. if (!BN_nnmod(k, k, group->order, ctx)) ^ 190. goto err; 191. } crypto/bn/bn_mod.c:13:1: Parameter `d->top` 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:199:31: Call 197. 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) 201. goto err; crypto/bn/bn_lib.c:140:9: Assignment 138. 139. if (BN_is_zero(a)) 140. return 0; ^ 141. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); 142. } crypto/bn/bn_div.c:199:5: Assignment 197. 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) 201. goto err; crypto/bn/bn_div.c:200:11: Call 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) ^ 201. goto err; 202. sdiv->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:941:1: Parameter `*a->d` 939. } 940. 941. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 942. { 943. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_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 `EC_POINT_mul` 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/630fe1da888490b7dfef3fe0928b813ddff5d51a/crypto/bn/bn_shift.c/#L112
d2a_code_trace_data_41922
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ecp_smpl.c:1348: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end`. Showing all 10 steps of the trace crypto/ec/ecp_smpl.c:1220:5: Call 1218. } 1219. 1220. BN_CTX_start(ctx); ^ 1221. tmp = BN_CTX_get(ctx); 1222. tmp_Z = 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/ec/ecp_smpl.c:1348:5: Call 1346. 1347. err: 1348. BN_CTX_end(ctx); ^ 1349. BN_CTX_free(new_ctx); 1350. if (prod_Z != NULL) { 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
d2a_code_trace_data_41923
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:822: error: NULL_DEREFERENCE pointer `x` last assigned on line 821 could be null and is dereferenced by call to `X509_get1_ocsp()` at line 822, column 8. Showing all 27 steps of the trace apps/s_server.c:795:1: start of procedure cert_status_cb() 793. */ 794. 795. > static int cert_status_cb(SSL *s, void *arg) 796. { 797. tlsextstatusctx *srctx = arg; apps/s_server.c:797:2: 795. static int cert_status_cb(SSL *s, void *arg) 796. { 797. > tlsextstatusctx *srctx = arg; 798. BIO *err = srctx->err; 799. char *host, *port, *path; apps/s_server.c:798:2: 796. { 797. tlsextstatusctx *srctx = arg; 798. > BIO *err = srctx->err; 799. char *host, *port, *path; 800. int use_ssl; apps/s_server.c:801:2: 799. char *host, *port, *path; 800. int use_ssl; 801. > unsigned char *rspder = NULL; 802. int rspderlen; 803. STACK_OF(OPENSSL_STRING) *aia = NULL; apps/s_server.c:803:2: 801. unsigned char *rspder = NULL; 802. int rspderlen; 803. > STACK_OF(OPENSSL_STRING) *aia = NULL; 804. X509 *x = NULL; 805. X509_STORE_CTX inctx; apps/s_server.c:804:2: 802. int rspderlen; 803. STACK_OF(OPENSSL_STRING) *aia = NULL; 804. > X509 *x = NULL; 805. X509_STORE_CTX inctx; 806. X509_OBJECT obj; apps/s_server.c:807:2: 805. X509_STORE_CTX inctx; 806. X509_OBJECT obj; 807. > OCSP_REQUEST *req = NULL; 808. OCSP_RESPONSE *resp = NULL; 809. OCSP_CERTID *id = NULL; apps/s_server.c:808:2: 806. X509_OBJECT obj; 807. OCSP_REQUEST *req = NULL; 808. > OCSP_RESPONSE *resp = NULL; 809. OCSP_CERTID *id = NULL; 810. STACK_OF(X509_EXTENSION) *exts; apps/s_server.c:809:2: 807. OCSP_REQUEST *req = NULL; 808. OCSP_RESPONSE *resp = NULL; 809. > OCSP_CERTID *id = NULL; 810. STACK_OF(X509_EXTENSION) *exts; 811. int ret = SSL_TLSEXT_ERR_NOACK; apps/s_server.c:811:2: 809. OCSP_CERTID *id = NULL; 810. STACK_OF(X509_EXTENSION) *exts; 811. > int ret = SSL_TLSEXT_ERR_NOACK; 812. int i; 813. #if 0 apps/s_server.c:818:6: Taking true branch 816. BIO_printf(err, "cert_status: received %d ids\n", sk_OCSP_RESPID_num(ids)); 817. #endif 818. if (srctx->verbose) ^ 819. BIO_puts(err, "cert_status: callback called\n"); 820. /* Build up OCSP query from server certificate */ apps/s_server.c:819:3: 817. #endif 818. if (srctx->verbose) 819. > BIO_puts(err, "cert_status: callback called\n"); 820. /* Build up OCSP query from server certificate */ 821. 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 true 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:271:4: Taking true branch 269. 270. if ((cb != NULL) && 271. ((i=(int)cb(b,BIO_CB_PUTS,in,0,0L,1L)) <= 0)) ^ 272. return(i); 273. crypto/bio/bio_lib.c:272:4: 270. if ((cb != NULL) && 271. ((i=(int)cb(b,BIO_CB_PUTS,in,0,0L,1L)) <= 0)) 272. > return(i); 273. 274. if (!b->init) 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:821:2: 819. BIO_puts(err, "cert_status: callback called\n"); 820. /* Build up OCSP query from server certificate */ 821. > x = SSL_get_certificate(s); 822. aia = X509_get1_ocsp(x); 823. if (aia) ssl/ssl_lib.c:2858:1: start of procedure SSL_get_certificate() 2856. 2857. /* Fix this function so that it takes an optional type parameter */ 2858. > X509 *SSL_get_certificate(const SSL *s) 2859. { 2860. if (s->cert != NULL) ssl/ssl_lib.c:2860:6: Taking false branch 2858. X509 *SSL_get_certificate(const SSL *s) 2859. { 2860. if (s->cert != NULL) ^ 2861. return(s->cert->key->x509); 2862. else ssl/ssl_lib.c:2863:3: 2861. return(s->cert->key->x509); 2862. else 2863. > return(NULL); 2864. } 2865. ssl/ssl_lib.c:2864:2: return from a call to SSL_get_certificate 2862. else 2863. return(NULL); 2864. } ^ 2865. 2866. /* Fix this function so that it takes an optional type parameter */ apps/s_server.c:822:2: 820. /* Build up OCSP query from server certificate */ 821. x = SSL_get_certificate(s); 822. > aia = X509_get1_ocsp(x); 823. if (aia) 824. {
https://github.com/openssl/openssl/blob/ec4a50b3c3f2f50caccfd52e939857a5d6f02fd1/apps/s_server.c/#L822
d2a_code_trace_data_41924
static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, OPENSSL_LH_DOALL_FUNC func, OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) { int i; OPENSSL_LH_NODE *a, *n; if (lh == NULL) return; for (i = lh->num_nodes - 1; i >= 0; i--) { a = lh->b[i]; while (a != NULL) { n = a->next; if (use_arg) func_arg(a->data, arg); else func(a->data); a = n; } } } apps/s_client.c:2420: error: INTEGER_OVERFLOW_L2 ([0, 8] - 1):unsigned32 by call to `SSL_free`. Showing all 18 steps of the trace apps/s_client.c:1457:11: Call 1455. #endif 1456. 1457. ctx = SSL_CTX_new(meth); ^ 1458. if (ctx == NULL) { 1459. ERR_print_errors(bio_err); ssl/ssl_lib.c:2321:21: Call 2319. goto err; 2320. 2321. ret->sessions = lh_SSL_SESSION_new(ssl_session_hash, ssl_session_cmp); ^ 2322. if (ret->sessions == NULL) 2323. goto err; ssl/ssl_locl.h:581:1: Call 579. }; 580. 581. > DEFINE_LHASH_OF(SSL_SESSION); 582. /* Needed in ssl_cert.c */ 583. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:37:5: Assignment 35. ret->comp = ((c == NULL) ? (OPENSSL_LH_COMPFUNC)strcmp : c); 36. ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h); 37. ret->num_nodes = MIN_NODES / 2; ^ 38. ret->num_alloc_nodes = MIN_NODES; 39. ret->pmax = MIN_NODES / 2; apps/s_client.c:2420:9: Call 2418. if (prexit != 0) 2419. print_stuff(bio_c_out, con, 1); 2420. SSL_free(con); ^ 2421. } 2422. #if !defined(OPENSSL_NO_NEXTPROTONEG) ssl/ssl_lib.c:926:1: Parameter `s->ctx->sessions->num_nodes` 924. } 925. 926. > void SSL_free(SSL *s) 927. { 928. int i; ssl/ssl_lib.c:998:5: Call 996. RECORD_LAYER_release(&s->rlayer); 997. 998. SSL_CTX_free(s->ctx); ^ 999. 1000. ASYNC_WAIT_CTX_free(s->waitctx); ssl/ssl_lib.c:2429:1: Parameter `a->sessions->num_nodes` 2427. } 2428. 2429. > void SSL_CTX_free(SSL_CTX *a) 2430. { 2431. int i; ssl/ssl_lib.c:2455:9: Call 2453. */ 2454. if (a->sessions != NULL) 2455. SSL_CTX_flush_sessions(a, 0); ^ 2456. 2457. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:974:1: Parameter `s->sessions->num_nodes` 972. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 973. 974. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 975. { 976. unsigned long i; ssl/ssl_sess.c:987:5: Call 985. i = lh_SSL_SESSION_get_down_load(s->sessions); 986. lh_SSL_SESSION_set_down_load(s->sessions, 0); 987. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp); ^ 988. lh_SSL_SESSION_set_down_load(s->sessions, i); 989. CRYPTO_THREAD_unlock(s->lock); ssl/ssl_sess.c:972:1: Parameter `lh->num_nodes` 970. } 971. 972. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 973. 974. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) ssl/ssl_sess.c:972:1: Call 970. } 971. 972. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 973. 974. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) crypto/lhash/lhash.c:182:1: Parameter `lh->num_nodes` 180. } 181. 182. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); crypto/lhash/lhash.c:184:5: Call 182. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); ^ 185. } 186. crypto/lhash/lhash.c:150:1: <LHS trace> 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:150:1: Parameter `lh->num_nodes` 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:164:10: Binary operation: ([0, 8] - 1):unsigned32 by call to `SSL_free` 162. * memory leaks otherwise 163. */ 164. for (i = lh->num_nodes - 1; i >= 0; i--) { ^ 165. a = lh->b[i]; 166. while (a != NULL) {
https://github.com/openssl/openssl/blob/2a7de0fd5d9baf946ef4d2c51096b04dd47a8143/crypto/lhash/lhash.c/#L164
d2a_code_trace_data_41925
static void unpack_input(const unsigned char *input, unsigned int *output) { unsigned int outbuffer[28]; unsigned short inbuffer[10]; unsigned int x; unsigned int *ptr; for (x=0;x<20;x+=2) inbuffer[x/2]=(input[x]<<8)+input[x+1]; ptr=outbuffer; *(ptr++)=27; *(ptr++)=(inbuffer[0]>>10)&0x3f; *(ptr++)=(inbuffer[0]>>5)&0x1f; *(ptr++)=inbuffer[0]&0x1f; *(ptr++)=(inbuffer[1]>>12)&0xf; *(ptr++)=(inbuffer[1]>>8)&0xf; *(ptr++)=(inbuffer[1]>>5)&7; *(ptr++)=(inbuffer[1]>>2)&7; *(ptr++)=((inbuffer[1]<<1)&6)|((inbuffer[2]>>15)&1); *(ptr++)=(inbuffer[2]>>12)&7; *(ptr++)=(inbuffer[2]>>10)&3; *(ptr++)=(inbuffer[2]>>5)&0x1f; *(ptr++)=((inbuffer[2]<<2)&0x7c)|((inbuffer[3]>>14)&3); *(ptr++)=(inbuffer[3]>>6)&0xff; *(ptr++)=((inbuffer[3]<<1)&0x7e)|((inbuffer[4]>>15)&1); *(ptr++)=(inbuffer[4]>>8)&0x7f; *(ptr++)=(inbuffer[4]>>1)&0x7f; *(ptr++)=((inbuffer[4]<<7)&0x80)|((inbuffer[5]>>9)&0x7f); *(ptr++)=(inbuffer[5]>>2)&0x7f; *(ptr++)=((inbuffer[5]<<5)&0x60)|((inbuffer[6]>>11)&0x1f); *(ptr++)=(inbuffer[6]>>4)&0x7f; *(ptr++)=((inbuffer[6]<<4)&0xf0)|((inbuffer[7]>>12)&0xf); *(ptr++)=(inbuffer[7]>>5)&0x7f; *(ptr++)=((inbuffer[7]<<2)&0x7c)|((inbuffer[8]>>14)&3); *(ptr++)=(inbuffer[8]>>7)&0x7f; *(ptr++)=((inbuffer[8]<<1)&0xfe)|((inbuffer[9]>>15)&1); *(ptr++)=(inbuffer[9]>>8)&0x7f; *(ptr++)=(inbuffer[9]>>1)&0x7f; *(output++)=outbuffer[11]; for (x=1;x<11;*(output++)=outbuffer[x++]); ptr=outbuffer+12; for (x=0;x<16;x+=4) { *(output++)=ptr[x]; *(output++)=ptr[x+2]; *(output++)=ptr[x+3]; *(output++)=ptr[x+1]; } } libavcodec/ra144.c:268: error: Uninitialized Value The value read from inbuffer[_] was never initialized. libavcodec/ra144.c:268:3: 266. ptr=outbuffer; 267. *(ptr++)=27; 268. *(ptr++)=(inbuffer[0]>>10)&0x3f; ^ 269. *(ptr++)=(inbuffer[0]>>5)&0x1f; 270. *(ptr++)=inbuffer[0]&0x1f;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ra144.c/#L268
d2a_code_trace_data_41926
int bn_cmp_words(const BN_ULONG *a, const BN_ULONG *b, int n) { int i; BN_ULONG aa, bb; aa = a[n - 1]; bb = b[n - 1]; if (aa != bb) return ((aa > bb) ? 1 : -1); for (i = n - 2; i >= 0; i--) { aa = a[i]; bb = b[i]; if (aa != bb) return ((aa > bb) ? 1 : -1); } return (0); } test/bntest.c:238: error: BUFFER_OVERRUN_L3 Offset: [8, +oo] (⇐ [8, +oo] + [0, +oo]) Size: [0, 8388607] by call to `BN_div_recp`. Showing all 19 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->N.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)) crypto/bn/bn_recp.c:46:10: Call 44. int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *d, BN_CTX *ctx) 45. { 46. if (!BN_copy(&(recp->N), d)) ^ 47. return 0; 48. BN_zero(&(recp->Nr)); crypto/bn/bn_lib.c:362:1: Parameter `*a->d` 360. } 361. 362. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 363. { 364. int i; 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:83:1: Parameter `*recp->N.d` 81. } 82. 83. > int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, 84. BN_RECP_CTX *recp, BN_CTX *ctx) 85. { crypto/bn/bn_recp.c:145:10: Call 143. d->neg = 0; 144. 145. if (!BN_mul(b, &(recp->N), d, ctx)) ^ 146. goto err; 147. if (!BN_usub(r, m, b)) crypto/bn/bn_mul.c:828:1: Parameter `*a->d` 826. #endif /* BN_RECURSION */ 827. 828. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 829. { 830. int ret = 0; crypto/bn/bn_mul.c:909:17: Call 907. if (bn_wexpand(rr, k * 4) == NULL) 908. goto err; 909. bn_mul_part_recursive(rr->d, a->d, b->d, ^ 910. j, al - j, bl - j, t->d); 911. } else { /* al <= j || bl <= j */ crypto/bn/bn_mul.c:480:1: Parameter `n` 478. */ 479. /* tnX may not be negative but less than n */ 480. > void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n, 481. int tna, int tnb, BN_ULONG *t) 482. { crypto/bn/bn_mul.c:493:10: Call 491. 492. /* r=(a[0]-a[1])*(b[1]-b[0]) */ 493. c1 = bn_cmp_part_words(a, &(a[n]), tna, n - tna); ^ 494. c2 = bn_cmp_part_words(&(b[n]), b, tnb, tnb - n); 495. neg = 0; crypto/bn/bn_lib.c:803:1: Parameter `cl` 801. */ 802. 803. > int bn_cmp_part_words(const BN_ULONG *a, const BN_ULONG *b, int cl, int dl) 804. { 805. int n, i; crypto/bn/bn_lib.c:820:12: Call 818. } 819. } 820. return bn_cmp_words(a, b, cl); ^ 821. } 822. crypto/bn/bn_lib.c:776:1: <Offset trace> 774. } 775. 776. > int bn_cmp_words(const BN_ULONG *a, const BN_ULONG *b, int n) 777. { 778. int i; crypto/bn/bn_lib.c:776:1: Parameter `n` 774. } 775. 776. > int bn_cmp_words(const BN_ULONG *a, const BN_ULONG *b, int n) 777. { 778. int i; crypto/bn/bn_lib.c:785:10: Assignment 783. if (aa != bb) 784. return ((aa > bb) ? 1 : -1); 785. for (i = n - 2; i >= 0; i--) { ^ 786. aa = a[i]; 787. bb = b[i]; crypto/bn/bn_lib.c:776:1: <Length trace> 774. } 775. 776. > int bn_cmp_words(const BN_ULONG *a, const BN_ULONG *b, int n) 777. { 778. int i; crypto/bn/bn_lib.c:776:1: Parameter `*b` 774. } 775. 776. > int bn_cmp_words(const BN_ULONG *a, const BN_ULONG *b, int n) 777. { 778. int i; crypto/bn/bn_lib.c:787:14: Array access: Offset: [8, +oo] (⇐ [8, +oo] + [0, +oo]) Size: [0, 8388607] by call to `BN_div_recp` 785. for (i = n - 2; i >= 0; i--) { 786. aa = a[i]; 787. bb = b[i]; ^ 788. if (aa != bb) 789. return ((aa > bb) ? 1 : -1);
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_lib.c/#L787
d2a_code_trace_data_41927
int print_attribs(BIO *out, const STACK_OF(X509_ATTRIBUTE) *attrlst, const char *name) { X509_ATTRIBUTE *attr; ASN1_TYPE *av; char *value; int i, attr_nid; if (!attrlst) { BIO_printf(out, "%s: <No Attributes>\n", name); return 1; } if (!sk_X509_ATTRIBUTE_num(attrlst)) { BIO_printf(out, "%s: <Empty Attributes>\n", name); return 1; } BIO_printf(out, "%s\n", name); for (i = 0; i < sk_X509_ATTRIBUTE_num(attrlst); i++) { ASN1_OBJECT *attr_obj; attr = sk_X509_ATTRIBUTE_value(attrlst, i); attr_obj = X509_ATTRIBUTE_get0_object(attr); attr_nid = OBJ_obj2nid(attr_obj); BIO_printf(out, " "); if (attr_nid == NID_undef) { i2a_ASN1_OBJECT(out, attr_obj); BIO_printf(out, ": "); } else { BIO_printf(out, "%s: ", OBJ_nid2ln(attr_nid)); } if (X509_ATTRIBUTE_count(attr)) { av = X509_ATTRIBUTE_get0_type(attr, 0); switch (av->type) { case V_ASN1_BMPSTRING: value = OPENSSL_uni2asc(av->value.bmpstring->data, av->value.bmpstring->length); BIO_printf(out, "%s\n", value); OPENSSL_free(value); break; case V_ASN1_OCTET_STRING: hex_prin(out, av->value.octet_string->data, av->value.octet_string->length); BIO_printf(out, "\n"); break; case V_ASN1_BIT_STRING: hex_prin(out, av->value.bit_string->data, av->value.bit_string->length); BIO_printf(out, "\n"); break; default: BIO_printf(out, "<Unsupported tag %d>\n", av->type); break; } } else { BIO_printf(out, "<No Values>\n"); } } return 1; } apps/pkcs12.c:914: error: NULL_DEREFERENCE pointer `av` last assigned on line 913 could be null and is dereferenced at line 914, column 21. Showing all 91 steps of the trace apps/pkcs12.c:883:1: start of procedure print_attribs() 881. /* Generalised attribute print: handle PKCS#8 and bag attributes */ 882. 883. > int print_attribs(BIO *out, const STACK_OF(X509_ATTRIBUTE) *attrlst, 884. const char *name) 885. { apps/pkcs12.c:890:10: Taking false branch 888. char *value; 889. int i, attr_nid; 890. if (!attrlst) { ^ 891. BIO_printf(out, "%s: <No Attributes>\n", name); 892. return 1; apps/pkcs12.c:894:10: 892. return 1; 893. } 894. > if (!sk_X509_ATTRIBUTE_num(attrlst)) { 895. BIO_printf(out, "%s: <Empty Attributes>\n", name); 896. return 1; include/openssl/x509.h:89:1: start of procedure sk_X509_ATTRIBUTE_num() 87. typedef struct x509_attributes_st X509_ATTRIBUTE; 88. 89. > DEFINE_STACK_OF(X509_ATTRIBUTE) 90. 91. typedef struct X509_req_info_st X509_REQ_INFO; crypto/stack/stack.c:379:1: start of procedure OPENSSL_sk_num() 377. } 378. 379. > int OPENSSL_sk_num(const OPENSSL_STACK *st) 380. { 381. return st == NULL ? -1 : st->num; crypto/stack/stack.c:381:12: Condition is false 379. int OPENSSL_sk_num(const OPENSSL_STACK *st) 380. { 381. return st == NULL ? -1 : st->num; ^ 382. } 383. crypto/stack/stack.c:381:5: 379. int OPENSSL_sk_num(const OPENSSL_STACK *st) 380. { 381. > return st == NULL ? -1 : st->num; 382. } 383. crypto/stack/stack.c:382:1: return from a call to OPENSSL_sk_num 380. { 381. return st == NULL ? -1 : st->num; 382. > } 383. 384. void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i) include/openssl/x509.h:89:1: return from a call to sk_X509_ATTRIBUTE_num 87. typedef struct x509_attributes_st X509_ATTRIBUTE; 88. 89. > DEFINE_STACK_OF(X509_ATTRIBUTE) 90. 91. typedef struct X509_req_info_st X509_REQ_INFO; apps/pkcs12.c:894:10: Taking false branch 892. return 1; 893. } 894. if (!sk_X509_ATTRIBUTE_num(attrlst)) { ^ 895. BIO_printf(out, "%s: <Empty Attributes>\n", name); 896. return 1; apps/pkcs12.c:898:5: Skipping BIO_printf(): empty list of specs 896. return 1; 897. } 898. BIO_printf(out, "%s\n", name); ^ 899. for (i = 0; i < sk_X509_ATTRIBUTE_num(attrlst); i++) { 900. ASN1_OBJECT *attr_obj; apps/pkcs12.c:899:10: 897. } 898. BIO_printf(out, "%s\n", name); 899. > for (i = 0; i < sk_X509_ATTRIBUTE_num(attrlst); i++) { 900. ASN1_OBJECT *attr_obj; 901. attr = sk_X509_ATTRIBUTE_value(attrlst, i); apps/pkcs12.c:899:17: 897. } 898. BIO_printf(out, "%s\n", name); 899. > for (i = 0; i < sk_X509_ATTRIBUTE_num(attrlst); i++) { 900. ASN1_OBJECT *attr_obj; 901. attr = sk_X509_ATTRIBUTE_value(attrlst, i); include/openssl/x509.h:89:1: start of procedure sk_X509_ATTRIBUTE_num() 87. typedef struct x509_attributes_st X509_ATTRIBUTE; 88. 89. > DEFINE_STACK_OF(X509_ATTRIBUTE) 90. 91. typedef struct X509_req_info_st X509_REQ_INFO; crypto/stack/stack.c:379:1: start of procedure OPENSSL_sk_num() 377. } 378. 379. > int OPENSSL_sk_num(const OPENSSL_STACK *st) 380. { 381. return st == NULL ? -1 : st->num; crypto/stack/stack.c:381:12: Condition is false 379. int OPENSSL_sk_num(const OPENSSL_STACK *st) 380. { 381. return st == NULL ? -1 : st->num; ^ 382. } 383. crypto/stack/stack.c:381:5: 379. int OPENSSL_sk_num(const OPENSSL_STACK *st) 380. { 381. > return st == NULL ? -1 : st->num; 382. } 383. crypto/stack/stack.c:382:1: return from a call to OPENSSL_sk_num 380. { 381. return st == NULL ? -1 : st->num; 382. > } 383. 384. void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i) include/openssl/x509.h:89:1: return from a call to sk_X509_ATTRIBUTE_num 87. typedef struct x509_attributes_st X509_ATTRIBUTE; 88. 89. > DEFINE_STACK_OF(X509_ATTRIBUTE) 90. 91. typedef struct X509_req_info_st X509_REQ_INFO; apps/pkcs12.c:899:17: Loop condition is true. Entering loop body 897. } 898. BIO_printf(out, "%s\n", name); 899. for (i = 0; i < sk_X509_ATTRIBUTE_num(attrlst); i++) { ^ 900. ASN1_OBJECT *attr_obj; 901. attr = sk_X509_ATTRIBUTE_value(attrlst, i); apps/pkcs12.c:901:9: 899. for (i = 0; i < sk_X509_ATTRIBUTE_num(attrlst); i++) { 900. ASN1_OBJECT *attr_obj; 901. > attr = sk_X509_ATTRIBUTE_value(attrlst, i); 902. attr_obj = X509_ATTRIBUTE_get0_object(attr); 903. attr_nid = OBJ_obj2nid(attr_obj); include/openssl/x509.h:89:1: start of procedure sk_X509_ATTRIBUTE_value() 87. typedef struct x509_attributes_st X509_ATTRIBUTE; 88. 89. > DEFINE_STACK_OF(X509_ATTRIBUTE) 90. 91. typedef struct X509_req_info_st X509_REQ_INFO; crypto/stack/stack.c:384:1: start of procedure OPENSSL_sk_value() 382. } 383. 384. > void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i) 385. { 386. if (st == NULL || i < 0 || i >= st->num) crypto/stack/stack.c:386:9: Taking false branch 384. void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i) 385. { 386. if (st == NULL || i < 0 || i >= st->num) ^ 387. return NULL; 388. return (void *)st->data[i]; crypto/stack/stack.c:386:23: Taking false branch 384. void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i) 385. { 386. if (st == NULL || i < 0 || i >= st->num) ^ 387. return NULL; 388. return (void *)st->data[i]; crypto/stack/stack.c:386:32: Taking false branch 384. void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i) 385. { 386. if (st == NULL || i < 0 || i >= st->num) ^ 387. return NULL; 388. return (void *)st->data[i]; crypto/stack/stack.c:388:5: 386. if (st == NULL || i < 0 || i >= st->num) 387. return NULL; 388. > return (void *)st->data[i]; 389. } 390. crypto/stack/stack.c:389:1: return from a call to OPENSSL_sk_value 387. return NULL; 388. return (void *)st->data[i]; 389. > } 390. 391. void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data) include/openssl/x509.h:89:1: return from a call to sk_X509_ATTRIBUTE_value 87. typedef struct x509_attributes_st X509_ATTRIBUTE; 88. 89. > DEFINE_STACK_OF(X509_ATTRIBUTE) 90. 91. typedef struct X509_req_info_st X509_REQ_INFO; apps/pkcs12.c:902:9: 900. ASN1_OBJECT *attr_obj; 901. attr = sk_X509_ATTRIBUTE_value(attrlst, i); 902. > attr_obj = X509_ATTRIBUTE_get0_object(attr); 903. attr_nid = OBJ_obj2nid(attr_obj); 904. BIO_printf(out, " "); crypto/x509/x509_att.c:303:1: start of procedure X509_ATTRIBUTE_get0_object() 301. } 302. 303. > ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr) 304. { 305. if (attr == NULL) crypto/x509/x509_att.c:305:9: Taking false branch 303. ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr) 304. { 305. if (attr == NULL) ^ 306. return NULL; 307. return attr->object; crypto/x509/x509_att.c:307:5: 305. if (attr == NULL) 306. return NULL; 307. > return attr->object; 308. } 309. crypto/x509/x509_att.c:308:1: return from a call to X509_ATTRIBUTE_get0_object 306. return NULL; 307. return attr->object; 308. > } 309. 310. void *X509_ATTRIBUTE_get0_data(X509_ATTRIBUTE *attr, int idx, apps/pkcs12.c:903:9: 901. attr = sk_X509_ATTRIBUTE_value(attrlst, i); 902. attr_obj = X509_ATTRIBUTE_get0_object(attr); 903. > attr_nid = OBJ_obj2nid(attr_obj); 904. BIO_printf(out, " "); 905. if (attr_nid == NID_undef) { crypto/objects/obj_dat.c:317:1: start of procedure OBJ_obj2nid() 315. IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj); 316. 317. > int OBJ_obj2nid(const ASN1_OBJECT *a) 318. { 319. const unsigned int *op; crypto/objects/obj_dat.c:322:9: Taking false branch 320. ADDED_OBJ ad, *adp; 321. 322. if (a == NULL) ^ 323. return NID_undef; 324. if (a->nid != 0) crypto/objects/obj_dat.c:324:9: Taking false branch 322. if (a == NULL) 323. return NID_undef; 324. if (a->nid != 0) ^ 325. return a->nid; 326. crypto/objects/obj_dat.c:327:9: Taking false branch 325. return a->nid; 326. 327. if (a->length == 0) ^ 328. return NID_undef; 329. crypto/objects/obj_dat.c:330:9: Taking true branch 328. return NID_undef; 329. 330. if (added != NULL) { ^ 331. ad.type = ADDED_DATA; 332. ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */ crypto/objects/obj_dat.c:331:9: 329. 330. if (added != NULL) { 331. > ad.type = ADDED_DATA; 332. ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */ 333. adp = lh_ADDED_OBJ_retrieve(added, &ad); crypto/objects/obj_dat.c:332:9: 330. if (added != NULL) { 331. ad.type = ADDED_DATA; 332. > ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */ 333. adp = lh_ADDED_OBJ_retrieve(added, &ad); 334. if (adp != NULL) crypto/objects/obj_dat.c:333:9: 331. ad.type = ADDED_DATA; 332. ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */ 333. > adp = lh_ADDED_OBJ_retrieve(added, &ad); 334. if (adp != NULL) 335. return adp->obj->nid; crypto/objects/obj_lcl.h:14:1: start of procedure lh_ADDED_OBJ_retrieve() 12. DEFINE_LHASH_OF(OBJ_NAME); 13. typedef struct added_obj_st ADDED_OBJ; 14. > DEFINE_LHASH_OF(ADDED_OBJ); crypto/lhash/lhash.c:165:1: start of procedure OPENSSL_LH_retrieve() 163. } 164. 165. > void *OPENSSL_LH_retrieve(OPENSSL_LHASH *lh, const void *data) 166. { 167. unsigned long hash; crypto/lhash/lhash.c:171:5: 169. void *ret; 170. 171. > tsan_store((TSAN_QUALIFIER int *)&lh->error, 0); 172. 173. rn = getrn(lh, data, &hash); crypto/lhash/lhash.c:173:5: Skipping getrn(): empty list of specs 171. tsan_store((TSAN_QUALIFIER int *)&lh->error, 0); 172. 173. rn = getrn(lh, data, &hash); ^ 174. 175. if (*rn == NULL) { crypto/lhash/lhash.c:175:9: Taking false branch 173. rn = getrn(lh, data, &hash); 174. 175. if (*rn == NULL) { ^ 176. tsan_counter(&lh->num_retrieve_miss); 177. return NULL; crypto/lhash/lhash.c:179:9: 177. return NULL; 178. } else { 179. > ret = (*rn)->data; 180. tsan_counter(&lh->num_retrieve); 181. } crypto/lhash/lhash.c:180:9: 178. } else { 179. ret = (*rn)->data; 180. > tsan_counter(&lh->num_retrieve); 181. } 182. crypto/lhash/lhash.c:183:5: 181. } 182. 183. > return ret; 184. } 185. crypto/lhash/lhash.c:184:1: return from a call to OPENSSL_LH_retrieve 182. 183. return ret; 184. > } 185. 186. static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, crypto/objects/obj_lcl.h:14:1: return from a call to lh_ADDED_OBJ_retrieve 12. DEFINE_LHASH_OF(OBJ_NAME); 13. typedef struct added_obj_st ADDED_OBJ; 14. > DEFINE_LHASH_OF(ADDED_OBJ); crypto/objects/obj_dat.c:334:13: Taking true branch 332. ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */ 333. adp = lh_ADDED_OBJ_retrieve(added, &ad); 334. if (adp != NULL) ^ 335. return adp->obj->nid; 336. } crypto/objects/obj_dat.c:335:13: 333. adp = lh_ADDED_OBJ_retrieve(added, &ad); 334. if (adp != NULL) 335. > return adp->obj->nid; 336. } 337. op = OBJ_bsearch_obj(&a, obj_objs, NUM_OBJ); crypto/objects/obj_dat.c:341:1: return from a call to OBJ_obj2nid 339. return NID_undef; 340. return nid_objs[*op].nid; 341. > } 342. 343. /* apps/pkcs12.c:904:9: Skipping BIO_printf(): empty list of specs 902. attr_obj = X509_ATTRIBUTE_get0_object(attr); 903. attr_nid = OBJ_obj2nid(attr_obj); 904. BIO_printf(out, " "); ^ 905. if (attr_nid == NID_undef) { 906. i2a_ASN1_OBJECT(out, attr_obj); apps/pkcs12.c:905:13: Taking false branch 903. attr_nid = OBJ_obj2nid(attr_obj); 904. BIO_printf(out, " "); 905. if (attr_nid == NID_undef) { ^ 906. i2a_ASN1_OBJECT(out, attr_obj); 907. BIO_printf(out, ": "); apps/pkcs12.c:909:13: 907. BIO_printf(out, ": "); 908. } else { 909. > BIO_printf(out, "%s: ", OBJ_nid2ln(attr_nid)); 910. } 911. crypto/objects/obj_dat.c:274:1: start of procedure OBJ_nid2ln() 272. } 273. 274. > const char *OBJ_nid2ln(int n) 275. { 276. ADDED_OBJ ad, *adp; crypto/objects/obj_dat.c:279:10: Taking true branch 277. ASN1_OBJECT ob; 278. 279. if ((n >= 0) && (n < NUM_NID)) { ^ 280. if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) { 281. OBJerr(OBJ_F_OBJ_NID2LN, OBJ_R_UNKNOWN_NID); crypto/objects/obj_dat.c:279:22: Taking true branch 277. ASN1_OBJECT ob; 278. 279. if ((n >= 0) && (n < NUM_NID)) { ^ 280. if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) { 281. OBJerr(OBJ_F_OBJ_NID2LN, OBJ_R_UNKNOWN_NID); crypto/objects/obj_dat.c:280:14: Taking true branch 278. 279. if ((n >= 0) && (n < NUM_NID)) { 280. if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) { ^ 281. OBJerr(OBJ_F_OBJ_NID2LN, OBJ_R_UNKNOWN_NID); 282. return NULL; crypto/objects/obj_dat.c:280:34: Taking false branch 278. 279. if ((n >= 0) && (n < NUM_NID)) { 280. if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) { ^ 281. OBJerr(OBJ_F_OBJ_NID2LN, OBJ_R_UNKNOWN_NID); 282. return NULL; crypto/objects/obj_dat.c:284:9: 282. return NULL; 283. } 284. > return nid_objs[n].ln; 285. } else if (added == NULL) 286. return NULL; crypto/objects/obj_dat.c:299:1: return from a call to OBJ_nid2ln 297. } 298. } 299. > } 300. 301. static int obj_cmp(const ASN1_OBJECT *const *ap, const unsigned int *bp) apps/pkcs12.c:909:13: Skipping BIO_printf(): empty list of specs 907. BIO_printf(out, ": "); 908. } else { 909. BIO_printf(out, "%s: ", OBJ_nid2ln(attr_nid)); ^ 910. } 911. apps/pkcs12.c:912:13: 910. } 911. 912. > if (X509_ATTRIBUTE_count(attr)) { 913. av = X509_ATTRIBUTE_get0_type(attr, 0); 914. switch (av->type) { crypto/x509/x509_att.c:296:1: start of procedure X509_ATTRIBUTE_count() 294. } 295. 296. > int X509_ATTRIBUTE_count(const X509_ATTRIBUTE *attr) 297. { 298. if (attr == NULL) crypto/x509/x509_att.c:298:9: Taking false branch 296. int X509_ATTRIBUTE_count(const X509_ATTRIBUTE *attr) 297. { 298. if (attr == NULL) ^ 299. return 0; 300. return sk_ASN1_TYPE_num(attr->set); crypto/x509/x509_att.c:300:5: 298. if (attr == NULL) 299. return 0; 300. > return sk_ASN1_TYPE_num(attr->set); 301. } 302. include/openssl/asn1.h:454:1: start of procedure sk_ASN1_TYPE_num() 452. } ASN1_TYPE; 453. 454. > DEFINE_STACK_OF(ASN1_TYPE) 455. 456. typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY; crypto/stack/stack.c:379:1: start of procedure OPENSSL_sk_num() 377. } 378. 379. > int OPENSSL_sk_num(const OPENSSL_STACK *st) 380. { 381. return st == NULL ? -1 : st->num; crypto/stack/stack.c:381:12: Condition is true 379. int OPENSSL_sk_num(const OPENSSL_STACK *st) 380. { 381. return st == NULL ? -1 : st->num; ^ 382. } 383. crypto/stack/stack.c:381:5: 379. int OPENSSL_sk_num(const OPENSSL_STACK *st) 380. { 381. > return st == NULL ? -1 : st->num; 382. } 383. crypto/stack/stack.c:382:1: return from a call to OPENSSL_sk_num 380. { 381. return st == NULL ? -1 : st->num; 382. > } 383. 384. void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i) include/openssl/asn1.h:454:1: return from a call to sk_ASN1_TYPE_num 452. } ASN1_TYPE; 453. 454. > DEFINE_STACK_OF(ASN1_TYPE) 455. 456. typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY; crypto/x509/x509_att.c:301:1: return from a call to X509_ATTRIBUTE_count 299. return 0; 300. return sk_ASN1_TYPE_num(attr->set); 301. > } 302. 303. ASN1_OBJECT *X509_ATTRIBUTE_get0_object(X509_ATTRIBUTE *attr) apps/pkcs12.c:912:13: Taking true branch 910. } 911. 912. if (X509_ATTRIBUTE_count(attr)) { ^ 913. av = X509_ATTRIBUTE_get0_type(attr, 0); 914. switch (av->type) { apps/pkcs12.c:913:13: 911. 912. if (X509_ATTRIBUTE_count(attr)) { 913. > av = X509_ATTRIBUTE_get0_type(attr, 0); 914. switch (av->type) { 915. case V_ASN1_BMPSTRING: crypto/x509/x509_att.c:326:1: start of procedure X509_ATTRIBUTE_get0_type() 324. } 325. 326. > ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx) 327. { 328. if (attr == NULL) crypto/x509/x509_att.c:328:9: Taking false branch 326. ASN1_TYPE *X509_ATTRIBUTE_get0_type(X509_ATTRIBUTE *attr, int idx) 327. { 328. if (attr == NULL) ^ 329. return NULL; 330. return sk_ASN1_TYPE_value(attr->set, idx); crypto/x509/x509_att.c:330:5: 328. if (attr == NULL) 329. return NULL; 330. > return sk_ASN1_TYPE_value(attr->set, idx); 331. } include/openssl/asn1.h:454:1: start of procedure sk_ASN1_TYPE_value() 452. } ASN1_TYPE; 453. 454. > DEFINE_STACK_OF(ASN1_TYPE) 455. 456. typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY; crypto/stack/stack.c:384:1: start of procedure OPENSSL_sk_value() 382. } 383. 384. > void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i) 385. { 386. if (st == NULL || i < 0 || i >= st->num) crypto/stack/stack.c:386:9: Taking true branch 384. void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i) 385. { 386. if (st == NULL || i < 0 || i >= st->num) ^ 387. return NULL; 388. return (void *)st->data[i]; crypto/stack/stack.c:387:9: 385. { 386. if (st == NULL || i < 0 || i >= st->num) 387. > return NULL; 388. return (void *)st->data[i]; 389. } crypto/stack/stack.c:389:1: return from a call to OPENSSL_sk_value 387. return NULL; 388. return (void *)st->data[i]; 389. > } 390. 391. void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data) include/openssl/asn1.h:454:1: return from a call to sk_ASN1_TYPE_value 452. } ASN1_TYPE; 453. 454. > DEFINE_STACK_OF(ASN1_TYPE) 455. 456. typedef STACK_OF(ASN1_TYPE) ASN1_SEQUENCE_ANY; crypto/x509/x509_att.c:331:1: return from a call to X509_ATTRIBUTE_get0_type 329. return NULL; 330. return sk_ASN1_TYPE_value(attr->set, idx); 331. > } apps/pkcs12.c:914:13: 912. if (X509_ATTRIBUTE_count(attr)) { 913. av = X509_ATTRIBUTE_get0_type(attr, 0); 914. > switch (av->type) { 915. case V_ASN1_BMPSTRING: 916. value = OPENSSL_uni2asc(av->value.bmpstring->data,
https://github.com/openssl/openssl/blob/c3612970465d0a13f2fc5b47bc28ca18516a699d/apps/pkcs12.c/#L914
d2a_code_trace_data_41928
static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, AVStream *st, AVPacket *pkt, uint32_t *timestamp, const uint8_t *buf, int len, int flags) { uint8_t nal; uint8_t type; int result = 0; if (!len) { av_log(ctx, AV_LOG_ERROR, "Empty H264 RTP packet\n"); return AVERROR_INVALIDDATA; } nal = buf[0]; type = nal & 0x1f; assert(data); assert(buf); if (type >= 1 && type <= 23) type = 1; switch (type) { case 0: case 1: av_new_packet(pkt, len + sizeof(start_sequence)); memcpy(pkt->data, start_sequence, sizeof(start_sequence)); memcpy(pkt->data + sizeof(start_sequence), buf, len); COUNT_NAL_TYPE(data, nal); break; case 24: buf++; len--; { int pass = 0; int total_length = 0; uint8_t *dst = NULL; for (pass = 0; pass < 2; pass++) { const uint8_t *src = buf; int src_len = len; while (src_len > 2) { uint16_t nal_size = AV_RB16(src); src += 2; src_len -= 2; if (nal_size <= src_len) { if (pass == 0) { total_length += sizeof(start_sequence) + nal_size; } else { assert(dst); memcpy(dst, start_sequence, sizeof(start_sequence)); dst += sizeof(start_sequence); memcpy(dst, src, nal_size); COUNT_NAL_TYPE(data, *src); dst += nal_size; } } else { av_log(ctx, AV_LOG_ERROR, "nal size exceeds length: %d %d\n", nal_size, src_len); } src += nal_size; src_len -= nal_size; if (src_len < 0) av_log(ctx, AV_LOG_ERROR, "Consumed more bytes than we got! (%d)\n", src_len); } if (pass == 0) { av_new_packet(pkt, total_length); dst = pkt->data; } else { assert(dst - pkt->data == total_length); } } } break; case 25: case 26: case 27: case 29: av_log(ctx, AV_LOG_ERROR, "Unhandled type (%d) (See RFC for implementation details\n", type); result = AVERROR(ENOSYS); break; case 28: buf++; len--; if (len > 1) { uint8_t fu_indicator = nal; uint8_t fu_header = *buf; uint8_t start_bit = fu_header >> 7; uint8_t av_unused end_bit = (fu_header & 0x40) >> 6; uint8_t nal_type = fu_header & 0x1f; uint8_t reconstructed_nal; reconstructed_nal = fu_indicator & 0xe0; reconstructed_nal |= nal_type; buf++; len--; if (start_bit) COUNT_NAL_TYPE(data, nal_type); if (start_bit) { av_new_packet(pkt, sizeof(start_sequence) + sizeof(nal) + len); memcpy(pkt->data, start_sequence, sizeof(start_sequence)); pkt->data[sizeof(start_sequence)] = reconstructed_nal; memcpy(pkt->data + sizeof(start_sequence) + sizeof(nal), buf, len); } else { av_new_packet(pkt, len); memcpy(pkt->data, buf, len); } } else { av_log(ctx, AV_LOG_ERROR, "Too short data for FU-A H264 RTP packet\n"); result = AVERROR_INVALIDDATA; } break; case 30: case 31: default: av_log(ctx, AV_LOG_ERROR, "Undefined type (%d)\n", type); result = AVERROR_INVALIDDATA; break; } pkt->stream_index = st->index; return result; } libavformat/rtpdec_h264.c:192: error: Null Dereference pointer `pkt->data` last assigned on line 191 could be null and is dereferenced by call to `memcpy()` at line 192, column 9. libavformat/rtpdec_h264.c:166:1: start of procedure h264_handle_packet() 164. 165. // return 0 on packet, no more left, 1 on packet, 1 on partial packet 166. static int h264_handle_packet(AVFormatContext *ctx, PayloadContext *data, ^ 167. AVStream *st, AVPacket *pkt, uint32_t *timestamp, 168. const uint8_t *buf, int len, int flags) libavformat/rtpdec_h264.c:172:5: 170. uint8_t nal; 171. uint8_t type; 172. int result = 0; ^ 173. 174. if (!len) { libavformat/rtpdec_h264.c:174:10: Taking false branch 172. int result = 0; 173. 174. if (!len) { ^ 175. av_log(ctx, AV_LOG_ERROR, "Empty H264 RTP packet\n"); 176. return AVERROR_INVALIDDATA; libavformat/rtpdec_h264.c:178:5: 176. return AVERROR_INVALIDDATA; 177. } 178. nal = buf[0]; ^ 179. type = nal & 0x1f; 180. libavformat/rtpdec_h264.c:179:5: 177. } 178. nal = buf[0]; 179. type = nal & 0x1f; ^ 180. 181. assert(data); libavformat/rtpdec_h264.c:181:5: 179. type = nal & 0x1f; 180. 181. assert(data); ^ 182. assert(buf); 183. libavformat/rtpdec_h264.c:182:5: 180. 181. assert(data); 182. assert(buf); ^ 183. 184. /* Simplify the case (these are all the nal types used internally by libavformat/rtpdec_h264.c:186:9: Taking true branch 184. /* Simplify the case (these are all the nal types used internally by 185. * the h264 codec). */ 186. if (type >= 1 && type <= 23) ^ 187. type = 1; 188. switch (type) { libavformat/rtpdec_h264.c:186:22: Taking true branch 184. /* Simplify the case (these are all the nal types used internally by 185. * the h264 codec). */ 186. if (type >= 1 && type <= 23) ^ 187. type = 1; 188. switch (type) { libavformat/rtpdec_h264.c:187:9: 185. * the h264 codec). */ 186. if (type >= 1 && type <= 23) 187. type = 1; ^ 188. switch (type) { 189. case 0: // undefined, but pass them through libavformat/rtpdec_h264.c:188:5: 186. if (type >= 1 && type <= 23) 187. type = 1; 188. switch (type) { ^ 189. case 0: // undefined, but pass them through 190. case 1: libavformat/rtpdec_h264.c:189:5: Switch condition is false. Skipping switch case 187. type = 1; 188. switch (type) { 189. case 0: // undefined, but pass them through ^ 190. case 1: 191. av_new_packet(pkt, len + sizeof(start_sequence)); libavformat/rtpdec_h264.c:190:5: Switch condition is true. Entering switch case 188. switch (type) { 189. case 0: // undefined, but pass them through 190. case 1: ^ 191. av_new_packet(pkt, len + sizeof(start_sequence)); 192. memcpy(pkt->data, start_sequence, sizeof(start_sequence)); libavformat/rtpdec_h264.c:191:9: 189. case 0: // undefined, but pass them through 190. case 1: 191. av_new_packet(pkt, len + sizeof(start_sequence)); ^ 192. memcpy(pkt->data, start_sequence, sizeof(start_sequence)); 193. memcpy(pkt->data + sizeof(start_sequence), buf, len); libavcodec/avpacket.c:61:1: start of procedure av_new_packet() 59. } 60. 61. int av_new_packet(AVPacket *pkt, int size) ^ 62. { 63. uint8_t *data = NULL; libavcodec/avpacket.c:63:5: 61. int av_new_packet(AVPacket *pkt, int size) 62. { 63. uint8_t *data = NULL; ^ 64. if ((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) 65. data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); libavcodec/avpacket.c:64:9: Taking true branch 62. { 63. uint8_t *data = NULL; 64. if ((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) ^ 65. data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); 66. if (data) { libavcodec/avpacket.c:65:9: 63. uint8_t *data = NULL; 64. if ((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) 65. data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); ^ 66. if (data) { 67. memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:9: Taking true branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if (size > (INT_MAX-32) || !size) ^ 73. return NULL; 74. libavutil/mem.c:73:9: 71. /* let's disallow possible ambiguous cases */ 72. if (size > (INT_MAX-32) || !size) 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, size_t size) libavcodec/avpacket.c:66:9: Taking false branch 64. if ((unsigned)size < (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) 65. data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); 66. if (data) { ^ 67. memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); 68. } else libavcodec/avpacket.c:69:9: 67. memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); 68. } else 69. size = 0; ^ 70. 71. av_init_packet(pkt); libavcodec/avpacket.c:71:5: 69. size = 0; 70. 71. av_init_packet(pkt); ^ 72. pkt->data = data; 73. pkt->size = size; libavcodec/avpacket.c:47:1: start of procedure av_init_packet() 45. } 46. 47. void av_init_packet(AVPacket *pkt) ^ 48. { 49. pkt->pts = AV_NOPTS_VALUE; libavcodec/avpacket.c:49:5: 47. void av_init_packet(AVPacket *pkt) 48. { 49. pkt->pts = AV_NOPTS_VALUE; ^ 50. pkt->dts = AV_NOPTS_VALUE; 51. pkt->pos = -1; libavcodec/avpacket.c:50:5: 48. { 49. pkt->pts = AV_NOPTS_VALUE; 50. pkt->dts = AV_NOPTS_VALUE; ^ 51. pkt->pos = -1; 52. pkt->duration = 0; libavcodec/avpacket.c:51:5: 49. pkt->pts = AV_NOPTS_VALUE; 50. pkt->dts = AV_NOPTS_VALUE; 51. pkt->pos = -1; ^ 52. pkt->duration = 0; 53. pkt->convergence_duration = 0; libavcodec/avpacket.c:52:5: 50. pkt->dts = AV_NOPTS_VALUE; 51. pkt->pos = -1; 52. pkt->duration = 0; ^ 53. pkt->convergence_duration = 0; 54. pkt->flags = 0; libavcodec/avpacket.c:53:5: 51. pkt->pos = -1; 52. pkt->duration = 0; 53. pkt->convergence_duration = 0; ^ 54. pkt->flags = 0; 55. pkt->stream_index = 0; libavcodec/avpacket.c:54:5: 52. pkt->duration = 0; 53. pkt->convergence_duration = 0; 54. pkt->flags = 0; ^ 55. pkt->stream_index = 0; 56. pkt->destruct = NULL; libavcodec/avpacket.c:55:5: 53. pkt->convergence_duration = 0; 54. pkt->flags = 0; 55. pkt->stream_index = 0; ^ 56. pkt->destruct = NULL; 57. pkt->side_data = NULL; libavcodec/avpacket.c:56:5: 54. pkt->flags = 0; 55. pkt->stream_index = 0; 56. pkt->destruct = NULL; ^ 57. pkt->side_data = NULL; 58. pkt->side_data_elems = 0; libavcodec/avpacket.c:57:5: 55. pkt->stream_index = 0; 56. pkt->destruct = NULL; 57. pkt->side_data = NULL; ^ 58. pkt->side_data_elems = 0; 59. } libavcodec/avpacket.c:58:5: 56. pkt->destruct = NULL; 57. pkt->side_data = NULL; 58. pkt->side_data_elems = 0; ^ 59. } 60. libavcodec/avpacket.c:59:1: return from a call to av_init_packet 57. pkt->side_data = NULL; 58. pkt->side_data_elems = 0; 59. } ^ 60. 61. int av_new_packet(AVPacket *pkt, int size) libavcodec/avpacket.c:72:5: 70. 71. av_init_packet(pkt); 72. pkt->data = data; ^ 73. pkt->size = size; 74. pkt->destruct = av_destruct_packet; libavcodec/avpacket.c:73:5: 71. av_init_packet(pkt); 72. pkt->data = data; 73. pkt->size = size; ^ 74. pkt->destruct = av_destruct_packet; 75. if (!data) libavcodec/avpacket.c:74:5: 72. pkt->data = data; 73. pkt->size = size; 74. pkt->destruct = av_destruct_packet; ^ 75. if (!data) 76. return AVERROR(ENOMEM); libavcodec/avpacket.c:75:10: Taking true branch 73. pkt->size = size; 74. pkt->destruct = av_destruct_packet; 75. if (!data) ^ 76. return AVERROR(ENOMEM); 77. return 0; libavcodec/avpacket.c:76:9: 74. pkt->destruct = av_destruct_packet; 75. if (!data) 76. return AVERROR(ENOMEM); ^ 77. return 0; 78. } libavcodec/avpacket.c:78:1: return from a call to av_new_packet 76. return AVERROR(ENOMEM); 77. return 0; 78. } ^ 79. 80. void av_shrink_packet(AVPacket *pkt, int size) libavformat/rtpdec_h264.c:192:9: 190. case 1: 191. av_new_packet(pkt, len + sizeof(start_sequence)); 192. memcpy(pkt->data, start_sequence, sizeof(start_sequence)); ^ 193. memcpy(pkt->data + sizeof(start_sequence), buf, len); 194. COUNT_NAL_TYPE(data, nal);
https://github.com/libav/libav/blob/f89584ca4458c84467e9fb27567e33891d1c7cd5/libavformat/rtpdec_h264.c/#L192
d2a_code_trace_data_41929
static inline uint64_t get_val(BitstreamContext *bc, unsigned n) { #ifdef BITSTREAM_READER_LE uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1); bc->bits >>= n; #else uint64_t ret = bc->bits >> (64 - n); bc->bits <<= n; #endif bc->bits_left -= n; return ret; } libavcodec/alsdec.c:1067: error: Integer Overflow L2 ([-2, +oo] - 1):unsigned32 by call to `read_decode_block`. libavcodec/alsdec.c:1042:1: Parameter `ctx->bc.bits_left` 1040. /** Decode blocks independently. 1041. */ 1042. static int decode_blocks_ind(ALSDecContext *ctx, unsigned int ra_frame, ^ 1043. unsigned int c, const unsigned int *div_blocks, 1044. unsigned int *js_blocks) libavcodec/alsdec.c:1067:20: Call 1065. bd.block_length = div_blocks[b]; 1066. 1067. if ((ret = read_decode_block(ctx, &bd)) < 0) { ^ 1068. // damaged block, write zero for the rest of the frame 1069. zero_remaining(b, ctx->num_blocks, div_blocks, bd.raw_samples); libavcodec/alsdec.c:1013:1: Parameter `ctx->bc.bits_left` 1011. /** Read and decode block data successively. 1012. */ 1013. static int read_decode_block(ALSDecContext *ctx, ALSBlockData *bd) ^ 1014. { 1015. int ret; libavcodec/alsdec.c:1017:16: Call 1015. int ret; 1016. 1017. if ((ret = read_block(ctx, bd)) < 0) ^ 1018. return ret; 1019. libavcodec/alsdec.c:968:1: Parameter `ctx->bc.bits_left` 966. /** Read the block data. 967. */ 968. static int read_block(ALSDecContext *ctx, ALSBlockData *bd) ^ 969. { 970. int ret = 0; libavcodec/alsdec.c:975:9: Call 973. *bd->shift_lsbs = 0; 974. // read block type flag and read the samples accordingly 975. if (bitstream_read_bit(bc)) { ^ 976. ret = read_var_block_data(ctx, bd); 977. } else { libavcodec/bitstream.h:145:1: Parameter `bc->bits_left` 143. 144. /* Return one bit from the buffer. */ 145. static inline unsigned bitstream_read_bit(BitstreamContext *bc) ^ 146. { 147. if (!bc->bits_left) libavcodec/bitstream.h:150:12: Call 148. refill_64(bc); 149. 150. return get_val(bc, 1); ^ 151. } 152. libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Assignment 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret; libavcodec/alsdec.c:976:15: Call 974. // read block type flag and read the samples accordingly 975. if (bitstream_read_bit(bc)) { 976. ret = read_var_block_data(ctx, bd); ^ 977. } else { 978. read_const_block_data(ctx, bd); libavcodec/alsdec.c:596:1: Parameter `ctx->bc.bits_left` 594. /** Read the block data for a non-constant block 595. */ 596. static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd) ^ 597. { 598. ALSSpecificConfig *sconf = &ctx->sconf; libavcodec/alsdec.c:616:23: Call 614. 615. *bd->opt_order = 1; 616. bd->js_blocks = bitstream_read_bit(bc); ^ 617. 618. opt_order = *bd->opt_order; libavcodec/bitstream.h:145:1: Parameter `bc->bits_left` 143. 144. /* Return one bit from the buffer. */ 145. static inline unsigned bitstream_read_bit(BitstreamContext *bc) ^ 146. { 147. if (!bc->bits_left) libavcodec/bitstream.h:150:12: Call 148. refill_64(bc); 149. 150. return get_val(bc, 1); ^ 151. } 152. libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Assignment 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret; libavcodec/alsdec.c:627:35: Call 625. log2_sub_blocks = bitstream_read(bc, 2); 626. else 627. log2_sub_blocks = 2 * bitstream_read_bit(bc); ^ 628. } 629. libavcodec/bitstream.h:145:1: Parameter `bc->bits_left` 143. 144. /* Return one bit from the buffer. */ 145. static inline unsigned bitstream_read_bit(BitstreamContext *bc) ^ 146. { 147. if (!bc->bits_left) libavcodec/bitstream.h:150:12: Call 148. refill_64(bc); 149. 150. return get_val(bc, 1); ^ 151. } 152. libavcodec/bitstream.h:130:1: <LHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `bc->bits_left` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: <RHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Binary operation: ([-2, +oo] - 1):unsigned32 by call to `read_decode_block` 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret;
https://github.com/libav/libav/blob/7ff018c1cb43a5fe5ee2049d325cdd785852067a/libavcodec/bitstream.h/#L139
d2a_code_trace_data_41930
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) { int i, nw, lb, rb; BN_ULONG *t, *f; BN_ULONG l; bn_check_top(r); bn_check_top(a); if (n < 0) { BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT); return 0; } r->neg = a->neg; nw = n / BN_BITS2; if (bn_wexpand(r, a->top + nw + 1) == NULL) return (0); lb = n % BN_BITS2; rb = BN_BITS2 - lb; f = a->d; t = r->d; t[a->top + nw] = 0; if (lb == 0) for (i = a->top - 1; i >= 0; i--) t[nw + i] = f[i]; else for (i = a->top - 1; i >= 0; i--) { l = f[i]; t[nw + i + 1] |= (l >> rb) & BN_MASK2; t[nw + i] = (l << lb) & BN_MASK2; } memset(t, 0, sizeof(*t) * nw); r->top = a->top + nw + 1; bn_correct_top(r); bn_check_top(r); return (1); } apps/dhparam.c:268: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `DH_check`. Showing all 16 steps of the trace apps/dhparam.c:205:32: Call 203. num, g); 204. BIO_printf(bio_err, "This is going to take a long time\n"); 205. if (dh == NULL || !DH_generate_parameters_ex(dh, num, g, cb)) { ^ 206. BN_GENCB_free(cb); 207. ERR_print_errors(bio_err); crypto/dh/dh_gen.c:23:1: Parameter `ret->p->top` 21. BN_GENCB *cb); 22. 23. > int DH_generate_parameters_ex(DH *ret, int prime_len, int generator, 24. BN_GENCB *cb) 25. { apps/dhparam.c:268:14: Call 266. 267. if (check) { 268. if (!DH_check(dh, &i)) { ^ 269. ERR_print_errors(bio_err); 270. goto end; crypto/dh/dh_check.c:25:1: Parameter `dh->p->top` 23. */ 24. 25. > int DH_check(const DH *dh, int *ret) 26. { 27. int ok = 0, r; crypto/dh/dh_check.c:62:14: Call 60. *ret |= DH_CHECK_Q_NOT_PRIME; 61. /* Check p == 1 mod q i.e. q divides p - 1 */ 62. if (!BN_div(t1, t2, dh->p, dh->q, ctx)) ^ 63. goto err; 64. if (!BN_is_one(t2)) crypto/bn/bn_div.c:140:1: Parameter `num->top` 138. * If 'dv' or 'rm' is NULL, the respective value is not returned. 139. */ 140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 141. BN_CTX *ctx) 142. { crypto/bn/bn_div.c:210:11: Call 208. sdiv->neg = 0; 209. norm_shift += BN_BITS2; 210. if (!(BN_lshift(snum, num, norm_shift))) ^ 211. goto err; 212. snum->neg = 0; crypto/bn/bn_shift.c:81:1: <Offset trace> 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:81:1: Parameter `n` 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:96:5: Assignment 94. 95. r->neg = a->neg; 96. nw = n / BN_BITS2; ^ 97. if (bn_wexpand(r, a->top + nw + 1) == NULL) 98. return (0); crypto/bn/bn_shift.c:81:1: <Length trace> 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:81:1: Parameter `*r->d` 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:9: Call 95. r->neg = a->neg; 96. nw = n / BN_BITS2; 97. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 98. return (0); 99. lb = n % BN_BITS2; crypto/bn/bn_lib.c:1016:1: Parameter `*a->d` 1014. } 1015. 1016. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 1017. { 1018. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:102:5: Assignment 100. rb = BN_BITS2 - lb; 101. f = a->d; 102. t = r->d; ^ 103. t[a->top + nw] = 0; 104. if (lb == 0) crypto/bn/bn_shift.c:110:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `DH_check` 108. for (i = a->top - 1; i >= 0; i--) { 109. l = f[i]; 110. t[nw + i + 1] |= (l >> rb) & BN_MASK2; ^ 111. t[nw + i] = (l << lb) & BN_MASK2; 112. }
https://github.com/openssl/openssl/blob/748e85308ef4f3e672975b3604ea2d76424fa404/crypto/bn/bn_shift.c/#L110
d2a_code_trace_data_41931
void ff_h264_draw_horiz_band(H264Context *h, int y, int height) { AVCodecContext *avctx = h->avctx; Picture *cur = &h->cur_pic; Picture *last = h->ref_list[0][0].f.data[0] ? &h->ref_list[0][0] : NULL; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); int vshift = desc->log2_chroma_h; const int field_pic = h->picture_structure != PICT_FRAME; if (field_pic) { height <<= 1; y <<= 1; } height = FFMIN(height, avctx->height - y); if (field_pic && h->first_field && !(avctx->slice_flags & SLICE_FLAG_ALLOW_FIELD)) return; if (avctx->draw_horiz_band) { AVFrame *src; int offset[AV_NUM_DATA_POINTERS]; int i; if (cur->f.pict_type == AV_PICTURE_TYPE_B || h->low_delay || (avctx->slice_flags & SLICE_FLAG_CODED_ORDER)) src = &cur->f; else if (last) src = &last->f; else return; offset[0] = y * src->linesize[0]; offset[1] = offset[2] = (y >> vshift) * src->linesize[1]; for (i = 3; i < AV_NUM_DATA_POINTERS; i++) offset[i] = 0; emms_c(); avctx->draw_horiz_band(avctx, src, offset, y, h->picture_structure, height); } } libavcodec/h264.c:216: error: Null Dereference pointer `desc` last assigned on line 215 could be null and is dereferenced at line 216, column 18. libavcodec/h264.c:210:1: start of procedure ff_h264_draw_horiz_band() 208. } 209. 210. void ff_h264_draw_horiz_band(H264Context *h, int y, int height) ^ 211. { 212. AVCodecContext *avctx = h->avctx; libavcodec/h264.c:212:5: 210. void ff_h264_draw_horiz_band(H264Context *h, int y, int height) 211. { 212. AVCodecContext *avctx = h->avctx; ^ 213. Picture *cur = &h->cur_pic; 214. Picture *last = h->ref_list[0][0].f.data[0] ? &h->ref_list[0][0] : NULL; libavcodec/h264.c:213:5: 211. { 212. AVCodecContext *avctx = h->avctx; 213. Picture *cur = &h->cur_pic; ^ 214. Picture *last = h->ref_list[0][0].f.data[0] ? &h->ref_list[0][0] : NULL; 215. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); libavcodec/h264.c:214:21: Condition is true 212. AVCodecContext *avctx = h->avctx; 213. Picture *cur = &h->cur_pic; 214. Picture *last = h->ref_list[0][0].f.data[0] ? &h->ref_list[0][0] : NULL; ^ 215. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); 216. int vshift = desc->log2_chroma_h; libavcodec/h264.c:214:5: 212. AVCodecContext *avctx = h->avctx; 213. Picture *cur = &h->cur_pic; 214. Picture *last = h->ref_list[0][0].f.data[0] ? &h->ref_list[0][0] : NULL; ^ 215. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); 216. int vshift = desc->log2_chroma_h; libavcodec/h264.c:215:5: 213. Picture *cur = &h->cur_pic; 214. Picture *last = h->ref_list[0][0].f.data[0] ? &h->ref_list[0][0] : NULL; 215. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); ^ 216. int vshift = desc->log2_chroma_h; 217. const int field_pic = h->picture_structure != PICT_FRAME; libavutil/pixdesc.c:1468:1: start of procedure av_pix_fmt_desc_get() 1466. } 1467. 1468. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) ^ 1469. { 1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) libavutil/pixdesc.c:1470:9: Taking false branch 1468. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1469. { 1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1471. return NULL; 1472. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1470:24: Taking true branch 1468. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1469. { 1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1471. return NULL; 1472. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1471:9: 1469. { 1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) 1471. return NULL; ^ 1472. return &av_pix_fmt_descriptors[pix_fmt]; 1473. } libavutil/pixdesc.c:1473:1: return from a call to av_pix_fmt_desc_get 1471. return NULL; 1472. return &av_pix_fmt_descriptors[pix_fmt]; 1473. } ^ 1474. 1475. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) libavcodec/h264.c:216:5: 214. Picture *last = h->ref_list[0][0].f.data[0] ? &h->ref_list[0][0] : NULL; 215. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); 216. int vshift = desc->log2_chroma_h; ^ 217. const int field_pic = h->picture_structure != PICT_FRAME; 218. if (field_pic) {
https://github.com/libav/libav/blob/b89e8759e053792704741d08cbc41c9ac3c7ed63/libavcodec/h264.c/#L216
d2a_code_trace_data_41932
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; return 1; } ssl/t1_lib.c:1043: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 4]):unsigned64 by call to `WPACKET_start_sub_packet_len__`. Showing all 12 steps of the trace ssl/t1_lib.c:1042:14: Call 1040. /* Add RI if renegotiating */ 1041. if (s->renegotiate) { 1042. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_renegotiate) ^ 1043. || !WPACKET_start_sub_packet_u16(pkt) 1044. || !WPACKET_sub_memcpy_u8(pkt, s->s3->previous_client_finished, ssl/packet.c:261:1: Parameter `pkt->buf->length` 259. } 260. 261. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 262. { 263. unsigned char *data; ssl/t1_lib.c:1043:21: Call 1041. if (s->renegotiate) { 1042. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_renegotiate) 1043. || !WPACKET_start_sub_packet_u16(pkt) ^ 1044. || !WPACKET_sub_memcpy_u8(pkt, s->s3->previous_client_finished, 1045. s->s3->previous_client_finished_len) ssl/packet.c:224:1: Parameter `pkt->written` 222. } 223. 224. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 225. { 226. WPACKET_SUB *sub; ssl/packet.c:248:10: Call 246. } 247. 248. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 249. return 0; 250. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */ ssl/packet.c:15:1: Parameter `pkt->written` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ssl/packet.c:17:10: Call 15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ^ 18. return 0; 19. ssl/packet.c:36:1: <LHS trace> 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: Parameter `pkt->buf->length` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: <RHS trace> 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: Parameter `len` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:46:9: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 4]):unsigned64 by call to `WPACKET_start_sub_packet_len__` 44. return 0; 45. 46. if (pkt->buf->length - pkt->written < len) { ^ 47. size_t newlen; 48. size_t reflen;
https://github.com/openssl/openssl/blob/e4e1aa903e624044d3319622fc50222f1b2c7328/ssl/packet.c/#L46
d2a_code_trace_data_41933
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_aria.c:482: 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_aria.c:482:5: Call 480. return 0; 481. } 482. CRYPTO_gcm128_tag(&gctx->gcm, EVP_CIPHER_CTX_buf_noconst(ctx), 16); ^ 483. gctx->taglen = 16; 484. /* Don't reuse the IV */ crypto/modes/gcm128.c:1872:12: <Offset trace> 1870. CRYPTO_gcm128_finish(ctx, NULL, 0); 1871. memcpy(tag, ctx->Xi.c, 1872. len <= sizeof(ctx->Xi.c) ? len : sizeof(ctx->Xi.c)); ^ 1873. } 1874. crypto/modes/gcm128.c:1872:12: Assignment 1870. CRYPTO_gcm128_finish(ctx, NULL, 0); 1871. memcpy(tag, ctx->Xi.c, 1872. len <= sizeof(ctx->Xi.c) ? len : sizeof(ctx->Xi.c)); ^ 1873. } 1874. crypto/modes/gcm128.c:1870:5: <Length trace> 1868. void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len) 1869. { 1870. CRYPTO_gcm128_finish(ctx, NULL, 0); ^ 1871. memcpy(tag, ctx->Xi.c, 1872. len <= sizeof(ctx->Xi.c) ? len : sizeof(ctx->Xi.c)); crypto/modes/gcm128.c:1870:5: Call 1868. void CRYPTO_gcm128_tag(GCM128_CONTEXT *ctx, unsigned char *tag, size_t len) 1869. { 1870. CRYPTO_gcm128_finish(ctx, NULL, 0); ^ 1871. memcpy(tag, ctx->Xi.c, 1872. len <= sizeof(ctx->Xi.c) ? len : sizeof(ctx->Xi.c)); crypto/modes/gcm128.c:1794:1: Parameter `ctx->Xi.c[*]` 1792. } 1793. 1794. > int CRYPTO_gcm128_finish(GCM128_CONTEXT *ctx, const unsigned char *tag, 1795. size_t len) 1796. { crypto/modes/gcm128.c:1871:5: Array access: Offset added: 16 Size: [0, +oo] by call to `CRYPTO_gcm128_tag` 1869. { 1870. CRYPTO_gcm128_finish(ctx, NULL, 0); 1871. memcpy(tag, ctx->Xi.c, ^ 1872. len <= sizeof(ctx->Xi.c) ? len : sizeof(ctx->Xi.c)); 1873. }
https://github.com/openssl/openssl/blob/de3955f66225e42bfae710c50b51c98aa4616ac1/crypto/modes/gcm128.c/#L1871
d2a_code_trace_data_41934
static inline void dv_encode_video_segment(DVVideoContext *s, uint8_t *dif, const uint16_t *mb_pos_ptr) { int mb_index, i, j, v; int mb_x, mb_y, c_offset, linesize; uint8_t* y_ptr; uint8_t* data; uint8_t* ptr; int do_edge_wrap; DECLARE_ALIGNED_16(DCTELEM, block[64]); EncBlockInfo enc_blks[5*6]; PutBitContext pbs[5*6]; PutBitContext* pb; EncBlockInfo* enc_blk; int vs_bit_size = 0; int qnos[5]; assert((((int)block) & 15) == 0); enc_blk = &enc_blks[0]; pb = &pbs[0]; for(mb_index = 0; mb_index < 5; mb_index++) { v = *mb_pos_ptr++; mb_x = v & 0xff; mb_y = v >> 8; if (s->sys->pix_fmt == PIX_FMT_YUV422P) { y_ptr = s->picture.data[0] + (mb_y * s->picture.linesize[0] * 8) + (mb_x * 4); } else { y_ptr = s->picture.data[0] + (mb_y * s->picture.linesize[0] * 8) + (mb_x * 8); } if (s->sys->pix_fmt == PIX_FMT_YUV420P) { c_offset = (((mb_y >> 1) * s->picture.linesize[1] * 8) + ((mb_x >> 1) * 8)); } else { c_offset = ((mb_y * s->picture.linesize[1] * 8) + ((mb_x >> 2) * 8)); } do_edge_wrap = 0; qnos[mb_index] = 15; ptr = dif + mb_index*80 + 4; for(j = 0;j < 6; j++) { int dummy = 0; if (s->sys->pix_fmt == PIX_FMT_YUV422P) { if (j == 0 || j == 2) { data = y_ptr + ((j>>1) * 8); linesize = s->picture.linesize[0]; } else if (j > 3) { data = s->picture.data[6 - j] + c_offset; linesize = s->picture.linesize[6 - j]; } else { data = 0; linesize = 0; dummy = 1; } } else { if (j < 4) { if (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x < (704 / 8)) { data = y_ptr + (j * 8); } else { data = y_ptr + ((j & 1) * 8) + ((j >> 1) * 8 * s->picture.linesize[0]); } linesize = s->picture.linesize[0]; } else { data = s->picture.data[6 - j] + c_offset; linesize = s->picture.linesize[6 - j]; if (s->sys->pix_fmt == PIX_FMT_YUV411P && mb_x >= (704 / 8)) do_edge_wrap = 1; } } if (do_edge_wrap) { uint8_t* d; DCTELEM *b = block; for (i=0;i<8;i++) { d = data + 8 * linesize; b[0] = data[0]; b[1] = data[1]; b[2] = data[2]; b[3] = data[3]; b[4] = d[0]; b[5] = d[1]; b[6] = d[2]; b[7] = d[3]; data += linesize; b += 8; } } else { if (!dummy) s->get_pixels(block, data, linesize); } if(s->avctx->flags & CODEC_FLAG_INTERLACED_DCT) enc_blk->dct_mode = dv_guess_dct_mode(block); else enc_blk->dct_mode = 0; enc_blk->area_q[0] = enc_blk->area_q[1] = enc_blk->area_q[2] = enc_blk->area_q[3] = 0; enc_blk->partial_bit_count = 0; enc_blk->partial_bit_buffer = 0; enc_blk->cur_ac = 0; if (dummy) { memset(block, 0, sizeof(block)); } else { s->fdct[enc_blk->dct_mode](block); } dv_set_class_number(block, enc_blk, enc_blk->dct_mode ? ff_zigzag248_direct : ff_zigzag_direct, enc_blk->dct_mode ? dv_weight_248 : dv_weight_88, j/4); init_put_bits(pb, ptr, block_sizes[j]/8); put_bits(pb, 9, (uint16_t)(((enc_blk->mb[0] >> 3) - 1024 + 2) >> 2)); put_bits(pb, 1, enc_blk->dct_mode); put_bits(pb, 2, enc_blk->cno); vs_bit_size += enc_blk->bit_size[0] + enc_blk->bit_size[1] + enc_blk->bit_size[2] + enc_blk->bit_size[3]; ++enc_blk; ++pb; ptr += block_sizes[j]/8; } } if (vs_total_ac_bits < vs_bit_size) dv_guess_qnos(&enc_blks[0], &qnos[0]); for (i=0; i<5; i++) { dif[i*80 + 3] = qnos[i]; } for (j=0; j<5*6; j++) dv_encode_ac(&enc_blks[j], &pbs[j], &pbs[j+1]); for (j=0; j<5*6; j+=6) { pb= &pbs[j]; for (i=0; i<6; i++) { if (enc_blks[i+j].partial_bit_count) pb=dv_encode_ac(&enc_blks[i+j], pb, &pbs[j+6]); } } pb= &pbs[0]; for (j=0; j<5*6; j++) { if (enc_blks[j].partial_bit_count) pb=dv_encode_ac(&enc_blks[j], pb, &pbs[6*5]); if (enc_blks[j].partial_bit_count) av_log(NULL, AV_LOG_ERROR, "ac bitstream overflow\n"); } for (j=0; j<5*6; j++) flush_put_bits(&pbs[j]); } libavcodec/dv.c:960: error: Uninitialized Value The value read from qnos[_] was never initialized. libavcodec/dv.c:960:8: 958. 959. for (i=0; i<5; i++) { 960. dif[i*80 + 3] = qnos[i]; ^ 961. } 962.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dv.c/#L960
d2a_code_trace_data_41935
static int matroska_parse_seekhead (MatroskaDemuxContext *matroska) { int res = 0; uint32_t id; av_log(matroska->ctx, AV_LOG_DEBUG, "parsing seekhead...\n"); while (res == 0) { if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { res = AVERROR(EIO); break; } else if (matroska->level_up) { matroska->level_up--; break; } switch (id) { case MATROSKA_ID_SEEKENTRY: { uint32_t seek_id = 0, peek_id_cache = 0; uint64_t seek_pos = (uint64_t) -1, t; if ((res = ebml_read_master(matroska, &id)) < 0) break; while (res == 0) { if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { res = AVERROR(EIO); break; } else if (matroska->level_up) { matroska->level_up--; break; } switch (id) { case MATROSKA_ID_SEEKID: res = ebml_read_uint(matroska, &id, &t); seek_id = t; break; case MATROSKA_ID_SEEKPOSITION: res = ebml_read_uint(matroska, &id, &seek_pos); break; default: av_log(matroska->ctx, AV_LOG_INFO, "Unknown seekhead ID 0x%x\n", id); case EBML_ID_VOID: res = ebml_read_skip(matroska); break; } if (matroska->level_up) { matroska->level_up--; break; } } if (!seek_id || seek_pos == (uint64_t) -1) { av_log(matroska->ctx, AV_LOG_INFO, "Incomplete seekhead entry (0x%x/%"PRIu64")\n", seek_id, seek_pos); break; } switch (seek_id) { case MATROSKA_ID_CUES: case MATROSKA_ID_TAGS: { uint32_t level_up = matroska->level_up; offset_t before_pos; uint64_t length; MatroskaLevel level; peek_id_cache = matroska->peek_id; before_pos = url_ftell(matroska->ctx->pb); if ((res = ebml_read_seek(matroska, seek_pos + matroska->segment_start)) < 0) return res; if (matroska->num_levels == EBML_MAX_DEPTH) { av_log(matroska->ctx, AV_LOG_INFO, "Max EBML element depth (%d) reached, " "cannot parse further.\n", EBML_MAX_DEPTH); return AVERROR_UNKNOWN; } level.start = 0; level.length = (uint64_t)-1; matroska->levels[matroska->num_levels] = level; matroska->num_levels++; if (!(id = ebml_peek_id (matroska, &matroska->level_up))) goto finish; if (id != seek_id) { av_log(matroska->ctx, AV_LOG_INFO, "We looked for ID=0x%x but got " "ID=0x%x (pos=%"PRIu64")", seek_id, id, seek_pos + matroska->segment_start); goto finish; } if ((res = ebml_read_master(matroska, &id)) < 0) goto finish; switch (id) { case MATROSKA_ID_CUES: if (!(res = matroska_parse_index(matroska)) || url_feof(matroska->ctx->pb)) { matroska->index_parsed = 1; res = 0; } break; case MATROSKA_ID_TAGS: if (!(res = matroska_parse_metadata(matroska)) || url_feof(matroska->ctx->pb)) { matroska->metadata_parsed = 1; res = 0; } break; } finish: while (matroska->num_levels) { matroska->num_levels--; length = matroska->levels[matroska->num_levels].length; if (length == (uint64_t)-1) break; } if ((res = ebml_read_seek(matroska, before_pos)) < 0) return res; matroska->peek_id = peek_id_cache; matroska->level_up = level_up; break; } default: av_log(matroska->ctx, AV_LOG_INFO, "Ignoring seekhead entry for ID=0x%x\n", seek_id); break; } break; } default: av_log(matroska->ctx, AV_LOG_INFO, "Unknown seekhead ID 0x%x\n", id); case EBML_ID_VOID: res = ebml_read_skip(matroska); break; } if (matroska->level_up) { matroska->level_up--; break; } } return res; } libavformat/matroskadec.c:1786: error: Buffer Overrun L2 Offset: [-oo, max(16, `matroska->num_levels`)] Size: 16. libavformat/matroskadec.c:1691:1: <Offset trace> 1689. } 1690. 1691. static int ^ 1692. matroska_parse_seekhead (MatroskaDemuxContext *matroska) 1693. { libavformat/matroskadec.c:1691:1: Parameter `matroska->num_levels` 1689. } 1690. 1691. static int ^ 1692. matroska_parse_seekhead (MatroskaDemuxContext *matroska) 1693. { libavformat/matroskadec.c:1700:20: Call 1698. 1699. while (res == 0) { 1700. if (!(id = ebml_peek_id(matroska, &matroska->level_up))) { ^ 1701. res = AVERROR(EIO); 1702. break; libavformat/matroskadec.c:306:1: Parameter `matroska->num_levels` 304. */ 305. 306. static uint32_t ^ 307. ebml_peek_id (MatroskaDemuxContext *matroska, 308. int *level_up) libavformat/matroskadec.c:312:9: Call 310. uint32_t id; 311. 312. if (ebml_read_element_id(matroska, &id, level_up) < 0) ^ 313. return 0; 314. libavformat/matroskadec.c:256:1: Parameter `matroska->num_levels` 254. */ 255. 256. static int ^ 257. ebml_read_element_id (MatroskaDemuxContext *matroska, 258. uint32_t *id, libavformat/matroskadec.c:1713:28: Call 1711. uint64_t seek_pos = (uint64_t) -1, t; 1712. 1713. if ((res = ebml_read_master(matroska, &id)) < 0) ^ 1714. break; 1715. libavformat/matroskadec.c:532:1: Parameter `matroska->num_levels` 530. */ 531. 532. static int ^ 533. ebml_read_master (MatroskaDemuxContext *matroska, 534. uint32_t *id) libavformat/matroskadec.c:541:16: Call 539. int res; 540. 541. if ((res = ebml_read_element_id(matroska, id, NULL)) < 0 || ^ 542. (res = ebml_read_element_length(matroska, &length)) < 0) 543. return res; libavformat/matroskadec.c:256:1: Parameter `matroska->num_levels` 254. */ 255. 256. static int ^ 257. ebml_read_element_id (MatroskaDemuxContext *matroska, 258. uint32_t *id, libavformat/matroskadec.c:1691:1: <Length trace> 1689. } 1690. 1691. static int ^ 1692. matroska_parse_seekhead (MatroskaDemuxContext *matroska) 1693. { libavformat/matroskadec.c:1691:1: Parameter `matroska->levels[*]` 1689. } 1690. 1691. static int ^ 1692. matroska_parse_seekhead (MatroskaDemuxContext *matroska) 1693. { libavformat/matroskadec.c:1786:25: Array access: Offset: [-oo, max(16, matroska->num_levels)] Size: 16 1784. level.start = 0; 1785. level.length = (uint64_t)-1; 1786. matroska->levels[matroska->num_levels] = level; ^ 1787. matroska->num_levels++; 1788.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/matroskadec.c/#L1786
d2a_code_trace_data_41936
int ssl3_get_cert_verify(SSL *s) { EVP_PKEY *pkey=NULL; unsigned char *p; int al,ok,ret=0; long n; int type=0,i,j; X509 *peer; const EVP_MD *md = NULL; EVP_MD_CTX mctx; EVP_MD_CTX_init(&mctx); n=s->method->ssl_get_message(s, SSL3_ST_SR_CERT_VRFY_A, SSL3_ST_SR_CERT_VRFY_B, -1, SSL3_RT_MAX_PLAIN_LENGTH, &ok); if (!ok) return((int)n); if (s->session->peer != NULL) { peer=s->session->peer; pkey=X509_get_pubkey(peer); type=X509_certificate_type(peer,pkey); } else { peer=NULL; pkey=NULL; } if (s->s3->tmp.message_type != SSL3_MT_CERTIFICATE_VERIFY) { s->s3->tmp.reuse_message=1; if ((peer != NULL) && (type & EVP_PKT_SIGN)) { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_MISSING_VERIFY_MESSAGE); goto f_err; } ret=1; goto end; } if (peer == NULL) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_NO_CLIENT_CERT_RECEIVED); al=SSL_AD_UNEXPECTED_MESSAGE; goto f_err; } if (!(type & EVP_PKT_SIGN)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE); al=SSL_AD_ILLEGAL_PARAMETER; goto f_err; } if (s->s3->change_cipher_spec) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_CCS_RECEIVED_EARLY); al=SSL_AD_UNEXPECTED_MESSAGE; goto f_err; } p=(unsigned char *)s->init_msg; if (n==64 && (pkey->type==NID_id_GostR3410_94 || pkey->type == NID_id_GostR3410_2001) ) { i=64; } else { if (SSL_USE_SIGALGS(s)) { int rv = tls12_check_peer_sigalg(&md, s, p, pkey); if (rv == -1) { al = SSL_AD_INTERNAL_ERROR; goto f_err; } else if (rv == 0) { al = SSL_AD_DECODE_ERROR; goto f_err; } #ifdef SSL_DEBUG fprintf(stderr, "USING TLSv1.2 HASH %s\n", EVP_MD_name(md)); #endif p += 2; n -= 2; } n2s(p,i); n-=2; if (i > n) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_LENGTH_MISMATCH); al=SSL_AD_DECODE_ERROR; goto f_err; } } j=EVP_PKEY_size(pkey); if ((i > j) || (n > j) || (n <= 0)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_WRONG_SIGNATURE_SIZE); al=SSL_AD_DECODE_ERROR; goto f_err; } if (SSL_USE_SIGALGS(s)) { long hdatalen = 0; void *hdata; hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata); if (hdatalen <= 0) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR); al=SSL_AD_INTERNAL_ERROR; goto f_err; } #ifdef SSL_DEBUG fprintf(stderr, "Using TLS 1.2 with client verify alg %s\n", EVP_MD_name(md)); #endif if (!EVP_VerifyInit_ex(&mctx, md, NULL) || !EVP_VerifyUpdate(&mctx, hdata, hdatalen)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_EVP_LIB); al=SSL_AD_INTERNAL_ERROR; goto f_err; } if (EVP_VerifyFinal(&mctx, p , i, pkey) <= 0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_SIGNATURE); goto f_err; } } else #ifndef OPENSSL_NO_RSA if (pkey->type == EVP_PKEY_RSA) { i=RSA_verify(NID_md5_sha1, s->s3->tmp.cert_verify_md, MD5_DIGEST_LENGTH+SHA_DIGEST_LENGTH, p, i, pkey->pkey.rsa); if (i < 0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_RSA_DECRYPT); goto f_err; } if (i == 0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_RSA_SIGNATURE); goto f_err; } } else #endif #ifndef OPENSSL_NO_DSA if (pkey->type == EVP_PKEY_DSA) { j=DSA_verify(pkey->save_type, &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]), SHA_DIGEST_LENGTH,p,i,pkey->pkey.dsa); if (j <= 0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_DSA_SIGNATURE); goto f_err; } } else #endif #ifndef OPENSSL_NO_ECDSA if (pkey->type == EVP_PKEY_EC) { j=ECDSA_verify(pkey->save_type, &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]), SHA_DIGEST_LENGTH,p,i,pkey->pkey.ec); if (j <= 0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE); goto f_err; } } else #endif if (pkey->type == NID_id_GostR3410_94 || pkey->type == NID_id_GostR3410_2001) { unsigned char signature[64]; int idx; EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new(pkey,NULL); EVP_PKEY_verify_init(pctx); if (i!=64) { fprintf(stderr,"GOST signature length is %d",i); } for (idx=0;idx<64;idx++) { signature[63-idx]=p[idx]; } j=EVP_PKEY_verify(pctx,signature,64,s->s3->tmp.cert_verify_md,32); EVP_PKEY_CTX_free(pctx); if (j<=0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE); goto f_err; } } else { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,ERR_R_INTERNAL_ERROR); al=SSL_AD_UNSUPPORTED_CERTIFICATE; goto f_err; } ret=1; if (0) { f_err: ssl3_send_alert(s,SSL3_AL_FATAL,al); } end: if (s->s3->handshake_buffer) { BIO_free(s->s3->handshake_buffer); s->s3->handshake_buffer = NULL; s->s3->flags &= ~TLS1_FLAGS_KEEP_HANDSHAKE; } EVP_MD_CTX_cleanup(&mctx); EVP_PKEY_free(pkey); return(ret); } ssl/s3_srvr.c:3126: error: NULL_DEREFERENCE pointer `pkey` last assigned on line 3078 could be null and is dereferenced at line 3126, column 16. Showing all 27 steps of the trace ssl/s3_srvr.c:3054:1: start of procedure ssl3_get_cert_verify() 3052. } 3053. 3054. > int ssl3_get_cert_verify(SSL *s) 3055. { 3056. EVP_PKEY *pkey=NULL; ssl/s3_srvr.c:3056:2: 3054. int ssl3_get_cert_verify(SSL *s) 3055. { 3056. > EVP_PKEY *pkey=NULL; 3057. unsigned char *p; 3058. int al,ok,ret=0; ssl/s3_srvr.c:3058:2: 3056. EVP_PKEY *pkey=NULL; 3057. unsigned char *p; 3058. > int al,ok,ret=0; 3059. long n; 3060. int type=0,i,j; ssl/s3_srvr.c:3060:2: 3058. int al,ok,ret=0; 3059. long n; 3060. > int type=0,i,j; 3061. X509 *peer; 3062. const EVP_MD *md = NULL; ssl/s3_srvr.c:3062:2: 3060. int type=0,i,j; 3061. X509 *peer; 3062. > const EVP_MD *md = NULL; 3063. EVP_MD_CTX mctx; 3064. EVP_MD_CTX_init(&mctx); ssl/s3_srvr.c:3064:2: 3062. const EVP_MD *md = NULL; 3063. EVP_MD_CTX mctx; 3064. > EVP_MD_CTX_init(&mctx); 3065. 3066. n=s->method->ssl_get_message(s, crypto/evp/digest.c:120:1: start of procedure EVP_MD_CTX_init() 118. #endif 119. 120. > void EVP_MD_CTX_init(EVP_MD_CTX *ctx) 121. { 122. memset(ctx,'\0',sizeof *ctx); crypto/evp/digest.c:122:2: 120. void EVP_MD_CTX_init(EVP_MD_CTX *ctx) 121. { 122. > memset(ctx,'\0',sizeof *ctx); 123. } 124. crypto/evp/digest.c:123:2: return from a call to EVP_MD_CTX_init 121. { 122. memset(ctx,'\0',sizeof *ctx); 123. } ^ 124. 125. EVP_MD_CTX *EVP_MD_CTX_create(void) ssl/s3_srvr.c:3066:2: Skipping __function_pointer__(): unresolved function pointer 3064. EVP_MD_CTX_init(&mctx); 3065. 3066. n=s->method->ssl_get_message(s, ^ 3067. SSL3_ST_SR_CERT_VRFY_A, 3068. SSL3_ST_SR_CERT_VRFY_B, ssl/s3_srvr.c:3073:7: Taking false branch 3071. &ok); 3072. 3073. if (!ok) return((int)n); ^ 3074. 3075. if (s->session->peer != NULL) ssl/s3_srvr.c:3075:6: Taking true branch 3073. if (!ok) return((int)n); 3074. 3075. if (s->session->peer != NULL) ^ 3076. { 3077. peer=s->session->peer; ssl/s3_srvr.c:3077:3: 3075. if (s->session->peer != NULL) 3076. { 3077. > peer=s->session->peer; 3078. pkey=X509_get_pubkey(peer); 3079. type=X509_certificate_type(peer,pkey); ssl/s3_srvr.c:3078:3: 3076. { 3077. peer=s->session->peer; 3078. > pkey=X509_get_pubkey(peer); 3079. type=X509_certificate_type(peer,pkey); 3080. } crypto/x509/x509_cmp.c:313:1: start of procedure X509_get_pubkey() 311. } 312. 313. > EVP_PKEY *X509_get_pubkey(X509 *x) 314. { 315. if ((x == NULL) || (x->cert_info == NULL)) crypto/x509/x509_cmp.c:315:7: Taking false branch 313. EVP_PKEY *X509_get_pubkey(X509 *x) 314. { 315. if ((x == NULL) || (x->cert_info == NULL)) ^ 316. return(NULL); 317. return(X509_PUBKEY_get(x->cert_info->key)); crypto/x509/x509_cmp.c:315:22: Taking true branch 313. EVP_PKEY *X509_get_pubkey(X509 *x) 314. { 315. if ((x == NULL) || (x->cert_info == NULL)) ^ 316. return(NULL); 317. return(X509_PUBKEY_get(x->cert_info->key)); crypto/x509/x509_cmp.c:316:3: 314. { 315. if ((x == NULL) || (x->cert_info == NULL)) 316. > return(NULL); 317. return(X509_PUBKEY_get(x->cert_info->key)); 318. } crypto/x509/x509_cmp.c:318:2: return from a call to X509_get_pubkey 316. return(NULL); 317. return(X509_PUBKEY_get(x->cert_info->key)); 318. } ^ 319. 320. ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x) ssl/s3_srvr.c:3079:3: Skipping X509_certificate_type(): empty list of specs 3077. peer=s->session->peer; 3078. pkey=X509_get_pubkey(peer); 3079. type=X509_certificate_type(peer,pkey); ^ 3080. } 3081. else ssl/s3_srvr.c:3087:6: Taking false branch 3085. } 3086. 3087. if (s->s3->tmp.message_type != SSL3_MT_CERTIFICATE_VERIFY) ^ 3088. { 3089. s->s3->tmp.reuse_message=1; ssl/s3_srvr.c:3100:6: Taking false branch 3098. } 3099. 3100. if (peer == NULL) ^ 3101. { 3102. SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_NO_CLIENT_CERT_RECEIVED); ssl/s3_srvr.c:3107:8: Taking false branch 3105. } 3106. 3107. if (!(type & EVP_PKT_SIGN)) ^ 3108. { 3109. SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE); ssl/s3_srvr.c:3114:6: Taking false branch 3112. } 3113. 3114. if (s->s3->change_cipher_spec) ^ 3115. { 3116. SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_CCS_RECEIVED_EARLY); ssl/s3_srvr.c:3122:2: 3120. 3121. /* we now have a signature that we need to verify */ 3122. > p=(unsigned char *)s->init_msg; 3123. /* Check for broken implementations of GOST ciphersuites */ 3124. /* If key is GOST and n is exactly 64, it is bare ssl/s3_srvr.c:3126:6: Taking true branch 3124. /* If key is GOST and n is exactly 64, it is bare 3125. * signature without length field */ 3126. if (n==64 && (pkey->type==NID_id_GostR3410_94 || ^ 3127. pkey->type == NID_id_GostR3410_2001) ) 3128. { ssl/s3_srvr.c:3126:16: 3124. /* If key is GOST and n is exactly 64, it is bare 3125. * signature without length field */ 3126. > if (n==64 && (pkey->type==NID_id_GostR3410_94 || 3127. pkey->type == NID_id_GostR3410_2001) ) 3128. {
https://github.com/openssl/openssl/blob/31832e8ff1a3e731ea9fab41aef071a12709cf33/ssl/s3_srvr.c/#L3126
d2a_code_trace_data_41937
static int write_packet(AVFormatContext *s, AVPacket *pkt) { VideoMuxData *img = s->priv_data; AVIOContext *pb[3]; char filename[1024]; AVCodecContext *codec = s->streams[pkt->stream_index]->codec; int i; if (!img->is_pipe) { if (img->update) { av_strlcpy(filename, img->path, sizeof(filename)); } else if (av_get_frame_filename(filename, sizeof(filename), img->path, img->img_number) < 0 && img->img_number > 1) { av_log(s, AV_LOG_ERROR, "Could not get frame filename number %d from pattern '%s'\n", img->img_number, img->path); return AVERROR(EIO); } for (i = 0; i < 3; i++) { if (s->io_open(s, &pb[i], img->tmp, AVIO_FLAG_WRITE, NULL) < 0) { av_log(s, AV_LOG_ERROR, "Could not open file : %s\n", img->tmp); return AVERROR(EIO); } if (codec->codec_id != AV_CODEC_ID_RAWVIDEO) break; filename[strlen(filename) - 1] = 'U' + i; } } else { pb[0] = s->pb; } if (codec->codec_id == AV_CODEC_ID_RAWVIDEO) { int ysize = codec->width * codec->height; avio_write(pb[0], pkt->data, ysize); avio_write(pb[1], pkt->data + ysize, (pkt->size - ysize) / 2); avio_write(pb[2], pkt->data + ysize + (pkt->size - ysize) / 2, (pkt->size - ysize) / 2); ff_format_io_close(s, &pb[1]); ff_format_io_close(s, &pb[2]); } else { if (ff_guess_image2_codec(s->filename) == AV_CODEC_ID_JPEG2000) { AVStream *st = s->streams[0]; if (st->codec->extradata_size > 8 && AV_RL32(st->codec->extradata + 4) == MKTAG('j', 'p', '2', 'h')) { if (pkt->size < 8 || AV_RL32(pkt->data + 4) != MKTAG('j', 'p', '2', 'c')) goto error; avio_wb32(pb[0], 12); ffio_wfourcc(pb[0], "jP "); avio_wb32(pb[0], 0x0D0A870A); avio_wb32(pb[0], 20); ffio_wfourcc(pb[0], "ftyp"); ffio_wfourcc(pb[0], "jp2 "); avio_wb32(pb[0], 0); ffio_wfourcc(pb[0], "jp2 "); avio_write(pb[0], st->codec->extradata, st->codec->extradata_size); } else if (pkt->size < 8 || (!st->codec->extradata_size && AV_RL32(pkt->data + 4) != MKTAG('j', 'P', ' ', ' '))) { error: av_log(s, AV_LOG_ERROR, "malformed JPEG 2000 codestream\n"); return -1; } } avio_write(pb[0], pkt->data, pkt->size); } avio_flush(pb[0]); if (!img->is_pipe) { ff_format_io_close(s, &pb[0]); ff_rename(img->tmp, filename); } img->img_number++; return 0; } libavformat/img2enc.c:82: error: Integer Overflow L2 ([0, +oo] - 1):unsigned64. libavformat/img2enc.c:56:1: <LHS trace> 54. } 55. 56. static int write_packet(AVFormatContext *s, AVPacket *pkt) ^ 57. { 58. VideoMuxData *img = s->priv_data; libavformat/img2enc.c:56:1: Array declaration 54. } 55. 56. static int write_packet(AVFormatContext *s, AVPacket *pkt) ^ 57. { 58. VideoMuxData *img = s->priv_data; libavformat/img2enc.c:82:13: Binary operation: ([0, +oo] - 1):unsigned64 80. if (codec->codec_id != AV_CODEC_ID_RAWVIDEO) 81. break; 82. filename[strlen(filename) - 1] = 'U' + i; ^ 83. } 84. } else {
https://github.com/libav/libav/blob/611ba89b896a5286b6d8ad9bfdbb8b4f5c11df9c/libavformat/img2enc.c/#L82
d2a_code_trace_data_41938
int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) { char *v; int gmt = 0; int i; int y = 0, M = 0, d = 0, h = 0, m = 0, s = 0; char *f = NULL; int f_len = 0; i = tm->length; v = (char *)tm->data; if (i < 12) goto err; if (v[i - 1] == 'Z') gmt = 1; for (i = 0; i < 12; i++) if ((v[i] > '9') || (v[i] < '0')) goto err; y = (v[0] - '0') * 1000 + (v[1] - '0') * 100 + (v[2] - '0') * 10 + (v[3] - '0'); M = (v[4] - '0') * 10 + (v[5] - '0'); if ((M > 12) || (M < 1)) goto err; d = (v[6] - '0') * 10 + (v[7] - '0'); h = (v[8] - '0') * 10 + (v[9] - '0'); m = (v[10] - '0') * 10 + (v[11] - '0'); if (tm->length >= 14 && (v[12] >= '0') && (v[12] <= '9') && (v[13] >= '0') && (v[13] <= '9')) { s = (v[12] - '0') * 10 + (v[13] - '0'); if (tm->length >= 15 && v[14] == '.') { int l = tm->length; f = &v[14]; f_len = 1; while (14 + f_len < l && f[f_len] >= '0' && f[f_len] <= '9') ++f_len; } } if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s", _asn1_mon[M - 1], d, h, m, s, f_len, f, y, (gmt) ? " GMT" : "") <= 0) return (0); else return (1); err: BIO_write(bp, "Bad time value", 14); return (0); } crypto/x509/t_crl.c:126: error: BUFFER_OVERRUN_L3 Offset: [-529, +oo] Size: 12 by call to `ASN1_TIME_print`. Showing all 11 steps of the trace crypto/x509/t_crl.c:99:9: Call 97. X509_CRL_get0_signature(&sig, &sig_alg, x); 98. X509_signature_print(out, sig_alg, NULL); 99. p = X509_NAME_oneline(X509_CRL_get_issuer(x), NULL, 0); ^ 100. BIO_printf(out, "%8sIssuer: %s\n", "", p); 101. OPENSSL_free(p); crypto/x509/x509_obj.c:87:9: Assignment 85. if (!BUF_MEM_grow(b, 200)) 86. goto err; 87. b->data[0] = '\0'; ^ 88. len = 200; 89. } else if (len == 0) { crypto/x509/t_crl.c:126:9: Call 124. i2a_ASN1_INTEGER(out, X509_REVOKED_get0_serialNumber(r)); 125. BIO_printf(out, "\n Revocation Date: "); 126. ASN1_TIME_print(out, X509_REVOKED_get0_revocationDate(r)); ^ 127. BIO_printf(out, "\n"); 128. X509V3_extensions_print(out, "CRL entry extensions", crypto/asn1/a_time.c:201:1: Parameter `*tm->data` 199. } 200. 201. > int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm) 202. { 203. if (tm->type == V_ASN1_UTCTIME) crypto/asn1/a_time.c:206:16: Call 204. return ASN1_UTCTIME_print(bp, tm); 205. if (tm->type == V_ASN1_GENERALIZEDTIME) 206. return ASN1_GENERALIZEDTIME_print(bp, tm); ^ 207. BIO_write(bp, "Bad time value", 14); 208. return (0); crypto/asn1/a_gentm.c:265:1: <Offset trace> 263. }; 264. 265. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 266. { 267. char *v; crypto/asn1/a_gentm.c:265:1: Parameter `*tm->data` 263. }; 264. 265. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 266. { 267. char *v; crypto/asn1/a_gentm.c:286:5: Assignment 284. y = (v[0] - '0') * 1000 + (v[1] - '0') * 100 285. + (v[2] - '0') * 10 + (v[3] - '0'); 286. M = (v[4] - '0') * 10 + (v[5] - '0'); ^ 287. if ((M > 12) || (M < 1)) 288. goto err; crypto/asn1/a_gentm.c:260:1: <Length trace> 258. } 259. 260. > const char *_asn1_mon[12] = { 261. "Jan", "Feb", "Mar", "Apr", "May", "Jun", 262. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" crypto/asn1/a_gentm.c:260:1: Array declaration 258. } 259. 260. > const char *_asn1_mon[12] = { 261. "Jan", "Feb", "Mar", "Apr", "May", "Jun", 262. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" crypto/asn1/a_gentm.c:307:20: Array access: Offset: [-529, +oo] Size: 12 by call to `ASN1_TIME_print` 305. 306. if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s", 307. _asn1_mon[M - 1], d, h, m, s, f_len, f, y, ^ 308. (gmt) ? " GMT" : "") <= 0) 309. return (0);
https://github.com/openssl/openssl/blob/b33d1141b6dcce947708b984c5e9e91dad3d675d/crypto/asn1/a_gentm.c/#L307
d2a_code_trace_data_41939
static ossl_inline unsigned int constant_time_is_zero(unsigned int a) { return constant_time_msb(~a & (a - 1)); } crypto/rsa/rsa_ssl.c:105: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `constant_time_is_zero`. Showing all 6 steps of the trace crypto/rsa/rsa_ssl.c:61:1: Parameter `*from` 59. * preserves error code reporting for backward compatibility. 60. */ 61. > int RSA_padding_check_SSLv23(unsigned char *to, int tlen, 62. const unsigned char *from, int flen, int num) 63. { crypto/rsa/rsa_ssl.c:93:9: Assignment 91. flen -= 1 & mask; 92. from -= 1 & mask; 93. *--em = *from & mask; ^ 94. } 95. crypto/rsa/rsa_ssl.c:105:32: Call 103. threes_in_row = 0; 104. for (i = 2; i < num; i++) { 105. unsigned int equals0 = constant_time_is_zero(em[i]); ^ 106. 107. zero_index = constant_time_select_int(~found_zero_byte & equals0, include/internal/constant_time_locl.h:164:1: <LHS trace> 162. } 163. 164. > static ossl_inline unsigned int constant_time_is_zero(unsigned int a) 165. { 166. return constant_time_msb(~a & (a - 1)); include/internal/constant_time_locl.h:164:1: Parameter `a` 162. } 163. 164. > static ossl_inline unsigned int constant_time_is_zero(unsigned int a) 165. { 166. return constant_time_msb(~a & (a - 1)); include/internal/constant_time_locl.h:166:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `constant_time_is_zero` 164. static ossl_inline unsigned int constant_time_is_zero(unsigned int a) 165. { 166. return constant_time_msb(~a & (a - 1)); ^ 167. } 168.
https://github.com/openssl/openssl/blob/4c2883a9bf59c5ee31e8e2e101b3894a16c06950/include/internal/constant_time_locl.h/#L166
d2a_code_trace_data_41940
static int add_session(SSL *ssl, SSL_SESSION *session) { simple_ssl_session *sess; unsigned char *p; sess = OPENSSL_malloc(sizeof(simple_ssl_session)); sess->idlen = session->session_id_length; sess->derlen = i2d_SSL_SESSION(session, NULL); sess->id = BUF_memdup(session->session_id, sess->idlen); sess->der = OPENSSL_malloc(sess->derlen); p = sess->der; i2d_SSL_SESSION(session, &p); sess->next = first; first = sess; BIO_printf(bio_err, "New session added to external cache\n"); return 0; } apps/s_server.c:2732: error: NULL_DEREFERENCE pointer `sess` last assigned on line 2730 could be null and is dereferenced at line 2732, column 2. Showing all 16 steps of the trace apps/s_server.c:2725:1: start of procedure add_session() 2723. static simple_ssl_session *first = NULL; 2724. 2725. > static int add_session(SSL *ssl, SSL_SESSION *session) 2726. { 2727. simple_ssl_session *sess; apps/s_server.c:2730:2: 2728. unsigned char *p; 2729. 2730. > sess = OPENSSL_malloc(sizeof(simple_ssl_session)); 2731. 2732. sess->idlen = session->session_id_length; crypto/mem.c:294:1: start of procedure CRYPTO_malloc() 292. } 293. 294. > void *CRYPTO_malloc(int num, const char *file, int line) 295. { 296. void *ret = NULL; crypto/mem.c:296:2: 294. void *CRYPTO_malloc(int num, const char *file, int line) 295. { 296. > void *ret = NULL; 297. 298. if (num <= 0) return NULL; crypto/mem.c:298:6: Taking false branch 296. void *ret = NULL; 297. 298. if (num <= 0) return NULL; ^ 299. 300. allow_customize = 0; crypto/mem.c:300:2: 298. if (num <= 0) return NULL; 299. 300. > allow_customize = 0; 301. if (malloc_debug_func != NULL) 302. { crypto/mem.c:301:6: Taking true branch 299. 300. allow_customize = 0; 301. if (malloc_debug_func != NULL) ^ 302. { 303. allow_customize_debug = 0; crypto/mem.c:303:3: 301. if (malloc_debug_func != NULL) 302. { 303. > allow_customize_debug = 0; 304. malloc_debug_func(NULL, num, file, line, 0); 305. } crypto/mem.c:304:3: Skipping __function_pointer__(): unresolved function pointer 302. { 303. allow_customize_debug = 0; 304. malloc_debug_func(NULL, num, file, line, 0); ^ 305. } 306. ret = malloc_ex_func(num,file,line); crypto/mem.c:306:2: Skipping __function_pointer__(): unresolved function pointer 304. malloc_debug_func(NULL, num, file, line, 0); 305. } 306. ret = malloc_ex_func(num,file,line); ^ 307. #ifdef LEVITTE_DEBUG_MEM 308. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num); crypto/mem.c:310:6: Taking true branch 308. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num); 309. #endif 310. if (malloc_debug_func != NULL) ^ 311. malloc_debug_func(ret, num, file, line, 1); 312. crypto/mem.c:311:3: Skipping __function_pointer__(): unresolved function pointer 309. #endif 310. if (malloc_debug_func != NULL) 311. malloc_debug_func(ret, num, file, line, 1); ^ 312. 313. #ifndef OPENSSL_CPUID_OBJ crypto/mem.c:317:12: Taking false branch 315. * sanitisation function can't be optimised out. NB: We only do 316. * this for >2Kb so the overhead doesn't bother us. */ 317. if(ret && (num > 2048)) ^ 318. { extern unsigned char cleanse_ctr; 319. ((unsigned char *)ret)[0] = cleanse_ctr; crypto/mem.c:323:2: 321. #endif 322. 323. > return ret; 324. } 325. char *CRYPTO_strdup(const char *str, const char *file, int line) crypto/mem.c:324:2: return from a call to CRYPTO_malloc 322. 323. return ret; 324. } ^ 325. char *CRYPTO_strdup(const char *str, const char *file, int line) 326. { apps/s_server.c:2732:2: 2730. sess = OPENSSL_malloc(sizeof(simple_ssl_session)); 2731. 2732. > sess->idlen = session->session_id_length; 2733. sess->derlen = i2d_SSL_SESSION(session, NULL); 2734.
https://github.com/openssl/openssl/blob/3fc2efd241bdded36dbc099d5d8016ed39311753/apps/s_server.c/#L2732
d2a_code_trace_data_41941
static int get_ocsp_resp_from_responder(SSL *s, tlsextstatusctx *srctx, OCSP_RESPONSE **resp) { char *host = NULL, *port = NULL, *path = NULL; int use_ssl; STACK_OF(OPENSSL_STRING) *aia = NULL; X509 *x = NULL; X509_STORE_CTX *inctx = NULL; X509_OBJECT *obj; OCSP_REQUEST *req = NULL; OCSP_CERTID *id = NULL; STACK_OF(X509_EXTENSION) *exts; int ret = SSL_TLSEXT_ERR_NOACK; int i; x = SSL_get_certificate(s); aia = X509_get1_ocsp(x); if (aia != NULL) { if (!OCSP_parse_url(sk_OPENSSL_STRING_value(aia, 0), &host, &port, &path, &use_ssl)) { BIO_puts(bio_err, "cert_status: can't parse AIA URL\n"); goto err; } if (srctx->verbose) BIO_printf(bio_err, "cert_status: AIA URL: %s\n", sk_OPENSSL_STRING_value(aia, 0)); } else { if (srctx->host == NULL) { BIO_puts(bio_err, "cert_status: no AIA and no default responder URL\n"); goto done; } host = srctx->host; path = srctx->path; port = srctx->port; use_ssl = srctx->use_ssl; } inctx = X509_STORE_CTX_new(); if (inctx == NULL) goto err; if (!X509_STORE_CTX_init(inctx, SSL_CTX_get_cert_store(SSL_get_SSL_CTX(s)), NULL, NULL)) goto err; obj = X509_STORE_CTX_get_obj_by_subject(inctx, X509_LU_X509, X509_get_issuer_name(x)); if (obj == NULL) { BIO_puts(bio_err, "cert_status: Can't retrieve issuer certificate.\n"); goto done; } id = OCSP_cert_to_id(NULL, x, X509_OBJECT_get0_X509(obj)); X509_OBJECT_free(obj); if (id == NULL) goto err; req = OCSP_REQUEST_new(); if (req == NULL) goto err; if (!OCSP_request_add0_id(req, id)) goto err; id = NULL; SSL_get_tlsext_status_exts(s, &exts); for (i = 0; i < sk_X509_EXTENSION_num(exts); i++) { X509_EXTENSION *ext = sk_X509_EXTENSION_value(exts, i); if (!OCSP_REQUEST_add_ext(req, ext, -1)) goto err; } *resp = process_responder(req, host, path, port, use_ssl, NULL, srctx->timeout); if (*resp == NULL) { BIO_puts(bio_err, "cert_status: error querying responder\n"); goto done; } ret = SSL_TLSEXT_ERR_OK; goto done; err: ret = SSL_TLSEXT_ERR_ALERT_FATAL; done: if (aia != NULL) { OPENSSL_free(host); OPENSSL_free(path); OPENSSL_free(port); X509_email_free(aia); } OCSP_CERTID_free(id); OCSP_REQUEST_free(req); X509_STORE_CTX_free(inctx); return ret; } apps/s_server.c:528: error: NULL_DEREFERENCE pointer `x` last assigned on line 527 could be null and is dereferenced by call to `X509_get1_ocsp()` at line 528, column 11. Showing all 14 steps of the trace apps/s_server.c:511:1: start of procedure get_ocsp_resp_from_responder() 509. * them until they were considered "expired". 510. */ 511. > static int get_ocsp_resp_from_responder(SSL *s, tlsextstatusctx *srctx, 512. OCSP_RESPONSE **resp) 513. { apps/s_server.c:514:5: 512. OCSP_RESPONSE **resp) 513. { 514. > char *host = NULL, *port = NULL, *path = NULL; 515. int use_ssl; 516. STACK_OF(OPENSSL_STRING) *aia = NULL; apps/s_server.c:516:5: 514. char *host = NULL, *port = NULL, *path = NULL; 515. int use_ssl; 516. > STACK_OF(OPENSSL_STRING) *aia = NULL; 517. X509 *x = NULL; 518. X509_STORE_CTX *inctx = NULL; apps/s_server.c:517:5: 515. int use_ssl; 516. STACK_OF(OPENSSL_STRING) *aia = NULL; 517. > X509 *x = NULL; 518. X509_STORE_CTX *inctx = NULL; 519. X509_OBJECT *obj; apps/s_server.c:518:5: 516. STACK_OF(OPENSSL_STRING) *aia = NULL; 517. X509 *x = NULL; 518. > X509_STORE_CTX *inctx = NULL; 519. X509_OBJECT *obj; 520. OCSP_REQUEST *req = NULL; apps/s_server.c:520:5: 518. X509_STORE_CTX *inctx = NULL; 519. X509_OBJECT *obj; 520. > OCSP_REQUEST *req = NULL; 521. OCSP_CERTID *id = NULL; 522. STACK_OF(X509_EXTENSION) *exts; apps/s_server.c:521:5: 519. X509_OBJECT *obj; 520. OCSP_REQUEST *req = NULL; 521. > OCSP_CERTID *id = NULL; 522. STACK_OF(X509_EXTENSION) *exts; 523. int ret = SSL_TLSEXT_ERR_NOACK; apps/s_server.c:523:5: 521. OCSP_CERTID *id = NULL; 522. STACK_OF(X509_EXTENSION) *exts; 523. > int ret = SSL_TLSEXT_ERR_NOACK; 524. int i; 525. apps/s_server.c:527:5: 525. 526. /* Build up OCSP query from server certificate */ 527. > x = SSL_get_certificate(s); 528. aia = X509_get1_ocsp(x); 529. if (aia != NULL) { ssl/ssl_lib.c:3703:1: start of procedure SSL_get_certificate() 3701. } 3702. 3703. > X509 *SSL_get_certificate(const SSL *s) 3704. { 3705. if (s->cert != NULL) ssl/ssl_lib.c:3705:9: Taking false branch 3703. X509 *SSL_get_certificate(const SSL *s) 3704. { 3705. if (s->cert != NULL) ^ 3706. return s->cert->key->x509; 3707. else ssl/ssl_lib.c:3708:9: 3706. return s->cert->key->x509; 3707. else 3708. > return NULL; 3709. } 3710. ssl/ssl_lib.c:3709:1: return from a call to SSL_get_certificate 3707. else 3708. return NULL; 3709. > } 3710. 3711. EVP_PKEY *SSL_get_privatekey(const SSL *s) apps/s_server.c:528:5: 526. /* Build up OCSP query from server certificate */ 527. x = SSL_get_certificate(s); 528. > aia = X509_get1_ocsp(x); 529. if (aia != NULL) { 530. if (!OCSP_parse_url(sk_OPENSSL_STRING_value(aia, 0),
https://github.com/openssl/openssl/blob/dab2cd68e7cc304c9b1a4e7cee18a98711771a53/apps/s_server.c/#L528
d2a_code_trace_data_41942
ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, long len) { ASN1_INTEGER *ret = NULL; size_t r; int neg; r = c2i_ibuf(NULL, NULL, *pp, len); if (r == 0) return NULL; if ((a == NULL) || ((*a) == NULL)) { ret = ASN1_INTEGER_new(); if (ret == NULL) return NULL; ret->type = V_ASN1_INTEGER; } else ret = *a; if (ASN1_STRING_set(ret, NULL, r) == 0) goto err; c2i_ibuf(ret->data, &neg, *pp, len); if (neg) ret->type |= V_ASN1_NEG; *pp += len; if (a != NULL) (*a) = ret; return ret; err: ASN1err(ASN1_F_C2I_ASN1_INTEGER, ERR_R_MALLOC_FAILURE); if ((a == NULL) || (*a != ret)) ASN1_INTEGER_free(ret); return NULL; } crypto/asn1/a_int.c:373: error: NULL_DEREFERENCE pointer `null` is dereferenced by call to `ASN1_STRING_set()` at line 373, column 9. Showing all 60 steps of the trace crypto/asn1/a_int.c:353:1: start of procedure c2i_ASN1_INTEGER() 351. 352. /* Convert ASN1 INTEGER content octets to ASN1_INTEGER structure */ 353. > ASN1_INTEGER *c2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **pp, 354. long len) 355. { crypto/asn1/a_int.c:356:5: 354. long len) 355. { 356. > ASN1_INTEGER *ret = NULL; 357. size_t r; 358. int neg; crypto/asn1/a_int.c:360:5: Skipping c2i_ibuf(): empty list of specs 358. int neg; 359. 360. r = c2i_ibuf(NULL, NULL, *pp, len); ^ 361. 362. if (r == 0) crypto/asn1/a_int.c:362:9: Taking false branch 360. r = c2i_ibuf(NULL, NULL, *pp, len); 361. 362. if (r == 0) ^ 363. return NULL; 364. crypto/asn1/a_int.c:365:10: Taking false branch 363. return NULL; 364. 365. if ((a == NULL) || ((*a) == NULL)) { ^ 366. ret = ASN1_INTEGER_new(); 367. if (ret == NULL) crypto/asn1/a_int.c:365:25: Taking true branch 363. return NULL; 364. 365. if ((a == NULL) || ((*a) == NULL)) { ^ 366. ret = ASN1_INTEGER_new(); 367. if (ret == NULL) crypto/asn1/a_int.c:366:9: 364. 365. if ((a == NULL) || ((*a) == NULL)) { 366. > ret = ASN1_INTEGER_new(); 367. if (ret == NULL) 368. return NULL; crypto/asn1/tasn_typ.c:78:1: start of procedure ASN1_INTEGER_new() 76. 77. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING) 78. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER) 79. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED) 80. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_BIT_STRING) 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/tasn_typ.c:78:1: return from a call to ASN1_INTEGER_new 76. 77. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING) 78. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER) 79. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED) 80. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_BIT_STRING) crypto/asn1/a_int.c:367:13: Taking false branch 365. if ((a == NULL) || ((*a) == NULL)) { 366. ret = ASN1_INTEGER_new(); 367. if (ret == NULL) ^ 368. return NULL; 369. ret->type = V_ASN1_INTEGER; crypto/asn1/a_int.c:369:9: 367. if (ret == NULL) 368. return NULL; 369. > ret->type = V_ASN1_INTEGER; 370. } else 371. ret = *a; crypto/asn1/a_int.c:373:9: 371. ret = *a; 372. 373. > if (ASN1_STRING_set(ret, NULL, r) == 0) 374. goto err; 375. crypto/asn1/asn1_lib.c:308:1: start of procedure ASN1_STRING_set() 306. } 307. 308. > int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) 309. { 310. unsigned char *c; crypto/asn1/asn1_lib.c:311:5: 309. { 310. unsigned char *c; 311. > const char *data = _data; 312. 313. if (len < 0) { crypto/asn1/asn1_lib.c:313:9: Taking false branch 311. const char *data = _data; 312. 313. if (len < 0) { ^ 314. if (data == NULL) 315. return (0); crypto/asn1/asn1_lib.c:319:10: Taking false branch 317. len = strlen(data); 318. } 319. if ((str->length < len) || (str->data == NULL)) { ^ 320. c = str->data; 321. str->data = OPENSSL_realloc(c, len + 1); crypto/asn1/asn1_lib.c:319:33: Taking true branch 317. len = strlen(data); 318. } 319. if ((str->length < len) || (str->data == NULL)) { ^ 320. c = str->data; 321. str->data = OPENSSL_realloc(c, len + 1); crypto/asn1/asn1_lib.c:320:9: 318. } 319. if ((str->length < len) || (str->data == NULL)) { 320. > c = str->data; 321. str->data = OPENSSL_realloc(c, len + 1); 322. if (str->data == NULL) { crypto/asn1/asn1_lib.c:321:9: 319. if ((str->length < len) || (str->data == NULL)) { 320. c = str->data; 321. > str->data = OPENSSL_realloc(c, len + 1); 322. if (str->data == NULL) { 323. ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE); crypto/mem.c:166:1: start of procedure CRYPTO_realloc() 164. } 165. 166. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) 167. { 168. if (str == NULL) crypto/mem.c:168:9: Taking true branch 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) 167. { 168. if (str == NULL) ^ 169. return CRYPTO_malloc(num, file, line); 170. crypto/mem.c:169:9: 167. { 168. if (str == NULL) 169. > return CRYPTO_malloc(num, file, line); 170. 171. if (num == 0) { crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:191:1: return from a call to CRYPTO_realloc 189. return realloc(str, num); 190. 191. > } 192. 193. void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num, crypto/asn1/asn1_lib.c:322:13: Taking false branch 320. c = str->data; 321. str->data = OPENSSL_realloc(c, len + 1); 322. if (str->data == NULL) { ^ 323. ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE); 324. str->data = c; crypto/asn1/asn1_lib.c:328:5: 326. } 327. } 328. > str->length = len; 329. if (data != NULL) { 330. memcpy(str->data, data, len); crypto/asn1/asn1_lib.c:329:9: Taking true branch 327. } 328. str->length = len; 329. if (data != NULL) { ^ 330. memcpy(str->data, data, len); 331. /* an allowance for strings :-) */ crypto/asn1/asn1_lib.c:330:9: 328. str->length = len; 329. if (data != NULL) { 330. > memcpy(str->data, data, len); 331. /* an allowance for strings :-) */ 332. str->data[len] = '\0'; crypto/asn1/asn1_lib.c:332:9: 330. memcpy(str->data, data, len); 331. /* an allowance for strings :-) */ 332. > str->data[len] = '\0'; 333. } 334. return (1); crypto/asn1/asn1_lib.c:334:5: 332. str->data[len] = '\0'; 333. } 334. > return (1); 335. } 336. crypto/asn1/asn1_lib.c:335:1: return from a call to ASN1_STRING_set 333. } 334. return (1); 335. > } 336. 337. void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/asn1/a_int.c/#L373
d2a_code_trace_data_41943
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/cms/cms_pwri.c:202: error: INTEGER_OVERFLOW_L2 (0 - [-oo, 32]):unsigned64 by call to `EVP_DecryptUpdate`. Showing all 7 steps of the trace crypto/cms/cms_pwri.c:202:13: Call 200. * this works because buffer is at least two block lengths long. 201. */ 202. || !EVP_DecryptUpdate(ctx, tmp, &outl, ^ 203. tmp + inlen - blocklen, blocklen) 204. /* Can now decrypt first n - 1 blocks */ crypto/evp/evp_enc.c:416:1: Parameter `ctx->cipher->block_size` 414. } 415. 416. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 417. const unsigned char *in, int inl) 418. { crypto/evp/evp_enc.c:422:5: Assignment 420. unsigned int b; 421. 422. b = ctx->cipher->block_size; ^ 423. 424. if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) { crypto/evp/evp_enc.c:452:16: Call 450. /* see comment about PTRDIFF_T comparison above */ 451. if (((PTRDIFF_T)out == (PTRDIFF_T)in) 452. || is_partially_overlapping(out, in, b)) { ^ 453. EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING); 454. return 0; crypto/evp/evp_enc.c:279:1: <RHS trace> 277. #endif 278. 279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 280. { 281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:279:1: Parameter `len` 277. #endif 278. 279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 280. { 281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:288:50: Binary operation: (0 - [-oo, 32]):unsigned64 by call to `EVP_DecryptUpdate` 286. */ 287. int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | 288. (diff > (0 - (PTRDIFF_T)len))); ^ 289. assert(!overlapped); 290. return overlapped;
https://github.com/openssl/openssl/blob/7141ba31969d0b378d08104a51f8f99b9187b9d5/crypto/evp/evp_enc.c/#L288
d2a_code_trace_data_41944
static TS_VERIFY_CTX *create_verify_ctx(char *data, char *digest, char *queryfile, char *CApath, char *CAfile, char *untrusted, X509_VERIFY_PARAM *vpm) { TS_VERIFY_CTX *ctx = NULL; BIO *input = NULL; TS_REQ *request = NULL; int ret = 0; int f = 0; if (data != NULL || digest != NULL) { if ((ctx = TS_VERIFY_CTX_new()) == NULL) goto err; f = TS_VFY_VERSION | TS_VFY_SIGNER; if (data != NULL) { f |= TS_VFY_DATA; if (TS_VERIFY_CTX_set_data(ctx, BIO_new_file(data, "rb")) == NULL) goto err; } else if (digest != NULL) { long imprint_len; unsigned char *hexstr = string_to_hex(digest, &imprint_len); f |= TS_VFY_IMPRINT; if (TS_VERIFY_CTX_set_imprint(ctx, hexstr, imprint_len) == NULL) { BIO_printf(bio_err, "invalid digest string\n"); goto err; } } } else if (queryfile != NULL) { if ((input = BIO_new_file(queryfile, "rb")) == NULL) goto err; if ((request = d2i_TS_REQ_bio(input, NULL)) == NULL) goto err; if ((ctx = TS_REQ_to_TS_VERIFY_CTX(request, NULL)) == NULL) goto err; } else return NULL; TS_VERIFY_CTX_add_flags(ctx, f | TS_VFY_SIGNATURE); if (TS_VERIFY_CTX_set_store(ctx, create_cert_store(CApath, CAfile, vpm)) == NULL) goto err; if (untrusted && TS_VERIFY_CTS_set_certs(ctx, TS_CONF_load_certs(untrusted)) == NULL) goto err; ret = 1; err: if (!ret) { TS_VERIFY_CTX_free(ctx); ctx = NULL; } BIO_free_all(input); TS_REQ_free(request); return ctx; } apps/ts.c:976: error: MEMORY_LEAK memory dynamically allocated by call to `TS_VERIFY_CTX_new()` at line 933, column 20 is not reachable after line 976, column 9. Showing all 119 steps of the trace apps/ts.c:920:1: start of procedure create_verify_ctx() 918. } 919. 920. > static TS_VERIFY_CTX *create_verify_ctx(char *data, char *digest, 921. char *queryfile, 922. char *CApath, char *CAfile, apps/ts.c:926:5: 924. X509_VERIFY_PARAM *vpm) 925. { 926. > TS_VERIFY_CTX *ctx = NULL; 927. BIO *input = NULL; 928. TS_REQ *request = NULL; apps/ts.c:927:5: 925. { 926. TS_VERIFY_CTX *ctx = NULL; 927. > BIO *input = NULL; 928. TS_REQ *request = NULL; 929. int ret = 0; apps/ts.c:928:5: 926. TS_VERIFY_CTX *ctx = NULL; 927. BIO *input = NULL; 928. > TS_REQ *request = NULL; 929. int ret = 0; 930. int f = 0; apps/ts.c:929:5: 927. BIO *input = NULL; 928. TS_REQ *request = NULL; 929. > int ret = 0; 930. int f = 0; 931. apps/ts.c:930:5: 928. TS_REQ *request = NULL; 929. int ret = 0; 930. > int f = 0; 931. 932. if (data != NULL || digest != NULL) { apps/ts.c:932:9: Taking false branch 930. int f = 0; 931. 932. if (data != NULL || digest != NULL) { ^ 933. if ((ctx = TS_VERIFY_CTX_new()) == NULL) 934. goto err; apps/ts.c:932:25: Taking true branch 930. int f = 0; 931. 932. if (data != NULL || digest != NULL) { ^ 933. if ((ctx = TS_VERIFY_CTX_new()) == NULL) 934. goto err; apps/ts.c:933:13: 931. 932. if (data != NULL || digest != NULL) { 933. > if ((ctx = TS_VERIFY_CTX_new()) == NULL) 934. goto err; 935. f = TS_VFY_VERSION | TS_VFY_SIGNER; crypto/ts/ts_verify_ctx.c:64:1: start of procedure TS_VERIFY_CTX_new() 62. #include "ts_lcl.h" 63. 64. > TS_VERIFY_CTX *TS_VERIFY_CTX_new(void) 65. { 66. TS_VERIFY_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); crypto/ts/ts_verify_ctx.c:66:5: 64. TS_VERIFY_CTX *TS_VERIFY_CTX_new(void) 65. { 66. > TS_VERIFY_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); 67. 68. if (ctx == NULL) 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/ts/ts_verify_ctx.c:68:9: Taking false branch 66. TS_VERIFY_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); 67. 68. if (ctx == NULL) ^ 69. TSerr(TS_F_TS_VERIFY_CTX_NEW, ERR_R_MALLOC_FAILURE); 70. return ctx; crypto/ts/ts_verify_ctx.c:70:5: 68. if (ctx == NULL) 69. TSerr(TS_F_TS_VERIFY_CTX_NEW, ERR_R_MALLOC_FAILURE); 70. > return ctx; 71. } 72. crypto/ts/ts_verify_ctx.c:71:1: return from a call to TS_VERIFY_CTX_new 69. TSerr(TS_F_TS_VERIFY_CTX_NEW, ERR_R_MALLOC_FAILURE); 70. return ctx; 71. > } 72. 73. void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx) apps/ts.c:933:13: Taking false branch 931. 932. if (data != NULL || digest != NULL) { 933. if ((ctx = TS_VERIFY_CTX_new()) == NULL) ^ 934. goto err; 935. f = TS_VFY_VERSION | TS_VFY_SIGNER; apps/ts.c:935:9: 933. if ((ctx = TS_VERIFY_CTX_new()) == NULL) 934. goto err; 935. > f = TS_VFY_VERSION | TS_VFY_SIGNER; 936. if (data != NULL) { 937. f |= TS_VFY_DATA; apps/ts.c:936:13: Taking false branch 934. goto err; 935. f = TS_VFY_VERSION | TS_VFY_SIGNER; 936. if (data != NULL) { ^ 937. f |= TS_VFY_DATA; 938. if (TS_VERIFY_CTX_set_data(ctx, BIO_new_file(data, "rb")) == NULL) apps/ts.c:940:20: Taking true branch 938. if (TS_VERIFY_CTX_set_data(ctx, BIO_new_file(data, "rb")) == NULL) 939. goto err; 940. } else if (digest != NULL) { ^ 941. long imprint_len; 942. unsigned char *hexstr = string_to_hex(digest, &imprint_len); apps/ts.c:942:13: Skipping string_to_hex(): empty list of specs 940. } else if (digest != NULL) { 941. long imprint_len; 942. unsigned char *hexstr = string_to_hex(digest, &imprint_len); ^ 943. f |= TS_VFY_IMPRINT; 944. if (TS_VERIFY_CTX_set_imprint(ctx, hexstr, imprint_len) == NULL) { apps/ts.c:943:13: 941. long imprint_len; 942. unsigned char *hexstr = string_to_hex(digest, &imprint_len); 943. > f |= TS_VFY_IMPRINT; 944. if (TS_VERIFY_CTX_set_imprint(ctx, hexstr, imprint_len) == NULL) { 945. BIO_printf(bio_err, "invalid digest string\n"); apps/ts.c:944:17: 942. unsigned char *hexstr = string_to_hex(digest, &imprint_len); 943. f |= TS_VFY_IMPRINT; 944. > if (TS_VERIFY_CTX_set_imprint(ctx, hexstr, imprint_len) == NULL) { 945. BIO_printf(bio_err, "invalid digest string\n"); 946. goto err; crypto/ts/ts_verify_ctx.c:119:1: start of procedure TS_VERIFY_CTX_set_imprint() 117. } 118. 119. > unsigned char *TS_VERIFY_CTX_set_imprint(TS_VERIFY_CTX *ctx, 120. unsigned char *hexstr, long len) 121. { crypto/ts/ts_verify_ctx.c:122:5: 120. unsigned char *hexstr, long len) 121. { 122. > ctx->imprint = hexstr; 123. ctx->imprint_len = len; 124. return ctx->imprint; crypto/ts/ts_verify_ctx.c:123:5: 121. { 122. ctx->imprint = hexstr; 123. > ctx->imprint_len = len; 124. return ctx->imprint; 125. } crypto/ts/ts_verify_ctx.c:124:5: 122. ctx->imprint = hexstr; 123. ctx->imprint_len = len; 124. > return ctx->imprint; 125. } 126. crypto/ts/ts_verify_ctx.c:125:1: return from a call to TS_VERIFY_CTX_set_imprint 123. ctx->imprint_len = len; 124. return ctx->imprint; 125. > } 126. 127. void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx) apps/ts.c:944:17: Taking false branch 942. unsigned char *hexstr = string_to_hex(digest, &imprint_len); 943. f |= TS_VFY_IMPRINT; 944. if (TS_VERIFY_CTX_set_imprint(ctx, hexstr, imprint_len) == NULL) { ^ 945. BIO_printf(bio_err, "invalid digest string\n"); 946. goto err; apps/ts.c:961:5: 959. 960. /* Add the signature verification flag and arguments. */ 961. > TS_VERIFY_CTX_add_flags(ctx, f | TS_VFY_SIGNATURE); 962. 963. /* Initialising the X509_STORE object. */ crypto/ts/ts_verify_ctx.c:88:1: start of procedure TS_VERIFY_CTX_add_flags() 86. } 87. 88. > int TS_VERIFY_CTX_add_flags(TS_VERIFY_CTX *ctx, int f) 89. { 90. ctx->flags |= f; crypto/ts/ts_verify_ctx.c:90:5: 88. int TS_VERIFY_CTX_add_flags(TS_VERIFY_CTX *ctx, int f) 89. { 90. > ctx->flags |= f; 91. return ctx->flags; 92. } crypto/ts/ts_verify_ctx.c:91:5: 89. { 90. ctx->flags |= f; 91. > return ctx->flags; 92. } 93. crypto/ts/ts_verify_ctx.c:92:1: return from a call to TS_VERIFY_CTX_add_flags 90. ctx->flags |= f; 91. return ctx->flags; 92. > } 93. 94. int TS_VERIFY_CTX_set_flags(TS_VERIFY_CTX *ctx, int f) apps/ts.c:964:9: 962. 963. /* Initialising the X509_STORE object. */ 964. > if (TS_VERIFY_CTX_set_store(ctx, create_cert_store(CApath, CAfile, vpm)) 965. == NULL) 966. goto err; apps/ts.c:984:1: start of procedure create_cert_store() 982. } 983. 984. > static X509_STORE *create_cert_store(char *CApath, char *CAfile, X509_VERIFY_PARAM *vpm) 985. { 986. X509_STORE *cert_ctx = NULL; apps/ts.c:986:5: 984. static X509_STORE *create_cert_store(char *CApath, char *CAfile, X509_VERIFY_PARAM *vpm) 985. { 986. > X509_STORE *cert_ctx = NULL; 987. X509_LOOKUP *lookup = NULL; 988. int i; apps/ts.c:987:5: 985. { 986. X509_STORE *cert_ctx = NULL; 987. > X509_LOOKUP *lookup = NULL; 988. int i; 989. apps/ts.c:990:5: Skipping X509_STORE_new(): empty list of specs 988. int i; 989. 990. cert_ctx = X509_STORE_new(); ^ 991. X509_STORE_set_verify_cb(cert_ctx, verify_cb); 992. if (CApath != NULL) { apps/ts.c:991:5: 989. 990. cert_ctx = X509_STORE_new(); 991. > X509_STORE_set_verify_cb(cert_ctx, verify_cb); 992. if (CApath != NULL) { 993. lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_hash_dir()); crypto/x509/x509_lu.c:701:1: start of procedure X509_STORE_set_verify_cb() 699. } 700. 701. > void X509_STORE_set_verify_cb(X509_STORE *ctx, 702. int (*verify_cb) (int, X509_STORE_CTX *)) 703. { crypto/x509/x509_lu.c:704:5: 702. int (*verify_cb) (int, X509_STORE_CTX *)) 703. { 704. > ctx->verify_cb = verify_cb; 705. } 706. crypto/x509/x509_lu.c:705:1: return from a call to X509_STORE_set_verify_cb 703. { 704. ctx->verify_cb = verify_cb; 705. > } 706. 707. void X509_STORE_set_lookup_crls_cb(X509_STORE *ctx, apps/ts.c:992:9: Taking false branch 990. cert_ctx = X509_STORE_new(); 991. X509_STORE_set_verify_cb(cert_ctx, verify_cb); 992. if (CApath != NULL) { ^ 993. lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_hash_dir()); 994. if (lookup == NULL) { apps/ts.c:1005:9: Taking true branch 1003. } 1004. 1005. if (CAfile != NULL) { ^ 1006. lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_file()); 1007. if (lookup == NULL) { apps/ts.c:1006:9: 1004. 1005. if (CAfile != NULL) { 1006. > lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_file()); 1007. if (lookup == NULL) { 1008. BIO_printf(bio_err, "memory allocation failure\n"); crypto/x509/by_file.c:83:1: start of procedure X509_LOOKUP_file() 81. }; 82. 83. > X509_LOOKUP_METHOD *X509_LOOKUP_file(void) 84. { 85. return (&x509_file_lookup); crypto/x509/by_file.c:85:5: 83. X509_LOOKUP_METHOD *X509_LOOKUP_file(void) 84. { 85. > return (&x509_file_lookup); 86. } 87. crypto/x509/by_file.c:86:1: return from a call to X509_LOOKUP_file 84. { 85. return (&x509_file_lookup); 86. > } 87. 88. static int by_file_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, crypto/x509/x509_lu.c:269:1: start of procedure X509_STORE_add_lookup() 267. } 268. 269. > X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m) 270. { 271. int i; crypto/x509/x509_lu.c:275:5: 273. X509_LOOKUP *lu; 274. 275. > sk = v->get_cert_methods; 276. for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) { 277. lu = sk_X509_LOOKUP_value(sk, i); crypto/x509/x509_lu.c:276:10: 274. 275. sk = v->get_cert_methods; 276. > for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) { 277. lu = sk_X509_LOOKUP_value(sk, i); 278. if (m == lu->method) { crypto/x509/x509_lu.c:276:17: 274. 275. sk = v->get_cert_methods; 276. > for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) { 277. lu = sk_X509_LOOKUP_value(sk, i); 278. if (m == lu->method) { include/openssl/x509_vfy.h:121:1: start of procedure sk_X509_LOOKUP_num() 119. typedef struct x509_lookup_st X509_LOOKUP; 120. 121. > DEFINE_STACK_OF(X509_LOOKUP) 122. DEFINE_STACK_OF(X509_OBJECT) 123. crypto/stack/stack.c:316:1: start of procedure sk_num() 314. } 315. 316. > int sk_num(const _STACK *st) 317. { 318. if (st == NULL) crypto/stack/stack.c:318:9: Taking true branch 316. int sk_num(const _STACK *st) 317. { 318. if (st == NULL) ^ 319. return -1; 320. return st->num; crypto/stack/stack.c:319:9: 317. { 318. if (st == NULL) 319. > return -1; 320. return st->num; 321. } crypto/stack/stack.c:321:1: return from a call to sk_num 319. return -1; 320. return st->num; 321. > } 322. 323. void *sk_value(const _STACK *st, int i) include/openssl/x509_vfy.h:121:1: return from a call to sk_X509_LOOKUP_num 119. typedef struct x509_lookup_st X509_LOOKUP; 120. 121. > DEFINE_STACK_OF(X509_LOOKUP) 122. DEFINE_STACK_OF(X509_OBJECT) 123. crypto/x509/x509_lu.c:276:17: Loop condition is false. Leaving loop 274. 275. sk = v->get_cert_methods; 276. for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) { ^ 277. lu = sk_X509_LOOKUP_value(sk, i); 278. if (m == lu->method) { crypto/x509/x509_lu.c:283:5: Skipping X509_LOOKUP_new(): empty list of specs 281. } 282. /* a new one */ 283. lu = X509_LOOKUP_new(m); ^ 284. if (lu == NULL) 285. return NULL; crypto/x509/x509_lu.c:284:9: Taking true branch 282. /* a new one */ 283. lu = X509_LOOKUP_new(m); 284. if (lu == NULL) ^ 285. return NULL; 286. else { crypto/x509/x509_lu.c:285:9: 283. lu = X509_LOOKUP_new(m); 284. if (lu == NULL) 285. > return NULL; 286. else { 287. lu->store_ctx = v; crypto/x509/x509_lu.c:295:1: return from a call to X509_STORE_add_lookup 293. } 294. } 295. > } 296. 297. int X509_STORE_get_by_subject(X509_STORE_CTX *vs, X509_LOOKUP_TYPE type, apps/ts.c:1007:13: Taking true branch 1005. if (CAfile != NULL) { 1006. lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_file()); 1007. if (lookup == NULL) { ^ 1008. BIO_printf(bio_err, "memory allocation failure\n"); 1009. goto err; apps/ts.c:1008:13: 1006. lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_file()); 1007. if (lookup == NULL) { 1008. > BIO_printf(bio_err, "memory allocation failure\n"); 1009. goto err; 1010. } crypto/bio/b_print.c:783:1: start of procedure BIO_printf() 781. /***************************************************************************/ 782. 783. > int BIO_printf(BIO *bio, const char *format, ...) 784. { 785. va_list args; crypto/bio/b_print.c:788:5: 786. int ret; 787. 788. > va_start(args, format); 789. 790. ret = BIO_vprintf(bio, format, args); crypto/bio/b_print.c:790:5: Skipping BIO_vprintf(): empty list of specs 788. va_start(args, format); 789. 790. ret = BIO_vprintf(bio, format, args); ^ 791. 792. va_end(args); crypto/bio/b_print.c:792:5: 790. ret = BIO_vprintf(bio, format, args); 791. 792. > va_end(args); 793. return (ret); 794. } crypto/bio/b_print.c:793:5: 791. 792. va_end(args); 793. > return (ret); 794. } 795. crypto/bio/b_print.c:794:1: return from a call to BIO_printf 792. va_end(args); 793. return (ret); 794. > } 795. 796. int BIO_vprintf(BIO *bio, const char *format, va_list args) apps/ts.c:1023:2: 1021. return cert_ctx; 1022. 1023. > err: 1024. X509_STORE_free(cert_ctx); 1025. return NULL; apps/ts.c:1024:5: 1022. 1023. err: 1024. > X509_STORE_free(cert_ctx); 1025. return NULL; 1026. } crypto/x509/x509_lu.c:227:1: start of procedure X509_STORE_free() 225. } 226. 227. > void X509_STORE_free(X509_STORE *vfy) 228. { 229. int i; crypto/x509/x509_lu.c:233:9: Taking false branch 231. X509_LOOKUP *lu; 232. 233. if (vfy == NULL) ^ 234. return; 235. crypto/x509/x509_lu.c:236:5: 234. return; 235. 236. > CRYPTO_atomic_add(&vfy->references, -1, &i, vfy->lock); 237. REF_PRINT_COUNT("X509_STORE", vfy); 238. if (i > 0) 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/x509/x509_lu.c:238:9: Taking true branch 236. CRYPTO_atomic_add(&vfy->references, -1, &i, vfy->lock); 237. REF_PRINT_COUNT("X509_STORE", vfy); 238. if (i > 0) ^ 239. return; 240. REF_ASSERT_ISNT(i < 0); crypto/x509/x509_lu.c:239:9: 237. REF_PRINT_COUNT("X509_STORE", vfy); 238. if (i > 0) 239. > return; 240. REF_ASSERT_ISNT(i < 0); 241. crypto/x509/x509_lu.c:255:1: return from a call to X509_STORE_free 253. CRYPTO_THREAD_lock_free(vfy->lock); 254. OPENSSL_free(vfy); 255. > } 256. 257. int X509_STORE_up_ref(X509_STORE *vfy) apps/ts.c:1025:5: 1023. err: 1024. X509_STORE_free(cert_ctx); 1025. > return NULL; 1026. } 1027. apps/ts.c:1026:1: return from a call to create_cert_store 1024. X509_STORE_free(cert_ctx); 1025. return NULL; 1026. > } 1027. 1028. static int verify_cb(int ok, X509_STORE_CTX *ctx) crypto/ts/ts_verify_ctx.c:106:1: start of procedure TS_VERIFY_CTX_set_store() 104. } 105. 106. > X509_STORE *TS_VERIFY_CTX_set_store(TS_VERIFY_CTX *ctx, X509_STORE *s) 107. { 108. ctx->store = s; crypto/ts/ts_verify_ctx.c:108:5: 106. X509_STORE *TS_VERIFY_CTX_set_store(TS_VERIFY_CTX *ctx, X509_STORE *s) 107. { 108. > ctx->store = s; 109. return ctx->store; 110. } crypto/ts/ts_verify_ctx.c:109:5: 107. { 108. ctx->store = s; 109. > return ctx->store; 110. } 111. crypto/ts/ts_verify_ctx.c:110:1: return from a call to TS_VERIFY_CTX_set_store 108. ctx->store = s; 109. return ctx->store; 110. > } 111. 112. STACK_OF(X509) *TS_VERIFY_CTS_set_certs(TS_VERIFY_CTX *ctx, apps/ts.c:964:9: Taking true branch 962. 963. /* Initialising the X509_STORE object. */ 964. if (TS_VERIFY_CTX_set_store(ctx, create_cert_store(CApath, CAfile, vpm)) ^ 965. == NULL) 966. goto err; apps/ts.c:974:2: 972. ret = 1; 973. 974. > err: 975. if (!ret) { 976. TS_VERIFY_CTX_free(ctx); apps/ts.c:975:10: Taking true branch 973. 974. err: 975. if (!ret) { ^ 976. TS_VERIFY_CTX_free(ctx); 977. ctx = NULL; apps/ts.c:976:9: 974. err: 975. if (!ret) { 976. > TS_VERIFY_CTX_free(ctx); 977. ctx = NULL; 978. } crypto/ts/ts_verify_ctx.c:79:1: start of procedure TS_VERIFY_CTX_free() 77. } 78. 79. > void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx) 80. { 81. if (!ctx) crypto/ts/ts_verify_ctx.c:81:10: Taking false branch 79. void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx) 80. { 81. if (!ctx) ^ 82. return; 83. crypto/ts/ts_verify_ctx.c:84:5: Skipping TS_VERIFY_CTX_cleanup(): empty list of specs 82. return; 83. 84. TS_VERIFY_CTX_cleanup(ctx); ^ 85. OPENSSL_free(ctx); 86. } crypto/ts/ts_verify_ctx.c:85:5: 83. 84. TS_VERIFY_CTX_cleanup(ctx); 85. > OPENSSL_free(ctx); 86. } 87. crypto/mem.c:210:1: start of procedure CRYPTO_free() 208. } 209. 210. > void CRYPTO_free(void *str, const char *file, int line) 211. { 212. if (free_impl != NULL && free_impl != &CRYPTO_free) { crypto/mem.c:212:9: Taking true branch 210. void CRYPTO_free(void *str, const char *file, int line) 211. { 212. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 213. free_impl(str, file, line); 214. return; crypto/mem.c:212:30: Taking true branch 210. void CRYPTO_free(void *str, const char *file, int line) 211. { 212. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 213. free_impl(str, file, line); 214. return; crypto/mem.c:213:9: Skipping __function_pointer__(): unresolved function pointer 211. { 212. if (free_impl != NULL && free_impl != &CRYPTO_free) { 213. free_impl(str, file, line); ^ 214. return; 215. } crypto/mem.c:214:9: 212. if (free_impl != NULL && free_impl != &CRYPTO_free) { 213. free_impl(str, file, line); 214. > return; 215. } 216. crypto/mem.c:228:1: return from a call to CRYPTO_free 226. free(str); 227. #endif 228. > } 229. 230. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/ts/ts_verify_ctx.c:86:1: return from a call to TS_VERIFY_CTX_free 84. TS_VERIFY_CTX_cleanup(ctx); 85. OPENSSL_free(ctx); 86. > } 87. 88. int TS_VERIFY_CTX_add_flags(TS_VERIFY_CTX *ctx, int f)
https://github.com/openssl/openssl/blob/91056e72693b4ee8cb5339d9091871ffc3b6f776/apps/ts.c/#L976
d2a_code_trace_data_41945
int ff_mjpeg_decode_sos(MJpegDecodeContext *s) { int len, nb_components, i, h, v, predictor, point_transform; int vmax, hmax, index, id; const int block_size= s->lossless ? 1 : 8; int ilv, prev_shift; len = get_bits(&s->gb, 16); nb_components = get_bits(&s->gb, 8); if (len != 6+2*nb_components) { av_log(s->avctx, AV_LOG_ERROR, "decode_sos: invalid len (%d)\n", len); return -1; } vmax = 0; hmax = 0; for(i=0;i<nb_components;i++) { id = get_bits(&s->gb, 8) - 1; av_log(s->avctx, AV_LOG_DEBUG, "component: %d\n", id); for(index=0;index<s->nb_components;index++) if (id == s->component_id[index]) break; if (index == s->nb_components) { av_log(s->avctx, AV_LOG_ERROR, "decode_sos: index(%d) out of components\n", index); return -1; } s->comp_index[i] = index; s->nb_blocks[i] = s->h_count[index] * s->v_count[index]; s->h_scount[i] = s->h_count[index]; s->v_scount[i] = s->v_count[index]; s->dc_index[i] = get_bits(&s->gb, 4); s->ac_index[i] = get_bits(&s->gb, 4); if (s->dc_index[i] < 0 || s->ac_index[i] < 0 || s->dc_index[i] >= 4 || s->ac_index[i] >= 4) goto out_of_range; #if 0 switch(s->start_code) { case SOF0: if (dc_index[i] > 1 || ac_index[i] > 1) goto out_of_range; break; case SOF1: case SOF2: if (dc_index[i] > 3 || ac_index[i] > 3) goto out_of_range; break; case SOF3: if (dc_index[i] > 3 || ac_index[i] != 0) goto out_of_range; break; } #endif } predictor= get_bits(&s->gb, 8); ilv= get_bits(&s->gb, 8); prev_shift = get_bits(&s->gb, 4); point_transform= get_bits(&s->gb, 4); for(i=0;i<nb_components;i++) s->last_dc[i] = 1024; if (nb_components > 1) { s->mb_width = (s->width + s->h_max * block_size - 1) / (s->h_max * block_size); s->mb_height = (s->height + s->v_max * block_size - 1) / (s->v_max * block_size); } else if(!s->ls) { h = s->h_max / s->h_scount[0]; v = s->v_max / s->v_scount[0]; s->mb_width = (s->width + h * block_size - 1) / (h * block_size); s->mb_height = (s->height + v * block_size - 1) / (v * block_size); s->nb_blocks[0] = 1; s->h_scount[0] = 1; s->v_scount[0] = 1; } if(s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_DEBUG, "%s %s p:%d >>:%d ilv:%d bits:%d %s\n", s->lossless ? "lossless" : "sequencial DCT", s->rgb ? "RGB" : "", predictor, point_transform, ilv, s->bits, s->pegasus_rct ? "PRCT" : (s->rct ? "RCT" : "")); for (i = s->mjpb_skiptosod; i > 0; i--) skip_bits(&s->gb, 8); if(s->lossless){ if(ENABLE_JPEGLS_DECODER && s->ls){ ff_jpegls_decode_picture(s, predictor, point_transform, ilv); }else{ if(s->rgb){ if(ljpeg_decode_rgb_scan(s, predictor, point_transform) < 0) return -1; }else{ if(ljpeg_decode_yuv_scan(s, predictor, point_transform) < 0) return -1; } } }else{ if(mjpeg_decode_scan(s, nb_components, predictor, ilv, prev_shift, point_transform) < 0) return -1; } emms_c(); return 0; out_of_range: av_log(s->avctx, AV_LOG_ERROR, "decode_sos: ac/dc index out of range\n"); return -1; } libavcodec/mjpegdec.c:1300: error: Buffer Overrun L2 Offset: [0, max(4, `avctx->priv_data->nb_components`)] Size: 4 by call to `ff_mjpeg_decode_sos`. libavcodec/mjpegdec.c:1106:1: Parameter `avctx->priv_data->nb_components` 1104. } 1105. 1106. int ff_mjpeg_decode_frame(AVCodecContext *avctx, ^ 1107. void *data, int *data_size, 1108. const uint8_t *buf, int buf_size) libavcodec/mjpegdec.c:1300:21: Call 1298. break; 1299. case SOS: 1300. ff_mjpeg_decode_sos(s); ^ 1301. /* buggy avid puts EOI every 10-20th frame */ 1302. /* if restart period is over process EOI */ libavcodec/mjpegdec.c:738:1: <Offset trace> 736. } 737. 738. int ff_mjpeg_decode_sos(MJpegDecodeContext *s) ^ 739. { 740. int len, nb_components, i, h, v, predictor, point_transform; libavcodec/mjpegdec.c:738:1: Parameter `s->nb_components` 736. } 737. 738. int ff_mjpeg_decode_sos(MJpegDecodeContext *s) ^ 739. { 740. int len, nb_components, i, h, v, predictor, point_transform; libavcodec/mjpegdec.c:738:1: <Length trace> 736. } 737. 738. int ff_mjpeg_decode_sos(MJpegDecodeContext *s) ^ 739. { 740. int len, nb_components, i, h, v, predictor, point_transform; libavcodec/mjpegdec.c:738:1: Parameter `s->h_count[*]` 736. } 737. 738. int ff_mjpeg_decode_sos(MJpegDecodeContext *s) ^ 739. { 740. int len, nb_components, i, h, v, predictor, point_transform; libavcodec/mjpegdec.c:770:27: Array access: Offset: [0, max(4, avctx->priv_data->nb_components)] Size: 4 by call to `ff_mjpeg_decode_sos` 768. s->comp_index[i] = index; 769. 770. s->nb_blocks[i] = s->h_count[index] * s->v_count[index]; ^ 771. s->h_scount[i] = s->h_count[index]; 772. s->v_scount[i] = s->v_count[index];
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mjpegdec.c/#L770
d2a_code_trace_data_41946
int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, const char *dir) { DIR *d; struct dirent *dstruct; int ret = 0; CRYPTO_w_lock(CRYPTO_LOCK_READDIR); d = opendir(dir); if(!d) { SYSerr(SYS_F_OPENDIR, get_last_sys_error()); ERR_add_error_data(3, "opendir('", dir, "')"); SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK, ERR_R_SYS_LIB); goto err; } while((dstruct=readdir(d))) { char buf[1024]; int r; if(strlen(dir)+strlen(dstruct->d_name)+2 > sizeof buf) { SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG); goto err; } r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name); if (r <= 0 || r >= sizeof buf) goto err; if(!SSL_add_file_cert_subjects_to_stack(stack,buf)) goto err; } ret = 1; err: CRYPTO_w_unlock(CRYPTO_LOCK_READDIR); return ret; } ssl/ssl_cert.c:746: error: RESOURCE_LEAK resource acquired to `ret` by call to `opendir()` at line 718, column 6 is not released after line 746, column 2. Showing all 12 steps of the trace ssl/ssl_cert.c:710:1: start of procedure SSL_add_dir_cert_subjects_to_stack() 708. #ifndef MAC_OS_pre_X 709. 710. > int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack, 711. const char *dir) 712. { ssl/ssl_cert.c:715:2: 713. DIR *d; 714. struct dirent *dstruct; 715. > int ret = 0; 716. 717. CRYPTO_w_lock(CRYPTO_LOCK_READDIR); ssl/ssl_cert.c:717:2: 715. int ret = 0; 716. 717. > CRYPTO_w_lock(CRYPTO_LOCK_READDIR); 718. d = opendir(dir); 719. crypto/cryptlib.c:198:1: start of procedure CRYPTO_lock() 196. } 197. 198. > void CRYPTO_lock(int mode, int type, const char *file, int line) 199. { 200. #ifdef LOCK_DEBUG crypto/cryptlib.c:223:6: Taking true branch 221. } 222. #endif 223. if (locking_callback != NULL) ^ 224. locking_callback(mode,type,file,line); 225. } crypto/cryptlib.c:224:3: Skipping __function_pointer__(): unresolved function pointer 222. #endif 223. if (locking_callback != NULL) 224. locking_callback(mode,type,file,line); ^ 225. } 226. crypto/cryptlib.c:223:2: 221. } 222. #endif 223. > if (locking_callback != NULL) 224. locking_callback(mode,type,file,line); 225. } crypto/cryptlib.c:225:2: return from a call to CRYPTO_lock 223. if (locking_callback != NULL) 224. locking_callback(mode,type,file,line); 225. } ^ 226. 227. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, ssl/ssl_cert.c:718:2: 716. 717. CRYPTO_w_lock(CRYPTO_LOCK_READDIR); 718. > d = opendir(dir); 719. 720. /* Note that a side effect is that the CAs will be sorted by name */ ssl/ssl_cert.c:721:6: Taking false branch 719. 720. /* Note that a side effect is that the CAs will be sorted by name */ 721. if(!d) ^ 722. { 723. SYSerr(SYS_F_OPENDIR, get_last_sys_error()); ssl/ssl_cert.c:729:9: Loop condition is false. Leaving loop 727. } 728. 729. while((dstruct=readdir(d))) ^ 730. { 731. char buf[1024]; ssl/ssl_cert.c:746:2: 744. goto err; 745. } 746. > ret = 1; 747. 748. err:
https://github.com/openssl/openssl/blob/4d29312ce198d00a69c4b0bf572c0de46778ecc9/ssl/ssl_cert.c/#L746
d2a_code_trace_data_41947
int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) { char *v; int gmt=0; int i; int y=0,M=0,d=0,h=0,m=0,s=0; char *f = NULL; int f_len = 0; i=tm->length; v=(char *)tm->data; if (i < 12) goto err; if (v[i-1] == 'Z') gmt=1; for (i=0; i<12; i++) if ((v[i] > '9') || (v[i] < '0')) goto err; y= (v[0]-'0')*1000+(v[1]-'0')*100 + (v[2]-'0')*10+(v[3]-'0'); M= (v[4]-'0')*10+(v[5]-'0'); if ((M > 12) || (M < 1)) goto err; d= (v[6]-'0')*10+(v[7]-'0'); h= (v[8]-'0')*10+(v[9]-'0'); m= (v[10]-'0')*10+(v[11]-'0'); if ( (v[12] >= '0') && (v[12] <= '9') && (v[13] >= '0') && (v[13] <= '9')) { s= (v[12]-'0')*10+(v[13]-'0'); if (v[14] == '.') { int l = tm->length; f = &v[14]; f_len = 1; while (14 + f_len < l && f[f_len] >= '0' && f[f_len] <= '9') ++f_len; } } if (BIO_printf(bp,"%s %2d %02d:%02d:%02d%.*s %d%s", mon[M-1],d,h,m,s,f_len,f,y,(gmt)?" GMT":"") <= 0) return(0); else return(1); err: BIO_write(bp,"Bad time value",14); return(0); } apps/ocsp.c:1015: error: BUFFER_OVERRUN_L3 Offset: [-529, +oo] Size: 12 by call to `ASN1_GENERALIZEDTIME_print`. Showing all 12 steps of the trace apps/ocsp.c:997:7: Call 995. BIO_printf(out, "%s: ", name); 996. 997. if(!OCSP_resp_find_status(bs, id, &status, &reason, ^ 998. &rev, &thisupd, &nextupd)) 999. { crypto/ocsp/ocsp_cl.c:301:6: Call 299. if(i < 0) return 0; 300. single = OCSP_resp_get0(bs, i); 301. i = OCSP_single_get0_status(single, reason, revtime, thisupd, nextupd); ^ 302. if(status) *status = i; 303. return 1; crypto/ocsp/ocsp_cl.c:259:1: Parameter `*single->certStatus->value.revoked->revocationReason->data` 257. */ 258. 259. > int OCSP_single_get0_status(OCSP_SINGLERESP *single, int *reason, 260. ASN1_GENERALIZEDTIME **revtime, 261. ASN1_GENERALIZEDTIME **thisupd, apps/ocsp.c:1007:8: Call 1005. * know which response this refers to. 1006. */ 1007. if (!OCSP_check_validity(thisupd, nextupd, nsec, maxage)) ^ 1008. { 1009. BIO_puts(out, "WARNING: Status times invalid.\n"); crypto/ocsp/ocsp_cl.c:313:1: Parameter `*nextupd->data` 311. */ 312. 313. > int OCSP_check_validity(ASN1_GENERALIZEDTIME *thisupd, ASN1_GENERALIZEDTIME *nextupd, long nsec, long maxsec) 314. { 315. int ret = 1; apps/ocsp.c:1015:3: Call 1013. 1014. BIO_puts(out, "\tThis Update: "); 1015. ASN1_GENERALIZEDTIME_print(out, thisupd); ^ 1016. BIO_puts(out, "\n"); 1017. crypto/asn1/t_x509.c:351:1: <Offset trace> 349. }; 350. 351. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 352. { 353. char *v; crypto/asn1/t_x509.c:351:1: Parameter `*tm->data` 349. }; 350. 351. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 352. { 353. char *v; crypto/asn1/t_x509.c:368:2: Assignment 366. if ((v[i] > '9') || (v[i] < '0')) goto err; 367. y= (v[0]-'0')*1000+(v[1]-'0')*100 + (v[2]-'0')*10+(v[3]-'0'); 368. M= (v[4]-'0')*10+(v[5]-'0'); ^ 369. if ((M > 12) || (M < 1)) goto err; 370. d= (v[6]-'0')*10+(v[7]-'0'); crypto/asn1/t_x509.c:345:1: <Length trace> 343. } 344. 345. > static const char *mon[12]= 346. { 347. "Jan","Feb","Mar","Apr","May","Jun", crypto/asn1/t_x509.c:345:1: Array declaration 343. } 344. 345. > static const char *mon[12]= 346. { 347. "Jan","Feb","Mar","Apr","May","Jun", crypto/asn1/t_x509.c:389:3: Array access: Offset: [-529, +oo] Size: 12 by call to `ASN1_GENERALIZEDTIME_print` 387. 388. if (BIO_printf(bp,"%s %2d %02d:%02d:%02d%.*s %d%s", 389. mon[M-1],d,h,m,s,f_len,f,y,(gmt)?" GMT":"") <= 0) ^ 390. return(0); 391. else
https://github.com/openssl/openssl/blob/e49978dafed3f0d77eb536f20677a1f22cb0b5a7/crypto/asn1/t_x509.c/#L389
d2a_code_trace_data_41948
void avformat_free_context(AVFormatContext *s) { int i, j; AVStream *st; if (!s) return; av_opt_free(s); if (s->iformat && s->iformat->priv_class && s->priv_data) av_opt_free(s->priv_data); for (i = 0; i < s->nb_streams; i++) { st = s->streams[i]; for (j = 0; j < st->nb_side_data; j++) av_freep(&st->side_data[j].data); av_freep(&st->side_data); st->nb_side_data = 0; if (st->parser) { av_parser_close(st->parser); } if (st->attached_pic.data) av_free_packet(&st->attached_pic); av_dict_free(&st->metadata); av_freep(&st->probe_data.buf); av_free(st->index_entries); av_free(st->codec->extradata); av_free(st->codec->subtitle_header); av_free(st->codec); av_free(st->priv_data); av_free(st->info); av_free(st); } for (i = s->nb_programs - 1; i >= 0; i--) { av_dict_free(&s->programs[i]->metadata); av_freep(&s->programs[i]->stream_index); av_freep(&s->programs[i]); } av_freep(&s->programs); av_freep(&s->priv_data); while (s->nb_chapters--) { av_dict_free(&s->chapters[s->nb_chapters]->metadata); av_free(s->chapters[s->nb_chapters]); } av_freep(&s->chapters); av_dict_free(&s->metadata); av_freep(&s->streams); av_freep(&s->internal); av_free(s); } libavformat/rtsp.c:724: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `avformat_close_input`. libavformat/rtsp.c:710:17: Unknown value from: non-const function 708. if (rtsp_st) { 709. if (rtsp_st->dynamic_handler && rtsp_st->dynamic_protocol_context) 710. rtsp_st->dynamic_handler->free( ^ 711. rtsp_st->dynamic_protocol_context); 712. for (j = 0; j < rtsp_st->nb_include_source_addrs; j++) libavformat/rtsp.c:724:9: Call 722. av_free(rt->rtsp_streams); 723. if (rt->asf_ctx) { 724. avformat_close_input(&rt->asf_ctx); ^ 725. } 726. if (CONFIG_RTPDEC && rt->ts) libavformat/utils.c:2486:1: Parameter `(*ps)->nb_programs` 2484. } 2485. 2486. void avformat_close_input(AVFormatContext **ps) ^ 2487. { 2488. AVFormatContext *s = *ps; libavformat/utils.c:2501:5: Call 2499. s->iformat->read_close(s); 2500. 2501. avformat_free_context(s); ^ 2502. 2503. *ps = NULL; libavformat/utils.c:2432:1: <LHS trace> 2430. } 2431. 2432. void avformat_free_context(AVFormatContext *s) ^ 2433. { 2434. int i, j; libavformat/utils.c:2432:1: Parameter `s->nb_programs` 2430. } 2431. 2432. void avformat_free_context(AVFormatContext *s) ^ 2433. { 2434. int i, j; libavformat/utils.c:2468:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avformat_close_input` 2466. av_free(st); 2467. } 2468. for (i = s->nb_programs - 1; i >= 0; i--) { ^ 2469. av_dict_free(&s->programs[i]->metadata); 2470. av_freep(&s->programs[i]->stream_index);
https://github.com/libav/libav/blob/b72727a5248f1ef02db99b378dce1eb48a46357a/libavformat/utils.c/#L2468
d2a_code_trace_data_41949
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 **)OPENSSL_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_clnt.c:234: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `ssl3_check_cert_and_algorithm`. Showing all 17 steps of the trace ssl/s3_clnt.c:227:8: Call 225. case SSL3_ST_CR_KEY_EXCH_A: 226. case SSL3_ST_CR_KEY_EXCH_B: 227. ret=ssl3_get_key_exchange(s); ^ 228. if (ret <= 0) goto end; 229. s->state=SSL3_ST_CR_CERT_REQ_A; ssl/s3_clnt.c:889:4: Call 887. /* use same message size as in ssl3_get_certificate_request() 888. * as ServerKeyExchange message may be skipped */ 889. n=ssl3_get_message(s, ^ 890. SSL3_ST_CR_KEY_EXCH_A, 891. SSL3_ST_CR_KEY_EXCH_B, ssl/s3_both.c:337:1: Parameter `s->ctx->sessions->p` 335. * the body is read in state 'stn'. 336. */ 337. > long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok) 338. { 339. unsigned char *p; ssl/s3_clnt.c:234:9: Call 232. /* at this point we check that we have the 233. * required stuff from the server */ 234. if (!ssl3_check_cert_and_algorithm(s)) ^ 235. { 236. ret= -1; ssl/s3_clnt.c:1792:1: Parameter `s->ctx->sessions->p` 1790. #define has_bits(i,m) (((i)&(m)) == (m)) 1791. 1792. > static int ssl3_check_cert_and_algorithm(SSL *s) 1793. { 1794. int i,idx; ssl/s3_clnt.c:1909:2: Call 1907. return(1); 1908. f_err: 1909. ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_HANDSHAKE_FAILURE); ^ 1910. err: 1911. return(0); ssl/s3_pkt.c:1155:1: Parameter `s->ctx->sessions->p` 1153. } 1154. 1155. > void ssl3_send_alert(SSL *s, int level, int desc) 1156. { 1157. /* Map tls/ssl alert value to correct one */ ssl/s3_pkt.c:1162:3: Call 1160. /* If a fatal one, remove from cache */ 1161. if ((level == 2) && (s->session != NULL)) 1162. SSL_CTX_remove_session(s->ctx,s->session); ^ 1163. 1164. s->s3->alert_dispatch=1; ssl/ssl_sess.c:468:1: Parameter `ctx->sessions->p` 466. } 467. 468. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 469. { 470. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:470:9: Call 468. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 469. { 470. return remove_session_lock(ctx, c, 1); ^ 471. } 472. ssl/ssl_sess.c:473:1: Parameter `ctx->sessions->p` 471. } 472. 473. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 474. { 475. SSL_SESSION *r; ssl/ssl_sess.c:481:20: Call 479. { 480. if(lck) CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX); 481. r=(SSL_SESSION *)lh_delete(ctx->sessions,c); ^ 482. if (r != NULL) 483. { crypto/lhash/lhash.c:217:1: Parameter `lh->pmax` 215. } 216. 217. > void *lh_delete(LHASH *lh, const 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((void *)ret); crypto/lhash/lhash.c:361:1: <LHS trace> 359. } 360. 361. > static void contract(LHASH *lh) 362. { 363. LHASH_NODE **n,*n1,*np; crypto/lhash/lhash.c:361:1: Parameter `lh->p` 359. } 360. 361. > static void contract(LHASH *lh) 362. { 363. LHASH_NODE **n,*n1,*np; crypto/lhash/lhash.c:365:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `ssl3_check_cert_and_algorithm` 363. LHASH_NODE **n,*n1,*np; 364. 365. np=lh->b[lh->p+lh->pmax-1]; ^ 366. lh->b[lh->p+lh->pmax-1]=NULL; /* 24/07-92 - eay - weird but :-( */ 367. if (lh->p == 0)
https://github.com/openssl/openssl/blob/9e09eebf94c933686077a1b1b2d60248acb9ba67/crypto/lhash/lhash.c/#L365
d2a_code_trace_data_41950
static int encode_thread(AVCodecContext *c, void *arg){ MpegEncContext *s= arg; int mb_x, mb_y, pdif = 0; int i, j; MpegEncContext best_s, backup_s; uint8_t bit_buf[2][MAX_MB_BYTES]; uint8_t bit_buf2[2][MAX_MB_BYTES]; uint8_t bit_buf_tex[2][MAX_MB_BYTES]; PutBitContext pb[2], pb2[2], tex_pb[2]; ff_check_alignment(); for(i=0; i<2; i++){ init_put_bits(&pb [i], bit_buf [i], MAX_MB_BYTES); init_put_bits(&pb2 [i], bit_buf2 [i], MAX_MB_BYTES); init_put_bits(&tex_pb[i], bit_buf_tex[i], MAX_MB_BYTES); } s->last_bits= put_bits_count(&s->pb); s->mv_bits=0; s->misc_bits=0; s->i_tex_bits=0; s->p_tex_bits=0; s->i_count=0; s->f_count=0; s->b_count=0; s->skip_count=0; for(i=0; i<3; i++){ s->last_dc[i] = 128 << s->intra_dc_precision; s->current_picture.error[i] = 0; } s->mb_skip_run = 0; memset(s->last_mv, 0, sizeof(s->last_mv)); s->last_mv_dir = 0; switch(s->codec_id){ case CODEC_ID_H263: case CODEC_ID_H263P: case CODEC_ID_FLV1: if (ENABLE_H263_ENCODER || ENABLE_H263P_ENCODER || ENABLE_FLV_ENCODER) s->gob_index = ff_h263_get_gob_height(s); break; case CODEC_ID_MPEG4: if(ENABLE_MPEG4_ENCODER && s->partitioned_frame) ff_mpeg4_init_partitions(s); break; } s->resync_mb_x=0; s->resync_mb_y=0; s->first_slice_line = 1; s->ptr_lastgob = s->pb.buf; for(mb_y= s->start_mb_y; mb_y < s->end_mb_y; mb_y++) { s->mb_x=0; s->mb_y= mb_y; ff_set_qscale(s, s->qscale); ff_init_block_index(s); for(mb_x=0; mb_x < s->mb_width; mb_x++) { int xy= mb_y*s->mb_stride + mb_x; int mb_type= s->mb_type[xy]; int dmin= INT_MAX; int dir; if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < MAX_MB_BYTES){ av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); return -1; } if(s->data_partitioning){ if( s->pb2 .buf_end - s->pb2 .buf - (put_bits_count(&s-> pb2)>>3) < MAX_MB_BYTES || s->tex_pb.buf_end - s->tex_pb.buf - (put_bits_count(&s->tex_pb )>>3) < MAX_MB_BYTES){ av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n"); return -1; } } s->mb_x = mb_x; s->mb_y = mb_y; ff_update_block_index(s); if(ENABLE_H261_ENCODER && s->codec_id == CODEC_ID_H261){ ff_h261_reorder_mb_index(s); xy= s->mb_y*s->mb_stride + s->mb_x; mb_type= s->mb_type[xy]; } if(s->rtp_mode){ int current_packet_size, is_gob_start; current_packet_size= ((put_bits_count(&s->pb)+7)>>3) - (s->ptr_lastgob - s->pb.buf); is_gob_start= s->avctx->rtp_payload_size && current_packet_size >= s->avctx->rtp_payload_size && mb_y + mb_x>0; if(s->start_mb_y == mb_y && mb_y > 0 && mb_x==0) is_gob_start=1; switch(s->codec_id){ case CODEC_ID_H263: case CODEC_ID_H263P: if(!s->h263_slice_structured) if(s->mb_x || s->mb_y%s->gob_index) is_gob_start=0; break; case CODEC_ID_MPEG2VIDEO: if(s->mb_x==0 && s->mb_y!=0) is_gob_start=1; case CODEC_ID_MPEG1VIDEO: if(s->mb_skip_run) is_gob_start=0; break; } if(is_gob_start){ if(s->start_mb_y != mb_y || mb_x!=0){ write_slice_end(s); if(ENABLE_MPEG4_ENCODER && s->codec_id==CODEC_ID_MPEG4 && s->partitioned_frame){ ff_mpeg4_init_partitions(s); } } assert((put_bits_count(&s->pb)&7) == 0); current_packet_size= pbBufPtr(&s->pb) - s->ptr_lastgob; if(s->avctx->error_rate && s->resync_mb_x + s->resync_mb_y > 0){ int r= put_bits_count(&s->pb)/8 + s->picture_number + 16 + s->mb_x + s->mb_y; int d= 100 / s->avctx->error_rate; if(r % d == 0){ current_packet_size=0; #ifndef ALT_BITSTREAM_WRITER s->pb.buf_ptr= s->ptr_lastgob; #endif assert(pbBufPtr(&s->pb) == s->ptr_lastgob); } } if (s->avctx->rtp_callback){ int number_mb = (mb_y - s->resync_mb_y)*s->mb_width + mb_x - s->resync_mb_x; s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, current_packet_size, number_mb); } switch(s->codec_id){ case CODEC_ID_MPEG4: if (ENABLE_MPEG4_ENCODER) { ff_mpeg4_encode_video_packet_header(s); ff_mpeg4_clean_buffers(s); } break; case CODEC_ID_MPEG1VIDEO: case CODEC_ID_MPEG2VIDEO: if (ENABLE_MPEG1VIDEO_ENCODER || ENABLE_MPEG2VIDEO_ENCODER) { ff_mpeg1_encode_slice_header(s); ff_mpeg1_clean_buffers(s); } break; case CODEC_ID_H263: case CODEC_ID_H263P: if (ENABLE_H263_ENCODER || ENABLE_H263P_ENCODER) h263_encode_gob_header(s, mb_y); break; } if(s->flags&CODEC_FLAG_PASS1){ int bits= put_bits_count(&s->pb); s->misc_bits+= bits - s->last_bits; s->last_bits= bits; } s->ptr_lastgob += current_packet_size; s->first_slice_line=1; s->resync_mb_x=mb_x; s->resync_mb_y=mb_y; } } if( (s->resync_mb_x == s->mb_x) && s->resync_mb_y+1 == s->mb_y){ s->first_slice_line=0; } s->mb_skipped=0; s->dquant=0; if(mb_type & (mb_type-1) || (s->flags & CODEC_FLAG_QP_RD)){ int next_block=0; int pb_bits_count, pb2_bits_count, tex_pb_bits_count; copy_context_before_encode(&backup_s, s, -1); backup_s.pb= s->pb; best_s.data_partitioning= s->data_partitioning; best_s.partitioned_frame= s->partitioned_frame; if(s->data_partitioning){ backup_s.pb2= s->pb2; backup_s.tex_pb= s->tex_pb; } if(mb_type&CANDIDATE_MB_TYPE_INTER){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = s->p_mv_table[xy][0]; s->mv[0][0][1] = s->p_mv_table[xy][1]; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER, pb, pb2, tex_pb, &dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]); } if(mb_type&CANDIDATE_MB_TYPE_INTER_I){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(i=0; i<2; i++){ j= s->field_select[0][i] = s->p_field_select_table[i][xy]; s->mv[0][i][0] = s->p_field_mv_table[i][j][xy][0]; s->mv[0][i][1] = s->p_field_mv_table[i][j][xy][1]; } encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER_I, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(mb_type&CANDIDATE_MB_TYPE_SKIPPED){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = 0; s->mv[0][0][1] = 0; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_SKIPPED, pb, pb2, tex_pb, &dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]); } if(mb_type&CANDIDATE_MB_TYPE_INTER4V){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_8X8; s->mb_intra= 0; for(i=0; i<4; i++){ s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0]; s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1]; } encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER4V, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(mb_type&CANDIDATE_MB_TYPE_FORWARD){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = s->b_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_forw_mv_table[xy][1]; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_FORWARD, pb, pb2, tex_pb, &dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]); } if(mb_type&CANDIDATE_MB_TYPE_BACKWARD){ s->mv_dir = MV_DIR_BACKWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[1][0][0] = s->b_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_back_mv_table[xy][1]; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BACKWARD, pb, pb2, tex_pb, &dmin, &next_block, s->mv[1][0][0], s->mv[1][0][1]); } if(mb_type&CANDIDATE_MB_TYPE_BIDIR){ s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mv_type = MV_TYPE_16X16; s->mb_intra= 0; s->mv[0][0][0] = s->b_bidir_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_bidir_forw_mv_table[xy][1]; s->mv[1][0][0] = s->b_bidir_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_bidir_back_mv_table[xy][1]; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BIDIR, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(mb_type&CANDIDATE_MB_TYPE_FORWARD_I){ s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(i=0; i<2; i++){ j= s->field_select[0][i] = s->b_field_select_table[0][i][xy]; s->mv[0][i][0] = s->b_field_mv_table[0][i][j][xy][0]; s->mv[0][i][1] = s->b_field_mv_table[0][i][j][xy][1]; } encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_FORWARD_I, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(mb_type&CANDIDATE_MB_TYPE_BACKWARD_I){ s->mv_dir = MV_DIR_BACKWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(i=0; i<2; i++){ j= s->field_select[1][i] = s->b_field_select_table[1][i][xy]; s->mv[1][i][0] = s->b_field_mv_table[1][i][j][xy][0]; s->mv[1][i][1] = s->b_field_mv_table[1][i][j][xy][1]; } encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BACKWARD_I, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(mb_type&CANDIDATE_MB_TYPE_BIDIR_I){ s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(dir=0; dir<2; dir++){ for(i=0; i<2; i++){ j= s->field_select[dir][i] = s->b_field_select_table[dir][i][xy]; s->mv[dir][i][0] = s->b_field_mv_table[dir][i][j][xy][0]; s->mv[dir][i][1] = s->b_field_mv_table[dir][i][j][xy][1]; } } encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BIDIR_I, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(mb_type&CANDIDATE_MB_TYPE_INTRA){ s->mv_dir = 0; s->mv_type = MV_TYPE_16X16; s->mb_intra= 1; s->mv[0][0][0] = 0; s->mv[0][0][1] = 0; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTRA, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); if(s->h263_pred || s->h263_aic){ if(best_s.mb_intra) s->mbintra_table[mb_x + mb_y*s->mb_stride]=1; else ff_clean_intra_table_entries(s); } } if((s->flags & CODEC_FLAG_QP_RD) && dmin < INT_MAX){ if(best_s.mv_type==MV_TYPE_16X16){ const int last_qp= backup_s.qscale; int qpi, qp, dc[6]; DCTELEM ac[6][16]; const int mvdir= (best_s.mv_dir&MV_DIR_BACKWARD) ? 1 : 0; static const int dquant_tab[4]={-1,1,-2,2}; assert(backup_s.dquant == 0); s->mv_dir= best_s.mv_dir; s->mv_type = MV_TYPE_16X16; s->mb_intra= best_s.mb_intra; s->mv[0][0][0] = best_s.mv[0][0][0]; s->mv[0][0][1] = best_s.mv[0][0][1]; s->mv[1][0][0] = best_s.mv[1][0][0]; s->mv[1][0][1] = best_s.mv[1][0][1]; qpi = s->pict_type == FF_B_TYPE ? 2 : 0; for(; qpi<4; qpi++){ int dquant= dquant_tab[qpi]; qp= last_qp + dquant; if(qp < s->avctx->qmin || qp > s->avctx->qmax) continue; backup_s.dquant= dquant; if(s->mb_intra && s->dc_val[0]){ for(i=0; i<6; i++){ dc[i]= s->dc_val[0][ s->block_index[i] ]; memcpy(ac[i], s->ac_val[0][s->block_index[i]], sizeof(DCTELEM)*16); } } encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER , pb, pb2, tex_pb, &dmin, &next_block, s->mv[mvdir][0][0], s->mv[mvdir][0][1]); if(best_s.qscale != qp){ if(s->mb_intra && s->dc_val[0]){ for(i=0; i<6; i++){ s->dc_val[0][ s->block_index[i] ]= dc[i]; memcpy(s->ac_val[0][s->block_index[i]], ac[i], sizeof(DCTELEM)*16); } } } } } } if(ENABLE_MPEG4_ENCODER && mb_type&CANDIDATE_MB_TYPE_DIRECT){ int mx= s->b_direct_mv_table[xy][0]; int my= s->b_direct_mv_table[xy][1]; backup_s.dquant = 0; s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; s->mb_intra= 0; ff_mpeg4_set_direct_mv(s, mx, my); encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_DIRECT, pb, pb2, tex_pb, &dmin, &next_block, mx, my); } if(ENABLE_MPEG4_ENCODER && mb_type&CANDIDATE_MB_TYPE_DIRECT0){ backup_s.dquant = 0; s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT; s->mb_intra= 0; ff_mpeg4_set_direct_mv(s, 0, 0); encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_DIRECT, pb, pb2, tex_pb, &dmin, &next_block, 0, 0); } if(!best_s.mb_intra && s->flags2&CODEC_FLAG2_SKIP_RD){ int coded=0; for(i=0; i<6; i++) coded |= s->block_last_index[i]; if(coded){ int mx,my; memcpy(s->mv, best_s.mv, sizeof(s->mv)); if(ENABLE_MPEG4_ENCODER && best_s.mv_dir & MV_DIRECT){ mx=my=0; ff_mpeg4_set_direct_mv(s, mx, my); }else if(best_s.mv_dir&MV_DIR_BACKWARD){ mx= s->mv[1][0][0]; my= s->mv[1][0][1]; }else{ mx= s->mv[0][0][0]; my= s->mv[0][0][1]; } s->mv_dir= best_s.mv_dir; s->mv_type = best_s.mv_type; s->mb_intra= 0; backup_s.dquant= 0; s->skipdct=1; encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER , pb, pb2, tex_pb, &dmin, &next_block, mx, my); s->skipdct=0; } } s->current_picture.qscale_table[xy]= best_s.qscale; copy_context_after_encode(s, &best_s, -1); pb_bits_count= put_bits_count(&s->pb); flush_put_bits(&s->pb); ff_copy_bits(&backup_s.pb, bit_buf[next_block^1], pb_bits_count); s->pb= backup_s.pb; if(s->data_partitioning){ pb2_bits_count= put_bits_count(&s->pb2); flush_put_bits(&s->pb2); ff_copy_bits(&backup_s.pb2, bit_buf2[next_block^1], pb2_bits_count); s->pb2= backup_s.pb2; tex_pb_bits_count= put_bits_count(&s->tex_pb); flush_put_bits(&s->tex_pb); ff_copy_bits(&backup_s.tex_pb, bit_buf_tex[next_block^1], tex_pb_bits_count); s->tex_pb= backup_s.tex_pb; } s->last_bits= put_bits_count(&s->pb); if (ENABLE_ANY_H263_ENCODER && s->out_format == FMT_H263 && s->pict_type!=FF_B_TYPE) ff_h263_update_motion_val(s); if(next_block==0){ s->dsp.put_pixels_tab[0][0](s->dest[0], s->rd_scratchpad , s->linesize ,16); s->dsp.put_pixels_tab[1][0](s->dest[1], s->rd_scratchpad + 16*s->linesize , s->uvlinesize, 8); s->dsp.put_pixels_tab[1][0](s->dest[2], s->rd_scratchpad + 16*s->linesize + 8, s->uvlinesize, 8); } if(s->avctx->mb_decision == FF_MB_DECISION_BITS) MPV_decode_mb(s, s->block); } else { int motion_x = 0, motion_y = 0; s->mv_type=MV_TYPE_16X16; switch(mb_type){ case CANDIDATE_MB_TYPE_INTRA: s->mv_dir = 0; s->mb_intra= 1; motion_x= s->mv[0][0][0] = 0; motion_y= s->mv[0][0][1] = 0; break; case CANDIDATE_MB_TYPE_INTER: s->mv_dir = MV_DIR_FORWARD; s->mb_intra= 0; motion_x= s->mv[0][0][0] = s->p_mv_table[xy][0]; motion_y= s->mv[0][0][1] = s->p_mv_table[xy][1]; break; case CANDIDATE_MB_TYPE_INTER_I: s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(i=0; i<2; i++){ j= s->field_select[0][i] = s->p_field_select_table[i][xy]; s->mv[0][i][0] = s->p_field_mv_table[i][j][xy][0]; s->mv[0][i][1] = s->p_field_mv_table[i][j][xy][1]; } break; case CANDIDATE_MB_TYPE_INTER4V: s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_8X8; s->mb_intra= 0; for(i=0; i<4; i++){ s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0]; s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1]; } break; case CANDIDATE_MB_TYPE_DIRECT: if (ENABLE_MPEG4_ENCODER) { s->mv_dir = MV_DIR_FORWARD|MV_DIR_BACKWARD|MV_DIRECT; s->mb_intra= 0; motion_x=s->b_direct_mv_table[xy][0]; motion_y=s->b_direct_mv_table[xy][1]; ff_mpeg4_set_direct_mv(s, motion_x, motion_y); } break; case CANDIDATE_MB_TYPE_DIRECT0: if (ENABLE_MPEG4_ENCODER) { s->mv_dir = MV_DIR_FORWARD|MV_DIR_BACKWARD|MV_DIRECT; s->mb_intra= 0; ff_mpeg4_set_direct_mv(s, 0, 0); } break; case CANDIDATE_MB_TYPE_BIDIR: s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mb_intra= 0; s->mv[0][0][0] = s->b_bidir_forw_mv_table[xy][0]; s->mv[0][0][1] = s->b_bidir_forw_mv_table[xy][1]; s->mv[1][0][0] = s->b_bidir_back_mv_table[xy][0]; s->mv[1][0][1] = s->b_bidir_back_mv_table[xy][1]; break; case CANDIDATE_MB_TYPE_BACKWARD: s->mv_dir = MV_DIR_BACKWARD; s->mb_intra= 0; motion_x= s->mv[1][0][0] = s->b_back_mv_table[xy][0]; motion_y= s->mv[1][0][1] = s->b_back_mv_table[xy][1]; break; case CANDIDATE_MB_TYPE_FORWARD: s->mv_dir = MV_DIR_FORWARD; s->mb_intra= 0; motion_x= s->mv[0][0][0] = s->b_forw_mv_table[xy][0]; motion_y= s->mv[0][0][1] = s->b_forw_mv_table[xy][1]; break; case CANDIDATE_MB_TYPE_FORWARD_I: s->mv_dir = MV_DIR_FORWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(i=0; i<2; i++){ j= s->field_select[0][i] = s->b_field_select_table[0][i][xy]; s->mv[0][i][0] = s->b_field_mv_table[0][i][j][xy][0]; s->mv[0][i][1] = s->b_field_mv_table[0][i][j][xy][1]; } break; case CANDIDATE_MB_TYPE_BACKWARD_I: s->mv_dir = MV_DIR_BACKWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(i=0; i<2; i++){ j= s->field_select[1][i] = s->b_field_select_table[1][i][xy]; s->mv[1][i][0] = s->b_field_mv_table[1][i][j][xy][0]; s->mv[1][i][1] = s->b_field_mv_table[1][i][j][xy][1]; } break; case CANDIDATE_MB_TYPE_BIDIR_I: s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD; s->mv_type = MV_TYPE_FIELD; s->mb_intra= 0; for(dir=0; dir<2; dir++){ for(i=0; i<2; i++){ j= s->field_select[dir][i] = s->b_field_select_table[dir][i][xy]; s->mv[dir][i][0] = s->b_field_mv_table[dir][i][j][xy][0]; s->mv[dir][i][1] = s->b_field_mv_table[dir][i][j][xy][1]; } } break; default: av_log(s->avctx, AV_LOG_ERROR, "illegal MB type\n"); } encode_mb(s, motion_x, motion_y); s->last_mv_dir = s->mv_dir; if (ENABLE_ANY_H263_ENCODER && s->out_format == FMT_H263 && s->pict_type!=FF_B_TYPE) ff_h263_update_motion_val(s); MPV_decode_mb(s, s->block); } if(s->mb_intra ){ s->p_mv_table[xy][0]=0; s->p_mv_table[xy][1]=0; } if(s->flags&CODEC_FLAG_PSNR){ int w= 16; int h= 16; if(s->mb_x*16 + 16 > s->width ) w= s->width - s->mb_x*16; if(s->mb_y*16 + 16 > s->height) h= s->height- s->mb_y*16; s->current_picture.error[0] += sse( s, s->new_picture.data[0] + s->mb_x*16 + s->mb_y*s->linesize*16, s->dest[0], w, h, s->linesize); s->current_picture.error[1] += sse( s, s->new_picture.data[1] + s->mb_x*8 + s->mb_y*s->uvlinesize*8, s->dest[1], w>>1, h>>1, s->uvlinesize); s->current_picture.error[2] += sse( s, s->new_picture .data[2] + s->mb_x*8 + s->mb_y*s->uvlinesize*8, s->dest[2], w>>1, h>>1, s->uvlinesize); } if(s->loop_filter){ if(ENABLE_ANY_H263_ENCODER && s->out_format == FMT_H263) ff_h263_loop_filter(s); } } } if (ENABLE_MSMPEG4_ENCODER && s->msmpeg4_version && s->msmpeg4_version<4 && s->pict_type == FF_I_TYPE) msmpeg4_encode_ext_header(s); write_slice_end(s); if (s->avctx->rtp_callback) { int number_mb = (mb_y - s->resync_mb_y)*s->mb_width - s->resync_mb_x; pdif = pbBufPtr(&s->pb) - s->ptr_lastgob; emms_c(); s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, pdif, number_mb); } return 0; } libavcodec/mpegvideo_enc.c:2398: error: Uninitialized Value The value read from best_s.mb_intra was never initialized. libavcodec/mpegvideo_enc.c:2398:21: 2396. &dmin, &next_block, 0, 0); 2397. } 2398. if(!best_s.mb_intra && s->flags2&CODEC_FLAG2_SKIP_RD){ ^ 2399. int coded=0; 2400. for(i=0; i<6; i++)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo_enc.c/#L2398
d2a_code_trace_data_41951
void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s, const uint8_t *buffer) { GetBitContext gb; init_get_bits(&gb, buffer, FLAC_STREAMINFO_SIZE*8); skip_bits(&gb, 16); s->max_blocksize = get_bits(&gb, 16); if (s->max_blocksize < 16) { av_log(avctx, AV_LOG_WARNING, "invalid max blocksize: %d\n", s->max_blocksize); s->max_blocksize = 16; } skip_bits(&gb, 24); s->max_framesize = get_bits_long(&gb, 24); s->samplerate = get_bits_long(&gb, 20); s->channels = get_bits(&gb, 3) + 1; s->bps = get_bits(&gb, 5) + 1; avctx->channels = s->channels; avctx->sample_rate = s->samplerate; avctx->bits_per_raw_sample = s->bps; if (s->bps > 16) avctx->sample_fmt = SAMPLE_FMT_S32; else avctx->sample_fmt = SAMPLE_FMT_S16; s->samples = get_bits_long(&gb, 32) << 4; s->samples |= get_bits(&gb, 4); skip_bits_long(&gb, 64); skip_bits_long(&gb, 64); dump_headers(avctx, s); } libavcodec/flacdec.c:190: error: Null Dereference pointer `&gb->buffer` last assigned on line 188 could be null and is dereferenced by call to `skip_bits()` at line 190, column 5. libavcodec/flacdec.c:184:1: start of procedure ff_flac_parse_streaminfo() 182. } 183. 184. void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s, ^ 185. const uint8_t *buffer) 186. { libavcodec/flacdec.c:188:5: 186. { 187. GetBitContext gb; 188. init_get_bits(&gb, buffer, FLAC_STREAMINFO_SIZE*8); ^ 189. 190. skip_bits(&gb, 16); /* skip min blocksize */ libavcodec/bitstream.h:743:1: start of procedure init_get_bits() 741. * @param bit_size the size of the buffer in bits 742. */ 743. static inline void init_get_bits(GetBitContext *s, ^ 744. const uint8_t *buffer, int bit_size) 745. { libavcodec/bitstream.h:746:5: 744. const uint8_t *buffer, int bit_size) 745. { 746. int buffer_size= (bit_size+7)>>3; ^ 747. if(buffer_size < 0 || bit_size < 0) { 748. buffer_size = bit_size = 0; libavcodec/bitstream.h:747:8: Taking true branch 745. { 746. int buffer_size= (bit_size+7)>>3; 747. if(buffer_size < 0 || bit_size < 0) { ^ 748. buffer_size = bit_size = 0; 749. buffer = NULL; libavcodec/bitstream.h:748:9: 746. int buffer_size= (bit_size+7)>>3; 747. if(buffer_size < 0 || bit_size < 0) { 748. buffer_size = bit_size = 0; ^ 749. buffer = NULL; 750. } libavcodec/bitstream.h:749:9: 747. if(buffer_size < 0 || bit_size < 0) { 748. buffer_size = bit_size = 0; 749. buffer = NULL; ^ 750. } 751. libavcodec/bitstream.h:752:5: 750. } 751. 752. s->buffer= buffer; ^ 753. s->size_in_bits= bit_size; 754. s->buffer_end= buffer + buffer_size; libavcodec/bitstream.h:753:5: 751. 752. s->buffer= buffer; 753. s->size_in_bits= bit_size; ^ 754. s->buffer_end= buffer + buffer_size; 755. #ifdef ALT_BITSTREAM_READER libavcodec/bitstream.h:754:5: 752. s->buffer= buffer; 753. s->size_in_bits= bit_size; 754. s->buffer_end= buffer + buffer_size; ^ 755. #ifdef ALT_BITSTREAM_READER 756. s->index=0; libavcodec/bitstream.h:756:5: 754. s->buffer_end= buffer + buffer_size; 755. #ifdef ALT_BITSTREAM_READER 756. s->index=0; ^ 757. #elif defined LIBMPEG2_BITSTREAM_READER 758. s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1)); libavcodec/bitstream.h:766:1: return from a call to init_get_bits 764. skip_bits_long(s, 0); 765. #endif 766. } ^ 767. 768. static inline void align_get_bits(GetBitContext *s) libavcodec/flacdec.c:190:5: 188. init_get_bits(&gb, buffer, FLAC_STREAMINFO_SIZE*8); 189. 190. skip_bits(&gb, 16); /* skip min blocksize */ ^ 191. s->max_blocksize = get_bits(&gb, 16); 192. if (s->max_blocksize < 16) { libavcodec/bitstream.h:658:1: start of procedure skip_bits() 656. } 657. 658. static inline void skip_bits(GetBitContext *s, int n){ ^ 659. //Note gcc seems to optimize this to s->index+=n for the ALT_READER :)) 660. OPEN_READER(re, s) libavcodec/bitstream.h:660:5: 658. static inline void skip_bits(GetBitContext *s, int n){ 659. //Note gcc seems to optimize this to s->index+=n for the ALT_READER :)) 660. OPEN_READER(re, s) ^ 661. UPDATE_CACHE(re, s) 662. LAST_SKIP_BITS(re, s, n) libavcodec/bitstream.h:661:5: 659. //Note gcc seems to optimize this to s->index+=n for the ALT_READER :)) 660. OPEN_READER(re, s) 661. UPDATE_CACHE(re, s) ^ 662. LAST_SKIP_BITS(re, s, n) 663. CLOSE_READER(re, s)
https://github.com/libav/libav/blob/184bc53db4fded8857af09cee2adc7197940deb7/libavcodec/flacdec.c/#L190
d2a_code_trace_data_41952
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ecp_smpl.c:595: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_inverse`. Showing all 23 steps of the trace crypto/ec/ecp_smpl.c:534:1: Parameter `ctx->stack.depth` 532. } 533. 534. > int ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP *group, 535. const EC_POINT *point, 536. BIGNUM *x, BIGNUM *y, crypto/ec/ecp_smpl.c:556:5: Call 554. } 555. 556. BN_CTX_start(ctx); ^ 557. Z = BN_CTX_get(ctx); 558. Z_1 = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/ec/ecp_smpl.c:595:14: Call 593. } 594. } else { 595. if (!BN_mod_inverse(Z_1, Z_, group->field, ctx)) { ^ 596. ECerr(EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES, 597. ERR_R_BN_LIB); crypto/bn/bn_gcd.c:226:1: Parameter `ctx->stack.depth` 224. BN_CTX *ctx); 225. 226. > BIGNUM *BN_mod_inverse(BIGNUM *in, 227. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 228. { crypto/bn/bn_gcd.c:231:10: Call 229. BIGNUM *rv; 230. int noinv; 231. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv); ^ 232. if (noinv) 233. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); crypto/bn/bn_gcd.c:237:1: Parameter `ctx->stack.depth` 235. } 236. 237. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 238. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 239. int *pnoinv) crypto/bn/bn_gcd.c:250:16: Call 248. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) 249. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) { 250. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 251. } 252. crypto/bn/bn_gcd.c:557:1: Parameter `ctx->stack.depth` 555. * not contain branches that may leak sensitive information. 556. */ 557. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 558. const BIGNUM *a, const BIGNUM *n, 559. BN_CTX *ctx) crypto/bn/bn_gcd.c:568:5: Call 566. bn_check_top(n); 567. 568. BN_CTX_start(ctx); ^ 569. A = BN_CTX_get(ctx); 570. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gcd.c:603:18: Call 601. BN_init(&local_B); 602. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME); 603. if (!BN_nnmod(B, &local_B, A, ctx)) ^ 604. goto err; 605. /* Ensure local_B goes out of scope before any further use of B */ crypto/bn/bn_mod.c:119:1: Parameter `ctx->stack.depth` 117. #include "bn_lcl.h" 118. 119. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 120. { 121. /* crypto/bn/bn_mod.c:126:11: Call 124. */ 125. 126. if (!(BN_mod(r, m, d, ctx))) ^ 127. return 0; 128. if (!r->neg) crypto/bn/bn_div.c:189:1: Parameter `ctx->stack.depth` 187. * If 'dv' or 'rm' is NULL, the respective value is not returned. 188. */ 189. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 190. BN_CTX *ctx) 191. { crypto/bn/bn_div.c:242:5: Call 240. } 241. 242. BN_CTX_start(ctx); ^ 243. tmp = BN_CTX_get(ctx); 244. snum = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:469:5: Call 467. if (no_branch) 468. bn_correct_top(res); 469. BN_CTX_end(ctx); ^ 470. return (1); 471. err: crypto/bn/bn_ctx.c:250:1: Parameter `ctx->stack.depth` 248. } 249. 250. > void BN_CTX_end(BN_CTX *ctx) 251. { 252. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:256:27: Call 254. ctx->err_stack--; 255. else { 256. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 257. /* Does this stack frame have anything to release? */ 258. if (fp < ctx->used) crypto/bn/bn_ctx.c:326:1: <LHS trace> 324. } 325. 326. > static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:326:1: Parameter `st->depth` 324. } 325. 326. > static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:328:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_inverse` 326. static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; ^ 329. } 330.
https://github.com/openssl/openssl/blob/e113c9c59dcb419dd00525cec431edb854a6c897/crypto/bn/bn_ctx.c/#L328
d2a_code_trace_data_41953
static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr, int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], int ref_mv_scale, int flags, int size, int h) { MotionEstContext * const c= &s->me; int best[2]={0, 0}; int d; int dmin; int map_generation; int penalty_factor; const int ref_mv_stride= s->mb_stride; const int ref_mv_xy= s->mb_x + s->mb_y*ref_mv_stride; me_cmp_func cmpf, chroma_cmpf; LOAD_COMMON LOAD_COMMON2 if(c->pre_pass){ penalty_factor= c->pre_penalty_factor; cmpf= s->dsp.me_pre_cmp[size]; chroma_cmpf= s->dsp.me_pre_cmp[size+1]; }else{ penalty_factor= c->penalty_factor; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; } map_generation= update_map_generation(c); assert(cmpf); dmin= cmp(s, 0, 0, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags); map[0]= map_generation; score_map[0]= dmin; if((s->pict_type == FF_B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0) dmin += (mv_penalty[pred_x] + mv_penalty[pred_y])*penalty_factor; if (s->first_slice_line) { CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) }else{ if(dmin<((h*h*s->avctx->mv0_threshold)>>8) && ( P_LEFT[0] |P_LEFT[1] |P_TOP[0] |P_TOP[1] |P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){ *mx_ptr= 0; *my_ptr= 0; c->skip=1; return dmin; } CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift) CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift) CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) } if(dmin>h*h*4){ if(c->pre_pass){ CHECK_CLIPPED_MV((last_mv[ref_mv_xy-1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy-1][1]*ref_mv_scale + (1<<15))>>16) if(!s->first_slice_line) CHECK_CLIPPED_MV((last_mv[ref_mv_xy-ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy-ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) }else{ CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) if(s->mb_y+1<s->end_mb_y) CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) } } if(c->avctx->last_predictor_count){ const int count= c->avctx->last_predictor_count; const int xstart= FFMAX(0, s->mb_x - count); const int ystart= FFMAX(0, s->mb_y - count); const int xend= FFMIN(s->mb_width , s->mb_x + count + 1); const int yend= FFMIN(s->mb_height, s->mb_y + count + 1); int mb_y; for(mb_y=ystart; mb_y<yend; mb_y++){ int mb_x; for(mb_x=xstart; mb_x<xend; mb_x++){ const int xy= mb_x + 1 + (mb_y + 1)*ref_mv_stride; int mx= (last_mv[xy][0]*ref_mv_scale + (1<<15))>>16; int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16; if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue; CHECK_MV(mx,my) } } } dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); *mx_ptr= best[0]; *my_ptr= best[1]; return dmin; } libavcodec/motion_est_template.c:1075: error: Uninitialized Value The value read from ymin was never initialized. libavcodec/motion_est_template.c:1075:13: 1073. (last_mv[ref_mv_xy-ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) 1074. }else{ 1075. CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, ^ 1076. (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) 1077. if(s->mb_y+1<s->end_mb_y) //FIXME replace at least with last_slice_line
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1075