id
stringlengths
25
25
content
stringlengths
649
72.1k
max_stars_repo_path
stringlengths
91
133
d2a_code_trace_data_43454
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:763: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_inv`. Showing all 29 steps of the trace test/bntest.c:763:13: Call 761. BN_bntest_rand(a, 512, 0, 0); 762. for (j = 0; j < 2; j++) { 763. BN_GF2m_mod_inv(c, a, b[j], ctx); ^ 764. BN_GF2m_mod_mul(d, a, c, b[j], ctx); 765. /* Test that ((1/a)*a) = 1. */ crypto/bn/bn_gf2m.c:724:1: Parameter `ctx->stack.depth` 722. * But it does eliminate first order deduction on the input. 723. */ 724. > int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) 725. { 726. BIGNUM *b = NULL; crypto/bn/bn_gf2m.c:729:5: Call 727. int ret = 0; 728. 729. BN_CTX_start(ctx); ^ 730. if ((b = BN_CTX_get(ctx)) == NULL) 731. goto err; crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gf2m.c:730:14: Call 728. 729. BN_CTX_start(ctx); 730. if ((b = BN_CTX_get(ctx)) == NULL) ^ 731. goto err; 732. 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_gf2m.c:755:5: Call 753. 754. err: 755. BN_CTX_end(ctx); ^ 756. return ret; 757. } crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); test/bntest.c:764:13: Call 762. for (j = 0; j < 2; j++) { 763. BN_GF2m_mod_inv(c, a, b[j], ctx); 764. BN_GF2m_mod_mul(d, a, c, b[j], ctx); ^ 765. /* Test that ((1/a)*a) = 1. */ 766. if (!TEST_BN_eq_one(d)) crypto/bn/bn_gf2m.c:465:1: Parameter `ctx->stack.depth` 463. * BN_GF2m_mod_mul_arr function. 464. */ 465. > int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 466. const BIGNUM *p, BN_CTX *ctx) 467. { test/bntest.c:763:13: Call 761. BN_bntest_rand(a, 512, 0, 0); 762. for (j = 0; j < 2; j++) { 763. BN_GF2m_mod_inv(c, a, b[j], ctx); ^ 764. BN_GF2m_mod_mul(d, a, c, b[j], ctx); 765. /* Test that ((1/a)*a) = 1. */ crypto/bn/bn_gf2m.c:724:1: Parameter `ctx->stack.depth` 722. * But it does eliminate first order deduction on the input. 723. */ 724. > int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) 725. { 726. BIGNUM *b = NULL; crypto/bn/bn_gf2m.c:729:5: Call 727. int ret = 0; 728. 729. BN_CTX_start(ctx); ^ 730. if ((b = BN_CTX_get(ctx)) == NULL) 731. goto err; crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gf2m.c:730:14: Call 728. 729. BN_CTX_start(ctx); 730. if ((b = BN_CTX_get(ctx)) == NULL) ^ 731. goto err; 732. 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_gf2m.c:741:10: Call 739. 740. /* r := a * b */ 741. if (!BN_GF2m_mod_mul(r, a, b, p, ctx)) ^ 742. goto err; 743. crypto/bn/bn_gf2m.c:465:1: Parameter `ctx->stack.depth` 463. * BN_GF2m_mod_mul_arr function. 464. */ 465. > int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 466. const BIGNUM *p, BN_CTX *ctx) 467. { crypto/bn/bn_gf2m.c:481:11: Call 479. goto err; 480. } 481. ret = BN_GF2m_mod_mul_arr(r, a, b, arr, ctx); ^ 482. bn_check_top(r); 483. err: crypto/bn/bn_gf2m.c:424:5: Call 422. } 423. 424. BN_CTX_start(ctx); ^ 425. if ((s = BN_CTX_get(ctx)) == NULL) 426. goto err; 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_gf2m.c:454:5: Call 452. 453. err: 454. BN_CTX_end(ctx); ^ 455. return ret; 456. } 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_GF2m_mod_inv` 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_43455
static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap) { RTSPState *rt = s->priv_data; RTSPStream *rtsp_st; int size, i, err; char *content; char url[1024]; if (!ff_network_init()) return AVERROR(EIO); content = av_malloc(SDP_MAX_SIZE); size = avio_read(s->pb, content, SDP_MAX_SIZE - 1); if (size <= 0) { av_free(content); return AVERROR_INVALIDDATA; } content[size] ='\0'; err = ff_sdp_parse(s, content); av_free(content); if (err) goto fail; for (i = 0; i < rt->nb_rtsp_streams; i++) { char namebuf[50]; rtsp_st = rt->rtsp_streams[i]; getnameinfo((struct sockaddr*) &rtsp_st->sdp_ip, sizeof(rtsp_st->sdp_ip), namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST); ff_url_join(url, sizeof(url), "rtp", NULL, namebuf, rtsp_st->sdp_port, "?localport=%d&ttl=%d&connect=%d", rtsp_st->sdp_port, rtsp_st->sdp_ttl, rt->rtsp_flags & RTSP_FLAG_FILTER_SRC ? 1 : 0); if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE) < 0) { err = AVERROR_INVALIDDATA; goto fail; } if ((err = rtsp_open_transport_ctx(s, rtsp_st))) goto fail; } return 0; fail: ff_rtsp_close_streams(s); ff_network_close(); return err; } libavformat/rtsp.c:1847: error: Null Dereference pointer `content` last assigned on line 1841 could be null and is dereferenced at line 1847, column 5. libavformat/rtsp.c:1828:1: start of procedure sdp_read_header() 1826. } 1827. 1828. static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap) ^ 1829. { 1830. RTSPState *rt = s->priv_data; libavformat/rtsp.c:1830:5: 1828. static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap) 1829. { 1830. RTSPState *rt = s->priv_data; ^ 1831. RTSPStream *rtsp_st; 1832. int size, i, err; libavformat/rtsp.c:1836:10: 1834. char url[1024]; 1835. 1836. if (!ff_network_init()) ^ 1837. return AVERROR(EIO); 1838. libavformat/network.c:124:1: start of procedure ff_network_init() 122. int ff_network_inited_globally; 123. 124. int ff_network_init(void) ^ 125. { 126. if (!ff_network_inited_globally) libavformat/network.c:126:10: Taking true branch 124. int ff_network_init(void) 125. { 126. if (!ff_network_inited_globally) ^ 127. av_log(NULL, AV_LOG_WARNING, "Using network protocols without global " 128. "network initialization. Please use " libavformat/network.c:127:9: Skipping av_log(): empty list of specs 125. { 126. if (!ff_network_inited_globally) 127. av_log(NULL, AV_LOG_WARNING, "Using network protocols without global " ^ 128. "network initialization. Please use " 129. "avformat_network_init(), this will " libavformat/network.c:136:5: 134. return 0; 135. #endif 136. return 1; ^ 137. } 138. libavformat/network.c:137:1: return from a call to ff_network_init 135. #endif 136. return 1; 137. } ^ 138. 139. int ff_network_wait_fd(int fd, int write) libavformat/rtsp.c:1836:10: Taking false branch 1834. char url[1024]; 1835. 1836. if (!ff_network_init()) ^ 1837. return AVERROR(EIO); 1838. libavformat/rtsp.c:1841:5: 1839. /* read the whole sdp file */ 1840. /* XXX: better loading */ 1841. content = av_malloc(SDP_MAX_SIZE); ^ 1842. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1); 1843. if (size <= 0) { libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) ^ 73. return NULL; 74. libavutil/mem.c:83:9: Taking true branch 81. ((char*)ptr)[-1]= diff; 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,32,size)) ^ 84. ptr = NULL; 85. #elif HAVE_MEMALIGN libavutil/mem.c:84:9: 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,32,size)) 84. ptr = NULL; ^ 85. #elif HAVE_MEMALIGN 86. ptr = memalign(32,size); libavutil/mem.c:114:5: 112. ptr = malloc(size); 113. #endif 114. return ptr; ^ 115. } 116. libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavformat/rtsp.c:1842:5: Skipping avio_read(): empty list of specs 1840. /* XXX: better loading */ 1841. content = av_malloc(SDP_MAX_SIZE); 1842. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1); ^ 1843. if (size <= 0) { 1844. av_free(content); libavformat/rtsp.c:1843:9: Taking false branch 1841. content = av_malloc(SDP_MAX_SIZE); 1842. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1); 1843. if (size <= 0) { ^ 1844. av_free(content); 1845. return AVERROR_INVALIDDATA; libavformat/rtsp.c:1847:5: 1845. return AVERROR_INVALIDDATA; 1846. } 1847. content[size] ='\0'; ^ 1848. 1849. err = ff_sdp_parse(s, content);
https://github.com/libav/libav/blob/090aaaf75280ed42a5e5c7424c366d5b6bab8dde/libavformat/rtsp.c/#L1847
d2a_code_trace_data_43456
void ssl3_cbc_copy_mac(unsigned char *out, const SSL3_RECORD *rec, size_t md_size) { #if defined(CBC_MAC_ROTATE_IN_PLACE) unsigned char rotated_mac_buf[64 + EVP_MAX_MD_SIZE]; unsigned char *rotated_mac; #else unsigned char rotated_mac[EVP_MAX_MD_SIZE]; #endif size_t mac_end = rec->length; size_t mac_start = mac_end - md_size; size_t in_mac; size_t scan_start = 0; size_t i, j; size_t rotate_offset; OPENSSL_assert(rec->orig_len >= md_size); OPENSSL_assert(md_size <= EVP_MAX_MD_SIZE); #if defined(CBC_MAC_ROTATE_IN_PLACE) rotated_mac = rotated_mac_buf + ((0 - (size_t)rotated_mac_buf) & 63); #endif if (rec->orig_len > md_size + 255 + 1) scan_start = rec->orig_len - (md_size + 255 + 1); in_mac = 0; rotate_offset = 0; memset(rotated_mac, 0, md_size); for (i = scan_start, j = 0; i < rec->orig_len; i++) { size_t mac_started = constant_time_eq_s(i, mac_start); size_t mac_ended = constant_time_lt_s(i, mac_end); unsigned char b = rec->data[i]; in_mac |= mac_started; in_mac &= mac_ended; rotate_offset |= j & mac_started; rotated_mac[j++] |= b & in_mac; j &= constant_time_lt_s(j, md_size); } #if defined(CBC_MAC_ROTATE_IN_PLACE) j = 0; for (i = 0; i < md_size; i++) { ((volatile unsigned char *)rotated_mac)[rotate_offset ^ 32]; out[j++] = rotated_mac[rotate_offset++]; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); } #else memset(out, 0, md_size); rotate_offset = md_size - rotate_offset; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); for (i = 0; i < md_size; i++) { for (j = 0; j < md_size; j++) out[j] |= rotated_mac[i] & constant_time_eq_8_s(j, rotate_offset); rotate_offset++; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); } #endif } ssl/record/ssl3_record.c:545: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, 64]):unsigned64 by call to `ssl3_cbc_copy_mac`. Showing all 9 steps of the trace ssl/record/ssl3_record.c:257:29: Call 255. if (!PACKET_get_1(&pkt, &type) 256. || !PACKET_get_net_2(&pkt, &version) 257. || !PACKET_get_net_2_len(&pkt, &thisrr->length)) { ^ 258. al = SSL_AD_DECODE_ERROR; 259. SSLerr(SSL_F_SSL3_GET_RECORD, ERR_R_INTERNAL_ERROR); ssl/packet_locl.h:164:8: Parameter `*data` 162. 163. /* Same as PACKET_get_net_2() but for a size_t */ 164. __owur static ossl_inline int PACKET_get_net_2_len(PACKET *pkt, size_t *data) ^ 165. { 166. unsigned int i; ssl/record/ssl3_record.c:545:17: Call 543. */ 544. mac = mac_tmp; 545. ssl3_cbc_copy_mac(mac_tmp, thisrr, mac_size); ^ 546. thisrr->length -= mac_size; 547. } else { ssl/record/ssl3_record.c:1407:1: <LHS trace> 1405. #define CBC_MAC_ROTATE_IN_PLACE 1406. 1407. > void ssl3_cbc_copy_mac(unsigned char *out, 1408. const SSL3_RECORD *rec, size_t md_size) 1409. { ssl/record/ssl3_record.c:1407:1: Parameter `rec->length` 1405. #define CBC_MAC_ROTATE_IN_PLACE 1406. 1407. > void ssl3_cbc_copy_mac(unsigned char *out, 1408. const SSL3_RECORD *rec, size_t md_size) 1409. { ssl/record/ssl3_record.c:1420:5: Assignment 1418. * mac_end is the index of |rec->data| just after the end of the MAC. 1419. */ 1420. size_t mac_end = rec->length; ^ 1421. size_t mac_start = mac_end - md_size; 1422. size_t in_mac; ssl/record/ssl3_record.c:1407:1: <RHS trace> 1405. #define CBC_MAC_ROTATE_IN_PLACE 1406. 1407. > void ssl3_cbc_copy_mac(unsigned char *out, 1408. const SSL3_RECORD *rec, size_t md_size) 1409. { ssl/record/ssl3_record.c:1407:1: Parameter `md_size` 1405. #define CBC_MAC_ROTATE_IN_PLACE 1406. 1407. > void ssl3_cbc_copy_mac(unsigned char *out, 1408. const SSL3_RECORD *rec, size_t md_size) 1409. { ssl/record/ssl3_record.c:1421:5: Binary operation: ([0, +oo] - [0, 64]):unsigned64 by call to `ssl3_cbc_copy_mac` 1419. */ 1420. size_t mac_end = rec->length; 1421. size_t mac_start = mac_end - md_size; ^ 1422. size_t in_mac; 1423. /*
https://github.com/openssl/openssl/blob/ffbaf06ade6dab6a0805a24087cf2e84c5db8d43/ssl/record/ssl3_record.c/#L1421
d2a_code_trace_data_43457
AP_DECLARE(apr_status_t) ap_rgetline_core(char **s, apr_size_t n, apr_size_t *read, request_rec *r, int fold, apr_bucket_brigade *bb) { apr_status_t rv; apr_bucket *e; apr_size_t bytes_handled = 0, current_alloc = 0; char *pos, *last_char = *s; int do_alloc = (*s == NULL), saw_eos = 0; if (last_char) *last_char = '\0'; for (;;) { apr_brigade_cleanup(bb); rv = ap_get_brigade(r->proto_input_filters, bb, AP_MODE_GETLINE, APR_BLOCK_READ, 0); if (rv != APR_SUCCESS) { return rv; } if (APR_BRIGADE_EMPTY(bb)) { return APR_EGENERAL; } for (e = APR_BRIGADE_FIRST(bb); e != APR_BRIGADE_SENTINEL(bb); e = APR_BUCKET_NEXT(e)) { const char *str; apr_size_t len; if (APR_BUCKET_IS_EOS(e)) { saw_eos = 1; break; } rv = apr_bucket_read(e, &str, &len, APR_BLOCK_READ); if (rv != APR_SUCCESS) { return rv; } if (len == 0) { continue; } if (n < bytes_handled + len) { *read = bytes_handled; if (*s) { if (bytes_handled > 0) { (*s)[bytes_handled-1] = '\0'; } else { (*s)[0] = '\0'; } } return APR_ENOSPC; } if (do_alloc) { if (!*s) { current_alloc = len; *s = apr_palloc(r->pool, current_alloc); } else if (bytes_handled + len > current_alloc) { apr_size_t new_size = current_alloc * 2; char *new_buffer; if (bytes_handled + len > new_size) { new_size = (bytes_handled + len) * 2; } new_buffer = apr_palloc(r->pool, new_size); memcpy(new_buffer, *s, bytes_handled); current_alloc = new_size; *s = new_buffer; } } pos = *s + bytes_handled; memcpy(pos, str, len); last_char = pos + len - 1; bytes_handled += len; } if (last_char && (*last_char == APR_ASCII_LF)) { break; } } if (last_char > *s && last_char[-1] == APR_ASCII_CR) { last_char--; } *last_char = '\0'; bytes_handled = last_char - *s; if (fold && bytes_handled && !saw_eos) { for (;;) { const char *str; apr_size_t len; char c; apr_brigade_cleanup(bb); rv = ap_get_brigade(r->proto_input_filters, bb, AP_MODE_SPECULATIVE, APR_BLOCK_READ, 1); if (rv != APR_SUCCESS) { return rv; } if (APR_BRIGADE_EMPTY(bb)) { break; } e = APR_BRIGADE_FIRST(bb); if (APR_BUCKET_IS_EOS(e)) { break; } rv = apr_bucket_read(e, &str, &len, APR_BLOCK_READ); if (rv != APR_SUCCESS) { apr_brigade_cleanup(bb); return rv; } c = *str; if (c == APR_ASCII_BLANK || c == APR_ASCII_TAB) { if (bytes_handled >= n) { *read = n; (*s)[n-1] = '\0'; return APR_ENOSPC; } else { apr_size_t next_size, next_len; char *tmp; if (do_alloc) { tmp = NULL; } else { tmp = last_char; } next_size = n - bytes_handled; rv = ap_rgetline_core(&tmp, next_size, &next_len, r, 0, bb); if (rv != APR_SUCCESS) { return rv; } if (do_alloc && next_len > 0) { char *new_buffer; apr_size_t new_size = bytes_handled + next_len + 1; new_buffer = apr_palloc(r->pool, new_size); memcpy(new_buffer, *s, bytes_handled); memcpy(new_buffer + bytes_handled, tmp, next_len + 1); *s = new_buffer; } last_char += next_len; bytes_handled += next_len; } } else { break; } } } *read = bytes_handled; if (strlen(*s) < bytes_handled) { return APR_EINVAL; } return APR_SUCCESS; } modules/http/http_filters.c:246: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `ap_get_mime_headers`. modules/http/http_filters.c:246:5: Call 244. r->headers_in = r->trailers_in; 245. apr_table_clear(r->headers_in); 246. ap_get_mime_headers(r); ^ 247. 248. if(r->status == HTTP_OK) { server/protocol.c:1194:1: Parameter `r->server->limit_req_fieldsize` 1192. } 1193. 1194. AP_DECLARE(void) ap_get_mime_headers(request_rec *r) ^ 1195. { 1196. apr_bucket_brigade *tmp_bb; server/protocol.c:1198:5: Call 1196. apr_bucket_brigade *tmp_bb; 1197. tmp_bb = apr_brigade_create(r->pool, r->connection->bucket_alloc); 1198. ap_get_mime_headers_core(r, tmp_bb); ^ 1199. apr_brigade_destroy(tmp_bb); 1200. } server/protocol.c:934:1: Parameter `r->server->limit_req_fieldsize` 932. } 933. 934. AP_DECLARE(void) ap_get_mime_headers_core(request_rec *r, apr_bucket_brigade *bb) ^ 935. { 936. char *last_field = NULL; server/protocol.c:955:14: Call 953. 954. field = NULL; 955. rv = ap_rgetline(&field, r->server->limit_req_fieldsize + 2, ^ 956. &len, r, 0, bb); 957. server/protocol.c:216:1: <LHS trace> 214. * or a full buffer, that's considered an error. 215. */ 216. AP_DECLARE(apr_status_t) ap_rgetline_core(char **s, apr_size_t n, ^ 217. apr_size_t *read, request_rec *r, 218. int fold, apr_bucket_brigade *bb) server/protocol.c:216:1: Parameter `n` 214. * or a full buffer, that's considered an error. 215. */ 216. AP_DECLARE(apr_status_t) ap_rgetline_core(char **s, apr_size_t n, ^ 217. apr_size_t *read, request_rec *r, 218. int fold, apr_bucket_brigade *bb) server/protocol.c:391:21: Binary operation: ([0, +oo] - 1):unsigned64 by call to `ap_get_mime_headers` 389. *read = n; 390. /* ensure this string is terminated */ 391. (*s)[n-1] = '\0'; ^ 392. return APR_ENOSPC; 393. }
https://github.com/apache/httpd/blob/74a5f93a855ae16c600b8837aaf4c8793a44041d/server/protocol.c/#L391
d2a_code_trace_data_43458
static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose) { size_t packlen = pkt->written - sub->pwritten; if (packlen == 0 && (sub->flags & WPACKET_FLAGS_NON_ZERO_LENGTH) != 0) return 0; if (packlen == 0 && sub->flags & WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH) { if (!doclose) return 0; if ((pkt->curr - sub->lenbytes) == sub->packet_len) { pkt->written -= sub->lenbytes; pkt->curr -= sub->lenbytes; } sub->packet_len = 0; sub->lenbytes = 0; } if (sub->lenbytes > 0 && !put_value(&GETBUF(pkt)[sub->packet_len], packlen, sub->lenbytes)) return 0; if (doclose) { pkt->subs = sub->parent; OPENSSL_free(sub); } return 1; } test/wpackettest.c:321: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `WPACKET_finish`. Showing all 13 steps of the trace test/wpackettest.c:316:10: Call 314. unsigned char *bytes; 315. 316. if (!TEST_true(WPACKET_init_len(&pkt, buf, 1)) ^ 317. || !TEST_true(WPACKET_allocate_bytes(&pkt, 2, &bytes))) 318. return cleanup(&pkt); ssl/packet.c:134:1: Parameter `lenbytes` 132. } 133. 134. > int WPACKET_init_len(WPACKET *pkt, BUF_MEM *buf, size_t lenbytes) 135. { 136. /* Internal API, so should not fail */ ssl/packet.c:145:12: Call 143. pkt->maxsize = maxmaxsize(lenbytes); 144. 145. return wpacket_intern_init_len(pkt, lenbytes); ^ 146. } 147. ssl/packet.c:90:1: Parameter `lenbytes` 88. } 89. 90. > static int wpacket_intern_init_len(WPACKET *pkt, size_t lenbytes) 91. { 92. unsigned char *lenchars; ssl/packet.c:104:5: Assignment 102. return 1; 103. 104. pkt->subs->pwritten = lenbytes; ^ 105. pkt->subs->lenbytes = lenbytes; 106. test/wpackettest.c:321:10: Call 319. bytes[0] = 0xfe; 320. bytes[1] = 0xff; 321. if (!TEST_true(WPACKET_finish(&pkt)) ^ 322. || !TEST_true(WPACKET_get_total_written(&pkt, &written)) 323. || !TEST_mem_eq(buf->data, written, alloc, sizeof(alloc))) ssl/packet.c:255:1: Parameter `pkt->written` 253. } 254. 255. > int WPACKET_finish(WPACKET *pkt) 256. { 257. int ret; ssl/packet.c:266:11: Call 264. return 0; 265. 266. ret = wpacket_intern_close(pkt, pkt->subs, 1); ^ 267. if (ret) { 268. OPENSSL_free(pkt->subs); ssl/packet.c:188:1: <LHS trace> 186. * (i.e. it fills in all the lengths), but doesn't actually close anything. 187. */ 188. > static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose) 189. { 190. size_t packlen = pkt->written - sub->pwritten; ssl/packet.c:188:1: Parameter `pkt->written` 186. * (i.e. it fills in all the lengths), but doesn't actually close anything. 187. */ 188. > static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose) 189. { 190. size_t packlen = pkt->written - sub->pwritten; ssl/packet.c:188:1: <RHS trace> 186. * (i.e. it fills in all the lengths), but doesn't actually close anything. 187. */ 188. > static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose) 189. { 190. size_t packlen = pkt->written - sub->pwritten; ssl/packet.c:188:1: Parameter `sub->pwritten` 186. * (i.e. it fills in all the lengths), but doesn't actually close anything. 187. */ 188. > static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose) 189. { 190. size_t packlen = pkt->written - sub->pwritten; ssl/packet.c:190:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `WPACKET_finish` 188. static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose) 189. { 190. size_t packlen = pkt->written - sub->pwritten; ^ 191. 192. if (packlen == 0
https://github.com/openssl/openssl/blob/424aa352458486d67e1e9cd3d3990dc06a60ba4a/ssl/packet.c/#L190
d2a_code_trace_data_43459
size_t CRYPTO_128_unwrap_pad(void *key, const unsigned char *icv, unsigned char *out, const unsigned char *in, size_t inlen, block128_f block) { size_t n = inlen / 8 - 1; size_t padded_len; size_t padding_len; size_t ptext_len; unsigned char aiv[8]; static unsigned char zeros[8] = {0x0}; size_t ret; if ((inlen & 0x7) != 0 || inlen < 16 || inlen >= CRYPTO128_WRAP_MAX) return 0; memmove(out, in, inlen); if (inlen == 16) { block(out, out, key); memcpy(aiv, out, 8); memmove(out, out + 8, 8); padded_len = 8; } else { padded_len = inlen - 8; ret = crypto_128_unwrap_raw(key, aiv, out, out, inlen, block); if (padded_len != ret) { OPENSSL_cleanse(out, inlen); return 0; } } if ((!icv && CRYPTO_memcmp(aiv, default_aiv, 4)) || (icv && CRYPTO_memcmp(aiv, icv, 4))) { OPENSSL_cleanse(out, inlen); return 0; } ptext_len = (aiv[4] << 24) | (aiv[5] << 16) | (aiv[6] << 8) | aiv[7]; if (8*(n-1) >= ptext_len || ptext_len > 8*n) { OPENSSL_cleanse(out, inlen); return 0; } padding_len = padded_len - ptext_len; if (CRYPTO_memcmp(out + ptext_len, zeros, padding_len) != 0) { OPENSSL_cleanse(out, inlen); return 0; } return ptext_len; } crypto/modes/wrap128.c:355: error: INTEGER_OVERFLOW_L2 ([-1, `inlen` - 1] - 1):unsigned64. Showing all 4 steps of the trace crypto/modes/wrap128.c:297:1: <LHS trace> 295. * Output length if unwrapping succeeded and IV matches. 296. */ 297. > size_t CRYPTO_128_unwrap_pad(void *key, const unsigned char *icv, 298. unsigned char *out, 299. const unsigned char *in, size_t inlen, block128_f block) crypto/modes/wrap128.c:297:1: Parameter `inlen` 295. * Output length if unwrapping succeeded and IV matches. 296. */ 297. > size_t CRYPTO_128_unwrap_pad(void *key, const unsigned char *icv, 298. unsigned char *out, 299. const unsigned char *in, size_t inlen, block128_f block) crypto/modes/wrap128.c:302:2: Assignment 300. { 301. /* n: number of 64-bit blocks in the padded key data */ 302. size_t n = inlen / 8 - 1; ^ 303. size_t padded_len; 304. size_t padding_len; crypto/modes/wrap128.c:355:6: Binary operation: ([-1, inlen - 1] - 1):unsigned64 353. 354. ptext_len = (aiv[4] << 24) | (aiv[5] << 16) | (aiv[6] << 8) | aiv[7]; 355. if (8*(n-1) >= ptext_len || ptext_len > 8*n) ^ 356. { 357. OPENSSL_cleanse(out, inlen);
https://github.com/openssl/openssl/blob/50bba6852df4d978d0b15ca8a087c6b0ac1a6e87/crypto/modes/wrap128.c/#L355
d2a_code_trace_data_43460
static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, const uint8_t *buf, int buf_size) { ASV1Context * const a = avctx->priv_data; AVFrame *picture = data; AVFrame * const p= (AVFrame*)&a->picture; int mb_x, mb_y; if(p->data[0]) avctx->release_buffer(avctx, p); p->reference= 0; if(avctx->get_buffer(avctx, p) < 0){ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } p->pict_type= FF_I_TYPE; p->key_frame= 1; a->bitstream_buffer= av_fast_realloc(a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if(avctx->codec_id == CODEC_ID_ASV1) a->dsp.bswap_buf((uint32_t*)a->bitstream_buffer, (const uint32_t*)buf, buf_size/4); else{ int i; for(i=0; i<buf_size; i++) a->bitstream_buffer[i]= ff_reverse[ buf[i] ]; } init_get_bits(&a->gb, a->bitstream_buffer, buf_size*8); for(mb_y=0; mb_y<a->mb_height2; mb_y++){ for(mb_x=0; mb_x<a->mb_width2; mb_x++){ if( decode_mb(a, a->block) <0) return -1; idct_put(a, mb_x, mb_y); } } if(a->mb_width2 != a->mb_width){ mb_x= a->mb_width2; for(mb_y=0; mb_y<a->mb_height2; mb_y++){ if( decode_mb(a, a->block) <0) return -1; idct_put(a, mb_x, mb_y); } } if(a->mb_height2 != a->mb_height){ mb_y= a->mb_height2; for(mb_x=0; mb_x<a->mb_width; mb_x++){ if( decode_mb(a, a->block) <0) return -1; idct_put(a, mb_x, mb_y); } } #if 0 int i; printf("%d %d\n", 8*buf_size, get_bits_count(&a->gb)); for(i=get_bits_count(&a->gb); i<8*buf_size; i++){ printf("%d", get_bits1(&a->gb)); } for(i=0; i<s->avctx->extradata_size; i++){ printf("%c\n", ((uint8_t*)s->avctx->extradata)[i]); } #endif *picture= *(AVFrame*)&a->picture; *data_size = sizeof(AVPicture); emms_c(); return (get_bits_count(&a->gb)+31)/32*4; } libavcodec/asv1.c:415: error: Null Dereference pointer `a->bitstream_buffer` last assigned on line 408 could be null and is dereferenced at line 415, column 13. libavcodec/asv1.c:388:1: start of procedure decode_frame() 386. } 387. 388. static int decode_frame(AVCodecContext *avctx, ^ 389. void *data, int *data_size, 390. const uint8_t *buf, int buf_size) libavcodec/asv1.c:392:5: 390. const uint8_t *buf, int buf_size) 391. { 392. ASV1Context * const a = avctx->priv_data; ^ 393. AVFrame *picture = data; 394. AVFrame * const p= (AVFrame*)&a->picture; libavcodec/asv1.c:393:5: 391. { 392. ASV1Context * const a = avctx->priv_data; 393. AVFrame *picture = data; ^ 394. AVFrame * const p= (AVFrame*)&a->picture; 395. int mb_x, mb_y; libavcodec/asv1.c:394:5: 392. ASV1Context * const a = avctx->priv_data; 393. AVFrame *picture = data; 394. AVFrame * const p= (AVFrame*)&a->picture; ^ 395. int mb_x, mb_y; 396. libavcodec/asv1.c:397:8: Taking true branch 395. int mb_x, mb_y; 396. 397. if(p->data[0]) ^ 398. avctx->release_buffer(avctx, p); 399. libavcodec/asv1.c:398:9: Skipping __function_pointer__(): unresolved function pointer 396. 397. if(p->data[0]) 398. avctx->release_buffer(avctx, p); ^ 399. 400. p->reference= 0; libavcodec/asv1.c:400:5: 398. avctx->release_buffer(avctx, p); 399. 400. p->reference= 0; ^ 401. if(avctx->get_buffer(avctx, p) < 0){ 402. av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); libavcodec/asv1.c:401:8: Taking false branch 399. 400. p->reference= 0; 401. if(avctx->get_buffer(avctx, p) < 0){ ^ 402. av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); 403. return -1; libavcodec/asv1.c:405:5: 403. return -1; 404. } 405. p->pict_type= FF_I_TYPE; ^ 406. p->key_frame= 1; 407. libavcodec/asv1.c:406:5: 404. } 405. p->pict_type= FF_I_TYPE; 406. p->key_frame= 1; ^ 407. 408. a->bitstream_buffer= av_fast_realloc(a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); libavcodec/asv1.c:408:5: 406. p->key_frame= 1; 407. 408. a->bitstream_buffer= av_fast_realloc(a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); ^ 409. 410. if(avctx->codec_id == CODEC_ID_ASV1) libavcodec/utils.c:63:1: start of procedure av_fast_realloc() 61. static int volatile entangled_thread_counter=0; 62. 63. void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size) ^ 64. { 65. if(min_size < *size) libavcodec/utils.c:65:8: Taking false branch 63. void *av_fast_realloc(void *ptr, unsigned int *size, unsigned int min_size) 64. { 65. if(min_size < *size) ^ 66. return ptr; 67. libavcodec/utils.c:68:12: Condition is true 66. return ptr; 67. 68. *size= FFMAX(17*min_size/16 + 32, min_size); ^ 69. 70. ptr= av_realloc(ptr, *size); libavcodec/utils.c:68:5: 66. return ptr; 67. 68. *size= FFMAX(17*min_size/16 + 32, min_size); ^ 69. 70. ptr= av_realloc(ptr, *size); libavcodec/utils.c:70:5: 68. *size= FFMAX(17*min_size/16 + 32, min_size); 69. 70. ptr= av_realloc(ptr, *size); ^ 71. if(!ptr) //we could set this to the unmodified min_size but this is safer if the user lost the ptr and uses NULL now 72. *size= 0; libavutil/mem.c:94:1: start of procedure av_realloc() 92. } 93. 94. void *av_realloc(void *ptr, unsigned int size) ^ 95. { 96. #ifdef CONFIG_MEMALIGN_HACK libavutil/mem.c:101:8: Taking true branch 99. 100. /* let's disallow possible ambiguous cases */ 101. if(size > (INT_MAX-16) ) ^ 102. return NULL; 103. libavutil/mem.c:102:9: 100. /* let's disallow possible ambiguous cases */ 101. if(size > (INT_MAX-16) ) 102. return NULL; ^ 103. 104. #ifdef CONFIG_MEMALIGN_HACK libavutil/mem.c:112:1: return from a call to av_realloc 110. return realloc(ptr, size); 111. #endif 112. } ^ 113. 114. void av_free(void *ptr) libavcodec/utils.c:71:9: Taking true branch 69. 70. ptr= av_realloc(ptr, *size); 71. if(!ptr) //we could set this to the unmodified min_size but this is safer if the user lost the ptr and uses NULL now ^ 72. *size= 0; 73. libavcodec/utils.c:72:9: 70. ptr= av_realloc(ptr, *size); 71. if(!ptr) //we could set this to the unmodified min_size but this is safer if the user lost the ptr and uses NULL now 72. *size= 0; ^ 73. 74. return ptr; libavcodec/utils.c:74:5: 72. *size= 0; 73. 74. return ptr; ^ 75. } 76. libavcodec/utils.c:75:1: return from a call to av_fast_realloc 73. 74. return ptr; 75. } ^ 76. 77. /* encoder management */ libavcodec/asv1.c:410:8: Taking false branch 408. a->bitstream_buffer= av_fast_realloc(a->bitstream_buffer, &a->bitstream_buffer_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); 409. 410. if(avctx->codec_id == CODEC_ID_ASV1) ^ 411. a->dsp.bswap_buf((uint32_t*)a->bitstream_buffer, (const uint32_t*)buf, buf_size/4); 412. else{ libavcodec/asv1.c:414:13: 412. else{ 413. int i; 414. for(i=0; i<buf_size; i++) ^ 415. a->bitstream_buffer[i]= ff_reverse[ buf[i] ]; 416. } libavcodec/asv1.c:414:18: Loop condition is true. Entering loop body 412. else{ 413. int i; 414. for(i=0; i<buf_size; i++) ^ 415. a->bitstream_buffer[i]= ff_reverse[ buf[i] ]; 416. } libavcodec/asv1.c:415:13: 413. int i; 414. for(i=0; i<buf_size; i++) 415. a->bitstream_buffer[i]= ff_reverse[ buf[i] ]; ^ 416. } 417.
https://github.com/libav/libav/blob/beca9a286c46a67b39fde5fab62a60d0766fc5ad/libavcodec/asv1.c/#L415
d2a_code_trace_data_43461
static inline void dxt1_decode_pixels(const uint8_t *s, uint32_t *d, unsigned int qstride, unsigned int flag, uint64_t alpha) { unsigned int x, y, c0, c1, a = (!flag * 255) << 24; unsigned int rb0, rb1, rb2, rb3, g0, g1, g2, g3; uint32_t colors[4], pixels; c0 = AV_RL16(s); c1 = AV_RL16(s+2); rb0 = (c0<<3 | c0<<8) & 0xf800f8; rb1 = (c1<<3 | c1<<8) & 0xf800f8; rb0 += (rb0>>5) & 0x070007; rb1 += (rb1>>5) & 0x070007; g0 = (c0 <<5) & 0x00fc00; g1 = (c1 <<5) & 0x00fc00; g0 += (g0 >>6) & 0x000300; g1 += (g1 >>6) & 0x000300; colors[0] = rb0 + g0 + a; colors[1] = rb1 + g1 + a; if (c0 > c1 || flag) { rb2 = (((2*rb0+rb1) * 21) >> 6) & 0xff00ff; rb3 = (((2*rb1+rb0) * 21) >> 6) & 0xff00ff; g2 = (((2*g0 +g1 ) * 21) >> 6) & 0x00ff00; g3 = (((2*g1 +g0 ) * 21) >> 6) & 0x00ff00; colors[3] = rb3 + g3 + a; } else { rb2 = ((rb0+rb1) >> 1) & 0xff00ff; g2 = ((g0 +g1 ) >> 1) & 0x00ff00; colors[3] = 0; } colors[2] = rb2 + g2 + a; pixels = AV_RL32(s+4); for (y=0; y<4; y++) { for (x=0; x<4; x++) { a = (alpha & 0x0f) << 28; a += a >> 4; d[x] = a + colors[pixels&3]; pixels >>= 2; alpha >>= 4; } d += qstride; } } libavcodec/s3tc.c:68: error: Integer Overflow L2 ([0, 4278190080] + [0, 4294967295]):unsigned32. libavcodec/s3tc.c:27:1: <LHS trace> 25. #include "s3tc.h" 26. 27. static inline void dxt1_decode_pixels(const uint8_t *s, uint32_t *d, ^ 28. unsigned int qstride, unsigned int flag, 29. uint64_t alpha) { libavcodec/s3tc.c:27:1: Parameter `alpha` 25. #include "s3tc.h" 26. 27. static inline void dxt1_decode_pixels(const uint8_t *s, uint32_t *d, ^ 28. unsigned int qstride, unsigned int flag, 29. uint64_t alpha) { libavcodec/s3tc.c:66:13: Assignment 64. for (y=0; y<4; y++) { 65. for (x=0; x<4; x++) { 66. a = (alpha & 0x0f) << 28; ^ 67. a += a >> 4; 68. d[x] = a + colors[pixels&3]; libavcodec/s3tc.c:67:13: Assignment 65. for (x=0; x<4; x++) { 66. a = (alpha & 0x0f) << 28; 67. a += a >> 4; ^ 68. d[x] = a + colors[pixels&3]; 69. pixels >>= 2; libavcodec/s3tc.c:58:9: <RHS trace> 56. rb2 = ((rb0+rb1) >> 1) & 0xff00ff; 57. g2 = ((g0 +g1 ) >> 1) & 0x00ff00; 58. colors[3] = 0; ^ 59. } 60. libavcodec/s3tc.c:58:9: Assignment 56. rb2 = ((rb0+rb1) >> 1) & 0xff00ff; 57. g2 = ((g0 +g1 ) >> 1) & 0x00ff00; 58. colors[3] = 0; ^ 59. } 60. libavcodec/s3tc.c:68:13: Binary operation: ([0, 4278190080] + [0, 4294967295]):unsigned32 66. a = (alpha & 0x0f) << 28; 67. a += a >> 4; 68. d[x] = a + colors[pixels&3]; ^ 69. pixels >>= 2; 70. alpha >>= 4;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/s3tc.c/#L68
d2a_code_trace_data_43462
void t2p_read_tiff_size(T2P* t2p, TIFF* input){ uint64* sbc=NULL; #if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT) unsigned char* jpt=NULL; tstrip_t i=0; tstrip_t stripcount=0; #endif uint64 k = 0; if(t2p->pdf_transcode == T2P_TRANSCODE_RAW){ #ifdef CCITT_SUPPORT if(t2p->pdf_compression == T2P_COMPRESS_G4 ){ TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc); if (sbc[0] != (uint64)(tmsize_t)sbc[0]) { TIFFError(TIFF2PDF_MODULE, "Integer overflow"); t2p->t2p_error = T2P_ERR_ERROR; } t2p->tiff_datasize=(tmsize_t)sbc[0]; return; } #endif #ifdef ZIP_SUPPORT if(t2p->pdf_compression == T2P_COMPRESS_ZIP){ TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc); if (sbc[0] != (uint64)(tmsize_t)sbc[0]) { TIFFError(TIFF2PDF_MODULE, "Integer overflow"); t2p->t2p_error = T2P_ERR_ERROR; } t2p->tiff_datasize=(tmsize_t)sbc[0]; return; } #endif #ifdef OJPEG_SUPPORT if(t2p->tiff_compression == COMPRESSION_OJPEG){ if(!TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc)){ TIFFError(TIFF2PDF_MODULE, "Input file %s missing field: TIFFTAG_STRIPBYTECOUNTS", TIFFFileName(input)); t2p->t2p_error = T2P_ERR_ERROR; return; } stripcount=TIFFNumberOfStrips(input); for(i=0;i<stripcount;i++){ k = checkAdd64(k, sbc[i], t2p); } if(TIFFGetField(input, TIFFTAG_JPEGIFOFFSET, &(t2p->tiff_dataoffset))){ if(t2p->tiff_dataoffset != 0){ if(TIFFGetField(input, TIFFTAG_JPEGIFBYTECOUNT, &(t2p->tiff_datasize))!=0){ if((uint64)t2p->tiff_datasize < k) { TIFFWarning(TIFF2PDF_MODULE, "Input file %s has short JPEG interchange file byte count", TIFFFileName(input)); t2p->pdf_ojpegiflength=t2p->tiff_datasize; k = checkAdd64(k, t2p->tiff_datasize, t2p); k = checkAdd64(k, 6, t2p); k = checkAdd64(k, stripcount, t2p); k = checkAdd64(k, stripcount, t2p); t2p->tiff_datasize = (tsize_t) k; if ((uint64) t2p->tiff_datasize != k) { TIFFError(TIFF2PDF_MODULE, "Integer overflow"); t2p->t2p_error = T2P_ERR_ERROR; } return; } return; }else { TIFFError(TIFF2PDF_MODULE, "Input file %s missing field: TIFFTAG_JPEGIFBYTECOUNT", TIFFFileName(input)); t2p->t2p_error = T2P_ERR_ERROR; return; } } } k = checkAdd64(k, stripcount, t2p); k = checkAdd64(k, stripcount, t2p); k = checkAdd64(k, 2048, t2p); t2p->tiff_datasize = (tsize_t) k; if ((uint64) t2p->tiff_datasize != k) { TIFFError(TIFF2PDF_MODULE, "Integer overflow"); t2p->t2p_error = T2P_ERR_ERROR; } return; } #endif #ifdef JPEG_SUPPORT if(t2p->tiff_compression == COMPRESSION_JPEG) { uint32 count = 0; if(TIFFGetField(input, TIFFTAG_JPEGTABLES, &count, &jpt) != 0 ){ if(count > 4){ k += count; k -= 2; } } else { k = 2; } stripcount=TIFFNumberOfStrips(input); if(!TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc)){ TIFFError(TIFF2PDF_MODULE, "Input file %s missing field: TIFFTAG_STRIPBYTECOUNTS", TIFFFileName(input)); t2p->t2p_error = T2P_ERR_ERROR; return; } for(i=0;i<stripcount;i++){ k = checkAdd64(k, sbc[i], t2p); k -=2; k +=2; } k = checkAdd64(k, 2, t2p); k = checkAdd64(k, 6, t2p); t2p->tiff_datasize = (tsize_t) k; if ((uint64) t2p->tiff_datasize != k) { TIFFError(TIFF2PDF_MODULE, "Integer overflow"); t2p->t2p_error = T2P_ERR_ERROR; } return; } #endif (void) 0; } k = checkMultiply64(TIFFScanlineSize(input), t2p->tiff_length, t2p); if(t2p->tiff_planar==PLANARCONFIG_SEPARATE){ k = checkMultiply64(k, t2p->tiff_samplesperpixel, t2p); } if (k == 0) { t2p->t2p_error = T2P_ERR_ERROR; } t2p->tiff_datasize = (tsize_t) k; if ((uint64) t2p->tiff_datasize != k) { TIFFError(TIFF2PDF_MODULE, "Integer overflow"); t2p->t2p_error = T2P_ERR_ERROR; } return; } tools/tiff2pdf.c:1922: error: Null Dereference pointer `sbc` last assigned on line 1899 could be null and is dereferenced at line 1922, column 17. tools/tiff2pdf.c:1897:1: start of procedure t2p_read_tiff_size() 1895. */ 1896. 1897. void t2p_read_tiff_size(T2P* t2p, TIFF* input){ ^ 1898. 1899. uint64* sbc=NULL; tools/tiff2pdf.c:1899:2: 1897. void t2p_read_tiff_size(T2P* t2p, TIFF* input){ 1898. 1899. uint64* sbc=NULL; ^ 1900. #if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT) 1901. unsigned char* jpt=NULL; tools/tiff2pdf.c:1901:2: 1899. uint64* sbc=NULL; 1900. #if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT) 1901. unsigned char* jpt=NULL; ^ 1902. tstrip_t i=0; 1903. tstrip_t stripcount=0; tools/tiff2pdf.c:1902:2: 1900. #if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT) 1901. unsigned char* jpt=NULL; 1902. tstrip_t i=0; ^ 1903. tstrip_t stripcount=0; 1904. #endif tools/tiff2pdf.c:1903:2: 1901. unsigned char* jpt=NULL; 1902. tstrip_t i=0; 1903. tstrip_t stripcount=0; ^ 1904. #endif 1905. uint64 k = 0; tools/tiff2pdf.c:1905:9: 1903. tstrip_t stripcount=0; 1904. #endif 1905. uint64 k = 0; ^ 1906. 1907. if(t2p->pdf_transcode == T2P_TRANSCODE_RAW){ tools/tiff2pdf.c:1907:5: Taking true branch 1905. uint64 k = 0; 1906. 1907. if(t2p->pdf_transcode == T2P_TRANSCODE_RAW){ ^ 1908. #ifdef CCITT_SUPPORT 1909. if(t2p->pdf_compression == T2P_COMPRESS_G4 ){ tools/tiff2pdf.c:1909:6: Taking false branch 1907. if(t2p->pdf_transcode == T2P_TRANSCODE_RAW){ 1908. #ifdef CCITT_SUPPORT 1909. if(t2p->pdf_compression == T2P_COMPRESS_G4 ){ ^ 1910. TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc); 1911. if (sbc[0] != (uint64)(tmsize_t)sbc[0]) { tools/tiff2pdf.c:1920:6: Taking true branch 1918. #endif 1919. #ifdef ZIP_SUPPORT 1920. if(t2p->pdf_compression == T2P_COMPRESS_ZIP){ ^ 1921. TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc); 1922. if (sbc[0] != (uint64)(tmsize_t)sbc[0]) { tools/tiff2pdf.c:1921:4: 1919. #ifdef ZIP_SUPPORT 1920. if(t2p->pdf_compression == T2P_COMPRESS_ZIP){ 1921. TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc); ^ 1922. if (sbc[0] != (uint64)(tmsize_t)sbc[0]) { 1923. TIFFError(TIFF2PDF_MODULE, "Integer overflow"); libtiff/tif_dir.c:1213:1: start of procedure TIFFGetField() 1211. * internal directory structure. 1212. */ 1213. int ^ 1214. TIFFGetField(TIFF* tif, uint32 tag, ...) 1215. { libtiff/tif_dir.c:1219:2: 1217. va_list ap; 1218. 1219. va_start(ap, tag); ^ 1220. status = TIFFVGetField(tif, tag, ap); 1221. va_end(ap); libtiff/tif_dir.c:1220:2: Skipping TIFFVGetField(): empty list of specs 1218. 1219. va_start(ap, tag); 1220. status = TIFFVGetField(tif, tag, ap); ^ 1221. va_end(ap); 1222. return (status); libtiff/tif_dir.c:1221:2: 1219. va_start(ap, tag); 1220. status = TIFFVGetField(tif, tag, ap); 1221. va_end(ap); ^ 1222. return (status); 1223. } libtiff/tif_dir.c:1222:2: 1220. status = TIFFVGetField(tif, tag, ap); 1221. va_end(ap); 1222. return (status); ^ 1223. } 1224. libtiff/tif_dir.c:1223:1: return from a call to TIFFGetField 1221. va_end(ap); 1222. return (status); 1223. } ^ 1224. 1225. /* tools/tiff2pdf.c:1922:17: 1920. if(t2p->pdf_compression == T2P_COMPRESS_ZIP){ 1921. TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc); 1922. if (sbc[0] != (uint64)(tmsize_t)sbc[0]) { ^ 1923. TIFFError(TIFF2PDF_MODULE, "Integer overflow"); 1924. t2p->t2p_error = T2P_ERR_ERROR;
https://gitlab.com/libtiff/libtiff/blob/6dac309a9701d15ac52d895d566ddae2ed49db9b/tools/tiff2pdf.c/#L1922
d2a_code_trace_data_43463
static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int length, int sb_min, int sb_max) { int sb, j, k, n, ch, run, channels; int joined_stereo, zero_encoding, chs; int type34_first; float type34_div = 0; float type34_predictor; float samples[10], sign_bits[16]; if (length == 0) { for (sb=sb_min; sb < sb_max; sb++) build_sb_samples_from_noise (q, sb); return; } for (sb = sb_min; sb < sb_max; sb++) { FIX_NOISE_IDX(q->noise_idx); channels = q->nb_channels; if (q->nb_channels <= 1 || sb < 12) joined_stereo = 0; else if (sb >= 24) joined_stereo = 1; else joined_stereo = (BITS_LEFT(length,gb) >= 1) ? get_bits1 (gb) : 0; if (joined_stereo) { if (BITS_LEFT(length,gb) >= 16) for (j = 0; j < 16; j++) sign_bits[j] = get_bits1 (gb); for (j = 0; j < 64; j++) if (q->coding_method[1][sb][j] > q->coding_method[0][sb][j]) q->coding_method[0][sb][j] = q->coding_method[1][sb][j]; fix_coding_method_array(sb, q->nb_channels, q->coding_method); channels = 1; } for (ch = 0; ch < channels; ch++) { zero_encoding = (BITS_LEFT(length,gb) >= 1) ? get_bits1(gb) : 0; type34_predictor = 0.0; type34_first = 1; for (j = 0; j < 128; ) { switch (q->coding_method[ch][sb][j / 2]) { case 8: if (BITS_LEFT(length,gb) >= 10) { if (zero_encoding) { for (k = 0; k < 5; k++) { if ((j + 2 * k) >= 128) break; samples[2 * k] = get_bits1(gb) ? dequant_1bit[joined_stereo][2 * get_bits1(gb)] : 0; } } else { n = get_bits(gb, 8); for (k = 0; k < 5; k++) samples[2 * k] = dequant_1bit[joined_stereo][random_dequant_index[n][k]]; } for (k = 0; k < 5; k++) samples[2 * k + 1] = SB_DITHERING_NOISE(sb,q->noise_idx); } else { for (k = 0; k < 10; k++) samples[k] = SB_DITHERING_NOISE(sb,q->noise_idx); } run = 10; break; case 10: if (BITS_LEFT(length,gb) >= 1) { float f = 0.81; if (get_bits1(gb)) f = -f; f -= noise_samples[((sb + 1) * (j +5 * ch + 1)) & 127] * 9.0 / 40.0; samples[0] = f; } else { samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx); } run = 1; break; case 16: if (BITS_LEFT(length,gb) >= 10) { if (zero_encoding) { for (k = 0; k < 5; k++) { if ((j + k) >= 128) break; samples[k] = (get_bits1(gb) == 0) ? 0 : dequant_1bit[joined_stereo][2 * get_bits1(gb)]; } } else { n = get_bits (gb, 8); for (k = 0; k < 5; k++) samples[k] = dequant_1bit[joined_stereo][random_dequant_index[n][k]]; } } else { for (k = 0; k < 5; k++) samples[k] = SB_DITHERING_NOISE(sb,q->noise_idx); } run = 5; break; case 24: if (BITS_LEFT(length,gb) >= 7) { n = get_bits(gb, 7); for (k = 0; k < 3; k++) samples[k] = (random_dequant_type24[n][k] - 2.0) * 0.5; } else { for (k = 0; k < 3; k++) samples[k] = SB_DITHERING_NOISE(sb,q->noise_idx); } run = 3; break; case 30: if (BITS_LEFT(length,gb) >= 4) samples[0] = type30_dequant[qdm2_get_vlc(gb, &vlc_tab_type30, 0, 1)]; else samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx); run = 1; break; case 34: if (BITS_LEFT(length,gb) >= 7) { if (type34_first) { type34_div = (float)(1 << get_bits(gb, 2)); samples[0] = ((float)get_bits(gb, 5) - 16.0) / 15.0; type34_predictor = samples[0]; type34_first = 0; } else { samples[0] = type34_delta[qdm2_get_vlc(gb, &vlc_tab_type34, 0, 1)] / type34_div + type34_predictor; type34_predictor = samples[0]; } } else { samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx); } run = 1; break; default: samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx); run = 1; break; } if (joined_stereo) { float tmp[10][MPA_MAX_CHANNELS]; for (k = 0; k < run; k++) { tmp[k][0] = samples[k]; tmp[k][1] = (sign_bits[(j + k) / 8]) ? -samples[k] : samples[k]; } for (chs = 0; chs < q->nb_channels; chs++) for (k = 0; k < run; k++) if ((j + k) < 128) q->sb_samples[chs][j + k][sb] = (int32_t)(f2i_scale * q->tone_level[chs][sb][((j + k)/2)] * tmp[k][chs] + .5); } else { for (k = 0; k < run; k++) if ((j + k) < 128) q->sb_samples[ch][j + k][sb] = (int32_t)(f2i_scale * q->tone_level[ch][sb][(j + k)/2] * samples[k] + .5); } j += run; } } } } libavcodec/qdm2.c:957: error: Buffer Overrun L2 Offset: [0, 136] Size: 128. libavcodec/qdm2.c:845:18: <Offset trace> 843. type34_first = 1; 844. 845. for (j = 0; j < 128; ) { ^ 846. switch (q->coding_method[ch][sb][j / 2]) { 847. case 8: libavcodec/qdm2.c:845:18: Assignment 843. type34_first = 1; 844. 845. for (j = 0; j < 128; ) { ^ 846. switch (q->coding_method[ch][sb][j / 2]) { 847. case 8: libavcodec/qdm2.c:798:1: <Length trace> 796. * @param sb_max higher subband processed (sb_max excluded) 797. */ 798. static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int length, int sb_min, int sb_max) ^ 799. { 800. int sb, j, k, n, ch, run, channels; libavcodec/qdm2.c:798:1: Parameter `q->sb_samples[*][*]` 796. * @param sb_max higher subband processed (sb_max excluded) 797. */ 798. static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int length, int sb_min, int sb_max) ^ 799. { 800. int sb, j, k, n, ch, run, channels; libavcodec/qdm2.c:957:33: Array access: Offset: [0, 136] Size: 128 955. for (k = 0; k < run; k++) 956. if ((j + k) < 128) 957. q->sb_samples[chs][j + k][sb] = (int32_t)(f2i_scale * q->tone_level[chs][sb][((j + k)/2)] * tmp[k][chs] + .5); ^ 958. } else { 959. for (k = 0; k < run; k++)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/qdm2.c/#L957
d2a_code_trace_data_43464
int bn_cmp_words(const BN_ULONG *a, const BN_ULONG *b, int n) { int i; BN_ULONG aa, bb; aa = a[n - 1]; bb = b[n - 1]; if (aa != bb) return ((aa > bb) ? 1 : -1); for (i = n - 2; i >= 0; i--) { aa = a[i]; bb = b[i]; if (aa != bb) return ((aa > bb) ? 1 : -1); } return (0); } crypto/rsa/rsa_chk.c:66: error: BUFFER_OVERRUN_L3 Offset: [9, +oo] (⇐ [9, +oo] + [0, +oo]) Size: [0, 8388607] by call to `BN_mul`. Showing all 23 steps of the trace crypto/rsa/rsa_chk.c:60:9: Call 58. 59. /* q prime? */ 60. if (BN_is_prime_ex(key->q, BN_prime_checks, NULL, cb) != 1) { ^ 61. ret = 0; 62. RSAerr(RSA_F_RSA_CHECK_KEY_EX, RSA_R_Q_NOT_PRIME); crypto/bn/bn_prime.c:197:12: Call 195. BN_GENCB *cb) 196. { 197. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb); ^ 198. } 199. crypto/bn/bn_prime.c:285:13: Call 283. /* now 1 <= check < A */ 284. 285. j = witness(check, A, A1, A1_odd, k, ctx, mont); ^ 286. if (j == -1) 287. goto err; crypto/bn/bn_prime.c:388:10: Call 386. BN_MONT_CTX *mont) 387. { 388. if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */ ^ 389. return -1; 390. if (BN_is_one(w)) crypto/bn/bn_exp.c:356:14: Call 354. 355. if (a->neg || BN_ucmp(a, m) >= 0) { 356. if (!BN_nnmod(val[0], a, m, ctx)) ^ 357. goto err; 358. aa = val[0]; 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:140:1: Parameter `*dv->d` 138. * If 'dv' or 'rm' is NULL, the respective value is not returned. 139. */ 140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 141. BN_CTX *ctx) 142. { crypto/rsa/rsa_chk.c:66:10: Call 64. 65. /* n = p*q? */ 66. if (!BN_mul(i, key->p, key->q, ctx)) { ^ 67. ret = -1; 68. goto err; crypto/bn/bn_mul.c:829:1: Parameter `a->top` 827. #endif /* BN_RECURSION */ 828. 829. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 830. { 831. int ret = 0; crypto/bn/bn_mul.c:846:5: Assignment 844. bn_check_top(r); 845. 846. al = a->top; ^ 847. bl = b->top; 848. crypto/bn/bn_mul.c:910:17: Call 908. if (bn_wexpand(rr, k * 4) == NULL) 909. goto err; 910. bn_mul_part_recursive(rr->d, a->d, b->d, ^ 911. j, al - j, bl - j, t->d); 912. } else { /* al <= j || bl <= j */ crypto/bn/bn_mul.c:480:1: Parameter `n` 478. */ 479. /* tnX may not be negative but less than n */ 480. > void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n, 481. int tna, int tnb, BN_ULONG *t) 482. { crypto/bn/bn_mul.c:543:9: Call 541. } else { 542. p = &(t[n2 * 2]); 543. bn_mul_recursive(&(t[n2]), t, &(t[n]), n, 0, 0, p); ^ 544. bn_mul_recursive(r, a, b, n, 0, 0, p); 545. i = n / 2; crypto/bn/bn_mul.c:333:1: Parameter `*b` 331. */ 332. /* dnX may not be positive, but n2/2+dnX has to be */ 333. > void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2, 334. int dna, int dnb, BN_ULONG *t) 335. { crypto/bn/bn_mul.c:367:10: Call 365. /* r=(a[0]-a[1])*(b[1]-b[0]) */ 366. c1 = bn_cmp_part_words(a, &(a[n]), tna, n - tna); 367. c2 = bn_cmp_part_words(&(b[n]), b, tnb, tnb - n); ^ 368. zero = neg = 0; 369. switch (c1 * 3 + c2) { crypto/bn/bn_lib.c:803:1: Parameter `cl` 801. */ 802. 803. > int bn_cmp_part_words(const BN_ULONG *a, const BN_ULONG *b, int cl, int dl) 804. { 805. int n, i; crypto/bn/bn_lib.c:820:12: Call 818. } 819. } 820. return bn_cmp_words(a, b, cl); ^ 821. } 822. crypto/bn/bn_lib.c:776:1: <Offset trace> 774. } 775. 776. > int bn_cmp_words(const BN_ULONG *a, const BN_ULONG *b, int n) 777. { 778. int i; crypto/bn/bn_lib.c:776:1: Parameter `n` 774. } 775. 776. > int bn_cmp_words(const BN_ULONG *a, const BN_ULONG *b, int n) 777. { 778. int i; crypto/bn/bn_lib.c:785:10: Assignment 783. if (aa != bb) 784. return ((aa > bb) ? 1 : -1); 785. for (i = n - 2; i >= 0; i--) { ^ 786. aa = a[i]; 787. bb = b[i]; crypto/bn/bn_lib.c:776:1: <Length trace> 774. } 775. 776. > int bn_cmp_words(const BN_ULONG *a, const BN_ULONG *b, int n) 777. { 778. int i; crypto/bn/bn_lib.c:776:1: Parameter `*b` 774. } 775. 776. > int bn_cmp_words(const BN_ULONG *a, const BN_ULONG *b, int n) 777. { 778. int i; crypto/bn/bn_lib.c:787:14: Array access: Offset: [9, +oo] (⇐ [9, +oo] + [0, +oo]) Size: [0, 8388607] by call to `BN_mul` 785. for (i = n - 2; i >= 0; i--) { 786. aa = a[i]; 787. bb = b[i]; ^ 788. if (aa != bb) 789. return ((aa > bb) ? 1 : -1);
https://github.com/openssl/openssl/blob/2f3930bc0edbfdc7718f709b856fa53f0ec57cde/crypto/bn/bn_lib.c/#L787
d2a_code_trace_data_43465
int ossl_init_thread_start(uint64_t opts) { struct thread_local_inits_st *locals = ossl_init_get_thread_local(1); if (locals == NULL) return 0; if (opts & OPENSSL_INIT_THREAD_ASYNC) { #ifdef OPENSSL_INIT_DEBUG fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: " "marking thread for async\n"); #endif locals->async = 1; } if (opts & OPENSSL_INIT_THREAD_ERR_STATE) { #ifdef OPENSSL_INIT_DEBUG fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: " "marking thread for err_state\n"); #endif locals->err_state = 1; } return 1; } crypto/init.c:383: error: MEMORY_LEAK memory dynamically allocated to `locals` by call to `ossl_init_get_thread_local()` at line 370, column 44 is not reachable after line 383, column 9. Showing all 37 steps of the trace crypto/init.c:368:1: start of procedure ossl_init_thread_start() 366. } 367. 368. > int ossl_init_thread_start(uint64_t opts) 369. { 370. struct thread_local_inits_st *locals = ossl_init_get_thread_local(1); crypto/init.c:370:5: 368. int ossl_init_thread_start(uint64_t opts) 369. { 370. > struct thread_local_inits_st *locals = ossl_init_get_thread_local(1); 371. 372. if (locals == NULL) crypto/init.c:86:1: start of procedure ossl_init_get_thread_local() 84. } 85. 86. > static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc) 87. { 88. struct thread_local_inits_st *local = crypto/init.c:88:5: 86. static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc) 87. { 88. > struct thread_local_inits_st *local = 89. CRYPTO_THREAD_get_local(&threadstopkey); 90. crypto/threads_pthread.c:120:1: start of procedure CRYPTO_THREAD_get_local() 118. } 119. 120. > void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key) 121. { 122. return pthread_getspecific(*key); crypto/threads_pthread.c:122:5: Skipping pthread_getspecific(): method has no implementation 120. void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key) 121. { 122. return pthread_getspecific(*key); ^ 123. } 124. crypto/threads_pthread.c:123:1: return from a call to CRYPTO_THREAD_get_local 121. { 122. return pthread_getspecific(*key); 123. > } 124. 125. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) crypto/init.c:91:9: Taking true branch 89. CRYPTO_THREAD_get_local(&threadstopkey); 90. 91. if (local == NULL && alloc) { ^ 92. local = OPENSSL_zalloc(sizeof *local); 93. CRYPTO_THREAD_set_local(&threadstopkey, local); crypto/init.c:91:26: Taking true branch 89. CRYPTO_THREAD_get_local(&threadstopkey); 90. 91. if (local == NULL && alloc) { ^ 92. local = OPENSSL_zalloc(sizeof *local); 93. CRYPTO_THREAD_set_local(&threadstopkey, local); crypto/init.c:92:9: 90. 91. if (local == NULL && alloc) { 92. > local = OPENSSL_zalloc(sizeof *local); 93. CRYPTO_THREAD_set_local(&threadstopkey, local); 94. } crypto/mem.c:146:1: start of procedure CRYPTO_zalloc() 144. } 145. 146. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 147. { 148. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:148:5: 146. void *CRYPTO_zalloc(size_t num, const char *file, int line) 147. { 148. > void *ret = CRYPTO_malloc(num, file, line); 149. 150. if (ret != NULL) crypto/mem.c:119:1: start of procedure CRYPTO_malloc() 117. } 118. 119. > void *CRYPTO_malloc(size_t num, const char *file, int line) 120. { 121. void *ret = NULL; crypto/mem.c:121:5: 119. void *CRYPTO_malloc(size_t num, const char *file, int line) 120. { 121. > void *ret = NULL; 122. 123. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:123:9: Taking false branch 121. void *ret = NULL; 122. 123. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 124. return malloc_impl(num, file, line); 125. crypto/mem.c:126:9: Taking false branch 124. return malloc_impl(num, file, line); 125. 126. if (num <= 0) ^ 127. return NULL; 128. crypto/mem.c:129:5: 127. return NULL; 128. 129. > allow_customize = 0; 130. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 131. if (call_malloc_debug) { crypto/mem.c:139:5: 137. } 138. #else 139. > osslargused(file); osslargused(line); 140. ret = malloc(num); 141. #endif crypto/mem.c:139:24: 137. } 138. #else 139. > osslargused(file); osslargused(line); 140. ret = malloc(num); 141. #endif crypto/mem.c:140:5: 138. #else 139. osslargused(file); osslargused(line); 140. > ret = malloc(num); 141. #endif 142. crypto/mem.c:143:5: 141. #endif 142. 143. > return ret; 144. } 145. crypto/mem.c:144:1: return from a call to CRYPTO_malloc 142. 143. return ret; 144. > } 145. 146. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:150:9: Taking true branch 148. void *ret = CRYPTO_malloc(num, file, line); 149. 150. if (ret != NULL) ^ 151. memset(ret, 0, num); 152. return ret; crypto/mem.c:151:9: 149. 150. if (ret != NULL) 151. > memset(ret, 0, num); 152. return ret; 153. } crypto/mem.c:152:5: 150. if (ret != NULL) 151. memset(ret, 0, num); 152. > return ret; 153. } 154. crypto/mem.c:153:1: return from a call to CRYPTO_zalloc 151. memset(ret, 0, num); 152. return ret; 153. > } 154. 155. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/init.c:93:9: 91. if (local == NULL && alloc) { 92. local = OPENSSL_zalloc(sizeof *local); 93. > CRYPTO_THREAD_set_local(&threadstopkey, local); 94. } 95. if (!alloc) { crypto/threads_pthread.c:125:1: start of procedure CRYPTO_THREAD_set_local() 123. } 124. 125. > int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) 126. { 127. if (pthread_setspecific(*key, val) != 0) crypto/threads_pthread.c:127:9: Taking true branch 125. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) 126. { 127. if (pthread_setspecific(*key, val) != 0) ^ 128. return 0; 129. crypto/threads_pthread.c:128:9: 126. { 127. if (pthread_setspecific(*key, val) != 0) 128. > return 0; 129. 130. return 1; crypto/threads_pthread.c:131:1: return from a call to CRYPTO_THREAD_set_local 129. 130. return 1; 131. > } 132. 133. int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key) crypto/init.c:95:10: Taking false branch 93. CRYPTO_THREAD_set_local(&threadstopkey, local); 94. } 95. if (!alloc) { ^ 96. CRYPTO_THREAD_set_local(&threadstopkey, NULL); 97. } crypto/init.c:99:5: 97. } 98. 99. > return local; 100. } 101. crypto/init.c:100:1: return from a call to ossl_init_get_thread_local 98. 99. return local; 100. > } 101. 102. typedef struct ossl_init_stop_st OPENSSL_INIT_STOP; crypto/init.c:372:9: Taking false branch 370. struct thread_local_inits_st *locals = ossl_init_get_thread_local(1); 371. 372. if (locals == NULL) ^ 373. return 0; 374. crypto/init.c:375:9: Taking false branch 373. return 0; 374. 375. if (opts & OPENSSL_INIT_THREAD_ASYNC) { ^ 376. #ifdef OPENSSL_INIT_DEBUG 377. fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: " crypto/init.c:383:9: Taking false branch 381. } 382. 383. if (opts & OPENSSL_INIT_THREAD_ERR_STATE) { ^ 384. #ifdef OPENSSL_INIT_DEBUG 385. fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "
https://github.com/openssl/openssl/blob/5968d11a7a28103610c054c6a57c852bbe0f3b51/crypto/init.c/#L383
d2a_code_trace_data_43466
int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, size_t len, size_t *written) { int i; SSL3_BUFFER *wb = s->rlayer.wbuf; size_t currbuf = 0; size_t tmpwrit = 0; if ((s->rlayer.wpend_tot > len) || ((s->rlayer.wpend_buf != buf) && !(s->mode & SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER)) || (s->rlayer.wpend_type != type)) { SSLerr(SSL_F_SSL3_WRITE_PENDING, SSL_R_BAD_WRITE_RETRY); return -1; } for (;;) { if (SSL3_BUFFER_get_left(&wb[currbuf]) == 0 && currbuf < s->rlayer.numwpipes - 1) { currbuf++; continue; } clear_sys_error(); if (s->wbio != NULL) { s->rwstate = SSL_WRITING; i = BIO_write(s->wbio, (char *) &(SSL3_BUFFER_get_buf(&wb[currbuf]) [SSL3_BUFFER_get_offset(&wb[currbuf])]), (unsigned int)SSL3_BUFFER_get_left(&wb[currbuf])); if (i >= 0) tmpwrit = i; } else { SSLerr(SSL_F_SSL3_WRITE_PENDING, SSL_R_BIO_NOT_SET); i = -1; } if (i > 0 && tmpwrit == SSL3_BUFFER_get_left(&wb[currbuf])) { SSL3_BUFFER_set_left(&wb[currbuf], 0); SSL3_BUFFER_add_offset(&wb[currbuf], tmpwrit); if (currbuf + 1 < s->rlayer.numwpipes) continue; s->rwstate = SSL_NOTHING; *written = s->rlayer.wpend_ret; return 1; } else if (i <= 0) { if (SSL_IS_DTLS(s)) { SSL3_BUFFER_set_left(&wb[currbuf], 0); } return -1; } SSL3_BUFFER_add_offset(&wb[currbuf], tmpwrit); SSL3_BUFFER_sub_left(&wb[currbuf], tmpwrit); } } ssl/record/rec_layer_s3.c:893: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `ssl3_write_pending`. Showing all 5 steps of the trace ssl/record/rec_layer_s3.c:635:1: Parameter `numpipes` 633. } 634. 635. > int do_ssl3_write(SSL *s, int type, const unsigned char *buf, 636. size_t *pipelens, size_t numpipes, 637. int create_empty_fragment, size_t *written) ssl/record/rec_layer_s3.c:893:12: Call 891. 892. /* we now just need to write the buffer */ 893. return ssl3_write_pending(s, type, buf, totlen, written); ^ 894. err: 895. return -1; ssl/record/rec_layer_s3.c:905:1: <LHS trace> 903. * <0 Failure (may be retryable) 904. */ 905. > int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, size_t len, 906. size_t *written) 907. { ssl/record/rec_layer_s3.c:905:1: Parameter `s->rlayer.numwpipes` 903. * <0 Failure (may be retryable) 904. */ 905. > int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, size_t len, 906. size_t *written) 907. { ssl/record/rec_layer_s3.c:924:16: Binary operation: ([0, +oo] - 1):unsigned64 by call to `ssl3_write_pending` 922. /* Loop until we find a buffer we haven't written out yet */ 923. if (SSL3_BUFFER_get_left(&wb[currbuf]) == 0 924. && currbuf < s->rlayer.numwpipes - 1) { ^ 925. currbuf++; 926. continue;
https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/ssl/record/rec_layer_s3.c/#L924
d2a_code_trace_data_43467
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/sm2/sm2_sign.c:350: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_add`. Showing all 19 steps of the trace crypto/sm2/sm2_sign.c:306:5: Call 304. } 305. 306. BN_CTX_start(ctx); ^ 307. t = BN_CTX_get(ctx); 308. x1 = 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/sm2/sm2_sign.c:350:10: Call 348. } 349. 350. if (!BN_mod_add(t, e, x1, order, ctx)) { ^ 351. SM2err(SM2_F_SM2_SIG_VERIFY, ERR_R_BN_LIB); 352. goto done; crypto/bn/bn_mod.c:28:1: Parameter `ctx->stack.depth` 26. } 27. 28. > int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 29. BN_CTX *ctx) 30. { crypto/bn/bn_mod.c:33:12: Call 31. if (!BN_add(r, a, b)) 32. return 0; 33. return BN_nnmod(r, r, m, ctx); ^ 34. } 35. crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth` 207. * If 'dv' or 'rm' is NULL, the respective value is not returned. 208. */ 209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 210. BN_CTX *ctx) 211. { crypto/bn/bn_div.c:229:11: Call 227. } 228. 229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx); ^ 230. 231. if (ret) { crypto/bn/bn_div.c:280:5: Call 278. bn_check_top(rm); 279. 280. BN_CTX_start(ctx); ^ 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_div.c:450:5: Call 448. if (rm != NULL) 449. bn_rshift_fixed_top(rm, snum, norm_shift); 450. BN_CTX_end(ctx); ^ 451. return 1; 452. err: crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_add` 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_43468
static ngx_int_t ngx_http_post_action(ngx_http_request_t *r) { ngx_http_core_loc_conf_t *clcf; clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); if (clcf->post_action.data == NULL) { return NGX_DECLINED; } if (r->post_action && r->uri_changes == 0) { return NGX_DECLINED; } ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "post action: \"%V\"", &clcf->post_action); r->main->count--; r->http_version = NGX_HTTP_VERSION_9; r->header_only = 1; r->post_action = 1; r->read_event_handler = ngx_http_block_reading; if (clcf->post_action.data[0] == '/') { ngx_http_internal_redirect(r, &clcf->post_action, NULL); } else { ngx_http_named_location(r, &clcf->post_action); } return NGX_OK; } src/http/ngx_http_upstream.c:570: error: Integer Overflow L2 ([0, `r->main->count` + 3] - 1):unsigned32 by call to `ngx_http_upstream_connect`. src/http/ngx_http_upstream.c:450:1: Parameter `r->main->count` 448. 449. 450. static void ^ 451. ngx_http_upstream_init_request(ngx_http_request_t *r) 452. { src/http/ngx_http_upstream.c:570:13: Call 568. } 569. 570. ngx_http_upstream_connect(r, u); ^ 571. 572. return; src/http/ngx_http_upstream.c:1091:1: Parameter `r->main->count` 1089. 1090. 1091. static void ^ 1092. ngx_http_upstream_connect(ngx_http_request_t *r, ngx_http_upstream_t *u) 1093. { src/http/ngx_http_upstream.c:1234:5: Call 1232. #endif 1233. 1234. ngx_http_upstream_send_request(r, u); ^ 1235. } 1236. src/http/ngx_http_upstream.c:1376:1: Parameter `r->main->count` 1374. 1375. 1376. static void ^ 1377. ngx_http_upstream_send_request(ngx_http_request_t *r, ngx_http_upstream_t *u) 1378. { src/http/ngx_http_upstream.c:1447:9: Call 1445. */ 1446. 1447. ngx_http_upstream_process_header(r, u); ^ 1448. return; 1449. } src/http/ngx_http_upstream.c:1499:1: Parameter `r->main->count` 1497. 1498. 1499. static void ^ 1500. ngx_http_upstream_process_header(ngx_http_request_t *r, ngx_http_upstream_t *u) 1501. { src/http/ngx_http_upstream.c:1630:13: Call 1628. } 1629. 1630. if (ngx_http_upstream_test_next(r, u) == NGX_OK) { ^ 1631. return; 1632. } src/http/ngx_http_upstream.c:1686:1: Parameter `r->main->count` 1684. 1685. 1686. static ngx_int_t ^ 1687. ngx_http_upstream_test_next(ngx_http_request_t *r, ngx_http_upstream_t *u) 1688. { src/http/ngx_http_upstream.c:1701:13: Call 1699. 1700. if (u->peer.tries > 1 && (u->conf->next_upstream & un->mask)) { 1701. ngx_http_upstream_next(r, u, un->mask); ^ 1702. return NGX_OK; 1703. } src/http/ngx_http_upstream.c:2814:1: Parameter `r->main->count` 2812. 2813. 2814. static void ^ 2815. ngx_http_upstream_next(ngx_http_request_t *r, ngx_http_upstream_t *u, 2816. ngx_uint_t ft_type) src/http/ngx_http_upstream.c:2896:26: Call 2894. if (rc == NGX_OK) { 2895. u->cache_status = NGX_HTTP_CACHE_STALE; 2896. rc = ngx_http_upstream_cache_send(r, u); ^ 2897. } 2898. src/http/ngx_http_upstream.c:803:1: Parameter `r->main->count` 801. 802. 803. static ngx_int_t ^ 804. ngx_http_upstream_cache_send(ngx_http_request_t *r, ngx_http_upstream_t *u) 805. { src/http/ngx_http_upstream.c:836:13: Call 834. if (rc == NGX_OK) { 835. 836. if (ngx_http_upstream_process_headers(r, u) != NGX_OK) { ^ 837. return NGX_DONE; 838. } src/http/ngx_http_upstream.c:1847:1: Parameter `r->main->count` 1845. 1846. 1847. static ngx_int_t ^ 1848. ngx_http_upstream_process_headers(ngx_http_request_t *r, ngx_http_upstream_t *u) 1849. { src/http/ngx_http_upstream.c:1862:9: Call 1860. && !(u->conf->ignore_headers & NGX_HTTP_UPSTREAM_IGN_XA_REDIRECT)) 1861. { 1862. ngx_http_upstream_finalize_request(r, u, NGX_DECLINED); ^ 1863. 1864. part = &u->headers_in.headers.part; src/http/ngx_http_upstream.c:2963:1: Parameter `r->main->count` 2961. 2962. 2963. static void ^ 2964. ngx_http_upstream_finalize_request(ngx_http_request_t *r, 2965. ngx_http_upstream_t *u, ngx_int_t rc) src/http/ngx_http_upstream.c:3094:5: Call 3092. } 3093. 3094. ngx_http_finalize_request(r, rc); ^ 3095. } 3096. src/http/ngx_http_request.c:1912:1: Parameter `r->main->count` 1910. 1911. 1912. void ^ 1913. ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc) 1914. { src/http/ngx_http_request.c:2084:9: Call 2082. } 2083. 2084. if (ngx_http_post_action(r) == NGX_OK) { ^ 2085. return; 2086. } src/http/ngx_http_request.c:2920:1: <LHS trace> 2918. 2919. 2920. static ngx_int_t ^ 2921. ngx_http_post_action(ngx_http_request_t *r) 2922. { src/http/ngx_http_request.c:2920:1: Parameter `r->main->count` 2918. 2919. 2920. static ngx_int_t ^ 2921. ngx_http_post_action(ngx_http_request_t *r) 2922. { src/http/ngx_http_request.c:2938:5: Binary operation: ([0, r->main->count + 3] - 1):unsigned32 by call to `ngx_http_upstream_connect` 2936. "post action: \"%V\"", &clcf->post_action); 2937. 2938. r->main->count--; ^ 2939. 2940. r->http_version = NGX_HTTP_VERSION_9;
https://github.com/nginx/nginx/blob/8cb7134f49bcdded469b3e72415b96794190257e/src/http/ngx_http_request.c/#L2938
d2a_code_trace_data_43469
static int get_certificate_status(const char *serial, CA_DB *db) { char *row[DB_NUMBER], **rrow; int ok = -1, i; size_t serial_len = strlen(serial); for (i = 0; i < DB_NUMBER; i++) row[i] = NULL; row[DB_serial] = app_malloc(serial_len + 2, "row serial#"); if (serial_len % 2) { row[DB_serial][0] = '0'; memcpy(row[DB_serial] + 1, serial, serial_len); row[DB_serial][serial_len + 1] = '\0'; } else { memcpy(row[DB_serial], serial, serial_len); row[DB_serial][serial_len] = '\0'; } make_uppercase(row[DB_serial]); ok = 1; rrow = TXT_DB_get_by_index(db->db, DB_serial, row); if (rrow == NULL) { BIO_printf(bio_err, "Serial %s not present in db.\n", row[DB_serial]); ok = -1; goto end; } else if (rrow[DB_type][0] == DB_TYPE_VAL) { BIO_printf(bio_err, "%s=Valid (%c)\n", row[DB_serial], rrow[DB_type][0]); goto end; } else if (rrow[DB_type][0] == DB_TYPE_REV) { BIO_printf(bio_err, "%s=Revoked (%c)\n", row[DB_serial], rrow[DB_type][0]); goto end; } else if (rrow[DB_type][0] == DB_TYPE_EXP) { BIO_printf(bio_err, "%s=Expired (%c)\n", row[DB_serial], rrow[DB_type][0]); goto end; } else if (rrow[DB_type][0] == DB_TYPE_SUSP) { BIO_printf(bio_err, "%s=Suspended (%c)\n", row[DB_serial], rrow[DB_type][0]); goto end; } else { BIO_printf(bio_err, "%s=Unknown (%c).\n", row[DB_serial], rrow[DB_type][0]); ok = -1; } end: for (i = 0; i < DB_NUMBER; i++) { OPENSSL_free(row[i]); } return ok; } apps/ca.c:2181: error: NULL_DEREFERENCE pointer `row[3]` last assigned on line 2168 could be null and is dereferenced by call to `memcpy()` at line 2181, column 9. Showing all 36 steps of the trace apps/ca.c:2157:1: start of procedure get_certificate_status() 2155. } 2156. 2157. > static int get_certificate_status(const char *serial, CA_DB *db) 2158. { 2159. char *row[DB_NUMBER], **rrow; apps/ca.c:2160:5: 2158. { 2159. char *row[DB_NUMBER], **rrow; 2160. > int ok = -1, i; 2161. size_t serial_len = strlen(serial); 2162. apps/ca.c:2161:5: 2159. char *row[DB_NUMBER], **rrow; 2160. int ok = -1, i; 2161. > size_t serial_len = strlen(serial); 2162. 2163. /* Free Resources */ apps/ca.c:2164:10: 2162. 2163. /* Free Resources */ 2164. > for (i = 0; i < DB_NUMBER; i++) 2165. row[i] = NULL; 2166. apps/ca.c:2164:17: Loop condition is true. Entering loop body 2162. 2163. /* Free Resources */ 2164. for (i = 0; i < DB_NUMBER; i++) ^ 2165. row[i] = NULL; 2166. apps/ca.c:2165:9: 2163. /* Free Resources */ 2164. for (i = 0; i < DB_NUMBER; i++) 2165. > row[i] = NULL; 2166. 2167. /* Malloc needed char spaces */ apps/ca.c:2164:32: 2162. 2163. /* Free Resources */ 2164. > for (i = 0; i < DB_NUMBER; i++) 2165. row[i] = NULL; 2166. apps/ca.c:2164:17: Loop condition is true. Entering loop body 2162. 2163. /* Free Resources */ 2164. for (i = 0; i < DB_NUMBER; i++) ^ 2165. row[i] = NULL; 2166. apps/ca.c:2165:9: 2163. /* Free Resources */ 2164. for (i = 0; i < DB_NUMBER; i++) 2165. > row[i] = NULL; 2166. 2167. /* Malloc needed char spaces */ apps/ca.c:2164:32: 2162. 2163. /* Free Resources */ 2164. > for (i = 0; i < DB_NUMBER; i++) 2165. row[i] = NULL; 2166. apps/ca.c:2164:17: Loop condition is true. Entering loop body 2162. 2163. /* Free Resources */ 2164. for (i = 0; i < DB_NUMBER; i++) ^ 2165. row[i] = NULL; 2166. apps/ca.c:2165:9: 2163. /* Free Resources */ 2164. for (i = 0; i < DB_NUMBER; i++) 2165. > row[i] = NULL; 2166. 2167. /* Malloc needed char spaces */ apps/ca.c:2164:32: 2162. 2163. /* Free Resources */ 2164. > for (i = 0; i < DB_NUMBER; i++) 2165. row[i] = NULL; 2166. apps/ca.c:2164:17: Loop condition is true. Entering loop body 2162. 2163. /* Free Resources */ 2164. for (i = 0; i < DB_NUMBER; i++) ^ 2165. row[i] = NULL; 2166. apps/ca.c:2165:9: 2163. /* Free Resources */ 2164. for (i = 0; i < DB_NUMBER; i++) 2165. > row[i] = NULL; 2166. 2167. /* Malloc needed char spaces */ apps/ca.c:2164:32: 2162. 2163. /* Free Resources */ 2164. > for (i = 0; i < DB_NUMBER; i++) 2165. row[i] = NULL; 2166. apps/ca.c:2164:17: Loop condition is false. Leaving loop 2162. 2163. /* Free Resources */ 2164. for (i = 0; i < DB_NUMBER; i++) ^ 2165. row[i] = NULL; 2166. apps/ca.c:2168:5: 2166. 2167. /* Malloc needed char spaces */ 2168. > row[DB_serial] = app_malloc(serial_len + 2, "row serial#"); 2169. 2170. if (serial_len % 2) { test/testutil/apps_mem.c:14:1: start of procedure app_malloc() 12. /* shim that avoids sucking in too much from apps/apps.c */ 13. 14. > void* app_malloc(int sz, const char *what) 15. { 16. void *vp = OPENSSL_malloc(sz); test/testutil/apps_mem.c:16:5: 14. void* app_malloc(int sz, const char *what) 15. { 16. > void *vp = OPENSSL_malloc(sz); 17. 18. return vp; crypto/mem.c:192:1: start of procedure CRYPTO_malloc() 190. #endif 191. 192. > void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. void *ret = NULL; crypto/mem.c:194:5: 192. void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. > void *ret = NULL; 195. 196. INCREMENT(malloc_count); crypto/mem.c:197:9: Taking true 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:197:32: Taking false branch 195. 196. INCREMENT(malloc_count); 197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 198. return malloc_impl(num, file, line); 199. crypto/mem.c:200:9: Taking false branch 198. return malloc_impl(num, file, line); 199. 200. if (num == 0) ^ 201. return NULL; 202. crypto/mem.c:204:9: Taking true branch 202. 203. FAILTEST(); 204. if (allow_customize) { ^ 205. /* 206. * Disallow customization after the first allocation. We only set this crypto/mem.c:210:9: 208. * allocation. 209. */ 210. > allow_customize = 0; 211. } 212. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:221:5: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:221:19: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:222:5: 220. #else 221. (void)(file); (void)(line); 222. > ret = malloc(num); 223. #endif 224. crypto/mem.c:225:5: 223. #endif 224. 225. > return ret; 226. } 227. crypto/mem.c:226:1: return from a call to CRYPTO_malloc 224. 225. return ret; 226. > } 227. 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) test/testutil/apps_mem.c:18:5: 16. void *vp = OPENSSL_malloc(sz); 17. 18. > return vp; 19. } test/testutil/apps_mem.c:19:1: return from a call to app_malloc 17. 18. return vp; 19. > } apps/ca.c:2170:9: Taking false branch 2168. row[DB_serial] = app_malloc(serial_len + 2, "row serial#"); 2169. 2170. if (serial_len % 2) { ^ 2171. /* 2172. * Set the first char to 0 apps/ca.c:2181:9: 2179. } else { 2180. /* Copy String from serial to row[DB_serial] */ 2181. > memcpy(row[DB_serial], serial, serial_len); 2182. row[DB_serial][serial_len] = '\0'; 2183. }
https://github.com/openssl/openssl/blob/ce506d27ab5e7d17dfe3fe649768a0d19b6c86ee/apps/ca.c/#L2181
d2a_code_trace_data_43470
static void opt_output_file(const char *filename) { AVFormatContext *oc; int use_video, use_audio, use_subtitle; int input_has_video, input_has_audio, input_has_subtitle; AVFormatParameters params, *ap = &params; if (!strcmp(filename, "-")) filename = "pipe:"; oc = avformat_alloc_context(); if (!file_oformat) { file_oformat = guess_format(NULL, filename, NULL); if (!file_oformat) { fprintf(stderr, "Unable to find a suitable output format for '%s'\n", filename); av_exit(1); } } oc->oformat = file_oformat; av_strlcpy(oc->filename, filename, sizeof(oc->filename)); if (!strcmp(file_oformat->name, "ffm") && av_strstart(filename, "http:", NULL)) { int err = read_ffserver_streams(oc, filename); if (err < 0) { print_error(filename, err); av_exit(1); } } else { use_video = file_oformat->video_codec != CODEC_ID_NONE || video_stream_copy || video_codec_name; use_audio = file_oformat->audio_codec != CODEC_ID_NONE || audio_stream_copy || audio_codec_name; use_subtitle = file_oformat->subtitle_codec != CODEC_ID_NONE || subtitle_stream_copy || subtitle_codec_name; if (nb_input_files > 0) { check_audio_video_sub_inputs(&input_has_video, &input_has_audio, &input_has_subtitle); if (!input_has_video) use_video = 0; if (!input_has_audio) use_audio = 0; if (!input_has_subtitle) use_subtitle = 0; } if (audio_disable) { use_audio = 0; } if (video_disable) { use_video = 0; } if (subtitle_disable) { use_subtitle = 0; } if (use_video) { new_video_stream(oc); } if (use_audio) { new_audio_stream(oc); } if (use_subtitle) { new_subtitle_stream(oc); } oc->timestamp = rec_timestamp; for(; metadata_count>0; metadata_count--){ av_metadata_set(&oc->metadata, metadata[metadata_count-1].key, metadata[metadata_count-1].value); } av_metadata_conv(oc, oc->oformat->metadata_conv, NULL); } output_files[nb_output_files++] = oc; if (oc->oformat->flags & AVFMT_NEEDNUMBER) { if (!av_filename_number_test(oc->filename)) { print_error(oc->filename, AVERROR_NUMEXPECTED); av_exit(1); } } if (!(oc->oformat->flags & AVFMT_NOFILE)) { if (!file_overwrite && (strchr(filename, ':') == NULL || filename[1] == ':' || av_strstart(filename, "file:", NULL))) { if (url_exist(filename)) { int c; if (!using_stdin) { fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename); fflush(stderr); c = getchar(); if (toupper(c) != 'Y') { fprintf(stderr, "Not overwriting - exiting\n"); av_exit(1); } } else { fprintf(stderr,"File '%s' already exists. Exiting.\n", filename); av_exit(1); } } } if (url_fopen(&oc->pb, filename, URL_WRONLY) < 0) { fprintf(stderr, "Could not open '%s'\n", filename); av_exit(1); } } memset(ap, 0, sizeof(*ap)); if (av_set_parameters(oc, ap) < 0) { fprintf(stderr, "%s: Invalid encoding parameters\n", oc->filename); av_exit(1); } oc->preload= (int)(mux_preload*AV_TIME_BASE); oc->max_delay= (int)(mux_max_delay*AV_TIME_BASE); oc->loop_output = loop_output; set_context_opts(oc, avformat_opts, AV_OPT_FLAG_ENCODING_PARAM); file_oformat = NULL; file_iformat = NULL; } ffmpeg.c:3268: error: Null Dereference pointer `oc` last assigned on line 3257 could be null and is dereferenced at line 3268, column 5. ffmpeg.c:3247:1: start of procedure opt_output_file() 3245. } 3246. 3247. static void opt_output_file(const char *filename) ^ 3248. { 3249. AVFormatContext *oc; ffmpeg.c:3252:5: 3250. int use_video, use_audio, use_subtitle; 3251. int input_has_video, input_has_audio, input_has_subtitle; 3252. AVFormatParameters params, *ap = &params; ^ 3253. 3254. if (!strcmp(filename, "-")) ffmpeg.c:3254:10: Taking false branch 3252. AVFormatParameters params, *ap = &params; 3253. 3254. if (!strcmp(filename, "-")) ^ 3255. filename = "pipe:"; 3256. ffmpeg.c:3257:5: 3255. filename = "pipe:"; 3256. 3257. oc = avformat_alloc_context(); ^ 3258. 3259. if (!file_oformat) { libavformat/options.c:77:1: start of procedure avformat_alloc_context() 75. } 76. 77. AVFormatContext *avformat_alloc_context(void) ^ 78. { 79. AVFormatContext *ic; libavformat/options.c:80:5: 78. { 79. AVFormatContext *ic; 80. ic = av_malloc(sizeof(AVFormatContext)); ^ 81. if (!ic) return ic; 82. avformat_get_context_defaults(ic); libavutil/mem.c:47:1: start of procedure av_malloc() 45. linker will do it automatically. */ 46. 47. void *av_malloc(unsigned int size) ^ 48. { 49. void *ptr = NULL; libavutil/mem.c:49:5: 47. void *av_malloc(unsigned int size) 48. { 49. void *ptr = NULL; ^ 50. #if CONFIG_MEMALIGN_HACK 51. long diff; libavutil/mem.c:55:8: Taking false branch 53. 54. /* let's disallow possible ambiguous cases */ 55. if(size > (INT_MAX-16) ) ^ 56. return NULL; 57. libavutil/mem.c:66:9: Taking false branch 64. ((char*)ptr)[-1]= diff; 65. #elif HAVE_POSIX_MEMALIGN 66. if (posix_memalign(&ptr,16,size)) ^ 67. ptr = NULL; 68. #elif HAVE_MEMALIGN libavutil/mem.c:99:5: 97. ptr = malloc(size); 98. #endif 99. return ptr; ^ 100. } 101. libavutil/mem.c:100:1: return from a call to av_malloc 98. #endif 99. return ptr; 100. } ^ 101. 102. void *av_realloc(void *ptr, unsigned int size) libavformat/options.c:81:10: Taking true branch 79. AVFormatContext *ic; 80. ic = av_malloc(sizeof(AVFormatContext)); 81. if (!ic) return ic; ^ 82. avformat_get_context_defaults(ic); 83. ic->av_class = &av_format_context_class; libavformat/options.c:81:14: 79. AVFormatContext *ic; 80. ic = av_malloc(sizeof(AVFormatContext)); 81. if (!ic) return ic; ^ 82. avformat_get_context_defaults(ic); 83. ic->av_class = &av_format_context_class; libavformat/options.c:85:1: return from a call to avformat_alloc_context 83. ic->av_class = &av_format_context_class; 84. return ic; 85. } ^ 86. 87. #if LIBAVFORMAT_VERSION_MAJOR < 53 ffmpeg.c:3259:10: Taking true branch 3257. oc = avformat_alloc_context(); 3258. 3259. if (!file_oformat) { ^ 3260. file_oformat = guess_format(NULL, filename, NULL); 3261. if (!file_oformat) { ffmpeg.c:3260:9: Skipping guess_format(): empty list of specs 3258. 3259. if (!file_oformat) { 3260. file_oformat = guess_format(NULL, filename, NULL); ^ 3261. if (!file_oformat) { 3262. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", ffmpeg.c:3261:14: Taking true branch 3259. if (!file_oformat) { 3260. file_oformat = guess_format(NULL, filename, NULL); 3261. if (!file_oformat) { ^ 3262. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", 3263. filename); ffmpeg.c:3262:13: 3260. file_oformat = guess_format(NULL, filename, NULL); 3261. if (!file_oformat) { 3262. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", ^ 3263. filename); 3264. av_exit(1); ffmpeg.c:3264:13: Skipping av_exit(): empty list of specs 3262. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", 3263. filename); 3264. av_exit(1); ^ 3265. } 3266. } ffmpeg.c:3268:5: 3266. } 3267. 3268. oc->oformat = file_oformat; ^ 3269. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); 3270.
https://github.com/libav/libav/blob/9aaa2077e5879b153d2ce6bea2e42f0c349a083f/ffmpeg.c/#L3268
d2a_code_trace_data_43471
static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr, int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], int ref_mv_scale, int flags, int size, int h) { MotionEstContext * const c= &s->me; int best[2]={0, 0}; int d; int dmin; int map_generation; int penalty_factor; const int ref_mv_stride= s->mb_stride; const int ref_mv_xy= s->mb_x + s->mb_y*ref_mv_stride; me_cmp_func cmpf, chroma_cmpf; LOAD_COMMON LOAD_COMMON2 if(c->pre_pass){ penalty_factor= c->pre_penalty_factor; cmpf= s->dsp.me_pre_cmp[size]; chroma_cmpf= s->dsp.me_pre_cmp[size+1]; }else{ penalty_factor= c->penalty_factor; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; } map_generation= update_map_generation(c); assert(cmpf); dmin= cmp(s, 0, 0, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags); map[0]= map_generation; score_map[0]= dmin; if((s->pict_type == FF_B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0) dmin += (mv_penalty[pred_x] + mv_penalty[pred_y])*penalty_factor; if (s->first_slice_line) { CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) }else{ if(dmin<((h*h*s->avctx->mv0_threshold)>>8) && ( P_LEFT[0] |P_LEFT[1] |P_TOP[0] |P_TOP[1] |P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){ *mx_ptr= 0; *my_ptr= 0; c->skip=1; return dmin; } CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift) CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift) CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) } if(dmin>h*h*4){ if(c->pre_pass){ CHECK_CLIPPED_MV((last_mv[ref_mv_xy-1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy-1][1]*ref_mv_scale + (1<<15))>>16) if(!s->first_slice_line) CHECK_CLIPPED_MV((last_mv[ref_mv_xy-ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy-ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) }else{ CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) if(s->mb_y+1<s->end_mb_y) CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) } } if(c->avctx->last_predictor_count){ const int count= c->avctx->last_predictor_count; const int xstart= FFMAX(0, s->mb_x - count); const int ystart= FFMAX(0, s->mb_y - count); const int xend= FFMIN(s->mb_width , s->mb_x + count + 1); const int yend= FFMIN(s->mb_height, s->mb_y + count + 1); int mb_y; for(mb_y=ystart; mb_y<yend; mb_y++){ int mb_x; for(mb_x=xstart; mb_x<xend; mb_x++){ const int xy= mb_x + 1 + (mb_y + 1)*ref_mv_stride; int mx= (last_mv[xy][0]*ref_mv_scale + (1<<15))>>16; int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16; if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue; CHECK_MV(mx,my) } } } dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); *mx_ptr= best[0]; *my_ptr= best[1]; return dmin; } libavcodec/motion_est_template.c:1061: error: Uninitialized Value The value read from ymin was never initialized. libavcodec/motion_est_template.c:1061:9: 1059. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) ) 1060. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) ) 1061. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, ^ 1062. (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) 1063. CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1061
d2a_code_trace_data_43472
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:389: error: Null Dereference pointer `sha` last assigned on line 377 could be null and is dereferenced by call to `av_sha_init()` at line 389, column 5. libavformat/rtmpproto.c:370:1: start of procedure rtmp_calc_digest() 368. * @param dst buffer where calculated digest will be stored (32 bytes) 369. */ 370. static void rtmp_calc_digest(const uint8_t *src, int len, int gap, ^ 371. const uint8_t *key, int keylen, uint8_t *dst) 372. { libavformat/rtmpproto.c:374:5: 372. { 373. struct AVSHA *sha; 374. uint8_t hmac_buf[64+32] = {0}; ^ 375. int i; 376. libavformat/rtmpproto.c:377:5: 375. int i; 376. 377. sha = av_mallocz(av_sha_size); ^ 378. 379. if (keylen < 64) { libavutil/mem.c:154:1: start of procedure av_mallocz() 152. } 153. 154. void *av_mallocz(size_t size) ^ 155. { 156. void *ptr = av_malloc(size); libavutil/mem.c:156:5: 154. void *av_mallocz(size_t size) 155. { 156. void *ptr = av_malloc(size); ^ 157. if (ptr) 158. 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: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) libavutil/mem.c:157:9: Taking false branch 155. { 156. void *ptr = av_malloc(size); 157. if (ptr) ^ 158. memset(ptr, 0, size); 159. return ptr; libavutil/mem.c:159:5: 157. if (ptr) 158. memset(ptr, 0, size); 159. return ptr; ^ 160. } 161. libavutil/mem.c:160:1: return from a call to av_mallocz 158. memset(ptr, 0, size); 159. return ptr; 160. } ^ 161. 162. char *av_strdup(const char *s) libavformat/rtmpproto.c:379:9: Taking true branch 377. sha = av_mallocz(av_sha_size); 378. 379. if (keylen < 64) { ^ 380. memcpy(hmac_buf, key, keylen); 381. } else { libavformat/rtmpproto.c:380:9: 378. 379. if (keylen < 64) { 380. memcpy(hmac_buf, key, keylen); ^ 381. } else { 382. av_sha_init(sha, 256); libavformat/rtmpproto.c:386:10: 384. av_sha_final(sha, hmac_buf); 385. } 386. for (i = 0; i < 64; i++) ^ 387. hmac_buf[i] ^= HMAC_IPAD_VAL; 388. libavformat/rtmpproto.c:386:17: Loop condition is true. Entering loop body 384. av_sha_final(sha, hmac_buf); 385. } 386. for (i = 0; i < 64; i++) ^ 387. hmac_buf[i] ^= HMAC_IPAD_VAL; 388. libavformat/rtmpproto.c:387:9: 385. } 386. for (i = 0; i < 64; i++) 387. hmac_buf[i] ^= HMAC_IPAD_VAL; ^ 388. 389. av_sha_init(sha, 256); libavformat/rtmpproto.c:386:25: 384. av_sha_final(sha, hmac_buf); 385. } 386. for (i = 0; i < 64; i++) ^ 387. hmac_buf[i] ^= HMAC_IPAD_VAL; 388. libavformat/rtmpproto.c:386:17: Loop condition is false. Leaving loop 384. av_sha_final(sha, hmac_buf); 385. } 386. for (i = 0; i < 64; i++) ^ 387. hmac_buf[i] ^= HMAC_IPAD_VAL; 388. libavformat/rtmpproto.c:389:5: 387. hmac_buf[i] ^= HMAC_IPAD_VAL; 388. 389. av_sha_init(sha, 256); ^ 390. av_sha_update(sha, hmac_buf, 64); 391. if (gap <= 0) { libavutil/sha.c:245:1: start of procedure av_sha_init() 243. 244. 245. int av_sha_init(AVSHA* ctx, int bits) ^ 246. { 247. ctx->digest_len = bits >> 5; libavutil/sha.c:247:5: 245. int av_sha_init(AVSHA* ctx, int bits) 246. { 247. ctx->digest_len = bits >> 5; ^ 248. switch (bits) { 249. case 160: // SHA-1
https://github.com/libav/libav/blob/3ffe32eb96e2414bdd87b353953d77fb83eca8ae/libavformat/rtmpproto.c/#L389
d2a_code_trace_data_43473
static ngx_int_t ngx_http_post_action(ngx_http_request_t *r) { ngx_http_core_loc_conf_t *clcf; clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module); if (clcf->post_action.data == NULL) { return NGX_DECLINED; } if (r->post_action && r->uri_changes == 0) { return NGX_DECLINED; } ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0, "post action: \"%V\"", &clcf->post_action); r->main->count--; r->http_version = NGX_HTTP_VERSION_9; r->header_only = 1; r->post_action = 1; r->read_event_handler = ngx_http_block_reading; if (clcf->post_action.data[0] == '/') { ngx_http_internal_redirect(r, &clcf->post_action, NULL); } else { ngx_http_named_location(r, &clcf->post_action); } return NGX_OK; } src/http/ngx_http_upstream.c:1709: error: Integer Overflow L2 ([0, `r->main->count` + 8] - 1):unsigned32 by call to `ngx_http_upstream_process_body_in_memory`. src/http/ngx_http_upstream.c:1527:1: Parameter `r->main->count` 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:1667:9: Call 1665. } 1666. 1667. if (ngx_http_upstream_process_headers(r, u) != NGX_OK) { ^ 1668. return; 1669. } src/http/ngx_http_upstream.c:1881:1: Parameter `r->main->count` 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:1709:5: Call 1707. u->read_event_handler = ngx_http_upstream_process_body_in_memory; 1708. 1709. ngx_http_upstream_process_body_in_memory(r, u); ^ 1710. } 1711. src/http/ngx_http_upstream.c:2003:1: Parameter `r->main->count` 2001. 2002. 2003. static void ^ 2004. ngx_http_upstream_process_body_in_memory(ngx_http_request_t *r, 2005. ngx_http_upstream_t *u) src/http/ngx_http_upstream.c:2021:9: Call 2019. if (rev->timedout) { 2020. ngx_connection_error(c, NGX_ETIMEDOUT, "upstream timed out"); 2021. ngx_http_upstream_finalize_request(r, u, NGX_HTTP_GATEWAY_TIME_OUT); ^ 2022. return; 2023. } src/http/ngx_http_upstream.c:3269:1: Parameter `r->main->count` 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->main->count` 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:2236:13: Call 2234. || c->error) 2235. { 2236. if (ngx_http_post_action(r) == NGX_OK) { ^ 2237. return; 2238. } src/http/ngx_http_request.c:3256:1: <LHS trace> 3254. 3255. 3256. static ngx_int_t ^ 3257. ngx_http_post_action(ngx_http_request_t *r) 3258. { src/http/ngx_http_request.c:3256:1: Parameter `r->main->count` 3254. 3255. 3256. static ngx_int_t ^ 3257. ngx_http_post_action(ngx_http_request_t *r) 3258. { src/http/ngx_http_request.c:3274:5: Binary operation: ([0, r->main->count + 8] - 1):unsigned32 by call to `ngx_http_upstream_process_body_in_memory` 3272. "post action: \"%V\"", &clcf->post_action); 3273. 3274. r->main->count--; ^ 3275. 3276. r->http_version = NGX_HTTP_VERSION_9;
https://github.com/nginx/nginx/blob/416b922bd2c285551d195c1f33a3736775ea45e9/src/http/ngx_http_request.c/#L3274
d2a_code_trace_data_43474
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:88: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `SSL_free`. Showing all 17 steps of the trace test/dtlstest.c:63:10: Call 61. 62. /* BIO is freed by create_ssl_connection on error */ 63. if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl1, &clientssl1, ^ 64. NULL, c_to_s_fbio))) 65. goto end; test/ssltestlib.c:559:15: Call 557. if (*sssl != NULL) 558. serverssl = *sssl; 559. else if (!TEST_ptr(serverssl = SSL_new(serverctx))) ^ 560. goto error; 561. if (*cssl != NULL) 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/dtlstest.c:88:5: Call 86. testresult = 1; 87. end: 88. SSL_free(serverssl1); ^ 89. SSL_free(clientssl1); 90. SSL_CTX_free(sctx); 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_43475
int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) { PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | (diff > (0 - (PTRDIFF_T)len))); assert(!overlapped); return overlapped; } crypto/evp/bio_enc.c:183: error: INTEGER_OVERFLOW_L2 (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate`. Showing all 9 steps of the trace crypto/evp/bio_enc.c:183:22: Call 181. int j = outl - blocksize, buf_len; 182. 183. if (!EVP_CipherUpdate(ctx->cipher, ^ 184. (unsigned char *)out, &buf_len, 185. ctx->read_start, i > j ? j : i)) { crypto/evp/evp_enc.c:205:1: Parameter `ctx->cipher->block_size` 203. } 204. 205. > int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 206. const unsigned char *in, int inl) 207. { crypto/evp/evp_enc.c:211:16: Call 209. return EVP_EncryptUpdate(ctx, out, outl, in, inl); 210. else 211. return EVP_DecryptUpdate(ctx, out, outl, in, inl); ^ 212. } 213. crypto/evp/evp_enc.c:416:1: Parameter `ctx->cipher->block_size` 414. } 415. 416. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 417. const unsigned char *in, int inl) 418. { crypto/evp/evp_enc.c:422:5: Assignment 420. unsigned int b; 421. 422. b = ctx->cipher->block_size; ^ 423. 424. if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) { crypto/evp/evp_enc.c:452:16: Call 450. /* see comment about PTRDIFF_T comparison above */ 451. if (((PTRDIFF_T)out == (PTRDIFF_T)in) 452. || is_partially_overlapping(out, in, b)) { ^ 453. EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING); 454. return 0; crypto/evp/evp_enc.c:279:1: <RHS trace> 277. #endif 278. 279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 280. { 281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:279:1: Parameter `len` 277. #endif 278. 279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len) 280. { 281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2; crypto/evp/evp_enc.c:288:50: Binary operation: (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate` 286. */ 287. int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) | 288. (diff > (0 - (PTRDIFF_T)len))); ^ 289. assert(!overlapped); 290. return overlapped;
https://github.com/openssl/openssl/blob/7141ba31969d0b378d08104a51f8f99b9187b9d5/crypto/evp/evp_enc.c/#L288
d2a_code_trace_data_43476
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) { int line_size; int sample_size = av_get_bytes_per_sample(sample_fmt); int planar = av_sample_fmt_is_planar(sample_fmt); if (!sample_size || nb_samples <= 0 || nb_channels <= 0) return AVERROR(EINVAL); if (!align) { if (nb_samples > INT_MAX - 31) return AVERROR(EINVAL); align = 1; nb_samples = FFALIGN(nb_samples, 32); } if (nb_channels > INT_MAX / align || (int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size) return AVERROR(EINVAL); line_size = planar ? FFALIGN(nb_samples * sample_size, align) : FFALIGN(nb_samples * sample_size * nb_channels, align); if (linesize) *linesize = line_size; return planar ? line_size * nb_channels : line_size; } libavresample/utils.c:391: error: Integer Overflow L2 ([1, 2147483616] + 32):signed32 by call to `ff_audio_data_copy`. libavresample/utils.c:367:15: Call 365. if (input) { 366. /* initialize input_buffer with input data */ 367. ret = ff_audio_data_init(&input_buffer, input, in_plane_size, ^ 368. avr->in_channels, in_samples, 369. avr->in_sample_fmt, 1, "input"); libavresample/audio_data.c:65:1: Parameter `a->nb_samples` 63. } 64. 65. int ff_audio_data_init(AudioData *a, uint8_t **src, int plane_size, int channels, ^ 66. int nb_samples, enum AVSampleFormat sample_fmt, 67. int read_only, const char *name) libavresample/utils.c:391:19: Call 389. * samples to the output fifo */ 390. av_dlog(avr, "[copy] %s to out_buffer\n", current_buffer->name); 391. ret = ff_audio_data_copy(avr->out_buffer, current_buffer, ^ 392. &avr->ch_map_info); 393. if (ret < 0) libavresample/audio_data.c:216:1: Parameter `src->nb_samples` 214. } 215. 216. int ff_audio_data_copy(AudioData *dst, AudioData *src, ChannelMapInfo *map) ^ 217. { 218. int ret, p; libavresample/audio_data.c:236:11: Call 234. 235. /* reallocate output if necessary */ 236. ret = ff_audio_data_realloc(dst, src->nb_samples); ^ 237. if (ret < 0) 238. return ret; libavresample/audio_data.c:153:1: Parameter `nb_samples` 151. } 152. 153. int ff_audio_data_realloc(AudioData *a, int nb_samples) ^ 154. { 155. int ret, new_buf_size, plane_size, p; libavresample/audio_data.c:165:20: Call 163. return AVERROR(EINVAL); 164. 165. new_buf_size = av_samples_get_buffer_size(&plane_size, ^ 166. a->allocated_channels, nb_samples, 167. a->sample_fmt, 0); libavutil/samplefmt.c:108:1: <LHS trace> 106. } 107. 108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, ^ 109. enum AVSampleFormat sample_fmt, int align) 110. { libavutil/samplefmt.c:108:1: Parameter `nb_samples` 106. } 107. 108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, ^ 109. enum AVSampleFormat sample_fmt, int align) 110. { libavutil/samplefmt.c:124:9: Binary operation: ([1, 2147483616] + 32):signed32 by call to `ff_audio_data_copy` 122. return AVERROR(EINVAL); 123. align = 1; 124. nb_samples = FFALIGN(nb_samples, 32); ^ 125. } 126.
https://github.com/libav/libav/blob/0e830094ad0dc251613a0aa3234d9c5c397e02e6/libavutil/samplefmt.c/#L124
d2a_code_trace_data_43477
static int parse_oct(const char *t[], PROPERTY_DEFINITION *res) { const char *s = *t; int64_t v = 0; if (*s == '9' || *s == '8' || !ossl_isdigit(*s)) return 0; do { v = (v << 3) + (*s - '0'); } while (ossl_isdigit(*++s) && *s != '9' && *s != '8'); if (!ossl_isspace(*s) && *s != '\0' && *s != ',') { PROPerr(PROP_F_PARSE_OCT, PROP_R_NOT_AN_OCTAL_DIGIT); return 0; } *t = skip_space(s); res->type = PROPERTY_TYPE_NUMBER; res->v.int_val = v; return 1; } test/property_test.c:341: error: BUFFER_OVERRUN_L3 Offset: [2, +oo] (⇐ [1, +oo] + 1) Size: [1, 50] by call to `ossl_method_store_add`. Showing all 23 steps of the trace test/property_test.c:324:1: Array declaration 322. } 323. 324. > static int test_query_cache_stochastic(void) 325. { 326. const int max = 10000, tail = 10; test/property_test.c:341:14: Call 339. v[i] = 2 * i; 340. BIO_snprintf(buf, sizeof(buf), "n=%d\n", i); 341. if (!TEST_true(ossl_method_store_add(store, i, buf, "abc", NULL)) ^ 342. || !TEST_true(ossl_method_store_cache_set(store, i, buf, v + i)) 343. || !TEST_true(ossl_method_store_cache_set(store, i, "n=1234", crypto/property/property.c:186:1: Parameter `*properties` 184. } 185. 186. > int ossl_method_store_add(OSSL_METHOD_STORE *store, 187. int nid, const char *properties, 188. void *method, void (*method_destruct)(void *)) crypto/property/property.c:215:33: Call 213. ossl_method_cache_flush(store, nid); 214. if ((impl->properties = ossl_prop_defn_get(properties)) == NULL) { 215. if ((impl->properties = ossl_parse_property(properties)) == NULL) ^ 216. goto err; 217. ossl_prop_defn_set(properties, impl->properties); crypto/property/property_parse.c:315:1: Parameter `*defn` 313. } 314. 315. > OSSL_PROPERTY_LIST *ossl_parse_property(const char *defn) 316. { 317. PROPERTY_DEFINITION *prop = NULL; crypto/property/property_parse.c:320:5: Assignment 318. OSSL_PROPERTY_LIST *res = NULL; 319. STACK_OF(PROPERTY_DEFINITION) *sk; 320. const char *s = defn; ^ 321. int done; 322. crypto/property/property_parse.c:326:9: Call 324. return NULL; 325. 326. s = skip_space(s); ^ 327. done = *s == '\0'; 328. while (!done) { crypto/property/property_parse.c:50:1: Parameter `*s` 48. DEFINE_STACK_OF(PROPERTY_DEFINITION) 49. 50. > static const char *skip_space(const char *s) 51. { 52. while (ossl_isspace(*s)) crypto/property/property_parse.c:54:5: Assignment 52. while (ossl_isspace(*s)) 53. s++; 54. return s; ^ 55. } 56. crypto/property/property_parse.c:326:5: Assignment 324. return NULL; 325. 326. s = skip_space(s); ^ 327. done = *s == '\0'; 328. while (!done) { crypto/property/property_parse.c:333:14: Call 331. goto err; 332. memset(&prop->v, 0, sizeof(prop->v)); 333. if (!parse_name(&s, 1, &prop->name_idx)) ^ 334. goto err; 335. prop->oper = PROPERTY_OPER_EQ; crypto/property/property_parse.c:81:1: Parameter `**t` 79. } 80. 81. > static int parse_name(const char *t[], int create, OSSL_PROPERTY_IDX *idx) 82. { 83. char name[100]; crypto/property/property_parse.c:340:13: Call 338. goto err; 339. } 340. if (match_ch(&s, '=')) { ^ 341. if (!parse_value(&s, prop, 1)) { 342. PROPerr(PROP_F_OSSL_PARSE_PROPERTY, PROP_R_NO_VALUE); crypto/property/property_parse.c:57:1: Parameter `**t` 55. } 56. 57. > static int match_ch(const char *t[], char m) 58. { 59. const char *s = *t; crypto/property/property_parse.c:341:18: Call 339. } 340. if (match_ch(&s, '=')) { 341. if (!parse_value(&s, prop, 1)) { ^ 342. PROPerr(PROP_F_OSSL_PARSE_PROPERTY, PROP_R_NO_VALUE); 343. goto err; crypto/property/property_parse.c:244:1: Parameter `**t` 242. } 243. 244. > static int parse_value(const char *t[], PROPERTY_DEFINITION *res, int create) 245. { 246. const char *s = *t; crypto/property/property_parse.c:246:5: Assignment 244. static int parse_value(const char *t[], PROPERTY_DEFINITION *res, int create) 245. { 246. const char *s = *t; ^ 247. int r = 0; 248. crypto/property/property_parse.c:263:9: Assignment 261. r = parse_hex(&s, res); 262. } else if (*s == '0' && ossl_isdigit(s[1])) { 263. s++; ^ 264. r = parse_oct(&s, res); 265. } else if (ossl_isdigit(*s)) { crypto/property/property_parse.c:264:13: Call 262. } else if (*s == '0' && ossl_isdigit(s[1])) { 263. s++; 264. r = parse_oct(&s, res); ^ 265. } else if (ossl_isdigit(*s)) { 266. return parse_number(t, res); crypto/property/property_parse.c:163:1: <Length trace> 161. } 162. 163. > static int parse_oct(const char *t[], PROPERTY_DEFINITION *res) 164. { 165. const char *s = *t; crypto/property/property_parse.c:163:1: Parameter `**t` 161. } 162. 163. > static int parse_oct(const char *t[], PROPERTY_DEFINITION *res) 164. { 165. const char *s = *t; crypto/property/property_parse.c:165:5: Assignment 163. static int parse_oct(const char *t[], PROPERTY_DEFINITION *res) 164. { 165. const char *s = *t; ^ 166. int64_t v = 0; 167. crypto/property/property_parse.c:172:14: Array access: Offset: [2, +oo] (⇐ [1, +oo] + 1) Size: [1, 50] by call to `ossl_method_store_add` 170. do { 171. v = (v << 3) + (*s - '0'); 172. } while (ossl_isdigit(*++s) && *s != '9' && *s != '8'); ^ 173. if (!ossl_isspace(*s) && *s != '\0' && *s != ',') { 174. PROPerr(PROP_F_PARSE_OCT, PROP_R_NOT_AN_OCTAL_DIGIT);
https://github.com/openssl/openssl/blob/4460ad90af0338abe31286f29b36baf2e41abf19/crypto/property/property_parse.c/#L172
d2a_code_trace_data_43478
static void pred8x8l_vertical_left_c(uint8_t *src, int has_topleft, int has_topright, int stride) { PREDICT_8x8_LOAD_TOP; PREDICT_8x8_LOAD_TOPRIGHT; SRC(0,0)= (t0 + t1 + 1) >> 1; SRC(0,1)= (t0 + 2*t1 + t2 + 2) >> 2; SRC(0,2)=SRC(1,0)= (t1 + t2 + 1) >> 1; SRC(0,3)=SRC(1,1)= (t1 + 2*t2 + t3 + 2) >> 2; SRC(0,4)=SRC(1,2)=SRC(2,0)= (t2 + t3 + 1) >> 1; SRC(0,5)=SRC(1,3)=SRC(2,1)= (t2 + 2*t3 + t4 + 2) >> 2; SRC(0,6)=SRC(1,4)=SRC(2,2)=SRC(3,0)= (t3 + t4 + 1) >> 1; SRC(0,7)=SRC(1,5)=SRC(2,3)=SRC(3,1)= (t3 + 2*t4 + t5 + 2) >> 2; SRC(1,6)=SRC(2,4)=SRC(3,2)=SRC(4,0)= (t4 + t5 + 1) >> 1; SRC(1,7)=SRC(2,5)=SRC(3,3)=SRC(4,1)= (t4 + 2*t5 + t6 + 2) >> 2; SRC(2,6)=SRC(3,4)=SRC(4,2)=SRC(5,0)= (t5 + t6 + 1) >> 1; SRC(2,7)=SRC(3,5)=SRC(4,3)=SRC(5,1)= (t5 + 2*t6 + t7 + 2) >> 2; SRC(3,6)=SRC(4,4)=SRC(5,2)=SRC(6,0)= (t6 + t7 + 1) >> 1; SRC(3,7)=SRC(4,5)=SRC(5,3)=SRC(6,1)= (t6 + 2*t7 + t8 + 2) >> 2; SRC(4,6)=SRC(5,4)=SRC(6,2)=SRC(7,0)= (t7 + t8 + 1) >> 1; SRC(4,7)=SRC(5,5)=SRC(6,3)=SRC(7,1)= (t7 + 2*t8 + t9 + 2) >> 2; SRC(5,6)=SRC(6,4)=SRC(7,2)= (t8 + t9 + 1) >> 1; SRC(5,7)=SRC(6,5)=SRC(7,3)= (t8 + 2*t9 + t10 + 2) >> 2; SRC(6,6)=SRC(7,4)= (t9 + t10 + 1) >> 1; SRC(6,7)=SRC(7,5)= (t9 + 2*t10 + t11 + 2) >> 2; SRC(7,6)= (t10 + t11 + 1) >> 1; SRC(7,7)= (t10 + 2*t11 + t12 + 2) >> 2; } libavcodec/h264pred.c:947: error: Uninitialized Value The value read from t7 was never initialized. libavcodec/h264pred.c:947:32: 945. SRC(2,7)=SRC(3,5)=SRC(4,3)=SRC(5,1)= (t5 + 2*t6 + t7 + 2) >> 2; 946. SRC(3,6)=SRC(4,4)=SRC(5,2)=SRC(6,0)= (t6 + t7 + 1) >> 1; 947. SRC(3,7)=SRC(4,5)=SRC(5,3)=SRC(6,1)= (t6 + 2*t7 + t8 + 2) >> 2; ^ 948. SRC(4,6)=SRC(5,4)=SRC(6,2)=SRC(7,0)= (t7 + t8 + 1) >> 1; 949. SRC(4,7)=SRC(5,5)=SRC(6,3)=SRC(7,1)= (t7 + 2*t8 + t9 + 2) >> 2;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264pred.c/#L947
d2a_code_trace_data_43479
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/ec/ecdsa_ossl.c:277: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `ecdsa_sign_setup`. Showing all 51 steps of the trace crypto/ec/ecdsa_ossl.c:211:1: Parameter `eckey->group->order->top` 209. } 210. 211. > ECDSA_SIG *ossl_ecdsa_sign_sig(const unsigned char *dgst, int dgst_len, 212. const BIGNUM *in_kinv, const BIGNUM *in_r, 213. EC_KEY *eckey) crypto/ec/ecdsa_ossl.c:260:9: Call 258. goto err; 259. } 260. i = BN_num_bits(order); ^ 261. /* 262. * Need to truncate digest if it is too long: first truncate whole 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:842:1: Parameter `a->top` 840. } 841. 842. > int BN_is_zero(const BIGNUM *a) 843. { 844. return a->top == 0; crypto/ec/ecdsa_ossl.c:277:18: Call 275. do { 276. if (in_kinv == NULL || in_r == NULL) { 277. if (!ecdsa_sign_setup(eckey, ctx, &kinv, &ret->r, dgst, dgst_len)) { ^ 278. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_ECDSA_LIB); 279. goto err; crypto/ec/ecdsa_ossl.c:34:1: Parameter `eckey->group->order->top` 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:82:18: Call 80. 81. /* Preallocate space */ 82. order_bits = BN_num_bits(order); ^ 83. if (!BN_set_bit(k, order_bits) 84. || !BN_set_bit(r, order_bits) 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:842:1: Parameter `a->top` 840. } 841. 842. > int BN_is_zero(const BIGNUM *a) 843. { 844. return a->top == 0; 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:182:1: Parameter `range->top` 180. } 181. 182. > int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range) 183. { 184. return bnrand_range(PRIVATE, r, range); 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:120:14: Call 118. * conditional copy. 119. */ 120. if (!BN_add(r, k, order) ^ 121. || !BN_add(X, r, order) 122. || !BN_copy(k, BN_num_bits(r) > order_bits ? r : X)) crypto/bn/bn_add.c:14:1: Parameter `b->top` 12. 13. /* signed add of b to a. */ 14. > int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 15. { 16. int ret, r_neg, cmp_res; crypto/ec/ecdsa_ossl.c:121:17: Call 119. */ 120. if (!BN_add(r, k, order) 121. || !BN_add(X, r, order) ^ 122. || !BN_copy(k, BN_num_bits(r) > order_bits ? r : X)) 123. goto err; crypto/bn/bn_add.c:14:1: Parameter `b->top` 12. 13. /* signed add of b to a. */ 14. > int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 15. { 16. int ret, r_neg, cmp_res; crypto/ec/ecdsa_ossl.c:126:14: Call 124. 125. /* compute r the x-coordinate of generator * k */ 126. if (!EC_POINT_mul(group, tmp_point, k, NULL, NULL, ctx)) { ^ 127. ECerr(EC_F_ECDSA_SIGN_SETUP, ERR_R_EC_LIB); 128. goto err; crypto/ec/ec_lib.c:922:1: Parameter `group->order->top` 920. } 921. 922. > int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, 923. const EC_POINT *point, const BIGNUM *p_scalar, BN_CTX *ctx) 924. { crypto/ec/ec_lib.c:933:12: Call 931. scalars[0] = p_scalar; 932. 933. return EC_POINTs_mul(group, r, g_scalar, ^ 934. (point != NULL 935. && p_scalar != NULL), points, scalars, ctx); crypto/ec/ec_lib.c:911:1: Parameter `group->order->top` 909. */ 910. 911. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 912. size_t num, const EC_POINT *points[], 913. const BIGNUM *scalars[], BN_CTX *ctx) crypto/ec/ecdsa_ossl.c:149:14: Call 147. } 148. #endif 149. if (!BN_nnmod(r, X, order, ctx)) { ^ 150. ECerr(EC_F_ECDSA_SIGN_SETUP, ERR_R_BN_LIB); 151. goto err; crypto/bn/bn_mod.c:13:1: Parameter `d->top` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:137:1: Parameter `divisor->top` 135. * If 'dv' or 'rm' is NULL, the respective value is not returned. 136. */ 137. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 138. BN_CTX *ctx) 139. { crypto/ec/ecdsa_ossl.c:168:18: Call 166. goto err; 167. } 168. if (!BN_mod_sub(X, order, X, order, ctx)) { ^ 169. ECerr(EC_F_ECDSA_SIGN_SETUP, ERR_R_BN_LIB); 170. goto err; crypto/bn/bn_mod.c:50:1: Parameter `a->top` 48. } 49. 50. > int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 51. BN_CTX *ctx) 52. { crypto/bn/bn_mod.c:53:10: Call 51. BN_CTX *ctx) 52. { 53. if (!BN_sub(r, a, b)) ^ 54. return 0; 55. return BN_nnmod(r, r, m, ctx); crypto/bn/bn_add.c:45:1: Parameter `a->top` 43. 44. /* signed sub of b from a. */ 45. > int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 46. { 47. int ret, r_neg, cmp_res; crypto/ec/ecdsa_ossl.c:173:18: Call 171. } 172. BN_set_flags(X, BN_FLG_CONSTTIME); 173. if (!BN_mod_exp_mont_consttime(k, k, X, order, ctx, ^ 174. group->mont_data)) { 175. ECerr(EC_F_ECDSA_SIGN_SETUP, ERR_R_BN_LIB); crypto/bn/bn_exp.c:747:14: Assignment 745. /* 2^(top*BN_BITS2) - m */ 746. tmp.d[0] = (0 - m->d[0]) & BN_MASK2; 747. for (i = 1; i < top; i++) ^ 748. tmp.d[i] = (~m->d[i]) & BN_MASK2; 749. tmp.top = top; crypto/bn/bn_exp.c:1046:14: Call 1044. for (wvalue = 0, i = bits % window; i >= 0; i--, bits--) 1045. wvalue = (wvalue << 1) + BN_is_bit_set(p, bits); 1046. if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&tmp, top, powerbuf, wvalue, ^ 1047. window)) 1048. goto err; crypto/bn/bn_exp.c:522:1: Parameter `top` 520. } 521. 522. > static int MOD_EXP_CTIME_COPY_FROM_PREBUF(BIGNUM *b, int top, 523. unsigned char *buf, int idx, 524. int window) crypto/bn/bn_exp.c:579:5: Assignment 577. } 578. 579. b->top = top; ^ 580. bn_correct_top(b); 581. return 1; crypto/bn/bn_exp.c:580:5: Call 578. 579. b->top = top; 580. bn_correct_top(b); ^ 581. return 1; 582. } crypto/bn/bn_lib.c:943:1: Parameter `a->top` 941. } 942. 943. > void bn_correct_top(BIGNUM *a) 944. { 945. BN_ULONG *ftl; crypto/bn/bn_exp.c:1072:18: Call 1070. 1071. /* Multiply the result into the intermediate result */ 1072. if (!BN_mod_mul_montgomery(&tmp, &tmp, &am, mont, ctx)) ^ 1073. goto err; 1074. } 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 `ecdsa_sign_setup` 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/7fcdbd839c629f5419a49bf8da28c968c8140c3d/crypto/bn/bn_sqr.c/#L120
d2a_code_trace_data_43480
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_ossl.c:222: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set_locked`. Showing all 28 steps of the trace crypto/rsa/rsa_ossl.c:181:5: Call 179. if ((ctx = BN_CTX_new()) == NULL) 180. goto err; 181. BN_CTX_start(ctx); ^ 182. f = BN_CTX_get(ctx); 183. ret = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/rsa/rsa_ossl.c:222:14: Call 220. 221. if (rsa->flags & RSA_FLAG_CACHE_PUBLIC) 222. if (!BN_MONT_CTX_set_locked ^ 223. (&rsa->_method_mod_n, CRYPTO_LOCK_RSA, rsa->n, ctx)) 224. goto err; crypto/bn/bn_mont.c:500:1: Parameter `ctx->stack.depth` 498. } 499. 500. > BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock, 501. const BIGNUM *mod, BN_CTX *ctx) 502. { crypto/bn/bn_mont.c:522:10: Call 520. if (ret == NULL) 521. return NULL; 522. if (!BN_MONT_CTX_set(ret, mod, ctx)) { ^ 523. BN_MONT_CTX_free(ret); 524. return NULL; crypto/bn/bn_mont.c:349:1: Parameter `ctx->stack.depth` 347. } 348. 349. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 350. { 351. int ret = 0; crypto/bn/bn_mont.c:357:5: Call 355. return 0; 356. 357. BN_CTX_start(ctx); ^ 358. if ((Ri = BN_CTX_get(ctx)) == NULL) 359. goto err; crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mont.c:428:14: Call 426. tmod.top = buf[0] != 0 ? 1 : 0; 427. /* Ri = R^-1 mod N */ 428. if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL) ^ 429. goto err; 430. if (!BN_lshift(Ri, Ri, BN_BITS2)) crypto/bn/bn_gcd.c:226:1: Parameter `ctx->stack.depth` 224. BN_CTX *ctx); 225. 226. > BIGNUM *BN_mod_inverse(BIGNUM *in, 227. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 228. { crypto/bn/bn_gcd.c:231:10: Call 229. BIGNUM *rv; 230. int noinv; 231. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv); ^ 232. if (noinv) 233. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); crypto/bn/bn_gcd.c:237:1: Parameter `ctx->stack.depth` 235. } 236. 237. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 238. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 239. int *pnoinv) crypto/bn/bn_gcd.c:250:16: Call 248. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) 249. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) { 250. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 251. } 252. crypto/bn/bn_gcd.c:557:1: Parameter `ctx->stack.depth` 555. * not contain branches that may leak sensitive information. 556. */ 557. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 558. const BIGNUM *a, const BIGNUM *n, 559. BN_CTX *ctx) crypto/bn/bn_gcd.c:568:5: Call 566. bn_check_top(n); 567. 568. BN_CTX_start(ctx); ^ 569. A = BN_CTX_get(ctx); 570. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gcd.c:603:18: Call 601. BN_init(&local_B); 602. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME); 603. if (!BN_nnmod(B, &local_B, A, ctx)) ^ 604. goto err; 605. /* Ensure local_B goes out of scope before any further use of B */ crypto/bn/bn_mod.c:119:1: Parameter `ctx->stack.depth` 117. #include "bn_lcl.h" 118. 119. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 120. { 121. /* crypto/bn/bn_mod.c:126:11: Call 124. */ 125. 126. if (!(BN_mod(r, m, d, ctx))) ^ 127. return 0; 128. if (!r->neg) crypto/bn/bn_div.c:189:1: Parameter `ctx->stack.depth` 187. * If 'dv' or 'rm' is NULL, the respective value is not returned. 188. */ 189. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 190. BN_CTX *ctx) 191. { crypto/bn/bn_div.c:242:5: Call 240. } 241. 242. BN_CTX_start(ctx); ^ 243. tmp = BN_CTX_get(ctx); 244. snum = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:469:5: Call 467. if (no_branch) 468. bn_correct_top(res); 469. BN_CTX_end(ctx); ^ 470. return (1); 471. err: crypto/bn/bn_ctx.c:250:1: Parameter `ctx->stack.depth` 248. } 249. 250. > void BN_CTX_end(BN_CTX *ctx) 251. { 252. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:256:27: Call 254. ctx->err_stack--; 255. else { 256. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 257. /* Does this stack frame have anything to release? */ 258. if (fp < ctx->used) crypto/bn/bn_ctx.c:326:1: <LHS trace> 324. } 325. 326. > static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:326:1: Parameter `st->depth` 324. } 325. 326. > static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:328:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set_locked` 326. static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; ^ 329. } 330.
https://github.com/openssl/openssl/blob/e113c9c59dcb419dd00525cec431edb854a6c897/crypto/bn/bn_ctx.c/#L328
d2a_code_trace_data_43481
static int uint32_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, int utype, char *free_cont, const ASN1_ITEM *it) { uint64_t utmp = 0; uint32_t utmp2 = 0; char *cp; int neg = 0; if (*pval == NULL && !uint64_new(pval, it)) return 0; cp = (char *)*pval; if (len == 0) goto long_compat; if (!c2i_uint64_int(&utmp, &neg, &cont, len)) return 0; if ((it->size & INTxx_FLAG_SIGNED) == 0 && neg) { ASN1err(ASN1_F_UINT32_C2I, ASN1_R_ILLEGAL_NEGATIVE_VALUE); return 0; } if (neg) { if (utmp > ABS_INT32_MIN) { ASN1err(ASN1_F_UINT32_C2I, ASN1_R_TOO_SMALL); return 0; } utmp = 0 - utmp; } else { if (((it->size & INTxx_FLAG_SIGNED) != 0 && utmp > INT32_MAX) || ((it->size & INTxx_FLAG_SIGNED) == 0 && utmp > UINT32_MAX)) { ASN1err(ASN1_F_UINT32_C2I, ASN1_R_TOO_LARGE); return 0; } } long_compat: utmp2 = (uint32_t)utmp; memcpy(cp, &utmp2, sizeof(utmp2)); return 1; } crypto/asn1/x_int64.c:208: error: INTEGER_OVERFLOW_L2 (0 - [-oo, 2147483648]):unsigned64. Showing all 4 steps of the trace crypto/asn1/x_int64.c:197:10: <RHS trace> 195. goto long_compat; 196. 197. if (!c2i_uint64_int(&utmp, &neg, &cont, len)) ^ 198. return 0; 199. if ((it->size & INTxx_FLAG_SIGNED) == 0 && neg) { crypto/asn1/x_int64.c:197:10: Call 195. goto long_compat; 196. 197. if (!c2i_uint64_int(&utmp, &neg, &cont, len)) ^ 198. return 0; 199. if ((it->size & INTxx_FLAG_SIGNED) == 0 && neg) { crypto/asn1/a_int.c:606:1: Parameter `*ret` 604. 605. /* Internal functions used by x_int64.c */ 606. > int c2i_uint64_int(uint64_t *ret, int *neg, const unsigned char **pp, long len) 607. { 608. unsigned char buf[sizeof(uint64_t)]; crypto/asn1/x_int64.c:208:9: Binary operation: (0 - [-oo, 2147483648]):unsigned64 206. return 0; 207. } 208. utmp = 0 - utmp; ^ 209. } else { 210. if (((it->size & INTxx_FLAG_SIGNED) != 0 && utmp > INT32_MAX)
https://github.com/openssl/openssl/blob/427e91d928ce7a1c583e4bba761cb17a85ac95b4/crypto/asn1/x_int64.c/#L208
d2a_code_trace_data_43482
static av_always_inline void dnxhd_get_blocks(DNXHDEncContext *ctx, int mb_x, int mb_y) { const uint8_t *ptr_y = ctx->thread[0]->src[0] + ((mb_y << 4) * ctx->m.linesize) + (mb_x << 4); const uint8_t *ptr_u = ctx->thread[0]->src[1] + ((mb_y << 4) * ctx->m.uvlinesize) + (mb_x << 3); const uint8_t *ptr_v = ctx->thread[0]->src[2] + ((mb_y << 4) * ctx->m.uvlinesize) + (mb_x << 3); DSPContext *dsp = &ctx->m.dsp; dsp->get_pixels(ctx->blocks[0], ptr_y , ctx->m.linesize); dsp->get_pixels(ctx->blocks[1], ptr_y + 8, ctx->m.linesize); dsp->get_pixels(ctx->blocks[2], ptr_u , ctx->m.uvlinesize); dsp->get_pixels(ctx->blocks[3], ptr_v , ctx->m.uvlinesize); if (mb_y+1 == ctx->m.mb_height && ctx->m.avctx->height == 1080) { if (ctx->interlaced) { dnxhd_get_pixels_4x8(ctx->blocks[4], ptr_y + ctx->dct_y_offset , ctx->m.linesize); dnxhd_get_pixels_4x8(ctx->blocks[5], ptr_y + ctx->dct_y_offset + 8, ctx->m.linesize); dnxhd_get_pixels_4x8(ctx->blocks[6], ptr_u + ctx->dct_uv_offset , ctx->m.uvlinesize); dnxhd_get_pixels_4x8(ctx->blocks[7], ptr_v + ctx->dct_uv_offset , ctx->m.uvlinesize); } else memset(ctx->blocks[4], 0, 4*64*sizeof(DCTELEM)); } else { dsp->get_pixels(ctx->blocks[4], ptr_y + ctx->dct_y_offset , ctx->m.linesize); dsp->get_pixels(ctx->blocks[5], ptr_y + ctx->dct_y_offset + 8, ctx->m.linesize); dsp->get_pixels(ctx->blocks[6], ptr_u + ctx->dct_uv_offset , ctx->m.uvlinesize); dsp->get_pixels(ctx->blocks[7], ptr_v + ctx->dct_uv_offset , ctx->m.uvlinesize); } } libavcodec/dnxhdenc.c:420: error: Buffer Overrun L1 Offset added: 512 Size: 128. libavcodec/dnxhdenc.c:401:1: <Length trace> 399. } 400. 401. static av_always_inline void dnxhd_get_blocks(DNXHDEncContext *ctx, int mb_x, int mb_y) ^ 402. { 403. const uint8_t *ptr_y = ctx->thread[0]->src[0] + ((mb_y << 4) * ctx->m.linesize) + (mb_x << 4); libavcodec/dnxhdenc.c:401:1: Parameter `ctx->blocks[*][*]` 399. } 400. 401. static av_always_inline void dnxhd_get_blocks(DNXHDEncContext *ctx, int mb_x, int mb_y) ^ 402. { 403. const uint8_t *ptr_y = ctx->thread[0]->src[0] + ((mb_y << 4) * ctx->m.linesize) + (mb_x << 4); libavcodec/dnxhdenc.c:420:13: Array access: Offset added: 512 Size: 128 418. dnxhd_get_pixels_4x8(ctx->blocks[7], ptr_v + ctx->dct_uv_offset , ctx->m.uvlinesize); 419. } else 420. memset(ctx->blocks[4], 0, 4*64*sizeof(DCTELEM)); ^ 421. } else { 422. dsp->get_pixels(ctx->blocks[4], ptr_y + ctx->dct_y_offset , ctx->m.linesize);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dnxhdenc.c/#L420
d2a_code_trace_data_43483
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.c:1107: error: Integer Overflow L2 ([1, 2147483616] + 32):signed32 by call to `alloc_picture`. libavcodec/mpegvideo.c:1107:9: Call 1105. pic->f->coded_picture_number = s->coded_picture_number++; 1106. 1107. if (alloc_picture(s, pic, 0) < 0) ^ 1108. return -1; 1109. libavcodec/mpegvideo.c:318:1: Parameter `pic->f->nb_samples` 316. } 317. 318. static int alloc_picture(MpegEncContext *s, Picture *pic, int shared) ^ 319. { 320. return ff_alloc_picture(s->avctx, pic, &s->me, &s->sc, shared, 0, libavcodec/mpegvideo.c:320:12: Call 318. static int alloc_picture(MpegEncContext *s, Picture *pic, int shared) 319. { 320. return ff_alloc_picture(s->avctx, pic, &s->me, &s->sc, shared, 0, ^ 321. s->chroma_x_shift, s->chroma_y_shift, s->out_format, 322. s->mb_stride, s->mb_height, s->b8_stride, libavcodec/mpegpicture.c:211:1: Parameter `pic->f->nb_samples` 209. * The pixels are allocated/set by calling get_buffer() if shared = 0 210. */ 211. int ff_alloc_picture(AVCodecContext *avctx, Picture *pic, MotionEstContext *me, ^ 212. ScratchpadContext *sc, int shared, int encoding, 213. int chroma_x_shift, int chroma_y_shift, int out_format, libavcodec/mpegpicture.c:224:13: Call 222. } else { 223. assert(!pic->f->buf[0]); 224. if (alloc_frame_buffer(avctx, pic, me, sc, ^ 225. chroma_x_shift, chroma_y_shift, 226. *linesize, *uvlinesize) < 0) libavcodec/mpegpicture.c:85:1: Parameter `pic->f->nb_samples` 83. * Allocate a frame buffer 84. */ 85. static int alloc_frame_buffer(AVCodecContext *avctx, Picture *pic, ^ 86. MotionEstContext *me, ScratchpadContext *sc, 87. int chroma_x_shift, int chroma_y_shift, libavcodec/mpegpicture.c:108:13: Call 106. pic->f->height = avctx->height; 107. pic->f->format = avctx->pix_fmt; 108. r = avcodec_default_get_buffer2(avctx, pic->f, 0); ^ 109. } 110. libavcodec/utils.c:510:1: Parameter `frame->nb_samples` 508. } 509. 510. int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags) ^ 511. { 512. int ret; libavcodec/utils.c:514:16: Call 512. int ret; 513. 514. if ((ret = update_frame_pool(avctx, frame)) < 0) ^ 515. return ret; 516. libavcodec/utils.c:333:1: Parameter `frame->nb_samples` 331. } 332. 333. static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame) ^ 334. { 335. FramePool *pool = avctx->internal->pool; libavcodec/utils.c:400:15: Call 398. 399. av_buffer_pool_uninit(&pool->pools[0]); 400. ret = av_samples_get_buffer_size(&pool->linesize[0], ch, ^ 401. frame->nb_samples, frame->format, 0); 402. if (ret < 0) libavutil/samplefmt.c:108:1: <LHS trace> 106. } 107. 108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, ^ 109. enum AVSampleFormat sample_fmt, int align) 110. { libavutil/samplefmt.c:108:1: Parameter `nb_samples` 106. } 107. 108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, ^ 109. enum AVSampleFormat sample_fmt, int align) 110. { libavutil/samplefmt.c:124:9: Binary operation: ([1, 2147483616] + 32):signed32 by call to `alloc_picture` 122. return AVERROR(EINVAL); 123. align = 1; 124. nb_samples = FFALIGN(nb_samples, 32); ^ 125. } 126.
https://github.com/libav/libav/blob/a7ac1a7b94447f33ae95be4d6d186e2775977f91/libavutil/samplefmt.c/#L124
d2a_code_trace_data_43484
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) { bn_check_top(b); if (a == b) return a; if (bn_wexpand(a, b->top) == NULL) return NULL; if (b->top > 0) memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); a->top = b->top; a->neg = b->neg; bn_check_top(a); return a; } test/sm2_internal_test.c:162: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `EC_POINT_mul`. Showing all 19 steps of the trace test/sm2_internal_test.c:151:17: Call 149. 150. if (!TEST_ptr(expected) 151. || !TEST_true(BN_hex2bn(&priv, privkey_hex))) ^ 152. goto done; 153. crypto/bn/bn_print.c:166:5: Assignment 164. j = i; /* least significant 'hex' */ 165. m = 0; 166. h = 0; ^ 167. while (j > 0) { 168. m = (BN_BYTES * 2 <= j) ? BN_BYTES * 2 : j; crypto/bn/bn_print.c:184:5: Assignment 182. j -= BN_BYTES * 2; 183. } 184. ret->top = h; ^ 185. bn_correct_top(ret); 186. test/sm2_internal_test.c:162:17: Call 160. pt = EC_POINT_new(group); 161. if (!TEST_ptr(pt) 162. || !TEST_true(EC_POINT_mul(group, pt, priv, NULL, NULL, NULL)) ^ 163. || !TEST_true(EC_KEY_set_public_key(key, pt)) 164. || !TEST_true(sm2_ciphertext_size(key, digest, msg_len, &ctext_len))) crypto/ec/ec_lib.c:929:1: Parameter `g_scalar->top` 927. } 928. 929. > int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, 930. const EC_POINT *point, const BIGNUM *p_scalar, BN_CTX *ctx) 931. { crypto/ec/ec_lib.c:940:12: Call 938. scalars[0] = p_scalar; 939. 940. return EC_POINTs_mul(group, r, g_scalar, ^ 941. (point != NULL 942. && p_scalar != NULL), points, scalars, ctx); crypto/ec/ec_lib.c:918:1: Parameter `scalar->top` 916. */ 917. 918. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 919. size_t num, const EC_POINT *points[], 920. const BIGNUM *scalars[], BN_CTX *ctx) crypto/ec/ec_lib.c:924:16: Call 922. if (group->meth->mul == 0) 923. /* use default */ 924. return ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx); ^ 925. 926. return group->meth->mul(group, r, scalar, num, points, scalars, ctx); crypto/ec/ec_mult.c:342:1: Parameter `scalar->top` 340. * in the addition if scalar != NULL 341. */ 342. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 343. size_t num, const EC_POINT *points[], const BIGNUM *scalars[], 344. BN_CTX *ctx) crypto/ec/ec_mult.c:393:16: Call 391. * constant time version. 392. */ 393. return ec_mul_consttime(group, r, scalar, NULL, ctx); ^ 394. } 395. if ((scalar == NULL) && (num == 1)) { crypto/ec/ec_mult.c:131:1: Parameter `scalar->top` 129. * Returns 1 on success, 0 otherwise. 130. */ 131. > static int ec_mul_consttime(const EC_GROUP *group, EC_POINT *r, 132. const BIGNUM *scalar, const EC_POINT *point, 133. BN_CTX *ctx) crypto/ec/ec_mult.c:179:10: Call 177. goto err; 178. 179. if (!BN_copy(k, scalar)) ^ 180. goto err; 181. crypto/bn/bn_lib.c:285:1: <Offset trace> 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_lib.c:285:1: Parameter `b->top` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_lib.c:285:1: <Length trace> 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_lib.c:285:1: Parameter `*a->d` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_lib.c:291:9: Call 289. if (a == b) 290. return a; 291. if (bn_wexpand(a, b->top) == NULL) ^ 292. return NULL; 293. crypto/bn/bn_lib.c:941:1: Parameter `*a->d` 939. } 940. 941. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 942. { 943. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:295:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `EC_POINT_mul` 293. 294. if (b->top > 0) 295. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); ^ 296. 297. a->top = b->top;
https://github.com/openssl/openssl/blob/630fe1da888490b7dfef3fe0928b813ddff5d51a/crypto/bn/bn_lib.c/#L295
d2a_code_trace_data_43485
int BN_num_bits_word(BN_ULONG l) { BN_ULONG x, mask; int bits = (l != 0); #if BN_BITS2 > 32 x = l >> 32; mask = (0 - x) & BN_MASK2; mask = (0 - (mask >> (BN_BITS2 - 1))); bits += 32 & mask; l ^= (x ^ l) & mask; #endif x = l >> 16; mask = (0 - x) & BN_MASK2; mask = (0 - (mask >> (BN_BITS2 - 1))); bits += 16 & mask; l ^= (x ^ l) & mask; x = l >> 8; mask = (0 - x) & BN_MASK2; mask = (0 - (mask >> (BN_BITS2 - 1))); bits += 8 & mask; l ^= (x ^ l) & mask; x = l >> 4; mask = (0 - x) & BN_MASK2; mask = (0 - (mask >> (BN_BITS2 - 1))); bits += 4 & mask; l ^= (x ^ l) & mask; x = l >> 2; mask = (0 - x) & BN_MASK2; mask = (0 - (mask >> (BN_BITS2 - 1))); bits += 2 & mask; l ^= (x ^ l) & mask; x = l >> 1; mask = (0 - x) & BN_MASK2; mask = (0 - (mask >> (BN_BITS2 - 1))); bits += 1 & mask; return bits; } crypto/bn/bn_rsa_fips186_4.c:289: error: INTEGER_OVERFLOW_L2 (0 - [0, max(1, `r2->top`)]):unsigned64 by call to `BN_mul`. Showing all 22 steps of the trace crypto/bn/bn_rsa_fips186_4.c:253:1: Parameter `r2->top` 251. * Y, X, r1, r2, e are not NULL. 252. */ 253. > int bn_rsa_fips186_4_derive_prime(BIGNUM *Y, BIGNUM *X, const BIGNUM *Xin, 254. const BIGNUM *r1, const BIGNUM *r2, int nlen, 255. const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb) crypto/bn/bn_rsa_fips186_4.c:280:16: Call 278. if (!(BN_lshift1(r1x2, r1) 279. /* (Step 1) GCD(2r1, r2) = 1 */ 280. && BN_gcd(tmp, r1x2, r2, ctx) ^ 281. && BN_is_one(tmp) 282. /* (Step 2) R = ((r2^-1 mod 2r1) * r2) - ((2r1^-1 mod r2)*2r1) */ crypto/bn/bn_gcd.c:15:1: Parameter `in_b->top` 13. static BIGNUM *euclid(BIGNUM *a, BIGNUM *b); 14. 15. > int BN_gcd(BIGNUM *r, const BIGNUM *in_a, const BIGNUM *in_b, BN_CTX *ctx) 16. { 17. BIGNUM *a, *b, *t; crypto/bn/bn_rsa_fips186_4.c:283:16: Call 281. && BN_is_one(tmp) 282. /* (Step 2) R = ((r2^-1 mod 2r1) * r2) - ((2r1^-1 mod r2)*2r1) */ 283. && BN_mod_inverse(R, r2, r1x2, ctx) ^ 284. && BN_mul(R, R, r2, ctx) /* R = (r2^-1 mod 2r1) * r2 */ 285. && BN_mod_inverse(tmp, r1x2, r2, ctx) crypto/bn/bn_gcd.c:124:1: Parameter `a->top` 122. BN_CTX *ctx); 123. 124. > BIGNUM *BN_mod_inverse(BIGNUM *in, 125. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 126. { crypto/bn/bn_gcd.c:129:10: Call 127. BIGNUM *rv; 128. int noinv; 129. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv); ^ 130. if (noinv) 131. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); crypto/bn/bn_gcd.c:135:1: Parameter `a->top` 133. } 134. 135. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 136. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 137. int *pnoinv) crypto/bn/bn_rsa_fips186_4.c:285:16: Call 283. && BN_mod_inverse(R, r2, r1x2, ctx) 284. && BN_mul(R, R, r2, ctx) /* R = (r2^-1 mod 2r1) * r2 */ 285. && BN_mod_inverse(tmp, r1x2, r2, ctx) ^ 286. && BN_mul(tmp, tmp, r1x2, ctx) /* tmp = (2r1^-1 mod r2)*2r1 */ 287. && BN_sub(R, R, tmp) crypto/bn/bn_gcd.c:124:1: Parameter `n->top` 122. BN_CTX *ctx); 123. 124. > BIGNUM *BN_mod_inverse(BIGNUM *in, 125. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 126. { crypto/bn/bn_gcd.c:129:10: Call 127. BIGNUM *rv; 128. int noinv; 129. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv); ^ 130. if (noinv) 131. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); crypto/bn/bn_gcd.c:144:33: Call 142. 143. /* This is invalid input so we don't worry about constant time here */ 144. if (BN_abs_is_word(n, 1) || BN_is_zero(n)) { ^ 145. if (pnoinv != NULL) 146. *pnoinv = 1; crypto/bn/bn_lib.c:864:1: Parameter `a->top` 862. } 863. 864. > int BN_is_zero(const BIGNUM *a) 865. { 866. return a->top == 0; crypto/bn/bn_rsa_fips186_4.c:289:16: Call 287. && BN_sub(R, R, tmp) 288. /* Calculate 2r1r2 */ 289. && BN_mul(r1r2x2, r1x2, r2, ctx))) ^ 290. goto err; 291. /* Make positive by adding the modulus */ crypto/bn/bn_mul.c:497:1: Parameter `b->top` 495. #endif /* BN_RECURSION */ 496. 497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); crypto/bn/bn_mul.c:499:15: Call 497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); ^ 500. 501. bn_correct_top(r); crypto/bn/bn_mul.c:507:1: Parameter `b->top` 505. } 506. 507. > int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 508. { 509. int ret = 0; crypto/bn/bn_mul.c:525:5: Assignment 523. 524. al = a->top; 525. bl = b->top; ^ 526. 527. if ((al == 0) || (bl == 0)) { crypto/bn/bn_mul.c:574:21: Call 572. } 573. if (i == -1) { 574. j = BN_num_bits_word((BN_ULONG)bl); ^ 575. } 576. j = 1 << (j - 1); crypto/bn/bn_lib.c:90:1: <RHS trace> 88. } 89. 90. > int BN_num_bits_word(BN_ULONG l) 91. { 92. BN_ULONG x, mask; crypto/bn/bn_lib.c:90:1: Parameter `l` 88. } 89. 90. > int BN_num_bits_word(BN_ULONG l) 91. { 92. BN_ULONG x, mask; crypto/bn/bn_lib.c:96:5: Assignment 94. 95. #if BN_BITS2 > 32 96. x = l >> 32; ^ 97. mask = (0 - x) & BN_MASK2; 98. mask = (0 - (mask >> (BN_BITS2 - 1))); crypto/bn/bn_lib.c:97:5: Binary operation: (0 - [0, max(1, r2->top)]):unsigned64 by call to `BN_mul` 95. #if BN_BITS2 > 32 96. x = l >> 32; 97. mask = (0 - x) & BN_MASK2; ^ 98. mask = (0 - (mask >> (BN_BITS2 - 1))); 99. bits += 32 & mask;
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_lib.c/#L97
d2a_code_trace_data_43486
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/ec_check.c:74: 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/ec_check.c:74:10: Call 72. } 73. 74. if (!EC_POINT_mul(group, point, order, NULL, NULL, ctx)) ^ 75. goto err; 76. if (!EC_POINT_is_at_infinity(group, point)) { 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_43487
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/dsa/dsa_ossl.c:81: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `dsa_sign_setup`. Showing all 24 steps of the trace crypto/dsa/dsa_ossl.c:49:1: Parameter `dsa->g->top` 47. } 48. 49. > static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) 50. { 51. BIGNUM *kinv = NULL; crypto/dsa/dsa_ossl.c:81:10: Call 79. goto err; 80. redo: 81. if (!dsa_sign_setup(dsa, ctx, &kinv, &ret->r, dgst, dlen)) ^ 82. goto err; 83. crypto/dsa/dsa_ossl.c:133:1: Parameter `dsa->g->top` 131. } 132. 133. > static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, 134. BIGNUM **kinvp, BIGNUM **rp, 135. const unsigned char *dgst, int dlen) crypto/dsa/dsa_ossl.c:199:18: Call 197. goto err; 198. } else { 199. if (!BN_mod_exp_mont(r, dsa->g, k, dsa->p, ctx, dsa->method_mont_p)) ^ 200. goto err; 201. } crypto/bn/bn_exp.c:300:1: Parameter `a->top` 298. } 299. 300. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 301. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 302. { crypto/bn/bn_exp.c:312:16: Call 310. 311. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { 312. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 313. } 314. crypto/bn/bn_exp.c:600:1: Parameter `a->top` 598. * http://www.daemonology.net/hyperthreading-considered-harmful/) 599. */ 600. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 601. const BIGNUM *m, BN_CTX *ctx, 602. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:757:17: Call 755. if (!BN_to_montgomery(&am, &am, mont, ctx)) 756. goto err; 757. } else if (!BN_to_montgomery(&am, a, mont, ctx)) ^ 758. goto err; 759. crypto/bn/bn_lib.c:945:1: Parameter `a->top` 943. } 944. 945. > int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 946. BN_CTX *ctx) 947. { crypto/bn/bn_lib.c:948:12: Call 946. BN_CTX *ctx) 947. { 948. return BN_mod_mul_montgomery(r, a, &(mont->RR), mont, ctx); ^ 949. } 950. 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:104:1: <Offset trace> 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:104:1: Parameter `n` 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:115:5: Assignment 113. rp[0] = rp[max - 1] = 0; 114. rp++; 115. j = n; ^ 116. 117. if (--j > 0) { crypto/bn/bn_sqr.c:117:9: Assignment 115. j = n; 116. 117. if (--j > 0) { ^ 118. ap++; 119. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); crypto/bn/bn_sqr.c:104:1: <Length trace> 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:104:1: Parameter `*r` 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:112:5: Assignment 110. max = n * 2; 111. ap = a; 112. rp = r; ^ 113. rp[0] = rp[max - 1] = 0; 114. rp++; crypto/bn/bn_sqr.c:114:5: Assignment 112. rp = r; 113. rp[0] = rp[max - 1] = 0; 114. rp++; ^ 115. j = n; 116. crypto/bn/bn_sqr.c:119:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `dsa_sign_setup` 117. if (--j > 0) { 118. ap++; 119. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); ^ 120. rp += 2; 121. }
https://github.com/openssl/openssl/blob/69588edbaa424beb71c6a9b1be416588232cb78c/crypto/bn/bn_sqr.c/#L119
d2a_code_trace_data_43488
void ssl3_cbc_copy_mac(unsigned char *out, const SSL3_RECORD *rec, size_t md_size) { #if defined(CBC_MAC_ROTATE_IN_PLACE) unsigned char rotated_mac_buf[64 + EVP_MAX_MD_SIZE]; unsigned char *rotated_mac; #else unsigned char rotated_mac[EVP_MAX_MD_SIZE]; #endif size_t mac_end = rec->length; size_t mac_start = mac_end - md_size; size_t scan_start = 0; size_t i, j; size_t div_spoiler; size_t rotate_offset; OPENSSL_assert(rec->orig_len >= md_size); OPENSSL_assert(md_size <= EVP_MAX_MD_SIZE); #if defined(CBC_MAC_ROTATE_IN_PLACE) rotated_mac = rotated_mac_buf + ((0 - (size_t)rotated_mac_buf) & 63); #endif if (rec->orig_len > md_size + 255 + 1) scan_start = rec->orig_len - (md_size + 255 + 1); div_spoiler = md_size >> 1; div_spoiler <<= (sizeof(div_spoiler) - 1) * 8; rotate_offset = (div_spoiler + mac_start - scan_start) % md_size; memset(rotated_mac, 0, md_size); for (i = scan_start, j = 0; i < rec->orig_len; i++) { unsigned char mac_started = constant_time_ge_8_s(i, mac_start); unsigned char mac_ended = constant_time_ge_8_s(i, mac_end); unsigned char b = rec->data[i]; rotated_mac[j++] |= b & mac_started & ~mac_ended; j &= constant_time_lt_s(j, md_size); } #if defined(CBC_MAC_ROTATE_IN_PLACE) j = 0; for (i = 0; i < md_size; i++) { ((volatile unsigned char *)rotated_mac)[rotate_offset ^ 32]; out[j++] = rotated_mac[rotate_offset++]; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); } #else memset(out, 0, md_size); rotate_offset = md_size - rotate_offset; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); for (i = 0; i < md_size; i++) { for (j = 0; j < md_size; j++) out[j] |= rotated_mac[i] & constant_time_eq_8_s(j, rotate_offset); rotate_offset++; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); } #endif } ssl/record/ssl3_record.c:437: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, 64]):unsigned64 by call to `ssl3_cbc_copy_mac`. Showing all 9 steps of the trace ssl/record/ssl3_record.c:125:1: Parameter `s->rlayer.rrec.length` 123. */ 124. /* used only by ssl3_read_bytes */ 125. > int ssl3_get_record(SSL *s) 126. { 127. int ssl_major, ssl_minor, al; ssl/record/ssl3_record.c:329:9: Assignment 327. /* decrypt in place in 'rr->input' */ 328. rr[num_recs].data = rr[num_recs].input; 329. rr[num_recs].orig_len = rr[num_recs].length; ^ 330. 331. /* Mark this record as not read by upper layers yet */ ssl/record/ssl3_record.c:437:17: Call 435. */ 436. mac = mac_tmp; 437. ssl3_cbc_copy_mac(mac_tmp, &rr[j], mac_size); ^ 438. rr[j].length -= mac_size; 439. } else { ssl/record/ssl3_record.c:1231:1: <LHS trace> 1229. #define CBC_MAC_ROTATE_IN_PLACE 1230. 1231. > void ssl3_cbc_copy_mac(unsigned char *out, 1232. const SSL3_RECORD *rec, size_t md_size) 1233. { ssl/record/ssl3_record.c:1231:1: Parameter `rec->length` 1229. #define CBC_MAC_ROTATE_IN_PLACE 1230. 1231. > void ssl3_cbc_copy_mac(unsigned char *out, 1232. const SSL3_RECORD *rec, size_t md_size) 1233. { ssl/record/ssl3_record.c:1244:5: Assignment 1242. * mac_end is the index of |rec->data| just after the end of the MAC. 1243. */ 1244. size_t mac_end = rec->length; ^ 1245. size_t mac_start = mac_end - md_size; 1246. /* ssl/record/ssl3_record.c:1231:1: <RHS trace> 1229. #define CBC_MAC_ROTATE_IN_PLACE 1230. 1231. > void ssl3_cbc_copy_mac(unsigned char *out, 1232. const SSL3_RECORD *rec, size_t md_size) 1233. { ssl/record/ssl3_record.c:1231:1: Parameter `md_size` 1229. #define CBC_MAC_ROTATE_IN_PLACE 1230. 1231. > void ssl3_cbc_copy_mac(unsigned char *out, 1232. const SSL3_RECORD *rec, size_t md_size) 1233. { ssl/record/ssl3_record.c:1245:5: Binary operation: ([0, +oo] - [0, 64]):unsigned64 by call to `ssl3_cbc_copy_mac` 1243. */ 1244. size_t mac_end = rec->length; 1245. size_t mac_start = mac_end - md_size; ^ 1246. /* 1247. * scan_start contains the number of bytes that we can ignore because the
https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/ssl/record/ssl3_record.c/#L1245
d2a_code_trace_data_43489
static void mpegts_write_pes(AVFormatContext *s, AVStream *st, const uint8_t *payload, int payload_size, int64_t pts, int64_t dts) { MpegTSWriteStream *ts_st = st->priv_data; uint8_t buf[TS_PACKET_SIZE]; uint8_t *q; int val, is_start, len, header_len, write_pcr, private_code, flags; int afc_len, stuffing_len; int64_t pcr = -1; is_start = 1; while (payload_size > 0) { retransmit_si_info(s); write_pcr = 0; if (ts_st->pid == ts_st->service->pcr_pid) { ts_st->service->pcr_packet_count++; if (ts_st->service->pcr_packet_count >= ts_st->service->pcr_packet_freq) { ts_st->service->pcr_packet_count = 0; write_pcr = 1; pcr = pts; } } q = buf; *q++ = 0x47; val = (ts_st->pid >> 8); if (is_start) val |= 0x40; *q++ = val; *q++ = ts_st->pid; *q++ = 0x10 | ts_st->cc | (write_pcr ? 0x20 : 0); ts_st->cc = (ts_st->cc + 1) & 0xf; if (write_pcr) { *q++ = 7; *q++ = 0x10; *q++ = pcr >> 25; *q++ = pcr >> 17; *q++ = pcr >> 9; *q++ = pcr >> 1; *q++ = (pcr & 1) << 7; *q++ = 0; } if (is_start) { *q++ = 0x00; *q++ = 0x00; *q++ = 0x01; private_code = 0; if (st->codec->codec_type == CODEC_TYPE_VIDEO) { *q++ = 0xe0; } else if (st->codec->codec_type == CODEC_TYPE_AUDIO && (st->codec->codec_id == CODEC_ID_MP2 || st->codec->codec_id == CODEC_ID_MP3)) { *q++ = 0xc0; } else { *q++ = 0xbd; if (st->codec->codec_type == CODEC_TYPE_SUBTITLE) { private_code = 0x20; } } header_len = 0; flags = 0; if (pts != AV_NOPTS_VALUE) { header_len += 5; flags |= 0x80; } if (dts != AV_NOPTS_VALUE) { header_len += 5; flags |= 0x40; } len = payload_size + header_len + 3; if (private_code != 0) len++; *q++ = len >> 8; *q++ = len; val = 0x80; if (st->codec->codec_type == CODEC_TYPE_SUBTITLE) val |= 0x04; *q++ = val; *q++ = flags; *q++ = header_len; if (pts != AV_NOPTS_VALUE) { write_pts(q, flags >> 6, pts); q += 5; } if (dts != AV_NOPTS_VALUE) { write_pts(q, 1, dts); q += 5; } if (private_code != 0) *q++ = private_code; is_start = 0; } header_len = q - buf; len = TS_PACKET_SIZE - header_len; if (len > payload_size) len = payload_size; stuffing_len = TS_PACKET_SIZE - header_len - len; if (stuffing_len > 0) { if (buf[3] & 0x20) { afc_len = buf[4] + 1; memmove(buf + 4 + afc_len + stuffing_len, buf + 4 + afc_len, header_len - (4 + afc_len)); buf[4] += stuffing_len; memset(buf + 4 + afc_len, 0xff, stuffing_len); } else { memmove(buf + 4 + stuffing_len, buf + 4, header_len - 4); buf[3] |= 0x20; buf[4] = stuffing_len - 1; if (stuffing_len >= 2) { buf[5] = 0x00; memset(buf + 6, 0xff, stuffing_len - 2); } } } memcpy(buf + TS_PACKET_SIZE - len, payload, len); payload += len; payload_size -= len; put_buffer(s->pb, buf, TS_PACKET_SIZE); } put_flush_packet(s->pb); } libavformat/mpegtsenc.c:599: error: Buffer Overrun L2 Offset added: [160-min(155, `payload_size`), 215] (⇐ [160-min(155, `payload_size`), 187] + [0, 28]) Size: 188. libavformat/mpegtsenc.c:480:1: <Offset trace> 478. 479. /* NOTE: pes_data contains all the PES packet */ 480. static void mpegts_write_pes(AVFormatContext *s, AVStream *st, ^ 481. const uint8_t *payload, int payload_size, 482. int64_t pts, int64_t dts) libavformat/mpegtsenc.c:480:1: Array declaration 478. 479. /* NOTE: pes_data contains all the PES packet */ 480. static void mpegts_write_pes(AVFormatContext *s, AVStream *st, ^ 481. const uint8_t *payload, int payload_size, 482. int64_t pts, int64_t dts) libavformat/mpegtsenc.c:581:9: Assignment 579. } 580. /* header size */ 581. header_len = q - buf; ^ 582. /* data len */ 583. len = TS_PACKET_SIZE - header_len; libavformat/mpegtsenc.c:480:1: <Length trace> 478. 479. /* NOTE: pes_data contains all the PES packet */ 480. static void mpegts_write_pes(AVFormatContext *s, AVStream *st, ^ 481. const uint8_t *payload, int payload_size, 482. int64_t pts, int64_t dts) libavformat/mpegtsenc.c:480:1: Array declaration 478. 479. /* NOTE: pes_data contains all the PES packet */ 480. static void mpegts_write_pes(AVFormatContext *s, AVStream *st, ^ 481. const uint8_t *payload, int payload_size, 482. int64_t pts, int64_t dts) libavformat/mpegtsenc.c:599:17: Array access: Offset added: [160-min(155, payload_size), 215] (⇐ [160-min(155, payload_size), 187] + [0, 28]) Size: 188 597. } else { 598. /* add stuffing */ 599. memmove(buf + 4 + stuffing_len, buf + 4, header_len - 4); ^ 600. buf[3] |= 0x20; 601. buf[4] = stuffing_len - 1;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/mpegtsenc.c/#L599
d2a_code_trace_data_43490
ngx_int_t ngx_atoi(u_char *line, size_t n) { ngx_int_t value, cutoff, cutlim; if (n == 0) { return NGX_ERROR; } cutoff = NGX_MAX_INT_T_VALUE / 10; cutlim = NGX_MAX_INT_T_VALUE % 10; for (value = 0; n--; line++) { if (*line < '0' || *line > '9') { return NGX_ERROR; } if (value >= cutoff && (value > cutoff || *line - '0' > cutlim)) { return NGX_ERROR; } value = value * 10 + (*line - '0'); } return value; } src/http/ngx_http_core_module.c:2641: error: Integer Overflow L2 ([0, 9223372036854775800] + [0, 9]):signed64 by call to `ngx_http_get_forwarded_addr_internal`. src/http/ngx_http_core_module.c:2641:14: Call 2639. 2640. while (i-- > 0) { 2641. rc = ngx_http_get_forwarded_addr_internal(r, addr, h[i]->value.data, ^ 2642. h[i]->value.len, proxies, 2643. recursive); src/http/ngx_http_core_module.c:2665:1: Parameter `*xff` 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:2641:14: Call 2639. 2640. while (i-- > 0) { 2641. rc = ngx_http_get_forwarded_addr_internal(r, addr, h[i]->value.data, ^ 2642. h[i]->value.len, proxies, 2643. recursive); src/http/ngx_http_core_module.c:2665:1: Parameter `*xff` 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:2641:14: Call 2639. 2640. while (i-- > 0) { 2641. rc = ngx_http_get_forwarded_addr_internal(r, addr, h[i]->value.data, ^ 2642. h[i]->value.len, proxies, 2643. recursive); src/http/ngx_http_core_module.c:2665:1: Parameter `*xff` 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: Parameter `*text` 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:629:10: Call 627. ngx_int_t rc, port; 628. 629. rc = ngx_parse_addr(pool, addr, text, len); ^ 630. 631. if (rc != NGX_DECLINED) { src/core/ngx_inet.c:561:1: Parameter `*text` 559. 560. 561. ngx_int_t ^ 562. ngx_parse_addr(ngx_pool_t *pool, ngx_addr_t *addr, u_char *text, size_t len) 563. { src/core/ngx_inet.c:663:12: Call 661. plen = last - p; 662. 663. port = ngx_atoi(p, plen); ^ 664. 665. if (port < 1 || port > 65535) { src/core/ngx_string.c:926:5: <LHS trace> 924. } 925. 926. cutoff = NGX_MAX_INT_T_VALUE / 10; ^ 927. cutlim = NGX_MAX_INT_T_VALUE % 10; 928. src/core/ngx_string.c:926:5: Assignment 924. } 925. 926. cutoff = NGX_MAX_INT_T_VALUE / 10; ^ 927. cutlim = NGX_MAX_INT_T_VALUE % 10; 928. src/core/ngx_string.c:917:1: <RHS trace> 915. 916. 917. ngx_int_t ^ 918. ngx_atoi(u_char *line, size_t n) 919. { src/core/ngx_string.c:917:1: Parameter `*line` 915. 916. 917. ngx_int_t ^ 918. ngx_atoi(u_char *line, size_t n) 919. { src/core/ngx_string.c:938:9: Binary operation: ([0, 9223372036854775800] + [0, 9]):signed64 by call to `ngx_http_get_forwarded_addr_internal` 936. } 937. 938. value = value * 10 + (*line - '0'); ^ 939. } 940.
https://github.com/nginx/nginx/blob/f909a7dc331621a8638ea46056e437b8be1496da/src/core/ngx_string.c/#L938
d2a_code_trace_data_43491
static int unpack_SQVH(COOKContext *q, int category, int* subband_coef_index, int* subband_coef_sign) { int i,j; int vlc, vd ,tmp, result; vd = vd_tab[category]; result = 0; for(i=0 ; i<vpr_tab[category] ; i++){ vlc = get_vlc2(&q->gb, q->sqvh[category].table, q->sqvh[category].bits, 3); if (q->bits_per_subpacket < get_bits_count(&q->gb)){ vlc = 0; result = 1; } for(j=vd-1 ; j>=0 ; j--){ tmp = (vlc * invradix_tab[category])/0x100000; subband_coef_index[vd*i+j] = vlc - tmp * (kmax_tab[category]+1); vlc = tmp; } for(j=0 ; j<vd ; j++){ if (subband_coef_index[i*vd + j]) { if(get_bits_count(&q->gb) < q->bits_per_subpacket){ subband_coef_sign[i*vd+j] = get_bits1(&q->gb); } else { result=1; subband_coef_sign[i*vd+j]=0; } } else { subband_coef_sign[i*vd+j]=0; } } } return result; } libavcodec/cook.c:627: error: Buffer Overrun L2 Offset: [min(7, `*category`), max(7, `*category`)] Size: 7 by call to `unpack_SQVH`. libavcodec/cook.c:613:1: Parameter `*category` 611. 612. 613. static void decode_vectors(COOKContext* q, int* category, ^ 614. int *quant_index_table, float* mlt_buffer){ 615. /* A zero in this table means that the subband coefficient is libavcodec/cook.c:627:16: Call 625. index = category[band]; 626. if(category[band] < 7){ 627. if(unpack_SQVH(q, category[band], subband_coef_index, subband_coef_sign)){ ^ 628. index=7; 629. for(j=0 ; j<q->total_subbands ; j++) category[band+j]=7; libavcodec/cook.c:568:1: <Offset trace> 566. */ 567. 568. static int unpack_SQVH(COOKContext *q, int category, int* subband_coef_index, ^ 569. int* subband_coef_sign) { 570. int i,j; libavcodec/cook.c:568:1: Parameter `category` 566. */ 567. 568. static int unpack_SQVH(COOKContext *q, int category, int* subband_coef_index, ^ 569. int* subband_coef_sign) { 570. int i,j; libavcodec/cookdata.h:61:1: <Length trace> 59. }; 60. 61. static const int vd_tab[7] = { ^ 62. 2, 2, 2, 4, 4, 5, 5, 63. }; libavcodec/cookdata.h:61:1: Array declaration 59. }; 60. 61. static const int vd_tab[7] = { ^ 62. 2, 2, 2, 4, 4, 5, 5, 63. }; libavcodec/cook.c:573:10: Array access: Offset: [min(7, *category), max(7, *category)] Size: 7 by call to `unpack_SQVH` 571. int vlc, vd ,tmp, result; 572. 573. vd = vd_tab[category]; ^ 574. result = 0; 575. for(i=0 ; i<vpr_tab[category] ; i++){
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/cook.c/#L573
d2a_code_trace_data_43492
static int estimate_best_b_count(MpegEncContext *s) { AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id); AVCodecContext *c = avcodec_alloc_context3(NULL); AVFrame input[FF_MAX_B_FRAMES + 2]; const int scale = s->avctx->brd_scale; int i, j, out_size, p_lambda, b_lambda, lambda2; int outbuf_size = s->width * s->height; uint8_t *outbuf = av_malloc(outbuf_size); int64_t best_rd = INT64_MAX; int best_b_count = -1; assert(scale >= 0 && scale <= 3); p_lambda = s->last_lambda_for[AV_PICTURE_TYPE_P]; b_lambda = s->last_lambda_for[AV_PICTURE_TYPE_B]; if (!b_lambda) b_lambda = p_lambda; lambda2 = (b_lambda * b_lambda + (1 << FF_LAMBDA_SHIFT) / 2) >> FF_LAMBDA_SHIFT; c->width = s->width >> scale; c->height = s->height >> scale; c->flags = CODEC_FLAG_QSCALE | CODEC_FLAG_PSNR | CODEC_FLAG_INPUT_PRESERVED ; c->flags |= s->avctx->flags & CODEC_FLAG_QPEL; c->mb_decision = s->avctx->mb_decision; c->me_cmp = s->avctx->me_cmp; c->mb_cmp = s->avctx->mb_cmp; c->me_sub_cmp = s->avctx->me_sub_cmp; c->pix_fmt = PIX_FMT_YUV420P; c->time_base = s->avctx->time_base; c->max_b_frames = s->max_b_frames; if (avcodec_open2(c, codec, NULL) < 0) return -1; for (i = 0; i < s->max_b_frames + 2; i++) { int ysize = c->width * c->height; int csize = (c->width / 2) * (c->height / 2); Picture pre_input, *pre_input_ptr = i ? s->input_picture[i - 1] : s->next_picture_ptr; avcodec_get_frame_defaults(&input[i]); input[i].data[0] = av_malloc(ysize + 2 * csize); input[i].data[1] = input[i].data[0] + ysize; input[i].data[2] = input[i].data[1] + csize; input[i].linesize[0] = c->width; input[i].linesize[1] = input[i].linesize[2] = c->width / 2; if (pre_input_ptr && (!i || s->input_picture[i - 1])) { pre_input = *pre_input_ptr; if (pre_input.f.type != FF_BUFFER_TYPE_SHARED && i) { pre_input.f.data[0] += INPLACE_OFFSET; pre_input.f.data[1] += INPLACE_OFFSET; pre_input.f.data[2] += INPLACE_OFFSET; } s->dsp.shrink[scale](input[i].data[0], input[i].linesize[0], pre_input.f.data[0], pre_input.f.linesize[0], c->width, c->height); s->dsp.shrink[scale](input[i].data[1], input[i].linesize[1], pre_input.f.data[1], pre_input.f.linesize[1], c->width >> 1, c->height >> 1); s->dsp.shrink[scale](input[i].data[2], input[i].linesize[2], pre_input.f.data[2], pre_input.f.linesize[2], c->width >> 1, c->height >> 1); } } for (j = 0; j < s->max_b_frames + 1; j++) { int64_t rd = 0; if (!s->input_picture[j]) break; c->error[0] = c->error[1] = c->error[2] = 0; input[0].pict_type = AV_PICTURE_TYPE_I; input[0].quality = 1 * FF_QP2LAMBDA; out_size = avcodec_encode_video(c, outbuf, outbuf_size, &input[0]); for (i = 0; i < s->max_b_frames + 1; i++) { int is_p = i % (j + 1) == j || i == s->max_b_frames; input[i + 1].pict_type = is_p ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_B; input[i + 1].quality = is_p ? p_lambda : b_lambda; out_size = avcodec_encode_video(c, outbuf, outbuf_size, &input[i + 1]); rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3); } while (out_size) { out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL); rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3); } rd += c->error[0] + c->error[1] + c->error[2]; if (rd < best_rd) { best_rd = rd; best_b_count = j; } } av_freep(&outbuf); avcodec_close(c); av_freep(&c); for (i = 0; i < s->max_b_frames + 2; i++) { av_freep(&input[i].data[0]); } return best_b_count; } libavcodec/mpegvideo_enc.c:1132: error: Null Dereference pointer `c` last assigned on line 1111 could be null and is dereferenced at line 1132, column 5. libavcodec/mpegvideo_enc.c:1108:1: start of procedure estimate_best_b_count() 1106. } 1107. 1108. static int estimate_best_b_count(MpegEncContext *s) ^ 1109. { 1110. AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id); libavcodec/mpegvideo_enc.c:1110:5: Skipping avcodec_find_encoder(): empty list of specs 1108. static int estimate_best_b_count(MpegEncContext *s) 1109. { 1110. AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id); ^ 1111. AVCodecContext *c = avcodec_alloc_context3(NULL); 1112. AVFrame input[FF_MAX_B_FRAMES + 2]; libavcodec/mpegvideo_enc.c:1111:5: 1109. { 1110. AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id); 1111. AVCodecContext *c = avcodec_alloc_context3(NULL); ^ 1112. AVFrame input[FF_MAX_B_FRAMES + 2]; 1113. const int scale = s->avctx->brd_scale; libavcodec/options.c:602:1: start of procedure avcodec_alloc_context3() 600. } 601. 602. AVCodecContext *avcodec_alloc_context3(AVCodec *codec){ ^ 603. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); 604. libavcodec/options.c:603:5: 601. 602. AVCodecContext *avcodec_alloc_context3(AVCodec *codec){ 603. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); ^ 604. 605. if(avctx==NULL) return NULL; libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) ^ 73. return NULL; 74. libavutil/mem.c:83:9: Taking false branch 81. ((char*)ptr)[-1]= diff; 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,32,size)) ^ 84. ptr = NULL; 85. #elif HAVE_MEMALIGN libavutil/mem.c:114:5: 112. ptr = malloc(size); 113. #endif 114. return ptr; ^ 115. } 116. libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavcodec/options.c:605:8: Taking true branch 603. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); 604. 605. if(avctx==NULL) return NULL; ^ 606. 607. if(avcodec_get_context_defaults3(avctx, codec) < 0){ libavcodec/options.c:605:21: 603. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); 604. 605. if(avctx==NULL) return NULL; ^ 606. 607. if(avcodec_get_context_defaults3(avctx, codec) < 0){ libavcodec/options.c:613:1: return from a call to avcodec_alloc_context3 611. 612. return avctx; 613. } ^ 614. 615. #if FF_API_ALLOC_CONTEXT libavcodec/mpegvideo_enc.c:1113:5: 1111. AVCodecContext *c = avcodec_alloc_context3(NULL); 1112. AVFrame input[FF_MAX_B_FRAMES + 2]; 1113. const int scale = s->avctx->brd_scale; ^ 1114. int i, j, out_size, p_lambda, b_lambda, lambda2; 1115. int outbuf_size = s->width * s->height; // FIXME libavcodec/mpegvideo_enc.c:1115:5: 1113. const int scale = s->avctx->brd_scale; 1114. int i, j, out_size, p_lambda, b_lambda, lambda2; 1115. int outbuf_size = s->width * s->height; // FIXME ^ 1116. uint8_t *outbuf = av_malloc(outbuf_size); 1117. int64_t best_rd = INT64_MAX; libavcodec/mpegvideo_enc.c:1116:5: 1114. int i, j, out_size, p_lambda, b_lambda, lambda2; 1115. int outbuf_size = s->width * s->height; // FIXME 1116. uint8_t *outbuf = av_malloc(outbuf_size); ^ 1117. int64_t best_rd = INT64_MAX; 1118. int best_b_count = -1; libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) ^ 73. return NULL; 74. libavutil/mem.c:83:9: Taking false branch 81. ((char*)ptr)[-1]= diff; 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,32,size)) ^ 84. ptr = NULL; 85. #elif HAVE_MEMALIGN libavutil/mem.c:114:5: 112. ptr = malloc(size); 113. #endif 114. return ptr; ^ 115. } 116. libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavcodec/mpegvideo_enc.c:1117:5: 1115. int outbuf_size = s->width * s->height; // FIXME 1116. uint8_t *outbuf = av_malloc(outbuf_size); 1117. int64_t best_rd = INT64_MAX; ^ 1118. int best_b_count = -1; 1119. libavcodec/mpegvideo_enc.c:1118:5: 1116. uint8_t *outbuf = av_malloc(outbuf_size); 1117. int64_t best_rd = INT64_MAX; 1118. int best_b_count = -1; ^ 1119. 1120. assert(scale >= 0 && scale <= 3); libavcodec/mpegvideo_enc.c:1120:5: 1118. int best_b_count = -1; 1119. 1120. assert(scale >= 0 && scale <= 3); ^ 1121. 1122. //emms_c(); libavcodec/mpegvideo_enc.c:1124:5: 1122. //emms_c(); 1123. //s->next_picture_ptr->quality; 1124. p_lambda = s->last_lambda_for[AV_PICTURE_TYPE_P]; ^ 1125. //p_lambda * FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; 1126. b_lambda = s->last_lambda_for[AV_PICTURE_TYPE_B]; libavcodec/mpegvideo_enc.c:1126:5: 1124. p_lambda = s->last_lambda_for[AV_PICTURE_TYPE_P]; 1125. //p_lambda * FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; 1126. b_lambda = s->last_lambda_for[AV_PICTURE_TYPE_B]; ^ 1127. if (!b_lambda) // FIXME we should do this somewhere else 1128. b_lambda = p_lambda; libavcodec/mpegvideo_enc.c:1127:10: Taking false branch 1125. //p_lambda * FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; 1126. b_lambda = s->last_lambda_for[AV_PICTURE_TYPE_B]; 1127. if (!b_lambda) // FIXME we should do this somewhere else ^ 1128. b_lambda = p_lambda; 1129. lambda2 = (b_lambda * b_lambda + (1 << FF_LAMBDA_SHIFT) / 2) >> libavcodec/mpegvideo_enc.c:1129:5: 1127. if (!b_lambda) // FIXME we should do this somewhere else 1128. b_lambda = p_lambda; 1129. lambda2 = (b_lambda * b_lambda + (1 << FF_LAMBDA_SHIFT) / 2) >> ^ 1130. FF_LAMBDA_SHIFT; 1131. libavcodec/mpegvideo_enc.c:1132:5: 1130. FF_LAMBDA_SHIFT; 1131. 1132. c->width = s->width >> scale; ^ 1133. c->height = s->height >> scale; 1134. c->flags = CODEC_FLAG_QSCALE | CODEC_FLAG_PSNR |
https://github.com/libav/libav/blob/e1e369049e3d2f88eed6ed38eb3dd704681c7f1a/libavcodec/mpegvideo_enc.c/#L1132
d2a_code_trace_data_43493
static void get_visual_weight(int16_t *weight, uint8_t *ptr, int stride){ int x, y; for(y=0; y<8; y++){ for(x=0; x<8; x++){ int x2, y2; int sum=0; int sqr=0; int count=0; for(y2= FFMAX(y-1, 0); y2 < FFMIN(8, y+2); y2++){ for(x2= FFMAX(x-1, 0); x2 < FFMIN(8, x+2); x2++){ int v= ptr[x2 + y2*stride]; sum += v; sqr += v*v; count++; } } weight[x + 8*y]= (36*ff_sqrt(count*sqr - sum*sum)) / count; } } } libavcodec/mpegvideo_enc.c:1646: error: Buffer Overrun L2 Offset: [7, 70] (⇐ 7 + [0, 63]) Size: 8 by call to `get_visual_weight`. libavcodec/mpegvideo_enc.c:1457:1: Array declaration 1455. } 1456. 1457. static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, int motion_y, int mb_block_height, int mb_block_count) ^ 1458. { 1459. int16_t weight[8][64]; libavcodec/mpegvideo_enc.c:1646:30: Call 1644. if(!s->chroma_y_shift){ /* 422 */ 1645. if(!skip_dct[6]) get_visual_weight(weight[6], ptr_cb + (dct_offset>>1), wrap_c); 1646. if(!skip_dct[7]) get_visual_weight(weight[7], ptr_cr + (dct_offset>>1), wrap_c); ^ 1647. } 1648. memcpy(orig[0], s->block[0], sizeof(DCTELEM)*64*mb_block_count); libavcodec/mpegvideo_enc.c:1437:9: <Offset trace> 1435. int x, y; 1436. //FIXME optimize 1437. for(y=0; y<8; y++){ ^ 1438. for(x=0; x<8; x++){ 1439. int x2, y2; libavcodec/mpegvideo_enc.c:1437:9: Assignment 1435. int x, y; 1436. //FIXME optimize 1437. for(y=0; y<8; y++){ ^ 1438. for(x=0; x<8; x++){ 1439. int x2, y2; libavcodec/mpegvideo_enc.c:1434:1: <Length trace> 1432. } 1433. 1434. static void get_visual_weight(int16_t *weight, uint8_t *ptr, int stride){ ^ 1435. int x, y; 1436. //FIXME optimize libavcodec/mpegvideo_enc.c:1434:1: Parameter `*weight` 1432. } 1433. 1434. static void get_visual_weight(int16_t *weight, uint8_t *ptr, int stride){ ^ 1435. int x, y; 1436. //FIXME optimize libavcodec/mpegvideo_enc.c:1452:13: Array access: Offset: [7, 70] (⇐ 7 + [0, 63]) Size: 8 by call to `get_visual_weight` 1450. } 1451. } 1452. weight[x + 8*y]= (36*ff_sqrt(count*sqr - sum*sum)) / count; ^ 1453. } 1454. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo_enc.c/#L1452
d2a_code_trace_data_43494
static inline uint64_t get_val(BitstreamContext *bc, unsigned n) { #ifdef BITSTREAM_READER_LE uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1); bc->bits >>= n; #else uint64_t ret = bc->bits >> (64 - n); bc->bits <<= n; #endif bc->bits_left -= n; return ret; } libavcodec/alsdec.c:1182: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `bitstream_read_bit`. libavcodec/alsdec.c:1175:1: Parameter `ctx->bc.bits_left` 1173. /** Read the channel data. 1174. */ 1175. static int read_channel_data(ALSDecContext *ctx, ALSChannelData *cd, int c) ^ 1176. { 1177. BitstreamContext *bc = &ctx->bc; libavcodec/alsdec.c:1182:57: Call 1180. int entries = 0; 1181. 1182. while (entries < channels && !(current->stop_flag = bitstream_read_bit(bc))) { ^ 1183. current->master_channel = bitstream_read(bc, av_ceil_log2(channels)); 1184. libavcodec/bitstream.h:145:1: Parameter `bc->bits_left` 143. 144. /* Return one bit from the buffer. */ 145. static inline unsigned bitstream_read_bit(BitstreamContext *bc) ^ 146. { 147. if (!bc->bits_left) libavcodec/bitstream.h:150:12: Call 148. refill_64(bc); 149. 150. return get_val(bc, 1); ^ 151. } 152. libavcodec/bitstream.h:130:1: <LHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `bc->bits_left` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: <RHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `bitstream_read_bit` 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret;
https://github.com/libav/libav/blob/7ff018c1cb43a5fe5ee2049d325cdd785852067a/libavcodec/bitstream.h/#L139
d2a_code_trace_data_43495
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; } } } ssl/ssl_lib.c:3806: error: INTEGER_OVERFLOW_L2 ([0, max(0, `s->ctx->sessions->num_nodes`)] - 1):unsigned32 by call to `SSL_free`. Showing all 17 steps of the trace ssl/ssl_lib.c:3693:1: Parameter `s->ctx->sessions->num_nodes` 3691. } 3692. 3693. > SSL *SSL_dup(SSL *s) 3694. { 3695. SSL *ret; ssl/ssl_lib.c:3707:16: Call 3705. * Otherwise, copy configuration state, and session if set. 3706. */ 3707. if ((ret = SSL_new(SSL_get_SSL_CTX(s))) == NULL) ^ 3708. return NULL; 3709. ssl/ssl_lib.c:671:1: Parameter `ctx->sessions->num_nodes` 669. } 670. 671. > SSL *SSL_new(SSL_CTX *ctx) 672. { 673. SSL *s; ssl/ssl_lib.c:3806:5: Call 3804. 3805. err: 3806. SSL_free(ret); ^ 3807. return NULL; 3808. } ssl/ssl_lib.c:1133:1: Parameter `s->ctx->sessions->num_nodes` 1131. } 1132. 1133. > void SSL_free(SSL *s) 1134. { 1135. int i; ssl/ssl_lib.c:1206:5: Call 1204. RECORD_LAYER_release(&s->rlayer); 1205. 1206. SSL_CTX_free(s->ctx); ^ 1207. 1208. ASYNC_WAIT_CTX_free(s->waitctx); ssl/ssl_lib.c:3078:1: Parameter `a->sessions->num_nodes` 3076. } 3077. 3078. > void SSL_CTX_free(SSL_CTX *a) 3079. { 3080. int i; ssl/ssl_lib.c:3104:9: Call 3102. */ 3103. if (a->sessions != NULL) 3104. SSL_CTX_flush_sessions(a, 0); ^ 3105. 3106. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:1106:1: Parameter `s->sessions->num_nodes` 1104. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1105. 1106. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 1107. { 1108. unsigned long i; ssl/ssl_sess.c:1119:5: Call 1117. i = lh_SSL_SESSION_get_down_load(s->sessions); 1118. lh_SSL_SESSION_set_down_load(s->sessions, 0); 1119. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp); ^ 1120. lh_SSL_SESSION_set_down_load(s->sessions, i); 1121. CRYPTO_THREAD_unlock(s->lock); ssl/ssl_sess.c:1104:1: Parameter `lh->num_nodes` 1102. } 1103. 1104. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1105. 1106. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) ssl/ssl_sess.c:1104:1: Call 1102. } 1103. 1104. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1105. 1106. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) crypto/lhash/lhash.c:209:1: Parameter `lh->num_nodes` 207. } 208. 209. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 210. { 211. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); crypto/lhash/lhash.c:211:5: Call 209. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 210. { 211. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); ^ 212. } 213. crypto/lhash/lhash.c:177:1: <LHS trace> 175. } 176. 177. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 178. OPENSSL_LH_DOALL_FUNC func, 179. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:177:1: Parameter `lh->num_nodes` 175. } 176. 177. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 178. OPENSSL_LH_DOALL_FUNC func, 179. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:191:10: Binary operation: ([0, max(0, s->ctx->sessions->num_nodes)] - 1):unsigned32 by call to `SSL_free` 189. * memory leaks otherwise 190. */ 191. for (i = lh->num_nodes - 1; i >= 0; i--) { ^ 192. a = lh->b[i]; 193. while (a != NULL) {
https://github.com/openssl/openssl/blob/6e68dae85a8f91944370125561c7ec0d5da46c20/crypto/lhash/lhash.c/#L191
d2a_code_trace_data_43496
MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt) { EVP_PKEY *pkey = NULL; const unsigned char *data; #ifndef OPENSSL_NO_GOST unsigned char *gost_data = NULL; #endif MSG_PROCESS_RETURN ret = MSG_PROCESS_ERROR; int j; unsigned int len; X509 *peer; const EVP_MD *md = NULL; size_t hdatalen = 0; void *hdata; unsigned char tls13tbs[TLS13_TBS_PREAMBLE_SIZE + EVP_MAX_MD_SIZE]; EVP_MD_CTX *mctx = EVP_MD_CTX_new(); EVP_PKEY_CTX *pctx = NULL; if (mctx == NULL) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_MALLOC_FAILURE); goto err; } peer = s->session->peer; pkey = X509_get0_pubkey(peer); if (pkey == NULL) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_INTERNAL_ERROR); goto err; } if (ssl_cert_lookup_by_pkey(pkey, NULL) == NULL) { SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER, SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE); goto err; } if (SSL_USE_SIGALGS(s)) { unsigned int sigalg; if (!PACKET_get_net_2(pkt, &sigalg)) { SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_BAD_PACKET); goto err; } if (tls12_check_peer_sigalg(s, sigalg, pkey) <= 0) { goto err; } #ifdef SSL_DEBUG fprintf(stderr, "USING TLSv1.2 HASH %s\n", EVP_MD_name(md)); #endif } else if (!tls1_set_peer_legacy_sigalg(s, pkey)) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_INTERNAL_ERROR); goto err; } if (!tls1_lookup_md(s->s3->tmp.peer_sigalg, &md)) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_INTERNAL_ERROR); goto err; } #ifndef OPENSSL_NO_GOST if (!SSL_USE_SIGALGS(s) && ((PACKET_remaining(pkt) == 64 && (EVP_PKEY_id(pkey) == NID_id_GostR3410_2001 || EVP_PKEY_id(pkey) == NID_id_GostR3410_2012_256)) || (PACKET_remaining(pkt) == 128 && EVP_PKEY_id(pkey) == NID_id_GostR3410_2012_512))) { len = PACKET_remaining(pkt); } else #endif if (!PACKET_get_net_2(pkt, &len)) { SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_LENGTH_MISMATCH); goto err; } j = EVP_PKEY_size(pkey); if (((int)len > j) || ((int)PACKET_remaining(pkt) > j) || (PACKET_remaining(pkt) == 0)) { SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_WRONG_SIGNATURE_SIZE); goto err; } if (!PACKET_get_bytes(pkt, &data, len)) { SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_LENGTH_MISMATCH); goto err; } if (!get_cert_verify_tbs_data(s, tls13tbs, &hdata, &hdatalen)) { goto err; } #ifdef SSL_DEBUG fprintf(stderr, "Using client verify alg %s\n", EVP_MD_name(md)); #endif if (EVP_DigestVerifyInit(mctx, &pctx, md, NULL, pkey) <= 0) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_EVP_LIB); goto err; } #ifndef OPENSSL_NO_GOST { int pktype = EVP_PKEY_id(pkey); if (pktype == NID_id_GostR3410_2001 || pktype == NID_id_GostR3410_2012_256 || pktype == NID_id_GostR3410_2012_512) { if ((gost_data = OPENSSL_malloc(len)) == NULL) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_MALLOC_FAILURE); goto err; } BUF_reverse(gost_data, data, len); data = gost_data; } } #endif if (SSL_USE_PSS(s)) { if (EVP_PKEY_CTX_set_rsa_padding(pctx, RSA_PKCS1_PSS_PADDING) <= 0 || EVP_PKEY_CTX_set_rsa_pss_saltlen(pctx, RSA_PSS_SALTLEN_DIGEST) <= 0) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_EVP_LIB); goto err; } } if (s->version == SSL3_VERSION) { if (EVP_DigestVerifyUpdate(mctx, hdata, hdatalen) <= 0 || !EVP_MD_CTX_ctrl(mctx, EVP_CTRL_SSL3_MASTER_SECRET, (int)s->session->master_key_length, s->session->master_key)) { SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_EVP_LIB); goto err; } if (EVP_DigestVerifyFinal(mctx, data, len) <= 0) { SSLfatal(s, SSL_AD_DECRYPT_ERROR, SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_BAD_SIGNATURE); goto err; } } else { j = EVP_DigestVerify(mctx, data, len, hdata, hdatalen); if (j <= 0) { SSLfatal(s, SSL_AD_DECRYPT_ERROR, SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_BAD_SIGNATURE); goto err; } } ret = MSG_PROCESS_CONTINUE_READING; err: BIO_free(s->s3->handshake_buffer); s->s3->handshake_buffer = NULL; EVP_MD_CTX_free(mctx); #ifndef OPENSSL_NO_GOST OPENSSL_free(gost_data); #endif return ret; } ssl/statem/statem_lib.c:496: error: MEMORY_LEAK memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 346, column 24 is not reachable after line 496, column 5. Showing all 68 steps of the trace ssl/statem/statem_lib.c:331:1: start of procedure tls_process_cert_verify() 329. } 330. 331. > MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt) 332. { 333. EVP_PKEY *pkey = NULL; ssl/statem/statem_lib.c:333:5: 331. MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt) 332. { 333. > EVP_PKEY *pkey = NULL; 334. const unsigned char *data; 335. #ifndef OPENSSL_NO_GOST ssl/statem/statem_lib.c:336:5: 334. const unsigned char *data; 335. #ifndef OPENSSL_NO_GOST 336. > unsigned char *gost_data = NULL; 337. #endif 338. MSG_PROCESS_RETURN ret = MSG_PROCESS_ERROR; ssl/statem/statem_lib.c:338:5: 336. unsigned char *gost_data = NULL; 337. #endif 338. > MSG_PROCESS_RETURN ret = MSG_PROCESS_ERROR; 339. int j; 340. unsigned int len; ssl/statem/statem_lib.c:342:5: 340. unsigned int len; 341. X509 *peer; 342. > const EVP_MD *md = NULL; 343. size_t hdatalen = 0; 344. void *hdata; ssl/statem/statem_lib.c:343:5: 341. X509 *peer; 342. const EVP_MD *md = NULL; 343. > size_t hdatalen = 0; 344. void *hdata; 345. unsigned char tls13tbs[TLS13_TBS_PREAMBLE_SIZE + EVP_MAX_MD_SIZE]; ssl/statem/statem_lib.c:346:5: 344. void *hdata; 345. unsigned char tls13tbs[TLS13_TBS_PREAMBLE_SIZE + EVP_MAX_MD_SIZE]; 346. > EVP_MD_CTX *mctx = EVP_MD_CTX_new(); 347. EVP_PKEY_CTX *pctx = NULL; 348. crypto/evp/digest.c:44:1: start of procedure EVP_MD_CTX_new() 42. } 43. 44. > EVP_MD_CTX *EVP_MD_CTX_new(void) 45. { 46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); crypto/evp/digest.c:46:5: 44. EVP_MD_CTX *EVP_MD_CTX_new(void) 45. { 46. > return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 47. } 48. crypto/mem.c:228:1: start of procedure CRYPTO_zalloc() 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:5: 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. > void *ret = CRYPTO_malloc(num, file, line); 231. 232. FAILTEST(); crypto/mem.c:192:1: start of procedure CRYPTO_malloc() 190. #endif 191. 192. > void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. void *ret = NULL; crypto/mem.c:194:5: 192. void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. > void *ret = NULL; 195. 196. INCREMENT(malloc_count); crypto/mem.c:197:9: Taking false branch 195. 196. INCREMENT(malloc_count); 197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 198. return malloc_impl(num, file, line); 199. crypto/mem.c:200:9: Taking false branch 198. return malloc_impl(num, file, line); 199. 200. if (num == 0) ^ 201. return NULL; 202. crypto/mem.c:204:9: Taking true branch 202. 203. FAILTEST(); 204. if (allow_customize) { ^ 205. /* 206. * Disallow customization after the first allocation. We only set this crypto/mem.c:210:9: 208. * allocation. 209. */ 210. > allow_customize = 0; 211. } 212. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:221:5: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:221:19: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:222:5: 220. #else 221. (void)(file); (void)(line); 222. > ret = malloc(num); 223. #endif 224. crypto/mem.c:225:5: 223. #endif 224. 225. > return ret; 226. } 227. crypto/mem.c:226:1: return from a call to CRYPTO_malloc 224. 225. return ret; 226. > } 227. 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:233:9: Taking true branch 231. 232. FAILTEST(); 233. if (ret != NULL) ^ 234. memset(ret, 0, num); 235. return ret; crypto/mem.c:234:9: 232. FAILTEST(); 233. if (ret != NULL) 234. > memset(ret, 0, num); 235. return ret; 236. } crypto/mem.c:235:5: 233. if (ret != NULL) 234. memset(ret, 0, num); 235. > return ret; 236. } 237. crypto/mem.c:236:1: return from a call to CRYPTO_zalloc 234. memset(ret, 0, num); 235. return ret; 236. > } 237. 238. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/evp/digest.c:47:1: return from a call to EVP_MD_CTX_new 45. { 46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 47. > } 48. 49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) ssl/statem/statem_lib.c:347:5: 345. unsigned char tls13tbs[TLS13_TBS_PREAMBLE_SIZE + EVP_MAX_MD_SIZE]; 346. EVP_MD_CTX *mctx = EVP_MD_CTX_new(); 347. > EVP_PKEY_CTX *pctx = NULL; 348. 349. if (mctx == NULL) { ssl/statem/statem_lib.c:349:9: Taking false branch 347. EVP_PKEY_CTX *pctx = NULL; 348. 349. if (mctx == NULL) { ^ 350. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CERT_VERIFY, 351. ERR_R_MALLOC_FAILURE); ssl/statem/statem_lib.c:355:5: 353. } 354. 355. > peer = s->session->peer; 356. pkey = X509_get0_pubkey(peer); 357. if (pkey == NULL) { ssl/statem/statem_lib.c:356:5: 354. 355. peer = s->session->peer; 356. > pkey = X509_get0_pubkey(peer); 357. if (pkey == NULL) { 358. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CERT_VERIFY, crypto/x509/x509_cmp.c:264:1: start of procedure X509_get0_pubkey() 262. } 263. 264. > EVP_PKEY *X509_get0_pubkey(const X509 *x) 265. { 266. if (x == NULL) crypto/x509/x509_cmp.c:266:9: Taking false branch 264. EVP_PKEY *X509_get0_pubkey(const X509 *x) 265. { 266. if (x == NULL) ^ 267. return NULL; 268. return X509_PUBKEY_get0(x->cert_info.key); crypto/x509/x509_cmp.c:268:5: 266. if (x == NULL) 267. return NULL; 268. > return X509_PUBKEY_get0(x->cert_info.key); 269. } 270. crypto/x509/x_pubkey.c:140:1: start of procedure X509_PUBKEY_get0() 138. } 139. 140. > EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key) 141. { 142. EVP_PKEY *ret = NULL; crypto/x509/x_pubkey.c:142:5: 140. EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key) 141. { 142. > EVP_PKEY *ret = NULL; 143. 144. if (key == NULL || key->public_key == NULL) crypto/x509/x_pubkey.c:144:9: Taking false branch 142. EVP_PKEY *ret = NULL; 143. 144. if (key == NULL || key->public_key == NULL) ^ 145. return NULL; 146. crypto/x509/x_pubkey.c:144:24: Taking false branch 142. EVP_PKEY *ret = NULL; 143. 144. if (key == NULL || key->public_key == NULL) ^ 145. return NULL; 146. crypto/x509/x_pubkey.c:147:9: Taking false branch 145. return NULL; 146. 147. if (key->pkey != NULL) ^ 148. return key->pkey; 149. crypto/x509/x_pubkey.c:158:5: 156. * in the queue. 157. */ 158. > x509_pubkey_decode(&ret, key); 159. /* If decode doesn't fail something bad happened */ 160. if (ret != NULL) { crypto/x509/x_pubkey.c:103:1: start of procedure x509_pubkey_decode() 101. 102. 103. > static int x509_pubkey_decode(EVP_PKEY **ppkey, X509_PUBKEY *key) 104. { 105. EVP_PKEY *pkey = EVP_PKEY_new(); crypto/x509/x_pubkey.c:105:5: Skipping EVP_PKEY_new(): empty list of specs 103. static int x509_pubkey_decode(EVP_PKEY **ppkey, X509_PUBKEY *key) 104. { 105. EVP_PKEY *pkey = EVP_PKEY_new(); ^ 106. 107. if (pkey == NULL) { crypto/x509/x_pubkey.c:107:9: Taking true branch 105. EVP_PKEY *pkey = EVP_PKEY_new(); 106. 107. if (pkey == NULL) { ^ 108. X509err(X509_F_X509_PUBKEY_DECODE, ERR_R_MALLOC_FAILURE); 109. return -1; crypto/x509/x_pubkey.c:108:9: Skipping ERR_put_error(): empty list of specs 106. 107. if (pkey == NULL) { 108. X509err(X509_F_X509_PUBKEY_DECODE, ERR_R_MALLOC_FAILURE); ^ 109. return -1; 110. } crypto/x509/x_pubkey.c:109:9: 107. if (pkey == NULL) { 108. X509err(X509_F_X509_PUBKEY_DECODE, ERR_R_MALLOC_FAILURE); 109. > return -1; 110. } 111. crypto/x509/x_pubkey.c:138:1: return from a call to x509_pubkey_decode 136. EVP_PKEY_free(pkey); 137. return 0; 138. > } 139. 140. EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key) crypto/x509/x_pubkey.c:160:9: Taking false branch 158. x509_pubkey_decode(&ret, key); 159. /* If decode doesn't fail something bad happened */ 160. if (ret != NULL) { ^ 161. X509err(X509_F_X509_PUBKEY_GET0, ERR_R_INTERNAL_ERROR); 162. EVP_PKEY_free(ret); crypto/x509/x_pubkey.c:165:5: 163. } 164. 165. > return NULL; 166. } 167. crypto/x509/x_pubkey.c:166:1: return from a call to X509_PUBKEY_get0 164. 165. return NULL; 166. > } 167. 168. EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key) crypto/x509/x509_cmp.c:269:1: return from a call to X509_get0_pubkey 267. return NULL; 268. return X509_PUBKEY_get0(x->cert_info.key); 269. > } 270. 271. EVP_PKEY *X509_get_pubkey(X509 *x) ssl/statem/statem_lib.c:357:9: Taking true branch 355. peer = s->session->peer; 356. pkey = X509_get0_pubkey(peer); 357. if (pkey == NULL) { ^ 358. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CERT_VERIFY, 359. ERR_R_INTERNAL_ERROR); ssl/statem/statem_lib.c:358:9: 356. pkey = X509_get0_pubkey(peer); 357. if (pkey == NULL) { 358. > SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CERT_VERIFY, 359. ERR_R_INTERNAL_ERROR); 360. goto err; test/tls13secretstest.c:210:1: start of procedure ossl_statem_fatal() 208. } 209. 210. > void ossl_statem_fatal(SSL *s, int al, int func, int reason, const char *file, 211. int line) 212. { test/tls13secretstest.c:213:1: return from a call to ossl_statem_fatal 211. int line) 212. { 213. > } 214. 215. int ossl_statem_export_allowed(SSL *s) ssl/statem/statem_lib.c:493:2: 491. 492. ret = MSG_PROCESS_CONTINUE_READING; 493. > err: 494. BIO_free(s->s3->handshake_buffer); 495. s->s3->handshake_buffer = NULL; ssl/statem/statem_lib.c:494:5: Skipping BIO_free(): empty list of specs 492. ret = MSG_PROCESS_CONTINUE_READING; 493. err: 494. BIO_free(s->s3->handshake_buffer); ^ 495. s->s3->handshake_buffer = NULL; 496. EVP_MD_CTX_free(mctx); ssl/statem/statem_lib.c:495:5: 493. err: 494. BIO_free(s->s3->handshake_buffer); 495. > s->s3->handshake_buffer = NULL; 496. EVP_MD_CTX_free(mctx); 497. #ifndef OPENSSL_NO_GOST ssl/statem/statem_lib.c:496:5: 494. BIO_free(s->s3->handshake_buffer); 495. s->s3->handshake_buffer = NULL; 496. > EVP_MD_CTX_free(mctx); 497. #ifndef OPENSSL_NO_GOST 498. OPENSSL_free(gost_data); crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_free() 47. } 48. 49. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 50. { 51. EVP_MD_CTX_reset(ctx); crypto/evp/digest.c:51:5: Skipping EVP_MD_CTX_reset(): empty list of specs 49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 50. { 51. EVP_MD_CTX_reset(ctx); ^ 52. OPENSSL_free(ctx); 53. } crypto/evp/digest.c:52:5: 50. { 51. EVP_MD_CTX_reset(ctx); 52. > OPENSSL_free(ctx); 53. } 54. crypto/mem.c:295:1: start of procedure CRYPTO_free() 293. } 294. 295. > void CRYPTO_free(void *str, const char *file, int line) 296. { 297. INCREMENT(free_count); crypto/mem.c:298:9: Taking true branch 296. { 297. INCREMENT(free_count); 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 299. free_impl(str, file, line); 300. return; crypto/mem.c:298:30: Taking true branch 296. { 297. INCREMENT(free_count); 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 299. free_impl(str, file, line); 300. return; crypto/mem.c:299:9: Skipping __function_pointer__(): unresolved function pointer 297. INCREMENT(free_count); 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { 299. free_impl(str, file, line); ^ 300. return; 301. } crypto/mem.c:300:9: 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { 299. free_impl(str, file, line); 300. > return; 301. } 302. crypto/mem.c:314:1: return from a call to CRYPTO_free 312. free(str); 313. #endif 314. > } 315. 316. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/evp/digest.c:53:1: return from a call to EVP_MD_CTX_free 51. EVP_MD_CTX_reset(ctx); 52. OPENSSL_free(ctx); 53. > } 54. 55. int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
https://github.com/openssl/openssl/blob/f770d75b1cac264d6280ec7326277daff6965cbb/ssl/statem/statem_lib.c/#L496
d2a_code_trace_data_43497
int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod){ int64_t c= (a-b) & (mod-1); if(c > (mod>>1)) c-= mod; return c; } libavformat/utils.c:1282: error: Integer Overflow L2 ([0, +oo] - 1):unsigned64 by call to `av_compare_mod`. libavformat/utils.c:1279:17: Assignment 1277. 1278. if (next_pkt->dts != AV_NOPTS_VALUE) { 1279. int wrap_bits = s->streams[next_pkt->stream_index]->pts_wrap_bits; ^ 1280. while (pktl && next_pkt->pts == AV_NOPTS_VALUE) { 1281. if (pktl->pkt.stream_index == next_pkt->stream_index && libavformat/utils.c:1282:26: Call 1280. while (pktl && next_pkt->pts == AV_NOPTS_VALUE) { 1281. if (pktl->pkt.stream_index == next_pkt->stream_index && 1282. (av_compare_mod(next_pkt->dts, pktl->pkt.dts, 2LL << (wrap_bits - 1)) < 0) && ^ 1283. av_compare_mod(pktl->pkt.pts, pktl->pkt.dts, 2LL << (wrap_bits - 1))) { //not b frame 1284. next_pkt->pts = pktl->pkt.dts; libavutil/mathematics.c:147:1: <LHS trace> 145. } 146. 147. int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod){ ^ 148. int64_t c= (a-b) & (mod-1); 149. if(c > (mod>>1)) libavutil/mathematics.c:147:1: Parameter `mod` 145. } 146. 147. int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod){ ^ 148. int64_t c= (a-b) & (mod-1); 149. if(c > (mod>>1)) libavutil/mathematics.c:148:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `av_compare_mod` 146. 147. int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod){ 148. int64_t c= (a-b) & (mod-1); ^ 149. if(c > (mod>>1)) 150. c-= mod;
https://github.com/libav/libav/blob/2ba65879b5853b49bbefb75346fd73c8645bccea/libavutil/mathematics.c/#L148
d2a_code_trace_data_43498
int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; if (pkt->buf->length > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = (pkt->buf->length == 0) ? DEFAULT_BUF_SIZE : pkt->buf->length * 2; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; pkt->written += len; pkt->curr += len; return 1; } ssl/t1_lib.c:1074: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + `s->tlsext_hostname->strlen` + 24]):unsigned64 by call to `WPACKET_start_sub_packet_len__`. Showing all 10 steps of the trace ssl/t1_lib.c:1072:14: Call 1070. /* Add SRP username if there is one */ 1071. if (s->srp_ctx.login != NULL) { 1072. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_srp) ^ 1073. /* Sub-packet for SRP extension */ 1074. || !WPACKET_start_sub_packet_u16(pkt) ssl/packet.c:238:1: Parameter `pkt->buf->length` 236. } 237. 238. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 239. { 240. unsigned char *data; ssl/t1_lib.c:1074:21: Call 1072. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_srp) 1073. /* Sub-packet for SRP extension */ 1074. || !WPACKET_start_sub_packet_u16(pkt) ^ 1075. || !WPACKET_start_sub_packet_u8(pkt) 1076. /* login must not be zero...internal error if so */ ssl/packet.c:201:1: Parameter `pkt->written` 199. } 200. 201. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 202. { 203. WPACKET_SUB *sub; ssl/packet.c:225:10: Call 223. } 224. 225. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 226. return 0; 227. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */ ssl/packet.c:15:1: <LHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `pkt->buf->length` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: <RHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `len` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:25:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + pkt->written + s->tlsext_hostname->strlen + 24]):unsigned64 by call to `WPACKET_start_sub_packet_len__` 23. return 0; 24. 25. if (pkt->buf->length - pkt->written < len) { ^ 26. size_t newlen; 27.
https://github.com/openssl/openssl/blob/84d5549e692e63a16fa1b11603e4098fc31746e9/ssl/packet.c/#L25
d2a_code_trace_data_43499
HANDSHAKE_RESULT *do_handshake(SSL_CTX *server_ctx, SSL_CTX *server2_ctx, SSL_CTX *client_ctx, const SSL_TEST_CTX *test_ctx) { SSL *server, *client; BIO *client_to_server, *server_to_client; HANDSHAKE_EX_DATA server_ex_data, client_ex_data; CTX_DATA client_ctx_data, server_ctx_data, server2_ctx_data; HANDSHAKE_RESULT *ret = HANDSHAKE_RESULT_new(); int client_turn = 1; peer_status_t client_status = PEER_RETRY, server_status = PEER_RETRY; handshake_status_t status = HANDSHAKE_RETRY; unsigned char* tick = NULL; size_t tick_len = 0; SSL_SESSION* sess = NULL; const unsigned char *proto = NULL; unsigned int proto_len = 0; memset(&server_ctx_data, 0, sizeof(server_ctx_data)); memset(&server2_ctx_data, 0, sizeof(server2_ctx_data)); memset(&client_ctx_data, 0, sizeof(client_ctx_data)); configure_handshake_ctx(server_ctx, server2_ctx, client_ctx, test_ctx, &server_ctx_data, &server2_ctx_data, &client_ctx_data); server = SSL_new(server_ctx); client = SSL_new(client_ctx); OPENSSL_assert(server != NULL && client != NULL); configure_handshake_ssl(server, client, test_ctx); memset(&server_ex_data, 0, sizeof(server_ex_data)); memset(&client_ex_data, 0, sizeof(client_ex_data)); ret->result = SSL_TEST_INTERNAL_ERROR; client_to_server = BIO_new(BIO_s_mem()); server_to_client = BIO_new(BIO_s_mem()); OPENSSL_assert(client_to_server != NULL && server_to_client != NULL); BIO_set_nbio(client_to_server, 1); BIO_set_nbio(server_to_client, 1); SSL_set_connect_state(client); SSL_set_accept_state(server); SSL_set_bio(client, server_to_client, client_to_server); OPENSSL_assert(BIO_up_ref(server_to_client) > 0); OPENSSL_assert(BIO_up_ref(client_to_server) > 0); SSL_set_bio(server, client_to_server, server_to_client); ex_data_idx = SSL_get_ex_new_index(0, "ex data", NULL, NULL, NULL); OPENSSL_assert(ex_data_idx >= 0); OPENSSL_assert(SSL_set_ex_data(server, ex_data_idx, &server_ex_data) == 1); OPENSSL_assert(SSL_set_ex_data(client, ex_data_idx, &client_ex_data) == 1); SSL_set_info_callback(server, &info_cb); SSL_set_info_callback(client, &info_cb); for(;;) { if (client_turn) { client_status = do_handshake_step(client); status = handshake_status(client_status, server_status, 1 ); } else { server_status = do_handshake_step(server); status = handshake_status(server_status, client_status, 0 ); } switch (status) { case HANDSHAKE_SUCCESS: ret->result = SSL_TEST_SUCCESS; goto err; case CLIENT_ERROR: ret->result = SSL_TEST_CLIENT_FAIL; goto err; case SERVER_ERROR: ret->result = SSL_TEST_SERVER_FAIL; goto err; case INTERNAL_ERROR: ret->result = SSL_TEST_INTERNAL_ERROR; goto err; case HANDSHAKE_RETRY: client_turn ^= 1; break; } } err: ret->server_alert_sent = server_ex_data.alert_sent; ret->server_alert_received = client_ex_data.alert_received; ret->client_alert_sent = client_ex_data.alert_sent; ret->client_alert_received = server_ex_data.alert_received; ret->server_protocol = SSL_version(server); ret->client_protocol = SSL_version(client); ret->servername = server_ex_data.servername; if ((sess = SSL_get0_session(client)) != NULL) SSL_SESSION_get0_ticket(sess, &tick, &tick_len); if (tick == NULL || tick_len == 0) ret->session_ticket = SSL_TEST_SESSION_TICKET_NO; else ret->session_ticket = SSL_TEST_SESSION_TICKET_YES; ret->session_ticket_do_not_call = server_ex_data.session_ticket_do_not_call; SSL_get0_next_proto_negotiated(client, &proto, &proto_len); ret->client_npn_negotiated = dup_str(proto, proto_len); SSL_get0_next_proto_negotiated(server, &proto, &proto_len); ret->server_npn_negotiated = dup_str(proto, proto_len); SSL_get0_alpn_selected(client, &proto, &proto_len); ret->client_alpn_negotiated = dup_str(proto, proto_len); SSL_get0_alpn_selected(server, &proto, &proto_len); ret->server_alpn_negotiated = dup_str(proto, proto_len); ctx_data_free_data(&server_ctx_data); ctx_data_free_data(&server2_ctx_data); ctx_data_free_data(&client_ctx_data); SSL_free(server); SSL_free(client); return ret; } test/handshake_helper.c:593: error: UNINITIALIZED_VALUE The value read from client_ex_data.alert_sent was never initialized. Showing all 1 steps of the trace test/handshake_helper.c:593:5: 591. ret->server_alert_sent = server_ex_data.alert_sent; 592. ret->server_alert_received = client_ex_data.alert_received; 593. > ret->client_alert_sent = client_ex_data.alert_sent; 594. ret->client_alert_received = server_ex_data.alert_received; 595. ret->server_protocol = SSL_version(server);
https://github.com/openssl/openssl/blob/70c22888c1648fe8652e77107f3c74bf2212de36/test/handshake_helper.c/#L593
d2a_code_trace_data_43500
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) { int i, nw, lb, rb; BN_ULONG *t, *f; BN_ULONG l; bn_check_top(r); bn_check_top(a); if (n < 0) { BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT); return 0; } r->neg = a->neg; nw = n / BN_BITS2; if (bn_wexpand(r, a->top + nw + 1) == NULL) return (0); lb = n % BN_BITS2; rb = BN_BITS2 - lb; f = a->d; t = r->d; t[a->top + nw] = 0; if (lb == 0) for (i = a->top - 1; i >= 0; i--) t[nw + i] = f[i]; else for (i = a->top - 1; i >= 0; i--) { l = f[i]; t[nw + i + 1] |= (l >> rb) & BN_MASK2; t[nw + i] = (l << lb) & BN_MASK2; } memset(t, 0, sizeof(*t) * nw); r->top = a->top + nw + 1; bn_correct_top(r); bn_check_top(r); return (1); } crypto/bn/bn_prime.c:286: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `witness`. Showing all 20 steps of the trace crypto/bn/bn_prime.c:243:13: Call 241. if ((t = BN_CTX_get(ctx)) == NULL) 242. goto err; 243. if (BN_copy(t, a) == NULL) ^ 244. goto err; 245. t->neg = 0; crypto/bn/bn_lib.c:362:1: Parameter `a->top` 360. } 361. 362. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 363. { 364. int i; crypto/bn/bn_prime.c:286:13: Call 284. /* now 1 <= check < A */ 285. 286. j = witness(check, A, A1, A1_odd, k, ctx, mont); ^ 287. if (j == -1) 288. goto err; crypto/bn/bn_prime.c:385:1: Parameter `w->top` 383. } 384. 385. > static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1, 386. const BIGNUM *a1_odd, int k, BN_CTX *ctx, 387. BN_MONT_CTX *mont) crypto/bn/bn_prime.c:389:10: Call 387. BN_MONT_CTX *mont) 388. { 389. if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */ ^ 390. return -1; 391. if (BN_is_one(w)) crypto/bn/bn_exp.c:301:1: Parameter `a->top` 299. } 300. 301. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 302. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 303. { crypto/bn/bn_exp.c:313:16: Call 311. 312. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { 313. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 314. } 315. crypto/bn/bn_exp.c:601:1: Parameter `a->top` 599. * http://www.daemonology.net/hyperthreading-considered-harmful/) 600. */ 601. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 602. const BIGNUM *m, BN_CTX *ctx, 603. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:754:14: Call 752. /* prepare a^1 in Montgomery domain */ 753. if (a->neg || BN_ucmp(a, m) >= 0) { 754. if (!BN_mod(&am, a, m, ctx)) ^ 755. goto err; 756. if (!BN_to_montgomery(&am, &am, mont, ctx)) crypto/bn/bn_div.c:140:1: Parameter `num->top` 138. * If 'dv' or 'rm' is NULL, the respective value is not returned. 139. */ 140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 141. BN_CTX *ctx) 142. { crypto/bn/bn_div.c:210:11: Call 208. sdiv->neg = 0; 209. norm_shift += BN_BITS2; 210. if (!(BN_lshift(snum, num, norm_shift))) ^ 211. goto err; 212. snum->neg = 0; crypto/bn/bn_shift.c:81:1: <Offset trace> 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:81:1: Parameter `n` 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:96:5: Assignment 94. 95. r->neg = a->neg; 96. nw = n / BN_BITS2; ^ 97. if (bn_wexpand(r, a->top + nw + 1) == NULL) 98. return (0); crypto/bn/bn_shift.c:81:1: <Length trace> 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:81:1: Parameter `*r->d` 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:9: Call 95. r->neg = a->neg; 96. nw = n / BN_BITS2; 97. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 98. return (0); 99. lb = n % BN_BITS2; crypto/bn/bn_lib.c:1016:1: Parameter `*a->d` 1014. } 1015. 1016. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 1017. { 1018. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:102:5: Assignment 100. rb = BN_BITS2 - lb; 101. f = a->d; 102. t = r->d; ^ 103. t[a->top + nw] = 0; 104. if (lb == 0) crypto/bn/bn_shift.c:110:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `witness` 108. for (i = a->top - 1; i >= 0; i--) { 109. l = f[i]; 110. t[nw + i + 1] |= (l >> rb) & BN_MASK2; ^ 111. t[nw + i] = (l << lb) & BN_MASK2; 112. }
https://github.com/openssl/openssl/blob/d7c42d71ba407a4b3c26ed58263ae225976bbac3/crypto/bn/bn_shift.c/#L110
d2a_code_trace_data_43501
DH *ssl_get_auto_dh(SSL *s) { int dh_secbits = 80; if (s->cert->dh_tmp_auto == 2) return DH_get_1024_160(); if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) { if (s->s3->tmp.new_cipher->strength_bits == 256) dh_secbits = 128; else dh_secbits = 80; } else { CERT_PKEY *cpk = ssl_get_server_send_pkey(s); dh_secbits = EVP_PKEY_security_bits(cpk->privatekey); } if (dh_secbits >= 128) { DH *dhp = DH_new(); BIGNUM *p, *g; if (dhp == NULL) return NULL; g = BN_new(); if (g != NULL) BN_set_word(g, 2); if (dh_secbits >= 192) p = BN_get_rfc3526_prime_8192(NULL); else p = BN_get_rfc3526_prime_3072(NULL); if (p == NULL || g == NULL || !DH_set0_pqg(dhp, p, NULL, g)) { DH_free(dhp); BN_free(p); BN_free(g); return NULL; } return dhp; } if (dh_secbits >= 112) return DH_get_2048_224(); return DH_get_1024_160(); } ssl/t1_lib.c:3980: error: NULL_DEREFERENCE pointer `cpk` last assigned on line 3979 could be null and is dereferenced at line 3980, column 45. Showing all 30 steps of the trace ssl/t1_lib.c:3968:1: start of procedure ssl_get_auto_dh() 3966. 3967. #ifndef OPENSSL_NO_DH 3968. > DH *ssl_get_auto_dh(SSL *s) 3969. { 3970. int dh_secbits = 80; ssl/t1_lib.c:3970:5: 3968. DH *ssl_get_auto_dh(SSL *s) 3969. { 3970. > int dh_secbits = 80; 3971. if (s->cert->dh_tmp_auto == 2) 3972. return DH_get_1024_160(); ssl/t1_lib.c:3971:9: Taking false branch 3969. { 3970. int dh_secbits = 80; 3971. if (s->cert->dh_tmp_auto == 2) ^ 3972. return DH_get_1024_160(); 3973. if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) { ssl/t1_lib.c:3973:9: Taking false branch 3971. if (s->cert->dh_tmp_auto == 2) 3972. return DH_get_1024_160(); 3973. if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) { ^ 3974. if (s->s3->tmp.new_cipher->strength_bits == 256) 3975. dh_secbits = 128; ssl/t1_lib.c:3979:9: 3977. dh_secbits = 80; 3978. } else { 3979. > CERT_PKEY *cpk = ssl_get_server_send_pkey(s); 3980. dh_secbits = EVP_PKEY_security_bits(cpk->privatekey); 3981. } ssl/ssl_lib.c:2772:1: start of procedure ssl_get_server_send_pkey() 2770. } 2771. 2772. > CERT_PKEY *ssl_get_server_send_pkey(SSL *s) 2773. { 2774. CERT *c; ssl/ssl_lib.c:2777:5: 2775. int i; 2776. 2777. > c = s->cert; 2778. if (!s->s3 || !s->s3->tmp.new_cipher) 2779. return NULL; ssl/ssl_lib.c:2778:10: Taking false branch 2776. 2777. c = s->cert; 2778. if (!s->s3 || !s->s3->tmp.new_cipher) ^ 2779. return NULL; 2780. ssl_set_masks(s); ssl/ssl_lib.c:2778:20: Taking false branch 2776. 2777. c = s->cert; 2778. if (!s->s3 || !s->s3->tmp.new_cipher) ^ 2779. return NULL; 2780. ssl_set_masks(s); ssl/ssl_lib.c:2780:5: Skipping ssl_set_masks(): empty list of specs 2778. if (!s->s3 || !s->s3->tmp.new_cipher) 2779. return NULL; 2780. ssl_set_masks(s); ^ 2781. 2782. i = ssl_get_server_cert_index(s); ssl/ssl_lib.c:2782:5: 2780. ssl_set_masks(s); 2781. 2782. > i = ssl_get_server_cert_index(s); 2783. 2784. /* This may or may not be an error. */ ssl/ssl_lib.c:2751:1: start of procedure ssl_get_server_cert_index() 2749. #endif 2750. 2751. > static int ssl_get_server_cert_index(const SSL *s) 2752. { 2753. int idx; ssl/ssl_lib.c:2754:5: 2752. { 2753. int idx; 2754. > idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher); 2755. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509) 2756. idx = SSL_PKEY_RSA_SIGN; ssl/ssl_ciph.c:1872:1: start of procedure ssl_cipher_get_cert_index() 1870. 1871. /* For a cipher return the index corresponding to the certificate type */ 1872. > int ssl_cipher_get_cert_index(const SSL_CIPHER *c) 1873. { 1874. uint32_t alg_a; ssl/ssl_ciph.c:1876:5: 1874. uint32_t alg_a; 1875. 1876. > alg_a = c->algorithm_auth; 1877. 1878. if (alg_a & SSL_aECDSA) ssl/ssl_ciph.c:1878:9: Taking false branch 1876. alg_a = c->algorithm_auth; 1877. 1878. if (alg_a & SSL_aECDSA) ^ 1879. return SSL_PKEY_ECC; 1880. else if (alg_a & SSL_aDSS) ssl/ssl_ciph.c:1880:14: Taking false branch 1878. if (alg_a & SSL_aECDSA) 1879. return SSL_PKEY_ECC; 1880. else if (alg_a & SSL_aDSS) ^ 1881. return SSL_PKEY_DSA_SIGN; 1882. else if (alg_a & SSL_aRSA) ssl/ssl_ciph.c:1882:14: Taking true branch 1880. else if (alg_a & SSL_aDSS) 1881. return SSL_PKEY_DSA_SIGN; 1882. else if (alg_a & SSL_aRSA) ^ 1883. return SSL_PKEY_RSA_ENC; 1884. else if (alg_a & SSL_aGOST12) ssl/ssl_ciph.c:1883:9: 1881. return SSL_PKEY_DSA_SIGN; 1882. else if (alg_a & SSL_aRSA) 1883. > return SSL_PKEY_RSA_ENC; 1884. else if (alg_a & SSL_aGOST12) 1885. return SSL_PKEY_GOST_EC; ssl/ssl_ciph.c:1890:1: return from a call to ssl_cipher_get_cert_index 1888. 1889. return -1; 1890. > } 1891. 1892. const SSL_CIPHER *ssl_get_cipher_by_char(SSL *ssl, const unsigned char *ptr) ssl/ssl_lib.c:2755:9: Taking true branch 2753. int idx; 2754. idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher); 2755. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509) ^ 2756. idx = SSL_PKEY_RSA_SIGN; 2757. if (idx == SSL_PKEY_GOST_EC) { ssl/ssl_lib.c:2755:37: Taking false branch 2753. int idx; 2754. idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher); 2755. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509) ^ 2756. idx = SSL_PKEY_RSA_SIGN; 2757. if (idx == SSL_PKEY_GOST_EC) { ssl/ssl_lib.c:2757:9: Taking false branch 2755. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509) 2756. idx = SSL_PKEY_RSA_SIGN; 2757. if (idx == SSL_PKEY_GOST_EC) { ^ 2758. if (s->cert->pkeys[SSL_PKEY_GOST12_512].x509) 2759. idx = SSL_PKEY_GOST12_512; ssl/ssl_lib.c:2767:9: Taking false branch 2765. idx = -1; 2766. } 2767. if (idx == -1) ^ 2768. SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR); 2769. return idx; ssl/ssl_lib.c:2769:5: 2767. if (idx == -1) 2768. SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR); 2769. > return idx; 2770. } 2771. ssl/ssl_lib.c:2770:1: return from a call to ssl_get_server_cert_index 2768. SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR); 2769. return idx; 2770. > } 2771. 2772. CERT_PKEY *ssl_get_server_send_pkey(SSL *s) ssl/ssl_lib.c:2785:9: Taking true branch 2783. 2784. /* This may or may not be an error. */ 2785. if (i < 0) ^ 2786. return NULL; 2787. ssl/ssl_lib.c:2786:9: 2784. /* This may or may not be an error. */ 2785. if (i < 0) 2786. > return NULL; 2787. 2788. /* May be NULL. */ ssl/ssl_lib.c:2790:1: return from a call to ssl_get_server_send_pkey 2788. /* May be NULL. */ 2789. return &c->pkeys[i]; 2790. > } 2791. 2792. EVP_PKEY *ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *cipher, ssl/t1_lib.c:3980:9: 3978. } else { 3979. CERT_PKEY *cpk = ssl_get_server_send_pkey(s); 3980. > dh_secbits = EVP_PKEY_security_bits(cpk->privatekey); 3981. } 3982.
https://github.com/openssl/openssl/blob/c0f9e23c6b8d1076796987d5a84557d410682d85/ssl/t1_lib.c/#L3980
d2a_code_trace_data_43502
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ec_mult.c:165: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mul`. Showing all 13 steps of the trace crypto/ec/ec_mult.c:131:1: Parameter `ctx->stack.depth` 129. * Returns 1 on success, 0 otherwise. 130. */ 131. > static int ec_mul_consttime(const EC_GROUP *group, EC_POINT *r, 132. const BIGNUM *scalar, const EC_POINT *point, 133. BN_CTX *ctx) crypto/ec/ec_mult.c:146:5: Call 144. return 0; 145. 146. BN_CTX_start(ctx); ^ 147. 148. s = EC_POINT_new(group); 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/ec_mult.c:165:23: Call 163. lambda = BN_CTX_get(ctx); 164. k = BN_CTX_get(ctx); 165. if (k == NULL || !BN_mul(cardinality, group->order, group->cofactor, ctx)) ^ 166. goto err; 167. crypto/bn/bn_mul.c:497:1: Parameter `ctx->stack.depth` 495. #endif /* BN_RECURSION */ 496. 497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = 0; crypto/bn/bn_mul.c:523:5: Call 521. top = al + bl; 522. 523. BN_CTX_start(ctx); ^ 524. if ((r == a) || (r == b)) { 525. if ((rr = BN_CTX_get(ctx)) == NULL) crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mul.c:608:5: Call 606. err: 607. bn_check_top(r); 608. BN_CTX_end(ctx); ^ 609. return ret; 610. } crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.depth` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:274:1: <LHS trace> 272. } 273. 274. > static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:274:1: Parameter `st->depth` 272. } 273. 274. > static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:276:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mul` 274. static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; ^ 277. } 278.
https://github.com/openssl/openssl/blob/51f3021d974f32539a2727908018664963695b5d/crypto/bn/bn_ctx.c/#L276
d2a_code_trace_data_43503
static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { VP8Context *s = avctx->priv_data; int ret, mb_x, mb_y, i, y, referenced; enum AVDiscard skip_thresh; AVFrame *av_uninit(curframe), *prev_frame; release_queued_segmaps(s, 0); if ((ret = decode_frame_header(s, avpkt->data, avpkt->size)) < 0) return ret; prev_frame = s->framep[VP56_FRAME_CURRENT]; referenced = s->update_last || s->update_golden == VP56_FRAME_CURRENT || s->update_altref == VP56_FRAME_CURRENT; skip_thresh = !referenced ? AVDISCARD_NONREF : !s->keyframe ? AVDISCARD_NONKEY : AVDISCARD_ALL; if (avctx->skip_frame >= skip_thresh) { s->invisible = 1; goto skip_decode; } s->deblock_filter = s->filter.level && avctx->skip_loop_filter < skip_thresh; for (i = 0; i < 5; i++) if (s->frames[i].data[0] && &s->frames[i] != prev_frame && &s->frames[i] != s->framep[VP56_FRAME_PREVIOUS] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN2]) vp8_release_frame(s, &s->frames[i], 1, 0); for (i = 0; i < 5; i++) if (&s->frames[i] != prev_frame && &s->frames[i] != s->framep[VP56_FRAME_PREVIOUS] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN2]) { curframe = s->framep[VP56_FRAME_CURRENT] = &s->frames[i]; break; } if (i == 5) { av_log(avctx, AV_LOG_FATAL, "Ran out of free frames!\n"); abort(); } if (curframe->data[0]) vp8_release_frame(s, curframe, 1, 0); curframe->key_frame = s->keyframe; curframe->pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; curframe->reference = referenced ? 3 : 0; if ((ret = vp8_alloc_frame(s, curframe))) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed!\n"); return ret; } if (s->update_altref != VP56_FRAME_NONE) { s->next_framep[VP56_FRAME_GOLDEN2] = s->framep[s->update_altref]; } else { s->next_framep[VP56_FRAME_GOLDEN2] = s->framep[VP56_FRAME_GOLDEN2]; } if (s->update_golden != VP56_FRAME_NONE) { s->next_framep[VP56_FRAME_GOLDEN] = s->framep[s->update_golden]; } else { s->next_framep[VP56_FRAME_GOLDEN] = s->framep[VP56_FRAME_GOLDEN]; } if (s->update_last) { s->next_framep[VP56_FRAME_PREVIOUS] = curframe; } else { s->next_framep[VP56_FRAME_PREVIOUS] = s->framep[VP56_FRAME_PREVIOUS]; } s->next_framep[VP56_FRAME_CURRENT] = curframe; ff_thread_finish_setup(avctx); if (!s->keyframe && (!s->framep[VP56_FRAME_PREVIOUS] || !s->framep[VP56_FRAME_GOLDEN] || !s->framep[VP56_FRAME_GOLDEN2])) { av_log(avctx, AV_LOG_WARNING, "Discarding interframe without a prior keyframe!\n"); return AVERROR_INVALIDDATA; } s->linesize = curframe->linesize[0]; s->uvlinesize = curframe->linesize[1]; if (!s->edge_emu_buffer) s->edge_emu_buffer = av_malloc(21*s->linesize); memset(s->top_nnz, 0, s->mb_width*sizeof(*s->top_nnz)); memset(s->macroblocks + s->mb_height*2 - 1, 0, (s->mb_width+1)*sizeof(*s->macroblocks)); if (!(avctx->flags & CODEC_FLAG_EMU_EDGE)) { s->top_border[0][15] = s->top_border[0][23] = 127; memset(s->top_border[1]-1, 127, s->mb_width*sizeof(*s->top_border)+1); } memset(s->ref_count, 0, sizeof(s->ref_count)); if (s->keyframe) memset(s->intra4x4_pred_mode_top, DC_PRED, s->mb_width*4); #define MARGIN (16 << 2) s->mv_min.y = -MARGIN; s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN; for (mb_y = 0; mb_y < s->mb_height; mb_y++) { VP56RangeCoder *c = &s->coeff_partition[mb_y & (s->num_coeff_partitions-1)]; VP8Macroblock *mb = s->macroblocks + (s->mb_height - mb_y - 1)*2; int mb_xy = mb_y*s->mb_width; uint8_t *dst[3] = { curframe->data[0] + 16*mb_y*s->linesize, curframe->data[1] + 8*mb_y*s->uvlinesize, curframe->data[2] + 8*mb_y*s->uvlinesize }; memset(mb - 1, 0, sizeof(*mb)); memset(s->left_nnz, 0, sizeof(s->left_nnz)); AV_WN32A(s->intra4x4_pred_mode_left, DC_PRED*0x01010101); if (!(avctx->flags & CODEC_FLAG_EMU_EDGE)) { for (i = 0; i < 3; i++) for (y = 0; y < 16>>!!i; y++) dst[i][y*curframe->linesize[i]-1] = 129; if (mb_y == 1) s->top_border[0][15] = s->top_border[0][23] = s->top_border[0][31] = 129; } s->mv_min.x = -MARGIN; s->mv_max.x = ((s->mb_width - 1) << 6) + MARGIN; if (prev_frame && s->segmentation.enabled && !s->segmentation.update_map) ff_thread_await_progress(prev_frame, mb_y, 0); for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) { s->dsp.prefetch(dst[0] + (mb_x&3)*4*s->linesize + 64, s->linesize, 4); s->dsp.prefetch(dst[1] + (mb_x&7)*s->uvlinesize + 64, dst[2] - dst[1], 2); decode_mb_mode(s, mb, mb_x, mb_y, curframe->ref_index[0] + mb_xy, prev_frame && prev_frame->ref_index[0] ? prev_frame->ref_index[0] + mb_xy : NULL); prefetch_motion(s, mb, mb_x, mb_y, mb_xy, VP56_FRAME_PREVIOUS); if (!mb->skip) decode_mb_coeffs(s, c, mb, s->top_nnz[mb_x], s->left_nnz); if (mb->mode <= MODE_I4x4) intra_predict(s, dst, mb, mb_x, mb_y); else inter_predict(s, dst, mb, mb_x, mb_y); prefetch_motion(s, mb, mb_x, mb_y, mb_xy, VP56_FRAME_GOLDEN); if (!mb->skip) { idct_mb(s, dst, mb); } else { AV_ZERO64(s->left_nnz); AV_WN64(s->top_nnz[mb_x], 0); if (mb->mode != MODE_I4x4 && mb->mode != VP8_MVMODE_SPLIT) { s->left_nnz[8] = 0; s->top_nnz[mb_x][8] = 0; } } if (s->deblock_filter) filter_level_for_mb(s, mb, &s->filter_strength[mb_x]); prefetch_motion(s, mb, mb_x, mb_y, mb_xy, VP56_FRAME_GOLDEN2); dst[0] += 16; dst[1] += 8; dst[2] += 8; s->mv_min.x -= 64; s->mv_max.x -= 64; } if (s->deblock_filter) { if (s->filter.simple) filter_mb_row_simple(s, curframe, mb_y); else filter_mb_row(s, curframe, mb_y); } s->mv_min.y -= 64; s->mv_max.y -= 64; ff_thread_report_progress(curframe, mb_y, 0); } ff_thread_report_progress(curframe, INT_MAX, 0); skip_decode: if (!s->update_probabilities) s->prob[0] = s->prob[1]; memcpy(&s->framep[0], &s->next_framep[0], sizeof(s->framep[0]) * 4); if (!s->invisible) { *(AVFrame*)data = *curframe; *data_size = sizeof(AVFrame); } return avpkt->size; } libavcodec/vp8.c:1569: error: Uninitialized Value The value read from curframe was never initialized. libavcodec/vp8.c:1569:5: 1567. int ret, mb_x, mb_y, i, y, referenced; 1568. enum AVDiscard skip_thresh; 1569. AVFrame *av_uninit(curframe), *prev_frame; ^ 1570. 1571. release_queued_segmaps(s, 0);
https://github.com/libav/libav/blob/5a2e2516456e383575b44545d17c7f5859ca67b9/libavcodec/vp8.c/#L1569
d2a_code_trace_data_43504
static int opt_vstats(const char *opt, const char *arg) { char filename[40]; time_t today2 = time(NULL); struct tm *today = localtime(&today2); snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, today->tm_sec); return opt_vstats_file(opt, filename); } avconv.c:4711: error: Null Dereference pointer `today` last assigned on line 4709 could be null and is dereferenced at line 4711, column 69. avconv.c:4705:1: start of procedure opt_vstats() 4703. } 4704. 4705. static int opt_vstats(const char *opt, const char *arg) ^ 4706. { 4707. char filename[40]; avconv.c:4708:5: 4706. { 4707. char filename[40]; 4708. time_t today2 = time(NULL); ^ 4709. struct tm *today = localtime(&today2); 4710. avconv.c:4709:5: 4707. char filename[40]; 4708. time_t today2 = time(NULL); 4709. struct tm *today = localtime(&today2); ^ 4710. 4711. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, avconv.c:4711:5: 4709. struct tm *today = localtime(&today2); 4710. 4711. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, ^ 4712. today->tm_sec); 4713. return opt_vstats_file(opt, filename);
https://github.com/libav/libav/blob/19ad567311b29a42e308317b5329218c590afac8/avconv.c/#L4711
d2a_code_trace_data_43505
int BN_set_bit(BIGNUM *a, int n) { int i, j, k; if (n < 0) return 0; i = n / BN_BITS2; j = n % BN_BITS2; if (a->top <= i) { if (bn_wexpand(a, i + 1) == NULL) return (0); for (k = a->top; k < i + 1; k++) a->d[k] = 0; a->top = i + 1; } a->d[i] |= (((BN_ULONG)1) << j); bn_check_top(a); return (1); } test/bntest.c:1340: error: BUFFER_OVERRUN_L3 Offset: [0, 193] Size: [0, 8388607] by call to `BN_GF2m_arr2poly`. Showing all 9 steps of the trace test/bntest.c:1327:16: Assignment 1325. int i, j, ret = 0; 1326. int p0[] = { 163, 7, 6, 3, 0, -1 }; 1327. int p1[] = { 193, 15, 0, -1 }; ^ 1328. 1329. a = BN_new(); test/bntest.c:1340:5: Call 1338. 1339. BN_GF2m_arr2poly(p0, b[0]); 1340. BN_GF2m_arr2poly(p1, b[1]); ^ 1341. 1342. for (i = 0; i < num0; i++) { crypto/bn/bn_gf2m.c:1209:1: Parameter `*p` 1207. * bit-string. The array must be terminated by -1. 1208. */ 1209. > int BN_GF2m_arr2poly(const int p[], BIGNUM *a) 1210. { 1211. int i; crypto/bn/bn_gf2m.c:1216:13: Call 1214. BN_zero(a); 1215. for (i = 0; p[i] != -1; i++) { 1216. if (BN_set_bit(a, p[i]) == 0) ^ 1217. return 0; 1218. } crypto/bn/bn_lib.c:692:1: <Offset trace> 690. } 691. 692. > int BN_set_bit(BIGNUM *a, int n) 693. { 694. int i, j, k; crypto/bn/bn_lib.c:692:1: Parameter `a->top` 690. } 691. 692. > int BN_set_bit(BIGNUM *a, int n) 693. { 694. int i, j, k; crypto/bn/bn_lib.c:692:1: <Length trace> 690. } 691. 692. > int BN_set_bit(BIGNUM *a, int n) 693. { 694. int i, j, k; crypto/bn/bn_lib.c:692:1: Parameter `*a->d` 690. } 691. 692. > int BN_set_bit(BIGNUM *a, int n) 693. { 694. int i, j, k; crypto/bn/bn_lib.c:709:5: Array access: Offset: [0, 193] Size: [0, 8388607] by call to `BN_GF2m_arr2poly` 707. } 708. 709. a->d[i] |= (((BN_ULONG)1) << j); ^ 710. bn_check_top(a); 711. return (1);
https://github.com/openssl/openssl/blob/b3618f44a7b8504bfb0a64e8a33e6b8e56d4d516/crypto/bn/bn_lib.c/#L709
d2a_code_trace_data_43506
static void BN_POOL_release(BN_POOL *p, unsigned int num) { unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE; p->used -= num; while (num--) { bn_check_top(p->current->vals + offset); if (offset == 0) { offset = BN_CTX_POOL_SIZE - 1; p->current = p->current->prev; } else offset--; } } crypto/rsa/rsa_sp800_56b_check.c:60: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_mul`. Showing all 17 steps of the trace 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:218:5: Call 216. ret = 1; 217. err: 218. BN_CTX_end(ctx); ^ 219. return ret; 220. } crypto/bn/bn_ctx.c:185:1: Parameter `ctx->pool.used` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/rsa/rsa_sp800_56b_check.c:60:14: Call 58. && BN_is_one(r) 59. /* (e) 1 = (dQ . e) mod (q - 1) */ 60. && BN_mod_mul(r, rsa->dmq1, rsa->e, q1, ctx) ^ 61. && BN_is_one(r) 62. /* (f) 1 = (qInv . q) mod p */ crypto/bn/bn_mod.c:193:1: Parameter `ctx->pool.used` 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:204:14: Call 202. 203. BN_CTX_start(ctx); 204. if ((t = BN_CTX_get(ctx)) == NULL) ^ 205. goto err; 206. if (a == b) { crypto/bn/bn_ctx.c:202:1: Parameter `ctx->pool.used` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_mod.c:210:14: Call 208. goto err; 209. } else { 210. if (!BN_mul(t, a, b, ctx)) ^ 211. goto err; 212. } crypto/bn/bn_mul.c:497:1: Parameter `ctx->pool.used` 495. #endif /* BN_RECURSION */ 496. 497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); crypto/bn/bn_mul.c:499:15: Call 497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); ^ 500. 501. bn_correct_top(r); crypto/bn/bn_mul.c:507:1: Parameter `ctx->pool.used` 505. } 506. 507. > int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 508. { 509. int ret = 0; crypto/bn/bn_mul.c: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->pool.used` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:194:13: Call 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) 194. BN_POOL_release(&ctx->pool, ctx->used - fp); ^ 195. ctx->used = fp; 196. /* Unjam "too_many" in case "get" had failed */ crypto/bn/bn_ctx.c:338:1: <LHS trace> 336. } 337. 338. > static void BN_POOL_release(BN_POOL *p, unsigned int num) 339. { 340. unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE; crypto/bn/bn_ctx.c:338:1: Parameter `p->used` 336. } 337. 338. > static void BN_POOL_release(BN_POOL *p, unsigned int num) 339. { 340. unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE; crypto/bn/bn_ctx.c:340:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_mul` 338. static void BN_POOL_release(BN_POOL *p, unsigned int num) 339. { 340. unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE; ^ 341. 342. p->used -= num;
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_ctx.c/#L340
d2a_code_trace_data_43507
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dsa/dsa_ossl.c:368: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_mul`. Showing all 26 steps of the trace crypto/dsa/dsa_ossl.c:354:7: Call 352. /* Calculate W = inv(S) mod Q 353. * save W in u2 */ 354. if ((BN_mod_inverse(&u2,sig->s,dsa->q,ctx)) == NULL) goto err; ^ 355. 356. /* save M in u1 */ crypto/bn/bn_gcd.c:209:1: Parameter `ctx->stack.depth` 207. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); 208. 209. > BIGNUM *BN_mod_inverse(BIGNUM *in, 210. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 211. { crypto/bn/bn_gcd.c:224:2: Call 222. bn_check_top(n); 223. 224. BN_CTX_start(ctx); ^ 225. A = BN_CTX_get(ctx); 226. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gcd.c:498:2: Call 496. err: 497. if ((ret == NULL) && (in == NULL)) BN_free(R); 498. BN_CTX_end(ctx); ^ 499. bn_check_top(ret); 500. return(ret); crypto/bn/bn_ctx.c:270:1: Parameter `ctx->stack.depth` 268. } 269. 270. > void BN_CTX_end(BN_CTX *ctx) 271. { 272. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/dsa/dsa_ossl.c:365:7: Call 363. 364. /* u1 = M * w mod q */ 365. if (!BN_mod_mul(&u1,&u1,&u2,dsa->q,ctx)) goto err; ^ 366. 367. /* u2 = r * w mod q */ crypto/bn/bn_mod.c:178:1: Parameter `ctx->stack.depth` 176. 177. /* slow but works */ 178. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 179. BN_CTX *ctx) 180. { crypto/bn/bn_mod.c:188:2: Call 186. bn_check_top(m); 187. 188. BN_CTX_start(ctx); ^ 189. if ((t = BN_CTX_get(ctx)) == NULL) goto err; 190. if (a == b) 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_mod.c:198:2: Call 196. ret=1; 197. err: 198. BN_CTX_end(ctx); ^ 199. return(ret); 200. } 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/dsa/dsa_ossl.c:368:7: Call 366. 367. /* u2 = r * w mod q */ 368. if (!BN_mod_mul(&u2,sig->r,&u2,dsa->q,ctx)) goto err; ^ 369. 370. crypto/bn/bn_mod.c:178:1: Parameter `ctx->stack.depth` 176. 177. /* slow but works */ 178. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 179. BN_CTX *ctx) 180. { crypto/bn/bn_mod.c:188:2: Call 186. bn_check_top(m); 187. 188. BN_CTX_start(ctx); ^ 189. if ((t = BN_CTX_get(ctx)) == NULL) goto err; 190. if (a == b) 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_mod.c:191:10: Call 189. if ((t = BN_CTX_get(ctx)) == NULL) goto err; 190. if (a == b) 191. { if (!BN_sqr(t,a,ctx)) goto err; } ^ 192. else 193. { if (!BN_mul(t,a,b,ctx)) goto err; } crypto/bn/bn_sqr.c:65:1: Parameter `ctx->stack.depth` 63. /* r must not be a */ 64. /* I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 */ 65. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 66. { 67. int max,al; crypto/bn/bn_sqr.c:83:2: Call 81. } 82. 83. BN_CTX_start(ctx); ^ 84. rr=(a != r) ? r : BN_CTX_get(ctx); 85. tmp=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_sqr.c:153:2: Call 151. bn_check_top(rr); 152. bn_check_top(tmp); 153. BN_CTX_end(ctx); ^ 154. return(ret); 155. } 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_mod_mul` 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_43508
char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) { const X509_NAME_ENTRY *ne; int i; int n, lold, l, l1, l2, num, j, type; const char *s; char *p; unsigned char *q; BUF_MEM *b = NULL; static const char hex[17] = "0123456789ABCDEF"; int gs_doit[4]; char tmp_buf[80]; #ifdef CHARSET_EBCDIC unsigned char ebcdic_buf[1024]; #endif if (buf == NULL) { if ((b = BUF_MEM_new()) == NULL) goto err; if (!BUF_MEM_grow(b, 200)) goto err; b->data[0] = '\0'; len = 200; } else if (len == 0) { return NULL; } if (a == NULL) { if (b) { buf = b->data; OPENSSL_free(b); } strncpy(buf, "NO X509_NAME", len); buf[len - 1] = '\0'; return buf; } len--; l = 0; for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { ne = sk_X509_NAME_ENTRY_value(a->entries, i); n = OBJ_obj2nid(ne->object); if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) { i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object); s = tmp_buf; } l1 = strlen(s); type = ne->value->type; num = ne->value->length; if (num > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } q = ne->value->data; #ifdef CHARSET_EBCDIC if (type == V_ASN1_GENERALSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_PRINTABLESTRING || type == V_ASN1_TELETEXSTRING || type == V_ASN1_IA5STRING) { if (num > (int)sizeof(ebcdic_buf)) num = sizeof(ebcdic_buf); ascii2ebcdic(ebcdic_buf, q, num); q = ebcdic_buf; } #endif if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) { gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0; for (j = 0; j < num; j++) if (q[j] != 0) gs_doit[j & 3] = 1; if (gs_doit[0] | gs_doit[1] | gs_doit[2]) gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; else { gs_doit[0] = gs_doit[1] = gs_doit[2] = 0; gs_doit[3] = 1; } } else gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; for (l2 = j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; l2++; #ifndef CHARSET_EBCDIC if ((q[j] < ' ') || (q[j] > '~')) l2 += 3; #else if ((os_toascii[q[j]] < os_toascii[' ']) || (os_toascii[q[j]] > os_toascii['~'])) l2 += 3; #endif } lold = l; l += 1 + l1 + 1 + l2; if (l > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } if (b != NULL) { if (!BUF_MEM_grow(b, l + 1)) goto err; p = &(b->data[lold]); } else if (l > len) { break; } else p = &(buf[lold]); *(p++) = '/'; memcpy(p, s, (unsigned int)l1); p += l1; *(p++) = '='; #ifndef CHARSET_EBCDIC q = ne->value->data; #endif for (j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; #ifndef CHARSET_EBCDIC n = q[j]; if ((n < ' ') || (n > '~')) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = n; #else n = os_toascii[q[j]]; if ((n < os_toascii[' ']) || (n > os_toascii['~'])) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = q[j]; #endif } *p = '\0'; } if (b != NULL) { p = b->data; OPENSSL_free(b); } else p = buf; if (i == 0) *p = '\0'; return (p); err: X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE); end: BUF_MEM_free(b); return (NULL); } crypto/x509/x509_cmp.c:42: error: BUFFER_OVERRUN_L3 Offset added: [0, 200] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace crypto/x509/x509_cmp.c:42:9: Call 40. if (ctx == NULL) 41. goto err; 42. f = X509_NAME_oneline(a->cert_info.issuer, NULL, 0); ^ 43. if (!EVP_DigestInit_ex(ctx, EVP_md5(), NULL)) 44. goto err; crypto/x509/x509_obj.c:25:1: <Offset trace> 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: Parameter `len` 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: <Length trace> 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:25:1: Parameter `*buf` 23. #define NAME_ONELINE_MAX (1024 * 1024) 24. 25. > char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) 26. { 27. const X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:56:9: Array access: Offset added: [0, 200] Size: [1, 2147483644] by call to `X509_NAME_oneline` 54. OPENSSL_free(b); 55. } 56. strncpy(buf, "NO X509_NAME", len); ^ 57. buf[len - 1] = '\0'; 58. return buf;
https://github.com/openssl/openssl/blob/cdb2a60347f988037d29adc7e4415e9c66c8a5a5/crypto/x509/x509_obj.c/#L56
d2a_code_trace_data_43509
static AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder) { const char *codec_string = encoder ? "encoder" : "decoder"; AVCodec *codec; codec = encoder ? avcodec_find_encoder_by_name(name) : avcodec_find_decoder_by_name(name); if(!codec) { av_log(NULL, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name); exit_program(1); } if(codec->type != type) { av_log(NULL, AV_LOG_FATAL, "Invalid %s type '%s'\n", codec_string, name); exit_program(1); } return codec; } avconv.c:2740: error: Null Dereference pointer `codec` last assigned on line 2733 could be null and is dereferenced at line 2740, column 8. avconv.c:2728:1: start of procedure find_codec_or_die() 2726. } 2727. 2728. static AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder) ^ 2729. { 2730. const char *codec_string = encoder ? "encoder" : "decoder"; avconv.c:2730:32: Condition is true 2728. static AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder) 2729. { 2730. const char *codec_string = encoder ? "encoder" : "decoder"; ^ 2731. AVCodec *codec; 2732. avconv.c:2730:5: 2728. static AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder) 2729. { 2730. const char *codec_string = encoder ? "encoder" : "decoder"; ^ 2731. AVCodec *codec; 2732. avconv.c:2733:13: Condition is true 2731. AVCodec *codec; 2732. 2733. codec = encoder ? ^ 2734. avcodec_find_encoder_by_name(name) : 2735. avcodec_find_decoder_by_name(name); avconv.c:2733:5: 2731. AVCodec *codec; 2732. 2733. codec = encoder ? ^ 2734. avcodec_find_encoder_by_name(name) : 2735. avcodec_find_decoder_by_name(name); avconv.c:2736:9: Taking true branch 2734. avcodec_find_encoder_by_name(name) : 2735. avcodec_find_decoder_by_name(name); 2736. if(!codec) { ^ 2737. av_log(NULL, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name); 2738. exit_program(1); avconv.c:2737:9: Skipping av_log(): empty list of specs 2735. avcodec_find_decoder_by_name(name); 2736. if(!codec) { 2737. av_log(NULL, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name); ^ 2738. exit_program(1); 2739. } avconv.c:2738:9: Skipping exit_program(): empty list of specs 2736. if(!codec) { 2737. av_log(NULL, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name); 2738. exit_program(1); ^ 2739. } 2740. if(codec->type != type) { avconv.c:2740:8: 2738. exit_program(1); 2739. } 2740. if(codec->type != type) { ^ 2741. av_log(NULL, AV_LOG_FATAL, "Invalid %s type '%s'\n", codec_string, name); 2742. exit_program(1);
https://github.com/libav/libav/blob/8664682d0e6b6071ca7b3f6b9e350305d3fbcf76/avconv.c/#L2740
d2a_code_trace_data_43510
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:663: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_div`. Showing all 25 steps of the trace test/bntest.c:663:13: Call 661. BN_bntest_rand(c, 512, 0, 0); 662. for (j = 0; j < 2; j++) { 663. BN_GF2m_mod_div(d, a, c, b[j], ctx); ^ 664. BN_GF2m_mod_mul(e, d, c, b[j], ctx); 665. BN_GF2m_mod_div(f, a, e, b[j], ctx); crypto/bn/bn_gf2m.c:760:1: Parameter `ctx->stack.depth` 758. * or y, x could equal y. 759. */ 760. > int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *y, const BIGNUM *x, 761. const BIGNUM *p, BN_CTX *ctx) 762. { crypto/bn/bn_gf2m.c:770:5: Call 768. bn_check_top(p); 769. 770. BN_CTX_start(ctx); ^ 771. xinv = BN_CTX_get(ctx); 772. if (xinv == NULL) crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gf2m.c:783:5: Call 781. 782. err: 783. BN_CTX_end(ctx); ^ 784. return ret; 785. } crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.depth` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); test/bntest.c:664:13: Call 662. for (j = 0; j < 2; j++) { 663. BN_GF2m_mod_div(d, a, c, b[j], ctx); 664. BN_GF2m_mod_mul(e, d, c, b[j], ctx); ^ 665. BN_GF2m_mod_div(f, a, e, b[j], ctx); 666. /* Test that ((a/c)*c)/a = 1. */ crypto/bn/bn_gf2m.c:473:1: Parameter `ctx->stack.depth` 471. * BN_GF2m_mod_mul_arr function. 472. */ 473. > int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 474. const BIGNUM *p, BN_CTX *ctx) 475. { test/bntest.c:665:13: Call 663. BN_GF2m_mod_div(d, a, c, b[j], ctx); 664. BN_GF2m_mod_mul(e, d, c, b[j], ctx); 665. BN_GF2m_mod_div(f, a, e, b[j], ctx); ^ 666. /* Test that ((a/c)*c)/a = 1. */ 667. if (!TEST_BN_eq_one(f)) crypto/bn/bn_gf2m.c:760:1: Parameter `ctx->stack.depth` 758. * or y, x could equal y. 759. */ 760. > int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *y, const BIGNUM *x, 761. const BIGNUM *p, BN_CTX *ctx) 762. { crypto/bn/bn_gf2m.c:770:5: Call 768. bn_check_top(p); 769. 770. BN_CTX_start(ctx); ^ 771. xinv = BN_CTX_get(ctx); 772. if (xinv == NULL) crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gf2m.c:783:5: Call 781. 782. err: 783. BN_CTX_end(ctx); ^ 784. return ret; 785. } crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.depth` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); test/bntest.c:663:13: Call 661. BN_bntest_rand(c, 512, 0, 0); 662. for (j = 0; j < 2; j++) { 663. BN_GF2m_mod_div(d, a, c, b[j], ctx); ^ 664. BN_GF2m_mod_mul(e, d, c, b[j], ctx); 665. 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/3f97052392cb10fca5309212bf720685262ad4a6/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_43511
void RAND_seed(const void *buf, int num) { const RAND_METHOD *meth = RAND_get_rand_method(); if (meth->seed != NULL) meth->seed(buf, num); } crypto/rand/rand_lib.c:130: error: NULL_DEREFERENCE pointer `meth` last assigned on line 128 could be null and is dereferenced at line 130, column 9. Showing all 14 steps of the trace crypto/rand/rand_lib.c:126:1: start of procedure RAND_seed() 124. #endif 125. 126. > void RAND_seed(const void *buf, int num) 127. { 128. const RAND_METHOD *meth = RAND_get_rand_method(); crypto/rand/rand_lib.c:128:5: 126. void RAND_seed(const void *buf, int num) 127. { 128. > const RAND_METHOD *meth = RAND_get_rand_method(); 129. 130. if (meth->seed != 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:130:9: 128. const RAND_METHOD *meth = RAND_get_rand_method(); 129. 130. > if (meth->seed != NULL) 131. meth->seed(buf, num); 132. }
https://github.com/openssl/openssl/blob/12fb8c3d2dd00f3d4f1b084385403d26ed64a596/crypto/rand/rand_lib.c/#L130
d2a_code_trace_data_43512
static inline void skip_remaining(BitstreamContext *bc, unsigned n) { #ifdef BITSTREAM_READER_LE bc->bits >>= n; #else bc->bits <<= n; #endif bc->bits_left -= n; } libavcodec/alsdec.c:1131: error: Integer Overflow L2 ([-3, +oo] - 5):unsigned32 by call to `read_decode_block`. libavcodec/alsdec.c:1082:1: Parameter `ctx->bc.bits_left` 1080. /** Decode blocks dependently. 1081. */ 1082. static int decode_blocks(ALSDecContext *ctx, unsigned int ra_frame, ^ 1083. unsigned int c, const unsigned int *div_blocks, 1084. unsigned int *js_blocks) libavcodec/alsdec.c:1131:20: Call 1129. bd[1].raw_other = bd[0].raw_samples; 1130. 1131. if ((ret = read_decode_block(ctx, &bd[0])) < 0 || ^ 1132. (ret = read_decode_block(ctx, &bd[1])) < 0) 1133. goto fail; libavcodec/alsdec.c:1013:1: Parameter `ctx->bc.bits_left` 1011. /** Read and decode block data successively. 1012. */ 1013. static int read_decode_block(ALSDecContext *ctx, ALSBlockData *bd) ^ 1014. { 1015. int ret; libavcodec/alsdec.c:1017:16: Call 1015. int ret; 1016. 1017. if ((ret = read_block(ctx, bd)) < 0) ^ 1018. return ret; 1019. libavcodec/alsdec.c:968:1: Parameter `ctx->bc.bits_left` 966. /** Read the block data. 967. */ 968. static int read_block(ALSDecContext *ctx, ALSBlockData *bd) ^ 969. { 970. int ret = 0; libavcodec/alsdec.c:975:9: Call 973. *bd->shift_lsbs = 0; 974. // read block type flag and read the samples accordingly 975. if (bitstream_read_bit(bc)) { ^ 976. ret = read_var_block_data(ctx, bd); 977. } else { libavcodec/bitstream.h:145:1: Parameter `bc->bits_left` 143. 144. /* Return one bit from the buffer. */ 145. static inline unsigned bitstream_read_bit(BitstreamContext *bc) ^ 146. { 147. if (!bc->bits_left) libavcodec/bitstream.h:150:12: Call 148. refill_64(bc); 149. 150. return get_val(bc, 1); ^ 151. } 152. libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Assignment 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret; libavcodec/alsdec.c:978:9: Call 976. ret = read_var_block_data(ctx, bd); 977. } else { 978. read_const_block_data(ctx, bd); ^ 979. } 980. libavcodec/alsdec.c:557:1: Parameter `ctx->bc.bits_left` 555. /** Read the block data for a constant block 556. */ 557. static void read_const_block_data(ALSDecContext *ctx, ALSBlockData *bd) ^ 558. { 559. ALSSpecificConfig *sconf = &ctx->sconf; libavcodec/alsdec.c:564:24: Call 562. 563. *bd->raw_samples = 0; 564. *bd->const_block = bitstream_read_bit(bc); // 1 = constant value, 0 = zero block (silence) ^ 565. bd->js_blocks = bitstream_read_bit(bc); 566. libavcodec/bitstream.h:145:1: Parameter `bc->bits_left` 143. 144. /* Return one bit from the buffer. */ 145. static inline unsigned bitstream_read_bit(BitstreamContext *bc) ^ 146. { 147. if (!bc->bits_left) libavcodec/bitstream.h:150:12: Call 148. refill_64(bc); 149. 150. return get_val(bc, 1); ^ 151. } 152. libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Assignment 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret; libavcodec/alsdec.c:565:24: Call 563. *bd->raw_samples = 0; 564. *bd->const_block = bitstream_read_bit(bc); // 1 = constant value, 0 = zero block (silence) 565. bd->js_blocks = bitstream_read_bit(bc); ^ 566. 567. // skip 5 reserved bits libavcodec/bitstream.h:145:1: Parameter `bc->bits_left` 143. 144. /* Return one bit from the buffer. */ 145. static inline unsigned bitstream_read_bit(BitstreamContext *bc) ^ 146. { 147. if (!bc->bits_left) libavcodec/bitstream.h:150:12: Call 148. refill_64(bc); 149. 150. return get_val(bc, 1); ^ 151. } 152. libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Assignment 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret; libavcodec/alsdec.c:568:5: Call 566. 567. // skip 5 reserved bits 568. bitstream_skip(bc, 5); ^ 569. 570. if (*bd->const_block) { libavcodec/bitstream.h:241:1: Parameter `n` 239. 240. /* Skip n bits in the buffer. */ 241. static inline void bitstream_skip(BitstreamContext *bc, unsigned n) ^ 242. { 243. if (n <= bc->bits_left) libavcodec/bitstream.h:244:9: Call 242. { 243. if (n <= bc->bits_left) 244. skip_remaining(bc, n); ^ 245. else { 246. n -= bc->bits_left; libavcodec/bitstream.h:230:1: <LHS trace> 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:230:1: Parameter `bc->bits_left` 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:230:1: <RHS trace> 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:230:1: Parameter `n` 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:237:5: Binary operation: ([-3, +oo] - 5):unsigned32 by call to `read_decode_block` 235. bc->bits <<= n; 236. #endif 237. bc->bits_left -= n; ^ 238. } 239.
https://github.com/libav/libav/blob/7ff018c1cb43a5fe5ee2049d325cdd785852067a/libavcodec/bitstream.h/#L237
d2a_code_trace_data_43513
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; bn_check_top(b); if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } test/rsa_mp_test.c:136: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_bin2bn`. Showing all 14 steps of the trace test/rsa_mp_test.c:136:10: Call 134. int rv = 256; /* public key length */ 135. 136. if (!TEST_int_eq(RSA_set0_key(key, ^ 137. BN_bin2bn(n, sizeof(n) - 1, NULL), 138. BN_bin2bn(e, sizeof(e) - 1, NULL), crypto/bn/bn_lib.c:399:1: Parameter `*ret->d` 397. } 398. 399. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) 400. { 401. unsigned int i, m; test/rsa_mp_test.c:136:10: Call 134. int rv = 256; /* public key length */ 135. 136. if (!TEST_int_eq(RSA_set0_key(key, ^ 137. BN_bin2bn(n, sizeof(n) - 1, NULL), 138. BN_bin2bn(e, sizeof(e) - 1, NULL), crypto/bn/bn_lib.c:399:1: Parameter `*ret->d` 397. } 398. 399. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) 400. { 401. unsigned int i, m; crypto/bn/bn_lib.c:421:9: Call 419. i = ((n - 1) / BN_BYTES) + 1; 420. m = ((n - 1) % (BN_BYTES)); 421. if (bn_wexpand(ret, (int)i) == NULL) { ^ 422. BN_free(bn); 423. return NULL; crypto/bn/bn_lib.c:940:1: Parameter `*a->d` 938. } 939. 940. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 941. { 942. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:942:37: Call 940. BIGNUM *bn_wexpand(BIGNUM *a, int words) 941. { 942. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 943. } 944. crypto/bn/bn_lib.c:273:1: Parameter `*b->d` 271. */ 272. 273. > BIGNUM *bn_expand2(BIGNUM *b, int words) 274. { 275. bn_check_top(b); crypto/bn/bn_lib.c:278:23: Call 276. 277. if (words > b->dmax) { 278. BN_ULONG *a = bn_expand_internal(b, words); ^ 279. if (!a) 280. return NULL; crypto/bn/bn_lib.c:235:1: <Offset trace> 233. /* This is used by bn_expand2() */ 234. /* The caller MUST check that words > b->dmax before calling this */ 235. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 236. { 237. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:235:1: Parameter `b->top` 233. /* This is used by bn_expand2() */ 234. /* The caller MUST check that words > b->dmax before calling this */ 235. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 236. { 237. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:235:1: <Length trace> 233. /* This is used by bn_expand2() */ 234. /* The caller MUST check that words > b->dmax before calling this */ 235. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 236. { 237. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:235:1: Parameter `*b->d` 233. /* This is used by bn_expand2() */ 234. /* The caller MUST check that words > b->dmax before calling this */ 235. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 236. { 237. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:260:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_bin2bn` 258. assert(b->top <= words); 259. if (b->top > 0) 260. memcpy(a, b->d, sizeof(*a) * b->top); ^ 261. 262. return a;
https://github.com/openssl/openssl/blob/92b1b9a8871530f26ef7df972111297ffa721be2/crypto/bn/bn_lib.c/#L260
d2a_code_trace_data_43514
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/ec/ecdsa_ossl.c:244: error: BUFFER_OVERRUN_L3 Offset: [31, +oo] Size: [0, 8388607] by call to `bn_mul_mont_fixed_top`. Showing all 15 steps of the trace crypto/ec/ecdsa_ossl.c:212:10: Call 210. if (8 * dgst_len > i) 211. dgst_len = (i + 7) / 8; 212. if (!BN_bin2bn(dgst, dgst_len, m)) { ^ 213. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB); 214. goto err; crypto/bn/bn_lib.c:372:1: Parameter `ret->top` 370. } 371. 372. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) 373. { 374. unsigned int i, m; crypto/ec/ecdsa_ossl.c:244:17: Call 242. */ 243. if (!bn_to_mont_fixed_top(s, ret->r, group->mont_data, ctx) 244. || !bn_mul_mont_fixed_top(s, s, priv_key, group->mont_data, ctx)) { ^ 245. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB); 246. goto err; crypto/bn/bn_mont.c:37:1: Parameter `b->top` 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:67:14: Call 65. bn_check_top(tmp); 66. if (a == b) { 67. if (!BN_sqr(tmp, a, ctx)) ^ 68. goto err; 69. } 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:99:1: <Offset trace> 97. 98. /* tmp must have 2*n words */ 99. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 100. { 101. int i, j, max; crypto/bn/bn_sqr.c:99:1: Parameter `n` 97. 98. /* tmp must have 2*n words */ 99. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 100. { 101. int i, j, max; crypto/bn/bn_sqr.c:105:5: Assignment 103. BN_ULONG *rp; 104. 105. max = n * 2; ^ 106. ap = a; 107. rp = r; crypto/bn/bn_sqr.c:99:1: <Length trace> 97. 98. /* tmp must have 2*n words */ 99. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 100. { 101. int i, j, max; crypto/bn/bn_sqr.c:99:1: Parameter `*r` 97. 98. /* tmp must have 2*n words */ 99. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 100. { 101. int i, j, max; crypto/bn/bn_sqr.c:107:5: Assignment 105. max = n * 2; 106. ap = a; 107. rp = r; ^ 108. rp[0] = rp[max - 1] = 0; 109. rp++; crypto/bn/bn_sqr.c:108:13: Array access: Offset: [31, +oo] Size: [0, 8388607] by call to `bn_mul_mont_fixed_top` 106. ap = a; 107. rp = r; 108. rp[0] = rp[max - 1] = 0; ^ 109. rp++; 110. j = n;
https://github.com/openssl/openssl/blob/4cc968df403ed9321d0df722aba33323ae575ce0/crypto/bn/bn_sqr.c/#L108
d2a_code_trace_data_43515
void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur, Picture *last, int y, int h, int picture_structure, int first_field, int draw_edges, int low_delay, int v_edge_pos, int h_edge_pos) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); int hshift = desc->log2_chroma_w; int vshift = desc->log2_chroma_h; const int field_pic = picture_structure != PICT_FRAME; if(field_pic){ h <<= 1; y <<= 1; } if (!avctx->hwaccel && draw_edges && cur->reference && !(avctx->flags & CODEC_FLAG_EMU_EDGE)) { int *linesize = cur->f.linesize; int sides = 0, edge_h; if (y==0) sides |= EDGE_TOP; if (y + h >= v_edge_pos) sides |= EDGE_BOTTOM; edge_h= FFMIN(h, v_edge_pos - y); dsp->draw_edges(cur->f.data[0] + y * linesize[0], linesize[0], h_edge_pos, edge_h, EDGE_WIDTH, EDGE_WIDTH, sides); dsp->draw_edges(cur->f.data[1] + (y >> vshift) * linesize[1], linesize[1], h_edge_pos >> hshift, edge_h >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, sides); dsp->draw_edges(cur->f.data[2] + (y >> vshift) * linesize[2], linesize[2], h_edge_pos >> hshift, edge_h >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, sides); } h = FFMIN(h, avctx->height - y); if(field_pic && first_field && !(avctx->slice_flags&SLICE_FLAG_ALLOW_FIELD)) return; if (avctx->draw_horiz_band) { AVFrame *src; int offset[AV_NUM_DATA_POINTERS]; int i; if(cur->f.pict_type == AV_PICTURE_TYPE_B || low_delay || (avctx->slice_flags & SLICE_FLAG_CODED_ORDER)) src = &cur->f; else if (last) src = &last->f; else return; if (cur->f.pict_type == AV_PICTURE_TYPE_B && picture_structure == PICT_FRAME && avctx->codec_id != AV_CODEC_ID_SVQ3) { for (i = 0; i < AV_NUM_DATA_POINTERS; i++) offset[i] = 0; }else{ offset[0]= y * src->linesize[0]; offset[1]= offset[2]= (y >> vshift) * src->linesize[1]; for (i = 3; i < AV_NUM_DATA_POINTERS; i++) offset[i] = 0; } emms_c(); avctx->draw_horiz_band(avctx, src, offset, y, picture_structure, h); } } libavcodec/mpegvideo.c:2205: error: Null Dereference pointer `desc` last assigned on line 2204 could be null and is dereferenced at line 2205, column 18. libavcodec/mpegvideo.c:2199:1: start of procedure ff_draw_horiz_band() 2197. * @param h is the normal height, this will be reduced automatically if needed for the last row 2198. */ 2199. void ff_draw_horiz_band(AVCodecContext *avctx, DSPContext *dsp, Picture *cur, ^ 2200. Picture *last, int y, int h, int picture_structure, 2201. int first_field, int draw_edges, int low_delay, libavcodec/mpegvideo.c:2204:5: 2202. int v_edge_pos, int h_edge_pos) 2203. { 2204. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); ^ 2205. int hshift = desc->log2_chroma_w; 2206. int vshift = desc->log2_chroma_h; libavutil/pixdesc.c:1468:1: start of procedure av_pix_fmt_desc_get() 1466. } 1467. 1468. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) ^ 1469. { 1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) libavutil/pixdesc.c:1470:9: Taking false branch 1468. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1469. { 1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1471. return NULL; 1472. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1470:24: Taking true branch 1468. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1469. { 1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1471. return NULL; 1472. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1471:9: 1469. { 1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) 1471. return NULL; ^ 1472. return &av_pix_fmt_descriptors[pix_fmt]; 1473. } libavutil/pixdesc.c:1473:1: return from a call to av_pix_fmt_desc_get 1471. return NULL; 1472. return &av_pix_fmt_descriptors[pix_fmt]; 1473. } ^ 1474. 1475. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) libavcodec/mpegvideo.c:2205:5: 2203. { 2204. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); 2205. int hshift = desc->log2_chroma_w; ^ 2206. int vshift = desc->log2_chroma_h; 2207. const int field_pic = picture_structure != PICT_FRAME;
https://github.com/libav/libav/blob/2852740e23f91d6775714d7cc29b9a73e1111ce0/libavcodec/mpegvideo.c/#L2205
d2a_code_trace_data_43516
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_x931g.c:76: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end`. Showing all 10 steps of the trace crypto/rsa/rsa_x931g.c:34:5: Call 32. if (ctx == NULL) 33. goto err; 34. BN_CTX_start(ctx); ^ 35. 36. r0 = 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/rsa/rsa_x931g.c:76:9: Call 74. 75. if (rsa->p == NULL || rsa->q == NULL) { 76. BN_CTX_end(ctx); ^ 77. BN_CTX_free(ctx); 78. return 2; crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_43517
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:4063: error: Integer Overflow L2 ([0, 2147483647] + 1):signed32. avconv.c:4062:11: <LHS trace> 4060. } 4061. *p++ = '\0'; 4062. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX); ^ 4063. o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1); 4064. o->streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); avconv.c:4062:11: Call 4060. } 4061. *p++ = '\0'; 4062. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX); ^ 4063. o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1); 4064. o->streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); cmdutils.c:83:1: Parameter `min` 81. } 82. 83. double parse_number_or_die(const char *context, const char *numstr, int type, ^ 84. double min, double max) 85. { cmdutils.c:98:9: Assignment 96. error = "Expected int for %s but found %s\n"; 97. else 98. return d; ^ 99. av_log(NULL, AV_LOG_FATAL, error, context, numstr, min, max); 100. exit_program(1); avconv.c:4062:5: Assignment 4060. } 4061. *p++ = '\0'; 4062. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX); ^ 4063. o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1); 4064. o->streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); avconv.c:4063:23: Binary operation: ([0, 2147483647] + 1):signed32 4061. *p++ = '\0'; 4062. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX); 4063. o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1); ^ 4064. o->streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); 4065. return 0;
https://github.com/libav/libav/blob/1be8c90847300ac7889833612c99d57c58ff64b1/avconv.c/#L4063
d2a_code_trace_data_43518
static int decode_header_trees(SmackVContext *smk) { GetBitContext gb; int mmap_size, mclr_size, full_size, type_size; mmap_size = AV_RL32(smk->avctx->extradata); mclr_size = AV_RL32(smk->avctx->extradata + 4); full_size = AV_RL32(smk->avctx->extradata + 8); type_size = AV_RL32(smk->avctx->extradata + 12); init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8); if(!get_bits1(&gb)) { av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n"); smk->mmap_tbl = av_malloc(sizeof(int) * 2); smk->mmap_tbl[0] = 0; smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1; } else { if (smacker_decode_header_tree(smk, &gb, &smk->mmap_tbl, smk->mmap_last, mmap_size)) return -1; } if(!get_bits1(&gb)) { av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n"); smk->mclr_tbl = av_malloc(sizeof(int) * 2); smk->mclr_tbl[0] = 0; smk->mclr_last[0] = smk->mclr_last[1] = smk->mclr_last[2] = 1; } else { if (smacker_decode_header_tree(smk, &gb, &smk->mclr_tbl, smk->mclr_last, mclr_size)) return -1; } if(!get_bits1(&gb)) { av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n"); smk->full_tbl = av_malloc(sizeof(int) * 2); smk->full_tbl[0] = 0; smk->full_last[0] = smk->full_last[1] = smk->full_last[2] = 1; } else { if (smacker_decode_header_tree(smk, &gb, &smk->full_tbl, smk->full_last, full_size)) return -1; } if(!get_bits1(&gb)) { av_log(smk->avctx, AV_LOG_INFO, "Skipping TYPE tree\n"); smk->type_tbl = av_malloc(sizeof(int) * 2); smk->type_tbl[0] = 0; smk->type_last[0] = smk->type_last[1] = smk->type_last[2] = 1; } else { if (smacker_decode_header_tree(smk, &gb, &smk->type_tbl, smk->type_last, type_size)) return -1; } return 0; } libavcodec/smacker.c:308: error: Null Dereference pointer `smk->full_tbl` last assigned on line 307 could be null and is dereferenced at line 308, column 9. libavcodec/smacker.c:276:1: start of procedure decode_header_trees() 274. } 275. 276. static int decode_header_trees(SmackVContext *smk) { ^ 277. GetBitContext gb; 278. int mmap_size, mclr_size, full_size, type_size; libavcodec/smacker.c:280:5: 278. int mmap_size, mclr_size, full_size, type_size; 279. 280. mmap_size = AV_RL32(smk->avctx->extradata); ^ 281. mclr_size = AV_RL32(smk->avctx->extradata + 4); 282. full_size = AV_RL32(smk->avctx->extradata + 8); libavcodec/smacker.c:281:5: 279. 280. mmap_size = AV_RL32(smk->avctx->extradata); 281. mclr_size = AV_RL32(smk->avctx->extradata + 4); ^ 282. full_size = AV_RL32(smk->avctx->extradata + 8); 283. type_size = AV_RL32(smk->avctx->extradata + 12); libavcodec/smacker.c:282:5: 280. mmap_size = AV_RL32(smk->avctx->extradata); 281. mclr_size = AV_RL32(smk->avctx->extradata + 4); 282. full_size = AV_RL32(smk->avctx->extradata + 8); ^ 283. type_size = AV_RL32(smk->avctx->extradata + 12); 284. libavcodec/smacker.c:283:5: 281. mclr_size = AV_RL32(smk->avctx->extradata + 4); 282. full_size = AV_RL32(smk->avctx->extradata + 8); 283. type_size = AV_RL32(smk->avctx->extradata + 12); ^ 284. 285. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8); libavcodec/smacker.c:285:5: 283. type_size = AV_RL32(smk->avctx->extradata + 12); 284. 285. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8); ^ 286. 287. if(!get_bits1(&gb)) { libavcodec/get_bits.h:352:1: start of procedure init_get_bits() 350. * @param bit_size the size of the buffer in bits 351. */ 352. static inline void init_get_bits(GetBitContext *s, const uint8_t *buffer, ^ 353. int bit_size) 354. { libavcodec/get_bits.h:355:5: 353. int bit_size) 354. { 355. int buffer_size = (bit_size+7)>>3; ^ 356. if (buffer_size < 0 || bit_size < 0) { 357. buffer_size = bit_size = 0; libavcodec/get_bits.h:356:9: Taking false branch 354. { 355. int buffer_size = (bit_size+7)>>3; 356. if (buffer_size < 0 || bit_size < 0) { ^ 357. buffer_size = bit_size = 0; 358. buffer = NULL; libavcodec/get_bits.h:356:28: Taking false branch 354. { 355. int buffer_size = (bit_size+7)>>3; 356. if (buffer_size < 0 || bit_size < 0) { ^ 357. buffer_size = bit_size = 0; 358. buffer = NULL; libavcodec/get_bits.h:361:5: 359. } 360. 361. s->buffer = buffer; ^ 362. s->size_in_bits = bit_size; 363. #if !UNCHECKED_BITSTREAM_READER libavcodec/get_bits.h:362:5: 360. 361. s->buffer = buffer; 362. s->size_in_bits = bit_size; ^ 363. #if !UNCHECKED_BITSTREAM_READER 364. s->size_in_bits_plus8 = bit_size + 8; libavcodec/get_bits.h:364:5: 362. s->size_in_bits = bit_size; 363. #if !UNCHECKED_BITSTREAM_READER 364. s->size_in_bits_plus8 = bit_size + 8; ^ 365. #endif 366. s->buffer_end = buffer + buffer_size; libavcodec/get_bits.h:366:5: 364. s->size_in_bits_plus8 = bit_size + 8; 365. #endif 366. s->buffer_end = buffer + buffer_size; ^ 367. s->index = 0; 368. } libavcodec/get_bits.h:367:5: 365. #endif 366. s->buffer_end = buffer + buffer_size; 367. s->index = 0; ^ 368. } 369. libavcodec/get_bits.h:368:1: return from a call to init_get_bits 366. s->buffer_end = buffer + buffer_size; 367. s->index = 0; 368. } ^ 369. 370. static inline void align_get_bits(GetBitContext *s) libavcodec/smacker.c:287:9: 285. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8); 286. 287. if(!get_bits1(&gb)) { ^ 288. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n"); 289. smk->mmap_tbl = av_malloc(sizeof(int) * 2); libavcodec/get_bits.h:268:1: start of procedure get_bits1() 266. } 267. 268. static inline unsigned int get_bits1(GetBitContext *s) ^ 269. { 270. unsigned int index = s->index; libavcodec/get_bits.h:270:5: 268. static inline unsigned int get_bits1(GetBitContext *s) 269. { 270. unsigned int index = s->index; ^ 271. uint8_t result = s->buffer[index>>3]; 272. #ifdef BITSTREAM_READER_LE libavcodec/get_bits.h:271:5: 269. { 270. unsigned int index = s->index; 271. uint8_t result = s->buffer[index>>3]; ^ 272. #ifdef BITSTREAM_READER_LE 273. result >>= index & 7; libavcodec/get_bits.h:273:5: 271. uint8_t result = s->buffer[index>>3]; 272. #ifdef BITSTREAM_READER_LE 273. result >>= index & 7; ^ 274. result &= 1; 275. #else libavcodec/get_bits.h:274:5: 272. #ifdef BITSTREAM_READER_LE 273. result >>= index & 7; 274. result &= 1; ^ 275. #else 276. result <<= index & 7; libavcodec/get_bits.h:280:9: Taking false branch 278. #endif 279. #if !UNCHECKED_BITSTREAM_READER 280. if (s->index < s->size_in_bits_plus8) ^ 281. #endif 282. index++; libavcodec/get_bits.h:283:5: 281. #endif 282. index++; 283. s->index = index; ^ 284. 285. return result; libavcodec/get_bits.h:285:5: 283. s->index = index; 284. 285. return result; ^ 286. } 287. libavcodec/get_bits.h:286:1: return from a call to get_bits1 284. 285. return result; 286. } ^ 287. 288. static inline unsigned int show_bits1(GetBitContext *s) libavcodec/smacker.c:287:9: Taking true branch 285. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8); 286. 287. if(!get_bits1(&gb)) { ^ 288. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n"); 289. smk->mmap_tbl = av_malloc(sizeof(int) * 2); libavcodec/smacker.c:288:9: Skipping av_log(): empty list of specs 286. 287. if(!get_bits1(&gb)) { 288. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n"); ^ 289. smk->mmap_tbl = av_malloc(sizeof(int) * 2); 290. smk->mmap_tbl[0] = 0; libavcodec/smacker.c:289:9: 287. if(!get_bits1(&gb)) { 288. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n"); 289. smk->mmap_tbl = av_malloc(sizeof(int) * 2); ^ 290. smk->mmap_tbl[0] = 0; 291. smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1; libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:71:5: 69. #endif 70. 71. assert(size); ^ 72. 73. /* let's disallow possible ambiguous cases */ libavutil/mem.c:74:9: Taking false branch 72. 73. /* let's disallow possible ambiguous cases */ 74. if (size > (INT_MAX-32) || !size) ^ 75. return NULL; 76. libavutil/mem.c:74:33: Taking false branch 72. 73. /* let's disallow possible ambiguous cases */ 74. if (size > (INT_MAX-32) || !size) ^ 75. return NULL; 76. libavutil/mem.c:85:9: Taking false branch 83. ((char*)ptr)[-1]= diff; 84. #elif HAVE_POSIX_MEMALIGN 85. if (posix_memalign(&ptr,32,size)) ^ 86. ptr = NULL; 87. #elif HAVE_ALIGNED_MALLOC libavutil/mem.c:118:5: 116. ptr = malloc(size); 117. #endif 118. return ptr; ^ 119. } 120. libavutil/mem.c:119:1: return from a call to av_malloc 117. #endif 118. return ptr; 119. } ^ 120. 121. void *av_realloc(void *ptr, size_t size) libavcodec/smacker.c:290:9: 288. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n"); 289. smk->mmap_tbl = av_malloc(sizeof(int) * 2); 290. smk->mmap_tbl[0] = 0; ^ 291. smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1; 292. } else { libavcodec/smacker.c:291:9: 289. smk->mmap_tbl = av_malloc(sizeof(int) * 2); 290. smk->mmap_tbl[0] = 0; 291. smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1; ^ 292. } else { 293. if (smacker_decode_header_tree(smk, &gb, &smk->mmap_tbl, smk->mmap_last, mmap_size)) libavcodec/smacker.c:296:9: 294. return -1; 295. } 296. if(!get_bits1(&gb)) { ^ 297. av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n"); 298. smk->mclr_tbl = av_malloc(sizeof(int) * 2); libavcodec/get_bits.h:268:1: start of procedure get_bits1() 266. } 267. 268. static inline unsigned int get_bits1(GetBitContext *s) ^ 269. { 270. unsigned int index = s->index; libavcodec/get_bits.h:270:5: 268. static inline unsigned int get_bits1(GetBitContext *s) 269. { 270. unsigned int index = s->index; ^ 271. uint8_t result = s->buffer[index>>3]; 272. #ifdef BITSTREAM_READER_LE libavcodec/get_bits.h:271:5: 269. { 270. unsigned int index = s->index; 271. uint8_t result = s->buffer[index>>3]; ^ 272. #ifdef BITSTREAM_READER_LE 273. result >>= index & 7; libavcodec/get_bits.h:273:5: 271. uint8_t result = s->buffer[index>>3]; 272. #ifdef BITSTREAM_READER_LE 273. result >>= index & 7; ^ 274. result &= 1; 275. #else libavcodec/get_bits.h:274:5: 272. #ifdef BITSTREAM_READER_LE 273. result >>= index & 7; 274. result &= 1; ^ 275. #else 276. result <<= index & 7; libavcodec/get_bits.h:280:9: Taking false branch 278. #endif 279. #if !UNCHECKED_BITSTREAM_READER 280. if (s->index < s->size_in_bits_plus8) ^ 281. #endif 282. index++; libavcodec/get_bits.h:283:5: 281. #endif 282. index++; 283. s->index = index; ^ 284. 285. return result; libavcodec/get_bits.h:285:5: 283. s->index = index; 284. 285. return result; ^ 286. } 287. libavcodec/get_bits.h:286:1: return from a call to get_bits1 284. 285. return result; 286. } ^ 287. 288. static inline unsigned int show_bits1(GetBitContext *s) libavcodec/smacker.c:296:9: Taking true branch 294. return -1; 295. } 296. if(!get_bits1(&gb)) { ^ 297. av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n"); 298. smk->mclr_tbl = av_malloc(sizeof(int) * 2); libavcodec/smacker.c:297:9: Skipping av_log(): empty list of specs 295. } 296. if(!get_bits1(&gb)) { 297. av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n"); ^ 298. smk->mclr_tbl = av_malloc(sizeof(int) * 2); 299. smk->mclr_tbl[0] = 0; libavcodec/smacker.c:298:9: 296. if(!get_bits1(&gb)) { 297. av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n"); 298. smk->mclr_tbl = av_malloc(sizeof(int) * 2); ^ 299. smk->mclr_tbl[0] = 0; 300. smk->mclr_last[0] = smk->mclr_last[1] = smk->mclr_last[2] = 1; libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:71:5: 69. #endif 70. 71. assert(size); ^ 72. 73. /* let's disallow possible ambiguous cases */ libavutil/mem.c:74:9: Taking false branch 72. 73. /* let's disallow possible ambiguous cases */ 74. if (size > (INT_MAX-32) || !size) ^ 75. return NULL; 76. libavutil/mem.c:74:33: Taking false branch 72. 73. /* let's disallow possible ambiguous cases */ 74. if (size > (INT_MAX-32) || !size) ^ 75. return NULL; 76. libavutil/mem.c:85:9: Taking false branch 83. ((char*)ptr)[-1]= diff; 84. #elif HAVE_POSIX_MEMALIGN 85. if (posix_memalign(&ptr,32,size)) ^ 86. ptr = NULL; 87. #elif HAVE_ALIGNED_MALLOC libavutil/mem.c:118:5: 116. ptr = malloc(size); 117. #endif 118. return ptr; ^ 119. } 120. libavutil/mem.c:119:1: return from a call to av_malloc 117. #endif 118. return ptr; 119. } ^ 120. 121. void *av_realloc(void *ptr, size_t size) libavcodec/smacker.c:299:9: 297. av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n"); 298. smk->mclr_tbl = av_malloc(sizeof(int) * 2); 299. smk->mclr_tbl[0] = 0; ^ 300. smk->mclr_last[0] = smk->mclr_last[1] = smk->mclr_last[2] = 1; 301. } else { libavcodec/smacker.c:300:9: 298. smk->mclr_tbl = av_malloc(sizeof(int) * 2); 299. smk->mclr_tbl[0] = 0; 300. smk->mclr_last[0] = smk->mclr_last[1] = smk->mclr_last[2] = 1; ^ 301. } else { 302. if (smacker_decode_header_tree(smk, &gb, &smk->mclr_tbl, smk->mclr_last, mclr_size)) libavcodec/smacker.c:305:9: 303. return -1; 304. } 305. if(!get_bits1(&gb)) { ^ 306. av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n"); 307. smk->full_tbl = av_malloc(sizeof(int) * 2); libavcodec/get_bits.h:268:1: start of procedure get_bits1() 266. } 267. 268. static inline unsigned int get_bits1(GetBitContext *s) ^ 269. { 270. unsigned int index = s->index; libavcodec/get_bits.h:270:5: 268. static inline unsigned int get_bits1(GetBitContext *s) 269. { 270. unsigned int index = s->index; ^ 271. uint8_t result = s->buffer[index>>3]; 272. #ifdef BITSTREAM_READER_LE libavcodec/get_bits.h:271:5: 269. { 270. unsigned int index = s->index; 271. uint8_t result = s->buffer[index>>3]; ^ 272. #ifdef BITSTREAM_READER_LE 273. result >>= index & 7; libavcodec/get_bits.h:273:5: 271. uint8_t result = s->buffer[index>>3]; 272. #ifdef BITSTREAM_READER_LE 273. result >>= index & 7; ^ 274. result &= 1; 275. #else libavcodec/get_bits.h:274:5: 272. #ifdef BITSTREAM_READER_LE 273. result >>= index & 7; 274. result &= 1; ^ 275. #else 276. result <<= index & 7; libavcodec/get_bits.h:280:9: Taking false branch 278. #endif 279. #if !UNCHECKED_BITSTREAM_READER 280. if (s->index < s->size_in_bits_plus8) ^ 281. #endif 282. index++; libavcodec/get_bits.h:283:5: 281. #endif 282. index++; 283. s->index = index; ^ 284. 285. return result; libavcodec/get_bits.h:285:5: 283. s->index = index; 284. 285. return result; ^ 286. } 287. libavcodec/get_bits.h:286:1: return from a call to get_bits1 284. 285. return result; 286. } ^ 287. 288. static inline unsigned int show_bits1(GetBitContext *s) libavcodec/smacker.c:305:9: Taking true branch 303. return -1; 304. } 305. if(!get_bits1(&gb)) { ^ 306. av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n"); 307. smk->full_tbl = av_malloc(sizeof(int) * 2); libavcodec/smacker.c:306:9: Skipping av_log(): empty list of specs 304. } 305. if(!get_bits1(&gb)) { 306. av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n"); ^ 307. smk->full_tbl = av_malloc(sizeof(int) * 2); 308. smk->full_tbl[0] = 0; libavcodec/smacker.c:307:9: 305. if(!get_bits1(&gb)) { 306. av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n"); 307. smk->full_tbl = av_malloc(sizeof(int) * 2); ^ 308. smk->full_tbl[0] = 0; 309. smk->full_last[0] = smk->full_last[1] = smk->full_last[2] = 1; libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:71:5: 69. #endif 70. 71. assert(size); ^ 72. 73. /* let's disallow possible ambiguous cases */ libavutil/mem.c:74:9: Taking false branch 72. 73. /* let's disallow possible ambiguous cases */ 74. if (size > (INT_MAX-32) || !size) ^ 75. return NULL; 76. libavutil/mem.c:74:33: Taking false branch 72. 73. /* let's disallow possible ambiguous cases */ 74. if (size > (INT_MAX-32) || !size) ^ 75. return NULL; 76. libavutil/mem.c:85:9: Taking true branch 83. ((char*)ptr)[-1]= diff; 84. #elif HAVE_POSIX_MEMALIGN 85. if (posix_memalign(&ptr,32,size)) ^ 86. ptr = NULL; 87. #elif HAVE_ALIGNED_MALLOC libavutil/mem.c:86:9: 84. #elif HAVE_POSIX_MEMALIGN 85. if (posix_memalign(&ptr,32,size)) 86. ptr = NULL; ^ 87. #elif HAVE_ALIGNED_MALLOC 88. ptr = _aligned_malloc(size, 32); libavutil/mem.c:118:5: 116. ptr = malloc(size); 117. #endif 118. return ptr; ^ 119. } 120. libavutil/mem.c:119:1: return from a call to av_malloc 117. #endif 118. return ptr; 119. } ^ 120. 121. void *av_realloc(void *ptr, size_t size) libavcodec/smacker.c:308:9: 306. av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n"); 307. smk->full_tbl = av_malloc(sizeof(int) * 2); 308. smk->full_tbl[0] = 0; ^ 309. smk->full_last[0] = smk->full_last[1] = smk->full_last[2] = 1; 310. } else {
https://github.com/libav/libav/blob/33bb63cb3e1de6d78c475cf14384089ef3f1867d/libavcodec/smacker.c/#L308
d2a_code_trace_data_43519
int BN_hex2bn(BIGNUM **bn, const char *a) { BIGNUM *ret = NULL; BN_ULONG l = 0; int neg = 0, h, m, i, j, k, c; int num; if (a == NULL || *a == '\0') return 0; if (*a == '-') { neg = 1; a++; } for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++) continue; if (i == 0 || i > INT_MAX / 4) goto err; num = i + neg; if (bn == NULL) return num; if (*bn == NULL) { if ((ret = BN_new()) == NULL) return 0; } else { ret = *bn; BN_zero(ret); } if (bn_expand(ret, i * 4) == NULL) goto err; j = i; m = 0; h = 0; while (j > 0) { m = (BN_BYTES * 2 <= j) ? BN_BYTES * 2 : j; l = 0; for (;;) { c = a[j - m]; k = OPENSSL_hexchar2int(c); if (k < 0) k = 0; l = (l << 4) | k; if (--m <= 0) { ret->d[h++] = l; break; } } j -= BN_BYTES * 2; } ret->top = h; bn_correct_top(ret); *bn = ret; bn_check_top(ret); if (ret->top != 0) ret->neg = neg; return num; err: if (*bn == NULL) BN_free(ret); return 0; } test/bntest.c:421: error: BUFFER_OVERRUN_L2 Offset: [0, 536870912] (⇐ [0, 1] + [0, 536870911]) Size: 129 by call to `BN_hex2bn`. Showing all 6 steps of the trace test/bntest.c:421:5: Call 419. "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" 420. "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"); 421. BN_hex2bn(&n, ^ 422. "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" 423. "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"); crypto/bn/bn_print.c:141:10: <Offset trace> 139. } 140. 141. for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++) ^ 142. continue; 143. crypto/bn/bn_print.c:141:10: Assignment 139. } 140. 141. for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++) ^ 142. continue; 143. crypto/bn/bn_print.c:126:1: <Length trace> 124. } 125. 126. > int BN_hex2bn(BIGNUM **bn, const char *a) 127. { 128. BIGNUM *ret = NULL; crypto/bn/bn_print.c:126:1: Parameter `*a` 124. } 125. 126. > int BN_hex2bn(BIGNUM **bn, const char *a) 127. { 128. BIGNUM *ret = NULL; crypto/bn/bn_print.c:141:37: Array access: Offset: [0, 536870912] (⇐ [0, 1] + [0, 536870911]) Size: 129 by call to `BN_hex2bn` 139. } 140. 141. for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++) ^ 142. continue; 143.
https://github.com/openssl/openssl/blob/f91e026e38321d0c154f535ecd5af09e424e7f1b/crypto/bn/bn_print.c/#L141
d2a_code_trace_data_43520
static int vp3_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; Vp3DecodeContext *s = avctx->priv_data; GetBitContext gb; int i; init_get_bits(&gb, buf, buf_size * 8); if (s->theora && get_bits1(&gb)) { av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n"); return -1; } s->keyframe = !get_bits1(&gb); if (!s->theora) skip_bits(&gb, 1); for (i = 0; i < 3; i++) s->last_qps[i] = s->qps[i]; s->nqps=0; do{ s->qps[s->nqps++]= get_bits(&gb, 6); } while(s->theora >= 0x030200 && s->nqps<3 && get_bits1(&gb)); for (i = s->nqps; i < 3; i++) s->qps[i] = -1; if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, " VP3 %sframe #%d: Q index = %d\n", s->keyframe?"key":"", avctx->frame_number+1, s->qps[0]); s->skip_loop_filter = !s->filter_limit_values[s->qps[0]] || avctx->skip_loop_filter >= (s->keyframe ? AVDISCARD_ALL : AVDISCARD_NONKEY); if (s->qps[0] != s->last_qps[0]) init_loop_filter(s); for (i = 0; i < s->nqps; i++) if (s->qps[i] != s->last_qps[i] || s->qps[0] != s->last_qps[0]) init_dequantizer(s, i); if (avctx->skip_frame >= AVDISCARD_NONKEY && !s->keyframe) return buf_size; s->current_frame.reference = 3; s->current_frame.pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; if (ff_thread_get_buffer(avctx, &s->current_frame) < 0) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); goto error; } if (!s->edge_emu_buffer) s->edge_emu_buffer = av_malloc(9*FFABS(s->current_frame.linesize[0])); if (s->keyframe) { if (!s->theora) { skip_bits(&gb, 4); skip_bits(&gb, 4); if (s->version) { s->version = get_bits(&gb, 5); if (avctx->frame_number == 0) av_log(s->avctx, AV_LOG_DEBUG, "VP version: %d\n", s->version); } } if (s->version || s->theora) { if (get_bits1(&gb)) av_log(s->avctx, AV_LOG_ERROR, "Warning, unsupported keyframe coding type?!\n"); skip_bits(&gb, 2); } } else { if (!s->golden_frame.data[0]) { av_log(s->avctx, AV_LOG_WARNING, "vp3: first frame not a keyframe\n"); s->golden_frame.reference = 3; s->golden_frame.pict_type = AV_PICTURE_TYPE_I; if (ff_thread_get_buffer(avctx, &s->golden_frame) < 0) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); goto error; } s->last_frame = s->golden_frame; s->last_frame.type = FF_BUFFER_TYPE_COPY; ff_thread_report_progress(&s->last_frame, INT_MAX, 0); } } memset(s->all_fragments, 0, s->fragment_count * sizeof(Vp3Fragment)); ff_thread_finish_setup(avctx); if (unpack_superblocks(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_superblocks\n"); goto error; } if (unpack_modes(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_modes\n"); goto error; } if (unpack_vectors(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_vectors\n"); goto error; } if (unpack_block_qpis(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_block_qpis\n"); goto error; } if (unpack_dct_coeffs(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_dct_coeffs\n"); goto error; } for (i = 0; i < 3; i++) { int height = s->height >> (i && s->chroma_y_shift); if (s->flipped_image) s->data_offset[i] = 0; else s->data_offset[i] = (height-1) * s->current_frame.linesize[i]; } s->last_slice_end = 0; for (i = 0; i < s->c_superblock_height; i++) render_slice(s, i); for (i = 0; i < 3; i++) { int row = (s->height >> (3+(i && s->chroma_y_shift))) - 1; apply_loop_filter(s, i, row, row+1); } vp3_draw_horiz_band(s, s->avctx->height); *data_size=sizeof(AVFrame); *(AVFrame*)data= s->current_frame; if (!HAVE_THREADS || !(s->avctx->active_thread_type&FF_THREAD_FRAME)) update_frames(avctx); return buf_size; error: ff_thread_report_progress(&s->current_frame, INT_MAX, 0); if (!HAVE_THREADS || !(s->avctx->active_thread_type&FF_THREAD_FRAME)) avctx->release_buffer(avctx, &s->current_frame); return -1; } libavcodec/vp3.c:1916: error: Null Dereference pointer `&gb->buffer` last assigned on line 1908 could be null and is dereferenced by call to `get_bits1()` at line 1916, column 20. libavcodec/vp3.c:1898:1: start of procedure vp3_decode_frame() 1896. } 1897. 1898. static int vp3_decode_frame(AVCodecContext *avctx, ^ 1899. void *data, int *data_size, 1900. AVPacket *avpkt) libavcodec/vp3.c:1902:5: 1900. AVPacket *avpkt) 1901. { 1902. const uint8_t *buf = avpkt->data; ^ 1903. int buf_size = avpkt->size; 1904. Vp3DecodeContext *s = avctx->priv_data; libavcodec/vp3.c:1903:5: 1901. { 1902. const uint8_t *buf = avpkt->data; 1903. int buf_size = avpkt->size; ^ 1904. Vp3DecodeContext *s = avctx->priv_data; 1905. GetBitContext gb; libavcodec/vp3.c:1904:5: 1902. const uint8_t *buf = avpkt->data; 1903. int buf_size = avpkt->size; 1904. Vp3DecodeContext *s = avctx->priv_data; ^ 1905. GetBitContext gb; 1906. int i; libavcodec/vp3.c:1908:5: 1906. int i; 1907. 1908. init_get_bits(&gb, buf, buf_size * 8); ^ 1909. 1910. if (s->theora && get_bits1(&gb)) libavcodec/get_bits.h:339:1: start of procedure init_get_bits() 337. * @param bit_size the size of the buffer in bits 338. */ 339. static inline void init_get_bits(GetBitContext *s, const uint8_t *buffer, ^ 340. int bit_size) 341. { libavcodec/get_bits.h:342:5: 340. int bit_size) 341. { 342. int buffer_size = (bit_size+7)>>3; ^ 343. if (buffer_size < 0 || bit_size < 0) { 344. buffer_size = bit_size = 0; libavcodec/get_bits.h:343:9: Taking true branch 341. { 342. int buffer_size = (bit_size+7)>>3; 343. if (buffer_size < 0 || bit_size < 0) { ^ 344. buffer_size = bit_size = 0; 345. buffer = NULL; libavcodec/get_bits.h:344:9: 342. int buffer_size = (bit_size+7)>>3; 343. if (buffer_size < 0 || bit_size < 0) { 344. buffer_size = bit_size = 0; ^ 345. buffer = NULL; 346. } libavcodec/get_bits.h:345:9: 343. if (buffer_size < 0 || bit_size < 0) { 344. buffer_size = bit_size = 0; 345. buffer = NULL; ^ 346. } 347. libavcodec/get_bits.h:348:5: 346. } 347. 348. s->buffer = buffer; ^ 349. s->size_in_bits = bit_size; 350. #if !UNCHECKED_BITSTREAM_READER libavcodec/get_bits.h:349:5: 347. 348. s->buffer = buffer; 349. s->size_in_bits = bit_size; ^ 350. #if !UNCHECKED_BITSTREAM_READER 351. s->size_in_bits_plus8 = bit_size + 8; libavcodec/get_bits.h:351:5: 349. s->size_in_bits = bit_size; 350. #if !UNCHECKED_BITSTREAM_READER 351. s->size_in_bits_plus8 = bit_size + 8; ^ 352. #endif 353. s->buffer_end = buffer + buffer_size; libavcodec/get_bits.h:353:5: 351. s->size_in_bits_plus8 = bit_size + 8; 352. #endif 353. s->buffer_end = buffer + buffer_size; ^ 354. s->index = 0; 355. } libavcodec/get_bits.h:354:5: 352. #endif 353. s->buffer_end = buffer + buffer_size; 354. s->index = 0; ^ 355. } 356. libavcodec/get_bits.h:355:1: return from a call to init_get_bits 353. s->buffer_end = buffer + buffer_size; 354. s->index = 0; 355. } ^ 356. 357. static inline void align_get_bits(GetBitContext *s) libavcodec/vp3.c:1910:9: Taking false branch 1908. init_get_bits(&gb, buf, buf_size * 8); 1909. 1910. if (s->theora && get_bits1(&gb)) ^ 1911. { 1912. av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n"); libavcodec/vp3.c:1916:20: 1914. } 1915. 1916. s->keyframe = !get_bits1(&gb); ^ 1917. if (!s->theora) 1918. skip_bits(&gb, 1); libavcodec/get_bits.h:255:1: start of procedure get_bits1() 253. } 254. 255. static inline unsigned int get_bits1(GetBitContext *s) ^ 256. { 257. unsigned int index = s->index; libavcodec/get_bits.h:257:5: 255. static inline unsigned int get_bits1(GetBitContext *s) 256. { 257. unsigned int index = s->index; ^ 258. uint8_t result = s->buffer[index>>3]; 259. #ifdef ALT_BITSTREAM_READER_LE libavcodec/get_bits.h:258:5: 256. { 257. unsigned int index = s->index; 258. uint8_t result = s->buffer[index>>3]; ^ 259. #ifdef ALT_BITSTREAM_READER_LE 260. result >>= index & 7;
https://github.com/libav/libav/blob/9f3c77dd2a4fa4accf102c2af1f22567652b8e0f/libavcodec/vp3.c/#L1916
d2a_code_trace_data_43521
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(!strcmp(tmp, "dcodec")){ opt_data_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:4200: error: Null Dereference pointer `f` last assigned on line 4195 could be null and is dereferenced by call to `feof()` at line 4200, column 12. ffmpeg.c:4187:1: start of procedure opt_preset() 4185. } 4186. 4187. static int opt_preset(const char *opt, const char *arg) ^ 4188. { 4189. FILE *f=NULL; ffmpeg.c:4189:5: 4187. static int opt_preset(const char *opt, const char *arg) 4188. { 4189. FILE *f=NULL; ^ 4190. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4191. char *codec_name = *opt == 'v' ? video_codec_name : ffmpeg.c:4191:24: Condition is false 4189. FILE *f=NULL; 4190. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4191. char *codec_name = *opt == 'v' ? video_codec_name : ^ 4192. *opt == 'a' ? audio_codec_name : 4193. subtitle_codec_name; ffmpeg.c:4192:24: Condition is false 4190. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4191. char *codec_name = *opt == 'v' ? video_codec_name : 4192. *opt == 'a' ? audio_codec_name : ^ 4193. subtitle_codec_name; 4194. ffmpeg.c:4191:24: 4189. FILE *f=NULL; 4190. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4191. char *codec_name = *opt == 'v' ? video_codec_name : ^ 4192. *opt == 'a' ? audio_codec_name : 4193. subtitle_codec_name; ffmpeg.c:4191:5: 4189. FILE *f=NULL; 4190. char filename[1000], tmp[1000], tmp2[1000], line[1000]; 4191. char *codec_name = *opt == 'v' ? video_codec_name : ^ 4192. *opt == 'a' ? audio_codec_name : 4193. subtitle_codec_name; ffmpeg.c:4195:64: Condition is false 4193. subtitle_codec_name; 4194. 4195. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { ^ 4196. fprintf(stderr, "File for preset '%s' not found\n", arg); 4197. ffmpeg_exit(1); ffmpeg.c:4195:11: Taking true branch 4193. subtitle_codec_name; 4194. 4195. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { ^ 4196. fprintf(stderr, "File for preset '%s' not found\n", arg); 4197. ffmpeg_exit(1); ffmpeg.c:4196:9: 4194. 4195. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { 4196. fprintf(stderr, "File for preset '%s' not found\n", arg); ^ 4197. ffmpeg_exit(1); 4198. } ffmpeg.c:4197:9: Skipping ffmpeg_exit(): empty list of specs 4195. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) { 4196. fprintf(stderr, "File for preset '%s' not found\n", arg); 4197. ffmpeg_exit(1); ^ 4198. } 4199. ffmpeg.c:4200:12: 4198. } 4199. 4200. while(!feof(f)){ ^ 4201. int e= fscanf(f, "%999[^\n]\n", line) - 1; 4202. if(line[0] == '#' && !e)
https://github.com/libav/libav/blob/b568d6d94bda607e4ebb35be68181a8c2a9f5c50/ffmpeg.c/#L4200
d2a_code_trace_data_43522
int test_mod_exp(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b, *c, *d, *e; int i; a = BN_new(); b = BN_new(); c = BN_new(); d = BN_new(); e = BN_new(); BN_one(a); BN_one(b); BN_zero(c); if (BN_mod_exp(d, a, b, c, ctx)) { fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n"); return 0; } BN_bntest_rand(c, 30, 0, 1); for (i = 0; i < num2; i++) { BN_bntest_rand(a, 20 + i * 5, 0, 0); BN_bntest_rand(b, 2 + i, 0, 0); if (!BN_mod_exp(d, a, b, c, ctx)) return (0); if (bp != NULL) { if (!results) { BN_print(bp, a); BIO_puts(bp, " ^ "); BN_print(bp, b); BIO_puts(bp, " % "); BN_print(bp, c); BIO_puts(bp, " - "); } BN_print(bp, d); BIO_puts(bp, "\n"); } BN_exp(e, a, b, ctx); BN_sub(e, e, d); BN_div(a, b, e, c, ctx); if (!BN_is_zero(b)) { fprintf(stderr, "Modulo exponentiation test failed!\n"); return 0; } } BN_hex2bn(&a, "050505050505"); BN_hex2bn(&b, "02"); BN_hex2bn(&c, "4141414141414141414141274141414141414141414141414141414141414141" "4141414141414141414141414141414141414141414141414141414141414141" "4141414141414141414141800000000000000000000000000000000000000000" "0000000000000000000000000000000000000000000000000000000000000000" "0000000000000000000000000000000000000000000000000000000000000000" "0000000000000000000000000000000000000000000000000000000001"); BN_mod_exp(d, a, b, c, ctx); BN_mul(e, a, a, ctx); if (BN_cmp(d, e)) { fprintf(stderr, "BN_mod_exp and BN_mul produce different results!\n"); return 0; } BN_free(a); BN_free(b); BN_free(c); BN_free(d); BN_free(e); return (1); } test/bntest.c:1050: error: MEMORY_LEAK memory dynamically allocated to `b` by call to `BN_new()` at line 985, column 9 is not reachable after line 1050, column 1. Showing all 145 steps of the trace test/bntest.c:979:1: start of procedure test_mod_exp() 977. } 978. 979. > int test_mod_exp(BIO *bp, BN_CTX *ctx) 980. { 981. BIGNUM *a, *b, *c, *d, *e; test/bntest.c:984:5: 982. int i; 983. 984. > a = BN_new(); 985. b = BN_new(); 986. 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:985:5: 983. 984. a = BN_new(); 985. > b = BN_new(); 986. c = BN_new(); 987. 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:986:5: 984. a = BN_new(); 985. b = BN_new(); 986. > c = BN_new(); 987. d = BN_new(); 988. e = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:987:5: 985. b = BN_new(); 986. c = BN_new(); 987. > d = BN_new(); 988. e = BN_new(); 989. 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:988:5: 986. c = BN_new(); 987. d = BN_new(); 988. > e = BN_new(); 989. 990. BN_one(a); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:990:5: 988. e = BN_new(); 989. 990. > BN_one(a); 991. BN_one(b); 992. BN_zero(c); crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is true 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:991:5: 989. 990. BN_one(a); 991. > BN_one(b); 992. BN_zero(c); 993. if (BN_mod_exp(d, a, b, c, ctx)) { crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is true 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:992:5: 990. BN_one(a); 991. BN_one(b); 992. > BN_zero(c); 993. if (BN_mod_exp(d, a, b, c, ctx)) { 994. fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n"); crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is false 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:993:9: Taking true branch 991. BN_one(b); 992. BN_zero(c); 993. if (BN_mod_exp(d, a, b, c, ctx)) { ^ 994. fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n"); 995. return 0; test/bntest.c:994:9: 992. BN_zero(c); 993. if (BN_mod_exp(d, a, b, c, ctx)) { 994. > fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n"); 995. return 0; 996. } test/bntest.c:995:9: 993. if (BN_mod_exp(d, a, b, c, ctx)) { 994. fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n"); 995. > return 0; 996. } 997. test/bntest.c:1050:1: return from a call to test_mod_exp 1048. BN_free(e); 1049. return (1); 1050. > } 1051. 1052. int test_mod_exp_mont_consttime(BIO *bp, BN_CTX *ctx)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L1050
d2a_code_trace_data_43523
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ecp_smpl.c:1158: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end`. Showing all 10 steps of the trace crypto/ec/ecp_smpl.c:1093:5: Call 1091. } 1092. 1093. BN_CTX_start(ctx); ^ 1094. tmp1 = BN_CTX_get(ctx); 1095. tmp2 = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/ec/ecp_smpl.c:1158:5: Call 1156. 1157. end: 1158. BN_CTX_end(ctx); ^ 1159. BN_CTX_free(new_ctx); 1160. return ret; crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_43524
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_prime.c:317: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set`. Showing all 25 steps of the trace crypto/bn/bn_prime.c:243:1: Parameter `ctx_passed->stack.depth` 241. } 242. 243. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 244. int do_trial_division, BN_GENCB *cb) 245. { crypto/bn/bn_prime.c:277:2: Call 275. if ((ctx=BN_CTX_new()) == NULL) 276. goto err; 277. BN_CTX_start(ctx); ^ 278. 279. /* A := abs(a) */ 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_prime.c:317:7: Call 315. if (mont == NULL) 316. goto err; 317. if (!BN_MONT_CTX_set(mont, A, ctx)) ^ 318. goto err; 319. 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` 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_43525
static inline void idx_to_quant(MPCContext *c, GetBitContext *gb, int idx, int *dst) { int i, i1, t; switch(idx){ case -1: for(i = 0; i < SAMPLES_PER_BAND; i++){ *dst++ = (av_random(&c->rnd) & 0x3FC) - 510; } break; case 1: i1 = get_bits1(gb); for(i = 0; i < SAMPLES_PER_BAND/3; i++){ t = get_vlc2(gb, quant_vlc[0][i1].table, 9, 2); *dst++ = mpc7_idx30[t]; *dst++ = mpc7_idx31[t]; *dst++ = mpc7_idx32[t]; } break; case 2: i1 = get_bits1(gb); for(i = 0; i < SAMPLES_PER_BAND/2; i++){ t = get_vlc2(gb, quant_vlc[1][i1].table, 9, 2); *dst++ = mpc7_idx50[t]; *dst++ = mpc7_idx51[t]; } break; case 3: case 4: case 5: case 6: case 7: i1 = get_bits1(gb); for(i = 0; i < SAMPLES_PER_BAND; i++) *dst++ = get_vlc2(gb, quant_vlc[idx-1][i1].table, 9, 2) - mpc7_quant_vlc_off[idx-1]; break; case 8: case 9: case 10: case 11: case 12: case 13: case 14: case 15: case 16: case 17: t = (1 << (idx - 2)) - 1; for(i = 0; i < SAMPLES_PER_BAND; i++) *dst++ = get_bits(gb, idx - 1) - t; break; default: return; } } libavcodec/mpc7.c:123: error: Integer Overflow L2 ([0, 1020] - 510):unsigned32. libavcodec/mpc7.c:123:23: <LHS trace> 121. case -1: 122. for(i = 0; i < SAMPLES_PER_BAND; i++){ 123. *dst++ = (av_random(&c->rnd) & 0x3FC) - 510; ^ 124. } 125. break; libavcodec/mpc7.c:123:23: Call 121. case -1: 122. for(i = 0; i < SAMPLES_PER_BAND; i++){ 123. *dst++ = (av_random(&c->rnd) & 0x3FC) - 510; ^ 124. } 125. break; libavutil/random.h:39:1: Parameter `state->mt[*]` 37. 38. /** generates a random number on [0,0xffffffff]-interval */ 39. static inline unsigned int av_random(AVRandomState *state) ^ 40. { 41. unsigned int y; libavutil/random.h:48:5: Assignment 46. 47. // grab one... 48. y = state->mt[state->index++]; ^ 49. 50. /* Now temper (Mersenne Twister coefficients) The coefficients for MT19937 are.. */ libavutil/random.h:51:5: Assignment 49. 50. /* Now temper (Mersenne Twister coefficients) The coefficients for MT19937 are.. */ 51. y ^= (y >> 11); ^ 52. y ^= (y << 7) & 0x9d2c5680; 53. y ^= (y << 15) & 0xefc60000; libavutil/random.h:52:5: Assignment 50. /* Now temper (Mersenne Twister coefficients) The coefficients for MT19937 are.. */ 51. y ^= (y >> 11); 52. y ^= (y << 7) & 0x9d2c5680; ^ 53. y ^= (y << 15) & 0xefc60000; 54. y ^= (y >> 18); libavutil/random.h:53:5: Assignment 51. y ^= (y >> 11); 52. y ^= (y << 7) & 0x9d2c5680; 53. y ^= (y << 15) & 0xefc60000; ^ 54. y ^= (y >> 18); 55. libavutil/random.h:54:5: Assignment 52. y ^= (y << 7) & 0x9d2c5680; 53. y ^= (y << 15) & 0xefc60000; 54. y ^= (y >> 18); ^ 55. 56. return y; libavutil/random.h:56:5: Assignment 54. y ^= (y >> 18); 55. 56. return y; ^ 57. } 58. libavcodec/mpc7.c:123:13: Binary operation: ([0, 1020] - 510):unsigned32 121. case -1: 122. for(i = 0; i < SAMPLES_PER_BAND; i++){ 123. *dst++ = (av_random(&c->rnd) & 0x3FC) - 510; ^ 124. } 125. break;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpc7.c/#L123
d2a_code_trace_data_43526
static char * ngx_http_log_set_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) { ngx_http_log_loc_conf_t *llcf = conf; ssize_t buf; ngx_uint_t i, n; ngx_str_t *value, name; ngx_http_log_t *log; ngx_http_log_fmt_t *fmt; ngx_http_log_main_conf_t *lmcf; ngx_http_script_compile_t sc; value = cf->args->elts; if (ngx_strcmp(value[1].data, "off") == 0) { llcf->off = 1; return NGX_CONF_OK; } if (llcf->logs == NULL) { llcf->logs = ngx_array_create(cf->pool, 2, sizeof(ngx_http_log_t)); if (llcf->logs == NULL) { return NGX_CONF_ERROR; } } lmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_log_module); log = ngx_array_push(llcf->logs); if (log == NULL) { return NGX_CONF_ERROR; } ngx_memzero(log, sizeof(ngx_http_log_t)); n = ngx_http_script_variables_count(&value[1]); if (n == 0) { log->file = ngx_conf_open_file(cf->cycle, &value[1]); if (log->file == NULL) { return NGX_CONF_ERROR; } } else { if (ngx_conf_full_name(cf->cycle, &value[1], 0) != NGX_OK) { return NGX_CONF_ERROR; } log->script = ngx_pcalloc(cf->pool, sizeof(ngx_http_log_script_t)); if (log->script == NULL) { return NGX_CONF_ERROR; } ngx_memzero(&sc, sizeof(ngx_http_script_compile_t)); sc.cf = cf; sc.source = &value[1]; sc.lengths = &log->script->lengths; sc.values = &log->script->values; sc.variables = n; sc.complete_lengths = 1; sc.complete_values = 1; if (ngx_http_script_compile(&sc) != NGX_OK) { return NGX_CONF_ERROR; } } if (cf->args->nelts >= 3) { name = value[2]; if (ngx_strcmp(name.data, "combined") == 0) { lmcf->combined_used = 1; } } else { name.len = sizeof("combined") - 1; name.data = (u_char *) "combined"; lmcf->combined_used = 1; } fmt = lmcf->formats.elts; for (i = 0; i < lmcf->formats.nelts; i++) { if (fmt[i].name.len == name.len && ngx_strcasecmp(fmt[i].name.data, name.data) == 0) { log->format = &fmt[i]; goto buffer; } } ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "unknown log format \"%V\"", &name); return NGX_CONF_ERROR; buffer: if (cf->args->nelts == 4) { if (ngx_strncmp(value[3].data, "buffer=", 7) != 0) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid parameter \"%V\"", &value[3]); return NGX_CONF_ERROR; } if (log->script) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "buffered logs can not have variables in name"); return NGX_CONF_ERROR; } name.len = value[3].len - 7; name.data = value[3].data + 7; buf = ngx_parse_size(&name); if (buf == NGX_ERROR) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid parameter \"%V\"", &value[3]); return NGX_CONF_ERROR; } if (log->file->buffer && log->file->last - log->file->pos != buf) { ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "access_log \"%V\" already defined " "with different buffer size", &value[1]); return NGX_CONF_ERROR; } log->file->buffer = ngx_palloc(cf->pool, buf); if (log->file->buffer == NULL) { return NGX_CONF_ERROR; } log->file->pos = log->file->buffer; log->file->last = log->file->buffer + buf; } return NGX_CONF_OK; } src/http/modules/ngx_http_log_module.c:932: error: Integer Overflow L2 ([0, +oo] - 7):unsigned64. src/http/modules/ngx_http_log_module.c:857:9: <LHS trace> 855. ngx_memzero(log, sizeof(ngx_http_log_t)); 856. 857. n = ngx_http_script_variables_count(&value[1]); ^ 858. 859. if (n == 0) { src/http/modules/ngx_http_log_module.c:857:9: Call 855. ngx_memzero(log, sizeof(ngx_http_log_t)); 856. 857. n = ngx_http_script_variables_count(&value[1]); ^ 858. 859. if (n == 0) { src/http/ngx_http_script.c:214:1: Parameter `value->len` 212. 213. 214. ngx_uint_t ^ 215. ngx_http_script_variables_count(ngx_str_t *value) 216. { src/http/modules/ngx_http_log_module.c:932:9: Binary operation: ([0, +oo] - 7):unsigned64 930. } 931. 932. name.len = value[3].len - 7; ^ 933. name.data = value[3].data + 7; 934.
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/http/modules/ngx_http_log_module.c/#L932
d2a_code_trace_data_43527
BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock, const BIGNUM *mod, BN_CTX *ctx) { BN_MONT_CTX *ret; CRYPTO_r_lock(lock); ret = *pmont; CRYPTO_r_unlock(lock); if (ret) return ret; ret = BN_MONT_CTX_new(); if (ret == NULL) return NULL; if (!BN_MONT_CTX_set(ret, mod, ctx)) { BN_MONT_CTX_free(ret); return NULL; } CRYPTO_w_lock(lock); if (*pmont) { BN_MONT_CTX_free(ret); ret = *pmont; } else *pmont = ret; CRYPTO_w_unlock(lock); return ret; } crypto/bn/bn_mont.c:523: error: MEMORY_LEAK memory dynamically allocated by call to `BN_MONT_CTX_new()` at line 519, column 11 is not reachable after line 523, column 9. Showing all 45 steps of the trace crypto/bn/bn_mont.c:500:1: start of procedure BN_MONT_CTX_set_locked() 498. } 499. 500. > BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock, 501. const BIGNUM *mod, BN_CTX *ctx) 502. { crypto/bn/bn_mont.c:505:5: 503. BN_MONT_CTX *ret; 504. 505. > CRYPTO_r_lock(lock); 506. ret = *pmont; 507. CRYPTO_r_unlock(lock); crypto/lock.c:414:1: start of procedure CRYPTO_lock() 412. } 413. 414. > void CRYPTO_lock(int mode, int type, const char *file, int line) 415. { 416. #ifdef LOCK_DEBUG crypto/lock.c:441:9: Taking false branch 439. } 440. #endif 441. if (type < 0) { ^ 442. if (dynlock_lock_callback != NULL) { 443. struct CRYPTO_dynlock_value *pointer crypto/lock.c:452:16: Taking true branch 450. CRYPTO_destroy_dynlockid(type); 451. } 452. } else if (locking_callback != NULL) ^ 453. locking_callback(mode, type, file, line); 454. } crypto/lock.c:453:9: Skipping __function_pointer__(): unresolved function pointer 451. } 452. } else if (locking_callback != NULL) 453. locking_callback(mode, type, file, line); ^ 454. } 455. crypto/lock.c:441:5: 439. } 440. #endif 441. > if (type < 0) { 442. if (dynlock_lock_callback != NULL) { 443. struct CRYPTO_dynlock_value *pointer crypto/lock.c:454:1: return from a call to CRYPTO_lock 452. } else if (locking_callback != NULL) 453. locking_callback(mode, type, file, line); 454. > } 455. 456. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, crypto/bn/bn_mont.c:506:5: 504. 505. CRYPTO_r_lock(lock); 506. > ret = *pmont; 507. CRYPTO_r_unlock(lock); 508. if (ret) crypto/bn/bn_mont.c:507:5: 505. CRYPTO_r_lock(lock); 506. ret = *pmont; 507. > CRYPTO_r_unlock(lock); 508. if (ret) 509. return ret; crypto/lock.c:414:1: start of procedure CRYPTO_lock() 412. } 413. 414. > void CRYPTO_lock(int mode, int type, const char *file, int line) 415. { 416. #ifdef LOCK_DEBUG crypto/lock.c:441:9: Taking false branch 439. } 440. #endif 441. if (type < 0) { ^ 442. if (dynlock_lock_callback != NULL) { 443. struct CRYPTO_dynlock_value *pointer crypto/lock.c:452:16: Taking true branch 450. CRYPTO_destroy_dynlockid(type); 451. } 452. } else if (locking_callback != NULL) ^ 453. locking_callback(mode, type, file, line); 454. } crypto/lock.c:453:9: Skipping __function_pointer__(): unresolved function pointer 451. } 452. } else if (locking_callback != NULL) 453. locking_callback(mode, type, file, line); ^ 454. } 455. crypto/lock.c:441:5: 439. } 440. #endif 441. > if (type < 0) { 442. if (dynlock_lock_callback != NULL) { 443. struct CRYPTO_dynlock_value *pointer crypto/lock.c:454:1: return from a call to CRYPTO_lock 452. } else if (locking_callback != NULL) 453. locking_callback(mode, type, file, line); 454. > } 455. 456. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, crypto/bn/bn_mont.c:508:9: Taking false branch 506. ret = *pmont; 507. CRYPTO_r_unlock(lock); 508. if (ret) ^ 509. return ret; 510. crypto/bn/bn_mont.c:519:5: 517. * (the losers throw away the work they've done). 518. */ 519. > ret = BN_MONT_CTX_new(); 520. if (ret == NULL) 521. return NULL; crypto/bn/bn_mont.c:315:1: start of procedure BN_MONT_CTX_new() 313. } 314. 315. > BN_MONT_CTX *BN_MONT_CTX_new(void) 316. { 317. BN_MONT_CTX *ret; crypto/bn/bn_mont.c:319:9: 317. BN_MONT_CTX *ret; 318. 319. > if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) 320. return (NULL); 321. crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/bn/bn_mont.c:319:9: Taking false branch 317. BN_MONT_CTX *ret; 318. 319. if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) ^ 320. return (NULL); 321. crypto/bn/bn_mont.c:322:5: 320. return (NULL); 321. 322. > BN_MONT_CTX_init(ret); 323. ret->flags = BN_FLG_MALLOCED; 324. return (ret); crypto/bn/bn_mont.c:327:1: start of procedure BN_MONT_CTX_init() 325. } 326. 327. > void BN_MONT_CTX_init(BN_MONT_CTX *ctx) 328. { 329. ctx->ri = 0; crypto/bn/bn_mont.c:329:5: 327. void BN_MONT_CTX_init(BN_MONT_CTX *ctx) 328. { 329. > ctx->ri = 0; 330. bn_init(&(ctx->RR)); 331. bn_init(&(ctx->N)); crypto/bn/bn_mont.c:330:5: Skipping bn_init(): empty list of specs 328. { 329. ctx->ri = 0; 330. bn_init(&(ctx->RR)); ^ 331. bn_init(&(ctx->N)); 332. bn_init(&(ctx->Ni)); crypto/bn/bn_mont.c:331:5: Skipping bn_init(): empty list of specs 329. ctx->ri = 0; 330. bn_init(&(ctx->RR)); 331. bn_init(&(ctx->N)); ^ 332. bn_init(&(ctx->Ni)); 333. ctx->n0[0] = ctx->n0[1] = 0; crypto/bn/bn_mont.c:332:5: Skipping bn_init(): empty list of specs 330. bn_init(&(ctx->RR)); 331. bn_init(&(ctx->N)); 332. bn_init(&(ctx->Ni)); ^ 333. ctx->n0[0] = ctx->n0[1] = 0; 334. ctx->flags = 0; crypto/bn/bn_mont.c:333:5: 331. bn_init(&(ctx->N)); 332. bn_init(&(ctx->Ni)); 333. > ctx->n0[0] = ctx->n0[1] = 0; 334. ctx->flags = 0; 335. } crypto/bn/bn_mont.c:334:5: 332. bn_init(&(ctx->Ni)); 333. ctx->n0[0] = ctx->n0[1] = 0; 334. > ctx->flags = 0; 335. } 336. crypto/bn/bn_mont.c:335:1: return from a call to BN_MONT_CTX_init 333. ctx->n0[0] = ctx->n0[1] = 0; 334. ctx->flags = 0; 335. > } 336. 337. void BN_MONT_CTX_free(BN_MONT_CTX *mont) crypto/bn/bn_mont.c:323:5: 321. 322. BN_MONT_CTX_init(ret); 323. > ret->flags = BN_FLG_MALLOCED; 324. return (ret); 325. } crypto/bn/bn_mont.c:324:5: 322. BN_MONT_CTX_init(ret); 323. ret->flags = BN_FLG_MALLOCED; 324. > return (ret); 325. } 326. crypto/bn/bn_mont.c:325:1: return from a call to BN_MONT_CTX_new 323. ret->flags = BN_FLG_MALLOCED; 324. return (ret); 325. > } 326. 327. void BN_MONT_CTX_init(BN_MONT_CTX *ctx) crypto/bn/bn_mont.c:520:9: Taking false branch 518. */ 519. ret = BN_MONT_CTX_new(); 520. if (ret == NULL) ^ 521. return NULL; 522. if (!BN_MONT_CTX_set(ret, mod, ctx)) { crypto/bn/bn_mont.c:522:10: Taking true branch 520. if (ret == NULL) 521. return NULL; 522. if (!BN_MONT_CTX_set(ret, mod, ctx)) { ^ 523. BN_MONT_CTX_free(ret); 524. return NULL; crypto/bn/bn_mont.c:523:9: Skipping BN_MONT_CTX_free(): empty list of specs 521. return NULL; 522. if (!BN_MONT_CTX_set(ret, mod, ctx)) { 523. BN_MONT_CTX_free(ret); ^ 524. return NULL; 525. }
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/bn/bn_mont.c/#L523
d2a_code_trace_data_43528
int PEM_def_callback(char *buf, int num, int w, void *key) { int i, j; const char *prompt; if (key) { i = strlen(key); i = (i > num) ? num : i; memcpy(buf, key, i); return i; } prompt = EVP_get_pw_prompt(); if (prompt == NULL) prompt = "Enter PEM pass phrase:"; for (;;) { int min_len = w ? MIN_LENGTH : 0; i = EVP_read_pw_string_min(buf, min_len, num, prompt, w); if (i != 0) { PEMerr(PEM_F_PEM_DEF_CALLBACK, PEM_R_PROBLEMS_GETTING_PASSWORD); memset(buf, 0, (unsigned int)num); return -1; } j = strlen(buf); if (min_len && j < min_len) { fprintf(stderr, "phrase is too short, needs to be at least %d chars\n", min_len); } else break; } return j; } crypto/pem/pem_lib.c:68: error: UNINITIALIZED_VALUE The value read from j was never initialized. Showing all 1 steps of the trace crypto/pem/pem_lib.c:68:5: 66. break; 67. } 68. > return j; 69. } 70.
https://github.com/openssl/openssl/blob/48feaceb53fa6ae924e298b8eba0e247019313e4/crypto/pem/pem_lib.c/#L68
d2a_code_trace_data_43529
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/sslapitest.c:1037: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `SSL_free`. Showing all 16 steps of the trace test/sslapitest.c:982:21: Call 980. 981. if (!TEST_ptr(ctx = SSL_CTX_new(TLS_method())) 982. || !TEST_ptr(ssl = SSL_new(ctx))) ^ 983. goto end; 984. 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/sslapitest.c:1037:5: Call 1035. 1036. end: 1037. SSL_free(ssl); ^ 1038. BIO_free(bio1); 1039. BIO_free(bio2); 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_43530
static int parse_oct(const char *t[], PROPERTY_DEFINITION *res) { const char *s = *t; int64_t v = 0; if (*s == '9' || *s == '8' || !ossl_isdigit(*s)) return 0; do { v = (v << 3) + (*s - '0'); } while (ossl_isdigit(*++s) && *s != '9' && *s != '8'); if (!ossl_isspace(*s) && *s != '\0' && *s != ',') { PROPerr(PROP_F_PARSE_OCT, PROP_R_NOT_AN_OCTAL_DIGIT); return 0; } *t = skip_space(s); res->type = PROPERTY_TYPE_NUMBER; res->v.int_val = v; return 1; } test/property_test.c:243: error: BUFFER_OVERRUN_L3 Offset: [2, +oo] (⇐ [1, +oo] + 1) Size: [1, 11] by call to `ossl_method_store_add`. Showing all 23 steps of the trace test/property_test.c:229:9: Array declaration 227. char *impl; 228. } impls[] = { 229. { 6, "position=1", "a" }, ^ 230. { 6, "position=2", "b" }, 231. { 6, "position=3", "c" }, test/property_test.c:243:14: Call 241. 242. for (i = 0; i < OSSL_NELEM(impls); i++) 243. if (!TEST_true(ossl_method_store_add(store, impls[i].nid, impls[i].prop, ^ 244. impls[i].impl, NULL))) { 245. TEST_note("iteration %zd", i + 1); crypto/property/property.c:176:1: Parameter `*properties` 174. } 175. 176. > int ossl_method_store_add(OSSL_METHOD_STORE *store, 177. int nid, const char *properties, 178. void *method, void (*method_destruct)(void *)) crypto/property/property.c:205:28: Call 203. ossl_method_cache_flush(store, nid); 204. if ((impl->properties = ossl_prop_defn_get(store->ctx, properties)) == NULL) { 205. impl->properties = ossl_parse_property(store->ctx, properties); ^ 206. if (impl->properties == NULL) 207. goto err; crypto/property/property_parse.c:322:1: Parameter `*defn` 320. } 321. 322. > OSSL_PROPERTY_LIST *ossl_parse_property(OPENSSL_CTX *ctx, const char *defn) 323. { 324. PROPERTY_DEFINITION *prop = NULL; crypto/property/property_parse.c:327:5: Assignment 325. OSSL_PROPERTY_LIST *res = NULL; 326. STACK_OF(PROPERTY_DEFINITION) *sk; 327. const char *s = defn; ^ 328. int done; 329. crypto/property/property_parse.c:333:9: Call 331. return NULL; 332. 333. s = skip_space(s); ^ 334. done = *s == '\0'; 335. while (!done) { crypto/property/property_parse.c:52:1: Parameter `*s` 50. DEFINE_STACK_OF(PROPERTY_DEFINITION) 51. 52. > static const char *skip_space(const char *s) 53. { 54. while (ossl_isspace(*s)) crypto/property/property_parse.c:56:5: Assignment 54. while (ossl_isspace(*s)) 55. s++; 56. return s; ^ 57. } 58. crypto/property/property_parse.c:333:5: Assignment 331. return NULL; 332. 333. s = skip_space(s); ^ 334. done = *s == '\0'; 335. while (!done) { crypto/property/property_parse.c:341:14: Call 339. memset(&prop->v, 0, sizeof(prop->v)); 340. prop->optional = 0; 341. if (!parse_name(ctx, &s, 1, &prop->name_idx)) ^ 342. goto err; 343. prop->oper = PROPERTY_OPER_EQ; crypto/property/property_parse.c:83:1: Parameter `**t` 81. } 82. 83. > static int parse_name(OPENSSL_CTX *ctx, const char *t[], int create, 84. OSSL_PROPERTY_IDX *idx) 85. { crypto/property/property_parse.c:348:13: Call 346. goto err; 347. } 348. if (match_ch(&s, '=')) { ^ 349. if (!parse_value(ctx, &s, prop, 1)) { 350. PROPerr(PROP_F_OSSL_PARSE_PROPERTY, PROP_R_NO_VALUE); crypto/property/property_parse.c:59:1: Parameter `**t` 57. } 58. 59. > static int match_ch(const char *t[], char m) 60. { 61. const char *s = *t; crypto/property/property_parse.c:349:18: Call 347. } 348. if (match_ch(&s, '=')) { 349. if (!parse_value(ctx, &s, prop, 1)) { ^ 350. PROPerr(PROP_F_OSSL_PARSE_PROPERTY, PROP_R_NO_VALUE); 351. goto err; crypto/property/property_parse.c:247:1: Parameter `**t` 245. } 246. 247. > static int parse_value(OPENSSL_CTX *ctx, const char *t[], 248. PROPERTY_DEFINITION *res, int create) 249. { crypto/property/property_parse.c:250:5: Assignment 248. PROPERTY_DEFINITION *res, int create) 249. { 250. const char *s = *t; ^ 251. int r = 0; 252. crypto/property/property_parse.c:267:9: Assignment 265. r = parse_hex(&s, res); 266. } else if (*s == '0' && ossl_isdigit(s[1])) { 267. s++; ^ 268. r = parse_oct(&s, res); 269. } else if (ossl_isdigit(*s)) { crypto/property/property_parse.c:268:13: Call 266. } else if (*s == '0' && ossl_isdigit(s[1])) { 267. s++; 268. r = parse_oct(&s, res); ^ 269. } else if (ossl_isdigit(*s)) { 270. return parse_number(t, res); crypto/property/property_parse.c:166:1: <Length trace> 164. } 165. 166. > static int parse_oct(const char *t[], PROPERTY_DEFINITION *res) 167. { 168. const char *s = *t; crypto/property/property_parse.c:166:1: Parameter `**t` 164. } 165. 166. > static int parse_oct(const char *t[], PROPERTY_DEFINITION *res) 167. { 168. const char *s = *t; crypto/property/property_parse.c:168:5: Assignment 166. static int parse_oct(const char *t[], PROPERTY_DEFINITION *res) 167. { 168. const char *s = *t; ^ 169. int64_t v = 0; 170. crypto/property/property_parse.c:175:14: Array access: Offset: [2, +oo] (⇐ [1, +oo] + 1) Size: [1, 11] by call to `ossl_method_store_add` 173. do { 174. v = (v << 3) + (*s - '0'); 175. } while (ossl_isdigit(*++s) && *s != '9' && *s != '8'); ^ 176. if (!ossl_isspace(*s) && *s != '\0' && *s != ',') { 177. PROPerr(PROP_F_PARSE_OCT, PROP_R_NOT_AN_OCTAL_DIGIT);
https://github.com/openssl/openssl/blob/bddf965d29cb4a9c4d6eeb94aa96dfa47d0cfa5d/crypto/property/property_parse.c/#L175
d2a_code_trace_data_43531
static unsigned long get_error_values(int inc, int top, const char **file, int *line, const char **data, int *flags) { int i = 0; ERR_STATE *es; unsigned long ret; es = ERR_get_state(); if (es == NULL) return 0; if (inc && top) { if (file) *file = ""; if (line) *line = 0; if (data) *data = ""; if (flags) *flags = 0; return ERR_R_INTERNAL_ERROR; } if (es->bottom == es->top) return 0; if (top) i = es->top; else i = (es->bottom + 1) % ERR_NUM_ERRORS; ret = es->err_buffer[i]; if (inc) { es->bottom = i; es->err_buffer[i] = 0; } if (file != NULL && line != NULL) { if (es->err_file[i] == NULL) { *file = "NA"; *line = 0; } else { *file = es->err_file[i]; *line = es->err_line[i]; } } if (data == NULL) { if (inc) { err_clear_data(es, i); } } else { if (es->err_data[i] == NULL) { *data = ""; if (flags != NULL) *flags = 0; } else { *data = es->err_data[i]; if (flags != NULL) *flags = es->err_data_flags[i]; } } return ret; } crypto/err/err.c:480: error: MEMORY_LEAK memory dynamically allocated by call to `ERR_get_state()` at line 474, column 10 is not reachable after line 480, column 14. Showing all 52 steps of the trace crypto/err/err.c:466:1: start of procedure get_error_values() 464. } 465. 466. > static unsigned long get_error_values(int inc, int top, const char **file, 467. int *line, const char **data, 468. int *flags) crypto/err/err.c:470:5: 468. int *flags) 469. { 470. > int i = 0; 471. ERR_STATE *es; 472. unsigned long ret; crypto/err/err.c:474:5: 472. unsigned long ret; 473. 474. > es = ERR_get_state(); 475. if (es == NULL) 476. return 0; crypto/err/err.c:662:1: start of procedure ERR_get_state() 660. } 661. 662. > ERR_STATE *ERR_get_state(void) 663. { 664. ERR_STATE *state = NULL; crypto/err/err.c:664:5: 662. ERR_STATE *ERR_get_state(void) 663. { 664. > ERR_STATE *state = NULL; 665. 666. if (!RUN_ONCE(&err_init, err_do_init)) crypto/err/err.c:666:10: 664. ERR_STATE *state = NULL; 665. 666. > if (!RUN_ONCE(&err_init, err_do_init)) 667. return NULL; 668. crypto/threads_pthread.c:105:1: start of procedure CRYPTO_THREAD_run_once() 103. } 104. 105. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 106. { 107. if (pthread_once(once, init) != 0) crypto/threads_pthread.c:107:9: Taking false branch 105. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 106. { 107. if (pthread_once(once, init) != 0) ^ 108. return 0; 109. crypto/threads_pthread.c:110:5: 108. return 0; 109. 110. > return 1; 111. } 112. crypto/threads_pthread.c:111:1: return from a call to CRYPTO_THREAD_run_once 109. 110. return 1; 111. > } 112. 113. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)) crypto/err/err.c:666:10: Condition is true 664. ERR_STATE *state = NULL; 665. 666. if (!RUN_ONCE(&err_init, err_do_init)) ^ 667. return NULL; 668. crypto/err/err.c:666:10: Taking false branch 664. ERR_STATE *state = NULL; 665. 666. if (!RUN_ONCE(&err_init, err_do_init)) ^ 667. return NULL; 668. crypto/err/err.c:674:10: Taking false branch 672. * Needed on any platform that doesn't define OPENSSL_USE_NODELETE. 673. */ 674. if (!OPENSSL_init_crypto(0, NULL)) ^ 675. return NULL; 676. crypto/err/err.c:677:5: 675. return NULL; 676. 677. > state = CRYPTO_THREAD_get_local(&err_thread_local); 678. 679. if (state == NULL) { crypto/threads_pthread.c:121:1: start of procedure CRYPTO_THREAD_get_local() 119. } 120. 121. > void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key) 122. { 123. return pthread_getspecific(*key); crypto/threads_pthread.c:123:5: Skipping pthread_getspecific(): method has no implementation 121. void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key) 122. { 123. return pthread_getspecific(*key); ^ 124. } 125. crypto/threads_pthread.c:124:1: return from a call to CRYPTO_THREAD_get_local 122. { 123. return pthread_getspecific(*key); 124. > } 125. 126. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) crypto/err/err.c:679:9: Taking true branch 677. state = CRYPTO_THREAD_get_local(&err_thread_local); 678. 679. if (state == NULL) { ^ 680. state = OPENSSL_zalloc(sizeof(*state)); 681. if (state == NULL) crypto/err/err.c:680:9: 678. 679. if (state == NULL) { 680. > state = OPENSSL_zalloc(sizeof(*state)); 681. if (state == NULL) 682. return NULL; crypto/mem.c:228:1: start of procedure CRYPTO_zalloc() 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:5: 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. > void *ret = CRYPTO_malloc(num, file, line); 231. 232. FAILTEST(); crypto/mem.c:192:1: start of procedure CRYPTO_malloc() 190. #endif 191. 192. > void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. void *ret = NULL; crypto/mem.c:194:5: 192. void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. > void *ret = NULL; 195. 196. INCREMENT(malloc_count); crypto/mem.c:197:9: Taking false branch 195. 196. INCREMENT(malloc_count); 197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 198. return malloc_impl(num, file, line); 199. crypto/mem.c:200:9: Taking false branch 198. return malloc_impl(num, file, line); 199. 200. if (num == 0) ^ 201. return NULL; 202. crypto/mem.c:204:9: Taking true branch 202. 203. FAILTEST(); 204. if (allow_customize) { ^ 205. /* 206. * Disallow customization after the first allocation. We only set this crypto/mem.c:210:9: 208. * allocation. 209. */ 210. > allow_customize = 0; 211. } 212. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:221:5: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:221:19: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:222:5: 220. #else 221. (void)(file); (void)(line); 222. > ret = malloc(num); 223. #endif 224. crypto/mem.c:225:5: 223. #endif 224. 225. > return ret; 226. } 227. crypto/mem.c:226:1: return from a call to CRYPTO_malloc 224. 225. return ret; 226. > } 227. 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:233:9: Taking true branch 231. 232. FAILTEST(); 233. if (ret != NULL) ^ 234. memset(ret, 0, num); 235. return ret; crypto/mem.c:234:9: 232. FAILTEST(); 233. if (ret != NULL) 234. > memset(ret, 0, num); 235. return ret; 236. } crypto/mem.c:235:5: 233. if (ret != NULL) 234. memset(ret, 0, num); 235. > return ret; 236. } 237. crypto/mem.c:236:1: return from a call to CRYPTO_zalloc 234. memset(ret, 0, num); 235. return ret; 236. > } 237. 238. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/err/err.c:681:13: Taking false branch 679. if (state == NULL) { 680. state = OPENSSL_zalloc(sizeof(*state)); 681. if (state == NULL) ^ 682. return NULL; 683. crypto/err/err.c:684:14: Taking false branch 682. return NULL; 683. 684. if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE) ^ 685. || !CRYPTO_THREAD_set_local(&err_thread_local, state)) { 686. ERR_STATE_free(state); crypto/err/err.c:685:17: 683. 684. if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE) 685. > || !CRYPTO_THREAD_set_local(&err_thread_local, state)) { 686. ERR_STATE_free(state); 687. return NULL; crypto/threads_pthread.c:126:1: start of procedure CRYPTO_THREAD_set_local() 124. } 125. 126. > int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) 127. { 128. if (pthread_setspecific(*key, val) != 0) crypto/threads_pthread.c:128:9: Taking false branch 126. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) 127. { 128. if (pthread_setspecific(*key, val) != 0) ^ 129. return 0; 130. crypto/threads_pthread.c:131:5: 129. return 0; 130. 131. > return 1; 132. } 133. crypto/threads_pthread.c:132:1: return from a call to CRYPTO_THREAD_set_local 130. 131. return 1; 132. > } 133. 134. int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key) crypto/err/err.c:685:17: Taking false branch 683. 684. if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE) 685. || !CRYPTO_THREAD_set_local(&err_thread_local, state)) { ^ 686. ERR_STATE_free(state); 687. return NULL; crypto/err/err.c:691:9: Skipping OPENSSL_init_crypto(): empty list of specs 689. 690. /* Ignore failures from these */ 691. OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL); ^ 692. } 693. crypto/err/err.c:694:5: 692. } 693. 694. > return state; 695. } 696. crypto/err/err.c:695:1: return from a call to ERR_get_state 693. 694. return state; 695. > } 696. 697. int ERR_get_next_error_library(void) crypto/err/err.c:475:9: Taking false branch 473. 474. es = ERR_get_state(); 475. if (es == NULL) ^ 476. return 0; 477. crypto/err/err.c:478:9: Taking true branch 476. return 0; 477. 478. if (inc && top) { ^ 479. if (file) 480. *file = ""; crypto/err/err.c:478:16: Taking true branch 476. return 0; 477. 478. if (inc && top) { ^ 479. if (file) 480. *file = ""; crypto/err/err.c:479:13: Taking true branch 477. 478. if (inc && top) { 479. if (file) ^ 480. *file = ""; 481. if (line) crypto/err/err.c:480:13: 478. if (inc && top) { 479. if (file) 480. > *file = ""; 481. if (line) 482. *line = 0;
https://github.com/openssl/openssl/blob/f770d75b1cac264d6280ec7326277daff6965cbb/crypto/err/err.c/#L480
d2a_code_trace_data_43532
static int vp3_decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; Vp3DecodeContext *s = avctx->priv_data; GetBitContext gb; int i; init_get_bits(&gb, buf, buf_size * 8); if (s->theora && get_bits1(&gb)) { av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n"); return -1; } s->keyframe = !get_bits1(&gb); if (!s->theora) skip_bits(&gb, 1); for (i = 0; i < 3; i++) s->last_qps[i] = s->qps[i]; s->nqps=0; do{ s->qps[s->nqps++]= get_bits(&gb, 6); } while(s->theora >= 0x030200 && s->nqps<3 && get_bits1(&gb)); for (i = s->nqps; i < 3; i++) s->qps[i] = -1; if (s->avctx->debug & FF_DEBUG_PICT_INFO) av_log(s->avctx, AV_LOG_INFO, " VP3 %sframe #%d: Q index = %d\n", s->keyframe?"key":"", avctx->frame_number+1, s->qps[0]); s->skip_loop_filter = !s->filter_limit_values[s->qps[0]] || avctx->skip_loop_filter >= (s->keyframe ? AVDISCARD_ALL : AVDISCARD_NONKEY); if (s->qps[0] != s->last_qps[0]) init_loop_filter(s); for (i = 0; i < s->nqps; i++) if (s->qps[i] != s->last_qps[i] || s->qps[0] != s->last_qps[0]) init_dequantizer(s, i); if (avctx->skip_frame >= AVDISCARD_NONKEY && !s->keyframe) return buf_size; s->current_frame.reference = 3; s->current_frame.pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; if (ff_thread_get_buffer(avctx, &s->current_frame) < 0) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); goto error; } if (!s->edge_emu_buffer) s->edge_emu_buffer = av_malloc(9*FFABS(s->current_frame.linesize[0])); if (s->keyframe) { if (!s->theora) { skip_bits(&gb, 4); skip_bits(&gb, 4); if (s->version) { s->version = get_bits(&gb, 5); if (avctx->frame_number == 0) av_log(s->avctx, AV_LOG_DEBUG, "VP version: %d\n", s->version); } } if (s->version || s->theora) { if (get_bits1(&gb)) av_log(s->avctx, AV_LOG_ERROR, "Warning, unsupported keyframe coding type?!\n"); skip_bits(&gb, 2); } } else { if (!s->golden_frame.data[0]) { av_log(s->avctx, AV_LOG_WARNING, "vp3: first frame not a keyframe\n"); s->golden_frame.reference = 3; s->golden_frame.pict_type = AV_PICTURE_TYPE_I; if (ff_thread_get_buffer(avctx, &s->golden_frame) < 0) { av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); goto error; } s->last_frame = s->golden_frame; s->last_frame.type = FF_BUFFER_TYPE_COPY; ff_thread_report_progress(&s->last_frame, INT_MAX, 0); } } memset(s->all_fragments, 0, s->fragment_count * sizeof(Vp3Fragment)); ff_thread_finish_setup(avctx); if (unpack_superblocks(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_superblocks\n"); goto error; } if (unpack_modes(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_modes\n"); goto error; } if (unpack_vectors(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_vectors\n"); goto error; } if (unpack_block_qpis(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_block_qpis\n"); goto error; } if (unpack_dct_coeffs(s, &gb)){ av_log(s->avctx, AV_LOG_ERROR, "error in unpack_dct_coeffs\n"); goto error; } for (i = 0; i < 3; i++) { int height = s->height >> (i && s->chroma_y_shift); if (s->flipped_image) s->data_offset[i] = 0; else s->data_offset[i] = (height-1) * s->current_frame.linesize[i]; } s->last_slice_end = 0; for (i = 0; i < s->c_superblock_height; i++) render_slice(s, i); for (i = 0; i < 3; i++) { int row = (s->height >> (3+(i && s->chroma_y_shift))) - 1; apply_loop_filter(s, i, row, row+1); } vp3_draw_horiz_band(s, s->avctx->height); *data_size=sizeof(AVFrame); *(AVFrame*)data= s->current_frame; if (!HAVE_THREADS || !(s->avctx->active_thread_type&FF_THREAD_FRAME)) update_frames(avctx); return buf_size; error: ff_thread_report_progress(&s->current_frame, INT_MAX, 0); if (!HAVE_THREADS || !(s->avctx->active_thread_type&FF_THREAD_FRAME)) avctx->release_buffer(avctx, &s->current_frame); return -1; } libavcodec/vp3.c:1926: error: Null Dereference pointer `&gb->buffer` last assigned on line 1918 could be null and is dereferenced by call to `get_bits1()` at line 1926, column 20. libavcodec/vp3.c:1908:1: start of procedure vp3_decode_frame() 1906. } 1907. 1908. static int vp3_decode_frame(AVCodecContext *avctx, ^ 1909. void *data, int *data_size, 1910. AVPacket *avpkt) libavcodec/vp3.c:1912:5: 1910. AVPacket *avpkt) 1911. { 1912. const uint8_t *buf = avpkt->data; ^ 1913. int buf_size = avpkt->size; 1914. Vp3DecodeContext *s = avctx->priv_data; libavcodec/vp3.c:1913:5: 1911. { 1912. const uint8_t *buf = avpkt->data; 1913. int buf_size = avpkt->size; ^ 1914. Vp3DecodeContext *s = avctx->priv_data; 1915. GetBitContext gb; libavcodec/vp3.c:1914:5: 1912. const uint8_t *buf = avpkt->data; 1913. int buf_size = avpkt->size; 1914. Vp3DecodeContext *s = avctx->priv_data; ^ 1915. GetBitContext gb; 1916. int i; libavcodec/vp3.c:1918:5: 1916. int i; 1917. 1918. init_get_bits(&gb, buf, buf_size * 8); ^ 1919. 1920. if (s->theora && get_bits1(&gb)) libavcodec/get_bits.h:339:1: start of procedure init_get_bits() 337. * @param bit_size the size of the buffer in bits 338. */ 339. static inline void init_get_bits(GetBitContext *s, const uint8_t *buffer, ^ 340. int bit_size) 341. { libavcodec/get_bits.h:342:5: 340. int bit_size) 341. { 342. int buffer_size = (bit_size+7)>>3; ^ 343. if (buffer_size < 0 || bit_size < 0) { 344. buffer_size = bit_size = 0; libavcodec/get_bits.h:343:9: Taking true branch 341. { 342. int buffer_size = (bit_size+7)>>3; 343. if (buffer_size < 0 || bit_size < 0) { ^ 344. buffer_size = bit_size = 0; 345. buffer = NULL; libavcodec/get_bits.h:344:9: 342. int buffer_size = (bit_size+7)>>3; 343. if (buffer_size < 0 || bit_size < 0) { 344. buffer_size = bit_size = 0; ^ 345. buffer = NULL; 346. } libavcodec/get_bits.h:345:9: 343. if (buffer_size < 0 || bit_size < 0) { 344. buffer_size = bit_size = 0; 345. buffer = NULL; ^ 346. } 347. libavcodec/get_bits.h:348:5: 346. } 347. 348. s->buffer = buffer; ^ 349. s->size_in_bits = bit_size; 350. #if !UNCHECKED_BITSTREAM_READER libavcodec/get_bits.h:349:5: 347. 348. s->buffer = buffer; 349. s->size_in_bits = bit_size; ^ 350. #if !UNCHECKED_BITSTREAM_READER 351. s->size_in_bits_plus8 = bit_size + 8; libavcodec/get_bits.h:351:5: 349. s->size_in_bits = bit_size; 350. #if !UNCHECKED_BITSTREAM_READER 351. s->size_in_bits_plus8 = bit_size + 8; ^ 352. #endif 353. s->buffer_end = buffer + buffer_size; libavcodec/get_bits.h:353:5: 351. s->size_in_bits_plus8 = bit_size + 8; 352. #endif 353. s->buffer_end = buffer + buffer_size; ^ 354. s->index = 0; 355. } libavcodec/get_bits.h:354:5: 352. #endif 353. s->buffer_end = buffer + buffer_size; 354. s->index = 0; ^ 355. } 356. libavcodec/get_bits.h:355:1: return from a call to init_get_bits 353. s->buffer_end = buffer + buffer_size; 354. s->index = 0; 355. } ^ 356. 357. static inline void align_get_bits(GetBitContext *s) libavcodec/vp3.c:1920:9: Taking false branch 1918. init_get_bits(&gb, buf, buf_size * 8); 1919. 1920. if (s->theora && get_bits1(&gb)) ^ 1921. { 1922. av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n"); libavcodec/vp3.c:1926:20: 1924. } 1925. 1926. s->keyframe = !get_bits1(&gb); ^ 1927. if (!s->theora) 1928. skip_bits(&gb, 1); libavcodec/get_bits.h:255:1: start of procedure get_bits1() 253. } 254. 255. static inline unsigned int get_bits1(GetBitContext *s) ^ 256. { 257. unsigned int index = s->index; libavcodec/get_bits.h:257:5: 255. static inline unsigned int get_bits1(GetBitContext *s) 256. { 257. unsigned int index = s->index; ^ 258. uint8_t result = s->buffer[index>>3]; 259. #ifdef BITSTREAM_READER_LE libavcodec/get_bits.h:258:5: 256. { 257. unsigned int index = s->index; 258. uint8_t result = s->buffer[index>>3]; ^ 259. #ifdef BITSTREAM_READER_LE 260. result >>= index & 7;
https://github.com/libav/libav/blob/1c9e340d35351858907f11c45b2691db708f3903/libavcodec/vp3.c/#L1926
d2a_code_trace_data_43533
static SSL_TEST_CTX_TEST_FIXTURE set_up(const char *const test_case_name) { SSL_TEST_CTX_TEST_FIXTURE fixture; fixture.test_case_name = test_case_name; fixture.expected_ctx = SSL_TEST_CTX_new(); OPENSSL_assert(fixture.expected_ctx != NULL); return fixture; } test/ssl_test_ctx_test.c:127: error: MEMORY_LEAK memory dynamically allocated by call to `SSL_TEST_CTX_new()` at line 125, column 28 is not reachable after line 127, column 5. Showing all 26 steps of the trace test/ssl_test_ctx_test.c:121:1: start of procedure set_up() 119. } 120. 121. > static SSL_TEST_CTX_TEST_FIXTURE set_up(const char *const test_case_name) 122. { 123. SSL_TEST_CTX_TEST_FIXTURE fixture; test/ssl_test_ctx_test.c:124:5: 122. { 123. SSL_TEST_CTX_TEST_FIXTURE fixture; 124. > fixture.test_case_name = test_case_name; 125. fixture.expected_ctx = SSL_TEST_CTX_new(); 126. OPENSSL_assert(fixture.expected_ctx != NULL); test/ssl_test_ctx_test.c:125:5: 123. SSL_TEST_CTX_TEST_FIXTURE fixture; 124. fixture.test_case_name = test_case_name; 125. > fixture.expected_ctx = SSL_TEST_CTX_new(); 126. OPENSSL_assert(fixture.expected_ctx != NULL); 127. return fixture; test/ssl_test_ctx.c:341:1: start of procedure SSL_TEST_CTX_new() 339. * for malloc failures and other internal errors. 340. */ 341. > SSL_TEST_CTX *SSL_TEST_CTX_new() 342. { 343. SSL_TEST_CTX *ret; test/ssl_test_ctx.c:344:5: 342. { 343. SSL_TEST_CTX *ret; 344. > ret = OPENSSL_zalloc(sizeof(*ret)); 345. OPENSSL_assert(ret != NULL); 346. return ret; crypto/mem.c:98:1: start of procedure CRYPTO_zalloc() 96. } 97. 98. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 99. { 100. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:100:5: 98. void *CRYPTO_zalloc(size_t num, const char *file, int line) 99. { 100. > void *ret = CRYPTO_malloc(num, file, line); 101. 102. if (ret != NULL) crypto/mem.c:71:1: start of procedure CRYPTO_malloc() 69. } 70. 71. > void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. void *ret = NULL; crypto/mem.c:73:5: 71. void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. > void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:75:9: Taking false branch 73. void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 76. return malloc_impl(num, file, line); 77. crypto/mem.c:78:9: Taking false branch 76. return malloc_impl(num, file, line); 77. 78. if (num <= 0) ^ 79. return NULL; 80. crypto/mem.c:81:5: 79. return NULL; 80. 81. > allow_customize = 0; 82. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 83. if (call_malloc_debug) { crypto/mem.c:91:5: 89. } 90. #else 91. > osslargused(file); osslargused(line); 92. ret = malloc(num); 93. #endif crypto/mem.c:91:24: 89. } 90. #else 91. > osslargused(file); osslargused(line); 92. ret = malloc(num); 93. #endif crypto/mem.c:92:5: 90. #else 91. osslargused(file); osslargused(line); 92. > ret = malloc(num); 93. #endif 94. crypto/mem.c:95:5: 93. #endif 94. 95. > return ret; 96. } 97. crypto/mem.c:96:1: return from a call to CRYPTO_malloc 94. 95. return ret; 96. > } 97. 98. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:102:9: Taking true branch 100. void *ret = CRYPTO_malloc(num, file, line); 101. 102. if (ret != NULL) ^ 103. memset(ret, 0, num); 104. return ret; crypto/mem.c:103:9: 101. 102. if (ret != NULL) 103. > memset(ret, 0, num); 104. return ret; 105. } crypto/mem.c:104:5: 102. if (ret != NULL) 103. memset(ret, 0, num); 104. > return ret; 105. } 106. crypto/mem.c:105:1: return from a call to CRYPTO_zalloc 103. memset(ret, 0, num); 104. return ret; 105. > } 106. 107. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) test/ssl_test_ctx.c:345:5: Condition is true 343. SSL_TEST_CTX *ret; 344. ret = OPENSSL_zalloc(sizeof(*ret)); 345. OPENSSL_assert(ret != NULL); ^ 346. return ret; 347. } test/ssl_test_ctx.c:346:5: 344. ret = OPENSSL_zalloc(sizeof(*ret)); 345. OPENSSL_assert(ret != NULL); 346. > return ret; 347. } 348. test/ssl_test_ctx.c:347:1: return from a call to SSL_TEST_CTX_new 345. OPENSSL_assert(ret != NULL); 346. return ret; 347. > } 348. 349. void SSL_TEST_CTX_free(SSL_TEST_CTX *ctx) test/ssl_test_ctx_test.c:126:5: Condition is true 124. fixture.test_case_name = test_case_name; 125. fixture.expected_ctx = SSL_TEST_CTX_new(); 126. OPENSSL_assert(fixture.expected_ctx != NULL); ^ 127. return fixture; 128. } test/ssl_test_ctx_test.c:127:5: 125. fixture.expected_ctx = SSL_TEST_CTX_new(); 126. OPENSSL_assert(fixture.expected_ctx != NULL); 127. > return fixture; 128. } 129.
https://github.com/openssl/openssl/blob/70c22888c1648fe8652e77107f3c74bf2212de36/test/ssl_test_ctx_test.c/#L127
d2a_code_trace_data_43534
static int module_init(CONF_MODULE *pmod, char *name, char *value, CONF *cnf) { int ret, init_called = 0; CONF_IMODULE *imod = NULL; imod = OPENSSL_malloc(sizeof(CONF_IMODULE)); if (!imod) goto err; imod->pmod = pmod; imod->name = BUF_strdup(name); imod->value = BUF_strdup(value); imod->usr_data = NULL; if (!imod->name || !imod->value) goto memerr; if(pmod->init) { ret = pmod->init(imod, cnf); init_called = 1; if (ret <= 0) goto err; } if (initialized_modules == NULL) initialized_modules = sk_CONF_IMODULE_new_null(); if (!initialized_modules) goto err; if (!sk_CONF_IMODULE_push(initialized_modules, imod)) goto err; pmod->links++; return ret; err: CONFerr(CONF_F_MODULE_INIT, ERR_R_MALLOC_FAILURE); if (pmod->finish && init_called) pmod->finish(imod); memerr: if (imod) { if (imod->name) OPENSSL_free(imod->name); if (imod->value) OPENSSL_free(imod->value); OPENSSL_free(imod); } return -1; } crypto/conf/conf_mod.c:360: error: UNINITIALIZED_VALUE The value read from ret was never initialized. Showing all 1 steps of the trace crypto/conf/conf_mod.c:360:2: 358. pmod->links++; 359. 360. > return ret; 361. 362. err:
https://github.com/openssl/openssl/blob/e4dd79bbc83f9eb4f55f3f1d04c4f72fea022778/crypto/conf/conf_mod.c/#L360
d2a_code_trace_data_43535
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_sqrt.c:75: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_nnmod`. Showing all 22 steps of the trace crypto/bn/bn_sqrt.c:60:9: Call 58. 59. BN_CTX_start(ctx); 60. A = BN_CTX_get(ctx); ^ 61. b = BN_CTX_get(ctx); 62. q = 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/bn/bn_sqrt.c:75:10: Call 73. 74. /* A = a mod p */ 75. if (!BN_nnmod(A, a, p, ctx)) ^ 76. goto end; 77. crypto/bn/bn_mod.c:13:1: Parameter `*r->d` 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 `*rm->d` 207. * If 'dv' or 'rm' is NULL, the respective value is not returned. 208. */ 209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 210. BN_CTX *ctx) 211. { crypto/bn/bn_div.c:229:11: Call 227. } 228. 229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx); ^ 230. 231. if (ret) { crypto/bn/bn_div.c:264:1: Parameter `*rm->d` 262. * divisor's length is considered public; 263. */ 264. > int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, 265. const BIGNUM *divisor, BN_CTX *ctx) 266. { crypto/bn/bn_div.c:449:9: Call 447. snum->flags |= BN_FLG_FIXED_TOP; 448. if (rm != NULL) 449. bn_rshift_fixed_top(rm, snum, norm_shift); ^ 450. BN_CTX_end(ctx); 451. return 1; crypto/bn/bn_shift.c:214:1: Parameter `*r->d` 212. * |n < BN_BITS2| or |n / BN_BITS2| being non-secret. 213. */ 214. > int bn_rshift_fixed_top(BIGNUM *r, const BIGNUM *a, int n) 215. { 216. int i, top, nw; crypto/bn/bn_shift.c:239:19: Call 237. mask |= mask >> 8; 238. top = a->top - nw; 239. if (r != a && bn_wexpand(r, top) == NULL) ^ 240. return 0; 241. 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_nnmod` 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_43536
static int estimate_best_b_count(MpegEncContext *s) { AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id); AVCodecContext *c = avcodec_alloc_context3(NULL); const int scale = s->avctx->brd_scale; int i, j, out_size, p_lambda, b_lambda, lambda2; int64_t best_rd = INT64_MAX; int best_b_count = -1; assert(scale >= 0 && scale <= 3); p_lambda = s->last_lambda_for[AV_PICTURE_TYPE_P]; b_lambda = s->last_lambda_for[AV_PICTURE_TYPE_B]; if (!b_lambda) b_lambda = p_lambda; lambda2 = (b_lambda * b_lambda + (1 << FF_LAMBDA_SHIFT) / 2) >> FF_LAMBDA_SHIFT; c->width = s->width >> scale; c->height = s->height >> scale; c->flags = CODEC_FLAG_QSCALE | CODEC_FLAG_PSNR; c->flags |= s->avctx->flags & CODEC_FLAG_QPEL; c->mb_decision = s->avctx->mb_decision; c->me_cmp = s->avctx->me_cmp; c->mb_cmp = s->avctx->mb_cmp; c->me_sub_cmp = s->avctx->me_sub_cmp; c->pix_fmt = AV_PIX_FMT_YUV420P; c->time_base = s->avctx->time_base; c->max_b_frames = s->max_b_frames; if (avcodec_open2(c, codec, NULL) < 0) return -1; for (i = 0; i < s->max_b_frames + 2; i++) { Picture pre_input, *pre_input_ptr = i ? s->input_picture[i - 1] : s->next_picture_ptr; if (pre_input_ptr && (!i || s->input_picture[i - 1])) { pre_input = *pre_input_ptr; if (!pre_input.shared && i) { pre_input.f->data[0] += INPLACE_OFFSET; pre_input.f->data[1] += INPLACE_OFFSET; pre_input.f->data[2] += INPLACE_OFFSET; } s->mpvencdsp.shrink[scale](s->tmp_frames[i]->data[0], s->tmp_frames[i]->linesize[0], pre_input.f->data[0], pre_input.f->linesize[0], c->width, c->height); s->mpvencdsp.shrink[scale](s->tmp_frames[i]->data[1], s->tmp_frames[i]->linesize[1], pre_input.f->data[1], pre_input.f->linesize[1], c->width >> 1, c->height >> 1); s->mpvencdsp.shrink[scale](s->tmp_frames[i]->data[2], s->tmp_frames[i]->linesize[2], pre_input.f->data[2], pre_input.f->linesize[2], c->width >> 1, c->height >> 1); } } for (j = 0; j < s->max_b_frames + 1; j++) { int64_t rd = 0; if (!s->input_picture[j]) break; c->error[0] = c->error[1] = c->error[2] = 0; s->tmp_frames[0]->pict_type = AV_PICTURE_TYPE_I; s->tmp_frames[0]->quality = 1 * FF_QP2LAMBDA; out_size = encode_frame(c, s->tmp_frames[0]); for (i = 0; i < s->max_b_frames + 1; i++) { int is_p = i % (j + 1) == j || i == s->max_b_frames; s->tmp_frames[i + 1]->pict_type = is_p ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_B; s->tmp_frames[i + 1]->quality = is_p ? p_lambda : b_lambda; out_size = encode_frame(c, s->tmp_frames[i + 1]); rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3); } while (out_size) { out_size = encode_frame(c, NULL); rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3); } rd += c->error[0] + c->error[1] + c->error[2]; if (rd < best_rd) { best_rd = rd; best_b_count = j; } } avcodec_close(c); av_freep(&c); return best_b_count; } libavcodec/mpegvideo_enc.c:1122: error: Null Dereference pointer `c` last assigned on line 1104 could be null and is dereferenced at line 1122, column 5. libavcodec/mpegvideo_enc.c:1101:1: start of procedure estimate_best_b_count() 1099. } 1100. 1101. static int estimate_best_b_count(MpegEncContext *s) ^ 1102. { 1103. AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id); libavcodec/mpegvideo_enc.c:1103:5: 1101. static int estimate_best_b_count(MpegEncContext *s) 1102. { 1103. AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id); ^ 1104. AVCodecContext *c = avcodec_alloc_context3(NULL); 1105. const int scale = s->avctx->brd_scale; libavcodec/utils.c:1752:1: start of procedure avcodec_find_encoder() 1750. } 1751. 1752. AVCodec *avcodec_find_encoder(enum AVCodecID id) ^ 1753. { 1754. return find_encdec(id, 1); libavcodec/utils.c:1754:5: Skipping find_encdec(): empty list of specs 1752. AVCodec *avcodec_find_encoder(enum AVCodecID id) 1753. { 1754. return find_encdec(id, 1); ^ 1755. } 1756. libavcodec/utils.c:1755:1: return from a call to avcodec_find_encoder 1753. { 1754. return find_encdec(id, 1); 1755. } ^ 1756. 1757. AVCodec *avcodec_find_encoder_by_name(const char *name) libavcodec/mpegvideo_enc.c:1104:5: 1102. { 1103. AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id); 1104. AVCodecContext *c = avcodec_alloc_context3(NULL); ^ 1105. const int scale = s->avctx->brd_scale; 1106. int i, j, out_size, p_lambda, b_lambda, lambda2; libavcodec/options.c:124:1: start of procedure avcodec_alloc_context3() 122. } 123. 124. AVCodecContext *avcodec_alloc_context3(const AVCodec *codec) ^ 125. { 126. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); libavcodec/options.c:126:5: 124. AVCodecContext *avcodec_alloc_context3(const AVCodec *codec) 125. { 126. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); ^ 127. 128. if (!avctx) 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 false branch 68. 69. /* let's disallow possibly ambiguous cases */ 70. if (size > (INT_MAX - 32) || !size) ^ 71. return NULL; 72. libavutil/mem.c:70:35: Taking false branch 68. 69. /* let's disallow possibly ambiguous cases */ 70. if (size > (INT_MAX - 32) || !size) ^ 71. return NULL; 72. libavutil/mem.c:81:9: Taking false branch 79. ((char *)ptr)[-1] = diff; 80. #elif HAVE_POSIX_MEMALIGN 81. if (posix_memalign(&ptr, 32, size)) ^ 82. ptr = NULL; 83. #elif HAVE_ALIGNED_MALLOC libavutil/mem.c:114:5: 112. ptr = malloc(size); 113. #endif 114. return ptr; ^ 115. } 116. libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavcodec/options.c:128:10: Taking true branch 126. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); 127. 128. if (!avctx) ^ 129. return NULL; 130. libavcodec/options.c:129:9: 127. 128. if (!avctx) 129. return NULL; ^ 130. 131. if(avcodec_get_context_defaults3(avctx, codec) < 0){ libavcodec/options.c:137:1: return from a call to avcodec_alloc_context3 135. 136. return avctx; 137. } ^ 138. 139. void avcodec_free_context(AVCodecContext **pavctx) libavcodec/mpegvideo_enc.c:1105:5: 1103. AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id); 1104. AVCodecContext *c = avcodec_alloc_context3(NULL); 1105. const int scale = s->avctx->brd_scale; ^ 1106. int i, j, out_size, p_lambda, b_lambda, lambda2; 1107. int64_t best_rd = INT64_MAX; libavcodec/mpegvideo_enc.c:1107:5: 1105. const int scale = s->avctx->brd_scale; 1106. int i, j, out_size, p_lambda, b_lambda, lambda2; 1107. int64_t best_rd = INT64_MAX; ^ 1108. int best_b_count = -1; 1109. libavcodec/mpegvideo_enc.c:1108:5: 1106. int i, j, out_size, p_lambda, b_lambda, lambda2; 1107. int64_t best_rd = INT64_MAX; 1108. int best_b_count = -1; ^ 1109. 1110. assert(scale >= 0 && scale <= 3); libavcodec/mpegvideo_enc.c:1110:5: 1108. int best_b_count = -1; 1109. 1110. assert(scale >= 0 && scale <= 3); ^ 1111. 1112. //emms_c(); libavcodec/mpegvideo_enc.c:1114:5: 1112. //emms_c(); 1113. //s->next_picture_ptr->quality; 1114. p_lambda = s->last_lambda_for[AV_PICTURE_TYPE_P]; ^ 1115. //p_lambda * FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; 1116. b_lambda = s->last_lambda_for[AV_PICTURE_TYPE_B]; libavcodec/mpegvideo_enc.c:1116:5: 1114. p_lambda = s->last_lambda_for[AV_PICTURE_TYPE_P]; 1115. //p_lambda * FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; 1116. b_lambda = s->last_lambda_for[AV_PICTURE_TYPE_B]; ^ 1117. if (!b_lambda) // FIXME we should do this somewhere else 1118. b_lambda = p_lambda; libavcodec/mpegvideo_enc.c:1117:10: Taking false branch 1115. //p_lambda * FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; 1116. b_lambda = s->last_lambda_for[AV_PICTURE_TYPE_B]; 1117. if (!b_lambda) // FIXME we should do this somewhere else ^ 1118. b_lambda = p_lambda; 1119. lambda2 = (b_lambda * b_lambda + (1 << FF_LAMBDA_SHIFT) / 2) >> libavcodec/mpegvideo_enc.c:1119:5: 1117. if (!b_lambda) // FIXME we should do this somewhere else 1118. b_lambda = p_lambda; 1119. lambda2 = (b_lambda * b_lambda + (1 << FF_LAMBDA_SHIFT) / 2) >> ^ 1120. FF_LAMBDA_SHIFT; 1121. libavcodec/mpegvideo_enc.c:1122:5: 1120. FF_LAMBDA_SHIFT; 1121. 1122. c->width = s->width >> scale; ^ 1123. c->height = s->height >> scale; 1124. c->flags = CODEC_FLAG_QSCALE | CODEC_FLAG_PSNR;
https://github.com/libav/libav/blob/b16699f2da9c1d41eff852ec3a0c81f74fd44421/libavcodec/mpegvideo_enc.c/#L1122
d2a_code_trace_data_43537
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) { int i, j, max; const BN_ULONG *ap; BN_ULONG *rp; max = n * 2; ap = a; rp = r; rp[0] = rp[max - 1] = 0; rp++; j = n; if (--j > 0) { ap++; rp[j] = bn_mul_words(rp, ap, j, ap[-1]); rp += 2; } for (i = n - 2; i > 0; i--) { j--; ap++; rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]); rp += 2; } bn_add_words(r, r, r, max); bn_sqr_words(tmp, a, n); bn_add_words(r, r, tmp, max); } test/srptest.c:180: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `SRP_create_verifier_BN`. Showing all 25 steps of the trace test/srptest.c:180:10: Call 178. BN_hex2bn(&s, "BEB25379D1A8581EB5A727673A2441EE"); 179. /* Set up server's password entry */ 180. if (!SRP_create_verifier_BN("alice", "password123", &s, &v, GN->N, ^ 181. GN->g)) { 182. fprintf(stderr, "Failed to create SRP verifier\n"); crypto/srp/srp_vfy.c:630:1: Parameter `g->top` 628. * BIGNUMS. 629. */ 630. > int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, 631. BIGNUM **verifier, const BIGNUM *N, 632. const BIGNUM *g) crypto/srp/srp_vfy.c:661:10: Call 659. goto err; 660. 661. if (!BN_mod_exp(*verifier, g, x, N, bn_ctx)) { ^ 662. BN_clear_free(*verifier); 663. goto err; crypto/bn/bn_exp.c:90:1: Parameter `a->top` 88. } 89. 90. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 91. BN_CTX *ctx) 92. { crypto/bn/bn_exp.c:150:19: Call 148. } else 149. # endif 150. ret = BN_mod_exp_mont(r, a, p, m, ctx, NULL); ^ 151. } else 152. #endif crypto/bn/bn_exp.c:300:1: Parameter `a->top` 298. } 299. 300. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 301. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 302. { crypto/bn/bn_exp.c:312:16: Call 310. 311. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { 312. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 313. } 314. crypto/bn/bn_exp.c:600:1: Parameter `a->top` 598. * http://www.daemonology.net/hyperthreading-considered-harmful/) 599. */ 600. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 601. const BIGNUM *m, BN_CTX *ctx, 602. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:757:17: Call 755. if (!BN_to_montgomery(&am, &am, mont, ctx)) 756. goto err; 757. } else if (!BN_to_montgomery(&am, a, mont, ctx)) ^ 758. goto err; 759. crypto/bn/bn_lib.c:945:1: Parameter `a->top` 943. } 944. 945. > int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 946. BN_CTX *ctx) 947. { crypto/bn/bn_lib.c:948:12: Call 946. BN_CTX *ctx) 947. { 948. return BN_mod_mul_montgomery(r, a, &(mont->RR), mont, ctx); ^ 949. } 950. 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:104:1: <Offset trace> 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:104:1: Parameter `n` 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:115:5: Assignment 113. rp[0] = rp[max - 1] = 0; 114. rp++; 115. j = n; ^ 116. 117. if (--j > 0) { crypto/bn/bn_sqr.c:117:9: Assignment 115. j = n; 116. 117. if (--j > 0) { ^ 118. ap++; 119. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); crypto/bn/bn_sqr.c:104:1: <Length trace> 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:104:1: Parameter `*r` 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:112:5: Assignment 110. max = n * 2; 111. ap = a; 112. rp = r; ^ 113. rp[0] = rp[max - 1] = 0; 114. rp++; crypto/bn/bn_sqr.c:114:5: Assignment 112. rp = r; 113. rp[0] = rp[max - 1] = 0; 114. rp++; ^ 115. j = n; 116. crypto/bn/bn_sqr.c:119:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `SRP_create_verifier_BN` 117. if (--j > 0) { 118. ap++; 119. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); ^ 120. rp += 2; 121. }
https://github.com/openssl/openssl/blob/b90506e995d44dee0ef4dd0324b56b59154256c2/crypto/bn/bn_sqr.c/#L119
d2a_code_trace_data_43538
static void unpack_input(const unsigned char *input, unsigned int *output) { unsigned int outbuffer[28]; unsigned short inbuffer[10]; unsigned int x; unsigned int *ptr; for (x=0;x<20;x+=2) inbuffer[x/2]=(input[x]<<8)+input[x+1]; ptr=outbuffer; *(ptr++)=27; *(ptr++)=(inbuffer[0]>>10)&0x3f; *(ptr++)=(inbuffer[0]>>5)&0x1f; *(ptr++)=inbuffer[0]&0x1f; *(ptr++)=(inbuffer[1]>>12)&0xf; *(ptr++)=(inbuffer[1]>>8)&0xf; *(ptr++)=(inbuffer[1]>>5)&7; *(ptr++)=(inbuffer[1]>>2)&7; *(ptr++)=((inbuffer[1]<<1)&6)|((inbuffer[2]>>15)&1); *(ptr++)=(inbuffer[2]>>12)&7; *(ptr++)=(inbuffer[2]>>10)&3; *(ptr++)=(inbuffer[2]>>5)&0x1f; *(ptr++)=((inbuffer[2]<<2)&0x7c)|((inbuffer[3]>>14)&3); *(ptr++)=(inbuffer[3]>>6)&0xff; *(ptr++)=((inbuffer[3]<<1)&0x7e)|((inbuffer[4]>>15)&1); *(ptr++)=(inbuffer[4]>>8)&0x7f; *(ptr++)=(inbuffer[4]>>1)&0x7f; *(ptr++)=((inbuffer[4]<<7)&0x80)|((inbuffer[5]>>9)&0x7f); *(ptr++)=(inbuffer[5]>>2)&0x7f; *(ptr++)=((inbuffer[5]<<5)&0x60)|((inbuffer[6]>>11)&0x1f); *(ptr++)=(inbuffer[6]>>4)&0x7f; *(ptr++)=((inbuffer[6]<<4)&0xf0)|((inbuffer[7]>>12)&0xf); *(ptr++)=(inbuffer[7]>>5)&0x7f; *(ptr++)=((inbuffer[7]<<2)&0x7c)|((inbuffer[8]>>14)&3); *(ptr++)=(inbuffer[8]>>7)&0x7f; *(ptr++)=((inbuffer[8]<<1)&0xfe)|((inbuffer[9]>>15)&1); *(ptr++)=(inbuffer[9]>>8)&0x7f; *(ptr++)=(inbuffer[9]>>1)&0x7f; *(output++)=outbuffer[11]; for (x=1;x<11;*(output++)=outbuffer[x++]); ptr=outbuffer+12; for (x=0;x<16;x+=4) { *(output++)=ptr[x]; *(output++)=ptr[x+2]; *(output++)=ptr[x+3]; *(output++)=ptr[x+1]; } } libavcodec/ra144.c:276: error: Uninitialized Value The value read from inbuffer[_] was never initialized. libavcodec/ra144.c:276:3: 274. *(ptr++)=(inbuffer[1]>>2)&7; 275. *(ptr++)=((inbuffer[1]<<1)&6)|((inbuffer[2]>>15)&1); 276. *(ptr++)=(inbuffer[2]>>12)&7; ^ 277. *(ptr++)=(inbuffer[2]>>10)&3; 278. *(ptr++)=(inbuffer[2]>>5)&0x1f;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ra144.c/#L276
d2a_code_trace_data_43539
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/statem/statem_clnt.c:795: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 36]):unsigned64 by call to `WPACKET_start_sub_packet_len__`. Showing all 12 steps of the trace ssl/statem/statem_clnt.c:784:17: Call 782. */ 783. if (!WPACKET_put_bytes_u16(pkt, s->client_version) 784. || !WPACKET_memcpy(pkt, s->s3->client_random, SSL3_RANDOM_SIZE)) { ^ 785. SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); 786. return 0; ssl/packet.c:302:1: Parameter `pkt->buf->length` 300. } 301. 302. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) 303. { 304. unsigned char *dest; ssl/statem/statem_clnt.c:795:17: Call 793. sess_id_len = s->session->session_id_length; 794. if (sess_id_len > sizeof(s->session->session_id) 795. || !WPACKET_start_sub_packet_u8(pkt) ^ 796. || (sess_id_len != 0 && !WPACKET_memcpy(pkt, s->session->session_id, 797. sess_id_len)) ssl/packet.c:224:1: Parameter `pkt->written` 222. } 223. 224. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 225. { 226. WPACKET_SUB *sub; ssl/packet.c:248:10: Call 246. } 247. 248. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 249. return 0; 250. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */ ssl/packet.c:15:1: Parameter `pkt->written` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ssl/packet.c:17:10: Call 15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ^ 18. return 0; 19. ssl/packet.c:36:1: <LHS trace> 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: Parameter `pkt->buf->length` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: <RHS trace> 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: Parameter `len` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:46:9: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 36]):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/6438632420cee9821409221ef6717edc5ee408c1/ssl/packet.c/#L46
d2a_code_trace_data_43540
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) { bn_check_top(b); if (a == b) return a; if (bn_wexpand(a, b->top) == NULL) return NULL; if (b->top > 0) memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); a->neg = b->neg; a->top = b->top; a->flags |= b->flags & BN_FLG_FIXED_TOP; bn_check_top(a); return a; } ssl/tls_srp.c:259: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `SRP_Calc_server_key`. Showing all 28 steps of the trace ssl/tls_srp.c:249:1: Parameter `s->srp_ctx.N->top` 247. } 248. 249. > int srp_generate_server_master_secret(SSL *s) 250. { 251. BIGNUM *K = NULL, *u = NULL; ssl/tls_srp.c:255:10: Call 253. unsigned char *tmp = NULL; 254. 255. if (!SRP_Verify_A_mod_N(s->srp_ctx.A, s->srp_ctx.N)) ^ 256. goto err; 257. if ((u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) == NULL) crypto/srp/srp_lib.c:239:1: Parameter `N->top` 237. } 238. 239. > int SRP_Verify_A_mod_N(const BIGNUM *A, const BIGNUM *N) 240. { 241. /* Checks if A % N == 0 */ crypto/srp/srp_lib.c:242:12: Call 240. { 241. /* Checks if A % N == 0 */ 242. return SRP_Verify_B_mod_N(A, N); ^ 243. } 244. crypto/srp/srp_lib.c:218:1: Parameter `N->top` 216. } 217. 218. > int SRP_Verify_B_mod_N(const BIGNUM *B, const BIGNUM *N) 219. { 220. BIGNUM *r; ssl/tls_srp.c:257:14: Call 255. if (!SRP_Verify_A_mod_N(s->srp_ctx.A, s->srp_ctx.N)) 256. goto err; 257. if ((u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) == NULL) ^ 258. goto err; 259. if ((K = SRP_Calc_server_key(s->srp_ctx.A, s->srp_ctx.v, u, s->srp_ctx.b, crypto/srp/srp_lib.c:52:1: Parameter `N->top` 50. } 51. 52. > BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N) 53. { 54. /* u = SHA1(PAD(A) || PAD(B) ) -- tls-srp RFC 5054 */ crypto/srp/srp_lib.c:55:12: Call 53. { 54. /* u = SHA1(PAD(A) || PAD(B) ) -- tls-srp RFC 5054 */ 55. return srp_Calc_xy(A, B, N); ^ 56. } 57. crypto/srp/srp_lib.c:23:1: Parameter `N->top` 21. /* calculate = SHA1(PAD(x) || PAD(y)) */ 22. 23. > static BIGNUM *srp_Calc_xy(const BIGNUM *x, const BIGNUM *y, const BIGNUM *N) 24. { 25. unsigned char digest[SHA_DIGEST_LENGTH]; crypto/srp/srp_lib.c:27:16: Call 25. unsigned char digest[SHA_DIGEST_LENGTH]; 26. unsigned char *tmp = NULL; 27. int numN = BN_num_bytes(N); ^ 28. BIGNUM *res = NULL; 29. crypto/bn/bn_lib.c:140:9: Call 138. bn_check_top(a); 139. 140. if (BN_is_zero(a)) ^ 141. return 0; 142. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); crypto/bn/bn_lib.c:843:1: Parameter `a->top` 841. } 842. 843. > int BN_is_zero(const BIGNUM *a) 844. { 845. return a->top == 0; ssl/tls_srp.c:259:14: Call 257. if ((u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) == NULL) 258. goto err; 259. if ((K = SRP_Calc_server_key(s->srp_ctx.A, s->srp_ctx.v, u, s->srp_ctx.b, ^ 260. s->srp_ctx.N)) == NULL) 261. goto err; crypto/srp/srp_lib.c:58:1: Parameter `N->top` 56. } 57. 58. > BIGNUM *SRP_Calc_server_key(const BIGNUM *A, const BIGNUM *v, const BIGNUM *u, 59. const BIGNUM *b, const BIGNUM *N) 60. { crypto/srp/srp_lib.c:72:10: Call 70. /* S = (A*v**u) ** b */ 71. 72. if (!BN_mod_exp(tmp, v, u, N, bn_ctx)) ^ 73. goto err; 74. if (!BN_mod_mul(tmp, A, tmp, N, bn_ctx)) crypto/bn/bn_exp.c:89:1: Parameter `m->top` 87. } 88. 89. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 90. BN_CTX *ctx) 91. { crypto/bn/bn_exp.c:134:9: Call 132. 133. #ifdef MONT_MUL_MOD 134. if (BN_is_odd(m)) { ^ 135. # ifdef MONT_EXP_WORD 136. if (a->top == 1 && !a->neg crypto/bn/bn_lib.c:858:1: Parameter `a->top` 856. } 857. 858. > int BN_is_odd(const BIGNUM *a) 859. { 860. return (a->top > 0) && (a->d[0] & 1); crypto/bn/bn_exp.c:149:15: Call 147. #ifdef RECP_MUL_MOD 148. { 149. ret = BN_mod_exp_recp(r, a, p, m, ctx); ^ 150. } 151. #else crypto/bn/bn_exp.c:161:1: Parameter `m->top` 159. } 160. 161. > int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 162. const BIGNUM *m, BN_CTX *ctx) 163. { crypto/bn/bn_exp.c:200:14: Call 198. if (m->neg) { 199. /* ignore sign of 'm' */ 200. if (!BN_copy(aa, m)) ^ 201. goto err; 202. aa->neg = 0; crypto/bn/bn_lib.c:281:1: <Offset trace> 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:281:1: Parameter `b->top` 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:281:1: <Length trace> 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:281:1: Parameter `*a->d` 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:287:9: Call 285. if (a == b) 286. return a; 287. if (bn_wexpand(a, b->top) == NULL) ^ 288. return NULL; 289. crypto/bn/bn_lib.c: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:291:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `SRP_Calc_server_key` 289. 290. if (b->top > 0) 291. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); ^ 292. 293. a->neg = b->neg;
https://github.com/openssl/openssl/blob/ea09abc80892920ee5db4de82bed7a193b5896f0/crypto/bn/bn_lib.c/#L291
d2a_code_trace_data_43541
int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len) { register UCHAR *p; if (len == 0) return 1; p=c->data; if (c->num != 0) { if ((c->num+len) >= MD2_BLOCK) { memcpy(&(p[c->num]),data,MD2_BLOCK-c->num); md2_block(c,c->data); data+=(MD2_BLOCK - c->num); len-=(MD2_BLOCK - c->num); c->num=0; } else { memcpy(&(p[c->num]),data,(int)len); c->num+=(int)len; return 1; } } while (len >= MD2_BLOCK) { md2_block(c,data); data+=MD2_BLOCK; len-=MD2_BLOCK; } memcpy(p,data,(int)len); c->num=(int)len; return 1; } crypto/md2/md2_dgst.c:147: error: BUFFER_OVERRUN_S2 Offset added: [max(1, `len`), `len`] Size: [0, +oo]. Showing all 5 steps of the trace crypto/md2/md2_dgst.c:127:1: <Offset trace> 125. } 126. 127. > int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len) 128. { 129. register UCHAR *p; crypto/md2/md2_dgst.c:127:1: Parameter `len` 125. } 126. 127. > int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len) 128. { 129. register UCHAR *p; crypto/md2/md2_dgst.c:127:1: <Length trace> 125. } 126. 127. > int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len) 128. { 129. register UCHAR *p; crypto/md2/md2_dgst.c:127:1: Parameter `c->data[*]` 125. } 126. 127. > int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len) 128. { 129. register UCHAR *p; crypto/md2/md2_dgst.c:147:4: Array access: Offset added: [max(1, len), len] Size: [0, +oo] 145. else 146. { 147. memcpy(&(p[c->num]),data,(int)len); ^ 148. /* data+=len; */ 149. c->num+=(int)len;
https://github.com/openssl/openssl/blob/ed5538dc2bf723388aba3aea332bf554c514dcfe/crypto/md2/md2_dgst.c/#L147
d2a_code_trace_data_43542
void CRYPTO_free(void *str, const char *file, int line) { if (free_impl != NULL && free_impl != &CRYPTO_free) { free_impl(str, file, line); return; } #ifndef OPENSSL_NO_CRYPTO_MDEBUG if (call_malloc_debug) { CRYPTO_mem_debug_free(str, 0, file, line); free(str); CRYPTO_mem_debug_free(str, 1, file, line); } else { free(str); } #else free(str); #endif } test/ssltest_old.c:2915: error: USE_AFTER_FREE call to `CRYPTO_free()` eventually accesses memory that was invalidated by call to `free()` on line 2914 indirectly during the call to `CRYPTO_free()`. Showing all 18 steps of the trace test/ssltest_old.c:2649:14: invalidation part of the trace starts here 2647. int err_in_server = 0; 2648. 2649. bufsiz = count > 40 * 1024 ? 40 * 1024 : count; ^ 2650. 2651. if ((cbuf = OPENSSL_zalloc(bufsiz)) == NULL) test/ssltest_old.c:2649:14: assigned 2647. int err_in_server = 0; 2648. 2649. bufsiz = count > 40 * 1024 ? 40 * 1024 : count; ^ 2650. 2651. if ((cbuf = OPENSSL_zalloc(bufsiz)) == NULL) test/ssltest_old.c:2649:5: assigned 2647. int err_in_server = 0; 2648. 2649. bufsiz = count > 40 * 1024 ? 40 * 1024 : count; ^ 2650. 2651. if ((cbuf = OPENSSL_zalloc(bufsiz)) == NULL) test/ssltest_old.c:2651:17: passed as argument to `CRYPTO_zalloc` 2649. bufsiz = count > 40 * 1024 ? 40 * 1024 : count; 2650. 2651. if ((cbuf = OPENSSL_zalloc(bufsiz)) == NULL) ^ 2652. goto err; 2653. if ((sbuf = OPENSSL_zalloc(bufsiz)) == NULL) test/ssltest_old.c:2651:17: return from call to `CRYPTO_zalloc` 2649. bufsiz = count > 40 * 1024 ? 40 * 1024 : count; 2650. 2651. if ((cbuf = OPENSSL_zalloc(bufsiz)) == NULL) ^ 2652. goto err; 2653. if ((sbuf = OPENSSL_zalloc(bufsiz)) == NULL) test/ssltest_old.c:2651:10: assigned 2649. bufsiz = count > 40 * 1024 ? 40 * 1024 : count; 2650. 2651. if ((cbuf = OPENSSL_zalloc(bufsiz)) == NULL) ^ 2652. goto err; 2653. if ((sbuf = OPENSSL_zalloc(bufsiz)) == NULL) test/ssltest_old.c:2914:5: when calling `CRYPTO_free` here 2912. BIO_free_all(c_bio); 2913. BIO_free_all(s_bio); 2914. OPENSSL_free(cbuf); ^ 2915. OPENSSL_free(sbuf); 2916. crypto/mem.c:163:1: parameter `str` of CRYPTO_free 161. } 162. 163. > void CRYPTO_free(void *str, const char *file, int line) 164. { 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { crypto/mem.c:179:5: was invalidated by call to `free()` 177. } 178. #else 179. free(str); ^ 180. #endif 181. } test/ssltest_old.c:2649:14: use-after-lifetime part of the trace starts here 2647. int err_in_server = 0; 2648. 2649. bufsiz = count > 40 * 1024 ? 40 * 1024 : count; ^ 2650. 2651. if ((cbuf = OPENSSL_zalloc(bufsiz)) == NULL) test/ssltest_old.c:2649:14: assigned 2647. int err_in_server = 0; 2648. 2649. bufsiz = count > 40 * 1024 ? 40 * 1024 : count; ^ 2650. 2651. if ((cbuf = OPENSSL_zalloc(bufsiz)) == NULL) test/ssltest_old.c:2649:5: assigned 2647. int err_in_server = 0; 2648. 2649. bufsiz = count > 40 * 1024 ? 40 * 1024 : count; ^ 2650. 2651. if ((cbuf = OPENSSL_zalloc(bufsiz)) == NULL) test/ssltest_old.c:2653:17: passed as argument to `CRYPTO_zalloc` 2651. if ((cbuf = OPENSSL_zalloc(bufsiz)) == NULL) 2652. goto err; 2653. if ((sbuf = OPENSSL_zalloc(bufsiz)) == NULL) ^ 2654. goto err; 2655. test/ssltest_old.c:2653:17: return from call to `CRYPTO_zalloc` 2651. if ((cbuf = OPENSSL_zalloc(bufsiz)) == NULL) 2652. goto err; 2653. if ((sbuf = OPENSSL_zalloc(bufsiz)) == NULL) ^ 2654. goto err; 2655. test/ssltest_old.c:2653:10: assigned 2651. if ((cbuf = OPENSSL_zalloc(bufsiz)) == NULL) 2652. goto err; 2653. if ((sbuf = OPENSSL_zalloc(bufsiz)) == NULL) ^ 2654. goto err; 2655. test/ssltest_old.c:2915:5: when calling `CRYPTO_free` here 2913. BIO_free_all(s_bio); 2914. OPENSSL_free(cbuf); 2915. OPENSSL_free(sbuf); ^ 2916. 2917. if (should_negotiate != NULL && strcmp(should_negotiate, "fail-client") == 0) crypto/mem.c:163:1: parameter `str` of CRYPTO_free 161. } 162. 163. > void CRYPTO_free(void *str, const char *file, int line) 164. { 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { crypto/mem.c:179:5: invalid access occurs here 177. } 178. #else 179. free(str); ^ 180. #endif 181. }
https://github.com/openssl/openssl/blob/f61c5ca6ca183bf0a51651857e3efb02a98889ad/crypto/mem.c/#L179
d2a_code_trace_data_43543
int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; if (pkt->buf->length > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = (pkt->buf->length == 0) ? DEFAULT_BUF_SIZE : pkt->buf->length * 2; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; pkt->written += len; pkt->curr += len; return 1; } ssl/s3_lib.c:2802: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 4]):unsigned64 by call to `WPACKET_start_sub_packet_len__`. Showing all 10 steps of the trace ssl/s3_lib.c:2801:10: Call 2799. { 2800. /* Set the content type and 3 bytes for the message len */ 2801. if (!WPACKET_put_bytes_u8(pkt, htype) ^ 2802. || !WPACKET_start_sub_packet_u24(pkt)) 2803. return 0; ssl/packet.c:238:1: Parameter `pkt->buf->length` 236. } 237. 238. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 239. { 240. unsigned char *data; ssl/s3_lib.c:2802:17: Call 2800. /* Set the content type and 3 bytes for the message len */ 2801. if (!WPACKET_put_bytes_u8(pkt, htype) 2802. || !WPACKET_start_sub_packet_u24(pkt)) ^ 2803. return 0; 2804. ssl/packet.c:201:1: Parameter `pkt->written` 199. } 200. 201. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 202. { 203. WPACKET_SUB *sub; ssl/packet.c:225:10: Call 223. } 224. 225. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 226. return 0; 227. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */ ssl/packet.c:15:1: <LHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `pkt->buf->length` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: <RHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `len` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:25:9: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 4]):unsigned64 by call to `WPACKET_start_sub_packet_len__` 23. return 0; 24. 25. if (pkt->buf->length - pkt->written < len) { ^ 26. size_t newlen; 27.
https://github.com/openssl/openssl/blob/84d5549e692e63a16fa1b11603e4098fc31746e9/ssl/packet.c/#L25
d2a_code_trace_data_43544
static int smka_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { AVFrame *frame = data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; GetBitContext gb; HuffContext h[4] = { { 0 } }; VLC vlc[4] = { { 0 } }; int16_t *samples; uint8_t *samples8; int val; int i, res, ret; int unp_size; int bits, stereo; int pred[2] = {0, 0}; if (buf_size <= 4) { av_log(avctx, AV_LOG_ERROR, "packet is too small\n"); return AVERROR(EINVAL); } unp_size = AV_RL32(buf); init_get_bits(&gb, buf + 4, (buf_size - 4) * 8); if(!get_bits1(&gb)){ av_log(avctx, AV_LOG_INFO, "Sound: no data\n"); *got_frame_ptr = 0; return 1; } stereo = get_bits1(&gb); bits = get_bits1(&gb); if (stereo ^ (avctx->channels != 1)) { av_log(avctx, AV_LOG_ERROR, "channels mismatch\n"); return AVERROR(EINVAL); } if (bits && avctx->sample_fmt == AV_SAMPLE_FMT_U8) { av_log(avctx, AV_LOG_ERROR, "sample format mismatch\n"); return AVERROR(EINVAL); } frame->nb_samples = unp_size / (avctx->channels * (bits + 1)); if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } samples = (int16_t *)frame->data[0]; samples8 = frame->data[0]; for(i = 0; i < (1 << (bits + stereo)); i++) { h[i].length = 256; h[i].maxlength = 0; h[i].current = 0; h[i].bits = av_mallocz(256 * 4); h[i].lengths = av_mallocz(256 * sizeof(int)); h[i].values = av_mallocz(256 * sizeof(int)); if (!h[i].bits || !h[i].lengths || !h[i].values) { ret = AVERROR(ENOMEM); goto error; } skip_bits1(&gb); if (smacker_decode_tree(&gb, &h[i], 0, 0) < 0) { ret = AVERROR_INVALIDDATA; goto error; } skip_bits1(&gb); if(h[i].current > 1) { res = init_vlc(&vlc[i], SMKTREE_BITS, h[i].length, h[i].lengths, sizeof(int), sizeof(int), h[i].bits, sizeof(uint32_t), sizeof(uint32_t), INIT_VLC_LE); if(res < 0) { av_log(avctx, AV_LOG_ERROR, "Cannot build VLC table\n"); ret = AVERROR_INVALIDDATA; goto error; } } } if(bits) { for(i = stereo; i >= 0; i--) pred[i] = sign_extend(av_bswap16(get_bits(&gb, 16)), 16); for(i = 0; i <= stereo; i++) *samples++ = pred[i]; for(; i < unp_size / 2; i++) { if(i & stereo) { if(vlc[2].table) res = get_vlc2(&gb, vlc[2].table, SMKTREE_BITS, 3); else res = 0; val = h[2].values[res]; if(vlc[3].table) res = get_vlc2(&gb, vlc[3].table, SMKTREE_BITS, 3); else res = 0; val |= h[3].values[res] << 8; pred[1] += sign_extend(val, 16); *samples++ = pred[1]; } else { if(vlc[0].table) res = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3); else res = 0; val = h[0].values[res]; if(vlc[1].table) res = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3); else res = 0; val |= h[1].values[res] << 8; pred[0] += sign_extend(val, 16); *samples++ = pred[0]; } } } else { for(i = stereo; i >= 0; i--) pred[i] = get_bits(&gb, 8); for(i = 0; i <= stereo; i++) *samples8++ = pred[i]; for(; i < unp_size; i++) { if(i & stereo){ if(vlc[1].table) res = get_vlc2(&gb, vlc[1].table, SMKTREE_BITS, 3); else res = 0; pred[1] += sign_extend(h[1].values[res], 8); *samples8++ = pred[1]; } else { if(vlc[0].table) res = get_vlc2(&gb, vlc[0].table, SMKTREE_BITS, 3); else res = 0; pred[0] += sign_extend(h[0].values[res], 8); *samples8++ = pred[0]; } } } *got_frame_ptr = 1; ret = buf_size; error: for(i = 0; i < 4; i++) { if(vlc[i].table) ff_free_vlc(&vlc[i]); av_free(h[i].bits); av_free(h[i].lengths); av_free(h[i].values); } return ret; } libavcodec/smacker.c:629: error: Null Dereference pointer `&gb->buffer` last assigned on line 627 could be null and is dereferenced by call to `get_bits1()` at line 629, column 9. libavcodec/smacker.c:603:1: start of procedure smka_decode_frame() 601. * Decode Smacker audio data 602. */ 603. static int smka_decode_frame(AVCodecContext *avctx, void *data, ^ 604. int *got_frame_ptr, AVPacket *avpkt) 605. { libavcodec/smacker.c:606:5: 604. int *got_frame_ptr, AVPacket *avpkt) 605. { 606. AVFrame *frame = data; ^ 607. const uint8_t *buf = avpkt->data; 608. int buf_size = avpkt->size; libavcodec/smacker.c:607:5: 605. { 606. AVFrame *frame = data; 607. const uint8_t *buf = avpkt->data; ^ 608. int buf_size = avpkt->size; 609. GetBitContext gb; libavcodec/smacker.c:608:5: 606. AVFrame *frame = data; 607. const uint8_t *buf = avpkt->data; 608. int buf_size = avpkt->size; ^ 609. GetBitContext gb; 610. HuffContext h[4] = { { 0 } }; libavcodec/smacker.c:610:5: 608. int buf_size = avpkt->size; 609. GetBitContext gb; 610. HuffContext h[4] = { { 0 } }; ^ 611. VLC vlc[4] = { { 0 } }; 612. int16_t *samples; libavcodec/smacker.c:611:5: 609. GetBitContext gb; 610. HuffContext h[4] = { { 0 } }; 611. VLC vlc[4] = { { 0 } }; ^ 612. int16_t *samples; 613. uint8_t *samples8; libavcodec/smacker.c:618:5: 616. int unp_size; 617. int bits, stereo; 618. int pred[2] = {0, 0}; ^ 619. 620. if (buf_size <= 4) { libavcodec/smacker.c:620:9: Taking false branch 618. int pred[2] = {0, 0}; 619. 620. if (buf_size <= 4) { ^ 621. av_log(avctx, AV_LOG_ERROR, "packet is too small\n"); 622. return AVERROR(EINVAL); libavcodec/smacker.c:625:5: 623. } 624. 625. unp_size = AV_RL32(buf); ^ 626. 627. init_get_bits(&gb, buf + 4, (buf_size - 4) * 8); libavcodec/smacker.c:627:5: 625. unp_size = AV_RL32(buf); 626. 627. init_get_bits(&gb, buf + 4, (buf_size - 4) * 8); ^ 628. 629. if(!get_bits1(&gb)){ 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/smacker.c:629:9: 627. init_get_bits(&gb, buf + 4, (buf_size - 4) * 8); 628. 629. if(!get_bits1(&gb)){ ^ 630. av_log(avctx, AV_LOG_INFO, "Sound: no data\n"); 631. *got_frame_ptr = 0; 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/smacker.c/#L629
d2a_code_trace_data_43545
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:434: 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:412:9: Call 410. 411. /* make data into a big number */ 412. if (BN_bin2bn(from, (int)flen, f) == NULL) ^ 413. goto err; 414. 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:434:14: Call 432. goto err; 433. } 434. if (!rsa_blinding_convert(blinding, f, unblind, ctx)) ^ 435. goto err; 436. } 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_43546
static int do_blob_header(const unsigned char **in, unsigned int length, unsigned int *pmagic, unsigned int *pbitlen, int *pisdss, int *pispub) { const unsigned char *p = *in; if (length < 16) return 0; if (*p == MS_PUBLICKEYBLOB) { if (*pispub == 0) { PEMerr(PEM_F_DO_BLOB_HEADER, PEM_R_EXPECTING_PRIVATE_KEY_BLOB); return 0; } *pispub = 1; } else if (*p == MS_PRIVATEKEYBLOB) { if (*pispub == 1) { PEMerr(PEM_F_DO_BLOB_HEADER, PEM_R_EXPECTING_PUBLIC_KEY_BLOB); return 0; } *pispub = 0; } else return 0; p++; if (*p++ != 0x2) { PEMerr(PEM_F_DO_BLOB_HEADER, PEM_R_BAD_VERSION_NUMBER); return 0; } p += 6; *pmagic = read_ledword(&p); *pbitlen = read_ledword(&p); *pisdss = 0; switch (*pmagic) { case MS_DSS1MAGIC: *pisdss = 1; case MS_RSA1MAGIC: if (*pispub == 0) { PEMerr(PEM_F_DO_BLOB_HEADER, PEM_R_EXPECTING_PRIVATE_KEY_BLOB); return 0; } break; case MS_DSS2MAGIC: *pisdss = 1; case MS_RSA2MAGIC: if (*pispub == 1) { PEMerr(PEM_F_DO_BLOB_HEADER, PEM_R_EXPECTING_PUBLIC_KEY_BLOB); return 0; } break; default: PEMerr(PEM_F_DO_BLOB_HEADER, PEM_R_BAD_MAGIC_NUMBER); return -1; } *in = p; return 1; } crypto/pem/pvkfmt.c:766: error: BUFFER_OVERRUN_L3 Offset: 1 Size: [0, +oo] by call to `do_PVK_body`. Showing all 21 steps of the trace crypto/pem/pvkfmt.c:753:10: Call 751. p = pvk_hdr; 752. 753. if (!do_PVK_header(&p, 24, 0, &saltlen, &keylen)) ^ 754. return 0; 755. buflen = (int)keylen + saltlen; crypto/pem/pvkfmt.c:609:1: Parameter `*pkeylen` 607. # ifndef OPENSSL_NO_RC4 608. 609. > static int do_PVK_header(const unsigned char **in, unsigned int length, 610. int skip_magic, 611. unsigned int *psaltlen, unsigned int *pkeylen) crypto/pem/pvkfmt.c:755:5: Assignment 753. if (!do_PVK_header(&p, 24, 0, &saltlen, &keylen)) 754. return 0; 755. buflen = (int)keylen + saltlen; ^ 756. buf = OPENSSL_malloc(buflen); 757. if (buf == NULL) { crypto/pem/pvkfmt.c:756:11: Call 754. return 0; 755. buflen = (int)keylen + saltlen; 756. buf = OPENSSL_malloc(buflen); ^ 757. if (buf == NULL) { 758. PEMerr(PEM_F_B2I_PVK_BIO, ERR_R_MALLOC_FAILURE); crypto/mem.c:125:9: Assignment 123. 124. if (num <= 0) 125. return NULL; ^ 126. 127. allow_customize = 0; crypto/pem/pvkfmt.c:756:5: Assignment 754. return 0; 755. buflen = (int)keylen + saltlen; 756. buf = OPENSSL_malloc(buflen); ^ 757. if (buf == NULL) { 758. PEMerr(PEM_F_B2I_PVK_BIO, ERR_R_MALLOC_FAILURE); crypto/pem/pvkfmt.c:761:5: Assignment 759. return 0; 760. } 761. p = buf; ^ 762. if (BIO_read(in, buf, buflen) != buflen) { 763. PEMerr(PEM_F_B2I_PVK_BIO, PEM_R_PVK_DATA_TOO_SHORT); crypto/pem/pvkfmt.c:766:11: Call 764. goto err; 765. } 766. ret = do_PVK_body(&p, saltlen, keylen, cb, u); ^ 767. 768. err: crypto/pem/pvkfmt.c:666:1: Parameter `**in` 664. } 665. 666. > static EVP_PKEY *do_PVK_body(const unsigned char **in, 667. unsigned int saltlen, unsigned int keylen, 668. pem_password_cb *cb, void *u) crypto/pem/pvkfmt.c:671:5: Assignment 669. { 670. EVP_PKEY *ret = NULL; 671. const unsigned char *p = *in; ^ 672. unsigned int magic; 673. unsigned char *enctmp = NULL, *q; crypto/pem/pvkfmt.c:733:11: Call 731. } 732. 733. ret = b2i_PrivateKey(&p, keylen); ^ 734. err: 735. EVP_CIPHER_CTX_free(cctx); crypto/pem/pvkfmt.c:388:1: Parameter `**in` 386. } 387. 388. > EVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length) 389. { 390. return do_b2i(in, length, 0); crypto/pem/pvkfmt.c:390:12: Call 388. EVP_PKEY *b2i_PrivateKey(const unsigned char **in, long length) 389. { 390. return do_b2i(in, length, 0); ^ 391. } 392. crypto/pem/pvkfmt.c:234:1: Parameter `**in` 232. } 233. 234. > static EVP_PKEY *do_b2i(const unsigned char **in, unsigned int length, 235. int ispub) 236. { crypto/pem/pvkfmt.c:237:5: Assignment 235. int ispub) 236. { 237. const unsigned char *p = *in; ^ 238. unsigned int bitlen, magic; 239. int isdss; crypto/pem/pvkfmt.c:240:9: Call 238. unsigned int bitlen, magic; 239. int isdss; 240. if (do_blob_header(&p, length, &magic, &bitlen, &isdss, &ispub) <= 0) { ^ 241. PEMerr(PEM_F_DO_B2I, PEM_R_KEYBLOB_HEADER_PARSE_ERROR); 242. return NULL; crypto/pem/pvkfmt.c:140:1: <Length trace> 138. unsigned int bitlen, int ispub); 139. 140. > static int do_blob_header(const unsigned char **in, unsigned int length, 141. unsigned int *pmagic, unsigned int *pbitlen, 142. int *pisdss, int *pispub) crypto/pem/pvkfmt.c:140:1: Parameter `**in` 138. unsigned int bitlen, int ispub); 139. 140. > static int do_blob_header(const unsigned char **in, unsigned int length, 141. unsigned int *pmagic, unsigned int *pbitlen, 142. int *pisdss, int *pispub) crypto/pem/pvkfmt.c:144:5: Assignment 142. int *pisdss, int *pispub) 143. { 144. const unsigned char *p = *in; ^ 145. if (length < 16) 146. return 0; crypto/pem/pvkfmt.c:162:5: Assignment 160. } else 161. return 0; 162. p++; ^ 163. /* Version */ 164. if (*p++ != 0x2) { crypto/pem/pvkfmt.c:164:9: Array access: Offset: 1 Size: [0, +oo] by call to `do_PVK_body` 162. p++; 163. /* Version */ 164. if (*p++ != 0x2) { ^ 165. PEMerr(PEM_F_DO_BLOB_HEADER, PEM_R_BAD_VERSION_NUMBER); 166. return 0;
https://github.com/openssl/openssl/blob/846ec07d904f9cc81d486db0db14fb84f61ff6e5/crypto/pem/pvkfmt.c/#L164
d2a_code_trace_data_43547
int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) { long l; int ret = 0, i; char *m = NULL, mlch = ' '; int nmindent = 0; ASN1_INTEGER *bs; EVP_PKEY *pkey = NULL; const char *neg; if ((nmflags & XN_FLAG_SEP_MASK) == XN_FLAG_SEP_MULTILINE) { mlch = '\n'; nmindent = 12; } if (nmflags == X509_FLAG_COMPAT) nmindent = 16; if (!(cflag & X509_FLAG_NO_HEADER)) { if (BIO_write(bp, "Certificate:\n", 13) <= 0) goto err; if (BIO_write(bp, " Data:\n", 10) <= 0) goto err; } if (!(cflag & X509_FLAG_NO_VERSION)) { l = X509_get_version(x); if (BIO_printf(bp, "%8sVersion: %lu (0x%lx)\n", "", l + 1, l) <= 0) goto err; } if (!(cflag & X509_FLAG_NO_SERIAL)) { if (BIO_write(bp, " Serial Number:", 22) <= 0) goto err; bs = X509_get_serialNumber(x); if (bs->length <= (int)sizeof(long)) { ERR_set_mark(); l = ASN1_INTEGER_get(bs); ERR_pop_to_mark(); } else { l = -1; } if (l != -1) { if (bs->type == V_ASN1_NEG_INTEGER) { l = -l; neg = "-"; } else neg = ""; if (BIO_printf(bp, " %s%lu (%s0x%lx)\n", neg, l, neg, l) <= 0) goto err; } else { neg = (bs->type == V_ASN1_NEG_INTEGER) ? " (Negative)" : ""; if (BIO_printf(bp, "\n%12s%s", "", neg) <= 0) goto err; for (i = 0; i < bs->length; i++) { if (BIO_printf(bp, "%02x%c", bs->data[i], ((i + 1 == bs->length) ? '\n' : ':')) <= 0) goto err; } } } if (!(cflag & X509_FLAG_NO_SIGNAME)) { X509_ALGOR *tsig_alg = X509_get0_tbs_sigalg(x); if (X509_signature_print(bp, tsig_alg, NULL) <= 0) goto err; } if (!(cflag & X509_FLAG_NO_ISSUER)) { if (BIO_printf(bp, " Issuer:%c", mlch) <= 0) goto err; if (X509_NAME_print_ex(bp, X509_get_issuer_name(x), nmindent, nmflags) < 0) goto err; if (BIO_write(bp, "\n", 1) <= 0) goto err; } if (!(cflag & X509_FLAG_NO_VALIDITY)) { if (BIO_write(bp, " Validity\n", 17) <= 0) goto err; if (BIO_write(bp, " Not Before: ", 24) <= 0) goto err; if (!ASN1_TIME_print(bp, X509_get_notBefore(x))) goto err; if (BIO_write(bp, "\n Not After : ", 25) <= 0) goto err; if (!ASN1_TIME_print(bp, X509_get_notAfter(x))) goto err; if (BIO_write(bp, "\n", 1) <= 0) goto err; } if (!(cflag & X509_FLAG_NO_SUBJECT)) { if (BIO_printf(bp, " Subject:%c", mlch) <= 0) goto err; if (X509_NAME_print_ex (bp, X509_get_subject_name(x), nmindent, nmflags) < 0) goto err; if (BIO_write(bp, "\n", 1) <= 0) goto err; } if (!(cflag & X509_FLAG_NO_PUBKEY)) { X509_PUBKEY *xpkey = X509_get_X509_PUBKEY(x); ASN1_OBJECT *xpoid; X509_PUBKEY_get0_param(&xpoid, NULL, NULL, NULL, xpkey); if (BIO_write(bp, " Subject Public Key Info:\n", 33) <= 0) goto err; if (BIO_printf(bp, "%12sPublic Key Algorithm: ", "") <= 0) goto err; if (i2a_ASN1_OBJECT(bp, xpoid) <= 0) goto err; if (BIO_puts(bp, "\n") <= 0) goto err; pkey = X509_get0_pubkey(x); if (pkey == NULL) { BIO_printf(bp, "%12sUnable to load Public Key\n", ""); ERR_print_errors(bp); } else { EVP_PKEY_print_public(bp, pkey, 16, NULL); } } if (!(cflag & X509_FLAG_NO_IDS)) { ASN1_BIT_STRING *iuid, *suid; X509_get0_uids(&iuid, &suid, x); if (iuid != NULL) { if (BIO_printf(bp, "%8sIssuer Unique ID: ", "") <= 0) goto err; if (!X509_signature_dump(bp, iuid, 12)) goto err; } if (suid != NULL) { if (BIO_printf(bp, "%8sSubject Unique ID: ", "") <= 0) goto err; if (!X509_signature_dump(bp, suid, 12)) goto err; } } if (!(cflag & X509_FLAG_NO_EXTENSIONS)) X509V3_extensions_print(bp, "X509v3 extensions", X509_get0_extensions(x), cflag, 8); if (!(cflag & X509_FLAG_NO_SIGDUMP)) { X509_ALGOR *sig_alg; ASN1_BIT_STRING *sig; X509_get0_signature(&sig, &sig_alg, x); if (X509_signature_print(bp, sig_alg, sig) <= 0) goto err; } if (!(cflag & X509_FLAG_NO_AUX)) { if (!X509_aux_print(bp, x, 0)) goto err; } ret = 1; err: OPENSSL_free(m); return (ret); } crypto/x509/t_x509.c:74: error: INTEGER_OVERFLOW_L2 ([-9223372036854775808, 9223372036854775807] + 1):signed64. Showing all 7 steps of the trace crypto/x509/t_x509.c:73:13: <LHS trace> 71. } 72. if (!(cflag & X509_FLAG_NO_VERSION)) { 73. l = X509_get_version(x); ^ 74. if (BIO_printf(bp, "%8sVersion: %lu (0x%lx)\n", "", l + 1, l) <= 0) 75. goto err; crypto/x509/t_x509.c:73:13: Call 71. } 72. if (!(cflag & X509_FLAG_NO_VERSION)) { 73. l = X509_get_version(x); ^ 74. if (BIO_printf(bp, "%8sVersion: %lu (0x%lx)\n", "", l + 1, l) <= 0) 75. goto err; crypto/x509/x509_set.c:115:12: Call 113. long X509_get_version(const X509 *x) 114. { 115. return ASN1_INTEGER_get(x->cert_info.version); ^ 116. } 117. crypto/asn1/a_int.c:564:9: Assignment 562. int64_t r; 563. if (a == NULL) 564. return 0; ^ 565. i = ASN1_INTEGER_get_int64(&r, a); 566. if (i == 0) crypto/x509/x509_set.c:115:5: Assignment 113. long X509_get_version(const X509 *x) 114. { 115. return ASN1_INTEGER_get(x->cert_info.version); ^ 116. } 117. crypto/x509/t_x509.c:73:9: Assignment 71. } 72. if (!(cflag & X509_FLAG_NO_VERSION)) { 73. l = X509_get_version(x); ^ 74. if (BIO_printf(bp, "%8sVersion: %lu (0x%lx)\n", "", l + 1, l) <= 0) 75. goto err; crypto/x509/t_x509.c:74:13: Binary operation: ([-9223372036854775808, 9223372036854775807] + 1):signed64 72. if (!(cflag & X509_FLAG_NO_VERSION)) { 73. l = X509_get_version(x); 74. if (BIO_printf(bp, "%8sVersion: %lu (0x%lx)\n", "", l + 1, l) <= 0) ^ 75. goto err; 76. }
https://github.com/openssl/openssl/blob/e1f02308aeb124168d8a6655e5c822c3b0126260/crypto/x509/t_x509.c/#L74
d2a_code_trace_data_43548
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/ecdsa_ossl.c:243: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `bn_to_mont_fixed_top`. Showing all 25 steps of the trace crypto/ec/ecdsa_ossl.c:212:10: Call 210. if (8 * dgst_len > i) 211. dgst_len = (i + 7) / 8; 212. if (!BN_bin2bn(dgst, dgst_len, m)) { ^ 213. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB); 214. goto err; crypto/bn/bn_lib.c:372:1: Parameter `ret->top` 370. } 371. 372. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) 373. { 374. unsigned int i, m; crypto/ec/ecdsa_ossl.c:243:14: Call 241. * below, returns user-visible value with removed zero padding. 242. */ 243. if (!bn_to_mont_fixed_top(s, ret->r, group->mont_data, ctx) ^ 244. || !bn_mul_mont_fixed_top(s, s, priv_key, group->mont_data, ctx)) { 245. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB); crypto/bn/bn_mont.c:210:1: Parameter `r->top` 208. } 209. 210. > int bn_to_mont_fixed_top(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 211. BN_CTX *ctx) 212. { crypto/bn/bn_mont.c:213:12: Call 211. BN_CTX *ctx) 212. { 213. return bn_mul_mont_fixed_top(r, a, &(mont->RR), mont, ctx); ^ 214. } 215. crypto/bn/bn_mont.c:37:1: Parameter `r->top` 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:75:10: Call 73. /* reduce from aRR to aR */ 74. #ifdef MONT_WORD 75. if (!bn_from_montgomery_word(r, tmp, mont)) ^ 76. goto err; 77. #else crypto/bn/bn_mont.c:88:1: Parameter `ret->top` 86. 87. #ifdef MONT_WORD 88. > static int bn_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont) 89. { 90. BIGNUM *n; crypto/bn/bn_mont.c:131:9: Call 129. } 130. 131. if (bn_wexpand(ret, nl) == NULL) ^ 132. return 0; 133. ret->top = nl; crypto/bn/bn_lib.c:948:1: Parameter `a->top` 946. } 947. 948. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:950:37: Call 948. BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 951. } 952. crypto/bn/bn_lib.c: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_to_mont_fixed_top` 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/4cc968df403ed9321d0df722aba33323ae575ce0/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_43549
static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict) { const char *codec_string = encoder ? "encoder" : "decoder"; AVCodec *codec; if(!name) return CODEC_ID_NONE; codec = encoder ? avcodec_find_encoder_by_name(name) : avcodec_find_decoder_by_name(name); if(!codec) { fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); ffmpeg_exit(1); } if(codec->type != type) { fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name); ffmpeg_exit(1); } if(codec->capabilities & CODEC_CAP_EXPERIMENTAL && strict > FF_COMPLIANCE_EXPERIMENTAL) { fprintf(stderr, "%s '%s' is experimental and might produce bad " "results.\nAdd '-strict experimental' if you want to use it.\n", codec_string, codec->name); codec = encoder ? avcodec_find_encoder(codec->id) : avcodec_find_decoder(codec->id); if (!(codec->capabilities & CODEC_CAP_EXPERIMENTAL)) fprintf(stderr, "Or use the non experimental %s '%s'.\n", codec_string, codec->name); ffmpeg_exit(1); } return codec->id; } ffmpeg.c:3098: error: Null Dereference pointer `codec` last assigned on line 3091 could be null and is dereferenced at line 3098, column 8. ffmpeg.c:3084:1: start of procedure find_codec_or_die() 3082. } 3083. 3084. static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict) ^ 3085. { 3086. const char *codec_string = encoder ? "encoder" : "decoder"; ffmpeg.c:3086:32: Condition is true 3084. static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict) 3085. { 3086. const char *codec_string = encoder ? "encoder" : "decoder"; ^ 3087. AVCodec *codec; 3088. ffmpeg.c:3086:5: 3084. static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict) 3085. { 3086. const char *codec_string = encoder ? "encoder" : "decoder"; ^ 3087. AVCodec *codec; 3088. ffmpeg.c:3089:9: Taking false branch 3087. AVCodec *codec; 3088. 3089. if(!name) ^ 3090. return CODEC_ID_NONE; 3091. codec = encoder ? ffmpeg.c:3091:13: Condition is true 3089. if(!name) 3090. return CODEC_ID_NONE; 3091. codec = encoder ? ^ 3092. avcodec_find_encoder_by_name(name) : 3093. avcodec_find_decoder_by_name(name); ffmpeg.c:3091:5: 3089. if(!name) 3090. return CODEC_ID_NONE; 3091. codec = encoder ? ^ 3092. avcodec_find_encoder_by_name(name) : 3093. avcodec_find_decoder_by_name(name); ffmpeg.c:3094:9: Taking true branch 3092. avcodec_find_encoder_by_name(name) : 3093. avcodec_find_decoder_by_name(name); 3094. if(!codec) { ^ 3095. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); 3096. ffmpeg_exit(1); ffmpeg.c:3095:9: 3093. avcodec_find_decoder_by_name(name); 3094. if(!codec) { 3095. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); ^ 3096. ffmpeg_exit(1); 3097. } ffmpeg.c:3096:9: Skipping ffmpeg_exit(): empty list of specs 3094. if(!codec) { 3095. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); 3096. ffmpeg_exit(1); ^ 3097. } 3098. if(codec->type != type) { ffmpeg.c:3098:8: 3096. ffmpeg_exit(1); 3097. } 3098. if(codec->type != type) { ^ 3099. fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name); 3100. ffmpeg_exit(1);
https://github.com/libav/libav/blob/f4c79d1e0b2e797012304db57903e4091b0c2d7c/ffmpeg.c/#L3098
d2a_code_trace_data_43550
static int sdp_read_header(AVFormatContext *s) { RTSPState *rt = s->priv_data; RTSPStream *rtsp_st; int size, i, err; char *content; char url[1024]; if (!ff_network_init()) return AVERROR(EIO); if (s->max_delay < 0) s->max_delay = DEFAULT_REORDERING_DELAY; content = av_malloc(SDP_MAX_SIZE); size = avio_read(s->pb, content, SDP_MAX_SIZE - 1); if (size <= 0) { av_free(content); return AVERROR_INVALIDDATA; } content[size] ='\0'; err = ff_sdp_parse(s, content); av_free(content); if (err) goto fail; for (i = 0; i < rt->nb_rtsp_streams; i++) { char namebuf[50]; rtsp_st = rt->rtsp_streams[i]; getnameinfo((struct sockaddr*) &rtsp_st->sdp_ip, sizeof(rtsp_st->sdp_ip), namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST); ff_url_join(url, sizeof(url), "rtp", NULL, namebuf, rtsp_st->sdp_port, "?localport=%d&ttl=%d&connect=%d", rtsp_st->sdp_port, rtsp_st->sdp_ttl, rt->rtsp_flags & RTSP_FLAG_FILTER_SRC ? 1 : 0); if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE, &s->interrupt_callback, NULL) < 0) { err = AVERROR_INVALIDDATA; goto fail; } if ((err = ff_rtsp_open_transport_ctx(s, rtsp_st))) goto fail; } return 0; fail: ff_rtsp_close_streams(s); ff_network_close(); return err; } libavformat/rtsp.c:1918: error: Null Dereference pointer `content` last assigned on line 1912 could be null and is dereferenced at line 1918, column 5. libavformat/rtsp.c:1896:1: start of procedure sdp_read_header() 1894. } 1895. 1896. static int sdp_read_header(AVFormatContext *s) ^ 1897. { 1898. RTSPState *rt = s->priv_data; libavformat/rtsp.c:1898:5: 1896. static int sdp_read_header(AVFormatContext *s) 1897. { 1898. RTSPState *rt = s->priv_data; ^ 1899. RTSPStream *rtsp_st; 1900. int size, i, err; libavformat/rtsp.c:1904:10: 1902. char url[1024]; 1903. 1904. if (!ff_network_init()) ^ 1905. return AVERROR(EIO); 1906. libavformat/network.c:124:1: start of procedure ff_network_init() 122. int ff_network_inited_globally; 123. 124. int ff_network_init(void) ^ 125. { 126. #if HAVE_WINSOCK2_H libavformat/network.c:130:10: Taking true branch 128. #endif 129. 130. if (!ff_network_inited_globally) ^ 131. av_log(NULL, AV_LOG_WARNING, "Using network protocols without global " 132. "network initialization. Please use " libavformat/network.c:131:9: Skipping av_log(): empty list of specs 129. 130. if (!ff_network_inited_globally) 131. av_log(NULL, AV_LOG_WARNING, "Using network protocols without global " ^ 132. "network initialization. Please use " 133. "avformat_network_init(), this will " libavformat/network.c:139:5: 137. return 0; 138. #endif 139. return 1; ^ 140. } 141. libavformat/network.c:140:1: return from a call to ff_network_init 138. #endif 139. return 1; 140. } ^ 141. 142. int ff_network_wait_fd(int fd, int write) libavformat/rtsp.c:1904:10: Taking false branch 1902. char url[1024]; 1903. 1904. if (!ff_network_init()) ^ 1905. return AVERROR(EIO); 1906. libavformat/rtsp.c:1907:9: Taking false branch 1905. return AVERROR(EIO); 1906. 1907. if (s->max_delay < 0) /* Not set by the caller */ ^ 1908. s->max_delay = DEFAULT_REORDERING_DELAY; 1909. libavformat/rtsp.c:1912:5: 1910. /* read the whole sdp file */ 1911. /* XXX: better loading */ 1912. content = av_malloc(SDP_MAX_SIZE); ^ 1913. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1); 1914. if (size <= 0) { libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:9: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if (size > (INT_MAX-32) || !size) ^ 73. return NULL; 74. libavutil/mem.c:72:33: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if (size > (INT_MAX-32) || !size) ^ 73. return NULL; 74. libavutil/mem.c:83:9: Taking true branch 81. ((char*)ptr)[-1]= diff; 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,32,size)) ^ 84. ptr = NULL; 85. #elif HAVE_ALIGNED_MALLOC libavutil/mem.c:84:9: 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,32,size)) 84. ptr = NULL; ^ 85. #elif HAVE_ALIGNED_MALLOC 86. ptr = _aligned_malloc(size, 32); libavutil/mem.c:116:5: 114. ptr = malloc(size); 115. #endif 116. return ptr; ^ 117. } 118. libavutil/mem.c:117:1: return from a call to av_malloc 115. #endif 116. return ptr; 117. } ^ 118. 119. void *av_realloc(void *ptr, size_t size) libavformat/rtsp.c:1913:5: Skipping avio_read(): empty list of specs 1911. /* XXX: better loading */ 1912. content = av_malloc(SDP_MAX_SIZE); 1913. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1); ^ 1914. if (size <= 0) { 1915. av_free(content); libavformat/rtsp.c:1914:9: Taking false branch 1912. content = av_malloc(SDP_MAX_SIZE); 1913. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1); 1914. if (size <= 0) { ^ 1915. av_free(content); 1916. return AVERROR_INVALIDDATA; libavformat/rtsp.c:1918:5: 1916. return AVERROR_INVALIDDATA; 1917. } 1918. content[size] ='\0'; ^ 1919. 1920. err = ff_sdp_parse(s, content);
https://github.com/libav/libav/blob/0aa907cfb1bbc647ee4b6da62fac5c89d7b4d318/libavformat/rtsp.c/#L1918
d2a_code_trace_data_43551
int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm) { SSL_COMP *comp; if (cm == NULL || cm->type == NID_undef) return 1; if (id < 193 || id > 255) { SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE); return 0; } MemCheck_off(); comp=(SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP)); comp->id=id; comp->method=cm; load_builtin_compressions(); if (ssl_comp_methods && sk_SSL_COMP_find(ssl_comp_methods,comp) >= 0) { OPENSSL_free(comp); MemCheck_on(); SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,SSL_R_DUPLICATE_COMPRESSION_ID); return(1); } else if ((ssl_comp_methods == NULL) || !sk_SSL_COMP_push(ssl_comp_methods,comp)) { OPENSSL_free(comp); MemCheck_on(); SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,ERR_R_MALLOC_FAILURE); return(1); } else { MemCheck_on(); return(0); } } ssl/ssl_ciph.c:1872: error: NULL_DEREFERENCE pointer `comp` last assigned on line 1871 could be null and is dereferenced at line 1872, column 2. Showing all 44 steps of the trace ssl/ssl_ciph.c:1851:1: start of procedure SSL_COMP_add_compression_method() 1849. } 1850. 1851. > int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm) 1852. { 1853. SSL_COMP *comp; ssl/ssl_ciph.c:1855:13: Taking false branch 1853. SSL_COMP *comp; 1854. 1855. if (cm == NULL || cm->type == NID_undef) ^ 1856. return 1; 1857. ssl/ssl_ciph.c:1855:27: Taking false branch 1853. SSL_COMP *comp; 1854. 1855. if (cm == NULL || cm->type == NID_undef) ^ 1856. return 1; 1857. ssl/ssl_ciph.c:1864:6: Taking false branch 1862. 64 to 192: external party methods assigned by IANA 1863. 193 to 255: reserved for private use */ 1864. if (id < 193 || id > 255) ^ 1865. { 1866. SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE); ssl/ssl_ciph.c:1864:18: Taking false branch 1862. 64 to 192: external party methods assigned by IANA 1863. 193 to 255: reserved for private use */ 1864. if (id < 193 || id > 255) ^ 1865. { 1866. SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE); ssl/ssl_ciph.c:1870:2: 1868. } 1869. 1870. > MemCheck_off(); 1871. comp=(SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP)); 1872. comp->id=id; crypto/mem_dbg.c:216:1: start of procedure CRYPTO_mem_ctrl() 214. } 215. 216. > int CRYPTO_mem_ctrl(int mode) 217. { 218. int ret=mh_mode; crypto/mem_dbg.c:218:2: 216. int CRYPTO_mem_ctrl(int mode) 217. { 218. > int ret=mh_mode; 219. 220. CRYPTO_w_lock(CRYPTO_LOCK_MALLOC); crypto/mem_dbg.c:220:2: 218. int ret=mh_mode; 219. 220. > CRYPTO_w_lock(CRYPTO_LOCK_MALLOC); 221. switch (mode) 222. { crypto/lock.c:426:1: start of procedure CRYPTO_lock() 424. } 425. 426. > void CRYPTO_lock(int mode, int type, const char *file, int line) 427. { 428. #ifdef LOCK_DEBUG crypto/lock.c:453:6: Taking false branch 451. } 452. #endif 453. if (type < 0) ^ 454. { 455. if (dynlock_lock_callback != NULL) crypto/lock.c:468:7: Taking true branch 466. } 467. else 468. if (locking_callback != NULL) ^ 469. locking_callback(mode,type,file,line); 470. } crypto/lock.c:469:4: Skipping __function_pointer__(): unresolved function pointer 467. else 468. if (locking_callback != NULL) 469. locking_callback(mode,type,file,line); ^ 470. } 471. crypto/lock.c:453:2: 451. } 452. #endif 453. > if (type < 0) 454. { 455. if (dynlock_lock_callback != NULL) crypto/lock.c:470:2: return from a call to CRYPTO_lock 468. if (locking_callback != NULL) 469. locking_callback(mode,type,file,line); 470. } ^ 471. 472. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, crypto/mem_dbg.c:221:2: 219. 220. CRYPTO_w_lock(CRYPTO_LOCK_MALLOC); 221. > switch (mode) 222. { 223. /* for applications (not to be called while multiple threads crypto/mem_dbg.c:225:2: Switch condition is false. Skipping switch case 223. /* for applications (not to be called while multiple threads 224. * use the library): */ 225. case CRYPTO_MEM_CHECK_ON: /* aka MemCheck_start() */ ^ 226. mh_mode = CRYPTO_MEM_CHECK_ON|CRYPTO_MEM_CHECK_ENABLE; 227. num_disable = 0; crypto/mem_dbg.c:229:2: Switch condition is false. Skipping switch case 227. num_disable = 0; 228. break; 229. case CRYPTO_MEM_CHECK_OFF: /* aka MemCheck_stop() */ ^ 230. mh_mode = 0; 231. num_disable = 0; /* should be true *before* MemCheck_stop is used, crypto/mem_dbg.c:236:2: Switch condition is true. Entering switch case 234. 235. /* switch off temporarily (for library-internal use): */ 236. case CRYPTO_MEM_CHECK_DISABLE: /* aka MemCheck_off() */ ^ 237. if (mh_mode & CRYPTO_MEM_CHECK_ON) 238. { crypto/mem_dbg.c:237:7: Taking false branch 235. /* switch off temporarily (for library-internal use): */ 236. case CRYPTO_MEM_CHECK_DISABLE: /* aka MemCheck_off() */ 237. if (mh_mode & CRYPTO_MEM_CHECK_ON) ^ 238. { 239. CRYPTO_THREADID cur; crypto/mem_dbg.c:282:2: 280. break; 281. } 282. > CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC); 283. return(ret); 284. } crypto/lock.c:426:1: start of procedure CRYPTO_lock() 424. } 425. 426. > void CRYPTO_lock(int mode, int type, const char *file, int line) 427. { 428. #ifdef LOCK_DEBUG crypto/lock.c:453:6: Taking false branch 451. } 452. #endif 453. if (type < 0) ^ 454. { 455. if (dynlock_lock_callback != NULL) crypto/lock.c:468:7: Taking true branch 466. } 467. else 468. if (locking_callback != NULL) ^ 469. locking_callback(mode,type,file,line); 470. } crypto/lock.c:469:4: Skipping __function_pointer__(): unresolved function pointer 467. else 468. if (locking_callback != NULL) 469. locking_callback(mode,type,file,line); ^ 470. } 471. crypto/lock.c:453:2: 451. } 452. #endif 453. > if (type < 0) 454. { 455. if (dynlock_lock_callback != NULL) crypto/lock.c:470:2: return from a call to CRYPTO_lock 468. if (locking_callback != NULL) 469. locking_callback(mode,type,file,line); 470. } ^ 471. 472. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file, crypto/mem_dbg.c:283:2: 281. } 282. CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC); 283. > return(ret); 284. } 285. crypto/mem_dbg.c:284:2: return from a call to CRYPTO_mem_ctrl 282. CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC); 283. return(ret); 284. } ^ 285. 286. int CRYPTO_is_mem_check_on(void) ssl/ssl_ciph.c:1871:2: 1869. 1870. MemCheck_off(); 1871. > comp=(SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP)); 1872. comp->id=id; 1873. comp->method=cm; crypto/mem.c:295:1: start of procedure CRYPTO_malloc() 293. } 294. 295. > void *CRYPTO_malloc(int num, const char *file, int line) 296. { 297. void *ret = NULL; crypto/mem.c:297:2: 295. void *CRYPTO_malloc(int num, const char *file, int line) 296. { 297. > void *ret = NULL; 298. 299. if (num <= 0) return NULL; crypto/mem.c:299:6: Taking false branch 297. void *ret = NULL; 298. 299. if (num <= 0) return NULL; ^ 300. 301. allow_customize = 0; crypto/mem.c:301:2: 299. if (num <= 0) return NULL; 300. 301. > allow_customize = 0; 302. if (malloc_debug_func != NULL) 303. { crypto/mem.c:302:6: Taking true branch 300. 301. allow_customize = 0; 302. if (malloc_debug_func != NULL) ^ 303. { 304. allow_customize_debug = 0; crypto/mem.c:304:3: 302. if (malloc_debug_func != NULL) 303. { 304. > allow_customize_debug = 0; 305. malloc_debug_func(NULL, num, file, line, 0); 306. } crypto/mem.c:305:3: Skipping __function_pointer__(): unresolved function pointer 303. { 304. allow_customize_debug = 0; 305. malloc_debug_func(NULL, num, file, line, 0); ^ 306. } 307. ret = malloc_ex_func(num,file,line); crypto/mem.c:307:2: Skipping __function_pointer__(): unresolved function pointer 305. malloc_debug_func(NULL, num, file, line, 0); 306. } 307. ret = malloc_ex_func(num,file,line); ^ 308. #ifdef LEVITTE_DEBUG_MEM 309. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num); crypto/mem.c:311:6: Taking true branch 309. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num); 310. #endif 311. if (malloc_debug_func != NULL) ^ 312. malloc_debug_func(ret, num, file, line, 1); 313. crypto/mem.c:312:3: Skipping __function_pointer__(): unresolved function pointer 310. #endif 311. if (malloc_debug_func != NULL) 312. malloc_debug_func(ret, num, file, line, 1); ^ 313. 314. #ifndef OPENSSL_CPUID_OBJ crypto/mem.c:318:12: Taking false branch 316. * sanitisation function can't be optimised out. NB: We only do 317. * this for >2Kb so the overhead doesn't bother us. */ 318. if(ret && (num > 2048)) ^ 319. { extern unsigned char cleanse_ctr; 320. ((unsigned char *)ret)[0] = cleanse_ctr; crypto/mem.c:324:2: 322. #endif 323. 324. > return ret; 325. } 326. char *CRYPTO_strdup(const char *str, const char *file, int line) crypto/mem.c:325:2: return from a call to CRYPTO_malloc 323. 324. return ret; 325. } ^ 326. char *CRYPTO_strdup(const char *str, const char *file, int line) 327. { ssl/ssl_ciph.c:1872:2: 1870. MemCheck_off(); 1871. comp=(SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP)); 1872. > comp->id=id; 1873. comp->method=cm; 1874. load_builtin_compressions();
https://github.com/openssl/openssl/blob/1c16fd1f033816c98b96a41691625c0c2788e805/ssl/ssl_ciph.c/#L1872
d2a_code_trace_data_43552
static void BN_POOL_release(BN_POOL *p, unsigned int num) { unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE; p->used -= num; while(num--) { bn_check_top(p->current->vals + offset); if(!offset) { offset = BN_CTX_POOL_SIZE - 1; p->current = p->current->prev; } else offset--; } } crypto/dsa/dsa_ossl.c:251: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set_locked`. Showing all 41 steps of the trace crypto/dsa/dsa_ossl.c:216:1: Parameter `ctx_in->pool.used` 214. } 215. 216. > static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) 217. { 218. BN_CTX *ctx; crypto/dsa/dsa_ossl.c:251:8: Call 249. if (dsa->flags & DSA_FLAG_CACHE_MONT_P) 250. { 251. if (!BN_MONT_CTX_set_locked(&dsa->method_mont_p, ^ 252. CRYPTO_LOCK_DSA, 253. dsa->p, ctx)) crypto/bn/bn_mont.c:478:1: Parameter `ctx->pool.used` 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->pool.used` 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:361:11: Call 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 */ 363. if (!BN_copy(&(mont->N),mod)) goto err; /* Set N */ crypto/bn/bn_ctx.c:288:1: Parameter `ctx->pool.used` 286. } 287. 288. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 289. { 290. BIGNUM *ret; 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->pool.used` 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->pool.used` 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:520:6: Call 518. 519. BN_CTX_start(ctx); 520. A = BN_CTX_get(ctx); ^ 521. B = BN_CTX_get(ctx); 522. X = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:288:1: Parameter `ctx->pool.used` 286. } 287. 288. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 289. { 290. BIGNUM *ret; crypto/bn/bn_gcd.c:521:6: Call 519. BN_CTX_start(ctx); 520. A = BN_CTX_get(ctx); 521. B = BN_CTX_get(ctx); ^ 522. X = BN_CTX_get(ctx); 523. D = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:288:1: Parameter `ctx->pool.used` 286. } 287. 288. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 289. { 290. BIGNUM *ret; crypto/bn/bn_gcd.c:522:6: Call 520. A = BN_CTX_get(ctx); 521. B = BN_CTX_get(ctx); 522. X = BN_CTX_get(ctx); ^ 523. D = BN_CTX_get(ctx); 524. M = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:288:1: Parameter `ctx->pool.used` 286. } 287. 288. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 289. { 290. BIGNUM *ret; crypto/bn/bn_gcd.c:523:6: Call 521. B = BN_CTX_get(ctx); 522. X = BN_CTX_get(ctx); 523. D = BN_CTX_get(ctx); ^ 524. M = BN_CTX_get(ctx); 525. Y = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:288:1: Parameter `ctx->pool.used` 286. } 287. 288. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 289. { 290. BIGNUM *ret; crypto/bn/bn_gcd.c:524:6: Call 522. X = BN_CTX_get(ctx); 523. D = BN_CTX_get(ctx); 524. M = BN_CTX_get(ctx); ^ 525. Y = BN_CTX_get(ctx); 526. T = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:288:1: Parameter `ctx->pool.used` 286. } 287. 288. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 289. { 290. BIGNUM *ret; crypto/bn/bn_gcd.c:525:6: Call 523. D = BN_CTX_get(ctx); 524. M = BN_CTX_get(ctx); 525. Y = BN_CTX_get(ctx); ^ 526. T = BN_CTX_get(ctx); 527. if (T == NULL) goto err; crypto/bn/bn_ctx.c:288:1: Parameter `ctx->pool.used` 286. } 287. 288. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 289. { 290. BIGNUM *ret; crypto/bn/bn_gcd.c:526:6: Call 524. M = BN_CTX_get(ctx); 525. Y = BN_CTX_get(ctx); 526. T = BN_CTX_get(ctx); ^ 527. if (T == NULL) goto err; 528. crypto/bn/bn_ctx.c:288:1: Parameter `ctx->pool.used` 286. } 287. 288. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 289. { 290. BIGNUM *ret; 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->pool.used` 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->pool.used` 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:227:6: Call 225. 226. BN_CTX_start(ctx); 227. tmp=BN_CTX_get(ctx); ^ 228. snum=BN_CTX_get(ctx); 229. sdiv=BN_CTX_get(ctx); crypto/bn/bn_ctx.c:288:1: Parameter `ctx->pool.used` 286. } 287. 288. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 289. { 290. BIGNUM *ret; crypto/bn/bn_div.c:228:7: Call 226. BN_CTX_start(ctx); 227. tmp=BN_CTX_get(ctx); 228. snum=BN_CTX_get(ctx); ^ 229. sdiv=BN_CTX_get(ctx); 230. if (dv == NULL) crypto/bn/bn_ctx.c:288:1: Parameter `ctx->pool.used` 286. } 287. 288. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 289. { 290. BIGNUM *ret; crypto/bn/bn_div.c:229:7: Call 227. tmp=BN_CTX_get(ctx); 228. snum=BN_CTX_get(ctx); 229. sdiv=BN_CTX_get(ctx); ^ 230. if (dv == NULL) 231. res=BN_CTX_get(ctx); crypto/bn/bn_ctx.c:288:1: Parameter `ctx->pool.used` 286. } 287. 288. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 289. { 290. BIGNUM *ret; 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->pool.used` 268. } 269. 270. > void BN_CTX_end(BN_CTX *ctx) 271. { 272. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:280:4: Call 278. /* Does this stack frame have anything to release? */ 279. if(fp < ctx->used) 280. BN_POOL_release(&ctx->pool, ctx->used - fp); ^ 281. ctx->used = fp; 282. /* Unjam "too_many" in case "get" had failed */ crypto/bn/bn_ctx.c:438:1: <LHS trace> 436. } 437. 438. > static void BN_POOL_release(BN_POOL *p, unsigned int num) 439. { 440. unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE; crypto/bn/bn_ctx.c:438:1: Parameter `p->used` 436. } 437. 438. > static void BN_POOL_release(BN_POOL *p, unsigned int num) 439. { 440. unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE; crypto/bn/bn_ctx.c:440:2: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set_locked` 438. static void BN_POOL_release(BN_POOL *p, unsigned int num) 439. { 440. unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE; ^ 441. p->used -= num; 442. while(num--)
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/bn/bn_ctx.c/#L440
d2a_code_trace_data_43553
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/extensions_clnt.c:217: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 6]):unsigned64 by call to `WPACKET_sub_memcpy__`. Showing all 16 steps of the trace ssl/statem/extensions_clnt.c:185:1: Parameter `pkt->written` 183. #endif 184. 185. > int tls_construct_ctos_session_ticket(SSL *s, WPACKET *pkt, X509 *x, 186. size_t chainidx, int *al) 187. { ssl/statem/extensions_clnt.c:216:10: Call 214. return 1; 215. 216. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_session_ticket) ^ 217. || !WPACKET_sub_memcpy_u16(pkt, s->session->ext.tick, ticklen)) { 218. SSLerr(SSL_F_TLS_CONSTRUCT_CTOS_SESSION_TICKET, ERR_R_INTERNAL_ERROR); ssl/packet.c:289:1: Parameter `pkt->written` 287. } 288. 289. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 290. { 291. unsigned char *data; ssl/statem/extensions_clnt.c:217:17: Call 215. 216. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_session_ticket) 217. || !WPACKET_sub_memcpy_u16(pkt, s->session->ext.tick, ticklen)) { ^ 218. SSLerr(SSL_F_TLS_CONSTRUCT_CTOS_SESSION_TICKET, ERR_R_INTERNAL_ERROR); 219. return 0; ssl/packet.c:348:10: Call 346. size_t lenbytes) 347. { 348. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) ^ 349. || !WPACKET_memcpy(pkt, src, len) 350. || !WPACKET_close(pkt)) ssl/packet.c:252:1: Parameter `pkt->buf->length` 250. } 251. 252. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 253. { 254. WPACKET_SUB *sub; ssl/packet.c:349:17: Call 347. { 348. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) 349. || !WPACKET_memcpy(pkt, src, len) ^ 350. || !WPACKET_close(pkt)) 351. return 0; ssl/packet.c:330:1: Parameter `pkt->written` 328. } 329. 330. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) 331. { 332. unsigned char *dest; ssl/packet.c:337:10: Call 335. return 1; 336. 337. if (!WPACKET_allocate_bytes(pkt, len, &dest)) ^ 338. return 0; 339. 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 + 6]):unsigned64 by call to `WPACKET_sub_memcpy__` 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/f61c5ca6ca183bf0a51651857e3efb02a98889ad/ssl/packet.c/#L49