id
stringlengths
25
25
content
stringlengths
649
72.1k
max_stars_repo_path
stringlengths
91
133
d2a_code_trace_data_44454
static int parse_icy(HTTPContext *s, const char *tag, const char *p) { int len = 4 + strlen(p) + strlen(tag); int is_first = !s->icy_metadata_headers; int ret; if (s->icy_metadata_headers) len += strlen(s->icy_metadata_headers); if ((ret = av_reallocp(&s->icy_metadata_headers, len)) < 0) return ret; if (is_first) *s->icy_metadata_headers = '\0'; av_strlcatf(s->icy_metadata_headers, len, "%s: %s\n", tag, p); return 0; } libavformat/http.c:421: error: Null Dereference pointer `s->icy_metadata_headers` last assigned on line 415 could be null and is dereferenced by call to `av_strlcatf()` at line 421, column 5. libavformat/http.c:406:1: start of procedure parse_icy() 404. 405. // Concat all Icy- header lines 406. static int parse_icy(HTTPContext *s, const char *tag, const char *p) ^ 407. { 408. int len = 4 + strlen(p) + strlen(tag); libavformat/http.c:408:5: 406. static int parse_icy(HTTPContext *s, const char *tag, const char *p) 407. { 408. int len = 4 + strlen(p) + strlen(tag); ^ 409. int is_first = !s->icy_metadata_headers; 410. int ret; libavformat/http.c:409:21: Condition is true 407. { 408. int len = 4 + strlen(p) + strlen(tag); 409. int is_first = !s->icy_metadata_headers; ^ 410. int ret; 411. libavformat/http.c:409:20: 407. { 408. int len = 4 + strlen(p) + strlen(tag); 409. int is_first = !s->icy_metadata_headers; ^ 410. int ret; 411. libavformat/http.c:409:5: 407. { 408. int len = 4 + strlen(p) + strlen(tag); 409. int is_first = !s->icy_metadata_headers; ^ 410. int ret; 411. libavformat/http.c:412:9: Taking true branch 410. int ret; 411. 412. if (s->icy_metadata_headers) ^ 413. len += strlen(s->icy_metadata_headers); 414. libavformat/http.c:413:9: 411. 412. if (s->icy_metadata_headers) 413. len += strlen(s->icy_metadata_headers); ^ 414. 415. if ((ret = av_reallocp(&s->icy_metadata_headers, len)) < 0) libavformat/http.c:415:9: 413. len += strlen(s->icy_metadata_headers); 414. 415. if ((ret = av_reallocp(&s->icy_metadata_headers, len)) < 0) ^ 416. return ret; 417. libavutil/mem.c:140:1: start of procedure av_reallocp() 138. } 139. 140. int av_reallocp(void *ptr, size_t size) ^ 141. { 142. void **ptrptr = ptr; libavutil/mem.c:142:5: 140. int av_reallocp(void *ptr, size_t size) 141. { 142. void **ptrptr = ptr; ^ 143. void *ret; 144. libavutil/mem.c:145:10: Taking true branch 143. void *ret; 144. 145. if (!size) { ^ 146. av_freep(ptr); 147. return 0; libavutil/mem.c:146:9: 144. 145. if (!size) { 146. av_freep(ptr); ^ 147. return 0; 148. } libavutil/mem.c:198:1: start of procedure av_freep() 196. } 197. 198. void av_freep(void *arg) ^ 199. { 200. void **ptr = (void **)arg; libavutil/mem.c:200:5: 198. void av_freep(void *arg) 199. { 200. void **ptr = (void **)arg; ^ 201. av_free(*ptr); 202. *ptr = NULL; libavutil/mem.c:201:5: 199. { 200. void **ptr = (void **)arg; 201. av_free(*ptr); ^ 202. *ptr = NULL; 203. } libavutil/mem.c:186:1: start of procedure av_free() 184. } 185. 186. void av_free(void *ptr) ^ 187. { 188. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:194:5: 192. _aligned_free(ptr); 193. #else 194. free(ptr); ^ 195. #endif 196. } libavutil/mem.c:196:1: return from a call to av_free 194. free(ptr); 195. #endif 196. } ^ 197. 198. void av_freep(void *arg) libavutil/mem.c:202:5: 200. void **ptr = (void **)arg; 201. av_free(*ptr); 202. *ptr = NULL; ^ 203. } 204. libavutil/mem.c:203:1: return from a call to av_freep 201. av_free(*ptr); 202. *ptr = NULL; 203. } ^ 204. 205. void *av_mallocz(size_t size) libavutil/mem.c:147:9: 145. if (!size) { 146. av_freep(ptr); 147. return 0; ^ 148. } 149. ret = av_realloc(*ptrptr, size); libavutil/mem.c:158:1: return from a call to av_reallocp 156. *ptrptr = ret; 157. return 0; 158. } ^ 159. 160. void *av_realloc_array(void *ptr, size_t nmemb, size_t size) libavformat/http.c:415:9: Taking false branch 413. len += strlen(s->icy_metadata_headers); 414. 415. if ((ret = av_reallocp(&s->icy_metadata_headers, len)) < 0) ^ 416. return ret; 417. libavformat/http.c:418:9: Taking false branch 416. return ret; 417. 418. if (is_first) ^ 419. *s->icy_metadata_headers = '\0'; 420. libavformat/http.c:421:5: 419. *s->icy_metadata_headers = '\0'; 420. 421. av_strlcatf(s->icy_metadata_headers, len, "%s: %s\n", tag, p); ^ 422. 423. return 0; libavutil/avstring.c:99:1: start of procedure av_strlcatf() 97. } 98. 99. size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) ^ 100. { 101. int len = strlen(dst); libavutil/avstring.c:101:5: 99. size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) 100. { 101. int len = strlen(dst); ^ 102. va_list vl; 103. libavutil/avstring.c:104:5: 102. va_list vl; 103. 104. va_start(vl, fmt); ^ 105. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); 106. va_end(vl); libavutil/avstring.c:105:33: Condition is true 103. 104. va_start(vl, fmt); 105. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); ^ 106. va_end(vl); 107. libavutil/avstring.c:105:5: 103. 104. va_start(vl, fmt); 105. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); ^ 106. va_end(vl); 107. libavutil/avstring.c:106:5: 104. va_start(vl, fmt); 105. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); 106. va_end(vl); ^ 107. 108. return len; libavutil/avstring.c:108:5: 106. va_end(vl); 107. 108. return len; ^ 109. } 110. libavutil/avstring.c:109:1: return from a call to av_strlcatf 107. 108. return len; 109. } ^ 110. 111. char *av_d2str(double d)
https://github.com/libav/libav/blob/436ced244fadcde2c0b925627920e84b25482542/libavformat/http.c/#L421
d2a_code_trace_data_44455
static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts) { InputStream *ist = s->opaque; const enum AVPixelFormat *p; int ret; for (p = pix_fmts; *p != -1; p++) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p); const HWAccel *hwaccel; if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) break; hwaccel = get_hwaccel(*p); if (!hwaccel || (ist->active_hwaccel_id && ist->active_hwaccel_id != hwaccel->id) || (ist->hwaccel_id != HWACCEL_AUTO && ist->hwaccel_id != hwaccel->id)) continue; ret = hwaccel->init(s); if (ret < 0) { if (ist->hwaccel_id == hwaccel->id) { av_log(NULL, AV_LOG_FATAL, "%s hwaccel requested for input stream #%d:%d, " "but cannot be initialized.\n", hwaccel->name, ist->file_index, ist->st->index); exit_program(1); } continue; } ist->active_hwaccel_id = hwaccel->id; ist->hwaccel_pix_fmt = *p; break; } return *p; } avconv.c:1391: error: Null Dereference pointer `desc` last assigned on line 1388 could be null and is dereferenced at line 1391, column 15. avconv.c:1381:1: start of procedure get_format() 1379. } 1380. 1381. static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts) ^ 1382. { 1383. InputStream *ist = s->opaque; avconv.c:1383:5: 1381. static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts) 1382. { 1383. InputStream *ist = s->opaque; ^ 1384. const enum AVPixelFormat *p; 1385. int ret; avconv.c:1387:10: 1385. int ret; 1386. 1387. for (p = pix_fmts; *p != -1; p++) { ^ 1388. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p); 1389. const HWAccel *hwaccel; avconv.c:1387:24: Loop condition is true. Entering loop body 1385. int ret; 1386. 1387. for (p = pix_fmts; *p != -1; p++) { ^ 1388. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p); 1389. const HWAccel *hwaccel; avconv.c:1388:9: 1386. 1387. for (p = pix_fmts; *p != -1; p++) { 1388. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p); ^ 1389. const HWAccel *hwaccel; 1390. libavutil/pixdesc.c:1507:1: start of procedure av_pix_fmt_desc_get() 1505. } 1506. 1507. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) ^ 1508. { 1509. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) libavutil/pixdesc.c:1509:9: Taking false branch 1507. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1508. { 1509. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1510. return NULL; 1511. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1509:24: Taking true branch 1507. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1508. { 1509. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1510. return NULL; 1511. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1510:9: 1508. { 1509. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) 1510. return NULL; ^ 1511. return &av_pix_fmt_descriptors[pix_fmt]; 1512. } libavutil/pixdesc.c:1512:1: return from a call to av_pix_fmt_desc_get 1510. return NULL; 1511. return &av_pix_fmt_descriptors[pix_fmt]; 1512. } ^ 1513. 1514. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) avconv.c:1391:15: 1389. const HWAccel *hwaccel; 1390. 1391. if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) ^ 1392. break; 1393.
https://github.com/libav/libav/blob/d7b3ee9a3a03ab88d61a5895fbdbc6689f4dd671/avconv.c/#L1391
d2a_code_trace_data_44456
static int opt_streamid(const char *opt, const char *arg) { int idx; char *p; char idx_str[16]; av_strlcpy(idx_str, arg, sizeof(idx_str)); p = strchr(idx_str, ':'); if (!p) { 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 = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1); streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); return 0; } ffmpeg.c:3766: error: Null Dereference pointer `p` last assigned on line 3766 could be null and is dereferenced at line 3766, column 5. ffmpeg.c:3752:1: start of procedure opt_streamid() 3750. 3751. /* arg format is "output-stream-index:streamid-value". */ 3752. static int opt_streamid(const char *opt, const char *arg) ^ 3753. { 3754. int idx; ffmpeg.c:3758:5: 3756. char idx_str[16]; 3757. 3758. av_strlcpy(idx_str, arg, sizeof(idx_str)); ^ 3759. p = strchr(idx_str, ':'); 3760. if (!p) { libavutil/avstring.c:64:1: start of procedure av_strlcpy() 62. } 63. 64. size_t av_strlcpy(char *dst, const char *src, size_t size) ^ 65. { 66. size_t len = 0; libavutil/avstring.c:66:5: 64. size_t av_strlcpy(char *dst, const char *src, size_t size) 65. { 66. size_t len = 0; ^ 67. while (++len < size && *src) 68. *dst++ = *src++; libavutil/avstring.c:67:12: Loop condition is true. Entering loop body 65. { 66. size_t len = 0; 67. while (++len < size && *src) ^ 68. *dst++ = *src++; 69. if (len <= size) libavutil/avstring.c:67:28: Loop condition is false. Leaving loop 65. { 66. size_t len = 0; 67. while (++len < size && *src) ^ 68. *dst++ = *src++; 69. if (len <= size) libavutil/avstring.c:69:9: Taking true branch 67. while (++len < size && *src) 68. *dst++ = *src++; 69. if (len <= size) ^ 70. *dst = 0; 71. return len + strlen(src) - 1; libavutil/avstring.c:70:9: 68. *dst++ = *src++; 69. if (len <= size) 70. *dst = 0; ^ 71. return len + strlen(src) - 1; 72. } libavutil/avstring.c:71:5: 69. if (len <= size) 70. *dst = 0; 71. return len + strlen(src) - 1; ^ 72. } 73. libavutil/avstring.c:72:1: return from a call to av_strlcpy 70. *dst = 0; 71. return len + strlen(src) - 1; 72. } ^ 73. 74. size_t av_strlcat(char *dst, const char *src, size_t size) ffmpeg.c:3759:5: 3757. 3758. av_strlcpy(idx_str, arg, sizeof(idx_str)); 3759. p = strchr(idx_str, ':'); ^ 3760. if (!p) { 3761. fprintf(stderr, ffmpeg.c:3760:10: Taking true branch 3758. av_strlcpy(idx_str, arg, sizeof(idx_str)); 3759. p = strchr(idx_str, ':'); 3760. if (!p) { ^ 3761. fprintf(stderr, 3762. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", ffmpeg.c:3761:9: 3759. p = strchr(idx_str, ':'); 3760. if (!p) { 3761. fprintf(stderr, ^ 3762. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", 3763. arg, opt); ffmpeg.c:3764:9: Skipping ffmpeg_exit(): empty list of specs 3762. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", 3763. arg, opt); 3764. ffmpeg_exit(1); ^ 3765. } 3766. *p++ = '\0'; ffmpeg.c:3766:5: 3764. ffmpeg_exit(1); 3765. } 3766. *p++ = '\0'; ^ 3767. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1); 3768. streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
https://github.com/libav/libav/blob/41e21e4db623ebd77f431a6f30cf21d62d9e1f33/ffmpeg.c/#L3766
d2a_code_trace_data_44457
static int ftp_getrc_msg(conn_rec *ftp_ctrl, apr_bucket_brigade *bb, char *msgbuf, int msglen) { int status; char response[MAX_LINE_LEN]; char buff[5]; char *mb = msgbuf, *me = &msgbuf[msglen]; apr_status_t rv; int eos; if (APR_SUCCESS != (rv = ftp_string_read(ftp_ctrl, bb, response, sizeof(response), &eos))) { return -1; } if (!apr_isdigit(response[0]) || !apr_isdigit(response[1]) || !apr_isdigit(response[2]) || (response[3] != ' ' && response[3] != '-')) status = 0; else status = 100 * response[0] + 10 * response[1] + response[2] - 111 * '0'; mb = apr_cpystrn(mb, response + 4, me - mb); if (response[3] == '-') { memcpy(buff, response, 3); buff[3] = ' '; do { if (APR_SUCCESS != (rv = ftp_string_read(ftp_ctrl, bb, response, sizeof(response), &eos))) { return -1; } mb = apr_cpystrn(mb, response + (' ' == response[0] ? 1 : 4), me - mb); } while (memcmp(response, buff, 4) != 0); } return status; } modules/proxy/mod_proxy_ftp.c:825: error: BUFFER_OVERRUN_L1 Offset: 8192 Size: 8192 by call to `ftp_getrc_msg`. modules/proxy/mod_proxy_ftp.c:800:1: Array declaration 798. * Allows for tracing the FTP protocol (in LogLevel debug) 799. */ 800. static int ^ 801. proxy_ftp_command(const char *cmd, request_rec *r, conn_rec *ftp_ctrl, 802. apr_bucket_brigade *bb, char **pmessage) modules/proxy/mod_proxy_ftp.c:825:10: Call 823. } 824. 825. rc = ftp_getrc_msg(ftp_ctrl, bb, message, sizeof message); ^ 826. if (rc == -1 || rc == 421) 827. strcpy(message,"<unable to read result>"); modules/proxy/mod_proxy_ftp.c:381:1: <Offset trace> 379. * remembers the response message in the supplied buffer 380. */ 381. static int ftp_getrc_msg(conn_rec *ftp_ctrl, apr_bucket_brigade *bb, char *msgbuf, int msglen) ^ 382. { 383. int status; modules/proxy/mod_proxy_ftp.c:381:1: Parameter `msglen` 379. * remembers the response message in the supplied buffer 380. */ 381. static int ftp_getrc_msg(conn_rec *ftp_ctrl, apr_bucket_brigade *bb, char *msgbuf, int msglen) ^ 382. { 383. int status; modules/proxy/mod_proxy_ftp.c:381:1: <Length trace> 379. * remembers the response message in the supplied buffer 380. */ 381. static int ftp_getrc_msg(conn_rec *ftp_ctrl, apr_bucket_brigade *bb, char *msgbuf, int msglen) ^ 382. { 383. int status; modules/proxy/mod_proxy_ftp.c:381:1: Parameter `*msgbuf` 379. * remembers the response message in the supplied buffer 380. */ 381. static int ftp_getrc_msg(conn_rec *ftp_ctrl, apr_bucket_brigade *bb, char *msgbuf, int msglen) ^ 382. { 383. int status; modules/proxy/mod_proxy_ftp.c:386:5: Array access: Offset: 8192 Size: 8192 by call to `ftp_getrc_msg` 384. char response[MAX_LINE_LEN]; 385. char buff[5]; 386. char *mb = msgbuf, *me = &msgbuf[msglen]; ^ 387. apr_status_t rv; 388. int eos;
https://github.com/apache/httpd/blob/8b2ec33ac5d314be345814db08e194ffeda6beb0/modules/proxy/mod_proxy_ftp.c/#L386
d2a_code_trace_data_44458
DECLAREcpFunc(cpSeparate2ContigByRow) { tdata_t inbuf = _TIFFmalloc(TIFFScanlineSize(in)); tdata_t outbuf = _TIFFmalloc(TIFFScanlineSize(out)); register uint8 *inp, *outp; register uint32 n; uint32 row; tsample_t s; for (row = 0; row < imagelength; row++) { for (s = 0; s < spp; s++) { if (TIFFReadScanline(in, inbuf, row, s) < 0 && !ignore) { TIFFError(TIFFFileName(in), "Error, can't read scanline %lu", (unsigned long) row); goto bad; } inp = (uint8*)inbuf; outp = ((uint8*)outbuf) + s; for (n = imagewidth; n-- > 0;) { *outp = *inp++; outp += spp; } } if (TIFFWriteScanline(out, outbuf, row, 0) < 0) { TIFFError(TIFFFileName(out), "Error, can't write scanline %lu", (unsigned long) row); goto bad; } } if (inbuf) _TIFFfree(inbuf); if (outbuf) _TIFFfree(outbuf); return 1; bad: if (inbuf) _TIFFfree(inbuf); if (outbuf) _TIFFfree(outbuf); return 0; } tools/tiffcp.c:1046: error: Integer Overflow L2 ([0, `imagewidth`] - 1):unsigned32. tools/tiffcp.c:1025:1: <LHS trace> 1023. * Separate -> contig by row. 1024. */ 1025. DECLAREcpFunc(cpSeparate2ContigByRow) ^ 1026. { 1027. tdata_t inbuf = _TIFFmalloc(TIFFScanlineSize(in)); tools/tiffcp.c:1025:1: Parameter `imagewidth` 1023. * Separate -> contig by row. 1024. */ 1025. DECLAREcpFunc(cpSeparate2ContigByRow) ^ 1026. { 1027. tdata_t inbuf = _TIFFmalloc(TIFFScanlineSize(in)); tools/tiffcp.c:1046:9: Assignment 1044. inp = (uint8*)inbuf; 1045. outp = ((uint8*)outbuf) + s; 1046. for (n = imagewidth; n-- > 0;) { ^ 1047. *outp = *inp++; 1048. outp += spp; tools/tiffcp.c:1046:25: Binary operation: ([0, imagewidth] - 1):unsigned32 1044. inp = (uint8*)inbuf; 1045. outp = ((uint8*)outbuf) + s; 1046. for (n = imagewidth; n-- > 0;) { ^ 1047. *outp = *inp++; 1048. outp += spp;
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/tools/tiffcp.c/#L1046
d2a_code_trace_data_44459
void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, MPA_INT *window, int *dither_state, OUT_INT *samples, int incr, int32_t sb_samples[SBLIMIT]) { int32_t tmp[32]; register MPA_INT *synth_buf; register const MPA_INT *w, *w2, *p; int j, offset, v; OUT_INT *samples2; #if FRAC_BITS <= 15 int sum, sum2; #else int64_t sum, sum2; #endif dct32(tmp, sb_samples); offset = *synth_buf_offset; synth_buf = synth_buf_ptr + offset; for(j=0;j<32;j++) { v = tmp[j]; #if FRAC_BITS <= 15 v = av_clip_int16(v); #endif synth_buf[j] = v; } memcpy(synth_buf + 512, synth_buf, 32 * sizeof(MPA_INT)); samples2 = samples + 31 * incr; w = window; w2 = window + 31; sum = *dither_state; p = synth_buf + 16; SUM8(sum, +=, w, p); p = synth_buf + 48; SUM8(sum, -=, w + 32, p); *samples = round_sample(&sum); samples += incr; w++; for(j=1;j<16;j++) { sum2 = 0; p = synth_buf + 16 + j; SUM8P2(sum, +=, sum2, -=, w, w2, p); p = synth_buf + 48 - j; SUM8P2(sum, -=, sum2, -=, w + 32, w2 + 32, p); *samples = round_sample(&sum); samples += incr; sum += sum2; *samples2 = round_sample(&sum); samples2 -= incr; w++; w2--; } p = synth_buf + 32; SUM8(sum, -=, w + 32, p); *samples = round_sample(&sum); *dither_state= sum; offset = (offset - 32) & 511; *synth_buf_offset = offset; } libavcodec/mpc.c:60: error: Buffer Overrun L2 Offset: [464+min(0, `c->synth_buf_offset[*]`), 465+max(511, `c->synth_buf_offset[*]`)] (⇐ [16+min(0, `c->synth_buf_offset[*]`), 17+max(511, `c->synth_buf_offset[*]`)] + 448) Size: 2 by call to `ff_mpa_synth_filter`. libavcodec/mpc.c:51:1: Parameter `c->synth_buf[*]` 49. * Process decoded Musepack data and produce PCM 50. */ 51. static void mpc_synth(MPCContext *c, int16_t *out) ^ 52. { 53. int dither_state = 0; libavcodec/mpc.c:60:13: Call 58. samples_ptr = samples + ch; 59. for(i = 0; i < SAMPLES_PER_BAND; i++) { 60. ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]), ^ 61. mpa_window, &dither_state, 62. samples_ptr, 2, libavcodec/mpegaudiodec.c:858:1: <Length trace> 856. 32 samples. */ 857. /* XXX: optimize by avoiding ring buffer usage */ 858. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ^ 859. MPA_INT *window, int *dither_state, 860. OUT_INT *samples, int incr, libavcodec/mpegaudiodec.c:858:1: Parameter `*synth_buf_ptr` 856. 32 samples. */ 857. /* XXX: optimize by avoiding ring buffer usage */ 858. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ^ 859. MPA_INT *window, int *dither_state, 860. OUT_INT *samples, int incr, libavcodec/mpegaudiodec.c:877:5: Assignment 875. 876. offset = *synth_buf_offset; 877. synth_buf = synth_buf_ptr + offset; ^ 878. 879. for(j=0;j<32;j++) { libavcodec/mpegaudiodec.c:896:5: Assignment 894. 895. sum = *dither_state; 896. p = synth_buf + 16; ^ 897. SUM8(sum, +=, w, p); 898. p = synth_buf + 48; libavcodec/mpegaudiodec.c:897:5: Array access: Offset: [464+min(0, c->synth_buf_offset[*]), 465+max(511, c->synth_buf_offset[*])] (⇐ [16+min(0, c->synth_buf_offset[*]), 17+max(511, c->synth_buf_offset[*])] + 448) Size: 2 by call to `ff_mpa_synth_filter` 895. sum = *dither_state; 896. p = synth_buf + 16; 897. SUM8(sum, +=, w, p); ^ 898. p = synth_buf + 48; 899. SUM8(sum, -=, w + 32, p);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L897
d2a_code_trace_data_44460
static int check_cert(X509_STORE_CTX *ctx) { X509_CRL *crl = NULL, *dcrl = NULL; X509 *x = NULL; int ok = 0, cnum = 0; unsigned int last_reasons = 0; cnum = ctx->error_depth; x = sk_X509_value(ctx->chain, cnum); ctx->current_cert = x; ctx->current_issuer = NULL; ctx->current_crl_score = 0; ctx->current_reasons = 0; while (ctx->current_reasons != CRLDP_ALL_REASONS) { last_reasons = ctx->current_reasons; if (ctx->get_crl) ok = ctx->get_crl(ctx, &crl, x); else ok = get_crl_delta(ctx, &crl, &dcrl, x); if (!ok) { ctx->error = X509_V_ERR_UNABLE_TO_GET_CRL; ok = ctx->verify_cb(0, ctx); goto err; } ctx->current_crl = crl; ok = ctx->check_crl(ctx, crl); if (!ok) goto err; if (dcrl) { ok = ctx->check_crl(ctx, dcrl); if (!ok) goto err; ok = ctx->cert_crl(ctx, dcrl, x); if (!ok) goto err; } else ok = 1; if (ok != 2) { ok = ctx->cert_crl(ctx, crl, x); if (!ok) goto err; } X509_CRL_free(crl); X509_CRL_free(dcrl); crl = NULL; dcrl = NULL; if (last_reasons == ctx->current_reasons) { ctx->error = X509_V_ERR_UNABLE_TO_GET_CRL; ok = ctx->verify_cb(0, ctx); goto err; } } err: X509_CRL_free(crl); X509_CRL_free(dcrl); ctx->current_crl = NULL; return ok; } crypto/x509/x509_vfy.c:756: error: NULL_DEREFERENCE pointer `x` last assigned on line 745 could be null and is dereferenced by call to `get_crl_delta()` at line 756, column 18. Showing all 22 steps of the trace crypto/x509/x509_vfy.c:738:1: start of procedure check_cert() 736. } 737. 738. > static int check_cert(X509_STORE_CTX *ctx) 739. { 740. X509_CRL *crl = NULL, *dcrl = NULL; crypto/x509/x509_vfy.c:740:5: 738. static int check_cert(X509_STORE_CTX *ctx) 739. { 740. > X509_CRL *crl = NULL, *dcrl = NULL; 741. X509 *x = NULL; 742. int ok = 0, cnum = 0; crypto/x509/x509_vfy.c:741:5: 739. { 740. X509_CRL *crl = NULL, *dcrl = NULL; 741. > X509 *x = NULL; 742. int ok = 0, cnum = 0; 743. unsigned int last_reasons = 0; crypto/x509/x509_vfy.c:742:5: 740. X509_CRL *crl = NULL, *dcrl = NULL; 741. X509 *x = NULL; 742. > int ok = 0, cnum = 0; 743. unsigned int last_reasons = 0; 744. cnum = ctx->error_depth; crypto/x509/x509_vfy.c:743:5: 741. X509 *x = NULL; 742. int ok = 0, cnum = 0; 743. > unsigned int last_reasons = 0; 744. cnum = ctx->error_depth; 745. x = sk_X509_value(ctx->chain, cnum); crypto/x509/x509_vfy.c:744:5: 742. int ok = 0, cnum = 0; 743. unsigned int last_reasons = 0; 744. > cnum = ctx->error_depth; 745. x = sk_X509_value(ctx->chain, cnum); 746. ctx->current_cert = x; crypto/x509/x509_vfy.c:745:5: 743. unsigned int last_reasons = 0; 744. cnum = ctx->error_depth; 745. > x = sk_X509_value(ctx->chain, cnum); 746. ctx->current_cert = x; 747. ctx->current_issuer = NULL; include/openssl/x509.h:169:1: start of procedure sk_X509_value() 167. typedef struct x509_cinf_st X509_CINF; 168. 169. > DEFINE_STACK_OF(X509) 170. 171. /* This is used for a table of trust checking functions */ crypto/stack/stack.c:323:1: start of procedure sk_value() 321. } 322. 323. > void *sk_value(const _STACK *st, int i) 324. { 325. if (!st || (i < 0) || (i >= st->num)) crypto/stack/stack.c:325:10: Taking false branch 323. void *sk_value(const _STACK *st, int i) 324. { 325. if (!st || (i < 0) || (i >= st->num)) ^ 326. return NULL; 327. return st->data[i]; crypto/stack/stack.c:325:17: Taking true branch 323. void *sk_value(const _STACK *st, int i) 324. { 325. if (!st || (i < 0) || (i >= st->num)) ^ 326. return NULL; 327. return st->data[i]; crypto/stack/stack.c:326:9: 324. { 325. if (!st || (i < 0) || (i >= st->num)) 326. > return NULL; 327. return st->data[i]; 328. } crypto/stack/stack.c:328:1: return from a call to sk_value 326. return NULL; 327. return st->data[i]; 328. > } 329. 330. void *sk_set(_STACK *st, int i, void *value) include/openssl/x509.h:169:1: return from a call to sk_X509_value 167. typedef struct x509_cinf_st X509_CINF; 168. 169. > DEFINE_STACK_OF(X509) 170. 171. /* This is used for a table of trust checking functions */ crypto/x509/x509_vfy.c:746:5: 744. cnum = ctx->error_depth; 745. x = sk_X509_value(ctx->chain, cnum); 746. > ctx->current_cert = x; 747. ctx->current_issuer = NULL; 748. ctx->current_crl_score = 0; crypto/x509/x509_vfy.c:747:5: 745. x = sk_X509_value(ctx->chain, cnum); 746. ctx->current_cert = x; 747. > ctx->current_issuer = NULL; 748. ctx->current_crl_score = 0; 749. ctx->current_reasons = 0; crypto/x509/x509_vfy.c:748:5: 746. ctx->current_cert = x; 747. ctx->current_issuer = NULL; 748. > ctx->current_crl_score = 0; 749. ctx->current_reasons = 0; 750. while (ctx->current_reasons != CRLDP_ALL_REASONS) { crypto/x509/x509_vfy.c:749:5: 747. ctx->current_issuer = NULL; 748. ctx->current_crl_score = 0; 749. > ctx->current_reasons = 0; 750. while (ctx->current_reasons != CRLDP_ALL_REASONS) { 751. last_reasons = ctx->current_reasons; crypto/x509/x509_vfy.c:750:12: Loop condition is true. Entering loop body 748. ctx->current_crl_score = 0; 749. ctx->current_reasons = 0; 750. while (ctx->current_reasons != CRLDP_ALL_REASONS) { ^ 751. last_reasons = ctx->current_reasons; 752. /* Try to retrieve relevant CRL */ crypto/x509/x509_vfy.c:751:9: 749. ctx->current_reasons = 0; 750. while (ctx->current_reasons != CRLDP_ALL_REASONS) { 751. > last_reasons = ctx->current_reasons; 752. /* Try to retrieve relevant CRL */ 753. if (ctx->get_crl) crypto/x509/x509_vfy.c:753:13: Taking false branch 751. last_reasons = ctx->current_reasons; 752. /* Try to retrieve relevant CRL */ 753. if (ctx->get_crl) ^ 754. ok = ctx->get_crl(ctx, &crl, x); 755. else crypto/x509/x509_vfy.c:756:13: 754. ok = ctx->get_crl(ctx, &crl, x); 755. else 756. > ok = get_crl_delta(ctx, &crl, &dcrl, x); 757. /* 758. * If error looking up CRL, nothing we can do except notify callback
https://github.com/openssl/openssl/blob/0daccd4dc1f1ac62181738a91714f35472e50f3c/crypto/x509/x509_vfy.c/#L756
d2a_code_trace_data_44461
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) { int i, j, max; const BN_ULONG *ap; BN_ULONG *rp; max = n * 2; ap = a; rp = r; rp[0] = rp[max - 1] = 0; rp++; j = n; if (--j > 0) { ap++; rp[j] = bn_mul_words(rp, ap, j, ap[-1]); rp += 2; } for (i = n - 2; i > 0; i--) { j--; ap++; rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]); rp += 2; } bn_add_words(r, r, r, max); bn_sqr_words(tmp, a, n); bn_add_words(r, r, tmp, max); } test/rsa_sp800_56b_test.c:443: error: BUFFER_OVERRUN_L3 Offset: [31, +oo] Size: [0, 8388607] by call to `rsa_sp800_56b_check_keypair`. Showing all 23 steps of the trace test/rsa_sp800_56b_test.c:443:14: Call 441. && TEST_ptr(ctx = BN_CTX_new()) 442. /* NULL parameters */ 443. && TEST_false(rsa_sp800_56b_check_keypair(key, NULL, -1, 2048)) ^ 444. /* load key */ 445. && TEST_ptr(p = bn_load_new(cav_p, sizeof(cav_p))) crypto/rsa/rsa_sp800_56b_check.c:316:1: Parameter `rsa->dmp1->top` 314. * 6.4.1.3.3 "rsakpv2 - crt" 315. */ 316. > int rsa_sp800_56b_check_keypair(const RSA *rsa, const BIGNUM *efixed, 317. int strength, int nbits) 318. { crypto/rsa/rsa_sp800_56b_check.c:377:14: Call 375. && rsa_check_private_exponent(rsa, nbits, ctx) 376. /* 6.4.1.2.3 (Step 7): Check the CRT components */ 377. && rsa_check_crt_components(rsa, ctx); ^ 378. if (ret != 1) 379. RSAerr(RSA_F_RSA_SP800_56B_CHECK_KEYPAIR, RSA_R_INVALID_KEYPAIR); crypto/rsa/rsa_sp800_56b_check.c:24:1: Parameter `rsa->dmp1->top` 22. * 6.4.1.3.3: rsakpv2-crt Step 7 23. */ 24. > int rsa_check_crt_components(const RSA *rsa, BN_CTX *ctx) 25. { 26. int ret = 0; crypto/rsa/rsa_sp800_56b_check.c:48:15: Call 46. && BN_sub_word(q1, 1) 47. /* (a) 1 < dP < (p – 1). */ 48. && (BN_cmp(rsa->dmp1, BN_value_one()) > 0) ^ 49. && (BN_cmp(rsa->dmp1, p1) < 0) 50. /* (b) 1 < dQ < (q - 1). */ crypto/bn/bn_lib.c:581:1: Parameter `a->top` 579. } 580. 581. > int BN_cmp(const BIGNUM *a, const BIGNUM *b) 582. { 583. int i; crypto/rsa/rsa_sp800_56b_check.c:49:15: Call 47. /* (a) 1 < dP < (p – 1). */ 48. && (BN_cmp(rsa->dmp1, BN_value_one()) > 0) 49. && (BN_cmp(rsa->dmp1, p1) < 0) ^ 50. /* (b) 1 < dQ < (q - 1). */ 51. && (BN_cmp(rsa->dmq1, BN_value_one()) > 0) crypto/bn/bn_lib.c:581:1: Parameter `a->top` 579. } 580. 581. > int BN_cmp(const BIGNUM *a, const BIGNUM *b) 582. { 583. int i; crypto/rsa/rsa_sp800_56b_check.c:57:14: Call 55. && (BN_cmp(rsa->iqmp, rsa->p) < 0) 56. /* (d) 1 = (dP . e) mod (p - 1)*/ 57. && BN_mod_mul(r, rsa->dmp1, rsa->e, p1, ctx) ^ 58. && BN_is_one(r) 59. /* (e) 1 = (dQ . e) mod (q - 1) */ crypto/bn/bn_mod.c:193:1: Parameter `a->top` 191. 192. /* slow but works */ 193. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 194. BN_CTX *ctx) 195. { crypto/bn/bn_mod.c:207:14: Call 205. goto err; 206. if (a == b) { 207. if (!BN_sqr(t, a, ctx)) ^ 208. goto err; 209. } else { crypto/bn/bn_sqr.c:17:1: Parameter `*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 `a->top` 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:35:5: Assignment 33. bn_check_top(a); 34. 35. al = a->top; ^ 36. if (al <= 0) { 37. r->top = 0; crypto/bn/bn_sqr.c:84:17: Call 82. if (bn_wexpand(tmp, max) == NULL) 83. goto err; 84. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 85. } 86. } crypto/bn/bn_sqr.c:109:1: <Offset trace> 107. 108. /* tmp must have 2*n words */ 109. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 110. { 111. int i, j, max; crypto/bn/bn_sqr.c:109:1: Parameter `n` 107. 108. /* tmp must have 2*n words */ 109. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 110. { 111. int i, j, max; crypto/bn/bn_sqr.c:115:5: Assignment 113. BN_ULONG *rp; 114. 115. max = n * 2; ^ 116. ap = a; 117. rp = r; crypto/bn/bn_sqr.c:109:1: <Length trace> 107. 108. /* tmp must have 2*n words */ 109. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 110. { 111. int i, j, max; crypto/bn/bn_sqr.c:109:1: Parameter `*r` 107. 108. /* tmp must have 2*n words */ 109. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 110. { 111. int i, j, max; crypto/bn/bn_sqr.c:117:5: Assignment 115. max = n * 2; 116. ap = a; 117. rp = r; ^ 118. rp[0] = rp[max - 1] = 0; 119. rp++; crypto/bn/bn_sqr.c:118:13: Array access: Offset: [31, +oo] Size: [0, 8388607] by call to `rsa_sp800_56b_check_keypair` 116. ap = a; 117. rp = r; 118. rp[0] = rp[max - 1] = 0; ^ 119. rp++; 120. j = n;
https://github.com/openssl/openssl/blob/260a16f33682a819414fcba6161708a5e6bdff50/crypto/bn/bn_sqr.c/#L118
d2a_code_trace_data_44462
static int ssl_cipher_process_rulestr(const char *rule_str, CIPHER_ORDER **head_p, CIPHER_ORDER **tail_p, SSL_CIPHER **ca_list) { unsigned long alg_mkey, alg_auth, alg_enc, alg_mac, alg_ssl, algo_strength; const char *l, *start, *buf; int j, multi, found, rule, retval, ok, buflen; unsigned long 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; alg_ssl = 0; algo_strength = 0; start=l; for (;;) { ch = *l; buf = l; buflen = 0; #ifndef CHARSET_EBCDIC while ( ((ch >= 'A') && (ch <= 'Z')) || ((ch >= '0') && (ch <= '9')) || ((ch >= 'a') && (ch <= 'z')) || (ch == '-')) #else while ( isalnum(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) && (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_EXP_MASK) { if (algo_strength & SSL_EXP_MASK) { algo_strength &= (ca_list[j]->algo_strength & SSL_EXP_MASK) | ~SSL_EXP_MASK; if (!(algo_strength & SSL_EXP_MASK)) { found = 0; break; } } else algo_strength |= ca_list[j]->algo_strength & SSL_EXP_MASK; } 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]->valid) { cipher_id = ca_list[j]->id; } else { if (ca_list[j]->algorithm_ssl) { if (alg_ssl) { alg_ssl &= ca_list[j]->algorithm_ssl; if (!alg_ssl) { found = 0; break; } } else alg_ssl = ca_list[j]->algorithm_ssl; } } if (!multi) break; } if (rule == CIPHER_SPECIAL) { ok = 0; if ((buflen == 8) && !strncmp(buf, "STRENGTH", 8)) ok = ssl_cipher_strength_sort(head_p, tail_p); 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, alg_ssl, algo_strength, rule, -1, head_p, tail_p); } else { while ((*l != '\0') && !ITEM_SEP(*l)) l++; } if (*l == '\0') break; } return(retval); } ssl/ssl_ciph.c:1115: error: UNINITIALIZED_VALUE The value read from found was never initialized. Showing all 1 steps of the trace ssl/ssl_ciph.c:1115:12: 1113. l++; 1114. } 1115. > else if (found) 1116. { 1117. ssl_cipher_apply_rule(cipher_id,
https://github.com/openssl/openssl/blob/02756aa8ba36af6e718d7a07c4e6bd8ad12e7ba1/ssl/ssl_ciph.c/#L1115
d2a_code_trace_data_44463
static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, OPENSSL_LH_DOALL_FUNC func, OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) { int i; OPENSSL_LH_NODE *a, *n; if (lh == NULL) return; for (i = lh->num_nodes - 1; i >= 0; i--) { a = lh->b[i]; while (a != NULL) { n = a->next; if (use_arg) func_arg(a->data, arg); else func(a->data); a = n; } } } apps/s_server.c:2426: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `SSL_free`. Showing all 16 steps of the trace apps/s_server.c:2048:15: Call 2046. 2047. if (con == NULL) { 2048. con = SSL_new(ctx); ^ 2049. 2050. if (s_tlsextdebug) { ssl/ssl_lib.c:518:1: Parameter `ctx->sessions->num_nodes` 516. } 517. 518. > SSL *SSL_new(SSL_CTX *ctx) 519. { 520. SSL *s; apps/s_server.c:2426:9: Call 2424. BIO_printf(bio_s_out, "shutting down SSL\n"); 2425. SSL_set_shutdown(con, SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN); 2426. SSL_free(con); ^ 2427. } 2428. BIO_printf(bio_s_out, "CONNECTION CLOSED\n"); ssl/ssl_lib.c:926:1: Parameter `s->ctx->sessions->num_nodes` 924. } 925. 926. > void SSL_free(SSL *s) 927. { 928. int i; ssl/ssl_lib.c:998:5: Call 996. RECORD_LAYER_release(&s->rlayer); 997. 998. SSL_CTX_free(s->ctx); ^ 999. 1000. ASYNC_WAIT_CTX_free(s->waitctx); ssl/ssl_lib.c:2429:1: Parameter `a->sessions->num_nodes` 2427. } 2428. 2429. > void SSL_CTX_free(SSL_CTX *a) 2430. { 2431. int i; ssl/ssl_lib.c:2455:9: Call 2453. */ 2454. if (a->sessions != NULL) 2455. SSL_CTX_flush_sessions(a, 0); ^ 2456. 2457. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:974:1: Parameter `s->sessions->num_nodes` 972. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 973. 974. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 975. { 976. unsigned long i; ssl/ssl_sess.c:987:5: Call 985. i = lh_SSL_SESSION_get_down_load(s->sessions); 986. lh_SSL_SESSION_set_down_load(s->sessions, 0); 987. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp); ^ 988. lh_SSL_SESSION_set_down_load(s->sessions, i); 989. CRYPTO_THREAD_unlock(s->lock); ssl/ssl_sess.c:972:1: Parameter `lh->num_nodes` 970. } 971. 972. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 973. 974. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) ssl/ssl_sess.c:972:1: Call 970. } 971. 972. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 973. 974. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) crypto/lhash/lhash.c:182:1: Parameter `lh->num_nodes` 180. } 181. 182. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); crypto/lhash/lhash.c:184:5: Call 182. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); ^ 185. } 186. crypto/lhash/lhash.c:150:1: <LHS trace> 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:150:1: Parameter `lh->num_nodes` 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:164:10: Binary operation: ([0, +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/2a7de0fd5d9baf946ef4d2c51096b04dd47a8143/crypto/lhash/lhash.c/#L164
d2a_code_trace_data_44464
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } crypto/ec/ecdh_ossl.c:81: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `EC_POINT_mul`. Showing all 25 steps of the trace crypto/ec/ecdh_ossl.c:81:10: Call 79. } 80. 81. if (!EC_POINT_mul(group, tmp, NULL, pub_key, priv_key, ctx)) { ^ 82. ECerr(EC_F_ECDH_SIMPLE_COMPUTE_KEY, EC_R_POINT_ARITHMETIC_FAILURE); 83. goto err; crypto/ec/ec_lib.c:971:1: Parameter `r->X->top` 969. } 970. 971. > int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, 972. const EC_POINT *point, const BIGNUM *p_scalar, BN_CTX *ctx) 973. { crypto/ec/ec_lib.c:982:12: Call 980. scalars[0] = p_scalar; 981. 982. return EC_POINTs_mul(group, r, g_scalar, ^ 983. (point != NULL 984. && p_scalar != NULL), points, scalars, ctx); crypto/ec/ec_lib.c:933:1: Parameter `r->X->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 `r->X->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:453:20: Call 451. * always call the ladder version. 452. */ 453. return ec_scalar_mul_ladder(group, r, scalar, NULL, ctx); ^ 454. } 455. if ((scalar == NULL) && (num == 1) && (scalars[0] != group->order)) { crypto/ec/ec_mult.c:139:1: Parameter `r->X->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:253:13: Call 251. || (bn_wexpand(s->Y, group_top) == NULL) 252. || (bn_wexpand(s->Z, group_top) == NULL) 253. || (bn_wexpand(r->X, group_top) == NULL) ^ 254. || (bn_wexpand(r->Y, group_top) == NULL) 255. || (bn_wexpand(r->Z, group_top) == NULL) 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 `EC_POINT_mul` 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/3051bf2afab7ac8b7b9c64e68755d1addd2fb8ff/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_44465
static size_t kat_entropy(RAND_DRBG *drbg, unsigned char **pout, int entropy, size_t min_len, size_t max_len, int prediction_resistance) { TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); t->entropycnt++; *pout = (unsigned char *)t->entropy; return t->entropylen; } test/drbgtest.c:150: error: NULL_DEREFERENCE pointer `t` last assigned on line 148 could be null and is dereferenced at line 150, column 5. Showing all 10 steps of the trace test/drbgtest.c:144:1: start of procedure kat_entropy() 142. } TEST_CTX; 143. 144. > static size_t kat_entropy(RAND_DRBG *drbg, unsigned char **pout, 145. int entropy, size_t min_len, size_t max_len, 146. int prediction_resistance) test/drbgtest.c:148:5: 146. int prediction_resistance) 147. { 148. > TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); 149. 150. t->entropycnt++; crypto/rand/drbg_lib.c:1108:1: start of procedure RAND_DRBG_get_ex_data() 1106. } 1107. 1108. > void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx) 1109. { 1110. return CRYPTO_get_ex_data(&drbg->ex_data, idx); crypto/rand/drbg_lib.c:1110:5: 1108. void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx) 1109. { 1110. > return CRYPTO_get_ex_data(&drbg->ex_data, idx); 1111. } 1112. crypto/ex_data.c:458:1: start of procedure CRYPTO_get_ex_data() 456. * particular index in the class used by this variable 457. */ 458. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 459. { 460. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) crypto/ex_data.c:460:9: Taking true branch 458. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 459. { 460. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) ^ 461. return NULL; 462. return sk_void_value(ad->sk, idx); crypto/ex_data.c:461:9: 459. { 460. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) 461. > return NULL; 462. return sk_void_value(ad->sk, idx); 463. } crypto/ex_data.c:463:1: return from a call to CRYPTO_get_ex_data 461. return NULL; 462. return sk_void_value(ad->sk, idx); 463. > } 464. 465. OPENSSL_CTX *crypto_ex_data_get_openssl_ctx(const CRYPTO_EX_DATA *ad) crypto/rand/drbg_lib.c:1111:1: return from a call to RAND_DRBG_get_ex_data 1109. { 1110. return CRYPTO_get_ex_data(&drbg->ex_data, idx); 1111. > } 1112. 1113. test/drbgtest.c:150:5: 148. TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); 149. 150. > t->entropycnt++; 151. *pout = (unsigned char *)t->entropy; 152. return t->entropylen;
https://github.com/openssl/openssl/blob/6b3d0423528b049d04b299a8588a32d5c1224717/test/drbgtest.c/#L150
d2a_code_trace_data_44466
static void opt_input_ts_scale(const char *arg) { unsigned int stream; double scale; char *p; stream = strtol(arg, &p, 0); if (*p) p++; scale= strtod(p, &p); if(stream >= MAX_STREAMS) ffmpeg_exit(1); input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); input_files_ts_scale[nb_input_files][stream]= scale; } ffmpeg.c:3085: error: Null Dereference pointer `input_files_ts_scale[nb_input_files]` last assigned on line 3084 could be null and is dereferenced at line 3085, column 5. ffmpeg.c:3070:1: start of procedure opt_input_ts_scale() 3068. } 3069. 3070. static void opt_input_ts_scale(const char *arg) ^ 3071. { 3072. unsigned int stream; ffmpeg.c:3076:5: 3074. char *p; 3075. 3076. stream = strtol(arg, &p, 0); ^ 3077. if (*p) 3078. p++; ffmpeg.c:3077:9: Taking true branch 3075. 3076. stream = strtol(arg, &p, 0); 3077. if (*p) ^ 3078. p++; 3079. scale= strtod(p, &p); ffmpeg.c:3078:9: 3076. stream = strtol(arg, &p, 0); 3077. if (*p) 3078. p++; ^ 3079. scale= strtod(p, &p); 3080. ffmpeg.c:3079:5: 3077. if (*p) 3078. p++; 3079. scale= strtod(p, &p); ^ 3080. 3081. if(stream >= MAX_STREAMS) ffmpeg.c:3081:8: Taking true branch 3079. scale= strtod(p, &p); 3080. 3081. if(stream >= MAX_STREAMS) ^ 3082. ffmpeg_exit(1); 3083. ffmpeg.c:3082:9: Skipping ffmpeg_exit(): empty list of specs 3080. 3081. if(stream >= MAX_STREAMS) 3082. ffmpeg_exit(1); ^ 3083. 3084. input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); ffmpeg.c:3084:5: 3082. ffmpeg_exit(1); 3083. 3084. input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); ^ 3085. input_files_ts_scale[nb_input_files][stream]= scale; 3086. } ffmpeg.c:511:1: start of procedure grow_array() 509. 510. /* similar to ff_dynarray_add() and av_fast_realloc() */ 511. static void *grow_array(void *array, int elem_size, int *size, int new_size) ^ 512. { 513. if (new_size >= INT_MAX / elem_size) { ffmpeg.c:513:9: Taking true branch 511. static void *grow_array(void *array, int elem_size, int *size, int new_size) 512. { 513. if (new_size >= INT_MAX / elem_size) { ^ 514. fprintf(stderr, "Array too big.\n"); 515. ffmpeg_exit(1); ffmpeg.c:514:9: 512. { 513. if (new_size >= INT_MAX / elem_size) { 514. fprintf(stderr, "Array too big.\n"); ^ 515. ffmpeg_exit(1); 516. } ffmpeg.c:515:9: Skipping ffmpeg_exit(): empty list of specs 513. if (new_size >= INT_MAX / elem_size) { 514. fprintf(stderr, "Array too big.\n"); 515. ffmpeg_exit(1); ^ 516. } 517. if (*size < new_size) { ffmpeg.c:517:9: Taking true branch 515. ffmpeg_exit(1); 516. } 517. if (*size < new_size) { ^ 518. uint8_t *tmp = av_realloc(array, new_size*elem_size); 519. if (!tmp) { ffmpeg.c:518:9: 516. } 517. if (*size < new_size) { 518. uint8_t *tmp = av_realloc(array, new_size*elem_size); ^ 519. if (!tmp) { 520. fprintf(stderr, "Could not alloc buffer.\n"); libavutil/mem.c:117:1: start of procedure av_realloc() 115. } 116. 117. void *av_realloc(void *ptr, size_t size) ^ 118. { 119. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:124:8: Taking false branch 122. 123. /* let's disallow possible ambiguous cases */ 124. if(size > (INT_MAX-16) ) ^ 125. return NULL; 126. libavutil/mem.c:133:5: 131. return (char*)realloc((char*)ptr - diff, size + diff) + diff; 132. #else 133. return realloc(ptr, size); ^ 134. #endif 135. } libavutil/mem.c:135:1: return from a call to av_realloc 133. return realloc(ptr, size); 134. #endif 135. } ^ 136. 137. void av_free(void *ptr) ffmpeg.c:519:14: Taking true branch 517. if (*size < new_size) { 518. uint8_t *tmp = av_realloc(array, new_size*elem_size); 519. if (!tmp) { ^ 520. fprintf(stderr, "Could not alloc buffer.\n"); 521. ffmpeg_exit(1); ffmpeg.c:520:13: 518. uint8_t *tmp = av_realloc(array, new_size*elem_size); 519. if (!tmp) { 520. fprintf(stderr, "Could not alloc buffer.\n"); ^ 521. ffmpeg_exit(1); 522. } ffmpeg.c:521:13: Skipping ffmpeg_exit(): empty list of specs 519. if (!tmp) { 520. fprintf(stderr, "Could not alloc buffer.\n"); 521. ffmpeg_exit(1); ^ 522. } 523. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); ffmpeg.c:523:9: 521. ffmpeg_exit(1); 522. } 523. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); ^ 524. *size = new_size; 525. return tmp; ffmpeg.c:524:9: 522. } 523. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); 524. *size = new_size; ^ 525. return tmp; 526. } ffmpeg.c:525:9: 523. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); 524. *size = new_size; 525. return tmp; ^ 526. } 527. return array; ffmpeg.c:528:1: return from a call to grow_array 526. } 527. return array; 528. } ^ 529. 530. static void choose_sample_fmt(AVStream *st, AVCodec *codec) ffmpeg.c:3085:5: 3083. 3084. input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); 3085. input_files_ts_scale[nb_input_files][stream]= scale; ^ 3086. } 3087.
https://github.com/libav/libav/blob/41e21e4db623ebd77f431a6f30cf21d62d9e1f33/ffmpeg.c/#L3085
d2a_code_trace_data_44467
static int epzs_motion_search4(MpegEncContext * s, int *mx_ptr, int *my_ptr, int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], int ref_mv_scale) { MotionEstContext * const c= &s->me; int best[2]={0, 0}; int d, dmin; int map_generation; const int penalty_factor= c->penalty_factor; const int size=1; const int h=8; const int ref_mv_stride= s->mb_stride; const int ref_mv_xy= s->mb_x + s->mb_y *ref_mv_stride; me_cmp_func cmpf, chroma_cmpf; LOAD_COMMON int flags= c->flags; LOAD_COMMON2 cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; map_generation= update_map_generation(c); dmin = 1000000; if (s->first_slice_line) { CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift) }else{ CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift) CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift) CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift) CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) } if(dmin>64*4){ CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) if(s->mb_y+1<s->end_mb_y) CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) } dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); *mx_ptr= best[0]; *my_ptr= best[1]; return dmin; } libavcodec/motion_est_template.c:1168: error: Uninitialized Value The value read from ymin was never initialized. libavcodec/motion_est_template.c:1168:9: 1166. CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift) 1167. CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) 1168. CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift) ^ 1169. CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) 1170. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1168
d2a_code_trace_data_44468
static void rtmp_calc_digest(const uint8_t *src, int len, int gap, const uint8_t *key, int keylen, uint8_t *dst) { struct AVSHA *sha; uint8_t hmac_buf[64+32] = {0}; int i; sha = av_mallocz(av_sha_size); if (keylen < 64) { memcpy(hmac_buf, key, keylen); } else { av_sha_init(sha, 256); av_sha_update(sha,key, keylen); av_sha_final(sha, hmac_buf); } for (i = 0; i < 64; i++) hmac_buf[i] ^= HMAC_IPAD_VAL; av_sha_init(sha, 256); av_sha_update(sha, hmac_buf, 64); if (gap <= 0) { av_sha_update(sha, src, len); } else { av_sha_update(sha, src, gap); av_sha_update(sha, src + gap + 32, len - gap - 32); } av_sha_final(sha, hmac_buf + 64); for (i = 0; i < 64; i++) hmac_buf[i] ^= HMAC_IPAD_VAL ^ HMAC_OPAD_VAL; av_sha_init(sha, 256); av_sha_update(sha, hmac_buf, 64+32); av_sha_final(sha, dst); av_free(sha); } libavformat/rtmpproto.c:418: error: Null Dereference pointer `sha` last assigned on line 406 could be null and is dereferenced by call to `av_sha_init()` at line 418, column 5. libavformat/rtmpproto.c:399:1: start of procedure rtmp_calc_digest() 397. * @param dst buffer where calculated digest will be stored (32 bytes) 398. */ 399. static void rtmp_calc_digest(const uint8_t *src, int len, int gap, ^ 400. const uint8_t *key, int keylen, uint8_t *dst) 401. { libavformat/rtmpproto.c:403:5: 401. { 402. struct AVSHA *sha; 403. uint8_t hmac_buf[64+32] = {0}; ^ 404. int i; 405. libavformat/rtmpproto.c:406:5: 404. int i; 405. 406. sha = av_mallocz(av_sha_size); ^ 407. 408. if (keylen < 64) { libavutil/mem.c:156:1: start of procedure av_mallocz() 154. } 155. 156. void *av_mallocz(size_t size) ^ 157. { 158. void *ptr = av_malloc(size); libavutil/mem.c:158:5: 156. void *av_mallocz(size_t size) 157. { 158. void *ptr = av_malloc(size); ^ 159. if (ptr) 160. memset(ptr, 0, size); libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(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:71:5: 69. #endif 70. 71. assert(size); ^ 72. 73. /* let's disallow possible ambiguous cases */ libavutil/mem.c:74:9: Taking true branch 72. 73. /* let's disallow possible ambiguous cases */ 74. if (size > (INT_MAX-32) || !size) ^ 75. return NULL; 76. libavutil/mem.c:75:9: 73. /* let's disallow possible ambiguous cases */ 74. if (size > (INT_MAX-32) || !size) 75. return NULL; ^ 76. 77. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:117:1: return from a call to av_malloc 115. #endif 116. return ptr; 117. } ^ 118. 119. void *av_realloc(void *ptr, size_t size) libavutil/mem.c:159:9: Taking false branch 157. { 158. void *ptr = av_malloc(size); 159. if (ptr) ^ 160. memset(ptr, 0, size); 161. return ptr; libavutil/mem.c:161:5: 159. if (ptr) 160. memset(ptr, 0, size); 161. return ptr; ^ 162. } 163. libavutil/mem.c:162:1: return from a call to av_mallocz 160. memset(ptr, 0, size); 161. return ptr; 162. } ^ 163. 164. char *av_strdup(const char *s) libavformat/rtmpproto.c:408:9: Taking true branch 406. sha = av_mallocz(av_sha_size); 407. 408. if (keylen < 64) { ^ 409. memcpy(hmac_buf, key, keylen); 410. } else { libavformat/rtmpproto.c:409:9: 407. 408. if (keylen < 64) { 409. memcpy(hmac_buf, key, keylen); ^ 410. } else { 411. av_sha_init(sha, 256); libavformat/rtmpproto.c:415:10: 413. av_sha_final(sha, hmac_buf); 414. } 415. for (i = 0; i < 64; i++) ^ 416. hmac_buf[i] ^= HMAC_IPAD_VAL; 417. libavformat/rtmpproto.c:415:17: Loop condition is true. Entering loop body 413. av_sha_final(sha, hmac_buf); 414. } 415. for (i = 0; i < 64; i++) ^ 416. hmac_buf[i] ^= HMAC_IPAD_VAL; 417. libavformat/rtmpproto.c:416:9: 414. } 415. for (i = 0; i < 64; i++) 416. hmac_buf[i] ^= HMAC_IPAD_VAL; ^ 417. 418. av_sha_init(sha, 256); libavformat/rtmpproto.c:415:25: 413. av_sha_final(sha, hmac_buf); 414. } 415. for (i = 0; i < 64; i++) ^ 416. hmac_buf[i] ^= HMAC_IPAD_VAL; 417. libavformat/rtmpproto.c:415:17: Loop condition is false. Leaving loop 413. av_sha_final(sha, hmac_buf); 414. } 415. for (i = 0; i < 64; i++) ^ 416. hmac_buf[i] ^= HMAC_IPAD_VAL; 417. libavformat/rtmpproto.c:418:5: 416. hmac_buf[i] ^= HMAC_IPAD_VAL; 417. 418. av_sha_init(sha, 256); ^ 419. av_sha_update(sha, hmac_buf, 64); 420. if (gap <= 0) { libavutil/sha.c:246:1: start of procedure av_sha_init() 244. 245. 246. int av_sha_init(AVSHA* ctx, int bits) ^ 247. { 248. ctx->digest_len = bits >> 5; libavutil/sha.c:248:5: 246. int av_sha_init(AVSHA* ctx, int bits) 247. { 248. ctx->digest_len = bits >> 5; ^ 249. switch (bits) { 250. case 160: // SHA-1
https://github.com/libav/libav/blob/af2f655c02c69aa615eb2a06000a1aa35916967a/libavformat/rtmpproto.c/#L418
d2a_code_trace_data_44469
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *A, *a = NULL; const BN_ULONG *B; int i; bn_check_top(b); if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return (NULL); } if (BN_get_flags(b,BN_FLG_SECURE)) a = A = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = A = OPENSSL_zalloc(words * sizeof(*a)); if (A == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return (NULL); } #if 1 B = b->d; if (B != NULL) { for (i = b->top >> 2; i > 0; i--, A += 4, B += 4) { BN_ULONG a0, a1, a2, a3; a0 = B[0]; a1 = B[1]; a2 = B[2]; a3 = B[3]; A[0] = a0; A[1] = a1; A[2] = a2; A[3] = a3; } switch (b->top & 3) { case 3: A[2] = B[2]; case 2: A[1] = B[1]; case 1: A[0] = B[0]; case 0: ; } } #else memset(A, 0, sizeof(*A) * words); memcpy(A, b->d, sizeof(b->d[0]) * b->top); #endif return (a); } crypto/dh/dh_check.c:158: error: BUFFER_OVERRUN_L3 Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, 8388607] by call to `BN_copy`. Showing all 14 steps of the trace crypto/dh/dh_check.c:153:11: Call 151. goto err; 152. BN_CTX_start(ctx); 153. tmp = BN_CTX_get(ctx); ^ 154. if (tmp == NULL || !BN_set_word(tmp, 1)) 155. goto err; crypto/bn/bn_ctx.c:283:5: Call 281. } 282. /* OK, make sure the returned bignum is "zero" */ 283. BN_zero(ret); ^ 284. ctx->used++; 285. CTXDBG_RET(ctx, ret); crypto/bn/bn_lib.c:520:1: Parameter `*a->d` 518. } 519. 520. > int BN_set_word(BIGNUM *a, BN_ULONG w) 521. { 522. bn_check_top(a); crypto/dh/dh_check.c:158:9: Call 156. if (BN_cmp(pub_key, tmp) <= 0) 157. *ret |= DH_CHECK_PUBKEY_TOO_SMALL; 158. if (BN_copy(tmp, dh->p) == NULL || !BN_sub_word(tmp, 1)) ^ 159. goto err; 160. if (BN_cmp(pub_key, tmp) >= 0) crypto/bn/bn_lib.c:419:1: Parameter `*a->d` 417. } 418. 419. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 420. { 421. int i; crypto/bn/bn_lib.c:429:9: Call 427. if (a == b) 428. return (a); 429. if (bn_wexpand(a, b->top) == NULL) ^ 430. return (NULL); 431. crypto/bn/bn_lib.c:985:1: Parameter `*a->d` 983. } 984. 985. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 986. { 987. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:987:37: Call 985. BIGNUM *bn_wexpand(BIGNUM *a, int words) 986. { 987. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 988. } 989. crypto/bn/bn_lib.c:380:1: Parameter `*b->d` 378. */ 379. 380. > BIGNUM *bn_expand2(BIGNUM *b, int words) 381. { 382. bn_check_top(b); crypto/bn/bn_lib.c:385:23: Call 383. 384. if (words > b->dmax) { 385. BN_ULONG *a = bn_expand_internal(b, words); ^ 386. if (!a) 387. return NULL; crypto/bn/bn_lib.c:299:1: <Length trace> 297. /* This is used by bn_expand2() */ 298. /* The caller MUST check that words > b->dmax before calling this */ 299. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 300. { 301. BN_ULONG *A, *a = NULL; crypto/bn/bn_lib.c:299:1: Parameter `*b->d` 297. /* This is used by bn_expand2() */ 298. /* The caller MUST check that words > b->dmax before calling this */ 299. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 300. { 301. BN_ULONG *A, *a = NULL; crypto/bn/bn_lib.c:325:5: Assignment 323. 324. #if 1 325. B = b->d; ^ 326. /* Check if the previous number needs to be copied */ 327. if (B != NULL) { crypto/bn/bn_lib.c:342:18: Array access: Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, 8388607] by call to `BN_copy` 340. a1 = B[1]; 341. a2 = B[2]; 342. a3 = B[3]; ^ 343. A[0] = a0; 344. A[1] = a1;
https://github.com/openssl/openssl/blob/c10d1bc81cb047cbd53f8cc430632b6a4a70252d/crypto/bn/bn_lib.c/#L342
d2a_code_trace_data_44470
IMPLEMENT_new_ctx(ctr, CTR, 128) providers/common/ciphers/aes.c:320: error: NULL_DEREFERENCE pointer `ctx` last assigned on line 320 could be null and is dereferenced at line 320, column 1. Showing all 18 steps of the trace providers/common/ciphers/aes.c:320:1: start of procedure aes_128_ctr_newctx() 318. IMPLEMENT_new_ctx(ctr, CTR, 256) 319. IMPLEMENT_new_ctx(ctr, CTR, 192) 320. > IMPLEMENT_new_ctx(ctr, CTR, 128) 321. 322. static void aes_freectx(void *vctx) crypto/mem.c:228:1: start of procedure CRYPTO_zalloc() 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:5: 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. > void *ret = CRYPTO_malloc(num, file, line); 231. 232. FAILTEST(); crypto/mem.c:192:1: start of procedure CRYPTO_malloc() 190. #endif 191. 192. > void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. void *ret = NULL; crypto/mem.c:194:5: 192. void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. > void *ret = NULL; 195. 196. INCREMENT(malloc_count); crypto/mem.c:197:9: Taking false branch 195. 196. INCREMENT(malloc_count); 197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 198. return malloc_impl(num, file, line); 199. crypto/mem.c:200:9: Taking false branch 198. return malloc_impl(num, file, line); 199. 200. if (num == 0) ^ 201. return NULL; 202. crypto/mem.c:204:9: Taking true branch 202. 203. FAILTEST(); 204. if (allow_customize) { ^ 205. /* 206. * Disallow customization after the first allocation. We only set this crypto/mem.c:210:9: 208. * allocation. 209. */ 210. > allow_customize = 0; 211. } 212. #if !defined(OPENSSL_NO_CRYPTO_MDEBUG) && !defined(FIPS_MODE) crypto/mem.c:221:5: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:221:19: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:222:5: 220. #else 221. (void)(file); (void)(line); 222. > ret = malloc(num); 223. #endif 224. crypto/mem.c:225:5: 223. #endif 224. 225. > return ret; 226. } 227. crypto/mem.c:226:1: return from a call to CRYPTO_malloc 224. 225. return ret; 226. > } 227. 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:233:9: Taking false branch 231. 232. FAILTEST(); 233. if (ret != NULL) ^ 234. memset(ret, 0, num); 235. return ret; crypto/mem.c:235:5: 233. if (ret != NULL) 234. memset(ret, 0, num); 235. > return ret; 236. } 237. crypto/mem.c:236:1: return from a call to CRYPTO_zalloc 234. memset(ret, 0, num); 235. return ret; 236. > } 237. 238. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) providers/common/ciphers/aes.c:320:1: 318. IMPLEMENT_new_ctx(ctr, CTR, 256) 319. IMPLEMENT_new_ctx(ctr, CTR, 192) 320. > IMPLEMENT_new_ctx(ctr, CTR, 128) 321. 322. static void aes_freectx(void *vctx)
https://github.com/openssl/openssl/blob/f79858ac4d90a450d0620d1ecb713bc35d7d9f8d/providers/common/ciphers/aes.c/#L320
d2a_code_trace_data_44471
static int mov_write_ctts_tag(AVIOContext *pb, MOVTrack *track) { MOVStts *ctts_entries; uint32_t entries = 0; uint32_t atom_size; int i; ctts_entries = av_malloc((track->entry + 1) * sizeof(*ctts_entries)); ctts_entries[0].count = 1; ctts_entries[0].duration = track->cluster[0].cts; for (i = 1; i < track->entry; i++) { if (track->cluster[i].cts == ctts_entries[entries].duration) { ctts_entries[entries].count++; } else { entries++; ctts_entries[entries].duration = track->cluster[i].cts; ctts_entries[entries].count = 1; } } entries++; atom_size = 16 + (entries * 8); avio_wb32(pb, atom_size); ffio_wfourcc(pb, "ctts"); avio_wb32(pb, 0); avio_wb32(pb, entries); for (i = 0; i < entries; i++) { avio_wb32(pb, ctts_entries[i].count); avio_wb32(pb, ctts_entries[i].duration); } av_free(ctts_entries); return atom_size; } libavformat/movenc.c:1163: error: Null Dereference pointer `ctts_entries` last assigned on line 1162 could be null and is dereferenced at line 1163, column 5. libavformat/movenc.c:1155:1: start of procedure mov_write_ctts_tag() 1153. } 1154. 1155. static int mov_write_ctts_tag(AVIOContext *pb, MOVTrack *track) ^ 1156. { 1157. MOVStts *ctts_entries; libavformat/movenc.c:1158:5: 1156. { 1157. MOVStts *ctts_entries; 1158. uint32_t entries = 0; ^ 1159. uint32_t atom_size; 1160. int i; libavformat/movenc.c:1162:5: 1160. int i; 1161. 1162. ctts_entries = av_malloc((track->entry + 1) * sizeof(*ctts_entries)); /* worst case */ ^ 1163. ctts_entries[0].count = 1; 1164. ctts_entries[0].duration = track->cluster[0].cts; libavutil/mem.c:62:1: start of procedure av_malloc() 60. * linker will do it automatically. */ 61. 62. void *av_malloc(size_t size) ^ 63. { 64. void *ptr = NULL; libavutil/mem.c:64:5: 62. void *av_malloc(size_t size) 63. { 64. void *ptr = NULL; ^ 65. #if CONFIG_MEMALIGN_HACK 66. long diff; libavutil/mem.c:70:9: Taking true branch 68. 69. /* let's disallow possibly ambiguous cases */ 70. if (size > (INT_MAX - 32) || !size) ^ 71. return NULL; 72. libavutil/mem.c:71:9: 69. /* let's disallow possibly ambiguous cases */ 70. if (size > (INT_MAX - 32) || !size) 71. return NULL; ^ 72. 73. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavformat/movenc.c:1163:5: 1161. 1162. ctts_entries = av_malloc((track->entry + 1) * sizeof(*ctts_entries)); /* worst case */ 1163. ctts_entries[0].count = 1; ^ 1164. ctts_entries[0].duration = track->cluster[0].cts; 1165. for (i = 1; i < track->entry; i++) {
https://github.com/libav/libav/blob/6f1960ab71b4f18551243ce22d01913108265233/libavformat/movenc.c/#L1163
d2a_code_trace_data_44472
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dsa/dsa_gen.c:665: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set`. Showing all 26 steps of the trace crypto/dsa/dsa_gen.c:655:5: Call 653. if (ctx == NULL) 654. return -1; 655. BN_CTX_start(ctx); ^ 656. if (BN_cmp(dsa->g, BN_value_one()) <= 0) 657. return 0; 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/dsa/dsa_gen.c:665:10: Call 663. if ((mont = BN_MONT_CTX_new()) == NULL) 664. goto err; 665. if (!BN_MONT_CTX_set(mont, dsa->p, ctx)) ^ 666. goto err; 667. /* Work out g^q mod p */ 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_44473
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } crypto/ec/ec2_smpl.c:816: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_GF2m_add`. Showing all 16 steps of the trace crypto/ec/ec2_smpl.c:793:10: Call 791. 792. BN_CTX_start(ctx); 793. t0 = BN_CTX_get(ctx); ^ 794. t1 = BN_CTX_get(ctx); 795. t2 = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:229:5: Call 227. } 228. /* OK, make sure the returned bignum is "zero" */ 229. BN_zero(ret); ^ 230. ctx->used++; 231. CTXDBG_RET(ctx, ret); crypto/bn/bn_lib.c:366:15: Assignment 364. a->neg = 0; 365. a->d[0] = w; 366. a->top = (w ? 1 : 0); ^ 367. a->flags &= ~BN_FLG_FIXED_TOP; 368. bn_check_top(a); crypto/bn/bn_lib.c:366:5: Assignment 364. a->neg = 0; 365. a->d[0] = w; 366. a->top = (w ? 1 : 0); ^ 367. a->flags &= ~BN_FLG_FIXED_TOP; 368. bn_check_top(a); crypto/ec/ec2_smpl.c:816:13: Call 814. || !group->meth->field_mul(group, t1, t1, t2, ctx) 815. || !group->meth->field_mul(group, r->X, r->Z, t2, ctx) 816. || !BN_GF2m_add(t2, p->X, r->X) ^ 817. || !group->meth->field_mul(group, t2, t2, t1, ctx) 818. || !BN_GF2m_add(r->Y, p->Y, t2) crypto/bn/bn_gf2m.c:252:1: Parameter `*r->d` 250. * could be equal; r is the bitwise XOR of a and b. 251. */ 252. > int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 253. { 254. int i; crypto/bn/bn_gf2m.c:268:9: Call 266. } 267. 268. if (bn_wexpand(r, at->top) == NULL) ^ 269. return 0; 270. crypto/bn/bn_lib.c:939:1: Parameter `*a->d` 937. } 938. 939. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 940. { 941. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:941:37: Call 939. BIGNUM *bn_wexpand(BIGNUM *a, int words) 940. { 941. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 942. } 943. crypto/bn/bn_lib.c:245:1: Parameter `*b->d` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `*b->d` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_GF2m_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/8f58ede09572dcc6a7e6c01280dd348240199568/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_44474
static int srp_Verify_N_and_g(const BIGNUM *N, const BIGNUM *g) { BN_CTX *bn_ctx = BN_CTX_new(); BIGNUM *p = BN_new(); BIGNUM *r = BN_new(); int ret = g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) && p != NULL && BN_rshift1(p, N) && BN_is_prime_ex(p, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) && r != NULL && BN_mod_exp(r, g, p, N, bn_ctx) && BN_add_word(r, 1) && BN_cmp(r, N) == 0; BN_free(r); BN_free(p); BN_CTX_free(bn_ctx); return ret; } apps/s_client.c:337: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 325, column 17 is not reachable after line 337, column 5. Showing all 102 steps of the trace apps/s_client.c:321:1: start of procedure srp_Verify_N_and_g() 319. # define SRP_NUMBER_ITERATIONS_FOR_PRIME 64 320. 321. > static int srp_Verify_N_and_g(const BIGNUM *N, const BIGNUM *g) 322. { 323. BN_CTX *bn_ctx = BN_CTX_new(); apps/s_client.c:323:5: 321. static int srp_Verify_N_and_g(const BIGNUM *N, const BIGNUM *g) 322. { 323. > BN_CTX *bn_ctx = BN_CTX_new(); 324. BIGNUM *p = BN_new(); 325. BIGNUM *r = BN_new(); crypto/bn/bn_ctx.c:189:1: start of procedure BN_CTX_new() 187. 188. 189. > BN_CTX *BN_CTX_new(void) 190. { 191. BN_CTX *ret; crypto/bn/bn_ctx.c:193:9: 191. BN_CTX *ret; 192. 193. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE); 195. return NULL; crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_ctx.c:193:9: Taking false branch 191. BN_CTX *ret; 192. 193. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE); 195. return NULL; crypto/bn/bn_ctx.c:198:5: 196. } 197. /* Initialise the structure */ 198. > BN_POOL_init(&ret->pool); 199. BN_STACK_init(&ret->stack); 200. return ret; crypto/bn/bn_ctx.c:335:1: start of procedure BN_POOL_init() 333. /***********/ 334. 335. > static void BN_POOL_init(BN_POOL *p) 336. { 337. p->head = p->current = p->tail = NULL; crypto/bn/bn_ctx.c:337:5: 335. static void BN_POOL_init(BN_POOL *p) 336. { 337. > p->head = p->current = p->tail = NULL; 338. p->used = p->size = 0; 339. } crypto/bn/bn_ctx.c:338:5: 336. { 337. p->head = p->current = p->tail = NULL; 338. > p->used = p->size = 0; 339. } 340. crypto/bn/bn_ctx.c:339:1: return from a call to BN_POOL_init 337. p->head = p->current = p->tail = NULL; 338. p->used = p->size = 0; 339. > } 340. 341. static void BN_POOL_finish(BN_POOL *p) crypto/bn/bn_ctx.c:199:5: 197. /* Initialise the structure */ 198. BN_POOL_init(&ret->pool); 199. > BN_STACK_init(&ret->stack); 200. return ret; 201. } crypto/bn/bn_ctx.c:294:1: start of procedure BN_STACK_init() 292. /************/ 293. 294. > static void BN_STACK_init(BN_STACK *st) 295. { 296. st->indexes = NULL; crypto/bn/bn_ctx.c:296:5: 294. static void BN_STACK_init(BN_STACK *st) 295. { 296. > st->indexes = NULL; 297. st->depth = st->size = 0; 298. } crypto/bn/bn_ctx.c:297:5: 295. { 296. st->indexes = NULL; 297. > st->depth = st->size = 0; 298. } 299. crypto/bn/bn_ctx.c:298:1: return from a call to BN_STACK_init 296. st->indexes = NULL; 297. st->depth = st->size = 0; 298. > } 299. 300. static void BN_STACK_finish(BN_STACK *st) crypto/bn/bn_ctx.c:200:5: 198. BN_POOL_init(&ret->pool); 199. BN_STACK_init(&ret->stack); 200. > return ret; 201. } 202. crypto/bn/bn_ctx.c:201:1: return from a call to BN_CTX_new 199. BN_STACK_init(&ret->stack); 200. return ret; 201. > } 202. 203. BN_CTX *BN_CTX_secure_new(void) apps/s_client.c:324:5: 322. { 323. BN_CTX *bn_ctx = BN_CTX_new(); 324. > BIGNUM *p = BN_new(); 325. BIGNUM *r = BN_new(); 326. int ret = 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) apps/s_client.c:325:5: 323. BN_CTX *bn_ctx = BN_CTX_new(); 324. BIGNUM *p = BN_new(); 325. > BIGNUM *r = BN_new(); 326. int ret = 327. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && 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) apps/s_client.c:327:9: Condition is true 325. BIGNUM *r = BN_new(); 326. int ret = 327. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && ^ 328. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) && 329. p != NULL && BN_rshift1(p, N) && apps/s_client.c:327:22: Condition is true 325. BIGNUM *r = BN_new(); 326. int ret = 327. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && ^ 328. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) && 329. p != NULL && BN_rshift1(p, N) && apps/s_client.c:327:35: Condition is true 325. BIGNUM *r = BN_new(); 326. int ret = 327. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && ^ 328. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) && 329. p != NULL && BN_rshift1(p, N) && apps/s_client.c:327:53: 325. BIGNUM *r = BN_new(); 326. int ret = 327. > g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && 328. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) && 329. p != NULL && BN_rshift1(p, N) && crypto/bn/bn_lib.c:914:1: start of procedure BN_is_odd() 912. } 913. 914. > int BN_is_odd(const BIGNUM *a) 915. { 916. return (a->top > 0) && (a->d[0] & 1); crypto/bn/bn_lib.c:916:13: Condition is true 914. int BN_is_odd(const BIGNUM *a) 915. { 916. return (a->top > 0) && (a->d[0] & 1); ^ 917. } 918. crypto/bn/bn_lib.c:916:29: Condition is false 914. int BN_is_odd(const BIGNUM *a) 915. { 916. return (a->top > 0) && (a->d[0] & 1); ^ 917. } 918. crypto/bn/bn_lib.c:916:12: 914. int BN_is_odd(const BIGNUM *a) 915. { 916. > return (a->top > 0) && (a->d[0] & 1); 917. } 918. crypto/bn/bn_lib.c:916:5: 914. int BN_is_odd(const BIGNUM *a) 915. { 916. > return (a->top > 0) && (a->d[0] & 1); 917. } 918. crypto/bn/bn_lib.c:917:1: return from a call to BN_is_odd 915. { 916. return (a->top > 0) && (a->d[0] & 1); 917. > } 918. 919. int BN_is_negative(const BIGNUM *a) apps/s_client.c:327:53: Condition is false 325. BIGNUM *r = BN_new(); 326. int ret = 327. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && ^ 328. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) && 329. p != NULL && BN_rshift1(p, N) && apps/s_client.c:327:9: 325. BIGNUM *r = BN_new(); 326. int ret = 327. > g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && 328. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) && 329. p != NULL && BN_rshift1(p, N) && apps/s_client.c:326:5: 324. BIGNUM *p = BN_new(); 325. BIGNUM *r = BN_new(); 326. > int ret = 327. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && 328. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) && apps/s_client.c:337:5: 335. BN_add_word(r, 1) && BN_cmp(r, N) == 0; 336. 337. > BN_free(r); 338. BN_free(p); 339. BN_CTX_free(bn_ctx); 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/apps/s_client.c/#L337
d2a_code_trace_data_44475
static void opt_output_file(const char *filename) { AVFormatContext *oc; int err, use_video, use_audio, use_subtitle, use_data; int input_has_video, input_has_audio, input_has_subtitle, input_has_data; 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; use_data = data_stream_copy || data_codec_name; if (nb_input_files > 0) { check_inputs(&input_has_video, &input_has_audio, &input_has_subtitle, &input_has_data); if (!input_has_video) use_video = 0; if (!input_has_audio) use_audio = 0; if (!input_has_subtitle) use_subtitle = 0; if (!input_has_data) use_data = 0; } if (audio_disable) use_audio = 0; if (video_disable) use_video = 0; if (subtitle_disable) use_subtitle = 0; if (data_disable) use_data = 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); if (use_data) new_data_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(EINVAL)); ffmpeg_exit(1); } } if (!(oc->oformat->flags & AVFMT_NOFILE)) { if (!file_overwrite && (strchr(filename, ':') == NULL || filename[1] == ':' || av_strstart(filename, "file:", NULL))) { if (avio_check(filename, 0) == 0) { 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 = avio_open(&oc->pb, filename, AVIO_FLAG_WRITE)) < 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); uninit_opts(); init_opts(); } ffmpeg.c:3738: error: Null Dereference pointer `oc` last assigned on line 3716 could be null and is dereferenced at line 3738, column 5. ffmpeg.c:3705:1: start of procedure opt_output_file() 3703. } 3704. 3705. static void opt_output_file(const char *filename) ^ 3706. { 3707. AVFormatContext *oc; ffmpeg.c:3710:5: 3708. int err, use_video, use_audio, use_subtitle, use_data; 3709. int input_has_video, input_has_audio, input_has_subtitle, input_has_data; 3710. AVFormatParameters params, *ap = &params; ^ 3711. AVOutputFormat *file_oformat; 3712. ffmpeg.c:3713:10: Taking false branch 3711. AVOutputFormat *file_oformat; 3712. 3713. if (!strcmp(filename, "-")) ^ 3714. filename = "pipe:"; 3715. ffmpeg.c:3716:5: 3714. filename = "pipe:"; 3715. 3716. oc = avformat_alloc_context(); ^ 3717. if (!oc) { 3718. print_error(filename, AVERROR(ENOMEM)); libavformat/options.c:78:1: start of procedure avformat_alloc_context() 76. } 77. 78. AVFormatContext *avformat_alloc_context(void) ^ 79. { 80. AVFormatContext *ic; libavformat/options.c:81:5: 79. { 80. AVFormatContext *ic; 81. ic = av_malloc(sizeof(AVFormatContext)); ^ 82. if (!ic) return ic; 83. avformat_get_context_defaults(ic); libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) ^ 73. return NULL; 74. libavutil/mem.c:83:9: Taking false branch 81. ((char*)ptr)[-1]= diff; 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,32,size)) ^ 84. ptr = NULL; 85. #elif HAVE_MEMALIGN libavutil/mem.c:114:5: 112. ptr = malloc(size); 113. #endif 114. return ptr; ^ 115. } 116. libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavformat/options.c:82:10: Taking true branch 80. AVFormatContext *ic; 81. ic = av_malloc(sizeof(AVFormatContext)); 82. if (!ic) return ic; ^ 83. avformat_get_context_defaults(ic); 84. ic->av_class = &av_format_context_class; libavformat/options.c:82:14: 80. AVFormatContext *ic; 81. ic = av_malloc(sizeof(AVFormatContext)); 82. if (!ic) return ic; ^ 83. avformat_get_context_defaults(ic); 84. ic->av_class = &av_format_context_class; libavformat/options.c:86:1: return from a call to avformat_alloc_context 84. ic->av_class = &av_format_context_class; 85. return ic; 86. } ^ ffmpeg.c:3717:10: Taking true branch 3715. 3716. oc = avformat_alloc_context(); 3717. if (!oc) { ^ 3718. print_error(filename, AVERROR(ENOMEM)); 3719. ffmpeg_exit(1); ffmpeg.c:3718:9: 3716. oc = avformat_alloc_context(); 3717. if (!oc) { 3718. print_error(filename, AVERROR(ENOMEM)); ^ 3719. ffmpeg_exit(1); 3720. } cmdutils.c:437:1: start of procedure print_error() 435. } 436. 437. void print_error(const char *filename, int err) ^ 438. { 439. char errbuf[128]; cmdutils.c:440:5: 438. { 439. char errbuf[128]; 440. const char *errbuf_ptr = errbuf; ^ 441. 442. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) cmdutils.c:442:9: Taking true branch 440. const char *errbuf_ptr = errbuf; 441. 442. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) ^ 443. errbuf_ptr = strerror(AVUNERROR(err)); 444. fprintf(stderr, "%s: %s\n", filename, errbuf_ptr); cmdutils.c:443:9: Skipping strerror(): method has no implementation 441. 442. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) 443. errbuf_ptr = strerror(AVUNERROR(err)); ^ 444. fprintf(stderr, "%s: %s\n", filename, errbuf_ptr); 445. } cmdutils.c:444:5: 442. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) 443. errbuf_ptr = strerror(AVUNERROR(err)); 444. fprintf(stderr, "%s: %s\n", filename, errbuf_ptr); ^ 445. } 446. cmdutils.c:445:1: return from a call to print_error 443. errbuf_ptr = strerror(AVUNERROR(err)); 444. fprintf(stderr, "%s: %s\n", filename, errbuf_ptr); 445. } ^ 446. 447. static int warned_cfg = 0; ffmpeg.c:3719:9: Skipping ffmpeg_exit(): empty list of specs 3717. if (!oc) { 3718. print_error(filename, AVERROR(ENOMEM)); 3719. ffmpeg_exit(1); ^ 3720. } 3721. ffmpeg.c:3722:9: Taking true branch 3720. } 3721. 3722. if (last_asked_format) { ^ 3723. file_oformat = av_guess_format(last_asked_format, NULL, NULL); 3724. if (!file_oformat) { ffmpeg.c:3723:9: Skipping av_guess_format(): empty list of specs 3721. 3722. if (last_asked_format) { 3723. file_oformat = av_guess_format(last_asked_format, NULL, NULL); ^ 3724. if (!file_oformat) { 3725. fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format); ffmpeg.c:3724:14: Taking false branch 3722. if (last_asked_format) { 3723. file_oformat = av_guess_format(last_asked_format, NULL, NULL); 3724. if (!file_oformat) { ^ 3725. fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format); 3726. ffmpeg_exit(1); ffmpeg.c:3728:9: 3726. ffmpeg_exit(1); 3727. } 3728. last_asked_format = NULL; ^ 3729. } else { 3730. file_oformat = av_guess_format(NULL, filename, NULL); ffmpeg.c:3738:5: 3736. } 3737. 3738. oc->oformat = file_oformat; ^ 3739. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); 3740.
https://github.com/libav/libav/blob/d0005d347d0831c904630fe70408c9fd4eec18e8/ffmpeg.c/#L3738
d2a_code_trace_data_44476
char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) { X509_NAME_ENTRY *ne; int i; int n, lold, l, l1, l2, num, j, type; const char *s; char *p; unsigned char *q; BUF_MEM *b = NULL; static const char hex[17] = "0123456789ABCDEF"; int gs_doit[4]; char tmp_buf[80]; #ifdef CHARSET_EBCDIC unsigned char ebcdic_buf[1024]; #endif if (buf == NULL) { if ((b = BUF_MEM_new()) == NULL) goto err; if (!BUF_MEM_grow(b, 200)) goto err; b->data[0] = '\0'; len = 200; } else if (len == 0) { return NULL; } if (a == NULL) { if (b) { buf = b->data; OPENSSL_free(b); } strncpy(buf, "NO X509_NAME", len); buf[len - 1] = '\0'; return buf; } len--; l = 0; for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { ne = sk_X509_NAME_ENTRY_value(a->entries, i); n = OBJ_obj2nid(ne->object); if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) { i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object); s = tmp_buf; } l1 = strlen(s); type = ne->value->type; num = ne->value->length; if (num > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } q = ne->value->data; #ifdef CHARSET_EBCDIC if (type == V_ASN1_GENERALSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_PRINTABLESTRING || type == V_ASN1_TELETEXSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_IA5STRING) { ascii2ebcdic(ebcdic_buf, q, (num > (int)sizeof(ebcdic_buf)) ? (int)sizeof(ebcdic_buf) : num); q = ebcdic_buf; } #endif if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) { gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0; for (j = 0; j < num; j++) if (q[j] != 0) gs_doit[j & 3] = 1; if (gs_doit[0] | gs_doit[1] | gs_doit[2]) gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; else { gs_doit[0] = gs_doit[1] = gs_doit[2] = 0; gs_doit[3] = 1; } } else gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; for (l2 = j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; l2++; #ifndef CHARSET_EBCDIC if ((q[j] < ' ') || (q[j] > '~')) l2 += 3; #else if ((os_toascii[q[j]] < os_toascii[' ']) || (os_toascii[q[j]] > os_toascii['~'])) l2 += 3; #endif } lold = l; l += 1 + l1 + 1 + l2; if (l > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } if (b != NULL) { if (!BUF_MEM_grow(b, l + 1)) goto err; p = &(b->data[lold]); } else if (l > len) { break; } else p = &(buf[lold]); *(p++) = '/'; memcpy(p, s, (unsigned int)l1); p += l1; *(p++) = '='; #ifndef CHARSET_EBCDIC q = ne->value->data; #endif for (j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; #ifndef CHARSET_EBCDIC n = q[j]; if ((n < ' ') || (n > '~')) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = n; #else n = os_toascii[q[j]]; if ((n < os_toascii[' ']) || (n > os_toascii['~'])) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = q[j]; #endif } *p = '\0'; } if (b != NULL) { p = b->data; OPENSSL_free(b); } else p = buf; if (i == 0) *p = '\0'; return (p); err: X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE); end: BUF_MEM_free(b); return (NULL); } apps/s_client.c:2586: error: BUFFER_OVERRUN_L3 Offset added: [200, 8192] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace apps/s_client.c:2586:17: Call 2584. BIO_printf(bio, "---\nCertificate chain\n"); 2585. for (i = 0; i < sk_X509_num(sk); i++) { 2586. X509_NAME_oneline(X509_get_subject_name(sk_X509_value(sk, i)), ^ 2587. buf, sizeof buf); 2588. BIO_printf(bio, "%2d s:%s\n", i, buf); crypto/x509/x509_obj.c:73:1: <Offset trace> 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:73:1: Parameter `len` 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:73:1: <Length trace> 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:73:1: Parameter `*buf` 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:104:9: Array access: Offset added: [200, 8192] Size: [1, 2147483644] by call to `X509_NAME_oneline` 102. OPENSSL_free(b); 103. } 104. strncpy(buf, "NO X509_NAME", len); ^ 105. buf[len - 1] = '\0'; 106. return buf;
https://github.com/openssl/openssl/blob/24c2cd3967ed23acc0bd31a3781c4525e2e42a2c/crypto/x509/x509_obj.c/#L104
d2a_code_trace_data_44477
char *CRYPTO_strdup(const char *str, const char* file, int line) { char *ret; size_t size; if (str == NULL) return NULL; size = strlen(str) + 1; ret = CRYPTO_malloc(size, file, line); if (ret != NULL) memcpy(ret, str, size); return ret; } apps/rehash.c:231: error: BUFFER_OVERRUN_L3 Offset added: [1, 4096] Size: [1, 4096] by call to `add_entry`. Showing all 14 steps of the trace apps/rehash.c:200:1: Array declaration 198. * This can be -1 if bad filename, or an error count. 199. */ 200. > static int handle_symlink(const char *filename, const char *fullpath) 201. { 202. unsigned int hash = 0; apps/rehash.c:231:12: Call 229. linktarget[n] = 0; 230. 231. return add_entry(type, hash, linktarget, NULL, 0, id); ^ 232. } 233. apps/rehash.c:132:1: Parameter `filename->strlen` 130. * Process an entry; return number of errors. 131. */ 132. > static int add_entry(enum Type type, unsigned int hash, const char *filename, 133. const unsigned char *digest, int need_symlink, 134. unsigned short old_id) apps/rehash.c:178:24: Call 176. *ep = nilhentry; 177. ep->old_id = ~0; 178. ep->filename = OPENSSL_strdup(filename); ^ 179. if (bp->last_entry) 180. bp->last_entry->next = ep; crypto/o_str.c:120:1: <Offset trace> 118. } 119. 120. > char *CRYPTO_strdup(const char *str, const char* file, int line) 121. { 122. char *ret; crypto/o_str.c:120:1: Parameter `str->strlen` 118. } 119. 120. > char *CRYPTO_strdup(const char *str, const char* file, int line) 121. { 122. char *ret; crypto/o_str.c:127:5: Assignment 125. if (str == NULL) 126. return NULL; 127. size = strlen(str) + 1; ^ 128. ret = CRYPTO_malloc(size, file, line); 129. if (ret != NULL) crypto/o_str.c:120:1: <Length trace> 118. } 119. 120. > char *CRYPTO_strdup(const char *str, const char* file, int line) 121. { 122. char *ret; crypto/o_str.c:120:1: Parameter `str->strlen` 118. } 119. 120. > char *CRYPTO_strdup(const char *str, const char* file, int line) 121. { 122. char *ret; crypto/o_str.c:127:5: Assignment 125. if (str == NULL) 126. return NULL; 127. size = strlen(str) + 1; ^ 128. ret = CRYPTO_malloc(size, file, line); 129. if (ret != NULL) crypto/o_str.c:128:11: Call 126. return NULL; 127. size = strlen(str) + 1; 128. ret = CRYPTO_malloc(size, file, line); ^ 129. if (ret != NULL) 130. memcpy(ret, str, size); crypto/mem.c:124:9: Assignment 122. 123. if (num <= 0) 124. return NULL; ^ 125. 126. allow_customize = 0; crypto/o_str.c:128:5: Assignment 126. return NULL; 127. size = strlen(str) + 1; 128. ret = CRYPTO_malloc(size, file, line); ^ 129. if (ret != NULL) 130. memcpy(ret, str, size); crypto/o_str.c:130:9: Array access: Offset added: [1, 4096] Size: [1, 4096] by call to `add_entry` 128. ret = CRYPTO_malloc(size, file, line); 129. if (ret != NULL) 130. memcpy(ret, str, size); ^ 131. return ret; 132. }
https://github.com/openssl/openssl/blob/ef2499298b26fa84594c8e85fd645bc75179cfdd/crypto/o_str.c/#L130
d2a_code_trace_data_44478
int RAND_pseudo_bytes(unsigned char *buf, int num) { const RAND_METHOD *meth = RAND_get_rand_method(); if (meth->pseudorand != NULL) return meth->pseudorand(buf, num); return -1; } crypto/rand/rand_lib.c:157: error: NULL_DEREFERENCE pointer `meth` last assigned on line 155 could be null and is dereferenced at line 157, column 9. Showing all 14 steps of the trace crypto/rand/rand_lib.c:153:1: start of procedure RAND_pseudo_bytes() 151. 152. #if OPENSSL_API_COMPAT < 0x10100000L 153. > int RAND_pseudo_bytes(unsigned char *buf, int num) 154. { 155. const RAND_METHOD *meth = RAND_get_rand_method(); crypto/rand/rand_lib.c:155:5: 153. int RAND_pseudo_bytes(unsigned char *buf, int num) 154. { 155. > const RAND_METHOD *meth = RAND_get_rand_method(); 156. 157. if (meth->pseudorand != NULL) crypto/rand/rand_lib.c:70:1: start of procedure RAND_get_rand_method() 68. } 69. 70. > const RAND_METHOD *RAND_get_rand_method(void) 71. { 72. const RAND_METHOD *tmp_meth = NULL; crypto/rand/rand_lib.c:72:5: 70. const RAND_METHOD *RAND_get_rand_method(void) 71. { 72. > const RAND_METHOD *tmp_meth = NULL; 73. 74. if (!RUN_ONCE(&rand_init, do_rand_init)) crypto/rand/rand_lib.c:74:10: 72. const RAND_METHOD *tmp_meth = NULL; 73. 74. > if (!RUN_ONCE(&rand_init, do_rand_init)) 75. return NULL; 76. crypto/threads_pthread.c:105:1: start of procedure CRYPTO_THREAD_run_once() 103. } 104. 105. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 106. { 107. if (pthread_once(once, init) != 0) crypto/threads_pthread.c:107:9: Taking true branch 105. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 106. { 107. if (pthread_once(once, init) != 0) ^ 108. return 0; 109. crypto/threads_pthread.c:108:9: 106. { 107. if (pthread_once(once, init) != 0) 108. > return 0; 109. 110. return 1; crypto/threads_pthread.c:111:1: return from a call to CRYPTO_THREAD_run_once 109. 110. return 1; 111. > } 112. 113. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)) crypto/rand/rand_lib.c:74:10: Condition is false 72. const RAND_METHOD *tmp_meth = NULL; 73. 74. if (!RUN_ONCE(&rand_init, do_rand_init)) ^ 75. return NULL; 76. crypto/rand/rand_lib.c:74:10: Taking true branch 72. const RAND_METHOD *tmp_meth = NULL; 73. 74. if (!RUN_ONCE(&rand_init, do_rand_init)) ^ 75. return NULL; 76. crypto/rand/rand_lib.c:75:9: 73. 74. if (!RUN_ONCE(&rand_init, do_rand_init)) 75. > return NULL; 76. 77. CRYPTO_THREAD_write_lock(rand_meth_lock); crypto/rand/rand_lib.c:98:1: return from a call to RAND_get_rand_method 96. CRYPTO_THREAD_unlock(rand_meth_lock); 97. return tmp_meth; 98. > } 99. 100. #ifndef OPENSSL_NO_ENGINE crypto/rand/rand_lib.c:157:9: 155. const RAND_METHOD *meth = RAND_get_rand_method(); 156. 157. > if (meth->pseudorand != NULL) 158. return meth->pseudorand(buf, num); 159. return -1;
https://github.com/openssl/openssl/blob/12fb8c3d2dd00f3d4f1b084385403d26ed64a596/crypto/rand/rand_lib.c/#L157
d2a_code_trace_data_44479
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:4394: error: NULL_DEREFERENCE pointer `null` is dereferenced by call to `ssl_security_cert()` at line 4394, column 10. Showing all 11 steps of the trace ssl/t1_lib.c:4385:1: start of procedure ssl_security_cert_chain() 4383. */ 4384. 4385. > int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *x, int vfy) 4386. { 4387. int rv, start_idx, i; ssl/t1_lib.c:4388:9: Taking true branch 4386. { 4387. int rv, start_idx, i; 4388. if (x == NULL) { ^ 4389. x = sk_X509_value(sk, 0); 4390. start_idx = 1; ssl/t1_lib.c:4389:9: 4387. int rv, start_idx, i; 4388. if (x == NULL) { 4389. > x = sk_X509_value(sk, 0); 4390. start_idx = 1; 4391. } else include/openssl/x509.h:97:1: start of procedure sk_X509_value() 95. typedef struct x509_cinf_st X509_CINF; 96. 97. > DEFINE_STACK_OF(X509) 98. 99. /* This is used for a table of trust checking functions */ crypto/stack/stack.c:284:1: start of procedure OPENSSL_sk_value() 282. } 283. 284. > void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i) 285. { 286. if (st == NULL || i < 0 || i >= st->num) crypto/stack/stack.c:286:9: Taking true branch 284. void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i) 285. { 286. if (st == NULL || i < 0 || i >= st->num) ^ 287. return NULL; 288. return (void *)st->data[i]; crypto/stack/stack.c:287:9: 285. { 286. if (st == NULL || i < 0 || i >= st->num) 287. > return NULL; 288. return (void *)st->data[i]; 289. } crypto/stack/stack.c:289:1: return from a call to OPENSSL_sk_value 287. return NULL; 288. return (void *)st->data[i]; 289. > } 290. 291. void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data) include/openssl/x509.h:97:1: return from a call to sk_X509_value 95. typedef struct x509_cinf_st X509_CINF; 96. 97. > DEFINE_STACK_OF(X509) 98. 99. /* This is used for a table of trust checking functions */ ssl/t1_lib.c:4390:9: 4388. if (x == NULL) { 4389. x = sk_X509_value(sk, 0); 4390. > start_idx = 1; 4391. } else 4392. start_idx = 0; ssl/t1_lib.c:4394:5: 4392. start_idx = 0; 4393. 4394. > rv = ssl_security_cert(s, NULL, x, vfy, 1); 4395. if (rv != 1) 4396. return rv;
https://github.com/openssl/openssl/blob/f7a39a5a3f7f91e0d1ba0030323eef26bc8ccddf/ssl/t1_lib.c/#L4394
d2a_code_trace_data_44480
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:1316: error: Buffer Overrun L2 Offset: [0, 3] Size: 3 by call to `l2_unscale_group`. libavcodec/mpegaudiodec.c:1316:33: Call 1314. v = v / steps; 1315. s->sb_samples[ch][k * 12 + l + 1][i] = 1316. l2_unscale_group(steps, v % steps, scale); ^ 1317. v = v / steps; 1318. s->sb_samples[ch][k * 12 + l + 2][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_44481
uintptr_t ngx_escape_uri(u_char *dst, u_char *src, size_t size, ngx_uint_t type) { ngx_uint_t n; uint32_t *escape; static u_char hex[] = "0123456789ABCDEF"; static uint32_t uri[] = { 0xffffffff, 0x80000029, 0x00000000, 0x80000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }; static uint32_t args[] = { 0xffffffff, 0x88000869, 0x00000000, 0x80000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }; static uint32_t uri_component[] = { 0xffffffff, 0xfc009fff, 0x78000001, 0xb8000001, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }; static uint32_t html[] = { 0xffffffff, 0x000000ad, 0x00000000, 0x80000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }; static uint32_t refresh[] = { 0xffffffff, 0x00000085, 0x00000000, 0x80000000, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }; static uint32_t memcached[] = { 0xffffffff, 0x00000021, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, }; static uint32_t *map[] = { uri, args, uri_component, html, refresh, memcached, memcached }; escape = map[type]; if (dst == NULL) { n = 0; while (size) { if (escape[*src >> 5] & (1U << (*src & 0x1f))) { n++; } src++; size--; } return (uintptr_t) n; } while (size) { if (escape[*src >> 5] & (1U << (*src & 0x1f))) { *dst++ = '%'; *dst++ = hex[*src >> 4]; *dst++ = hex[*src & 0xf]; src++; } else { *dst++ = *src++; } size--; } return (uintptr_t) dst; } src/http/modules/ngx_http_ssi_filter_module.c:2330: error: Buffer Overrun L3 Offset: [1, +oo] Size: [0, +oo] by call to `ngx_escape_uri`. src/http/modules/ngx_http_ssi_filter_module.c:2243:1: Global `ngx_http_ssi_none.len` 2241. 2242. 2243. static ngx_int_t ^ 2244. ngx_http_ssi_echo(ngx_http_request_t *r, ngx_http_ssi_ctx_t *ctx, 2245. ngx_str_t **params) src/http/modules/ngx_http_ssi_filter_module.c:2325:17: Call 2323. 2324. if (len) { 2325. p = ngx_pnalloc(r->pool, value->len + len); ^ 2326. if (p == NULL) { 2327. return NGX_HTTP_SSI_ERROR; src/core/ngx_palloc.c:140:16: Call 138. #if !(NGX_DEBUG_PALLOC) 139. if (size <= pool->max) { 140. return ngx_palloc_small(pool, size, 0); ^ 141. } 142. #endif src/core/ngx_palloc.c:157:9: Assignment 155. 156. do { 157. m = p->d.last; ^ 158. 159. if (align) { src/core/ngx_palloc.c:166:13: Assignment 164. p->d.last = m + size; 165. 166. return m; ^ 167. } 168. src/core/ngx_palloc.c:140:9: Assignment 138. #if !(NGX_DEBUG_PALLOC) 139. if (size <= pool->max) { 140. return ngx_palloc_small(pool, size, 0); ^ 141. } 142. #endif src/http/modules/ngx_http_ssi_filter_module.c:2325:13: Assignment 2323. 2324. if (len) { 2325. p = ngx_pnalloc(r->pool, value->len + len); ^ 2326. if (p == NULL) { 2327. return NGX_HTTP_SSI_ERROR; src/http/modules/ngx_http_ssi_filter_module.c:2330:20: Call 2328. } 2329. 2330. (void) ngx_escape_uri(p, value->data, value->len, NGX_ESCAPE_HTML); ^ 2331. } 2332. src/core/ngx_string.c:1424:1: <Length trace> 1422. 1423. 1424. uintptr_t ^ 1425. ngx_escape_uri(u_char *dst, u_char *src, size_t size, ngx_uint_t type) 1426. { src/core/ngx_string.c:1424:1: Parameter `*dst` 1422. 1423. 1424. uintptr_t ^ 1425. ngx_escape_uri(u_char *dst, u_char *src, size_t size, ngx_uint_t type) 1426. { src/core/ngx_string.c:1578:14: Assignment 1576. while (size) { 1577. if (escape[*src >> 5] & (1U << (*src & 0x1f))) { 1578. *dst++ = '%'; ^ 1579. *dst++ = hex[*src >> 4]; 1580. *dst++ = hex[*src & 0xf]; src/core/ngx_string.c:1579:13: Array access: Offset: [1, +oo] Size: [0, +oo] by call to `ngx_escape_uri` 1577. if (escape[*src >> 5] & (1U << (*src & 0x1f))) { 1578. *dst++ = '%'; 1579. *dst++ = hex[*src >> 4]; ^ 1580. *dst++ = hex[*src & 0xf]; 1581. src++;
https://github.com/nginx/nginx/blob/6299f5e9149483251bbbcc8ad26cf29b6109e75c/src/core/ngx_string.c/#L1579
d2a_code_trace_data_44482
static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vstream, const char *key, unsigned int max_pos, int depth) { AVCodecContext *acodec, *vcodec; ByteIOContext *ioc; AMFDataType amf_type; char str_val[256]; double num_val; num_val = 0; ioc = s->pb; amf_type = get_byte(ioc); switch(amf_type) { case AMF_DATA_TYPE_NUMBER: num_val = av_int2dbl(get_be64(ioc)); break; case AMF_DATA_TYPE_BOOL: num_val = get_byte(ioc); break; case AMF_DATA_TYPE_STRING: if(amf_get_string(ioc, str_val, sizeof(str_val)) < 0) return -1; break; case AMF_DATA_TYPE_OBJECT: { unsigned int keylen; while(url_ftell(ioc) < max_pos - 2 && (keylen = get_be16(ioc))) { url_fskip(ioc, keylen); if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0) return -1; } if(get_byte(ioc) != AMF_END_OF_OBJECT) return -1; } break; case AMF_DATA_TYPE_NULL: case AMF_DATA_TYPE_UNDEFINED: case AMF_DATA_TYPE_UNSUPPORTED: break; case AMF_DATA_TYPE_MIXEDARRAY: url_fskip(ioc, 4); while(url_ftell(ioc) < max_pos - 2 && amf_get_string(ioc, str_val, sizeof(str_val)) > 0) { if(amf_parse_object(s, astream, vstream, str_val, max_pos, depth + 1) < 0) return -1; } if(get_byte(ioc) != AMF_END_OF_OBJECT) return -1; break; case AMF_DATA_TYPE_ARRAY: { unsigned int arraylen, i; arraylen = get_be32(ioc); for(i = 0; i < arraylen && url_ftell(ioc) < max_pos - 1; i++) { if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0) return -1; } } break; case AMF_DATA_TYPE_DATE: url_fskip(ioc, 8 + 2); break; default: return -1; } if(depth == 1 && key) { acodec = astream ? astream->codec : NULL; vcodec = vstream ? vstream->codec : NULL; if(amf_type == AMF_DATA_TYPE_BOOL) { if(!strcmp(key, "stereo") && acodec) acodec->channels = num_val > 0 ? 2 : 1; } else if(amf_type == AMF_DATA_TYPE_NUMBER) { if(!strcmp(key, "duration")) s->duration = num_val * AV_TIME_BASE; else if(!strcmp(key, "audiocodecid") && acodec && 0 <= (int)num_val) flv_set_audio_codec(s, astream, (int)num_val << FLV_AUDIO_CODECID_OFFSET); else if(!strcmp(key, "videocodecid") && vcodec && 0 <= (int)num_val) flv_set_video_codec(s, vstream, (int)num_val); else if(!strcmp(key, "audiosamplesize") && acodec && 0 < (int)num_val) { acodec->bits_per_sample = num_val; if(num_val == 8 && (acodec->codec_id == CODEC_ID_PCM_S16BE || acodec->codec_id == CODEC_ID_PCM_S16LE)) acodec->codec_id = CODEC_ID_PCM_S8; } else if(!strcmp(key, "audiosamplerate") && acodec && num_val >= 0) { if (!acodec->sample_rate) { switch((int)num_val) { case 44000: acodec->sample_rate = 44100 ; break; case 22000: acodec->sample_rate = 22050 ; break; case 11000: acodec->sample_rate = 11025 ; break; case 5000 : acodec->sample_rate = 5512 ; break; default : acodec->sample_rate = num_val; } } } } } return 0; } libavformat/flvdec.c:308: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `flv_read_metabody`. libavformat/flvdec.c:286:12: Call 284. url_fskip(s->pb, 4); /* size of previous packet */ 285. type = get_byte(s->pb); 286. size = get_be24(s->pb); ^ 287. pts = get_be24(s->pb); 288. pts |= get_byte(s->pb) << 24; libavformat/aviobuf.c:470:11: Call 468. { 469. unsigned int val; 470. val = get_be16(s) << 8; ^ 471. val |= get_byte(s); 472. return val; libavformat/aviobuf.c:462:11: Call 460. { 461. unsigned int val; 462. val = get_byte(s) << 8; ^ 463. val |= get_byte(s); 464. return val; libavformat/aviobuf.c:348:13: Assignment 346. return *s->buf_ptr++; 347. else 348. return 0; ^ 349. } 350. } libavformat/aviobuf.c:462:5: Assignment 460. { 461. unsigned int val; 462. val = get_byte(s) << 8; ^ 463. val |= get_byte(s); 464. return val; libavformat/aviobuf.c:463:5: Assignment 461. unsigned int val; 462. val = get_byte(s) << 8; 463. val |= get_byte(s); ^ 464. return val; 465. } libavformat/aviobuf.c:464:5: Assignment 462. val = get_byte(s) << 8; 463. val |= get_byte(s); 464. return val; ^ 465. } 466. libavformat/aviobuf.c:470:5: Assignment 468. { 469. unsigned int val; 470. val = get_be16(s) << 8; ^ 471. val |= get_byte(s); 472. return val; libavformat/aviobuf.c:471:5: Assignment 469. unsigned int val; 470. val = get_be16(s) << 8; 471. val |= get_byte(s); ^ 472. return val; 473. } libavformat/aviobuf.c:472:5: Assignment 470. val = get_be16(s) << 8; 471. val |= get_byte(s); 472. return val; ^ 473. } 474. unsigned int get_be32(ByteIOContext *s) libavformat/flvdec.c:286:5: Assignment 284. url_fskip(s->pb, 4); /* size of previous packet */ 285. type = get_byte(s->pb); 286. size = get_be24(s->pb); ^ 287. pts = get_be24(s->pb); 288. pts |= get_byte(s->pb) << 24; libavformat/flvdec.c:298:5: Assignment 296. continue; 297. 298. next= size + url_ftell(s->pb); ^ 299. 300. if (type == FLV_TAG_TYPE_AUDIO) { libavformat/flvdec.c:308:13: Call 306. } else { 307. if (type == FLV_TAG_TYPE_META && size > 13+1+4) 308. flv_read_metabody(s, next); ^ 309. else /* skip packet */ 310. av_log(s, AV_LOG_ERROR, "skipping flv packet: type %d, size %d, flags %d\n", type, size, flags); libavformat/flvdec.c:206:1: Parameter `next_pos` 204. } 205. 206. static int flv_read_metabody(AVFormatContext *s, unsigned int next_pos) { ^ 207. AMFDataType type; 208. AVStream *stream, *astream, *vstream; libavformat/flvdec.c:231:8: Call 229. 230. //parse the second object (we want a mixed array) 231. if(amf_parse_object(s, astream, vstream, buffer, next_pos, 0) < 0) ^ 232. return -1; 233. libavformat/flvdec.c:104:1: <LHS trace> 102. } 103. 104. static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vstream, const char *key, unsigned int max_pos, int depth) { ^ 105. AVCodecContext *acodec, *vcodec; 106. ByteIOContext *ioc; libavformat/flvdec.c:104:1: Parameter `max_pos` 102. } 103. 104. static int amf_parse_object(AVFormatContext *s, AVStream *astream, AVStream *vstream, const char *key, unsigned int max_pos, int depth) { ^ 105. AVCodecContext *acodec, *vcodec; 106. ByteIOContext *ioc; libavformat/flvdec.c:155:40: Binary operation: ([0, +oo] - 1):unsigned32 by call to `flv_read_metabody` 153. 154. arraylen = get_be32(ioc); 155. for(i = 0; i < arraylen && url_ftell(ioc) < max_pos - 1; i++) { ^ 156. if(amf_parse_object(s, NULL, NULL, NULL, max_pos, depth + 1) < 0) 157. return -1; //if we couldn't skip, bomb out.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/flvdec.c/#L155
d2a_code_trace_data_44483
static ssize_t ngx_http_validate_host(u_char *host, size_t len) { u_char ch; size_t i, last; ngx_uint_t dot; last = len; dot = 0; for (i = 0; i < len; i++) { ch = host[i]; if (ch == '.') { if (dot) { return -1; } dot = 1; continue; } dot = 0; if (ch == ':') { last = i; continue; } if (ch == '/' || ch == '\0') { return -1; } #if (NGX_WIN32) if (ch == '\\') { return -1; } #endif } if (dot) { last--; } return last; } src/http/ngx_http_request.c:1602: error: Integer Overflow L2 ([0, `len`] - 1):unsigned64. src/http/ngx_http_request.c:1561:1: <LHS trace> 1559. 1560. 1561. static ssize_t ^ 1562. ngx_http_validate_host(u_char *host, size_t len) 1563. { src/http/ngx_http_request.c:1561:1: Parameter `len` 1559. 1560. 1561. static ssize_t ^ 1562. ngx_http_validate_host(u_char *host, size_t len) 1563. { src/http/ngx_http_request.c:1568:5: Assignment 1566. ngx_uint_t dot; 1567. 1568. last = len; ^ 1569. dot = 0; 1570. src/http/ngx_http_request.c:1602:9: Binary operation: ([0, len] - 1):unsigned64 1600. 1601. if (dot) { 1602. last--; ^ 1603. } 1604.
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/http/ngx_http_request.c/#L1602
d2a_code_trace_data_44484
static ossl_inline void packet_forward(PACKET *pkt, size_t len) { pkt->curr += len; pkt->remaining -= len; } ssl/t1_lib.c:1738: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 2):unsigned64 by call to `PACKET_forward`. Showing all 8 steps of the trace ssl/t1_lib.c:1738:10: Call 1736. tmppkt = hello->extensions; 1737. 1738. if (!PACKET_forward(&tmppkt, 2) ^ 1739. || !PACKET_get_net_2(&tmppkt, &type) 1740. || !PACKET_get_length_prefixed_2(&tmppkt, &sni)) { 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] - 2):unsigned64 by call to `PACKET_forward` 34. { 35. pkt->curr += len; 36. pkt->remaining -= len; ^ 37. } 38.
https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/ssl/packet_locl.h/#L36
d2a_code_trace_data_44485
static void unhook_drbg(RAND_DRBG *drbg) { HOOK_CTX *ctx = get_hook_ctx(drbg); drbg->get_entropy = ctx->get_entropy; CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DRBG, drbg, &drbg->ex_data); } test/drbgtest.c:591: error: NULL_DEREFERENCE pointer `ctx` last assigned on line 589 could be null and is dereferenced at line 591, column 25. Showing all 13 steps of the trace test/drbgtest.c:587:1: start of procedure unhook_drbg() 585. 586. /* Installs the hook for the get_entropy() callback of the given drbg */ 587. > static void unhook_drbg(RAND_DRBG *drbg) 588. { 589. HOOK_CTX *ctx = get_hook_ctx(drbg); test/drbgtest.c:589:5: 587. static void unhook_drbg(RAND_DRBG *drbg) 588. { 589. > HOOK_CTX *ctx = get_hook_ctx(drbg); 590. 591. drbg->get_entropy = ctx->get_entropy; test/drbgtest.c:552:1: start of procedure get_hook_ctx() 550. static HOOK_CTX master_ctx, public_ctx, private_ctx; 551. 552. > static HOOK_CTX *get_hook_ctx(RAND_DRBG *drbg) 553. { 554. return (HOOK_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); test/drbgtest.c:554:5: 552. static HOOK_CTX *get_hook_ctx(RAND_DRBG *drbg) 553. { 554. > return (HOOK_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); 555. } 556. crypto/rand/drbg_lib.c:1108:1: start of procedure RAND_DRBG_get_ex_data() 1106. } 1107. 1108. > void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx) 1109. { 1110. return CRYPTO_get_ex_data(&drbg->ex_data, idx); crypto/rand/drbg_lib.c:1110:5: 1108. void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx) 1109. { 1110. > return CRYPTO_get_ex_data(&drbg->ex_data, idx); 1111. } 1112. crypto/ex_data.c:458:1: start of procedure CRYPTO_get_ex_data() 456. * particular index in the class used by this variable 457. */ 458. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 459. { 460. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) crypto/ex_data.c:460:9: Taking true branch 458. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 459. { 460. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) ^ 461. return NULL; 462. return sk_void_value(ad->sk, idx); crypto/ex_data.c:461:9: 459. { 460. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) 461. > return NULL; 462. return sk_void_value(ad->sk, idx); 463. } crypto/ex_data.c:463:1: return from a call to CRYPTO_get_ex_data 461. return NULL; 462. return sk_void_value(ad->sk, idx); 463. > } 464. 465. OPENSSL_CTX *crypto_ex_data_get_openssl_ctx(const CRYPTO_EX_DATA *ad) crypto/rand/drbg_lib.c:1111:1: return from a call to RAND_DRBG_get_ex_data 1109. { 1110. return CRYPTO_get_ex_data(&drbg->ex_data, idx); 1111. > } 1112. 1113. test/drbgtest.c:555:1: return from a call to get_hook_ctx 553. { 554. return (HOOK_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); 555. > } 556. 557. /* Intercepts and counts calls to the get_entropy() callback */ test/drbgtest.c:591:5: 589. HOOK_CTX *ctx = get_hook_ctx(drbg); 590. 591. > drbg->get_entropy = ctx->get_entropy; 592. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DRBG, drbg, &drbg->ex_data); 593. }
https://github.com/openssl/openssl/blob/6b3d0423528b049d04b299a8588a32d5c1224717/test/drbgtest.c/#L591
d2a_code_trace_data_44486
static int mov_write_ctts_tag(AVIOContext *pb, MOVTrack *track) { MOVStts *ctts_entries; uint32_t entries = 0; uint32_t atom_size; int i; ctts_entries = av_malloc((track->entry + 1) * sizeof(*ctts_entries)); ctts_entries[0].count = 1; ctts_entries[0].duration = track->cluster[0].cts; for (i = 1; i < track->entry; i++) { if (track->cluster[i].cts == ctts_entries[entries].duration) { ctts_entries[entries].count++; } else { entries++; ctts_entries[entries].duration = track->cluster[i].cts; ctts_entries[entries].count = 1; } } entries++; atom_size = 16 + (entries * 8); avio_wb32(pb, atom_size); ffio_wfourcc(pb, "ctts"); avio_wb32(pb, 0); avio_wb32(pb, entries); for (i = 0; i < entries; i++) { avio_wb32(pb, ctts_entries[i].count); avio_wb32(pb, ctts_entries[i].duration); } av_free(ctts_entries); return atom_size; } libavformat/movenc.c:1104: error: Null Dereference pointer `ctts_entries` last assigned on line 1103 could be null and is dereferenced at line 1104, column 5. libavformat/movenc.c:1096:1: start of procedure mov_write_ctts_tag() 1094. } 1095. 1096. static int mov_write_ctts_tag(AVIOContext *pb, MOVTrack *track) ^ 1097. { 1098. MOVStts *ctts_entries; libavformat/movenc.c:1099:5: 1097. { 1098. MOVStts *ctts_entries; 1099. uint32_t entries = 0; ^ 1100. uint32_t atom_size; 1101. int i; libavformat/movenc.c:1103:5: 1101. int i; 1102. 1103. ctts_entries = av_malloc((track->entry + 1) * sizeof(*ctts_entries)); /* worst case */ ^ 1104. ctts_entries[0].count = 1; 1105. ctts_entries[0].duration = track->cluster[0].cts; 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 true branch 67. 68. /* let's disallow possible ambiguous cases */ 69. if (size > (INT_MAX - 32) || !size) ^ 70. return NULL; 71. libavutil/mem.c:70:9: 68. /* let's disallow possible ambiguous cases */ 69. if (size > (INT_MAX - 32) || !size) 70. return NULL; ^ 71. 72. #if CONFIG_MEMALIGN_HACK 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/movenc.c:1104:5: 1102. 1103. ctts_entries = av_malloc((track->entry + 1) * sizeof(*ctts_entries)); /* worst case */ 1104. ctts_entries[0].count = 1; ^ 1105. ctts_entries[0].duration = track->cluster[0].cts; 1106. for (i = 1; i < track->entry; i++) {
https://github.com/libav/libav/blob/b89e8759e053792704741d08cbc41c9ac3c7ed63/libavformat/movenc.c/#L1104
d2a_code_trace_data_44487
int av_find_stream_info(AVFormatContext *ic) { int i, count, ret, read_size, j; AVStream *st; AVPacket pkt1, *pkt; int64_t last_dts[MAX_STREAMS]; int duration_count[MAX_STREAMS]={0}; double (*duration_error)[MAX_STD_TIMEBASES]; offset_t old_offset = url_ftell(ic->pb); int64_t codec_info_duration[MAX_STREAMS]={0}; int codec_info_nb_frames[MAX_STREAMS]={0}; AVProbeData probe_data[MAX_STREAMS]; int codec_identified[MAX_STREAMS]={0}; duration_error = av_mallocz(MAX_STREAMS * sizeof(*duration_error)); if (!duration_error) return AVERROR(ENOMEM); for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; if(st->codec->codec_type == CODEC_TYPE_VIDEO){ if(!st->codec->time_base.num) st->codec->time_base= st->time_base; } if (!st->parser) { st->parser = av_parser_init(st->codec->codec_id); if(st->need_parsing == AVSTREAM_PARSE_HEADERS && st->parser){ st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES; } } } for(i=0;i<MAX_STREAMS;i++){ last_dts[i]= AV_NOPTS_VALUE; } memset(probe_data, 0, sizeof(probe_data)); count = 0; read_size = 0; for(;;) { for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; if (!has_codec_parameters(st->codec)) break; if( tb_unreliable(st->codec) && duration_count[i]<20 && st->codec->codec_type == CODEC_TYPE_VIDEO) break; if(st->parser && st->parser->parser->split && !st->codec->extradata) break; if(st->first_dts == AV_NOPTS_VALUE) break; } if (i == ic->nb_streams) { if (!(ic->ctx_flags & AVFMTCTX_NOHEADER)) { ret = count; break; } } if (read_size >= MAX_READ_SIZE) { ret = count; break; } ret = av_read_frame_internal(ic, &pkt1); if (ret < 0) { ret = -1; for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; if (!has_codec_parameters(st->codec)){ char buf[256]; avcodec_string(buf, sizeof(buf), st->codec, 0); av_log(ic, AV_LOG_INFO, "Could not find codec parameters (%s)\n", buf); } else { ret = 0; } } break; } pkt= add_to_pktbuf(ic, &pkt1); if(av_dup_packet(pkt) < 0) return AVERROR(ENOMEM); read_size += pkt->size; st = ic->streams[pkt->stream_index]; if(codec_info_nb_frames[st->index]>1) codec_info_duration[st->index] += pkt->duration; if (pkt->duration != 0) codec_info_nb_frames[st->index]++; { int index= pkt->stream_index; int64_t last= last_dts[index]; int64_t duration= pkt->dts - last; if(pkt->dts != AV_NOPTS_VALUE && last != AV_NOPTS_VALUE && duration>0){ double dur= duration * av_q2d(st->time_base); if(duration_count[index] < 2) memset(duration_error[index], 0, sizeof(*duration_error)); for(i=1; i<MAX_STD_TIMEBASES; i++){ int framerate= get_std_framerate(i); int ticks= lrintf(dur*framerate/(1001*12)); double error= dur - ticks*1001*12/(double)framerate; duration_error[index][i] += error*error; } duration_count[index]++; } if(last == AV_NOPTS_VALUE || duration_count[index]<=1) last_dts[pkt->stream_index]= pkt->dts; if (st->codec->codec_id == CODEC_ID_NONE) { AVProbeData *pd = &(probe_data[st->index]); pd->buf = av_realloc(pd->buf, pd->buf_size+pkt->size+AVPROBE_PADDING_SIZE); memcpy(pd->buf+pd->buf_size, pkt->data, pkt->size); pd->buf_size += pkt->size; memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE); } } if(st->parser && st->parser->parser->split && !st->codec->extradata){ int i= st->parser->parser->split(st->codec, pkt->data, pkt->size); if(i){ st->codec->extradata_size= i; st->codec->extradata= av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); memcpy(st->codec->extradata, pkt->data, st->codec->extradata_size); memset(st->codec->extradata + i, 0, FF_INPUT_BUFFER_PADDING_SIZE); } } if (!has_codec_parameters(st->codec) ) try_decode_frame(st, pkt->data, pkt->size); if (st->time_base.den > 0 && av_rescale_q(codec_info_duration[st->index], st->time_base, AV_TIME_BASE_Q) >= ic->max_analyze_duration) { break; } count++; } for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; if(st->codec->codec) avcodec_close(st->codec); } for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; if (st->codec->codec_type == CODEC_TYPE_VIDEO) { if(st->codec->codec_id == CODEC_ID_RAWVIDEO && !st->codec->codec_tag && !st->codec->bits_per_sample) st->codec->codec_tag= avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt); if(duration_count[i] && tb_unreliable(st->codec) ){ double best_error= 2*av_q2d(st->time_base); best_error= best_error*best_error*duration_count[i]*1000*12*30; for(j=1; j<MAX_STD_TIMEBASES; j++){ double error= duration_error[i][j] * get_std_framerate(j); if(error < best_error){ best_error= error; av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, get_std_framerate(j), 12*1001, INT_MAX); } } } if (!st->r_frame_rate.num){ if( st->codec->time_base.den * (int64_t)st->time_base.num <= st->codec->time_base.num * (int64_t)st->time_base.den){ st->r_frame_rate.num = st->codec->time_base.den; st->r_frame_rate.den = st->codec->time_base.num; }else{ st->r_frame_rate.num = st->time_base.den; st->r_frame_rate.den = st->time_base.num; } } }else if(st->codec->codec_type == CODEC_TYPE_AUDIO) { if (st->codec->codec_id == CODEC_ID_NONE && probe_data[st->index].buf_size > 0) { codec_identified[st->index] = set_codec_from_probe_data(st, &(probe_data[st->index]), 1); if (codec_identified[st->index]) { st->need_parsing = AVSTREAM_PARSE_FULL; } } if(!st->codec->bits_per_sample) st->codec->bits_per_sample= av_get_bits_per_sample(st->codec->codec_id); } } av_estimate_timings(ic, old_offset); for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; if (codec_identified[st->index]) break; } if(i!=ic->nb_streams){ av_read_frame_flush(ic); for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; if (codec_identified[st->index]) { av_seek_frame(ic, st->index, 0.0, 0); } st->cur_dts= st->first_dts; } url_fseek(ic->pb, ic->data_offset, SEEK_SET); } #if 0 for(i=0;i<ic->nb_streams;i++) { st = ic->streams[i]; if (st->codec->codec_type == CODEC_TYPE_VIDEO) { if(b-frames){ ppktl = &ic->packet_buffer; while(ppkt1){ if(ppkt1->stream_index != i) continue; if(ppkt1->pkt->dts < 0) break; if(ppkt1->pkt->pts != AV_NOPTS_VALUE) break; ppkt1->pkt->dts -= delta; ppkt1= ppkt1->next; } if(ppkt1) continue; st->cur_dts -= delta; } } } #endif av_free(duration_error); for(i=0;i<MAX_STREAMS;i++){ av_freep(&(probe_data[i].buf)); } return ret; } libavformat/utils.c:1927: error: Uninitialized Value The value read from last_dts[_] was never initialized. libavformat/utils.c:1927:13: 1925. { 1926. int index= pkt->stream_index; 1927. int64_t last= last_dts[index]; ^ 1928. int64_t duration= pkt->dts - last; 1929.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/utils.c/#L1927
d2a_code_trace_data_44488
static int www_body(char *hostname, int s, int stype, unsigned char *context) { char *buf = NULL; int ret = 1; int i, j, k, dot; SSL *con; const SSL_CIPHER *c; BIO *io, *ssl_bio, *sbio; #ifdef RENEG int total_bytes = 0; #endif int width; fd_set readfds; width = s + 1; buf = app_malloc(bufsize, "server www buffer"); io = BIO_new(BIO_f_buffer()); ssl_bio = BIO_new(BIO_f_ssl()); if ((io == NULL) || (ssl_bio == NULL)) goto err; #ifdef FIONBIO if (s_nbio) { unsigned long sl = 1; if (!s_quiet) BIO_printf(bio_err, "turning on non blocking io\n"); if (BIO_socket_ioctl(s, FIONBIO, &sl) < 0) ERR_print_errors(bio_err); } #endif if (!BIO_set_write_buffer_size(io, bufsize)) goto err; if ((con = SSL_new(ctx)) == NULL) goto err; if (s_tlsextdebug) { SSL_set_tlsext_debug_callback(con, tlsext_cb); SSL_set_tlsext_debug_arg(con, bio_s_out); } if (context && !SSL_set_session_id_context(con, context, strlen((char *)context))) goto err; sbio = BIO_new_socket(s, BIO_NOCLOSE); if (s_nbio_test) { BIO *test; test = BIO_new(BIO_f_nbio_test()); sbio = BIO_push(test, sbio); } SSL_set_bio(con, sbio, sbio); SSL_set_accept_state(con); BIO_set_ssl(ssl_bio, con, BIO_CLOSE); BIO_push(io, ssl_bio); #ifdef CHARSET_EBCDIC io = BIO_push(BIO_new(BIO_f_ebcdic_filter()), io); #endif if (s_debug) { SSL_set_debug(con, 1); BIO_set_callback(SSL_get_rbio(con), bio_dump_callback); BIO_set_callback_arg(SSL_get_rbio(con), (char *)bio_s_out); } if (s_msg) { #ifndef OPENSSL_NO_SSL_TRACE if (s_msg == 2) SSL_set_msg_callback(con, SSL_trace); else #endif SSL_set_msg_callback(con, msg_cb); SSL_set_msg_callback_arg(con, bio_s_msg ? bio_s_msg : bio_s_out); } for (;;) { i = BIO_gets(io, buf, bufsize - 1); if (i < 0) { if (!BIO_should_retry(io) && !SSL_waiting_for_async(con)) { if (!s_quiet) ERR_print_errors(bio_err); goto err; } else { BIO_printf(bio_s_out, "read R BLOCK\n"); #ifndef OPENSSL_NO_SRP if (BIO_should_io_special(io) && BIO_get_retry_reason(io) == BIO_RR_SSL_X509_LOOKUP) { BIO_printf(bio_s_out, "LOOKUP renego during read\n"); srp_callback_parm.user = SRP_VBASE_get_by_user(srp_callback_parm.vb, srp_callback_parm.login); if (srp_callback_parm.user) BIO_printf(bio_s_out, "LOOKUP done %s\n", srp_callback_parm.user->info); else BIO_printf(bio_s_out, "LOOKUP not successful\n"); continue; } #endif #if defined(OPENSSL_SYS_NETWARE) delay(1000); #elif !defined(OPENSSL_SYS_MSDOS) sleep(1); #endif continue; } } else if (i == 0) { ret = 1; goto end; } if (((www == 1) && (strncmp("GET ", buf, 4) == 0)) || ((www == 2) && (strncmp("GET /stats ", buf, 11) == 0))) { char *p; X509 *peer; STACK_OF(SSL_CIPHER) *sk; static const char *space = " "; if (www == 1 && strncmp("GET /reneg", buf, 10) == 0) { if (strncmp("GET /renegcert", buf, 14) == 0) SSL_set_verify(con, SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE, NULL); i = SSL_renegotiate(con); BIO_printf(bio_s_out, "SSL_renegotiate -> %d\n", i); i = SSL_do_handshake(con); if (i <= 0) { BIO_printf(bio_s_out, "SSL_do_handshake() Retval %d\n", SSL_get_error(con, i)); ERR_print_errors(bio_err); goto err; } FD_ZERO(&readfds); openssl_fdset(s, &readfds); i = select(width, (void *)&readfds, NULL, NULL, NULL); if (i <= 0 || !FD_ISSET(s, &readfds)) { BIO_printf(bio_s_out, "Error waiting for client response\n"); ERR_print_errors(bio_err); goto err; } BIO_gets(io, buf, bufsize - 1); } BIO_puts(io, "HTTP/1.0 200 ok\r\nContent-type: text/html\r\n\r\n"); BIO_puts(io, "<HTML><BODY BGCOLOR=\"#ffffff\">\n"); BIO_puts(io, "<pre>\n"); BIO_puts(io, "\n"); for (i = 0; i < local_argc; i++) { const char *myp; for (myp = local_argv[i]; *myp; myp++) switch (*myp) { case '<': BIO_puts(io, "&lt;"); break; case '>': BIO_puts(io, "&gt;"); break; case '&': BIO_puts(io, "&amp;"); break; default: BIO_write(io, myp, 1); break; } BIO_write(io, " ", 1); } BIO_puts(io, "\n"); BIO_printf(io, "Secure Renegotiation IS%s supported\n", SSL_get_secure_renegotiation_support(con) ? "" : " NOT"); BIO_printf(io, "Ciphers supported in s_server binary\n"); sk = SSL_get_ciphers(con); j = sk_SSL_CIPHER_num(sk); for (i = 0; i < j; i++) { c = sk_SSL_CIPHER_value(sk, i); BIO_printf(io, "%-11s:%-25s ", SSL_CIPHER_get_version(c), SSL_CIPHER_get_name(c)); if ((((i + 1) % 2) == 0) && (i + 1 != j)) BIO_puts(io, "\n"); } BIO_puts(io, "\n"); p = SSL_get_shared_ciphers(con, buf, bufsize); if (p != NULL) { BIO_printf(io, "---\nCiphers common between both SSL end points:\n"); j = i = 0; while (*p) { if (*p == ':') { BIO_write(io, space, 26 - j); i++; j = 0; BIO_write(io, ((i % 3) ? " " : "\n"), 1); } else { BIO_write(io, p, 1); j++; } p++; } BIO_puts(io, "\n"); } ssl_print_sigalgs(io, con); #ifndef OPENSSL_NO_EC ssl_print_curves(io, con, 0); #endif BIO_printf(io, (SSL_cache_hit(con) ? "---\nReused, " : "---\nNew, ")); c = SSL_get_current_cipher(con); BIO_printf(io, "%s, Cipher is %s\n", SSL_CIPHER_get_version(c), SSL_CIPHER_get_name(c)); SSL_SESSION_print(io, SSL_get_session(con)); BIO_printf(io, "---\n"); print_stats(io, SSL_get_SSL_CTX(con)); BIO_printf(io, "---\n"); peer = SSL_get_peer_certificate(con); if (peer != NULL) { BIO_printf(io, "Client certificate\n"); X509_print(io, peer); PEM_write_bio_X509(io, peer); } else BIO_puts(io, "no client certificate available\n"); BIO_puts(io, "</BODY></HTML>\r\n\r\n"); break; } else if ((www == 2 || www == 3) && (strncmp("GET /", buf, 5) == 0)) { BIO *file; char *p, *e; static const char *text = "HTTP/1.0 200 ok\r\nContent-type: text/plain\r\n\r\n"; p = &(buf[5]); dot = 1; for (e = p; *e != '\0'; e++) { if (e[0] == ' ') break; switch (dot) { case 1: dot = (e[0] == '.') ? 2 : 0; break; case 2: dot = (e[0] == '.') ? 3 : 0; break; case 3: dot = (e[0] == '/') ? -1 : 0; break; } if (dot == 0) dot = (e[0] == '/') ? 1 : 0; } dot = (dot == 3) || (dot == -1); if (*e == '\0') { BIO_puts(io, text); BIO_printf(io, "'%s' is an invalid file name\r\n", p); break; } *e = '\0'; if (dot) { BIO_puts(io, text); BIO_printf(io, "'%s' contains '..' reference\r\n", p); break; } if (*p == '/') { BIO_puts(io, text); BIO_printf(io, "'%s' is an invalid path\r\n", p); break; } if (app_isdir(p) > 0) { BIO_puts(io, text); BIO_printf(io, "'%s' is a directory\r\n", p); break; } if ((file = BIO_new_file(p, "r")) == NULL) { BIO_puts(io, text); BIO_printf(io, "Error opening '%s'\r\n", p); ERR_print_errors(io); break; } if (!s_quiet) BIO_printf(bio_err, "FILE:%s\n", p); if (www == 2) { i = strlen(p); if (((i > 5) && (strcmp(&(p[i - 5]), ".html") == 0)) || ((i > 4) && (strcmp(&(p[i - 4]), ".php") == 0)) || ((i > 4) && (strcmp(&(p[i - 4]), ".htm") == 0))) BIO_puts(io, "HTTP/1.0 200 ok\r\nContent-type: text/html\r\n\r\n"); else BIO_puts(io, "HTTP/1.0 200 ok\r\nContent-type: text/plain\r\n\r\n"); } for (;;) { i = BIO_read(file, buf, bufsize); if (i <= 0) break; #ifdef RENEG total_bytes += i; BIO_printf(bio_err, "%d\n", i); if (total_bytes > 3 * 1024) { total_bytes = 0; BIO_printf(bio_err, "RENEGOTIATE\n"); SSL_renegotiate(con); } #endif for (j = 0; j < i;) { #ifdef RENEG { static count = 0; if (++count == 13) { SSL_renegotiate(con); } } #endif k = BIO_write(io, &(buf[j]), i - j); if (k <= 0) { if (!BIO_should_retry(io) && !SSL_waiting_for_async(con)) goto write_error; else { BIO_printf(bio_s_out, "rwrite W BLOCK\n"); } } else { j += k; } } } write_error: BIO_free(file); break; } } for (;;) { i = (int)BIO_flush(io); if (i <= 0) { if (!BIO_should_retry(io)) break; } else break; } end: SSL_set_shutdown(con, SSL_SENT_SHUTDOWN | SSL_RECEIVED_SHUTDOWN); err: if (ret >= 0) BIO_printf(bio_s_out, "ACCEPT\n"); OPENSSL_free(buf); BIO_free_all(io); return (ret); } apps/s_server.c:2606: error: MEMORY_LEAK memory dynamically allocated to `ssl_bio` by call to `BIO_new()` at line 2605, column 15 is not reachable after line 2606, column 10. Showing all 63 steps of the trace apps/s_server.c:2586:1: start of procedure www_body() 2584. #endif 2585. 2586. > static int www_body(char *hostname, int s, int stype, unsigned char *context) 2587. { 2588. char *buf = NULL; apps/s_server.c:2588:5: 2586. static int www_body(char *hostname, int s, int stype, unsigned char *context) 2587. { 2588. > char *buf = NULL; 2589. int ret = 1; 2590. int i, j, k, dot; apps/s_server.c:2589:5: 2587. { 2588. char *buf = NULL; 2589. > int ret = 1; 2590. int i, j, k, dot; 2591. SSL *con; apps/s_server.c:2601:5: 2599. 2600. /* Set width for a select call if needed */ 2601. > width = s + 1; 2602. 2603. buf = app_malloc(bufsize, "server www buffer"); apps/s_server.c:2603:5: 2601. width = s + 1; 2602. 2603. > buf = app_malloc(bufsize, "server www buffer"); 2604. io = BIO_new(BIO_f_buffer()); 2605. ssl_bio = BIO_new(BIO_f_ssl()); apps/apps.c:976:1: start of procedure app_malloc() 974. } 975. 976. > void* app_malloc(int sz, const char *what) 977. { 978. void *vp = OPENSSL_malloc(sz); apps/apps.c:978:5: 976. void* app_malloc(int sz, const char *what) 977. { 978. > void *vp = OPENSSL_malloc(sz); 979. 980. if (vp == NULL) { crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) apps/apps.c:980:9: Taking false branch 978. void *vp = OPENSSL_malloc(sz); 979. 980. if (vp == NULL) { ^ 981. BIO_printf(bio_err, "%s: Could not allocate %d bytes for %s\n", 982. opt_getprog(), sz, what); apps/apps.c:986:5: 984. exit(1); 985. } 986. > return vp; 987. } 988. apps/apps.c:987:1: return from a call to app_malloc 985. } 986. return vp; 987. > } 988. 989. apps/s_server.c:2604:5: 2602. 2603. buf = app_malloc(bufsize, "server www buffer"); 2604. > io = BIO_new(BIO_f_buffer()); 2605. ssl_bio = BIO_new(BIO_f_ssl()); 2606. if ((io == NULL) || (ssl_bio == NULL)) crypto/bio/bf_buff.c:87:1: start of procedure BIO_f_buffer() 85. }; 86. 87. > BIO_METHOD *BIO_f_buffer(void) 88. { 89. return (&methods_buffer); crypto/bio/bf_buff.c:89:5: 87. BIO_METHOD *BIO_f_buffer(void) 88. { 89. > return (&methods_buffer); 90. } 91. crypto/bio/bf_buff.c:90:1: return from a call to BIO_f_buffer 88. { 89. return (&methods_buffer); 90. > } 91. 92. static int buffer_new(BIO *bi) crypto/bio/bio_lib.c:66:1: start of procedure BIO_new() 64. #include <openssl/stack.h> 65. 66. > BIO *BIO_new(BIO_METHOD *method) 67. { 68. BIO *ret = OPENSSL_malloc(sizeof(*ret)); crypto/bio/bio_lib.c:68:5: 66. BIO *BIO_new(BIO_METHOD *method) 67. { 68. > BIO *ret = OPENSSL_malloc(sizeof(*ret)); 69. 70. 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/bio/bio_lib.c:70:9: Taking false branch 68. BIO *ret = OPENSSL_malloc(sizeof(*ret)); 69. 70. if (ret == NULL) { ^ 71. BIOerr(BIO_F_BIO_NEW, ERR_R_MALLOC_FAILURE); 72. return (NULL); crypto/bio/bio_lib.c:74:10: Taking true branch 72. return (NULL); 73. } 74. if (!BIO_set(ret, method)) { ^ 75. OPENSSL_free(ret); 76. ret = NULL; crypto/bio/bio_lib.c:75:9: 73. } 74. if (!BIO_set(ret, method)) { 75. > OPENSSL_free(ret); 76. ret = NULL; 77. } crypto/mem.c:234:1: start of procedure CRYPTO_free() 232. } 233. 234. > void CRYPTO_free(void *str) 235. { 236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:245:5: 243. } 244. #else 245. > free(str); 246. #endif 247. } crypto/mem.c:247:1: return from a call to CRYPTO_free 245. free(str); 246. #endif 247. > } 248. 249. void CRYPTO_clear_free(void *str, size_t num) crypto/bio/bio_lib.c:76:9: 74. if (!BIO_set(ret, method)) { 75. OPENSSL_free(ret); 76. > ret = NULL; 77. } 78. return (ret); crypto/bio/bio_lib.c:78:5: 76. ret = NULL; 77. } 78. > return (ret); 79. } 80. crypto/bio/bio_lib.c:79:1: return from a call to BIO_new 77. } 78. return (ret); 79. > } 80. 81. int BIO_set(BIO *bio, BIO_METHOD *method) apps/s_server.c:2605:5: 2603. buf = app_malloc(bufsize, "server www buffer"); 2604. io = BIO_new(BIO_f_buffer()); 2605. > ssl_bio = BIO_new(BIO_f_ssl()); 2606. if ((io == NULL) || (ssl_bio == NULL)) 2607. goto err; ssl/bio_ssl.c:97:1: start of procedure BIO_f_ssl() 95. }; 96. 97. > BIO_METHOD *BIO_f_ssl(void) 98. { 99. return (&methods_sslp); ssl/bio_ssl.c:99:5: 97. BIO_METHOD *BIO_f_ssl(void) 98. { 99. > return (&methods_sslp); 100. } 101. ssl/bio_ssl.c:100:1: return from a call to BIO_f_ssl 98. { 99. return (&methods_sslp); 100. > } 101. 102. static int ssl_new(BIO *bi) crypto/bio/bio_lib.c:66:1: start of procedure BIO_new() 64. #include <openssl/stack.h> 65. 66. > BIO *BIO_new(BIO_METHOD *method) 67. { 68. BIO *ret = OPENSSL_malloc(sizeof(*ret)); crypto/bio/bio_lib.c:68:5: 66. BIO *BIO_new(BIO_METHOD *method) 67. { 68. > BIO *ret = OPENSSL_malloc(sizeof(*ret)); 69. 70. 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/bio/bio_lib.c:70:9: Taking false branch 68. BIO *ret = OPENSSL_malloc(sizeof(*ret)); 69. 70. if (ret == NULL) { ^ 71. BIOerr(BIO_F_BIO_NEW, ERR_R_MALLOC_FAILURE); 72. return (NULL); crypto/bio/bio_lib.c:74:10: Taking false branch 72. return (NULL); 73. } 74. if (!BIO_set(ret, method)) { ^ 75. OPENSSL_free(ret); 76. ret = NULL; crypto/bio/bio_lib.c:78:5: 76. ret = NULL; 77. } 78. > return (ret); 79. } 80. crypto/bio/bio_lib.c:79:1: return from a call to BIO_new 77. } 78. return (ret); 79. > } 80. 81. int BIO_set(BIO *bio, BIO_METHOD *method) apps/s_server.c:2606:10: Taking true branch 2604. io = BIO_new(BIO_f_buffer()); 2605. ssl_bio = BIO_new(BIO_f_ssl()); 2606. if ((io == NULL) || (ssl_bio == NULL)) ^ 2607. goto err; 2608.
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/apps/s_server.c/#L2606
d2a_code_trace_data_44489
static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale){ int v; int i=0; uint8_t state[CONTEXT_SIZE]; memset(state, 128, sizeof(state)); for(v=0; i<128 ; v++){ int len= get_symbol(c, state, 0) + 1; if(len + i > 128) return -1; while(len--){ quant_table[i] = scale*v; i++; } } for(i=1; i<128; i++){ quant_table[256-i]= -quant_table[i]; } quant_table[128]= -quant_table[127]; return 2*v - 1; } libavcodec/ffv1.c:907: error: Buffer Overrun L1 Offset: [129, 259] (⇐ [0, 4] + [129, 255]) Size: 5 by call to `read_quant_table`. libavcodec/ffv1.c:865:1: Parameter `f->quant_table[*]` 863. } 864. 865. static int read_header(FFV1Context *f){ ^ 866. uint8_t state[CONTEXT_SIZE]; 867. int i, context_count; libavcodec/ffv1.c:907:25: Call 905. context_count=1; 906. for(i=0; i<5; i++){ 907. context_count*= read_quant_table(c, f->quant_table[i], context_count); ^ 908. if(context_count < 0 || context_count > 32768){ 909. av_log(f->avctx, AV_LOG_ERROR, "read_quant_table error\n"); libavcodec/ffv1.c:857:9: <Offset trace> 855. } 856. 857. for(i=1; i<128; i++){ ^ 858. quant_table[256-i]= -quant_table[i]; 859. } libavcodec/ffv1.c:857:9: Assignment 855. } 856. 857. for(i=1; i<128; i++){ ^ 858. quant_table[256-i]= -quant_table[i]; 859. } libavcodec/ffv1.c:837:1: <Length trace> 835. } 836. 837. static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale){ ^ 838. int v; 839. int i=0; libavcodec/ffv1.c:837:1: Parameter `*quant_table` 835. } 836. 837. static int read_quant_table(RangeCoder *c, int16_t *quant_table, int scale){ ^ 838. int v; 839. int i=0; libavcodec/ffv1.c:858:9: Array access: Offset: [129, 259] (⇐ [0, 4] + [129, 255]) Size: 5 by call to `read_quant_table` 856. 857. for(i=1; i<128; i++){ 858. quant_table[256-i]= -quant_table[i]; ^ 859. } 860. quant_table[128]= -quant_table[127];
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ffv1.c/#L858
d2a_code_trace_data_44490
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:1076: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + `s->tlsext_hostname->strlen` + 25]):unsigned64 by call to `WPACKET_start_sub_packet_len__`. Showing all 12 steps of the trace ssl/t1_lib.c:1074:14: Call 1072. /* Add SRP username if there is one */ 1073. if (s->srp_ctx.login != NULL) { 1074. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_srp) ^ 1075. /* Sub-packet for SRP extension */ 1076. || !WPACKET_start_sub_packet_u16(pkt) ssl/packet.c: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:1076:21: Call 1074. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_srp) 1075. /* Sub-packet for SRP extension */ 1076. || !WPACKET_start_sub_packet_u16(pkt) ^ 1077. || !WPACKET_start_sub_packet_u8(pkt) 1078. /* login must not be zero...internal error if so */ ssl/packet.c: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->tlsext_hostname->strlen + 25]):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_44491
void ngx_http_set_exten(ngx_http_request_t *r) { ngx_int_t i; ngx_str_null(&r->exten); for (i = r->uri.len - 1; i > 1; i--) { if (r->uri.data[i] == '.' && r->uri.data[i - 1] != '/') { r->exten.len = r->uri.len - i - 1; r->exten.data = &r->uri.data[i + 1]; return; } else if (r->uri.data[i] == '/') { return; } } return; } src/http/ngx_http_upstream.c:938: error: Integer Overflow L2 ([0, +oo] - 1):unsigned64 by call to `ngx_http_upstream_connect`. src/http/ngx_http_upstream.c:938:5: Call 936. ur->ctx = NULL; 937. 938. ngx_http_upstream_connect(r, u); ^ 939. 940. failed: src/http/ngx_http_upstream.c:1132:1: Parameter `r->uri.len` 1130. 1131. 1132. static void ^ 1133. ngx_http_upstream_connect(ngx_http_request_t *r, ngx_http_upstream_t *u) 1134. { src/http/ngx_http_upstream.c:1273:5: Call 1271. #endif 1272. 1273. ngx_http_upstream_send_request(r, u); ^ 1274. } 1275. src/http/ngx_http_upstream.c:1416:1: Parameter `r->uri.len` 1414. 1415. 1416. static void ^ 1417. ngx_http_upstream_send_request(ngx_http_request_t *r, ngx_http_upstream_t *u) 1418. { src/http/ngx_http_upstream.c:1476:9: Call 1474. 1475. if (c->read->ready) { 1476. ngx_http_upstream_process_header(r, u); ^ 1477. return; 1478. } src/http/ngx_http_upstream.c:1527:1: Parameter `r->uri.len` 1525. 1526. 1527. static void ^ 1528. ngx_http_upstream_process_header(ngx_http_request_t *r, ngx_http_upstream_t *u) 1529. { src/http/ngx_http_upstream.c:1658:13: Call 1656. } 1657. 1658. if (ngx_http_upstream_test_next(r, u) == NGX_OK) { ^ 1659. return; 1660. } src/http/ngx_http_upstream.c:1713:1: Parameter `r->uri.len` 1711. 1712. 1713. static ngx_int_t ^ 1714. ngx_http_upstream_test_next(ngx_http_request_t *r, ngx_http_upstream_t *u) 1715. { src/http/ngx_http_upstream.c:1728:13: Call 1726. 1727. if (u->peer.tries > 1 && (u->conf->next_upstream & un->mask)) { 1728. ngx_http_upstream_next(r, u, un->mask); ^ 1729. return NGX_OK; 1730. } src/http/ngx_http_upstream.c:3131:1: Parameter `r->uri.len` 3129. 3130. 3131. static void ^ 3132. ngx_http_upstream_next(ngx_http_request_t *r, ngx_http_upstream_t *u, 3133. ngx_uint_t ft_type) src/http/ngx_http_upstream.c:3218:26: Call 3216. if (rc == NGX_OK) { 3217. u->cache_status = NGX_HTTP_CACHE_STALE; 3218. rc = ngx_http_upstream_cache_send(r, u); ^ 3219. } 3220. src/http/ngx_http_upstream.c:832:1: Parameter `r->uri.len` 830. 831. 832. static ngx_int_t ^ 833. ngx_http_upstream_cache_send(ngx_http_request_t *r, ngx_http_upstream_t *u) 834. { src/http/ngx_http_upstream.c:865:13: Call 863. if (rc == NGX_OK) { 864. 865. if (ngx_http_upstream_process_headers(r, u) != NGX_OK) { ^ 866. return NGX_DONE; 867. } src/http/ngx_http_upstream.c:1881:1: Parameter `r->uri.len` 1879. 1880. 1881. static ngx_int_t ^ 1882. ngx_http_upstream_process_headers(ngx_http_request_t *r, ngx_http_upstream_t *u) 1883. { src/http/ngx_http_upstream.c:1896:9: Call 1894. && !(u->conf->ignore_headers & NGX_HTTP_UPSTREAM_IGN_XA_REDIRECT)) 1895. { 1896. ngx_http_upstream_finalize_request(r, u, NGX_DECLINED); ^ 1897. 1898. part = &u->headers_in.headers.part; src/http/ngx_http_upstream.c:3269:1: Parameter `r->uri.len` 3267. 3268. 3269. static void ^ 3270. ngx_http_upstream_finalize_request(ngx_http_request_t *r, 3271. ngx_http_upstream_t *u, ngx_int_t rc) src/http/ngx_http_upstream.c:3402:5: Call 3400. } 3401. 3402. ngx_http_finalize_request(r, rc); ^ 3403. } 3404. src/http/ngx_http_request.c:2198:1: Parameter `r->uri.len` 2196. 2197. 2198. void ^ 2199. ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc) 2200. { src/http/ngx_http_request.c:2270:38: Call 2268. c->write->handler = ngx_http_request_handler; 2269. 2270. ngx_http_finalize_request(r, ngx_http_special_response_handler(r, rc)); ^ 2271. return; 2272. } src/http/ngx_http_special_response.c:365:1: Parameter `r->uri.len` 363. 364. 365. ngx_int_t ^ 366. ngx_http_special_response_handler(ngx_http_request_t *r, ngx_int_t error) 367. { src/http/ngx_http_special_response.c:416:24: Call 414. for (i = 0; i < clcf->error_pages->nelts; i++) { 415. if (err_page[i].status == error) { 416. return ngx_http_send_error_page(r, &err_page[i]); ^ 417. } 418. } src/http/ngx_http_special_response.c:534:1: Parameter `r->uri.len` 532. 533. 534. static ngx_int_t ^ 535. ngx_http_send_error_page(ngx_http_request_t *r, ngx_http_err_page_t *err_page) 536. { src/http/ngx_http_special_response.c:570:16: Call 568. } 569. 570. return ngx_http_internal_redirect(r, &uri, &args); ^ 571. } 572. src/http/ngx_http_core_module.c:2551:1: Parameter `r->uri.len` 2549. 2550. 2551. ngx_int_t ^ 2552. ngx_http_internal_redirect(ngx_http_request_t *r, 2553. ngx_str_t *uri, ngx_str_t *args) src/http/ngx_http_core_module.c:2581:5: Call 2579. "internal redirect: \"%V?%V\"", uri, &r->args); 2580. 2581. ngx_http_set_exten(r); ^ 2582. 2583. /* clear the modules contexts */ src/http/ngx_http_core_module.c:1795:1: <LHS trace> 1793. 1794. 1795. void ^ 1796. ngx_http_set_exten(ngx_http_request_t *r) 1797. { src/http/ngx_http_core_module.c:1795:1: Parameter `r->uri.len` 1793. 1794. 1795. void ^ 1796. ngx_http_set_exten(ngx_http_request_t *r) 1797. { src/http/ngx_http_core_module.c:1802:10: Binary operation: ([0, +oo] - 1):unsigned64 by call to `ngx_http_upstream_connect` 1800. ngx_str_null(&r->exten); 1801. 1802. for (i = r->uri.len - 1; i > 1; i--) { ^ 1803. if (r->uri.data[i] == '.' && r->uri.data[i - 1] != '/') { 1804.
https://github.com/nginx/nginx/blob/416b922bd2c285551d195c1f33a3736775ea45e9/src/http/ngx_http_core_module.c/#L1802
d2a_code_trace_data_44492
ASN1_OBJECT *OBJ_nid2obj(int n) { ADDED_OBJ ad, *adp; ASN1_OBJECT ob; if ((n >= 0) && (n < NUM_NID)) { if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) { OBJerr(OBJ_F_OBJ_NID2OBJ, OBJ_R_UNKNOWN_NID); return (NULL); } return ((ASN1_OBJECT *)&(nid_objs[n])); } else if (added == NULL) return (NULL); else { ad.type = ADDED_NID; ad.obj = &ob; ob.nid = n; adp = lh_ADDED_OBJ_retrieve(added, &ad); if (adp != NULL) return (adp->obj); else { OBJerr(OBJ_F_OBJ_NID2OBJ, OBJ_R_UNKNOWN_NID); return (NULL); } } } crypto/asn1/p5_scrypt.c:128: error: USE_AFTER_FREE call to `OBJ_nid2obj()` eventually accesses memory that was invalidated by call to `free()` on line 122 indirectly during the call to `EVP_CIPHER_type()`. Showing all 17 steps of the trace crypto/asn1/p5_scrypt.c:122:15: invalidation part of the trace starts here 120. } 121. 122. alg_nid = EVP_CIPHER_type(cipher); ^ 123. if (alg_nid == NID_undef) { 124. ASN1err(ASN1_F_PKCS5_PBE2_SET_SCRYPT, crypto/asn1/p5_scrypt.c:122:15: global variable `nid_objs` accessed here 120. } 121. 122. alg_nid = EVP_CIPHER_type(cipher); ^ 123. if (alg_nid == NID_undef) { 124. ASN1err(ASN1_F_PKCS5_PBE2_SET_SCRYPT, crypto/asn1/p5_scrypt.c:122:15: when calling `EVP_CIPHER_type` here 120. } 121. 122. alg_nid = EVP_CIPHER_type(cipher); ^ 123. if (alg_nid == NID_undef) { 124. ASN1err(ASN1_F_PKCS5_PBE2_SET_SCRYPT, crypto/evp/evp_lib.c:206:16: global variable `nid_objs` accessed here 204. default: 205. /* Check it has an OID and it is valid */ 206. otmp = OBJ_nid2obj(nid); ^ 207. if (OBJ_get0_data(otmp) == NULL) 208. nid = NID_undef; crypto/evp/evp_lib.c:206:16: passed as argument to `OBJ_nid2obj` 204. default: 205. /* Check it has an OID and it is valid */ 206. otmp = OBJ_nid2obj(nid); ^ 207. if (OBJ_get0_data(otmp) == NULL) 208. nid = NID_undef; crypto/evp/evp_lib.c:206:16: return from call to `OBJ_nid2obj` 204. default: 205. /* Check it has an OID and it is valid */ 206. otmp = OBJ_nid2obj(nid); ^ 207. if (OBJ_get0_data(otmp) == NULL) 208. nid = NID_undef; crypto/evp/evp_lib.c:206:9: assigned 204. default: 205. /* Check it has an OID and it is valid */ 206. otmp = OBJ_nid2obj(nid); ^ 207. if (OBJ_get0_data(otmp) == NULL) 208. nid = NID_undef; crypto/evp/evp_lib.c:209:9: when calling `ASN1_OBJECT_free` here 207. if (OBJ_get0_data(otmp) == NULL) 208. nid = NID_undef; 209. ASN1_OBJECT_free(otmp); ^ 210. return nid; 211. } crypto/asn1/a_object.c:380:1: parameter `a` of ASN1_OBJECT_free 378. } 379. 380. > void ASN1_OBJECT_free(ASN1_OBJECT *a) 381. { 382. if (a == NULL) crypto/asn1/a_object.c:399:9: when calling `CRYPTO_free` here 397. } 398. if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC) 399. OPENSSL_free(a); ^ 400. } 401. crypto/mem.c:234:1: parameter `str` of CRYPTO_free 232. } 233. 234. > void CRYPTO_free(void *str) 235. { 236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:245:5: was invalidated by call to `free()` 243. } 244. #else 245. free(str); ^ 246. #endif 247. } crypto/asn1/p5_scrypt.c:122:15: use-after-lifetime part of the trace starts here 120. } 121. 122. alg_nid = EVP_CIPHER_type(cipher); ^ 123. if (alg_nid == NID_undef) { 124. ASN1err(ASN1_F_PKCS5_PBE2_SET_SCRYPT, crypto/asn1/p5_scrypt.c:122:15: global variable `nid_objs` accessed here 120. } 121. 122. alg_nid = EVP_CIPHER_type(cipher); ^ 123. if (alg_nid == NID_undef) { 124. ASN1err(ASN1_F_PKCS5_PBE2_SET_SCRYPT, crypto/asn1/p5_scrypt.c:128:11: when calling `OBJ_nid2obj` here 126. goto err; 127. } 128. obj = OBJ_nid2obj(alg_nid); ^ 129. pbe2 = PBE2PARAM_new(); 130. if (pbe2 == NULL) crypto/objects/obj_dat.c:299:34: global variable `nid_objs` accessed here 297. 298. if ((n >= 0) && (n < NUM_NID)) { 299. if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) { ^ 300. OBJerr(OBJ_F_OBJ_NID2OBJ, OBJ_R_UNKNOWN_NID); 301. return (NULL); crypto/objects/obj_dat.c:299:34: invalid access occurs here 297. 298. if ((n >= 0) && (n < NUM_NID)) { 299. if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) { ^ 300. OBJerr(OBJ_F_OBJ_NID2OBJ, OBJ_R_UNKNOWN_NID); 301. return (NULL);
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/objects/obj_dat.c/#L299
d2a_code_trace_data_44493
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) { int i, j, max; const BN_ULONG *ap; BN_ULONG *rp; max = n * 2; ap = a; rp = r; rp[0] = rp[max - 1] = 0; rp++; j = n; if (--j > 0) { ap++; rp[j] = bn_mul_words(rp, ap, j, ap[-1]); rp += 2; } for (i = n - 2; i > 0; i--) { j--; ap++; rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]); rp += 2; } bn_add_words(r, r, r, max); bn_sqr_words(tmp, a, n); bn_add_words(r, r, tmp, max); } crypto/bn/bn_prime.c:223: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `witness`. Showing all 25 steps of the trace crypto/bn/bn_prime.c:198:10: Call 196. 197. /* compute A1 := a - 1 */ 198. if (!BN_copy(A1, a) || !BN_sub_word(A1, 1)) ^ 199. goto err; 200. /* compute A3 := a - 3 */ crypto/bn/bn_lib.c:285:1: Parameter `a->top` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_prime.c:223:13: Call 221. goto err; 222. 223. j = witness(check, a, A1, A1_odd, k, ctx, mont); ^ 224. if (j == -1) 225. goto err; crypto/bn/bn_prime.c:245:1: Parameter `w->top` 243. } 244. 245. > static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1, 246. const BIGNUM *a1_odd, int k, BN_CTX *ctx, 247. BN_MONT_CTX *mont) crypto/bn/bn_prime.c:249:10: Call 247. BN_MONT_CTX *mont) 248. { 249. if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */ ^ 250. return -1; 251. if (BN_is_one(w)) crypto/bn/bn_exp.c:296:1: Parameter `a->top` 294. } 295. 296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 297. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 298. { crypto/bn/bn_exp.c:310:16: Call 308. || BN_get_flags(a, BN_FLG_CONSTTIME) != 0 309. || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) { 310. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 311. } 312. crypto/bn/bn_exp.c:596:1: Parameter `a->top` 594. * http://www.daemonology.net/hyperthreading-considered-harmful/) 595. */ 596. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 597. const BIGNUM *m, BN_CTX *ctx, 598. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:759:17: Call 757. if (!BN_to_montgomery(&am, &am, mont, ctx)) 758. goto err; 759. } else if (!BN_to_montgomery(&am, a, mont, ctx)) ^ 760. goto err; 761. crypto/bn/bn_lib.c:870:1: Parameter `a->top` 868. } 869. 870. > int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 871. BN_CTX *ctx) 872. { crypto/bn/bn_lib.c:873:12: Call 871. BN_CTX *ctx) 872. { 873. return BN_mod_mul_montgomery(r, a, &(mont->RR), mont, ctx); ^ 874. } 875. crypto/bn/bn_mont.c:26:1: Parameter `a->top` 24. #endif 25. 26. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 27. BN_MONT_CTX *mont, BN_CTX *ctx) 28. { crypto/bn/bn_mont.c:53:14: Call 51. bn_check_top(tmp); 52. if (a == b) { 53. if (!BN_sqr(tmp, a, ctx)) ^ 54. goto err; 55. } else { crypto/bn/bn_sqr.c:17:1: Parameter `a->top` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int max, al; crypto/bn/bn_sqr.c:25:5: Assignment 23. bn_check_top(a); 24. 25. al = a->top; ^ 26. if (al <= 0) { 27. r->top = 0; crypto/bn/bn_sqr.c:74:17: Call 72. if (bn_wexpand(tmp, max) == NULL) 73. goto err; 74. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 75. } 76. } crypto/bn/bn_sqr.c:105:1: <Offset trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `n` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:116:5: Assignment 114. rp[0] = rp[max - 1] = 0; 115. rp++; 116. j = n; ^ 117. 118. if (--j > 0) { crypto/bn/bn_sqr.c:118:9: Assignment 116. j = n; 117. 118. if (--j > 0) { ^ 119. ap++; 120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); crypto/bn/bn_sqr.c:105:1: <Length trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `*r` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:113:5: Assignment 111. max = n * 2; 112. ap = a; 113. rp = r; ^ 114. rp[0] = rp[max - 1] = 0; 115. rp++; crypto/bn/bn_sqr.c:115:5: Assignment 113. rp = r; 114. rp[0] = rp[max - 1] = 0; 115. rp++; ^ 116. j = n; 117. crypto/bn/bn_sqr.c:120:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `witness` 118. if (--j > 0) { 119. ap++; 120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); ^ 121. rp += 2; 122. }
https://github.com/openssl/openssl/blob/b48d4397b8ee4256f0b0a115eb99f27ae89995e0/crypto/bn/bn_sqr.c/#L120
d2a_code_trace_data_44494
static inline int parse_nal_units(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t *buf, int buf_size) { H264Context *h = s->priv_data; const uint8_t *buf_end = buf + buf_size; unsigned int pps_id; unsigned int slice_type; int state = -1, got_reset = 0; const uint8_t *ptr; int field_poc[2]; s->pict_type = AV_PICTURE_TYPE_I; s->key_frame = 0; s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN; h->avctx = avctx; ff_h264_reset_sei(h); if (!buf_size) return 0; for (;;) { int src_length, dst_length, consumed; buf = avpriv_find_start_code(buf, buf_end, &state); if (buf >= buf_end) break; --buf; src_length = buf_end - buf; switch (state & 0x1f) { case NAL_SLICE: case NAL_IDR_SLICE: if ((state & 0x1f) == NAL_IDR_SLICE || ((state >> 5) & 0x3) == 0) { if (src_length > 60) src_length = 60; } else { if (src_length > 1000) src_length = 1000; } break; } ptr = ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length); if (!ptr || dst_length < 0) break; init_get_bits(&h->gb, ptr, 8 * dst_length); switch (h->nal_unit_type) { case NAL_SPS: ff_h264_decode_seq_parameter_set(h); break; case NAL_PPS: ff_h264_decode_picture_parameter_set(h, h->gb.size_in_bits); break; case NAL_SEI: ff_h264_decode_sei(h); break; case NAL_IDR_SLICE: s->key_frame = 1; h->prev_frame_num = 0; h->prev_frame_num_offset = 0; h->prev_poc_msb = h->prev_poc_lsb = 0; case NAL_SLICE: get_ue_golomb(&h->gb); slice_type = get_ue_golomb_31(&h->gb); s->pict_type = golomb_to_pict_type[slice_type % 5]; if (h->sei_recovery_frame_cnt >= 0) { s->key_frame = 1; } pps_id = get_ue_golomb(&h->gb); if (pps_id >= MAX_PPS_COUNT) { av_log(h->avctx, AV_LOG_ERROR, "pps_id %u out of range\n", pps_id); return -1; } if (!h->pps_buffers[pps_id]) { av_log(h->avctx, AV_LOG_ERROR, "non-existing PPS %u referenced\n", pps_id); return -1; } h->pps = *h->pps_buffers[pps_id]; if (!h->sps_buffers[h->pps.sps_id]) { av_log(h->avctx, AV_LOG_ERROR, "non-existing SPS %u referenced\n", h->pps.sps_id); return -1; } h->sps = *h->sps_buffers[h->pps.sps_id]; h->frame_num = get_bits(&h->gb, h->sps.log2_max_frame_num); avctx->profile = ff_h264_get_profile(&h->sps); avctx->level = h->sps.level_idc; if (h->sps.frame_mbs_only_flag) { h->picture_structure = PICT_FRAME; } else { if (get_bits1(&h->gb)) { h->picture_structure = PICT_TOP_FIELD + get_bits1(&h->gb); } else { h->picture_structure = PICT_FRAME; } } if (h->nal_unit_type == NAL_IDR_SLICE) get_ue_golomb(&h->gb); if (h->sps.poc_type == 0) { h->poc_lsb = get_bits(&h->gb, h->sps.log2_max_poc_lsb); if (h->pps.pic_order_present == 1 && h->picture_structure == PICT_FRAME) h->delta_poc_bottom = get_se_golomb(&h->gb); } if (h->sps.poc_type == 1 && !h->sps.delta_pic_order_always_zero_flag) { h->delta_poc[0] = get_se_golomb(&h->gb); if (h->pps.pic_order_present == 1 && h->picture_structure == PICT_FRAME) h->delta_poc[1] = get_se_golomb(&h->gb); } field_poc[0] = field_poc[1] = INT_MAX; ff_init_poc(h, field_poc, &s->output_picture_number); if (h->nal_ref_idc && h->nal_unit_type != NAL_IDR_SLICE) { got_reset = scan_mmco_reset(s); if (got_reset < 0) return got_reset; } h->prev_frame_num = got_reset ? 0 : h->frame_num; h->prev_frame_num_offset = got_reset ? 0 : h->frame_num_offset; if (h->nal_ref_idc != 0) { if (!got_reset) { h->prev_poc_msb = h->poc_msb; h->prev_poc_lsb = h->poc_lsb; } else { h->prev_poc_msb = 0; h->prev_poc_lsb = h->picture_structure == PICT_BOTTOM_FIELD ? 0 : field_poc[0]; } } if (h->sps.pic_struct_present_flag) { switch (h->sei_pic_struct) { case SEI_PIC_STRUCT_TOP_FIELD: case SEI_PIC_STRUCT_BOTTOM_FIELD: s->repeat_pict = 0; break; case SEI_PIC_STRUCT_FRAME: case SEI_PIC_STRUCT_TOP_BOTTOM: case SEI_PIC_STRUCT_BOTTOM_TOP: s->repeat_pict = 1; break; case SEI_PIC_STRUCT_TOP_BOTTOM_TOP: case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: s->repeat_pict = 2; break; case SEI_PIC_STRUCT_FRAME_DOUBLING: s->repeat_pict = 3; break; case SEI_PIC_STRUCT_FRAME_TRIPLING: s->repeat_pict = 5; break; default: s->repeat_pict = h->picture_structure == PICT_FRAME ? 1 : 0; break; } } else { s->repeat_pict = h->picture_structure == PICT_FRAME ? 1 : 0; } if (h->picture_structure == PICT_FRAME) { s->picture_structure = AV_PICTURE_STRUCTURE_FRAME; if (h->sps.pic_struct_present_flag) { switch (h->sei_pic_struct) { case SEI_PIC_STRUCT_TOP_BOTTOM: case SEI_PIC_STRUCT_TOP_BOTTOM_TOP: s->field_order = AV_FIELD_TT; break; case SEI_PIC_STRUCT_BOTTOM_TOP: case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM: s->field_order = AV_FIELD_BB; break; default: s->field_order = AV_FIELD_PROGRESSIVE; break; } } else { if (field_poc[0] < field_poc[1]) s->field_order = AV_FIELD_TT; else if (field_poc[0] > field_poc[1]) s->field_order = AV_FIELD_BB; else s->field_order = AV_FIELD_PROGRESSIVE; } } else { if (h->picture_structure == PICT_TOP_FIELD) s->picture_structure = AV_PICTURE_STRUCTURE_TOP_FIELD; else s->picture_structure = AV_PICTURE_STRUCTURE_BOTTOM_FIELD; s->field_order = AV_FIELD_UNKNOWN; } return 0; } buf += consumed; } av_log(h->avctx, AV_LOG_ERROR, "missing picture in access unit\n"); return -1; } libavcodec/h264_parser.c:224: error: Null Dereference pointer `h->gb.buffer` last assigned on line 221 could be null and is dereferenced by call to `ff_h264_decode_seq_parameter_set()` at line 224, column 13. libavcodec/h264_parser.c:171:1: start of procedure parse_nal_units() 169. * @param buf_size size of the buffer. 170. */ 171. static inline int parse_nal_units(AVCodecParserContext *s, ^ 172. AVCodecContext *avctx, 173. const uint8_t *buf, int buf_size) libavcodec/h264_parser.c:175:5: 173. const uint8_t *buf, int buf_size) 174. { 175. H264Context *h = s->priv_data; ^ 176. const uint8_t *buf_end = buf + buf_size; 177. unsigned int pps_id; libavcodec/h264_parser.c:176:5: 174. { 175. H264Context *h = s->priv_data; 176. const uint8_t *buf_end = buf + buf_size; ^ 177. unsigned int pps_id; 178. unsigned int slice_type; libavcodec/h264_parser.c:179:5: 177. unsigned int pps_id; 178. unsigned int slice_type; 179. int state = -1, got_reset = 0; ^ 180. const uint8_t *ptr; 181. int field_poc[2]; libavcodec/h264_parser.c:184:5: 182. 183. /* set some sane default values */ 184. s->pict_type = AV_PICTURE_TYPE_I; ^ 185. s->key_frame = 0; 186. s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN; libavcodec/h264_parser.c:185:5: 183. /* set some sane default values */ 184. s->pict_type = AV_PICTURE_TYPE_I; 185. s->key_frame = 0; ^ 186. s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN; 187. libavcodec/h264_parser.c:186:5: 184. s->pict_type = AV_PICTURE_TYPE_I; 185. s->key_frame = 0; 186. s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN; ^ 187. 188. h->avctx = avctx; libavcodec/h264_parser.c:188:5: 186. s->picture_structure = AV_PICTURE_STRUCTURE_UNKNOWN; 187. 188. h->avctx = avctx; ^ 189. ff_h264_reset_sei(h); 190. libavcodec/h264_parser.c:189:5: 187. 188. h->avctx = avctx; 189. ff_h264_reset_sei(h); ^ 190. 191. if (!buf_size) libavcodec/h264_sei.c:37:1: start of procedure ff_h264_reset_sei() 35. }; 36. 37. void ff_h264_reset_sei(H264Context *h) ^ 38. { 39. h->sei_recovery_frame_cnt = -1; libavcodec/h264_sei.c:39:5: 37. void ff_h264_reset_sei(H264Context *h) 38. { 39. h->sei_recovery_frame_cnt = -1; ^ 40. h->sei_dpb_output_delay = 0; 41. h->sei_cpb_removal_delay = -1; libavcodec/h264_sei.c:40:5: 38. { 39. h->sei_recovery_frame_cnt = -1; 40. h->sei_dpb_output_delay = 0; ^ 41. h->sei_cpb_removal_delay = -1; 42. h->sei_buffering_period_present = 0; libavcodec/h264_sei.c:41:5: 39. h->sei_recovery_frame_cnt = -1; 40. h->sei_dpb_output_delay = 0; 41. h->sei_cpb_removal_delay = -1; ^ 42. h->sei_buffering_period_present = 0; 43. h->sei_frame_packing_present = 0; libavcodec/h264_sei.c:42:5: 40. h->sei_dpb_output_delay = 0; 41. h->sei_cpb_removal_delay = -1; 42. h->sei_buffering_period_present = 0; ^ 43. h->sei_frame_packing_present = 0; 44. h->sei_display_orientation_present = 0; libavcodec/h264_sei.c:43:5: 41. h->sei_cpb_removal_delay = -1; 42. h->sei_buffering_period_present = 0; 43. h->sei_frame_packing_present = 0; ^ 44. h->sei_display_orientation_present = 0; 45. } libavcodec/h264_sei.c:44:5: 42. h->sei_buffering_period_present = 0; 43. h->sei_frame_packing_present = 0; 44. h->sei_display_orientation_present = 0; ^ 45. } 46. libavcodec/h264_sei.c:45:1: return from a call to ff_h264_reset_sei 43. h->sei_frame_packing_present = 0; 44. h->sei_display_orientation_present = 0; 45. } ^ 46. 47. static int decode_picture_timing(H264Context *h) libavcodec/h264_parser.c:191:10: Taking false branch 189. ff_h264_reset_sei(h); 190. 191. if (!buf_size) ^ 192. return 0; 193. libavcodec/h264_parser.c:393:5: Loop condition is true. Entering loop body 391. } 392. buf += consumed; 393. } ^ 394. /* didn't find a picture! */ 395. av_log(h->avctx, AV_LOG_ERROR, "missing picture in access unit\n"); libavcodec/h264_parser.c:196:9: Skipping avpriv_find_start_code(): empty list of specs 194. for (;;) { 195. int src_length, dst_length, consumed; 196. buf = avpriv_find_start_code(buf, buf_end, &state); ^ 197. if (buf >= buf_end) 198. break; libavcodec/h264_parser.c:197:13: Taking false branch 195. int src_length, dst_length, consumed; 196. buf = avpriv_find_start_code(buf, buf_end, &state); 197. if (buf >= buf_end) ^ 198. break; 199. --buf; libavcodec/h264_parser.c:199:9: 197. if (buf >= buf_end) 198. break; 199. --buf; ^ 200. src_length = buf_end - buf; 201. switch (state & 0x1f) { libavcodec/h264_parser.c:200:9: 198. break; 199. --buf; 200. src_length = buf_end - buf; ^ 201. switch (state & 0x1f) { 202. case NAL_SLICE: libavcodec/h264_parser.c:201:9: 199. --buf; 200. src_length = buf_end - buf; 201. switch (state & 0x1f) { ^ 202. case NAL_SLICE: 203. case NAL_IDR_SLICE: libavcodec/h264_parser.c:202:9: Switch condition is true. Entering switch case 200. src_length = buf_end - buf; 201. switch (state & 0x1f) { 202. case NAL_SLICE: ^ 203. case NAL_IDR_SLICE: 204. // Do not walk the whole buffer just to decode slice header libavcodec/h264_parser.c:205:17: Taking false branch 203. case NAL_IDR_SLICE: 204. // Do not walk the whole buffer just to decode slice header 205. if ((state & 0x1f) == NAL_IDR_SLICE || ((state >> 5) & 0x3) == 0) { ^ 206. /* IDR or disposable slice 207. * No need to decode many bytes because MMCOs shall not be present. */ libavcodec/h264_parser.c:205:52: Taking false branch 203. case NAL_IDR_SLICE: 204. // Do not walk the whole buffer just to decode slice header 205. if ((state & 0x1f) == NAL_IDR_SLICE || ((state >> 5) & 0x3) == 0) { ^ 206. /* IDR or disposable slice 207. * No need to decode many bytes because MMCOs shall not be present. */ libavcodec/h264_parser.c:212:21: Taking false branch 210. } else { 211. /* To decode up to MMCOs */ 212. if (src_length > 1000) ^ 213. src_length = 1000; 214. } libavcodec/h264_parser.c:217:9: Skipping ff_h264_decode_nal(): empty list of specs 215. break; 216. } 217. ptr = ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length); ^ 218. if (!ptr || dst_length < 0) 219. break; libavcodec/h264_parser.c:218:14: Taking false branch 216. } 217. ptr = ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length); 218. if (!ptr || dst_length < 0) ^ 219. break; 220. libavcodec/h264_parser.c:218:21: Taking false branch 216. } 217. ptr = ff_h264_decode_nal(h, buf, &dst_length, &consumed, src_length); 218. if (!ptr || dst_length < 0) ^ 219. break; 220. libavcodec/h264_parser.c:221:9: 219. break; 220. 221. init_get_bits(&h->gb, ptr, 8 * dst_length); ^ 222. switch (h->nal_unit_type) { 223. case NAL_SPS: libavcodec/get_bits.h:376:1: start of procedure init_get_bits() 374. * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow. 375. */ 376. static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer, ^ 377. int bit_size) 378. { libavcodec/get_bits.h:380:5: 378. { 379. int buffer_size; 380. int ret = 0; ^ 381. 382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { libavcodec/get_bits.h:382:9: Taking true branch 380. int ret = 0; 381. 382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { ^ 383. bit_size = 0; 384. buffer = NULL; libavcodec/get_bits.h:383:9: 381. 382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { 383. bit_size = 0; ^ 384. buffer = NULL; 385. ret = AVERROR_INVALIDDATA; libavcodec/get_bits.h:384:9: 382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { 383. bit_size = 0; 384. buffer = NULL; ^ 385. ret = AVERROR_INVALIDDATA; 386. } libavcodec/get_bits.h:385:9: 383. bit_size = 0; 384. buffer = NULL; 385. ret = AVERROR_INVALIDDATA; ^ 386. } 387. libavcodec/get_bits.h:388:5: 386. } 387. 388. buffer_size = (bit_size + 7) >> 3; ^ 389. 390. s->buffer = buffer; libavcodec/get_bits.h:390:5: 388. buffer_size = (bit_size + 7) >> 3; 389. 390. s->buffer = buffer; ^ 391. s->size_in_bits = bit_size; 392. #if !UNCHECKED_BITSTREAM_READER libavcodec/get_bits.h:391:5: 389. 390. s->buffer = buffer; 391. s->size_in_bits = bit_size; ^ 392. #if !UNCHECKED_BITSTREAM_READER 393. s->size_in_bits_plus8 = bit_size + 8; libavcodec/get_bits.h:393:5: 391. s->size_in_bits = bit_size; 392. #if !UNCHECKED_BITSTREAM_READER 393. s->size_in_bits_plus8 = bit_size + 8; ^ 394. #endif 395. s->buffer_end = buffer + buffer_size; libavcodec/get_bits.h:395:5: 393. s->size_in_bits_plus8 = bit_size + 8; 394. #endif 395. s->buffer_end = buffer + buffer_size; ^ 396. s->index = 0; 397. libavcodec/get_bits.h:396:5: 394. #endif 395. s->buffer_end = buffer + buffer_size; 396. s->index = 0; ^ 397. 398. return ret; libavcodec/get_bits.h:398:5: 396. s->index = 0; 397. 398. return ret; ^ 399. } 400. libavcodec/get_bits.h:399:1: return from a call to init_get_bits 397. 398. return ret; 399. } ^ 400. 401. /** libavcodec/h264_parser.c:222:9: 220. 221. init_get_bits(&h->gb, ptr, 8 * dst_length); 222. switch (h->nal_unit_type) { ^ 223. case NAL_SPS: 224. ff_h264_decode_seq_parameter_set(h); libavcodec/h264_parser.c:223:9: Switch condition is true. Entering switch case 221. init_get_bits(&h->gb, ptr, 8 * dst_length); 222. switch (h->nal_unit_type) { 223. case NAL_SPS: ^ 224. ff_h264_decode_seq_parameter_set(h); 225. break; libavcodec/h264_parser.c:224:13: 222. switch (h->nal_unit_type) { 223. case NAL_SPS: 224. ff_h264_decode_seq_parameter_set(h); ^ 225. break; 226. case NAL_PPS: libavcodec/h264_ps.c:299:1: start of procedure ff_h264_decode_seq_parameter_set() 297. } 298. 299. int ff_h264_decode_seq_parameter_set(H264Context *h) ^ 300. { 301. int profile_idc, level_idc, constraint_set_flags = 0; libavcodec/h264_ps.c:301:5: 299. int ff_h264_decode_seq_parameter_set(H264Context *h) 300. { 301. int profile_idc, level_idc, constraint_set_flags = 0; ^ 302. unsigned int sps_id; 303. int i, log2_max_frame_num_minus4; libavcodec/h264_ps.c:306:5: Skipping get_bits(): empty list of specs 304. SPS *sps; 305. 306. profile_idc = get_bits(&h->gb, 8); ^ 307. constraint_set_flags |= get_bits1(&h->gb) << 0; // constraint_set0_flag 308. constraint_set_flags |= get_bits1(&h->gb) << 1; // constraint_set1_flag libavcodec/h264_ps.c:307:5: 305. 306. profile_idc = get_bits(&h->gb, 8); 307. constraint_set_flags |= get_bits1(&h->gb) << 0; // constraint_set0_flag ^ 308. constraint_set_flags |= get_bits1(&h->gb) << 1; // constraint_set1_flag 309. constraint_set_flags |= get_bits1(&h->gb) << 2; // constraint_set2_flag libavcodec/get_bits.h:272:1: start of procedure get_bits1() 270. } 271. 272. static inline unsigned int get_bits1(GetBitContext *s) ^ 273. { 274. unsigned int index = s->index; libavcodec/get_bits.h:274:5: 272. static inline unsigned int get_bits1(GetBitContext *s) 273. { 274. unsigned int index = s->index; ^ 275. uint8_t result = s->buffer[index >> 3]; 276. #ifdef BITSTREAM_READER_LE libavcodec/get_bits.h:275:5: 273. { 274. unsigned int index = s->index; 275. uint8_t result = s->buffer[index >> 3]; ^ 276. #ifdef BITSTREAM_READER_LE 277. result >>= index & 7; libavcodec/get_bits.h:277:5: 275. uint8_t result = s->buffer[index >> 3]; 276. #ifdef BITSTREAM_READER_LE 277. result >>= index & 7; ^ 278. result &= 1; 279. #else libavcodec/get_bits.h:278:5: 276. #ifdef BITSTREAM_READER_LE 277. result >>= index & 7; 278. result &= 1; ^ 279. #else 280. result <<= index & 7; libavcodec/get_bits.h:284:9: Taking true branch 282. #endif 283. #if !UNCHECKED_BITSTREAM_READER 284. if (s->index < s->size_in_bits_plus8) ^ 285. #endif 286. index++; libavcodec/get_bits.h:286:9: 284. if (s->index < s->size_in_bits_plus8) 285. #endif 286. index++; ^ 287. s->index = index; 288. libavcodec/get_bits.h:287:5: 285. #endif 286. index++; 287. s->index = index; ^ 288. 289. return result; libavcodec/get_bits.h:289:5: 287. s->index = index; 288. 289. return result; ^ 290. } 291. libavcodec/get_bits.h:290:1: return from a call to get_bits1 288. 289. return result; 290. } ^ 291. 292. static inline unsigned int show_bits1(GetBitContext *s) libavcodec/h264_ps.c:308:5: 306. profile_idc = get_bits(&h->gb, 8); 307. constraint_set_flags |= get_bits1(&h->gb) << 0; // constraint_set0_flag 308. constraint_set_flags |= get_bits1(&h->gb) << 1; // constraint_set1_flag ^ 309. constraint_set_flags |= get_bits1(&h->gb) << 2; // constraint_set2_flag 310. constraint_set_flags |= get_bits1(&h->gb) << 3; // constraint_set3_flag libavcodec/get_bits.h:272:1: start of procedure get_bits1() 270. } 271. 272. static inline unsigned int get_bits1(GetBitContext *s) ^ 273. { 274. unsigned int index = s->index; libavcodec/get_bits.h:274:5: 272. static inline unsigned int get_bits1(GetBitContext *s) 273. { 274. unsigned int index = s->index; ^ 275. uint8_t result = s->buffer[index >> 3]; 276. #ifdef BITSTREAM_READER_LE libavcodec/get_bits.h:275:5: 273. { 274. unsigned int index = s->index; 275. uint8_t result = s->buffer[index >> 3]; ^ 276. #ifdef BITSTREAM_READER_LE 277. result >>= index & 7; libavcodec/get_bits.h:277:5: 275. uint8_t result = s->buffer[index >> 3]; 276. #ifdef BITSTREAM_READER_LE 277. result >>= index & 7; ^ 278. result &= 1; 279. #else libavcodec/get_bits.h:278:5: 276. #ifdef BITSTREAM_READER_LE 277. result >>= index & 7; 278. result &= 1; ^ 279. #else 280. result <<= index & 7; libavcodec/get_bits.h:284:9: Taking true branch 282. #endif 283. #if !UNCHECKED_BITSTREAM_READER 284. if (s->index < s->size_in_bits_plus8) ^ 285. #endif 286. index++; libavcodec/get_bits.h:286:9: 284. if (s->index < s->size_in_bits_plus8) 285. #endif 286. index++; ^ 287. s->index = index; 288. libavcodec/get_bits.h:287:5: 285. #endif 286. index++; 287. s->index = index; ^ 288. 289. return result; libavcodec/get_bits.h:289:5: 287. s->index = index; 288. 289. return result; ^ 290. } 291. libavcodec/get_bits.h:290:1: return from a call to get_bits1 288. 289. return result; 290. } ^ 291. 292. static inline unsigned int show_bits1(GetBitContext *s) libavcodec/h264_ps.c:309:5: 307. constraint_set_flags |= get_bits1(&h->gb) << 0; // constraint_set0_flag 308. constraint_set_flags |= get_bits1(&h->gb) << 1; // constraint_set1_flag 309. constraint_set_flags |= get_bits1(&h->gb) << 2; // constraint_set2_flag ^ 310. constraint_set_flags |= get_bits1(&h->gb) << 3; // constraint_set3_flag 311. constraint_set_flags |= get_bits1(&h->gb) << 4; // constraint_set4_flag libavcodec/get_bits.h:272:1: start of procedure get_bits1() 270. } 271. 272. static inline unsigned int get_bits1(GetBitContext *s) ^ 273. { 274. unsigned int index = s->index; libavcodec/get_bits.h:274:5: 272. static inline unsigned int get_bits1(GetBitContext *s) 273. { 274. unsigned int index = s->index; ^ 275. uint8_t result = s->buffer[index >> 3]; 276. #ifdef BITSTREAM_READER_LE libavcodec/get_bits.h:275:5: 273. { 274. unsigned int index = s->index; 275. uint8_t result = s->buffer[index >> 3]; ^ 276. #ifdef BITSTREAM_READER_LE 277. result >>= index & 7; libavcodec/get_bits.h:277:5: 275. uint8_t result = s->buffer[index >> 3]; 276. #ifdef BITSTREAM_READER_LE 277. result >>= index & 7; ^ 278. result &= 1; 279. #else libavcodec/get_bits.h:278:5: 276. #ifdef BITSTREAM_READER_LE 277. result >>= index & 7; 278. result &= 1; ^ 279. #else 280. result <<= index & 7; libavcodec/get_bits.h:284:9: Taking true branch 282. #endif 283. #if !UNCHECKED_BITSTREAM_READER 284. if (s->index < s->size_in_bits_plus8) ^ 285. #endif 286. index++; libavcodec/get_bits.h:286:9: 284. if (s->index < s->size_in_bits_plus8) 285. #endif 286. index++; ^ 287. s->index = index; 288. libavcodec/get_bits.h:287:5: 285. #endif 286. index++; 287. s->index = index; ^ 288. 289. return result; libavcodec/get_bits.h:289:5: 287. s->index = index; 288. 289. return result; ^ 290. } 291. libavcodec/get_bits.h:290:1: return from a call to get_bits1 288. 289. return result; 290. } ^ 291. 292. static inline unsigned int show_bits1(GetBitContext *s) libavcodec/h264_ps.c:310:5: 308. constraint_set_flags |= get_bits1(&h->gb) << 1; // constraint_set1_flag 309. constraint_set_flags |= get_bits1(&h->gb) << 2; // constraint_set2_flag 310. constraint_set_flags |= get_bits1(&h->gb) << 3; // constraint_set3_flag ^ 311. constraint_set_flags |= get_bits1(&h->gb) << 4; // constraint_set4_flag 312. constraint_set_flags |= get_bits1(&h->gb) << 5; // constraint_set5_flag libavcodec/get_bits.h:272:1: start of procedure get_bits1() 270. } 271. 272. static inline unsigned int get_bits1(GetBitContext *s) ^ 273. { 274. unsigned int index = s->index; libavcodec/get_bits.h:274:5: 272. static inline unsigned int get_bits1(GetBitContext *s) 273. { 274. unsigned int index = s->index; ^ 275. uint8_t result = s->buffer[index >> 3]; 276. #ifdef BITSTREAM_READER_LE libavcodec/get_bits.h:275:5: 273. { 274. unsigned int index = s->index; 275. uint8_t result = s->buffer[index >> 3]; ^ 276. #ifdef BITSTREAM_READER_LE 277. result >>= index & 7; libavcodec/get_bits.h:277:5: 275. uint8_t result = s->buffer[index >> 3]; 276. #ifdef BITSTREAM_READER_LE 277. result >>= index & 7; ^ 278. result &= 1; 279. #else libavcodec/get_bits.h:278:5: 276. #ifdef BITSTREAM_READER_LE 277. result >>= index & 7; 278. result &= 1; ^ 279. #else 280. result <<= index & 7; libavcodec/get_bits.h:284:9: Taking true branch 282. #endif 283. #if !UNCHECKED_BITSTREAM_READER 284. if (s->index < s->size_in_bits_plus8) ^ 285. #endif 286. index++; libavcodec/get_bits.h:286:9: 284. if (s->index < s->size_in_bits_plus8) 285. #endif 286. index++; ^ 287. s->index = index; 288. libavcodec/get_bits.h:287:5: 285. #endif 286. index++; 287. s->index = index; ^ 288. 289. return result; libavcodec/get_bits.h:289:5: 287. s->index = index; 288. 289. return result; ^ 290. } 291. libavcodec/get_bits.h:290:1: return from a call to get_bits1 288. 289. return result; 290. } ^ 291. 292. static inline unsigned int show_bits1(GetBitContext *s) libavcodec/h264_ps.c:311:5: 309. constraint_set_flags |= get_bits1(&h->gb) << 2; // constraint_set2_flag 310. constraint_set_flags |= get_bits1(&h->gb) << 3; // constraint_set3_flag 311. constraint_set_flags |= get_bits1(&h->gb) << 4; // constraint_set4_flag ^ 312. constraint_set_flags |= get_bits1(&h->gb) << 5; // constraint_set5_flag 313. skip_bits(&h->gb, 2); // reserved_zero_2bits libavcodec/get_bits.h:272:1: start of procedure get_bits1() 270. } 271. 272. static inline unsigned int get_bits1(GetBitContext *s) ^ 273. { 274. unsigned int index = s->index; libavcodec/get_bits.h:274:5: 272. static inline unsigned int get_bits1(GetBitContext *s) 273. { 274. unsigned int index = s->index; ^ 275. uint8_t result = s->buffer[index >> 3]; 276. #ifdef BITSTREAM_READER_LE libavcodec/get_bits.h:275:5: 273. { 274. unsigned int index = s->index; 275. uint8_t result = s->buffer[index >> 3]; ^ 276. #ifdef BITSTREAM_READER_LE 277. result >>= index & 7; libavcodec/get_bits.h:277:5: 275. uint8_t result = s->buffer[index >> 3]; 276. #ifdef BITSTREAM_READER_LE 277. result >>= index & 7; ^ 278. result &= 1; 279. #else libavcodec/get_bits.h:278:5: 276. #ifdef BITSTREAM_READER_LE 277. result >>= index & 7; 278. result &= 1; ^ 279. #else 280. result <<= index & 7; libavcodec/get_bits.h:284:9: Taking true branch 282. #endif 283. #if !UNCHECKED_BITSTREAM_READER 284. if (s->index < s->size_in_bits_plus8) ^ 285. #endif 286. index++; libavcodec/get_bits.h:286:9: 284. if (s->index < s->size_in_bits_plus8) 285. #endif 286. index++; ^ 287. s->index = index; 288. libavcodec/get_bits.h:287:5: 285. #endif 286. index++; 287. s->index = index; ^ 288. 289. return result; libavcodec/get_bits.h:289:5: 287. s->index = index; 288. 289. return result; ^ 290. } 291. libavcodec/get_bits.h:290:1: return from a call to get_bits1 288. 289. return result; 290. } ^ 291. 292. static inline unsigned int show_bits1(GetBitContext *s) libavcodec/h264_ps.c:312:5: 310. constraint_set_flags |= get_bits1(&h->gb) << 3; // constraint_set3_flag 311. constraint_set_flags |= get_bits1(&h->gb) << 4; // constraint_set4_flag 312. constraint_set_flags |= get_bits1(&h->gb) << 5; // constraint_set5_flag ^ 313. skip_bits(&h->gb, 2); // reserved_zero_2bits 314. level_idc = get_bits(&h->gb, 8); libavcodec/get_bits.h:272:1: start of procedure get_bits1() 270. } 271. 272. static inline unsigned int get_bits1(GetBitContext *s) ^ 273. { 274. unsigned int index = s->index; libavcodec/get_bits.h:274:5: 272. static inline unsigned int get_bits1(GetBitContext *s) 273. { 274. unsigned int index = s->index; ^ 275. uint8_t result = s->buffer[index >> 3]; 276. #ifdef BITSTREAM_READER_LE libavcodec/get_bits.h:275:5: 273. { 274. unsigned int index = s->index; 275. uint8_t result = s->buffer[index >> 3]; ^ 276. #ifdef BITSTREAM_READER_LE 277. result >>= index & 7;
https://github.com/libav/libav/blob/77ab341c0c6cdf2bd437bb48d429e797d1e60da2/libavcodec/h264_parser.c/#L224
d2a_code_trace_data_44495
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_eay.c:581: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set_locked`. Showing all 26 steps of the trace crypto/rsa/rsa_eay.c:508:2: Call 506. 507. if((ctx = BN_CTX_new()) == NULL) goto err; 508. BN_CTX_start(ctx); ^ 509. f = BN_CTX_get(ctx); 510. ret = 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/rsa/rsa_eay.c:581:9: Call 579. 580. if (rsa->flags & RSA_FLAG_CACHE_PUBLIC) 581. if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_n, CRYPTO_LOCK_RSA, rsa->n, ctx)) ^ 582. goto err; 583. if (!rsa->meth->bn_mod_exp(ret,f,d,rsa->n,ctx, crypto/bn/bn_mont.c:478:1: Parameter `ctx->stack.depth` 476. } 477. 478. > BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock, 479. const BIGNUM *mod, BN_CTX *ctx) 480. { crypto/bn/bn_mont.c:494:16: Call 492. { 493. ret = BN_MONT_CTX_new(); 494. if (ret && !BN_MONT_CTX_set(ret, mod, ctx)) ^ 495. BN_MONT_CTX_free(ret); 496. else 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, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set_locked` 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_44496
static int decode_residual_block(AVSContext *h, GetBitContext *gb, const dec_2dvlc_t *r, int esc_golomb_order, int qp, uint8_t *dst, int stride) { int i, level_code, esc_code, level, run, mask; DCTELEM level_buf[64]; uint8_t run_buf[64]; DCTELEM *block = h->block; for(i=0;i<65;i++) { level_code = get_ue_code(gb,r->golomb_order); if(level_code >= ESCAPE_CODE) { run = ((level_code - ESCAPE_CODE) >> 1) + 1; esc_code = get_ue_code(gb,esc_golomb_order); level = esc_code + (run > r->max_run ? 1 : r->level_add[run]); while(level > r->inc_limit) r++; mask = -(level_code & 1); level = (level^mask) - mask; } else { level = r->rltab[level_code][0]; if(!level) break; run = r->rltab[level_code][1]; r += r->rltab[level_code][2]; } level_buf[i] = level; run_buf[i] = run; } if(dequant(h,level_buf, run_buf, block, ff_cavs_dequant_mul[qp], ff_cavs_dequant_shift[qp], i)) return -1; h->s.dsp.cavs_idct8_add(dst,block,stride); return 0; } libavcodec/cavsdec.c:140: error: Buffer Overrun L2 Offset: [0, 64] Size: 64. libavcodec/cavsdec.c:123:9: <Offset trace> 121. DCTELEM *block = h->block; 122. 123. for(i=0;i<65;i++) { ^ 124. level_code = get_ue_code(gb,r->golomb_order); 125. if(level_code >= ESCAPE_CODE) { libavcodec/cavsdec.c:123:9: Assignment 121. DCTELEM *block = h->block; 122. 123. for(i=0;i<65;i++) { ^ 124. level_code = get_ue_code(gb,r->golomb_order); 125. if(level_code >= ESCAPE_CODE) { libavcodec/cavsdec.c:115:1: <Length trace> 113. * @param stride line stride in frame buffer 114. */ 115. static int decode_residual_block(AVSContext *h, GetBitContext *gb, ^ 116. const dec_2dvlc_t *r, int esc_golomb_order, 117. int qp, uint8_t *dst, int stride) { libavcodec/cavsdec.c:115:1: Array declaration 113. * @param stride line stride in frame buffer 114. */ 115. static int decode_residual_block(AVSContext *h, GetBitContext *gb, ^ 116. const dec_2dvlc_t *r, int esc_golomb_order, 117. int qp, uint8_t *dst, int stride) { libavcodec/cavsdec.c:140:9: Array access: Offset: [0, 64] Size: 64 138. r += r->rltab[level_code][2]; 139. } 140. level_buf[i] = level; ^ 141. run_buf[i] = run; 142. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/cavsdec.c/#L140
d2a_code_trace_data_44497
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:1936: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mul`. Showing all 13 steps of the trace test/bntest.c:1936:10: Call 1934. BN_set_negative(a, 1); 1935. BN_zero(b); 1936. if (!TEST_true(BN_mul(c, a, b, ctx))) ^ 1937. goto err; 1938. if (!TEST_BN_eq_zero(c) crypto/bn/bn_mul.c:497:1: Parameter `ctx->stack.depth` 495. #endif /* BN_RECURSION */ 496. 497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); crypto/bn/bn_mul.c:499:15: Call 497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); ^ 500. 501. bn_correct_top(r); crypto/bn/bn_mul.c:533:5: Call 531. top = al + bl; 532. 533. BN_CTX_start(ctx); ^ 534. if ((r == a) || (r == b)) { 535. if ((rr = BN_CTX_get(ctx)) == NULL) crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_mul.c:618:5: Call 616. err: 617. bn_check_top(r); 618. BN_CTX_end(ctx); ^ 619. return ret; 620. } crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mul` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_44498
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/ectest.c:88: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mul`. Showing all 15 steps of the trace test/ectest.c:107:14: Call 105. points[0] = points[1] = P; 106. 107. if (!TEST_true(EC_POINTs_mul(group, R, NULL, 2, points, scalars, ctx)) ^ 108. || !TEST_true(EC_POINT_dbl(group, S, points[0], ctx)) 109. || !TEST_int_eq(0, EC_POINT_cmp(group, R, S, ctx))) crypto/ec/ec_lib.c:918:1: Parameter `ctx->stack.depth` 916. */ 917. 918. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 919. size_t num, const EC_POINT *points[], 920. const BIGNUM *scalars[], BN_CTX *ctx) test/ectest.c:88:17: Call 86. 87. /* n2 = (1 - order) * (1 + order) = 1 - order^2 */ 88. || !TEST_true(BN_mul(n2, n1, n2, ctx)) ^ 89. || !TEST_true(EC_POINT_mul(group, Q, NULL, P, n2, ctx)) 90. || !TEST_int_eq(0, EC_POINT_cmp(group, Q, P, ctx))) crypto/bn/bn_mul.c:497:1: Parameter `ctx->stack.depth` 495. #endif /* BN_RECURSION */ 496. 497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); crypto/bn/bn_mul.c:499:15: Call 497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); ^ 500. 501. bn_correct_top(r); crypto/bn/bn_mul.c:533:5: Call 531. top = al + bl; 532. 533. BN_CTX_start(ctx); ^ 534. if ((r == a) || (r == b)) { 535. if ((rr = BN_CTX_get(ctx)) == NULL) crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_mul.c:618:5: Call 616. err: 617. bn_check_top(r); 618. BN_CTX_end(ctx); ^ 619. return ret; 620. } crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mul` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_44499
static int opt_metadata(const char *opt, const char *arg) { char *mid= strchr(arg, '='); if(!mid){ fprintf(stderr, "Missing =\n"); av_exit(1); } *mid++= 0; metadata_count++; metadata= av_realloc(metadata, sizeof(*metadata)*metadata_count); metadata[metadata_count-1].key = av_strdup(arg); metadata[metadata_count-1].value= av_strdup(mid); return 0; } ffmpeg.c:2559: error: Null Dereference pointer `mid` last assigned on line 2559 could be null and is dereferenced at line 2559, column 5. ffmpeg.c:2551:1: start of procedure opt_metadata() 2549. } 2550. 2551. static int opt_metadata(const char *opt, const char *arg) ^ 2552. { 2553. char *mid= strchr(arg, '='); ffmpeg.c:2553:5: 2551. static int opt_metadata(const char *opt, const char *arg) 2552. { 2553. char *mid= strchr(arg, '='); ^ 2554. 2555. if(!mid){ ffmpeg.c:2555:9: Taking true branch 2553. char *mid= strchr(arg, '='); 2554. 2555. if(!mid){ ^ 2556. fprintf(stderr, "Missing =\n"); 2557. av_exit(1); ffmpeg.c:2556:9: 2554. 2555. if(!mid){ 2556. fprintf(stderr, "Missing =\n"); ^ 2557. av_exit(1); 2558. } ffmpeg.c:2557:9: Skipping av_exit(): empty list of specs 2555. if(!mid){ 2556. fprintf(stderr, "Missing =\n"); 2557. av_exit(1); ^ 2558. } 2559. *mid++= 0; ffmpeg.c:2559:5: 2557. av_exit(1); 2558. } 2559. *mid++= 0; ^ 2560. 2561. metadata_count++;
https://github.com/libav/libav/blob/184bc53db4fded8857af09cee2adc7197940deb7/ffmpeg.c/#L2559
d2a_code_trace_data_44500
int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) { PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | (diff > (0 - (PTRDIFF_T)len))); return overlapped; } crypto/pem/pvkfmt.c:830: error: INTEGER_OVERFLOW_L2 (0 - [-oo, 32]):unsigned64 by call to `EVP_DecryptUpdate`. Showing all 7 steps of the trace crypto/pem/pvkfmt.c:830:14: Call 828. goto error; 829. OPENSSL_cleanse(keybuf, 20); 830. if (!EVP_DecryptUpdate(cctx, p, &enctmplen, p, pklen - 8)) ^ 831. goto error; 832. if (!EVP_DecryptFinal_ex(cctx, p + enctmplen, &enctmplen)) crypto/evp/evp_enc.c:416:1: Parameter `ctx->cipher->block_size` 414. } 415. 416. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 417. const unsigned char *in, int inl) 418. { crypto/evp/evp_enc.c:422:5: Assignment 420. unsigned int b; 421. 422. b = ctx->cipher->block_size; ^ 423. 424. if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) { crypto/evp/evp_enc.c:452:16: Call 450. /* see comment about PTRDIFF_T comparison above */ 451. if (((PTRDIFF_T)out == (PTRDIFF_T)in) 452. || is_partially_overlapping(out, in, b)) { ^ 453. EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING); 454. return 0; crypto/evp/evp_enc.c:279:1: <RHS trace> 277. #endif 278. 279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 280. { 281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:279:1: Parameter `len` 277. #endif 278. 279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 280. { 281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:288:50: Binary operation: (0 - [-oo, 32]):unsigned64 by call to `EVP_DecryptUpdate` 286. */ 287. int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | 288. (diff > (0 - (PTRDIFF_T)len))); ^ 289. 290. return overlapped;
https://github.com/openssl/openssl/blob/b1531d8e6cc95837e38b10d875ae64144c6fdf7a/crypto/evp/evp_enc.c/#L288
d2a_code_trace_data_44501
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/rsa/rsa_crpt.c:97: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_sub`. Showing all 18 steps of the trace crypto/rsa/rsa_crpt.c:91:10: Call 89. 90. BN_CTX_start(ctx); 91. r0 = BN_CTX_get(ctx); ^ 92. r1 = BN_CTX_get(ctx); 93. r2 = BN_CTX_get(ctx); 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:366:15: Assignment 364. a->neg = 0; 365. a->d[0] = w; 366. a->top = (w ? 1 : 0); ^ 367. a->flags &= ~BN_FLG_FIXED_TOP; 368. bn_check_top(a); crypto/bn/bn_lib.c:366:5: Assignment 364. a->neg = 0; 365. a->d[0] = w; 366. a->top = (w ? 1 : 0); ^ 367. a->flags &= ~BN_FLG_FIXED_TOP; 368. bn_check_top(a); crypto/rsa/rsa_crpt.c:97:10: Call 95. goto err; 96. 97. if (!BN_sub(r1, p, BN_value_one())) ^ 98. goto err; 99. if (!BN_sub(r2, q, BN_value_one())) crypto/bn/bn_add.c:45:1: Parameter `*r->d` 43. 44. /* signed sub of b from a. */ 45. > int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 46. { 47. int ret, r_neg, cmp_res; crypto/bn/bn_add.c:62:19: Call 60. } else if (cmp_res < 0) { 61. r_neg = !b->neg; 62. ret = BN_usub(r, b, a); ^ 63. } else { 64. r_neg = 0; crypto/bn/bn_add.c:125:1: Parameter `*r->d` 123. 124. /* unsigned subtraction of b from a, a must be larger than b. */ 125. > int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 126. { 127. int max, min, dif; crypto/bn/bn_add.c:143:9: Call 141. } 142. 143. if (bn_wexpand(r, max) == NULL) ^ 144. return 0; 145. crypto/bn/bn_lib.c: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, 536870848] by call to `BN_sub` 230. assert(b->top <= words); 231. if (b->top > 0) 232. memcpy(a, b->d, sizeof(*a) * b->top); ^ 233. 234. return a;
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_44502
static inline void decode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){ PlaneContext * const p= &s->plane[plane_index]; RangeCoder * const c= &s->c; int x; int run_count=0; int run_mode=0; int run_index= s->run_index; for(x=0; x<w; x++){ int diff, context, sign; context= get_context(s, sample[1] + x, sample[0] + x, sample[1] + x); if(context < 0){ context= -context; sign=1; }else sign=0; if(s->ac){ diff= get_symbol(c, p->state[context], 1); }else{ if(context == 0 && run_mode==0) run_mode=1; if(run_mode){ if(run_count==0 && run_mode==1){ if(get_bits1(&s->gb)){ run_count = 1<<log2_run[run_index]; if(x + run_count <= w) run_index++; }else{ if(log2_run[run_index]) run_count = get_bits(&s->gb, log2_run[run_index]); else run_count=0; if(run_index) run_index--; run_mode=2; } } run_count--; if(run_count < 0){ run_mode=0; run_count=0; diff= get_vlc_symbol(&s->gb, &p->vlc_state[context], bits); if(diff>=0) diff++; }else diff=0; }else diff= get_vlc_symbol(&s->gb, &p->vlc_state[context], bits); } if(sign) diff= -diff; sample[1][x]= (predict(sample[1] + x, sample[0] + x) + diff) & ((1<<bits)-1); } s->run_index= run_index; } libavcodec/ffv1.c:787: error: Buffer Overrun L1 Offset: [3, `w` + 3] (⇐ [3, 4] + [0, `w` - 1]) Size: 2 by call to `decode_line`. libavcodec/ffv1.c:768:1: Parameter `w` 766. } 767. 768. static void decode_plane(FFV1Context *s, uint8_t *src, int w, int h, int stride, int plane_index){ ^ 769. int x, y; 770. int_fast16_t sample_buffer[2][w+6]; libavcodec/ffv1.c:787:9: Call 785. 786. //{START_TIMER 787. decode_line(s, w, sample, plane_index, 8); ^ 788. for(x=0; x<w; x++){ 789. src[x + stride*y]= sample[1][x]; libavcodec/ffv1.c:711:1: <Offset trace> 709. } 710. 711. static inline void decode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){ ^ 712. PlaneContext * const p= &s->plane[plane_index]; 713. RangeCoder * const c= &s->c; libavcodec/ffv1.c:711:1: Parameter `w` 709. } 710. 711. static inline void decode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){ ^ 712. PlaneContext * const p= &s->plane[plane_index]; 713. RangeCoder * const c= &s->c; libavcodec/ffv1.c:711:1: <Length trace> 709. } 710. 711. static inline void decode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){ ^ 712. PlaneContext * const p= &s->plane[plane_index]; 713. RangeCoder * const c= &s->c; libavcodec/ffv1.c:711:1: Parameter `**sample` 709. } 710. 711. static inline void decode_line(FFV1Context *s, int w, int_fast16_t *sample[2], int plane_index, int bits){ ^ 712. PlaneContext * const p= &s->plane[plane_index]; 713. RangeCoder * const c= &s->c; libavcodec/ffv1.c:763:9: Array access: Offset: [3, w + 3] (⇐ [3, 4] + [0, w - 1]) Size: 2 by call to `decode_line` 761. if(sign) diff= -diff; 762. 763. sample[1][x]= (predict(sample[1] + x, sample[0] + x) + diff) & ((1<<bits)-1); ^ 764. } 765. s->run_index= run_index;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ffv1.c/#L763
d2a_code_trace_data_44503
static void deinterlace_bottom_field_inplace(uint8_t *src1, int src_wrap, int width, int height) { uint8_t *src_m1, *src_0, *src_p1, *src_p2; int y; uint8_t *buf; buf = (uint8_t*)av_malloc(width); src_m1 = src1; memcpy(buf,src_m1,width); src_0=&src_m1[src_wrap]; src_p1=&src_0[src_wrap]; src_p2=&src_p1[src_wrap]; for(y=0;y<(height-2);y+=2) { deinterlace_line_inplace(buf,src_m1,src_0,src_p1,src_p2,width); src_m1 = src_p1; src_0 = src_p2; src_p1 += 2*src_wrap; src_p2 += 2*src_wrap; } deinterlace_line_inplace(buf,src_m1,src_0,src_0,src_0,width); av_free(buf); } libavcodec/imgconvert.c:1231: error: Null Dereference pointer `buf` last assigned on line 1228 could be null and is dereferenced by call to `memcpy()` at line 1231, column 5. libavcodec/imgconvert.c:1222:1: start of procedure deinterlace_bottom_field_inplace() 1220. } 1221. 1222. static void deinterlace_bottom_field_inplace(uint8_t *src1, int src_wrap, ^ 1223. int width, int height) 1224. { libavcodec/imgconvert.c:1228:5: 1226. int y; 1227. uint8_t *buf; 1228. buf = (uint8_t*)av_malloc(width); ^ 1229. 1230. src_m1 = src1; libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(unsigned int size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(unsigned int size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking true branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-16) ) ^ 73. return NULL; 74. libavutil/mem.c:73:9: 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-16) ) 73. return NULL; ^ 74. 75. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:117:1: return from a call to av_malloc 115. #endif 116. return ptr; 117. } ^ 118. 119. void *av_realloc(void *ptr, unsigned int size) libavcodec/imgconvert.c:1230:5: 1228. buf = (uint8_t*)av_malloc(width); 1229. 1230. src_m1 = src1; ^ 1231. memcpy(buf,src_m1,width); 1232. src_0=&src_m1[src_wrap]; libavcodec/imgconvert.c:1231:5: 1229. 1230. src_m1 = src1; 1231. memcpy(buf,src_m1,width); ^ 1232. src_0=&src_m1[src_wrap]; 1233. src_p1=&src_0[src_wrap];
https://github.com/libav/libav/blob/983ec304974bfa928735153e115659c700c170dd/libavcodec/imgconvert.c/#L1231
d2a_code_trace_data_44504
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->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } if (allocbytes != NULL) *allocbytes = WPACKET_get_curr(pkt); return 1; } ssl/statem/statem_srvr.c:2512: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 4]):unsigned64 by call to `tls_construct_extensions`. Showing all 14 steps of the trace ssl/statem/statem_srvr.c:2506:14: Call 2504. if (SSL_IS_TLS13(s)) { 2505. /* TODO(TLS1.3) for now send empty request context */ 2506. if (!WPACKET_put_bytes_u8(pkt, 0)) { ^ 2507. SSLerr(SSL_F_TLS_CONSTRUCT_CERTIFICATE_REQUEST, 2508. ERR_R_INTERNAL_ERROR); ssl/packet.c:312:1: Parameter `pkt->buf->length` 310. } 311. 312. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 313. { 314. unsigned char *data; ssl/statem/statem_srvr.c:2512:14: Call 2510. } 2511. 2512. if (!tls_construct_extensions(s, pkt, EXT_TLS1_3_CERTIFICATE_REQUEST, ^ 2513. NULL, 0, &al)) { 2514. SSLerr(SSL_F_TLS_CONSTRUCT_CERTIFICATE_REQUEST, ssl/statem/extensions.c:625:1: Parameter `pkt->written` 623. * failure construction stops at the first extension to fail to construct. 624. */ 625. > int tls_construct_extensions(SSL *s, WPACKET *pkt, unsigned int context, 626. X509 *x, size_t chainidx, int *al) 627. { ssl/statem/extensions.c:638:10: Call 636. tmpal = SSL_AD_INTERNAL_ERROR; 637. 638. if (!WPACKET_start_sub_packet_u16(pkt) ^ 639. /* 640. * If extensions are of zero length then we don't even add the ssl/packet.c:275:1: Parameter `pkt->written` 273. } 274. 275. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 276. { 277. WPACKET_SUB *sub; ssl/packet.c:299:10: Call 297. } 298. 299. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 300. return 0; 301. /* 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:39:1: <LHS trace> 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: Parameter `pkt->buf->length` 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: <RHS trace> 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: Parameter `len` 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:49:36: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 4]):unsigned64 by call to `tls_construct_extensions` 47. return 0; 48. 49. if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) { ^ 50. size_t newlen; 51. size_t reflen;
https://github.com/openssl/openssl/blob/6d0b5ee1d6163732b886bc0567dbce08aeade4c1/ssl/packet.c/#L49
d2a_code_trace_data_44505
int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, size_t num, const EC_POINT *points[], const BIGNUM *scalars[], BN_CTX *ctx) { const EC_POINT *generator = NULL; EC_POINT *tmp = NULL; size_t totalnum; size_t blocksize = 0, numblocks = 0; size_t pre_points_per_block = 0; size_t i, j; int k; int r_is_inverted = 0; int r_is_at_infinity = 1; size_t *wsize = NULL; signed char **wNAF = NULL; size_t *wNAF_len = NULL; size_t max_len = 0; size_t num_val; EC_POINT **val = NULL; EC_POINT **v; EC_POINT ***val_sub = NULL; const EC_PRE_COMP *pre_comp = NULL; int num_scalar = 0; int ret = 0; if (!BN_is_zero(group->order) && !BN_is_zero(group->cofactor)) { if ((scalar != group->order) && (scalar != NULL) && (num == 0)) { return ec_scalar_mul_ladder(group, r, scalar, NULL, ctx); } if ((scalar == NULL) && (num == 1) && (scalars[0] != group->order)) { return ec_scalar_mul_ladder(group, r, scalars[0], points[0], ctx); } } if (scalar != NULL) { generator = EC_GROUP_get0_generator(group); if (generator == NULL) { ECerr(EC_F_EC_WNAF_MUL, EC_R_UNDEFINED_GENERATOR); goto err; } pre_comp = group->pre_comp.ec; if (pre_comp && pre_comp->numblocks && (EC_POINT_cmp(group, generator, pre_comp->points[0], ctx) == 0)) { blocksize = pre_comp->blocksize; numblocks = (BN_num_bits(scalar) / blocksize) + 1; if (numblocks > pre_comp->numblocks) numblocks = pre_comp->numblocks; pre_points_per_block = (size_t)1 << (pre_comp->w - 1); if (pre_comp->num != (pre_comp->numblocks * pre_points_per_block)) { ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR); goto err; } } else { pre_comp = NULL; numblocks = 1; num_scalar = 1; } } totalnum = num + numblocks; wsize = OPENSSL_malloc(totalnum * sizeof(wsize[0])); wNAF_len = OPENSSL_malloc(totalnum * sizeof(wNAF_len[0])); wNAF = OPENSSL_malloc((totalnum + 1) * sizeof(wNAF[0])); val_sub = OPENSSL_malloc(totalnum * sizeof(val_sub[0])); if (wNAF != NULL) wNAF[0] = NULL; if (wsize == NULL || wNAF_len == NULL || wNAF == NULL || val_sub == NULL) { ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE); goto err; } num_val = 0; for (i = 0; i < num + num_scalar; i++) { size_t bits; bits = i < num ? BN_num_bits(scalars[i]) : BN_num_bits(scalar); wsize[i] = EC_window_bits_for_scalar_size(bits); num_val += (size_t)1 << (wsize[i] - 1); wNAF[i + 1] = NULL; wNAF[i] = bn_compute_wNAF((i < num ? scalars[i] : scalar), wsize[i], &wNAF_len[i]); if (wNAF[i] == NULL) goto err; if (wNAF_len[i] > max_len) max_len = wNAF_len[i]; } if (numblocks) { if (pre_comp == NULL) { if (num_scalar != 1) { ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR); goto err; } } else { signed char *tmp_wNAF = NULL; size_t tmp_len = 0; if (num_scalar != 0) { ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR); goto err; } wsize[num] = pre_comp->w; tmp_wNAF = bn_compute_wNAF(scalar, wsize[num], &tmp_len); if (!tmp_wNAF) goto err; if (tmp_len <= max_len) { numblocks = 1; totalnum = num + 1; wNAF[num] = tmp_wNAF; wNAF[num + 1] = NULL; wNAF_len[num] = tmp_len; val_sub[num] = pre_comp->points; } else { signed char *pp; EC_POINT **tmp_points; if (tmp_len < numblocks * blocksize) { numblocks = (tmp_len + blocksize - 1) / blocksize; if (numblocks > pre_comp->numblocks) { ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR); OPENSSL_free(tmp_wNAF); goto err; } totalnum = num + numblocks; } pp = tmp_wNAF; tmp_points = pre_comp->points; for (i = num; i < totalnum; i++) { if (i < totalnum - 1) { wNAF_len[i] = blocksize; if (tmp_len < blocksize) { ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR); OPENSSL_free(tmp_wNAF); goto err; } tmp_len -= blocksize; } else wNAF_len[i] = tmp_len; wNAF[i + 1] = NULL; wNAF[i] = OPENSSL_malloc(wNAF_len[i]); if (wNAF[i] == NULL) { ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE); OPENSSL_free(tmp_wNAF); goto err; } memcpy(wNAF[i], pp, wNAF_len[i]); if (wNAF_len[i] > max_len) max_len = wNAF_len[i]; if (*tmp_points == NULL) { ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR); OPENSSL_free(tmp_wNAF); goto err; } val_sub[i] = tmp_points; tmp_points += pre_points_per_block; pp += blocksize; } OPENSSL_free(tmp_wNAF); } } } val = OPENSSL_malloc((num_val + 1) * sizeof(val[0])); if (val == NULL) { ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE); goto err; } val[num_val] = NULL; v = val; for (i = 0; i < num + num_scalar; i++) { val_sub[i] = v; for (j = 0; j < ((size_t)1 << (wsize[i] - 1)); j++) { *v = EC_POINT_new(group); if (*v == NULL) goto err; v++; } } if (!(v == val + num_val)) { ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR); goto err; } if ((tmp = EC_POINT_new(group)) == NULL) goto err; for (i = 0; i < num + num_scalar; i++) { if (i < num) { if (!EC_POINT_copy(val_sub[i][0], points[i])) goto err; } else { if (!EC_POINT_copy(val_sub[i][0], generator)) goto err; } if (wsize[i] > 1) { if (!EC_POINT_dbl(group, tmp, val_sub[i][0], ctx)) goto err; for (j = 1; j < ((size_t)1 << (wsize[i] - 1)); j++) { if (!EC_POINT_add (group, val_sub[i][j], val_sub[i][j - 1], tmp, ctx)) goto err; } } } if (!EC_POINTs_make_affine(group, num_val, val, ctx)) goto err; r_is_at_infinity = 1; for (k = max_len - 1; k >= 0; k--) { if (!r_is_at_infinity) { if (!EC_POINT_dbl(group, r, r, ctx)) goto err; } for (i = 0; i < totalnum; i++) { if (wNAF_len[i] > (size_t)k) { int digit = wNAF[i][k]; int is_neg; if (digit) { is_neg = digit < 0; if (is_neg) digit = -digit; if (is_neg != r_is_inverted) { if (!r_is_at_infinity) { if (!EC_POINT_invert(group, r, ctx)) goto err; } r_is_inverted = !r_is_inverted; } if (r_is_at_infinity) { if (!EC_POINT_copy(r, val_sub[i][digit >> 1])) goto err; r_is_at_infinity = 0; } else { if (!EC_POINT_add (group, r, r, val_sub[i][digit >> 1], ctx)) goto err; } } } } } if (r_is_at_infinity) { if (!EC_POINT_set_to_infinity(group, r)) goto err; } else { if (r_is_inverted) if (!EC_POINT_invert(group, r, ctx)) goto err; } ret = 1; err: EC_POINT_free(tmp); OPENSSL_free(wsize); OPENSSL_free(wNAF_len); if (wNAF != NULL) { signed char **w; for (w = wNAF; *w != NULL; w++) OPENSSL_free(*w); OPENSSL_free(wNAF); } if (val != NULL) { for (v = val; *v != NULL; v++) EC_POINT_clear_free(*v); OPENSSL_free(val); } OPENSSL_free(val_sub); return ret; } apps/ecparam.c:286: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `EC_GROUP_check`. Showing all 10 steps of the trace apps/ecparam.c:286:14: Call 284. if (check) { 285. BIO_printf(bio_err, "checking elliptic curve parameters: "); 286. if (!EC_GROUP_check(group, NULL)) { ^ 287. BIO_printf(bio_err, "failed\n"); 288. ERR_print_errors(bio_err); crypto/ec/ec_check.c:23:1: Parameter `group->pre_comp.ec->w` 21. } 22. 23. > int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx) 24. { 25. #ifdef FIPS_MODE crypto/ec/ec_check.c:81:10: Call 79. } 80. 81. if (!EC_POINT_mul(group, point, order, NULL, NULL, ctx)) ^ 82. goto err; 83. if (!EC_POINT_is_at_infinity(group, point)) { crypto/ec/ec_lib.c:971:1: Parameter `group->pre_comp.ec->w` 969. } 970. 971. > int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, 972. const EC_POINT *point, const BIGNUM *p_scalar, BN_CTX *ctx) 973. { crypto/ec/ec_lib.c:982:12: Call 980. scalars[0] = p_scalar; 981. 982. return EC_POINTs_mul(group, r, g_scalar, ^ 983. (point != NULL 984. && p_scalar != NULL), points, scalars, ctx); crypto/ec/ec_lib.c:933:1: Parameter `group->pre_comp.ec->w` 931. */ 932. 933. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 934. size_t num, const EC_POINT *points[], 935. const BIGNUM *scalars[], BN_CTX *ctx) crypto/ec/ec_lib.c:965:15: Call 963. else 964. /* use default */ 965. ret = ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx); ^ 966. 967. BN_CTX_free(new_ctx); crypto/ec/ec_mult.c:410:1: <LHS trace> 408. * in the addition if scalar != NULL 409. */ 410. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 411. size_t num, const EC_POINT *points[], const BIGNUM *scalars[], 412. BN_CTX *ctx) crypto/ec/ec_mult.c:410:1: Parameter `group->pre_comp.ec->w` 408. * in the addition if scalar != NULL 409. */ 410. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 411. size_t num, const EC_POINT *points[], const BIGNUM *scalars[], 412. BN_CTX *ctx) crypto/ec/ec_mult.c:494:13: Binary operation: ([0, +oo] - 1):unsigned64 by call to `EC_GROUP_check` 492. numblocks = pre_comp->numblocks; 493. 494. pre_points_per_block = (size_t)1 << (pre_comp->w - 1); ^ 495. 496. /* check that pre_comp looks sane */
https://github.com/openssl/openssl/blob/b11327929294cf825e4759d97af6f174bd6b081c/crypto/ec/ec_mult.c/#L494
d2a_code_trace_data_44506
void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) { #ifdef POLY1305_ASM poly1305_blocks_f poly1305_blocks_p = ctx->func.blocks; #endif size_t rem, num; if ((num = ctx->num)) { rem = POLY1305_BLOCK_SIZE - num; if (len >= rem) { memcpy(ctx->data + num, inp, rem); poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 1); inp += rem; len -= rem; } else { memcpy(ctx->data + num, inp, len); ctx->num = num + len; return; } } rem = len % POLY1305_BLOCK_SIZE; len -= rem; if (len >= POLY1305_BLOCK_SIZE) { poly1305_blocks(ctx->opaque, inp, len, 1); inp += len; } if (rem) memcpy(ctx->data, inp, rem); ctx->num = rem; } crypto/evp/e_chacha20_poly1305.c:340: error: INTEGER_OVERFLOW_L2 (16 - [1, 43]):unsigned64 by call to `Poly1305_Update`. Showing all 7 steps of the trace crypto/evp/e_chacha20_poly1305.c:255:9: Call 253. ChaCha20_ctr32(buf, zero, (buf_len = 2 * CHACHA_BLK_SIZE), 254. actx->key.key.d, actx->key.counter); 255. Poly1305_Init(POLY1305_ctx(actx), buf); ^ 256. actx->key.partial_len = 0; 257. memcpy(tohash, actx->tls_aad, POLY1305_BLOCK_SIZE); crypto/poly1305/poly1305.c:457:5: Assignment 455. #endif 456. 457. ctx->num = 0; ^ 458. 459. } crypto/evp/e_chacha20_poly1305.c:340:5: Call 338. } 339. 340. Poly1305_Update(POLY1305_ctx(actx), tohash, tohash_len); ^ 341. OPENSSL_cleanse(buf, buf_len); 342. Poly1305_Final(POLY1305_ctx(actx), ctx->encrypt ? actx->tag crypto/poly1305/poly1305.c:470:1: <RHS trace> 468. #endif 469. 470. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) 471. { 472. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:470:1: Parameter `ctx->num` 468. #endif 469. 470. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) 471. { 472. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:483:10: Assignment 481. size_t rem, num; 482. 483. if ((num = ctx->num)) { ^ 484. rem = POLY1305_BLOCK_SIZE - num; 485. if (len >= rem) { crypto/poly1305/poly1305.c:484:9: Binary operation: (16 - [1, 43]):unsigned64 by call to `Poly1305_Update` 482. 483. if ((num = ctx->num)) { 484. rem = POLY1305_BLOCK_SIZE - num; ^ 485. if (len >= rem) { 486. memcpy(ctx->data + num, inp, rem);
https://github.com/openssl/openssl/blob/3e0076c213ec2d1149a9a89f9bc141d1a1a44630/crypto/poly1305/poly1305.c/#L484
d2a_code_trace_data_44507
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_exp.c:354: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_nnmod`. Showing all 24 steps of the trace crypto/bn/bn_exp.c:296:1: Parameter `ctx->stack.depth` 294. } 295. 296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 297. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 298. { crypto/bn/bn_exp.c:333:5: Call 331. } 332. 333. BN_CTX_start(ctx); ^ 334. d = BN_CTX_get(ctx); 335. r = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_exp.c:334:9: Call 332. 333. BN_CTX_start(ctx); 334. d = BN_CTX_get(ctx); ^ 335. r = BN_CTX_get(ctx); 336. val[0] = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_exp.c:335:9: Call 333. BN_CTX_start(ctx); 334. d = BN_CTX_get(ctx); 335. r = BN_CTX_get(ctx); ^ 336. val[0] = BN_CTX_get(ctx); 337. if (val[0] == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_exp.c:336:14: Call 334. d = BN_CTX_get(ctx); 335. r = BN_CTX_get(ctx); 336. val[0] = BN_CTX_get(ctx); ^ 337. if (val[0] == NULL) 338. 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_exp.c:354:14: Call 352. 353. if (a->neg || BN_ucmp(a, m) >= 0) { 354. if (!BN_nnmod(val[0], a, m, ctx)) ^ 355. goto err; 356. aa = val[0]; crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c: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_nnmod` 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_44508
int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, int *pclass, long omax) { int i, ret; long l; const unsigned char *p = *pp; int tag, xclass, inf; long max = omax; if (!max) goto err; ret = (*p & V_ASN1_CONSTRUCTED); xclass = (*p & V_ASN1_PRIVATE); i = *p & V_ASN1_PRIMITIVE_TAG; if (i == V_ASN1_PRIMITIVE_TAG) { p++; if (--max == 0) goto err; l = 0; while (*p & 0x80) { l <<= 7L; l |= *(p++) & 0x7f; if (--max == 0) goto err; if (l > (INT_MAX >> 7L)) goto err; } l <<= 7L; l |= *(p++) & 0x7f; tag = (int)l; if (--max == 0) goto err; } else { tag = i; p++; if (--max == 0) goto err; } *ptag = tag; *pclass = xclass; if (!asn1_get_length(&p, &inf, plength, max)) goto err; if (inf && !(ret & V_ASN1_CONSTRUCTED)) goto err; if (*plength > (omax - (p - *pp))) { ASN1err(ASN1_F_ASN1_GET_OBJECT, ASN1_R_TOO_LONG); ret |= 0x80; } *pp = p; return ret | inf; err: ASN1err(ASN1_F_ASN1_GET_OBJECT, ASN1_R_HEADER_TOO_LONG); return 0x80; } apps/asn1pars.c:238: error: BUFFER_OVERRUN_L3 Offset: [2, +oo] Size: [1, 2147483644] by call to `d2i_ASN1_TYPE`. Showing all 22 steps of the trace apps/asn1pars.c:206:13: Assignment 204. } 205. 206. num = 0; ^ 207. for (;;) { 208. if (!BUF_MEM_grow(buf, num + BUFSIZ)) apps/asn1pars.c:224:9: Assignment 222. if (sk_OPENSSL_STRING_num(osk)) { 223. tmpbuf = str; 224. tmplen = num; ^ 225. for (i = 0; i < sk_OPENSSL_STRING_num(osk); i++) { 226. ASN1_TYPE *atmp; apps/asn1pars.c:234:13: Assignment 232. continue; 233. } 234. tmpbuf += j; ^ 235. tmplen -= j; 236. atmp = at; apps/asn1pars.c:237:13: Assignment 235. tmplen -= j; 236. atmp = at; 237. ctmpbuf = tmpbuf; ^ 238. at = d2i_ASN1_TYPE(NULL, &ctmpbuf, tmplen); 239. ASN1_TYPE_free(atmp); apps/asn1pars.c:238:18: Call 236. atmp = at; 237. ctmpbuf = tmpbuf; 238. at = d2i_ASN1_TYPE(NULL, &ctmpbuf, tmplen); ^ 239. ASN1_TYPE_free(atmp); 240. if (!at) { crypto/asn1/tasn_typ.c:53:1: Parameter `**in` 51. IMPLEMENT_ASN1_TYPE(ASN1_SEQUENCE) 52. 53. > IMPLEMENT_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE) 54. 55. /* Multistring types */ crypto/asn1/tasn_typ.c:53:1: Call 51. IMPLEMENT_ASN1_TYPE(ASN1_SEQUENCE) 52. 53. > IMPLEMENT_ASN1_FUNCTIONS_fname(ASN1_TYPE, ASN1_ANY, ASN1_TYPE) 54. 55. /* Multistring types */ crypto/asn1/tasn_dec.c:105:1: Parameter `**in` 103. */ 104. 105. > ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, 106. const unsigned char **in, long len, 107. const ASN1_ITEM *it) crypto/asn1/tasn_dec.c:114:9: Call 112. pval = &ptmpval; 113. asn1_tlc_clear_nc(&c); 114. if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) ^ 115. return *pval; 116. return NULL; crypto/asn1/tasn_dec.c:119:1: Parameter `**in` 117. } 118. 119. > int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, 120. const ASN1_ITEM *it, 121. int tag, int aclass, char opt, ASN1_TLC *ctx) crypto/asn1/tasn_dec.c:124:10: Call 122. { 123. int rv; 124. rv = asn1_item_embed_d2i(pval, in, len, it, tag, aclass, opt, ctx, 0); ^ 125. if (rv <= 0) 126. ASN1_item_ex_free(pval, it); crypto/asn1/tasn_dec.c:135:1: Parameter `**in` 133. */ 134. 135. > static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in, 136. long len, const ASN1_ITEM *it, 137. int tag, int aclass, char opt, ASN1_TLC *ctx, crypto/asn1/tasn_dec.c:185:9: Assignment 183. 184. case ASN1_ITYPE_MSTRING: 185. p = *in; ^ 186. /* Just read in tag and class */ 187. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, crypto/asn1/tasn_dec.c:187:15: Call 185. p = *in; 186. /* Just read in tag and class */ 187. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, ^ 188. &p, len, -1, 0, 1, ctx); 189. if (!ret) { crypto/asn1/tasn_dec.c:1078:1: Parameter `**in` 1076. */ 1077. 1078. > static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, 1079. char *inf, char *cst, 1080. const unsigned char **in, long len, crypto/asn1/tasn_dec.c:1087:5: Assignment 1085. long plen; 1086. const unsigned char *p, *q; 1087. p = *in; ^ 1088. q = p; 1089. crypto/asn1/tasn_dec.c:1097:13: Call 1095. p += ctx->hdrlen; 1096. } else { 1097. i = ASN1_get_object(&p, &plen, &ptag, &pclass, len); ^ 1098. if (ctx) { 1099. ctx->ret = i; crypto/asn1/asn1_lib.c:44:1: <Length trace> 42. } 43. 44. > int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, 45. int *pclass, long omax) 46. { crypto/asn1/asn1_lib.c:44:1: Parameter `**pp` 42. } 43. 44. > int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, 45. int *pclass, long omax) 46. { crypto/asn1/asn1_lib.c:49:5: Assignment 47. int i, ret; 48. long l; 49. const unsigned char *p = *pp; ^ 50. int tag, xclass, inf; 51. long max = omax; crypto/asn1/asn1_lib.c:59:9: Assignment 57. i = *p & V_ASN1_PRIMITIVE_TAG; 58. if (i == V_ASN1_PRIMITIVE_TAG) { /* high-tag */ 59. p++; ^ 60. if (--max == 0) 61. goto err; crypto/asn1/asn1_lib.c:63:16: Array access: Offset: [2, +oo] Size: [1, 2147483644] by call to `d2i_ASN1_TYPE` 61. goto err; 62. l = 0; 63. while (*p & 0x80) { ^ 64. l <<= 7L; 65. l |= *(p++) & 0x7f;
https://github.com/openssl/openssl/blob/260a16f33682a819414fcba6161708a5e6bdff50/crypto/asn1/asn1_lib.c/#L63
d2a_code_trace_data_44509
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:383: error: Integer Overflow L2 ([1, +oo] - 10):unsigned32 by call to `bitstream_read_signed`. libavcodec/takdec.c:383:21: Call 381. int16_t predictors[MAX_PREDICTORS]; 382. 383. predictors[0] = bitstream_read_signed(bc, 10); ^ 384. predictors[1] = bitstream_read_signed(bc, 10); 385. predictors[2] = bitstream_read_signed(bc, size) << (10 - size); libavcodec/bitstream.h:199:1: Parameter `n` 197. /* Return n bits from the buffer as a signed integer. 198. * n has to be in the 0-32 range. */ 199. static inline int32_t bitstream_read_signed(BitstreamContext *bc, unsigned n) ^ 200. { 201. return sign_extend(bitstream_read(bc, n), n); libavcodec/bitstream.h:201:24: Call 199. static inline int32_t bitstream_read_signed(BitstreamContext *bc, unsigned n) 200. { 201. return sign_extend(bitstream_read(bc, n), n); ^ 202. } 203. 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] - 10):unsigned32 by call to `bitstream_read_signed` 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_44510
static int opt_preset(const char *opt, const char *arg) { FILE *f=NULL; char filename[1000], tmp[1000], tmp2[1000], line[1000]; char *codec_name = *opt == 'v' ? video_codec_name : *opt == 'a' ? audio_codec_name : subtitle_codec_name; if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { fprintf(stderr, "File for preset '%s' not found\n", arg); ffmpeg_exit(1); } while(!feof(f)){ int e= fscanf(f, "%999[^\n]\n", line) - 1; if(line[0] == '#' && !e) continue; e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2; if(e){ fprintf(stderr, "%s: Invalid syntax: '%s'\n", filename, line); ffmpeg_exit(1); } if(!strcmp(tmp, "acodec")){ opt_audio_codec(tmp2); }else if(!strcmp(tmp, "vcodec")){ opt_video_codec(tmp2); }else if(!strcmp(tmp, "scodec")){ opt_subtitle_codec(tmp2); }else if(opt_default(tmp, tmp2) < 0){ fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2); ffmpeg_exit(1); } } fclose(f); return 0; } ffmpeg.c:4115: error: Null Dereference pointer `f` last assigned on line 4110 could be null and is dereferenced by call to `feof()` at line 4115, column 12. ffmpeg.c:4102:1: start of procedure opt_preset() 4100. } 4101. 4102. static int opt_preset(const char *opt, const char *arg) ^ 4103. { 4104. FILE *f=NULL; ffmpeg.c:4104:5: 4102. static int opt_preset(const char *opt, const char *arg) 4103. { 4104. FILE *f=NULL; ^ 4105. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4106. char *codec_name = *opt == 'v' ? video_codec_name : ffmpeg.c:4106:24: Condition is false 4104. FILE *f=NULL; 4105. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4106. char *codec_name = *opt == 'v' ? video_codec_name : ^ 4107. *opt == 'a' ? audio_codec_name : 4108. subtitle_codec_name; ffmpeg.c:4107:24: Condition is false 4105. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4106. char *codec_name = *opt == 'v' ? video_codec_name : 4107. *opt == 'a' ? audio_codec_name : ^ 4108. subtitle_codec_name; 4109. ffmpeg.c:4106:24: 4104. FILE *f=NULL; 4105. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4106. char *codec_name = *opt == 'v' ? video_codec_name : ^ 4107. *opt == 'a' ? audio_codec_name : 4108. subtitle_codec_name; ffmpeg.c:4106:5: 4104. FILE *f=NULL; 4105. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4106. char *codec_name = *opt == 'v' ? video_codec_name : ^ 4107. *opt == 'a' ? audio_codec_name : 4108. subtitle_codec_name; ffmpeg.c:4110:64: Condition is false 4108. subtitle_codec_name; 4109. 4110. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { ^ 4111. fprintf(stderr, "File for preset '%s' not found\n", arg); 4112. ffmpeg_exit(1); ffmpeg.c:4110:11: Taking true branch 4108. subtitle_codec_name; 4109. 4110. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { ^ 4111. fprintf(stderr, "File for preset '%s' not found\n", arg); 4112. ffmpeg_exit(1); ffmpeg.c:4111:9: 4109. 4110. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { 4111. fprintf(stderr, "File for preset '%s' not found\n", arg); ^ 4112. ffmpeg_exit(1); 4113. } ffmpeg.c:4112:9: Skipping ffmpeg_exit(): empty list of specs 4110. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { 4111. fprintf(stderr, "File for preset '%s' not found\n", arg); 4112. ffmpeg_exit(1); ^ 4113. } 4114. ffmpeg.c:4115:12: 4113. } 4114. 4115. while(!feof(f)){ ^ 4116. int e= fscanf(f, "%999[^\n]\n", line) - 1; 4117. if(line[0] == '#' && !e)
https://github.com/libav/libav/blob/129983408d0d064db656742a3d3d4c038420f48c/ffmpeg.c/#L4115
d2a_code_trace_data_44511
int test_mont(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b, *c, *d, *A, *B; BIGNUM *n; int i; BN_MONT_CTX *mont; a = BN_new(); b = BN_new(); c = BN_new(); d = BN_new(); A = BN_new(); B = BN_new(); n = BN_new(); mont = BN_MONT_CTX_new(); if (mont == NULL) return 0; BN_zero(n); if (BN_MONT_CTX_set(mont, n, ctx)) { fprintf(stderr, "BN_MONT_CTX_set succeeded for zero modulus!\n"); return 0; } BN_set_word(n, 16); if (BN_MONT_CTX_set(mont, n, ctx)) { fprintf(stderr, "BN_MONT_CTX_set succeeded for even modulus!\n"); return 0; } BN_bntest_rand(a, 100, 0, 0); BN_bntest_rand(b, 100, 0, 0); for (i = 0; i < num2; i++) { int bits = (200 * (i + 1)) / num2; if (bits == 0) continue; BN_bntest_rand(n, bits, 0, 1); BN_MONT_CTX_set(mont, n, ctx); BN_nnmod(a, a, n, ctx); BN_nnmod(b, b, n, ctx); BN_to_montgomery(A, a, mont, ctx); BN_to_montgomery(B, b, mont, ctx); BN_mod_mul_montgomery(c, A, B, mont, ctx); BN_from_montgomery(A, c, mont, ctx); if (bp != NULL) { if (!results) { BN_print(bp, a); BIO_puts(bp, " * "); BN_print(bp, b); BIO_puts(bp, " % "); BN_print(bp, &mont->N); BIO_puts(bp, " - "); } BN_print(bp, A); BIO_puts(bp, "\n"); } BN_mod_mul(d, a, b, n, ctx); BN_sub(d, d, A); if (!BN_is_zero(d)) { fprintf(stderr, "Montgomery multiplication test failed!\n"); return 0; } } BN_MONT_CTX_free(mont); BN_free(a); BN_free(b); BN_free(c); BN_free(d); BN_free(A); BN_free(B); BN_free(n); return (1); } test/bntest.c:806: error: MEMORY_LEAK memory dynamically allocated by call to `BN_MONT_CTX_new()` at line 800, column 12 is not reachable after line 806, column 17. Showing all 193 steps of the trace test/bntest.c:785:1: start of procedure test_mont() 783. } 784. 785. > int test_mont(BIO *bp, BN_CTX *ctx) 786. { 787. BIGNUM *a, *b, *c, *d, *A, *B; test/bntest.c:792:5: 790. BN_MONT_CTX *mont; 791. 792. > a = BN_new(); 793. b = BN_new(); 794. 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:793:5: 791. 792. a = BN_new(); 793. > b = BN_new(); 794. c = BN_new(); 795. 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:794:5: 792. a = BN_new(); 793. b = BN_new(); 794. > c = BN_new(); 795. d = BN_new(); 796. A = 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:795:5: 793. b = BN_new(); 794. c = BN_new(); 795. > d = BN_new(); 796. A = BN_new(); 797. B = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:796:5: 794. c = BN_new(); 795. d = BN_new(); 796. > A = BN_new(); 797. B = BN_new(); 798. n = 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:797:5: 795. d = BN_new(); 796. A = BN_new(); 797. > B = BN_new(); 798. n = BN_new(); 799. 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:798:5: 796. A = BN_new(); 797. B = BN_new(); 798. > n = BN_new(); 799. 800. mont = BN_MONT_CTX_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:800:5: 798. n = BN_new(); 799. 800. > mont = BN_MONT_CTX_new(); 801. if (mont == NULL) 802. return 0; crypto/bn/bn_mont.c:315:1: start of procedure BN_MONT_CTX_new() 313. } 314. 315. > BN_MONT_CTX *BN_MONT_CTX_new(void) 316. { 317. BN_MONT_CTX *ret; crypto/bn/bn_mont.c:319:9: 317. BN_MONT_CTX *ret; 318. 319. > if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) 320. return (NULL); 321. crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/bn/bn_mont.c:319:9: Taking false branch 317. BN_MONT_CTX *ret; 318. 319. if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) ^ 320. return (NULL); 321. crypto/bn/bn_mont.c:322:5: 320. return (NULL); 321. 322. > BN_MONT_CTX_init(ret); 323. ret->flags = BN_FLG_MALLOCED; 324. return (ret); crypto/bn/bn_mont.c:327:1: start of procedure BN_MONT_CTX_init() 325. } 326. 327. > void BN_MONT_CTX_init(BN_MONT_CTX *ctx) 328. { 329. ctx->ri = 0; crypto/bn/bn_mont.c:329:5: 327. void BN_MONT_CTX_init(BN_MONT_CTX *ctx) 328. { 329. > ctx->ri = 0; 330. bn_init(&(ctx->RR)); 331. bn_init(&(ctx->N)); crypto/bn/bn_mont.c:330:5: Skipping bn_init(): empty list of specs 328. { 329. ctx->ri = 0; 330. bn_init(&(ctx->RR)); ^ 331. bn_init(&(ctx->N)); 332. bn_init(&(ctx->Ni)); crypto/bn/bn_mont.c:331:5: Skipping bn_init(): empty list of specs 329. ctx->ri = 0; 330. bn_init(&(ctx->RR)); 331. bn_init(&(ctx->N)); ^ 332. bn_init(&(ctx->Ni)); 333. ctx->n0[0] = ctx->n0[1] = 0; crypto/bn/bn_mont.c:332:5: Skipping bn_init(): empty list of specs 330. bn_init(&(ctx->RR)); 331. bn_init(&(ctx->N)); 332. bn_init(&(ctx->Ni)); ^ 333. ctx->n0[0] = ctx->n0[1] = 0; 334. ctx->flags = 0; crypto/bn/bn_mont.c:333:5: 331. bn_init(&(ctx->N)); 332. bn_init(&(ctx->Ni)); 333. > ctx->n0[0] = ctx->n0[1] = 0; 334. ctx->flags = 0; 335. } crypto/bn/bn_mont.c:334:5: 332. bn_init(&(ctx->Ni)); 333. ctx->n0[0] = ctx->n0[1] = 0; 334. > ctx->flags = 0; 335. } 336. crypto/bn/bn_mont.c:335:1: return from a call to BN_MONT_CTX_init 333. ctx->n0[0] = ctx->n0[1] = 0; 334. ctx->flags = 0; 335. > } 336. 337. void BN_MONT_CTX_free(BN_MONT_CTX *mont) crypto/bn/bn_mont.c:323:5: 321. 322. BN_MONT_CTX_init(ret); 323. > ret->flags = BN_FLG_MALLOCED; 324. return (ret); 325. } crypto/bn/bn_mont.c:324:5: 322. BN_MONT_CTX_init(ret); 323. ret->flags = BN_FLG_MALLOCED; 324. > return (ret); 325. } 326. crypto/bn/bn_mont.c:325:1: return from a call to BN_MONT_CTX_new 323. ret->flags = BN_FLG_MALLOCED; 324. return (ret); 325. > } 326. 327. void BN_MONT_CTX_init(BN_MONT_CTX *ctx) test/bntest.c:801:9: Taking false branch 799. 800. mont = BN_MONT_CTX_new(); 801. if (mont == NULL) ^ 802. return 0; 803. test/bntest.c:804:5: 802. return 0; 803. 804. > BN_zero(n); 805. if (BN_MONT_CTX_set(mont, n, ctx)) { 806. fprintf(stderr, "BN_MONT_CTX_set succeeded for zero modulus!\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:805:9: Taking true branch 803. 804. BN_zero(n); 805. if (BN_MONT_CTX_set(mont, n, ctx)) { ^ 806. fprintf(stderr, "BN_MONT_CTX_set succeeded for zero modulus!\n"); 807. return 0; test/bntest.c:806:9: 804. BN_zero(n); 805. if (BN_MONT_CTX_set(mont, n, ctx)) { 806. > fprintf(stderr, "BN_MONT_CTX_set succeeded for zero modulus!\n"); 807. return 0; 808. }
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L806
d2a_code_trace_data_44512
static int drbg_status(void) { DRBG_CTX *dctx = RAND_DRBG_get_default(); int ret; CRYPTO_THREAD_write_lock(dctx->lock); ret = dctx->status == DRBG_STATUS_READY ? 1 : 0; CRYPTO_THREAD_unlock(dctx->lock); return ret; } crypto/rand/drbg_rand.c:421: error: NULL_DEREFERENCE pointer `dctx` last assigned on line 418 could be null and is dereferenced at line 421, column 30. Showing all 13 steps of the trace crypto/rand/drbg_rand.c:416:1: start of procedure drbg_status() 414. } 415. 416. > static int drbg_status(void) 417. { 418. DRBG_CTX *dctx = RAND_DRBG_get_default(); crypto/rand/drbg_rand.c:418:5: 416. static int drbg_status(void) 417. { 418. > DRBG_CTX *dctx = RAND_DRBG_get_default(); 419. int ret; 420. crypto/rand/drbg_rand.c:384:1: start of procedure RAND_DRBG_get_default() 382. */ 383. 384. > DRBG_CTX *RAND_DRBG_get_default(void) 385. { 386. if (!RUN_ONCE(&ossl_drbg_init, do_ossl_drbg_init)) crypto/rand/drbg_rand.c:386:10: 384. DRBG_CTX *RAND_DRBG_get_default(void) 385. { 386. > if (!RUN_ONCE(&ossl_drbg_init, do_ossl_drbg_init)) 387. return NULL; 388. return &ossl_drbg; crypto/threads_pthread.c:105:1: start of procedure CRYPTO_THREAD_run_once() 103. } 104. 105. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 106. { 107. if (pthread_once(once, init) != 0) crypto/threads_pthread.c:107:9: Taking true branch 105. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 106. { 107. if (pthread_once(once, init) != 0) ^ 108. return 0; 109. crypto/threads_pthread.c:108:9: 106. { 107. if (pthread_once(once, init) != 0) 108. > return 0; 109. 110. return 1; crypto/threads_pthread.c:111:1: return from a call to CRYPTO_THREAD_run_once 109. 110. return 1; 111. > } 112. 113. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)) crypto/rand/drbg_rand.c:386:10: Condition is false 384. DRBG_CTX *RAND_DRBG_get_default(void) 385. { 386. if (!RUN_ONCE(&ossl_drbg_init, do_ossl_drbg_init)) ^ 387. return NULL; 388. return &ossl_drbg; crypto/rand/drbg_rand.c:386:10: Taking true branch 384. DRBG_CTX *RAND_DRBG_get_default(void) 385. { 386. if (!RUN_ONCE(&ossl_drbg_init, do_ossl_drbg_init)) ^ 387. return NULL; 388. return &ossl_drbg; crypto/rand/drbg_rand.c:387:9: 385. { 386. if (!RUN_ONCE(&ossl_drbg_init, do_ossl_drbg_init)) 387. > return NULL; 388. return &ossl_drbg; 389. } crypto/rand/drbg_rand.c:389:1: return from a call to RAND_DRBG_get_default 387. return NULL; 388. return &ossl_drbg; 389. > } 390. 391. static int drbg_bytes(unsigned char *out, int count) crypto/rand/drbg_rand.c:421:5: 419. int ret; 420. 421. > CRYPTO_THREAD_write_lock(dctx->lock); 422. ret = dctx->status == DRBG_STATUS_READY ? 1 : 0; 423. CRYPTO_THREAD_unlock(dctx->lock);
https://github.com/openssl/openssl/blob/12fb8c3d2dd00f3d4f1b084385403d26ed64a596/crypto/rand/drbg_rand.c/#L421
d2a_code_trace_data_44513
static void perform_idle_server_maintenance(int child_bucket, int num_buckets) { int i, j; int idle_thread_count = 0; worker_score *ws; process_score *ps; int free_length = 0; int free_slots[MAX_SPAWN_RATE]; int last_non_dead = -1; int active_thread_count = 0; for (i = 0; i < server_limit; ++i) { int status = SERVER_DEAD; int child_threads_active = 0; if (i >= retained->max_daemons_limit && free_length == retained->idle_spawn_rate[child_bucket]) { break; } ps = &ap_scoreboard_image->parent[i]; if (ps->pid != 0) { for (j = 0; j < threads_per_child; j++) { ws = &ap_scoreboard_image->servers[i][j]; status = ws->status; if (status <= SERVER_READY && !ps->quiescing && !ps->not_accepting && ps->generation == retained->my_generation && ps->bucket == child_bucket) { ++idle_thread_count; } if (status >= SERVER_READY && status < SERVER_GRACEFUL) { ++child_threads_active; } } last_non_dead = i; } active_thread_count += child_threads_active; if (!ps->pid && free_length < retained->idle_spawn_rate[child_bucket]) free_slots[free_length++] = i; else if (child_threads_active == threads_per_child) had_healthy_child = 1; } if (retained->sick_child_detected) { if (had_healthy_child) { retained->sick_child_detected = 0; } else { shutdown_pending = 1; child_fatal = 1; ap_log_error(APLOG_MARK, APLOG_ALERT, 0, ap_server_conf, APLOGNO(02324) "A resource shortage or other unrecoverable failure " "was encountered before any child process initialized " "successfully... httpd is exiting!"); return; } } retained->max_daemons_limit = last_non_dead + 1; if (idle_thread_count > max_spare_threads / num_buckets) { if (retained->total_daemons <= active_daemons_limit && retained->total_daemons < server_limit) { ap_mpm_podx_signal(all_buckets[child_bucket].pod, AP_MPM_PODX_GRACEFUL); retained->idle_spawn_rate[child_bucket] = 1; active_daemons--; } else { ap_log_error(APLOG_MARK, APLOG_TRACE5, 0, ap_server_conf, "Not shutting down child: total daemons %d / " "active limit %d / ServerLimit %d", retained->total_daemons, active_daemons_limit, server_limit); } } else if (idle_thread_count < min_spare_threads / num_buckets) { if (active_thread_count >= max_workers) { if (!retained->maxclients_reported) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, ap_server_conf, APLOGNO(00484) "server reached MaxRequestWorkers setting, " "consider raising the MaxRequestWorkers " "setting"); retained->maxclients_reported = 1; } retained->idle_spawn_rate[child_bucket] = 1; } else if (free_length == 0) { ap_log_error(APLOG_MARK, APLOG_ERR, 0, ap_server_conf, APLOGNO() "scoreboard is full, not at MaxRequestWorkers." "Increase ServerLimit."); retained->idle_spawn_rate[child_bucket] = 1; } else { if (free_length > retained->idle_spawn_rate[child_bucket]) { free_length = retained->idle_spawn_rate[child_bucket]; } if (retained->idle_spawn_rate[child_bucket] >= 8) { ap_log_error(APLOG_MARK, APLOG_INFO, 0, ap_server_conf, APLOGNO(00486) "server seems busy, (you may need " "to increase StartServers, ThreadsPerChild " "or Min/MaxSpareThreads), " "spawning %d children, there are around %d idle " "threads, %d active children, and %d children " "that are shutting down", free_length, idle_thread_count, active_daemons, retained->total_daemons); } for (i = 0; i < free_length; ++i) { ap_log_error(APLOG_MARK, APLOG_TRACE5, 0, ap_server_conf, "Spawning new child: slot %d active / " "total daemons: %d/%d", free_slots[i], active_daemons, retained->total_daemons); make_child(ap_server_conf, free_slots[i], child_bucket); } if (retained->hold_off_on_exponential_spawning) { --retained->hold_off_on_exponential_spawning; } else if (retained->idle_spawn_rate[child_bucket] < MAX_SPAWN_RATE / num_buckets) { retained->idle_spawn_rate[child_bucket] *= 2; } } } else { retained->idle_spawn_rate[child_bucket] = 1; } } server/mpm/event/event.c:3080: error: UNINITIALIZED_VALUE The value read from free_slots[_] was never initialized. server/mpm/event/event.c:3080:17: 3078. } 3079. for (i = 0; i < free_length; ++i) { 3080. ap_log_error(APLOG_MARK, APLOG_TRACE5, 0, ap_server_conf, ^ 3081. "Spawning new child: slot %d active / " 3082. "total daemons: %d/%d",
https://github.com/apache/httpd/blob/31857a5cfabcd44d6a3299a20f7455a72db13ae5/server/mpm/event/event.c/#L3080
d2a_code_trace_data_44514
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:1086: error: Uninitialized Value The value read from ref[_] was never initialized. libavcodec/h264.c:1086:24: 1084. if(ref[0] > 0) 1085. a= pack16to32(mv[0][0],mv[0][1]); 1086. if(ref[1] > 0) ^ 1087. b= pack16to32(mv[1][0],mv[1][1]); 1088. }else{
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L1086
d2a_code_trace_data_44515
void Poly1305_Final(POLY1305 *ctx, unsigned char mac[16]) { #ifdef POLY1305_ASM poly1305_blocks_f poly1305_blocks_p = ctx->func.blocks; poly1305_emit_f poly1305_emit_p = ctx->func.emit; #endif size_t num; if ((num = ctx->num)) { ctx->data[num++] = 1; while (num < POLY1305_BLOCK_SIZE) ctx->data[num++] = 0; poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 0); } poly1305_emit(ctx->opaque, mac, ctx->nonce); OPENSSL_cleanse(ctx, sizeof(*ctx)); } crypto/evp/e_chacha20_poly1305.c:342: error: BUFFER_OVERRUN_L2 Offset: [1, 57] Size: 16 by call to `Poly1305_Final`. Showing all 12 steps of the trace crypto/evp/e_chacha20_poly1305.c:255:9: Call 253. ChaCha20_ctr32(buf, zero, (buf_len = 2 * CHACHA_BLK_SIZE), 254. actx->key.key.d, actx->key.counter); 255. Poly1305_Init(POLY1305_ctx(actx), buf); ^ 256. actx->key.partial_len = 0; 257. memcpy(tohash, actx->tls_aad, POLY1305_BLOCK_SIZE); crypto/poly1305/poly1305.c:457:5: Assignment 455. #endif 456. 457. ctx->num = 0; ^ 458. 459. } crypto/evp/e_chacha20_poly1305.c:340:5: Call 338. } 339. 340. Poly1305_Update(POLY1305_ctx(actx), tohash, tohash_len); ^ 341. OPENSSL_cleanse(buf, buf_len); 342. Poly1305_Final(POLY1305_ctx(actx), ctx->encrypt ? actx->tag crypto/poly1305/poly1305.c:470:1: Parameter `len` 468. #endif 469. 470. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len) 471. { 472. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:493:13: Assignment 491. /* Still not enough data to process a block. */ 492. memcpy(ctx->data + num, inp, len); 493. ctx->num = num + len; ^ 494. return; 495. } crypto/evp/e_chacha20_poly1305.c:342:5: Call 340. Poly1305_Update(POLY1305_ctx(actx), tohash, tohash_len); 341. OPENSSL_cleanse(buf, buf_len); 342. Poly1305_Final(POLY1305_ctx(actx), ctx->encrypt ? actx->tag ^ 343. : tohash); 344. crypto/poly1305/poly1305.c:512:1: <Offset trace> 510. } 511. 512. > void Poly1305_Final(POLY1305 *ctx, unsigned char mac[16]) 513. { 514. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:512:1: Parameter `ctx->num` 510. } 511. 512. > void Poly1305_Final(POLY1305 *ctx, unsigned char mac[16]) 513. { 514. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:520:10: Assignment 518. size_t num; 519. 520. if ((num = ctx->num)) { ^ 521. ctx->data[num++] = 1; /* pad bit */ 522. while (num < POLY1305_BLOCK_SIZE) crypto/poly1305/poly1305.c:512:1: <Length trace> 510. } 511. 512. > void Poly1305_Final(POLY1305 *ctx, unsigned char mac[16]) 513. { 514. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:512:1: Parameter `ctx->data[*]` 510. } 511. 512. > void Poly1305_Final(POLY1305 *ctx, unsigned char mac[16]) 513. { 514. #ifdef POLY1305_ASM crypto/poly1305/poly1305.c:521:9: Array access: Offset: [1, 57] Size: 16 by call to `Poly1305_Final` 519. 520. if ((num = ctx->num)) { 521. ctx->data[num++] = 1; /* pad bit */ ^ 522. while (num < POLY1305_BLOCK_SIZE) 523. ctx->data[num++] = 0;
https://github.com/openssl/openssl/blob/3e0076c213ec2d1149a9a89f9bc141d1a1a44630/crypto/poly1305/poly1305.c/#L521
d2a_code_trace_data_44516
static void JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 skiplength) { if ((uint32)skiplength<=data->bufferbytesleft) { data->buffercurrentbyte+=skiplength; data->bufferbytesleft-=skiplength; } else { uint16 m; m=skiplength-data->bufferbytesleft; if (m<=data->filebytesleft) { data->bufferbytesleft=0; data->fileoffset+=m; data->filebytesleft-=m; data->filepositioned=0; } else { data->bufferbytesleft=0; data->filebytesleft=0; } } } libtiff/tif_jpeg.c:829: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `JPEGFixupTagsSubsamplingSkip`. libtiff/tif_jpeg.c:820:7: Call 818. for (o=1; o<data->tif->tif_dir.td_samplesperpixel; o++) 819. { 820. JPEGFixupTagsSubsamplingSkip(data,1); ^ 821. if (!JPEGFixupTagsSubsamplingReadByte(data,&p)) 822. return(0); libtiff/tif_jpeg.c:912:4: Assignment 910. if (m<=data->filebytesleft) 911. { 912. data->bufferbytesleft=0; ^ 913. data->fileoffset+=m; 914. data->filebytesleft-=m; libtiff/tif_jpeg.c:821:12: Call 819. { 820. JPEGFixupTagsSubsamplingSkip(data,1); 821. if (!JPEGFixupTagsSubsamplingReadByte(data,&p)) ^ 822. return(0); 823. if (p!=0x11) libtiff/tif_jpeg.c:855:1: Parameter `data->bufferbytesleft` 853. } 854. 855. static int ^ 856. JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result) 857. { libtiff/tif_jpeg.c:829:7: Call 827. return(1); 828. } 829. JPEGFixupTagsSubsamplingSkip(data,1); ^ 830. } 831. if (((ph!=1)&&(ph!=2)&&(ph!=4))||((pv!=1)&&(pv!=2)&&(pv!=4))) libtiff/tif_jpeg.c:898:1: <LHS trace> 896. } 897. 898. static void ^ 899. JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 skiplength) 900. { libtiff/tif_jpeg.c:898:1: Parameter `skiplength` 896. } 897. 898. static void ^ 899. JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 skiplength) 900. { libtiff/tif_jpeg.c:898:1: <RHS trace> 896. } 897. 898. static void ^ 899. JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 skiplength) 900. { libtiff/tif_jpeg.c:898:1: Parameter `skiplength` 896. } 897. 898. static void ^ 899. JPEGFixupTagsSubsamplingSkip(struct JPEGFixupTagsSubsamplingData* data, uint16 skiplength) 900. { libtiff/tif_jpeg.c:904:3: Binary operation: ([0, +oo] - 1):unsigned32 by call to `JPEGFixupTagsSubsamplingSkip` 902. { 903. data->buffercurrentbyte+=skiplength; 904. data->bufferbytesleft-=skiplength; ^ 905. } 906. else
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_jpeg.c/#L904
d2a_code_trace_data_44517
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ecp_smpl.c:1401: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_inverse`. Showing all 26 steps of the trace crypto/ec/ecp_smpl.c:1378:1: Parameter `ctx->stack.depth` 1376. * Since we don't have a Mont structure here, SCA hardening is with blinding. 1377. */ 1378. > int ec_GFp_simple_field_inv(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, 1379. BN_CTX *ctx) 1380. { crypto/ec/ecp_smpl.c:1388:5: Call 1386. return 0; 1387. 1388. BN_CTX_start(ctx); ^ 1389. if ((e = BN_CTX_get(ctx)) == NULL) 1390. 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/ec/ecp_smpl.c:1401:10: Call 1399. goto err; 1400. /* r := 1/(a * e) */ 1401. if (!BN_mod_inverse(r, r, group->field, ctx)) { ^ 1402. ECerr(EC_F_EC_GFP_SIMPLE_FIELD_INV, EC_R_CANNOT_INVERT); 1403. goto err; crypto/bn/bn_gcd.c:124:1: Parameter `ctx->stack.depth` 122. BN_CTX *ctx); 123. 124. > BIGNUM *BN_mod_inverse(BIGNUM *in, 125. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 126. { crypto/bn/bn_gcd.c:129:10: Call 127. BIGNUM *rv; 128. int noinv; 129. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv); ^ 130. if (noinv) 131. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); crypto/bn/bn_gcd.c:135:1: Parameter `ctx->stack.depth` 133. } 134. 135. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 136. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 137. int *pnoinv) crypto/bn/bn_gcd.c:155:16: Call 153. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) 154. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) { 155. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 156. } 157. crypto/bn/bn_gcd.c:458:1: Parameter `ctx->stack.depth` 456. * not contain branches that may leak sensitive information. 457. */ 458. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 459. const BIGNUM *a, const BIGNUM *n, 460. BN_CTX *ctx) crypto/bn/bn_gcd.c:469:5: Call 467. bn_check_top(n); 468. 469. BN_CTX_start(ctx); ^ 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c: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_gcd.c:504:18: Call 502. bn_init(&local_B); 503. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME); 504. if (!BN_nnmod(B, &local_B, A, ctx)) ^ 505. goto err; 506. /* Ensure local_B goes out of scope before any further use of B */ crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth` 207. * If 'dv' or 'rm' is NULL, the respective value is not returned. 208. */ 209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 210. BN_CTX *ctx) 211. { crypto/bn/bn_div.c:229:11: Call 227. } 228. 229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx); ^ 230. 231. if (ret) { crypto/bn/bn_div.c:280:5: Call 278. bn_check_top(rm); 279. 280. BN_CTX_start(ctx); ^ 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c: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: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: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_inverse` 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/8f58ede09572dcc6a7e6c01280dd348240199568/crypto/bn/bn_ctx.c/#L276
d2a_code_trace_data_44518
static void sbr_make_f_tablelim(SpectralBandReplication *sbr) { int k; if (sbr->bs_limiter_bands > 0) { static const float bands_warped[3] = { 1.32715174233856803909f, 1.18509277094158210129f, 1.11987160404675912501f }; const float lim_bands_per_octave_warped = bands_warped[sbr->bs_limiter_bands - 1]; int16_t patch_borders[7]; uint16_t *in = sbr->f_tablelim + 1, *out = sbr->f_tablelim; patch_borders[0] = sbr->kx[1]; for (k = 1; k <= sbr->num_patches; k++) patch_borders[k] = patch_borders[k-1] + sbr->patch_num_subbands[k-1]; memcpy(sbr->f_tablelim, sbr->f_tablelow, (sbr->n[0] + 1) * sizeof(sbr->f_tablelow[0])); if (sbr->num_patches > 1) memcpy(sbr->f_tablelim + sbr->n[0] + 1, patch_borders + 1, (sbr->num_patches - 1) * sizeof(patch_borders[0])); qsort(sbr->f_tablelim, sbr->num_patches + sbr->n[0], sizeof(sbr->f_tablelim[0]), qsort_comparison_function_int16); sbr->n_lim = sbr->n[0] + sbr->num_patches - 1; while (out < sbr->f_tablelim + sbr->n_lim) { if (*in >= *out * lim_bands_per_octave_warped) { *++out = *in++; } else if (*in == *out || !in_table_int16(patch_borders, sbr->num_patches, *in)) { in++; sbr->n_lim--; } else if (!in_table_int16(patch_borders, sbr->num_patches, *out)) { *out = *in++; sbr->n_lim--; } else { *++out = *in++; } } } else { sbr->f_tablelim[0] = sbr->f_tablelow[0]; sbr->f_tablelim[1] = sbr->f_tablelow[sbr->n[0]]; sbr->n_lim = 1; } } libavcodec/aac.c:2041: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `decode_extension_payload`. libavcodec/aac.c:2017:19: Call 2015. 2016. case TYPE_DSE: 2017. err = skip_data_stream_element(ac, &gb); ^ 2018. break; 2019. libavcodec/aac.c:600:1: Parameter `*ac->avccontext` 598. * Skip data_stream_element; reference: table 4.10. 599. */ 600. static int skip_data_stream_element(AACContext *ac, GetBitContext *gb) ^ 601. { 602. int byte_align = get_bits1(gb); libavcodec/aac.c:2041:28: Call 2039. } 2040. while (elem_id > 0) 2041. elem_id -= decode_extension_payload(ac, &gb, elem_id, che_prev, elem_type_prev); ^ 2042. err = 0; /* FIXME */ 2043. break; libavcodec/aac.c:1644:1: Parameter `che->sbr.n[*]` 1642. * @return Returns number of bytes consumed 1643. */ 1644. static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt, ^ 1645. ChannelElement *che, enum RawDataBlockType elem_type) 1646. { libavcodec/aac.c:1667:15: Call 1665. ac->m4ac.sbr = 1; 1666. } 1667. res = ff_decode_sbr_extension(ac, &che->sbr, gb, crc_flag, cnt, elem_type); ^ 1668. break; 1669. case EXT_DYNAMIC_RANGE: libavcodec/aacsbr.c:1050:1: Parameter `sbr->n[*]` 1048. * @return Returns number of bytes consumed from the TYPE_FIL element. 1049. */ 1050. int ff_decode_sbr_extension(AACContext *ac, SpectralBandReplication *sbr, ^ 1051. GetBitContext *gb_host, int crc, int cnt, int id_aac) 1052. { libavcodec/aacsbr.c:1076:25: Call 1074. num_sbr_bits++; 1075. if (get_bits1(gb)) // bs_header_flag 1076. num_sbr_bits += read_sbr_header(sbr, gb); ^ 1077. 1078. if (sbr->reset) libavcodec/aacsbr.c:216:1: Parameter `sbr->n[*]` 214. } 215. 216. static unsigned int read_sbr_header(SpectralBandReplication *sbr, GetBitContext *gb) ^ 217. { 218. unsigned int cnt = get_bits_count(gb); libavcodec/aacsbr.c:265:9: Call 263. 264. if (sbr->bs_limiter_bands != old_bs_limiter_bands && !sbr->reset) 265. sbr_make_f_tablelim(sbr); ^ 266. 267. return get_bits_count(gb) - cnt; libavcodec/aacsbr.c:169:1: <LHS trace> 167. 168. /// Limiter Frequency Band Table (14496-3 sp04 p198) 169. static void sbr_make_f_tablelim(SpectralBandReplication *sbr) ^ 170. { 171. int k; libavcodec/aacsbr.c:169:1: Parameter `sbr->n[*]` 167. 168. /// Limiter Frequency Band Table (14496-3 sp04 p198) 169. static void sbr_make_f_tablelim(SpectralBandReplication *sbr) ^ 170. { 171. int k; libavcodec/aacsbr.c:194:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `decode_extension_payload` 192. qsort_comparison_function_int16); 193. 194. sbr->n_lim = sbr->n[0] + sbr->num_patches - 1; ^ 195. while (out < sbr->f_tablelim + sbr->n_lim) { 196. if (*in >= *out * lim_bands_per_octave_warped) {
https://github.com/libav/libav/blob/76561924cf3d9789653dc72d696f119862616891/libavcodec/aacsbr.c/#L194
d2a_code_trace_data_44519
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); } test/dtlstest.c:89: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `SSL_free`. Showing all 17 steps of the trace test/dtlstest.c:64:10: Call 62. 63. /* BIO is freed by create_ssl_connection on error */ 64. if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl1, &clientssl1, ^ 65. NULL, c_to_s_fbio))) 66. goto end; test/ssltestlib.c:580:21: Call 578. 579. if (*sssl == NULL) 580. serverssl = SSL_new(serverctx); ^ 581. else 582. serverssl = *sssl; ssl/ssl_lib.c:521:1: Parameter `ctx->sessions->num_items` 519. } 520. 521. > SSL *SSL_new(SSL_CTX *ctx) 522. { 523. SSL *s; test/dtlstest.c:89:5: Call 87. testresult = 1; 88. end: 89. SSL_free(serverssl1); ^ 90. SSL_free(clientssl1); 91. SSL_CTX_free(sctx); ssl/ssl_lib.c:963:1: Parameter `s->session_ctx->sessions->num_items` 961. } 962. 963. > void SSL_free(SSL *s) 964. { 965. int i; ssl/ssl_lib.c:993:9: Call 991. /* Make the next call work :-) */ 992. if (s->session != NULL) { 993. ssl_clear_bad_session(s); ^ 994. SSL_SESSION_free(s->session); 995. } ssl/ssl_sess.c:1039:1: Parameter `s->session_ctx->sessions->num_items` 1037. } 1038. 1039. > int ssl_clear_bad_session(SSL *s) 1040. { 1041. if ((s->session != NULL) && ssl/ssl_sess.c:1044:9: Call 1042. !(s->shutdown & SSL_SENT_SHUTDOWN) && 1043. !(SSL_in_init(s) || SSL_in_before(s))) { 1044. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 1045. return (1); 1046. } else ssl/ssl_sess.c:725:1: Parameter `ctx->sessions->num_items` 723. } 724. 725. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 726. { 727. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:727:12: Call 725. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 726. { 727. return remove_session_lock(ctx, c, 1); ^ 728. } 729. ssl/ssl_sess.c:730:1: Parameter `ctx->sessions->num_items` 728. } 729. 730. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 731. { 732. SSL_SESSION *r; ssl/ssl_sess.c:740:17: Call 738. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 739. ret = 1; 740. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 741. SSL_SESSION_list_remove(ctx, c); 742. } ssl/ssl_locl.h:689:1: Parameter `lh->num_items` 687. } CLIENTHELLO_MSG; 688. 689. > DEFINE_LHASH_OF(SSL_SESSION); 690. /* Needed in ssl_cert.c */ 691. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:689:1: Call 687. } CLIENTHELLO_MSG; 688. 689. > DEFINE_LHASH_OF(SSL_SESSION); 690. /* Needed in ssl_cert.c */ 691. 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/fe55c4a20f79c77c64a082c5df2c5e8a61317162/crypto/lhash/lhash.c/#L123
d2a_code_trace_data_44520
void TIFFReverseBits(uint8* cp, tmsize_t n) { for (; n > 8; n -= 8) { cp[0] = TIFFBitRevTable[cp[0]]; cp[1] = TIFFBitRevTable[cp[1]]; cp[2] = TIFFBitRevTable[cp[2]]; cp[3] = TIFFBitRevTable[cp[3]]; cp[4] = TIFFBitRevTable[cp[4]]; cp[5] = TIFFBitRevTable[cp[5]]; cp[6] = TIFFBitRevTable[cp[6]]; cp[7] = TIFFBitRevTable[cp[7]]; cp += 8; } while (n-- > 0) *cp = TIFFBitRevTable[*cp], cp++; } tools/tiffcp.c:962: error: Buffer Overrun L3 Offset: [7, +oo] (⇐ [0, +oo] + 7) Size: [0, +oo] by call to `TIFFWriteScanline`. tools/tiffcp.c:947:1: Parameter `out->tif_rawdata` 945. * Separate -> separate by row for rows/strip change. 946. */ 947. DECLAREcpFunc(cpSeparate2SeparateByRow) ^ 948. { 949. tdata_t buf = _TIFFmalloc(TIFFScanlineSize(in)); tools/tiffcp.c:962:8: Call 960. goto bad; 961. } 962. if (TIFFWriteScanline(out, buf, row, s) < 0) { ^ 963. TIFFError(TIFFFileName(out), 964. "Error, can't write scanline %lu", libtiff/tif_write.c:48:1: Parameter `*tif->tif_rawdata` 46. static int TIFFAppendToStrip(TIFF* tif, uint32 strip, uint8* data, tmsize_t cc); 47. 48. int ^ 49. TIFFWriteScanline(TIFF* tif, void* buf, uint32 row, uint16 sample) 50. { libtiff/tif_write.c:107:8: Call 105. * Changing strips -- flush any data present. 106. */ 107. if (!TIFFFlushData(tif)) ^ 108. return (-1); 109. tif->tif_curstrip = strip; libtiff/tif_flush.c:98:1: Parameter `*tif->tif_rawdata` 96. * problems for other people. 97. */ 98. int ^ 99. TIFFFlushData(TIFF* tif) 100. { libtiff/tif_flush.c:108:10: Call 106. return (0); 107. } 108. return (TIFFFlushData1(tif)); ^ 109. } 110. libtiff/tif_write.c:709:1: Parameter `*tif->tif_rawdata` 707. * for infinite recursion. 708. */ 709. int ^ 710. TIFFFlushData1(TIFF* tif) 711. { libtiff/tif_write.c:715:4: Call 713. if (!isFillOrder(tif, tif->tif_dir.td_fillorder) && 714. (tif->tif_flags & TIFF_NOBITREV) == 0) 715. TIFFReverseBits((uint8*)tif->tif_rawdata, ^ 716. tif->tif_rawcc); 717. if (!TIFFAppendToStrip(tif, libtiff/tif_swab.c:285:1: <Length trace> 283. } 284. 285. void ^ 286. TIFFReverseBits(uint8* cp, tmsize_t n) 287. { libtiff/tif_swab.c:285:1: Parameter `*cp` 283. } 284. 285. void ^ 286. TIFFReverseBits(uint8* cp, tmsize_t n) 287. { libtiff/tif_swab.c:296:3: Array access: Offset: [7, +oo] (⇐ [0, +oo] + 7) Size: [0, +oo] by call to `TIFFWriteScanline` 294. cp[5] = TIFFBitRevTable[cp[5]]; 295. cp[6] = TIFFBitRevTable[cp[6]]; 296. cp[7] = TIFFBitRevTable[cp[7]]; ^ 297. cp += 8; 298. }
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_swab.c/#L296
d2a_code_trace_data_44521
int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) { PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | (diff > (0 - (PTRDIFF_T)len))); return overlapped; } crypto/rand/drbg_ctr.c:251: error: INTEGER_OVERFLOW_L2 (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate`. Showing all 9 steps of the trace crypto/rand/drbg_ctr.c:251:10: Call 249. } 250. inc_128(ctr); 251. if (!EVP_CipherUpdate(ctr->ctx, ctr->V, &outlen, ctr->V, AES_BLOCK_SIZE) ^ 252. || outlen != AES_BLOCK_SIZE) 253. return 0; crypto/evp/evp_enc.c:209:1: Parameter `ctx->cipher->block_size` 207. } 208. 209. > int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 210. const unsigned char *in, int inl) 211. { crypto/evp/evp_enc.c:215:16: Call 213. return EVP_EncryptUpdate(ctx, out, outl, in, inl); 214. else 215. return EVP_DecryptUpdate(ctx, out, outl, in, inl); ^ 216. } 217. crypto/evp/evp_enc.c:423:1: Parameter `ctx->cipher->block_size` 421. } 422. 423. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 424. const unsigned char *in, int inl) 425. { crypto/evp/evp_enc.c:429:5: Assignment 427. unsigned int b; 428. 429. b = ctx->cipher->block_size; ^ 430. 431. if (EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS)) crypto/evp/evp_enc.c:462:16: Call 460. /* see comment about PTRDIFF_T comparison above */ 461. if (((PTRDIFF_T)out == (PTRDIFF_T)in) 462. || is_partially_overlapping(out, in, b)) { ^ 463. EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING); 464. return 0; crypto/evp/evp_enc.c:283:1: <RHS trace> 281. #endif 282. 283. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 284. { 285. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:283:1: Parameter `len` 281. #endif 282. 283. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 284. { 285. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:292:50: Binary operation: (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate` 290. */ 291. int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | 292. (diff > (0 - (PTRDIFF_T)len))); ^ 293. 294. return overlapped;
https://github.com/openssl/openssl/blob/e613b1eff40f21cd99240f9884cd3396b0ab50f1/crypto/evp/evp_enc.c/#L292
d2a_code_trace_data_44522
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:1495: error: Integer Overflow L2 ([1, 2147483616] + 32):signed32 by call to `alloc_picture`. libavcodec/mpegvideo_enc.c:1495:17: Call 1493. 1494. pic->reference = s->reordered_input_picture[0]->reference; 1495. if (alloc_picture(s, pic, 0) < 0) { ^ 1496. return -1; 1497. } libavcodec/mpegvideo_enc.c:1035:1: Parameter `pic->f->nb_samples` 1033. } 1034. 1035. static int alloc_picture(MpegEncContext *s, Picture *pic, int shared) ^ 1036. { 1037. return ff_alloc_picture(s->avctx, pic, &s->me, &s->sc, shared, 1, libavcodec/mpegvideo_enc.c:1037:12: Call 1035. static int alloc_picture(MpegEncContext *s, Picture *pic, int shared) 1036. { 1037. return ff_alloc_picture(s->avctx, pic, &s->me, &s->sc, shared, 1, ^ 1038. s->chroma_x_shift, s->chroma_y_shift, s->out_format, 1039. 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:512:1: Parameter `frame->nb_samples` 510. } 511. 512. int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags) ^ 513. { 514. int ret; libavcodec/utils.c:519:16: Call 517. return av_hwframe_get_buffer(avctx->hw_frames_ctx, frame, 0); 518. 519. if ((ret = update_frame_pool(avctx, frame)) < 0) ^ 520. return ret; 521. libavcodec/utils.c:334:1: Parameter `frame->nb_samples` 332. } 333. 334. static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame) ^ 335. { 336. FramePool *pool = avctx->internal->pool; libavcodec/utils.c:402:15: Call 400. 401. av_buffer_pool_uninit(&pool->pools[0]); 402. ret = av_samples_get_buffer_size(&pool->linesize[0], ch, ^ 403. frame->nb_samples, frame->format, 0); 404. 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/11b8030309ee93d79b3a6cd4b83bf00757db1598/libavutil/samplefmt.c/#L124
d2a_code_trace_data_44523
int avfilter_init_str(AVFilterContext *filter, const char *args) { AVDictionary *options = NULL; AVDictionaryEntry *e; int ret = 0; if (args && *args) { if (!filter->filter->priv_class) { av_log(filter, AV_LOG_ERROR, "This filter does not take any " "options, but options were provided: %s.\n", args); return AVERROR(EINVAL); } #if FF_API_OLD_FILTER_OPTS if (!strcmp(filter->filter->name, "scale") && strchr(args, ':') && strchr(args, ':') < strchr(args, '=')) { char *copy = av_strdup(args); char *p; av_log(filter, AV_LOG_WARNING, "The <w>:<h>:flags=<flags> option " "syntax is deprecated. Use either <w>:<h>:<flags> or " "w=<w>:h=<h>:flags=<flags>.\n"); if (!copy) { ret = AVERROR(ENOMEM); goto fail; } p = strrchr(copy, ':'); if (p) { *p++ = 0; ret = av_dict_parse_string(&options, p, "=", ":", 0); } if (ret >= 0) ret = process_unnamed_options(filter, &options, copy); av_freep(&copy); if (ret < 0) goto fail; } else #endif if (strchr(args, '=')) { ret = av_dict_parse_string(&options, args, "=", ":", 0); if (ret < 0) goto fail; #if FF_API_OLD_FILTER_OPTS } else if (!strcmp(filter->filter->name, "format") || !strcmp(filter->filter->name, "noformat") || !strcmp(filter->filter->name, "frei0r") || !strcmp(filter->filter->name, "frei0r_src") || !strcmp(filter->filter->name, "ocv")) { char *copy = av_strdup(args); char *p = copy; int nb_leading = 0; if (!copy) { ret = AVERROR(ENOMEM); goto fail; } if (!strcmp(filter->filter->name, "frei0r") || !strcmp(filter->filter->name, "ocv")) nb_leading = 1; else if (!strcmp(filter->filter->name, "frei0r_src")) nb_leading = 3; while (nb_leading--) { p = strchr(p, ':'); if (!p) { p = copy + strlen(copy); break; } p++; } if (strchr(p, ':')) { av_log(filter, AV_LOG_WARNING, "This syntax is deprecated. Use " "'|' to separate the list items.\n"); } while ((p = strchr(p, ':'))) *p++ = '|'; ret = process_unnamed_options(filter, &options, copy); av_freep(&copy); if (ret < 0) goto fail; #endif } else { ret = process_unnamed_options(filter, &options, args); if (ret < 0) goto fail; } } ret = avfilter_init_dict(filter, &options); if (ret < 0) goto fail; if ((e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX))) { av_log(filter, AV_LOG_ERROR, "No such option: %s.\n", e->key); ret = AVERROR_OPTION_NOT_FOUND; goto fail; } fail: av_dict_free(&options); return ret; } libavfilter/avfilter.c:687: error: Memory Leak memory dynamically allocated by call to `av_strdup()` at line 654, column 26 is not reachable after line 687, column 13. libavfilter/avfilter.c:598:1: start of procedure avfilter_init_str() 596. } 597. 598. int avfilter_init_str(AVFilterContext *filter, const char *args) ^ 599. { 600. AVDictionary *options = NULL; libavfilter/avfilter.c:600:5: 598. int avfilter_init_str(AVFilterContext *filter, const char *args) 599. { 600. AVDictionary *options = NULL; ^ 601. AVDictionaryEntry *e; 602. int ret = 0; libavfilter/avfilter.c:602:5: 600. AVDictionary *options = NULL; 601. AVDictionaryEntry *e; 602. int ret = 0; ^ 603. 604. if (args && *args) { libavfilter/avfilter.c:604:9: Taking true branch 602. int ret = 0; 603. 604. if (args && *args) { ^ 605. if (!filter->filter->priv_class) { 606. av_log(filter, AV_LOG_ERROR, "This filter does not take any " libavfilter/avfilter.c:604:17: Taking true branch 602. int ret = 0; 603. 604. if (args && *args) { ^ 605. if (!filter->filter->priv_class) { 606. av_log(filter, AV_LOG_ERROR, "This filter does not take any " libavfilter/avfilter.c:605:14: Taking false branch 603. 604. if (args && *args) { 605. if (!filter->filter->priv_class) { ^ 606. av_log(filter, AV_LOG_ERROR, "This filter does not take any " 607. "options, but options were provided: %s.\n", args); libavfilter/avfilter.c:612:14: Taking false branch 610. 611. #if FF_API_OLD_FILTER_OPTS 612. if (!strcmp(filter->filter->name, "scale") && ^ 613. strchr(args, ':') && strchr(args, ':') < strchr(args, '=')) { 614. /* old w:h:flags=<flags> syntax */ libavfilter/avfilter.c:641:13: Taking false branch 639. #endif 640. 641. if (strchr(args, '=')) { ^ 642. /* assume a list of key1=value1:key2=value2:... */ 643. ret = av_dict_parse_string(&options, args, "=", ":", 0); libavfilter/avfilter.c:647:21: Taking false branch 645. goto fail; 646. #if FF_API_OLD_FILTER_OPTS 647. } else if (!strcmp(filter->filter->name, "format") || ^ 648. !strcmp(filter->filter->name, "noformat") || 649. !strcmp(filter->filter->name, "frei0r") || libavfilter/avfilter.c:648:21: Taking false branch 646. #if FF_API_OLD_FILTER_OPTS 647. } else if (!strcmp(filter->filter->name, "format") || 648. !strcmp(filter->filter->name, "noformat") || ^ 649. !strcmp(filter->filter->name, "frei0r") || 650. !strcmp(filter->filter->name, "frei0r_src") || libavfilter/avfilter.c:649:21: Taking false branch 647. } else if (!strcmp(filter->filter->name, "format") || 648. !strcmp(filter->filter->name, "noformat") || 649. !strcmp(filter->filter->name, "frei0r") || ^ 650. !strcmp(filter->filter->name, "frei0r_src") || 651. !strcmp(filter->filter->name, "ocv")) { libavfilter/avfilter.c:650:21: Taking false branch 648. !strcmp(filter->filter->name, "noformat") || 649. !strcmp(filter->filter->name, "frei0r") || 650. !strcmp(filter->filter->name, "frei0r_src") || ^ 651. !strcmp(filter->filter->name, "ocv")) { 652. /* a hack for compatibility with the old syntax libavfilter/avfilter.c:651:21: Taking true branch 649. !strcmp(filter->filter->name, "frei0r") || 650. !strcmp(filter->filter->name, "frei0r_src") || 651. !strcmp(filter->filter->name, "ocv")) { ^ 652. /* a hack for compatibility with the old syntax 653. * replace colons with |s */ libavfilter/avfilter.c:654:13: 652. /* a hack for compatibility with the old syntax 653. * replace colons with |s */ 654. char *copy = av_strdup(args); ^ 655. char *p = copy; 656. int nb_leading = 0; // number of leading colons to skip libavutil/mem.c:219:1: start of procedure av_strdup() 217. } 218. 219. char *av_strdup(const char *s) ^ 220. { 221. char *ptr = NULL; libavutil/mem.c:221:5: 219. char *av_strdup(const char *s) 220. { 221. char *ptr = NULL; ^ 222. if (s) { 223. int len = strlen(s) + 1; libavutil/mem.c:222:9: Taking true branch 220. { 221. char *ptr = NULL; 222. if (s) { ^ 223. int len = strlen(s) + 1; 224. ptr = av_realloc(NULL, len); libavutil/mem.c:223:9: 221. char *ptr = NULL; 222. if (s) { 223. int len = strlen(s) + 1; ^ 224. ptr = av_realloc(NULL, len); 225. if (ptr) libavutil/mem.c:224:9: 222. if (s) { 223. int len = strlen(s) + 1; 224. ptr = av_realloc(NULL, len); ^ 225. if (ptr) 226. memcpy(ptr, s, len); libavutil/mem.c:117:1: start of procedure av_realloc() 115. } 116. 117. void *av_realloc(void *ptr, size_t size) ^ 118. { 119. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:124:9: Taking false branch 122. 123. /* let's disallow possibly ambiguous cases */ 124. if (size > (INT_MAX - 16)) ^ 125. return NULL; 126. libavutil/mem.c:136:5: 134. return _aligned_realloc(ptr, size, 32); 135. #else 136. return realloc(ptr, size); ^ 137. #endif 138. } libavutil/mem.c:138:1: return from a call to av_realloc 136. return realloc(ptr, size); 137. #endif 138. } ^ 139. 140. int av_reallocp(void *ptr, size_t size) libavutil/mem.c:225:13: Taking true branch 223. int len = strlen(s) + 1; 224. ptr = av_realloc(NULL, len); 225. if (ptr) ^ 226. memcpy(ptr, s, len); 227. } libavutil/mem.c:226:13: 224. ptr = av_realloc(NULL, len); 225. if (ptr) 226. memcpy(ptr, s, len); ^ 227. } 228. return ptr; libavutil/mem.c:228:5: 226. memcpy(ptr, s, len); 227. } 228. return ptr; ^ 229. } 230. libavutil/mem.c:229:1: return from a call to av_strdup 227. } 228. return ptr; 229. } ^ 230. 231. char *av_strndup(const char *s, size_t len) libavfilter/avfilter.c:655:13: 653. * replace colons with |s */ 654. char *copy = av_strdup(args); 655. char *p = copy; ^ 656. int nb_leading = 0; // number of leading colons to skip 657. libavfilter/avfilter.c:656:13: 654. char *copy = av_strdup(args); 655. char *p = copy; 656. int nb_leading = 0; // number of leading colons to skip ^ 657. 658. if (!copy) { libavfilter/avfilter.c:658:18: Taking false branch 656. int nb_leading = 0; // number of leading colons to skip 657. 658. if (!copy) { ^ 659. ret = AVERROR(ENOMEM); 660. goto fail; libavfilter/avfilter.c:663:18: Taking false branch 661. } 662. 663. if (!strcmp(filter->filter->name, "frei0r") || ^ 664. !strcmp(filter->filter->name, "ocv")) 665. nb_leading = 1; libavfilter/avfilter.c:664:18: Taking false branch 662. 663. if (!strcmp(filter->filter->name, "frei0r") || 664. !strcmp(filter->filter->name, "ocv")) ^ 665. nb_leading = 1; 666. else if (!strcmp(filter->filter->name, "frei0r_src")) libavfilter/avfilter.c:666:23: Taking false branch 664. !strcmp(filter->filter->name, "ocv")) 665. nb_leading = 1; 666. else if (!strcmp(filter->filter->name, "frei0r_src")) ^ 667. nb_leading = 3; 668. libavfilter/avfilter.c:669:20: Loop condition is false. Leaving loop 667. nb_leading = 3; 668. 669. while (nb_leading--) { ^ 670. p = strchr(p, ':'); 671. if (!p) { libavfilter/avfilter.c:678:17: Taking true branch 676. } 677. 678. if (strchr(p, ':')) { ^ 679. av_log(filter, AV_LOG_WARNING, "This syntax is deprecated. Use " 680. "'|' to separate the list items.\n"); libavfilter/avfilter.c:679:17: Skipping av_log(): empty list of specs 677. 678. if (strchr(p, ':')) { 679. av_log(filter, AV_LOG_WARNING, "This syntax is deprecated. Use " ^ 680. "'|' to separate the list items.\n"); 681. } libavfilter/avfilter.c:683:21: Loop condition is false. Leaving loop 681. } 682. 683. while ((p = strchr(p, ':'))) ^ 684. *p++ = '|'; 685. libavfilter/avfilter.c:686:13: Skipping process_unnamed_options(): empty list of specs 684. *p++ = '|'; 685. 686. ret = process_unnamed_options(filter, &options, copy); ^ 687. av_freep(&copy); 688. libavfilter/avfilter.c:687:13: Skipping av_freep(): empty list of specs 685. 686. ret = process_unnamed_options(filter, &options, copy); 687. av_freep(&copy); ^ 688. 689. if (ret < 0)
https://github.com/libav/libav/blob/65e73bc60f98dc7b26c687e145dfb755d3f2ccfa/libavfilter/avfilter.c/#L687
d2a_code_trace_data_44524
ngx_int_t ngx_parse_addr_port(ngx_pool_t *pool, ngx_addr_t *addr, u_char *text, size_t len) { u_char *p, *last; size_t plen; ngx_int_t rc, port; rc = ngx_parse_addr(pool, addr, text, len); if (rc != NGX_DECLINED) { return rc; } last = text + len; #if (NGX_HAVE_INET6) if (len && text[0] == '[') { p = ngx_strlchr(text, last, ']'); if (p == NULL || p == last - 1 || *++p != ':') { return NGX_DECLINED; } text++; len -= 2; } else #endif { p = ngx_strlchr(text, last, ':'); if (p == NULL) { return NGX_DECLINED; } } p++; plen = last - p; port = ngx_atoi(p, plen); if (port < 1 || port > 65535) { return NGX_DECLINED; } len -= plen + 1; rc = ngx_parse_addr(pool, addr, text, len); if (rc != NGX_OK) { return rc; } ngx_inet_set_port(addr->sockaddr, (in_port_t) port); return NGX_OK; } src/http/ngx_http_core_module.c:2694: error: Integer Overflow L2 ([1, +oo] - 2):unsigned64 by call to `ngx_parse_addr_port`. src/http/ngx_http_core_module.c:2665:1: Parameter `xfflen` 2663. 2664. 2665. static ngx_int_t ^ 2666. ngx_http_get_forwarded_addr_internal(ngx_http_request_t *r, ngx_addr_t *addr, 2667. u_char *xff, size_t xfflen, ngx_array_t *proxies, int recursive) src/http/ngx_http_core_module.c:2694:13: Call 2692. } 2693. 2694. if (ngx_parse_addr_port(r->pool, &paddr, p, xfflen - (p - xff)) ^ 2695. != NGX_OK) 2696. { src/core/ngx_inet.c:621:1: <LHS trace> 619. 620. 621. ngx_int_t ^ 622. ngx_parse_addr_port(ngx_pool_t *pool, ngx_addr_t *addr, u_char *text, 623. size_t len) src/core/ngx_inet.c:621:1: Parameter `len` 619. 620. 621. ngx_int_t ^ 622. ngx_parse_addr_port(ngx_pool_t *pool, ngx_addr_t *addr, u_char *text, 623. size_t len) src/core/ngx_inet.c:647:9: Binary operation: ([1, +oo] - 2):unsigned64 by call to `ngx_parse_addr_port` 645. 646. text++; 647. len -= 2; ^ 648. 649. } else
https://github.com/nginx/nginx/blob/f909a7dc331621a8638ea46056e437b8be1496da/src/core/ngx_inet.c/#L647
d2a_code_trace_data_44525
void av_close_input_stream(AVFormatContext *s) { int i; AVStream *st; flush_packet_queue(s); if (s->iformat->read_close) s->iformat->read_close(s); for(i=0;i<s->nb_streams;i++) { st = s->streams[i]; if (st->parser) { av_parser_close(st->parser); av_free_packet(&st->cur_pkt); } av_metadata_free(&st->metadata); av_free(st->index_entries); av_free(st->codec->extradata); av_free(st->codec->subtitle_header); av_free(st->codec); #if FF_API_OLD_METADATA av_free(st->filename); #endif av_free(st->priv_data); av_free(st->info); av_free(st); } for(i=s->nb_programs-1; i>=0; i--) { #if FF_API_OLD_METADATA av_freep(&s->programs[i]->provider_name); av_freep(&s->programs[i]->name); #endif av_metadata_free(&s->programs[i]->metadata); av_freep(&s->programs[i]->stream_index); av_freep(&s->programs[i]); } av_freep(&s->programs); av_freep(&s->priv_data); while(s->nb_chapters--) { #if FF_API_OLD_METADATA av_free(s->chapters[s->nb_chapters]->title); #endif av_metadata_free(&s->chapters[s->nb_chapters]->metadata); av_free(s->chapters[s->nb_chapters]); } av_freep(&s->chapters); av_metadata_free(&s->metadata); av_freep(&s->key); av_free(s); } libavformat/rtsp.c:531: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `av_close_input_stream`. libavformat/rtsp.c:525:17: Unknown value from: non-const function 523. if (rtsp_st) { 524. if (rtsp_st->dynamic_handler && rtsp_st->dynamic_protocol_context) 525. rtsp_st->dynamic_handler->close( ^ 526. rtsp_st->dynamic_protocol_context); 527. } libavformat/rtsp.c:531:9: Call 529. av_free(rt->rtsp_streams); 530. if (rt->asf_ctx) { 531. av_close_input_stream (rt->asf_ctx); ^ 532. rt->asf_ctx = NULL; 533. } libavformat/utils.c:2542:1: <LHS trace> 2540. } 2541. 2542. void av_close_input_stream(AVFormatContext *s) ^ 2543. { 2544. int i; libavformat/utils.c:2542:1: Parameter `s->nb_programs` 2540. } 2541. 2542. void av_close_input_stream(AVFormatContext *s) ^ 2543. { 2544. int i; libavformat/utils.c:2569:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `av_close_input_stream` 2567. av_free(st); 2568. } 2569. for(i=s->nb_programs-1; i>=0; i--) { ^ 2570. #if FF_API_OLD_METADATA 2571. av_freep(&s->programs[i]->provider_name);
https://github.com/libav/libav/blob/a6d1bd05c906fc7ad34fae1029a45ec3cbcc4fcc/libavformat/utils.c/#L2569
d2a_code_trace_data_44526
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } crypto/ec/ecp_smpl.c:1391: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_priv_rand_range`. Showing all 26 steps of the trace crypto/ec/ecp_smpl.c:1391:14: Call 1389. 1390. do { 1391. if (!BN_priv_rand_range(e, group->field)) ^ 1392. goto err; 1393. } while (BN_is_zero(e)); crypto/bn/bn_rand.c:210:12: Call 208. int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range) 209. { 210. return bnrand_range(PRIVATE, r, range, NULL); ^ 211. } 212. crypto/bn/bn_rand.c:127:1: Parameter `r->top` 125. 126. /* random number r: 0 <= r < range */ 127. > static int bnrand_range(BNRAND_FLAG flag, BIGNUM *r, const BIGNUM *range, 128. BN_CTX *ctx) 129. { crypto/ec/ecp_smpl.c:1391:14: Call 1389. 1390. do { 1391. if (!BN_priv_rand_range(e, group->field)) ^ 1392. goto err; 1393. } while (BN_is_zero(e)); crypto/bn/bn_rand.c:208:1: Parameter `r->top` 206. } 207. 208. > int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range) 209. { 210. return bnrand_range(PRIVATE, r, range, NULL); crypto/bn/bn_rand.c:210:12: Call 208. int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range) 209. { 210. return bnrand_range(PRIVATE, r, range, NULL); ^ 211. } 212. crypto/bn/bn_rand.c:127:1: Parameter `r->top` 125. 126. /* random number r: 0 <= r < range */ 127. > static int bnrand_range(BNRAND_FLAG flag, BIGNUM *r, const BIGNUM *range, 128. BN_CTX *ctx) 129. { crypto/bn/bn_rand.c:143:9: Call 141. 142. if (n == 1) 143. BN_zero(r); ^ 144. else if (!BN_is_bit_set(range, n - 2) && !BN_is_bit_set(range, n - 3)) { 145. /* crypto/bn/bn_lib.c:361:1: Parameter `a->top` 359. } 360. 361. > int BN_set_word(BIGNUM *a, BN_ULONG w) 362. { 363. bn_check_top(a); crypto/bn/bn_lib.c:364:9: Call 362. { 363. bn_check_top(a); 364. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 365. return 0; 366. a->neg = 0; crypto/bn/bn_lcl.h:660:1: Parameter `a->top` 658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 659. 660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 661. { 662. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_lcl.h:668:12: Call 666. return a; 667. 668. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2); ^ 669. } 670. crypto/bn/bn_lib.c:245:1: Parameter `b->top` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `words` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:224:13: Call 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/mem.c:228:1: Parameter `num` 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:17: Call 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/mem.c:230:5: Assignment 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:235:5: Assignment 233. if (ret != NULL) 234. memset(ret, 0, num); 235. return ret; ^ 236. } 237. crypto/bn/bn_lib.c:224:9: Assignment 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_priv_rand_range` 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_44527
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:1013: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mul`. Showing all 10 steps of the trace test/bntest.c:1013:17: Call 1011. || !BN_add(ret, a, a) 1012. || !equalBN("A + A", lshift1, ret) 1013. || !BN_mul(ret, a, two, ctx) ^ 1014. || !equalBN("A * 2", lshift1, ret) 1015. || !BN_div(ret, remainder, lshift1, two, ctx) crypto/bn/bn_mul.c:828:1: Parameter `ctx->stack.depth` 826. #endif /* BN_RECURSION */ 827. 828. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 829. { 830. int ret = 0; crypto/bn/bn_mul.c:854:5: Call 852. top = al + bl; 853. 854. BN_CTX_start(ctx); ^ 855. if ((r == a) || (r == b)) { 856. if ((rr = BN_CTX_get(ctx)) == NULL) crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mul.c:979:5: Call 977. err: 978. bn_check_top(r); 979. BN_CTX_end(ctx); ^ 980. return (ret); 981. } crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.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_mul` 271. static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; ^ 274. } 275.
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_44528
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:370: error: Integer Overflow L2 ([1, +oo] - 4):unsigned32 by call to `bitstream_read`. libavcodec/takdec.c:370:16: Call 368. { 369. if (bitstream_read_bit(bc)) 370. return bitstream_read(bc, 4) + 1; ^ 371. else 372. return 0; libavcodec/bitstream.h:183:1: Parameter `n` 181. 182. /* Return n bits from the buffer. n has to be in the 0-32 range. */ 183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n) ^ 184. { 185. if (!n) libavcodec/bitstream.h: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] - 4):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_44529
static int do_multi(int multi, int size_num) { int n; int fd[2]; int *fds; static char sep[] = ":"; fds = malloc(sizeof(*fds) * multi); for (n = 0; n < multi; ++n) { if (pipe(fd) == -1) { BIO_printf(bio_err, "pipe failure\n"); exit(1); } fflush(stdout); (void)BIO_flush(bio_err); if (fork()) { close(fd[1]); fds[n] = fd[0]; } else { close(fd[0]); close(1); if (dup(fd[1]) == -1) { BIO_printf(bio_err, "dup failed\n"); exit(1); } close(fd[1]); mr = 1; usertime = 0; free(fds); return 0; } printf("Forked child %d\n", n); } for (n = 0; n < multi; ++n) { FILE *f; char buf[1024]; char *p; f = fdopen(fds[n], "r"); while (fgets(buf, sizeof(buf), f)) { p = strchr(buf, '\n'); if (p) *p = '\0'; if (buf[0] != '+') { BIO_printf(bio_err, "Don't understand line '%s' from child %d\n", buf, n); continue; } printf("Got: %s from %d\n", buf, n); if (strncmp(buf, "+F:", 3) == 0) { int alg; int j; p = buf + 3; alg = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); for (j = 0; j < size_num; ++j) results[alg][j] += atof(sstrsep(&p, sep)); } else if (strncmp(buf, "+F2:", 4) == 0) { int k; double d; p = buf + 4; k = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); d = atof(sstrsep(&p, sep)); rsa_results[k][0] += d; d = atof(sstrsep(&p, sep)); rsa_results[k][1] += d; } # ifndef OPENSSL_NO_DSA else if (strncmp(buf, "+F3:", 4) == 0) { int k; double d; p = buf + 4; k = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); d = atof(sstrsep(&p, sep)); dsa_results[k][0] += d; d = atof(sstrsep(&p, sep)); dsa_results[k][1] += d; } # endif # ifndef OPENSSL_NO_EC else if (strncmp(buf, "+F4:", 4) == 0) { int k; double d; p = buf + 4; k = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); d = atof(sstrsep(&p, sep)); ecdsa_results[k][0] += d; d = atof(sstrsep(&p, sep)); ecdsa_results[k][1] += d; } else if (strncmp(buf, "+F5:", 4) == 0) { int k; double d; p = buf + 4; k = atoi(sstrsep(&p, sep)); sstrsep(&p, sep); d = atof(sstrsep(&p, sep)); ecdh_results[k][0] += d; } # endif else if (strncmp(buf, "+H:", 3) == 0) { ; } else BIO_printf(bio_err, "Unknown type '%s' from child %d\n", buf, n); } fclose(f); } free(fds); return 1; } apps/speed.c:3134: error: NULL_DEREFERENCE pointer `fds` last assigned on line 3124 could be null and is dereferenced at line 3134, column 13. Showing all 19 steps of the trace apps/speed.c:3117:1: start of procedure do_multi() 3115. } 3116. 3117. > static int do_multi(int multi, int size_num) 3118. { 3119. int n; apps/speed.c:3122:5: 3120. int fd[2]; 3121. int *fds; 3122. > static char sep[] = ":"; 3123. 3124. fds = malloc(sizeof(*fds) * multi); apps/speed.c:3124:5: 3122. static char sep[] = ":"; 3123. 3124. > fds = malloc(sizeof(*fds) * multi); 3125. for (n = 0; n < multi; ++n) { 3126. if (pipe(fd) == -1) { apps/speed.c:3125:10: 3123. 3124. fds = malloc(sizeof(*fds) * multi); 3125. > for (n = 0; n < multi; ++n) { 3126. if (pipe(fd) == -1) { 3127. BIO_printf(bio_err, "pipe failure\n"); apps/speed.c:3125:17: Loop condition is true. Entering loop body 3123. 3124. fds = malloc(sizeof(*fds) * multi); 3125. for (n = 0; n < multi; ++n) { ^ 3126. if (pipe(fd) == -1) { 3127. BIO_printf(bio_err, "pipe failure\n"); apps/speed.c:3126:13: Taking false branch 3124. fds = malloc(sizeof(*fds) * multi); 3125. for (n = 0; n < multi; ++n) { 3126. if (pipe(fd) == -1) { ^ 3127. BIO_printf(bio_err, "pipe failure\n"); 3128. exit(1); apps/speed.c:3130:9: 3128. exit(1); 3129. } 3130. > fflush(stdout); 3131. (void)BIO_flush(bio_err); 3132. if (fork()) { apps/speed.c:3131:15: 3129. } 3130. fflush(stdout); 3131. > (void)BIO_flush(bio_err); 3132. if (fork()) { 3133. close(fd[1]); crypto/bio/bio_lib.c:509:1: start of procedure BIO_ctrl() 507. } 508. 509. > long BIO_ctrl(BIO *b, int cmd, long larg, void *parg) 510. { 511. long ret; crypto/bio/bio_lib.c:513:9: Taking false branch 511. long ret; 512. 513. if (b == NULL) ^ 514. return 0; 515. crypto/bio/bio_lib.c:516:10: Taking false branch 514. return 0; 515. 516. if ((b->method == NULL) || (b->method->ctrl == NULL)) { ^ 517. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); 518. return -2; crypto/bio/bio_lib.c:516:33: Taking true branch 514. return 0; 515. 516. if ((b->method == NULL) || (b->method->ctrl == NULL)) { ^ 517. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); 518. return -2; crypto/bio/bio_lib.c:517:9: Skipping ERR_put_error(): empty list of specs 515. 516. if ((b->method == NULL) || (b->method->ctrl == NULL)) { 517. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); ^ 518. return -2; 519. } crypto/bio/bio_lib.c:518:9: 516. if ((b->method == NULL) || (b->method->ctrl == NULL)) { 517. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); 518. > return -2; 519. } 520. crypto/bio/bio_lib.c:534:1: return from a call to BIO_ctrl 532. 533. return ret; 534. > } 535. 536. long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp) apps/speed.c:3131:9: 3129. } 3130. fflush(stdout); 3131. > (void)BIO_flush(bio_err); 3132. if (fork()) { 3133. close(fd[1]); apps/speed.c:3132:13: Taking true branch 3130. fflush(stdout); 3131. (void)BIO_flush(bio_err); 3132. if (fork()) { ^ 3133. close(fd[1]); 3134. fds[n] = fd[0]; apps/speed.c:3133:13: 3131. (void)BIO_flush(bio_err); 3132. if (fork()) { 3133. > close(fd[1]); 3134. fds[n] = fd[0]; 3135. } else { apps/speed.c:3134:13: 3132. if (fork()) { 3133. close(fd[1]); 3134. > fds[n] = fd[0]; 3135. } else { 3136. close(fd[0]);
https://github.com/openssl/openssl/blob/4bed94f0c11ef63587c6b2edb03c3c438e221604/apps/speed.c/#L3134
d2a_code_trace_data_44530
static void copy_flags(BIO *bio) { int flags; BIO *next = BIO_next(bio); flags = BIO_test_flags(next, BIO_FLAGS_SHOULD_RETRY | BIO_FLAGS_RWS); BIO_clear_flags(bio, BIO_FLAGS_SHOULD_RETRY | BIO_FLAGS_RWS); BIO_set_flags(bio, flags); } test/ssltestlib.c:101: error: NULL_DEREFERENCE pointer `next` last assigned on line 99 could be null and is dereferenced by call to `BIO_test_flags()` at line 101, column 13. Showing all 9 steps of the trace test/ssltestlib.c:96:1: start of procedure copy_flags() 94. } 95. 96. > static void copy_flags(BIO *bio) 97. { 98. int flags; test/ssltestlib.c:99:5: 97. { 98. int flags; 99. > BIO *next = BIO_next(bio); 100. 101. flags = BIO_test_flags(next, BIO_FLAGS_SHOULD_RETRY | BIO_FLAGS_RWS); crypto/bio/bio_lib.c:670:1: start of procedure BIO_next() 668. } 669. 670. > BIO *BIO_next(BIO *b) 671. { 672. if (b == NULL) crypto/bio/bio_lib.c:672:9: Taking true branch 670. BIO *BIO_next(BIO *b) 671. { 672. if (b == NULL) ^ 673. return NULL; 674. return b->next_bio; crypto/bio/bio_lib.c:673:9: 671. { 672. if (b == NULL) 673. > return NULL; 674. return b->next_bio; 675. } crypto/bio/bio_lib.c:675:1: return from a call to BIO_next 673. return NULL; 674. return b->next_bio; 675. > } 676. 677. void BIO_set_next(BIO *b, BIO *next) test/ssltestlib.c:101:5: 99. BIO *next = BIO_next(bio); 100. 101. > flags = BIO_test_flags(next, BIO_FLAGS_SHOULD_RETRY | BIO_FLAGS_RWS); 102. BIO_clear_flags(bio, BIO_FLAGS_SHOULD_RETRY | BIO_FLAGS_RWS); 103. BIO_set_flags(bio, flags); crypto/bio/bio_lib.c:195:1: start of procedure BIO_test_flags() 193. } 194. 195. > int BIO_test_flags(const BIO *b, int flags) 196. { 197. return (b->flags & flags); crypto/bio/bio_lib.c:197:5: 195. int BIO_test_flags(const BIO *b, int flags) 196. { 197. > return (b->flags & flags); 198. } 199.
https://github.com/openssl/openssl/blob/a01b9cd5a76ea45e083dbf2ca002ca44ce3f525f/test/ssltestlib.c/#L101
d2a_code_trace_data_44531
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) { int i, j, max; const BN_ULONG *ap; BN_ULONG *rp; max = n * 2; ap = a; rp = r; rp[0] = rp[max - 1] = 0; rp++; j = n; if (--j > 0) { ap++; rp[j] = bn_mul_words(rp, ap, j, ap[-1]); rp += 2; } for (i = n - 2; i > 0; i--) { j--; ap++; rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]); rp += 2; } bn_add_words(r, r, r, max); bn_sqr_words(tmp, a, n); bn_add_words(r, r, tmp, max); } crypto/rsa/rsa_ossl.c:306: error: BUFFER_OVERRUN_L3 Offset: [31, +oo] Size: [0, 8388607] by call to `rsa_blinding_convert`. Showing all 19 steps of the trace crypto/rsa/rsa_ossl.c:283:9: Call 281. goto err; 282. 283. if (BN_bin2bn(buf, num, f) == NULL) ^ 284. goto err; 285. crypto/bn/bn_lib.c:407:1: Parameter `ret->top` 405. } 406. 407. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) 408. { 409. unsigned int i, m; crypto/rsa/rsa_ossl.c:306:14: Call 304. goto err; 305. } 306. if (!rsa_blinding_convert(blinding, f, unblind, ctx)) ^ 307. goto err; 308. } crypto/rsa/rsa_ossl.c:200:1: Parameter `f->top` 198. } 199. 200. > static int rsa_blinding_convert(BN_BLINDING *b, BIGNUM *f, BIGNUM *unblind, 201. BN_CTX *ctx) 202. { crypto/rsa/rsa_ossl.c:207:16: Call 205. * Local blinding: store the unblinding factor in BN_BLINDING. 206. */ 207. return BN_BLINDING_convert_ex(f, NULL, b, ctx); ^ 208. } else { 209. /* crypto/bn/bn_blind.c:130:1: Parameter `n->top` 128. } 129. 130. > int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx) 131. { 132. int ret = 1; crypto/bn/bn_blind.c:152:10: Call 150. } 151. 152. if (!BN_mod_mul(n, n, b->A, b->mod, ctx)) ^ 153. ret = 0; 154. crypto/bn/bn_mod.c:73:1: Parameter `a->top` 71. 72. /* slow but works */ 73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 74. BN_CTX *ctx) 75. { crypto/bn/bn_mod.c:87:14: Call 85. goto err; 86. if (a == b) { 87. if (!BN_sqr(t, a, ctx)) ^ 88. goto err; 89. } else { crypto/bn/bn_sqr.c:17:1: Parameter `a->top` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int max, al; crypto/bn/bn_sqr.c:25:5: Assignment 23. bn_check_top(a); 24. 25. al = a->top; ^ 26. if (al <= 0) { 27. r->top = 0; crypto/bn/bn_sqr.c:74:17: Call 72. if (bn_wexpand(tmp, max) == NULL) 73. goto err; 74. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 75. } 76. } crypto/bn/bn_sqr.c:105:1: <Offset trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `n` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:111:5: Assignment 109. BN_ULONG *rp; 110. 111. max = n * 2; ^ 112. ap = a; 113. rp = r; crypto/bn/bn_sqr.c:105:1: <Length trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `*r` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:113:5: Assignment 111. max = n * 2; 112. ap = a; 113. rp = r; ^ 114. rp[0] = rp[max - 1] = 0; 115. rp++; crypto/bn/bn_sqr.c:114:13: Array access: Offset: [31, +oo] Size: [0, 8388607] by call to `rsa_blinding_convert` 112. ap = a; 113. rp = r; 114. rp[0] = rp[max - 1] = 0; ^ 115. rp++; 116. j = n;
https://github.com/openssl/openssl/blob/aa048aef0b9146f90c06333dedfc105d1f9e2c22/crypto/bn/bn_sqr.c/#L114
d2a_code_trace_data_44532
static int opt_metadata(const char *opt, const char *arg) { char *mid= strchr(arg, '='); if(!mid){ fprintf(stderr, "Missing =\n"); ffmpeg_exit(1); } *mid++= 0; av_metadata_set2(&metadata, arg, mid, 0); return 0; } ffmpeg.c:2814: error: Null Dereference pointer `mid` last assigned on line 2814 could be null and is dereferenced at line 2814, column 5. ffmpeg.c:2806:1: start of procedure opt_metadata() 2804. } 2805. 2806. static int opt_metadata(const char *opt, const char *arg) ^ 2807. { 2808. char *mid= strchr(arg, '='); ffmpeg.c:2808:5: 2806. static int opt_metadata(const char *opt, const char *arg) 2807. { 2808. char *mid= strchr(arg, '='); ^ 2809. 2810. if(!mid){ ffmpeg.c:2810:9: Taking true branch 2808. char *mid= strchr(arg, '='); 2809. 2810. if(!mid){ ^ 2811. fprintf(stderr, "Missing =\n"); 2812. ffmpeg_exit(1); ffmpeg.c:2811:9: 2809. 2810. if(!mid){ 2811. fprintf(stderr, "Missing =\n"); ^ 2812. ffmpeg_exit(1); 2813. } ffmpeg.c:2812:9: Skipping ffmpeg_exit(): empty list of specs 2810. if(!mid){ 2811. fprintf(stderr, "Missing =\n"); 2812. ffmpeg_exit(1); ^ 2813. } 2814. *mid++= 0; ffmpeg.c:2814:5: 2812. ffmpeg_exit(1); 2813. } 2814. *mid++= 0; ^ 2815. 2816. av_metadata_set2(&metadata, arg, mid, 0);
https://github.com/libav/libav/blob/5da116a3fde9013846bd7b385cdde5ce2951869c/ffmpeg.c/#L2814
d2a_code_trace_data_44533
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_exp2.c:83: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_to_montgomery`. Showing all 32 steps of the trace crypto/bn/bn_exp2.c:16:1: Parameter `ctx->stack.depth` 14. #define TABLE_SIZE 32 15. 16. > int BN_mod_exp2_mont(BIGNUM *rr, const BIGNUM *a1, const BIGNUM *p1, 17. const BIGNUM *a2, const BIGNUM *p2, const BIGNUM *m, 18. BN_CTX *ctx, BN_MONT_CTX *in_mont) crypto/bn/bn_exp2.c:48:5: Call 46. bits = (bits1 > bits2) ? bits1 : bits2; 47. 48. BN_CTX_start(ctx); ^ 49. d = BN_CTX_get(ctx); 50. r = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_exp2.c:49:9: Call 47. 48. BN_CTX_start(ctx); 49. d = BN_CTX_get(ctx); ^ 50. r = BN_CTX_get(ctx); 51. val1[0] = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_exp2.c:50:9: Call 48. BN_CTX_start(ctx); 49. d = BN_CTX_get(ctx); 50. r = BN_CTX_get(ctx); ^ 51. val1[0] = BN_CTX_get(ctx); 52. val2[0] = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_exp2.c:51:15: Call 49. d = BN_CTX_get(ctx); 50. r = BN_CTX_get(ctx); 51. val1[0] = BN_CTX_get(ctx); ^ 52. val2[0] = BN_CTX_get(ctx); 53. if (val2[0] == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_exp2.c:52:15: Call 50. r = BN_CTX_get(ctx); 51. val1[0] = BN_CTX_get(ctx); 52. val2[0] = BN_CTX_get(ctx); ^ 53. if (val2[0] == NULL) 54. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_exp2.c:83:10: Call 81. } 82. 83. if (!BN_to_montgomery(val1[0], a_mod_m, mont, ctx)) ^ 84. goto err; 85. if (window1 > 1) { crypto/bn/bn_lib.c:889:1: Parameter `ctx->stack.depth` 887. } 888. 889. > int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 890. BN_CTX *ctx) 891. { crypto/bn/bn_lib.c:892:12: Call 890. BN_CTX *ctx) 891. { 892. return BN_mod_mul_montgomery(r, a, &(mont->RR), mont, ctx); ^ 893. } 894. crypto/bn/bn_mont.c:26:1: Parameter `ctx->stack.depth` 24. #endif 25. 26. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 27. BN_MONT_CTX *mont, BN_CTX *ctx) 28. { crypto/bn/bn_mont.c:29:15: Call 27. BN_MONT_CTX *mont, BN_CTX *ctx) 28. { 29. int ret = bn_mul_mont_fixed_top(r, a, b, mont, ctx); ^ 30. 31. bn_correct_top(r); 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_montgomery` 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_44534
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:1445: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `s->s3->previous_server_finished_len` + `pkt->written` + 24]):unsigned64 by call to `WPACKET_sub_memcpy__`. Showing all 20 steps of the trace ssl/t1_lib.c:1398:1: Parameter `pkt->written` 1396. } 1397. 1398. > int ssl_add_serverhello_tlsext(SSL *s, WPACKET *pkt, int *al) 1399. { 1400. #ifndef OPENSSL_NO_NEXTPROTONEG ssl/t1_lib.c:1410:10: Call 1408. #endif 1409. 1410. if (!WPACKET_start_sub_packet_u16(pkt) ^ 1411. || !WPACKET_set_flags(pkt, WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH)) { 1412. SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); ssl/packet.c:224:1: Parameter `pkt->written` 222. } 223. 224. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 225. { 226. WPACKET_SUB *sub; ssl/t1_lib.c:1443:14: Call 1441. tls1_get_formatlist(s, &plist, &plistlen); 1442. 1443. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats) ^ 1444. || !WPACKET_start_sub_packet_u16(pkt) 1445. || !WPACKET_sub_memcpy_u8(pkt, plist, plistlen) ssl/packet.c:261:1: Parameter `pkt->written` 259. } 260. 261. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 262. { 263. unsigned char *data; ssl/t1_lib.c:1444:21: Call 1442. 1443. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats) 1444. || !WPACKET_start_sub_packet_u16(pkt) ^ 1445. || !WPACKET_sub_memcpy_u8(pkt, plist, plistlen) 1446. || !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/t1_lib.c:1445:21: Call 1443. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats) 1444. || !WPACKET_start_sub_packet_u16(pkt) 1445. || !WPACKET_sub_memcpy_u8(pkt, plist, plistlen) ^ 1446. || !WPACKET_close(pkt)) { 1447. SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); ssl/packet.c:320:10: Call 318. size_t lenbytes) 319. { 320. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) ^ 321. || !WPACKET_memcpy(pkt, src, len) 322. || !WPACKET_close(pkt)) ssl/packet.c:224:1: Parameter `pkt->buf->length` 222. } 223. 224. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 225. { 226. WPACKET_SUB *sub; ssl/packet.c:321:17: Call 319. { 320. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) 321. || !WPACKET_memcpy(pkt, src, len) ^ 322. || !WPACKET_close(pkt)) 323. return 0; ssl/packet.c:302:1: Parameter `pkt->written` 300. } 301. 302. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) 303. { 304. unsigned char *dest; ssl/packet.c:309:10: Call 307. return 1; 308. 309. if (!WPACKET_allocate_bytes(pkt, len, &dest)) ^ 310. return 0; 311. 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 + s->s3->previous_server_finished_len + pkt->written + 24]):unsigned64 by call to `WPACKET_sub_memcpy__` 44. return 0; 45. 46. if (pkt->buf->length - pkt->written < len) { ^ 47. size_t newlen; 48. size_t reflen;
https://github.com/openssl/openssl/blob/e4e1aa903e624044d3319622fc50222f1b2c7328/ssl/packet.c/#L46
d2a_code_trace_data_44535
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_refs.c:148: error: Buffer Overrun L2 Offset: [0, 63] Size: 32. libavcodec/h264_refs.c:147:18: <Offset trace> 145. 146. if (lens[0] == lens[1] && lens[1] > 1) { 147. for (i = 0; i < lens[0] && ^ 148. h->default_ref_list[0][i].f.buf[0]->buffer == 149. h->default_ref_list[1][i].f.buf[0]->buffer; i++); libavcodec/h264_refs.c:147:18: Assignment 145. 146. if (lens[0] == lens[1] && lens[1] > 1) { 147. for (i = 0; i < lens[0] && ^ 148. h->default_ref_list[0][i].f.buf[0]->buffer == 149. h->default_ref_list[1][i].f.buf[0]->buffer; i++); 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:148:25: Array access: Offset: [0, 63] Size: 32 146. if (lens[0] == lens[1] && lens[1] > 1) { 147. for (i = 0; i < lens[0] && 148. h->default_ref_list[0][i].f.buf[0]->buffer == ^ 149. h->default_ref_list[1][i].f.buf[0]->buffer; i++); 150. if (i == lens[0]) {
https://github.com/libav/libav/blob/0673ede985a6560e7efb86dab1c58fb7f95ce587/libavcodec/h264_refs.c/#L148
d2a_code_trace_data_44536
void nelly_decode_block(NellyMoserDecodeContext *s, const unsigned char block[NELLY_BLOCK_LEN], float audio[NELLY_SAMPLES]) { int i,j; float buf[NELLY_FILL_LEN], pows[NELLY_FILL_LEN]; float *aptr, *bptr, *pptr, val, pval; int bits[NELLY_BUF_LEN]; unsigned char v; init_get_bits(&s->gb, block, NELLY_BLOCK_LEN * 8); bptr = buf; pptr = pows; val = nelly_init_table[get_bits(&s->gb, 6)]; for (i=0 ; i<NELLY_BANDS ; i++) { if (i > 0) val += nelly_delta_table[get_bits(&s->gb, 5)]; pval = pow(2, val/2048); for (j = 0; j < nelly_band_sizes_table[i]; j++) { *bptr++ = val; *pptr++ = pval; } } get_sample_bits(buf, bits); for (i = 0; i < 2; i++) { aptr = audio + i * NELLY_BUF_LEN; init_get_bits(&s->gb, block, NELLY_BLOCK_LEN * 8); skip_bits(&s->gb, NELLY_HEADER_BITS + i*NELLY_DETAIL_BITS); for (j = 0; j < NELLY_FILL_LEN; j++) { if (bits[j] <= 0) { aptr[j] = M_SQRT1_2*pows[j]; if (av_random(&s->random_state) & 1) aptr[j] *= -1.0; } else { v = get_bits(&s->gb, bits[j]); aptr[j] = dequantization_table[(1<<bits[j])-1+v]*pows[j]; } } memset(&aptr[NELLY_FILL_LEN], 0, (NELLY_BUF_LEN - NELLY_FILL_LEN) * sizeof(float)); s->imdct_ctx.fft.imdct_calc(&s->imdct_ctx, s->imdct_out, aptr, s->imdct_tmp); memcpy(&aptr[0],&s->imdct_out[NELLY_BUF_LEN+NELLY_BUF_LEN/2], (NELLY_BUF_LEN/2)*sizeof(float)); memcpy(&aptr[NELLY_BUF_LEN / 2],&s->imdct_out[0],(NELLY_BUF_LEN/2)*sizeof(float)); overlap_and_window(s, s->state, aptr); } } libavcodec/nellymoserdec.c:316: error: Uninitialized Value The value read from pows[_] was never initialized. libavcodec/nellymoserdec.c:316:17: 314. } else { 315. v = get_bits(&s->gb, bits[j]); 316. aptr[j] = dequantization_table[(1<<bits[j])-1+v]*pows[j]; ^ 317. } 318. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/nellymoserdec.c/#L316
d2a_code_trace_data_44537
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *A, *a = NULL; const BN_ULONG *B; int i; bn_check_top(b); if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return (NULL); } if (BN_get_flags(b, BN_FLG_SECURE)) a = A = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = A = OPENSSL_zalloc(words * sizeof(*a)); if (A == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return (NULL); } #if 1 B = b->d; if (B != NULL) { for (i = b->top >> 2; i > 0; i--, A += 4, B += 4) { BN_ULONG a0, a1, a2, a3; a0 = B[0]; a1 = B[1]; a2 = B[2]; a3 = B[3]; A[0] = a0; A[1] = a1; A[2] = a2; A[3] = a3; } switch (b->top & 3) { case 3: A[2] = B[2]; case 2: A[1] = B[1]; case 1: A[0] = B[0]; case 0: ; } } #else memset(A, 0, sizeof(*A) * words); memcpy(A, b->d, sizeof(b->d[0]) * b->top); #endif return (a); } crypto/ec/ec2_mult.c:271: error: BUFFER_OVERRUN_L3 Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, 8388607] by call to `BN_GF2m_add`. Showing all 13 steps of the trace crypto/ec/ec2_mult.c:259:12: Call 257. if (bn_wexpand(x1, group_top) == NULL 258. || bn_wexpand(z1, group_top) == NULL 259. || bn_wexpand(x2, group_top) == NULL ^ 260. || bn_wexpand(z2, group_top) == NULL) 261. goto err; 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/ec/ec2_mult.c:271:10: Call 269. if (!group->meth->field_sqr(group, x2, z2, ctx)) 270. goto err; 271. if (!BN_GF2m_add(x2, x2, group->b)) ^ 272. goto err; /* x2 = x^4 + b */ 273. crypto/bn/bn_gf2m.c:260:1: Parameter `*r->d` 258. * could be equal; r is the bitwise XOR of a and b. 259. */ 260. > int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 261. { 262. int i; crypto/bn/bn_gf2m.c:276:9: Call 274. } 275. 276. if (bn_wexpand(r, at->top) == NULL) ^ 277. return 0; 278. crypto/bn/bn_lib.c:1016:1: Parameter `*a->d` 1014. } 1015. 1016. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 1017. { 1018. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:1018:37: Call 1016. BIGNUM *bn_wexpand(BIGNUM *a, int words) 1017. { 1018. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 1019. } 1020. crypto/bn/bn_lib.c:323:1: Parameter `*b->d` 321. */ 322. 323. > BIGNUM *bn_expand2(BIGNUM *b, int words) 324. { 325. bn_check_top(b); crypto/bn/bn_lib.c:328:23: Call 326. 327. if (words > b->dmax) { 328. BN_ULONG *a = bn_expand_internal(b, words); ^ 329. if (!a) 330. return NULL; crypto/bn/bn_lib.c:246:1: <Length trace> 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *A, *a = NULL; crypto/bn/bn_lib.c:246:1: Parameter `*b->d` 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *A, *a = NULL; crypto/bn/bn_lib.c:272:5: Assignment 270. 271. #if 1 272. B = b->d; ^ 273. /* Check if the previous number needs to be copied */ 274. if (B != NULL) { crypto/bn/bn_lib.c:289:18: Array access: Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, 8388607] by call to `BN_GF2m_add` 287. a1 = B[1]; 288. a2 = B[2]; 289. a3 = B[3]; ^ 290. A[0] = a0; 291. A[1] = a1;
https://github.com/openssl/openssl/blob/d7c42d71ba407a4b3c26ed58263ae225976bbac3/crypto/bn/bn_lib.c/#L289
d2a_code_trace_data_44538
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:1475: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_div`. Showing all 12 steps of the trace test/bntest.c:1453:1: Parameter `ctx->stack.depth` 1451. } 1452. 1453. > int test_gf2m_mod_div(BIO *bp, BN_CTX *ctx) 1454. { 1455. BIGNUM *a, *b[2], *c, *d, *e, *f; test/bntest.c:1475:13: Call 1473. BN_bntest_rand(c, 512, 0, 0); 1474. for (j = 0; j < 2; j++) { 1475. BN_GF2m_mod_div(d, a, c, b[j], ctx); ^ 1476. BN_GF2m_mod_mul(e, d, c, b[j], ctx); 1477. BN_GF2m_mod_div(f, a, e, b[j], ctx); crypto/bn/bn_gf2m.c:770:5: Call 768. bn_check_top(p); 769. 770. BN_CTX_start(ctx); ^ 771. xinv = BN_CTX_get(ctx); 772. if (xinv == NULL) crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gf2m.c:783:5: Call 781. 782. err: 783. BN_CTX_end(ctx); ^ 784. return ret; 785. } crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.indexes` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:271:1: <Offset trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `st->depth` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: <Length trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `*st->indexes` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:273:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_div` 271. static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; ^ 274. } 275.
https://github.com/openssl/openssl/blob/b3618f44a7b8504bfb0a64e8a33e6b8e56d4d516/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_44539
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:1108: error: Null Dereference pointer `*to[i]` last assigned on line 1106 could be null and is dereferenced by call to `memcpy()` at line 1108, column 22. libavcodec/h264.c:1100:1: start of procedure copy_parameter_set() 1098. } 1099. 1100. static void copy_parameter_set(void **to, void **from, int count, int size) ^ 1101. { 1102. int i; libavcodec/h264.c:1104:10: 1102. int i; 1103. 1104. for (i=0; i<count; i++){ ^ 1105. if (to[i] && !from[i]) av_freep(&to[i]); 1106. else if (from[i] && !to[i]) to[i] = av_malloc(size); libavcodec/h264.c:1104:15: Loop condition is true. Entering loop body 1102. int i; 1103. 1104. for (i=0; i<count; i++){ ^ 1105. if (to[i] && !from[i]) av_freep(&to[i]); 1106. else if (from[i] && !to[i]) to[i] = av_malloc(size); libavcodec/h264.c:1105:13: Taking false branch 1103. 1104. for (i=0; i<count; i++){ 1105. if (to[i] && !from[i]) av_freep(&to[i]); ^ 1106. else if (from[i] && !to[i]) to[i] = av_malloc(size); 1107. libavcodec/h264.c:1106:18: Taking true branch 1104. for (i=0; i<count; i++){ 1105. if (to[i] && !from[i]) av_freep(&to[i]); 1106. else if (from[i] && !to[i]) to[i] = av_malloc(size); ^ 1107. 1108. if (from[i]) memcpy(to[i], from[i], size); libavcodec/h264.c:1106:30: Taking true branch 1104. for (i=0; i<count; i++){ 1105. if (to[i] && !from[i]) av_freep(&to[i]); 1106. else if (from[i] && !to[i]) to[i] = av_malloc(size); ^ 1107. 1108. if (from[i]) memcpy(to[i], from[i], size); libavcodec/h264.c:1106:37: 1104. for (i=0; i<count; i++){ 1105. if (to[i] && !from[i]) av_freep(&to[i]); 1106. else if (from[i] && !to[i]) to[i] = av_malloc(size); ^ 1107. 1108. 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:1108:13: Taking true branch 1106. else if (from[i] && !to[i]) to[i] = av_malloc(size); 1107. 1108. if (from[i]) memcpy(to[i], from[i], size); ^ 1109. } 1110. } libavcodec/h264.c:1108:22: 1106. else if (from[i] && !to[i]) to[i] = av_malloc(size); 1107. 1108. if (from[i]) memcpy(to[i], from[i], size); ^ 1109. } 1110. }
https://github.com/libav/libav/blob/d1186ff72d75b6067770890758c4feb92abd84f7/libavcodec/h264.c/#L1108
d2a_code_trace_data_44540
static void init_dequant4_coeff_table(H264Context *h){ int i,j,q,x; const int transpose = (h->s.dsp.h264_idct_add != ff_h264_idct_add_c); for(i=0; i<6; i++ ){ h->dequant4_coeff[i] = h->dequant4_buffer[i]; for(j=0; j<i; j++){ if(!memcmp(h->pps.scaling_matrix4[j], h->pps.scaling_matrix4[i], 16*sizeof(uint8_t))){ h->dequant4_coeff[i] = h->dequant4_buffer[j]; break; } } if(j<i) continue; for(q=0; q<52; q++){ int shift = ff_div6[q] + 2; int idx = ff_rem6[q]; for(x=0; x<16; x++) h->dequant4_coeff[i][q][transpose ? (x>>2)|((x<<2)&0xF) : x] = ((uint32_t)dequant4_coeff_init[idx][(x&1) + ((x>>2)&1)] * h->pps.scaling_matrix4[i][x]) << shift; } } } libavcodec/h264.c:2066: error: Buffer Overrun L2 Offset: [0, 57] (⇐ [0, 6] + [0, 51]) Size: 6. libavcodec/h264.c:2062:13: <Offset trace> 2060. continue; 2061. 2062. for(q=0; q<52; q++){ ^ 2063. int shift = ff_div6[q] + 2; 2064. int idx = ff_rem6[q]; libavcodec/h264.c:2062:13: Assignment 2060. continue; 2061. 2062. for(q=0; q<52; q++){ ^ 2063. int shift = ff_div6[q] + 2; 2064. int idx = ff_rem6[q]; libavcodec/h264.c:2048:1: <Length trace> 2046. } 2047. 2048. static void init_dequant4_coeff_table(H264Context *h){ ^ 2049. int i,j,q,x; 2050. const int transpose = (h->s.dsp.h264_idct_add != ff_h264_idct_add_c); //FIXME ugly libavcodec/h264.c:2048:1: Parameter `*h->dequant4_coeff[*]` 2046. } 2047. 2048. static void init_dequant4_coeff_table(H264Context *h){ ^ 2049. int i,j,q,x; 2050. const int transpose = (h->s.dsp.h264_idct_add != ff_h264_idct_add_c); //FIXME ugly libavcodec/h264.c:2066:17: Array access: Offset: [0, 57] (⇐ [0, 6] + [0, 51]) Size: 6 2064. int idx = ff_rem6[q]; 2065. for(x=0; x<16; x++) 2066. h->dequant4_coeff[i][q][transpose ? (x>>2)|((x<<2)&0xF) : x] = ^ 2067. ((uint32_t)dequant4_coeff_init[idx][(x&1) + ((x>>2)&1)] * 2068. h->pps.scaling_matrix4[i][x]) << shift;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L2066
d2a_code_trace_data_44541
u_char * ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) { u_char *p, zero, *last; int d; float f, scale; size_t len, slen; int64_t i64; uint64_t ui64; ngx_msec_t ms; ngx_uint_t width, sign, hex, max_width, frac_width, i; ngx_str_t *v; ngx_variable_value_t *vv; if (max == 0) { return buf; } last = buf + max; while (*fmt && buf < last) { if (*fmt == '%') { i64 = 0; ui64 = 0; zero = (u_char) ((*++fmt == '0') ? '0' : ' '); width = 0; sign = 1; hex = 0; max_width = 0; frac_width = 0; slen = (size_t) -1; while (*fmt >= '0' && *fmt <= '9') { width = width * 10 + *fmt++ - '0'; } for ( ;; ) { switch (*fmt) { case 'u': sign = 0; fmt++; continue; case 'm': max_width = 1; fmt++; continue; case 'X': hex = 2; sign = 0; fmt++; continue; case 'x': hex = 1; sign = 0; fmt++; continue; case '.': fmt++; while (*fmt >= '0' && *fmt <= '9') { frac_width = frac_width * 10 + *fmt++ - '0'; } break; case '*': slen = va_arg(args, size_t); fmt++; continue; default: break; } break; } switch (*fmt) { case 'V': v = va_arg(args, ngx_str_t *); len = v->len; len = (buf + len < last) ? len : (size_t) (last - buf); buf = ngx_cpymem(buf, v->data, len); fmt++; continue; case 'v': vv = va_arg(args, ngx_variable_value_t *); len = vv->len; len = (buf + len < last) ? len : (size_t) (last - buf); buf = ngx_cpymem(buf, vv->data, len); fmt++; continue; case 's': p = va_arg(args, u_char *); if (slen == (size_t) -1) { while (*p && buf < last) { *buf++ = *p++; } } else { len = (buf + slen < last) ? slen : (size_t) (last - buf); buf = ngx_cpymem(buf, p, len); } fmt++; continue; case 'O': i64 = (int64_t) va_arg(args, off_t); sign = 1; break; case 'P': i64 = (int64_t) va_arg(args, ngx_pid_t); sign = 1; break; case 'T': i64 = (int64_t) va_arg(args, time_t); sign = 1; break; case 'M': ms = (ngx_msec_t) va_arg(args, ngx_msec_t); if ((ngx_msec_int_t) ms == -1) { sign = 1; i64 = -1; } else { sign = 0; ui64 = (uint64_t) ms; } break; case 'z': if (sign) { i64 = (int64_t) va_arg(args, ssize_t); } else { ui64 = (uint64_t) va_arg(args, size_t); } break; case 'i': if (sign) { i64 = (int64_t) va_arg(args, ngx_int_t); } else { ui64 = (uint64_t) va_arg(args, ngx_uint_t); } if (max_width) { width = NGX_INT_T_LEN; } break; case 'd': if (sign) { i64 = (int64_t) va_arg(args, int); } else { ui64 = (uint64_t) va_arg(args, u_int); } break; case 'l': if (sign) { i64 = (int64_t) va_arg(args, long); } else { ui64 = (uint64_t) va_arg(args, u_long); } break; case 'D': if (sign) { i64 = (int64_t) va_arg(args, int32_t); } else { ui64 = (uint64_t) va_arg(args, uint32_t); } break; case 'L': if (sign) { i64 = va_arg(args, int64_t); } else { ui64 = va_arg(args, uint64_t); } break; case 'A': if (sign) { i64 = (int64_t) va_arg(args, ngx_atomic_int_t); } else { ui64 = (uint64_t) va_arg(args, ngx_atomic_uint_t); } if (max_width) { width = NGX_ATOMIC_T_LEN; } break; case 'f': f = (float) va_arg(args, double); if (f < 0) { *buf++ = '-'; f = -f; } ui64 = (int64_t) f; buf = ngx_sprintf_num(buf, last, ui64, zero, 0, width); if (frac_width) { if (buf < last) { *buf++ = '.'; } scale = 1.0; for (i = 0; i < frac_width; i++) { scale *= 10.0; } ui64 = (uint64_t) ((f - (int64_t) ui64) * scale); buf = ngx_sprintf_num(buf, last, ui64, '0', 0, frac_width); } fmt++; continue; #if !(NGX_WIN32) case 'r': i64 = (int64_t) va_arg(args, rlim_t); sign = 1; break; #endif case 'p': ui64 = (uintptr_t) va_arg(args, void *); hex = 2; sign = 0; zero = '0'; width = NGX_PTR_SIZE * 2; break; case 'c': d = va_arg(args, int); *buf++ = (u_char) (d & 0xff); fmt++; continue; case 'Z': *buf++ = '\0'; fmt++; continue; case 'N': #if (NGX_WIN32) *buf++ = CR; #endif *buf++ = LF; fmt++; continue; case '%': *buf++ = '%'; fmt++; continue; default: *buf++ = *fmt++; continue; } if (sign) { if (i64 < 0) { *buf++ = '-'; ui64 = (uint64_t) -i64; } else { ui64 = (uint64_t) i64; } } buf = ngx_sprintf_num(buf, last, ui64, zero, hex, width); fmt++; } else { *buf++ = *fmt++; } } return buf; } src/http/modules/ngx_http_charset_filter_module.c:1566: error: Buffer Overrun L2 Offset: [0, 4048] Size: 2048 by call to `ngx_log_error_core`. src/http/modules/ngx_http_charset_filter_module.c:1566:9: Call 1564. } 1565. 1566. ngx_log_error(NGX_LOG_EMERG, cf->log, 0, ^ 1567. "no \"charset_map\" between the charsets \"%V\" and \"%V\"", 1568. &charset[c].name, &charset[recode[i].dst].name); src/core/ngx_log.c:67:1: Array declaration 65. #if (NGX_HAVE_VARIADIC_MACROS) 66. 67. void ^ 68. ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err, 69. const char *fmt, ...) src/core/ngx_log.c:88:5: Assignment 86. } 87. 88. last = errstr + NGX_MAX_ERROR_STR; ^ 89. 90. ngx_memcpy(errstr, ngx_cached_err_log_time.data, src/core/ngx_log.c:133:13: Call 131. ? " (%d: " : " (%Xd: ", err); 132. #else 133. p = ngx_snprintf(p, last - p, " (%d: ", err); ^ 134. #endif 135. src/core/ngx_string.c:109:1: Parameter `max` 107. 108. 109. u_char * ngx_cdecl ^ 110. ngx_snprintf(u_char *buf, size_t max, const char *fmt, ...) 111. { src/core/ngx_string.c:116:9: Call 114. 115. va_start(args, fmt); 116. p = ngx_vsnprintf(buf, max, fmt, args); ^ 117. va_end(args); 118. src/core/ngx_string.c:123:1: <Length trace> 121. 122. 123. u_char * ^ 124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) 125. { src/core/ngx_string.c:123:1: Parameter `*buf` 121. 122. 123. u_char * ^ 124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) 125. { src/core/ngx_string.c:244:25: Array access: Offset: [0, 4048] Size: 2048 by call to `ngx_log_error_core` 242. if (slen == (size_t) -1) { 243. while (*p && buf < last) { 244. *buf++ = *p++; ^ 245. } 246.
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_string.c/#L244
d2a_code_trace_data_44542
int BN_set_word(BIGNUM *a, BN_ULONG w) { bn_check_top(a); if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) return 0; a->neg = 0; a->d[0] = w; a->top = (w ? 1 : 0); a->flags &= ~BN_FLG_FIXED_TOP; bn_check_top(a); return 1; } test/bntest.c:1941: error: BUFFER_OVERRUN_L3 Offset: 0 Size: [0, 8388607] by call to `BN_rand`. Showing all 14 steps of the trace test/bntest.c:1940:10: Call 1938. 1939. /* Test BN_rand for degenerate cases with |top| and |bottom| parameters. */ 1940. if (!TEST_false(BN_rand(bn, 0, 0 /* top */ , 0 /* bottom */ )) ^ 1941. || !TEST_false(BN_rand(bn, 0, 1 /* top */ , 1 /* bottom */ )) 1942. || !TEST_true(BN_rand(bn, 1, 0 /* top */ , 0 /* bottom */ )) crypto/bn/bn_rand.c:106:1: Parameter `*rnd->d` 104. return bnrand(NORMAL, rnd, bits, top, bottom, ctx); 105. } 106. > int BN_rand(BIGNUM *rnd, int bits, int top, int bottom) 107. { 108. return bnrand(NORMAL, rnd, bits, top, bottom, NULL); 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->d` 21. } BNRAND_FLAG; 22. 23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, 24. BN_CTX *ctx) 25. { test/bntest.c:1941:17: Call 1939. /* Test BN_rand for degenerate cases with |top| and |bottom| parameters. */ 1940. if (!TEST_false(BN_rand(bn, 0, 0 /* top */ , 0 /* bottom */ )) 1941. || !TEST_false(BN_rand(bn, 0, 1 /* top */ , 1 /* bottom */ )) ^ 1942. || !TEST_true(BN_rand(bn, 1, 0 /* top */ , 0 /* bottom */ )) 1943. || !TEST_BN_eq_one(bn) crypto/bn/bn_rand.c:106:1: Parameter `*rnd->d` 104. return bnrand(NORMAL, rnd, bits, top, bottom, ctx); 105. } 106. > int BN_rand(BIGNUM *rnd, int bits, int top, int bottom) 107. { 108. return bnrand(NORMAL, rnd, bits, top, bottom, NULL); 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->d` 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:33:9: Call 31. if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY) 32. goto toosmall; 33. BN_zero(rnd); ^ 34. return 1; 35. } crypto/bn/bn_lib.c:361:1: <Length trace> 359. } 360. 361. > int BN_set_word(BIGNUM *a, BN_ULONG w) 362. { 363. bn_check_top(a); crypto/bn/bn_lib.c:361:1: Parameter `*a->d` 359. } 360. 361. > int BN_set_word(BIGNUM *a, BN_ULONG w) 362. { 363. bn_check_top(a); crypto/bn/bn_lib.c:364:9: Call 362. { 363. bn_check_top(a); 364. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 365. return 0; 366. a->neg = 0; crypto/bn/bn_lcl.h:660:1: Parameter `*a->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_lib.c:367:5: Array access: Offset: 0 Size: [0, 8388607] by call to `BN_rand` 365. return 0; 366. a->neg = 0; 367. a->d[0] = w; ^ 368. a->top = (w ? 1 : 0); 369. a->flags &= ~BN_FLG_FIXED_TOP;
https://github.com/openssl/openssl/blob/bd01733fdd9a5a0acdc72cf5c6601d37e8ddd801/crypto/bn/bn_lib.c/#L367
d2a_code_trace_data_44543
static int var_diamond_search(MpegEncContext * s, int *best, int dmin, int src_index, int ref_index, int const penalty_factor, int size, int h, int flags) { MotionEstContext * const c= &s->me; me_cmp_func cmpf, chroma_cmpf; int dia_size; LOAD_COMMON LOAD_COMMON2 int map_generation= c->map_generation; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; for(dia_size=1; dia_size<=c->dia_size; dia_size++){ int dir, start, end; const int x= best[0]; const int y= best[1]; start= FFMAX(0, y + dia_size - ymax); end = FFMIN(dia_size, xmax - x + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x + dir , y + dia_size - dir); } start= FFMAX(0, x + dia_size - xmax); end = FFMIN(dia_size, y - ymin + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x + dia_size - dir, y - dir ); } start= FFMAX(0, -y + dia_size + ymin ); end = FFMIN(dia_size, x - xmin + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x - dir , y - dia_size + dir); } start= FFMAX(0, -x + dia_size + xmin ); end = FFMIN(dia_size, ymax - y + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x - dia_size + dir, y + dir ); } if(x!=best[0] || y!=best[1]) dia_size=0; #if 0 { int dx, dy, i; static int stats[8*8]; dx= FFABS(x-best[0]); dy= FFABS(y-best[1]); stats[dy*8 + dx] ++; if(256*256*256*64 % (stats[0]+1)==0){ for(i=0; i<64; i++){ if((i&7)==0) printf("\n"); printf("%6d ", stats[i]); } printf("\n"); } } #endif } return dmin; } libavcodec/motion_est_template.c:939: error: Uninitialized Value The value read from xmin was never initialized. libavcodec/motion_est_template.c:939:13: 937. 938. //check(x - dir,y - dia_size + dir,0, a2) 939. CHECK_MV(x - dir , y - dia_size + dir); ^ 940. } 941.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L939
d2a_code_trace_data_44544
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_mont.c:351: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, +oo] by call to `BN_mod_inverse`. Showing all 23 steps of the trace crypto/bn/bn_mont.c:272:15: Call 270. 271. BN_CTX_start(ctx); 272. if ((Ri = BN_CTX_get(ctx)) == NULL) ^ 273. goto err; 274. R = &(mont->RR); /* grab RR as a temp */ crypto/bn/bn_ctx.c: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_mont.c:351:19: Call 349. if (BN_is_one(&tmod)) 350. BN_zero(Ri); 351. else if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL) ^ 352. goto err; 353. if (!BN_lshift(Ri, Ri, BN_BITS2)) crypto/bn/bn_gcd.c:124:1: Parameter `*in->d` 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 `*in->d` 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 `*in->d` 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:606:18: Call 604. /* Y*a == 1 (mod |n|) */ 605. if (!Y->neg && BN_ucmp(Y, n) < 0) { 606. if (!BN_copy(R, Y)) ^ 607. goto err; 608. } else { 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: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_mod_inverse` 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_44545
static int encode_block(SVQ1Context *s, uint8_t *src, uint8_t *ref, uint8_t *decoded, int stride, int level, int threshold, int lambda, int intra){ int count, y, x, i, j, split, best_mean, best_score, best_count; int best_vector[6]; int block_sum[7]= {0, 0, 0, 0, 0, 0}; int w= 2<<((level+2)>>1); int h= 2<<((level+1)>>1); int size=w*h; int16_t block[7][256]; const int8_t *codebook_sum, *codebook; const uint16_t (*mean_vlc)[2]; const uint8_t (*multistage_vlc)[2]; best_score=0; if(intra){ codebook_sum= svq1_intra_codebook_sum[level]; codebook= ff_svq1_intra_codebooks[level]; mean_vlc= ff_svq1_intra_mean_vlc; multistage_vlc= ff_svq1_intra_multistage_vlc[level]; for(y=0; y<h; y++){ for(x=0; x<w; x++){ int v= src[x + y*stride]; block[0][x + w*y]= v; best_score += v*v; block_sum[0] += v; } } }else{ codebook_sum= svq1_inter_codebook_sum[level]; codebook= ff_svq1_inter_codebooks[level]; mean_vlc= ff_svq1_inter_mean_vlc + 256; multistage_vlc= ff_svq1_inter_multistage_vlc[level]; for(y=0; y<h; y++){ for(x=0; x<w; x++){ int v= src[x + y*stride] - ref[x + y*stride]; block[0][x + w*y]= v; best_score += v*v; block_sum[0] += v; } } } best_count=0; best_score -= ((block_sum[0]*block_sum[0])>>(level+3)); best_mean= (block_sum[0] + (size>>1)) >> (level+3); if(level<4){ for(count=1; count<7; count++){ int best_vector_score= INT_MAX; int best_vector_sum=-999, best_vector_mean=-999; const int stage= count-1; const int8_t *vector; for(i=0; i<16; i++){ int sum= codebook_sum[stage*16 + i]; int sqr, diff, score; vector = codebook + stage*size*16 + i*size; sqr = s->dsp.ssd_int8_vs_int16(vector, block[stage], size); diff= block_sum[stage] - sum; score= sqr - ((diff*(int64_t)diff)>>(level+3)); if(score < best_vector_score){ int mean= (diff + (size>>1)) >> (level+3); assert(mean >-300 && mean<300); mean= av_clip(mean, intra?0:-256, 255); best_vector_score= score; best_vector[stage]= i; best_vector_sum= sum; best_vector_mean= mean; } } assert(best_vector_mean != -999); vector= codebook + stage*size*16 + best_vector[stage]*size; for(j=0; j<size; j++){ block[stage+1][j] = block[stage][j] - vector[j]; } block_sum[stage+1]= block_sum[stage] - best_vector_sum; best_vector_score += lambda*(+ 1 + 4*count + multistage_vlc[1+count][1] + mean_vlc[best_vector_mean][1]); if(best_vector_score < best_score){ best_score= best_vector_score; best_count= count; best_mean= best_vector_mean; } } } split=0; if(best_score > threshold && level){ int score=0; int offset= (level&1) ? stride*h/2 : w/2; PutBitContext backup[6]; for(i=level-1; i>=0; i--){ backup[i]= s->reorder_pb[i]; } score += encode_block(s, src , ref , decoded , stride, level-1, threshold>>1, lambda, intra); score += encode_block(s, src + offset, ref + offset, decoded + offset, stride, level-1, threshold>>1, lambda, intra); score += lambda; if(score < best_score){ best_score= score; split=1; }else{ for(i=level-1; i>=0; i--){ s->reorder_pb[i]= backup[i]; } } } if (level > 0) put_bits(&s->reorder_pb[level], 1, split); if(!split){ assert((best_mean >= 0 && best_mean<256) || !intra); assert(best_mean >= -256 && best_mean<256); assert(best_count >=0 && best_count<7); assert(level<4 || best_count==0); put_bits(&s->reorder_pb[level], multistage_vlc[1 + best_count][1], multistage_vlc[1 + best_count][0]); put_bits(&s->reorder_pb[level], mean_vlc[best_mean][1], mean_vlc[best_mean][0]); for (i = 0; i < best_count; i++){ assert(best_vector[i]>=0 && best_vector[i]<16); put_bits(&s->reorder_pb[level], 4, best_vector[i]); } for(y=0; y<h; y++){ for(x=0; x<w; x++){ decoded[x + y*stride]= src[x + y*stride] - block[best_count][x + w*y] + best_mean; } } } return best_score; } libavcodec/svq1enc.c:401: error: Buffer Overrun L1 Offset: 5 Size: 4 by call to `encode_block`. libavcodec/svq1enc.c:401:28: Call 399. score[0]= vlc[1]*lambda; 400. } 401. score[0]+= encode_block(s, src+16*x, NULL, temp, stride, 5, 64, lambda, 1); ^ 402. for(i=0; i<6; i++){ 403. count[0][i]= put_bits_count(&s->reorder_pb[i]); libavcodec/svq1enc.c:124:1: <Offset trace> 122. #endif 123. 124. static int encode_block(SVQ1Context *s, uint8_t *src, uint8_t *ref, uint8_t *decoded, int stride, int level, int threshold, int lambda, int intra){ ^ 125. int count, y, x, i, j, split, best_mean, best_score, best_count; 126. int best_vector[6]; libavcodec/svq1enc.c:124:1: Parameter `level` 122. #endif 123. 124. static int encode_block(SVQ1Context *s, uint8_t *src, uint8_t *ref, uint8_t *decoded, int stride, int level, int threshold, int lambda, int intra){ ^ 125. int count, y, x, i, j, split, best_mean, best_score, best_count; 126. int best_vector[6]; libavcodec/svq1enc_cb.h:64:1: <Length trace> 62. }; 63. 64. static const int8_t svq1_intra_codebook_sum[4][16*6] = { ^ 65. { 66. 0, 0, 0, -1, -1, -1, -1, -2, 0, -1, -1, 0, -1, 0, 1, 0, libavcodec/svq1enc_cb.h:64:1: Array declaration 62. }; 63. 64. static const int8_t svq1_intra_codebook_sum[4][16*6] = { ^ 65. { 66. 0, 0, 0, -1, -1, -1, -1, -2, 0, -1, -1, 0, -1, 0, 1, 0, libavcodec/svq1enc.c:139:9: Array access: Offset: 5 Size: 4 by call to `encode_block` 137. //FIXME optimize, this doenst need to be done multiple times 138. if(intra){ 139. codebook_sum= svq1_intra_codebook_sum[level]; ^ 140. codebook= ff_svq1_intra_codebooks[level]; 141. mean_vlc= ff_svq1_intra_mean_vlc;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/svq1enc.c/#L139
d2a_code_trace_data_44546
static int createCroppedImage(struct image_data *image, struct crop_mask *crop, unsigned char **read_buff_ptr, unsigned char **crop_buff_ptr) { tsize_t cropsize; unsigned char *read_buff = NULL; unsigned char *crop_buff = NULL; unsigned char *new_buff = NULL; static tsize_t prev_cropsize = 0; read_buff = *read_buff_ptr; crop_buff = read_buff; *crop_buff_ptr = read_buff; crop->combined_width = image->width; crop->combined_length = image->length; cropsize = crop->bufftotal; crop_buff = *crop_buff_ptr; if (!crop_buff) { crop_buff = (unsigned char *)limitMalloc(cropsize); *crop_buff_ptr = crop_buff; _TIFFmemset(crop_buff, 0, cropsize); prev_cropsize = cropsize; } else { if (prev_cropsize < cropsize) { new_buff = _TIFFrealloc(crop_buff, cropsize); if (!new_buff) { free (crop_buff); crop_buff = (unsigned char *)limitMalloc(cropsize); } else crop_buff = new_buff; _TIFFmemset(crop_buff, 0, cropsize); } } if (!crop_buff) { TIFFError("createCroppedImage", "Unable to allocate/reallocate crop buffer"); return (-1); } *crop_buff_ptr = crop_buff; if (crop->crop_mode & CROP_INVERT) { switch (crop->photometric) { case PHOTOMETRIC_MINISWHITE: case PHOTOMETRIC_MINISBLACK: image->photometric = crop->photometric; break; case INVERT_DATA_ONLY: case INVERT_DATA_AND_TAG: if (invertImage(image->photometric, image->spp, image->bps, crop->combined_width, crop->combined_length, crop_buff)) { TIFFError("createCroppedImage", "Failed to invert colorspace for image or cropped selection"); return (-1); } if (crop->photometric == INVERT_DATA_AND_TAG) { switch (image->photometric) { case PHOTOMETRIC_MINISWHITE: image->photometric = PHOTOMETRIC_MINISBLACK; break; case PHOTOMETRIC_MINISBLACK: image->photometric = PHOTOMETRIC_MINISWHITE; break; default: break; } } break; default: break; } } if (crop->crop_mode & CROP_MIRROR) { if (mirrorImage(image->spp, image->bps, crop->mirror, crop->combined_width, crop->combined_length, crop_buff)) { TIFFError("createCroppedImage", "Failed to mirror image or cropped selection %s", (crop->rotation == MIRROR_HORIZ) ? "horizontally" : "vertically"); return (-1); } } if (crop->crop_mode & CROP_ROTATE) { if (rotateImage(crop->rotation, image, &crop->combined_width, &crop->combined_length, crop_buff_ptr)) { TIFFError("createCroppedImage", "Failed to rotate image or cropped selection by %d degrees", crop->rotation); return (-1); } } if (crop_buff == read_buff) *read_buff_ptr = NULL; return (0); } tools/tiffcrop.c:7656: error: Null Dereference pointer `crop_buff` last assigned on line 7654 could be null and is dereferenced by call to `_TIFFmemset()` at line 7656, column 5. tools/tiffcrop.c:7632:1: start of procedure createCroppedImage() 7630. * the most optimized path when no Zones or Regions are required. 7631. */ 7632. static int ^ 7633. createCroppedImage(struct image_data *image, struct crop_mask *crop, 7634. unsigned char **read_buff_ptr, unsigned char **crop_buff_ptr) tools/tiffcrop.c:7637:3: 7635. { 7636. tsize_t cropsize; 7637. unsigned char *read_buff = NULL; ^ 7638. unsigned char *crop_buff = NULL; 7639. unsigned char *new_buff = NULL; tools/tiffcrop.c:7638:3: 7636. tsize_t cropsize; 7637. unsigned char *read_buff = NULL; 7638. unsigned char *crop_buff = NULL; ^ 7639. unsigned char *new_buff = NULL; 7640. static tsize_t prev_cropsize = 0; tools/tiffcrop.c:7639:3: 7637. unsigned char *read_buff = NULL; 7638. unsigned char *crop_buff = NULL; 7639. unsigned char *new_buff = NULL; ^ 7640. static tsize_t prev_cropsize = 0; 7641. tools/tiffcrop.c:7640:3: 7638. unsigned char *crop_buff = NULL; 7639. unsigned char *new_buff = NULL; 7640. static tsize_t prev_cropsize = 0; ^ 7641. 7642. read_buff = *read_buff_ptr; tools/tiffcrop.c:7642:3: 7640. static tsize_t prev_cropsize = 0; 7641. 7642. read_buff = *read_buff_ptr; ^ 7643. 7644. /* process full image, no crop buffer needed */ tools/tiffcrop.c:7645:3: 7643. 7644. /* process full image, no crop buffer needed */ 7645. crop_buff = read_buff; ^ 7646. *crop_buff_ptr = read_buff; 7647. crop->combined_width = image->width; tools/tiffcrop.c:7646:3: 7644. /* process full image, no crop buffer needed */ 7645. crop_buff = read_buff; 7646. *crop_buff_ptr = read_buff; ^ 7647. crop->combined_width = image->width; 7648. crop->combined_length = image->length; tools/tiffcrop.c:7647:3: 7645. crop_buff = read_buff; 7646. *crop_buff_ptr = read_buff; 7647. crop->combined_width = image->width; ^ 7648. crop->combined_length = image->length; 7649. tools/tiffcrop.c:7648:3: 7646. *crop_buff_ptr = read_buff; 7647. crop->combined_width = image->width; 7648. crop->combined_length = image->length; ^ 7649. 7650. cropsize = crop->bufftotal; tools/tiffcrop.c:7650:3: 7648. crop->combined_length = image->length; 7649. 7650. cropsize = crop->bufftotal; ^ 7651. crop_buff = *crop_buff_ptr; 7652. if (!crop_buff) tools/tiffcrop.c:7651:3: 7649. 7650. cropsize = crop->bufftotal; 7651. crop_buff = *crop_buff_ptr; ^ 7652. if (!crop_buff) 7653. { tools/tiffcrop.c:7652:8: Taking true branch 7650. cropsize = crop->bufftotal; 7651. crop_buff = *crop_buff_ptr; 7652. if (!crop_buff) ^ 7653. { 7654. crop_buff = (unsigned char *)limitMalloc(cropsize); tools/tiffcrop.c:7654:5: 7652. if (!crop_buff) 7653. { 7654. crop_buff = (unsigned char *)limitMalloc(cropsize); ^ 7655. *crop_buff_ptr = crop_buff; 7656. _TIFFmemset(crop_buff, 0, cropsize); tools/tiffcrop.c:629:1: start of procedure limitMalloc() 627. * This custom malloc function enforce a maximum allocation size 628. */ 629. static void* limitMalloc(tmsize_t s) ^ 630. { 631. if (maxMalloc && (s > maxMalloc)) { tools/tiffcrop.c:631:7: Taking true branch 629. static void* limitMalloc(tmsize_t s) 630. { 631. if (maxMalloc && (s > maxMalloc)) { ^ 632. fprintf(stderr, "MemoryLimitError: allocation of " TIFF_UINT64_FORMAT " bytes is forbidden. Limit is " TIFF_UINT64_FORMAT ".\n", 633. (uint64)s, (uint64)maxMalloc); tools/tiffcrop.c:631:21: Taking true branch 629. static void* limitMalloc(tmsize_t s) 630. { 631. if (maxMalloc && (s > maxMalloc)) { ^ 632. fprintf(stderr, "MemoryLimitError: allocation of " TIFF_UINT64_FORMAT " bytes is forbidden. Limit is " TIFF_UINT64_FORMAT ".\n", 633. (uint64)s, (uint64)maxMalloc); tools/tiffcrop.c:632:5: 630. { 631. if (maxMalloc && (s > maxMalloc)) { 632. fprintf(stderr, "MemoryLimitError: allocation of " TIFF_UINT64_FORMAT " bytes is forbidden. Limit is " TIFF_UINT64_FORMAT ".\n", ^ 633. (uint64)s, (uint64)maxMalloc); 634. fprintf(stderr, " use -k option to change limit.\n"); return NULL; tools/tiffcrop.c:634:5: 632. fprintf(stderr, "MemoryLimitError: allocation of " TIFF_UINT64_FORMAT " bytes is forbidden. Limit is " TIFF_UINT64_FORMAT ".\n", 633. (uint64)s, (uint64)maxMalloc); 634. fprintf(stderr, " use -k option to change limit.\n"); return NULL; ^ 635. } 636. return _TIFFmalloc(s); tools/tiffcrop.c:634:76: 632. fprintf(stderr, "MemoryLimitError: allocation of " TIFF_UINT64_FORMAT " bytes is forbidden. Limit is " TIFF_UINT64_FORMAT ".\n", 633. (uint64)s, (uint64)maxMalloc); 634. fprintf(stderr, " use -k option to change limit.\n"); return NULL; ^ 635. } 636. return _TIFFmalloc(s); tools/tiffcrop.c:637:1: return from a call to limitMalloc 635. } 636. return _TIFFmalloc(s); 637. } ^ 638. 639. tools/tiffcrop.c:7655:5: 7653. { 7654. crop_buff = (unsigned char *)limitMalloc(cropsize); 7655. *crop_buff_ptr = crop_buff; ^ 7656. _TIFFmemset(crop_buff, 0, cropsize); 7657. prev_cropsize = cropsize; tools/tiffcrop.c:7656:5: 7654. crop_buff = (unsigned char *)limitMalloc(cropsize); 7655. *crop_buff_ptr = crop_buff; 7656. _TIFFmemset(crop_buff, 0, cropsize); ^ 7657. prev_cropsize = cropsize; 7658. } libtiff/tif_unix.c:337:1: start of procedure _TIFFmemset() 335. } 336. 337. void ^ 338. _TIFFmemset(void* p, int v, tmsize_t c) 339. { libtiff/tif_unix.c:340:2: 338. _TIFFmemset(void* p, int v, tmsize_t c) 339. { 340. memset(p, v, (size_t) c); ^ 341. } 342. libtiff/tif_unix.c:341:1: return from a call to _TIFFmemset 339. { 340. memset(p, v, (size_t) c); 341. } ^ 342. 343. void
https://gitlab.com/libtiff/libtiff/blob/632f6a1a4f830f69d62fc0314b2109a2d9025963/tools/tiffcrop.c/#L7656
d2a_code_trace_data_44547
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:92: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_generate_dsa_nonce`. Showing all 22 steps of the trace crypto/ec/ecdsa_ossl.c:100:22: Call 98. } 99. } else { 100. if (!BN_priv_rand_range(k, order)) { ^ 101. ECerr(EC_F_ECDSA_SIGN_SETUP, 102. EC_R_RANDOM_NUMBER_GENERATION_FAILED); crypto/bn/bn_rand.c:184:12: Call 182. int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range) 183. { 184. return bnrand_range(PRIVATE, r, range); ^ 185. } 186. crypto/bn/bn_rand.c:113:1: Parameter `range->top` 111. 112. /* random number r: 0 <= r < range */ 113. > static int bnrand_range(BNRAND_FLAG flag, BIGNUM *r, const BIGNUM *range) 114. { 115. int n; crypto/ec/ecdsa_ossl.c:92:22: Call 90. do 91. if (dgst != NULL) { 92. if (!BN_generate_dsa_nonce ^ 93. (k, order, EC_KEY_get0_private_key(eckey), dgst, dlen, 94. ctx)) { crypto/bn/bn_rand.c:205:1: Parameter `range->top` 203. * used. 204. */ 205. > int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range, 206. const BIGNUM *priv, const unsigned char *message, 207. size_t message_len, BN_CTX *ctx) crypto/bn/bn_rand.c:218:34: Call 216. unsigned done, todo; 217. /* We generate |range|+8 bytes of random output. */ 218. const unsigned num_k_bytes = BN_num_bytes(range) + 8; ^ 219. unsigned char private_bytes[96]; 220. unsigned char *k_bytes; crypto/bn/bn_lib.c:139:9: Call 137. bn_check_top(a); 138. 139. if (BN_is_zero(a)) ^ 140. return 0; 141. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); crypto/bn/bn_lib.c:814:1: Parameter `a->top` 812. } 813. 814. > int BN_is_zero(const BIGNUM *a) 815. { 816. return a->top == 0; crypto/bn/bn_rand.c:260:9: Call 258. if (!BN_bin2bn(k_bytes, num_k_bytes, out)) 259. goto err; 260. if (BN_mod(out, out, range, ctx) != 1) ^ 261. goto err; 262. ret = 1; crypto/bn/bn_div.c:199:31: Call 197. 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) 201. goto err; crypto/bn/bn_lib.c:140:9: Assignment 138. 139. if (BN_is_zero(a)) 140. return 0; ^ 141. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); 142. } crypto/bn/bn_div.c:199:5: Assignment 197. 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) 201. goto err; crypto/bn/bn_div.c:200:11: Call 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) ^ 201. goto err; 202. sdiv->neg = 0; crypto/bn/bn_shift.c:83:1: <Offset trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `n` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:5: Assignment 95. } 96. 97. nw = n / BN_BITS2; ^ 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) 99. return 0; crypto/bn/bn_shift.c:83:1: <Length trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `*r->d` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:98:9: Call 96. 97. nw = n / BN_BITS2; 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 99. return 0; 100. r->neg = a->neg; crypto/bn/bn_lib.c:910:1: Parameter `*a->d` 908. } 909. 910. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 911. { 912. 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_generate_dsa_nonce` 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/49cd47eaababc8c57871b929080fc1357e2ad7b8/crypto/bn/bn_shift.c/#L112
d2a_code_trace_data_44548
static inline void packet_forward(PACKET *pkt, size_t len) { pkt->curr += len; pkt->remaining -= len; } ssl/s3_clnt.c:1055: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 2):unsigned64 by call to `PACKET_get_bytes`. Showing all 10 steps of the trace ssl/s3_clnt.c:974:10: Call 972. } 973. 974. if (!PACKET_buf_init(&pkt, s->init_msg, n)) { ^ 975. al = SSL_AD_INTERNAL_ERROR; 976. SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, ERR_R_INTERNAL_ERROR); ssl/packet_locl.h:110:8: Parameter `pkt->remaining` 108. * is being used. 109. */ 110. __owur static inline int PACKET_buf_init(PACKET *pkt, unsigned char *buf, ^ 111. size_t len) 112. { ssl/s3_clnt.c:1055:14: Call 1053. unsigned char *vers; 1054. 1055. if (!PACKET_get_bytes(&pkt, &vers, 2)) { ^ 1056. al = SSL_AD_DECODE_ERROR; 1057. SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_LENGTH_MISMATCH); ssl/packet_locl.h:332:8: Parameter `len` 330. * freed 331. */ 332. __owur static inline int PACKET_get_bytes(PACKET *pkt, unsigned char **data, ^ 333. size_t len) 334. { ssl/packet_locl.h:338:5: Call 336. return 0; 337. 338. packet_forward(pkt, len); ^ 339. 340. return 1; ssl/packet_locl.h:80:1: <LHS trace> 78. 79. /* Internal unchecked shorthand; don't use outside this file. */ 80. > static inline void packet_forward(PACKET *pkt, size_t len) 81. { 82. pkt->curr += len; ssl/packet_locl.h:80:1: Parameter `pkt->remaining` 78. 79. /* Internal unchecked shorthand; don't use outside this file. */ 80. > static inline void packet_forward(PACKET *pkt, size_t len) 81. { 82. pkt->curr += len; ssl/packet_locl.h:80:1: <RHS trace> 78. 79. /* Internal unchecked shorthand; don't use outside this file. */ 80. > static inline void packet_forward(PACKET *pkt, size_t len) 81. { 82. pkt->curr += len; ssl/packet_locl.h:80:1: Parameter `len` 78. 79. /* Internal unchecked shorthand; don't use outside this file. */ 80. > static inline void packet_forward(PACKET *pkt, size_t len) 81. { 82. pkt->curr += len; ssl/packet_locl.h:83:5: Binary operation: ([0, +oo] - 2):unsigned64 by call to `PACKET_get_bytes` 81. { 82. pkt->curr += len; 83. pkt->remaining -= len; ^ 84. } 85.
https://github.com/openssl/openssl/blob/f8e0a5573820bd7318782d4954c6643ff7e58102/ssl/packet_locl.h/#L83
d2a_code_trace_data_44549
static int opt_streamid(OptionsContext *o, const char *opt, const char *arg) { int idx; char *p; char idx_str[16]; av_strlcpy(idx_str, arg, sizeof(idx_str)); p = strchr(idx_str, ':'); if (!p) { av_log(NULL, AV_LOG_FATAL, "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", arg, opt); exit_program(1); } *p++ = '\0'; idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX); o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1); o->streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); return 0; } avconv.c:3534: error: Null Dereference pointer `p` last assigned on line 3534 could be null and is dereferenced at line 3534, column 5. avconv.c:3520:1: start of procedure opt_streamid() 3518. 3519. /* arg format is "output-stream-index:streamid-value". */ 3520. static int opt_streamid(OptionsContext *o, const char *opt, const char *arg) ^ 3521. { 3522. int idx; avconv.c:3526:5: 3524. char idx_str[16]; 3525. 3526. av_strlcpy(idx_str, arg, sizeof(idx_str)); ^ 3527. p = strchr(idx_str, ':'); 3528. if (!p) { libavutil/avstring.c:64:1: start of procedure av_strlcpy() 62. } 63. 64. size_t av_strlcpy(char *dst, const char *src, size_t size) ^ 65. { 66. size_t len = 0; libavutil/avstring.c:66:5: 64. size_t av_strlcpy(char *dst, const char *src, size_t size) 65. { 66. size_t len = 0; ^ 67. while (++len < size && *src) 68. *dst++ = *src++; libavutil/avstring.c:67:12: Loop condition is true. Entering loop body 65. { 66. size_t len = 0; 67. while (++len < size && *src) ^ 68. *dst++ = *src++; 69. if (len <= size) libavutil/avstring.c:67:28: Loop condition is false. Leaving loop 65. { 66. size_t len = 0; 67. while (++len < size && *src) ^ 68. *dst++ = *src++; 69. if (len <= size) libavutil/avstring.c:69:9: Taking true branch 67. while (++len < size && *src) 68. *dst++ = *src++; 69. if (len <= size) ^ 70. *dst = 0; 71. return len + strlen(src) - 1; libavutil/avstring.c:70:9: 68. *dst++ = *src++; 69. if (len <= size) 70. *dst = 0; ^ 71. return len + strlen(src) - 1; 72. } libavutil/avstring.c:71:5: 69. if (len <= size) 70. *dst = 0; 71. return len + strlen(src) - 1; ^ 72. } 73. libavutil/avstring.c:72:1: return from a call to av_strlcpy 70. *dst = 0; 71. return len + strlen(src) - 1; 72. } ^ 73. 74. size_t av_strlcat(char *dst, const char *src, size_t size) avconv.c:3527:5: 3525. 3526. av_strlcpy(idx_str, arg, sizeof(idx_str)); 3527. p = strchr(idx_str, ':'); ^ 3528. if (!p) { 3529. av_log(NULL, AV_LOG_FATAL, avconv.c:3528:10: Taking true branch 3526. av_strlcpy(idx_str, arg, sizeof(idx_str)); 3527. p = strchr(idx_str, ':'); 3528. if (!p) { ^ 3529. av_log(NULL, AV_LOG_FATAL, 3530. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", avconv.c:3529:9: Skipping av_log(): empty list of specs 3527. p = strchr(idx_str, ':'); 3528. if (!p) { 3529. av_log(NULL, AV_LOG_FATAL, ^ 3530. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", 3531. arg, opt); avconv.c:3532:9: Skipping exit_program(): empty list of specs 3530. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", 3531. arg, opt); 3532. exit_program(1); ^ 3533. } 3534. *p++ = '\0'; avconv.c:3534:5: 3532. exit_program(1); 3533. } 3534. *p++ = '\0'; ^ 3535. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX); 3536. o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1);
https://github.com/libav/libav/blob/4bf3c8f226252e18de8051fd0d417c1d39857b67/avconv.c/#L3534
d2a_code_trace_data_44550
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); } test/sslcorrupttest.c:172: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `SSL_free`. Showing all 16 steps of the trace test/sslcorrupttest.c:149:11: Call 147. ctx = SSL_CTX_new(TLS_server_method()); 148. TEST_check(ctx != NULL); 149. ssl = SSL_new(ctx); ^ 150. TEST_check(ssl != NULL); 151. sk_ciphers = SSL_get1_supported_ciphers(ssl); ssl/ssl_lib.c:522:1: Parameter `ctx->sessions->num_items` 520. } 521. 522. > SSL *SSL_new(SSL_CTX *ctx) 523. { 524. SSL *s; test/sslcorrupttest.c:172:5: Call 170. 171. sk_SSL_CIPHER_free(sk_ciphers); 172. SSL_free(ssl); ^ 173. SSL_CTX_free(ctx); 174. ssl/ssl_lib.c:968:1: Parameter `s->session_ctx->sessions->num_items` 966. } 967. 968. > void SSL_free(SSL *s) 969. { 970. int i; ssl/ssl_lib.c:999:9: Call 997. /* Make the next call work :-) */ 998. if (s->session != NULL) { 999. ssl_clear_bad_session(s); ^ 1000. SSL_SESSION_free(s->session); 1001. } ssl/ssl_sess.c:1049:1: Parameter `s->session_ctx->sessions->num_items` 1047. } 1048. 1049. > int ssl_clear_bad_session(SSL *s) 1050. { 1051. if ((s->session != NULL) && ssl/ssl_sess.c:1054:9: Call 1052. !(s->shutdown & SSL_SENT_SHUTDOWN) && 1053. !(SSL_in_init(s) || SSL_in_before(s))) { 1054. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 1055. return (1); 1056. } else ssl/ssl_sess.c:725:1: Parameter `ctx->sessions->num_items` 723. } 724. 725. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 726. { 727. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:727:12: Call 725. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 726. { 727. return remove_session_lock(ctx, c, 1); ^ 728. } 729. ssl/ssl_sess.c:730:1: Parameter `ctx->sessions->num_items` 728. } 729. 730. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 731. { 732. SSL_SESSION *r; ssl/ssl_sess.c:740:17: Call 738. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 739. ret = 1; 740. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 741. SSL_SESSION_list_remove(ctx, c); 742. } ssl/ssl_locl.h:721:1: Parameter `lh->num_items` 719. } TLSEXT_INDEX; 720. 721. > DEFINE_LHASH_OF(SSL_SESSION); 722. /* Needed in ssl_cert.c */ 723. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:721:1: Call 719. } TLSEXT_INDEX; 720. 721. > DEFINE_LHASH_OF(SSL_SESSION); 722. /* Needed in ssl_cert.c */ 723. 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/7f7eb90b8ac55997c5c825bb3ebcfe28611e06f5/crypto/lhash/lhash.c/#L123
d2a_code_trace_data_44551
int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) { PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | (diff > (0 - (PTRDIFF_T)len))); return overlapped; } crypto/cms/cms_pwri.c:205: error: INTEGER_OVERFLOW_L2 (0 - [-oo, 32]):unsigned64 by call to `EVP_DecryptUpdate`. Showing all 7 steps of the trace crypto/cms/cms_pwri.c:205:13: Call 203. tmp + inlen - blocklen, blocklen) 204. /* Can now decrypt first n - 1 blocks */ 205. || !EVP_DecryptUpdate(ctx, tmp, &outl, in, inlen - blocklen) ^ 206. 207. /* Reset IV to original value */ crypto/evp/evp_enc.c:416:1: Parameter `ctx->cipher->block_size` 414. } 415. 416. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 417. const unsigned char *in, int inl) 418. { crypto/evp/evp_enc.c:422:5: Assignment 420. unsigned int b; 421. 422. b = ctx->cipher->block_size; ^ 423. 424. if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) { crypto/evp/evp_enc.c:452:16: Call 450. /* see comment about PTRDIFF_T comparison above */ 451. if (((PTRDIFF_T)out == (PTRDIFF_T)in) 452. || is_partially_overlapping(out, in, b)) { ^ 453. EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING); 454. return 0; crypto/evp/evp_enc.c:279:1: <RHS trace> 277. #endif 278. 279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 280. { 281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:279:1: Parameter `len` 277. #endif 278. 279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 280. { 281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:288:50: Binary operation: (0 - [-oo, 32]):unsigned64 by call to `EVP_DecryptUpdate` 286. */ 287. int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | 288. (diff > (0 - (PTRDIFF_T)len))); ^ 289. 290. return overlapped;
https://github.com/openssl/openssl/blob/b1531d8e6cc95837e38b10d875ae64144c6fdf7a/crypto/evp/evp_enc.c/#L288
d2a_code_trace_data_44552
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ecdsa_ossl.c:281: 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:281:14: Call 279. goto err; 280. } 281. if (!BN_mod_mul(s, s, ckinv, order, ctx)) { ^ 282. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB); 283. 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_44553
int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) { PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | (diff > (0 - (PTRDIFF_T)len))); assert(!overlapped); return overlapped; } crypto/cms/cms_kari.c:211: error: INTEGER_OVERFLOW_L2 (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate`. Showing all 9 steps of the trace crypto/cms/cms_kari.c:211:10: Call 209. if (out == NULL) 210. goto err; 211. if (!EVP_CipherUpdate(kari->ctx, out, &outlen, in, inlen)) ^ 212. goto err; 213. *pout = out; crypto/evp/evp_enc.c:205:1: Parameter `ctx->cipher->block_size` 203. } 204. 205. > int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 206. const unsigned char *in, int inl) 207. { crypto/evp/evp_enc.c:211:16: Call 209. return EVP_EncryptUpdate(ctx, out, outl, in, inl); 210. else 211. return EVP_DecryptUpdate(ctx, out, outl, in, inl); ^ 212. } 213. crypto/evp/evp_enc.c:416:1: Parameter `ctx->cipher->block_size` 414. } 415. 416. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 417. const unsigned char *in, int inl) 418. { crypto/evp/evp_enc.c:422:5: Assignment 420. unsigned int b; 421. 422. b = ctx->cipher->block_size; ^ 423. 424. if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) { crypto/evp/evp_enc.c:452:16: Call 450. /* see comment about PTRDIFF_T comparison above */ 451. if (((PTRDIFF_T)out == (PTRDIFF_T)in) 452. || is_partially_overlapping(out, in, b)) { ^ 453. EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING); 454. return 0; crypto/evp/evp_enc.c:279:1: <RHS trace> 277. #endif 278. 279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 280. { 281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:279:1: Parameter `len` 277. #endif 278. 279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 280. { 281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:288:50: Binary operation: (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate` 286. */ 287. int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | 288. (diff > (0 - (PTRDIFF_T)len))); ^ 289. assert(!overlapped); 290. return overlapped;
https://github.com/openssl/openssl/blob/7141ba31969d0b378d08104a51f8f99b9187b9d5/crypto/evp/evp_enc.c/#L288