id
stringlengths
25
25
content
stringlengths
649
72.1k
max_stars_repo_path
stringlengths
91
133
d2a_code_trace_data_43254
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/sm2/sm2_sign.c:123: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_mod_mul`. Showing all 22 steps of the trace crypto/sm2/sm2_sign.c:120:9: Call 118. continue; 119. 120. BN_add(s, dA, BN_value_one()); ^ 121. BN_mod_inverse(s, s, order, ctx); 122. crypto/bn/bn_add.c:40:18: Call 38. 39. if (BN_ucmp(a, b) < 0) { 40. if (!BN_usub(r, b, a)) ^ 41. return 0; 42. r->neg = 1; crypto/bn/bn_add.c:107:1: Parameter `r->top` 105. 106. /* unsigned subtraction of b from a, a must be larger than b. */ 107. > int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 108. { 109. int max, min, dif; crypto/sm2/sm2_sign.c:121:9: Call 119. 120. BN_add(s, dA, BN_value_one()); 121. BN_mod_inverse(s, s, order, ctx); ^ 122. 123. BN_mod_mul(tmp, dA, r, order, 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/sm2/sm2_sign.c:123:9: Call 121. BN_mod_inverse(s, s, order, ctx); 122. 123. BN_mod_mul(tmp, dA, r, order, ctx); ^ 124. BN_sub(tmp, k, tmp); 125. 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: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 `BN_mod_mul` 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/440bce8f813fa661437ce52378c3df38e2fd073b/crypto/bn/bn_sqr.c/#L120
d2a_code_trace_data_43255
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, &s->interrupt_callback, NULL) < 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:1871: error: Null Dereference pointer `content` last assigned on line 1865 could be null and is dereferenced at line 1871, column 5. libavformat/rtsp.c:1852:1: start of procedure sdp_read_header() 1850. } 1851. 1852. static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap) ^ 1853. { 1854. RTSPState *rt = s->priv_data; libavformat/rtsp.c:1854:5: 1852. static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap) 1853. { 1854. RTSPState *rt = s->priv_data; ^ 1855. RTSPStream *rtsp_st; 1856. int size, i, err; libavformat/rtsp.c:1860:10: 1858. char url[1024]; 1859. 1860. if (!ff_network_init()) ^ 1861. return AVERROR(EIO); 1862. 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:1860:10: Taking false branch 1858. char url[1024]; 1859. 1860. if (!ff_network_init()) ^ 1861. return AVERROR(EIO); 1862. libavformat/rtsp.c:1865:5: 1863. /* read the whole sdp file */ 1864. /* XXX: better loading */ 1865. content = av_malloc(SDP_MAX_SIZE); ^ 1866. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1); 1867. 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:1866:5: Skipping avio_read(): empty list of specs 1864. /* XXX: better loading */ 1865. content = av_malloc(SDP_MAX_SIZE); 1866. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1); ^ 1867. if (size <= 0) { 1868. av_free(content); libavformat/rtsp.c:1867:9: Taking false branch 1865. content = av_malloc(SDP_MAX_SIZE); 1866. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1); 1867. if (size <= 0) { ^ 1868. av_free(content); 1869. return AVERROR_INVALIDDATA; libavformat/rtsp.c:1871:5: 1869. return AVERROR_INVALIDDATA; 1870. } 1871. content[size] ='\0'; ^ 1872. 1873. err = ff_sdp_parse(s, content);
https://github.com/libav/libav/blob/83ab10f6e9559be3420af1a26c36d6bec0496e89/libavformat/rtsp.c/#L1871
d2a_code_trace_data_43256
static ossl_inline void packet_forward(PACKET *pkt, size_t len) { pkt->curr += len; pkt->remaining -= len; } test/servername_test.c:55: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 34):unsigned64 by call to `PACKET_forward`. Showing all 14 steps of the trace test/servername_test.c:49:10: Call 47. 48. len = BIO_get_mem_data(bio, (char **)&data); 49. if (!TEST_true(PACKET_buf_init(&pkt, data, len)) ^ 50. /* Skip the record header */ 51. || !PACKET_forward(&pkt, SSL3_RT_HEADER_LENGTH) ssl/packet_locl.h:68:8: Parameter `pkt->remaining` 66. * is being used. 67. */ 68. __owur static ossl_inline int PACKET_buf_init(PACKET *pkt, ^ 69. const unsigned char *buf, 70. size_t len) test/servername_test.c:51:17: Call 49. if (!TEST_true(PACKET_buf_init(&pkt, data, len)) 50. /* Skip the record header */ 51. || !PACKET_forward(&pkt, SSL3_RT_HEADER_LENGTH) ^ 52. /* Skip the handshake message header */ 53. || !TEST_true(PACKET_forward(&pkt, SSL3_HM_HEADER_LENGTH)) ssl/packet_locl.h:463:8: Parameter `len` 461. 462. /* Move the current reading position forward |len| bytes */ 463. __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len) ^ 464. { 465. if (PACKET_remaining(pkt) < len) test/servername_test.c:53:17: Call 51. || !PACKET_forward(&pkt, SSL3_RT_HEADER_LENGTH) 52. /* Skip the handshake message header */ 53. || !TEST_true(PACKET_forward(&pkt, SSL3_HM_HEADER_LENGTH)) ^ 54. /* Skip client version and random */ 55. || !TEST_true(PACKET_forward(&pkt, CLIENT_VERSION_LEN ssl/packet_locl.h:463:8: Parameter `len` 461. 462. /* Move the current reading position forward |len| bytes */ 463. __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len) ^ 464. { 465. if (PACKET_remaining(pkt) < len) test/servername_test.c:55:17: Call 53. || !TEST_true(PACKET_forward(&pkt, SSL3_HM_HEADER_LENGTH)) 54. /* Skip client version and random */ 55. || !TEST_true(PACKET_forward(&pkt, CLIENT_VERSION_LEN ^ 56. + SSL3_RANDOM_SIZE)) 57. /* Skip session id */ ssl/packet_locl.h:463:8: Parameter `len` 461. 462. /* Move the current reading position forward |len| bytes */ 463. __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len) ^ 464. { 465. if (PACKET_remaining(pkt) < len) ssl/packet_locl.h:468:5: Call 466. return 0; 467. 468. packet_forward(pkt, len); ^ 469. 470. return 1; ssl/packet_locl.h:29:1: <LHS trace> 27. 28. /* Internal unchecked shorthand; don't use outside this file. */ 29. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 30. { 31. pkt->curr += len; ssl/packet_locl.h:29:1: Parameter `pkt->remaining` 27. 28. /* Internal unchecked shorthand; don't use outside this file. */ 29. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 30. { 31. pkt->curr += len; ssl/packet_locl.h:29:1: <RHS trace> 27. 28. /* Internal unchecked shorthand; don't use outside this file. */ 29. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 30. { 31. pkt->curr += len; ssl/packet_locl.h:29:1: Parameter `len` 27. 28. /* Internal unchecked shorthand; don't use outside this file. */ 29. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 30. { 31. pkt->curr += len; ssl/packet_locl.h:32:5: Binary operation: ([0, +oo] - 34):unsigned64 by call to `PACKET_forward` 30. { 31. pkt->curr += len; 32. pkt->remaining -= len; ^ 33. } 34.
https://github.com/openssl/openssl/blob/2e6b615f795e8ca8ae830a00079c4ea064eaae42/ssl/packet_locl.h/#L32
d2a_code_trace_data_43257
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) { int i, nw, lb, rb; BN_ULONG *t, *f; BN_ULONG l; bn_check_top(r); bn_check_top(a); if (n < 0) { BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT); return 0; } nw = n / BN_BITS2; if (bn_wexpand(r, a->top + nw + 1) == NULL) return 0; r->neg = a->neg; lb = n % BN_BITS2; rb = BN_BITS2 - lb; f = a->d; t = r->d; t[a->top + nw] = 0; if (lb == 0) for (i = a->top - 1; i >= 0; i--) t[nw + i] = f[i]; else for (i = a->top - 1; i >= 0; i--) { l = f[i]; t[nw + i + 1] |= (l >> rb) & BN_MASK2; t[nw + i] = (l << lb) & BN_MASK2; } memset(t, 0, sizeof(*t) * nw); r->top = a->top + nw + 1; bn_correct_top(r); bn_check_top(r); return 1; } crypto/sm2/sm2_sign.c:202: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mod_add`. Showing all 26 steps of the trace crypto/sm2/sm2_sign.c:192:9: Call 190. ECDSA_SIG_get0(sig, &r, &s); 191. 192. if (BN_cmp(r, BN_value_one()) < 0) ^ 193. goto done; 194. if (BN_cmp(s, BN_value_one()) < 0) crypto/bn/bn_lib.c:539:1: Parameter `a->top` 537. } 538. 539. > int BN_cmp(const BIGNUM *a, const BIGNUM *b) 540. { 541. int i; crypto/sm2/sm2_sign.c:194:9: Call 192. if (BN_cmp(r, BN_value_one()) < 0) 193. goto done; 194. if (BN_cmp(s, BN_value_one()) < 0) ^ 195. goto done; 196. crypto/bn/bn_lib.c:539:1: Parameter `a->top` 537. } 538. 539. > int BN_cmp(const BIGNUM *a, const BIGNUM *b) 540. { 541. int i; crypto/sm2/sm2_sign.c:197:9: Call 195. goto done; 196. 197. if (BN_cmp(order, r) <= 0) ^ 198. goto done; 199. if (BN_cmp(order, s) <= 0) crypto/bn/bn_lib.c:539:1: Parameter `a->top` 537. } 538. 539. > int BN_cmp(const BIGNUM *a, const BIGNUM *b) 540. { 541. int i; crypto/sm2/sm2_sign.c:199:9: Call 197. if (BN_cmp(order, r) <= 0) 198. goto done; 199. if (BN_cmp(order, s) <= 0) ^ 200. goto done; 201. crypto/bn/bn_lib.c:539:1: Parameter `a->top` 537. } 538. 539. > int BN_cmp(const BIGNUM *a, const BIGNUM *b) 540. { 541. int i; crypto/sm2/sm2_sign.c:202:9: Call 200. goto done; 201. 202. if (BN_mod_add(t, r, s, order, ctx) == 0) ^ 203. goto done; 204. crypto/bn/bn_mod.c:28:1: Parameter `m->top` 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 `d->top` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:199:31: Call 197. 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) 201. goto err; crypto/bn/bn_lib.c:140:9: Assignment 138. 139. if (BN_is_zero(a)) 140. return 0; ^ 141. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); 142. } crypto/bn/bn_div.c:199:5: Assignment 197. 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) 201. goto err; crypto/bn/bn_div.c:200:11: Call 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) ^ 201. goto err; 202. sdiv->neg = 0; crypto/bn/bn_shift.c:83:1: <Offset trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `n` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:5: Assignment 95. } 96. 97. nw = n / BN_BITS2; ^ 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) 99. return 0; crypto/bn/bn_shift.c:83:1: <Length trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `*r->d` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:98:9: Call 96. 97. nw = n / BN_BITS2; 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 99. return 0; 100. r->neg = a->neg; crypto/bn/bn_lib.c:910:1: Parameter `*a->d` 908. } 909. 910. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 911. { 912. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:104:5: Assignment 102. rb = BN_BITS2 - lb; 103. f = a->d; 104. t = r->d; ^ 105. t[a->top + nw] = 0; 106. if (lb == 0) crypto/bn/bn_shift.c:112:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mod_add` 110. for (i = a->top - 1; i >= 0; i--) { 111. l = f[i]; 112. t[nw + i + 1] |= (l >> rb) & BN_MASK2; ^ 113. t[nw + i] = (l << lb) & BN_MASK2; 114. }
https://github.com/openssl/openssl/blob/440bce8f813fa661437ce52378c3df38e2fd073b/crypto/bn/bn_shift.c/#L112
d2a_code_trace_data_43258
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dsa/dsa_ossl.c:305: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_exp_mont`. Showing all 31 steps of the trace crypto/dsa/dsa_ossl.c:230:1: Parameter `ctx_in->stack.depth` 228. } 229. 230. > static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, 231. BIGNUM **kinvp, BIGNUM **rp, 232. const unsigned char *dgst, int dlen) crypto/dsa/dsa_ossl.c:305:5: Call 303. K = k; 304. } 305. DSA_BN_MOD_EXP(goto err, dsa, r, dsa->g, K, dsa->p, ctx, ^ 306. dsa->method_mont_p); 307. if (!BN_mod(r, r, dsa->q, ctx)) crypto/bn/bn_exp.c:396:1: Parameter `ctx->stack.depth` 394. } 395. 396. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 397. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 398. { crypto/bn/bn_exp.c:408:16: Call 406. 407. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { 408. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 409. } 410. crypto/bn/bn_exp.c:644:1: Parameter `ctx->stack.depth` 642. * http://www.daemong-consideredperthreading-considered-harmful/) 643. */ 644. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 645. const BIGNUM *m, BN_CTX *ctx, 646. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:678:5: Call 676. } 677. 678. BN_CTX_start(ctx); ^ 679. 680. /* 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_exp.c:689:14: Call 687. if ((mont = BN_MONT_CTX_new()) == NULL) 688. goto err; 689. if (!BN_MONT_CTX_set(mont, m, ctx)) ^ 690. goto err; 691. } 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_mod_exp_mont` 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_43259
static int matroska_decode_buffer(uint8_t** buf, int* buf_size, MatroskaTrack *track) { MatroskaTrackEncoding *encodings = track->encodings.elem; uint8_t* data = *buf; int isize = *buf_size; uint8_t* pkt_data = NULL; int pkt_size = isize; int result = 0; int olen; if (pkt_size >= 10000000) return -1; switch (encodings[0].compression.algo) { case MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP: return encodings[0].compression.settings.size; case MATROSKA_TRACK_ENCODING_COMP_LZO: do { olen = pkt_size *= 3; pkt_data = av_realloc(pkt_data, pkt_size+AV_LZO_OUTPUT_PADDING); result = av_lzo1x_decode(pkt_data, &olen, data, &isize); } while (result==AV_LZO_OUTPUT_FULL && pkt_size<10000000); if (result) goto failed; pkt_size -= olen; break; #if CONFIG_ZLIB case MATROSKA_TRACK_ENCODING_COMP_ZLIB: { z_stream zstream = {0}; if (inflateInit(&zstream) != Z_OK) return -1; zstream.next_in = data; zstream.avail_in = isize; do { pkt_size *= 3; pkt_data = av_realloc(pkt_data, pkt_size); zstream.avail_out = pkt_size - zstream.total_out; zstream.next_out = pkt_data + zstream.total_out; result = inflate(&zstream, Z_NO_FLUSH); } while (result==Z_OK && pkt_size<10000000); pkt_size = zstream.total_out; inflateEnd(&zstream); if (result != Z_STREAM_END) goto failed; break; } #endif #if CONFIG_BZLIB case MATROSKA_TRACK_ENCODING_COMP_BZLIB: { bz_stream bzstream = {0}; if (BZ2_bzDecompressInit(&bzstream, 0, 0) != BZ_OK) return -1; bzstream.next_in = data; bzstream.avail_in = isize; do { pkt_size *= 3; pkt_data = av_realloc(pkt_data, pkt_size); bzstream.avail_out = pkt_size - bzstream.total_out_lo32; bzstream.next_out = pkt_data + bzstream.total_out_lo32; result = BZ2_bzDecompress(&bzstream); } while (result==BZ_OK && pkt_size<10000000); pkt_size = bzstream.total_out_lo32; BZ2_bzDecompressEnd(&bzstream); if (result != BZ_STREAM_END) goto failed; break; } #endif default: return -1; } *buf = pkt_data; *buf_size = pkt_size; return 0; failed: av_free(pkt_data); return -1; } libavformat/matroskadec.c:943: error: Memory Leak memory dynamically allocated by call to `av_realloc()` at line 943, column 24 is not reachable after line 943, column 13. libavformat/matroskadec.c:923:1: start of procedure matroska_decode_buffer() 921. } 922. 923. static int matroska_decode_buffer(uint8_t** buf, int* buf_size, ^ 924. MatroskaTrack *track) 925. { libavformat/matroskadec.c:926:5: 924. MatroskaTrack *track) 925. { 926. MatroskaTrackEncoding *encodings = track->encodings.elem; ^ 927. uint8_t* data = *buf; 928. int isize = *buf_size; libavformat/matroskadec.c:927:5: 925. { 926. MatroskaTrackEncoding *encodings = track->encodings.elem; 927. uint8_t* data = *buf; ^ 928. int isize = *buf_size; 929. uint8_t* pkt_data = NULL; libavformat/matroskadec.c:928:5: 926. MatroskaTrackEncoding *encodings = track->encodings.elem; 927. uint8_t* data = *buf; 928. int isize = *buf_size; ^ 929. uint8_t* pkt_data = NULL; 930. int pkt_size = isize; libavformat/matroskadec.c:929:5: 927. uint8_t* data = *buf; 928. int isize = *buf_size; 929. uint8_t* pkt_data = NULL; ^ 930. int pkt_size = isize; 931. int result = 0; libavformat/matroskadec.c:930:5: 928. int isize = *buf_size; 929. uint8_t* pkt_data = NULL; 930. int pkt_size = isize; ^ 931. int result = 0; 932. int olen; libavformat/matroskadec.c:931:5: 929. uint8_t* pkt_data = NULL; 930. int pkt_size = isize; 931. int result = 0; ^ 932. int olen; 933. libavformat/matroskadec.c:934:9: Taking false branch 932. int olen; 933. 934. if (pkt_size >= 10000000) ^ 935. return -1; 936. libavformat/matroskadec.c:937:5: 935. return -1; 936. 937. switch (encodings[0].compression.algo) { ^ 938. case MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP: 939. return encodings[0].compression.settings.size; libavformat/matroskadec.c:938:5: Switch condition is false. Skipping switch case 936. 937. switch (encodings[0].compression.algo) { 938. case MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP: ^ 939. return encodings[0].compression.settings.size; 940. case MATROSKA_TRACK_ENCODING_COMP_LZO: libavformat/matroskadec.c:940:5: Switch condition is true. Entering switch case 938. case MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP: 939. return encodings[0].compression.settings.size; 940. case MATROSKA_TRACK_ENCODING_COMP_LZO: ^ 941. do { 942. olen = pkt_size *= 3; libavformat/matroskadec.c:942:13: 940. case MATROSKA_TRACK_ENCODING_COMP_LZO: 941. do { 942. olen = pkt_size *= 3; ^ 943. pkt_data = av_realloc(pkt_data, pkt_size+AV_LZO_OUTPUT_PADDING); 944. result = av_lzo1x_decode(pkt_data, &olen, data, &isize); libavformat/matroskadec.c:943:13: 941. do { 942. olen = pkt_size *= 3; 943. pkt_data = av_realloc(pkt_data, pkt_size+AV_LZO_OUTPUT_PADDING); ^ 944. result = av_lzo1x_decode(pkt_data, &olen, data, &isize); 945. } while (result==AV_LZO_OUTPUT_FULL && pkt_size<10000000); libavutil/mem.c:119:1: start of procedure av_realloc() 117. } 118. 119. void *av_realloc(void *ptr, FF_INTERNAL_MEM_TYPE size) ^ 120. { 121. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:126:8: Taking false branch 124. 125. /* let's disallow possible ambiguous cases */ 126. if(size > (INT_MAX-16) ) ^ 127. return NULL; 128. libavutil/mem.c:135:5: 133. return (char*)realloc((char*)ptr - diff, size + diff) + diff; 134. #else 135. return realloc(ptr, size); ^ 136. #endif 137. } libavutil/mem.c:137:1: return from a call to av_realloc 135. return realloc(ptr, size); 136. #endif 137. } ^ 138. 139. void av_free(void *ptr) libavformat/matroskadec.c:944:13: Skipping av_lzo1x_decode(): empty list of specs 942. olen = pkt_size *= 3; 943. pkt_data = av_realloc(pkt_data, pkt_size+AV_LZO_OUTPUT_PADDING); 944. result = av_lzo1x_decode(pkt_data, &olen, data, &isize); ^ 945. } while (result==AV_LZO_OUTPUT_FULL && pkt_size<10000000); 946. if (result) libavformat/matroskadec.c:945:18: Loop condition is true. Entering loop body 943. pkt_data = av_realloc(pkt_data, pkt_size+AV_LZO_OUTPUT_PADDING); 944. result = av_lzo1x_decode(pkt_data, &olen, data, &isize); 945. } while (result==AV_LZO_OUTPUT_FULL && pkt_size<10000000); ^ 946. if (result) 947. goto failed; libavformat/matroskadec.c:945:48: Loop condition is true. Entering loop body 943. pkt_data = av_realloc(pkt_data, pkt_size+AV_LZO_OUTPUT_PADDING); 944. result = av_lzo1x_decode(pkt_data, &olen, data, &isize); 945. } while (result==AV_LZO_OUTPUT_FULL && pkt_size<10000000); ^ 946. if (result) 947. goto failed; libavformat/matroskadec.c:942:13: 940. case MATROSKA_TRACK_ENCODING_COMP_LZO: 941. do { 942. olen = pkt_size *= 3; ^ 943. pkt_data = av_realloc(pkt_data, pkt_size+AV_LZO_OUTPUT_PADDING); 944. result = av_lzo1x_decode(pkt_data, &olen, data, &isize); libavformat/matroskadec.c:943:13: 941. do { 942. olen = pkt_size *= 3; 943. pkt_data = av_realloc(pkt_data, pkt_size+AV_LZO_OUTPUT_PADDING); ^ 944. result = av_lzo1x_decode(pkt_data, &olen, data, &isize); 945. } while (result==AV_LZO_OUTPUT_FULL && pkt_size<10000000); libavutil/mem.c:119:1: start of procedure av_realloc() 117. } 118. 119. void *av_realloc(void *ptr, FF_INTERNAL_MEM_TYPE size) ^ 120. { 121. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:126:8: Taking true branch 124. 125. /* let's disallow possible ambiguous cases */ 126. if(size > (INT_MAX-16) ) ^ 127. return NULL; 128. libavutil/mem.c:127:9: 125. /* let's disallow possible ambiguous cases */ 126. if(size > (INT_MAX-16) ) 127. return NULL; ^ 128. 129. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:137:1: return from a call to av_realloc 135. return realloc(ptr, size); 136. #endif 137. } ^ 138. 139. void av_free(void *ptr)
https://github.com/libav/libav/blob/90e8a9c34f641d0cb9137190c1912a3da3095e01/libavformat/matroskadec.c/#L943
d2a_code_trace_data_43260
static void dequant_lsps(double *lsps, int num, const uint16_t *values, const uint16_t *sizes, int n_stages, const uint8_t *table, const double *mul_q, const double *base_q) { int n, m; memset(lsps, 0, num * sizeof(*lsps)); for (n = 0; n < n_stages; n++) { const uint8_t *t_off = &table[values[n] * num]; double base = base_q[n], mul = mul_q[n]; for (m = 0; m < num; m++) lsps[m] += base + mul * t_off[m]; table += sizes[n] * num; } } libavcodec/wmavoice.c:1817: error: Buffer Overrun L2 Offset: [0, 11] (⇐ [0, 2] + [0, 9]) Size: 3 by call to `dequant_lsp10i`. libavcodec/wmavoice.c:1734:1: Array declaration 1732. * fully parse the superframe 1733. */ 1734. static int synth_superframe(AVCodecContext *ctx, AVFrame *frame, ^ 1735. int *got_frame_ptr) 1736. { libavcodec/wmavoice.c:1817:17: Call 1815. 1816. if (s->lsps == 10) { 1817. dequant_lsp10i(gb, lsps[n]); ^ 1818. } else /* s->lsps == 16 */ 1819. dequant_lsp16i(gb, lsps[n]); libavcodec/wmavoice.c:855:1: Parameter `*lsps` 853. * Parse 10 independently-coded LSPs. 854. */ 855. static void dequant_lsp10i(GetBitContext *gb, double *lsps) ^ 856. { 857. static const uint16_t vec_sizes[4] = { 256, 64, 32, 32 }; libavcodec/wmavoice.c:873:5: Call 871. v[3] = get_bits(gb, 5); 872. 873. dequant_lsps(lsps, 10, v, vec_sizes, 4, wmavoice_dq_lsp10i, ^ 874. mul_lsf, base_lsf); 875. } libavcodec/wmavoice.c:823:1: <Offset trace> 821. * @param base_q base (lowest) LSF values 822. */ 823. static void dequant_lsps(double *lsps, int num, ^ 824. const uint16_t *values, 825. const uint16_t *sizes, libavcodec/wmavoice.c:823:1: Parameter `num` 821. * @param base_q base (lowest) LSF values 822. */ 823. static void dequant_lsps(double *lsps, int num, ^ 824. const uint16_t *values, 825. const uint16_t *sizes, libavcodec/wmavoice.c:823:1: <Length trace> 821. * @param base_q base (lowest) LSF values 822. */ 823. static void dequant_lsps(double *lsps, int num, ^ 824. const uint16_t *values, 825. const uint16_t *sizes, libavcodec/wmavoice.c:823:1: Parameter `*lsps` 821. * @param base_q base (lowest) LSF values 822. */ 823. static void dequant_lsps(double *lsps, int num, ^ 824. const uint16_t *values, 825. const uint16_t *sizes, libavcodec/wmavoice.c:838:13: Array access: Offset: [0, 11] (⇐ [0, 2] + [0, 9]) Size: 3 by call to `dequant_lsp10i` 836. 837. for (m = 0; m < num; m++) 838. lsps[m] += base + mul * t_off[m]; ^ 839. 840. table += sizes[n] * num;
https://github.com/libav/libav/blob/c6507946d428ee082676d5917fbb3eb0d1d7eb2e/libavcodec/wmavoice.c/#L838
d2a_code_trace_data_43261
static int tls_curve_allowed(SSL *s, const unsigned char *curve, int op) { const tls_curve_info *cinfo; if (curve[0]) return 1; if ((curve[1] < 1) || ((size_t)curve[1] > OSSL_NELEM(nid_list))) return 0; cinfo = &nid_list[curve[1] - 1]; # ifdef OPENSSL_NO_EC2M if (cinfo->flags & TLS_CURVE_CHAR2) return 0; # endif return ssl_security(s, op, cinfo->secbits, cinfo->nid, (void *)curve); } ssl/t1_lib.c:1289: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: 29 by call to `tls_curve_allowed`. Showing all 7 steps of the trace ssl/t1_lib.c:1120:1: Parameter `*s->session->tlsext_ellipticcurvelist` 1118. } 1119. 1120. > unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *buf, 1121. unsigned char *limit, int *al) 1122. { ssl/t1_lib.c:1289:17: Call 1287. /* Copy curve ID if supported */ 1288. for (i = 0; i < num_curves; i++, pcurves += 2) { 1289. if (tls_curve_allowed(s, pcurves, SSL_SECOP_CURVE_SUPPORTED)) { ^ 1290. *etmp++ = pcurves[0]; 1291. *etmp++ = pcurves[1]; ssl/t1_lib.c:419:1: <Offset trace> 417. 418. /* See if curve is allowed by security callback */ 419. > static int tls_curve_allowed(SSL *s, const unsigned char *curve, int op) 420. { 421. const tls_curve_info *cinfo; ssl/t1_lib.c:419:1: Parameter `*curve` 417. 418. /* See if curve is allowed by security callback */ 419. > static int tls_curve_allowed(SSL *s, const unsigned char *curve, int op) 420. { 421. const tls_curve_info *cinfo; ssl/t1_lib.c:237:1: <Length trace> 235. */ 236. 237. > static const tls_curve_info nid_list[] = { 238. {NID_sect163k1, 80, TLS_CURVE_CHAR2}, /* sect163k1 (1) */ 239. {NID_sect163r1, 80, TLS_CURVE_CHAR2}, /* sect163r1 (2) */ ssl/t1_lib.c:237:1: Array declaration 235. */ 236. 237. > static const tls_curve_info nid_list[] = { 238. {NID_sect163k1, 80, TLS_CURVE_CHAR2}, /* sect163k1 (1) */ 239. {NID_sect163r1, 80, TLS_CURVE_CHAR2}, /* sect163r1 (2) */ ssl/t1_lib.c:426:5: Array access: Offset: [-1, +oo] Size: 29 by call to `tls_curve_allowed` 424. if ((curve[1] < 1) || ((size_t)curve[1] > OSSL_NELEM(nid_list))) 425. return 0; 426. cinfo = &nid_list[curve[1] - 1]; ^ 427. # ifdef OPENSSL_NO_EC2M 428. if (cinfo->flags & TLS_CURVE_CHAR2)
https://github.com/openssl/openssl/blob/0421c00e56cad9bdce5c1df4d406b7fc799bf6ad/ssl/t1_lib.c/#L426
d2a_code_trace_data_43262
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/ecdsatest.c:359: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_bin2bn`. Showing all 14 steps of the trace test/ecdsatest.c:358:14: Call 356. if (!TEST_ptr(modified_sig = ECDSA_SIG_new())) 357. goto builtin_err; 358. if (!TEST_ptr(modified_r = BN_bin2bn(raw_buf, bn_len, NULL)) ^ 359. || !TEST_ptr(modified_s = BN_bin2bn(raw_buf + bn_len, 360. bn_len, NULL)) crypto/bn/bn_lib.c:407:1: Parameter `*ret->d` 405. } 406. 407. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) 408. { 409. unsigned int i, m; test/ecdsatest.c:359:21: Call 357. goto builtin_err; 358. if (!TEST_ptr(modified_r = BN_bin2bn(raw_buf, bn_len, NULL)) 359. || !TEST_ptr(modified_s = BN_bin2bn(raw_buf + bn_len, ^ 360. bn_len, NULL)) 361. || !TEST_true(ECDSA_SIG_set0(modified_sig, crypto/bn/bn_lib.c:407:1: Parameter `*ret->d` 405. } 406. 407. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) 408. { 409. unsigned int i, m; crypto/bn/bn_lib.c:429:9: Call 427. i = ((n - 1) / BN_BYTES) + 1; 428. m = ((n - 1) % (BN_BYTES)); 429. if (bn_wexpand(ret, (int)i) == NULL) { ^ 430. BN_free(bn); 431. return NULL; crypto/bn/bn_lib.c:948:1: Parameter `*a->d` 946. } 947. 948. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:950:37: Call 948. BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 951. } 952. crypto/bn/bn_lib.c:284:1: Parameter `*b->d` 282. */ 283. 284. > BIGNUM *bn_expand2(BIGNUM *b, int words) 285. { 286. bn_check_top(b); crypto/bn/bn_lib.c:289:23: Call 287. 288. if (words > b->dmax) { 289. BN_ULONG *a = bn_expand_internal(b, words); ^ 290. if (!a) 291. return NULL; crypto/bn/bn_lib.c:246:1: <Offset trace> 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:246:1: Parameter `b->top` 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:246:1: <Length trace> 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:246:1: Parameter `*b->d` 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:271:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_bin2bn` 269. assert(b->top <= words); 270. if (b->top > 0) 271. memcpy(a, b->d, sizeof(*a) * b->top); ^ 272. 273. return a;
https://github.com/openssl/openssl/blob/b66411f6cda6970c01283ddde6d8063c57b3b7d9/crypto/bn/bn_lib.c/#L271
d2a_code_trace_data_43263
ngx_int_t ngx_http_arg(ngx_http_request_t *r, u_char *name, size_t len, ngx_str_t *value) { u_char *p, *last; if (r->args.len == 0) { return NGX_DECLINED; } p = r->args.data; last = p + r->args.len; for ( ; p < last; p++) { p = ngx_strlcasestrn(p, last - 1, name, len - 1); if (p == NULL) { return NGX_DECLINED; } if ((p == r->args.data || *(p - 1) == '&') && *(p + len) == '=') { value->data = p + len + 1; p = ngx_strlchr(p, last, '&'); if (p == NULL) { p = r->args.data + r->args.len; } value->len = p - value->data; return NGX_OK; } } return NGX_DECLINED; } src/http/ngx_http_variables.c:788: error: Integer Overflow L2 ([0, +oo] - 1):unsigned64 by call to `ngx_http_arg`. src/http/ngx_http_variables.c:785:5: Assignment 783. ngx_str_t value; 784. 785. len = name->len - (sizeof("arg_") - 1); ^ 786. arg = name->data + sizeof("arg_") - 1; 787. src/http/ngx_http_variables.c:788:9: Call 786. arg = name->data + sizeof("arg_") - 1; 787. 788. if (ngx_http_arg(r, arg, len, &value) != NGX_OK) { ^ 789. v->not_found = 1; 790. return NGX_OK; src/http/ngx_http_parse.c:1486:1: <LHS trace> 1484. 1485. 1486. ngx_int_t ^ 1487. ngx_http_arg(ngx_http_request_t *r, u_char *name, size_t len, ngx_str_t *value) 1488. { src/http/ngx_http_parse.c:1486:1: Parameter `len` 1484. 1485. 1486. ngx_int_t ^ 1487. ngx_http_arg(ngx_http_request_t *r, u_char *name, size_t len, ngx_str_t *value) 1488. { src/http/ngx_http_parse.c:1502:13: Binary operation: ([0, +oo] - 1):unsigned64 by call to `ngx_http_arg` 1500. /* we need '=' after name, so drop one char from last */ 1501. 1502. p = ngx_strlcasestrn(p, last - 1, name, len - 1); ^ 1503. 1504. if (p == NULL) {
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/http/ngx_http_parse.c/#L1502
d2a_code_trace_data_43264
size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) { int len = strlen(dst); va_list vl; va_start(vl, fmt); len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); va_end(vl); return len; } libavformat/rtsp.c:966: error: Integer Overflow R2 ([0, +oo] + [0, +oo]):signed32 by call to `av_strlcatf`. libavformat/rtsp.c:886:1: Parameter `transport.strlen` 884. * @returns 0 on success, <0 on error, 1 if protocol is unavailable. 885. */ 886. static int ^ 887. make_setup_request (AVFormatContext *s, const char *host, int port, 888. int lower_transport, const char *real_challenge) libavformat/rtsp.c:966:13: Call 964. if (rt->server_type != RTSP_SERVER_REAL) 965. av_strlcat(transport, "unicast;", sizeof(transport)); 966. av_strlcatf(transport, sizeof(transport), ^ 967. "client_port=%d", port); 968. if (rt->transport == RTSP_TRANSPORT_RTP && libavutil/avstring.c:68:1: <LHS trace> 66. } 67. 68. size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) ^ 69. { 70. int len = strlen(dst); libavutil/avstring.c:68:1: Parameter `size` 66. } 67. 68. size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) ^ 69. { 70. int len = strlen(dst); libavutil/avstring.c:74:12: <RHS trace> 72. 73. va_start(vl, fmt); 74. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); ^ 75. va_end(vl); 76. libavutil/avstring.c:74:12: Risky value from: vsnprintf 72. 73. va_start(vl, fmt); 74. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); ^ 75. va_end(vl); 76. libavutil/avstring.c:74:5: Binary operation: ([0, +oo] + [0, +oo]):signed32 by call to `av_strlcatf` 72. 73. va_start(vl, fmt); 74. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); ^ 75. va_end(vl); 76.
https://github.com/libav/libav/blob/184bc53db4fded8857af09cee2adc7197940deb7/libavutil/avstring.c/#L74
d2a_code_trace_data_43265
static void ngx_http_limit_zone_cleanup(void *data) { ngx_http_limit_zone_cleanup_t *lzcln = data; ngx_slab_pool_t *shpool; ngx_rbtree_node_t *node; ngx_http_limit_zone_ctx_t *ctx; ngx_http_limit_zone_node_t *lz; ctx = lzcln->shm_zone->data; shpool = (ngx_slab_pool_t *) lzcln->shm_zone->shm.addr; node = lzcln->node; lz = (ngx_http_limit_zone_node_t *) &node->color; ngx_shmtx_lock(&shpool->mutex); ngx_log_debug2(NGX_LOG_DEBUG_HTTP, lzcln->shm_zone->shm.log, 0, "limit zone cleanup: %08XD %d", node->key, lz->conn); lz->conn--; if (lz->conn == 0) { ngx_rbtree_delete(ctx->rbtree, node); ngx_slab_free_locked(shpool, node); } ngx_shmtx_unlock(&shpool->mutex); } src/http/modules/ngx_http_limit_zone_module.c:303: error: Integer Overflow L1 (0 - 1):unsigned16. src/http/modules/ngx_http_limit_zone_module.c:298:5: <LHS trace> 296. lz = (ngx_http_limit_zone_node_t *) &node->color; 297. 298. ngx_shmtx_lock(&shpool->mutex); ^ 299. 300. ngx_log_debug2(NGX_LOG_DEBUG_HTTP, lzcln->shm_zone->shm.log, 0, src/http/modules/ngx_http_limit_zone_module.c:298:5: Call 296. lz = (ngx_http_limit_zone_node_t *) &node->color; 297. 298. ngx_shmtx_lock(&shpool->mutex); ^ 299. 300. ngx_log_debug2(NGX_LOG_DEBUG_HTTP, lzcln->shm_zone->shm.log, 0, src/core/ngx_spinlock.c:11:1: Parameter `*lock` 9. 10. 11. void ^ 12. ngx_spinlock(ngx_atomic_t *lock, ngx_atomic_int_t value, ngx_uint_t spin) 13. { src/http/modules/ngx_http_limit_zone_module.c:303:5: Binary operation: (0 - 1):unsigned16 301. "limit zone cleanup: %08XD %d", node->key, lz->conn); 302. 303. lz->conn--; ^ 304. 305. if (lz->conn == 0) {
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/http/modules/ngx_http_limit_zone_module.c/#L303
d2a_code_trace_data_43266
static ossl_inline void packet_forward(PACKET *pkt, size_t len) { pkt->curr += len; pkt->remaining -= len; } test/servername_test.c:51: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 5):unsigned64 by call to `PACKET_forward`. Showing all 10 steps of the trace test/servername_test.c:49:10: Call 47. 48. len = BIO_get_mem_data(bio, (char **)&data); 49. if (!TEST_true(PACKET_buf_init(&pkt, data, len)) ^ 50. /* Skip the record header */ 51. || !PACKET_forward(&pkt, SSL3_RT_HEADER_LENGTH) ssl/packet_locl.h:68:8: Parameter `pkt->remaining` 66. * is being used. 67. */ 68. __owur static ossl_inline int PACKET_buf_init(PACKET *pkt, ^ 69. const unsigned char *buf, 70. size_t len) test/servername_test.c:51:17: Call 49. if (!TEST_true(PACKET_buf_init(&pkt, data, len)) 50. /* Skip the record header */ 51. || !PACKET_forward(&pkt, SSL3_RT_HEADER_LENGTH) ^ 52. /* Skip the handshake message header */ 53. || !TEST_true(PACKET_forward(&pkt, SSL3_HM_HEADER_LENGTH)) ssl/packet_locl.h:463:8: Parameter `len` 461. 462. /* Move the current reading position forward |len| bytes */ 463. __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len) ^ 464. { 465. if (PACKET_remaining(pkt) < len) ssl/packet_locl.h:468:5: Call 466. return 0; 467. 468. packet_forward(pkt, len); ^ 469. 470. return 1; ssl/packet_locl.h:29:1: <LHS trace> 27. 28. /* Internal unchecked shorthand; don't use outside this file. */ 29. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 30. { 31. pkt->curr += len; ssl/packet_locl.h:29:1: Parameter `pkt->remaining` 27. 28. /* Internal unchecked shorthand; don't use outside this file. */ 29. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 30. { 31. pkt->curr += len; ssl/packet_locl.h:29:1: <RHS trace> 27. 28. /* Internal unchecked shorthand; don't use outside this file. */ 29. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 30. { 31. pkt->curr += len; ssl/packet_locl.h:29:1: Parameter `len` 27. 28. /* Internal unchecked shorthand; don't use outside this file. */ 29. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 30. { 31. pkt->curr += len; ssl/packet_locl.h:32:5: Binary operation: ([0, +oo] - 5):unsigned64 by call to `PACKET_forward` 30. { 31. pkt->curr += len; 32. pkt->remaining -= len; ^ 33. } 34.
https://github.com/openssl/openssl/blob/2e6b615f795e8ca8ae830a00079c4ea064eaae42/ssl/packet_locl.h/#L32
d2a_code_trace_data_43267
static void old_print_object_header(const char *name) { char *str, *p; if (!strcmp(name, "tags")) return; str = p = av_strdup(name); if (!str) return; while (*p) { *p = av_toupper(*p); p++; } avio_printf(probe_out, "[%s]\n", str); av_freep(&str); } avprobe.c:360: error: Memory Leak memory dynamically allocated by call to `av_strdup()` at line 351, column 15 is not reachable after line 360, column 5. avprobe.c:344:1: start of procedure old_print_object_header() 342. * old-style pseudo-INI 343. */ 344. static void old_print_object_header(const char *name) ^ 345. { 346. char *str, *p; avprobe.c:348:10: Taking false branch 346. char *str, *p; 347. 348. if (!strcmp(name, "tags")) ^ 349. return; 350. avprobe.c:351:5: 349. return; 350. 351. str = p = av_strdup(name); ^ 352. if (!str) 353. return; libavutil/mem.c:196:1: start of procedure av_strdup() 194. } 195. 196. char *av_strdup(const char *s) ^ 197. { 198. char *ptr = NULL; libavutil/mem.c:198:5: 196. char *av_strdup(const char *s) 197. { 198. char *ptr = NULL; ^ 199. if (s) { 200. int len = strlen(s) + 1; libavutil/mem.c:199:9: Taking true branch 197. { 198. char *ptr = NULL; 199. if (s) { ^ 200. int len = strlen(s) + 1; 201. ptr = av_realloc(NULL, len); libavutil/mem.c:200:9: 198. char *ptr = NULL; 199. if (s) { 200. int len = strlen(s) + 1; ^ 201. ptr = av_realloc(NULL, len); 202. if (ptr) libavutil/mem.c:201:9: 199. if (s) { 200. int len = strlen(s) + 1; 201. ptr = av_realloc(NULL, len); ^ 202. if (ptr) 203. memcpy(ptr, s, len); libavutil/mem.c:107:1: start of procedure av_realloc() 105. } 106. 107. void *av_realloc(void *ptr, size_t size) ^ 108. { 109. /* let's disallow possibly ambiguous cases */ libavutil/mem.c:110:9: Taking false branch 108. { 109. /* let's disallow possibly ambiguous cases */ 110. if (size > (INT_MAX - 16)) ^ 111. return NULL; 112. libavutil/mem.c:116:5: 114. return _aligned_realloc(ptr, size, 32); 115. #else 116. return realloc(ptr, size); ^ 117. #endif 118. } libavutil/mem.c:118:1: return from a call to av_realloc 116. return realloc(ptr, size); 117. #endif 118. } ^ 119. 120. int av_reallocp(void *ptr, size_t size) libavutil/mem.c:202:13: Taking true branch 200. int len = strlen(s) + 1; 201. ptr = av_realloc(NULL, len); 202. if (ptr) ^ 203. memcpy(ptr, s, len); 204. } libavutil/mem.c:203:13: 201. ptr = av_realloc(NULL, len); 202. if (ptr) 203. memcpy(ptr, s, len); ^ 204. } 205. return ptr; libavutil/mem.c:205:5: 203. memcpy(ptr, s, len); 204. } 205. return ptr; ^ 206. } 207. libavutil/mem.c:206:1: return from a call to av_strdup 204. } 205. return ptr; 206. } ^ 207. 208. char *av_strndup(const char *s, size_t len) avprobe.c:352:10: Taking false branch 350. 351. str = p = av_strdup(name); 352. if (!str) ^ 353. return; 354. while (*p) { avprobe.c:354:12: Loop condition is true. Entering loop body 352. if (!str) 353. return; 354. while (*p) { ^ 355. *p = av_toupper(*p); 356. p++; avprobe.c:355:9: 353. return; 354. while (*p) { 355. *p = av_toupper(*p); ^ 356. p++; 357. } libavutil/avstring.h:182:1: start of procedure av_toupper() 180. * Locale-independent conversion of ASCII characters to uppercase. 181. */ 182. static inline av_const int av_toupper(int c) ^ 183. { 184. if (c >= 'a' && c <= 'z') libavutil/avstring.h:184:9: Taking false branch 182. static inline av_const int av_toupper(int c) 183. { 184. if (c >= 'a' && c <= 'z') ^ 185. c ^= 0x20; 186. return c; libavutil/avstring.h:186:5: 184. if (c >= 'a' && c <= 'z') 185. c ^= 0x20; 186. return c; ^ 187. } 188. libavutil/avstring.h:187:1: return from a call to av_toupper 185. c ^= 0x20; 186. return c; 187. } ^ 188. 189. /** avprobe.c:356:9: 354. while (*p) { 355. *p = av_toupper(*p); 356. p++; ^ 357. } 358. avprobe.c:354:12: Loop condition is false. Leaving loop 352. if (!str) 353. return; 354. while (*p) { ^ 355. *p = av_toupper(*p); 356. p++; avprobe.c:359:5: 357. } 358. 359. avio_printf(probe_out, "[%s]\n", str); ^ 360. av_freep(&str); 361. } libavformat/aviobuf.c:1014:1: start of procedure avio_printf() 1012. } 1013. 1014. int avio_printf(AVIOContext *s, const char *fmt, ...) ^ 1015. { 1016. va_list ap; libavformat/aviobuf.c:1020:5: 1018. int ret; 1019. 1020. va_start(ap, fmt); ^ 1021. ret = vsnprintf(buf, sizeof(buf), fmt, ap); 1022. va_end(ap); libavformat/aviobuf.c:1021:5: 1019. 1020. va_start(ap, fmt); 1021. ret = vsnprintf(buf, sizeof(buf), fmt, ap); ^ 1022. va_end(ap); 1023. avio_write(s, buf, strlen(buf)); libavformat/aviobuf.c:1022:5: 1020. va_start(ap, fmt); 1021. ret = vsnprintf(buf, sizeof(buf), fmt, ap); 1022. va_end(ap); ^ 1023. avio_write(s, buf, strlen(buf)); 1024. return ret; libavformat/aviobuf.c:1023:5: Skipping avio_write(): empty list of specs 1021. ret = vsnprintf(buf, sizeof(buf), fmt, ap); 1022. va_end(ap); 1023. avio_write(s, buf, strlen(buf)); ^ 1024. return ret; 1025. } libavformat/aviobuf.c:1024:5: 1022. va_end(ap); 1023. avio_write(s, buf, strlen(buf)); 1024. return ret; ^ 1025. } 1026. libavformat/aviobuf.c:1025:1: return from a call to avio_printf 1023. avio_write(s, buf, strlen(buf)); 1024. return ret; 1025. } ^ 1026. 1027. int avio_pause(AVIOContext *s, int pause) avprobe.c:360:5: Skipping av_freep(): empty list of specs 358. 359. avio_printf(probe_out, "[%s]\n", str); 360. av_freep(&str); ^ 361. } 362.
https://github.com/libav/libav/blob/d0a603a534a0ee4b255e5e72742428a7f7f42b83/avprobe.c/#L360
d2a_code_trace_data_43268
void TIFFSwabArrayOfDouble(double* dp, tmsize_t n) { register unsigned char *cp; register unsigned char t; assert(sizeof(double)==8); while (n-- > 0) { cp = (unsigned char *)dp; t = cp[7]; cp[7] = cp[0]; cp[0] = t; t = cp[6]; cp[6] = cp[1]; cp[1] = t; t = cp[5]; cp[5] = cp[2]; cp[2] = t; t = cp[4]; cp[4] = cp[3]; cp[3] = t; dp++; } } tools/thumbnail.c:616: error: Buffer Overrun L3 Offset: [7, +oo] (⇐ [0, +oo] + 7) Size: [0, +oo] by call to `TIFFWriteDirectory`. tools/thumbnail.c:563:1: Parameter `out->tif_dir.td_samplesperpixel` 561. } 562. 563. static int ^ 564. generateThumbnail(TIFF* in, TIFF* out) 565. { tools/thumbnail.c:615:13: Call 613. diroff[0] = 0UL; 614. TIFFSetField(out, TIFFTAG_SUBIFD, 1, diroff); 615. return (TIFFWriteEncodedStrip(out, 0, thumbnail, tnw*tnh) != -1 && ^ 616. TIFFWriteDirectory(out) != -1); 617. } libtiff/tif_write.c:183:1: Parameter `tif->tif_dir.td_samplesperpixel` 181. * NB: Image length must be setup before writing. 182. */ 183. tmsize_t ^ 184. TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc) 185. { tools/thumbnail.c:616:13: Call 614. TIFFSetField(out, TIFFTAG_SUBIFD, 1, diroff); 615. return (TIFFWriteEncodedStrip(out, 0, thumbnail, tnw*tnh) != -1 && 616. TIFFWriteDirectory(out) != -1); ^ 617. } 618. libtiff/tif_dirwrite.c:163:1: Parameter `tif->tif_dir.td_samplesperpixel` 161. * storage that's been changed. 162. */ 163. int ^ 164. TIFFWriteDirectory(TIFF* tif) 165. { libtiff/tif_dirwrite.c:166:9: Call 164. TIFFWriteDirectory(TIFF* tif) 165. { 166. return TIFFWriteDirectorySec(tif,TRUE,TRUE,NULL); ^ 167. } 168. libtiff/tif_dirwrite.c:345:1: Parameter `tif->tif_dir.td_samplesperpixel` 343. } 344. 345. static int ^ 346. TIFFWriteDirectorySec(TIFF* tif, int isimage, int imagedone, uint64* pdiroff) 347. { libtiff/tif_dirwrite.c:555:10: Call 553. if (TIFFFieldSet(tif,FIELD_SMINSAMPLEVALUE)) 554. { 555. if (!TIFFWriteDirectoryTagSampleformatPerSample(tif,&ndir,dir,TIFFTAG_SMINSAMPLEVALUE,tif->tif_dir.td_sminsamplevalue)) ^ 556. goto bad; 557. } libtiff/tif_dirwrite.c:897:1: Parameter `tif->tif_dir.td_samplesperpixel` 895. } 896. 897. static int ^ 898. TIFFWriteDirectoryTagSampleformatPerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, double value) 899. { libtiff/tif_dirwrite.c:906:12: Call 904. return(TIFFWriteDirectoryTagFloatPerSample(tif,ndir,dir,tag,(float)value)); 905. else 906. return(TIFFWriteDirectoryTagDoublePerSample(tif,ndir,dir,tag,value)); ^ 907. case SAMPLEFORMAT_INT: 908. if (tif->tif_dir.td_bitspersample<=8) libtiff/tif_dirwrite.c:1394:1: Parameter `tif->tif_dir.td_samplesperpixel` 1392. } 1393. 1394. static int TIFFWriteDirectoryTagDoublePerSample(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, double value) ^ 1395. { 1396. static const char module[] = "TIFFWriteDirectoryTagDoublePerSample"; libtiff/tif_dirwrite.c:1406:4: Call 1404. return(1); 1405. } 1406. m=_TIFFmalloc(tif->tif_dir.td_samplesperpixel*sizeof(double)); ^ 1407. if (m==NULL) 1408. { libtiff/tif_unix.c:253:1: Parameter `s` 251. #endif 252. 253. void* ^ 254. _TIFFmalloc(tmsize_t s) 255. { libtiff/tif_unix.c:256:10: Array declaration 254. _TIFFmalloc(tmsize_t s) 255. { 256. return (malloc((size_t) s)); ^ 257. } 258. libtiff/tif_unix.c:256:2: Assignment 254. _TIFFmalloc(tmsize_t s) 255. { 256. return (malloc((size_t) s)); ^ 257. } 258. libtiff/tif_dirwrite.c:1406:2: Assignment 1404. return(1); 1405. } 1406. m=_TIFFmalloc(tif->tif_dir.td_samplesperpixel*sizeof(double)); ^ 1407. if (m==NULL) 1408. { libtiff/tif_dirwrite.c:1414:4: Call 1412. for (na=m, nb=0; nb<tif->tif_dir.td_samplesperpixel; na++, nb++) 1413. *na=value; 1414. o=TIFFWriteDirectoryTagCheckedDoubleArray(tif,ndir,dir,tag,tif->tif_dir.td_samplesperpixel,m); ^ 1415. _TIFFfree(m); 1416. return(o); libtiff/tif_dirwrite.c:2138:1: Parameter `*value` 2136. #endif 2137. 2138. static int ^ 2139. TIFFWriteDirectoryTagCheckedDoubleArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, double* value) 2140. { libtiff/tif_dirwrite.c:2145:3: Call 2143. TIFFCvtNativeToIEEEDouble(tif,count,&value); 2144. if (tif->tif_flags&TIFF_SWAB) 2145. TIFFSwabArrayOfDouble(value,count); ^ 2146. return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_DOUBLE,count,count*8,value)); 2147. } libtiff/tif_swab.c:183:1: <Length trace> 181. 182. #ifndef TIFFSwabArrayOfDouble 183. void ^ 184. TIFFSwabArrayOfDouble(double* dp, tmsize_t n) 185. { libtiff/tif_swab.c:183:1: Parameter `*dp` 181. 182. #ifndef TIFFSwabArrayOfDouble 183. void ^ 184. TIFFSwabArrayOfDouble(double* dp, tmsize_t n) 185. { libtiff/tif_swab.c:191:3: Assignment 189. /* XXX unroll loop some */ 190. while (n-- > 0) { 191. cp = (unsigned char *)dp; ^ 192. t = cp[7]; cp[7] = cp[0]; cp[0] = t; 193. t = cp[6]; cp[6] = cp[1]; cp[1] = t; libtiff/tif_swab.c:192:7: Array access: Offset: [7, +oo] (⇐ [0, +oo] + 7) Size: [0, +oo] by call to `TIFFWriteDirectory` 190. while (n-- > 0) { 191. cp = (unsigned char *)dp; 192. t = cp[7]; cp[7] = cp[0]; cp[0] = t; ^ 193. t = cp[6]; cp[6] = cp[1]; cp[1] = t; 194. t = cp[5]; cp[5] = cp[2]; cp[2] = t;
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_swab.c/#L192
d2a_code_trace_data_43269
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_sp800_56b_check.c:133: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `rsa_check_prime_factor_range`. Showing all 16 steps of the trace crypto/rsa/rsa_sp800_56b_check.c:131:9: Call 129. 130. /* (Steps 5 a-b) prime test */ 131. if (BN_is_prime_fasttest_ex(p, checks, ctx, 1, NULL) != 1 ^ 132. /* (Step 5c) (√2)(2^(nbits/2 - 1) <= p <= 2^(nbits/2 - 1) */ 133. || rsa_check_prime_factor_range(p, nbits, ctx) != 1) crypto/bn/bn_prime.c:187:1: Parameter `ctx_passed->stack.depth` 185. 186. /* See FIPS 186-4 C.3.1 Miller Rabin Probabilistic Primality Test. */ 187. > int BN_is_prime_fasttest_ex(const BIGNUM *w, int checks, BN_CTX *ctx_passed, 188. int do_trial_division, BN_GENCB *cb) 189. { crypto/rsa/rsa_sp800_56b_check.c:133:16: Call 131. if (BN_is_prime_fasttest_ex(p, checks, ctx, 1, NULL) != 1 132. /* (Step 5c) (√2)(2^(nbits/2 - 1) <= p <= 2^(nbits/2 - 1) */ 133. || rsa_check_prime_factor_range(p, nbits, ctx) != 1) ^ 134. return 0; 135. crypto/rsa/rsa_sp800_56b_check.c:84:1: Parameter `ctx->stack.depth` 82. * 0xFFFFFFFF_FFFF.......................FFF 83. */ 84. > int rsa_check_prime_factor_range(const BIGNUM *p, int nbits, BN_CTX *ctx) 85. { 86. int ret = 0; crypto/rsa/rsa_sp800_56b_check.c:95:5: Call 93. return 0; 94. 95. BN_CTX_start(ctx); ^ 96. tmp = BN_CTX_get(ctx); 97. low = 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/rsa/rsa_sp800_56b_check.c:96:11: Call 94. 95. BN_CTX_start(ctx); 96. tmp = BN_CTX_get(ctx); ^ 97. low = BN_CTX_get(ctx); 98. 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/rsa/rsa_sp800_56b_check.c:97:11: Call 95. BN_CTX_start(ctx); 96. tmp = BN_CTX_get(ctx); 97. low = BN_CTX_get(ctx); ^ 98. 99. /* set low = (√2)(2^(nbits/2 - 1) */ 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/rsa/rsa_sp800_56b_check.c:113:5: Call 111. ret = 1; 112. err: 113. BN_CTX_end(ctx); ^ 114. return ret; 115. } crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <LHS trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `rsa_check_prime_factor_range` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_43270
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:1924: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_exp`. Showing all 19 steps of the trace test/bntest.c:1924:10: Call 1922. BN_zero(zero); 1923. 1924. if (!TEST_true(BN_mod_exp(r, a, zero, BN_value_one(), NULL)) ^ 1925. || !TEST_BN_eq_zero(r) 1926. || !TEST_true(BN_mod_exp_mont(r, a, zero, BN_value_one(), crypto/bn/bn_exp.c:91:1: Parameter `ctx->stack.depth` 89. } 90. 91. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 92. BN_CTX *ctx) 93. { crypto/bn/bn_exp.c: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 `ctx->stack.depth` 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:189:5: Call 187. } 188. 189. BN_CTX_start(ctx); ^ 190. aa = BN_CTX_get(ctx); 191. val[0] = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_exp.c:208:10: Call 206. } 207. 208. if (!BN_nnmod(val[0], a, m, ctx)) ^ 209. goto err; /* 1 */ 210. if (BN_is_zero(val[0])) { crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:193:5: Call 191. } 192. 193. BN_CTX_start(ctx); ^ 194. tmp = BN_CTX_get(ctx); 195. snum = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:416:5: Call 414. if (no_branch) 415. bn_correct_top(res); 416. BN_CTX_end(ctx); ^ 417. return (1); 418. err: crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.indexes` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:271:1: <Offset trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `st->depth` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: <Length trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `*st->indexes` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:273:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_exp` 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_43271
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dsa/dsa_ossl.c:229: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_MONT_CTX_set_locked`. Showing all 46 steps of the trace crypto/dsa/dsa_ossl.c:178:1: Parameter `ctx_in->stack.depth` 176. } 177. 178. > static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, 179. BIGNUM **kinvp, BIGNUM **rp, 180. const unsigned char *dgst, int dlen) crypto/dsa/dsa_ossl.c:229:14: Call 227. 228. if (dsa->flags & DSA_FLAG_CACHE_MONT_P) { 229. if (!BN_MONT_CTX_set_locked(&dsa->method_mont_p, ^ 230. dsa->lock, dsa->p, ctx)) 231. goto err; crypto/bn/bn_mont.c:428:1: Parameter `ctx->stack.depth` 426. } 427. 428. > BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_RWLOCK *lock, 429. const BIGNUM *mod, BN_CTX *ctx) 430. { crypto/bn/bn_mont.c:450:10: Call 448. if (ret == NULL) 449. return NULL; 450. if (!BN_MONT_CTX_set(ret, mod, ctx)) { ^ 451. BN_MONT_CTX_free(ret); 452. return NULL; crypto/bn/bn_mont.c:263:1: Parameter `ctx->stack.depth` 261. } 262. 263. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 264. { 265. int i, ret = 0; crypto/bn/bn_mont.c:271:5: Call 269. return 0; 270. 271. BN_CTX_start(ctx); ^ 272. if ((Ri = BN_CTX_get(ctx)) == NULL) 273. goto err; crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_mont.c:272:15: Call 270. 271. BN_CTX_start(ctx); 272. if ((Ri = BN_CTX_get(ctx)) == NULL) ^ 273. goto err; 274. R = &(mont->RR); /* grab RR as a temp */ crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_mont.c:351:19: Call 349. if (BN_is_one(&tmod)) 350. BN_zero(Ri); 351. else if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL) ^ 352. goto err; 353. if (!BN_lshift(Ri, Ri, BN_BITS2)) crypto/bn/bn_gcd.c:124:1: Parameter `ctx->stack.depth` 122. BN_CTX *ctx); 123. 124. > BIGNUM *BN_mod_inverse(BIGNUM *in, 125. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 126. { crypto/bn/bn_gcd.c:129:10: Call 127. BIGNUM *rv; 128. int noinv; 129. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv); ^ 130. if (noinv) 131. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); crypto/bn/bn_gcd.c:135:1: Parameter `ctx->stack.depth` 133. } 134. 135. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 136. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 137. int *pnoinv) crypto/bn/bn_gcd.c:155:16: Call 153. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) 154. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) { 155. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 156. } 157. crypto/bn/bn_gcd.c:458:1: Parameter `ctx->stack.depth` 456. * not contain branches that may leak sensitive information. 457. */ 458. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 459. const BIGNUM *a, const BIGNUM *n, 460. BN_CTX *ctx) crypto/bn/bn_gcd.c:469:5: Call 467. bn_check_top(n); 468. 469. BN_CTX_start(ctx); ^ 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gcd.c:470:9: Call 468. 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); ^ 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:471:9: Call 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); ^ 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:472:9: Call 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); ^ 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:473:9: Call 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); ^ 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:474:9: Call 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); ^ 475. Y = BN_CTX_get(ctx); 476. T = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:475:9: Call 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); ^ 476. T = BN_CTX_get(ctx); 477. if (T == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:476:9: Call 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); 476. T = BN_CTX_get(ctx); ^ 477. if (T == NULL) 478. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:504:18: Call 502. bn_init(&local_B); 503. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME); 504. if (!BN_nnmod(B, &local_B, A, ctx)) ^ 505. goto err; 506. /* Ensure local_B goes out of scope before any further use of B */ crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth` 207. * If 'dv' or 'rm' is NULL, the respective value is not returned. 208. */ 209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 210. BN_CTX *ctx) 211. { crypto/bn/bn_div.c:229:11: Call 227. } 228. 229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx); ^ 230. 231. if (ret) { crypto/bn/bn_div.c:280:5: Call 278. bn_check_top(rm); 279. 280. BN_CTX_start(ctx); ^ 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_div.c:450:5: Call 448. if (rm != NULL) 449. bn_rshift_fixed_top(rm, snum, norm_shift); 450. BN_CTX_end(ctx); ^ 451. return 1; 452. err: crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_MONT_CTX_set_locked` 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_43272
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); } ssl/statem/statem_srvr.c:2355: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `srp_generate_server_master_secret`. Showing all 29 steps of the trace ssl/statem/statem_srvr.c:2339:25: Call 2337. return 0; 2338. } 2339. if ((s->srp_ctx.A = BN_bin2bn(data, i, NULL)) == NULL) { ^ 2340. SSLerr(SSL_F_TLS_PROCESS_CKE_SRP, ERR_R_BN_LIB); 2341. return 0; crypto/bn/bn_lib.c:492:9: Assignment 490. n = len; 491. if (n == 0) { 492. ret->top = 0; ^ 493. return (ret); 494. } ssl/statem/statem_srvr.c:2355:10: Call 2353. } 2354. 2355. if (!srp_generate_server_master_secret(s)) { ^ 2356. SSLerr(SSL_F_TLS_PROCESS_CKE_SRP, ERR_R_INTERNAL_ERROR); 2357. return 0; ssl/tls_srp.c:284:1: Parameter `s->srp_ctx.A->top` 282. } 283. 284. > int srp_generate_server_master_secret(SSL *s) 285. { 286. BIGNUM *K = NULL, *u = NULL; ssl/tls_srp.c:290:10: Call 288. unsigned char *tmp = NULL; 289. 290. if (!SRP_Verify_A_mod_N(s->srp_ctx.A, s->srp_ctx.N)) ^ 291. goto err; 292. if ((u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) == NULL) crypto/srp/srp_lib.c:233:1: Parameter `A->top` 231. } 232. 233. > int SRP_Verify_A_mod_N(const BIGNUM *A, const BIGNUM *N) 234. { 235. /* Checks if A % N == 0 */ crypto/srp/srp_lib.c:236:12: Call 234. { 235. /* Checks if A % N == 0 */ 236. return SRP_Verify_B_mod_N(A, N); ^ 237. } 238. crypto/srp/srp_lib.c:212:1: Parameter `B->top` 210. } 211. 212. > int SRP_Verify_B_mod_N(const BIGNUM *B, const BIGNUM *N) 213. { 214. BIGNUM *r; ssl/tls_srp.c:292:14: Call 290. if (!SRP_Verify_A_mod_N(s->srp_ctx.A, s->srp_ctx.N)) 291. goto err; 292. if ((u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) == NULL) ^ 293. goto err; 294. if ((K = SRP_Calc_server_key(s->srp_ctx.A, s->srp_ctx.v, u, s->srp_ctx.b, crypto/srp/srp_lib.c:47:1: Parameter `A->top` 45. } 46. 47. > BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N) 48. { 49. /* k = SHA1(PAD(A) || PAD(B) ) -- tls-srp draft 8 */ crypto/srp/srp_lib.c:50:12: Call 48. { 49. /* k = SHA1(PAD(A) || PAD(B) ) -- tls-srp draft 8 */ 50. return srp_Calc_xy(A, B, N); ^ 51. } 52. crypto/srp/srp_lib.c:19:1: Parameter `x->top` 17. /* calculate = SHA1(PAD(x) || PAD(y)) */ 18. 19. > static BIGNUM *srp_Calc_xy(const BIGNUM *x, const BIGNUM *y, const BIGNUM *N) 20. { 21. unsigned char digest[SHA_DIGEST_LENGTH]; ssl/tls_srp.c:294:14: Call 292. if ((u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) == NULL) 293. goto err; 294. if ((K = SRP_Calc_server_key(s->srp_ctx.A, s->srp_ctx.v, u, s->srp_ctx.b, ^ 295. s->srp_ctx.N)) == NULL) 296. goto err; crypto/srp/srp_lib.c:53:1: Parameter `A->top` 51. } 52. 53. > BIGNUM *SRP_Calc_server_key(const BIGNUM *A, const BIGNUM *v, const BIGNUM *u, 54. const BIGNUM *b, const BIGNUM *N) 55. { crypto/srp/srp_lib.c:69:10: Call 67. if (!BN_mod_exp(tmp, v, u, N, bn_ctx)) 68. goto err; 69. if (!BN_mod_mul(tmp, A, tmp, N, bn_ctx)) ^ 70. goto err; 71. 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: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_generate_server_master_secret` 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_43273
int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *ret) { int ok = 0; BIGNUM *q = NULL; *ret = 0; q = BN_new(); if (q == NULL) goto err; BN_set_word(q, 1); if (BN_cmp(pub_key, q) <= 0) *ret |= DH_CHECK_PUBKEY_TOO_SMALL; BN_copy(q, dh->p); BN_sub_word(q, 1); if (BN_cmp(pub_key, q) >= 0) *ret |= DH_CHECK_PUBKEY_TOO_LARGE; ok = 1; err: BN_free(q); return (ok); } crypto/dh/dh_check.c:162: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 149, column 9 is not reachable after line 162, column 5. Showing all 56 steps of the trace crypto/dh/dh_check.c:143:1: start of procedure DH_check_pub_key() 141. } 142. 143. > int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *ret) 144. { 145. int ok = 0; crypto/dh/dh_check.c:145:5: 143. int DH_check_pub_key(const DH *dh, const BIGNUM *pub_key, int *ret) 144. { 145. > int ok = 0; 146. BIGNUM *q = NULL; 147. crypto/dh/dh_check.c:146:5: 144. { 145. int ok = 0; 146. > BIGNUM *q = NULL; 147. 148. *ret = 0; crypto/dh/dh_check.c:148:5: 146. BIGNUM *q = NULL; 147. 148. > *ret = 0; 149. q = BN_new(); 150. if (q == NULL) crypto/dh/dh_check.c:149:5: 147. 148. *ret = 0; 149. > q = BN_new(); 150. if (q == NULL) 151. goto err; 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) crypto/dh/dh_check.c:150:9: Taking false branch 148. *ret = 0; 149. q = BN_new(); 150. if (q == NULL) ^ 151. goto err; 152. BN_set_word(q, 1); crypto/dh/dh_check.c:152:5: 150. if (q == NULL) 151. goto err; 152. > BN_set_word(q, 1); 153. if (BN_cmp(pub_key, q) <= 0) 154. *ret |= DH_CHECK_PUBKEY_TOO_SMALL; 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) crypto/dh/dh_check.c:153:9: Taking false branch 151. goto err; 152. BN_set_word(q, 1); 153. if (BN_cmp(pub_key, q) <= 0) ^ 154. *ret |= DH_CHECK_PUBKEY_TOO_SMALL; 155. BN_copy(q, dh->p); crypto/dh/dh_check.c:155:5: Skipping BN_copy(): empty list of specs 153. if (BN_cmp(pub_key, q) <= 0) 154. *ret |= DH_CHECK_PUBKEY_TOO_SMALL; 155. BN_copy(q, dh->p); ^ 156. BN_sub_word(q, 1); 157. if (BN_cmp(pub_key, q) >= 0) crypto/dh/dh_check.c:156:5: Skipping BN_sub_word(): empty list of specs 154. *ret |= DH_CHECK_PUBKEY_TOO_SMALL; 155. BN_copy(q, dh->p); 156. BN_sub_word(q, 1); ^ 157. if (BN_cmp(pub_key, q) >= 0) 158. *ret |= DH_CHECK_PUBKEY_TOO_LARGE; crypto/dh/dh_check.c:157:9: Taking false branch 155. BN_copy(q, dh->p); 156. BN_sub_word(q, 1); 157. if (BN_cmp(pub_key, q) >= 0) ^ 158. *ret |= DH_CHECK_PUBKEY_TOO_LARGE; 159. crypto/dh/dh_check.c:160:5: 158. *ret |= DH_CHECK_PUBKEY_TOO_LARGE; 159. 160. > ok = 1; 161. err: 162. BN_free(q); crypto/dh/dh_check.c:161:2: 159. 160. ok = 1; 161. > err: 162. BN_free(q); 163. return (ok); crypto/dh/dh_check.c:162:5: 160. ok = 1; 161. err: 162. > BN_free(q); 163. return (ok); 164. } crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/dh/dh_check.c/#L162
d2a_code_trace_data_43274
int RAND_status(void) { const RAND_METHOD *meth = RAND_get_rand_method(); if (meth->status != NULL) return meth->status(); return 0; } crypto/rand/rand_lib.c:167: error: NULL_DEREFERENCE pointer `meth` last assigned on line 165 could be null and is dereferenced at line 167, column 9. Showing all 14 steps of the trace crypto/rand/rand_lib.c:163:1: start of procedure RAND_status() 161. #endif 162. 163. > int RAND_status(void) 164. { 165. const RAND_METHOD *meth = RAND_get_rand_method(); crypto/rand/rand_lib.c:165:5: 163. int RAND_status(void) 164. { 165. > const RAND_METHOD *meth = RAND_get_rand_method(); 166. 167. if (meth->status != 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:167:9: 165. const RAND_METHOD *meth = RAND_get_rand_method(); 166. 167. > if (meth->status != NULL) 168. return meth->status(); 169. return 0;
https://github.com/openssl/openssl/blob/12fb8c3d2dd00f3d4f1b084385403d26ed64a596/crypto/rand/rand_lib.c/#L167
d2a_code_trace_data_43275
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; } crypto/ec/ec_key.c:97: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `EC_GROUP_copy`. Showing all 21 steps of the trace crypto/ec/ec_key.c:97:14: Call 95. if (dest->group == NULL) 96. return NULL; 97. if (!EC_GROUP_copy(dest->group, src->group)) ^ 98. return NULL; 99. crypto/ec/ec_lib.c:130:1: Parameter `dest->cofactor->top` 128. } 129. 130. > int EC_GROUP_copy(EC_GROUP *dest, const EC_GROUP *src) 131. { 132. if (dest->meth->group_copy == 0) { crypto/ec/ec_lib.c:206:14: Call 204. if (!BN_copy(dest->order, src->order)) 205. return 0; 206. if (!BN_copy(dest->cofactor, src->cofactor)) ^ 207. return 0; 208. } crypto/bn/bn_lib.c:323:1: Parameter `a->top` 321. } 322. 323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 324. { 325. bn_check_top(b); crypto/bn/bn_lib.c:329:9: Call 327. if (a == b) 328. return a; 329. if (bn_wexpand(a, b->top) == NULL) ^ 330. return NULL; 331. crypto/bn/bn_lib.c:948:1: Parameter `a->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:284:1: Parameter `b->top` 282. */ 283. 284. > BIGNUM *bn_expand2(BIGNUM *b, int words) 285. { 286. bn_check_top(b); crypto/bn/bn_lib.c:289:23: Call 287. 288. if (words > b->dmax) { 289. BN_ULONG *a = bn_expand_internal(b, words); ^ 290. if (!a) 291. return NULL; crypto/bn/bn_lib.c:246:1: <Offset trace> 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:246:1: Parameter `b->top` 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:246:1: <Length trace> 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:246:1: Parameter `words` 244. /* This is used by bn_expand2() */ 245. /* The caller MUST check that words > b->dmax before calling this */ 246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 247. { 248. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:263:13: Call 261. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 262. else 263. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 264. if (a == NULL) { 265. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/mem.c:186:1: Parameter `num` 184. } 185. 186. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:188:17: Call 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. void *ret = CRYPTO_malloc(num, file, line); ^ 189. 190. FAILTEST(); crypto/mem.c:166:9: Assignment 164. 165. if (num == 0) 166. return NULL; ^ 167. 168. FAILTEST(); crypto/mem.c:188:5: Assignment 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. void *ret = CRYPTO_malloc(num, file, line); ^ 189. 190. FAILTEST(); crypto/mem.c:193:5: Assignment 191. if (ret != NULL) 192. memset(ret, 0, num); 193. return ret; ^ 194. } 195. crypto/bn/bn_lib.c:263:9: Assignment 261. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 262. else 263. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 264. if (a == NULL) { 265. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:271:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `EC_GROUP_copy` 269. assert(b->top <= words); 270. if (b->top > 0) 271. memcpy(a, b->d, sizeof(*a) * b->top); ^ 272. 273. return a;
https://github.com/openssl/openssl/blob/05eec39505ba8af6f3c1558a26c565987707cd37/crypto/bn/bn_lib.c/#L271
d2a_code_trace_data_43276
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:624: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_inv`. Showing all 19 steps of the trace test/bntest.c:624:13: Call 622. BN_bntest_rand(a, 512, 0, 0); 623. for (j = 0; j < 2; j++) { 624. BN_GF2m_mod_inv(c, a, b[j], ctx); ^ 625. BN_GF2m_mod_mul(d, a, c, b[j], ctx); 626. /* Test that ((1/a)*a) = 1. */ crypto/bn/bn_gf2m.c:560:1: Parameter `ctx->stack.depth` 558. * Curve Cryptography Over Binary Fields". 559. */ 560. > int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) 561. { 562. BIGNUM *b, *c = NULL, *u = NULL, *v = NULL, *tmp; crypto/bn/bn_gf2m.c:568:5: Call 566. bn_check_top(p); 567. 568. BN_CTX_start(ctx); ^ 569. 570. if ((b = 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_gf2m.c:724:5: Call 722. bn_correct_top(v); 723. # endif 724. BN_CTX_end(ctx); ^ 725. return ret; 726. } 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:625:13: Call 623. for (j = 0; j < 2; j++) { 624. BN_GF2m_mod_inv(c, a, b[j], ctx); 625. BN_GF2m_mod_mul(d, a, c, b[j], ctx); ^ 626. /* Test that ((1/a)*a) = 1. */ 627. if (!TEST_BN_eq_one(d)) 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:624:13: Call 622. BN_bntest_rand(a, 512, 0, 0); 623. for (j = 0; j < 2; j++) { 624. BN_GF2m_mod_inv(c, a, b[j], ctx); ^ 625. BN_GF2m_mod_mul(d, a, c, b[j], ctx); 626. /* Test that ((1/a)*a) = 1. */ crypto/bn/bn_gf2m.c:568:5: Call 566. bn_check_top(p); 567. 568. BN_CTX_start(ctx); ^ 569. 570. if ((b = BN_CTX_get(ctx)) == 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:724:5: Call 722. bn_correct_top(v); 723. # endif 724. BN_CTX_end(ctx); ^ 725. return ret; 726. } 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_inv` 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_43277
static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, OPENSSL_LH_DOALL_FUNC func, OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) { int i; OPENSSL_LH_NODE *a, *n; if (lh == NULL) return; for (i = lh->num_nodes - 1; i >= 0; i--) { a = lh->b[i]; while (a != NULL) { n = a->next; if (use_arg) func_arg(a->data, arg); else func(a->data); a = n; } } } test/sslapitest.c:5797: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `SSL_free`. Showing all 17 steps of the trace test/sslapitest.c:5756:10: Call 5754. } 5755. 5756. if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl, ^ 5757. NULL, NULL)) 5758. || !TEST_true(create_ssl_connection(serverssl, clientssl, test/ssltestlib.c:669:15: Call 667. if (*sssl != NULL) 668. serverssl = *sssl; 669. else if (!TEST_ptr(serverssl = SSL_new(serverctx))) ^ 670. goto error; 671. if (*cssl != NULL) ssl/ssl_lib.c:671:1: Parameter `ctx->sessions->num_nodes` 669. } 670. 671. > SSL *SSL_new(SSL_CTX *ctx) 672. { 673. SSL *s; test/sslapitest.c:5797:5: Call 5795. 5796. end: 5797. SSL_free(serverssl); ^ 5798. SSL_free(clientssl); 5799. SSL_CTX_free(sctx); 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, +oo] - 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_43278
int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, size_t len, size_t *written) { int i; SSL3_BUFFER *wb = s->rlayer.wbuf; size_t currbuf = 0; size_t tmpwrit = 0; if ((s->rlayer.wpend_tot > len) || ((s->rlayer.wpend_buf != buf) && !(s->mode & SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER)) || (s->rlayer.wpend_type != type)) { SSLerr(SSL_F_SSL3_WRITE_PENDING, SSL_R_BAD_WRITE_RETRY); return -1; } for (;;) { if (SSL3_BUFFER_get_left(&wb[currbuf]) == 0 && currbuf < s->rlayer.numwpipes - 1) { currbuf++; continue; } clear_sys_error(); if (s->wbio != NULL) { s->rwstate = SSL_WRITING; i = BIO_write(s->wbio, (char *) &(SSL3_BUFFER_get_buf(&wb[currbuf]) [SSL3_BUFFER_get_offset(&wb[currbuf])]), (unsigned int)SSL3_BUFFER_get_left(&wb[currbuf])); if (i >= 0) tmpwrit = i; } else { SSLerr(SSL_F_SSL3_WRITE_PENDING, SSL_R_BIO_NOT_SET); i = -1; } if (i > 0 && tmpwrit == SSL3_BUFFER_get_left(&wb[currbuf])) { SSL3_BUFFER_set_left(&wb[currbuf], 0); SSL3_BUFFER_add_offset(&wb[currbuf], tmpwrit); if (currbuf + 1 < s->rlayer.numwpipes) continue; s->rwstate = SSL_NOTHING; *written = s->rlayer.wpend_ret; return 1; } else if (i <= 0) { if (SSL_IS_DTLS(s)) { SSL3_BUFFER_set_left(&wb[currbuf], 0); } return (i); } SSL3_BUFFER_add_offset(&wb[currbuf], tmpwrit); SSL3_BUFFER_sub_left(&wb[currbuf], tmpwrit); } } ssl/record/rec_layer_d1.c:408: error: INTEGER_OVERFLOW_L2 ([0, max(1, `s->rlayer.numwpipes`)] - 1):unsigned64 by call to `dtls1_read_failed`. Showing all 25 steps of the trace ssl/record/rec_layer_d1.c:331:1: Parameter `s->rlayer.numwpipes` 329. * none of our business 330. */ 331. > int dtls1_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf, 332. size_t len, int peek, size_t *readbytes) 333. { ssl/record/rec_layer_d1.c:400:9: Call 398. 399. /* Check for timeout */ 400. if (dtls1_handle_timeout(s) > 0) ^ 401. goto start; 402. ssl/d1_lib.c:369:1: Parameter `s->rlayer.numwpipes` 367. } 368. 369. > int dtls1_handle_timeout(SSL *s) 370. { 371. /* if no timer is expired, don't do anything */ ssl/record/rec_layer_d1.c:406:16: Call 404. if ((SSL3_RECORD_get_length(rr) == 0) 405. || (s->rlayer.rstate == SSL_ST_READ_BODY)) { 406. iret = dtls1_get_record(s); ^ 407. if (iret <= 0) { 408. iret = dtls1_read_failed(s, iret); ssl/record/ssl3_record.c:1721:1: Parameter `s->rlayer.numwpipes` 1719. */ 1720. /* used only by dtls1_read_bytes */ 1721. > int dtls1_get_record(SSL *s) 1722. { 1723. int ssl_major, ssl_minor; ssl/record/ssl3_record.c:1739:10: Call 1737. * This is a non-blocking operation. 1738. */ 1739. if (!dtls1_process_buffered_records(s)) ^ 1740. return -1; 1741. ssl/record/rec_layer_d1.c:222:1: Parameter `s->rlayer.numwpipes` 220. &((s)->rlayer.d->unprocessed_rcds)) 221. 222. > int dtls1_process_buffered_records(SSL *s) 223. { 224. pitem *item; ssl/record/rec_layer_d1.c:408:20: Call 406. iret = dtls1_get_record(s); 407. if (iret <= 0) { 408. iret = dtls1_read_failed(s, iret); ^ 409. /* anything other than a timeout is an error */ 410. if (iret <= 0) ssl/statem/statem_dtls.c:919:1: Parameter `s->rlayer.numwpipes` 917. #endif 918. 919. > int dtls1_read_failed(SSL *s, int code) 920. { 921. if (code > 0) { ssl/statem/statem_dtls.c:940:12: Call 938. } 939. 940. return dtls1_handle_timeout(s); ^ 941. } 942. ssl/d1_lib.c:369:1: Parameter `s->rlayer.numwpipes` 367. } 368. 369. > int dtls1_handle_timeout(SSL *s) 370. { 371. /* if no timer is expired, don't do anything */ ssl/d1_lib.c:387:12: Call 385. 386. dtls1_start_timer(s); 387. return dtls1_retransmit_buffered_messages(s); ^ 388. } 389. ssl/statem/statem_dtls.c:958:1: Parameter `s->rlayer.numwpipes` 956. } 957. 958. > int dtls1_retransmit_buffered_messages(SSL *s) 959. { 960. pqueue *sent = s->d1->sent_messages; ssl/statem/statem_dtls.c:970:13: Call 968. for (item = pqueue_next(&iter); item != NULL; item = pqueue_next(&iter)) { 969. frag = (hm_fragment *)item->data; 970. if (dtls1_retransmit_message(s, (unsigned short) ^ 971. dtls1_get_queue_priority 972. (frag->msg_header.seq, ssl/statem/statem_dtls.c:1047:1: Parameter `s->rlayer.numwpipes` 1045. } 1046. 1047. > int dtls1_retransmit_message(SSL *s, unsigned short seq, int *found) 1048. { 1049. int ret; ssl/statem/statem_dtls.c:1104:11: Call 1102. saved_retransmit_state.epoch); 1103. 1104. ret = dtls1_do_write(s, frag->msg_header.is_ccs ? ^ 1105. SSL3_RT_CHANGE_CIPHER_SPEC : SSL3_RT_HANDSHAKE); 1106. ssl/statem/statem_dtls.c:109:1: Parameter `s->rlayer.numwpipes` 107. * SSL3_RT_CHANGE_CIPHER_SPEC) 108. */ 109. > int dtls1_do_write(SSL *s, int type) 110. { 111. int ret; ssl/statem/statem_dtls.c:239:15: Call 237. } 238. 239. ret = dtls1_write_bytes(s, type, &s->init_buf->data[s->init_off], len, ^ 240. &written); 241. if (ret < 0) { ssl/record/rec_layer_d1.c:730:1: Parameter `s->rlayer.numwpipes` 728. * not all data has been sent or non-blocking IO. 729. */ 730. > int dtls1_write_bytes(SSL *s, int type, const void *buf, size_t len, 731. size_t *written) 732. { ssl/record/rec_layer_d1.c:740:9: Call 738. } 739. s->rwstate = SSL_NOTHING; 740. i = do_dtls1_write(s, type, buf, len, 0, written); ^ 741. return i; 742. } ssl/record/rec_layer_d1.c:744:1: Parameter `s->rlayer.numwpipes` 742. } 743. 744. > int do_dtls1_write(SSL *s, int type, const unsigned char *buf, 745. size_t len, int create_empty_fragment, size_t *written) 746. { ssl/record/rec_layer_d1.c:936:12: Call 934. 935. /* we now just need to write the buffer */ 936. return ssl3_write_pending(s, type, buf, len, written); ^ 937. err: 938. return -1; ssl/record/rec_layer_s3.c:1058:1: <LHS trace> 1056. * Return values are as per SSL_write() 1057. */ 1058. > int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, size_t len, 1059. size_t *written) 1060. { ssl/record/rec_layer_s3.c:1058:1: Parameter `s->rlayer.numwpipes` 1056. * Return values are as per SSL_write() 1057. */ 1058. > int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, size_t len, 1059. size_t *written) 1060. { ssl/record/rec_layer_s3.c:1077:16: Binary operation: ([0, max(1, s->rlayer.numwpipes)] - 1):unsigned64 by call to `dtls1_read_failed` 1075. /* Loop until we find a buffer we haven't written out yet */ 1076. if (SSL3_BUFFER_get_left(&wb[currbuf]) == 0 1077. && currbuf < s->rlayer.numwpipes - 1) { ^ 1078. currbuf++; 1079. continue;
https://github.com/openssl/openssl/blob/7f7eb90b8ac55997c5c825bb3ebcfe28611e06f5/ssl/record/rec_layer_s3.c/#L1077
d2a_code_trace_data_43279
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/sm2/sm2_sign.c:202: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_add`. Showing all 17 steps of the trace crypto/sm2/sm2_sign.c:172:5: Call 170. goto done; 171. 172. BN_CTX_start(ctx); ^ 173. 174. t = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/sm2/sm2_sign.c:202:9: Call 200. goto done; 201. 202. if (BN_mod_add(t, r, s, order, ctx) == 0) ^ 203. goto done; 204. crypto/bn/bn_mod.c:28:1: Parameter `ctx->stack.depth` 26. } 27. 28. > int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 29. BN_CTX *ctx) 30. { crypto/bn/bn_mod.c:33:12: Call 31. if (!BN_add(r, a, b)) 32. return 0; 33. return BN_nnmod(r, r, m, ctx); ^ 34. } 35. crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:190:5: Call 188. } 189. 190. BN_CTX_start(ctx); ^ 191. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 192. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:410:5: Call 408. if (no_branch) 409. bn_correct_top(res); 410. BN_CTX_end(ctx); ^ 411. return 1; 412. err: crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.indexes` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:271:1: <Offset trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `st->depth` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: <Length trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `*st->indexes` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:273:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_add` 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/440bce8f813fa661437ce52378c3df38e2fd073b/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_43280
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) { bn_check_top(b); if (a == b) return a; if (bn_wexpand(a, b->top) == NULL) return NULL; if (b->top > 0) memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); a->top = b->top; a->neg = b->neg; bn_check_top(a); return a; } crypto/sm2/sm2_crypt.c:329: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `EC_POINT_mul`. Showing all 16 steps of the trace crypto/sm2/sm2_crypt.c:329:17: Call 327. if (!EC_POINT_set_affine_coordinates_GFp(group, C1, sm2_ctext->C1x, 328. sm2_ctext->C1y, ctx) 329. || !EC_POINT_mul(group, C1, NULL, C1, EC_KEY_get0_private_key(key), ^ 330. ctx) 331. || !EC_POINT_get_affine_coordinates_GFp(group, C1, x2, y2, ctx)) { crypto/ec/ec_lib.c:929:1: Parameter `p_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 `(*scalars)->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 `(*scalars)->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:403:16: Call 401. * we always call the constant time version. 402. */ 403. return ec_mul_consttime(group, r, scalars[0], points[0], ctx); ^ 404. } 405. 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_43281
void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){ int i; InternalBuffer *buf, *last; assert(pic->type==FF_BUFFER_TYPE_INTERNAL); assert(s->internal_buffer_count); if(s->internal_buffer){ buf = NULL; for(i=0; i<s->internal_buffer_count; i++){ buf= &((InternalBuffer*)s->internal_buffer)[i]; if(buf->data[0] == pic->data[0]) break; } assert(i < s->internal_buffer_count); s->internal_buffer_count--; last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count]; FFSWAP(InternalBuffer, *buf, *last); } for(i=0; i<4; i++){ pic->data[i]=NULL; } if(s->debug&FF_DEBUG_BUFFERS) av_log(s, AV_LOG_DEBUG, "default_release_buffer called on pic %p, %d buffers used\n", pic, s->internal_buffer_count); } libavcodec/utils.c:373: error: Null Dereference pointer `buf` last assigned on line 363 could be null and is dereferenced at line 373, column 5. libavcodec/utils.c:355:1: start of procedure avcodec_default_release_buffer() 353. } 354. 355. void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){ ^ 356. int i; 357. InternalBuffer *buf, *last; libavcodec/utils.c:359:5: 357. InternalBuffer *buf, *last; 358. 359. assert(pic->type==FF_BUFFER_TYPE_INTERNAL); ^ 360. assert(s->internal_buffer_count); 361. libavcodec/utils.c:360:5: 358. 359. assert(pic->type==FF_BUFFER_TYPE_INTERNAL); 360. assert(s->internal_buffer_count); ^ 361. 362. if(s->internal_buffer){ libavcodec/utils.c:362:8: Taking true branch 360. assert(s->internal_buffer_count); 361. 362. if(s->internal_buffer){ ^ 363. buf = NULL; /* avoids warning */ 364. for(i=0; i<s->internal_buffer_count; i++){ //just 3-5 checks so is not worth to optimize libavcodec/utils.c:363:5: 361. 362. if(s->internal_buffer){ 363. buf = NULL; /* avoids warning */ ^ 364. for(i=0; i<s->internal_buffer_count; i++){ //just 3-5 checks so is not worth to optimize 365. buf= &((InternalBuffer*)s->internal_buffer)[i]; libavcodec/utils.c:364:9: 362. if(s->internal_buffer){ 363. buf = NULL; /* avoids warning */ 364. for(i=0; i<s->internal_buffer_count; i++){ //just 3-5 checks so is not worth to optimize ^ 365. buf= &((InternalBuffer*)s->internal_buffer)[i]; 366. if(buf->data[0] == pic->data[0]) libavcodec/utils.c:364:14: Loop condition is false. Leaving loop 362. if(s->internal_buffer){ 363. buf = NULL; /* avoids warning */ 364. for(i=0; i<s->internal_buffer_count; i++){ //just 3-5 checks so is not worth to optimize ^ 365. buf= &((InternalBuffer*)s->internal_buffer)[i]; 366. if(buf->data[0] == pic->data[0]) libavcodec/utils.c:369:5: 367. break; 368. } 369. assert(i < s->internal_buffer_count); ^ 370. s->internal_buffer_count--; 371. last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count]; libavcodec/utils.c:370:5: 368. } 369. assert(i < s->internal_buffer_count); 370. s->internal_buffer_count--; ^ 371. last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count]; 372. libavcodec/utils.c:371:5: 369. assert(i < s->internal_buffer_count); 370. s->internal_buffer_count--; 371. last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count]; ^ 372. 373. FFSWAP(InternalBuffer, *buf, *last); libavcodec/utils.c:373:5: 371. last = &((InternalBuffer*)s->internal_buffer)[s->internal_buffer_count]; 372. 373. FFSWAP(InternalBuffer, *buf, *last); ^ 374. } 375.
https://github.com/libav/libav/blob/4578435f35888c95b12a53a12cdab612ac3fef04/libavcodec/utils.c/#L373
d2a_code_trace_data_43282
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dsa/dsa_ossl.c:128: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_mul`. Showing all 16 steps of the trace crypto/dsa/dsa_ossl.c:92:10: Call 90. 91. redo: 92. if (!dsa_sign_setup(dsa, ctx, &kinv, &ret->r, dgst, dlen)) ^ 93. goto err; 94. crypto/dsa/dsa_ossl.c:175:1: Parameter `ctx_in->stack.depth` 173. } 174. 175. > static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, 176. BIGNUM **kinvp, BIGNUM **rp, 177. const unsigned char *dgst, int dlen) crypto/dsa/dsa_ossl.c:128:10: Call 126. if (!BN_mod_mul(tmp, blind, dsa->priv_key, dsa->q, ctx)) 127. goto err; 128. if (!BN_mod_mul(tmp, tmp, ret->r, dsa->q, ctx)) ^ 129. goto err; 130. crypto/bn/bn_mod.c:73:1: Parameter `ctx->stack.depth` 71. 72. /* slow but works */ 73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 74. BN_CTX *ctx) 75. { crypto/bn/bn_mod.c:83:5: Call 81. bn_check_top(m); 82. 83. BN_CTX_start(ctx); ^ 84. if ((t = BN_CTX_get(ctx)) == NULL) 85. goto err; crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mod.c:87:14: Call 85. goto err; 86. if (a == b) { 87. if (!BN_sqr(t, a, ctx)) ^ 88. goto err; 89. } else { crypto/bn/bn_sqr.c:17:1: Parameter `ctx->stack.depth` 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:32:5: Call 30. } 31. 32. BN_CTX_start(ctx); ^ 33. rr = (a != r) ? r : BN_CTX_get(ctx); 34. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_sqr.c:100:5: Call 98. bn_check_top(rr); 99. bn_check_top(tmp); 100. BN_CTX_end(ctx); ^ 101. return ret; 102. } crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.depth` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:274:1: <LHS trace> 272. } 273. 274. > static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:274:1: Parameter `st->depth` 272. } 273. 274. > static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:276:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_mul` 274. static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; ^ 277. } 278.
https://github.com/openssl/openssl/blob/a766aab93a282774e63ba918d0bb1c6680a5f292/crypto/bn/bn_ctx.c/#L276
d2a_code_trace_data_43283
static unsigned int read_ledword(const unsigned char **in) { const unsigned char *p = *in; unsigned int ret; ret = *p++; ret |= (*p++ << 8); ret |= (*p++ << 16); ret |= (*p++ << 24); *in = p; return ret; } crypto/pem/pvkfmt.c:766: error: BUFFER_OVERRUN_L3 Offset: 11 Size: [8, +oo] by call to `do_PVK_body`. Showing all 16 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: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 `keylen` 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:688:18: Call 686. goto err; 687. } 688. enctmp = OPENSSL_malloc(keylen + 8); ^ 689. if (enctmp == NULL) { 690. PEMerr(PEM_F_DO_PVK_BODY, 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:688:9: Assignment 686. goto err; 687. } 688. enctmp = OPENSSL_malloc(keylen + 8); ^ 689. if (enctmp == NULL) { 690. PEMerr(PEM_F_DO_PVK_BODY, ERR_R_MALLOC_FAILURE); crypto/pem/pvkfmt.c:705:9: Assignment 703. } 704. inlen = keylen - 8; 705. q = enctmp + 8; ^ 706. if (!EVP_DecryptInit_ex(cctx, EVP_rc4(), NULL, keybuf, NULL)) 707. goto err; crypto/pem/pvkfmt.c:712:17: Call 710. if (!EVP_DecryptFinal_ex(cctx, q + enctmplen, &enctmplen)) 711. goto err; 712. magic = read_ledword((const unsigned char **)&q); ^ 713. if (magic != MS_RSA2MAGIC && magic != MS_DSS2MAGIC) { 714. q = enctmp + 8; crypto/pem/pvkfmt.c:77:1: <Length trace> 75. */ 76. 77. > static unsigned int read_ledword(const unsigned char **in) 78. { 79. const unsigned char *p = *in; crypto/pem/pvkfmt.c:77:1: Parameter `**in` 75. */ 76. 77. > static unsigned int read_ledword(const unsigned char **in) 78. { 79. const unsigned char *p = *in; crypto/pem/pvkfmt.c:79:5: Assignment 77. static unsigned int read_ledword(const unsigned char **in) 78. { 79. const unsigned char *p = *in; ^ 80. unsigned int ret; 81. ret = *p++; crypto/pem/pvkfmt.c:81:12: Assignment 79. const unsigned char *p = *in; 80. unsigned int ret; 81. ret = *p++; ^ 82. ret |= (*p++ << 8); 83. ret |= (*p++ << 16); crypto/pem/pvkfmt.c:82:14: Assignment 80. unsigned int ret; 81. ret = *p++; 82. ret |= (*p++ << 8); ^ 83. ret |= (*p++ << 16); 84. ret |= (*p++ << 24); crypto/pem/pvkfmt.c:83:14: Assignment 81. ret = *p++; 82. ret |= (*p++ << 8); 83. ret |= (*p++ << 16); ^ 84. ret |= (*p++ << 24); 85. *in = p; crypto/pem/pvkfmt.c:84:13: Array access: Offset: 11 Size: [8, +oo] by call to `do_PVK_body` 82. ret |= (*p++ << 8); 83. ret |= (*p++ << 16); 84. ret |= (*p++ << 24); ^ 85. *in = p; 86. return ret;
https://github.com/openssl/openssl/blob/846ec07d904f9cc81d486db0db14fb84f61ff6e5/crypto/pem/pvkfmt.c/#L84
d2a_code_trace_data_43284
static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) { int ret, i, type, size, pts, flags, is_audio, next, pos; AVStream *st = NULL; for(;;){ pos = url_ftell(s->pb); url_fskip(s->pb, 4); type = get_byte(s->pb); size = get_be24(s->pb); pts = get_be24(s->pb); pts |= get_byte(s->pb) << 24; if (url_feof(s->pb)) return AVERROR(EIO); url_fskip(s->pb, 3); flags = 0; if(size == 0) continue; next= size + url_ftell(s->pb); if (type == FLV_TAG_TYPE_AUDIO) { is_audio=1; flags = get_byte(s->pb); } else if (type == FLV_TAG_TYPE_VIDEO) { is_audio=0; flags = get_byte(s->pb); } else { if (type == FLV_TAG_TYPE_META && size > 13+1+4) flv_read_metabody(s, next); else av_log(s, AV_LOG_ERROR, "skipping flv packet: type %d, size %d, flags %d\n", type, size, flags); url_fseek(s->pb, next, SEEK_SET); continue; } for(i=0;i<s->nb_streams;i++) { st = s->streams[i]; if (st->id == is_audio) break; } if(i == s->nb_streams){ av_log(NULL, AV_LOG_ERROR, "invalid stream\n"); st= create_stream(s, is_audio); } if( (st->discard >= AVDISCARD_NONKEY && !((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY || is_audio)) ||(st->discard >= AVDISCARD_BIDIR && ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_DISP_INTER && !is_audio)) || st->discard >= AVDISCARD_ALL ){ url_fseek(s->pb, next, SEEK_SET); continue; } if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY) av_add_index_entry(st, pos, pts, size, 0, AVINDEX_KEYFRAME); break; } if(!url_is_streamed(s->pb) && s->duration==AV_NOPTS_VALUE){ int size; const int pos= url_ftell(s->pb); const int fsize= url_fsize(s->pb); url_fseek(s->pb, fsize-4, SEEK_SET); size= get_be32(s->pb); url_fseek(s->pb, fsize-3-size, SEEK_SET); if(size == get_be24(s->pb) + 11){ s->duration= get_be24(s->pb) * (int64_t)AV_TIME_BASE / 1000; } url_fseek(s->pb, pos, SEEK_SET); } if(is_audio){ if(!st->codec->sample_rate || !st->codec->bits_per_sample || (!st->codec->codec_id && !st->codec->codec_tag)) { st->codec->channels = (flags & FLV_AUDIO_CHANNEL_MASK) == FLV_STEREO ? 2 : 1; if((flags & FLV_AUDIO_CODECID_MASK) == FLV_CODECID_NELLYMOSER_8HZ_MONO) st->codec->sample_rate= 8000; else st->codec->sample_rate = (44100 << ((flags & FLV_AUDIO_SAMPLERATE_MASK) >> FLV_AUDIO_SAMPLERATE_OFFSET) >> 3); st->codec->bits_per_sample = (flags & FLV_AUDIO_SAMPLESIZE_MASK) ? 16 : 8; flv_set_audio_codec(s, st, flags & FLV_AUDIO_CODECID_MASK); } }else{ size -= flv_set_video_codec(s, st, flags & FLV_VIDEO_CODECID_MASK); } ret= av_get_packet(s->pb, pkt, size - 1); if (ret <= 0) { return AVERROR(EIO); } pkt->size = ret; pkt->pts = pts; pkt->stream_index = st->index; if (is_audio || ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY)) pkt->flags |= PKT_FLAG_KEY; return ret; } libavformat/flvdec.c:373: error: Uninitialized Value The value read from pts was never initialized. libavformat/flvdec.c:373:5: 371. packet */ 372. pkt->size = ret; 373. pkt->pts = pts; ^ 374. pkt->stream_index = st->index; 375.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/flvdec.c/#L373
d2a_code_trace_data_43285
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/mpc8.c:130: error: Integer Overflow L2 ([1, +oo] - 4):unsigned32 by call to `bitstream_read`. libavcodec/mpc8.c:130:19: Call 128. bitstream_skip(&bc, 3); // sample rate 129. c->maxbands = bitstream_read(&bc, 5) + 1; 130. channels = bitstream_read(&bc, 4) + 1; ^ 131. if (channels > 2) { 132. avpriv_request_sample(avctx, "Multichannel MPC SV8"); libavcodec/bitstream.h:183:1: Parameter `n` 181. 182. /* Return n bits from the buffer. n has to be in the 0-32 range. */ 183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n) ^ 184. { 185. if (!n) libavcodec/bitstream.h:194:12: Call 192. } 193. 194. return get_val(bc, n); ^ 195. } 196. libavcodec/bitstream.h:130:1: <LHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `bc->bits_left` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: <RHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Binary operation: ([1, +oo] - 4):unsigned32 by call to `bitstream_read` 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret;
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L139
d2a_code_trace_data_43286
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:103: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `EC_POINT_mul`. Showing all 29 steps of the trace crypto/ec/ecdsa_ossl.c:77:10: Call 75. /* Preallocate space */ 76. order_bits = BN_num_bits(order); 77. if (!BN_set_bit(k, order_bits) ^ 78. || !BN_set_bit(r, order_bits) 79. || !BN_set_bit(X, order_bits)) crypto/bn/bn_lib.c:628:1: Parameter `a->top` 626. } 627. 628. > int BN_set_bit(BIGNUM *a, int n) 629. { 630. int i, j, k; crypto/ec/ecdsa_ossl.c:100:18: Call 98. } 99. } 100. } while (BN_is_zero(k)); ^ 101. 102. /* compute r the x-coordinate of generator * k */ crypto/bn/bn_lib.c:866:1: Parameter `a->top` 864. } 865. 866. > int BN_is_zero(const BIGNUM *a) 867. { 868. return a->top == 0; crypto/ec/ecdsa_ossl.c:103:14: Call 101. 102. /* compute r the x-coordinate of generator * k */ 103. if (!EC_POINT_mul(group, tmp_point, k, NULL, NULL, ctx)) { ^ 104. ECerr(EC_F_ECDSA_SIGN_SETUP, ERR_R_EC_LIB); 105. goto err; crypto/ec/ec_lib.c:971:1: Parameter `r->X->top` 969. } 970. 971. > int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, 972. const EC_POINT *point, const BIGNUM *p_scalar, BN_CTX *ctx) 973. { crypto/ec/ec_lib.c:982:12: Call 980. scalars[0] = p_scalar; 981. 982. return EC_POINTs_mul(group, r, g_scalar, ^ 983. (point != NULL 984. && p_scalar != NULL), points, scalars, ctx); crypto/ec/ec_lib.c:933:1: Parameter `r->X->top` 931. */ 932. 933. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 934. size_t num, const EC_POINT *points[], 935. const BIGNUM *scalars[], BN_CTX *ctx) crypto/ec/ec_lib.c:965:15: Call 963. else 964. /* use default */ 965. ret = ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx); ^ 966. 967. BN_CTX_free(new_ctx); crypto/ec/ec_mult.c:410:1: Parameter `r->X->top` 408. * in the addition if scalar != NULL 409. */ 410. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 411. size_t num, const EC_POINT *points[], const BIGNUM *scalars[], 412. BN_CTX *ctx) crypto/ec/ec_mult.c:453:20: Call 451. * always call the ladder version. 452. */ 453. return ec_scalar_mul_ladder(group, r, scalar, NULL, ctx); ^ 454. } 455. if ((scalar == NULL) && (num == 1) && (scalars[0] != group->order)) { crypto/ec/ec_mult.c:139:1: Parameter `r->X->top` 137. * Returns 1 on success, 0 otherwise. 138. */ 139. > int ec_scalar_mul_ladder(const EC_GROUP *group, EC_POINT *r, 140. const BIGNUM *scalar, const EC_POINT *point, 141. BN_CTX *ctx) crypto/ec/ec_mult.c:253:13: Call 251. || (bn_wexpand(s->Y, group_top) == NULL) 252. || (bn_wexpand(s->Z, group_top) == NULL) 253. || (bn_wexpand(r->X, group_top) == NULL) ^ 254. || (bn_wexpand(r->Y, group_top) == NULL) 255. || (bn_wexpand(r->Z, group_top) == NULL) crypto/bn/bn_lib.c:962:1: Parameter `a->top` 960. } 961. 962. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 963. { 964. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:964:37: Call 962. BIGNUM *bn_wexpand(BIGNUM *a, int words) 963. { 964. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 965. } 966. crypto/bn/bn_lib.c:245:1: Parameter `b->top` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `words` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:224:13: Call 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/mem.c:228:1: Parameter `num` 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:17: Call 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/mem.c:230:5: Assignment 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:235:5: Assignment 233. if (ret != NULL) 234. memset(ret, 0, num); 235. return ret; ^ 236. } 237. crypto/bn/bn_lib.c:224:9: Assignment 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `EC_POINT_mul` 230. assert(b->top <= words); 231. if (b->top > 0) 232. memcpy(a, b->d, sizeof(*a) * b->top); ^ 233. 234. return a;
https://github.com/openssl/openssl/blob/3051bf2afab7ac8b7b9c64e68755d1addd2fb8ff/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_43287
static size_t kat_entropy(RAND_DRBG *drbg, unsigned char **pout, int entropy, size_t min_len, size_t max_len, int prediction_resistance) { TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); t->entropycnt++; *pout = (unsigned char *)t->entropy; return t->entropylen; } test/drbgtest.c:143: error: NULL_DEREFERENCE pointer `t` last assigned on line 141 could be null and is dereferenced at line 143, column 5. Showing all 10 steps of the trace test/drbgtest.c:137:1: start of procedure kat_entropy() 135. } TEST_CTX; 136. 137. > static size_t kat_entropy(RAND_DRBG *drbg, unsigned char **pout, 138. int entropy, size_t min_len, size_t max_len, 139. int prediction_resistance) test/drbgtest.c:141:5: 139. int prediction_resistance) 140. { 141. > TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); 142. 143. t->entropycnt++; crypto/rand/drbg_lib.c:929:1: start of procedure RAND_DRBG_get_ex_data() 927. } 928. 929. > void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx) 930. { 931. return CRYPTO_get_ex_data(&drbg->ex_data, idx); crypto/rand/drbg_lib.c:931:5: 929. void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx) 930. { 931. > return CRYPTO_get_ex_data(&drbg->ex_data, idx); 932. } 933. crypto/ex_data.c:429:1: start of procedure CRYPTO_get_ex_data() 427. * particular index in the class used by this variable 428. */ 429. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 430. { 431. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) crypto/ex_data.c:431:9: Taking true branch 429. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 430. { 431. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) ^ 432. return NULL; 433. return sk_void_value(ad->sk, idx); crypto/ex_data.c:432:9: 430. { 431. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) 432. > return NULL; 433. return sk_void_value(ad->sk, idx); 434. } crypto/ex_data.c:434:1: return from a call to CRYPTO_get_ex_data 432. return NULL; 433. return sk_void_value(ad->sk, idx); 434. > } crypto/rand/drbg_lib.c:932:1: return from a call to RAND_DRBG_get_ex_data 930. { 931. return CRYPTO_get_ex_data(&drbg->ex_data, idx); 932. > } 933. 934. test/drbgtest.c:143:5: 141. TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); 142. 143. > t->entropycnt++; 144. *pout = (unsigned char *)t->entropy; 145. return t->entropylen;
https://github.com/openssl/openssl/blob/8d4f150f70d70d6c3e62661ed7cc16c2f751d8a1/test/drbgtest.c/#L143
d2a_code_trace_data_43288
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:669: error: INTEGER_OVERFLOW_L2 ([0, max(0, `ctx->sessions->num_nodes`)] - 1):unsigned32 by call to `SSL_free`. Showing all 15 steps of the trace ssl/ssl_lib.c:518:1: Parameter `ctx->sessions->num_nodes` 516. } 517. 518. > SSL *SSL_new(SSL_CTX *ctx) 519. { 520. SSL *s; ssl/ssl_lib.c:669:5: Call 667. return s; 668. err: 669. SSL_free(s); ^ 670. SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE); 671. return NULL; ssl/ssl_lib.c:926:1: Parameter `s->ctx->sessions->num_nodes` 924. } 925. 926. > void SSL_free(SSL *s) 927. { 928. int i; ssl/ssl_lib.c:998:5: Call 996. RECORD_LAYER_release(&s->rlayer); 997. 998. SSL_CTX_free(s->ctx); ^ 999. 1000. ASYNC_WAIT_CTX_free(s->waitctx); ssl/ssl_lib.c:2429:1: Parameter `a->sessions->num_nodes` 2427. } 2428. 2429. > void SSL_CTX_free(SSL_CTX *a) 2430. { 2431. int i; ssl/ssl_lib.c:2455:9: Call 2453. */ 2454. if (a->sessions != NULL) 2455. SSL_CTX_flush_sessions(a, 0); ^ 2456. 2457. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:974:1: Parameter `s->sessions->num_nodes` 972. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 973. 974. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 975. { 976. unsigned long i; ssl/ssl_sess.c:987:5: Call 985. i = lh_SSL_SESSION_get_down_load(s->sessions); 986. lh_SSL_SESSION_set_down_load(s->sessions, 0); 987. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp); ^ 988. lh_SSL_SESSION_set_down_load(s->sessions, i); 989. CRYPTO_THREAD_unlock(s->lock); ssl/ssl_sess.c:972:1: Parameter `lh->num_nodes` 970. } 971. 972. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 973. 974. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) ssl/ssl_sess.c:972:1: Call 970. } 971. 972. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 973. 974. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) crypto/lhash/lhash.c:182:1: Parameter `lh->num_nodes` 180. } 181. 182. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); crypto/lhash/lhash.c:184:5: Call 182. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); ^ 185. } 186. crypto/lhash/lhash.c:150:1: <LHS trace> 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:150:1: Parameter `lh->num_nodes` 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:164:10: Binary operation: ([0, max(0, ctx->sessions->num_nodes)] - 1):unsigned32 by call to `SSL_free` 162. * memory leaks otherwise 163. */ 164. for (i = lh->num_nodes - 1; i >= 0; i--) { ^ 165. a = lh->b[i]; 166. while (a != NULL) {
https://github.com/openssl/openssl/blob/2a7de0fd5d9baf946ef4d2c51096b04dd47a8143/crypto/lhash/lhash.c/#L164
d2a_code_trace_data_43289
void avfilter_unref_pic(AVFilterPicRef *ref) { if(!(--ref->pic->refcount)) ref->pic->free(ref->pic); av_free(ref); } ffmpeg.c:1782: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_pic`. ffmpeg.c:1782:17: Call 1780. ist->out_video_filter && avfilter_poll_frame(ist->out_video_filter->inputs[0]); 1781. if(ist->picref) 1782. avfilter_unref_pic(ist->picref); ^ 1783. } 1784. #endif libavfilter/avfilter.c:56:1: Parameter `ref->pic->refcount` 54. } 55. 56. void avfilter_unref_pic(AVFilterPicRef *ref) ^ 57. { 58. if(!(--ref->pic->refcount)) libavfilter/avfilter.c:58:10: Assignment 56. void avfilter_unref_pic(AVFilterPicRef *ref) 57. { 58. if(!(--ref->pic->refcount)) ^ 59. ref->pic->free(ref->pic); 60. av_free(ref); ffmpeg.c:1782:17: Call 1780. ist->out_video_filter && avfilter_poll_frame(ist->out_video_filter->inputs[0]); 1781. if(ist->picref) 1782. avfilter_unref_pic(ist->picref); ^ 1783. } 1784. #endif libavfilter/avfilter.c:56:1: <LHS trace> 54. } 55. 56. void avfilter_unref_pic(AVFilterPicRef *ref) ^ 57. { 58. if(!(--ref->pic->refcount)) libavfilter/avfilter.c:56:1: Parameter `ref->pic->refcount` 54. } 55. 56. void avfilter_unref_pic(AVFilterPicRef *ref) ^ 57. { 58. if(!(--ref->pic->refcount)) libavfilter/avfilter.c:58:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_pic` 56. void avfilter_unref_pic(AVFilterPicRef *ref) 57. { 58. if(!(--ref->pic->refcount)) ^ 59. ref->pic->free(ref->pic); 60. av_free(ref);
https://github.com/libav/libav/blob/748db0fcc486417225d4cb45d7d5488a00dcc4e3/libavfilter/avfilter.c/#L58
d2a_code_trace_data_43290
void avformat_free_context(AVFormatContext *s) { int i; AVStream *st; av_opt_free(s); if (s->iformat && s->iformat->priv_class && s->priv_data) av_opt_free(s->priv_data); for(i=0;i<s->nb_streams;i++) { st = s->streams[i]; if (st->parser) { av_parser_close(st->parser); } if (st->attached_pic.data) av_free_packet(&st->attached_pic); av_dict_free(&st->metadata); av_free(st->index_entries); av_free(st->codec->extradata); av_free(st->codec->subtitle_header); av_free(st->codec); av_free(st->priv_data); av_free(st->info); av_free(st); } for(i=s->nb_programs-1; i>=0; i--) { av_dict_free(&s->programs[i]->metadata); av_freep(&s->programs[i]->stream_index); av_freep(&s->programs[i]); } av_freep(&s->programs); av_freep(&s->priv_data); while(s->nb_chapters--) { av_dict_free(&s->chapters[s->nb_chapters]->metadata); av_free(s->chapters[s->nb_chapters]); } av_freep(&s->chapters); av_dict_free(&s->metadata); av_freep(&s->streams); av_free(s); } libavformat/segment.c:82: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `avformat_free_context`. libavformat/segment.c:82:9: Call 80. 81. if (write_header) { 82. avformat_free_context(oc); ^ 83. c->avf = NULL; 84. if ((err = segment_mux_init(s)) < 0) libavformat/utils.c:2623:1: <LHS trace> 2621. } 2622. 2623. void avformat_free_context(AVFormatContext *s) ^ 2624. { 2625. int i; libavformat/utils.c:2623:1: Parameter `s->nb_programs` 2621. } 2622. 2623. void avformat_free_context(AVFormatContext *s) ^ 2624. { 2625. int i; libavformat/utils.c:2649:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avformat_free_context` 2647. av_free(st); 2648. } 2649. for(i=s->nb_programs-1; i>=0; i--) { ^ 2650. av_dict_free(&s->programs[i]->metadata); 2651. av_freep(&s->programs[i]->stream_index);
https://github.com/libav/libav/blob/a7329e5fc22433dfeaf7af22fb40fe3cada21385/libavformat/utils.c/#L2649
d2a_code_trace_data_43291
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_key.c:395: 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_key.c:395:10: Call 393. } 394. /* 5.6.2.3.3 (Step 4) : pub_key * order is the point at infinity. */ 395. if (!EC_POINT_mul(eckey->group, point, NULL, eckey->pub_key, order, ctx)) { ^ 396. ECerr(EC_F_EC_KEY_SIMPLE_CHECK_KEY, ERR_R_EC_LIB); 397. goto err; crypto/ec/ec_lib.c:971:1: Parameter `r->X->top` 969. } 970. 971. > int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, 972. const EC_POINT *point, const BIGNUM *p_scalar, BN_CTX *ctx) 973. { crypto/ec/ec_lib.c:982:12: Call 980. scalars[0] = p_scalar; 981. 982. return EC_POINTs_mul(group, r, g_scalar, ^ 983. (point != NULL 984. && p_scalar != NULL), points, scalars, ctx); crypto/ec/ec_lib.c:933:1: Parameter `r->X->top` 931. */ 932. 933. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 934. size_t num, const EC_POINT *points[], 935. const BIGNUM *scalars[], BN_CTX *ctx) crypto/ec/ec_lib.c:965:15: Call 963. else 964. /* use default */ 965. ret = ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx); ^ 966. 967. BN_CTX_free(new_ctx); crypto/ec/ec_mult.c:410:1: Parameter `r->X->top` 408. * in the addition if scalar != NULL 409. */ 410. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 411. size_t num, const EC_POINT *points[], const BIGNUM *scalars[], 412. BN_CTX *ctx) crypto/ec/ec_mult.c:453:20: Call 451. * always call the ladder version. 452. */ 453. return ec_scalar_mul_ladder(group, r, scalar, NULL, ctx); ^ 454. } 455. if ((scalar == NULL) && (num == 1) && (scalars[0] != group->order)) { crypto/ec/ec_mult.c:139:1: Parameter `r->X->top` 137. * Returns 1 on success, 0 otherwise. 138. */ 139. > int ec_scalar_mul_ladder(const EC_GROUP *group, EC_POINT *r, 140. const BIGNUM *scalar, const EC_POINT *point, 141. BN_CTX *ctx) crypto/ec/ec_mult.c:253:13: Call 251. || (bn_wexpand(s->Y, group_top) == NULL) 252. || (bn_wexpand(s->Z, group_top) == NULL) 253. || (bn_wexpand(r->X, group_top) == NULL) ^ 254. || (bn_wexpand(r->Y, group_top) == NULL) 255. || (bn_wexpand(r->Z, group_top) == NULL) crypto/bn/bn_lib.c:962:1: Parameter `a->top` 960. } 961. 962. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 963. { 964. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:964:37: Call 962. BIGNUM *bn_wexpand(BIGNUM *a, int words) 963. { 964. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 965. } 966. crypto/bn/bn_lib.c:245:1: Parameter `b->top` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `words` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:224:13: Call 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/mem.c:228:1: Parameter `num` 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:17: Call 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/mem.c:230:5: Assignment 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:235:5: Assignment 233. if (ret != NULL) 234. memset(ret, 0, num); 235. return ret; ^ 236. } 237. crypto/bn/bn_lib.c:224:9: Assignment 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `EC_POINT_mul` 230. assert(b->top <= words); 231. if (b->top > 0) 232. memcpy(a, b->d, sizeof(*a) * b->top); ^ 233. 234. return a;
https://github.com/openssl/openssl/blob/3051bf2afab7ac8b7b9c64e68755d1addd2fb8ff/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_43292
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_exp.c:753: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `bn_to_mont_fixed_top`. Showing all 16 steps of the trace crypto/bn/bn_exp.c:592:1: Parameter `ctx->stack.depth` 590. * http://www.daemonology.net/hyperthreading-considered-harmful/) 591. */ 592. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 593. const BIGNUM *m, BN_CTX *ctx, 594. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:636:5: Call 634. } 635. 636. BN_CTX_start(ctx); ^ 637. 638. /* crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_exp.c:753:10: Call 751. } else 752. #endif 753. if (!bn_to_mont_fixed_top(&tmp, BN_value_one(), mont, ctx)) ^ 754. goto err; 755. crypto/bn/bn_mont.c:222:1: Parameter `ctx->stack.depth` 220. } 221. 222. > int bn_to_mont_fixed_top(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 223. BN_CTX *ctx) 224. { crypto/bn/bn_mont.c:225:12: Call 223. BN_CTX *ctx) 224. { 225. return bn_mul_mont_fixed_top(r, a, &(mont->RR), mont, ctx); ^ 226. } 227. crypto/bn/bn_mont.c:60:5: Call 58. return 0; 59. 60. BN_CTX_start(ctx); ^ 61. tmp = BN_CTX_get(ctx); 62. if (tmp == NULL) crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_mont.c:83:5: Call 81. ret = 1; 82. err: 83. BN_CTX_end(ctx); ^ 84. return ret; 85. } crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `bn_to_mont_fixed_top` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_43293
int pem_check_suffix(const char *pem_str, const char *suffix) { int pem_len = strlen(pem_str); int suffix_len = strlen(suffix); const char *p; if (suffix_len + 1 >= pem_len) return 0; p = pem_str + pem_len - suffix_len; if (strcmp(p, suffix)) return 0; p--; if (*p != ' ') return 0; return p - pem_str; } crypto/pem/pem_pkey.c:77: error: BUFFER_OVERRUN_L3 Offset: [-12, +oo] Size: [1, 241] by call to `pem_check_suffix`. Showing all 10 steps of the trace crypto/pem/pem_pkey.c:35:10: Call 33. EVP_PKEY *ret = NULL; 34. 35. if (!PEM_bytes_read_bio(&data, &len, &nm, PEM_STRING_EVP_PKEY, bp, cb, u)) ^ 36. return NULL; 37. p = data; crypto/pem/pem_lib.c:291:12: Call 289. const char *name, BIO *bp, pem_password_cb *cb, 290. void *u) { 291. return pem_bytes_read_bio_flags(pdata, plen, pnm, name, bp, cb, u, ^ 292. PEM_FLAG_EAY_COMPATIBLE); 293. } crypto/pem/pem_lib.c:260:14: Call 258. pem_free(header, flags); 259. pem_free(data, flags); 260. if (!PEM_read_bio_ex(bp, &nm, &header, &data, &len, flags)) { ^ 261. if (ERR_GET_REASON(ERR_peek_error()) == PEM_R_NO_START_LINE) 262. ERR_add_error_data(2, "Expecting: ", name); crypto/pem/pem_lib.c:958:5: Assignment 956. } 957. BIO_read(headerB, *header, headerlen); 958. (*header)[headerlen] = '\0'; ^ 959. BIO_read(dataB, *data, len); 960. *len_out = len; crypto/pem/pem_pkey.c:77:24: Call 75. } 76. PKCS8_PRIV_KEY_INFO_free(p8inf); 77. } else if ((slen = pem_check_suffix(nm, "PRIVATE KEY")) > 0) { ^ 78. const EVP_PKEY_ASN1_METHOD *ameth; 79. ameth = EVP_PKEY_asn1_find_str(NULL, nm, slen); crypto/pem/pem_lib.c:985:1: <Length trace> 983. */ 984. 985. > int pem_check_suffix(const char *pem_str, const char *suffix) 986. { 987. int pem_len = strlen(pem_str); crypto/pem/pem_lib.c:985:1: Parameter `*pem_str` 983. */ 984. 985. > int pem_check_suffix(const char *pem_str, const char *suffix) 986. { 987. int pem_len = strlen(pem_str); crypto/pem/pem_lib.c:992:5: Assignment 990. if (suffix_len + 1 >= pem_len) 991. return 0; 992. p = pem_str + pem_len - suffix_len; ^ 993. if (strcmp(p, suffix)) 994. return 0; crypto/pem/pem_lib.c:995:5: Assignment 993. if (strcmp(p, suffix)) 994. return 0; 995. p--; ^ 996. if (*p != ' ') 997. return 0; crypto/pem/pem_lib.c:996:9: Array access: Offset: [-12, +oo] Size: [1, 241] by call to `pem_check_suffix` 994. return 0; 995. p--; 996. if (*p != ' ') ^ 997. return 0; 998. return p - pem_str;
https://github.com/openssl/openssl/blob/7671342e550ed2de676b23c79d0e7f45a381c76e/crypto/pem/pem_lib.c/#L996
d2a_code_trace_data_43294
void *lh_delete(_LHASH *lh, const void *data) { unsigned long hash; LHASH_NODE *nn, **rn; void *ret; lh->error = 0; rn = getrn(lh, data, &hash); if (*rn == NULL) { lh->num_no_delete++; return (NULL); } else { nn = *rn; *rn = nn->next; ret = nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))) contract(lh); return (ret); } ssl/record/rec_layer_s3.c:1045: error: INTEGER_OVERFLOW_L2 ([0, max(0, `s->ctx->sessions->num_items`)] - 1):unsigned64 by call to `ssl3_get_record`. Showing all 13 steps of the trace ssl/record/rec_layer_s3.c:975:1: Parameter `s->ctx->sessions->num_items` 973. * none of our business 974. */ 975. > int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek) 976. { 977. int al, i, j, ret; ssl/record/rec_layer_s3.c:1045:15: Call 1043. if ((SSL3_RECORD_get_length(rr) == 0) 1044. || (s->rlayer.rstate == SSL_ST_READ_BODY)) { 1045. ret = ssl3_get_record(s); ^ 1046. if (ret <= 0) 1047. return (ret); ssl/record/ssl3_record.c:180:1: Parameter `s->ctx->sessions->num_items` 178. */ 179. /* used only by ssl3_read_bytes */ 180. > int ssl3_get_record(SSL *s) 181. { 182. int ssl_major, ssl_minor, al; ssl/record/ssl3_record.c:468:5: Call 466. 467. f_err: 468. ssl3_send_alert(s, SSL3_AL_FATAL, al); ^ 469. err: 470. return (ret); ssl/s3_msg.c:166:1: Parameter `s->ctx->sessions->num_items` 164. } 165. 166. > int ssl3_send_alert(SSL *s, int level, int desc) 167. { 168. /* Map tls/ssl alert value to correct one */ ssl/s3_msg.c:177:9: Call 175. /* If a fatal one, remove from cache */ 176. if ((level == SSL3_AL_FATAL) && (s->session != NULL)) 177. SSL_CTX_remove_session(s->ctx, s->session); ^ 178. 179. s->s3->alert_dispatch = 1; ssl/ssl_sess.c:675:1: Parameter `ctx->sessions->num_items` 673. } 674. 675. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 676. { 677. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:677:12: Call 675. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 676. { 677. return remove_session_lock(ctx, c, 1); ^ 678. } 679. ssl/ssl_sess.c:680:1: Parameter `ctx->sessions->num_items` 678. } 679. 680. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 681. { 682. SSL_SESSION *r; ssl/ssl_sess.c:690:17: Call 688. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 689. ret = 1; 690. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 691. SSL_SESSION_list_remove(ctx, c); 692. } crypto/lhash/lhash.c:211:1: <LHS trace> 209. } 210. 211. > void *lh_delete(_LHASH *lh, const void *data) 212. { 213. unsigned long hash; crypto/lhash/lhash.c:211:1: Parameter `lh->num_items` 209. } 210. 211. > void *lh_delete(_LHASH *lh, const void *data) 212. { 213. unsigned long hash; crypto/lhash/lhash.c:231:5: Binary operation: ([0, max(0, s->ctx->sessions->num_items)] - 1):unsigned64 by call to `ssl3_get_record` 229. } 230. 231. lh->num_items--; ^ 232. if ((lh->num_nodes > MIN_NODES) && 233. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
https://github.com/openssl/openssl/blob/747e16398d704a667cc99f8a0b1912c36b7de52d/crypto/lhash/lhash.c/#L231
d2a_code_trace_data_43295
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:1063: error: Uninitialized Value The value read from ymax was never initialized. libavcodec/motion_est_template.c:1063:9: 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) ^ 1064. CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift) 1065. CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1063
d2a_code_trace_data_43296
static ossl_inline void packet_forward(PACKET *pkt, size_t len) { pkt->curr += len; pkt->remaining -= len; } test/sslapitest.c:3127: error: INTEGER_OVERFLOW_L2 ([0, 9223372036854775807] - 4):unsigned64 by call to `PACKET_forward`. Showing all 13 steps of the trace test/sslapitest.c:3117:19: Assignment 3115. long len; 3116. unsigned char *data; 3117. PACKET pkt = {0}, pkt2 = {0}, pkt3 = {0}; ^ 3118. unsigned int MFL_code = 0, type = 0; 3119. test/sslapitest.c:3123:10: Call 3121. goto end; 3122. 3123. if (!TEST_true( PACKET_buf_init( &pkt, data, len ) ) ^ 3124. /* Skip the record header */ 3125. || !PACKET_forward(&pkt, SSL3_RT_HEADER_LENGTH) ssl/packet_locl.h:72:8: Parameter `pkt->remaining` 70. * is being used. 71. */ 72. __owur static ossl_inline int PACKET_buf_init(PACKET *pkt, ^ 73. const unsigned char *buf, 74. size_t len) test/sslapitest.c:3125:17: Call 3123. if (!TEST_true( PACKET_buf_init( &pkt, data, len ) ) 3124. /* Skip the record header */ 3125. || !PACKET_forward(&pkt, SSL3_RT_HEADER_LENGTH) ^ 3126. /* Skip the handshake message header */ 3127. || !TEST_true(PACKET_forward(&pkt, SSL3_HM_HEADER_LENGTH)) ssl/packet_locl.h:467:8: Parameter `len` 465. 466. /* Move the current reading position forward |len| bytes */ 467. __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len) ^ 468. { 469. if (PACKET_remaining(pkt) < len) test/sslapitest.c:3127:17: Call 3125. || !PACKET_forward(&pkt, SSL3_RT_HEADER_LENGTH) 3126. /* Skip the handshake message header */ 3127. || !TEST_true(PACKET_forward(&pkt, SSL3_HM_HEADER_LENGTH)) ^ 3128. /* Skip client version and random */ 3129. || !TEST_true(PACKET_forward(&pkt, CLIENT_VERSION_LEN ssl/packet_locl.h:467:8: Parameter `len` 465. 466. /* Move the current reading position forward |len| bytes */ 467. __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len) ^ 468. { 469. if (PACKET_remaining(pkt) < len) ssl/packet_locl.h:472:5: Call 470. return 0; 471. 472. packet_forward(pkt, len); ^ 473. 474. return 1; ssl/packet_locl.h:33:1: <LHS trace> 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: Parameter `pkt->remaining` 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: <RHS trace> 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: Parameter `len` 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:36:5: Binary operation: ([0, 9223372036854775807] - 4):unsigned64 by call to `PACKET_forward` 34. { 35. pkt->curr += len; 36. pkt->remaining -= len; ^ 37. } 38.
https://github.com/openssl/openssl/blob/9f5671c7e9f30dfa53b1a2b553f234c2761ceb66/ssl/packet_locl.h/#L36
d2a_code_trace_data_43297
static void opt_input_ts_scale(const char *arg) { unsigned int stream; double scale; char *p; stream = strtol(arg, &p, 0); if (*p) p++; scale= strtod(p, &p); if(stream >= MAX_STREAMS) ffmpeg_exit(1); input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); input_files_ts_scale[nb_input_files][stream]= scale; } ffmpeg.c:3049: error: Null Dereference pointer `input_files_ts_scale[nb_input_files]` last assigned on line 3048 could be null and is dereferenced at line 3049, column 5. ffmpeg.c:3034:1: start of procedure opt_input_ts_scale() 3032. } 3033. 3034. static void opt_input_ts_scale(const char *arg) ^ 3035. { 3036. unsigned int stream; ffmpeg.c:3040:5: 3038. char *p; 3039. 3040. stream = strtol(arg, &p, 0); ^ 3041. if (*p) 3042. p++; ffmpeg.c:3041:9: Taking true branch 3039. 3040. stream = strtol(arg, &p, 0); 3041. if (*p) ^ 3042. p++; 3043. scale= strtod(p, &p); ffmpeg.c:3042:9: 3040. stream = strtol(arg, &p, 0); 3041. if (*p) 3042. p++; ^ 3043. scale= strtod(p, &p); 3044. ffmpeg.c:3043:5: 3041. if (*p) 3042. p++; 3043. scale= strtod(p, &p); ^ 3044. 3045. if(stream >= MAX_STREAMS) ffmpeg.c:3045:8: Taking true branch 3043. scale= strtod(p, &p); 3044. 3045. if(stream >= MAX_STREAMS) ^ 3046. ffmpeg_exit(1); 3047. ffmpeg.c:3046:9: Skipping ffmpeg_exit(): empty list of specs 3044. 3045. if(stream >= MAX_STREAMS) 3046. ffmpeg_exit(1); ^ 3047. 3048. input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); ffmpeg.c:3048:5: 3046. ffmpeg_exit(1); 3047. 3048. input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); ^ 3049. input_files_ts_scale[nb_input_files][stream]= scale; 3050. } ffmpeg.c:520:1: start of procedure grow_array() 518. 519. /* similar to ff_dynarray_add() and av_fast_realloc() */ 520. static void *grow_array(void *array, int elem_size, int *size, int new_size) ^ 521. { 522. if (new_size >= INT_MAX / elem_size) { ffmpeg.c:522:9: Taking true branch 520. static void *grow_array(void *array, int elem_size, int *size, int new_size) 521. { 522. if (new_size >= INT_MAX / elem_size) { ^ 523. fprintf(stderr, "Array too big.\n"); 524. ffmpeg_exit(1); ffmpeg.c:523:9: 521. { 522. if (new_size >= INT_MAX / elem_size) { 523. fprintf(stderr, "Array too big.\n"); ^ 524. ffmpeg_exit(1); 525. } ffmpeg.c:524:9: Skipping ffmpeg_exit(): empty list of specs 522. if (new_size >= INT_MAX / elem_size) { 523. fprintf(stderr, "Array too big.\n"); 524. ffmpeg_exit(1); ^ 525. } 526. if (*size < new_size) { ffmpeg.c:526:9: Taking true branch 524. ffmpeg_exit(1); 525. } 526. if (*size < new_size) { ^ 527. uint8_t *tmp = av_realloc(array, new_size*elem_size); 528. if (!tmp) { ffmpeg.c:527:9: 525. } 526. if (*size < new_size) { 527. uint8_t *tmp = av_realloc(array, new_size*elem_size); ^ 528. if (!tmp) { 529. fprintf(stderr, "Could not alloc buffer.\n"); libavutil/mem.c:117:1: start of procedure av_realloc() 115. } 116. 117. void *av_realloc(void *ptr, size_t size) ^ 118. { 119. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:124:8: Taking false branch 122. 123. /* let's disallow possible ambiguous cases */ 124. if(size > (INT_MAX-16) ) ^ 125. return NULL; 126. libavutil/mem.c:133:5: 131. return (char*)realloc((char*)ptr - diff, size + diff) + diff; 132. #else 133. return realloc(ptr, size); ^ 134. #endif 135. } libavutil/mem.c:135:1: return from a call to av_realloc 133. return realloc(ptr, size); 134. #endif 135. } ^ 136. 137. void av_free(void *ptr) ffmpeg.c:528:14: Taking true branch 526. if (*size < new_size) { 527. uint8_t *tmp = av_realloc(array, new_size*elem_size); 528. if (!tmp) { ^ 529. fprintf(stderr, "Could not alloc buffer.\n"); 530. ffmpeg_exit(1); ffmpeg.c:529:13: 527. uint8_t *tmp = av_realloc(array, new_size*elem_size); 528. if (!tmp) { 529. fprintf(stderr, "Could not alloc buffer.\n"); ^ 530. ffmpeg_exit(1); 531. } ffmpeg.c:530:13: Skipping ffmpeg_exit(): empty list of specs 528. if (!tmp) { 529. fprintf(stderr, "Could not alloc buffer.\n"); 530. ffmpeg_exit(1); ^ 531. } 532. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); ffmpeg.c:532:9: 530. ffmpeg_exit(1); 531. } 532. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); ^ 533. *size = new_size; 534. return tmp; ffmpeg.c:533:9: 531. } 532. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); 533. *size = new_size; ^ 534. return tmp; 535. } ffmpeg.c:534:9: 532. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); 533. *size = new_size; 534. return tmp; ^ 535. } 536. return array; ffmpeg.c:537:1: return from a call to grow_array 535. } 536. return array; 537. } ^ 538. 539. static void choose_sample_fmt(AVStream *st, AVCodec *codec) ffmpeg.c:3049:5: 3047. 3048. input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1); 3049. input_files_ts_scale[nb_input_files][stream]= scale; ^ 3050. } 3051.
https://github.com/libav/libav/blob/b568d6d94bda607e4ebb35be68181a8c2a9f5c50/ffmpeg.c/#L3049
d2a_code_trace_data_43298
void *sk_value(const _STACK *st, int i) { if (!st || (i < 0) || (i >= st->num)) return NULL; return st->data[i]; } crypto/asn1/asn_mime.c:433: error: USE_AFTER_FREE call to `mime_hdr_find()` eventually accesses memory that was invalidated by call to `free()` on line 428 indirectly during the call to `mime_parse_hdr()`. Showing all 29 steps of the trace crypto/asn1/asn_mime.c:428:20: invalidation part of the trace starts here 426. *bcont = NULL; 427. 428. if ((headers = mime_parse_hdr(bio)) == NULL) { ^ 429. ASN1err(ASN1_F_SMIME_READ_ASN1, ASN1_R_MIME_PARSE_ERROR); 430. return NULL; crypto/asn1/asn_mime.c:428:20: when calling `mime_parse_hdr` here 426. *bcont = NULL; 427. 428. if ((headers = mime_parse_hdr(bio)) == NULL) { ^ 429. ASN1err(ASN1_F_SMIME_READ_ASN1, ASN1_R_MIME_PARSE_ERROR); 430. return NULL; crypto/asn1/asn_mime.c:677:15: passed as argument to `sk_MIME_HEADER_new` 675. int len, state, save_state = 0; 676. 677. headers = sk_MIME_HEADER_new(mime_hdr_cmp); ^ 678. if (headers == NULL) 679. return NULL; crypto/asn1/asn_mime.c:677:15: return from call to `sk_MIME_HEADER_new` 675. int len, state, save_state = 0; 676. 677. headers = sk_MIME_HEADER_new(mime_hdr_cmp); ^ 678. if (headers == NULL) 679. return NULL; crypto/asn1/asn_mime.c:677:5: assigned 675. int len, state, save_state = 0; 676. 677. headers = sk_MIME_HEADER_new(mime_hdr_cmp); ^ 678. if (headers == NULL) 679. return NULL; crypto/asn1/asn_mime.c:711:21: when calling `sk_MIME_HEADER_push` here 709. *p = 0; 710. mhdr = mime_hdr_new(ntmp, strip_ends(q)); 711. sk_MIME_HEADER_push(headers, mhdr); ^ 712. ntmp = NULL; 713. q = p + 1; crypto/asn1/asn1_locl.h:93:1: parameter `sk` of sk_MIME_HEADER_push 91. DEFINE_STACK_OF(MIME_PARAM) 92. typedef struct mime_header_st MIME_HEADER; 93. > DEFINE_STACK_OF(MIME_HEADER) 94. 95. /* Month values for printing out times */ crypto/asn1/asn1_locl.h:93:1: when calling `sk_push` here 91. DEFINE_STACK_OF(MIME_PARAM) 92. typedef struct mime_header_st MIME_HEADER; 93. > DEFINE_STACK_OF(MIME_HEADER) 94. 95. /* Month values for printing out times */ crypto/stack/stack.c:259:1: parameter `st` of sk_push 257. } 258. 259. > int sk_push(_STACK *st, void *data) 260. { 261. return (sk_insert(st, data, st->num)); crypto/stack/stack.c:261:13: when calling `sk_insert` here 259. int sk_push(_STACK *st, void *data) 260. { 261. return (sk_insert(st, data, st->num)); ^ 262. } 263. crypto/stack/stack.c:167:1: parameter `st` of sk_insert 165. } 166. 167. > int sk_insert(_STACK *st, void *data, int loc) 168. { 169. char **s; crypto/stack/stack.c:174:13: when calling `CRYPTO_realloc` here 172. return 0; 173. if (st->num_alloc <= st->num + 1) { 174. s = OPENSSL_realloc((char *)st->data, ^ 175. (unsigned int)sizeof(char *) * st->num_alloc * 2); 176. if (s == NULL) crypto/mem.c:166:1: parameter `str` of CRYPTO_realloc 164. } 165. 166. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) 167. { 168. if (str == NULL) crypto/mem.c:172:9: when calling `CRYPTO_free` here 170. 171. if (num == 0) { 172. CRYPTO_free(str); ^ 173. return NULL; 174. } crypto/mem.c:234:1: parameter `str` of CRYPTO_free 232. } 233. 234. > void CRYPTO_free(void *str) 235. { 236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:245:5: was invalidated by call to `free()` 243. } 244. #else 245. free(str); ^ 246. #endif 247. } crypto/asn1/asn_mime.c:428:20: use-after-lifetime part of the trace starts here 426. *bcont = NULL; 427. 428. if ((headers = mime_parse_hdr(bio)) == NULL) { ^ 429. ASN1err(ASN1_F_SMIME_READ_ASN1, ASN1_R_MIME_PARSE_ERROR); 430. return NULL; crypto/asn1/asn_mime.c:428:20: passed as argument to `mime_parse_hdr` 426. *bcont = NULL; 427. 428. if ((headers = mime_parse_hdr(bio)) == NULL) { ^ 429. ASN1err(ASN1_F_SMIME_READ_ASN1, ASN1_R_MIME_PARSE_ERROR); 430. return NULL; crypto/asn1/asn_mime.c:677:15: passed as argument to `sk_MIME_HEADER_new` 675. int len, state, save_state = 0; 676. 677. headers = sk_MIME_HEADER_new(mime_hdr_cmp); ^ 678. if (headers == NULL) 679. return NULL; crypto/asn1/asn_mime.c:677:15: return from call to `sk_MIME_HEADER_new` 675. int len, state, save_state = 0; 676. 677. headers = sk_MIME_HEADER_new(mime_hdr_cmp); ^ 678. if (headers == NULL) 679. return NULL; crypto/asn1/asn_mime.c:677:5: assigned 675. int len, state, save_state = 0; 676. 677. headers = sk_MIME_HEADER_new(mime_hdr_cmp); ^ 678. if (headers == NULL) 679. return NULL; crypto/asn1/asn_mime.c:428:20: return from call to `mime_parse_hdr` 426. *bcont = NULL; 427. 428. if ((headers = mime_parse_hdr(bio)) == NULL) { ^ 429. ASN1err(ASN1_F_SMIME_READ_ASN1, ASN1_R_MIME_PARSE_ERROR); 430. return NULL; crypto/asn1/asn_mime.c:433:16: when calling `mime_hdr_find` here 431. } 432. 433. if ((hdr = mime_hdr_find(headers, "content-type")) == NULL ^ 434. || hdr->value == NULL) { 435. sk_MIME_HEADER_pop_free(headers, mime_hdr_free); crypto/asn1/asn_mime.c:922:1: parameter `hdrs` of mime_hdr_find 920. /* Find a header with a given name (if possible) */ 921. 922. > static MIME_HEADER *mime_hdr_find(STACK_OF(MIME_HEADER) *hdrs, char *name) 923. { 924. MIME_HEADER htmp; crypto/asn1/asn_mime.c:930:12: when calling `sk_MIME_HEADER_value` here 928. if (idx < 0) 929. return NULL; 930. return sk_MIME_HEADER_value(hdrs, idx); ^ 931. } 932. crypto/asn1/asn1_locl.h:93:1: parameter `sk` of sk_MIME_HEADER_value 91. DEFINE_STACK_OF(MIME_PARAM) 92. typedef struct mime_header_st MIME_HEADER; 93. > DEFINE_STACK_OF(MIME_HEADER) 94. 95. /* Month values for printing out times */ crypto/asn1/asn1_locl.h:93:1: when calling `sk_value` here 91. DEFINE_STACK_OF(MIME_PARAM) 92. typedef struct mime_header_st MIME_HEADER; 93. > DEFINE_STACK_OF(MIME_HEADER) 94. 95. /* Month values for printing out times */ crypto/stack/stack.c:324:1: parameter `st` of sk_value 322. } 323. 324. > void *sk_value(const _STACK *st, int i) 325. { 326. if (!st || (i < 0) || (i >= st->num)) crypto/stack/stack.c:328:12: invalid access occurs here 326. if (!st || (i < 0) || (i >= st->num)) 327. return NULL; 328. return st->data[i]; ^ 329. } 330.
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/stack/stack.c/#L328
d2a_code_trace_data_43299
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:291: error: Uninitialized Value The value read from inbuffer[_] was never initialized. libavcodec/ra144.c:291:3: 289. *(ptr++)=(inbuffer[7]>>5)&0x7f; 290. *(ptr++)=((inbuffer[7]<<2)&0x7c)|((inbuffer[8]>>14)&3); 291. *(ptr++)=(inbuffer[8]>>7)&0x7f; ^ 292. *(ptr++)=((inbuffer[8]<<1)&0xfe)|((inbuffer[9]>>15)&1); 293. *(ptr++)=(inbuffer[9]>>8)&0x7f;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ra144.c/#L291
d2a_code_trace_data_43300
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:2954: error: Null Dereference pointer `codec` last assigned on line 2947 could be null and is dereferenced at line 2954, column 8. ffmpeg.c:2940:1: start of procedure find_codec_or_die() 2938. } 2939. 2940. static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict) ^ 2941. { 2942. const char *codec_string = encoder ? "encoder" : "decoder"; ffmpeg.c:2942:32: Condition is true 2940. static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict) 2941. { 2942. const char *codec_string = encoder ? "encoder" : "decoder"; ^ 2943. AVCodec *codec; 2944. ffmpeg.c:2942:5: 2940. static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict) 2941. { 2942. const char *codec_string = encoder ? "encoder" : "decoder"; ^ 2943. AVCodec *codec; 2944. ffmpeg.c:2945:9: Taking false branch 2943. AVCodec *codec; 2944. 2945. if(!name) ^ 2946. return CODEC_ID_NONE; 2947. codec = encoder ? ffmpeg.c:2947:13: Condition is true 2945. if(!name) 2946. return CODEC_ID_NONE; 2947. codec = encoder ? ^ 2948. avcodec_find_encoder_by_name(name) : 2949. avcodec_find_decoder_by_name(name); ffmpeg.c:2947:5: 2945. if(!name) 2946. return CODEC_ID_NONE; 2947. codec = encoder ? ^ 2948. avcodec_find_encoder_by_name(name) : 2949. avcodec_find_decoder_by_name(name); ffmpeg.c:2950:9: Taking true branch 2948. avcodec_find_encoder_by_name(name) : 2949. avcodec_find_decoder_by_name(name); 2950. if(!codec) { ^ 2951. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); 2952. ffmpeg_exit(1); ffmpeg.c:2951:9: 2949. avcodec_find_decoder_by_name(name); 2950. if(!codec) { 2951. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); ^ 2952. ffmpeg_exit(1); 2953. } ffmpeg.c:2952:9: Skipping ffmpeg_exit(): empty list of specs 2950. if(!codec) { 2951. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); 2952. ffmpeg_exit(1); ^ 2953. } 2954. if(codec->type != type) { ffmpeg.c:2954:8: 2952. ffmpeg_exit(1); 2953. } 2954. if(codec->type != type) { ^ 2955. fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name); 2956. ffmpeg_exit(1);
https://github.com/libav/libav/blob/eced8fa02ea237abd9c6a6e9287bb7524addb8f4/ffmpeg.c/#L2954
d2a_code_trace_data_43301
static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, OPENSSL_LH_DOALL_FUNC func, OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) { int i; OPENSSL_LH_NODE *a, *n; if (lh == NULL) return; for (i = lh->num_nodes - 1; i >= 0; i--) { a = lh->b[i]; while (a != NULL) { n = a->next; if (use_arg) func_arg(a->data, arg); else func(a->data); a = n; } } } test/sslapitest.c:3764: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `SSL_free`. Showing all 19 steps of the trace test/sslapitest.c:3743:10: Call 3741. int testresult = 0; 3742. 3743. if (!TEST_true(create_ssl_ctx_pair(TLS_server_method(), TLS_client_method(), ^ 3744. TLS1_VERSION, 0, 3745. &sctx, &cctx, cert, privkey))) test/ssltestlib.c:619:10: Call 617. SSL_CTX *clientctx = NULL; 618. 619. if (!TEST_ptr(serverctx = SSL_CTX_new(sm)) ^ 620. || (cctx != NULL && !TEST_ptr(clientctx = SSL_CTX_new(cm)))) 621. goto err; ssl/ssl_lib.c:2942:21: Call 2940. goto err; 2941. 2942. ret->sessions = lh_SSL_SESSION_new(ssl_session_hash, ssl_session_cmp); ^ 2943. if (ret->sessions == NULL) 2944. goto err; ssl/ssl_locl.h:736:1: Call 734. } TLSEXT_INDEX; 735. 736. > DEFINE_LHASH_OF(SSL_SESSION); 737. /* Needed in ssl_cert.c */ 738. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:63:5: Assignment 61. ret->comp = ((c == NULL) ? (OPENSSL_LH_COMPFUNC)strcmp : c); 62. ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h); 63. ret->num_nodes = MIN_NODES / 2; ^ 64. ret->num_alloc_nodes = MIN_NODES; 65. ret->pmax = MIN_NODES / 2; test/sslapitest.c:3764:5: Call 3762. 3763. /* Fatal error so abandon the connection from this client */ 3764. SSL_free(clientssl); ^ 3765. clientssl = NULL; 3766. ssl/ssl_lib.c:1134:1: Parameter `s->ctx->sessions->num_nodes` 1132. } 1133. 1134. > void SSL_free(SSL *s) 1135. { 1136. int i; ssl/ssl_lib.c:1209:5: Call 1207. s->method->ssl_free(s); 1208. 1209. SSL_CTX_free(s->ctx); ^ 1210. 1211. ASYNC_WAIT_CTX_free(s->waitctx); ssl/ssl_lib.c:3103:1: Parameter `a->sessions->num_nodes` 3101. } 3102. 3103. > void SSL_CTX_free(SSL_CTX *a) 3104. { 3105. int i; ssl/ssl_lib.c:3129:9: Call 3127. */ 3128. if (a->sessions != NULL) 3129. SSL_CTX_flush_sessions(a, 0); ^ 3130. 3131. 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, +oo] - 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/6e94b5aecd619afd25e3dc25902952b1b3194edf/crypto/lhash/lhash.c/#L191
d2a_code_trace_data_43302
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:2001: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_div`. Showing all 13 steps of the trace test/bntest.c:2001:10: Call 1999. BN_zero(zero); 2000. 2001. if (!TEST_false(BN_div(a, b, BN_value_one(), zero, ctx))) ^ 2002. goto err; 2003. ERR_clear_error(); crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth` 207. * If 'dv' or 'rm' is NULL, the respective value is not returned. 208. */ 209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 210. BN_CTX *ctx) 211. { crypto/bn/bn_div.c:229:11: Call 227. } 228. 229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx); ^ 230. 231. if (ret) { crypto/bn/bn_div.c:280:5: Call 278. bn_check_top(rm); 279. 280. BN_CTX_start(ctx); ^ 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_div.c:450:5: Call 448. if (rm != NULL) 449. bn_rshift_fixed_top(rm, snum, norm_shift); 450. BN_CTX_end(ctx); ^ 451. return 1; 452. err: crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_div` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_43303
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:3951: error: NULL_DEREFERENCE pointer `cpk` last assigned on line 3950 could be null and is dereferenced at line 3951, column 45. Showing all 30 steps of the trace ssl/t1_lib.c:3939:1: start of procedure ssl_get_auto_dh() 3937. 3938. #ifndef OPENSSL_NO_DH 3939. > DH *ssl_get_auto_dh(SSL *s) 3940. { 3941. int dh_secbits = 80; ssl/t1_lib.c:3941:5: 3939. DH *ssl_get_auto_dh(SSL *s) 3940. { 3941. > int dh_secbits = 80; 3942. if (s->cert->dh_tmp_auto == 2) 3943. return DH_get_1024_160(); ssl/t1_lib.c:3942:9: Taking false branch 3940. { 3941. int dh_secbits = 80; 3942. if (s->cert->dh_tmp_auto == 2) ^ 3943. return DH_get_1024_160(); 3944. if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) { ssl/t1_lib.c:3944:9: Taking false branch 3942. if (s->cert->dh_tmp_auto == 2) 3943. return DH_get_1024_160(); 3944. if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) { ^ 3945. if (s->s3->tmp.new_cipher->strength_bits == 256) 3946. dh_secbits = 128; ssl/t1_lib.c:3950:9: 3948. dh_secbits = 80; 3949. } else { 3950. > CERT_PKEY *cpk = ssl_get_server_send_pkey(s); 3951. dh_secbits = EVP_PKEY_security_bits(cpk->privatekey); 3952. } 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:3951:9: 3949. } else { 3950. CERT_PKEY *cpk = ssl_get_server_send_pkey(s); 3951. > dh_secbits = EVP_PKEY_security_bits(cpk->privatekey); 3952. } 3953.
https://github.com/openssl/openssl/blob/a1f2b0e6e07a53c0ae2c81cba319b90e54210cd6/ssl/t1_lib.c/#L3951
d2a_code_trace_data_43304
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_gen.c:422: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_is_prime_fasttest_ex`. Showing all 49 steps of the trace crypto/dsa/dsa_gen.c:390:10: Call 388. } 389. 390. if (!BN_lshift(test, BN_value_one(), L - 1)) ^ 391. goto err; 392. for (;;) { crypto/bn/bn_shift.c:83:1: Parameter `r->top` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/dsa/dsa_gen.c:422:17: Call 420. 421. /* step 4 */ 422. r = BN_is_prime_fasttest_ex(q, DSS_prime_checks, ctx, ^ 423. seed_in ? 1 : 0, cb); 424. if (r > 0) crypto/bn/bn_prime.c:151:1: Parameter `a->top` 149. } 150. 151. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 152. int do_trial_division, BN_GENCB *cb) 153. { crypto/bn/bn_prime.c:161:9: Call 159. 160. /* Take care of the really small primes 2 & 3 */ 161. if (BN_is_word(a, 2) || BN_is_word(a, 3)) ^ 162. return 1; 163. crypto/bn/bn_lib.c:855:1: Parameter `a->top` 853. } 854. 855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); crypto/bn/bn_lib.c:857:12: Call 855. int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); ^ 858. } 859. crypto/bn/bn_lib.c:840:1: Parameter `a->top` 838. } 839. 840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w) 841. { 842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0)); crypto/bn/bn_prime.c:161:29: Call 159. 160. /* Take care of the really small primes 2 & 3 */ 161. if (BN_is_word(a, 2) || BN_is_word(a, 3)) ^ 162. return 1; 163. crypto/bn/bn_lib.c:855:1: Parameter `a->top` 853. } 854. 855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); crypto/bn/bn_lib.c:857:12: Call 855. int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); ^ 858. } 859. crypto/bn/bn_lib.c:840:1: Parameter `a->top` 838. } 839. 840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w) 841. { 842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0)); crypto/bn/bn_prime.c:165:10: Call 163. 164. /* Check odd and bigger than 1 */ 165. if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0) ^ 166. return 0; 167. crypto/bn/bn_lib.c:860:1: Parameter `a->top` 858. } 859. 860. > int BN_is_odd(const BIGNUM *a) 861. { 862. return (a->top > 0) && (a->d[0] & 1); crypto/bn/bn_prime.c:165:26: Call 163. 164. /* Check odd and bigger than 1 */ 165. if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0) ^ 166. return 0; 167. crypto/bn/bn_lib.c:542:1: Parameter `a->top` 540. } 541. 542. > int BN_cmp(const BIGNUM *a, const BIGNUM *b) 543. { 544. int i; crypto/bn/bn_prime.c:198:10: Call 196. 197. /* compute A1 := a - 1 */ 198. if (!BN_copy(A1, a) || !BN_sub_word(A1, 1)) ^ 199. goto err; 200. /* compute A3 := a - 3 */ crypto/bn/bn_lib.c:285:1: Parameter `b->top` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_prime.c:201:10: Call 199. goto err; 200. /* compute A3 := a - 3 */ 201. if (!BN_copy(A3, a) || !BN_sub_word(A3, 3)) ^ 202. goto err; 203. 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_prime.c:215:10: Call 213. if (mont == NULL) 214. goto err; 215. if (!BN_MONT_CTX_set(mont, a, ctx)) ^ 216. goto err; 217. crypto/bn/bn_mont.c:238:9: Call 236. BIGNUM *Ri, *R; 237. 238. if (BN_is_zero(mod)) ^ 239. return 0; 240. crypto/bn/bn_lib.c:845:1: Parameter `a->top` 843. } 844. 845. > int BN_is_zero(const BIGNUM *a) 846. { 847. return a->top == 0; crypto/bn/bn_prime.c:223:13: Call 221. goto err; 222. 223. j = witness(check, a, A1, A1_odd, k, ctx, mont); ^ 224. if (j == -1) 225. goto err; crypto/bn/bn_prime.c:245:1: Parameter `a->top` 243. } 244. 245. > static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1, 246. const BIGNUM *a1_odd, int k, BN_CTX *ctx, 247. BN_MONT_CTX *mont) crypto/bn/bn_prime.c:249:10: Call 247. BN_MONT_CTX *mont) 248. { 249. if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */ ^ 250. return -1; 251. if (BN_is_one(w)) crypto/bn/bn_exp.c:296:1: Parameter `m->top` 294. } 295. 296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 297. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 298. { crypto/bn/bn_exp.c:310:16: Call 308. || BN_get_flags(a, BN_FLG_CONSTTIME) != 0 309. || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) { 310. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 311. } 312. crypto/bn/bn_exp.c:745:14: Assignment 743. /* 2^(top*BN_BITS2) - m */ 744. tmp.d[0] = (0 - m->d[0]) & BN_MASK2; 745. for (i = 1; i < top; i++) ^ 746. tmp.d[i] = (~m->d[i]) & BN_MASK2; 747. tmp.top = top; crypto/bn/bn_exp.c:1062:14: Call 1060. bits -= window0; 1061. wvalue = bn_get_bits(p, bits) & wmask; 1062. if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&tmp, top, powerbuf, wvalue, ^ 1063. window)) 1064. goto err; crypto/bn/bn_exp.c:520:1: Parameter `top` 518. } 519. 520. > static int MOD_EXP_CTIME_COPY_FROM_PREBUF(BIGNUM *b, int top, 521. unsigned char *buf, int idx, 522. int window) crypto/bn/bn_exp.c:577:5: Assignment 575. } 576. 577. b->top = top; ^ 578. bn_correct_top(b); 579. return 1; crypto/bn/bn_exp.c:578:5: Call 576. 577. b->top = top; 578. bn_correct_top(b); ^ 579. return 1; 580. } crypto/bn/bn_lib.c:946:1: Parameter `a->top` 944. } 945. 946. > void bn_correct_top(BIGNUM *a) 947. { 948. BN_ULONG *ftl; crypto/bn/bn_exp.c:1075:22: Call 1073. /* Square the result window-size times */ 1074. for (i = 0; i < window; i++) 1075. if (!BN_mod_mul_montgomery(&tmp, &tmp, &tmp, mont, ctx)) ^ 1076. goto err; 1077. 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 `BN_is_prime_fasttest_ex` 118. if (--j > 0) { 119. ap++; 120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); ^ 121. rp += 2; 122. }
https://github.com/openssl/openssl/blob/b48d4397b8ee4256f0b0a115eb99f27ae89995e0/crypto/bn/bn_sqr.c/#L120
d2a_code_trace_data_43305
char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) { X509_NAME_ENTRY *ne; int i; int n, lold, l, l1, l2, num, j, type; const char *s; char *p; unsigned char *q; BUF_MEM *b = NULL; static const char hex[17] = "0123456789ABCDEF"; int gs_doit[4]; char tmp_buf[80]; #ifdef CHARSET_EBCDIC unsigned char ebcdic_buf[1024]; #endif if (buf == NULL) { if ((b = BUF_MEM_new()) == NULL) goto err; if (!BUF_MEM_grow(b, 200)) goto err; b->data[0] = '\0'; len = 200; } else if (len == 0) { return NULL; } if (a == NULL) { if (b) { buf = b->data; OPENSSL_free(b); } strncpy(buf, "NO X509_NAME", len); buf[len - 1] = '\0'; return buf; } len--; l = 0; for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { ne = sk_X509_NAME_ENTRY_value(a->entries, i); n = OBJ_obj2nid(ne->object); if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) { i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object); s = tmp_buf; } l1 = strlen(s); type = ne->value->type; num = ne->value->length; q = ne->value->data; #ifdef CHARSET_EBCDIC if (type == V_ASN1_GENERALSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_PRINTABLESTRING || type == V_ASN1_TELETEXSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_IA5STRING) { ascii2ebcdic(ebcdic_buf, q, (num > (int)sizeof(ebcdic_buf)) ? (int)sizeof(ebcdic_buf) : num); q = ebcdic_buf; } #endif if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) { gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0; for (j = 0; j < num; j++) if (q[j] != 0) gs_doit[j & 3] = 1; if (gs_doit[0] | gs_doit[1] | gs_doit[2]) gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; else { gs_doit[0] = gs_doit[1] = gs_doit[2] = 0; gs_doit[3] = 1; } } else gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; for (l2 = j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; l2++; #ifndef CHARSET_EBCDIC if ((q[j] < ' ') || (q[j] > '~')) l2 += 3; #else if ((os_toascii[q[j]] < os_toascii[' ']) || (os_toascii[q[j]] > os_toascii['~'])) l2 += 3; #endif } lold = l; l += 1 + l1 + 1 + l2; if (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); BUF_MEM_free(b); return (NULL); } crypto/x509/x_name.c:536: 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/x_name.c:536:9: Call 534. l = 80 - 2 - obase; 535. 536. b = X509_NAME_oneline(name, NULL, 0); ^ 537. if (!b) 538. return 0; crypto/x509/x509_obj.c:66:1: <Offset trace> 64. #include "internal/x509_int.h" 65. 66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 67. { 68. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:66:1: Parameter `len` 64. #include "internal/x509_int.h" 65. 66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 67. { 68. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:66:1: <Length trace> 64. #include "internal/x509_int.h" 65. 66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 67. { 68. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:66:1: Parameter `*buf` 64. #include "internal/x509_int.h" 65. 66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 67. { 68. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:97:9: Array access: Offset added: [0, 200] Size: [1, 2147483644] by call to `X509_NAME_oneline` 95. OPENSSL_free(b); 96. } 97. strncpy(buf, "NO X509_NAME", len); ^ 98. buf[len - 1] = '\0'; 99. return buf;
https://github.com/openssl/openssl/blob/b33d1141b6dcce947708b984c5e9e91dad3d675d/crypto/x509/x509_obj.c/#L97
d2a_code_trace_data_43306
static inline uint64_t get_val(BitstreamContext *bc, unsigned n) { #ifdef BITSTREAM_READER_LE uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1); bc->bits >>= n; #else uint64_t ret = bc->bits >> (64 - n); bc->bits <<= n; #endif bc->bits_left -= n; return ret; } libavcodec/takdec.c:595: error: Integer Overflow L2 ([1, +oo] - 10):unsigned32 by call to `bitstream_read_signed`. libavcodec/takdec.c:595:19: Call 593. case 5: /* side/right with scale factor */ 594. dshift = bits_esc4(bc); 595. dfactor = bitstream_read_signed(bc, 10); ^ 596. for (i = 0; i < length; i++) { 597. int32_t a = p1[i]; libavcodec/bitstream.h:199:1: Parameter `n` 197. /* Return n bits from the buffer as a signed integer. 198. * n has to be in the 0-32 range. */ 199. static inline int32_t bitstream_read_signed(BitstreamContext *bc, unsigned n) ^ 200. { 201. return sign_extend(bitstream_read(bc, n), n); libavcodec/bitstream.h:201:24: Call 199. static inline int32_t bitstream_read_signed(BitstreamContext *bc, unsigned n) 200. { 201. return sign_extend(bitstream_read(bc, n), n); ^ 202. } 203. libavcodec/bitstream.h:183:1: Parameter `n` 181. 182. /* Return n bits from the buffer. n has to be in the 0-32 range. */ 183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n) ^ 184. { 185. if (!n) libavcodec/bitstream.h:194:12: Call 192. } 193. 194. return get_val(bc, n); ^ 195. } 196. libavcodec/bitstream.h:130:1: <LHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `bc->bits_left` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: <RHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Binary operation: ([1, +oo] - 10):unsigned32 by call to `bitstream_read_signed` 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret;
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L139
d2a_code_trace_data_43307
char *X509_NAME_oneline(const X509_NAME *a, char *buf, int len) { const X509_NAME_ENTRY *ne; int i; int n, lold, l, l1, l2, num, j, type; const char *s; char *p; unsigned char *q; BUF_MEM *b = NULL; static const char hex[17] = "0123456789ABCDEF"; int gs_doit[4]; char tmp_buf[80]; #ifdef CHARSET_EBCDIC unsigned char ebcdic_buf[1024]; #endif if (buf == NULL) { if ((b = BUF_MEM_new()) == NULL) goto err; if (!BUF_MEM_grow(b, 200)) goto err; b->data[0] = '\0'; len = 200; } else if (len == 0) { return NULL; } if (a == NULL) { if (b) { buf = b->data; OPENSSL_free(b); } strncpy(buf, "NO X509_NAME", len); buf[len - 1] = '\0'; return buf; } len--; l = 0; for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { ne = sk_X509_NAME_ENTRY_value(a->entries, i); n = OBJ_obj2nid(ne->object); if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) { i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object); s = tmp_buf; } l1 = strlen(s); type = ne->value->type; num = ne->value->length; if (num > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } q = ne->value->data; #ifdef CHARSET_EBCDIC if (type == V_ASN1_GENERALSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_PRINTABLESTRING || type == V_ASN1_TELETEXSTRING || type == V_ASN1_IA5STRING) { if (num > (int)sizeof(ebcdic_buf)) num = sizeof(ebcdic_buf); ascii2ebcdic(ebcdic_buf, q, num); q = ebcdic_buf; } #endif if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) { gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0; for (j = 0; j < num; j++) if (q[j] != 0) gs_doit[j & 3] = 1; if (gs_doit[0] | gs_doit[1] | gs_doit[2]) gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; else { gs_doit[0] = gs_doit[1] = gs_doit[2] = 0; gs_doit[3] = 1; } } else gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; for (l2 = j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; l2++; #ifndef CHARSET_EBCDIC if ((q[j] < ' ') || (q[j] > '~')) l2 += 3; #else if ((os_toascii[q[j]] < os_toascii[' ']) || (os_toascii[q[j]] > os_toascii['~'])) l2 += 3; #endif } lold = l; l += 1 + l1 + 1 + l2; if (l > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } if (b != NULL) { if (!BUF_MEM_grow(b, l + 1)) goto err; p = &(b->data[lold]); } else if (l > len) { break; } else p = &(buf[lold]); *(p++) = '/'; memcpy(p, s, (unsigned int)l1); p += l1; *(p++) = '='; #ifndef CHARSET_EBCDIC q = ne->value->data; #endif for (j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; #ifndef CHARSET_EBCDIC n = q[j]; if ((n < ' ') || (n > '~')) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = n; #else n = os_toascii[q[j]]; if ((n < os_toascii[' ']) || (n > os_toascii['~'])) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = q[j]; #endif } *p = '\0'; } if (b != NULL) { p = b->data; OPENSSL_free(b); } else p = buf; if (i == 0) *p = '\0'; return (p); err: X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE); end: BUF_MEM_free(b); return (NULL); } test/ssltest_old.c:2917: error: BUFFER_OVERRUN_L2 Offset: [-oo, 1048576] Size: 256 by call to `X509_NAME_oneline`. Showing all 6 steps of the trace test/ssltest_old.c:2913:1: Array declaration 2911. } 2912. 2913. > static int verify_callback(int ok, X509_STORE_CTX *ctx) 2914. { 2915. char *s, buf[256]; test/ssltest_old.c:2917:9: Call 2915. char *s, buf[256]; 2916. 2917. s = X509_NAME_oneline(X509_get_subject_name(X509_STORE_CTX_get_current_cert(ctx)), ^ 2918. buf, sizeof buf); 2919. if (s != NULL) { 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:134:13: Assignment 132. break; 133. } else 134. p = &(buf[lold]); ^ 135. *(p++) = '/'; 136. memcpy(p, s, (unsigned int)l1); crypto/x509/x509_obj.c:135:9: Array access: Offset: [-oo, 1048576] Size: 256 by call to `X509_NAME_oneline` 133. } else 134. p = &(buf[lold]); 135. *(p++) = '/'; ^ 136. memcpy(p, s, (unsigned int)l1); 137. p += l1;
https://github.com/openssl/openssl/blob/cdb2a60347f988037d29adc7e4415e9c66c8a5a5/crypto/x509/x509_obj.c/#L135
d2a_code_trace_data_43308
int dtls1_buffer_message(SSL *s, int is_ccs) { pitem *item; hm_fragment *frag; unsigned char seq64be[8]; OPENSSL_assert(s->init_off == 0); frag = dtls1_hm_fragment_new(s->init_num, 0); if (frag == NULL) return 0; memcpy(frag->fragment, s->init_buf->data, s->init_num); if (is_ccs) { OPENSSL_assert(s->d1->w_msg_hdr.msg_len + ((s->version==DTLS1_BAD_VER)?3:DTLS1_CCS_HEADER_LENGTH) == (unsigned int)s->init_num); } else { OPENSSL_assert(s->d1->w_msg_hdr.msg_len + DTLS1_HM_HEADER_LENGTH == (unsigned int)s->init_num); } frag->msg_header.msg_len = s->d1->w_msg_hdr.msg_len; frag->msg_header.seq = s->d1->w_msg_hdr.seq; frag->msg_header.type = s->d1->w_msg_hdr.type; frag->msg_header.frag_off = 0; frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len; frag->msg_header.is_ccs = is_ccs; frag->msg_header.saved_retransmit_state.enc_write_ctx = s->enc_write_ctx; frag->msg_header.saved_retransmit_state.write_hash = s->write_hash; frag->msg_header.saved_retransmit_state.compress = s->compress; frag->msg_header.saved_retransmit_state.session = s->session; frag->msg_header.saved_retransmit_state.epoch = DTLS_RECORD_LAYER_get_w_epoch(&s->rlayer); memset(seq64be, 0, sizeof(seq64be)); seq64be[6] = (unsigned char)(dtls1_get_queue_priority(frag->msg_header.seq, frag->msg_header.is_ccs) >> 8); seq64be[7] = (unsigned char)(dtls1_get_queue_priority(frag->msg_header.seq, frag->msg_header.is_ccs)); item = pitem_new(seq64be, frag); if (item == NULL) { dtls1_hm_fragment_free(frag); return 0; } pqueue_insert(s->d1->sent_messages, item); return 1; } ssl/statem/statem_dtls.c:1151: error: MEMORY_LEAK memory dynamically allocated by call to `pitem_new()` at line 1145, column 12 is not reachable after line 1151, column 5. Showing all 80 steps of the trace ssl/statem/statem_dtls.c:1092:1: start of procedure dtls1_buffer_message() 1090. } 1091. 1092. > int dtls1_buffer_message(SSL *s, int is_ccs) 1093. { 1094. pitem *item; ssl/statem/statem_dtls.c:1102:5: Condition is true 1100. * serialized 1101. */ 1102. OPENSSL_assert(s->init_off == 0); ^ 1103. 1104. frag = dtls1_hm_fragment_new(s->init_num, 0); ssl/statem/statem_dtls.c:1104:5: 1102. OPENSSL_assert(s->init_off == 0); 1103. 1104. > frag = dtls1_hm_fragment_new(s->init_num, 0); 1105. if (frag == NULL) 1106. return 0; ssl/statem/statem_dtls.c:163:1: start of procedure dtls1_hm_fragment_new() 161. static int dtls_get_reassembled_message(SSL *s, long *len); 162. 163. > static hm_fragment *dtls1_hm_fragment_new(unsigned long frag_len, 164. int reassembly) 165. { ssl/statem/statem_dtls.c:166:5: 164. int reassembly) 165. { 166. > hm_fragment *frag = NULL; 167. unsigned char *buf = NULL; 168. unsigned char *bitmask = NULL; ssl/statem/statem_dtls.c:167:5: 165. { 166. hm_fragment *frag = NULL; 167. > unsigned char *buf = NULL; 168. unsigned char *bitmask = NULL; 169. ssl/statem/statem_dtls.c:168:5: 166. hm_fragment *frag = NULL; 167. unsigned char *buf = NULL; 168. > unsigned char *bitmask = NULL; 169. 170. frag = OPENSSL_malloc(sizeof(*frag)); ssl/statem/statem_dtls.c:170:5: 168. unsigned char *bitmask = NULL; 169. 170. > frag = OPENSSL_malloc(sizeof(*frag)); 171. if (frag == NULL) 172. return NULL; crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) ssl/statem/statem_dtls.c:171:9: Taking false branch 169. 170. frag = OPENSSL_malloc(sizeof(*frag)); 171. if (frag == NULL) ^ 172. return NULL; 173. ssl/statem/statem_dtls.c:174:9: Taking true branch 172. return NULL; 173. 174. if (frag_len) { ^ 175. buf = OPENSSL_malloc(frag_len); 176. if (buf == NULL) { ssl/statem/statem_dtls.c:175:9: 173. 174. if (frag_len) { 175. > buf = OPENSSL_malloc(frag_len); 176. if (buf == NULL) { 177. OPENSSL_free(frag); crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) ssl/statem/statem_dtls.c:176:13: Taking false branch 174. if (frag_len) { 175. buf = OPENSSL_malloc(frag_len); 176. if (buf == NULL) { ^ 177. OPENSSL_free(frag); 178. return NULL; ssl/statem/statem_dtls.c:183:5: 181. 182. /* zero length fragment gets zero frag->fragment */ 183. > frag->fragment = buf; 184. 185. /* Initialize reassembly bitmask if necessary */ ssl/statem/statem_dtls.c:186:9: Taking false branch 184. 185. /* Initialize reassembly bitmask if necessary */ 186. if (reassembly) { ^ 187. bitmask = OPENSSL_zalloc(RSMBLY_BITMASK_SIZE(frag_len)); 188. if (bitmask == NULL) { ssl/statem/statem_dtls.c:195:5: 193. } 194. 195. > frag->reassembly = bitmask; 196. 197. return frag; ssl/statem/statem_dtls.c:197:5: 195. frag->reassembly = bitmask; 196. 197. > return frag; 198. } 199. ssl/statem/statem_dtls.c:198:1: return from a call to dtls1_hm_fragment_new 196. 197. return frag; 198. > } 199. 200. void dtls1_hm_fragment_free(hm_fragment *frag) ssl/statem/statem_dtls.c:1105:9: Taking false branch 1103. 1104. frag = dtls1_hm_fragment_new(s->init_num, 0); 1105. if (frag == NULL) ^ 1106. return 0; 1107. ssl/statem/statem_dtls.c:1108:5: 1106. return 0; 1107. 1108. > memcpy(frag->fragment, s->init_buf->data, s->init_num); 1109. 1110. if (is_ccs) { ssl/statem/statem_dtls.c:1110:9: Taking true branch 1108. memcpy(frag->fragment, s->init_buf->data, s->init_num); 1109. 1110. if (is_ccs) { ^ 1111. /* For DTLS1_BAD_VER the header length is non-standard */ 1112. OPENSSL_assert(s->d1->w_msg_hdr.msg_len + ssl/statem/statem_dtls.c:1112:9: Condition is false 1110. if (is_ccs) { 1111. /* For DTLS1_BAD_VER the header length is non-standard */ 1112. OPENSSL_assert(s->d1->w_msg_hdr.msg_len + ^ 1113. ((s->version==DTLS1_BAD_VER)?3:DTLS1_CCS_HEADER_LENGTH) 1114. == (unsigned int)s->init_num); ssl/statem/statem_dtls.c:1112:9: Condition is true 1110. if (is_ccs) { 1111. /* For DTLS1_BAD_VER the header length is non-standard */ 1112. OPENSSL_assert(s->d1->w_msg_hdr.msg_len + ^ 1113. ((s->version==DTLS1_BAD_VER)?3:DTLS1_CCS_HEADER_LENGTH) 1114. == (unsigned int)s->init_num); ssl/statem/statem_dtls.c:1120:5: 1118. } 1119. 1120. > frag->msg_header.msg_len = s->d1->w_msg_hdr.msg_len; 1121. frag->msg_header.seq = s->d1->w_msg_hdr.seq; 1122. frag->msg_header.type = s->d1->w_msg_hdr.type; ssl/statem/statem_dtls.c:1121:5: 1119. 1120. frag->msg_header.msg_len = s->d1->w_msg_hdr.msg_len; 1121. > frag->msg_header.seq = s->d1->w_msg_hdr.seq; 1122. frag->msg_header.type = s->d1->w_msg_hdr.type; 1123. frag->msg_header.frag_off = 0; ssl/statem/statem_dtls.c:1122:5: 1120. frag->msg_header.msg_len = s->d1->w_msg_hdr.msg_len; 1121. frag->msg_header.seq = s->d1->w_msg_hdr.seq; 1122. > frag->msg_header.type = s->d1->w_msg_hdr.type; 1123. frag->msg_header.frag_off = 0; 1124. frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len; ssl/statem/statem_dtls.c:1123:5: 1121. frag->msg_header.seq = s->d1->w_msg_hdr.seq; 1122. frag->msg_header.type = s->d1->w_msg_hdr.type; 1123. > frag->msg_header.frag_off = 0; 1124. frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len; 1125. frag->msg_header.is_ccs = is_ccs; ssl/statem/statem_dtls.c:1124:5: 1122. frag->msg_header.type = s->d1->w_msg_hdr.type; 1123. frag->msg_header.frag_off = 0; 1124. > frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len; 1125. frag->msg_header.is_ccs = is_ccs; 1126. ssl/statem/statem_dtls.c:1125:5: 1123. frag->msg_header.frag_off = 0; 1124. frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len; 1125. > frag->msg_header.is_ccs = is_ccs; 1126. 1127. /* save current state */ ssl/statem/statem_dtls.c:1128:5: 1126. 1127. /* save current state */ 1128. > frag->msg_header.saved_retransmit_state.enc_write_ctx = s->enc_write_ctx; 1129. frag->msg_header.saved_retransmit_state.write_hash = s->write_hash; 1130. frag->msg_header.saved_retransmit_state.compress = s->compress; ssl/statem/statem_dtls.c:1129:5: 1127. /* save current state */ 1128. frag->msg_header.saved_retransmit_state.enc_write_ctx = s->enc_write_ctx; 1129. > frag->msg_header.saved_retransmit_state.write_hash = s->write_hash; 1130. frag->msg_header.saved_retransmit_state.compress = s->compress; 1131. frag->msg_header.saved_retransmit_state.session = s->session; ssl/statem/statem_dtls.c:1130:5: 1128. frag->msg_header.saved_retransmit_state.enc_write_ctx = s->enc_write_ctx; 1129. frag->msg_header.saved_retransmit_state.write_hash = s->write_hash; 1130. > frag->msg_header.saved_retransmit_state.compress = s->compress; 1131. frag->msg_header.saved_retransmit_state.session = s->session; 1132. frag->msg_header.saved_retransmit_state.epoch = ssl/statem/statem_dtls.c:1131:5: 1129. frag->msg_header.saved_retransmit_state.write_hash = s->write_hash; 1130. frag->msg_header.saved_retransmit_state.compress = s->compress; 1131. > frag->msg_header.saved_retransmit_state.session = s->session; 1132. frag->msg_header.saved_retransmit_state.epoch = 1133. DTLS_RECORD_LAYER_get_w_epoch(&s->rlayer); ssl/statem/statem_dtls.c:1132:5: 1130. frag->msg_header.saved_retransmit_state.compress = s->compress; 1131. frag->msg_header.saved_retransmit_state.session = s->session; 1132. > frag->msg_header.saved_retransmit_state.epoch = 1133. DTLS_RECORD_LAYER_get_w_epoch(&s->rlayer); 1134. ssl/statem/statem_dtls.c:1135:5: 1133. DTLS_RECORD_LAYER_get_w_epoch(&s->rlayer); 1134. 1135. > memset(seq64be, 0, sizeof(seq64be)); 1136. seq64be[6] = 1137. (unsigned ssl/statem/statem_dtls.c:1136:5: 1134. 1135. memset(seq64be, 0, sizeof(seq64be)); 1136. > seq64be[6] = 1137. (unsigned 1138. char)(dtls1_get_queue_priority(frag->msg_header.seq, ssl/statem/statem_dtls.c:1052:1: start of procedure dtls1_get_queue_priority() 1050. } 1051. 1052. > int dtls1_get_queue_priority(unsigned short seq, int is_ccs) 1053. { 1054. /* ssl/statem/statem_dtls.c:1064:5: 1062. * priority queues) and fits in the unsigned short variable. 1063. */ 1064. > return seq * 2 - is_ccs; 1065. } 1066. ssl/statem/statem_dtls.c:1065:1: return from a call to dtls1_get_queue_priority 1063. */ 1064. return seq * 2 - is_ccs; 1065. > } 1066. 1067. int dtls1_retransmit_buffered_messages(SSL *s) ssl/statem/statem_dtls.c:1140:5: 1138. char)(dtls1_get_queue_priority(frag->msg_header.seq, 1139. frag->msg_header.is_ccs) >> 8); 1140. > seq64be[7] = 1141. (unsigned 1142. char)(dtls1_get_queue_priority(frag->msg_header.seq, ssl/statem/statem_dtls.c:1052:1: start of procedure dtls1_get_queue_priority() 1050. } 1051. 1052. > int dtls1_get_queue_priority(unsigned short seq, int is_ccs) 1053. { 1054. /* ssl/statem/statem_dtls.c:1064:5: 1062. * priority queues) and fits in the unsigned short variable. 1063. */ 1064. > return seq * 2 - is_ccs; 1065. } 1066. ssl/statem/statem_dtls.c:1065:1: return from a call to dtls1_get_queue_priority 1063. */ 1064. return seq * 2 - is_ccs; 1065. > } 1066. 1067. int dtls1_retransmit_buffered_messages(SSL *s) ssl/statem/statem_dtls.c:1145:5: 1143. frag->msg_header.is_ccs)); 1144. 1145. > item = pitem_new(seq64be, frag); 1146. if (item == NULL) { 1147. dtls1_hm_fragment_free(frag); crypto/pqueue/pqueue.c:69:1: start of procedure pitem_new() 67. } pqueue_s; 68. 69. > pitem *pitem_new(unsigned char *prio64be, void *data) 70. { 71. pitem *item = OPENSSL_malloc(sizeof(*item)); crypto/pqueue/pqueue.c:71:5: 69. pitem *pitem_new(unsigned char *prio64be, void *data) 70. { 71. > pitem *item = OPENSSL_malloc(sizeof(*item)); 72. if (item == NULL) 73. return NULL; crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/pqueue/pqueue.c:72:9: Taking false branch 70. { 71. pitem *item = OPENSSL_malloc(sizeof(*item)); 72. if (item == NULL) ^ 73. return NULL; 74. crypto/pqueue/pqueue.c:75:5: 73. return NULL; 74. 75. > memcpy(item->priority, prio64be, sizeof(item->priority)); 76. 77. item->data = data; crypto/pqueue/pqueue.c:77:5: 75. memcpy(item->priority, prio64be, sizeof(item->priority)); 76. 77. > item->data = data; 78. item->next = NULL; 79. crypto/pqueue/pqueue.c:78:5: 76. 77. item->data = data; 78. > item->next = NULL; 79. 80. return item; crypto/pqueue/pqueue.c:80:5: 78. item->next = NULL; 79. 80. > return item; 81. } 82. crypto/pqueue/pqueue.c:81:1: return from a call to pitem_new 79. 80. return item; 81. > } 82. 83. void pitem_free(pitem *item) ssl/statem/statem_dtls.c:1146:9: Taking false branch 1144. 1145. item = pitem_new(seq64be, frag); 1146. if (item == NULL) { ^ 1147. dtls1_hm_fragment_free(frag); 1148. return 0; ssl/statem/statem_dtls.c:1151:5: Skipping pqueue_insert(): empty list of specs 1149. } 1150. 1151. pqueue_insert(s->d1->sent_messages, item); ^ 1152. return 1; 1153. }
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/ssl/statem/statem_dtls.c/#L1151
d2a_code_trace_data_43309
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ecp_smpl.c:288: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_sqr`. Showing all 18 steps of the trace crypto/ec/ecp_smpl.c:243:1: Parameter `ctx->stack.depth` 241. } 242. 243. > int ec_GFp_simple_group_check_discriminant(const EC_GROUP *group, BN_CTX *ctx) 244. { 245. int ret = 0; crypto/ec/ecp_smpl.c:258:5: Call 256. } 257. } 258. BN_CTX_start(ctx); ^ 259. a = BN_CTX_get(ctx); 260. b = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/ec/ecp_smpl.c:288:14: Call 286. goto err; 287. } else if (!BN_is_zero(b)) { 288. if (!BN_mod_sqr(tmp_1, a, p, ctx)) ^ 289. goto err; 290. if (!BN_mod_mul(tmp_2, tmp_1, a, p, ctx)) crypto/bn/bn_mod.c:222:1: Parameter `ctx->stack.depth` 220. } 221. 222. > int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx) 223. { 224. if (!BN_sqr(r, a, ctx)) crypto/bn/bn_mod.c:224:10: Call 222. int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx) 223. { 224. if (!BN_sqr(r, a, ctx)) ^ 225. return 0; 226. /* r->neg == 0, thus we don't need BN_nnmod */ crypto/bn/bn_sqr.c:17:1: Parameter `ctx->stack.depth` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int ret = bn_sqr_fixed_top(r, a, ctx); crypto/bn/bn_sqr.c:19:15: Call 17. int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int ret = bn_sqr_fixed_top(r, a, ctx); ^ 20. 21. bn_correct_top(r); crypto/bn/bn_sqr.c:42:5: Call 40. } 41. 42. BN_CTX_start(ctx); ^ 43. rr = (a != r) ? r : BN_CTX_get(ctx); 44. 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_sqr.c:104:5: Call 102. bn_check_top(rr); 103. bn_check_top(tmp); 104. BN_CTX_end(ctx); ^ 105. return ret; 106. } 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_sqr` 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_43310
static int sab_diamond_search(MpegEncContext * s, int *best, int dmin, int src_index, int ref_index, int const penalty_factor, int size, int h, int flags) { MotionEstContext * const c= &s->me; me_cmp_func cmpf, chroma_cmpf; Minima minima[MAX_SAB_SIZE]; const int minima_count= FFABS(c->dia_size); int i, j; LOAD_COMMON LOAD_COMMON2 int map_generation= c->map_generation; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; for(j=i=0; i<ME_MAP_SIZE && j<MAX_SAB_SIZE; i++){ uint32_t key= map[i]; key += (1<<(ME_MAP_MV_BITS-1)) + (1<<(2*ME_MAP_MV_BITS-1)); if((key&((-1)<<(2*ME_MAP_MV_BITS))) != map_generation) continue; minima[j].height= score_map[i]; minima[j].x= key & ((1<<ME_MAP_MV_BITS)-1); key>>=ME_MAP_MV_BITS; minima[j].y= key & ((1<<ME_MAP_MV_BITS)-1); minima[j].x-= (1<<(ME_MAP_MV_BITS-1)); minima[j].y-= (1<<(ME_MAP_MV_BITS-1)); if( minima[j].x > xmax || minima[j].x < xmin || minima[j].y > ymax || minima[j].y < ymin) continue; minima[j].checked=0; if(minima[j].x || minima[j].y) minima[j].height+= (mv_penalty[((minima[j].x)<<shift)-pred_x] + mv_penalty[((minima[j].y)<<shift)-pred_y])*penalty_factor; j++; } qsort(minima, j, sizeof(Minima), minima_cmp); for(; j<minima_count; j++){ minima[j].height=256*256*256*64; minima[j].checked=0; minima[j].x= minima[j].y=0; } for(i=0; i<minima_count; i++){ const int x= minima[i].x; const int y= minima[i].y; int d; if(minima[i].checked) continue; if( x >= xmax || x <= xmin || y >= ymax || y <= ymin) continue; SAB_CHECK_MV(x-1, y) SAB_CHECK_MV(x+1, y) SAB_CHECK_MV(x , y-1) SAB_CHECK_MV(x , y+1) minima[i].checked= 1; } best[0]= minima[0].x; best[1]= minima[0].y; dmin= minima[0].height; if( best[0] < xmax && best[0] > xmin && best[1] < ymax && best[1] > ymin){ int d; CHECK_MV(best[0]-1, best[1]) CHECK_MV(best[0]+1, best[1]) CHECK_MV(best[0], best[1]-1) CHECK_MV(best[0], best[1]+1) } return dmin; } libavcodec/motion_est_template.c:885: error: Uninitialized Value The value read from ymax was never initialized. libavcodec/motion_est_template.c:885:11: 883. 884. if( best[0] < xmax && best[0] > xmin 885. && best[1] < ymax && best[1] > ymin){ ^ 886. int d; 887. //ensure that the refernece samples for hpel refinement are in the map
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L885
d2a_code_trace_data_43311
int tls_construct_new_session_ticket(SSL *s) { unsigned char *senc = NULL; EVP_CIPHER_CTX *ctx; HMAC_CTX *hctx = NULL; unsigned char *p, *macstart; const unsigned char *const_p; int len, slen_full, slen; SSL_SESSION *sess; unsigned int hlen; SSL_CTX *tctx = s->initial_ctx; unsigned char iv[EVP_MAX_IV_LENGTH]; unsigned char key_name[TLSEXT_KEYNAME_LENGTH]; int iv_len; slen_full = i2d_SSL_SESSION(s->session, NULL); if (slen_full == 0 || slen_full > 0xFF00) { ossl_statem_set_error(s); return 0; } senc = OPENSSL_malloc(slen_full); if (senc == NULL) { ossl_statem_set_error(s); return 0; } ctx = EVP_CIPHER_CTX_new(); hctx = HMAC_CTX_new(); p = senc; if (!i2d_SSL_SESSION(s->session, &p)) goto err; const_p = senc; sess = d2i_SSL_SESSION(NULL, &const_p, slen_full); if (sess == NULL) goto err; sess->session_id_length = 0; slen = i2d_SSL_SESSION(sess, NULL); if (slen == 0 || slen > slen_full) { SSL_SESSION_free(sess); goto err; } p = senc; if (!i2d_SSL_SESSION(sess, &p)) { SSL_SESSION_free(sess); goto err; } SSL_SESSION_free(sess); if (!BUF_MEM_grow(s->init_buf, SSL_HM_HEADER_LENGTH(s) + 6 + sizeof(key_name) + EVP_MAX_IV_LENGTH + EVP_MAX_BLOCK_LENGTH + EVP_MAX_MD_SIZE + slen)) goto err; p = ssl_handshake_start(s); if (tctx->tlsext_ticket_key_cb) { int ret = tctx->tlsext_ticket_key_cb(s, key_name, iv, ctx, hctx, 1); if (ret == 0) { l2n(0, p); s2n(0, p); if (!ssl_set_handshake_header(s, SSL3_MT_NEWSESSION_TICKET, p - ssl_handshake_start(s))) goto err; OPENSSL_free(senc); EVP_CIPHER_CTX_free(ctx); HMAC_CTX_free(hctx); return 1; } if (ret < 0) goto err; iv_len = EVP_CIPHER_CTX_iv_length(ctx); } else { const EVP_CIPHER *cipher = EVP_aes_256_cbc(); iv_len = EVP_CIPHER_iv_length(cipher); if (RAND_bytes(iv, iv_len) <= 0) goto err; if (!EVP_EncryptInit_ex(ctx, cipher, NULL, tctx->tlsext_tick_aes_key, iv)) goto err; if (!HMAC_Init_ex(hctx, tctx->tlsext_tick_hmac_key, sizeof(tctx->tlsext_tick_hmac_key), EVP_sha256(), NULL)) goto err; memcpy(key_name, tctx->tlsext_tick_key_name, sizeof(tctx->tlsext_tick_key_name)); } l2n(s->hit ? 0 : s->session->timeout, p); p += 2; macstart = p; memcpy(p, key_name, sizeof(key_name)); p += sizeof(key_name); memcpy(p, iv, iv_len); p += iv_len; if (!EVP_EncryptUpdate(ctx, p, &len, senc, slen)) goto err; p += len; if (!EVP_EncryptFinal(ctx, p, &len)) goto err; p += len; if (!HMAC_Update(hctx, macstart, p - macstart)) goto err; if (!HMAC_Final(hctx, p, &hlen)) goto err; EVP_CIPHER_CTX_free(ctx); HMAC_CTX_free(hctx); ctx = NULL; hctx = NULL; p += hlen; len = p - ssl_handshake_start(s); p = ssl_handshake_start(s) + 4; s2n(len - 6, p); if (!ssl_set_handshake_header(s, SSL3_MT_NEWSESSION_TICKET, len)) goto err; OPENSSL_free(senc); return 1; err: OPENSSL_free(senc); EVP_CIPHER_CTX_free(ctx); HMAC_CTX_free(hctx); ossl_statem_set_error(s); return 0; } ssl/statem/statem_srvr.c:2959: error: BUFFER_OVERRUN_S2 Offset: [`s->method->ssl3_enc->hhlen` + 5, `s->method->ssl3_enc->hhlen` + 5] (⇐ [`s->method->ssl3_enc->hhlen` + 4, `s->method->ssl3_enc->hhlen` + 4] + 1) Size: [1, 2147483644]. Showing all 8 steps of the trace ssl/statem/statem_srvr.c:2874:1: <Length trace> 2872. } 2873. 2874. > int tls_construct_new_session_ticket(SSL *s) 2875. { 2876. unsigned char *senc = NULL; ssl/statem/statem_srvr.c:2874:1: Parameter `s->method->ssl3_enc->hhlen` 2872. } 2873. 2874. > int tls_construct_new_session_ticket(SSL *s) 2875. { 2876. unsigned char *senc = NULL; ssl/statem/statem_srvr.c:2947:5: Assignment 2945. goto err; 2946. 2947. p = ssl_handshake_start(s); ^ 2948. /* 2949. * Initialize HMAC and cipher contexts. If callback present it does ssl/statem/statem_srvr.c:2958:13: Assignment 2956. 2957. if (ret == 0) { 2958. l2n(0, p); /* timeout */ ^ 2959. s2n(0, p); /* length */ 2960. if (!ssl_set_handshake_header(s, SSL3_MT_NEWSESSION_TICKET, p - ssl_handshake_start(s))) ssl/statem/statem_srvr.c:2958:13: Assignment 2956. 2957. if (ret == 0) { 2958. l2n(0, p); /* timeout */ ^ 2959. s2n(0, p); /* length */ 2960. if (!ssl_set_handshake_header(s, SSL3_MT_NEWSESSION_TICKET, p - ssl_handshake_start(s))) ssl/statem/statem_srvr.c:2958:13: Assignment 2956. 2957. if (ret == 0) { 2958. l2n(0, p); /* timeout */ ^ 2959. s2n(0, p); /* length */ 2960. if (!ssl_set_handshake_header(s, SSL3_MT_NEWSESSION_TICKET, p - ssl_handshake_start(s))) ssl/statem/statem_srvr.c:2958:13: Assignment 2956. 2957. if (ret == 0) { 2958. l2n(0, p); /* timeout */ ^ 2959. s2n(0, p); /* length */ 2960. if (!ssl_set_handshake_header(s, SSL3_MT_NEWSESSION_TICKET, p - ssl_handshake_start(s))) ssl/statem/statem_srvr.c:2959:13: Array access: Offset: [s->method->ssl3_enc->hhlen + 5, s->method->ssl3_enc->hhlen + 5] (⇐ [s->method->ssl3_enc->hhlen + 4, s->method->ssl3_enc->hhlen + 4] + 1) Size: [1, 2147483644] 2957. if (ret == 0) { 2958. l2n(0, p); /* timeout */ 2959. s2n(0, p); /* length */ ^ 2960. if (!ssl_set_handshake_header(s, SSL3_MT_NEWSESSION_TICKET, p - ssl_handshake_start(s))) 2961. goto err;
https://github.com/openssl/openssl/blob/6670d55a847f8f2415842bc085150e838d4aac5d/ssl/statem/statem_srvr.c/#L2959
d2a_code_trace_data_43312
static int xan_huffman_decode(unsigned char *dest, int dest_len, const unsigned char *src, int src_len) { unsigned char byte = *src++; unsigned char ival = byte + 0x16; const unsigned char * ptr = src + byte*2; int ptr_len = src_len - 1 - byte*2; unsigned char val = ival; unsigned char *dest_end = dest + dest_len; unsigned char *dest_start = dest; GetBitContext gb; if (ptr_len < 0) return AVERROR_INVALIDDATA; init_get_bits(&gb, ptr, ptr_len * 8); while (val != 0x16) { unsigned idx = val - 0x17 + get_bits1(&gb) * byte; if (idx >= 2 * byte) return AVERROR_INVALIDDATA; val = src[idx]; if (val < 0x16) { if (dest >= dest_end) return dest_len; *dest++ = val; val = ival; } } return dest - dest_start; } libavcodec/xan.c:115: error: Null Dereference pointer `&gb->buffer` last assigned on line 112 could be null and is dereferenced by call to `get_bits1()` at line 115, column 37. libavcodec/xan.c:97:1: start of procedure xan_huffman_decode() 95. } 96. 97. static int xan_huffman_decode(unsigned char *dest, int dest_len, ^ 98. const unsigned char *src, int src_len) 99. { libavcodec/xan.c:100:5: 98. const unsigned char *src, int src_len) 99. { 100. unsigned char byte = *src++; ^ 101. unsigned char ival = byte + 0x16; 102. const unsigned char * ptr = src + byte*2; libavcodec/xan.c:101:5: 99. { 100. unsigned char byte = *src++; 101. unsigned char ival = byte + 0x16; ^ 102. const unsigned char * ptr = src + byte*2; 103. int ptr_len = src_len - 1 - byte*2; libavcodec/xan.c:102:5: 100. unsigned char byte = *src++; 101. unsigned char ival = byte + 0x16; 102. const unsigned char * ptr = src + byte*2; ^ 103. int ptr_len = src_len - 1 - byte*2; 104. unsigned char val = ival; libavcodec/xan.c:103:5: 101. unsigned char ival = byte + 0x16; 102. const unsigned char * ptr = src + byte*2; 103. int ptr_len = src_len - 1 - byte*2; ^ 104. unsigned char val = ival; 105. unsigned char *dest_end = dest + dest_len; libavcodec/xan.c:104:5: 102. const unsigned char * ptr = src + byte*2; 103. int ptr_len = src_len - 1 - byte*2; 104. unsigned char val = ival; ^ 105. unsigned char *dest_end = dest + dest_len; 106. unsigned char *dest_start = dest; libavcodec/xan.c:105:5: 103. int ptr_len = src_len - 1 - byte*2; 104. unsigned char val = ival; 105. unsigned char *dest_end = dest + dest_len; ^ 106. unsigned char *dest_start = dest; 107. GetBitContext gb; libavcodec/xan.c:106:5: 104. unsigned char val = ival; 105. unsigned char *dest_end = dest + dest_len; 106. unsigned char *dest_start = dest; ^ 107. GetBitContext gb; 108. libavcodec/xan.c:109:9: Taking false branch 107. GetBitContext gb; 108. 109. if (ptr_len < 0) ^ 110. return AVERROR_INVALIDDATA; 111. libavcodec/xan.c:112:5: 110. return AVERROR_INVALIDDATA; 111. 112. init_get_bits(&gb, ptr, ptr_len * 8); ^ 113. 114. while (val != 0x16) { libavcodec/get_bits.h:375:1: start of procedure init_get_bits() 373. * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow. 374. */ 375. static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer, ^ 376. int bit_size) 377. { libavcodec/get_bits.h:379:5: 377. { 378. int buffer_size; 379. int ret = 0; ^ 380. 381. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { libavcodec/get_bits.h:381:9: Taking true branch 379. int ret = 0; 380. 381. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { ^ 382. buffer_size = bit_size = 0; 383. buffer = NULL; libavcodec/get_bits.h:382:9: 380. 381. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { 382. buffer_size = bit_size = 0; ^ 383. buffer = NULL; 384. ret = AVERROR_INVALIDDATA; libavcodec/get_bits.h:383:9: 381. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { 382. buffer_size = bit_size = 0; 383. buffer = NULL; ^ 384. ret = AVERROR_INVALIDDATA; 385. } libavcodec/get_bits.h:384:9: 382. buffer_size = bit_size = 0; 383. buffer = NULL; 384. ret = AVERROR_INVALIDDATA; ^ 385. } 386. libavcodec/get_bits.h:387:5: 385. } 386. 387. buffer_size = (bit_size + 7) >> 3; ^ 388. 389. s->buffer = buffer; libavcodec/get_bits.h:389:5: 387. buffer_size = (bit_size + 7) >> 3; 388. 389. s->buffer = buffer; ^ 390. s->size_in_bits = bit_size; 391. #if !UNCHECKED_BITSTREAM_READER libavcodec/get_bits.h:390:5: 388. 389. s->buffer = buffer; 390. s->size_in_bits = bit_size; ^ 391. #if !UNCHECKED_BITSTREAM_READER 392. s->size_in_bits_plus8 = bit_size + 8; libavcodec/get_bits.h:392:5: 390. s->size_in_bits = bit_size; 391. #if !UNCHECKED_BITSTREAM_READER 392. s->size_in_bits_plus8 = bit_size + 8; ^ 393. #endif 394. s->buffer_end = buffer + buffer_size; libavcodec/get_bits.h:394:5: 392. s->size_in_bits_plus8 = bit_size + 8; 393. #endif 394. s->buffer_end = buffer + buffer_size; ^ 395. s->index = 0; 396. libavcodec/get_bits.h:395:5: 393. #endif 394. s->buffer_end = buffer + buffer_size; 395. s->index = 0; ^ 396. 397. return ret; libavcodec/get_bits.h:397:5: 395. s->index = 0; 396. 397. return ret; ^ 398. } 399. libavcodec/get_bits.h:398:1: return from a call to init_get_bits 396. 397. return ret; 398. } ^ 399. 400. /** libavcodec/xan.c:114:12: Loop condition is true. Entering loop body 112. init_get_bits(&gb, ptr, ptr_len * 8); 113. 114. while (val != 0x16) { ^ 115. unsigned idx = val - 0x17 + get_bits1(&gb) * byte; 116. if (idx >= 2 * byte) libavcodec/xan.c:115:9: 113. 114. while (val != 0x16) { 115. unsigned idx = val - 0x17 + get_bits1(&gb) * byte; ^ 116. if (idx >= 2 * byte) 117. return AVERROR_INVALIDDATA; libavcodec/get_bits.h:271:1: start of procedure get_bits1() 269. } 270. 271. static inline unsigned int get_bits1(GetBitContext *s) ^ 272. { 273. unsigned int index = s->index; libavcodec/get_bits.h:273:5: 271. static inline unsigned int get_bits1(GetBitContext *s) 272. { 273. unsigned int index = s->index; ^ 274. uint8_t result = s->buffer[index >> 3]; 275. #ifdef BITSTREAM_READER_LE libavcodec/get_bits.h:274:5: 272. { 273. unsigned int index = s->index; 274. uint8_t result = s->buffer[index >> 3]; ^ 275. #ifdef BITSTREAM_READER_LE 276. result >>= index & 7;
https://github.com/libav/libav/blob/fc739b3eefa0b58d64e7661621da94a94dbc8a82/libavcodec/xan.c/#L115
d2a_code_trace_data_43313
static void print_key_details(BIO *out, EVP_PKEY *key) { int keyid = EVP_PKEY_id(key); #ifndef OPENSSL_NO_EC if (keyid == EVP_PKEY_EC) { EC_KEY *ec = EVP_PKEY_get1_EC_KEY(key); int nid; const char *cname; nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec)); EC_KEY_free(ec); cname = EC_curve_nid2nist(nid); if (!cname) cname = OBJ_nid2sn(nid); BIO_printf(out, "%d bits EC (%s)", EVP_PKEY_bits(key), cname); } else #endif { const char *algname; switch (keyid) { case EVP_PKEY_RSA: algname = "RSA"; break; case EVP_PKEY_DSA: algname = "DSA"; break; case EVP_PKEY_DH: algname = "DH"; break; default: algname = OBJ_nid2sn(keyid); break; } BIO_printf(out, "%d bits %s", EVP_PKEY_bits(key), algname); } } test/ssltest.c:842: error: NULL_DEREFERENCE pointer `ec` last assigned on line 839 could be null and is dereferenced by call to `EC_KEY_get0_group()` at line 842, column 39. Showing all 19 steps of the trace test/ssltest.c:834:1: start of procedure print_key_details() 832. } 833. 834. > static void print_key_details(BIO *out, EVP_PKEY *key) 835. { 836. int keyid = EVP_PKEY_id(key); test/ssltest.c:836:5: 834. static void print_key_details(BIO *out, EVP_PKEY *key) 835. { 836. > int keyid = EVP_PKEY_id(key); 837. #ifndef OPENSSL_NO_EC 838. if (keyid == EVP_PKEY_EC) { crypto/evp/p_lib.c:410:1: start of procedure EVP_PKEY_id() 408. } 409. 410. > int EVP_PKEY_id(const EVP_PKEY *pkey) 411. { 412. return pkey->type; crypto/evp/p_lib.c:412:5: 410. int EVP_PKEY_id(const EVP_PKEY *pkey) 411. { 412. > return pkey->type; 413. } 414. crypto/evp/p_lib.c:413:1: return from a call to EVP_PKEY_id 411. { 412. return pkey->type; 413. > } 414. 415. int EVP_PKEY_base_id(const EVP_PKEY *pkey) test/ssltest.c:838:9: Taking true branch 836. int keyid = EVP_PKEY_id(key); 837. #ifndef OPENSSL_NO_EC 838. if (keyid == EVP_PKEY_EC) { ^ 839. EC_KEY *ec = EVP_PKEY_get1_EC_KEY(key); 840. int nid; test/ssltest.c:839:9: 837. #ifndef OPENSSL_NO_EC 838. if (keyid == EVP_PKEY_EC) { 839. > EC_KEY *ec = EVP_PKEY_get1_EC_KEY(key); 840. int nid; 841. const char *cname; crypto/evp/p_lib.c:356:1: start of procedure EVP_PKEY_get1_EC_KEY() 354. } 355. 356. > EC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey) 357. { 358. EC_KEY *ret = EVP_PKEY_get0_EC_KEY(pkey); crypto/evp/p_lib.c:358:5: 356. EC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey) 357. { 358. > EC_KEY *ret = EVP_PKEY_get0_EC_KEY(pkey); 359. if (ret != NULL) 360. EC_KEY_up_ref(ret); crypto/evp/p_lib.c:347:1: start of procedure EVP_PKEY_get0_EC_KEY() 345. } 346. 347. > EC_KEY *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey) 348. { 349. if (pkey->type != EVP_PKEY_EC) { crypto/evp/p_lib.c:349:9: Taking false branch 347. EC_KEY *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey) 348. { 349. if (pkey->type != EVP_PKEY_EC) { ^ 350. EVPerr(EVP_F_EVP_PKEY_GET0_EC_KEY, EVP_R_EXPECTING_A_EC_KEY); 351. return NULL; crypto/evp/p_lib.c:353:5: 351. return NULL; 352. } 353. > return pkey->pkey.ec; 354. } 355. crypto/evp/p_lib.c:354:1: return from a call to EVP_PKEY_get0_EC_KEY 352. } 353. return pkey->pkey.ec; 354. > } 355. 356. EC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey) crypto/evp/p_lib.c:359:9: Taking false branch 357. { 358. EC_KEY *ret = EVP_PKEY_get0_EC_KEY(pkey); 359. if (ret != NULL) ^ 360. EC_KEY_up_ref(ret); 361. return ret; crypto/evp/p_lib.c:361:5: 359. if (ret != NULL) 360. EC_KEY_up_ref(ret); 361. > return ret; 362. } 363. #endif crypto/evp/p_lib.c:362:1: return from a call to EVP_PKEY_get1_EC_KEY 360. EC_KEY_up_ref(ret); 361. return ret; 362. > } 363. #endif 364. test/ssltest.c:842:9: 840. int nid; 841. const char *cname; 842. > nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec)); 843. EC_KEY_free(ec); 844. cname = EC_curve_nid2nist(nid); crypto/ec/ec_key.c:450:1: start of procedure EC_KEY_get0_group() 448. } 449. 450. > const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key) 451. { 452. return key->group; crypto/ec/ec_key.c:452:5: 450. const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key) 451. { 452. > return key->group; 453. } 454.
https://github.com/openssl/openssl/blob/57ce7b617c602ae8513c22daa2bda31f179edb0f/test/ssltest.c/#L842
d2a_code_trace_data_43314
static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr, SpectrumParameters *spectrum) { unsigned int temp, max_qmf_subbands; unsigned int start_min, stop_min; int k; const int8_t *sbr_offset_ptr; int16_t stop_dk[13]; if (sbr->sample_rate < 32000) { temp = 3000; } else if (sbr->sample_rate < 64000) { temp = 4000; } else temp = 5000; start_min = ((temp << 7) + (sbr->sample_rate >> 1)) / sbr->sample_rate; stop_min = ((temp << 8) + (sbr->sample_rate >> 1)) / sbr->sample_rate; switch (sbr->sample_rate) { case 16000: sbr_offset_ptr = sbr_offset[0]; break; case 22050: sbr_offset_ptr = sbr_offset[1]; break; case 24000: sbr_offset_ptr = sbr_offset[2]; break; case 32000: sbr_offset_ptr = sbr_offset[3]; break; case 44100: case 48000: case 64000: sbr_offset_ptr = sbr_offset[4]; break; case 88200: case 96000: case 128000: case 176400: case 192000: sbr_offset_ptr = sbr_offset[5]; break; default: av_log(ac->avctx, AV_LOG_ERROR, "Unsupported sample rate for SBR: %d\n", sbr->sample_rate); return -1; } sbr->k[0] = start_min + sbr_offset_ptr[spectrum->bs_start_freq]; if (spectrum->bs_stop_freq < 14) { sbr->k[2] = stop_min; make_bands(stop_dk, stop_min, 64, 13); qsort(stop_dk, 13, sizeof(stop_dk[0]), qsort_comparison_function_int16); for (k = 0; k < spectrum->bs_stop_freq; k++) sbr->k[2] += stop_dk[k]; } else if (spectrum->bs_stop_freq == 14) { sbr->k[2] = 2*sbr->k[0]; } else if (spectrum->bs_stop_freq == 15) { sbr->k[2] = 3*sbr->k[0]; } else { av_log(ac->avctx, AV_LOG_ERROR, "Invalid bs_stop_freq: %d\n", spectrum->bs_stop_freq); return -1; } sbr->k[2] = FFMIN(64, sbr->k[2]); if (sbr->sample_rate <= 32000) { max_qmf_subbands = 48; } else if (sbr->sample_rate == 44100) { max_qmf_subbands = 35; } else if (sbr->sample_rate >= 48000) max_qmf_subbands = 32; if (sbr->k[2] - sbr->k[0] > max_qmf_subbands) { av_log(ac->avctx, AV_LOG_ERROR, "Invalid bitstream, too many QMF subbands: %d\n", sbr->k[2] - sbr->k[0]); return -1; } if (!spectrum->bs_freq_scale) { int dk, k2diff; dk = spectrum->bs_alter_scale + 1; sbr->n_master = ((sbr->k[2] - sbr->k[0] + (dk&2)) >> dk) << 1; if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band)) return -1; for (k = 1; k <= sbr->n_master; k++) sbr->f_master[k] = dk; k2diff = sbr->k[2] - sbr->k[0] - sbr->n_master * dk; if (k2diff < 0) { sbr->f_master[1]--; sbr->f_master[2]-= (k2diff < -1); } else if (k2diff) { sbr->f_master[sbr->n_master]++; } sbr->f_master[0] = sbr->k[0]; for (k = 1; k <= sbr->n_master; k++) sbr->f_master[k] += sbr->f_master[k - 1]; } else { int half_bands = 7 - spectrum->bs_freq_scale; int two_regions, num_bands_0; int vdk0_max, vdk1_min; int16_t vk0[49]; if (49 * sbr->k[2] > 110 * sbr->k[0]) { two_regions = 1; sbr->k[1] = 2 * sbr->k[0]; } else { two_regions = 0; sbr->k[1] = sbr->k[2]; } num_bands_0 = lrintf(half_bands * log2f(sbr->k[1] / (float)sbr->k[0])) * 2; if (num_bands_0 <= 0) { av_log(ac->avctx, AV_LOG_ERROR, "Invalid num_bands_0: %d\n", num_bands_0); return -1; } vk0[0] = 0; make_bands(vk0+1, sbr->k[0], sbr->k[1], num_bands_0); qsort(vk0 + 1, num_bands_0, sizeof(vk0[1]), qsort_comparison_function_int16); vdk0_max = vk0[num_bands_0]; vk0[0] = sbr->k[0]; for (k = 1; k <= num_bands_0; k++) { if (vk0[k] <= 0) { av_log(ac->avctx, AV_LOG_ERROR, "Invalid vDk0[%d]: %d\n", k, vk0[k]); return -1; } vk0[k] += vk0[k-1]; } if (two_regions) { int16_t vk1[49]; float invwarp = spectrum->bs_alter_scale ? 0.76923076923076923077f : 1.0f; int num_bands_1 = lrintf(half_bands * invwarp * log2f(sbr->k[2] / (float)sbr->k[1])) * 2; make_bands(vk1+1, sbr->k[1], sbr->k[2], num_bands_1); vdk1_min = array_min_int16(vk1 + 1, num_bands_1); if (vdk1_min < vdk0_max) { int change; qsort(vk1 + 1, num_bands_1, sizeof(vk1[1]), qsort_comparison_function_int16); change = FFMIN(vdk0_max - vk1[1], (vk1[num_bands_1] - vk1[1]) >> 1); vk1[1] += change; vk1[num_bands_1] -= change; } qsort(vk1 + 1, num_bands_1, sizeof(vk1[1]), qsort_comparison_function_int16); vk1[0] = sbr->k[1]; for (k = 1; k <= num_bands_1; k++) { if (vk1[k] <= 0) { av_log(ac->avctx, AV_LOG_ERROR, "Invalid vDk1[%d]: %d\n", k, vk1[k]); return -1; } vk1[k] += vk1[k-1]; } sbr->n_master = num_bands_0 + num_bands_1; if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band)) return -1; memcpy(&sbr->f_master[0], vk0, (num_bands_0 + 1) * sizeof(sbr->f_master[0])); memcpy(&sbr->f_master[num_bands_0 + 1], vk1 + 1, num_bands_1 * sizeof(sbr->f_master[0])); } else { sbr->n_master = num_bands_0; if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band)) return -1; memcpy(sbr->f_master, vk0, (num_bands_0 + 1) * sizeof(sbr->f_master[0])); } } return 0; } libavcodec/aacdec.c:2061: error: Integer Overflow L2 ([0, +oo] - 1):unsigned16 by call to `decode_extension_payload`. libavcodec/aacdec.c:2037:19: Call 2035. 2036. case TYPE_DSE: 2037. err = skip_data_stream_element(ac, &gb); ^ 2038. break; 2039. libavcodec/aacdec.c:610:1: Parameter `*ac->avctx` 608. * Skip data_stream_element; reference: table 4.10. 609. */ 610. static int skip_data_stream_element(AACContext *ac, GetBitContext *gb) ^ 611. { 612. int byte_align = get_bits1(gb); libavcodec/aacdec.c:2061:28: Call 2059. } 2060. while (elem_id > 0) 2061. elem_id -= decode_extension_payload(ac, &gb, elem_id, che_prev, elem_type_prev); ^ 2062. err = 0; /* FIXME */ 2063. break; libavcodec/aacdec.c:1654:1: Parameter `che->sbr.f_master[*]` 1652. * @return Returns number of bytes consumed 1653. */ 1654. static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt, ^ 1655. ChannelElement *che, enum RawDataBlockType elem_type) 1656. { libavcodec/aacdec.c:1681:15: Call 1679. ac->m4ac.sbr = 1; 1680. } 1681. res = ff_decode_sbr_extension(ac, &che->sbr, gb, crc_flag, cnt, elem_type); ^ 1682. break; 1683. case EXT_DYNAMIC_RANGE: libavcodec/aacsbr.c:1044:1: Parameter `sbr->f_master[*]` 1042. * @return Returns number of bytes consumed from the TYPE_FIL element. 1043. */ 1044. int ff_decode_sbr_extension(AACContext *ac, SpectralBandReplication *sbr, ^ 1045. GetBitContext *gb_host, int crc, int cnt, int id_aac) 1046. { libavcodec/aacsbr.c:1073:9: Call 1071. 1072. if (sbr->reset) 1073. sbr_reset(ac, sbr); ^ 1074. 1075. if (sbr->start) libavcodec/aacsbr.c:1023:1: Parameter `sbr->f_master[*]` 1021. } 1022. 1023. static void sbr_reset(AACContext *ac, SpectralBandReplication *sbr) ^ 1024. { 1025. int err; libavcodec/aacsbr.c:1026:11: Call 1024. { 1025. int err; 1026. err = sbr_make_f_master(ac, sbr, &sbr->spectrum_params); ^ 1027. if (err >= 0) 1028. err = sbr_make_f_derived(ac, sbr); libavcodec/aacsbr.c:304:1: <LHS trace> 302. 303. /// Master Frequency Band Table (14496-3 sp04 p194) 304. static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr, ^ 305. SpectrumParameters *spectrum) 306. { libavcodec/aacsbr.c:304:1: Parameter `sbr->f_master[*]` 302. 303. /// Master Frequency Band Table (14496-3 sp04 p194) 304. static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr, ^ 305. SpectrumParameters *spectrum) 306. { libavcodec/aacsbr.c:394:13: Binary operation: ([0, +oo] - 1):unsigned16 by call to `decode_extension_payload` 392. k2diff = sbr->k[2] - sbr->k[0] - sbr->n_master * dk; 393. if (k2diff < 0) { 394. sbr->f_master[1]--; ^ 395. sbr->f_master[2]-= (k2diff < -1); 396. } else if (k2diff) {
https://github.com/libav/libav/blob/5634f30c4a25c17c1de26703948efeafb733413d/libavcodec/aacsbr.c/#L394
d2a_code_trace_data_43315
size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) { int len = strlen(dst); va_list vl; va_start(vl, fmt); len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); va_end(vl); return len; } ffmpeg.c:1878: error: Integer Overflow R2 ([0, +oo] + [0, +oo]):signed32 by call to `print_sdp`. ffmpeg.c:1721:25: Unknown value from: fopen 1719. pass_logfilename : DEFAULT_PASS_LOGFILENAME, i); 1720. if (codec->flags & CODEC_FLAG_PASS1) { 1721. f = fopen(logfilename, "w"); ^ 1722. if (!f) { 1723. perror(logfilename); ffmpeg.c:1878:9: Call 1876. } 1877. if (want_sdp) { 1878. print_sdp(output_files, nb_output_files); ^ 1879. } 1880. ffmpeg.c:1375:1: Parameter `sdp.strlen` 1373. } 1374. 1375. static void print_sdp(AVFormatContext **avc, int n) ^ 1376. { 1377. char sdp[2048]; ffmpeg.c:1379:5: Call 1377. char sdp[2048]; 1378. 1379. avf_sdp_create(avc, n, sdp, sizeof(sdp)); ^ 1380. printf("SDP:\n%s\n", sdp); 1381. } libavformat/sdp.c:277:1: Parameter `buff->strlen` 275. } 276. 277. int avf_sdp_create(AVFormatContext *ac[], int n_files, char *buff, int size) ^ 278. { 279. struct sdp_session_level s; libavformat/sdp.c:298:5: Call 296. } 297. } 298. sdp_write_header(buff, size, &s); ^ 299. 300. dst[0] = 0; libavformat/sdp.c:56:1: Parameter `buff->strlen` 54. } 55. 56. static void sdp_write_header(char *buff, int size, struct sdp_session_level *s) ^ 57. { 58. av_strlcatf(buff, size, "v=%d\r\n" libavformat/sdp.c:67:5: Call 65. s->start_time, s->end_time, 66. s->name[0] ? s->name : "No Name"); 67. dest_write(buff, size, s->dst_addr, s->ttl); ^ 68. } 69. libavformat/sdp.c:45:1: Parameter `buff->strlen` 43. }; 44. 45. static void dest_write(char *buff, int size, const char *dest_addr, int ttl) ^ 46. { 47. if (dest_addr) { libavformat/sdp.c:49:13: Call 47. if (dest_addr) { 48. if (ttl > 0) { 49. av_strlcatf(buff, size, "c=IN IP4 %s/%d\r\n", dest_addr, ttl); ^ 50. } else { 51. av_strlcatf(buff, size, "c=IN IP4 %s\r\n", dest_addr); libavutil/string.c:68:1: <LHS trace> 66. } 67. 68. size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) ^ 69. { 70. int len = strlen(dst); libavutil/string.c:68:1: Parameter `size` 66. } 67. 68. size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) ^ 69. { 70. int len = strlen(dst); libavutil/string.c:74:12: <RHS trace> 72. 73. va_start(vl, fmt); 74. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); ^ 75. va_end(vl); 76. libavutil/string.c:74:12: Risky value from: vsnprintf 72. 73. va_start(vl, fmt); 74. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); ^ 75. va_end(vl); 76. libavutil/string.c:74:5: Binary operation: ([0, +oo] + [0, +oo]):signed32 by call to `print_sdp` 72. 73. va_start(vl, fmt); 74. len += vsnprintf(dst + len, size > len ? size - len : 0, fmt, vl); ^ 75. va_end(vl); 76.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavutil/string.c/#L74
d2a_code_trace_data_43316
char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) { X509_NAME_ENTRY *ne; int i; int n, lold, l, l1, l2, num, j, type; const char *s; char *p; unsigned char *q; BUF_MEM *b = NULL; static const char hex[17] = "0123456789ABCDEF"; int gs_doit[4]; char tmp_buf[80]; #ifdef CHARSET_EBCDIC unsigned char ebcdic_buf[1024]; #endif if (buf == NULL) { if ((b = BUF_MEM_new()) == NULL) goto err; if (!BUF_MEM_grow(b, 200)) goto err; b->data[0] = '\0'; len = 200; } else if (len == 0) { return NULL; } if (a == NULL) { if (b) { buf = b->data; OPENSSL_free(b); } strncpy(buf, "NO X509_NAME", len); buf[len - 1] = '\0'; return buf; } len--; l = 0; for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) { ne = sk_X509_NAME_ENTRY_value(a->entries, i); n = OBJ_obj2nid(ne->object); if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) { i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object); s = tmp_buf; } l1 = strlen(s); type = ne->value->type; num = ne->value->length; if (num > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } q = ne->value->data; #ifdef CHARSET_EBCDIC if (type == V_ASN1_GENERALSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_PRINTABLESTRING || type == V_ASN1_TELETEXSTRING || type == V_ASN1_VISIBLESTRING || type == V_ASN1_IA5STRING) { ascii2ebcdic(ebcdic_buf, q, (num > (int)sizeof(ebcdic_buf)) ? (int)sizeof(ebcdic_buf) : num); q = ebcdic_buf; } #endif if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) { gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0; for (j = 0; j < num; j++) if (q[j] != 0) gs_doit[j & 3] = 1; if (gs_doit[0] | gs_doit[1] | gs_doit[2]) gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; else { gs_doit[0] = gs_doit[1] = gs_doit[2] = 0; gs_doit[3] = 1; } } else gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1; for (l2 = j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; l2++; #ifndef CHARSET_EBCDIC if ((q[j] < ' ') || (q[j] > '~')) l2 += 3; #else if ((os_toascii[q[j]] < os_toascii[' ']) || (os_toascii[q[j]] > os_toascii['~'])) l2 += 3; #endif } lold = l; l += 1 + l1 + 1 + l2; if (l > NAME_ONELINE_MAX) { X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG); goto end; } if (b != NULL) { if (!BUF_MEM_grow(b, l + 1)) goto err; p = &(b->data[lold]); } else if (l > len) { break; } else p = &(buf[lold]); *(p++) = '/'; memcpy(p, s, (unsigned int)l1); p += l1; *(p++) = '='; #ifndef CHARSET_EBCDIC q = ne->value->data; #endif for (j = 0; j < num; j++) { if (!gs_doit[j & 3]) continue; #ifndef CHARSET_EBCDIC n = q[j]; if ((n < ' ') || (n > '~')) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = n; #else n = os_toascii[q[j]]; if ((n < os_toascii[' ']) || (n > os_toascii['~'])) { *(p++) = '\\'; *(p++) = 'x'; *(p++) = hex[(n >> 4) & 0x0f]; *(p++) = hex[n & 0x0f]; } else *(p++) = q[j]; #endif } *p = '\0'; } if (b != NULL) { p = b->data; OPENSSL_free(b); } else p = buf; if (i == 0) *p = '\0'; return (p); err: X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE); end: BUF_MEM_free(b); return (NULL); } apps/x509.c:762: error: BUFFER_OVERRUN_L3 Offset added: [200, 256] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace apps/x509.c:762:17: Call 760. int len; 761. 762. X509_NAME_oneline(X509_get_subject_name(x), buf, sizeof buf); ^ 763. BIO_printf(out, "/*\n" 764. " * Subject: %s\n", buf); crypto/x509/x509_obj.c:73:1: <Offset trace> 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:73:1: Parameter `len` 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:73:1: <Length trace> 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:73:1: Parameter `*buf` 71. #define NAME_ONELINE_MAX (1024 * 1024) 72. 73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 74. { 75. X509_NAME_ENTRY *ne; crypto/x509/x509_obj.c:104:9: Array access: Offset added: [200, 256] Size: [1, 2147483644] by call to `X509_NAME_oneline` 102. OPENSSL_free(b); 103. } 104. strncpy(buf, "NO X509_NAME", len); ^ 105. buf[len - 1] = '\0'; 106. return buf;
https://github.com/openssl/openssl/blob/24c2cd3967ed23acc0bd31a3781c4525e2e42a2c/crypto/x509/x509_obj.c/#L104
d2a_code_trace_data_43317
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ecdh_ossl.c:136: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mul`. Showing all 13 steps of the trace crypto/ec/ecdh_ossl.c:122:5: Call 120. if ((ctx = BN_CTX_new()) == NULL) 121. goto err; 122. BN_CTX_start(ctx); ^ 123. x = BN_CTX_get(ctx); 124. y = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:227:1: Parameter `ctx->stack.depth` 225. } 226. 227. > void BN_CTX_start(BN_CTX *ctx) 228. { 229. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/ec/ecdh_ossl.c:136:14: Call 134. if (EC_KEY_get_flags(ecdh) & EC_FLAG_COFACTOR_ECDH) { 135. if (!EC_GROUP_get_cofactor(group, x, NULL) || 136. !BN_mul(x, x, priv_key, ctx)) { ^ 137. ECerr(EC_F_ECDH_SIMPLE_COMPUTE_KEY, ERR_R_MALLOC_FAILURE); 138. goto err; crypto/bn/bn_mul.c:908:5: Call 906. top = al + bl; 907. 908. BN_CTX_start(ctx); ^ 909. if ((r == a) || (r == b)) { 910. if ((rr = BN_CTX_get(ctx)) == NULL) crypto/bn/bn_ctx.c:227:1: Parameter `*ctx->stack.indexes` 225. } 226. 227. > void BN_CTX_start(BN_CTX *ctx) 228. { 229. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mul.c:1032:5: Call 1030. err: 1031. bn_check_top(r); 1032. BN_CTX_end(ctx); ^ 1033. return (ret); 1034. } crypto/bn/bn_ctx.c:241:1: Parameter `*ctx->stack.indexes` 239. } 240. 241. > void BN_CTX_end(BN_CTX *ctx) 242. { 243. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:247:27: Call 245. ctx->err_stack--; 246. else { 247. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 248. /* Does this stack frame have anything to release? */ 249. if (fp < ctx->used) crypto/bn/bn_ctx.c:317:1: <Offset trace> 315. } 316. 317. > static unsigned int BN_STACK_pop(BN_STACK *st) 318. { 319. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:317:1: Parameter `st->depth` 315. } 316. 317. > static unsigned int BN_STACK_pop(BN_STACK *st) 318. { 319. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:317:1: <Length trace> 315. } 316. 317. > static unsigned int BN_STACK_pop(BN_STACK *st) 318. { 319. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:317:1: Parameter `*st->indexes` 315. } 316. 317. > static unsigned int BN_STACK_pop(BN_STACK *st) 318. { 319. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:319:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mul` 317. static unsigned int BN_STACK_pop(BN_STACK *st) 318. { 319. return st->indexes[--(st->depth)]; ^ 320. } 321.
https://github.com/openssl/openssl/blob/fdfb8c848679d74fd492e3b306500f2da0570c17/crypto/bn/bn_ctx.c/#L319
d2a_code_trace_data_43318
static void cpContigBufToSeparateBuf(uint8* out, uint8* in, uint32 rows, uint32 cols, int outskew, int inskew, tsample_t spp, int bytes_per_sample ) { while (rows-- > 0) { uint32 j = cols; while (j-- > 0) { int n = bytes_per_sample; while( n-- ) { *out++ = *in++; } in += (spp-1) * bytes_per_sample; } out += outskew; in += inskew; } } tools/tiffcp.c:1085: error: Integer Overflow L2 ([0, `rows`] - 1):unsigned32. tools/tiffcp.c:1080:1: <LHS trace> 1078. } 1079. 1080. static void ^ 1081. cpContigBufToSeparateBuf(uint8* out, uint8* in, 1082. uint32 rows, uint32 cols, int outskew, int inskew, tsample_t spp, tools/tiffcp.c:1080:1: Parameter `rows` 1078. } 1079. 1080. static void ^ 1081. cpContigBufToSeparateBuf(uint8* out, uint8* in, 1082. uint32 rows, uint32 cols, int outskew, int inskew, tsample_t spp, tools/tiffcp.c:1085:9: Binary operation: ([0, rows] - 1):unsigned32 1083. int bytes_per_sample ) 1084. { 1085. while (rows-- > 0) { ^ 1086. uint32 j = cols; 1087. while (j-- > 0)
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/tools/tiffcp.c/#L1085
d2a_code_trace_data_43319
static int img_read_packet(AVFormatContext *s1, AVPacket *pkt) { VideoData *s = s1->priv_data; char filename[1024]; int i; int size[3]={0}, ret[3]={0}; ByteIOContext *f[3]; AVCodecContext *codec= s1->streams[0]->codec; if (!s->is_pipe) { if (s1->loop_input && s->img_number > s->img_last) { s->img_number = s->img_first; } if (av_get_frame_filename(filename, sizeof(filename), s->path, s->img_number)<0 && s->img_number > 1) return AVERROR(EIO); for(i=0; i<3; i++){ if (url_fopen(&f[i], filename, URL_RDONLY) < 0) return AVERROR(EIO); size[i]= url_fsize(f[i]); if(codec->codec_id != CODEC_ID_RAWVIDEO) break; filename[ strlen(filename) - 1 ]= 'U' + i; } if(codec->codec_id == CODEC_ID_RAWVIDEO && !codec->width) infer_size(&codec->width, &codec->height, size[0]); } else { f[0] = s1->pb; if (url_feof(f[0])) return AVERROR(EIO); size[0]= 4096; } av_new_packet(pkt, size[0] + size[1] + size[2]); pkt->stream_index = 0; pkt->flags |= PKT_FLAG_KEY; pkt->size= 0; for(i=0; i<3; i++){ if(size[i]){ ret[i]= get_buffer(f[i], pkt->data + pkt->size, size[i]); if (!s->is_pipe) url_fclose(f[i]); if(ret[i]>0) pkt->size += ret[i]; } } if (ret[0] <= 0 || ret[1]<0 || ret[2]<0) { av_free_packet(pkt); return AVERROR(EIO); } else { s->img_count++; s->img_number++; return 0; } } libavformat/img2.c:269: error: Integer Overflow L2 ([0, +oo] - 1):unsigned64. libavformat/img2.c:245:1: <LHS trace> 243. } 244. 245. static int img_read_packet(AVFormatContext *s1, AVPacket *pkt) ^ 246. { 247. VideoData *s = s1->priv_data; libavformat/img2.c:245:1: Array declaration 243. } 244. 245. static int img_read_packet(AVFormatContext *s1, AVPacket *pkt) ^ 246. { 247. VideoData *s = s1->priv_data; libavformat/img2.c:269:13: Binary operation: ([0, +oo] - 1):unsigned64 267. if(codec->codec_id != CODEC_ID_RAWVIDEO) 268. break; 269. filename[ strlen(filename) - 1 ]= 'U' + i; ^ 270. } 271.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/img2.c/#L269
d2a_code_trace_data_43320
int BN_num_bits_word(BN_ULONG l) { static const char bits[256]={ 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4, 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, }; #if defined(SIXTY_FOUR_BIT_LONG) if (l & 0xffffffff00000000L) { if (l & 0xffff000000000000L) { if (l & 0xff00000000000000L) { return(bits[(int)(l>>56)]+56); } else return(bits[(int)(l>>48)]+48); } else { if (l & 0x0000ff0000000000L) { return(bits[(int)(l>>40)]+40); } else return(bits[(int)(l>>32)]+32); } } else #else #ifdef SIXTY_FOUR_BIT if (l & 0xffffffff00000000LL) { if (l & 0xffff000000000000LL) { if (l & 0xff00000000000000LL) { return(bits[(int)(l>>56)]+56); } else return(bits[(int)(l>>48)]+48); } else { if (l & 0x0000ff0000000000LL) { return(bits[(int)(l>>40)]+40); } else return(bits[(int)(l>>32)]+32); } } else #endif #endif { #if defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG) if (l & 0xffff0000L) { if (l & 0xff000000L) return(bits[(int)(l>>24L)]+24); else return(bits[(int)(l>>16L)]+16); } else #endif { #if defined(SIXTEEN_BIT) || defined(THIRTY_TWO_BIT) || defined(SIXTY_FOUR_BIT) || defined(SIXTY_FOUR_BIT_LONG) if (l & 0xff00L) return(bits[(int)(l>>8)]+8); else #endif return(bits[(int)(l )] ); } } } crypto/bn/bn_print.c:135: error: BUFFER_OVERRUN_L2 Offset: [0, 1000000000] Size: 256 by call to `BN_div_word`. Showing all 11 steps of the trace crypto/bn/bn_print.c:135:8: Call 133. while (!BN_is_zero(t)) 134. { 135. *lp=BN_div_word(t,BN_DEC_CONV); ^ 136. lp++; 137. } crypto/bn/bn_word.c:86:1: Parameter `w` 84. } 85. 86. > BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w) 87. { 88. BN_ULONG ret = 0; crypto/bn/bn_word.c:91:2: Assignment 89. int i; 90. 91. w &= BN_MASK2; ^ 92. 93. if (!w) crypto/bn/bn_word.c:104:5: Call 102. 103. l=a->d[i]; 104. d=bn_div_words(ret,l,w); ^ 105. ret=(l-((d*w)&BN_MASK2))&BN_MASK2; 106. a->d[i]=d; crypto/bn/bn_asm.c:232:1: Parameter `d` 230. /* Divide h,l by d and return the result. */ 231. /* I need to test this some more :-( */ 232. > BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d) 233. { 234. BN_ULONG dh,dl,q,ret=0,th,tl,t; crypto/bn/bn_asm.c:239:4: Call 237. if (d == 0) return(BN_MASK2); 238. 239. i=BN_num_bits_word(d); ^ 240. assert((i == BN_BITS2) || (h > (BN_ULONG)1<<i)); 241. crypto/bn/bn_lib.c:158:1: <Offset trace> 156. } 157. 158. > int BN_num_bits_word(BN_ULONG l) 159. { 160. static const char bits[256]={ crypto/bn/bn_lib.c:158:1: Parameter `l` 156. } 157. 158. > int BN_num_bits_word(BN_ULONG l) 159. { 160. static const char bits[256]={ crypto/bn/bn_lib.c:160:2: <Length trace> 158. int BN_num_bits_word(BN_ULONG l) 159. { 160. static const char bits[256]={ ^ 161. 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4, 162. 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, crypto/bn/bn_lib.c:160:2: Array declaration 158. int BN_num_bits_word(BN_ULONG l) 159. { 160. static const char bits[256]={ ^ 161. 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4, 162. 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, crypto/bn/bn_lib.c:229:12: Array access: Offset: [0, 1000000000] Size: 256 by call to `BN_div_word` 227. { 228. if (l & 0xff000000L) 229. return(bits[(int)(l>>24L)]+24); ^ 230. else return(bits[(int)(l>>16L)]+16); 231. }
https://github.com/openssl/openssl/blob/6defae04f3c44087d9129994fa88b4f9271b153f/crypto/bn/bn_lib.c/#L229
d2a_code_trace_data_43321
static int opt_metadata(const char *opt, const char *arg) { char *mid= strchr(arg, '='); if(!mid){ fprintf(stderr, "Missing =\n"); av_exit(1); } *mid++= 0; metadata_count++; metadata= av_realloc(metadata, sizeof(*metadata)*metadata_count); metadata[metadata_count-1].key = av_strdup(arg); metadata[metadata_count-1].value= av_strdup(mid); return 0; } ffmpeg.c:2543: error: Null Dereference pointer `mid` last assigned on line 2543 could be null and is dereferenced at line 2543, column 5. ffmpeg.c:2535:1: start of procedure opt_metadata() 2533. } 2534. 2535. static int opt_metadata(const char *opt, const char *arg) ^ 2536. { 2537. char *mid= strchr(arg, '='); ffmpeg.c:2537:5: 2535. static int opt_metadata(const char *opt, const char *arg) 2536. { 2537. char *mid= strchr(arg, '='); ^ 2538. 2539. if(!mid){ ffmpeg.c:2539:9: Taking true branch 2537. char *mid= strchr(arg, '='); 2538. 2539. if(!mid){ ^ 2540. fprintf(stderr, "Missing =\n"); 2541. av_exit(1); ffmpeg.c:2540:9: 2538. 2539. if(!mid){ 2540. fprintf(stderr, "Missing =\n"); ^ 2541. av_exit(1); 2542. } ffmpeg.c:2541:9: Skipping av_exit(): empty list of specs 2539. if(!mid){ 2540. fprintf(stderr, "Missing =\n"); 2541. av_exit(1); ^ 2542. } 2543. *mid++= 0; ffmpeg.c:2543:5: 2541. av_exit(1); 2542. } 2543. *mid++= 0; ^ 2544. 2545. metadata_count++;
https://github.com/libav/libav/blob/9aaa2077e5879b153d2ce6bea2e42f0c349a083f/ffmpeg.c/#L2543
d2a_code_trace_data_43322
static ossl_inline unsigned int constant_time_is_zero(unsigned int a) { return constant_time_msb(~a & (a - 1)); } test/constant_time_test.c:62: error: INTEGER_OVERFLOW_L1 (0 - 1):unsigned32 by call to `constant_time_is_zero`. Showing all 5 steps of the trace test/constant_time_test.c:60:1: Parameter `a` 58. } 59. 60. > static int test_is_zero(unsigned int a) 61. { 62. if (a == 0 && !TEST_uint_eq(constant_time_is_zero(a), CONSTTIME_TRUE)) test/constant_time_test.c:62:20: Call 60. static int test_is_zero(unsigned int a) 61. { 62. if (a == 0 && !TEST_uint_eq(constant_time_is_zero(a), CONSTTIME_TRUE)) ^ 63. return 0; 64. if (a != 0 && !TEST_uint_eq(constant_time_is_zero(a), CONSTTIME_FALSE)) include/internal/constant_time_locl.h:150:1: <LHS trace> 148. } 149. 150. > static ossl_inline unsigned int constant_time_is_zero(unsigned int a) 151. { 152. return constant_time_msb(~a & (a - 1)); include/internal/constant_time_locl.h:150:1: Parameter `a` 148. } 149. 150. > static ossl_inline unsigned int constant_time_is_zero(unsigned int a) 151. { 152. return constant_time_msb(~a & (a - 1)); include/internal/constant_time_locl.h:152:12: Binary operation: (0 - 1):unsigned32 by call to `constant_time_is_zero` 150. static ossl_inline unsigned int constant_time_is_zero(unsigned int a) 151. { 152. return constant_time_msb(~a & (a - 1)); ^ 153. } 154.
https://github.com/openssl/openssl/blob/f3ab6c16c424054c8d6d2c152744dcbaf41c3232/include/internal/constant_time_locl.h/#L152
d2a_code_trace_data_43323
static void allocChoppedUpStripArrays(TIFF* tif, uint32 nstrips, uint64 stripbytes, uint32 rowsperstrip) { TIFFDirectory *td = &tif->tif_dir; uint64 bytecount; uint64 offset; uint32 i; uint64 *newcounts; uint64 *newoffsets; newcounts = (uint64*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint64), "for chopped \"StripByteCounts\" array"); newoffsets = (uint64*) _TIFFCheckMalloc(tif, nstrips, sizeof (uint64), "for chopped \"StripOffsets\" array"); if (newcounts == NULL || newoffsets == NULL) { if (newcounts != NULL) _TIFFfree(newcounts); if (newoffsets != NULL) _TIFFfree(newoffsets); return; } offset = td->td_stripoffset[0]; bytecount = td->td_stripoffset[td->td_nstrips-1] + td->td_stripbytecount[td->td_nstrips-1] - offset; for (i = 0; i < nstrips; i++) { if (stripbytes > bytecount) stripbytes = bytecount; newcounts[i] = stripbytes; newoffsets[i] = stripbytes ? offset : 0; offset += stripbytes; bytecount -= stripbytes; } td->td_stripsperimage = td->td_nstrips = nstrips; TIFFSetField(tif, TIFFTAG_ROWSPERSTRIP, rowsperstrip); _TIFFfree(td->td_stripbytecount); _TIFFfree(td->td_stripoffset); td->td_stripbytecount = newcounts; td->td_stripoffset = newoffsets; td->td_stripbytecountsorted = 1; } libtiff/tif_dirread.c:4261: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `TryChopUpUncompressedBigTiff`. libtiff/tif_dirread.c:4217:8: Assignment 4215. 4216. tif->tif_dir.td_stripbytecountsorted = 1; 4217. for (strip = 1; strip < tif->tif_dir.td_nstrips; strip++) { ^ 4218. if (tif->tif_dir.td_stripoffset[strip - 1] > 4219. tif->tif_dir.td_stripoffset[strip]) { libtiff/tif_dirread.c:4261:13: Call 4259. if ( !_TIFFFillStriles(tif) || !tif->tif_dir.td_stripbytecount ) 4260. return 0; 4261. TryChopUpUncompressedBigTiff(tif); ^ 4262. } 4263. libtiff/tif_dirread.c:5851:1: Parameter `tif->tif_dir.td_nstrips` 5849. * amount memory. 5850. */ 5851. static void TryChopUpUncompressedBigTiff( TIFF* tif ) ^ 5852. { 5853. TIFFDirectory *td = &tif->tif_dir; libtiff/tif_dirread.c:5936:5: Call 5934. } 5935. 5936. allocChoppedUpStripArrays(tif, nstrips, stripbytes, rowsperstrip); ^ 5937. } 5938. libtiff/tif_dirread.c:5717:1: <LHS trace> 5715. } 5716. 5717. static void allocChoppedUpStripArrays(TIFF* tif, uint32 nstrips, ^ 5718. uint64 stripbytes, uint32 rowsperstrip) 5719. { libtiff/tif_dirread.c:5717:1: Parameter `tif->tif_dir.td_nstrips` 5715. } 5716. 5717. static void allocChoppedUpStripArrays(TIFF* tif, uint32 nstrips, ^ 5718. uint64 stripbytes, uint32 rowsperstrip) 5719. { libtiff/tif_dirread.c:5748:17: Binary operation: ([0, +oo] - 1):unsigned32 by call to `TryChopUpUncompressedBigTiff` 5746. */ 5747. offset = td->td_stripoffset[0]; 5748. bytecount = td->td_stripoffset[td->td_nstrips-1] + ^ 5749. td->td_stripbytecount[td->td_nstrips-1] - offset; 5750. for (i = 0; i < nstrips; i++)
https://gitlab.com/libtiff/libtiff/blob/b9b93f661ed56fda222ce686a6e6ef03ee84bc3d/libtiff/tif_dirread.c/#L5748
d2a_code_trace_data_43324
static ossl_inline void packet_forward(PACKET *pkt, size_t len) { pkt->curr += len; pkt->remaining -= len; } ssl/d1_lib.c:635: error: INTEGER_OVERFLOW_L2 ([2, +oo] - 32):unsigned64 by call to `PACKET_forward`. Showing all 26 steps of the trace ssl/d1_lib.c:586:17: Call 584. || !PACKET_get_net_3_len(&msgpkt, &fragoff) 585. || !PACKET_get_net_3_len(&msgpkt, &fraglen) 586. || !PACKET_get_sub_packet(&msgpkt, &msgpayload, fraglen) ^ 587. || PACKET_remaining(&msgpkt) != 0) { 588. SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_LENGTH_MISMATCH); ssl/packet_locl.h:124:8: Parameter `subpkt->remaining` 122. * original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|. 123. */ 124. __owur static ossl_inline int PACKET_get_sub_packet(PACKET *pkt, ^ 125. PACKET *subpkt, size_t len) 126. { ssl/packet_locl.h:127:10: Call 125. PACKET *subpkt, size_t len) 126. { 127. if (!PACKET_peek_sub_packet(pkt, subpkt, len)) ^ 128. return 0; 129. ssl/packet_locl.h:110:8: Parameter `subpkt->remaining` 108. * the original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|. 109. */ 110. __owur static ossl_inline int PACKET_peek_sub_packet(const PACKET *pkt, ^ 111. PACKET *subpkt, size_t len) 112. { ssl/d1_lib.c:621:14: Call 619. s->msg_callback_arg); 620. 621. if (!PACKET_get_net_2(&msgpayload, &clientvers)) { ^ 622. SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_LENGTH_MISMATCH); 623. goto end; ssl/packet_locl.h:153:8: Parameter `pkt->remaining` 151. /* Equivalent of n2s */ 152. /* Get 2 bytes in network order from |pkt| and store the value in |*data| */ 153. __owur static ossl_inline int PACKET_get_net_2(PACKET *pkt, unsigned int *data) ^ 154. { 155. if (!PACKET_peek_net_2(pkt, data)) ssl/packet_locl.h:155:10: Call 153. __owur static ossl_inline int PACKET_get_net_2(PACKET *pkt, unsigned int *data) 154. { 155. if (!PACKET_peek_net_2(pkt, data)) ^ 156. return 0; 157. ssl/packet_locl.h:139:8: Parameter `pkt->remaining` 137. * |*data| 138. */ 139. __owur static ossl_inline int PACKET_peek_net_2(const PACKET *pkt, ^ 140. unsigned int *data) 141. { ssl/d1_lib.c:635:14: Call 633. } 634. 635. if (!PACKET_forward(&msgpayload, SSL3_RANDOM_SIZE) ^ 636. || !PACKET_get_length_prefixed_1(&msgpayload, &session) 637. || !PACKET_get_length_prefixed_1(&msgpayload, &cookiepkt)) { ssl/packet_locl.h:467:8: Parameter `len` 465. 466. /* Move the current reading position forward |len| bytes */ 467. __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len) ^ 468. { 469. if (PACKET_remaining(pkt) < len) ssl/d1_lib.c:586:17: Call 584. || !PACKET_get_net_3_len(&msgpkt, &fragoff) 585. || !PACKET_get_net_3_len(&msgpkt, &fraglen) 586. || !PACKET_get_sub_packet(&msgpkt, &msgpayload, fraglen) ^ 587. || PACKET_remaining(&msgpkt) != 0) { 588. SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_LENGTH_MISMATCH); ssl/packet_locl.h:124:8: Parameter `subpkt->remaining` 122. * original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|. 123. */ 124. __owur static ossl_inline int PACKET_get_sub_packet(PACKET *pkt, ^ 125. PACKET *subpkt, size_t len) 126. { ssl/packet_locl.h:127:10: Call 125. PACKET *subpkt, size_t len) 126. { 127. if (!PACKET_peek_sub_packet(pkt, subpkt, len)) ^ 128. return 0; 129. ssl/packet_locl.h:110:8: Parameter `subpkt->remaining` 108. * the original |pkt|, so data wrapped by |pkt| must outlive the |subpkt|. 109. */ 110. __owur static ossl_inline int PACKET_peek_sub_packet(const PACKET *pkt, ^ 111. PACKET *subpkt, size_t len) 112. { ssl/d1_lib.c:621:14: Call 619. s->msg_callback_arg); 620. 621. if (!PACKET_get_net_2(&msgpayload, &clientvers)) { ^ 622. SSLerr(SSL_F_DTLSV1_LISTEN, SSL_R_LENGTH_MISMATCH); 623. goto end; ssl/packet_locl.h:153:8: Parameter `pkt->remaining` 151. /* Equivalent of n2s */ 152. /* Get 2 bytes in network order from |pkt| and store the value in |*data| */ 153. __owur static ossl_inline int PACKET_get_net_2(PACKET *pkt, unsigned int *data) ^ 154. { 155. if (!PACKET_peek_net_2(pkt, data)) ssl/packet_locl.h:155:10: Call 153. __owur static ossl_inline int PACKET_get_net_2(PACKET *pkt, unsigned int *data) 154. { 155. if (!PACKET_peek_net_2(pkt, data)) ^ 156. return 0; 157. ssl/packet_locl.h:139:8: Parameter `pkt->remaining` 137. * |*data| 138. */ 139. __owur static ossl_inline int PACKET_peek_net_2(const PACKET *pkt, ^ 140. unsigned int *data) 141. { ssl/d1_lib.c:635:14: Call 633. } 634. 635. if (!PACKET_forward(&msgpayload, SSL3_RANDOM_SIZE) ^ 636. || !PACKET_get_length_prefixed_1(&msgpayload, &session) 637. || !PACKET_get_length_prefixed_1(&msgpayload, &cookiepkt)) { ssl/packet_locl.h:467:8: Parameter `len` 465. 466. /* Move the current reading position forward |len| bytes */ 467. __owur static ossl_inline int PACKET_forward(PACKET *pkt, size_t len) ^ 468. { 469. if (PACKET_remaining(pkt) < len) ssl/packet_locl.h:472:5: Call 470. return 0; 471. 472. packet_forward(pkt, len); ^ 473. 474. return 1; ssl/packet_locl.h:33:1: <LHS trace> 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: Parameter `pkt->remaining` 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: <RHS trace> 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: Parameter `len` 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:36:5: Binary operation: ([2, +oo] - 32):unsigned64 by call to `PACKET_forward` 34. { 35. pkt->curr += len; 36. pkt->remaining -= len; ^ 37. } 38.
https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/ssl/packet_locl.h/#L36
d2a_code_trace_data_43325
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; } crypto/bn/bn_prime.c:220: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_priv_rand_range`. Showing all 25 steps of the trace crypto/bn/bn_prime.c:198:10: Call 196. 197. /* compute A1 := a - 1 */ 198. if (!BN_copy(A1, a) || !BN_sub_word(A1, 1)) ^ 199. goto err; 200. /* compute A3 := a - 3 */ crypto/bn/bn_lib.c:285:1: Parameter `a->top` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_prime.c:220:14: Call 218. for (i = 0; i < checks; i++) { 219. /* 1 < check < a-1 */ 220. if (!BN_priv_rand_range(check, A3) || !BN_add_word(check, 2)) ^ 221. goto err; 222. crypto/bn/bn_rand.c:182:1: Parameter `r->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 `r->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/bn/bn_rand.c:128:9: Call 126. 127. if (n == 1) 128. BN_zero(r); ^ 129. else if (!BN_is_bit_set(range, n - 2) && !BN_is_bit_set(range, n - 3)) { 130. /* crypto/bn/bn_lib.c:360:1: Parameter `a->top` 358. } 359. 360. > int BN_set_word(BIGNUM *a, BN_ULONG w) 361. { 362. bn_check_top(a); crypto/bn/bn_lib.c:363:9: Call 361. { 362. bn_check_top(a); 363. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 364. return 0; 365. a->neg = 0; crypto/bn/bn_lcl.h:651:1: Parameter `a->top` 649. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 650. 651. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 652. { 653. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_lcl.h:659:12: Call 657. return a; 658. 659. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2); ^ 660. } 661. crypto/bn/bn_lib.c:246:1: Parameter `b->top` 244. */ 245. 246. > BIGNUM *bn_expand2(BIGNUM *b, int words) 247. { 248. bn_check_top(b); crypto/bn/bn_lib.c:251:23: Call 249. 250. if (words > b->dmax) { 251. BN_ULONG *a = bn_expand_internal(b, words); ^ 252. if (!a) 253. return NULL; crypto/bn/bn_lib.c:208:1: <Offset trace> 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:208:1: Parameter `b->top` 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:208:1: <Length trace> 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:208:1: Parameter `words` 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:225:13: Call 223. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 224. else 225. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 226. if (a == NULL) { 227. 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:225:9: Assignment 223. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 224. else 225. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 226. if (a == NULL) { 227. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:233:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_priv_rand_range` 231. assert(b->top <= words); 232. if (b->top > 0) 233. memcpy(a, b->d, sizeof(*a) * b->top); ^ 234. 235. return a;
https://github.com/openssl/openssl/blob/b48d4397b8ee4256f0b0a115eb99f27ae89995e0/crypto/bn/bn_lib.c/#L233
d2a_code_trace_data_43326
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dsa/dsa_ossl.c:281: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_exp_mont`. Showing all 29 steps of the trace crypto/dsa/dsa_ossl.c:216:1: Parameter `ctx_in->stack.depth` 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:281:2: Call 279. K = &k; 280. } 281. DSA_BN_MOD_EXP(goto err, dsa, r, dsa->g, K, dsa->p, ctx, ^ 282. dsa->method_mont_p); 283. if (!BN_mod(r,r,dsa->q,ctx)) goto err; crypto/bn/bn_exp.c:384:1: Parameter `ctx->stack.depth` 382. 383. 384. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 385. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 386. { crypto/bn/bn_exp.c:397:10: Call 395. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) 396. { 397. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 398. } 399. crypto/bn/bn_exp.c:578:1: Parameter `ctx->stack.depth` 576. * http://www.daemonology.net/hyperthreading-considered-harmful/) 577. */ 578. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 579. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 580. { crypto/bn/bn_exp.c:609:2: Call 607. } 608. 609. BN_CTX_start(ctx); ^ 610. 611. /* Allocate a montgomery context if it was not supplied by the caller. crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_exp.c:619:8: Call 617. { 618. if ((mont=BN_MONT_CTX_new()) == NULL) goto err; 619. if (!BN_MONT_CTX_set(mont,m,ctx)) goto err; ^ 620. } 621. 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_mod_exp_mont` 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_43327
int test_div_recp(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b, *c, *d, *e; BN_RECP_CTX *recp; int i; recp = BN_RECP_CTX_new(); a = BN_new(); b = BN_new(); c = BN_new(); d = BN_new(); e = BN_new(); for (i = 0; i < num0 + num1; i++) { if (i < num1) { BN_bntest_rand(a, 400, 0, 0); BN_copy(b, a); BN_lshift(a, a, i); BN_add_word(a, i); } else BN_bntest_rand(b, 50 + 3 * (i - num1), 0, 0); a->neg = rand_neg(); b->neg = rand_neg(); BN_RECP_CTX_set(recp, b, ctx); BN_div_recp(d, c, a, recp, ctx); if (bp != NULL) { if (!results) { BN_print(bp, a); BIO_puts(bp, " / "); BN_print(bp, b); BIO_puts(bp, " - "); } BN_print(bp, d); BIO_puts(bp, "\n"); if (!results) { BN_print(bp, a); BIO_puts(bp, " % "); BN_print(bp, b); BIO_puts(bp, " - "); } BN_print(bp, c); BIO_puts(bp, "\n"); } BN_mul(e, d, b, ctx); BN_add(d, e, c); BN_sub(d, d, a); if (!BN_is_zero(d)) { fprintf(stderr, "Reciprocal division test failed!\n"); fprintf(stderr, "a="); BN_print_fp(stderr, a); fprintf(stderr, "\nb="); BN_print_fp(stderr, b); fprintf(stderr, "\n"); return 0; } } BN_free(a); BN_free(b); BN_free(c); BN_free(d); BN_free(e); BN_RECP_CTX_free(recp); return (1); } test/bntest.c:628: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 578, column 9 is not reachable after line 628, column 5. Showing all 149 steps of the trace test/bntest.c:571:1: start of procedure test_div_recp() 569. } 570. 571. > int test_div_recp(BIO *bp, BN_CTX *ctx) 572. { 573. BIGNUM *a, *b, *c, *d, *e; test/bntest.c:577:5: 575. int i; 576. 577. > recp = BN_RECP_CTX_new(); 578. a = BN_new(); 579. b = BN_new(); crypto/bn/bn_recp.c:70:1: start of procedure BN_RECP_CTX_new() 68. } 69. 70. > BN_RECP_CTX *BN_RECP_CTX_new(void) 71. { 72. BN_RECP_CTX *ret; crypto/bn/bn_recp.c:74:9: 72. BN_RECP_CTX *ret; 73. 74. > if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) 75. return (NULL); 76. 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_recp.c:74:9: Taking false branch 72. BN_RECP_CTX *ret; 73. 74. if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) ^ 75. return (NULL); 76. crypto/bn/bn_recp.c:77:5: 75. return (NULL); 76. 77. > BN_RECP_CTX_init(ret); 78. ret->flags = BN_FLG_MALLOCED; 79. return (ret); crypto/bn/bn_recp.c:62:1: start of procedure BN_RECP_CTX_init() 60. #include "bn_lcl.h" 61. 62. > void BN_RECP_CTX_init(BN_RECP_CTX *recp) 63. { 64. bn_init(&(recp->N)); crypto/bn/bn_recp.c:64:5: Skipping bn_init(): empty list of specs 62. void BN_RECP_CTX_init(BN_RECP_CTX *recp) 63. { 64. bn_init(&(recp->N)); ^ 65. bn_init(&(recp->Nr)); 66. recp->num_bits = 0; crypto/bn/bn_recp.c:65:5: Skipping bn_init(): empty list of specs 63. { 64. bn_init(&(recp->N)); 65. bn_init(&(recp->Nr)); ^ 66. recp->num_bits = 0; 67. recp->flags = 0; crypto/bn/bn_recp.c:66:5: 64. bn_init(&(recp->N)); 65. bn_init(&(recp->Nr)); 66. > recp->num_bits = 0; 67. recp->flags = 0; 68. } crypto/bn/bn_recp.c:67:5: 65. bn_init(&(recp->Nr)); 66. recp->num_bits = 0; 67. > recp->flags = 0; 68. } 69. crypto/bn/bn_recp.c:68:1: return from a call to BN_RECP_CTX_init 66. recp->num_bits = 0; 67. recp->flags = 0; 68. > } 69. 70. BN_RECP_CTX *BN_RECP_CTX_new(void) crypto/bn/bn_recp.c:78:5: 76. 77. BN_RECP_CTX_init(ret); 78. > ret->flags = BN_FLG_MALLOCED; 79. return (ret); 80. } crypto/bn/bn_recp.c:79:5: 77. BN_RECP_CTX_init(ret); 78. ret->flags = BN_FLG_MALLOCED; 79. > return (ret); 80. } 81. crypto/bn/bn_recp.c:80:1: return from a call to BN_RECP_CTX_new 78. ret->flags = BN_FLG_MALLOCED; 79. return (ret); 80. > } 81. 82. void BN_RECP_CTX_free(BN_RECP_CTX *recp) test/bntest.c:578:5: 576. 577. recp = BN_RECP_CTX_new(); 578. > a = BN_new(); 579. b = BN_new(); 580. 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:579:5: 577. recp = BN_RECP_CTX_new(); 578. a = BN_new(); 579. > b = BN_new(); 580. c = BN_new(); 581. 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:580:5: 578. a = BN_new(); 579. b = BN_new(); 580. > c = BN_new(); 581. d = BN_new(); 582. 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:581:5: 579. b = BN_new(); 580. c = BN_new(); 581. > d = BN_new(); 582. e = BN_new(); 583. 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:582:5: 580. c = BN_new(); 581. d = BN_new(); 582. > e = BN_new(); 583. 584. for (i = 0; i < num0 + num1; i++) { crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:584:10: 582. e = BN_new(); 583. 584. > for (i = 0; i < num0 + num1; i++) { 585. if (i < num1) { 586. BN_bntest_rand(a, 400, 0, 0); test/bntest.c:584:17: Loop condition is false. Leaving loop 582. e = BN_new(); 583. 584. for (i = 0; i < num0 + num1; i++) { ^ 585. if (i < num1) { 586. BN_bntest_rand(a, 400, 0, 0); test/bntest.c:628:5: 626. } 627. } 628. > BN_free(a); 629. BN_free(b); 630. BN_free(c); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a)
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L628
d2a_code_trace_data_43328
static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, int motion_y, int mb_block_height, int mb_block_count) { int16_t weight[8][64]; DCTELEM orig[8][64]; const int mb_x= s->mb_x; const int mb_y= s->mb_y; int i; int skip_dct[8]; int dct_offset = s->linesize*8; uint8_t *ptr_y, *ptr_cb, *ptr_cr; int wrap_y, wrap_c; for(i=0; i<mb_block_count; i++) skip_dct[i]=s->skipdct; if(s->adaptive_quant){ const int last_qp= s->qscale; const int mb_xy= mb_x + mb_y*s->mb_stride; s->lambda= s->lambda_table[mb_xy]; update_qscale(s); if(!(s->flags&CODEC_FLAG_QP_RD)){ s->qscale= s->current_picture_ptr->qscale_table[mb_xy]; s->dquant= s->qscale - last_qp; if(s->out_format==FMT_H263){ s->dquant= av_clip(s->dquant, -2, 2); if(s->codec_id==CODEC_ID_MPEG4){ if(!s->mb_intra){ if(s->pict_type == FF_B_TYPE){ if(s->dquant&1 || s->mv_dir&MV_DIRECT) s->dquant= 0; } if(s->mv_type==MV_TYPE_8X8) s->dquant=0; } } } } ff_set_qscale(s, last_qp + s->dquant); }else if(s->flags&CODEC_FLAG_QP_RD) ff_set_qscale(s, s->qscale + s->dquant); wrap_y = s->linesize; wrap_c = s->uvlinesize; ptr_y = s->new_picture.data[0] + (mb_y * 16 * wrap_y) + mb_x * 16; ptr_cb = s->new_picture.data[1] + (mb_y * mb_block_height * wrap_c) + mb_x * 8; ptr_cr = s->new_picture.data[2] + (mb_y * mb_block_height * wrap_c) + mb_x * 8; if(mb_x*16+16 > s->width || mb_y*16+16 > s->height){ uint8_t *ebuf= s->edge_emu_buffer + 32; ff_emulated_edge_mc(ebuf , ptr_y , wrap_y,16,16,mb_x*16,mb_y*16, s->width , s->height); ptr_y= ebuf; ff_emulated_edge_mc(ebuf+18*wrap_y , ptr_cb, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1); ptr_cb= ebuf+18*wrap_y; ff_emulated_edge_mc(ebuf+18*wrap_y+8, ptr_cr, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1); ptr_cr= ebuf+18*wrap_y+8; } if (s->mb_intra) { if(s->flags&CODEC_FLAG_INTERLACED_DCT){ int progressive_score, interlaced_score; s->interlaced_dct=0; progressive_score= s->dsp.ildct_cmp[4](s, ptr_y , NULL, wrap_y, 8) +s->dsp.ildct_cmp[4](s, ptr_y + wrap_y*8, NULL, wrap_y, 8) - 400; if(progressive_score > 0){ interlaced_score = s->dsp.ildct_cmp[4](s, ptr_y , NULL, wrap_y*2, 8) +s->dsp.ildct_cmp[4](s, ptr_y + wrap_y , NULL, wrap_y*2, 8); if(progressive_score > interlaced_score){ s->interlaced_dct=1; dct_offset= wrap_y; wrap_y<<=1; if (s->chroma_format == CHROMA_422) wrap_c<<=1; } } } s->dsp.get_pixels(s->block[0], ptr_y , wrap_y); s->dsp.get_pixels(s->block[1], ptr_y + 8, wrap_y); s->dsp.get_pixels(s->block[2], ptr_y + dct_offset , wrap_y); s->dsp.get_pixels(s->block[3], ptr_y + dct_offset + 8, wrap_y); if(s->flags&CODEC_FLAG_GRAY){ skip_dct[4]= 1; skip_dct[5]= 1; }else{ s->dsp.get_pixels(s->block[4], ptr_cb, wrap_c); s->dsp.get_pixels(s->block[5], ptr_cr, wrap_c); if(!s->chroma_y_shift){ s->dsp.get_pixels(s->block[6], ptr_cb + (dct_offset>>1), wrap_c); s->dsp.get_pixels(s->block[7], ptr_cr + (dct_offset>>1), wrap_c); } } }else{ op_pixels_func (*op_pix)[4]; qpel_mc_func (*op_qpix)[16]; uint8_t *dest_y, *dest_cb, *dest_cr; dest_y = s->dest[0]; dest_cb = s->dest[1]; dest_cr = s->dest[2]; if ((!s->no_rounding) || s->pict_type==FF_B_TYPE){ op_pix = s->dsp.put_pixels_tab; op_qpix= s->dsp.put_qpel_pixels_tab; }else{ op_pix = s->dsp.put_no_rnd_pixels_tab; op_qpix= s->dsp.put_no_rnd_qpel_pixels_tab; } if (s->mv_dir & MV_DIR_FORWARD) { MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.data, op_pix, op_qpix); op_pix = s->dsp.avg_pixels_tab; op_qpix= s->dsp.avg_qpel_pixels_tab; } if (s->mv_dir & MV_DIR_BACKWARD) { MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.data, op_pix, op_qpix); } if(s->flags&CODEC_FLAG_INTERLACED_DCT){ int progressive_score, interlaced_score; s->interlaced_dct=0; progressive_score= s->dsp.ildct_cmp[0](s, dest_y , ptr_y , wrap_y, 8) +s->dsp.ildct_cmp[0](s, dest_y + wrap_y*8, ptr_y + wrap_y*8, wrap_y, 8) - 400; if(s->avctx->ildct_cmp == FF_CMP_VSSE) progressive_score -= 400; if(progressive_score>0){ interlaced_score = s->dsp.ildct_cmp[0](s, dest_y , ptr_y , wrap_y*2, 8) +s->dsp.ildct_cmp[0](s, dest_y + wrap_y , ptr_y + wrap_y , wrap_y*2, 8); if(progressive_score > interlaced_score){ s->interlaced_dct=1; dct_offset= wrap_y; wrap_y<<=1; if (s->chroma_format == CHROMA_422) wrap_c<<=1; } } } s->dsp.diff_pixels(s->block[0], ptr_y , dest_y , wrap_y); s->dsp.diff_pixels(s->block[1], ptr_y + 8, dest_y + 8, wrap_y); s->dsp.diff_pixels(s->block[2], ptr_y + dct_offset , dest_y + dct_offset , wrap_y); s->dsp.diff_pixels(s->block[3], ptr_y + dct_offset + 8, dest_y + dct_offset + 8, wrap_y); if(s->flags&CODEC_FLAG_GRAY){ skip_dct[4]= 1; skip_dct[5]= 1; }else{ s->dsp.diff_pixels(s->block[4], ptr_cb, dest_cb, wrap_c); s->dsp.diff_pixels(s->block[5], ptr_cr, dest_cr, wrap_c); if(!s->chroma_y_shift){ s->dsp.diff_pixels(s->block[6], ptr_cb + (dct_offset>>1), dest_cb + (dct_offset>>1), wrap_c); s->dsp.diff_pixels(s->block[7], ptr_cr + (dct_offset>>1), dest_cr + (dct_offset>>1), wrap_c); } } if(s->current_picture.mc_mb_var[s->mb_stride*mb_y+ mb_x]<2*s->qscale*s->qscale){ if(s->dsp.sad[1](NULL, ptr_y , dest_y , wrap_y, 8) < 20*s->qscale) skip_dct[0]= 1; if(s->dsp.sad[1](NULL, ptr_y + 8, dest_y + 8, wrap_y, 8) < 20*s->qscale) skip_dct[1]= 1; if(s->dsp.sad[1](NULL, ptr_y +dct_offset , dest_y +dct_offset , wrap_y, 8) < 20*s->qscale) skip_dct[2]= 1; if(s->dsp.sad[1](NULL, ptr_y +dct_offset+ 8, dest_y +dct_offset+ 8, wrap_y, 8) < 20*s->qscale) skip_dct[3]= 1; if(s->dsp.sad[1](NULL, ptr_cb , dest_cb , wrap_c, 8) < 20*s->qscale) skip_dct[4]= 1; if(s->dsp.sad[1](NULL, ptr_cr , dest_cr , wrap_c, 8) < 20*s->qscale) skip_dct[5]= 1; if(!s->chroma_y_shift){ if(s->dsp.sad[1](NULL, ptr_cb +(dct_offset>>1), dest_cb +(dct_offset>>1), wrap_c, 8) < 20*s->qscale) skip_dct[6]= 1; if(s->dsp.sad[1](NULL, ptr_cr +(dct_offset>>1), dest_cr +(dct_offset>>1), wrap_c, 8) < 20*s->qscale) skip_dct[7]= 1; } } } if(s->avctx->quantizer_noise_shaping){ if(!skip_dct[0]) get_visual_weight(weight[0], ptr_y , wrap_y); if(!skip_dct[1]) get_visual_weight(weight[1], ptr_y + 8, wrap_y); if(!skip_dct[2]) get_visual_weight(weight[2], ptr_y + dct_offset , wrap_y); if(!skip_dct[3]) get_visual_weight(weight[3], ptr_y + dct_offset + 8, wrap_y); if(!skip_dct[4]) get_visual_weight(weight[4], ptr_cb , wrap_c); if(!skip_dct[5]) get_visual_weight(weight[5], ptr_cr , wrap_c); if(!s->chroma_y_shift){ if(!skip_dct[6]) get_visual_weight(weight[6], ptr_cb + (dct_offset>>1), wrap_c); if(!skip_dct[7]) get_visual_weight(weight[7], ptr_cr + (dct_offset>>1), wrap_c); } memcpy(orig[0], s->block[0], sizeof(DCTELEM)*64*mb_block_count); } assert(s->out_format!=FMT_MJPEG || s->qscale==8); { for(i=0;i<mb_block_count;i++) { if(!skip_dct[i]){ int overflow; s->block_last_index[i] = s->dct_quantize(s, s->block[i], i, s->qscale, &overflow); if (overflow) clip_coeffs(s, s->block[i], s->block_last_index[i]); }else s->block_last_index[i]= -1; } if(s->avctx->quantizer_noise_shaping){ for(i=0;i<mb_block_count;i++) { if(!skip_dct[i]){ s->block_last_index[i] = dct_quantize_refine(s, s->block[i], weight[i], orig[i], i, s->qscale); } } } if(s->luma_elim_threshold && !s->mb_intra) for(i=0; i<4; i++) dct_single_coeff_elimination(s, i, s->luma_elim_threshold); if(s->chroma_elim_threshold && !s->mb_intra) for(i=4; i<mb_block_count; i++) dct_single_coeff_elimination(s, i, s->chroma_elim_threshold); if(s->flags & CODEC_FLAG_CBP_RD){ for(i=0;i<mb_block_count;i++) { if(s->block_last_index[i] == -1) s->coded_score[i]= INT_MAX/256; } } } if((s->flags&CODEC_FLAG_GRAY) && s->mb_intra){ s->block_last_index[4]= s->block_last_index[5]= 0; s->block[4][0]= s->block[5][0]= (1024 + s->c_dc_scale/2)/ s->c_dc_scale; } if(s->alternate_scan && s->dct_quantize != dct_quantize_c){ for(i=0; i<mb_block_count; i++){ int j; if(s->block_last_index[i]>0){ for(j=63; j>0; j--){ if(s->block[i][ s->intra_scantable.permutated[j] ]) break; } s->block_last_index[i]= j; } } } switch(s->codec_id){ case CODEC_ID_MPEG1VIDEO: case CODEC_ID_MPEG2VIDEO: if (ENABLE_MPEG1VIDEO_ENCODER || ENABLE_MPEG2VIDEO_ENCODER) mpeg1_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_MPEG4: if (ENABLE_MPEG4_ENCODER) mpeg4_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_MSMPEG4V2: case CODEC_ID_MSMPEG4V3: case CODEC_ID_WMV1: if (ENABLE_MSMPEG4_ENCODER) msmpeg4_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_WMV2: if (ENABLE_WMV2_ENCODER) ff_wmv2_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_H261: if (ENABLE_H261_ENCODER) ff_h261_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_H263: case CODEC_ID_H263P: case CODEC_ID_FLV1: case CODEC_ID_RV10: case CODEC_ID_RV20: if (ENABLE_H263_ENCODER || ENABLE_H263P_ENCODER || ENABLE_FLV_ENCODER || ENABLE_RV10_ENCODER || ENABLE_RV20_ENCODER) h263_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_MJPEG: if (ENABLE_MJPEG_ENCODER) ff_mjpeg_encode_mb(s, s->block); break; default: assert(0); } } libavcodec/mpegvideo_enc.c:1754: error: Buffer Overrun L1 Offset added: 1024 Size: 128 by call to `encode_mb_internal`. libavcodec/mpegvideo_enc.c:1754:41: Call 1752. { 1753. if (s->chroma_format == CHROMA_420) encode_mb_internal(s, motion_x, motion_y, 8, 6); 1754. else encode_mb_internal(s, motion_x, motion_y, 16, 8); ^ 1755. } 1756. libavcodec/mpegvideo_enc.c:1457:1: <Offset trace> 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:1457:1: Parameter `mb_block_count` 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:1457:1: <Length trace> 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: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:1648:9: Array access: Offset added: 1024 Size: 128 by call to `encode_mb_internal` 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); ^ 1649. } 1650.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo_enc.c/#L1648
d2a_code_trace_data_43329
static int cms_SignerInfo_content_sign(CMS_ContentInfo *cms, CMS_SignerInfo *si, BIO *chain) { EVP_MD_CTX *mctx = EVP_MD_CTX_new(); int r = 0; EVP_PKEY_CTX *pctx = NULL; if (mctx == NULL) { CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN, ERR_R_MALLOC_FAILURE); return 0; } if (!si->pkey) { CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN, CMS_R_NO_PRIVATE_KEY); goto err; } if (!cms_DigestAlgorithm_find_ctx(mctx, chain, si->digestAlgorithm)) goto err; if (si->pctx && !cms_sd_asn1_ctrl(si, 0)) goto err; if (CMS_signed_get_attr_count(si) >= 0) { ASN1_OBJECT *ctype = cms->d.signedData->encapContentInfo->eContentType; unsigned char md[EVP_MAX_MD_SIZE]; unsigned int mdlen; if (!EVP_DigestFinal_ex(mctx, md, &mdlen)) goto err; if (!CMS_signed_add1_attr_by_NID(si, NID_pkcs9_messageDigest, V_ASN1_OCTET_STRING, md, mdlen)) goto err; if (CMS_signed_add1_attr_by_NID(si, NID_pkcs9_contentType, V_ASN1_OBJECT, ctype, -1) <= 0) goto err; if (!CMS_SignerInfo_sign(si)) goto err; } else if (si->pctx) { unsigned char *sig; size_t siglen; unsigned char md[EVP_MAX_MD_SIZE]; unsigned int mdlen; pctx = si->pctx; if (!EVP_DigestFinal_ex(mctx, md, &mdlen)) goto err; siglen = EVP_PKEY_size(si->pkey); sig = OPENSSL_malloc(siglen); if (sig == NULL) { CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN, ERR_R_MALLOC_FAILURE); goto err; } if (EVP_PKEY_sign(pctx, sig, &siglen, md, mdlen) <= 0) { OPENSSL_free(sig); goto err; } ASN1_STRING_set0(si->signature, sig, siglen); } else { unsigned char *sig; unsigned int siglen; sig = OPENSSL_malloc(EVP_PKEY_size(si->pkey)); if (sig == NULL) { CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN, ERR_R_MALLOC_FAILURE); goto err; } if (!EVP_SignFinal(mctx, sig, &siglen, si->pkey)) { CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN, CMS_R_SIGNFINAL_ERROR); OPENSSL_free(sig); goto err; } ASN1_STRING_set0(si->signature, sig, siglen); } r = 1; err: EVP_MD_CTX_free(mctx); EVP_PKEY_CTX_free(pctx); return r; } crypto/cms/cms_sd.c:614: error: MEMORY_LEAK memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 536, column 24 is not reachable after line 614, column 5. Showing all 85 steps of the trace crypto/cms/cms_sd.c:533:1: start of procedure cms_SignerInfo_content_sign() 531. } 532. 533. > static int cms_SignerInfo_content_sign(CMS_ContentInfo *cms, 534. CMS_SignerInfo *si, BIO *chain) 535. { crypto/cms/cms_sd.c:536:5: 534. CMS_SignerInfo *si, BIO *chain) 535. { 536. > EVP_MD_CTX *mctx = EVP_MD_CTX_new(); 537. int r = 0; 538. EVP_PKEY_CTX *pctx = NULL; 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:197:1: start of procedure CRYPTO_zalloc() 195. } 196. 197. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 198. { 199. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:199:5: 197. void *CRYPTO_zalloc(size_t num, const char *file, int line) 198. { 199. > void *ret = CRYPTO_malloc(num, file, line); 200. 201. FAILTEST(); crypto/mem.c:169:1: start of procedure CRYPTO_malloc() 167. #endif 168. 169. > void *CRYPTO_malloc(size_t num, const char *file, int line) 170. { 171. void *ret = NULL; crypto/mem.c:171:5: 169. void *CRYPTO_malloc(size_t num, const char *file, int line) 170. { 171. > void *ret = NULL; 172. 173. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:173:9: Taking false branch 171. void *ret = NULL; 172. 173. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 174. return malloc_impl(num, file, line); 175. crypto/mem.c:176:9: Taking false branch 174. return malloc_impl(num, file, line); 175. 176. if (num == 0) ^ 177. return NULL; 178. crypto/mem.c:180:5: 178. 179. FAILTEST(); 180. > allow_customize = 0; 181. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 182. if (call_malloc_debug) { crypto/mem.c:190:5: 188. } 189. #else 190. > osslargused(file); osslargused(line); 191. ret = malloc(num); 192. #endif crypto/mem.c:190:24: 188. } 189. #else 190. > osslargused(file); osslargused(line); 191. ret = malloc(num); 192. #endif crypto/mem.c:191:5: 189. #else 190. osslargused(file); osslargused(line); 191. > ret = malloc(num); 192. #endif 193. crypto/mem.c:194:5: 192. #endif 193. 194. > return ret; 195. } 196. crypto/mem.c:195:1: return from a call to CRYPTO_malloc 193. 194. return ret; 195. > } 196. 197. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:202:9: Taking true branch 200. 201. FAILTEST(); 202. if (ret != NULL) ^ 203. memset(ret, 0, num); 204. return ret; crypto/mem.c:203:9: 201. FAILTEST(); 202. if (ret != NULL) 203. > memset(ret, 0, num); 204. return ret; 205. } crypto/mem.c:204:5: 202. if (ret != NULL) 203. memset(ret, 0, num); 204. > return ret; 205. } 206. crypto/mem.c:205:1: return from a call to CRYPTO_zalloc 203. memset(ret, 0, num); 204. return ret; 205. > } 206. 207. 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) crypto/cms/cms_sd.c:537:5: 535. { 536. EVP_MD_CTX *mctx = EVP_MD_CTX_new(); 537. > int r = 0; 538. EVP_PKEY_CTX *pctx = NULL; 539. crypto/cms/cms_sd.c:538:5: 536. EVP_MD_CTX *mctx = EVP_MD_CTX_new(); 537. int r = 0; 538. > EVP_PKEY_CTX *pctx = NULL; 539. 540. if (mctx == NULL) { crypto/cms/cms_sd.c:540:9: Taking false branch 538. EVP_PKEY_CTX *pctx = NULL; 539. 540. if (mctx == NULL) { ^ 541. CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN, ERR_R_MALLOC_FAILURE); 542. return 0; crypto/cms/cms_sd.c:545:10: Taking false branch 543. } 544. 545. if (!si->pkey) { ^ 546. CMSerr(CMS_F_CMS_SIGNERINFO_CONTENT_SIGN, CMS_R_NO_PRIVATE_KEY); 547. goto err; crypto/cms/cms_sd.c:550:10: 548. } 549. 550. > if (!cms_DigestAlgorithm_find_ctx(mctx, chain, si->digestAlgorithm)) 551. goto err; 552. /* Set SignerInfo algorithm details if we used custom parameter */ crypto/cms/cms_lib.c:311:1: start of procedure cms_DigestAlgorithm_find_ctx() 309. /* Locate a message digest content from a BIO chain based on SignerInfo */ 310. 311. > int cms_DigestAlgorithm_find_ctx(EVP_MD_CTX *mctx, BIO *chain, 312. X509_ALGOR *mdalg) 313. { crypto/cms/cms_lib.c:316:5: 314. int nid; 315. const ASN1_OBJECT *mdoid; 316. > X509_ALGOR_get0(&mdoid, NULL, NULL, mdalg); 317. nid = OBJ_obj2nid(mdoid); 318. /* Look for digest type to match signature */ crypto/asn1/x_algor.c:53:1: start of procedure X509_ALGOR_get0() 51. } 52. 53. > void X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype, 54. const void **ppval, const X509_ALGOR *algor) 55. { crypto/asn1/x_algor.c:56:9: Taking true branch 54. const void **ppval, const X509_ALGOR *algor) 55. { 56. if (paobj) ^ 57. *paobj = algor->algorithm; 58. if (pptype) { crypto/asn1/x_algor.c:57:9: 55. { 56. if (paobj) 57. > *paobj = algor->algorithm; 58. if (pptype) { 59. if (algor->parameter == NULL) { crypto/asn1/x_algor.c:58:9: Taking false branch 56. if (paobj) 57. *paobj = algor->algorithm; 58. if (pptype) { ^ 59. if (algor->parameter == NULL) { 60. *pptype = V_ASN1_UNDEF; crypto/asn1/x_algor.c:58:5: 56. if (paobj) 57. *paobj = algor->algorithm; 58. > if (pptype) { 59. if (algor->parameter == NULL) { 60. *pptype = V_ASN1_UNDEF; crypto/asn1/x_algor.c:67:1: return from a call to X509_ALGOR_get0 65. *ppval = algor->parameter->value.ptr; 66. } 67. > } 68. 69. /* Set up an X509_ALGOR DigestAlgorithmIdentifier from an EVP_MD */ crypto/cms/cms_lib.c:317:5: 315. const ASN1_OBJECT *mdoid; 316. X509_ALGOR_get0(&mdoid, NULL, NULL, mdalg); 317. > nid = OBJ_obj2nid(mdoid); 318. /* Look for digest type to match signature */ 319. for (;;) { crypto/objects/obj_dat.c:317:1: start of procedure OBJ_obj2nid() 315. IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj); 316. 317. > int OBJ_obj2nid(const ASN1_OBJECT *a) 318. { 319. const unsigned int *op; crypto/objects/obj_dat.c:322:9: Taking false branch 320. ADDED_OBJ ad, *adp; 321. 322. if (a == NULL) ^ 323. return NID_undef; 324. if (a->nid != 0) crypto/objects/obj_dat.c:324:9: Taking false branch 322. if (a == NULL) 323. return NID_undef; 324. if (a->nid != 0) ^ 325. return a->nid; 326. crypto/objects/obj_dat.c:327:9: Taking false branch 325. return a->nid; 326. 327. if (a->length == 0) ^ 328. return NID_undef; 329. crypto/objects/obj_dat.c:330:9: Taking true branch 328. return NID_undef; 329. 330. if (added != NULL) { ^ 331. ad.type = ADDED_DATA; 332. ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */ crypto/objects/obj_dat.c:331:9: 329. 330. if (added != NULL) { 331. > ad.type = ADDED_DATA; 332. ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */ 333. adp = lh_ADDED_OBJ_retrieve(added, &ad); crypto/objects/obj_dat.c:332:9: 330. if (added != NULL) { 331. ad.type = ADDED_DATA; 332. > ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */ 333. adp = lh_ADDED_OBJ_retrieve(added, &ad); 334. if (adp != NULL) crypto/objects/obj_dat.c:333:9: 331. ad.type = ADDED_DATA; 332. ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */ 333. > adp = lh_ADDED_OBJ_retrieve(added, &ad); 334. if (adp != NULL) 335. return adp->obj->nid; crypto/objects/obj_lcl.h:14:1: start of procedure lh_ADDED_OBJ_retrieve() 12. DEFINE_LHASH_OF(OBJ_NAME); 13. typedef struct added_obj_st ADDED_OBJ; 14. > DEFINE_LHASH_OF(ADDED_OBJ); crypto/lhash/lhash.c:134:1: start of procedure OPENSSL_LH_retrieve() 132. } 133. 134. > void *OPENSSL_LH_retrieve(OPENSSL_LHASH *lh, const void *data) 135. { 136. unsigned long hash; crypto/lhash/lhash.c:141:5: 139. int scratch; 140. 141. > lh->error = 0; 142. rn = getrn(lh, data, &hash); 143. crypto/lhash/lhash.c:142:5: Skipping getrn(): empty list of specs 140. 141. lh->error = 0; 142. rn = getrn(lh, data, &hash); ^ 143. 144. if (*rn == NULL) { crypto/lhash/lhash.c:144:9: Taking false branch 142. rn = getrn(lh, data, &hash); 143. 144. if (*rn == NULL) { ^ 145. CRYPTO_atomic_add(&lh->num_retrieve_miss, 1, &scratch, lh->retrieve_stats_lock); 146. return NULL; crypto/lhash/lhash.c:148:9: 146. return NULL; 147. } else { 148. > ret = (*rn)->data; 149. CRYPTO_atomic_add(&lh->num_retrieve, 1, &scratch, lh->retrieve_stats_lock); 150. } crypto/lhash/lhash.c:149:9: 147. } else { 148. ret = (*rn)->data; 149. > CRYPTO_atomic_add(&lh->num_retrieve, 1, &scratch, lh->retrieve_stats_lock); 150. } 151. return ret; crypto/threads_pthread.c:152:1: start of procedure CRYPTO_atomic_add() 150. } 151. 152. > int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock) 153. { 154. # if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL) crypto/threads_pthread.c:155:9: Taking false branch 153. { 154. # if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL) 155. if (__atomic_is_lock_free(sizeof(*val), val)) { ^ 156. *ret = __atomic_add_fetch(val, amount, __ATOMIC_ACQ_REL); 157. return 1; crypto/threads_pthread.c:160:10: 158. } 159. # endif 160. > if (!CRYPTO_THREAD_write_lock(lock)) 161. return 0; 162. crypto/threads_pthread.c:64:1: start of procedure CRYPTO_THREAD_write_lock() 62. } 63. 64. > int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock) 65. { 66. # ifdef USE_RWLOCK crypto/threads_pthread.c:67:9: Taking true branch 65. { 66. # ifdef USE_RWLOCK 67. if (pthread_rwlock_wrlock(lock) != 0) ^ 68. return 0; 69. # else crypto/threads_pthread.c:68:9: 66. # ifdef USE_RWLOCK 67. if (pthread_rwlock_wrlock(lock) != 0) 68. > return 0; 69. # else 70. if (pthread_mutex_lock(lock) != 0) crypto/threads_pthread.c:75:1: return from a call to CRYPTO_THREAD_write_lock 73. 74. return 1; 75. > } 76. 77. int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock) crypto/threads_pthread.c:160:10: Taking true branch 158. } 159. # endif 160. if (!CRYPTO_THREAD_write_lock(lock)) ^ 161. return 0; 162. crypto/threads_pthread.c:161:9: 159. # endif 160. if (!CRYPTO_THREAD_write_lock(lock)) 161. > return 0; 162. 163. *val += amount; crypto/threads_pthread.c:170:1: return from a call to CRYPTO_atomic_add 168. 169. return 1; 170. > } 171. 172. # ifdef OPENSSL_SYS_UNIX crypto/lhash/lhash.c:151:5: 149. CRYPTO_atomic_add(&lh->num_retrieve, 1, &scratch, lh->retrieve_stats_lock); 150. } 151. > return ret; 152. } 153. crypto/lhash/lhash.c:152:1: return from a call to OPENSSL_LH_retrieve 150. } 151. return ret; 152. > } 153. 154. static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, crypto/objects/obj_lcl.h:14:1: return from a call to lh_ADDED_OBJ_retrieve 12. DEFINE_LHASH_OF(OBJ_NAME); 13. typedef struct added_obj_st ADDED_OBJ; 14. > DEFINE_LHASH_OF(ADDED_OBJ); crypto/objects/obj_dat.c:334:13: Taking true branch 332. ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */ 333. adp = lh_ADDED_OBJ_retrieve(added, &ad); 334. if (adp != NULL) ^ 335. return adp->obj->nid; 336. } crypto/objects/obj_dat.c:335:13: 333. adp = lh_ADDED_OBJ_retrieve(added, &ad); 334. if (adp != NULL) 335. > return adp->obj->nid; 336. } 337. op = OBJ_bsearch_obj(&a, obj_objs, NUM_OBJ); crypto/objects/obj_dat.c:341:1: return from a call to OBJ_obj2nid 339. return NID_undef; 340. return nid_objs[*op].nid; 341. > } 342. 343. /* crypto/cms/cms_lib.c:336:5: Loop condition is true. Entering loop body 334. return EVP_MD_CTX_copy_ex(mctx, mtmp); 335. chain = BIO_next(chain); 336. } ^ 337. } 338. crypto/cms/cms_lib.c:321:9: Skipping BIO_find_type(): empty list of specs 319. for (;;) { 320. EVP_MD_CTX *mtmp; 321. chain = BIO_find_type(chain, BIO_TYPE_MD); ^ 322. if (chain == NULL) { 323. CMSerr(CMS_F_CMS_DIGESTALGORITHM_FIND_CTX, crypto/cms/cms_lib.c:322:13: Taking true branch 320. EVP_MD_CTX *mtmp; 321. chain = BIO_find_type(chain, BIO_TYPE_MD); 322. if (chain == NULL) { ^ 323. CMSerr(CMS_F_CMS_DIGESTALGORITHM_FIND_CTX, 324. CMS_R_NO_MATCHING_DIGEST); crypto/cms/cms_lib.c:323:13: Skipping ERR_put_error(): empty list of specs 321. chain = BIO_find_type(chain, BIO_TYPE_MD); 322. if (chain == NULL) { 323. CMSerr(CMS_F_CMS_DIGESTALGORITHM_FIND_CTX, ^ 324. CMS_R_NO_MATCHING_DIGEST); 325. return 0; crypto/cms/cms_lib.c:325:13: 323. CMSerr(CMS_F_CMS_DIGESTALGORITHM_FIND_CTX, 324. CMS_R_NO_MATCHING_DIGEST); 325. > return 0; 326. } 327. BIO_get_md_ctx(chain, &mtmp); crypto/cms/cms_lib.c:337:1: return from a call to cms_DigestAlgorithm_find_ctx 335. chain = BIO_next(chain); 336. } 337. > } 338. 339. static STACK_OF(CMS_CertificateChoices) crypto/cms/cms_sd.c:550:10: Taking true branch 548. } 549. 550. if (!cms_DigestAlgorithm_find_ctx(mctx, chain, si->digestAlgorithm)) ^ 551. goto err; 552. /* Set SignerInfo algorithm details if we used custom parameter */ crypto/cms/cms_sd.c:613:2: 611. r = 1; 612. 613. > err: 614. EVP_MD_CTX_free(mctx); 615. EVP_PKEY_CTX_free(pctx); crypto/cms/cms_sd.c:614:5: 612. 613. err: 614. > EVP_MD_CTX_free(mctx); 615. EVP_PKEY_CTX_free(pctx); 616. return r; 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:264:1: start of procedure CRYPTO_free() 262. } 263. 264. > void CRYPTO_free(void *str, const char *file, int line) 265. { 266. if (free_impl != NULL && free_impl != &CRYPTO_free) { crypto/mem.c:266:9: Taking true branch 264. void CRYPTO_free(void *str, const char *file, int line) 265. { 266. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 267. free_impl(str, file, line); 268. return; crypto/mem.c:266:30: Taking true branch 264. void CRYPTO_free(void *str, const char *file, int line) 265. { 266. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 267. free_impl(str, file, line); 268. return; crypto/mem.c:267:9: Skipping __function_pointer__(): unresolved function pointer 265. { 266. if (free_impl != NULL && free_impl != &CRYPTO_free) { 267. free_impl(str, file, line); ^ 268. return; 269. } crypto/mem.c:268:9: 266. if (free_impl != NULL && free_impl != &CRYPTO_free) { 267. free_impl(str, file, line); 268. > return; 269. } 270. crypto/mem.c:282:1: return from a call to CRYPTO_free 280. free(str); 281. #endif 282. > } 283. 284. 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/b842fcbb37cf3cded72dd7706abd8d54a10cd508/crypto/cms/cms_sd.c/#L614
d2a_code_trace_data_43330
static int interlaced_search(MpegEncContext *s, int ref_index, int16_t (*mv_tables[2][2])[2], uint8_t *field_select_tables[2], int mx, int my, int user_field_select) { MotionEstContext * const c= &s->me; const int size=0; const int h=8; int block; int P[10][2]; uint8_t * const mv_penalty= c->current_mv_penalty; int same=1; const int stride= 2*s->linesize; int dmin_sum= 0; const int mot_stride= s->mb_stride; const int xy= s->mb_x + s->mb_y*mot_stride; c->ymin>>=1; c->ymax>>=1; c->stride<<=1; c->uvstride<<=1; init_interlaced_ref(s, ref_index); for(block=0; block<2; block++){ int field_select; int best_dmin= INT_MAX; int best_field= -1; for(field_select=0; field_select<2; field_select++){ int dmin, mx_i, my_i; int16_t (*mv_table)[2]= mv_tables[block][field_select]; if(user_field_select){ assert(field_select==0 || field_select==1); assert(field_select_tables[block][xy]==0 || field_select_tables[block][xy]==1); if(field_select_tables[block][xy] != field_select) continue; } P_LEFT[0] = mv_table[xy - 1][0]; P_LEFT[1] = mv_table[xy - 1][1]; if(P_LEFT[0] > (c->xmax<<1)) P_LEFT[0] = (c->xmax<<1); c->pred_x= P_LEFT[0]; c->pred_y= P_LEFT[1]; if(!s->first_slice_line){ P_TOP[0] = mv_table[xy - mot_stride][0]; P_TOP[1] = mv_table[xy - mot_stride][1]; P_TOPRIGHT[0] = mv_table[xy - mot_stride + 1][0]; P_TOPRIGHT[1] = mv_table[xy - mot_stride + 1][1]; if(P_TOP[1] > (c->ymax<<1)) P_TOP[1] = (c->ymax<<1); if(P_TOPRIGHT[0] < (c->xmin<<1)) P_TOPRIGHT[0]= (c->xmin<<1); if(P_TOPRIGHT[0] > (c->xmax<<1)) P_TOPRIGHT[0]= (c->xmax<<1); if(P_TOPRIGHT[1] > (c->ymax<<1)) P_TOPRIGHT[1]= (c->ymax<<1); P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]); P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]); } P_MV1[0]= mx; P_MV1[1]= my / 2; dmin = epzs_motion_search2(s, &mx_i, &my_i, P, block, field_select+ref_index, mv_table, (1<<16)>>1); dmin= c->sub_motion_search(s, &mx_i, &my_i, dmin, block, field_select+ref_index, size, h); mv_table[xy][0]= mx_i; mv_table[xy][1]= my_i; if(s->dsp.me_sub_cmp[0] != s->dsp.mb_cmp[0]){ int dxy; uint8_t *ref= c->ref[field_select+ref_index][0] + (mx_i>>1) + (my_i>>1)*stride; dxy = ((my_i & 1) << 1) | (mx_i & 1); if(s->no_rounding){ s->dsp.put_no_rnd_pixels_tab[size][dxy](c->scratchpad, ref , stride, h); }else{ s->dsp.put_pixels_tab [size][dxy](c->scratchpad, ref , stride, h); } dmin= s->dsp.mb_cmp[size](s, c->src[block][0], c->scratchpad, stride, h); dmin+= (mv_penalty[mx_i-c->pred_x] + mv_penalty[my_i-c->pred_y] + 1)*c->mb_penalty_factor; }else dmin+= c->mb_penalty_factor; dmin += field_select != block; if(dmin < best_dmin){ best_dmin= dmin; best_field= field_select; } } { int16_t (*mv_table)[2]= mv_tables[block][best_field]; if(mv_table[xy][0] != mx) same=0; if(mv_table[xy][1]&1) same=0; if(mv_table[xy][1]*2 != my) same=0; if(best_field != block) same=0; } field_select_tables[block][xy]= best_field; dmin_sum += best_dmin; } c->ymin<<=1; c->ymax<<=1; c->stride>>=1; c->uvstride>>=1; if(same) return INT_MAX; switch(c->avctx->mb_cmp&0xFF){ case FF_CMP_RD: return dmin_sum; default: return dmin_sum+ 11*c->mb_penalty_factor; } } libavcodec/motion_est.c:985: error: Buffer Overrun L3 Offset: [-1, 1] Size: 2. libavcodec/motion_est.c:917:9: <Offset trace> 915. int field_select; 916. int best_dmin= INT_MAX; 917. int best_field= -1; ^ 918. 919. for(field_select=0; field_select<2; field_select++){ libavcodec/motion_est.c:917:9: Assignment 915. int field_select; 916. int best_dmin= INT_MAX; 917. int best_field= -1; ^ 918. 919. for(field_select=0; field_select<2; field_select++){ libavcodec/motion_est.c:893:1: <Length trace> 891. } 892. 893. static int interlaced_search(MpegEncContext *s, int ref_index, ^ 894. int16_t (*mv_tables[2][2])[2], uint8_t *field_select_tables[2], int mx, int my, int user_field_select) 895. { libavcodec/motion_est.c:893:1: Parameter `(*mv_tables)[*]` 891. } 892. 893. static int interlaced_search(MpegEncContext *s, int ref_index, ^ 894. int16_t (*mv_tables[2][2])[2], uint8_t *field_select_tables[2], int mx, int my, int user_field_select) 895. { libavcodec/motion_est.c:985:37: Array access: Offset: [-1, 1] Size: 2 983. } 984. { 985. int16_t (*mv_table)[2]= mv_tables[block][best_field]; ^ 986. 987. if(mv_table[xy][0] != mx) same=0; //FIXME check if these checks work and are any good at all
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est.c/#L985
d2a_code_trace_data_43331
void avformat_close_input(AVFormatContext **ps) { AVFormatContext *s = *ps; AVIOContext *pb = s->pb; if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) || (s->flags & AVFMT_FLAG_CUSTOM_IO)) pb = NULL; flush_packet_queue(s); if (s->iformat) { if (s->iformat->read_close) s->iformat->read_close(s); } avformat_free_context(s); *ps = NULL; avio_close(pb); } libavformat/utils.c:2577: error: Null Dereference pointer `pb` last assigned on line 2564 could be null and is dereferenced by call to `avio_close()` at line 2577, column 5. libavformat/utils.c:2557:1: start of procedure avformat_close_input() 2555. } 2556. 2557. void avformat_close_input(AVFormatContext **ps) ^ 2558. { 2559. AVFormatContext *s = *ps; libavformat/utils.c:2559:5: 2557. void avformat_close_input(AVFormatContext **ps) 2558. { 2559. AVFormatContext *s = *ps; ^ 2560. AVIOContext *pb = s->pb; 2561. libavformat/utils.c:2560:5: 2558. { 2559. AVFormatContext *s = *ps; 2560. AVIOContext *pb = s->pb; ^ 2561. 2562. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) || libavformat/utils.c:2562:10: Taking true branch 2560. AVIOContext *pb = s->pb; 2561. 2562. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) || ^ 2563. (s->flags & AVFMT_FLAG_CUSTOM_IO)) 2564. pb = NULL; libavformat/utils.c:2562:24: Taking false branch 2560. AVIOContext *pb = s->pb; 2561. 2562. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) || ^ 2563. (s->flags & AVFMT_FLAG_CUSTOM_IO)) 2564. pb = NULL; libavformat/utils.c:2563:10: Taking true branch 2561. 2562. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) || 2563. (s->flags & AVFMT_FLAG_CUSTOM_IO)) ^ 2564. pb = NULL; 2565. libavformat/utils.c:2564:9: 2562. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) || 2563. (s->flags & AVFMT_FLAG_CUSTOM_IO)) 2564. pb = NULL; ^ 2565. 2566. flush_packet_queue(s); libavformat/utils.c:2566:5: Skipping flush_packet_queue(): empty list of specs 2564. pb = NULL; 2565. 2566. flush_packet_queue(s); ^ 2567. 2568. if (s->iformat) { libavformat/utils.c:2568:9: Taking true branch 2566. flush_packet_queue(s); 2567. 2568. if (s->iformat) { ^ 2569. if (s->iformat->read_close) 2570. s->iformat->read_close(s); libavformat/utils.c:2569:13: Taking true branch 2567. 2568. if (s->iformat) { 2569. if (s->iformat->read_close) ^ 2570. s->iformat->read_close(s); 2571. } libavformat/utils.c:2570:13: Skipping __function_pointer__(): unresolved function pointer 2568. if (s->iformat) { 2569. if (s->iformat->read_close) 2570. s->iformat->read_close(s); ^ 2571. } 2572. libavformat/utils.c:2573:5: Skipping avformat_free_context(): empty list of specs 2571. } 2572. 2573. avformat_free_context(s); ^ 2574. 2575. *ps = NULL; libavformat/utils.c:2575:5: 2573. avformat_free_context(s); 2574. 2575. *ps = NULL; ^ 2576. 2577. avio_close(pb); libavformat/utils.c:2577:5: 2575. *ps = NULL; 2576. 2577. avio_close(pb); ^ 2578. } 2579. libavformat/aviobuf.c:794:1: start of procedure avio_close() 792. } 793. 794. int avio_close(AVIOContext *s) ^ 795. { 796. URLContext *h; libavformat/aviobuf.c:798:10: Taking false branch 796. URLContext *h; 797. 798. if (!s) ^ 799. return 0; 800. libavformat/aviobuf.c:801:5: 799. return 0; 800. 801. avio_flush(s); ^ 802. h = s->opaque; 803. av_freep(&s->buffer); libavformat/aviobuf.c:180:1: start of procedure avio_flush() 178. } 179. 180. void avio_flush(AVIOContext *s) ^ 181. { 182. flush_buffer(s); libavformat/aviobuf.c:182:5: 180. void avio_flush(AVIOContext *s) 181. { 182. flush_buffer(s); ^ 183. s->must_flush = 0; 184. } libavformat/aviobuf.c:124:1: start of procedure flush_buffer() 122. } 123. 124. static void flush_buffer(AVIOContext *s) ^ 125. { 126. if (s->buf_ptr > s->buffer) { libavformat/aviobuf.c:126:9: 124. static void flush_buffer(AVIOContext *s) 125. { 126. if (s->buf_ptr > s->buffer) { ^ 127. if (s->write_packet && !s->error) { 128. int ret = s->write_packet(s->opaque, s->buffer,
https://github.com/libav/libav/blob/f8d1bb6723a677d7221c674a4e47e3d4cecfca17/libavformat/utils.c/#L2577
d2a_code_trace_data_43332
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dsa/dsa_key.c:59: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_exp`. Showing all 19 steps of the trace crypto/dsa/dsa_key.c:59:14: Call 57. BN_with_flags(prk, priv_key, BN_FLG_CONSTTIME); 58. 59. if (!BN_mod_exp(pub_key, dsa->g, prk, dsa->p, ctx)) { ^ 60. BN_free(prk); 61. goto err; crypto/bn/bn_exp.c:90:1: Parameter `ctx->stack.depth` 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:155:15: Call 153. #ifdef RECP_MUL_MOD 154. { 155. ret = BN_mod_exp_recp(r, a, p, m, ctx); ^ 156. } 157. #else crypto/bn/bn_exp.c:167:1: Parameter `ctx->stack.depth` 165. } 166. 167. > int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 168. const BIGNUM *m, BN_CTX *ctx) 169. { crypto/bn/bn_exp.c:195:5: Call 193. } 194. 195. BN_CTX_start(ctx); ^ 196. aa = BN_CTX_get(ctx); 197. val[0] = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_exp.c:214:10: Call 212. } 213. 214. if (!BN_nnmod(val[0], a, m, ctx)) ^ 215. goto err; /* 1 */ 216. if (BN_is_zero(val[0])) { crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:193:5: Call 191. } 192. 193. BN_CTX_start(ctx); ^ 194. tmp = BN_CTX_get(ctx); 195. snum = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:416:5: Call 414. if (no_branch) 415. bn_correct_top(res); 416. BN_CTX_end(ctx); ^ 417. return (1); 418. err: crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.indexes` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:271:1: <Offset trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `st->depth` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: <Length trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `*st->indexes` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:273:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_exp` 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/ec772a817afc0f788c38006f623204a7d76221ec/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_43333
static int fill_default_ref_list(H264Context *h){ MpegEncContext * const s = &h->s; int i; int smallest_poc_greater_than_current = -1; int structure_sel; Picture sorted_short_ref[32]; Picture field_entry_list[2][32]; Picture *frame_list[2]; if (FIELD_PICTURE) { structure_sel = PICT_FRAME; frame_list[0] = field_entry_list[0]; frame_list[1] = field_entry_list[1]; } else { structure_sel = 0; frame_list[0] = h->default_ref_list[0]; frame_list[1] = h->default_ref_list[1]; } if(h->slice_type==FF_B_TYPE){ int list; int len[2]; int short_len[2]; int out_i; int limit= INT_MIN; for(out_i=0; out_i<h->short_ref_count; out_i++){ int best_i=INT_MIN; int best_poc=INT_MAX; for(i=0; i<h->short_ref_count; i++){ const int poc= h->short_ref[i]->poc; if(poc > limit && poc < best_poc){ best_poc= poc; best_i= i; } } assert(best_i != INT_MIN); limit= best_poc; sorted_short_ref[out_i]= *h->short_ref[best_i]; tprintf(h->s.avctx, "sorted poc: %d->%d poc:%d fn:%d\n", best_i, out_i, sorted_short_ref[out_i].poc, sorted_short_ref[out_i].frame_num); if (-1 == smallest_poc_greater_than_current) { if (h->short_ref[best_i]->poc >= s->current_picture_ptr->poc) { smallest_poc_greater_than_current = out_i; } } } tprintf(h->s.avctx, "current poc: %d, smallest_poc_greater_than_current: %d\n", s->current_picture_ptr->poc, smallest_poc_greater_than_current); for(list=0; list<2; list++){ int index = 0; int j= -99; int step= list ? -1 : 1; for(i=0; i<h->short_ref_count && index < h->ref_count[list]; i++, j+=step) { int sel; while(j<0 || j>= h->short_ref_count){ if(j != -99 && step == (list ? -1 : 1)) return -1; step = -step; j= smallest_poc_greater_than_current + (step>>1); } sel = sorted_short_ref[j].reference | structure_sel; if(sel != PICT_FRAME) continue; frame_list[list][index ]= sorted_short_ref[j]; frame_list[list][index++].pic_id= sorted_short_ref[j].frame_num; } short_len[list] = index; for(i = 0; i < 16 && index < h->ref_count[ list ]; i++){ int sel; if(h->long_ref[i] == NULL) continue; sel = h->long_ref[i]->reference | structure_sel; if(sel != PICT_FRAME) continue; frame_list[ list ][index ]= *h->long_ref[i]; frame_list[ list ][index++].pic_id= i; } len[list] = index; } for(list=0; list<2; list++){ if (FIELD_PICTURE) len[list] = split_field_ref_list(h->default_ref_list[list], h->ref_count[list], frame_list[list], len[list], s->picture_structure, short_len[list]); if(list && len[0] > 1 && len[0] == len[1]) for(i=0; h->default_ref_list[0][i].data[0] == h->default_ref_list[1][i].data[0]; i++) if(i == len[0]){ FFSWAP(Picture, h->default_ref_list[1][0], h->default_ref_list[1][1]); break; } if(len[list] < h->ref_count[ list ]) memset(&h->default_ref_list[list][len[list]], 0, sizeof(Picture)*(h->ref_count[ list ] - len[list])); } }else{ int index=0; int short_len; for(i=0; i<h->short_ref_count; i++){ int sel; sel = h->short_ref[i]->reference | structure_sel; if(sel != PICT_FRAME) continue; frame_list[0][index ]= *h->short_ref[i]; frame_list[0][index++].pic_id= h->short_ref[i]->frame_num; } short_len = index; for(i = 0; i < 16; i++){ int sel; if(h->long_ref[i] == NULL) continue; sel = h->long_ref[i]->reference | structure_sel; if(sel != PICT_FRAME) continue; frame_list[0][index ]= *h->long_ref[i]; frame_list[0][index++].pic_id= i; } if (FIELD_PICTURE) index = split_field_ref_list(h->default_ref_list[0], h->ref_count[0], frame_list[0], index, s->picture_structure, short_len); if(index < h->ref_count[0]) memset(&h->default_ref_list[0][index], 0, sizeof(Picture)*(h->ref_count[0] - index)); } #ifdef TRACE for (i=0; i<h->ref_count[0]; i++) { tprintf(h->s.avctx, "List0: %s fn:%d 0x%p\n", (h->default_ref_list[0][i].long_ref ? "LT" : "ST"), h->default_ref_list[0][i].pic_id, h->default_ref_list[0][i].data[0]); } if(h->slice_type==FF_B_TYPE){ for (i=0; i<h->ref_count[1]; i++) { tprintf(h->s.avctx, "List1: %s fn:%d 0x%p\n", (h->default_ref_list[1][i].long_ref ? "LT" : "ST"), h->default_ref_list[1][i].pic_id, h->default_ref_list[1][i].data[0]); } } #endif return 0; } libavcodec/h264.c:2938: error: Uninitialized Value The value read from len[_] was never initialized. libavcodec/h264.c:2938:38: 2936. 2937. // swap the two first elements of L1 when L0 and L1 are identical 2938. if(list && len[0] > 1 && len[0] == len[1]) ^ 2939. for(i=0; h->default_ref_list[0][i].data[0] == h->default_ref_list[1][i].data[0]; i++) 2940. if(i == len[0]){
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L2938
d2a_code_trace_data_43334
void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits) { int i, j; unsigned char *k; RC2_INT *ki; unsigned int c, d; k = (unsigned char *)&(key->data[0]); *k = 0; if (len > 128) len = 128; if (bits <= 0) bits = 1024; if (bits > 1024) bits = 1024; for (i = 0; i < len; i++) k[i] = data[i]; d = k[len - 1]; j = 0; for (i = len; i < 128; i++, j++) { d = key_table[(k[j] + d) & 0xff]; k[i] = d; } j = (bits + 7) >> 3; i = 128 - j; c = (0xff >> (-bits & 0x07)); d = key_table[k[i] & c]; k[i] = d; while (i--) { d = key_table[k[i + j] ^ d]; k[i] = d; } ki = &(key->data[63]); for (i = 127; i >= 0; i -= 2) *(ki--) = ((k[i] << 8) | k[i - 1]) & 0xffff; } crypto/rc2/rc2_skey.c:142: error: BUFFER_OVERRUN_L3 Offset: [-1, 126] Size: 256. Showing all 6 steps of the trace crypto/rc2/rc2_skey.c:141:10: <Offset trace> 139. /* copy from bytes into RC2_INT's */ 140. ki = &(key->data[63]); 141. for (i = 127; i >= 0; i -= 2) ^ 142. *(ki--) = ((k[i] << 8) | k[i - 1]) & 0xffff; 143. } crypto/rc2/rc2_skey.c:141:10: Assignment 139. /* copy from bytes into RC2_INT's */ 140. ki = &(key->data[63]); 141. for (i = 127; i >= 0; i -= 2) ^ 142. *(ki--) = ((k[i] << 8) | k[i - 1]) & 0xffff; 143. } crypto/rc2/rc2_skey.c:98:1: <Length trace> 96. * uses a version where the bits parameter is the same as len*8 97. */ 98. > void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits) 99. { 100. int i, j; crypto/rc2/rc2_skey.c:98:1: Parameter `key->data[*]` 96. * uses a version where the bits parameter is the same as len*8 97. */ 98. > void RC2_set_key(RC2_KEY *key, int len, const unsigned char *data, int bits) 99. { 100. int i, j; crypto/rc2/rc2_skey.c:105:5: Assignment 103. unsigned int c, d; 104. 105. k = (unsigned char *)&(key->data[0]); ^ 106. *k = 0; /* for if there is a zero length key */ 107. crypto/rc2/rc2_skey.c:142:34: Array access: Offset: [-1, 126] Size: 256 140. ki = &(key->data[63]); 141. for (i = 127; i >= 0; i -= 2) 142. *(ki--) = ((k[i] << 8) | k[i - 1]) & 0xffff; ^ 143. } 144.
https://github.com/openssl/openssl/blob/9c46f4b9cd4912b61cb546c48b678488d7f26ed6/crypto/rc2/rc2_skey.c/#L142
d2a_code_trace_data_43335
static void fill_caches(H264Context *h, int mb_type, int for_deblock){ MpegEncContext * const s = &h->s; const int mb_xy= s->mb_x + s->mb_y*s->mb_stride; int topleft_xy, top_xy, topright_xy, left_xy[2]; int topleft_type, top_type, topright_type, left_type[2]; int left_block[8]; int topleft_partition= -1; int i; top_xy = mb_xy - (s->mb_stride << FIELD_PICTURE); if(for_deblock && (h->slice_num == 1 || h->slice_table[mb_xy] == h->slice_table[top_xy]) && !FRAME_MBAFF) return; topleft_xy = top_xy - 1; topright_xy= top_xy + 1; left_xy[1] = left_xy[0] = mb_xy-1; left_block[0]= 0; left_block[1]= 1; left_block[2]= 2; left_block[3]= 3; left_block[4]= 7; left_block[5]= 10; left_block[6]= 8; left_block[7]= 11; if(FRAME_MBAFF){ const int pair_xy = s->mb_x + (s->mb_y & ~1)*s->mb_stride; const int top_pair_xy = pair_xy - s->mb_stride; const int topleft_pair_xy = top_pair_xy - 1; const int topright_pair_xy = top_pair_xy + 1; const int topleft_mb_frame_flag = !IS_INTERLACED(s->current_picture.mb_type[topleft_pair_xy]); const int top_mb_frame_flag = !IS_INTERLACED(s->current_picture.mb_type[top_pair_xy]); const int topright_mb_frame_flag = !IS_INTERLACED(s->current_picture.mb_type[topright_pair_xy]); const int left_mb_frame_flag = !IS_INTERLACED(s->current_picture.mb_type[pair_xy-1]); const int curr_mb_frame_flag = !IS_INTERLACED(mb_type); const int bottom = (s->mb_y & 1); tprintf(s->avctx, "fill_caches: curr_mb_frame_flag:%d, left_mb_frame_flag:%d, topleft_mb_frame_flag:%d, top_mb_frame_flag:%d, topright_mb_frame_flag:%d\n", curr_mb_frame_flag, left_mb_frame_flag, topleft_mb_frame_flag, top_mb_frame_flag, topright_mb_frame_flag); if (bottom ? !curr_mb_frame_flag : (!curr_mb_frame_flag && !top_mb_frame_flag) ) { top_xy -= s->mb_stride; } if (bottom ? !curr_mb_frame_flag : (!curr_mb_frame_flag && !topleft_mb_frame_flag) ) { topleft_xy -= s->mb_stride; } else if(bottom && curr_mb_frame_flag && !left_mb_frame_flag) { topleft_xy += s->mb_stride; topleft_partition = 0; } if (bottom ? !curr_mb_frame_flag : (!curr_mb_frame_flag && !topright_mb_frame_flag) ) { topright_xy -= s->mb_stride; } if (left_mb_frame_flag != curr_mb_frame_flag) { left_xy[1] = left_xy[0] = pair_xy - 1; if (curr_mb_frame_flag) { if (bottom) { left_block[0]= 2; left_block[1]= 2; left_block[2]= 3; left_block[3]= 3; left_block[4]= 8; left_block[5]= 11; left_block[6]= 8; left_block[7]= 11; } else { left_block[0]= 0; left_block[1]= 0; left_block[2]= 1; left_block[3]= 1; left_block[4]= 7; left_block[5]= 10; left_block[6]= 7; left_block[7]= 10; } } else { left_xy[1] += s->mb_stride; left_block[1]= 2; left_block[2]= 0; left_block[3]= 2; left_block[5]= 10; left_block[6]= 7; left_block[7]= 10; } } } h->top_mb_xy = top_xy; h->left_mb_xy[0] = left_xy[0]; h->left_mb_xy[1] = left_xy[1]; if(for_deblock){ topleft_type = 0; topright_type = 0; top_type = h->slice_table[top_xy ] < 255 ? s->current_picture.mb_type[top_xy] : 0; left_type[0] = h->slice_table[left_xy[0] ] < 255 ? s->current_picture.mb_type[left_xy[0]] : 0; left_type[1] = h->slice_table[left_xy[1] ] < 255 ? s->current_picture.mb_type[left_xy[1]] : 0; if(FRAME_MBAFF && !IS_INTRA(mb_type)){ int list; int v = *(uint16_t*)&h->non_zero_count[mb_xy][14]; for(i=0; i<16; i++) h->non_zero_count_cache[scan8[i]] = (v>>i)&1; for(list=0; list<h->list_count; list++){ if(USES_LIST(mb_type,list)){ uint32_t *src = (uint32_t*)s->current_picture.motion_val[list][h->mb2b_xy[mb_xy]]; uint32_t *dst = (uint32_t*)h->mv_cache[list][scan8[0]]; int8_t *ref = &s->current_picture.ref_index[list][h->mb2b8_xy[mb_xy]]; for(i=0; i<4; i++, dst+=8, src+=h->b_stride){ dst[0] = src[0]; dst[1] = src[1]; dst[2] = src[2]; dst[3] = src[3]; } *(uint32_t*)&h->ref_cache[list][scan8[ 0]] = *(uint32_t*)&h->ref_cache[list][scan8[ 2]] = pack16to32(ref[0],ref[1])*0x0101; ref += h->b8_stride; *(uint32_t*)&h->ref_cache[list][scan8[ 8]] = *(uint32_t*)&h->ref_cache[list][scan8[10]] = pack16to32(ref[0],ref[1])*0x0101; }else{ fill_rectangle(&h-> mv_cache[list][scan8[ 0]], 4, 4, 8, 0, 4); fill_rectangle(&h->ref_cache[list][scan8[ 0]], 4, 4, 8, (uint8_t)LIST_NOT_USED, 1); } } } }else{ topleft_type = h->slice_table[topleft_xy ] == h->slice_num ? s->current_picture.mb_type[topleft_xy] : 0; top_type = h->slice_table[top_xy ] == h->slice_num ? s->current_picture.mb_type[top_xy] : 0; topright_type= h->slice_table[topright_xy] == h->slice_num ? s->current_picture.mb_type[topright_xy]: 0; left_type[0] = h->slice_table[left_xy[0] ] == h->slice_num ? s->current_picture.mb_type[left_xy[0]] : 0; left_type[1] = h->slice_table[left_xy[1] ] == h->slice_num ? s->current_picture.mb_type[left_xy[1]] : 0; } if(IS_INTRA(mb_type)){ h->topleft_samples_available= h->top_samples_available= h->left_samples_available= 0xFFFF; h->topright_samples_available= 0xEEEA; if(!IS_INTRA(top_type) && (top_type==0 || h->pps.constrained_intra_pred)){ h->topleft_samples_available= 0xB3FF; h->top_samples_available= 0x33FF; h->topright_samples_available= 0x26EA; } for(i=0; i<2; i++){ if(!IS_INTRA(left_type[i]) && (left_type[i]==0 || h->pps.constrained_intra_pred)){ h->topleft_samples_available&= 0xDF5F; h->left_samples_available&= 0x5F5F; } } if(!IS_INTRA(topleft_type) && (topleft_type==0 || h->pps.constrained_intra_pred)) h->topleft_samples_available&= 0x7FFF; if(!IS_INTRA(topright_type) && (topright_type==0 || h->pps.constrained_intra_pred)) h->topright_samples_available&= 0xFBFF; if(IS_INTRA4x4(mb_type)){ if(IS_INTRA4x4(top_type)){ h->intra4x4_pred_mode_cache[4+8*0]= h->intra4x4_pred_mode[top_xy][4]; h->intra4x4_pred_mode_cache[5+8*0]= h->intra4x4_pred_mode[top_xy][5]; h->intra4x4_pred_mode_cache[6+8*0]= h->intra4x4_pred_mode[top_xy][6]; h->intra4x4_pred_mode_cache[7+8*0]= h->intra4x4_pred_mode[top_xy][3]; }else{ int pred; if(!top_type || (IS_INTER(top_type) && h->pps.constrained_intra_pred)) pred= -1; else{ pred= 2; } h->intra4x4_pred_mode_cache[4+8*0]= h->intra4x4_pred_mode_cache[5+8*0]= h->intra4x4_pred_mode_cache[6+8*0]= h->intra4x4_pred_mode_cache[7+8*0]= pred; } for(i=0; i<2; i++){ if(IS_INTRA4x4(left_type[i])){ h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= h->intra4x4_pred_mode[left_xy[i]][left_block[0+2*i]]; h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= h->intra4x4_pred_mode[left_xy[i]][left_block[1+2*i]]; }else{ int pred; if(!left_type[i] || (IS_INTER(left_type[i]) && h->pps.constrained_intra_pred)) pred= -1; else{ pred= 2; } h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= pred; } } } } if(top_type){ h->non_zero_count_cache[4+8*0]= h->non_zero_count[top_xy][4]; h->non_zero_count_cache[5+8*0]= h->non_zero_count[top_xy][5]; h->non_zero_count_cache[6+8*0]= h->non_zero_count[top_xy][6]; h->non_zero_count_cache[7+8*0]= h->non_zero_count[top_xy][3]; h->non_zero_count_cache[1+8*0]= h->non_zero_count[top_xy][9]; h->non_zero_count_cache[2+8*0]= h->non_zero_count[top_xy][8]; h->non_zero_count_cache[1+8*3]= h->non_zero_count[top_xy][12]; h->non_zero_count_cache[2+8*3]= h->non_zero_count[top_xy][11]; }else{ h->non_zero_count_cache[4+8*0]= h->non_zero_count_cache[5+8*0]= h->non_zero_count_cache[6+8*0]= h->non_zero_count_cache[7+8*0]= h->non_zero_count_cache[1+8*0]= h->non_zero_count_cache[2+8*0]= h->non_zero_count_cache[1+8*3]= h->non_zero_count_cache[2+8*3]= h->pps.cabac && !IS_INTRA(mb_type) ? 0 : 64; } for (i=0; i<2; i++) { if(left_type[i]){ h->non_zero_count_cache[3+8*1 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[0+2*i]]; h->non_zero_count_cache[3+8*2 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[1+2*i]]; h->non_zero_count_cache[0+8*1 + 8*i]= h->non_zero_count[left_xy[i]][left_block[4+2*i]]; h->non_zero_count_cache[0+8*4 + 8*i]= h->non_zero_count[left_xy[i]][left_block[5+2*i]]; }else{ h->non_zero_count_cache[3+8*1 + 2*8*i]= h->non_zero_count_cache[3+8*2 + 2*8*i]= h->non_zero_count_cache[0+8*1 + 8*i]= h->non_zero_count_cache[0+8*4 + 8*i]= h->pps.cabac && !IS_INTRA(mb_type) ? 0 : 64; } } if( h->pps.cabac ) { if(top_type) { h->top_cbp = h->cbp_table[top_xy]; } else if(IS_INTRA(mb_type)) { h->top_cbp = 0x1C0; } else { h->top_cbp = 0; } if (left_type[0]) { h->left_cbp = h->cbp_table[left_xy[0]] & 0x1f0; } else if(IS_INTRA(mb_type)) { h->left_cbp = 0x1C0; } else { h->left_cbp = 0; } if (left_type[0]) { h->left_cbp |= ((h->cbp_table[left_xy[0]]>>((left_block[0]&(~1))+1))&0x1) << 1; } if (left_type[1]) { h->left_cbp |= ((h->cbp_table[left_xy[1]]>>((left_block[2]&(~1))+1))&0x1) << 3; } } #if 1 if(IS_INTER(mb_type) || IS_DIRECT(mb_type)){ int list; for(list=0; list<h->list_count; list++){ if(!USES_LIST(mb_type, list) && !IS_DIRECT(mb_type) && !h->deblocking_filter){ continue; } h->mv_cache_clean[list]= 0; if(USES_LIST(top_type, list)){ const int b_xy= h->mb2b_xy[top_xy] + 3*h->b_stride; const int b8_xy= h->mb2b8_xy[top_xy] + h->b8_stride; *(uint32_t*)h->mv_cache[list][scan8[0] + 0 - 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + 0]; *(uint32_t*)h->mv_cache[list][scan8[0] + 1 - 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + 1]; *(uint32_t*)h->mv_cache[list][scan8[0] + 2 - 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + 2]; *(uint32_t*)h->mv_cache[list][scan8[0] + 3 - 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + 3]; h->ref_cache[list][scan8[0] + 0 - 1*8]= h->ref_cache[list][scan8[0] + 1 - 1*8]= s->current_picture.ref_index[list][b8_xy + 0]; h->ref_cache[list][scan8[0] + 2 - 1*8]= h->ref_cache[list][scan8[0] + 3 - 1*8]= s->current_picture.ref_index[list][b8_xy + 1]; }else{ *(uint32_t*)h->mv_cache [list][scan8[0] + 0 - 1*8]= *(uint32_t*)h->mv_cache [list][scan8[0] + 1 - 1*8]= *(uint32_t*)h->mv_cache [list][scan8[0] + 2 - 1*8]= *(uint32_t*)h->mv_cache [list][scan8[0] + 3 - 1*8]= 0; *(uint32_t*)&h->ref_cache[list][scan8[0] + 0 - 1*8]= ((top_type ? LIST_NOT_USED : PART_NOT_AVAILABLE)&0xFF)*0x01010101; } for(i=0; i<2; i++){ int cache_idx = scan8[0] - 1 + i*2*8; if(USES_LIST(left_type[i], list)){ const int b_xy= h->mb2b_xy[left_xy[i]] + 3; const int b8_xy= h->mb2b8_xy[left_xy[i]] + 1; *(uint32_t*)h->mv_cache[list][cache_idx ]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[0+i*2]]; *(uint32_t*)h->mv_cache[list][cache_idx+8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[1+i*2]]; h->ref_cache[list][cache_idx ]= s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[0+i*2]>>1)]; h->ref_cache[list][cache_idx+8]= s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[1+i*2]>>1)]; }else{ *(uint32_t*)h->mv_cache [list][cache_idx ]= *(uint32_t*)h->mv_cache [list][cache_idx+8]= 0; h->ref_cache[list][cache_idx ]= h->ref_cache[list][cache_idx+8]= left_type[i] ? LIST_NOT_USED : PART_NOT_AVAILABLE; } } if((for_deblock || (IS_DIRECT(mb_type) && !h->direct_spatial_mv_pred)) && !FRAME_MBAFF) continue; if(USES_LIST(topleft_type, list)){ const int b_xy = h->mb2b_xy[topleft_xy] + 3 + h->b_stride + (topleft_partition & 2*h->b_stride); const int b8_xy= h->mb2b8_xy[topleft_xy] + 1 + (topleft_partition & h->b8_stride); *(uint32_t*)h->mv_cache[list][scan8[0] - 1 - 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy]; h->ref_cache[list][scan8[0] - 1 - 1*8]= s->current_picture.ref_index[list][b8_xy]; }else{ *(uint32_t*)h->mv_cache[list][scan8[0] - 1 - 1*8]= 0; h->ref_cache[list][scan8[0] - 1 - 1*8]= topleft_type ? LIST_NOT_USED : PART_NOT_AVAILABLE; } if(USES_LIST(topright_type, list)){ const int b_xy= h->mb2b_xy[topright_xy] + 3*h->b_stride; const int b8_xy= h->mb2b8_xy[topright_xy] + h->b8_stride; *(uint32_t*)h->mv_cache[list][scan8[0] + 4 - 1*8]= *(uint32_t*)s->current_picture.motion_val[list][b_xy]; h->ref_cache[list][scan8[0] + 4 - 1*8]= s->current_picture.ref_index[list][b8_xy]; }else{ *(uint32_t*)h->mv_cache [list][scan8[0] + 4 - 1*8]= 0; h->ref_cache[list][scan8[0] + 4 - 1*8]= topright_type ? LIST_NOT_USED : PART_NOT_AVAILABLE; } if((IS_SKIP(mb_type) || IS_DIRECT(mb_type)) && !FRAME_MBAFF) continue; h->ref_cache[list][scan8[5 ]+1] = h->ref_cache[list][scan8[7 ]+1] = h->ref_cache[list][scan8[13]+1] = h->ref_cache[list][scan8[4 ]] = h->ref_cache[list][scan8[12]] = PART_NOT_AVAILABLE; *(uint32_t*)h->mv_cache [list][scan8[5 ]+1]= *(uint32_t*)h->mv_cache [list][scan8[7 ]+1]= *(uint32_t*)h->mv_cache [list][scan8[13]+1]= *(uint32_t*)h->mv_cache [list][scan8[4 ]]= *(uint32_t*)h->mv_cache [list][scan8[12]]= 0; if( h->pps.cabac ) { if(USES_LIST(top_type, list)){ const int b_xy= h->mb2b_xy[top_xy] + 3*h->b_stride; *(uint32_t*)h->mvd_cache[list][scan8[0] + 0 - 1*8]= *(uint32_t*)h->mvd_table[list][b_xy + 0]; *(uint32_t*)h->mvd_cache[list][scan8[0] + 1 - 1*8]= *(uint32_t*)h->mvd_table[list][b_xy + 1]; *(uint32_t*)h->mvd_cache[list][scan8[0] + 2 - 1*8]= *(uint32_t*)h->mvd_table[list][b_xy + 2]; *(uint32_t*)h->mvd_cache[list][scan8[0] + 3 - 1*8]= *(uint32_t*)h->mvd_table[list][b_xy + 3]; }else{ *(uint32_t*)h->mvd_cache [list][scan8[0] + 0 - 1*8]= *(uint32_t*)h->mvd_cache [list][scan8[0] + 1 - 1*8]= *(uint32_t*)h->mvd_cache [list][scan8[0] + 2 - 1*8]= *(uint32_t*)h->mvd_cache [list][scan8[0] + 3 - 1*8]= 0; } if(USES_LIST(left_type[0], list)){ const int b_xy= h->mb2b_xy[left_xy[0]] + 3; *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 + 0*8]= *(uint32_t*)h->mvd_table[list][b_xy + h->b_stride*left_block[0]]; *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 + 1*8]= *(uint32_t*)h->mvd_table[list][b_xy + h->b_stride*left_block[1]]; }else{ *(uint32_t*)h->mvd_cache [list][scan8[0] - 1 + 0*8]= *(uint32_t*)h->mvd_cache [list][scan8[0] - 1 + 1*8]= 0; } if(USES_LIST(left_type[1], list)){ const int b_xy= h->mb2b_xy[left_xy[1]] + 3; *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 + 2*8]= *(uint32_t*)h->mvd_table[list][b_xy + h->b_stride*left_block[2]]; *(uint32_t*)h->mvd_cache[list][scan8[0] - 1 + 3*8]= *(uint32_t*)h->mvd_table[list][b_xy + h->b_stride*left_block[3]]; }else{ *(uint32_t*)h->mvd_cache [list][scan8[0] - 1 + 2*8]= *(uint32_t*)h->mvd_cache [list][scan8[0] - 1 + 3*8]= 0; } *(uint32_t*)h->mvd_cache [list][scan8[5 ]+1]= *(uint32_t*)h->mvd_cache [list][scan8[7 ]+1]= *(uint32_t*)h->mvd_cache [list][scan8[13]+1]= *(uint32_t*)h->mvd_cache [list][scan8[4 ]]= *(uint32_t*)h->mvd_cache [list][scan8[12]]= 0; if(h->slice_type == FF_B_TYPE){ fill_rectangle(&h->direct_cache[scan8[0]], 4, 4, 8, 0, 1); if(IS_DIRECT(top_type)){ *(uint32_t*)&h->direct_cache[scan8[0] - 1*8]= 0x01010101; }else if(IS_8X8(top_type)){ int b8_xy = h->mb2b8_xy[top_xy] + h->b8_stride; h->direct_cache[scan8[0] + 0 - 1*8]= h->direct_table[b8_xy]; h->direct_cache[scan8[0] + 2 - 1*8]= h->direct_table[b8_xy + 1]; }else{ *(uint32_t*)&h->direct_cache[scan8[0] - 1*8]= 0; } if(IS_DIRECT(left_type[0])) h->direct_cache[scan8[0] - 1 + 0*8]= 1; else if(IS_8X8(left_type[0])) h->direct_cache[scan8[0] - 1 + 0*8]= h->direct_table[h->mb2b8_xy[left_xy[0]] + 1 + h->b8_stride*(left_block[0]>>1)]; else h->direct_cache[scan8[0] - 1 + 0*8]= 0; if(IS_DIRECT(left_type[1])) h->direct_cache[scan8[0] - 1 + 2*8]= 1; else if(IS_8X8(left_type[1])) h->direct_cache[scan8[0] - 1 + 2*8]= h->direct_table[h->mb2b8_xy[left_xy[1]] + 1 + h->b8_stride*(left_block[2]>>1)]; else h->direct_cache[scan8[0] - 1 + 2*8]= 0; } } if(FRAME_MBAFF){ #define MAP_MVS\ MAP_F2F(scan8[0] - 1 - 1*8, topleft_type)\ MAP_F2F(scan8[0] + 0 - 1*8, top_type)\ MAP_F2F(scan8[0] + 1 - 1*8, top_type)\ MAP_F2F(scan8[0] + 2 - 1*8, top_type)\ MAP_F2F(scan8[0] + 3 - 1*8, top_type)\ MAP_F2F(scan8[0] + 4 - 1*8, topright_type)\ MAP_F2F(scan8[0] - 1 + 0*8, left_type[0])\ MAP_F2F(scan8[0] - 1 + 1*8, left_type[0])\ MAP_F2F(scan8[0] - 1 + 2*8, left_type[1])\ MAP_F2F(scan8[0] - 1 + 3*8, left_type[1]) if(MB_FIELD){ #define MAP_F2F(idx, mb_type)\ if(!IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0){\ h->ref_cache[list][idx] <<= 1;\ h->mv_cache[list][idx][1] /= 2;\ h->mvd_cache[list][idx][1] /= 2;\ } MAP_MVS #undef MAP_F2F }else{ #define MAP_F2F(idx, mb_type)\ if(IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0){\ h->ref_cache[list][idx] >>= 1;\ h->mv_cache[list][idx][1] <<= 1;\ h->mvd_cache[list][idx][1] <<= 1;\ } MAP_MVS #undef MAP_F2F } } } } #endif h->neighbor_transform_size= !!IS_8x8DCT(top_type) + !!IS_8x8DCT(left_type[0]); } libavcodec/h264.c:267: error: Buffer Overrun L2 Offset: [0, 11] Size: 8. libavcodec/h264.c:100:5: <Offset trace> 98. topright_xy= top_xy + 1; 99. left_xy[1] = left_xy[0] = mb_xy-1; 100. left_block[0]= 0; ^ 101. left_block[1]= 1; 102. left_block[2]= 2; libavcodec/h264.c:100:5: Assignment 98. topright_xy= top_xy + 1; 99. left_xy[1] = left_xy[0] = mb_xy-1; 100. left_block[0]= 0; ^ 101. left_block[1]= 1; 102. left_block[2]= 2; libavcodec/h264.c:79:1: <Length trace> 77. 78. 79. static void fill_caches(H264Context *h, int mb_type, int for_deblock){ ^ 80. MpegEncContext * const s = &h->s; 81. const int mb_xy= s->mb_x + s->mb_y*s->mb_stride; libavcodec/h264.c:79:1: Parameter `(*h->intra4x4_pred_mode)[*]` 77. 78. 79. static void fill_caches(H264Context *h, int mb_type, int for_deblock){ ^ 80. MpegEncContext * const s = &h->s; 81. const int mb_xy= s->mb_x + s->mb_y*s->mb_stride; libavcodec/h264.c:267:65: Array access: Offset: [0, 11] Size: 8 265. for(i=0; i<2; i++){ 266. if(IS_INTRA4x4(left_type[i])){ 267. h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= h->intra4x4_pred_mode[left_xy[i]][left_block[0+2*i]]; ^ 268. h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= h->intra4x4_pred_mode[left_xy[i]][left_block[1+2*i]]; 269. }else{
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L267
d2a_code_trace_data_43336
static ossl_inline void packet_forward(PACKET *pkt, size_t len) { pkt->curr += len; pkt->remaining -= len; } test/packettest.c:185: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 4):unsigned64 by call to `PACKET_copy_bytes`. Showing all 10 steps of the trace test/packettest.c:184:10: Call 182. PACKET pkt; 183. 184. if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN)) ^ 185. || !TEST_true(PACKET_copy_bytes(&pkt, bytes, 4)) 186. || !TEST_char_eq(bytes[0], 2) ssl/packet_locl.h:72:8: Parameter `pkt->remaining` 70. * is being used. 71. */ 72. __owur static ossl_inline int PACKET_buf_init(PACKET *pkt, ^ 73. const unsigned char *buf, 74. size_t len) test/packettest.c:185:17: Call 183. 184. if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN)) 185. || !TEST_true(PACKET_copy_bytes(&pkt, bytes, 4)) ^ 186. || !TEST_char_eq(bytes[0], 2) 187. || !TEST_char_eq(bytes[1], 4) ssl/packet_locl.h:379:8: Parameter `len` 377. * The caller is responsible for ensuring that |data| can hold |len| bytes. 378. */ 379. __owur static ossl_inline int PACKET_copy_bytes(PACKET *pkt, ^ 380. unsigned char *data, size_t len) 381. { ssl/packet_locl.h:385:5: Call 383. return 0; 384. 385. packet_forward(pkt, len); ^ 386. 387. return 1; ssl/packet_locl.h:33:1: <LHS trace> 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: Parameter `pkt->remaining` 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: <RHS trace> 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: Parameter `len` 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:36:5: Binary operation: ([0, +oo] - 4):unsigned64 by call to `PACKET_copy_bytes` 34. { 35. pkt->curr += len; 36. pkt->remaining -= len; ^ 37. } 38.
https://github.com/openssl/openssl/blob/424aa352458486d67e1e9cd3d3990dc06a60ba4a/ssl/packet_locl.h/#L36
d2a_code_trace_data_43337
static int epzs_motion_search4(MpegEncContext * s, int *mx_ptr, int *my_ptr, int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], int ref_mv_scale) { MotionEstContext * const c= &s->me; int best[2]={0, 0}; int d, dmin; int map_generation; const int penalty_factor= c->penalty_factor; const int size=1; const int h=8; const int ref_mv_stride= s->mb_stride; const int ref_mv_xy= s->mb_x + s->mb_y *ref_mv_stride; me_cmp_func cmpf, chroma_cmpf; LOAD_COMMON int flags= c->flags; LOAD_COMMON2 cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; map_generation= update_map_generation(c); dmin = 1000000; if (s->first_slice_line) { CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift) }else{ CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift) CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift) CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift) CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) } if(dmin>64*4){ CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) if(s->mb_y+1<s->end_mb_y) CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) } dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); *mx_ptr= best[0]; *my_ptr= best[1]; return dmin; } libavcodec/motion_est_template.c:1169: error: Uninitialized Value The value read from ymin was never initialized. libavcodec/motion_est_template.c:1169:9: 1167. CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) 1168. CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift) 1169. CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) ^ 1170. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, 1171. (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1169
d2a_code_trace_data_43338
void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) { unsigned long hash; OPENSSL_LH_NODE *nn, **rn; void *ret; lh->error = 0; rn = getrn(lh, data, &hash); if (*rn == NULL) { lh->num_no_delete++; return (NULL); } else { nn = *rn; *rn = nn->next; ret = nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))) contract(lh); return (ret); } ssl/bio_ssl.c:248: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `SSL_clear`. Showing all 14 steps of the trace ssl/bio_ssl.c:248:14: Call 246. SSL_set_accept_state(ssl); 247. 248. if (!SSL_clear(ssl)) { ^ 249. ret = 0; 250. break; ssl/ssl_lib.c:440:1: Parameter `s->initial_ctx->sessions->num_items` 438. } 439. 440. > int SSL_clear(SSL *s) 441. { 442. if (s->method == NULL) { ssl/ssl_lib.c:447:9: Call 445. } 446. 447. if (ssl_clear_bad_session(s)) { ^ 448. SSL_SESSION_free(s->session); 449. s->session = NULL; ssl/ssl_sess.c:992:1: Parameter `s->initial_ctx->sessions->num_items` 990. } 991. 992. > int ssl_clear_bad_session(SSL *s) 993. { 994. if ((s->session != NULL) && ssl/ssl_sess.c:997:9: Call 995. !(s->shutdown & SSL_SENT_SHUTDOWN) && 996. !(SSL_in_init(s) || SSL_in_before(s))) { 997. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 998. return (1); 999. } else ssl/ssl_sess.c:691:1: Parameter `ctx->sessions->num_items` 689. } 690. 691. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 692. { 693. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:693:12: Call 691. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 692. { 693. return remove_session_lock(ctx, c, 1); ^ 694. } 695. ssl/ssl_sess.c:696:1: Parameter `ctx->sessions->num_items` 694. } 695. 696. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 697. { 698. SSL_SESSION *r; ssl/ssl_sess.c:706:17: Call 704. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 705. ret = 1; 706. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 707. SSL_SESSION_list_remove(ctx, c); 708. } ssl/ssl_locl.h:581:1: Parameter `lh->num_items` 579. }; 580. 581. > DEFINE_LHASH_OF(SSL_SESSION); 582. /* Needed in ssl_cert.c */ 583. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:581:1: Call 579. }; 580. 581. > DEFINE_LHASH_OF(SSL_SESSION); 582. /* Needed in ssl_cert.c */ 583. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:103:1: <LHS trace> 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:103:1: Parameter `lh->num_items` 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:123:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `SSL_clear` 121. } 122. 123. lh->num_items--; ^ 124. if ((lh->num_nodes > MIN_NODES) && 125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
https://github.com/openssl/openssl/blob/2a7de0fd5d9baf946ef4d2c51096b04dd47a8143/crypto/lhash/lhash.c/#L123
d2a_code_trace_data_43339
static void apply_window_mp3_c(MPA_INT *synth_buf, MPA_INT *window, int *dither_state, OUT_INT *samples, int incr) { register const MPA_INT *w, *w2, *p; int j; OUT_INT *samples2; #if CONFIG_FLOAT float sum, sum2; #elif FRAC_BITS <= 15 int sum, sum2; #else int64_t sum, sum2; #endif memcpy(synth_buf + 512, synth_buf, 32 * sizeof(*synth_buf)); samples2 = samples + 31 * incr; w = window; w2 = window + 31; sum = *dither_state; p = synth_buf + 16; SUM8(MACS, sum, w, p); p = synth_buf + 48; SUM8(MLSS, sum, w + 32, p); *samples = round_sample(&sum); samples += incr; w++; for(j=1;j<16;j++) { sum2 = 0; p = synth_buf + 16 + j; SUM8P2(sum, MACS, sum2, MLSS, w, w2, p); p = synth_buf + 48 - j; SUM8P2(sum, MLSS, sum2, MLSS, w + 32, w2 + 32, p); *samples = round_sample(&sum); samples += incr; sum += sum2; *samples2 = round_sample(&sum); samples2 -= incr; w++; w2--; } p = synth_buf + 32; SUM8(MLSS, sum, w + 32, p); *samples = round_sample(&sum); *dither_state= sum; } libavcodec/mpc.c:54: error: Buffer Overrun L2 Offset: [481+min(0, `c->synth_buf_offset[*]`), 496+max(511, `c->synth_buf_offset[*]`)] (⇐ [33+min(0, `c->synth_buf_offset[*]`), 48+max(511, `c->synth_buf_offset[*]`)] + 448) Size: 2 by call to `ff_mpa_synth_filter`. libavcodec/mpc.c:45:1: Parameter `c->synth_buf[*]` 43. * Process decoded Musepack data and produce PCM 44. */ 45. static void mpc_synth(MPCContext *c, int16_t *out) ^ 46. { 47. int dither_state = 0; libavcodec/mpc.c:54:13: Call 52. samples_ptr = samples + ch; 53. for(i = 0; i < SAMPLES_PER_BAND; i++) { 54. ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]), ^ 55. ff_mpa_synth_window, &dither_state, 56. samples_ptr, 2, libavcodec/mpegaudiodec.c:705:1: Parameter `*synth_buf_ptr` 703. /* XXX: optimize by avoiding ring buffer usage */ 704. #if !CONFIG_FLOAT 705. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ^ 706. MPA_INT *window, int *dither_state, 707. OUT_INT *samples, int incr, libavcodec/mpegaudiodec.c:718:5: Assignment 716. 717. offset = *synth_buf_offset; 718. synth_buf = synth_buf_ptr + offset; ^ 719. 720. #if FRAC_BITS <= 15 libavcodec/mpegaudiodec.c:731:5: Call 729. #endif 730. 731. apply_window_mp3_c(synth_buf, window, dither_state, samples, incr); ^ 732. 733. offset = (offset - 32) & 511; libavcodec/mpegaudiodec.c:646:1: <Length trace> 644. } 645. 646. static void apply_window_mp3_c(MPA_INT *synth_buf, MPA_INT *window, ^ 647. int *dither_state, OUT_INT *samples, int incr) 648. { libavcodec/mpegaudiodec.c:646:1: Parameter `*synth_buf` 644. } 645. 646. static void apply_window_mp3_c(MPA_INT *synth_buf, MPA_INT *window, ^ 647. int *dither_state, OUT_INT *samples, int incr) 648. { libavcodec/mpegaudiodec.c:682:9: Assignment 680. p = synth_buf + 16 + j; 681. SUM8P2(sum, MACS, sum2, MLSS, w, w2, p); 682. p = synth_buf + 48 - j; ^ 683. SUM8P2(sum, MLSS, sum2, MLSS, w + 32, w2 + 32, p); 684. libavcodec/mpegaudiodec.c:683:9: Array access: Offset: [481+min(0, c->synth_buf_offset[*]), 496+max(511, c->synth_buf_offset[*])] (⇐ [33+min(0, c->synth_buf_offset[*]), 48+max(511, c->synth_buf_offset[*])] + 448) Size: 2 by call to `ff_mpa_synth_filter` 681. SUM8P2(sum, MACS, sum2, MLSS, w, w2, p); 682. p = synth_buf + 48 - j; 683. SUM8P2(sum, MLSS, sum2, MLSS, w + 32, w2 + 32, p); ^ 684. 685. *samples = round_sample(&sum);
https://github.com/libav/libav/blob/63e8d9760f23a4edf81e9ae58c4f6d3baa6ff4dd/libavcodec/mpegaudiodec.c/#L683
d2a_code_trace_data_43340
int RSA_X931_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e, BN_GENCB *cb) { int ok = 0; BIGNUM *Xp = NULL, *Xq = NULL; BN_CTX *ctx = NULL; ctx = BN_CTX_new(); if (ctx == NULL) goto error; BN_CTX_start(ctx); Xp = BN_CTX_get(ctx); Xq = BN_CTX_get(ctx); if (Xq == NULL) goto error; if (!BN_X931_generate_Xpq(Xp, Xq, bits, ctx)) goto error; rsa->p = BN_new(); rsa->q = BN_new(); if (rsa->p == NULL || rsa->q == NULL) goto error; if (!BN_X931_generate_prime_ex(rsa->p, NULL, NULL, NULL, NULL, Xp, e, ctx, cb)) goto error; if (!BN_X931_generate_prime_ex(rsa->q, NULL, NULL, NULL, NULL, Xq, e, ctx, cb)) goto error; if (!RSA_X931_derive_ex(rsa, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, e, cb)) goto error; ok = 1; error: if (ctx) BN_CTX_end(ctx); BN_CTX_free(ctx); if (ok) return 1; return 0; } crypto/rsa/rsa_x931g.c:191: error: NULL_DEREFERENCE pointer `ctx` last assigned on line 150 could be null and is dereferenced by call to `BN_CTX_free()` at line 191, column 5. Showing all 24 steps of the trace crypto/rsa/rsa_x931g.c:143:1: start of procedure RSA_X931_generate_key_ex() 141. } 142. 143. > int RSA_X931_generate_key_ex(RSA *rsa, int bits, const BIGNUM *e, 144. BN_GENCB *cb) 145. { crypto/rsa/rsa_x931g.c:146:5: 144. BN_GENCB *cb) 145. { 146. > int ok = 0; 147. BIGNUM *Xp = NULL, *Xq = NULL; 148. BN_CTX *ctx = NULL; crypto/rsa/rsa_x931g.c:147:5: 145. { 146. int ok = 0; 147. > BIGNUM *Xp = NULL, *Xq = NULL; 148. BN_CTX *ctx = NULL; 149. crypto/rsa/rsa_x931g.c:148:5: 146. int ok = 0; 147. BIGNUM *Xp = NULL, *Xq = NULL; 148. > BN_CTX *ctx = NULL; 149. 150. ctx = BN_CTX_new(); crypto/rsa/rsa_x931g.c:150:5: Skipping BN_CTX_new(): empty list of specs 148. BN_CTX *ctx = NULL; 149. 150. ctx = BN_CTX_new(); ^ 151. if (ctx == NULL) 152. goto error; crypto/rsa/rsa_x931g.c:151:9: Taking true branch 149. 150. ctx = BN_CTX_new(); 151. if (ctx == NULL) ^ 152. goto error; 153. crypto/rsa/rsa_x931g.c:188:2: 186. ok = 1; 187. 188. > error: 189. if (ctx) 190. BN_CTX_end(ctx); crypto/rsa/rsa_x931g.c:189:9: Taking false branch 187. 188. error: 189. if (ctx) ^ 190. BN_CTX_end(ctx); 191. BN_CTX_free(ctx); crypto/rsa/rsa_x931g.c:191:5: 189. if (ctx) 190. BN_CTX_end(ctx); 191. > BN_CTX_free(ctx); 192. 193. if (ok) crypto/bn/bn_ctx.c:157:1: start of procedure BN_CTX_free() 155. } 156. 157. > void BN_CTX_free(BN_CTX *ctx) 158. { 159. #ifdef BN_CTX_DEBUG crypto/bn/bn_ctx.c:174:5: 172. } 173. #endif 174. > BN_STACK_finish(&ctx->stack); 175. BN_POOL_finish(&ctx->pool); 176. OPENSSL_free(ctx); crypto/bn/bn_ctx.c:243:1: start of procedure BN_STACK_finish() 241. } 242. 243. > static void BN_STACK_finish(BN_STACK *st) 244. { 245. OPENSSL_free(st->indexes); crypto/bn/bn_ctx.c:245:5: 243. static void BN_STACK_finish(BN_STACK *st) 244. { 245. > OPENSSL_free(st->indexes); 246. st->indexes = NULL; 247. } crypto/mem.c:295:1: start of procedure CRYPTO_free() 293. } 294. 295. > void CRYPTO_free(void *str, const char *file, int line) 296. { 297. INCREMENT(free_count); crypto/mem.c:298:9: Taking true branch 296. { 297. INCREMENT(free_count); 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 299. free_impl(str, file, line); 300. return; crypto/mem.c:298:30: Taking true branch 296. { 297. INCREMENT(free_count); 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 299. free_impl(str, file, line); 300. return; crypto/mem.c:299:9: Skipping __function_pointer__(): unresolved function pointer 297. INCREMENT(free_count); 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { 299. free_impl(str, file, line); ^ 300. return; 301. } crypto/mem.c:300:9: 298. if (free_impl != NULL && free_impl != &CRYPTO_free) { 299. free_impl(str, file, line); 300. > return; 301. } 302. crypto/mem.c:314:1: return from a call to CRYPTO_free 312. free(str); 313. #endif 314. > } 315. 316. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/bn/bn_ctx.c:246:5: 244. { 245. OPENSSL_free(st->indexes); 246. > st->indexes = NULL; 247. } 248. crypto/bn/bn_ctx.c:247:1: return from a call to BN_STACK_finish 245. OPENSSL_free(st->indexes); 246. st->indexes = NULL; 247. > } 248. 249. crypto/bn/bn_ctx.c:175:5: 173. #endif 174. BN_STACK_finish(&ctx->stack); 175. > BN_POOL_finish(&ctx->pool); 176. OPENSSL_free(ctx); 177. } crypto/bn/bn_ctx.c:284:1: start of procedure BN_POOL_finish() 282. } 283. 284. > static void BN_POOL_finish(BN_POOL *p) 285. { 286. unsigned int loop; crypto/bn/bn_ctx.c:289:12: Loop condition is false. Leaving loop 287. BIGNUM *bn; 288. 289. while (p->head) { ^ 290. for (loop = 0, bn = p->head->vals; loop++ < BN_CTX_POOL_SIZE; bn++) 291. if (bn->d)
https://github.com/openssl/openssl/blob/98c03302fb7b855647aa14022f61f5fb272e514a/crypto/rsa/rsa_x931g.c/#L191
d2a_code_trace_data_43341
static int select_server_ctx(SSL *s, void *arg, int ignore) { const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); HANDSHAKE_EX_DATA *ex_data = (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); if (servername == NULL) { ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; return SSL_TLSEXT_ERR_NOACK; } if (strcmp(servername, "server2") == 0) { SSL_CTX *new_ctx = (SSL_CTX*)arg; SSL_set_SSL_CTX(s, new_ctx); SSL_clear_options(s, 0xFFFFFFFFL); SSL_set_options(s, SSL_CTX_get_options(new_ctx)); ex_data->servername = SSL_TEST_SERVERNAME_SERVER2; return SSL_TLSEXT_ERR_OK; } else if (strcmp(servername, "server1") == 0) { ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; return SSL_TLSEXT_ERR_OK; } else if (ignore) { ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; return SSL_TLSEXT_ERR_NOACK; } else { return SSL_TLSEXT_ERR_ALERT_FATAL; } } test/handshake_helper.c:112: error: NULL_DEREFERENCE pointer `ex_data` last assigned on line 87 could be null and is dereferenced at line 112, column 9. Showing all 22 steps of the trace test/handshake_helper.c:84:1: start of procedure select_server_ctx() 82. * An empty SNI extension also returns SSL_TSLEXT_ERR_NOACK. 83. */ 84. > static int select_server_ctx(SSL *s, void *arg, int ignore) 85. { 86. const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); test/handshake_helper.c:86:5: 84. static int select_server_ctx(SSL *s, void *arg, int ignore) 85. { 86. > const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); 87. HANDSHAKE_EX_DATA *ex_data = 88. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); ssl/ssl_lib.c:2052:1: start of procedure SSL_get_servername() 2050. */ 2051. 2052. > const char *SSL_get_servername(const SSL *s, const int type) 2053. { 2054. if (type != TLSEXT_NAMETYPE_host_name) ssl/ssl_lib.c:2054:9: Taking false branch 2052. const char *SSL_get_servername(const SSL *s, const int type) 2053. { 2054. if (type != TLSEXT_NAMETYPE_host_name) ^ 2055. return NULL; 2056. ssl/ssl_lib.c:2057:12: Condition is true 2055. return NULL; 2056. 2057. return s->session && !s->tlsext_hostname ? ^ 2058. s->session->tlsext_hostname : s->tlsext_hostname; 2059. } ssl/ssl_lib.c:2057:27: Condition is true 2055. return NULL; 2056. 2057. return s->session && !s->tlsext_hostname ? ^ 2058. s->session->tlsext_hostname : s->tlsext_hostname; 2059. } ssl/ssl_lib.c:2057:12: 2055. return NULL; 2056. 2057. > return s->session && !s->tlsext_hostname ? 2058. s->session->tlsext_hostname : s->tlsext_hostname; 2059. } ssl/ssl_lib.c:2057:5: 2055. return NULL; 2056. 2057. > return s->session && !s->tlsext_hostname ? 2058. s->session->tlsext_hostname : s->tlsext_hostname; 2059. } ssl/ssl_lib.c:2059:1: return from a call to SSL_get_servername 2057. return s->session && !s->tlsext_hostname ? 2058. s->session->tlsext_hostname : s->tlsext_hostname; 2059. > } 2060. 2061. int SSL_get_servername_type(const SSL *s) test/handshake_helper.c:87:5: 85. { 86. const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); 87. > HANDSHAKE_EX_DATA *ex_data = 88. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); 89. ssl/ssl_lib.c:3496:1: start of procedure SSL_get_ex_data() 3494. } 3495. 3496. > void *SSL_get_ex_data(const SSL *s, int idx) 3497. { 3498. return (CRYPTO_get_ex_data(&s->ex_data, idx)); ssl/ssl_lib.c:3498:5: 3496. void *SSL_get_ex_data(const SSL *s, int idx) 3497. { 3498. > return (CRYPTO_get_ex_data(&s->ex_data, idx)); 3499. } 3500. crypto/ex_data.c:369:1: start of procedure CRYPTO_get_ex_data() 367. * particular index in the class used by this variable 368. */ 369. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 370. { 371. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) crypto/ex_data.c:371:9: Taking true branch 369. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 370. { 371. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) ^ 372. return NULL; 373. return sk_void_value(ad->sk, idx); crypto/ex_data.c:372:9: 370. { 371. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) 372. > return NULL; 373. return sk_void_value(ad->sk, idx); 374. } crypto/ex_data.c:374:1: return from a call to CRYPTO_get_ex_data 372. return NULL; 373. return sk_void_value(ad->sk, idx); 374. > } ssl/ssl_lib.c:3499:1: return from a call to SSL_get_ex_data 3497. { 3498. return (CRYPTO_get_ex_data(&s->ex_data, idx)); 3499. > } 3500. 3501. int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg) test/handshake_helper.c:90:9: Taking false branch 88. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); 89. 90. if (servername == NULL) { ^ 91. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 92. return SSL_TLSEXT_ERR_NOACK; test/handshake_helper.c:95:9: Taking false branch 93. } 94. 95. if (strcmp(servername, "server2") == 0) { ^ 96. SSL_CTX *new_ctx = (SSL_CTX*)arg; 97. SSL_set_SSL_CTX(s, new_ctx); test/handshake_helper.c:108:16: Taking false branch 106. ex_data->servername = SSL_TEST_SERVERNAME_SERVER2; 107. return SSL_TLSEXT_ERR_OK; 108. } else if (strcmp(servername, "server1") == 0) { ^ 109. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 110. return SSL_TLSEXT_ERR_OK; test/handshake_helper.c:111:16: Taking true branch 109. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 110. return SSL_TLSEXT_ERR_OK; 111. } else if (ignore) { ^ 112. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 113. return SSL_TLSEXT_ERR_NOACK; test/handshake_helper.c:112:9: 110. return SSL_TLSEXT_ERR_OK; 111. } else if (ignore) { 112. > ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 113. return SSL_TLSEXT_ERR_NOACK; 114. } else {
https://github.com/openssl/openssl/blob/70c22888c1648fe8652e77107f3c74bf2212de36/test/handshake_helper.c/#L112
d2a_code_trace_data_43342
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:303: error: Buffer Overrun L2 Offset: [15, 30] (⇐ 12 + [3, 18]) Size: 28. libavcodec/ra144.c:299:8: <Offset trace> 297. for (x=1;x<11;*(output++)=outbuffer[x++]); 298. ptr=outbuffer+12; 299. for (x=0;x<16;x+=4) ^ 300. { 301. *(output++)=ptr[x]; libavcodec/ra144.c:299:8: Assignment 297. for (x=1;x<11;*(output++)=outbuffer[x++]); 298. ptr=outbuffer+12; 299. for (x=0;x<16;x+=4) ^ 300. { 301. *(output++)=ptr[x]; libavcodec/ra144.c:254:1: <Length trace> 252. 253. /* Decode 20-byte input */ 254. static void unpack_input(const unsigned char *input, unsigned int *output) ^ 255. { 256. unsigned int outbuffer[28]; libavcodec/ra144.c:254:1: Array declaration 252. 253. /* Decode 20-byte input */ 254. static void unpack_input(const unsigned char *input, unsigned int *output) ^ 255. { 256. unsigned int outbuffer[28]; libavcodec/ra144.c:298:3: Assignment 296. *(output++)=outbuffer[11]; 297. for (x=1;x<11;*(output++)=outbuffer[x++]); 298. ptr=outbuffer+12; ^ 299. for (x=0;x<16;x+=4) 300. { libavcodec/ra144.c:303:17: Array access: Offset: [15, 30] (⇐ 12 + [3, 18]) Size: 28 301. *(output++)=ptr[x]; 302. *(output++)=ptr[x+2]; 303. *(output++)=ptr[x+3]; ^ 304. *(output++)=ptr[x+1]; 305. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ra144.c/#L303
d2a_code_trace_data_43343
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; } crypto/ec/ec_lib.c:1043: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_sub`. Showing all 18 steps of the trace crypto/ec/ec_lib.c:1034:14: Call 1032. 1033. BN_CTX_start(ctx); 1034. if ((e = BN_CTX_get(ctx)) == NULL) ^ 1035. goto err; 1036. crypto/bn/bn_ctx.c:229:5: Call 227. } 228. /* OK, make sure the returned bignum is "zero" */ 229. BN_zero(ret); ^ 230. ctx->used++; 231. CTXDBG_RET(ctx, ret); crypto/bn/bn_lib.c:367:15: Assignment 365. a->neg = 0; 366. a->d[0] = w; 367. a->top = (w ? 1 : 0); ^ 368. bn_check_top(a); 369. return 1; crypto/bn/bn_lib.c:367:5: Assignment 365. a->neg = 0; 366. a->d[0] = w; 367. a->top = (w ? 1 : 0); ^ 368. bn_check_top(a); 369. return 1; crypto/ec/ec_lib.c:1043:10: Call 1041. if (!BN_set_word(e, 2)) 1042. goto err; 1043. if (!BN_sub(e, group->order, e)) ^ 1044. goto err; 1045. /*- crypto/bn/bn_add.c:45:1: Parameter `*r->d` 43. 44. /* signed sub of b from a. */ 45. > int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 46. { 47. int ret, r_neg, cmp_res; crypto/bn/bn_add.c:59:19: Call 57. if (cmp_res > 0) { 58. r_neg = a->neg; 59. ret = BN_usub(r, a, b); ^ 60. } else if (cmp_res < 0) { 61. r_neg = !b->neg; crypto/bn/bn_add.c:125:1: Parameter `*r->d` 123. 124. /* unsigned subtraction of b from a, a must be larger than b. */ 125. > int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b) 126. { 127. int max, min, dif; crypto/bn/bn_add.c:143:9: Call 141. } 142. 143. if (bn_wexpand(r, max) == NULL) ^ 144. return 0; 145. crypto/bn/bn_lib.c: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:943:37: Call 941. BIGNUM *bn_wexpand(BIGNUM *a, int words) 942. { 943. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 944. } 945. crypto/bn/bn_lib.c:246:1: Parameter `*b->d` 244. */ 245. 246. > BIGNUM *bn_expand2(BIGNUM *b, int words) 247. { 248. bn_check_top(b); crypto/bn/bn_lib.c:251:23: Call 249. 250. if (words > b->dmax) { 251. BN_ULONG *a = bn_expand_internal(b, words); ^ 252. if (!a) 253. return NULL; crypto/bn/bn_lib.c:208:1: <Offset trace> 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:208:1: Parameter `b->top` 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:208:1: <Length trace> 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:208:1: Parameter `*b->d` 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:233:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_sub` 231. assert(b->top <= words); 232. if (b->top > 0) 233. memcpy(a, b->d, sizeof(*a) * b->top); ^ 234. 235. return a;
https://github.com/openssl/openssl/blob/b8c32081e02b7008a90d878eccce46da256dfe86/crypto/bn/bn_lib.c/#L233
d2a_code_trace_data_43344
static int select_server_ctx(SSL *s, void *arg, int ignore) { const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); HANDSHAKE_EX_DATA *ex_data = (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); if (servername == NULL) { ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; return SSL_TLSEXT_ERR_NOACK; } if (strcmp(servername, "server2") == 0) { SSL_CTX *new_ctx = (SSL_CTX*)arg; SSL_set_SSL_CTX(s, new_ctx); SSL_clear_options(s, 0xFFFFFFFFL); SSL_set_options(s, SSL_CTX_get_options(new_ctx)); ex_data->servername = SSL_TEST_SERVERNAME_SERVER2; return SSL_TLSEXT_ERR_OK; } else if (strcmp(servername, "server1") == 0) { ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; return SSL_TLSEXT_ERR_OK; } else if (ignore) { ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; return SSL_TLSEXT_ERR_NOACK; } else { return SSL_TLSEXT_ERR_ALERT_FATAL; } } test/handshake_helper.c:106: error: NULL_DEREFERENCE pointer `ex_data` last assigned on line 87 could be null and is dereferenced at line 106, column 9. Showing all 40 steps of the trace test/handshake_helper.c:84:1: start of procedure select_server_ctx() 82. * An empty SNI extension also returns SSL_TSLEXT_ERR_NOACK. 83. */ 84. > static int select_server_ctx(SSL *s, void *arg, int ignore) 85. { 86. const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); test/handshake_helper.c:86:5: 84. static int select_server_ctx(SSL *s, void *arg, int ignore) 85. { 86. > const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); 87. HANDSHAKE_EX_DATA *ex_data = 88. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); ssl/ssl_lib.c:2052:1: start of procedure SSL_get_servername() 2050. */ 2051. 2052. > const char *SSL_get_servername(const SSL *s, const int type) 2053. { 2054. if (type != TLSEXT_NAMETYPE_host_name) ssl/ssl_lib.c:2054:9: Taking false branch 2052. const char *SSL_get_servername(const SSL *s, const int type) 2053. { 2054. if (type != TLSEXT_NAMETYPE_host_name) ^ 2055. return NULL; 2056. ssl/ssl_lib.c:2057:12: Condition is true 2055. return NULL; 2056. 2057. return s->session && !s->tlsext_hostname ? ^ 2058. s->session->tlsext_hostname : s->tlsext_hostname; 2059. } ssl/ssl_lib.c:2057:27: Condition is true 2055. return NULL; 2056. 2057. return s->session && !s->tlsext_hostname ? ^ 2058. s->session->tlsext_hostname : s->tlsext_hostname; 2059. } ssl/ssl_lib.c:2057:12: 2055. return NULL; 2056. 2057. > return s->session && !s->tlsext_hostname ? 2058. s->session->tlsext_hostname : s->tlsext_hostname; 2059. } ssl/ssl_lib.c:2057:5: 2055. return NULL; 2056. 2057. > return s->session && !s->tlsext_hostname ? 2058. s->session->tlsext_hostname : s->tlsext_hostname; 2059. } ssl/ssl_lib.c:2059:1: return from a call to SSL_get_servername 2057. return s->session && !s->tlsext_hostname ? 2058. s->session->tlsext_hostname : s->tlsext_hostname; 2059. > } 2060. 2061. int SSL_get_servername_type(const SSL *s) test/handshake_helper.c:87:5: 85. { 86. const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); 87. > HANDSHAKE_EX_DATA *ex_data = 88. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); 89. ssl/ssl_lib.c:3496:1: start of procedure SSL_get_ex_data() 3494. } 3495. 3496. > void *SSL_get_ex_data(const SSL *s, int idx) 3497. { 3498. return (CRYPTO_get_ex_data(&s->ex_data, idx)); ssl/ssl_lib.c:3498:5: 3496. void *SSL_get_ex_data(const SSL *s, int idx) 3497. { 3498. > return (CRYPTO_get_ex_data(&s->ex_data, idx)); 3499. } 3500. crypto/ex_data.c:369:1: start of procedure CRYPTO_get_ex_data() 367. * particular index in the class used by this variable 368. */ 369. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 370. { 371. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) crypto/ex_data.c:371:9: Taking true branch 369. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 370. { 371. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) ^ 372. return NULL; 373. return sk_void_value(ad->sk, idx); crypto/ex_data.c:372:9: 370. { 371. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) 372. > return NULL; 373. return sk_void_value(ad->sk, idx); 374. } crypto/ex_data.c:374:1: return from a call to CRYPTO_get_ex_data 372. return NULL; 373. return sk_void_value(ad->sk, idx); 374. > } ssl/ssl_lib.c:3499:1: return from a call to SSL_get_ex_data 3497. { 3498. return (CRYPTO_get_ex_data(&s->ex_data, idx)); 3499. > } 3500. 3501. int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg) test/handshake_helper.c:90:9: Taking false branch 88. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); 89. 90. if (servername == NULL) { ^ 91. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 92. return SSL_TLSEXT_ERR_NOACK; test/handshake_helper.c:95:9: Taking true branch 93. } 94. 95. if (strcmp(servername, "server2") == 0) { ^ 96. SSL_CTX *new_ctx = (SSL_CTX*)arg; 97. SSL_set_SSL_CTX(s, new_ctx); test/handshake_helper.c:96:9: 94. 95. if (strcmp(servername, "server2") == 0) { 96. > SSL_CTX *new_ctx = (SSL_CTX*)arg; 97. SSL_set_SSL_CTX(s, new_ctx); 98. /* test/handshake_helper.c:97:9: 95. if (strcmp(servername, "server2") == 0) { 96. SSL_CTX *new_ctx = (SSL_CTX*)arg; 97. > SSL_set_SSL_CTX(s, new_ctx); 98. /* 99. * Copy over all the SSL_CTX options - reasonable behavior ssl/ssl_lib.c:3348:1: start of procedure SSL_set_SSL_CTX() 3346. } 3347. 3348. > SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx) 3349. { 3350. CERT *new_cert; ssl/ssl_lib.c:3351:9: Taking false branch 3349. { 3350. CERT *new_cert; 3351. if (ssl->ctx == ctx) ^ 3352. return ssl->ctx; 3353. if (ctx == NULL) ssl/ssl_lib.c:3353:9: Taking false branch 3351. if (ssl->ctx == ctx) 3352. return ssl->ctx; 3353. if (ctx == NULL) ^ 3354. ctx = ssl->initial_ctx; 3355. new_cert = ssl_cert_dup(ctx->cert); ssl/ssl_lib.c:3355:5: Skipping ssl_cert_dup(): empty list of specs 3353. if (ctx == NULL) 3354. ctx = ssl->initial_ctx; 3355. new_cert = ssl_cert_dup(ctx->cert); ^ 3356. if (new_cert == NULL) { 3357. return NULL; ssl/ssl_lib.c:3356:9: Taking true branch 3354. ctx = ssl->initial_ctx; 3355. new_cert = ssl_cert_dup(ctx->cert); 3356. if (new_cert == NULL) { ^ 3357. return NULL; 3358. } ssl/ssl_lib.c:3357:9: 3355. new_cert = ssl_cert_dup(ctx->cert); 3356. if (new_cert == NULL) { 3357. > return NULL; 3358. } 3359. ssl_cert_free(ssl->cert); ssl/ssl_lib.c:3386:1: return from a call to SSL_set_SSL_CTX 3384. 3385. return ssl->ctx; 3386. > } 3387. 3388. int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx) test/handshake_helper.c:103:9: 101. * contexts differ/conflict 102. */ 103. > SSL_clear_options(s, 0xFFFFFFFFL); 104. SSL_set_options(s, SSL_CTX_get_options(new_ctx)); 105. ssl/ssl_lib.c:3851:1: start of procedure SSL_clear_options() 3849. return ctx->options &= ~op; 3850. } 3851. > unsigned long SSL_clear_options(SSL *s, unsigned long op) 3852. { 3853. return s->options &= ~op; ssl/ssl_lib.c:3853:5: 3851. unsigned long SSL_clear_options(SSL *s, unsigned long op) 3852. { 3853. > return s->options &= ~op; 3854. } 3855. ssl/ssl_lib.c:3854:1: return from a call to SSL_clear_options 3852. { 3853. return s->options &= ~op; 3854. > } 3855. 3856. STACK_OF(X509) *SSL_get0_verified_chain(const SSL *s) test/handshake_helper.c:104:9: 102. */ 103. SSL_clear_options(s, 0xFFFFFFFFL); 104. > SSL_set_options(s, SSL_CTX_get_options(new_ctx)); 105. 106. ex_data->servername = SSL_TEST_SERVERNAME_SERVER2; ssl/ssl_lib.c:3831:1: start of procedure SSL_CTX_get_options() 3829. * control interface. 3830. */ 3831. > unsigned long SSL_CTX_get_options(const SSL_CTX *ctx) 3832. { 3833. return ctx->options; ssl/ssl_lib.c:3833:5: 3831. unsigned long SSL_CTX_get_options(const SSL_CTX *ctx) 3832. { 3833. > return ctx->options; 3834. } 3835. unsigned long SSL_get_options(const SSL* s) ssl/ssl_lib.c:3834:1: return from a call to SSL_CTX_get_options 3832. { 3833. return ctx->options; 3834. > } 3835. unsigned long SSL_get_options(const SSL* s) 3836. { ssl/ssl_lib.c:3843:1: start of procedure SSL_set_options() 3841. return ctx->options |= op; 3842. } 3843. > unsigned long SSL_set_options(SSL *s, unsigned long op) 3844. { 3845. return s->options |= op; ssl/ssl_lib.c:3845:5: 3843. unsigned long SSL_set_options(SSL *s, unsigned long op) 3844. { 3845. > return s->options |= op; 3846. } 3847. unsigned long SSL_CTX_clear_options(SSL_CTX *ctx, unsigned long op) ssl/ssl_lib.c:3846:1: return from a call to SSL_set_options 3844. { 3845. return s->options |= op; 3846. > } 3847. unsigned long SSL_CTX_clear_options(SSL_CTX *ctx, unsigned long op) 3848. { test/handshake_helper.c:106:9: 104. SSL_set_options(s, SSL_CTX_get_options(new_ctx)); 105. 106. > ex_data->servername = SSL_TEST_SERVERNAME_SERVER2; 107. return SSL_TLSEXT_ERR_OK; 108. } else if (strcmp(servername, "server1") == 0) {
https://github.com/openssl/openssl/blob/70c22888c1648fe8652e77107f3c74bf2212de36/test/handshake_helper.c/#L106
d2a_code_trace_data_43345
int pkey_ctrl_string(EVP_PKEY_CTX *ctx, const char *value) { int rv; char *stmp, *vtmp = NULL; stmp = OPENSSL_strdup(value); if (!stmp) return -1; vtmp = strchr(stmp, ':'); if (vtmp) { *vtmp = 0; vtmp++; } rv = EVP_PKEY_CTX_ctrl_str(ctx, stmp, vtmp); OPENSSL_free(stmp); return rv; } apps/apps.c:1850: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_strdup()` at line 1841, column 12 is not reachable after line 1850, column 5. Showing all 39 steps of the trace apps/apps.c:1837:1: start of procedure pkey_ctrl_string() 1835. } 1836. 1837. > int pkey_ctrl_string(EVP_PKEY_CTX *ctx, const char *value) 1838. { 1839. int rv; apps/apps.c:1840:5: 1838. { 1839. int rv; 1840. > char *stmp, *vtmp = NULL; 1841. stmp = OPENSSL_strdup(value); 1842. if (!stmp) apps/apps.c:1841:5: 1839. int rv; 1840. char *stmp, *vtmp = NULL; 1841. > stmp = OPENSSL_strdup(value); 1842. if (!stmp) 1843. return -1; crypto/o_str.c:28:1: start of procedure CRYPTO_strdup() 26. } 27. 28. > char *CRYPTO_strdup(const char *str, const char* file, int line) 29. { 30. char *ret; crypto/o_str.c:33:9: Taking false branch 31. size_t size; 32. 33. if (str == NULL) ^ 34. return NULL; 35. size = strlen(str) + 1; crypto/o_str.c:35:5: 33. if (str == NULL) 34. return NULL; 35. > size = strlen(str) + 1; 36. ret = CRYPTO_malloc(size, file, line); 37. if (ret != NULL) crypto/o_str.c:36:5: 34. return NULL; 35. size = strlen(str) + 1; 36. > ret = CRYPTO_malloc(size, file, line); 37. if (ret != NULL) 38. memcpy(ret, str, size); 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/o_str.c:37:9: Taking true branch 35. size = strlen(str) + 1; 36. ret = CRYPTO_malloc(size, file, line); 37. if (ret != NULL) ^ 38. memcpy(ret, str, size); 39. return ret; crypto/o_str.c:38:9: 36. ret = CRYPTO_malloc(size, file, line); 37. if (ret != NULL) 38. > memcpy(ret, str, size); 39. return ret; 40. } crypto/o_str.c:39:5: 37. if (ret != NULL) 38. memcpy(ret, str, size); 39. > return ret; 40. } 41. crypto/o_str.c:40:1: return from a call to CRYPTO_strdup 38. memcpy(ret, str, size); 39. return ret; 40. > } 41. 42. char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line) apps/apps.c:1842:10: Taking false branch 1840. char *stmp, *vtmp = NULL; 1841. stmp = OPENSSL_strdup(value); 1842. if (!stmp) ^ 1843. return -1; 1844. vtmp = strchr(stmp, ':'); apps/apps.c:1844:5: 1842. if (!stmp) 1843. return -1; 1844. > vtmp = strchr(stmp, ':'); 1845. if (vtmp) { 1846. *vtmp = 0; apps/apps.c:1845:9: Taking false branch 1843. return -1; 1844. vtmp = strchr(stmp, ':'); 1845. if (vtmp) { ^ 1846. *vtmp = 0; 1847. vtmp++; apps/apps.c:1849:5: 1847. vtmp++; 1848. } 1849. > rv = EVP_PKEY_CTX_ctrl_str(ctx, stmp, vtmp); 1850. OPENSSL_free(stmp); 1851. return rv; crypto/evp/pmeth_lib.c:326:1: start of procedure EVP_PKEY_CTX_ctrl_str() 324. } 325. 326. > int EVP_PKEY_CTX_ctrl_str(EVP_PKEY_CTX *ctx, 327. const char *name, const char *value) 328. { crypto/evp/pmeth_lib.c:329:10: Taking false branch 327. const char *name, const char *value) 328. { 329. if (!ctx || !ctx->pmeth || !ctx->pmeth->ctrl_str) { ^ 330. EVPerr(EVP_F_EVP_PKEY_CTX_CTRL_STR, EVP_R_COMMAND_NOT_SUPPORTED); 331. return -2; crypto/evp/pmeth_lib.c:329:18: Taking false branch 327. const char *name, const char *value) 328. { 329. if (!ctx || !ctx->pmeth || !ctx->pmeth->ctrl_str) { ^ 330. EVPerr(EVP_F_EVP_PKEY_CTX_CTRL_STR, EVP_R_COMMAND_NOT_SUPPORTED); 331. return -2; crypto/evp/pmeth_lib.c:329:33: Taking false branch 327. const char *name, const char *value) 328. { 329. if (!ctx || !ctx->pmeth || !ctx->pmeth->ctrl_str) { ^ 330. EVPerr(EVP_F_EVP_PKEY_CTX_CTRL_STR, EVP_R_COMMAND_NOT_SUPPORTED); 331. return -2; crypto/evp/pmeth_lib.c:333:9: Taking false branch 331. return -2; 332. } 333. if (strcmp(name, "digest") == 0) ^ 334. return EVP_PKEY_CTX_md(ctx, EVP_PKEY_OP_TYPE_SIG, EVP_PKEY_CTRL_MD, 335. value); crypto/evp/pmeth_lib.c:336:5: Skipping __function_pointer__(): unresolved function pointer 334. return EVP_PKEY_CTX_md(ctx, EVP_PKEY_OP_TYPE_SIG, EVP_PKEY_CTRL_MD, 335. value); 336. return ctx->pmeth->ctrl_str(ctx, name, value); ^ 337. } 338. crypto/evp/pmeth_lib.c:337:1: return from a call to EVP_PKEY_CTX_ctrl_str 335. value); 336. return ctx->pmeth->ctrl_str(ctx, name, value); 337. > } 338. 339. /* Utility functions to send a string of hex string to a ctrl */ apps/apps.c:1850:5: 1848. } 1849. rv = EVP_PKEY_CTX_ctrl_str(ctx, stmp, vtmp); 1850. > OPENSSL_free(stmp); 1851. return rv; 1852. } crypto/mem.c:163:1: start of procedure 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:165:9: Taking true branch 163. void CRYPTO_free(void *str, const char *file, int line) 164. { 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 166. free_impl(str, file, line); 167. return; crypto/mem.c:165:30: Taking true branch 163. void CRYPTO_free(void *str, const char *file, int line) 164. { 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 166. free_impl(str, file, line); 167. return; crypto/mem.c:166:9: Skipping __function_pointer__(): unresolved function pointer 164. { 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { 166. free_impl(str, file, line); ^ 167. return; 168. } crypto/mem.c:167:9: 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { 166. free_impl(str, file, line); 167. > return; 168. } 169. crypto/mem.c:181:1: return from a call to CRYPTO_free 179. free(str); 180. #endif 181. > } 182. 183. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
https://github.com/openssl/openssl/blob/e3bc1305ec97d4ad4ab05fa59a288e92df2b2025/apps/apps.c/#L1850
d2a_code_trace_data_43346
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:186: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end`. Showing all 8 steps of the trace crypto/rsa/rsa_sp800_56b_check.c:175:15: Call 173. ret = (gcd != NULL 174. /* LCM(p - 1, q - 1) */ 175. && (rsa_get_lcm(ctx, rsa->p, rsa->q, lcm, gcd, p1, q1, p1q1) == 1) ^ 176. /* (Step 6a) d < LCM(p - 1, q - 1) */ 177. && (BN_cmp(rsa->d, lcm) < 0) crypto/rsa/rsa_sp800_56b_check.c:220:1: Parameter `ctx->pool.used` 218. 219. /* return LCM(p-1, q-1) */ 220. > int rsa_get_lcm(BN_CTX *ctx, const BIGNUM *p, const BIGNUM *q, 221. BIGNUM *lcm, BIGNUM *gcd, BIGNUM *p1, BIGNUM *q1, 222. BIGNUM *p1q1) crypto/rsa/rsa_sp800_56b_check.c:186:5: Call 184. BN_clear(lcm); 185. BN_clear(gcd); 186. BN_CTX_end(ctx); ^ 187. return ret; 188. } 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_CTX_end` 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_43347
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; } crypto/bn/bn_prime.c:219: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_priv_rand_range`. Showing all 25 steps of the trace crypto/bn/bn_prime.c:195:10: Call 193. 194. /* compute A1 := a - 1 */ 195. if (!BN_copy(A1, a)) ^ 196. goto err; 197. if (!BN_sub_word(A1, 1)) crypto/bn/bn_lib.c:285:1: Parameter `a->top` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_prime.c:219:14: Call 217. 218. for (i = 0; i < checks; i++) { 219. if (!BN_priv_rand_range(check, A1)) ^ 220. goto err; 221. if (!BN_add_word(check, 1)) crypto/bn/bn_rand.c:182:1: Parameter `r->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 `r->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/bn/bn_rand.c:128:9: Call 126. 127. if (n == 1) 128. BN_zero(r); ^ 129. else if (!BN_is_bit_set(range, n - 2) && !BN_is_bit_set(range, n - 3)) { 130. /* crypto/bn/bn_lib.c:357:1: Parameter `a->top` 355. } 356. 357. > int BN_set_word(BIGNUM *a, BN_ULONG w) 358. { 359. bn_check_top(a); crypto/bn/bn_lib.c:360:9: Call 358. { 359. bn_check_top(a); 360. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 361. return 0; 362. a->neg = 0; crypto/bn/bn_lcl.h:651:1: Parameter `a->top` 649. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 650. 651. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 652. { 653. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_lcl.h:659:12: Call 657. return a; 658. 659. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2); ^ 660. } 661. crypto/bn/bn_lib.c:246:1: Parameter `b->top` 244. */ 245. 246. > BIGNUM *bn_expand2(BIGNUM *b, int words) 247. { 248. bn_check_top(b); crypto/bn/bn_lib.c:251:23: Call 249. 250. if (words > b->dmax) { 251. BN_ULONG *a = bn_expand_internal(b, words); ^ 252. if (!a) 253. return NULL; crypto/bn/bn_lib.c:208:1: <Offset trace> 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:208:1: Parameter `b->top` 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:208:1: <Length trace> 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:208:1: Parameter `words` 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:225:13: Call 223. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 224. else 225. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 226. if (a == NULL) { 227. 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:225:9: Assignment 223. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 224. else 225. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 226. if (a == NULL) { 227. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:233:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_priv_rand_range` 231. assert(b->top <= words); 232. if (b->top > 0) 233. memcpy(a, b->d, sizeof(*a) * b->top); ^ 234. 235. return a;
https://github.com/openssl/openssl/blob/49cd47eaababc8c57871b929080fc1357e2ad7b8/crypto/bn/bn_lib.c/#L233
d2a_code_trace_data_43348
ssize_t ngx_parse_size(ngx_str_t *line) { u_char unit; size_t len; ssize_t size; ngx_int_t scale; len = line->len; unit = line->data[len - 1]; switch (unit) { case 'K': case 'k': len--; scale = 1024; break; case 'M': case 'm': len--; scale = 1024 * 1024; break; default: scale = 1; } size = ngx_atosz(line->data, len); if (size == NGX_ERROR) { return NGX_ERROR; } size *= scale; return size; } src/core/ngx_conf_file.c:1189: error: Integer Overflow L2 ([0, +oo] - 1):unsigned64 by call to `ngx_parse_size`. src/core/ngx_conf_file.c:1189:11: Call 1187. value = cf->args->elts; 1188. 1189. *sp = ngx_parse_size(&value[1]); ^ 1190. if (*sp == (size_t) NGX_ERROR) { 1191. return "invalid value"; src/core/ngx_parse.c:11:1: <LHS trace> 9. 10. 11. ssize_t ^ 12. ngx_parse_size(ngx_str_t *line) 13. { src/core/ngx_parse.c:11:1: Parameter `line->len` 9. 10. 11. ssize_t ^ 12. ngx_parse_size(ngx_str_t *line) 13. { src/core/ngx_parse.c:19:5: Assignment 17. ngx_int_t scale; 18. 19. len = line->len; ^ 20. unit = line->data[len - 1]; 21. src/core/ngx_parse.c:20:12: Binary operation: ([0, +oo] - 1):unsigned64 by call to `ngx_parse_size` 18. 19. len = line->len; 20. unit = line->data[len - 1]; ^ 21. 22. switch (unit) {
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_parse.c/#L20
d2a_code_trace_data_43349
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ec2_mult.c:292: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `gf2m_Madd`. Showing all 14 steps of the trace crypto/ec/ec2_mult.c:219:1: Parameter `ctx->stack.depth` 217. * avoiding conditional branches. 218. */ 219. > static int ec_GF2m_montgomery_point_multiply(const EC_GROUP *group, 220. EC_POINT *r, 221. const BIGNUM *scalar, crypto/ec/ec2_mult.c:247:5: Call 245. * Since point_multiply is static we can guarantee that ctx != NULL. 246. */ 247. BN_CTX_start(ctx); ^ 248. x1 = BN_CTX_get(ctx); 249. z1 = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/ec/ec2_mult.c:292:18: Call 290. BN_consttime_swap(word & mask, x1, x2, group_top); 291. BN_consttime_swap(word & mask, z1, z2, group_top); 292. if (!gf2m_Madd(group, point->X, x2, z2, x1, z1, ctx)) ^ 293. goto err; 294. if (!gf2m_Mdouble(group, x1, z1, ctx)) crypto/ec/ec2_mult.c:89:5: Call 87. 88. /* Since Madd is static we can guarantee that ctx != NULL. */ 89. BN_CTX_start(ctx); ^ 90. t1 = BN_CTX_get(ctx); 91. t2 = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/ec/ec2_mult.c:115:5: Call 113. 114. err: 115. BN_CTX_end(ctx); ^ 116. return ret; 117. } 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 `gf2m_Madd` 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/d7c42d71ba407a4b3c26ed58263ae225976bbac3/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_43350
static int createImageSection(uint32 sectsize, unsigned char **sect_buff_ptr) { unsigned char *sect_buff = NULL; unsigned char *new_buff = NULL; static uint32 prev_sectsize = 0; sect_buff = *sect_buff_ptr; if (!sect_buff) { sect_buff = (unsigned char *)_TIFFmalloc(sectsize); *sect_buff_ptr = sect_buff; _TIFFmemset(sect_buff, 0, sectsize); } else { if (prev_sectsize < sectsize) { new_buff = _TIFFrealloc(sect_buff, sectsize); if (!new_buff) { free (sect_buff); sect_buff = (unsigned char *)_TIFFmalloc(sectsize); } else sect_buff = new_buff; _TIFFmemset(sect_buff, 0, sectsize); } } if (!sect_buff) { TIFFError("createImageSection", "Unable to allocate/reallocate section buffer"); return (-1); } prev_sectsize = sectsize; *sect_buff_ptr = sect_buff; return (0); } tools/tiffcrop.c:7190: error: Null Dereference pointer `sect_buff` last assigned on line 7185 could be null and is dereferenced by call to `_TIFFmemset()` at line 7190, column 7. tools/tiffcrop.c:7162:1: start of procedure createImageSection() 7160. 7161. /* Create a buffer to write one section at a time */ 7162. static int ^ 7163. createImageSection(uint32 sectsize, unsigned char **sect_buff_ptr) 7164. { tools/tiffcrop.c:7165:3: 7163. createImageSection(uint32 sectsize, unsigned char **sect_buff_ptr) 7164. { 7165. unsigned char *sect_buff = NULL; ^ 7166. unsigned char *new_buff = NULL; 7167. static uint32 prev_sectsize = 0; tools/tiffcrop.c:7166:3: 7164. { 7165. unsigned char *sect_buff = NULL; 7166. unsigned char *new_buff = NULL; ^ 7167. static uint32 prev_sectsize = 0; 7168. tools/tiffcrop.c:7167:3: 7165. unsigned char *sect_buff = NULL; 7166. unsigned char *new_buff = NULL; 7167. static uint32 prev_sectsize = 0; ^ 7168. 7169. sect_buff = *sect_buff_ptr; tools/tiffcrop.c:7169:3: 7167. static uint32 prev_sectsize = 0; 7168. 7169. sect_buff = *sect_buff_ptr; ^ 7170. 7171. if (!sect_buff) tools/tiffcrop.c:7171:8: Taking false branch 7169. sect_buff = *sect_buff_ptr; 7170. 7171. if (!sect_buff) ^ 7172. { 7173. sect_buff = (unsigned char *)_TIFFmalloc(sectsize); tools/tiffcrop.c:7179:9: Taking true branch 7177. else 7178. { 7179. if (prev_sectsize < sectsize) ^ 7180. { 7181. new_buff = _TIFFrealloc(sect_buff, sectsize); tools/tiffcrop.c:7181:7: 7179. if (prev_sectsize < sectsize) 7180. { 7181. new_buff = _TIFFrealloc(sect_buff, sectsize); ^ 7182. if (!new_buff) 7183. { libtiff/tif_unix.c:265:1: start of procedure _TIFFrealloc() 263. } 264. 265. void* ^ 266. _TIFFrealloc(void* p, tmsize_t s) 267. { libtiff/tif_unix.c:268:2: 266. _TIFFrealloc(void* p, tmsize_t s) 267. { 268. return (realloc(p, (size_t) s)); ^ 269. } 270. libtiff/tif_unix.c:269:1: return from a call to _TIFFrealloc 267. { 268. return (realloc(p, (size_t) s)); 269. } ^ 270. 271. void tools/tiffcrop.c:7182:12: Taking true branch 7180. { 7181. new_buff = _TIFFrealloc(sect_buff, sectsize); 7182. if (!new_buff) ^ 7183. { 7184. free (sect_buff); tools/tiffcrop.c:7184:2: 7182. if (!new_buff) 7183. { 7184. free (sect_buff); ^ 7185. sect_buff = (unsigned char *)_TIFFmalloc(sectsize); 7186. } tools/tiffcrop.c:7185:9: 7183. { 7184. free (sect_buff); 7185. sect_buff = (unsigned char *)_TIFFmalloc(sectsize); ^ 7186. } 7187. else libtiff/tif_unix.c:253:1: start of procedure _TIFFmalloc() 251. #endif 252. 253. void* ^ 254. _TIFFmalloc(tmsize_t s) 255. { libtiff/tif_unix.c:256:2: 254. _TIFFmalloc(tmsize_t s) 255. { 256. return (malloc((size_t) s)); ^ 257. } 258. libtiff/tif_unix.c:257:1: return from a call to _TIFFmalloc 255. { 256. return (malloc((size_t) s)); 257. } ^ 258. 259. void tools/tiffcrop.c:7190:7: 7188. sect_buff = new_buff; 7189. 7190. _TIFFmemset(sect_buff, 0, sectsize); ^ 7191. } 7192. } libtiff/tif_unix.c:271:1: start of procedure _TIFFmemset() 269. } 270. 271. void ^ 272. _TIFFmemset(void* p, int v, tmsize_t c) 273. { libtiff/tif_unix.c:274:2: 272. _TIFFmemset(void* p, int v, tmsize_t c) 273. { 274. memset(p, v, (size_t) c); ^ 275. } 276. libtiff/tif_unix.c:275:1: return from a call to _TIFFmemset 273. { 274. memset(p, v, (size_t) c); 275. } ^ 276. 277. void
https://gitlab.com/libtiff/libtiff/blob/b69a1998bedfabc32cd541408bffdef05bd01e45/tools/tiffcrop.c/#L7190
d2a_code_trace_data_43351
static int read_sl_header(PESContext *pes, SLConfigDescr *sl, const uint8_t *buf, int buf_size) { GetBitContext gb; int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0; int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0; int dts_flag = -1, cts_flag = -1; int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE; init_get_bits(&gb, buf, buf_size * 8); if (sl->use_au_start) au_start_flag = get_bits1(&gb); if (sl->use_au_end) au_end_flag = get_bits1(&gb); if (!sl->use_au_start && !sl->use_au_end) au_start_flag = au_end_flag = 1; if (sl->ocr_len > 0) ocr_flag = get_bits1(&gb); if (sl->use_idle) idle_flag = get_bits1(&gb); if (sl->use_padding) padding_flag = get_bits1(&gb); if (padding_flag) padding_bits = get_bits(&gb, 3); if (!idle_flag && (!padding_flag || padding_bits != 0)) { if (sl->packet_seq_num_len) skip_bits_long(&gb, sl->packet_seq_num_len); if (sl->degr_prior_len) if (get_bits1(&gb)) skip_bits(&gb, sl->degr_prior_len); if (ocr_flag) skip_bits_long(&gb, sl->ocr_len); if (au_start_flag) { if (sl->use_rand_acc_pt) get_bits1(&gb); if (sl->au_seq_num_len > 0) skip_bits_long(&gb, sl->au_seq_num_len); if (sl->use_timestamps) { dts_flag = get_bits1(&gb); cts_flag = get_bits1(&gb); } } if (sl->inst_bitrate_len) inst_bitrate_flag = get_bits1(&gb); if (dts_flag == 1) dts = get_bits64(&gb, sl->timestamp_len); if (cts_flag == 1) cts = get_bits64(&gb, sl->timestamp_len); if (sl->au_len > 0) skip_bits_long(&gb, sl->au_len); if (inst_bitrate_flag) skip_bits_long(&gb, sl->inst_bitrate_len); } if (dts != AV_NOPTS_VALUE) pes->dts = dts; if (cts != AV_NOPTS_VALUE) pes->pts = cts; if (sl->timestamp_len && sl->timestamp_res) avpriv_set_pts_info(pes->st, sl->timestamp_len, 1, sl->timestamp_res); return (get_bits_count(&gb) + 7) >> 3; } libavformat/mpegts.c:739: error: Null Dereference pointer `&gb->buffer` last assigned on line 736 could be null and is dereferenced by call to `get_bits1()` at line 739, column 25. libavformat/mpegts.c:728:1: start of procedure read_sl_header() 726. } 727. 728. static int read_sl_header(PESContext *pes, SLConfigDescr *sl, ^ 729. const uint8_t *buf, int buf_size) 730. { libavformat/mpegts.c:732:5: 730. { 731. GetBitContext gb; 732. int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0; ^ 733. int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0; 734. int dts_flag = -1, cts_flag = -1; libavformat/mpegts.c:733:5: 731. GetBitContext gb; 732. int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0; 733. int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0; ^ 734. int dts_flag = -1, cts_flag = -1; 735. int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE; libavformat/mpegts.c:734:5: 732. int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0; 733. int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0; 734. int dts_flag = -1, cts_flag = -1; ^ 735. int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE; 736. init_get_bits(&gb, buf, buf_size * 8); libavformat/mpegts.c:735:5: 733. int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0; 734. int dts_flag = -1, cts_flag = -1; 735. int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE; ^ 736. init_get_bits(&gb, buf, buf_size * 8); 737. libavformat/mpegts.c:736:5: 734. int dts_flag = -1, cts_flag = -1; 735. int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE; 736. init_get_bits(&gb, buf, buf_size * 8); ^ 737. 738. if (sl->use_au_start) 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. /** libavformat/mpegts.c:738:9: Taking true branch 736. init_get_bits(&gb, buf, buf_size * 8); 737. 738. if (sl->use_au_start) ^ 739. au_start_flag = get_bits1(&gb); 740. if (sl->use_au_end) libavformat/mpegts.c:739:9: 737. 738. if (sl->use_au_start) 739. au_start_flag = get_bits1(&gb); ^ 740. if (sl->use_au_end) 741. au_end_flag = get_bits1(&gb); 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/libavformat/mpegts.c/#L739
d2a_code_trace_data_43352
int ssl3_send_client_key_exchange(SSL *s) { unsigned char *p,*d; int n; unsigned long alg_k; #ifndef OPENSSL_NO_RSA unsigned char *q; EVP_PKEY *pkey=NULL; #endif #ifndef OPENSSL_NO_KRB5 KSSL_ERR kssl_err; #endif #ifndef OPENSSL_NO_ECDH EC_KEY *clnt_ecdh = NULL; const EC_POINT *srvr_ecpoint = NULL; EVP_PKEY *srvr_pub_pkey = NULL; unsigned char *encodedPoint = NULL; int encoded_pt_len = 0; BN_CTX * bn_ctx = NULL; #endif if (s->state == SSL3_ST_CW_KEY_EXCH_A) { d=(unsigned char *)s->init_buf->data; p= &(d[4]); alg_k=s->s3->tmp.new_cipher->algorithm_mkey; if (0) {} #ifndef OPENSSL_NO_RSA else if (alg_k & SSL_kRSA) { RSA *rsa; unsigned char tmp_buf[SSL_MAX_MASTER_KEY_LENGTH]; if (s->session->sess_cert->peer_rsa_tmp != NULL) rsa=s->session->sess_cert->peer_rsa_tmp; else { pkey=X509_get_pubkey(s->session->sess_cert->peer_pkeys[SSL_PKEY_RSA_ENC].x509); if ((pkey == NULL) || (pkey->type != EVP_PKEY_RSA) || (pkey->pkey.rsa == NULL)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_INTERNAL_ERROR); goto err; } rsa=pkey->pkey.rsa; EVP_PKEY_free(pkey); } tmp_buf[0]=s->client_version>>8; tmp_buf[1]=s->client_version&0xff; if (RAND_bytes(&(tmp_buf[2]),sizeof tmp_buf-2) <= 0) goto err; s->session->master_key_length=sizeof tmp_buf; q=p; if (s->version > SSL3_VERSION) p+=2; n=RSA_public_encrypt(sizeof tmp_buf, tmp_buf,p,rsa,RSA_PKCS1_PADDING); #ifdef PKCS1_CHECK if (s->options & SSL_OP_PKCS1_CHECK_1) p[1]++; if (s->options & SSL_OP_PKCS1_CHECK_2) tmp_buf[0]=0x70; #endif if (n <= 0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,SSL_R_BAD_RSA_ENCRYPT); goto err; } if (s->version > SSL3_VERSION) { s2n(n,q); n+=2; } s->session->master_key_length= s->method->ssl3_enc->generate_master_secret(s, s->session->master_key, tmp_buf,sizeof tmp_buf); OPENSSL_cleanse(tmp_buf,sizeof tmp_buf); } #endif #ifndef OPENSSL_NO_KRB5 else if (alg_k & SSL_kKRB5) { krb5_error_code krb5rc; KSSL_CTX *kssl_ctx = s->kssl_ctx; krb5_data *enc_ticket; krb5_data authenticator, *authp = NULL; EVP_CIPHER_CTX ciph_ctx; const EVP_CIPHER *enc = NULL; unsigned char iv[EVP_MAX_IV_LENGTH]; unsigned char tmp_buf[SSL_MAX_MASTER_KEY_LENGTH]; unsigned char epms[SSL_MAX_MASTER_KEY_LENGTH + EVP_MAX_IV_LENGTH]; int padl, outl = sizeof(epms); EVP_CIPHER_CTX_init(&ciph_ctx); #ifdef KSSL_DEBUG printf("ssl3_send_client_key_exchange(%lx & %lx)\n", alg_k, SSL_kKRB5); #endif authp = NULL; #ifdef KRB5SENDAUTH if (KRB5SENDAUTH) authp = &authenticator; #endif krb5rc = kssl_cget_tkt(kssl_ctx, &enc_ticket, authp, &kssl_err); enc = kssl_map_enc(kssl_ctx->enctype); if (enc == NULL) goto err; #ifdef KSSL_DEBUG { printf("kssl_cget_tkt rtn %d\n", krb5rc); if (krb5rc && kssl_err.text) printf("kssl_cget_tkt kssl_err=%s\n", kssl_err.text); } #endif if (krb5rc) { ssl3_send_alert(s,SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE); SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, kssl_err.reason); goto err; } s2n(enc_ticket->length,p); memcpy(p, enc_ticket->data, enc_ticket->length); p+= enc_ticket->length; n = enc_ticket->length + 2; if (authp && authp->length) { s2n(authp->length,p); memcpy(p, authp->data, authp->length); p+= authp->length; n+= authp->length + 2; free(authp->data); authp->data = NULL; authp->length = 0; } else { s2n(0,p); n+=2; } tmp_buf[0]=s->client_version>>8; tmp_buf[1]=s->client_version&0xff; if (RAND_bytes(&(tmp_buf[2]),sizeof tmp_buf-2) <= 0) goto err; memset(iv, 0, sizeof iv); EVP_EncryptInit_ex(&ciph_ctx,enc, NULL, kssl_ctx->key,iv); EVP_EncryptUpdate(&ciph_ctx,epms,&outl,tmp_buf, sizeof tmp_buf); EVP_EncryptFinal_ex(&ciph_ctx,&(epms[outl]),&padl); outl += padl; if (outl > (int)sizeof epms) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } EVP_CIPHER_CTX_cleanup(&ciph_ctx); s2n(outl,p); memcpy(p, epms, outl); p+=outl; n+=outl + 2; s->session->master_key_length= s->method->ssl3_enc->generate_master_secret(s, s->session->master_key, tmp_buf, sizeof tmp_buf); OPENSSL_cleanse(tmp_buf, sizeof tmp_buf); OPENSSL_cleanse(epms, outl); } #endif #ifndef OPENSSL_NO_DH else if (alg_k & (SSL_kEDH|SSL_kDHr|SSL_kDHd)) { DH *dh_srvr,*dh_clnt; if (s->session->sess_cert == NULL) { ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_UNEXPECTED_MESSAGE); SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,SSL_R_UNEXPECTED_MESSAGE); goto err; } if (s->session->sess_cert->peer_dh_tmp != NULL) dh_srvr=s->session->sess_cert->peer_dh_tmp; else { ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_HANDSHAKE_FAILURE); SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,SSL_R_UNABLE_TO_FIND_DH_PARAMETERS); goto err; } if ((dh_clnt=DHparams_dup(dh_srvr)) == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_DH_LIB); goto err; } if (!DH_generate_key(dh_clnt)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_DH_LIB); goto err; } n=DH_compute_key(p,dh_srvr->pub_key,dh_clnt); if (n <= 0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_DH_LIB); goto err; } s->session->master_key_length= s->method->ssl3_enc->generate_master_secret(s, s->session->master_key,p,n); memset(p,0,n); n=BN_num_bytes(dh_clnt->pub_key); s2n(n,p); BN_bn2bin(dh_clnt->pub_key,p); n+=2; DH_free(dh_clnt); } #endif #ifndef OPENSSL_NO_ECDH else if (alg_k & (SSL_kEECDH|SSL_kECDHr|SSL_kECDHe)) { const EC_GROUP *srvr_group = NULL; EC_KEY *tkey; int ecdh_clnt_cert = 0; int field_size = 0; if ((alg_k & (SSL_kECDHr|SSL_kECDHe)) && (s->cert != NULL)) { } if (s->session->sess_cert->peer_ecdh_tmp != NULL) { tkey = s->session->sess_cert->peer_ecdh_tmp; } else { srvr_pub_pkey = X509_get_pubkey(s->session-> \ sess_cert->peer_pkeys[SSL_PKEY_ECC].x509); if ((srvr_pub_pkey == NULL) || (srvr_pub_pkey->type != EVP_PKEY_EC) || (srvr_pub_pkey->pkey.ec == NULL)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } tkey = srvr_pub_pkey->pkey.ec; } srvr_group = EC_KEY_get0_group(tkey); srvr_ecpoint = EC_KEY_get0_public_key(tkey); if ((srvr_group == NULL) || (srvr_ecpoint == NULL)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } if ((clnt_ecdh=EC_KEY_new()) == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_MALLOC_FAILURE); goto err; } if (!EC_KEY_set_group(clnt_ecdh, srvr_group)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_EC_LIB); goto err; } if (ecdh_clnt_cert) { const BIGNUM *priv_key; tkey = s->cert->key->privatekey->pkey.ec; priv_key = EC_KEY_get0_private_key(tkey); if (priv_key == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_MALLOC_FAILURE); goto err; } if (!EC_KEY_set_private_key(clnt_ecdh, priv_key)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_EC_LIB); goto err; } } else { if (!(EC_KEY_generate_key(clnt_ecdh))) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_ECDH_LIB); goto err; } } field_size = EC_GROUP_get_degree(srvr_group); if (field_size <= 0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_ECDH_LIB); goto err; } n=ECDH_compute_key(p, (field_size+7)/8, srvr_ecpoint, clnt_ecdh, NULL); if (n <= 0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_ECDH_LIB); goto err; } s->session->master_key_length = s->method->ssl3_enc \ -> generate_master_secret(s, s->session->master_key, p, n); memset(p, 0, n); if (ecdh_clnt_cert) { n = 0; } else { encoded_pt_len = EC_POINT_point2oct(srvr_group, EC_KEY_get0_public_key(clnt_ecdh), POINT_CONVERSION_UNCOMPRESSED, NULL, 0, NULL); encodedPoint = (unsigned char *) OPENSSL_malloc(encoded_pt_len * sizeof(unsigned char)); bn_ctx = BN_CTX_new(); if ((encodedPoint == NULL) || (bn_ctx == NULL)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_MALLOC_FAILURE); goto err; } n = EC_POINT_point2oct(srvr_group, EC_KEY_get0_public_key(clnt_ecdh), POINT_CONVERSION_UNCOMPRESSED, encodedPoint, encoded_pt_len, bn_ctx); *p = n; p += 1; memcpy((unsigned char *)p, encodedPoint, n); n += 1; } BN_CTX_free(bn_ctx); if (encodedPoint != NULL) OPENSSL_free(encodedPoint); if (clnt_ecdh != NULL) EC_KEY_free(clnt_ecdh); EVP_PKEY_free(srvr_pub_pkey); } #endif else if (alg_k & SSL_kGOST) { EVP_PKEY_CTX *pkey_ctx; X509 *peer_cert; size_t msglen; unsigned int md_len; int keytype; unsigned char premaster_secret[32],shared_ukm[32], tmp[256]; EVP_MD_CTX *ukm_hash; EVP_PKEY *pub_key; peer_cert=s->session->sess_cert->peer_pkeys[(keytype=SSL_PKEY_GOST01)].x509; if (!peer_cert) peer_cert=s->session->sess_cert->peer_pkeys[(keytype=SSL_PKEY_GOST94)].x509; if (!peer_cert) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER); goto err; } pkey_ctx=EVP_PKEY_CTX_new(pub_key=X509_get_pubkey(peer_cert),NULL); EVP_PKEY_encrypt_init(pkey_ctx); RAND_bytes(premaster_secret,32); if (s->s3->tmp.cert_req && s->cert->key->privatekey) { if (EVP_PKEY_derive_set_peer(pkey_ctx,s->cert->key->privatekey) <=0) { ERR_clear_error(); } } ukm_hash = EVP_MD_CTX_create(); EVP_DigestInit(ukm_hash,EVP_get_digestbynid(NID_id_GostR3411_94)); EVP_DigestUpdate(ukm_hash,s->s3->client_random,SSL3_RANDOM_SIZE); EVP_DigestUpdate(ukm_hash,s->s3->server_random,SSL3_RANDOM_SIZE); EVP_DigestFinal_ex(ukm_hash, shared_ukm, &md_len); EVP_MD_CTX_destroy(ukm_hash); if (EVP_PKEY_CTX_ctrl(pkey_ctx,-1,EVP_PKEY_OP_ENCRYPT,EVP_PKEY_CTRL_SET_IV, 8,shared_ukm)<0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, SSL_R_LIBRARY_BUG); goto err; } *(p++)=V_ASN1_SEQUENCE | V_ASN1_CONSTRUCTED; msglen=255; if (EVP_PKEY_encrypt(pkey_ctx,tmp,&msglen,premaster_secret,32)<0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, SSL_R_LIBRARY_BUG); goto err; } if (msglen >= 0x80) { *(p++)=0x81; *(p++)= msglen & 0xff; n=msglen+3; } else { *(p++)= msglen & 0xff; n=msglen+2; } memcpy(p, tmp, msglen); if (EVP_PKEY_CTX_ctrl(pkey_ctx, -1, -1, EVP_PKEY_CTRL_PEER_KEY, 2, NULL) > 0) { s->s3->flags |= TLS1_FLAGS_SKIP_CERT_VERIFY; } EVP_PKEY_CTX_free(pkey_ctx); s->session->master_key_length= s->method->ssl3_enc->generate_master_secret(s, s->session->master_key,premaster_secret,32); EVP_PKEY_free(pub_key); } #ifndef OPENSSL_NO_PSK else if (alg_k & SSL_kPSK) { char identity[PSK_MAX_IDENTITY_LEN]; unsigned char *t = NULL; unsigned char psk_or_pre_ms[PSK_MAX_PSK_LEN*2+4]; unsigned int pre_ms_len = 0, psk_len = 0; int psk_err = 1; n = 0; if (s->psk_client_callback == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, SSL_R_PSK_NO_CLIENT_CB); goto err; } psk_len = s->psk_client_callback(s, s->ctx->psk_identity_hint, identity, PSK_MAX_IDENTITY_LEN, psk_or_pre_ms, sizeof(psk_or_pre_ms)); if (psk_len > PSK_MAX_PSK_LEN) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto psk_err; } else if (psk_len == 0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, SSL_R_PSK_IDENTITY_NOT_FOUND); goto psk_err; } pre_ms_len = 2+psk_len+2+psk_len; t = psk_or_pre_ms; memmove(psk_or_pre_ms+psk_len+4, psk_or_pre_ms, psk_len); s2n(psk_len, t); memset(t, 0, psk_len); t+=psk_len; s2n(psk_len, t); if (s->session->psk_identity_hint != NULL) OPENSSL_free(s->session->psk_identity_hint); s->session->psk_identity_hint = BUF_strdup(s->ctx->psk_identity_hint); if (s->ctx->psk_identity_hint != NULL && s->session->psk_identity_hint == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE); goto psk_err; } if (s->session->psk_identity != NULL) OPENSSL_free(s->session->psk_identity); s->session->psk_identity = BUF_strdup(identity); if (s->session->psk_identity == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE); goto psk_err; } s->session->master_key_length = s->method->ssl3_enc->generate_master_secret(s, s->session->master_key, psk_or_pre_ms, pre_ms_len); n = strlen(identity); s2n(n, p); memcpy(p, identity, n); n+=2; psk_err = 0; psk_err: OPENSSL_cleanse(identity, PSK_MAX_IDENTITY_LEN); OPENSSL_cleanse(psk_or_pre_ms, sizeof(psk_or_pre_ms)); if (psk_err != 0) { ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE); goto err; } } #endif else { ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE); SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } *(d++)=SSL3_MT_CLIENT_KEY_EXCHANGE; l2n3(n,d); s->state=SSL3_ST_CW_KEY_EXCH_B; s->init_num=n+4; s->init_off=0; } return(ssl3_do_write(s,SSL3_RT_HANDSHAKE)); err: #ifndef OPENSSL_NO_ECDH BN_CTX_free(bn_ctx); if (encodedPoint != NULL) OPENSSL_free(encodedPoint); if (clnt_ecdh != NULL) EC_KEY_free(clnt_ecdh); EVP_PKEY_free(srvr_pub_pkey); #endif return(-1); } ssl/s3_clnt.c:2499: error: NULL_DEREFERENCE pointer `pub_key` last assigned on line 2499 could be null and is dereferenced by call to `EVP_PKEY_CTX_new()` at line 2499, column 13. Showing all 27 steps of the trace ssl/s3_clnt.c:2006:1: start of procedure ssl3_send_client_key_exchange() 2004. 2005. 2006. > int ssl3_send_client_key_exchange(SSL *s) 2007. { 2008. unsigned char *p,*d; ssl/s3_clnt.c:2013:2: 2011. #ifndef OPENSSL_NO_RSA 2012. unsigned char *q; 2013. > EVP_PKEY *pkey=NULL; 2014. #endif 2015. #ifndef OPENSSL_NO_KRB5 ssl/s3_clnt.c:2019:2: 2017. #endif /* OPENSSL_NO_KRB5 */ 2018. #ifndef OPENSSL_NO_ECDH 2019. > EC_KEY *clnt_ecdh = NULL; 2020. const EC_POINT *srvr_ecpoint = NULL; 2021. EVP_PKEY *srvr_pub_pkey = NULL; ssl/s3_clnt.c:2020:2: 2018. #ifndef OPENSSL_NO_ECDH 2019. EC_KEY *clnt_ecdh = NULL; 2020. > const EC_POINT *srvr_ecpoint = NULL; 2021. EVP_PKEY *srvr_pub_pkey = NULL; 2022. unsigned char *encodedPoint = NULL; ssl/s3_clnt.c:2021:2: 2019. EC_KEY *clnt_ecdh = NULL; 2020. const EC_POINT *srvr_ecpoint = NULL; 2021. > EVP_PKEY *srvr_pub_pkey = NULL; 2022. unsigned char *encodedPoint = NULL; 2023. int encoded_pt_len = 0; ssl/s3_clnt.c:2022:2: 2020. const EC_POINT *srvr_ecpoint = NULL; 2021. EVP_PKEY *srvr_pub_pkey = NULL; 2022. > unsigned char *encodedPoint = NULL; 2023. int encoded_pt_len = 0; 2024. BN_CTX * bn_ctx = NULL; ssl/s3_clnt.c:2023:2: 2021. EVP_PKEY *srvr_pub_pkey = NULL; 2022. unsigned char *encodedPoint = NULL; 2023. > int encoded_pt_len = 0; 2024. BN_CTX * bn_ctx = NULL; 2025. #endif ssl/s3_clnt.c:2024:2: 2022. unsigned char *encodedPoint = NULL; 2023. int encoded_pt_len = 0; 2024. > BN_CTX * bn_ctx = NULL; 2025. #endif 2026. ssl/s3_clnt.c:2027:6: Taking true branch 2025. #endif 2026. 2027. if (s->state == SSL3_ST_CW_KEY_EXCH_A) ^ 2028. { 2029. d=(unsigned char *)s->init_buf->data; ssl/s3_clnt.c:2029:3: 2027. if (s->state == SSL3_ST_CW_KEY_EXCH_A) 2028. { 2029. > d=(unsigned char *)s->init_buf->data; 2030. p= &(d[4]); 2031. ssl/s3_clnt.c:2030:3: 2028. { 2029. d=(unsigned char *)s->init_buf->data; 2030. > p= &(d[4]); 2031. 2032. alg_k=s->s3->tmp.new_cipher->algorithm_mkey; ssl/s3_clnt.c:2032:3: 2030. p= &(d[4]); 2031. 2032. > alg_k=s->s3->tmp.new_cipher->algorithm_mkey; 2033. 2034. /* Fool emacs indentation */ ssl/s3_clnt.c:2035:7: Taking false branch 2033. 2034. /* Fool emacs indentation */ 2035. if (0) {} ^ 2036. #ifndef OPENSSL_NO_RSA 2037. else if (alg_k & SSL_kRSA) ssl/s3_clnt.c:2037:12: Taking false branch 2035. if (0) {} 2036. #ifndef OPENSSL_NO_RSA 2037. else if (alg_k & SSL_kRSA) ^ 2038. { 2039. RSA *rsa; ssl/s3_clnt.c:2230:12: Taking false branch 2228. #endif 2229. #ifndef OPENSSL_NO_DH 2230. else if (alg_k & (SSL_kEDH|SSL_kDHr|SSL_kDHd)) ^ 2231. { 2232. DH *dh_srvr,*dh_clnt; ssl/s3_clnt.c:2294:12: Taking false branch 2292. 2293. #ifndef OPENSSL_NO_ECDH 2294. else if (alg_k & (SSL_kEECDH|SSL_kECDHr|SSL_kECDHe)) ^ 2295. { 2296. const EC_GROUP *srvr_group = NULL; ssl/s3_clnt.c:2478:12: Taking true branch 2476. } 2477. #endif /* !OPENSSL_NO_ECDH */ 2478. else if (alg_k & SSL_kGOST) ^ 2479. { 2480. /* GOST key exchange message creation */ ssl/s3_clnt.c:2491:4: 2489. 2490. /* Get server sertificate PKEY and create ctx from it */ 2491. > peer_cert=s->session->sess_cert->peer_pkeys[(keytype=SSL_PKEY_GOST01)].x509; 2492. if (!peer_cert) 2493. peer_cert=s->session->sess_cert->peer_pkeys[(keytype=SSL_PKEY_GOST94)].x509; ssl/s3_clnt.c:2492:9: Taking true branch 2490. /* Get server sertificate PKEY and create ctx from it */ 2491. peer_cert=s->session->sess_cert->peer_pkeys[(keytype=SSL_PKEY_GOST01)].x509; 2492. if (!peer_cert) ^ 2493. peer_cert=s->session->sess_cert->peer_pkeys[(keytype=SSL_PKEY_GOST94)].x509; 2494. if (!peer_cert) { ssl/s3_clnt.c:2493:5: 2491. peer_cert=s->session->sess_cert->peer_pkeys[(keytype=SSL_PKEY_GOST01)].x509; 2492. if (!peer_cert) 2493. > peer_cert=s->session->sess_cert->peer_pkeys[(keytype=SSL_PKEY_GOST94)].x509; 2494. if (!peer_cert) { 2495. SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER); ssl/s3_clnt.c:2494:9: Taking false branch 2492. if (!peer_cert) 2493. peer_cert=s->session->sess_cert->peer_pkeys[(keytype=SSL_PKEY_GOST94)].x509; 2494. if (!peer_cert) { ^ 2495. SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER); 2496. goto err; ssl/s3_clnt.c:2499:4: 2497. } 2498. 2499. > pkey_ctx=EVP_PKEY_CTX_new(pub_key=X509_get_pubkey(peer_cert),NULL); 2500. /* If we have send a certificate, and certificate key 2501. crypto/x509/x509_cmp.c:295:1: start of procedure X509_get_pubkey() 293. } 294. 295. > EVP_PKEY *X509_get_pubkey(X509 *x) 296. { 297. if ((x == NULL) || (x->cert_info == NULL)) crypto/x509/x509_cmp.c:297:7: Taking false branch 295. EVP_PKEY *X509_get_pubkey(X509 *x) 296. { 297. if ((x == NULL) || (x->cert_info == NULL)) ^ 298. return(NULL); 299. return(X509_PUBKEY_get(x->cert_info->key)); crypto/x509/x509_cmp.c:297:22: Taking true branch 295. EVP_PKEY *X509_get_pubkey(X509 *x) 296. { 297. if ((x == NULL) || (x->cert_info == NULL)) ^ 298. return(NULL); 299. return(X509_PUBKEY_get(x->cert_info->key)); crypto/x509/x509_cmp.c:298:3: 296. { 297. if ((x == NULL) || (x->cert_info == NULL)) 298. > return(NULL); 299. return(X509_PUBKEY_get(x->cert_info->key)); 300. } crypto/x509/x509_cmp.c:300:2: return from a call to X509_get_pubkey 298. return(NULL); 299. return(X509_PUBKEY_get(x->cert_info->key)); 300. } ^ 301. 302. ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x)
https://github.com/openssl/openssl/blob/dd4a0af3701b1669661d62420253ec1e40076e61/ssl/s3_clnt.c/#L2499
d2a_code_trace_data_43353
static int check_image_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, const int linesizes[4]) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); int i; for (i = 0; i < 4; i++) { int plane = desc->comp[i].plane; if (!data[plane] || !linesizes[plane]) return 0; } return 1; } libswscale/swscale_unscaled.c:1118: error: Null Dereference pointer `desc` last assigned on line 1114 could be null and is dereferenced at line 1118, column 21. libswscale/swscale_unscaled.c:1111:1: start of procedure check_image_pointers() 1109. } 1110. 1111. static int check_image_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, ^ 1112. const int linesizes[4]) 1113. { libswscale/swscale_unscaled.c:1114:5: 1112. const int linesizes[4]) 1113. { 1114. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt); ^ 1115. int i; 1116. libavutil/pixdesc.c:1464:1: start of procedure av_pix_fmt_desc_get() 1462. } 1463. 1464. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) ^ 1465. { 1466. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) libavutil/pixdesc.c:1466:9: Taking false branch 1464. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1465. { 1466. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1467. return NULL; 1468. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1466:24: Taking true branch 1464. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1465. { 1466. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1467. return NULL; 1468. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1467:9: 1465. { 1466. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) 1467. return NULL; ^ 1468. return &av_pix_fmt_descriptors[pix_fmt]; 1469. } libavutil/pixdesc.c:1469:1: return from a call to av_pix_fmt_desc_get 1467. return NULL; 1468. return &av_pix_fmt_descriptors[pix_fmt]; 1469. } ^ 1470. 1471. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) libswscale/swscale_unscaled.c:1117:10: 1115. int i; 1116. 1117. for (i = 0; i < 4; i++) { ^ 1118. int plane = desc->comp[i].plane; 1119. if (!data[plane] || !linesizes[plane]) libswscale/swscale_unscaled.c:1117:17: Loop condition is true. Entering loop body 1115. int i; 1116. 1117. for (i = 0; i < 4; i++) { ^ 1118. int plane = desc->comp[i].plane; 1119. if (!data[plane] || !linesizes[plane]) libswscale/swscale_unscaled.c:1118:9: 1116. 1117. for (i = 0; i < 4; i++) { 1118. int plane = desc->comp[i].plane; ^ 1119. if (!data[plane] || !linesizes[plane]) 1120. return 0;
https://github.com/libav/libav/blob/5f87c277bd5caa09cc4f9061d4ccdd58dc121110/libswscale/swscale_unscaled.c/#L1118