id
stringlengths 25
25
| content
stringlengths 649
72.1k
| max_stars_repo_path
stringlengths 91
133
|
|---|---|---|
d2a_code_trace_data_42654
|
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/ectest.c:870: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_hex2bn`.
Showing all 21 steps of the trace
test/ectest.c:870:13: Call
868. || !TEST_ptr(z = BN_new())
869. || !TEST_ptr(yplusone = BN_new())
870. || !TEST_true(BN_hex2bn(&p, test->p))
^
871. || !TEST_true(BN_hex2bn(&a, test->a))
872. || !TEST_true(BN_hex2bn(&b, test->b))
crypto/bn/bn_print.c:126:1: Parameter `(*bn)->top`
124. }
125.
126. > int BN_hex2bn(BIGNUM **bn, const char *a)
127. {
128. BIGNUM *ret = NULL;
crypto/bn/bn_print.c:157:9: Call
155. } else {
156. ret = *bn;
157. BN_zero(ret);
^
158. }
159.
crypto/bn/bn_lib.c:395:1: Parameter `a->top`
393. }
394.
395. > int BN_set_word(BIGNUM *a, BN_ULONG w)
396. {
397. bn_check_top(a);
crypto/bn/bn_lib.c:398:9: Call
396. {
397. bn_check_top(a);
398. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
399. return (0);
400. a->neg = 0;
crypto/bn/bn_lcl.h:660:1: Parameter `a->top`
658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
659.
660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
661. {
662. if (bits > (INT_MAX - BN_BITS2 + 1))
crypto/bn/bn_lcl.h:668:12: Call
666. return a;
667.
668. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2);
^
669. }
670.
crypto/bn/bn_lib.c:284:1: Parameter `b->top`
282. */
283.
284. > BIGNUM *bn_expand2(BIGNUM *b, int words)
285. {
286. bn_check_top(b);
crypto/bn/bn_lib.c:289:23: Call
287.
288. if (words > b->dmax) {
289. BN_ULONG *a = bn_expand_internal(b, words);
^
290. if (!a)
291. return NULL;
crypto/bn/bn_lib.c:246:1: <Offset trace>
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:246:1: Parameter `b->top`
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:246:1: <Length trace>
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:246:1: Parameter `words`
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:263:13: Call
261. a = OPENSSL_secure_zalloc(words * sizeof(*a));
262. else
263. a = OPENSSL_zalloc(words * sizeof(*a));
^
264. if (a == NULL) {
265. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
crypto/mem.c:186:1: Parameter `num`
184. }
185.
186. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
187. {
188. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:188:17: Call
186. void *CRYPTO_zalloc(size_t num, const char *file, int line)
187. {
188. void *ret = CRYPTO_malloc(num, file, line);
^
189.
190. FAILTEST();
crypto/mem.c:166:9: Assignment
164.
165. if (num == 0)
166. return NULL;
^
167.
168. FAILTEST();
crypto/mem.c:188:5: Assignment
186. void *CRYPTO_zalloc(size_t num, const char *file, int line)
187. {
188. void *ret = CRYPTO_malloc(num, file, line);
^
189.
190. FAILTEST();
crypto/mem.c:193:5: Assignment
191. if (ret != NULL)
192. memset(ret, 0, num);
193. return ret;
^
194. }
195.
crypto/bn/bn_lib.c:263:9: Assignment
261. a = OPENSSL_secure_zalloc(words * sizeof(*a));
262. else
263. a = OPENSSL_zalloc(words * sizeof(*a));
^
264. if (a == NULL) {
265. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
crypto/bn/bn_lib.c:271:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_hex2bn`
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/7671342e550ed2de676b23c79d0e7f45a381c76e/crypto/bn/bn_lib.c/#L271
|
d2a_code_trace_data_42655
|
void ff_MPV_frame_end(MpegEncContext *s)
{
#if FF_API_XVMC
FF_DISABLE_DEPRECATION_WARNINGS
if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) {
ff_xvmc_field_end(s);
} else
FF_ENABLE_DEPRECATION_WARNINGS
#endif
if (s->er.error_count &&
!s->avctx->hwaccel &&
s->unrestricted_mv &&
s->current_picture.reference &&
!s->intra_only &&
!(s->flags & CODEC_FLAG_EMU_EDGE)) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
int hshift = desc->log2_chroma_w;
int vshift = desc->log2_chroma_h;
s->dsp.draw_edges(s->current_picture.f.data[0], s->linesize,
s->h_edge_pos, s->v_edge_pos,
EDGE_WIDTH, EDGE_WIDTH,
EDGE_TOP | EDGE_BOTTOM);
s->dsp.draw_edges(s->current_picture.f.data[1], s->uvlinesize,
s->h_edge_pos >> hshift, s->v_edge_pos >> vshift,
EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,
EDGE_TOP | EDGE_BOTTOM);
s->dsp.draw_edges(s->current_picture.f.data[2], s->uvlinesize,
s->h_edge_pos >> hshift, s->v_edge_pos >> vshift,
EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift,
EDGE_TOP | EDGE_BOTTOM);
}
emms_c();
if (s->current_picture.reference)
ff_thread_report_progress(&s->current_picture_ptr->tf, INT_MAX, 0);
}
libavcodec/mpegvideo.c:1663: error: Null Dereference
pointer `desc` last assigned on line 1662 could be null and is dereferenced at line 1663, column 22.
libavcodec/mpegvideo.c:1645:1: start of procedure ff_MPV_frame_end()
1643.
1644. /* called after a frame has been decoded. */
1645. void ff_MPV_frame_end(MpegEncContext *s)
^
1646. {
1647. #if FF_API_XVMC
libavcodec/mpegvideo.c:1651:9: Taking false branch
1649. /* redraw edges for the frame if decoding didn't complete */
1650. // just to make sure that all data is rendered.
1651. if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) {
^
1652. ff_xvmc_field_end(s);
1653. } else
libavcodec/mpegvideo.c:1656:9: Taking true branch
1654. FF_ENABLE_DEPRECATION_WARNINGS
1655. #endif /* FF_API_XVMC */
1656. if (s->er.error_count &&
^
1657. !s->avctx->hwaccel &&
1658. s->unrestricted_mv &&
libavcodec/mpegvideo.c:1657:10: Taking true branch
1655. #endif /* FF_API_XVMC */
1656. if (s->er.error_count &&
1657. !s->avctx->hwaccel &&
^
1658. s->unrestricted_mv &&
1659. s->current_picture.reference &&
libavcodec/mpegvideo.c:1658:9: Taking true branch
1656. if (s->er.error_count &&
1657. !s->avctx->hwaccel &&
1658. s->unrestricted_mv &&
^
1659. s->current_picture.reference &&
1660. !s->intra_only &&
libavcodec/mpegvideo.c:1659:9: Taking true branch
1657. !s->avctx->hwaccel &&
1658. s->unrestricted_mv &&
1659. s->current_picture.reference &&
^
1660. !s->intra_only &&
1661. !(s->flags & CODEC_FLAG_EMU_EDGE)) {
libavcodec/mpegvideo.c:1660:10: Taking true branch
1658. s->unrestricted_mv &&
1659. s->current_picture.reference &&
1660. !s->intra_only &&
^
1661. !(s->flags & CODEC_FLAG_EMU_EDGE)) {
1662. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
libavcodec/mpegvideo.c:1661:11: Taking true branch
1659. s->current_picture.reference &&
1660. !s->intra_only &&
1661. !(s->flags & CODEC_FLAG_EMU_EDGE)) {
^
1662. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
1663. int hshift = desc->log2_chroma_w;
libavcodec/mpegvideo.c:1662:9:
1660. !s->intra_only &&
1661. !(s->flags & CODEC_FLAG_EMU_EDGE)) {
1662. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
^
1663. int hshift = desc->log2_chroma_w;
1664. int vshift = desc->log2_chroma_h;
libavutil/pixdesc.c:1507:1: start of procedure av_pix_fmt_desc_get()
1505. }
1506.
1507. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
^
1508. {
1509. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
libavutil/pixdesc.c:1509:9: Taking false branch
1507. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1508. {
1509. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
^
1510. return NULL;
1511. return &av_pix_fmt_descriptors[pix_fmt];
libavutil/pixdesc.c:1509:24: Taking true branch
1507. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1508. {
1509. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
^
1510. return NULL;
1511. return &av_pix_fmt_descriptors[pix_fmt];
libavutil/pixdesc.c:1510:9:
1508. {
1509. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
1510. return NULL;
^
1511. return &av_pix_fmt_descriptors[pix_fmt];
1512. }
libavutil/pixdesc.c:1512:1: return from a call to av_pix_fmt_desc_get
1510. return NULL;
1511. return &av_pix_fmt_descriptors[pix_fmt];
1512. }
^
1513.
1514. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
libavcodec/mpegvideo.c:1663:9:
1661. !(s->flags & CODEC_FLAG_EMU_EDGE)) {
1662. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
1663. int hshift = desc->log2_chroma_w;
^
1664. int vshift = desc->log2_chroma_h;
1665. s->dsp.draw_edges(s->current_picture.f.data[0], s->linesize,
|
https://github.com/libav/libav/blob/d7b3ee9a3a03ab88d61a5895fbdbc6689f4dd671/libavcodec/mpegvideo.c/#L1663
|
d2a_code_trace_data_42656
|
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
{
int i, nw, lb, rb;
BN_ULONG *t, *f;
BN_ULONG l;
bn_check_top(r);
bn_check_top(a);
if (n < 0) {
BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT);
return 0;
}
nw = n / BN_BITS2;
if (bn_wexpand(r, a->top + nw + 1) == NULL)
return 0;
r->neg = a->neg;
lb = n % BN_BITS2;
rb = BN_BITS2 - lb;
f = a->d;
t = r->d;
t[a->top + nw] = 0;
if (lb == 0)
for (i = a->top - 1; i >= 0; i--)
t[nw + i] = f[i];
else
for (i = a->top - 1; i >= 0; i--) {
l = f[i];
t[nw + i + 1] |= (l >> rb) & BN_MASK2;
t[nw + i] = (l << lb) & BN_MASK2;
}
memset(t, 0, sizeof(*t) * nw);
r->top = a->top + nw + 1;
bn_correct_top(r);
bn_check_top(r);
return 1;
}
crypto/ec/ecdsa_ossl.c:223: error: BUFFER_OVERRUN_L3
Offset: [1, +oo] Size: [0, 8388607] by call to `ecdsa_sign_setup`.
Showing all 28 steps of the trace
crypto/ec/ecdsa_ossl.c:161:1: Parameter `eckey->group->order->top`
159. }
160.
161. > ECDSA_SIG *ossl_ecdsa_sign_sig(const unsigned char *dgst, int dgst_len,
162. const BIGNUM *in_kinv, const BIGNUM *in_r,
163. EC_KEY *eckey)
crypto/ec/ecdsa_ossl.c:206:9: Call
204.
205. order = EC_GROUP_get0_order(group);
206. i = BN_num_bits(order);
^
207. /*
208. * Need to truncate digest if it is too long: first truncate whole bytes.
crypto/bn/bn_lib.c:140:9: Call
138. bn_check_top(a);
139.
140. if (BN_is_zero(a))
^
141. return 0;
142. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
crypto/bn/bn_lib.c:852:1: Parameter `a->top`
850. }
851.
852. > int BN_is_zero(const BIGNUM *a)
853. {
854. return a->top == 0;
crypto/ec/ecdsa_ossl.c:223:18: Call
221. do {
222. if (in_kinv == NULL || in_r == NULL) {
223. if (!ecdsa_sign_setup(eckey, ctx, &kinv, &ret->r, dgst, dgst_len)) {
^
224. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_ECDSA_LIB);
225. goto err;
crypto/ec/ecdsa_ossl.c:33:1: Parameter `eckey->group->order->top`
31. }
32.
33. > static int ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in,
34. BIGNUM **kinvp, BIGNUM **rp,
35. const unsigned char *dgst, int dlen)
crypto/ec/ecdsa_ossl.c:76:18: Call
74.
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)
crypto/bn/bn_lib.c:140:9: Call
138. bn_check_top(a);
139.
140. if (BN_is_zero(a))
^
141. return 0;
142. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
crypto/bn/bn_lib.c:852:1: Parameter `a->top`
850. }
851.
852. > int BN_is_zero(const BIGNUM *a)
853. {
854. return a->top == 0;
crypto/ec/ecdsa_ossl.c:86:22: Call
84. do {
85. if (dgst != NULL) {
86. if (!BN_generate_dsa_nonce(k, order,
^
87. EC_KEY_get0_private_key(eckey),
88. dgst, dlen, ctx)) {
crypto/bn/bn_rand.c:205:1: Parameter `range->top`
203. * used.
204. */
205. > int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range,
206. const BIGNUM *priv, const unsigned char *message,
207. size_t message_len, BN_CTX *ctx)
crypto/bn/bn_rand.c:218:34: Call
216. unsigned done, todo;
217. /* We generate |range|+8 bytes of random output. */
218. const unsigned num_k_bytes = BN_num_bytes(range) + 8;
^
219. unsigned char private_bytes[96];
220. unsigned char *k_bytes;
crypto/bn/bn_lib.c:140:9: Call
138. bn_check_top(a);
139.
140. if (BN_is_zero(a))
^
141. return 0;
142. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
crypto/bn/bn_lib.c:852:1: Parameter `a->top`
850. }
851.
852. > int BN_is_zero(const BIGNUM *a)
853. {
854. return a->top == 0;
crypto/bn/bn_rand.c:260:9: Call
258. if (!BN_bin2bn(k_bytes, num_k_bytes, out))
259. goto err;
260. if (BN_mod(out, out, range, ctx) != 1)
^
261. goto err;
262. ret = 1;
crypto/bn/bn_div.c:199:31: Call
197.
198. /* First we normalise the numbers */
199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
^
200. if (!(BN_lshift(sdiv, divisor, norm_shift)))
201. goto err;
crypto/bn/bn_lib.c:141:9: Assignment
139.
140. if (BN_is_zero(a))
141. return 0;
^
142. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
143. }
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: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_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 `ecdsa_sign_setup`
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/4cc968df403ed9321d0df722aba33323ae575ce0/crypto/bn/bn_shift.c/#L112
|
d2a_code_trace_data_42657
|
static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose)
{
size_t packlen = pkt->written - sub->pwritten;
if (packlen == 0
&& (sub->flags & WPACKET_FLAGS_NON_ZERO_LENGTH) != 0)
return 0;
if (packlen == 0
&& sub->flags & WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH) {
if (!doclose)
return 0;
if ((pkt->curr - sub->lenbytes) == sub->packet_len) {
pkt->written -= sub->lenbytes;
pkt->curr -= sub->lenbytes;
}
sub->packet_len = 0;
sub->lenbytes = 0;
}
if (sub->lenbytes > 0
&& !put_value(&GETBUF(pkt)[sub->packet_len], packlen,
sub->lenbytes))
return 0;
if (doclose) {
pkt->subs = sub->parent;
OPENSSL_free(sub);
}
return 1;
}
ssl/record/rec_layer_s3.c:1032: error: INTEGER_OVERFLOW_L2
([0, +oo] - [0, 2]):unsigned64 by call to `WPACKET_close`.
Showing all 10 steps of the trace
ssl/record/rec_layer_s3.c:758:14: Call
756. #endif
757. SSL3_BUFFER_set_offset(wb, align);
758. if (!WPACKET_init_static_len(&pkt[0], SSL3_BUFFER_get_buf(wb),
^
759. SSL3_BUFFER_get_len(wb), 0)
760. || !WPACKET_allocate_bytes(&pkt[0], align, NULL)) {
ssl/packet.c:116:1: Parameter `pkt->curr`
114. }
115.
116. > int WPACKET_init_static_len(WPACKET *pkt, unsigned char *buf, size_t len,
117. size_t lenbytes)
118. {
ssl/record/rec_layer_s3.c:1032:21: Call
1030.
1031. if (!WPACKET_get_length(thispkt, &len)
1032. || !WPACKET_close(thispkt)) {
^
1033. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_DO_SSL3_WRITE,
1034. ERR_R_INTERNAL_ERROR);
ssl/packet.c:238:1: Parameter `pkt->curr`
236. }
237.
238. > int WPACKET_close(WPACKET *pkt)
239. {
240. /*
ssl/packet.c:247:12: Call
245. return 0;
246.
247. return wpacket_intern_close(pkt, pkt->subs, 1);
^
248. }
249.
ssl/packet.c:184:1: <LHS trace>
182. * (i.e. it fills in all the lengths), but doesn't actually close anything.
183. */
184. > static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose)
185. {
186. size_t packlen = pkt->written - sub->pwritten;
ssl/packet.c:184:1: Parameter `pkt->curr`
182. * (i.e. it fills in all the lengths), but doesn't actually close anything.
183. */
184. > static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose)
185. {
186. size_t packlen = pkt->written - sub->pwritten;
ssl/packet.c:184:1: <RHS trace>
182. * (i.e. it fills in all the lengths), but doesn't actually close anything.
183. */
184. > static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose)
185. {
186. size_t packlen = pkt->written - sub->pwritten;
ssl/packet.c:184:1: Parameter `sub->lenbytes`
182. * (i.e. it fills in all the lengths), but doesn't actually close anything.
183. */
184. > static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose)
185. {
186. size_t packlen = pkt->written - sub->pwritten;
ssl/packet.c:199:13: Binary operation: ([0, +oo] - [0, 2]):unsigned64 by call to `WPACKET_close`
197.
198. /* Deallocate any bytes allocated for the length of the WPACKET */
199. if ((pkt->curr - sub->lenbytes) == sub->packet_len) {
^
200. pkt->written -= sub->lenbytes;
201. pkt->curr -= sub->lenbytes;
|
https://github.com/openssl/openssl/blob/a8ea8018fa187e22fb4989450b550589e20f62c2/ssl/packet.c/#L199
|
d2a_code_trace_data_42658
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
test/bntest.c:674: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_mul`.
Showing all 25 steps of the trace
test/bntest.c:672:13: Call
670. BN_bntest_rand(d, 512, 0, 0);
671. for (j = 0; j < 2; j++) {
672. BN_GF2m_mod_exp(e, a, c, b[j], ctx);
^
673. BN_GF2m_mod_exp(f, a, d, b[j], ctx);
674. BN_GF2m_mod_mul(e, e, f, b[j], ctx);
crypto/bn/bn_gf2m.c:955:1: Parameter `ctx->stack.depth`
953. * for best performance, use the BN_GF2m_mod_exp_arr function.
954. */
955. > int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
956. const BIGNUM *p, BN_CTX *ctx)
957. {
test/bntest.c:673:13: Call
671. for (j = 0; j < 2; j++) {
672. BN_GF2m_mod_exp(e, a, c, b[j], ctx);
673. BN_GF2m_mod_exp(f, a, d, b[j], ctx);
^
674. BN_GF2m_mod_mul(e, e, f, b[j], ctx);
675. BN_add(f, c, d);
crypto/bn/bn_gf2m.c:955:1: Parameter `ctx->stack.depth`
953. * for best performance, use the BN_GF2m_mod_exp_arr function.
954. */
955. > int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
956. const BIGNUM *p, BN_CTX *ctx)
957. {
test/bntest.c:674:13: Call
672. BN_GF2m_mod_exp(e, a, c, b[j], ctx);
673. BN_GF2m_mod_exp(f, a, d, b[j], ctx);
674. BN_GF2m_mod_mul(e, e, f, b[j], ctx);
^
675. BN_add(f, c, d);
676. BN_GF2m_mod_exp(f, a, f, b[j], ctx);
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:676:13: Call
674. BN_GF2m_mod_mul(e, e, f, b[j], ctx);
675. BN_add(f, c, d);
676. BN_GF2m_mod_exp(f, a, f, b[j], ctx);
^
677. BN_GF2m_add(f, e, f);
678. /* Test that a^(c+d)=a^c*a^d. */
crypto/bn/bn_gf2m.c:955:1: Parameter `ctx->stack.depth`
953. * for best performance, use the BN_GF2m_mod_exp_arr function.
954. */
955. > int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
956. const BIGNUM *p, BN_CTX *ctx)
957. {
test/bntest.c:672:13: Call
670. BN_bntest_rand(d, 512, 0, 0);
671. for (j = 0; j < 2; j++) {
672. BN_GF2m_mod_exp(e, a, c, b[j], ctx);
^
673. BN_GF2m_mod_exp(f, a, d, b[j], ctx);
674. BN_GF2m_mod_mul(e, e, f, b[j], ctx);
crypto/bn/bn_gf2m.c:955:1: Parameter `ctx->stack.depth`
953. * for best performance, use the BN_GF2m_mod_exp_arr function.
954. */
955. > int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
956. const BIGNUM *p, BN_CTX *ctx)
957. {
test/bntest.c:673:13: Call
671. for (j = 0; j < 2; j++) {
672. BN_GF2m_mod_exp(e, a, c, b[j], ctx);
673. BN_GF2m_mod_exp(f, a, d, b[j], ctx);
^
674. BN_GF2m_mod_mul(e, e, f, b[j], ctx);
675. BN_add(f, c, d);
crypto/bn/bn_gf2m.c:955:1: Parameter `ctx->stack.depth`
953. * for best performance, use the BN_GF2m_mod_exp_arr function.
954. */
955. > int BN_GF2m_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
956. const BIGNUM *p, BN_CTX *ctx)
957. {
test/bntest.c:674:13: Call
672. BN_GF2m_mod_exp(e, a, c, b[j], ctx);
673. BN_GF2m_mod_exp(f, a, d, b[j], ctx);
674. BN_GF2m_mod_mul(e, e, f, b[j], ctx);
^
675. BN_add(f, c, d);
676. BN_GF2m_mod_exp(f, a, f, b[j], ctx);
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. {
crypto/bn/bn_gf2m.c:489:11: Call
487. goto err;
488. }
489. ret = BN_GF2m_mod_mul_arr(r, a, b, arr, ctx);
^
490. bn_check_top(r);
491. err:
crypto/bn/bn_gf2m.c:432:5: Call
430. }
431.
432. BN_CTX_start(ctx);
^
433. if ((s = BN_CTX_get(ctx)) == NULL)
434. goto err;
crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_gf2m.c:462:5: Call
460.
461. err:
462. BN_CTX_end(ctx);
^
463. return ret;
464. }
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_mul`
271. static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
^
274. }
275.
|
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_ctx.c/#L273
|
d2a_code_trace_data_42659
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/ec/ecp_smpl.c:933: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end`.
Showing all 10 steps of the trace
crypto/ec/ecp_smpl.c:823:5: Call
821. }
822.
823. BN_CTX_start(ctx);
^
824. n0 = BN_CTX_get(ctx);
825. n1 = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/ec/ecp_smpl.c:933:5: Call
931.
932. err:
933. BN_CTX_end(ctx);
^
934. BN_CTX_free(new_ctx);
935. return ret;
crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <Offset trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: <Length trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end`
266. static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
^
269. }
270.
|
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
|
d2a_code_trace_data_42660
|
void avformat_free_context(AVFormatContext *s)
{
int i;
if (!s)
return;
av_opt_free(s);
if (s->iformat && s->iformat->priv_class && s->priv_data)
av_opt_free(s->priv_data);
for (i = 0; i < s->nb_streams; i++)
free_stream(&s->streams[i]);
for (i = s->nb_programs - 1; i >= 0; i--) {
av_dict_free(&s->programs[i]->metadata);
av_freep(&s->programs[i]->stream_index);
av_freep(&s->programs[i]);
}
av_freep(&s->programs);
av_freep(&s->priv_data);
while (s->nb_chapters--) {
av_dict_free(&s->chapters[s->nb_chapters]->metadata);
av_free(s->chapters[s->nb_chapters]);
}
av_freep(&s->chapters);
av_dict_free(&s->metadata);
av_freep(&s->streams);
av_freep(&s->internal);
av_free(s);
}
libavformat/movenc.c:3764: error: Integer Overflow L1
([-oo, 0] - 1):unsigned32 by call to `ff_mov_close_hinting`.
libavformat/movenc.c:3759:9: Call
3757. if (mov->tracks[mov->chapter_track].enc)
3758. av_free(mov->tracks[mov->chapter_track].enc->extradata);
3759. av_freep(&mov->tracks[mov->chapter_track].enc);
^
3760. }
3761.
libavutil/mem.c:207:26: Assignment
205.
206. memcpy(&val, arg, sizeof(val));
207. memcpy(arg, &(void *){ NULL }, sizeof(val));
^
208. av_free(val);
209. }
libavformat/movenc.c:3764:13: Call
3762. for (i = 0; i < mov->nb_streams; i++) {
3763. if (mov->tracks[i].tag == MKTAG('r','t','p',' '))
3764. ff_mov_close_hinting(&mov->tracks[i]);
^
3765. av_freep(&mov->tracks[i].cluster);
3766. av_freep(&mov->tracks[i].frag_info);
libavformat/movenchint.c:458:1: Parameter `track->rtp_ctx->nb_chapters`
456. }
457.
458. void ff_mov_close_hinting(MOVTrack *track)
^
459. {
460. AVFormatContext *rtp_ctx = track->rtp_ctx;
libavformat/movenchint.c:470:5: Call
468. ffio_free_dyn_buf(&rtp_ctx->pb);
469. }
470. avformat_free_context(rtp_ctx);
^
471. }
libavformat/utils.c:2477:1: <LHS trace>
2475. }
2476.
2477. void avformat_free_context(AVFormatContext *s)
^
2478. {
2479. int i;
libavformat/utils.c:2477:1: Parameter `s->nb_chapters`
2475. }
2476.
2477. void avformat_free_context(AVFormatContext *s)
^
2478. {
2479. int i;
libavformat/utils.c:2498:12: Binary operation: ([-oo, 0] - 1):unsigned32 by call to `ff_mov_close_hinting`
2496. av_freep(&s->programs);
2497. av_freep(&s->priv_data);
2498. while (s->nb_chapters--) {
^
2499. av_dict_free(&s->chapters[s->nb_chapters]->metadata);
2500. av_free(s->chapters[s->nb_chapters]);
|
https://github.com/libav/libav/blob/a8068346e48e123f8d3bdf4d64464d81e53e5fc7/libavformat/utils.c/#L2498
|
d2a_code_trace_data_42661
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/rsa/rsa_eay.c:562: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set_locked`.
Showing all 28 steps of the trace
crypto/rsa/rsa_eay.c:496:2: Call
494.
495. if((ctx = BN_CTX_new()) == NULL) goto err;
496. BN_CTX_start(ctx);
^
497. f = BN_CTX_get(ctx);
498. br = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth`
253. }
254.
255. > void BN_CTX_start(BN_CTX *ctx)
256. {
257. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/rsa/rsa_eay.c:562:3: Call
560. d = rsa->d;
561.
562. MONT_HELPER(rsa->_method_mod_n, ctx, rsa->n, rsa->flags & RSA_FLAG_CACHE_PUBLIC, goto err);
^
563. if (!rsa->meth->bn_mod_exp(ret,f,d,rsa->n,ctx,
564. rsa->_method_mod_n))
crypto/bn/bn_mont.c:530:1: Parameter `ctx->stack.depth`
528. }
529.
530. > BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock,
531. const BIGNUM *mod, BN_CTX *ctx)
532. {
crypto/bn/bn_mont.c:546:16: Call
544. {
545. ret = BN_MONT_CTX_new();
546. if (ret && !BN_MONT_CTX_set(ret, mod, ctx))
^
547. BN_MONT_CTX_free(ret);
548. else
crypto/bn/bn_mont.c:412:1: Parameter `ctx->stack.depth`
410. }
411.
412. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
413. {
414. int ret = 0;
crypto/bn/bn_mont.c:417:2: Call
415. BIGNUM *Ri,*R;
416.
417. BN_CTX_start(ctx);
^
418. if((Ri = BN_CTX_get(ctx)) == NULL) goto err;
419. 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:473:8: Call
471. tmod.top = buf[0] != 0 ? 1 : 0;
472. /* Ri = R^-1 mod N*/
473. if ((BN_mod_inverse(Ri,R,&tmod,ctx)) == NULL)
^
474. goto err;
475. if (!BN_lshift(Ri,Ri,BN_BITS2)) goto err; /* R*Ri */
crypto/bn/bn_gcd.c:208:1: Parameter `ctx->stack.depth`
206. static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in,
207. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx);
208. > BIGNUM *BN_mod_inverse(BIGNUM *in,
209. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx)
210. {
crypto/bn/bn_gcd.c:217:10: Call
215. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0))
216. {
217. return BN_mod_inverse_no_branch(in, a, n, ctx);
^
218. }
219.
crypto/bn/bn_gcd.c:506:1: Parameter `ctx->stack.depth`
504. * It does not contain branches that may leak sensitive information.
505. */
506. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in,
507. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx)
508. {
crypto/bn/bn_gcd.c:518:2: Call
516. bn_check_top(n);
517.
518. BN_CTX_start(ctx);
^
519. A = BN_CTX_get(ctx);
520. 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:547:8: Call
545. pB = &local_B;
546. BN_with_flags(pB, B, BN_FLG_CONSTTIME);
547. if (!BN_nnmod(B, pB, A, ctx)) goto err;
^
548. }
549. 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. static int BN_div_no_branch(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num,
180. const BIGNUM *divisor, BN_CTX *ctx);
181. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
182. BN_CTX *ctx)
183. {
crypto/bn/bn_div.c:192:10: Call
190. if ((BN_get_flags(num, BN_FLG_CONSTTIME) != 0) || (BN_get_flags(divisor, BN_FLG_CONSTTIME) != 0))
191. {
192. return BN_div_no_branch(dv, rm, num, divisor, ctx);
^
193. }
194.
crypto/bn/bn_div.c:414:1: Parameter `ctx->stack.depth`
412. * branches that may leak sensitive information.
413. */
414. > static int BN_div_no_branch(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num,
415. const BIGNUM *divisor, BN_CTX *ctx)
416. {
crypto/bn/bn_div.c:434:2: Call
432. }
433.
434. BN_CTX_start(ctx);
^
435. tmp=BN_CTX_get(ctx);
436. 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:630:2: Call
628. }
629. bn_correct_top(res);
630. BN_CTX_end(ctx);
^
631. return(1);
632. err:
crypto/bn/bn_ctx.c:270:1: Parameter `ctx->stack.depth`
268. }
269.
270. > void BN_CTX_end(BN_CTX *ctx)
271. {
272. CTXDBG_ENTRY("BN_CTX_end", ctx);
crypto/bn/bn_ctx.c:277:21: Call
275. else
276. {
277. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
278. /* Does this stack frame have anything to release? */
279. if(fp < ctx->used)
crypto/bn/bn_ctx.c:351:1: <LHS trace>
349. }
350.
351. > static unsigned int BN_STACK_pop(BN_STACK *st)
352. {
353. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:351:1: Parameter `st->depth`
349. }
350.
351. > static unsigned int BN_STACK_pop(BN_STACK *st)
352. {
353. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:353:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set_locked`
351. static unsigned int BN_STACK_pop(BN_STACK *st)
352. {
353. return st->indexes[--(st->depth)];
^
354. }
355.
|
https://github.com/openssl/openssl/blob/56c7754cab3da9745e52e36b0bf998f8356fd6d5/crypto/bn/bn_ctx.c/#L353
|
d2a_code_trace_data_42662
|
static void mpegts_write_section(MpegTSSection *s, uint8_t *buf, int len)
{
unsigned int crc;
unsigned char packet[TS_PACKET_SIZE];
const unsigned char *buf_ptr;
unsigned char *q;
int first, b, len1, left;
crc = bswap_32(av_crc(av_crc_get_table(AV_CRC_32_IEEE), -1, buf, len - 4));
buf[len - 4] = (crc >> 24) & 0xff;
buf[len - 3] = (crc >> 16) & 0xff;
buf[len - 2] = (crc >> 8) & 0xff;
buf[len - 1] = (crc) & 0xff;
buf_ptr = buf;
while (len > 0) {
first = (buf == buf_ptr);
q = packet;
*q++ = 0x47;
b = (s->pid >> 8);
if (first)
b |= 0x40;
*q++ = b;
*q++ = s->pid;
s->cc = (s->cc + 1) & 0xf;
*q++ = 0x10 | s->cc;
if (first)
*q++ = 0;
len1 = TS_PACKET_SIZE - (q - packet);
if (len1 > len)
len1 = len;
memcpy(q, buf_ptr, len1);
q += len1;
left = TS_PACKET_SIZE - (q - packet);
if (left > 0)
memset(q, 0xff, left);
s->write_packet(s, packet);
buf_ptr += len1;
len -= len1;
}
}
libavformat/mpegtsenc.c:186: error: Buffer Overrun L2
Offset added: [5, 189] (⇐ [4, 5] + [1, 184]) Size: 188 by call to `mpegts_write_section1`.
libavformat/mpegtsenc.c:173:1: Array declaration
171. } MpegTSWrite;
172.
173. static void mpegts_write_pat(AVFormatContext *s)
^
174. {
175. MpegTSWrite *ts = s->priv_data;
libavformat/mpegtsenc.c:186:5: Call
184. put16(&q, 0xe000 | service->pmt.pid);
185. }
186. mpegts_write_section1(&ts->pat, PAT_TID, ts->tsid, 0, 0, 0,
^
187. data, q - data);
188. }
libavformat/mpegtsenc.c:93:1: Parameter `len`
91. }
92.
93. static int mpegts_write_section1(MpegTSSection *s, int tid, int id,
^
94. int version, int sec_num, int last_sec_num,
95. uint8_t *buf, int len)
libavformat/mpegtsenc.c:100:5: Assignment
98. unsigned int tot_len;
99.
100. tot_len = 3 + 5 + len + 4;
^
101. /* check if not too big */
102. if (tot_len > 1024)
libavformat/mpegtsenc.c:114:5: Call
112. memcpy(q, buf, len);
113.
114. mpegts_write_section(s, section, tot_len);
^
115. return 0;
116. }
libavformat/mpegtsenc.c:38:1: <Offset trace>
36.
37. /* NOTE: 4 bytes must be left at the end for the crc32 */
38. static void mpegts_write_section(MpegTSSection *s, uint8_t *buf, int len)
^
39. {
40. unsigned int crc;
libavformat/mpegtsenc.c:38:1: Parameter `len`
36.
37. /* NOTE: 4 bytes must be left at the end for the crc32 */
38. static void mpegts_write_section(MpegTSSection *s, uint8_t *buf, int len)
^
39. {
40. unsigned int crc;
libavformat/mpegtsenc.c:38:1: <Length trace>
36.
37. /* NOTE: 4 bytes must be left at the end for the crc32 */
38. static void mpegts_write_section(MpegTSSection *s, uint8_t *buf, int len)
^
39. {
40. unsigned int crc;
libavformat/mpegtsenc.c:38:1: Array declaration
36.
37. /* NOTE: 4 bytes must be left at the end for the crc32 */
38. static void mpegts_write_section(MpegTSSection *s, uint8_t *buf, int len)
^
39. {
40. unsigned int crc;
libavformat/mpegtsenc.c:56:9: Assignment
54. while (len > 0) {
55. first = (buf == buf_ptr);
56. q = packet;
^
57. *q++ = 0x47;
58. b = (s->pid >> 8);
libavformat/mpegtsenc.c:57:10: Assignment
55. first = (buf == buf_ptr);
56. q = packet;
57. *q++ = 0x47;
^
58. b = (s->pid >> 8);
59. if (first)
libavformat/mpegtsenc.c:61:10: Assignment
59. if (first)
60. b |= 0x40;
61. *q++ = b;
^
62. *q++ = s->pid;
63. s->cc = (s->cc + 1) & 0xf;
libavformat/mpegtsenc.c:62:10: Assignment
60. b |= 0x40;
61. *q++ = b;
62. *q++ = s->pid;
^
63. s->cc = (s->cc + 1) & 0xf;
64. *q++ = 0x10 | s->cc;
libavformat/mpegtsenc.c:64:10: Assignment
62. *q++ = s->pid;
63. s->cc = (s->cc + 1) & 0xf;
64. *q++ = 0x10 | s->cc;
^
65. if (first)
66. *q++ = 0; /* 0 offset */
libavformat/mpegtsenc.c:70:9: Array access: Offset added: [5, 189] (⇐ [4, 5] + [1, 184]) Size: 188 by call to `mpegts_write_section1`
68. if (len1 > len)
69. len1 = len;
70. memcpy(q, buf_ptr, len1);
^
71. q += len1;
72. /* add known padding data */
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/mpegtsenc.c/#L70
|
d2a_code_trace_data_42663
|
void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks)
#ifdef OPENSSL_FIPS
{
fips_cipher_abort(IDEA);
private_idea_set_encrypt_key(key, ks);
}
void private_idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks)
#endif
{
int i;
register IDEA_INT *kt,*kf,r0,r1,r2;
kt= &(ks->data[0][0]);
n2s(key,kt[0]); n2s(key,kt[1]); n2s(key,kt[2]); n2s(key,kt[3]);
n2s(key,kt[4]); n2s(key,kt[5]); n2s(key,kt[6]); n2s(key,kt[7]);
kf=kt;
kt+=8;
for (i=0; i<6; i++)
{
r2= kf[1];
r1= kf[2];
*(kt++)= ((r2<<9) | (r1>>7))&0xffff;
r0= kf[3];
*(kt++)= ((r1<<9) | (r0>>7))&0xffff;
r1= kf[4];
*(kt++)= ((r0<<9) | (r1>>7))&0xffff;
r0= kf[5];
*(kt++)= ((r1<<9) | (r0>>7))&0xffff;
r1= kf[6];
*(kt++)= ((r0<<9) | (r1>>7))&0xffff;
r0= kf[7];
*(kt++)= ((r1<<9) | (r0>>7))&0xffff;
r1= kf[0];
if (i >= 5) break;
*(kt++)= ((r0<<9) | (r1>>7))&0xffff;
*(kt++)= ((r1<<9) | (r2>>7))&0xffff;
kf+=8;
}
}
crypto/idea/i_skey.c:86: error: BUFFER_OVERRUN_L1
Offset: [8, +oo] Size: 6.
Showing all 5 steps of the trace
crypto/idea/i_skey.c:64:1: <Length trace>
62.
63. static IDEA_INT inverse(unsigned int xin);
64. > void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks)
65. #ifdef OPENSSL_FIPS
66. {
crypto/idea/i_skey.c:64:1: Parameter `ks->data[*][*]`
62.
63. static IDEA_INT inverse(unsigned int xin);
64. > void idea_set_encrypt_key(const unsigned char *key, IDEA_KEY_SCHEDULE *ks)
65. #ifdef OPENSSL_FIPS
66. {
crypto/idea/i_skey.c:76:2: Assignment
74. register IDEA_INT *kt,*kf,r0,r1,r2;
75.
76. kt= &(ks->data[0][0]);
^
77. n2s(key,kt[0]); n2s(key,kt[1]); n2s(key,kt[2]); n2s(key,kt[3]);
78. n2s(key,kt[4]); n2s(key,kt[5]); n2s(key,kt[6]); n2s(key,kt[7]);
crypto/idea/i_skey.c:81:2: Assignment
79.
80. kf=kt;
81. kt+=8;
^
82. for (i=0; i<6; i++)
83. {
crypto/idea/i_skey.c:86:3: Array access: Offset: [8, +oo] Size: 6
84. r2= kf[1];
85. r1= kf[2];
86. *(kt++)= ((r2<<9) | (r1>>7))&0xffff;
^
87. r0= kf[3];
88. *(kt++)= ((r1<<9) | (r0>>7))&0xffff;
|
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/idea/i_skey.c/#L86
|
d2a_code_trace_data_42664
|
static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr,
int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2],
int ref_mv_scale, int flags, int size, int h)
{
MotionEstContext * const c= &s->me;
int best[2]={0, 0};
int d;
int dmin;
int map_generation;
int penalty_factor;
const int ref_mv_stride= s->mb_stride;
const int ref_mv_xy= s->mb_x + s->mb_y*ref_mv_stride;
me_cmp_func cmpf, chroma_cmpf;
LOAD_COMMON
LOAD_COMMON2
if(c->pre_pass){
penalty_factor= c->pre_penalty_factor;
cmpf= s->dsp.me_pre_cmp[size];
chroma_cmpf= s->dsp.me_pre_cmp[size+1];
}else{
penalty_factor= c->penalty_factor;
cmpf= s->dsp.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1];
}
map_generation= update_map_generation(c);
assert(cmpf);
dmin= cmp(s, 0, 0, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);
map[0]= map_generation;
score_map[0]= dmin;
if((s->pict_type == FF_B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0)
dmin += (mv_penalty[pred_x] + mv_penalty[pred_y])*penalty_factor;
if (s->first_slice_line) {
CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
}else{
if(dmin<((h*h*s->avctx->mv0_threshold)>>8)
&& ( P_LEFT[0] |P_LEFT[1]
|P_TOP[0] |P_TOP[1]
|P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){
*mx_ptr= 0;
*my_ptr= 0;
c->skip=1;
return dmin;
}
CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift)
CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1)
CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1)
CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) )
CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) )
CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift)
CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift)
CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
}
if(dmin>h*h*4){
if(c->pre_pass){
CHECK_CLIPPED_MV((last_mv[ref_mv_xy-1][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy-1][1]*ref_mv_scale + (1<<15))>>16)
if(!s->first_slice_line)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy-ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy-ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
}else{
CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16)
if(s->mb_y+1<s->end_mb_y)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
}
}
if(c->avctx->last_predictor_count){
const int count= c->avctx->last_predictor_count;
const int xstart= FFMAX(0, s->mb_x - count);
const int ystart= FFMAX(0, s->mb_y - count);
const int xend= FFMIN(s->mb_width , s->mb_x + count + 1);
const int yend= FFMIN(s->mb_height, s->mb_y + count + 1);
int mb_y;
for(mb_y=ystart; mb_y<yend; mb_y++){
int mb_x;
for(mb_x=xstart; mb_x<xend; mb_x++){
const int xy= mb_x + 1 + (mb_y + 1)*ref_mv_stride;
int mx= (last_mv[xy][0]*ref_mv_scale + (1<<15))>>16;
int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16;
if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue;
CHECK_MV(mx,my)
}
}
}
dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
*mx_ptr= best[0];
*my_ptr= best[1];
return dmin;
}
libavcodec/motion_est_template.c:1065: error: Uninitialized Value
The value read from xmin was never initialized.
libavcodec/motion_est_template.c:1065:9:
1063. CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift)
1064. CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift)
1065. CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
^
1066. }
1067. if(dmin>h*h*4){
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1065
|
d2a_code_trace_data_42665
|
static int expand(OPENSSL_LHASH *lh)
{
OPENSSL_LH_NODE **n, **n1, **n2, *np;
unsigned int p, pmax, nni, j;
unsigned long hash;
nni = lh->num_alloc_nodes;
p = lh->p;
pmax = lh->pmax;
if (p + 1 >= pmax) {
j = nni * 2;
n = OPENSSL_realloc(lh->b, sizeof(OPENSSL_LH_NODE *) * j);
if (n == NULL) {
lh->error++;
return 0;
}
lh->b = n;
memset(n + nni, 0, sizeof(*n) * (j - nni));
lh->pmax = nni;
lh->num_alloc_nodes = j;
lh->num_expand_reallocs++;
lh->p = 0;
} else {
lh->p++;
}
lh->num_nodes++;
lh->num_expands++;
n1 = &(lh->b[p]);
n2 = &(lh->b[p + pmax]);
*n2 = NULL;
for (np = *n1; np != NULL;) {
hash = np->hash;
if ((hash % nni) != p) {
*n1 = (*n1)->next;
np->next = *n2;
*n2 = np;
} else
n1 = &((*n1)->next);
np = *n1;
}
return 1;
}
test/sslapitest.c:4157: error: BUFFER_OVERRUN_L3
Offset added: [272, +oo] (⇐ [16, +oo] + [256, +oo]) Size: [1, +oo] by call to `TXT_DB_insert`.
Showing all 24 steps of the trace
test/sslapitest.c:4133:12: Call
4131. goto end;
4132.
4133. gNid = SRP_create_verifier(userid, password, &row[DB_srpsalt],
^
4134. &row[DB_srpverifier], NULL, NULL);
4135. if (!TEST_ptr(gNid))
crypto/srp/srp_vfy.c:627:10: Call
625. }
626.
627. if (!SRP_create_verifier_BN(user, pass, &s, &v, N_bn, g_bn))
^
628. goto err;
629.
crypto/srp/srp_vfy.c:693:9: Call
691. }
692.
693. x = SRP_Calc_x(salttmp, user, pass);
^
694.
695. *verifier = BN_new();
crypto/srp/srp_lib.c:135:10: Call
133. goto err;
134.
135. if (!EVP_DigestInit_ex(ctxt, EVP_sha1(), NULL)
^
136. || !EVP_DigestUpdate(ctxt, user, strlen(user))
137. || !EVP_DigestUpdate(ctxt, ":", 1)
crypto/evp/digest.c:88:20: Call
86. } else {
87. /* Ask if an ENGINE is reserved for this job */
88. impl = ENGINE_get_digest_engine(type->type);
^
89. }
90. if (impl != NULL) {
crypto/engine/tb_digest.c:65:12: Call
63. ENGINE *ENGINE_get_digest_engine(int nid)
64. {
65. return engine_table_select(&digest_table, nid);
^
66. }
67.
crypto/engine/eng_table.c:216:10: Call
214. * operations. But don't worry about a fprintf(stderr).
215. */
216. if (!int_table_check(table, 0))
^
217. goto end;
218. tmplate.nid = nid;
crypto/engine/eng_table.c:72:15: Call
70. if (!create)
71. return 0;
72. if ((lh = lh_ENGINE_PILE_new(engine_pile_hash, engine_pile_cmp)) == NULL)
^
73. return 0;
74. *t = (ENGINE_TABLE *)lh;
crypto/engine/eng_int.h:169:1: Call
167. typedef struct st_engine_pile ENGINE_PILE;
168.
169. > DEFINE_LHASH_OF(ENGINE_PILE);
170.
171. #endif /* HEADER_ENGINE_INT_H */
crypto/lhash/lhash.c:62:5: Assignment
60. ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h);
61. ret->num_nodes = MIN_NODES / 2;
62. ret->num_alloc_nodes = MIN_NODES;
^
63. ret->pmax = MIN_NODES / 2;
64. ret->up_load = UP_LOAD;
test/sslapitest.c:4157:17: Call
4155. || !TEST_ptr(row[DB_srptype])
4156. || !TEST_ptr(row[DB_srpgN])
4157. || !TEST_true(TXT_DB_insert(db, row)))
^
4158. goto end;
4159.
crypto/txt_db/txt_db.c:237:1: Parameter `(*db->index)->num_alloc_nodes`
235. }
236.
237. > int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *row)
238. {
239. int i;
crypto/txt_db/txt_db.c:260:19: Call
258. if ((db->qual[i] != NULL) && (db->qual[i] (row) == 0))
259. continue;
260. (void)lh_OPENSSL_STRING_insert(db->index[i], row);
^
261. if (lh_OPENSSL_STRING_retrieve(db->index[i], row) == NULL)
262. goto err1;
include/openssl/lhash.h:197:1: Parameter `lh->num_alloc_nodes`
195. LHASH_OF(type)
196.
197. > DEFINE_LHASH_OF(OPENSSL_STRING);
198. # ifdef _MSC_VER
199. /*
include/openssl/lhash.h:197:1: Call
195. LHASH_OF(type)
196.
197. > DEFINE_LHASH_OF(OPENSSL_STRING);
198. # ifdef _MSC_VER
199. /*
crypto/lhash/lhash.c:94:1: Parameter `lh->num_alloc_nodes`
92. }
93.
94. > void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data)
95. {
96. unsigned long hash;
crypto/lhash/lhash.c:101:77: Call
99.
100. lh->error = 0;
101. if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh))
^
102. return NULL; /* 'lh->error++' already done in 'expand' */
103.
crypto/lhash/lhash.c:210:1: <Offset trace>
208. }
209.
210. > static int expand(OPENSSL_LHASH *lh)
211. {
212. OPENSSL_LH_NODE **n, **n1, **n2, *np;
crypto/lhash/lhash.c:210:1: Parameter `lh->num_alloc_nodes`
208. }
209.
210. > static int expand(OPENSSL_LHASH *lh)
211. {
212. OPENSSL_LH_NODE **n, **n1, **n2, *np;
crypto/lhash/lhash.c:216:5: Assignment
214. unsigned long hash;
215.
216. nni = lh->num_alloc_nodes;
^
217. p = lh->p;
218. pmax = lh->pmax;
crypto/lhash/lhash.c:210:1: <Length trace>
208. }
209.
210. > static int expand(OPENSSL_LHASH *lh)
211. {
212. OPENSSL_LH_NODE **n, **n1, **n2, *np;
crypto/lhash/lhash.c:210:1: Parameter `lh->num_alloc_nodes`
208. }
209.
210. > static int expand(OPENSSL_LHASH *lh)
211. {
212. OPENSSL_LH_NODE **n, **n1, **n2, *np;
crypto/lhash/lhash.c:216:5: Assignment
214. unsigned long hash;
215.
216. nni = lh->num_alloc_nodes;
^
217. p = lh->p;
218. pmax = lh->pmax;
crypto/lhash/lhash.c:227:9: Array access: Offset added: [272, +oo] (⇐ [16, +oo] + [256, +oo]) Size: [1, +oo] by call to `TXT_DB_insert`
225. }
226. lh->b = n;
227. memset(n + nni, 0, sizeof(*n) * (j - nni));
^
228. lh->pmax = nni;
229. lh->num_alloc_nodes = j;
|
https://github.com/openssl/openssl/blob/eaf39a9fe6f55feb5251e235069e02f7f50d9a49/crypto/lhash/lhash.c/#L227
|
d2a_code_trace_data_42666
|
int ssl3_get_cert_verify(SSL *s)
{
EVP_PKEY *pkey = NULL;
unsigned char *sig, *data;
int al, ok, ret = 0;
long n;
int type = 0, i, j;
unsigned int len;
X509 *peer;
const EVP_MD *md = NULL;
EVP_MD_CTX mctx;
PACKET pkt;
EVP_MD_CTX_init(&mctx);
if (s->session->peer == NULL) {
ret = 1;
goto end;
}
n = s->method->ssl_get_message(s,
SSL3_ST_SR_CERT_VRFY_A,
SSL3_ST_SR_CERT_VRFY_B,
SSL3_MT_CERTIFICATE_VERIFY,
SSL3_RT_MAX_PLAIN_LENGTH, &ok);
if (!ok)
return ((int)n);
peer = s->session->peer;
pkey = X509_get_pubkey(peer);
type = X509_certificate_type(peer, pkey);
if (!(type & EVP_PKT_SIGN)) {
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,
SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE);
al = SSL_AD_ILLEGAL_PARAMETER;
goto f_err;
}
if (!PACKET_buf_init(&pkt, s->init_msg, n)) {
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR);
al = SSL_AD_INTERNAL_ERROR;
goto f_err;
}
if (n == 64 && pkey->type == NID_id_GostR3410_2001) {
len = 64;
} else {
if (SSL_USE_SIGALGS(s)) {
int rv;
if (!PACKET_get_bytes(&pkt, &sig, 2)) {
al = SSL_AD_DECODE_ERROR;
goto f_err;
}
rv = tls12_check_peer_sigalg(&md, s, sig, pkey);
if (rv == -1) {
al = SSL_AD_INTERNAL_ERROR;
goto f_err;
} else if (rv == 0) {
al = SSL_AD_DECODE_ERROR;
goto f_err;
}
#ifdef SSL_DEBUG
fprintf(stderr, "USING TLSv1.2 HASH %s\n", EVP_MD_name(md));
#endif
}
if (!PACKET_get_net_2(&pkt, &len)) {
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_LENGTH_MISMATCH);
al = SSL_AD_DECODE_ERROR;
goto f_err;
}
}
j = EVP_PKEY_size(pkey);
if (((int)len > j) || ((int)PACKET_remaining(&pkt) > j) || (n <= 0)) {
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_WRONG_SIGNATURE_SIZE);
al = SSL_AD_DECODE_ERROR;
goto f_err;
}
if (!PACKET_get_bytes(&pkt, &data, len)) {
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_LENGTH_MISMATCH);
al = SSL_AD_DECODE_ERROR;
goto f_err;
}
if (SSL_USE_SIGALGS(s)) {
long hdatalen = 0;
void *hdata;
hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata);
if (hdatalen <= 0) {
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR);
al = SSL_AD_INTERNAL_ERROR;
goto f_err;
}
#ifdef SSL_DEBUG
fprintf(stderr, "Using TLS 1.2 with client verify alg %s\n",
EVP_MD_name(md));
#endif
if (!EVP_VerifyInit_ex(&mctx, md, NULL)
|| !EVP_VerifyUpdate(&mctx, hdata, hdatalen)) {
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_EVP_LIB);
al = SSL_AD_INTERNAL_ERROR;
goto f_err;
}
if (EVP_VerifyFinal(&mctx, data, len, pkey) <= 0) {
al = SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_SIGNATURE);
goto f_err;
}
} else
#ifndef OPENSSL_NO_RSA
if (pkey->type == EVP_PKEY_RSA) {
i = RSA_verify(NID_md5_sha1, s->s3->tmp.cert_verify_md,
MD5_DIGEST_LENGTH + SHA_DIGEST_LENGTH, data, len,
pkey->pkey.rsa);
if (i < 0) {
al = SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_RSA_DECRYPT);
goto f_err;
}
if (i == 0) {
al = SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_RSA_SIGNATURE);
goto f_err;
}
} else
#endif
#ifndef OPENSSL_NO_DSA
if (pkey->type == EVP_PKEY_DSA) {
j = DSA_verify(pkey->save_type,
&(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]),
SHA_DIGEST_LENGTH, data, len, pkey->pkey.dsa);
if (j <= 0) {
al = SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_DSA_SIGNATURE);
goto f_err;
}
} else
#endif
#ifndef OPENSSL_NO_EC
if (pkey->type == EVP_PKEY_EC) {
j = ECDSA_verify(pkey->save_type,
&(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]),
SHA_DIGEST_LENGTH, data, len, pkey->pkey.ec);
if (j <= 0) {
al = SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE);
goto f_err;
}
} else
#endif
if (pkey->type == NID_id_GostR3410_2001) {
unsigned char signature[64];
int idx;
EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new(pkey, NULL);
EVP_PKEY_verify_init(pctx);
if (len != 64) {
fprintf(stderr, "GOST signature length is %d", len);
}
for (idx = 0; idx < 64; idx++) {
signature[63 - idx] = data[idx];
}
j = EVP_PKEY_verify(pctx, signature, 64, s->s3->tmp.cert_verify_md,
32);
EVP_PKEY_CTX_free(pctx);
if (j <= 0) {
al = SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE);
goto f_err;
}
} else {
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR);
al = SSL_AD_UNSUPPORTED_CERTIFICATE;
goto f_err;
}
ret = 1;
if (0) {
f_err:
ssl3_send_alert(s, SSL3_AL_FATAL, al);
s->state = SSL_ST_ERR;
}
end:
BIO_free(s->s3->handshake_buffer);
s->s3->handshake_buffer = NULL;
EVP_MD_CTX_cleanup(&mctx);
EVP_PKEY_free(pkey);
return (ret);
}
ssl/s3_srvr.c:2934: error: NULL_DEREFERENCE
pointer `pkey` last assigned on line 2913 could be null and is dereferenced at line 2934, column 20.
Showing all 34 steps of the trace
ssl/s3_srvr.c:2876:1: start of procedure ssl3_get_cert_verify()
2874. }
2875.
2876. > int ssl3_get_cert_verify(SSL *s)
2877. {
2878. EVP_PKEY *pkey = NULL;
ssl/s3_srvr.c:2878:5:
2876. int ssl3_get_cert_verify(SSL *s)
2877. {
2878. > EVP_PKEY *pkey = NULL;
2879. unsigned char *sig, *data;
2880. int al, ok, ret = 0;
ssl/s3_srvr.c:2880:5:
2878. EVP_PKEY *pkey = NULL;
2879. unsigned char *sig, *data;
2880. > int al, ok, ret = 0;
2881. long n;
2882. int type = 0, i, j;
ssl/s3_srvr.c:2882:5:
2880. int al, ok, ret = 0;
2881. long n;
2882. > int type = 0, i, j;
2883. unsigned int len;
2884. X509 *peer;
ssl/s3_srvr.c:2885:5:
2883. unsigned int len;
2884. X509 *peer;
2885. > const EVP_MD *md = NULL;
2886. EVP_MD_CTX mctx;
2887. PACKET pkt;
ssl/s3_srvr.c:2888:5:
2886. EVP_MD_CTX mctx;
2887. PACKET pkt;
2888. > EVP_MD_CTX_init(&mctx);
2889.
2890. /*
crypto/evp/digest.c:120:1: start of procedure EVP_MD_CTX_init()
118. #endif
119.
120. > void EVP_MD_CTX_init(EVP_MD_CTX *ctx)
121. {
122. memset(ctx, 0, sizeof(*ctx));
crypto/evp/digest.c:122:5:
120. void EVP_MD_CTX_init(EVP_MD_CTX *ctx)
121. {
122. > memset(ctx, 0, sizeof(*ctx));
123. }
124.
crypto/evp/digest.c:123:1: return from a call to EVP_MD_CTX_init
121. {
122. memset(ctx, 0, sizeof(*ctx));
123. > }
124.
125. EVP_MD_CTX *EVP_MD_CTX_create(void)
ssl/s3_srvr.c:2898:9: Taking false branch
2896. * CertificateVerify state so we should not arrive here.
2897. */
2898. if (s->session->peer == NULL) {
^
2899. ret = 1;
2900. goto end;
ssl/s3_srvr.c:2903:5: Skipping __function_pointer__(): unresolved function pointer
2901. }
2902.
2903. n = s->method->ssl_get_message(s,
^
2904. SSL3_ST_SR_CERT_VRFY_A,
2905. SSL3_ST_SR_CERT_VRFY_B,
ssl/s3_srvr.c:2909:10: Taking false branch
2907. SSL3_RT_MAX_PLAIN_LENGTH, &ok);
2908.
2909. if (!ok)
^
2910. return ((int)n);
2911.
ssl/s3_srvr.c:2912:5:
2910. return ((int)n);
2911.
2912. > peer = s->session->peer;
2913. pkey = X509_get_pubkey(peer);
2914. type = X509_certificate_type(peer, pkey);
ssl/s3_srvr.c:2913:5:
2911.
2912. peer = s->session->peer;
2913. > pkey = X509_get_pubkey(peer);
2914. type = X509_certificate_type(peer, pkey);
2915.
crypto/x509/x509_cmp.c:307:1: start of procedure X509_get_pubkey()
305. }
306.
307. > EVP_PKEY *X509_get_pubkey(X509 *x)
308. {
309. if ((x == NULL) || (x->cert_info == NULL))
crypto/x509/x509_cmp.c:309:10: Taking false branch
307. EVP_PKEY *X509_get_pubkey(X509 *x)
308. {
309. if ((x == NULL) || (x->cert_info == NULL))
^
310. return (NULL);
311. return (X509_PUBKEY_get(x->cert_info->key));
crypto/x509/x509_cmp.c:309:25: Taking true branch
307. EVP_PKEY *X509_get_pubkey(X509 *x)
308. {
309. if ((x == NULL) || (x->cert_info == NULL))
^
310. return (NULL);
311. return (X509_PUBKEY_get(x->cert_info->key));
crypto/x509/x509_cmp.c:310:9:
308. {
309. if ((x == NULL) || (x->cert_info == NULL))
310. > return (NULL);
311. return (X509_PUBKEY_get(x->cert_info->key));
312. }
crypto/x509/x509_cmp.c:312:1: return from a call to X509_get_pubkey
310. return (NULL);
311. return (X509_PUBKEY_get(x->cert_info->key));
312. > }
313.
314. ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x)
ssl/s3_srvr.c:2914:5: Skipping X509_certificate_type(): empty list of specs
2912. peer = s->session->peer;
2913. pkey = X509_get_pubkey(peer);
2914. type = X509_certificate_type(peer, pkey);
^
2915.
2916. if (!(type & EVP_PKT_SIGN)) {
ssl/s3_srvr.c:2916:11: Taking false branch
2914. type = X509_certificate_type(peer, pkey);
2915.
2916. if (!(type & EVP_PKT_SIGN)) {
^
2917. SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,
2918. SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE);
ssl/s3_srvr.c:2924:10:
2922.
2923. /* we now have a signature that we need to verify */
2924. > if (!PACKET_buf_init(&pkt, s->init_msg, n)) {
2925. SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR);
2926. al = SSL_AD_INTERNAL_ERROR;
ssl/packet_locl.h:95:1: start of procedure PACKET_buf_init()
93. * is being used.
94. */
95. > static inline int PACKET_buf_init(PACKET *pkt, unsigned char *buf, size_t len)
96. {
97. pkt->start = pkt->curr = buf;
ssl/packet_locl.h:97:5:
95. static inline int PACKET_buf_init(PACKET *pkt, unsigned char *buf, size_t len)
96. {
97. > pkt->start = pkt->curr = buf;
98. pkt->end = pkt->start + len;
99.
ssl/packet_locl.h:98:5:
96. {
97. pkt->start = pkt->curr = buf;
98. > pkt->end = pkt->start + len;
99.
100. /* Sanity checks */
ssl/packet_locl.h:101:9: Taking false branch
99.
100. /* Sanity checks */
101. if (pkt->start > pkt->end
^
102. || pkt->curr < pkt->start
103. || pkt->curr > pkt->end
ssl/packet_locl.h:102:16: Taking false branch
100. /* Sanity checks */
101. if (pkt->start > pkt->end
102. || pkt->curr < pkt->start
^
103. || pkt->curr > pkt->end
104. || len != (size_t)(pkt->end - pkt->start)) {
ssl/packet_locl.h:103:16: Taking false branch
101. if (pkt->start > pkt->end
102. || pkt->curr < pkt->start
103. || pkt->curr > pkt->end
^
104. || len != (size_t)(pkt->end - pkt->start)) {
105. return 0;
ssl/packet_locl.h:104:16: Taking false branch
102. || pkt->curr < pkt->start
103. || pkt->curr > pkt->end
104. || len != (size_t)(pkt->end - pkt->start)) {
^
105. return 0;
106. }
ssl/packet_locl.h:108:5:
106. }
107.
108. > return 1;
109. }
110.
ssl/packet_locl.h:109:1: return from a call to PACKET_buf_init
107.
108. return 1;
109. > }
110.
111. /*
ssl/s3_srvr.c:2924:10: Taking false branch
2922.
2923. /* we now have a signature that we need to verify */
2924. if (!PACKET_buf_init(&pkt, s->init_msg, n)) {
^
2925. SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR);
2926. al = SSL_AD_INTERNAL_ERROR;
ssl/s3_srvr.c:2934:9: Taking true branch
2932. * length field
2933. */
2934. if (n == 64 && pkey->type == NID_id_GostR3410_2001) {
^
2935. len = 64;
2936. } else {
ssl/s3_srvr.c:2934:20:
2932. * length field
2933. */
2934. > if (n == 64 && pkey->type == NID_id_GostR3410_2001) {
2935. len = 64;
2936. } else {
|
https://github.com/openssl/openssl/blob/eb647452eb73be491521980f45582c63f7194521/ssl/s3_srvr.c/#L2934
|
d2a_code_trace_data_42667
|
void CRYPTO_free(void *str, const char *file, int line)
{
if (free_impl != NULL && free_impl != &CRYPTO_free) {
free_impl(str, file, line);
return;
}
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
if (call_malloc_debug) {
CRYPTO_mem_debug_free(str, 0, file, line);
free(str);
CRYPTO_mem_debug_free(str, 1, file, line);
} else {
free(str);
}
#else
free(str);
#endif
}
crypto/asn1/asn_mime.c:409: error: USE_AFTER_FREE
call to `sk_BIO_pop_free()` eventually accesses memory that was invalidated by call to `free()` on line 405 indirectly during the call to `multi_split()`.
Showing all 29 steps of the trace
crypto/asn1/asn_mime.c:374:5: invalidation part of the trace starts here
372. BIO *asnin;
373. STACK_OF(MIME_HEADER) *headers = NULL;
374. STACK_OF(BIO) *parts = NULL;
^
375. MIME_HEADER *hdr;
376. MIME_PARAM *prm;
crypto/asn1/asn_mime.c:374:5: variable `parts` declared here
372. BIO *asnin;
373. STACK_OF(MIME_HEADER) *headers = NULL;
374. STACK_OF(BIO) *parts = NULL;
^
375. MIME_HEADER *hdr;
376. MIME_PARAM *prm;
crypto/asn1/asn_mime.c:405:15: when calling `multi_split` here
403. return NULL;
404. }
405. ret = multi_split(bio, prm->param_value, &parts);
^
406. sk_MIME_HEADER_pop_free(headers, mime_hdr_free);
407. if (!ret || (sk_BIO_num(parts) != 2)) {
crypto/asn1/asn_mime.c:573:13: passed as argument to `sk_BIO_new_null`
571. state = 0;
572. first = 1;
573. parts = sk_BIO_new_null();
^
574. *ret = parts;
575. if (*ret == NULL)
crypto/asn1/asn_mime.c:573:13: return from call to `sk_BIO_new_null`
571. state = 0;
572. first = 1;
573. parts = sk_BIO_new_null();
^
574. *ret = parts;
575. if (*ret == NULL)
crypto/asn1/asn_mime.c:573:5: assigned
571. state = 0;
572. first = 1;
573. parts = sk_BIO_new_null();
^
574. *ret = parts;
575. if (*ret == NULL)
crypto/asn1/asn_mime.c:583:18: when calling `sk_BIO_push` here
581. part++;
582. } else if (state == 2) {
583. if (!sk_BIO_push(parts, bpart)) {
^
584. BIO_free(bpart);
585. return 0;
include/openssl/bio.h:260:1: parameter `sk` of sk_BIO_push
258. typedef void bio_info_cb(BIO *, int, const char *, int, long, long);
259.
260. > DEFINE_STACK_OF(BIO)
261.
262. /* Prefix and suffix callback in ASN1 BIO */
include/openssl/bio.h:260:1: when calling `OPENSSL_sk_push` here
258. typedef void bio_info_cb(BIO *, int, const char *, int, long, long);
259.
260. > DEFINE_STACK_OF(BIO)
261.
262. /* Prefix and suffix callback in ASN1 BIO */
crypto/stack/stack.c:307:1: parameter `st` of OPENSSL_sk_push
305. }
306.
307. > int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data)
308. {
309. if (st == NULL)
crypto/stack/stack.c:311:12: when calling `OPENSSL_sk_insert` here
309. if (st == NULL)
310. return -1;
311. return OPENSSL_sk_insert(st, data, st->num);
^
312. }
313.
crypto/stack/stack.c:222:1: parameter `st` of OPENSSL_sk_insert
220. }
221.
222. > int OPENSSL_sk_insert(OPENSSL_STACK *st, const void *data, int loc)
223. {
224. if (st == NULL || st->num < 0 || st->num == max_nodes)
crypto/stack/stack.c:227:10: when calling `sk_reserve` here
225. return 0;
226.
227. if (!sk_reserve(st, 1, 0))
^
228. return 0;
229.
crypto/stack/stack.c:166:1: parameter `st` of sk_reserve
164.
165. /* internal STACK storage allocation */
166. > static int sk_reserve(OPENSSL_STACK *st, int n, int exact)
167. {
168. const void **tmpdata;
crypto/stack/stack.c:203:15: when calling `CRYPTO_realloc` here
201. }
202.
203. tmpdata = OPENSSL_realloc((void *)st->data, sizeof(void *) * num_alloc);
^
204. if (tmpdata == NULL)
205. return 0;
crypto/mem.c:208:1: parameter `str` of CRYPTO_realloc
206. }
207.
208. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
209. {
210. if (realloc_impl != NULL && realloc_impl != &CRYPTO_realloc)
crypto/mem.c:218:9: when calling `CRYPTO_free` here
216.
217. if (num == 0) {
218. CRYPTO_free(str, file, line);
^
219. return NULL;
220. }
crypto/mem.c:265:1: parameter `str` of CRYPTO_free
263. }
264.
265. > void CRYPTO_free(void *str, const char *file, int line)
266. {
267. if (free_impl != NULL && free_impl != &CRYPTO_free) {
crypto/mem.c:281:5: was invalidated by call to `free()`
279. }
280. #else
281. free(str);
^
282. #endif
283. }
crypto/asn1/asn_mime.c:374:5: use-after-lifetime part of the trace starts here
372. BIO *asnin;
373. STACK_OF(MIME_HEADER) *headers = NULL;
374. STACK_OF(BIO) *parts = NULL;
^
375. MIME_HEADER *hdr;
376. MIME_PARAM *prm;
crypto/asn1/asn_mime.c:374:5: variable `parts` declared here
372. BIO *asnin;
373. STACK_OF(MIME_HEADER) *headers = NULL;
374. STACK_OF(BIO) *parts = NULL;
^
375. MIME_HEADER *hdr;
376. MIME_PARAM *prm;
crypto/asn1/asn_mime.c:405:15: passed as argument to `multi_split`
403. return NULL;
404. }
405. ret = multi_split(bio, prm->param_value, &parts);
^
406. sk_MIME_HEADER_pop_free(headers, mime_hdr_free);
407. if (!ret || (sk_BIO_num(parts) != 2)) {
crypto/asn1/asn_mime.c:573:13: passed as argument to `sk_BIO_new_null`
571. state = 0;
572. first = 1;
573. parts = sk_BIO_new_null();
^
574. *ret = parts;
575. if (*ret == NULL)
crypto/asn1/asn_mime.c:573:13: return from call to `sk_BIO_new_null`
571. state = 0;
572. first = 1;
573. parts = sk_BIO_new_null();
^
574. *ret = parts;
575. if (*ret == NULL)
crypto/asn1/asn_mime.c:573:5: assigned
571. state = 0;
572. first = 1;
573. parts = sk_BIO_new_null();
^
574. *ret = parts;
575. if (*ret == NULL)
crypto/asn1/asn_mime.c:405:15: return from call to `multi_split`
403. return NULL;
404. }
405. ret = multi_split(bio, prm->param_value, &parts);
^
406. sk_MIME_HEADER_pop_free(headers, mime_hdr_free);
407. if (!ret || (sk_BIO_num(parts) != 2)) {
crypto/asn1/asn_mime.c:409:13: when calling `sk_BIO_pop_free` here
407. if (!ret || (sk_BIO_num(parts) != 2)) {
408. ASN1err(ASN1_F_SMIME_READ_ASN1, ASN1_R_NO_MULTIPART_BODY_FAILURE);
409. sk_BIO_pop_free(parts, BIO_vfree);
^
410. return NULL;
411. }
crypto/mem.c:265:1: parameter `str` of CRYPTO_free
263. }
264.
265. > void CRYPTO_free(void *str, const char *file, int line)
266. {
267. if (free_impl != NULL && free_impl != &CRYPTO_free) {
crypto/mem.c:281:5: invalid access occurs here
279. }
280. #else
281. free(str);
^
282. #endif
283. }
|
https://github.com/openssl/openssl/blob/270a4bba49849de7f928f4fab186205abd132411/crypto/mem.c/#L281
|
d2a_code_trace_data_42668
|
void av_close_input_stream(AVFormatContext *s)
{
int i;
AVStream *st;
if (s->cur_st && s->cur_st->parser)
av_free_packet(&s->cur_pkt);
if (s->iformat->read_close)
s->iformat->read_close(s);
for(i=0;i<s->nb_streams;i++) {
st = s->streams[i];
if (st->parser) {
av_parser_close(st->parser);
}
av_free(st->index_entries);
av_free(st->codec->extradata);
av_free(st->codec);
av_free(st->filename);
av_free(st);
}
for(i=s->nb_programs-1; i>=0; i--) {
av_freep(&s->programs[i]->provider_name);
av_freep(&s->programs[i]->name);
av_freep(&s->programs[i]->stream_index);
av_freep(&s->programs[i]);
}
flush_packet_queue(s);
av_freep(&s->priv_data);
av_free(s);
}
ffmpeg.c:395: error: Integer Overflow L2
([0, +oo] - 1):unsigned32 by call to `av_close_input_file`.
ffmpeg.c:379:11: Call
377. AVFormatContext *ic;
378.
379. err = av_open_input_file(&ic, filename, NULL, FFM_PACKET_SIZE, NULL);
^
380. if (err < 0)
381. return err;
libavformat/utils.c:416:1: Parameter `(*ic_ptr)->filename.strlen`
414. #define PROBE_BUF_MAX (1<<20)
415.
416. int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
^
417. AVInputFormat *fmt,
418. int buf_size,
ffmpeg.c:395:5: Call
393. }
394.
395. av_close_input_file(ic);
^
396. return 0;
397. }
libavformat/utils.c:2152:1: Parameter `s->nb_programs`
2150. }
2151.
2152. void av_close_input_file(AVFormatContext *s)
^
2153. {
2154. ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb;
libavformat/utils.c:2155:5: Call
2153. {
2154. ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb;
2155. av_close_input_stream(s);
^
2156. if (pb)
2157. url_fclose(pb);
libavformat/utils.c:2118:1: <LHS trace>
2116. }
2117.
2118. void av_close_input_stream(AVFormatContext *s)
^
2119. {
2120. int i;
libavformat/utils.c:2118:1: Parameter `s->nb_programs`
2116. }
2117.
2118. void av_close_input_stream(AVFormatContext *s)
^
2119. {
2120. int i;
libavformat/utils.c:2141:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `av_close_input_file`
2139. av_free(st);
2140. }
2141. for(i=s->nb_programs-1; i>=0; i--) {
^
2142. av_freep(&s->programs[i]->provider_name);
2143. av_freep(&s->programs[i]->name);
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/utils.c/#L2141
|
d2a_code_trace_data_42669
|
ImgReSampleContext *img_resample_full_init(int owidth, int oheight,
int iwidth, int iheight,
int topBand, int bottomBand,
int leftBand, int rightBand,
int padtop, int padbottom,
int padleft, int padright)
{
ImgReSampleContext *s;
if (!owidth || !oheight || !iwidth || !iheight)
return NULL;
s = av_mallocz(sizeof(ImgReSampleContext));
if (!s)
return NULL;
if((unsigned)owidth >= UINT_MAX / (LINE_BUF_HEIGHT + NB_TAPS))
return NULL;
s->line_buf = av_mallocz(owidth * (LINE_BUF_HEIGHT + NB_TAPS));
if (!s->line_buf)
goto fail;
s->owidth = owidth;
s->oheight = oheight;
s->iwidth = iwidth;
s->iheight = iheight;
s->topBand = topBand;
s->bottomBand = bottomBand;
s->leftBand = leftBand;
s->rightBand = rightBand;
s->padtop = padtop;
s->padbottom = padbottom;
s->padleft = padleft;
s->padright = padright;
s->pad_owidth = owidth - (padleft + padright);
s->pad_oheight = oheight - (padtop + padbottom);
s->h_incr = ((iwidth - leftBand - rightBand) * POS_FRAC) / s->pad_owidth;
s->v_incr = ((iheight - topBand - bottomBand) * POS_FRAC) / s->pad_oheight;
av_build_filter(&s->h_filters[0][0], (float) s->pad_owidth /
(float) (iwidth - leftBand - rightBand), NB_TAPS, NB_PHASES, 1<<FILTER_BITS, 0);
av_build_filter(&s->v_filters[0][0], (float) s->pad_oheight /
(float) (iheight - topBand - bottomBand), NB_TAPS, NB_PHASES, 1<<FILTER_BITS, 0);
return s;
fail:
av_free(s);
return NULL;
}
libavcodec/imgresample.c:451: error: Integer Overflow L2
([`owidth`, min(214748363, `owidth`)] × 20):signed32.
libavcodec/imgresample.c:434:1: <LHS trace>
432. }
433.
434. ImgReSampleContext *img_resample_full_init(int owidth, int oheight,
^
435. int iwidth, int iheight,
436. int topBand, int bottomBand,
libavcodec/imgresample.c:434:1: Parameter `owidth`
432. }
433.
434. ImgReSampleContext *img_resample_full_init(int owidth, int oheight,
^
435. int iwidth, int iheight,
436. int topBand, int bottomBand,
libavcodec/imgresample.c:451:19: Binary operation: ([owidth, min(214748363, owidth)] × 20):signed32
449. if((unsigned)owidth >= UINT_MAX / (LINE_BUF_HEIGHT + NB_TAPS))
450. return NULL;
451. s->line_buf = av_mallocz(owidth * (LINE_BUF_HEIGHT + NB_TAPS));
^
452. if (!s->line_buf)
453. goto fail;
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/imgresample.c/#L451
|
d2a_code_trace_data_42670
|
u_char *
ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
{
u_char *p, zero, *last;
int d;
float f, scale;
size_t len, slen;
int64_t i64;
uint64_t ui64;
ngx_msec_t ms;
ngx_uint_t width, sign, hex, max_width, frac_width, i;
ngx_str_t *v;
ngx_variable_value_t *vv;
if (max == 0) {
return buf;
}
last = buf + max;
while (*fmt && buf < last) {
if (*fmt == '%') {
i64 = 0;
ui64 = 0;
zero = (u_char) ((*++fmt == '0') ? '0' : ' ');
width = 0;
sign = 1;
hex = 0;
max_width = 0;
frac_width = 0;
slen = (size_t) -1;
while (*fmt >= '0' && *fmt <= '9') {
width = width * 10 + *fmt++ - '0';
}
for ( ;; ) {
switch (*fmt) {
case 'u':
sign = 0;
fmt++;
continue;
case 'm':
max_width = 1;
fmt++;
continue;
case 'X':
hex = 2;
sign = 0;
fmt++;
continue;
case 'x':
hex = 1;
sign = 0;
fmt++;
continue;
case '.':
fmt++;
while (*fmt >= '0' && *fmt <= '9') {
frac_width = frac_width * 10 + *fmt++ - '0';
}
break;
case '*':
slen = va_arg(args, size_t);
fmt++;
continue;
default:
break;
}
break;
}
switch (*fmt) {
case 'V':
v = va_arg(args, ngx_str_t *);
len = v->len;
len = (buf + len < last) ? len : (size_t) (last - buf);
buf = ngx_cpymem(buf, v->data, len);
fmt++;
continue;
case 'v':
vv = va_arg(args, ngx_variable_value_t *);
len = vv->len;
len = (buf + len < last) ? len : (size_t) (last - buf);
buf = ngx_cpymem(buf, vv->data, len);
fmt++;
continue;
case 's':
p = va_arg(args, u_char *);
if (slen == (size_t) -1) {
while (*p && buf < last) {
*buf++ = *p++;
}
} else {
len = (buf + slen < last) ? slen : (size_t) (last - buf);
buf = ngx_cpymem(buf, p, len);
}
fmt++;
continue;
case 'O':
i64 = (int64_t) va_arg(args, off_t);
sign = 1;
break;
case 'P':
i64 = (int64_t) va_arg(args, ngx_pid_t);
sign = 1;
break;
case 'T':
i64 = (int64_t) va_arg(args, time_t);
sign = 1;
break;
case 'M':
ms = (ngx_msec_t) va_arg(args, ngx_msec_t);
if ((ngx_msec_int_t) ms == -1) {
sign = 1;
i64 = -1;
} else {
sign = 0;
ui64 = (uint64_t) ms;
}
break;
case 'z':
if (sign) {
i64 = (int64_t) va_arg(args, ssize_t);
} else {
ui64 = (uint64_t) va_arg(args, size_t);
}
break;
case 'i':
if (sign) {
i64 = (int64_t) va_arg(args, ngx_int_t);
} else {
ui64 = (uint64_t) va_arg(args, ngx_uint_t);
}
if (max_width) {
width = NGX_INT_T_LEN;
}
break;
case 'd':
if (sign) {
i64 = (int64_t) va_arg(args, int);
} else {
ui64 = (uint64_t) va_arg(args, u_int);
}
break;
case 'l':
if (sign) {
i64 = (int64_t) va_arg(args, long);
} else {
ui64 = (uint64_t) va_arg(args, u_long);
}
break;
case 'D':
if (sign) {
i64 = (int64_t) va_arg(args, int32_t);
} else {
ui64 = (uint64_t) va_arg(args, uint32_t);
}
break;
case 'L':
if (sign) {
i64 = va_arg(args, int64_t);
} else {
ui64 = va_arg(args, uint64_t);
}
break;
case 'A':
if (sign) {
i64 = (int64_t) va_arg(args, ngx_atomic_int_t);
} else {
ui64 = (uint64_t) va_arg(args, ngx_atomic_uint_t);
}
if (max_width) {
width = NGX_ATOMIC_T_LEN;
}
break;
case 'f':
f = (float) va_arg(args, double);
if (f < 0) {
*buf++ = '-';
f = -f;
}
ui64 = (int64_t) f;
buf = ngx_sprintf_num(buf, last, ui64, zero, 0, width);
if (frac_width) {
if (buf < last) {
*buf++ = '.';
}
scale = 1.0;
for (i = 0; i < frac_width; i++) {
scale *= 10.0;
}
ui64 = (uint64_t) ((f - (int64_t) ui64) * scale);
buf = ngx_sprintf_num(buf, last, ui64, '0', 0, frac_width);
}
fmt++;
continue;
#if !(NGX_WIN32)
case 'r':
i64 = (int64_t) va_arg(args, rlim_t);
sign = 1;
break;
#endif
case 'p':
ui64 = (uintptr_t) va_arg(args, void *);
hex = 2;
sign = 0;
zero = '0';
width = NGX_PTR_SIZE * 2;
break;
case 'c':
d = va_arg(args, int);
*buf++ = (u_char) (d & 0xff);
fmt++;
continue;
case 'Z':
*buf++ = '\0';
fmt++;
continue;
case 'N':
#if (NGX_WIN32)
*buf++ = CR;
#endif
*buf++ = LF;
fmt++;
continue;
case '%':
*buf++ = '%';
fmt++;
continue;
default:
*buf++ = *fmt++;
continue;
}
if (sign) {
if (i64 < 0) {
*buf++ = '-';
ui64 = (uint64_t) -i64;
} else {
ui64 = (uint64_t) i64;
}
}
buf = ngx_sprintf_num(buf, last, ui64, zero, hex, width);
fmt++;
} else {
*buf++ = *fmt++;
}
}
return buf;
}
src/http/ngx_http_header_filter_module.c:489: error: Buffer Overrun L3
Offset: [0, 131077] Size: [0, +oo] by call to `ngx_sprintf`.
src/http/ngx_http_header_filter_module.c:430:5: Assignment
428.
429. /* "HTTP/1.x " */
430. b->last = ngx_cpymem(b->last, "HTTP/1.1 ", sizeof("HTTP/1.x ") - 1);
^
431.
432. /* status line */
src/http/ngx_http_header_filter_module.c:489:19: Call
487. && r->headers_out.content_length_n >= 0)
488. {
489. b->last = ngx_sprintf(b->last, "Content-Length: %O" CRLF,
^
490. r->headers_out.content_length_n);
491. }
src/core/ngx_string.c:95:1: Parameter `*buf`
93.
94.
95. u_char * ngx_cdecl
^
96. ngx_sprintf(u_char *buf, const char *fmt, ...)
97. {
src/core/ngx_string.c:102:9: Call
100.
101. va_start(args, fmt);
102. p = ngx_vsnprintf(buf, /* STUB */ 65536, fmt, args);
^
103. va_end(args);
104.
src/core/ngx_string.c:123:1: <Length trace>
121.
122.
123. u_char *
^
124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
125. {
src/core/ngx_string.c:123:1: Parameter `*buf`
121.
122.
123. u_char *
^
124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
125. {
src/core/ngx_string.c:244:25: Array access: Offset: [0, 131077] Size: [0, +oo] by call to `ngx_sprintf`
242. if (slen == (size_t) -1) {
243. while (*p && buf < last) {
244. *buf++ = *p++;
^
245. }
246.
|
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_string.c/#L244
|
d2a_code_trace_data_42671
|
static int adpcm_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
const uint8_t *buf, int buf_size)
{
ADPCMContext *c = avctx->priv_data;
ADPCMChannelStatus *cs;
int n, m, channel, i;
int block_predictor[2];
short *samples;
short *samples_end;
const uint8_t *src;
int st;
unsigned char last_byte = 0;
unsigned char nibble;
int decode_top_nibble_next = 0;
int diff_channel;
uint32_t samples_in_chunk;
int32_t previous_left_sample, previous_right_sample;
int32_t current_left_sample, current_right_sample;
int32_t next_left_sample, next_right_sample;
int32_t coeff1l, coeff2l, coeff1r, coeff2r;
uint8_t shift_left, shift_right;
int count1, count2;
if (!buf_size)
return 0;
if(*data_size/4 < buf_size + 8)
return -1;
samples = data;
samples_end= samples + *data_size/2;
*data_size= 0;
src = buf;
st = avctx->channels == 2 ? 1 : 0;
switch(avctx->codec->id) {
case CODEC_ID_ADPCM_IMA_QT:
n = (buf_size - 2);
channel = c->channel;
cs = &(c->status[channel]);
cs->predictor = (*src++) << 8;
cs->predictor |= (*src & 0x80);
cs->predictor &= 0xFF80;
if(cs->predictor & 0x8000)
cs->predictor -= 0x10000;
cs->predictor = av_clip_int16(cs->predictor);
cs->step_index = (*src++) & 0x7F;
if (cs->step_index > 88){
av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index);
cs->step_index = 88;
}
cs->step = step_table[cs->step_index];
if (st && channel)
samples++;
for(m=32; n>0 && m>0; n--, m--) {
*samples = adpcm_ima_expand_nibble(cs, src[0] & 0x0F, 3);
samples += avctx->channels;
*samples = adpcm_ima_expand_nibble(cs, (src[0] >> 4) & 0x0F, 3);
samples += avctx->channels;
src ++;
}
if(st) {
c->channel = (channel + 1) % 2;
if(channel == 1) {
return src - buf;
}
}
break;
case CODEC_ID_ADPCM_IMA_WAV:
if (avctx->block_align != 0 && buf_size > avctx->block_align)
buf_size = avctx->block_align;
for(i=0; i<avctx->channels; i++){
cs = &(c->status[i]);
cs->predictor = *samples++ = (int16_t)(src[0] + (src[1]<<8));
src+=2;
cs->step_index = *src++;
if (cs->step_index > 88){
av_log(avctx, AV_LOG_ERROR, "ERROR: step_index = %i\n", cs->step_index);
cs->step_index = 88;
}
if (*src++) av_log(avctx, AV_LOG_ERROR, "unused byte should be null but is %d!!\n", src[-1]);
}
while(src < buf + buf_size){
for(m=0; m<4; m++){
for(i=0; i<=st; i++)
*samples++ = adpcm_ima_expand_nibble(&c->status[i], src[4*i] & 0x0F, 3);
for(i=0; i<=st; i++)
*samples++ = adpcm_ima_expand_nibble(&c->status[i], src[4*i] >> 4 , 3);
src++;
}
src += 4*st;
}
break;
case CODEC_ID_ADPCM_4XM:
cs = &(c->status[0]);
c->status[0].predictor= (int16_t)(src[0] + (src[1]<<8)); src+=2;
if(st){
c->status[1].predictor= (int16_t)(src[0] + (src[1]<<8)); src+=2;
}
c->status[0].step_index= (int16_t)(src[0] + (src[1]<<8)); src+=2;
if(st){
c->status[1].step_index= (int16_t)(src[0] + (src[1]<<8)); src+=2;
}
if (cs->step_index < 0) cs->step_index = 0;
if (cs->step_index > 88) cs->step_index = 88;
m= (buf_size - (src - buf))>>st;
for(i=0; i<m; i++) {
*samples++ = adpcm_ima_expand_nibble(&c->status[0], src[i] & 0x0F, 4);
if (st)
*samples++ = adpcm_ima_expand_nibble(&c->status[1], src[i+m] & 0x0F, 4);
*samples++ = adpcm_ima_expand_nibble(&c->status[0], src[i] >> 4, 4);
if (st)
*samples++ = adpcm_ima_expand_nibble(&c->status[1], src[i+m] >> 4, 4);
}
src += m<<st;
break;
case CODEC_ID_ADPCM_MS:
if (avctx->block_align != 0 && buf_size > avctx->block_align)
buf_size = avctx->block_align;
n = buf_size - 7 * avctx->channels;
if (n < 0)
return -1;
block_predictor[0] = av_clip(*src++, 0, 7);
block_predictor[1] = 0;
if (st)
block_predictor[1] = av_clip(*src++, 0, 7);
c->status[0].idelta = (int16_t)((*src & 0xFF) | ((src[1] << 8) & 0xFF00));
src+=2;
if (st){
c->status[1].idelta = (int16_t)((*src & 0xFF) | ((src[1] << 8) & 0xFF00));
src+=2;
}
c->status[0].coeff1 = AdaptCoeff1[block_predictor[0]];
c->status[0].coeff2 = AdaptCoeff2[block_predictor[0]];
c->status[1].coeff1 = AdaptCoeff1[block_predictor[1]];
c->status[1].coeff2 = AdaptCoeff2[block_predictor[1]];
c->status[0].sample1 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00));
src+=2;
if (st) c->status[1].sample1 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00));
if (st) src+=2;
c->status[0].sample2 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00));
src+=2;
if (st) c->status[1].sample2 = ((*src & 0xFF) | ((src[1] << 8) & 0xFF00));
if (st) src+=2;
*samples++ = c->status[0].sample1;
if (st) *samples++ = c->status[1].sample1;
*samples++ = c->status[0].sample2;
if (st) *samples++ = c->status[1].sample2;
for(;n>0;n--) {
*samples++ = adpcm_ms_expand_nibble(&c->status[0], (src[0] >> 4) & 0x0F);
*samples++ = adpcm_ms_expand_nibble(&c->status[st], src[0] & 0x0F);
src ++;
}
break;
case CODEC_ID_ADPCM_IMA_DK4:
if (avctx->block_align != 0 && buf_size > avctx->block_align)
buf_size = avctx->block_align;
c->status[0].predictor = (int16_t)(src[0] | (src[1] << 8));
c->status[0].step_index = src[2];
src += 4;
*samples++ = c->status[0].predictor;
if (st) {
c->status[1].predictor = (int16_t)(src[0] | (src[1] << 8));
c->status[1].step_index = src[2];
src += 4;
*samples++ = c->status[1].predictor;
}
while (src < buf + buf_size) {
*samples++ = adpcm_ima_expand_nibble(&c->status[0],
(src[0] >> 4) & 0x0F, 3);
if (st)
*samples++ = adpcm_ima_expand_nibble(&c->status[1],
src[0] & 0x0F, 3);
else
*samples++ = adpcm_ima_expand_nibble(&c->status[0],
src[0] & 0x0F, 3);
src++;
}
break;
case CODEC_ID_ADPCM_IMA_DK3:
if (avctx->block_align != 0 && buf_size > avctx->block_align)
buf_size = avctx->block_align;
if(buf_size + 16 > (samples_end - samples)*3/8)
return -1;
c->status[0].predictor = (int16_t)(src[10] | (src[11] << 8));
c->status[1].predictor = (int16_t)(src[12] | (src[13] << 8));
c->status[0].step_index = src[14];
c->status[1].step_index = src[15];
src += 16;
diff_channel = c->status[1].predictor;
while (1) {
DK3_GET_NEXT_NIBBLE();
adpcm_ima_expand_nibble(&c->status[0], nibble, 3);
DK3_GET_NEXT_NIBBLE();
adpcm_ima_expand_nibble(&c->status[1], nibble, 3);
diff_channel = (diff_channel + c->status[1].predictor) / 2;
*samples++ = c->status[0].predictor + c->status[1].predictor;
*samples++ = c->status[0].predictor - c->status[1].predictor;
DK3_GET_NEXT_NIBBLE();
adpcm_ima_expand_nibble(&c->status[0], nibble, 3);
diff_channel = (diff_channel + c->status[1].predictor) / 2;
*samples++ = c->status[0].predictor + c->status[1].predictor;
*samples++ = c->status[0].predictor - c->status[1].predictor;
}
break;
case CODEC_ID_ADPCM_IMA_WS:
while (src < buf + buf_size) {
if (st) {
*samples++ = adpcm_ima_expand_nibble(&c->status[0],
(src[0] >> 4) & 0x0F, 3);
*samples++ = adpcm_ima_expand_nibble(&c->status[1],
src[0] & 0x0F, 3);
} else {
*samples++ = adpcm_ima_expand_nibble(&c->status[0],
(src[0] >> 4) & 0x0F, 3);
*samples++ = adpcm_ima_expand_nibble(&c->status[0],
src[0] & 0x0F, 3);
}
src++;
}
break;
case CODEC_ID_ADPCM_XA:
while (buf_size >= 128) {
xa_decode(samples, src, &c->status[0], &c->status[1],
avctx->channels);
src += 128;
samples += 28 * 8;
buf_size -= 128;
}
break;
case CODEC_ID_ADPCM_IMA_EA_EACS:
samples_in_chunk = bytestream_get_le32(&src) >> (1-st);
if (samples_in_chunk > buf_size-4-(8<<st)) {
src += buf_size - 4;
break;
}
for (i=0; i<=st; i++)
c->status[i].step_index = bytestream_get_le32(&src);
for (i=0; i<=st; i++)
c->status[i].predictor = bytestream_get_le32(&src);
for (; samples_in_chunk; samples_in_chunk--, src++) {
*samples++ = adpcm_ima_expand_nibble(&c->status[0], *src>>4, 3);
*samples++ = adpcm_ima_expand_nibble(&c->status[st], *src&0x0F, 3);
}
break;
case CODEC_ID_ADPCM_IMA_EA_SEAD:
for (; src < buf+buf_size; src++) {
*samples++ = adpcm_ima_expand_nibble(&c->status[0], src[0] >> 4, 6);
*samples++ = adpcm_ima_expand_nibble(&c->status[st],src[0]&0x0F, 6);
}
break;
case CODEC_ID_ADPCM_EA:
samples_in_chunk = AV_RL32(src);
if (samples_in_chunk >= ((buf_size - 12) * 2)) {
src += buf_size;
break;
}
src += 4;
current_left_sample = (int16_t)AV_RL16(src);
src += 2;
previous_left_sample = (int16_t)AV_RL16(src);
src += 2;
current_right_sample = (int16_t)AV_RL16(src);
src += 2;
previous_right_sample = (int16_t)AV_RL16(src);
src += 2;
for (count1 = 0; count1 < samples_in_chunk/28;count1++) {
coeff1l = ea_adpcm_table[(*src >> 4) & 0x0F];
coeff2l = ea_adpcm_table[((*src >> 4) & 0x0F) + 4];
coeff1r = ea_adpcm_table[*src & 0x0F];
coeff2r = ea_adpcm_table[(*src & 0x0F) + 4];
src++;
shift_left = ((*src >> 4) & 0x0F) + 8;
shift_right = (*src & 0x0F) + 8;
src++;
for (count2 = 0; count2 < 28; count2++) {
next_left_sample = (((*src & 0xF0) << 24) >> shift_left);
next_right_sample = (((*src & 0x0F) << 28) >> shift_right);
src++;
next_left_sample = (next_left_sample +
(current_left_sample * coeff1l) +
(previous_left_sample * coeff2l) + 0x80) >> 8;
next_right_sample = (next_right_sample +
(current_right_sample * coeff1r) +
(previous_right_sample * coeff2r) + 0x80) >> 8;
previous_left_sample = current_left_sample;
current_left_sample = av_clip_int16(next_left_sample);
previous_right_sample = current_right_sample;
current_right_sample = av_clip_int16(next_right_sample);
*samples++ = (unsigned short)current_left_sample;
*samples++ = (unsigned short)current_right_sample;
}
}
break;
case CODEC_ID_ADPCM_EA_R1:
case CODEC_ID_ADPCM_EA_R2:
case CODEC_ID_ADPCM_EA_R3: {
const int big_endian = avctx->codec->id == CODEC_ID_ADPCM_EA_R3;
int32_t previous_sample, current_sample, next_sample;
int32_t coeff1, coeff2;
uint8_t shift;
unsigned int channel;
uint16_t *samplesC;
const uint8_t *srcC;
samples_in_chunk = (big_endian ? bytestream_get_be32(&src)
: bytestream_get_le32(&src)) / 28;
if (samples_in_chunk > UINT32_MAX/(28*avctx->channels) ||
28*samples_in_chunk*avctx->channels > samples_end-samples) {
src += buf_size - 4;
break;
}
for (channel=0; channel<avctx->channels; channel++) {
srcC = src + (big_endian ? bytestream_get_be32(&src)
: bytestream_get_le32(&src))
+ (avctx->channels-channel-1) * 4;
samplesC = samples + channel;
if (avctx->codec->id == CODEC_ID_ADPCM_EA_R1) {
current_sample = (int16_t)bytestream_get_le16(&srcC);
previous_sample = (int16_t)bytestream_get_le16(&srcC);
} else {
current_sample = c->status[channel].predictor;
previous_sample = c->status[channel].prev_sample;
}
for (count1=0; count1<samples_in_chunk; count1++) {
if (*srcC == 0xEE) {
srcC++;
current_sample = (int16_t)bytestream_get_be16(&srcC);
previous_sample = (int16_t)bytestream_get_be16(&srcC);
for (count2=0; count2<28; count2++) {
*samplesC = (int16_t)bytestream_get_be16(&srcC);
samplesC += avctx->channels;
}
} else {
coeff1 = ea_adpcm_table[ (*srcC>>4) & 0x0F ];
coeff2 = ea_adpcm_table[((*srcC>>4) & 0x0F) + 4];
shift = (*srcC++ & 0x0F) + 8;
for (count2=0; count2<28; count2++) {
if (count2 & 1)
next_sample = ((*srcC++ & 0x0F) << 28) >> shift;
else
next_sample = ((*srcC & 0xF0) << 24) >> shift;
next_sample += (current_sample * coeff1) +
(previous_sample * coeff2);
next_sample = av_clip_int16(next_sample >> 8);
previous_sample = current_sample;
current_sample = next_sample;
*samplesC = current_sample;
samplesC += avctx->channels;
}
}
}
if (avctx->codec->id != CODEC_ID_ADPCM_EA_R1) {
c->status[channel].predictor = current_sample;
c->status[channel].prev_sample = previous_sample;
}
}
src = src + buf_size - (4 + 4*avctx->channels);
samples += 28 * samples_in_chunk * avctx->channels;
break;
}
case CODEC_ID_ADPCM_EA_XAS:
if (samples_end-samples < 32*4*avctx->channels
|| buf_size < (4+15)*4*avctx->channels) {
src += buf_size;
break;
}
for (channel=0; channel<avctx->channels; channel++) {
int coeff[2][4], shift[4];
short *s2, *s = &samples[channel];
for (n=0; n<4; n++, s+=32*avctx->channels) {
for (i=0; i<2; i++)
coeff[i][n] = ea_adpcm_table[(src[0]&0x0F)+4*i];
shift[n] = (src[2]&0x0F) + 8;
for (s2=s, i=0; i<2; i++, src+=2, s2+=avctx->channels)
s2[0] = (src[0]&0xF0) + (src[1]<<8);
}
for (m=2; m<32; m+=2) {
s = &samples[m*avctx->channels + channel];
for (n=0; n<4; n++, src++, s+=32*avctx->channels) {
for (s2=s, i=0; i<8; i+=4, s2+=avctx->channels) {
int level = ((*src & (0xF0>>i)) << (24+i)) >> shift[n];
int pred = s2[-1*avctx->channels] * coeff[0][n]
+ s2[-2*avctx->channels] * coeff[1][n];
s2[0] = av_clip_int16((level + pred + 0x80) >> 8);
}
}
}
}
samples += 32*4*avctx->channels;
break;
case CODEC_ID_ADPCM_IMA_AMV:
case CODEC_ID_ADPCM_IMA_SMJPEG:
c->status[0].predictor = (int16_t)bytestream_get_le16(&src);
c->status[0].step_index = bytestream_get_le16(&src);
if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV)
src+=4;
while (src < buf + buf_size) {
char hi, lo;
lo = *src & 0x0F;
hi = (*src >> 4) & 0x0F;
if (avctx->codec->id == CODEC_ID_ADPCM_IMA_AMV)
FFSWAP(char, hi, lo);
*samples++ = adpcm_ima_expand_nibble(&c->status[0],
lo, 3);
*samples++ = adpcm_ima_expand_nibble(&c->status[0],
hi, 3);
src++;
}
break;
case CODEC_ID_ADPCM_CT:
while (src < buf + buf_size) {
if (st) {
*samples++ = adpcm_ct_expand_nibble(&c->status[0],
(src[0] >> 4) & 0x0F);
*samples++ = adpcm_ct_expand_nibble(&c->status[1],
src[0] & 0x0F);
} else {
*samples++ = adpcm_ct_expand_nibble(&c->status[0],
(src[0] >> 4) & 0x0F);
*samples++ = adpcm_ct_expand_nibble(&c->status[0],
src[0] & 0x0F);
}
src++;
}
break;
case CODEC_ID_ADPCM_SBPRO_4:
case CODEC_ID_ADPCM_SBPRO_3:
case CODEC_ID_ADPCM_SBPRO_2:
if (!c->status[0].step_index) {
*samples++ = 128 * (*src++ - 0x80);
if (st)
*samples++ = 128 * (*src++ - 0x80);
c->status[0].step_index = 1;
}
if (avctx->codec->id == CODEC_ID_ADPCM_SBPRO_4) {
while (src < buf + buf_size) {
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
(src[0] >> 4) & 0x0F, 4, 0);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[st],
src[0] & 0x0F, 4, 0);
src++;
}
} else if (avctx->codec->id == CODEC_ID_ADPCM_SBPRO_3) {
while (src < buf + buf_size && samples + 2 < samples_end) {
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
(src[0] >> 5) & 0x07, 3, 0);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
(src[0] >> 2) & 0x07, 3, 0);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
src[0] & 0x03, 2, 0);
src++;
}
} else {
while (src < buf + buf_size && samples + 3 < samples_end) {
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
(src[0] >> 6) & 0x03, 2, 2);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[st],
(src[0] >> 4) & 0x03, 2, 2);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[0],
(src[0] >> 2) & 0x03, 2, 2);
*samples++ = adpcm_sbpro_expand_nibble(&c->status[st],
src[0] & 0x03, 2, 2);
src++;
}
}
break;
case CODEC_ID_ADPCM_SWF:
{
GetBitContext gb;
const int *table;
int k0, signmask, nb_bits, count;
int size = buf_size*8;
init_get_bits(&gb, buf, size);
nb_bits = get_bits(&gb, 2)+2;
table = swf_index_tables[nb_bits-2];
k0 = 1 << (nb_bits-2);
signmask = 1 << (nb_bits-1);
while (get_bits_count(&gb) <= size - 22*avctx->channels) {
for (i = 0; i < avctx->channels; i++) {
*samples++ = c->status[i].predictor = get_sbits(&gb, 16);
c->status[i].step_index = get_bits(&gb, 6);
}
for (count = 0; get_bits_count(&gb) <= size - nb_bits*avctx->channels && count < 4095; count++) {
int i;
for (i = 0; i < avctx->channels; i++) {
int delta = get_bits(&gb, nb_bits);
int step = step_table[c->status[i].step_index];
long vpdiff = 0;
int k = k0;
do {
if (delta & k)
vpdiff += step;
step >>= 1;
k >>= 1;
} while(k);
vpdiff += step;
if (delta & signmask)
c->status[i].predictor -= vpdiff;
else
c->status[i].predictor += vpdiff;
c->status[i].step_index += table[delta & (~signmask)];
c->status[i].step_index = av_clip(c->status[i].step_index, 0, 88);
c->status[i].predictor = av_clip_int16(c->status[i].predictor);
*samples++ = c->status[i].predictor;
if (samples >= samples_end) {
av_log(avctx, AV_LOG_ERROR, "allocated output buffer is too small\n");
return -1;
}
}
}
}
src += buf_size;
break;
}
case CODEC_ID_ADPCM_YAMAHA:
while (src < buf + buf_size) {
if (st) {
*samples++ = adpcm_yamaha_expand_nibble(&c->status[0],
src[0] & 0x0F);
*samples++ = adpcm_yamaha_expand_nibble(&c->status[1],
(src[0] >> 4) & 0x0F);
} else {
*samples++ = adpcm_yamaha_expand_nibble(&c->status[0],
src[0] & 0x0F);
*samples++ = adpcm_yamaha_expand_nibble(&c->status[0],
(src[0] >> 4) & 0x0F);
}
src++;
}
break;
case CODEC_ID_ADPCM_THP:
{
int table[2][16];
unsigned int samplecnt;
int prev[2][2];
int ch;
if (buf_size < 80) {
av_log(avctx, AV_LOG_ERROR, "frame too small\n");
return -1;
}
src+=4;
samplecnt = bytestream_get_be32(&src);
for (i = 0; i < 32; i++)
table[0][i] = (int16_t)bytestream_get_be16(&src);
for (i = 0; i < 4; i++)
prev[0][i] = (int16_t)bytestream_get_be16(&src);
if (samplecnt >= (samples_end - samples) / (st + 1)) {
av_log(avctx, AV_LOG_ERROR, "allocated output buffer is too small\n");
return -1;
}
for (ch = 0; ch <= st; ch++) {
samples = (unsigned short *) data + ch;
for (i = 0; i < samplecnt / 14; i++) {
int index = (*src >> 4) & 7;
unsigned int exp = 28 - (*src++ & 15);
int factor1 = table[ch][index * 2];
int factor2 = table[ch][index * 2 + 1];
for (n = 0; n < 14; n++) {
int32_t sampledat;
if(n&1) sampledat= *src++ <<28;
else sampledat= (*src&0xF0)<<24;
sampledat = ((prev[ch][0]*factor1
+ prev[ch][1]*factor2) >> 11) + (sampledat>>exp);
*samples = av_clip_int16(sampledat);
prev[ch][1] = prev[ch][0];
prev[ch][0] = *samples++;
samples += st;
}
}
}
samples -= st;
break;
}
default:
return -1;
}
*data_size = (uint8_t *)samples - (uint8_t *)data;
return src - buf;
}
libavcodec/adpcm.c:1523: error: Buffer Overrun L2
Offset: [0, 31] Size: 16.
libavcodec/adpcm.c:1522:14: <Offset trace>
1520. samplecnt = bytestream_get_be32(&src);
1521.
1522. for (i = 0; i < 32; i++)
^
1523. table[0][i] = (int16_t)bytestream_get_be16(&src);
1524.
libavcodec/adpcm.c:1522:14: Assignment
1520. samplecnt = bytestream_get_be32(&src);
1521.
1522. for (i = 0; i < 32; i++)
^
1523. table[0][i] = (int16_t)bytestream_get_be16(&src);
1524.
libavcodec/adpcm.c:876:1: <Length trace>
874. }
875.
876. static int adpcm_decode_frame(AVCodecContext *avctx,
^
877. void *data, int *data_size,
878. const uint8_t *buf, int buf_size)
libavcodec/adpcm.c:876:1: Array declaration
874. }
875.
876. static int adpcm_decode_frame(AVCodecContext *avctx,
^
877. void *data, int *data_size,
878. const uint8_t *buf, int buf_size)
libavcodec/adpcm.c:1523:13: Array access: Offset: [0, 31] Size: 16
1521.
1522. for (i = 0; i < 32; i++)
1523. table[0][i] = (int16_t)bytestream_get_be16(&src);
^
1524.
1525. /* Initialize the previous sample. */
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/adpcm.c/#L1523
|
d2a_code_trace_data_42672
|
static int vp3_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
Vp3DecodeContext *s = avctx->priv_data;
GetBitContext gb;
int i;
init_get_bits(&gb, buf, buf_size * 8);
if (s->theora && get_bits1(&gb))
{
av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n");
return -1;
}
s->keyframe = !get_bits1(&gb);
if (!s->theora)
skip_bits(&gb, 1);
for (i = 0; i < 3; i++)
s->last_qps[i] = s->qps[i];
s->nqps=0;
do{
s->qps[s->nqps++]= get_bits(&gb, 6);
} while(s->theora >= 0x030200 && s->nqps<3 && get_bits1(&gb));
for (i = s->nqps; i < 3; i++)
s->qps[i] = -1;
if (s->avctx->debug & FF_DEBUG_PICT_INFO)
av_log(s->avctx, AV_LOG_INFO, " VP3 %sframe #%d: Q index = %d\n",
s->keyframe?"key":"", avctx->frame_number+1, s->qps[0]);
s->skip_loop_filter = !s->filter_limit_values[s->qps[0]] ||
avctx->skip_loop_filter >= (s->keyframe ? AVDISCARD_ALL : AVDISCARD_NONKEY);
if (s->qps[0] != s->last_qps[0])
init_loop_filter(s);
for (i = 0; i < s->nqps; i++)
if (s->qps[i] != s->last_qps[i] || s->qps[0] != s->last_qps[0])
init_dequantizer(s, i);
if (avctx->skip_frame >= AVDISCARD_NONKEY && !s->keyframe)
return buf_size;
s->current_frame.reference = 3;
s->current_frame.pict_type = s->keyframe ? FF_I_TYPE : FF_P_TYPE;
if (ff_thread_get_buffer(avctx, &s->current_frame) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
goto error;
}
if (s->keyframe) {
if (!s->theora)
{
skip_bits(&gb, 4);
skip_bits(&gb, 4);
if (s->version)
{
s->version = get_bits(&gb, 5);
if (avctx->frame_number == 0)
av_log(s->avctx, AV_LOG_DEBUG, "VP version: %d\n", s->version);
}
}
if (s->version || s->theora)
{
if (get_bits1(&gb))
av_log(s->avctx, AV_LOG_ERROR, "Warning, unsupported keyframe coding type?!\n");
skip_bits(&gb, 2);
}
} else {
if (!s->golden_frame.data[0]) {
av_log(s->avctx, AV_LOG_WARNING, "vp3: first frame not a keyframe\n");
s->golden_frame.reference = 3;
s->golden_frame.pict_type = FF_I_TYPE;
if (ff_thread_get_buffer(avctx, &s->golden_frame) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
goto error;
}
s->last_frame = s->golden_frame;
s->last_frame.type = FF_BUFFER_TYPE_COPY;
}
}
s->current_frame.qscale_table= s->qscale_table;
s->current_frame.qstride= 0;
memset(s->all_fragments, 0, s->fragment_count * sizeof(Vp3Fragment));
ff_thread_finish_setup(avctx);
if (unpack_superblocks(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_superblocks\n");
goto error;
}
if (unpack_modes(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_modes\n");
goto error;
}
if (unpack_vectors(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_vectors\n");
goto error;
}
if (unpack_block_qpis(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_block_qpis\n");
goto error;
}
if (unpack_dct_coeffs(s, &gb)){
av_log(s->avctx, AV_LOG_ERROR, "error in unpack_dct_coeffs\n");
goto error;
}
for (i = 0; i < 3; i++) {
int height = s->height >> (i && s->chroma_y_shift);
if (s->flipped_image)
s->data_offset[i] = 0;
else
s->data_offset[i] = (height-1) * s->current_frame.linesize[i];
}
s->last_slice_end = 0;
for (i = 0; i < s->c_superblock_height; i++)
render_slice(s, i);
for (i = 0; i < 3; i++) {
int row = (s->height >> (3+(i && s->chroma_y_shift))) - 1;
apply_loop_filter(s, i, row, row+1);
}
vp3_draw_horiz_band(s, s->avctx->height);
*data_size=sizeof(AVFrame);
*(AVFrame*)data= s->current_frame;
if (!HAVE_PTHREADS || !(s->avctx->active_thread_type&FF_THREAD_FRAME))
update_frames(avctx);
return buf_size;
error:
ff_thread_report_progress(&s->current_frame, INT_MAX, 0);
if (!HAVE_PTHREADS || !(s->avctx->active_thread_type&FF_THREAD_FRAME))
avctx->release_buffer(avctx, &s->current_frame);
return -1;
}
libavcodec/vp3.c:1850: error: Null Dereference
pointer `&gb->buffer` last assigned on line 1848 could be null and is dereferenced by call to `get_bits1()` at line 1850, column 22.
libavcodec/vp3.c:1838:1: start of procedure vp3_decode_frame()
1836. * This is the ffmpeg/libavcodec API frame decode function.
1837. */
1838. static int vp3_decode_frame(AVCodecContext *avctx,
^
1839. void *data, int *data_size,
1840. AVPacket *avpkt)
libavcodec/vp3.c:1842:5:
1840. AVPacket *avpkt)
1841. {
1842. const uint8_t *buf = avpkt->data;
^
1843. int buf_size = avpkt->size;
1844. Vp3DecodeContext *s = avctx->priv_data;
libavcodec/vp3.c:1843:5:
1841. {
1842. const uint8_t *buf = avpkt->data;
1843. int buf_size = avpkt->size;
^
1844. Vp3DecodeContext *s = avctx->priv_data;
1845. GetBitContext gb;
libavcodec/vp3.c:1844:5:
1842. const uint8_t *buf = avpkt->data;
1843. int buf_size = avpkt->size;
1844. Vp3DecodeContext *s = avctx->priv_data;
^
1845. GetBitContext gb;
1846. int i;
libavcodec/vp3.c:1848:5:
1846. int i;
1847.
1848. init_get_bits(&gb, buf, buf_size * 8);
^
1849.
1850. if (s->theora && get_bits1(&gb))
libavcodec/get_bits.h:391:1: start of procedure init_get_bits()
389. * responsible for checking for the buffer end yourself (take advantage of the padding)!
390. */
391. static inline void init_get_bits(GetBitContext *s,
^
392. const uint8_t *buffer, int bit_size)
393. {
libavcodec/get_bits.h:394:5:
392. const uint8_t *buffer, int bit_size)
393. {
394. int buffer_size = (bit_size+7)>>3;
^
395. if (buffer_size < 0 || bit_size < 0) {
396. buffer_size = bit_size = 0;
libavcodec/get_bits.h:395:9: Taking true branch
393. {
394. int buffer_size = (bit_size+7)>>3;
395. if (buffer_size < 0 || bit_size < 0) {
^
396. buffer_size = bit_size = 0;
397. buffer = NULL;
libavcodec/get_bits.h:396:9:
394. int buffer_size = (bit_size+7)>>3;
395. if (buffer_size < 0 || bit_size < 0) {
396. buffer_size = bit_size = 0;
^
397. buffer = NULL;
398. }
libavcodec/get_bits.h:397:9:
395. if (buffer_size < 0 || bit_size < 0) {
396. buffer_size = bit_size = 0;
397. buffer = NULL;
^
398. }
399.
libavcodec/get_bits.h:400:5:
398. }
399.
400. s->buffer = buffer;
^
401. s->size_in_bits = bit_size;
402. s->buffer_end = buffer + buffer_size;
libavcodec/get_bits.h:401:5:
399.
400. s->buffer = buffer;
401. s->size_in_bits = bit_size;
^
402. s->buffer_end = buffer + buffer_size;
403. #ifdef ALT_BITSTREAM_READER
libavcodec/get_bits.h:402:5:
400. s->buffer = buffer;
401. s->size_in_bits = bit_size;
402. s->buffer_end = buffer + buffer_size;
^
403. #ifdef ALT_BITSTREAM_READER
404. s->index = 0;
libavcodec/get_bits.h:404:5:
402. s->buffer_end = buffer + buffer_size;
403. #ifdef ALT_BITSTREAM_READER
404. s->index = 0;
^
405. #elif defined A32_BITSTREAM_READER
406. s->buffer_ptr = (uint32_t*)((intptr_t)buffer & ~3);
libavcodec/get_bits.h:410:1: return from a call to init_get_bits
408. skip_bits_long(s, 0);
409. #endif
410. }
^
411.
412. static inline void align_get_bits(GetBitContext *s)
libavcodec/vp3.c:1850:9: Taking true branch
1848. init_get_bits(&gb, buf, buf_size * 8);
1849.
1850. if (s->theora && get_bits1(&gb))
^
1851. {
1852. av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n");
libavcodec/vp3.c:1850:22:
1848. init_get_bits(&gb, buf, buf_size * 8);
1849.
1850. if (s->theora && get_bits1(&gb))
^
1851. {
1852. av_log(avctx, AV_LOG_ERROR, "Header packet passed to frame decoder, skipping\n");
libavcodec/get_bits.h:311:1: start of procedure get_bits1()
309. }
310.
311. static inline unsigned int get_bits1(GetBitContext *s){
^
312. #ifdef ALT_BITSTREAM_READER
313. unsigned int index = s->index;
libavcodec/get_bits.h:313:5:
311. static inline unsigned int get_bits1(GetBitContext *s){
312. #ifdef ALT_BITSTREAM_READER
313. unsigned int index = s->index;
^
314. uint8_t result = s->buffer[index>>3];
315. #ifdef ALT_BITSTREAM_READER_LE
libavcodec/get_bits.h:314:5:
312. #ifdef ALT_BITSTREAM_READER
313. unsigned int index = s->index;
314. uint8_t result = s->buffer[index>>3];
^
315. #ifdef ALT_BITSTREAM_READER_LE
316. result >>= index & 7;
|
https://github.com/libav/libav/blob/f4c79d1e0b2e797012304db57903e4091b0c2d7c/libavcodec/vp3.c/#L1850
|
d2a_code_trace_data_42673
|
int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
{
assert(pkt->subs != NULL && len != 0);
if (pkt->subs == NULL || len == 0)
return 0;
if (pkt->maxsize - pkt->written < len)
return 0;
if (pkt->buf->length - pkt->written < len) {
size_t newlen;
size_t reflen;
reflen = (len > pkt->buf->length) ? len : pkt->buf->length;
if (reflen > SIZE_MAX / 2) {
newlen = SIZE_MAX;
} else {
newlen = reflen * 2;
if (newlen < DEFAULT_BUF_SIZE)
newlen = DEFAULT_BUF_SIZE;
}
if (BUF_MEM_grow(pkt->buf, newlen) == 0)
return 0;
}
*allocbytes = (unsigned char *)pkt->buf->data + pkt->curr;
pkt->written += len;
pkt->curr += len;
return 1;
}
ssl/t1_lib.c:1043: error: INTEGER_OVERFLOW_L2
([0, +oo] - [`pkt->written`, `pkt->written` + 4]):unsigned64 by call to `WPACKET_start_sub_packet_len__`.
Showing all 10 steps of the trace
ssl/t1_lib.c:1042:14: Call
1040. /* Add RI if renegotiating */
1041. if (s->renegotiate) {
1042. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_renegotiate)
^
1043. || !WPACKET_start_sub_packet_u16(pkt)
1044. || !WPACKET_sub_memcpy_u8(pkt, s->s3->previous_client_finished,
ssl/packet.c:242:1: Parameter `pkt->buf->length`
240. }
241.
242. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size)
243. {
244. unsigned char *data;
ssl/t1_lib.c:1043:21: Call
1041. if (s->renegotiate) {
1042. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_renegotiate)
1043. || !WPACKET_start_sub_packet_u16(pkt)
^
1044. || !WPACKET_sub_memcpy_u8(pkt, s->s3->previous_client_finished,
1045. s->s3->previous_client_finished_len)
ssl/packet.c:205:1: Parameter `pkt->written`
203. }
204.
205. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes)
206. {
207. WPACKET_SUB *sub;
ssl/packet.c:229:10: Call
227. }
228.
229. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars))
^
230. return 0;
231. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */
ssl/packet.c:15:1: <LHS trace>
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:15:1: Parameter `pkt->buf->length`
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:15:1: <RHS trace>
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:15:1: Parameter `len`
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:25:9: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 4]):unsigned64 by call to `WPACKET_start_sub_packet_len__`
23. return 0;
24.
25. if (pkt->buf->length - pkt->written < len) {
^
26. size_t newlen;
27. size_t reflen;
|
https://github.com/openssl/openssl/blob/a6972f346248fbc37e42056bb943fae0896a2967/ssl/packet.c/#L25
|
d2a_code_trace_data_42674
|
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/dsa/dsa_ossl.c:136: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_mod_add_quick`.
Showing all 23 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 `(*rp)->top`
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:136:10: Call
134.
135. /* s : = (blind * priv_key * r) + (blind * m) mod q */
136. if (!BN_mod_add_quick(ret->s, tmp, blindm, dsa->q))
^
137. goto err;
138.
crypto/bn/bn_mod.c:93:1: Parameter `r->top`
91. }
92.
93. > int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
94. const BIGNUM *m)
95. {
crypto/bn/bn_mod.c:96:15: Call
94. const BIGNUM *m)
95. {
96. int ret = bn_mod_add_fixed_top(r, a, b, m);
^
97.
98. if (ret)
crypto/bn/bn_mod.c:48:1: Parameter `r->top`
46. * move depending on whether or not subtraction borrowed.
47. */
48. > int bn_mod_add_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
49. const BIGNUM *m)
50. {
crypto/bn/bn_mod.c:56:9: Call
54. const BN_ULONG *ap, *bp;
55.
56. if (bn_wexpand(r, mtop) == NULL)
^
57. return 0;
58.
crypto/bn/bn_lib.c:948:1: Parameter `a->top`
946. }
947.
948. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
949. {
950. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_lib.c:950:37: Call
948. BIGNUM *bn_wexpand(BIGNUM *a, int words)
949. {
950. return (words <= a->dmax) ? a : bn_expand2(a, words);
^
951. }
952.
crypto/bn/bn_lib.c:245:1: Parameter `b->top`
243. */
244.
245. > BIGNUM *bn_expand2(BIGNUM *b, int words)
246. {
247. if (words > b->dmax) {
crypto/bn/bn_lib.c:248:23: Call
246. {
247. if (words > b->dmax) {
248. BN_ULONG *a = bn_expand_internal(b, words);
^
249. if (!a)
250. return NULL;
crypto/bn/bn_lib.c:209:1: <Offset trace>
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: Parameter `b->top`
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: <Length trace>
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: Parameter `words`
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:224:13: Call
222. a = OPENSSL_secure_zalloc(words * sizeof(*a));
223. else
224. a = OPENSSL_zalloc(words * sizeof(*a));
^
225. if (a == NULL) {
226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
crypto/mem.c:228:1: Parameter `num`
226. }
227.
228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:230:17: Call
228. void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
^
231.
232. FAILTEST();
crypto/mem.c:201:9: Assignment
199.
200. if (num == 0)
201. return NULL;
^
202.
203. FAILTEST();
crypto/mem.c:230:5: Assignment
228. void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
^
231.
232. FAILTEST();
crypto/mem.c:235:5: Assignment
233. if (ret != NULL)
234. memset(ret, 0, num);
235. return ret;
^
236. }
237.
crypto/bn/bn_lib.c:224:9: Assignment
222. a = OPENSSL_secure_zalloc(words * sizeof(*a));
223. else
224. a = OPENSSL_zalloc(words * sizeof(*a));
^
225. if (a == NULL) {
226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_mod_add_quick`
230. assert(b->top <= words);
231. if (b->top > 0)
232. memcpy(a, b->d, sizeof(*a) * b->top);
^
233.
234. return a;
|
https://github.com/openssl/openssl/blob/4cc968df403ed9321d0df722aba33323ae575ce0/crypto/bn/bn_lib.c/#L232
|
d2a_code_trace_data_42675
|
TXT_DB *TXT_DB_read(BIO *in, int num)
{
TXT_DB *ret = NULL;
int esc = 0;
long ln = 0;
int i, add, n;
int size = BUFSIZE;
int offset = 0;
char *p, *f;
OPENSSL_STRING *pp;
BUF_MEM *buf = NULL;
if ((buf = BUF_MEM_new()) == NULL)
goto err;
if (!BUF_MEM_grow(buf, size))
goto err;
if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
goto err;
ret->num_fields = num;
ret->index = NULL;
ret->qual = NULL;
if ((ret->data = sk_OPENSSL_PSTRING_new_null()) == NULL)
goto err;
if ((ret->index = OPENSSL_malloc(sizeof(*ret->index) * num)) == NULL)
goto err;
if ((ret->qual = OPENSSL_malloc(sizeof(*(ret->qual)) * num)) == NULL)
goto err;
for (i = 0; i < num; i++) {
ret->index[i] = NULL;
ret->qual[i] = NULL;
}
add = (num + 1) * sizeof(char *);
buf->data[size - 1] = '\0';
offset = 0;
for (;;) {
if (offset != 0) {
size += BUFSIZE;
if (!BUF_MEM_grow_clean(buf, size))
goto err;
}
buf->data[offset] = '\0';
BIO_gets(in, &(buf->data[offset]), size - offset);
ln++;
if (buf->data[offset] == '\0')
break;
if ((offset == 0) && (buf->data[0] == '#'))
continue;
i = strlen(&(buf->data[offset]));
offset += i;
if (buf->data[offset - 1] != '\n')
continue;
else {
buf->data[offset - 1] = '\0';
if ((p = OPENSSL_malloc(add + offset)) == NULL)
goto err;
offset = 0;
}
pp = (char **)p;
p += add;
n = 0;
pp[n++] = p;
i = 0;
f = buf->data;
esc = 0;
for (;;) {
if (*f == '\0')
break;
if (*f == '\t') {
if (esc)
p--;
else {
*(p++) = '\0';
f++;
if (n >= num)
break;
pp[n++] = p;
continue;
}
}
esc = (*f == '\\');
*(p++) = *(f++);
}
*(p++) = '\0';
if ((n != num) || (*f != '\0')) {
OPENSSL_free(pp);
ret->error = DB_ERROR_WRONG_NUM_FIELDS;
goto err;
}
pp[n] = p;
if (!sk_OPENSSL_PSTRING_push(ret->data, pp)) {
OPENSSL_free(pp);
goto err;
}
}
BUF_MEM_free(buf);
return ret;
err:
BUF_MEM_free(buf);
if (ret != NULL) {
sk_OPENSSL_PSTRING_free(ret->data);
OPENSSL_free(ret->index);
OPENSSL_free(ret->qual);
OPENSSL_free(ret);
}
return (NULL);
}
crypto/txt_db/txt_db.c:111: error: BUFFER_OVERRUN_S2
Offset: [max(1, `num`), `num`] Size: [1, +oo].
Showing all 10 steps of the trace
crypto/txt_db/txt_db.c:20:1: <Offset trace>
18. #define BUFSIZE 512
19.
20. > TXT_DB *TXT_DB_read(BIO *in, int num)
21. {
22. TXT_DB *ret = NULL;
crypto/txt_db/txt_db.c:20:1: Parameter `num`
18. #define BUFSIZE 512
19.
20. > TXT_DB *TXT_DB_read(BIO *in, int num)
21. {
22. TXT_DB *ret = NULL;
crypto/txt_db/txt_db.c:20:1: <Length trace>
18. #define BUFSIZE 512
19.
20. > TXT_DB *TXT_DB_read(BIO *in, int num)
21. {
22. TXT_DB *ret = NULL;
crypto/txt_db/txt_db.c:20:1: Parameter `num`
18. #define BUFSIZE 512
19.
20. > TXT_DB *TXT_DB_read(BIO *in, int num)
21. {
22. TXT_DB *ret = NULL;
crypto/txt_db/txt_db.c:53:5: Assignment
51. }
52.
53. add = (num + 1) * sizeof(char *);
^
54. buf->data[size - 1] = '\0';
55. offset = 0;
crypto/txt_db/txt_db.c:75:22: Call
73. else {
74. buf->data[offset - 1] = '\0'; /* blat the '\n' */
75. if ((p = OPENSSL_malloc(add + offset)) == NULL)
^
76. goto err;
77. offset = 0;
crypto/mem.c:166:9: Assignment
164.
165. if (num == 0)
166. return NULL;
^
167.
168. FAILTEST();
crypto/txt_db/txt_db.c:75:18: Assignment
73. else {
74. buf->data[offset - 1] = '\0'; /* blat the '\n' */
75. if ((p = OPENSSL_malloc(add + offset)) == NULL)
^
76. goto err;
77. offset = 0;
crypto/txt_db/txt_db.c:79:9: Assignment
77. offset = 0;
78. }
79. pp = (char **)p;
^
80. p += add;
81. n = 0;
crypto/txt_db/txt_db.c:111:9: Array access: Offset: [max(1, num), num] Size: [1, +oo]
109. goto err;
110. }
111. pp[n] = p;
^
112. if (!sk_OPENSSL_PSTRING_push(ret->data, pp)) {
113. OPENSSL_free(pp);
|
https://github.com/openssl/openssl/blob/1b8f19379a521ec11ce37e12316dd3edc0acfb82/crypto/txt_db/txt_db.c/#L111
|
d2a_code_trace_data_42676
|
static av_cold int movie_init(AVFilterContext *ctx)
{
MovieContext *movie = ctx->priv;
AVInputFormat *iformat = NULL;
AVStream *st;
AVCodec *codec;
int ret;
int64_t timestamp;
av_register_all();
iformat = movie->format_name ? av_find_input_format(movie->format_name) : NULL;
movie->format_ctx = NULL;
if ((ret = avformat_open_input(&movie->format_ctx, movie->file_name, iformat, NULL)) < 0) {
av_log(ctx, AV_LOG_ERROR,
"Failed to avformat_open_input '%s'\n", movie->file_name);
return ret;
}
if ((ret = avformat_find_stream_info(movie->format_ctx, NULL)) < 0)
av_log(ctx, AV_LOG_WARNING, "Failed to find stream info\n");
if (movie->seek_point > 0) {
timestamp = movie->seek_point;
if (movie->format_ctx->start_time != AV_NOPTS_VALUE) {
if (timestamp > INT64_MAX - movie->format_ctx->start_time) {
av_log(ctx, AV_LOG_ERROR,
"%s: seek value overflow with start_time:%"PRId64" seek_point:%"PRId64"\n",
movie->file_name, movie->format_ctx->start_time, movie->seek_point);
return AVERROR(EINVAL);
}
timestamp += movie->format_ctx->start_time;
}
if ((ret = av_seek_frame(movie->format_ctx, -1, timestamp, AVSEEK_FLAG_BACKWARD)) < 0) {
av_log(ctx, AV_LOG_ERROR, "%s: could not seek to position %"PRId64"\n",
movie->file_name, timestamp);
return ret;
}
}
if ((ret = av_find_best_stream(movie->format_ctx, AVMEDIA_TYPE_VIDEO,
movie->stream_index, -1, NULL, 0)) < 0) {
av_log(ctx, AV_LOG_ERROR, "No video stream with index '%d' found\n",
movie->stream_index);
return ret;
}
movie->stream_index = ret;
st = movie->format_ctx->streams[movie->stream_index];
codec = avcodec_find_decoder(st->codecpar->codec_id);
if (!codec) {
av_log(ctx, AV_LOG_ERROR, "Failed to find any codec\n");
return AVERROR(EINVAL);
}
movie->codec_ctx = avcodec_alloc_context3(codec);
if (!movie->codec_ctx)
return AVERROR(ENOMEM);
ret = avcodec_parameters_to_context(movie->codec_ctx, st->codecpar);
if (ret < 0)
return ret;
movie->codec_ctx->refcounted_frames = 1;
if ((ret = avcodec_open2(movie->codec_ctx, codec, NULL)) < 0) {
av_log(ctx, AV_LOG_ERROR, "Failed to open codec\n");
return ret;
}
movie->w = movie->codec_ctx->width;
movie->h = movie->codec_ctx->height;
av_log(ctx, AV_LOG_VERBOSE, "seek_point:%"PRIi64" format_name:%s file_name:%s stream_index:%d\n",
movie->seek_point, movie->format_name, movie->file_name,
movie->stream_index);
return 0;
}
libavfilter/vsrc_movie.c:140: error: Null Dereference
pointer `movie->format_ctx` last assigned on line 103 could be null and is dereferenced at line 140, column 10.
libavfilter/vsrc_movie.c:89:1: start of procedure movie_init()
87. };
88.
89. static av_cold int movie_init(AVFilterContext *ctx)
^
90. {
91. MovieContext *movie = ctx->priv;
libavfilter/vsrc_movie.c:91:5:
89. static av_cold int movie_init(AVFilterContext *ctx)
90. {
91. MovieContext *movie = ctx->priv;
^
92. AVInputFormat *iformat = NULL;
93. AVStream *st;
libavfilter/vsrc_movie.c:92:5:
90. {
91. MovieContext *movie = ctx->priv;
92. AVInputFormat *iformat = NULL;
^
93. AVStream *st;
94. AVCodec *codec;
libavfilter/vsrc_movie.c:98:5:
96. int64_t timestamp;
97.
98. av_register_all();
^
99.
100. // Try to find the movie format (container)
libavformat/allformats.c:44:1: start of procedure av_register_all()
42. #define REGISTER_MUXDEMUX(X, x) REGISTER_MUXER(X, x); REGISTER_DEMUXER(X, x)
43.
44. void av_register_all(void)
^
45. {
46. static int initialized;
libavformat/allformats.c:48:9: Taking true branch
46. static int initialized;
47.
48. if (initialized)
^
49. return;
50. initialized = 1;
libavformat/allformats.c:49:9:
47.
48. if (initialized)
49. return;
^
50. initialized = 1;
51.
libavformat/allformats.c:261:1: return from a call to av_register_all
259. REGISTER_DEMUXER (YOP, yop);
260. REGISTER_MUXDEMUX(YUV4MPEGPIPE, yuv4mpegpipe);
261. }
^
libavfilter/vsrc_movie.c:101:15: Condition is true
99.
100. // Try to find the movie format (container)
101. iformat = movie->format_name ? av_find_input_format(movie->format_name) : NULL;
^
102.
103. movie->format_ctx = NULL;
libavfilter/vsrc_movie.c:101:5:
99.
100. // Try to find the movie format (container)
101. iformat = movie->format_name ? av_find_input_format(movie->format_name) : NULL;
^
102.
103. movie->format_ctx = NULL;
libavfilter/vsrc_movie.c:103:5:
101. iformat = movie->format_name ? av_find_input_format(movie->format_name) : NULL;
102.
103. movie->format_ctx = NULL;
^
104. if ((ret = avformat_open_input(&movie->format_ctx, movie->file_name, iformat, NULL)) < 0) {
105. av_log(ctx, AV_LOG_ERROR,
libavfilter/vsrc_movie.c:104:9: Taking false branch
102.
103. movie->format_ctx = NULL;
104. if ((ret = avformat_open_input(&movie->format_ctx, movie->file_name, iformat, NULL)) < 0) {
^
105. av_log(ctx, AV_LOG_ERROR,
106. "Failed to avformat_open_input '%s'\n", movie->file_name);
libavfilter/vsrc_movie.c:109:9: Taking true branch
107. return ret;
108. }
109. if ((ret = avformat_find_stream_info(movie->format_ctx, NULL)) < 0)
^
110. av_log(ctx, AV_LOG_WARNING, "Failed to find stream info\n");
111.
libavfilter/vsrc_movie.c:110:9: Skipping av_log(): empty list of specs
108. }
109. if ((ret = avformat_find_stream_info(movie->format_ctx, NULL)) < 0)
110. av_log(ctx, AV_LOG_WARNING, "Failed to find stream info\n");
^
111.
112. // if seeking requested, we execute it
libavfilter/vsrc_movie.c:113:9: Taking false branch
111.
112. // if seeking requested, we execute it
113. if (movie->seek_point > 0) {
^
114. timestamp = movie->seek_point;
115. // add the stream start time, should it exist
libavfilter/vsrc_movie.c:133:9: Taking false branch
131.
132. /* select the video stream */
133. if ((ret = av_find_best_stream(movie->format_ctx, AVMEDIA_TYPE_VIDEO,
^
134. movie->stream_index, -1, NULL, 0)) < 0) {
135. av_log(ctx, AV_LOG_ERROR, "No video stream with index '%d' found\n",
libavfilter/vsrc_movie.c:139:5:
137. return ret;
138. }
139. movie->stream_index = ret;
^
140. st = movie->format_ctx->streams[movie->stream_index];
141.
libavfilter/vsrc_movie.c:140:5:
138. }
139. movie->stream_index = ret;
140. st = movie->format_ctx->streams[movie->stream_index];
^
141.
142. /*
|
https://github.com/libav/libav/blob/d0c84c41d33ffd270d5f9fe0290e08341397fdee/libavfilter/vsrc_movie.c/#L140
|
d2a_code_trace_data_42677
|
void CRYPTO_free(void *str)
{
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
if (call_malloc_debug) {
CRYPTO_mem_debug_free(str, 0);
free(str);
CRYPTO_mem_debug_free(str, 1);
} else {
free(str);
}
#else
free(str);
#endif
}
crypto/ocsp/ocsp_ext.c:455: error: USE_AFTER_FREE
call to `OBJ_txt2nid()` eventually accesses memory that was invalidated by call to `free()` on line 455 indirectly during the call to `OBJ_txt2nid()`.
Showing all 17 steps of the trace
crypto/ocsp/ocsp_ext.c:455:20: invalidation part of the trace starts here
453. goto err;
454. while (oids && *oids) {
455. if ((nid = OBJ_txt2nid(*oids)) != NID_undef && (o = OBJ_nid2obj(nid)))
^
456. sk_ASN1_OBJECT_push(sk, o);
457. oids++;
crypto/ocsp/ocsp_ext.c:455:20: global variable `added` accessed here
453. goto err;
454. while (oids && *oids) {
455. if ((nid = OBJ_txt2nid(*oids)) != NID_undef && (o = OBJ_nid2obj(nid)))
^
456. sk_ASN1_OBJECT_push(sk, o);
457. oids++;
crypto/ocsp/ocsp_ext.c:455:20: when calling `OBJ_txt2nid` here
453. goto err;
454. while (oids && *oids) {
455. if ((nid = OBJ_txt2nid(*oids)) != NID_undef && (o = OBJ_nid2obj(nid)))
^
456. sk_ASN1_OBJECT_push(sk, o);
457. oids++;
crypto/objects/obj_dat.c:603:11: global variable `added` accessed here
601. ASN1_OBJECT *obj;
602. int nid;
603. obj = OBJ_txt2obj(s, 0);
^
604. nid = OBJ_obj2nid(obj);
605. ASN1_OBJECT_free(obj);
crypto/objects/obj_dat.c:603:11: passed as argument to `OBJ_txt2obj`
601. ASN1_OBJECT *obj;
602. int nid;
603. obj = OBJ_txt2obj(s, 0);
^
604. nid = OBJ_obj2nid(obj);
605. ASN1_OBJECT_free(obj);
crypto/objects/obj_dat.c:603:11: return from call to `OBJ_txt2obj`
601. ASN1_OBJECT *obj;
602. int nid;
603. obj = OBJ_txt2obj(s, 0);
^
604. nid = OBJ_obj2nid(obj);
605. ASN1_OBJECT_free(obj);
crypto/objects/obj_dat.c:603:5: assigned
601. ASN1_OBJECT *obj;
602. int nid;
603. obj = OBJ_txt2obj(s, 0);
^
604. nid = OBJ_obj2nid(obj);
605. ASN1_OBJECT_free(obj);
crypto/objects/obj_dat.c:605:5: when calling `ASN1_OBJECT_free` here
603. obj = OBJ_txt2obj(s, 0);
604. nid = OBJ_obj2nid(obj);
605. ASN1_OBJECT_free(obj);
^
606. return nid;
607. }
crypto/asn1/a_object.c:380:1: parameter `a` of ASN1_OBJECT_free
378. }
379.
380. > void ASN1_OBJECT_free(ASN1_OBJECT *a)
381. {
382. if (a == NULL)
crypto/asn1/a_object.c:399:9: when calling `CRYPTO_free` here
397. }
398. if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC)
399. OPENSSL_free(a);
^
400. }
401.
crypto/mem.c:234:1: parameter `str` of CRYPTO_free
232. }
233.
234. > void CRYPTO_free(void *str)
235. {
236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
crypto/mem.c:245:5: was invalidated by call to `free()`
243. }
244. #else
245. free(str);
^
246. #endif
247. }
crypto/ocsp/ocsp_ext.c:455:20: use-after-lifetime part of the trace starts here
453. goto err;
454. while (oids && *oids) {
455. if ((nid = OBJ_txt2nid(*oids)) != NID_undef && (o = OBJ_nid2obj(nid)))
^
456. sk_ASN1_OBJECT_push(sk, o);
457. oids++;
crypto/ocsp/ocsp_ext.c:455:20: global variable `added` accessed here
453. goto err;
454. while (oids && *oids) {
455. if ((nid = OBJ_txt2nid(*oids)) != NID_undef && (o = OBJ_nid2obj(nid)))
^
456. sk_ASN1_OBJECT_push(sk, o);
457. oids++;
crypto/ocsp/ocsp_ext.c:455:20: when calling `OBJ_txt2nid` here
453. goto err;
454. while (oids && *oids) {
455. if ((nid = OBJ_txt2nid(*oids)) != NID_undef && (o = OBJ_nid2obj(nid)))
^
456. sk_ASN1_OBJECT_push(sk, o);
457. oids++;
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: invalid access occurs here
243. }
244. #else
245. free(str);
^
246. #endif
247. }
|
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/mem.c/#L245
|
d2a_code_trace_data_42678
|
int ossl_ec_key_gen(EC_KEY *eckey)
{
int ok = 0;
BN_CTX *ctx = NULL;
BIGNUM *priv_key = NULL, *order = NULL;
EC_POINT *pub_key = NULL;
if ((order = BN_new()) == NULL)
goto err;
if ((ctx = BN_CTX_new()) == NULL)
goto err;
if (eckey->priv_key == NULL) {
priv_key = BN_new();
if (priv_key == NULL)
goto err;
} else
priv_key = eckey->priv_key;
if (!EC_GROUP_get_order(eckey->group, order, ctx))
goto err;
do
if (!BN_rand_range(priv_key, order))
goto err;
while (BN_is_zero(priv_key)) ;
if (eckey->pub_key == NULL) {
pub_key = EC_POINT_new(eckey->group);
if (pub_key == NULL)
goto err;
} else
pub_key = eckey->pub_key;
if (!EC_POINT_mul(eckey->group, pub_key, priv_key, NULL, NULL, ctx))
goto err;
eckey->priv_key = priv_key;
eckey->pub_key = pub_key;
ok = 1;
err:
BN_free(order);
if (eckey->pub_key == NULL)
EC_POINT_free(pub_key);
if (eckey->priv_key != priv_key)
BN_free(priv_key);
BN_CTX_free(ctx);
return (ok);
}
crypto/ec/ec_key.c:284: error: MEMORY_LEAK
memory dynamically allocated by call to `BN_new()` at line 248, column 18 is not reachable after line 284, column 5.
Showing all 125 steps of the trace
crypto/ec/ec_key.c:241:1: start of procedure ossl_ec_key_gen()
239. }
240.
241. > int ossl_ec_key_gen(EC_KEY *eckey)
242. {
243. int ok = 0;
crypto/ec/ec_key.c:243:5:
241. int ossl_ec_key_gen(EC_KEY *eckey)
242. {
243. > int ok = 0;
244. BN_CTX *ctx = NULL;
245. BIGNUM *priv_key = NULL, *order = NULL;
crypto/ec/ec_key.c:244:5:
242. {
243. int ok = 0;
244. > BN_CTX *ctx = NULL;
245. BIGNUM *priv_key = NULL, *order = NULL;
246. EC_POINT *pub_key = NULL;
crypto/ec/ec_key.c:245:5:
243. int ok = 0;
244. BN_CTX *ctx = NULL;
245. > BIGNUM *priv_key = NULL, *order = NULL;
246. EC_POINT *pub_key = NULL;
247.
crypto/ec/ec_key.c:246:5:
244. BN_CTX *ctx = NULL;
245. BIGNUM *priv_key = NULL, *order = NULL;
246. > EC_POINT *pub_key = NULL;
247.
248. if ((order = BN_new()) == NULL)
crypto/ec/ec_key.c:248:9:
246. EC_POINT *pub_key = NULL;
247.
248. > if ((order = BN_new()) == NULL)
249. goto err;
250. if ((ctx = BN_CTX_new()) == NULL)
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/ec/ec_key.c:248:9: Taking false branch
246. EC_POINT *pub_key = NULL;
247.
248. if ((order = BN_new()) == NULL)
^
249. goto err;
250. if ((ctx = BN_CTX_new()) == NULL)
crypto/ec/ec_key.c:250:9:
248. if ((order = BN_new()) == NULL)
249. goto err;
250. > if ((ctx = BN_CTX_new()) == NULL)
251. goto err;
252.
crypto/bn/bn_ctx.c:189:1: start of procedure BN_CTX_new()
187.
188.
189. > BN_CTX *BN_CTX_new(void)
190. {
191. BN_CTX *ret;
crypto/bn/bn_ctx.c:193:9:
191. BN_CTX *ret;
192.
193. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE);
195. return NULL;
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_ctx.c:193:9: Taking false branch
191. BN_CTX *ret;
192.
193. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE);
195. return NULL;
crypto/bn/bn_ctx.c:198:5:
196. }
197. /* Initialise the structure */
198. > BN_POOL_init(&ret->pool);
199. BN_STACK_init(&ret->stack);
200. return ret;
crypto/bn/bn_ctx.c:335:1: start of procedure BN_POOL_init()
333. /***********/
334.
335. > static void BN_POOL_init(BN_POOL *p)
336. {
337. p->head = p->current = p->tail = NULL;
crypto/bn/bn_ctx.c:337:5:
335. static void BN_POOL_init(BN_POOL *p)
336. {
337. > p->head = p->current = p->tail = NULL;
338. p->used = p->size = 0;
339. }
crypto/bn/bn_ctx.c:338:5:
336. {
337. p->head = p->current = p->tail = NULL;
338. > p->used = p->size = 0;
339. }
340.
crypto/bn/bn_ctx.c:339:1: return from a call to BN_POOL_init
337. p->head = p->current = p->tail = NULL;
338. p->used = p->size = 0;
339. > }
340.
341. static void BN_POOL_finish(BN_POOL *p)
crypto/bn/bn_ctx.c:199:5:
197. /* Initialise the structure */
198. BN_POOL_init(&ret->pool);
199. > BN_STACK_init(&ret->stack);
200. return ret;
201. }
crypto/bn/bn_ctx.c:294:1: start of procedure BN_STACK_init()
292. /************/
293.
294. > static void BN_STACK_init(BN_STACK *st)
295. {
296. st->indexes = NULL;
crypto/bn/bn_ctx.c:296:5:
294. static void BN_STACK_init(BN_STACK *st)
295. {
296. > st->indexes = NULL;
297. st->depth = st->size = 0;
298. }
crypto/bn/bn_ctx.c:297:5:
295. {
296. st->indexes = NULL;
297. > st->depth = st->size = 0;
298. }
299.
crypto/bn/bn_ctx.c:298:1: return from a call to BN_STACK_init
296. st->indexes = NULL;
297. st->depth = st->size = 0;
298. > }
299.
300. static void BN_STACK_finish(BN_STACK *st)
crypto/bn/bn_ctx.c:200:5:
198. BN_POOL_init(&ret->pool);
199. BN_STACK_init(&ret->stack);
200. > return ret;
201. }
202.
crypto/bn/bn_ctx.c:201:1: return from a call to BN_CTX_new
199. BN_STACK_init(&ret->stack);
200. return ret;
201. > }
202.
203. BN_CTX *BN_CTX_secure_new(void)
crypto/ec/ec_key.c:250:9: Taking false branch
248. if ((order = BN_new()) == NULL)
249. goto err;
250. if ((ctx = BN_CTX_new()) == NULL)
^
251. goto err;
252.
crypto/ec/ec_key.c:253:9: Taking false branch
251. goto err;
252.
253. if (eckey->priv_key == NULL) {
^
254. priv_key = BN_new();
255. if (priv_key == NULL)
crypto/ec/ec_key.c:258:9:
256. goto err;
257. } else
258. > priv_key = eckey->priv_key;
259.
260. if (!EC_GROUP_get_order(eckey->group, order, ctx))
crypto/ec/ec_key.c:260:10:
258. priv_key = eckey->priv_key;
259.
260. > if (!EC_GROUP_get_order(eckey->group, order, ctx))
261. goto err;
262.
crypto/ec/ec_lib.c:351:1: start of procedure EC_GROUP_get_order()
349. }
350.
351. > int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx)
352. {
353. if (!BN_copy(order, group->order))
crypto/ec/ec_lib.c:353:10: Taking false branch
351. int EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx)
352. {
353. if (!BN_copy(order, group->order))
^
354. return 0;
355.
crypto/ec/ec_lib.c:356:13:
354. return 0;
355.
356. > return !BN_is_zero(order);
357. }
358.
crypto/bn/bn_lib.c:899:1: start of procedure BN_is_zero()
897. }
898.
899. > int BN_is_zero(const BIGNUM *a)
900. {
901. return a->top == 0;
crypto/bn/bn_lib.c:901:12: Condition is false
899. int BN_is_zero(const BIGNUM *a)
900. {
901. return a->top == 0;
^
902. }
903.
crypto/bn/bn_lib.c:901:5:
899. int BN_is_zero(const BIGNUM *a)
900. {
901. > return a->top == 0;
902. }
903.
crypto/bn/bn_lib.c:902:1: return from a call to BN_is_zero
900. {
901. return a->top == 0;
902. > }
903.
904. int BN_is_one(const BIGNUM *a)
crypto/ec/ec_lib.c:356:13: Condition is false
354. return 0;
355.
356. return !BN_is_zero(order);
^
357. }
358.
crypto/ec/ec_lib.c:356:12:
354. return 0;
355.
356. > return !BN_is_zero(order);
357. }
358.
crypto/ec/ec_lib.c:356:5:
354. return 0;
355.
356. > return !BN_is_zero(order);
357. }
358.
crypto/ec/ec_lib.c:357:1: return from a call to EC_GROUP_get_order
355.
356. return !BN_is_zero(order);
357. > }
358.
359. int EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor,
crypto/ec/ec_key.c:260:10: Taking false branch
258. priv_key = eckey->priv_key;
259.
260. if (!EC_GROUP_get_order(eckey->group, order, ctx))
^
261. goto err;
262.
crypto/ec/ec_key.c:264:14:
262.
263. do
264. > if (!BN_rand_range(priv_key, order))
265. goto err;
266. while (BN_is_zero(priv_key)) ;
crypto/bn/bn_rand.c:281:1: start of procedure BN_rand_range()
279. }
280.
281. > int BN_rand_range(BIGNUM *r, const BIGNUM *range)
282. {
283. return bn_rand_range(0, r, range);
crypto/bn/bn_rand.c:283:5: Skipping bn_rand_range(): empty list of specs
281. int BN_rand_range(BIGNUM *r, const BIGNUM *range)
282. {
283. return bn_rand_range(0, r, range);
^
284. }
285.
crypto/bn/bn_rand.c:284:1: return from a call to BN_rand_range
282. {
283. return bn_rand_range(0, r, range);
284. > }
285.
286. int BN_pseudo_rand_range(BIGNUM *r, const BIGNUM *range)
crypto/ec/ec_key.c:264:14: Taking false branch
262.
263. do
264. if (!BN_rand_range(priv_key, order))
^
265. goto err;
266. while (BN_is_zero(priv_key)) ;
crypto/ec/ec_key.c:266:12:
264. if (!BN_rand_range(priv_key, order))
265. goto err;
266. > while (BN_is_zero(priv_key)) ;
267.
268. if (eckey->pub_key == NULL) {
crypto/bn/bn_lib.c:899:1: start of procedure BN_is_zero()
897. }
898.
899. > int BN_is_zero(const BIGNUM *a)
900. {
901. return a->top == 0;
crypto/bn/bn_lib.c:901:12: Condition is false
899. int BN_is_zero(const BIGNUM *a)
900. {
901. return a->top == 0;
^
902. }
903.
crypto/bn/bn_lib.c:901:5:
899. int BN_is_zero(const BIGNUM *a)
900. {
901. > return a->top == 0;
902. }
903.
crypto/bn/bn_lib.c:902:1: return from a call to BN_is_zero
900. {
901. return a->top == 0;
902. > }
903.
904. int BN_is_one(const BIGNUM *a)
crypto/ec/ec_key.c:266:12: Loop condition is false. Leaving loop
264. if (!BN_rand_range(priv_key, order))
265. goto err;
266. while (BN_is_zero(priv_key)) ;
^
267.
268. if (eckey->pub_key == NULL) {
crypto/ec/ec_key.c:268:9: Taking true branch
266. while (BN_is_zero(priv_key)) ;
267.
268. if (eckey->pub_key == NULL) {
^
269. pub_key = EC_POINT_new(eckey->group);
270. if (pub_key == NULL)
crypto/ec/ec_key.c:269:9:
267.
268. if (eckey->pub_key == NULL) {
269. > pub_key = EC_POINT_new(eckey->group);
270. if (pub_key == NULL)
271. goto err;
crypto/ec/ec_lib.c:561:1: start of procedure EC_POINT_new()
559. /* functions for EC_POINT objects */
560.
561. > EC_POINT *EC_POINT_new(const EC_GROUP *group)
562. {
563. EC_POINT *ret;
crypto/ec/ec_lib.c:565:9: Taking false branch
563. EC_POINT *ret;
564.
565. if (group == NULL) {
^
566. ECerr(EC_F_EC_POINT_NEW, ERR_R_PASSED_NULL_PARAMETER);
567. return NULL;
crypto/ec/ec_lib.c:569:9: Taking false branch
567. return NULL;
568. }
569. if (group->meth->point_init == 0) {
^
570. ECerr(EC_F_EC_POINT_NEW, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
571. return NULL;
crypto/ec/ec_lib.c:574:5:
572. }
573.
574. > ret = OPENSSL_malloc(sizeof(*ret));
575. if (ret == NULL) {
576. ECerr(EC_F_EC_POINT_NEW, ERR_R_MALLOC_FAILURE);
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/ec/ec_lib.c:575:9: Taking false branch
573.
574. ret = OPENSSL_malloc(sizeof(*ret));
575. if (ret == NULL) {
^
576. ECerr(EC_F_EC_POINT_NEW, ERR_R_MALLOC_FAILURE);
577. return NULL;
crypto/ec/ec_lib.c:580:5:
578. }
579.
580. > ret->meth = group->meth;
581.
582. if (!ret->meth->point_init(ret)) {
crypto/ec/ec_lib.c:582:10: Taking true branch
580. ret->meth = group->meth;
581.
582. if (!ret->meth->point_init(ret)) {
^
583. OPENSSL_free(ret);
584. return NULL;
crypto/ec/ec_lib.c:583:9:
581.
582. if (!ret->meth->point_init(ret)) {
583. > OPENSSL_free(ret);
584. return NULL;
585. }
crypto/mem.c:234:1: start of procedure CRYPTO_free()
232. }
233.
234. > void CRYPTO_free(void *str)
235. {
236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
crypto/mem.c:245:5:
243. }
244. #else
245. > free(str);
246. #endif
247. }
crypto/mem.c:247:1: return from a call to CRYPTO_free
245. free(str);
246. #endif
247. > }
248.
249. void CRYPTO_clear_free(void *str, size_t num)
crypto/ec/ec_lib.c:584:9:
582. if (!ret->meth->point_init(ret)) {
583. OPENSSL_free(ret);
584. > return NULL;
585. }
586.
crypto/ec/ec_lib.c:588:1: return from a call to EC_POINT_new
586.
587. return ret;
588. > }
589.
590. void EC_POINT_free(EC_POINT *point)
crypto/ec/ec_key.c:270:13: Taking true branch
268. if (eckey->pub_key == NULL) {
269. pub_key = EC_POINT_new(eckey->group);
270. if (pub_key == NULL)
^
271. goto err;
272. } else
crypto/ec/ec_key.c:283:2:
281. ok = 1;
282.
283. > err:
284. BN_free(order);
285. if (eckey->pub_key == NULL)
crypto/ec/ec_key.c:284:5:
282.
283. err:
284. > BN_free(order);
285. if (eckey->pub_key == NULL)
286. EC_POINT_free(pub_key);
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/crypto/ec/ec_key.c/#L284
|
d2a_code_trace_data_42679
|
int
TIFFReadDirectory(TIFF* tif)
{
static const char module[] = "TIFFReadDirectory";
TIFFDirEntry* dir;
uint16 dircount;
TIFFDirEntry* dp;
uint16 di;
const TIFFField* fip;
uint32 fii;
toff_t nextdiroff;
tif->tif_diroff=tif->tif_nextdiroff;
if (!TIFFCheckDirOffset(tif,tif->tif_nextdiroff))
return 0;
(*tif->tif_cleanup)(tif);
tif->tif_curdir++;
nextdiroff = tif->tif_nextdiroff;
dircount=TIFFFetchDirectory(tif,nextdiroff,&dir,&tif->tif_nextdiroff);
if (!dircount)
{
TIFFErrorExt(tif->tif_clientdata,module,
"Failed to read directory at offset " TIFF_UINT64_FORMAT,nextdiroff);
return 0;
}
TIFFReadDirectoryCheckOrder(tif,dir,dircount);
tif->tif_flags &= ~TIFF_BEENWRITING;
tif->tif_flags &= ~TIFF_BUF4WRITE;
TIFFFreeDirectory(tif);
TIFFDefaultDirectory(tif);
TIFFSetField(tif,TIFFTAG_PLANARCONFIG,PLANARCONFIG_CONTIG);
dp=TIFFReadDirectoryFindEntry(tif,dir,dircount,TIFFTAG_SAMPLESPERPIXEL);
if (dp)
{
if (!TIFFFetchNormalTag(tif,dp,0))
goto bad;
dp->tdir_tag=IGNORE;
}
dp=TIFFReadDirectoryFindEntry(tif,dir,dircount,TIFFTAG_COMPRESSION);
if (dp)
{
uint16 value;
enum TIFFReadDirEntryErr err;
err=TIFFReadDirEntryShort(tif,dp,&value);
if (err==TIFFReadDirEntryErrCount)
err=TIFFReadDirEntryPersampleShort(tif,dp,&value);
if (err!=TIFFReadDirEntryErrOk)
{
TIFFReadDirEntryOutputErr(tif,err,module,"Compression",0);
goto bad;
}
if (!TIFFSetField(tif,TIFFTAG_COMPRESSION,value))
goto bad;
dp->tdir_tag=IGNORE;
}
else
{
if (!TIFFSetField(tif,TIFFTAG_COMPRESSION,COMPRESSION_NONE))
goto bad;
}
for (di=0, dp=dir; di<dircount; di++, dp++)
{
if (dp->tdir_tag!=IGNORE)
{
TIFFReadDirectoryFindFieldInfo(tif,dp->tdir_tag,&fii);
if (fii==(uint32)(-1))
{
TIFFWarningExt(tif->tif_clientdata, module,
"Unknown field with tag %d (0x%x) encountered",
dp->tdir_tag,dp->tdir_tag);
if (!_TIFFMergeFields(tif,
_TIFFCreateAnonField(tif,
dp->tdir_tag,
(TIFFDataType) dp->tdir_type),
1)) {
TIFFWarningExt(tif->tif_clientdata,
module,
"Registering anonymous field with tag %d (0x%x) failed",
dp->tdir_tag,
dp->tdir_tag);
dp->tdir_tag=IGNORE;
} else {
TIFFReadDirectoryFindFieldInfo(tif,dp->tdir_tag,&fii);
assert(fii!=(uint32)(-1));
}
}
}
if (dp->tdir_tag!=IGNORE)
{
fip=tif->tif_fields[fii];
if (fip->field_bit==FIELD_IGNORE)
dp->tdir_tag=IGNORE;
else
{
switch (dp->tdir_tag)
{
case TIFFTAG_STRIPOFFSETS:
case TIFFTAG_STRIPBYTECOUNTS:
case TIFFTAG_TILEOFFSETS:
case TIFFTAG_TILEBYTECOUNTS:
TIFFSetFieldBit(tif,fip->field_bit);
break;
case TIFFTAG_IMAGEWIDTH:
case TIFFTAG_IMAGELENGTH:
case TIFFTAG_IMAGEDEPTH:
case TIFFTAG_TILELENGTH:
case TIFFTAG_TILEWIDTH:
case TIFFTAG_TILEDEPTH:
case TIFFTAG_PLANARCONFIG:
case TIFFTAG_ROWSPERSTRIP:
case TIFFTAG_EXTRASAMPLES:
if (!TIFFFetchNormalTag(tif,dp,0))
goto bad;
dp->tdir_tag=IGNORE;
break;
}
}
}
}
if ((tif->tif_dir.td_compression==COMPRESSION_OJPEG)&&
(tif->tif_dir.td_planarconfig==PLANARCONFIG_SEPARATE))
{
dp=TIFFReadDirectoryFindEntry(tif,dir,dircount,TIFFTAG_STRIPOFFSETS);
if ((dp!=0)&&(dp->tdir_count==1))
{
dp=TIFFReadDirectoryFindEntry(tif,dir,dircount,
TIFFTAG_STRIPBYTECOUNTS);
if ((dp!=0)&&(dp->tdir_count==1))
{
tif->tif_dir.td_planarconfig=PLANARCONFIG_CONTIG;
TIFFWarningExt(tif->tif_clientdata,module,
"Planarconfig tag value assumed incorrect, "
"assuming data is contig instead of chunky");
}
}
}
if (!TIFFFieldSet(tif,FIELD_IMAGEDIMENSIONS))
{
MissingRequired(tif,"ImageLength");
goto bad;
}
if (!TIFFFieldSet(tif, FIELD_TILEDIMENSIONS)) {
tif->tif_dir.td_nstrips = TIFFNumberOfStrips(tif);
tif->tif_dir.td_tilewidth = tif->tif_dir.td_imagewidth;
tif->tif_dir.td_tilelength = tif->tif_dir.td_rowsperstrip;
tif->tif_dir.td_tiledepth = tif->tif_dir.td_imagedepth;
tif->tif_flags &= ~TIFF_ISTILED;
} else {
tif->tif_dir.td_nstrips = TIFFNumberOfTiles(tif);
tif->tif_flags |= TIFF_ISTILED;
}
if (!tif->tif_dir.td_nstrips) {
TIFFErrorExt(tif->tif_clientdata, module,
"Cannot handle zero number of %s",
isTiled(tif) ? "tiles" : "strips");
goto bad;
}
tif->tif_dir.td_stripsperimage = tif->tif_dir.td_nstrips;
if (tif->tif_dir.td_planarconfig == PLANARCONFIG_SEPARATE)
tif->tif_dir.td_stripsperimage /= tif->tif_dir.td_samplesperpixel;
if (!TIFFFieldSet(tif, FIELD_STRIPOFFSETS)) {
if ((tif->tif_dir.td_compression==COMPRESSION_OJPEG) &&
(isTiled(tif)==0) &&
(tif->tif_dir.td_nstrips==1)) {
TIFFSetFieldBit(tif, FIELD_STRIPOFFSETS);
} else {
MissingRequired(tif,
isTiled(tif) ? "TileOffsets" : "StripOffsets");
goto bad;
}
}
for (di=0, dp=dir; di<dircount; di++, dp++)
{
switch (dp->tdir_tag)
{
case IGNORE:
break;
case TIFFTAG_MINSAMPLEVALUE:
case TIFFTAG_MAXSAMPLEVALUE:
case TIFFTAG_BITSPERSAMPLE:
case TIFFTAG_DATATYPE:
case TIFFTAG_SAMPLEFORMAT:
{
uint16 value;
enum TIFFReadDirEntryErr err;
err=TIFFReadDirEntryShort(tif,dp,&value);
if (err==TIFFReadDirEntryErrCount)
err=TIFFReadDirEntryPersampleShort(tif,dp,&value);
if (err!=TIFFReadDirEntryErrOk)
{
TIFFReadDirEntryOutputErr(tif,err,module,TIFFFieldWithTag(tif,dp->tdir_tag)->field_name,0);
goto bad;
}
if (!TIFFSetField(tif,dp->tdir_tag,value))
goto bad;
}
break;
case TIFFTAG_SMINSAMPLEVALUE:
case TIFFTAG_SMAXSAMPLEVALUE:
{
double value;
enum TIFFReadDirEntryErr err;
err=TIFFReadDirEntryPersampleDouble(tif,dp,&value);
if (err!=TIFFReadDirEntryErrOk)
{
TIFFReadDirEntryOutputErr(tif,err,module,TIFFFieldWithTag(tif,dp->tdir_tag)->field_name,0);
goto bad;
}
if (!TIFFSetField(tif,dp->tdir_tag,value))
goto bad;
}
break;
case TIFFTAG_STRIPOFFSETS:
case TIFFTAG_TILEOFFSETS:
if (!TIFFFetchStripThing(tif,dp,tif->tif_dir.td_nstrips,&tif->tif_dir.td_stripoffset))
goto bad;
break;
case TIFFTAG_STRIPBYTECOUNTS:
case TIFFTAG_TILEBYTECOUNTS:
if (!TIFFFetchStripThing(tif,dp,tif->tif_dir.td_nstrips,&tif->tif_dir.td_stripbytecount))
goto bad;
break;
case TIFFTAG_COLORMAP:
case TIFFTAG_TRANSFERFUNCTION:
{
enum TIFFReadDirEntryErr err;
uint32 countpersample;
uint32 countrequired;
uint32 incrementpersample;
uint16* value;
countpersample=(1L<<tif->tif_dir.td_bitspersample);
if ((dp->tdir_tag==TIFFTAG_TRANSFERFUNCTION)&&(dp->tdir_count==(uint64)countpersample))
{
countrequired=countpersample;
incrementpersample=0;
}
else
{
countrequired=3*countpersample;
incrementpersample=countpersample;
}
if (dp->tdir_count!=(uint64)countrequired)
err=TIFFReadDirEntryErrCount;
else
err=TIFFReadDirEntryShortArray(tif,dp,&value);
if (err!=TIFFReadDirEntryErrOk)
TIFFReadDirEntryOutputErr(tif,err,module,TIFFFieldWithTag(tif,dp->tdir_tag)->field_name,1);
else
{
TIFFSetField(tif,dp->tdir_tag,value,value+incrementpersample,value+2*incrementpersample);
_TIFFfree(value);
}
}
break;
case TIFFTAG_OSUBFILETYPE:
{
uint16 valueo;
uint32 value;
if (TIFFReadDirEntryShort(tif,dp,&valueo)==TIFFReadDirEntryErrOk)
{
switch (valueo)
{
case OFILETYPE_REDUCEDIMAGE: value=FILETYPE_REDUCEDIMAGE; break;
case OFILETYPE_PAGE: value=FILETYPE_PAGE; break;
default: value=0; break;
}
if (value!=0)
TIFFSetField(tif,TIFFTAG_SUBFILETYPE,value);
}
}
break;
default:
(void) TIFFFetchNormalTag(tif, dp, TRUE);
break;
}
}
if (tif->tif_dir.td_compression==COMPRESSION_OJPEG)
{
if (!TIFFFieldSet(tif,FIELD_PHOTOMETRIC))
{
TIFFWarningExt(tif->tif_clientdata, module,
"Photometric tag is missing, assuming data is YCbCr");
if (!TIFFSetField(tif,TIFFTAG_PHOTOMETRIC,PHOTOMETRIC_YCBCR))
goto bad;
}
else if (tif->tif_dir.td_photometric==PHOTOMETRIC_RGB)
{
tif->tif_dir.td_photometric=PHOTOMETRIC_YCBCR;
TIFFWarningExt(tif->tif_clientdata, module,
"Photometric tag value assumed incorrect, "
"assuming data is YCbCr instead of RGB");
}
if (!TIFFFieldSet(tif,FIELD_BITSPERSAMPLE))
{
TIFFWarningExt(tif->tif_clientdata,module,
"BitsPerSample tag is missing, assuming 8 bits per sample");
if (!TIFFSetField(tif,TIFFTAG_BITSPERSAMPLE,8))
goto bad;
}
if (!TIFFFieldSet(tif,FIELD_SAMPLESPERPIXEL))
{
if ((tif->tif_dir.td_photometric==PHOTOMETRIC_RGB)
|| (tif->tif_dir.td_photometric==PHOTOMETRIC_YCBCR))
{
TIFFWarningExt(tif->tif_clientdata,module,
"SamplesPerPixel tag is missing, "
"assuming correct SamplesPerPixel value is 3");
if (!TIFFSetField(tif,TIFFTAG_SAMPLESPERPIXEL,3))
goto bad;
}
else if ((tif->tif_dir.td_photometric==PHOTOMETRIC_MINISWHITE)
|| (tif->tif_dir.td_photometric==PHOTOMETRIC_MINISBLACK))
{
TIFFWarningExt(tif->tif_clientdata,module,
"SamplesPerPixel tag is missing, "
"assuming correct SamplesPerPixel value is 1");
if (!TIFFSetField(tif,TIFFTAG_SAMPLESPERPIXEL,1))
goto bad;
}
}
}
if (tif->tif_dir.td_photometric == PHOTOMETRIC_PALETTE &&
!TIFFFieldSet(tif, FIELD_COLORMAP)) {
MissingRequired(tif, "Colormap");
goto bad;
}
if (tif->tif_dir.td_compression!=COMPRESSION_OJPEG)
{
if (!TIFFFieldSet(tif, FIELD_STRIPBYTECOUNTS)) {
if ((tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG &&
tif->tif_dir.td_nstrips > 1) ||
(tif->tif_dir.td_planarconfig == PLANARCONFIG_SEPARATE &&
tif->tif_dir.td_nstrips != (uint32)tif->tif_dir.td_samplesperpixel)) {
MissingRequired(tif, "StripByteCounts");
goto bad;
}
TIFFWarningExt(tif->tif_clientdata, module,
"TIFF directory is missing required "
"\"%s\" field, calculating from imagelength",
TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name);
if (EstimateStripByteCounts(tif, dir, dircount) < 0)
goto bad;
#define BYTECOUNTLOOKSBAD \
( (tif->tif_dir.td_stripbytecount[0] == 0 && tif->tif_dir.td_stripoffset[0] != 0) || \
(tif->tif_dir.td_compression == COMPRESSION_NONE && \
tif->tif_dir.td_stripbytecount[0] > TIFFGetFileSize(tif) - tif->tif_dir.td_stripoffset[0]) || \
(tif->tif_mode == O_RDONLY && \
tif->tif_dir.td_compression == COMPRESSION_NONE && \
tif->tif_dir.td_stripbytecount[0] < TIFFScanlineSize64(tif) * tif->tif_dir.td_imagelength) )
} else if (tif->tif_dir.td_nstrips == 1
&& tif->tif_dir.td_stripoffset[0] != 0
&& BYTECOUNTLOOKSBAD) {
TIFFWarningExt(tif->tif_clientdata, module,
"Bogus \"%s\" field, ignoring and calculating from imagelength",
TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name);
if(EstimateStripByteCounts(tif, dir, dircount) < 0)
goto bad;
} else if (tif->tif_dir.td_planarconfig == PLANARCONFIG_CONTIG
&& tif->tif_dir.td_nstrips > 2
&& tif->tif_dir.td_compression == COMPRESSION_NONE
&& tif->tif_dir.td_stripbytecount[0] != tif->tif_dir.td_stripbytecount[1]
&& tif->tif_dir.td_stripbytecount[0] != 0
&& tif->tif_dir.td_stripbytecount[1] != 0 ) {
TIFFWarningExt(tif->tif_clientdata, module,
"Wrong \"%s\" field, ignoring and calculating from imagelength",
TIFFFieldWithTag(tif,TIFFTAG_STRIPBYTECOUNTS)->field_name);
if (EstimateStripByteCounts(tif, dir, dircount) < 0)
goto bad;
}
}
if (dir)
{
_TIFFfree(dir);
dir=NULL;
}
if (!TIFFFieldSet(tif, FIELD_MAXSAMPLEVALUE))
{
if (tif->tif_dir.td_bitspersample>=16)
tif->tif_dir.td_maxsamplevalue=0xFFFF;
else
tif->tif_dir.td_maxsamplevalue = (uint16)((1L<<tif->tif_dir.td_bitspersample)-1);
}
if (tif->tif_dir.td_nstrips > 1) {
uint32 strip;
tif->tif_dir.td_stripbytecountsorted = 1;
for (strip = 1; strip < tif->tif_dir.td_nstrips; strip++) {
if (tif->tif_dir.td_stripoffset[strip - 1] >
tif->tif_dir.td_stripoffset[strip]) {
tif->tif_dir.td_stripbytecountsorted = 0;
break;
}
}
}
(*tif->tif_fixuptags)(tif);
if ((tif->tif_dir.td_planarconfig==PLANARCONFIG_CONTIG)&&
(tif->tif_dir.td_nstrips==1)&&
(tif->tif_dir.td_compression==COMPRESSION_NONE)&&
((tif->tif_flags&(TIFF_STRIPCHOP|TIFF_ISTILED))==TIFF_STRIPCHOP))
ChopUpSingleUncompressedStrip(tif);
tif->tif_flags &= ~TIFF_DIRTYDIRECT;
tif->tif_flags &= ~TIFF_DIRTYSTRIP;
tif->tif_row = (uint32) -1;
tif->tif_curstrip = (uint32) -1;
tif->tif_col = (uint32) -1;
tif->tif_curtile = (uint32) -1;
tif->tif_tilesize = (tmsize_t) -1;
tif->tif_scanlinesize = TIFFScanlineSize(tif);
if (!tif->tif_scanlinesize) {
TIFFErrorExt(tif->tif_clientdata, module,
"Cannot handle zero scanline size");
return (0);
}
if (isTiled(tif)) {
tif->tif_tilesize = TIFFTileSize(tif);
if (!tif->tif_tilesize) {
TIFFErrorExt(tif->tif_clientdata, module,
"Cannot handle zero tile size");
return (0);
}
} else {
if (!TIFFStripSize(tif)) {
TIFFErrorExt(tif->tif_clientdata, module,
"Cannot handle zero strip size");
return (0);
}
}
return (1);
bad:
if (dir)
_TIFFfree(dir);
return (0);
}
contrib/addtiffo/tif_overview.c:836: error: Buffer Overrun L3
Offset: 1 Size: [0, +oo] by call to `TIFFCreateOvrCache`.
contrib/addtiffo/tif_overview.c:827:22: Call
825. }
826.
827. nDirOffset = TIFF_WriteOverview( hTIFF, nOXSize, nOYSize,
^
828. nBitsPerPixel, nPlanarConfig,
829. nSamples, nOBlockXSize, nOBlockYSize,
contrib/addtiffo/tif_overview.c:146:9: Call
144. /* Write directory, and return byte offset. */
145. /* -------------------------------------------------------------------- */
146. if( TIFFWriteCheck( hTIFF, bTiled, "TIFFBuildOverviews" ) == 0 )
^
147. return 0;
148.
libtiff/tif_write.c:488:1: Parameter `*tif->tif_dir.td_stripbytecount`
486. * that important information is not changed.
487. */
488. int
^
489. TIFFWriteCheck(TIFF* tif, int tiles, const char* module)
490. {
contrib/addtiffo/tif_overview.c:836:25: Call
834. nHorSubsampling, nVerSubsampling );
835.
836. papoRawBIs[i] = TIFFCreateOvrCache( hTIFF, nDirOffset );
^
837. }
838.
contrib/addtiffo/tif_ovrcache.c:43:1: Parameter `*hTIFF->tif_dir.td_stripbytecount`
41. /************************************************************************/
42.
43. TIFFOvrCache *TIFFCreateOvrCache( TIFF *hTIFF, toff_t nDirOffset )
^
44.
45. {
contrib/addtiffo/tif_ovrcache.c:57:5: Call
55. /* -------------------------------------------------------------------- */
56. nBaseDirOffset = TIFFCurrentDirOffset( psCache->hTIFF );
57. TIFFSetSubDirectory( hTIFF, nDirOffset );
^
58.
59. TIFFGetField( hTIFF, TIFFTAG_IMAGEWIDTH, &(psCache->nXSize) );
libtiff/tif_dir.c:1384:1: Parameter `*tif->tif_dir.td_stripbytecount`
1382. * the SubIFD tag (e.g. thumbnail images).
1383. */
1384. int
^
1385. TIFFSetSubDirectory(TIFF* tif, uint64 diroff)
1386. {
libtiff/tif_dir.c:1393:10: Call
1391. */
1392. tif->tif_dirnumber = 0;
1393. return (TIFFReadDirectory(tif));
^
1394. }
1395.
libtiff/tif_dirread.c:3389:1: <Length trace>
3387. * format. We read directories sequentially.
3388. */
3389. int
^
3390. TIFFReadDirectory(TIFF* tif)
3391. {
libtiff/tif_dirread.c:3389:1: Parameter `*tif->tif_dir.td_stripbytecount`
3387. * format. We read directories sequentially.
3388. */
3389. int
^
3390. TIFFReadDirectory(TIFF* tif)
3391. {
libtiff/tif_dirread.c:3417:2: Call
3415. tif->tif_flags &= ~TIFF_BUF4WRITE; /* reset before new dir */
3416. /* free any old stuff and reinit */
3417. TIFFFreeDirectory(tif);
^
3418. TIFFDefaultDirectory(tif);
3419. /*
libtiff/tif_dir.c:1065:1: Parameter `*tif->tif_dir.td_stripbytecount`
1063. * Release storage associated with a directory.
1064. */
1065. void
^
1066. TIFFFreeDirectory(TIFF* tif)
1067. {
libtiff/tif_dirread.c:3872:47: Array access: Offset: 1 Size: [0, +oo] by call to `TIFFCreateOvrCache`
3870. && tif->tif_dir.td_nstrips > 2
3871. && tif->tif_dir.td_compression == COMPRESSION_NONE
3872. && tif->tif_dir.td_stripbytecount[0] != tif->tif_dir.td_stripbytecount[1]
^
3873. && tif->tif_dir.td_stripbytecount[0] != 0
3874. && tif->tif_dir.td_stripbytecount[1] != 0 ) {
|
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_dirread.c/#L3872
|
d2a_code_trace_data_42680
|
static SwsVector *sws_getShiftedVec(SwsVector *a, int shift){
int length= a->length + FFABS(shift)*2;
double *coeff= av_malloc(length*sizeof(double));
int i;
SwsVector *vec= av_malloc(sizeof(SwsVector));
vec->coeff= coeff;
vec->length= length;
for (i=0; i<length; i++) coeff[i]= 0.0;
for (i=0; i<a->length; i++)
{
coeff[i + (length-1)/2 - (a->length-1)/2 - shift]= a->coeff[i];
}
return vec;
}
libswscale/swscale.c:3012: error: Null Dereference
pointer `vec` last assigned on line 3010 could be null and is dereferenced at line 3012, column 5.
libswscale/swscale.c:3006:1: start of procedure sws_getShiftedVec()
3004.
3005. /* shift left / or right if "shift" is negative */
3006. static SwsVector *sws_getShiftedVec(SwsVector *a, int shift){
^
3007. int length= a->length + FFABS(shift)*2;
3008. double *coeff= av_malloc(length*sizeof(double));
libswscale/swscale.c:3007:29: Condition is true
3005. /* shift left / or right if "shift" is negative */
3006. static SwsVector *sws_getShiftedVec(SwsVector *a, int shift){
3007. int length= a->length + FFABS(shift)*2;
^
3008. double *coeff= av_malloc(length*sizeof(double));
3009. int i;
libswscale/swscale.c:3007:5:
3005. /* shift left / or right if "shift" is negative */
3006. static SwsVector *sws_getShiftedVec(SwsVector *a, int shift){
3007. int length= a->length + FFABS(shift)*2;
^
3008. double *coeff= av_malloc(length*sizeof(double));
3009. int i;
libswscale/swscale.c:3008:5:
3006. static SwsVector *sws_getShiftedVec(SwsVector *a, int shift){
3007. int length= a->length + FFABS(shift)*2;
3008. double *coeff= av_malloc(length*sizeof(double));
^
3009. int i;
3010. SwsVector *vec= av_malloc(sizeof(SwsVector));
libavutil/mem.c:47:1: start of procedure av_malloc()
45. linker will do it automatically. */
46.
47. void *av_malloc(unsigned int size)
^
48. {
49. void *ptr = NULL;
libavutil/mem.c:49:5:
47. void *av_malloc(unsigned int size)
48. {
49. void *ptr = NULL;
^
50. #if CONFIG_MEMALIGN_HACK
51. long diff;
libavutil/mem.c:55:8: Taking false branch
53.
54. /* let's disallow possible ambiguous cases */
55. if(size > (INT_MAX-16) )
^
56. return NULL;
57.
libavutil/mem.c:66:9: Taking false branch
64. ((char*)ptr)[-1]= diff;
65. #elif HAVE_POSIX_MEMALIGN
66. if (posix_memalign(&ptr,16,size))
^
67. ptr = NULL;
68. #elif HAVE_MEMALIGN
libavutil/mem.c:99:5:
97. ptr = malloc(size);
98. #endif
99. return ptr;
^
100. }
101.
libavutil/mem.c:100:1: return from a call to av_malloc
98. #endif
99. return ptr;
100. }
^
101.
102. void *av_realloc(void *ptr, unsigned int size)
libswscale/swscale.c:3010:5:
3008. double *coeff= av_malloc(length*sizeof(double));
3009. int i;
3010. SwsVector *vec= av_malloc(sizeof(SwsVector));
^
3011.
3012. vec->coeff= coeff;
libavutil/mem.c:47:1: start of procedure av_malloc()
45. linker will do it automatically. */
46.
47. void *av_malloc(unsigned int size)
^
48. {
49. void *ptr = NULL;
libavutil/mem.c:49:5:
47. void *av_malloc(unsigned int size)
48. {
49. void *ptr = NULL;
^
50. #if CONFIG_MEMALIGN_HACK
51. long diff;
libavutil/mem.c:55:8: Taking false branch
53.
54. /* let's disallow possible ambiguous cases */
55. if(size > (INT_MAX-16) )
^
56. return NULL;
57.
libavutil/mem.c:66:9: Taking true branch
64. ((char*)ptr)[-1]= diff;
65. #elif HAVE_POSIX_MEMALIGN
66. if (posix_memalign(&ptr,16,size))
^
67. ptr = NULL;
68. #elif HAVE_MEMALIGN
libavutil/mem.c:67:9:
65. #elif HAVE_POSIX_MEMALIGN
66. if (posix_memalign(&ptr,16,size))
67. ptr = NULL;
^
68. #elif HAVE_MEMALIGN
69. ptr = memalign(16,size);
libavutil/mem.c:99:5:
97. ptr = malloc(size);
98. #endif
99. return ptr;
^
100. }
101.
libavutil/mem.c:100:1: return from a call to av_malloc
98. #endif
99. return ptr;
100. }
^
101.
102. void *av_realloc(void *ptr, unsigned int size)
libswscale/swscale.c:3012:5:
3010. SwsVector *vec= av_malloc(sizeof(SwsVector));
3011.
3012. vec->coeff= coeff;
^
3013. vec->length= length;
3014.
|
https://github.com/libav/libav/blob/184bc53db4fded8857af09cee2adc7197940deb7/libswscale/swscale.c/#L3012
|
d2a_code_trace_data_42681
|
static int dca_subsubframe(DCAContext * s)
{
int k, l;
int subsubframe = s->current_subsubframe;
const float *quant_step_table;
float subband_samples[DCA_PRIM_CHANNELS_MAX][DCA_SUBBANDS][8];
if (s->bit_rate == 0x1f)
quant_step_table = lossless_quant_d;
else
quant_step_table = lossy_quant_d;
for (k = 0; k < s->prim_channels; k++) {
for (l = 0; l < s->vq_start_subband[k]; l++) {
int m;
int abits = s->bitalloc[k][l];
float quant_step_size = quant_step_table[abits];
float rscale;
int sel = s->quant_index_huffman[k][abits];
if(!abits){
memset(subband_samples[k][l], 0, 8 * sizeof(subband_samples[0][0][0]));
}else if(abits >= 11 || !dca_smpl_bitalloc[abits].vlc[sel].table){
if(abits <= 7){
int block_code1, block_code2, size, levels;
int block[8];
size = abits_sizes[abits-1];
levels = abits_levels[abits-1];
block_code1 = get_bits(&s->gb, size);
decode_blockcode(block_code1, levels, block);
block_code2 = get_bits(&s->gb, size);
decode_blockcode(block_code2, levels, &block[4]);
for (m = 0; m < 8; m++)
subband_samples[k][l][m] = block[m];
}else{
for (m = 0; m < 8; m++)
subband_samples[k][l][m] = get_sbits(&s->gb, abits - 3);
}
}else{
for (m = 0; m < 8; m++)
subband_samples[k][l][m] = get_bitalloc(&s->gb, &dca_smpl_bitalloc[abits], sel);
}
if (s->transition_mode[k][l] &&
subsubframe >= s->transition_mode[k][l])
rscale = quant_step_size * s->scale_factor[k][l][1];
else
rscale = quant_step_size * s->scale_factor[k][l][0];
rscale *= s->scalefactor_adj[k][sel];
for (m = 0; m < 8; m++)
subband_samples[k][l][m] *= rscale;
if (s->prediction_mode[k][l]) {
int n;
for (m = 0; m < 8; m++) {
for (n = 1; n <= 4; n++)
if (m >= n)
subband_samples[k][l][m] +=
(adpcm_vb[s->prediction_vq[k][l]][n - 1] *
subband_samples[k][l][m - n] / 8192);
else if (s->predictor_history)
subband_samples[k][l][m] +=
(adpcm_vb[s->prediction_vq[k][l]][n - 1] *
s->subband_samples_hist[k][l][m - n +
4] / 8192);
}
}
}
for (l = s->vq_start_subband[k]; l < s->subband_activity[k]; l++) {
int m;
if (!s->debug_flag & 0x01) {
av_log(s->avctx, AV_LOG_DEBUG, "Stream with high frequencies VQ coding\n");
s->debug_flag |= 0x01;
}
for (m = 0; m < 8; m++) {
subband_samples[k][l][m] =
high_freq_vq[s->high_freq_vq[k][l]][subsubframe * 8 +
m]
* (float) s->scale_factor[k][l][0] / 16.0;
}
}
}
if (s->aspf || subsubframe == s->subsubframes - 1) {
if (0xFFFF == get_bits(&s->gb, 16)) {
#ifdef TRACE
av_log(s->avctx, AV_LOG_DEBUG, "Got subframe DSYNC\n");
#endif
} else {
av_log(s->avctx, AV_LOG_ERROR, "Didn't get subframe DSYNC\n");
}
}
for (k = 0; k < s->prim_channels; k++)
for (l = 0; l < s->vq_start_subband[k]; l++)
memcpy(s->subband_samples_hist[k][l], &subband_samples[k][l][4],
4 * sizeof(subband_samples[0][0][0]));
for (k = 0; k < s->prim_channels; k++) {
qmf_32_subbands(s, k, subband_samples[k], &s->samples[256 * k],
2.0 / 3 ,
0 );
}
if (s->prim_channels > dca_channels[s->output & DCA_CHANNEL_MASK]) {
dca_downmix(s->samples, s->amode, s->downmix_coef);
}
if (s->output & DCA_LFE) {
int lfe_samples = 2 * s->lfe * s->subsubframes;
int i_channels = dca_channels[s->output & DCA_CHANNEL_MASK];
lfe_interpolation_fir(s->lfe, 2 * s->lfe,
s->lfe_data + lfe_samples +
2 * s->lfe * subsubframe,
&s->samples[256 * i_channels],
256.0, 0 );
}
return 0;
}
libavcodec/dca.c:999: error: Buffer Overrun L2
Offset: [0, 63] Size: 16.
libavcodec/dca.c:848:1: <Offset trace>
846. static const uint8_t abits_levels[7] = { 3, 5, 7, 9, 13, 17, 25 };
847.
848. static int dca_subsubframe(DCAContext * s)
^
849. {
850. int k, l;
libavcodec/dca.c:848:1: Parameter `s->output`
846. static const uint8_t abits_levels[7] = { 3, 5, 7, 9, 13, 17, 25 };
847.
848. static int dca_subsubframe(DCAContext * s)
^
849. {
850. int k, l;
libavcodec/dcadata.h:50:1: <Length trace>
48. };
49.
50. static const uint8_t dca_channels[16] =
^
51. {
52. 1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 6, 7, 8, 8
libavcodec/dcadata.h:50:1: Array declaration
48. };
49.
50. static const uint8_t dca_channels[16] =
^
51. {
52. 1, 2, 2, 2, 2, 3, 3, 4, 4, 5, 6, 6, 6, 7, 8, 8
libavcodec/dca.c:999:28: Array access: Offset: [0, 63] Size: 16
997. /* Down mixing */
998.
999. if (s->prim_channels > dca_channels[s->output & DCA_CHANNEL_MASK]) {
^
1000. dca_downmix(s->samples, s->amode, s->downmix_coef);
1001. }
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dca.c/#L999
|
d2a_code_trace_data_42682
|
unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n) {
unsigned int ret=0, i, j;
do {
++ret;
for(i=0,j=ret;i<n-1;i++) j*=ret;
} while (j<=x);
return (ret-1);
}
libavcodec/vorbis_dec.c:335: error: Integer Overflow L2
([0, +oo] - 1):unsigned32 by call to `ff_vorbis_nth_root`.
libavcodec/vorbis_dec.c:283:21: Assignment
281.
282. used_entries=0;
283. for(ce=0;ce<entries;++ce) {
^
284. flag=get_bits1(gb);
285. if (flag) {
libavcodec/vorbis_dec.c:335:50: Call
333. if (codebook_setup->lookup_type==1) {
334. uint_fast16_t i, j, k;
335. uint_fast16_t codebook_lookup_values=ff_vorbis_nth_root(entries, codebook_setup->dimensions);
^
336. uint_fast16_t codebook_multiplicands[codebook_lookup_values];
337.
libavcodec/vorbis.c:35:1: <LHS trace>
33. /* Helper functions */
34.
35. unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n) { // x^(1/n)
^
36. unsigned int ret=0, i, j;
37.
libavcodec/vorbis.c:35:1: Parameter `n`
33. /* Helper functions */
34.
35. unsigned int ff_vorbis_nth_root(unsigned int x, unsigned int n) { // x^(1/n)
^
36. unsigned int ret=0, i, j;
37.
libavcodec/vorbis.c:40:23: Binary operation: ([0, +oo] - 1):unsigned32 by call to `ff_vorbis_nth_root`
38. do {
39. ++ret;
40. for(i=0,j=ret;i<n-1;i++) j*=ret;
^
41. } while (j<=x);
42.
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vorbis.c/#L40
|
d2a_code_trace_data_42683
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/ec/ecdsa_ossl.c:233: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `bn_mul_mont_fixed_top`.
Showing all 19 steps of the trace
crypto/ec/ecdsa_ossl.c:212:18: Call
210. do {
211. if (in_kinv == NULL || in_r == NULL) {
212. if (!ecdsa_sign_setup(eckey, ctx, &kinv, &ret->r, dgst, dgst_len)) {
^
213. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_ECDSA_LIB);
214. goto err;
crypto/ec/ecdsa_ossl.c:33:1: Parameter `ctx_in->stack.depth`
31. }
32.
33. > static int ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in,
34. BIGNUM **kinvp, BIGNUM **rp,
35. const unsigned char *dgst, int dlen)
crypto/ec/ecdsa_ossl.c:233:17: Call
231. */
232. if (!bn_to_mont_fixed_top(s, ret->r, group->mont_data, ctx)
233. || !bn_mul_mont_fixed_top(s, s, priv_key, group->mont_data, ctx)) {
^
234. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB);
235. goto err;
crypto/bn/bn_mont.c:37:1: Parameter `ctx->stack.depth`
35. }
36.
37. > int bn_mul_mont_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
38. BN_MONT_CTX *mont, BN_CTX *ctx)
39. {
crypto/bn/bn_mont.c:60:5: Call
58. return 0;
59.
60. BN_CTX_start(ctx);
^
61. tmp = BN_CTX_get(ctx);
62. if (tmp == NULL)
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_mont.c:61:11: Call
59.
60. BN_CTX_start(ctx);
61. tmp = BN_CTX_get(ctx);
^
62. if (tmp == NULL)
63. goto err;
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_mont.c:70:14: Call
68. goto err;
69. } else {
70. if (!bn_mul_fixed_top(tmp, a, b, ctx))
^
71. goto err;
72. }
crypto/bn/bn_mul.c:533:5: Call
531. top = al + bl;
532.
533. BN_CTX_start(ctx);
^
534. if ((r == a) || (r == b)) {
535. if ((rr = BN_CTX_get(ctx)) == NULL)
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_mul.c:618:5: Call
616. err:
617. bn_check_top(r);
618. BN_CTX_end(ctx);
^
619. return ret;
620. }
crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <Offset trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: <Length trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `bn_mul_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_42684
|
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;
}
apps/x509.c:924: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_add_word`.
Showing all 22 steps of the trace
apps/x509.c:920:14: Call
918. }
919.
920. serial = load_serial(buf, create, NULL);
^
921. if (serial == NULL)
922. goto end;
apps/apps.c:1372:29: Call
1370. ERR_clear_error();
1371. ret = BN_new();
1372. if (ret == NULL || !rand_serial(ret, ai))
^
1373. BIO_printf(bio_err, "Out of memory\n");
1374. } else {
apps/apps.c:1491:1: Parameter `b->top`
1489. }
1490.
1491. > int rand_serial(BIGNUM *b, ASN1_INTEGER *ai)
1492. {
1493. BIGNUM *btmp;
apps/x509.c:924:10: Call
922. goto end;
923.
924. if (!BN_add_word(serial, 1)) {
^
925. BIO_printf(bio_err, "add_word failure\n");
926. goto end;
crypto/bn/bn_word.c:120:10: Assignment
118. return (i);
119. }
120. for (i = 0; w != 0 && i < a->top; i++) {
^
121. a->d[i] = l = (a->d[i] + w) & BN_MASK2;
122. w = (w > l) ? 1 : 0;
crypto/bn/bn_word.c:125:13: Call
123. }
124. if (w && i == a->top) {
125. if (bn_wexpand(a, a->top + 1) == NULL)
^
126. return 0;
127. a->top++;
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 `BN_add_word`
269. assert(b->top <= words);
270. if (b->top > 0)
271. memcpy(a, b->d, sizeof(*a) * b->top);
^
272.
273. return a;
|
https://github.com/openssl/openssl/blob/2234212c3dde887e0b7fa08277d035cd132e2cce/crypto/bn/bn_lib.c/#L271
|
d2a_code_trace_data_42685
|
void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
{
unsigned long hash;
OPENSSL_LH_NODE *nn, **rn;
void *ret;
lh->error = 0;
rn = getrn(lh, data, &hash);
if (*rn == NULL) {
lh->num_no_delete++;
return (NULL);
} else {
nn = *rn;
*rn = nn->next;
ret = nn->data;
OPENSSL_free(nn);
lh->num_delete++;
}
lh->num_items--;
if ((lh->num_nodes > MIN_NODES) &&
(lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
contract(lh);
return (ret);
}
test/sslcorrupttest.c:244: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned64 by call to `SSL_free`.
Showing all 17 steps of the trace
test/sslcorrupttest.c:223:10: Call
221.
222. /* BIO is freed by create_ssl_connection on error */
223. if (!TEST_true(create_ssl_objects(sctx, cctx, &server, &client, NULL,
^
224. c_to_s_fbio)))
225. goto end;
test/ssltestlib.c:580:21: Call
578.
579. if (*sssl == NULL)
580. serverssl = SSL_new(serverctx);
^
581. else
582. serverssl = *sssl;
ssl/ssl_lib.c:521:1: Parameter `ctx->sessions->num_items`
519. }
520.
521. > SSL *SSL_new(SSL_CTX *ctx)
522. {
523. SSL *s;
test/sslcorrupttest.c:244:5: Call
242. testresult = 1;
243. end:
244. SSL_free(server);
^
245. SSL_free(client);
246. SSL_CTX_free(sctx);
ssl/ssl_lib.c:963:1: Parameter `s->session_ctx->sessions->num_items`
961. }
962.
963. > void SSL_free(SSL *s)
964. {
965. int i;
ssl/ssl_lib.c:993:9: Call
991. /* Make the next call work :-) */
992. if (s->session != NULL) {
993. ssl_clear_bad_session(s);
^
994. SSL_SESSION_free(s->session);
995. }
ssl/ssl_sess.c:1039:1: Parameter `s->session_ctx->sessions->num_items`
1037. }
1038.
1039. > int ssl_clear_bad_session(SSL *s)
1040. {
1041. if ((s->session != NULL) &&
ssl/ssl_sess.c:1044:9: Call
1042. !(s->shutdown & SSL_SENT_SHUTDOWN) &&
1043. !(SSL_in_init(s) || SSL_in_before(s))) {
1044. SSL_CTX_remove_session(s->session_ctx, s->session);
^
1045. return (1);
1046. } else
ssl/ssl_sess.c:725:1: Parameter `ctx->sessions->num_items`
723. }
724.
725. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
726. {
727. return remove_session_lock(ctx, c, 1);
ssl/ssl_sess.c:727:12: Call
725. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
726. {
727. return remove_session_lock(ctx, c, 1);
^
728. }
729.
ssl/ssl_sess.c:730:1: Parameter `ctx->sessions->num_items`
728. }
729.
730. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
731. {
732. SSL_SESSION *r;
ssl/ssl_sess.c:740:17: Call
738. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) {
739. ret = 1;
740. r = lh_SSL_SESSION_delete(ctx->sessions, c);
^
741. SSL_SESSION_list_remove(ctx, c);
742. }
ssl/ssl_locl.h:689:1: Parameter `lh->num_items`
687. } CLIENTHELLO_MSG;
688.
689. > DEFINE_LHASH_OF(SSL_SESSION);
690. /* Needed in ssl_cert.c */
691. DEFINE_LHASH_OF(X509_NAME);
ssl/ssl_locl.h:689:1: Call
687. } CLIENTHELLO_MSG;
688.
689. > DEFINE_LHASH_OF(SSL_SESSION);
690. /* Needed in ssl_cert.c */
691. DEFINE_LHASH_OF(X509_NAME);
crypto/lhash/lhash.c:103:1: <LHS trace>
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:103:1: Parameter `lh->num_items`
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:123:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `SSL_free`
121. }
122.
123. lh->num_items--;
^
124. if ((lh->num_nodes > MIN_NODES) &&
125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
|
https://github.com/openssl/openssl/blob/f3ab6c16c424054c8d6d2c152744dcbaf41c3232/crypto/lhash/lhash.c/#L123
|
d2a_code_trace_data_42686
|
static int estimate_best_b_count(MpegEncContext *s){
AVCodec *codec= avcodec_find_encoder(s->avctx->codec_id);
AVCodecContext *c= avcodec_alloc_context();
AVFrame input[FF_MAX_B_FRAMES+2];
const int scale= s->avctx->brd_scale;
int i, j, out_size, p_lambda, b_lambda, lambda2;
int outbuf_size= s->width * s->height;
uint8_t *outbuf= av_malloc(outbuf_size);
int64_t best_rd= INT64_MAX;
int best_b_count= -1;
assert(scale>=0 && scale <=3);
p_lambda= s->last_lambda_for[AV_PICTURE_TYPE_P];
b_lambda= s->last_lambda_for[AV_PICTURE_TYPE_B];
if(!b_lambda) b_lambda= p_lambda;
lambda2= (b_lambda*b_lambda + (1<<FF_LAMBDA_SHIFT)/2 ) >> FF_LAMBDA_SHIFT;
c->width = s->width >> scale;
c->height= s->height>> scale;
c->flags= CODEC_FLAG_QSCALE | CODEC_FLAG_PSNR | CODEC_FLAG_INPUT_PRESERVED ;
c->flags|= s->avctx->flags & CODEC_FLAG_QPEL;
c->mb_decision= s->avctx->mb_decision;
c->me_cmp= s->avctx->me_cmp;
c->mb_cmp= s->avctx->mb_cmp;
c->me_sub_cmp= s->avctx->me_sub_cmp;
c->pix_fmt = PIX_FMT_YUV420P;
c->time_base= s->avctx->time_base;
c->max_b_frames= s->max_b_frames;
if (avcodec_open(c, codec) < 0)
return -1;
for(i=0; i<s->max_b_frames+2; i++){
int ysize= c->width*c->height;
int csize= (c->width/2)*(c->height/2);
Picture pre_input, *pre_input_ptr= i ? s->input_picture[i-1] : s->next_picture_ptr;
avcodec_get_frame_defaults(&input[i]);
input[i].data[0]= av_malloc(ysize + 2*csize);
input[i].data[1]= input[i].data[0] + ysize;
input[i].data[2]= input[i].data[1] + csize;
input[i].linesize[0]= c->width;
input[i].linesize[1]=
input[i].linesize[2]= c->width/2;
if(pre_input_ptr && (!i || s->input_picture[i-1])) {
pre_input= *pre_input_ptr;
if(pre_input.type != FF_BUFFER_TYPE_SHARED && i) {
pre_input.data[0]+=INPLACE_OFFSET;
pre_input.data[1]+=INPLACE_OFFSET;
pre_input.data[2]+=INPLACE_OFFSET;
}
s->dsp.shrink[scale](input[i].data[0], input[i].linesize[0], pre_input.data[0], pre_input.linesize[0], c->width, c->height);
s->dsp.shrink[scale](input[i].data[1], input[i].linesize[1], pre_input.data[1], pre_input.linesize[1], c->width>>1, c->height>>1);
s->dsp.shrink[scale](input[i].data[2], input[i].linesize[2], pre_input.data[2], pre_input.linesize[2], c->width>>1, c->height>>1);
}
}
for(j=0; j<s->max_b_frames+1; j++){
int64_t rd=0;
if(!s->input_picture[j])
break;
c->error[0]= c->error[1]= c->error[2]= 0;
input[0].pict_type= AV_PICTURE_TYPE_I;
input[0].quality= 1 * FF_QP2LAMBDA;
out_size = avcodec_encode_video(c, outbuf, outbuf_size, &input[0]);
for(i=0; i<s->max_b_frames+1; i++){
int is_p= i % (j+1) == j || i==s->max_b_frames;
input[i+1].pict_type= is_p ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_B;
input[i+1].quality= is_p ? p_lambda : b_lambda;
out_size = avcodec_encode_video(c, outbuf, outbuf_size, &input[i+1]);
rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3);
}
while(out_size){
out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL);
rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3);
}
rd += c->error[0] + c->error[1] + c->error[2];
if(rd < best_rd){
best_rd= rd;
best_b_count= j;
}
}
av_freep(&outbuf);
avcodec_close(c);
av_freep(&c);
for(i=0; i<s->max_b_frames+2; i++){
av_freep(&input[i].data[0]);
}
return best_b_count;
}
libavcodec/mpegvideo_enc.c:963: error: Null Dereference
pointer `c` last assigned on line 946 could be null and is dereferenced at line 963, column 5.
libavcodec/mpegvideo_enc.c:944:1: start of procedure estimate_best_b_count()
942. }
943.
944. static int estimate_best_b_count(MpegEncContext *s){
^
945. AVCodec *codec= avcodec_find_encoder(s->avctx->codec_id);
946. AVCodecContext *c= avcodec_alloc_context();
libavcodec/mpegvideo_enc.c:945:5: Skipping avcodec_find_encoder(): empty list of specs
943.
944. static int estimate_best_b_count(MpegEncContext *s){
945. AVCodec *codec= avcodec_find_encoder(s->avctx->codec_id);
^
946. AVCodecContext *c= avcodec_alloc_context();
947. AVFrame input[FF_MAX_B_FRAMES+2];
libavcodec/mpegvideo_enc.c:946:5:
944. static int estimate_best_b_count(MpegEncContext *s){
945. AVCodec *codec= avcodec_find_encoder(s->avctx->codec_id);
946. AVCodecContext *c= avcodec_alloc_context();
^
947. AVFrame input[FF_MAX_B_FRAMES+2];
948. const int scale= s->avctx->brd_scale;
libavcodec/options.c:536:1: start of procedure avcodec_alloc_context()
534. }
535.
536. AVCodecContext *avcodec_alloc_context(void){
^
537. return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN);
538. }
libavcodec/options.c:537:5:
535.
536. AVCodecContext *avcodec_alloc_context(void){
537. return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN);
^
538. }
539.
libavcodec/options.c:522:1: start of procedure avcodec_alloc_context2()
520. }
521.
522. AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){
^
523. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
524.
libavcodec/options.c:523:5:
521.
522. AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){
523. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
^
524.
525. if(avctx==NULL) return NULL;
libavutil/mem.c:64:1: start of procedure av_malloc()
62. linker will do it automatically. */
63.
64. void *av_malloc(size_t size)
^
65. {
66. void *ptr = NULL;
libavutil/mem.c:66:5:
64. void *av_malloc(size_t size)
65. {
66. void *ptr = NULL;
^
67. #if CONFIG_MEMALIGN_HACK
68. long diff;
libavutil/mem.c:72:8: Taking false branch
70.
71. /* let's disallow possible ambiguous cases */
72. if(size > (INT_MAX-32) )
^
73. return NULL;
74.
libavutil/mem.c:83:9: Taking false branch
81. ((char*)ptr)[-1]= diff;
82. #elif HAVE_POSIX_MEMALIGN
83. if (posix_memalign(&ptr,32,size))
^
84. ptr = NULL;
85. #elif HAVE_MEMALIGN
libavutil/mem.c:114:5:
112. ptr = malloc(size);
113. #endif
114. return ptr;
^
115. }
116.
libavutil/mem.c:115:1: return from a call to av_malloc
113. #endif
114. return ptr;
115. }
^
116.
117. void *av_realloc(void *ptr, size_t size)
libavcodec/options.c:525:8: Taking true branch
523. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
524.
525. if(avctx==NULL) return NULL;
^
526.
527. avcodec_get_context_defaults2(avctx, codec_type);
libavcodec/options.c:525:21:
523. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext));
524.
525. if(avctx==NULL) return NULL;
^
526.
527. avcodec_get_context_defaults2(avctx, codec_type);
libavcodec/options.c:530:1: return from a call to avcodec_alloc_context2
528.
529. return avctx;
530. }
^
531.
532. void avcodec_get_context_defaults(AVCodecContext *s){
libavcodec/options.c:538:1: return from a call to avcodec_alloc_context
536. AVCodecContext *avcodec_alloc_context(void){
537. return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN);
538. }
^
539.
540. int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
libavcodec/mpegvideo_enc.c:948:5:
946. AVCodecContext *c= avcodec_alloc_context();
947. AVFrame input[FF_MAX_B_FRAMES+2];
948. const int scale= s->avctx->brd_scale;
^
949. int i, j, out_size, p_lambda, b_lambda, lambda2;
950. int outbuf_size= s->width * s->height; //FIXME
libavcodec/mpegvideo_enc.c:950:5:
948. const int scale= s->avctx->brd_scale;
949. int i, j, out_size, p_lambda, b_lambda, lambda2;
950. int outbuf_size= s->width * s->height; //FIXME
^
951. uint8_t *outbuf= av_malloc(outbuf_size);
952. int64_t best_rd= INT64_MAX;
libavcodec/mpegvideo_enc.c:951:5:
949. int i, j, out_size, p_lambda, b_lambda, lambda2;
950. int outbuf_size= s->width * s->height; //FIXME
951. uint8_t *outbuf= av_malloc(outbuf_size);
^
952. int64_t best_rd= INT64_MAX;
953. int best_b_count= -1;
libavutil/mem.c:64:1: start of procedure av_malloc()
62. linker will do it automatically. */
63.
64. void *av_malloc(size_t size)
^
65. {
66. void *ptr = NULL;
libavutil/mem.c:66:5:
64. void *av_malloc(size_t size)
65. {
66. void *ptr = NULL;
^
67. #if CONFIG_MEMALIGN_HACK
68. long diff;
libavutil/mem.c:72:8: Taking false branch
70.
71. /* let's disallow possible ambiguous cases */
72. if(size > (INT_MAX-32) )
^
73. return NULL;
74.
libavutil/mem.c:83:9: Taking false branch
81. ((char*)ptr)[-1]= diff;
82. #elif HAVE_POSIX_MEMALIGN
83. if (posix_memalign(&ptr,32,size))
^
84. ptr = NULL;
85. #elif HAVE_MEMALIGN
libavutil/mem.c:114:5:
112. ptr = malloc(size);
113. #endif
114. return ptr;
^
115. }
116.
libavutil/mem.c:115:1: return from a call to av_malloc
113. #endif
114. return ptr;
115. }
^
116.
117. void *av_realloc(void *ptr, size_t size)
libavcodec/mpegvideo_enc.c:952:5:
950. int outbuf_size= s->width * s->height; //FIXME
951. uint8_t *outbuf= av_malloc(outbuf_size);
952. int64_t best_rd= INT64_MAX;
^
953. int best_b_count= -1;
954.
libavcodec/mpegvideo_enc.c:953:5:
951. uint8_t *outbuf= av_malloc(outbuf_size);
952. int64_t best_rd= INT64_MAX;
953. int best_b_count= -1;
^
954.
955. assert(scale>=0 && scale <=3);
libavcodec/mpegvideo_enc.c:955:5:
953. int best_b_count= -1;
954.
955. assert(scale>=0 && scale <=3);
^
956.
957. // emms_c();
libavcodec/mpegvideo_enc.c:958:5:
956.
957. // emms_c();
958. p_lambda= s->last_lambda_for[AV_PICTURE_TYPE_P]; //s->next_picture_ptr->quality;
^
959. b_lambda= s->last_lambda_for[AV_PICTURE_TYPE_B]; //p_lambda *FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset;
960. if(!b_lambda) b_lambda= p_lambda; //FIXME we should do this somewhere else
libavcodec/mpegvideo_enc.c:959:5:
957. // emms_c();
958. p_lambda= s->last_lambda_for[AV_PICTURE_TYPE_P]; //s->next_picture_ptr->quality;
959. b_lambda= s->last_lambda_for[AV_PICTURE_TYPE_B]; //p_lambda *FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset;
^
960. if(!b_lambda) b_lambda= p_lambda; //FIXME we should do this somewhere else
961. lambda2= (b_lambda*b_lambda + (1<<FF_LAMBDA_SHIFT)/2 ) >> FF_LAMBDA_SHIFT;
libavcodec/mpegvideo_enc.c:960:9: Taking false branch
958. p_lambda= s->last_lambda_for[AV_PICTURE_TYPE_P]; //s->next_picture_ptr->quality;
959. b_lambda= s->last_lambda_for[AV_PICTURE_TYPE_B]; //p_lambda *FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset;
960. if(!b_lambda) b_lambda= p_lambda; //FIXME we should do this somewhere else
^
961. lambda2= (b_lambda*b_lambda + (1<<FF_LAMBDA_SHIFT)/2 ) >> FF_LAMBDA_SHIFT;
962.
libavcodec/mpegvideo_enc.c:961:5:
959. b_lambda= s->last_lambda_for[AV_PICTURE_TYPE_B]; //p_lambda *FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset;
960. if(!b_lambda) b_lambda= p_lambda; //FIXME we should do this somewhere else
961. lambda2= (b_lambda*b_lambda + (1<<FF_LAMBDA_SHIFT)/2 ) >> FF_LAMBDA_SHIFT;
^
962.
963. c->width = s->width >> scale;
libavcodec/mpegvideo_enc.c:963:5:
961. lambda2= (b_lambda*b_lambda + (1<<FF_LAMBDA_SHIFT)/2 ) >> FF_LAMBDA_SHIFT;
962.
963. c->width = s->width >> scale;
^
964. c->height= s->height>> scale;
965. c->flags= CODEC_FLAG_QSCALE | CODEC_FLAG_PSNR | CODEC_FLAG_INPUT_PRESERVED /*| CODEC_FLAG_EMU_EDGE*/;
|
https://github.com/libav/libav/blob/6a9c85944427e3c4355bce67d7f677ec69527bff/libavcodec/mpegvideo_enc.c/#L963
|
d2a_code_trace_data_42687
|
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
{
int i, j, max;
const BN_ULONG *ap;
BN_ULONG *rp;
max = n * 2;
ap = a;
rp = r;
rp[0] = rp[max - 1] = 0;
rp++;
j = n;
if (--j > 0) {
ap++;
rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
rp += 2;
}
for (i = n - 2; i > 0; i--) {
j--;
ap++;
rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]);
rp += 2;
}
bn_add_words(r, r, r, max);
bn_sqr_words(tmp, a, n);
bn_add_words(r, r, tmp, max);
}
crypto/ec/ecdsa_ossl.c:247: error: BUFFER_OVERRUN_L3
Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `ecdsa_sign_setup`.
Showing all 47 steps of the trace
crypto/ec/ecdsa_ossl.c:170:1: Parameter `eckey->group->order->top`
168. }
169.
170. > ECDSA_SIG *ossl_ecdsa_sign_sig(const unsigned char *dgst, int dgst_len,
171. const BIGNUM *in_kinv, const BIGNUM *in_r,
172. EC_KEY *eckey)
crypto/ec/ecdsa_ossl.c:230:9: Call
228. goto err;
229. }
230. i = BN_num_bits(order);
^
231. /*
232. * Need to truncate digest if it is too long: first truncate whole bytes.
crypto/bn/bn_lib.c:139:9: Call
137. bn_check_top(a);
138.
139. if (BN_is_zero(a))
^
140. return 0;
141. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
crypto/bn/bn_lib.c:845:1: Parameter `a->top`
843. }
844.
845. > int BN_is_zero(const BIGNUM *a)
846. {
847. return a->top == 0;
crypto/ec/ecdsa_ossl.c:247:18: Call
245. do {
246. if (in_kinv == NULL || in_r == NULL) {
247. if (!ecdsa_sign_setup(eckey, ctx, &kinv, &ret->r, dgst, dgst_len)) {
^
248. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_ECDSA_LIB);
249. goto err;
crypto/ec/ecdsa_ossl.c:34:1: Parameter `eckey->group->order->top`
32. }
33.
34. > static int ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in,
35. BIGNUM **kinvp, BIGNUM **rp,
36. const unsigned char *dgst, int dlen)
crypto/ec/ecdsa_ossl.c:82:18: Call
80.
81. /* Preallocate space */
82. order_bits = BN_num_bits(order);
^
83. if (!BN_set_bit(k, order_bits)
84. || !BN_set_bit(r, order_bits)
crypto/bn/bn_lib.c:139:9: Call
137. bn_check_top(a);
138.
139. if (BN_is_zero(a))
^
140. return 0;
141. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
crypto/bn/bn_lib.c:845:1: Parameter `a->top`
843. }
844.
845. > int BN_is_zero(const BIGNUM *a)
846. {
847. return a->top == 0;
crypto/ec/ecdsa_ossl.c:100:22: Call
98. }
99. } else {
100. if (!BN_priv_rand_range(k, order)) {
^
101. ECerr(EC_F_ECDSA_SIGN_SETUP,
102. EC_R_RANDOM_NUMBER_GENERATION_FAILED);
crypto/bn/bn_rand.c:182:1: Parameter `range->top`
180. }
181.
182. > int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range)
183. {
184. return bnrand_range(PRIVATE, r, range);
crypto/bn/bn_rand.c:184:12: Call
182. int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range)
183. {
184. return bnrand_range(PRIVATE, r, range);
^
185. }
186.
crypto/bn/bn_rand.c:113:1: Parameter `range->top`
111.
112. /* random number r: 0 <= r < range */
113. > static int bnrand_range(BNRAND_FLAG flag, BIGNUM *r, const BIGNUM *range)
114. {
115. int n;
crypto/ec/ecdsa_ossl.c:132:14: Call
130. }
131. #endif
132. if (!BN_nnmod(r, X, order, ctx)) {
^
133. ECerr(EC_F_ECDSA_SIGN_SETUP, ERR_R_BN_LIB);
134. goto err;
crypto/bn/bn_mod.c:13:1: Parameter `d->top`
11. #include "bn_lcl.h"
12.
13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
14. {
15. /*
crypto/bn/bn_mod.c:20:11: Call
18. */
19.
20. if (!(BN_mod(r, m, d, ctx)))
^
21. return 0;
22. if (!r->neg)
crypto/bn/bn_div.c:137:1: Parameter `divisor->top`
135. * If 'dv' or 'rm' is NULL, the respective value is not returned.
136. */
137. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
138. BN_CTX *ctx)
139. {
crypto/ec/ecdsa_ossl.c:140:10: Call
138.
139. /* compute the inverse of k */
140. if (!ec_group_do_inverse_ord(group, k, k, ctx)) {
^
141. ECerr(EC_F_ECDSA_SIGN_SETUP, ERR_R_BN_LIB);
142. goto err;
crypto/ec/ec_lib.c:1074:1: Parameter `group->order->top`
1072. * other functionality.
1073. */
1074. > int ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res,
1075. const BIGNUM *x, BN_CTX *ctx)
1076. {
crypto/ec/ec_lib.c:1080:16: Call
1078. return group->meth->field_inverse_mod_ord(group, res, x, ctx);
1079. else
1080. return ec_field_inverse_mod_ord(group, res, x, ctx);
^
1081. }
1082.
crypto/ec/ec_lib.c:1020:1: Parameter `group->order->top`
1018. }
1019.
1020. > static int ec_field_inverse_mod_ord(const EC_GROUP *group, BIGNUM *r,
1021. const BIGNUM *x, BN_CTX *ctx)
1022. {
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 `a->top`
43.
44. /* signed sub of b from a. */
45. > int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
46. {
47. int ret, r_neg, cmp_res;
crypto/ec/ec_lib.c:1049:10: Call
1047. * No need for scatter-gather or BN_FLG_CONSTTIME.
1048. */
1049. if (!BN_mod_exp_mont(r, x, e, group->order, ctx, group->mont_data))
^
1050. goto err;
1051.
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:1098:18: Call
1096.
1097. /* Multiply the result into the intermediate result */
1098. if (!BN_mod_mul_montgomery(&tmp, &tmp, &am, mont, ctx))
^
1099. goto err;
1100. }
crypto/bn/bn_mont.c:26:1: Parameter `a->top`
24. #endif
25.
26. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
27. BN_MONT_CTX *mont, BN_CTX *ctx)
28. {
crypto/bn/bn_mont.c:53:14: Call
51. bn_check_top(tmp);
52. if (a == b) {
53. if (!BN_sqr(tmp, a, ctx))
^
54. goto err;
55. } else {
crypto/bn/bn_sqr.c:17:1: Parameter `a->top`
15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96
16. */
17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
18. {
19. int max, al;
crypto/bn/bn_sqr.c:25:5: Assignment
23. bn_check_top(a);
24.
25. al = a->top;
^
26. if (al <= 0) {
27. r->top = 0;
crypto/bn/bn_sqr.c:74:17: Call
72. if (bn_wexpand(tmp, max) == NULL)
73. goto err;
74. bn_sqr_normal(rr->d, a->d, al, tmp->d);
^
75. }
76. }
crypto/bn/bn_sqr.c:105:1: <Offset trace>
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:105:1: Parameter `n`
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:116:5: Assignment
114. rp[0] = rp[max - 1] = 0;
115. rp++;
116. j = n;
^
117.
118. if (--j > 0) {
crypto/bn/bn_sqr.c:118:9: Assignment
116. j = n;
117.
118. if (--j > 0) {
^
119. ap++;
120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
crypto/bn/bn_sqr.c:105:1: <Length trace>
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:105:1: Parameter `*r`
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:113:5: Assignment
111. max = n * 2;
112. ap = a;
113. rp = r;
^
114. rp[0] = rp[max - 1] = 0;
115. rp++;
crypto/bn/bn_sqr.c:115:5: Assignment
113. rp = r;
114. rp[0] = rp[max - 1] = 0;
115. rp++;
^
116. j = n;
117.
crypto/bn/bn_sqr.c:120:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `ecdsa_sign_setup`
118. if (--j > 0) {
119. ap++;
120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
^
121. rp += 2;
122. }
|
https://github.com/openssl/openssl/blob/b8c32081e02b7008a90d878eccce46da256dfe86/crypto/bn/bn_sqr.c/#L120
|
d2a_code_trace_data_42688
|
ngx_int_t
ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value,
ngx_uint_t flags)
{
size_t len;
u_char *p;
ngx_str_t *name;
ngx_uint_t i, k, n, skip, last;
ngx_array_t *keys, *hwc;
ngx_hash_key_t *hk;
last = key->len;
if (flags & NGX_HASH_WILDCARD_KEY) {
n = 0;
for (i = 0; i < key->len; i++) {
if (key->data[i] == '*') {
if (++n > 1) {
return NGX_DECLINED;
}
}
if (key->data[i] == '.' && key->data[i + 1] == '.') {
return NGX_DECLINED;
}
if (key->data[i] == '\0') {
return NGX_DECLINED;
}
}
if (key->len > 1 && key->data[0] == '.') {
skip = 1;
goto wildcard;
}
if (key->len > 2) {
if (key->data[0] == '*' && key->data[1] == '.') {
skip = 2;
goto wildcard;
}
if (key->data[i - 2] == '.' && key->data[i - 1] == '*') {
skip = 0;
last -= 2;
goto wildcard;
}
}
if (n) {
return NGX_DECLINED;
}
}
k = 0;
for (i = 0; i < last; i++) {
if (!(flags & NGX_HASH_READONLY_KEY)) {
key->data[i] = ngx_tolower(key->data[i]);
}
k = ngx_hash(k, key->data[i]);
}
k %= ha->hsize;
name = ha->keys_hash[k].elts;
if (name) {
for (i = 0; i < ha->keys_hash[k].nelts; i++) {
if (last != name[i].len) {
continue;
}
if (ngx_strncmp(key->data, name[i].data, last) == 0) {
return NGX_BUSY;
}
}
} else {
if (ngx_array_init(&ha->keys_hash[k], ha->temp_pool, 4,
sizeof(ngx_str_t))
!= NGX_OK)
{
return NGX_ERROR;
}
}
name = ngx_array_push(&ha->keys_hash[k]);
if (name == NULL) {
return NGX_ERROR;
}
*name = *key;
hk = ngx_array_push(&ha->keys);
if (hk == NULL) {
return NGX_ERROR;
}
hk->key = *key;
hk->key_hash = ngx_hash_key(key->data, last);
hk->value = value;
return NGX_OK;
wildcard:
k = ngx_hash_strlow(&key->data[skip], &key->data[skip], last - skip);
k %= ha->hsize;
if (skip == 1) {
name = ha->keys_hash[k].elts;
if (name) {
len = last - skip;
for (i = 0; i < ha->keys_hash[k].nelts; i++) {
if (len != name[i].len) {
continue;
}
if (ngx_strncmp(&key->data[1], name[i].data, len) == 0) {
return NGX_BUSY;
}
}
} else {
if (ngx_array_init(&ha->keys_hash[k], ha->temp_pool, 4,
sizeof(ngx_str_t))
!= NGX_OK)
{
return NGX_ERROR;
}
}
name = ngx_array_push(&ha->keys_hash[k]);
if (name == NULL) {
return NGX_ERROR;
}
name->len = last - 1;
name->data = ngx_pnalloc(ha->temp_pool, name->len);
if (name->data == NULL) {
return NGX_ERROR;
}
ngx_memcpy(name->data, &key->data[1], name->len);
}
if (skip) {
p = ngx_pnalloc(ha->temp_pool, last);
if (p == NULL) {
return NGX_ERROR;
}
len = 0;
n = 0;
for (i = last - 1; i; i--) {
if (key->data[i] == '.') {
ngx_memcpy(&p[n], &key->data[i + 1], len);
n += len;
p[n++] = '.';
len = 0;
continue;
}
len++;
}
if (len) {
ngx_memcpy(&p[n], &key->data[1], len);
n += len;
}
p[n] = '\0';
hwc = &ha->dns_wc_head;
keys = &ha->dns_wc_head_hash[k];
} else {
last++;
p = ngx_pnalloc(ha->temp_pool, last);
if (p == NULL) {
return NGX_ERROR;
}
ngx_cpystrn(p, key->data, last);
hwc = &ha->dns_wc_tail;
keys = &ha->dns_wc_tail_hash[k];
}
name = keys->elts;
if (name) {
len = last - skip;
for (i = 0; i < keys->nelts; i++) {
if (len != name[i].len) {
continue;
}
if (ngx_strncmp(key->data + skip, name[i].data, len) == 0) {
return NGX_BUSY;
}
}
} else {
if (ngx_array_init(keys, ha->temp_pool, 4, sizeof(ngx_str_t)) != NGX_OK)
{
return NGX_ERROR;
}
}
name = ngx_array_push(keys);
if (name == NULL) {
return NGX_ERROR;
}
name->len = last - skip;
name->data = ngx_pnalloc(ha->temp_pool, name->len);
if (name->data == NULL) {
return NGX_ERROR;
}
ngx_memcpy(name->data, key->data + skip, name->len);
hk = ngx_array_push(hwc);
if (hk == NULL) {
return NGX_ERROR;
}
hk->key.len = last - 1;
hk->key.data = p;
hk->key_hash = 0;
hk->value = value;
return NGX_OK;
}
src/http/modules/ngx_http_referer_module.c:275: error: Buffer Overrun L3
Offset: [-1, +oo] Size: [1, +oo] by call to `ngx_http_add_variable`.
src/http/modules/ngx_http_referer_module.c:275:11: Call
273. ngx_http_variable_t *var;
274.
275. var = ngx_http_add_variable(cf, &ngx_http_invalid_referer_name,
^
276. NGX_HTTP_VAR_CHANGEABLE);
277. if (var == NULL) {
src/http/ngx_http_variables.c:392:1: Parameter `name->len`
390.
391.
392. ngx_http_variable_t *
^
393. ngx_http_add_variable(ngx_conf_t *cf, ngx_str_t *name, ngx_uint_t flags)
394. {
src/http/ngx_http_variables.c:439:5: Assignment
437. }
438.
439. v->name.len = name->len;
^
440. v->name.data = ngx_pnalloc(cf->pool, name->len);
441. if (v->name.data == NULL) {
src/http/ngx_http_variables.c:453:10: Call
451. v->index = 0;
452.
453. rc = ngx_hash_add_key(cmcf->variables_keys, &v->name, v, 0);
^
454.
455. if (rc == NGX_ERROR) {
src/core/ngx_hash.c:712:1: <Offset trace>
710.
711.
712. ngx_int_t
^
713. ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value,
714. ngx_uint_t flags)
src/core/ngx_hash.c:712:1: Parameter `key->len`
710.
711.
712. ngx_int_t
^
713. ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value,
714. ngx_uint_t flags)
src/core/ngx_hash.c:712:1: <Length trace>
710.
711.
712. ngx_int_t
^
713. ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value,
714. ngx_uint_t flags)
src/core/ngx_hash.c:712:1: Parameter `*key->data`
710.
711.
712. ngx_int_t
^
713. ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value,
714. ngx_uint_t flags)
src/core/ngx_hash.c:763:17: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `ngx_http_add_variable`
761. }
762.
763. if (key->data[i - 2] == '.' && key->data[i - 1] == '*') {
^
764. skip = 0;
765. last -= 2;
|
https://github.com/nginx/nginx/blob/c09bba400d233331f1b405e18c6912a30502dee9/src/core/ngx_hash.c/#L763
|
d2a_code_trace_data_42689
|
int ossl_init_thread_start(uint64_t opts)
{
struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
if (locals == NULL)
return 0;
if (opts & OPENSSL_INIT_THREAD_ASYNC) {
#ifdef OPENSSL_INIT_DEBUG
fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "
"marking thread for async\n");
#endif
locals->async = 1;
}
if (opts & OPENSSL_INIT_THREAD_ERR_STATE) {
#ifdef OPENSSL_INIT_DEBUG
fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "
"marking thread for err_state\n");
#endif
locals->err_state = 1;
}
return 1;
}
crypto/init.c:387: error: MEMORY_LEAK
memory dynamically allocated by call to `ossl_init_get_thread_local()` at line 369, column 44 is not reachable after line 387, column 9.
Showing all 38 steps of the trace
crypto/init.c:367:1: start of procedure ossl_init_thread_start()
365. }
366.
367. > int ossl_init_thread_start(uint64_t opts)
368. {
369. struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
crypto/init.c:369:5:
367. int ossl_init_thread_start(uint64_t opts)
368. {
369. > struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
370.
371. if (locals == NULL)
crypto/init.c:85:1: start of procedure ossl_init_get_thread_local()
83. }
84.
85. > static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc)
86. {
87. struct thread_local_inits_st *local =
crypto/init.c:87:5:
85. static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc)
86. {
87. > struct thread_local_inits_st *local =
88. CRYPTO_THREAD_get_local(&threadstopkey);
89.
crypto/threads_pthread.c:120:1: start of procedure CRYPTO_THREAD_get_local()
118. }
119.
120. > void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key)
121. {
122. return pthread_getspecific(*key);
crypto/threads_pthread.c:122:5: Skipping pthread_getspecific(): method has no implementation
120. void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key)
121. {
122. return pthread_getspecific(*key);
^
123. }
124.
crypto/threads_pthread.c:123:1: return from a call to CRYPTO_THREAD_get_local
121. {
122. return pthread_getspecific(*key);
123. > }
124.
125. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)
crypto/init.c:90:9: Taking true branch
88. CRYPTO_THREAD_get_local(&threadstopkey);
89.
90. if (local == NULL && alloc) {
^
91. local = OPENSSL_zalloc(sizeof *local);
92. CRYPTO_THREAD_set_local(&threadstopkey, local);
crypto/init.c:90:26: Taking true branch
88. CRYPTO_THREAD_get_local(&threadstopkey);
89.
90. if (local == NULL && alloc) {
^
91. local = OPENSSL_zalloc(sizeof *local);
92. CRYPTO_THREAD_set_local(&threadstopkey, local);
crypto/init.c:91:9:
89.
90. if (local == NULL && alloc) {
91. > local = OPENSSL_zalloc(sizeof *local);
92. CRYPTO_THREAD_set_local(&threadstopkey, local);
93. }
crypto/mem.c:146:1: start of procedure CRYPTO_zalloc()
144. }
145.
146. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
147. {
148. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:148:5:
146. void *CRYPTO_zalloc(size_t num, const char *file, int line)
147. {
148. > void *ret = CRYPTO_malloc(num, file, line);
149.
150. if (ret != NULL)
crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
117. }
118.
119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
120. {
121. void *ret = NULL;
crypto/mem.c:121:5:
119. void *CRYPTO_malloc(size_t num, const char *file, int line)
120. {
121. > void *ret = NULL;
122.
123. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
crypto/mem.c:123:9: Taking false branch
121. void *ret = NULL;
122.
123. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
124. return malloc_impl(num, file, line);
125.
crypto/mem.c:126:9: Taking false branch
124. return malloc_impl(num, file, line);
125.
126. if (num <= 0)
^
127. return NULL;
128.
crypto/mem.c:129:5:
127. return NULL;
128.
129. > allow_customize = 0;
130. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
131. if (call_malloc_debug) {
crypto/mem.c:139:5:
137. }
138. #else
139. > osslargused(file); osslargused(line);
140. ret = malloc(num);
141. #endif
crypto/mem.c:139:24:
137. }
138. #else
139. > osslargused(file); osslargused(line);
140. ret = malloc(num);
141. #endif
crypto/mem.c:140:5:
138. #else
139. osslargused(file); osslargused(line);
140. > ret = malloc(num);
141. #endif
142.
crypto/mem.c:143:5:
141. #endif
142.
143. > return ret;
144. }
145.
crypto/mem.c:144:1: return from a call to CRYPTO_malloc
142.
143. return ret;
144. > }
145.
146. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:150:9: Taking true branch
148. void *ret = CRYPTO_malloc(num, file, line);
149.
150. if (ret != NULL)
^
151. memset(ret, 0, num);
152. return ret;
crypto/mem.c:151:9:
149.
150. if (ret != NULL)
151. > memset(ret, 0, num);
152. return ret;
153. }
crypto/mem.c:152:5:
150. if (ret != NULL)
151. memset(ret, 0, num);
152. > return ret;
153. }
154.
crypto/mem.c:153:1: return from a call to CRYPTO_zalloc
151. memset(ret, 0, num);
152. return ret;
153. > }
154.
155. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/init.c:92:9:
90. if (local == NULL && alloc) {
91. local = OPENSSL_zalloc(sizeof *local);
92. > CRYPTO_THREAD_set_local(&threadstopkey, local);
93. }
94. if (!alloc) {
crypto/threads_pthread.c:125:1: start of procedure CRYPTO_THREAD_set_local()
123. }
124.
125. > int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)
126. {
127. if (pthread_setspecific(*key, val) != 0)
crypto/threads_pthread.c:127:9: Taking true branch
125. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)
126. {
127. if (pthread_setspecific(*key, val) != 0)
^
128. return 0;
129.
crypto/threads_pthread.c:128:9:
126. {
127. if (pthread_setspecific(*key, val) != 0)
128. > return 0;
129.
130. return 1;
crypto/threads_pthread.c:131:1: return from a call to CRYPTO_THREAD_set_local
129.
130. return 1;
131. > }
132.
133. int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key)
crypto/init.c:94:10: Taking false branch
92. CRYPTO_THREAD_set_local(&threadstopkey, local);
93. }
94. if (!alloc) {
^
95. CRYPTO_THREAD_set_local(&threadstopkey, NULL);
96. }
crypto/init.c:98:5:
96. }
97.
98. > return local;
99. }
100.
crypto/init.c:99:1: return from a call to ossl_init_get_thread_local
97.
98. return local;
99. > }
100.
101. typedef struct ossl_init_stop_st OPENSSL_INIT_STOP;
crypto/init.c:371:9: Taking false branch
369. struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
370.
371. if (locals == NULL)
^
372. return 0;
373.
crypto/init.c:374:9: Taking false branch
372. return 0;
373.
374. if (opts & OPENSSL_INIT_THREAD_ASYNC) {
^
375. #ifdef OPENSSL_INIT_DEBUG
376. fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "
crypto/init.c:382:9: Taking true branch
380. }
381.
382. if (opts & OPENSSL_INIT_THREAD_ERR_STATE) {
^
383. #ifdef OPENSSL_INIT_DEBUG
384. fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "
crypto/init.c:387:9:
385. "marking thread for err_state\n");
386. #endif
387. > locals->err_state = 1;
388. }
389.
|
https://github.com/openssl/openssl/blob/6457615ac82d688a965c9b2cce9611e0559635be/crypto/init.c/#L387
|
d2a_code_trace_data_42690
|
static int gxf_write_mpeg_auxiliary(ByteIOContext *pb, GXFStreamContext *ctx)
{
char buffer[1024];
int size;
if (ctx->iframes) {
ctx->p_per_gop = ctx->pframes / ctx->iframes;
if (ctx->pframes % ctx->iframes)
ctx->p_per_gop++;
if (ctx->pframes)
ctx->b_per_gop = ctx->bframes / ctx->pframes;
if (ctx->p_per_gop > 9)
ctx->p_per_gop = 9;
if (ctx->b_per_gop > 9)
ctx->b_per_gop = 9;
}
size = snprintf(buffer, 1024, "Ver 1\nBr %.6f\nIpg 1\nPpi %d\nBpiop %d\n"
"Pix 0\nCf %d\nCg %d\nSl 7\nnl16 %d\nVi 1\nf1 1\n",
(float)ctx->codec->bit_rate, ctx->p_per_gop, ctx->b_per_gop,
ctx->codec->pix_fmt == PIX_FMT_YUV422P ? 2 : 1, ctx->first_gop_closed == 1,
ctx->codec->height / 16);
put_byte(pb, TRACK_MPG_AUX);
put_byte(pb, size + 1);
put_buffer(pb, (uint8_t *)buffer, size + 1);
return size + 3;
}
libavformat/gxfenc.c:191: error: Integer Overflow R2
([0, +oo] + 1):signed32.
libavformat/gxfenc.c:185:12: <LHS trace>
183. ctx->b_per_gop = 9; /* ensure value won't take more than one char */
184. }
185. size = snprintf(buffer, 1024, "Ver 1\nBr %.6f\nIpg 1\nPpi %d\nBpiop %d\n"
^
186. "Pix 0\nCf %d\nCg %d\nSl 7\nnl16 %d\nVi 1\nf1 1\n",
187. (float)ctx->codec->bit_rate, ctx->p_per_gop, ctx->b_per_gop,
libavformat/gxfenc.c:185:12: Risky value from: snprintf
183. ctx->b_per_gop = 9; /* ensure value won't take more than one char */
184. }
185. size = snprintf(buffer, 1024, "Ver 1\nBr %.6f\nIpg 1\nPpi %d\nBpiop %d\n"
^
186. "Pix 0\nCf %d\nCg %d\nSl 7\nnl16 %d\nVi 1\nf1 1\n",
187. (float)ctx->codec->bit_rate, ctx->p_per_gop, ctx->b_per_gop,
libavformat/gxfenc.c:185:5: Assignment
183. ctx->b_per_gop = 9; /* ensure value won't take more than one char */
184. }
185. size = snprintf(buffer, 1024, "Ver 1\nBr %.6f\nIpg 1\nPpi %d\nBpiop %d\n"
^
186. "Pix 0\nCf %d\nCg %d\nSl 7\nnl16 %d\nVi 1\nf1 1\n",
187. (float)ctx->codec->bit_rate, ctx->p_per_gop, ctx->b_per_gop,
libavformat/gxfenc.c:191:5: Binary operation: ([0, +oo] + 1):signed32
189. ctx->codec->height / 16);
190. put_byte(pb, TRACK_MPG_AUX);
191. put_byte(pb, size + 1);
^
192. put_buffer(pb, (uint8_t *)buffer, size + 1);
193. return size + 3;
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/gxfenc.c/#L191
|
d2a_code_trace_data_42691
|
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:692: error: Null Dereference
pointer `&gb->buffer` last assigned on line 689 could be null and is dereferenced by call to `get_bits1()` at line 692, column 25.
libavformat/mpegts.c:682:1: start of procedure read_sl_header()
680. }
681.
682. static int read_sl_header(PESContext *pes, SLConfigDescr *sl, const uint8_t *buf, int buf_size)
^
683. {
684. GetBitContext gb;
libavformat/mpegts.c:685:5:
683. {
684. GetBitContext gb;
685. int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0;
^
686. int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0;
687. int dts_flag = -1, cts_flag = -1;
libavformat/mpegts.c:686:5:
684. GetBitContext gb;
685. int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0;
686. int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0;
^
687. int dts_flag = -1, cts_flag = -1;
688. int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE;
libavformat/mpegts.c:687:5:
685. int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0;
686. int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0;
687. int dts_flag = -1, cts_flag = -1;
^
688. int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE;
689. init_get_bits(&gb, buf, buf_size*8);
libavformat/mpegts.c:688:5:
686. int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0;
687. int dts_flag = -1, cts_flag = -1;
688. int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE;
^
689. init_get_bits(&gb, buf, buf_size*8);
690.
libavformat/mpegts.c:689:5:
687. int dts_flag = -1, cts_flag = -1;
688. int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE;
689. init_get_bits(&gb, buf, buf_size*8);
^
690.
691. if (sl->use_au_start)
libavcodec/get_bits.h:352:1: start of procedure init_get_bits()
350. * @param bit_size the size of the buffer in bits
351. */
352. static inline void init_get_bits(GetBitContext *s, const uint8_t *buffer,
^
353. int bit_size)
354. {
libavcodec/get_bits.h:355:5:
353. int bit_size)
354. {
355. int buffer_size = (bit_size+7)>>3;
^
356. if (buffer_size < 0 || bit_size < 0) {
357. buffer_size = bit_size = 0;
libavcodec/get_bits.h:356:9: Taking true branch
354. {
355. int buffer_size = (bit_size+7)>>3;
356. if (buffer_size < 0 || bit_size < 0) {
^
357. buffer_size = bit_size = 0;
358. buffer = NULL;
libavcodec/get_bits.h:357:9:
355. int buffer_size = (bit_size+7)>>3;
356. if (buffer_size < 0 || bit_size < 0) {
357. buffer_size = bit_size = 0;
^
358. buffer = NULL;
359. }
libavcodec/get_bits.h:358:9:
356. if (buffer_size < 0 || bit_size < 0) {
357. buffer_size = bit_size = 0;
358. buffer = NULL;
^
359. }
360.
libavcodec/get_bits.h:361:5:
359. }
360.
361. s->buffer = buffer;
^
362. s->size_in_bits = bit_size;
363. #if !UNCHECKED_BITSTREAM_READER
libavcodec/get_bits.h:362:5:
360.
361. s->buffer = buffer;
362. s->size_in_bits = bit_size;
^
363. #if !UNCHECKED_BITSTREAM_READER
364. s->size_in_bits_plus8 = bit_size + 8;
libavcodec/get_bits.h:364:5:
362. s->size_in_bits = bit_size;
363. #if !UNCHECKED_BITSTREAM_READER
364. s->size_in_bits_plus8 = bit_size + 8;
^
365. #endif
366. s->buffer_end = buffer + buffer_size;
libavcodec/get_bits.h:366:5:
364. s->size_in_bits_plus8 = bit_size + 8;
365. #endif
366. s->buffer_end = buffer + buffer_size;
^
367. s->index = 0;
368. }
libavcodec/get_bits.h:367:5:
365. #endif
366. s->buffer_end = buffer + buffer_size;
367. s->index = 0;
^
368. }
369.
libavcodec/get_bits.h:368:1: return from a call to init_get_bits
366. s->buffer_end = buffer + buffer_size;
367. s->index = 0;
368. }
^
369.
370. static inline void align_get_bits(GetBitContext *s)
libavformat/mpegts.c:691:9: Taking true branch
689. init_get_bits(&gb, buf, buf_size*8);
690.
691. if (sl->use_au_start)
^
692. au_start_flag = get_bits1(&gb);
693. if (sl->use_au_end)
libavformat/mpegts.c:692:9:
690.
691. if (sl->use_au_start)
692. au_start_flag = get_bits1(&gb);
^
693. if (sl->use_au_end)
694. au_end_flag = get_bits1(&gb);
libavcodec/get_bits.h:268:1: start of procedure get_bits1()
266. }
267.
268. static inline unsigned int get_bits1(GetBitContext *s)
^
269. {
270. unsigned int index = s->index;
libavcodec/get_bits.h:270:5:
268. static inline unsigned int get_bits1(GetBitContext *s)
269. {
270. unsigned int index = s->index;
^
271. uint8_t result = s->buffer[index>>3];
272. #ifdef BITSTREAM_READER_LE
libavcodec/get_bits.h:271:5:
269. {
270. unsigned int index = s->index;
271. uint8_t result = s->buffer[index>>3];
^
272. #ifdef BITSTREAM_READER_LE
273. result >>= index & 7;
|
https://github.com/libav/libav/blob/e5356ebf2216918ad6351d4caa8b58c881c4b0ea/libavformat/mpegts.c/#L692
|
d2a_code_trace_data_42692
|
void
ngx_md5_update(ngx_md5_t *ctx, const void *data, size_t size)
{
size_t used, free;
used = (size_t) (ctx->bytes & 0x3f);
ctx->bytes += size;
if (used) {
free = 64 - used;
if (size < free) {
ngx_memcpy(&ctx->buffer[used], data, size);
return;
}
ngx_memcpy(&ctx->buffer[used], data, free);
data = (u_char *) data + free;
size -= free;
(void) ngx_md5_body(ctx, ctx->buffer, 64);
}
if (size >= 64) {
data = ngx_md5_body(ctx, data, size & ~(size_t) 0x3f);
size &= 0x3f;
}
ngx_memcpy(ctx->buffer, data, size);
}
src/http/ngx_http_file_cache.c:1545: error: Integer Overflow L2
([1, 128] - [1, 63]):unsigned64 by call to `ngx_http_file_cache_vary`.
src/http/ngx_http_file_cache.c:1539:13: Assignment
1537. if (c->vary.len > NGX_HTTP_CACHE_VARY_LEN) {
1538. /* should not happen */
1539. c->vary.len = NGX_HTTP_CACHE_VARY_LEN;
^
1540. }
1541.
src/http/ngx_http_file_cache.c:1545:9: Call
1543. ngx_memcpy(h.vary, c->vary.data, c->vary.len);
1544.
1545. ngx_http_file_cache_vary(r, c->vary.data, c->vary.len, c->variant);
^
1546. ngx_memcpy(h.variant, c->variant, NGX_HTTP_CACHE_KEY_LEN);
1547. }
src/http/ngx_http_file_cache.c:1054:1: Array declaration
1052.
1053.
1054. static void
^
1055. ngx_http_file_cache_vary(ngx_http_request_t *r, u_char *vary, size_t len,
1056. u_char *hash)
src/http/ngx_http_file_cache.c:1071:5: Assignment
1069. ngx_strlow(buf, vary, len);
1070.
1071. p = buf;
^
1072. last = buf + len;
1073.
src/http/ngx_http_file_cache.c:1082:9: Assignment
1080. while (p < last && *p != ',' && *p != ' ') { p++; }
1081.
1082. name.len = p - name.data;
^
1083.
1084. if (name.len == 0) {
src/http/ngx_http_file_cache.c:1091:9: Call
1089. "http file cache vary: %V", &name);
1090.
1091. ngx_md5_update(&md5, name.data, name.len);
^
1092. ngx_md5_update(&md5, (u_char *) ":", sizeof(":") - 1);
1093.
src/core/ngx_md5.c:30:1: <LHS trace>
28.
29.
30. void
^
31. ngx_md5_update(ngx_md5_t *ctx, const void *data, size_t size)
32. {
src/core/ngx_md5.c:30:1: Parameter `size`
28.
29.
30. void
^
31. ngx_md5_update(ngx_md5_t *ctx, const void *data, size_t size)
32. {
src/core/ngx_md5.c:30:1: <RHS trace>
28.
29.
30. void
^
31. ngx_md5_update(ngx_md5_t *ctx, const void *data, size_t size)
32. {
src/core/ngx_md5.c:30:1: Parameter `size`
28.
29.
30. void
^
31. ngx_md5_update(ngx_md5_t *ctx, const void *data, size_t size)
32. {
src/core/ngx_md5.c:48:9: Binary operation: ([1, 128] - [1, 63]):unsigned64 by call to `ngx_http_file_cache_vary`
46. ngx_memcpy(&ctx->buffer[used], data, free);
47. data = (u_char *) data + free;
48. size -= free;
^
49. (void) ngx_md5_body(ctx, ctx->buffer, 64);
50. }
|
https://github.com/nginx/nginx/blob/5544756296e5abaecb5f640753d6de939b701035/src/core/ngx_md5.c/#L48
|
d2a_code_trace_data_42693
|
void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb)
{
BN_ULONG *rr;
if (na < nb) {
int itmp;
BN_ULONG *ltmp;
itmp = na;
na = nb;
nb = itmp;
ltmp = a;
a = b;
b = ltmp;
}
rr = &(r[na]);
if (nb <= 0) {
(void)bn_mul_words(r, a, na, 0);
return;
} else
rr[0] = bn_mul_words(r, a, na, b[0]);
for (;;) {
if (--nb <= 0)
return;
rr[1] = bn_mul_add_words(&(r[1]), a, na, b[1]);
if (--nb <= 0)
return;
rr[2] = bn_mul_add_words(&(r[2]), a, na, b[2]);
if (--nb <= 0)
return;
rr[3] = bn_mul_add_words(&(r[3]), a, na, b[3]);
if (--nb <= 0)
return;
rr[4] = bn_mul_add_words(&(r[4]), a, na, b[4]);
rr += 4;
r += 4;
b += 4;
}
}
crypto/rsa/rsa_chk.c:66: error: BUFFER_OVERRUN_L3
Offset: [4, +oo] (⇐ [0, +oo] + 4) Size: [0, 8388607] by call to `BN_mul`.
Showing all 19 steps of the trace
crypto/rsa/rsa_chk.c:60:9: Call
58.
59. /* q prime? */
60. if (BN_is_prime_ex(key->q, BN_prime_checks, NULL, cb) != 1) {
^
61. ret = 0;
62. RSAerr(RSA_F_RSA_CHECK_KEY_EX, RSA_R_Q_NOT_PRIME);
crypto/bn/bn_prime.c:150:12: Call
148. BN_GENCB *cb)
149. {
150. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb);
^
151. }
152.
crypto/bn/bn_prime.c:227:13: Call
225. /* now 1 <= check < a */
226.
227. j = witness(check, a, A1, A1_odd, k, ctx, mont);
^
228. if (j == -1)
229. goto err;
crypto/bn/bn_prime.c:253:10: Call
251. BN_MONT_CTX *mont)
252. {
253. if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */
^
254. return -1;
255. if (BN_is_one(w))
crypto/bn/bn_exp.c:350:14: Call
348.
349. if (a->neg || BN_ucmp(a, m) >= 0) {
350. if (!BN_nnmod(val[0], a, m, ctx))
^
351. goto err;
352. aa = val[0];
crypto/bn/bn_mod.c:20:11: Call
18. */
19.
20. if (!(BN_mod(r, m, d, ctx)))
^
21. return 0;
22. if (!r->neg)
crypto/bn/bn_div.c:140:1: Parameter `*dv->d`
138. * If 'dv' or 'rm' is NULL, the respective value is not returned.
139. */
140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
141. BN_CTX *ctx)
142. {
crypto/rsa/rsa_chk.c:66:10: Call
64.
65. /* n = p*q? */
66. if (!BN_mul(i, key->p, key->q, ctx)) {
^
67. ret = -1;
68. goto err;
crypto/bn/bn_mul.c:495:1: Parameter `*r->d`
493. #endif /* BN_RECURSION */
494.
495. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
496. {
497. int ret = 0;
crypto/bn/bn_mul.c:573:21: Call
571. if (bn_wexpand(t, k * 4) == NULL)
572. goto err;
573. if (bn_wexpand(rr, k * 4) == NULL)
^
574. goto err;
575. bn_mul_part_recursive(rr->d, a->d, b->d,
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_mul.c:575:17: Call
573. if (bn_wexpand(rr, k * 4) == NULL)
574. goto err;
575. bn_mul_part_recursive(rr->d, a->d, b->d,
^
576. j, al - j, bl - j, t->d);
577. } else { /* al <= j || bl <= j */
crypto/bn/bn_mul.c:320:1: Parameter `*t`
318. */
319. /* tnX may not be negative but less than n */
320. > void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
321. int tna, int tnb, BN_ULONG *t)
322. {
crypto/bn/bn_mul.c:380:9: Call
378. } else {
379. p = &(t[n2 * 2]);
380. bn_mul_recursive(&(t[n2]), t, &(t[n]), n, 0, 0, p);
^
381. bn_mul_recursive(r, a, b, n, 0, 0, p);
382. i = n / 2;
crypto/bn/bn_mul.c:173:1: Parameter `*a`
171. */
172. /* dnX may not be positive, but n2/2+dnX has to be */
173. > void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2,
174. int dna, int dnb, BN_ULONG *t)
175. {
crypto/bn/bn_mul.c:199:9: Call
197. /* Else do normal multiply */
198. if (n2 < BN_MUL_RECURSIVE_SIZE_NORMAL) {
199. bn_mul_normal(r, a, n2 + dna, b, n2 + dnb);
^
200. if ((dna + dnb) < 0)
201. memset(&r[2 * n2 + dna + dnb], 0,
crypto/bn/bn_mul.c:650:1: <Length trace>
648. }
649.
650. > void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb)
651. {
652. BN_ULONG *rr;
crypto/bn/bn_mul.c:650:1: Parameter `*b`
648. }
649.
650. > void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb)
651. {
652. BN_ULONG *rr;
crypto/bn/bn_mul.c:685:50: Array access: Offset: [4, +oo] (⇐ [0, +oo] + 4) Size: [0, 8388607] by call to `BN_mul`
683. if (--nb <= 0)
684. return;
685. rr[4] = bn_mul_add_words(&(r[4]), a, na, b[4]);
^
686. rr += 4;
687. r += 4;
|
https://github.com/openssl/openssl/blob/757264207ad8650a89ea903d48ad89f61d56ea9c/crypto/bn/bn_mul.c/#L685
|
d2a_code_trace_data_42694
|
static int init_context_frame(MpegEncContext *s)
{
int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y;
s->mb_width = (s->width + 15) / 16;
s->mb_stride = s->mb_width + 1;
s->b8_stride = s->mb_width * 2 + 1;
s->b4_stride = s->mb_width * 4 + 1;
mb_array_size = s->mb_height * s->mb_stride;
mv_table_size = (s->mb_height + 2) * s->mb_stride + 1;
s->h_edge_pos = s->mb_width * 16;
s->v_edge_pos = s->mb_height * 16;
s->mb_num = s->mb_width * s->mb_height;
s->block_wrap[0] =
s->block_wrap[1] =
s->block_wrap[2] =
s->block_wrap[3] = s->b8_stride;
s->block_wrap[4] =
s->block_wrap[5] = s->mb_stride;
y_size = s->b8_stride * (2 * s->mb_height + 1);
c_size = s->mb_stride * (s->mb_height + 1);
yc_size = y_size + 2 * c_size;
FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int),
fail);
for (y = 0; y < s->mb_height; y++)
for (x = 0; x < s->mb_width; x++)
s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride;
s->mb_index2xy[s->mb_height * s->mb_width] =
(s->mb_height - 1) * s->mb_stride + s->mb_width;
if (s->encoding) {
FF_ALLOCZ_OR_GOTO(s->avctx, s->p_mv_table_base,
mv_table_size * 2 * sizeof(int16_t), fail);
FF_ALLOCZ_OR_GOTO(s->avctx, s->b_forw_mv_table_base,
mv_table_size * 2 * sizeof(int16_t), fail);
FF_ALLOCZ_OR_GOTO(s->avctx, s->b_back_mv_table_base,
mv_table_size * 2 * sizeof(int16_t), fail);
FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_forw_mv_table_base,
mv_table_size * 2 * sizeof(int16_t), fail);
FF_ALLOCZ_OR_GOTO(s->avctx, s->b_bidir_back_mv_table_base,
mv_table_size * 2 * sizeof(int16_t), fail);
FF_ALLOCZ_OR_GOTO(s->avctx, s->b_direct_mv_table_base,
mv_table_size * 2 * sizeof(int16_t), fail);
s->p_mv_table = s->p_mv_table_base + s->mb_stride + 1;
s->b_forw_mv_table = s->b_forw_mv_table_base + s->mb_stride + 1;
s->b_back_mv_table = s->b_back_mv_table_base + s->mb_stride + 1;
s->b_bidir_forw_mv_table = s->b_bidir_forw_mv_table_base +
s->mb_stride + 1;
s->b_bidir_back_mv_table = s->b_bidir_back_mv_table_base +
s->mb_stride + 1;
s->b_direct_mv_table = s->b_direct_mv_table_base + s->mb_stride + 1;
FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_type, mb_array_size *
sizeof(uint16_t), fail);
FF_ALLOCZ_OR_GOTO(s->avctx, s->lambda_table, mb_array_size *
sizeof(int), fail);
FF_ALLOC_OR_GOTO(s->avctx, s->cplx_tab,
mb_array_size * sizeof(float), fail);
FF_ALLOC_OR_GOTO(s->avctx, s->bits_tab,
mb_array_size * sizeof(float), fail);
}
if (s->codec_id == AV_CODEC_ID_MPEG4 ||
(s->flags & CODEC_FLAG_INTERLACED_ME)) {
for (i = 0; i < 2; i++) {
int j, k;
for (j = 0; j < 2; j++) {
for (k = 0; k < 2; k++) {
FF_ALLOCZ_OR_GOTO(s->avctx,
s->b_field_mv_table_base[i][j][k],
mv_table_size * 2 * sizeof(int16_t),
fail);
s->b_field_mv_table[i][j][k] = s->b_field_mv_table_base[i][j][k] +
s->mb_stride + 1;
}
FF_ALLOCZ_OR_GOTO(s->avctx, s->b_field_select_table [i][j],
mb_array_size * 2 * sizeof(uint8_t), fail);
FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_mv_table_base[i][j],
mv_table_size * 2 * sizeof(int16_t), fail);
s->p_field_mv_table[i][j] = s->p_field_mv_table_base[i][j]
+ s->mb_stride + 1;
}
FF_ALLOCZ_OR_GOTO(s->avctx, s->p_field_select_table[i],
mb_array_size * 2 * sizeof(uint8_t), fail);
}
}
if (s->out_format == FMT_H263) {
FF_ALLOCZ_OR_GOTO(s->avctx, s->coded_block_base, y_size, fail);
s->coded_block = s->coded_block_base + s->b8_stride + 1;
FF_ALLOCZ_OR_GOTO(s->avctx, s->cbp_table,
mb_array_size * sizeof(uint8_t), fail);
FF_ALLOCZ_OR_GOTO(s->avctx, s->pred_dir_table,
mb_array_size * sizeof(uint8_t), fail);
}
if (s->h263_pred || s->h263_plus || !s->encoding) {
FF_ALLOCZ_OR_GOTO(s->avctx, s->dc_val_base,
yc_size * sizeof(int16_t), fail);
s->dc_val[0] = s->dc_val_base + s->b8_stride + 1;
s->dc_val[1] = s->dc_val_base + y_size + s->mb_stride + 1;
s->dc_val[2] = s->dc_val[1] + c_size;
for (i = 0; i < yc_size; i++)
s->dc_val_base[i] = 1024;
}
FF_ALLOCZ_OR_GOTO(s->avctx, s->mbintra_table, mb_array_size, fail);
memset(s->mbintra_table, 1, mb_array_size);
FF_ALLOCZ_OR_GOTO(s->avctx, s->mbskip_table, mb_array_size + 2, fail);
return init_er(s);
fail:
return AVERROR(ENOMEM);
}
libavcodec/mpegvideo.c:886: error: Null Dereference
pointer `s->mb_index2xy` last assigned on line 880 could be null and is dereferenced at line 886, column 5.
libavcodec/mpegvideo.c:851:1: start of procedure init_context_frame()
849. * Initialize and allocates MpegEncContext fields dependent on the resolution.
850. */
851. static int init_context_frame(MpegEncContext *s)
^
852. {
853. int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y;
libavcodec/mpegvideo.c:855:5:
853. int y_size, c_size, yc_size, i, mb_array_size, mv_table_size, x, y;
854.
855. s->mb_width = (s->width + 15) / 16;
^
856. s->mb_stride = s->mb_width + 1;
857. s->b8_stride = s->mb_width * 2 + 1;
libavcodec/mpegvideo.c:856:5:
854.
855. s->mb_width = (s->width + 15) / 16;
856. s->mb_stride = s->mb_width + 1;
^
857. s->b8_stride = s->mb_width * 2 + 1;
858. s->b4_stride = s->mb_width * 4 + 1;
libavcodec/mpegvideo.c:857:5:
855. s->mb_width = (s->width + 15) / 16;
856. s->mb_stride = s->mb_width + 1;
857. s->b8_stride = s->mb_width * 2 + 1;
^
858. s->b4_stride = s->mb_width * 4 + 1;
859. mb_array_size = s->mb_height * s->mb_stride;
libavcodec/mpegvideo.c:858:5:
856. s->mb_stride = s->mb_width + 1;
857. s->b8_stride = s->mb_width * 2 + 1;
858. s->b4_stride = s->mb_width * 4 + 1;
^
859. mb_array_size = s->mb_height * s->mb_stride;
860. mv_table_size = (s->mb_height + 2) * s->mb_stride + 1;
libavcodec/mpegvideo.c:859:5:
857. s->b8_stride = s->mb_width * 2 + 1;
858. s->b4_stride = s->mb_width * 4 + 1;
859. mb_array_size = s->mb_height * s->mb_stride;
^
860. mv_table_size = (s->mb_height + 2) * s->mb_stride + 1;
861.
libavcodec/mpegvideo.c:860:5:
858. s->b4_stride = s->mb_width * 4 + 1;
859. mb_array_size = s->mb_height * s->mb_stride;
860. mv_table_size = (s->mb_height + 2) * s->mb_stride + 1;
^
861.
862. /* set default edge pos, will be overriden
libavcodec/mpegvideo.c:864:5:
862. /* set default edge pos, will be overriden
863. * in decode_header if needed */
864. s->h_edge_pos = s->mb_width * 16;
^
865. s->v_edge_pos = s->mb_height * 16;
866.
libavcodec/mpegvideo.c:865:5:
863. * in decode_header if needed */
864. s->h_edge_pos = s->mb_width * 16;
865. s->v_edge_pos = s->mb_height * 16;
^
866.
867. s->mb_num = s->mb_width * s->mb_height;
libavcodec/mpegvideo.c:867:5:
865. s->v_edge_pos = s->mb_height * 16;
866.
867. s->mb_num = s->mb_width * s->mb_height;
^
868.
869. s->block_wrap[0] =
libavcodec/mpegvideo.c:869:5:
867. s->mb_num = s->mb_width * s->mb_height;
868.
869. s->block_wrap[0] =
^
870. s->block_wrap[1] =
871. s->block_wrap[2] =
libavcodec/mpegvideo.c:873:5:
871. s->block_wrap[2] =
872. s->block_wrap[3] = s->b8_stride;
873. s->block_wrap[4] =
^
874. s->block_wrap[5] = s->mb_stride;
875.
libavcodec/mpegvideo.c:876:5:
874. s->block_wrap[5] = s->mb_stride;
875.
876. y_size = s->b8_stride * (2 * s->mb_height + 1);
^
877. c_size = s->mb_stride * (s->mb_height + 1);
878. yc_size = y_size + 2 * c_size;
libavcodec/mpegvideo.c:877:5:
875.
876. y_size = s->b8_stride * (2 * s->mb_height + 1);
877. c_size = s->mb_stride * (s->mb_height + 1);
^
878. yc_size = y_size + 2 * c_size;
879.
libavcodec/mpegvideo.c:878:5:
876. y_size = s->b8_stride * (2 * s->mb_height + 1);
877. c_size = s->mb_stride * (s->mb_height + 1);
878. yc_size = y_size + 2 * c_size;
^
879.
880. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int),
libavcodec/mpegvideo.c:880:5:
878. yc_size = y_size + 2 * c_size;
879.
880. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int),
^
881. fail); // error ressilience code looks cleaner with this
882. for (y = 0; y < s->mb_height; y++)
libavutil/mem.c:205:1: start of procedure av_mallocz()
203. }
204.
205. void *av_mallocz(size_t size)
^
206. {
207. void *ptr = av_malloc(size);
libavutil/mem.c:207:5:
205. void *av_mallocz(size_t size)
206. {
207. void *ptr = av_malloc(size);
^
208. if (ptr)
209. memset(ptr, 0, size);
libavutil/mem.c:62:1: start of procedure av_malloc()
60. * linker will do it automatically. */
61.
62. void *av_malloc(size_t size)
^
63. {
64. void *ptr = NULL;
libavutil/mem.c:64:5:
62. void *av_malloc(size_t size)
63. {
64. void *ptr = NULL;
^
65. #if CONFIG_MEMALIGN_HACK
66. long diff;
libavutil/mem.c:70:9: Taking true branch
68.
69. /* let's disallow possibly ambiguous cases */
70. if (size > (INT_MAX - 32) || !size)
^
71. return NULL;
72.
libavutil/mem.c:71:9:
69. /* let's disallow possibly ambiguous cases */
70. if (size > (INT_MAX - 32) || !size)
71. return NULL;
^
72.
73. #if CONFIG_MEMALIGN_HACK
libavutil/mem.c:115:1: return from a call to av_malloc
113. #endif
114. return ptr;
115. }
^
116.
117. void *av_realloc(void *ptr, size_t size)
libavutil/mem.c:208:9: Taking false branch
206. {
207. void *ptr = av_malloc(size);
208. if (ptr)
^
209. memset(ptr, 0, size);
210. return ptr;
libavutil/mem.c:210:5:
208. if (ptr)
209. memset(ptr, 0, size);
210. return ptr;
^
211. }
212.
libavutil/mem.c:211:1: return from a call to av_mallocz
209. memset(ptr, 0, size);
210. return ptr;
211. }
^
212.
213. char *av_strdup(const char *s)
libavcodec/mpegvideo.c:880:5: Taking true branch
878. yc_size = y_size + 2 * c_size;
879.
880. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int),
^
881. fail); // error ressilience code looks cleaner with this
882. for (y = 0; y < s->mb_height; y++)
libavcodec/mpegvideo.c:880:5: Taking false branch
878. yc_size = y_size + 2 * c_size;
879.
880. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int),
^
881. fail); // error ressilience code looks cleaner with this
882. for (y = 0; y < s->mb_height; y++)
libavcodec/mpegvideo.c:882:10:
880. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int),
881. fail); // error ressilience code looks cleaner with this
882. for (y = 0; y < s->mb_height; y++)
^
883. for (x = 0; x < s->mb_width; x++)
884. s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride;
libavcodec/mpegvideo.c:882:17: Loop condition is false. Leaving loop
880. FF_ALLOCZ_OR_GOTO(s->avctx, s->mb_index2xy, (s->mb_num + 1) * sizeof(int),
881. fail); // error ressilience code looks cleaner with this
882. for (y = 0; y < s->mb_height; y++)
^
883. for (x = 0; x < s->mb_width; x++)
884. s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride;
libavcodec/mpegvideo.c:886:5:
884. s->mb_index2xy[x + y * s->mb_width] = x + y * s->mb_stride;
885.
886. s->mb_index2xy[s->mb_height * s->mb_width] =
^
887. (s->mb_height - 1) * s->mb_stride + s->mb_width; // FIXME really needed?
888.
|
https://github.com/libav/libav/blob/16e7b189c548b4075ff4b5dd62af10e2acae260b/libavcodec/mpegvideo.c/#L886
|
d2a_code_trace_data_42695
|
int test_gf2m_mod_sqr(BIO *bp, BN_CTX *ctx)
{
BIGNUM *a, *b[2], *c, *d;
int i, j, ret = 0;
int p0[] = { 163, 7, 6, 3, 0, -1 };
int p1[] = { 193, 15, 0, -1 };
a = BN_new();
b[0] = BN_new();
b[1] = BN_new();
c = BN_new();
d = BN_new();
BN_GF2m_arr2poly(p0, b[0]);
BN_GF2m_arr2poly(p1, b[1]);
for (i = 0; i < num0; i++) {
BN_bntest_rand(a, 1024, 0, 0);
for (j = 0; j < 2; j++) {
BN_GF2m_mod_sqr(c, a, b[j], ctx);
BN_copy(d, a);
BN_GF2m_mod_mul(d, a, d, b[j], ctx);
BN_GF2m_add(d, c, d);
if (!BN_is_zero(d)) {
fprintf(stderr, "GF(2^m) modular squaring test failed!\n");
goto err;
}
}
}
ret = 1;
err:
BN_free(a);
BN_free(b[0]);
BN_free(b[1]);
BN_free(c);
BN_free(d);
return ret;
}
test/bntest.c:1395: error: MEMORY_LEAK
memory dynamically allocated by call to `BN_new()` at line 1370, column 9 is not reachable after line 1395, column 5.
Showing all 133 steps of the trace
test/bntest.c:1363:1: start of procedure test_gf2m_mod_sqr()
1361. }
1362.
1363. > int test_gf2m_mod_sqr(BIO *bp, BN_CTX *ctx)
1364. {
1365. BIGNUM *a, *b[2], *c, *d;
test/bntest.c:1366:5:
1364. {
1365. BIGNUM *a, *b[2], *c, *d;
1366. > int i, j, ret = 0;
1367. int p0[] = { 163, 7, 6, 3, 0, -1 };
1368. int p1[] = { 193, 15, 0, -1 };
test/bntest.c:1367:5:
1365. BIGNUM *a, *b[2], *c, *d;
1366. int i, j, ret = 0;
1367. > int p0[] = { 163, 7, 6, 3, 0, -1 };
1368. int p1[] = { 193, 15, 0, -1 };
1369.
test/bntest.c:1368:5:
1366. int i, j, ret = 0;
1367. int p0[] = { 163, 7, 6, 3, 0, -1 };
1368. > int p1[] = { 193, 15, 0, -1 };
1369.
1370. a = BN_new();
test/bntest.c:1370:5:
1368. int p1[] = { 193, 15, 0, -1 };
1369.
1370. > a = BN_new();
1371. b[0] = BN_new();
1372. b[1] = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:1371:5:
1369.
1370. a = BN_new();
1371. > b[0] = BN_new();
1372. b[1] = BN_new();
1373. 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:1372:5:
1370. a = BN_new();
1371. b[0] = BN_new();
1372. > b[1] = BN_new();
1373. c = BN_new();
1374. 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:1373:5:
1371. b[0] = BN_new();
1372. b[1] = BN_new();
1373. > c = BN_new();
1374. d = BN_new();
1375.
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:1374:5:
1372. b[1] = BN_new();
1373. c = BN_new();
1374. > d = BN_new();
1375.
1376. BN_GF2m_arr2poly(p0, b[0]);
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:1376:5: Skipping BN_GF2m_arr2poly(): empty list of specs
1374. d = BN_new();
1375.
1376. BN_GF2m_arr2poly(p0, b[0]);
^
1377. BN_GF2m_arr2poly(p1, b[1]);
1378.
test/bntest.c:1377:5: Skipping BN_GF2m_arr2poly(): empty list of specs
1375.
1376. BN_GF2m_arr2poly(p0, b[0]);
1377. BN_GF2m_arr2poly(p1, b[1]);
^
1378.
1379. for (i = 0; i < num0; i++) {
test/bntest.c:1379:10:
1377. BN_GF2m_arr2poly(p1, b[1]);
1378.
1379. > for (i = 0; i < num0; i++) {
1380. BN_bntest_rand(a, 1024, 0, 0);
1381. for (j = 0; j < 2; j++) {
test/bntest.c:1379:17: Loop condition is false. Leaving loop
1377. BN_GF2m_arr2poly(p1, b[1]);
1378.
1379. for (i = 0; i < num0; i++) {
^
1380. BN_bntest_rand(a, 1024, 0, 0);
1381. for (j = 0; j < 2; j++) {
test/bntest.c:1393:5:
1391. }
1392. }
1393. > ret = 1;
1394. err:
1395. BN_free(a);
test/bntest.c:1394:2:
1392. }
1393. ret = 1;
1394. > err:
1395. BN_free(a);
1396. BN_free(b[0]);
test/bntest.c:1395:5:
1393. ret = 1;
1394. err:
1395. > BN_free(a);
1396. BN_free(b[0]);
1397. BN_free(b[1]);
crypto/bn/bn_lib.c:252:1: start of procedure BN_free()
250. }
251.
252. > void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
crypto/bn/bn_lib.c:254:9: Taking false branch
252. void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
^
255. return;
256. bn_check_top(a);
crypto/bn/bn_lib.c:257:10:
255. return;
256. bn_check_top(a);
257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
963. }
964.
965. > int BN_get_flags(const BIGNUM *b, int n)
966. {
967. return b->flags & n;
crypto/bn/bn_lib.c:967:5:
965. int BN_get_flags(const BIGNUM *b, int n)
966. {
967. > return b->flags & n;
968. }
969.
crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
966. {
967. return b->flags & n;
968. > }
969.
970. /* Populate a BN_GENCB structure with an "old"-style callback */
crypto/bn/bn_lib.c:257:10: Taking false branch
255. return;
256. bn_check_top(a);
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
^
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:259:9: Taking false branch
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
^
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:263:9:
261. else {
262. #if OPENSSL_API_COMPAT < 0x00908000L
263. > a->flags |= BN_FLG_FREE;
264. #endif
265. a->d = NULL;
crypto/bn/bn_lib.c:265:9:
263. a->flags |= BN_FLG_FREE;
264. #endif
265. > a->d = NULL;
266. }
267. }
crypto/bn/bn_lib.c:259:5:
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. > if (a->flags & BN_FLG_MALLOCED)
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:267:1: return from a call to BN_free
265. a->d = NULL;
266. }
267. > }
268.
269. void bn_init(BIGNUM *a)
|
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L1395
|
d2a_code_trace_data_42696
|
tmsize_t
TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc)
{
static const char module[] = "TIFFWriteEncodedStrip";
TIFFDirectory *td = &tif->tif_dir;
uint16 sample;
if (!WRITECHECKSTRIPS(tif, module))
return ((tmsize_t) -1);
if (strip >= td->td_nstrips) {
if (td->td_planarconfig == PLANARCONFIG_SEPARATE) {
TIFFErrorExt(tif->tif_clientdata, module,
"Can not grow image by strips when using separate planes");
return ((tmsize_t) -1);
}
if (!TIFFGrowStrips(tif, 1, module))
return ((tmsize_t) -1);
td->td_stripsperimage =
TIFFhowmany_32(td->td_imagelength, td->td_rowsperstrip);
}
if (!BUFFERCHECK(tif))
return ((tmsize_t) -1);
tif->tif_flags |= TIFF_BUF4WRITE;
tif->tif_curstrip = strip;
if (td->td_stripsperimage == 0) {
TIFFErrorExt(tif->tif_clientdata, module, "Zero strips per image");
return ((tmsize_t) -1);
}
tif->tif_row = (strip % td->td_stripsperimage) * td->td_rowsperstrip;
if ((tif->tif_flags & TIFF_CODERSETUP) == 0) {
if (!(*tif->tif_setupencode)(tif))
return ((tmsize_t) -1);
tif->tif_flags |= TIFF_CODERSETUP;
}
if( td->td_stripbytecount[strip] > 0 )
{
if( tif->tif_rawdatasize <= (tmsize_t)td->td_stripbytecount[strip] )
{
if( !(TIFFWriteBufferSetup(tif, NULL,
(tmsize_t)TIFFroundup_64((uint64)(td->td_stripbytecount[strip] + 1), 1024))) )
return ((tmsize_t)(-1));
}
tif->tif_curoff = 0;
}
tif->tif_rawcc = 0;
tif->tif_rawcp = tif->tif_rawdata;
tif->tif_flags &= ~TIFF_POSTENCODE;
if( td->td_compression == COMPRESSION_NONE )
{
tif->tif_postdecode( tif, (uint8*) data, cc );
if (!isFillOrder(tif, td->td_fillorder) &&
(tif->tif_flags & TIFF_NOBITREV) == 0)
TIFFReverseBits((uint8*) data, cc);
if (cc > 0 &&
!TIFFAppendToStrip(tif, strip, (uint8*) data, cc))
return ((tmsize_t) -1);
return (cc);
}
sample = (uint16)(strip / td->td_stripsperimage);
if (!(*tif->tif_preencode)(tif, sample))
return ((tmsize_t) -1);
tif->tif_postdecode( tif, (uint8*) data, cc );
if (!(*tif->tif_encodestrip)(tif, (uint8*) data, cc, sample))
return ((tmsize_t) -1);
if (!(*tif->tif_postencode)(tif))
return ((tmsize_t) -1);
if (!isFillOrder(tif, td->td_fillorder) &&
(tif->tif_flags & TIFF_NOBITREV) == 0)
TIFFReverseBits(tif->tif_rawdata, tif->tif_rawcc);
if (tif->tif_rawcc > 0 &&
!TIFFAppendToStrip(tif, strip, tif->tif_rawdata, tif->tif_rawcc))
return ((tmsize_t) -1);
tif->tif_rawcc = 0;
tif->tif_rawcp = tif->tif_rawdata;
return (cc);
}
libtiff/tif_write.c:243: error: Buffer Overrun S2
Offset: `strip` Size: [0, +oo].
libtiff/tif_write.c:185:1: <Offset trace>
183. * NB: Image length must be setup before writing.
184. */
185. tmsize_t
^
186. TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc)
187. {
libtiff/tif_write.c:185:1: Parameter `strip`
183. * NB: Image length must be setup before writing.
184. */
185. tmsize_t
^
186. TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc)
187. {
libtiff/tif_write.c:185:1: <Length trace>
183. * NB: Image length must be setup before writing.
184. */
185. tmsize_t
^
186. TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc)
187. {
libtiff/tif_write.c:185:1: Parameter `*tif->tif_dir.td_stripbytecount`
183. * NB: Image length must be setup before writing.
184. */
185. tmsize_t
^
186. TIFFWriteEncodedStrip(TIFF* tif, uint32 strip, void* data, tmsize_t cc)
187. {
libtiff/tif_write.c:243:51: Array access: Offset: strip Size: [0, +oo]
241. /* so that TIFFAppendToStrip() will detect the overflow when it is called the first */
242. /* time if the new compressed tile is bigger than the older one. (GDAL #4771) */
243. if( tif->tif_rawdatasize <= (tmsize_t)td->td_stripbytecount[strip] )
^
244. {
245. if( !(TIFFWriteBufferSetup(tif, NULL,
|
https://gitlab.com/libtiff/libtiff/blob/f9fc01c331aa901375ff084b7421559f878ccf0b/libtiff/tif_write.c/#L243
|
d2a_code_trace_data_42697
|
int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info)
{
const char *p;
char tag[128], *q;
p = info;
if (*p == '?')
p++;
for(;;) {
q = tag;
while (*p != '\0' && *p != '=' && *p != '&') {
if ((q - tag) < sizeof(tag) - 1)
*q++ = *p;
p++;
}
*q = '\0';
q = arg;
if (*p == '=') {
p++;
while (*p != '&' && *p != '\0') {
if ((q - arg) < arg_size - 1) {
if (*p == '+')
*q++ = ' ';
else
*q++ = *p;
}
p++;
}
*q = '\0';
}
if (!strcmp(tag, tag1))
return 1;
if (*p != '&')
break;
p++;
}
return 0;
}
ffserver.c:2825: error: Buffer Overrun L1
Offset: [1, +oo] Size: 1 by call to `open_input_stream`.
ffserver.c:2825:13: Call
2823.
2824. /* open input stream */
2825. if (open_input_stream(rtp_c, "") < 0) {
^
2826. rtsp_reply_error(c, RTSP_STATUS_INTERNAL);
2827. return;
ffserver.c:1882:1: Parameter `*info`
1880. }
1881.
1882. static int open_input_stream(HTTPContext *c, const char *info)
^
1883. {
1884. char buf[128];
ffserver.c:1895:13: Call
1893. buf_size = FFM_PACKET_SIZE;
1894. /* compute position (absolute time) */
1895. if (find_info_tag(buf, sizeof(buf), "date", info))
^
1896. {
1897. stream_pos = parse_date(buf, 0);
libavformat/utils.c:2810:1: <Length trace>
2808. }
2809.
2810. int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info)
^
2811. {
2812. const char *p;
libavformat/utils.c:2810:1: Parameter `*info`
2808. }
2809.
2810. int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info)
^
2811. {
2812. const char *p;
libavformat/utils.c:2815:5: Assignment
2813. char tag[128], *q;
2814.
2815. p = info;
^
2816. if (*p == '?')
2817. p++;
libavformat/utils.c:2828:13: Assignment
2826. q = arg;
2827. if (*p == '=') {
2828. p++;
^
2829. while (*p != '&' && *p != '\0') {
2830. if ((q - arg) < arg_size - 1) {
libavformat/utils.c:2829:20: Array access: Offset: [1, +oo] Size: 1 by call to `open_input_stream`
2827. if (*p == '=') {
2828. p++;
2829. while (*p != '&' && *p != '\0') {
^
2830. if ((q - arg) < arg_size - 1) {
2831. if (*p == '+')
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/utils.c/#L2829
|
d2a_code_trace_data_42698
|
static void build_file_streams(void)
{
FFStream *stream, *stream_next;
AVFormatContext *infile;
int i;
for(stream = first_stream; stream != NULL; stream = stream_next) {
stream_next = stream->next;
if (stream->stream_type == STREAM_TYPE_LIVE &&
!stream->feed) {
stream->ap_in = av_mallocz(sizeof(AVFormatParameters));
if (stream->fmt && !strcmp(stream->fmt->name, "rtp")) {
stream->ap_in->mpeg2ts_raw = 1;
stream->ap_in->mpeg2ts_compute_pcr = 1;
}
if (av_open_input_file(&infile, stream->feed_filename,
stream->ifmt, 0, stream->ap_in) < 0) {
http_log("%s not found", stream->feed_filename);
fail:
remove_stream(stream);
} else {
if (av_find_stream_info(infile) < 0) {
http_log("Could not find codec parameters from '%s'",
stream->feed_filename);
av_close_input_file(infile);
goto fail;
}
extract_mpeg4_header(infile);
for(i=0;i<infile->nb_streams;i++)
add_av_stream1(stream, infile->streams[i]->codec);
av_close_input_file(infile);
}
}
}
}
ffserver.c:3306: error: Memory Leak
`stream` is not reachable after line 3306, column 14.
ffserver.c:3296:1: start of procedure build_file_streams()
3294.
3295. /* compute the needed AVStream for each file */
3296. static void build_file_streams(void)
^
3297. {
3298. FFStream *stream, *stream_next;
ffserver.c:3303:9:
3301.
3302. /* gather all streams */
3303. for(stream = first_stream; stream != NULL; stream = stream_next) {
^
3304. stream_next = stream->next;
3305. if (stream->stream_type == STREAM_TYPE_LIVE &&
ffserver.c:3303:32: Loop condition is true. Entering loop body
3301.
3302. /* gather all streams */
3303. for(stream = first_stream; stream != NULL; stream = stream_next) {
^
3304. stream_next = stream->next;
3305. if (stream->stream_type == STREAM_TYPE_LIVE &&
ffserver.c:3304:9:
3302. /* gather all streams */
3303. for(stream = first_stream; stream != NULL; stream = stream_next) {
3304. stream_next = stream->next;
^
3305. if (stream->stream_type == STREAM_TYPE_LIVE &&
3306. !stream->feed) {
ffserver.c:3305:13: Taking true branch
3303. for(stream = first_stream; stream != NULL; stream = stream_next) {
3304. stream_next = stream->next;
3305. if (stream->stream_type == STREAM_TYPE_LIVE &&
^
3306. !stream->feed) {
3307. /* the stream comes from a file */
ffserver.c:3306:14: Taking true branch
3304. stream_next = stream->next;
3305. if (stream->stream_type == STREAM_TYPE_LIVE &&
3306. !stream->feed) {
^
3307. /* the stream comes from a file */
3308. /* try to open the file */
ffserver.c:3310:13:
3308. /* try to open the file */
3309. /* open stream */
3310. stream->ap_in = av_mallocz(sizeof(AVFormatParameters));
^
3311. if (stream->fmt && !strcmp(stream->fmt->name, "rtp")) {
3312. /* specific case : if transport stream output to RTP,
libavutil/mem.c:132:1: start of procedure av_mallocz()
130. }
131.
132. void *av_mallocz(unsigned int size)
^
133. {
134. void *ptr = av_malloc(size);
libavutil/mem.c:134:5:
132. void *av_mallocz(unsigned int size)
133. {
134. void *ptr = av_malloc(size);
^
135. if (ptr)
136. memset(ptr, 0, size);
libavutil/mem.c:42:1: start of procedure av_malloc()
40. linker will do it automatically */
41.
42. void *av_malloc(unsigned int size)
^
43. {
44. void *ptr;
libavutil/mem.c:50:8: Taking false branch
48.
49. /* let's disallow possible ambiguous cases */
50. if(size > (INT_MAX-16) )
^
51. return NULL;
52.
libavutil/mem.c:61:5: Skipping memalign(): method has no implementation
59. ((char*)ptr)[-1]= diff;
60. #elif defined (HAVE_MEMALIGN)
61. ptr = memalign(16,size);
^
62. /* Why 64?
63. Indeed, we should align it:
libavutil/mem.c:91:5:
89. ptr = malloc(size);
90. #endif
91. return ptr;
^
92. }
93.
libavutil/mem.c:92:1: return from a call to av_malloc
90. #endif
91. return ptr;
92. }
^
93.
94. void *av_realloc(void *ptr, unsigned int size)
libavutil/mem.c:135:9: Taking false branch
133. {
134. void *ptr = av_malloc(size);
135. if (ptr)
^
136. memset(ptr, 0, size);
137. return ptr;
libavutil/mem.c:137:5:
135. if (ptr)
136. memset(ptr, 0, size);
137. return ptr;
^
138. }
139.
libavutil/mem.c:138:1: return from a call to av_mallocz
136. memset(ptr, 0, size);
137. return ptr;
138. }
^
139.
140. char *av_strdup(const char *s)
ffserver.c:3311:17: Taking true branch
3309. /* open stream */
3310. stream->ap_in = av_mallocz(sizeof(AVFormatParameters));
3311. if (stream->fmt && !strcmp(stream->fmt->name, "rtp")) {
^
3312. /* specific case : if transport stream output to RTP,
3313. we use a raw transport stream reader */
ffserver.c:3311:33: Taking false branch
3309. /* open stream */
3310. stream->ap_in = av_mallocz(sizeof(AVFormatParameters));
3311. if (stream->fmt && !strcmp(stream->fmt->name, "rtp")) {
^
3312. /* specific case : if transport stream output to RTP,
3313. we use a raw transport stream reader */
ffserver.c:3318:17:
3316. }
3317.
3318. if (av_open_input_file(&infile, stream->feed_filename,
^
3319. stream->ifmt, 0, stream->ap_in) < 0) {
3320. http_log("%s not found", stream->feed_filename);
libavformat/utils.c:416:1: start of procedure av_open_input_file()
414. #define PROBE_BUF_MAX (1<<20)
415.
416. int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
^
417. AVInputFormat *fmt,
418. int buf_size,
libavformat/utils.c:422:5:
420. {
421. int err, probe_size;
422. AVProbeData probe_data, *pd = &probe_data;
^
423. ByteIOContext *pb = NULL;
424.
libavformat/utils.c:423:5:
421. int err, probe_size;
422. AVProbeData probe_data, *pd = &probe_data;
423. ByteIOContext *pb = NULL;
^
424.
425. pd->filename = "";
libavformat/utils.c:425:5:
423. ByteIOContext *pb = NULL;
424.
425. pd->filename = "";
^
426. if (filename)
427. pd->filename = filename;
libavformat/utils.c:426:9: Taking true branch
424.
425. pd->filename = "";
426. if (filename)
^
427. pd->filename = filename;
428. pd->buf = NULL;
libavformat/utils.c:427:9:
425. pd->filename = "";
426. if (filename)
427. pd->filename = filename;
^
428. pd->buf = NULL;
429. pd->buf_size = 0;
libavformat/utils.c:428:5:
426. if (filename)
427. pd->filename = filename;
428. pd->buf = NULL;
^
429. pd->buf_size = 0;
430.
libavformat/utils.c:429:5:
427. pd->filename = filename;
428. pd->buf = NULL;
429. pd->buf_size = 0;
^
430.
431. if (!fmt) {
libavformat/utils.c:431:10: Taking false branch
429. pd->buf_size = 0;
430.
431. if (!fmt) {
^
432. /* guess format if no file can be opened */
433. fmt = av_probe_input_format(pd, 0);
libavformat/utils.c:438:10: Taking false branch
436. /* Do not open file if the format does not need it. XXX: specific
437. hack needed to handle RTSP/TCP */
438. if (!fmt || !(fmt->flags & AVFMT_NOFILE)) {
^
439. /* if no file needed do not try to open one */
440. if ((err=url_fopen(&pb, filename, URL_RDONLY)) < 0) {
libavformat/utils.c:438:19: Taking true branch
436. /* Do not open file if the format does not need it. XXX: specific
437. hack needed to handle RTSP/TCP */
438. if (!fmt || !(fmt->flags & AVFMT_NOFILE)) {
^
439. /* if no file needed do not try to open one */
440. if ((err=url_fopen(&pb, filename, URL_RDONLY)) < 0) {
libavformat/utils.c:440:13:
438. if (!fmt || !(fmt->flags & AVFMT_NOFILE)) {
439. /* if no file needed do not try to open one */
440. if ((err=url_fopen(&pb, filename, URL_RDONLY)) < 0) {
^
441. goto fail;
442. }
libavformat/aviobuf.c:585:1: start of procedure url_fopen()
583. }
584.
585. int url_fopen(ByteIOContext **s, const char *filename, int flags)
^
586. {
587. URLContext *h;
libavformat/aviobuf.c:590:5: Skipping url_open(): empty list of specs
588. int err;
589.
590. err = url_open(&h, filename, flags);
^
591. if (err < 0)
592. return err;
libavformat/aviobuf.c:591:9: Taking true branch
589.
590. err = url_open(&h, filename, flags);
591. if (err < 0)
^
592. return err;
593. err = url_fdopen(s, h);
libavformat/aviobuf.c:592:9:
590. err = url_open(&h, filename, flags);
591. if (err < 0)
592. return err;
^
593. err = url_fdopen(s, h);
594. if (err < 0) {
libavformat/aviobuf.c:599:1: return from a call to url_fopen
597. }
598. return 0;
599. }
^
600.
601. int url_fclose(ByteIOContext *s)
libavformat/utils.c:440:13: Taking true branch
438. if (!fmt || !(fmt->flags & AVFMT_NOFILE)) {
439. /* if no file needed do not try to open one */
440. if ((err=url_fopen(&pb, filename, URL_RDONLY)) < 0) {
^
441. goto fail;
442. }
libavformat/utils.c:484:2:
482. goto fail;
483. return 0;
484. fail:
^
485. av_freep(&pd->buf);
486. if (pb)
libavformat/utils.c:485:5:
483. return 0;
484. fail:
485. av_freep(&pd->buf);
^
486. if (pb)
487. url_fclose(pb);
libavutil/mem.c:125:1: start of procedure av_freep()
123. }
124.
125. void av_freep(void *arg)
^
126. {
127. void **ptr= (void**)arg;
libavutil/mem.c:127:5:
125. void av_freep(void *arg)
126. {
127. void **ptr= (void**)arg;
^
128. av_free(*ptr);
129. *ptr = NULL;
libavutil/mem.c:128:5:
126. {
127. void **ptr= (void**)arg;
128. av_free(*ptr);
^
129. *ptr = NULL;
130. }
libavutil/mem.c:114:1: start of procedure av_free()
112. }
113.
114. void av_free(void *ptr)
^
115. {
116. /* XXX: this test should not be needed on most libcs */
libavutil/mem.c:117:9: Taking false branch
115. {
116. /* XXX: this test should not be needed on most libcs */
117. if (ptr)
^
118. #ifdef CONFIG_MEMALIGN_HACK
119. free((char*)ptr - ((char*)ptr)[-1]);
libavutil/mem.c:117:5:
115. {
116. /* XXX: this test should not be needed on most libcs */
117. if (ptr)
^
118. #ifdef CONFIG_MEMALIGN_HACK
119. free((char*)ptr - ((char*)ptr)[-1]);
libavutil/mem.c:123:1: return from a call to av_free
121. free(ptr);
122. #endif
123. }
^
124.
125. void av_freep(void *arg)
libavutil/mem.c:129:5:
127. void **ptr= (void**)arg;
128. av_free(*ptr);
129. *ptr = NULL;
^
130. }
131.
libavutil/mem.c:130:1: return from a call to av_freep
128. av_free(*ptr);
129. *ptr = NULL;
130. }
^
131.
132. void *av_mallocz(unsigned int size)
libavformat/utils.c:486:9: Taking false branch
484. fail:
485. av_freep(&pd->buf);
486. if (pb)
^
487. url_fclose(pb);
488. *ic_ptr = NULL;
libavformat/utils.c:488:5:
486. if (pb)
487. url_fclose(pb);
488. *ic_ptr = NULL;
^
489. return err;
490.
libavformat/utils.c:489:5:
487. url_fclose(pb);
488. *ic_ptr = NULL;
489. return err;
^
490.
491. }
libavformat/utils.c:491:1: return from a call to av_open_input_file
489. return err;
490.
491. }
^
492.
493. /*******************************************************/
ffserver.c:3318:17: Taking true branch
3316. }
3317.
3318. if (av_open_input_file(&infile, stream->feed_filename,
^
3319. stream->ifmt, 0, stream->ap_in) < 0) {
3320. http_log("%s not found", stream->feed_filename);
ffserver.c:3320:17:
3318. if (av_open_input_file(&infile, stream->feed_filename,
3319. stream->ifmt, 0, stream->ap_in) < 0) {
3320. http_log("%s not found", stream->feed_filename);
^
3321. /* remove stream (no need to spend more time on it) */
3322. fail:
ffserver.c:308:1: start of procedure http_log()
306. static FILE *logfile = NULL;
307.
308. static void __attribute__ ((format (printf, 1, 2))) http_log(const char *fmt, ...)
^
309. {
310. va_list ap;
ffserver.c:311:5:
309. {
310. va_list ap;
311. va_start(ap, fmt);
^
312.
313. if (logfile) {
ffserver.c:313:9: Taking true branch
311. va_start(ap, fmt);
312.
313. if (logfile) {
^
314. vfprintf(logfile, fmt, ap);
315. fflush(logfile);
ffserver.c:314:9:
312.
313. if (logfile) {
314. vfprintf(logfile, fmt, ap);
^
315. fflush(logfile);
316. }
ffserver.c:315:9:
313. if (logfile) {
314. vfprintf(logfile, fmt, ap);
315. fflush(logfile);
^
316. }
317. va_end(ap);
ffserver.c:317:5:
315. fflush(logfile);
316. }
317. va_end(ap);
^
318. }
319.
ffserver.c:318:1: return from a call to http_log
316. }
317. va_end(ap);
318. }
^
319.
320. static char *ctime1(char *buf2)
ffserver.c:3322:13:
3320. http_log("%s not found", stream->feed_filename);
3321. /* remove stream (no need to spend more time on it) */
3322. fail:
^
3323. remove_stream(stream);
3324. } else {
ffserver.c:3323:17: Skipping remove_stream(): empty list of specs
3321. /* remove stream (no need to spend more time on it) */
3322. fail:
3323. remove_stream(stream);
^
3324. } else {
3325. /* find all the AVStreams inside and reference them in
ffserver.c:3303:48:
3301.
3302. /* gather all streams */
3303. for(stream = first_stream; stream != NULL; stream = stream_next) {
^
3304. stream_next = stream->next;
3305. if (stream->stream_type == STREAM_TYPE_LIVE &&
ffserver.c:3303:32: Loop condition is true. Entering loop body
3301.
3302. /* gather all streams */
3303. for(stream = first_stream; stream != NULL; stream = stream_next) {
^
3304. stream_next = stream->next;
3305. if (stream->stream_type == STREAM_TYPE_LIVE &&
ffserver.c:3304:9:
3302. /* gather all streams */
3303. for(stream = first_stream; stream != NULL; stream = stream_next) {
3304. stream_next = stream->next;
^
3305. if (stream->stream_type == STREAM_TYPE_LIVE &&
3306. !stream->feed) {
ffserver.c:3305:13: Taking true branch
3303. for(stream = first_stream; stream != NULL; stream = stream_next) {
3304. stream_next = stream->next;
3305. if (stream->stream_type == STREAM_TYPE_LIVE &&
^
3306. !stream->feed) {
3307. /* the stream comes from a file */
ffserver.c:3306:14: Taking false branch
3304. stream_next = stream->next;
3305. if (stream->stream_type == STREAM_TYPE_LIVE &&
3306. !stream->feed) {
^
3307. /* the stream comes from a file */
3308. /* try to open the file */
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/ffserver.c/#L3306
|
d2a_code_trace_data_42699
|
int BN_set_word(BIGNUM *a, BN_ULONG w)
{
bn_check_top(a);
if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
return 0;
a->neg = 0;
a->d[0] = w;
a->top = (w ? 1 : 0);
bn_check_top(a);
return 1;
}
crypto/sm2/sm2_crypt.c:139: error: BUFFER_OVERRUN_L3
Offset: 0 Size: [0, 8388607] by call to `BN_priv_rand_range`.
Showing all 15 steps of the trace
crypto/sm2/sm2_crypt.c:122:9: Call
120.
121. BN_CTX_start(ctx);
122. k = BN_CTX_get(ctx);
^
123. x1 = BN_CTX_get(ctx);
124. x2 = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:229:5: Call
227. }
228. /* OK, make sure the returned bignum is "zero" */
229. BN_zero(ret);
^
230. ctx->used++;
231. CTXDBG_RET(ctx, ret);
crypto/bn/bn_lib.c:357:1: Parameter `*a->d`
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->d`
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/sm2/sm2_crypt.c:139:5: Call
137. memset(ciphertext_buf, 0, *ciphertext_len);
138.
139. BN_priv_rand_range(k, order);
^
140.
141. if (EC_POINT_mul(group, kG, k, NULL, NULL, ctx) == 0)
crypto/bn/bn_rand.c:182:1: Parameter `*r->d`
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->d`
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: <Length trace>
355. }
356.
357. > int BN_set_word(BIGNUM *a, BN_ULONG w)
358. {
359. bn_check_top(a);
crypto/bn/bn_lib.c:357:1: Parameter `*a->d`
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->d`
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_lib.c:363:5: Array access: Offset: 0 Size: [0, 8388607] by call to `BN_priv_rand_range`
361. return 0;
362. a->neg = 0;
363. a->d[0] = w;
^
364. a->top = (w ? 1 : 0);
365. bn_check_top(a);
|
https://github.com/openssl/openssl/blob/440bce8f813fa661437ce52378c3df38e2fd073b/crypto/bn/bn_lib.c/#L363
|
d2a_code_trace_data_42700
|
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:1906: error: Buffer Overrun L2
Offset: [1, 2] (⇐ 1 + [0, 1]) Size: 2 by call to `interlaced_search`.
libavcodec/motion_est.c:1838:1: Parameter `s->b_field_mv_table[*]`
1836. }
1837.
1838. void ff_estimate_b_frame_motion(MpegEncContext * s,
^
1839. int mb_x, int mb_y)
1840. {
libavcodec/motion_est.c:1906:17: Call
1904. c->skip=0;
1905. c->current_mv_penalty= c->mv_penalty[s->b_code] + MAX_MV;
1906. interlaced_search(s, 2,
^
1907. s->b_field_mv_table[1], s->b_field_select_table[1],
1908. s->b_back_mv_table[xy][0], s->b_back_mv_table[xy][1], 1);
libavcodec/motion_est.c:893:1: <Offset 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 `**field_select_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: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:921:37: Array access: Offset: [1, 2] (⇐ 1 + [0, 1]) Size: 2 by call to `interlaced_search`
919. for(field_select=0; field_select<2; field_select++){
920. int dmin, mx_i, my_i;
921. int16_t (*mv_table)[2]= mv_tables[block][field_select];
^
922.
923. if(user_field_select){
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est.c/#L921
|
d2a_code_trace_data_42701
|
static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
unsigned int global_gain,
IndividualChannelStream *ics,
enum BandType band_type[120],
int band_type_run_end[120])
{
int g, i, idx = 0;
int offset[3] = { global_gain, global_gain - 90, 0 };
int clipped_offset;
int noise_flag = 1;
for (g = 0; g < ics->num_window_groups; g++) {
for (i = 0; i < ics->max_sfb;) {
int run_end = band_type_run_end[idx];
if (band_type[idx] == ZERO_BT) {
for (; i < run_end; i++, idx++)
sf[idx] = 0.;
} else if ((band_type[idx] == INTENSITY_BT) ||
(band_type[idx] == INTENSITY_BT2)) {
for (; i < run_end; i++, idx++) {
offset[2] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
clipped_offset = av_clip(offset[2], -155, 100);
if (offset[2] != clipped_offset) {
avpriv_request_sample(ac->avctx,
"If you heard an audible artifact, there may be a bug in the decoder. "
"Clipped intensity stereo position (%d -> %d)",
offset[2], clipped_offset);
}
sf[idx] = ff_aac_pow2sf_tab[-clipped_offset + POW_SF2_ZERO];
}
} else if (band_type[idx] == NOISE_BT) {
for (; i < run_end; i++, idx++) {
if (noise_flag-- > 0)
offset[1] += get_bits(gb, 9) - 256;
else
offset[1] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
clipped_offset = av_clip(offset[1], -100, 155);
if (offset[1] != clipped_offset) {
avpriv_request_sample(ac->avctx,
"If you heard an audible artifact, there may be a bug in the decoder. "
"Clipped noise gain (%d -> %d)",
offset[1], clipped_offset);
}
sf[idx] = -ff_aac_pow2sf_tab[clipped_offset + POW_SF2_ZERO];
}
} else {
for (; i < run_end; i++, idx++) {
offset[0] += get_vlc2(gb, vlc_scalefactors.table, 7, 3) - 60;
if (offset[0] > 255U) {
av_log(ac->avctx, AV_LOG_ERROR,
"Scalefactor (%d) out of range.\n", offset[0]);
return AVERROR_INVALIDDATA;
}
sf[idx] = -ff_aac_pow2sf_tab[offset[0] - 100 + POW_SF2_ZERO];
}
}
}
}
return 0;
}
libavcodec/aacdec.c:1721: error: Integer Overflow L2
([0, +oo] - 90):unsigned32 by call to `decode_scalefactors`.
libavcodec/aacdec.c:1711:19: Call
1709. pulse.num_pulse = 0;
1710.
1711. global_gain = get_bits(gb, 8);
^
1712.
1713. if (!common_window && !scale_flag) {
libavcodec/get_bits.h:244:5: Call
242. register int tmp;
243. OPEN_READER(re, s);
244. UPDATE_CACHE(re, s);
^
245. tmp = SHOW_UBITS(re, s, n);
246. LAST_SKIP_BITS(re, s, n);
libavutil/bswap.h:66:1: Parameter `x`
64.
65. #ifndef av_bswap32
66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
^
67. {
68. return AV_BSWAP32C(x);
libavutil/bswap.h:68:5: Assignment
66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
67. {
68. return AV_BSWAP32C(x);
^
69. }
70. #endif
libavcodec/get_bits.h:244:5: Assignment
242. register int tmp;
243. OPEN_READER(re, s);
244. UPDATE_CACHE(re, s);
^
245. tmp = SHOW_UBITS(re, s, n);
246. LAST_SKIP_BITS(re, s, n);
libavcodec/get_bits.h:245:5: Assignment
243. OPEN_READER(re, s);
244. UPDATE_CACHE(re, s);
245. tmp = SHOW_UBITS(re, s, n);
^
246. LAST_SKIP_BITS(re, s, n);
247. CLOSE_READER(re, s);
libavcodec/get_bits.h:248:5: Assignment
246. LAST_SKIP_BITS(re, s, n);
247. CLOSE_READER(re, s);
248. return tmp;
^
249. }
250.
libavcodec/aacdec.c:1711:5: Assignment
1709. pulse.num_pulse = 0;
1710.
1711. global_gain = get_bits(gb, 8);
^
1712.
1713. if (!common_window && !scale_flag) {
libavcodec/aacdec.c:1721:16: Call
1719. sce->band_type_run_end, gb, ics)) < 0)
1720. return ret;
1721. if ((ret = decode_scalefactors(ac, sce->sf, gb, global_gain, ics,
^
1722. sce->band_type, sce->band_type_run_end)) < 0)
1723. return ret;
libavcodec/aacdec.c:1160:1: <LHS trace>
1158. * @return Returns error status. 0 - OK, !0 - error
1159. */
1160. static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
^
1161. unsigned int global_gain,
1162. IndividualChannelStream *ics,
libavcodec/aacdec.c:1160:1: Parameter `global_gain`
1158. * @return Returns error status. 0 - OK, !0 - error
1159. */
1160. static int decode_scalefactors(AACContext *ac, float sf[120], GetBitContext *gb,
^
1161. unsigned int global_gain,
1162. IndividualChannelStream *ics,
libavcodec/aacdec.c:1167:21: Binary operation: ([0, +oo] - 90):unsigned32 by call to `decode_scalefactors`
1165. {
1166. int g, i, idx = 0;
1167. int offset[3] = { global_gain, global_gain - 90, 0 };
^
1168. int clipped_offset;
1169. int noise_flag = 1;
|
https://github.com/libav/libav/blob/6652338f43ef623045912d7f28b61adea05d27ae/libavcodec/aacdec.c/#L1167
|
d2a_code_trace_data_42702
|
static int flv_write_header(AVFormatContext *s)
{
ByteIOContext *pb = s->pb;
FLVContext *flv = s->priv_data;
int i, width, height, samplerate, samplesize, channels, audiocodecid, videocodecid;
double framerate = 0.0;
int metadata_size_pos, data_size;
flv->hasAudio = 0;
flv->hasVideo = 0;
for(i=0; i<s->nb_streams; i++){
AVCodecContext *enc = s->streams[i]->codec;
if (enc->codec_type == CODEC_TYPE_VIDEO) {
width = enc->width;
height = enc->height;
if (s->streams[i]->r_frame_rate.den && s->streams[i]->r_frame_rate.num) {
framerate = av_q2d(s->streams[i]->r_frame_rate);
} else {
framerate = 1/av_q2d(s->streams[i]->codec->time_base);
}
flv->hasVideo=1;
videocodecid = enc->codec_tag;
if(videocodecid == 0) {
av_log(enc, AV_LOG_ERROR, "video codec not compatible with flv\n");
return -1;
}
} else {
flv->hasAudio=1;
samplerate = enc->sample_rate;
channels = enc->channels;
audiocodecid = enc->codec_tag;
samplesize = (enc->codec_id == CODEC_ID_PCM_S8) ? 8 : 16;
if(get_audio_flags(enc)<0)
return -1;
}
av_set_pts_info(s->streams[i], 24, 1, 1000);
}
put_tag(pb,"FLV");
put_byte(pb,1);
put_byte(pb, FLV_HEADER_FLAG_HASAUDIO * flv->hasAudio
+ FLV_HEADER_FLAG_HASVIDEO * flv->hasVideo);
put_be32(pb,9);
put_be32(pb,0);
for(i=0; i<s->nb_streams; i++){
if(s->streams[i]->codec->codec_tag == 5){
put_byte(pb,8);
put_be24(pb,0);
put_be24(pb,0);
put_be32(pb,0);
put_be32(pb,11);
flv->reserved=5;
}
}
put_byte(pb, 18);
metadata_size_pos= url_ftell(pb);
put_be24(pb, 0);
put_be24(pb, 0);
put_be32(pb, 0);
put_byte(pb, AMF_DATA_TYPE_STRING);
put_amf_string(pb, "onMetaData");
put_byte(pb, AMF_DATA_TYPE_MIXEDARRAY);
put_be32(pb, 5*flv->hasVideo + 4*flv->hasAudio + 2);
put_amf_string(pb, "duration");
flv->duration_offset= url_ftell(pb);
put_amf_double(pb, 0);
if(flv->hasVideo){
put_amf_string(pb, "width");
put_amf_double(pb, width);
put_amf_string(pb, "height");
put_amf_double(pb, height);
put_amf_string(pb, "videodatarate");
put_amf_double(pb, s->bit_rate / 1024.0);
put_amf_string(pb, "framerate");
put_amf_double(pb, framerate);
put_amf_string(pb, "videocodecid");
put_amf_double(pb, videocodecid);
}
if(flv->hasAudio){
put_amf_string(pb, "audiosamplerate");
put_amf_double(pb, samplerate);
put_amf_string(pb, "audiosamplesize");
put_amf_double(pb, samplesize);
put_amf_string(pb, "stereo");
put_amf_bool(pb, (channels == 2));
put_amf_string(pb, "audiocodecid");
put_amf_double(pb, audiocodecid);
}
put_amf_string(pb, "filesize");
flv->filesize_offset= url_ftell(pb);
put_amf_double(pb, 0);
put_amf_string(pb, "");
put_byte(pb, AMF_END_OF_OBJECT);
data_size= url_ftell(pb) - metadata_size_pos - 10;
url_fseek(pb, metadata_size_pos, SEEK_SET);
put_be24(pb, data_size);
url_fseek(pb, data_size + 10 - 3, SEEK_CUR);
put_be32(pb, data_size + 11);
return 0;
}
libavformat/flvenc.c:221: error: Uninitialized Value
The value read from videocodecid was never initialized.
libavformat/flvenc.c:221:9:
219.
220. put_amf_string(pb, "videocodecid");
221. put_amf_double(pb, videocodecid);
^
222. }
223.
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/flvenc.c/#L221
|
d2a_code_trace_data_42703
|
void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
{
unsigned long hash;
OPENSSL_LH_NODE *nn, **rn;
void *ret;
lh->error = 0;
rn = getrn(lh, data, &hash);
if (*rn == NULL) {
lh->num_no_delete++;
return NULL;
} else {
nn = *rn;
*rn = nn->next;
ret = nn->data;
OPENSSL_free(nn);
lh->num_delete++;
}
lh->num_items--;
if ((lh->num_nodes > MIN_NODES) &&
(lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
contract(lh);
return ret;
}
test/sslapitest.c:5682: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned64 by call to `SSL_free`.
Showing all 17 steps of the trace
test/sslapitest.c:5673:10: Call
5671. verify_cb);
5672.
5673. if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl,
^
5674. NULL, NULL))
5675. || !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_items`
669. }
670.
671. > SSL *SSL_new(SSL_CTX *ctx)
672. {
673. SSL *s;
test/sslapitest.c:5682:5: Call
5680.
5681. end:
5682. SSL_free(serverssl);
^
5683. SSL_free(clientssl);
5684. SSL_CTX_free(sctx);
ssl/ssl_lib.c:1133:1: Parameter `s->session_ctx->sessions->num_items`
1131. }
1132.
1133. > void SSL_free(SSL *s)
1134. {
1135. int i;
ssl/ssl_lib.c:1164:9: Call
1162. /* Make the next call work :-) */
1163. if (s->session != NULL) {
1164. ssl_clear_bad_session(s);
^
1165. SSL_SESSION_free(s->session);
1166. }
ssl/ssl_sess.c:1124:1: Parameter `s->session_ctx->sessions->num_items`
1122. }
1123.
1124. > int ssl_clear_bad_session(SSL *s)
1125. {
1126. if ((s->session != NULL) &&
ssl/ssl_sess.c:1129:9: Call
1127. !(s->shutdown & SSL_SENT_SHUTDOWN) &&
1128. !(SSL_in_init(s) || SSL_in_before(s))) {
1129. SSL_CTX_remove_session(s->session_ctx, s->session);
^
1130. return 1;
1131. } else
ssl/ssl_sess.c:742:1: Parameter `ctx->sessions->num_items`
740. }
741.
742. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
743. {
744. return remove_session_lock(ctx, c, 1);
ssl/ssl_sess.c:744:12: Call
742. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
743. {
744. return remove_session_lock(ctx, c, 1);
^
745. }
746.
ssl/ssl_sess.c:747:1: Parameter `ctx->sessions->num_items`
745. }
746.
747. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
748. {
749. SSL_SESSION *r;
ssl/ssl_sess.c:757:17: Call
755. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) != NULL) {
756. ret = 1;
757. r = lh_SSL_SESSION_delete(ctx->sessions, r);
^
758. SSL_SESSION_list_remove(ctx, r);
759. }
ssl/ssl_locl.h:732:1: Parameter `lh->num_items`
730. } TLSEXT_INDEX;
731.
732. > DEFINE_LHASH_OF(SSL_SESSION);
733. /* Needed in ssl_cert.c */
734. DEFINE_LHASH_OF(X509_NAME);
ssl/ssl_locl.h:732:1: Call
730. } TLSEXT_INDEX;
731.
732. > DEFINE_LHASH_OF(SSL_SESSION);
733. /* Needed in ssl_cert.c */
734. DEFINE_LHASH_OF(X509_NAME);
crypto/lhash/lhash.c:128:1: <LHS trace>
126. }
127.
128. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
129. {
130. unsigned long hash;
crypto/lhash/lhash.c:128:1: Parameter `lh->num_items`
126. }
127.
128. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
129. {
130. unsigned long hash;
crypto/lhash/lhash.c:148:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `SSL_free`
146. }
147.
148. lh->num_items--;
^
149. if ((lh->num_nodes > MIN_NODES) &&
150. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
|
https://github.com/openssl/openssl/blob/6e68dae85a8f91944370125561c7ec0d5da46c20/crypto/lhash/lhash.c/#L148
|
d2a_code_trace_data_42704
|
void CRYPTO_free(void *str)
{
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
if (call_malloc_debug) {
CRYPTO_mem_debug_free(str, 0);
free(str);
CRYPTO_mem_debug_free(str, 1);
} else {
free(str);
}
#else
free(str);
#endif
}
crypto/conf/conf_mod.c:435: error: USE_AFTER_FREE
call to `module_finish()` eventually accesses memory that was invalidated by call to `free()` on line 435 indirectly during the call to `module_finish()`.
Showing all 20 steps of the trace
crypto/conf/conf_mod.c:433:32: invalidation part of the trace starts here
431. {
432. CONF_IMODULE *imod;
433. while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
^
434. imod = sk_CONF_IMODULE_pop(initialized_modules);
435. module_finish(imod);
crypto/conf/conf_mod.c:433:32: global variable `initialized_modules` accessed here
431. {
432. CONF_IMODULE *imod;
433. while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
^
434. imod = sk_CONF_IMODULE_pop(initialized_modules);
435. module_finish(imod);
crypto/conf/conf_mod.c:434:16: passed as argument to `sk_CONF_IMODULE_pop`
432. CONF_IMODULE *imod;
433. while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
434. imod = sk_CONF_IMODULE_pop(initialized_modules);
^
435. module_finish(imod);
436. }
crypto/conf/conf_mod.c:434:16: return from call to `sk_CONF_IMODULE_pop`
432. CONF_IMODULE *imod;
433. while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
434. imod = sk_CONF_IMODULE_pop(initialized_modules);
^
435. module_finish(imod);
436. }
crypto/conf/conf_mod.c:434:9: assigned
432. CONF_IMODULE *imod;
433. while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
434. imod = sk_CONF_IMODULE_pop(initialized_modules);
^
435. module_finish(imod);
436. }
crypto/conf/conf_mod.c:435:9: when calling `module_finish` here
433. while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
434. imod = sk_CONF_IMODULE_pop(initialized_modules);
435. module_finish(imod);
^
436. }
437. sk_CONF_IMODULE_free(initialized_modules);
crypto/conf/conf_mod.c:443:1: parameter `imod` of module_finish
441. /* finish a module instance */
442.
443. > static void module_finish(CONF_IMODULE *imod)
444. {
445. if (!imod)
crypto/conf/conf_mod.c:452:5: when calling `CRYPTO_free` here
450. OPENSSL_free(imod->name);
451. OPENSSL_free(imod->value);
452. OPENSSL_free(imod);
^
453. }
454.
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/conf/conf_mod.c:433:32: use-after-lifetime part of the trace starts here
431. {
432. CONF_IMODULE *imod;
433. while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
^
434. imod = sk_CONF_IMODULE_pop(initialized_modules);
435. module_finish(imod);
crypto/conf/conf_mod.c:433:32: global variable `initialized_modules` accessed here
431. {
432. CONF_IMODULE *imod;
433. while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
^
434. imod = sk_CONF_IMODULE_pop(initialized_modules);
435. module_finish(imod);
crypto/conf/conf_mod.c:434:16: passed as argument to `sk_CONF_IMODULE_pop`
432. CONF_IMODULE *imod;
433. while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
434. imod = sk_CONF_IMODULE_pop(initialized_modules);
^
435. module_finish(imod);
436. }
crypto/conf/conf_mod.c:434:16: return from call to `sk_CONF_IMODULE_pop`
432. CONF_IMODULE *imod;
433. while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
434. imod = sk_CONF_IMODULE_pop(initialized_modules);
^
435. module_finish(imod);
436. }
crypto/conf/conf_mod.c:434:9: assigned
432. CONF_IMODULE *imod;
433. while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
434. imod = sk_CONF_IMODULE_pop(initialized_modules);
^
435. module_finish(imod);
436. }
crypto/conf/conf_mod.c:435:9: when calling `module_finish` here
433. while (sk_CONF_IMODULE_num(initialized_modules) > 0) {
434. imod = sk_CONF_IMODULE_pop(initialized_modules);
435. module_finish(imod);
^
436. }
437. sk_CONF_IMODULE_free(initialized_modules);
crypto/conf/conf_mod.c:443:1: parameter `imod` of module_finish
441. /* finish a module instance */
442.
443. > static void module_finish(CONF_IMODULE *imod)
444. {
445. if (!imod)
crypto/conf/conf_mod.c:452:5: when calling `CRYPTO_free` here
450. OPENSSL_free(imod->name);
451. OPENSSL_free(imod->value);
452. OPENSSL_free(imod);
^
453. }
454.
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: invalid access occurs here
243. }
244. #else
245. free(str);
^
246. #endif
247. }
|
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/mem.c/#L245
|
d2a_code_trace_data_42705
|
static int kek_unwrap_key(unsigned char *out, size_t *outlen,
const unsigned char *in, size_t inlen,
EVP_CIPHER_CTX *ctx)
{
size_t blocklen = EVP_CIPHER_CTX_block_size(ctx);
unsigned char *tmp;
int outl, rv = 0;
if (inlen < 2 * blocklen) {
return 0;
}
if (inlen % blocklen) {
return 0;
}
if ((tmp = OPENSSL_malloc(inlen)) == NULL) {
CMSerr(CMS_F_KEK_UNWRAP_KEY, ERR_R_MALLOC_FAILURE);
return 0;
}
if (!EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, &outl,
in + inlen - 2 * blocklen, blocklen * 2)
|| !EVP_DecryptUpdate(ctx, tmp, &outl,
tmp + inlen - blocklen, blocklen)
|| !EVP_DecryptUpdate(ctx, tmp, &outl, in, inlen - blocklen)
|| !EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, NULL)
|| !EVP_DecryptUpdate(ctx, tmp, &outl, tmp, inlen))
goto err;
if (((tmp[1] ^ tmp[4]) & (tmp[2] ^ tmp[5]) & (tmp[3] ^ tmp[6])) != 0xff) {
goto err;
}
if (inlen < (size_t)(tmp[0] - 4)) {
goto err;
}
*outlen = (size_t)tmp[0];
memcpy(out, tmp + 4, *outlen);
rv = 1;
err:
OPENSSL_clear_free(tmp, inlen);
return rv;
}
crypto/cms/cms_smime.c:720: error: BUFFER_OVERRUN_L3
Offset: 6 Size: [1, +oo] by call to `CMS_RecipientInfo_decrypt`.
Showing all 13 steps of the trace
crypto/cms/cms_smime.c:720:13: Call
718. continue;
719. CMS_RecipientInfo_set0_password(ri, pass, passlen);
720. r = CMS_RecipientInfo_decrypt(cms, ri);
^
721. CMS_RecipientInfo_set0_password(ri, NULL, 0);
722. if (r > 0)
crypto/cms/cms_env.c:739:1: Parameter `ri->d.pwri->encryptedKey->length`
737. }
738.
739. > int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri)
740. {
741. switch (ri->type) {
crypto/cms/cms_smime.c:720:13: Call
718. continue;
719. CMS_RecipientInfo_set0_password(ri, pass, passlen);
720. r = CMS_RecipientInfo_decrypt(cms, ri);
^
721. CMS_RecipientInfo_set0_password(ri, NULL, 0);
722. if (r > 0)
crypto/cms/cms_env.c:739:1: Parameter `ri->d.pwri->encryptedKey->length`
737. }
738.
739. > int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri)
740. {
741. switch (ri->type) {
crypto/cms/cms_env.c:749:16: Call
747.
748. case CMS_RECIPINFO_PASS:
749. return cms_RecipientInfo_pwri_crypt(cms, ri, 0);
^
750.
751. default:
crypto/cms/cms_pwri.c:276:1: Parameter `ri->d.pwri->encryptedKey->length`
274. /* Encrypt/Decrypt content key in PWRI recipient info */
275.
276. > int cms_RecipientInfo_pwri_crypt(const CMS_ContentInfo *cms, CMS_RecipientInfo *ri,
277. int en_de)
278. {
crypto/cms/cms_pwri.c:369:14: Call
367. goto err;
368. }
369. if (!kek_unwrap_key(key, &keylen,
^
370. pwri->encryptedKey->data,
371. pwri->encryptedKey->length, kekctx)) {
crypto/cms/cms_pwri.c:176:1: <Length trace>
174. */
175.
176. > static int kek_unwrap_key(unsigned char *out, size_t *outlen,
177. const unsigned char *in, size_t inlen,
178. EVP_CIPHER_CTX *ctx)
crypto/cms/cms_pwri.c:176:1: Parameter `inlen`
174. */
175.
176. > static int kek_unwrap_key(unsigned char *out, size_t *outlen,
177. const unsigned char *in, size_t inlen,
178. EVP_CIPHER_CTX *ctx)
crypto/cms/cms_pwri.c:191:16: Call
189. return 0;
190. }
191. if ((tmp = OPENSSL_malloc(inlen)) == NULL) {
^
192. CMSerr(CMS_F_KEK_UNWRAP_KEY, ERR_R_MALLOC_FAILURE);
193. return 0;
crypto/mem.c:201:9: Assignment
199.
200. if (num == 0)
201. return NULL;
^
202.
203. FAILTEST();
crypto/cms/cms_pwri.c:191:10: Assignment
189. return 0;
190. }
191. if ((tmp = OPENSSL_malloc(inlen)) == NULL) {
^
192. CMSerr(CMS_F_KEK_UNWRAP_KEY, ERR_R_MALLOC_FAILURE);
193. return 0;
crypto/cms/cms_pwri.c:214:60: Array access: Offset: 6 Size: [1, +oo] by call to `CMS_RecipientInfo_decrypt`
212. goto err;
213. /* Check check bytes */
214. if (((tmp[1] ^ tmp[4]) & (tmp[2] ^ tmp[5]) & (tmp[3] ^ tmp[6])) != 0xff) {
^
215. /* Check byte failure */
216. goto err;
|
https://github.com/openssl/openssl/blob/bcf082d130a413a728a382bd6e6bfdbf2cedba45/crypto/cms/cms_pwri.c/#L214
|
d2a_code_trace_data_42706
|
tmsize_t
TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size)
{
static const char module[] = "TIFFReadEncodedStrip";
TIFFDirectory *td = &tif->tif_dir;
uint32 rowsperstrip;
uint32 stripsperplane;
uint32 stripinplane;
uint16 plane;
uint32 rows;
tmsize_t stripsize;
if (!TIFFCheckRead(tif,0))
return((tmsize_t)(-1));
if (strip>=td->td_nstrips)
{
TIFFErrorExt(tif->tif_clientdata,module,
"%lu: Strip out of range, max %lu",(unsigned long)strip,
(unsigned long)td->td_nstrips);
return((tmsize_t)(-1));
}
rowsperstrip=td->td_rowsperstrip;
if (rowsperstrip>td->td_imagelength)
rowsperstrip=td->td_imagelength;
stripsperplane=((td->td_imagelength+rowsperstrip-1)/rowsperstrip);
stripinplane=(strip%stripsperplane);
plane=(strip/stripsperplane);
rows=td->td_imagelength-stripinplane*rowsperstrip;
if (rows>rowsperstrip)
rows=rowsperstrip;
stripsize=TIFFVStripSize(tif,rows);
if (stripsize==0)
return((tmsize_t)(-1));
if ((size!=(tmsize_t)(-1))&&(size<stripsize))
stripsize=size;
if (!TIFFFillStrip(tif,strip))
return((tmsize_t)(-1));
if ((*tif->tif_decodestrip)(tif,buf,stripsize,plane)<=0)
return((tmsize_t)(-1));
(*tif->tif_postdecode)(tif,buf,stripsize);
return(stripsize);
}
contrib/addtiffo/tif_overview.c:866: error: Integer Overflow L2
([0, +oo] - 1):unsigned32 by call to `TIFF_ProcessFullResBlock`.
contrib/addtiffo/tif_overview.c:685:1: Parameter `hTIFF->tif_dir.td_imagelength`
683. /************************************************************************/
684.
685. void TIFFBuildOverviews( TIFF *hTIFF, int nOverviews, int * panOvList,
^
686. int bUseSubIFDs, const char *pszResampleMethod,
687. int (*pfnProgress)( double, void * ),
contrib/addtiffo/tif_overview.c:866:13: Call
864. */
865.
866. TIFF_ProcessFullResBlock( hTIFF, nPlanarConfig,
^
867. bSubsampled,nHorSubsampling,nVerSubsampling,
868. nOverviews, panOvList,
contrib/addtiffo/tif_overview.c:540:1: Parameter `hTIFF->tif_dir.td_imagelength`
538. /************************************************************************/
539.
540. void TIFF_ProcessFullResBlock( TIFF *hTIFF, int nPlanarConfig,
^
541. int bSubsampled,
542. int nHorSubsampling, int nVerSubsampling,
contrib/addtiffo/tif_overview.c:577:39: Call
575. (tsample_t) iSample),
576. pabySrcTile,
577. TIFFStripSize(hTIFF) );
^
578. }
579. }
libtiff/tif_strip.c:235:1: Parameter `tif->tif_dir.td_imagelength`
233. return (TIFFVStripSize64(tif, rps));
234. }
235. tmsize_t
^
236. TIFFStripSize(TIFF* tif)
237. {
libtiff/tif_strip.c:241:4: Call
239. uint64 m;
240. tmsize_t n;
241. m=TIFFStripSize64(tif);
^
242. n=(tmsize_t)m;
243. if ((uint64)n!=m)
libtiff/tif_strip.c:226:1: Parameter `tif->tif_dir.td_imagelength`
224. * to hold the strip.
225. */
226. uint64
^
227. TIFFStripSize64(TIFF* tif)
228. {
contrib/addtiffo/tif_overview.c:573:17: Call
571. else
572. {
573. TIFFReadEncodedStrip( hTIFF,
^
574. TIFFComputeStrip(hTIFF, nSYOff,
575. (tsample_t) iSample),
libtiff/tif_read.c:123:1: <LHS trace>
121. * amount into the user-supplied buffer.
122. */
123. tmsize_t
^
124. TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size)
125. {
libtiff/tif_read.c:123:1: Parameter `tif->tif_dir.td_imagelength`
121. * amount into the user-supplied buffer.
122. */
123. tmsize_t
^
124. TIFFReadEncodedStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size)
125. {
libtiff/tif_read.c:151:2: Binary operation: ([0, +oo] - 1):unsigned32 by call to `TIFF_ProcessFullResBlock`
149. if (rowsperstrip>td->td_imagelength)
150. rowsperstrip=td->td_imagelength;
151. stripsperplane=((td->td_imagelength+rowsperstrip-1)/rowsperstrip);
^
152. stripinplane=(strip%stripsperplane);
153. plane=(strip/stripsperplane);
|
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_read.c/#L151
|
d2a_code_trace_data_42707
|
static void opt_output_file(const char *filename)
{
AVFormatContext *oc;
int err, use_video, use_audio, use_subtitle;
int input_has_video, input_has_audio, input_has_subtitle;
AVFormatParameters params, *ap = ¶ms;
AVOutputFormat *file_oformat;
if (!strcmp(filename, "-"))
filename = "pipe:";
oc = avformat_alloc_context();
if (!oc) {
print_error(filename, AVERROR(ENOMEM));
av_exit(1);
}
if (last_asked_format) {
file_oformat = av_guess_format(last_asked_format, NULL, NULL);
if (!file_oformat) {
fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format);
av_exit(1);
}
last_asked_format = NULL;
} else {
file_oformat = av_guess_format(NULL, filename, NULL);
if (!file_oformat) {
fprintf(stderr, "Unable to find a suitable output format for '%s'\n",
filename);
av_exit(1);
}
}
oc->oformat = file_oformat;
av_strlcpy(oc->filename, filename, sizeof(oc->filename));
if (!strcmp(file_oformat->name, "ffm") &&
av_strstart(filename, "http:", NULL)) {
int err = read_ffserver_streams(oc, filename);
if (err < 0) {
print_error(filename, err);
av_exit(1);
}
} else {
use_video = file_oformat->video_codec != CODEC_ID_NONE || video_stream_copy || video_codec_name;
use_audio = file_oformat->audio_codec != CODEC_ID_NONE || audio_stream_copy || audio_codec_name;
use_subtitle = file_oformat->subtitle_codec != CODEC_ID_NONE || subtitle_stream_copy || subtitle_codec_name;
if (nb_input_files > 0) {
check_audio_video_sub_inputs(&input_has_video, &input_has_audio,
&input_has_subtitle);
if (!input_has_video)
use_video = 0;
if (!input_has_audio)
use_audio = 0;
if (!input_has_subtitle)
use_subtitle = 0;
}
if (audio_disable) {
use_audio = 0;
}
if (video_disable) {
use_video = 0;
}
if (subtitle_disable) {
use_subtitle = 0;
}
if (use_video) {
new_video_stream(oc);
}
if (use_audio) {
new_audio_stream(oc);
}
if (use_subtitle) {
new_subtitle_stream(oc);
}
oc->timestamp = recording_timestamp;
for(; metadata_count>0; metadata_count--){
av_metadata_set2(&oc->metadata, metadata[metadata_count-1].key,
metadata[metadata_count-1].value, 0);
}
av_metadata_conv(oc, oc->oformat->metadata_conv, NULL);
}
output_files[nb_output_files++] = oc;
if (oc->oformat->flags & AVFMT_NEEDNUMBER) {
if (!av_filename_number_test(oc->filename)) {
print_error(oc->filename, AVERROR_NUMEXPECTED);
av_exit(1);
}
}
if (!(oc->oformat->flags & AVFMT_NOFILE)) {
if (!file_overwrite &&
(strchr(filename, ':') == NULL ||
filename[1] == ':' ||
av_strstart(filename, "file:", NULL))) {
if (url_exist(filename)) {
if (!using_stdin) {
fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename);
fflush(stderr);
if (!read_yesno()) {
fprintf(stderr, "Not overwriting - exiting\n");
av_exit(1);
}
}
else {
fprintf(stderr,"File '%s' already exists. Exiting.\n", filename);
av_exit(1);
}
}
}
if ((err = url_fopen(&oc->pb, filename, URL_WRONLY)) < 0) {
print_error(filename, err);
av_exit(1);
}
}
memset(ap, 0, sizeof(*ap));
if (av_set_parameters(oc, ap) < 0) {
fprintf(stderr, "%s: Invalid encoding parameters\n",
oc->filename);
av_exit(1);
}
oc->preload= (int)(mux_preload*AV_TIME_BASE);
oc->max_delay= (int)(mux_max_delay*AV_TIME_BASE);
oc->loop_output = loop_output;
oc->flags |= AVFMT_FLAG_NONBLOCK;
set_context_opts(oc, avformat_opts, AV_OPT_FLAG_ENCODING_PARAM);
memset(streamid_map, 0, sizeof(streamid_map));
}
ffmpeg.c:3689: error: Null Dereference
pointer `oc` last assigned on line 3667 could be null and is dereferenced at line 3689, column 5.
ffmpeg.c:3656:1: start of procedure opt_output_file()
3654. }
3655.
3656. static void opt_output_file(const char *filename)
^
3657. {
3658. AVFormatContext *oc;
ffmpeg.c:3661:5:
3659. int err, use_video, use_audio, use_subtitle;
3660. int input_has_video, input_has_audio, input_has_subtitle;
3661. AVFormatParameters params, *ap = ¶ms;
^
3662. AVOutputFormat *file_oformat;
3663.
ffmpeg.c:3664:10: Taking false branch
3662. AVOutputFormat *file_oformat;
3663.
3664. if (!strcmp(filename, "-"))
^
3665. filename = "pipe:";
3666.
ffmpeg.c:3667:5:
3665. filename = "pipe:";
3666.
3667. oc = avformat_alloc_context();
^
3668. if (!oc) {
3669. print_error(filename, AVERROR(ENOMEM));
libavformat/options.c:81:1: start of procedure avformat_alloc_context()
79. }
80.
81. AVFormatContext *avformat_alloc_context(void)
^
82. {
83. AVFormatContext *ic;
libavformat/options.c:84:5:
82. {
83. AVFormatContext *ic;
84. ic = av_malloc(sizeof(AVFormatContext));
^
85. if (!ic) return ic;
86. avformat_get_context_defaults(ic);
libavutil/mem.c:64:1: start of procedure av_malloc()
62. linker will do it automatically. */
63.
64. void *av_malloc(unsigned int size)
^
65. {
66. void *ptr = NULL;
libavutil/mem.c:66:5:
64. void *av_malloc(unsigned int size)
65. {
66. void *ptr = NULL;
^
67. #if CONFIG_MEMALIGN_HACK
68. long diff;
libavutil/mem.c:72:8: Taking false branch
70.
71. /* let's disallow possible ambiguous cases */
72. if(size > (INT_MAX-16) )
^
73. return NULL;
74.
libavutil/mem.c:83:9: Taking false branch
81. ((char*)ptr)[-1]= diff;
82. #elif HAVE_POSIX_MEMALIGN
83. if (posix_memalign(&ptr,16,size))
^
84. ptr = NULL;
85. #elif HAVE_MEMALIGN
libavutil/mem.c:116:5:
114. ptr = malloc(size);
115. #endif
116. return ptr;
^
117. }
118.
libavutil/mem.c:117:1: return from a call to av_malloc
115. #endif
116. return ptr;
117. }
^
118.
119. void *av_realloc(void *ptr, unsigned int size)
libavformat/options.c:85:10: Taking true branch
83. AVFormatContext *ic;
84. ic = av_malloc(sizeof(AVFormatContext));
85. if (!ic) return ic;
^
86. avformat_get_context_defaults(ic);
87. ic->av_class = &av_format_context_class;
libavformat/options.c:85:14:
83. AVFormatContext *ic;
84. ic = av_malloc(sizeof(AVFormatContext));
85. if (!ic) return ic;
^
86. avformat_get_context_defaults(ic);
87. ic->av_class = &av_format_context_class;
libavformat/options.c:89:1: return from a call to avformat_alloc_context
87. ic->av_class = &av_format_context_class;
88. return ic;
89. }
^
90.
91. #if LIBAVFORMAT_VERSION_MAJOR < 53
ffmpeg.c:3668:10: Taking true branch
3666.
3667. oc = avformat_alloc_context();
3668. if (!oc) {
^
3669. print_error(filename, AVERROR(ENOMEM));
3670. av_exit(1);
ffmpeg.c:3669:9:
3667. oc = avformat_alloc_context();
3668. if (!oc) {
3669. print_error(filename, AVERROR(ENOMEM));
^
3670. av_exit(1);
3671. }
cmdutils.c:293:1: start of procedure print_error()
291. }
292.
293. void print_error(const char *filename, int err)
^
294. {
295. char errbuf[128];
cmdutils.c:296:5:
294. {
295. char errbuf[128];
296. const char *errbuf_ptr = errbuf;
^
297.
298. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0)
cmdutils.c:298:9:
296. const char *errbuf_ptr = errbuf;
297.
298. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0)
^
299. errbuf_ptr = strerror(AVUNERROR(err));
300. fprintf(stderr, "%s: %s\n", filename, errbuf_ptr);
libavutil/error.c:22:1: start of procedure av_strerror()
20. #include "avstring.h"
21.
22. int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
^
23. {
24. int ret = 0;
libavutil/error.c:24:5:
22. int av_strerror(int errnum, char *errbuf, size_t errbuf_size)
23. {
24. int ret = 0;
^
25. const char *errstr = NULL;
26.
libavutil/error.c:25:5:
23. {
24. int ret = 0;
25. const char *errstr = NULL;
^
26.
27. switch (errnum) {
libavutil/error.c:27:5:
25. const char *errstr = NULL;
26.
27. switch (errnum) {
^
28. case AVERROR_EOF: errstr = "End of file"; break;
29. case AVERROR_INVALIDDATA: errstr = "Invalid data found when processing input"; break;
libavutil/error.c:28:5: Switch condition is false. Skipping switch case
26.
27. switch (errnum) {
28. case AVERROR_EOF: errstr = "End of file"; break;
^
29. case AVERROR_INVALIDDATA: errstr = "Invalid data found when processing input"; break;
30. case AVERROR_NUMEXPECTED: errstr = "Number syntax expected in filename"; break;
libavutil/error.c:29:5: Switch condition is false. Skipping switch case
27. switch (errnum) {
28. case AVERROR_EOF: errstr = "End of file"; break;
29. case AVERROR_INVALIDDATA: errstr = "Invalid data found when processing input"; break;
^
30. case AVERROR_NUMEXPECTED: errstr = "Number syntax expected in filename"; break;
31. case AVERROR_PATCHWELCOME: errstr = "Not yet implemented in FFmpeg, patches welcome"; break;
libavutil/error.c:30:5: Switch condition is false. Skipping switch case
28. case AVERROR_EOF: errstr = "End of file"; break;
29. case AVERROR_INVALIDDATA: errstr = "Invalid data found when processing input"; break;
30. case AVERROR_NUMEXPECTED: errstr = "Number syntax expected in filename"; break;
^
31. case AVERROR_PATCHWELCOME: errstr = "Not yet implemented in FFmpeg, patches welcome"; break;
32. }
libavutil/error.c:31:5: Switch condition is false. Skipping switch case
29. case AVERROR_INVALIDDATA: errstr = "Invalid data found when processing input"; break;
30. case AVERROR_NUMEXPECTED: errstr = "Number syntax expected in filename"; break;
31. case AVERROR_PATCHWELCOME: errstr = "Not yet implemented in FFmpeg, patches welcome"; break;
^
32. }
33.
libavutil/error.c:34:9: Taking false branch
32. }
33.
34. if (errstr) {
^
35. av_strlcpy(errbuf, errstr, errbuf_size);
36. } else {
libavutil/error.c:38:9:
36. } else {
37. #if HAVE_STRERROR_R
38. ret = strerror_r(AVUNERROR(errnum), errbuf, errbuf_size);
^
39. #else
40. ret = -1;
libavutil/error.c:42:13: Taking false branch
40. ret = -1;
41. #endif
42. if (ret < 0)
^
43. snprintf(errbuf, errbuf_size, "Error number %d occurred", errnum);
44. }
libavutil/error.c:46:5:
44. }
45.
46. return ret;
^
47. }
libavutil/error.c:47:1: return from a call to av_strerror
45.
46. return ret;
47. }
^
cmdutils.c:298:9: Taking false branch
296. const char *errbuf_ptr = errbuf;
297.
298. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0)
^
299. errbuf_ptr = strerror(AVUNERROR(err));
300. fprintf(stderr, "%s: %s\n", filename, errbuf_ptr);
cmdutils.c:300:5:
298. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0)
299. errbuf_ptr = strerror(AVUNERROR(err));
300. fprintf(stderr, "%s: %s\n", filename, errbuf_ptr);
^
301. }
302.
cmdutils.c:301:1: return from a call to print_error
299. errbuf_ptr = strerror(AVUNERROR(err));
300. fprintf(stderr, "%s: %s\n", filename, errbuf_ptr);
301. }
^
302.
303. #define PRINT_LIB_VERSION(outstream,libname,LIBNAME,indent) \
ffmpeg.c:3670:9: Skipping av_exit(): empty list of specs
3668. if (!oc) {
3669. print_error(filename, AVERROR(ENOMEM));
3670. av_exit(1);
^
3671. }
3672.
ffmpeg.c:3673:9: Taking true branch
3671. }
3672.
3673. if (last_asked_format) {
^
3674. file_oformat = av_guess_format(last_asked_format, NULL, NULL);
3675. if (!file_oformat) {
ffmpeg.c:3674:9: Skipping av_guess_format(): empty list of specs
3672.
3673. if (last_asked_format) {
3674. file_oformat = av_guess_format(last_asked_format, NULL, NULL);
^
3675. if (!file_oformat) {
3676. fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format);
ffmpeg.c:3675:14: Taking false branch
3673. if (last_asked_format) {
3674. file_oformat = av_guess_format(last_asked_format, NULL, NULL);
3675. if (!file_oformat) {
^
3676. fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format);
3677. av_exit(1);
ffmpeg.c:3679:9:
3677. av_exit(1);
3678. }
3679. last_asked_format = NULL;
^
3680. } else {
3681. file_oformat = av_guess_format(NULL, filename, NULL);
ffmpeg.c:3689:5:
3687. }
3688.
3689. oc->oformat = file_oformat;
^
3690. av_strlcpy(oc->filename, filename, sizeof(oc->filename));
3691.
|
https://github.com/libav/libav/blob/66b84e4ab2fc96222dab32173d84f4a403129deb/ffmpeg.c/#L3689
|
d2a_code_trace_data_42708
|
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:1642: error: Uninitialized Value
The value read from skip_dct[_] was never initialized.
libavcodec/mpegvideo_enc.c:1642:13:
1640. if(!skip_dct[2]) get_visual_weight(weight[2], ptr_y + dct_offset , wrap_y);
1641. if(!skip_dct[3]) get_visual_weight(weight[3], ptr_y + dct_offset + 8, wrap_y);
1642. if(!skip_dct[4]) get_visual_weight(weight[4], ptr_cb , wrap_c);
^
1643. if(!skip_dct[5]) get_visual_weight(weight[5], ptr_cr , wrap_c);
1644. if(!s->chroma_y_shift){ /* 422 */
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo_enc.c/#L1642
|
d2a_code_trace_data_42709
|
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();
if (dhp == NULL)
return NULL;
dhp->g = BN_new();
if (dhp->g != NULL)
BN_set_word(dhp->g, 2);
if (dh_secbits >= 192)
dhp->p = get_rfc3526_prime_8192(NULL);
else
dhp->p = get_rfc3526_prime_3072(NULL);
if (dhp->p == NULL || dhp->g == NULL) {
DH_free(dhp);
return NULL;
}
return dhp;
}
if (dh_secbits >= 112)
return DH_get_2048_224();
return DH_get_1024_160();
}
ssl/t1_lib.c:4282: error: NULL_DEREFERENCE
pointer `cpk` last assigned on line 4281 could be null and is dereferenced at line 4282, column 45.
Showing all 34 steps of the trace
ssl/t1_lib.c:4270:1: start of procedure ssl_get_auto_dh()
4268.
4269. #ifndef OPENSSL_NO_DH
4270. > DH *ssl_get_auto_dh(SSL *s)
4271. {
4272. int dh_secbits = 80;
ssl/t1_lib.c:4272:5:
4270. DH *ssl_get_auto_dh(SSL *s)
4271. {
4272. > int dh_secbits = 80;
4273. if (s->cert->dh_tmp_auto == 2)
4274. return DH_get_1024_160();
ssl/t1_lib.c:4273:9: Taking false branch
4271. {
4272. int dh_secbits = 80;
4273. if (s->cert->dh_tmp_auto == 2)
^
4274. return DH_get_1024_160();
4275. if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {
ssl/t1_lib.c:4275:9: Taking false branch
4273. if (s->cert->dh_tmp_auto == 2)
4274. return DH_get_1024_160();
4275. if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) {
^
4276. if (s->s3->tmp.new_cipher->strength_bits == 256)
4277. dh_secbits = 128;
ssl/t1_lib.c:4281:9:
4279. dh_secbits = 80;
4280. } else {
4281. > CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
4282. dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
4283. }
ssl/ssl_lib.c:2283:1: start of procedure ssl_get_server_send_pkey()
2281. }
2282.
2283. > CERT_PKEY *ssl_get_server_send_pkey(SSL *s)
2284. {
2285. CERT *c;
ssl/ssl_lib.c:2288:5:
2286. int i;
2287.
2288. > c = s->cert;
2289. if (!s->s3 || !s->s3->tmp.new_cipher)
2290. return NULL;
ssl/ssl_lib.c:2289:10: Taking false branch
2287.
2288. c = s->cert;
2289. if (!s->s3 || !s->s3->tmp.new_cipher)
^
2290. return NULL;
2291. ssl_set_masks(s, s->s3->tmp.new_cipher);
ssl/ssl_lib.c:2289:20: Taking false branch
2287.
2288. c = s->cert;
2289. if (!s->s3 || !s->s3->tmp.new_cipher)
^
2290. return NULL;
2291. ssl_set_masks(s, s->s3->tmp.new_cipher);
ssl/ssl_lib.c:2291:5: Skipping ssl_set_masks(): empty list of specs
2289. if (!s->s3 || !s->s3->tmp.new_cipher)
2290. return NULL;
2291. ssl_set_masks(s, s->s3->tmp.new_cipher);
^
2292.
2293. #ifdef OPENSSL_SSL_DEBUG_BROKEN_PROTOCOL
ssl/ssl_lib.c:2302:5:
2300. #endif
2301.
2302. > i = ssl_get_server_cert_index(s);
2303.
2304. /* This may or may not be an error. */
ssl/ssl_lib.c:2262:1: start of procedure ssl_get_server_cert_index()
2260. #endif
2261.
2262. > static int ssl_get_server_cert_index(const SSL *s)
2263. {
2264. int idx;
ssl/ssl_lib.c:2265:5:
2263. {
2264. int idx;
2265. > idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
2266. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
2267. idx = SSL_PKEY_RSA_SIGN;
ssl/ssl_ciph.c:2014:1: start of procedure ssl_cipher_get_cert_index()
2012.
2013. /* For a cipher return the index corresponding to the certificate type */
2014. > int ssl_cipher_get_cert_index(const SSL_CIPHER *c)
2015. {
2016. uint32_t alg_k, alg_a;
ssl/ssl_ciph.c:2018:5:
2016. uint32_t alg_k, alg_a;
2017.
2018. > alg_k = c->algorithm_mkey;
2019. alg_a = c->algorithm_auth;
2020.
ssl/ssl_ciph.c:2019:5:
2017.
2018. alg_k = c->algorithm_mkey;
2019. > alg_a = c->algorithm_auth;
2020.
2021. if (alg_k & (SSL_kECDHr | SSL_kECDHe)) {
ssl/ssl_ciph.c:2021:9: Taking false branch
2019. alg_a = c->algorithm_auth;
2020.
2021. if (alg_k & (SSL_kECDHr | SSL_kECDHe)) {
^
2022. /*
2023. * we don't need to look at SSL_kECDHE since no certificate is needed
ssl/ssl_ciph.c:2031:16: Taking false branch
2029. */
2030. return SSL_PKEY_ECC;
2031. } else if (alg_a & SSL_aECDSA)
^
2032. return SSL_PKEY_ECC;
2033. else if (alg_k & SSL_kDHr)
ssl/ssl_ciph.c:2033:14: Taking false branch
2031. } else if (alg_a & SSL_aECDSA)
2032. return SSL_PKEY_ECC;
2033. else if (alg_k & SSL_kDHr)
^
2034. return SSL_PKEY_DH_RSA;
2035. else if (alg_k & SSL_kDHd)
ssl/ssl_ciph.c:2035:14: Taking false branch
2033. else if (alg_k & SSL_kDHr)
2034. return SSL_PKEY_DH_RSA;
2035. else if (alg_k & SSL_kDHd)
^
2036. return SSL_PKEY_DH_DSA;
2037. else if (alg_a & SSL_aDSS)
ssl/ssl_ciph.c:2037:14: Taking false branch
2035. else if (alg_k & SSL_kDHd)
2036. return SSL_PKEY_DH_DSA;
2037. else if (alg_a & SSL_aDSS)
^
2038. return SSL_PKEY_DSA_SIGN;
2039. else if (alg_a & SSL_aRSA)
ssl/ssl_ciph.c:2039:14: Taking true branch
2037. else if (alg_a & SSL_aDSS)
2038. return SSL_PKEY_DSA_SIGN;
2039. else if (alg_a & SSL_aRSA)
^
2040. return SSL_PKEY_RSA_ENC;
2041. else if (alg_a & SSL_aGOST12)
ssl/ssl_ciph.c:2040:9:
2038. return SSL_PKEY_DSA_SIGN;
2039. else if (alg_a & SSL_aRSA)
2040. > return SSL_PKEY_RSA_ENC;
2041. else if (alg_a & SSL_aGOST12)
2042. return SSL_PKEY_GOST_EC;
ssl/ssl_ciph.c:2047:1: return from a call to ssl_cipher_get_cert_index
2045.
2046. return -1;
2047. > }
2048.
2049. const SSL_CIPHER *ssl_get_cipher_by_char(SSL *ssl, const unsigned char *ptr)
ssl/ssl_lib.c:2266:9: Taking true branch
2264. int idx;
2265. idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
2266. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
^
2267. idx = SSL_PKEY_RSA_SIGN;
2268. if (idx == SSL_PKEY_GOST_EC) {
ssl/ssl_lib.c:2266:37: Taking false branch
2264. int idx;
2265. idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher);
2266. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
^
2267. idx = SSL_PKEY_RSA_SIGN;
2268. if (idx == SSL_PKEY_GOST_EC) {
ssl/ssl_lib.c:2268:9: Taking false branch
2266. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509)
2267. idx = SSL_PKEY_RSA_SIGN;
2268. if (idx == SSL_PKEY_GOST_EC) {
^
2269. if (s->cert->pkeys[SSL_PKEY_GOST12_512].x509)
2270. idx = SSL_PKEY_GOST12_512;
ssl/ssl_lib.c:2278:9: Taking false branch
2276. idx = -1;
2277. }
2278. if (idx == -1)
^
2279. SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
2280. return idx;
ssl/ssl_lib.c:2280:5:
2278. if (idx == -1)
2279. SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
2280. > return idx;
2281. }
2282.
ssl/ssl_lib.c:2281:1: return from a call to ssl_get_server_cert_index
2279. SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR);
2280. return idx;
2281. > }
2282.
2283. CERT_PKEY *ssl_get_server_send_pkey(SSL *s)
ssl/ssl_lib.c:2305:9: Taking true branch
2303.
2304. /* This may or may not be an error. */
2305. if (i < 0)
^
2306. return NULL;
2307.
ssl/ssl_lib.c:2306:9:
2304. /* This may or may not be an error. */
2305. if (i < 0)
2306. > return NULL;
2307.
2308. /* May be NULL. */
ssl/ssl_lib.c:2310:1: return from a call to ssl_get_server_send_pkey
2308. /* May be NULL. */
2309. return &c->pkeys[i];
2310. > }
2311.
2312. EVP_PKEY *ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *cipher,
ssl/t1_lib.c:4282:9:
4280. } else {
4281. CERT_PKEY *cpk = ssl_get_server_send_pkey(s);
4282. > dh_secbits = EVP_PKEY_security_bits(cpk->privatekey);
4283. }
4284.
|
https://github.com/openssl/openssl/blob/de17db915e26452819692fd837d788d52b8dd48a/ssl/t1_lib.c/#L4282
|
d2a_code_trace_data_42710
|
void private_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data)
{
register RC4_INT tmp;
register int id1,id2;
register RC4_INT *d;
unsigned int i;
d= &(key->data[0]);
key->x = 0;
key->y = 0;
id1=id2=0;
#define SK_LOOP(d,n) { \
tmp=d[(n)]; \
id2 = (data[id1] + tmp + id2) & 0xff; \
if (++id1 == len) id1=0; \
d[(n)]=d[id2]; \
d[id2]=tmp; }
for (i=0; i < 256; i++) d[i]=i;
for (i=0; i < 256; i+=4)
{
SK_LOOP(d,i+0);
SK_LOOP(d,i+1);
SK_LOOP(d,i+2);
SK_LOOP(d,i+3);
}
}
crypto/rc4/rc4_skey.c:113: error: BUFFER_OVERRUN_L2
Offset: [3, 258] Size: 256.
Showing all 6 steps of the trace
crypto/rc4/rc4_skey.c:108:7: <Offset trace>
106.
107. for (i=0; i < 256; i++) d[i]=i;
108. for (i=0; i < 256; i+=4)
^
109. {
110. SK_LOOP(d,i+0);
crypto/rc4/rc4_skey.c:108:7: Assignment
106.
107. for (i=0; i < 256; i++) d[i]=i;
108. for (i=0; i < 256; i+=4)
^
109. {
110. SK_LOOP(d,i+0);
crypto/rc4/rc4_skey.c:88:1: <Length trace>
86. */
87.
88. > void private_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data)
89. {
90. register RC4_INT tmp;
crypto/rc4/rc4_skey.c:88:1: Parameter `key->data[*]`
86. */
87.
88. > void private_RC4_set_key(RC4_KEY *key, int len, const unsigned char *data)
89. {
90. register RC4_INT tmp;
crypto/rc4/rc4_skey.c:95:9: Assignment
93. unsigned int i;
94.
95. d= &(key->data[0]);
^
96. key->x = 0;
97. key->y = 0;
crypto/rc4/rc4_skey.c:113:3: Array access: Offset: [3, 258] Size: 256
111. SK_LOOP(d,i+1);
112. SK_LOOP(d,i+2);
113. SK_LOOP(d,i+3);
^
114. }
115. }
|
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/rc4/rc4_skey.c/#L113
|
d2a_code_trace_data_42711
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/rsa/rsa_sp800_56b_gen.c:130: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `BN_CTX_end`.
Showing all 7 steps of the trace
crypto/rsa/rsa_sp800_56b_gen.c:51:1: Parameter `ctx->stack.depth`
49. * (Required for CAVS testing).
50. */
51. > int rsa_fips186_4_gen_prob_primes(RSA *rsa, BIGNUM *p1, BIGNUM *p2,
52. BIGNUM *Xpout, const BIGNUM *Xp,
53. const BIGNUM *Xp1, const BIGNUM *Xp2,
crypto/rsa/rsa_sp800_56b_gen.c:130:5: Call
128. BN_clear(tmp);
129.
130. BN_CTX_end(ctx);
^
131. return ret;
132. }
crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <LHS trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end`
266. static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
^
269. }
270.
|
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_ctx.c/#L268
|
d2a_code_trace_data_42712
|
static ngx_int_t
ngx_http_gzip_accept_encoding(ngx_str_t *ae)
{
u_char *p, *start, *last;
start = ae->data;
last = start + ae->len;
for ( ;; ) {
p = ngx_strcasestrn(start, "gzip", 4 - 1);
if (p == NULL) {
return NGX_DECLINED;
}
if (p == start || (*(p - 1) == ',' || *(p - 1) == ' ')) {
break;
}
start = p + 4;
}
p += 4;
while (p < last) {
switch(*p++) {
case ',':
return NGX_OK;
case ';':
goto quantity;
case ' ':
continue;
default:
return NGX_DECLINED;
}
}
return NGX_OK;
quantity:
while (p < last) {
switch(*p++) {
case 'q':
case 'Q':
goto equal;
case ' ':
continue;
default:
return NGX_DECLINED;
}
}
return NGX_OK;
equal:
if (p + 2 > last || *p++ != '=') {
return NGX_DECLINED;
}
if (ngx_http_gzip_quantity(p, last) == 0) {
return NGX_DECLINED;
}
return NGX_OK;
}
src/http/ngx_http_core_module.c:2229: error: Uninitialized Value
The value read from p was never initialized.
src/http/ngx_http_core_module.c:2229:5:
2227. }
2228.
2229. p += 4;
^
2230.
2231. while (p < last) {
|
https://github.com/nginx/nginx/blob/ddb7cd1c410a7166d8e28092d714f782ed1d69b3/src/http/ngx_http_core_module.c/#L2229
|
d2a_code_trace_data_42713
|
static int opt_streamid(OptionsContext *o, const char *opt, const char *arg)
{
int idx;
char *p;
char idx_str[16];
av_strlcpy(idx_str, arg, sizeof(idx_str));
p = strchr(idx_str, ':');
if (!p) {
av_log(NULL, AV_LOG_FATAL,
"Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
arg, opt);
exit_program(1);
}
*p++ = '\0';
idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX);
o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1);
o->streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX);
return 0;
}
avconv.c:3418: error: Null Dereference
pointer `p` last assigned on line 3418 could be null and is dereferenced at line 3418, column 5.
avconv.c:3404:1: start of procedure opt_streamid()
3402.
3403. /* arg format is "output-stream-index:streamid-value". */
3404. static int opt_streamid(OptionsContext *o, const char *opt, const char *arg)
^
3405. {
3406. int idx;
avconv.c:3410:5:
3408. char idx_str[16];
3409.
3410. av_strlcpy(idx_str, arg, sizeof(idx_str));
^
3411. p = strchr(idx_str, ':');
3412. if (!p) {
libavutil/avstring.c:64:1: start of procedure av_strlcpy()
62. }
63.
64. size_t av_strlcpy(char *dst, const char *src, size_t size)
^
65. {
66. size_t len = 0;
libavutil/avstring.c:66:5:
64. size_t av_strlcpy(char *dst, const char *src, size_t size)
65. {
66. size_t len = 0;
^
67. while (++len < size && *src)
68. *dst++ = *src++;
libavutil/avstring.c:67:12: Loop condition is true. Entering loop body
65. {
66. size_t len = 0;
67. while (++len < size && *src)
^
68. *dst++ = *src++;
69. if (len <= size)
libavutil/avstring.c:67:28: Loop condition is false. Leaving loop
65. {
66. size_t len = 0;
67. while (++len < size && *src)
^
68. *dst++ = *src++;
69. if (len <= size)
libavutil/avstring.c:69:9: Taking true branch
67. while (++len < size && *src)
68. *dst++ = *src++;
69. if (len <= size)
^
70. *dst = 0;
71. return len + strlen(src) - 1;
libavutil/avstring.c:70:9:
68. *dst++ = *src++;
69. if (len <= size)
70. *dst = 0;
^
71. return len + strlen(src) - 1;
72. }
libavutil/avstring.c:71:5:
69. if (len <= size)
70. *dst = 0;
71. return len + strlen(src) - 1;
^
72. }
73.
libavutil/avstring.c:72:1: return from a call to av_strlcpy
70. *dst = 0;
71. return len + strlen(src) - 1;
72. }
^
73.
74. size_t av_strlcat(char *dst, const char *src, size_t size)
avconv.c:3411:5:
3409.
3410. av_strlcpy(idx_str, arg, sizeof(idx_str));
3411. p = strchr(idx_str, ':');
^
3412. if (!p) {
3413. av_log(NULL, AV_LOG_FATAL,
avconv.c:3412:10: Taking true branch
3410. av_strlcpy(idx_str, arg, sizeof(idx_str));
3411. p = strchr(idx_str, ':');
3412. if (!p) {
^
3413. av_log(NULL, AV_LOG_FATAL,
3414. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
avconv.c:3413:9: Skipping av_log(): empty list of specs
3411. p = strchr(idx_str, ':');
3412. if (!p) {
3413. av_log(NULL, AV_LOG_FATAL,
^
3414. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
3415. arg, opt);
avconv.c:3416:9: Skipping exit_program(): empty list of specs
3414. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n",
3415. arg, opt);
3416. exit_program(1);
^
3417. }
3418. *p++ = '\0';
avconv.c:3418:5:
3416. exit_program(1);
3417. }
3418. *p++ = '\0';
^
3419. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX);
3420. o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1);
|
https://github.com/libav/libav/blob/e551a6f49a13f2e992c42bc00a8b45ad636e52ad/avconv.c/#L3418
|
d2a_code_trace_data_42714
|
static void await_references(H264Context *h){
MpegEncContext * const s = &h->s;
const int mb_xy= h->mb_xy;
const int mb_type= s->current_picture.mb_type[mb_xy];
int refs[2][48];
int nrefs[2] = {0};
int ref, list;
memset(refs, -1, sizeof(refs));
if(IS_16X16(mb_type)){
get_lowest_part_y(h, refs, 0, 16, 0,
IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);
}else if(IS_16X8(mb_type)){
get_lowest_part_y(h, refs, 0, 8, 0,
IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);
get_lowest_part_y(h, refs, 8, 8, 8,
IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1), nrefs);
}else if(IS_8X16(mb_type)){
get_lowest_part_y(h, refs, 0, 16, 0,
IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);
get_lowest_part_y(h, refs, 4, 16, 0,
IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1), nrefs);
}else{
int i;
assert(IS_8X8(mb_type));
for(i=0; i<4; i++){
const int sub_mb_type= h->sub_mb_type[i];
const int n= 4*i;
int y_offset= (i&2)<<2;
if(IS_SUB_8X8(sub_mb_type)){
get_lowest_part_y(h, refs, n , 8, y_offset,
IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
}else if(IS_SUB_8X4(sub_mb_type)){
get_lowest_part_y(h, refs, n , 4, y_offset,
IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
get_lowest_part_y(h, refs, n+2, 4, y_offset+4,
IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
}else if(IS_SUB_4X8(sub_mb_type)){
get_lowest_part_y(h, refs, n , 8, y_offset,
IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
get_lowest_part_y(h, refs, n+1, 8, y_offset,
IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
}else{
int j;
assert(IS_SUB_4X4(sub_mb_type));
for(j=0; j<4; j++){
int sub_y_offset= y_offset + 2*(j&2);
get_lowest_part_y(h, refs, n+j, 4, sub_y_offset,
IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
}
}
}
}
for(list=h->list_count-1; list>=0; list--){
for(ref=0; ref<48 && nrefs[list]; ref++){
int row = refs[list][ref];
if(row >= 0){
Picture *ref_pic = &h->ref_list[list][ref];
int ref_field = ref_pic->reference - 1;
int ref_field_picture = ref_pic->field_picture;
int pic_height = 16*s->mb_height >> ref_field_picture;
row <<= MB_MBAFF;
nrefs[list]--;
if(!FIELD_PICTURE && ref_field_picture){
ff_thread_await_progress((AVFrame*)ref_pic, FFMIN((row >> 1) - !(row&1), pic_height-1), 1);
ff_thread_await_progress((AVFrame*)ref_pic, FFMIN((row >> 1) , pic_height-1), 0);
}else if(FIELD_PICTURE && !ref_field_picture){
ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row*2 + ref_field , pic_height-1), 0);
}else if(FIELD_PICTURE){
ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row, pic_height-1), ref_field);
}else{
ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row, pic_height-1), 0);
}
}
}
}
}
libavcodec/h264.c:3655: error: Integer Overflow L2
([0, +oo] - 1):unsigned32 by call to `field_end`.
libavcodec/h264.c:3635:15: Call
3633. }
3634.
3635. buf_index=decode_nal_units(h, buf, buf_size);
^
3636. if(buf_index < 0)
3637. return -1;
libavcodec/h264.c:3337:1: Parameter `h->s.list_count`
3335.
3336.
3337. static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size){
^
3338. MpegEncContext * const s = &h->s;
3339. AVCodecContext * const avctx= s->avctx;
libavcodec/h264.c:3655:9: Call
3653. if(s->flags2 & CODEC_FLAG2_CHUNKS) decode_postinit(h, 1);
3654.
3655. field_end(h, 0);
^
3656.
3657. if (!h->next_output_pic) {
libavcodec/h264.c:2126:1: Parameter `h->s.list_count`
2124. }
2125.
2126. static void field_end(H264Context *h, int in_setup){
^
2127. MpegEncContext * const s = &h->s;
2128. AVCodecContext * const avctx= s->avctx;
libavcodec/h264.c:2170:9: Call
2168. */
2169. if (!FIELD_PICTURE)
2170. ff_er_frame_end(s);
^
2171.
2172. MPV_frame_end(s);
libavcodec/error_resilience.c:776:1: Parameter `s->list_count`
774. }
775.
776. void ff_er_frame_end(MpegEncContext *s){
^
777. int i, mb_x, mb_y, error, error_type, dc_error, mv_error, ac_error;
778. int distance;
libavcodec/error_resilience.c:995:13: Call
993. s->mb_x= mb_x;
994. s->mb_y= mb_y;
995. decode_mb(s, 0/*FIXME h264 partitioned slices need this set*/);
^
996. }
997. }
libavcodec/error_resilience.c:43:1: Parameter `s->list_count`
41. #undef mb_intra
42.
43. static void decode_mb(MpegEncContext *s, int ref){
^
44. s->dest[0] = s->current_picture.data[0] + (s->mb_y * 16* s->linesize ) + s->mb_x * 16;
45. s->dest[1] = s->current_picture.data[1] + (s->mb_y * (16>>s->chroma_y_shift) * s->uvlinesize) + s->mb_x * (16>>s->chroma_x_shift);
libavcodec/error_resilience.c:59:9: Call
57. fill_rectangle(h->mv_cache[0][ scan8[0] ], 4, 4, 8, pack16to32(s->mv[0][0][0],s->mv[0][0][1]), 4);
58. assert(!FRAME_MBAFF);
59. ff_h264_hl_decode_mb(h);
^
60. }else{
61. assert(ref==0);
libavcodec/h264.c:1847:1: Parameter `h->list_count`
1845. }
1846.
1847. void ff_h264_hl_decode_mb(H264Context *h){
^
1848. MpegEncContext * const s = &h->s;
1849. const int mb_xy= h->mb_xy;
libavcodec/h264.c:1854:9: Call
1852.
1853. if (is_complex) {
1854. hl_decode_mb_complex(h);
^
1855. } else if (h->pixel_shift) {
1856. hl_decode_mb_simple_16(h);
libavcodec/h264.c:1843:1: Parameter `h->list_count`
1841. * Process a macroblock; this handles edge cases, such as interlacing.
1842. */
1843. static void av_noinline hl_decode_mb_complex(H264Context *h){
^
1844. hl_decode_mb_internal(h, 0, h->pixel_shift);
1845. }
libavcodec/h264.c:1844:5: Call
1842. */
1843. static void av_noinline hl_decode_mb_complex(H264Context *h){
1844. hl_decode_mb_internal(h, 0, h->pixel_shift);
^
1845. }
1846.
libavcodec/h264.c:1541:1: Parameter `h->list_count`
1539. }
1540.
1541. static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple, int pixel_shift){
^
1542. MpegEncContext * const s = &h->s;
1543. const int mb_x= s->mb_x;
libavcodec/h264.c:1735:17: Call
1733. }else if(is_h264){
1734. if (pixel_shift) {
1735. hl_motion_16(h, dest_y, dest_cb, dest_cr,
^
1736. s->me.qpel_put, s->dsp.put_h264_chroma_pixels_tab,
1737. s->me.qpel_avg, s->dsp.avg_h264_chroma_pixels_tab,
libavcodec/h264.c:762:1: Parameter `h->list_count`
760. }
761. hl_motion_fn(0, 8);
762. hl_motion_fn(1, 16);
^
763.
764. static void free_tables(H264Context *h, int free_rbsp){
libavcodec/h264.c:762:1: Call
760. }
761. hl_motion_fn(0, 8);
762. hl_motion_fn(1, 16);
^
763.
764. static void free_tables(H264Context *h, int free_rbsp){
libavcodec/h264.c:646:1: Parameter `h->list_count`
644. }
645.
646. static av_always_inline void hl_motion(H264Context *h, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
^
647. qpel_mc_func (*qpix_put)[16], h264_chroma_mc_func (*chroma_put),
648. qpel_mc_func (*qpix_avg)[16], h264_chroma_mc_func (*chroma_avg),
libavcodec/h264.c:658:9: Call
656.
657. if(HAVE_PTHREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME))
658. await_references(h);
^
659. prefetch_motion(h, 0, pixel_shift);
660.
libavcodec/h264.c:299:1: <LHS trace>
297. * @param h the H264 context
298. */
299. static void await_references(H264Context *h){
^
300. MpegEncContext * const s = &h->s;
301. const int mb_xy= h->mb_xy;
libavcodec/h264.c:299:1: Parameter `h->list_count`
297. * @param h the H264 context
298. */
299. static void await_references(H264Context *h){
^
300. MpegEncContext * const s = &h->s;
301. const int mb_xy= h->mb_xy;
libavcodec/h264.c:357:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `field_end`
355. }
356.
357. for(list=h->list_count-1; list>=0; list--){
^
358. for(ref=0; ref<48 && nrefs[list]; ref++){
359. int row = refs[list][ref];
|
https://github.com/libav/libav/blob/6a9c85944427e3c4355bce67d7f677ec69527bff/libavcodec/h264.c/#L357
|
d2a_code_trace_data_42715
|
int test_mul(BIO *bp)
{
BIGNUM *a, *b, *c, *d, *e;
int i;
BN_CTX *ctx;
ctx = BN_CTX_new();
if (ctx == NULL)
EXIT(1);
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, 100, 0, 0);
BN_bntest_rand(b, 100, 0, 0);
} else
BN_bntest_rand(b, i - num1, 0, 0);
a->neg = rand_neg();
b->neg = rand_neg();
BN_mul(c, a, b, ctx);
if (bp != NULL) {
if (!results) {
BN_print(bp, a);
BIO_puts(bp, " * ");
BN_print(bp, b);
BIO_puts(bp, " - ");
}
BN_print(bp, c);
BIO_puts(bp, "\n");
}
BN_div(d, e, c, a, ctx);
BN_sub(d, d, b);
if (!BN_is_zero(d) || !BN_is_zero(e)) {
fprintf(stderr, "Multiplication test failed!\n");
return 0;
}
}
BN_free(a);
BN_free(b);
BN_free(c);
BN_free(d);
BN_free(e);
BN_CTX_free(ctx);
return (1);
}
test/bntest.c:681: error: MEMORY_LEAK
memory dynamically allocated by call to `BN_new()` at line 649, column 9 is not reachable after line 681, column 5.
Showing all 184 steps of the trace
test/bntest.c:637:1: start of procedure test_mul()
635. }
636.
637. > int test_mul(BIO *bp)
638. {
639. BIGNUM *a, *b, *c, *d, *e;
test/bntest.c:643:5:
641. BN_CTX *ctx;
642.
643. > ctx = BN_CTX_new();
644. if (ctx == NULL)
645. EXIT(1);
crypto/bn/bn_ctx.c:189:1: start of procedure BN_CTX_new()
187.
188.
189. > BN_CTX *BN_CTX_new(void)
190. {
191. BN_CTX *ret;
crypto/bn/bn_ctx.c:193:9:
191. BN_CTX *ret;
192.
193. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE);
195. return NULL;
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_ctx.c:193:9: Taking false branch
191. BN_CTX *ret;
192.
193. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE);
195. return NULL;
crypto/bn/bn_ctx.c:198:5:
196. }
197. /* Initialise the structure */
198. > BN_POOL_init(&ret->pool);
199. BN_STACK_init(&ret->stack);
200. return ret;
crypto/bn/bn_ctx.c:335:1: start of procedure BN_POOL_init()
333. /***********/
334.
335. > static void BN_POOL_init(BN_POOL *p)
336. {
337. p->head = p->current = p->tail = NULL;
crypto/bn/bn_ctx.c:337:5:
335. static void BN_POOL_init(BN_POOL *p)
336. {
337. > p->head = p->current = p->tail = NULL;
338. p->used = p->size = 0;
339. }
crypto/bn/bn_ctx.c:338:5:
336. {
337. p->head = p->current = p->tail = NULL;
338. > p->used = p->size = 0;
339. }
340.
crypto/bn/bn_ctx.c:339:1: return from a call to BN_POOL_init
337. p->head = p->current = p->tail = NULL;
338. p->used = p->size = 0;
339. > }
340.
341. static void BN_POOL_finish(BN_POOL *p)
crypto/bn/bn_ctx.c:199:5:
197. /* Initialise the structure */
198. BN_POOL_init(&ret->pool);
199. > BN_STACK_init(&ret->stack);
200. return ret;
201. }
crypto/bn/bn_ctx.c:294:1: start of procedure BN_STACK_init()
292. /************/
293.
294. > static void BN_STACK_init(BN_STACK *st)
295. {
296. st->indexes = NULL;
crypto/bn/bn_ctx.c:296:5:
294. static void BN_STACK_init(BN_STACK *st)
295. {
296. > st->indexes = NULL;
297. st->depth = st->size = 0;
298. }
crypto/bn/bn_ctx.c:297:5:
295. {
296. st->indexes = NULL;
297. > st->depth = st->size = 0;
298. }
299.
crypto/bn/bn_ctx.c:298:1: return from a call to BN_STACK_init
296. st->indexes = NULL;
297. st->depth = st->size = 0;
298. > }
299.
300. static void BN_STACK_finish(BN_STACK *st)
crypto/bn/bn_ctx.c:200:5:
198. BN_POOL_init(&ret->pool);
199. BN_STACK_init(&ret->stack);
200. > return ret;
201. }
202.
crypto/bn/bn_ctx.c:201:1: return from a call to BN_CTX_new
199. BN_STACK_init(&ret->stack);
200. return ret;
201. > }
202.
203. BN_CTX *BN_CTX_secure_new(void)
test/bntest.c:644:9: Taking false branch
642.
643. ctx = BN_CTX_new();
644. if (ctx == NULL)
^
645. EXIT(1);
646.
test/bntest.c:647:5:
645. EXIT(1);
646.
647. > a = BN_new();
648. b = BN_new();
649. 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:648:5:
646.
647. a = BN_new();
648. > b = BN_new();
649. c = BN_new();
650. 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:649:5:
647. a = BN_new();
648. b = BN_new();
649. > c = BN_new();
650. d = BN_new();
651. 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:650:5:
648. b = BN_new();
649. c = BN_new();
650. > d = BN_new();
651. e = BN_new();
652.
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:651:5:
649. c = BN_new();
650. d = BN_new();
651. > e = BN_new();
652.
653. 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:653:10:
651. e = BN_new();
652.
653. > for (i = 0; i < num0 + num1; i++) {
654. if (i <= num1) {
655. BN_bntest_rand(a, 100, 0, 0);
test/bntest.c:653:17: Loop condition is false. Leaving loop
651. e = BN_new();
652.
653. for (i = 0; i < num0 + num1; i++) {
^
654. if (i <= num1) {
655. BN_bntest_rand(a, 100, 0, 0);
test/bntest.c:679:5:
677. }
678. }
679. > BN_free(a);
680. BN_free(b);
681. BN_free(c);
crypto/bn/bn_lib.c:252:1: start of procedure BN_free()
250. }
251.
252. > void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
crypto/bn/bn_lib.c:254:9: Taking false branch
252. void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
^
255. return;
256. bn_check_top(a);
crypto/bn/bn_lib.c:257:10:
255. return;
256. bn_check_top(a);
257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
963. }
964.
965. > int BN_get_flags(const BIGNUM *b, int n)
966. {
967. return b->flags & n;
crypto/bn/bn_lib.c:967:5:
965. int BN_get_flags(const BIGNUM *b, int n)
966. {
967. > return b->flags & n;
968. }
969.
crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
966. {
967. return b->flags & n;
968. > }
969.
970. /* Populate a BN_GENCB structure with an "old"-style callback */
crypto/bn/bn_lib.c:257:10: Taking false branch
255. return;
256. bn_check_top(a);
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
^
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:259:9: Taking false branch
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
^
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:263:9:
261. else {
262. #if OPENSSL_API_COMPAT < 0x00908000L
263. > a->flags |= BN_FLG_FREE;
264. #endif
265. a->d = NULL;
crypto/bn/bn_lib.c:265:9:
263. a->flags |= BN_FLG_FREE;
264. #endif
265. > a->d = NULL;
266. }
267. }
crypto/bn/bn_lib.c:259:5:
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. > if (a->flags & BN_FLG_MALLOCED)
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:267:1: return from a call to BN_free
265. a->d = NULL;
266. }
267. > }
268.
269. void bn_init(BIGNUM *a)
test/bntest.c:680:5:
678. }
679. BN_free(a);
680. > BN_free(b);
681. BN_free(c);
682. BN_free(d);
crypto/bn/bn_lib.c:252:1: start of procedure BN_free()
250. }
251.
252. > void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
crypto/bn/bn_lib.c:254:9: Taking false branch
252. void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
^
255. return;
256. bn_check_top(a);
crypto/bn/bn_lib.c:257:10:
255. return;
256. bn_check_top(a);
257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
963. }
964.
965. > int BN_get_flags(const BIGNUM *b, int n)
966. {
967. return b->flags & n;
crypto/bn/bn_lib.c:967:5:
965. int BN_get_flags(const BIGNUM *b, int n)
966. {
967. > return b->flags & n;
968. }
969.
crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
966. {
967. return b->flags & n;
968. > }
969.
970. /* Populate a BN_GENCB structure with an "old"-style callback */
crypto/bn/bn_lib.c:257:10: Taking false branch
255. return;
256. bn_check_top(a);
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
^
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:259:9: Taking false branch
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
^
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:263:9:
261. else {
262. #if OPENSSL_API_COMPAT < 0x00908000L
263. > a->flags |= BN_FLG_FREE;
264. #endif
265. a->d = NULL;
crypto/bn/bn_lib.c:265:9:
263. a->flags |= BN_FLG_FREE;
264. #endif
265. > a->d = NULL;
266. }
267. }
crypto/bn/bn_lib.c:259:5:
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. > if (a->flags & BN_FLG_MALLOCED)
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:267:1: return from a call to BN_free
265. a->d = NULL;
266. }
267. > }
268.
269. void bn_init(BIGNUM *a)
test/bntest.c:681:5:
679. BN_free(a);
680. BN_free(b);
681. > BN_free(c);
682. BN_free(d);
683. BN_free(e);
crypto/bn/bn_lib.c:252:1: start of procedure BN_free()
250. }
251.
252. > void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
crypto/bn/bn_lib.c:254:9: Taking false branch
252. void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
^
255. return;
256. bn_check_top(a);
crypto/bn/bn_lib.c:257:10:
255. return;
256. bn_check_top(a);
257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
963. }
964.
965. > int BN_get_flags(const BIGNUM *b, int n)
966. {
967. return b->flags & n;
crypto/bn/bn_lib.c:967:5:
965. int BN_get_flags(const BIGNUM *b, int n)
966. {
967. > return b->flags & n;
968. }
969.
crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
966. {
967. return b->flags & n;
968. > }
969.
970. /* Populate a BN_GENCB structure with an "old"-style callback */
crypto/bn/bn_lib.c:257:10: Taking false branch
255. return;
256. bn_check_top(a);
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
^
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:259:9: Taking false branch
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
^
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:263:9:
261. else {
262. #if OPENSSL_API_COMPAT < 0x00908000L
263. > a->flags |= BN_FLG_FREE;
264. #endif
265. a->d = NULL;
crypto/bn/bn_lib.c:265:9:
263. a->flags |= BN_FLG_FREE;
264. #endif
265. > a->d = NULL;
266. }
267. }
crypto/bn/bn_lib.c:259:5:
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. > if (a->flags & BN_FLG_MALLOCED)
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:267:1: return from a call to BN_free
265. a->d = NULL;
266. }
267. > }
268.
269. void bn_init(BIGNUM *a)
|
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L681
|
d2a_code_trace_data_42716
|
ngx_int_t
ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value,
ngx_uint_t flags)
{
size_t len;
u_char *p;
ngx_str_t *name;
ngx_uint_t i, k, n, skip, last;
ngx_array_t *keys, *hwc;
ngx_hash_key_t *hk;
last = key->len;
if (flags & NGX_HASH_WILDCARD_KEY) {
n = 0;
for (i = 0; i < key->len; i++) {
if (key->data[i] == '*') {
if (++n > 1) {
return NGX_DECLINED;
}
}
if (key->data[i] == '.' && key->data[i + 1] == '.') {
return NGX_DECLINED;
}
if (key->data[i] == '\0') {
return NGX_DECLINED;
}
}
if (key->len > 1 && key->data[0] == '.') {
skip = 1;
goto wildcard;
}
if (key->len > 2) {
if (key->data[0] == '*' && key->data[1] == '.') {
skip = 2;
goto wildcard;
}
if (key->data[i - 2] == '.' && key->data[i - 1] == '*') {
skip = 0;
last -= 2;
goto wildcard;
}
}
if (n) {
return NGX_DECLINED;
}
}
k = 0;
for (i = 0; i < last; i++) {
if (!(flags & NGX_HASH_READONLY_KEY)) {
key->data[i] = ngx_tolower(key->data[i]);
}
k = ngx_hash(k, key->data[i]);
}
k %= ha->hsize;
name = ha->keys_hash[k].elts;
if (name) {
for (i = 0; i < ha->keys_hash[k].nelts; i++) {
if (last != name[i].len) {
continue;
}
if (ngx_strncmp(key->data, name[i].data, last) == 0) {
return NGX_BUSY;
}
}
} else {
if (ngx_array_init(&ha->keys_hash[k], ha->temp_pool, 4,
sizeof(ngx_str_t))
!= NGX_OK)
{
return NGX_ERROR;
}
}
name = ngx_array_push(&ha->keys_hash[k]);
if (name == NULL) {
return NGX_ERROR;
}
*name = *key;
hk = ngx_array_push(&ha->keys);
if (hk == NULL) {
return NGX_ERROR;
}
hk->key = *key;
hk->key_hash = ngx_hash_key(key->data, last);
hk->value = value;
return NGX_OK;
wildcard:
k = ngx_hash_strlow(&key->data[skip], &key->data[skip], last - skip);
k %= ha->hsize;
if (skip == 1) {
name = ha->keys_hash[k].elts;
if (name) {
len = last - skip;
for (i = 0; i < ha->keys_hash[k].nelts; i++) {
if (len != name[i].len) {
continue;
}
if (ngx_strncmp(&key->data[1], name[i].data, len) == 0) {
return NGX_BUSY;
}
}
} else {
if (ngx_array_init(&ha->keys_hash[k], ha->temp_pool, 4,
sizeof(ngx_str_t))
!= NGX_OK)
{
return NGX_ERROR;
}
}
name = ngx_array_push(&ha->keys_hash[k]);
if (name == NULL) {
return NGX_ERROR;
}
name->len = last - 1;
name->data = ngx_pnalloc(ha->temp_pool, name->len);
if (name->data == NULL) {
return NGX_ERROR;
}
ngx_memcpy(name->data, &key->data[1], name->len);
}
if (skip) {
p = ngx_pnalloc(ha->temp_pool, last);
if (p == NULL) {
return NGX_ERROR;
}
len = 0;
n = 0;
for (i = last - 1; i; i--) {
if (key->data[i] == '.') {
ngx_memcpy(&p[n], &key->data[i + 1], len);
n += len;
p[n++] = '.';
len = 0;
continue;
}
len++;
}
if (len) {
ngx_memcpy(&p[n], &key->data[1], len);
n += len;
}
p[n] = '\0';
hwc = &ha->dns_wc_head;
keys = &ha->dns_wc_head_hash[k];
} else {
last++;
p = ngx_pnalloc(ha->temp_pool, last);
if (p == NULL) {
return NGX_ERROR;
}
ngx_cpystrn(p, key->data, last);
hwc = &ha->dns_wc_tail;
keys = &ha->dns_wc_tail_hash[k];
}
name = keys->elts;
if (name) {
len = last - skip;
for (i = 0; i < keys->nelts; i++) {
if (len != name[i].len) {
continue;
}
if (ngx_strncmp(key->data + skip, name[i].data, len) == 0) {
return NGX_BUSY;
}
}
} else {
if (ngx_array_init(keys, ha->temp_pool, 4, sizeof(ngx_str_t)) != NGX_OK)
{
return NGX_ERROR;
}
}
name = ngx_array_push(keys);
if (name == NULL) {
return NGX_ERROR;
}
name->len = last - skip;
name->data = ngx_pnalloc(ha->temp_pool, name->len);
if (name->data == NULL) {
return NGX_ERROR;
}
ngx_memcpy(name->data, key->data + skip, name->len);
hk = ngx_array_push(hwc);
if (hk == NULL) {
return NGX_ERROR;
}
hk->key.len = last - 1;
hk->key.data = p;
hk->key_hash = 0;
hk->value = value;
return NGX_OK;
}
src/http/modules/ngx_http_referer_module.c:275: error: Buffer Overrun L3
Offset added: [-3, +oo] (⇐ [0, 2] + [-3, +oo]) Size: [8, +oo] by call to `ngx_http_add_variable`.
src/http/modules/ngx_http_referer_module.c:275:11: Call
273. ngx_http_variable_t *var;
274.
275. var = ngx_http_add_variable(cf, &ngx_http_invalid_referer_name,
^
276. NGX_HTTP_VAR_CHANGEABLE);
277. if (var == NULL) {
src/http/ngx_http_variables.c:392:1: Parameter `name->len`
390.
391.
392. ngx_http_variable_t *
^
393. ngx_http_add_variable(ngx_conf_t *cf, ngx_str_t *name, ngx_uint_t flags)
394. {
src/http/ngx_http_variables.c:439:5: Assignment
437. }
438.
439. v->name.len = name->len;
^
440. v->name.data = ngx_pnalloc(cf->pool, name->len);
441. if (v->name.data == NULL) {
src/http/ngx_http_variables.c:453:10: Call
451. v->index = 0;
452.
453. rc = ngx_hash_add_key(cmcf->variables_keys, &v->name, v, 0);
^
454.
455. if (rc == NGX_ERROR) {
src/core/ngx_hash.c:752:13: <Offset trace>
750.
751. if (key->len > 1 && key->data[0] == '.') {
752. skip = 1;
^
753. goto wildcard;
754. }
src/core/ngx_hash.c:752:13: Assignment
750.
751. if (key->len > 1 && key->data[0] == '.') {
752. skip = 1;
^
753. goto wildcard;
754. }
src/core/ngx_hash.c:966:5: Assignment
964. }
965.
966. name->len = last - skip;
^
967. name->data = ngx_pnalloc(ha->temp_pool, name->len);
968. if (name->data == NULL) {
src/core/ngx_hash.c:712:1: <Length trace>
710.
711.
712. ngx_int_t
^
713. ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value,
714. ngx_uint_t flags)
src/core/ngx_hash.c:712:1: Parameter `*key->data`
710.
711.
712. ngx_int_t
^
713. ngx_hash_add_key(ngx_hash_keys_arrays_t *ha, ngx_str_t *key, void *value,
714. ngx_uint_t flags)
src/core/ngx_hash.c:972:5: Array access: Offset added: [-3, +oo] (⇐ [0, 2] + [-3, +oo]) Size: [8, +oo] by call to `ngx_http_add_variable`
970. }
971.
972. ngx_memcpy(name->data, key->data + skip, name->len);
^
973.
974.
|
https://github.com/nginx/nginx/blob/c09bba400d233331f1b405e18c6912a30502dee9/src/core/ngx_hash.c/#L972
|
d2a_code_trace_data_42717
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
test/bntest.c:726: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_sqr`.
Showing all 17 steps of the trace
test/bntest.c:726:13: Call
724. BN_bntest_rand(a, 1024, 0, 0);
725. for (j = 0; j < 2; j++) {
726. BN_GF2m_mod_sqr(c, a, b[j], ctx);
^
727. BN_copy(d, a);
728. BN_GF2m_mod_mul(d, a, d, b[j], ctx);
crypto/bn/bn_gf2m.c:524:1: Parameter `ctx->stack.depth`
522. * use the BN_GF2m_mod_sqr_arr function.
523. */
524. > int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
525. {
526. int ret = 0;
test/bntest.c:728:13: Call
726. BN_GF2m_mod_sqr(c, a, b[j], ctx);
727. BN_copy(d, a);
728. BN_GF2m_mod_mul(d, a, d, b[j], ctx);
^
729. BN_GF2m_add(d, c, d);
730. /* Test that a*a = a^2. */
crypto/bn/bn_gf2m.c:465:1: Parameter `ctx->stack.depth`
463. * BN_GF2m_mod_mul_arr function.
464. */
465. > int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
466. const BIGNUM *p, BN_CTX *ctx)
467. {
test/bntest.c:726:13: Call
724. BN_bntest_rand(a, 1024, 0, 0);
725. for (j = 0; j < 2; j++) {
726. BN_GF2m_mod_sqr(c, a, b[j], ctx);
^
727. BN_copy(d, a);
728. BN_GF2m_mod_mul(d, a, d, b[j], ctx);
crypto/bn/bn_gf2m.c:524:1: Parameter `ctx->stack.depth`
522. * use the BN_GF2m_mod_sqr_arr function.
523. */
524. > int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
525. {
526. int ret = 0;
crypto/bn/bn_gf2m.c:539:11: Call
537. goto err;
538. }
539. ret = BN_GF2m_mod_sqr_arr(r, a, arr, ctx);
^
540. bn_check_top(r);
541. err:
crypto/bn/bn_gf2m.c:496:5: Call
494.
495. bn_check_top(a);
496. BN_CTX_start(ctx);
^
497. if ((s = BN_CTX_get(ctx)) == NULL)
498. goto err;
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_gf2m.c:514:5: Call
512. ret = 1;
513. err:
514. BN_CTX_end(ctx);
^
515. return ret;
516. }
crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <Offset trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: <Length trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_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_42718
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/bn/bn_prime.c:256: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul`.
Showing all 22 steps of the trace
crypto/bn/bn_prime.c:245:1: Parameter `ctx->stack.depth`
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 `ctx->stack.depth`
294. }
295.
296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
297. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
298. {
crypto/bn/bn_prime.c:256:14: Call
254. return 0; /* w == -1 (mod a), 'a' is probably prime */
255. while (--k) {
256. if (!BN_mod_mul(w, w, w, a, ctx)) /* w := w^2 mod a */
^
257. return -1;
258. if (BN_is_one(w))
crypto/bn/bn_mod.c:193:1: Parameter `ctx->stack.depth`
191.
192. /* slow but works */
193. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
194. BN_CTX *ctx)
195. {
crypto/bn/bn_mod.c:203:5: Call
201. bn_check_top(m);
202.
203. BN_CTX_start(ctx);
^
204. if ((t = BN_CTX_get(ctx)) == NULL)
205. 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_mod.c:204:14: Call
202.
203. BN_CTX_start(ctx);
204. if ((t = BN_CTX_get(ctx)) == NULL)
^
205. goto err;
206. if (a == b) {
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_mod.c:210:14: Call
208. goto err;
209. } else {
210. if (!BN_mul(t, a, b, ctx))
^
211. goto err;
212. }
crypto/bn/bn_mul.c:497:1: Parameter `ctx->stack.depth`
495. #endif /* BN_RECURSION */
496.
497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
498. {
499. int ret = bn_mul_fixed_top(r, a, b, ctx);
crypto/bn/bn_mul.c:499:15: Call
497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
498. {
499. int ret = bn_mul_fixed_top(r, a, b, ctx);
^
500.
501. bn_correct_top(r);
crypto/bn/bn_mul.c:533:5: Call
531. top = al + bl;
532.
533. BN_CTX_start(ctx);
^
534. if ((r == a) || (r == b)) {
535. if ((rr = BN_CTX_get(ctx)) == NULL)
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_mul.c:618:5: Call
616. err:
617. bn_check_top(r);
618. BN_CTX_end(ctx);
^
619. return ret;
620. }
crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <Offset trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: <Length trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul`
266. static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
^
269. }
270.
|
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
|
d2a_code_trace_data_42719
|
static void vp6_default_models_init(vp56_context_t *s)
{
vp56_model_t *model = s->modelp;
model->vector_dct[0] = 0xA2;
model->vector_dct[1] = 0xA4;
model->vector_sig[0] = 0x80;
model->vector_sig[1] = 0x80;
memcpy(model->mb_types_stats, vp56_def_mb_types_stats, sizeof(model->mb_types_stats));
memcpy(model->vector_fdv, vp6_def_fdv_vector_model, sizeof(model->vector_fdv));
memcpy(model->vector_pdv, vp6_def_pdv_vector_model, sizeof(model->vector_pdv));
memcpy(model->coeff_runv, vp6_def_runv_coeff_model, sizeof(model->coeff_runv));
memcpy(model->coeff_reorder, vp6_def_coeff_reorder, sizeof(model->coeff_reorder));
vp6_coeff_order_table_init(s);
}
libavcodec/vp6.c:176: error: Buffer Overrun L3
Offset added: 64 Size: [0, +oo].
libavcodec/vp6.c:163:1: <Length trace>
161. }
162.
163. static void vp6_default_models_init(vp56_context_t *s)
^
164. {
165. vp56_model_t *model = s->modelp;
libavcodec/vp6.c:163:1: Parameter `s->modelp->coeff_reorder[*]`
161. }
162.
163. static void vp6_default_models_init(vp56_context_t *s)
^
164. {
165. vp56_model_t *model = s->modelp;
libavcodec/vp6.c:176:5: Array access: Offset added: 64 Size: [0, +oo]
174. memcpy(model->vector_pdv, vp6_def_pdv_vector_model, sizeof(model->vector_pdv));
175. memcpy(model->coeff_runv, vp6_def_runv_coeff_model, sizeof(model->coeff_runv));
176. memcpy(model->coeff_reorder, vp6_def_coeff_reorder, sizeof(model->coeff_reorder));
^
177.
178. vp6_coeff_order_table_init(s);
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vp6.c/#L176
|
d2a_code_trace_data_42720
|
int RAND_bytes(unsigned char *buf, int num)
{
const RAND_METHOD *meth = RAND_get_rand_method();
if (meth->bytes != NULL)
return meth->bytes(buf, num);
RANDerr(RAND_F_RAND_BYTES, RAND_R_FUNC_NOT_IMPLEMENTED);
return -1;
}
crypto/rand/rand_lib.c:773: error: NULL_DEREFERENCE
pointer `meth` last assigned on line 771 could be null and is dereferenced at line 773, column 9.
Showing all 14 steps of the trace
crypto/rand/rand_lib.c:769:1: start of procedure RAND_bytes()
767. }
768.
769. > int RAND_bytes(unsigned char *buf, int num)
770. {
771. const RAND_METHOD *meth = RAND_get_rand_method();
crypto/rand/rand_lib.c:771:5:
769. int RAND_bytes(unsigned char *buf, int num)
770. {
771. > const RAND_METHOD *meth = RAND_get_rand_method();
772.
773. if (meth->bytes != NULL)
crypto/rand/rand_lib.c:671:1: start of procedure RAND_get_rand_method()
669. #endif
670.
671. > const RAND_METHOD *RAND_get_rand_method(void)
672. {
673. #ifdef FIPS_MODE
crypto/rand/rand_lib.c:676:5:
674. return NULL;
675. #else
676. > const RAND_METHOD *tmp_meth = NULL;
677.
678. if (!RUN_ONCE(&rand_init, do_rand_init))
crypto/rand/rand_lib.c:678:10:
676. const RAND_METHOD *tmp_meth = NULL;
677.
678. > if (!RUN_ONCE(&rand_init, do_rand_init))
679. return NULL;
680.
crypto/threads_pthread.c:111:1: start of procedure CRYPTO_THREAD_run_once()
109. }
110.
111. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
112. {
113. if (pthread_once(once, init) != 0)
crypto/threads_pthread.c:113:9: Taking true branch
111. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
112. {
113. if (pthread_once(once, init) != 0)
^
114. return 0;
115.
crypto/threads_pthread.c:114:9:
112. {
113. if (pthread_once(once, init) != 0)
114. > return 0;
115.
116. return 1;
crypto/threads_pthread.c:117:1: return from a call to CRYPTO_THREAD_run_once
115.
116. return 1;
117. > }
118.
119. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))
crypto/rand/rand_lib.c:678:10: Condition is false
676. const RAND_METHOD *tmp_meth = NULL;
677.
678. if (!RUN_ONCE(&rand_init, do_rand_init))
^
679. return NULL;
680.
crypto/rand/rand_lib.c:678:10: Taking true branch
676. const RAND_METHOD *tmp_meth = NULL;
677.
678. if (!RUN_ONCE(&rand_init, do_rand_init))
^
679. return NULL;
680.
crypto/rand/rand_lib.c:679:9:
677.
678. if (!RUN_ONCE(&rand_init, do_rand_init))
679. > return NULL;
680.
681. CRYPTO_THREAD_write_lock(rand_meth_lock);
crypto/rand/rand_lib.c:703:1: return from a call to RAND_get_rand_method
701. return tmp_meth;
702. #endif
703. > }
704.
705. #if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE)
crypto/rand/rand_lib.c:773:9:
771. const RAND_METHOD *meth = RAND_get_rand_method();
772.
773. > if (meth->bytes != NULL)
774. return meth->bytes(buf, num);
775. RANDerr(RAND_F_RAND_BYTES, RAND_R_FUNC_NOT_IMPLEMENTED);
|
https://github.com/openssl/openssl/blob/37ca204b96b036f949b8bc8389c1f8e806e1cbec/crypto/rand/rand_lib.c/#L773
|
d2a_code_trace_data_42721
|
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
{
int i;
BN_ULONG *A;
const BN_ULONG *B;
bn_check_top(b);
if (a == b)
return (a);
if (bn_wexpand(a, b->top) == NULL)
return (NULL);
#if 1
A = a->d;
B = b->d;
for (i = b->top >> 2; i > 0; i--, A += 4, B += 4) {
BN_ULONG a0, a1, a2, a3;
a0 = B[0];
a1 = B[1];
a2 = B[2];
a3 = B[3];
A[0] = a0;
A[1] = a1;
A[2] = a2;
A[3] = a3;
}
switch (b->top & 3) {
case 3:
A[2] = B[2];
case 2:
A[1] = B[1];
case 1:
A[0] = B[0];
case 0:;
}
#else
memcpy(a->d, b->d, sizeof(b->d[0]) * b->top);
#endif
a->top = b->top;
a->neg = b->neg;
bn_check_top(a);
return (a);
}
crypto/bn/bn_prime.c:243: error: BUFFER_OVERRUN_L3
Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, 8388607] by call to `BN_copy`.
Showing all 12 steps of the trace
crypto/bn/bn_prime.c:241:18: Call
239. if (a->neg) {
240. BIGNUM *t;
241. if ((t = BN_CTX_get(ctx)) == NULL)
^
242. goto err;
243. if (BN_copy(t, a) == NULL)
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:463:1: Parameter `*a->d`
461. }
462.
463. > int BN_set_word(BIGNUM *a, BN_ULONG w)
464. {
465. bn_check_top(a);
crypto/bn/bn_lib.c:466:9: Call
464. {
465. bn_check_top(a);
466. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
467. return (0);
468. a->neg = 0;
crypto/bn/bn_lcl.h:676:1: Parameter `*a->d`
674. int bn_probable_prime_dh_coprime(BIGNUM *rnd, int bits, BN_CTX *ctx);
675.
676. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
677. {
678. if (bits > (INT_MAX - BN_BITS2 + 1))
crypto/bn/bn_prime.c:243:13: Call
241. if ((t = BN_CTX_get(ctx)) == NULL)
242. goto err;
243. if (BN_copy(t, a) == NULL)
^
244. goto err;
245. t->neg = 0;
crypto/bn/bn_lib.c:362:1: <Length trace>
360. }
361.
362. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
363. {
364. int i;
crypto/bn/bn_lib.c:362:1: Parameter `*a->d`
360. }
361.
362. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
363. {
364. int i;
crypto/bn/bn_lib.c:372:9: Call
370. if (a == b)
371. return (a);
372. if (bn_wexpand(a, b->top) == NULL)
^
373. return (NULL);
374.
crypto/bn/bn_lib.c:1016:1: Parameter `*a->d`
1014. }
1015.
1016. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
1017. {
1018. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_lib.c:376:5: Assignment
374.
375. #if 1
376. A = a->d;
^
377. B = b->d;
378. for (i = b->top >> 2; i > 0; i--, A += 4, B += 4) {
crypto/bn/bn_lib.c:387:9: Array access: Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, 8388607] by call to `BN_copy`
385. A[1] = a1;
386. A[2] = a2;
387. A[3] = a3;
^
388. }
389. /* ultrix cc workaround, see comments in bn_expand_internal */
|
https://github.com/openssl/openssl/blob/d7c42d71ba407a4b3c26ed58263ae225976bbac3/crypto/bn/bn_lib.c/#L387
|
d2a_code_trace_data_42722
|
u_char *
ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
{
u_char *p, zero, *last;
int d;
float f, scale;
size_t len, slen;
int64_t i64;
uint64_t ui64;
ngx_msec_t ms;
ngx_uint_t width, sign, hex, max_width, frac_width, i;
ngx_str_t *v;
ngx_variable_value_t *vv;
if (max == 0) {
return buf;
}
last = buf + max;
while (*fmt && buf < last) {
if (*fmt == '%') {
i64 = 0;
ui64 = 0;
zero = (u_char) ((*++fmt == '0') ? '0' : ' ');
width = 0;
sign = 1;
hex = 0;
max_width = 0;
frac_width = 0;
slen = (size_t) -1;
while (*fmt >= '0' && *fmt <= '9') {
width = width * 10 + *fmt++ - '0';
}
for ( ;; ) {
switch (*fmt) {
case 'u':
sign = 0;
fmt++;
continue;
case 'm':
max_width = 1;
fmt++;
continue;
case 'X':
hex = 2;
sign = 0;
fmt++;
continue;
case 'x':
hex = 1;
sign = 0;
fmt++;
continue;
case '.':
fmt++;
while (*fmt >= '0' && *fmt <= '9') {
frac_width = frac_width * 10 + *fmt++ - '0';
}
break;
case '*':
slen = va_arg(args, size_t);
fmt++;
continue;
default:
break;
}
break;
}
switch (*fmt) {
case 'V':
v = va_arg(args, ngx_str_t *);
len = v->len;
len = (buf + len < last) ? len : (size_t) (last - buf);
buf = ngx_cpymem(buf, v->data, len);
fmt++;
continue;
case 'v':
vv = va_arg(args, ngx_variable_value_t *);
len = vv->len;
len = (buf + len < last) ? len : (size_t) (last - buf);
buf = ngx_cpymem(buf, vv->data, len);
fmt++;
continue;
case 's':
p = va_arg(args, u_char *);
if (slen == (size_t) -1) {
while (*p && buf < last) {
*buf++ = *p++;
}
} else {
len = (buf + slen < last) ? slen : (size_t) (last - buf);
buf = ngx_cpymem(buf, p, len);
}
fmt++;
continue;
case 'O':
i64 = (int64_t) va_arg(args, off_t);
sign = 1;
break;
case 'P':
i64 = (int64_t) va_arg(args, ngx_pid_t);
sign = 1;
break;
case 'T':
i64 = (int64_t) va_arg(args, time_t);
sign = 1;
break;
case 'M':
ms = (ngx_msec_t) va_arg(args, ngx_msec_t);
if ((ngx_msec_int_t) ms == -1) {
sign = 1;
i64 = -1;
} else {
sign = 0;
ui64 = (uint64_t) ms;
}
break;
case 'z':
if (sign) {
i64 = (int64_t) va_arg(args, ssize_t);
} else {
ui64 = (uint64_t) va_arg(args, size_t);
}
break;
case 'i':
if (sign) {
i64 = (int64_t) va_arg(args, ngx_int_t);
} else {
ui64 = (uint64_t) va_arg(args, ngx_uint_t);
}
if (max_width) {
width = NGX_INT_T_LEN;
}
break;
case 'd':
if (sign) {
i64 = (int64_t) va_arg(args, int);
} else {
ui64 = (uint64_t) va_arg(args, u_int);
}
break;
case 'l':
if (sign) {
i64 = (int64_t) va_arg(args, long);
} else {
ui64 = (uint64_t) va_arg(args, u_long);
}
break;
case 'D':
if (sign) {
i64 = (int64_t) va_arg(args, int32_t);
} else {
ui64 = (uint64_t) va_arg(args, uint32_t);
}
break;
case 'L':
if (sign) {
i64 = va_arg(args, int64_t);
} else {
ui64 = va_arg(args, uint64_t);
}
break;
case 'A':
if (sign) {
i64 = (int64_t) va_arg(args, ngx_atomic_int_t);
} else {
ui64 = (uint64_t) va_arg(args, ngx_atomic_uint_t);
}
if (max_width) {
width = NGX_ATOMIC_T_LEN;
}
break;
case 'f':
f = (float) va_arg(args, double);
if (f < 0) {
*buf++ = '-';
f = -f;
}
ui64 = (int64_t) f;
buf = ngx_sprintf_num(buf, last, ui64, zero, 0, width);
if (frac_width) {
if (buf < last) {
*buf++ = '.';
}
scale = 1.0;
for (i = 0; i < frac_width; i++) {
scale *= 10.0;
}
ui64 = (uint64_t) ((f - (int64_t) ui64) * scale);
buf = ngx_sprintf_num(buf, last, ui64, '0', 0, frac_width);
}
fmt++;
continue;
#if !(NGX_WIN32)
case 'r':
i64 = (int64_t) va_arg(args, rlim_t);
sign = 1;
break;
#endif
case 'p':
ui64 = (uintptr_t) va_arg(args, void *);
hex = 2;
sign = 0;
zero = '0';
width = NGX_PTR_SIZE * 2;
break;
case 'c':
d = va_arg(args, int);
*buf++ = (u_char) (d & 0xff);
fmt++;
continue;
case 'Z':
*buf++ = '\0';
fmt++;
continue;
case 'N':
#if (NGX_WIN32)
*buf++ = CR;
#endif
*buf++ = LF;
fmt++;
continue;
case '%':
*buf++ = '%';
fmt++;
continue;
default:
*buf++ = *fmt++;
continue;
}
if (sign) {
if (i64 < 0) {
*buf++ = '-';
ui64 = (uint64_t) -i64;
} else {
ui64 = (uint64_t) i64;
}
}
buf = ngx_sprintf_num(buf, last, ui64, zero, hex, width);
fmt++;
} else {
*buf++ = *fmt++;
}
}
return buf;
}
src/http/modules/ngx_http_proxy_module.c:1573: error: Buffer Overrun L2
Offset: [0, 4048] Size: 2048 by call to `ngx_log_error_core`.
src/http/modules/ngx_http_proxy_module.c:1472:14: Unknown value from: ngx_http_parse_header_line
1470. for ( ;; ) {
1471.
1472. rc = ngx_http_parse_header_line(r, &r->upstream->buffer, 1);
^
1473.
1474. if (rc == NGX_OK) {
src/http/modules/ngx_http_proxy_module.c:1573:9: Call
1571. /* there was error while a header line parsing */
1572.
1573. ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
^
1574. "upstream sent invalid header");
1575.
src/core/ngx_log.c:67:1: Array declaration
65. #if (NGX_HAVE_VARIADIC_MACROS)
66.
67. void
^
68. ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,
69. const char *fmt, ...)
src/core/ngx_log.c:88:5: Assignment
86. }
87.
88. last = errstr + NGX_MAX_ERROR_STR;
^
89.
90. ngx_memcpy(errstr, ngx_cached_err_log_time.data,
src/core/ngx_log.c:133:13: Call
131. ? " (%d: " : " (%Xd: ", err);
132. #else
133. p = ngx_snprintf(p, last - p, " (%d: ", err);
^
134. #endif
135.
src/core/ngx_string.c:109:1: Parameter `max`
107.
108.
109. u_char * ngx_cdecl
^
110. ngx_snprintf(u_char *buf, size_t max, const char *fmt, ...)
111. {
src/core/ngx_string.c:116:9: Call
114.
115. va_start(args, fmt);
116. p = ngx_vsnprintf(buf, max, fmt, args);
^
117. va_end(args);
118.
src/core/ngx_string.c:123:1: <Length trace>
121.
122.
123. u_char *
^
124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
125. {
src/core/ngx_string.c:123:1: Parameter `*buf`
121.
122.
123. u_char *
^
124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
125. {
src/core/ngx_string.c:244:25: Array access: Offset: [0, 4048] Size: 2048 by call to `ngx_log_error_core`
242. if (slen == (size_t) -1) {
243. while (*p && buf < last) {
244. *buf++ = *p++;
^
245. }
246.
|
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_string.c/#L244
|
d2a_code_trace_data_42723
|
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
{
assert(pkt->subs != NULL && len != 0);
if (pkt->subs == NULL || len == 0)
return 0;
if (pkt->maxsize - pkt->written < len)
return 0;
if (pkt->buf->length - pkt->written < len) {
size_t newlen;
size_t reflen;
reflen = (len > pkt->buf->length) ? len : pkt->buf->length;
if (reflen > SIZE_MAX / 2) {
newlen = SIZE_MAX;
} else {
newlen = reflen * 2;
if (newlen < DEFAULT_BUF_SIZE)
newlen = DEFAULT_BUF_SIZE;
}
if (BUF_MEM_grow(pkt->buf, newlen) == 0)
return 0;
}
*allocbytes = (unsigned char *)pkt->buf->data + pkt->curr;
return 1;
}
ssl/s3_lib.c:3727: error: INTEGER_OVERFLOW_L2
([0, +oo] - [`pkt->written`, `pkt->written` + 4]):unsigned64 by call to `WPACKET_put_bytes__`.
Showing all 12 steps of the trace
ssl/s3_lib.c:3726:20: Call
3724. #ifndef OPENSSL_NO_GOST
3725. if (s->version >= TLS1_VERSION && (alg_k & SSL_kGOST))
3726. return WPACKET_put_bytes_u8(pkt, TLS_CT_GOST01_SIGN)
^
3727. && WPACKET_put_bytes_u8(pkt, TLS_CT_GOST12_SIGN)
3728. && WPACKET_put_bytes_u8(pkt, TLS_CT_GOST12_512_SIGN);
ssl/packet.c:261:1: Parameter `pkt->buf->length`
259. }
260.
261. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size)
262. {
263. unsigned char *data;
ssl/s3_lib.c:3727:24: Call
3725. if (s->version >= TLS1_VERSION && (alg_k & SSL_kGOST))
3726. return WPACKET_put_bytes_u8(pkt, TLS_CT_GOST01_SIGN)
3727. && WPACKET_put_bytes_u8(pkt, TLS_CT_GOST12_SIGN)
^
3728. && WPACKET_put_bytes_u8(pkt, TLS_CT_GOST12_512_SIGN);
3729. #endif
ssl/packet.c:261:1: Parameter `pkt->written`
259. }
260.
261. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size)
262. {
263. unsigned char *data;
ssl/packet.c:269:17: Call
267.
268. if (size > sizeof(unsigned int)
269. || !WPACKET_allocate_bytes(pkt, size, &data)
^
270. || !put_value(data, val, size))
271. return 0;
ssl/packet.c:15:1: Parameter `pkt->written`
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes))
ssl/packet.c:17:10: Call
15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes))
^
18. return 0;
19.
ssl/packet.c:36:1: <LHS trace>
34. }
35.
36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
37. {
38. /* Internal API, so should not fail */
ssl/packet.c:36:1: Parameter `pkt->buf->length`
34. }
35.
36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
37. {
38. /* Internal API, so should not fail */
ssl/packet.c:36:1: <RHS trace>
34. }
35.
36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
37. {
38. /* Internal API, so should not fail */
ssl/packet.c:36:1: Parameter `len`
34. }
35.
36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
37. {
38. /* Internal API, so should not fail */
ssl/packet.c:46:9: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 4]):unsigned64 by call to `WPACKET_put_bytes__`
44. return 0;
45.
46. if (pkt->buf->length - pkt->written < len) {
^
47. size_t newlen;
48. size_t reflen;
|
https://github.com/openssl/openssl/blob/e4e1aa903e624044d3319622fc50222f1b2c7328/ssl/packet.c/#L46
|
d2a_code_trace_data_42724
|
int test_gf2m_mod_exp(BIO *bp, BN_CTX *ctx)
{
BIGNUM *a, *b[2], *c, *d, *e, *f;
int i, j, ret = 0;
int p0[] = { 163, 7, 6, 3, 0, -1 };
int p1[] = { 193, 15, 0, -1 };
a = BN_new();
b[0] = BN_new();
b[1] = BN_new();
c = BN_new();
d = BN_new();
e = BN_new();
f = BN_new();
BN_GF2m_arr2poly(p0, b[0]);
BN_GF2m_arr2poly(p1, b[1]);
for (i = 0; i < num0; i++) {
BN_bntest_rand(a, 512, 0, 0);
BN_bntest_rand(c, 512, 0, 0);
BN_bntest_rand(d, 512, 0, 0);
for (j = 0; j < 2; j++) {
BN_GF2m_mod_exp(e, a, c, b[j], ctx);
BN_GF2m_mod_exp(f, a, d, b[j], ctx);
BN_GF2m_mod_mul(e, e, f, b[j], ctx);
BN_add(f, c, d);
BN_GF2m_mod_exp(f, a, f, b[j], ctx);
BN_GF2m_add(f, e, f);
if (!BN_is_zero(f)) {
fprintf(stderr,
"GF(2^m) modular exponentiation test failed!\n");
goto err;
}
}
}
ret = 1;
err:
BN_free(a);
BN_free(b[0]);
BN_free(b[1]);
BN_free(c);
BN_free(d);
BN_free(e);
BN_free(f);
return ret;
}
test/bntest.c:1524: error: MEMORY_LEAK
memory dynamically allocated by call to `BN_new()` at line 1492, column 9 is not reachable after line 1524, column 5.
Showing all 177 steps of the trace
test/bntest.c:1485:1: start of procedure test_gf2m_mod_exp()
1483. }
1484.
1485. > int test_gf2m_mod_exp(BIO *bp, BN_CTX *ctx)
1486. {
1487. BIGNUM *a, *b[2], *c, *d, *e, *f;
test/bntest.c:1488:5:
1486. {
1487. BIGNUM *a, *b[2], *c, *d, *e, *f;
1488. > int i, j, ret = 0;
1489. int p0[] = { 163, 7, 6, 3, 0, -1 };
1490. int p1[] = { 193, 15, 0, -1 };
test/bntest.c:1489:5:
1487. BIGNUM *a, *b[2], *c, *d, *e, *f;
1488. int i, j, ret = 0;
1489. > int p0[] = { 163, 7, 6, 3, 0, -1 };
1490. int p1[] = { 193, 15, 0, -1 };
1491.
test/bntest.c:1490:5:
1488. int i, j, ret = 0;
1489. int p0[] = { 163, 7, 6, 3, 0, -1 };
1490. > int p1[] = { 193, 15, 0, -1 };
1491.
1492. a = BN_new();
test/bntest.c:1492:5:
1490. int p1[] = { 193, 15, 0, -1 };
1491.
1492. > a = BN_new();
1493. b[0] = BN_new();
1494. b[1] = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:1493:5:
1491.
1492. a = BN_new();
1493. > b[0] = BN_new();
1494. b[1] = BN_new();
1495. 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:1494:5:
1492. a = BN_new();
1493. b[0] = BN_new();
1494. > b[1] = BN_new();
1495. c = BN_new();
1496. 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:1495:5:
1493. b[0] = BN_new();
1494. b[1] = BN_new();
1495. > c = BN_new();
1496. d = BN_new();
1497. 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:1496:5:
1494. b[1] = BN_new();
1495. c = BN_new();
1496. > d = BN_new();
1497. e = BN_new();
1498. f = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:1497:5:
1495. c = BN_new();
1496. d = BN_new();
1497. > e = BN_new();
1498. f = BN_new();
1499.
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:1498:5:
1496. d = BN_new();
1497. e = BN_new();
1498. > f = BN_new();
1499.
1500. BN_GF2m_arr2poly(p0, b[0]);
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:1500:5: Skipping BN_GF2m_arr2poly(): empty list of specs
1498. f = BN_new();
1499.
1500. BN_GF2m_arr2poly(p0, b[0]);
^
1501. BN_GF2m_arr2poly(p1, b[1]);
1502.
test/bntest.c:1501:5: Skipping BN_GF2m_arr2poly(): empty list of specs
1499.
1500. BN_GF2m_arr2poly(p0, b[0]);
1501. BN_GF2m_arr2poly(p1, b[1]);
^
1502.
1503. for (i = 0; i < num0; i++) {
test/bntest.c:1503:10:
1501. BN_GF2m_arr2poly(p1, b[1]);
1502.
1503. > for (i = 0; i < num0; i++) {
1504. BN_bntest_rand(a, 512, 0, 0);
1505. BN_bntest_rand(c, 512, 0, 0);
test/bntest.c:1503:17: Loop condition is false. Leaving loop
1501. BN_GF2m_arr2poly(p1, b[1]);
1502.
1503. for (i = 0; i < num0; i++) {
^
1504. BN_bntest_rand(a, 512, 0, 0);
1505. BN_bntest_rand(c, 512, 0, 0);
test/bntest.c:1522:5:
1520. }
1521. }
1522. > ret = 1;
1523. err:
1524. BN_free(a);
test/bntest.c:1523:2:
1521. }
1522. ret = 1;
1523. > err:
1524. BN_free(a);
1525. BN_free(b[0]);
test/bntest.c:1524:5:
1522. ret = 1;
1523. err:
1524. > BN_free(a);
1525. BN_free(b[0]);
1526. BN_free(b[1]);
crypto/bn/bn_lib.c:252:1: start of procedure BN_free()
250. }
251.
252. > void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
crypto/bn/bn_lib.c:254:9: Taking false branch
252. void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
^
255. return;
256. bn_check_top(a);
crypto/bn/bn_lib.c:257:10:
255. return;
256. bn_check_top(a);
257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
963. }
964.
965. > int BN_get_flags(const BIGNUM *b, int n)
966. {
967. return b->flags & n;
crypto/bn/bn_lib.c:967:5:
965. int BN_get_flags(const BIGNUM *b, int n)
966. {
967. > return b->flags & n;
968. }
969.
crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
966. {
967. return b->flags & n;
968. > }
969.
970. /* Populate a BN_GENCB structure with an "old"-style callback */
crypto/bn/bn_lib.c:257:10: Taking false branch
255. return;
256. bn_check_top(a);
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
^
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:259:9: Taking false branch
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
^
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:263:9:
261. else {
262. #if OPENSSL_API_COMPAT < 0x00908000L
263. > a->flags |= BN_FLG_FREE;
264. #endif
265. a->d = NULL;
crypto/bn/bn_lib.c:265:9:
263. a->flags |= BN_FLG_FREE;
264. #endif
265. > a->d = NULL;
266. }
267. }
crypto/bn/bn_lib.c:259:5:
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. > if (a->flags & BN_FLG_MALLOCED)
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:267:1: return from a call to BN_free
265. a->d = NULL;
266. }
267. > }
268.
269. void bn_init(BIGNUM *a)
|
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L1524
|
d2a_code_trace_data_42725
|
static int kek_unwrap_key(unsigned char *out, size_t *outlen,
const unsigned char *in, size_t inlen,
EVP_CIPHER_CTX *ctx)
{
size_t blocklen = EVP_CIPHER_CTX_block_size(ctx);
unsigned char *tmp;
int outl, rv = 0;
if (inlen < 2 * blocklen) {
return 0;
}
if (inlen % blocklen) {
return 0;
}
tmp = OPENSSL_malloc(inlen);
if (tmp == NULL)
return 0;
if (!EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, &outl,
in + inlen - 2 * blocklen, blocklen * 2)
|| !EVP_DecryptUpdate(ctx, tmp, &outl,
tmp + inlen - blocklen, blocklen)
|| !EVP_DecryptUpdate(ctx, tmp, &outl, in, inlen - blocklen)
|| !EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, NULL)
|| !EVP_DecryptUpdate(ctx, tmp, &outl, tmp, inlen))
goto err;
if (((tmp[1] ^ tmp[4]) & (tmp[2] ^ tmp[5]) & (tmp[3] ^ tmp[6])) != 0xff) {
goto err;
}
if (inlen < (size_t)(tmp[0] - 4)) {
goto err;
}
*outlen = (size_t)tmp[0];
memcpy(out, tmp + 4, *outlen);
rv = 1;
err:
OPENSSL_clear_free(tmp, inlen);
return rv;
}
crypto/cms/cms_smime.c:734: error: BUFFER_OVERRUN_L3
Offset: 6 Size: [1, +oo] by call to `CMS_RecipientInfo_decrypt`.
Showing all 13 steps of the trace
crypto/cms/cms_smime.c:734:17: Call
732. if (!id || (CMS_RecipientInfo_kekri_id_cmp(ri, id, idlen) == 0)) {
733. CMS_RecipientInfo_set0_key(ri, key, keylen);
734. r = CMS_RecipientInfo_decrypt(cms, ri);
^
735. CMS_RecipientInfo_set0_key(ri, NULL, 0);
736. if (r > 0)
crypto/cms/cms_env.c:782:1: Parameter `ri->d.pwri->encryptedKey->length`
780. }
781.
782. > int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri)
783. {
784. switch (ri->type) {
crypto/cms/cms_smime.c:734:17: Call
732. if (!id || (CMS_RecipientInfo_kekri_id_cmp(ri, id, idlen) == 0)) {
733. CMS_RecipientInfo_set0_key(ri, key, keylen);
734. r = CMS_RecipientInfo_decrypt(cms, ri);
^
735. CMS_RecipientInfo_set0_key(ri, NULL, 0);
736. if (r > 0)
crypto/cms/cms_env.c:782:1: Parameter `ri->d.pwri->encryptedKey->length`
780. }
781.
782. > int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri)
783. {
784. switch (ri->type) {
crypto/cms/cms_env.c:792:16: Call
790.
791. case CMS_RECIPINFO_PASS:
792. return cms_RecipientInfo_pwri_crypt(cms, ri, 0);
^
793.
794. default:
crypto/cms/cms_pwri.c:320:1: Parameter `ri->d.pwri->encryptedKey->length`
318. /* Encrypt/Decrypt content key in PWRI recipient info */
319.
320. > int cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri,
321. int en_de)
322. {
crypto/cms/cms_pwri.c:409:14: Call
407. goto err;
408. }
409. if (!kek_unwrap_key(key, &keylen,
^
410. pwri->encryptedKey->data,
411. pwri->encryptedKey->length, kekctx)) {
crypto/cms/cms_pwri.c:221:1: <Length trace>
219. */
220.
221. > static int kek_unwrap_key(unsigned char *out, size_t *outlen,
222. const unsigned char *in, size_t inlen,
223. EVP_CIPHER_CTX *ctx)
crypto/cms/cms_pwri.c:221:1: Parameter `inlen`
219. */
220.
221. > static int kek_unwrap_key(unsigned char *out, size_t *outlen,
222. const unsigned char *in, size_t inlen,
223. EVP_CIPHER_CTX *ctx)
crypto/cms/cms_pwri.c:236:11: Call
234. return 0;
235. }
236. tmp = OPENSSL_malloc(inlen);
^
237. if (tmp == NULL)
238. return 0;
crypto/mem.c:125:9: Assignment
123.
124. if (num <= 0)
125. return NULL;
^
126.
127. allow_customize = 0;
crypto/cms/cms_pwri.c:236:5: Assignment
234. return 0;
235. }
236. tmp = OPENSSL_malloc(inlen);
^
237. if (tmp == NULL)
238. return 0;
crypto/cms/cms_pwri.c:258:60: Array access: Offset: 6 Size: [1, +oo] by call to `CMS_RecipientInfo_decrypt`
256. goto err;
257. /* Check check bytes */
258. if (((tmp[1] ^ tmp[4]) & (tmp[2] ^ tmp[5]) & (tmp[3] ^ tmp[6])) != 0xff) {
^
259. /* Check byte failure */
260. goto err;
|
https://github.com/openssl/openssl/blob/846ec07d904f9cc81d486db0db14fb84f61ff6e5/crypto/cms/cms_pwri.c/#L258
|
d2a_code_trace_data_42726
|
static void frame_end(MpegEncContext *s)
{
int i;
if (s->unrestricted_mv &&
s->current_picture.reference &&
!s->intra_only) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
int hshift = desc->log2_chroma_w;
int vshift = desc->log2_chroma_h;
s->mpvencdsp.draw_edges(s->current_picture.f->data[0], s->linesize,
s->h_edge_pos, s->v_edge_pos,
EDGE_WIDTH, EDGE_WIDTH,
EDGE_TOP | EDGE_BOTTOM);
s->mpvencdsp.draw_edges(s->current_picture.f->data[1], s->uvlinesize,
s->h_edge_pos >> hshift,
s->v_edge_pos >> vshift,
EDGE_WIDTH >> hshift,
EDGE_WIDTH >> vshift,
EDGE_TOP | EDGE_BOTTOM);
s->mpvencdsp.draw_edges(s->current_picture.f->data[2], s->uvlinesize,
s->h_edge_pos >> hshift,
s->v_edge_pos >> vshift,
EDGE_WIDTH >> hshift,
EDGE_WIDTH >> vshift,
EDGE_TOP | EDGE_BOTTOM);
}
emms_c();
s->last_pict_type = s->pict_type;
s->last_lambda_for [s->pict_type] = s->current_picture_ptr->f->quality;
if (s->pict_type!= AV_PICTURE_TYPE_B)
s->last_non_b_pict_type = s->pict_type;
if (s->encoding) {
for (i = 0; i < MAX_PICTURE_COUNT; i++) {
if (!s->picture[i].reference)
ff_mpeg_unref_picture(s, &s->picture[i]);
}
}
s->avctx->coded_frame = s->current_picture_ptr->f;
}
libavcodec/mpegvideo_enc.c:1401: error: Null Dereference
pointer `desc` last assigned on line 1400 could be null and is dereferenced at line 1401, column 22.
libavcodec/mpegvideo_enc.c:1393:1: start of procedure frame_end()
1391. }
1392.
1393. static void frame_end(MpegEncContext *s)
^
1394. {
1395. int i;
libavcodec/mpegvideo_enc.c:1397:9: Taking true branch
1395. int i;
1396.
1397. if (s->unrestricted_mv &&
^
1398. s->current_picture.reference &&
1399. !s->intra_only) {
libavcodec/mpegvideo_enc.c:1398:9: Taking true branch
1396.
1397. if (s->unrestricted_mv &&
1398. s->current_picture.reference &&
^
1399. !s->intra_only) {
1400. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
libavcodec/mpegvideo_enc.c:1399:10: Taking true branch
1397. if (s->unrestricted_mv &&
1398. s->current_picture.reference &&
1399. !s->intra_only) {
^
1400. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
1401. int hshift = desc->log2_chroma_w;
libavcodec/mpegvideo_enc.c:1400:9:
1398. s->current_picture.reference &&
1399. !s->intra_only) {
1400. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
^
1401. int hshift = desc->log2_chroma_w;
1402. int vshift = desc->log2_chroma_h;
libavutil/pixdesc.c:1599:1: start of procedure av_pix_fmt_desc_get()
1597. }
1598.
1599. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
^
1600. {
1601. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
libavutil/pixdesc.c:1601:9: Taking false branch
1599. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1600. {
1601. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
^
1602. return NULL;
1603. return &av_pix_fmt_descriptors[pix_fmt];
libavutil/pixdesc.c:1601:24: Taking true branch
1599. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1600. {
1601. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
^
1602. return NULL;
1603. return &av_pix_fmt_descriptors[pix_fmt];
libavutil/pixdesc.c:1602:9:
1600. {
1601. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
1602. return NULL;
^
1603. return &av_pix_fmt_descriptors[pix_fmt];
1604. }
libavutil/pixdesc.c:1604:1: return from a call to av_pix_fmt_desc_get
1602. return NULL;
1603. return &av_pix_fmt_descriptors[pix_fmt];
1604. }
^
1605.
1606. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
libavcodec/mpegvideo_enc.c:1401:9:
1399. !s->intra_only) {
1400. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
1401. int hshift = desc->log2_chroma_w;
^
1402. int vshift = desc->log2_chroma_h;
1403. s->mpvencdsp.draw_edges(s->current_picture.f->data[0], s->linesize,
|
https://github.com/libav/libav/blob/b16699f2da9c1d41eff852ec3a0c81f74fd44421/libavcodec/mpegvideo_enc.c/#L1401
|
d2a_code_trace_data_42727
|
static ossl_inline size_t constant_time_is_zero_s(size_t a)
{
return constant_time_msb_s(~a & (a - 1));
}
include/internal/constant_time_locl.h:325: error: INTEGER_OVERFLOW_L2
([0, `idx`] - 1):unsigned64 by call to `constant_time_is_zero_s`.
Showing all 5 steps of the trace
include/internal/constant_time_locl.h:310:1: Parameter `idx`
308. * private.
309. */
310. > static ossl_inline void constant_time_lookup(void *out,
311. const void *table,
312. size_t rowsize,
include/internal/constant_time_locl.h:325:31: Call
323. /* Note idx may underflow - but that is well defined */
324. for (i = 0; i < numrows; i++, idx--) {
325. mask = (unsigned char)constant_time_is_zero_s(idx);
^
326. for (j = 0; j < rowsize; j++)
327. *(outc + j) |= constant_time_select_8(mask, *(tablec++), 0);
include/internal/constant_time_locl.h:173:1: <LHS trace>
171. }
172.
173. > static ossl_inline size_t constant_time_is_zero_s(size_t a)
174. {
175. return constant_time_msb_s(~a & (a - 1));
include/internal/constant_time_locl.h:173:1: Parameter `a`
171. }
172.
173. > static ossl_inline size_t constant_time_is_zero_s(size_t a)
174. {
175. return constant_time_msb_s(~a & (a - 1));
include/internal/constant_time_locl.h:175:12: Binary operation: ([0, idx] - 1):unsigned64 by call to `constant_time_is_zero_s`
173. static ossl_inline size_t constant_time_is_zero_s(size_t a)
174. {
175. return constant_time_msb_s(~a & (a - 1));
^
176. }
177.
|
https://github.com/openssl/openssl/blob/a7232276fef30a63070fd9dbb53d3820d3761d5b/include/internal/constant_time_locl.h/#L175
|
d2a_code_trace_data_42728
|
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: Buffer Overrun L3
Offset: [-1, +oo] Size: 1024.
libavformat/img2.c:245:1: <Offset 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:245:1: <Length 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: Array access: Offset: [-1, +oo] Size: 1024
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_42729
|
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:1099: error: Uninitialized Value
The value read from ymax was never initialized.
libavcodec/motion_est_template.c:1099:17:
1097.
1098. if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue;
1099. CHECK_MV(mx,my)
^
1100. }
1101. }
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1099
|
d2a_code_trace_data_42730
|
ngx_int_t
ngx_http_set_exten(ngx_http_request_t *r)
{
ngx_int_t i;
r->exten.len = 0;
r->exten.data = NULL;
for (i = r->uri.len - 1; i > 1; i--) {
if (r->uri.data[i] == '.' && r->uri.data[i - 1] != '/') {
r->exten.len = r->uri.len - i - 1;
r->exten.data = &r->uri.data[i + 1];
break;
} else if (r->uri.data[i] == '/') {
break;
}
}
return NGX_OK;
}
src/http/ngx_http_core_module.c:2114: error: Integer Overflow L2
([0, +oo] - 1):unsigned64 by call to `ngx_http_set_exten`.
src/http/ngx_http_core_module.c:2114:9: Call
2112. sr->http_protocol = r->http_protocol;
2113.
2114. if (ngx_http_set_exten(sr) != NGX_OK) {
^
2115. return NGX_ERROR;
2116. }
src/http/ngx_http_core_module.c:1614:1: <LHS trace>
1612.
1613.
1614. ngx_int_t
^
1615. ngx_http_set_exten(ngx_http_request_t *r)
1616. {
src/http/ngx_http_core_module.c:1614:1: Parameter `r->uri.len`
1612.
1613.
1614. ngx_int_t
^
1615. ngx_http_set_exten(ngx_http_request_t *r)
1616. {
src/http/ngx_http_core_module.c:1622:10: Binary operation: ([0, +oo] - 1):unsigned64 by call to `ngx_http_set_exten`
1620. r->exten.data = NULL;
1621.
1622. for (i = r->uri.len - 1; i > 1; i--) {
^
1623. if (r->uri.data[i] == '.' && r->uri.data[i - 1] != '/') {
1624.
|
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/http/ngx_http_core_module.c/#L1622
|
d2a_code_trace_data_42731
|
struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i)
{
CRYPTO_dynlock *pointer = NULL;
if (i)
i = -i - 1;
CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK);
if (dyn_locks != NULL && i < sk_CRYPTO_dynlock_num(dyn_locks))
pointer = sk_CRYPTO_dynlock_value(dyn_locks, i);
if (pointer)
pointer->references++;
CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
if (pointer)
return pointer->data;
return NULL;
}
crypto/lock.c:491: error: USE_AFTER_FREE
call to `CRYPTO_lock()` eventually accesses memory that was invalidated by call to `free()` on line 477 indirectly during the call to `CRYPTO_lock()`.
Showing all 22 steps of the trace
crypto/lock.c:477:9: invalidation part of the trace starts here
475. #endif
476. } else {
477. CRYPTO_lock(CRYPTO_LOCK | CRYPTO_WRITE, type, file, line);
^
478.
479. ret = *pointer + amount;
crypto/lock.c:477:9: global variable `dyn_locks` accessed here
475. #endif
476. } else {
477. CRYPTO_lock(CRYPTO_LOCK | CRYPTO_WRITE, type, file, line);
^
478.
479. ret = *pointer + amount;
crypto/lock.c:477:9: when calling `CRYPTO_lock` here
475. #endif
476. } else {
477. CRYPTO_lock(CRYPTO_LOCK | CRYPTO_WRITE, type, file, line);
^
478.
479. ret = *pointer + amount;
crypto/lock.c:444:19: global variable `dyn_locks` accessed here
442. if (dynlock_lock_callback != NULL) {
443. struct CRYPTO_dynlock_value *pointer
444. = CRYPTO_get_dynlock_value(type);
^
445.
446. OPENSSL_assert(pointer != NULL);
crypto/lock.c:450:13: when calling `CRYPTO_destroy_dynlockid` here
448. dynlock_lock_callback(mode, pointer, file, line);
449.
450. CRYPTO_destroy_dynlockid(type);
^
451. }
452. } else if (locking_callback != NULL)
crypto/lock.c:301:9: global variable `dyn_locks` accessed here
299. CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK);
300.
301. if (dyn_locks == NULL || i >= sk_CRYPTO_dynlock_num(dyn_locks)) {
^
302. CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
303. return;
crypto/lock.c:305:15: passed as argument to `sk_CRYPTO_dynlock_value`
303. return;
304. }
305. pointer = sk_CRYPTO_dynlock_value(dyn_locks, i);
^
306. if (pointer != NULL) {
307. --pointer->references;
crypto/lock.c:305:15: return from call to `sk_CRYPTO_dynlock_value`
303. return;
304. }
305. pointer = sk_CRYPTO_dynlock_value(dyn_locks, i);
^
306. if (pointer != NULL) {
307. --pointer->references;
crypto/lock.c:305:5: assigned
303. return;
304. }
305. pointer = sk_CRYPTO_dynlock_value(dyn_locks, i);
^
306. if (pointer != NULL) {
307. --pointer->references;
crypto/lock.c:323:9: when calling `CRYPTO_free` here
321. if (pointer) {
322. dynlock_destroy_callback(pointer->data, __FILE__, __LINE__);
323. OPENSSL_free(pointer);
^
324. }
325. }
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/lock.c:477:9: use-after-lifetime part of the trace starts here
475. #endif
476. } else {
477. CRYPTO_lock(CRYPTO_LOCK | CRYPTO_WRITE, type, file, line);
^
478.
479. ret = *pointer + amount;
crypto/lock.c:477:9: global variable `dyn_locks` accessed here
475. #endif
476. } else {
477. CRYPTO_lock(CRYPTO_LOCK | CRYPTO_WRITE, type, file, line);
^
478.
479. ret = *pointer + amount;
crypto/lock.c:491:9: when calling `CRYPTO_lock` here
489. #endif
490. *pointer = ret;
491. CRYPTO_lock(CRYPTO_UNLOCK | CRYPTO_WRITE, type, file, line);
^
492. }
493. return (ret);
crypto/lock.c:444:19: global variable `dyn_locks` accessed here
442. if (dynlock_lock_callback != NULL) {
443. struct CRYPTO_dynlock_value *pointer
444. = CRYPTO_get_dynlock_value(type);
^
445.
446. OPENSSL_assert(pointer != NULL);
crypto/lock.c:444:19: when calling `CRYPTO_get_dynlock_value` here
442. if (dynlock_lock_callback != NULL) {
443. struct CRYPTO_dynlock_value *pointer
444. = CRYPTO_get_dynlock_value(type);
^
445.
446. OPENSSL_assert(pointer != NULL);
crypto/lock.c:335:9: global variable `dyn_locks` accessed here
333. CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK);
334.
335. if (dyn_locks != NULL && i < sk_CRYPTO_dynlock_num(dyn_locks))
^
336. pointer = sk_CRYPTO_dynlock_value(dyn_locks, i);
337. if (pointer)
crypto/lock.c:336:19: passed as argument to `sk_CRYPTO_dynlock_value`
334.
335. if (dyn_locks != NULL && i < sk_CRYPTO_dynlock_num(dyn_locks))
336. pointer = sk_CRYPTO_dynlock_value(dyn_locks, i);
^
337. if (pointer)
338. pointer->references++;
crypto/lock.c:336:19: return from call to `sk_CRYPTO_dynlock_value`
334.
335. if (dyn_locks != NULL && i < sk_CRYPTO_dynlock_num(dyn_locks))
336. pointer = sk_CRYPTO_dynlock_value(dyn_locks, i);
^
337. if (pointer)
338. pointer->references++;
crypto/lock.c:336:9: assigned
334.
335. if (dyn_locks != NULL && i < sk_CRYPTO_dynlock_num(dyn_locks))
336. pointer = sk_CRYPTO_dynlock_value(dyn_locks, i);
^
337. if (pointer)
338. pointer->references++;
crypto/lock.c:343:16: invalid access occurs here
341.
342. if (pointer)
343. return pointer->data;
^
344. return NULL;
345. }
|
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/lock.c/#L343
|
d2a_code_trace_data_42732
|
int i2d_ASN1_SET(STACK *a, unsigned char **pp, int (*func)(), int ex_tag,
int ex_class, int is_set)
{
int ret=0,r;
int i;
unsigned char *p;
unsigned char *pStart, *pTempMem;
MYBLOB *rgSetBlob;
int totSize;
if (a == NULL) return(0);
for (i=sk_num(a)-1; i>=0; i--)
ret+=func(sk_value(a,i),NULL);
r=ASN1_object_size(1,ret,ex_tag);
if (pp == NULL) return(r);
p= *pp;
ASN1_put_object(&p,1,ret,ex_tag,ex_class);
if(!is_set || (sk_num(a) < 2))
{
for (i=0; i<sk_num(a); i++)
func(sk_value(a,i),&p);
*pp=p;
return(r);
}
pStart = p;
rgSetBlob = (MYBLOB *)Malloc( sk_num(a) * sizeof(MYBLOB));
for (i=0; i<sk_num(a); i++)
{
rgSetBlob[i].pbData = p;
func(sk_value(a,i),&p);
rgSetBlob[i].cbData = p - rgSetBlob[i].pbData;
}
*pp=p;
totSize = p - pStart;
qsort( rgSetBlob, sk_num(a), sizeof(MYBLOB), SetBlobCmp);
pTempMem = Malloc(totSize);
p = pTempMem;
for(i=0; i<sk_num(a); ++i)
{
memcpy(p, rgSetBlob[i].pbData, rgSetBlob[i].cbData);
p += rgSetBlob[i].cbData;
}
memcpy(pStart, pTempMem, totSize);
Free(pTempMem);
Free(rgSetBlob);
return(r);
}
crypto/pkcs7/pk7_smime.c:129: error: BUFFER_OVERRUN_L3
Offset: [0, 4] Size: [0, 5] by call to `PKCS7_add_attrib_smimecap`.
Showing all 24 steps of the trace
crypto/pkcs7/pk7_smime.c:112:16: Call
110. V_ASN1_OBJECT, OBJ_nid2obj(NID_pkcs7_data));
111. /* Add SMIMECapabilities */
112. if(!(smcap = sk_new(NULL))) {
^
113. PKCS7err(PKCS7_F_PKCS7_SIGN,ERR_R_MALLOC_FAILURE);
114. return NULL;
crypto/stack/stack.c:125:2: Assignment
123. ret->comp=c;
124. ret->num_alloc=MIN_NODES;
125. ret->num=0;
^
126. ret->sorted=0;
127. return(ret);
crypto/pkcs7/pk7_smime.c:117:3: Call
115. }
116. #ifndef NO_DES
117. PKCS7_simple_smimecap (smcap, NID_des_ede3_cbc, -1);
^
118. #endif
119. #ifndef NO_RC2
crypto/pkcs7/pk7_attr.c:57:1: Parameter `sk->num`
55.
56. /* Basic smime-capabilities OID and optional integer arg */
57. > int PKCS7_simple_smimecap(STACK *sk, int nid, int arg)
58. {
59. X509_ALGOR *alg;
crypto/pkcs7/pk7_smime.c:120:3: Call
118. #endif
119. #ifndef NO_RC2
120. PKCS7_simple_smimecap (smcap, NID_rc2_cbc, 128);
^
121. PKCS7_simple_smimecap (smcap, NID_rc2_cbc, 64);
122. #endif
crypto/pkcs7/pk7_attr.c:57:1: Parameter `sk->num`
55.
56. /* Basic smime-capabilities OID and optional integer arg */
57. > int PKCS7_simple_smimecap(STACK *sk, int nid, int arg)
58. {
59. X509_ALGOR *alg;
crypto/pkcs7/pk7_smime.c:121:3: Call
119. #ifndef NO_RC2
120. PKCS7_simple_smimecap (smcap, NID_rc2_cbc, 128);
121. PKCS7_simple_smimecap (smcap, NID_rc2_cbc, 64);
^
122. #endif
123. #ifndef NO_DES
crypto/pkcs7/pk7_attr.c:57:1: Parameter `sk->num`
55.
56. /* Basic smime-capabilities OID and optional integer arg */
57. > int PKCS7_simple_smimecap(STACK *sk, int nid, int arg)
58. {
59. X509_ALGOR *alg;
crypto/pkcs7/pk7_smime.c:124:3: Call
122. #endif
123. #ifndef NO_DES
124. PKCS7_simple_smimecap (smcap, NID_des_cbc, -1);
^
125. #endif
126. #ifndef NO_RC2
crypto/pkcs7/pk7_attr.c:57:1: Parameter `sk->num`
55.
56. /* Basic smime-capabilities OID and optional integer arg */
57. > int PKCS7_simple_smimecap(STACK *sk, int nid, int arg)
58. {
59. X509_ALGOR *alg;
crypto/pkcs7/pk7_smime.c:127:3: Call
125. #endif
126. #ifndef NO_RC2
127. PKCS7_simple_smimecap (smcap, NID_rc2_cbc, 40);
^
128. #endif
129. PKCS7_add_attrib_smimecap (si, smcap);
crypto/pkcs7/pk7_attr.c:57:1: Parameter `sk->num`
55.
56. /* Basic smime-capabilities OID and optional integer arg */
57. > int PKCS7_simple_smimecap(STACK *sk, int nid, int arg)
58. {
59. X509_ALGOR *alg;
crypto/pkcs7/pk7_smime.c:129:3: Call
127. PKCS7_simple_smimecap (smcap, NID_rc2_cbc, 40);
128. #endif
129. PKCS7_add_attrib_smimecap (si, smcap);
^
130. sk_pop_free(smcap, X509_ALGOR_free);
131. }
crypto/pkcs7/pk7_attr.c:17:1: Parameter `cap->num`
15. #include <openssl/err.h>
16.
17. > int PKCS7_add_attrib_smimecap(PKCS7_SIGNER_INFO *si, STACK *cap)
18. {
19. ASN1_STRING *seq;
crypto/pkcs7/pk7_attr.c:22:6: Call
20. unsigned char *p, *pp;
21. int len;
22. len=i2d_ASN1_SET(cap,NULL,i2d_X509_ALGOR, V_ASN1_SEQUENCE,
^
23. V_ASN1_UNIVERSAL, IS_SEQUENCE);
24. if(!(pp=(unsigned char *)Malloc(len))) {
crypto/asn1/a_set.c:122:14: <Offset trace>
120. we will store the SET blobs */
121.
122. for (i=0; i<sk_num(a); i++)
^
123. {
124. rgSetBlob[i].pbData = p; /* catch each set encode blob */
crypto/asn1/a_set.c:122:14: Assignment
120. we will store the SET blobs */
121.
122. for (i=0; i<sk_num(a); i++)
^
123. {
124. rgSetBlob[i].pbData = p; /* catch each set encode blob */
crypto/asn1/a_set.c:86:1: <Length trace>
84.
85. /* int is_set: if TRUE, then sort the contents (i.e. it isn't a SEQUENCE) */
86. > int i2d_ASN1_SET(STACK *a, unsigned char **pp, int (*func)(), int ex_tag,
87. int ex_class, int is_set)
88. {
crypto/asn1/a_set.c:86:1: Parameter `a->num`
84.
85. /* int is_set: if TRUE, then sort the contents (i.e. it isn't a SEQUENCE) */
86. > int i2d_ASN1_SET(STACK *a, unsigned char **pp, int (*func)(), int ex_tag,
87. int ex_class, int is_set)
88. {
crypto/asn1/a_set.c:119:39: Call
117.
118. pStart = p; /* Catch the beg of Setblobs*/
119. rgSetBlob = (MYBLOB *)Malloc( sk_num(a) * sizeof(MYBLOB)); /* In this array
^
120. we will store the SET blobs */
121.
crypto/stack/stack.c:285:17: Assignment
283. int sk_num(STACK *st)
284. {
285. if(st == NULL) return -1;
^
286. return st->num;
287. }
crypto/asn1/a_set.c:119:31: Array declaration
117.
118. pStart = p; /* Catch the beg of Setblobs*/
119. rgSetBlob = (MYBLOB *)Malloc( sk_num(a) * sizeof(MYBLOB)); /* In this array
^
120. we will store the SET blobs */
121.
crypto/asn1/a_set.c:119:9: Assignment
117.
118. pStart = p; /* Catch the beg of Setblobs*/
119. rgSetBlob = (MYBLOB *)Malloc( sk_num(a) * sizeof(MYBLOB)); /* In this array
^
120. we will store the SET blobs */
121.
crypto/asn1/a_set.c:124:17: Array access: Offset: [0, 4] Size: [0, 5] by call to `PKCS7_add_attrib_smimecap`
122. for (i=0; i<sk_num(a); i++)
123. {
124. rgSetBlob[i].pbData = p; /* catch each set encode blob */
^
125. func(sk_value(a,i),&p);
126. rgSetBlob[i].cbData = p - rgSetBlob[i].pbData; /* Length of this
|
https://github.com/openssl/openssl/blob/2449961ab2dc8e5b9f7349b32b1089824d244a9a/crypto/asn1/a_set.c/#L124
|
d2a_code_trace_data_42733
|
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/sm2/sm2_sign.c:108: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_mod_add`.
Showing all 26 steps of the trace
crypto/sm2/sm2_sign.c:102:13: Call
100. BN_priv_rand_range(k, order);
101.
102. if (EC_POINT_mul(group, kG, k, NULL, NULL, ctx) == 0)
^
103. goto done;
104.
crypto/ec/ec_lib.c:932:12: Call
930. scalars[0] = p_scalar;
931.
932. return EC_POINTs_mul(group, r, g_scalar,
^
933. (point != NULL
934. && p_scalar != NULL), points, scalars, ctx);
crypto/ec/ec_lib.c:910:1: Parameter `(*scalars)->top`
908. */
909.
910. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
911. size_t num, const EC_POINT *points[],
912. const BIGNUM *scalars[], BN_CTX *ctx)
crypto/sm2/sm2_sign.c:108:13: Call
106. goto done;
107.
108. if (BN_mod_add(r, e, x1, order, ctx) == 0)
^
109. goto done;
110.
crypto/bn/bn_mod.c:28:1: Parameter `r->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:31:10: Call
29. BN_CTX *ctx)
30. {
31. if (!BN_add(r, a, b))
^
32. return 0;
33. return BN_nnmod(r, r, m, ctx);
crypto/bn/bn_add.c:14:1: Parameter `r->top`
12.
13. /* r can == a or b */
14. > int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
15. {
16. int a_neg = a->neg, ret;
crypto/bn/bn_add.c:51:11: Call
49. }
50.
51. ret = BN_uadd(r, a, b);
^
52. r->neg = a_neg;
53. bn_check_top(r);
crypto/bn/bn_add.c:58:1: Parameter `r->top`
56.
57. /* unsigned add of b to a */
58. > int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
59. {
60. int max, min, dif;
crypto/bn/bn_add.c:78:9: Call
76. dif = max - min;
77.
78. if (bn_wexpand(r, max + 1) == NULL)
^
79. return 0;
80.
crypto/bn/bn_lib.c:910:1: Parameter `a->top`
908. }
909.
910. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
911. {
912. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_lib.c:912:37: Call
910. BIGNUM *bn_wexpand(BIGNUM *a, int words)
911. {
912. return (words <= a->dmax) ? a : bn_expand2(a, words);
^
913. }
914.
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_mod_add`
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/440bce8f813fa661437ce52378c3df38e2fd073b/crypto/bn/bn_lib.c/#L233
|
d2a_code_trace_data_42734
|
static void opt_vstats (void)
{
char filename[40];
time_t today2 = time(NULL);
struct tm *today = localtime(&today2);
snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
today->tm_sec);
opt_vstats_file(filename);
}
ffmpeg.c:4142: error: Null Dereference
pointer `today` last assigned on line 4140 could be null and is dereferenced at line 4142, column 69.
ffmpeg.c:4136:1: start of procedure opt_vstats()
4134. }
4135.
4136. static void opt_vstats (void)
^
4137. {
4138. char filename[40];
ffmpeg.c:4139:5:
4137. {
4138. char filename[40];
4139. time_t today2 = time(NULL);
^
4140. struct tm *today = localtime(&today2);
4141.
ffmpeg.c:4140:5:
4138. char filename[40];
4139. time_t today2 = time(NULL);
4140. struct tm *today = localtime(&today2);
^
4141.
4142. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
ffmpeg.c:4142:5:
4140. struct tm *today = localtime(&today2);
4141.
4142. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
^
4143. today->tm_sec);
4144. opt_vstats_file(filename);
|
https://github.com/libav/libav/blob/d0005d347d0831c904630fe70408c9fd4eec18e8/ffmpeg.c/#L4142
|
d2a_code_trace_data_42735
|
static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
{
unsigned char *buf = NULL;
int ret = 0, bit, bytes, mask;
time_t tim;
if (bits == 0) {
if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY)
goto toosmall;
BN_zero(rnd);
return 1;
}
if (bits < 0 || (bits == 1 && top > 0))
goto toosmall;
bytes = (bits + 7) / 8;
bit = (bits - 1) % 8;
mask = 0xff << (bit + 1);
buf = OPENSSL_malloc(bytes);
if (buf == NULL) {
BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE);
goto err;
}
time(&tim);
RAND_add(&tim, sizeof(tim), 0.0);
if (RAND_bytes(buf, bytes) <= 0)
goto err;
if (pseudorand == 2) {
int i;
unsigned char c;
for (i = 0; i < bytes; i++) {
if (RAND_bytes(&c, 1) <= 0)
goto err;
if (c >= 128 && i > 0)
buf[i] = buf[i - 1];
else if (c < 42)
buf[i] = 0;
else if (c < 84)
buf[i] = 255;
}
}
if (top >= 0) {
if (top) {
if (bit == 0) {
buf[0] = 1;
buf[1] |= 0x80;
} else {
buf[0] |= (3 << (bit - 1));
}
} else {
buf[0] |= (1 << bit);
}
}
buf[0] &= ~mask;
if (bottom)
buf[bytes - 1] |= 1;
if (!BN_bin2bn(buf, bytes, rnd))
goto err;
ret = 1;
err:
OPENSSL_clear_free(buf, bytes);
bn_check_top(rnd);
return (ret);
toosmall:
BNerr(BN_F_BNRAND, BN_R_BITS_TOO_SMALL);
return 0;
}
test/ectest.c:623: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_pseudo_rand`.
Showing all 14 steps of the trace
test/ectest.c:623:13: Call
621. || !TEST_int_eq(0, EC_POINT_cmp(group, P, R, ctx))
622. || !TEST_int_eq(0, EC_POINT_cmp(group, R, Q, ctx))
623. || !TEST_true(BN_pseudo_rand(y, BN_num_bits(y), 0, 0))
^
624. || !TEST_true(BN_add(z, z, y)))
625. goto err;
crypto/bn/bn_lib.c:167:9: Assignment
165.
166. if (BN_is_zero(a))
167. return 0;
^
168. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
169. }
test/ectest.c:623:13: Call
621. || !TEST_int_eq(0, EC_POINT_cmp(group, P, R, ctx))
622. || !TEST_int_eq(0, EC_POINT_cmp(group, R, Q, ctx))
623. || !TEST_true(BN_pseudo_rand(y, BN_num_bits(y), 0, 0))
^
624. || !TEST_true(BN_add(z, z, y)))
625. goto err;
crypto/bn/bn_rand.c:101:1: Parameter `bits`
99. }
100.
101. > int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom)
102. {
103. return bnrand(1, rnd, bits, top, bottom);
crypto/bn/bn_rand.c:103:12: Call
101. int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom)
102. {
103. return bnrand(1, rnd, bits, top, bottom);
^
104. }
105.
crypto/bn/bn_rand.c:56:14: <Offset trace>
54. unsigned char c;
55.
56. for (i = 0; i < bytes; i++) {
^
57. if (RAND_bytes(&c, 1) <= 0)
58. goto err;
crypto/bn/bn_rand.c:56:14: Assignment
54. unsigned char c;
55.
56. for (i = 0; i < bytes; i++) {
^
57. if (RAND_bytes(&c, 1) <= 0)
58. goto err;
crypto/bn/bn_rand.c:17:1: <Length trace>
15. #include <openssl/sha.h>
16.
17. > static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
18. {
19. unsigned char *buf = NULL;
crypto/bn/bn_rand.c:17:1: Parameter `bits`
15. #include <openssl/sha.h>
16.
17. > static int bnrand(int pseudorand, BIGNUM *rnd, int bits, int top, int bottom)
18. {
19. unsigned char *buf = NULL;
crypto/bn/bn_rand.c:32:5: Assignment
30. goto toosmall;
31.
32. bytes = (bits + 7) / 8;
^
33. bit = (bits - 1) % 8;
34. mask = 0xff << (bit + 1);
crypto/bn/bn_rand.c:36:11: Call
34. mask = 0xff << (bit + 1);
35.
36. buf = OPENSSL_malloc(bytes);
^
37. if (buf == NULL) {
38. BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE);
crypto/mem.c:166:9: Assignment
164.
165. if (num == 0)
166. return NULL;
^
167.
168. FAILTEST();
crypto/bn/bn_rand.c:36:5: Assignment
34. mask = 0xff << (bit + 1);
35.
36. buf = OPENSSL_malloc(bytes);
^
37. if (buf == NULL) {
38. BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE);
crypto/bn/bn_rand.c:82:9: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_pseudo_rand`
80. buf[0] &= ~mask;
81. if (bottom) /* set bottom bit if requested */
82. buf[bytes - 1] |= 1;
^
83. if (!BN_bin2bn(buf, bytes, rnd))
84. goto err;
|
https://github.com/openssl/openssl/blob/7671342e550ed2de676b23c79d0e7f45a381c76e/crypto/bn/bn_rand.c/#L82
|
d2a_code_trace_data_42736
|
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
{
int i, j, max;
const BN_ULONG *ap;
BN_ULONG *rp;
max = n * 2;
ap = a;
rp = r;
rp[0] = rp[max - 1] = 0;
rp++;
j = n;
if (--j > 0) {
ap++;
rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
rp += 2;
}
for (i = n - 2; i > 0; i--) {
j--;
ap++;
rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]);
rp += 2;
}
bn_add_words(r, r, r, max);
bn_sqr_words(tmp, a, n);
bn_add_words(r, r, tmp, max);
}
crypto/dsa/dsa_ossl.c:81: error: BUFFER_OVERRUN_L3
Offset: [31, +oo] Size: [0, 8388607] by call to `dsa_sign_setup`.
Showing all 22 steps of the trace
crypto/dsa/dsa_ossl.c:49:1: Parameter `dsa->g->top`
47. }
48.
49. > static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
50. {
51. BIGNUM *kinv = NULL;
crypto/dsa/dsa_ossl.c:81:10: Call
79. goto err;
80. redo:
81. if (!dsa_sign_setup(dsa, ctx, &kinv, &ret->r, dgst, dlen))
^
82. goto err;
83.
crypto/dsa/dsa_ossl.c:133:1: Parameter `dsa->g->top`
131. }
132.
133. > static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in,
134. BIGNUM **kinvp, BIGNUM **rp,
135. const unsigned char *dgst, int dlen)
crypto/dsa/dsa_ossl.c:199:18: Call
197. goto err;
198. } else {
199. if (!BN_mod_exp_mont(r, dsa->g, k, dsa->p, ctx, dsa->method_mont_p))
^
200. goto err;
201. }
crypto/bn/bn_exp.c:300:1: Parameter `a->top`
298. }
299.
300. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
301. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
302. {
crypto/bn/bn_exp.c:312:16: Call
310.
311. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) {
312. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);
^
313. }
314.
crypto/bn/bn_exp.c:600:1: Parameter `a->top`
598. * http://www.daemonology.net/hyperthreading-considered-harmful/)
599. */
600. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
601. const BIGNUM *m, BN_CTX *ctx,
602. BN_MONT_CTX *in_mont)
crypto/bn/bn_exp.c:757:17: Call
755. if (!BN_to_montgomery(&am, &am, mont, ctx))
756. goto err;
757. } else if (!BN_to_montgomery(&am, a, mont, ctx))
^
758. goto err;
759.
crypto/bn/bn_lib.c:945:1: Parameter `a->top`
943. }
944.
945. > int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont,
946. BN_CTX *ctx)
947. {
crypto/bn/bn_lib.c:948:12: Call
946. BN_CTX *ctx)
947. {
948. return BN_mod_mul_montgomery(r, a, &(mont->RR), mont, ctx);
^
949. }
950.
crypto/bn/bn_mont.c:26:1: Parameter `a->top`
24. #endif
25.
26. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
27. BN_MONT_CTX *mont, BN_CTX *ctx)
28. {
crypto/bn/bn_mont.c:53:14: Call
51. bn_check_top(tmp);
52. if (a == b) {
53. if (!BN_sqr(tmp, a, ctx))
^
54. goto err;
55. } else {
crypto/bn/bn_sqr.c:17:1: Parameter `a->top`
15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96
16. */
17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
18. {
19. int max, al;
crypto/bn/bn_sqr.c:25:5: Assignment
23. bn_check_top(a);
24.
25. al = a->top;
^
26. if (al <= 0) {
27. r->top = 0;
crypto/bn/bn_sqr.c:74:17: Call
72. if (bn_wexpand(tmp, max) == NULL)
73. goto err;
74. bn_sqr_normal(rr->d, a->d, al, tmp->d);
^
75. }
76. }
crypto/bn/bn_sqr.c:104:1: <Offset trace>
102.
103. /* tmp must have 2*n words */
104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
105. {
106. int i, j, max;
crypto/bn/bn_sqr.c:104:1: Parameter `n`
102.
103. /* tmp must have 2*n words */
104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
105. {
106. int i, j, max;
crypto/bn/bn_sqr.c:110:5: Assignment
108. BN_ULONG *rp;
109.
110. max = n * 2;
^
111. ap = a;
112. rp = r;
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:113:13: Array access: Offset: [31, +oo] Size: [0, 8388607] by call to `dsa_sign_setup`
111. ap = a;
112. rp = r;
113. rp[0] = rp[max - 1] = 0;
^
114. rp++;
115. j = n;
|
https://github.com/openssl/openssl/blob/69588edbaa424beb71c6a9b1be416588232cb78c/crypto/bn/bn_sqr.c/#L113
|
d2a_code_trace_data_42737
|
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:629: error: MEMORY_LEAK
memory dynamically allocated by call to `BN_new()` at line 579, column 9 is not reachable after line 629, column 5.
Showing all 162 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)
test/bntest.c:629:5:
627. }
628. BN_free(a);
629. > BN_free(b);
630. BN_free(c);
631. BN_free(d);
crypto/bn/bn_lib.c:252:1: start of procedure BN_free()
250. }
251.
252. > void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
crypto/bn/bn_lib.c:254:9: Taking false branch
252. void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
^
255. return;
256. bn_check_top(a);
crypto/bn/bn_lib.c:257:10:
255. return;
256. bn_check_top(a);
257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
963. }
964.
965. > int BN_get_flags(const BIGNUM *b, int n)
966. {
967. return b->flags & n;
crypto/bn/bn_lib.c:967:5:
965. int BN_get_flags(const BIGNUM *b, int n)
966. {
967. > return b->flags & n;
968. }
969.
crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
966. {
967. return b->flags & n;
968. > }
969.
970. /* Populate a BN_GENCB structure with an "old"-style callback */
crypto/bn/bn_lib.c:257:10: Taking false branch
255. return;
256. bn_check_top(a);
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
^
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:259:9: Taking false branch
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
^
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:263:9:
261. else {
262. #if OPENSSL_API_COMPAT < 0x00908000L
263. > a->flags |= BN_FLG_FREE;
264. #endif
265. a->d = NULL;
crypto/bn/bn_lib.c:265:9:
263. a->flags |= BN_FLG_FREE;
264. #endif
265. > a->d = NULL;
266. }
267. }
crypto/bn/bn_lib.c:259:5:
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. > if (a->flags & BN_FLG_MALLOCED)
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:267:1: return from a call to BN_free
265. a->d = NULL;
266. }
267. > }
268.
269. void bn_init(BIGNUM *a)
|
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L629
|
d2a_code_trace_data_42738
|
int ff_yuv2rgb_c_init_tables(SwsContext *c, const int inv_table[4],
int fullRange, int brightness,
int contrast, int saturation)
{
const int isRgb = c->dstFormat == PIX_FMT_RGB32 ||
c->dstFormat == PIX_FMT_RGB32_1 ||
c->dstFormat == PIX_FMT_BGR24 ||
c->dstFormat == PIX_FMT_RGB565BE ||
c->dstFormat == PIX_FMT_RGB565LE ||
c->dstFormat == PIX_FMT_RGB555BE ||
c->dstFormat == PIX_FMT_RGB555LE ||
c->dstFormat == PIX_FMT_RGB444BE ||
c->dstFormat == PIX_FMT_RGB444LE ||
c->dstFormat == PIX_FMT_RGB8 ||
c->dstFormat == PIX_FMT_RGB4 ||
c->dstFormat == PIX_FMT_RGB4_BYTE ||
c->dstFormat == PIX_FMT_MONOBLACK;
const int isNotNe = c->dstFormat == PIX_FMT_NE(RGB565LE, RGB565BE) ||
c->dstFormat == PIX_FMT_NE(RGB555LE, RGB555BE) ||
c->dstFormat == PIX_FMT_NE(RGB444LE, RGB444BE) ||
c->dstFormat == PIX_FMT_NE(BGR565LE, BGR565BE) ||
c->dstFormat == PIX_FMT_NE(BGR555LE, BGR555BE) ||
c->dstFormat == PIX_FMT_NE(BGR444LE, BGR444BE);
const int bpp = c->dstFormatBpp;
uint8_t *y_table;
uint16_t *y_table16;
uint32_t *y_table32;
int i, base, rbase, gbase, bbase, abase, needAlpha;
const int yoffs = fullRange ? 384 : 326;
int64_t crv = inv_table[0];
int64_t cbu = inv_table[1];
int64_t cgu = -inv_table[2];
int64_t cgv = -inv_table[3];
int64_t cy = 1 << 16;
int64_t oy = 0;
int64_t yb = 0;
if (!fullRange) {
cy = (cy * 255) / 219;
oy = 16 << 16;
} else {
crv = (crv * 224) / 255;
cbu = (cbu * 224) / 255;
cgu = (cgu * 224) / 255;
cgv = (cgv * 224) / 255;
}
cy = (cy * contrast) >> 16;
crv = (crv * contrast * saturation) >> 32;
cbu = (cbu * contrast * saturation) >> 32;
cgu = (cgu * contrast * saturation) >> 32;
cgv = (cgv * contrast * saturation) >> 32;
oy -= 256 * brightness;
c->uOffset = 0x0400040004000400LL;
c->vOffset = 0x0400040004000400LL;
c->yCoeff = roundToInt16(cy * 8192) * 0x0001000100010001ULL;
c->vrCoeff = roundToInt16(crv * 8192) * 0x0001000100010001ULL;
c->ubCoeff = roundToInt16(cbu * 8192) * 0x0001000100010001ULL;
c->vgCoeff = roundToInt16(cgv * 8192) * 0x0001000100010001ULL;
c->ugCoeff = roundToInt16(cgu * 8192) * 0x0001000100010001ULL;
c->yOffset = roundToInt16(oy * 8) * 0x0001000100010001ULL;
c->yuv2rgb_y_coeff = (int16_t)roundToInt16(cy << 13);
c->yuv2rgb_y_offset = (int16_t)roundToInt16(oy << 9);
c->yuv2rgb_v2r_coeff = (int16_t)roundToInt16(crv << 13);
c->yuv2rgb_v2g_coeff = (int16_t)roundToInt16(cgv << 13);
c->yuv2rgb_u2g_coeff = (int16_t)roundToInt16(cgu << 13);
c->yuv2rgb_u2b_coeff = (int16_t)roundToInt16(cbu << 13);
crv = ((crv << 16) + 0x8000) / cy;
cbu = ((cbu << 16) + 0x8000) / cy;
cgu = ((cgu << 16) + 0x8000) / cy;
cgv = ((cgv << 16) + 0x8000) / cy;
av_free(c->yuvTable);
switch (bpp) {
case 1:
c->yuvTable = av_malloc(1024);
y_table = c->yuvTable;
yb = -(384 << 16) - oy;
for (i = 0; i < 1024 - 110; i++) {
y_table[i + 110] = av_clip_uint8((yb + 0x8000) >> 16) >> 7;
yb += cy;
}
fill_table(c->table_gU, 1, cgu, y_table + yoffs);
fill_gv_table(c->table_gV, 1, cgv);
break;
case 4:
case 4 | 128:
rbase = isRgb ? 3 : 0;
gbase = 1;
bbase = isRgb ? 0 : 3;
c->yuvTable = av_malloc(1024 * 3);
y_table = c->yuvTable;
yb = -(384 << 16) - oy;
for (i = 0; i < 1024 - 110; i++) {
int yval = av_clip_uint8((yb + 0x8000) >> 16);
y_table[i + 110] = (yval >> 7) << rbase;
y_table[i + 37 + 1024] = ((yval + 43) / 85) << gbase;
y_table[i + 110 + 2048] = (yval >> 7) << bbase;
yb += cy;
}
fill_table(c->table_rV, 1, crv, y_table + yoffs);
fill_table(c->table_gU, 1, cgu, y_table + yoffs + 1024);
fill_table(c->table_bU, 1, cbu, y_table + yoffs + 2048);
fill_gv_table(c->table_gV, 1, cgv);
break;
case 8:
rbase = isRgb ? 5 : 0;
gbase = isRgb ? 2 : 3;
bbase = isRgb ? 0 : 6;
c->yuvTable = av_malloc(1024 * 3);
y_table = c->yuvTable;
yb = -(384 << 16) - oy;
for (i = 0; i < 1024 - 38; i++) {
int yval = av_clip_uint8((yb + 0x8000) >> 16);
y_table[i + 16] = ((yval + 18) / 36) << rbase;
y_table[i + 16 + 1024] = ((yval + 18) / 36) << gbase;
y_table[i + 37 + 2048] = ((yval + 43) / 85) << bbase;
yb += cy;
}
fill_table(c->table_rV, 1, crv, y_table + yoffs);
fill_table(c->table_gU, 1, cgu, y_table + yoffs + 1024);
fill_table(c->table_bU, 1, cbu, y_table + yoffs + 2048);
fill_gv_table(c->table_gV, 1, cgv);
break;
case 12:
rbase = isRgb ? 8 : 0;
gbase = 4;
bbase = isRgb ? 0 : 8;
c->yuvTable = av_malloc(1024 * 3 * 2);
y_table16 = c->yuvTable;
yb = -(384 << 16) - oy;
for (i = 0; i < 1024; i++) {
uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16);
y_table16[i] = (yval >> 4) << rbase;
y_table16[i + 1024] = (yval >> 4) << gbase;
y_table16[i + 2048] = (yval >> 4) << bbase;
yb += cy;
}
if (isNotNe)
for (i = 0; i < 1024 * 3; i++)
y_table16[i] = av_bswap16(y_table16[i]);
fill_table(c->table_rV, 2, crv, y_table16 + yoffs);
fill_table(c->table_gU, 2, cgu, y_table16 + yoffs + 1024);
fill_table(c->table_bU, 2, cbu, y_table16 + yoffs + 2048);
fill_gv_table(c->table_gV, 2, cgv);
break;
case 15:
case 16:
rbase = isRgb ? bpp - 5 : 0;
gbase = 5;
bbase = isRgb ? 0 : (bpp - 5);
c->yuvTable = av_malloc(1024 * 3 * 2);
y_table16 = c->yuvTable;
yb = -(384 << 16) - oy;
for (i = 0; i < 1024; i++) {
uint8_t yval = av_clip_uint8((yb + 0x8000) >> 16);
y_table16[i] = (yval >> 3) << rbase;
y_table16[i + 1024] = (yval >> (18 - bpp)) << gbase;
y_table16[i + 2048] = (yval >> 3) << bbase;
yb += cy;
}
if (isNotNe)
for (i = 0; i < 1024 * 3; i++)
y_table16[i] = av_bswap16(y_table16[i]);
fill_table(c->table_rV, 2, crv, y_table16 + yoffs);
fill_table(c->table_gU, 2, cgu, y_table16 + yoffs + 1024);
fill_table(c->table_bU, 2, cbu, y_table16 + yoffs + 2048);
fill_gv_table(c->table_gV, 2, cgv);
break;
case 24:
case 48:
c->yuvTable = av_malloc(1024);
y_table = c->yuvTable;
yb = -(384 << 16) - oy;
for (i = 0; i < 1024; i++) {
y_table[i] = av_clip_uint8((yb + 0x8000) >> 16);
yb += cy;
}
fill_table(c->table_rV, 1, crv, y_table + yoffs);
fill_table(c->table_gU, 1, cgu, y_table + yoffs);
fill_table(c->table_bU, 1, cbu, y_table + yoffs);
fill_gv_table(c->table_gV, 1, cgv);
break;
case 32:
base = (c->dstFormat == PIX_FMT_RGB32_1 ||
c->dstFormat == PIX_FMT_BGR32_1) ? 8 : 0;
rbase = base + (isRgb ? 16 : 0);
gbase = base + 8;
bbase = base + (isRgb ? 0 : 16);
needAlpha = CONFIG_SWSCALE_ALPHA && isALPHA(c->srcFormat);
if (!needAlpha)
abase = (base + 24) & 31;
c->yuvTable = av_malloc(1024 * 3 * 4);
y_table32 = c->yuvTable;
yb = -(384 << 16) - oy;
for (i = 0; i < 1024; i++) {
unsigned yval = av_clip_uint8((yb + 0x8000) >> 16);
y_table32[i] = (yval << rbase) +
(needAlpha ? 0 : (255u << abase));
y_table32[i + 1024] = yval << gbase;
y_table32[i + 2048] = yval << bbase;
yb += cy;
}
fill_table(c->table_rV, 4, crv, y_table32 + yoffs);
fill_table(c->table_gU, 4, cgu, y_table32 + yoffs + 1024);
fill_table(c->table_bU, 4, cbu, y_table32 + yoffs + 2048);
fill_gv_table(c->table_gV, 4, cgv);
break;
default:
c->yuvTable = NULL;
av_log(c, AV_LOG_ERROR, "%ibpp not supported by yuv2rgb\n", bpp);
return -1;
}
return 0;
}
libswscale/yuv2rgb.c:841: error: Uninitialized Value
The value read from abase was never initialized.
libswscale/yuv2rgb.c:841:36:
839. unsigned yval = av_clip_uint8((yb + 0x8000) >> 16);
840. y_table32[i] = (yval << rbase) +
841. (needAlpha ? 0 : (255u << abase));
^
842. y_table32[i + 1024] = yval << gbase;
843. y_table32[i + 2048] = yval << bbase;
|
https://github.com/libav/libav/blob/0ad522afb3a3b3d22402ecb82dd4609f7655031b/libswscale/yuv2rgb.c/#L841
|
d2a_code_trace_data_42739
|
static int encode_thread(AVCodecContext *c, void *arg){
MpegEncContext *s= arg;
int mb_x, mb_y, pdif = 0;
int i, j;
MpegEncContext best_s, backup_s;
uint8_t bit_buf[2][MAX_MB_BYTES];
uint8_t bit_buf2[2][MAX_MB_BYTES];
uint8_t bit_buf_tex[2][MAX_MB_BYTES];
PutBitContext pb[2], pb2[2], tex_pb[2];
ff_check_alignment();
for(i=0; i<2; i++){
init_put_bits(&pb [i], bit_buf [i], MAX_MB_BYTES);
init_put_bits(&pb2 [i], bit_buf2 [i], MAX_MB_BYTES);
init_put_bits(&tex_pb[i], bit_buf_tex[i], MAX_MB_BYTES);
}
s->last_bits= put_bits_count(&s->pb);
s->mv_bits=0;
s->misc_bits=0;
s->i_tex_bits=0;
s->p_tex_bits=0;
s->i_count=0;
s->f_count=0;
s->b_count=0;
s->skip_count=0;
for(i=0; i<3; i++){
s->last_dc[i] = 128 << s->intra_dc_precision;
s->current_picture.error[i] = 0;
}
s->mb_skip_run = 0;
memset(s->last_mv, 0, sizeof(s->last_mv));
s->last_mv_dir = 0;
switch(s->codec_id){
case CODEC_ID_H263:
case CODEC_ID_H263P:
case CODEC_ID_FLV1:
if (ENABLE_H263_ENCODER || ENABLE_H263P_ENCODER || ENABLE_FLV_ENCODER)
s->gob_index = ff_h263_get_gob_height(s);
break;
case CODEC_ID_MPEG4:
if(ENABLE_MPEG4_ENCODER && s->partitioned_frame)
ff_mpeg4_init_partitions(s);
break;
}
s->resync_mb_x=0;
s->resync_mb_y=0;
s->first_slice_line = 1;
s->ptr_lastgob = s->pb.buf;
for(mb_y= s->start_mb_y; mb_y < s->end_mb_y; mb_y++) {
s->mb_x=0;
s->mb_y= mb_y;
ff_set_qscale(s, s->qscale);
ff_init_block_index(s);
for(mb_x=0; mb_x < s->mb_width; mb_x++) {
int xy= mb_y*s->mb_stride + mb_x;
int mb_type= s->mb_type[xy];
int dmin= INT_MAX;
int dir;
if(s->pb.buf_end - s->pb.buf - (put_bits_count(&s->pb)>>3) < MAX_MB_BYTES){
av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
return -1;
}
if(s->data_partitioning){
if( s->pb2 .buf_end - s->pb2 .buf - (put_bits_count(&s-> pb2)>>3) < MAX_MB_BYTES
|| s->tex_pb.buf_end - s->tex_pb.buf - (put_bits_count(&s->tex_pb )>>3) < MAX_MB_BYTES){
av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
return -1;
}
}
s->mb_x = mb_x;
s->mb_y = mb_y;
ff_update_block_index(s);
if(ENABLE_H261_ENCODER && s->codec_id == CODEC_ID_H261){
ff_h261_reorder_mb_index(s);
xy= s->mb_y*s->mb_stride + s->mb_x;
mb_type= s->mb_type[xy];
}
if(s->rtp_mode){
int current_packet_size, is_gob_start;
current_packet_size= ((put_bits_count(&s->pb)+7)>>3) - (s->ptr_lastgob - s->pb.buf);
is_gob_start= s->avctx->rtp_payload_size && current_packet_size >= s->avctx->rtp_payload_size && mb_y + mb_x>0;
if(s->start_mb_y == mb_y && mb_y > 0 && mb_x==0) is_gob_start=1;
switch(s->codec_id){
case CODEC_ID_H263:
case CODEC_ID_H263P:
if(!s->h263_slice_structured)
if(s->mb_x || s->mb_y%s->gob_index) is_gob_start=0;
break;
case CODEC_ID_MPEG2VIDEO:
if(s->mb_x==0 && s->mb_y!=0) is_gob_start=1;
case CODEC_ID_MPEG1VIDEO:
if(s->mb_skip_run) is_gob_start=0;
break;
}
if(is_gob_start){
if(s->start_mb_y != mb_y || mb_x!=0){
write_slice_end(s);
if(ENABLE_MPEG4_ENCODER && s->codec_id==CODEC_ID_MPEG4 && s->partitioned_frame){
ff_mpeg4_init_partitions(s);
}
}
assert((put_bits_count(&s->pb)&7) == 0);
current_packet_size= pbBufPtr(&s->pb) - s->ptr_lastgob;
if(s->avctx->error_rate && s->resync_mb_x + s->resync_mb_y > 0){
int r= put_bits_count(&s->pb)/8 + s->picture_number + 16 + s->mb_x + s->mb_y;
int d= 100 / s->avctx->error_rate;
if(r % d == 0){
current_packet_size=0;
#ifndef ALT_BITSTREAM_WRITER
s->pb.buf_ptr= s->ptr_lastgob;
#endif
assert(pbBufPtr(&s->pb) == s->ptr_lastgob);
}
}
if (s->avctx->rtp_callback){
int number_mb = (mb_y - s->resync_mb_y)*s->mb_width + mb_x - s->resync_mb_x;
s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, current_packet_size, number_mb);
}
switch(s->codec_id){
case CODEC_ID_MPEG4:
if (ENABLE_MPEG4_ENCODER) {
ff_mpeg4_encode_video_packet_header(s);
ff_mpeg4_clean_buffers(s);
}
break;
case CODEC_ID_MPEG1VIDEO:
case CODEC_ID_MPEG2VIDEO:
if (ENABLE_MPEG1VIDEO_ENCODER || ENABLE_MPEG2VIDEO_ENCODER) {
ff_mpeg1_encode_slice_header(s);
ff_mpeg1_clean_buffers(s);
}
break;
case CODEC_ID_H263:
case CODEC_ID_H263P:
if (ENABLE_H263_ENCODER || ENABLE_H263P_ENCODER)
h263_encode_gob_header(s, mb_y);
break;
}
if(s->flags&CODEC_FLAG_PASS1){
int bits= put_bits_count(&s->pb);
s->misc_bits+= bits - s->last_bits;
s->last_bits= bits;
}
s->ptr_lastgob += current_packet_size;
s->first_slice_line=1;
s->resync_mb_x=mb_x;
s->resync_mb_y=mb_y;
}
}
if( (s->resync_mb_x == s->mb_x)
&& s->resync_mb_y+1 == s->mb_y){
s->first_slice_line=0;
}
s->mb_skipped=0;
s->dquant=0;
if(mb_type & (mb_type-1) || (s->flags & CODEC_FLAG_QP_RD)){
int next_block=0;
int pb_bits_count, pb2_bits_count, tex_pb_bits_count;
copy_context_before_encode(&backup_s, s, -1);
backup_s.pb= s->pb;
best_s.data_partitioning= s->data_partitioning;
best_s.partitioned_frame= s->partitioned_frame;
if(s->data_partitioning){
backup_s.pb2= s->pb2;
backup_s.tex_pb= s->tex_pb;
}
if(mb_type&CANDIDATE_MB_TYPE_INTER){
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_16X16;
s->mb_intra= 0;
s->mv[0][0][0] = s->p_mv_table[xy][0];
s->mv[0][0][1] = s->p_mv_table[xy][1];
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER, pb, pb2, tex_pb,
&dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]);
}
if(mb_type&CANDIDATE_MB_TYPE_INTER_I){
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_FIELD;
s->mb_intra= 0;
for(i=0; i<2; i++){
j= s->field_select[0][i] = s->p_field_select_table[i][xy];
s->mv[0][i][0] = s->p_field_mv_table[i][j][xy][0];
s->mv[0][i][1] = s->p_field_mv_table[i][j][xy][1];
}
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER_I, pb, pb2, tex_pb,
&dmin, &next_block, 0, 0);
}
if(mb_type&CANDIDATE_MB_TYPE_SKIPPED){
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_16X16;
s->mb_intra= 0;
s->mv[0][0][0] = 0;
s->mv[0][0][1] = 0;
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_SKIPPED, pb, pb2, tex_pb,
&dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]);
}
if(mb_type&CANDIDATE_MB_TYPE_INTER4V){
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_8X8;
s->mb_intra= 0;
for(i=0; i<4; i++){
s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0];
s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1];
}
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER4V, pb, pb2, tex_pb,
&dmin, &next_block, 0, 0);
}
if(mb_type&CANDIDATE_MB_TYPE_FORWARD){
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_16X16;
s->mb_intra= 0;
s->mv[0][0][0] = s->b_forw_mv_table[xy][0];
s->mv[0][0][1] = s->b_forw_mv_table[xy][1];
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_FORWARD, pb, pb2, tex_pb,
&dmin, &next_block, s->mv[0][0][0], s->mv[0][0][1]);
}
if(mb_type&CANDIDATE_MB_TYPE_BACKWARD){
s->mv_dir = MV_DIR_BACKWARD;
s->mv_type = MV_TYPE_16X16;
s->mb_intra= 0;
s->mv[1][0][0] = s->b_back_mv_table[xy][0];
s->mv[1][0][1] = s->b_back_mv_table[xy][1];
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BACKWARD, pb, pb2, tex_pb,
&dmin, &next_block, s->mv[1][0][0], s->mv[1][0][1]);
}
if(mb_type&CANDIDATE_MB_TYPE_BIDIR){
s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD;
s->mv_type = MV_TYPE_16X16;
s->mb_intra= 0;
s->mv[0][0][0] = s->b_bidir_forw_mv_table[xy][0];
s->mv[0][0][1] = s->b_bidir_forw_mv_table[xy][1];
s->mv[1][0][0] = s->b_bidir_back_mv_table[xy][0];
s->mv[1][0][1] = s->b_bidir_back_mv_table[xy][1];
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BIDIR, pb, pb2, tex_pb,
&dmin, &next_block, 0, 0);
}
if(mb_type&CANDIDATE_MB_TYPE_FORWARD_I){
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_FIELD;
s->mb_intra= 0;
for(i=0; i<2; i++){
j= s->field_select[0][i] = s->b_field_select_table[0][i][xy];
s->mv[0][i][0] = s->b_field_mv_table[0][i][j][xy][0];
s->mv[0][i][1] = s->b_field_mv_table[0][i][j][xy][1];
}
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_FORWARD_I, pb, pb2, tex_pb,
&dmin, &next_block, 0, 0);
}
if(mb_type&CANDIDATE_MB_TYPE_BACKWARD_I){
s->mv_dir = MV_DIR_BACKWARD;
s->mv_type = MV_TYPE_FIELD;
s->mb_intra= 0;
for(i=0; i<2; i++){
j= s->field_select[1][i] = s->b_field_select_table[1][i][xy];
s->mv[1][i][0] = s->b_field_mv_table[1][i][j][xy][0];
s->mv[1][i][1] = s->b_field_mv_table[1][i][j][xy][1];
}
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BACKWARD_I, pb, pb2, tex_pb,
&dmin, &next_block, 0, 0);
}
if(mb_type&CANDIDATE_MB_TYPE_BIDIR_I){
s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD;
s->mv_type = MV_TYPE_FIELD;
s->mb_intra= 0;
for(dir=0; dir<2; dir++){
for(i=0; i<2; i++){
j= s->field_select[dir][i] = s->b_field_select_table[dir][i][xy];
s->mv[dir][i][0] = s->b_field_mv_table[dir][i][j][xy][0];
s->mv[dir][i][1] = s->b_field_mv_table[dir][i][j][xy][1];
}
}
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_BIDIR_I, pb, pb2, tex_pb,
&dmin, &next_block, 0, 0);
}
if(mb_type&CANDIDATE_MB_TYPE_INTRA){
s->mv_dir = 0;
s->mv_type = MV_TYPE_16X16;
s->mb_intra= 1;
s->mv[0][0][0] = 0;
s->mv[0][0][1] = 0;
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTRA, pb, pb2, tex_pb,
&dmin, &next_block, 0, 0);
if(s->h263_pred || s->h263_aic){
if(best_s.mb_intra)
s->mbintra_table[mb_x + mb_y*s->mb_stride]=1;
else
ff_clean_intra_table_entries(s);
}
}
if((s->flags & CODEC_FLAG_QP_RD) && dmin < INT_MAX){
if(best_s.mv_type==MV_TYPE_16X16){
const int last_qp= backup_s.qscale;
int qpi, qp, dc[6];
DCTELEM ac[6][16];
const int mvdir= (best_s.mv_dir&MV_DIR_BACKWARD) ? 1 : 0;
static const int dquant_tab[4]={-1,1,-2,2};
assert(backup_s.dquant == 0);
s->mv_dir= best_s.mv_dir;
s->mv_type = MV_TYPE_16X16;
s->mb_intra= best_s.mb_intra;
s->mv[0][0][0] = best_s.mv[0][0][0];
s->mv[0][0][1] = best_s.mv[0][0][1];
s->mv[1][0][0] = best_s.mv[1][0][0];
s->mv[1][0][1] = best_s.mv[1][0][1];
qpi = s->pict_type == FF_B_TYPE ? 2 : 0;
for(; qpi<4; qpi++){
int dquant= dquant_tab[qpi];
qp= last_qp + dquant;
if(qp < s->avctx->qmin || qp > s->avctx->qmax)
continue;
backup_s.dquant= dquant;
if(s->mb_intra && s->dc_val[0]){
for(i=0; i<6; i++){
dc[i]= s->dc_val[0][ s->block_index[i] ];
memcpy(ac[i], s->ac_val[0][s->block_index[i]], sizeof(DCTELEM)*16);
}
}
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER , pb, pb2, tex_pb,
&dmin, &next_block, s->mv[mvdir][0][0], s->mv[mvdir][0][1]);
if(best_s.qscale != qp){
if(s->mb_intra && s->dc_val[0]){
for(i=0; i<6; i++){
s->dc_val[0][ s->block_index[i] ]= dc[i];
memcpy(s->ac_val[0][s->block_index[i]], ac[i], sizeof(DCTELEM)*16);
}
}
}
}
}
}
if(ENABLE_MPEG4_ENCODER && mb_type&CANDIDATE_MB_TYPE_DIRECT){
int mx= s->b_direct_mv_table[xy][0];
int my= s->b_direct_mv_table[xy][1];
backup_s.dquant = 0;
s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT;
s->mb_intra= 0;
ff_mpeg4_set_direct_mv(s, mx, my);
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_DIRECT, pb, pb2, tex_pb,
&dmin, &next_block, mx, my);
}
if(ENABLE_MPEG4_ENCODER && mb_type&CANDIDATE_MB_TYPE_DIRECT0){
backup_s.dquant = 0;
s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD | MV_DIRECT;
s->mb_intra= 0;
ff_mpeg4_set_direct_mv(s, 0, 0);
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_DIRECT, pb, pb2, tex_pb,
&dmin, &next_block, 0, 0);
}
if(!best_s.mb_intra && s->flags2&CODEC_FLAG2_SKIP_RD){
int coded=0;
for(i=0; i<6; i++)
coded |= s->block_last_index[i];
if(coded){
int mx,my;
memcpy(s->mv, best_s.mv, sizeof(s->mv));
if(ENABLE_MPEG4_ENCODER && best_s.mv_dir & MV_DIRECT){
mx=my=0;
ff_mpeg4_set_direct_mv(s, mx, my);
}else if(best_s.mv_dir&MV_DIR_BACKWARD){
mx= s->mv[1][0][0];
my= s->mv[1][0][1];
}else{
mx= s->mv[0][0][0];
my= s->mv[0][0][1];
}
s->mv_dir= best_s.mv_dir;
s->mv_type = best_s.mv_type;
s->mb_intra= 0;
backup_s.dquant= 0;
s->skipdct=1;
encode_mb_hq(s, &backup_s, &best_s, CANDIDATE_MB_TYPE_INTER , pb, pb2, tex_pb,
&dmin, &next_block, mx, my);
s->skipdct=0;
}
}
s->current_picture.qscale_table[xy]= best_s.qscale;
copy_context_after_encode(s, &best_s, -1);
pb_bits_count= put_bits_count(&s->pb);
flush_put_bits(&s->pb);
ff_copy_bits(&backup_s.pb, bit_buf[next_block^1], pb_bits_count);
s->pb= backup_s.pb;
if(s->data_partitioning){
pb2_bits_count= put_bits_count(&s->pb2);
flush_put_bits(&s->pb2);
ff_copy_bits(&backup_s.pb2, bit_buf2[next_block^1], pb2_bits_count);
s->pb2= backup_s.pb2;
tex_pb_bits_count= put_bits_count(&s->tex_pb);
flush_put_bits(&s->tex_pb);
ff_copy_bits(&backup_s.tex_pb, bit_buf_tex[next_block^1], tex_pb_bits_count);
s->tex_pb= backup_s.tex_pb;
}
s->last_bits= put_bits_count(&s->pb);
if (ENABLE_ANY_H263_ENCODER &&
s->out_format == FMT_H263 && s->pict_type!=FF_B_TYPE)
ff_h263_update_motion_val(s);
if(next_block==0){
s->dsp.put_pixels_tab[0][0](s->dest[0], s->rd_scratchpad , s->linesize ,16);
s->dsp.put_pixels_tab[1][0](s->dest[1], s->rd_scratchpad + 16*s->linesize , s->uvlinesize, 8);
s->dsp.put_pixels_tab[1][0](s->dest[2], s->rd_scratchpad + 16*s->linesize + 8, s->uvlinesize, 8);
}
if(s->avctx->mb_decision == FF_MB_DECISION_BITS)
MPV_decode_mb(s, s->block);
} else {
int motion_x = 0, motion_y = 0;
s->mv_type=MV_TYPE_16X16;
switch(mb_type){
case CANDIDATE_MB_TYPE_INTRA:
s->mv_dir = 0;
s->mb_intra= 1;
motion_x= s->mv[0][0][0] = 0;
motion_y= s->mv[0][0][1] = 0;
break;
case CANDIDATE_MB_TYPE_INTER:
s->mv_dir = MV_DIR_FORWARD;
s->mb_intra= 0;
motion_x= s->mv[0][0][0] = s->p_mv_table[xy][0];
motion_y= s->mv[0][0][1] = s->p_mv_table[xy][1];
break;
case CANDIDATE_MB_TYPE_INTER_I:
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_FIELD;
s->mb_intra= 0;
for(i=0; i<2; i++){
j= s->field_select[0][i] = s->p_field_select_table[i][xy];
s->mv[0][i][0] = s->p_field_mv_table[i][j][xy][0];
s->mv[0][i][1] = s->p_field_mv_table[i][j][xy][1];
}
break;
case CANDIDATE_MB_TYPE_INTER4V:
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_8X8;
s->mb_intra= 0;
for(i=0; i<4; i++){
s->mv[0][i][0] = s->current_picture.motion_val[0][s->block_index[i]][0];
s->mv[0][i][1] = s->current_picture.motion_val[0][s->block_index[i]][1];
}
break;
case CANDIDATE_MB_TYPE_DIRECT:
if (ENABLE_MPEG4_ENCODER) {
s->mv_dir = MV_DIR_FORWARD|MV_DIR_BACKWARD|MV_DIRECT;
s->mb_intra= 0;
motion_x=s->b_direct_mv_table[xy][0];
motion_y=s->b_direct_mv_table[xy][1];
ff_mpeg4_set_direct_mv(s, motion_x, motion_y);
}
break;
case CANDIDATE_MB_TYPE_DIRECT0:
if (ENABLE_MPEG4_ENCODER) {
s->mv_dir = MV_DIR_FORWARD|MV_DIR_BACKWARD|MV_DIRECT;
s->mb_intra= 0;
ff_mpeg4_set_direct_mv(s, 0, 0);
}
break;
case CANDIDATE_MB_TYPE_BIDIR:
s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD;
s->mb_intra= 0;
s->mv[0][0][0] = s->b_bidir_forw_mv_table[xy][0];
s->mv[0][0][1] = s->b_bidir_forw_mv_table[xy][1];
s->mv[1][0][0] = s->b_bidir_back_mv_table[xy][0];
s->mv[1][0][1] = s->b_bidir_back_mv_table[xy][1];
break;
case CANDIDATE_MB_TYPE_BACKWARD:
s->mv_dir = MV_DIR_BACKWARD;
s->mb_intra= 0;
motion_x= s->mv[1][0][0] = s->b_back_mv_table[xy][0];
motion_y= s->mv[1][0][1] = s->b_back_mv_table[xy][1];
break;
case CANDIDATE_MB_TYPE_FORWARD:
s->mv_dir = MV_DIR_FORWARD;
s->mb_intra= 0;
motion_x= s->mv[0][0][0] = s->b_forw_mv_table[xy][0];
motion_y= s->mv[0][0][1] = s->b_forw_mv_table[xy][1];
break;
case CANDIDATE_MB_TYPE_FORWARD_I:
s->mv_dir = MV_DIR_FORWARD;
s->mv_type = MV_TYPE_FIELD;
s->mb_intra= 0;
for(i=0; i<2; i++){
j= s->field_select[0][i] = s->b_field_select_table[0][i][xy];
s->mv[0][i][0] = s->b_field_mv_table[0][i][j][xy][0];
s->mv[0][i][1] = s->b_field_mv_table[0][i][j][xy][1];
}
break;
case CANDIDATE_MB_TYPE_BACKWARD_I:
s->mv_dir = MV_DIR_BACKWARD;
s->mv_type = MV_TYPE_FIELD;
s->mb_intra= 0;
for(i=0; i<2; i++){
j= s->field_select[1][i] = s->b_field_select_table[1][i][xy];
s->mv[1][i][0] = s->b_field_mv_table[1][i][j][xy][0];
s->mv[1][i][1] = s->b_field_mv_table[1][i][j][xy][1];
}
break;
case CANDIDATE_MB_TYPE_BIDIR_I:
s->mv_dir = MV_DIR_FORWARD | MV_DIR_BACKWARD;
s->mv_type = MV_TYPE_FIELD;
s->mb_intra= 0;
for(dir=0; dir<2; dir++){
for(i=0; i<2; i++){
j= s->field_select[dir][i] = s->b_field_select_table[dir][i][xy];
s->mv[dir][i][0] = s->b_field_mv_table[dir][i][j][xy][0];
s->mv[dir][i][1] = s->b_field_mv_table[dir][i][j][xy][1];
}
}
break;
default:
av_log(s->avctx, AV_LOG_ERROR, "illegal MB type\n");
}
encode_mb(s, motion_x, motion_y);
s->last_mv_dir = s->mv_dir;
if (ENABLE_ANY_H263_ENCODER &&
s->out_format == FMT_H263 && s->pict_type!=FF_B_TYPE)
ff_h263_update_motion_val(s);
MPV_decode_mb(s, s->block);
}
if(s->mb_intra ){
s->p_mv_table[xy][0]=0;
s->p_mv_table[xy][1]=0;
}
if(s->flags&CODEC_FLAG_PSNR){
int w= 16;
int h= 16;
if(s->mb_x*16 + 16 > s->width ) w= s->width - s->mb_x*16;
if(s->mb_y*16 + 16 > s->height) h= s->height- s->mb_y*16;
s->current_picture.error[0] += sse(
s, s->new_picture.data[0] + s->mb_x*16 + s->mb_y*s->linesize*16,
s->dest[0], w, h, s->linesize);
s->current_picture.error[1] += sse(
s, s->new_picture.data[1] + s->mb_x*8 + s->mb_y*s->uvlinesize*8,
s->dest[1], w>>1, h>>1, s->uvlinesize);
s->current_picture.error[2] += sse(
s, s->new_picture .data[2] + s->mb_x*8 + s->mb_y*s->uvlinesize*8,
s->dest[2], w>>1, h>>1, s->uvlinesize);
}
if(s->loop_filter){
if(ENABLE_ANY_H263_ENCODER && s->out_format == FMT_H263)
ff_h263_loop_filter(s);
}
}
}
if (ENABLE_MSMPEG4_ENCODER && s->msmpeg4_version && s->msmpeg4_version<4 && s->pict_type == FF_I_TYPE)
msmpeg4_encode_ext_header(s);
write_slice_end(s);
if (s->avctx->rtp_callback) {
int number_mb = (mb_y - s->resync_mb_y)*s->mb_width - s->resync_mb_x;
pdif = pbBufPtr(&s->pb) - s->ptr_lastgob;
emms_c();
s->avctx->rtp_callback(s->avctx, s->ptr_lastgob, pdif, number_mb);
}
return 0;
}
libavcodec/mpegvideo_enc.c:2371: error: Uninitialized Value
The value read from dc[_] was never initialized.
libavcodec/mpegvideo_enc.c:2371:41:
2369. if(s->mb_intra && s->dc_val[0]){
2370. for(i=0; i<6; i++){
2371. s->dc_val[0][ s->block_index[i] ]= dc[i];
^
2372. memcpy(s->ac_val[0][s->block_index[i]], ac[i], sizeof(DCTELEM)*16);
2373. }
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo_enc.c/#L2371
|
d2a_code_trace_data_42740
|
static MYOBJ *MYOBJ_new()
{
static int count = 0;
MYOBJ *obj = OPENSSL_malloc(sizeof(*obj));
obj->id = ++count;
obj->st = CRYPTO_new_ex_data(CRYPTO_EX_INDEX_APP, obj, &obj->ex_data);
return obj;
}
test/exdatatest.c:135: error: NULL_DEREFERENCE
pointer `obj` last assigned on line 133 could be null and is dereferenced at line 135, column 5.
Showing all 14 steps of the trace
test/exdatatest.c:130:1: start of procedure MYOBJ_new()
128. } MYOBJ;
129.
130. > static MYOBJ *MYOBJ_new()
131. {
132. static int count = 0;
test/exdatatest.c:132:5:
130. static MYOBJ *MYOBJ_new()
131. {
132. > static int count = 0;
133. MYOBJ *obj = OPENSSL_malloc(sizeof(*obj));
134.
test/exdatatest.c:133:5:
131. {
132. static int count = 0;
133. > MYOBJ *obj = OPENSSL_malloc(sizeof(*obj));
134.
135. obj->id = ++count;
crypto/mem.c:158:1: start of procedure CRYPTO_malloc()
156. #endif
157.
158. > void *CRYPTO_malloc(size_t num, const char *file, int line)
159. {
160. void *ret = NULL;
crypto/mem.c:160:5:
158. void *CRYPTO_malloc(size_t num, const char *file, int line)
159. {
160. > void *ret = NULL;
161.
162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
crypto/mem.c:162:9: Taking false branch
160. void *ret = NULL;
161.
162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
163. return malloc_impl(num, file, line);
164.
crypto/mem.c:165:9: Taking false branch
163. return malloc_impl(num, file, line);
164.
165. if (num == 0)
^
166. return NULL;
167.
crypto/mem.c:169:5:
167.
168. FAILTEST();
169. > allow_customize = 0;
170. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
171. if (call_malloc_debug) {
crypto/mem.c:179:5:
177. }
178. #else
179. > osslargused(file); osslargused(line);
180. ret = malloc(num);
181. #endif
crypto/mem.c:179:24:
177. }
178. #else
179. > osslargused(file); osslargused(line);
180. ret = malloc(num);
181. #endif
crypto/mem.c:180:5:
178. #else
179. osslargused(file); osslargused(line);
180. > ret = malloc(num);
181. #endif
182.
crypto/mem.c:183:5:
181. #endif
182.
183. > return ret;
184. }
185.
crypto/mem.c:184:1: return from a call to CRYPTO_malloc
182.
183. return ret;
184. > }
185.
186. void *CRYPTO_zalloc(size_t num, const char *file, int line)
test/exdatatest.c:135:5:
133. MYOBJ *obj = OPENSSL_malloc(sizeof(*obj));
134.
135. > obj->id = ++count;
136. obj->st = CRYPTO_new_ex_data(CRYPTO_EX_INDEX_APP, obj, &obj->ex_data);
137. return obj;
|
https://github.com/openssl/openssl/blob/1ded2dd3ee9389b412e2ef0cf8e0b40a4ed3179b/test/exdatatest.c/#L135
|
d2a_code_trace_data_42741
|
static inline void skip_remaining(BitstreamContext *bc, unsigned n)
{
#ifdef BITSTREAM_READER_LE
bc->bits >>= n;
#else
bc->bits <<= n;
#endif
bc->bits_left -= n;
}
libavcodec/mpc7.c:91: error: Integer Overflow L2
([0, +oo] - 88):unsigned32 by call to `bitstream_skip`.
libavcodec/mpc7.c:86:19: Call
84. c->IS = bitstream_read_bit(&bc);
85. c->MSS = bitstream_read_bit(&bc);
86. c->maxbands = bitstream_read(&bc, 6);
^
87. if(c->maxbands >= BANDS){
88. av_log(avctx, AV_LOG_ERROR, "Too many bands: %i\n", c->maxbands);
libavcodec/bitstream.h:183:1: Parameter `bc->bits_left`
181.
182. /* Return n bits from the buffer. n has to be in the 0-32 range. */
183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n)
^
184. {
185. if (!n)
libavcodec/mpc7.c:91:5: Call
89. return -1;
90. }
91. bitstream_skip(&bc, 88);
^
92. c->gapless = bitstream_read_bit(&bc);
93. c->lastframelen = bitstream_read(&bc, 11);
libavcodec/bitstream.h:241:1: Parameter `n`
239.
240. /* Skip n bits in the buffer. */
241. static inline void bitstream_skip(BitstreamContext *bc, unsigned n)
^
242. {
243. if (n <= bc->bits_left)
libavcodec/bitstream.h:244:9: Call
242. {
243. if (n <= bc->bits_left)
244. skip_remaining(bc, n);
^
245. else {
246. n -= bc->bits_left;
libavcodec/bitstream.h:230:1: <LHS trace>
228. }
229.
230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
^
231. {
232. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:230:1: Parameter `bc->bits_left`
228. }
229.
230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
^
231. {
232. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:230:1: <RHS trace>
228. }
229.
230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
^
231. {
232. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:230:1: Parameter `n`
228. }
229.
230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
^
231. {
232. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:237:5: Binary operation: ([0, +oo] - 88):unsigned32 by call to `bitstream_skip`
235. bc->bits <<= n;
236. #endif
237. bc->bits_left -= n;
^
238. }
239.
|
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L237
|
d2a_code_trace_data_42742
|
int SSL_use_certificate(SSL *ssl, X509 *x)
{
int rv;
if (x == NULL) {
SSLerr(SSL_F_SSL_USE_CERTIFICATE, ERR_R_PASSED_NULL_PARAMETER);
return (0);
}
rv = ssl_security_cert(ssl, NULL, x, 0, 1);
if (rv != 1) {
SSLerr(SSL_F_SSL_USE_CERTIFICATE, rv);
return 0;
}
return (ssl_set_cert(ssl->cert, x));
}
ssl/ssl_rsa.c:76: error: NULL_DEREFERENCE
pointer `null` is dereferenced by call to `ssl_security_cert()` at line 76, column 10.
Showing all 3 steps of the trace
ssl/ssl_rsa.c:69:1: start of procedure SSL_use_certificate()
67. static int ssl_set_cert(CERT *c, X509 *x509);
68. static int ssl_set_pkey(CERT *c, EVP_PKEY *pkey);
69. > int SSL_use_certificate(SSL *ssl, X509 *x)
70. {
71. int rv;
ssl/ssl_rsa.c:72:9: Taking false branch
70. {
71. int rv;
72. if (x == NULL) {
^
73. SSLerr(SSL_F_SSL_USE_CERTIFICATE, ERR_R_PASSED_NULL_PARAMETER);
74. return (0);
ssl/ssl_rsa.c:76:5:
74. return (0);
75. }
76. > rv = ssl_security_cert(ssl, NULL, x, 0, 1);
77. if (rv != 1) {
78. SSLerr(SSL_F_SSL_USE_CERTIFICATE, rv);
|
https://github.com/openssl/openssl/blob/57ce7b617c602ae8513c22daa2bda31f179edb0f/ssl/ssl_rsa.c/#L76
|
d2a_code_trace_data_42743
|
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:2561: error: Null Dereference
pointer `pb` last assigned on line 2548 could be null and is dereferenced by call to `avio_close()` at line 2561, column 5.
libavformat/utils.c:2541:1: start of procedure avformat_close_input()
2539. }
2540.
2541. void avformat_close_input(AVFormatContext **ps)
^
2542. {
2543. AVFormatContext *s = *ps;
libavformat/utils.c:2543:5:
2541. void avformat_close_input(AVFormatContext **ps)
2542. {
2543. AVFormatContext *s = *ps;
^
2544. AVIOContext *pb = s->pb;
2545.
libavformat/utils.c:2544:5:
2542. {
2543. AVFormatContext *s = *ps;
2544. AVIOContext *pb = s->pb;
^
2545.
2546. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
libavformat/utils.c:2546:10: Taking true branch
2544. AVIOContext *pb = s->pb;
2545.
2546. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
^
2547. (s->flags & AVFMT_FLAG_CUSTOM_IO))
2548. pb = NULL;
libavformat/utils.c:2546:24: Taking false branch
2544. AVIOContext *pb = s->pb;
2545.
2546. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
^
2547. (s->flags & AVFMT_FLAG_CUSTOM_IO))
2548. pb = NULL;
libavformat/utils.c:2547:10: Taking true branch
2545.
2546. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
2547. (s->flags & AVFMT_FLAG_CUSTOM_IO))
^
2548. pb = NULL;
2549.
libavformat/utils.c:2548:9:
2546. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
2547. (s->flags & AVFMT_FLAG_CUSTOM_IO))
2548. pb = NULL;
^
2549.
2550. flush_packet_queue(s);
libavformat/utils.c:2550:5: Skipping flush_packet_queue(): empty list of specs
2548. pb = NULL;
2549.
2550. flush_packet_queue(s);
^
2551.
2552. if (s->iformat) {
libavformat/utils.c:2552:9: Taking true branch
2550. flush_packet_queue(s);
2551.
2552. if (s->iformat) {
^
2553. if (s->iformat->read_close)
2554. s->iformat->read_close(s);
libavformat/utils.c:2553:13: Taking true branch
2551.
2552. if (s->iformat) {
2553. if (s->iformat->read_close)
^
2554. s->iformat->read_close(s);
2555. }
libavformat/utils.c:2554:13: Skipping __function_pointer__(): unresolved function pointer
2552. if (s->iformat) {
2553. if (s->iformat->read_close)
2554. s->iformat->read_close(s);
^
2555. }
2556.
libavformat/utils.c:2557:5: Skipping avformat_free_context(): empty list of specs
2555. }
2556.
2557. avformat_free_context(s);
^
2558.
2559. *ps = NULL;
libavformat/utils.c:2559:5:
2557. avformat_free_context(s);
2558.
2559. *ps = NULL;
^
2560.
2561. avio_close(pb);
libavformat/utils.c:2561:5:
2559. *ps = NULL;
2560.
2561. avio_close(pb);
^
2562. }
2563.
libavformat/aviobuf.c:782:1: start of procedure avio_close()
780. }
781.
782. int avio_close(AVIOContext *s)
^
783. {
784. URLContext *h;
libavformat/aviobuf.c:786:10: Taking false branch
784. URLContext *h;
785.
786. if (!s)
^
787. return 0;
788.
libavformat/aviobuf.c:789:5:
787. return 0;
788.
789. avio_flush(s);
^
790. h = s->opaque;
791. 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/d010e95f86089abe9a3d4d4a66ac8102312d28a4/libavformat/utils.c/#L2561
|
d2a_code_trace_data_42744
|
int RAND_pseudo_bytes(unsigned char *buf, int num)
{
const RAND_METHOD *meth = RAND_get_rand_method();
if (meth->pseudorand != NULL)
return meth->pseudorand(buf, num);
return -1;
}
crypto/rand/rand_lib.c:820: error: NULL_DEREFERENCE
pointer `meth` last assigned on line 818 could be null and is dereferenced at line 820, column 9.
Showing all 6 steps of the trace
crypto/rand/rand_lib.c:816:1: start of procedure RAND_pseudo_bytes()
814.
815. #if !OPENSSL_API_1_1_0 && !defined(FIPS_MODE)
816. > int RAND_pseudo_bytes(unsigned char *buf, int num)
817. {
818. const RAND_METHOD *meth = RAND_get_rand_method();
crypto/rand/rand_lib.c:818:5:
816. int RAND_pseudo_bytes(unsigned char *buf, int num)
817. {
818. > const RAND_METHOD *meth = RAND_get_rand_method();
819.
820. if (meth->pseudorand != NULL)
crypto/rand/rand_lib.c:686:1: start of procedure RAND_get_rand_method()
684. #endif
685.
686. > const RAND_METHOD *RAND_get_rand_method(void)
687. {
688. #ifdef FIPS_MODE
crypto/rand/rand_lib.c:689:5:
687. {
688. #ifdef FIPS_MODE
689. > return NULL;
690. #else
691. const RAND_METHOD *tmp_meth = NULL;
crypto/rand/rand_lib.c:718:1: return from a call to RAND_get_rand_method
716. return tmp_meth;
717. #endif
718. > }
719.
720. #if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE)
crypto/rand/rand_lib.c:820:9:
818. const RAND_METHOD *meth = RAND_get_rand_method();
819.
820. > if (meth->pseudorand != NULL)
821. return meth->pseudorand(buf, num);
822. return -1;
|
https://github.com/openssl/openssl/blob/2cafb1dff3ef13c470c4d2d7b1d8a1f7142d8813/crypto/rand/rand_lib.c/#L820
|
d2a_code_trace_data_42745
|
static int check_name_constraints(X509_STORE_CTX *ctx)
{
X509 *x;
int i, j, rv;
for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--)
{
x = sk_X509_value(ctx->chain, i);
if (i && (x->ex_flags & EXFLAG_SI))
continue;
for (j = sk_X509_num(ctx->chain) - 1; j > i; j--)
{
NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc;
if (nc)
{
rv = NAME_CONSTRAINTS_check(x, nc);
if (rv != X509_V_OK)
{
ctx->error = rv;
ctx->error_depth = i;
ctx->current_cert = x;
if (!ctx->verify_cb(0,ctx))
return 0;
}
}
}
}
return 1;
}
crypto/x509/x509_vfy.c:704: error: NULL_DEREFERENCE
pointer `x` last assigned on line 702 could be null and is dereferenced at line 704, column 13.
Showing all 66 steps of the trace
crypto/x509/x509_vfy.c:695:1: start of procedure check_name_constraints()
693. }
694.
695. > static int check_name_constraints(X509_STORE_CTX *ctx)
696. {
697. X509 *x;
crypto/x509/x509_vfy.c:700:11: Condition is true
698. int i, j, rv;
699. /* Check name constraints for all certificates */
700. for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--)
^
701. {
702. x = sk_X509_value(ctx->chain, i);
crypto/x509/x509_vfy.c:700:7:
698. int i, j, rv;
699. /* Check name constraints for all certificates */
700. > for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--)
701. {
702. x = sk_X509_value(ctx->chain, i);
crypto/stack/stack.c:294:1: start of procedure sk_num()
292. }
293.
294. > int sk_num(const _STACK *st)
295. {
296. if(st == NULL) return -1;
crypto/stack/stack.c:296:5: Taking false branch
294. int sk_num(const _STACK *st)
295. {
296. if(st == NULL) return -1;
^
297. return st->num;
298. }
crypto/stack/stack.c:297:2:
295. {
296. if(st == NULL) return -1;
297. > return st->num;
298. }
299.
crypto/stack/stack.c:298:1: return from a call to sk_num
296. if(st == NULL) return -1;
297. return st->num;
298. > }
299.
300. void *sk_value(const _STACK *st, int i)
crypto/x509/x509_vfy.c:700:40: Loop condition is true. Entering loop body
698. int i, j, rv;
699. /* Check name constraints for all certificates */
700. for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--)
^
701. {
702. x = sk_X509_value(ctx->chain, i);
crypto/x509/x509_vfy.c:702:7: Condition is true
700. for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--)
701. {
702. x = sk_X509_value(ctx->chain, i);
^
703. /* Ignore self issued certs unless last in chain */
704. if (i && (x->ex_flags & EXFLAG_SI))
crypto/x509/x509_vfy.c:702:3:
700. for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--)
701. {
702. > x = sk_X509_value(ctx->chain, i);
703. /* Ignore self issued certs unless last in chain */
704. if (i && (x->ex_flags & EXFLAG_SI))
crypto/stack/stack.c:300:1: start of procedure sk_value()
298. }
299.
300. > void *sk_value(const _STACK *st, int i)
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
crypto/stack/stack.c:302:6: Taking false branch
300. void *sk_value(const _STACK *st, int i)
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
^
303. return st->data[i];
304. }
crypto/stack/stack.c:302:13: Taking false branch
300. void *sk_value(const _STACK *st, int i)
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
^
303. return st->data[i];
304. }
crypto/stack/stack.c:302:24: Taking false branch
300. void *sk_value(const _STACK *st, int i)
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
^
303. return st->data[i];
304. }
crypto/stack/stack.c:303:2:
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
303. > return st->data[i];
304. }
305.
crypto/stack/stack.c:304:1: return from a call to sk_value
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
303. return st->data[i];
304. > }
305.
306. void *sk_set(_STACK *st, int i, void *value)
crypto/x509/x509_vfy.c:704:7: Taking true branch
702. x = sk_X509_value(ctx->chain, i);
703. /* Ignore self issued certs unless last in chain */
704. if (i && (x->ex_flags & EXFLAG_SI))
^
705. continue;
706. /* Check against constraints for all certificates higher in
crypto/x509/x509_vfy.c:704:13: Taking true branch
702. x = sk_X509_value(ctx->chain, i);
703. /* Ignore self issued certs unless last in chain */
704. if (i && (x->ex_flags & EXFLAG_SI))
^
705. continue;
706. /* Check against constraints for all certificates higher in
crypto/x509/x509_vfy.c:700:48:
698. int i, j, rv;
699. /* Check name constraints for all certificates */
700. > for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--)
701. {
702. x = sk_X509_value(ctx->chain, i);
crypto/x509/x509_vfy.c:700:40: Loop condition is true. Entering loop body
698. int i, j, rv;
699. /* Check name constraints for all certificates */
700. for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--)
^
701. {
702. x = sk_X509_value(ctx->chain, i);
crypto/x509/x509_vfy.c:702:7: Condition is true
700. for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--)
701. {
702. x = sk_X509_value(ctx->chain, i);
^
703. /* Ignore self issued certs unless last in chain */
704. if (i && (x->ex_flags & EXFLAG_SI))
crypto/x509/x509_vfy.c:702:3:
700. for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--)
701. {
702. > x = sk_X509_value(ctx->chain, i);
703. /* Ignore self issued certs unless last in chain */
704. if (i && (x->ex_flags & EXFLAG_SI))
crypto/stack/stack.c:300:1: start of procedure sk_value()
298. }
299.
300. > void *sk_value(const _STACK *st, int i)
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
crypto/stack/stack.c:302:6: Taking false branch
300. void *sk_value(const _STACK *st, int i)
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
^
303. return st->data[i];
304. }
crypto/stack/stack.c:302:13: Taking false branch
300. void *sk_value(const _STACK *st, int i)
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
^
303. return st->data[i];
304. }
crypto/stack/stack.c:302:24: Taking false branch
300. void *sk_value(const _STACK *st, int i)
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
^
303. return st->data[i];
304. }
crypto/stack/stack.c:303:2:
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
303. > return st->data[i];
304. }
305.
crypto/stack/stack.c:304:1: return from a call to sk_value
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
303. return st->data[i];
304. > }
305.
306. void *sk_set(_STACK *st, int i, void *value)
crypto/x509/x509_vfy.c:704:7: Taking true branch
702. x = sk_X509_value(ctx->chain, i);
703. /* Ignore self issued certs unless last in chain */
704. if (i && (x->ex_flags & EXFLAG_SI))
^
705. continue;
706. /* Check against constraints for all certificates higher in
crypto/x509/x509_vfy.c:704:13: Taking false branch
702. x = sk_X509_value(ctx->chain, i);
703. /* Ignore self issued certs unless last in chain */
704. if (i && (x->ex_flags & EXFLAG_SI))
^
705. continue;
706. /* Check against constraints for all certificates higher in
crypto/x509/x509_vfy.c:711:12: Condition is true
709. * assumed it expects them to be obeyed.
710. */
711. for (j = sk_X509_num(ctx->chain) - 1; j > i; j--)
^
712. {
713. NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc;
crypto/x509/x509_vfy.c:711:8:
709. * assumed it expects them to be obeyed.
710. */
711. > for (j = sk_X509_num(ctx->chain) - 1; j > i; j--)
712. {
713. NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc;
crypto/stack/stack.c:294:1: start of procedure sk_num()
292. }
293.
294. > int sk_num(const _STACK *st)
295. {
296. if(st == NULL) return -1;
crypto/stack/stack.c:296:5: Taking false branch
294. int sk_num(const _STACK *st)
295. {
296. if(st == NULL) return -1;
^
297. return st->num;
298. }
crypto/stack/stack.c:297:2:
295. {
296. if(st == NULL) return -1;
297. > return st->num;
298. }
299.
crypto/stack/stack.c:298:1: return from a call to sk_num
296. if(st == NULL) return -1;
297. return st->num;
298. > }
299.
300. void *sk_value(const _STACK *st, int i)
crypto/x509/x509_vfy.c:711:41: Loop condition is true. Entering loop body
709. * assumed it expects them to be obeyed.
710. */
711. for (j = sk_X509_num(ctx->chain) - 1; j > i; j--)
^
712. {
713. NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc;
crypto/x509/x509_vfy.c:713:27: Condition is true
711. for (j = sk_X509_num(ctx->chain) - 1; j > i; j--)
712. {
713. NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc;
^
714. if (nc)
715. {
crypto/x509/x509_vfy.c:713:4:
711. for (j = sk_X509_num(ctx->chain) - 1; j > i; j--)
712. {
713. > NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc;
714. if (nc)
715. {
crypto/stack/stack.c:300:1: start of procedure sk_value()
298. }
299.
300. > void *sk_value(const _STACK *st, int i)
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
crypto/stack/stack.c:302:6: Taking false branch
300. void *sk_value(const _STACK *st, int i)
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
^
303. return st->data[i];
304. }
crypto/stack/stack.c:302:13: Taking false branch
300. void *sk_value(const _STACK *st, int i)
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
^
303. return st->data[i];
304. }
crypto/stack/stack.c:302:24: Taking false branch
300. void *sk_value(const _STACK *st, int i)
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
^
303. return st->data[i];
304. }
crypto/stack/stack.c:303:2:
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
303. > return st->data[i];
304. }
305.
crypto/stack/stack.c:304:1: return from a call to sk_value
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
303. return st->data[i];
304. > }
305.
306. void *sk_set(_STACK *st, int i, void *value)
crypto/x509/x509_vfy.c:714:8: Taking true branch
712. {
713. NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc;
714. if (nc)
^
715. {
716. rv = NAME_CONSTRAINTS_check(x, nc);
crypto/x509/x509_vfy.c:716:5: Skipping NAME_CONSTRAINTS_check(): empty list of specs
714. if (nc)
715. {
716. rv = NAME_CONSTRAINTS_check(x, nc);
^
717. if (rv != X509_V_OK)
718. {
crypto/x509/x509_vfy.c:717:9: Taking true branch
715. {
716. rv = NAME_CONSTRAINTS_check(x, nc);
717. if (rv != X509_V_OK)
^
718. {
719. ctx->error = rv;
crypto/x509/x509_vfy.c:719:6:
717. if (rv != X509_V_OK)
718. {
719. > ctx->error = rv;
720. ctx->error_depth = i;
721. ctx->current_cert = x;
crypto/x509/x509_vfy.c:720:6:
718. {
719. ctx->error = rv;
720. > ctx->error_depth = i;
721. ctx->current_cert = x;
722. if (!ctx->verify_cb(0,ctx))
crypto/x509/x509_vfy.c:721:6:
719. ctx->error = rv;
720. ctx->error_depth = i;
721. > ctx->current_cert = x;
722. if (!ctx->verify_cb(0,ctx))
723. return 0;
crypto/x509/x509_vfy.c:722:11: Taking false branch
720. ctx->error_depth = i;
721. ctx->current_cert = x;
722. if (!ctx->verify_cb(0,ctx))
^
723. return 0;
724. }
crypto/x509/x509_vfy.c:711:48:
709. * assumed it expects them to be obeyed.
710. */
711. > for (j = sk_X509_num(ctx->chain) - 1; j > i; j--)
712. {
713. NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc;
crypto/x509/x509_vfy.c:711:41: Loop condition is false. Leaving loop
709. * assumed it expects them to be obeyed.
710. */
711. for (j = sk_X509_num(ctx->chain) - 1; j > i; j--)
^
712. {
713. NAME_CONSTRAINTS *nc = sk_X509_value(ctx->chain, j)->nc;
crypto/x509/x509_vfy.c:700:48:
698. int i, j, rv;
699. /* Check name constraints for all certificates */
700. > for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--)
701. {
702. x = sk_X509_value(ctx->chain, i);
crypto/x509/x509_vfy.c:700:40: Loop condition is true. Entering loop body
698. int i, j, rv;
699. /* Check name constraints for all certificates */
700. for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--)
^
701. {
702. x = sk_X509_value(ctx->chain, i);
crypto/x509/x509_vfy.c:702:7: Condition is true
700. for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--)
701. {
702. x = sk_X509_value(ctx->chain, i);
^
703. /* Ignore self issued certs unless last in chain */
704. if (i && (x->ex_flags & EXFLAG_SI))
crypto/x509/x509_vfy.c:702:3:
700. for (i = sk_X509_num(ctx->chain) - 1; i >= 0; i--)
701. {
702. > x = sk_X509_value(ctx->chain, i);
703. /* Ignore self issued certs unless last in chain */
704. if (i && (x->ex_flags & EXFLAG_SI))
crypto/stack/stack.c:300:1: start of procedure sk_value()
298. }
299.
300. > void *sk_value(const _STACK *st, int i)
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
crypto/stack/stack.c:302:6: Taking false branch
300. void *sk_value(const _STACK *st, int i)
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
^
303. return st->data[i];
304. }
crypto/stack/stack.c:302:13: Taking false branch
300. void *sk_value(const _STACK *st, int i)
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
^
303. return st->data[i];
304. }
crypto/stack/stack.c:302:24: Taking true branch
300. void *sk_value(const _STACK *st, int i)
301. {
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
^
303. return st->data[i];
304. }
crypto/stack/stack.c:302:39:
300. void *sk_value(const _STACK *st, int i)
301. {
302. > if(!st || (i < 0) || (i >= st->num)) return NULL;
303. return st->data[i];
304. }
crypto/stack/stack.c:304:1: return from a call to sk_value
302. if(!st || (i < 0) || (i >= st->num)) return NULL;
303. return st->data[i];
304. > }
305.
306. void *sk_set(_STACK *st, int i, void *value)
crypto/x509/x509_vfy.c:704:7: Taking true branch
702. x = sk_X509_value(ctx->chain, i);
703. /* Ignore self issued certs unless last in chain */
704. if (i && (x->ex_flags & EXFLAG_SI))
^
705. continue;
706. /* Check against constraints for all certificates higher in
crypto/x509/x509_vfy.c:704:13:
702. x = sk_X509_value(ctx->chain, i);
703. /* Ignore self issued certs unless last in chain */
704. > if (i && (x->ex_flags & EXFLAG_SI))
705. continue;
706. /* Check against constraints for all certificates higher in
|
https://github.com/openssl/openssl/blob/2dac2667d1ec0ffd9f5609cc07f7e1221624e152/crypto/x509/x509_vfy.c/#L704
|
d2a_code_trace_data_42746
|
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_freep(&st->probe_data.buf);
av_free(st->index_entries);
av_free(st->codec->extradata);
av_free(st->codec->subtitle_header);
av_free(st->codec);
av_free(st->priv_data);
av_free(st->info);
av_free(st);
}
for(i=s->nb_programs-1; i>=0; i--) {
av_dict_free(&s->programs[i]->metadata);
av_freep(&s->programs[i]->stream_index);
av_freep(&s->programs[i]);
}
av_freep(&s->programs);
av_freep(&s->priv_data);
while(s->nb_chapters--) {
av_dict_free(&s->chapters[s->nb_chapters]->metadata);
av_free(s->chapters[s->nb_chapters]);
}
av_freep(&s->chapters);
av_dict_free(&s->metadata);
av_freep(&s->streams);
av_free(s);
}
libavformat/hlsenc.c:304: error: Integer Overflow L2
([0, +oo] - 1):unsigned32 by call to `avformat_free_context`.
libavformat/hlsenc.c:303:5: Call
301.
302. av_write_trailer(oc);
303. avio_closep(&oc->pb);
^
304. avformat_free_context(oc);
305. av_free(hls->basename);
libavformat/aviobuf.c:810:15: Call
808. int avio_closep(AVIOContext **s)
809. {
810. int ret = avio_close(*s);
^
811. *s = NULL;
812. return ret;
libavformat/aviobuf.c:794:1: Parameter `s->opaque->is_connected`
792. }
793.
794. int avio_close(AVIOContext *s)
^
795. {
796. URLContext *h;
libavformat/hlsenc.c:304:5: Call
302. av_write_trailer(oc);
303. avio_closep(&oc->pb);
304. avformat_free_context(oc);
^
305. av_free(hls->basename);
306. append_entry(hls, hls->duration);
libavformat/utils.c:2501:1: <LHS trace>
2499. }
2500.
2501. void avformat_free_context(AVFormatContext *s)
^
2502. {
2503. int i;
libavformat/utils.c:2501:1: Parameter `s->nb_programs`
2499. }
2500.
2501. void avformat_free_context(AVFormatContext *s)
^
2502. {
2503. int i;
libavformat/utils.c:2528:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avformat_free_context`
2526. av_free(st);
2527. }
2528. for(i=s->nb_programs-1; i>=0; i--) {
^
2529. av_dict_free(&s->programs[i]->metadata);
2530. av_freep(&s->programs[i]->stream_index);
|
https://github.com/libav/libav/blob/0a14fefd68cc18ce3252edff8a05ee9b3945b694/libavformat/utils.c/#L2528
|
d2a_code_trace_data_42747
|
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:435: error: Integer Overflow L2
([1, +oo] - 4):unsigned32 by call to `bitstream_read`.
libavcodec/takdec.c:435:36: Call
433. return decode_residues(s, decoded, subframe_size);
434.
435. filter_order = predictor_sizes[bitstream_read(bc, 4)];
^
436.
437. if (prev_subframe_size > 0 && bitstream_read_bit(bc)) {
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_42748
|
void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
{
unsigned long hash;
OPENSSL_LH_NODE *nn, **rn;
void *ret;
lh->error = 0;
rn = getrn(lh, data, &hash);
if (*rn == NULL) {
lh->num_no_delete++;
return (NULL);
} else {
nn = *rn;
*rn = nn->next;
ret = nn->data;
OPENSSL_free(nn);
lh->num_delete++;
}
lh->num_items--;
if ((lh->num_nodes > MIN_NODES) &&
(lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
contract(lh);
return (ret);
}
ssl/ssl_lib.c:3434: error: INTEGER_OVERFLOW_L2
([0, max(0, `s->ctx->sessions->num_items`)] - 1):unsigned64 by call to `SSL_free`.
Showing all 17 steps of the trace
ssl/ssl_lib.c:3311:1: Parameter `s->ctx->sessions->num_items`
3309. }
3310.
3311. > SSL *SSL_dup(SSL *s)
3312. {
3313. STACK_OF(X509_NAME) *sk;
ssl/ssl_lib.c:3327:16: Call
3325. * Otherwise, copy configuration state, and session if set.
3326. */
3327. if ((ret = SSL_new(SSL_get_SSL_CTX(s))) == NULL)
^
3328. return (NULL);
3329.
ssl/ssl_lib.c:522:1: Parameter `ctx->sessions->num_items`
520. }
521.
522. > SSL *SSL_new(SSL_CTX *ctx)
523. {
524. SSL *s;
ssl/ssl_lib.c:3434:5: Call
3432.
3433. err:
3434. SSL_free(ret);
^
3435. return NULL;
3436. }
ssl/ssl_lib.c:968:1: Parameter `s->session_ctx->sessions->num_items`
966. }
967.
968. > void SSL_free(SSL *s)
969. {
970. int i;
ssl/ssl_lib.c:999:9: Call
997. /* Make the next call work :-) */
998. if (s->session != NULL) {
999. ssl_clear_bad_session(s);
^
1000. SSL_SESSION_free(s->session);
1001. }
ssl/ssl_sess.c:1049:1: Parameter `s->session_ctx->sessions->num_items`
1047. }
1048.
1049. > int ssl_clear_bad_session(SSL *s)
1050. {
1051. if ((s->session != NULL) &&
ssl/ssl_sess.c:1054:9: Call
1052. !(s->shutdown & SSL_SENT_SHUTDOWN) &&
1053. !(SSL_in_init(s) || SSL_in_before(s))) {
1054. SSL_CTX_remove_session(s->session_ctx, s->session);
^
1055. return (1);
1056. } else
ssl/ssl_sess.c:725:1: Parameter `ctx->sessions->num_items`
723. }
724.
725. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
726. {
727. return remove_session_lock(ctx, c, 1);
ssl/ssl_sess.c:727:12: Call
725. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
726. {
727. return remove_session_lock(ctx, c, 1);
^
728. }
729.
ssl/ssl_sess.c:730:1: Parameter `ctx->sessions->num_items`
728. }
729.
730. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
731. {
732. SSL_SESSION *r;
ssl/ssl_sess.c:740:17: Call
738. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) {
739. ret = 1;
740. r = lh_SSL_SESSION_delete(ctx->sessions, c);
^
741. SSL_SESSION_list_remove(ctx, c);
742. }
ssl/ssl_locl.h:721:1: Parameter `lh->num_items`
719. } TLSEXT_INDEX;
720.
721. > DEFINE_LHASH_OF(SSL_SESSION);
722. /* Needed in ssl_cert.c */
723. DEFINE_LHASH_OF(X509_NAME);
ssl/ssl_locl.h:721:1: Call
719. } TLSEXT_INDEX;
720.
721. > DEFINE_LHASH_OF(SSL_SESSION);
722. /* Needed in ssl_cert.c */
723. DEFINE_LHASH_OF(X509_NAME);
crypto/lhash/lhash.c:103:1: <LHS trace>
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:103:1: Parameter `lh->num_items`
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:123:5: Binary operation: ([0, max(0, s->ctx->sessions->num_items)] - 1):unsigned64 by call to `SSL_free`
121. }
122.
123. lh->num_items--;
^
124. if ((lh->num_nodes > MIN_NODES) &&
125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
|
https://github.com/openssl/openssl/blob/7f7eb90b8ac55997c5c825bb3ebcfe28611e06f5/crypto/lhash/lhash.c/#L123
|
d2a_code_trace_data_42749
|
int test_exp(BIO *bp, BN_CTX *ctx)
{
BIGNUM *a, *b, *d, *e, *one;
int i;
a = BN_new();
b = BN_new();
d = BN_new();
e = BN_new();
one = BN_new();
BN_one(one);
for (i = 0; i < num2; i++) {
BN_bntest_rand(a, 20 + i * 5, 0, 0);
BN_bntest_rand(b, 2 + i, 0, 0);
if (BN_exp(d, a, b, ctx) <= 0)
return (0);
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");
}
BN_one(e);
for (; !BN_is_zero(b); BN_sub(b, b, one))
BN_mul(e, e, a, ctx);
BN_sub(e, e, d);
if (!BN_is_zero(e)) {
fprintf(stderr, "Exponentiation test failed!\n");
return 0;
}
}
BN_free(a);
BN_free(b);
BN_free(d);
BN_free(e);
BN_free(one);
return (1);
}
test/bntest.c:1224: error: MEMORY_LEAK
memory dynamically allocated by call to `BN_new()` at line 1191, column 9 is not reachable after line 1224, column 5.
Showing all 136 steps of the trace
test/bntest.c:1186:1: start of procedure test_exp()
1184. }
1185.
1186. > int test_exp(BIO *bp, BN_CTX *ctx)
1187. {
1188. BIGNUM *a, *b, *d, *e, *one;
test/bntest.c:1191:5:
1189. int i;
1190.
1191. > a = BN_new();
1192. b = BN_new();
1193. 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:1192:5:
1190.
1191. a = BN_new();
1192. > b = BN_new();
1193. d = BN_new();
1194. 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:1193:5:
1191. a = BN_new();
1192. b = BN_new();
1193. > d = BN_new();
1194. e = BN_new();
1195. one = 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:1194:5:
1192. b = BN_new();
1193. d = BN_new();
1194. > e = BN_new();
1195. one = BN_new();
1196. BN_one(one);
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:1195:5:
1193. d = BN_new();
1194. e = BN_new();
1195. > one = BN_new();
1196. BN_one(one);
1197.
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:1196:5:
1194. e = BN_new();
1195. one = BN_new();
1196. > BN_one(one);
1197.
1198. for (i = 0; i < num2; i++) {
crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word()
528. }
529.
530. > int BN_set_word(BIGNUM *a, BN_ULONG w)
531. {
532. bn_check_top(a);
crypto/bn/bn_lib.c:533:9: Condition is true
531. {
532. bn_check_top(a);
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
534. return (0);
535. a->neg = 0;
crypto/bn/bn_lib.c:533:9: Taking false branch
531. {
532. bn_check_top(a);
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
534. return (0);
535. a->neg = 0;
crypto/bn/bn_lib.c:535:5:
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
534. return (0);
535. > a->neg = 0;
536. a->d[0] = w;
537. a->top = (w ? 1 : 0);
crypto/bn/bn_lib.c:536:5:
534. return (0);
535. a->neg = 0;
536. > a->d[0] = w;
537. a->top = (w ? 1 : 0);
538. bn_check_top(a);
crypto/bn/bn_lib.c:537:15: Condition is true
535. a->neg = 0;
536. a->d[0] = w;
537. a->top = (w ? 1 : 0);
^
538. bn_check_top(a);
539. return (1);
crypto/bn/bn_lib.c:537:5:
535. a->neg = 0;
536. a->d[0] = w;
537. > a->top = (w ? 1 : 0);
538. bn_check_top(a);
539. return (1);
crypto/bn/bn_lib.c:539:5:
537. a->top = (w ? 1 : 0);
538. bn_check_top(a);
539. > return (1);
540. }
541.
crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word
538. bn_check_top(a);
539. return (1);
540. > }
541.
542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
test/bntest.c:1198:10:
1196. BN_one(one);
1197.
1198. > for (i = 0; i < num2; i++) {
1199. BN_bntest_rand(a, 20 + i * 5, 0, 0);
1200. BN_bntest_rand(b, 2 + i, 0, 0);
test/bntest.c:1198:17: Loop condition is false. Leaving loop
1196. BN_one(one);
1197.
1198. for (i = 0; i < num2; i++) {
^
1199. BN_bntest_rand(a, 20 + i * 5, 0, 0);
1200. BN_bntest_rand(b, 2 + i, 0, 0);
test/bntest.c:1224:5:
1222. }
1223. }
1224. > BN_free(a);
1225. BN_free(b);
1226. BN_free(d);
crypto/bn/bn_lib.c:252:1: start of procedure BN_free()
250. }
251.
252. > void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
crypto/bn/bn_lib.c:254:9: Taking false branch
252. void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
^
255. return;
256. bn_check_top(a);
crypto/bn/bn_lib.c:257:10:
255. return;
256. bn_check_top(a);
257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
963. }
964.
965. > int BN_get_flags(const BIGNUM *b, int n)
966. {
967. return b->flags & n;
crypto/bn/bn_lib.c:967:5:
965. int BN_get_flags(const BIGNUM *b, int n)
966. {
967. > return b->flags & n;
968. }
969.
crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
966. {
967. return b->flags & n;
968. > }
969.
970. /* Populate a BN_GENCB structure with an "old"-style callback */
crypto/bn/bn_lib.c:257:10: Taking false branch
255. return;
256. bn_check_top(a);
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
^
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:259:9: Taking false branch
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
^
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:263:9:
261. else {
262. #if OPENSSL_API_COMPAT < 0x00908000L
263. > a->flags |= BN_FLG_FREE;
264. #endif
265. a->d = NULL;
crypto/bn/bn_lib.c:265:9:
263. a->flags |= BN_FLG_FREE;
264. #endif
265. > a->d = NULL;
266. }
267. }
crypto/bn/bn_lib.c:259:5:
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. > if (a->flags & BN_FLG_MALLOCED)
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:267:1: return from a call to BN_free
265. a->d = NULL;
266. }
267. > }
268.
269. void bn_init(BIGNUM *a)
|
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L1224
|
d2a_code_trace_data_42750
|
static int do_test_file(const char *testfile)
{
BIO *in;
char buf[10240];
EVP_TEST t;
current_test_file = testfile;
if (!TEST_ptr(in = BIO_new_file(testfile, "rb")))
return 0;
memset(&t, 0, sizeof(t));
t.start_line = -1;
t.in = in;
t.err = NULL;
while (BIO_gets(in, buf, sizeof(buf))) {
t.line++;
if (!TEST_true(parse_test_line(&t, buf)))
return 0;
}
if (!run_and_get_next(&t, NULL))
return 0;
TEST_info("Completed %d tests with %d errors and %d skipped",
t.ntests, t.errors, t.nskip);
free_key_list(public_keys);
free_key_list(private_keys);
BIO_free(t.key);
BIO_free(in);
return t.errors == 0;
}
test/evp_test.c:2088: error: UNINITIALIZED_VALUE
The value read from t.line was never initialized.
Showing all 1 steps of the trace
test/evp_test.c:2088:9:
2086. t.err = NULL;
2087. while (BIO_gets(in, buf, sizeof(buf))) {
2088. > t.line++;
2089. if (!TEST_true(parse_test_line(&t, buf)))
2090. return 0;
|
https://github.com/openssl/openssl/blob/69b4c01fd26e6eb72b156ed3014522c3295a7669/test/evp_test.c/#L2088
|
d2a_code_trace_data_42751
|
int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *x, int vfy)
{
int rv, start_idx, i;
if (x == NULL) {
x = sk_X509_value(sk, 0);
start_idx = 1;
} else
start_idx = 0;
rv = ssl_security_cert(s, NULL, x, vfy, 1);
if (rv != 1)
return rv;
for (i = start_idx; i < sk_X509_num(sk); i++) {
x = sk_X509_value(sk, i);
rv = ssl_security_cert(s, NULL, x, vfy, 0);
if (rv != 1)
return rv;
}
return 1;
}
ssl/t1_lib.c:4071: error: NULL_DEREFERENCE
pointer `null` is dereferenced by call to `ssl_security_cert()` at line 4071, column 10.
Showing all 11 steps of the trace
ssl/t1_lib.c:4062:1: start of procedure ssl_security_cert_chain()
4060. */
4061.
4062. > int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *x, int vfy)
4063. {
4064. int rv, start_idx, i;
ssl/t1_lib.c:4065:9: Taking true branch
4063. {
4064. int rv, start_idx, i;
4065. if (x == NULL) {
^
4066. x = sk_X509_value(sk, 0);
4067. start_idx = 1;
ssl/t1_lib.c:4066:9:
4064. int rv, start_idx, i;
4065. if (x == NULL) {
4066. > x = sk_X509_value(sk, 0);
4067. start_idx = 1;
4068. } else
include/openssl/x509.h:97:1: start of procedure sk_X509_value()
95. typedef struct x509_cinf_st X509_CINF;
96.
97. > DEFINE_STACK_OF(X509)
98.
99. /* This is used for a table of trust checking functions */
crypto/stack/stack.c:265:1: start of procedure OPENSSL_sk_value()
263. }
264.
265. > void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
266. {
267. if (st == NULL || i < 0 || i >= st->num)
crypto/stack/stack.c:267:9: Taking true branch
265. void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
266. {
267. if (st == NULL || i < 0 || i >= st->num)
^
268. return NULL;
269. return (void *)st->data[i];
crypto/stack/stack.c:268:9:
266. {
267. if (st == NULL || i < 0 || i >= st->num)
268. > return NULL;
269. return (void *)st->data[i];
270. }
crypto/stack/stack.c:270:1: return from a call to OPENSSL_sk_value
268. return NULL;
269. return (void *)st->data[i];
270. > }
271.
272. void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data)
include/openssl/x509.h:97:1: return from a call to sk_X509_value
95. typedef struct x509_cinf_st X509_CINF;
96.
97. > DEFINE_STACK_OF(X509)
98.
99. /* This is used for a table of trust checking functions */
ssl/t1_lib.c:4067:9:
4065. if (x == NULL) {
4066. x = sk_X509_value(sk, 0);
4067. > start_idx = 1;
4068. } else
4069. start_idx = 0;
ssl/t1_lib.c:4071:5:
4069. start_idx = 0;
4070.
4071. > rv = ssl_security_cert(s, NULL, x, vfy, 1);
4072. if (rv != 1)
4073. return rv;
|
https://github.com/openssl/openssl/blob/869d0a37cfa7cfdbd42026d2b75d14cdc64e81e0/ssl/t1_lib.c/#L4071
|
d2a_code_trace_data_42752
|
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:973: error: INTEGER_OVERFLOW_L2
([0, max(0, `s->initial_ctx->sessions->num_nodes`)] - 1):unsigned32 by call to `SSL_CTX_free`.
Showing all 13 steps of the trace
ssl/ssl_lib.c:926:1: Parameter `s->initial_ctx->sessions->num_nodes`
924. }
925.
926. > void SSL_free(SSL *s)
927. {
928. int i;
ssl/ssl_lib.c:973:5: Call
971.
972. OPENSSL_free(s->tlsext_hostname);
973. SSL_CTX_free(s->initial_ctx);
^
974. #ifndef OPENSSL_NO_EC
975. OPENSSL_free(s->tlsext_ecpointformatlist);
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, s->initial_ctx->sessions->num_nodes)] - 1):unsigned32 by call to `SSL_CTX_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_42753
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/bn/bn_exp.c:1345: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul`.
Showing all 30 steps of the trace
crypto/bn/bn_exp.c:1277:1: Parameter `ctx->stack.depth`
1275.
1276. /* The old fallback, simple version :-) */
1277. > int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
1278. const BIGNUM *m, BN_CTX *ctx)
1279. {
crypto/bn/bn_exp.c:1306:5: Call
1304. }
1305.
1306. BN_CTX_start(ctx);
^
1307. d = BN_CTX_get(ctx);
1308. val[0] = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_exp.c:1307:9: Call
1305.
1306. BN_CTX_start(ctx);
1307. d = BN_CTX_get(ctx);
^
1308. val[0] = BN_CTX_get(ctx);
1309. if (val[0] == NULL)
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_exp.c:1308:14: Call
1306. BN_CTX_start(ctx);
1307. d = BN_CTX_get(ctx);
1308. val[0] = BN_CTX_get(ctx);
^
1309. if (val[0] == NULL)
1310. goto err;
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_exp.c:1312:10: Call
1310. goto err;
1311.
1312. if (!BN_nnmod(val[0], a, m, ctx))
^
1313. goto err; /* 1 */
1314. 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: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_exp.c:1345:22: Call
1343. if (BN_is_bit_set(p, wstart) == 0) {
1344. if (!start)
1345. if (!BN_mod_mul(r, r, r, m, ctx))
^
1346. goto err;
1347. if (wstart == 0)
crypto/bn/bn_mod.c:193:1: Parameter `ctx->stack.depth`
191.
192. /* slow but works */
193. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
194. BN_CTX *ctx)
195. {
crypto/bn/bn_mod.c:203:5: Call
201. bn_check_top(m);
202.
203. BN_CTX_start(ctx);
^
204. if ((t = BN_CTX_get(ctx)) == NULL)
205. 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_mod.c:204:14: Call
202.
203. BN_CTX_start(ctx);
204. if ((t = BN_CTX_get(ctx)) == NULL)
^
205. goto err;
206. if (a == b) {
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_mod.c:210:14: Call
208. goto err;
209. } else {
210. if (!BN_mul(t, a, b, ctx))
^
211. goto err;
212. }
crypto/bn/bn_mul.c:497:1: Parameter `ctx->stack.depth`
495. #endif /* BN_RECURSION */
496.
497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
498. {
499. int ret = bn_mul_fixed_top(r, a, b, ctx);
crypto/bn/bn_mul.c:499:15: Call
497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
498. {
499. int ret = bn_mul_fixed_top(r, a, b, ctx);
^
500.
501. bn_correct_top(r);
crypto/bn/bn_mul.c:533:5: Call
531. top = al + bl;
532.
533. BN_CTX_start(ctx);
^
534. if ((r == a) || (r == b)) {
535. if ((rr = BN_CTX_get(ctx)) == NULL)
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_mul.c:618:5: Call
616. err:
617. bn_check_top(r);
618. BN_CTX_end(ctx);
^
619. return ret;
620. }
crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <Offset trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: <Length trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul`
266. static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
^
269. }
270.
|
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.