id
stringlengths
25
25
content
stringlengths
649
72.1k
max_stars_repo_path
stringlengths
91
133
d2a_code_trace_data_44254
static void opt_output_file(const char *filename) { AVFormatContext *oc; int use_video, use_audio, use_subtitle; int input_has_video, input_has_audio, input_has_subtitle; AVFormatParameters params, *ap = &params; if (!strcmp(filename, "-")) filename = "pipe:"; oc = avformat_alloc_context(); if (!file_oformat) { file_oformat = guess_format(NULL, filename, NULL); if (!file_oformat) { fprintf(stderr, "Unable to find a suitable output format for '%s'\n", filename); av_exit(1); } } oc->oformat = file_oformat; av_strlcpy(oc->filename, filename, sizeof(oc->filename)); if (!strcmp(file_oformat->name, "ffm") && av_strstart(filename, "http:", NULL)) { int err = read_ffserver_streams(oc, filename); if (err < 0) { print_error(filename, err); av_exit(1); } } else { use_video = file_oformat->video_codec != CODEC_ID_NONE || video_stream_copy || video_codec_name; use_audio = file_oformat->audio_codec != CODEC_ID_NONE || audio_stream_copy || audio_codec_name; use_subtitle = file_oformat->subtitle_codec != CODEC_ID_NONE || subtitle_stream_copy || subtitle_codec_name; if (nb_input_files > 0) { check_audio_video_sub_inputs(&input_has_video, &input_has_audio, &input_has_subtitle); if (!input_has_video) use_video = 0; if (!input_has_audio) use_audio = 0; if (!input_has_subtitle) use_subtitle = 0; } if (audio_disable) { use_audio = 0; } if (video_disable) { use_video = 0; } if (subtitle_disable) { use_subtitle = 0; } if (use_video) { new_video_stream(oc); } if (use_audio) { new_audio_stream(oc); } if (use_subtitle) { new_subtitle_stream(oc); } oc->timestamp = rec_timestamp; for(; metadata_count>0; metadata_count--){ av_metadata_set(&oc->metadata, metadata[metadata_count-1].key, metadata[metadata_count-1].value); } av_metadata_conv(oc, oc->oformat->metadata_conv, NULL); } output_files[nb_output_files++] = oc; if (oc->oformat->flags & AVFMT_NEEDNUMBER) { if (!av_filename_number_test(oc->filename)) { print_error(oc->filename, AVERROR_NUMEXPECTED); av_exit(1); } } if (!(oc->oformat->flags & AVFMT_NOFILE)) { if (!file_overwrite && (strchr(filename, ':') == NULL || filename[1] == ':' || av_strstart(filename, "file:", NULL))) { if (url_exist(filename)) { int c; if (!using_stdin) { fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename); fflush(stderr); c = getchar(); if (toupper(c) != 'Y') { fprintf(stderr, "Not overwriting - exiting\n"); av_exit(1); } } else { fprintf(stderr,"File '%s' already exists. Exiting.\n", filename); av_exit(1); } } } if (url_fopen(&oc->pb, filename, URL_WRONLY) < 0) { fprintf(stderr, "Could not open '%s'\n", filename); av_exit(1); } } memset(ap, 0, sizeof(*ap)); if (av_set_parameters(oc, ap) < 0) { fprintf(stderr, "%s: Invalid encoding parameters\n", oc->filename); av_exit(1); } oc->preload= (int)(mux_preload*AV_TIME_BASE); oc->max_delay= (int)(mux_max_delay*AV_TIME_BASE); oc->loop_output = loop_output; set_context_opts(oc, avformat_opts, AV_OPT_FLAG_ENCODING_PARAM); file_oformat = NULL; file_iformat = NULL; } ffmpeg.c:3271: error: Null Dereference pointer `file_oformat` last assigned on line 3260 could be null and is dereferenced at line 3271, column 17. ffmpeg.c:3247:1: start of procedure opt_output_file() 3245. } 3246. 3247. static void opt_output_file(const char *filename) ^ 3248. { 3249. AVFormatContext *oc; ffmpeg.c:3252:5: 3250. int use_video, use_audio, use_subtitle; 3251. int input_has_video, input_has_audio, input_has_subtitle; 3252. AVFormatParameters params, *ap = &params; ^ 3253. 3254. if (!strcmp(filename, "-")) ffmpeg.c:3254:10: Taking true branch 3252. AVFormatParameters params, *ap = &params; 3253. 3254. if (!strcmp(filename, "-")) ^ 3255. filename = "pipe:"; 3256. ffmpeg.c:3255:9: 3253. 3254. if (!strcmp(filename, "-")) 3255. filename = "pipe:"; ^ 3256. 3257. oc = avformat_alloc_context(); ffmpeg.c:3257:5: 3255. filename = "pipe:"; 3256. 3257. oc = avformat_alloc_context(); ^ 3258. 3259. if (!file_oformat) { libavformat/options.c:77:1: start of procedure avformat_alloc_context() 75. } 76. 77. AVFormatContext *avformat_alloc_context(void) ^ 78. { 79. AVFormatContext *ic; libavformat/options.c:80:5: 78. { 79. AVFormatContext *ic; 80. ic = av_malloc(sizeof(AVFormatContext)); ^ 81. if (!ic) return ic; 82. avformat_get_context_defaults(ic); libavutil/mem.c:47:1: start of procedure av_malloc() 45. linker will do it automatically. */ 46. 47. void *av_malloc(unsigned int size) ^ 48. { 49. void *ptr = NULL; libavutil/mem.c:49:5: 47. void *av_malloc(unsigned int size) 48. { 49. void *ptr = NULL; ^ 50. #if CONFIG_MEMALIGN_HACK 51. long diff; libavutil/mem.c:55:8: Taking false branch 53. 54. /* let's disallow possible ambiguous cases */ 55. if(size > (INT_MAX-16) ) ^ 56. return NULL; 57. libavutil/mem.c:66:9: Taking false branch 64. ((char*)ptr)[-1]= diff; 65. #elif HAVE_POSIX_MEMALIGN 66. if (posix_memalign(&ptr,16,size)) ^ 67. ptr = NULL; 68. #elif HAVE_MEMALIGN libavutil/mem.c:99:5: 97. ptr = malloc(size); 98. #endif 99. return ptr; ^ 100. } 101. libavutil/mem.c:100:1: return from a call to av_malloc 98. #endif 99. return ptr; 100. } ^ 101. 102. void *av_realloc(void *ptr, unsigned int size) libavformat/options.c:81:10: Taking false branch 79. AVFormatContext *ic; 80. ic = av_malloc(sizeof(AVFormatContext)); 81. if (!ic) return ic; ^ 82. avformat_get_context_defaults(ic); 83. ic->av_class = &av_format_context_class; libavformat/options.c:82:5: Skipping avformat_get_context_defaults(): empty list of specs 80. ic = av_malloc(sizeof(AVFormatContext)); 81. if (!ic) return ic; 82. avformat_get_context_defaults(ic); ^ 83. ic->av_class = &av_format_context_class; 84. return ic; libavformat/options.c:83:5: 81. if (!ic) return ic; 82. avformat_get_context_defaults(ic); 83. ic->av_class = &av_format_context_class; ^ 84. return ic; 85. } libavformat/options.c:84:5: 82. avformat_get_context_defaults(ic); 83. ic->av_class = &av_format_context_class; 84. return ic; ^ 85. } 86. libavformat/options.c:85:1: return from a call to avformat_alloc_context 83. ic->av_class = &av_format_context_class; 84. return ic; 85. } ^ 86. 87. #if LIBAVFORMAT_VERSION_MAJOR < 53 ffmpeg.c:3259:10: Taking true branch 3257. oc = avformat_alloc_context(); 3258. 3259. if (!file_oformat) { ^ 3260. file_oformat = guess_format(NULL, filename, NULL); 3261. if (!file_oformat) { ffmpeg.c:3260:9: Skipping guess_format(): empty list of specs 3258. 3259. if (!file_oformat) { 3260. file_oformat = guess_format(NULL, filename, NULL); ^ 3261. if (!file_oformat) { 3262. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", ffmpeg.c:3261:14: Taking true branch 3259. if (!file_oformat) { 3260. file_oformat = guess_format(NULL, filename, NULL); 3261. if (!file_oformat) { ^ 3262. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", 3263. filename); ffmpeg.c:3262:13: 3260. file_oformat = guess_format(NULL, filename, NULL); 3261. if (!file_oformat) { 3262. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", ^ 3263. filename); 3264. av_exit(1); ffmpeg.c:3264:13: Skipping av_exit(): empty list of specs 3262. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", 3263. filename); 3264. av_exit(1); ^ 3265. } 3266. } ffmpeg.c:3268:5: 3266. } 3267. 3268. oc->oformat = file_oformat; ^ 3269. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); 3270. ffmpeg.c:3269:5: 3267. 3268. oc->oformat = file_oformat; 3269. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); ^ 3270. 3271. if (!strcmp(file_oformat->name, "ffm") && libavutil/avstring.c:50:1: start of procedure av_strlcpy() 48. } 49. 50. size_t av_strlcpy(char *dst, const char *src, size_t size) ^ 51. { 52. size_t len = 0; libavutil/avstring.c:52:5: 50. size_t av_strlcpy(char *dst, const char *src, size_t size) 51. { 52. size_t len = 0; ^ 53. while (++len < size && *src) 54. *dst++ = *src++; libavutil/avstring.c:53:12: Loop condition is true. Entering loop body 51. { 52. size_t len = 0; 53. while (++len < size && *src) ^ 54. *dst++ = *src++; 55. if (len <= size) libavutil/avstring.c:53:28: Loop condition is false. Leaving loop 51. { 52. size_t len = 0; 53. while (++len < size && *src) ^ 54. *dst++ = *src++; 55. if (len <= size) libavutil/avstring.c:55:9: Taking true branch 53. while (++len < size && *src) 54. *dst++ = *src++; 55. if (len <= size) ^ 56. *dst = 0; 57. return len + strlen(src) - 1; libavutil/avstring.c:56:9: 54. *dst++ = *src++; 55. if (len <= size) 56. *dst = 0; ^ 57. return len + strlen(src) - 1; 58. } libavutil/avstring.c:57:5: 55. if (len <= size) 56. *dst = 0; 57. return len + strlen(src) - 1; ^ 58. } 59. libavutil/avstring.c:58:1: return from a call to av_strlcpy 56. *dst = 0; 57. return len + strlen(src) - 1; 58. } ^ 59. 60. size_t av_strlcat(char *dst, const char *src, size_t size) ffmpeg.c:3271:10: 3269. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); 3270. 3271. if (!strcmp(file_oformat->name, "ffm") && ^ 3272. av_strstart(filename, "http:", NULL)) { 3273. /* special case for files sent to ffserver: we get the stream
https://github.com/libav/libav/blob/9aaa2077e5879b153d2ce6bea2e42f0c349a083f/ffmpeg.c/#L3271
d2a_code_trace_data_44255
static int alac_encode_frame(AVCodecContext *avctx, uint8_t *frame, int buf_size, void *data) { AlacEncodeContext *s = avctx->priv_data; PutBitContext *pb = &s->pbctx; int i, out_bytes, verbatim_flag = 0; if(avctx->frame_size > DEFAULT_FRAME_SIZE) { av_log(avctx, AV_LOG_ERROR, "input frame size exceeded\n"); return -1; } if(buf_size < 2*s->max_coded_frame_size) { av_log(avctx, AV_LOG_ERROR, "buffer size is too small\n"); return -1; } verbatim: init_put_bits(pb, frame, buf_size); if((s->compression_level == 0) || verbatim_flag) { int16_t *samples = data; write_frame_header(s, 1); for(i=0; i<avctx->frame_size*avctx->channels; i++) { put_sbits(pb, 16, *samples++); } } else { init_sample_buffers(s, data); write_frame_header(s, 0); write_compressed_frame(s); } put_bits(pb, 3, 7); flush_put_bits(pb); out_bytes = put_bits_count(pb) >> 3; if(out_bytes > s->max_coded_frame_size) { if(verbatim_flag || (s->compression_level == 0)) { av_log(avctx, AV_LOG_ERROR, "error encoding frame\n"); return -1; } verbatim_flag = 1; goto verbatim; } return out_bytes; } libavcodec/alacenc.c:486: error: Null Dereference pointer `s->pbctx.buf_ptr` last assigned on line 481 could be null and is dereferenced by call to `write_frame_header()` at line 486, column 9. libavcodec/alacenc.c:463:1: start of procedure alac_encode_frame() 461. } 462. 463. static int alac_encode_frame(AVCodecContext *avctx, uint8_t *frame, ^ 464. int buf_size, void *data) 465. { libavcodec/alacenc.c:466:5: 464. int buf_size, void *data) 465. { 466. AlacEncodeContext *s = avctx->priv_data; ^ 467. PutBitContext *pb = &s->pbctx; 468. int i, out_bytes, verbatim_flag = 0; libavcodec/alacenc.c:467:5: 465. { 466. AlacEncodeContext *s = avctx->priv_data; 467. PutBitContext *pb = &s->pbctx; ^ 468. int i, out_bytes, verbatim_flag = 0; 469. libavcodec/alacenc.c:468:5: 466. AlacEncodeContext *s = avctx->priv_data; 467. PutBitContext *pb = &s->pbctx; 468. int i, out_bytes, verbatim_flag = 0; ^ 469. 470. if(avctx->frame_size > DEFAULT_FRAME_SIZE) { libavcodec/alacenc.c:470:8: Taking false branch 468. int i, out_bytes, verbatim_flag = 0; 469. 470. if(avctx->frame_size > DEFAULT_FRAME_SIZE) { ^ 471. av_log(avctx, AV_LOG_ERROR, "input frame size exceeded\n"); 472. return -1; libavcodec/alacenc.c:475:8: Taking false branch 473. } 474. 475. if(buf_size < 2*s->max_coded_frame_size) { ^ 476. av_log(avctx, AV_LOG_ERROR, "buffer size is too small\n"); 477. return -1; libavcodec/alacenc.c:508:9: 506. } 507. verbatim_flag = 1; 508. goto verbatim; ^ 509. } 510. libavcodec/alacenc.c:481:5: 479. 480. verbatim: 481. init_put_bits(pb, frame, buf_size); ^ 482. 483. if((s->compression_level == 0) || verbatim_flag) { libavcodec/put_bits.h:60:1: start of procedure init_put_bits() 58. * @param buffer_size the size in bytes of buffer 59. */ 60. static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size) ^ 61. { 62. if(buffer_size < 0) { libavcodec/put_bits.h:62:8: Taking true branch 60. static inline void init_put_bits(PutBitContext *s, uint8_t *buffer, int buffer_size) 61. { 62. if(buffer_size < 0) { ^ 63. buffer_size = 0; 64. buffer = NULL; libavcodec/put_bits.h:63:9: 61. { 62. if(buffer_size < 0) { 63. buffer_size = 0; ^ 64. buffer = NULL; 65. } libavcodec/put_bits.h:64:9: 62. if(buffer_size < 0) { 63. buffer_size = 0; 64. buffer = NULL; ^ 65. } 66. libavcodec/put_bits.h:67:5: 65. } 66. 67. s->size_in_bits= 8*buffer_size; ^ 68. s->buf = buffer; 69. s->buf_end = s->buf + buffer_size; libavcodec/put_bits.h:68:5: 66. 67. s->size_in_bits= 8*buffer_size; 68. s->buf = buffer; ^ 69. s->buf_end = s->buf + buffer_size; 70. #ifdef ALT_BITSTREAM_WRITER libavcodec/put_bits.h:69:5: 67. s->size_in_bits= 8*buffer_size; 68. s->buf = buffer; 69. s->buf_end = s->buf + buffer_size; ^ 70. #ifdef ALT_BITSTREAM_WRITER 71. s->index=0; libavcodec/put_bits.h:75:5: 73. // memset(buffer, 0, buffer_size); 74. #else 75. s->buf_ptr = s->buf; ^ 76. s->bit_left=32; 77. s->bit_buf=0; libavcodec/put_bits.h:76:5: 74. #else 75. s->buf_ptr = s->buf; 76. s->bit_left=32; ^ 77. s->bit_buf=0; 78. #endif libavcodec/put_bits.h:77:5: 75. s->buf_ptr = s->buf; 76. s->bit_left=32; 77. s->bit_buf=0; ^ 78. #endif 79. } libavcodec/put_bits.h:79:1: return from a call to init_put_bits 77. s->bit_buf=0; 78. #endif 79. } ^ 80. 81. /** libavcodec/alacenc.c:483:9: Taking true branch 481. init_put_bits(pb, frame, buf_size); 482. 483. if((s->compression_level == 0) || verbatim_flag) { ^ 484. // Verbatim mode 485. int16_t *samples = data; libavcodec/alacenc.c:485:9: 483. if((s->compression_level == 0) || verbatim_flag) { 484. // Verbatim mode 485. int16_t *samples = data; ^ 486. write_frame_header(s, 1); 487. for(i=0; i<avctx->frame_size*avctx->channels; i++) { libavcodec/alacenc.c:486:9: 484. // Verbatim mode 485. int16_t *samples = data; 486. write_frame_header(s, 1); ^ 487. for(i=0; i<avctx->frame_size*avctx->channels; i++) { 488. put_sbits(pb, 16, *samples++); libavcodec/alacenc.c:119:1: start of procedure write_frame_header() 117. } 118. 119. static void write_frame_header(AlacEncodeContext *s, int is_verbatim) ^ 120. { 121. put_bits(&s->pbctx, 3, s->avctx->channels-1); // No. of channels -1 libavcodec/alacenc.c:121:5: 119. static void write_frame_header(AlacEncodeContext *s, int is_verbatim) 120. { 121. put_bits(&s->pbctx, 3, s->avctx->channels-1); // No. of channels -1 ^ 122. put_bits(&s->pbctx, 16, 0); // Seems to be zero 123. put_bits(&s->pbctx, 1, 1); // Sample count is in the header libavcodec/put_bits.h:143:1: start of procedure put_bits() 141. * Use put_bits32 to write 32 bits. 142. */ 143. static inline void put_bits(PutBitContext *s, int n, unsigned int value) ^ 144. #ifndef ALT_BITSTREAM_WRITER 145. { libavcodec/put_bits.h:150:5: 148. 149. // printf("put_bits=%d %x\n", n, value); 150. assert(n <= 31 && value < (1U << n)); ^ 151. 152. bit_buf = s->bit_buf; libavcodec/put_bits.h:152:5: 150. assert(n <= 31 && value < (1U << n)); 151. 152. bit_buf = s->bit_buf; ^ 153. bit_left = s->bit_left; 154. libavcodec/put_bits.h:153:5: 151. 152. bit_buf = s->bit_buf; 153. bit_left = s->bit_left; ^ 154. 155. // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf); libavcodec/put_bits.h:172:9: Taking false branch 170. bit_left-=n; 171. #else 172. if (n < bit_left) { ^ 173. bit_buf = (bit_buf<<n) | value; 174. bit_left-=n; libavcodec/put_bits.h:176:9: 174. bit_left-=n; 175. } else { 176. bit_buf<<=bit_left; ^ 177. bit_buf |= value >> (n - bit_left); 178. #if !HAVE_FAST_UNALIGNED libavcodec/put_bits.h:177:9: 175. } else { 176. bit_buf<<=bit_left; 177. bit_buf |= value >> (n - bit_left); ^ 178. #if !HAVE_FAST_UNALIGNED 179. if (3 & (intptr_t) s->buf_ptr) { libavcodec/put_bits.h:179:13: Taking false branch 177. bit_buf |= value >> (n - bit_left); 178. #if !HAVE_FAST_UNALIGNED 179. if (3 & (intptr_t) s->buf_ptr) { ^ 180. AV_WB32(s->buf_ptr, bit_buf); 181. } else libavcodec/put_bits.h:183:9: 181. } else 182. #endif 183. *(uint32_t *)s->buf_ptr = be2me_32(bit_buf); ^ 184. //printf("bitbuf = %08x\n", bit_buf); 185. s->buf_ptr+=4; libavutil/bswap.h:54:1: start of procedure bswap_32() 52. 53. #ifndef bswap_32 54. static av_always_inline av_const uint32_t bswap_32(uint32_t x) ^ 55. { 56. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); libavutil/bswap.h:56:5: 54. static av_always_inline av_const uint32_t bswap_32(uint32_t x) 55. { 56. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); ^ 57. x= (x>>16) | (x<<16); 58. return x; libavutil/bswap.h:57:5: 55. { 56. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); 57. x= (x>>16) | (x<<16); ^ 58. return x; 59. } libavutil/bswap.h:58:5: 56. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); 57. x= (x>>16) | (x<<16); 58. return x; ^ 59. } 60. #endif libavutil/bswap.h:59:1: return from a call to bswap_32 57. x= (x>>16) | (x<<16); 58. return x; 59. } ^ 60. #endif 61. libavcodec/put_bits.h:185:9: 183. *(uint32_t *)s->buf_ptr = be2me_32(bit_buf); 184. //printf("bitbuf = %08x\n", bit_buf); 185. s->buf_ptr+=4; ^ 186. bit_left+=32 - n; 187. bit_buf = value; libavcodec/put_bits.h:186:9: 184. //printf("bitbuf = %08x\n", bit_buf); 185. s->buf_ptr+=4; 186. bit_left+=32 - n; ^ 187. bit_buf = value; 188. } libavcodec/put_bits.h:187:9: 185. s->buf_ptr+=4; 186. bit_left+=32 - n; 187. bit_buf = value; ^ 188. } 189. #endif libavcodec/put_bits.h:191:5: 189. #endif 190. 191. s->bit_buf = bit_buf; ^ 192. s->bit_left = bit_left; 193. } libavcodec/put_bits.h:192:5: 190. 191. s->bit_buf = bit_buf; 192. s->bit_left = bit_left; ^ 193. } 194. #else /* ALT_BITSTREAM_WRITER defined */ libavcodec/put_bits.h:193:1: return from a call to put_bits 191. s->bit_buf = bit_buf; 192. s->bit_left = bit_left; 193. } ^ 194. #else /* ALT_BITSTREAM_WRITER defined */ 195. { libavcodec/alacenc.c:122:5: 120. { 121. put_bits(&s->pbctx, 3, s->avctx->channels-1); // No. of channels -1 122. put_bits(&s->pbctx, 16, 0); // Seems to be zero ^ 123. put_bits(&s->pbctx, 1, 1); // Sample count is in the header 124. put_bits(&s->pbctx, 2, 0); // FIXME: Wasted bytes field libavcodec/put_bits.h:143:1: start of procedure put_bits() 141. * Use put_bits32 to write 32 bits. 142. */ 143. static inline void put_bits(PutBitContext *s, int n, unsigned int value) ^ 144. #ifndef ALT_BITSTREAM_WRITER 145. { libavcodec/put_bits.h:150:5: 148. 149. // printf("put_bits=%d %x\n", n, value); 150. assert(n <= 31 && value < (1U << n)); ^ 151. 152. bit_buf = s->bit_buf; libavcodec/put_bits.h:152:5: 150. assert(n <= 31 && value < (1U << n)); 151. 152. bit_buf = s->bit_buf; ^ 153. bit_left = s->bit_left; 154. libavcodec/put_bits.h:153:5: 151. 152. bit_buf = s->bit_buf; 153. bit_left = s->bit_left; ^ 154. 155. // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf); libavcodec/put_bits.h:172:9: Taking true branch 170. bit_left-=n; 171. #else 172. if (n < bit_left) { ^ 173. bit_buf = (bit_buf<<n) | value; 174. bit_left-=n; libavcodec/put_bits.h:173:9: 171. #else 172. if (n < bit_left) { 173. bit_buf = (bit_buf<<n) | value; ^ 174. bit_left-=n; 175. } else { libavcodec/put_bits.h:174:9: 172. if (n < bit_left) { 173. bit_buf = (bit_buf<<n) | value; 174. bit_left-=n; ^ 175. } else { 176. bit_buf<<=bit_left; libavcodec/put_bits.h:191:5: 189. #endif 190. 191. s->bit_buf = bit_buf; ^ 192. s->bit_left = bit_left; 193. } libavcodec/put_bits.h:192:5: 190. 191. s->bit_buf = bit_buf; 192. s->bit_left = bit_left; ^ 193. } 194. #else /* ALT_BITSTREAM_WRITER defined */ libavcodec/put_bits.h:193:1: return from a call to put_bits 191. s->bit_buf = bit_buf; 192. s->bit_left = bit_left; 193. } ^ 194. #else /* ALT_BITSTREAM_WRITER defined */ 195. { libavcodec/alacenc.c:123:5: 121. put_bits(&s->pbctx, 3, s->avctx->channels-1); // No. of channels -1 122. put_bits(&s->pbctx, 16, 0); // Seems to be zero 123. put_bits(&s->pbctx, 1, 1); // Sample count is in the header ^ 124. put_bits(&s->pbctx, 2, 0); // FIXME: Wasted bytes field 125. put_bits(&s->pbctx, 1, is_verbatim); // Audio block is verbatim libavcodec/put_bits.h:143:1: start of procedure put_bits() 141. * Use put_bits32 to write 32 bits. 142. */ 143. static inline void put_bits(PutBitContext *s, int n, unsigned int value) ^ 144. #ifndef ALT_BITSTREAM_WRITER 145. { libavcodec/put_bits.h:150:5: 148. 149. // printf("put_bits=%d %x\n", n, value); 150. assert(n <= 31 && value < (1U << n)); ^ 151. 152. bit_buf = s->bit_buf; libavcodec/put_bits.h:152:5: 150. assert(n <= 31 && value < (1U << n)); 151. 152. bit_buf = s->bit_buf; ^ 153. bit_left = s->bit_left; 154. libavcodec/put_bits.h:153:5: 151. 152. bit_buf = s->bit_buf; 153. bit_left = s->bit_left; ^ 154. 155. // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf); libavcodec/put_bits.h:172:9: Taking true branch 170. bit_left-=n; 171. #else 172. if (n < bit_left) { ^ 173. bit_buf = (bit_buf<<n) | value; 174. bit_left-=n; libavcodec/put_bits.h:173:9: 171. #else 172. if (n < bit_left) { 173. bit_buf = (bit_buf<<n) | value; ^ 174. bit_left-=n; 175. } else { libavcodec/put_bits.h:174:9: 172. if (n < bit_left) { 173. bit_buf = (bit_buf<<n) | value; 174. bit_left-=n; ^ 175. } else { 176. bit_buf<<=bit_left; libavcodec/put_bits.h:191:5: 189. #endif 190. 191. s->bit_buf = bit_buf; ^ 192. s->bit_left = bit_left; 193. } libavcodec/put_bits.h:192:5: 190. 191. s->bit_buf = bit_buf; 192. s->bit_left = bit_left; ^ 193. } 194. #else /* ALT_BITSTREAM_WRITER defined */ libavcodec/put_bits.h:193:1: return from a call to put_bits 191. s->bit_buf = bit_buf; 192. s->bit_left = bit_left; 193. } ^ 194. #else /* ALT_BITSTREAM_WRITER defined */ 195. { libavcodec/alacenc.c:124:5: 122. put_bits(&s->pbctx, 16, 0); // Seems to be zero 123. put_bits(&s->pbctx, 1, 1); // Sample count is in the header 124. put_bits(&s->pbctx, 2, 0); // FIXME: Wasted bytes field ^ 125. put_bits(&s->pbctx, 1, is_verbatim); // Audio block is verbatim 126. put_bits32(&s->pbctx, s->avctx->frame_size); // No. of samples in the frame libavcodec/put_bits.h:143:1: start of procedure put_bits() 141. * Use put_bits32 to write 32 bits. 142. */ 143. static inline void put_bits(PutBitContext *s, int n, unsigned int value) ^ 144. #ifndef ALT_BITSTREAM_WRITER 145. { libavcodec/put_bits.h:150:5: 148. 149. // printf("put_bits=%d %x\n", n, value); 150. assert(n <= 31 && value < (1U << n)); ^ 151. 152. bit_buf = s->bit_buf; libavcodec/put_bits.h:152:5: 150. assert(n <= 31 && value < (1U << n)); 151. 152. bit_buf = s->bit_buf; ^ 153. bit_left = s->bit_left; 154. libavcodec/put_bits.h:153:5: 151. 152. bit_buf = s->bit_buf; 153. bit_left = s->bit_left; ^ 154. 155. // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf); libavcodec/put_bits.h:172:9: Taking true branch 170. bit_left-=n; 171. #else 172. if (n < bit_left) { ^ 173. bit_buf = (bit_buf<<n) | value; 174. bit_left-=n; libavcodec/put_bits.h:173:9: 171. #else 172. if (n < bit_left) { 173. bit_buf = (bit_buf<<n) | value; ^ 174. bit_left-=n; 175. } else { libavcodec/put_bits.h:174:9: 172. if (n < bit_left) { 173. bit_buf = (bit_buf<<n) | value; 174. bit_left-=n; ^ 175. } else { 176. bit_buf<<=bit_left; libavcodec/put_bits.h:191:5: 189. #endif 190. 191. s->bit_buf = bit_buf; ^ 192. s->bit_left = bit_left; 193. } libavcodec/put_bits.h:192:5: 190. 191. s->bit_buf = bit_buf; 192. s->bit_left = bit_left; ^ 193. } 194. #else /* ALT_BITSTREAM_WRITER defined */ libavcodec/put_bits.h:193:1: return from a call to put_bits 191. s->bit_buf = bit_buf; 192. s->bit_left = bit_left; 193. } ^ 194. #else /* ALT_BITSTREAM_WRITER defined */ 195. { libavcodec/alacenc.c:125:5: 123. put_bits(&s->pbctx, 1, 1); // Sample count is in the header 124. put_bits(&s->pbctx, 2, 0); // FIXME: Wasted bytes field 125. put_bits(&s->pbctx, 1, is_verbatim); // Audio block is verbatim ^ 126. put_bits32(&s->pbctx, s->avctx->frame_size); // No. of samples in the frame 127. } libavcodec/put_bits.h:143:1: start of procedure put_bits() 141. * Use put_bits32 to write 32 bits. 142. */ 143. static inline void put_bits(PutBitContext *s, int n, unsigned int value) ^ 144. #ifndef ALT_BITSTREAM_WRITER 145. { libavcodec/put_bits.h:150:5: 148. 149. // printf("put_bits=%d %x\n", n, value); 150. assert(n <= 31 && value < (1U << n)); ^ 151. 152. bit_buf = s->bit_buf; libavcodec/put_bits.h:152:5: 150. assert(n <= 31 && value < (1U << n)); 151. 152. bit_buf = s->bit_buf; ^ 153. bit_left = s->bit_left; 154. libavcodec/put_bits.h:153:5: 151. 152. bit_buf = s->bit_buf; 153. bit_left = s->bit_left; ^ 154. 155. // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf); libavcodec/put_bits.h:172:9: Taking true branch 170. bit_left-=n; 171. #else 172. if (n < bit_left) { ^ 173. bit_buf = (bit_buf<<n) | value; 174. bit_left-=n; libavcodec/put_bits.h:173:9: 171. #else 172. if (n < bit_left) { 173. bit_buf = (bit_buf<<n) | value; ^ 174. bit_left-=n; 175. } else { libavcodec/put_bits.h:174:9: 172. if (n < bit_left) { 173. bit_buf = (bit_buf<<n) | value; 174. bit_left-=n; ^ 175. } else { 176. bit_buf<<=bit_left; libavcodec/put_bits.h:191:5: 189. #endif 190. 191. s->bit_buf = bit_buf; ^ 192. s->bit_left = bit_left; 193. } libavcodec/put_bits.h:192:5: 190. 191. s->bit_buf = bit_buf; 192. s->bit_left = bit_left; ^ 193. } 194. #else /* ALT_BITSTREAM_WRITER defined */ libavcodec/put_bits.h:193:1: return from a call to put_bits 191. s->bit_buf = bit_buf; 192. s->bit_left = bit_left; 193. } ^ 194. #else /* ALT_BITSTREAM_WRITER defined */ 195. { libavcodec/alacenc.c:126:5: 124. put_bits(&s->pbctx, 2, 0); // FIXME: Wasted bytes field 125. put_bits(&s->pbctx, 1, is_verbatim); // Audio block is verbatim 126. put_bits32(&s->pbctx, s->avctx->frame_size); // No. of samples in the frame ^ 127. } 128. libavcodec/put_bits.h:269:1: start of procedure put_bits32() 267. * Write exactly 32 bits into a bitstream 268. */ 269. static void av_unused put_bits32(PutBitContext *s, uint32_t value) ^ 270. { 271. int lo = value & 0xffff; libavcodec/put_bits.h:271:5: 269. static void av_unused put_bits32(PutBitContext *s, uint32_t value) 270. { 271. int lo = value & 0xffff; ^ 272. int hi = value >> 16; 273. #ifdef ALT_BITSTREAM_WRITER_LE libavcodec/put_bits.h:272:5: 270. { 271. int lo = value & 0xffff; 272. int hi = value >> 16; ^ 273. #ifdef ALT_BITSTREAM_WRITER_LE 274. put_bits(s, 16, lo); libavcodec/put_bits.h:277:5: 275. put_bits(s, 16, hi); 276. #else 277. put_bits(s, 16, hi); ^ 278. put_bits(s, 16, lo); 279. #endif libavcodec/put_bits.h:143:1: start of procedure put_bits() 141. * Use put_bits32 to write 32 bits. 142. */ 143. static inline void put_bits(PutBitContext *s, int n, unsigned int value) ^ 144. #ifndef ALT_BITSTREAM_WRITER 145. { libavcodec/put_bits.h:150:5: 148. 149. // printf("put_bits=%d %x\n", n, value); 150. assert(n <= 31 && value < (1U << n)); ^ 151. 152. bit_buf = s->bit_buf; libavcodec/put_bits.h:152:5: 150. assert(n <= 31 && value < (1U << n)); 151. 152. bit_buf = s->bit_buf; ^ 153. bit_left = s->bit_left; 154. libavcodec/put_bits.h:153:5: 151. 152. bit_buf = s->bit_buf; 153. bit_left = s->bit_left; ^ 154. 155. // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf); libavcodec/put_bits.h:172:9: Taking true branch 170. bit_left-=n; 171. #else 172. if (n < bit_left) { ^ 173. bit_buf = (bit_buf<<n) | value; 174. bit_left-=n; libavcodec/put_bits.h:173:9: 171. #else 172. if (n < bit_left) { 173. bit_buf = (bit_buf<<n) | value; ^ 174. bit_left-=n; 175. } else { libavcodec/put_bits.h:174:9: 172. if (n < bit_left) { 173. bit_buf = (bit_buf<<n) | value; 174. bit_left-=n; ^ 175. } else { 176. bit_buf<<=bit_left; libavcodec/put_bits.h:191:5: 189. #endif 190. 191. s->bit_buf = bit_buf; ^ 192. s->bit_left = bit_left; 193. } libavcodec/put_bits.h:192:5: 190. 191. s->bit_buf = bit_buf; 192. s->bit_left = bit_left; ^ 193. } 194. #else /* ALT_BITSTREAM_WRITER defined */ libavcodec/put_bits.h:193:1: return from a call to put_bits 191. s->bit_buf = bit_buf; 192. s->bit_left = bit_left; 193. } ^ 194. #else /* ALT_BITSTREAM_WRITER defined */ 195. { libavcodec/put_bits.h:278:5: 276. #else 277. put_bits(s, 16, hi); 278. put_bits(s, 16, lo); ^ 279. #endif 280. } libavcodec/put_bits.h:143:1: start of procedure put_bits() 141. * Use put_bits32 to write 32 bits. 142. */ 143. static inline void put_bits(PutBitContext *s, int n, unsigned int value) ^ 144. #ifndef ALT_BITSTREAM_WRITER 145. { libavcodec/put_bits.h:150:5: 148. 149. // printf("put_bits=%d %x\n", n, value); 150. assert(n <= 31 && value < (1U << n)); ^ 151. 152. bit_buf = s->bit_buf; libavcodec/put_bits.h:152:5: 150. assert(n <= 31 && value < (1U << n)); 151. 152. bit_buf = s->bit_buf; ^ 153. bit_left = s->bit_left; 154. libavcodec/put_bits.h:153:5: 151. 152. bit_buf = s->bit_buf; 153. bit_left = s->bit_left; ^ 154. 155. // printf("n=%d value=%x cnt=%d buf=%x\n", n, value, bit_cnt, bit_buf); libavcodec/put_bits.h:172:9: Taking false branch 170. bit_left-=n; 171. #else 172. if (n < bit_left) { ^ 173. bit_buf = (bit_buf<<n) | value; 174. bit_left-=n; libavcodec/put_bits.h:176:9: 174. bit_left-=n; 175. } else { 176. bit_buf<<=bit_left; ^ 177. bit_buf |= value >> (n - bit_left); 178. #if !HAVE_FAST_UNALIGNED libavcodec/put_bits.h:177:9: 175. } else { 176. bit_buf<<=bit_left; 177. bit_buf |= value >> (n - bit_left); ^ 178. #if !HAVE_FAST_UNALIGNED 179. if (3 & (intptr_t) s->buf_ptr) { libavcodec/put_bits.h:179:13: Taking false branch 177. bit_buf |= value >> (n - bit_left); 178. #if !HAVE_FAST_UNALIGNED 179. if (3 & (intptr_t) s->buf_ptr) { ^ 180. AV_WB32(s->buf_ptr, bit_buf); 181. } else libavcodec/put_bits.h:183:9: 181. } else 182. #endif 183. *(uint32_t *)s->buf_ptr = be2me_32(bit_buf); ^ 184. //printf("bitbuf = %08x\n", bit_buf); 185. s->buf_ptr+=4; libavutil/bswap.h:54:1: start of procedure bswap_32() 52. 53. #ifndef bswap_32 54. static av_always_inline av_const uint32_t bswap_32(uint32_t x) ^ 55. { 56. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); libavutil/bswap.h:56:5: 54. static av_always_inline av_const uint32_t bswap_32(uint32_t x) 55. { 56. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); ^ 57. x= (x>>16) | (x<<16); 58. return x; libavutil/bswap.h:57:5: 55. { 56. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); 57. x= (x>>16) | (x<<16); ^ 58. return x; 59. } libavutil/bswap.h:58:5: 56. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); 57. x= (x>>16) | (x<<16); 58. return x; ^ 59. } 60. #endif libavutil/bswap.h:59:1: return from a call to bswap_32 57. x= (x>>16) | (x<<16); 58. return x; 59. } ^ 60. #endif 61. libavcodec/put_bits.h:185:9: 183. *(uint32_t *)s->buf_ptr = be2me_32(bit_buf); 184. //printf("bitbuf = %08x\n", bit_buf); 185. s->buf_ptr+=4; ^ 186. bit_left+=32 - n; 187. bit_buf = value; libavcodec/put_bits.h:186:9: 184. //printf("bitbuf = %08x\n", bit_buf); 185. s->buf_ptr+=4; 186. bit_left+=32 - n; ^ 187. bit_buf = value; 188. } libavcodec/put_bits.h:187:9: 185. s->buf_ptr+=4; 186. bit_left+=32 - n; 187. bit_buf = value; ^ 188. } 189. #endif libavcodec/put_bits.h:191:5: 189. #endif 190. 191. s->bit_buf = bit_buf; ^ 192. s->bit_left = bit_left; 193. } libavcodec/put_bits.h:192:5: 190. 191. s->bit_buf = bit_buf; 192. s->bit_left = bit_left; ^ 193. } 194. #else /* ALT_BITSTREAM_WRITER defined */ libavcodec/put_bits.h:193:1: return from a call to put_bits 191. s->bit_buf = bit_buf; 192. s->bit_left = bit_left; 193. } ^ 194. #else /* ALT_BITSTREAM_WRITER defined */ 195. { libavcodec/put_bits.h:280:1: return from a call to put_bits32 278. put_bits(s, 16, lo); 279. #endif 280. } ^ 281. 282. /** libavcodec/alacenc.c:127:1: return from a call to write_frame_header 125. put_bits(&s->pbctx, 1, is_verbatim); // Audio block is verbatim 126. put_bits32(&s->pbctx, s->avctx->frame_size); // No. of samples in the frame 127. } ^ 128. 129. static void calc_predictor_params(AlacEncodeContext *s, int ch)
https://github.com/libav/libav/blob/01418506a2cf2ae5bee9931417279009b50bf531/libavcodec/alacenc.c/#L486
d2a_code_trace_data_44256
static int64_t mpegts_get_pcr(AVFormatContext *s, int stream_index, int64_t *ppos, int64_t pos_limit) { MpegTSContext *ts = s->priv_data; int64_t pos, timestamp; uint8_t buf[TS_PACKET_SIZE]; int pcr_l, pcr_pid = ((PESContext*)s->streams[stream_index]->priv_data)->pcr_pid; const int find_next= 1; pos = ((*ppos + ts->raw_packet_size - 1) / ts->raw_packet_size) * ts->raw_packet_size; if (find_next) { for(;;) { url_fseek(s->pb, pos, SEEK_SET); if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE) return AV_NOPTS_VALUE; if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) && parse_pcr(&timestamp, &pcr_l, buf) == 0) { break; } pos += ts->raw_packet_size; } } else { for(;;) { pos -= ts->raw_packet_size; if (pos < 0) return AV_NOPTS_VALUE; url_fseek(s->pb, pos, SEEK_SET); if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE) return AV_NOPTS_VALUE; if ((pcr_pid < 0 || (AV_RB16(buf + 1) & 0x1fff) == pcr_pid) && parse_pcr(&timestamp, &pcr_l, buf) == 0) { break; } } } *ppos = pos; return timestamp; } libavformat/mpegts.c:1410: error: Uninitialized Value The value read from timestamp was never initialized. libavformat/mpegts.c:1410:5: 1408. *ppos = pos; 1409. 1410. return timestamp; ^ 1411. } 1412.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/mpegts.c/#L1410
d2a_code_trace_data_44257
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_exp.c:757: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `bn_to_mont_fixed_top`. Showing all 22 steps of the trace crypto/bn/bn_exp.c:592:1: Parameter `ctx->stack.depth` 590. * http://www.daemonology.net/hyperthreading-considered-harmful/) 591. */ 592. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 593. const BIGNUM *m, BN_CTX *ctx, 594. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:636:5: Call 634. } 635. 636. BN_CTX_start(ctx); ^ 637. 638. /* crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_exp.c:757:10: Call 755. 756. /* prepare a^1 in Montgomery domain */ 757. if (!bn_to_mont_fixed_top(&am, a, mont, ctx)) ^ 758. goto err; 759. crypto/bn/bn_mont.c:222:1: Parameter `ctx->stack.depth` 220. } 221. 222. > int bn_to_mont_fixed_top(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 223. BN_CTX *ctx) 224. { crypto/bn/bn_mont.c:225:12: Call 223. BN_CTX *ctx) 224. { 225. return bn_mul_mont_fixed_top(r, a, &(mont->RR), mont, ctx); ^ 226. } 227. crypto/bn/bn_mont.c:37:1: Parameter `ctx->stack.depth` 35. } 36. 37. > int bn_mul_mont_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 38. BN_MONT_CTX *mont, BN_CTX *ctx) 39. { crypto/bn/bn_mont.c:60:5: Call 58. return 0; 59. 60. BN_CTX_start(ctx); ^ 61. tmp = BN_CTX_get(ctx); 62. if (tmp == NULL) crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_mont.c:61:11: Call 59. 60. BN_CTX_start(ctx); 61. tmp = BN_CTX_get(ctx); ^ 62. if (tmp == NULL) 63. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_mont.c:70:14: Call 68. goto err; 69. } else { 70. if (!bn_mul_fixed_top(tmp, a, b, ctx)) ^ 71. goto err; 72. } crypto/bn/bn_mul.c:533:5: Call 531. top = al + bl; 532. 533. BN_CTX_start(ctx); ^ 534. if ((r == a) || (r == b)) { 535. if ((rr = BN_CTX_get(ctx)) == NULL) crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_mul.c:618:5: Call 616. err: 617. bn_check_top(r); 618. BN_CTX_end(ctx); ^ 619. return ret; 620. } crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `bn_to_mont_fixed_top` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_44258
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, nb_output_files); if (use_audio) new_audio_stream(oc, nb_output_files); if (use_subtitle) new_subtitle_stream(oc, nb_output_files); oc->timestamp = recording_timestamp; av_metadata_copy(&oc->metadata, metadata, 0); av_metadata_free(&metadata); } 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, NULL); av_freep(&forced_key_frames); } ffmpeg.c:3739: error: Null Dereference pointer `file_oformat` last assigned on line 3728 could be null and is dereferenced at line 3739, column 17. ffmpeg.c:3703:1: start of procedure opt_output_file() 3701. } 3702. 3703. static void opt_output_file(const char *filename) ^ 3704. { 3705. AVFormatContext *oc; ffmpeg.c:3708:5: 3706. int err, use_video, use_audio, use_subtitle; 3707. int input_has_video, input_has_audio, input_has_subtitle; 3708. AVFormatParameters params, *ap = &params; ^ 3709. AVOutputFormat *file_oformat; 3710. ffmpeg.c:3711:10: Taking false branch 3709. AVOutputFormat *file_oformat; 3710. 3711. if (!strcmp(filename, "-")) ^ 3712. filename = "pipe:"; 3713. ffmpeg.c:3714:5: 3712. filename = "pipe:"; 3713. 3714. oc = avformat_alloc_context(); ^ 3715. if (!oc) { 3716. print_error(filename, AVERROR(ENOMEM)); libavformat/options.c:82:1: start of procedure avformat_alloc_context() 80. } 81. 82. AVFormatContext *avformat_alloc_context(void) ^ 83. { 84. AVFormatContext *ic; libavformat/options.c:85:5: 83. { 84. AVFormatContext *ic; 85. ic = av_malloc(sizeof(AVFormatContext)); ^ 86. if (!ic) return ic; 87. 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(FF_INTERNAL_MEM_TYPE size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(FF_INTERNAL_MEM_TYPE size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking 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, FF_INTERNAL_MEM_TYPE size) libavformat/options.c:86:10: Taking false branch 84. AVFormatContext *ic; 85. ic = av_malloc(sizeof(AVFormatContext)); 86. if (!ic) return ic; ^ 87. avformat_get_context_defaults(ic); 88. ic->av_class = &av_format_context_class; libavformat/options.c:87:5: Skipping avformat_get_context_defaults(): empty list of specs 85. ic = av_malloc(sizeof(AVFormatContext)); 86. if (!ic) return ic; 87. avformat_get_context_defaults(ic); ^ 88. ic->av_class = &av_format_context_class; 89. return ic; libavformat/options.c:88:5: 86. if (!ic) return ic; 87. avformat_get_context_defaults(ic); 88. ic->av_class = &av_format_context_class; ^ 89. return ic; 90. } libavformat/options.c:89:5: 87. avformat_get_context_defaults(ic); 88. ic->av_class = &av_format_context_class; 89. return ic; ^ 90. } 91. libavformat/options.c:90:1: return from a call to avformat_alloc_context 88. ic->av_class = &av_format_context_class; 89. return ic; 90. } ^ 91. 92. #if FF_API_ALLOC_FORMAT_CONTEXT ffmpeg.c:3715:10: Taking false branch 3713. 3714. oc = avformat_alloc_context(); 3715. if (!oc) { ^ 3716. print_error(filename, AVERROR(ENOMEM)); 3717. ffmpeg_exit(1); ffmpeg.c:3720:9: Taking false branch 3718. } 3719. 3720. if (last_asked_format) { ^ 3721. file_oformat = av_guess_format(last_asked_format, NULL, NULL); 3722. if (!file_oformat) { ffmpeg.c:3728:9: Skipping av_guess_format(): empty list of specs 3726. last_asked_format = NULL; 3727. } else { 3728. file_oformat = av_guess_format(NULL, filename, NULL); ^ 3729. if (!file_oformat) { 3730. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", ffmpeg.c:3729:14: Taking true branch 3727. } else { 3728. file_oformat = av_guess_format(NULL, filename, NULL); 3729. if (!file_oformat) { ^ 3730. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", 3731. filename); ffmpeg.c:3730:13: 3728. file_oformat = av_guess_format(NULL, filename, NULL); 3729. if (!file_oformat) { 3730. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", ^ 3731. filename); 3732. ffmpeg_exit(1); ffmpeg.c:3732:13: Skipping ffmpeg_exit(): empty list of specs 3730. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", 3731. filename); 3732. ffmpeg_exit(1); ^ 3733. } 3734. } ffmpeg.c:3736:5: 3734. } 3735. 3736. oc->oformat = file_oformat; ^ 3737. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); 3738. ffmpeg.c:3737:5: 3735. 3736. oc->oformat = file_oformat; 3737. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); ^ 3738. 3739. if (!strcmp(file_oformat->name, "ffm") && libavutil/avstring.c:64:1: start of procedure av_strlcpy() 62. } 63. 64. size_t av_strlcpy(char *dst, const char *src, size_t size) ^ 65. { 66. size_t len = 0; libavutil/avstring.c:66:5: 64. size_t av_strlcpy(char *dst, const char *src, size_t size) 65. { 66. size_t len = 0; ^ 67. while (++len < size && *src) 68. *dst++ = *src++; libavutil/avstring.c:67:12: Loop condition is true. Entering loop body 65. { 66. size_t len = 0; 67. while (++len < size && *src) ^ 68. *dst++ = *src++; 69. if (len <= size) libavutil/avstring.c:67:28: Loop condition is false. Leaving loop 65. { 66. size_t len = 0; 67. while (++len < size && *src) ^ 68. *dst++ = *src++; 69. if (len <= size) libavutil/avstring.c:69:9: Taking true branch 67. while (++len < size && *src) 68. *dst++ = *src++; 69. if (len <= size) ^ 70. *dst = 0; 71. return len + strlen(src) - 1; libavutil/avstring.c:70:9: 68. *dst++ = *src++; 69. if (len <= size) 70. *dst = 0; ^ 71. return len + strlen(src) - 1; 72. } libavutil/avstring.c:71:5: 69. if (len <= size) 70. *dst = 0; 71. return len + strlen(src) - 1; ^ 72. } 73. libavutil/avstring.c:72:1: return from a call to av_strlcpy 70. *dst = 0; 71. return len + strlen(src) - 1; 72. } ^ 73. 74. size_t av_strlcat(char *dst, const char *src, size_t size) ffmpeg.c:3739:10: 3737. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); 3738. 3739. if (!strcmp(file_oformat->name, "ffm") && ^ 3740. av_strstart(filename, "http:", NULL)) { 3741. /* special case for files sent to ffserver: we get the stream
https://github.com/libav/libav/blob/87e4d9b252bc6fa3b982f7050013069c9dc3e05b/ffmpeg.c/#L3739
d2a_code_trace_data_44259
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_mont.c:432: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_div`. Showing all 16 steps of the trace crypto/bn/bn_mont.c:421:8: Call 419. tmod.top = buf[0] != 0 ? 1 : 0; 420. /* Ri = R^-1 mod N*/ 421. if ((BN_mod_inverse(Ri,R,&tmod,ctx)) == NULL) ^ 422. goto err; 423. if (!BN_lshift(Ri,Ri,BN_BITS2)) goto err; /* R*Ri */ crypto/bn/bn_gcd.c:209:1: Parameter `ctx->stack.depth` 207. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); 208. 209. > BIGNUM *BN_mod_inverse(BIGNUM *in, 210. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 211. { crypto/bn/bn_gcd.c:224:2: Call 222. bn_check_top(n); 223. 224. BN_CTX_start(ctx); ^ 225. A = BN_CTX_get(ctx); 226. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gcd.c:498:2: Call 496. err: 497. if ((ret == NULL) && (in == NULL)) BN_free(R); 498. BN_CTX_end(ctx); ^ 499. bn_check_top(ret); 500. return(ret); crypto/bn/bn_ctx.c:270:1: Parameter `ctx->stack.depth` 268. } 269. 270. > void BN_CTX_end(BN_CTX *ctx) 271. { 272. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_mont.c:432:8: Call 430. if (!BN_set_word(Ri,BN_MASK2)) goto err; /* Ri-- (mod word size) */ 431. } 432. if (!BN_div(Ri,NULL,Ri,&tmod,ctx)) goto err; ^ 433. /* Ni = (R*Ri-1)/N, 434. * keep only least significant word: */ crypto/bn/bn_div.c:181:1: Parameter `ctx->stack.depth` 179. * If 'dv' or 'rm' is NULL, the respective value is not returned. 180. */ 181. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 182. BN_CTX *ctx) 183. { crypto/bn/bn_div.c:226:2: Call 224. } 225. 226. BN_CTX_start(ctx); ^ 227. tmp=BN_CTX_get(ctx); 228. snum=BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:441:2: Call 439. } 440. if (no_branch) bn_correct_top(res); 441. BN_CTX_end(ctx); ^ 442. return(1); 443. err: crypto/bn/bn_ctx.c:270:1: Parameter `ctx->stack.depth` 268. } 269. 270. > void BN_CTX_end(BN_CTX *ctx) 271. { 272. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:277:21: Call 275. else 276. { 277. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 278. /* Does this stack frame have anything to release? */ 279. if(fp < ctx->used) crypto/bn/bn_ctx.c:351:1: <LHS trace> 349. } 350. 351. > static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:351:1: Parameter `st->depth` 349. } 350. 351. > static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:353:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_div` 351. static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; ^ 354. } 355.
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/bn/bn_ctx.c/#L353
d2a_code_trace_data_44260
static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) { unsigned char *buf = NULL; int ret = 0, bit, bytes, mask; time_t tim; if (bits == 0) { if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY) goto toosmall; BN_zero(rnd); return 1; } if (bits < 0 || (bits == 1 && top > 0)) goto toosmall; bytes = (bits + 7) / 8; bit = (bits - 1) % 8; mask = 0xff << (bit + 1); buf = OPENSSL_malloc(bytes); if (buf == NULL) { BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); goto err; } time(&tim); RAND_add(&tim, sizeof(tim), 0.0); if (RAND_bytes(buf, bytes) <= 0) goto err; if (pseudorand == 2) { int i; unsigned char c; for (i = 0; i < bytes; i++) { if (RAND_bytes(&c, 1) <= 0) goto err; if (c >= 128 && i > 0) buf[i] = buf[i - 1]; else if (c < 42) buf[i] = 0; else if (c < 84) buf[i] = 255; } } if (top >= 0) { if (top) { if (bit == 0) { buf[0] = 1; buf[1] |= 0x80; } else { buf[0] |= (3 << (bit - 1)); } } else { buf[0] |= (1 << bit); } } buf[0] &= ~mask; if (bottom) buf[bytes - 1] |= 1; if (!BN_bin2bn(buf, bytes, rnd)) goto err; ret = 1; err: OPENSSL_clear_free(buf, bytes); bn_check_top(rnd); return (ret); toosmall: BNerr(BN_F_BNRAND, BN_R_BITS_TOO_SMALL); return 0; } test/bntest.c:1768: error: BUFFER_OVERRUN_L3 Offset: [-1, 8] Size: [1, 9] by call to `BN_rand`. Showing all 12 steps of the trace test/bntest.c:1768:17: Call 1766. || !TEST_true(BN_rand(bn, 1, -1 /* top */ , 1 /* bottom */ )) 1767. || !TEST_BN_eq_one(bn) 1768. || !TEST_true(BN_rand(bn, 2, 1 /* top */ , 0 /* bottom */ )) ^ 1769. || !TEST_BN_eq_word(bn, 3)) 1770. goto err; crypto/bn/bn_rand.c:96:1: Parameter `bits` 94. } 95. 96. > int BN_rand(BIGNUM *rnd, int bits, int top, int bottom) 97. { 98. return bnrand(0, rnd, bits, top, bottom); crypto/bn/bn_rand.c:98:12: Call 96. int BN_rand(BIGNUM *rnd, int bits, int top, int bottom) 97. { 98. return bnrand(0, rnd, bits, top, bottom); ^ 99. } 100. crypto/bn/bn_rand.c:56:14: <Offset trace> 54. unsigned char c; 55. 56. for (i = 0; i < bytes; i++) { ^ 57. if (RAND_bytes(&c, 1) <= 0) 58. goto err; crypto/bn/bn_rand.c:56:14: Assignment 54. unsigned char c; 55. 56. for (i = 0; i < bytes; i++) { ^ 57. if (RAND_bytes(&c, 1) <= 0) 58. goto err; crypto/bn/bn_rand.c:17:1: <Length trace> 15. #include <openssl/sha.h> 16. 17. > static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) 18. { 19. unsigned char *buf = NULL; crypto/bn/bn_rand.c:17:1: Parameter `bits` 15. #include <openssl/sha.h> 16. 17. > static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom) 18. { 19. unsigned char *buf = NULL; crypto/bn/bn_rand.c:32:5: Assignment 30. goto toosmall; 31. 32. bytes = (bits + 7) / 8; ^ 33. bit = (bits - 1) % 8; 34. mask = 0xff << (bit + 1); crypto/bn/bn_rand.c:36:11: Call 34. mask = 0xff << (bit + 1); 35. 36. buf = OPENSSL_malloc(bytes); ^ 37. if (buf == NULL) { 38. BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); crypto/mem.c:166:9: Assignment 164. 165. if (num == 0) 166. return NULL; ^ 167. 168. FAILTEST(); crypto/bn/bn_rand.c:36:5: Assignment 34. mask = 0xff << (bit + 1); 35. 36. buf = OPENSSL_malloc(bytes); ^ 37. if (buf == NULL) { 38. BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); crypto/bn/bn_rand.c:82:9: Array access: Offset: [-1, 8] Size: [1, 9] by call to `BN_rand` 80. buf[0] &= ~mask; 81. if (bottom) /* set bottom bit if requested */ 82. buf[bytes - 1] |= 1; ^ 83. if (!BN_bin2bn(buf, bytes, rnd)) 84. goto err;
https://github.com/openssl/openssl/blob/3f97052392cb10fca5309212bf720685262ad4a6/crypto/bn/bn_rand.c/#L82
d2a_code_trace_data_44261
static inline uint64_t get_val(BitstreamContext *bc, unsigned n) { #ifdef BITSTREAM_READER_LE uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1); bc->bits >>= n; #else uint64_t ret = bc->bits >> (64 - n); bc->bits <<= n; #endif bc->bits_left -= n; return ret; } libavcodec/takdec.c:779: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `decode_channel`. libavcodec/takdec.c:688:16: Call 686. bitstream_init8(bc, pkt->data, pkt->size); 687. 688. if ((ret = ff_tak_decode_frame_header(avctx, bc, &s->ti, 0)) < 0) ^ 689. return ret; 690. libavcodec/tak.c:127:9: Call 125. TAKStreamInfo *ti, int log_level_offset) 126. { 127. if (bitstream_read(bc, TAK_FRAME_HEADER_SYNC_ID_BITS) != TAK_FRAME_HEADER_SYNC_ID) { ^ 128. av_log(avctx, AV_LOG_ERROR + log_level_offset, "missing sync id\n"); 129. return AVERROR_INVALIDDATA; libavcodec/bitstream.h:183:1: Parameter `bc->bits_left` 181. 182. /* Return n bits from the buffer. n has to be in the 0-32 range. */ 183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n) ^ 184. { 185. if (!n) libavcodec/takdec.c:779:27: Call 777. if (s->ti.codec == TAK_CODEC_MONO_STEREO) { 778. for (chan = 0; chan < avctx->channels; chan++) 779. if (ret = decode_channel(s, chan)) ^ 780. return ret; 781. libavcodec/takdec.c:504:1: Parameter `s->bc.bits_left` 502. } 503. 504. static int decode_channel(TAKDecContext *s, int chan) ^ 505. { 506. AVCodecContext *avctx = s->avctx; libavcodec/takdec.c:513:29: Call 511. int subframe_len[MAX_SUBFRAMES]; 512. 513. s->sample_shift[chan] = bits_esc4(bc); ^ 514. if (s->sample_shift[chan] >= avctx->bits_per_coded_sample) 515. return AVERROR_INVALIDDATA; libavcodec/takdec.c:367:1: Parameter `bc->bits_left` 365. } 366. 367. static int bits_esc4(BitstreamContext *bc) ^ 368. { 369. if (bitstream_read_bit(bc)) libavcodec/takdec.c:369:9: Call 367. static int bits_esc4(BitstreamContext *bc) 368. { 369. if (bitstream_read_bit(bc)) ^ 370. return bitstream_read(bc, 4) + 1; 371. else libavcodec/bitstream.h:145:1: Parameter `bc->bits_left` 143. 144. /* Return one bit from the buffer. */ 145. static inline unsigned bitstream_read_bit(BitstreamContext *bc) ^ 146. { 147. if (!bc->bits_left) libavcodec/bitstream.h:150:12: Call 148. refill_64(bc); 149. 150. return get_val(bc, 1); ^ 151. } 152. libavcodec/bitstream.h:130:1: <LHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `bc->bits_left` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: <RHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `decode_channel` 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_44262
int ctr_instantiate(RAND_DRBG *drbg, const unsigned char *entropy, size_t entropylen, const unsigned char *nonce, size_t noncelen, const unsigned char *pers, size_t perslen) { RAND_DRBG_CTR *ctr = &drbg->ctr; if (entropy == NULL) return 0; memset(ctr->K, 0, sizeof(ctr->K)); memset(ctr->V, 0, sizeof(ctr->V)); AES_set_encrypt_key(ctr->K, drbg->strength, &ctr->ks); ctr_update(drbg, entropy, entropylen, pers, perslen, nonce, noncelen); return 1; } crypto/rand/drbg_rand.c:249: error: BUFFER_OVERRUN_L3 Offset added: 32 Size: [0, +oo]. Showing all 3 steps of the trace crypto/rand/drbg_rand.c:239:1: <Length trace> 237. } 238. 239. > int ctr_instantiate(RAND_DRBG *drbg, 240. const unsigned char *entropy, size_t entropylen, 241. const unsigned char *nonce, size_t noncelen, crypto/rand/drbg_rand.c:239:1: Parameter `drbg->ctr.K[*]` 237. } 238. 239. > int ctr_instantiate(RAND_DRBG *drbg, 240. const unsigned char *entropy, size_t entropylen, 241. const unsigned char *nonce, size_t noncelen, crypto/rand/drbg_rand.c:249:5: Array access: Offset added: 32 Size: [0, +oo] 247. return 0; 248. 249. memset(ctr->K, 0, sizeof(ctr->K)); ^ 250. memset(ctr->V, 0, sizeof(ctr->V)); 251. AES_set_encrypt_key(ctr->K, drbg->strength, &ctr->ks);
https://github.com/openssl/openssl/blob/aa048aef0b9146f90c06333dedfc105d1f9e2c22/crypto/rand/drbg_rand.c/#L249
d2a_code_trace_data_44263
int SM2_decrypt(const EC_KEY *key, const EVP_MD *digest, const uint8_t *ciphertext, size_t ciphertext_len, uint8_t *ptext_buf, size_t *ptext_len) { int rc = 0; int i; BN_CTX *ctx = NULL; const EC_GROUP *group = EC_KEY_get0_group(key); EC_POINT *C1 = NULL; struct SM2_Ciphertext_st *sm2_ctext = NULL; BIGNUM *x2 = NULL; BIGNUM *y2 = NULL; uint8_t *x2y2 = NULL; uint8_t *computed_C3 = NULL; const size_t field_size = EC_field_size(group); const int hash_size = EVP_MD_size(digest); uint8_t *msg_mask = NULL; const uint8_t *C2 = NULL; const uint8_t *C3 = NULL; int msg_len = 0; EVP_MD_CTX *hash = NULL; if (field_size == 0 || hash_size == 0) goto done; memset(ptext_buf, 0xFF, *ptext_len); sm2_ctext = d2i_SM2_Ciphertext(NULL, &ciphertext, ciphertext_len); if (sm2_ctext == NULL) goto done; if (sm2_ctext->C3->length != hash_size) goto done; C2 = sm2_ctext->C2->data; C3 = sm2_ctext->C3->data; msg_len = sm2_ctext->C2->length; ctx = BN_CTX_new(); if (ctx == NULL) goto done; BN_CTX_start(ctx); x2 = BN_CTX_get(ctx); y2 = BN_CTX_get(ctx); if(y2 == NULL) goto done; msg_mask = OPENSSL_zalloc(msg_len); x2y2 = OPENSSL_zalloc(2 * field_size); computed_C3 = OPENSSL_zalloc(hash_size); if(msg_mask == NULL || x2y2 == NULL || computed_C3 == NULL) goto done; C1 = EC_POINT_new(group); if (C1 == NULL) goto done; if (EC_POINT_set_affine_coordinates_GFp (group, C1, sm2_ctext->C1x, sm2_ctext->C1y, ctx) == 0) goto done; if (EC_POINT_mul(group, C1, NULL, C1, EC_KEY_get0_private_key(key), ctx) == 0) goto done; if (EC_POINT_get_affine_coordinates_GFp(group, C1, x2, y2, ctx) == 0) goto done; BN_bn2binpad(x2, x2y2, field_size); BN_bn2binpad(y2, x2y2 + field_size, field_size); if (ECDH_KDF_X9_62(msg_mask, msg_len, x2y2, 2 * field_size, NULL, 0, digest) == 0) goto done; for (i = 0; i != msg_len; ++i) ptext_buf[i] = C2[i] ^ msg_mask[i]; hash = EVP_MD_CTX_new(); if (hash == NULL) goto done; if (EVP_DigestInit(hash, digest) == 0) goto done; if (EVP_DigestUpdate(hash, x2y2, field_size) == 0) goto done; if (EVP_DigestUpdate(hash, ptext_buf, msg_len) == 0) goto done; if (EVP_DigestUpdate(hash, x2y2 + field_size, field_size) == 0) goto done; if (EVP_DigestFinal(hash, computed_C3, NULL) == 0) goto done; if (memcmp(computed_C3, C3, hash_size) != 0) goto done; rc = 1; *ptext_len = msg_len; done: if (rc == 0) memset(ptext_buf, 0, *ptext_len); OPENSSL_free(msg_mask); OPENSSL_free(x2y2); OPENSSL_free(computed_C3); EC_POINT_free(C1); BN_CTX_free(ctx); SM2_Ciphertext_free(sm2_ctext); EVP_MD_CTX_free(hash); return rc; } crypto/sm2/sm2_crypt.c:330: error: NULL_DEREFERENCE pointer `ctx` last assigned on line 216 could be null and is dereferenced by call to `BN_CTX_free()` at line 330, column 5. Showing all 97 steps of the trace crypto/sm2/sm2_crypt.c:208:1: start of procedure SM2_decrypt() 206. } 207. 208. > int SM2_decrypt(const EC_KEY *key, 209. const EVP_MD *digest, 210. const uint8_t *ciphertext, crypto/sm2/sm2_crypt.c:213:5: 211. size_t ciphertext_len, uint8_t *ptext_buf, size_t *ptext_len) 212. { 213. > int rc = 0; 214. int i; 215. crypto/sm2/sm2_crypt.c:216:5: 214. int i; 215. 216. > BN_CTX *ctx = NULL; 217. const EC_GROUP *group = EC_KEY_get0_group(key); 218. EC_POINT *C1 = NULL; crypto/sm2/sm2_crypt.c:217:5: 215. 216. BN_CTX *ctx = NULL; 217. > const EC_GROUP *group = EC_KEY_get0_group(key); 218. EC_POINT *C1 = NULL; 219. struct SM2_Ciphertext_st *sm2_ctext = 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_crypt.c:218:5: 216. BN_CTX *ctx = NULL; 217. const EC_GROUP *group = EC_KEY_get0_group(key); 218. > EC_POINT *C1 = NULL; 219. struct SM2_Ciphertext_st *sm2_ctext = NULL; 220. BIGNUM *x2 = NULL; crypto/sm2/sm2_crypt.c:219:5: 217. const EC_GROUP *group = EC_KEY_get0_group(key); 218. EC_POINT *C1 = NULL; 219. > struct SM2_Ciphertext_st *sm2_ctext = NULL; 220. BIGNUM *x2 = NULL; 221. BIGNUM *y2 = NULL; crypto/sm2/sm2_crypt.c:220:5: 218. EC_POINT *C1 = NULL; 219. struct SM2_Ciphertext_st *sm2_ctext = NULL; 220. > BIGNUM *x2 = NULL; 221. BIGNUM *y2 = NULL; 222. crypto/sm2/sm2_crypt.c:221:5: 219. struct SM2_Ciphertext_st *sm2_ctext = NULL; 220. BIGNUM *x2 = NULL; 221. > BIGNUM *y2 = NULL; 222. 223. uint8_t *x2y2 = NULL; crypto/sm2/sm2_crypt.c:223:5: 221. BIGNUM *y2 = NULL; 222. 223. > uint8_t *x2y2 = NULL; 224. uint8_t *computed_C3 = NULL; 225. crypto/sm2/sm2_crypt.c:224:5: 222. 223. uint8_t *x2y2 = NULL; 224. > uint8_t *computed_C3 = NULL; 225. 226. const size_t field_size = EC_field_size(group); crypto/sm2/sm2_crypt.c:226:5: 224. uint8_t *computed_C3 = NULL; 225. 226. > const size_t field_size = EC_field_size(group); 227. const int hash_size = EVP_MD_size(digest); 228. crypto/sm2/sm2_crypt.c:38:1: start of procedure EC_field_size() 36. IMPLEMENT_ASN1_FUNCTIONS(SM2_Ciphertext) 37. 38. > static size_t EC_field_size(const EC_GROUP *group) 39. { 40. /* Is there some simpler way to do this? */ crypto/sm2/sm2_crypt.c:41:5: Skipping BN_new(): empty list of specs 39. { 40. /* Is there some simpler way to do this? */ 41. BIGNUM *p = BN_new(); ^ 42. BIGNUM *a = BN_new(); 43. BIGNUM *b = BN_new(); crypto/sm2/sm2_crypt.c:42:5: Skipping BN_new(): empty list of specs 40. /* Is there some simpler way to do this? */ 41. BIGNUM *p = BN_new(); 42. BIGNUM *a = BN_new(); ^ 43. BIGNUM *b = BN_new(); 44. size_t field_size = 0; crypto/sm2/sm2_crypt.c:43:5: Skipping BN_new(): empty list of specs 41. BIGNUM *p = BN_new(); 42. BIGNUM *a = BN_new(); 43. BIGNUM *b = BN_new(); ^ 44. size_t field_size = 0; 45. crypto/sm2/sm2_crypt.c:44:5: 42. BIGNUM *a = BN_new(); 43. BIGNUM *b = BN_new(); 44. > size_t field_size = 0; 45. 46. if (p == NULL || a == NULL || b == NULL) crypto/sm2/sm2_crypt.c:46:9: Taking false branch 44. size_t field_size = 0; 45. 46. if (p == NULL || a == NULL || b == NULL) ^ 47. goto done; 48. crypto/sm2/sm2_crypt.c:46:22: Taking false branch 44. size_t field_size = 0; 45. 46. if (p == NULL || a == NULL || b == NULL) ^ 47. goto done; 48. crypto/sm2/sm2_crypt.c:46:35: Taking false branch 44. size_t field_size = 0; 45. 46. if (p == NULL || a == NULL || b == NULL) ^ 47. goto done; 48. crypto/sm2/sm2_crypt.c:49:5: 47. goto done; 48. 49. > EC_GROUP_get_curve_GFp(group, p, a, b, NULL); 50. field_size = (BN_num_bits(p) + 7) / 8; 51. crypto/ec/ec_lib.c:424:1: start of procedure EC_GROUP_get_curve_GFp() 422. } 423. 424. > int EC_GROUP_get_curve_GFp(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, 425. BIGNUM *b, BN_CTX *ctx) 426. { crypto/ec/ec_lib.c:427:9: Taking true branch 425. BIGNUM *b, BN_CTX *ctx) 426. { 427. if (group->meth->group_get_curve == 0) { ^ 428. ECerr(EC_F_EC_GROUP_GET_CURVE_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); 429. return 0; crypto/ec/ec_lib.c:428:9: Skipping ERR_put_error(): empty list of specs 426. { 427. if (group->meth->group_get_curve == 0) { 428. ECerr(EC_F_EC_GROUP_GET_CURVE_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); ^ 429. return 0; 430. } crypto/ec/ec_lib.c:429:9: 427. if (group->meth->group_get_curve == 0) { 428. ECerr(EC_F_EC_GROUP_GET_CURVE_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); 429. > return 0; 430. } 431. return group->meth->group_get_curve(group, p, a, b, ctx); crypto/ec/ec_lib.c:432:1: return from a call to EC_GROUP_get_curve_GFp 430. } 431. return group->meth->group_get_curve(group, p, a, b, ctx); 432. > } 433. 434. #ifndef OPENSSL_NO_EC2M crypto/sm2/sm2_crypt.c:50:5: 48. 49. EC_GROUP_get_curve_GFp(group, p, a, b, NULL); 50. > field_size = (BN_num_bits(p) + 7) / 8; 51. 52. done: crypto/bn/bn_lib.c:134:1: start of procedure BN_num_bits() 132. } 133. 134. > int BN_num_bits(const BIGNUM *a) 135. { 136. int i = a->top - 1; crypto/bn/bn_lib.c:136:5: 134. int BN_num_bits(const BIGNUM *a) 135. { 136. > int i = a->top - 1; 137. bn_check_top(a); 138. crypto/bn/bn_lib.c:139:9: 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:814:1: start of procedure BN_is_zero() 812. } 813. 814. > int BN_is_zero(const BIGNUM *a) 815. { 816. return a->top == 0; crypto/bn/bn_lib.c:816:12: Condition is true 814. int BN_is_zero(const BIGNUM *a) 815. { 816. return a->top == 0; ^ 817. } 818. crypto/bn/bn_lib.c:816:5: 814. int BN_is_zero(const BIGNUM *a) 815. { 816. > return a->top == 0; 817. } 818. crypto/bn/bn_lib.c:817:1: return from a call to BN_is_zero 815. { 816. return a->top == 0; 817. > } 818. 819. int BN_is_one(const BIGNUM *a) crypto/bn/bn_lib.c:139:9: Taking true branch 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:140:9: 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_lib.c:142:1: return from a call to BN_num_bits 140. return 0; 141. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); 142. > } 143. 144. static void bn_free_d(BIGNUM *a) crypto/sm2/sm2_crypt.c:52:2: 50. field_size = (BN_num_bits(p) + 7) / 8; 51. 52. > done: 53. BN_free(p); 54. BN_free(a); crypto/sm2/sm2_crypt.c:53:5: Skipping BN_free(): empty list of specs 51. 52. done: 53. BN_free(p); ^ 54. BN_free(a); 55. BN_free(b); crypto/sm2/sm2_crypt.c:54:5: Skipping BN_free(): empty list of specs 52. done: 53. BN_free(p); 54. BN_free(a); ^ 55. BN_free(b); 56. crypto/sm2/sm2_crypt.c:55:5: Skipping BN_free(): empty list of specs 53. BN_free(p); 54. BN_free(a); 55. BN_free(b); ^ 56. 57. return field_size; crypto/sm2/sm2_crypt.c:57:5: 55. BN_free(b); 56. 57. > return field_size; 58. } 59. crypto/sm2/sm2_crypt.c:58:1: return from a call to EC_field_size 56. 57. return field_size; 58. > } 59. 60. size_t SM2_plaintext_size(const EC_KEY *key, const EVP_MD *digest, size_t msg_len) crypto/sm2/sm2_crypt.c:227:5: 225. 226. const size_t field_size = EC_field_size(group); 227. > const int hash_size = EVP_MD_size(digest); 228. 229. uint8_t *msg_mask = NULL; crypto/evp/evp_lib.c:301:1: start of procedure EVP_MD_size() 299. } 300. 301. > int EVP_MD_size(const EVP_MD *md) 302. { 303. if (!md) { crypto/evp/evp_lib.c:303:10: Taking false branch 301. int EVP_MD_size(const EVP_MD *md) 302. { 303. if (!md) { ^ 304. EVPerr(EVP_F_EVP_MD_SIZE, EVP_R_MESSAGE_DIGEST_IS_NULL); 305. return -1; crypto/evp/evp_lib.c:307:5: 305. return -1; 306. } 307. > return md->md_size; 308. } 309. crypto/evp/evp_lib.c:308:1: return from a call to EVP_MD_size 306. } 307. return md->md_size; 308. > } 309. 310. unsigned long EVP_MD_flags(const EVP_MD *md) crypto/sm2/sm2_crypt.c:229:5: 227. const int hash_size = EVP_MD_size(digest); 228. 229. > uint8_t *msg_mask = NULL; 230. const uint8_t *C2 = NULL; 231. const uint8_t *C3 = NULL; crypto/sm2/sm2_crypt.c:230:5: 228. 229. uint8_t *msg_mask = NULL; 230. > const uint8_t *C2 = NULL; 231. const uint8_t *C3 = NULL; 232. int msg_len = 0; crypto/sm2/sm2_crypt.c:231:5: 229. uint8_t *msg_mask = NULL; 230. const uint8_t *C2 = NULL; 231. > const uint8_t *C3 = NULL; 232. int msg_len = 0; 233. EVP_MD_CTX *hash = NULL; crypto/sm2/sm2_crypt.c:232:5: 230. const uint8_t *C2 = NULL; 231. const uint8_t *C3 = NULL; 232. > int msg_len = 0; 233. EVP_MD_CTX *hash = NULL; 234. crypto/sm2/sm2_crypt.c:233:5: 231. const uint8_t *C3 = NULL; 232. int msg_len = 0; 233. > EVP_MD_CTX *hash = NULL; 234. 235. if (field_size == 0 || hash_size == 0) crypto/sm2/sm2_crypt.c:235:9: Taking true branch 233. EVP_MD_CTX *hash = NULL; 234. 235. if (field_size == 0 || hash_size == 0) ^ 236. goto done; 237. crypto/sm2/sm2_crypt.c:321:2: 319. *ptext_len = msg_len; 320. 321. > done: 322. 323. if (rc == 0) crypto/sm2/sm2_crypt.c:323:9: Taking true branch 321. done: 322. 323. if (rc == 0) ^ 324. memset(ptext_buf, 0, *ptext_len); 325. crypto/sm2/sm2_crypt.c:324:9: 322. 323. if (rc == 0) 324. > memset(ptext_buf, 0, *ptext_len); 325. 326. OPENSSL_free(msg_mask); crypto/sm2/sm2_crypt.c:326:5: 324. memset(ptext_buf, 0, *ptext_len); 325. 326. > OPENSSL_free(msg_mask); 327. OPENSSL_free(x2y2); 328. OPENSSL_free(computed_C3); 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/sm2/sm2_crypt.c:327:5: 325. 326. OPENSSL_free(msg_mask); 327. > OPENSSL_free(x2y2); 328. OPENSSL_free(computed_C3); 329. EC_POINT_free(C1); 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/sm2/sm2_crypt.c:328:5: 326. OPENSSL_free(msg_mask); 327. OPENSSL_free(x2y2); 328. > OPENSSL_free(computed_C3); 329. EC_POINT_free(C1); 330. BN_CTX_free(ctx); 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/sm2/sm2_crypt.c:329:5: 327. OPENSSL_free(x2y2); 328. OPENSSL_free(computed_C3); 329. > EC_POINT_free(C1); 330. BN_CTX_free(ctx); 331. SM2_Ciphertext_free(sm2_ctext); 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_crypt.c:330:5: 328. OPENSSL_free(computed_C3); 329. EC_POINT_free(C1); 330. > BN_CTX_free(ctx); 331. SM2_Ciphertext_free(sm2_ctext); 332. EVP_MD_CTX_free(hash); 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_crypt.c/#L330
d2a_code_trace_data_44264
static int decode_block_progressive(MJpegDecodeContext *s, DCTELEM *block, int component, int dc_index, int ac_index, int16_t *quant_matrix, int ss, int se, int Ah, int Al, int *EOBRUN) { int code, i, j, level, val, run; if(!ss){ val = mjpeg_decode_dc(s, dc_index); if (val == 0xffff) { av_log(s->avctx, AV_LOG_ERROR, "error dc\n"); return -1; } val = (val * quant_matrix[0] << Al) + s->last_dc[component]; }else val = 0; s->last_dc[component] = val; block[0] = val; if(!se) return 0; if(*EOBRUN){ (*EOBRUN)--; return 0; } {OPEN_READER(re, &s->gb) for(i=ss;;i++) { UPDATE_CACHE(re, &s->gb); GET_VLC(code, re, &s->gb, s->vlcs[1][ac_index].table, 9, 2) code -= 16; if(code & 0xF) { i += ((unsigned) code) >> 4; code &= 0xf; if(code > MIN_CACHE_BITS - 16){ UPDATE_CACHE(re, &s->gb) } { int cache=GET_CACHE(re,&s->gb); int sign=(~cache)>>31; level = (NEG_USR32(sign ^ cache,code) ^ sign) - sign; } LAST_SKIP_BITS(re, &s->gb, code) if (i >= se) { if(i == se){ j = s->scantable.permutated[se]; block[j] = level * quant_matrix[j] << Al; break; } av_log(s->avctx, AV_LOG_ERROR, "error count: %d\n", i); return -1; } j = s->scantable.permutated[i]; block[j] = level * quant_matrix[j] << Al; }else{ run = ((unsigned) code) >> 4; if(run == 0xF){ i += 15; }else{ val = run; run = (1 << run); UPDATE_CACHE(re, &s->gb); run += (GET_CACHE(re, &s->gb) >> (32 - val)) & (run - 1); if(val) LAST_SKIP_BITS(re, &s->gb, val); *EOBRUN = run - 1; break; } } } CLOSE_READER(re, &s->gb)} return 0; } libavcodec/mjpegdec.c:1300: error: Buffer Overrun L3 Offset: 3 Size: [0, +oo] by call to `ff_mjpeg_decode_sos`. libavcodec/mjpegdec.c:1106:1: Parameter `avctx->priv_data->buffer` 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:1160:21: Call 1158. } 1159. } 1160. init_get_bits(&s->gb, s->buffer, (dst - s->buffer)*8); ^ 1161. 1162. av_log(avctx, AV_LOG_DEBUG, "escaping removed %td bytes\n", libavcodec/bitstream.h:758:1: Parameter `*buffer` 756. * @param bit_size the size of the buffer in bits 757. */ 758. static inline void init_get_bits(GetBitContext *s, ^ 759. const uint8_t *buffer, int bit_size) 760. { libavcodec/bitstream.h:767:5: Assignment 765. } 766. 767. s->buffer= buffer; ^ 768. s->size_in_bits= bit_size; 769. s->buffer_end= buffer + buffer_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: Parameter `*s->gb.buffer` 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:848:12: Call 846. } 847. }else{ 848. if(mjpeg_decode_scan(s, nb_components, predictor, ilv, prev_shift, point_transform) < 0) ^ 849. return -1; 850. } libavcodec/mjpegdec.c:660:1: Parameter `*s->gb.buffer` 658. } 659. 660. static int mjpeg_decode_scan(MJpegDecodeContext *s, int nb_components, int ss, int se, int Ah, int Al){ ^ 661. int i, mb_x, mb_y; 662. int EOBRUN = 0; libavcodec/mjpegdec.c:702:43: Call 700. return -1; 701. } 702. if (s->progressive && decode_block_progressive(s, s->block, i, ^ 703. s->dc_index[i], s->ac_index[i], 704. s->quant_matrixes[ s->quant_index[c] ], ss, se, Ah, Al, &EOBRUN) < 0) { libavcodec/mjpegdec.c:433:1: <Length trace> 431. 432. /* decode block and dequantize - progressive JPEG version */ 433. static int decode_block_progressive(MJpegDecodeContext *s, DCTELEM *block, ^ 434. int component, int dc_index, int ac_index, int16_t *quant_matrix, 435. int ss, int se, int Ah, int Al, int *EOBRUN) libavcodec/mjpegdec.c:433:1: Parameter `*s->gb.buffer` 431. 432. /* decode block and dequantize - progressive JPEG version */ 433. static int decode_block_progressive(MJpegDecodeContext *s, DCTELEM *block, ^ 434. int component, int dc_index, int ac_index, int16_t *quant_matrix, 435. int ss, int se, int Ah, int Al, int *EOBRUN) libavcodec/mjpegdec.c:467:17: Array access: Offset: 3 Size: [0, +oo] by call to `ff_mjpeg_decode_sos` 465. code &= 0xf; 466. if(code > MIN_CACHE_BITS - 16){ 467. UPDATE_CACHE(re, &s->gb) ^ 468. } 469. {
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mjpegdec.c/#L467
d2a_code_trace_data_44265
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_gcd.c:346: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_div`. Showing all 30 steps of the trace crypto/bn/bn_gcd.c:135:1: Parameter `ctx->stack.depth` 133. } 134. 135. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 136. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 137. int *pnoinv) crypto/bn/bn_gcd.c:161:5: Call 159. bn_check_top(n); 160. 161. BN_CTX_start(ctx); ^ 162. A = BN_CTX_get(ctx); 163. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gcd.c:162:9: Call 160. 161. BN_CTX_start(ctx); 162. A = BN_CTX_get(ctx); ^ 163. B = BN_CTX_get(ctx); 164. X = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:163:9: Call 161. BN_CTX_start(ctx); 162. A = BN_CTX_get(ctx); 163. B = BN_CTX_get(ctx); ^ 164. X = BN_CTX_get(ctx); 165. D = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:164:9: Call 162. A = BN_CTX_get(ctx); 163. B = BN_CTX_get(ctx); 164. X = BN_CTX_get(ctx); ^ 165. D = BN_CTX_get(ctx); 166. M = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:165:9: Call 163. B = BN_CTX_get(ctx); 164. X = BN_CTX_get(ctx); 165. D = BN_CTX_get(ctx); ^ 166. M = BN_CTX_get(ctx); 167. Y = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:166:9: Call 164. X = BN_CTX_get(ctx); 165. D = BN_CTX_get(ctx); 166. M = BN_CTX_get(ctx); ^ 167. Y = BN_CTX_get(ctx); 168. T = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:167:9: Call 165. D = BN_CTX_get(ctx); 166. M = BN_CTX_get(ctx); 167. Y = BN_CTX_get(ctx); ^ 168. T = BN_CTX_get(ctx); 169. if (T == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:168:9: Call 166. M = BN_CTX_get(ctx); 167. Y = BN_CTX_get(ctx); 168. T = BN_CTX_get(ctx); ^ 169. if (T == NULL) 170. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:346:22: Call 344. } 345. } else { 346. if (!BN_div(D, M, A, B, ctx)) ^ 347. goto err; 348. } 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_44266
int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *x, int vfy) { int rv, start_idx, i; if (x == NULL) { x = sk_X509_value(sk, 0); start_idx = 1; } else start_idx = 0; rv = ssl_security_cert(s, NULL, x, vfy, 1); if (rv != 1) return rv; for (i = start_idx; i < sk_X509_num(sk); i++) { x = sk_X509_value(sk, i); rv = ssl_security_cert(s, NULL, x, vfy, 0); if (rv != 1) return rv; } return 1; } ssl/t1_lib.c:4181: error: NULL_DEREFERENCE pointer `null` is dereferenced by call to `ssl_security_cert()` at line 4181, column 10. Showing all 4 steps of the trace ssl/t1_lib.c:4172:1: start of procedure ssl_security_cert_chain() 4170. */ 4171. 4172. > int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *x, int vfy) 4173. { 4174. int rv, start_idx, i; ssl/t1_lib.c:4175:9: Taking false branch 4173. { 4174. int rv, start_idx, i; 4175. if (x == NULL) { ^ 4176. x = sk_X509_value(sk, 0); 4177. start_idx = 1; ssl/t1_lib.c:4179:9: 4177. start_idx = 1; 4178. } else 4179. > start_idx = 0; 4180. 4181. rv = ssl_security_cert(s, NULL, x, vfy, 1); ssl/t1_lib.c:4181:5: 4179. start_idx = 0; 4180. 4181. > rv = ssl_security_cert(s, NULL, x, vfy, 1); 4182. if (rv != 1) 4183. return rv;
https://github.com/openssl/openssl/blob/91056e72693b4ee8cb5339d9091871ffc3b6f776/ssl/t1_lib.c/#L4181
d2a_code_trace_data_44267
int test_sub(BIO *bp) { BIGNUM *a, *b, *c; int i; a = BN_new(); b = BN_new(); c = BN_new(); for (i = 0; i < num0 + num1; i++) { if (i < num1) { BN_bntest_rand(a, 512, 0, 0); BN_copy(b, a); if (BN_set_bit(a, i) == 0) return (0); BN_add_word(b, i); } else { BN_bntest_rand(b, 400 + i - num1, 0, 0); a->neg = rand_neg(); b->neg = rand_neg(); } BN_sub(c, a, b); if (bp != NULL) { if (!results) { BN_print(bp, a); BIO_puts(bp, " - "); BN_print(bp, b); BIO_puts(bp, " - "); } BN_print(bp, c); BIO_puts(bp, "\n"); } BN_add(c, c, b); BN_sub(c, c, a); if (!BN_is_zero(c)) { fprintf(stderr, "Subtract test failed!\n"); return 0; } } BN_free(a); BN_free(b); BN_free(c); return (1); } test/bntest.c:435: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 401, column 9 is not reachable after line 435, column 5. Showing all 108 steps of the trace test/bntest.c:394:1: start of procedure test_sub() 392. } 393. 394. > int test_sub(BIO *bp) 395. { 396. BIGNUM *a, *b, *c; test/bntest.c:399:5: 397. int i; 398. 399. > a = BN_new(); 400. b = BN_new(); 401. c = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:400:5: 398. 399. a = BN_new(); 400. > b = BN_new(); 401. c = BN_new(); 402. crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:401:5: 399. a = BN_new(); 400. b = BN_new(); 401. > c = BN_new(); 402. 403. for (i = 0; i < num0 + num1; i++) { crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:403:10: 401. c = BN_new(); 402. 403. > for (i = 0; i < num0 + num1; i++) { 404. if (i < num1) { 405. BN_bntest_rand(a, 512, 0, 0); test/bntest.c:403:17: Loop condition is false. Leaving loop 401. c = BN_new(); 402. 403. for (i = 0; i < num0 + num1; i++) { ^ 404. if (i < num1) { 405. BN_bntest_rand(a, 512, 0, 0); test/bntest.c:433:5: 431. } 432. } 433. > BN_free(a); 434. BN_free(b); 435. BN_free(c); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a) test/bntest.c:434:5: 432. } 433. BN_free(a); 434. > BN_free(b); 435. BN_free(c); 436. return (1); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a) test/bntest.c:435:5: 433. BN_free(a); 434. BN_free(b); 435. > BN_free(c); 436. return (1); 437. } crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a)
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L435
d2a_code_trace_data_44268
int av_new_packet(AVPacket *pkt, int size) { uint8_t *data; if((unsigned)size > (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) return AVERROR(ENOMEM); data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); if (!data) return AVERROR(ENOMEM); memset(data + size, 0, FF_INPUT_BUFFER_PADDING_SIZE); av_init_packet(pkt); pkt->data = data; pkt->size = size; pkt->destruct = av_destruct_packet; return 0; } libavformat/idroq.c:237: error: Integer Overflow L2 ([-oo, 2147483655] + 8):signed32 by call to `av_new_packet`. libavformat/idroq.c:197:9: Assignment 195. 196. chunk_type = AV_RL16(&preamble[0]); 197. chunk_size = AV_RL32(&preamble[2]); ^ 198. if(chunk_size > INT_MAX) 199. return AVERROR_INVALIDDATA; libavformat/idroq.c:237:17: Call 235. case RoQ_QUAD_VQ: 236. /* load up the packet */ 237. if (av_new_packet(pkt, chunk_size + RoQ_CHUNK_PREAMBLE_SIZE)) ^ 238. return AVERROR(EIO); 239. /* copy over preamble */ libavformat/utils.c:205:1: <LHS trace> 203. } 204. 205. int av_new_packet(AVPacket *pkt, int size) ^ 206. { 207. uint8_t *data; libavformat/utils.c:205:1: Parameter `size` 203. } 204. 205. int av_new_packet(AVPacket *pkt, int size) ^ 206. { 207. uint8_t *data; libavformat/utils.c:210:12: Binary operation: ([-oo, 2147483655] + 8):signed32 by call to `av_new_packet` 208. if((unsigned)size > (unsigned)size + FF_INPUT_BUFFER_PADDING_SIZE) 209. return AVERROR(ENOMEM); 210. data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE); ^ 211. if (!data) 212. return AVERROR(ENOMEM);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/utils.c/#L210
d2a_code_trace_data_44269
static void opt_streamid(const char *opt, const char *arg) { int idx; char *p; char idx_str[16]; strncpy(idx_str, arg, sizeof(idx_str)); idx_str[sizeof(idx_str)-1] = '\0'; p = strchr(idx_str, ':'); if (!p) { fprintf(stderr, "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", arg, opt); ffmpeg_exit(1); } *p++ = '\0'; idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1); streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); } ffmpeg.c:3654: error: Null Dereference pointer `p` last assigned on line 3654 could be null and is dereferenced at line 3654, column 5. ffmpeg.c:3639:1: start of procedure opt_streamid() 3637. 3638. /* arg format is "output-stream-index:streamid-value". */ 3639. static void opt_streamid(const char *opt, const char *arg) ^ 3640. { 3641. int idx; ffmpeg.c:3645:5: 3643. char idx_str[16]; 3644. 3645. strncpy(idx_str, arg, sizeof(idx_str)); ^ 3646. idx_str[sizeof(idx_str)-1] = '\0'; 3647. p = strchr(idx_str, ':'); ffmpeg.c:3646:5: 3644. 3645. strncpy(idx_str, arg, sizeof(idx_str)); 3646. idx_str[sizeof(idx_str)-1] = '\0'; ^ 3647. p = strchr(idx_str, ':'); 3648. if (!p) { ffmpeg.c:3647:5: 3645. strncpy(idx_str, arg, sizeof(idx_str)); 3646. idx_str[sizeof(idx_str)-1] = '\0'; 3647. p = strchr(idx_str, ':'); ^ 3648. if (!p) { 3649. fprintf(stderr, ffmpeg.c:3648:10: Taking true branch 3646. idx_str[sizeof(idx_str)-1] = '\0'; 3647. p = strchr(idx_str, ':'); 3648. if (!p) { ^ 3649. fprintf(stderr, 3650. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", ffmpeg.c:3649:9: 3647. p = strchr(idx_str, ':'); 3648. if (!p) { 3649. fprintf(stderr, ^ 3650. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", 3651. arg, opt); ffmpeg.c:3652:9: Skipping ffmpeg_exit(): empty list of specs 3650. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", 3651. arg, opt); 3652. ffmpeg_exit(1); ^ 3653. } 3654. *p++ = '\0'; ffmpeg.c:3654:5: 3652. ffmpeg_exit(1); 3653. } 3654. *p++ = '\0'; ^ 3655. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1); 3656. streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);
https://github.com/libav/libav/blob/ad0d70c964f852a18e9ab8124f0e7aa8876cac6e/ffmpeg.c/#L3654
d2a_code_trace_data_44270
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } crypto/bn/bn_prime.c:497: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_add`. Showing all 32 steps of the trace crypto/bn/bn_prime.c:471:10: Call 469. goto err; 470. 471. if (!BN_rand(rnd, bits, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD)) ^ 472. goto err; 473. crypto/bn/bn_rand.c:108:12: Call 106. int BN_rand(BIGNUM *rnd, int bits, int top, int bottom) 107. { 108. return bnrand(NORMAL, rnd, bits, top, bottom, NULL); ^ 109. } 110. crypto/bn/bn_rand.c:23:1: Parameter `rnd->top` 21. } BNRAND_FLAG; 22. 23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, 24. BN_CTX *ctx) 25. { crypto/bn/bn_prime.c:476:10: Call 474. /* we need ((rnd-rem) % add) == 0 */ 475. 476. if (!BN_mod(t1, rnd, add, ctx)) ^ 477. goto err; 478. if (!BN_sub(rnd, rnd, t1)) crypto/bn/bn_div.c:209:1: Parameter `num->top` 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_prime.c:478:10: Call 476. if (!BN_mod(t1, rnd, add, ctx)) 477. goto err; 478. if (!BN_sub(rnd, rnd, t1)) ^ 479. goto err; 480. if (rem == NULL) { crypto/bn/bn_add.c:45:1: Parameter `a->top` 43. 44. /* signed sub of b from a. */ 45. > int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 46. { 47. int ret, r_neg, cmp_res; crypto/bn/bn_prime.c:481:14: Call 479. goto err; 480. if (rem == NULL) { 481. if (!BN_add_word(rnd, 1)) ^ 482. goto err; 483. } else { crypto/bn/bn_word.c:98:1: Parameter `a->top` 96. } 97. 98. > int BN_add_word(BIGNUM *a, BN_ULONG w) 99. { 100. BN_ULONG l; crypto/bn/bn_prime.c:493:24: Call 491. for (i = 1; i < NUMPRIMES; i++) { 492. /* check that rnd is a prime */ 493. BN_ULONG mod = BN_mod_word(rnd, (BN_ULONG)primes[i]); ^ 494. if (mod == (BN_ULONG)-1) 495. goto err; crypto/bn/bn_word.c:13:1: Parameter `a->top` 11. #include "bn_lcl.h" 12. 13. > BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w) 14. { 15. #ifndef BN_LLONG crypto/bn/bn_prime.c:497:18: Call 495. goto err; 496. if (mod <= 1) { 497. if (!BN_add(rnd, rnd, add)) ^ 498. goto err; 499. goto loop; crypto/bn/bn_add.c:14:1: Parameter `r->top` 12. 13. /* signed add of b to a. */ 14. > int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 15. { 16. int ret, r_neg, cmp_res; crypto/bn/bn_add.c:31:19: Call 29. } else if (cmp_res < 0) { 30. r_neg = b->neg; 31. ret = BN_usub(r, b, a); ^ 32. } else { 33. r_neg = 0; crypto/bn/bn_add.c:125:1: Parameter `r->top` 123. 124. /* unsigned subtraction of b from a, a must be larger than b. */ 125. > int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 126. { 127. int max, min, dif; crypto/bn/bn_add.c:143:9: Call 141. } 142. 143. if (bn_wexpand(r, max) == NULL) ^ 144. return 0; 145. crypto/bn/bn_lib.c:962:1: Parameter `a->top` 960. } 961. 962. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 963. { 964. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:964:37: Call 962. BIGNUM *bn_wexpand(BIGNUM *a, int words) 963. { 964. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 965. } 966. crypto/bn/bn_lib.c:245:1: Parameter `b->top` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `words` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:224:13: Call 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/mem.c:228:1: Parameter `num` 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:17: Call 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/mem.c:230:5: Assignment 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:235:5: Assignment 233. if (ret != NULL) 234. memset(ret, 0, num); 235. return ret; ^ 236. } 237. crypto/bn/bn_lib.c:224:9: Assignment 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_add` 230. assert(b->top <= words); 231. if (b->top > 0) 232. memcpy(a, b->d, sizeof(*a) * b->top); ^ 233. 234. return a;
https://github.com/openssl/openssl/blob/bd01733fdd9a5a0acdc72cf5c6601d37e8ddd801/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_44271
static inline uint64_t get_val(BitstreamContext *bc, unsigned n) { #ifdef BITSTREAM_READER_LE uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1); bc->bits >>= n; #else uint64_t ret = bc->bits >> (64 - n); bc->bits <<= n; #endif bc->bits_left -= n; return ret; } libavcodec/takdec.c:468: error: Integer Overflow L2 ([1, +oo] - 3):unsigned32 by call to `bitstream_read`. libavcodec/takdec.c:468:25: Call 466. filter_quant = 10; 467. if (bitstream_read_bit(bc)) { 468. filter_quant -= bitstream_read(bc, 3) + 1; ^ 469. if (filter_quant < 3) 470. return AVERROR_INVALIDDATA; libavcodec/bitstream.h:183:1: Parameter `n` 181. 182. /* Return n bits from the buffer. n has to be in the 0-32 range. */ 183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n) ^ 184. { 185. if (!n) libavcodec/bitstream.h:194:12: Call 192. } 193. 194. return get_val(bc, n); ^ 195. } 196. libavcodec/bitstream.h:130:1: <LHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `bc->bits_left` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: <RHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Binary operation: ([1, +oo] - 3):unsigned32 by call to `bitstream_read` 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret;
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L139
d2a_code_trace_data_44272
static int decode_residual(H264Context *h, GetBitContext *gb, DCTELEM *block, int n, const uint8_t *scantable, const uint32_t *qmul, int max_coeff){ MpegEncContext * const s = &h->s; static const int coeff_token_table_index[17]= {0, 0, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3}; int level[16]; int zeros_left, coeff_num, coeff_token, total_coeff, i, j, trailing_ones, run_before; if(n == CHROMA_DC_BLOCK_INDEX){ coeff_token= get_vlc2(gb, chroma_dc_coeff_token_vlc.table, CHROMA_DC_COEFF_TOKEN_VLC_BITS, 1); total_coeff= coeff_token>>2; }else{ if(n == LUMA_DC_BLOCK_INDEX){ total_coeff= pred_non_zero_count(h, 0); coeff_token= get_vlc2(gb, coeff_token_vlc[ coeff_token_table_index[total_coeff] ].table, COEFF_TOKEN_VLC_BITS, 2); total_coeff= coeff_token>>2; }else{ total_coeff= pred_non_zero_count(h, n); coeff_token= get_vlc2(gb, coeff_token_vlc[ coeff_token_table_index[total_coeff] ].table, COEFF_TOKEN_VLC_BITS, 2); total_coeff= coeff_token>>2; h->non_zero_count_cache[ scan8[n] ]= total_coeff; } } if(total_coeff==0) return 0; if(total_coeff > (unsigned)max_coeff) { av_log(h->s.avctx, AV_LOG_ERROR, "corrupted macroblock %d %d (total_coeff=%d)\n", s->mb_x, s->mb_y, total_coeff); return -1; } trailing_ones= coeff_token&3; tprintf(h->s.avctx, "trailing:%d, total:%d\n", trailing_ones, total_coeff); assert(total_coeff<=16); for(i=0; i<trailing_ones; i++){ level[i]= 1 - 2*get_bits1(gb); } if(i<total_coeff) { int level_code, mask; int suffix_length = total_coeff > 10 && trailing_ones < 3; int prefix= get_level_prefix(gb); if(prefix<14){ if(suffix_length) level_code= (prefix<<suffix_length) + get_bits(gb, suffix_length); else level_code= (prefix<<suffix_length); }else if(prefix==14){ if(suffix_length) level_code= (prefix<<suffix_length) + get_bits(gb, suffix_length); else level_code= prefix + get_bits(gb, 4); }else if(prefix==15){ level_code= (prefix<<suffix_length) + get_bits(gb, 12); if(suffix_length==0) level_code+=15; }else{ av_log(h->s.avctx, AV_LOG_ERROR, "prefix too large at %d %d\n", s->mb_x, s->mb_y); return -1; } if(trailing_ones < 3) level_code += 2; suffix_length = 1; if(level_code > 5) suffix_length++; mask= -(level_code&1); level[i]= (((2+level_code)>>1) ^ mask) - mask; i++; for(;i<total_coeff;i++) { static const int suffix_limit[7] = {0,5,11,23,47,95,INT_MAX }; prefix = get_level_prefix(gb); if(prefix<15){ level_code = (prefix<<suffix_length) + get_bits(gb, suffix_length); }else if(prefix==15){ level_code = (prefix<<suffix_length) + get_bits(gb, 12); }else{ av_log(h->s.avctx, AV_LOG_ERROR, "prefix too large at %d %d\n", s->mb_x, s->mb_y); return -1; } mask= -(level_code&1); level[i]= (((2+level_code)>>1) ^ mask) - mask; if(level_code > suffix_limit[suffix_length]) suffix_length++; } } if(total_coeff == max_coeff) zeros_left=0; else{ if(n == CHROMA_DC_BLOCK_INDEX) zeros_left= get_vlc2(gb, chroma_dc_total_zeros_vlc[ total_coeff-1 ].table, CHROMA_DC_TOTAL_ZEROS_VLC_BITS, 1); else zeros_left= get_vlc2(gb, total_zeros_vlc[ total_coeff-1 ].table, TOTAL_ZEROS_VLC_BITS, 1); } coeff_num = zeros_left + total_coeff - 1; j = scantable[coeff_num]; if(n > 24){ block[j] = level[0]; for(i=1;i<total_coeff;i++) { if(zeros_left <= 0) run_before = 0; else if(zeros_left < 7){ run_before= get_vlc2(gb, run_vlc[zeros_left-1].table, RUN_VLC_BITS, 1); }else{ run_before= get_vlc2(gb, run7_vlc.table, RUN7_VLC_BITS, 2); } zeros_left -= run_before; coeff_num -= 1 + run_before; j= scantable[ coeff_num ]; block[j]= level[i]; } }else{ block[j] = (level[0] * qmul[j] + 32)>>6; for(i=1;i<total_coeff;i++) { if(zeros_left <= 0) run_before = 0; else if(zeros_left < 7){ run_before= get_vlc2(gb, run_vlc[zeros_left-1].table, RUN_VLC_BITS, 1); }else{ run_before= get_vlc2(gb, run7_vlc.table, RUN7_VLC_BITS, 2); } zeros_left -= run_before; coeff_num -= 1 + run_before; j= scantable[ coeff_num ]; block[j]= (level[i] * qmul[j] + 32)>>6; } } if(zeros_left<0){ av_log(h->s.avctx, AV_LOG_ERROR, "negative number of zero coeffs at %d %d\n", s->mb_x, s->mb_y); return -1; } return 0; } libavcodec/h264.c:4416: error: Uninitialized Value The value read from level[_] was never initialized. libavcodec/h264.c:4416:9: 4414. } 4415. }else{ 4416. block[j] = (level[0] * qmul[j] + 32)>>6; ^ 4417. for(i=1;i<total_coeff;i++) { 4418. if(zeros_left <= 0)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L4416
d2a_code_trace_data_44273
void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) { unsigned long hash; OPENSSL_LH_NODE *nn, **rn; void *ret; lh->error = 0; rn = getrn(lh, data, &hash); if (*rn == NULL) { lh->num_no_delete++; return (NULL); } else { nn = *rn; *rn = nn->next; ret = nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))) contract(lh); return (ret); } apps/s_time.c:264: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `SSL_free`. Showing all 17 steps of the trace apps/s_time.c:231:21: Call 229. break; 230. 231. if ((scon = doConnection(NULL, host, ctx)) == NULL) ^ 232. goto end; 233. apps/s_time.c:385:21: Call 383. 384. if (scon == NULL) 385. serverCon = SSL_new(ctx); ^ 386. else { 387. serverCon = scon; ssl/ssl_lib.c:518:1: Parameter `ctx->sessions->num_items` 516. } 517. 518. > SSL *SSL_new(SSL_CTX *ctx) 519. { 520. SSL *s; apps/s_time.c:264:9: Call 262. fflush(stdout); 263. 264. SSL_free(scon); ^ 265. scon = NULL; 266. } ssl/ssl_lib.c:926:1: Parameter `s->initial_ctx->sessions->num_items` 924. } 925. 926. > void SSL_free(SSL *s) 927. { 928. int i; ssl/ssl_lib.c:963:9: Call 961. /* Make the next call work :-) */ 962. if (s->session != NULL) { 963. ssl_clear_bad_session(s); ^ 964. SSL_SESSION_free(s->session); 965. } ssl/ssl_sess.c:992:1: Parameter `s->initial_ctx->sessions->num_items` 990. } 991. 992. > int ssl_clear_bad_session(SSL *s) 993. { 994. if ((s->session != NULL) && ssl/ssl_sess.c:997:9: Call 995. !(s->shutdown & SSL_SENT_SHUTDOWN) && 996. !(SSL_in_init(s) || SSL_in_before(s))) { 997. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 998. return (1); 999. } else ssl/ssl_sess.c:691:1: Parameter `ctx->sessions->num_items` 689. } 690. 691. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 692. { 693. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:693:12: Call 691. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 692. { 693. return remove_session_lock(ctx, c, 1); ^ 694. } 695. ssl/ssl_sess.c:696:1: Parameter `ctx->sessions->num_items` 694. } 695. 696. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 697. { 698. SSL_SESSION *r; ssl/ssl_sess.c:706:17: Call 704. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 705. ret = 1; 706. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 707. SSL_SESSION_list_remove(ctx, c); 708. } ssl/ssl_locl.h:581:1: Parameter `lh->num_items` 579. }; 580. 581. > DEFINE_LHASH_OF(SSL_SESSION); 582. /* Needed in ssl_cert.c */ 583. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:581:1: Call 579. }; 580. 581. > DEFINE_LHASH_OF(SSL_SESSION); 582. /* Needed in ssl_cert.c */ 583. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:103:1: <LHS trace> 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:103:1: Parameter `lh->num_items` 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:123:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `SSL_free` 121. } 122. 123. lh->num_items--; ^ 124. if ((lh->num_nodes > MIN_NODES) && 125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
https://github.com/openssl/openssl/blob/2a7de0fd5d9baf946ef4d2c51096b04dd47a8143/crypto/lhash/lhash.c/#L123
d2a_code_trace_data_44274
void avfilter_unref_buffer(AVFilterBufferRef *ref) { if (!ref) return; if (!(--ref->buf->refcount)) ref->buf->free(ref->buf); if (ref->extended_data != ref->data) av_freep(&ref->extended_data); av_free(ref->video); av_free(ref->audio); av_free(ref); } libavfilter/buffer.c:89: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer`. libavfilter/buffer.c:89:5: Call 87. void avfilter_unref_bufferp(AVFilterBufferRef **ref) 88. { 89. avfilter_unref_buffer(*ref); ^ 90. *ref = NULL; 91. } libavfilter/buffer.c:74:1: <LHS trace> 72. } 73. 74. void avfilter_unref_buffer(AVFilterBufferRef *ref) ^ 75. { 76. if (!ref) libavfilter/buffer.c:74:1: Parameter `ref->buf->refcount` 72. } 73. 74. void avfilter_unref_buffer(AVFilterBufferRef *ref) ^ 75. { 76. if (!ref) libavfilter/buffer.c:78:11: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer` 76. if (!ref) 77. return; 78. if (!(--ref->buf->refcount)) ^ 79. ref->buf->free(ref->buf); 80. if (ref->extended_data != ref->data)
https://github.com/libav/libav/blob/b70d89a033dacf53758256f875f1b23ce0ae13f1/libavfilter/buffer.c/#L78
d2a_code_trace_data_44275
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:1103: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + `s->srp_ctx.login->strlen` + `s->tlsext_hostname->strlen` + 32]):unsigned64 by call to `WPACKET_start_sub_packet_len__`. Showing all 12 steps of the trace ssl/t1_lib.c:1101:14: Call 1099. tls1_get_formatlist(s, &pformats, &num_formats); 1100. 1101. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats) ^ 1102. /* Sub-packet for formats extension */ 1103. || !WPACKET_start_sub_packet_u16(pkt) ssl/packet.c: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:1103:21: Call 1101. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats) 1102. /* Sub-packet for formats extension */ 1103. || !WPACKET_start_sub_packet_u16(pkt) ^ 1104. || !WPACKET_sub_memcpy_u8(pkt, pformats, num_formats) 1105. || !WPACKET_close(pkt)) { ssl/packet.c: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] - [0, s->s3->previous_client_finished_len + pkt->written + s->srp_ctx.login->strlen + s->tlsext_hostname->strlen + 32]):unsigned64 by call to `WPACKET_start_sub_packet_len__` 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_44276
static int JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result) { if (data->bufferbytesleft==0) { uint32 m; if (data->filebytesleft==0) return(0); if (!data->filepositioned) { TIFFSeekFile(data->tif,data->fileoffset,SEEK_SET); data->filepositioned=1; } m=data->buffersize; if ((uint64)m>data->filebytesleft) m=(uint32)data->filebytesleft; assert(m<0x80000000UL); if (TIFFReadFile(data->tif,data->buffer,(tmsize_t)m)!=(tmsize_t)m) return(0); data->buffercurrentbyte=data->buffer; data->bufferbytesleft=m; data->fileoffset+=m; data->filebytesleft-=m; } *result=*data->buffercurrentbyte; data->buffercurrentbyte++; data->bufferbytesleft--; return(1); } libtiff/tif_jpeg.c:752: error: Integer Overflow L2 ([1, +oo] - [0, 2147483647]):unsigned64 by call to `JPEGFixupTagsSubsamplingReadByte`. libtiff/tif_jpeg.c:743:1: Parameter `data->filebytesleft` 741. } 742. 743. static int ^ 744. JPEGFixupTagsSubsamplingSec(struct JPEGFixupTagsSubsamplingData* data) 745. { libtiff/tif_jpeg.c:752:9: Call 750. while (1) 751. { 752. if (!JPEGFixupTagsSubsamplingReadByte(data,&m)) ^ 753. return(0); 754. if (m==255) libtiff/tif_jpeg.c:855:1: <LHS trace> 853. } 854. 855. static int ^ 856. JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result) 857. { libtiff/tif_jpeg.c:855:1: Parameter `data->filebytesleft` 853. } 854. 855. static int ^ 856. JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result) 857. { libtiff/tif_jpeg.c:872:7: <RHS trace> 870. m=(uint32)data->filebytesleft; 871. assert(m<0x80000000UL); 872. if (TIFFReadFile(data->tif,data->buffer,(tmsize_t)m)!=(tmsize_t)m) ^ 873. return(0); 874. data->buffercurrentbyte=data->buffer; libtiff/tif_jpeg.c:872:7: Unknown value from: non-const function 870. m=(uint32)data->filebytesleft; 871. assert(m<0x80000000UL); 872. if (TIFFReadFile(data->tif,data->buffer,(tmsize_t)m)!=(tmsize_t)m) ^ 873. return(0); 874. data->buffercurrentbyte=data->buffer; libtiff/tif_jpeg.c:877:3: Binary operation: ([1, +oo] - [0, 2147483647]):unsigned64 by call to `JPEGFixupTagsSubsamplingReadByte` 875. data->bufferbytesleft=m; 876. data->fileoffset+=m; 877. data->filebytesleft-=m; ^ 878. } 879. *result=*data->buffercurrentbyte;
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_jpeg.c/#L877
d2a_code_trace_data_44277
static SwsVector *sws_sumVec(SwsVector *a, SwsVector *b){ int length= FFMAX(a->length, b->length); double *coeff= av_malloc(length*sizeof(double)); int i; SwsVector *vec= av_malloc(sizeof(SwsVector)); vec->coeff= coeff; vec->length= length; for (i=0; i<length; i++) coeff[i]= 0.0; for (i=0; i<a->length; i++) coeff[i + (length-1)/2 - (a->length-1)/2]+= a->coeff[i]; for (i=0; i<b->length; i++) coeff[i + (length-1)/2 - (b->length-1)/2]+= b->coeff[i]; return vec; } libswscale/swscale.c:2977: error: Null Dereference pointer `vec` last assigned on line 2975 could be null and is dereferenced at line 2977, column 5. libswscale/swscale.c:2971:1: start of procedure sws_sumVec() 2969. } 2970. 2971. static SwsVector *sws_sumVec(SwsVector *a, SwsVector *b){ ^ 2972. int length= FFMAX(a->length, b->length); 2973. double *coeff= av_malloc(length*sizeof(double)); libswscale/swscale.c:2972:17: Condition is true 2970. 2971. static SwsVector *sws_sumVec(SwsVector *a, SwsVector *b){ 2972. int length= FFMAX(a->length, b->length); ^ 2973. double *coeff= av_malloc(length*sizeof(double)); 2974. int i; libswscale/swscale.c:2972:5: 2970. 2971. static SwsVector *sws_sumVec(SwsVector *a, SwsVector *b){ 2972. int length= FFMAX(a->length, b->length); ^ 2973. double *coeff= av_malloc(length*sizeof(double)); 2974. int i; libswscale/swscale.c:2973:5: 2971. static SwsVector *sws_sumVec(SwsVector *a, SwsVector *b){ 2972. int length= FFMAX(a->length, b->length); 2973. double *coeff= av_malloc(length*sizeof(double)); ^ 2974. int i; 2975. SwsVector *vec= av_malloc(sizeof(SwsVector)); libavutil/mem.c:47:1: start of procedure av_malloc() 45. linker will do it automatically. */ 46. 47. void *av_malloc(unsigned int size) ^ 48. { 49. void *ptr = NULL; libavutil/mem.c:49:5: 47. void *av_malloc(unsigned int size) 48. { 49. void *ptr = NULL; ^ 50. #if CONFIG_MEMALIGN_HACK 51. long diff; libavutil/mem.c:55:8: Taking false branch 53. 54. /* let's disallow possible ambiguous cases */ 55. if(size > (INT_MAX-16) ) ^ 56. return NULL; 57. libavutil/mem.c:66:9: Taking false branch 64. ((char*)ptr)[-1]= diff; 65. #elif HAVE_POSIX_MEMALIGN 66. if (posix_memalign(&ptr,16,size)) ^ 67. ptr = NULL; 68. #elif HAVE_MEMALIGN libavutil/mem.c:99:5: 97. ptr = malloc(size); 98. #endif 99. return ptr; ^ 100. } 101. libavutil/mem.c:100:1: return from a call to av_malloc 98. #endif 99. return ptr; 100. } ^ 101. 102. void *av_realloc(void *ptr, unsigned int size) libswscale/swscale.c:2975:5: 2973. double *coeff= av_malloc(length*sizeof(double)); 2974. int i; 2975. SwsVector *vec= av_malloc(sizeof(SwsVector)); ^ 2976. 2977. vec->coeff= coeff; libavutil/mem.c:47:1: start of procedure av_malloc() 45. linker will do it automatically. */ 46. 47. void *av_malloc(unsigned int size) ^ 48. { 49. void *ptr = NULL; libavutil/mem.c:49:5: 47. void *av_malloc(unsigned int size) 48. { 49. void *ptr = NULL; ^ 50. #if CONFIG_MEMALIGN_HACK 51. long diff; libavutil/mem.c:55:8: Taking false branch 53. 54. /* let's disallow possible ambiguous cases */ 55. if(size > (INT_MAX-16) ) ^ 56. return NULL; 57. libavutil/mem.c:66:9: Taking true branch 64. ((char*)ptr)[-1]= diff; 65. #elif HAVE_POSIX_MEMALIGN 66. if (posix_memalign(&ptr,16,size)) ^ 67. ptr = NULL; 68. #elif HAVE_MEMALIGN libavutil/mem.c:67:9: 65. #elif HAVE_POSIX_MEMALIGN 66. if (posix_memalign(&ptr,16,size)) 67. ptr = NULL; ^ 68. #elif HAVE_MEMALIGN 69. ptr = memalign(16,size); libavutil/mem.c:99:5: 97. ptr = malloc(size); 98. #endif 99. return ptr; ^ 100. } 101. libavutil/mem.c:100:1: return from a call to av_malloc 98. #endif 99. return ptr; 100. } ^ 101. 102. void *av_realloc(void *ptr, unsigned int size) libswscale/swscale.c:2977:5: 2975. SwsVector *vec= av_malloc(sizeof(SwsVector)); 2976. 2977. vec->coeff= coeff; ^ 2978. vec->length= length; 2979.
https://github.com/libav/libav/blob/184bc53db4fded8857af09cee2adc7197940deb7/libswscale/swscale.c/#L2977
d2a_code_trace_data_44278
static ngx_int_t ngx_http_upstream_get_random_peer(ngx_peer_connection_t *pc, void *data) { ngx_http_upstream_random_peer_data_t *rp = data; time_t now; uintptr_t m; ngx_uint_t i, n; ngx_http_upstream_rr_peer_t *peer; ngx_http_upstream_rr_peers_t *peers; ngx_http_upstream_rr_peer_data_t *rrp; ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0, "get random peer, try: %ui", pc->tries); rrp = &rp->rrp; peers = rrp->peers; ngx_http_upstream_rr_peers_rlock(peers); if (rp->tries > 20 || peers->single) { ngx_http_upstream_rr_peers_unlock(peers); return ngx_http_upstream_get_round_robin_peer(pc, rrp); } pc->cached = 0; pc->connection = NULL; now = ngx_time(); for ( ;; ) { i = ngx_http_upstream_peek_random_peer(peers, rp); peer = rp->conf->ranges[i].peer; n = i / (8 * sizeof(uintptr_t)); m = (uintptr_t) 1 << i % (8 * sizeof(uintptr_t)); if (rrp->tried[n] & m) { goto next; } ngx_http_upstream_rr_peer_lock(peers, peer); if (peer->down) { ngx_http_upstream_rr_peer_unlock(peers, peer); goto next; } if (peer->max_fails && peer->fails >= peer->max_fails && now - peer->checked <= peer->fail_timeout) { ngx_http_upstream_rr_peer_unlock(peers, peer); goto next; } if (peer->max_conns && peer->conns >= peer->max_conns) { ngx_http_upstream_rr_peer_unlock(peers, peer); goto next; } break; next: if (++rp->tries > 20) { ngx_http_upstream_rr_peers_unlock(peers); return ngx_http_upstream_get_round_robin_peer(pc, rrp); } } rrp->current = peer; if (now - peer->checked > peer->fail_timeout) { peer->checked = now; } pc->sockaddr = peer->sockaddr; pc->socklen = peer->socklen; pc->name = &peer->name; peer->conns++; ngx_http_upstream_rr_peer_unlock(peers, peer); ngx_http_upstream_rr_peers_unlock(peers); rrp->tried[n] |= m; return NGX_OK; } src/http/modules/ngx_http_upstream_random_module.c:291: error: Uninitialized Value The value read from m was never initialized. src/http/modules/ngx_http_upstream_random_module.c:291:5: 289. ngx_http_upstream_rr_peers_unlock(peers); 290. 291. rrp->tried[n] |= m; ^ 292. 293. return NGX_OK;
https://github.com/nginx/nginx/blob/468e37734c48e63296e9f633fd6319519b5f8c74/src/http/modules/ngx_http_upstream_random_module.c/#L291
d2a_code_trace_data_44279
static int query_formats(AVFilterContext *ctx) { AVFilterFormats *formats; enum AVPixelFormat pix_fmt; int ret; if (ctx->inputs[0]) { const AVPixFmtDescriptor *desc = NULL; formats = NULL; while ((desc = av_pix_fmt_desc_next(desc))) { pix_fmt = av_pix_fmt_desc_get_id(desc); if ((sws_isSupportedInput(pix_fmt) || sws_isSupportedEndiannessConversion(pix_fmt)) && (ret = ff_add_format(&formats, pix_fmt)) < 0) { ff_formats_unref(&formats); return ret; } } ff_formats_ref(formats, &ctx->inputs[0]->out_formats); } if (ctx->outputs[0]) { const AVPixFmtDescriptor *desc = NULL; formats = NULL; while ((desc = av_pix_fmt_desc_next(desc))) { pix_fmt = av_pix_fmt_desc_get_id(desc); if ((sws_isSupportedOutput(pix_fmt) || sws_isSupportedEndiannessConversion(pix_fmt)) && (ret = ff_add_format(&formats, pix_fmt)) < 0) { ff_formats_unref(&formats); return ret; } } ff_formats_ref(formats, &ctx->outputs[0]->in_formats); } return 0; } libavfilter/vf_scale.c:135: error: Null Dereference pointer `formats` last assigned on line 125 could be null and is dereferenced by call to `ff_formats_ref()` at line 135, column 9. libavfilter/vf_scale.c:117:1: start of procedure query_formats() 115. } 116. 117. static int query_formats(AVFilterContext *ctx) ^ 118. { 119. AVFilterFormats *formats; libavfilter/vf_scale.c:123:9: Taking true branch 121. int ret; 122. 123. if (ctx->inputs[0]) { ^ 124. const AVPixFmtDescriptor *desc = NULL; 125. formats = NULL; libavfilter/vf_scale.c:124:9: 122. 123. if (ctx->inputs[0]) { 124. const AVPixFmtDescriptor *desc = NULL; ^ 125. formats = NULL; 126. while ((desc = av_pix_fmt_desc_next(desc))) { libavfilter/vf_scale.c:125:9: 123. if (ctx->inputs[0]) { 124. const AVPixFmtDescriptor *desc = NULL; 125. formats = NULL; ^ 126. while ((desc = av_pix_fmt_desc_next(desc))) { 127. pix_fmt = av_pix_fmt_desc_get_id(desc); libavfilter/vf_scale.c:126:17: 124. const AVPixFmtDescriptor *desc = NULL; 125. formats = NULL; 126. while ((desc = av_pix_fmt_desc_next(desc))) { ^ 127. pix_fmt = av_pix_fmt_desc_get_id(desc); 128. if ((sws_isSupportedInput(pix_fmt) || libavutil/pixdesc.c:1692:1: start of procedure av_pix_fmt_desc_next() 1690. } 1691. 1692. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) ^ 1693. { 1694. if (!prev) libavutil/pixdesc.c:1694:10: Taking true branch 1692. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) 1693. { 1694. if (!prev) ^ 1695. return &av_pix_fmt_descriptors[0]; 1696. if (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1) libavutil/pixdesc.c:1695:9: 1693. { 1694. if (!prev) 1695. return &av_pix_fmt_descriptors[0]; ^ 1696. if (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1) 1697. return prev + 1; libavutil/pixdesc.c:1699:1: return from a call to av_pix_fmt_desc_next 1697. return prev + 1; 1698. return NULL; 1699. } ^ 1700. 1701. enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc) libavfilter/vf_scale.c:126:17: Loop condition is true. Entering loop body 124. const AVPixFmtDescriptor *desc = NULL; 125. formats = NULL; 126. while ((desc = av_pix_fmt_desc_next(desc))) { ^ 127. pix_fmt = av_pix_fmt_desc_get_id(desc); 128. if ((sws_isSupportedInput(pix_fmt) || libavfilter/vf_scale.c:127:13: 125. formats = NULL; 126. while ((desc = av_pix_fmt_desc_next(desc))) { 127. pix_fmt = av_pix_fmt_desc_get_id(desc); ^ 128. if ((sws_isSupportedInput(pix_fmt) || 129. sws_isSupportedEndiannessConversion(pix_fmt)) libavutil/pixdesc.c:1701:1: start of procedure av_pix_fmt_desc_get_id() 1699. } 1700. 1701. enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc) ^ 1702. { 1703. if (desc < av_pix_fmt_descriptors || libavutil/pixdesc.c:1703:9: Taking false branch 1701. enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc) 1702. { 1703. if (desc < av_pix_fmt_descriptors || ^ 1704. desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors)) 1705. return AV_PIX_FMT_NONE; libavutil/pixdesc.c:1704:9: Taking false branch 1702. { 1703. if (desc < av_pix_fmt_descriptors || 1704. desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors)) ^ 1705. return AV_PIX_FMT_NONE; 1706. libavutil/pixdesc.c:1707:5: 1705. return AV_PIX_FMT_NONE; 1706. 1707. return desc - av_pix_fmt_descriptors; ^ 1708. } 1709. libavutil/pixdesc.c:1708:1: return from a call to av_pix_fmt_desc_get_id 1706. 1707. return desc - av_pix_fmt_descriptors; 1708. } ^ 1709. 1710. int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, libavfilter/vf_scale.c:128:18: 126. while ((desc = av_pix_fmt_desc_next(desc))) { 127. pix_fmt = av_pix_fmt_desc_get_id(desc); 128. if ((sws_isSupportedInput(pix_fmt) || ^ 129. sws_isSupportedEndiannessConversion(pix_fmt)) 130. && (ret = ff_add_format(&formats, pix_fmt)) < 0) { libswscale/utils.c:190:1: start of procedure sws_isSupportedInput() 188. }; 189. 190. int sws_isSupportedInput(enum AVPixelFormat pix_fmt) ^ 191. { 192. return (unsigned)pix_fmt < AV_PIX_FMT_NB ? libswscale/utils.c:192:12: Condition is true 190. int sws_isSupportedInput(enum AVPixelFormat pix_fmt) 191. { 192. return (unsigned)pix_fmt < AV_PIX_FMT_NB ? ^ 193. format_entries[pix_fmt].is_supported_in : 0; 194. } libswscale/utils.c:192:5: 190. int sws_isSupportedInput(enum AVPixelFormat pix_fmt) 191. { 192. return (unsigned)pix_fmt < AV_PIX_FMT_NB ? ^ 193. format_entries[pix_fmt].is_supported_in : 0; 194. } libswscale/utils.c:194:1: return from a call to sws_isSupportedInput 192. return (unsigned)pix_fmt < AV_PIX_FMT_NB ? 193. format_entries[pix_fmt].is_supported_in : 0; 194. } ^ 195. 196. int sws_isSupportedOutput(enum AVPixelFormat pix_fmt) libavfilter/vf_scale.c:128:18: Taking false branch 126. while ((desc = av_pix_fmt_desc_next(desc))) { 127. pix_fmt = av_pix_fmt_desc_get_id(desc); 128. if ((sws_isSupportedInput(pix_fmt) || ^ 129. sws_isSupportedEndiannessConversion(pix_fmt)) 130. && (ret = ff_add_format(&formats, pix_fmt)) < 0) { libavfilter/vf_scale.c:129:18: 127. pix_fmt = av_pix_fmt_desc_get_id(desc); 128. if ((sws_isSupportedInput(pix_fmt) || 129. sws_isSupportedEndiannessConversion(pix_fmt)) ^ 130. && (ret = ff_add_format(&formats, pix_fmt)) < 0) { 131. ff_formats_unref(&formats); libswscale/utils.c:202:1: start of procedure sws_isSupportedEndiannessConversion() 200. } 201. 202. int sws_isSupportedEndiannessConversion(enum AVPixelFormat pix_fmt) ^ 203. { 204. return (unsigned)pix_fmt < AV_PIX_FMT_NB ? libswscale/utils.c:204:12: Condition is true 202. int sws_isSupportedEndiannessConversion(enum AVPixelFormat pix_fmt) 203. { 204. return (unsigned)pix_fmt < AV_PIX_FMT_NB ? ^ 205. format_entries[pix_fmt].is_supported_endianness : 0; 206. } libswscale/utils.c:204:5: 202. int sws_isSupportedEndiannessConversion(enum AVPixelFormat pix_fmt) 203. { 204. return (unsigned)pix_fmt < AV_PIX_FMT_NB ? ^ 205. format_entries[pix_fmt].is_supported_endianness : 0; 206. } libswscale/utils.c:206:1: return from a call to sws_isSupportedEndiannessConversion 204. return (unsigned)pix_fmt < AV_PIX_FMT_NB ? 205. format_entries[pix_fmt].is_supported_endianness : 0; 206. } ^ 207. 208. const char *sws_format_name(enum AVPixelFormat format) libavfilter/vf_scale.c:129:18: Taking false branch 127. pix_fmt = av_pix_fmt_desc_get_id(desc); 128. if ((sws_isSupportedInput(pix_fmt) || 129. sws_isSupportedEndiannessConversion(pix_fmt)) ^ 130. && (ret = ff_add_format(&formats, pix_fmt)) < 0) { 131. ff_formats_unref(&formats); libavfilter/vf_scale.c:126:17: 124. const AVPixFmtDescriptor *desc = NULL; 125. formats = NULL; 126. while ((desc = av_pix_fmt_desc_next(desc))) { ^ 127. pix_fmt = av_pix_fmt_desc_get_id(desc); 128. if ((sws_isSupportedInput(pix_fmt) || libavutil/pixdesc.c:1692:1: start of procedure av_pix_fmt_desc_next() 1690. } 1691. 1692. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) ^ 1693. { 1694. if (!prev) libavutil/pixdesc.c:1694:10: Taking false branch 1692. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) 1693. { 1694. if (!prev) ^ 1695. return &av_pix_fmt_descriptors[0]; 1696. if (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1) libavutil/pixdesc.c:1696:9: Taking true branch 1694. if (!prev) 1695. return &av_pix_fmt_descriptors[0]; 1696. if (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1) ^ 1697. return prev + 1; 1698. return NULL; libavutil/pixdesc.c:1697:9: 1695. return &av_pix_fmt_descriptors[0]; 1696. if (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1) 1697. return prev + 1; ^ 1698. return NULL; 1699. } libavutil/pixdesc.c:1699:1: return from a call to av_pix_fmt_desc_next 1697. return prev + 1; 1698. return NULL; 1699. } ^ 1700. 1701. enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc) libavfilter/vf_scale.c:126:17: Loop condition is true. Entering loop body 124. const AVPixFmtDescriptor *desc = NULL; 125. formats = NULL; 126. while ((desc = av_pix_fmt_desc_next(desc))) { ^ 127. pix_fmt = av_pix_fmt_desc_get_id(desc); 128. if ((sws_isSupportedInput(pix_fmt) || libavfilter/vf_scale.c:127:13: 125. formats = NULL; 126. while ((desc = av_pix_fmt_desc_next(desc))) { 127. pix_fmt = av_pix_fmt_desc_get_id(desc); ^ 128. if ((sws_isSupportedInput(pix_fmt) || 129. sws_isSupportedEndiannessConversion(pix_fmt)) libavutil/pixdesc.c:1701:1: start of procedure av_pix_fmt_desc_get_id() 1699. } 1700. 1701. enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc) ^ 1702. { 1703. if (desc < av_pix_fmt_descriptors || libavutil/pixdesc.c:1703:9: Taking false branch 1701. enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc) 1702. { 1703. if (desc < av_pix_fmt_descriptors || ^ 1704. desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors)) 1705. return AV_PIX_FMT_NONE; libavutil/pixdesc.c:1704:9: Taking false branch 1702. { 1703. if (desc < av_pix_fmt_descriptors || 1704. desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors)) ^ 1705. return AV_PIX_FMT_NONE; 1706. libavutil/pixdesc.c:1707:5: 1705. return AV_PIX_FMT_NONE; 1706. 1707. return desc - av_pix_fmt_descriptors; ^ 1708. } 1709. libavutil/pixdesc.c:1708:1: return from a call to av_pix_fmt_desc_get_id 1706. 1707. return desc - av_pix_fmt_descriptors; 1708. } ^ 1709. 1710. int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, libavfilter/vf_scale.c:128:18: 126. while ((desc = av_pix_fmt_desc_next(desc))) { 127. pix_fmt = av_pix_fmt_desc_get_id(desc); 128. if ((sws_isSupportedInput(pix_fmt) || ^ 129. sws_isSupportedEndiannessConversion(pix_fmt)) 130. && (ret = ff_add_format(&formats, pix_fmt)) < 0) { libswscale/utils.c:190:1: start of procedure sws_isSupportedInput() 188. }; 189. 190. int sws_isSupportedInput(enum AVPixelFormat pix_fmt) ^ 191. { 192. return (unsigned)pix_fmt < AV_PIX_FMT_NB ? libswscale/utils.c:192:12: Condition is true 190. int sws_isSupportedInput(enum AVPixelFormat pix_fmt) 191. { 192. return (unsigned)pix_fmt < AV_PIX_FMT_NB ? ^ 193. format_entries[pix_fmt].is_supported_in : 0; 194. } libswscale/utils.c:192:5: 190. int sws_isSupportedInput(enum AVPixelFormat pix_fmt) 191. { 192. return (unsigned)pix_fmt < AV_PIX_FMT_NB ? ^ 193. format_entries[pix_fmt].is_supported_in : 0; 194. } libswscale/utils.c:194:1: return from a call to sws_isSupportedInput 192. return (unsigned)pix_fmt < AV_PIX_FMT_NB ? 193. format_entries[pix_fmt].is_supported_in : 0; 194. } ^ 195. 196. int sws_isSupportedOutput(enum AVPixelFormat pix_fmt) libavfilter/vf_scale.c:128:18: Taking false branch 126. while ((desc = av_pix_fmt_desc_next(desc))) { 127. pix_fmt = av_pix_fmt_desc_get_id(desc); 128. if ((sws_isSupportedInput(pix_fmt) || ^ 129. sws_isSupportedEndiannessConversion(pix_fmt)) 130. && (ret = ff_add_format(&formats, pix_fmt)) < 0) { libavfilter/vf_scale.c:129:18: 127. pix_fmt = av_pix_fmt_desc_get_id(desc); 128. if ((sws_isSupportedInput(pix_fmt) || 129. sws_isSupportedEndiannessConversion(pix_fmt)) ^ 130. && (ret = ff_add_format(&formats, pix_fmt)) < 0) { 131. ff_formats_unref(&formats); libswscale/utils.c:202:1: start of procedure sws_isSupportedEndiannessConversion() 200. } 201. 202. int sws_isSupportedEndiannessConversion(enum AVPixelFormat pix_fmt) ^ 203. { 204. return (unsigned)pix_fmt < AV_PIX_FMT_NB ? libswscale/utils.c:204:12: Condition is true 202. int sws_isSupportedEndiannessConversion(enum AVPixelFormat pix_fmt) 203. { 204. return (unsigned)pix_fmt < AV_PIX_FMT_NB ? ^ 205. format_entries[pix_fmt].is_supported_endianness : 0; 206. } libswscale/utils.c:204:5: 202. int sws_isSupportedEndiannessConversion(enum AVPixelFormat pix_fmt) 203. { 204. return (unsigned)pix_fmt < AV_PIX_FMT_NB ? ^ 205. format_entries[pix_fmt].is_supported_endianness : 0; 206. } libswscale/utils.c:206:1: return from a call to sws_isSupportedEndiannessConversion 204. return (unsigned)pix_fmt < AV_PIX_FMT_NB ? 205. format_entries[pix_fmt].is_supported_endianness : 0; 206. } ^ 207. 208. const char *sws_format_name(enum AVPixelFormat format) libavfilter/vf_scale.c:129:18: Taking false branch 127. pix_fmt = av_pix_fmt_desc_get_id(desc); 128. if ((sws_isSupportedInput(pix_fmt) || 129. sws_isSupportedEndiannessConversion(pix_fmt)) ^ 130. && (ret = ff_add_format(&formats, pix_fmt)) < 0) { 131. ff_formats_unref(&formats); libavfilter/vf_scale.c:126:17: 124. const AVPixFmtDescriptor *desc = NULL; 125. formats = NULL; 126. while ((desc = av_pix_fmt_desc_next(desc))) { ^ 127. pix_fmt = av_pix_fmt_desc_get_id(desc); 128. if ((sws_isSupportedInput(pix_fmt) || libavutil/pixdesc.c:1692:1: start of procedure av_pix_fmt_desc_next() 1690. } 1691. 1692. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) ^ 1693. { 1694. if (!prev) libavutil/pixdesc.c:1694:10: Taking false branch 1692. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) 1693. { 1694. if (!prev) ^ 1695. return &av_pix_fmt_descriptors[0]; 1696. if (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1) libavutil/pixdesc.c:1696:9: Taking true branch 1694. if (!prev) 1695. return &av_pix_fmt_descriptors[0]; 1696. if (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1) ^ 1697. return prev + 1; 1698. return NULL; libavutil/pixdesc.c:1697:9: 1695. return &av_pix_fmt_descriptors[0]; 1696. if (prev - av_pix_fmt_descriptors < FF_ARRAY_ELEMS(av_pix_fmt_descriptors) - 1) 1697. return prev + 1; ^ 1698. return NULL; 1699. } libavutil/pixdesc.c:1699:1: return from a call to av_pix_fmt_desc_next 1697. return prev + 1; 1698. return NULL; 1699. } ^ 1700. 1701. enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc) libavfilter/vf_scale.c:126:17: Loop condition is false. Leaving loop 124. const AVPixFmtDescriptor *desc = NULL; 125. formats = NULL; 126. while ((desc = av_pix_fmt_desc_next(desc))) { ^ 127. pix_fmt = av_pix_fmt_desc_get_id(desc); 128. if ((sws_isSupportedInput(pix_fmt) || libavfilter/vf_scale.c:135:9: 133. } 134. } 135. ff_formats_ref(formats, &ctx->inputs[0]->out_formats); ^ 136. } 137. if (ctx->outputs[0]) { libavfilter/formats.c:276:1: start of procedure ff_formats_ref() 274. } 275. 276. void ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref) ^ 277. { 278. FORMATS_REF(f, ref); libavfilter/formats.c:278:5: 276. void ff_formats_ref(AVFilterFormats *f, AVFilterFormats **ref) 277. { 278. FORMATS_REF(f, ref); ^ 279. } 280.
https://github.com/libav/libav/blob/bf50607ab76157ba251a01f5baa5cf67b23b2ee9/libavfilter/vf_scale.c/#L135
d2a_code_trace_data_44280
ngx_int_t ngx_atoi(u_char *line, size_t n) { ngx_int_t value, cutoff, cutlim; if (n == 0) { return NGX_ERROR; } cutoff = NGX_MAX_INT_T_VALUE / 10; cutlim = NGX_MAX_INT_T_VALUE % 10; for (value = 0; n--; line++) { if (*line < '0' || *line > '9') { return NGX_ERROR; } if (value >= cutoff && (value > cutoff || *line - '0' > cutlim)) { return NGX_ERROR; } value = value * 10 + (*line - '0'); } return value; } src/core/nginx.c:1362: error: Integer Overflow L2 ([0, 9223372036854775800] + [0, 9]):signed64 by call to `ngx_atoi`. src/core/nginx.c:1357:9: Unknown value from: strcmp 1355. value = cf->args->elts; 1356. 1357. if (ngx_strcmp(value[1].data, "auto") == 0) { ^ 1358. ccf->worker_processes = ngx_ncpu; 1359. return NGX_CONF_OK; src/core/nginx.c:1362:29: Call 1360. } 1361. 1362. ccf->worker_processes = ngx_atoi(value[1].data, value[1].len); ^ 1363. 1364. if (ccf->worker_processes == NGX_ERROR) { src/core/ngx_string.c:910:5: <LHS trace> 908. } 909. 910. cutoff = NGX_MAX_INT_T_VALUE / 10; ^ 911. cutlim = NGX_MAX_INT_T_VALUE % 10; 912. src/core/ngx_string.c:910:5: Assignment 908. } 909. 910. cutoff = NGX_MAX_INT_T_VALUE / 10; ^ 911. cutlim = NGX_MAX_INT_T_VALUE % 10; 912. src/core/ngx_string.c:901:1: <RHS trace> 899. 900. 901. ngx_int_t ^ 902. ngx_atoi(u_char *line, size_t n) 903. { src/core/ngx_string.c:901:1: Parameter `*line` 899. 900. 901. ngx_int_t ^ 902. ngx_atoi(u_char *line, size_t n) 903. { src/core/ngx_string.c:922:9: Binary operation: ([0, 9223372036854775800] + [0, 9]):signed64 by call to `ngx_atoi` 920. } 921. 922. value = value * 10 + (*line - '0'); ^ 923. } 924.
https://github.com/nginx/nginx/blob/79a03b3ff6d950e60a06c6d979bd7a909709e82d/src/core/ngx_string.c/#L922
d2a_code_trace_data_44281
static int ssl_cipher_process_rulestr(const char *rule_str, CIPHER_ORDER **head_p, CIPHER_ORDER **tail_p, const SSL_CIPHER **ca_list, CERT *c) { uint32_t alg_mkey, alg_auth, alg_enc, alg_mac, algo_strength; int min_tls; const char *l, *buf; int j, multi, found, rule, retval, ok, buflen; uint32_t cipher_id = 0; char ch; retval = 1; l = rule_str; for ( ; ; ) { ch = *l; if (ch == '\0') break; if (ch == '-') { rule = CIPHER_DEL; l++; } else if (ch == '+') { rule = CIPHER_ORD; l++; } else if (ch == '!') { rule = CIPHER_KILL; l++; } else if (ch == '@') { rule = CIPHER_SPECIAL; l++; } else { rule = CIPHER_ADD; } if (ITEM_SEP(ch)) { l++; continue; } alg_mkey = 0; alg_auth = 0; alg_enc = 0; alg_mac = 0; min_tls = 0; algo_strength = 0; for (;;) { ch = *l; buf = l; buflen = 0; #ifndef CHARSET_EBCDIC while (((ch >= 'A') && (ch <= 'Z')) || ((ch >= '0') && (ch <= '9')) || ((ch >= 'a') && (ch <= 'z')) || (ch == '-') || (ch == '.') || (ch == '=')) #else while (isalnum((unsigned char)ch) || (ch == '-') || (ch == '.') || (ch == '=')) #endif { ch = *(++l); buflen++; } if (buflen == 0) { SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR, SSL_R_INVALID_COMMAND); retval = found = 0; l++; break; } if (rule == CIPHER_SPECIAL) { found = 0; break; } if (ch == '+') { multi = 1; l++; } else { multi = 0; } j = found = 0; cipher_id = 0; while (ca_list[j]) { if (strncmp(buf, ca_list[j]->name, buflen) == 0 && (ca_list[j]->name[buflen] == '\0')) { found = 1; break; } else j++; } if (!found) break; if (ca_list[j]->algorithm_mkey) { if (alg_mkey) { alg_mkey &= ca_list[j]->algorithm_mkey; if (!alg_mkey) { found = 0; break; } } else { alg_mkey = ca_list[j]->algorithm_mkey; } } if (ca_list[j]->algorithm_auth) { if (alg_auth) { alg_auth &= ca_list[j]->algorithm_auth; if (!alg_auth) { found = 0; break; } } else { alg_auth = ca_list[j]->algorithm_auth; } } if (ca_list[j]->algorithm_enc) { if (alg_enc) { alg_enc &= ca_list[j]->algorithm_enc; if (!alg_enc) { found = 0; break; } } else { alg_enc = ca_list[j]->algorithm_enc; } } if (ca_list[j]->algorithm_mac) { if (alg_mac) { alg_mac &= ca_list[j]->algorithm_mac; if (!alg_mac) { found = 0; break; } } else { alg_mac = ca_list[j]->algorithm_mac; } } if (ca_list[j]->algo_strength & SSL_STRONG_MASK) { if (algo_strength & SSL_STRONG_MASK) { algo_strength &= (ca_list[j]->algo_strength & SSL_STRONG_MASK) | ~SSL_STRONG_MASK; if (!(algo_strength & SSL_STRONG_MASK)) { found = 0; break; } } else { algo_strength = ca_list[j]->algo_strength & SSL_STRONG_MASK; } } if (ca_list[j]->algo_strength & SSL_DEFAULT_MASK) { if (algo_strength & SSL_DEFAULT_MASK) { algo_strength &= (ca_list[j]->algo_strength & SSL_DEFAULT_MASK) | ~SSL_DEFAULT_MASK; if (!(algo_strength & SSL_DEFAULT_MASK)) { found = 0; break; } } else { algo_strength |= ca_list[j]->algo_strength & SSL_DEFAULT_MASK; } } if (ca_list[j]->valid) { cipher_id = ca_list[j]->id; } else { if (ca_list[j]->min_tls) { if (min_tls != 0 && min_tls != ca_list[j]->min_tls) { found = 0; break; } else { min_tls = ca_list[j]->min_tls; } } } if (!multi) break; } if (rule == CIPHER_SPECIAL) { ok = 0; if ((buflen == 8) && strncmp(buf, "STRENGTH", 8) == 0) { ok = ssl_cipher_strength_sort(head_p, tail_p); } else if (buflen == 10 && strncmp(buf, "SECLEVEL=", 9) == 0) { int level = buf[9] - '0'; if (level < 0 || level > 5) { SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR, SSL_R_INVALID_COMMAND); } else { c->sec_level = level; ok = 1; } } else { SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR, SSL_R_INVALID_COMMAND); } if (ok == 0) retval = 0; while ((*l != '\0') && !ITEM_SEP(*l)) l++; } else if (found) { ssl_cipher_apply_rule(cipher_id, alg_mkey, alg_auth, alg_enc, alg_mac, min_tls, algo_strength, rule, -1, head_p, tail_p); } else { while ((*l != '\0') && !ITEM_SEP(*l)) l++; } if (*l == '\0') break; } return retval; } test/cipherlist_test.c:227: error: BUFFER_OVERRUN_L1 Offset: [9, +oo] (⇐ [0, +oo] + 9) Size: 8 by call to `SSL_CTX_set_cipher_list`. Showing all 13 steps of the trace test/cipherlist_test.c:227:10: Call 225. return 0; 226. 227. if (!TEST_int_eq(SSL_CTX_set_cipher_list(fixture->server, "no-such"), 0)) ^ 228. goto end; 229. ssl/ssl_lib.c:2603:1: Parameter `*str` 2601. 2602. /** specify the ciphers to be used by default by the SSL_CTX */ 2603. > int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str) 2604. { 2605. STACK_OF(SSL_CIPHER) *sk; ssl/ssl_lib.c:2607:10: Call 2605. STACK_OF(SSL_CIPHER) *sk; 2606. 2607. sk = ssl_create_cipher_list(ctx->method, ctx->tls13_ciphersuites, ^ 2608. &ctx->cipher_list, &ctx->cipher_list_by_id, str, 2609. ctx->cert); ssl/ssl_ciph.c:1402:1: Parameter `*rule_str` 1400. } 1401. 1402. > STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method, 1403. STACK_OF(SSL_CIPHER) *tls13_ciphersuites, 1404. STACK_OF(SSL_CIPHER) **cipher_list, ssl/ssl_ciph.c:1422:10: Call 1420. return NULL; 1421. #ifndef OPENSSL_NO_EC 1422. if (!check_suiteb_cipher_list(ssl_method, c, &rule_str)) ^ 1423. return NULL; 1424. #endif ssl/ssl_ciph.c:1222:1: Parameter `**prule_str` 1220. 1221. #ifndef OPENSSL_NO_EC 1222. > static int check_suiteb_cipher_list(const SSL_METHOD *meth, CERT *c, 1223. const char **prule_str) 1224. { ssl/ssl_ciph.c:1571:5: Assignment 1569. */ 1570. ok = 1; 1571. rule_p = rule_str; ^ 1572. if (strncmp(rule_str, "DEFAULT", 7) == 0) { 1573. ok = ssl_cipher_process_rulestr(SSL_DEFAULT_CIPHER_LIST, ssl/ssl_ciph.c:1581:14: Call 1579. 1580. if (ok && (strlen(rule_p) > 0)) 1581. ok = ssl_cipher_process_rulestr(rule_p, &head, &tail, ca_list, c); ^ 1582. 1583. OPENSSL_free(ca_list); /* Not needed anymore */ ssl/ssl_ciph.c:957:1: <Length trace> 955. } 956. 957. > static int ssl_cipher_process_rulestr(const char *rule_str, 958. CIPHER_ORDER **head_p, 959. CIPHER_ORDER **tail_p, ssl/ssl_ciph.c:957:1: Parameter `*rule_str` 955. } 956. 957. > static int ssl_cipher_process_rulestr(const char *rule_str, 958. CIPHER_ORDER **head_p, 959. CIPHER_ORDER **tail_p, ssl/ssl_ciph.c:970:5: Assignment 968. 969. retval = 1; 970. l = rule_str; ^ 971. for ( ; ; ) { 972. ch = *l; ssl/ssl_ciph.c:1006:13: Assignment 1004. for (;;) { 1005. ch = *l; 1006. buf = l; ^ 1007. buflen = 0; 1008. #ifndef CHARSET_EBCDIC ssl/ssl_ciph.c:1184:29: Array access: Offset: [9, +oo] (⇐ [0, +oo] + 9) Size: 8 by call to `SSL_CTX_set_cipher_list` 1182. ok = ssl_cipher_strength_sort(head_p, tail_p); 1183. } else if (buflen == 10 && strncmp(buf, "SECLEVEL=", 9) == 0) { 1184. int level = buf[9] - '0'; ^ 1185. if (level < 0 || level > 5) { 1186. SSLerr(SSL_F_SSL_CIPHER_PROCESS_RULESTR,
https://github.com/openssl/openssl/blob/4af5836b55442f31795eff6c8c81ea7a1b8cf94b/ssl/ssl_ciph.c/#L1184
d2a_code_trace_data_44282
int ossltest_aes128_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { if (ctx->cipher_data == NULL) { ctx->cipher_data = OPENSSL_zalloc(EVP_aes_128_cbc()->ctx_size); if (ctx->cipher_data == NULL) { OSSLTESTerr(OSSLTEST_F_OSSLTEST_AES128_INIT_KEY, ERR_R_MALLOC_FAILURE); return 0; } } return EVP_aes_128_cbc()->init(ctx, key, iv, enc); } engines/e_ossltest.c:585: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_zalloc()` at line 578, column 28 is not reachable after line 585, column 12. Showing all 25 steps of the trace engines/e_ossltest.c:569:1: start of procedure ossltest_aes128_init_key() 567. */ 568. 569. > int ossltest_aes128_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, 570. const unsigned char *iv, int enc) 571. { engines/e_ossltest.c:572:9: Taking true branch 570. const unsigned char *iv, int enc) 571. { 572. if (ctx->cipher_data == NULL) { ^ 573. /* 574. * Normally cipher_data is allocated automatically for an engine but engines/e_ossltest.c:578:9: 576. * run time 577. */ 578. > ctx->cipher_data = OPENSSL_zalloc(EVP_aes_128_cbc()->ctx_size); 579. if (ctx->cipher_data == NULL) { 580. OSSLTESTerr(OSSLTEST_F_OSSLTEST_AES128_INIT_KEY, crypto/evp/e_aes.c:1233:1: start of procedure EVP_aes_128_cbc() 1231. } 1232. 1233. > BLOCK_CIPHER_generic_pack(NID_aes, 128, 0) 1234. BLOCK_CIPHER_generic_pack(NID_aes, 192, 0) 1235. BLOCK_CIPHER_generic_pack(NID_aes, 256, 0) crypto/evp/e_aes.c:1233:1: return from a call to EVP_aes_128_cbc 1231. } 1232. 1233. > BLOCK_CIPHER_generic_pack(NID_aes, 128, 0) 1234. BLOCK_CIPHER_generic_pack(NID_aes, 192, 0) 1235. BLOCK_CIPHER_generic_pack(NID_aes, 256, 0) 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) engines/e_ossltest.c:579:13: Taking false branch 577. */ 578. ctx->cipher_data = OPENSSL_zalloc(EVP_aes_128_cbc()->ctx_size); 579. if (ctx->cipher_data == NULL) { ^ 580. OSSLTESTerr(OSSLTEST_F_OSSLTEST_AES128_INIT_KEY, 581. ERR_R_MALLOC_FAILURE); engines/e_ossltest.c:585:5: 583. } 584. } 585. > return EVP_aes_128_cbc()->init(ctx, key, iv, enc); 586. } 587. crypto/evp/e_aes.c:1233:1: start of procedure EVP_aes_128_cbc() 1231. } 1232. 1233. > BLOCK_CIPHER_generic_pack(NID_aes, 128, 0) 1234. BLOCK_CIPHER_generic_pack(NID_aes, 192, 0) 1235. BLOCK_CIPHER_generic_pack(NID_aes, 256, 0) crypto/evp/e_aes.c:1233:1: return from a call to EVP_aes_128_cbc 1231. } 1232. 1233. > BLOCK_CIPHER_generic_pack(NID_aes, 128, 0) 1234. BLOCK_CIPHER_generic_pack(NID_aes, 192, 0) 1235. BLOCK_CIPHER_generic_pack(NID_aes, 256, 0) engines/e_ossltest.c:585:5: Skipping __function_pointer__(): unresolved function pointer 583. } 584. } 585. return EVP_aes_128_cbc()->init(ctx, key, iv, enc); ^ 586. } 587.
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/engines/e_ossltest.c/#L585
d2a_code_trace_data_44283
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ecdh_ossl.c:128: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end`. Showing all 8 steps of the trace crypto/ec/ecdh_ossl.c:52:5: Call 50. if ((ctx = BN_CTX_new()) == NULL) 51. goto err; 52. BN_CTX_start(ctx); ^ 53. x = BN_CTX_get(ctx); 54. if (x == NULL) { crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/ec/ecdh_ossl.c:128:9: Call 126. EC_POINT_free(tmp); 127. if (ctx) 128. BN_CTX_end(ctx); ^ 129. BN_CTX_free(ctx); 130. OPENSSL_free(buf); crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.depth` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:271:1: <LHS trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `st->depth` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:273:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end` 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/e613b1eff40f21cd99240f9884cd3396b0ab50f1/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_44284
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:460: error: Integer Overflow L2 (32 - [-1+min(64, `s->bc_extra_bits.bits_left`), -1+max(64, `s->bc_extra_bits.bits_left`)]):unsigned32 by call to `bitstream_read`. libavcodec/wavpack.c:435:1: Parameter `s->bc_extra_bits.bits_left` 433. } 434. 435. static float wv_get_value_float(WavpackFrameContext *s, uint32_t *crc, int S) ^ 436. { 437. union { libavcodec/wavpack.c:459:38: Call 457. S = -S; 458. if (S >= 0x1000000) { 459. if (s->got_extra_bits && bitstream_read_bit(&s->bc_extra_bits)) ^ 460. S = bitstream_read(&s->bc_extra_bits, 23); 461. 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/wavpack.c:460:21: Call 458. if (S >= 0x1000000) { 459. if (s->got_extra_bits && bitstream_read_bit(&s->bc_extra_bits)) 460. S = bitstream_read(&s->bc_extra_bits, 23); ^ 461. else 462. S = 0; libavcodec/bitstream.h:183:1: Parameter `n` 181. 182. /* Return n bits from the buffer. n has to be in the 0-32 range. */ 183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n) ^ 184. { 185. if (!n) libavcodec/bitstream.h:189:9: Call 187. 188. if (n > bc->bits_left) { 189. refill_32(bc); ^ 190. if (bc->bits_left < 32) 191. bc->bits_left = n; libavcodec/bitstream.h:60:1: <RHS trace> 58. } 59. 60. static inline void refill_32(BitstreamContext *bc) ^ 61. { 62. if (bc->ptr >= bc->buffer_end) libavcodec/bitstream.h:60:1: Parameter `bc->bits_left` 58. } 59. 60. static inline void refill_32(BitstreamContext *bc) ^ 61. { 62. if (bc->ptr >= bc->buffer_end) libavcodec/bitstream.h:68:5: Binary operation: (32 - [-1+min(64, s->bc_extra_bits.bits_left), -1+max(64, s->bc_extra_bits.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_44285
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) { bn_check_top(b); if (a == b) return a; if (bn_wexpand(a, b->top) == NULL) return NULL; if (b->top > 0) memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); a->top = b->top; a->neg = b->neg; bn_check_top(a); return a; } apps/s_client.c:244: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_mod_exp`. Showing all 28 steps of the trace apps/s_client.c:231:1: Parameter `N->top` 229. # define SRP_NUMBER_ITERATIONS_FOR_PRIME 64 230. 231. > static int srp_Verify_N_and_g(const BIGNUM *N, const BIGNUM *g) 232. { 233. BN_CTX *bn_ctx = BN_CTX_new(); apps/s_client.c:237:53: Call 235. BIGNUM *r = BN_new(); 236. int ret = 237. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && ^ 238. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 && 239. p != NULL && BN_rshift1(p, N) && crypto/bn/bn_lib.c:867:1: Parameter `a->top` 865. } 866. 867. > int BN_is_odd(const BIGNUM *a) 868. { 869. return (a->top > 0) && (a->d[0] & 1); apps/s_client.c:238:9: Call 236. int ret = 237. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && 238. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 && ^ 239. p != NULL && BN_rshift1(p, N) && 240. /* p = (N-1)/2 */ crypto/bn/bn_prime.c:147:1: Parameter `a->top` 145. } 146. 147. > int BN_is_prime_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 148. BN_GENCB *cb) 149. { crypto/bn/bn_prime.c:150:12: Call 148. BN_GENCB *cb) 149. { 150. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb); ^ 151. } 152. crypto/bn/bn_prime.c:153:1: Parameter `a->top` 151. } 152. 153. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 154. int do_trial_division, BN_GENCB *cb) 155. { crypto/bn/bn_prime.c:162:9: Call 160. BN_MONT_CTX *mont = NULL; 161. 162. if (BN_cmp(a, BN_value_one()) <= 0) ^ 163. return 0; 164. crypto/bn/bn_lib.c:577:1: Parameter `a->top` 575. } 576. 577. > int BN_cmp(const BIGNUM *a, const BIGNUM *b) 578. { 579. int i; apps/s_client.c:239:22: Call 237. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && 238. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 && 239. p != NULL && BN_rshift1(p, N) && ^ 240. /* p = (N-1)/2 */ 241. BN_is_prime_ex(p, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 && crypto/bn/bn_shift.c:54:9: Call 52. bn_check_top(a); 53. 54. if (BN_is_zero(a)) { ^ 55. BN_zero(r); 56. return (1); crypto/bn/bn_lib.c:852:1: Parameter `a->top` 850. } 851. 852. > int BN_is_zero(const BIGNUM *a) 853. { 854. return a->top == 0; apps/s_client.c:244:9: Call 242. r != NULL && 243. /* verify g^((N-1)/2) == -1 (mod N) */ 244. BN_mod_exp(r, g, p, N, bn_ctx) && ^ 245. BN_add_word(r, 1) && BN_cmp(r, N) == 0; 246. crypto/bn/bn_exp.c:91:1: Parameter `m->top` 89. } 90. 91. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 92. BN_CTX *ctx) 93. { crypto/bn/bn_exp.c:136:9: Call 134. 135. #ifdef MONT_MUL_MOD 136. if (BN_is_odd(m)) { ^ 137. # ifdef MONT_EXP_WORD 138. if (a->top == 1 && !a->neg crypto/bn/bn_lib.c:867:1: Parameter `a->top` 865. } 866. 867. > int BN_is_odd(const BIGNUM *a) 868. { 869. return (a->top > 0) && (a->d[0] & 1); crypto/bn/bn_exp.c:149:15: Call 147. #ifdef RECP_MUL_MOD 148. { 149. ret = BN_mod_exp_recp(r, a, p, m, ctx); ^ 150. } 151. #else crypto/bn/bn_exp.c:161:1: Parameter `m->top` 159. } 160. 161. > int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 162. const BIGNUM *m, BN_CTX *ctx) 163. { crypto/bn/bn_exp.c:204:13: Call 202. goto err; 203. } else { 204. if (BN_RECP_CTX_set(&recp, m, ctx) <= 0) ^ 205. goto err; 206. } crypto/bn/bn_recp.c:44:1: Parameter `d->top` 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:323:1: <Offset trace> 321. } 322. 323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 324. { 325. bn_check_top(b); crypto/bn/bn_lib.c:323:1: Parameter `b->top` 321. } 322. 323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 324. { 325. bn_check_top(b); crypto/bn/bn_lib.c:323:1: <Length trace> 321. } 322. 323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 324. { 325. bn_check_top(b); crypto/bn/bn_lib.c:323:1: Parameter `*a->d` 321. } 322. 323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 324. { 325. bn_check_top(b); crypto/bn/bn_lib.c:329:9: Call 327. if (a == b) 328. return a; 329. if (bn_wexpand(a, b->top) == NULL) ^ 330. return NULL; 331. crypto/bn/bn_lib.c:948:1: Parameter `*a->d` 946. } 947. 948. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:333:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_mod_exp` 331. 332. if (b->top > 0) 333. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); ^ 334. 335. a->top = b->top;
https://github.com/openssl/openssl/blob/757264207ad8650a89ea903d48ad89f61d56ea9c/crypto/bn/bn_lib.c/#L333
d2a_code_trace_data_44286
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) { int i, nw, lb, rb; BN_ULONG *t, *f; BN_ULONG l; bn_check_top(r); bn_check_top(a); if (n < 0) { BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT); return 0; } r->neg = a->neg; nw = n / BN_BITS2; if (bn_wexpand(r, a->top + nw + 1) == NULL) return (0); lb = n % BN_BITS2; rb = BN_BITS2 - lb; f = a->d; t = r->d; t[a->top + nw] = 0; if (lb == 0) for (i = a->top - 1; i >= 0; i--) t[nw + i] = f[i]; else for (i = a->top - 1; i >= 0; i--) { l = f[i]; t[nw + i + 1] |= (l >> rb) & BN_MASK2; t[nw + i] = (l << lb) & BN_MASK2; } memset(t, 0, sizeof(*t) * nw); r->top = a->top + nw + 1; bn_correct_top(r); bn_check_top(r); return (1); } test/bntest.c:821: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_generate_prime_ex`. Showing all 18 steps of the trace test/bntest.c:821:10: Call 819. */ 820. 821. if (!BN_generate_prime_ex(b, 512, 0, NULL, NULL, NULL)) ^ 822. goto err; 823. b->neg = rand_neg(); crypto/bn/bn_prime.c:101:1: Parameter `add->top` 99. } 100. 101. > int BN_generate_prime_ex(BIGNUM *ret, int bits, int safe, 102. const BIGNUM *add, const BIGNUM *rem, BN_GENCB *cb) 103. { crypto/bn/bn_prime.c:142:18: Call 140. goto err; 141. } else { 142. if (!bn_probable_prime_dh(ret, bits, add, rem, ctx)) ^ 143. goto err; 144. } crypto/bn/bn_prime.c:494:1: Parameter `add->top` 492. } 493. 494. > int bn_probable_prime_dh(BIGNUM *rnd, int bits, 495. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx) 496. { crypto/bn/bn_prime.c:509:10: Call 507. /* we need ((rnd-rem) % add) == 0 */ 508. 509. if (!BN_mod(t1, rnd, add, ctx)) ^ 510. goto err; 511. if (!BN_sub(rnd, rnd, t1)) crypto/bn/bn_div.c:205:31: Call 203. 204. /* First we normalise the numbers */ 205. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 206. if (!(BN_lshift(sdiv, divisor, norm_shift))) 207. goto err; crypto/bn/bn_lib.c:167:9: Assignment 165. 166. if (BN_is_zero(a)) 167. return 0; ^ 168. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); 169. } crypto/bn/bn_div.c:205:5: Assignment 203. 204. /* First we normalise the numbers */ 205. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 206. if (!(BN_lshift(sdiv, divisor, norm_shift))) 207. goto err; crypto/bn/bn_div.c:206:11: Call 204. /* First we normalise the numbers */ 205. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); 206. if (!(BN_lshift(sdiv, divisor, norm_shift))) ^ 207. goto err; 208. sdiv->neg = 0; crypto/bn/bn_shift.c:81:1: <Offset trace> 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:81:1: Parameter `n` 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:96:5: Assignment 94. 95. r->neg = a->neg; 96. nw = n / BN_BITS2; ^ 97. if (bn_wexpand(r, a->top + nw + 1) == NULL) 98. return (0); crypto/bn/bn_shift.c:81:1: <Length trace> 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:81:1: Parameter `*r->d` 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:9: Call 95. r->neg = a->neg; 96. nw = n / BN_BITS2; 97. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 98. return (0); 99. lb = n % BN_BITS2; crypto/bn/bn_lib.c:1016:1: Parameter `*a->d` 1014. } 1015. 1016. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 1017. { 1018. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:102:5: Assignment 100. rb = BN_BITS2 - lb; 101. f = a->d; 102. t = r->d; ^ 103. t[a->top + nw] = 0; 104. if (lb == 0) crypto/bn/bn_shift.c:110:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_generate_prime_ex` 108. for (i = a->top - 1; i >= 0; i--) { 109. l = f[i]; 110. t[nw + i + 1] |= (l >> rb) & BN_MASK2; ^ 111. t[nw + i] = (l << lb) & BN_MASK2; 112. }
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_shift.c/#L110
d2a_code_trace_data_44287
void RAND_seed(const void *buf, int num) { const RAND_METHOD *meth = RAND_get_rand_method(); if (meth->seed != NULL) meth->seed(buf, num); } crypto/rand/rand_lib.c:839: error: NULL_DEREFERENCE pointer `meth` last assigned on line 837 could be null and is dereferenced at line 839, column 9. Showing all 6 steps of the trace crypto/rand/rand_lib.c:835:1: start of procedure RAND_seed() 833. #endif 834. 835. > void RAND_seed(const void *buf, int num) 836. { 837. const RAND_METHOD *meth = RAND_get_rand_method(); crypto/rand/rand_lib.c:837:5: 835. void RAND_seed(const void *buf, int num) 836. { 837. > const RAND_METHOD *meth = RAND_get_rand_method(); 838. 839. if (meth->seed != NULL) crypto/rand/rand_lib.c:775:1: start of procedure RAND_get_rand_method() 773. #endif 774. 775. > const RAND_METHOD *RAND_get_rand_method(void) 776. { 777. #ifdef FIPS_MODE crypto/rand/rand_lib.c:778:5: 776. { 777. #ifdef FIPS_MODE 778. > return NULL; 779. #else 780. const RAND_METHOD *tmp_meth = NULL; crypto/rand/rand_lib.c:807:1: return from a call to RAND_get_rand_method 805. return tmp_meth; 806. #endif 807. > } 808. 809. #if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE) crypto/rand/rand_lib.c:839:9: 837. const RAND_METHOD *meth = RAND_get_rand_method(); 838. 839. > if (meth->seed != NULL) 840. meth->seed(buf, num); 841. }
https://github.com/openssl/openssl/blob/fa3eb248e29ca8031e6a14e8a2c6f3cd58b5450e/crypto/rand/rand_lib.c/#L839
d2a_code_trace_data_44288
static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose) { size_t packlen = pkt->written - sub->pwritten; if (packlen == 0 && (sub->flags & WPACKET_FLAGS_NON_ZERO_LENGTH) != 0) return 0; if (packlen == 0 && sub->flags & WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH) { if (!doclose) return 0; if ((pkt->curr - sub->lenbytes) == sub->packet_len) { pkt->written -= sub->lenbytes; pkt->curr -= sub->lenbytes; } sub->packet_len = 0; sub->lenbytes = 0; } if (sub->lenbytes > 0 && !put_value(&GETBUF(pkt)[sub->packet_len], packlen, sub->lenbytes)) return 0; if (doclose) { pkt->subs = sub->parent; OPENSSL_free(sub); } return 1; } ssl/tls13_enc.c:55: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `WPACKET_close`. Showing all 11 steps of the trace ssl/tls13_enc.c:52:17: Call 50. if (!WPACKET_init_static_len(&pkt, hkdflabel, sizeof(hkdflabel), 0) 51. || !WPACKET_put_bytes_u16(&pkt, outlen) 52. || !WPACKET_start_sub_packet_u8(&pkt) ^ 53. || !WPACKET_memcpy(&pkt, label_prefix, sizeof(label_prefix) - 1) 54. || !WPACKET_memcpy(&pkt, label, labellen) ssl/packet.c:270:1: Parameter `lenbytes` 268. } 269. 270. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 271. { 272. WPACKET_SUB *sub; ssl/packet.c:286:5: Assignment 284. pkt->subs = sub; 285. sub->pwritten = pkt->written + lenbytes; 286. sub->lenbytes = lenbytes; ^ 287. 288. if (lenbytes == 0) { ssl/tls13_enc.c:55:17: Call 53. || !WPACKET_memcpy(&pkt, label_prefix, sizeof(label_prefix) - 1) 54. || !WPACKET_memcpy(&pkt, label, labellen) 55. || !WPACKET_close(&pkt) ^ 56. || !WPACKET_sub_memcpy_u8(&pkt, data, (data == NULL) ? 0 : datalen) 57. || !WPACKET_get_total_written(&pkt, &hkdflabellen) ssl/packet.c:238:1: Parameter `pkt->curr` 236. } 237. 238. > int WPACKET_close(WPACKET *pkt) 239. { 240. /* ssl/packet.c:247:12: Call 245. return 0; 246. 247. return wpacket_intern_close(pkt, pkt->subs, 1); ^ 248. } 249. ssl/packet.c:184:1: <LHS trace> 182. * (i.e. it fills in all the lengths), but doesn't actually close anything. 183. */ 184. > static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose) 185. { 186. size_t packlen = pkt->written - sub->pwritten; ssl/packet.c:184:1: Parameter `pkt->curr` 182. * (i.e. it fills in all the lengths), but doesn't actually close anything. 183. */ 184. > static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose) 185. { 186. size_t packlen = pkt->written - sub->pwritten; ssl/packet.c:184:1: <RHS trace> 182. * (i.e. it fills in all the lengths), but doesn't actually close anything. 183. */ 184. > static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose) 185. { 186. size_t packlen = pkt->written - sub->pwritten; ssl/packet.c:184:1: Parameter `sub->lenbytes` 182. * (i.e. it fills in all the lengths), but doesn't actually close anything. 183. */ 184. > static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose) 185. { 186. size_t packlen = pkt->written - sub->pwritten; ssl/packet.c:199:13: Binary operation: ([0, +oo] - 1):unsigned64 by call to `WPACKET_close` 197. 198. /* Deallocate any bytes allocated for the length of the WPACKET */ 199. if ((pkt->curr - sub->lenbytes) == sub->packet_len) { ^ 200. pkt->written -= sub->lenbytes; 201. pkt->curr -= sub->lenbytes;
https://github.com/openssl/openssl/blob/dd05bd4cb46e9662fae6f0f8ca9590fef6c1c957/ssl/packet.c/#L199
d2a_code_trace_data_44289
static int sdp_read_header(AVFormatContext *s) { RTSPState *rt = s->priv_data; RTSPStream *rtsp_st; int size, i, err; char *content; char url[1024]; if (!ff_network_init()) return AVERROR(EIO); if (s->max_delay < 0) s->max_delay = DEFAULT_REORDERING_DELAY; if (rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO) rt->lower_transport = RTSP_LOWER_TRANSPORT_CUSTOM; content = av_malloc(SDP_MAX_SIZE); size = avio_read(s->pb, content, SDP_MAX_SIZE - 1); if (size <= 0) { av_free(content); return AVERROR_INVALIDDATA; } content[size] ='\0'; err = ff_sdp_parse(s, content); av_free(content); if (err) goto fail; for (i = 0; i < rt->nb_rtsp_streams; i++) { char namebuf[50]; rtsp_st = rt->rtsp_streams[i]; if (!(rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)) { getnameinfo((struct sockaddr*) &rtsp_st->sdp_ip, sizeof(rtsp_st->sdp_ip), namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST); ff_url_join(url, sizeof(url), "rtp", NULL, namebuf, rtsp_st->sdp_port, "?localport=%d&ttl=%d&connect=%d", rtsp_st->sdp_port, rtsp_st->sdp_ttl, rt->rtsp_flags & RTSP_FLAG_FILTER_SRC ? 1 : 0); append_source_addrs(url, sizeof(url), "sources", rtsp_st->nb_include_source_addrs, rtsp_st->include_source_addrs); append_source_addrs(url, sizeof(url), "block", rtsp_st->nb_exclude_source_addrs, rtsp_st->exclude_source_addrs); if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE, &s->interrupt_callback, NULL) < 0) { err = AVERROR_INVALIDDATA; goto fail; } } if ((err = ff_rtsp_open_transport_ctx(s, rtsp_st))) goto fail; } return 0; fail: ff_rtsp_close_streams(s); ff_network_close(); return err; } libavformat/rtsp.c:2161: error: Null Dereference pointer `content` last assigned on line 2155 could be null and is dereferenced at line 2161, column 5. libavformat/rtsp.c:2137:1: start of procedure sdp_read_header() 2135. } 2136. 2137. static int sdp_read_header(AVFormatContext *s) ^ 2138. { 2139. RTSPState *rt = s->priv_data; libavformat/rtsp.c:2139:5: 2137. static int sdp_read_header(AVFormatContext *s) 2138. { 2139. RTSPState *rt = s->priv_data; ^ 2140. RTSPStream *rtsp_st; 2141. int size, i, err; libavformat/rtsp.c:2145:10: 2143. char url[1024]; 2144. 2145. if (!ff_network_init()) ^ 2146. return AVERROR(EIO); 2147. libavformat/network.c:122:1: start of procedure ff_network_init() 120. int ff_network_inited_globally; 121. 122. int ff_network_init(void) ^ 123. { 124. #if HAVE_WINSOCK2_H libavformat/network.c:128:10: Taking true branch 126. #endif 127. 128. if (!ff_network_inited_globally) ^ 129. av_log(NULL, AV_LOG_WARNING, "Using network protocols without global " 130. "network initialization. Please use " libavformat/network.c:129:9: Skipping av_log(): empty list of specs 127. 128. if (!ff_network_inited_globally) 129. av_log(NULL, AV_LOG_WARNING, "Using network protocols without global " ^ 130. "network initialization. Please use " 131. "avformat_network_init(), this will " libavformat/network.c:137:5: 135. return 0; 136. #endif 137. return 1; ^ 138. } 139. libavformat/network.c:138:1: return from a call to ff_network_init 136. #endif 137. return 1; 138. } ^ 139. 140. int ff_network_wait_fd(int fd, int write) libavformat/rtsp.c:2145:10: Taking false branch 2143. char url[1024]; 2144. 2145. if (!ff_network_init()) ^ 2146. return AVERROR(EIO); 2147. libavformat/rtsp.c:2148:9: Taking false branch 2146. return AVERROR(EIO); 2147. 2148. if (s->max_delay < 0) /* Not set by the caller */ ^ 2149. s->max_delay = DEFAULT_REORDERING_DELAY; 2150. if (rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO) libavformat/rtsp.c:2150:9: Taking true branch 2148. if (s->max_delay < 0) /* Not set by the caller */ 2149. s->max_delay = DEFAULT_REORDERING_DELAY; 2150. if (rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO) ^ 2151. rt->lower_transport = RTSP_LOWER_TRANSPORT_CUSTOM; 2152. libavformat/rtsp.c:2151:9: 2149. s->max_delay = DEFAULT_REORDERING_DELAY; 2150. if (rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO) 2151. rt->lower_transport = RTSP_LOWER_TRANSPORT_CUSTOM; ^ 2152. 2153. /* read the whole sdp file */ libavformat/rtsp.c:2155:5: 2153. /* read the whole sdp file */ 2154. /* XXX: better loading */ 2155. content = av_malloc(SDP_MAX_SIZE); ^ 2156. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1); 2157. if (size <= 0) { libavutil/mem.c:61:1: start of procedure av_malloc() 59. * linker will do it automatically. */ 60. 61. void *av_malloc(size_t size) ^ 62. { 63. void *ptr = NULL; libavutil/mem.c:63:5: 61. void *av_malloc(size_t size) 62. { 63. void *ptr = NULL; ^ 64. #if CONFIG_MEMALIGN_HACK 65. long diff; libavutil/mem.c:69:9: Taking false branch 67. 68. /* let's disallow possible ambiguous cases */ 69. if (size > (INT_MAX - 32) || !size) ^ 70. return NULL; 71. libavutil/mem.c:69:35: Taking false branch 67. 68. /* let's disallow possible ambiguous cases */ 69. if (size > (INT_MAX - 32) || !size) ^ 70. return NULL; 71. libavutil/mem.c:80:9: Taking true branch 78. ((char *)ptr)[-1] = diff; 79. #elif HAVE_POSIX_MEMALIGN 80. if (posix_memalign(&ptr, 32, size)) ^ 81. ptr = NULL; 82. #elif HAVE_ALIGNED_MALLOC libavutil/mem.c:81:9: 79. #elif HAVE_POSIX_MEMALIGN 80. if (posix_memalign(&ptr, 32, size)) 81. ptr = NULL; ^ 82. #elif HAVE_ALIGNED_MALLOC 83. ptr = _aligned_malloc(size, 32); libavutil/mem.c:113:5: 111. ptr = malloc(size); 112. #endif 113. return ptr; ^ 114. } 115. libavutil/mem.c:114:1: return from a call to av_malloc 112. #endif 113. return ptr; 114. } ^ 115. 116. void *av_realloc(void *ptr, size_t size) libavformat/rtsp.c:2156:5: Skipping avio_read(): empty list of specs 2154. /* XXX: better loading */ 2155. content = av_malloc(SDP_MAX_SIZE); 2156. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1); ^ 2157. if (size <= 0) { 2158. av_free(content); libavformat/rtsp.c:2157:9: Taking false branch 2155. content = av_malloc(SDP_MAX_SIZE); 2156. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1); 2157. if (size <= 0) { ^ 2158. av_free(content); 2159. return AVERROR_INVALIDDATA; libavformat/rtsp.c:2161:5: 2159. return AVERROR_INVALIDDATA; 2160. } 2161. content[size] ='\0'; ^ 2162. 2163. err = ff_sdp_parse(s, content);
https://github.com/libav/libav/blob/a9b04b2c43f95cc17c2291f83c27a3119471d986/libavformat/rtsp.c/#L2161
d2a_code_trace_data_44290
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:679: error: BUFFER_OVERRUN_L3 Offset: 6 Size: [1, +oo] by call to `CMS_RecipientInfo_decrypt`. Showing all 13 steps of the trace crypto/cms/cms_smime.c:677:28: Call 675. * all. 676. */ 677. else if (!cert || !CMS_RecipientInfo_ktri_cert_cmp(ri, cert)) { ^ 678. CMS_RecipientInfo_set0_pkey(ri, pk); 679. r = CMS_RecipientInfo_decrypt(cms, ri); crypto/cms/cms_env.c:313:1: Parameter `ri->d.ktri->rid->d.issuerAndSerialNumber->issuer->length` 311. } 312. 313. > int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert) 314. { 315. if (ri->type != CMS_RECIPINFO_TRANS) { crypto/cms/cms_smime.c:679:17: Call 677. else if (!cert || !CMS_RecipientInfo_ktri_cert_cmp(ri, cert)) { 678. CMS_RecipientInfo_set0_pkey(ri, pk); 679. r = CMS_RecipientInfo_decrypt(cms, ri); ^ 680. CMS_RecipientInfo_set0_pkey(ri, NULL); 681. if (cert) { 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: <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:258:60: Array access: Offset: 6 Size: [1, +oo] by call to `CMS_RecipientInfo_decrypt` 256. goto err; 257. /* Check check bytes */ 258. if (((tmp[1] ^ tmp[4]) & (tmp[2] ^ tmp[5]) & (tmp[3] ^ tmp[6])) != 0xff) { ^ 259. /* Check byte failure */ 260. goto err;
https://github.com/openssl/openssl/blob/846ec07d904f9cc81d486db0db14fb84f61ff6e5/crypto/cms/cms_pwri.c/#L258
d2a_code_trace_data_44291
static ChannelElement *get_che(AACContext *ac, int type, int elem_id) { int err_printed = 0; while (ac->tags_seen_this_frame[type][elem_id] && elem_id < MAX_ELEM_ID) { if (ac->output_configured < OC_LOCKED && !err_printed) { av_log(ac->avccontext, AV_LOG_WARNING, "Duplicate channel tag found, attempting to remap.\n"); err_printed = 1; } elem_id++; } if (elem_id == MAX_ELEM_ID) return NULL; ac->tags_seen_this_frame[type][elem_id] = 1; if (ac->tag_che_map[type][elem_id]) { return ac->tag_che_map[type][elem_id]; } if (ac->tags_mapped >= tags_per_config[ac->m4ac.chan_config]) { return NULL; } switch (ac->m4ac.chan_config) { case 7: if (ac->tags_mapped == 3 && type == TYPE_CPE) { ac->tags_mapped++; return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][2]; } case 6: if (ac->tags_mapped == tags_per_config[ac->m4ac.chan_config] - 1 && (type == TYPE_LFE || type == TYPE_SCE)) { ac->tags_mapped++; return ac->tag_che_map[type][elem_id] = ac->che[TYPE_LFE][0]; } case 5: if (ac->tags_mapped == 2 && type == TYPE_CPE) { ac->tags_mapped++; return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][1]; } case 4: if (ac->tags_mapped == 2 && ac->m4ac.chan_config == 4 && type == TYPE_SCE) { ac->tags_mapped++; return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][1]; } case 3: case 2: if (ac->tags_mapped == (ac->m4ac.chan_config != 2) && type == TYPE_CPE) { ac->tags_mapped++; return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][0]; } else if (ac->m4ac.chan_config == 2) { return NULL; } case 1: if (!ac->tags_mapped && type == TYPE_SCE) { ac->tags_mapped++; return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][0]; } default: return NULL; } } libavcodec/aac.c:133: error: Buffer Overrun L2 Offset: [`elem_id`, max(16, `elem_id`)] Size: 16. libavcodec/aac.c:114:1: <Offset trace> 112. static const char overread_err[] = "Input buffer exhausted before END element found\n"; 113. 114. static ChannelElement *get_che(AACContext *ac, int type, int elem_id) ^ 115. { 116. /* Some buggy encoders appear to set all elem_ids to zero and rely on libavcodec/aac.c:114:1: Parameter `elem_id` 112. static const char overread_err[] = "Input buffer exhausted before END element found\n"; 113. 114. static ChannelElement *get_che(AACContext *ac, int type, int elem_id) ^ 115. { 116. /* Some buggy encoders appear to set all elem_ids to zero and rely on libavcodec/aac.c:114:1: <Length trace> 112. static const char overread_err[] = "Input buffer exhausted before END element found\n"; 113. 114. static ChannelElement *get_che(AACContext *ac, int type, int elem_id) ^ 115. { 116. /* Some buggy encoders appear to set all elem_ids to zero and rely on libavcodec/aac.c:114:1: Parameter `ac->tag_che_map[*][*]` 112. static const char overread_err[] = "Input buffer exhausted before END element found\n"; 113. 114. static ChannelElement *get_che(AACContext *ac, int type, int elem_id) ^ 115. { 116. /* Some buggy encoders appear to set all elem_ids to zero and rely on libavcodec/aac.c:133:16: Array access: Offset: [elem_id, max(16, elem_id)] Size: 16 131. 132. if (ac->tag_che_map[type][elem_id]) { 133. return ac->tag_che_map[type][elem_id]; ^ 134. } 135. if (ac->tags_mapped >= tags_per_config[ac->m4ac.chan_config]) {
https://github.com/libav/libav/blob/76561924cf3d9789653dc72d696f119862616891/libavcodec/aac.c/#L133
d2a_code_trace_data_44292
static inline void pred_direct_motion(H264Context * const h, int *mb_type){ MpegEncContext * const s = &h->s; const int mb_xy = s->mb_x + s->mb_y*s->mb_stride; const int b8_xy = 2*s->mb_x + 2*s->mb_y*h->b8_stride; const int b4_xy = 4*s->mb_x + 4*s->mb_y*h->b_stride; const int mb_type_col = h->ref_list[1][0].mb_type[mb_xy]; const int16_t (*l1mv0)[2] = (const int16_t (*)[2]) &h->ref_list[1][0].motion_val[0][b4_xy]; const int16_t (*l1mv1)[2] = (const int16_t (*)[2]) &h->ref_list[1][0].motion_val[1][b4_xy]; const int8_t *l1ref0 = &h->ref_list[1][0].ref_index[0][b8_xy]; const int8_t *l1ref1 = &h->ref_list[1][0].ref_index[1][b8_xy]; const int is_b8x8 = IS_8X8(*mb_type); unsigned int sub_mb_type; int i8, i4; #define MB_TYPE_16x16_OR_INTRA (MB_TYPE_16x16|MB_TYPE_INTRA4x4|MB_TYPE_INTRA16x16|MB_TYPE_INTRA_PCM) if(IS_8X8(mb_type_col) && !h->sps.direct_8x8_inference_flag){ sub_mb_type = MB_TYPE_8x8|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; *mb_type = MB_TYPE_8x8|MB_TYPE_L0L1; }else if(!is_b8x8 && (mb_type_col & MB_TYPE_16x16_OR_INTRA)){ sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; *mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; }else{ sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; *mb_type = MB_TYPE_8x8|MB_TYPE_L0L1; } if(!is_b8x8) *mb_type |= MB_TYPE_DIRECT2; if(MB_FIELD) *mb_type |= MB_TYPE_INTERLACED; tprintf(s->avctx, "mb_type = %08x, sub_mb_type = %08x, is_b8x8 = %d, mb_type_col = %08x\n", *mb_type, sub_mb_type, is_b8x8, mb_type_col); if(h->direct_spatial_mv_pred){ int ref[2]; int mv[2][2]; int list; for(list=0; list<2; list++){ int refa = h->ref_cache[list][scan8[0] - 1]; int refb = h->ref_cache[list][scan8[0] - 8]; int refc = h->ref_cache[list][scan8[0] - 8 + 4]; if(refc == -2) refc = h->ref_cache[list][scan8[0] - 8 - 1]; ref[list] = refa; if(ref[list] < 0 || (refb < ref[list] && refb >= 0)) ref[list] = refb; if(ref[list] < 0 || (refc < ref[list] && refc >= 0)) ref[list] = refc; if(ref[list] < 0) ref[list] = -1; } if(ref[0] < 0 && ref[1] < 0){ ref[0] = ref[1] = 0; mv[0][0] = mv[0][1] = mv[1][0] = mv[1][1] = 0; }else{ for(list=0; list<2; list++){ if(ref[list] >= 0) pred_motion(h, 0, 4, list, ref[list], &mv[list][0], &mv[list][1]); else mv[list][0] = mv[list][1] = 0; } } if(ref[1] < 0){ if(!is_b8x8) *mb_type &= ~MB_TYPE_L1; sub_mb_type &= ~MB_TYPE_L1; }else if(ref[0] < 0){ if(!is_b8x8) *mb_type &= ~MB_TYPE_L0; sub_mb_type &= ~MB_TYPE_L0; } if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col)){ int pair_xy = s->mb_x + (s->mb_y&~1)*s->mb_stride; int mb_types_col[2]; int b8_stride = h->b8_stride; int b4_stride = h->b_stride; *mb_type = (*mb_type & ~MB_TYPE_16x16) | MB_TYPE_8x8; if(IS_INTERLACED(*mb_type)){ mb_types_col[0] = h->ref_list[1][0].mb_type[pair_xy]; mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy+s->mb_stride]; if(s->mb_y&1){ l1ref0 -= 2*b8_stride; l1ref1 -= 2*b8_stride; l1mv0 -= 4*b4_stride; l1mv1 -= 4*b4_stride; } b8_stride *= 3; b4_stride *= 6; }else{ int cur_poc = s->current_picture_ptr->poc; int *col_poc = h->ref_list[1]->field_poc; int col_parity = FFABS(col_poc[0] - cur_poc) >= FFABS(col_poc[1] - cur_poc); int dy = 2*col_parity - (s->mb_y&1); mb_types_col[0] = mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy + col_parity*s->mb_stride]; l1ref0 += dy*b8_stride; l1ref1 += dy*b8_stride; l1mv0 += 2*dy*b4_stride; l1mv1 += 2*dy*b4_stride; b8_stride = 0; } for(i8=0; i8<4; i8++){ int x8 = i8&1; int y8 = i8>>1; int xy8 = x8+y8*b8_stride; int xy4 = 3*x8+y8*b4_stride; int a=0, b=0; if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) continue; h->sub_mb_type[i8] = sub_mb_type; fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1); fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1); if(!IS_INTRA(mb_types_col[y8]) && ( (l1ref0[xy8] == 0 && FFABS(l1mv0[xy4][0]) <= 1 && FFABS(l1mv0[xy4][1]) <= 1) || (l1ref0[xy8] < 0 && l1ref1[xy8] == 0 && FFABS(l1mv1[xy4][0]) <= 1 && FFABS(l1mv1[xy4][1]) <= 1))){ if(ref[0] > 0) a= pack16to32(mv[0][0],mv[0][1]); if(ref[1] > 0) b= pack16to32(mv[1][0],mv[1][1]); }else{ a= pack16to32(mv[0][0],mv[0][1]); b= pack16to32(mv[1][0],mv[1][1]); } fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, a, 4); fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, b, 4); } }else if(IS_16X16(*mb_type)){ int a=0, b=0; fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, (uint8_t)ref[0], 1); fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, (uint8_t)ref[1], 1); if(!IS_INTRA(mb_type_col) && ( (l1ref0[0] == 0 && FFABS(l1mv0[0][0]) <= 1 && FFABS(l1mv0[0][1]) <= 1) || (l1ref0[0] < 0 && l1ref1[0] == 0 && FFABS(l1mv1[0][0]) <= 1 && FFABS(l1mv1[0][1]) <= 1 && (h->x264_build>33 || !h->x264_build)))){ if(ref[0] > 0) a= pack16to32(mv[0][0],mv[0][1]); if(ref[1] > 0) b= pack16to32(mv[1][0],mv[1][1]); }else{ a= pack16to32(mv[0][0],mv[0][1]); b= pack16to32(mv[1][0],mv[1][1]); } fill_rectangle(&h->mv_cache[0][scan8[0]], 4, 4, 8, a, 4); fill_rectangle(&h->mv_cache[1][scan8[0]], 4, 4, 8, b, 4); }else{ for(i8=0; i8<4; i8++){ const int x8 = i8&1; const int y8 = i8>>1; if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) continue; h->sub_mb_type[i8] = sub_mb_type; fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mv[0][0],mv[0][1]), 4); fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mv[1][0],mv[1][1]), 4); fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1); fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1); if(!IS_INTRA(mb_type_col) && ( l1ref0[x8 + y8*h->b8_stride] == 0 || (l1ref0[x8 + y8*h->b8_stride] < 0 && l1ref1[x8 + y8*h->b8_stride] == 0 && (h->x264_build>33 || !h->x264_build)))){ const int16_t (*l1mv)[2]= l1ref0[x8 + y8*h->b8_stride] == 0 ? l1mv0 : l1mv1; if(IS_SUB_8X8(sub_mb_type)){ const int16_t *mv_col = l1mv[x8*3 + y8*3*h->b_stride]; if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){ if(ref[0] == 0) fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4); if(ref[1] == 0) fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4); } }else for(i4=0; i4<4; i4++){ const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*h->b_stride]; if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){ if(ref[0] == 0) *(uint32_t*)h->mv_cache[0][scan8[i8*4+i4]] = 0; if(ref[1] == 0) *(uint32_t*)h->mv_cache[1][scan8[i8*4+i4]] = 0; } } } } } }else{ const int *map_col_to_list0[2] = {h->map_col_to_list0[0], h->map_col_to_list0[1]}; const int *dist_scale_factor = h->dist_scale_factor; if(FRAME_MBAFF){ if(IS_INTERLACED(*mb_type)){ map_col_to_list0[0] = h->map_col_to_list0_field[0]; map_col_to_list0[1] = h->map_col_to_list0_field[1]; dist_scale_factor = h->dist_scale_factor_field; } if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col)){ const int pair_xy = s->mb_x + (s->mb_y&~1)*s->mb_stride; int mb_types_col[2]; int y_shift; *mb_type = MB_TYPE_8x8|MB_TYPE_L0L1 | (is_b8x8 ? 0 : MB_TYPE_DIRECT2) | (*mb_type & MB_TYPE_INTERLACED); sub_mb_type = MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2|MB_TYPE_16x16; if(IS_INTERLACED(*mb_type)){ mb_types_col[0] = h->ref_list[1][0].mb_type[pair_xy]; mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy+s->mb_stride]; if(s->mb_y&1){ l1ref0 -= 2*h->b8_stride; l1ref1 -= 2*h->b8_stride; l1mv0 -= 4*h->b_stride; l1mv1 -= 4*h->b_stride; } y_shift = 0; if( (mb_types_col[0] & MB_TYPE_16x16_OR_INTRA) && (mb_types_col[1] & MB_TYPE_16x16_OR_INTRA) && !is_b8x8) *mb_type |= MB_TYPE_16x8; else *mb_type |= MB_TYPE_8x8; }else{ int dy = (s->mb_y&1) ? 1 : 2; mb_types_col[0] = mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy+s->mb_stride]; l1ref0 += dy*h->b8_stride; l1ref1 += dy*h->b8_stride; l1mv0 += 2*dy*h->b_stride; l1mv1 += 2*dy*h->b_stride; y_shift = 2; if((mb_types_col[0] & (MB_TYPE_16x16_OR_INTRA|MB_TYPE_16x8)) && !is_b8x8) *mb_type |= MB_TYPE_16x16; else *mb_type |= MB_TYPE_8x8; } for(i8=0; i8<4; i8++){ const int x8 = i8&1; const int y8 = i8>>1; int ref0, scale; const int16_t (*l1mv)[2]= l1mv0; if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) continue; h->sub_mb_type[i8] = sub_mb_type; fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, 0, 1); if(IS_INTRA(mb_types_col[y8])){ fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, 0, 1); fill_rectangle(&h-> mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4); fill_rectangle(&h-> mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4); continue; } ref0 = l1ref0[x8 + (y8*2>>y_shift)*h->b8_stride]; if(ref0 >= 0) ref0 = map_col_to_list0[0][ref0*2>>y_shift]; else{ ref0 = map_col_to_list0[1][l1ref1[x8 + (y8*2>>y_shift)*h->b8_stride]*2>>y_shift]; l1mv= l1mv1; } scale = dist_scale_factor[ref0]; fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1); { const int16_t *mv_col = l1mv[x8*3 + (y8*6>>y_shift)*h->b_stride]; int my_col = (mv_col[1]<<y_shift)/2; int mx = (scale * mv_col[0] + 128) >> 8; int my = (scale * my_col + 128) >> 8; fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mx,my), 4); fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mx-mv_col[0],my-my_col), 4); } } return; } } if(IS_16X16(*mb_type)){ int ref, mv0, mv1; fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, 0, 1); if(IS_INTRA(mb_type_col)){ ref=mv0=mv1=0; }else{ const int ref0 = l1ref0[0] >= 0 ? map_col_to_list0[0][l1ref0[0]] : map_col_to_list0[1][l1ref1[0]]; const int scale = dist_scale_factor[ref0]; const int16_t *mv_col = l1ref0[0] >= 0 ? l1mv0[0] : l1mv1[0]; int mv_l0[2]; mv_l0[0] = (scale * mv_col[0] + 128) >> 8; mv_l0[1] = (scale * mv_col[1] + 128) >> 8; ref= ref0; mv0= pack16to32(mv_l0[0],mv_l0[1]); mv1= pack16to32(mv_l0[0]-mv_col[0],mv_l0[1]-mv_col[1]); } fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, ref, 1); fill_rectangle(&h-> mv_cache[0][scan8[0]], 4, 4, 8, mv0, 4); fill_rectangle(&h-> mv_cache[1][scan8[0]], 4, 4, 8, mv1, 4); }else{ for(i8=0; i8<4; i8++){ const int x8 = i8&1; const int y8 = i8>>1; int ref0, scale; const int16_t (*l1mv)[2]= l1mv0; if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) continue; h->sub_mb_type[i8] = sub_mb_type; fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, 0, 1); if(IS_INTRA(mb_type_col)){ fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, 0, 1); fill_rectangle(&h-> mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4); fill_rectangle(&h-> mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4); continue; } ref0 = l1ref0[x8 + y8*h->b8_stride]; if(ref0 >= 0) ref0 = map_col_to_list0[0][ref0]; else{ ref0 = map_col_to_list0[1][l1ref1[x8 + y8*h->b8_stride]]; l1mv= l1mv1; } scale = dist_scale_factor[ref0]; fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1); if(IS_SUB_8X8(sub_mb_type)){ const int16_t *mv_col = l1mv[x8*3 + y8*3*h->b_stride]; int mx = (scale * mv_col[0] + 128) >> 8; int my = (scale * mv_col[1] + 128) >> 8; fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mx,my), 4); fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mx-mv_col[0],my-mv_col[1]), 4); }else for(i4=0; i4<4; i4++){ const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*h->b_stride]; int16_t *mv_l0 = h->mv_cache[0][scan8[i8*4+i4]]; mv_l0[0] = (scale * mv_col[0] + 128) >> 8; mv_l0[1] = (scale * mv_col[1] + 128) >> 8; *(uint32_t*)h->mv_cache[1][scan8[i8*4+i4]] = pack16to32(mv_l0[0]-mv_col[0],mv_l0[1]-mv_col[1]); } } } } } libavcodec/h264.c:1012: error: Uninitialized Value The value read from ref[_] was never initialized. libavcodec/h264.c:1012:26: 1010. } 1011. 1012. if(ref[0] < 0 && ref[1] < 0){ ^ 1013. ref[0] = ref[1] = 0; 1014. mv[0][0] = mv[0][1] =
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L1012
d2a_code_trace_data_44293
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dh/dh_key.c:143: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set_locked`. Showing all 26 steps of the trace crypto/dh/dh_key.c:143:16: Call 141. 142. if (dh->flags & DH_FLAG_CACHE_MONT_P) { 143. mont = BN_MONT_CTX_set_locked(&dh->method_mont_p, ^ 144. CRYPTO_LOCK_DH, dh->p, ctx); 145. if (!mont) crypto/bn/bn_mont.c:500:1: Parameter `ctx->stack.depth` 498. } 499. 500. > BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock, 501. const BIGNUM *mod, BN_CTX *ctx) 502. { crypto/bn/bn_mont.c:522:10: Call 520. if (ret == NULL) 521. return NULL; 522. if (!BN_MONT_CTX_set(ret, mod, ctx)) { ^ 523. BN_MONT_CTX_free(ret); 524. return NULL; crypto/bn/bn_mont.c:349:1: Parameter `ctx->stack.depth` 347. } 348. 349. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 350. { 351. int ret = 0; crypto/bn/bn_mont.c:357:5: Call 355. return 0; 356. 357. BN_CTX_start(ctx); ^ 358. if ((Ri = BN_CTX_get(ctx)) == NULL) 359. goto err; 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_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 `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_MONT_CTX_set_locked` 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_44294
int tls13_enc(SSL *s, SSL3_RECORD *recs, size_t n_recs, int sending) { EVP_CIPHER_CTX *ctx; unsigned char iv[EVP_MAX_IV_LENGTH]; size_t ivlen, taglen, offset, loop; unsigned char *staticiv; unsigned char *seq; int lenu, lenf; SSL3_RECORD *rec = &recs[0]; uint32_t alg_enc; if (n_recs != 1) { return -1; } if (sending) { ctx = s->enc_write_ctx; staticiv = s->write_iv; seq = RECORD_LAYER_get_write_sequence(&s->rlayer); } else { ctx = s->enc_read_ctx; staticiv = s->read_iv; seq = RECORD_LAYER_get_read_sequence(&s->rlayer); } if (ctx == NULL) { memmove(rec->data, rec->input, rec->length); rec->input = rec->data; return 1; } ivlen = EVP_CIPHER_CTX_iv_length(ctx); if (s->early_data_state == SSL_EARLY_DATA_WRITING || s->early_data_state == SSL_EARLY_DATA_WRITE_RETRY) { alg_enc = s->session->cipher->algorithm_enc; } else { assert(s->s3->tmp.new_cipher != NULL); if (s->s3->tmp.new_cipher == NULL) return -1; alg_enc = s->s3->tmp.new_cipher->algorithm_enc; } if (alg_enc & SSL_AESCCM) { if (alg_enc & (SSL_AES128CCM8 | SSL_AES256CCM8)) taglen = EVP_CCM8_TLS_TAG_LEN; else taglen = EVP_CCM_TLS_TAG_LEN; if (sending && EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, taglen, NULL) <= 0) return -1; } else if (alg_enc & SSL_AESGCM) { taglen = EVP_GCM_TLS_TAG_LEN; } else if (alg_enc & SSL_CHACHA20) { taglen = EVP_CHACHAPOLY_TLS_TAG_LEN; } else { return -1; } if (!sending) { if (rec->length < taglen + 1) return 0; rec->length -= taglen; } if (ivlen < SEQ_NUM_SIZE) { return -1; } offset = ivlen - SEQ_NUM_SIZE; memcpy(iv, staticiv, offset); for (loop = 0; loop < SEQ_NUM_SIZE; loop++) iv[offset + loop] = staticiv[offset + loop] ^ seq[loop]; for (loop = SEQ_NUM_SIZE; loop > 0; loop--) { ++seq[loop - 1]; if (seq[loop - 1] != 0) break; } if (loop == 0) { return -1; } if (EVP_CipherInit_ex(ctx, NULL, NULL, NULL, iv, sending) <= 0 || (!sending && EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, taglen, rec->data + rec->length) <= 0) || EVP_CipherUpdate(ctx, rec->data, &lenu, rec->input, (unsigned int)rec->length) <= 0 || EVP_CipherFinal_ex(ctx, rec->data + lenu, &lenf) <= 0 || (size_t)(lenu + lenf) != rec->length) { return -1; } if (sending) { if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, taglen, rec->data + rec->length) <= 0) return -1; rec->length += taglen; } return 1; } ssl/record/rec_layer_s3.c:920: error: INTEGER_OVERFLOW_L2 ([9, +oo] - [8, 16]):unsigned64 by call to `tls13_enc`. Showing all 8 steps of the trace ssl/record/rec_layer_s3.c:632:1: Parameter `*pipelens` 630. } 631. 632. > int do_ssl3_write(SSL *s, int type, const unsigned char *buf, 633. size_t *pipelens, size_t numpipes, 634. int create_empty_fragment, size_t *written) ssl/record/rec_layer_s3.c:835:9: Assignment 833. /* lets setup the record stuff. */ 834. SSL3_RECORD_set_data(thiswr, compressdata); 835. SSL3_RECORD_set_length(thiswr, pipelens[j]); ^ 836. SSL3_RECORD_set_input(thiswr, (unsigned char *)&buf[totlen]); 837. totlen += pipelens[j]; ssl/record/rec_layer_s3.c:920:13: Call 918. * send early data - so we need to use the the tls13enc function. 919. */ 920. if (tls13_enc(s, wr, numpipes, 1) < 1) ^ 921. goto err; 922. } else { ssl/record/ssl3_record_tls13.c:24:1: <LHS trace> 22. * an internal error occurred. 23. */ 24. > int tls13_enc(SSL *s, SSL3_RECORD *recs, size_t n_recs, int sending) 25. { 26. EVP_CIPHER_CTX *ctx; ssl/record/ssl3_record_tls13.c:24:1: Parameter `recs->length` 22. * an internal error occurred. 23. */ 24. > int tls13_enc(SSL *s, SSL3_RECORD *recs, size_t n_recs, int sending) 25. { 26. EVP_CIPHER_CTX *ctx; ssl/record/ssl3_record_tls13.c:24:1: <RHS trace> 22. * an internal error occurred. 23. */ 24. > int tls13_enc(SSL *s, SSL3_RECORD *recs, size_t n_recs, int sending) 25. { 26. EVP_CIPHER_CTX *ctx; ssl/record/ssl3_record_tls13.c:24:1: Parameter `recs->length` 22. * an internal error occurred. 23. */ 24. > int tls13_enc(SSL *s, SSL3_RECORD *recs, size_t n_recs, int sending) 25. { 26. EVP_CIPHER_CTX *ctx; ssl/record/ssl3_record_tls13.c:96:9: Binary operation: ([9, +oo] - [8, 16]):unsigned64 by call to `tls13_enc` 94. if (rec->length < taglen + 1) 95. return 0; 96. rec->length -= taglen; ^ 97. } 98.
https://github.com/openssl/openssl/blob/424aa352458486d67e1e9cd3d3990dc06a60ba4a/ssl/record/ssl3_record_tls13.c/#L96
d2a_code_trace_data_44295
HANDSHAKE_RESULT *do_handshake(SSL_CTX *server_ctx, SSL_CTX *server2_ctx, SSL_CTX *client_ctx, const SSL_TEST_CTX *test_ctx) { SSL *server, *client; BIO *client_to_server, *server_to_client; HANDSHAKE_EX_DATA server_ex_data, client_ex_data; CTX_DATA client_ctx_data, server_ctx_data, server2_ctx_data; HANDSHAKE_RESULT *ret = HANDSHAKE_RESULT_new(); int client_turn = 1; peer_status_t client_status = PEER_RETRY, server_status = PEER_RETRY; handshake_status_t status = HANDSHAKE_RETRY; unsigned char* tick = NULL; size_t tick_len = 0; SSL_SESSION* sess = NULL; const unsigned char *proto = NULL; unsigned int proto_len = 0; memset(&server_ctx_data, 0, sizeof(server_ctx_data)); memset(&server2_ctx_data, 0, sizeof(server2_ctx_data)); memset(&client_ctx_data, 0, sizeof(client_ctx_data)); configure_handshake_ctx(server_ctx, server2_ctx, client_ctx, test_ctx, &server_ctx_data, &server2_ctx_data, &client_ctx_data); server = SSL_new(server_ctx); client = SSL_new(client_ctx); OPENSSL_assert(server != NULL && client != NULL); configure_handshake_ssl(server, client, test_ctx); memset(&server_ex_data, 0, sizeof(server_ex_data)); memset(&client_ex_data, 0, sizeof(client_ex_data)); ret->result = SSL_TEST_INTERNAL_ERROR; client_to_server = BIO_new(BIO_s_mem()); server_to_client = BIO_new(BIO_s_mem()); OPENSSL_assert(client_to_server != NULL && server_to_client != NULL); BIO_set_nbio(client_to_server, 1); BIO_set_nbio(server_to_client, 1); SSL_set_connect_state(client); SSL_set_accept_state(server); SSL_set_bio(client, server_to_client, client_to_server); OPENSSL_assert(BIO_up_ref(server_to_client) > 0); OPENSSL_assert(BIO_up_ref(client_to_server) > 0); SSL_set_bio(server, client_to_server, server_to_client); ex_data_idx = SSL_get_ex_new_index(0, "ex data", NULL, NULL, NULL); OPENSSL_assert(ex_data_idx >= 0); OPENSSL_assert(SSL_set_ex_data(server, ex_data_idx, &server_ex_data) == 1); OPENSSL_assert(SSL_set_ex_data(client, ex_data_idx, &client_ex_data) == 1); SSL_set_info_callback(server, &info_cb); SSL_set_info_callback(client, &info_cb); for(;;) { if (client_turn) { client_status = do_handshake_step(client); status = handshake_status(client_status, server_status, 1 ); } else { server_status = do_handshake_step(server); status = handshake_status(server_status, client_status, 0 ); } switch (status) { case HANDSHAKE_SUCCESS: ret->result = SSL_TEST_SUCCESS; goto err; case CLIENT_ERROR: ret->result = SSL_TEST_CLIENT_FAIL; goto err; case SERVER_ERROR: ret->result = SSL_TEST_SERVER_FAIL; goto err; case INTERNAL_ERROR: ret->result = SSL_TEST_INTERNAL_ERROR; goto err; case HANDSHAKE_RETRY: client_turn ^= 1; break; } } err: ret->server_alert_sent = server_ex_data.alert_sent; ret->server_alert_received = client_ex_data.alert_received; ret->client_alert_sent = client_ex_data.alert_sent; ret->client_alert_received = server_ex_data.alert_received; ret->server_protocol = SSL_version(server); ret->client_protocol = SSL_version(client); ret->servername = server_ex_data.servername; if ((sess = SSL_get0_session(client)) != NULL) SSL_SESSION_get0_ticket(sess, &tick, &tick_len); if (tick == NULL || tick_len == 0) ret->session_ticket = SSL_TEST_SESSION_TICKET_NO; else ret->session_ticket = SSL_TEST_SESSION_TICKET_YES; ret->session_ticket_do_not_call = server_ex_data.session_ticket_do_not_call; SSL_get0_next_proto_negotiated(client, &proto, &proto_len); ret->client_npn_negotiated = dup_str(proto, proto_len); SSL_get0_next_proto_negotiated(server, &proto, &proto_len); ret->server_npn_negotiated = dup_str(proto, proto_len); SSL_get0_alpn_selected(client, &proto, &proto_len); ret->client_alpn_negotiated = dup_str(proto, proto_len); SSL_get0_alpn_selected(server, &proto, &proto_len); ret->server_alpn_negotiated = dup_str(proto, proto_len); ctx_data_free_data(&server_ctx_data); ctx_data_free_data(&server2_ctx_data); ctx_data_free_data(&client_ctx_data); SSL_free(server); SSL_free(client); return ret; } test/handshake_helper.c:597: error: UNINITIALIZED_VALUE The value read from server_ex_data.servername was never initialized. Showing all 1 steps of the trace test/handshake_helper.c:597:5: 595. ret->server_protocol = SSL_version(server); 596. ret->client_protocol = SSL_version(client); 597. > ret->servername = server_ex_data.servername; 598. if ((sess = SSL_get0_session(client)) != NULL) 599. SSL_SESSION_get0_ticket(sess, &tick, &tick_len);
https://github.com/openssl/openssl/blob/70c22888c1648fe8652e77107f3c74bf2212de36/test/handshake_helper.c/#L597
d2a_code_trace_data_44296
static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, BN_CTX *ctx) { unsigned char *buf = NULL; int b, ret = 0, bit, bytes, mask; OPENSSL_CTX *libctx = bn_get_lib_ctx(ctx); if (bits == 0) { if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY) goto toosmall; BN_zero(rnd); return 1; } if (bits < 0 || (bits == 1 && top > 0)) goto toosmall; bytes = (bits + 7) / 8; bit = (bits - 1) % 8; mask = 0xff << (bit + 1); buf = OPENSSL_malloc(bytes); if (buf == NULL) { BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); goto err; } b = flag == NORMAL ? rand_bytes_ex(libctx, buf, bytes) : rand_priv_bytes_ex(libctx, buf, bytes); if (b <= 0) goto err; if (flag == TESTING) { int i; unsigned char c; for (i = 0; i < bytes; i++) { if (rand_bytes_ex(libctx, &c, 1) <= 0) goto err; if (c >= 128 && i > 0) buf[i] = buf[i - 1]; else if (c < 42) buf[i] = 0; else if (c < 84) buf[i] = 255; } } if (top >= 0) { if (top) { if (bit == 0) { buf[0] = 1; buf[1] |= 0x80; } else { buf[0] |= (3 << (bit - 1)); } } else { buf[0] |= (1 << bit); } } buf[0] &= ~mask; if (bottom) buf[bytes - 1] |= 1; if (!BN_bin2bn(buf, bytes, rnd)) goto err; ret = 1; err: OPENSSL_clear_free(buf, bytes); bn_check_top(rnd); return ret; toosmall: BNerr(BN_F_BNRAND, BN_R_BITS_TOO_SMALL); return 0; } test/bntest.c:657: error: BUFFER_OVERRUN_L3 Offset: [-1, 1030] Size: [1, 1031] by call to `BN_bntest_rand`. Showing all 12 steps of the trace test/bntest.c:657:14: Call 655. 656. for (i = 0; i < NUM0; i++) { 657. if (!TEST_true(BN_bntest_rand(a, 1024, 0, 0))) ^ 658. goto err; 659. for (j = 0; j < 2; j++) { crypto/bn/bn_rand.c:111:1: Parameter `bits` 109. } 110. 111. > int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom) 112. { 113. return bnrand(TESTING, rnd, bits, top, bottom, NULL); crypto/bn/bn_rand.c:113:12: Call 111. int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom) 112. { 113. return bnrand(TESTING, rnd, bits, top, bottom, NULL); ^ 114. } 115. crypto/bn/bn_rand.c:62:14: <Offset trace> 60. unsigned char c; 61. 62. for (i = 0; i < bytes; i++) { ^ 63. if (rand_bytes_ex(libctx, &c, 1) <= 0) 64. goto err; crypto/bn/bn_rand.c:62:14: Assignment 60. unsigned char c; 61. 62. for (i = 0; i < bytes; i++) { ^ 63. if (rand_bytes_ex(libctx, &c, 1) <= 0) 64. goto err; crypto/bn/bn_rand.c:23:1: <Length trace> 21. } BNRAND_FLAG; 22. 23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, 24. BN_CTX *ctx) 25. { crypto/bn/bn_rand.c:23:1: Parameter `bits` 21. } BNRAND_FLAG; 22. 23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, 24. BN_CTX *ctx) 25. { crypto/bn/bn_rand.c:39:5: Assignment 37. goto toosmall; 38. 39. bytes = (bits + 7) / 8; ^ 40. bit = (bits - 1) % 8; 41. mask = 0xff << (bit + 1); crypto/bn/bn_rand.c:43:11: Call 41. mask = 0xff << (bit + 1); 42. 43. buf = OPENSSL_malloc(bytes); ^ 44. if (buf == NULL) { 45. BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/bn/bn_rand.c:43:5: Assignment 41. mask = 0xff << (bit + 1); 42. 43. buf = OPENSSL_malloc(bytes); ^ 44. if (buf == NULL) { 45. BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE); crypto/bn/bn_rand.c:88:9: Array access: Offset: [-1, 1030] Size: [1, 1031] by call to `BN_bntest_rand` 86. buf[0] &= ~mask; 87. if (bottom) /* set bottom bit if requested */ 88. buf[bytes - 1] |= 1; ^ 89. if (!BN_bin2bn(buf, bytes, rnd)) 90. goto err;
https://github.com/openssl/openssl/blob/bd01733fdd9a5a0acdc72cf5c6601d37e8ddd801/crypto/bn/bn_rand.c/#L88
d2a_code_trace_data_44297
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dsa/dsa_gen.c:219: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_div`. Showing all 15 steps of the trace crypto/dsa/dsa_gen.c:101:5: Call 99. goto err; 100. 101. BN_CTX_start(ctx); ^ 102. 103. r0 = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/dsa/dsa_gen.c:219:18: Call 217. if (!BN_lshift1(r0, q)) 218. goto err; 219. if (!BN_mod(c, X, r0, ctx)) ^ 220. goto err; 221. if (!BN_sub(r0, c, BN_value_one())) 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_44298
void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) { unsigned long hash; OPENSSL_LH_NODE *nn, **rn; void *ret; lh->error = 0; rn = getrn(lh, data, &hash); if (*rn == NULL) { lh->num_no_delete++; return (NULL); } else { nn = *rn; *rn = nn->next; ret = nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))) contract(lh); return (ret); } apps/s_time.c:422: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `SSL_free`. Showing all 16 steps of the trace apps/s_time.c:385:21: Call 383. 384. if (scon == NULL) 385. serverCon = SSL_new(ctx); ^ 386. else { 387. serverCon = scon; ssl/ssl_lib.c:518:1: Parameter `ctx->sessions->num_items` 516. } 517. 518. > SSL *SSL_new(SSL_CTX *ctx) 519. { 520. SSL *s; apps/s_time.c:422:13: Call 420. ERR_print_errors(bio_err); 421. if (scon == NULL) 422. SSL_free(serverCon); ^ 423. return NULL; 424. } ssl/ssl_lib.c:926:1: Parameter `s->initial_ctx->sessions->num_items` 924. } 925. 926. > void SSL_free(SSL *s) 927. { 928. int i; ssl/ssl_lib.c:963:9: Call 961. /* Make the next call work :-) */ 962. if (s->session != NULL) { 963. ssl_clear_bad_session(s); ^ 964. SSL_SESSION_free(s->session); 965. } ssl/ssl_sess.c:986:1: Parameter `s->initial_ctx->sessions->num_items` 984. } 985. 986. > int ssl_clear_bad_session(SSL *s) 987. { 988. if ((s->session != NULL) && ssl/ssl_sess.c:991:9: Call 989. !(s->shutdown & SSL_SENT_SHUTDOWN) && 990. !(SSL_in_init(s) || SSL_in_before(s))) { 991. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 992. return (1); 993. } else ssl/ssl_sess.c:693:1: Parameter `ctx->sessions->num_items` 691. } 692. 693. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 694. { 695. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:695:12: Call 693. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 694. { 695. return remove_session_lock(ctx, c, 1); ^ 696. } 697. ssl/ssl_sess.c:698:1: Parameter `ctx->sessions->num_items` 696. } 697. 698. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 699. { 700. SSL_SESSION *r; ssl/ssl_sess.c:708:17: Call 706. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 707. ret = 1; 708. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 709. SSL_SESSION_list_remove(ctx, c); 710. } ssl/ssl_locl.h:581:1: Parameter `lh->num_items` 579. }; 580. 581. > DEFINE_LHASH_OF(SSL_SESSION); 582. /* Needed in ssl_cert.c */ 583. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:581:1: Call 579. }; 580. 581. > DEFINE_LHASH_OF(SSL_SESSION); 582. /* Needed in ssl_cert.c */ 583. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:103:1: <LHS trace> 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:103:1: Parameter `lh->num_items` 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:123:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `SSL_free` 121. } 122. 123. lh->num_items--; ^ 124. if ((lh->num_nodes > MIN_NODES) && 125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
https://github.com/openssl/openssl/blob/2dca984babedf93c560aba54da3f4c9222ee0d12/crypto/lhash/lhash.c/#L123
d2a_code_trace_data_44299
static int ts_verify_cert(X509_STORE *store, STACK_OF(X509) *untrusted, X509 *signer, STACK_OF(X509) **chain) { X509_STORE_CTX *cert_ctx = NULL; int i; int ret = 0; *chain = NULL; cert_ctx = X509_STORE_CTX_new(); if (cert_ctx == NULL) { TSerr(TS_F_TS_VERIFY_CERT, ERR_R_MALLOC_FAILURE); goto err; } if (!X509_STORE_CTX_init(cert_ctx, store, signer, untrusted)) goto end; X509_STORE_CTX_set_purpose(cert_ctx, X509_PURPOSE_TIMESTAMP_SIGN); i = X509_verify_cert(cert_ctx); if (i <= 0) { int j = X509_STORE_CTX_get_error(cert_ctx); TSerr(TS_F_TS_VERIFY_CERT, TS_R_CERTIFICATE_VERIFY_ERROR); ERR_add_error_data(2, "Verify error:", X509_verify_cert_error_string(j)); goto err; } *chain = X509_STORE_CTX_get1_chain(cert_ctx); ret = 1; goto end; err: ret = 0; end: X509_STORE_CTX_free(cert_ctx); return ret; } crypto/ts/ts_rsp_verify.c:197: error: MEMORY_LEAK memory dynamically allocated by call to `X509_STORE_CTX_new()` at line 173, column 16 is not reachable after line 197, column 5. Showing all 41 steps of the trace crypto/ts/ts_rsp_verify.c:165:1: start of procedure ts_verify_cert() 163. * freeing the vector. 164. */ 165. > static int ts_verify_cert(X509_STORE *store, STACK_OF(X509) *untrusted, 166. X509 *signer, STACK_OF(X509) **chain) 167. { crypto/ts/ts_rsp_verify.c:168:5: 166. X509 *signer, STACK_OF(X509) **chain) 167. { 168. > X509_STORE_CTX *cert_ctx = NULL; 169. int i; 170. int ret = 0; crypto/ts/ts_rsp_verify.c:170:5: 168. X509_STORE_CTX *cert_ctx = NULL; 169. int i; 170. > int ret = 0; 171. 172. *chain = NULL; crypto/ts/ts_rsp_verify.c:172:5: 170. int ret = 0; 171. 172. > *chain = NULL; 173. cert_ctx = X509_STORE_CTX_new(); 174. if (cert_ctx == NULL) { crypto/ts/ts_rsp_verify.c:173:5: 171. 172. *chain = NULL; 173. > cert_ctx = X509_STORE_CTX_new(); 174. if (cert_ctx == NULL) { 175. TSerr(TS_F_TS_VERIFY_CERT, ERR_R_MALLOC_FAILURE); crypto/x509/x509_vfy.c:2150:1: start of procedure X509_STORE_CTX_new() 2148. } 2149. 2150. > X509_STORE_CTX *X509_STORE_CTX_new(void) 2151. { 2152. X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); crypto/x509/x509_vfy.c:2152:5: 2150. X509_STORE_CTX *X509_STORE_CTX_new(void) 2151. { 2152. > X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); 2153. 2154. if (ctx == NULL) { crypto/mem.c:186:1: start of procedure CRYPTO_zalloc() 184. } 185. 186. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:188:5: 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. > void *ret = CRYPTO_malloc(num, file, line); 189. 190. FAILTEST(); crypto/mem.c:158:1: start of procedure CRYPTO_malloc() 156. #endif 157. 158. > void *CRYPTO_malloc(size_t num, const char *file, int line) 159. { 160. void *ret = NULL; crypto/mem.c:160:5: 158. void *CRYPTO_malloc(size_t num, const char *file, int line) 159. { 160. > void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:162:9: Taking false branch 160. void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 163. return malloc_impl(num, file, line); 164. crypto/mem.c:165:9: Taking false branch 163. return malloc_impl(num, file, line); 164. 165. if (num == 0) ^ 166. return NULL; 167. crypto/mem.c:169:5: 167. 168. FAILTEST(); 169. > allow_customize = 0; 170. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 171. if (call_malloc_debug) { crypto/mem.c:179:5: 177. } 178. #else 179. > osslargused(file); osslargused(line); 180. ret = malloc(num); 181. #endif crypto/mem.c:179:24: 177. } 178. #else 179. > osslargused(file); osslargused(line); 180. ret = malloc(num); 181. #endif crypto/mem.c:180:5: 178. #else 179. osslargused(file); osslargused(line); 180. > ret = malloc(num); 181. #endif 182. crypto/mem.c:183:5: 181. #endif 182. 183. > return ret; 184. } 185. crypto/mem.c:184:1: return from a call to CRYPTO_malloc 182. 183. return ret; 184. > } 185. 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:191:9: Taking true branch 189. 190. FAILTEST(); 191. if (ret != NULL) ^ 192. memset(ret, 0, num); 193. return ret; crypto/mem.c:192:9: 190. FAILTEST(); 191. if (ret != NULL) 192. > memset(ret, 0, num); 193. return ret; 194. } crypto/mem.c:193:5: 191. if (ret != NULL) 192. memset(ret, 0, num); 193. > return ret; 194. } 195. crypto/mem.c:194:1: return from a call to CRYPTO_zalloc 192. memset(ret, 0, num); 193. return ret; 194. > } 195. 196. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/x509/x509_vfy.c:2154:9: Taking false branch 2152. X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx)); 2153. 2154. if (ctx == NULL) { ^ 2155. X509err(X509_F_X509_STORE_CTX_NEW, ERR_R_MALLOC_FAILURE); 2156. return NULL; crypto/x509/x509_vfy.c:2158:5: 2156. return NULL; 2157. } 2158. > return ctx; 2159. } 2160. crypto/x509/x509_vfy.c:2159:1: return from a call to X509_STORE_CTX_new 2157. } 2158. return ctx; 2159. > } 2160. 2161. void X509_STORE_CTX_free(X509_STORE_CTX *ctx) crypto/ts/ts_rsp_verify.c:174:9: Taking false branch 172. *chain = NULL; 173. cert_ctx = X509_STORE_CTX_new(); 174. if (cert_ctx == NULL) { ^ 175. TSerr(TS_F_TS_VERIFY_CERT, ERR_R_MALLOC_FAILURE); 176. goto err; crypto/ts/ts_rsp_verify.c:178:10: Taking true branch 176. goto err; 177. } 178. if (!X509_STORE_CTX_init(cert_ctx, store, signer, untrusted)) ^ 179. goto end; 180. X509_STORE_CTX_set_purpose(cert_ctx, X509_PURPOSE_TIMESTAMP_SIGN); crypto/ts/ts_rsp_verify.c:196:1: 194. ret = 0; 195. 196. > end: 197. X509_STORE_CTX_free(cert_ctx); 198. return ret; crypto/ts/ts_rsp_verify.c:197:5: 195. 196. end: 197. > X509_STORE_CTX_free(cert_ctx); 198. return ret; 199. } crypto/x509/x509_vfy.c:2161:1: start of procedure X509_STORE_CTX_free() 2159. } 2160. 2161. > void X509_STORE_CTX_free(X509_STORE_CTX *ctx) 2162. { 2163. if (ctx == NULL) crypto/x509/x509_vfy.c:2163:9: Taking false branch 2161. void X509_STORE_CTX_free(X509_STORE_CTX *ctx) 2162. { 2163. if (ctx == NULL) ^ 2164. return; 2165. crypto/x509/x509_vfy.c:2166:5: Skipping X509_STORE_CTX_cleanup(): empty list of specs 2164. return; 2165. 2166. X509_STORE_CTX_cleanup(ctx); ^ 2167. OPENSSL_free(ctx); 2168. } crypto/x509/x509_vfy.c:2167:5: 2165. 2166. X509_STORE_CTX_cleanup(ctx); 2167. > OPENSSL_free(ctx); 2168. } 2169. crypto/mem.c:253:1: start of procedure 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:255:9: Taking true branch 253. void CRYPTO_free(void *str, const char *file, int line) 254. { 255. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 256. free_impl(str, file, line); 257. return; crypto/mem.c:255:30: Taking true branch 253. void CRYPTO_free(void *str, const char *file, int line) 254. { 255. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 256. free_impl(str, file, line); 257. return; crypto/mem.c:256:9: Skipping __function_pointer__(): unresolved function pointer 254. { 255. if (free_impl != NULL && free_impl != &CRYPTO_free) { 256. free_impl(str, file, line); ^ 257. return; 258. } crypto/mem.c:257:9: 255. if (free_impl != NULL && free_impl != &CRYPTO_free) { 256. free_impl(str, file, line); 257. > return; 258. } 259. crypto/mem.c:271:1: return from a call to CRYPTO_free 269. free(str); 270. #endif 271. > } 272. 273. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/x509/x509_vfy.c:2168:1: return from a call to X509_STORE_CTX_free 2166. X509_STORE_CTX_cleanup(ctx); 2167. OPENSSL_free(ctx); 2168. > } 2169. 2170. int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509,
https://github.com/openssl/openssl/blob/84c34ba8762463057d372e22ad98a045dbd9a51f/crypto/ts/ts_rsp_verify.c/#L197
d2a_code_trace_data_44300
static int expand(OPENSSL_LHASH *lh) { OPENSSL_LH_NODE **n, **n1, **n2, *np; unsigned int p, pmax, nni, j; unsigned long hash; nni = lh->num_alloc_nodes; p = lh->p; pmax = lh->pmax; if (p + 1 >= pmax) { j = nni * 2; n = OPENSSL_realloc(lh->b, sizeof(OPENSSL_LH_NODE *) * j); if (n == NULL) { lh->error++; return 0; } lh->b = n; memset(n + nni, 0, sizeof(*n) * (j - nni)); lh->pmax = nni; lh->num_alloc_nodes = j; lh->num_expand_reallocs++; lh->p = 0; } else { lh->p++; } lh->num_nodes++; lh->num_expands++; n1 = &(lh->b[p]); n2 = &(lh->b[p + pmax]); *n2 = NULL; 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; } return 1; } test/sslapitest.c:4827: error: BUFFER_OVERRUN_L3 Offset added: [272, +oo] (⇐ [16, +oo] + [256, +oo]) Size: [1, +oo] by call to `TXT_DB_insert`. Showing all 24 steps of the trace test/sslapitest.c:4803:12: Call 4801. goto end; 4802. 4803. gNid = SRP_create_verifier(userid, password, &row[DB_srpsalt], ^ 4804. &row[DB_srpverifier], NULL, NULL); 4805. if (!TEST_ptr(gNid)) crypto/srp/srp_vfy.c:649:10: Call 647. goto err; 648. 649. if (!SRP_create_verifier_BN(user, pass, &s, &v, N_bn, g_bn)) ^ 650. goto err; 651. crypto/srp/srp_vfy.c:722:9: Call 720. } 721. 722. x = SRP_Calc_x(salttmp, user, pass); ^ 723. if (x == NULL) 724. goto err; crypto/srp/srp_lib.c:136:10: Call 134. goto err; 135. 136. if (!EVP_DigestInit_ex(ctxt, EVP_sha1(), NULL) ^ 137. || !EVP_DigestUpdate(ctxt, user, strlen(user)) 138. || !EVP_DigestUpdate(ctxt, ":", 1) crypto/evp/digest.c:93:20: Call 91. } else { 92. /* Ask if an ENGINE is reserved for this job */ 93. impl = ENGINE_get_digest_engine(type->type); ^ 94. } 95. if (impl != NULL) { crypto/engine/tb_digest.c:65:12: Call 63. ENGINE *ENGINE_get_digest_engine(int nid) 64. { 65. return engine_table_select(&digest_table, nid); ^ 66. } 67. crypto/engine/eng_table.c:212:10: Call 210. * operations. But don't worry about a debug printout 211. */ 212. if (!int_table_check(table, 0)) ^ 213. goto end; 214. tmplate.nid = nid; crypto/engine/eng_table.c:73:15: Call 71. if (!create) 72. return 0; 73. if ((lh = lh_ENGINE_PILE_new(engine_pile_hash, engine_pile_cmp)) == NULL) ^ 74. return 0; 75. *t = (ENGINE_TABLE *)lh; crypto/engine/eng_int.h:152:1: Call 150. typedef struct st_engine_pile ENGINE_PILE; 151. 152. > DEFINE_LHASH_OF(ENGINE_PILE); 153. 154. #endif /* HEADER_ENGINE_INT_H */ crypto/lhash/lhash.c:64:5: Assignment 62. ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h); 63. ret->num_nodes = MIN_NODES / 2; 64. ret->num_alloc_nodes = MIN_NODES; ^ 65. ret->pmax = MIN_NODES / 2; 66. ret->up_load = UP_LOAD; test/sslapitest.c:4827:17: Call 4825. || !TEST_ptr(row[DB_srptype]) 4826. || !TEST_ptr(row[DB_srpgN]) 4827. || !TEST_true(TXT_DB_insert(db, row))) ^ 4828. goto end; 4829. crypto/txt_db/txt_db.c:237:1: Parameter `(*db->index)->num_alloc_nodes` 235. } 236. 237. > int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *row) 238. { 239. int i; crypto/txt_db/txt_db.c:260:19: Call 258. if ((db->qual[i] != NULL) && (db->qual[i] (row) == 0)) 259. continue; 260. (void)lh_OPENSSL_STRING_insert(db->index[i], row); ^ 261. if (lh_OPENSSL_STRING_retrieve(db->index[i], row) == NULL) 262. goto err1; include/openssl/lhash.h:202:1: Parameter `lh->num_alloc_nodes` 200. LHASH_OF(type) 201. 202. > DEFINE_LHASH_OF(OPENSSL_STRING); 203. # ifdef _MSC_VER 204. /* include/openssl/lhash.h:202:1: Call 200. LHASH_OF(type) 201. 202. > DEFINE_LHASH_OF(OPENSSL_STRING); 203. # ifdef _MSC_VER 204. /* crypto/lhash/lhash.c:104:1: Parameter `lh->num_alloc_nodes` 102. } 103. 104. > void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data) 105. { 106. unsigned long hash; crypto/lhash/lhash.c:111:77: Call 109. 110. lh->error = 0; 111. if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh)) ^ 112. return NULL; /* 'lh->error++' already done in 'expand' */ 113. crypto/lhash/lhash.c:222:1: <Offset trace> 220. } 221. 222. > static int expand(OPENSSL_LHASH *lh) 223. { 224. OPENSSL_LH_NODE **n, **n1, **n2, *np; crypto/lhash/lhash.c:222:1: Parameter `lh->num_alloc_nodes` 220. } 221. 222. > static int expand(OPENSSL_LHASH *lh) 223. { 224. OPENSSL_LH_NODE **n, **n1, **n2, *np; crypto/lhash/lhash.c:228:5: Assignment 226. unsigned long hash; 227. 228. nni = lh->num_alloc_nodes; ^ 229. p = lh->p; 230. pmax = lh->pmax; crypto/lhash/lhash.c:222:1: <Length trace> 220. } 221. 222. > static int expand(OPENSSL_LHASH *lh) 223. { 224. OPENSSL_LH_NODE **n, **n1, **n2, *np; crypto/lhash/lhash.c:222:1: Parameter `lh->num_alloc_nodes` 220. } 221. 222. > static int expand(OPENSSL_LHASH *lh) 223. { 224. OPENSSL_LH_NODE **n, **n1, **n2, *np; crypto/lhash/lhash.c:228:5: Assignment 226. unsigned long hash; 227. 228. nni = lh->num_alloc_nodes; ^ 229. p = lh->p; 230. pmax = lh->pmax; crypto/lhash/lhash.c:239:9: Array access: Offset added: [272, +oo] (⇐ [16, +oo] + [256, +oo]) Size: [1, +oo] by call to `TXT_DB_insert` 237. } 238. lh->b = n; 239. memset(n + nni, 0, sizeof(*n) * (j - nni)); ^ 240. lh->pmax = nni; 241. lh->num_alloc_nodes = j;
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/lhash/lhash.c/#L239
d2a_code_trace_data_44301
char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) { const X509_NAME_ENTRY *ne; int i; int n, lold, l, l1, l2, num, j, type; const char *s; char *p; unsigned char *q; BUF_MEM *b = NULL; static const char hex[17] = "0123456789ABCDEF"; int gs_doit[4]; char tmp_buf[80]; #ifdef CHARSET_EBCDIC unsigned char ebcdic_buf[1024]; #endif if (buf == NULL) { if ((b = BUF_MEM_new()) == NULL) goto err; if (!BUF_MEM_grow(b, 200)) goto err; b->data[0] = '\0'; len = 200; } else if (len == 0) { return NULL; } if (a == NULL) { if (b) { buf = b->data; OPENSSL_free(b); } strncpy(buf, "NO X509_NAME", len); buf[len - 1] = '\0'; return buf; } len--; l = 0; for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { ne = sk_X509_NAME_ENTRY_value(a->entries, i); n = OBJ_obj2nid(ne->object); if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) { i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object); s = tmp_buf; } l1 = strlen(s); type = ne->value->type; num = ne->value->length; if (num > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } q = ne->value->data; #ifdef CHARSET_EBCDIC if (type == V_ASN1_GENERALSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_PRINTABLESTRING || type == V_ASN1_TELETEXSTRING || type == V_ASN1_IA5STRING) { if (num > (int)sizeof(ebcdic_buf)) num = sizeof(ebcdic_buf); ascii2ebcdic(ebcdic_buf, q, num); q = ebcdic_buf; } #endif if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) { gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0; for (j = 0; j < num; j++) if (q[j] != 0) gs_doit[j & 3] = 1; if (gs_doit[0] | gs_doit[1] | gs_doit[2]) gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; else { gs_doit[0] = gs_doit[1] = gs_doit[2] = 0; gs_doit[3] = 1; } } else gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; for (l2 = j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; l2++; #ifndef CHARSET_EBCDIC if ((q[j] < ' ') || (q[j] > '~')) l2 += 3; #else if ((os_toascii[q[j]] < os_toascii[' ']) || (os_toascii[q[j]] > os_toascii['~'])) l2 += 3; #endif } lold = l; l += 1 + l1 + 1 + l2; if (l > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } if (b != NULL) { if (!BUF_MEM_grow(b, l + 1)) goto err; p = &(b->data[lold]); } else if (l > len) { break; } else p = &(buf[lold]); *(p++) = '/'; memcpy(p, s, (unsigned int)l1); p += l1; *(p++) = '='; #ifndef CHARSET_EBCDIC q = ne->value->data; #endif for (j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; #ifndef CHARSET_EBCDIC n = q[j]; if ((n < ' ') || (n > '~')) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = n; #else n = os_toascii[q[j]]; if ((n < os_toascii[' ']) || (n > os_toascii['~'])) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = q[j]; #endif } *p = '\0'; } if (b != NULL) { p = b->data; OPENSSL_free(b); } else p = buf; if (i == 0) *p = '\0'; return (p); err: X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE); end: BUF_MEM_free(b); return (NULL); } crypto/x509/t_crl.c:53: error: BUFFER_OVERRUN_L3 Offset added: [0, 200] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace crypto/x509/t_crl.c:53:9: Call 51. X509_CRL_get0_signature(x, &sig, &sig_alg); 52. X509_signature_print(out, sig_alg, NULL); 53. p = X509_NAME_oneline(X509_CRL_get_issuer(x), NULL, 0); ^ 54. BIO_printf(out, "%8sIssuer: %s\n", "", p); 55. OPENSSL_free(p); 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: [0, 200] 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/645c694d85c8f48c74e7db8730ead874656c781e/crypto/x509/x509_obj.c/#L56
d2a_code_trace_data_44302
static void dequant_lsp16r(GetBitContext *gb, double *i_lsps, const double *old, double *a1, double *a2, int q_mode) { static const uint16_t vec_sizes[3] = { 128, 128, 128 }; static const double mul_lsf[3] = { 1.2232979501e-3, 1.4062241527e-3, 1.6114744851e-3 }; static const double base_lsf[3] = { M_PI * -5.5830e-2, M_PI * -5.2908e-2, M_PI * -5.4776e-2 }; const float (*ipol_tab)[2][16] = q_mode ? wmavoice_lsp16_intercoeff_b : wmavoice_lsp16_intercoeff_a; uint16_t interpol, v[3]; int n; dequant_lsp16i(gb, i_lsps); interpol = get_bits(gb, 5); v[0] = get_bits(gb, 7); v[1] = get_bits(gb, 7); v[2] = get_bits(gb, 7); for (n = 0; n < 16; n++) { double delta = old[n] - i_lsps[n]; a1[n] = ipol_tab[interpol][0][n] * delta + i_lsps[n]; a1[16 + n] = ipol_tab[interpol][1][n] * delta + i_lsps[n]; } dequant_lsps( a2, 10, v, vec_sizes, 1, wmavoice_dq_lsp16r1, mul_lsf, base_lsf); dequant_lsps(&a2[10], 10, &v[1], &vec_sizes[1], 1, wmavoice_dq_lsp16r2, &mul_lsf[1], &base_lsf[1]); dequant_lsps(&a2[20], 12, &v[2], &vec_sizes[2], 1, wmavoice_dq_lsp16r3, &mul_lsf[2], &base_lsf[2]); } libavcodec/wmavoice.c:1791: error: Buffer Overrun L2 Offset: [2, 17] (⇐ 2 + [0, 15]) Size: 3 by call to `dequant_lsp16r`. libavcodec/wmavoice.c:1734:1: Array declaration 1732. * fully parse the superframe 1733. */ 1734. static int synth_superframe(AVCodecContext *ctx, AVFrame *frame, ^ 1735. int *got_frame_ptr) 1736. { libavcodec/wmavoice.c:1791:13: Call 1789. dequant_lsp10r(gb, lsps[2], prev_lsps, a1, a2, s->lsp_q_mode); 1790. } else /* s->lsps == 16 */ 1791. dequant_lsp16r(gb, lsps[2], prev_lsps, a1, a2, s->lsp_q_mode); ^ 1792. 1793. for (n = 0; n < s->lsps; n++) { libavcodec/wmavoice.c:973:10: <Offset trace> 971. v[2] = get_bits(gb, 7); 972. 973. for (n = 0; n < 16; n++) { ^ 974. double delta = old[n] - i_lsps[n]; 975. a1[n] = ipol_tab[interpol][0][n] * delta + i_lsps[n]; libavcodec/wmavoice.c:973:10: Assignment 971. v[2] = get_bits(gb, 7); 972. 973. for (n = 0; n < 16; n++) { ^ 974. double delta = old[n] - i_lsps[n]; 975. a1[n] = ipol_tab[interpol][0][n] * delta + i_lsps[n]; libavcodec/wmavoice.c:950:1: <Length trace> 948. * generate LSPs for the other frames from them (residual coding). 949. */ 950. static void dequant_lsp16r(GetBitContext *gb, ^ 951. double *i_lsps, const double *old, 952. double *a1, double *a2, int q_mode) libavcodec/wmavoice.c:950:1: Parameter `*i_lsps` 948. * generate LSPs for the other frames from them (residual coding). 949. */ 950. static void dequant_lsp16r(GetBitContext *gb, ^ 951. double *i_lsps, const double *old, 952. double *a1, double *a2, int q_mode) libavcodec/wmavoice.c:974:33: Array access: Offset: [2, 17] (⇐ 2 + [0, 15]) Size: 3 by call to `dequant_lsp16r` 972. 973. for (n = 0; n < 16; n++) { 974. double delta = old[n] - i_lsps[n]; ^ 975. a1[n] = ipol_tab[interpol][0][n] * delta + i_lsps[n]; 976. a1[16 + n] = ipol_tab[interpol][1][n] * delta + i_lsps[n];
https://github.com/libav/libav/blob/c6507946d428ee082676d5917fbb3eb0d1d7eb2e/libavcodec/wmavoice.c/#L974
d2a_code_trace_data_44303
void t2p_pdf_currenttime(T2P* t2p) { struct tm* currenttime; time_t timenow; if (time(&timenow) == (time_t) -1) { TIFFError(TIFF2PDF_MODULE, "Can't get the current time: %s", strerror(errno)); timenow = (time_t) 0; } currenttime = localtime(&timenow); snprintf(t2p->pdf_datetime, sizeof(t2p->pdf_datetime), "D:%.4d%.2d%.2d%.2d%.2d%.2d", (currenttime->tm_year + 1900) % 65536, (currenttime->tm_mon + 1) % 256, (currenttime->tm_mday) % 256, (currenttime->tm_hour) % 256, (currenttime->tm_min) % 256, (currenttime->tm_sec) % 256); return; } tools/tiff2pdf.c:4217: error: Null Dereference pointer `currenttime` last assigned on line 4214 could be null and is dereferenced at line 4217, column 5. tools/tiff2pdf.c:4203:1: start of procedure t2p_pdf_currenttime() 4201. */ 4202. 4203. void t2p_pdf_currenttime(T2P* t2p) ^ 4204. { 4205. struct tm* currenttime; tools/tiff2pdf.c:4208:6: Taking false branch 4206. time_t timenow; 4207. 4208. if (time(&timenow) == (time_t) -1) { ^ 4209. TIFFError(TIFF2PDF_MODULE, 4210. "Can't get the current time: %s", strerror(errno)); tools/tiff2pdf.c:4214:2: 4212. } 4213. 4214. currenttime = localtime(&timenow); ^ 4215. snprintf(t2p->pdf_datetime, sizeof(t2p->pdf_datetime), 4216. "D:%.4d%.2d%.2d%.2d%.2d%.2d", tools/tiff2pdf.c:4215:2: 4213. 4214. currenttime = localtime(&timenow); 4215. snprintf(t2p->pdf_datetime, sizeof(t2p->pdf_datetime), ^ 4216. "D:%.4d%.2d%.2d%.2d%.2d%.2d", 4217. (currenttime->tm_year + 1900) % 65536,
https://gitlab.com/libtiff/libtiff/blob/6dac309a9701d15ac52d895d566ddae2ed49db9b/tools/tiff2pdf.c/#L4217
d2a_code_trace_data_44304
int ff_h264_fill_default_ref_list(H264Context *h) { int i, len; if (h->slice_type_nos == AV_PICTURE_TYPE_B) { Picture *sorted[32]; int cur_poc, list; int lens[2]; if (FIELD_PICTURE(h)) cur_poc = h->cur_pic_ptr->field_poc[h->picture_structure == PICT_BOTTOM_FIELD]; else cur_poc = h->cur_pic_ptr->poc; for (list = 0; list < 2; list++) { len = add_sorted(sorted, h->short_ref, h->short_ref_count, cur_poc, 1 ^ list); len += add_sorted(sorted + len, h->short_ref, h->short_ref_count, cur_poc, 0 ^ list); assert(len <= 32); len = build_def_list(h->default_ref_list[list], FF_ARRAY_ELEMS(h->default_ref_list[0]), sorted, len, 0, h->picture_structure); len += build_def_list(h->default_ref_list[list] + len, FF_ARRAY_ELEMS(h->default_ref_list[0]) - len, h->long_ref, 16, 1, h->picture_structure); if (len < h->ref_count[list]) memset(&h->default_ref_list[list][len], 0, sizeof(Picture) * (h->ref_count[list] - len)); lens[list] = len; } if (lens[0] == lens[1] && lens[1] > 1) { for (i = 0; i < lens[0] && h->default_ref_list[0][i].f.buf[0]->buffer == h->default_ref_list[1][i].f.buf[0]->buffer; i++); if (i == lens[0]) { Picture tmp; COPY_PICTURE(&tmp, &h->default_ref_list[1][0]); COPY_PICTURE(&h->default_ref_list[1][0], &h->default_ref_list[1][1]); COPY_PICTURE(&h->default_ref_list[1][1], &tmp); } } } else { len = build_def_list(h->default_ref_list[0], FF_ARRAY_ELEMS(h->default_ref_list[0]), h->short_ref, h->short_ref_count, 0, h->picture_structure); len += build_def_list(h->default_ref_list[0] + len, FF_ARRAY_ELEMS(h->default_ref_list[0]) - len, h-> long_ref, 16, 1, h->picture_structure); if (len < h->ref_count[0]) memset(&h->default_ref_list[0][len], 0, sizeof(Picture) * (h->ref_count[0] - len)); } #ifdef TRACE for (i = 0; i < h->ref_count[0]; i++) { tprintf(h->avctx, "List0: %s fn:%d 0x%p\n", (h->default_ref_list[0][i].long_ref ? "LT" : "ST"), h->default_ref_list[0][i].pic_id, h->default_ref_list[0][i].f.data[0]); } if (h->slice_type_nos == AV_PICTURE_TYPE_B) { for (i = 0; i < h->ref_count[1]; i++) { tprintf(h->avctx, "List1: %s fn:%d 0x%p\n", (h->default_ref_list[1][i].long_ref ? "LT" : "ST"), h->default_ref_list[1][i].pic_id, h->default_ref_list[1][i].f.data[0]); } } #endif return 0; } libavcodec/h264.c:3705: error: Buffer Overrun L3 Offset added: [-86528, +oo] Size: 43264 by call to `ff_h264_fill_default_ref_list`. libavcodec/h264.c:3289:1: Parameter `h->ref_count[*]` 3287. * @return 0 if okay, <0 if an error occurred, 1 if decoding must not be multithreaded 3288. */ 3289. static int decode_slice_header(H264Context *h, H264Context *h0) ^ 3290. { 3291. unsigned int first_mb_in_slice; libavcodec/h264.c:3705:9: Call 3703. 3704. if (!default_ref_list_done) 3705. ff_h264_fill_default_ref_list(h); ^ 3706. 3707. if (h->slice_type_nos != AV_PICTURE_TYPE_I) { libavcodec/h264_refs.c:116:1: <Offset trace> 114. } 115. 116. int ff_h264_fill_default_ref_list(H264Context *h) ^ 117. { 118. int i, len; libavcodec/h264_refs.c:116:1: Parameter `h->ref_count[*]` 114. } 115. 116. int ff_h264_fill_default_ref_list(H264Context *h) ^ 117. { 118. int i, len; libavcodec/h264_refs.c:116:1: <Length trace> 114. } 115. 116. int ff_h264_fill_default_ref_list(H264Context *h) ^ 117. { 118. int i, len; libavcodec/h264_refs.c:116:1: Parameter `h->default_ref_list[*][*]` 114. } 115. 116. int ff_h264_fill_default_ref_list(H264Context *h) ^ 117. { 118. int i, len; libavcodec/h264_refs.c:142:17: Array access: Offset added: [-86528, +oo] Size: 43264 by call to `ff_h264_fill_default_ref_list` 140. 141. if (len < h->ref_count[list]) 142. memset(&h->default_ref_list[list][len], 0, sizeof(Picture) * (h->ref_count[list] - len)); ^ 143. lens[list] = len; 144. }
https://github.com/libav/libav/blob/0673ede985a6560e7efb86dab1c58fb7f95ce587/libavcodec/h264_refs.c/#L142
d2a_code_trace_data_44305
int test_mod_exp(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b, *c, *d, *e; int i; a = BN_new(); b = BN_new(); c = BN_new(); d = BN_new(); e = BN_new(); BN_one(a); BN_one(b); BN_zero(c); if (BN_mod_exp(d, a, b, c, ctx)) { fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n"); return 0; } BN_bntest_rand(c, 30, 0, 1); for (i = 0; i < num2; i++) { BN_bntest_rand(a, 20 + i * 5, 0, 0); BN_bntest_rand(b, 2 + i, 0, 0); if (!BN_mod_exp(d, a, b, c, ctx)) return (0); if (bp != NULL) { if (!results) { BN_print(bp, a); BIO_puts(bp, " ^ "); BN_print(bp, b); BIO_puts(bp, " % "); BN_print(bp, c); BIO_puts(bp, " - "); } BN_print(bp, d); BIO_puts(bp, "\n"); } BN_exp(e, a, b, ctx); BN_sub(e, e, d); BN_div(a, b, e, c, ctx); if (!BN_is_zero(b)) { fprintf(stderr, "Modulo exponentiation test failed!\n"); return 0; } } BN_hex2bn(&a, "050505050505"); BN_hex2bn(&b, "02"); BN_hex2bn(&c, "4141414141414141414141274141414141414141414141414141414141414141" "4141414141414141414141414141414141414141414141414141414141414141" "4141414141414141414141800000000000000000000000000000000000000000" "0000000000000000000000000000000000000000000000000000000000000000" "0000000000000000000000000000000000000000000000000000000000000000" "0000000000000000000000000000000000000000000000000000000001"); BN_mod_exp(d, a, b, c, ctx); BN_mul(e, a, a, ctx); if (BN_cmp(d, e)) { fprintf(stderr, "BN_mod_exp and BN_mul produce different results!\n"); return 0; } BN_free(a); BN_free(b); BN_free(c); BN_free(d); BN_free(e); return (1); } test/bntest.c:984: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 978, column 9 is not reachable after line 984, column 17. Showing all 143 steps of the trace test/bntest.c:969:1: start of procedure test_mod_exp() 967. } 968. 969. > int test_mod_exp(BIO *bp, BN_CTX *ctx) 970. { 971. BIGNUM *a, *b, *c, *d, *e; test/bntest.c:974:5: 972. int i; 973. 974. > a = BN_new(); 975. b = BN_new(); 976. c = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:975:5: 973. 974. a = BN_new(); 975. > b = BN_new(); 976. c = BN_new(); 977. d = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:976:5: 974. a = BN_new(); 975. b = BN_new(); 976. > c = BN_new(); 977. d = BN_new(); 978. e = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:977:5: 975. b = BN_new(); 976. c = BN_new(); 977. > d = BN_new(); 978. e = BN_new(); 979. crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:978:5: 976. c = BN_new(); 977. d = BN_new(); 978. > e = BN_new(); 979. 980. BN_one(a); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:980:5: 978. e = BN_new(); 979. 980. > BN_one(a); 981. BN_one(b); 982. BN_zero(c); crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is true 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:981:5: 979. 980. BN_one(a); 981. > BN_one(b); 982. BN_zero(c); 983. if (BN_mod_exp(d, a, b, c, ctx)) { crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is true 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:982:5: 980. BN_one(a); 981. BN_one(b); 982. > BN_zero(c); 983. if (BN_mod_exp(d, a, b, c, ctx)) { 984. fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n"); crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is false 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:983:9: Taking true branch 981. BN_one(b); 982. BN_zero(c); 983. if (BN_mod_exp(d, a, b, c, ctx)) { ^ 984. fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n"); 985. return 0; test/bntest.c:984:9: 982. BN_zero(c); 983. if (BN_mod_exp(d, a, b, c, ctx)) { 984. > fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n"); 985. return 0; 986. }
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L984
d2a_code_trace_data_44306
static void info_cb(const SSL *s, int where, int ret) { if (where & SSL_CB_ALERT) { HANDSHAKE_EX_DATA *ex_data = (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); if (where & SSL_CB_WRITE) { ex_data->alert_sent = ret; } else { ex_data->alert_received = ret; } } } test/handshake_helper.c:73: error: NULL_DEREFERENCE pointer `ex_data` last assigned on line 68 could be null and is dereferenced at line 73, column 13. Showing all 12 steps of the trace test/handshake_helper.c:65:1: start of procedure info_cb() 63. static int ex_data_idx; 64. 65. > static void info_cb(const SSL *s, int where, int ret) 66. { 67. if (where & SSL_CB_ALERT) { test/handshake_helper.c:67:9: Taking true branch 65. static void info_cb(const SSL *s, int where, int ret) 66. { 67. if (where & SSL_CB_ALERT) { ^ 68. HANDSHAKE_EX_DATA *ex_data = 69. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); test/handshake_helper.c:68:9: 66. { 67. if (where & SSL_CB_ALERT) { 68. > HANDSHAKE_EX_DATA *ex_data = 69. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); 70. if (where & SSL_CB_WRITE) { ssl/ssl_lib.c:3496:1: start of procedure SSL_get_ex_data() 3494. } 3495. 3496. > void *SSL_get_ex_data(const SSL *s, int idx) 3497. { 3498. return (CRYPTO_get_ex_data(&s->ex_data, idx)); ssl/ssl_lib.c:3498:5: 3496. void *SSL_get_ex_data(const SSL *s, int idx) 3497. { 3498. > return (CRYPTO_get_ex_data(&s->ex_data, idx)); 3499. } 3500. crypto/ex_data.c:369:1: start of procedure CRYPTO_get_ex_data() 367. * particular index in the class used by this variable 368. */ 369. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 370. { 371. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) crypto/ex_data.c:371:9: Taking true branch 369. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 370. { 371. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) ^ 372. return NULL; 373. return sk_void_value(ad->sk, idx); crypto/ex_data.c:372:9: 370. { 371. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) 372. > return NULL; 373. return sk_void_value(ad->sk, idx); 374. } crypto/ex_data.c:374:1: return from a call to CRYPTO_get_ex_data 372. return NULL; 373. return sk_void_value(ad->sk, idx); 374. > } ssl/ssl_lib.c:3499:1: return from a call to SSL_get_ex_data 3497. { 3498. return (CRYPTO_get_ex_data(&s->ex_data, idx)); 3499. > } 3500. 3501. int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg) test/handshake_helper.c:70:13: Taking false branch 68. HANDSHAKE_EX_DATA *ex_data = 69. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); 70. if (where & SSL_CB_WRITE) { ^ 71. ex_data->alert_sent = ret; 72. } else { test/handshake_helper.c:73:13: 71. ex_data->alert_sent = ret; 72. } else { 73. > ex_data->alert_received = ret; 74. } 75. }
https://github.com/openssl/openssl/blob/70c22888c1648fe8652e77107f3c74bf2212de36/test/handshake_helper.c/#L73
d2a_code_trace_data_44307
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_ossl.c:434: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set_locked`. Showing all 28 steps of the trace crypto/rsa/rsa_ossl.c:358:5: Call 356. if ((ctx = BN_CTX_new()) == NULL) 357. goto err; 358. BN_CTX_start(ctx); ^ 359. f = BN_CTX_get(ctx); 360. ret = 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/rsa/rsa_ossl.c:434:18: Call 432. 433. if (rsa->flags & RSA_FLAG_CACHE_PUBLIC) 434. if (!BN_MONT_CTX_set_locked ^ 435. (&rsa->_method_mod_n, CRYPTO_LOCK_RSA, rsa->n, ctx)) { 436. BN_free(local_d); crypto/bn/bn_mont.c:500:1: Parameter `ctx->stack.depth` 498. } 499. 500. > BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock, 501. const BIGNUM *mod, BN_CTX *ctx) 502. { crypto/bn/bn_mont.c:522:10: Call 520. if (ret == NULL) 521. return NULL; 522. if (!BN_MONT_CTX_set(ret, mod, ctx)) { ^ 523. BN_MONT_CTX_free(ret); 524. return NULL; crypto/bn/bn_mont.c:349:1: Parameter `ctx->stack.depth` 347. } 348. 349. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 350. { 351. int ret = 0; crypto/bn/bn_mont.c:357:5: Call 355. return 0; 356. 357. BN_CTX_start(ctx); ^ 358. if ((Ri = BN_CTX_get(ctx)) == NULL) 359. goto err; 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_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 `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_MONT_CTX_set_locked` 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_44308
static ossl_inline size_t constant_time_lt_s(size_t a, size_t b) { return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b))); } ssl/record/ssl3_record.c:1689: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [1, 17728]):unsigned64 by call to `ssl3_cbc_copy_mac`. Showing all 10 steps of the trace ssl/record/ssl3_record.c:1553:1: Parameter `s->rlayer.rrec.length` 1551. } 1552. 1553. > int dtls1_process_record(SSL *s, DTLS1_BITMAP *bitmap) 1554. { 1555. int i; ssl/record/ssl3_record.c:1593:5: Assignment 1591. /* decrypt in place in 'rr->input' */ 1592. rr->data = rr->input; 1593. rr->orig_len = rr->length; ^ 1594. 1595. if (SSL_READ_ETM(s) && s->read_hash) { ssl/record/ssl3_record.c:1689:18: Call 1687. */ 1688. mac = mac_tmp; 1689. if (!ssl3_cbc_copy_mac(mac_tmp, rr, mac_size)) { ^ 1690. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_DTLS1_PROCESS_RECORD, 1691. ERR_R_INTERNAL_ERROR); ssl/record/ssl3_record.c:1478:1: Parameter `md_size` 1476. #define CBC_MAC_ROTATE_IN_PLACE 1477. 1478. > int ssl3_cbc_copy_mac(unsigned char *out, 1479. const SSL3_RECORD *rec, size_t md_size) 1480. { ssl/record/ssl3_record.c:1536:26: Call 1534. ((volatile unsigned char *)rotated_mac)[rotate_offset ^ 32]; 1535. out[j++] = rotated_mac[rotate_offset++]; 1536. rotate_offset &= constant_time_lt_s(rotate_offset, md_size); ^ 1537. } 1538. #else include/internal/constant_time_locl.h:119:1: <LHS trace> 117. } 118. 119. > static ossl_inline size_t constant_time_lt_s(size_t a, size_t b) 120. { 121. return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b))); include/internal/constant_time_locl.h:119:1: Parameter `a` 117. } 118. 119. > static ossl_inline size_t constant_time_lt_s(size_t a, size_t b) 120. { 121. return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b))); include/internal/constant_time_locl.h:119:1: <RHS trace> 117. } 118. 119. > static ossl_inline size_t constant_time_lt_s(size_t a, size_t b) 120. { 121. return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b))); include/internal/constant_time_locl.h:119:1: Parameter `b` 117. } 118. 119. > static ossl_inline size_t constant_time_lt_s(size_t a, size_t b) 120. { 121. return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b))); include/internal/constant_time_locl.h:121:12: Binary operation: ([0, +oo] - [1, 17728]):unsigned64 by call to `ssl3_cbc_copy_mac` 119. static ossl_inline size_t constant_time_lt_s(size_t a, size_t b) 120. { 121. return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b))); ^ 122. } 123.
https://github.com/openssl/openssl/blob/a8ea8018fa187e22fb4989450b550589e20f62c2/include/internal/constant_time_locl.h/#L121
d2a_code_trace_data_44309
void RAND_add(const void *buf, int num, double randomness) { const RAND_METHOD *meth = RAND_get_rand_method(); if (meth->add != NULL) meth->add(buf, num, randomness); } crypto/rand/rand_lib.c:801: error: NULL_DEREFERENCE pointer `meth` last assigned on line 799 could be null and is dereferenced at line 801, column 9. Showing all 14 steps of the trace crypto/rand/rand_lib.c:797:1: start of procedure RAND_add() 795. } 796. 797. > void RAND_add(const void *buf, int num, double randomness) 798. { 799. const RAND_METHOD *meth = RAND_get_rand_method(); crypto/rand/rand_lib.c:799:5: 797. void RAND_add(const void *buf, int num, double randomness) 798. { 799. > const RAND_METHOD *meth = RAND_get_rand_method(); 800. 801. if (meth->add != NULL) crypto/rand/rand_lib.c:733:1: start of procedure RAND_get_rand_method() 731. } 732. 733. > const RAND_METHOD *RAND_get_rand_method(void) 734. { 735. const RAND_METHOD *tmp_meth = NULL; crypto/rand/rand_lib.c:735:5: 733. const RAND_METHOD *RAND_get_rand_method(void) 734. { 735. > const RAND_METHOD *tmp_meth = NULL; 736. 737. if (!RUN_ONCE(&rand_init, do_rand_init)) crypto/rand/rand_lib.c:737:10: 735. const RAND_METHOD *tmp_meth = NULL; 736. 737. > if (!RUN_ONCE(&rand_init, do_rand_init)) 738. return NULL; 739. crypto/threads_pthread.c:111:1: start of procedure CRYPTO_THREAD_run_once() 109. } 110. 111. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 112. { 113. if (pthread_once(once, init) != 0) crypto/threads_pthread.c:113:9: Taking true branch 111. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 112. { 113. if (pthread_once(once, init) != 0) ^ 114. return 0; 115. crypto/threads_pthread.c:114:9: 112. { 113. if (pthread_once(once, init) != 0) 114. > return 0; 115. 116. return 1; crypto/threads_pthread.c:117:1: return from a call to CRYPTO_THREAD_run_once 115. 116. return 1; 117. > } 118. 119. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)) crypto/rand/rand_lib.c:737:10: Condition is false 735. const RAND_METHOD *tmp_meth = NULL; 736. 737. if (!RUN_ONCE(&rand_init, do_rand_init)) ^ 738. return NULL; 739. crypto/rand/rand_lib.c:737:10: Taking true branch 735. const RAND_METHOD *tmp_meth = NULL; 736. 737. if (!RUN_ONCE(&rand_init, do_rand_init)) ^ 738. return NULL; 739. crypto/rand/rand_lib.c:738:9: 736. 737. if (!RUN_ONCE(&rand_init, do_rand_init)) 738. > return NULL; 739. 740. CRYPTO_THREAD_write_lock(rand_meth_lock); crypto/rand/rand_lib.c:761:1: return from a call to RAND_get_rand_method 759. CRYPTO_THREAD_unlock(rand_meth_lock); 760. return tmp_meth; 761. > } 762. 763. #ifndef OPENSSL_NO_ENGINE crypto/rand/rand_lib.c:801:9: 799. const RAND_METHOD *meth = RAND_get_rand_method(); 800. 801. > if (meth->add != NULL) 802. meth->add(buf, num, randomness); 803. }
https://github.com/openssl/openssl/blob/1901516a4ba909fff12e0e7815aa2d499f4d6d67/crypto/rand/rand_lib.c/#L801
d2a_code_trace_data_44310
static inline int check_sessionid(AVFormatContext *s, RTSPMessageHeader *request) { RTSPState *rt = s->priv_data; unsigned char *session_id = rt->session_id; if (!session_id[0]) { av_log(s, AV_LOG_WARNING, "There is no session-id at the moment\n"); return 0; } if (strcmp(session_id, request->session_id)) { av_log(s, AV_LOG_ERROR, "Unexpected session-id %s\n", request->session_id); rtsp_send_reply(s, RTSP_STATUS_SESSION, NULL, request->seq); return AVERROR_STREAM_NOT_FOUND; } return 0; } libavformat/rtspdec.c:133: error: Null Dereference pointer `null` is dereferenced by call to `rtsp_send_reply()` at line 133, column 9. libavformat/rtspdec.c:121:1: start of procedure check_sessionid() 119. } 120. 121. static inline int check_sessionid(AVFormatContext *s, ^ 122. RTSPMessageHeader *request) 123. { libavformat/rtspdec.c:124:5: 122. RTSPMessageHeader *request) 123. { 124. RTSPState *rt = s->priv_data; ^ 125. unsigned char *session_id = rt->session_id; 126. if (!session_id[0]) { libavformat/rtspdec.c:125:5: 123. { 124. RTSPState *rt = s->priv_data; 125. unsigned char *session_id = rt->session_id; ^ 126. if (!session_id[0]) { 127. av_log(s, AV_LOG_WARNING, "There is no session-id at the moment\n"); libavformat/rtspdec.c:126:10: Taking false branch 124. RTSPState *rt = s->priv_data; 125. unsigned char *session_id = rt->session_id; 126. if (!session_id[0]) { ^ 127. av_log(s, AV_LOG_WARNING, "There is no session-id at the moment\n"); 128. return 0; libavformat/rtspdec.c:130:9: Taking true branch 128. return 0; 129. } 130. if (strcmp(session_id, request->session_id)) { ^ 131. av_log(s, AV_LOG_ERROR, "Unexpected session-id %s\n", 132. request->session_id); libavformat/rtspdec.c:131:9: Skipping av_log(): empty list of specs 129. } 130. if (strcmp(session_id, request->session_id)) { 131. av_log(s, AV_LOG_ERROR, "Unexpected session-id %s\n", ^ 132. request->session_id); 133. rtsp_send_reply(s, RTSP_STATUS_SESSION, NULL, request->seq); libavformat/rtspdec.c:133:9: 131. av_log(s, AV_LOG_ERROR, "Unexpected session-id %s\n", 132. request->session_id); 133. rtsp_send_reply(s, RTSP_STATUS_SESSION, NULL, request->seq); ^ 134. return AVERROR_STREAM_NOT_FOUND; 135. } libavformat/rtspdec.c:94:1: start of procedure rtsp_send_reply() 92. } 93. 94. static int rtsp_send_reply(AVFormatContext *s, enum RTSPStatusCode code, ^ 95. const char *extracontent, uint16_t seq) 96. { libavformat/rtspdec.c:97:5: 95. const char *extracontent, uint16_t seq) 96. { 97. RTSPState *rt = s->priv_data; ^ 98. char message[4096]; 99. int index = 0; libavformat/rtspdec.c:99:5: 97. RTSPState *rt = s->priv_data; 98. char message[4096]; 99. int index = 0; ^ 100. while (status_messages[index].code) { 101. if (status_messages[index].code == code) { libavformat/rtspdec.c:100:12: Loop condition is true. Entering loop body 98. char message[4096]; 99. int index = 0; 100. while (status_messages[index].code) { ^ 101. if (status_messages[index].code == code) { 102. snprintf(message, sizeof(message), "RTSP/1.0 %d %s\r\n", libavformat/rtspdec.c:101:13: Taking false branch 99. int index = 0; 100. while (status_messages[index].code) { 101. if (status_messages[index].code == code) { ^ 102. snprintf(message, sizeof(message), "RTSP/1.0 %d %s\r\n", 103. code, status_messages[index].message); libavformat/rtspdec.c:106:9: 104. break; 105. } 106. index++; ^ 107. } 108. if (!status_messages[index].code) libavformat/rtspdec.c:100:12: Loop condition is true. Entering loop body 98. char message[4096]; 99. int index = 0; 100. while (status_messages[index].code) { ^ 101. if (status_messages[index].code == code) { 102. snprintf(message, sizeof(message), "RTSP/1.0 %d %s\r\n", libavformat/rtspdec.c:101:13: Taking false branch 99. int index = 0; 100. while (status_messages[index].code) { 101. if (status_messages[index].code == code) { ^ 102. snprintf(message, sizeof(message), "RTSP/1.0 %d %s\r\n", 103. code, status_messages[index].message); libavformat/rtspdec.c:106:9: 104. break; 105. } 106. index++; ^ 107. } 108. if (!status_messages[index].code) libavformat/rtspdec.c:100:12: Loop condition is true. Entering loop body 98. char message[4096]; 99. int index = 0; 100. while (status_messages[index].code) { ^ 101. if (status_messages[index].code == code) { 102. snprintf(message, sizeof(message), "RTSP/1.0 %d %s\r\n", libavformat/rtspdec.c:101:13: Taking false branch 99. int index = 0; 100. while (status_messages[index].code) { 101. if (status_messages[index].code == code) { ^ 102. snprintf(message, sizeof(message), "RTSP/1.0 %d %s\r\n", 103. code, status_messages[index].message); libavformat/rtspdec.c:106:9: 104. break; 105. } 106. index++; ^ 107. } 108. if (!status_messages[index].code) libavformat/rtspdec.c:100:12: Loop condition is false. Leaving loop 98. char message[4096]; 99. int index = 0; 100. while (status_messages[index].code) { ^ 101. if (status_messages[index].code == code) { 102. snprintf(message, sizeof(message), "RTSP/1.0 %d %s\r\n", libavformat/rtspdec.c:108:10: Taking true branch 106. index++; 107. } 108. if (!status_messages[index].code) ^ 109. return AVERROR(EINVAL); 110. av_strlcatf(message, sizeof(message), "CSeq: %d\r\n", seq); libavformat/rtspdec.c:109:9: 107. } 108. if (!status_messages[index].code) 109. return AVERROR(EINVAL); ^ 110. av_strlcatf(message, sizeof(message), "CSeq: %d\r\n", seq); 111. av_strlcatf(message, sizeof(message), "Server: %s\r\n", LIBAVFORMAT_IDENT); libavformat/rtspdec.c:119:1: return from a call to rtsp_send_reply 117. 118. return 0; 119. } ^ 120. 121. static inline int check_sessionid(AVFormatContext *s,
https://github.com/libav/libav/blob/0aa907cfb1bbc647ee4b6da62fac5c89d7b4d318/libavformat/rtspdec.c/#L133
d2a_code_trace_data_44311
static int pbe_test_init(struct evp_test *t, const char *alg) { struct pbe_data *pdat; int pbe_type = 0; #ifndef OPENSSL_NO_SCRYPT if (strcmp(alg, "scrypt") == 0) pbe_type = PBE_TYPE_SCRYPT; #endif else if (strcmp(alg, "pbkdf2") == 0) pbe_type = PBE_TYPE_PBKDF2; else if (strcmp(alg, "pkcs12") == 0) pbe_type = PBE_TYPE_PKCS12; else fprintf(stderr, "Unknown pbe algorithm %s\n", alg); pdat = OPENSSL_malloc(sizeof(*pdat)); pdat->pbe_type = pbe_type; pdat->pass = NULL; pdat->salt = NULL; pdat->N = 0; pdat->r = 0; pdat->p = 0; pdat->maxmem = 0; pdat->id = 0; pdat->iter = 0; pdat->md = NULL; t->data = pdat; return 1; } test/evp_test.c:1436: error: NULL_DEREFERENCE pointer `pdat` last assigned on line 1435 could be null and is dereferenced at line 1436, column 5. Showing all 17 steps of the trace test/evp_test.c:1420:1: start of procedure pbe_test_init() 1418. } 1419. 1420. > static int pbe_test_init(struct evp_test *t, const char *alg) 1421. { 1422. struct pbe_data *pdat; test/evp_test.c:1423:5: 1421. { 1422. struct pbe_data *pdat; 1423. > int pbe_type = 0; 1424. 1425. #ifndef OPENSSL_NO_SCRYPT test/evp_test.c:1426:9: Taking false branch 1424. 1425. #ifndef OPENSSL_NO_SCRYPT 1426. if (strcmp(alg, "scrypt") == 0) ^ 1427. pbe_type = PBE_TYPE_SCRYPT; 1428. #endif test/evp_test.c:1429:14: Taking false branch 1427. pbe_type = PBE_TYPE_SCRYPT; 1428. #endif 1429. else if (strcmp(alg, "pbkdf2") == 0) ^ 1430. pbe_type = PBE_TYPE_PBKDF2; 1431. else if (strcmp(alg, "pkcs12") == 0) test/evp_test.c:1431:14: Taking false branch 1429. else if (strcmp(alg, "pbkdf2") == 0) 1430. pbe_type = PBE_TYPE_PBKDF2; 1431. else if (strcmp(alg, "pkcs12") == 0) ^ 1432. pbe_type = PBE_TYPE_PKCS12; 1433. else test/evp_test.c:1434:9: 1432. pbe_type = PBE_TYPE_PKCS12; 1433. else 1434. > fprintf(stderr, "Unknown pbe algorithm %s\n", alg); 1435. pdat = OPENSSL_malloc(sizeof(*pdat)); 1436. pdat->pbe_type = pbe_type; test/evp_test.c:1435:5: 1433. else 1434. fprintf(stderr, "Unknown pbe algorithm %s\n", alg); 1435. > pdat = OPENSSL_malloc(sizeof(*pdat)); 1436. pdat->pbe_type = pbe_type; 1437. pdat->pass = NULL; crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) test/evp_test.c:1436:5: 1434. fprintf(stderr, "Unknown pbe algorithm %s\n", alg); 1435. pdat = OPENSSL_malloc(sizeof(*pdat)); 1436. > pdat->pbe_type = pbe_type; 1437. pdat->pass = NULL; 1438. pdat->salt = NULL;
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/evp_test.c/#L1436
d2a_code_trace_data_44312
int test_gf2m_mod_sqrt(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b[2], *c, *d, *e, *f; int i, j, ret = 0; int p0[] = { 163, 7, 6, 3, 0, -1 }; int p1[] = { 193, 15, 0, -1 }; a = BN_new(); b[0] = BN_new(); b[1] = BN_new(); c = BN_new(); d = BN_new(); e = BN_new(); f = BN_new(); BN_GF2m_arr2poly(p0, b[0]); BN_GF2m_arr2poly(p1, b[1]); for (i = 0; i < num0; i++) { BN_bntest_rand(a, 512, 0, 0); for (j = 0; j < 2; j++) { BN_GF2m_mod(c, a, b[j]); BN_GF2m_mod_sqrt(d, a, b[j], ctx); BN_GF2m_mod_sqr(e, d, b[j], ctx); BN_GF2m_add(f, c, e); if (!BN_is_zero(f)) { fprintf(stderr, "GF(2^m) modular square root test failed!\n"); goto err; } } } ret = 1; err: BN_free(a); BN_free(b[0]); BN_free(b[1]); BN_free(c); BN_free(d); BN_free(e); BN_free(f); return ret; } test/bntest.c:1568: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 1541, column 9 is not reachable after line 1568, column 5. Showing all 177 steps of the trace test/bntest.c:1534:1: start of procedure test_gf2m_mod_sqrt() 1532. } 1533. 1534. > int test_gf2m_mod_sqrt(BIO *bp, BN_CTX *ctx) 1535. { 1536. BIGNUM *a, *b[2], *c, *d, *e, *f; test/bntest.c:1537:5: 1535. { 1536. BIGNUM *a, *b[2], *c, *d, *e, *f; 1537. > int i, j, ret = 0; 1538. int p0[] = { 163, 7, 6, 3, 0, -1 }; 1539. int p1[] = { 193, 15, 0, -1 }; test/bntest.c:1538:5: 1536. BIGNUM *a, *b[2], *c, *d, *e, *f; 1537. int i, j, ret = 0; 1538. > int p0[] = { 163, 7, 6, 3, 0, -1 }; 1539. int p1[] = { 193, 15, 0, -1 }; 1540. test/bntest.c:1539:5: 1537. int i, j, ret = 0; 1538. int p0[] = { 163, 7, 6, 3, 0, -1 }; 1539. > int p1[] = { 193, 15, 0, -1 }; 1540. 1541. a = BN_new(); test/bntest.c:1541:5: 1539. int p1[] = { 193, 15, 0, -1 }; 1540. 1541. > a = BN_new(); 1542. b[0] = BN_new(); 1543. b[1] = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1542:5: 1540. 1541. a = BN_new(); 1542. > b[0] = BN_new(); 1543. b[1] = BN_new(); 1544. c = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1543:5: 1541. a = BN_new(); 1542. b[0] = BN_new(); 1543. > b[1] = BN_new(); 1544. c = BN_new(); 1545. d = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1544:5: 1542. b[0] = BN_new(); 1543. b[1] = BN_new(); 1544. > c = BN_new(); 1545. d = BN_new(); 1546. e = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1545:5: 1543. b[1] = BN_new(); 1544. c = BN_new(); 1545. > d = BN_new(); 1546. e = BN_new(); 1547. f = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1546:5: 1544. c = BN_new(); 1545. d = BN_new(); 1546. > e = BN_new(); 1547. f = BN_new(); 1548. crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1547:5: 1545. d = BN_new(); 1546. e = BN_new(); 1547. > f = BN_new(); 1548. 1549. BN_GF2m_arr2poly(p0, b[0]); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1549:5: Skipping BN_GF2m_arr2poly(): empty list of specs 1547. f = BN_new(); 1548. 1549. BN_GF2m_arr2poly(p0, b[0]); ^ 1550. BN_GF2m_arr2poly(p1, b[1]); 1551. test/bntest.c:1550:5: Skipping BN_GF2m_arr2poly(): empty list of specs 1548. 1549. BN_GF2m_arr2poly(p0, b[0]); 1550. BN_GF2m_arr2poly(p1, b[1]); ^ 1551. 1552. for (i = 0; i < num0; i++) { test/bntest.c:1552:10: 1550. BN_GF2m_arr2poly(p1, b[1]); 1551. 1552. > for (i = 0; i < num0; i++) { 1553. BN_bntest_rand(a, 512, 0, 0); 1554. for (j = 0; j < 2; j++) { test/bntest.c:1552:17: Loop condition is false. Leaving loop 1550. BN_GF2m_arr2poly(p1, b[1]); 1551. 1552. for (i = 0; i < num0; i++) { ^ 1553. BN_bntest_rand(a, 512, 0, 0); 1554. for (j = 0; j < 2; j++) { test/bntest.c:1566:5: 1564. } 1565. } 1566. > ret = 1; 1567. err: 1568. BN_free(a); test/bntest.c:1567:2: 1565. } 1566. ret = 1; 1567. > err: 1568. BN_free(a); 1569. BN_free(b[0]); test/bntest.c:1568:5: 1566. ret = 1; 1567. err: 1568. > BN_free(a); 1569. BN_free(b[0]); 1570. BN_free(b[1]); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L1568
d2a_code_trace_data_44313
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } crypto/bn/bn_prime.c:478: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_sub`. Showing all 26 steps of the trace crypto/bn/bn_prime.c:471:10: Call 469. goto err; 470. 471. if (!BN_rand(rnd, bits, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD)) ^ 472. goto err; 473. crypto/bn/bn_rand.c:108:12: Call 106. int BN_rand(BIGNUM *rnd, int bits, int top, int bottom) 107. { 108. return bnrand(NORMAL, rnd, bits, top, bottom, NULL); ^ 109. } 110. crypto/bn/bn_rand.c:23:1: Parameter `rnd->top` 21. } BNRAND_FLAG; 22. 23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, 24. BN_CTX *ctx) 25. { crypto/bn/bn_prime.c:476:10: Call 474. /* we need ((rnd-rem) % add) == 0 */ 475. 476. if (!BN_mod(t1, rnd, add, ctx)) ^ 477. goto err; 478. if (!BN_sub(rnd, rnd, t1)) crypto/bn/bn_div.c:209:1: Parameter `num->top` 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_prime.c:478:10: Call 476. if (!BN_mod(t1, rnd, add, ctx)) 477. goto err; 478. if (!BN_sub(rnd, rnd, t1)) ^ 479. goto err; 480. if (rem == NULL) { crypto/bn/bn_add.c:45:1: Parameter `r->top` 43. 44. /* signed sub of b from a. */ 45. > int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 46. { 47. int ret, r_neg, cmp_res; crypto/bn/bn_add.c:54:15: Call 52. if (a->neg != b->neg) { 53. r_neg = a->neg; 54. ret = BN_uadd(r, a, b); ^ 55. } else { 56. cmp_res = BN_ucmp(a, b); crypto/bn/bn_add.c:76:1: Parameter `r->top` 74. 75. /* unsigned add of b to a, r can be equal to a or b. */ 76. > int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 77. { 78. int max, min, dif; crypto/bn/bn_add.c:96:9: Call 94. dif = max - min; 95. 96. if (bn_wexpand(r, max + 1) == NULL) ^ 97. return 0; 98. crypto/bn/bn_lib.c:962:1: Parameter `a->top` 960. } 961. 962. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 963. { 964. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:964:37: Call 962. BIGNUM *bn_wexpand(BIGNUM *a, int words) 963. { 964. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 965. } 966. crypto/bn/bn_lib.c:245:1: Parameter `b->top` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `words` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:224:13: Call 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/mem.c:228:1: Parameter `num` 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:17: Call 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/mem.c:230:5: Assignment 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:235:5: Assignment 233. if (ret != NULL) 234. memset(ret, 0, num); 235. return ret; ^ 236. } 237. crypto/bn/bn_lib.c:224:9: Assignment 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_sub` 230. assert(b->top <= words); 231. if (b->top > 0) 232. memcpy(a, b->d, sizeof(*a) * b->top); ^ 233. 234. return a;
https://github.com/openssl/openssl/blob/bd01733fdd9a5a0acdc72cf5c6601d37e8ddd801/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_44314
static ossl_inline void packet_forward(PACKET *pkt, size_t len) { pkt->curr += len; pkt->remaining -= len; } test/packettest.c:144: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 247):unsigned64 by call to `PACKET_forward`. Showing all 14 steps of the trace test/packettest.c:139:10: Call 137. unsigned long i; 138. 139. if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN)) ^ 140. || !TEST_true(PACKET_get_sub_packet(&pkt, &subpkt, 4)) 141. || !TEST_true(PACKET_get_net_4(&subpkt, &i)) ssl/packet_locl.h:72:8: Parameter `pkt->remaining` 70. * is being used. 71. */ 72. __owur static ossl_inline int PACKET_buf_init(PACKET *pkt, ^ 73. const unsigned char *buf, 74. size_t len) test/packettest.c:140:17: Call 138. 139. if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN)) 140. || !TEST_true(PACKET_get_sub_packet(&pkt, &subpkt, 4)) ^ 141. || !TEST_true(PACKET_get_net_4(&subpkt, &i)) 142. || !TEST_ulong_eq(i, 0x02040608UL) ssl/packet_locl.h:124:8: Parameter `pkt->remaining` 122. * original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|. 123. */ 124. __owur static ossl_inline int PACKET_get_sub_packet(PACKET *pkt, ^ 125. PACKET *subpkt, size_t len) 126. { ssl/packet_locl.h:127:10: Call 125. PACKET *subpkt, size_t len) 126. { 127. if (!PACKET_peek_sub_packet(pkt, subpkt, len)) ^ 128. return 0; 129. ssl/packet_locl.h:110:8: Parameter `len` 108. * the original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|. 109. */ 110. __owur static ossl_inline int PACKET_peek_sub_packet(const PACKET *pkt, ^ 111. PACKET *subpkt, size_t len) 112. { test/packettest.c:144:17: Call 142. || !TEST_ulong_eq(i, 0x02040608UL) 143. || !TEST_size_t_eq(PACKET_remaining(&subpkt), 0) 144. || !TEST_true(PACKET_forward(&pkt, BUF_LEN - 8)) ^ 145. || !TEST_true(PACKET_get_sub_packet(&pkt, &subpkt, 4)) 146. || !TEST_true(PACKET_get_net_4(&subpkt, &i)) ssl/packet_locl.h:467:8: Parameter `len` 465. 466. /* Move the current reading position forward |len| bytes */ 467. __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len) ^ 468. { 469. if (PACKET_remaining(pkt) < len) ssl/packet_locl.h:472:5: Call 470. return 0; 471. 472. packet_forward(pkt, len); ^ 473. 474. return 1; ssl/packet_locl.h:33:1: <LHS trace> 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: Parameter `pkt->remaining` 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: <RHS trace> 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: Parameter `len` 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:36:5: Binary operation: ([0, +oo] - 247):unsigned64 by call to `PACKET_forward` 34. { 35. pkt->curr += len; 36. pkt->remaining -= len; ^ 37. } 38.
https://github.com/openssl/openssl/blob/424aa352458486d67e1e9cd3d3990dc06a60ba4a/ssl/packet_locl.h/#L36
d2a_code_trace_data_44315
int ssl3_get_cert_verify(SSL *s) { EVP_PKEY *pkey = NULL; unsigned char *sig, *data; int al, ok, ret = 0; long n; int type = 0, i, j; unsigned int len; X509 *peer; const EVP_MD *md = NULL; EVP_MD_CTX mctx; PACKET pkt; EVP_MD_CTX_init(&mctx); if (s->session->peer == NULL) { ret = 1; goto end; } n = s->method->ssl_get_message(s, SSL3_ST_SR_CERT_VRFY_A, SSL3_ST_SR_CERT_VRFY_B, SSL3_MT_CERTIFICATE_VERIFY, SSL3_RT_MAX_PLAIN_LENGTH, &ok); if (!ok) return ((int)n); peer = s->session->peer; pkey = X509_get_pubkey(peer); type = X509_certificate_type(peer, pkey); 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 (!PACKET_buf_init(&pkt, s->init_msg, n)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR); al = SSL_AD_INTERNAL_ERROR; goto f_err; } if (n == 64 && pkey->type == NID_id_GostR3410_2001) { len = 64; } else { if (SSL_USE_SIGALGS(s)) { int rv; if (!PACKET_get_bytes(&pkt, &sig, 2)) { al = SSL_AD_DECODE_ERROR; goto f_err; } rv = tls12_check_peer_sigalg(&md, s, sig, pkey); if (rv == -1) { al = SSL_AD_INTERNAL_ERROR; goto f_err; } else if (rv == 0) { al = SSL_AD_DECODE_ERROR; goto f_err; } #ifdef SSL_DEBUG fprintf(stderr, "USING TLSv1.2 HASH %s\n", EVP_MD_name(md)); #endif } if (!PACKET_get_net_2(&pkt, &len)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_LENGTH_MISMATCH); al = SSL_AD_DECODE_ERROR; goto f_err; } } j = EVP_PKEY_size(pkey); if (((int)len > j) || ((int)PACKET_remaining(&pkt) > j) || (n <= 0)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_WRONG_SIGNATURE_SIZE); al = SSL_AD_DECODE_ERROR; goto f_err; } if (!PACKET_get_bytes(&pkt, &data, len)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_LENGTH_MISMATCH); 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, data, len, 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, data, len, 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, data, len, 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_EC if (pkey->type == EVP_PKEY_EC) { j = ECDSA_verify(pkey->save_type, &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]), SHA_DIGEST_LENGTH, data, len, pkey->pkey.ec); if (j <= 0) { al = SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE); goto f_err; } } else #endif if (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 (len != 64) { fprintf(stderr, "GOST signature length is %d", len); } for (idx = 0; idx < 64; idx++) { signature[63 - idx] = data[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); s->state = SSL_ST_ERR; } end: BIO_free(s->s3->handshake_buffer); s->s3->handshake_buffer = NULL; EVP_MD_CTX_cleanup(&mctx); EVP_PKEY_free(pkey); return (ret); } ssl/s3_srvr.c:2921: error: NULL_DEREFERENCE pointer `pkey` last assigned on line 2900 could be null and is dereferenced at line 2921, column 20. Showing all 34 steps of the trace ssl/s3_srvr.c:2863:1: start of procedure ssl3_get_cert_verify() 2861. } 2862. 2863. > int ssl3_get_cert_verify(SSL *s) 2864. { 2865. EVP_PKEY *pkey = NULL; ssl/s3_srvr.c:2865:5: 2863. int ssl3_get_cert_verify(SSL *s) 2864. { 2865. > EVP_PKEY *pkey = NULL; 2866. unsigned char *sig, *data; 2867. int al, ok, ret = 0; ssl/s3_srvr.c:2867:5: 2865. EVP_PKEY *pkey = NULL; 2866. unsigned char *sig, *data; 2867. > int al, ok, ret = 0; 2868. long n; 2869. int type = 0, i, j; ssl/s3_srvr.c:2869:5: 2867. int al, ok, ret = 0; 2868. long n; 2869. > int type = 0, i, j; 2870. unsigned int len; 2871. X509 *peer; ssl/s3_srvr.c:2872:5: 2870. unsigned int len; 2871. X509 *peer; 2872. > const EVP_MD *md = NULL; 2873. EVP_MD_CTX mctx; 2874. PACKET pkt; ssl/s3_srvr.c:2875:5: 2873. EVP_MD_CTX mctx; 2874. PACKET pkt; 2875. > EVP_MD_CTX_init(&mctx); 2876. 2877. /* crypto/evp/digest.c:120:1: start of procedure EVP_MD_CTX_init() 118. #endif 119. 120. > void EVP_MD_CTX_init(EVP_MD_CTX *ctx) 121. { 122. memset(ctx, 0, sizeof(*ctx)); crypto/evp/digest.c:122:5: 120. void EVP_MD_CTX_init(EVP_MD_CTX *ctx) 121. { 122. > memset(ctx, 0, sizeof(*ctx)); 123. } 124. crypto/evp/digest.c:123:1: return from a call to EVP_MD_CTX_init 121. { 122. memset(ctx, 0, sizeof(*ctx)); 123. > } 124. 125. EVP_MD_CTX *EVP_MD_CTX_create(void) ssl/s3_srvr.c:2885:9: Taking false branch 2883. * CertificateVerify state so we should not arrive here. 2884. */ 2885. if (s->session->peer == NULL) { ^ 2886. ret = 1; 2887. goto end; ssl/s3_srvr.c:2890:5: Skipping __function_pointer__(): unresolved function pointer 2888. } 2889. 2890. n = s->method->ssl_get_message(s, ^ 2891. SSL3_ST_SR_CERT_VRFY_A, 2892. SSL3_ST_SR_CERT_VRFY_B, ssl/s3_srvr.c:2896:10: Taking false branch 2894. SSL3_RT_MAX_PLAIN_LENGTH, &ok); 2895. 2896. if (!ok) ^ 2897. return ((int)n); 2898. ssl/s3_srvr.c:2899:5: 2897. return ((int)n); 2898. 2899. > peer = s->session->peer; 2900. pkey = X509_get_pubkey(peer); 2901. type = X509_certificate_type(peer, pkey); ssl/s3_srvr.c:2900:5: 2898. 2899. peer = s->session->peer; 2900. > pkey = X509_get_pubkey(peer); 2901. type = X509_certificate_type(peer, pkey); 2902. crypto/x509/x509_cmp.c:307:1: start of procedure X509_get_pubkey() 305. } 306. 307. > EVP_PKEY *X509_get_pubkey(X509 *x) 308. { 309. if ((x == NULL) || (x->cert_info == NULL)) crypto/x509/x509_cmp.c:309:10: Taking false branch 307. EVP_PKEY *X509_get_pubkey(X509 *x) 308. { 309. if ((x == NULL) || (x->cert_info == NULL)) ^ 310. return (NULL); 311. return (X509_PUBKEY_get(x->cert_info->key)); crypto/x509/x509_cmp.c:309:25: Taking true branch 307. EVP_PKEY *X509_get_pubkey(X509 *x) 308. { 309. if ((x == NULL) || (x->cert_info == NULL)) ^ 310. return (NULL); 311. return (X509_PUBKEY_get(x->cert_info->key)); crypto/x509/x509_cmp.c:310:9: 308. { 309. if ((x == NULL) || (x->cert_info == NULL)) 310. > return (NULL); 311. return (X509_PUBKEY_get(x->cert_info->key)); 312. } crypto/x509/x509_cmp.c:312:1: return from a call to X509_get_pubkey 310. return (NULL); 311. return (X509_PUBKEY_get(x->cert_info->key)); 312. > } 313. 314. ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x) ssl/s3_srvr.c:2901:5: Skipping X509_certificate_type(): empty list of specs 2899. peer = s->session->peer; 2900. pkey = X509_get_pubkey(peer); 2901. type = X509_certificate_type(peer, pkey); ^ 2902. 2903. if (!(type & EVP_PKT_SIGN)) { ssl/s3_srvr.c:2903:11: Taking false branch 2901. type = X509_certificate_type(peer, pkey); 2902. 2903. if (!(type & EVP_PKT_SIGN)) { ^ 2904. SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, 2905. SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE); ssl/s3_srvr.c:2911:10: 2909. 2910. /* we now have a signature that we need to verify */ 2911. > if (!PACKET_buf_init(&pkt, s->init_msg, n)) { 2912. SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR); 2913. al = SSL_AD_INTERNAL_ERROR; ssl/packet_locl.h:106:1: start of procedure PACKET_buf_init() 104. * is being used. 105. */ 106. > static inline int PACKET_buf_init(PACKET *pkt, unsigned char *buf, size_t len) 107. { 108. pkt->start = pkt->curr = buf; ssl/packet_locl.h:108:5: 106. static inline int PACKET_buf_init(PACKET *pkt, unsigned char *buf, size_t len) 107. { 108. > pkt->start = pkt->curr = buf; 109. pkt->end = pkt->start + len; 110. ssl/packet_locl.h:109:5: 107. { 108. pkt->start = pkt->curr = buf; 109. > pkt->end = pkt->start + len; 110. 111. /* Sanity checks */ ssl/packet_locl.h:112:9: Taking false branch 110. 111. /* Sanity checks */ 112. if (pkt->start > pkt->end ^ 113. || pkt->curr < pkt->start 114. || pkt->curr > pkt->end ssl/packet_locl.h:113:16: Taking false branch 111. /* Sanity checks */ 112. if (pkt->start > pkt->end 113. || pkt->curr < pkt->start ^ 114. || pkt->curr > pkt->end 115. || len != (size_t)(pkt->end - pkt->start)) { ssl/packet_locl.h:114:16: Taking false branch 112. if (pkt->start > pkt->end 113. || pkt->curr < pkt->start 114. || pkt->curr > pkt->end ^ 115. || len != (size_t)(pkt->end - pkt->start)) { 116. return 0; ssl/packet_locl.h:115:16: Taking false branch 113. || pkt->curr < pkt->start 114. || pkt->curr > pkt->end 115. || len != (size_t)(pkt->end - pkt->start)) { ^ 116. return 0; 117. } ssl/packet_locl.h:119:5: 117. } 118. 119. > return 1; 120. } 121. ssl/packet_locl.h:120:1: return from a call to PACKET_buf_init 118. 119. return 1; 120. > } 121. 122. /* ssl/s3_srvr.c:2911:10: Taking false branch 2909. 2910. /* we now have a signature that we need to verify */ 2911. if (!PACKET_buf_init(&pkt, s->init_msg, n)) { ^ 2912. SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR); 2913. al = SSL_AD_INTERNAL_ERROR; ssl/s3_srvr.c:2921:9: Taking true branch 2919. * length field 2920. */ 2921. if (n == 64 && pkey->type == NID_id_GostR3410_2001) { ^ 2922. len = 64; 2923. } else { ssl/s3_srvr.c:2921:20: 2919. * length field 2920. */ 2921. > if (n == 64 && pkey->type == NID_id_GostR3410_2001) { 2922. len = 64; 2923. } else {
https://github.com/openssl/openssl/blob/2dcac136a8c4e37646b717b68eeccc191d074bf0/ssl/s3_srvr.c/#L2921
d2a_code_trace_data_44316
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) { bn_check_top(b); if (a == b) return a; if (bn_wexpand(a, b->top) == NULL) return NULL; if (b->top > 0) memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); a->top = b->top; a->neg = b->neg; bn_check_top(a); return a; } crypto/rsa/rsa_chk.c:184: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_mod_inverse`. Showing all 27 steps of the trace crypto/rsa/rsa_chk.c:19:1: Parameter `key->q->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:71:9: Call 69. 70. /* q prime? */ 71. if (BN_is_prime_ex(key->q, BN_prime_checks, NULL, cb) != 1) { ^ 72. ret = 0; 73. RSAerr(RSA_F_RSA_CHECK_KEY_EX, RSA_R_Q_NOT_PRIME); crypto/bn/bn_prime.c:145:1: Parameter `a->top` 143. } 144. 145. > int BN_is_prime_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 146. BN_GENCB *cb) 147. { crypto/bn/bn_prime.c:148:12: Call 146. BN_GENCB *cb) 147. { 148. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb); ^ 149. } 150. crypto/bn/bn_prime.c:151:1: Parameter `a->top` 149. } 150. 151. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 152. int do_trial_division, BN_GENCB *cb) 153. { crypto/bn/bn_prime.c:161:9: Call 159. 160. /* Take care of the really small primes 2 & 3 */ 161. if (BN_is_word(a, 2) || BN_is_word(a, 3)) ^ 162. return 1; 163. crypto/bn/bn_lib.c:855:1: Parameter `a->top` 853. } 854. 855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); crypto/bn/bn_lib.c:857:12: Call 855. int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); ^ 858. } 859. crypto/bn/bn_lib.c:840:1: Parameter `a->top` 838. } 839. 840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w) 841. { 842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0)); crypto/rsa/rsa_chk.c:111:10: Call 109. goto err; 110. } 111. if (!BN_sub(j, key->q, BN_value_one())) { ^ 112. ret = -1; 113. goto err; crypto/bn/bn_add.c:45:1: Parameter `a->top` 43. 44. /* signed sub of b from a. */ 45. > int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 46. { 47. int ret, r_neg, cmp_res; crypto/rsa/rsa_chk.c:170:14: Call 168. 169. /* dmq1 = d mod (q-1)? */ 170. if (!BN_sub(i, key->q, BN_value_one())) { ^ 171. ret = -1; 172. goto err; crypto/bn/bn_add.c:45:1: Parameter `a->top` 43. 44. /* signed sub of b from a. */ 45. > int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 46. { 47. int ret, r_neg, cmp_res; crypto/rsa/rsa_chk.c:184:14: Call 182. 183. /* iqmp = q^-1 mod p? */ 184. if (!BN_mod_inverse(i, key->q, key->p, ctx)) { ^ 185. ret = -1; 186. goto err; crypto/bn/bn_gcd.c:124:1: Parameter `a->top` 122. BN_CTX *ctx); 123. 124. > BIGNUM *BN_mod_inverse(BIGNUM *in, 125. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 126. { crypto/bn/bn_gcd.c:129:10: Call 127. BIGNUM *rv; 128. int noinv; 129. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv); ^ 130. if (noinv) 131. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); crypto/bn/bn_gcd.c:135:1: Parameter `a->top` 133. } 134. 135. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 136. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 137. int *pnoinv) crypto/bn/bn_gcd.c:155:16: Call 153. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) 154. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) { 155. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 156. } 157. crypto/bn/bn_gcd.c:458:1: Parameter `a->top` 456. * not contain branches that may leak sensitive information. 457. */ 458. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 459. const BIGNUM *a, const BIGNUM *n, 460. BN_CTX *ctx) crypto/bn/bn_gcd.c:489:9: Call 487. BN_one(X); 488. BN_zero(Y); 489. if (BN_copy(B, a) == NULL) ^ 490. goto err; 491. if (BN_copy(A, n) == NULL) crypto/bn/bn_lib.c:285:1: <Offset trace> 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_lib.c:285:1: Parameter `b->top` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_lib.c:285:1: <Length trace> 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_lib.c:285:1: Parameter `*a->d` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_lib.c:291:9: Call 289. if (a == b) 290. return a; 291. if (bn_wexpand(a, b->top) == NULL) ^ 292. return NULL; 293. crypto/bn/bn_lib.c:941:1: Parameter `*a->d` 939. } 940. 941. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 942. { 943. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:295:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_mod_inverse` 293. 294. if (b->top > 0) 295. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); ^ 296. 297. a->top = b->top;
https://github.com/openssl/openssl/blob/b48d4397b8ee4256f0b0a115eb99f27ae89995e0/crypto/bn/bn_lib.c/#L295
d2a_code_trace_data_44317
void ff_block_permute(DCTELEM *block, uint8_t *permutation, const uint8_t *scantable, int last) { int i; DCTELEM temp[64]; if(last<=0) return; for(i=0; i<=last; i++){ const int j= scantable[i]; temp[j]= block[j]; block[j]=0; } for(i=0; i<=last; i++){ const int j= scantable[i]; const int perm_j= permutation[j]; block[perm_j]= temp[j]; } } libavcodec/dsputil.c:3330: error: Uninitialized Value The value read from temp[_] was never initialized. libavcodec/dsputil.c:3330:9: 3328. const int j= scantable[i]; 3329. const int perm_j= permutation[j]; 3330. block[perm_j]= temp[j]; ^ 3331. } 3332. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dsputil.c/#L3330
d2a_code_trace_data_44318
static inline int l2_unscale_group(int steps, int mant, int scale_factor) { int shift, mod, val; shift = scale_factor_modshift[scale_factor]; mod = shift & 3; shift >>= 2; val = (mant - (steps >> 1)) * scale_factor_mult2[steps >> 2][mod]; if (shift > 0) val = (val + (1 << (shift - 1))) >> shift; return val; } libavcodec/mpegaudiodec.c:1313: error: Buffer Overrun L2 Offset: [0, 3] Size: 3 by call to `l2_unscale_group`. libavcodec/mpegaudiodec.c:1313:33: Call 1311. steps = ff_mpa_quant_steps[qindex]; 1312. s->sb_samples[ch][k * 12 + l + 0][i] = 1313. l2_unscale_group(steps, v % steps, scale); ^ 1314. v = v / steps; 1315. s->sb_samples[ch][k * 12 + l + 1][i] = libavcodec/mpegaudiodec.c:207:1: <Offset trace> 205. } 206. 207. static inline int l2_unscale_group(int steps, int mant, int scale_factor) ^ 208. { 209. int shift, mod, val; libavcodec/mpegaudiodec.c:207:1: Global `scale_factor_modshift` 205. } 206. 207. static inline int l2_unscale_group(int steps, int mant, int scale_factor) ^ 208. { 209. int shift, mod, val; libavcodec/mpegaudiodec.c:211:5: Assignment 209. int shift, mod, val; 210. 211. shift = scale_factor_modshift[scale_factor]; ^ 212. mod = shift & 3; 213. shift >>= 2; libavcodec/mpegaudiodec.c:212:5: Assignment 210. 211. shift = scale_factor_modshift[scale_factor]; 212. mod = shift & 3; ^ 213. shift >>= 2; 214. libavcodec/mpegaudiodec.c:121:1: <Length trace> 119. { FIXR(1.0 * (v)), FIXR(0.7937005259 * (v)), FIXR(0.6299605249 * (v)) } 120. 121. static const int32_t scale_factor_mult2[3][3] = { ^ 122. SCALE_GEN(4.0 / 3.0), /* 3 steps */ 123. SCALE_GEN(4.0 / 5.0), /* 5 steps */ libavcodec/mpegaudiodec.c:121:1: Array declaration 119. { FIXR(1.0 * (v)), FIXR(0.7937005259 * (v)), FIXR(0.6299605249 * (v)) } 120. 121. static const int32_t scale_factor_mult2[3][3] = { ^ 122. SCALE_GEN(4.0 / 3.0), /* 3 steps */ 123. SCALE_GEN(4.0 / 5.0), /* 5 steps */ libavcodec/mpegaudiodec.c:215:35: Array access: Offset: [0, 3] Size: 3 by call to `l2_unscale_group` 213. shift >>= 2; 214. 215. val = (mant - (steps >> 1)) * scale_factor_mult2[steps >> 2][mod]; ^ 216. /* NOTE: at this point, 0 <= shift <= 21 */ 217. if (shift > 0)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L215
d2a_code_trace_data_44319
static void STORE_ATTR_INFO_attr_free(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code) { if (ATTR_IS_SET(attrs,code)) { switch(code) { case STORE_ATTR_FRIENDLYNAME: case STORE_ATTR_EMAIL: case STORE_ATTR_FILENAME: STORE_ATTR_INFO_modify_cstr(attrs, code, NULL, 0); break; case STORE_ATTR_KEYID: case STORE_ATTR_ISSUERKEYID: case STORE_ATTR_SUBJECTKEYID: case STORE_ATTR_ISSUERSERIALHASH: case STORE_ATTR_CERTHASH: STORE_ATTR_INFO_modify_sha1str(attrs, code, NULL, 0); break; case STORE_ATTR_ISSUER: case STORE_ATTR_SUBJECT: STORE_ATTR_INFO_modify_dn(attrs, code, NULL); break; case STORE_ATTR_SERIAL: STORE_ATTR_INFO_modify_number(attrs, code, NULL); break; default: break; } } } crypto/store/str_lib.c:1302: error: NULL_DEREFERENCE pointer `null` is dereferenced by call to `STORE_ATTR_INFO_modify_sha1str()` at line 1302, column 4. Showing all 82 steps of the trace crypto/store/str_lib.c:1285:1: start of procedure STORE_ATTR_INFO_attr_free() 1283. return (STORE_ATTR_INFO *)OPENSSL_malloc(sizeof(STORE_ATTR_INFO)); 1284. } 1285. > static void STORE_ATTR_INFO_attr_free(STORE_ATTR_INFO *attrs, 1286. STORE_ATTR_TYPES code) 1287. { crypto/store/str_lib.c:1288:6: Taking true branch 1286. STORE_ATTR_TYPES code) 1287. { 1288. if (ATTR_IS_SET(attrs,code)) ^ 1289. { 1290. switch(code) crypto/store/str_lib.c:1288:6: Taking true branch 1286. STORE_ATTR_TYPES code) 1287. { 1288. if (ATTR_IS_SET(attrs,code)) ^ 1289. { 1290. switch(code) crypto/store/str_lib.c:1288:6: Taking true branch 1286. STORE_ATTR_TYPES code) 1287. { 1288. if (ATTR_IS_SET(attrs,code)) ^ 1289. { 1290. switch(code) crypto/store/str_lib.c:1290:3: 1288. if (ATTR_IS_SET(attrs,code)) 1289. { 1290. > switch(code) 1291. { 1292. case STORE_ATTR_FRIENDLYNAME: crypto/store/str_lib.c:1292:3: Switch condition is false. Skipping switch case 1290. switch(code) 1291. { 1292. case STORE_ATTR_FRIENDLYNAME: ^ 1293. case STORE_ATTR_EMAIL: 1294. case STORE_ATTR_FILENAME: crypto/store/str_lib.c:1293:3: Switch condition is false. Skipping switch case 1291. { 1292. case STORE_ATTR_FRIENDLYNAME: 1293. case STORE_ATTR_EMAIL: ^ 1294. case STORE_ATTR_FILENAME: 1295. STORE_ATTR_INFO_modify_cstr(attrs, code, NULL, 0); crypto/store/str_lib.c:1294:3: Switch condition is false. Skipping switch case 1292. case STORE_ATTR_FRIENDLYNAME: 1293. case STORE_ATTR_EMAIL: 1294. case STORE_ATTR_FILENAME: ^ 1295. STORE_ATTR_INFO_modify_cstr(attrs, code, NULL, 0); 1296. break; crypto/store/str_lib.c:1297:3: Switch condition is true. Entering switch case 1295. STORE_ATTR_INFO_modify_cstr(attrs, code, NULL, 0); 1296. break; 1297. case STORE_ATTR_KEYID: ^ 1298. case STORE_ATTR_ISSUERKEYID: 1299. case STORE_ATTR_SUBJECTKEYID: crypto/store/str_lib.c:1302:4: 1300. case STORE_ATTR_ISSUERSERIALHASH: 1301. case STORE_ATTR_CERTHASH: 1302. > STORE_ATTR_INFO_modify_sha1str(attrs, code, NULL, 0); 1303. break; 1304. case STORE_ATTR_ISSUER: crypto/store/str_lib.c:1483:1: start of procedure STORE_ATTR_INFO_modify_sha1str() 1481. return STORE_ATTR_INFO_set_cstr(attrs, code, cstr, cstr_size); 1482. } 1483. > int STORE_ATTR_INFO_modify_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, 1484. unsigned char *sha1str, size_t sha1str_size) 1485. { crypto/store/str_lib.c:1486:7: Taking false branch 1484. unsigned char *sha1str, size_t sha1str_size) 1485. { 1486. if (!attrs) ^ 1487. { 1488. STOREerr(STORE_F_STORE_ATTR_INFO_MODIFY_SHA1STR, crypto/store/str_lib.c:1492:6: Taking true branch 1490. return 0; 1491. } 1492. if (ATTR_IS_SET(attrs,code)) ^ 1493. { 1494. OPENSSL_free(attrs->values[code].sha1string); crypto/store/str_lib.c:1492:6: Taking false branch 1490. return 0; 1491. } 1492. if (ATTR_IS_SET(attrs,code)) ^ 1493. { 1494. OPENSSL_free(attrs->values[code].sha1string); crypto/store/str_lib.c:1498:2: 1496. CLEAR_ATTRBIT(attrs, code); 1497. } 1498. > return STORE_ATTR_INFO_set_sha1str(attrs, code, sha1str, sha1str_size); 1499. } 1500. int STORE_ATTR_INFO_modify_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, crypto/store/str_lib.c:1404:1: start of procedure STORE_ATTR_INFO_set_sha1str() 1402. return 0; 1403. } 1404. > int STORE_ATTR_INFO_set_sha1str(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, 1405. unsigned char *sha1str, size_t sha1str_size) 1406. { crypto/store/str_lib.c:1407:7: Taking false branch 1405. unsigned char *sha1str, size_t sha1str_size) 1406. { 1407. if (!attrs) ^ 1408. { 1409. STOREerr(STORE_F_STORE_ATTR_INFO_SET_SHA1STR, crypto/store/str_lib.c:1413:7: Taking false branch 1411. return 0; 1412. } 1413. if (!ATTR_IS_SET(attrs,code)) ^ 1414. { 1415. if ((attrs->values[code].sha1string = crypto/store/str_lib.c:1413:7: Taking true branch 1411. return 0; 1412. } 1413. if (!ATTR_IS_SET(attrs,code)) ^ 1414. { 1415. if ((attrs->values[code].sha1string = crypto/store/str_lib.c:1415:8: 1413. if (!ATTR_IS_SET(attrs,code)) 1414. { 1415. > if ((attrs->values[code].sha1string = 1416. (unsigned char *)BUF_memdup(sha1str, 1417. sha1str_size))) crypto/buffer/buffer.c:187:1: start of procedure BUF_memdup() 185. } 186. 187. > void *BUF_memdup(const void *data, size_t siz) 188. { 189. void *ret; crypto/buffer/buffer.c:191:6: Taking false branch 189. void *ret; 190. 191. if (data == NULL) return(NULL); ^ 192. 193. ret=OPENSSL_malloc(siz); crypto/buffer/buffer.c:193:2: 191. if (data == NULL) return(NULL); 192. 193. > ret=OPENSSL_malloc(siz); 194. if (ret == NULL) 195. { 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 false branch 297. 298. allow_customize = 0; 299. if (malloc_debug_func != NULL) ^ 300. { 301. allow_customize_debug = 0; 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 false 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: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) crypto/buffer/buffer.c:194:6: Taking true branch 192. 193. ret=OPENSSL_malloc(siz); 194. if (ret == NULL) ^ 195. { 196. BUFerr(BUF_F_BUF_MEMDUP,ERR_R_MALLOC_FAILURE); crypto/buffer/buffer.c:196:3: 194. if (ret == NULL) 195. { 196. > BUFerr(BUF_F_BUF_MEMDUP,ERR_R_MALLOC_FAILURE); 197. return(NULL); 198. } crypto/err/err.c:666:1: start of procedure ERR_put_error() 664. /********************************************************/ 665. 666. > void ERR_put_error(int lib, int func, int reason, const char *file, 667. int line) 668. { crypto/err/err.c:690:2: Skipping ERR_get_state(): empty list of specs 688. } 689. #endif 690. es=ERR_get_state(); ^ 691. 692. es->top=(es->top+1)%ERR_NUM_ERRORS; crypto/err/err.c:692:2: 690. es=ERR_get_state(); 691. 692. > es->top=(es->top+1)%ERR_NUM_ERRORS; 693. if (es->top == es->bottom) 694. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS; crypto/err/err.c:693:6: Taking false branch 691. 692. es->top=(es->top+1)%ERR_NUM_ERRORS; 693. if (es->top == es->bottom) ^ 694. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS; 695. es->err_flags[es->top]=0; crypto/err/err.c:695:2: 693. if (es->top == es->bottom) 694. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS; 695. > es->err_flags[es->top]=0; 696. es->err_buffer[es->top]=ERR_PACK(lib,func,reason); 697. es->err_file[es->top]=file; crypto/err/err.c:696:2: 694. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS; 695. es->err_flags[es->top]=0; 696. > es->err_buffer[es->top]=ERR_PACK(lib,func,reason); 697. es->err_file[es->top]=file; 698. es->err_line[es->top]=line; crypto/err/err.c:697:2: 695. es->err_flags[es->top]=0; 696. es->err_buffer[es->top]=ERR_PACK(lib,func,reason); 697. > es->err_file[es->top]=file; 698. es->err_line[es->top]=line; 699. err_clear_data(es,es->top); crypto/err/err.c:698:2: 696. es->err_buffer[es->top]=ERR_PACK(lib,func,reason); 697. es->err_file[es->top]=file; 698. > es->err_line[es->top]=line; 699. err_clear_data(es,es->top); 700. } crypto/err/err.c:699:2: Taking true branch 697. es->err_file[es->top]=file; 698. es->err_line[es->top]=line; 699. err_clear_data(es,es->top); ^ 700. } 701. crypto/err/err.c:699:2: Taking true branch 697. es->err_file[es->top]=file; 698. es->err_line[es->top]=line; 699. err_clear_data(es,es->top); ^ 700. } 701. crypto/mem.c:371:1: start of procedure CRYPTO_free() 369. } 370. 371. > void CRYPTO_free(void *str) 372. { 373. if (free_debug_func != NULL) crypto/mem.c:373:6: Taking true branch 371. void CRYPTO_free(void *str) 372. { 373. if (free_debug_func != NULL) ^ 374. free_debug_func(str, 0); 375. #ifdef LEVITTE_DEBUG_MEM crypto/mem.c:374:3: Skipping __function_pointer__(): unresolved function pointer 372. { 373. if (free_debug_func != NULL) 374. free_debug_func(str, 0); ^ 375. #ifdef LEVITTE_DEBUG_MEM 376. fprintf(stderr, "LEVITTE_DEBUG_MEM: < 0x%p\n", str); crypto/mem.c:378:2: Skipping __function_pointer__(): unresolved function pointer 376. fprintf(stderr, "LEVITTE_DEBUG_MEM: < 0x%p\n", str); 377. #endif 378. free_func(str); ^ 379. if (free_debug_func != NULL) 380. free_debug_func(NULL, 1); crypto/mem.c:379:6: Taking true branch 377. #endif 378. free_func(str); 379. if (free_debug_func != NULL) ^ 380. free_debug_func(NULL, 1); 381. } crypto/mem.c:380:3: Skipping __function_pointer__(): unresolved function pointer 378. free_func(str); 379. if (free_debug_func != NULL) 380. free_debug_func(NULL, 1); ^ 381. } 382. crypto/mem.c:379:2: 377. #endif 378. free_func(str); 379. > if (free_debug_func != NULL) 380. free_debug_func(NULL, 1); 381. } crypto/mem.c:381:2: return from a call to CRYPTO_free 379. if (free_debug_func != NULL) 380. free_debug_func(NULL, 1); 381. } ^ 382. 383. void *CRYPTO_remalloc(void *a, int num, const char *file, int line) crypto/err/err.c:699:2: Loop condition is false. Leaving loop 697. es->err_file[es->top]=file; 698. es->err_line[es->top]=line; 699. err_clear_data(es,es->top); ^ 700. } 701. crypto/err/err.c:700:2: return from a call to ERR_put_error 698. es->err_line[es->top]=line; 699. err_clear_data(es,es->top); 700. } ^ 701. 702. void ERR_clear_error(void) crypto/buffer/buffer.c:197:3: 195. { 196. BUFerr(BUF_F_BUF_MEMDUP,ERR_R_MALLOC_FAILURE); 197. > return(NULL); 198. } 199. return memcpy(ret, data, siz); crypto/buffer/buffer.c:200:2: return from a call to BUF_memdup 198. } 199. return memcpy(ret, data, siz); 200. } ^ 201. 202. size_t BUF_strlcpy(char *dst, const char *src, size_t size) crypto/store/str_lib.c:1415:8: Taking false branch 1413. if (!ATTR_IS_SET(attrs,code)) 1414. { 1415. if ((attrs->values[code].sha1string = ^ 1416. (unsigned char *)BUF_memdup(sha1str, 1417. sha1str_size))) crypto/store/str_lib.c:1419:3: 1417. sha1str_size))) 1418. return 1; 1419. > STOREerr(STORE_F_STORE_ATTR_INFO_SET_SHA1STR, 1420. ERR_R_MALLOC_FAILURE); 1421. return 0; crypto/err/err.c:666:1: start of procedure ERR_put_error() 664. /********************************************************/ 665. 666. > void ERR_put_error(int lib, int func, int reason, const char *file, 667. int line) 668. { crypto/err/err.c:690:2: Skipping ERR_get_state(): empty list of specs 688. } 689. #endif 690. es=ERR_get_state(); ^ 691. 692. es->top=(es->top+1)%ERR_NUM_ERRORS; crypto/err/err.c:692:2: 690. es=ERR_get_state(); 691. 692. > es->top=(es->top+1)%ERR_NUM_ERRORS; 693. if (es->top == es->bottom) 694. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS; crypto/err/err.c:693:6: Taking false branch 691. 692. es->top=(es->top+1)%ERR_NUM_ERRORS; 693. if (es->top == es->bottom) ^ 694. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS; 695. es->err_flags[es->top]=0; crypto/err/err.c:695:2: 693. if (es->top == es->bottom) 694. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS; 695. > es->err_flags[es->top]=0; 696. es->err_buffer[es->top]=ERR_PACK(lib,func,reason); 697. es->err_file[es->top]=file; crypto/err/err.c:696:2: 694. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS; 695. es->err_flags[es->top]=0; 696. > es->err_buffer[es->top]=ERR_PACK(lib,func,reason); 697. es->err_file[es->top]=file; 698. es->err_line[es->top]=line; crypto/err/err.c:697:2: 695. es->err_flags[es->top]=0; 696. es->err_buffer[es->top]=ERR_PACK(lib,func,reason); 697. > es->err_file[es->top]=file; 698. es->err_line[es->top]=line; 699. err_clear_data(es,es->top); crypto/err/err.c:698:2: 696. es->err_buffer[es->top]=ERR_PACK(lib,func,reason); 697. es->err_file[es->top]=file; 698. > es->err_line[es->top]=line; 699. err_clear_data(es,es->top); 700. } crypto/err/err.c:699:2: Taking true branch 697. es->err_file[es->top]=file; 698. es->err_line[es->top]=line; 699. err_clear_data(es,es->top); ^ 700. } 701. crypto/err/err.c:699:2: Taking true branch 697. es->err_file[es->top]=file; 698. es->err_line[es->top]=line; 699. err_clear_data(es,es->top); ^ 700. } 701. crypto/mem.c:371:1: start of procedure CRYPTO_free() 369. } 370. 371. > void CRYPTO_free(void *str) 372. { 373. if (free_debug_func != NULL) crypto/mem.c:373:6: Taking true branch 371. void CRYPTO_free(void *str) 372. { 373. if (free_debug_func != NULL) ^ 374. free_debug_func(str, 0); 375. #ifdef LEVITTE_DEBUG_MEM crypto/mem.c:374:3: Skipping __function_pointer__(): unresolved function pointer 372. { 373. if (free_debug_func != NULL) 374. free_debug_func(str, 0); ^ 375. #ifdef LEVITTE_DEBUG_MEM 376. fprintf(stderr, "LEVITTE_DEBUG_MEM: < 0x%p\n", str); crypto/mem.c:378:2: Skipping __function_pointer__(): unresolved function pointer 376. fprintf(stderr, "LEVITTE_DEBUG_MEM: < 0x%p\n", str); 377. #endif 378. free_func(str); ^ 379. if (free_debug_func != NULL) 380. free_debug_func(NULL, 1); crypto/mem.c:379:6: Taking true branch 377. #endif 378. free_func(str); 379. if (free_debug_func != NULL) ^ 380. free_debug_func(NULL, 1); 381. } crypto/mem.c:380:3: Skipping __function_pointer__(): unresolved function pointer 378. free_func(str); 379. if (free_debug_func != NULL) 380. free_debug_func(NULL, 1); ^ 381. } 382. crypto/mem.c:379:2: 377. #endif 378. free_func(str); 379. > if (free_debug_func != NULL) 380. free_debug_func(NULL, 1); 381. } crypto/mem.c:381:2: return from a call to CRYPTO_free 379. if (free_debug_func != NULL) 380. free_debug_func(NULL, 1); 381. } ^ 382. 383. void *CRYPTO_remalloc(void *a, int num, const char *file, int line) crypto/err/err.c:699:2: Loop condition is false. Leaving loop 697. es->err_file[es->top]=file; 698. es->err_line[es->top]=line; 699. err_clear_data(es,es->top); ^ 700. } 701. crypto/err/err.c:700:2: return from a call to ERR_put_error 698. es->err_line[es->top]=line; 699. err_clear_data(es,es->top); 700. } ^ 701. 702. void ERR_clear_error(void) crypto/store/str_lib.c:1421:3: 1419. STOREerr(STORE_F_STORE_ATTR_INFO_SET_SHA1STR, 1420. ERR_R_MALLOC_FAILURE); 1421. > return 0; 1422. } 1423. STOREerr(STORE_F_STORE_ATTR_INFO_SET_SHA1STR, STORE_R_ALREADY_HAS_A_VALUE); crypto/store/str_lib.c:1425:2: return from a call to STORE_ATTR_INFO_set_sha1str 1423. STOREerr(STORE_F_STORE_ATTR_INFO_SET_SHA1STR, STORE_R_ALREADY_HAS_A_VALUE); 1424. return 0; 1425. } ^ 1426. int STORE_ATTR_INFO_set_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, 1427. X509_NAME *dn) crypto/store/str_lib.c:1499:2: return from a call to STORE_ATTR_INFO_modify_sha1str 1497. } 1498. return STORE_ATTR_INFO_set_sha1str(attrs, code, sha1str, sha1str_size); 1499. } ^ 1500. int STORE_ATTR_INFO_modify_dn(STORE_ATTR_INFO *attrs, STORE_ATTR_TYPES code, 1501. X509_NAME *dn)
https://github.com/openssl/openssl/blob/0e3b6b70df7c2e02ec32818ceaec99b3ac8a85cc/crypto/store/str_lib.c/#L1302
d2a_code_trace_data_44320
static size_t kat_nonce(DRBG_CTX *dctx, unsigned char **pout, int entropy, size_t min_len, size_t max_len) { TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(dctx, app_data_index); t->noncecnt++; *pout = (unsigned char *)t->nonce; return t->noncelen; } test/drbgtest.c:132: error: NULL_DEREFERENCE pointer `t` last assigned on line 130 could be null and is dereferenced at line 132, column 5. Showing all 10 steps of the trace test/drbgtest.c:127:1: start of procedure kat_nonce() 125. } 126. 127. > static size_t kat_nonce(DRBG_CTX *dctx, unsigned char **pout, 128. int entropy, size_t min_len, size_t max_len) 129. { test/drbgtest.c:130:5: 128. int entropy, size_t min_len, size_t max_len) 129. { 130. > TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(dctx, app_data_index); 131. 132. t->noncecnt++; crypto/rand/drbg_lib.c:346:1: start of procedure RAND_DRBG_get_ex_data() 344. } 345. 346. > void *RAND_DRBG_get_ex_data(const DRBG_CTX *dctx, int idx) 347. { 348. return CRYPTO_get_ex_data(&dctx->ex_data, idx); crypto/rand/drbg_lib.c:348:5: 346. void *RAND_DRBG_get_ex_data(const DRBG_CTX *dctx, int idx) 347. { 348. > return CRYPTO_get_ex_data(&dctx->ex_data, idx); 349. } 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. > } crypto/rand/drbg_lib.c:349:1: return from a call to RAND_DRBG_get_ex_data 347. { 348. return CRYPTO_get_ex_data(&dctx->ex_data, idx); 349. > } test/drbgtest.c:132:5: 130. TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(dctx, app_data_index); 131. 132. > t->noncecnt++; 133. *pout = (unsigned char *)t->nonce; 134. return t->noncelen;
https://github.com/openssl/openssl/blob/12fb8c3d2dd00f3d4f1b084385403d26ed64a596/test/drbgtest.c/#L132
d2a_code_trace_data_44321
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ecp_smpl.c:1308: 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:1240:1: Parameter `ctx->stack.depth` 1238. } 1239. 1240. > int ec_GFp_simple_points_make_affine(const EC_GROUP *group, size_t num, 1241. EC_POINT *points[], BN_CTX *ctx) 1242. { crypto/ec/ecp_smpl.c:1258:5: Call 1256. } 1257. 1258. BN_CTX_start(ctx); ^ 1259. tmp = BN_CTX_get(ctx); 1260. tmp_Z = 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:1308:10: Call 1306. */ 1307. 1308. if (!BN_mod_inverse(tmp, prod_Z[num - 1], group->field, ctx)) { ^ 1309. ECerr(EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE, ERR_R_BN_LIB); 1310. goto err; 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_44322
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:1059: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + 11]):unsigned64 by call to `WPACKET_start_sub_packet_len__`. Showing all 12 steps of the trace ssl/t1_lib.c:1057:14: Call 1055. if (s->tlsext_hostname != NULL) { 1056. /* Add TLS extension servername to the Client Hello message */ 1057. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_server_name) ^ 1058. /* Sub-packet for server_name extension */ 1059. || !WPACKET_start_sub_packet_u16(pkt) 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:1059:21: Call 1057. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_server_name) 1058. /* Sub-packet for server_name extension */ 1059. || !WPACKET_start_sub_packet_u16(pkt) ^ 1060. /* Sub-packet for servername list (always 1 hostname)*/ 1061. || !WPACKET_start_sub_packet_u16(pkt) ssl/packet.c:224:1: Parameter `pkt->written` 222. } 223. 224. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 225. { 226. WPACKET_SUB *sub; ssl/packet.c:248:10: Call 246. } 247. 248. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 249. return 0; 250. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */ ssl/packet.c:15:1: Parameter `pkt->written` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ssl/packet.c:17:10: Call 15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ^ 18. return 0; 19. ssl/packet.c:36:1: <LHS trace> 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: Parameter `pkt->buf->length` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: <RHS trace> 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: Parameter `len` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:46:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + pkt->written + 11]):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_44323
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/sm2/sm2_sign.c:214: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_add`. Showing all 17 steps of the trace crypto/sm2/sm2_sign.c:186:5: Call 184. } 185. 186. BN_CTX_start(ctx); ^ 187. t = BN_CTX_get(ctx); 188. x1 = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/sm2/sm2_sign.c:214:10: Call 212. } 213. 214. if (!BN_mod_add(t, r, s, order, ctx)) { ^ 215. SM2err(SM2_F_SM2_SIG_VERIFY, ERR_R_BN_LIB); 216. goto done; crypto/bn/bn_mod.c:28:1: Parameter `ctx->stack.depth` 26. } 27. 28. > int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 29. BN_CTX *ctx) 30. { crypto/bn/bn_mod.c:33:12: Call 31. if (!BN_add(r, a, b)) 32. return 0; 33. return BN_nnmod(r, r, m, ctx); ^ 34. } 35. crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:190:5: Call 188. } 189. 190. BN_CTX_start(ctx); ^ 191. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 192. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:410:5: Call 408. if (no_branch) 409. bn_correct_top(res); 410. BN_CTX_end(ctx); ^ 411. return 1; 412. err: crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.indexes` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:274:1: <Offset trace> 272. } 273. 274. > static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:274:1: Parameter `st->depth` 272. } 273. 274. > static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:274:1: <Length trace> 272. } 273. 274. > static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:274:1: Parameter `*st->indexes` 272. } 273. 274. > static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:276:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_add` 274. static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; ^ 277. } 278.
https://github.com/openssl/openssl/blob/630fe1da888490b7dfef3fe0928b813ddff5d51a/crypto/bn/bn_ctx.c/#L276
d2a_code_trace_data_44324
int test_div(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b, *c, *d, *e; int i; a = BN_new(); b = BN_new(); c = BN_new(); d = BN_new(); e = BN_new(); BN_one(a); BN_zero(b); if (BN_div(d, c, a, b, ctx)) { fprintf(stderr, "Division by zero succeeded!\n"); return 0; } for (i = 0; i < num0 + num1; i++) { if (i < num1) { BN_bntest_rand(a, 400, 0, 0); BN_copy(b, a); BN_lshift(a, a, i); BN_add_word(a, i); } else BN_bntest_rand(b, 50 + 3 * (i - num1), 0, 0); a->neg = rand_neg(); b->neg = rand_neg(); BN_div(d, c, a, b, ctx); if (bp != NULL) { if (!results) { BN_print(bp, a); BIO_puts(bp, " / "); BN_print(bp, b); BIO_puts(bp, " - "); } BN_print(bp, d); BIO_puts(bp, "\n"); if (!results) { BN_print(bp, a); BIO_puts(bp, " % "); BN_print(bp, b); BIO_puts(bp, " - "); } BN_print(bp, c); BIO_puts(bp, "\n"); } BN_mul(e, d, b, ctx); BN_add(d, e, c); BN_sub(d, d, a); if (!BN_is_zero(d)) { fprintf(stderr, "Division test failed!\n"); return 0; } } BN_free(a); BN_free(b); BN_free(c); BN_free(d); BN_free(e); return (1); } test/bntest.c:508: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 456, column 9 is not reachable after line 508, column 5. Showing all 173 steps of the trace test/bntest.c:449:1: start of procedure test_div() 447. } 448. 449. > int test_div(BIO *bp, BN_CTX *ctx) 450. { 451. BIGNUM *a, *b, *c, *d, *e; test/bntest.c:454:5: 452. int i; 453. 454. > a = BN_new(); 455. b = BN_new(); 456. c = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:455:5: 453. 454. a = BN_new(); 455. > b = BN_new(); 456. c = BN_new(); 457. d = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:456:5: 454. a = BN_new(); 455. b = BN_new(); 456. > c = BN_new(); 457. d = BN_new(); 458. e = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:457:5: 455. b = BN_new(); 456. c = BN_new(); 457. > d = BN_new(); 458. e = BN_new(); 459. crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:458:5: 456. c = BN_new(); 457. d = BN_new(); 458. > e = BN_new(); 459. 460. BN_one(a); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:460:5: 458. e = BN_new(); 459. 460. > BN_one(a); 461. BN_zero(b); 462. crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is true 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:461:5: 459. 460. BN_one(a); 461. > BN_zero(b); 462. 463. if (BN_div(d, c, a, b, ctx)) { crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is false 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:463:9: Taking false branch 461. BN_zero(b); 462. 463. if (BN_div(d, c, a, b, ctx)) { ^ 464. fprintf(stderr, "Division by zero succeeded!\n"); 465. return 0; test/bntest.c:468:10: 466. } 467. 468. > for (i = 0; i < num0 + num1; i++) { 469. if (i < num1) { 470. BN_bntest_rand(a, 400, 0, 0); test/bntest.c:468:17: Loop condition is false. Leaving loop 466. } 467. 468. for (i = 0; i < num0 + num1; i++) { ^ 469. if (i < num1) { 470. BN_bntest_rand(a, 400, 0, 0); test/bntest.c:506:5: 504. } 505. } 506. > BN_free(a); 507. BN_free(b); 508. BN_free(c); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a) test/bntest.c:507:5: 505. } 506. BN_free(a); 507. > BN_free(b); 508. BN_free(c); 509. BN_free(d); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a) test/bntest.c:508:5: 506. BN_free(a); 507. BN_free(b); 508. > BN_free(c); 509. BN_free(d); 510. BN_free(e); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L508
d2a_code_trace_data_44325
static inline void idx_to_quant(MPCContext *c, BitstreamContext *bc, int idx, int *dst) { int i, i1, t; switch(idx){ case -1: for(i = 0; i < SAMPLES_PER_BAND; i++){ *dst++ = (av_lfg_get(&c->rnd) & 0x3FC) - 510; } break; case 1: i1 = bitstream_read_bit(bc); for(i = 0; i < SAMPLES_PER_BAND/3; i++){ t = bitstream_read_vlc(bc, quant_vlc[0][i1].table, 9, 2); *dst++ = mpc7_idx30[t]; *dst++ = mpc7_idx31[t]; *dst++ = mpc7_idx32[t]; } break; case 2: i1 = bitstream_read_bit(bc); for(i = 0; i < SAMPLES_PER_BAND/2; i++){ t = bitstream_read_vlc(bc, quant_vlc[1][i1].table, 9, 2); *dst++ = mpc7_idx50[t]; *dst++ = mpc7_idx51[t]; } break; case 3: case 4: case 5: case 6: case 7: i1 = bitstream_read_bit(bc); for(i = 0; i < SAMPLES_PER_BAND; i++) *dst++ = bitstream_read_vlc(bc, quant_vlc[idx - 1][i1].table, 9, 2) - mpc7_quant_vlc_off[idx - 1]; break; case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: t = (1 << (idx - 2)) - 1; for(i = 0; i < SAMPLES_PER_BAND; i++) *dst++ = bitstream_read(bc, idx - 1) - t; break; default: return; } } libavcodec/mpc7.c:153: error: Integer Overflow L2 ([0, 1020] - 510):unsigned32. libavcodec/mpc7.c:147:1: <LHS trace> 145. * Fill samples for given subband 146. */ 147. static inline void idx_to_quant(MPCContext *c, BitstreamContext *bc, int idx, int *dst) ^ 148. { 149. int i, i1, t; libavcodec/mpc7.c:147:1: Parameter `c->rnd.state[*]` 145. * Fill samples for given subband 146. */ 147. static inline void idx_to_quant(MPCContext *c, BitstreamContext *bc, int idx, int *dst) ^ 148. { 149. int i, i1, t; libavcodec/mpc7.c:153:23: Call 151. case -1: 152. for(i = 0; i < SAMPLES_PER_BAND; i++){ 153. *dst++ = (av_lfg_get(&c->rnd) & 0x3FC) - 510; ^ 154. } 155. break; libavutil/lfg.h:38:1: Parameter `c->state[*]` 36. * it may be good enough and faster for your specific use case. 37. */ 38. static inline unsigned int av_lfg_get(AVLFG *c){ ^ 39. c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63]; 40. return c->state[c->index++ & 63]; libavutil/lfg.h:40:5: Assignment 38. static inline unsigned int av_lfg_get(AVLFG *c){ 39. c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63]; 40. return c->state[c->index++ & 63]; ^ 41. } 42. libavcodec/mpc7.c:153:13: Binary operation: ([0, 1020] - 510):unsigned32 151. case -1: 152. for(i = 0; i < SAMPLES_PER_BAND; i++){ 153. *dst++ = (av_lfg_get(&c->rnd) & 0x3FC) - 510; ^ 154. } 155. break;
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/mpc7.c/#L153
d2a_code_trace_data_44326
void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) { unsigned long hash; OPENSSL_LH_NODE *nn, **rn; void *ret; lh->error = 0; rn = getrn(lh, data, &hash); if (*rn == NULL) { lh->num_no_delete++; return (NULL); } else { nn = *rn; *rn = nn->next; ret = nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))) contract(lh); return (ret); } ssl/record/ssl3_record.c:1621: error: INTEGER_OVERFLOW_L2 ([0, max(0, `s->initial_ctx->sessions->num_items`)] - 1):unsigned64 by call to `dtls1_process_record`. Showing all 17 steps of the trace ssl/record/ssl3_record.c:1462:1: Parameter `s->initial_ctx->sessions->num_items` 1460. */ 1461. /* used only by dtls1_read_bytes */ 1462. > int dtls1_get_record(SSL *s) 1463. { 1464. int ssl_major, ssl_minor; ssl/record/ssl3_record.c:1479:10: Call 1477. * This is a non-blocking operation. 1478. */ 1479. if (!dtls1_process_buffered_records(s)) ^ 1480. return -1; 1481. ssl/record/rec_layer_d1.c:229:1: Parameter `s->initial_ctx->sessions->num_items` 227. &((s)->rlayer.d->unprocessed_rcds)) 228. 229. > int dtls1_process_buffered_records(SSL *s) 230. { 231. pitem *item; ssl/record/ssl3_record.c:1621:10: Call 1619. } 1620. 1621. if (!dtls1_process_record(s, bitmap)) { ^ 1622. rr->length = 0; 1623. RECORD_LAYER_reset_packet_length(&s->rlayer); /* dump this record */ ssl/record/ssl3_record.c:1276:1: Parameter `s->initial_ctx->sessions->num_items` 1274. } 1275. 1276. > int dtls1_process_record(SSL *s, DTLS1_BITMAP *bitmap) 1277. { 1278. int i, al; ssl/record/ssl3_record.c:1439:5: Call 1437. 1438. f_err: 1439. ssl3_send_alert(s, SSL3_AL_FATAL, al); ^ 1440. err: 1441. return (0); ssl/s3_msg.c:63:1: Parameter `s->initial_ctx->sessions->num_items` 61. } 62. 63. > int ssl3_send_alert(SSL *s, int level, int desc) 64. { 65. /* Map tls/ssl alert value to correct one */ ssl/s3_msg.c:74:9: Call 72. /* If a fatal one, remove from cache */ 73. if ((level == SSL3_AL_FATAL) && (s->session != NULL)) 74. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 75. 76. s->s3->alert_dispatch = 1; ssl/ssl_sess.c:697:1: Parameter `ctx->sessions->num_items` 695. } 696. 697. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 698. { 699. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:699:12: Call 697. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 698. { 699. return remove_session_lock(ctx, c, 1); ^ 700. } 701. ssl/ssl_sess.c:702:1: Parameter `ctx->sessions->num_items` 700. } 701. 702. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 703. { 704. SSL_SESSION *r; ssl/ssl_sess.c:712:17: Call 710. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 711. ret = 1; 712. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 713. SSL_SESSION_list_remove(ctx, c); 714. } ssl/ssl_locl.h:595:1: Parameter `lh->num_items` 593. }; 594. 595. > DEFINE_LHASH_OF(SSL_SESSION); 596. /* Needed in ssl_cert.c */ 597. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:595:1: Call 593. }; 594. 595. > DEFINE_LHASH_OF(SSL_SESSION); 596. /* Needed in ssl_cert.c */ 597. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:103:1: <LHS trace> 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:103:1: Parameter `lh->num_items` 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:123:5: Binary operation: ([0, max(0, s->initial_ctx->sessions->num_items)] - 1):unsigned64 by call to `dtls1_process_record` 121. } 122. 123. lh->num_items--; ^ 124. if ((lh->num_nodes > MIN_NODES) && 125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
https://github.com/openssl/openssl/blob/1fb9fdc3027b27d8eb6a1e6a846435b070980770/crypto/lhash/lhash.c/#L123
d2a_code_trace_data_44327
static int SSHKDF(const EVP_MD *evp_md, const unsigned char *key, size_t key_len, const unsigned char *xcghash, size_t xcghash_len, const unsigned char *session_id, size_t session_id_len, char type, unsigned char *okey, size_t okey_len) { EVP_MD_CTX *md = NULL; unsigned char digest[EVP_MAX_MD_SIZE]; unsigned int dsize = 0; size_t cursize = 0; int ret = 0; md = EVP_MD_CTX_new(); if (md == NULL) return 0; if (!EVP_DigestInit_ex(md, evp_md, NULL)) goto out; if (!EVP_DigestUpdate(md, key, key_len)) goto out; if (!EVP_DigestUpdate(md, xcghash, xcghash_len)) goto out; if (!EVP_DigestUpdate(md, &type, 1)) goto out; if (!EVP_DigestUpdate(md, session_id, session_id_len)) goto out; if (!EVP_DigestFinal_ex(md, digest, &dsize)) goto out; if (okey_len < dsize) { memcpy(okey, digest, okey_len); ret = 1; goto out; } memcpy(okey, digest, dsize); for (cursize = dsize; cursize < okey_len; cursize += dsize) { if (!EVP_DigestInit_ex(md, evp_md, NULL)) goto out; if (!EVP_DigestUpdate(md, key, key_len)) goto out; if (!EVP_DigestUpdate(md, xcghash, xcghash_len)) goto out; if (!EVP_DigestUpdate(md, okey, cursize)) goto out; if (!EVP_DigestFinal_ex(md, digest, &dsize)) goto out; if (okey_len < cursize + dsize) { memcpy(okey + cursize, digest, okey_len - cursize); ret = 1; goto out; } memcpy(okey + cursize, digest, dsize); } ret = 1; out: EVP_MD_CTX_free(md); OPENSSL_cleanse(digest, EVP_MAX_MD_SIZE); return ret; } crypto/kdf/sshkdf.c:284: error: MEMORY_LEAK memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 225, column 10 is not reachable after line 284, column 5. Showing all 45 steps of the trace crypto/kdf/sshkdf.c:213:1: start of procedure SSHKDF() 211. }; 212. 213. > static int SSHKDF(const EVP_MD *evp_md, 214. const unsigned char *key, size_t key_len, 215. const unsigned char *xcghash, size_t xcghash_len, crypto/kdf/sshkdf.c:219:5: 217. char type, unsigned char *okey, size_t okey_len) 218. { 219. > EVP_MD_CTX *md = NULL; 220. unsigned char digest[EVP_MAX_MD_SIZE]; 221. unsigned int dsize = 0; crypto/kdf/sshkdf.c:221:5: 219. EVP_MD_CTX *md = NULL; 220. unsigned char digest[EVP_MAX_MD_SIZE]; 221. > unsigned int dsize = 0; 222. size_t cursize = 0; 223. int ret = 0; crypto/kdf/sshkdf.c:222:5: 220. unsigned char digest[EVP_MAX_MD_SIZE]; 221. unsigned int dsize = 0; 222. > size_t cursize = 0; 223. int ret = 0; 224. crypto/kdf/sshkdf.c:223:5: 221. unsigned int dsize = 0; 222. size_t cursize = 0; 223. > int ret = 0; 224. 225. md = EVP_MD_CTX_new(); crypto/kdf/sshkdf.c:225:5: 223. int ret = 0; 224. 225. > md = EVP_MD_CTX_new(); 226. if (md == NULL) 227. return 0; crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_new() 47. } 48. 49. > EVP_MD_CTX *EVP_MD_CTX_new(void) 50. { 51. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); crypto/evp/digest.c:51:5: 49. EVP_MD_CTX *EVP_MD_CTX_new(void) 50. { 51. > return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 52. } 53. 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:52:1: return from a call to EVP_MD_CTX_new 50. { 51. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 52. > } 53. 54. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) crypto/kdf/sshkdf.c:226:9: Taking false branch 224. 225. md = EVP_MD_CTX_new(); 226. if (md == NULL) ^ 227. return 0; 228. crypto/kdf/sshkdf.c:229:10: Taking false branch 227. return 0; 228. 229. if (!EVP_DigestInit_ex(md, evp_md, NULL)) ^ 230. goto out; 231. crypto/kdf/sshkdf.c:232:10: 230. goto out; 231. 232. > if (!EVP_DigestUpdate(md, key, key_len)) 233. goto out; 234. crypto/evp/digest.c:151:1: start of procedure EVP_DigestUpdate() 149. } 150. 151. > int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, size_t count) 152. { 153. return ctx->update(ctx, data, count); crypto/evp/digest.c:153:5: Skipping __function_pointer__(): unresolved function pointer 151. int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, size_t count) 152. { 153. return ctx->update(ctx, data, count); ^ 154. } 155. crypto/evp/digest.c:154:1: return from a call to EVP_DigestUpdate 152. { 153. return ctx->update(ctx, data, count); 154. > } 155. 156. /* The caller can assume that this removes any secret data from the context */ crypto/kdf/sshkdf.c:232:10: Taking true branch 230. goto out; 231. 232. if (!EVP_DigestUpdate(md, key, key_len)) ^ 233. goto out; 234. crypto/kdf/sshkdf.c:283:1: 281. ret = 1; 282. 283. > out: 284. EVP_MD_CTX_free(md); 285. OPENSSL_cleanse(digest, EVP_MAX_MD_SIZE); crypto/kdf/sshkdf.c:284:5: 282. 283. out: 284. > EVP_MD_CTX_free(md); 285. OPENSSL_cleanse(digest, EVP_MAX_MD_SIZE); 286. return ret; crypto/evp/digest.c:54:1: start of procedure EVP_MD_CTX_free() 52. } 53. 54. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 55. { 56. EVP_MD_CTX_reset(ctx); crypto/evp/digest.c:56:5: Skipping EVP_MD_CTX_reset(): empty list of specs 54. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 55. { 56. EVP_MD_CTX_reset(ctx); ^ 57. OPENSSL_free(ctx); 58. } crypto/evp/digest.c:57:5: 55. { 56. EVP_MD_CTX_reset(ctx); 57. > OPENSSL_free(ctx); 58. } 59. 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:58:1: return from a call to EVP_MD_CTX_free 56. EVP_MD_CTX_reset(ctx); 57. OPENSSL_free(ctx); 58. > } 59. 60. int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
https://github.com/openssl/openssl/blob/9f27d4bf32c0465270e1922365b21825a0f7a42a/crypto/kdf/sshkdf.c/#L284
d2a_code_trace_data_44328
tmsize_t TIFFWriteEncodedTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc) { static const char module[] = "TIFFWriteEncodedTile"; TIFFDirectory *td; uint16 sample; if (!WRITECHECKTILES(tif, module)) return ((tmsize_t)(-1)); td = &tif->tif_dir; if (tile >= td->td_nstrips) { TIFFErrorExt(tif->tif_clientdata, module, "Tile %lu out of range, max %lu", (unsigned long) tile, (unsigned long) td->td_nstrips); return ((tmsize_t)(-1)); } if (!BUFFERCHECK(tif)) return ((tmsize_t)(-1)); tif->tif_flags |= TIFF_BUF4WRITE; tif->tif_curtile = tile; tif->tif_rawcc = 0; tif->tif_rawcp = tif->tif_rawdata; if( td->td_stripbytecount[tile] > 0 ) { tif->tif_curoff = 0; } tif->tif_row = (tile % TIFFhowmany_32(td->td_imagelength, td->td_tilelength)) * td->td_tilelength; tif->tif_col = (tile % TIFFhowmany_32(td->td_imagewidth, td->td_tilewidth)) * td->td_tilewidth; if ((tif->tif_flags & TIFF_CODERSETUP) == 0) { if (!(*tif->tif_setupencode)(tif)) return ((tmsize_t)(-1)); tif->tif_flags |= TIFF_CODERSETUP; } tif->tif_flags &= ~TIFF_POSTENCODE; sample = (uint16)(tile/td->td_stripsperimage); if (!(*tif->tif_preencode)(tif, sample)) return ((tmsize_t)(-1)); if ( cc < 1 || cc > tif->tif_tilesize) cc = tif->tif_tilesize; tif->tif_postdecode( tif, (uint8*) data, cc ); if (!(*tif->tif_encodetile)(tif, (uint8*) data, cc, sample)) return (0); if (!(*tif->tif_postencode)(tif)) return ((tmsize_t)(-1)); if (!isFillOrder(tif, td->td_fillorder) && (tif->tif_flags & TIFF_NOBITREV) == 0) TIFFReverseBits((uint8*)tif->tif_rawdata, tif->tif_rawcc); if (tif->tif_rawcc > 0 && !TIFFAppendToStrip(tif, tile, tif->tif_rawdata, tif->tif_rawcc)) return ((tmsize_t)(-1)); tif->tif_rawcc = 0; tif->tif_rawcp = tif->tif_rawdata; return (cc); } libtiff/tif_write.c:368: error: Buffer Overrun S2 Offset: `tile` Size: [0, +oo]. libtiff/tif_write.c:339:1: <Offset trace> 337. * the image on each write (as TIFFWriteScanline does). 338. */ 339. tmsize_t ^ 340. TIFFWriteEncodedTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc) 341. { libtiff/tif_write.c:339:1: Parameter `tile` 337. * the image on each write (as TIFFWriteScanline does). 338. */ 339. tmsize_t ^ 340. TIFFWriteEncodedTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc) 341. { libtiff/tif_write.c:339:1: <Length trace> 337. * the image on each write (as TIFFWriteScanline does). 338. */ 339. tmsize_t ^ 340. TIFFWriteEncodedTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc) 341. { libtiff/tif_write.c:339:1: Parameter `*tif->tif_dir.td_stripbytecount` 337. * the image on each write (as TIFFWriteScanline does). 338. */ 339. tmsize_t ^ 340. TIFFWriteEncodedTile(TIFF* tif, uint32 tile, void* data, tmsize_t cc) 341. { libtiff/tif_write.c:368:6: Array access: Offset: tile Size: [0, +oo] 366. tif->tif_rawcp = tif->tif_rawdata; 367. 368. if( td->td_stripbytecount[tile] > 0 ) ^ 369. { 370. /* Force TIFFAppendToStrip() to consider placing data at end
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_write.c/#L368
d2a_code_trace_data_44329
static int test_rand_add(void) { RAND_DRBG *master = RAND_DRBG_get0_master(); RAND_DRBG_get_entropy_fn old_get_entropy = master->get_entropy; RAND_DRBG_cleanup_entropy_fn old_cleanup_entropy = master->cleanup_entropy; int rv = 0; unsigned char rand_add_buf[256]; master->get_entropy = get_pool_entropy; master->cleanup_entropy = cleanup_pool_entropy; master->reseed_prop_counter++; RAND_DRBG_uninstantiate(master); memset(rand_add_buf, 0xCD, sizeof(rand_add_buf)); RAND_add(rand_add_buf, sizeof(rand_add_buf), sizeof(rand_add_buf)); if (!TEST_true(RAND_DRBG_instantiate(master, NULL, 0))) goto error; rv = 1; error: master->get_entropy = old_get_entropy; master->cleanup_entropy = old_cleanup_entropy; return rv; } test/drbgtest.c:926: error: NULL_DEREFERENCE pointer `master` last assigned on line 925 could be null and is dereferenced at line 926, column 48. Showing all 13 steps of the trace test/drbgtest.c:923:1: start of procedure test_rand_add() 921. * RAND_add() is enough to reseed it. 922. */ 923. > static int test_rand_add(void) 924. { 925. RAND_DRBG *master = RAND_DRBG_get0_master(); test/drbgtest.c:925:5: 923. static int test_rand_add(void) 924. { 925. > RAND_DRBG *master = RAND_DRBG_get0_master(); 926. RAND_DRBG_get_entropy_fn old_get_entropy = master->get_entropy; 927. RAND_DRBG_cleanup_entropy_fn old_cleanup_entropy = master->cleanup_entropy; crypto/rand/drbg_lib.c:1088:1: start of procedure RAND_DRBG_get0_master() 1086. * 1087. */ 1088. > RAND_DRBG *RAND_DRBG_get0_master(void) 1089. { 1090. if (!RUN_ONCE(&rand_drbg_init, do_rand_drbg_init)) crypto/rand/drbg_lib.c:1090:10: 1088. RAND_DRBG *RAND_DRBG_get0_master(void) 1089. { 1090. > if (!RUN_ONCE(&rand_drbg_init, do_rand_drbg_init)) 1091. return NULL; 1092. crypto/threads_pthread.c:111:1: start of procedure CRYPTO_THREAD_run_once() 109. } 110. 111. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 112. { 113. if (pthread_once(once, init) != 0) crypto/threads_pthread.c:113:9: Taking true branch 111. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 112. { 113. if (pthread_once(once, init) != 0) ^ 114. return 0; 115. crypto/threads_pthread.c:114:9: 112. { 113. if (pthread_once(once, init) != 0) 114. > return 0; 115. 116. return 1; crypto/threads_pthread.c:117:1: return from a call to CRYPTO_THREAD_run_once 115. 116. return 1; 117. > } 118. 119. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)) crypto/rand/drbg_lib.c:1090:10: Condition is false 1088. RAND_DRBG *RAND_DRBG_get0_master(void) 1089. { 1090. if (!RUN_ONCE(&rand_drbg_init, do_rand_drbg_init)) ^ 1091. return NULL; 1092. crypto/rand/drbg_lib.c:1090:10: Taking true branch 1088. RAND_DRBG *RAND_DRBG_get0_master(void) 1089. { 1090. if (!RUN_ONCE(&rand_drbg_init, do_rand_drbg_init)) ^ 1091. return NULL; 1092. crypto/rand/drbg_lib.c:1091:9: 1089. { 1090. if (!RUN_ONCE(&rand_drbg_init, do_rand_drbg_init)) 1091. > return NULL; 1092. 1093. return master_drbg; crypto/rand/drbg_lib.c:1094:1: return from a call to RAND_DRBG_get0_master 1092. 1093. return master_drbg; 1094. > } 1095. 1096. /* test/drbgtest.c:926:5: 924. { 925. RAND_DRBG *master = RAND_DRBG_get0_master(); 926. > RAND_DRBG_get_entropy_fn old_get_entropy = master->get_entropy; 927. RAND_DRBG_cleanup_entropy_fn old_cleanup_entropy = master->cleanup_entropy; 928. int rv = 0;
https://github.com/openssl/openssl/blob/b44882a0bd0717e0aab84f5dc3ef81ab673155e9/test/drbgtest.c/#L926
d2a_code_trace_data_44330
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/rsa.c:218: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `RSA_check_key`. Showing all 18 steps of the trace apps/rsa.c:213:9: Call 211. RSA_get0_key(rsa, &n, NULL, NULL); 212. BIO_printf(out, "Modulus="); 213. BN_print(out, n); ^ 214. BIO_printf(out, "\n"); 215. } crypto/bn/bn_print.c:301:1: Parameter `a->top` 299. # endif 300. 301. > int BN_print(BIO *bp, const BIGNUM *a) 302. { 303. int i, j, v, z = 0; apps/rsa.c:218:17: Call 216. 217. if (check) { 218. int r = RSA_check_key(rsa); ^ 219. 220. if (r == 1) crypto/rsa/rsa_chk.c:14:1: Parameter `key->d->top` 12. #include "rsa_locl.h" 13. 14. > int RSA_check_key(const RSA *key) 15. { 16. return RSA_check_key_ex(key, NULL); crypto/rsa/rsa_chk.c:16:12: Call 14. int RSA_check_key(const RSA *key) 15. { 16. return RSA_check_key_ex(key, NULL); ^ 17. } 18. 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:114:14: Call 112. goto err; 113. } 114. if (!BN_mod(j, key->d, i, ctx)) { ^ 115. ret = -1; 116. goto err; 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 `RSA_check_key` 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/2f3930bc0edbfdc7718f709b856fa53f0ec57cde/crypto/bn/bn_shift.c/#L110
d2a_code_trace_data_44331
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_sqrt.c:148: error: INTEGER_OVERFLOW_L2 ([0, 6+max(0, `ctx->stack.depth`)] - 1):unsigned32 by call to `BN_mod_exp`. Showing all 35 steps of the trace crypto/bn/bn_sqrt.c:62:1: Parameter `ctx->stack.depth` 60. 61. 62. > BIGNUM *BN_mod_sqrt(BIGNUM *in, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) 63. /* Returns 'ret' such that 64. * ret^2 == a (mod p), crypto/bn/bn_sqrt.c:114:2: Call 112. } 113. 114. BN_CTX_start(ctx); ^ 115. A = BN_CTX_get(ctx); 116. b = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_sqrt.c:128:7: Call 126. 127. /* A = a mod p */ 128. if (!BN_nnmod(A, a, p, ctx)) goto end; ^ 129. 130. /* now write |p| - 1 as 2^e*q where q is odd */ crypto/bn/bn_mod.c:127:1: Parameter `ctx->stack.depth` 125. 126. 127. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 128. { 129. /* like BN_mod, but returns non-negative remainder crypto/bn/bn_mod.c:132:8: Call 130. * (i.e., 0 <= r < |d| always holds) */ 131. 132. if (!(BN_mod(r,m,d,ctx))) ^ 133. return 0; 134. if (!r->neg) crypto/bn/bn_div.c:181:1: Parameter `ctx->stack.depth` 179. * If 'dv' or 'rm' is NULL, the respective value is not returned. 180. */ 181. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 182. BN_CTX *ctx) 183. { crypto/bn/bn_sqrt.c:148:8: Call 146. q->neg = 0; 147. if (!BN_add_word(q, 1)) goto end; 148. if (!BN_mod_exp(ret, A, q, p, ctx)) goto end; ^ 149. err = 0; 150. goto vrfy; crypto/bn/bn_exp.c:176:1: Parameter `ctx->stack.depth` 174. 175. 176. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 177. BN_CTX *ctx) 178. { crypto/bn/bn_exp.c:232:8: Call 230. { 231. BN_ULONG A = a->d[0]; 232. ret=BN_mod_exp_mont_word(r,A,p,m,ctx,NULL); ^ 233. } 234. else crypto/bn/bn_exp.c:832:1: Parameter `ctx->stack.depth` 830. } 831. 832. > int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p, 833. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 834. { crypto/bn/bn_exp.c:887:2: Call 885. } 886. 887. BN_CTX_start(ctx); ^ 888. d = BN_CTX_get(ctx); 889. r = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_exp.c:898:8: Call 896. { 897. if ((mont = BN_MONT_CTX_new()) == NULL) goto err; 898. if (!BN_MONT_CTX_set(mont, m, ctx)) goto err; ^ 899. } 900. crypto/bn/bn_mont.c:355:1: Parameter `ctx->stack.depth` 353. } 354. 355. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 356. { 357. int ret = 0; crypto/bn/bn_mont.c:360:2: Call 358. BIGNUM *Ri,*R; 359. 360. BN_CTX_start(ctx); ^ 361. if((Ri = BN_CTX_get(ctx)) == NULL) goto err; 362. R= &(mont->RR); /* grab RR as a temp */ crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mont.c:421:8: Call 419. tmod.top = buf[0] != 0 ? 1 : 0; 420. /* Ri = R^-1 mod N*/ 421. if ((BN_mod_inverse(Ri,R,&tmod,ctx)) == NULL) ^ 422. goto err; 423. if (!BN_lshift(Ri,Ri,BN_BITS2)) goto err; /* R*Ri */ crypto/bn/bn_gcd.c:209:1: Parameter `ctx->stack.depth` 207. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); 208. 209. > BIGNUM *BN_mod_inverse(BIGNUM *in, 210. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 211. { crypto/bn/bn_gcd.c:218:10: Call 216. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) 217. { 218. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 219. } 220. crypto/bn/bn_gcd.c:507:1: Parameter `ctx->stack.depth` 505. * It does not contain branches that may leak sensitive information. 506. */ 507. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 508. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 509. { crypto/bn/bn_gcd.c:519:2: Call 517. bn_check_top(n); 518. 519. BN_CTX_start(ctx); ^ 520. A = BN_CTX_get(ctx); 521. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gcd.c:548:8: Call 546. pB = &local_B; 547. BN_with_flags(pB, B, BN_FLG_CONSTTIME); 548. if (!BN_nnmod(B, pB, A, ctx)) goto err; ^ 549. } 550. sign = -1; crypto/bn/bn_mod.c:127:1: Parameter `ctx->stack.depth` 125. 126. 127. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 128. { 129. /* like BN_mod, but returns non-negative remainder crypto/bn/bn_mod.c:132:8: Call 130. * (i.e., 0 <= r < |d| always holds) */ 131. 132. if (!(BN_mod(r,m,d,ctx))) ^ 133. return 0; 134. if (!r->neg) crypto/bn/bn_div.c:181:1: Parameter `ctx->stack.depth` 179. * If 'dv' or 'rm' is NULL, the respective value is not returned. 180. */ 181. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 182. BN_CTX *ctx) 183. { crypto/bn/bn_div.c:226:2: Call 224. } 225. 226. BN_CTX_start(ctx); ^ 227. tmp=BN_CTX_get(ctx); 228. snum=BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:441:2: Call 439. } 440. if (no_branch) bn_correct_top(res); 441. BN_CTX_end(ctx); ^ 442. return(1); 443. err: crypto/bn/bn_ctx.c:270:1: Parameter `ctx->stack.depth` 268. } 269. 270. > void BN_CTX_end(BN_CTX *ctx) 271. { 272. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:277:21: Call 275. else 276. { 277. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 278. /* Does this stack frame have anything to release? */ 279. if(fp < ctx->used) crypto/bn/bn_ctx.c:351:1: <LHS trace> 349. } 350. 351. > static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:351:1: Parameter `st->depth` 349. } 350. 351. > static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:353:9: Binary operation: ([0, 6+max(0, ctx->stack.depth)] - 1):unsigned32 by call to `BN_mod_exp` 351. static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; ^ 354. } 355.
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/bn/bn_ctx.c/#L353
d2a_code_trace_data_44332
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } crypto/bn/bn_recp.c:67: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, +oo] by call to `BN_sqr`. Showing all 19 steps of the trace crypto/bn/bn_recp.c:63:14: Call 61. 62. BN_CTX_start(ctx); 63. if ((a = BN_CTX_get(ctx)) == NULL) ^ 64. goto err; 65. if (y != NULL) { crypto/bn/bn_ctx.c:219:5: Call 217. } 218. /* OK, make sure the returned bignum is "zero" */ 219. BN_zero(ret); ^ 220. /* clear BN_FLG_CONSTTIME if leaked from previous frames */ 221. ret->flags &= (~BN_FLG_CONSTTIME); crypto/bn/bn_lib.c:359:1: Parameter `*a->d` 357. } 358. 359. > int BN_set_word(BIGNUM *a, BN_ULONG w) 360. { 361. bn_check_top(a); crypto/bn/bn_lib.c:362:9: Call 360. { 361. bn_check_top(a); 362. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 363. return 0; 364. a->neg = 0; crypto/bn/bn_lcl.h:660:1: Parameter `*a->d` 658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 659. 660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 661. { 662. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_recp.c:67:18: Call 65. if (y != NULL) { 66. if (x == y) { 67. if (!BN_sqr(a, x, ctx)) ^ 68. goto err; 69. } else { crypto/bn/bn_sqr.c:17:1: Parameter `*r->d` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int ret = bn_sqr_fixed_top(r, a, ctx); crypto/bn/bn_sqr.c:19:15: Call 17. int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int ret = bn_sqr_fixed_top(r, a, ctx); ^ 20. 21. bn_correct_top(r); crypto/bn/bn_sqr.c:27:1: Parameter `*r->d` 25. } 26. 27. > int bn_sqr_fixed_top(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 28. { 29. int max, al; crypto/bn/bn_sqr.c:49:9: Call 47. 48. max = 2 * al; /* Non-zero (from above) */ 49. if (bn_wexpand(rr, max) == NULL) ^ 50. goto err; 51. crypto/bn/bn_lib.c:960:1: Parameter `*a->d` 958. } 959. 960. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 961. { 962. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:962:37: Call 960. BIGNUM *bn_wexpand(BIGNUM *a, int words) 961. { 962. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 963. } 964. crypto/bn/bn_lib.c:245:1: Parameter `*b->d` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `*b->d` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, +oo] by call to `BN_sqr` 230. assert(b->top <= words); 231. if (b->top > 0) 232. memcpy(a, b->d, sizeof(*a) * b->top); ^ 233. 234. return a;
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_44333
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_prime.c:377: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set`. Showing all 27 steps of the trace crypto/bn/bn_prime.c:306:1: Parameter `ctx_passed->stack.depth` 304. } 305. 306. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 307. int do_trial_division, BN_GENCB *cb) 308. { crypto/bn/bn_prime.c:338:5: Call 336. else if ((ctx = BN_CTX_new()) == NULL) 337. goto err; 338. BN_CTX_start(ctx); ^ 339. 340. /* A := abs(a) */ 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_prime.c:377:10: Call 375. if (mont == NULL) 376. goto err; 377. if (!BN_MONT_CTX_set(mont, A, ctx)) ^ 378. goto err; 379. crypto/bn/bn_mont.c:349:1: Parameter `ctx->stack.depth` 347. } 348. 349. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 350. { 351. int ret = 0; crypto/bn/bn_mont.c:357:5: Call 355. return 0; 356. 357. BN_CTX_start(ctx); ^ 358. if ((Ri = BN_CTX_get(ctx)) == NULL) 359. goto err; 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_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 `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_MONT_CTX_set` 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_44334
int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[], BN_CTX *ctx) { int ret = 0; BIGNUM *u; if (!p[0]) return BN_zero(r); BN_CTX_start(ctx); if ((u = BN_CTX_get(ctx)) == NULL) goto err; if (!BN_zero(u)) goto err; if (!BN_set_bit(u, p[0] - 1)) goto err; ret = BN_GF2m_mod_exp_arr(r, a, u, p, ctx); bn_check_top(r); err: BN_CTX_end(ctx); return ret; } crypto/bn/bn_gf2m.c:864: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_GF2m_mod_sqrt_arr`. Showing all 6 steps of the trace crypto/bn/bn_gf2m.c:858:8: Call 856. unsigned int *arr=NULL, ret = 0; 857. if ((arr = (unsigned int *)OPENSSL_malloc(sizeof(unsigned int) * max)) == NULL) goto err; 858. ret = BN_GF2m_poly2arr(p, arr, max); ^ 859. if (!ret || ret > max) 860. { crypto/bn/bn_gf2m.c:983:1: Parameter `*p` 981. * number of coefficients that would be extracted if array was large enough. 982. */ 983. > int BN_GF2m_poly2arr(const BIGNUM *a, unsigned int p[], int max) 984. { 985. int i, j, k = 0; crypto/bn/bn_gf2m.c:864:8: Call 862. goto err; 863. } 864. ret = BN_GF2m_mod_sqrt_arr(r, a, arr, ctx); ^ 865. bn_check_top(r); 866. err: crypto/bn/bn_gf2m.c:824:1: <LHS trace> 822. * Uses exponentiation as in algorithm A.4.1 from IEEE P1363. 823. */ 824. > int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[], BN_CTX *ctx) 825. { 826. int ret = 0; crypto/bn/bn_gf2m.c:824:1: Parameter `*p` 822. * Uses exponentiation as in algorithm A.4.1 from IEEE P1363. 823. */ 824. > int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, const unsigned int p[], BN_CTX *ctx) 825. { 826. int ret = 0; crypto/bn/bn_gf2m.c:837:7: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_GF2m_mod_sqrt_arr` 835. 836. if (!BN_zero(u)) goto err; 837. if (!BN_set_bit(u, p[0] - 1)) goto err; ^ 838. ret = BN_GF2m_mod_exp_arr(r, a, u, p, ctx); 839. bn_check_top(r);
https://github.com/openssl/openssl/blob/6defae04f3c44087d9129994fa88b4f9271b153f/crypto/bn/bn_gf2m.c/#L837
d2a_code_trace_data_44335
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) { bn_check_top(b); if (a == b) return a; if (bn_wexpand(a, b->top) == NULL) return NULL; if (b->top > 0) memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); a->neg = b->neg; a->top = b->top; a->flags |= b->flags & BN_FLG_FIXED_TOP; bn_check_top(a); return a; } test/ectest.c:914: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `EC_POINTs_mul`. Showing all 16 steps of the trace test/ectest.c:827:13: Call 825. || !TEST_ptr(z = BN_new()) 826. || !TEST_ptr(yplusone = BN_new()) 827. || !TEST_true(BN_hex2bn(&p, test->p)) ^ 828. || !TEST_true(BN_hex2bn(&a, test->a)) 829. || !TEST_true(BN_hex2bn(&b, test->b)) crypto/bn/bn_print.c:126:1: Parameter `(*bn)->top` 124. } 125. 126. > int BN_hex2bn(BIGNUM **bn, const char *a) 127. { 128. BIGNUM *ret = NULL; test/ectest.c:914:14: Call 912. 913. /* z is still the group order */ 914. if (!TEST_true(EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx)) ^ 915. || !TEST_true(EC_POINTs_mul(group, R, z, 2, points, scalars, ctx)) 916. || !TEST_int_eq(0, EC_POINT_cmp(group, P, R, ctx)) crypto/ec/ec_lib.c:933:1: Parameter `(*scalars)->top` 931. */ 932. 933. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 934. size_t num, const EC_POINT *points[], 935. const BIGNUM *scalars[], BN_CTX *ctx) crypto/ec/ec_lib.c:965:15: Call 963. else 964. /* use default */ 965. ret = ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx); ^ 966. 967. BN_CTX_free(new_ctx); crypto/ec/ec_mult.c:410:1: Parameter `(*scalars)->top` 408. * in the addition if scalar != NULL 409. */ 410. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 411. size_t num, const EC_POINT *points[], const BIGNUM *scalars[], 412. BN_CTX *ctx) crypto/ec/ec_mult.c:463:20: Call 461. * actually set and we always call the ladder version. 462. */ 463. return ec_scalar_mul_ladder(group, r, scalars[0], points[0], ctx); ^ 464. } 465. } crypto/ec/ec_mult.c:139:1: Parameter `scalar->top` 137. * Returns 1 on success, 0 otherwise. 138. */ 139. > int ec_scalar_mul_ladder(const EC_GROUP *group, EC_POINT *r, 140. const BIGNUM *scalar, const EC_POINT *point, 141. BN_CTX *ctx) crypto/ec/ec_mult.c:215:10: Call 213. } 214. 215. if (!BN_copy(k, scalar)) { ^ 216. ECerr(EC_F_EC_SCALAR_MUL_LADDER, ERR_R_BN_LIB); 217. goto err; crypto/bn/bn_lib.c:281:1: <Offset trace> 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:281:1: Parameter `b->top` 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:281:1: <Length trace> 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:281:1: Parameter `*a->d` 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:287:9: Call 285. if (a == b) 286. return a; 287. if (bn_wexpand(a, b->top) == NULL) ^ 288. return NULL; 289. crypto/bn/bn_lib.c:962:1: Parameter `*a->d` 960. } 961. 962. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 963. { 964. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:291:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `EC_POINTs_mul` 289. 290. if (b->top > 0) 291. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); ^ 292. 293. a->neg = b->neg;
https://github.com/openssl/openssl/blob/3051bf2afab7ac8b7b9c64e68755d1addd2fb8ff/crypto/bn/bn_lib.c/#L291
d2a_code_trace_data_44336
static inline void skip_remaining(BitstreamContext *bc, unsigned n) { #ifdef BITSTREAM_READER_LE bc->bits >>= n; #else bc->bits <<= n; #endif bc->bits_left -= n; } libavcodec/alsdec.c:1067: error: Integer Overflow L2 ([-3, +oo] - 5):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:978:9: Call 976. ret = read_var_block_data(ctx, bd); 977. } else { 978. read_const_block_data(ctx, bd); ^ 979. } 980. libavcodec/alsdec.c:557:1: Parameter `ctx->bc.bits_left` 555. /** Read the block data for a constant block 556. */ 557. static void read_const_block_data(ALSDecContext *ctx, ALSBlockData *bd) ^ 558. { 559. ALSSpecificConfig *sconf = &ctx->sconf; libavcodec/alsdec.c:564:24: Call 562. 563. *bd->raw_samples = 0; 564. *bd->const_block = bitstream_read_bit(bc); // 1 = constant value, 0 = zero block (silence) ^ 565. bd->js_blocks = bitstream_read_bit(bc); 566. 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:565:24: Call 563. *bd->raw_samples = 0; 564. *bd->const_block = bitstream_read_bit(bc); // 1 = constant value, 0 = zero block (silence) 565. bd->js_blocks = bitstream_read_bit(bc); ^ 566. 567. // skip 5 reserved bits 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:568:5: Call 566. 567. // skip 5 reserved bits 568. bitstream_skip(bc, 5); ^ 569. 570. if (*bd->const_block) { libavcodec/bitstream.h:241:1: Parameter `n` 239. 240. /* Skip n bits in the buffer. */ 241. static inline void bitstream_skip(BitstreamContext *bc, unsigned n) ^ 242. { 243. if (n <= bc->bits_left) libavcodec/bitstream.h:244:9: Call 242. { 243. if (n <= bc->bits_left) 244. skip_remaining(bc, n); ^ 245. else { 246. n -= bc->bits_left; libavcodec/bitstream.h:230:1: <LHS trace> 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:230:1: Parameter `bc->bits_left` 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:230:1: <RHS trace> 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:230:1: Parameter `n` 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:237:5: Binary operation: ([-3, +oo] - 5):unsigned32 by call to `read_decode_block` 235. bc->bits <<= n; 236. #endif 237. bc->bits_left -= n; ^ 238. } 239.
https://github.com/libav/libav/blob/7ff018c1cb43a5fe5ee2049d325cdd785852067a/libavcodec/bitstream.h/#L237
d2a_code_trace_data_44337
static size_t asn1_put_uint64(unsigned char *b, uint64_t r) { if (r >= 0x100) { unsigned char *p; uint64_t rtmp = r; size_t i = 0; while (rtmp) { rtmp >>= 8; i++; } p = b + i - 1; do { *p-- = r & 0xFF; r >>= 8; } while (p >= b); return i; } b[0] = (unsigned char)r; return 1; } crypto/asn1/a_int.c:648: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: 8 by call to `asn1_put_uint64`. Showing all 5 steps of the trace crypto/asn1/a_int.c:643:1: Array declaration 641. } 642. 643. > int i2c_uint64_int(unsigned char *p, uint64_t r, int neg) 644. { 645. unsigned char buf[sizeof(uint64_t)]; crypto/asn1/a_int.c:648:14: Call 646. size_t buflen; 647. 648. buflen = asn1_put_uint64(buf, r); ^ 649. if (p == NULL) 650. return i2c_ibuf(buf, buflen, neg, NULL); crypto/asn1/a_int.c:243:1: <Length trace> 241. } 242. 243. > static size_t asn1_put_uint64(unsigned char *b, uint64_t r) 244. { 245. if (r >= 0x100) { crypto/asn1/a_int.c:243:1: Parameter `*b` 241. } 242. 243. > static size_t asn1_put_uint64(unsigned char *b, uint64_t r) 244. { 245. if (r >= 0x100) { crypto/asn1/a_int.c:260:13: Array access: Offset: [-1, +oo] Size: 8 by call to `asn1_put_uint64` 258. 259. do { 260. *p-- = r & 0xFF; ^ 261. r >>= 8; 262. } while (p >= b);
https://github.com/openssl/openssl/blob/8ac6a53100bd6730a8824968ec25dccc727c29c9/crypto/asn1/a_int.c/#L260
d2a_code_trace_data_44338
static int decode_mb_cabac(H264Context *h) { MpegEncContext * const s = &h->s; const int mb_xy= s->mb_x + s->mb_y*s->mb_stride; int mb_type, partition_count, cbp = 0; int dct8x8_allowed= h->pps.transform_8x8_mode; s->dsp.clear_blocks(h->mb); tprintf(s->avctx, "pic:%d mb:%d/%d\n", h->frame_num, s->mb_x, s->mb_y); if( h->slice_type != FF_I_TYPE && h->slice_type != FF_SI_TYPE ) { int skip; if( FRAME_MBAFF && s->mb_x==0 && (s->mb_y&1)==0 ) predict_field_decoding_flag(h); if( FRAME_MBAFF && (s->mb_y&1)==1 && h->prev_mb_skipped ) skip = h->next_mb_skipped; else skip = decode_cabac_mb_skip( h, s->mb_x, s->mb_y ); if( skip ) { if( FRAME_MBAFF && (s->mb_y&1)==0 ){ s->current_picture.mb_type[mb_xy] = MB_TYPE_SKIP; h->next_mb_skipped = decode_cabac_mb_skip( h, s->mb_x, s->mb_y+1 ); if(h->next_mb_skipped) predict_field_decoding_flag(h); else h->mb_mbaff = h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h); } decode_mb_skip(h); h->cbp_table[mb_xy] = 0; h->chroma_pred_mode_table[mb_xy] = 0; h->last_qscale_diff = 0; return 0; } } if(FRAME_MBAFF){ if( (s->mb_y&1) == 0 ) h->mb_mbaff = h->mb_field_decoding_flag = decode_cabac_field_decoding_flag(h); }else h->mb_field_decoding_flag= (s->picture_structure!=PICT_FRAME); h->prev_mb_skipped = 0; compute_mb_neighbors(h); if( ( mb_type = decode_cabac_mb_type( h ) ) < 0 ) { av_log( h->s.avctx, AV_LOG_ERROR, "decode_cabac_mb_type failed\n" ); return -1; } if( h->slice_type == FF_B_TYPE ) { if( mb_type < 23 ){ partition_count= b_mb_type_info[mb_type].partition_count; mb_type= b_mb_type_info[mb_type].type; }else{ mb_type -= 23; goto decode_intra_mb; } } else if( h->slice_type == FF_P_TYPE ) { if( mb_type < 5) { partition_count= p_mb_type_info[mb_type].partition_count; mb_type= p_mb_type_info[mb_type].type; } else { mb_type -= 5; goto decode_intra_mb; } } else { assert(h->slice_type == FF_I_TYPE); decode_intra_mb: partition_count = 0; cbp= i_mb_type_info[mb_type].cbp; h->intra16x16_pred_mode= i_mb_type_info[mb_type].pred_mode; mb_type= i_mb_type_info[mb_type].type; } if(MB_FIELD) mb_type |= MB_TYPE_INTERLACED; h->slice_table[ mb_xy ]= h->slice_num; if(IS_INTRA_PCM(mb_type)) { const uint8_t *ptr; unsigned int x, y; ptr= h->cabac.bytestream; if(h->cabac.low&0x1) ptr--; if(CABAC_BITS==16){ if(h->cabac.low&0x1FF) ptr--; } for(y=0; y<16; y++){ const int index= 4*(y&3) + 32*((y>>2)&1) + 128*(y>>3); for(x=0; x<16; x++){ tprintf(s->avctx, "LUMA ICPM LEVEL (%3d)\n", *ptr); h->mb[index + (x&3) + 16*((x>>2)&1) + 64*(x>>3)]= *ptr++; } } for(y=0; y<8; y++){ const int index= 256 + 4*(y&3) + 32*(y>>2); for(x=0; x<8; x++){ tprintf(s->avctx, "CHROMA U ICPM LEVEL (%3d)\n", *ptr); h->mb[index + (x&3) + 16*(x>>2)]= *ptr++; } } for(y=0; y<8; y++){ const int index= 256 + 64 + 4*(y&3) + 32*(y>>2); for(x=0; x<8; x++){ tprintf(s->avctx, "CHROMA V ICPM LEVEL (%3d)\n", *ptr); h->mb[index + (x&3) + 16*(x>>2)]= *ptr++; } } ff_init_cabac_decoder(&h->cabac, ptr, h->cabac.bytestream_end - ptr); h->cbp_table[mb_xy] = 0x1ef; h->chroma_pred_mode_table[mb_xy] = 0; s->current_picture.qscale_table[mb_xy]= 0; h->chroma_qp[0] = get_chroma_qp(h, 0, 0); h->chroma_qp[1] = get_chroma_qp(h, 1, 0); memset(h->non_zero_count[mb_xy], 16, 16); s->current_picture.mb_type[mb_xy]= mb_type; return 0; } if(MB_MBAFF){ h->ref_count[0] <<= 1; h->ref_count[1] <<= 1; } fill_caches(h, mb_type, 0); if( IS_INTRA( mb_type ) ) { int i, pred_mode; if( IS_INTRA4x4( mb_type ) ) { if( dct8x8_allowed && decode_cabac_mb_transform_size( h ) ) { mb_type |= MB_TYPE_8x8DCT; for( i = 0; i < 16; i+=4 ) { int pred = pred_intra_mode( h, i ); int mode = decode_cabac_mb_intra4x4_pred_mode( h, pred ); fill_rectangle( &h->intra4x4_pred_mode_cache[ scan8[i] ], 2, 2, 8, mode, 1 ); } } else { for( i = 0; i < 16; i++ ) { int pred = pred_intra_mode( h, i ); h->intra4x4_pred_mode_cache[ scan8[i] ] = decode_cabac_mb_intra4x4_pred_mode( h, pred ); } } write_back_intra_pred_mode(h); if( check_intra4x4_pred_mode(h) < 0 ) return -1; } else { h->intra16x16_pred_mode= check_intra_pred_mode( h, h->intra16x16_pred_mode ); if( h->intra16x16_pred_mode < 0 ) return -1; } h->chroma_pred_mode_table[mb_xy] = pred_mode = decode_cabac_mb_chroma_pre_mode( h ); pred_mode= check_intra_pred_mode( h, pred_mode ); if( pred_mode < 0 ) return -1; h->chroma_pred_mode= pred_mode; } else if( partition_count == 4 ) { int i, j, sub_partition_count[4], list, ref[2][4]; if( h->slice_type == FF_B_TYPE ) { for( i = 0; i < 4; i++ ) { h->sub_mb_type[i] = decode_cabac_b_mb_sub_type( h ); sub_partition_count[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= b_sub_mb_type_info[ h->sub_mb_type[i] ].type; } if( IS_DIRECT(h->sub_mb_type[0] | h->sub_mb_type[1] | h->sub_mb_type[2] | h->sub_mb_type[3]) ) { pred_direct_motion(h, &mb_type); h->ref_cache[0][scan8[4]] = h->ref_cache[1][scan8[4]] = h->ref_cache[0][scan8[12]] = h->ref_cache[1][scan8[12]] = PART_NOT_AVAILABLE; if( h->ref_count[0] > 1 || h->ref_count[1] > 1 ) { for( i = 0; i < 4; i++ ) if( IS_DIRECT(h->sub_mb_type[i]) ) fill_rectangle( &h->direct_cache[scan8[4*i]], 2, 2, 8, 1, 1 ); } } } else { for( i = 0; i < 4; i++ ) { h->sub_mb_type[i] = decode_cabac_p_mb_sub_type( h ); sub_partition_count[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].partition_count; h->sub_mb_type[i]= p_sub_mb_type_info[ h->sub_mb_type[i] ].type; } } for( list = 0; list < h->list_count; list++ ) { for( i = 0; i < 4; i++ ) { if(IS_DIRECT(h->sub_mb_type[i])) continue; if(IS_DIR(h->sub_mb_type[i], 0, list)){ if( h->ref_count[list] > 1 ) ref[list][i] = decode_cabac_mb_ref( h, list, 4*i ); else ref[list][i] = 0; } else { ref[list][i] = -1; } h->ref_cache[list][ scan8[4*i]+1 ]= h->ref_cache[list][ scan8[4*i]+8 ]=h->ref_cache[list][ scan8[4*i]+9 ]= ref[list][i]; } } if(dct8x8_allowed) dct8x8_allowed = get_dct8x8_allowed(h); for(list=0; list<h->list_count; list++){ for(i=0; i<4; i++){ h->ref_cache[list][ scan8[4*i] ]=h->ref_cache[list][ scan8[4*i]+1 ]; if(IS_DIRECT(h->sub_mb_type[i])){ fill_rectangle(h->mvd_cache[list][scan8[4*i]], 2, 2, 8, 0, 4); continue; } if(IS_DIR(h->sub_mb_type[i], 0, list) && !IS_DIRECT(h->sub_mb_type[i])){ const int sub_mb_type= h->sub_mb_type[i]; const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1; for(j=0; j<sub_partition_count[i]; j++){ int mpx, mpy; int mx, my; const int index= 4*i + block_width*j; int16_t (* mv_cache)[2]= &h->mv_cache[list][ scan8[index] ]; int16_t (* mvd_cache)[2]= &h->mvd_cache[list][ scan8[index] ]; pred_motion(h, index, block_width, list, h->ref_cache[list][ scan8[index] ], &mpx, &mpy); mx = mpx + decode_cabac_mb_mvd( h, list, index, 0 ); my = mpy + decode_cabac_mb_mvd( h, list, index, 1 ); tprintf(s->avctx, "final mv:%d %d\n", mx, my); if(IS_SUB_8X8(sub_mb_type)){ mv_cache[ 1 ][0]= mv_cache[ 8 ][0]= mv_cache[ 9 ][0]= mx; mv_cache[ 1 ][1]= mv_cache[ 8 ][1]= mv_cache[ 9 ][1]= my; mvd_cache[ 1 ][0]= mvd_cache[ 8 ][0]= mvd_cache[ 9 ][0]= mx - mpx; mvd_cache[ 1 ][1]= mvd_cache[ 8 ][1]= mvd_cache[ 9 ][1]= my - mpy; }else if(IS_SUB_8X4(sub_mb_type)){ mv_cache[ 1 ][0]= mx; mv_cache[ 1 ][1]= my; mvd_cache[ 1 ][0]= mx - mpx; mvd_cache[ 1 ][1]= my - mpy; }else if(IS_SUB_4X8(sub_mb_type)){ mv_cache[ 8 ][0]= mx; mv_cache[ 8 ][1]= my; mvd_cache[ 8 ][0]= mx - mpx; mvd_cache[ 8 ][1]= my - mpy; } mv_cache[ 0 ][0]= mx; mv_cache[ 0 ][1]= my; mvd_cache[ 0 ][0]= mx - mpx; mvd_cache[ 0 ][1]= my - mpy; } }else{ uint32_t *p= (uint32_t *)&h->mv_cache[list][ scan8[4*i] ][0]; uint32_t *pd= (uint32_t *)&h->mvd_cache[list][ scan8[4*i] ][0]; p[0] = p[1] = p[8] = p[9] = 0; pd[0]= pd[1]= pd[8]= pd[9]= 0; } } } } else if( IS_DIRECT(mb_type) ) { pred_direct_motion(h, &mb_type); fill_rectangle(h->mvd_cache[0][scan8[0]], 4, 4, 8, 0, 4); fill_rectangle(h->mvd_cache[1][scan8[0]], 4, 4, 8, 0, 4); dct8x8_allowed &= h->sps.direct_8x8_inference_flag; } else { int list, mx, my, i, mpx, mpy; if(IS_16X16(mb_type)){ for(list=0; list<h->list_count; list++){ if(IS_DIR(mb_type, 0, list)){ const int ref = h->ref_count[list] > 1 ? decode_cabac_mb_ref( h, list, 0 ) : 0; fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, ref, 1); }else fill_rectangle(&h->ref_cache[list][ scan8[0] ], 4, 4, 8, (uint8_t)LIST_NOT_USED, 1); } for(list=0; list<h->list_count; list++){ if(IS_DIR(mb_type, 0, list)){ pred_motion(h, 0, 4, list, h->ref_cache[list][ scan8[0] ], &mpx, &mpy); mx = mpx + decode_cabac_mb_mvd( h, list, 0, 0 ); my = mpy + decode_cabac_mb_mvd( h, list, 0, 1 ); tprintf(s->avctx, "final mv:%d %d\n", mx, my); fill_rectangle(h->mvd_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx-mpx,my-mpy), 4); fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, pack16to32(mx,my), 4); }else fill_rectangle(h->mv_cache[list][ scan8[0] ], 4, 4, 8, 0, 4); } } else if(IS_16X8(mb_type)){ for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ const int ref= h->ref_count[list] > 1 ? decode_cabac_mb_ref( h, list, 8*i ) : 0; fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, ref, 1); }else fill_rectangle(&h->ref_cache[list][ scan8[0] + 16*i ], 4, 2, 8, (LIST_NOT_USED&0xFF), 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ pred_16x8_motion(h, 8*i, list, h->ref_cache[list][scan8[0] + 16*i], &mpx, &mpy); mx = mpx + decode_cabac_mb_mvd( h, list, 8*i, 0 ); my = mpy + decode_cabac_mb_mvd( h, list, 8*i, 1 ); tprintf(s->avctx, "final mv:%d %d\n", mx, my); fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack16to32(mx-mpx,my-mpy), 4); fill_rectangle(h->mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, pack16to32(mx,my), 4); }else{ fill_rectangle(h->mvd_cache[list][ scan8[0] + 16*i ], 4, 2, 8, 0, 4); fill_rectangle(h-> mv_cache[list][ scan8[0] + 16*i ], 4, 2, 8, 0, 4); } } } }else{ assert(IS_8X16(mb_type)); for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ const int ref= h->ref_count[list] > 1 ? decode_cabac_mb_ref( h, list, 4*i ) : 0; fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, ref, 1); }else fill_rectangle(&h->ref_cache[list][ scan8[0] + 2*i ], 2, 4, 8, (LIST_NOT_USED&0xFF), 1); } } for(list=0; list<h->list_count; list++){ for(i=0; i<2; i++){ if(IS_DIR(mb_type, i, list)){ pred_8x16_motion(h, i*4, list, h->ref_cache[list][ scan8[0] + 2*i ], &mpx, &mpy); mx = mpx + decode_cabac_mb_mvd( h, list, 4*i, 0 ); my = mpy + decode_cabac_mb_mvd( h, list, 4*i, 1 ); tprintf(s->avctx, "final mv:%d %d\n", mx, my); fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack16to32(mx-mpx,my-mpy), 4); fill_rectangle(h->mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, pack16to32(mx,my), 4); }else{ fill_rectangle(h->mvd_cache[list][ scan8[0] + 2*i ], 2, 4, 8, 0, 4); fill_rectangle(h-> mv_cache[list][ scan8[0] + 2*i ], 2, 4, 8, 0, 4); } } } } } if( IS_INTER( mb_type ) ) { h->chroma_pred_mode_table[mb_xy] = 0; write_back_motion( h, mb_type ); } if( !IS_INTRA16x16( mb_type ) ) { cbp = decode_cabac_mb_cbp_luma( h ); cbp |= decode_cabac_mb_cbp_chroma( h ) << 4; } h->cbp_table[mb_xy] = h->cbp = cbp; if( dct8x8_allowed && (cbp&15) && !IS_INTRA( mb_type ) ) { if( decode_cabac_mb_transform_size( h ) ) mb_type |= MB_TYPE_8x8DCT; } s->current_picture.mb_type[mb_xy]= mb_type; if( cbp || IS_INTRA16x16( mb_type ) ) { const uint8_t *scan, *scan8x8, *dc_scan; const uint32_t *qmul; int dqp; if(IS_INTERLACED(mb_type)){ scan8x8= s->qscale ? h->field_scan8x8 : h->field_scan8x8_q0; scan= s->qscale ? h->field_scan : h->field_scan_q0; dc_scan= luma_dc_field_scan; }else{ scan8x8= s->qscale ? h->zigzag_scan8x8 : h->zigzag_scan8x8_q0; scan= s->qscale ? h->zigzag_scan : h->zigzag_scan_q0; dc_scan= luma_dc_zigzag_scan; } h->last_qscale_diff = dqp = decode_cabac_mb_dqp( h ); if( dqp == INT_MIN ){ av_log(h->s.avctx, AV_LOG_ERROR, "cabac decode of qscale diff failed at %d %d\n", s->mb_x, s->mb_y); return -1; } s->qscale += dqp; if(((unsigned)s->qscale) > 51){ if(s->qscale<0) s->qscale+= 52; else s->qscale-= 52; } h->chroma_qp[0] = get_chroma_qp(h, 0, s->qscale); h->chroma_qp[1] = get_chroma_qp(h, 1, s->qscale); if( IS_INTRA16x16( mb_type ) ) { int i; decode_cabac_residual( h, h->mb, 0, 0, dc_scan, NULL, 16); if( cbp&15 ) { qmul = h->dequant4_coeff[0][s->qscale]; for( i = 0; i < 16; i++ ) { decode_cabac_residual(h, h->mb + 16*i, 1, i, scan + 1, qmul, 15); } } else { fill_rectangle(&h->non_zero_count_cache[scan8[0]], 4, 4, 8, 0, 1); } } else { int i8x8, i4x4; for( i8x8 = 0; i8x8 < 4; i8x8++ ) { if( cbp & (1<<i8x8) ) { if( IS_8x8DCT(mb_type) ) { decode_cabac_residual(h, h->mb + 64*i8x8, 5, 4*i8x8, scan8x8, h->dequant8_coeff[IS_INTRA( mb_type ) ? 0:1][s->qscale], 64); } else { qmul = h->dequant4_coeff[IS_INTRA( mb_type ) ? 0:3][s->qscale]; for( i4x4 = 0; i4x4 < 4; i4x4++ ) { const int index = 4*i8x8 + i4x4; decode_cabac_residual(h, h->mb + 16*index, 2, index, scan, qmul, 16); } } } else { uint8_t * const nnz= &h->non_zero_count_cache[ scan8[4*i8x8] ]; nnz[0] = nnz[1] = nnz[8] = nnz[9] = 0; } } } if( cbp&0x30 ){ int c; for( c = 0; c < 2; c++ ) { decode_cabac_residual(h, h->mb + 256 + 16*4*c, 3, c, chroma_dc_scan, NULL, 4); } } if( cbp&0x20 ) { int c, i; for( c = 0; c < 2; c++ ) { qmul = h->dequant4_coeff[c+1+(IS_INTRA( mb_type ) ? 0:3)][h->chroma_qp[c]]; for( i = 0; i < 4; i++ ) { const int index = 16 + 4 * c + i; decode_cabac_residual(h, h->mb + 16*index, 4, index - 16, scan + 1, qmul, 15); } } } else { uint8_t * const nnz= &h->non_zero_count_cache[0]; nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] = nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0; } } else { uint8_t * const nnz= &h->non_zero_count_cache[0]; fill_rectangle(&nnz[scan8[0]], 4, 4, 8, 0, 1); nnz[ scan8[16]+0 ] = nnz[ scan8[16]+1 ] =nnz[ scan8[16]+8 ] =nnz[ scan8[16]+9 ] = nnz[ scan8[20]+0 ] = nnz[ scan8[20]+1 ] =nnz[ scan8[20]+8 ] =nnz[ scan8[20]+9 ] = 0; h->last_qscale_diff = 0; } s->current_picture.qscale_table[mb_xy]= s->qscale; write_back_non_zero_count(h); if(MB_MBAFF){ h->ref_count[0] >>= 1; h->ref_count[1] >>= 1; } return 0; } libavcodec/h264.c:5808: error: Uninitialized Value The value read from sub_partition_count[_] was never initialized. libavcodec/h264.c:5808:30: 5806. const int sub_mb_type= h->sub_mb_type[i]; 5807. const int block_width= (sub_mb_type & (MB_TYPE_16x16|MB_TYPE_16x8)) ? 2 : 1; 5808. for(j=0; j<sub_partition_count[i]; j++){ ^ 5809. int mpx, mpy; 5810. int mx, my;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L5808
d2a_code_trace_data_44339
static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, OPENSSL_LH_DOALL_FUNC func, OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) { int i; OPENSSL_LH_NODE *a, *n; if (lh == NULL) return; for (i = lh->num_nodes - 1; i >= 0; i--) { a = lh->b[i]; while (a != NULL) { n = a->next; if (use_arg) func_arg(a->data, arg); else func(a->data); a = n; } } } test/sslapitest.c:2552: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `SSL_free`. Showing all 17 steps of the trace test/sslapitest.c:2467:10: Call 2465. } 2466. 2467. if (!create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL, NULL)) { ^ 2468. printf("Unable to create SSL objects\n"); 2469. goto end; test/ssltestlib.c:580:21: Call 578. 579. if (*sssl == NULL) 580. serverssl = SSL_new(serverctx); ^ 581. else 582. serverssl = *sssl; ssl/ssl_lib.c:521:1: Parameter `ctx->sessions->num_nodes` 519. } 520. 521. > SSL *SSL_new(SSL_CTX *ctx) 522. { 523. SSL *s; test/sslapitest.c:2552:5: Call 2550. end: 2551. SSL_SESSION_free(sess); 2552. SSL_free(serverssl); ^ 2553. SSL_free(clientssl); 2554. SSL_CTX_free(sctx); ssl/ssl_lib.c:963:1: Parameter `s->ctx->sessions->num_nodes` 961. } 962. 963. > void SSL_free(SSL *s) 964. { 965. int i; ssl/ssl_lib.c:1030:5: Call 1028. RECORD_LAYER_release(&s->rlayer); 1029. 1030. SSL_CTX_free(s->ctx); ^ 1031. 1032. ASYNC_WAIT_CTX_free(s->waitctx); ssl/ssl_lib.c:2780:1: Parameter `a->sessions->num_nodes` 2778. } 2779. 2780. > void SSL_CTX_free(SSL_CTX *a) 2781. { 2782. int i; ssl/ssl_lib.c:2806:9: Call 2804. */ 2805. if (a->sessions != NULL) 2806. SSL_CTX_flush_sessions(a, 0); ^ 2807. 2808. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:1021:1: Parameter `s->sessions->num_nodes` 1019. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1020. 1021. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 1022. { 1023. unsigned long i; ssl/ssl_sess.c:1034:5: Call 1032. i = lh_SSL_SESSION_get_down_load(s->sessions); 1033. lh_SSL_SESSION_set_down_load(s->sessions, 0); 1034. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp); ^ 1035. lh_SSL_SESSION_set_down_load(s->sessions, i); 1036. CRYPTO_THREAD_unlock(s->lock); ssl/ssl_sess.c:1019:1: Parameter `lh->num_nodes` 1017. } 1018. 1019. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1020. 1021. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) ssl/ssl_sess.c:1019:1: Call 1017. } 1018. 1019. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1020. 1021. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) crypto/lhash/lhash.c:182:1: Parameter `lh->num_nodes` 180. } 181. 182. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); crypto/lhash/lhash.c:184:5: Call 182. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); ^ 185. } 186. crypto/lhash/lhash.c:150:1: <LHS trace> 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:150:1: Parameter `lh->num_nodes` 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:164:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `SSL_free` 162. * memory leaks otherwise 163. */ 164. for (i = lh->num_nodes - 1; i >= 0; i--) { ^ 165. a = lh->b[i]; 166. while (a != NULL) {
https://github.com/openssl/openssl/blob/e128f891de71bbdba8391355af8d6d47d20b1969/crypto/lhash/lhash.c/#L164
d2a_code_trace_data_44340
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:3582: error: Null Dereference pointer `st` last assigned on line 3576 could be null and is dereferenced at line 3582, column 16. ffmpeg.c:3569:1: start of procedure new_data_stream() 3567. } 3568. 3569. static void new_data_stream(AVFormatContext *oc, int file_idx) ^ 3570. { 3571. AVStream *st; ffmpeg.c:3573:5: 3571. AVStream *st; 3572. AVOutputStream *ost; 3573. AVCodec *codec=NULL; ^ 3574. AVCodecContext *data_enc; 3575. ffmpeg.c:3576:28: Condition is true 3574. AVCodecContext *data_enc; 3575. 3576. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); ^ 3577. if (!st) { 3578. fprintf(stderr, "Could not alloc stream\n"); ffmpeg.c:3576:5: 3574. AVCodecContext *data_enc; 3575. 3576. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); ^ 3577. if (!st) { 3578. fprintf(stderr, "Could not alloc stream\n"); libavformat/utils.c:2586:1: start of procedure av_new_stream() 2584. } 2585. 2586. AVStream *av_new_stream(AVFormatContext *s, int id) ^ 2587. { 2588. AVStream *st; libavformat/utils.c:2592:9: Taking true branch 2590. AVStream **streams; 2591. 2592. if (s->nb_streams >= INT_MAX/sizeof(*streams)) ^ 2593. return NULL; 2594. streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams)); libavformat/utils.c:2593:9: 2591. 2592. if (s->nb_streams >= INT_MAX/sizeof(*streams)) 2593. return NULL; ^ 2594. streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams)); 2595. if (!streams) libavformat/utils.c:2635:1: return from a call to av_new_stream 2633. s->streams[s->nb_streams++] = st; 2634. return st; 2635. } ^ 2636. 2637. AVProgram *av_new_program(AVFormatContext *ac, int id) ffmpeg.c:3577:10: Taking true branch 3575. 3576. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); 3577. if (!st) { ^ 3578. fprintf(stderr, "Could not alloc stream\n"); 3579. ffmpeg_exit(1); ffmpeg.c:3578:9: 3576. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); 3577. if (!st) { 3578. fprintf(stderr, "Could not alloc stream\n"); ^ 3579. ffmpeg_exit(1); 3580. } ffmpeg.c:3579:9: Skipping ffmpeg_exit(): empty list of specs 3577. if (!st) { 3578. fprintf(stderr, "Could not alloc stream\n"); 3579. ffmpeg_exit(1); ^ 3580. } 3581. ost = new_output_stream(oc, file_idx); ffmpeg.c:3581:5: Skipping new_output_stream(): empty list of specs 3579. ffmpeg_exit(1); 3580. } 3581. ost = new_output_stream(oc, file_idx); ^ 3582. data_enc = st->codec; 3583. output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); ffmpeg.c:3582:5: 3580. } 3581. ost = new_output_stream(oc, file_idx); 3582. data_enc = st->codec; ^ 3583. output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); 3584. if (!data_stream_copy) {
https://github.com/libav/libav/blob/d0005d347d0831c904630fe70408c9fd4eec18e8/ffmpeg.c/#L3582
d2a_code_trace_data_44341
static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt, int *al) { #ifndef OPENSSL_NO_RSA unsigned char *encdata = NULL; EVP_PKEY *pkey = NULL; EVP_PKEY_CTX *pctx = NULL; size_t enclen; unsigned char *pms = NULL; size_t pmslen = 0; if (s->session->peer == NULL) { SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); return 0; } pkey = X509_get0_pubkey(s->session->peer); if (EVP_PKEY_get0_RSA(pkey) == NULL) { SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); return 0; } pmslen = SSL_MAX_MASTER_KEY_LENGTH; pms = OPENSSL_malloc(pmslen); if (pms == NULL) { SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_MALLOC_FAILURE); *al = SSL_AD_INTERNAL_ERROR; return 0; } pms[0] = s->client_version >> 8; pms[1] = s->client_version & 0xff; if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) { goto err; } if (s->version > SSL3_VERSION && !WPACKET_start_sub_packet_u16(pkt)) { SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); goto err; } pctx = EVP_PKEY_CTX_new(pkey, NULL); if (pctx == NULL || EVP_PKEY_encrypt_init(pctx) <= 0 || EVP_PKEY_encrypt(pctx, NULL, &enclen, pms, pmslen) <= 0) { SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_EVP_LIB); goto err; } if (!WPACKET_allocate_bytes(pkt, enclen, &encdata) || EVP_PKEY_encrypt(pctx, encdata, &enclen, pms, pmslen) <= 0) { SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, SSL_R_BAD_RSA_ENCRYPT); goto err; } EVP_PKEY_CTX_free(pctx); pctx = NULL; # ifdef PKCS1_CHECK if (s->options & SSL_OP_PKCS1_CHECK_1) (*p)[1]++; if (s->options & SSL_OP_PKCS1_CHECK_2) tmp_buf[0] = 0x70; # endif if (s->version > SSL3_VERSION && !WPACKET_close(pkt)) { SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); goto err; } s->s3->tmp.pms = pms; s->s3->tmp.pmslen = pmslen; return 1; err: OPENSSL_clear_free(pms, pmslen); EVP_PKEY_CTX_free(pctx); return 0; #else SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); *al = SSL_AD_INTERNAL_ERROR; return 0; #endif } ssl/statem/statem_clnt.c:2389: error: NULL_DEREFERENCE pointer `pkey` last assigned on line 2388 could be null and is dereferenced by call to `EVP_PKEY_get0_RSA()` at line 2389, column 9. Showing all 30 steps of the trace ssl/statem/statem_clnt.c:2370:1: start of procedure tls_construct_cke_rsa() 2368. } 2369. 2370. > static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt, int *al) 2371. { 2372. #ifndef OPENSSL_NO_RSA ssl/statem/statem_clnt.c:2373:5: 2371. { 2372. #ifndef OPENSSL_NO_RSA 2373. > unsigned char *encdata = NULL; 2374. EVP_PKEY *pkey = NULL; 2375. EVP_PKEY_CTX *pctx = NULL; ssl/statem/statem_clnt.c:2374:5: 2372. #ifndef OPENSSL_NO_RSA 2373. unsigned char *encdata = NULL; 2374. > EVP_PKEY *pkey = NULL; 2375. EVP_PKEY_CTX *pctx = NULL; 2376. size_t enclen; ssl/statem/statem_clnt.c:2375:5: 2373. unsigned char *encdata = NULL; 2374. EVP_PKEY *pkey = NULL; 2375. > EVP_PKEY_CTX *pctx = NULL; 2376. size_t enclen; 2377. unsigned char *pms = NULL; ssl/statem/statem_clnt.c:2377:5: 2375. EVP_PKEY_CTX *pctx = NULL; 2376. size_t enclen; 2377. > unsigned char *pms = NULL; 2378. size_t pmslen = 0; 2379. ssl/statem/statem_clnt.c:2378:5: 2376. size_t enclen; 2377. unsigned char *pms = NULL; 2378. > size_t pmslen = 0; 2379. 2380. if (s->session->peer == NULL) { ssl/statem/statem_clnt.c:2380:9: Taking false branch 2378. size_t pmslen = 0; 2379. 2380. if (s->session->peer == NULL) { ^ 2381. /* 2382. * We should always have a server certificate with SSL_kRSA. ssl/statem/statem_clnt.c:2388:5: 2386. } 2387. 2388. > pkey = X509_get0_pubkey(s->session->peer); 2389. if (EVP_PKEY_get0_RSA(pkey) == NULL) { 2390. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); crypto/x509/x509_cmp.c:265:1: start of procedure X509_get0_pubkey() 263. } 264. 265. > EVP_PKEY *X509_get0_pubkey(const X509 *x) 266. { 267. if (x == NULL) crypto/x509/x509_cmp.c:267:9: Taking false branch 265. EVP_PKEY *X509_get0_pubkey(const X509 *x) 266. { 267. if (x == NULL) ^ 268. return NULL; 269. return X509_PUBKEY_get0(x->cert_info.key); crypto/x509/x509_cmp.c:269:5: 267. if (x == NULL) 268. return NULL; 269. > return X509_PUBKEY_get0(x->cert_info.key); 270. } 271. crypto/x509/x_pubkey.c:140:1: start of procedure X509_PUBKEY_get0() 138. } 139. 140. > EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key) 141. { 142. EVP_PKEY *ret = NULL; crypto/x509/x_pubkey.c:142:5: 140. EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key) 141. { 142. > EVP_PKEY *ret = NULL; 143. 144. if (key == NULL || key->public_key == NULL) crypto/x509/x_pubkey.c:144:9: Taking false branch 142. EVP_PKEY *ret = NULL; 143. 144. if (key == NULL || key->public_key == NULL) ^ 145. return NULL; 146. crypto/x509/x_pubkey.c:144:24: Taking false branch 142. EVP_PKEY *ret = NULL; 143. 144. if (key == NULL || key->public_key == NULL) ^ 145. return NULL; 146. crypto/x509/x_pubkey.c:147:9: Taking false branch 145. return NULL; 146. 147. if (key->pkey != NULL) ^ 148. return key->pkey; 149. crypto/x509/x_pubkey.c:158:5: 156. * in the queue. 157. */ 158. > x509_pubkey_decode(&ret, key); 159. /* If decode doesn't fail something bad happened */ 160. if (ret != NULL) { crypto/x509/x_pubkey.c:103:1: start of procedure x509_pubkey_decode() 101. 102. 103. > static int x509_pubkey_decode(EVP_PKEY **ppkey, X509_PUBKEY *key) 104. { 105. EVP_PKEY *pkey = EVP_PKEY_new(); crypto/x509/x_pubkey.c:105:5: Skipping EVP_PKEY_new(): empty list of specs 103. static int x509_pubkey_decode(EVP_PKEY **ppkey, X509_PUBKEY *key) 104. { 105. EVP_PKEY *pkey = EVP_PKEY_new(); ^ 106. 107. if (pkey == NULL) { crypto/x509/x_pubkey.c:107:9: Taking true branch 105. EVP_PKEY *pkey = EVP_PKEY_new(); 106. 107. if (pkey == NULL) { ^ 108. X509err(X509_F_X509_PUBKEY_DECODE, ERR_R_MALLOC_FAILURE); 109. return -1; crypto/x509/x_pubkey.c:108:9: Skipping ERR_put_error(): empty list of specs 106. 107. if (pkey == NULL) { 108. X509err(X509_F_X509_PUBKEY_DECODE, ERR_R_MALLOC_FAILURE); ^ 109. return -1; 110. } crypto/x509/x_pubkey.c:109:9: 107. if (pkey == NULL) { 108. X509err(X509_F_X509_PUBKEY_DECODE, ERR_R_MALLOC_FAILURE); 109. > return -1; 110. } 111. crypto/x509/x_pubkey.c:138:1: return from a call to x509_pubkey_decode 136. EVP_PKEY_free(pkey); 137. return 0; 138. > } 139. 140. EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key) crypto/x509/x_pubkey.c:160:9: Taking false branch 158. x509_pubkey_decode(&ret, key); 159. /* If decode doesn't fail something bad happened */ 160. if (ret != NULL) { ^ 161. X509err(X509_F_X509_PUBKEY_GET0, ERR_R_INTERNAL_ERROR); 162. EVP_PKEY_free(ret); crypto/x509/x_pubkey.c:165:5: 163. } 164. 165. > return NULL; 166. } 167. crypto/x509/x_pubkey.c:166:1: return from a call to X509_PUBKEY_get0 164. 165. return NULL; 166. > } 167. 168. EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) crypto/x509/x509_cmp.c:270:1: return from a call to X509_get0_pubkey 268. return NULL; 269. return X509_PUBKEY_get0(x->cert_info.key); 270. > } 271. 272. EVP_PKEY *X509_get_pubkey(X509 *x) ssl/statem/statem_clnt.c:2389:9: 2387. 2388. pkey = X509_get0_pubkey(s->session->peer); 2389. > if (EVP_PKEY_get0_RSA(pkey) == NULL) { 2390. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR); 2391. return 0; crypto/evp/p_lib.c:261:1: start of procedure EVP_PKEY_get0_RSA() 259. } 260. 261. > RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey) 262. { 263. if (pkey->type != EVP_PKEY_RSA) { crypto/evp/p_lib.c:263:9: 261. RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey) 262. { 263. > if (pkey->type != EVP_PKEY_RSA) { 264. EVPerr(EVP_F_EVP_PKEY_GET0_RSA, EVP_R_EXPECTING_AN_RSA_KEY); 265. return NULL;
https://github.com/openssl/openssl/blob/f7a39a5a3f7f91e0d1ba0030323eef26bc8ccddf/ssl/statem/statem_clnt.c/#L2389
d2a_code_trace_data_44342
int RAND_status(void) { const RAND_METHOD *meth = RAND_get_rand_method(); if (meth->status != NULL) return meth->status(); return 0; } crypto/rand/rand_lib.c:852: error: NULL_DEREFERENCE pointer `meth` last assigned on line 850 could be null and is dereferenced at line 852, column 9. Showing all 14 steps of the trace crypto/rand/rand_lib.c:848:1: start of procedure RAND_status() 846. #endif 847. 848. > int RAND_status(void) 849. { 850. const RAND_METHOD *meth = RAND_get_rand_method(); crypto/rand/rand_lib.c:850:5: 848. int RAND_status(void) 849. { 850. > const RAND_METHOD *meth = RAND_get_rand_method(); 851. 852. if (meth->status != NULL) crypto/rand/rand_lib.c:733:1: start of procedure RAND_get_rand_method() 731. } 732. 733. > const RAND_METHOD *RAND_get_rand_method(void) 734. { 735. const RAND_METHOD *tmp_meth = NULL; crypto/rand/rand_lib.c:735:5: 733. const RAND_METHOD *RAND_get_rand_method(void) 734. { 735. > const RAND_METHOD *tmp_meth = NULL; 736. 737. if (!RUN_ONCE(&rand_init, do_rand_init)) crypto/rand/rand_lib.c:737:10: 735. const RAND_METHOD *tmp_meth = NULL; 736. 737. > if (!RUN_ONCE(&rand_init, do_rand_init)) 738. return NULL; 739. crypto/threads_pthread.c:111:1: start of procedure CRYPTO_THREAD_run_once() 109. } 110. 111. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 112. { 113. if (pthread_once(once, init) != 0) crypto/threads_pthread.c:113:9: Taking true branch 111. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 112. { 113. if (pthread_once(once, init) != 0) ^ 114. return 0; 115. crypto/threads_pthread.c:114:9: 112. { 113. if (pthread_once(once, init) != 0) 114. > return 0; 115. 116. return 1; crypto/threads_pthread.c:117:1: return from a call to CRYPTO_THREAD_run_once 115. 116. return 1; 117. > } 118. 119. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)) crypto/rand/rand_lib.c:737:10: Condition is false 735. const RAND_METHOD *tmp_meth = NULL; 736. 737. if (!RUN_ONCE(&rand_init, do_rand_init)) ^ 738. return NULL; 739. crypto/rand/rand_lib.c:737:10: Taking true branch 735. const RAND_METHOD *tmp_meth = NULL; 736. 737. if (!RUN_ONCE(&rand_init, do_rand_init)) ^ 738. return NULL; 739. crypto/rand/rand_lib.c:738:9: 736. 737. if (!RUN_ONCE(&rand_init, do_rand_init)) 738. > return NULL; 739. 740. CRYPTO_THREAD_write_lock(rand_meth_lock); crypto/rand/rand_lib.c:761:1: return from a call to RAND_get_rand_method 759. CRYPTO_THREAD_unlock(rand_meth_lock); 760. return tmp_meth; 761. > } 762. 763. #ifndef OPENSSL_NO_ENGINE crypto/rand/rand_lib.c:852:9: 850. const RAND_METHOD *meth = RAND_get_rand_method(); 851. 852. > if (meth->status != NULL) 853. return meth->status(); 854. return 0;
https://github.com/openssl/openssl/blob/1901516a4ba909fff12e0e7815aa2d499f4d6d67/crypto/rand/rand_lib.c/#L852
d2a_code_trace_data_44343
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ec_lib.c:1081: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set`. Showing all 24 steps of the trace crypto/ec/ec_lib.c:1081:10: Call 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/bn/bn_mont.c:349:1: Parameter `ctx->stack.depth` 347. } 348. 349. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 350. { 351. int ret = 0; crypto/bn/bn_mont.c:357:5: Call 355. return 0; 356. 357. BN_CTX_start(ctx); ^ 358. if ((Ri = BN_CTX_get(ctx)) == NULL) 359. goto err; 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_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 `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_MONT_CTX_set` 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_44344
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ecdsa_ossl.c:273: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul`. Showing all 17 steps of the trace crypto/ec/ecdsa_ossl.c:260:18: Call 258. do { 259. if (in_kinv == NULL || in_r == NULL) { 260. if (!ecdsa_sign_setup(eckey, ctx, &kinv, &ret->r, dgst, dgst_len)) { ^ 261. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_ECDSA_LIB); 262. goto err; crypto/ec/ecdsa_ossl.c:34:1: Parameter `ctx_in->stack.depth` 32. } 33. 34. > static int ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, 35. BIGNUM **kinvp, BIGNUM **rp, 36. const unsigned char *dgst, int dlen) crypto/ec/ecdsa_ossl.c:273:14: Call 271. } 272. 273. if (!BN_mod_mul(tmp, priv_key, ret->r, order, ctx)) { ^ 274. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB); 275. goto err; crypto/bn/bn_mod.c:73:1: Parameter `ctx->stack.depth` 71. 72. /* slow but works */ 73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 74. BN_CTX *ctx) 75. { crypto/bn/bn_mod.c:83:5: Call 81. bn_check_top(m); 82. 83. BN_CTX_start(ctx); ^ 84. if ((t = BN_CTX_get(ctx)) == NULL) 85. goto err; crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mod.c:87:14: Call 85. goto err; 86. if (a == b) { 87. if (!BN_sqr(t, a, ctx)) ^ 88. goto err; 89. } else { crypto/bn/bn_sqr.c:32:5: Call 30. } 31. 32. BN_CTX_start(ctx); ^ 33. rr = (a != r) ? r : BN_CTX_get(ctx); 34. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_sqr.c:99:5: Call 97. bn_check_top(rr); 98. bn_check_top(tmp); 99. BN_CTX_end(ctx); ^ 100. return (ret); 101. } crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.indexes` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:271:1: <Offset trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `st->depth` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: <Length trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `*st->indexes` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:273:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul` 271. static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; ^ 274. } 275.
https://github.com/openssl/openssl/blob/69588edbaa424beb71c6a9b1be416588232cb78c/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_44345
int tls1_export_keying_material(SSL *s, unsigned char *out, unsigned int olen, const char *label, unsigned int llen, const unsigned char *context, unsigned int contextlen, int use_context) { unsigned char *buff; unsigned char *val; unsigned int vallen, currentvalpos, rv; #ifdef KSSL_DEBUG printf ("tls1_export_keying_material(%p, %p,%d, %s,%d, %p,%d)\n", s, out,olen, label,llen, p,plen); #endif buff = OPENSSL_malloc(olen); if (buff == NULL) goto err2; vallen = llen + SSL3_RANDOM_SIZE * 2; if (use_context) { vallen += 2 + contextlen; } val = OPENSSL_malloc(vallen); if (val == NULL) goto err2; currentvalpos = 0; memcpy(val + currentvalpos, (unsigned char *) label, llen); currentvalpos += llen; memcpy(val + currentvalpos, s->s3->client_random, SSL3_RANDOM_SIZE); currentvalpos += SSL3_RANDOM_SIZE; memcpy(val + currentvalpos, s->s3->server_random, SSL3_RANDOM_SIZE); currentvalpos += SSL3_RANDOM_SIZE; if (use_context) { val[currentvalpos] = (contextlen << 8) & 0xff; currentvalpos++; val[currentvalpos] = contextlen & 0xff; currentvalpos++; if ((contextlen > 0) || (context != NULL)) { memcpy(val + currentvalpos, context, contextlen); } } if (bcmp(val, TLS_MD_CLIENT_FINISH_CONST, TLS_MD_CLIENT_FINISH_CONST_SIZE) == 0) goto err1; if (bcmp(val, TLS_MD_SERVER_FINISH_CONST, TLS_MD_SERVER_FINISH_CONST_SIZE) == 0) goto err1; if (bcmp(val, TLS_MD_MASTER_SECRET_CONST, TLS_MD_MASTER_SECRET_CONST_SIZE) == 0) goto err1; if (bcmp(val, TLS_MD_KEY_EXPANSION_CONST, TLS_MD_KEY_EXPANSION_CONST_SIZE) == 0) goto err1; tls1_PRF(s->s3->tmp.new_cipher->algorithm2, val, vallen, NULL, 0, NULL, 0, NULL, 0, NULL, 0, s->session->master_key,s->session->master_key_length, out,buff,olen); #ifdef KSSL_DEBUG printf ("tls1_export_keying_material() complete\n"); #endif rv = olen; goto ret; err1: SSLerr(SSL_F_TLS1_EXPORT_KEYING_MATERIAL, SSL_R_TLS_ILLEGAL_EXPORTER_LABEL); rv = 0; goto ret; err2: SSLerr(SSL_F_TLS1_EXPORT_KEYING_MATERIAL, ERR_R_MALLOC_FAILURE); rv = 0; ret: if (buff != NULL) OPENSSL_free(buff); if (val != NULL) OPENSSL_free(val); return(rv); } ssl/t1_enc.c:1207: error: UNINITIALIZED_VALUE The value read from val was never initialized. Showing all 1 steps of the trace ssl/t1_enc.c:1207:6: 1205. ret: 1206. if (buff != NULL) OPENSSL_free(buff); 1207. > if (val != NULL) OPENSSL_free(val); 1208. return(rv); 1209. }
https://github.com/openssl/openssl/blob/d674bb4bc84e6e8cf510adfe7049cb19a2c29cf8/ssl/t1_enc.c/#L1207
d2a_code_trace_data_44346
static int seq_parse_frame_data(SeqDemuxContext *seq, ByteIOContext *pb) { unsigned int offset_table[4], buffer_num[4]; TiertexSeqFrameBuffer *seq_buffer; int i, e, err; seq->current_frame_offs += SEQ_FRAME_SIZE; url_fseek(pb, seq->current_frame_offs, SEEK_SET); seq->current_audio_data_offs = get_le16(pb); if (seq->current_audio_data_offs != 0) { seq->current_audio_data_size = SEQ_AUDIO_BUFFER_SIZE * 2; } else { seq->current_audio_data_size = 0; } seq->current_pal_data_offs = get_le16(pb); if (seq->current_pal_data_offs != 0) { seq->current_pal_data_size = 768; } else { seq->current_pal_data_size = 0; } for (i = 0; i < 4; i++) buffer_num[i] = get_byte(pb); for (i = 0; i < 4; i++) offset_table[i] = get_le16(pb); for (i = 0; i < 3; i++) { if (offset_table[i] != 0) { for (e = i + 1; e < 4 && offset_table[e] == 0; e++); err = seq_fill_buffer(seq, pb, buffer_num[1 + i], offset_table[i], offset_table[e] - offset_table[i]); if (err != 0) return err; } } if (buffer_num[0] != 255) { if (buffer_num[0] >= SEQ_NUM_FRAME_BUFFERS) return AVERROR_INVALIDDATA; seq_buffer = &seq->frame_buffers[buffer_num[0]]; seq->current_video_data_size = seq_buffer->fill_size; seq->current_video_data_ptr = seq_buffer->data; seq_buffer->fill_size = 0; } else { seq->current_video_data_size = 0; seq->current_video_data_ptr = 0; } return 0; } libavformat/tiertexseq.c:157: error: Uninitialized Value The value read from offset_table[_] was never initialized. libavformat/tiertexseq.c:157:13: 155. 156. for (i = 0; i < 3; i++) { 157. if (offset_table[i] != 0) { ^ 158. for (e = i + 1; e < 4 && offset_table[e] == 0; e++); 159. err = seq_fill_buffer(seq, pb, buffer_num[1 + i],
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/tiertexseq.c/#L157
d2a_code_trace_data_44347
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) { int line_size; int sample_size = av_get_bytes_per_sample(sample_fmt); int planar = av_sample_fmt_is_planar(sample_fmt); if (!sample_size || nb_samples <= 0 || nb_channels <= 0) return AVERROR(EINVAL); if (!align) { if (nb_samples > INT_MAX - 31) return AVERROR(EINVAL); align = 1; nb_samples = FFALIGN(nb_samples, 32); } if (nb_channels > INT_MAX / align || (int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size) return AVERROR(EINVAL); line_size = planar ? FFALIGN(nb_samples * sample_size, align) : FFALIGN(nb_samples * sample_size * nb_channels, align); if (linesize) *linesize = line_size; return planar ? line_size * nb_channels : line_size; } libavresample/resample.c:434: error: Integer Overflow L2 ([1, 2147483616] + 32):signed32 by call to `ff_audio_data_realloc`. libavresample/resample.c:432:23: Call 430. /* TODO: try to calculate this without the dummy resample() run */ 431. if (!dst->read_only && dst->allow_realloc) { 432. out_samples = resample(c, NULL, NULL, NULL, c->buffer->nb_samples, ^ 433. INT_MAX, 0); 434. ret = ff_audio_data_realloc(dst, out_samples); libavresample/resample.c:343:9: Assignment 341. 342. if (!dst != !src) 343. return AVERROR(EINVAL); ^ 344. 345. if (compensation_distance == 0 && c->filter_length == 1 && libavresample/resample.c:432:9: Assignment 430. /* TODO: try to calculate this without the dummy resample() run */ 431. if (!dst->read_only && dst->allow_realloc) { 432. out_samples = resample(c, NULL, NULL, NULL, c->buffer->nb_samples, ^ 433. INT_MAX, 0); 434. ret = ff_audio_data_realloc(dst, out_samples); libavresample/resample.c:434:15: Call 432. out_samples = resample(c, NULL, NULL, NULL, c->buffer->nb_samples, 433. INT_MAX, 0); 434. ret = ff_audio_data_realloc(dst, out_samples); ^ 435. if (ret < 0) { 436. av_log(c->avr, AV_LOG_ERROR, "error reallocating output\n"); libavresample/audio_data.c:153:1: Parameter `nb_samples` 151. } 152. 153. int ff_audio_data_realloc(AudioData *a, int nb_samples) ^ 154. { 155. int ret, new_buf_size, plane_size, p; libavresample/audio_data.c:177:15: Call 175. uint8_t *new_data[AVRESAMPLE_MAX_CHANNELS] = { NULL }; 176. 177. ret = av_samples_alloc(new_data, &plane_size, a->allocated_channels, ^ 178. nb_samples, a->sample_fmt, 0); 179. if (ret < 0) libavutil/samplefmt.c:162:1: Parameter `nb_samples` 160. } 161. 162. int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels, ^ 163. int nb_samples, enum AVSampleFormat sample_fmt, int align) 164. { libavutil/samplefmt.c:166:16: Call 164. { 165. uint8_t *buf; 166. int size = av_samples_get_buffer_size(NULL, nb_channels, nb_samples, ^ 167. sample_fmt, align); 168. if (size < 0) libavutil/samplefmt.c:108:1: <LHS trace> 106. } 107. 108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, ^ 109. enum AVSampleFormat sample_fmt, int align) 110. { libavutil/samplefmt.c:108:1: Parameter `nb_samples` 106. } 107. 108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, ^ 109. enum AVSampleFormat sample_fmt, int align) 110. { libavutil/samplefmt.c:124:9: Binary operation: ([1, 2147483616] + 32):signed32 by call to `ff_audio_data_realloc` 122. return AVERROR(EINVAL); 123. align = 1; 124. nb_samples = FFALIGN(nb_samples, 32); ^ 125. } 126.
https://github.com/libav/libav/blob/0e830094ad0dc251613a0aa3234d9c5c397e02e6/libavutil/samplefmt.c/#L124
d2a_code_trace_data_44348
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size) { EightBpsContext * const c = avctx->priv_data; const unsigned char *encoded = buf; unsigned char *pixptr, *pixptr_end; unsigned int height = avctx->height; unsigned int dlen, p, row; const unsigned char *lp, *dp; unsigned char count; unsigned int px_inc; unsigned int planes = c->planes; unsigned char *planemap = c->planemap; if(c->pic.data[0]) avctx->release_buffer(avctx, &c->pic); c->pic.reference = 0; c->pic.buffer_hints = FF_BUFFER_HINTS_VALID; if(avctx->get_buffer(avctx, &c->pic) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } dp = encoded + planes * (height << 1); if (planes == 4) planes--; px_inc = planes + (avctx->pix_fmt == PIX_FMT_RGB32); for (p = 0; p < planes; p++) { lp = encoded + p * (height << 1); for(row = 0; row < height; row++) { pixptr = c->pic.data[0] + row * c->pic.linesize[0] + planemap[p]; pixptr_end = pixptr + c->pic.linesize[0]; dlen = be2me_16(*(const unsigned short *)(lp+row*2)); while(dlen > 0) { if(dp + 1 >= buf+buf_size) return -1; if ((count = *dp++) <= 127) { count++; dlen -= count + 1; if (pixptr + count * px_inc > pixptr_end) break; if(dp + count > buf+buf_size) return -1; while(count--) { *pixptr = *dp++; pixptr += px_inc; } } else { count = 257 - count; if (pixptr + count * px_inc > pixptr_end) break; while(count--) { *pixptr = *dp; pixptr += px_inc; } dp++; dlen -= 2; } } } } if (avctx->palctrl) { memcpy (c->pic.data[1], avctx->palctrl->palette, AVPALETTE_SIZE); if (avctx->palctrl->palette_changed) { c->pic.palette_has_changed = 1; avctx->palctrl->palette_changed = 0; } else c->pic.palette_has_changed = 0; } *data_size = sizeof(AVFrame); *(AVFrame*)data = c->pic; return buf_size; } libavcodec/8bps.c:123: error: Integer Overflow L2 ([1, +oo] - 2):unsigned32. libavcodec/8bps.c:60:1: <LHS trace> 58. * 59. */ 60. static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size) ^ 61. { 62. EightBpsContext * const c = avctx->priv_data; libavcodec/8bps.c:60:1: Parameter `*buf` 58. * 59. */ 60. static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size) ^ 61. { 62. EightBpsContext * const c = avctx->priv_data; libavcodec/8bps.c:100:32: Assignment 98. pixptr = c->pic.data[0] + row * c->pic.linesize[0] + planemap[p]; 99. pixptr_end = pixptr + c->pic.linesize[0]; 100. dlen = be2me_16(*(const unsigned short *)(lp+row*2)); ^ 101. /* Decode a row of this plane */ 102. while(dlen > 0) { libavcodec/8bps.c:100:25: Assignment 98. pixptr = c->pic.data[0] + row * c->pic.linesize[0] + planemap[p]; 99. pixptr_end = pixptr + c->pic.linesize[0]; 100. dlen = be2me_16(*(const unsigned short *)(lp+row*2)); ^ 101. /* Decode a row of this plane */ 102. while(dlen > 0) { libavcodec/8bps.c:123:41: Binary operation: ([1, +oo] - 2):unsigned32 121. } 122. dp++; 123. dlen -= 2; ^ 124. } 125. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/8bps.c/#L123
d2a_code_trace_data_44349
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/ec/ecdsa_ossl.c:483: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_nnmod`. Showing all 16 steps of the trace crypto/ec/ecdsa_ossl.c:428:10: Call 426. } 427. /* calculate tmp1 = inv(S) mod order */ 428. if (!ec_group_do_inverse_ord(group, u2, sig->s, ctx)) { ^ 429. ECerr(EC_F_OSSL_ECDSA_VERIFY_SIG, ERR_R_BN_LIB); 430. goto err; crypto/ec/ec_lib.c:1074:1: Parameter `res->top` 1072. * other functionality. 1073. */ 1074. > int ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res, 1075. const BIGNUM *x, BN_CTX *ctx) 1076. { crypto/ec/ecdsa_ossl.c:483:10: Call 481. } 482. #endif 483. if (!BN_nnmod(u1, X, order, ctx)) { ^ 484. ECerr(EC_F_OSSL_ECDSA_VERIFY_SIG, ERR_R_BN_LIB); 485. goto err; crypto/bn/bn_mod.c:13:1: Parameter `m->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: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:204:11: Call 202. sdiv->neg = 0; 203. norm_shift += BN_BITS2; 204. if (!(BN_lshift(snum, num, norm_shift))) ^ 205. goto err; 206. snum->neg = 0; crypto/bn/bn_shift.c:83:1: <Offset trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `n` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:5: Assignment 95. } 96. 97. nw = n / BN_BITS2; ^ 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) 99. return 0; crypto/bn/bn_shift.c:83:1: <Length trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `*r->d` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:98:9: Call 96. 97. nw = n / BN_BITS2; 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 99. return 0; 100. r->neg = a->neg; crypto/bn/bn_lib.c: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 `BN_nnmod` 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/b8c32081e02b7008a90d878eccce46da256dfe86/crypto/bn/bn_shift.c/#L112
d2a_code_trace_data_44350
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) { int line_size; int sample_size = av_get_bytes_per_sample(sample_fmt); int planar = av_sample_fmt_is_planar(sample_fmt); if (!sample_size || nb_samples <= 0 || nb_channels <= 0) return AVERROR(EINVAL); if (!align) { if (nb_samples > INT_MAX - 31) return AVERROR(EINVAL); align = 1; nb_samples = FFALIGN(nb_samples, 32); } if (nb_channels > INT_MAX / align || (int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size) return AVERROR(EINVAL); line_size = planar ? FFALIGN(nb_samples * sample_size, align) : FFALIGN(nb_samples * sample_size * nb_channels, align); if (linesize) *linesize = line_size; return planar ? line_size * nb_channels : line_size; } libavcodec/mpegvideo_enc.c:1399: error: Integer Overflow L2 ([1, 2147483616] + 32):signed32 by call to `alloc_picture`. libavcodec/mpegvideo_enc.c:1399:17: Call 1397. 1398. pic->reference = s->reordered_input_picture[0]->reference; 1399. if (alloc_picture(s, pic, 0) < 0) { ^ 1400. return -1; 1401. } libavcodec/mpegvideo_enc.c:946:1: Parameter `pic->f->nb_samples` 944. } 945. 946. static int alloc_picture(MpegEncContext *s, Picture *pic, int shared) ^ 947. { 948. return ff_alloc_picture(s->avctx, pic, &s->me, &s->sc, shared, 1, libavcodec/mpegvideo_enc.c:948:12: Call 946. static int alloc_picture(MpegEncContext *s, Picture *pic, int shared) 947. { 948. return ff_alloc_picture(s->avctx, pic, &s->me, &s->sc, shared, 1, ^ 949. s->chroma_x_shift, s->chroma_y_shift, s->out_format, 950. s->mb_stride, s->mb_height, s->b8_stride, libavcodec/mpegpicture.c:211:1: Parameter `pic->f->nb_samples` 209. * The pixels are allocated/set by calling get_buffer() if shared = 0 210. */ 211. int ff_alloc_picture(AVCodecContext *avctx, Picture *pic, MotionEstContext *me, ^ 212. ScratchpadContext *sc, int shared, int encoding, 213. int chroma_x_shift, int chroma_y_shift, int out_format, libavcodec/mpegpicture.c:224:13: Call 222. } else { 223. assert(!pic->f->buf[0]); 224. if (alloc_frame_buffer(avctx, pic, me, sc, ^ 225. chroma_x_shift, chroma_y_shift, 226. *linesize, *uvlinesize) < 0) libavcodec/mpegpicture.c:85:1: Parameter `pic->f->nb_samples` 83. * Allocate a frame buffer 84. */ 85. static int alloc_frame_buffer(AVCodecContext *avctx, Picture *pic, ^ 86. MotionEstContext *me, ScratchpadContext *sc, 87. int chroma_x_shift, int chroma_y_shift, libavcodec/mpegpicture.c:108:13: Call 106. pic->f->height = avctx->height; 107. pic->f->format = avctx->pix_fmt; 108. r = avcodec_default_get_buffer2(avctx, pic->f, 0); ^ 109. } 110. libavcodec/utils.c:510:1: Parameter `frame->nb_samples` 508. } 509. 510. int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags) ^ 511. { 512. int ret; libavcodec/utils.c:514:16: Call 512. int ret; 513. 514. if ((ret = update_frame_pool(avctx, frame)) < 0) ^ 515. return ret; 516. libavcodec/utils.c:333:1: Parameter `frame->nb_samples` 331. } 332. 333. static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame) ^ 334. { 335. FramePool *pool = avctx->internal->pool; libavcodec/utils.c:400:15: Call 398. 399. av_buffer_pool_uninit(&pool->pools[0]); 400. ret = av_samples_get_buffer_size(&pool->linesize[0], ch, ^ 401. frame->nb_samples, frame->format, 0); 402. if (ret < 0) libavutil/samplefmt.c:108:1: <LHS trace> 106. } 107. 108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, ^ 109. enum AVSampleFormat sample_fmt, int align) 110. { libavutil/samplefmt.c:108:1: Parameter `nb_samples` 106. } 107. 108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, ^ 109. enum AVSampleFormat sample_fmt, int align) 110. { libavutil/samplefmt.c:124:9: Binary operation: ([1, 2147483616] + 32):signed32 by call to `alloc_picture` 122. return AVERROR(EINVAL); 123. align = 1; 124. nb_samples = FFALIGN(nb_samples, 32); ^ 125. } 126.
https://github.com/libav/libav/blob/a7ac1a7b94447f33ae95be4d6d186e2775977f91/libavutil/samplefmt.c/#L124
d2a_code_trace_data_44351
static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) { SmackerContext *smk = s->priv_data; int flags; int ret; int i; int frame_size = 0; int palchange = 0; int pos; if (url_feof(s->pb) || smk->cur_frame >= smk->frames) return AVERROR(EIO); if(smk->curstream < 0) { url_fseek(s->pb, smk->nextpos, 0); frame_size = smk->frm_size[smk->cur_frame] & (~3); flags = smk->frm_flags[smk->cur_frame]; pos = url_ftell(s->pb); if(flags & SMACKER_PAL){ int size, sz, t, off, j, pos; uint8_t *pal = smk->pal; uint8_t oldpal[768]; memcpy(oldpal, pal, 768); size = get_byte(s->pb); size = size * 4 - 1; frame_size -= size; frame_size--; sz = 0; pos = url_ftell(s->pb) + size; while(sz < 256){ t = get_byte(s->pb); if(t & 0x80){ sz += (t & 0x7F) + 1; pal += ((t & 0x7F) + 1) * 3; } else if(t & 0x40){ off = get_byte(s->pb) * 3; j = (t & 0x3F) + 1; while(j-- && sz < 256) { *pal++ = oldpal[off + 0]; *pal++ = oldpal[off + 1]; *pal++ = oldpal[off + 2]; sz++; off += 3; } } else { *pal++ = smk_pal[t]; *pal++ = smk_pal[get_byte(s->pb) & 0x3F]; *pal++ = smk_pal[get_byte(s->pb) & 0x3F]; sz++; } } url_fseek(s->pb, pos, 0); palchange |= 1; } flags >>= 1; smk->curstream = -1; for(i = 0; i < 7; i++) { if(flags & 1) { int size; size = get_le32(s->pb) - 4; frame_size -= size; frame_size -= 4; smk->curstream++; smk->bufs[smk->curstream] = av_realloc(smk->bufs[smk->curstream], size); smk->buf_sizes[smk->curstream] = size; ret = get_buffer(s->pb, smk->bufs[smk->curstream], size); if(ret != size) return AVERROR(EIO); smk->stream_id[smk->curstream] = smk->indexes[i]; } flags >>= 1; } if (av_new_packet(pkt, frame_size + 768)) return AVERROR(ENOMEM); if(smk->frm_size[smk->cur_frame] & 1) palchange |= 2; pkt->data[0] = palchange; memcpy(pkt->data + 1, smk->pal, 768); ret = get_buffer(s->pb, pkt->data + 769, frame_size); if(ret != frame_size) return AVERROR(EIO); pkt->stream_index = smk->videoindex; pkt->size = ret + 769; smk->cur_frame++; smk->nextpos = url_ftell(s->pb); } else { if (av_new_packet(pkt, smk->buf_sizes[smk->curstream])) return AVERROR(ENOMEM); memcpy(pkt->data, smk->bufs[smk->curstream], smk->buf_sizes[smk->curstream]); pkt->size = smk->buf_sizes[smk->curstream]; pkt->stream_index = smk->stream_id[smk->curstream]; pkt->pts = smk->aud_pts[smk->curstream]; smk->aud_pts[smk->curstream] += AV_RL32(pkt->data); smk->curstream--; } return 0; } libavformat/smacker.c:300: error: Buffer Overrun L1 Offset added: 768 Size: 64. libavformat/smacker.c:219:1: <Length trace> 217. 218. 219. static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) ^ 220. { 221. SmackerContext *smk = s->priv_data; libavformat/smacker.c:219:1: Parameter `s->priv_data->pal` 217. 218. 219. static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt) ^ 220. { 221. SmackerContext *smk = s->priv_data; libavformat/smacker.c:300:9: Array access: Offset added: 768 Size: 64 298. palchange |= 2; 299. pkt->data[0] = palchange; 300. memcpy(pkt->data + 1, smk->pal, 768); ^ 301. ret = get_buffer(s->pb, pkt->data + 769, frame_size); 302. if(ret != frame_size)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/smacker.c/#L300
d2a_code_trace_data_44352
static void copy_parameter_set(void **to, void **from, int count, int size) { int i; for (i=0; i<count; i++){ if (to[i] && !from[i]) av_freep(&to[i]); else if (from[i] && !to[i]) to[i] = av_malloc(size); if (from[i]) memcpy(to[i], from[i], size); } } libavcodec/h264.c:1084: error: Null Dereference pointer `*to[i]` last assigned on line 1082 could be null and is dereferenced by call to `memcpy()` at line 1084, column 22. libavcodec/h264.c:1076:1: start of procedure copy_parameter_set() 1074. } 1075. 1076. static void copy_parameter_set(void **to, void **from, int count, int size) ^ 1077. { 1078. int i; libavcodec/h264.c:1080:10: 1078. int i; 1079. 1080. for (i=0; i<count; i++){ ^ 1081. if (to[i] && !from[i]) av_freep(&to[i]); 1082. else if (from[i] && !to[i]) to[i] = av_malloc(size); libavcodec/h264.c:1080:15: Loop condition is true. Entering loop body 1078. int i; 1079. 1080. for (i=0; i<count; i++){ ^ 1081. if (to[i] && !from[i]) av_freep(&to[i]); 1082. else if (from[i] && !to[i]) to[i] = av_malloc(size); libavcodec/h264.c:1081:13: Taking false branch 1079. 1080. for (i=0; i<count; i++){ 1081. if (to[i] && !from[i]) av_freep(&to[i]); ^ 1082. else if (from[i] && !to[i]) to[i] = av_malloc(size); 1083. libavcodec/h264.c:1082:18: Taking true branch 1080. for (i=0; i<count; i++){ 1081. if (to[i] && !from[i]) av_freep(&to[i]); 1082. else if (from[i] && !to[i]) to[i] = av_malloc(size); ^ 1083. 1084. if (from[i]) memcpy(to[i], from[i], size); libavcodec/h264.c:1082:30: Taking true branch 1080. for (i=0; i<count; i++){ 1081. if (to[i] && !from[i]) av_freep(&to[i]); 1082. else if (from[i] && !to[i]) to[i] = av_malloc(size); ^ 1083. 1084. if (from[i]) memcpy(to[i], from[i], size); libavcodec/h264.c:1082:37: 1080. for (i=0; i<count; i++){ 1081. if (to[i] && !from[i]) av_freep(&to[i]); 1082. else if (from[i] && !to[i]) to[i] = av_malloc(size); ^ 1083. 1084. if (from[i]) memcpy(to[i], from[i], size); libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking true branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) ^ 73. return NULL; 74. libavutil/mem.c:73:9: 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) 73. return NULL; ^ 74. 75. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavcodec/h264.c:1084:13: Taking true branch 1082. else if (from[i] && !to[i]) to[i] = av_malloc(size); 1083. 1084. if (from[i]) memcpy(to[i], from[i], size); ^ 1085. } 1086. } libavcodec/h264.c:1084:22: 1082. else if (from[i] && !to[i]) to[i] = av_malloc(size); 1083. 1084. if (from[i]) memcpy(to[i], from[i], size); ^ 1085. } 1086. }
https://github.com/libav/libav/blob/6a9c85944427e3c4355bce67d7f677ec69527bff/libavcodec/h264.c/#L1084
d2a_code_trace_data_44353
int HMAC_CTX_reset(HMAC_CTX *ctx) { hmac_ctx_cleanup(ctx); if (ctx->i_ctx == NULL) ctx->i_ctx = EVP_MD_CTX_new(); if (ctx->i_ctx == NULL) goto err; if (ctx->o_ctx == NULL) ctx->o_ctx = EVP_MD_CTX_new(); if (ctx->o_ctx == NULL) goto err; if (ctx->md_ctx == NULL) ctx->md_ctx = EVP_MD_CTX_new(); if (ctx->md_ctx == NULL) goto err; ctx->md = NULL; return 1; err: hmac_ctx_cleanup(ctx); return 0; } crypto/hmac/hmac.c:223: error: MEMORY_LEAK memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 213, column 22 is not reachable after line 223, column 5. Showing all 47 steps of the trace crypto/hmac/hmac.c:205:1: start of procedure HMAC_CTX_reset() 203. } 204. 205. > int HMAC_CTX_reset(HMAC_CTX *ctx) 206. { 207. hmac_ctx_cleanup(ctx); crypto/hmac/hmac.c:207:5: Skipping hmac_ctx_cleanup(): empty list of specs 205. int HMAC_CTX_reset(HMAC_CTX *ctx) 206. { 207. hmac_ctx_cleanup(ctx); ^ 208. if (ctx->i_ctx == NULL) 209. ctx->i_ctx = EVP_MD_CTX_new(); crypto/hmac/hmac.c:208:9: Taking false branch 206. { 207. hmac_ctx_cleanup(ctx); 208. if (ctx->i_ctx == NULL) ^ 209. ctx->i_ctx = EVP_MD_CTX_new(); 210. if (ctx->i_ctx == NULL) crypto/hmac/hmac.c:210:9: Taking false branch 208. if (ctx->i_ctx == NULL) 209. ctx->i_ctx = EVP_MD_CTX_new(); 210. if (ctx->i_ctx == NULL) ^ 211. goto err; 212. if (ctx->o_ctx == NULL) crypto/hmac/hmac.c:212:9: Taking true branch 210. if (ctx->i_ctx == NULL) 211. goto err; 212. if (ctx->o_ctx == NULL) ^ 213. ctx->o_ctx = EVP_MD_CTX_new(); 214. if (ctx->o_ctx == NULL) crypto/hmac/hmac.c:213:9: 211. goto err; 212. if (ctx->o_ctx == NULL) 213. > ctx->o_ctx = EVP_MD_CTX_new(); 214. if (ctx->o_ctx == NULL) 215. goto err; crypto/evp/digest.c:153:1: start of procedure EVP_MD_CTX_new() 151. } 152. 153. > EVP_MD_CTX *EVP_MD_CTX_new(void) 154. { 155. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); crypto/evp/digest.c:155:5: 153. EVP_MD_CTX *EVP_MD_CTX_new(void) 154. { 155. > return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 156. } 157. 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/evp/digest.c:156:1: return from a call to EVP_MD_CTX_new 154. { 155. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 156. > } 157. 158. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) crypto/hmac/hmac.c:214:9: Taking false branch 212. if (ctx->o_ctx == NULL) 213. ctx->o_ctx = EVP_MD_CTX_new(); 214. if (ctx->o_ctx == NULL) ^ 215. goto err; 216. if (ctx->md_ctx == NULL) crypto/hmac/hmac.c:216:9: Taking true branch 214. if (ctx->o_ctx == NULL) 215. goto err; 216. if (ctx->md_ctx == NULL) ^ 217. ctx->md_ctx = EVP_MD_CTX_new(); 218. if (ctx->md_ctx == NULL) crypto/hmac/hmac.c:217:9: 215. goto err; 216. if (ctx->md_ctx == NULL) 217. > ctx->md_ctx = EVP_MD_CTX_new(); 218. if (ctx->md_ctx == NULL) 219. goto err; crypto/evp/digest.c:153:1: start of procedure EVP_MD_CTX_new() 151. } 152. 153. > EVP_MD_CTX *EVP_MD_CTX_new(void) 154. { 155. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); crypto/evp/digest.c:155:5: 153. EVP_MD_CTX *EVP_MD_CTX_new(void) 154. { 155. > return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 156. } 157. crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking false branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/evp/digest.c:156:1: return from a call to EVP_MD_CTX_new 154. { 155. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 156. > } 157. 158. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) crypto/hmac/hmac.c:218:9: Taking true branch 216. if (ctx->md_ctx == NULL) 217. ctx->md_ctx = EVP_MD_CTX_new(); 218. if (ctx->md_ctx == NULL) ^ 219. goto err; 220. ctx->md = NULL; crypto/hmac/hmac.c:222:2: 220. ctx->md = NULL; 221. return 1; 222. > err: 223. hmac_ctx_cleanup(ctx); 224. return 0; crypto/hmac/hmac.c:223:5: Skipping hmac_ctx_cleanup(): empty list of specs 221. return 1; 222. err: 223. hmac_ctx_cleanup(ctx); ^ 224. return 0; 225. }
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/hmac/hmac.c/#L223