id stringlengths 25 25 | content stringlengths 649 72.1k | max_stars_repo_path stringlengths 91 133 |
|---|---|---|
d2a_code_trace_data_41454 | 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/statem/statem_srvr.c:1474: error: INTEGER_OVERFLOW_L2
([0, max(0, `s->initial_ctx->sessions->num_items`)] - 1):unsigned64 by call to `ssl3_send_alert`.
Showing all 13 steps of the trace
ssl/statem/statem_srvr.c:1378:1: Parameter `s->initial_ctx->sessions->num_items`
1376. }
1377.
1378. > WORK_STATE tls_post_process_client_hello(SSL *s, WORK_STATE wst)
1379. {
1380. int al = SSL_AD_HANDSHAKE_FAILURE;
ssl/statem/statem_srvr.c:1474:5: Call
1472. return WORK_FINISHED_STOP;
1473. f_err:
1474. ssl3_send_alert(s, SSL3_AL_FATAL, al);
^
1475. ossl_statem_set_error(s);
1476. return WORK_ERROR;
ssl/s3_msg.c:64:1: Parameter `s->initial_ctx->sessions->num_items`
62. }
63.
64. > int ssl3_send_alert(SSL *s, int level, int desc)
65. {
66. /* Map tls/ssl alert value to correct one */
ssl/s3_msg.c:75:9: Call
73. /* If a fatal one, remove from cache */
74. if ((level == SSL3_AL_FATAL) && (s->session != NULL))
75. SSL_CTX_remove_session(s->session_ctx, s->session);
^
76.
77. s->s3->alert_dispatch = 1;
ssl/ssl_sess.c:691:1: Parameter `ctx->sessions->num_items`
689. }
690.
691. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
692. {
693. return remove_session_lock(ctx, c, 1);
ssl/ssl_sess.c:693:12: Call
691. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
692. {
693. return remove_session_lock(ctx, c, 1);
^
694. }
695.
ssl/ssl_sess.c:696:1: Parameter `ctx->sessions->num_items`
694. }
695.
696. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
697. {
698. SSL_SESSION *r;
ssl/ssl_sess.c:706:17: Call
704. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) {
705. ret = 1;
706. r = lh_SSL_SESSION_delete(ctx->sessions, c);
^
707. SSL_SESSION_list_remove(ctx, c);
708. }
ssl/ssl_locl.h:581:1: Parameter `lh->num_items`
579. };
580.
581. > DEFINE_LHASH_OF(SSL_SESSION);
582. /* Needed in ssl_cert.c */
583. DEFINE_LHASH_OF(X509_NAME);
ssl/ssl_locl.h:581:1: Call
579. };
580.
581. > DEFINE_LHASH_OF(SSL_SESSION);
582. /* Needed in ssl_cert.c */
583. DEFINE_LHASH_OF(X509_NAME);
crypto/lhash/lhash.c:103:1: <LHS trace>
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:103:1: Parameter `lh->num_items`
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:123:5: Binary operation: ([0, max(0, s->initial_ctx->sessions->num_items)] - 1):unsigned64 by call to `ssl3_send_alert`
121. }
122.
123. lh->num_items--;
^
124. if ((lh->num_nodes > MIN_NODES) &&
125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
| https://github.com/openssl/openssl/blob/2a7de0fd5d9baf946ef4d2c51096b04dd47a8143/crypto/lhash/lhash.c/#L123 |
d2a_code_trace_data_41455 | void bn_correct_top(BIGNUM *a)
{
BN_ULONG *ftl;
int tmp_top = a->top;
if (tmp_top > 0) {
for (ftl = &(a->d[tmp_top]); tmp_top > 0; tmp_top--) {
ftl--;
if (*ftl != 0)
break;
}
a->top = tmp_top;
}
if (a->top == 0)
a->neg = 0;
a->flags &= ~BN_FLG_FIXED_TOP;
bn_pollute(a);
}
crypto/bn/bn_exp.c:220: error: BUFFER_OVERRUN_L3
Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mod_mul_reciprocal`.
Showing all 18 steps of the trace
crypto/bn/bn_exp.c:203:13: Call
201. goto err;
202. aa->neg = 0;
203. if (BN_RECP_CTX_set(&recp, aa, ctx) <= 0)
^
204. goto err;
205. } else {
crypto/bn/bn_recp.c:45:1: Parameter `*recp->Nr.d`
43. }
44.
45. > int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *d, BN_CTX *ctx)
46. {
47. if (!BN_copy(&(recp->N), d))
crypto/bn/bn_exp.c:220:14: Call
218. window = BN_window_bits_for_exponent_size(bits);
219. if (window > 1) {
220. if (!BN_mod_mul_reciprocal(aa, val[0], val[0], &recp, ctx))
^
221. goto err; /* 2 */
222. j = 1 << (window - 1);
crypto/bn/bn_recp.c:55:1: Parameter `*recp->Nr.d`
53. }
54.
55. > int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y,
56. BN_RECP_CTX *recp, BN_CTX *ctx)
57. {
crypto/bn/bn_recp.c:77:11: Call
75. ca = x; /* Just do the mod */
76.
77. ret = BN_div_recp(NULL, r, ca, recp, ctx);
^
78. err:
79. BN_CTX_end(ctx);
crypto/bn/bn_recp.c:84:1: Parameter `*recp->Nr.d`
82. }
83.
84. > int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,
85. BN_RECP_CTX *recp, BN_CTX *ctx)
86. {
crypto/bn/bn_recp.c:121:23: Call
119. /* Nr := round(2^i / N) */
120. if (i != recp->shift)
121. recp->shift = BN_reciprocal(&(recp->Nr), &(recp->N), i, ctx);
^
122. /* BN_reciprocal could have returned -1 for an error */
123. if (recp->shift == -1)
crypto/bn/bn_recp.c:174:1: Parameter `*r->d`
172. */
173. /* r := 2^len / m */
174. > int BN_reciprocal(BIGNUM *r, const BIGNUM *m, int len, BN_CTX *ctx)
175. {
176. int ret = -1;
crypto/bn/bn_recp.c:186:10: Call
184. goto err;
185.
186. if (!BN_div(r, NULL, t, m, ctx))
^
187. goto err;
188.
crypto/bn/bn_div.c:229:11: Call
227. }
228.
229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx);
^
230.
231. if (ret) {
crypto/bn/bn_div.c:264:1: Parameter `dv->top`
262. * divisor's length is considered public;
263. */
264. > int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num,
265. const BIGNUM *divisor, BN_CTX *ctx)
266. {
crypto/bn/bn_div.c:233:13: Call
231. if (ret) {
232. if (dv != NULL)
233. bn_correct_top(dv);
^
234. if (rm != NULL)
235. bn_correct_top(rm);
crypto/bn/bn_lib.c:965:1: <Offset trace>
963. }
964.
965. > void bn_correct_top(BIGNUM *a)
966. {
967. BN_ULONG *ftl;
crypto/bn/bn_lib.c:965:1: Parameter `a->top`
963. }
964.
965. > void bn_correct_top(BIGNUM *a)
966. {
967. BN_ULONG *ftl;
crypto/bn/bn_lib.c:968:5: Assignment
966. {
967. BN_ULONG *ftl;
968. int tmp_top = a->top;
^
969.
970. if (tmp_top > 0) {
crypto/bn/bn_lib.c:965:1: <Length trace>
963. }
964.
965. > void bn_correct_top(BIGNUM *a)
966. {
967. BN_ULONG *ftl;
crypto/bn/bn_lib.c:965:1: Parameter `*a->d`
963. }
964.
965. > void bn_correct_top(BIGNUM *a)
966. {
967. BN_ULONG *ftl;
crypto/bn/bn_lib.c:971:14: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mod_mul_reciprocal`
969.
970. if (tmp_top > 0) {
971. for (ftl = &(a->d[tmp_top]); tmp_top > 0; tmp_top--) {
^
972. ftl--;
973. if (*ftl != 0)
| https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_lib.c/#L971 |
d2a_code_trace_data_41456 | static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts)
{
InputStream *ist = s->opaque;
const enum AVPixelFormat *p;
int ret;
for (p = pix_fmts; *p != -1; p++) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p);
const HWAccel *hwaccel;
if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))
break;
hwaccel = get_hwaccel(*p);
if (!hwaccel ||
(ist->active_hwaccel_id && ist->active_hwaccel_id != hwaccel->id) ||
(ist->hwaccel_id != HWACCEL_AUTO && ist->hwaccel_id != hwaccel->id))
continue;
ret = hwaccel->init(s);
if (ret < 0) {
if (ist->hwaccel_id == hwaccel->id) {
av_log(NULL, AV_LOG_FATAL,
"%s hwaccel requested for input stream #%d:%d, "
"but cannot be initialized.\n", hwaccel->name,
ist->file_index, ist->st->index);
return AV_PIX_FMT_NONE;
}
continue;
}
ist->active_hwaccel_id = hwaccel->id;
ist->hwaccel_pix_fmt = *p;
break;
}
return *p;
}
avconv.c:1519: error: Null Dereference
pointer `desc` last assigned on line 1516 could be null and is dereferenced at line 1519, column 15.
avconv.c:1509:1: start of procedure get_format()
1507. }
1508.
1509. static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts)
^
1510. {
1511. InputStream *ist = s->opaque;
avconv.c:1511:5:
1509. static enum AVPixelFormat get_format(AVCodecContext *s, const enum AVPixelFormat *pix_fmts)
1510. {
1511. InputStream *ist = s->opaque;
^
1512. const enum AVPixelFormat *p;
1513. int ret;
avconv.c:1515:10:
1513. int ret;
1514.
1515. for (p = pix_fmts; *p != -1; p++) {
^
1516. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p);
1517. const HWAccel *hwaccel;
avconv.c:1515:24: Loop condition is true. Entering loop body
1513. int ret;
1514.
1515. for (p = pix_fmts; *p != -1; p++) {
^
1516. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p);
1517. const HWAccel *hwaccel;
avconv.c:1516:9:
1514.
1515. for (p = pix_fmts; *p != -1; p++) {
1516. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(*p);
^
1517. const HWAccel *hwaccel;
1518.
libavutil/pixdesc.c:1703:1: start of procedure av_pix_fmt_desc_get()
1701. }
1702.
1703. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
^
1704. {
1705. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
libavutil/pixdesc.c:1705:9: Taking false branch
1703. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1704. {
1705. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
^
1706. return NULL;
1707. return &av_pix_fmt_descriptors[pix_fmt];
libavutil/pixdesc.c:1705:24: Taking true branch
1703. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1704. {
1705. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
^
1706. return NULL;
1707. return &av_pix_fmt_descriptors[pix_fmt];
libavutil/pixdesc.c:1706:9:
1704. {
1705. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
1706. return NULL;
^
1707. return &av_pix_fmt_descriptors[pix_fmt];
1708. }
libavutil/pixdesc.c:1708:1: return from a call to av_pix_fmt_desc_get
1706. return NULL;
1707. return &av_pix_fmt_descriptors[pix_fmt];
1708. }
^
1709.
1710. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
avconv.c:1519:15:
1517. const HWAccel *hwaccel;
1518.
1519. if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))
^
1520. break;
1521.
| https://github.com/libav/libav/blob/1db8eb154908cde577477b6ab17430a0cd46b7bd/avconv.c/#L1519 |
d2a_code_trace_data_41457 | static void exponents_from_scale_factors(MPADecodeContext *s,
GranuleDef *g,
int16_t *exponents)
{
const uint8_t *bstab, *pretab;
int len, i, j, k, l, v0, shift, gain, gains[3];
int16_t *exp_ptr;
exp_ptr = exponents;
gain = g->global_gain - 210;
shift = g->scalefac_scale + 1;
bstab = band_size_long[s->sample_rate_index];
pretab = mpa_pretab[g->preflag];
for(i=0;i<g->long_end;i++) {
v0 = gain - ((g->scale_factors[i] + pretab[i]) << shift) + 400;
len = bstab[i];
for(j=len;j>0;j--)
*exp_ptr++ = v0;
}
if (g->short_start < 13) {
bstab = band_size_short[s->sample_rate_index];
gains[0] = gain - (g->subblock_gain[0] << 3);
gains[1] = gain - (g->subblock_gain[1] << 3);
gains[2] = gain - (g->subblock_gain[2] << 3);
k = g->long_end;
for(i=g->short_start;i<13;i++) {
len = bstab[i];
for(l=0;l<3;l++) {
v0 = gains[l] - (g->scale_factors[k++] << shift) + 400;
for(j=len;j>0;j--)
*exp_ptr++ = v0;
}
}
}
}
libavcodec/mpegaudiodec.c:2469: error: Buffer Overrun L2
Offset: [0, 9] Size: 9 by call to `mp_decode_frame`.
libavcodec/mpegaudiodec.c:2428:1: Parameter `*buf`
2426.
2427. #ifdef CONFIG_MP3ADU_DECODER
2428. static int decode_frame_adu(AVCodecContext * avctx,
^
2429. void *data, int *data_size,
2430. const uint8_t * buf, int buf_size)
libavcodec/mpegaudiodec.c:2450:5: Assignment
2448.
2449. // Get header and restore sync word
2450. header = AV_RB32(buf) | 0xffe00000;
^
2451.
2452. if (ff_mpa_check_header(header) < 0) { // Bad header, discard frame
libavcodec/mpegaudiodec.c:2457:5: Call
2455. }
2456.
2457. ff_mpegaudio_decode_header(s, header);
^
2458. /* update codec info */
2459. avctx->sample_rate = s->sample_rate;
libavcodec/mpegaudiodecheader.c:39:9: Assignment
37. if (header & (1<<20)) {
38. s->lsf = (header & (1<<19)) ? 0 : 1;
39. mpeg25 = 0;
^
40. } else {
41. s->lsf = 1;
libavcodec/mpegaudiodecheader.c:49:5: Assignment
47. sample_rate_index = (header >> 10) & 3;
48. sample_rate = ff_mpa_freq_tab[sample_rate_index] >> (s->lsf + mpeg25);
49. sample_rate_index += 3 * (s->lsf + mpeg25);
^
50. s->sample_rate_index = sample_rate_index;
51. s->error_protection = ((header >> 16) & 1) ^ 1;
libavcodec/mpegaudiodecheader.c:50:5: Assignment
48. sample_rate = ff_mpa_freq_tab[sample_rate_index] >> (s->lsf + mpeg25);
49. sample_rate_index += 3 * (s->lsf + mpeg25);
50. s->sample_rate_index = sample_rate_index;
^
51. s->error_protection = ((header >> 16) & 1) ^ 1;
52. s->sample_rate = sample_rate;
libavcodec/mpegaudiodec.c:2469:20: Call
2467. out_size = buf_size;
2468. } else {
2469. out_size = mp_decode_frame(s, out_samples, buf, buf_size);
^
2470. }
2471.
libavcodec/mpegaudiodec.c:2289:1: Parameter `s->sample_rate_index`
2287. }
2288.
2289. static int mp_decode_frame(MPADecodeContext *s,
^
2290. OUT_INT *samples, const uint8_t *buf, int buf_size)
2291. {
libavcodec/mpegaudiodec.c:2314:21: Call
2312. s->avctx->frame_size = s->lsf ? 576 : 1152;
2313. default:
2314. nb_frames = mp_decode_layer3(s);
^
2315.
2316. s->last_buf_size=0;
libavcodec/mpegaudiodec.c:2015:1: Parameter `s->sample_rate_index`
2013.
2014. /* main layer3 decoding function */
2015. static int mp_decode_layer3(MPADecodeContext *s)
^
2016. {
2017. int nb_granules, main_data_begin, private_bits;
libavcodec/mpegaudiodec.c:2255:13: Call
2253. }
2254.
2255. exponents_from_scale_factors(s, g, exponents);
^
2256.
2257. /* read Huffman coded residue */
libavcodec/mpegaudiodec.c:1419:1: <Offset trace>
1417. }
1418.
1419. static void exponents_from_scale_factors(MPADecodeContext *s,
^
1420. GranuleDef *g,
1421. int16_t *exponents)
libavcodec/mpegaudiodec.c:1419:1: Parameter `s->sample_rate_index`
1417. }
1418.
1419. static void exponents_from_scale_factors(MPADecodeContext *s,
^
1420. GranuleDef *g,
1421. int16_t *exponents)
libavcodec/mpegaudiodectab.h:563:1: <Length trace>
561.
562. /* band size tables */
563. static const uint8_t band_size_long[9][22] = {
^
564. { 4, 4, 4, 4, 4, 4, 6, 6, 8, 8, 10,
565. 12, 16, 20, 24, 28, 34, 42, 50, 54, 76, 158, }, /* 44100 */
libavcodec/mpegaudiodectab.h:563:1: Array declaration
561.
562. /* band size tables */
563. static const uint8_t band_size_long[9][22] = {
^
564. { 4, 4, 4, 4, 4, 4, 6, 6, 8, 8, 10,
565. 12, 16, 20, 24, 28, 34, 42, 50, 54, 76, 158, }, /* 44100 */
libavcodec/mpegaudiodec.c:1431:5: Array access: Offset: [0, 9] Size: 9 by call to `mp_decode_frame`
1429. shift = g->scalefac_scale + 1;
1430.
1431. bstab = band_size_long[s->sample_rate_index];
^
1432. pretab = mpa_pretab[g->preflag];
1433. for(i=0;i<g->long_end;i++) {
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L1431 |
d2a_code_trace_data_41458 | 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;
}
test/ec_internal_test.c:86: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_bin2bn`.
Showing all 17 steps of the trace
test/ec_internal_test.c:82:9: Call
80.
81. BN_CTX_start(ctx);
82. p = BN_CTX_get(ctx);
^
83. a = BN_CTX_get(ctx);
84. if (!TEST_ptr(b = 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:359:1: Parameter `*a->d`
357. }
358.
359. > int BN_set_word(BIGNUM *a, BN_ULONG w)
360. {
361. bn_check_top(a);
crypto/bn/bn_lib.c:362:9: Call
360. {
361. bn_check_top(a);
362. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
363. return 0;
364. a->neg = 0;
crypto/bn/bn_lcl.h:660:1: Parameter `*a->d`
658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
659.
660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
661. {
662. if (bits > (INT_MAX - BN_BITS2 + 1))
test/ec_internal_test.c:86:13: Call
84. if (!TEST_ptr(b = BN_CTX_get(ctx))
85. || !TEST_ptr(group = EC_GROUP_new(meth))
86. || !TEST_true(BN_bin2bn(params, len, p))
^
87. || !TEST_true(BN_bin2bn(params + len, len, a))
88. || !TEST_true(BN_bin2bn(params + 2 * len, len, b))
crypto/bn/bn_lib.c:372:1: Parameter `*ret->d`
370. }
371.
372. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
373. {
374. unsigned int i, m;
crypto/bn/bn_lib.c:394:9: Call
392. i = ((n - 1) / BN_BYTES) + 1;
393. m = ((n - 1) % (BN_BYTES));
394. if (bn_wexpand(ret, (int)i) == NULL) {
^
395. BN_free(bn);
396. return NULL;
crypto/bn/bn_lib.c:939:1: Parameter `*a->d`
937. }
938.
939. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
940. {
941. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_lib.c:941:37: Call
939. BIGNUM *bn_wexpand(BIGNUM *a, int words)
940. {
941. return (words <= a->dmax) ? a : bn_expand2(a, words);
^
942. }
943.
crypto/bn/bn_lib.c:245:1: Parameter `*b->d`
243. */
244.
245. > BIGNUM *bn_expand2(BIGNUM *b, int words)
246. {
247. if (words > b->dmax) {
crypto/bn/bn_lib.c:248:23: Call
246. {
247. if (words > b->dmax) {
248. BN_ULONG *a = bn_expand_internal(b, words);
^
249. if (!a)
250. return NULL;
crypto/bn/bn_lib.c:209:1: <Offset trace>
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: Parameter `b->top`
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: <Length trace>
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: Parameter `*b->d`
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_bin2bn`
230. assert(b->top <= words);
231. if (b->top > 0)
232. memcpy(a, b->d, sizeof(*a) * b->top);
^
233.
234. return a;
| https://github.com/openssl/openssl/blob/8f58ede09572dcc6a7e6c01280dd348240199568/crypto/bn/bn_lib.c/#L232 |
d2a_code_trace_data_41459 | static void write_quant_table(RangeCoder *c, int16_t *quant_table){
int last=0;
int i;
uint8_t state[CONTEXT_SIZE];
memset(state, 128, sizeof(state));
for(i=1; i<128 ; i++){
if(quant_table[i] != quant_table[i-1]){
put_symbol(c, state, i-last-1, 0);
last= i;
}
}
put_symbol(c, state, i-last-1, 0);
}
libavcodec/ffv1.c:529: error: Buffer Overrun L2
Offset: [1, 131] (⇐ [0, 4] + [1, 127]) Size: 5 by call to `write_quant_table`.
libavcodec/ffv1.c:513:1: Parameter `f->quant_table[*]`
511. }
512.
513. static void write_header(FFV1Context *f){
^
514. uint8_t state[CONTEXT_SIZE];
515. int i;
libavcodec/ffv1.c:529:9: Call
527.
528. for(i=0; i<5; i++)
529. write_quant_table(c, f->quant_table[i]);
^
530. }
531. #endif /* CONFIG_ENCODERS */
libavcodec/ffv1.c:504:9: <Offset trace>
502. memset(state, 128, sizeof(state));
503.
504. for(i=1; i<128 ; i++){
^
505. if(quant_table[i] != quant_table[i-1]){
506. put_symbol(c, state, i-last-1, 0);
libavcodec/ffv1.c:504:9: Assignment
502. memset(state, 128, sizeof(state));
503.
504. for(i=1; i<128 ; i++){
^
505. if(quant_table[i] != quant_table[i-1]){
506. put_symbol(c, state, i-last-1, 0);
libavcodec/ffv1.c:498:1: <Length trace>
496. }
497.
498. static void write_quant_table(RangeCoder *c, int16_t *quant_table){
^
499. int last=0;
500. int i;
libavcodec/ffv1.c:498:1: Parameter `*quant_table`
496. }
497.
498. static void write_quant_table(RangeCoder *c, int16_t *quant_table){
^
499. int last=0;
500. int i;
libavcodec/ffv1.c:505:12: Array access: Offset: [1, 131] (⇐ [0, 4] + [1, 127]) Size: 5 by call to `write_quant_table`
503.
504. for(i=1; i<128 ; i++){
505. if(quant_table[i] != quant_table[i-1]){
^
506. put_symbol(c, state, i-last-1, 0);
507. last= i;
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ffv1.c/#L505 |
d2a_code_trace_data_41460 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/ec/ecdsa_ossl.c:337: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `BN_mod_mul`.
Showing all 16 steps of the trace
crypto/ec/ecdsa_ossl.c:239:5: Call
237. }
238.
239. BN_CTX_start(ctx);
^
240. tmp = BN_CTX_get(ctx);
241. m = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/ec/ecdsa_ossl.c:337:14: Call
335.
336. /* s := s * k^-1 mod order */
337. if (!BN_mod_mul(s, s, ckinv, order, ctx)) {
^
338. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB);
339. goto err;
crypto/bn/bn_mod.c:73:1: Parameter `ctx->stack.depth`
71.
72. /* slow but works */
73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
74. BN_CTX *ctx)
75. {
crypto/bn/bn_mod.c:83:5: Call
81. bn_check_top(m);
82.
83. BN_CTX_start(ctx);
^
84. if ((t = BN_CTX_get(ctx)) == NULL)
85. goto err;
crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_mod.c:90:14: Call
88. goto err;
89. } else {
90. if (!BN_mul(t, a, b, ctx))
^
91. goto err;
92. }
crypto/bn/bn_mul.c:497:1: Parameter `ctx->stack.depth`
495. #endif /* BN_RECURSION */
496.
497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
498. {
499. int ret = 0;
crypto/bn/bn_mul.c:523:5: Call
521. top = al + bl;
522.
523. BN_CTX_start(ctx);
^
524. if ((r == a) || (r == b)) {
525. if ((rr = BN_CTX_get(ctx)) == NULL)
crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_mul.c:608:5: Call
606. err:
607. bn_check_top(r);
608. BN_CTX_end(ctx);
^
609. return ret;
610. }
crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.depth`
193. }
194.
195. > void BN_CTX_end(BN_CTX *ctx)
196. {
197. CTXDBG_ENTRY("BN_CTX_end", ctx);
crypto/bn/bn_ctx.c:201:27: Call
199. ctx->err_stack--;
200. else {
201. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
202. /* Does this stack frame have anything to release? */
203. if (fp < ctx->used)
crypto/bn/bn_ctx.c:274:1: <LHS trace>
272. }
273.
274. > static unsigned int BN_STACK_pop(BN_STACK *st)
275. {
276. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:274:1: Parameter `st->depth`
272. }
273.
274. > static unsigned int BN_STACK_pop(BN_STACK *st)
275. {
276. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:276:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_mul`
274. static unsigned int BN_STACK_pop(BN_STACK *st)
275. {
276. return st->indexes[--(st->depth)];
^
277. }
278.
| https://github.com/openssl/openssl/blob/ddb634fe6f9aeea34fe036cf804903b4240d38ac/crypto/bn/bn_ctx.c/#L276 |
d2a_code_trace_data_41461 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/ec/ecp_mont.c:231: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set`.
Showing all 23 steps of the trace
crypto/ec/ecp_mont.c:204:1: Parameter `ctx->stack.depth`
202.
203.
204. > int ec_GFp_mont_group_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
205. {
206. BN_CTX *new_ctx = NULL;
crypto/ec/ecp_mont.c:231:7: Call
229. mont = BN_MONT_CTX_new();
230. if (mont == NULL) goto err;
231. if (!BN_MONT_CTX_set(mont, p, ctx))
^
232. {
233. ECerr(EC_F_EC_GFP_MONT_GROUP_SET_CURVE, ERR_R_BN_LIB);
crypto/bn/bn_mont.c:355:1: Parameter `ctx->stack.depth`
353. }
354.
355. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
356. {
357. int ret = 0;
crypto/bn/bn_mont.c:360:2: Call
358. BIGNUM *Ri,*R;
359.
360. BN_CTX_start(ctx);
^
361. if((Ri = BN_CTX_get(ctx)) == NULL) goto err;
362. R= &(mont->RR); /* grab RR as a temp */
crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth`
253. }
254.
255. > void BN_CTX_start(BN_CTX *ctx)
256. {
257. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_mont.c:421:8: Call
419. tmod.top = buf[0] != 0 ? 1 : 0;
420. /* Ri = R^-1 mod N*/
421. if ((BN_mod_inverse(Ri,R,&tmod,ctx)) == NULL)
^
422. goto err;
423. if (!BN_lshift(Ri,Ri,BN_BITS2)) goto err; /* R*Ri */
crypto/bn/bn_gcd.c:209:1: Parameter `ctx->stack.depth`
207. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx);
208.
209. > BIGNUM *BN_mod_inverse(BIGNUM *in,
210. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx)
211. {
crypto/bn/bn_gcd.c:218:10: Call
216. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0))
217. {
218. return BN_mod_inverse_no_branch(in, a, n, ctx);
^
219. }
220.
crypto/bn/bn_gcd.c:507:1: Parameter `ctx->stack.depth`
505. * It does not contain branches that may leak sensitive information.
506. */
507. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in,
508. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx)
509. {
crypto/bn/bn_gcd.c:519:2: Call
517. bn_check_top(n);
518.
519. BN_CTX_start(ctx);
^
520. A = BN_CTX_get(ctx);
521. B = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth`
253. }
254.
255. > void BN_CTX_start(BN_CTX *ctx)
256. {
257. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_gcd.c:548:8: Call
546. pB = &local_B;
547. BN_with_flags(pB, B, BN_FLG_CONSTTIME);
548. if (!BN_nnmod(B, pB, A, ctx)) goto err;
^
549. }
550. sign = -1;
crypto/bn/bn_mod.c:127:1: Parameter `ctx->stack.depth`
125.
126.
127. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
128. {
129. /* like BN_mod, but returns non-negative remainder
crypto/bn/bn_mod.c:132:8: Call
130. * (i.e., 0 <= r < |d| always holds) */
131.
132. if (!(BN_mod(r,m,d,ctx)))
^
133. return 0;
134. if (!r->neg)
crypto/bn/bn_div.c:181:1: Parameter `ctx->stack.depth`
179. * If 'dv' or 'rm' is NULL, the respective value is not returned.
180. */
181. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
182. BN_CTX *ctx)
183. {
crypto/bn/bn_div.c:226:2: Call
224. }
225.
226. BN_CTX_start(ctx);
^
227. tmp=BN_CTX_get(ctx);
228. snum=BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth`
253. }
254.
255. > void BN_CTX_start(BN_CTX *ctx)
256. {
257. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_div.c:441:2: Call
439. }
440. if (no_branch) bn_correct_top(res);
441. BN_CTX_end(ctx);
^
442. return(1);
443. err:
crypto/bn/bn_ctx.c:270:1: Parameter `ctx->stack.depth`
268. }
269.
270. > void BN_CTX_end(BN_CTX *ctx)
271. {
272. CTXDBG_ENTRY("BN_CTX_end", ctx);
crypto/bn/bn_ctx.c:277:21: Call
275. else
276. {
277. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
278. /* Does this stack frame have anything to release? */
279. if(fp < ctx->used)
crypto/bn/bn_ctx.c:351:1: <LHS trace>
349. }
350.
351. > static unsigned int BN_STACK_pop(BN_STACK *st)
352. {
353. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:351:1: Parameter `st->depth`
349. }
350.
351. > static unsigned int BN_STACK_pop(BN_STACK *st)
352. {
353. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:353:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set`
351. static unsigned int BN_STACK_pop(BN_STACK *st)
352. {
353. return st->indexes[--(st->depth)];
^
354. }
355.
| https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/bn/bn_ctx.c/#L353 |
d2a_code_trace_data_41462 | static int escape130_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *avpkt)
{
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
Escape130Context *s = avctx->priv_data;
AVFrame *pic = data;
GetBitContext gb;
int ret;
uint8_t *old_y, *old_cb, *old_cr,
*new_y, *new_cb, *new_cr;
uint8_t *dstY, *dstU, *dstV;
unsigned old_y_stride, old_cb_stride, old_cr_stride,
new_y_stride, new_cb_stride, new_cr_stride;
unsigned total_blocks = avctx->width * avctx->height / 4,
block_index, block_x = 0;
unsigned y[4] = { 0 }, cb = 0x10, cr = 0x10;
int skip = -1, y_avg = 0, i, j;
uint8_t *ya = s->old_y_avg;
if (buf_size <= 16) {
av_log(avctx, AV_LOG_ERROR, "Insufficient frame data\n");
return AVERROR_INVALIDDATA;
}
if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
return ret;
init_get_bits(&gb, buf + 16, (buf_size - 16) * 8);
new_y = s->new_y;
new_cb = s->new_u;
new_cr = s->new_v;
new_y_stride = s->linesize[0];
new_cb_stride = s->linesize[1];
new_cr_stride = s->linesize[2];
old_y = s->old_y;
old_cb = s->old_u;
old_cr = s->old_v;
old_y_stride = s->linesize[0];
old_cb_stride = s->linesize[1];
old_cr_stride = s->linesize[2];
for (block_index = 0; block_index < total_blocks; block_index++) {
if (skip == -1)
skip = decode_skip_count(&gb);
if (skip == -1) {
av_log(avctx, AV_LOG_ERROR, "Error decoding skip value\n");
return AVERROR_INVALIDDATA;
}
if (skip) {
y[0] = old_y[0];
y[1] = old_y[1];
y[2] = old_y[old_y_stride];
y[3] = old_y[old_y_stride + 1];
y_avg = ya[0];
cb = old_cb[0];
cr = old_cr[0];
} else {
if (get_bits1(&gb)) {
unsigned sign_selector = get_bits(&gb, 6);
unsigned difference_selector = get_bits(&gb, 2);
y_avg = 2 * get_bits(&gb, 5);
for (i = 0; i < 4; i++) {
y[i] = av_clip(y_avg + offset_table[difference_selector] *
sign_table[sign_selector][i], 0, 63);
}
} else if (get_bits1(&gb)) {
if (get_bits1(&gb)) {
y_avg = get_bits(&gb, 6);
} else {
unsigned adjust_index = get_bits(&gb, 3);
y_avg = (y_avg + luma_adjust[adjust_index]) & 63;
}
for (i = 0; i < 4; i++)
y[i] = y_avg;
}
if (get_bits1(&gb)) {
if (get_bits1(&gb)) {
cb = get_bits(&gb, 5);
cr = get_bits(&gb, 5);
} else {
unsigned adjust_index = get_bits(&gb, 3);
cb = (cb + chroma_adjust[0][adjust_index]) & 31;
cr = (cr + chroma_adjust[1][adjust_index]) & 31;
}
}
}
*ya++ = y_avg;
new_y[0] = y[0];
new_y[1] = y[1];
new_y[new_y_stride] = y[2];
new_y[new_y_stride + 1] = y[3];
*new_cb = cb;
*new_cr = cr;
old_y += 2;
old_cb++;
old_cr++;
new_y += 2;
new_cb++;
new_cr++;
block_x++;
if (block_x * 2 == avctx->width) {
block_x = 0;
old_y += old_y_stride * 2 - avctx->width;
old_cb += old_cb_stride - avctx->width / 2;
old_cr += old_cr_stride - avctx->width / 2;
new_y += new_y_stride * 2 - avctx->width;
new_cb += new_cb_stride - avctx->width / 2;
new_cr += new_cr_stride - avctx->width / 2;
}
skip--;
}
new_y = s->new_y;
new_cb = s->new_u;
new_cr = s->new_v;
dstY = pic->data[0];
dstU = pic->data[1];
dstV = pic->data[2];
for (j = 0; j < avctx->height; j++) {
for (i = 0; i < avctx->width; i++)
dstY[i] = new_y[i] << 2;
dstY += pic->linesize[0];
new_y += new_y_stride;
}
for (j = 0; j < avctx->height / 2; j++) {
for (i = 0; i < avctx->width / 2; i++) {
dstU[i] = chroma_vals[new_cb[i]];
dstV[i] = chroma_vals[new_cr[i]];
}
dstU += pic->linesize[1];
dstV += pic->linesize[2];
new_cb += new_cb_stride;
new_cr += new_cr_stride;
}
av_dlog(avctx, "Frame data: provided %d bytes, used %d bytes\n",
buf_size, get_bits_count(&gb) >> 3);
FFSWAP(uint8_t*, s->old_y, s->new_y);
FFSWAP(uint8_t*, s->old_u, s->new_u);
FFSWAP(uint8_t*, s->old_v, s->new_v);
*got_frame = 1;
return buf_size;
}
libavcodec/escape130.c:237: error: Null Dereference
pointer `&gb->buffer` last assigned on line 218 could be null and is dereferenced by call to `decode_skip_count()` at line 237, column 20.
libavcodec/escape130.c:188:1: start of procedure escape130_decode_frame()
186. }
187.
188. static int escape130_decode_frame(AVCodecContext *avctx, void *data,
^
189. int *got_frame, AVPacket *avpkt)
190. {
libavcodec/escape130.c:191:5:
189. int *got_frame, AVPacket *avpkt)
190. {
191. const uint8_t *buf = avpkt->data;
^
192. int buf_size = avpkt->size;
193. Escape130Context *s = avctx->priv_data;
libavcodec/escape130.c:192:5:
190. {
191. const uint8_t *buf = avpkt->data;
192. int buf_size = avpkt->size;
^
193. Escape130Context *s = avctx->priv_data;
194. AVFrame *pic = data;
libavcodec/escape130.c:193:5:
191. const uint8_t *buf = avpkt->data;
192. int buf_size = avpkt->size;
193. Escape130Context *s = avctx->priv_data;
^
194. AVFrame *pic = data;
195. GetBitContext gb;
libavcodec/escape130.c:194:5:
192. int buf_size = avpkt->size;
193. Escape130Context *s = avctx->priv_data;
194. AVFrame *pic = data;
^
195. GetBitContext gb;
196. int ret;
libavcodec/escape130.c:203:5:
201. unsigned old_y_stride, old_cb_stride, old_cr_stride,
202. new_y_stride, new_cb_stride, new_cr_stride;
203. unsigned total_blocks = avctx->width * avctx->height / 4,
^
204. block_index, block_x = 0;
205. unsigned y[4] = { 0 }, cb = 0x10, cr = 0x10;
libavcodec/escape130.c:205:5:
203. unsigned total_blocks = avctx->width * avctx->height / 4,
204. block_index, block_x = 0;
205. unsigned y[4] = { 0 }, cb = 0x10, cr = 0x10;
^
206. int skip = -1, y_avg = 0, i, j;
207. uint8_t *ya = s->old_y_avg;
libavcodec/escape130.c:206:5:
204. block_index, block_x = 0;
205. unsigned y[4] = { 0 }, cb = 0x10, cr = 0x10;
206. int skip = -1, y_avg = 0, i, j;
^
207. uint8_t *ya = s->old_y_avg;
208.
libavcodec/escape130.c:207:5:
205. unsigned y[4] = { 0 }, cb = 0x10, cr = 0x10;
206. int skip = -1, y_avg = 0, i, j;
207. uint8_t *ya = s->old_y_avg;
^
208.
209. // first 16 bytes are header; no useful information in here
libavcodec/escape130.c:210:9: Taking false branch
208.
209. // first 16 bytes are header; no useful information in here
210. if (buf_size <= 16) {
^
211. av_log(avctx, AV_LOG_ERROR, "Insufficient frame data\n");
212. return AVERROR_INVALIDDATA;
libavcodec/escape130.c:215:9: Taking false branch
213. }
214.
215. if ((ret = ff_get_buffer(avctx, pic, 0)) < 0)
^
216. return ret;
217.
libavcodec/escape130.c:218:5:
216. return ret;
217.
218. init_get_bits(&gb, buf + 16, (buf_size - 16) * 8);
^
219.
220. new_y = s->new_y;
libavcodec/get_bits.h:376:1: start of procedure init_get_bits()
374. * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow.
375. */
376. static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer,
^
377. int bit_size)
378. {
libavcodec/get_bits.h:380:5:
378. {
379. int buffer_size;
380. int ret = 0;
^
381.
382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
libavcodec/get_bits.h:382:9: Taking true branch
380. int ret = 0;
381.
382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
^
383. bit_size = 0;
384. buffer = NULL;
libavcodec/get_bits.h:383:9:
381.
382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
383. bit_size = 0;
^
384. buffer = NULL;
385. ret = AVERROR_INVALIDDATA;
libavcodec/get_bits.h:384:9:
382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) {
383. bit_size = 0;
384. buffer = NULL;
^
385. ret = AVERROR_INVALIDDATA;
386. }
libavcodec/get_bits.h:385:9:
383. bit_size = 0;
384. buffer = NULL;
385. ret = AVERROR_INVALIDDATA;
^
386. }
387.
libavcodec/get_bits.h:388:5:
386. }
387.
388. buffer_size = (bit_size + 7) >> 3;
^
389.
390. s->buffer = buffer;
libavcodec/get_bits.h:390:5:
388. buffer_size = (bit_size + 7) >> 3;
389.
390. s->buffer = buffer;
^
391. s->size_in_bits = bit_size;
392. #if !UNCHECKED_BITSTREAM_READER
libavcodec/get_bits.h:391:5:
389.
390. s->buffer = buffer;
391. s->size_in_bits = bit_size;
^
392. #if !UNCHECKED_BITSTREAM_READER
393. s->size_in_bits_plus8 = bit_size + 8;
libavcodec/get_bits.h:393:5:
391. s->size_in_bits = bit_size;
392. #if !UNCHECKED_BITSTREAM_READER
393. s->size_in_bits_plus8 = bit_size + 8;
^
394. #endif
395. s->buffer_end = buffer + buffer_size;
libavcodec/get_bits.h:395:5:
393. s->size_in_bits_plus8 = bit_size + 8;
394. #endif
395. s->buffer_end = buffer + buffer_size;
^
396. s->index = 0;
397.
libavcodec/get_bits.h:396:5:
394. #endif
395. s->buffer_end = buffer + buffer_size;
396. s->index = 0;
^
397.
398. return ret;
libavcodec/get_bits.h:398:5:
396. s->index = 0;
397.
398. return ret;
^
399. }
400.
libavcodec/get_bits.h:399:1: return from a call to init_get_bits
397.
398. return ret;
399. }
^
400.
401. /**
libavcodec/escape130.c:220:5:
218. init_get_bits(&gb, buf + 16, (buf_size - 16) * 8);
219.
220. new_y = s->new_y;
^
221. new_cb = s->new_u;
222. new_cr = s->new_v;
libavcodec/escape130.c:221:5:
219.
220. new_y = s->new_y;
221. new_cb = s->new_u;
^
222. new_cr = s->new_v;
223. new_y_stride = s->linesize[0];
libavcodec/escape130.c:222:5:
220. new_y = s->new_y;
221. new_cb = s->new_u;
222. new_cr = s->new_v;
^
223. new_y_stride = s->linesize[0];
224. new_cb_stride = s->linesize[1];
libavcodec/escape130.c:223:5:
221. new_cb = s->new_u;
222. new_cr = s->new_v;
223. new_y_stride = s->linesize[0];
^
224. new_cb_stride = s->linesize[1];
225. new_cr_stride = s->linesize[2];
libavcodec/escape130.c:224:5:
222. new_cr = s->new_v;
223. new_y_stride = s->linesize[0];
224. new_cb_stride = s->linesize[1];
^
225. new_cr_stride = s->linesize[2];
226. old_y = s->old_y;
libavcodec/escape130.c:225:5:
223. new_y_stride = s->linesize[0];
224. new_cb_stride = s->linesize[1];
225. new_cr_stride = s->linesize[2];
^
226. old_y = s->old_y;
227. old_cb = s->old_u;
libavcodec/escape130.c:226:5:
224. new_cb_stride = s->linesize[1];
225. new_cr_stride = s->linesize[2];
226. old_y = s->old_y;
^
227. old_cb = s->old_u;
228. old_cr = s->old_v;
libavcodec/escape130.c:227:5:
225. new_cr_stride = s->linesize[2];
226. old_y = s->old_y;
227. old_cb = s->old_u;
^
228. old_cr = s->old_v;
229. old_y_stride = s->linesize[0];
libavcodec/escape130.c:228:5:
226. old_y = s->old_y;
227. old_cb = s->old_u;
228. old_cr = s->old_v;
^
229. old_y_stride = s->linesize[0];
230. old_cb_stride = s->linesize[1];
libavcodec/escape130.c:229:5:
227. old_cb = s->old_u;
228. old_cr = s->old_v;
229. old_y_stride = s->linesize[0];
^
230. old_cb_stride = s->linesize[1];
231. old_cr_stride = s->linesize[2];
libavcodec/escape130.c:230:5:
228. old_cr = s->old_v;
229. old_y_stride = s->linesize[0];
230. old_cb_stride = s->linesize[1];
^
231. old_cr_stride = s->linesize[2];
232.
libavcodec/escape130.c:231:5:
229. old_y_stride = s->linesize[0];
230. old_cb_stride = s->linesize[1];
231. old_cr_stride = s->linesize[2];
^
232.
233. for (block_index = 0; block_index < total_blocks; block_index++) {
libavcodec/escape130.c:233:10:
231. old_cr_stride = s->linesize[2];
232.
233. for (block_index = 0; block_index < total_blocks; block_index++) {
^
234. // Note that this call will make us skip the rest of the blocks
235. // if the frame ends prematurely.
libavcodec/escape130.c:233:27: Loop condition is true. Entering loop body
231. old_cr_stride = s->linesize[2];
232.
233. for (block_index = 0; block_index < total_blocks; block_index++) {
^
234. // Note that this call will make us skip the rest of the blocks
235. // if the frame ends prematurely.
libavcodec/escape130.c:236:13: Taking true branch
234. // Note that this call will make us skip the rest of the blocks
235. // if the frame ends prematurely.
236. if (skip == -1)
^
237. skip = decode_skip_count(&gb);
238. if (skip == -1) {
libavcodec/escape130.c:237:13:
235. // if the frame ends prematurely.
236. if (skip == -1)
237. skip = decode_skip_count(&gb);
^
238. if (skip == -1) {
239. av_log(avctx, AV_LOG_ERROR, "Error decoding skip value\n");
libavcodec/escape130.c:165:1: start of procedure decode_skip_count()
163. }
164.
165. static int decode_skip_count(GetBitContext* gb)
^
166. {
167. int value;
libavcodec/escape130.c:169:5:
167. int value;
168.
169. value = get_bits1(gb);
^
170. if (value)
171. return 0;
libavcodec/get_bits.h:272:1: start of procedure get_bits1()
270. }
271.
272. static inline unsigned int get_bits1(GetBitContext *s)
^
273. {
274. unsigned int index = s->index;
libavcodec/get_bits.h:274:5:
272. static inline unsigned int get_bits1(GetBitContext *s)
273. {
274. unsigned int index = s->index;
^
275. uint8_t result = s->buffer[index >> 3];
276. #ifdef BITSTREAM_READER_LE
libavcodec/get_bits.h:275:5:
273. {
274. unsigned int index = s->index;
275. uint8_t result = s->buffer[index >> 3];
^
276. #ifdef BITSTREAM_READER_LE
277. result >>= index & 7;
| https://github.com/libav/libav/blob/77ab341c0c6cdf2bd437bb48d429e797d1e60da2/libavcodec/escape130.c/#L237 |
d2a_code_trace_data_41463 | static int do_multi(int multi)
{
int n;
int fd[2];
int *fds;
static char sep[]=":";
fds=malloc(multi*sizeof *fds);
for(n=0 ; n < multi ; ++n)
{
if (pipe(fd) == -1)
{
fprintf(stderr, "pipe failure\n");
exit(1);
}
fflush(stdout);
fflush(stderr);
if(fork())
{
close(fd[1]);
fds[n]=fd[0];
}
else
{
close(fd[0]);
close(1);
if (dup(fd[1]) == -1)
{
fprintf(stderr, "dup failed\n");
exit(1);
}
close(fd[1]);
mr=1;
usertime=0;
free(fds);
return 0;
}
printf("Forked child %d\n",n);
}
for(n=0 ; n < multi ; ++n)
{
FILE *f;
char buf[1024];
char *p;
f=fdopen(fds[n],"r");
while(fgets(buf,sizeof buf,f))
{
p=strchr(buf,'\n');
if(p)
*p='\0';
if(buf[0] != '+')
{
fprintf(stderr,"Don't understand line '%s' from child %d\n",
buf,n);
continue;
}
printf("Got: %s from %d\n",buf,n);
if(!strncmp(buf,"+F:",3))
{
int alg;
int j;
p=buf+3;
alg=atoi(sstrsep(&p,sep));
sstrsep(&p,sep);
for(j=0 ; j < SIZE_NUM ; ++j)
results[alg][j]+=atof(sstrsep(&p,sep));
}
else if(!strncmp(buf,"+F2:",4))
{
int k;
double d;
p=buf+4;
k=atoi(sstrsep(&p,sep));
sstrsep(&p,sep);
d=atof(sstrsep(&p,sep));
if(n)
rsa_results[k][0]=1/(1/rsa_results[k][0]+1/d);
else
rsa_results[k][0]=d;
d=atof(sstrsep(&p,sep));
if(n)
rsa_results[k][1]=1/(1/rsa_results[k][1]+1/d);
else
rsa_results[k][1]=d;
}
else if(!strncmp(buf,"+F2:",4))
{
int k;
double d;
p=buf+4;
k=atoi(sstrsep(&p,sep));
sstrsep(&p,sep);
d=atof(sstrsep(&p,sep));
if(n)
rsa_results[k][0]=1/(1/rsa_results[k][0]+1/d);
else
rsa_results[k][0]=d;
d=atof(sstrsep(&p,sep));
if(n)
rsa_results[k][1]=1/(1/rsa_results[k][1]+1/d);
else
rsa_results[k][1]=d;
}
#ifndef OPENSSL_NO_DSA
else if(!strncmp(buf,"+F3:",4))
{
int k;
double d;
p=buf+4;
k=atoi(sstrsep(&p,sep));
sstrsep(&p,sep);
d=atof(sstrsep(&p,sep));
if(n)
dsa_results[k][0]=1/(1/dsa_results[k][0]+1/d);
else
dsa_results[k][0]=d;
d=atof(sstrsep(&p,sep));
if(n)
dsa_results[k][1]=1/(1/dsa_results[k][1]+1/d);
else
dsa_results[k][1]=d;
}
#endif
#ifndef OPENSSL_NO_ECDSA
else if(!strncmp(buf,"+F4:",4))
{
int k;
double d;
p=buf+4;
k=atoi(sstrsep(&p,sep));
sstrsep(&p,sep);
d=atof(sstrsep(&p,sep));
if(n)
ecdsa_results[k][0]=1/(1/ecdsa_results[k][0]+1/d);
else
ecdsa_results[k][0]=d;
d=atof(sstrsep(&p,sep));
if(n)
ecdsa_results[k][1]=1/(1/ecdsa_results[k][1]+1/d);
else
ecdsa_results[k][1]=d;
}
#endif
#ifndef OPENSSL_NO_ECDH
else if(!strncmp(buf,"+F5:",4))
{
int k;
double d;
p=buf+4;
k=atoi(sstrsep(&p,sep));
sstrsep(&p,sep);
d=atof(sstrsep(&p,sep));
if(n)
ecdh_results[k][0]=1/(1/ecdh_results[k][0]+1/d);
else
ecdh_results[k][0]=d;
}
#endif
else if(!strncmp(buf,"+H:",3))
{
}
else
fprintf(stderr,"Unknown type '%s' from child %d\n",buf,n);
}
fclose(f);
}
free(fds);
return 1;
}
apps/speed.c:2760: error: NULL_DEREFERENCE
pointer `fds` last assigned on line 2747 could be null and is dereferenced at line 2760, column 4.
Showing all 11 steps of the trace
apps/speed.c:2740:1: start of procedure do_multi()
2738. }
2739.
2740. > static int do_multi(int multi)
2741. {
2742. int n;
apps/speed.c:2745:2:
2743. int fd[2];
2744. int *fds;
2745. > static char sep[]=":";
2746.
2747. fds=malloc(multi*sizeof *fds);
apps/speed.c:2747:2:
2745. static char sep[]=":";
2746.
2747. > fds=malloc(multi*sizeof *fds);
2748. for(n=0 ; n < multi ; ++n)
2749. {
apps/speed.c:2748:6:
2746.
2747. fds=malloc(multi*sizeof *fds);
2748. > for(n=0 ; n < multi ; ++n)
2749. {
2750. if (pipe(fd) == -1)
apps/speed.c:2748:12: Loop condition is true. Entering loop body
2746.
2747. fds=malloc(multi*sizeof *fds);
2748. for(n=0 ; n < multi ; ++n)
^
2749. {
2750. if (pipe(fd) == -1)
apps/speed.c:2750:7: Taking false branch
2748. for(n=0 ; n < multi ; ++n)
2749. {
2750. if (pipe(fd) == -1)
^
2751. {
2752. fprintf(stderr, "pipe failure\n");
apps/speed.c:2755:3:
2753. exit(1);
2754. }
2755. > fflush(stdout);
2756. fflush(stderr);
2757. if(fork())
apps/speed.c:2756:3:
2754. }
2755. fflush(stdout);
2756. > fflush(stderr);
2757. if(fork())
2758. {
apps/speed.c:2757:6: Taking true branch
2755. fflush(stdout);
2756. fflush(stderr);
2757. if(fork())
^
2758. {
2759. close(fd[1]);
apps/speed.c:2759:4:
2757. if(fork())
2758. {
2759. > close(fd[1]);
2760. fds[n]=fd[0];
2761. }
apps/speed.c:2760:4:
2758. {
2759. close(fd[1]);
2760. > fds[n]=fd[0];
2761. }
2762. else
| https://github.com/openssl/openssl/blob/7e965dcc3812ac6ec4d1413c5ea3224be6486c8f/apps/speed.c/#L2760 |
d2a_code_trace_data_41464 | static int fill_default_ref_list(H264Context *h){
MpegEncContext * const s = &h->s;
int i;
int smallest_poc_greater_than_current = -1;
int structure_sel;
Picture sorted_short_ref[32];
Picture field_entry_list[2][32];
Picture *frame_list[2];
if (FIELD_PICTURE) {
structure_sel = PICT_FRAME;
frame_list[0] = field_entry_list[0];
frame_list[1] = field_entry_list[1];
} else {
structure_sel = 0;
frame_list[0] = h->default_ref_list[0];
frame_list[1] = h->default_ref_list[1];
}
if(h->slice_type==FF_B_TYPE){
int list;
int len[2];
int short_len[2];
int out_i;
int limit= INT_MIN;
for(out_i=0; out_i<h->short_ref_count; out_i++){
int best_i=INT_MIN;
int best_poc=INT_MAX;
for(i=0; i<h->short_ref_count; i++){
const int poc= h->short_ref[i]->poc;
if(poc > limit && poc < best_poc){
best_poc= poc;
best_i= i;
}
}
assert(best_i != INT_MIN);
limit= best_poc;
sorted_short_ref[out_i]= *h->short_ref[best_i];
tprintf(h->s.avctx, "sorted poc: %d->%d poc:%d fn:%d\n", best_i, out_i, sorted_short_ref[out_i].poc, sorted_short_ref[out_i].frame_num);
if (-1 == smallest_poc_greater_than_current) {
if (h->short_ref[best_i]->poc >= s->current_picture_ptr->poc) {
smallest_poc_greater_than_current = out_i;
}
}
}
tprintf(h->s.avctx, "current poc: %d, smallest_poc_greater_than_current: %d\n", s->current_picture_ptr->poc, smallest_poc_greater_than_current);
for(list=0; list<2; list++){
int index = 0;
int j= -99;
int step= list ? -1 : 1;
for(i=0; i<h->short_ref_count && index < h->ref_count[list]; i++, j+=step) {
int sel;
while(j<0 || j>= h->short_ref_count){
if(j != -99 && step == (list ? -1 : 1))
return -1;
step = -step;
j= smallest_poc_greater_than_current + (step>>1);
}
sel = sorted_short_ref[j].reference | structure_sel;
if(sel != PICT_FRAME) continue;
frame_list[list][index ]= sorted_short_ref[j];
frame_list[list][index++].pic_id= sorted_short_ref[j].frame_num;
}
short_len[list] = index;
for(i = 0; i < 16 && index < h->ref_count[ list ]; i++){
int sel;
if(h->long_ref[i] == NULL) continue;
sel = h->long_ref[i]->reference | structure_sel;
if(sel != PICT_FRAME) continue;
frame_list[ list ][index ]= *h->long_ref[i];
frame_list[ list ][index++].pic_id= i;
}
len[list] = index;
}
for(list=0; list<2; list++){
if (FIELD_PICTURE)
len[list] = split_field_ref_list(h->default_ref_list[list],
h->ref_count[list],
frame_list[list],
len[list],
s->picture_structure,
short_len[list]);
if(list && len[0] > 1 && len[0] == len[1])
for(i=0; h->default_ref_list[0][i].data[0] == h->default_ref_list[1][i].data[0]; i++)
if(i == len[0]){
FFSWAP(Picture, h->default_ref_list[1][0], h->default_ref_list[1][1]);
break;
}
if(len[list] < h->ref_count[ list ])
memset(&h->default_ref_list[list][len[list]], 0, sizeof(Picture)*(h->ref_count[ list ] - len[list]));
}
}else{
int index=0;
int short_len;
for(i=0; i<h->short_ref_count; i++){
int sel;
sel = h->short_ref[i]->reference | structure_sel;
if(sel != PICT_FRAME) continue;
frame_list[0][index ]= *h->short_ref[i];
frame_list[0][index++].pic_id= h->short_ref[i]->frame_num;
}
short_len = index;
for(i = 0; i < 16; i++){
int sel;
if(h->long_ref[i] == NULL) continue;
sel = h->long_ref[i]->reference | structure_sel;
if(sel != PICT_FRAME) continue;
frame_list[0][index ]= *h->long_ref[i];
frame_list[0][index++].pic_id= i;
}
if (FIELD_PICTURE)
index = split_field_ref_list(h->default_ref_list[0],
h->ref_count[0], frame_list[0],
index, s->picture_structure,
short_len);
if(index < h->ref_count[0])
memset(&h->default_ref_list[0][index], 0, sizeof(Picture)*(h->ref_count[0] - index));
}
#ifdef TRACE
for (i=0; i<h->ref_count[0]; i++) {
tprintf(h->s.avctx, "List0: %s fn:%d 0x%p\n", (h->default_ref_list[0][i].long_ref ? "LT" : "ST"), h->default_ref_list[0][i].pic_id, h->default_ref_list[0][i].data[0]);
}
if(h->slice_type==FF_B_TYPE){
for (i=0; i<h->ref_count[1]; i++) {
tprintf(h->s.avctx, "List1: %s fn:%d 0x%p\n", (h->default_ref_list[1][i].long_ref ? "LT" : "ST"), h->default_ref_list[1][i].pic_id, h->default_ref_list[1][i].data[0]);
}
}
#endif
return 0;
}
libavcodec/h264.c:2930: error: Uninitialized Value
The value read from short_len[_] was never initialized.
libavcodec/h264.c:2930:29:
2928. for(list=0; list<2; list++){
2929. if (FIELD_PICTURE)
2930. len[list] = split_field_ref_list(h->default_ref_list[list],
^
2931. h->ref_count[list],
2932. frame_list[list],
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L2930 |
d2a_code_trace_data_41465 | static int nss_keylog_int(const char *prefix,
SSL *ssl,
const uint8_t *parameter_1,
size_t parameter_1_len,
const uint8_t *parameter_2,
size_t parameter_2_len)
{
char *out = NULL;
char *cursor = NULL;
size_t out_len = 0;
size_t i;
size_t prefix_len;
if (ssl->ctx->keylog_callback == NULL)
return 1;
prefix_len = strlen(prefix);
out_len = prefix_len + (2 * parameter_1_len) + (2 * parameter_2_len) + 3;
if ((out = cursor = OPENSSL_malloc(out_len)) == NULL) {
SSLfatal(ssl, SSL_AD_INTERNAL_ERROR, SSL_F_NSS_KEYLOG_INT,
ERR_R_MALLOC_FAILURE);
return 0;
}
strcpy(cursor, prefix);
cursor += prefix_len;
*cursor++ = ' ';
for (i = 0; i < parameter_1_len; i++) {
sprintf(cursor, "%02x", parameter_1[i]);
cursor += 2;
}
*cursor++ = ' ';
for (i = 0; i < parameter_2_len; i++) {
sprintf(cursor, "%02x", parameter_2[i]);
cursor += 2;
}
*cursor = '\0';
ssl->ctx->keylog_callback(ssl, (const char *)out);
OPENSSL_clear_free(out, out_len);
return 1;
}
ssl/ssl_lib.c:5134: error: BUFFER_OVERRUN_S2
Offset: [`prefix->strlen` + 1, +oo] Size: [1, 2⋅`parameter_2_len` + 2⋅`parameter_1_len` + `prefix->strlen` + 3].
Showing all 6 steps of the trace
ssl/ssl_lib.c:5094:1: <Length trace>
5092. }
5093.
5094. > static int nss_keylog_int(const char *prefix,
5095. SSL *ssl,
5096. const uint8_t *parameter_1,
ssl/ssl_lib.c:5094:1: Parameter `prefix->strlen`
5092. }
5093.
5094. > static int nss_keylog_int(const char *prefix,
5095. SSL *ssl,
5096. const uint8_t *parameter_1,
ssl/ssl_lib.c:5118:5: Assignment
5116. * hexadecimal, so we need a buffer that is twice their lengths.
5117. */
5118. prefix_len = strlen(prefix);
^
5119. out_len = prefix_len + (2 * parameter_1_len) + (2 * parameter_2_len) + 3;
5120. if ((out = cursor = OPENSSL_malloc(out_len)) == NULL) {
ssl/ssl_lib.c:5127:5: Assignment
5125.
5126. strcpy(cursor, prefix);
5127. cursor += prefix_len;
^
5128. *cursor++ = ' ';
5129.
ssl/ssl_lib.c:5128:6: Assignment
5126. strcpy(cursor, prefix);
5127. cursor += prefix_len;
5128. *cursor++ = ' ';
^
5129.
5130. for (i = 0; i < parameter_1_len; i++) {
ssl/ssl_lib.c:5134:5: Array access: Offset: [prefix->strlen + 1, +oo] Size: [1, 2⋅parameter_2_len + 2⋅parameter_1_len + prefix->strlen + 3]
5132. cursor += 2;
5133. }
5134. *cursor++ = ' ';
^
5135.
5136. for (i = 0; i < parameter_2_len; i++) {
| https://github.com/openssl/openssl/blob/fb9c3ff565aa11b08646e0f9f28fc082ed365cbd/ssl/ssl_lib.c/#L5134 |
d2a_code_trace_data_41466 | static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg,
OPENSSL_LH_DOALL_FUNC func,
OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg)
{
int i;
OPENSSL_LH_NODE *a, *n;
if (lh == NULL)
return;
for (i = lh->num_nodes - 1; i >= 0; i--) {
a = lh->b[i];
while (a != NULL) {
n = a->next;
if (use_arg)
func_arg(a->data, arg);
else
func(a->data);
a = n;
}
}
}
test/sslapitest.c:1256: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `SSL_free`.
Showing all 19 steps of the trace
test/sslapitest.c:1095:10: Call
1093. numnewsesstick = 2;
1094.
1095. if (!TEST_true(create_ssl_ctx_pair(TLS_server_method(), TLS_client_method(),
^
1096. TLS1_VERSION, 0,
1097. &sctx, &cctx, cert, privkey)))
test/ssltestlib.c:619:10: Call
617. SSL_CTX *clientctx = NULL;
618.
619. if (!TEST_ptr(serverctx = SSL_CTX_new(sm))
^
620. || (cctx != NULL && !TEST_ptr(clientctx = SSL_CTX_new(cm))))
621. goto err;
ssl/ssl_lib.c:2942:21: Call
2940. goto err;
2941.
2942. ret->sessions = lh_SSL_SESSION_new(ssl_session_hash, ssl_session_cmp);
^
2943. if (ret->sessions == NULL)
2944. goto err;
ssl/ssl_locl.h:736:1: Call
734. } TLSEXT_INDEX;
735.
736. > DEFINE_LHASH_OF(SSL_SESSION);
737. /* Needed in ssl_cert.c */
738. DEFINE_LHASH_OF(X509_NAME);
crypto/lhash/lhash.c:63:5: Assignment
61. ret->comp = ((c == NULL) ? (OPENSSL_LH_COMPFUNC)strcmp : c);
62. ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h);
63. ret->num_nodes = MIN_NODES / 2;
^
64. ret->num_alloc_nodes = MIN_NODES;
65. ret->pmax = MIN_NODES / 2;
test/sslapitest.c:1256:5: Call
1254. | SSL_SESS_CACHE_NO_INTERNAL_STORE);
1255.
1256. SSL_free(serverssl1);
^
1257. SSL_free(clientssl1);
1258. serverssl1 = clientssl1 = NULL;
ssl/ssl_lib.c:1134:1: Parameter `s->ctx->sessions->num_nodes`
1132. }
1133.
1134. > void SSL_free(SSL *s)
1135. {
1136. int i;
ssl/ssl_lib.c:1209:5: Call
1207. s->method->ssl_free(s);
1208.
1209. SSL_CTX_free(s->ctx);
^
1210.
1211. ASYNC_WAIT_CTX_free(s->waitctx);
ssl/ssl_lib.c:3103:1: Parameter `a->sessions->num_nodes`
3101. }
3102.
3103. > void SSL_CTX_free(SSL_CTX *a)
3104. {
3105. int i;
ssl/ssl_lib.c:3129:9: Call
3127. */
3128. if (a->sessions != NULL)
3129. SSL_CTX_flush_sessions(a, 0);
^
3130.
3131. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data);
ssl/ssl_sess.c:1106:1: Parameter `s->sessions->num_nodes`
1104. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM);
1105.
1106. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t)
1107. {
1108. unsigned long i;
ssl/ssl_sess.c:1119:5: Call
1117. i = lh_SSL_SESSION_get_down_load(s->sessions);
1118. lh_SSL_SESSION_set_down_load(s->sessions, 0);
1119. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp);
^
1120. lh_SSL_SESSION_set_down_load(s->sessions, i);
1121. CRYPTO_THREAD_unlock(s->lock);
ssl/ssl_sess.c:1104:1: Parameter `lh->num_nodes`
1102. }
1103.
1104. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM);
1105.
1106. void SSL_CTX_flush_sessions(SSL_CTX *s, long t)
ssl/ssl_sess.c:1104:1: Call
1102. }
1103.
1104. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM);
1105.
1106. void SSL_CTX_flush_sessions(SSL_CTX *s, long t)
crypto/lhash/lhash.c:209:1: Parameter `lh->num_nodes`
207. }
208.
209. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg)
210. {
211. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg);
crypto/lhash/lhash.c:211:5: Call
209. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg)
210. {
211. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg);
^
212. }
213.
crypto/lhash/lhash.c:177:1: <LHS trace>
175. }
176.
177. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg,
178. OPENSSL_LH_DOALL_FUNC func,
179. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg)
crypto/lhash/lhash.c:177:1: Parameter `lh->num_nodes`
175. }
176.
177. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg,
178. OPENSSL_LH_DOALL_FUNC func,
179. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg)
crypto/lhash/lhash.c:191:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `SSL_free`
189. * memory leaks otherwise
190. */
191. for (i = lh->num_nodes - 1; i >= 0; i--) {
^
192. a = lh->b[i];
193. while (a != NULL) {
| https://github.com/openssl/openssl/blob/6e94b5aecd619afd25e3dc25902952b1b3194edf/crypto/lhash/lhash.c/#L191 |
d2a_code_trace_data_41467 | int tls1_set_sigalgs(CERT *c, const int *psig_nids, size_t salglen, int client)
{
unsigned int *sigalgs, *sptr;
size_t i;
if (salglen & 1)
return 0;
sigalgs = OPENSSL_malloc(salglen * sizeof(*sigalgs));
if (sigalgs == NULL)
return 0;
for (i = 0, sptr = sigalgs; i < salglen; i += 2) {
size_t j;
SIGALG_LOOKUP *curr;
int md_id = *psig_nids++;
int sig_id = *psig_nids++;
for (j = 0, curr = sigalg_lookup_tbl; j < OSSL_NELEM(sigalg_lookup_tbl);
j++, curr++) {
if (SIGID_IS_PSS(curr->sigalg))
continue;
if (curr->hash == md_id && curr->sig == sig_id) {
*sptr++ = curr->sigalg;
break;
}
}
if (j == OSSL_NELEM(sigalg_lookup_tbl))
goto err;
}
if (client) {
OPENSSL_free(c->client_sigalgs);
c->client_sigalgs = sigalgs;
c->client_sigalgslen = salglen;
} else {
OPENSSL_free(c->conf_sigalgs);
c->conf_sigalgs = sigalgs;
c->conf_sigalgslen = salglen;
}
return 1;
err:
OPENSSL_free(sigalgs);
return 0;
}
ssl/t1_lib.c:1807: error: BUFFER_OVERRUN_L1
Offset: [0, +oo] Size: 0 by call to `tls1_set_sigalgs`.
Showing all 9 steps of the trace
ssl/t1_lib.c:1802:5: Assignment
1800. {
1801. sig_cb_st sig;
1802. sig.sigalgcnt = 0;
^
1803. if (!CONF_parse_list(str, ':', 1, sig_cb, &sig))
1804. return 0;
ssl/t1_lib.c:1807:12: Call
1805. if (c == NULL)
1806. return 1;
1807. return tls1_set_sigalgs(c, sig.sigalgs, sig.sigalgcnt, client);
^
1808. }
1809.
ssl/t1_lib.c:1811:1: <Length trace>
1809.
1810. /* TODO(TLS1.3): Needs updating to allow setting of TLS1.3 sig algs */
1811. > int tls1_set_sigalgs(CERT *c, const int *psig_nids, size_t salglen, int client)
1812. {
1813. unsigned int *sigalgs, *sptr;
ssl/t1_lib.c:1811:1: Parameter `salglen`
1809.
1810. /* TODO(TLS1.3): Needs updating to allow setting of TLS1.3 sig algs */
1811. > int tls1_set_sigalgs(CERT *c, const int *psig_nids, size_t salglen, int client)
1812. {
1813. unsigned int *sigalgs, *sptr;
ssl/t1_lib.c:1818:15: Call
1816. if (salglen & 1)
1817. return 0;
1818. sigalgs = OPENSSL_malloc(salglen * sizeof(*sigalgs));
^
1819. if (sigalgs == NULL)
1820. return 0;
crypto/mem.c:79:9: Assignment
77.
78. if (num <= 0)
79. return NULL;
^
80.
81. allow_customize = 0;
ssl/t1_lib.c:1818:5: Assignment
1816. if (salglen & 1)
1817. return 0;
1818. sigalgs = OPENSSL_malloc(salglen * sizeof(*sigalgs));
^
1819. if (sigalgs == NULL)
1820. return 0;
ssl/t1_lib.c:1825:17: Assignment
1823. * RSA-PKCS1. For now we only allow setting of RSA-PKCS1
1824. */
1825. for (i = 0, sptr = sigalgs; i < salglen; i += 2) {
^
1826. size_t j;
1827. SIGALG_LOOKUP *curr;
ssl/t1_lib.c:1837:17: Array access: Offset: [0, +oo] Size: 0 by call to `tls1_set_sigalgs`
1835. continue;
1836. if (curr->hash == md_id && curr->sig == sig_id) {
1837. *sptr++ = curr->sigalg;
^
1838. break;
1839. }
| https://github.com/openssl/openssl/blob/adb403dea90cd3e2fb028bb16d44364a7b5d75d1/ssl/t1_lib.c/#L1837 |
d2a_code_trace_data_41468 | static void BN_POOL_release(BN_POOL *p, unsigned int num)
{
unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;
p->used -= num;
while(num--)
{
bn_check_top(p->current->vals + offset);
if(!offset)
{
offset = BN_CTX_POOL_SIZE - 1;
p->current = p->current->prev;
}
else
offset--;
}
}
crypto/bn/bn_gf2m.c:692: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `BN_GF2m_mod_mul`.
Showing all 17 steps of the trace
crypto/bn/bn_gf2m.c:691:7: Call
689. if (xinv == NULL) goto err;
690.
691. if (!BN_GF2m_mod_inv(xinv, x, p, ctx)) goto err;
^
692. if (!BN_GF2m_mod_mul(r, y, xinv, p, ctx)) goto err;
693. bn_check_top(r);
crypto/bn/bn_gf2m.c:645:4: Call
643.
644. err:
645. BN_CTX_end(ctx);
^
646. return ret;
647. }
crypto/bn/bn_ctx.c:272:1: Parameter `ctx->pool.used`
270. }
271.
272. > void BN_CTX_end(BN_CTX *ctx)
273. {
274. CTXDBG_ENTRY("BN_CTX_end", ctx);
crypto/bn/bn_gf2m.c:692:7: Call
690.
691. if (!BN_GF2m_mod_inv(xinv, x, p, ctx)) goto err;
692. if (!BN_GF2m_mod_mul(r, y, xinv, p, ctx)) goto err;
^
693. bn_check_top(r);
694. ret = 1;
crypto/bn/bn_gf2m.c:441:1: Parameter `ctx->pool.used`
439. * BN_GF2m_mod_mul_arr function.
440. */
441. > int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *p, BN_CTX *ctx)
442. {
443. int ret = 0;
crypto/bn/bn_gf2m.c:456:8: Call
454. goto err;
455. }
456. ret = BN_GF2m_mod_mul_arr(r, a, b, arr, ctx);
^
457. bn_check_top(r);
458. err:
crypto/bn/bn_gf2m.c:388:1: Parameter `ctx->pool.used`
386. * the result in r. r could be a or b; a could be b.
387. */
388. > int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const int p[], BN_CTX *ctx)
389. {
390. int zlen, i, j, k, ret = 0;
crypto/bn/bn_gf2m.c:399:10: Call
397. if (a == b)
398. {
399. return BN_GF2m_mod_sqr_arr(r, a, p, ctx);
^
400. }
401.
crypto/bn/bn_gf2m.c:465:1: Parameter `ctx->pool.used`
463.
464. /* Square a, reduce the result mod p, and store it in a. r could be a. */
465. > int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[], BN_CTX *ctx)
466. {
467. int i, ret = 0;
crypto/bn/bn_gf2m.c:472:11: Call
470. bn_check_top(a);
471. BN_CTX_start(ctx);
472. if ((s = BN_CTX_get(ctx)) == NULL) return 0;
^
473. if (!bn_wexpand(s, 2 * a->top)) goto err;
474.
crypto/bn/bn_ctx.c:290:1: Parameter `ctx->pool.used`
288. }
289.
290. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
291. {
292. BIGNUM *ret;
crypto/bn/bn_gf2m.c:487:2: Call
485. ret = 1;
486. err:
487. BN_CTX_end(ctx);
^
488. return ret;
489. }
crypto/bn/bn_ctx.c:272:1: Parameter `ctx->pool.used`
270. }
271.
272. > void BN_CTX_end(BN_CTX *ctx)
273. {
274. CTXDBG_ENTRY("BN_CTX_end", ctx);
crypto/bn/bn_ctx.c:282:4: Call
280. /* Does this stack frame have anything to release? */
281. if(fp < ctx->used)
282. BN_POOL_release(&ctx->pool, ctx->used - fp);
^
283. ctx->used = fp;
284. /* Unjam "too_many" in case "get" had failed */
crypto/bn/bn_ctx.c:440:1: <LHS trace>
438. }
439.
440. > static void BN_POOL_release(BN_POOL *p, unsigned int num)
441. {
442. unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;
crypto/bn/bn_ctx.c:440:1: Parameter `p->used`
438. }
439.
440. > static void BN_POOL_release(BN_POOL *p, unsigned int num)
441. {
442. unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;
crypto/bn/bn_ctx.c:442:2: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_GF2m_mod_mul`
440. static void BN_POOL_release(BN_POOL *p, unsigned int num)
441. {
442. unsigned int offset = (p->used - 1) % BN_CTX_POOL_SIZE;
^
443. p->used -= num;
444. while(num--)
| https://github.com/openssl/openssl/blob/0b59755f434eca1ed621974ae9f95663dcdcac35/crypto/bn/bn_ctx.c/#L442 |
d2a_code_trace_data_41469 | static int mov_write_stts_tag(ByteIOContext *pb, MOVTrack* track)
{
MOV_stts_t *stts_entries;
uint32_t entries = -1;
uint32_t atom_size;
int i;
if (track->enc->codec_type == CODEC_TYPE_AUDIO && !track->audio_vbr) {
stts_entries = av_malloc(sizeof(*stts_entries));
stts_entries[0].count = track->sampleCount;
stts_entries[0].duration = 1;
entries = 1;
} else {
stts_entries = av_malloc(track->entry * sizeof(*stts_entries));
for (i=0; i<track->entry; i++) {
int64_t duration = i + 1 == track->entry ?
track->trackDuration - track->cluster[i].dts + track->cluster[0].dts :
track->cluster[i+1].dts - track->cluster[i].dts;
if (i && duration == stts_entries[entries].duration) {
stts_entries[entries].count++;
} else {
entries++;
stts_entries[entries].duration = duration;
stts_entries[entries].count = 1;
}
}
entries++;
}
atom_size = 16 + (entries * 8);
put_be32(pb, atom_size);
put_tag(pb, "stts");
put_be32(pb, 0);
put_be32(pb, entries);
for (i=0; i<entries; i++) {
put_be32(pb, stts_entries[i].count);
put_be32(pb, stts_entries[i].duration);
}
av_free(stts_entries);
return atom_size;
}
libavformat/movenc.c:699: error: Integer Overflow L1
([4294967295, +oo] + 1):unsigned32.
libavformat/movenc.c:676:5: <LHS trace>
674. {
675. MOV_stts_t *stts_entries;
676. uint32_t entries = -1;
^
677. uint32_t atom_size;
678. int i;
libavformat/movenc.c:676:5: Assignment
674. {
675. MOV_stts_t *stts_entries;
676. uint32_t entries = -1;
^
677. uint32_t atom_size;
678. int i;
libavformat/movenc.c:699:9: Binary operation: ([4294967295, +oo] + 1):unsigned32
697. }
698. }
699. entries++; /* last one */
^
700. }
701. atom_size = 16 + (entries * 8);
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/movenc.c/#L699 |
d2a_code_trace_data_41470 | int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
{
char *v;
int gmt=0;
int i;
int y=0,M=0,d=0,h=0,m=0,s=0;
char *f = NULL;
int f_len = 0;
i=tm->length;
v=(char *)tm->data;
if (i < 12) goto err;
if (v[i-1] == 'Z') gmt=1;
for (i=0; i<12; i++)
if ((v[i] > '9') || (v[i] < '0')) goto err;
y= (v[0]-'0')*1000+(v[1]-'0')*100 + (v[2]-'0')*10+(v[3]-'0');
M= (v[4]-'0')*10+(v[5]-'0');
if ((M > 12) || (M < 1)) goto err;
d= (v[6]-'0')*10+(v[7]-'0');
h= (v[8]-'0')*10+(v[9]-'0');
m= (v[10]-'0')*10+(v[11]-'0');
if (tm->length >= 14 &&
(v[12] >= '0') && (v[12] <= '9') &&
(v[13] >= '0') && (v[13] <= '9'))
{
s= (v[12]-'0')*10+(v[13]-'0');
if (tm->length >= 15 && v[14] == '.')
{
int l = tm->length;
f = &v[14];
f_len = 1;
while (14 + f_len < l && f[f_len] >= '0' && f[f_len] <= '9')
++f_len;
}
}
if (BIO_printf(bp,"%s %2d %02d:%02d:%02d%.*s %d%s",
mon[M-1],d,h,m,s,f_len,f,y,(gmt)?" GMT":"") <= 0)
return(0);
else
return(1);
err:
BIO_write(bp,"Bad time value",14);
return(0);
}
crypto/x509v3/v3_ocsp.c:189: error: BUFFER_OVERRUN_L3
Offset: [-529, +oo] Size: 12 by call to `ASN1_GENERALIZEDTIME_print`.
Showing all 7 steps of the trace
crypto/x509v3/v3_ocsp.c:189:6: Call
187. {
188. if (BIO_printf(bp, "%*s", ind, "") <= 0) return 0;
189. if(!ASN1_GENERALIZEDTIME_print(bp, cutoff)) return 0;
^
190. return 1;
191. }
crypto/asn1/t_x509.c:354:1: <Offset trace>
352. };
353.
354. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
355. {
356. char *v;
crypto/asn1/t_x509.c:354:1: Parameter `*tm->data`
352. };
353.
354. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
355. {
356. char *v;
crypto/asn1/t_x509.c:371:2: Assignment
369. if ((v[i] > '9') || (v[i] < '0')) goto err;
370. y= (v[0]-'0')*1000+(v[1]-'0')*100 + (v[2]-'0')*10+(v[3]-'0');
371. M= (v[4]-'0')*10+(v[5]-'0');
^
372. if ((M > 12) || (M < 1)) goto err;
373. d= (v[6]-'0')*10+(v[7]-'0');
crypto/asn1/t_x509.c:348:1: <Length trace>
346. }
347.
348. > static const char *mon[12]=
349. {
350. "Jan","Feb","Mar","Apr","May","Jun",
crypto/asn1/t_x509.c:348:1: Array declaration
346. }
347.
348. > static const char *mon[12]=
349. {
350. "Jan","Feb","Mar","Apr","May","Jun",
crypto/asn1/t_x509.c:393:3: Array access: Offset: [-529, +oo] Size: 12 by call to `ASN1_GENERALIZEDTIME_print`
391.
392. if (BIO_printf(bp,"%s %2d %02d:%02d:%02d%.*s %d%s",
393. mon[M-1],d,h,m,s,f_len,f,y,(gmt)?" GMT":"") <= 0)
^
394. return(0);
395. else
| https://github.com/openssl/openssl/blob/c21869fb07ea02ffd46e817caeb47d85a85ee8ef/crypto/asn1/t_x509.c/#L393 |
d2a_code_trace_data_41471 | void CRYPTO_ctr128_encrypt_ctr32(const unsigned char *in, unsigned char *out,
size_t len, const void *key,
unsigned char ivec[16], unsigned char ecount_buf[16],
unsigned int *num, ctr128_f func)
{
unsigned int n,ctr32;
assert(in && out && key && ecount_buf && num);
assert(*num < 16);
n = *num;
while (n && len) {
*(out++) = *(in++) ^ ecount_buf[n];
--len;
n = (n+1) % 16;
}
ctr32 = GETU32(ivec+12);
while (len>=16) {
size_t blocks = len/16;
if (sizeof(size_t)>sizeof(unsigned int) && blocks>(1U<<28))
blocks = (1U<<28);
ctr32 += (u32)blocks;
if (ctr32 < blocks) {
blocks -= ctr32;
ctr32 = 0;
}
(*func)(in,out,blocks,key,ivec);
PUTU32(ivec+12,ctr32);
if (ctr32 == 0) ctr96_inc(ivec);
blocks *= 16;
len -= blocks;
out += blocks;
in += blocks;
}
if (len) {
memset(ecount_buf,0,16);
(*func)(ecount_buf,ecount_buf,1,key,ivec);
++ctr32;
PUTU32(ivec+12,ctr32);
if (ctr32 == 0) ctr96_inc(ivec);
while (len--) {
out[n] = in[n] ^ ecount_buf[n];
++n;
}
}
*num=n;
}
crypto/modes/ctr128.c:225: error: INTEGER_OVERFLOW_L2
([1, 268435456] - [-oo, 268435455]):unsigned64.
Showing all 5 steps of the trace
crypto/modes/ctr128.c:216:4: <LHS trace>
214. */
215. if (sizeof(size_t)>sizeof(unsigned int) && blocks>(1U<<28))
216. blocks = (1U<<28);
^
217. /*
218. * As (*func) operates on 32-bit counter, caller
crypto/modes/ctr128.c:216:4: Assignment
214. */
215. if (sizeof(size_t)>sizeof(unsigned int) && blocks>(1U<<28))
216. blocks = (1U<<28);
^
217. /*
218. * As (*func) operates on 32-bit counter, caller
crypto/modes/ctr128.c:216:4: <RHS trace>
214. */
215. if (sizeof(size_t)>sizeof(unsigned int) && blocks>(1U<<28))
216. blocks = (1U<<28);
^
217. /*
218. * As (*func) operates on 32-bit counter, caller
crypto/modes/ctr128.c:216:4: Assignment
214. */
215. if (sizeof(size_t)>sizeof(unsigned int) && blocks>(1U<<28))
216. blocks = (1U<<28);
^
217. /*
218. * As (*func) operates on 32-bit counter, caller
crypto/modes/ctr128.c:225:4: Binary operation: ([1, 268435456] - [-oo, 268435455]):unsigned64
223. ctr32 += (u32)blocks;
224. if (ctr32 < blocks) {
225. blocks -= ctr32;
^
226. ctr32 = 0;
227. }
| https://github.com/openssl/openssl/blob/ea7239cf15b7eeb8555db5b7801e6da7406566ea/crypto/modes/ctr128.c/#L225 |
d2a_code_trace_data_41472 | static void new_video_stream(AVFormatContext *oc)
{
AVStream *st;
AVCodecContext *video_enc;
enum CodecID codec_id;
st = av_new_stream(oc, streamid_map[oc->nb_streams]);
if (!st) {
fprintf(stderr, "Could not alloc stream\n");
ffmpeg_exit(1);
}
avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_VIDEO);
bitstream_filters[nb_output_files][oc->nb_streams - 1]= video_bitstream_filters;
video_bitstream_filters= NULL;
avcodec_thread_init(st->codec, thread_count);
video_enc = st->codec;
if(video_codec_tag)
video_enc->codec_tag= video_codec_tag;
if( (video_global_header&1)
|| (video_global_header==0 && (oc->oformat->flags & AVFMT_GLOBALHEADER))){
video_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags|= CODEC_FLAG_GLOBAL_HEADER;
}
if(video_global_header&2){
video_enc->flags2 |= CODEC_FLAG2_LOCAL_HEADER;
avcodec_opts[AVMEDIA_TYPE_VIDEO]->flags2|= CODEC_FLAG2_LOCAL_HEADER;
}
if (video_stream_copy) {
st->stream_copy = 1;
video_enc->codec_type = AVMEDIA_TYPE_VIDEO;
video_enc->sample_aspect_ratio =
st->sample_aspect_ratio = av_d2q(frame_aspect_ratio*frame_height/frame_width, 255);
} else {
const char *p;
int i;
AVCodec *codec;
AVRational fps= frame_rate.num ? frame_rate : (AVRational){25,1};
if (video_codec_name) {
codec_id = find_codec_or_die(video_codec_name, AVMEDIA_TYPE_VIDEO, 1,
video_enc->strict_std_compliance);
codec = avcodec_find_encoder_by_name(video_codec_name);
output_codecs[nb_ocodecs] = codec;
} else {
codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_VIDEO);
codec = avcodec_find_encoder(codec_id);
}
video_enc->codec_id = codec_id;
set_context_opts(video_enc, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM);
if (codec && codec->supported_framerates && !force_fps)
fps = codec->supported_framerates[av_find_nearest_q_idx(fps, codec->supported_framerates)];
video_enc->time_base.den = fps.num;
video_enc->time_base.num = fps.den;
video_enc->width = frame_width;
video_enc->height = frame_height;
video_enc->sample_aspect_ratio = av_d2q(frame_aspect_ratio*video_enc->height/video_enc->width, 255);
video_enc->pix_fmt = frame_pix_fmt;
st->sample_aspect_ratio = video_enc->sample_aspect_ratio;
choose_pixel_fmt(st, codec);
if (intra_only)
video_enc->gop_size = 0;
if (video_qscale || same_quality) {
video_enc->flags |= CODEC_FLAG_QSCALE;
video_enc->global_quality=
st->quality = FF_QP2LAMBDA * video_qscale;
}
if(intra_matrix)
video_enc->intra_matrix = intra_matrix;
if(inter_matrix)
video_enc->inter_matrix = inter_matrix;
p= video_rc_override_string;
for(i=0; p; i++){
int start, end, q;
int e=sscanf(p, "%d,%d,%d", &start, &end, &q);
if(e!=3){
fprintf(stderr, "error parsing rc_override\n");
ffmpeg_exit(1);
}
video_enc->rc_override=
av_realloc(video_enc->rc_override,
sizeof(RcOverride)*(i+1));
video_enc->rc_override[i].start_frame= start;
video_enc->rc_override[i].end_frame = end;
if(q>0){
video_enc->rc_override[i].qscale= q;
video_enc->rc_override[i].quality_factor= 1.0;
}
else{
video_enc->rc_override[i].qscale= 0;
video_enc->rc_override[i].quality_factor= -q/100.0;
}
p= strchr(p, '/');
if(p) p++;
}
video_enc->rc_override_count=i;
if (!video_enc->rc_initial_buffer_occupancy)
video_enc->rc_initial_buffer_occupancy = video_enc->rc_buffer_size*3/4;
video_enc->me_threshold= me_threshold;
video_enc->intra_dc_precision= intra_dc_precision - 8;
if (do_psnr)
video_enc->flags|= CODEC_FLAG_PSNR;
if (do_pass) {
if (do_pass == 1) {
video_enc->flags |= CODEC_FLAG_PASS1;
} else {
video_enc->flags |= CODEC_FLAG_PASS2;
}
}
}
nb_ocodecs++;
if (video_language) {
av_metadata_set2(&st->metadata, "language", video_language, 0);
av_freep(&video_language);
}
video_disable = 0;
av_freep(&video_codec_name);
video_stream_copy = 0;
frame_pix_fmt = PIX_FMT_NONE;
}
ffmpeg.c:3363: error: Null Dereference
pointer `st` last assigned on line 3358 could be null and is dereferenced at line 3363, column 35.
ffmpeg.c:3352:1: start of procedure new_video_stream()
3350. }
3351.
3352. static void new_video_stream(AVFormatContext *oc)
^
3353. {
3354. AVStream *st;
ffmpeg.c:3358:5:
3356. enum CodecID codec_id;
3357.
3358. st = av_new_stream(oc, streamid_map[oc->nb_streams]);
^
3359. if (!st) {
3360. fprintf(stderr, "Could not alloc stream\n");
libavformat/utils.c:2501:1: start of procedure av_new_stream()
2499. }
2500.
2501. AVStream *av_new_stream(AVFormatContext *s, int id)
^
2502. {
2503. AVStream *st;
libavformat/utils.c:2506:9: Taking true branch
2504. int i;
2505.
2506. if (s->nb_streams >= MAX_STREAMS){
^
2507. av_log(s, AV_LOG_ERROR, "Too many streams\n");
2508. return NULL;
libavformat/utils.c:2507:9: Skipping av_log(): empty list of specs
2505.
2506. if (s->nb_streams >= MAX_STREAMS){
2507. av_log(s, AV_LOG_ERROR, "Too many streams\n");
^
2508. return NULL;
2509. }
libavformat/utils.c:2508:9:
2506. if (s->nb_streams >= MAX_STREAMS){
2507. av_log(s, AV_LOG_ERROR, "Too many streams\n");
2508. return NULL;
^
2509. }
2510.
libavformat/utils.c:2543:1: return from a call to av_new_stream
2541. s->streams[s->nb_streams++] = st;
2542. return st;
2543. }
^
2544.
2545. AVProgram *av_new_program(AVFormatContext *ac, int id)
ffmpeg.c:3359:10: Taking true branch
3357.
3358. st = av_new_stream(oc, streamid_map[oc->nb_streams]);
3359. if (!st) {
^
3360. fprintf(stderr, "Could not alloc stream\n");
3361. ffmpeg_exit(1);
ffmpeg.c:3360:9:
3358. st = av_new_stream(oc, streamid_map[oc->nb_streams]);
3359. if (!st) {
3360. fprintf(stderr, "Could not alloc stream\n");
^
3361. ffmpeg_exit(1);
3362. }
ffmpeg.c:3361:9: Skipping ffmpeg_exit(): empty list of specs
3359. if (!st) {
3360. fprintf(stderr, "Could not alloc stream\n");
3361. ffmpeg_exit(1);
^
3362. }
3363. avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_VIDEO);
ffmpeg.c:3363:5:
3361. ffmpeg_exit(1);
3362. }
3363. avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_VIDEO);
^
3364. bitstream_filters[nb_output_files][oc->nb_streams - 1]= video_bitstream_filters;
3365. video_bitstream_filters= NULL;
| https://github.com/libav/libav/blob/ad0d70c964f852a18e9ab8124f0e7aa8876cac6e/ffmpeg.c/#L3363 |
d2a_code_trace_data_41473 | static int rtsp_read_announce(AVFormatContext *s)
{
RTSPState *rt = s->priv_data;
RTSPMessageHeader request = { 0 };
char sdp[4096];
int ret;
ret = rtsp_read_request(s, &request, "ANNOUNCE");
if (ret)
return ret;
rt->seq++;
if (strcmp(request.content_type, "application/sdp")) {
av_log(s, AV_LOG_ERROR, "Unexpected content type %s\n",
request.content_type);
rtsp_send_reply(s, RTSP_STATUS_SERVICE, NULL, request.seq);
return AVERROR_OPTION_NOT_FOUND;
}
if (request.content_length && request.content_length < sizeof(sdp) - 1) {
if (ffurl_read_complete(rt->rtsp_hd, sdp, request.content_length)
< request.content_length) {
av_log(s, AV_LOG_ERROR,
"Unable to get complete SDP Description in ANNOUNCE\n");
rtsp_send_reply(s, RTSP_STATUS_INTERNAL, NULL, request.seq);
return AVERROR(EIO);
}
sdp[request.content_length] = '\0';
av_log(s, AV_LOG_VERBOSE, "SDP: %s\n", sdp);
ret = ff_sdp_parse(s, sdp);
if (ret)
return ret;
rtsp_send_reply(s, RTSP_STATUS_OK, NULL, request.seq);
return 0;
}
av_log(s, AV_LOG_ERROR,
"Content-Length header value exceeds sdp allocated buffer (4KB)\n");
rtsp_send_reply(s, RTSP_STATUS_INTERNAL,
"Content-Length exceeds buffer size", request.seq);
return AVERROR(EIO);
}
libavformat/rtspdec.c:200: error: Null Dereference
pointer `null` is dereferenced by call to `rtsp_send_reply()` at line 200, column 9.
libavformat/rtspdec.c:169:1: start of procedure rtsp_read_announce()
167. }
168.
169. static int rtsp_read_announce(AVFormatContext *s)
^
170. {
171. RTSPState *rt = s->priv_data;
libavformat/rtspdec.c:171:5:
169. static int rtsp_read_announce(AVFormatContext *s)
170. {
171. RTSPState *rt = s->priv_data;
^
172. RTSPMessageHeader request = { 0 };
173. char sdp[4096];
libavformat/rtspdec.c:172:5:
170. {
171. RTSPState *rt = s->priv_data;
172. RTSPMessageHeader request = { 0 };
^
173. char sdp[4096];
174. int ret;
libavformat/rtspdec.c:176:5: Skipping rtsp_read_request(): empty list of specs
174. int ret;
175.
176. ret = rtsp_read_request(s, &request, "ANNOUNCE");
^
177. if (ret)
178. return ret;
libavformat/rtspdec.c:177:9: Taking false branch
175.
176. ret = rtsp_read_request(s, &request, "ANNOUNCE");
177. if (ret)
^
178. return ret;
179. rt->seq++;
libavformat/rtspdec.c:179:5:
177. if (ret)
178. return ret;
179. rt->seq++;
^
180. if (strcmp(request.content_type, "application/sdp")) {
181. av_log(s, AV_LOG_ERROR, "Unexpected content type %s\n",
libavformat/rtspdec.c:180:9: Taking false branch
178. return ret;
179. rt->seq++;
180. if (strcmp(request.content_type, "application/sdp")) {
^
181. av_log(s, AV_LOG_ERROR, "Unexpected content type %s\n",
182. request.content_type);
libavformat/rtspdec.c:186:9: Taking true branch
184. return AVERROR_OPTION_NOT_FOUND;
185. }
186. if (request.content_length && request.content_length < sizeof(sdp) - 1) {
^
187. /* Read SDP */
188. if (ffurl_read_complete(rt->rtsp_hd, sdp, request.content_length)
libavformat/rtspdec.c:186:35: Taking true branch
184. return AVERROR_OPTION_NOT_FOUND;
185. }
186. if (request.content_length && request.content_length < sizeof(sdp) - 1) {
^
187. /* Read SDP */
188. if (ffurl_read_complete(rt->rtsp_hd, sdp, request.content_length)
libavformat/rtspdec.c:188:13:
186. if (request.content_length && request.content_length < sizeof(sdp) - 1) {
187. /* Read SDP */
188. if (ffurl_read_complete(rt->rtsp_hd, sdp, request.content_length)
^
189. < request.content_length) {
190. av_log(s, AV_LOG_ERROR,
libavformat/avio.c:258:1: start of procedure ffurl_read_complete()
256. }
257.
258. int ffurl_read_complete(URLContext *h, unsigned char *buf, int size)
^
259. {
260. if (!(h->flags & AVIO_FLAG_READ))
libavformat/avio.c:260:11: Taking true branch
258. int ffurl_read_complete(URLContext *h, unsigned char *buf, int size)
259. {
260. if (!(h->flags & AVIO_FLAG_READ))
^
261. return AVERROR(EIO);
262. return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read);
libavformat/avio.c:261:9:
259. {
260. if (!(h->flags & AVIO_FLAG_READ))
261. return AVERROR(EIO);
^
262. return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read);
263. }
libavformat/avio.c:263:1: return from a call to ffurl_read_complete
261. return AVERROR(EIO);
262. return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read);
263. }
^
264.
265. int ffurl_write(URLContext *h, const unsigned char *buf, int size)
libavformat/rtspdec.c:188:13: Taking false branch
186. if (request.content_length && request.content_length < sizeof(sdp) - 1) {
187. /* Read SDP */
188. if (ffurl_read_complete(rt->rtsp_hd, sdp, request.content_length)
^
189. < request.content_length) {
190. av_log(s, AV_LOG_ERROR,
libavformat/rtspdec.c:195:9:
193. return AVERROR(EIO);
194. }
195. sdp[request.content_length] = '\0';
^
196. av_log(s, AV_LOG_VERBOSE, "SDP: %s\n", sdp);
197. ret = ff_sdp_parse(s, sdp);
libavformat/rtspdec.c:196:9: Skipping av_log(): empty list of specs
194. }
195. sdp[request.content_length] = '\0';
196. av_log(s, AV_LOG_VERBOSE, "SDP: %s\n", sdp);
^
197. ret = ff_sdp_parse(s, sdp);
198. if (ret)
libavformat/rtspdec.c:197:9: Skipping ff_sdp_parse(): empty list of specs
195. sdp[request.content_length] = '\0';
196. av_log(s, AV_LOG_VERBOSE, "SDP: %s\n", sdp);
197. ret = ff_sdp_parse(s, sdp);
^
198. if (ret)
199. return ret;
libavformat/rtspdec.c:198:13: Taking false branch
196. av_log(s, AV_LOG_VERBOSE, "SDP: %s\n", sdp);
197. ret = ff_sdp_parse(s, sdp);
198. if (ret)
^
199. return ret;
200. rtsp_send_reply(s, RTSP_STATUS_OK, NULL, request.seq);
libavformat/rtspdec.c:200:9:
198. if (ret)
199. return ret;
200. rtsp_send_reply(s, RTSP_STATUS_OK, NULL, request.seq);
^
201. return 0;
202. }
libavformat/rtspdec.c:94:1: start of procedure rtsp_send_reply()
92. }
93.
94. static int rtsp_send_reply(AVFormatContext *s, enum RTSPStatusCode code,
^
95. const char *extracontent, uint16_t seq)
96. {
libavformat/rtspdec.c:97:5:
95. const char *extracontent, uint16_t seq)
96. {
97. RTSPState *rt = s->priv_data;
^
98. char message[4096];
99. int index = 0;
libavformat/rtspdec.c:99:5:
97. RTSPState *rt = s->priv_data;
98. char message[4096];
99. int index = 0;
^
100. while (status_messages[index].code) {
101. if (status_messages[index].code == code) {
libavformat/rtspdec.c:100:12: Loop condition is true. Entering loop body
98. char message[4096];
99. int index = 0;
100. while (status_messages[index].code) {
^
101. if (status_messages[index].code == code) {
102. snprintf(message, sizeof(message), "RTSP/1.0 %d %s\r\n",
libavformat/rtspdec.c:101:13: Taking false branch
99. int index = 0;
100. while (status_messages[index].code) {
101. if (status_messages[index].code == code) {
^
102. snprintf(message, sizeof(message), "RTSP/1.0 %d %s\r\n",
103. code, status_messages[index].message);
libavformat/rtspdec.c:106:9:
104. break;
105. }
106. index++;
^
107. }
108. if (!status_messages[index].code)
libavformat/rtspdec.c:100:12: Loop condition is true. Entering loop body
98. char message[4096];
99. int index = 0;
100. while (status_messages[index].code) {
^
101. if (status_messages[index].code == code) {
102. snprintf(message, sizeof(message), "RTSP/1.0 %d %s\r\n",
libavformat/rtspdec.c:101:13: Taking false branch
99. int index = 0;
100. while (status_messages[index].code) {
101. if (status_messages[index].code == code) {
^
102. snprintf(message, sizeof(message), "RTSP/1.0 %d %s\r\n",
103. code, status_messages[index].message);
libavformat/rtspdec.c:106:9:
104. break;
105. }
106. index++;
^
107. }
108. if (!status_messages[index].code)
libavformat/rtspdec.c:100:12: Loop condition is true. Entering loop body
98. char message[4096];
99. int index = 0;
100. while (status_messages[index].code) {
^
101. if (status_messages[index].code == code) {
102. snprintf(message, sizeof(message), "RTSP/1.0 %d %s\r\n",
libavformat/rtspdec.c:101:13: Taking false branch
99. int index = 0;
100. while (status_messages[index].code) {
101. if (status_messages[index].code == code) {
^
102. snprintf(message, sizeof(message), "RTSP/1.0 %d %s\r\n",
103. code, status_messages[index].message);
libavformat/rtspdec.c:106:9:
104. break;
105. }
106. index++;
^
107. }
108. if (!status_messages[index].code)
libavformat/rtspdec.c:100:12: Loop condition is false. Leaving loop
98. char message[4096];
99. int index = 0;
100. while (status_messages[index].code) {
^
101. if (status_messages[index].code == code) {
102. snprintf(message, sizeof(message), "RTSP/1.0 %d %s\r\n",
libavformat/rtspdec.c:108:10: Taking true branch
106. index++;
107. }
108. if (!status_messages[index].code)
^
109. return AVERROR(EINVAL);
110. av_strlcatf(message, sizeof(message), "CSeq: %d\r\n", seq);
libavformat/rtspdec.c:109:9:
107. }
108. if (!status_messages[index].code)
109. return AVERROR(EINVAL);
^
110. av_strlcatf(message, sizeof(message), "CSeq: %d\r\n", seq);
111. av_strlcatf(message, sizeof(message), "Server: %s\r\n", LIBAVFORMAT_IDENT);
libavformat/rtspdec.c:119:1: return from a call to rtsp_send_reply
117.
118. return 0;
119. }
^
120.
121. static inline int check_sessionid(AVFormatContext *s,
| https://github.com/libav/libav/blob/0aa907cfb1bbc647ee4b6da62fac5c89d7b4d318/libavformat/rtspdec.c/#L200 |
d2a_code_trace_data_41474 | static int t_fromb64(unsigned char *a, size_t alen, const char *src)
{
char *loc;
int i, j;
int size;
while (*src && (*src == ' ' || *src == '\t' || *src == '\n'))
++src;
size = strlen(src);
if (alen > INT_MAX || size > (int)alen)
return -1;
i = 0;
while (i < size) {
loc = strchr(b64table, src[i]);
if (loc == (char *)0)
break;
else
a[i] = loc - b64table;
++i;
}
if (i == 0)
return 0;
size = i;
i = size - 1;
j = size;
while (1) {
a[j] = a[i];
if (--i < 0)
break;
a[j] |= (a[i] & 3) << 6;
--j;
a[j] = (unsigned char)((a[i] & 0x3c) >> 2);
if (--i < 0)
break;
a[j] |= (a[i] & 0xf) << 4;
--j;
a[j] = (unsigned char)((a[i] & 0x30) >> 4);
if (--i < 0)
break;
a[j] |= (a[i] << 2);
a[--j] = 0;
if (--i < 0)
break;
}
while (a[j] == 0 && j <= size)
++j;
i = 0;
while (j <= size)
a[i++] = a[j++];
return i;
}
crypto/srp/srp_vfy.c:384: error: BUFFER_OVERRUN_L2
Offset: [-oo, 2147483648] Size: 2500 by call to `SRP_gN_place_bn`.
Showing all 14 steps of the trace
crypto/srp/srp_vfy.c:365:18: Call
363. error_code = SRP_ERR_VBASE_INCOMPLETE_FILE;
364.
365. if ((tmpdb = TXT_DB_read(in, DB_NUMBER)) == NULL)
^
366. goto err;
367.
crypto/txt_db/txt_db.c:55:5: Assignment
53. add = (num + 1) * sizeof(char *);
54. buf->data[size - 1] = '\0';
55. offset = 0;
^
56. for (;;) {
57. if (offset != 0) {
crypto/srp/srp_vfy.c:384:29: Call
382.
383. if ((gN->id = OPENSSL_strdup(pp[DB_srpid])) == NULL
384. || (gN->N = SRP_gN_place_bn(vb->gN_cache, pp[DB_srpverifier]))
^
385. == NULL
386. || (gN->g = SRP_gN_place_bn(vb->gN_cache, pp[DB_srpsalt]))
crypto/srp/srp_vfy.c:315:1: Parameter `ch->strlen`
313. }
314.
315. > static BIGNUM *SRP_gN_place_bn(STACK_OF(SRP_gN_cache) *gN_cache, char *ch)
316. {
317. int i;
crypto/srp/srp_vfy.c:328:31: Call
326. }
327. { /* it is the first time that we find it */
328. SRP_gN_cache *newgN = SRP_gN_new_init(ch);
^
329. if (newgN) {
330. if (sk_SRP_gN_cache_insert(gN_cache, newgN, 0) > 0)
crypto/srp/srp_vfy.c:266:1: Array declaration
264. }
265.
266. > static SRP_gN_cache *SRP_gN_new_init(const char *ch)
267. {
268. unsigned char tmp[MAX_LEN];
crypto/srp/srp_vfy.c:275:11: Call
273. return NULL;
274.
275. len = t_fromb64(tmp, sizeof(tmp), ch);
^
276. if (len < 0)
277. goto err;
crypto/srp/srp_vfy.c:33:1: <Offset trace>
31. * Convert a base64 string into raw byte array representation.
32. */
33. > static int t_fromb64(unsigned char *a, size_t alen, const char *src)
34. {
35. char *loc;
crypto/srp/srp_vfy.c:33:1: Parameter `alen`
31. * Convert a base64 string into raw byte array representation.
32. */
33. > static int t_fromb64(unsigned char *a, size_t alen, const char *src)
34. {
35. char *loc;
crypto/srp/srp_vfy.c:57:5: Assignment
55. if (i == 0)
56. return 0;
57. size = i;
^
58. i = size - 1;
59. j = size;
crypto/srp/srp_vfy.c:59:5: Assignment
57. size = i;
58. i = size - 1;
59. j = size;
^
60. while (1) {
61. a[j] = a[i];
crypto/srp/srp_vfy.c:33:1: <Length trace>
31. * Convert a base64 string into raw byte array representation.
32. */
33. > static int t_fromb64(unsigned char *a, size_t alen, const char *src)
34. {
35. char *loc;
crypto/srp/srp_vfy.c:33:1: Parameter `*a`
31. * Convert a base64 string into raw byte array representation.
32. */
33. > static int t_fromb64(unsigned char *a, size_t alen, const char *src)
34. {
35. char *loc;
crypto/srp/srp_vfy.c:80:12: Array access: Offset: [-oo, 2147483648] Size: 2500 by call to `SRP_gN_place_bn`
78. break;
79. }
80. while (a[j] == 0 && j <= size)
^
81. ++j;
82. i = 0;
| https://github.com/openssl/openssl/blob/9dd4ac8cf17f2afd636e85ae0111d1df4104a475/crypto/srp/srp_vfy.c/#L80 |
d2a_code_trace_data_41475 | 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:243: error: BUFFER_OVERRUN_L3
Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `bn_to_mont_fixed_top`.
Showing all 19 steps of the trace
crypto/ec/ecdsa_ossl.c:212:10: Call
210. if (8 * dgst_len > i)
211. dgst_len = (i + 7) / 8;
212. if (!BN_bin2bn(dgst, dgst_len, m)) {
^
213. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB);
214. goto err;
crypto/bn/bn_lib.c:372:1: Parameter `ret->top`
370. }
371.
372. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
373. {
374. unsigned int i, m;
crypto/ec/ecdsa_ossl.c:243:14: Call
241. * below, returns user-visible value with removed zero padding.
242. */
243. if (!bn_to_mont_fixed_top(s, ret->r, group->mont_data, ctx)
^
244. || !bn_mul_mont_fixed_top(s, s, priv_key, group->mont_data, ctx)) {
245. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB);
crypto/bn/bn_mont.c:210:1: Parameter `a->top`
208. }
209.
210. > int bn_to_mont_fixed_top(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont,
211. BN_CTX *ctx)
212. {
crypto/bn/bn_mont.c:213:12: Call
211. BN_CTX *ctx)
212. {
213. return bn_mul_mont_fixed_top(r, a, &(mont->RR), mont, ctx);
^
214. }
215.
crypto/bn/bn_mont.c:37:1: Parameter `b->top`
35. }
36.
37. > int bn_mul_mont_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
38. BN_MONT_CTX *mont, BN_CTX *ctx)
39. {
crypto/bn/bn_mont.c:67:14: Call
65. bn_check_top(tmp);
66. if (a == b) {
67. if (!BN_sqr(tmp, a, ctx))
^
68. goto err;
69. } else {
crypto/bn/bn_sqr.c:17:1: Parameter `a->top`
15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96
16. */
17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
18. {
19. int max, al;
crypto/bn/bn_sqr.c:25:5: Assignment
23. bn_check_top(a);
24.
25. al = a->top;
^
26. if (al <= 0) {
27. r->top = 0;
crypto/bn/bn_sqr.c:74:17: Call
72. if (bn_wexpand(tmp, max) == NULL)
73. goto err;
74. bn_sqr_normal(rr->d, a->d, al, tmp->d);
^
75. }
76. }
crypto/bn/bn_sqr.c:99:1: <Offset trace>
97.
98. /* tmp must have 2*n words */
99. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
100. {
101. int i, j, max;
crypto/bn/bn_sqr.c:99:1: Parameter `n`
97.
98. /* tmp must have 2*n words */
99. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
100. {
101. int i, j, max;
crypto/bn/bn_sqr.c:110:5: Assignment
108. rp[0] = rp[max - 1] = 0;
109. rp++;
110. j = n;
^
111.
112. if (--j > 0) {
crypto/bn/bn_sqr.c:112:9: Assignment
110. j = n;
111.
112. if (--j > 0) {
^
113. ap++;
114. rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
crypto/bn/bn_sqr.c:99:1: <Length trace>
97.
98. /* tmp must have 2*n words */
99. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
100. {
101. int i, j, max;
crypto/bn/bn_sqr.c:99:1: Parameter `*r`
97.
98. /* tmp must have 2*n words */
99. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
100. {
101. int i, j, max;
crypto/bn/bn_sqr.c:107:5: Assignment
105. max = n * 2;
106. ap = a;
107. rp = r;
^
108. rp[0] = rp[max - 1] = 0;
109. rp++;
crypto/bn/bn_sqr.c:109:5: Assignment
107. rp = r;
108. rp[0] = rp[max - 1] = 0;
109. rp++;
^
110. j = n;
111.
crypto/bn/bn_sqr.c:114:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `bn_to_mont_fixed_top`
112. if (--j > 0) {
113. ap++;
114. rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
^
115. rp += 2;
116. }
| https://github.com/openssl/openssl/blob/4cc968df403ed9321d0df722aba33323ae575ce0/crypto/bn/bn_sqr.c/#L114 |
d2a_code_trace_data_41476 | static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
{
BN_ULONG *a = NULL;
if (words > (INT_MAX / (4 * BN_BITS2))) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG);
return NULL;
}
if (BN_get_flags(b, BN_FLG_STATIC_DATA)) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
return NULL;
}
if (BN_get_flags(b, BN_FLG_SECURE))
a = OPENSSL_secure_zalloc(words * sizeof(*a));
else
a = OPENSSL_zalloc(words * sizeof(*a));
if (a == NULL) {
BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
return NULL;
}
assert(b->top <= words);
if (b->top > 0)
memcpy(a, b->d, sizeof(*a) * b->top);
return a;
}
crypto/ec/ecdsa_ossl.c:230: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_copy`.
Showing all 21 steps of the trace
crypto/ec/ecdsa_ossl.c:212:10: Call
210. if (8 * dgst_len > i)
211. dgst_len = (i + 7) / 8;
212. if (!BN_bin2bn(dgst, dgst_len, m)) {
^
213. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB);
214. goto err;
crypto/bn/bn_lib.c:372:1: Parameter `ret->top`
370. }
371.
372. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
373. {
374. unsigned int i, m;
crypto/ec/ecdsa_ossl.c:230:17: Call
228. } else {
229. ckinv = in_kinv;
230. if (BN_copy(ret->r, in_r) == NULL) {
^
231. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_MALLOC_FAILURE);
232. goto err;
crypto/bn/bn_lib.c:281:1: Parameter `a->top`
279. }
280.
281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
282. {
283. bn_check_top(b);
crypto/bn/bn_lib.c:287:9: Call
285. if (a == b)
286. return a;
287. if (bn_wexpand(a, b->top) == NULL)
^
288. return NULL;
289.
crypto/bn/bn_lib.c: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_copy`
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_41477 | 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:1104: error: INTEGER_OVERFLOW_L2
([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + `s->srp_ctx.login->strlen` + `s->tlsext_hostname->strlen` + 34]):unsigned64 by call to `WPACKET_sub_memcpy__`.
Showing all 12 steps of the trace
ssl/t1_lib.c:1103:21: Call
1101. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats)
1102. /* Sub-packet for formats extension */
1103. || !WPACKET_start_sub_packet_u16(pkt)
^
1104. || !WPACKET_sub_memcpy_u8(pkt, pformats, num_formats)
1105. || !WPACKET_close(pkt)) {
ssl/packet.c:205:1: Parameter `pkt->buf->length`
203. }
204.
205. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes)
206. {
207. WPACKET_SUB *sub;
ssl/t1_lib.c:1104:21: Call
1102. /* Sub-packet for formats extension */
1103. || !WPACKET_start_sub_packet_u16(pkt)
1104. || !WPACKET_sub_memcpy_u8(pkt, pformats, num_formats)
^
1105. || !WPACKET_close(pkt)) {
1106. SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
ssl/packet.c:298:1: Parameter `pkt->written`
296. }
297.
298. > int WPACKET_sub_memcpy__(WPACKET *pkt, const void *src, size_t len,
299. size_t lenbytes)
300. {
ssl/packet.c:301:10: Call
299. size_t lenbytes)
300. {
301. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes)
^
302. || !WPACKET_memcpy(pkt, src, len)
303. || !WPACKET_close(pkt))
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] - [0, s->s3->previous_client_finished_len + pkt->written + s->srp_ctx.login->strlen + s->tlsext_hostname->strlen + 34]):unsigned64 by call to `WPACKET_sub_memcpy__`
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_41478 | int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
size_t num, const EC_POINT *points[], const BIGNUM *scalars[],
BN_CTX *ctx)
{
BN_CTX *new_ctx = NULL;
const EC_POINT *generator = NULL;
EC_POINT *tmp = NULL;
size_t totalnum;
size_t blocksize = 0, numblocks = 0;
size_t pre_points_per_block = 0;
size_t i, j;
int k;
int r_is_inverted = 0;
int r_is_at_infinity = 1;
size_t *wsize = NULL;
signed char **wNAF = NULL;
size_t *wNAF_len = NULL;
size_t max_len = 0;
size_t num_val;
EC_POINT **val = NULL;
EC_POINT **v;
EC_POINT ***val_sub = NULL;
const EC_PRE_COMP *pre_comp = NULL;
int num_scalar = 0;
int ret = 0;
if (group->meth != r->meth) {
ECerr(EC_F_EC_WNAF_MUL, EC_R_INCOMPATIBLE_OBJECTS);
return 0;
}
if ((scalar == NULL) && (num == 0)) {
return EC_POINT_set_to_infinity(group, r);
}
for (i = 0; i < num; i++) {
if (group->meth != points[i]->meth) {
ECerr(EC_F_EC_WNAF_MUL, EC_R_INCOMPATIBLE_OBJECTS);
return 0;
}
}
if (ctx == NULL) {
ctx = new_ctx = BN_CTX_new();
if (ctx == NULL)
goto err;
}
if (scalar != NULL) {
generator = EC_GROUP_get0_generator(group);
if (generator == NULL) {
ECerr(EC_F_EC_WNAF_MUL, EC_R_UNDEFINED_GENERATOR);
goto err;
}
pre_comp = group->pre_comp.ec;
if (pre_comp && pre_comp->numblocks
&& (EC_POINT_cmp(group, generator, pre_comp->points[0], ctx) ==
0)) {
blocksize = pre_comp->blocksize;
numblocks = (BN_num_bits(scalar) / blocksize) + 1;
if (numblocks > pre_comp->numblocks)
numblocks = pre_comp->numblocks;
pre_points_per_block = (size_t)1 << (pre_comp->w - 1);
if (pre_comp->num != (pre_comp->numblocks * pre_points_per_block)) {
ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR);
goto err;
}
} else {
pre_comp = NULL;
numblocks = 1;
num_scalar = 1;
}
}
totalnum = num + numblocks;
wsize = OPENSSL_malloc(totalnum * sizeof wsize[0]);
wNAF_len = OPENSSL_malloc(totalnum * sizeof wNAF_len[0]);
wNAF = OPENSSL_malloc((totalnum + 1) * sizeof wNAF[0]);
val_sub = OPENSSL_malloc(totalnum * sizeof val_sub[0]);
if (wNAF != NULL)
wNAF[0] = NULL;
if (wsize == NULL || wNAF_len == NULL || wNAF == NULL || val_sub == NULL) {
ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE);
goto err;
}
num_val = 0;
for (i = 0; i < num + num_scalar; i++) {
size_t bits;
bits = i < num ? BN_num_bits(scalars[i]) : BN_num_bits(scalar);
wsize[i] = EC_window_bits_for_scalar_size(bits);
num_val += (size_t)1 << (wsize[i] - 1);
wNAF[i + 1] = NULL;
wNAF[i] =
bn_compute_wNAF((i < num ? scalars[i] : scalar), wsize[i],
&wNAF_len[i]);
if (wNAF[i] == NULL)
goto err;
if (wNAF_len[i] > max_len)
max_len = wNAF_len[i];
}
if (numblocks) {
if (pre_comp == NULL) {
if (num_scalar != 1) {
ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR);
goto err;
}
} else {
signed char *tmp_wNAF = NULL;
size_t tmp_len = 0;
if (num_scalar != 0) {
ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR);
goto err;
}
wsize[num] = pre_comp->w;
tmp_wNAF = bn_compute_wNAF(scalar, wsize[num], &tmp_len);
if (!tmp_wNAF)
goto err;
if (tmp_len <= max_len) {
numblocks = 1;
totalnum = num + 1;
wNAF[num] = tmp_wNAF;
wNAF[num + 1] = NULL;
wNAF_len[num] = tmp_len;
val_sub[num] = pre_comp->points;
} else {
signed char *pp;
EC_POINT **tmp_points;
if (tmp_len < numblocks * blocksize) {
numblocks = (tmp_len + blocksize - 1) / blocksize;
if (numblocks > pre_comp->numblocks) {
ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR);
OPENSSL_free(tmp_wNAF);
goto err;
}
totalnum = num + numblocks;
}
pp = tmp_wNAF;
tmp_points = pre_comp->points;
for (i = num; i < totalnum; i++) {
if (i < totalnum - 1) {
wNAF_len[i] = blocksize;
if (tmp_len < blocksize) {
ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR);
OPENSSL_free(tmp_wNAF);
goto err;
}
tmp_len -= blocksize;
} else
wNAF_len[i] = tmp_len;
wNAF[i + 1] = NULL;
wNAF[i] = OPENSSL_malloc(wNAF_len[i]);
if (wNAF[i] == NULL) {
ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE);
OPENSSL_free(tmp_wNAF);
goto err;
}
memcpy(wNAF[i], pp, wNAF_len[i]);
if (wNAF_len[i] > max_len)
max_len = wNAF_len[i];
if (*tmp_points == NULL) {
ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR);
OPENSSL_free(tmp_wNAF);
goto err;
}
val_sub[i] = tmp_points;
tmp_points += pre_points_per_block;
pp += blocksize;
}
OPENSSL_free(tmp_wNAF);
}
}
}
val = OPENSSL_malloc((num_val + 1) * sizeof val[0]);
if (val == NULL) {
ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE);
goto err;
}
val[num_val] = NULL;
v = val;
for (i = 0; i < num + num_scalar; i++) {
val_sub[i] = v;
for (j = 0; j < ((size_t)1 << (wsize[i] - 1)); j++) {
*v = EC_POINT_new(group);
if (*v == NULL)
goto err;
v++;
}
}
if (!(v == val + num_val)) {
ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR);
goto err;
}
if ((tmp = EC_POINT_new(group)) == NULL)
goto err;
for (i = 0; i < num + num_scalar; i++) {
if (i < num) {
if (!EC_POINT_copy(val_sub[i][0], points[i]))
goto err;
} else {
if (!EC_POINT_copy(val_sub[i][0], generator))
goto err;
}
if (wsize[i] > 1) {
if (!EC_POINT_dbl(group, tmp, val_sub[i][0], ctx))
goto err;
for (j = 1; j < ((size_t)1 << (wsize[i] - 1)); j++) {
if (!EC_POINT_add
(group, val_sub[i][j], val_sub[i][j - 1], tmp, ctx))
goto err;
}
}
}
if (!EC_POINTs_make_affine(group, num_val, val, ctx))
goto err;
r_is_at_infinity = 1;
for (k = max_len - 1; k >= 0; k--) {
if (!r_is_at_infinity) {
if (!EC_POINT_dbl(group, r, r, ctx))
goto err;
}
for (i = 0; i < totalnum; i++) {
if (wNAF_len[i] > (size_t)k) {
int digit = wNAF[i][k];
int is_neg;
if (digit) {
is_neg = digit < 0;
if (is_neg)
digit = -digit;
if (is_neg != r_is_inverted) {
if (!r_is_at_infinity) {
if (!EC_POINT_invert(group, r, ctx))
goto err;
}
r_is_inverted = !r_is_inverted;
}
if (r_is_at_infinity) {
if (!EC_POINT_copy(r, val_sub[i][digit >> 1]))
goto err;
r_is_at_infinity = 0;
} else {
if (!EC_POINT_add
(group, r, r, val_sub[i][digit >> 1], ctx))
goto err;
}
}
}
}
}
if (r_is_at_infinity) {
if (!EC_POINT_set_to_infinity(group, r))
goto err;
} else {
if (r_is_inverted)
if (!EC_POINT_invert(group, r, ctx))
goto err;
}
ret = 1;
err:
BN_CTX_free(new_ctx);
EC_POINT_free(tmp);
OPENSSL_free(wsize);
OPENSSL_free(wNAF_len);
if (wNAF != NULL) {
signed char **w;
for (w = wNAF; *w != NULL; w++)
OPENSSL_free(*w);
OPENSSL_free(wNAF);
}
if (val != NULL) {
for (v = val; *v != NULL; v++)
EC_POINT_clear_free(*v);
OPENSSL_free(val);
}
OPENSSL_free(val_sub);
return ret;
}
test/ectest.c:965: error: BUFFER_OVERRUN_L3
Offset: [2, +oo] Size: [0, +oo] by call to `EC_POINTs_mul`.
Showing all 13 steps of the trace
test/ectest.c:965:14: Call
963.
964. /* z is still the group order */
965. if (!TEST_true(EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx))
^
966. || !TEST_true(EC_POINTs_mul(group, R, z, 2, points, scalars, ctx))
967. || !TEST_int_eq(0, EC_POINT_cmp(group, P, R, ctx))
crypto/ec/ec_lib.c:914:1: Parameter `num`
912. */
913.
914. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
915. size_t num, const EC_POINT *points[],
916. const BIGNUM *scalars[], BN_CTX *ctx)
crypto/ec/ec_lib.c:920:16: Call
918. if (group->meth->mul == 0)
919. /* use default */
920. return ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx);
^
921.
922. return group->meth->mul(group, r, scalar, num, points, scalars, ctx);
crypto/ec/ec_mult.c:129:1: <Offset trace>
127. * in the addition if scalar != NULL
128. */
129. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
130. size_t num, const EC_POINT *points[], const BIGNUM *scalars[],
131. BN_CTX *ctx)
crypto/ec/ec_mult.c:129:1: Parameter `num`
127. * in the addition if scalar != NULL
128. */
129. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
130. size_t num, const EC_POINT *points[], const BIGNUM *scalars[],
131. BN_CTX *ctx)
crypto/ec/ec_mult.c:223:5: Assignment
221. }
222.
223. totalnum = num + numblocks;
^
224.
225. wsize = OPENSSL_malloc(totalnum * sizeof wsize[0]);
crypto/ec/ec_mult.c:129:1: <Length trace>
127. * in the addition if scalar != NULL
128. */
129. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
130. size_t num, const EC_POINT *points[], const BIGNUM *scalars[],
131. BN_CTX *ctx)
crypto/ec/ec_mult.c:129:1: Parameter `num`
127. * in the addition if scalar != NULL
128. */
129. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
130. size_t num, const EC_POINT *points[], const BIGNUM *scalars[],
131. BN_CTX *ctx)
crypto/ec/ec_mult.c:223:5: Assignment
221. }
222.
223. totalnum = num + numblocks;
^
224.
225. wsize = OPENSSL_malloc(totalnum * sizeof wsize[0]);
crypto/ec/ec_mult.c:226:16: Call
224.
225. wsize = OPENSSL_malloc(totalnum * sizeof wsize[0]);
226. wNAF_len = OPENSSL_malloc(totalnum * sizeof wNAF_len[0]);
^
227. wNAF = OPENSSL_malloc((totalnum + 1) * sizeof wNAF[0]); /* includes space
228. * for pivot */
crypto/mem.c:166:9: Assignment
164.
165. if (num == 0)
166. return NULL;
^
167.
168. FAILTEST();
crypto/ec/ec_mult.c:226:5: Assignment
224.
225. wsize = OPENSSL_malloc(totalnum * sizeof wsize[0]);
226. wNAF_len = OPENSSL_malloc(totalnum * sizeof wNAF_len[0]);
^
227. wNAF = OPENSSL_malloc((totalnum + 1) * sizeof wNAF[0]); /* includes space
228. * for pivot */
crypto/ec/ec_mult.c:331:25: Array access: Offset: [2, +oo] Size: [0, +oo] by call to `EC_POINTs_mul`
329. for (i = num; i < totalnum; i++) {
330. if (i < totalnum - 1) {
331. wNAF_len[i] = blocksize;
^
332. if (tmp_len < blocksize) {
333. ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR);
| https://github.com/openssl/openssl/blob/7671342e550ed2de676b23c79d0e7f45a381c76e/crypto/ec/ec_mult.c/#L331 |
d2a_code_trace_data_41479 | void av_free(void *ptr)
{
#if CONFIG_MEMALIGN_HACK
if (ptr)
free((char *)ptr - ((char *)ptr)[-1]);
#elif HAVE_ALIGNED_MALLOC
_aligned_free(ptr);
#else
free(ptr);
#endif
}
libavformat/movenchint.c:243: error: Use After Free
call to `sample_queue_pop()` eventually accesses memory that was invalidated by call to `free()` on line 243 indirectly during the call to `sample_queue_pop()`.
libavformat/movenchint.c:214:1: invalidation part of the trace starts here
212. * @return 0 if a match was found, < 0 if no match was found
213. */
214. static int find_sample_match(const uint8_t *data, int len,
^
215. HintSampleQueue *queue, int *pos,
216. int *match_sample, int *match_offset,
libavformat/movenchint.c:214:1: parameter `queue` of find_sample_match
212. * @return 0 if a match was found, < 0 if no match was found
213. */
214. static int find_sample_match(const uint8_t *data, int len,
^
215. HintSampleQueue *queue, int *pos,
216. int *match_sample, int *match_offset,
libavformat/movenchint.c:243:13: when calling `sample_queue_pop` here
241. } else {
242. /* No match for this sample, remove it */
243. sample_queue_pop(queue);
^
244. }
245. }
libavformat/movenchint.c:70:1: parameter `queue` of sample_queue_pop
68. * Remove the first sample from the sample queue.
69. */
70. static void sample_queue_pop(HintSampleQueue *queue)
^
71. {
72. if (queue->len <= 0)
libavformat/movenchint.c:75:9: when calling `av_free` here
73. return;
74. if (queue->samples[0].own_data)
75. av_free(queue->samples[0].data);
^
76. queue->len--;
77. memmove(queue->samples, queue->samples + 1, sizeof(HintSample)*queue->len);
libavutil/mem.c:185:1: parameter `ptr` of av_free
183. }
184.
185. void av_free(void *ptr)
^
186. {
187. #if CONFIG_MEMALIGN_HACK
libavutil/mem.c:193:5: was invalidated by call to `free()`
191. _aligned_free(ptr);
192. #else
193. free(ptr);
^
194. #endif
195. }
libavformat/movenchint.c:214:1: use-after-lifetime part of the trace starts here
212. * @return 0 if a match was found, < 0 if no match was found
213. */
214. static int find_sample_match(const uint8_t *data, int len,
^
215. HintSampleQueue *queue, int *pos,
216. int *match_sample, int *match_offset,
libavformat/movenchint.c:214:1: parameter `queue` of find_sample_match
212. * @return 0 if a match was found, < 0 if no match was found
213. */
214. static int find_sample_match(const uint8_t *data, int len,
^
215. HintSampleQueue *queue, int *pos,
216. int *match_sample, int *match_offset,
libavformat/movenchint.c:243:13: when calling `sample_queue_pop` here
241. } else {
242. /* No match for this sample, remove it */
243. sample_queue_pop(queue);
^
244. }
245. }
libavformat/movenchint.c:70:1: parameter `queue` of sample_queue_pop
68. * Remove the first sample from the sample queue.
69. */
70. static void sample_queue_pop(HintSampleQueue *queue)
^
71. {
72. if (queue->len <= 0)
libavformat/movenchint.c:75:9: when calling `av_free` here
73. return;
74. if (queue->samples[0].own_data)
75. av_free(queue->samples[0].data);
^
76. queue->len--;
77. memmove(queue->samples, queue->samples + 1, sizeof(HintSample)*queue->len);
libavutil/mem.c:185:1: parameter `ptr` of av_free
183. }
184.
185. void av_free(void *ptr)
^
186. {
187. #if CONFIG_MEMALIGN_HACK
libavutil/mem.c:193:5: invalid access occurs here
191. _aligned_free(ptr);
192. #else
193. free(ptr);
^
194. #endif
195. }
| https://github.com/libav/libav/blob/d6d27f3e58e6980bce4a490e7d8cc0f6a84521fe/libavutil/mem.c/#L193 |
d2a_code_trace_data_41480 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/rsa/rsa_sp800_56b_check.c:186: error: INTEGER_OVERFLOW_L2
([0, 7+max(0, `ctx->stack.depth`)] - 1):unsigned32 by call to `BN_CTX_end`.
Showing all 21 steps of the trace
crypto/rsa/rsa_sp800_56b_check.c:157:1: Parameter `ctx->stack.depth`
155. * (Step 6b) 1 = (d*e) mod LCM(p–1, q–1)
156. */
157. > int rsa_check_private_exponent(const RSA *rsa, int nbits, BN_CTX *ctx)
158. {
159. int ret;
crypto/rsa/rsa_sp800_56b_check.c:166:5: Call
164. return 0;
165.
166. BN_CTX_start(ctx);
^
167. r = BN_CTX_get(ctx);
168. p1 = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/rsa/rsa_sp800_56b_check.c:167:9: Call
165.
166. BN_CTX_start(ctx);
167. r = BN_CTX_get(ctx);
^
168. p1 = BN_CTX_get(ctx);
169. q1 = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/rsa/rsa_sp800_56b_check.c:168:10: Call
166. BN_CTX_start(ctx);
167. r = BN_CTX_get(ctx);
168. p1 = BN_CTX_get(ctx);
^
169. q1 = BN_CTX_get(ctx);
170. lcm = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/rsa/rsa_sp800_56b_check.c:169:10: Call
167. r = BN_CTX_get(ctx);
168. p1 = BN_CTX_get(ctx);
169. q1 = BN_CTX_get(ctx);
^
170. lcm = BN_CTX_get(ctx);
171. p1q1 = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/rsa/rsa_sp800_56b_check.c:170:11: Call
168. p1 = BN_CTX_get(ctx);
169. q1 = BN_CTX_get(ctx);
170. lcm = BN_CTX_get(ctx);
^
171. p1q1 = BN_CTX_get(ctx);
172. gcd = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/rsa/rsa_sp800_56b_check.c:171:12: Call
169. q1 = BN_CTX_get(ctx);
170. lcm = BN_CTX_get(ctx);
171. p1q1 = BN_CTX_get(ctx);
^
172. gcd = BN_CTX_get(ctx);
173. ret = (gcd != 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/rsa/rsa_sp800_56b_check.c:172:11: Call
170. lcm = BN_CTX_get(ctx);
171. p1q1 = BN_CTX_get(ctx);
172. gcd = BN_CTX_get(ctx);
^
173. ret = (gcd != NULL
174. /* LCM(p - 1, q - 1) */
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/rsa/rsa_sp800_56b_check.c:186:5: Call
184. BN_clear(lcm);
185. BN_clear(gcd);
186. BN_CTX_end(ctx);
^
187. return ret;
188. }
crypto/bn/bn_ctx.c:185:1: Parameter `ctx->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, 7+max(0, ctx->stack.depth)] - 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_41481 | int av_find_stream_info(AVFormatContext *ic)
{
int i, count, ret, read_size, j;
AVStream *st;
AVPacket pkt1, *pkt;
int64_t last_dts[MAX_STREAMS];
int duration_count[MAX_STREAMS]={0};
double (*duration_error)[MAX_STD_TIMEBASES];
offset_t old_offset = url_ftell(ic->pb);
int64_t codec_info_duration[MAX_STREAMS]={0};
int codec_info_nb_frames[MAX_STREAMS]={0};
AVProbeData probe_data[MAX_STREAMS];
int codec_identified[MAX_STREAMS]={0};
duration_error = av_mallocz(MAX_STREAMS * sizeof(*duration_error));
if (!duration_error) return AVERROR(ENOMEM);
for(i=0;i<ic->nb_streams;i++) {
st = ic->streams[i];
if(st->codec->codec_type == CODEC_TYPE_VIDEO){
if(!st->codec->time_base.num)
st->codec->time_base= st->time_base;
}
if (!st->parser) {
st->parser = av_parser_init(st->codec->codec_id);
if(st->need_parsing == AVSTREAM_PARSE_HEADERS && st->parser){
st->parser->flags |= PARSER_FLAG_COMPLETE_FRAMES;
}
}
}
for(i=0;i<MAX_STREAMS;i++){
last_dts[i]= AV_NOPTS_VALUE;
}
memset(probe_data, 0, sizeof(probe_data));
count = 0;
read_size = 0;
for(;;) {
for(i=0;i<ic->nb_streams;i++) {
st = ic->streams[i];
if (!has_codec_parameters(st->codec))
break;
if( tb_unreliable(st->codec)
&& duration_count[i]<20 && st->codec->codec_type == CODEC_TYPE_VIDEO)
break;
if(st->parser && st->parser->parser->split && !st->codec->extradata)
break;
if(st->first_dts == AV_NOPTS_VALUE)
break;
}
if (i == ic->nb_streams) {
if (!(ic->ctx_flags & AVFMTCTX_NOHEADER)) {
ret = count;
break;
}
}
if (read_size >= MAX_READ_SIZE) {
ret = count;
break;
}
ret = av_read_frame_internal(ic, &pkt1);
if (ret < 0) {
ret = -1;
for(i=0;i<ic->nb_streams;i++) {
st = ic->streams[i];
if (!has_codec_parameters(st->codec)){
char buf[256];
avcodec_string(buf, sizeof(buf), st->codec, 0);
av_log(ic, AV_LOG_INFO, "Could not find codec parameters (%s)\n", buf);
} else {
ret = 0;
}
}
break;
}
pkt= add_to_pktbuf(ic, &pkt1);
if(av_dup_packet(pkt) < 0)
return AVERROR(ENOMEM);
read_size += pkt->size;
st = ic->streams[pkt->stream_index];
if(codec_info_nb_frames[st->index]>1)
codec_info_duration[st->index] += pkt->duration;
if (pkt->duration != 0)
codec_info_nb_frames[st->index]++;
{
int index= pkt->stream_index;
int64_t last= last_dts[index];
int64_t duration= pkt->dts - last;
if(pkt->dts != AV_NOPTS_VALUE && last != AV_NOPTS_VALUE && duration>0){
double dur= duration * av_q2d(st->time_base);
if(duration_count[index] < 2)
memset(duration_error[index], 0, sizeof(*duration_error));
for(i=1; i<MAX_STD_TIMEBASES; i++){
int framerate= get_std_framerate(i);
int ticks= lrintf(dur*framerate/(1001*12));
double error= dur - ticks*1001*12/(double)framerate;
duration_error[index][i] += error*error;
}
duration_count[index]++;
}
if(last == AV_NOPTS_VALUE || duration_count[index]<=1)
last_dts[pkt->stream_index]= pkt->dts;
if (st->codec->codec_id == CODEC_ID_NONE) {
AVProbeData *pd = &(probe_data[st->index]);
pd->buf = av_realloc(pd->buf, pd->buf_size+pkt->size+AVPROBE_PADDING_SIZE);
memcpy(pd->buf+pd->buf_size, pkt->data, pkt->size);
pd->buf_size += pkt->size;
memset(pd->buf+pd->buf_size, 0, AVPROBE_PADDING_SIZE);
}
}
if(st->parser && st->parser->parser->split && !st->codec->extradata){
int i= st->parser->parser->split(st->codec, pkt->data, pkt->size);
if(i){
st->codec->extradata_size= i;
st->codec->extradata= av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
memcpy(st->codec->extradata, pkt->data, st->codec->extradata_size);
memset(st->codec->extradata + i, 0, FF_INPUT_BUFFER_PADDING_SIZE);
}
}
if (!has_codec_parameters(st->codec) )
try_decode_frame(st, pkt->data, pkt->size);
if (st->time_base.den > 0 && av_rescale_q(codec_info_duration[st->index], st->time_base, AV_TIME_BASE_Q) >= ic->max_analyze_duration) {
break;
}
count++;
}
for(i=0;i<ic->nb_streams;i++) {
st = ic->streams[i];
if(st->codec->codec)
avcodec_close(st->codec);
}
for(i=0;i<ic->nb_streams;i++) {
st = ic->streams[i];
if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
if(st->codec->codec_id == CODEC_ID_RAWVIDEO && !st->codec->codec_tag && !st->codec->bits_per_sample)
st->codec->codec_tag= avcodec_pix_fmt_to_codec_tag(st->codec->pix_fmt);
if(duration_count[i]
&& tb_unreliable(st->codec) ){
double best_error= 2*av_q2d(st->time_base);
best_error= best_error*best_error*duration_count[i]*1000*12*30;
for(j=1; j<MAX_STD_TIMEBASES; j++){
double error= duration_error[i][j] * get_std_framerate(j);
if(error < best_error){
best_error= error;
av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den, get_std_framerate(j), 12*1001, INT_MAX);
}
}
}
if (!st->r_frame_rate.num){
if( st->codec->time_base.den * (int64_t)st->time_base.num
<= st->codec->time_base.num * (int64_t)st->time_base.den){
st->r_frame_rate.num = st->codec->time_base.den;
st->r_frame_rate.den = st->codec->time_base.num;
}else{
st->r_frame_rate.num = st->time_base.den;
st->r_frame_rate.den = st->time_base.num;
}
}
}else if(st->codec->codec_type == CODEC_TYPE_AUDIO) {
if (st->codec->codec_id == CODEC_ID_NONE && probe_data[st->index].buf_size > 0) {
codec_identified[st->index] = set_codec_from_probe_data(st, &(probe_data[st->index]), 1);
if (codec_identified[st->index]) {
st->need_parsing = AVSTREAM_PARSE_FULL;
}
}
if(!st->codec->bits_per_sample)
st->codec->bits_per_sample= av_get_bits_per_sample(st->codec->codec_id);
}
}
av_estimate_timings(ic, old_offset);
for(i=0;i<ic->nb_streams;i++) {
st = ic->streams[i];
if (codec_identified[st->index])
break;
}
if(i!=ic->nb_streams){
av_read_frame_flush(ic);
for(i=0;i<ic->nb_streams;i++) {
st = ic->streams[i];
if (codec_identified[st->index]) {
av_seek_frame(ic, st->index, 0.0, 0);
}
st->cur_dts= st->first_dts;
}
url_fseek(ic->pb, ic->data_offset, SEEK_SET);
}
#if 0
for(i=0;i<ic->nb_streams;i++) {
st = ic->streams[i];
if (st->codec->codec_type == CODEC_TYPE_VIDEO) {
if(b-frames){
ppktl = &ic->packet_buffer;
while(ppkt1){
if(ppkt1->stream_index != i)
continue;
if(ppkt1->pkt->dts < 0)
break;
if(ppkt1->pkt->pts != AV_NOPTS_VALUE)
break;
ppkt1->pkt->dts -= delta;
ppkt1= ppkt1->next;
}
if(ppkt1)
continue;
st->cur_dts -= delta;
}
}
}
#endif
av_free(duration_error);
for(i=0;i<MAX_STREAMS;i++){
av_freep(&(probe_data[i].buf));
}
return ret;
}
libavformat/utils.c:2095: error: Uninitialized Value
The value read from ret was never initialized.
libavformat/utils.c:2095:5:
2093. }
2094.
2095. return ret;
^
2096. }
2097.
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/utils.c/#L2095 |
d2a_code_trace_data_41482 | int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx,
unsigned char *md_out,
size_t *md_out_size,
const unsigned char header[13],
const unsigned char *data,
size_t data_plus_mac_size,
size_t data_plus_mac_plus_padding_size,
const unsigned char *mac_secret,
size_t mac_secret_length, char is_sslv3)
{
union {
double align;
unsigned char c[sizeof(LARGEST_DIGEST_CTX)];
} md_state;
void (*md_final_raw) (void *ctx, unsigned char *md_out);
void (*md_transform) (void *ctx, const unsigned char *block);
size_t md_size, md_block_size = 64;
size_t sslv3_pad_length = 40, header_length, variance_blocks,
len, max_mac_bytes, num_blocks,
num_starting_blocks, k, mac_end_offset, c, index_a, index_b;
size_t bits;
unsigned char length_bytes[MAX_HASH_BIT_COUNT_BYTES];
unsigned char hmac_pad[MAX_HASH_BLOCK_SIZE];
unsigned char first_block[MAX_HASH_BLOCK_SIZE];
unsigned char mac_out[EVP_MAX_MD_SIZE];
size_t i, j;
unsigned md_out_size_u;
EVP_MD_CTX *md_ctx = NULL;
size_t md_length_size = 8;
char length_is_big_endian = 1;
int ret;
if (!ossl_assert(data_plus_mac_plus_padding_size < 1024 * 1024))
return 0;
switch (EVP_MD_CTX_type(ctx)) {
case NID_md5:
if (MD5_Init((MD5_CTX *)md_state.c) <= 0)
return 0;
md_final_raw = tls1_md5_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))MD5_Transform;
md_size = 16;
sslv3_pad_length = 48;
length_is_big_endian = 0;
break;
case NID_sha1:
if (SHA1_Init((SHA_CTX *)md_state.c) <= 0)
return 0;
md_final_raw = tls1_sha1_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))SHA1_Transform;
md_size = 20;
break;
case NID_sha224:
if (SHA224_Init((SHA256_CTX *)md_state.c) <= 0)
return 0;
md_final_raw = tls1_sha256_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))SHA256_Transform;
md_size = 224 / 8;
break;
case NID_sha256:
if (SHA256_Init((SHA256_CTX *)md_state.c) <= 0)
return 0;
md_final_raw = tls1_sha256_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))SHA256_Transform;
md_size = 32;
break;
case NID_sha384:
if (SHA384_Init((SHA512_CTX *)md_state.c) <= 0)
return 0;
md_final_raw = tls1_sha512_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))SHA512_Transform;
md_size = 384 / 8;
md_block_size = 128;
md_length_size = 16;
break;
case NID_sha512:
if (SHA512_Init((SHA512_CTX *)md_state.c) <= 0)
return 0;
md_final_raw = tls1_sha512_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))SHA512_Transform;
md_size = 64;
md_block_size = 128;
md_length_size = 16;
break;
default:
if (md_out_size != NULL)
*md_out_size = 0;
return ossl_assert(0);
}
if (!ossl_assert(md_length_size <= MAX_HASH_BIT_COUNT_BYTES)
|| !ossl_assert(md_block_size <= MAX_HASH_BLOCK_SIZE)
|| !ossl_assert(md_size <= EVP_MAX_MD_SIZE))
return 0;
header_length = 13;
if (is_sslv3) {
header_length = mac_secret_length + sslv3_pad_length + 8 +
1 +
2 ;
}
variance_blocks = is_sslv3 ? 2 : 6;
len = data_plus_mac_plus_padding_size + header_length;
max_mac_bytes = len - md_size - 1;
num_blocks =
(max_mac_bytes + 1 + md_length_size + md_block_size -
1) / md_block_size;
num_starting_blocks = 0;
k = 0;
mac_end_offset = data_plus_mac_size + header_length - md_size;
c = mac_end_offset % md_block_size;
index_a = mac_end_offset / md_block_size;
index_b = (mac_end_offset + md_length_size) / md_block_size;
if (num_blocks > variance_blocks + (is_sslv3 ? 1 : 0)) {
num_starting_blocks = num_blocks - variance_blocks;
k = md_block_size * num_starting_blocks;
}
bits = 8 * mac_end_offset;
if (!is_sslv3) {
bits += 8 * md_block_size;
memset(hmac_pad, 0, md_block_size);
if (!ossl_assert(mac_secret_length <= sizeof(hmac_pad)))
return 0;
memcpy(hmac_pad, mac_secret, mac_secret_length);
for (i = 0; i < md_block_size; i++)
hmac_pad[i] ^= 0x36;
md_transform(md_state.c, hmac_pad);
}
if (length_is_big_endian) {
memset(length_bytes, 0, md_length_size - 4);
length_bytes[md_length_size - 4] = (unsigned char)(bits >> 24);
length_bytes[md_length_size - 3] = (unsigned char)(bits >> 16);
length_bytes[md_length_size - 2] = (unsigned char)(bits >> 8);
length_bytes[md_length_size - 1] = (unsigned char)bits;
} else {
memset(length_bytes, 0, md_length_size);
length_bytes[md_length_size - 5] = (unsigned char)(bits >> 24);
length_bytes[md_length_size - 6] = (unsigned char)(bits >> 16);
length_bytes[md_length_size - 7] = (unsigned char)(bits >> 8);
length_bytes[md_length_size - 8] = (unsigned char)bits;
}
if (k > 0) {
if (is_sslv3) {
size_t overhang;
if (header_length <= md_block_size) {
return 0;
}
overhang = header_length - md_block_size;
md_transform(md_state.c, header);
memcpy(first_block, header + md_block_size, overhang);
memcpy(first_block + overhang, data, md_block_size - overhang);
md_transform(md_state.c, first_block);
for (i = 1; i < k / md_block_size - 1; i++)
md_transform(md_state.c, data + md_block_size * i - overhang);
} else {
memcpy(first_block, header, 13);
memcpy(first_block + 13, data, md_block_size - 13);
md_transform(md_state.c, first_block);
for (i = 1; i < k / md_block_size; i++)
md_transform(md_state.c, data + md_block_size * i - 13);
}
}
memset(mac_out, 0, sizeof(mac_out));
for (i = num_starting_blocks; i <= num_starting_blocks + variance_blocks;
i++) {
unsigned char block[MAX_HASH_BLOCK_SIZE];
unsigned char is_block_a = constant_time_eq_8_s(i, index_a);
unsigned char is_block_b = constant_time_eq_8_s(i, index_b);
for (j = 0; j < md_block_size; j++) {
unsigned char b = 0, is_past_c, is_past_cp1;
if (k < header_length)
b = header[k];
else if (k < data_plus_mac_plus_padding_size + header_length)
b = data[k - header_length];
k++;
is_past_c = is_block_a & constant_time_ge_8_s(j, c);
is_past_cp1 = is_block_a & constant_time_ge_8_s(j, c + 1);
b = constant_time_select_8(is_past_c, 0x80, b);
b = b & ~is_past_cp1;
b &= ~is_block_b | is_block_a;
if (j >= md_block_size - md_length_size) {
b = constant_time_select_8(is_block_b,
length_bytes[j -
(md_block_size -
md_length_size)], b);
}
block[j] = b;
}
md_transform(md_state.c, block);
md_final_raw(md_state.c, block);
for (j = 0; j < md_size; j++)
mac_out[j] |= block[j] & is_block_b;
}
md_ctx = EVP_MD_CTX_new();
if (md_ctx == NULL)
goto err;
if (EVP_DigestInit_ex(md_ctx, EVP_MD_CTX_md(ctx), NULL ) <= 0)
goto err;
if (is_sslv3) {
memset(hmac_pad, 0x5c, sslv3_pad_length);
if (EVP_DigestUpdate(md_ctx, mac_secret, mac_secret_length) <= 0
|| EVP_DigestUpdate(md_ctx, hmac_pad, sslv3_pad_length) <= 0
|| EVP_DigestUpdate(md_ctx, mac_out, md_size) <= 0)
goto err;
} else {
for (i = 0; i < md_block_size; i++)
hmac_pad[i] ^= 0x6a;
if (EVP_DigestUpdate(md_ctx, hmac_pad, md_block_size) <= 0
|| EVP_DigestUpdate(md_ctx, mac_out, md_size) <= 0)
goto err;
}
ret = EVP_DigestFinal(md_ctx, md_out, &md_out_size_u);
if (ret && md_out_size)
*md_out_size = md_out_size_u;
EVP_MD_CTX_free(md_ctx);
return 1;
err:
EVP_MD_CTX_free(md_ctx);
return 0;
}
ssl/s3_cbc.c:323: error: INTEGER_OVERFLOW_L2
([3, +oo] - [2, 6]):unsigned64.
Showing all 6 steps of the trace
ssl/s3_cbc.c:322:41: <LHS trace>
320. * least two because the header is larger than a single block.
321. */
322. if (num_blocks > variance_blocks + (is_sslv3 ? 1 : 0)) {
^
323. num_starting_blocks = num_blocks - variance_blocks;
324. k = md_block_size * num_starting_blocks;
ssl/s3_cbc.c:322:41: Assignment
320. * least two because the header is larger than a single block.
321. */
322. if (num_blocks > variance_blocks + (is_sslv3 ? 1 : 0)) {
^
323. num_starting_blocks = num_blocks - variance_blocks;
324. k = md_block_size * num_starting_blocks;
ssl/s3_cbc.c:264:23: <RHS trace>
262. * variance_blocks can be reduced.
263. */
264. variance_blocks = is_sslv3 ? 2 : 6;
^
265. /*
266. * From now on we're dealing with the MAC, which conceptually has 13
ssl/s3_cbc.c:264:23: Assignment
262. * variance_blocks can be reduced.
263. */
264. variance_blocks = is_sslv3 ? 2 : 6;
^
265. /*
266. * From now on we're dealing with the MAC, which conceptually has 13
ssl/s3_cbc.c:264:5: Assignment
262. * variance_blocks can be reduced.
263. */
264. variance_blocks = is_sslv3 ? 2 : 6;
^
265. /*
266. * From now on we're dealing with the MAC, which conceptually has 13
ssl/s3_cbc.c:323:9: Binary operation: ([3, +oo] - [2, 6]):unsigned64
321. */
322. if (num_blocks > variance_blocks + (is_sslv3 ? 1 : 0)) {
323. num_starting_blocks = num_blocks - variance_blocks;
^
324. k = md_block_size * num_starting_blocks;
325. }
| https://github.com/openssl/openssl/blob/dc5831da59e9bfad61ba425d886a0b06ac160cd6/ssl/s3_cbc.c/#L323 |
d2a_code_trace_data_41483 | 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;
}
}
test/bntest.c:1078: error: BUFFER_OVERRUN_L3
Offset: [4, +oo] (⇐ [0, +oo] + 4) Size: [0, 8388607] by call to `BN_mod_exp_mont_consttime`.
Showing all 18 steps of the trace
test/bntest.c:1075:5: Call
1073. e = BN_new();
1074.
1075. BN_one(a);
^
1076. BN_one(b);
1077. BN_zero(c);
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))
test/bntest.c:1078:9: Call
1076. BN_one(b);
1077. BN_zero(c);
1078. if (BN_mod_exp_mont_consttime(d, a, b, c, ctx, NULL)) {
^
1079. fprintf(stderr, "BN_mod_exp_mont_consttime with zero modulus "
1080. "succeeded\n");
crypto/bn/bn_exp.c:601:1: Parameter `*a->d`
599. * http://www.daemonology.net/hyperthreading-considered-harmful/)
600. */
601. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
602. const BIGNUM *m, BN_CTX *ctx,
603. BN_MONT_CTX *in_mont)
crypto/bn/bn_exp.c:758:17: Call
756. if (!BN_to_montgomery(&am, &am, mont, ctx))
757. goto err;
758. } else if (!BN_to_montgomery(&am, a, mont, ctx))
^
759. goto err;
760.
crypto/bn/bn_lib.c:945:1: Parameter `*a->d`
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->d`
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:56:14: Call
54. goto err;
55. } else {
56. if (!BN_mul(tmp, a, b, ctx))
^
57. goto err;
58. }
crypto/bn/bn_mul.c:828:1: Parameter `*a->d`
826. #endif /* BN_RECURSION */
827.
828. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
829. {
830. int ret = 0;
crypto/bn/bn_mul.c:909:17: Call
907. if (bn_wexpand(rr, k * 4) == NULL)
908. goto err;
909. bn_mul_part_recursive(rr->d, a->d, b->d,
^
910. j, al - j, bl - j, t->d);
911. } else { /* al <= j || bl <= j */
crypto/bn/bn_mul.c:480:1: Parameter `*a`
478. */
479. /* tnX may not be negative but less than n */
480. > void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n,
481. int tna, int tnb, BN_ULONG *t)
482. {
crypto/bn/bn_mul.c:488:9: Call
486.
487. if (n < 8) {
488. bn_mul_normal(r, a, n + tna, b, n + tnb);
^
489. return;
490. }
crypto/bn/bn_mul.c:983:1: <Length trace>
981. }
982.
983. > void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb)
984. {
985. BN_ULONG *rr;
crypto/bn/bn_mul.c:983:1: Parameter `*b`
981. }
982.
983. > void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb)
984. {
985. BN_ULONG *rr;
crypto/bn/bn_mul.c:1018:50: Array access: Offset: [4, +oo] (⇐ [0, +oo] + 4) Size: [0, 8388607] by call to `BN_mod_exp_mont_consttime`
1016. if (--nb <= 0)
1017. return;
1018. rr[4] = bn_mul_add_words(&(r[4]), a, na, b[4]);
^
1019. rr += 4;
1020. r += 4;
| https://github.com/openssl/openssl/blob/b3618f44a7b8504bfb0a64e8a33e6b8e56d4d516/crypto/bn/bn_mul.c/#L1018 |
d2a_code_trace_data_41484 | static int build_chain(X509_STORE_CTX *ctx)
{
struct dane_st *dane = (struct dane_st *)ctx->dane;
int num = sk_X509_num(ctx->chain);
X509 *cert = sk_X509_value(ctx->chain, num - 1);
int ss = cert_self_signed(cert);
STACK_OF(X509) *sktmp = NULL;
unsigned int search;
int may_trusted = 0;
int may_alternate = 0;
int trust = X509_TRUST_UNTRUSTED;
int alt_untrusted = 0;
int depth;
int ok = 0;
int i;
OPENSSL_assert(num == 1 && ctx->num_untrusted == num);
#define S_DOUNTRUSTED (1 << 0)
#define S_DOTRUSTED (1 << 1)
#define S_DOALTERNATE (1 << 2)
search = (ctx->untrusted != NULL) ? S_DOUNTRUSTED : 0;
if (DANETLS_HAS_PKIX(dane) || !DANETLS_HAS_DANE(dane)) {
if (search == 0 || ctx->param->flags & X509_V_FLAG_TRUSTED_FIRST)
search |= S_DOTRUSTED;
else if (!(ctx->param->flags & X509_V_FLAG_NO_ALT_CHAINS))
may_alternate = 1;
may_trusted = 1;
}
if (ctx->untrusted && (sktmp = sk_X509_dup(ctx->untrusted)) == NULL) {
X509err(X509_F_BUILD_CHAIN, ERR_R_MALLOC_FAILURE);
return 0;
}
if (DANETLS_ENABLED(dane) && dane->certs != NULL) {
for (i = 0; i < sk_X509_num(dane->certs); ++i) {
if (!sk_X509_push(sktmp, sk_X509_value(dane->certs, i))) {
sk_X509_free(sktmp);
X509err(X509_F_BUILD_CHAIN, ERR_R_MALLOC_FAILURE);
return 0;
}
}
}
if (ctx->param->depth > INT_MAX/2)
ctx->param->depth = INT_MAX/2;
depth = ctx->param->depth + 1;
while (search != 0) {
X509 *x;
X509 *xtmp = NULL;
if ((search & S_DOTRUSTED) != 0) {
STACK_OF(X509) *hide = ctx->chain;
i = num = sk_X509_num(ctx->chain);
if ((search & S_DOALTERNATE) != 0) {
i = alt_untrusted;
}
x = sk_X509_value(ctx->chain, i-1);
ctx->chain = NULL;
ok = (depth < num) ? 0 : ctx->get_issuer(&xtmp, ctx, x);
ctx->chain = hide;
if (ok < 0) {
trust = X509_TRUST_REJECTED;
search = 0;
continue;
}
if (ok > 0) {
if ((search & S_DOALTERNATE) != 0) {
OPENSSL_assert(num > i && i > 0 && ss == 0);
search &= ~S_DOALTERNATE;
for (; num > i; --num)
X509_free(sk_X509_pop(ctx->chain));
ctx->num_untrusted = num;
if (DANETLS_ENABLED(dane) &&
dane->mdpth >= ctx->num_untrusted) {
dane->mdpth = -1;
X509_free(dane->mcert);
dane->mcert = NULL;
}
if (DANETLS_ENABLED(dane) &&
dane->pdpth >= ctx->num_untrusted)
dane->pdpth = -1;
}
if (ss == 0) {
if (!sk_X509_push(ctx->chain, x = xtmp)) {
X509_free(xtmp);
X509err(X509_F_BUILD_CHAIN, ERR_R_MALLOC_FAILURE);
trust = X509_TRUST_REJECTED;
search = 0;
continue;
}
ss = cert_self_signed(x);
} else if (num == ctx->num_untrusted) {
if (X509_cmp(x, xtmp) != 0) {
X509_free(xtmp);
ok = 0;
} else {
X509_free(x);
ctx->num_untrusted = --num;
(void) sk_X509_set(ctx->chain, num, x = xtmp);
}
}
if (ok) {
OPENSSL_assert(ctx->num_untrusted <= num);
search &= ~S_DOUNTRUSTED;
switch (trust = check_trust(ctx, num)) {
case X509_TRUST_TRUSTED:
case X509_TRUST_REJECTED:
search = 0;
continue;
}
if (ss == 0)
continue;
}
}
if ((search & S_DOUNTRUSTED) == 0) {
if ((search & S_DOALTERNATE) != 0 && --alt_untrusted > 0)
continue;
if (!may_alternate || (search & S_DOALTERNATE) != 0 ||
ctx->num_untrusted < 2)
break;
search |= S_DOALTERNATE;
alt_untrusted = ctx->num_untrusted - 1;
ss = 0;
}
}
if ((search & S_DOUNTRUSTED) != 0) {
num = sk_X509_num(ctx->chain);
OPENSSL_assert(num == ctx->num_untrusted);
x = sk_X509_value(ctx->chain, num-1);
xtmp = (depth < num) ? NULL : find_issuer(ctx, sktmp, x);
if (xtmp == NULL) {
search &= ~S_DOUNTRUSTED;
if (may_trusted)
search |= S_DOTRUSTED;
continue;
}
if (!sk_X509_push(ctx->chain, x = xtmp)) {
X509err(X509_F_BUILD_CHAIN, ERR_R_MALLOC_FAILURE);
trust = X509_TRUST_REJECTED;
search = 0;
continue;
}
X509_up_ref(x);
++ctx->num_untrusted;
ss = cert_self_signed(xtmp);
(void) sk_X509_delete_ptr(sktmp, x);
switch (trust = check_dane_issuer(ctx, ctx->num_untrusted - 1)) {
case X509_TRUST_TRUSTED:
case X509_TRUST_REJECTED:
search = 0;
continue;
}
}
}
sk_X509_free(sktmp);
num = sk_X509_num(ctx->chain);
if (num <= depth) {
if (trust == X509_TRUST_UNTRUSTED && DANETLS_HAS_DANE_TA(dane))
trust = check_dane_pkeys(ctx);
if (trust == X509_TRUST_UNTRUSTED && num == ctx->num_untrusted)
trust = check_trust(ctx, num);
}
switch (trust) {
case X509_TRUST_TRUSTED:
return 1;
case X509_TRUST_REJECTED:
return 0;
case X509_TRUST_UNTRUSTED:
default:
num = sk_X509_num(ctx->chain);
ctx->current_cert = sk_X509_value(ctx->chain, num - 1);
ctx->error_depth = num-1;
if (num > depth)
ctx->error = X509_V_ERR_CERT_CHAIN_TOO_LONG;
else if (DANETLS_ENABLED(dane) &&
(!DANETLS_HAS_PKIX(dane) || dane->pdpth >= 0))
ctx->error = X509_V_ERR_CERT_UNTRUSTED;
else if (ss && sk_X509_num(ctx->chain) == 1)
ctx->error = X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT;
else if (ss)
ctx->error = X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN;
else if (ctx->num_untrusted == num)
ctx->error = X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY;
else
ctx->error = X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT;
if (DANETLS_ENABLED(dane))
dane_reset(dane);
return ctx->verify_cb(0, ctx);
}
}
crypto/x509/x509_vfy.c:2711: error: NULL_DEREFERENCE
pointer `cert` last assigned on line 2710 could be null and is dereferenced by call to `cert_self_signed()` at line 2711, column 14.
Showing all 20 steps of the trace
crypto/x509/x509_vfy.c:2706:1: start of procedure build_chain()
2704. }
2705.
2706. > static int build_chain(X509_STORE_CTX *ctx)
2707. {
2708. struct dane_st *dane = (struct dane_st *)ctx->dane;
crypto/x509/x509_vfy.c:2708:5:
2706. static int build_chain(X509_STORE_CTX *ctx)
2707. {
2708. > struct dane_st *dane = (struct dane_st *)ctx->dane;
2709. int num = sk_X509_num(ctx->chain);
2710. X509 *cert = sk_X509_value(ctx->chain, num - 1);
crypto/x509/x509_vfy.c:2709:5:
2707. {
2708. struct dane_st *dane = (struct dane_st *)ctx->dane;
2709. > int num = sk_X509_num(ctx->chain);
2710. X509 *cert = sk_X509_value(ctx->chain, num - 1);
2711. int ss = cert_self_signed(cert);
include/openssl/x509.h:169:1: start of procedure sk_X509_num()
167. typedef struct x509_cinf_st X509_CINF;
168.
169. > DEFINE_STACK_OF(X509)
170.
171. /* This is used for a table of trust checking functions */
crypto/stack/stack.c:316:1: start of procedure sk_num()
314. }
315.
316. > int sk_num(const _STACK *st)
317. {
318. if (st == NULL)
crypto/stack/stack.c:318:9: Taking true branch
316. int sk_num(const _STACK *st)
317. {
318. if (st == NULL)
^
319. return -1;
320. return st->num;
crypto/stack/stack.c:319:9:
317. {
318. if (st == NULL)
319. > return -1;
320. return st->num;
321. }
crypto/stack/stack.c:321:1: return from a call to sk_num
319. return -1;
320. return st->num;
321. > }
322.
323. void *sk_value(const _STACK *st, int i)
include/openssl/x509.h:169:1: return from a call to sk_X509_num
167. typedef struct x509_cinf_st X509_CINF;
168.
169. > DEFINE_STACK_OF(X509)
170.
171. /* This is used for a table of trust checking functions */
crypto/x509/x509_vfy.c:2710:5:
2708. struct dane_st *dane = (struct dane_st *)ctx->dane;
2709. int num = sk_X509_num(ctx->chain);
2710. > X509 *cert = sk_X509_value(ctx->chain, num - 1);
2711. int ss = cert_self_signed(cert);
2712. STACK_OF(X509) *sktmp = NULL;
include/openssl/x509.h:169:1: start of procedure sk_X509_value()
167. typedef struct x509_cinf_st X509_CINF;
168.
169. > DEFINE_STACK_OF(X509)
170.
171. /* This is used for a table of trust checking functions */
crypto/stack/stack.c:323:1: start of procedure sk_value()
321. }
322.
323. > void *sk_value(const _STACK *st, int i)
324. {
325. if (!st || (i < 0) || (i >= st->num))
crypto/stack/stack.c:325:10: Taking true branch
323. void *sk_value(const _STACK *st, int i)
324. {
325. if (!st || (i < 0) || (i >= st->num))
^
326. return NULL;
327. return st->data[i];
crypto/stack/stack.c:326:9:
324. {
325. if (!st || (i < 0) || (i >= st->num))
326. > return NULL;
327. return st->data[i];
328. }
crypto/stack/stack.c:328:1: return from a call to sk_value
326. return NULL;
327. return st->data[i];
328. > }
329.
330. void *sk_set(_STACK *st, int i, void *value)
include/openssl/x509.h:169:1: return from a call to sk_X509_value
167. typedef struct x509_cinf_st X509_CINF;
168.
169. > DEFINE_STACK_OF(X509)
170.
171. /* This is used for a table of trust checking functions */
crypto/x509/x509_vfy.c:2711:5:
2709. int num = sk_X509_num(ctx->chain);
2710. X509 *cert = sk_X509_value(ctx->chain, num - 1);
2711. > int ss = cert_self_signed(cert);
2712. STACK_OF(X509) *sktmp = NULL;
2713. unsigned int search;
crypto/x509/x509_vfy.c:154:1: start of procedure cert_self_signed()
152.
153. /* Return 1 is a certificate is self signed */
154. > static int cert_self_signed(X509 *x)
155. {
156. /*
crypto/x509/x509_vfy.c:161:5: Skipping X509_check_purpose(): empty list of specs
159. * parse errors, rather than memory pressure!
160. */
161. X509_check_purpose(x, -1, 0);
^
162. if (x->ex_flags & EXFLAG_SS)
163. return 1;
crypto/x509/x509_vfy.c:162:9:
160. */
161. X509_check_purpose(x, -1, 0);
162. > if (x->ex_flags & EXFLAG_SS)
163. return 1;
164. else
| https://github.com/openssl/openssl/blob/895c2f84a6a083fc8b9f69f962ed19da12ce3b40/crypto/x509/x509_vfy.c/#L2711 |
d2a_code_trace_data_41485 | void dsputil_init(DSPContext* c, AVCodecContext *avctx)
{
int i;
ff_check_alignment();
#ifdef CONFIG_ENCODERS
if(avctx->dct_algo==FF_DCT_FASTINT) {
c->fdct = fdct_ifast;
c->fdct248 = fdct_ifast248;
}
else if(avctx->dct_algo==FF_DCT_FAAN) {
c->fdct = ff_faandct;
c->fdct248 = ff_faandct248;
}
else {
c->fdct = ff_jpeg_fdct_islow;
c->fdct248 = ff_fdct248_islow;
}
#endif
if(avctx->lowres==1){
if(avctx->idct_algo==FF_IDCT_INT || avctx->idct_algo==FF_IDCT_AUTO || !ENABLE_H264_DECODER){
c->idct_put= ff_jref_idct4_put;
c->idct_add= ff_jref_idct4_add;
}else{
c->idct_put= ff_h264_lowres_idct_put_c;
c->idct_add= ff_h264_lowres_idct_add_c;
}
c->idct = j_rev_dct4;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else if(avctx->lowres==2){
c->idct_put= ff_jref_idct2_put;
c->idct_add= ff_jref_idct2_add;
c->idct = j_rev_dct2;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else if(avctx->lowres==3){
c->idct_put= ff_jref_idct1_put;
c->idct_add= ff_jref_idct1_add;
c->idct = j_rev_dct1;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else{
if(avctx->idct_algo==FF_IDCT_INT){
c->idct_put= ff_jref_idct_put;
c->idct_add= ff_jref_idct_add;
c->idct = j_rev_dct;
c->idct_permutation_type= FF_LIBMPEG2_IDCT_PERM;
}else if((ENABLE_VP3_DECODER || ENABLE_VP5_DECODER || ENABLE_VP6_DECODER || ENABLE_THEORA_DECODER ) &&
avctx->idct_algo==FF_IDCT_VP3){
c->idct_put= ff_vp3_idct_put_c;
c->idct_add= ff_vp3_idct_add_c;
c->idct = ff_vp3_idct_c;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else if(avctx->idct_algo==FF_IDCT_WMV2){
c->idct_put= ff_wmv2_idct_put_c;
c->idct_add= ff_wmv2_idct_add_c;
c->idct = ff_wmv2_idct_c;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else if(avctx->idct_algo==FF_IDCT_FAAN){
c->idct_put= ff_faanidct_put;
c->idct_add= ff_faanidct_add;
c->idct = ff_faanidct;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}else{
c->idct_put= ff_simple_idct_put;
c->idct_add= ff_simple_idct_add;
c->idct = ff_simple_idct;
c->idct_permutation_type= FF_NO_IDCT_PERM;
}
}
if (ENABLE_H264_DECODER) {
c->h264_idct_add= ff_h264_idct_add_c;
c->h264_idct8_add= ff_h264_idct8_add_c;
c->h264_idct_dc_add= ff_h264_idct_dc_add_c;
c->h264_idct8_dc_add= ff_h264_idct8_dc_add_c;
}
c->get_pixels = get_pixels_c;
c->diff_pixels = diff_pixels_c;
c->put_pixels_clamped = put_pixels_clamped_c;
c->put_signed_pixels_clamped = put_signed_pixels_clamped_c;
c->add_pixels_clamped = add_pixels_clamped_c;
c->add_pixels8 = add_pixels8_c;
c->add_pixels4 = add_pixels4_c;
c->sum_abs_dctelem = sum_abs_dctelem_c;
c->gmc1 = gmc1_c;
c->gmc = ff_gmc_c;
c->clear_blocks = clear_blocks_c;
c->pix_sum = pix_sum_c;
c->pix_norm1 = pix_norm1_c;
c->pix_abs[0][0] = pix_abs16_c;
c->pix_abs[0][1] = pix_abs16_x2_c;
c->pix_abs[0][2] = pix_abs16_y2_c;
c->pix_abs[0][3] = pix_abs16_xy2_c;
c->pix_abs[1][0] = pix_abs8_c;
c->pix_abs[1][1] = pix_abs8_x2_c;
c->pix_abs[1][2] = pix_abs8_y2_c;
c->pix_abs[1][3] = pix_abs8_xy2_c;
#define dspfunc(PFX, IDX, NUM) \
c->PFX ## _pixels_tab[IDX][0] = PFX ## _pixels ## NUM ## _c; \
c->PFX ## _pixels_tab[IDX][1] = PFX ## _pixels ## NUM ## _x2_c; \
c->PFX ## _pixels_tab[IDX][2] = PFX ## _pixels ## NUM ## _y2_c; \
c->PFX ## _pixels_tab[IDX][3] = PFX ## _pixels ## NUM ## _xy2_c
dspfunc(put, 0, 16);
dspfunc(put_no_rnd, 0, 16);
dspfunc(put, 1, 8);
dspfunc(put_no_rnd, 1, 8);
dspfunc(put, 2, 4);
dspfunc(put, 3, 2);
dspfunc(avg, 0, 16);
dspfunc(avg_no_rnd, 0, 16);
dspfunc(avg, 1, 8);
dspfunc(avg_no_rnd, 1, 8);
dspfunc(avg, 2, 4);
dspfunc(avg, 3, 2);
#undef dspfunc
c->put_no_rnd_pixels_l2[0]= put_no_rnd_pixels16_l2_c;
c->put_no_rnd_pixels_l2[1]= put_no_rnd_pixels8_l2_c;
c->put_tpel_pixels_tab[ 0] = put_tpel_pixels_mc00_c;
c->put_tpel_pixels_tab[ 1] = put_tpel_pixels_mc10_c;
c->put_tpel_pixels_tab[ 2] = put_tpel_pixels_mc20_c;
c->put_tpel_pixels_tab[ 4] = put_tpel_pixels_mc01_c;
c->put_tpel_pixels_tab[ 5] = put_tpel_pixels_mc11_c;
c->put_tpel_pixels_tab[ 6] = put_tpel_pixels_mc21_c;
c->put_tpel_pixels_tab[ 8] = put_tpel_pixels_mc02_c;
c->put_tpel_pixels_tab[ 9] = put_tpel_pixels_mc12_c;
c->put_tpel_pixels_tab[10] = put_tpel_pixels_mc22_c;
c->avg_tpel_pixels_tab[ 0] = avg_tpel_pixels_mc00_c;
c->avg_tpel_pixels_tab[ 1] = avg_tpel_pixels_mc10_c;
c->avg_tpel_pixels_tab[ 2] = avg_tpel_pixels_mc20_c;
c->avg_tpel_pixels_tab[ 4] = avg_tpel_pixels_mc01_c;
c->avg_tpel_pixels_tab[ 5] = avg_tpel_pixels_mc11_c;
c->avg_tpel_pixels_tab[ 6] = avg_tpel_pixels_mc21_c;
c->avg_tpel_pixels_tab[ 8] = avg_tpel_pixels_mc02_c;
c->avg_tpel_pixels_tab[ 9] = avg_tpel_pixels_mc12_c;
c->avg_tpel_pixels_tab[10] = avg_tpel_pixels_mc22_c;
#define dspfunc(PFX, IDX, NUM) \
c->PFX ## _pixels_tab[IDX][ 0] = PFX ## NUM ## _mc00_c; \
c->PFX ## _pixels_tab[IDX][ 1] = PFX ## NUM ## _mc10_c; \
c->PFX ## _pixels_tab[IDX][ 2] = PFX ## NUM ## _mc20_c; \
c->PFX ## _pixels_tab[IDX][ 3] = PFX ## NUM ## _mc30_c; \
c->PFX ## _pixels_tab[IDX][ 4] = PFX ## NUM ## _mc01_c; \
c->PFX ## _pixels_tab[IDX][ 5] = PFX ## NUM ## _mc11_c; \
c->PFX ## _pixels_tab[IDX][ 6] = PFX ## NUM ## _mc21_c; \
c->PFX ## _pixels_tab[IDX][ 7] = PFX ## NUM ## _mc31_c; \
c->PFX ## _pixels_tab[IDX][ 8] = PFX ## NUM ## _mc02_c; \
c->PFX ## _pixels_tab[IDX][ 9] = PFX ## NUM ## _mc12_c; \
c->PFX ## _pixels_tab[IDX][10] = PFX ## NUM ## _mc22_c; \
c->PFX ## _pixels_tab[IDX][11] = PFX ## NUM ## _mc32_c; \
c->PFX ## _pixels_tab[IDX][12] = PFX ## NUM ## _mc03_c; \
c->PFX ## _pixels_tab[IDX][13] = PFX ## NUM ## _mc13_c; \
c->PFX ## _pixels_tab[IDX][14] = PFX ## NUM ## _mc23_c; \
c->PFX ## _pixels_tab[IDX][15] = PFX ## NUM ## _mc33_c
dspfunc(put_qpel, 0, 16);
dspfunc(put_no_rnd_qpel, 0, 16);
dspfunc(avg_qpel, 0, 16);
dspfunc(put_qpel, 1, 8);
dspfunc(put_no_rnd_qpel, 1, 8);
dspfunc(avg_qpel, 1, 8);
dspfunc(put_h264_qpel, 0, 16);
dspfunc(put_h264_qpel, 1, 8);
dspfunc(put_h264_qpel, 2, 4);
dspfunc(put_h264_qpel, 3, 2);
dspfunc(avg_h264_qpel, 0, 16);
dspfunc(avg_h264_qpel, 1, 8);
dspfunc(avg_h264_qpel, 2, 4);
#undef dspfunc
c->put_h264_chroma_pixels_tab[0]= put_h264_chroma_mc8_c;
c->put_h264_chroma_pixels_tab[1]= put_h264_chroma_mc4_c;
c->put_h264_chroma_pixels_tab[2]= put_h264_chroma_mc2_c;
c->avg_h264_chroma_pixels_tab[0]= avg_h264_chroma_mc8_c;
c->avg_h264_chroma_pixels_tab[1]= avg_h264_chroma_mc4_c;
c->avg_h264_chroma_pixels_tab[2]= avg_h264_chroma_mc2_c;
c->put_no_rnd_h264_chroma_pixels_tab[0]= put_no_rnd_h264_chroma_mc8_c;
c->weight_h264_pixels_tab[0]= weight_h264_pixels16x16_c;
c->weight_h264_pixels_tab[1]= weight_h264_pixels16x8_c;
c->weight_h264_pixels_tab[2]= weight_h264_pixels8x16_c;
c->weight_h264_pixels_tab[3]= weight_h264_pixels8x8_c;
c->weight_h264_pixels_tab[4]= weight_h264_pixels8x4_c;
c->weight_h264_pixels_tab[5]= weight_h264_pixels4x8_c;
c->weight_h264_pixels_tab[6]= weight_h264_pixels4x4_c;
c->weight_h264_pixels_tab[7]= weight_h264_pixels4x2_c;
c->weight_h264_pixels_tab[8]= weight_h264_pixels2x4_c;
c->weight_h264_pixels_tab[9]= weight_h264_pixels2x2_c;
c->biweight_h264_pixels_tab[0]= biweight_h264_pixels16x16_c;
c->biweight_h264_pixels_tab[1]= biweight_h264_pixels16x8_c;
c->biweight_h264_pixels_tab[2]= biweight_h264_pixels8x16_c;
c->biweight_h264_pixels_tab[3]= biweight_h264_pixels8x8_c;
c->biweight_h264_pixels_tab[4]= biweight_h264_pixels8x4_c;
c->biweight_h264_pixels_tab[5]= biweight_h264_pixels4x8_c;
c->biweight_h264_pixels_tab[6]= biweight_h264_pixels4x4_c;
c->biweight_h264_pixels_tab[7]= biweight_h264_pixels4x2_c;
c->biweight_h264_pixels_tab[8]= biweight_h264_pixels2x4_c;
c->biweight_h264_pixels_tab[9]= biweight_h264_pixels2x2_c;
c->draw_edges = draw_edges_c;
#ifdef CONFIG_CAVS_DECODER
ff_cavsdsp_init(c,avctx);
#endif
#if defined(CONFIG_VC1_DECODER) || defined(CONFIG_WMV3_DECODER)
ff_vc1dsp_init(c,avctx);
#endif
#if defined(CONFIG_WMV2_DECODER) || defined(CONFIG_VC1_DECODER) || defined(CONFIG_WMV3_DECODER)
ff_intrax8dsp_init(c,avctx);
#endif
#if defined(CONFIG_H264_ENCODER)
ff_h264dspenc_init(c,avctx);
#endif
c->put_mspel_pixels_tab[0]= put_mspel8_mc00_c;
c->put_mspel_pixels_tab[1]= put_mspel8_mc10_c;
c->put_mspel_pixels_tab[2]= put_mspel8_mc20_c;
c->put_mspel_pixels_tab[3]= put_mspel8_mc30_c;
c->put_mspel_pixels_tab[4]= put_mspel8_mc02_c;
c->put_mspel_pixels_tab[5]= put_mspel8_mc12_c;
c->put_mspel_pixels_tab[6]= put_mspel8_mc22_c;
c->put_mspel_pixels_tab[7]= put_mspel8_mc32_c;
#define SET_CMP_FUNC(name) \
c->name[0]= name ## 16_c;\
c->name[1]= name ## 8x8_c;
SET_CMP_FUNC(hadamard8_diff)
c->hadamard8_diff[4]= hadamard8_intra16_c;
SET_CMP_FUNC(dct_sad)
SET_CMP_FUNC(dct_max)
#ifdef CONFIG_GPL
SET_CMP_FUNC(dct264_sad)
#endif
c->sad[0]= pix_abs16_c;
c->sad[1]= pix_abs8_c;
c->sse[0]= sse16_c;
c->sse[1]= sse8_c;
c->sse[2]= sse4_c;
SET_CMP_FUNC(quant_psnr)
SET_CMP_FUNC(rd)
SET_CMP_FUNC(bit)
c->vsad[0]= vsad16_c;
c->vsad[4]= vsad_intra16_c;
c->vsse[0]= vsse16_c;
c->vsse[4]= vsse_intra16_c;
c->nsse[0]= nsse16_c;
c->nsse[1]= nsse8_c;
#ifdef CONFIG_SNOW_ENCODER
c->w53[0]= w53_16_c;
c->w53[1]= w53_8_c;
c->w97[0]= w97_16_c;
c->w97[1]= w97_8_c;
#endif
c->ssd_int8_vs_int16 = ssd_int8_vs_int16_c;
c->add_bytes= add_bytes_c;
c->add_bytes_l2= add_bytes_l2_c;
c->diff_bytes= diff_bytes_c;
c->sub_hfyu_median_prediction= sub_hfyu_median_prediction_c;
c->bswap_buf= bswap_buf;
#ifdef CONFIG_PNG_DECODER
c->add_png_paeth_prediction= ff_add_png_paeth_prediction;
#endif
c->h264_v_loop_filter_luma= h264_v_loop_filter_luma_c;
c->h264_h_loop_filter_luma= h264_h_loop_filter_luma_c;
c->h264_v_loop_filter_chroma= h264_v_loop_filter_chroma_c;
c->h264_h_loop_filter_chroma= h264_h_loop_filter_chroma_c;
c->h264_v_loop_filter_chroma_intra= h264_v_loop_filter_chroma_intra_c;
c->h264_h_loop_filter_chroma_intra= h264_h_loop_filter_chroma_intra_c;
c->h264_loop_filter_strength= NULL;
if (ENABLE_ANY_H263) {
c->h263_h_loop_filter= h263_h_loop_filter_c;
c->h263_v_loop_filter= h263_v_loop_filter_c;
}
c->h261_loop_filter= h261_loop_filter_c;
c->try_8x8basis= try_8x8basis_c;
c->add_8x8basis= add_8x8basis_c;
#ifdef CONFIG_SNOW_DECODER
c->vertical_compose97i = ff_snow_vertical_compose97i;
c->horizontal_compose97i = ff_snow_horizontal_compose97i;
c->inner_add_yblock = ff_snow_inner_add_yblock;
#endif
#ifdef CONFIG_VORBIS_DECODER
c->vorbis_inverse_coupling = vorbis_inverse_coupling;
#endif
#ifdef CONFIG_FLAC_ENCODER
c->flac_compute_autocorr = ff_flac_compute_autocorr;
#endif
c->vector_fmul = vector_fmul_c;
c->vector_fmul_reverse = vector_fmul_reverse_c;
c->vector_fmul_add_add = ff_vector_fmul_add_add_c;
c->float_to_int16 = ff_float_to_int16_c;
c->shrink[0]= ff_img_copy_plane;
c->shrink[1]= ff_shrink22;
c->shrink[2]= ff_shrink44;
c->shrink[3]= ff_shrink88;
c->prefetch= just_return;
memset(c->put_2tap_qpel_pixels_tab, 0, sizeof(c->put_2tap_qpel_pixels_tab));
memset(c->avg_2tap_qpel_pixels_tab, 0, sizeof(c->avg_2tap_qpel_pixels_tab));
if (ENABLE_MMX) dsputil_init_mmx (c, avctx);
if (ENABLE_ARMV4L) dsputil_init_armv4l(c, avctx);
if (ENABLE_MLIB) dsputil_init_mlib (c, avctx);
if (ENABLE_VIS) dsputil_init_vis (c, avctx);
if (ENABLE_ALPHA) dsputil_init_alpha (c, avctx);
if (ENABLE_POWERPC) dsputil_init_ppc (c, avctx);
if (ENABLE_MMI) dsputil_init_mmi (c, avctx);
if (ENABLE_SH4) dsputil_init_sh4 (c, avctx);
if (ENABLE_BFIN) dsputil_init_bfin (c, avctx);
for(i=0; i<64; i++){
if(!c->put_2tap_qpel_pixels_tab[0][i])
c->put_2tap_qpel_pixels_tab[0][i]= c->put_h264_qpel_pixels_tab[0][i];
if(!c->avg_2tap_qpel_pixels_tab[0][i])
c->avg_2tap_qpel_pixels_tab[0][i]= c->avg_h264_qpel_pixels_tab[0][i];
}
switch(c->idct_permutation_type){
case FF_NO_IDCT_PERM:
for(i=0; i<64; i++)
c->idct_permutation[i]= i;
break;
case FF_LIBMPEG2_IDCT_PERM:
for(i=0; i<64; i++)
c->idct_permutation[i]= (i & 0x38) | ((i & 6) >> 1) | ((i & 1) << 2);
break;
case FF_SIMPLE_IDCT_PERM:
for(i=0; i<64; i++)
c->idct_permutation[i]= simple_mmx_permutation[i];
break;
case FF_TRANSPOSE_IDCT_PERM:
for(i=0; i<64; i++)
c->idct_permutation[i]= ((i&7)<<3) | (i>>3);
break;
case FF_PARTTRANS_IDCT_PERM:
for(i=0; i<64; i++)
c->idct_permutation[i]= (i&0x24) | ((i&3)<<3) | ((i>>3)&3);
break;
default:
av_log(avctx, AV_LOG_ERROR, "Internal error, IDCT permutation not set\n");
}
}
libavcodec/dsputil.c:4452: error: Buffer Overrun L2
Offset: [0, 63] Size: 16.
libavcodec/dsputil.c:4451:9: <Offset trace>
4449. if (ENABLE_BFIN) dsputil_init_bfin (c, avctx);
4450.
4451. for(i=0; i<64; i++){
^
4452. if(!c->put_2tap_qpel_pixels_tab[0][i])
4453. c->put_2tap_qpel_pixels_tab[0][i]= c->put_h264_qpel_pixels_tab[0][i];
libavcodec/dsputil.c:4451:9: Assignment
4449. if (ENABLE_BFIN) dsputil_init_bfin (c, avctx);
4450.
4451. for(i=0; i<64; i++){
^
4452. if(!c->put_2tap_qpel_pixels_tab[0][i])
4453. c->put_2tap_qpel_pixels_tab[0][i]= c->put_h264_qpel_pixels_tab[0][i];
libavcodec/dsputil.c:4115:1: <Length trace>
4113. }
4114.
4115. void dsputil_init(DSPContext* c, AVCodecContext *avctx)
^
4116. {
4117. int i;
libavcodec/dsputil.c:4115:1: Parameter `c->put_2tap_qpel_pixels_tab[*][*]`
4113. }
4114.
4115. void dsputil_init(DSPContext* c, AVCodecContext *avctx)
^
4116. {
4117. int i;
libavcodec/dsputil.c:4452:13: Array access: Offset: [0, 63] Size: 16
4450.
4451. for(i=0; i<64; i++){
4452. if(!c->put_2tap_qpel_pixels_tab[0][i])
^
4453. c->put_2tap_qpel_pixels_tab[0][i]= c->put_h264_qpel_pixels_tab[0][i];
4454. if(!c->avg_2tap_qpel_pixels_tab[0][i])
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dsputil.c/#L4452 |
d2a_code_trace_data_41486 | static void getSubSampleFactors(int *h, int *v, enum AVPixelFormat format)
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format);
*h = desc->log2_chroma_w;
*v = desc->log2_chroma_h;
}
libswscale/utils.c:780: error: Null Dereference
pointer `desc` last assigned on line 779 could be null and is dereferenced at line 780, column 10.
libswscale/utils.c:777:1: start of procedure getSubSampleFactors()
775. #endif /* HAVE_MMXEXT_INLINE */
776.
777. static void getSubSampleFactors(int *h, int *v, enum AVPixelFormat format)
^
778. {
779. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format);
libswscale/utils.c:779:5:
777. static void getSubSampleFactors(int *h, int *v, enum AVPixelFormat format)
778. {
779. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format);
^
780. *h = desc->log2_chroma_w;
781. *v = desc->log2_chroma_h;
libavutil/pixdesc.c:1468:1: start of procedure av_pix_fmt_desc_get()
1466. }
1467.
1468. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
^
1469. {
1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
libavutil/pixdesc.c:1470:9: Taking false branch
1468. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1469. {
1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
^
1471. return NULL;
1472. return &av_pix_fmt_descriptors[pix_fmt];
libavutil/pixdesc.c:1470:24: Taking true branch
1468. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1469. {
1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
^
1471. return NULL;
1472. return &av_pix_fmt_descriptors[pix_fmt];
libavutil/pixdesc.c:1471:9:
1469. {
1470. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
1471. return NULL;
^
1472. return &av_pix_fmt_descriptors[pix_fmt];
1473. }
libavutil/pixdesc.c:1473:1: return from a call to av_pix_fmt_desc_get
1471. return NULL;
1472. return &av_pix_fmt_descriptors[pix_fmt];
1473. }
^
1474.
1475. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
libswscale/utils.c:780:5:
778. {
779. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(format);
780. *h = desc->log2_chroma_w;
^
781. *v = desc->log2_chroma_h;
782. }
| https://github.com/libav/libav/blob/0a14fefd68cc18ce3252edff8a05ee9b3945b694/libswscale/utils.c/#L780 |
d2a_code_trace_data_41487 | static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, const int16_t bS[7], int bsi, int qp ) {
const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);
int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;
int alpha = alpha_table[index_a];
int beta = beta_table[qp - qp_bd_offset + h->slice_beta_offset];
if (alpha ==0 || beta == 0) return;
if( bS[0] < 4 ) {
int8_t tc[4];
tc[0] = tc0_table[index_a][bS[0*bsi]];
tc[1] = tc0_table[index_a][bS[1*bsi]];
tc[2] = tc0_table[index_a][bS[2*bsi]];
tc[3] = tc0_table[index_a][bS[3*bsi]];
h->h264dsp.h264_h_loop_filter_luma_mbaff(pix, stride, alpha, beta, tc);
} else {
h->h264dsp.h264_h_loop_filter_luma_mbaff_intra(pix, stride, alpha, beta);
}
}
libavcodec/h264_loopfilter.c:713: error: Buffer Overrun L2
Offset: [1, 4] Size: 4 by call to `filter_mb_mbaff_edgev`.
libavcodec/h264_loopfilter.c:684:21: Assignment
682.
683. if( IS_INTRA( mbn_type ) )
684. bS[i] = 4;
^
685. else{
686. bS[i] = 1 + !!(h->non_zero_count_cache[12+8*(i>>1)] |
libavcodec/h264_loopfilter.c:713:13: Call
711. { int i; for (i = 0; i < 8; i++) tprintf(s->avctx, " bS[%d]:%d", i, bS[i]); tprintf(s->avctx, "\n"); }
712. if(MB_FIELD){
713. filter_mb_mbaff_edgev ( h, img_y , linesize, bS , 1, qp [0] );
^
714. filter_mb_mbaff_edgev ( h, img_y + 8* linesize, linesize, bS+4, 1, qp [1] );
715. if (chroma){
libavcodec/h264_loopfilter.c:140:1: <Offset trace>
138. }
139.
140. static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, const int16_t bS[7], int bsi, int qp ) {
^
141. const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);
142. int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;
libavcodec/h264_loopfilter.c:140:1: Parameter `*bS`
138. }
139.
140. static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, const int16_t bS[7], int bsi, int qp ) {
^
141. const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);
142. int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;
libavcodec/h264_loopfilter.c:73:1: <Length trace>
71. 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
72. };
73. static const uint8_t tc0_table[52*3][4] = {
^
74. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
75. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
libavcodec/h264_loopfilter.c:73:1: Array declaration
71. 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
72. };
73. static const uint8_t tc0_table[52*3][4] = {
^
74. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
75. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
libavcodec/h264_loopfilter.c:149:17: Array access: Offset: [1, 4] Size: 4 by call to `filter_mb_mbaff_edgev`
147. if( bS[0] < 4 ) {
148. int8_t tc[4];
149. tc[0] = tc0_table[index_a][bS[0*bsi]];
^
150. tc[1] = tc0_table[index_a][bS[1*bsi]];
151. tc[2] = tc0_table[index_a][bS[2*bsi]];
| https://github.com/libav/libav/blob/ecf026f1aa8ffe170b5b8c577cae56a405ebafc8/libavcodec/h264_loopfilter.c/#L149 |
d2a_code_trace_data_41488 | 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:449: error: BUFFER_OVERRUN_L3
Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_mod_mul`.
Showing all 17 steps of the trace
crypto/ec/ecdsa_ossl.c:428:10: Call
426. }
427. /* calculate tmp1 = inv(S) mod order */
428. if (!ec_group_do_inverse_ord(group, u2, sig->s, ctx)) {
^
429. ECerr(EC_F_OSSL_ECDSA_VERIFY_SIG, ERR_R_BN_LIB);
430. goto err;
crypto/ec/ec_lib.c:1074:1: Parameter `res->top`
1072. * other functionality.
1073. */
1074. > int ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res,
1075. const BIGNUM *x, BN_CTX *ctx)
1076. {
crypto/ec/ecdsa_ossl.c:449:10: Call
447. }
448. /* u1 = m * tmp mod order */
449. if (!BN_mod_mul(u1, m, u2, order, ctx)) {
^
450. ECerr(EC_F_OSSL_ECDSA_VERIFY_SIG, ERR_R_BN_LIB);
451. goto err;
crypto/bn/bn_mod.c:73:1: Parameter `a->top`
71.
72. /* slow but works */
73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
74. BN_CTX *ctx)
75. {
crypto/bn/bn_mod.c:87:14: Call
85. goto err;
86. if (a == b) {
87. if (!BN_sqr(t, a, ctx))
^
88. goto err;
89. } else {
crypto/bn/bn_sqr.c:17:1: Parameter `a->top`
15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96
16. */
17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
18. {
19. int max, al;
crypto/bn/bn_sqr.c:25:5: Assignment
23. bn_check_top(a);
24.
25. al = a->top;
^
26. if (al <= 0) {
27. r->top = 0;
crypto/bn/bn_sqr.c:74:17: Call
72. if (bn_wexpand(tmp, max) == NULL)
73. goto err;
74. bn_sqr_normal(rr->d, a->d, al, tmp->d);
^
75. }
76. }
crypto/bn/bn_sqr.c:105:1: <Offset trace>
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:105:1: Parameter `n`
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:116:5: Assignment
114. rp[0] = rp[max - 1] = 0;
115. rp++;
116. j = n;
^
117.
118. if (--j > 0) {
crypto/bn/bn_sqr.c:118:9: Assignment
116. j = n;
117.
118. if (--j > 0) {
^
119. ap++;
120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
crypto/bn/bn_sqr.c:105:1: <Length trace>
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:105:1: Parameter `*r`
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:113:5: Assignment
111. max = n * 2;
112. ap = a;
113. rp = r;
^
114. rp[0] = rp[max - 1] = 0;
115. rp++;
crypto/bn/bn_sqr.c:115:5: Assignment
113. rp = r;
114. rp[0] = rp[max - 1] = 0;
115. rp++;
^
116. j = n;
117.
crypto/bn/bn_sqr.c:120:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_mod_mul`
118. if (--j > 0) {
119. ap++;
120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
^
121. rp += 2;
122. }
| https://github.com/openssl/openssl/blob/b8c32081e02b7008a90d878eccce46da256dfe86/crypto/bn/bn_sqr.c/#L120 |
d2a_code_trace_data_41489 | static int aac_decode_frame(AVCodecContext * avccontext, void * data, int * data_size, const uint8_t * buf, int buf_size) {
AACContext * ac = avccontext->priv_data;
GetBitContext gb;
enum RawDataBlockType elem_type;
int err, elem_id, data_size_tmp;
init_get_bits(&gb, buf, buf_size*8);
while ((elem_type = get_bits(&gb, 3)) != TYPE_END) {
elem_id = get_bits(&gb, 4);
err = -1;
if(elem_type == TYPE_SCE && elem_id == 1 &&
!ac->che[TYPE_SCE][elem_id] && ac->che[TYPE_LFE][0]) {
ac->che[TYPE_SCE][elem_id] = ac->che[TYPE_LFE][0];
ac->che[TYPE_LFE][0] = NULL;
}
if(elem_type < TYPE_DSE) {
if(!ac->che[elem_type][elem_id])
return -1;
if(elem_type != TYPE_CCE)
ac->che[elem_type][elem_id]->coup.coupling_point = 4;
}
switch (elem_type) {
case TYPE_SCE:
err = decode_ics(ac, &ac->che[TYPE_SCE][elem_id]->ch[0], &gb, 0, 0);
break;
case TYPE_CPE:
err = decode_cpe(ac, &gb, elem_id);
break;
case TYPE_CCE:
err = decode_cce(ac, &gb, ac->che[TYPE_CCE][elem_id]);
break;
case TYPE_LFE:
err = decode_ics(ac, &ac->che[TYPE_LFE][elem_id]->ch[0], &gb, 0, 0);
break;
case TYPE_DSE:
skip_data_stream_element(&gb);
err = 0;
break;
case TYPE_PCE:
{
enum ChannelPosition new_che_pos[4][MAX_ELEM_ID];
memset(new_che_pos, 0, 4 * MAX_ELEM_ID * sizeof(new_che_pos[0][0]));
if((err = decode_pce(ac, new_che_pos, &gb)))
break;
err = output_configure(ac, ac->che_pos, new_che_pos);
break;
}
case TYPE_FIL:
if (elem_id == 15)
elem_id += get_bits(&gb, 8) - 1;
while (elem_id > 0)
elem_id -= decode_extension_payload(ac, &gb, elem_id);
err = 0;
break;
default:
err = -1;
break;
}
if(err)
return err;
}
spectral_to_sample(ac);
if (!ac->is_saved) {
ac->is_saved = 1;
*data_size = 0;
return buf_size;
}
data_size_tmp = 1024 * avccontext->channels * sizeof(int16_t);
if(*data_size < data_size_tmp) {
av_log(avccontext, AV_LOG_ERROR,
"Output buffer too small (%d) or trying to output too many samples (%d) for this frame.\n",
*data_size, data_size_tmp);
return -1;
}
*data_size = data_size_tmp;
ac->dsp.float_to_int16_interleave(data, (const float **)ac->output_data, 1024, avccontext->channels);
return buf_size;
}
libavcodec/aac.c:1330: error: Null Dereference
pointer `&gb->buffer` last assigned on line 1327 could be null and is dereferenced by call to `get_bits()` at line 1330, column 25.
libavcodec/aac.c:1321:1: start of procedure aac_decode_frame()
1319. }
1320.
1321. static int aac_decode_frame(AVCodecContext * avccontext, void * data, int * data_size, const uint8_t * buf, int buf_size) {
^
1322. AACContext * ac = avccontext->priv_data;
1323. GetBitContext gb;
libavcodec/aac.c:1322:5:
1320.
1321. static int aac_decode_frame(AVCodecContext * avccontext, void * data, int * data_size, const uint8_t * buf, int buf_size) {
1322. AACContext * ac = avccontext->priv_data;
^
1323. GetBitContext gb;
1324. enum RawDataBlockType elem_type;
libavcodec/aac.c:1327:5:
1325. int err, elem_id, data_size_tmp;
1326.
1327. init_get_bits(&gb, buf, buf_size*8);
^
1328.
1329. // parse
libavcodec/bitstream.h:745:1: start of procedure init_get_bits()
743. * @param bit_size the size of the buffer in bits
744. */
745. static inline void init_get_bits(GetBitContext *s,
^
746. const uint8_t *buffer, int bit_size)
747. {
libavcodec/bitstream.h:748:5:
746. const uint8_t *buffer, int bit_size)
747. {
748. int buffer_size= (bit_size+7)>>3;
^
749. if(buffer_size < 0 || bit_size < 0) {
750. buffer_size = bit_size = 0;
libavcodec/bitstream.h:749:8: Taking true branch
747. {
748. int buffer_size= (bit_size+7)>>3;
749. if(buffer_size < 0 || bit_size < 0) {
^
750. buffer_size = bit_size = 0;
751. buffer = NULL;
libavcodec/bitstream.h:750:9:
748. int buffer_size= (bit_size+7)>>3;
749. if(buffer_size < 0 || bit_size < 0) {
750. buffer_size = bit_size = 0;
^
751. buffer = NULL;
752. }
libavcodec/bitstream.h:751:9:
749. if(buffer_size < 0 || bit_size < 0) {
750. buffer_size = bit_size = 0;
751. buffer = NULL;
^
752. }
753.
libavcodec/bitstream.h:754:5:
752. }
753.
754. s->buffer= buffer;
^
755. s->size_in_bits= bit_size;
756. s->buffer_end= buffer + buffer_size;
libavcodec/bitstream.h:755:5:
753.
754. s->buffer= buffer;
755. s->size_in_bits= bit_size;
^
756. s->buffer_end= buffer + buffer_size;
757. #ifdef ALT_BITSTREAM_READER
libavcodec/bitstream.h:756:5:
754. s->buffer= buffer;
755. s->size_in_bits= bit_size;
756. s->buffer_end= buffer + buffer_size;
^
757. #ifdef ALT_BITSTREAM_READER
758. s->index=0;
libavcodec/bitstream.h:758:5:
756. s->buffer_end= buffer + buffer_size;
757. #ifdef ALT_BITSTREAM_READER
758. s->index=0;
^
759. #elif defined LIBMPEG2_BITSTREAM_READER
760. s->buffer_ptr = (uint8_t*)((intptr_t)buffer&(~1));
libavcodec/bitstream.h:768:1: return from a call to init_get_bits
766. skip_bits_long(s, 0);
767. #endif
768. }
^
769.
770. static inline void align_get_bits(GetBitContext *s)
libavcodec/aac.c:1330:12:
1328.
1329. // parse
1330. while ((elem_type = get_bits(&gb, 3)) != TYPE_END) {
^
1331. elem_id = get_bits(&gb, 4);
1332. err = -1;
libavcodec/bitstream.h:642:1: start of procedure get_bits()
640. * Note, the alt bitstream reader can read up to 25 bits, but the libmpeg2 reader can't
641. */
642. static inline unsigned int get_bits(GetBitContext *s, int n){
^
643. register int tmp;
644. OPEN_READER(re, s)
libavcodec/bitstream.h:644:5:
642. static inline unsigned int get_bits(GetBitContext *s, int n){
643. register int tmp;
644. OPEN_READER(re, s)
^
645. UPDATE_CACHE(re, s)
646. tmp= SHOW_UBITS(re, s, n);
libavcodec/bitstream.h:645:5:
643. register int tmp;
644. OPEN_READER(re, s)
645. UPDATE_CACHE(re, s)
^
646. tmp= SHOW_UBITS(re, s, n);
647. LAST_SKIP_BITS(re, s, n)
| https://github.com/libav/libav/blob/0885770455c32180001b2ce05d181abe8deaf06d/libavcodec/aac.c/#L1330 |
d2a_code_trace_data_41490 | 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:1044: error: INTEGER_OVERFLOW_L2
([0, +oo] - [`pkt->written`, `pkt->written` + 7]):unsigned64 by call to `WPACKET_sub_memcpy__`.
Showing all 16 steps of the trace
ssl/t1_lib.c:1016:1: Parameter `pkt->written`
1014. }
1015.
1016. > int ssl_add_clienthello_tlsext(SSL *s, WPACKET *pkt, int *al)
1017. {
1018. #ifndef OPENSSL_NO_EC
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->written`
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/t1_lib.c:1044:21: Call
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)
1046. || !WPACKET_close(pkt)) {
ssl/packet.c:301:10: Call
299. size_t lenbytes)
300. {
301. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes)
^
302. || !WPACKET_memcpy(pkt, src, len)
303. || !WPACKET_close(pkt))
ssl/packet.c:205:1: Parameter `pkt->buf->length`
203. }
204.
205. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes)
206. {
207. WPACKET_SUB *sub;
ssl/packet.c:302:17: Call
300. {
301. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes)
302. || !WPACKET_memcpy(pkt, src, len)
^
303. || !WPACKET_close(pkt))
304. return 0;
ssl/packet.c:283:1: Parameter `pkt->written`
281. }
282.
283. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len)
284. {
285. unsigned char *dest;
ssl/packet.c:290:10: Call
288. return 1;
289.
290. if (!WPACKET_allocate_bytes(pkt, len, &dest))
^
291. return 0;
292.
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 + 7]):unsigned64 by call to `WPACKET_sub_memcpy__`
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_41491 | static int opt_metadata(const char *opt, const char *arg)
{
char *mid= strchr(arg, '=');
if(!mid){
fprintf(stderr, "Missing =\n");
ffmpeg_exit(1);
}
*mid++= 0;
av_metadata_set2(&metadata, arg, mid, 0);
return 0;
}
ffmpeg.c:2803: error: Null Dereference
pointer `mid` last assigned on line 2803 could be null and is dereferenced at line 2803, column 5.
ffmpeg.c:2795:1: start of procedure opt_metadata()
2793. }
2794.
2795. static int opt_metadata(const char *opt, const char *arg)
^
2796. {
2797. char *mid= strchr(arg, '=');
ffmpeg.c:2797:5:
2795. static int opt_metadata(const char *opt, const char *arg)
2796. {
2797. char *mid= strchr(arg, '=');
^
2798.
2799. if(!mid){
ffmpeg.c:2799:9: Taking true branch
2797. char *mid= strchr(arg, '=');
2798.
2799. if(!mid){
^
2800. fprintf(stderr, "Missing =\n");
2801. ffmpeg_exit(1);
ffmpeg.c:2800:9:
2798.
2799. if(!mid){
2800. fprintf(stderr, "Missing =\n");
^
2801. ffmpeg_exit(1);
2802. }
ffmpeg.c:2801:9: Skipping ffmpeg_exit(): empty list of specs
2799. if(!mid){
2800. fprintf(stderr, "Missing =\n");
2801. ffmpeg_exit(1);
^
2802. }
2803. *mid++= 0;
ffmpeg.c:2803:5:
2801. ffmpeg_exit(1);
2802. }
2803. *mid++= 0;
^
2804.
2805. av_metadata_set2(&metadata, arg, mid, 0);
| https://github.com/libav/libav/blob/d0005d347d0831c904630fe70408c9fd4eec18e8/ffmpeg.c/#L2803 |
d2a_code_trace_data_41492 | 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:4121: error: NULL_DEREFERENCE
pointer `null` is dereferenced by call to `ssl_security_cert()` at line 4121, column 10.
Showing all 4 steps of the trace
ssl/t1_lib.c:4112:1: start of procedure ssl_security_cert_chain()
4110. */
4111.
4112. > int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *x, int vfy)
4113. {
4114. int rv, start_idx, i;
ssl/t1_lib.c:4115:9: Taking false branch
4113. {
4114. int rv, start_idx, i;
4115. if (x == NULL) {
^
4116. x = sk_X509_value(sk, 0);
4117. start_idx = 1;
ssl/t1_lib.c:4119:9:
4117. start_idx = 1;
4118. } else
4119. > start_idx = 0;
4120.
4121. rv = ssl_security_cert(s, NULL, x, vfy, 1);
ssl/t1_lib.c:4121:5:
4119. start_idx = 0;
4120.
4121. > rv = ssl_security_cert(s, NULL, x, vfy, 1);
4122. if (rv != 1)
4123. return rv;
| https://github.com/openssl/openssl/blob/924ec89a2499ad18009412c6688b02452735a858/ssl/t1_lib.c/#L4121 |
d2a_code_trace_data_41493 | int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
{
assert(pkt->subs != NULL && len != 0);
if (pkt->subs == NULL || len == 0)
return 0;
if (pkt->maxsize - pkt->written < len)
return 0;
if (pkt->buf->length - pkt->written < len) {
size_t newlen;
if (pkt->buf->length > SIZE_MAX / 2) {
newlen = SIZE_MAX;
} else {
newlen = (pkt->buf->length == 0) ? DEFAULT_BUF_SIZE
: pkt->buf->length * 2;
}
if (BUF_MEM_grow(pkt->buf, newlen) == 0)
return 0;
}
*allocbytes = (unsigned char *)pkt->buf->data + pkt->curr;
pkt->written += len;
pkt->curr += len;
return 1;
}
ssl/statem/statem_srvr.c:848: error: INTEGER_OVERFLOW_L2
([0, +oo] - [`pkt->written`, `pkt->written` + 5]):unsigned64 by call to `WPACKET_sub_memcpy__`.
Showing all 14 steps of the trace
ssl/statem/statem_srvr.c:843:1: Parameter `pkt->written`
841. }
842.
843. > int dtls_raw_hello_verify_request(WPACKET *pkt, unsigned char *cookie,
844. unsigned char cookie_len)
845. {
ssl/statem/statem_srvr.c:847:10: Call
845. {
846. /* Always use DTLS 1.0 version: see RFC 6347 */
847. if (!WPACKET_put_bytes_u16(pkt, DTLS1_VERSION)
^
848. || !WPACKET_sub_memcpy_u8(pkt, cookie, cookie_len))
849. return 0;
ssl/packet.c:238:1: Parameter `pkt->written`
236. }
237.
238. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size)
239. {
240. unsigned char *data;
ssl/statem/statem_srvr.c:848:17: Call
846. /* Always use DTLS 1.0 version: see RFC 6347 */
847. if (!WPACKET_put_bytes_u16(pkt, DTLS1_VERSION)
848. || !WPACKET_sub_memcpy_u8(pkt, cookie, cookie_len))
^
849. return 0;
850.
ssl/packet.c:297:10: Call
295. size_t lenbytes)
296. {
297. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes)
^
298. || !WPACKET_memcpy(pkt, src, len)
299. || !WPACKET_close(pkt))
ssl/packet.c:201:1: Parameter `pkt->buf->length`
199. }
200.
201. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes)
202. {
203. WPACKET_SUB *sub;
ssl/packet.c:298:17: Call
296. {
297. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes)
298. || !WPACKET_memcpy(pkt, src, len)
^
299. || !WPACKET_close(pkt))
300. return 0;
ssl/packet.c:279:1: Parameter `pkt->written`
277. }
278.
279. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len)
280. {
281. unsigned char *dest;
ssl/packet.c:286:10: Call
284. return 1;
285.
286. if (!WPACKET_allocate_bytes(pkt, len, &dest))
^
287. return 0;
288.
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 + 5]):unsigned64 by call to `WPACKET_sub_memcpy__`
23. return 0;
24.
25. if (pkt->buf->length - pkt->written < len) {
^
26. size_t newlen;
27.
| https://github.com/openssl/openssl/blob/84d5549e692e63a16fa1b11603e4098fc31746e9/ssl/packet.c/#L25 |
d2a_code_trace_data_41494 | static void getChannelWeights (int indx, int flag, float ch[2]){
if (indx == 7) {
ch[0] = 1.0;
ch[1] = 1.0;
} else {
ch[0] = (float)(indx & 7) / 7.0;
ch[1] = sqrt(2 - ch[0]*ch[0]);
if(flag)
FFSWAP(float, ch[0], ch[1]);
}
}
libavcodec/atrac3.c:686: error: Buffer Overrun L1
Offset: 2 (⇐ 1 + 1) Size: 2 by call to `getChannelWeights`.
libavcodec/atrac3.c:678:1: Array declaration
676. }
677.
678. static void channelWeighting (float *su1, float *su2, int *p3)
^
679. {
680. int band, nsample;
libavcodec/atrac3.c:686:9: Call
684. if (p3[1] != 7 || p3[3] != 7){
685. getChannelWeights(p3[1], p3[0], w[0]);
686. getChannelWeights(p3[3], p3[2], w[1]);
^
687.
688. for(band = 1; band < 4; band++) {
libavcodec/atrac3.c:665:1: <Length trace>
663. }
664.
665. static void getChannelWeights (int indx, int flag, float ch[2]){
^
666.
667. if (indx == 7) {
libavcodec/atrac3.c:665:1: Parameter `*ch`
663. }
664.
665. static void getChannelWeights (int indx, int flag, float ch[2]){
^
666.
667. if (indx == 7) {
libavcodec/atrac3.c:669:9: Array access: Offset: 2 (⇐ 1 + 1) Size: 2 by call to `getChannelWeights`
667. if (indx == 7) {
668. ch[0] = 1.0;
669. ch[1] = 1.0;
^
670. } else {
671. ch[0] = (float)(indx & 7) / 7.0;
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/atrac3.c/#L669 |
d2a_code_trace_data_41495 | int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm)
{
SSL_COMP *comp;
if (cm == NULL || cm->type == NID_undef)
return 1;
if (id < 193 || id > 255)
{
SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE);
return 0;
}
MemCheck_off();
comp=(SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP));
comp->id=id;
comp->method=cm;
load_builtin_compressions();
if (ssl_comp_methods
&& sk_SSL_COMP_find(ssl_comp_methods,comp) >= 0)
{
OPENSSL_free(comp);
MemCheck_on();
SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,SSL_R_DUPLICATE_COMPRESSION_ID);
return(1);
}
else if ((ssl_comp_methods == NULL)
|| !sk_SSL_COMP_push(ssl_comp_methods,comp))
{
OPENSSL_free(comp);
MemCheck_on();
SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,ERR_R_MALLOC_FAILURE);
return(1);
}
else
{
MemCheck_on();
return(0);
}
}
ssl/ssl_ciph.c:1885: error: NULL_DEREFERENCE
pointer `comp` last assigned on line 1884 could be null and is dereferenced at line 1885, column 2.
Showing all 44 steps of the trace
ssl/ssl_ciph.c:1864:1: start of procedure SSL_COMP_add_compression_method()
1862. }
1863.
1864. > int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm)
1865. {
1866. SSL_COMP *comp;
ssl/ssl_ciph.c:1868:13: Taking false branch
1866. SSL_COMP *comp;
1867.
1868. if (cm == NULL || cm->type == NID_undef)
^
1869. return 1;
1870.
ssl/ssl_ciph.c:1868:27: Taking false branch
1866. SSL_COMP *comp;
1867.
1868. if (cm == NULL || cm->type == NID_undef)
^
1869. return 1;
1870.
ssl/ssl_ciph.c:1877:6: Taking false branch
1875. 64 to 192: external party methods assigned by IANA
1876. 193 to 255: reserved for private use */
1877. if (id < 193 || id > 255)
^
1878. {
1879. SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE);
ssl/ssl_ciph.c:1877:18: Taking false branch
1875. 64 to 192: external party methods assigned by IANA
1876. 193 to 255: reserved for private use */
1877. if (id < 193 || id > 255)
^
1878. {
1879. SSLerr(SSL_F_SSL_COMP_ADD_COMPRESSION_METHOD,SSL_R_COMPRESSION_ID_NOT_WITHIN_PRIVATE_RANGE);
ssl/ssl_ciph.c:1883:2:
1881. }
1882.
1883. > MemCheck_off();
1884. comp=(SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP));
1885. comp->id=id;
crypto/mem_dbg.c:216:1: start of procedure CRYPTO_mem_ctrl()
214. }
215.
216. > int CRYPTO_mem_ctrl(int mode)
217. {
218. int ret=mh_mode;
crypto/mem_dbg.c:218:2:
216. int CRYPTO_mem_ctrl(int mode)
217. {
218. > int ret=mh_mode;
219.
220. CRYPTO_w_lock(CRYPTO_LOCK_MALLOC);
crypto/mem_dbg.c:220:2:
218. int ret=mh_mode;
219.
220. > CRYPTO_w_lock(CRYPTO_LOCK_MALLOC);
221. switch (mode)
222. {
crypto/lock.c:426:1: start of procedure CRYPTO_lock()
424. }
425.
426. > void CRYPTO_lock(int mode, int type, const char *file, int line)
427. {
428. #ifdef LOCK_DEBUG
crypto/lock.c:453:6: Taking false branch
451. }
452. #endif
453. if (type < 0)
^
454. {
455. if (dynlock_lock_callback != NULL)
crypto/lock.c:468:7: Taking true branch
466. }
467. else
468. if (locking_callback != NULL)
^
469. locking_callback(mode,type,file,line);
470. }
crypto/lock.c:469:4: Skipping __function_pointer__(): unresolved function pointer
467. else
468. if (locking_callback != NULL)
469. locking_callback(mode,type,file,line);
^
470. }
471.
crypto/lock.c:453:2:
451. }
452. #endif
453. > if (type < 0)
454. {
455. if (dynlock_lock_callback != NULL)
crypto/lock.c:470:2: return from a call to CRYPTO_lock
468. if (locking_callback != NULL)
469. locking_callback(mode,type,file,line);
470. }
^
471.
472. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,
crypto/mem_dbg.c:221:2:
219.
220. CRYPTO_w_lock(CRYPTO_LOCK_MALLOC);
221. > switch (mode)
222. {
223. /* for applications (not to be called while multiple threads
crypto/mem_dbg.c:225:2: Switch condition is false. Skipping switch case
223. /* for applications (not to be called while multiple threads
224. * use the library): */
225. case CRYPTO_MEM_CHECK_ON: /* aka MemCheck_start() */
^
226. mh_mode = CRYPTO_MEM_CHECK_ON|CRYPTO_MEM_CHECK_ENABLE;
227. num_disable = 0;
crypto/mem_dbg.c:229:2: Switch condition is false. Skipping switch case
227. num_disable = 0;
228. break;
229. case CRYPTO_MEM_CHECK_OFF: /* aka MemCheck_stop() */
^
230. mh_mode = 0;
231. num_disable = 0; /* should be true *before* MemCheck_stop is used,
crypto/mem_dbg.c:236:2: Switch condition is true. Entering switch case
234.
235. /* switch off temporarily (for library-internal use): */
236. case CRYPTO_MEM_CHECK_DISABLE: /* aka MemCheck_off() */
^
237. if (mh_mode & CRYPTO_MEM_CHECK_ON)
238. {
crypto/mem_dbg.c:237:7: Taking false branch
235. /* switch off temporarily (for library-internal use): */
236. case CRYPTO_MEM_CHECK_DISABLE: /* aka MemCheck_off() */
237. if (mh_mode & CRYPTO_MEM_CHECK_ON)
^
238. {
239. CRYPTO_THREADID cur;
crypto/mem_dbg.c:282:2:
280. break;
281. }
282. > CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC);
283. return(ret);
284. }
crypto/lock.c:426:1: start of procedure CRYPTO_lock()
424. }
425.
426. > void CRYPTO_lock(int mode, int type, const char *file, int line)
427. {
428. #ifdef LOCK_DEBUG
crypto/lock.c:453:6: Taking false branch
451. }
452. #endif
453. if (type < 0)
^
454. {
455. if (dynlock_lock_callback != NULL)
crypto/lock.c:468:7: Taking true branch
466. }
467. else
468. if (locking_callback != NULL)
^
469. locking_callback(mode,type,file,line);
470. }
crypto/lock.c:469:4: Skipping __function_pointer__(): unresolved function pointer
467. else
468. if (locking_callback != NULL)
469. locking_callback(mode,type,file,line);
^
470. }
471.
crypto/lock.c:453:2:
451. }
452. #endif
453. > if (type < 0)
454. {
455. if (dynlock_lock_callback != NULL)
crypto/lock.c:470:2: return from a call to CRYPTO_lock
468. if (locking_callback != NULL)
469. locking_callback(mode,type,file,line);
470. }
^
471.
472. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,
crypto/mem_dbg.c:283:2:
281. }
282. CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC);
283. > return(ret);
284. }
285.
crypto/mem_dbg.c:284:2: return from a call to CRYPTO_mem_ctrl
282. CRYPTO_w_unlock(CRYPTO_LOCK_MALLOC);
283. return(ret);
284. }
^
285.
286. int CRYPTO_is_mem_check_on(void)
ssl/ssl_ciph.c:1884:2:
1882.
1883. MemCheck_off();
1884. > comp=(SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP));
1885. comp->id=id;
1886. comp->method=cm;
crypto/mem.c:295:1: start of procedure CRYPTO_malloc()
293. }
294.
295. > void *CRYPTO_malloc(int num, const char *file, int line)
296. {
297. void *ret = NULL;
crypto/mem.c:297:2:
295. void *CRYPTO_malloc(int num, const char *file, int line)
296. {
297. > void *ret = NULL;
298.
299. if (num <= 0) return NULL;
crypto/mem.c:299:6: Taking false branch
297. void *ret = NULL;
298.
299. if (num <= 0) return NULL;
^
300.
301. allow_customize = 0;
crypto/mem.c:301:2:
299. if (num <= 0) return NULL;
300.
301. > allow_customize = 0;
302. if (malloc_debug_func != NULL)
303. {
crypto/mem.c:302:6: Taking true branch
300.
301. allow_customize = 0;
302. if (malloc_debug_func != NULL)
^
303. {
304. allow_customize_debug = 0;
crypto/mem.c:304:3:
302. if (malloc_debug_func != NULL)
303. {
304. > allow_customize_debug = 0;
305. malloc_debug_func(NULL, num, file, line, 0);
306. }
crypto/mem.c:305:3: Skipping __function_pointer__(): unresolved function pointer
303. {
304. allow_customize_debug = 0;
305. malloc_debug_func(NULL, num, file, line, 0);
^
306. }
307. ret = malloc_ex_func(num,file,line);
crypto/mem.c:307:2: Skipping __function_pointer__(): unresolved function pointer
305. malloc_debug_func(NULL, num, file, line, 0);
306. }
307. ret = malloc_ex_func(num,file,line);
^
308. #ifdef LEVITTE_DEBUG_MEM
309. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num);
crypto/mem.c:311:6: Taking true branch
309. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num);
310. #endif
311. if (malloc_debug_func != NULL)
^
312. malloc_debug_func(ret, num, file, line, 1);
313.
crypto/mem.c:312:3: Skipping __function_pointer__(): unresolved function pointer
310. #endif
311. if (malloc_debug_func != NULL)
312. malloc_debug_func(ret, num, file, line, 1);
^
313.
314. #ifndef OPENSSL_CPUID_OBJ
crypto/mem.c:318:12: Taking false branch
316. * sanitisation function can't be optimised out. NB: We only do
317. * this for >2Kb so the overhead doesn't bother us. */
318. if(ret && (num > 2048))
^
319. { extern unsigned char cleanse_ctr;
320. ((unsigned char *)ret)[0] = cleanse_ctr;
crypto/mem.c:324:2:
322. #endif
323.
324. > return ret;
325. }
326. char *CRYPTO_strdup(const char *str, const char *file, int line)
crypto/mem.c:325:2: return from a call to CRYPTO_malloc
323.
324. return ret;
325. }
^
326. char *CRYPTO_strdup(const char *str, const char *file, int line)
327. {
ssl/ssl_ciph.c:1885:2:
1883. MemCheck_off();
1884. comp=(SSL_COMP *)OPENSSL_malloc(sizeof(SSL_COMP));
1885. > comp->id=id;
1886. comp->method=cm;
1887. load_builtin_compressions();
| https://github.com/openssl/openssl/blob/4544f0a69161a37ee3edce3cc1bc34c3678a4d64/ssl/ssl_ciph.c/#L1885 |
d2a_code_trace_data_41496 | IMPLEMENT_new_ctx(cfb1, CFB, 128)
providers/common/ciphers/aes.c:311: error: NULL_DEREFERENCE
pointer `ctx` last assigned on line 311 could be null and is dereferenced at line 311, column 1.
Showing all 18 steps of the trace
providers/common/ciphers/aes.c:311:1: start of procedure aes_128_cfb1_newctx()
309. IMPLEMENT_new_ctx(cfb1, CFB, 256)
310. IMPLEMENT_new_ctx(cfb1, CFB, 192)
311. > IMPLEMENT_new_ctx(cfb1, CFB, 128)
312. IMPLEMENT_new_ctx(cfb8, CFB, 256)
313. IMPLEMENT_new_ctx(cfb8, CFB, 192)
crypto/mem.c:228:1: start of procedure CRYPTO_zalloc()
226. }
227.
228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:230:5:
228. void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. > void *ret = CRYPTO_malloc(num, file, line);
231.
232. FAILTEST();
crypto/mem.c:192:1: start of procedure CRYPTO_malloc()
190. #endif
191.
192. > void *CRYPTO_malloc(size_t num, const char *file, int line)
193. {
194. void *ret = NULL;
crypto/mem.c:194:5:
192. void *CRYPTO_malloc(size_t num, const char *file, int line)
193. {
194. > void *ret = NULL;
195.
196. INCREMENT(malloc_count);
crypto/mem.c:197:9: Taking false branch
195.
196. INCREMENT(malloc_count);
197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
198. return malloc_impl(num, file, line);
199.
crypto/mem.c:200:9: Taking false branch
198. return malloc_impl(num, file, line);
199.
200. if (num == 0)
^
201. return NULL;
202.
crypto/mem.c:204:9: Taking true branch
202.
203. FAILTEST();
204. if (allow_customize) {
^
205. /*
206. * Disallow customization after the first allocation. We only set this
crypto/mem.c:210:9:
208. * allocation.
209. */
210. > allow_customize = 0;
211. }
212. #if !defined(OPENSSL_NO_CRYPTO_MDEBUG) && !defined(FIPS_MODE)
crypto/mem.c:221:5:
219. }
220. #else
221. > (void)(file); (void)(line);
222. ret = malloc(num);
223. #endif
crypto/mem.c:221:19:
219. }
220. #else
221. > (void)(file); (void)(line);
222. ret = malloc(num);
223. #endif
crypto/mem.c:222:5:
220. #else
221. (void)(file); (void)(line);
222. > ret = malloc(num);
223. #endif
224.
crypto/mem.c:225:5:
223. #endif
224.
225. > return ret;
226. }
227.
crypto/mem.c:226:1: return from a call to CRYPTO_malloc
224.
225. return ret;
226. > }
227.
228. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:233:9: Taking false branch
231.
232. FAILTEST();
233. if (ret != NULL)
^
234. memset(ret, 0, num);
235. return ret;
crypto/mem.c:235:5:
233. if (ret != NULL)
234. memset(ret, 0, num);
235. > return ret;
236. }
237.
crypto/mem.c:236:1: return from a call to CRYPTO_zalloc
234. memset(ret, 0, num);
235. return ret;
236. > }
237.
238. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
providers/common/ciphers/aes.c:311:1:
309. IMPLEMENT_new_ctx(cfb1, CFB, 256)
310. IMPLEMENT_new_ctx(cfb1, CFB, 192)
311. > IMPLEMENT_new_ctx(cfb1, CFB, 128)
312. IMPLEMENT_new_ctx(cfb8, CFB, 256)
313. IMPLEMENT_new_ctx(cfb8, CFB, 192)
| https://github.com/openssl/openssl/blob/f79858ac4d90a450d0620d1ecb713bc35d7d9f8d/providers/common/ciphers/aes.c/#L311 |
d2a_code_trace_data_41497 | 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_core_module.c:4188: error: Buffer Overrun L3
Offset: [0, 65535] Size: [6, +oo] by call to `ngx_inet_resolve_host`.
src/http/ngx_http_core_module.c:4188:9: Call
4186. u.port = 53;
4187.
4188. if (ngx_inet_resolve_host(cf->pool, &u) != NGX_OK) {
^
4189. ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "%V: %s", &u.host, u.err);
4190. return NGX_CONF_ERROR;
src/core/ngx_inet.c:688:1: Parameter `u->host.len`
686.
687.
688. ngx_int_t
^
689. ngx_inet_resolve_host(ngx_pool_t *pool, ngx_url_t *u)
690. {
src/core/ngx_inet.c:790:13: Call
788. u->addrs[0].socklen = sizeof(struct sockaddr_in);
789.
790. p = ngx_pnalloc(pool, u->host.len + sizeof(":65535") - 1);
^
791. if (p == NULL) {
792. return NGX_ERROR;
src/core/ngx_palloc.c:155:13: Assignment
153.
154. do {
155. m = p->d.last;
^
156.
157. if ((size_t) (p->d.end - m) >= size) {
src/core/ngx_palloc.c:160:17: Assignment
158. p->d.last = m + size;
159.
160. return m;
^
161. }
162.
src/core/ngx_inet.c:790:9: Assignment
788. u->addrs[0].socklen = sizeof(struct sockaddr_in);
789.
790. p = ngx_pnalloc(pool, u->host.len + sizeof(":65535") - 1);
^
791. if (p == NULL) {
792. return NGX_ERROR;
src/core/ngx_inet.c:795:32: Call
793. }
794.
795. u->addrs[0].name.len = ngx_sprintf(p, "%V:%d",
^
796. &u->host, ntohs(port)) - p;
797. u->addrs[0].name.data = p;
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, 65535] Size: [6, +oo] by call to `ngx_inet_resolve_host`
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_41498 | void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
{
int i, j, max;
const BN_ULONG *ap;
BN_ULONG *rp;
max = n * 2;
ap = a;
rp = r;
rp[0] = rp[max - 1] = 0;
rp++;
j = n;
if (--j > 0) {
ap++;
rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
rp += 2;
}
for (i = n - 2; i > 0; i--) {
j--;
ap++;
rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]);
rp += 2;
}
bn_add_words(r, r, r, max);
bn_sqr_words(tmp, a, n);
bn_add_words(r, r, tmp, max);
}
crypto/bn/bn_prime.c:117: error: BUFFER_OVERRUN_L3
Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_is_prime_fasttest_ex`.
Showing all 52 steps of the trace
crypto/bn/bn_prime.c:90:18: Call
88. } else {
89. if (safe) {
90. if (!probable_prime_dh_safe(ret, bits, add, rem, ctx))
^
91. goto err;
92. } else {
crypto/bn/bn_prime.c:404:1: Parameter `p->top`
402. }
403.
404. > static int probable_prime_dh_safe(BIGNUM *p, int bits, const BIGNUM *padd,
405. const BIGNUM *rem, BN_CTX *ctx)
406. {
crypto/bn/bn_prime.c:113:14: Call
111. * prime is odd, We just need to divide by 2
112. */
113. if (!BN_rshift1(t, ret))
^
114. goto err;
115.
crypto/bn/bn_shift.c:54:9: Call
52. bn_check_top(a);
53.
54. if (BN_is_zero(a)) {
^
55. BN_zero(r);
56. return 1;
crypto/bn/bn_lib.c:845:1: Parameter `a->top`
843. }
844.
845. > int BN_is_zero(const BIGNUM *a)
846. {
847. return a->top == 0;
crypto/bn/bn_prime.c:117:17: Call
115.
116. for (i = 0; i < checks; i++) {
117. j = BN_is_prime_fasttest_ex(ret, 1, ctx, 0, cb);
^
118. if (j == -1)
119. goto err;
crypto/bn/bn_prime.c:151:1: Parameter `a->top`
149. }
150.
151. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
152. int do_trial_division, BN_GENCB *cb)
153. {
crypto/bn/bn_prime.c:161:9: Call
159.
160. /* Take care of the really small primes 2 & 3 */
161. if (BN_is_word(a, 2) || BN_is_word(a, 3))
^
162. return 1;
163.
crypto/bn/bn_lib.c:855:1: Parameter `a->top`
853. }
854.
855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w)
856. {
857. return BN_abs_is_word(a, w) && (!w || !a->neg);
crypto/bn/bn_lib.c:857:12: Call
855. int BN_is_word(const BIGNUM *a, const BN_ULONG w)
856. {
857. return BN_abs_is_word(a, w) && (!w || !a->neg);
^
858. }
859.
crypto/bn/bn_lib.c:840:1: Parameter `a->top`
838. }
839.
840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
841. {
842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
crypto/bn/bn_prime.c:161:29: Call
159.
160. /* Take care of the really small primes 2 & 3 */
161. if (BN_is_word(a, 2) || BN_is_word(a, 3))
^
162. return 1;
163.
crypto/bn/bn_lib.c:855:1: Parameter `a->top`
853. }
854.
855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w)
856. {
857. return BN_abs_is_word(a, w) && (!w || !a->neg);
crypto/bn/bn_lib.c:857:12: Call
855. int BN_is_word(const BIGNUM *a, const BN_ULONG w)
856. {
857. return BN_abs_is_word(a, w) && (!w || !a->neg);
^
858. }
859.
crypto/bn/bn_lib.c:840:1: Parameter `a->top`
838. }
839.
840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
841. {
842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
crypto/bn/bn_prime.c:165:10: Call
163.
164. /* Check odd and bigger than 1 */
165. if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0)
^
166. return 0;
167.
crypto/bn/bn_lib.c:860:1: Parameter `a->top`
858. }
859.
860. > int BN_is_odd(const BIGNUM *a)
861. {
862. return (a->top > 0) && (a->d[0] & 1);
crypto/bn/bn_prime.c:165:26: Call
163.
164. /* Check odd and bigger than 1 */
165. if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0)
^
166. return 0;
167.
crypto/bn/bn_lib.c:542:1: Parameter `a->top`
540. }
541.
542. > int BN_cmp(const BIGNUM *a, const BIGNUM *b)
543. {
544. int i;
crypto/bn/bn_prime.c:198:10: Call
196.
197. /* compute A1 := a - 1 */
198. if (!BN_copy(A1, a) || !BN_sub_word(A1, 1))
^
199. goto err;
200. /* compute A3 := a - 3 */
crypto/bn/bn_lib.c:285:1: Parameter `b->top`
283. }
284.
285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
286. {
287. bn_check_top(b);
crypto/bn/bn_prime.c:201:10: Call
199. goto err;
200. /* compute A3 := a - 3 */
201. if (!BN_copy(A3, a) || !BN_sub_word(A3, 3))
^
202. goto err;
203.
crypto/bn/bn_lib.c:285:1: Parameter `b->top`
283. }
284.
285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
286. {
287. bn_check_top(b);
crypto/bn/bn_prime.c:215:10: Call
213. if (mont == NULL)
214. goto err;
215. if (!BN_MONT_CTX_set(mont, a, ctx))
^
216. goto err;
217.
crypto/bn/bn_mont.c:238:9: Call
236. BIGNUM *Ri, *R;
237.
238. if (BN_is_zero(mod))
^
239. return 0;
240.
crypto/bn/bn_lib.c:845:1: Parameter `a->top`
843. }
844.
845. > int BN_is_zero(const BIGNUM *a)
846. {
847. return a->top == 0;
crypto/bn/bn_prime.c:223:13: Call
221. goto err;
222.
223. j = witness(check, a, A1, A1_odd, k, ctx, mont);
^
224. if (j == -1)
225. goto err;
crypto/bn/bn_prime.c:245:1: Parameter `a->top`
243. }
244.
245. > static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1,
246. const BIGNUM *a1_odd, int k, BN_CTX *ctx,
247. BN_MONT_CTX *mont)
crypto/bn/bn_prime.c:249:10: Call
247. BN_MONT_CTX *mont)
248. {
249. if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */
^
250. return -1;
251. if (BN_is_one(w))
crypto/bn/bn_exp.c:296:1: Parameter `m->top`
294. }
295.
296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
297. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
298. {
crypto/bn/bn_exp.c:310:16: Call
308. || BN_get_flags(a, BN_FLG_CONSTTIME) != 0
309. || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {
310. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);
^
311. }
312.
crypto/bn/bn_exp.c:745:14: Assignment
743. /* 2^(top*BN_BITS2) - m */
744. tmp.d[0] = (0 - m->d[0]) & BN_MASK2;
745. for (i = 1; i < top; i++)
^
746. tmp.d[i] = (~m->d[i]) & BN_MASK2;
747. tmp.top = top;
crypto/bn/bn_exp.c:1062:14: Call
1060. bits -= window0;
1061. wvalue = bn_get_bits(p, bits) & wmask;
1062. if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&tmp, top, powerbuf, wvalue,
^
1063. window))
1064. goto err;
crypto/bn/bn_exp.c:520:1: Parameter `top`
518. }
519.
520. > static int MOD_EXP_CTIME_COPY_FROM_PREBUF(BIGNUM *b, int top,
521. unsigned char *buf, int idx,
522. int window)
crypto/bn/bn_exp.c:577:5: Assignment
575. }
576.
577. b->top = top;
^
578. bn_correct_top(b);
579. return 1;
crypto/bn/bn_exp.c:578:5: Call
576.
577. b->top = top;
578. bn_correct_top(b);
^
579. return 1;
580. }
crypto/bn/bn_lib.c:946:1: Parameter `a->top`
944. }
945.
946. > void bn_correct_top(BIGNUM *a)
947. {
948. BN_ULONG *ftl;
crypto/bn/bn_exp.c:1075:22: Call
1073. /* Square the result window-size times */
1074. for (i = 0; i < window; i++)
1075. if (!BN_mod_mul_montgomery(&tmp, &tmp, &tmp, mont, ctx))
^
1076. goto err;
1077.
crypto/bn/bn_mont.c:26:1: Parameter `a->top`
24. #endif
25.
26. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
27. BN_MONT_CTX *mont, BN_CTX *ctx)
28. {
crypto/bn/bn_mont.c:53:14: Call
51. bn_check_top(tmp);
52. if (a == b) {
53. if (!BN_sqr(tmp, a, ctx))
^
54. goto err;
55. } else {
crypto/bn/bn_sqr.c:17:1: Parameter `a->top`
15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96
16. */
17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
18. {
19. int max, al;
crypto/bn/bn_sqr.c:25:5: Assignment
23. bn_check_top(a);
24.
25. al = a->top;
^
26. if (al <= 0) {
27. r->top = 0;
crypto/bn/bn_sqr.c:74:17: Call
72. if (bn_wexpand(tmp, max) == NULL)
73. goto err;
74. bn_sqr_normal(rr->d, a->d, al, tmp->d);
^
75. }
76. }
crypto/bn/bn_sqr.c:105:1: <Offset trace>
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:105:1: Parameter `n`
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:116:5: Assignment
114. rp[0] = rp[max - 1] = 0;
115. rp++;
116. j = n;
^
117.
118. if (--j > 0) {
crypto/bn/bn_sqr.c:118:9: Assignment
116. j = n;
117.
118. if (--j > 0) {
^
119. ap++;
120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
crypto/bn/bn_sqr.c:105:1: <Length trace>
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:105:1: Parameter `*r`
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:113:5: Assignment
111. max = n * 2;
112. ap = a;
113. rp = r;
^
114. rp[0] = rp[max - 1] = 0;
115. rp++;
crypto/bn/bn_sqr.c:115:5: Assignment
113. rp = r;
114. rp[0] = rp[max - 1] = 0;
115. rp++;
^
116. j = n;
117.
crypto/bn/bn_sqr.c:120:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_is_prime_fasttest_ex`
118. if (--j > 0) {
119. ap++;
120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
^
121. rp += 2;
122. }
| https://github.com/openssl/openssl/blob/b48d4397b8ee4256f0b0a115eb99f27ae89995e0/crypto/bn/bn_sqr.c/#L120 |
d2a_code_trace_data_41499 | 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:1064: error: Uninitialized Value
The value read from ymax was never initialized.
libavcodec/motion_est_template.c:1064:9:
1062. (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
1063. CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift)
1064. CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift)
^
1065. CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
1066. }
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1064 |
d2a_code_trace_data_41500 | static void opt_input_ts_scale(const char *arg)
{
unsigned int stream;
double scale;
char *p;
stream = strtol(arg, &p, 0);
if (*p)
p++;
scale= strtod(p, &p);
if(stream >= MAX_STREAMS)
ffmpeg_exit(1);
input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1);
input_files_ts_scale[nb_input_files][stream]= scale;
}
ffmpeg.c:3079: error: Null Dereference
pointer `input_files_ts_scale[nb_input_files]` last assigned on line 3078 could be null and is dereferenced at line 3079, column 5.
ffmpeg.c:3064:1: start of procedure opt_input_ts_scale()
3062. }
3063.
3064. static void opt_input_ts_scale(const char *arg)
^
3065. {
3066. unsigned int stream;
ffmpeg.c:3070:5:
3068. char *p;
3069.
3070. stream = strtol(arg, &p, 0);
^
3071. if (*p)
3072. p++;
ffmpeg.c:3071:9: Taking true branch
3069.
3070. stream = strtol(arg, &p, 0);
3071. if (*p)
^
3072. p++;
3073. scale= strtod(p, &p);
ffmpeg.c:3072:9:
3070. stream = strtol(arg, &p, 0);
3071. if (*p)
3072. p++;
^
3073. scale= strtod(p, &p);
3074.
ffmpeg.c:3073:5:
3071. if (*p)
3072. p++;
3073. scale= strtod(p, &p);
^
3074.
3075. if(stream >= MAX_STREAMS)
ffmpeg.c:3075:8: Taking true branch
3073. scale= strtod(p, &p);
3074.
3075. if(stream >= MAX_STREAMS)
^
3076. ffmpeg_exit(1);
3077.
ffmpeg.c:3076:9: Skipping ffmpeg_exit(): empty list of specs
3074.
3075. if(stream >= MAX_STREAMS)
3076. ffmpeg_exit(1);
^
3077.
3078. input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1);
ffmpeg.c:3078:5:
3076. ffmpeg_exit(1);
3077.
3078. input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1);
^
3079. input_files_ts_scale[nb_input_files][stream]= scale;
3080. }
ffmpeg.c:576:1: start of procedure grow_array()
574.
575. /* similar to ff_dynarray_add() and av_fast_realloc() */
576. static void *grow_array(void *array, int elem_size, int *size, int new_size)
^
577. {
578. if (new_size >= INT_MAX / elem_size) {
ffmpeg.c:578:9: Taking true branch
576. static void *grow_array(void *array, int elem_size, int *size, int new_size)
577. {
578. if (new_size >= INT_MAX / elem_size) {
^
579. fprintf(stderr, "Array too big.\n");
580. ffmpeg_exit(1);
ffmpeg.c:579:9:
577. {
578. if (new_size >= INT_MAX / elem_size) {
579. fprintf(stderr, "Array too big.\n");
^
580. ffmpeg_exit(1);
581. }
ffmpeg.c:580:9: Skipping ffmpeg_exit(): empty list of specs
578. if (new_size >= INT_MAX / elem_size) {
579. fprintf(stderr, "Array too big.\n");
580. ffmpeg_exit(1);
^
581. }
582. if (*size < new_size) {
ffmpeg.c:582:9: Taking true branch
580. ffmpeg_exit(1);
581. }
582. if (*size < new_size) {
^
583. uint8_t *tmp = av_realloc(array, new_size*elem_size);
584. if (!tmp) {
ffmpeg.c:583:9:
581. }
582. if (*size < new_size) {
583. uint8_t *tmp = av_realloc(array, new_size*elem_size);
^
584. if (!tmp) {
585. fprintf(stderr, "Could not alloc buffer.\n");
libavutil/mem.c:119:1: start of procedure av_realloc()
117. }
118.
119. void *av_realloc(void *ptr, FF_INTERNAL_MEM_TYPE size)
^
120. {
121. #if CONFIG_MEMALIGN_HACK
libavutil/mem.c:126:8: Taking false branch
124.
125. /* let's disallow possible ambiguous cases */
126. if(size > (INT_MAX-16) )
^
127. return NULL;
128.
libavutil/mem.c:135:5:
133. return (char*)realloc((char*)ptr - diff, size + diff) + diff;
134. #else
135. return realloc(ptr, size);
^
136. #endif
137. }
libavutil/mem.c:137:1: return from a call to av_realloc
135. return realloc(ptr, size);
136. #endif
137. }
^
138.
139. void av_free(void *ptr)
ffmpeg.c:584:14: Taking true branch
582. if (*size < new_size) {
583. uint8_t *tmp = av_realloc(array, new_size*elem_size);
584. if (!tmp) {
^
585. fprintf(stderr, "Could not alloc buffer.\n");
586. ffmpeg_exit(1);
ffmpeg.c:585:13:
583. uint8_t *tmp = av_realloc(array, new_size*elem_size);
584. if (!tmp) {
585. fprintf(stderr, "Could not alloc buffer.\n");
^
586. ffmpeg_exit(1);
587. }
ffmpeg.c:586:13: Skipping ffmpeg_exit(): empty list of specs
584. if (!tmp) {
585. fprintf(stderr, "Could not alloc buffer.\n");
586. ffmpeg_exit(1);
^
587. }
588. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
ffmpeg.c:588:9:
586. ffmpeg_exit(1);
587. }
588. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
^
589. *size = new_size;
590. return tmp;
ffmpeg.c:589:9:
587. }
588. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
589. *size = new_size;
^
590. return tmp;
591. }
ffmpeg.c:590:9:
588. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
589. *size = new_size;
590. return tmp;
^
591. }
592. return array;
ffmpeg.c:593:1: return from a call to grow_array
591. }
592. return array;
593. }
^
594.
595. static void choose_sample_fmt(AVStream *st, AVCodec *codec)
ffmpeg.c:3079:5:
3077.
3078. input_files_ts_scale[nb_input_files] = grow_array(input_files_ts_scale[nb_input_files], sizeof(*input_files_ts_scale[nb_input_files]), &nb_input_files_ts_scale[nb_input_files], stream + 1);
3079. input_files_ts_scale[nb_input_files][stream]= scale;
^
3080. }
3081.
| https://github.com/libav/libav/blob/87e4d9b252bc6fa3b982f7050013069c9dc3e05b/ffmpeg.c/#L3079 |
d2a_code_trace_data_41501 | static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg,
OPENSSL_LH_DOALL_FUNC func,
OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg)
{
int i;
OPENSSL_LH_NODE *a, *n;
if (lh == NULL)
return;
for (i = lh->num_nodes - 1; i >= 0; i--) {
a = lh->b[i];
while (a != NULL) {
n = a->next;
if (use_arg)
func_arg(a->data, arg);
else
func(a->data);
a = n;
}
}
}
test/recordlentest.c:194: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `SSL_free`.
Showing all 17 steps of the trace
test/recordlentest.c:121:10: Call
119. }
120.
121. if (!create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL, NULL)) {
^
122. printf("Unable to create SSL objects\n");
123. goto end;
test/ssltestlib.c:579:21: Call
577.
578. if (*sssl == NULL)
579. serverssl = SSL_new(serverctx);
^
580. else
581. serverssl = *sssl;
ssl/ssl_lib.c:523:1: Parameter `ctx->sessions->num_nodes`
521. }
522.
523. > SSL *SSL_new(SSL_CTX *ctx)
524. {
525. SSL *s;
test/recordlentest.c:194:5: Call
192. if(!testresult)
193. ERR_print_errors_fp(stdout);
194. SSL_free(serverssl);
^
195. SSL_free(clientssl);
196. SSL_CTX_free(sctx);
ssl/ssl_lib.c:965:1: Parameter `s->ctx->sessions->num_nodes`
963. }
964.
965. > void SSL_free(SSL *s)
966. {
967. int i;
ssl/ssl_lib.c:1032:5: Call
1030. RECORD_LAYER_release(&s->rlayer);
1031.
1032. SSL_CTX_free(s->ctx);
^
1033.
1034. ASYNC_WAIT_CTX_free(s->waitctx);
ssl/ssl_lib.c:2825:1: Parameter `a->sessions->num_nodes`
2823. }
2824.
2825. > void SSL_CTX_free(SSL_CTX *a)
2826. {
2827. int i;
ssl/ssl_lib.c:2851:9: Call
2849. */
2850. if (a->sessions != NULL)
2851. SSL_CTX_flush_sessions(a, 0);
^
2852.
2853. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data);
ssl/ssl_sess.c:1018:1: Parameter `s->sessions->num_nodes`
1016. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM);
1017.
1018. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t)
1019. {
1020. unsigned long i;
ssl/ssl_sess.c:1031:5: Call
1029. i = lh_SSL_SESSION_get_down_load(s->sessions);
1030. lh_SSL_SESSION_set_down_load(s->sessions, 0);
1031. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp);
^
1032. lh_SSL_SESSION_set_down_load(s->sessions, i);
1033. CRYPTO_THREAD_unlock(s->lock);
ssl/ssl_sess.c:1016:1: Parameter `lh->num_nodes`
1014. }
1015.
1016. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM);
1017.
1018. void SSL_CTX_flush_sessions(SSL_CTX *s, long t)
ssl/ssl_sess.c:1016:1: Call
1014. }
1015.
1016. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM);
1017.
1018. void SSL_CTX_flush_sessions(SSL_CTX *s, long t)
crypto/lhash/lhash.c:182:1: Parameter `lh->num_nodes`
180. }
181.
182. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg)
183. {
184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg);
crypto/lhash/lhash.c:184:5: Call
182. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg)
183. {
184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg);
^
185. }
186.
crypto/lhash/lhash.c:150:1: <LHS trace>
148. }
149.
150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg,
151. OPENSSL_LH_DOALL_FUNC func,
152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg)
crypto/lhash/lhash.c:150:1: Parameter `lh->num_nodes`
148. }
149.
150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg,
151. OPENSSL_LH_DOALL_FUNC func,
152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg)
crypto/lhash/lhash.c:164:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `SSL_free`
162. * memory leaks otherwise
163. */
164. for (i = lh->num_nodes - 1; i >= 0; i--) {
^
165. a = lh->b[i];
166. while (a != NULL) {
| https://github.com/openssl/openssl/blob/ee6d9dfb39ff90a31027c51b80362d274918e3dd/crypto/lhash/lhash.c/#L164 |
d2a_code_trace_data_41502 | 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/x509v3/v3_scts.c:252: error: USE_AFTER_FREE
call to `SCT_LIST_free()` eventually accesses memory that was invalidated by call to `free()` on line 185 indirectly during the call to `sk_SCT_push()`.
Showing all 22 steps of the trace
crypto/x509v3/v3_scts.c:169:15: invalidation part of the trace starts here
167. goto done;
168.
169. if ((sk = sk_SCT_new_null()) == NULL)
^
170. goto done;
171.
crypto/x509v3/v3_scts.c:169:15: passed as argument to `sk_SCT_new_null`
167. goto done;
168.
169. if ((sk = sk_SCT_new_null()) == NULL)
^
170. goto done;
171.
crypto/x509v3/v3_scts.c:169:15: return from call to `sk_SCT_new_null`
167. goto done;
168.
169. if ((sk = sk_SCT_new_null()) == NULL)
^
170. goto done;
171.
crypto/x509v3/v3_scts.c:169:10: assigned
167. goto done;
168.
169. if ((sk = sk_SCT_new_null()) == NULL)
^
170. goto done;
171.
crypto/x509v3/v3_scts.c:185:14: when calling `sk_SCT_push` here
183. if (sct == NULL)
184. goto err;
185. if (!sk_SCT_push(sk, sct)) {
^
186. OPENSSL_free(sct);
187. goto err;
crypto/include/internal/ct_int.h:117:1: parameter `sk` of sk_SCT_push
115. } SCT;
116.
117. > DEFINE_STACK_OF(SCT)
118.
119. /*
crypto/include/internal/ct_int.h:117:1: when calling `sk_push` here
115. } SCT;
116.
117. > DEFINE_STACK_OF(SCT)
118.
119. /*
crypto/stack/stack.c:259:1: parameter `st` of sk_push
257. }
258.
259. > int sk_push(_STACK *st, void *data)
260. {
261. return (sk_insert(st, data, st->num));
crypto/stack/stack.c:261:13: when calling `sk_insert` here
259. int sk_push(_STACK *st, void *data)
260. {
261. return (sk_insert(st, data, st->num));
^
262. }
263.
crypto/stack/stack.c:167:1: parameter `st` of sk_insert
165. }
166.
167. > int sk_insert(_STACK *st, void *data, int loc)
168. {
169. char **s;
crypto/stack/stack.c:174:13: when calling `CRYPTO_realloc` here
172. return 0;
173. if (st->num_alloc <= st->num + 1) {
174. s = OPENSSL_realloc((char *)st->data,
^
175. (unsigned int)sizeof(char *) * st->num_alloc * 2);
176. if (s == NULL)
crypto/mem.c:166:1: parameter `str` of CRYPTO_realloc
164. }
165.
166. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
167. {
168. if (str == NULL)
crypto/mem.c:172:9: when calling `CRYPTO_free` here
170.
171. if (num == 0) {
172. CRYPTO_free(str);
^
173. return NULL;
174. }
crypto/mem.c:234:1: parameter `str` of CRYPTO_free
232. }
233.
234. > void CRYPTO_free(void *str)
235. {
236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
crypto/mem.c:245:5: was invalidated by call to `free()`
243. }
244. #else
245. free(str);
^
246. #endif
247. }
crypto/x509v3/v3_scts.c:169:15: use-after-lifetime part of the trace starts here
167. goto done;
168.
169. if ((sk = sk_SCT_new_null()) == NULL)
^
170. goto done;
171.
crypto/x509v3/v3_scts.c:169:15: passed as argument to `sk_SCT_new_null`
167. goto done;
168.
169. if ((sk = sk_SCT_new_null()) == NULL)
^
170. goto done;
171.
crypto/x509v3/v3_scts.c:169:15: return from call to `sk_SCT_new_null`
167. goto done;
168.
169. if ((sk = sk_SCT_new_null()) == NULL)
^
170. goto done;
171.
crypto/x509v3/v3_scts.c:169:10: assigned
167. goto done;
168.
169. if ((sk = sk_SCT_new_null()) == NULL)
^
170. goto done;
171.
crypto/x509v3/v3_scts.c:252:5: when calling `SCT_LIST_free` here
250.
251. err:
252. SCT_LIST_free(sk);
^
253. sk = NULL;
254. goto done;
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_41503 | static int chacha20_poly1305_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
const unsigned char *in, size_t len)
{
EVP_CHACHA_AEAD_CTX *actx = aead_data(ctx);
size_t tail, tohash_len, buf_len, plen = actx->tls_payload_length;
unsigned char *buf, *tohash, *ctr, storage[sizeof(zero) + 32];
if (len != plen + POLY1305_BLOCK_SIZE)
return -1;
buf = storage + ((0 - (size_t)storage) & 15);
ctr = buf + CHACHA_BLK_SIZE;
tohash = buf + CHACHA_BLK_SIZE - POLY1305_BLOCK_SIZE;
# ifdef XOR128_HELPERS
if (plen <= 3 * CHACHA_BLK_SIZE) {
actx->key.counter[0] = 0;
buf_len = (plen + 2 * CHACHA_BLK_SIZE - 1) & (0 - CHACHA_BLK_SIZE);
ChaCha20_ctr32(buf, zero, buf_len, actx->key.key.d,
actx->key.counter);
Poly1305_Init(POLY1305_ctx(actx), buf);
actx->key.partial_len = 0;
memcpy(tohash, actx->tls_aad, POLY1305_BLOCK_SIZE);
tohash_len = POLY1305_BLOCK_SIZE;
actx->len.aad = EVP_AEAD_TLS1_AAD_LEN;
actx->len.text = plen;
if (plen) {
if (ctx->encrypt)
ctr = xor128_encrypt_n_pad(out, in, ctr, plen);
else
ctr = xor128_decrypt_n_pad(out, in, ctr, plen);
in += plen;
out += plen;
tohash_len = (size_t)(ctr - tohash);
}
}
# else
if (plen <= CHACHA_BLK_SIZE) {
size_t i;
actx->key.counter[0] = 0;
ChaCha20_ctr32(buf, zero, (buf_len = 2 * CHACHA_BLK_SIZE),
actx->key.key.d, actx->key.counter);
Poly1305_Init(POLY1305_ctx(actx), buf);
actx->key.partial_len = 0;
memcpy(tohash, actx->tls_aad, POLY1305_BLOCK_SIZE);
tohash_len = POLY1305_BLOCK_SIZE;
actx->len.aad = EVP_AEAD_TLS1_AAD_LEN;
actx->len.text = plen;
if (ctx->encrypt) {
for (i = 0; i < plen; i++) {
out[i] = ctr[i] ^= in[i];
}
} else {
for (i = 0; i < plen; i++) {
unsigned char c = in[i];
out[i] = ctr[i] ^ c;
ctr[i] = c;
}
}
in += i;
out += i;
tail = (0 - i) & (POLY1305_BLOCK_SIZE - 1);
memset(ctr + i, 0, tail);
ctr += i + tail;
tohash_len += i + tail;
}
# endif
else {
actx->key.counter[0] = 0;
ChaCha20_ctr32(buf, zero, (buf_len = CHACHA_BLK_SIZE),
actx->key.key.d, actx->key.counter);
Poly1305_Init(POLY1305_ctx(actx), buf);
actx->key.counter[0] = 1;
actx->key.partial_len = 0;
Poly1305_Update(POLY1305_ctx(actx), actx->tls_aad, POLY1305_BLOCK_SIZE);
tohash = ctr;
tohash_len = 0;
actx->len.aad = EVP_AEAD_TLS1_AAD_LEN;
actx->len.text = plen;
if (ctx->encrypt) {
ChaCha20_ctr32(out, in, plen, actx->key.key.d, actx->key.counter);
Poly1305_Update(POLY1305_ctx(actx), out, plen);
} else {
Poly1305_Update(POLY1305_ctx(actx), in, plen);
ChaCha20_ctr32(out, in, plen, actx->key.key.d, actx->key.counter);
}
in += plen;
out += plen;
tail = (0 - plen) & (POLY1305_BLOCK_SIZE - 1);
Poly1305_Update(POLY1305_ctx(actx), zero, tail);
}
{
const union {
long one;
char little;
} is_endian = { 1 };
if (is_endian.little) {
memcpy(ctr, (unsigned char *)&actx->len, POLY1305_BLOCK_SIZE);
} else {
ctr[0] = (unsigned char)(actx->len.aad);
ctr[1] = (unsigned char)(actx->len.aad>>8);
ctr[2] = (unsigned char)(actx->len.aad>>16);
ctr[3] = (unsigned char)(actx->len.aad>>24);
ctr[4] = (unsigned char)(actx->len.aad>>32);
ctr[5] = (unsigned char)(actx->len.aad>>40);
ctr[6] = (unsigned char)(actx->len.aad>>48);
ctr[7] = (unsigned char)(actx->len.aad>>56);
ctr[8] = (unsigned char)(actx->len.text);
ctr[9] = (unsigned char)(actx->len.text>>8);
ctr[10] = (unsigned char)(actx->len.text>>16);
ctr[11] = (unsigned char)(actx->len.text>>24);
ctr[12] = (unsigned char)(actx->len.text>>32);
ctr[13] = (unsigned char)(actx->len.text>>40);
ctr[14] = (unsigned char)(actx->len.text>>48);
ctr[15] = (unsigned char)(actx->len.text>>56);
}
tohash_len += POLY1305_BLOCK_SIZE;
}
Poly1305_Update(POLY1305_ctx(actx), tohash, tohash_len);
OPENSSL_cleanse(buf, buf_len);
Poly1305_Final(POLY1305_ctx(actx), ctx->encrypt ? actx->tag
: tohash);
actx->tls_payload_length = NO_TLS_PAYLOAD_LENGTH;
if (ctx->encrypt) {
memcpy(out, actx->tag, POLY1305_BLOCK_SIZE);
} else {
if (CRYPTO_memcmp(tohash, in, POLY1305_BLOCK_SIZE)) {
memset(out - (len - POLY1305_BLOCK_SIZE), 0,
len - POLY1305_BLOCK_SIZE);
return -1;
}
}
return len;
}
crypto/evp/e_chacha20_poly1305.c:306: error: INTEGER_OVERFLOW_L1
(0 - [max(65, `ctx->cipher_data->tls_payload_length`), `ctx->cipher_data->tls_payload_length`]):unsigned64.
Showing all 3 steps of the trace
crypto/evp/e_chacha20_poly1305.c:210:1: <RHS trace>
208. # endif
209.
210. > static int chacha20_poly1305_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
211. const unsigned char *in, size_t len)
212. {
crypto/evp/e_chacha20_poly1305.c:210:1: Parameter `len`
208. # endif
209.
210. > static int chacha20_poly1305_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
211. const unsigned char *in, size_t len)
212. {
crypto/evp/e_chacha20_poly1305.c:306:9: Binary operation: (0 - [max(65, ctx->cipher_data->tls_payload_length), ctx->cipher_data->tls_payload_length]):unsigned64
304. in += plen;
305. out += plen;
306. tail = (0 - plen) & (POLY1305_BLOCK_SIZE - 1);
^
307. Poly1305_Update(POLY1305_ctx(actx), zero, tail);
308. }
| https://github.com/openssl/openssl/blob/3e0076c213ec2d1149a9a89f9bc141d1a1a44630/crypto/evp/e_chacha20_poly1305.c/#L306 |
d2a_code_trace_data_41504 | static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
{
BN_ULONG *a = NULL;
if (words > (INT_MAX / (4 * BN_BITS2))) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG);
return NULL;
}
if (BN_get_flags(b, BN_FLG_STATIC_DATA)) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
return NULL;
}
if (BN_get_flags(b, BN_FLG_SECURE))
a = OPENSSL_secure_zalloc(words * sizeof(*a));
else
a = OPENSSL_zalloc(words * sizeof(*a));
if (a == NULL) {
BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
return NULL;
}
assert(b->top <= words);
if (b->top > 0)
memcpy(a, b->d, sizeof(*a) * b->top);
return a;
}
crypto/bn/bn_recp.c:70: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, +oo] by call to `BN_mul`.
Showing all 19 steps of the trace
crypto/bn/bn_recp.c:63:14: Call
61.
62. BN_CTX_start(ctx);
63. if ((a = BN_CTX_get(ctx)) == NULL)
^
64. goto err;
65. if (y != NULL) {
crypto/bn/bn_ctx.c:219:5: Call
217. }
218. /* OK, make sure the returned bignum is "zero" */
219. BN_zero(ret);
^
220. /* clear BN_FLG_CONSTTIME if leaked from previous frames */
221. ret->flags &= (~BN_FLG_CONSTTIME);
crypto/bn/bn_lib.c:359:1: Parameter `*a->d`
357. }
358.
359. > int BN_set_word(BIGNUM *a, BN_ULONG w)
360. {
361. bn_check_top(a);
crypto/bn/bn_lib.c:362:9: Call
360. {
361. bn_check_top(a);
362. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
363. return 0;
364. a->neg = 0;
crypto/bn/bn_lcl.h:660:1: Parameter `*a->d`
658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
659.
660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
661. {
662. if (bits > (INT_MAX - BN_BITS2 + 1))
crypto/bn/bn_recp.c:70:18: Call
68. goto err;
69. } else {
70. if (!BN_mul(a, x, y, ctx))
^
71. goto err;
72. }
crypto/bn/bn_mul.c:497:1: Parameter `*r->d`
495. #endif /* BN_RECURSION */
496.
497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
498. {
499. int ret = bn_mul_fixed_top(r, a, b, ctx);
crypto/bn/bn_mul.c:499:15: Call
497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
498. {
499. int ret = bn_mul_fixed_top(r, a, b, ctx);
^
500.
501. bn_correct_top(r);
crypto/bn/bn_mul.c:507:1: Parameter `*r->d`
505. }
506.
507. > int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
508. {
509. int ret = 0;
crypto/bn/bn_mul.c:555:17: Call
553. # endif
554. if (al == 8) {
555. if (bn_wexpand(rr, 16) == NULL)
^
556. goto err;
557. rr->top = 16;
crypto/bn/bn_lib.c:960:1: Parameter `*a->d`
958. }
959.
960. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
961. {
962. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_lib.c:962:37: Call
960. BIGNUM *bn_wexpand(BIGNUM *a, int words)
961. {
962. return (words <= a->dmax) ? a : bn_expand2(a, words);
^
963. }
964.
crypto/bn/bn_lib.c:245:1: Parameter `*b->d`
243. */
244.
245. > BIGNUM *bn_expand2(BIGNUM *b, int words)
246. {
247. if (words > b->dmax) {
crypto/bn/bn_lib.c:248:23: Call
246. {
247. if (words > b->dmax) {
248. BN_ULONG *a = bn_expand_internal(b, words);
^
249. if (!a)
250. return NULL;
crypto/bn/bn_lib.c:209:1: <Offset trace>
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: Parameter `b->top`
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: <Length trace>
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: Parameter `*b->d`
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, +oo] by call to `BN_mul`
230. assert(b->top <= words);
231. if (b->top > 0)
232. memcpy(a, b->d, sizeof(*a) * b->top);
^
233.
234. return a;
| https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_lib.c/#L232 |
d2a_code_trace_data_41505 | 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:831: error: NULL_DEREFERENCE
pointer `meth` last assigned on line 829 could be null and is dereferenced at line 831, column 9.
Showing all 14 steps of the trace
crypto/rand/rand_lib.c:827:1: start of procedure RAND_bytes()
825. }
826.
827. > int RAND_bytes(unsigned char *buf, int num)
828. {
829. const RAND_METHOD *meth = RAND_get_rand_method();
crypto/rand/rand_lib.c:829:5:
827. int RAND_bytes(unsigned char *buf, int num)
828. {
829. > const RAND_METHOD *meth = RAND_get_rand_method();
830.
831. if (meth->bytes != NULL)
crypto/rand/rand_lib.c:733:1: start of procedure RAND_get_rand_method()
731. }
732.
733. > const RAND_METHOD *RAND_get_rand_method(void)
734. {
735. const RAND_METHOD *tmp_meth = NULL;
crypto/rand/rand_lib.c:735:5:
733. const RAND_METHOD *RAND_get_rand_method(void)
734. {
735. > const RAND_METHOD *tmp_meth = NULL;
736.
737. if (!RUN_ONCE(&rand_init, do_rand_init))
crypto/rand/rand_lib.c:737:10:
735. const RAND_METHOD *tmp_meth = NULL;
736.
737. > if (!RUN_ONCE(&rand_init, do_rand_init))
738. return NULL;
739.
crypto/threads_pthread.c:111:1: start of procedure CRYPTO_THREAD_run_once()
109. }
110.
111. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
112. {
113. if (pthread_once(once, init) != 0)
crypto/threads_pthread.c:113:9: Taking true branch
111. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
112. {
113. if (pthread_once(once, init) != 0)
^
114. return 0;
115.
crypto/threads_pthread.c:114:9:
112. {
113. if (pthread_once(once, init) != 0)
114. > return 0;
115.
116. return 1;
crypto/threads_pthread.c:117:1: return from a call to CRYPTO_THREAD_run_once
115.
116. return 1;
117. > }
118.
119. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))
crypto/rand/rand_lib.c:737:10: Condition is false
735. const RAND_METHOD *tmp_meth = NULL;
736.
737. if (!RUN_ONCE(&rand_init, do_rand_init))
^
738. return NULL;
739.
crypto/rand/rand_lib.c:737:10: Taking true branch
735. const RAND_METHOD *tmp_meth = NULL;
736.
737. if (!RUN_ONCE(&rand_init, do_rand_init))
^
738. return NULL;
739.
crypto/rand/rand_lib.c:738:9:
736.
737. if (!RUN_ONCE(&rand_init, do_rand_init))
738. > return NULL;
739.
740. CRYPTO_THREAD_write_lock(rand_meth_lock);
crypto/rand/rand_lib.c:761:1: return from a call to RAND_get_rand_method
759. CRYPTO_THREAD_unlock(rand_meth_lock);
760. return tmp_meth;
761. > }
762.
763. #ifndef OPENSSL_NO_ENGINE
crypto/rand/rand_lib.c:831:9:
829. const RAND_METHOD *meth = RAND_get_rand_method();
830.
831. > if (meth->bytes != NULL)
832. return meth->bytes(buf, num);
833. RANDerr(RAND_F_RAND_BYTES, RAND_R_FUNC_NOT_IMPLEMENTED);
| https://github.com/openssl/openssl/blob/1901516a4ba909fff12e0e7815aa2d499f4d6d67/crypto/rand/rand_lib.c/#L831 |
d2a_code_trace_data_41506 | static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
{
BN_ULONG *a = NULL;
if (words > (INT_MAX / (4 * BN_BITS2))) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG);
return NULL;
}
if (BN_get_flags(b, BN_FLG_STATIC_DATA)) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
return NULL;
}
if (BN_get_flags(b, BN_FLG_SECURE))
a = OPENSSL_secure_zalloc(words * sizeof(*a));
else
a = OPENSSL_zalloc(words * sizeof(*a));
if (a == NULL) {
BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
return NULL;
}
assert(b->top <= words);
if (b->top > 0)
memcpy(a, b->d, sizeof(*a) * b->top);
return a;
}
crypto/bn/bn_prime.c:300: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_priv_rand_range`.
Showing all 25 steps of the trace
crypto/bn/bn_prime.c:270:16: Call
268. if (!(b != NULL
269. /* w1 := w - 1 */
270. && BN_copy(w1, w)
^
271. && BN_sub_word(w1, 1)
272. /* w3 := w - 3 */
crypto/bn/bn_lib.c:281:1: Parameter `a->top`
279. }
280.
281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
282. {
283. bn_check_top(b);
crypto/bn/bn_prime.c:300:14: Call
298. for (i = 0; i < iterations; ++i) {
299. /* (Step 4.1) obtain a Random string of bits b where 1 < b < w-1 */
300. if (!BN_priv_rand_range(b, w3) || !BN_add_word(b, 2)) /* 1 < b < w-1 */
^
301. goto err;
302.
crypto/bn/bn_rand.c:208:1: Parameter `r->top`
206. }
207.
208. > int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range)
209. {
210. return bnrand_range(PRIVATE, r, range, NULL);
crypto/bn/bn_rand.c:210:12: Call
208. int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range)
209. {
210. return bnrand_range(PRIVATE, r, range, NULL);
^
211. }
212.
crypto/bn/bn_rand.c:127:1: Parameter `r->top`
125.
126. /* random number r: 0 <= r < range */
127. > static int bnrand_range(BNRAND_FLAG flag, BIGNUM *r, const BIGNUM *range,
128. BN_CTX *ctx)
129. {
crypto/bn/bn_rand.c:143:9: Call
141.
142. if (n == 1)
143. BN_zero(r);
^
144. else if (!BN_is_bit_set(range, n - 2) && !BN_is_bit_set(range, n - 3)) {
145. /*
crypto/bn/bn_lib.c:361:1: Parameter `a->top`
359. }
360.
361. > int BN_set_word(BIGNUM *a, BN_ULONG w)
362. {
363. bn_check_top(a);
crypto/bn/bn_lib.c:364:9: Call
362. {
363. bn_check_top(a);
364. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
365. return 0;
366. a->neg = 0;
crypto/bn/bn_lcl.h:660:1: Parameter `a->top`
658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
659.
660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
661. {
662. if (bits > (INT_MAX - BN_BITS2 + 1))
crypto/bn/bn_lcl.h:668:12: Call
666. return a;
667.
668. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2);
^
669. }
670.
crypto/bn/bn_lib.c:245:1: Parameter `b->top`
243. */
244.
245. > BIGNUM *bn_expand2(BIGNUM *b, int words)
246. {
247. if (words > b->dmax) {
crypto/bn/bn_lib.c:248:23: Call
246. {
247. if (words > b->dmax) {
248. BN_ULONG *a = bn_expand_internal(b, words);
^
249. if (!a)
250. return NULL;
crypto/bn/bn_lib.c:209:1: <Offset trace>
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: Parameter `b->top`
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: <Length trace>
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: Parameter `words`
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:224:13: Call
222. a = OPENSSL_secure_zalloc(words * sizeof(*a));
223. else
224. a = OPENSSL_zalloc(words * sizeof(*a));
^
225. if (a == NULL) {
226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
crypto/mem.c:228:1: Parameter `num`
226. }
227.
228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:230:17: Call
228. void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
^
231.
232. FAILTEST();
crypto/mem.c:201:9: Assignment
199.
200. if (num == 0)
201. return NULL;
^
202.
203. FAILTEST();
crypto/mem.c:230:5: Assignment
228. void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
^
231.
232. FAILTEST();
crypto/mem.c:235:5: Assignment
233. if (ret != NULL)
234. memset(ret, 0, num);
235. return ret;
^
236. }
237.
crypto/bn/bn_lib.c:224:9: Assignment
222. a = OPENSSL_secure_zalloc(words * sizeof(*a));
223. else
224. a = OPENSSL_zalloc(words * sizeof(*a));
^
225. if (a == NULL) {
226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_priv_rand_range`
230. assert(b->top <= words);
231. if (b->top > 0)
232. memcpy(a, b->d, sizeof(*a) * b->top);
^
233.
234. return a;
| https://github.com/openssl/openssl/blob/bd01733fdd9a5a0acdc72cf5c6601d37e8ddd801/crypto/bn/bn_lib.c/#L232 |
d2a_code_trace_data_41507 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/dh/dh_check.c:220: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_exp`.
Showing all 33 steps of the trace
crypto/dh/dh_check.c:207:5: Call
205. if (ctx == NULL)
206. goto err;
207. BN_CTX_start(ctx);
^
208. tmp = BN_CTX_get(ctx);
209. if (tmp == NULL || !BN_set_word(tmp, 1))
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/dh/dh_check.c:220:14: Call
218. if (dh->q != NULL) {
219. /* Check pub_key^q == 1 mod p */
220. if (!BN_mod_exp(tmp, pub_key, dh->q, dh->p, ctx))
^
221. goto err;
222. if (!BN_is_one(tmp))
crypto/bn/bn_exp.c:89:1: Parameter `ctx->stack.depth`
87. }
88.
89. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
90. BN_CTX *ctx)
91. {
crypto/bn/bn_exp.c:149:15: Call
147. #ifdef RECP_MUL_MOD
148. {
149. ret = BN_mod_exp_recp(r, a, p, m, ctx);
^
150. }
151. #else
crypto/bn/bn_exp.c:161:1: Parameter `ctx->stack.depth`
159. }
160.
161. > int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
162. const BIGNUM *m, BN_CTX *ctx)
163. {
crypto/bn/bn_exp.c:191:5: Call
189. }
190.
191. BN_CTX_start(ctx);
^
192. aa = BN_CTX_get(ctx);
193. 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:192:10: Call
190.
191. BN_CTX_start(ctx);
192. aa = BN_CTX_get(ctx);
^
193. val[0] = BN_CTX_get(ctx);
194. 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:193:14: Call
191. BN_CTX_start(ctx);
192. aa = BN_CTX_get(ctx);
193. val[0] = BN_CTX_get(ctx);
^
194. if (val[0] == NULL)
195. 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:210:10: Call
208. }
209.
210. if (!BN_nnmod(val[0], a, m, ctx))
^
211. goto err; /* 1 */
212. 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:220:14: Call
218. window = BN_window_bits_for_exponent_size(bits);
219. if (window > 1) {
220. if (!BN_mod_mul_reciprocal(aa, val[0], val[0], &recp, ctx))
^
221. goto err; /* 2 */
222. j = 1 << (window - 1);
crypto/bn/bn_recp.c:55:1: Parameter `ctx->stack.depth`
53. }
54.
55. > int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y,
56. BN_RECP_CTX *recp, BN_CTX *ctx)
57. {
crypto/bn/bn_recp.c:62:5: Call
60. const BIGNUM *ca;
61.
62. BN_CTX_start(ctx);
^
63. if ((a = BN_CTX_get(ctx)) == NULL)
64. 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_recp.c:63:14: Call
61.
62. BN_CTX_start(ctx);
63. if ((a = BN_CTX_get(ctx)) == NULL)
^
64. goto err;
65. if (y != NULL) {
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_recp.c:77:11: Call
75. ca = x; /* Just do the mod */
76.
77. ret = BN_div_recp(NULL, r, ca, recp, ctx);
^
78. err:
79. BN_CTX_end(ctx);
crypto/bn/bn_recp.c:90:5: Call
88. BIGNUM *a, *b, *d, *r;
89.
90. BN_CTX_start(ctx);
^
91. d = (dv != NULL) ? dv : BN_CTX_get(ctx);
92. r = (rem != NULL) ? rem : BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_recp.c:101:13: Call
99. BN_zero(d);
100. if (!BN_copy(r, m)) {
101. BN_CTX_end(ctx);
^
102. return 0;
103. }
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_exp`
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_41508 | static int hadamard8_diff8x8_c( void *s, uint8_t *dst, uint8_t *src, int stride, int h){
int i;
int temp[64];
int sum=0;
assert(h==8);
for(i=0; i<8; i++){
BUTTERFLY2(temp[8*i+0], temp[8*i+1], src[stride*i+0]-dst[stride*i+0],src[stride*i+1]-dst[stride*i+1]);
BUTTERFLY2(temp[8*i+2], temp[8*i+3], src[stride*i+2]-dst[stride*i+2],src[stride*i+3]-dst[stride*i+3]);
BUTTERFLY2(temp[8*i+4], temp[8*i+5], src[stride*i+4]-dst[stride*i+4],src[stride*i+5]-dst[stride*i+5]);
BUTTERFLY2(temp[8*i+6], temp[8*i+7], src[stride*i+6]-dst[stride*i+6],src[stride*i+7]-dst[stride*i+7]);
BUTTERFLY1(temp[8*i+0], temp[8*i+2]);
BUTTERFLY1(temp[8*i+1], temp[8*i+3]);
BUTTERFLY1(temp[8*i+4], temp[8*i+6]);
BUTTERFLY1(temp[8*i+5], temp[8*i+7]);
BUTTERFLY1(temp[8*i+0], temp[8*i+4]);
BUTTERFLY1(temp[8*i+1], temp[8*i+5]);
BUTTERFLY1(temp[8*i+2], temp[8*i+6]);
BUTTERFLY1(temp[8*i+3], temp[8*i+7]);
}
for(i=0; i<8; i++){
BUTTERFLY1(temp[8*0+i], temp[8*1+i]);
BUTTERFLY1(temp[8*2+i], temp[8*3+i]);
BUTTERFLY1(temp[8*4+i], temp[8*5+i]);
BUTTERFLY1(temp[8*6+i], temp[8*7+i]);
BUTTERFLY1(temp[8*0+i], temp[8*2+i]);
BUTTERFLY1(temp[8*1+i], temp[8*3+i]);
BUTTERFLY1(temp[8*4+i], temp[8*6+i]);
BUTTERFLY1(temp[8*5+i], temp[8*7+i]);
sum +=
BUTTERFLYA(temp[8*0+i], temp[8*4+i])
+BUTTERFLYA(temp[8*1+i], temp[8*5+i])
+BUTTERFLYA(temp[8*2+i], temp[8*6+i])
+BUTTERFLYA(temp[8*3+i], temp[8*7+i]);
}
#if 0
static int maxi=0;
if(sum>maxi){
maxi=sum;
printf("MAX:%d\n", maxi);
}
#endif
return sum;
}
libavcodec/dsputil.c:3512: error: Uninitialized Value
The value read from temp[_] was never initialized.
libavcodec/dsputil.c:3512:9:
3510.
3511. for(i=0; i<8; i++){
3512. BUTTERFLY1(temp[8*0+i], temp[8*1+i]);
^
3513. BUTTERFLY1(temp[8*2+i], temp[8*3+i]);
3514. BUTTERFLY1(temp[8*4+i], temp[8*5+i]);
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dsputil.c/#L3512 |
d2a_code_trace_data_41509 | static void av_always_inline filter_mb_edgeh( uint8_t *pix, int stride, const int16_t bS[4], unsigned int qp, H264Context *h ) {
const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);
const unsigned int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;
const int alpha = alpha_table[index_a];
const int beta = beta_table[qp - qp_bd_offset + h->slice_beta_offset];
if (alpha ==0 || beta == 0) return;
if( bS[0] < 4 ) {
int8_t tc[4];
tc[0] = tc0_table[index_a][bS[0]];
tc[1] = tc0_table[index_a][bS[1]];
tc[2] = tc0_table[index_a][bS[2]];
tc[3] = tc0_table[index_a][bS[3]];
h->h264dsp.h264_v_loop_filter_luma(pix, stride, alpha, beta, tc);
} else {
h->h264dsp.h264_v_loop_filter_luma_intra(pix, stride, alpha, beta);
}
}
libavcodec/h264_loopfilter.c:258: error: Buffer Overrun L2
Offset: [3, 4] Size: 4 by call to `filter_mb_edgeh`.
libavcodec/h264_loopfilter.c:250:39: Assignment
248.
249. if( IS_INTRA(mb_type) ) {
250. static const int16_t bS4[4] = {4,4,4,4};
^
251. static const int16_t bS3[4] = {3,3,3,3};
252. const int16_t *bSH = FIELD_PICTURE ? bS3 : bS4;
libavcodec/h264_loopfilter.c:258:17: Call
256. filter_mb_edgev( &img_y[4*2], linesize, bS3, qp, h);
257. if(top_type){
258. filter_mb_edgeh( &img_y[4*0*linesize], linesize, bSH, qp1, h);
^
259. }
260. filter_mb_edgeh( &img_y[4*2*linesize], linesize, bS3, qp, h);
libavcodec/h264_loopfilter.c:177:1: <Offset trace>
175. }
176.
177. static void av_always_inline filter_mb_edgeh( uint8_t *pix, int stride, const int16_t bS[4], unsigned int qp, H264Context *h ) {
^
178. const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);
179. const unsigned int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;
libavcodec/h264_loopfilter.c:177:1: Parameter `*bS`
175. }
176.
177. static void av_always_inline filter_mb_edgeh( uint8_t *pix, int stride, const int16_t bS[4], unsigned int qp, H264Context *h ) {
^
178. const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);
179. const unsigned int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;
libavcodec/h264_loopfilter.c:73:1: <Length trace>
71. 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
72. };
73. static const uint8_t tc0_table[52*3][4] = {
^
74. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
75. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
libavcodec/h264_loopfilter.c:73:1: Array declaration
71. 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
72. };
73. static const uint8_t tc0_table[52*3][4] = {
^
74. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
75. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
libavcodec/h264_loopfilter.c:186:17: Array access: Offset: [3, 4] Size: 4 by call to `filter_mb_edgeh`
184. if( bS[0] < 4 ) {
185. int8_t tc[4];
186. tc[0] = tc0_table[index_a][bS[0]];
^
187. tc[1] = tc0_table[index_a][bS[1]];
188. tc[2] = tc0_table[index_a][bS[2]];
| https://github.com/libav/libav/blob/ecf026f1aa8ffe170b5b8c577cae56a405ebafc8/libavcodec/h264_loopfilter.c/#L186 |
d2a_code_trace_data_41510 | static void unhook_drbg(RAND_DRBG *drbg)
{
HOOK_CTX *ctx = get_hook_ctx(drbg);
drbg->get_entropy = ctx->get_entropy;
CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DRBG, drbg, &drbg->ex_data);
}
test/drbgtest.c:584: error: NULL_DEREFERENCE
pointer `ctx` last assigned on line 582 could be null and is dereferenced at line 584, column 25.
Showing all 13 steps of the trace
test/drbgtest.c:580:1: start of procedure unhook_drbg()
578.
579. /* Installs the hook for the get_entropy() callback of the given drbg */
580. > static void unhook_drbg(RAND_DRBG *drbg)
581. {
582. HOOK_CTX *ctx = get_hook_ctx(drbg);
test/drbgtest.c:582:5:
580. static void unhook_drbg(RAND_DRBG *drbg)
581. {
582. > HOOK_CTX *ctx = get_hook_ctx(drbg);
583.
584. drbg->get_entropy = ctx->get_entropy;
test/drbgtest.c:545:1: start of procedure get_hook_ctx()
543. static HOOK_CTX master_ctx, public_ctx, private_ctx;
544.
545. > static HOOK_CTX *get_hook_ctx(RAND_DRBG *drbg)
546. {
547. return (HOOK_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index);
test/drbgtest.c:547:5:
545. static HOOK_CTX *get_hook_ctx(RAND_DRBG *drbg)
546. {
547. > return (HOOK_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index);
548. }
549.
crypto/rand/drbg_lib.c:929:1: start of procedure RAND_DRBG_get_ex_data()
927. }
928.
929. > void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx)
930. {
931. return CRYPTO_get_ex_data(&drbg->ex_data, idx);
crypto/rand/drbg_lib.c:931:5:
929. void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx)
930. {
931. > return CRYPTO_get_ex_data(&drbg->ex_data, idx);
932. }
933.
crypto/ex_data.c:429:1: start of procedure CRYPTO_get_ex_data()
427. * particular index in the class used by this variable
428. */
429. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
430. {
431. if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
crypto/ex_data.c:431:9: Taking true branch
429. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
430. {
431. if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
^
432. return NULL;
433. return sk_void_value(ad->sk, idx);
crypto/ex_data.c:432:9:
430. {
431. if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
432. > return NULL;
433. return sk_void_value(ad->sk, idx);
434. }
crypto/ex_data.c:434:1: return from a call to CRYPTO_get_ex_data
432. return NULL;
433. return sk_void_value(ad->sk, idx);
434. > }
crypto/rand/drbg_lib.c:932:1: return from a call to RAND_DRBG_get_ex_data
930. {
931. return CRYPTO_get_ex_data(&drbg->ex_data, idx);
932. > }
933.
934.
test/drbgtest.c:548:1: return from a call to get_hook_ctx
546. {
547. return (HOOK_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index);
548. > }
549.
550. /* Intercepts and counts calls to the get_entropy() callback */
test/drbgtest.c:584:5:
582. HOOK_CTX *ctx = get_hook_ctx(drbg);
583.
584. > drbg->get_entropy = ctx->get_entropy;
585. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DRBG, drbg, &drbg->ex_data);
586. }
| https://github.com/openssl/openssl/blob/8d4f150f70d70d6c3e62661ed7cc16c2f751d8a1/test/drbgtest.c/#L584 |
d2a_code_trace_data_41511 | static int select_server_ctx(SSL *s, void *arg, int ignore)
{
const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
HANDSHAKE_EX_DATA *ex_data =
(HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
if (servername == NULL) {
ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
return SSL_TLSEXT_ERR_NOACK;
}
if (strcmp(servername, "server2") == 0) {
SSL_CTX *new_ctx = (SSL_CTX*)arg;
SSL_set_SSL_CTX(s, new_ctx);
SSL_clear_options(s, 0xFFFFFFFFL);
SSL_set_options(s, SSL_CTX_get_options(new_ctx));
ex_data->servername = SSL_TEST_SERVERNAME_SERVER2;
return SSL_TLSEXT_ERR_OK;
} else if (strcmp(servername, "server1") == 0) {
ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
return SSL_TLSEXT_ERR_OK;
} else if (ignore) {
ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
return SSL_TLSEXT_ERR_NOACK;
} else {
return SSL_TLSEXT_ERR_ALERT_FATAL;
}
}
test/handshake_helper.c:109: error: NULL_DEREFERENCE
pointer `ex_data` last assigned on line 87 could be null and is dereferenced at line 109, column 9.
Showing all 21 steps of the trace
test/handshake_helper.c:84:1: start of procedure select_server_ctx()
82. * An empty SNI extension also returns SSL_TSLEXT_ERR_NOACK.
83. */
84. > static int select_server_ctx(SSL *s, void *arg, int ignore)
85. {
86. const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
test/handshake_helper.c:86:5:
84. static int select_server_ctx(SSL *s, void *arg, int ignore)
85. {
86. > const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
87. HANDSHAKE_EX_DATA *ex_data =
88. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
ssl/ssl_lib.c:2052:1: start of procedure SSL_get_servername()
2050. */
2051.
2052. > const char *SSL_get_servername(const SSL *s, const int type)
2053. {
2054. if (type != TLSEXT_NAMETYPE_host_name)
ssl/ssl_lib.c:2054:9: Taking false branch
2052. const char *SSL_get_servername(const SSL *s, const int type)
2053. {
2054. if (type != TLSEXT_NAMETYPE_host_name)
^
2055. return NULL;
2056.
ssl/ssl_lib.c:2057:12: Condition is true
2055. return NULL;
2056.
2057. return s->session && !s->tlsext_hostname ?
^
2058. s->session->tlsext_hostname : s->tlsext_hostname;
2059. }
ssl/ssl_lib.c:2057:27: Condition is true
2055. return NULL;
2056.
2057. return s->session && !s->tlsext_hostname ?
^
2058. s->session->tlsext_hostname : s->tlsext_hostname;
2059. }
ssl/ssl_lib.c:2057:12:
2055. return NULL;
2056.
2057. > return s->session && !s->tlsext_hostname ?
2058. s->session->tlsext_hostname : s->tlsext_hostname;
2059. }
ssl/ssl_lib.c:2057:5:
2055. return NULL;
2056.
2057. > return s->session && !s->tlsext_hostname ?
2058. s->session->tlsext_hostname : s->tlsext_hostname;
2059. }
ssl/ssl_lib.c:2059:1: return from a call to SSL_get_servername
2057. return s->session && !s->tlsext_hostname ?
2058. s->session->tlsext_hostname : s->tlsext_hostname;
2059. > }
2060.
2061. int SSL_get_servername_type(const SSL *s)
test/handshake_helper.c:87:5:
85. {
86. const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
87. > HANDSHAKE_EX_DATA *ex_data =
88. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
89.
ssl/ssl_lib.c:3496:1: start of procedure SSL_get_ex_data()
3494. }
3495.
3496. > void *SSL_get_ex_data(const SSL *s, int idx)
3497. {
3498. return (CRYPTO_get_ex_data(&s->ex_data, idx));
ssl/ssl_lib.c:3498:5:
3496. void *SSL_get_ex_data(const SSL *s, int idx)
3497. {
3498. > return (CRYPTO_get_ex_data(&s->ex_data, idx));
3499. }
3500.
crypto/ex_data.c:369:1: start of procedure CRYPTO_get_ex_data()
367. * particular index in the class used by this variable
368. */
369. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
370. {
371. if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
crypto/ex_data.c:371:9: Taking true branch
369. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
370. {
371. if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
^
372. return NULL;
373. return sk_void_value(ad->sk, idx);
crypto/ex_data.c:372:9:
370. {
371. if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
372. > return NULL;
373. return sk_void_value(ad->sk, idx);
374. }
crypto/ex_data.c:374:1: return from a call to CRYPTO_get_ex_data
372. return NULL;
373. return sk_void_value(ad->sk, idx);
374. > }
ssl/ssl_lib.c:3499:1: return from a call to SSL_get_ex_data
3497. {
3498. return (CRYPTO_get_ex_data(&s->ex_data, idx));
3499. > }
3500.
3501. int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg)
test/handshake_helper.c:90:9: Taking false branch
88. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
89.
90. if (servername == NULL) {
^
91. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
92. return SSL_TLSEXT_ERR_NOACK;
test/handshake_helper.c:95:9: Taking false branch
93. }
94.
95. if (strcmp(servername, "server2") == 0) {
^
96. SSL_CTX *new_ctx = (SSL_CTX*)arg;
97. SSL_set_SSL_CTX(s, new_ctx);
test/handshake_helper.c:108:16: Taking true branch
106. ex_data->servername = SSL_TEST_SERVERNAME_SERVER2;
107. return SSL_TLSEXT_ERR_OK;
108. } else if (strcmp(servername, "server1") == 0) {
^
109. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
110. return SSL_TLSEXT_ERR_OK;
test/handshake_helper.c:109:9:
107. return SSL_TLSEXT_ERR_OK;
108. } else if (strcmp(servername, "server1") == 0) {
109. > ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
110. return SSL_TLSEXT_ERR_OK;
111. } else if (ignore) {
| https://github.com/openssl/openssl/blob/70c22888c1648fe8652e77107f3c74bf2212de36/test/handshake_helper.c/#L109 |
d2a_code_trace_data_41512 | static int cb_server_alpn(SSL *s, const unsigned char **out,
unsigned char *outlen, const unsigned char *in,
unsigned int inlen, void *arg)
{
unsigned char *protos;
unsigned short protos_len;
protos = next_protos_parse(&protos_len, alpn_server);
if (protos == NULL) {
fprintf(stderr, "failed to parser ALPN server protocol string: %s\n",
alpn_server);
abort();
}
if (SSL_select_next_proto
((unsigned char **)out, outlen, protos, protos_len, in,
inlen) != OPENSSL_NPN_NEGOTIATED) {
OPENSSL_free(protos);
return SSL_TLSEXT_ERR_NOACK;
}
alpn_selected = OPENSSL_malloc(*outlen);
memcpy(alpn_selected, *out, *outlen);
*out = alpn_selected;
OPENSSL_free(protos);
return SSL_TLSEXT_ERR_OK;
}
test/ssltest.c:442: error: NULL_DEREFERENCE
pointer `alpn_selected` last assigned on line 441 could be null and is dereferenced by call to `memcpy()` at line 442, column 5.
Showing all 11 steps of the trace
test/ssltest.c:416:1: start of procedure cb_server_alpn()
414. }
415.
416. > static int cb_server_alpn(SSL *s, const unsigned char **out,
417. unsigned char *outlen, const unsigned char *in,
418. unsigned int inlen, void *arg)
test/ssltest.c:423:5: Skipping next_protos_parse(): empty list of specs
421. unsigned short protos_len;
422.
423. protos = next_protos_parse(&protos_len, alpn_server);
^
424. if (protos == NULL) {
425. fprintf(stderr, "failed to parser ALPN server protocol string: %s\n",
test/ssltest.c:424:9: Taking false branch
422.
423. protos = next_protos_parse(&protos_len, alpn_server);
424. if (protos == NULL) {
^
425. fprintf(stderr, "failed to parser ALPN server protocol string: %s\n",
426. alpn_server);
test/ssltest.c:430:9: Taking false branch
428. }
429.
430. if (SSL_select_next_proto
^
431. ((unsigned char **)out, outlen, protos, protos_len, in,
432. inlen) != OPENSSL_NPN_NEGOTIATED) {
test/ssltest.c:441:5:
439. * verify_alpn.
440. */
441. > alpn_selected = OPENSSL_malloc(*outlen);
442. memcpy(alpn_selected, *out, *outlen);
443. *out = alpn_selected;
crypto/mem.c:279:1: start of procedure CRYPTO_malloc()
277. }
278.
279. > void *CRYPTO_malloc(size_t num, const char *file, int line)
280. {
281. void *ret = NULL;
crypto/mem.c:281:5:
279. void *CRYPTO_malloc(size_t num, const char *file, int line)
280. {
281. > void *ret = NULL;
282.
283. if (num <= 0)
crypto/mem.c:283:9: Taking true branch
281. void *ret = NULL;
282.
283. if (num <= 0)
^
284. return NULL;
285.
crypto/mem.c:284:9:
282.
283. if (num <= 0)
284. > return NULL;
285.
286. if (allow_customize)
crypto/mem.c:310:1: return from a call to CRYPTO_malloc
308.
309. return ret;
310. > }
311.
312. void *CRYPTO_zalloc(size_t num, const char *file, int line)
test/ssltest.c:442:5:
440. */
441. alpn_selected = OPENSSL_malloc(*outlen);
442. > memcpy(alpn_selected, *out, *outlen);
443. *out = alpn_selected;
444.
| https://github.com/openssl/openssl/blob/57ce7b617c602ae8513c22daa2bda31f179edb0f/test/ssltest.c/#L442 |
d2a_code_trace_data_41513 | static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
RTSPState *rt = s->priv_data;
RTSPStream *rtsp_st;
int size, i, err;
char *content;
char url[1024];
if (!ff_network_init())
return AVERROR(EIO);
content = av_malloc(SDP_MAX_SIZE);
size = get_buffer(s->pb, content, SDP_MAX_SIZE - 1);
if (size <= 0) {
av_free(content);
return AVERROR_INVALIDDATA;
}
content[size] ='\0';
err = ff_sdp_parse(s, content);
av_free(content);
if (err) goto fail;
for (i = 0; i < rt->nb_rtsp_streams; i++) {
char namebuf[50];
rtsp_st = rt->rtsp_streams[i];
getnameinfo((struct sockaddr*) &rtsp_st->sdp_ip, sizeof(rtsp_st->sdp_ip),
namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);
ff_url_join(url, sizeof(url), "rtp", NULL,
namebuf, rtsp_st->sdp_port,
"?localport=%d&ttl=%d", rtsp_st->sdp_port,
rtsp_st->sdp_ttl);
if (url_open(&rtsp_st->rtp_handle, url, URL_RDWR) < 0) {
err = AVERROR_INVALIDDATA;
goto fail;
}
if ((err = rtsp_open_transport_ctx(s, rtsp_st)))
goto fail;
}
return 0;
fail:
ff_rtsp_close_streams(s);
ff_network_close();
return err;
}
libavformat/rtsp.c:1793: error: Null Dereference
pointer `content` last assigned on line 1787 could be null and is dereferenced at line 1793, column 5.
libavformat/rtsp.c:1774:1: start of procedure sdp_read_header()
1772. }
1773.
1774. static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap)
^
1775. {
1776. RTSPState *rt = s->priv_data;
libavformat/rtsp.c:1776:5:
1774. static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap)
1775. {
1776. RTSPState *rt = s->priv_data;
^
1777. RTSPStream *rtsp_st;
1778. int size, i, err;
libavformat/rtsp.c:1782:10:
1780. char url[1024];
1781.
1782. if (!ff_network_init())
^
1783. return AVERROR(EIO);
1784.
libavformat/network.h:49:1: start of procedure ff_network_init()
47. int ff_socket_nonblock(int socket, int enable);
48.
49. static inline int ff_network_init(void)
^
50. {
51. #if HAVE_WINSOCK2_H
libavformat/network.h:56:5:
54. return 0;
55. #endif
56. return 1;
^
57. }
58.
libavformat/network.h:57:1: return from a call to ff_network_init
55. #endif
56. return 1;
57. }
^
58.
59. static inline void ff_network_close(void)
libavformat/rtsp.c:1782:10: Taking false branch
1780. char url[1024];
1781.
1782. if (!ff_network_init())
^
1783. return AVERROR(EIO);
1784.
libavformat/rtsp.c:1787:5:
1785. /* read the whole sdp file */
1786. /* XXX: better loading */
1787. content = av_malloc(SDP_MAX_SIZE);
^
1788. size = get_buffer(s->pb, content, SDP_MAX_SIZE - 1);
1789. if (size <= 0) {
libavutil/mem.c:64:1: start of procedure av_malloc()
62. linker will do it automatically. */
63.
64. void *av_malloc(FF_INTERNAL_MEM_TYPE size)
^
65. {
66. void *ptr = NULL;
libavutil/mem.c:66:5:
64. void *av_malloc(FF_INTERNAL_MEM_TYPE size)
65. {
66. void *ptr = NULL;
^
67. #if CONFIG_MEMALIGN_HACK
68. long diff;
libavutil/mem.c:72:8: Taking false branch
70.
71. /* let's disallow possible ambiguous cases */
72. if(size > (INT_MAX-16) )
^
73. return NULL;
74.
libavutil/mem.c:83:9: Taking true 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:84:9:
82. #elif HAVE_POSIX_MEMALIGN
83. if (posix_memalign(&ptr,16,size))
84. ptr = NULL;
^
85. #elif HAVE_MEMALIGN
86. ptr = memalign(16,size);
libavutil/mem.c:116:5:
114. ptr = malloc(size);
115. #endif
116. return ptr;
^
117. }
118.
libavutil/mem.c:117:1: return from a call to av_malloc
115. #endif
116. return ptr;
117. }
^
118.
119. void *av_realloc(void *ptr, FF_INTERNAL_MEM_TYPE size)
libavformat/rtsp.c:1788:5: Skipping get_buffer(): empty list of specs
1786. /* XXX: better loading */
1787. content = av_malloc(SDP_MAX_SIZE);
1788. size = get_buffer(s->pb, content, SDP_MAX_SIZE - 1);
^
1789. if (size <= 0) {
1790. av_free(content);
libavformat/rtsp.c:1789:9: Taking false branch
1787. content = av_malloc(SDP_MAX_SIZE);
1788. size = get_buffer(s->pb, content, SDP_MAX_SIZE - 1);
1789. if (size <= 0) {
^
1790. av_free(content);
1791. return AVERROR_INVALIDDATA;
libavformat/rtsp.c:1793:5:
1791. return AVERROR_INVALIDDATA;
1792. }
1793. content[size] ='\0';
^
1794.
1795. err = ff_sdp_parse(s, content);
| https://github.com/libav/libav/blob/d9c0510e22821baa364306d867ffac45da0620c8/libavformat/rtsp.c/#L1793 |
d2a_code_trace_data_41514 | int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
{
assert(pkt->subs != NULL && len != 0);
if (pkt->subs == NULL || len == 0)
return 0;
if (pkt->maxsize - pkt->written < len)
return 0;
if (pkt->buf->length - pkt->written < len) {
size_t newlen;
if (pkt->buf->length > SIZE_MAX / 2) {
newlen = SIZE_MAX;
} else {
newlen = (pkt->buf->length == 0) ? DEFAULT_BUF_SIZE
: pkt->buf->length * 2;
}
if (BUF_MEM_grow(pkt->buf, newlen) == 0)
return 0;
}
*allocbytes = (unsigned char *)pkt->buf->data + pkt->curr;
pkt->written += len;
pkt->curr += len;
return 1;
}
ssl/t1_lib.c:1099: error: INTEGER_OVERFLOW_L2
([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + `s->srp_ctx.login->strlen` + `s->tlsext_hostname->strlen` + 27]):unsigned64 by call to `WPACKET_put_bytes`.
Showing all 9 steps of the trace
ssl/t1_lib.c:1016:1: Parameter `pkt->written`
1014. }
1015.
1016. > int ssl_add_clienthello_tlsext(SSL *s, WPACKET *pkt, int *al)
1017. {
1018. #ifndef OPENSSL_NO_EC
ssl/t1_lib.c:1099:14: Call
1097. tls1_get_formatlist(s, &pformats, &num_formats);
1098.
1099. if (!WPACKET_put_bytes(pkt, TLSEXT_TYPE_ec_point_formats, 2)
^
1100. /* Sub-packet for formats extension */
1101. || !WPACKET_start_sub_packet_u16(pkt)
ssl/packet.c:226:1: Parameter `pkt->written`
224. }
225.
226. > int WPACKET_put_bytes(WPACKET *pkt, unsigned int val, size_t size)
227. {
228. unsigned char *data;
ssl/packet.c:234:17: Call
232.
233. if (size > sizeof(unsigned int)
234. || !WPACKET_allocate_bytes(pkt, size, &data)
^
235. || !put_value(data, val, size))
236. return 0;
ssl/packet.c:15:1: <LHS trace>
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:15:1: Parameter `pkt->buf->length`
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:15:1: <RHS trace>
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:15:1: Parameter `len`
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:25:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + pkt->written + s->srp_ctx.login->strlen + s->tlsext_hostname->strlen + 27]):unsigned64 by call to `WPACKET_put_bytes`
23. return 0;
24.
25. if (pkt->buf->length - pkt->written < len) {
^
26. size_t newlen;
27.
| https://github.com/openssl/openssl/blob/c0f9e23c6b8d1076796987d5a84557d410682d85/ssl/packet.c/#L25 |
d2a_code_trace_data_41515 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/bn/bn_blind.c:155: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul_montgomery`.
Showing all 20 steps of the trace
crypto/bn/bn_blind.c:134:1: Parameter `ctx->stack.depth`
132. }
133.
134. > int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx)
135. {
136. int ret = 1;
crypto/bn/bn_blind.c:155:15: Call
153.
154. if (b->m_ctx != NULL)
155. ret = BN_mod_mul_montgomery(n, n, b->A, b->m_ctx, ctx);
^
156. else
157. ret = BN_mod_mul(n, n, b->A, b->mod, ctx);
crypto/bn/bn_mont.c:26:1: Parameter `ctx->stack.depth`
24. #endif
25.
26. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
27. BN_MONT_CTX *mont, BN_CTX *ctx)
28. {
crypto/bn/bn_mont.c:29:15: Call
27. BN_MONT_CTX *mont, BN_CTX *ctx)
28. {
29. int ret = bn_mul_mont_fixed_top(r, a, b, mont, ctx);
^
30.
31. bn_correct_top(r);
crypto/bn/bn_mont.c:37:1: Parameter `ctx->stack.depth`
35. }
36.
37. > int bn_mul_mont_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
38. BN_MONT_CTX *mont, BN_CTX *ctx)
39. {
crypto/bn/bn_mont.c:60:5: Call
58. return 0;
59.
60. BN_CTX_start(ctx);
^
61. tmp = BN_CTX_get(ctx);
62. if (tmp == NULL)
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_mont.c:61:11: Call
59.
60. BN_CTX_start(ctx);
61. tmp = BN_CTX_get(ctx);
^
62. if (tmp == NULL)
63. goto err;
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_mont.c:70:14: Call
68. goto err;
69. } else {
70. if (!bn_mul_fixed_top(tmp, a, b, ctx))
^
71. goto err;
72. }
crypto/bn/bn_mul.c:533:5: Call
531. top = al + bl;
532.
533. BN_CTX_start(ctx);
^
534. if ((r == a) || (r == b)) {
535. if ((rr = BN_CTX_get(ctx)) == NULL)
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_mul.c:618:5: Call
616. err:
617. bn_check_top(r);
618. BN_CTX_end(ctx);
^
619. return ret;
620. }
crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <Offset trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: <Length trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul_montgomery`
266. static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
^
269. }
270.
| https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268 |
d2a_code_trace_data_41516 | int ssl3_new(SSL *s)
{
SSL3_STATE *s3;
if ((s3 = OPENSSL_zalloc(sizeof(*s3))) == NULL)
goto err;
s->s3 = s3;
#ifndef OPENSSL_NO_SRP
if (!SSL_SRP_CTX_init(s))
goto err;
#endif
s->method->ssl_clear(s);
return (1);
err:
return (0);
}
ssl/s3_lib.c:3362: error: MEMORY_LEAK
memory dynamically allocated by call to `CRYPTO_zalloc()` at line 3357, column 15 is not reachable after line 3362, column 10.
Showing all 20 steps of the trace
ssl/s3_lib.c:3353:1: start of procedure ssl3_new()
3351. }
3352.
3353. > int ssl3_new(SSL *s)
3354. {
3355. SSL3_STATE *s3;
ssl/s3_lib.c:3357:9:
3355. SSL3_STATE *s3;
3356.
3357. > if ((s3 = OPENSSL_zalloc(sizeof(*s3))) == NULL)
3358. goto err;
3359. s->s3 = s3;
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)
ssl/s3_lib.c:3357:9: Taking false branch
3355. SSL3_STATE *s3;
3356.
3357. if ((s3 = OPENSSL_zalloc(sizeof(*s3))) == NULL)
^
3358. goto err;
3359. s->s3 = s3;
ssl/s3_lib.c:3359:5:
3357. if ((s3 = OPENSSL_zalloc(sizeof(*s3))) == NULL)
3358. goto err;
3359. > s->s3 = s3;
3360.
3361. #ifndef OPENSSL_NO_SRP
ssl/s3_lib.c:3362:10: Skipping SSL_SRP_CTX_init(): empty list of specs
3360.
3361. #ifndef OPENSSL_NO_SRP
3362. if (!SSL_SRP_CTX_init(s))
^
3363. goto err;
3364. #endif
| https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/ssl/s3_lib.c/#L3362 |
d2a_code_trace_data_41517 | void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len)
{
#ifdef POLY1305_ASM
poly1305_blocks_f poly1305_blocks_p = ctx->func.blocks;
#endif
size_t rem, num;
if ((num = ctx->num)) {
rem = POLY1305_BLOCK_SIZE - num;
if (len >= rem) {
memcpy(ctx->data + num, inp, rem);
poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 1);
inp += rem;
len -= rem;
} else {
memcpy(ctx->data + num, inp, len);
ctx->num = num + len;
return;
}
}
rem = len % POLY1305_BLOCK_SIZE;
len -= rem;
if (len >= POLY1305_BLOCK_SIZE) {
poly1305_blocks(ctx->opaque, inp, len, 1);
inp += len;
}
if (rem)
memcpy(ctx->data, inp, rem);
ctx->num = rem;
}
crypto/evp/e_chacha20_poly1305.c:307: error: INTEGER_OVERFLOW_L2
([-15, +oo] - [-15, 15]):unsigned64 by call to `Poly1305_Update`.
Showing all 9 steps of the trace
crypto/evp/e_chacha20_poly1305.c:210:1: Parameter `len`
208. # endif
209.
210. > static int chacha20_poly1305_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
211. const unsigned char *in, size_t len)
212. {
crypto/evp/e_chacha20_poly1305.c:306:9: Assignment
304. in += plen;
305. out += plen;
306. tail = (0 - plen) & (POLY1305_BLOCK_SIZE - 1);
^
307. Poly1305_Update(POLY1305_ctx(actx), zero, tail);
308. }
crypto/evp/e_chacha20_poly1305.c:307:9: Call
305. out += plen;
306. tail = (0 - plen) & (POLY1305_BLOCK_SIZE - 1);
307. Poly1305_Update(POLY1305_ctx(actx), zero, tail);
^
308. }
309.
crypto/poly1305/poly1305.c:470:1: <LHS trace>
468. #endif
469.
470. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len)
471. {
472. #ifdef POLY1305_ASM
crypto/poly1305/poly1305.c:470:1: Parameter `len`
468. #endif
469.
470. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len)
471. {
472. #ifdef POLY1305_ASM
crypto/poly1305/poly1305.c:470:1: <RHS trace>
468. #endif
469.
470. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len)
471. {
472. #ifdef POLY1305_ASM
crypto/poly1305/poly1305.c:470:1: Parameter `len`
468. #endif
469.
470. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len)
471. {
472. #ifdef POLY1305_ASM
crypto/poly1305/poly1305.c:498:5: Assignment
496. }
497.
498. rem = len % POLY1305_BLOCK_SIZE;
^
499. len -= rem;
500.
crypto/poly1305/poly1305.c:499:5: Binary operation: ([-15, +oo] - [-15, 15]):unsigned64 by call to `Poly1305_Update`
497.
498. rem = len % POLY1305_BLOCK_SIZE;
499. len -= rem;
^
500.
501. if (len >= POLY1305_BLOCK_SIZE) {
| https://github.com/openssl/openssl/blob/3e0076c213ec2d1149a9a89f9bc141d1a1a44630/crypto/poly1305/poly1305.c/#L499 |
d2a_code_trace_data_41518 | 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);
}
test/bntest.c:1924: error: BUFFER_OVERRUN_L3
Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mod_exp`.
Showing all 21 steps of the trace
test/bntest.c:1922:5: Call
1920. || !TEST_ptr(r = BN_new()))
1921. goto err;
1922. BN_zero(zero);
^
1923.
1924. if (!TEST_true(BN_mod_exp(r, a, zero, BN_value_one(), NULL))
crypto/bn/bn_lib.c:402:15: Assignment
400. a->neg = 0;
401. a->d[0] = w;
402. a->top = (w ? 1 : 0);
^
403. bn_check_top(a);
404. return (1);
crypto/bn/bn_lib.c:402:5: Assignment
400. a->neg = 0;
401. a->d[0] = w;
402. a->top = (w ? 1 : 0);
^
403. bn_check_top(a);
404. return (1);
test/bntest.c:1924:10: Call
1922. BN_zero(zero);
1923.
1924. if (!TEST_true(BN_mod_exp(r, a, zero, BN_value_one(), NULL))
^
1925. || !TEST_BN_eq_zero(r)
1926. || !TEST_true(BN_mod_exp_mont(r, a, zero, BN_value_one(),
crypto/bn/bn_exp.c:91:1: Parameter `a->top`
89. }
90.
91. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
92. BN_CTX *ctx)
93. {
crypto/bn/bn_exp.c:144:19: Call
142. } else
143. # endif
144. ret = BN_mod_exp_mont(r, a, p, m, ctx, NULL);
^
145. } else
146. #endif
crypto/bn/bn_exp.c:294:1: Parameter `a->top`
292. }
293.
294. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
295. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
296. {
crypto/bn/bn_exp.c:306:16: Call
304.
305. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) {
306. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);
^
307. }
308.
crypto/bn/bn_exp.c:594:1: Parameter `a->top`
592. * http://www.daemonology.net/hyperthreading-considered-harmful/)
593. */
594. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
595. const BIGNUM *m, BN_CTX *ctx,
596. BN_MONT_CTX *in_mont)
crypto/bn/bn_exp.c:747:14: Call
745. /* prepare a^1 in Montgomery domain */
746. if (a->neg || BN_ucmp(a, m) >= 0) {
747. if (!BN_mod(&am, a, m, ctx))
^
748. goto err;
749. if (!BN_to_montgomery(&am, &am, mont, ctx))
crypto/bn/bn_div.c:140:1: Parameter `num->top`
138. * If 'dv' or 'rm' is NULL, the respective value is not returned.
139. */
140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
141. BN_CTX *ctx)
142. {
crypto/bn/bn_div.c:210:11: Call
208. sdiv->neg = 0;
209. norm_shift += BN_BITS2;
210. if (!(BN_lshift(snum, num, norm_shift)))
^
211. goto err;
212. snum->neg = 0;
crypto/bn/bn_shift.c: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 `BN_mod_exp`
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/3f97052392cb10fca5309212bf720685262ad4a6/crypto/bn/bn_shift.c/#L112 |
d2a_code_trace_data_41519 | 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/mpc7.c:93: error: Integer Overflow L2
([1, +oo] - 11):unsigned32 by call to `bitstream_read`.
libavcodec/mpc7.c:93:23: Call
91. bitstream_skip(&bc, 88);
92. c->gapless = bitstream_read_bit(&bc);
93. c->lastframelen = bitstream_read(&bc, 11);
^
94. av_log(avctx, AV_LOG_DEBUG, "IS: %d, MSS: %d, TG: %d, LFL: %d, bands: %d\n",
95. c->IS, c->MSS, c->gapless, c->lastframelen, c->maxbands);
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] - 11):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_41520 | static int filter_frame(AVFilterLink *link, AVFrame *in)
{
ScaleContext *scale = link->dst->priv;
AVFilterLink *outlink = link->dst->outputs[0];
AVFrame *out;
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
if (!scale->sws)
return ff_filter_frame(outlink, in);
scale->hsub = desc->log2_chroma_w;
scale->vsub = desc->log2_chroma_h;
out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
if (!out) {
av_frame_free(&in);
return AVERROR(ENOMEM);
}
av_frame_copy_props(out, in);
out->width = outlink->w;
out->height = outlink->h;
av_reduce(&out->sample_aspect_ratio.num, &out->sample_aspect_ratio.den,
(int64_t)in->sample_aspect_ratio.num * outlink->h * link->w,
(int64_t)in->sample_aspect_ratio.den * outlink->w * link->h,
INT_MAX);
sws_scale(scale->sws, in->data, in->linesize, 0, in->height,
out->data, out->linesize);
av_frame_free(&in);
return ff_filter_frame(outlink, out);
}
libavfilter/vf_scale.c:265: error: Null Dereference
pointer `desc` last assigned on line 260 could be null and is dereferenced at line 265, column 19.
libavfilter/vf_scale.c:255:1: start of procedure filter_frame()
253. }
254.
255. static int filter_frame(AVFilterLink *link, AVFrame *in)
^
256. {
257. ScaleContext *scale = link->dst->priv;
libavfilter/vf_scale.c:257:5:
255. static int filter_frame(AVFilterLink *link, AVFrame *in)
256. {
257. ScaleContext *scale = link->dst->priv;
^
258. AVFilterLink *outlink = link->dst->outputs[0];
259. AVFrame *out;
libavfilter/vf_scale.c:258:5:
256. {
257. ScaleContext *scale = link->dst->priv;
258. AVFilterLink *outlink = link->dst->outputs[0];
^
259. AVFrame *out;
260. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
libavfilter/vf_scale.c:260:5:
258. AVFilterLink *outlink = link->dst->outputs[0];
259. AVFrame *out;
260. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
^
261.
262. if (!scale->sws)
libavutil/pixdesc.c:1464:1: start of procedure av_pix_fmt_desc_get()
1462. }
1463.
1464. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
^
1465. {
1466. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
libavutil/pixdesc.c:1466:9: Taking false branch
1464. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1465. {
1466. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
^
1467. return NULL;
1468. return &av_pix_fmt_descriptors[pix_fmt];
libavutil/pixdesc.c:1466:24: Taking true branch
1464. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1465. {
1466. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
^
1467. return NULL;
1468. return &av_pix_fmt_descriptors[pix_fmt];
libavutil/pixdesc.c:1467:9:
1465. {
1466. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
1467. return NULL;
^
1468. return &av_pix_fmt_descriptors[pix_fmt];
1469. }
libavutil/pixdesc.c:1469:1: return from a call to av_pix_fmt_desc_get
1467. return NULL;
1468. return &av_pix_fmt_descriptors[pix_fmt];
1469. }
^
1470.
1471. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
libavfilter/vf_scale.c:262:10: Taking false branch
260. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format);
261.
262. if (!scale->sws)
^
263. return ff_filter_frame(outlink, in);
264.
libavfilter/vf_scale.c:265:5:
263. return ff_filter_frame(outlink, in);
264.
265. scale->hsub = desc->log2_chroma_w;
^
266. scale->vsub = desc->log2_chroma_h;
267.
| https://github.com/libav/libav/blob/5f87c277bd5caa09cc4f9061d4ccdd58dc121110/libavfilter/vf_scale.c/#L265 |
d2a_code_trace_data_41521 | static void pred8x8l_down_right_c(uint8_t *src, int has_topleft, int has_topright, int stride)
{
PREDICT_8x8_LOAD_TOP;
PREDICT_8x8_LOAD_LEFT;
PREDICT_8x8_LOAD_TOPLEFT;
SRC(0,7)= (l7 + 2*l6 + l5 + 2) >> 2;
SRC(0,6)=SRC(1,7)= (l6 + 2*l5 + l4 + 2) >> 2;
SRC(0,5)=SRC(1,6)=SRC(2,7)= (l5 + 2*l4 + l3 + 2) >> 2;
SRC(0,4)=SRC(1,5)=SRC(2,6)=SRC(3,7)= (l4 + 2*l3 + l2 + 2) >> 2;
SRC(0,3)=SRC(1,4)=SRC(2,5)=SRC(3,6)=SRC(4,7)= (l3 + 2*l2 + l1 + 2) >> 2;
SRC(0,2)=SRC(1,3)=SRC(2,4)=SRC(3,5)=SRC(4,6)=SRC(5,7)= (l2 + 2*l1 + l0 + 2) >> 2;
SRC(0,1)=SRC(1,2)=SRC(2,3)=SRC(3,4)=SRC(4,5)=SRC(5,6)=SRC(6,7)= (l1 + 2*l0 + lt + 2) >> 2;
SRC(0,0)=SRC(1,1)=SRC(2,2)=SRC(3,3)=SRC(4,4)=SRC(5,5)=SRC(6,6)=SRC(7,7)= (l0 + 2*lt + t0 + 2) >> 2;
SRC(1,0)=SRC(2,1)=SRC(3,2)=SRC(4,3)=SRC(5,4)=SRC(6,5)=SRC(7,6)= (lt + 2*t0 + t1 + 2) >> 2;
SRC(2,0)=SRC(3,1)=SRC(4,2)=SRC(5,3)=SRC(6,4)=SRC(7,5)= (t0 + 2*t1 + t2 + 2) >> 2;
SRC(3,0)=SRC(4,1)=SRC(5,2)=SRC(6,3)=SRC(7,4)= (t1 + 2*t2 + t3 + 2) >> 2;
SRC(4,0)=SRC(5,1)=SRC(6,2)=SRC(7,3)= (t2 + 2*t3 + t4 + 2) >> 2;
SRC(5,0)=SRC(6,1)=SRC(7,2)= (t3 + 2*t4 + t5 + 2) >> 2;
SRC(6,0)=SRC(7,1)= (t4 + 2*t5 + t6 + 2) >> 2;
SRC(7,0)= (t5 + 2*t6 + t7 + 2) >> 2;
}
libavcodec/h264pred.c:857: error: Uninitialized Value
The value read from l7 was never initialized.
libavcodec/h264pred.c:857:5:
855. PREDICT_8x8_LOAD_LEFT;
856. PREDICT_8x8_LOAD_TOPLEFT;
857. SRC(0,7)= (l7 + 2*l6 + l5 + 2) >> 2;
^
858. SRC(0,6)=SRC(1,7)= (l6 + 2*l5 + l4 + 2) >> 2;
859. SRC(0,5)=SRC(1,6)=SRC(2,7)= (l5 + 2*l4 + l3 + 2) >> 2;
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264pred.c/#L857 |
d2a_code_trace_data_41522 | static int dca_subsubframe(DCAContext *s, int base_channel, int block_index)
{
int k, l;
int subsubframe = s->current_subsubframe;
const float *quant_step_table;
LOCAL_ALIGNED_16(int32_t, block, [SAMPLES_PER_SUBBAND * DCA_SUBBANDS]);
if (s->bit_rate_index == 0x1f)
quant_step_table = ff_dca_lossless_quant_d;
else
quant_step_table = ff_dca_lossy_quant_d;
for (k = base_channel; k < s->audio_header.prim_channels; k++) {
float (*subband_samples)[8] = s->dca_chan[k].subband_samples[block_index];
float rscale[DCA_SUBBANDS];
if (get_bits_left(&s->gb) < 0)
return AVERROR_INVALIDDATA;
for (l = 0; l < s->audio_header.vq_start_subband[k]; l++) {
int m;
int abits = s->dca_chan[k].bitalloc[l];
float quant_step_size = quant_step_table[abits];
int sel = s->audio_header.quant_index_huffman[k][abits];
if (!abits) {
rscale[l] = 0;
memset(block + SAMPLES_PER_SUBBAND * l, 0, SAMPLES_PER_SUBBAND * sizeof(block[0]));
} else {
int sfi = s->dca_chan[k].transition_mode[l] &&
subsubframe >= s->dca_chan[k].transition_mode[l];
rscale[l] = quant_step_size * s->dca_chan[k].scale_factor[l][sfi] *
s->audio_header.scalefactor_adj[k][sel];
if (abits >= 11 || !dca_smpl_bitalloc[abits].vlc[sel].table) {
if (abits <= 7) {
int block_code1, block_code2, size, levels, err;
size = abits_sizes[abits - 1];
levels = abits_levels[abits - 1];
block_code1 = get_bits(&s->gb, size);
block_code2 = get_bits(&s->gb, size);
err = decode_blockcodes(block_code1, block_code2,
levels, block + SAMPLES_PER_SUBBAND * l);
if (err) {
av_log(s->avctx, AV_LOG_ERROR,
"ERROR: block code look-up failed\n");
return AVERROR_INVALIDDATA;
}
} else {
for (m = 0; m < SAMPLES_PER_SUBBAND; m++)
block[SAMPLES_PER_SUBBAND * l + m] = get_sbits(&s->gb, abits - 3);
}
} else {
for (m = 0; m < SAMPLES_PER_SUBBAND; m++)
block[SAMPLES_PER_SUBBAND * l + m] = get_bitalloc(&s->gb,
&dca_smpl_bitalloc[abits], sel);
}
}
}
s->fmt_conv.int32_to_float_fmul_array8(&s->fmt_conv, subband_samples[0],
block, rscale, SAMPLES_PER_SUBBAND * s->audio_header.vq_start_subband[k]);
for (l = 0; l < s->audio_header.vq_start_subband[k]; l++) {
int m;
if (s->dca_chan[k].prediction_mode[l]) {
int n;
if (s->predictor_history)
subband_samples[l][0] += (ff_dca_adpcm_vb[s->dca_chan[k].prediction_vq[l]][0] *
s->dca_chan[k].subband_samples_hist[l][3] +
ff_dca_adpcm_vb[s->dca_chan[k].prediction_vq[l]][1] *
s->dca_chan[k].subband_samples_hist[l][2] +
ff_dca_adpcm_vb[s->dca_chan[k].prediction_vq[l]][2] *
s->dca_chan[k].subband_samples_hist[l][1] +
ff_dca_adpcm_vb[s->dca_chan[k].prediction_vq[l]][3] *
s->dca_chan[k].subband_samples_hist[l][0]) *
(1.0f / 8192);
for (m = 1; m < SAMPLES_PER_SUBBAND; m++) {
float sum = ff_dca_adpcm_vb[s->dca_chan[k].prediction_vq[l]][0] *
subband_samples[l][m - 1];
for (n = 2; n <= 4; n++)
if (m >= n)
sum += ff_dca_adpcm_vb[s->dca_chan[k].prediction_vq[l]][n - 1] *
subband_samples[l][m - n];
else if (s->predictor_history)
sum += ff_dca_adpcm_vb[s->dca_chan[k].prediction_vq[l]][n - 1] *
s->dca_chan[k].subband_samples_hist[l][m - n + 4];
subband_samples[l][m] += sum * 1.0f / 8192;
}
}
}
for (l = 0; l < DCA_SUBBANDS; l++)
AV_COPY128(s->dca_chan[k].subband_samples_hist[l], &subband_samples[l][4]);
if (s->audio_header.subband_activity[k] > s->audio_header.vq_start_subband[k]) {
if (!s->debug_flag & 0x01) {
av_log(s->avctx, AV_LOG_DEBUG,
"Stream with high frequencies VQ coding\n");
s->debug_flag |= 0x01;
}
s->dcadsp.decode_hf(subband_samples, s->dca_chan[k].high_freq_vq,
ff_dca_high_freq_vq, subsubframe * SAMPLES_PER_SUBBAND,
s->dca_chan[k].scale_factor,
s->audio_header.vq_start_subband[k],
s->audio_header.subband_activity[k]);
}
}
if (s->aspf || subsubframe == s->subsubframes[s->current_subframe] - 1) {
if (get_bits(&s->gb, 16) != 0xFFFF) {
av_log(s->avctx, AV_LOG_ERROR, "Didn't get subframe DSYNC\n");
return AVERROR_INVALIDDATA;
}
}
return 0;
}
libavcodec/dcadec.c:902: error: Buffer Overrun L2
Offset: [1, 5] Size: 4.
libavcodec/dcadec.c:893:22: <Offset trace>
891. s->dca_chan[k].subband_samples_hist[l][0]) *
892. (1.0f / 8192);
893. for (m = 1; m < SAMPLES_PER_SUBBAND; m++) {
^
894. float sum = ff_dca_adpcm_vb[s->dca_chan[k].prediction_vq[l]][0] *
895. subband_samples[l][m - 1];
libavcodec/dcadec.c:893:22: Assignment
891. s->dca_chan[k].subband_samples_hist[l][0]) *
892. (1.0f / 8192);
893. for (m = 1; m < SAMPLES_PER_SUBBAND; m++) {
^
894. float sum = ff_dca_adpcm_vb[s->dca_chan[k].prediction_vq[l]][0] *
895. subband_samples[l][m - 1];
libavcodec/dcadec.c:788:1: <Length trace>
786. static const uint8_t abits_levels[7] = { 3, 5, 7, 9, 13, 17, 25 };
787.
788. static int dca_subsubframe(DCAContext *s, int base_channel, int block_index)
^
789. {
790. int k, l;
libavcodec/dcadec.c:788:1: Parameter `s->dca_chan[*].subband_samples_hist[*][*]`
786. static const uint8_t abits_levels[7] = { 3, 5, 7, 9, 13, 17, 25 };
787.
788. static int dca_subsubframe(DCAContext *s, int base_channel, int block_index)
^
789. {
790. int k, l;
libavcodec/dcadec.c:902:36: Array access: Offset: [1, 5] Size: 4
900. else if (s->predictor_history)
901. sum += ff_dca_adpcm_vb[s->dca_chan[k].prediction_vq[l]][n - 1] *
902. s->dca_chan[k].subband_samples_hist[l][m - n + 4];
^
903. subband_samples[l][m] += sum * 1.0f / 8192;
904. }
| https://github.com/libav/libav/blob/c1aac39eaccd32dc3b74ccfcce701d3d888fbc6b/libavcodec/dcadec.c/#L902 |
d2a_code_trace_data_41523 | 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:1058: error: Uninitialized Value
The value read from ymin was never initialized.
libavcodec/motion_est_template.c:1058:9:
1056. CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift)
1057. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1)
1058. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1)
^
1059. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) )
1060. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) )
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1058 |
d2a_code_trace_data_41524 | 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:214: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_mod_add`.
Showing all 20 steps of the trace
crypto/sm2/sm2_sign.c:187:9: Call
185.
186. BN_CTX_start(ctx);
187. t = BN_CTX_get(ctx);
^
188. x1 = BN_CTX_get(ctx);
189. if (x1 == 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:367:15: Assignment
365. a->neg = 0;
366. a->d[0] = w;
367. a->top = (w ? 1 : 0);
^
368. bn_check_top(a);
369. return 1;
crypto/bn/bn_lib.c:367:5: Assignment
365. a->neg = 0;
366. a->d[0] = w;
367. a->top = (w ? 1 : 0);
^
368. bn_check_top(a);
369. return 1;
crypto/sm2/sm2_sign.c:214:10: Call
212. }
213.
214. if (!BN_mod_add(t, r, s, order, ctx)) {
^
215. SM2err(SM2_F_SM2_SIG_VERIFY, ERR_R_BN_LIB);
216. goto done;
crypto/bn/bn_mod.c:28:1: Parameter `*r->d`
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->d`
12.
13. /* signed add of b to a. */
14. > int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
15. {
16. int ret, r_neg, cmp_res;
crypto/bn/bn_add.c:23:15: Call
21. if (a->neg == b->neg) {
22. r_neg = a->neg;
23. ret = BN_uadd(r, a, b);
^
24. } else {
25. cmp_res = BN_ucmp(a, b);
crypto/bn/bn_add.c:76:1: Parameter `*r->d`
74.
75. /* unsigned add of b to a, r can be equal to a or b. */
76. > int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
77. {
78. int max, min, dif;
crypto/bn/bn_add.c:96:9: Call
94. dif = max - min;
95.
96. if (bn_wexpand(r, max + 1) == NULL)
^
97. return 0;
98.
crypto/bn/bn_lib.c:941:1: Parameter `*a->d`
939. }
940.
941. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
942. {
943. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_lib.c:943:37: Call
941. BIGNUM *bn_wexpand(BIGNUM *a, int words)
942. {
943. return (words <= a->dmax) ? a : bn_expand2(a, words);
^
944. }
945.
crypto/bn/bn_lib.c:246:1: Parameter `*b->d`
244. */
245.
246. > BIGNUM *bn_expand2(BIGNUM *b, int words)
247. {
248. bn_check_top(b);
crypto/bn/bn_lib.c:251:23: Call
249.
250. if (words > b->dmax) {
251. BN_ULONG *a = bn_expand_internal(b, words);
^
252. if (!a)
253. return NULL;
crypto/bn/bn_lib.c:208:1: <Offset trace>
206. /* This is used by bn_expand2() */
207. /* The caller MUST check that words > b->dmax before calling this */
208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
209. {
210. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:208:1: Parameter `b->top`
206. /* This is used by bn_expand2() */
207. /* The caller MUST check that words > b->dmax before calling this */
208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
209. {
210. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:208:1: <Length trace>
206. /* This is used by bn_expand2() */
207. /* The caller MUST check that words > b->dmax before calling this */
208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
209. {
210. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:208:1: Parameter `*b->d`
206. /* This is used by bn_expand2() */
207. /* The caller MUST check that words > b->dmax before calling this */
208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
209. {
210. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:233:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_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/630fe1da888490b7dfef3fe0928b813ddff5d51a/crypto/bn/bn_lib.c/#L233 |
d2a_code_trace_data_41525 | static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,
LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg)
{
int i;
LHASH_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:588: error: INTEGER_OVERFLOW_L2
([0, max(0, `s->ctx->sessions->num_nodes`)] - 1):unsigned32 by call to `SSL_CTX_free`.
Showing all 11 steps of the trace
ssl/ssl_lib.c:505:1: Parameter `s->ctx->sessions->num_nodes`
503. }
504.
505. > void SSL_free(SSL *s)
506. {
507. int i;
ssl/ssl_lib.c:588:14: Call
586. if (s->method != NULL) s->method->ssl_free(s);
587.
588. if (s->ctx) SSL_CTX_free(s->ctx);
^
589.
590. #ifndef OPENSSL_NO_KRB5
ssl/ssl_lib.c:1899:1: Parameter `a->sessions->num_nodes`
1897. #endif
1898.
1899. > void SSL_CTX_free(SSL_CTX *a)
1900. {
1901. int i;
ssl/ssl_lib.c:1931:3: Call
1929. */
1930. if (a->sessions != NULL)
1931. SSL_CTX_flush_sessions(a,0);
^
1932.
1933. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data);
ssl/ssl_sess.c:985:1: Parameter `s->sessions->num_nodes`
983. static IMPLEMENT_LHASH_DOALL_ARG_FN(timeout, SSL_SESSION, TIMEOUT_PARAM)
984.
985. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t)
986. {
987. unsigned long i;
ssl/ssl_sess.c:997:2: Call
995. i=CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load;
996. CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load=0;
997. lh_SSL_SESSION_doall_arg(tp.cache, LHASH_DOALL_ARG_FN(timeout),
^
998. TIMEOUT_PARAM, &tp);
999. CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load=i;
crypto/lhash/lhash.c:305:1: Parameter `lh->num_nodes`
303. }
304.
305. > void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg)
306. {
307. doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg);
crypto/lhash/lhash.c:307:2: Call
305. void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg)
306. {
307. doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg);
^
308. }
309.
crypto/lhash/lhash.c:270:1: <LHS trace>
268. }
269.
270. > static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,
271. LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg)
272. {
crypto/lhash/lhash.c:270:1: Parameter `lh->num_nodes`
268. }
269.
270. > static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,
271. LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg)
272. {
crypto/lhash/lhash.c:281:7: Binary operation: ([0, max(0, s->ctx->sessions->num_nodes)] - 1):unsigned32 by call to `SSL_CTX_free`
279. /* reverse the order so we search from 'top to bottom'
280. * We were having memory leaks otherwise */
281. for (i=lh->num_nodes-1; i>=0; i--)
^
282. {
283. a=lh->b[i];
| https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/lhash/lhash.c/#L281 |
d2a_code_trace_data_41526 | 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:644: error: NULL_DEREFERENCE
pointer `meth` last assigned on line 642 could be null and is dereferenced at line 644, column 9.
Showing all 14 steps of the trace
crypto/rand/rand_lib.c:640:1: start of procedure RAND_bytes()
638. }
639.
640. > int RAND_bytes(unsigned char *buf, int num)
641. {
642. const RAND_METHOD *meth = RAND_get_rand_method();
crypto/rand/rand_lib.c:642:5:
640. int RAND_bytes(unsigned char *buf, int num)
641. {
642. > const RAND_METHOD *meth = RAND_get_rand_method();
643.
644. if (meth->bytes != NULL)
crypto/rand/rand_lib.c:548:1: start of procedure RAND_get_rand_method()
546. }
547.
548. > const RAND_METHOD *RAND_get_rand_method(void)
549. {
550. const RAND_METHOD *tmp_meth = NULL;
crypto/rand/rand_lib.c:550:5:
548. const RAND_METHOD *RAND_get_rand_method(void)
549. {
550. > const RAND_METHOD *tmp_meth = NULL;
551.
552. if (!RUN_ONCE(&rand_init, do_rand_init))
crypto/rand/rand_lib.c:552:10:
550. const RAND_METHOD *tmp_meth = NULL;
551.
552. > if (!RUN_ONCE(&rand_init, do_rand_init))
553. return NULL;
554.
crypto/threads_pthread.c:105:1: start of procedure CRYPTO_THREAD_run_once()
103. }
104.
105. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
106. {
107. if (pthread_once(once, init) != 0)
crypto/threads_pthread.c:107:9: Taking true branch
105. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
106. {
107. if (pthread_once(once, init) != 0)
^
108. return 0;
109.
crypto/threads_pthread.c:108:9:
106. {
107. if (pthread_once(once, init) != 0)
108. > return 0;
109.
110. return 1;
crypto/threads_pthread.c:111:1: return from a call to CRYPTO_THREAD_run_once
109.
110. return 1;
111. > }
112.
113. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))
crypto/rand/rand_lib.c:552:10: Condition is false
550. const RAND_METHOD *tmp_meth = NULL;
551.
552. if (!RUN_ONCE(&rand_init, do_rand_init))
^
553. return NULL;
554.
crypto/rand/rand_lib.c:552:10: Taking true branch
550. const RAND_METHOD *tmp_meth = NULL;
551.
552. if (!RUN_ONCE(&rand_init, do_rand_init))
^
553. return NULL;
554.
crypto/rand/rand_lib.c:553:9:
551.
552. if (!RUN_ONCE(&rand_init, do_rand_init))
553. > return NULL;
554.
555. CRYPTO_THREAD_write_lock(rand_meth_lock);
crypto/rand/rand_lib.c:576:1: return from a call to RAND_get_rand_method
574. CRYPTO_THREAD_unlock(rand_meth_lock);
575. return tmp_meth;
576. > }
577.
578. #ifndef OPENSSL_NO_ENGINE
crypto/rand/rand_lib.c:644:9:
642. const RAND_METHOD *meth = RAND_get_rand_method();
643.
644. > if (meth->bytes != NULL)
645. return meth->bytes(buf, num);
646. RANDerr(RAND_F_RAND_BYTES, RAND_R_FUNC_NOT_IMPLEMENTED);
| https://github.com/openssl/openssl/blob/e0b625f9db00509af9004b7907d44b78f332754a/crypto/rand/rand_lib.c/#L644 |
d2a_code_trace_data_41527 | static int decode_13(AVCodecContext *avctx, DxaDecContext *c, uint8_t* dst, uint8_t *src, uint8_t *ref)
{
uint8_t *code, *data, *mv, *msk, *tmp, *tmp2;
int i, j, k;
int type, x, y, d, d2;
int stride = c->pic.linesize[0];
uint32_t mask;
code = src + 12;
data = code + ((avctx->width * avctx->height) >> 4);
mv = data + AV_RB32(src + 0);
msk = mv + AV_RB32(src + 4);
for(j = 0; j < avctx->height; j += 4){
for(i = 0; i < avctx->width; i += 4){
tmp = dst + i;
tmp2 = ref + i;
type = *code++;
switch(type){
case 4:
x = (*mv) >> 4; if(x & 8) x = 8 - x;
y = (*mv++) & 0xF; if(y & 8) y = 8 - y;
tmp2 += x + y*stride;
case 0:
case 5:
for(y = 0; y < 4; y++){
memcpy(tmp, tmp2, 4);
tmp += stride;
tmp2 += stride;
}
break;
case 1:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
if(type == 1){
mask = AV_RB16(msk);
msk += 2;
}else{
type -= 10;
mask = ((msk[0] & 0xF0) << shift1[type]) | ((msk[0] & 0xF) << shift2[type]);
msk++;
}
for(y = 0; y < 4; y++){
for(x = 0; x < 4; x++){
tmp[x] = (mask & 0x8000) ? *data++ : tmp2[x];
mask <<= 1;
}
tmp += stride;
tmp2 += stride;
}
break;
case 2:
for(y = 0; y < 4; y++){
memset(tmp, data[0], 4);
tmp += stride;
}
data++;
break;
case 3:
for(y = 0; y < 4; y++){
memcpy(tmp, data, 4);
data += 4;
tmp += stride;
}
break;
case 8:
mask = *msk++;
for(k = 0; k < 4; k++){
d = ((k & 1) << 1) + ((k & 2) * stride);
d2 = ((k & 1) << 1) + ((k & 2) * stride);
tmp2 = ref + i + d2;
switch(mask & 0xC0){
case 0x80:
x = (*mv) >> 4; if(x & 8) x = 8 - x;
y = (*mv++) & 0xF; if(y & 8) y = 8 - y;
tmp2 += x + y*stride;
case 0x00:
tmp[d + 0 ] = tmp2[0];
tmp[d + 1 ] = tmp2[1];
tmp[d + 0 + stride] = tmp2[0 + stride];
tmp[d + 1 + stride] = tmp2[1 + stride];
break;
case 0x40:
tmp[d + 0 ] = data[0];
tmp[d + 1 ] = data[0];
tmp[d + 0 + stride] = data[0];
tmp[d + 1 + stride] = data[0];
data++;
break;
case 0xC0:
tmp[d + 0 ] = *data++;
tmp[d + 1 ] = *data++;
tmp[d + 0 + stride] = *data++;
tmp[d + 1 + stride] = *data++;
break;
}
mask <<= 2;
}
break;
case 32:
mask = AV_RB16(msk);
msk += 2;
for(y = 0; y < 4; y++){
for(x = 0; x < 4; x++){
tmp[x] = data[mask & 1];
mask >>= 1;
}
tmp += stride;
tmp2 += stride;
}
data += 2;
break;
case 33:
case 34:
mask = AV_RB32(msk);
msk += 4;
for(y = 0; y < 4; y++){
for(x = 0; x < 4; x++){
tmp[x] = data[mask & 3];
mask >>= 2;
}
tmp += stride;
tmp2 += stride;
}
data += type - 30;
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unknown opcode %d\n", type);
return -1;
}
}
dst += stride * 4;
ref += stride * 4;
}
return 0;
}
libavcodec/dxa.c:270: error: Buffer Overrun L3
Offset: [-8, 5] Size: 6 by call to `decode_13`.
libavcodec/dxa.c:215:8: Unknown value from: non-const function
213. }
214.
215. if(avctx->get_buffer(avctx, &c->pic) < 0){
^
216. av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
217. return -1;
libavcodec/dxa.c:270:9: Call
268. c->pic.key_frame = 0;
269. c->pic.pict_type = FF_P_TYPE;
270. decode_13(avctx, c, c->pic.data[0], srcptr, c->prev.data[0]);
^
271. break;
272. default:
libavcodec/dxa.c:49:1: <Offset trace>
47. static const int shift2[6] = { 0, 0, 8, 4, 0, 4 };
48.
49. static int decode_13(AVCodecContext *avctx, DxaDecContext *c, uint8_t* dst, uint8_t *src, uint8_t *ref)
^
50. {
51. uint8_t *code, *data, *mv, *msk, *tmp, *tmp2;
libavcodec/dxa.c:49:1: Parameter `*src`
47. static const int shift2[6] = { 0, 0, 8, 4, 0, 4 };
48.
49. static int decode_13(AVCodecContext *avctx, DxaDecContext *c, uint8_t* dst, uint8_t *src, uint8_t *ref)
^
50. {
51. uint8_t *code, *data, *mv, *msk, *tmp, *tmp2;
libavcodec/dxa.c:66:13: Assignment
64. tmp = dst + i;
65. tmp2 = ref + i;
66. type = *code++;
^
67. switch(type){
68. case 4: // motion compensation
libavcodec/dxa.c:91:21: Assignment
89. msk += 2;
90. }else{
91. type -= 10;
^
92. mask = ((msk[0] & 0xF0) << shift1[type]) | ((msk[0] & 0xF) << shift2[type]);
93. msk++;
libavcodec/dxa.c:46:1: <Length trace>
44. } DxaDecContext;
45.
46. static const int shift1[6] = { 0, 8, 8, 8, 4, 4 };
^
47. static const int shift2[6] = { 0, 0, 8, 4, 0, 4 };
48.
libavcodec/dxa.c:46:1: Array declaration
44. } DxaDecContext;
45.
46. static const int shift1[6] = { 0, 8, 8, 8, 4, 4 };
^
47. static const int shift2[6] = { 0, 0, 8, 4, 0, 4 };
48.
libavcodec/dxa.c:92:48: Array access: Offset: [-8, 5] Size: 6 by call to `decode_13`
90. }else{
91. type -= 10;
92. mask = ((msk[0] & 0xF0) << shift1[type]) | ((msk[0] & 0xF) << shift2[type]);
^
93. msk++;
94. }
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dxa.c/#L92 |
d2a_code_trace_data_41528 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/bn/bn_rsa_fips186_4.c:215: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `bn_rsa_fips186_4_derive_prime`.
Showing all 30 steps of the trace
crypto/bn/bn_rsa_fips186_4.c:208:17: Call
206. /* (Steps 4.2/5.2) - find first auxiliary probable primes */
207. if (!bn_rsa_fips186_4_find_aux_prob_prime(Xp1i, p1i, ctx, cb)
208. || !bn_rsa_fips186_4_find_aux_prob_prime(Xp2i, p2i, ctx, cb))
^
209. goto err;
210. /* (Table B.1) auxiliary prime Max length check */
crypto/bn/bn_rsa_fips186_4.c:120:1: Parameter `ctx->stack.depth`
118. * Returns: 1 on success otherwise it returns 0.
119. */
120. > static int bn_rsa_fips186_4_find_aux_prob_prime(const BIGNUM *Xp1,
121. BIGNUM *p1, BN_CTX *ctx,
122. BN_GENCB *cb)
crypto/bn/bn_rsa_fips186_4.c:215:10: Call
213. goto err;
214. /* (Steps 4.3/5.3) - generate prime */
215. if (!bn_rsa_fips186_4_derive_prime(p, Xpout, Xp, p1i, p2i, nlen, e, ctx, cb))
^
216. goto err;
217. ret = 1;
crypto/bn/bn_rsa_fips186_4.c:253:1: Parameter `ctx->stack.depth`
251. * Y, X, r1, r2, e are not NULL.
252. */
253. > int bn_rsa_fips186_4_derive_prime(BIGNUM *Y, BIGNUM *X, const BIGNUM *Xin,
254. const BIGNUM *r1, const BIGNUM *r2, int nlen,
255. const BIGNUM *e, BN_CTX *ctx, BN_GENCB *cb)
crypto/bn/bn_rsa_fips186_4.c:265:5: Call
263. if (checks == 0)
264. return 0;
265. BN_CTX_start(ctx);
^
266.
267. R = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_rsa_fips186_4.c:267:9: Call
265. BN_CTX_start(ctx);
266.
267. R = BN_CTX_get(ctx);
^
268. tmp = BN_CTX_get(ctx);
269. r1r2x2 = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_rsa_fips186_4.c:268:11: Call
266.
267. R = BN_CTX_get(ctx);
268. tmp = BN_CTX_get(ctx);
^
269. r1r2x2 = BN_CTX_get(ctx);
270. y1 = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_rsa_fips186_4.c:269:14: Call
267. R = BN_CTX_get(ctx);
268. tmp = BN_CTX_get(ctx);
269. r1r2x2 = BN_CTX_get(ctx);
^
270. y1 = BN_CTX_get(ctx);
271. r1x2 = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_rsa_fips186_4.c:270:10: Call
268. tmp = BN_CTX_get(ctx);
269. r1r2x2 = BN_CTX_get(ctx);
270. y1 = BN_CTX_get(ctx);
^
271. r1x2 = BN_CTX_get(ctx);
272. if (r1x2 == 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_rsa_fips186_4.c:271:12: Call
269. r1r2x2 = BN_CTX_get(ctx);
270. y1 = BN_CTX_get(ctx);
271. r1x2 = BN_CTX_get(ctx);
^
272. if (r1x2 == NULL)
273. 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_rsa_fips186_4.c:280:16: Call
278. if (!(BN_lshift1(r1x2, r1)
279. /* (Step 1) GCD(2r1, r2) = 1 */
280. && BN_gcd(tmp, r1x2, r2, ctx)
^
281. && BN_is_one(tmp)
282. /* (Step 2) R = ((r2^-1 mod 2r1) * r2) - ((2r1^-1 mod r2)*2r1) */
crypto/bn/bn_gcd.c:15:1: Parameter `ctx->stack.depth`
13. static BIGNUM *euclid(BIGNUM *a, BIGNUM *b);
14.
15. > int BN_gcd(BIGNUM *r, const BIGNUM *in_a, const BIGNUM *in_b, BN_CTX *ctx)
16. {
17. BIGNUM *a, *b, *t;
crypto/bn/bn_gcd.c:23:5: Call
21. bn_check_top(in_b);
22.
23. BN_CTX_start(ctx);
^
24. a = BN_CTX_get(ctx);
25. b = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_gcd.c:24:9: Call
22.
23. BN_CTX_start(ctx);
24. a = BN_CTX_get(ctx);
^
25. b = BN_CTX_get(ctx);
26. if (b == NULL)
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_gcd.c:25:9: Call
23. BN_CTX_start(ctx);
24. a = BN_CTX_get(ctx);
25. b = BN_CTX_get(ctx);
^
26. if (b == NULL)
27. goto err;
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_gcd.c:49:5: Call
47. ret = 1;
48. err:
49. BN_CTX_end(ctx);
^
50. bn_check_top(r);
51. return ret;
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_rsa_fips186_4_derive_prime`
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_41529 | static int dct_quantize_refine(MpegEncContext *s,
DCTELEM *block, int16_t *weight, DCTELEM *orig,
int n, int qscale){
int16_t rem[64];
DECLARE_ALIGNED_16(DCTELEM, d1[64]);
const int *qmat;
const uint8_t *scantable= s->intra_scantable.scantable;
const uint8_t *perm_scantable= s->intra_scantable.permutated;
int run_tab[65];
int prev_run=0;
int prev_level=0;
int qmul, qadd, start_i, last_non_zero, i, dc;
uint8_t * length;
uint8_t * last_length;
int lambda;
int rle_index, run, q = 1, sum;
#ifdef REFINE_STATS
static int count=0;
static int after_last=0;
static int to_zero=0;
static int from_zero=0;
static int raise=0;
static int lower=0;
static int messed_sign=0;
#endif
if(basis[0][0] == 0)
build_basis(s->dsp.idct_permutation);
qmul= qscale*2;
qadd= (qscale-1)|1;
if (s->mb_intra) {
if (!s->h263_aic) {
if (n < 4)
q = s->y_dc_scale;
else
q = s->c_dc_scale;
} else{
q = 1;
qadd=0;
}
q <<= RECON_SHIFT-3;
dc= block[0]*q;
start_i = 1;
qmat = s->q_intra_matrix[qscale];
length = s->intra_ac_vlc_length;
last_length= s->intra_ac_vlc_last_length;
} else {
dc= 0;
start_i = 0;
qmat = s->q_inter_matrix[qscale];
length = s->inter_ac_vlc_length;
last_length= s->inter_ac_vlc_last_length;
}
last_non_zero = s->block_last_index[n];
#ifdef REFINE_STATS
{START_TIMER
#endif
dc += (1<<(RECON_SHIFT-1));
for(i=0; i<64; i++){
rem[i]= dc - (orig[i]<<RECON_SHIFT);
}
#ifdef REFINE_STATS
STOP_TIMER("memset rem[]")}
#endif
sum=0;
for(i=0; i<64; i++){
int one= 36;
int qns=4;
int w;
w= FFABS(weight[i]) + qns*one;
w= 15 + (48*qns*one + w/2)/w;
weight[i] = w;
assert(w>0);
assert(w<(1<<6));
sum += w*w;
}
lambda= sum*(uint64_t)s->lambda2 >> (FF_LAMBDA_SHIFT - 6 + 6 + 6 + 6);
#ifdef REFINE_STATS
{START_TIMER
#endif
run=0;
rle_index=0;
for(i=start_i; i<=last_non_zero; i++){
int j= perm_scantable[i];
const int level= block[j];
int coeff;
if(level){
if(level<0) coeff= qmul*level - qadd;
else coeff= qmul*level + qadd;
run_tab[rle_index++]=run;
run=0;
s->dsp.add_8x8basis(rem, basis[j], coeff);
}else{
run++;
}
}
#ifdef REFINE_STATS
if(last_non_zero>0){
STOP_TIMER("init rem[]")
}
}
{START_TIMER
#endif
for(;;){
int best_score=s->dsp.try_8x8basis(rem, weight, basis[0], 0);
int best_coeff=0;
int best_change=0;
int run2, best_unquant_change=0, analyze_gradient;
#ifdef REFINE_STATS
{START_TIMER
#endif
analyze_gradient = last_non_zero > 2 || s->avctx->quantizer_noise_shaping >= 3;
if(analyze_gradient){
#ifdef REFINE_STATS
{START_TIMER
#endif
for(i=0; i<64; i++){
int w= weight[i];
d1[i] = (rem[i]*w*w + (1<<(RECON_SHIFT+12-1)))>>(RECON_SHIFT+12);
}
#ifdef REFINE_STATS
STOP_TIMER("rem*w*w")}
{START_TIMER
#endif
s->dsp.fdct(d1);
#ifdef REFINE_STATS
STOP_TIMER("dct")}
#endif
}
if(start_i){
const int level= block[0];
int change, old_coeff;
assert(s->mb_intra);
old_coeff= q*level;
for(change=-1; change<=1; change+=2){
int new_level= level + change;
int score, new_coeff;
new_coeff= q*new_level;
if(new_coeff >= 2048 || new_coeff < 0)
continue;
score= s->dsp.try_8x8basis(rem, weight, basis[0], new_coeff - old_coeff);
if(score<best_score){
best_score= score;
best_coeff= 0;
best_change= change;
best_unquant_change= new_coeff - old_coeff;
}
}
}
run=0;
rle_index=0;
run2= run_tab[rle_index++];
prev_level=0;
prev_run=0;
for(i=start_i; i<64; i++){
int j= perm_scantable[i];
const int level= block[j];
int change, old_coeff;
if(s->avctx->quantizer_noise_shaping < 3 && i > last_non_zero + 1)
break;
if(level){
if(level<0) old_coeff= qmul*level - qadd;
else old_coeff= qmul*level + qadd;
run2= run_tab[rle_index++];
}else{
old_coeff=0;
run2--;
assert(run2>=0 || i >= last_non_zero );
}
for(change=-1; change<=1; change+=2){
int new_level= level + change;
int score, new_coeff, unquant_change;
score=0;
if(s->avctx->quantizer_noise_shaping < 2 && FFABS(new_level) > FFABS(level))
continue;
if(new_level){
if(new_level<0) new_coeff= qmul*new_level - qadd;
else new_coeff= qmul*new_level + qadd;
if(new_coeff >= 2048 || new_coeff <= -2048)
continue;
if(level){
if(level < 63 && level > -63){
if(i < last_non_zero)
score += length[UNI_AC_ENC_INDEX(run, new_level+64)]
- length[UNI_AC_ENC_INDEX(run, level+64)];
else
score += last_length[UNI_AC_ENC_INDEX(run, new_level+64)]
- last_length[UNI_AC_ENC_INDEX(run, level+64)];
}
}else{
assert(FFABS(new_level)==1);
if(analyze_gradient){
int g= d1[ scantable[i] ];
if(g && (g^new_level) >= 0)
continue;
}
if(i < last_non_zero){
int next_i= i + run2 + 1;
int next_level= block[ perm_scantable[next_i] ] + 64;
if(next_level&(~127))
next_level= 0;
if(next_i < last_non_zero)
score += length[UNI_AC_ENC_INDEX(run, 65)]
+ length[UNI_AC_ENC_INDEX(run2, next_level)]
- length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)];
else
score += length[UNI_AC_ENC_INDEX(run, 65)]
+ last_length[UNI_AC_ENC_INDEX(run2, next_level)]
- last_length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)];
}else{
score += last_length[UNI_AC_ENC_INDEX(run, 65)];
if(prev_level){
score += length[UNI_AC_ENC_INDEX(prev_run, prev_level)]
- last_length[UNI_AC_ENC_INDEX(prev_run, prev_level)];
}
}
}
}else{
new_coeff=0;
assert(FFABS(level)==1);
if(i < last_non_zero){
int next_i= i + run2 + 1;
int next_level= block[ perm_scantable[next_i] ] + 64;
if(next_level&(~127))
next_level= 0;
if(next_i < last_non_zero)
score += length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)]
- length[UNI_AC_ENC_INDEX(run2, next_level)]
- length[UNI_AC_ENC_INDEX(run, 65)];
else
score += last_length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)]
- last_length[UNI_AC_ENC_INDEX(run2, next_level)]
- length[UNI_AC_ENC_INDEX(run, 65)];
}else{
score += -last_length[UNI_AC_ENC_INDEX(run, 65)];
if(prev_level){
score += last_length[UNI_AC_ENC_INDEX(prev_run, prev_level)]
- length[UNI_AC_ENC_INDEX(prev_run, prev_level)];
}
}
}
score *= lambda;
unquant_change= new_coeff - old_coeff;
assert((score < 100*lambda && score > -100*lambda) || lambda==0);
score+= s->dsp.try_8x8basis(rem, weight, basis[j], unquant_change);
if(score<best_score){
best_score= score;
best_coeff= i;
best_change= change;
best_unquant_change= unquant_change;
}
}
if(level){
prev_level= level + 64;
if(prev_level&(~127))
prev_level= 0;
prev_run= run;
run=0;
}else{
run++;
}
}
#ifdef REFINE_STATS
STOP_TIMER("iterative step")}
#endif
if(best_change){
int j= perm_scantable[ best_coeff ];
block[j] += best_change;
if(best_coeff > last_non_zero){
last_non_zero= best_coeff;
assert(block[j]);
#ifdef REFINE_STATS
after_last++;
#endif
}else{
#ifdef REFINE_STATS
if(block[j]){
if(block[j] - best_change){
if(FFABS(block[j]) > FFABS(block[j] - best_change)){
raise++;
}else{
lower++;
}
}else{
from_zero++;
}
}else{
to_zero++;
}
#endif
for(; last_non_zero>=start_i; last_non_zero--){
if(block[perm_scantable[last_non_zero]])
break;
}
}
#ifdef REFINE_STATS
count++;
if(256*256*256*64 % count == 0){
printf("after_last:%d to_zero:%d from_zero:%d raise:%d lower:%d sign:%d xyp:%d/%d/%d\n", after_last, to_zero, from_zero, raise, lower, messed_sign, s->mb_x, s->mb_y, s->picture_number);
}
#endif
run=0;
rle_index=0;
for(i=start_i; i<=last_non_zero; i++){
int j= perm_scantable[i];
const int level= block[j];
if(level){
run_tab[rle_index++]=run;
run=0;
}else{
run++;
}
}
s->dsp.add_8x8basis(rem, basis[j], best_unquant_change);
}else{
break;
}
}
#ifdef REFINE_STATS
if(last_non_zero>0){
STOP_TIMER("iterative search")
}
}
#endif
return last_non_zero;
}
libavcodec/mpegvideo_enc.c:3508: error: Uninitialized Value
The value read from d1[_] was never initialized.
libavcodec/mpegvideo_enc.c:3508:29:
3506.
3507. if(analyze_gradient){
3508. int g= d1[ scantable[i] ];
^
3509. if(g && (g^new_level) >= 0)
3510. continue;
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo_enc.c/#L3508 |
d2a_code_trace_data_41530 | static void unpack_input(const unsigned char *input, unsigned int *output)
{
unsigned int outbuffer[28];
unsigned short inbuffer[10];
unsigned int x;
unsigned int *ptr;
for (x=0;x<20;x+=2)
inbuffer[x/2]=(input[x]<<8)+input[x+1];
ptr=outbuffer;
*(ptr++)=27;
*(ptr++)=(inbuffer[0]>>10)&0x3f;
*(ptr++)=(inbuffer[0]>>5)&0x1f;
*(ptr++)=inbuffer[0]&0x1f;
*(ptr++)=(inbuffer[1]>>12)&0xf;
*(ptr++)=(inbuffer[1]>>8)&0xf;
*(ptr++)=(inbuffer[1]>>5)&7;
*(ptr++)=(inbuffer[1]>>2)&7;
*(ptr++)=((inbuffer[1]<<1)&6)|((inbuffer[2]>>15)&1);
*(ptr++)=(inbuffer[2]>>12)&7;
*(ptr++)=(inbuffer[2]>>10)&3;
*(ptr++)=(inbuffer[2]>>5)&0x1f;
*(ptr++)=((inbuffer[2]<<2)&0x7c)|((inbuffer[3]>>14)&3);
*(ptr++)=(inbuffer[3]>>6)&0xff;
*(ptr++)=((inbuffer[3]<<1)&0x7e)|((inbuffer[4]>>15)&1);
*(ptr++)=(inbuffer[4]>>8)&0x7f;
*(ptr++)=(inbuffer[4]>>1)&0x7f;
*(ptr++)=((inbuffer[4]<<7)&0x80)|((inbuffer[5]>>9)&0x7f);
*(ptr++)=(inbuffer[5]>>2)&0x7f;
*(ptr++)=((inbuffer[5]<<5)&0x60)|((inbuffer[6]>>11)&0x1f);
*(ptr++)=(inbuffer[6]>>4)&0x7f;
*(ptr++)=((inbuffer[6]<<4)&0xf0)|((inbuffer[7]>>12)&0xf);
*(ptr++)=(inbuffer[7]>>5)&0x7f;
*(ptr++)=((inbuffer[7]<<2)&0x7c)|((inbuffer[8]>>14)&3);
*(ptr++)=(inbuffer[8]>>7)&0x7f;
*(ptr++)=((inbuffer[8]<<1)&0xfe)|((inbuffer[9]>>15)&1);
*(ptr++)=(inbuffer[9]>>8)&0x7f;
*(ptr++)=(inbuffer[9]>>1)&0x7f;
*(output++)=outbuffer[11];
for (x=1;x<11;*(output++)=outbuffer[x++]);
ptr=outbuffer+12;
for (x=0;x<16;x+=4)
{
*(output++)=ptr[x];
*(output++)=ptr[x+2];
*(output++)=ptr[x+3];
*(output++)=ptr[x+1];
}
}
libavcodec/ra144.c:284: error: Uninitialized Value
The value read from inbuffer[_] was never initialized.
libavcodec/ra144.c:284:3:
282. *(ptr++)=(inbuffer[4]>>8)&0x7f;
283. *(ptr++)=(inbuffer[4]>>1)&0x7f;
284. *(ptr++)=((inbuffer[4]<<7)&0x80)|((inbuffer[5]>>9)&0x7f);
^
285. *(ptr++)=(inbuffer[5]>>2)&0x7f;
286. *(ptr++)=((inbuffer[5]<<5)&0x60)|((inbuffer[6]>>11)&0x1f);
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ra144.c/#L284 |
d2a_code_trace_data_41531 | static int mem_init(BIO *bi, unsigned long flags)
{
BIO_BUF_MEM *bb = OPENSSL_zalloc(sizeof(*bb));
if (bb == NULL)
return(0);
if ((bb->buf = BUF_MEM_new_ex(flags)) == NULL)
return(0);
if ((bb->readp = OPENSSL_zalloc(sizeof(*bb->readp))) == NULL)
return(0);
*bb->readp = *bb->buf;
bi->shutdown = 1;
bi->init = 1;
bi->num = -1;
bi->ptr = (char *)bb;
return(1);
}
crypto/bio/bss_mem.c:157: error: MEMORY_LEAK
memory dynamically allocated to `return` by call to `CRYPTO_zalloc()` at line 150, column 23 is not reachable after line 157, column 9.
Showing all 34 steps of the trace
crypto/bio/bss_mem.c:148:1: start of procedure mem_init()
146. }
147.
148. > static int mem_init(BIO *bi, unsigned long flags)
149. {
150. BIO_BUF_MEM *bb = OPENSSL_zalloc(sizeof(*bb));
crypto/bio/bss_mem.c:150:5:
148. static int mem_init(BIO *bi, unsigned long flags)
149. {
150. > BIO_BUF_MEM *bb = OPENSSL_zalloc(sizeof(*bb));
151.
152. if (bb == NULL)
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/bio/bss_mem.c:152:9: Taking false branch
150. BIO_BUF_MEM *bb = OPENSSL_zalloc(sizeof(*bb));
151.
152. if (bb == NULL)
^
153. return(0);
154. if ((bb->buf = BUF_MEM_new_ex(flags)) == NULL)
crypto/bio/bss_mem.c:154:9: Taking false branch
152. if (bb == NULL)
153. return(0);
154. if ((bb->buf = BUF_MEM_new_ex(flags)) == NULL)
^
155. return(0);
156. if ((bb->readp = OPENSSL_zalloc(sizeof(*bb->readp))) == NULL)
crypto/bio/bss_mem.c:156:9:
154. if ((bb->buf = BUF_MEM_new_ex(flags)) == NULL)
155. return(0);
156. > if ((bb->readp = OPENSSL_zalloc(sizeof(*bb->readp))) == NULL)
157. return(0);
158. *bb->readp = *bb->buf;
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 true 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:123:32: Taking true 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:124:9: Skipping __function_pointer__(): unresolved function pointer
122.
123. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
124. return malloc_impl(num, file, line);
^
125.
126. if (num <= 0)
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 false 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: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/bio/bss_mem.c:156:9: Taking true branch
154. if ((bb->buf = BUF_MEM_new_ex(flags)) == NULL)
155. return(0);
156. if ((bb->readp = OPENSSL_zalloc(sizeof(*bb->readp))) == NULL)
^
157. return(0);
158. *bb->readp = *bb->buf;
crypto/bio/bss_mem.c:157:9:
155. return(0);
156. if ((bb->readp = OPENSSL_zalloc(sizeof(*bb->readp))) == NULL)
157. > return(0);
158. *bb->readp = *bb->buf;
159. bi->shutdown = 1;
| https://github.com/openssl/openssl/blob/cb2ceb18f242bbc573c0e332f34b9ca42fc5f561/crypto/bio/bss_mem.c/#L157 |
d2a_code_trace_data_41532 | void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
{
int i, j, max;
const BN_ULONG *ap;
BN_ULONG *rp;
max = n * 2;
ap = a;
rp = r;
rp[0] = rp[max - 1] = 0;
rp++;
j = n;
if (--j > 0) {
ap++;
rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
rp += 2;
}
for (i = n - 2; i > 0; i--) {
j--;
ap++;
rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]);
rp += 2;
}
bn_add_words(r, r, r, max);
bn_sqr_words(tmp, a, n);
bn_add_words(r, r, tmp, max);
}
test/srptest.c:177: error: BUFFER_OVERRUN_L3
Offset: [31, +oo] Size: [0, 8388607] by call to `SRP_create_verifier_BN`.
Showing all 23 steps of the trace
test/srptest.c:177:10: Call
175. BN_hex2bn(&s, "BEB25379D1A8581EB5A727673A2441EE");
176. /* Set up server's password entry */
177. if (!TEST_true(SRP_create_verifier_BN("alice", "password123", &s, &v, GN->N,
^
178. GN->g)))
179. goto err;
crypto/srp/srp_vfy.c:633:1: Parameter `g->top`
631. * BIGNUMS.
632. */
633. > int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,
634. BIGNUM **verifier, const BIGNUM *N,
635. const BIGNUM *g)
crypto/srp/srp_vfy.c:664:10: Call
662. goto err;
663.
664. if (!BN_mod_exp(*verifier, g, x, N, bn_ctx)) {
^
665. BN_clear_free(*verifier);
666. goto err;
crypto/bn/bn_exp.c:91:1: Parameter `a->top`
89. }
90.
91. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
92. BN_CTX *ctx)
93. {
crypto/bn/bn_exp.c:144:19: Call
142. } else
143. # endif
144. ret = BN_mod_exp_mont(r, a, p, m, ctx, NULL);
^
145. } else
146. #endif
crypto/bn/bn_exp.c:294:1: Parameter `a->top`
292. }
293.
294. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
295. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
296. {
crypto/bn/bn_exp.c:306:16: Call
304.
305. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) {
306. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);
^
307. }
308.
crypto/bn/bn_exp.c:594:1: Parameter `a->top`
592. * http://www.daemonology.net/hyperthreading-considered-harmful/)
593. */
594. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
595. const BIGNUM *m, BN_CTX *ctx,
596. BN_MONT_CTX *in_mont)
crypto/bn/bn_exp.c:751:17: Call
749. if (!BN_to_montgomery(&am, &am, mont, ctx))
750. goto err;
751. } else if (!BN_to_montgomery(&am, a, mont, ctx))
^
752. goto err;
753.
crypto/bn/bn_lib.c:877:1: Parameter `a->top`
875. }
876.
877. > int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont,
878. BN_CTX *ctx)
879. {
crypto/bn/bn_lib.c:880:12: Call
878. BN_CTX *ctx)
879. {
880. return BN_mod_mul_montgomery(r, a, &(mont->RR), mont, ctx);
^
881. }
882.
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:111:5: Assignment
109. BN_ULONG *rp;
110.
111. max = n * 2;
^
112. ap = a;
113. rp = r;
crypto/bn/bn_sqr.c:105:1: <Length trace>
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:105:1: Parameter `*r`
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:113:5: Assignment
111. max = n * 2;
112. ap = a;
113. rp = r;
^
114. rp[0] = rp[max - 1] = 0;
115. rp++;
crypto/bn/bn_sqr.c:114:13: Array access: Offset: [31, +oo] Size: [0, 8388607] by call to `SRP_create_verifier_BN`
112. ap = a;
113. rp = r;
114. rp[0] = rp[max - 1] = 0;
^
115. rp++;
116. j = n;
| https://github.com/openssl/openssl/blob/b66411f6cda6970c01283ddde6d8063c57b3b7d9/crypto/bn/bn_sqr.c/#L114 |
d2a_code_trace_data_41533 | static int split_field_copy(Picture *dest, Picture *src, int parity, int id_add)
{
int match = !!(src->reference & parity);
if (match) {
COPY_PICTURE(dest, src);
if (parity != PICT_FRAME) {
pic_as_field(dest, parity);
dest->pic_id *= 2;
dest->pic_id += id_add;
}
}
return match;
}
libavcodec/h264_refs.c:135: error: Buffer Overrun L2
Offset: [0, 32] Size: 2 by call to `build_def_list`.
libavcodec/h264_refs.c:116:1: Parameter `h->default_ref_list[*]`
114. }
115.
116. int ff_h264_fill_default_ref_list(H264Context *h)
^
117. {
118. int i, len;
libavcodec/h264_refs.c:135:20: Call
133. assert(len <= 32);
134.
135. len = build_def_list(h->default_ref_list[list], FF_ARRAY_ELEMS(h->default_ref_list[0]),
^
136. sorted, len, 0, h->picture_structure);
137. len += build_def_list(h->default_ref_list[list] + len,
libavcodec/h264_refs.c:70:1: Parameter `def_len`
68. }
69.
70. static int build_def_list(Picture *def, int def_len,
^
71. Picture **in, int len, int is_long, int sel)
72. {
libavcodec/h264_refs.c:83:13: Call
81. if (i[0] < len && index < def_len) {
82. in[i[0]]->pic_id = is_long ? i[0] : in[i[0]]->frame_num;
83. split_field_copy(&def[index++], in[i[0]++], sel, 1);
^
84. }
85. if (i[1] < len && index < def_len) {
libavcodec/h264_refs.c:54:1: <Length trace>
52. }
53.
54. static int split_field_copy(Picture *dest, Picture *src, int parity, int id_add)
^
55. {
56. int match = !!(src->reference & parity);
libavcodec/h264_refs.c:54:1: Parameter `*dest`
52. }
53.
54. static int split_field_copy(Picture *dest, Picture *src, int parity, int id_add)
^
55. {
56. int match = !!(src->reference & parity);
libavcodec/h264_refs.c:59:9: Array access: Offset: [0, 32] Size: 2 by call to `build_def_list`
57.
58. if (match) {
59. COPY_PICTURE(dest, src);
^
60. if (parity != PICT_FRAME) {
61. pic_as_field(dest, parity);
| https://github.com/libav/libav/blob/0673ede985a6560e7efb86dab1c58fb7f95ce587/libavcodec/h264_refs.c/#L59 |
d2a_code_trace_data_41534 | void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
{
unsigned long hash;
OPENSSL_LH_NODE *nn, **rn;
void *ret;
lh->error = 0;
rn = getrn(lh, data, &hash);
if (*rn == NULL) {
lh->num_no_delete++;
return (NULL);
} else {
nn = *rn;
*rn = nn->next;
ret = nn->data;
OPENSSL_free(nn);
lh->num_delete++;
}
lh->num_items--;
if ((lh->num_nodes > MIN_NODES) &&
(lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
contract(lh);
return (ret);
}
apps/s_client.c:2420: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned64 by call to `SSL_free`.
Showing all 16 steps of the trace
apps/s_client.c:1644:11: Call
1642. }
1643.
1644. con = SSL_new(ctx);
^
1645. if (sess_in) {
1646. SSL_SESSION *sess;
ssl/ssl_lib.c:518:1: Parameter `ctx->sessions->num_items`
516. }
517.
518. > SSL *SSL_new(SSL_CTX *ctx)
519. {
520. SSL *s;
apps/s_client.c:2420:9: Call
2418. if (prexit != 0)
2419. print_stuff(bio_c_out, con, 1);
2420. SSL_free(con);
^
2421. }
2422. #if !defined(OPENSSL_NO_NEXTPROTONEG)
ssl/ssl_lib.c:926:1: Parameter `s->initial_ctx->sessions->num_items`
924. }
925.
926. > void SSL_free(SSL *s)
927. {
928. int i;
ssl/ssl_lib.c:963:9: Call
961. /* Make the next call work :-) */
962. if (s->session != NULL) {
963. ssl_clear_bad_session(s);
^
964. SSL_SESSION_free(s->session);
965. }
ssl/ssl_sess.c:992:1: Parameter `s->initial_ctx->sessions->num_items`
990. }
991.
992. > int ssl_clear_bad_session(SSL *s)
993. {
994. if ((s->session != NULL) &&
ssl/ssl_sess.c:997:9: Call
995. !(s->shutdown & SSL_SENT_SHUTDOWN) &&
996. !(SSL_in_init(s) || SSL_in_before(s))) {
997. SSL_CTX_remove_session(s->session_ctx, s->session);
^
998. return (1);
999. } else
ssl/ssl_sess.c:691:1: Parameter `ctx->sessions->num_items`
689. }
690.
691. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
692. {
693. return remove_session_lock(ctx, c, 1);
ssl/ssl_sess.c:693:12: Call
691. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
692. {
693. return remove_session_lock(ctx, c, 1);
^
694. }
695.
ssl/ssl_sess.c:696:1: Parameter `ctx->sessions->num_items`
694. }
695.
696. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
697. {
698. SSL_SESSION *r;
ssl/ssl_sess.c:706:17: Call
704. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) {
705. ret = 1;
706. r = lh_SSL_SESSION_delete(ctx->sessions, c);
^
707. SSL_SESSION_list_remove(ctx, c);
708. }
ssl/ssl_locl.h:581:1: Parameter `lh->num_items`
579. };
580.
581. > DEFINE_LHASH_OF(SSL_SESSION);
582. /* Needed in ssl_cert.c */
583. DEFINE_LHASH_OF(X509_NAME);
ssl/ssl_locl.h:581:1: Call
579. };
580.
581. > DEFINE_LHASH_OF(SSL_SESSION);
582. /* Needed in ssl_cert.c */
583. DEFINE_LHASH_OF(X509_NAME);
crypto/lhash/lhash.c:103:1: <LHS trace>
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:103:1: Parameter `lh->num_items`
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:123:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `SSL_free`
121. }
122.
123. lh->num_items--;
^
124. if ((lh->num_nodes > MIN_NODES) &&
125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
| https://github.com/openssl/openssl/blob/2a7de0fd5d9baf946ef4d2c51096b04dd47a8143/crypto/lhash/lhash.c/#L123 |
d2a_code_trace_data_41535 | static int vorbis_parse_audio_packet(vorbis_context *vc) {
GetBitContext *gb=&vc->gb;
uint_fast8_t previous_window=0,next_window=0;
uint_fast8_t mode_number;
uint_fast16_t blocksize;
int_fast32_t i,j;
uint_fast8_t no_residue[vc->audio_channels];
uint_fast8_t do_not_decode[vc->audio_channels];
vorbis_mapping *mapping;
float *ch_res_ptr=vc->channel_residues;
float *ch_floor_ptr=vc->channel_floors;
uint_fast8_t res_chan[vc->audio_channels];
uint_fast8_t res_num=0;
int_fast16_t retlen=0;
uint_fast16_t saved_start=0;
float fadd_bias = vc->add_bias;
if (get_bits1(gb)) {
av_log(vc->avccontext, AV_LOG_ERROR, "Not a Vorbis I audio packet.\n");
return -1;
}
if (vc->mode_count==1) {
mode_number=0;
} else {
mode_number=get_bits(gb, ilog(vc->mode_count-1));
}
vc->mode_number=mode_number;
mapping=&vc->mappings[vc->modes[mode_number].mapping];
AV_DEBUG(" Mode number: %d , mapping: %d , blocktype %d \n", mode_number, vc->modes[mode_number].mapping, vc->modes[mode_number].blockflag);
if (vc->modes[mode_number].blockflag) {
previous_window=get_bits1(gb);
next_window=get_bits1(gb);
}
blocksize=vc->blocksize[vc->modes[mode_number].blockflag];
memset(ch_res_ptr, 0, sizeof(float)*vc->audio_channels*blocksize/2);
memset(ch_floor_ptr, 0, sizeof(float)*vc->audio_channels*blocksize/2);
for(i=0;i<vc->audio_channels;++i) {
vorbis_floor *floor;
if (mapping->submaps>1) {
floor=&vc->floors[mapping->submap_floor[mapping->mux[i]]];
} else {
floor=&vc->floors[mapping->submap_floor[0]];
}
no_residue[i]=floor->decode(vc, &floor->data, ch_floor_ptr);
ch_floor_ptr+=blocksize/2;
}
for(i=mapping->coupling_steps-1;i>=0;--i) {
if (!(no_residue[mapping->magnitude[i]] & no_residue[mapping->angle[i]])) {
no_residue[mapping->magnitude[i]]=0;
no_residue[mapping->angle[i]]=0;
}
}
for(i=0;i<mapping->submaps;++i) {
vorbis_residue *residue;
uint_fast8_t ch=0;
for(j=0;j<vc->audio_channels;++j) {
if ((mapping->submaps==1) || (i=mapping->mux[j])) {
res_chan[j]=res_num;
if (no_residue[j]) {
do_not_decode[ch]=1;
} else {
do_not_decode[ch]=0;
}
++ch;
++res_num;
}
}
residue=&vc->residues[mapping->submap_residue[i]];
vorbis_residue_decode(vc, residue, ch, do_not_decode, ch_res_ptr, blocksize/2);
ch_res_ptr+=ch*blocksize/2;
}
for(i=mapping->coupling_steps-1;i>=0;--i) {
float *mag, *ang;
mag=vc->channel_residues+res_chan[mapping->magnitude[i]]*blocksize/2;
ang=vc->channel_residues+res_chan[mapping->angle[i]]*blocksize/2;
vc->dsp.vorbis_inverse_coupling(mag, ang, blocksize/2);
}
for(j=0, ch_floor_ptr=vc->channel_floors;j<vc->audio_channels;++j,ch_floor_ptr+=blocksize/2) {
ch_res_ptr=vc->channel_residues+res_chan[j]*blocksize/2;
vc->dsp.vector_fmul(ch_floor_ptr, ch_res_ptr, blocksize/2);
}
for(j=0;j<vc->audio_channels;++j) {
uint_fast8_t step=vc->audio_channels;
uint_fast16_t k;
float *saved=vc->saved+j*vc->blocksize[1]/2;
float *ret=vc->ret;
const float *lwin=vc->win[1];
const float *swin=vc->win[0];
float *buf=vc->buf;
float *buf_tmp=vc->buf_tmp;
ch_floor_ptr=vc->channel_floors+j*blocksize/2;
saved_start=vc->saved_start;
vc->mdct[0].fft.imdct_calc(&vc->mdct[vc->modes[mode_number].blockflag], buf, ch_floor_ptr, buf_tmp);
if (vc->modes[mode_number].blockflag) {
if (previous_window) {
vc->dsp.vector_fmul_add_add(ret+j, buf, lwin, saved, vc->add_bias, vc->blocksize[1]/2, step);
retlen=vc->blocksize[1]/2;
} else {
int len = (vc->blocksize[1]-vc->blocksize[0])/4;
buf += len;
vc->dsp.vector_fmul_add_add(ret+j, buf, swin, saved, vc->add_bias, vc->blocksize[0]/2, step);
k = vc->blocksize[0]/2*step + j;
buf += vc->blocksize[0]/2;
if(vc->exp_bias){
for(i=0; i<len; i++, k+=step)
((uint32_t*)ret)[k] = ((uint32_t*)buf)[i] + vc->exp_bias;
} else {
for(i=0; i<len; i++, k+=step)
ret[k] = buf[i] + fadd_bias;
}
buf=vc->buf;
retlen=vc->blocksize[0]/2+len;
}
if (next_window) {
buf += vc->blocksize[1]/2;
vc->dsp.vector_fmul_reverse(saved, buf, lwin, vc->blocksize[1]/2);
saved_start=0;
} else {
saved_start=(vc->blocksize[1]-vc->blocksize[0])/4;
buf += vc->blocksize[1]/2;
for(i=0; i<saved_start; i++)
((uint32_t*)saved)[i] = ((uint32_t*)buf)[i] + vc->exp_bias;
vc->dsp.vector_fmul_reverse(saved+saved_start, buf+saved_start, swin, vc->blocksize[0]/2);
}
} else {
if(vc->add_bias) {
for(k=j, i=0;i<saved_start;++i, k+=step)
ret[k] = saved[i] + fadd_bias;
} else {
for(k=j, i=0;i<saved_start;++i, k+=step)
ret[k] = saved[i];
}
vc->dsp.vector_fmul_add_add(ret+k, buf, swin, saved+saved_start, vc->add_bias, vc->blocksize[0]/2, step);
retlen=saved_start+vc->blocksize[0]/2;
buf += vc->blocksize[0]/2;
vc->dsp.vector_fmul_reverse(saved, buf, swin, vc->blocksize[0]/2);
saved_start=0;
}
}
vc->saved_start=saved_start;
return retlen*vc->audio_channels;
}
libavcodec/vorbis_dec.c:1457: error: Uninitialized Value
The value read from no_residue[_] was never initialized.
libavcodec/vorbis_dec.c:1457:15:
1455.
1456. for(i=mapping->coupling_steps-1;i>=0;--i) {
1457. if (!(no_residue[mapping->magnitude[i]] & no_residue[mapping->angle[i]])) {
^
1458. no_residue[mapping->magnitude[i]]=0;
1459. no_residue[mapping->angle[i]]=0;
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vorbis_dec.c/#L1457 |
d2a_code_trace_data_41536 | SSL *SSL_new(SSL_CTX *ctx)
{
SSL *s;
if (ctx == NULL) {
SSLerr(SSL_F_SSL_NEW, SSL_R_NULL_SSL_CTX);
return NULL;
}
if (ctx->method == NULL) {
SSLerr(SSL_F_SSL_NEW, SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION);
return NULL;
}
s = OPENSSL_zalloc(sizeof(*s));
if (s == NULL)
goto err;
s->references = 1;
s->lock = CRYPTO_THREAD_lock_new();
if (s->lock == NULL) {
OPENSSL_free(s);
s = NULL;
goto err;
}
if (RAND_get_rand_method() == RAND_OpenSSL()) {
s->drbg =
RAND_DRBG_new(RAND_DRBG_NID, RAND_DRBG_FLAG_CTR_USE_DF,
RAND_DRBG_get0_global());
if (s->drbg == NULL
|| RAND_DRBG_instantiate(s->drbg,
(const unsigned char *) SSL_version_str,
sizeof(SSL_version_str) - 1) == 0)
goto err;
}
RECORD_LAYER_init(&s->rlayer, s);
s->options = ctx->options;
s->dane.flags = ctx->dane.flags;
s->min_proto_version = ctx->min_proto_version;
s->max_proto_version = ctx->max_proto_version;
s->mode = ctx->mode;
s->max_cert_list = ctx->max_cert_list;
s->max_early_data = ctx->max_early_data;
s->cert = ssl_cert_dup(ctx->cert);
if (s->cert == NULL)
goto err;
RECORD_LAYER_set_read_ahead(&s->rlayer, ctx->read_ahead);
s->msg_callback = ctx->msg_callback;
s->msg_callback_arg = ctx->msg_callback_arg;
s->verify_mode = ctx->verify_mode;
s->not_resumable_session_cb = ctx->not_resumable_session_cb;
s->record_padding_cb = ctx->record_padding_cb;
s->record_padding_arg = ctx->record_padding_arg;
s->block_padding = ctx->block_padding;
s->sid_ctx_length = ctx->sid_ctx_length;
if (!ossl_assert(s->sid_ctx_length <= sizeof(s->sid_ctx)))
goto err;
memcpy(&s->sid_ctx, &ctx->sid_ctx, sizeof(s->sid_ctx));
s->verify_callback = ctx->default_verify_callback;
s->generate_session_id = ctx->generate_session_id;
s->param = X509_VERIFY_PARAM_new();
if (s->param == NULL)
goto err;
X509_VERIFY_PARAM_inherit(s->param, ctx->param);
s->quiet_shutdown = ctx->quiet_shutdown;
s->ext.max_fragment_len_mode = ctx->ext.max_fragment_len_mode;
s->max_send_fragment = ctx->max_send_fragment;
s->split_send_fragment = ctx->split_send_fragment;
s->max_pipelines = ctx->max_pipelines;
if (s->max_pipelines > 1)
RECORD_LAYER_set_read_ahead(&s->rlayer, 1);
if (ctx->default_read_buf_len > 0)
SSL_set_default_read_buffer_len(s, ctx->default_read_buf_len);
SSL_CTX_up_ref(ctx);
s->ctx = ctx;
s->ext.debug_cb = 0;
s->ext.debug_arg = NULL;
s->ext.ticket_expected = 0;
s->ext.status_type = ctx->ext.status_type;
s->ext.status_expected = 0;
s->ext.ocsp.ids = NULL;
s->ext.ocsp.exts = NULL;
s->ext.ocsp.resp = NULL;
s->ext.ocsp.resp_len = 0;
SSL_CTX_up_ref(ctx);
s->session_ctx = ctx;
#ifndef OPENSSL_NO_EC
if (ctx->ext.ecpointformats) {
s->ext.ecpointformats =
OPENSSL_memdup(ctx->ext.ecpointformats,
ctx->ext.ecpointformats_len);
if (!s->ext.ecpointformats)
goto err;
s->ext.ecpointformats_len =
ctx->ext.ecpointformats_len;
}
if (ctx->ext.supportedgroups) {
s->ext.supportedgroups =
OPENSSL_memdup(ctx->ext.supportedgroups,
ctx->ext.supportedgroups_len
* sizeof(*ctx->ext.supportedgroups));
if (!s->ext.supportedgroups)
goto err;
s->ext.supportedgroups_len = ctx->ext.supportedgroups_len;
}
#endif
#ifndef OPENSSL_NO_NEXTPROTONEG
s->ext.npn = NULL;
#endif
if (s->ctx->ext.alpn) {
s->ext.alpn = OPENSSL_malloc(s->ctx->ext.alpn_len);
if (s->ext.alpn == NULL)
goto err;
memcpy(s->ext.alpn, s->ctx->ext.alpn, s->ctx->ext.alpn_len);
s->ext.alpn_len = s->ctx->ext.alpn_len;
}
s->verified_chain = NULL;
s->verify_result = X509_V_OK;
s->default_passwd_callback = ctx->default_passwd_callback;
s->default_passwd_callback_userdata = ctx->default_passwd_callback_userdata;
s->method = ctx->method;
s->key_update = SSL_KEY_UPDATE_NONE;
if (!s->method->ssl_new(s))
goto err;
s->server = (ctx->method->ssl_accept == ssl_undefined_function) ? 0 : 1;
if (!SSL_clear(s))
goto err;
if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL, s, &s->ex_data))
goto err;
#ifndef OPENSSL_NO_PSK
s->psk_client_callback = ctx->psk_client_callback;
s->psk_server_callback = ctx->psk_server_callback;
#endif
s->psk_find_session_cb = ctx->psk_find_session_cb;
s->psk_use_session_cb = ctx->psk_use_session_cb;
s->job = NULL;
#ifndef OPENSSL_NO_CT
if (!SSL_set_ct_validation_callback(s, ctx->ct_validation_callback,
ctx->ct_validation_callback_arg))
goto err;
#endif
return s;
err:
SSL_free(s);
SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE);
return NULL;
}
ssl/ssl_lib.c:702: error: MEMORY_LEAK
memory dynamically allocated by call to `CRYPTO_THREAD_lock_new()` at line 680, column 15 is not reachable after line 702, column 5.
Showing all 63 steps of the trace
ssl/ssl_lib.c:662:1: start of procedure SSL_new()
660. }
661.
662. > SSL *SSL_new(SSL_CTX *ctx)
663. {
664. SSL *s;
ssl/ssl_lib.c:666:9: Taking false branch
664. SSL *s;
665.
666. if (ctx == NULL) {
^
667. SSLerr(SSL_F_SSL_NEW, SSL_R_NULL_SSL_CTX);
668. return NULL;
ssl/ssl_lib.c:670:9: Taking false branch
668. return NULL;
669. }
670. if (ctx->method == NULL) {
^
671. SSLerr(SSL_F_SSL_NEW, SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION);
672. return NULL;
ssl/ssl_lib.c:675:5:
673. }
674.
675. > s = OPENSSL_zalloc(sizeof(*s));
676. if (s == NULL)
677. goto err;
crypto/mem.c:218:1: start of procedure CRYPTO_zalloc()
216. }
217.
218. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
219. {
220. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:220:5:
218. void *CRYPTO_zalloc(size_t num, const char *file, int line)
219. {
220. > void *ret = CRYPTO_malloc(num, file, line);
221.
222. FAILTEST();
crypto/mem.c:189:1: start of procedure CRYPTO_malloc()
187. #endif
188.
189. > void *CRYPTO_malloc(size_t num, const char *file, int line)
190. {
191. void *ret = NULL;
crypto/mem.c:191:5:
189. void *CRYPTO_malloc(size_t num, const char *file, int line)
190. {
191. > void *ret = NULL;
192.
193. INCREMENT(malloc_count);
crypto/mem.c:194:9: Taking false branch
192.
193. INCREMENT(malloc_count);
194. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
195. return malloc_impl(num, file, line);
196.
crypto/mem.c:197:9: Taking false branch
195. return malloc_impl(num, file, line);
196.
197. if (num == 0)
^
198. return NULL;
199.
crypto/mem.c:201:5:
199.
200. FAILTEST();
201. > allow_customize = 0;
202. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
203. if (call_malloc_debug) {
crypto/mem.c:211:5:
209. }
210. #else
211. > (void)(file); (void)(line);
212. ret = malloc(num);
213. #endif
crypto/mem.c:211:19:
209. }
210. #else
211. > (void)(file); (void)(line);
212. ret = malloc(num);
213. #endif
crypto/mem.c:212:5:
210. #else
211. (void)(file); (void)(line);
212. > ret = malloc(num);
213. #endif
214.
crypto/mem.c:215:5:
213. #endif
214.
215. > return ret;
216. }
217.
crypto/mem.c:216:1: return from a call to CRYPTO_malloc
214.
215. return ret;
216. > }
217.
218. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:223:9: Taking true branch
221.
222. FAILTEST();
223. if (ret != NULL)
^
224. memset(ret, 0, num);
225. return ret;
crypto/mem.c:224:9:
222. FAILTEST();
223. if (ret != NULL)
224. > memset(ret, 0, num);
225. return ret;
226. }
crypto/mem.c:225:5:
223. if (ret != NULL)
224. memset(ret, 0, num);
225. > return ret;
226. }
227.
crypto/mem.c:226:1: return from a call to CRYPTO_zalloc
224. memset(ret, 0, num);
225. return ret;
226. > }
227.
228. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
ssl/ssl_lib.c:676:9: Taking false branch
674.
675. s = OPENSSL_zalloc(sizeof(*s));
676. if (s == NULL)
^
677. goto err;
678.
ssl/ssl_lib.c:679:5:
677. goto err;
678.
679. > s->references = 1;
680. s->lock = CRYPTO_THREAD_lock_new();
681. if (s->lock == NULL) {
ssl/ssl_lib.c:680:5:
678.
679. s->references = 1;
680. > s->lock = CRYPTO_THREAD_lock_new();
681. if (s->lock == NULL) {
682. OPENSSL_free(s);
crypto/threads_pthread.c:19:1: start of procedure CRYPTO_THREAD_lock_new()
17. # endif
18.
19. > CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void)
20. {
21. # ifdef USE_RWLOCK
crypto/threads_pthread.c:22:5:
20. {
21. # ifdef USE_RWLOCK
22. > CRYPTO_RWLOCK *lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t));
23. if (lock == NULL)
24. return NULL;
crypto/mem.c:218:1: start of procedure CRYPTO_zalloc()
216. }
217.
218. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
219. {
220. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:220:5:
218. void *CRYPTO_zalloc(size_t num, const char *file, int line)
219. {
220. > void *ret = CRYPTO_malloc(num, file, line);
221.
222. FAILTEST();
crypto/mem.c:189:1: start of procedure CRYPTO_malloc()
187. #endif
188.
189. > void *CRYPTO_malloc(size_t num, const char *file, int line)
190. {
191. void *ret = NULL;
crypto/mem.c:191:5:
189. void *CRYPTO_malloc(size_t num, const char *file, int line)
190. {
191. > void *ret = NULL;
192.
193. INCREMENT(malloc_count);
crypto/mem.c:194:9: Taking false branch
192.
193. INCREMENT(malloc_count);
194. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
195. return malloc_impl(num, file, line);
196.
crypto/mem.c:197:9: Taking false branch
195. return malloc_impl(num, file, line);
196.
197. if (num == 0)
^
198. return NULL;
199.
crypto/mem.c:201:5:
199.
200. FAILTEST();
201. > allow_customize = 0;
202. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
203. if (call_malloc_debug) {
crypto/mem.c:211:5:
209. }
210. #else
211. > (void)(file); (void)(line);
212. ret = malloc(num);
213. #endif
crypto/mem.c:211:19:
209. }
210. #else
211. > (void)(file); (void)(line);
212. ret = malloc(num);
213. #endif
crypto/mem.c:212:5:
210. #else
211. (void)(file); (void)(line);
212. > ret = malloc(num);
213. #endif
214.
crypto/mem.c:215:5:
213. #endif
214.
215. > return ret;
216. }
217.
crypto/mem.c:216:1: return from a call to CRYPTO_malloc
214.
215. return ret;
216. > }
217.
218. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:223:9: Taking true branch
221.
222. FAILTEST();
223. if (ret != NULL)
^
224. memset(ret, 0, num);
225. return ret;
crypto/mem.c:224:9:
222. FAILTEST();
223. if (ret != NULL)
224. > memset(ret, 0, num);
225. return ret;
226. }
crypto/mem.c:225:5:
223. if (ret != NULL)
224. memset(ret, 0, num);
225. > return ret;
226. }
227.
crypto/mem.c:226:1: return from a call to CRYPTO_zalloc
224. memset(ret, 0, num);
225. return ret;
226. > }
227.
228. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/threads_pthread.c:23:9: Taking false branch
21. # ifdef USE_RWLOCK
22. CRYPTO_RWLOCK *lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t));
23. if (lock == NULL)
^
24. return NULL;
25.
crypto/threads_pthread.c:26:9: Taking false branch
24. return NULL;
25.
26. if (pthread_rwlock_init(lock, NULL) != 0) {
^
27. OPENSSL_free(lock);
28. return NULL;
crypto/threads_pthread.c:48:5:
46. # endif
47.
48. > return lock;
49. }
50.
crypto/threads_pthread.c:49:1: return from a call to CRYPTO_THREAD_lock_new
47.
48. return lock;
49. > }
50.
51. int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock)
ssl/ssl_lib.c:681:9: Taking false branch
679. s->references = 1;
680. s->lock = CRYPTO_THREAD_lock_new();
681. if (s->lock == NULL) {
^
682. OPENSSL_free(s);
683. s = NULL;
ssl/ssl_lib.c:691:9:
689. * chained DRBG.
690. */
691. > if (RAND_get_rand_method() == RAND_OpenSSL()) {
692. s->drbg =
693. RAND_DRBG_new(RAND_DRBG_NID, RAND_DRBG_FLAG_CTR_USE_DF,
crypto/rand/rand_lib.c:556:1: start of procedure RAND_get_rand_method()
554. }
555.
556. > const RAND_METHOD *RAND_get_rand_method(void)
557. {
558. const RAND_METHOD *tmp_meth = NULL;
crypto/rand/rand_lib.c:558:5:
556. const RAND_METHOD *RAND_get_rand_method(void)
557. {
558. > const RAND_METHOD *tmp_meth = NULL;
559.
560. if (!RUN_ONCE(&rand_init, do_rand_init))
crypto/rand/rand_lib.c:560:10:
558. const RAND_METHOD *tmp_meth = NULL;
559.
560. > if (!RUN_ONCE(&rand_init, do_rand_init))
561. return NULL;
562.
crypto/threads_pthread.c:105:1: start of procedure CRYPTO_THREAD_run_once()
103. }
104.
105. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
106. {
107. if (pthread_once(once, init) != 0)
crypto/threads_pthread.c:107:9: Taking true branch
105. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
106. {
107. if (pthread_once(once, init) != 0)
^
108. return 0;
109.
crypto/threads_pthread.c:108:9:
106. {
107. if (pthread_once(once, init) != 0)
108. > return 0;
109.
110. return 1;
crypto/threads_pthread.c:111:1: return from a call to CRYPTO_THREAD_run_once
109.
110. return 1;
111. > }
112.
113. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))
crypto/rand/rand_lib.c:560:10: Condition is false
558. const RAND_METHOD *tmp_meth = NULL;
559.
560. if (!RUN_ONCE(&rand_init, do_rand_init))
^
561. return NULL;
562.
crypto/rand/rand_lib.c:560:10: Taking true branch
558. const RAND_METHOD *tmp_meth = NULL;
559.
560. if (!RUN_ONCE(&rand_init, do_rand_init))
^
561. return NULL;
562.
crypto/rand/rand_lib.c:561:9:
559.
560. if (!RUN_ONCE(&rand_init, do_rand_init))
561. > return NULL;
562.
563. CRYPTO_THREAD_write_lock(rand_meth_lock);
crypto/rand/rand_lib.c:584:1: return from a call to RAND_get_rand_method
582. CRYPTO_THREAD_unlock(rand_meth_lock);
583. return tmp_meth;
584. > }
585.
586. #ifndef OPENSSL_NO_ENGINE
crypto/rand/drbg_lib.c:683:1: start of procedure RAND_OpenSSL()
681. };
682.
683. > RAND_METHOD *RAND_OpenSSL(void)
684. {
685. return &rand_meth;
crypto/rand/drbg_lib.c:685:5:
683. RAND_METHOD *RAND_OpenSSL(void)
684. {
685. > return &rand_meth;
686. }
crypto/rand/drbg_lib.c:686:1: return from a call to RAND_OpenSSL
684. {
685. return &rand_meth;
686. > }
ssl/ssl_lib.c:691:9: Taking false branch
689. * chained DRBG.
690. */
691. if (RAND_get_rand_method() == RAND_OpenSSL()) {
^
692. s->drbg =
693. RAND_DRBG_new(RAND_DRBG_NID, RAND_DRBG_FLAG_CTR_USE_DF,
ssl/ssl_lib.c:702:5: Skipping RECORD_LAYER_init(): empty list of specs
700. }
701.
702. RECORD_LAYER_init(&s->rlayer, s);
^
703.
704. s->options = ctx->options;
| https://github.com/openssl/openssl/blob/fce78bd4ede74d4fa7bd1c8195d8f7bc9403bd4c/ssl/ssl_lib.c/#L702 |
d2a_code_trace_data_41537 | static int asn1_get_length(const unsigned char **pp, int *inf, long *rl,
long max)
{
const unsigned char *p = *pp;
unsigned long ret = 0;
int i;
if (max-- < 1)
return 0;
if (*p == 0x80) {
*inf = 1;
p++;
} else {
*inf = 0;
i = *p & 0x7f;
if (*p++ & 0x80) {
if (max < i + 1)
return 0;
while (i > 0 && *p == 0) {
p++;
i--;
}
if (i > (int)sizeof(long))
return 0;
while (i > 0) {
ret <<= 8;
ret |= *p++;
i--;
}
if (ret > LONG_MAX)
return 0;
} else
ret = i;
}
*pp = p;
*rl = (long)ret;
return 1;
}
crypto/pem/pem_pkey.c:42: error: BUFFER_OVERRUN_L3
Offset: [2, +oo] Size: [1, +oo] by call to `d2i_PKCS8_PRIV_KEY_INFO`.
Showing all 27 steps of the trace
crypto/pem/pem_pkey.c:35:10: Call
33. EVP_PKEY *ret = NULL;
34.
35. if (!PEM_bytes_read_bio_secmem(&data, &len, &nm, PEM_STRING_EVP_PKEY, bp,
^
36. cb, u))
37. return NULL;
crypto/pem/pem_lib.c:282:1: Parameter `**pdata`
280. }
281.
282. > int PEM_bytes_read_bio_secmem(unsigned char **pdata, long *plen, char **pnm,
283. const char *name, BIO *bp, pem_password_cb *cb,
284. void *u) {
crypto/pem/pem_lib.c:285:12: Call
283. const char *name, BIO *bp, pem_password_cb *cb,
284. void *u) {
285. return pem_bytes_read_bio_flags(pdata, plen, pnm, name, bp, cb, u,
^
286. PEM_FLAG_SECURE | PEM_FLAG_EAY_COMPATIBLE);
287. }
crypto/pem/pem_lib.c:232:1: Parameter `**pdata`
230. }
231.
232. > static int pem_bytes_read_bio_flags(unsigned char **pdata, long *plen,
233. char **pnm, const char *name, BIO *bp,
234. pem_password_cb *cb, void *u,
crypto/pem/pem_pkey.c:38:5: Assignment
36. cb, u))
37. return NULL;
38. p = data;
^
39.
40. if (strcmp(nm, PEM_STRING_PKCS8INF) == 0) {
crypto/pem/pem_pkey.c:42:17: Call
40. if (strcmp(nm, PEM_STRING_PKCS8INF) == 0) {
41. PKCS8_PRIV_KEY_INFO *p8inf;
42. p8inf = d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, len);
^
43. if (!p8inf)
44. goto p8err;
crypto/asn1/p8_pkey.c:36:1: Parameter `**in`
34. } ASN1_SEQUENCE_END_cb(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO)
35.
36. > IMPLEMENT_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO)
37.
38. int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj,
crypto/asn1/p8_pkey.c:36:1: Call
34. } ASN1_SEQUENCE_END_cb(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO)
35.
36. > IMPLEMENT_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO)
37.
38. int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj,
crypto/asn1/tasn_dec.c:105:1: Parameter `**in`
103. */
104.
105. > ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval,
106. const unsigned char **in, long len,
107. const ASN1_ITEM *it)
crypto/asn1/tasn_dec.c:114:9: Call
112. pval = &ptmpval;
113. asn1_tlc_clear_nc(&c);
114. if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0)
^
115. return *pval;
116. return NULL;
crypto/asn1/tasn_dec.c:119:1: Parameter `**in`
117. }
118.
119. > int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
120. const ASN1_ITEM *it,
121. int tag, int aclass, char opt, ASN1_TLC *ctx)
crypto/asn1/tasn_dec.c:124:10: Call
122. {
123. int rv;
124. rv = asn1_item_embed_d2i(pval, in, len, it, tag, aclass, opt, ctx, 0);
^
125. if (rv <= 0)
126. ASN1_item_ex_free(pval, it);
crypto/asn1/tasn_dec.c:135:1: Parameter `**in`
133. */
134.
135. > static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in,
136. long len, const ASN1_ITEM *it,
137. int tag, int aclass, char opt, ASN1_TLC *ctx,
crypto/asn1/tasn_dec.c:185:9: Assignment
183.
184. case ASN1_ITYPE_MSTRING:
185. p = *in;
^
186. /* Just read in tag and class */
187. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL,
crypto/asn1/tasn_dec.c:187:15: Call
185. p = *in;
186. /* Just read in tag and class */
187. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL,
^
188. &p, len, -1, 0, 1, ctx);
189. if (!ret) {
crypto/asn1/tasn_dec.c:1078:1: Parameter `**in`
1076. */
1077.
1078. > static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass,
1079. char *inf, char *cst,
1080. const unsigned char **in, long len,
crypto/asn1/tasn_dec.c:1087:5: Assignment
1085. long plen;
1086. const unsigned char *p, *q;
1087. p = *in;
^
1088. q = p;
1089.
crypto/asn1/tasn_dec.c:1097:13: Call
1095. p += ctx->hdrlen;
1096. } else {
1097. i = ASN1_get_object(&p, &plen, &ptag, &pclass, len);
^
1098. if (ctx) {
1099. ctx->ret = i;
crypto/asn1/asn1_lib.c:44:1: Parameter `**pp`
42. }
43.
44. > int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
45. int *pclass, long omax)
46. {
crypto/asn1/asn1_lib.c:49:5: Assignment
47. int i, ret;
48. long l;
49. const unsigned char *p = *pp;
^
50. int tag, xclass, inf;
51. long max = omax;
crypto/asn1/asn1_lib.c:78:9: Assignment
76. } else {
77. tag = i;
78. p++;
^
79. if (--max == 0)
80. goto err;
crypto/asn1/asn1_lib.c:84:10: Call
82. *ptag = tag;
83. *pclass = xclass;
84. if (!asn1_get_length(&p, &inf, plength, max))
^
85. goto err;
86.
crypto/asn1/asn1_lib.c:112:1: <Length trace>
110. * are stored most significant digit first.
111. */
112. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl,
113. long max)
114. {
crypto/asn1/asn1_lib.c:112:1: Parameter `**pp`
110. * are stored most significant digit first.
111. */
112. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl,
113. long max)
114. {
crypto/asn1/asn1_lib.c:115:5: Assignment
113. long max)
114. {
115. const unsigned char *p = *pp;
^
116. unsigned long ret = 0;
117. int i;
crypto/asn1/asn1_lib.c:127:14: Assignment
125. *inf = 0;
126. i = *p & 0x7f;
127. if (*p++ & 0x80) {
^
128. if (max < i + 1)
129. return 0;
crypto/asn1/asn1_lib.c:131:29: Array access: Offset: [2, +oo] Size: [1, +oo] by call to `d2i_PKCS8_PRIV_KEY_INFO`
129. return 0;
130. /* Skip leading zeroes */
131. while (i > 0 && *p == 0) {
^
132. p++;
133. i--;
| https://github.com/openssl/openssl/blob/32c6985349ba134761f75a3f61814234d096a1df/crypto/asn1/asn1_lib.c/#L131 |
d2a_code_trace_data_41538 | char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
{
X509_NAME_ENTRY *ne;
int i;
int n, lold, l, l1, l2, num, j, type;
const char *s;
char *p;
unsigned char *q;
BUF_MEM *b = NULL;
static const char hex[17] = "0123456789ABCDEF";
int gs_doit[4];
char tmp_buf[80];
#ifdef CHARSET_EBCDIC
unsigned char ebcdic_buf[1024];
#endif
if (buf == NULL) {
if ((b = BUF_MEM_new()) == NULL)
goto err;
if (!BUF_MEM_grow(b, 200))
goto err;
b->data[0] = '\0';
len = 200;
} else if (len == 0) {
return NULL;
}
if (a == NULL) {
if (b) {
buf = b->data;
OPENSSL_free(b);
}
strncpy(buf, "NO X509_NAME", len);
buf[len - 1] = '\0';
return buf;
}
len--;
l = 0;
for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
ne = sk_X509_NAME_ENTRY_value(a->entries, i);
n = OBJ_obj2nid(ne->object);
if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) {
i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object);
s = tmp_buf;
}
l1 = strlen(s);
type = ne->value->type;
num = ne->value->length;
q = ne->value->data;
#ifdef CHARSET_EBCDIC
if (type == V_ASN1_GENERALSTRING ||
type == V_ASN1_VISIBLESTRING ||
type == V_ASN1_PRINTABLESTRING ||
type == V_ASN1_TELETEXSTRING ||
type == V_ASN1_VISIBLESTRING || type == V_ASN1_IA5STRING) {
ascii2ebcdic(ebcdic_buf, q, (num > (int)sizeof(ebcdic_buf))
? (int)sizeof(ebcdic_buf) : num);
q = ebcdic_buf;
}
#endif
if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) {
gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0;
for (j = 0; j < num; j++)
if (q[j] != 0)
gs_doit[j & 3] = 1;
if (gs_doit[0] | gs_doit[1] | gs_doit[2])
gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1;
else {
gs_doit[0] = gs_doit[1] = gs_doit[2] = 0;
gs_doit[3] = 1;
}
} else
gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1;
for (l2 = j = 0; j < num; j++) {
if (!gs_doit[j & 3])
continue;
l2++;
#ifndef CHARSET_EBCDIC
if ((q[j] < ' ') || (q[j] > '~'))
l2 += 3;
#else
if ((os_toascii[q[j]] < os_toascii[' ']) ||
(os_toascii[q[j]] > os_toascii['~']))
l2 += 3;
#endif
}
lold = l;
l += 1 + l1 + 1 + l2;
if (b != NULL) {
if (!BUF_MEM_grow(b, l + 1))
goto err;
p = &(b->data[lold]);
} else if (l > len) {
break;
} else
p = &(buf[lold]);
*(p++) = '/';
memcpy(p, s, (unsigned int)l1);
p += l1;
*(p++) = '=';
#ifndef CHARSET_EBCDIC
q = ne->value->data;
#endif
for (j = 0; j < num; j++) {
if (!gs_doit[j & 3])
continue;
#ifndef CHARSET_EBCDIC
n = q[j];
if ((n < ' ') || (n > '~')) {
*(p++) = '\\';
*(p++) = 'x';
*(p++) = hex[(n >> 4) & 0x0f];
*(p++) = hex[n & 0x0f];
} else
*(p++) = n;
#else
n = os_toascii[q[j]];
if ((n < os_toascii[' ']) || (n > os_toascii['~'])) {
*(p++) = '\\';
*(p++) = 'x';
*(p++) = hex[(n >> 4) & 0x0f];
*(p++) = hex[n & 0x0f];
} else
*(p++) = q[j];
#endif
}
*p = '\0';
}
if (b != NULL) {
p = b->data;
OPENSSL_free(b);
} else
p = buf;
if (i == 0)
*p = '\0';
return (p);
err:
X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE);
BUF_MEM_free(b);
return (NULL);
}
apps/apps.c:257: error: BUFFER_OVERRUN_L3
Offset added: [0, 200] Size: [1, 2147483644] by call to `X509_NAME_oneline`.
Showing all 6 steps of the trace
apps/apps.c:257:9: Call
255. char *p;
256.
257. p = X509_NAME_oneline(X509_get_subject_name(x), NULL, 0);
^
258. BIO_puts(out, "subject=");
259. BIO_puts(out, p);
crypto/x509/x509_obj.c:66:1: <Offset trace>
64. #include "internal/x509_int.h"
65.
66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
67. {
68. X509_NAME_ENTRY *ne;
crypto/x509/x509_obj.c:66:1: Parameter `len`
64. #include "internal/x509_int.h"
65.
66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
67. {
68. X509_NAME_ENTRY *ne;
crypto/x509/x509_obj.c:66:1: <Length trace>
64. #include "internal/x509_int.h"
65.
66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
67. {
68. X509_NAME_ENTRY *ne;
crypto/x509/x509_obj.c:66:1: Parameter `*buf`
64. #include "internal/x509_int.h"
65.
66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
67. {
68. X509_NAME_ENTRY *ne;
crypto/x509/x509_obj.c:97:9: Array access: Offset added: [0, 200] Size: [1, 2147483644] by call to `X509_NAME_oneline`
95. OPENSSL_free(b);
96. }
97. strncpy(buf, "NO X509_NAME", len);
^
98. buf[len - 1] = '\0';
99. return buf;
| https://github.com/openssl/openssl/blob/b33d1141b6dcce947708b984c5e9e91dad3d675d/crypto/x509/x509_obj.c/#L97 |
d2a_code_trace_data_41539 | 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_env.c:910: error: BUFFER_OVERRUN_L3
Offset added: [4, +oo] (⇐ 4 + [0, +oo]) Size: [1, +oo] by call to `CMS_RecipientInfo_encrypt`.
Showing all 16 steps of the trace
crypto/cms/cms_env.c:910:13: Call
908. for (i = 0; i < sk_CMS_RecipientInfo_num(rinfos); i++) {
909. ri = sk_CMS_RecipientInfo_value(rinfos, i);
910. if (CMS_RecipientInfo_encrypt(cms, ri) <= 0) {
^
911. CMSerr(CMS_F_CMS_ENVELOPEDDATA_INIT_BIO,
912. CMS_R_ERROR_SETTING_RECIPIENTINFO);
crypto/cms/cms_env.c:801:1: Parameter `ri->d.pwri->encryptedKey->length`
799. }
800.
801. > int CMS_RecipientInfo_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri)
802. {
803. switch (ri->type) {
crypto/cms/cms_env.c:910:13: Call
908. for (i = 0; i < sk_CMS_RecipientInfo_num(rinfos); i++) {
909. ri = sk_CMS_RecipientInfo_value(rinfos, i);
910. if (CMS_RecipientInfo_encrypt(cms, ri) <= 0) {
^
911. CMSerr(CMS_F_CMS_ENVELOPEDDATA_INIT_BIO,
912. CMS_R_ERROR_SETTING_RECIPIENTINFO);
crypto/cms/cms_env.c:801:1: Parameter `ri->d.pwri->encryptedKey->length`
799. }
800.
801. > int CMS_RecipientInfo_encrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri)
802. {
803. switch (ri->type) {
crypto/cms/cms_env.c:814:16: Call
812.
813. case CMS_RECIPINFO_PASS:
814. return cms_RecipientInfo_pwri_crypt(cms, ri, 1);
^
815.
816. 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: <Offset 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:266:5: Assignment
264. goto err;
265. }
266. *outlen = (size_t)tmp[0];
^
267. memcpy(out, tmp + 4, *outlen);
268. rv = 1;
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:267:5: Array access: Offset added: [4, +oo] (⇐ 4 + [0, +oo]) Size: [1, +oo] by call to `CMS_RecipientInfo_encrypt`
265. }
266. *outlen = (size_t)tmp[0];
267. memcpy(out, tmp + 4, *outlen);
^
268. rv = 1;
269. err:
| https://github.com/openssl/openssl/blob/846ec07d904f9cc81d486db0db14fb84f61ff6e5/crypto/cms/cms_pwri.c/#L267 |
d2a_code_trace_data_41540 | static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int length, int sb_min, int sb_max)
{
int sb, j, k, n, ch, run, channels;
int joined_stereo, zero_encoding, chs;
int type34_first;
float type34_div = 0;
float type34_predictor;
float samples[10], sign_bits[16];
if (length == 0) {
for (sb=sb_min; sb < sb_max; sb++)
build_sb_samples_from_noise (q, sb);
return;
}
for (sb = sb_min; sb < sb_max; sb++) {
FIX_NOISE_IDX(q->noise_idx);
channels = q->nb_channels;
if (q->nb_channels <= 1 || sb < 12)
joined_stereo = 0;
else if (sb >= 24)
joined_stereo = 1;
else
joined_stereo = (BITS_LEFT(length,gb) >= 1) ? get_bits1 (gb) : 0;
if (joined_stereo) {
if (BITS_LEFT(length,gb) >= 16)
for (j = 0; j < 16; j++)
sign_bits[j] = get_bits1 (gb);
for (j = 0; j < 64; j++)
if (q->coding_method[1][sb][j] > q->coding_method[0][sb][j])
q->coding_method[0][sb][j] = q->coding_method[1][sb][j];
fix_coding_method_array(sb, q->nb_channels, q->coding_method);
channels = 1;
}
for (ch = 0; ch < channels; ch++) {
zero_encoding = (BITS_LEFT(length,gb) >= 1) ? get_bits1(gb) : 0;
type34_predictor = 0.0;
type34_first = 1;
for (j = 0; j < 128; ) {
switch (q->coding_method[ch][sb][j / 2]) {
case 8:
if (BITS_LEFT(length,gb) >= 10) {
if (zero_encoding) {
for (k = 0; k < 5; k++) {
if ((j + 2 * k) >= 128)
break;
samples[2 * k] = get_bits1(gb) ? dequant_1bit[joined_stereo][2 * get_bits1(gb)] : 0;
}
} else {
n = get_bits(gb, 8);
for (k = 0; k < 5; k++)
samples[2 * k] = dequant_1bit[joined_stereo][random_dequant_index[n][k]];
}
for (k = 0; k < 5; k++)
samples[2 * k + 1] = SB_DITHERING_NOISE(sb,q->noise_idx);
} else {
for (k = 0; k < 10; k++)
samples[k] = SB_DITHERING_NOISE(sb,q->noise_idx);
}
run = 10;
break;
case 10:
if (BITS_LEFT(length,gb) >= 1) {
float f = 0.81;
if (get_bits1(gb))
f = -f;
f -= noise_samples[((sb + 1) * (j +5 * ch + 1)) & 127] * 9.0 / 40.0;
samples[0] = f;
} else {
samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx);
}
run = 1;
break;
case 16:
if (BITS_LEFT(length,gb) >= 10) {
if (zero_encoding) {
for (k = 0; k < 5; k++) {
if ((j + k) >= 128)
break;
samples[k] = (get_bits1(gb) == 0) ? 0 : dequant_1bit[joined_stereo][2 * get_bits1(gb)];
}
} else {
n = get_bits (gb, 8);
for (k = 0; k < 5; k++)
samples[k] = dequant_1bit[joined_stereo][random_dequant_index[n][k]];
}
} else {
for (k = 0; k < 5; k++)
samples[k] = SB_DITHERING_NOISE(sb,q->noise_idx);
}
run = 5;
break;
case 24:
if (BITS_LEFT(length,gb) >= 7) {
n = get_bits(gb, 7);
for (k = 0; k < 3; k++)
samples[k] = (random_dequant_type24[n][k] - 2.0) * 0.5;
} else {
for (k = 0; k < 3; k++)
samples[k] = SB_DITHERING_NOISE(sb,q->noise_idx);
}
run = 3;
break;
case 30:
if (BITS_LEFT(length,gb) >= 4)
samples[0] = type30_dequant[qdm2_get_vlc(gb, &vlc_tab_type30, 0, 1)];
else
samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx);
run = 1;
break;
case 34:
if (BITS_LEFT(length,gb) >= 7) {
if (type34_first) {
type34_div = (float)(1 << get_bits(gb, 2));
samples[0] = ((float)get_bits(gb, 5) - 16.0) / 15.0;
type34_predictor = samples[0];
type34_first = 0;
} else {
samples[0] = type34_delta[qdm2_get_vlc(gb, &vlc_tab_type34, 0, 1)] / type34_div + type34_predictor;
type34_predictor = samples[0];
}
} else {
samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx);
}
run = 1;
break;
default:
samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx);
run = 1;
break;
}
if (joined_stereo) {
float tmp[10][MPA_MAX_CHANNELS];
for (k = 0; k < run; k++) {
tmp[k][0] = samples[k];
tmp[k][1] = (sign_bits[(j + k) / 8]) ? -samples[k] : samples[k];
}
for (chs = 0; chs < q->nb_channels; chs++)
for (k = 0; k < run; k++)
if ((j + k) < 128)
q->sb_samples[chs][j + k][sb] = (int32_t)(f2i_scale * q->tone_level[chs][sb][((j + k)/2)] * tmp[k][chs] + .5);
} else {
for (k = 0; k < run; k++)
if ((j + k) < 128)
q->sb_samples[ch][j + k][sb] = (int32_t)(f2i_scale * q->tone_level[ch][sb][(j + k)/2] * samples[k] + .5);
}
j += run;
}
}
}
}
libavcodec/qdm2.c:957: error: Buffer Overrun L2
Offset: [0, 68] Size: 64.
libavcodec/qdm2.c:845:18: <Offset trace>
843. type34_first = 1;
844.
845. for (j = 0; j < 128; ) {
^
846. switch (q->coding_method[ch][sb][j / 2]) {
847. case 8:
libavcodec/qdm2.c:845:18: Assignment
843. type34_first = 1;
844.
845. for (j = 0; j < 128; ) {
^
846. switch (q->coding_method[ch][sb][j / 2]) {
847. case 8:
libavcodec/qdm2.c:798:1: <Length trace>
796. * @param sb_max higher subband processed (sb_max excluded)
797. */
798. static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int length, int sb_min, int sb_max)
^
799. {
800. int sb, j, k, n, ch, run, channels;
libavcodec/qdm2.c:798:1: Parameter `q->tone_level[*][*][*]`
796. * @param sb_max higher subband processed (sb_max excluded)
797. */
798. static void synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int length, int sb_min, int sb_max)
^
799. {
800. int sb, j, k, n, ch, run, channels;
libavcodec/qdm2.c:957:87: Array access: Offset: [0, 68] Size: 64
955. for (k = 0; k < run; k++)
956. if ((j + k) < 128)
957. q->sb_samples[chs][j + k][sb] = (int32_t)(f2i_scale * q->tone_level[chs][sb][((j + k)/2)] * tmp[k][chs] + .5);
^
958. } else {
959. for (k = 0; k < run; k++)
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/qdm2.c/#L957 |
d2a_code_trace_data_41541 | MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt)
{
EVP_PKEY *pkey = NULL;
const unsigned char *data;
#ifndef OPENSSL_NO_GOST
unsigned char *gost_data = NULL;
#endif
int al = SSL_AD_INTERNAL_ERROR, ret = MSG_PROCESS_ERROR;
int type = 0, j, pktype;
unsigned int len;
X509 *peer;
const EVP_MD *md = NULL;
size_t hdatalen = 0;
void *hdata;
unsigned char tls13tbs[TLS13_TBS_PREAMBLE_SIZE + EVP_MAX_MD_SIZE];
EVP_MD_CTX *mctx = EVP_MD_CTX_new();
EVP_PKEY_CTX *pctx = NULL;
if (mctx == NULL) {
SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_MALLOC_FAILURE);
goto f_err;
}
peer = s->session->peer;
pkey = X509_get0_pubkey(peer);
pktype = EVP_PKEY_id(pkey);
type = X509_certificate_type(peer, pkey);
if (!(type & EVP_PKT_SIGN)) {
SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY,
SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE);
al = SSL_AD_ILLEGAL_PARAMETER;
goto f_err;
}
#ifndef OPENSSL_NO_GOST
if (PACKET_remaining(pkt) == 64
&& EVP_PKEY_id(pkey) == NID_id_GostR3410_2001) {
len = 64;
} else
#endif
{
if (SSL_USE_SIGALGS(s)) {
int rv;
unsigned int sigalg;
if (!PACKET_get_net_2(pkt, &sigalg)) {
al = SSL_AD_DECODE_ERROR;
goto f_err;
}
rv = tls12_check_peer_sigalg(&md, s, sigalg, pkey);
if (rv == -1) {
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
} else {
int idx = ssl_cert_type(NULL, pkey);
if (idx >= 0)
md = s->s3->tmp.md[idx];
if (md == NULL) {
al = SSL_AD_INTERNAL_ERROR;
goto f_err;
}
}
if (!PACKET_get_net_2(pkt, &len)) {
SSLerr(SSL_F_TLS_PROCESS_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)
|| (PACKET_remaining(pkt) == 0)) {
SSLerr(SSL_F_TLS_PROCESS_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_TLS_PROCESS_CERT_VERIFY, SSL_R_LENGTH_MISMATCH);
al = SSL_AD_DECODE_ERROR;
goto f_err;
}
if (!get_cert_verify_tbs_data(s, tls13tbs, &hdata, &hdatalen)) {
SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_INTERNAL_ERROR);
goto f_err;
}
#ifdef SSL_DEBUG
fprintf(stderr, "Using client verify alg %s\n", EVP_MD_name(md));
#endif
if (EVP_DigestVerifyInit(mctx, &pctx, md, NULL, pkey) <= 0
|| EVP_DigestVerifyUpdate(mctx, hdata, hdatalen) <= 0) {
SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_EVP_LIB);
goto f_err;
}
#ifndef OPENSSL_NO_GOST
{
if (pktype == NID_id_GostR3410_2001
|| pktype == NID_id_GostR3410_2012_256
|| pktype == NID_id_GostR3410_2012_512) {
if ((gost_data = OPENSSL_malloc(len)) == NULL) {
SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_MALLOC_FAILURE);
goto f_err;
}
BUF_reverse(gost_data, data, len);
data = gost_data;
}
}
#endif
if (SSL_IS_TLS13(s) && pktype == EVP_PKEY_RSA) {
if (EVP_PKEY_CTX_set_rsa_padding(pctx, RSA_PKCS1_PSS_PADDING) <= 0
|| EVP_PKEY_CTX_set_rsa_pss_saltlen(pctx, -1) <= 0) {
SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_EVP_LIB);
goto f_err;
}
} else if (s->version == SSL3_VERSION
&& !EVP_MD_CTX_ctrl(mctx, EVP_CTRL_SSL3_MASTER_SECRET,
(int)s->session->master_key_length,
s->session->master_key)) {
SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_EVP_LIB);
goto f_err;
}
if (EVP_DigestVerifyFinal(mctx, data, len) <= 0) {
al = SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, SSL_R_BAD_SIGNATURE);
goto f_err;
}
if (SSL_IS_TLS13(s))
ret = MSG_PROCESS_CONTINUE_READING;
else
ret = MSG_PROCESS_CONTINUE_PROCESSING;
if (0) {
f_err:
ssl3_send_alert(s, SSL3_AL_FATAL, al);
ossl_statem_set_error(s);
}
BIO_free(s->s3->handshake_buffer);
s->s3->handshake_buffer = NULL;
EVP_MD_CTX_free(mctx);
#ifndef OPENSSL_NO_GOST
OPENSSL_free(gost_data);
#endif
return ret;
}
ssl/statem/statem_lib.c:263: error: NULL_DEREFERENCE
pointer `pkey` last assigned on line 262 could be null and is dereferenced by call to `EVP_PKEY_id()` at line 263, column 14.
Showing all 53 steps of the trace
ssl/statem/statem_lib.c:238:1: start of procedure tls_process_cert_verify()
236. }
237.
238. > MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt)
239. {
240. EVP_PKEY *pkey = NULL;
ssl/statem/statem_lib.c:240:5:
238. MSG_PROCESS_RETURN tls_process_cert_verify(SSL *s, PACKET *pkt)
239. {
240. > EVP_PKEY *pkey = NULL;
241. const unsigned char *data;
242. #ifndef OPENSSL_NO_GOST
ssl/statem/statem_lib.c:243:5:
241. const unsigned char *data;
242. #ifndef OPENSSL_NO_GOST
243. > unsigned char *gost_data = NULL;
244. #endif
245. int al = SSL_AD_INTERNAL_ERROR, ret = MSG_PROCESS_ERROR;
ssl/statem/statem_lib.c:245:5:
243. unsigned char *gost_data = NULL;
244. #endif
245. > int al = SSL_AD_INTERNAL_ERROR, ret = MSG_PROCESS_ERROR;
246. int type = 0, j, pktype;
247. unsigned int len;
ssl/statem/statem_lib.c:246:5:
244. #endif
245. int al = SSL_AD_INTERNAL_ERROR, ret = MSG_PROCESS_ERROR;
246. > int type = 0, j, pktype;
247. unsigned int len;
248. X509 *peer;
ssl/statem/statem_lib.c:249:5:
247. unsigned int len;
248. X509 *peer;
249. > const EVP_MD *md = NULL;
250. size_t hdatalen = 0;
251. void *hdata;
ssl/statem/statem_lib.c:250:5:
248. X509 *peer;
249. const EVP_MD *md = NULL;
250. > size_t hdatalen = 0;
251. void *hdata;
252. unsigned char tls13tbs[TLS13_TBS_PREAMBLE_SIZE + EVP_MAX_MD_SIZE];
ssl/statem/statem_lib.c:253:5:
251. void *hdata;
252. unsigned char tls13tbs[TLS13_TBS_PREAMBLE_SIZE + EVP_MAX_MD_SIZE];
253. > EVP_MD_CTX *mctx = EVP_MD_CTX_new();
254. EVP_PKEY_CTX *pctx = NULL;
255.
crypto/evp/digest.c:44:1: start of procedure EVP_MD_CTX_new()
42. }
43.
44. > EVP_MD_CTX *EVP_MD_CTX_new(void)
45. {
46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
crypto/evp/digest.c:46:5:
44. EVP_MD_CTX *EVP_MD_CTX_new(void)
45. {
46. > return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
47. }
48.
crypto/mem.c:98:1: start of procedure CRYPTO_zalloc()
96. }
97.
98. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
99. {
100. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:100:5:
98. void *CRYPTO_zalloc(size_t num, const char *file, int line)
99. {
100. > void *ret = CRYPTO_malloc(num, file, line);
101.
102. if (ret != NULL)
crypto/mem.c:71:1: start of procedure CRYPTO_malloc()
69. }
70.
71. > void *CRYPTO_malloc(size_t num, const char *file, int line)
72. {
73. void *ret = NULL;
crypto/mem.c:73:5:
71. void *CRYPTO_malloc(size_t num, const char *file, int line)
72. {
73. > void *ret = NULL;
74.
75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
crypto/mem.c:75:9: Taking false branch
73. void *ret = NULL;
74.
75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
76. return malloc_impl(num, file, line);
77.
crypto/mem.c:78:9: Taking false branch
76. return malloc_impl(num, file, line);
77.
78. if (num <= 0)
^
79. return NULL;
80.
crypto/mem.c:81:5:
79. return NULL;
80.
81. > allow_customize = 0;
82. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
83. if (call_malloc_debug) {
crypto/mem.c:91:5:
89. }
90. #else
91. > osslargused(file); osslargused(line);
92. ret = malloc(num);
93. #endif
crypto/mem.c:91:24:
89. }
90. #else
91. > osslargused(file); osslargused(line);
92. ret = malloc(num);
93. #endif
crypto/mem.c:92:5:
90. #else
91. osslargused(file); osslargused(line);
92. > ret = malloc(num);
93. #endif
94.
crypto/mem.c:95:5:
93. #endif
94.
95. > return ret;
96. }
97.
crypto/mem.c:96:1: return from a call to CRYPTO_malloc
94.
95. return ret;
96. > }
97.
98. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:102:9: Taking true branch
100. void *ret = CRYPTO_malloc(num, file, line);
101.
102. if (ret != NULL)
^
103. memset(ret, 0, num);
104. return ret;
crypto/mem.c:103:9:
101.
102. if (ret != NULL)
103. > memset(ret, 0, num);
104. return ret;
105. }
crypto/mem.c:104:5:
102. if (ret != NULL)
103. memset(ret, 0, num);
104. > return ret;
105. }
106.
crypto/mem.c:105:1: return from a call to CRYPTO_zalloc
103. memset(ret, 0, num);
104. return ret;
105. > }
106.
107. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/evp/digest.c:47:1: return from a call to EVP_MD_CTX_new
45. {
46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
47. > }
48.
49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
ssl/statem/statem_lib.c:254:5:
252. unsigned char tls13tbs[TLS13_TBS_PREAMBLE_SIZE + EVP_MAX_MD_SIZE];
253. EVP_MD_CTX *mctx = EVP_MD_CTX_new();
254. > EVP_PKEY_CTX *pctx = NULL;
255.
256. if (mctx == NULL) {
ssl/statem/statem_lib.c:256:9: Taking false branch
254. EVP_PKEY_CTX *pctx = NULL;
255.
256. if (mctx == NULL) {
^
257. SSLerr(SSL_F_TLS_PROCESS_CERT_VERIFY, ERR_R_MALLOC_FAILURE);
258. goto f_err;
ssl/statem/statem_lib.c:261:5:
259. }
260.
261. > peer = s->session->peer;
262. pkey = X509_get0_pubkey(peer);
263. pktype = EVP_PKEY_id(pkey);
ssl/statem/statem_lib.c:262:5:
260.
261. peer = s->session->peer;
262. > pkey = X509_get0_pubkey(peer);
263. pktype = EVP_PKEY_id(pkey);
264. type = X509_certificate_type(peer, pkey);
crypto/x509/x509_cmp.c:265:1: start of procedure X509_get0_pubkey()
263. }
264.
265. > EVP_PKEY *X509_get0_pubkey(const X509 *x)
266. {
267. if (x == NULL)
crypto/x509/x509_cmp.c:267:9: Taking false branch
265. EVP_PKEY *X509_get0_pubkey(const X509 *x)
266. {
267. if (x == NULL)
^
268. return NULL;
269. return X509_PUBKEY_get0(x->cert_info.key);
crypto/x509/x509_cmp.c:269:5:
267. if (x == NULL)
268. return NULL;
269. > return X509_PUBKEY_get0(x->cert_info.key);
270. }
271.
crypto/x509/x_pubkey.c:140:1: start of procedure X509_PUBKEY_get0()
138. }
139.
140. > EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key)
141. {
142. EVP_PKEY *ret = NULL;
crypto/x509/x_pubkey.c:142:5:
140. EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key)
141. {
142. > EVP_PKEY *ret = NULL;
143.
144. if (key == NULL || key->public_key == NULL)
crypto/x509/x_pubkey.c:144:9: Taking false branch
142. EVP_PKEY *ret = NULL;
143.
144. if (key == NULL || key->public_key == NULL)
^
145. return NULL;
146.
crypto/x509/x_pubkey.c:144:24: Taking false branch
142. EVP_PKEY *ret = NULL;
143.
144. if (key == NULL || key->public_key == NULL)
^
145. return NULL;
146.
crypto/x509/x_pubkey.c:147:9: Taking false branch
145. return NULL;
146.
147. if (key->pkey != NULL)
^
148. return key->pkey;
149.
crypto/x509/x_pubkey.c:158:5:
156. * in the queue.
157. */
158. > x509_pubkey_decode(&ret, key);
159. /* If decode doesn't fail something bad happened */
160. if (ret != NULL) {
crypto/x509/x_pubkey.c:103:1: start of procedure x509_pubkey_decode()
101.
102.
103. > static int x509_pubkey_decode(EVP_PKEY **ppkey, X509_PUBKEY *key)
104. {
105. EVP_PKEY *pkey = EVP_PKEY_new();
crypto/x509/x_pubkey.c:105:5: Skipping EVP_PKEY_new(): empty list of specs
103. static int x509_pubkey_decode(EVP_PKEY **ppkey, X509_PUBKEY *key)
104. {
105. EVP_PKEY *pkey = EVP_PKEY_new();
^
106.
107. if (pkey == NULL) {
crypto/x509/x_pubkey.c:107:9: Taking true branch
105. EVP_PKEY *pkey = EVP_PKEY_new();
106.
107. if (pkey == NULL) {
^
108. X509err(X509_F_X509_PUBKEY_DECODE, ERR_R_MALLOC_FAILURE);
109. return -1;
crypto/x509/x_pubkey.c:108:9: Skipping ERR_put_error(): empty list of specs
106.
107. if (pkey == NULL) {
108. X509err(X509_F_X509_PUBKEY_DECODE, ERR_R_MALLOC_FAILURE);
^
109. return -1;
110. }
crypto/x509/x_pubkey.c:109:9:
107. if (pkey == NULL) {
108. X509err(X509_F_X509_PUBKEY_DECODE, ERR_R_MALLOC_FAILURE);
109. > return -1;
110. }
111.
crypto/x509/x_pubkey.c:138:1: return from a call to x509_pubkey_decode
136. EVP_PKEY_free(pkey);
137. return 0;
138. > }
139.
140. EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key)
crypto/x509/x_pubkey.c:160:9: Taking false branch
158. x509_pubkey_decode(&ret, key);
159. /* If decode doesn't fail something bad happened */
160. if (ret != NULL) {
^
161. X509err(X509_F_X509_PUBKEY_GET0, ERR_R_INTERNAL_ERROR);
162. EVP_PKEY_free(ret);
crypto/x509/x_pubkey.c:165:5:
163. }
164.
165. > return NULL;
166. }
167.
crypto/x509/x_pubkey.c:166:1: return from a call to X509_PUBKEY_get0
164.
165. return NULL;
166. > }
167.
168. EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
crypto/x509/x509_cmp.c:270:1: return from a call to X509_get0_pubkey
268. return NULL;
269. return X509_PUBKEY_get0(x->cert_info.key);
270. > }
271.
272. EVP_PKEY *X509_get_pubkey(X509 *x)
ssl/statem/statem_lib.c:263:5:
261. peer = s->session->peer;
262. pkey = X509_get0_pubkey(peer);
263. > pktype = EVP_PKEY_id(pkey);
264. type = X509_certificate_type(peer, pkey);
265.
crypto/evp/p_lib.c:378:1: start of procedure EVP_PKEY_id()
376. }
377.
378. > int EVP_PKEY_id(const EVP_PKEY *pkey)
379. {
380. return pkey->type;
crypto/evp/p_lib.c:380:5:
378. int EVP_PKEY_id(const EVP_PKEY *pkey)
379. {
380. > return pkey->type;
381. }
382.
| https://github.com/openssl/openssl/blob/4954fd13b3c71f0f74677b78533f1176e13de032/ssl/statem/statem_lib.c/#L263 |
d2a_code_trace_data_41542 | int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a_, const unsigned int p[], BN_CTX *ctx)
{
int ret = 0, count = 0;
unsigned int j;
BIGNUM *a, *z, *rho, *w, *w2, *tmp;
if (!p[0])
return BN_zero(r);
BN_CTX_start(ctx);
a = BN_CTX_get(ctx);
z = BN_CTX_get(ctx);
w = BN_CTX_get(ctx);
if (w == NULL) goto err;
if (!BN_GF2m_mod_arr(a, a_, p)) goto err;
if (BN_is_zero(a))
{
ret = BN_zero(r);
goto err;
}
if (p[0] & 0x1)
{
if (!BN_copy(z, a)) goto err;
for (j = 1; j <= (p[0] - 1) / 2; j++)
{
if (!BN_GF2m_mod_sqr_arr(z, z, p, ctx)) goto err;
if (!BN_GF2m_mod_sqr_arr(z, z, p, ctx)) goto err;
if (!BN_GF2m_add(z, z, a)) goto err;
}
}
else
{
rho = BN_CTX_get(ctx);
w2 = BN_CTX_get(ctx);
tmp = BN_CTX_get(ctx);
if (tmp == NULL) goto err;
do
{
if (!BN_rand(rho, p[0], 0, 0)) goto err;
if (!BN_GF2m_mod_arr(rho, rho, p)) goto err;
if (!BN_zero(z)) goto err;
if (!BN_copy(w, rho)) goto err;
for (j = 1; j <= p[0] - 1; j++)
{
if (!BN_GF2m_mod_sqr_arr(z, z, p, ctx)) goto err;
if (!BN_GF2m_mod_sqr_arr(w2, w, p, ctx)) goto err;
if (!BN_GF2m_mod_mul_arr(tmp, w2, a, p, ctx)) goto err;
if (!BN_GF2m_add(z, z, tmp)) goto err;
if (!BN_GF2m_add(w, w2, rho)) goto err;
}
count++;
} while (BN_is_zero(w) && (count < MAX_ITERATIONS));
if (BN_is_zero(w))
{
BNerr(BN_F_BN_GF2M_MOD_SOLVE_QUAD_ARR,BN_R_TOO_MANY_ITERATIONS);
goto err;
}
}
if (!BN_GF2m_mod_sqr_arr(w, z, p, ctx)) goto err;
if (!BN_GF2m_add(w, z, w)) goto err;
if (BN_GF2m_cmp(w, a)) goto err;
if (!BN_copy(r, z)) goto err;
bn_check_top(r);
ret = 1;
err:
BN_CTX_end(ctx);
return ret;
}
crypto/bn/bn_gf2m.c:902: error: INTEGER_OVERFLOW_L2
([0, `*p`] - 1):unsigned32.
Showing all 3 steps of the trace
crypto/bn/bn_gf2m.c:874:1: <LHS trace>
872. * Uses algorithms A.4.7 and A.4.6 from IEEE P1363.
873. */
874. > int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a_, const unsigned int p[], BN_CTX *ctx)
875. {
876. int ret = 0, count = 0;
crypto/bn/bn_gf2m.c:874:1: Parameter `*p`
872. * Uses algorithms A.4.7 and A.4.6 from IEEE P1363.
873. */
874. > int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a_, const unsigned int p[], BN_CTX *ctx)
875. {
876. int ret = 0, count = 0;
crypto/bn/bn_gf2m.c:902:15: Binary operation: ([0, *p] - 1):unsigned32
900. /* compute half-trace of a */
901. if (!BN_copy(z, a)) goto err;
902. for (j = 1; j <= (p[0] - 1) / 2; j++)
^
903. {
904. if (!BN_GF2m_mod_sqr_arr(z, z, p, ctx)) goto err;
| https://github.com/openssl/openssl/blob/6defae04f3c44087d9129994fa88b4f9271b153f/crypto/bn/bn_gf2m.c/#L902 |
d2a_code_trace_data_41543 | static int dv_extract_audio(uint8_t* frame, uint8_t* pcm, uint8_t* pcm2,
const DVprofile *sys)
{
int size, chan, i, j, d, of, smpls, freq, quant, half_ch;
uint16_t lc, rc;
const uint8_t* as_pack;
as_pack = dv_extract_pack(frame, dv_audio_source);
if (!as_pack)
return 0;
smpls = as_pack[1] & 0x3f;
freq = (as_pack[4] >> 3) & 0x07;
quant = as_pack[4] & 0x07;
if (quant > 1)
return -1;
size = (sys->audio_min_samples[freq] + smpls) * 4;
half_ch = sys->difseg_size/2;
for (chan = 0; chan < sys->n_difchan; chan++) {
for (i = 0; i < sys->difseg_size; i++) {
frame += 6 * 80;
if (quant == 1 && i == half_ch) {
if (!pcm2)
break;
else
pcm = pcm2;
}
for (j = 0; j < 9; j++) {
for (d = 8; d < 80; d += 2) {
if (quant == 0) {
of = sys->audio_shuffle[i][j] + (d - 8)/2 * sys->audio_stride;
if (of*2 >= size)
continue;
pcm[of*2] = frame[d+1];
pcm[of*2+1] = frame[d];
if (pcm[of*2+1] == 0x80 && pcm[of*2] == 0x00)
pcm[of*2+1] = 0;
} else {
lc = ((uint16_t)frame[d] << 4) |
((uint16_t)frame[d+2] >> 4);
rc = ((uint16_t)frame[d+1] << 4) |
((uint16_t)frame[d+2] & 0x0f);
lc = (lc == 0x800 ? 0 : dv_audio_12to16(lc));
rc = (rc == 0x800 ? 0 : dv_audio_12to16(rc));
of = sys->audio_shuffle[i%half_ch][j] + (d - 8)/3 * sys->audio_stride;
if (of*2 >= size)
continue;
pcm[of*2] = lc & 0xff;
pcm[of*2+1] = lc >> 8;
of = sys->audio_shuffle[i%half_ch+half_ch][j] +
(d - 8)/3 * sys->audio_stride;
pcm[of*2] = rc & 0xff;
pcm[of*2+1] = rc >> 8;
++d;
}
}
frame += 16 * 80;
}
}
if(!pcm2)
break;
pcm = pcm2;
}
return size;
}
libavdevice/dv1394.c:202: error: Buffer Overrun L2
Offset: [0, 7] Size: 3 by call to `dv_produce_packet`.
libavdevice/dv1394.c:170:13: Unknown value from: ioctl
168. }
169.
170. if (ioctl(dv->fd, DV1394_GET_STATUS, &s) < 0) {
^
171. av_log(context, AV_LOG_ERROR, "Failed to get status: %s\n", strerror(errno));
172. return AVERROR(EIO);
libavdevice/dv1394.c:202:12: Call
200. #endif
201.
202. size = dv_produce_packet(dv->dv_demux, pkt,
^
203. dv->ring + (dv->index * DV1394_PAL_FRAME_SIZE),
204. DV1394_PAL_FRAME_SIZE);
libavformat/dv.c:309:1: Parameter `*buf`
307. }
308.
309. int dv_produce_packet(DVDemuxContext *c, AVPacket *pkt,
^
310. uint8_t* buf, int buf_size)
311. {
libavformat/dv.c:315:20: Call
313.
314. if (buf_size < DV_PROFILE_BYTES ||
315. !(c->sys = dv_frame_profile(buf)) ||
^
316. buf_size < c->sys->frame_size) {
317. return -1; /* Broken frame, or not enough data */
libavcodec/dvdata.h:2664:1: Parameter `*frame`
2662. #define DV_MAX_FRAME_SIZE 288000
2663.
2664. static inline const DVprofile* dv_frame_profile(const uint8_t* frame)
^
2665. {
2666. if ((frame[3] & 0x80) == 0) { /* DSF flag */
libavformat/dv.c:322:12: Call
320. /* Queueing audio packet */
321. /* FIXME: in case of no audio/bad audio we have to do something */
322. size = dv_extract_audio_info(c, buf);
^
323. for (i=0; i<c->ach; i++) {
324. c->audio_pkt[i].size = size;
libavformat/dv.c:182:1: Parameter `*frame`
180. }
181.
182. static int dv_extract_audio_info(DVDemuxContext* c, uint8_t* frame)
^
183. {
184. const uint8_t* as_pack;
libavformat/dv.c:187:15: Call
185. int freq, stype, smpls, quant, i, ach;
186.
187. as_pack = dv_extract_pack(frame, dv_audio_source);
^
188. if (!as_pack || !c->sys) { /* No audio ? */
189. c->ach = 0;
libavformat/dv.c:72:1: Parameter `t`
70. * to have a fallback mechanism for complete search of missing packs.
71. */
72. static const uint8_t* dv_extract_pack(uint8_t* frame, enum dv_pack_type t)
^
73. {
74. int offs;
libavformat/dv.c:327:5: Call
325. c->audio_pkt[i].pts = c->abytes * 30000*8 / c->ast[i]->codec->bit_rate;
326. }
327. dv_extract_audio(buf, c->audio_buf[0], c->audio_buf[1], c->sys);
^
328. c->abytes += size;
329.
libavformat/dv.c:101:1: <Offset trace>
99. * are converted into 16bit linear ones.
100. */
101. static int dv_extract_audio(uint8_t* frame, uint8_t* pcm, uint8_t* pcm2,
^
102. const DVprofile *sys)
103. {
libavformat/dv.c:101:1: Parameter `*frame`
99. * are converted into 16bit linear ones.
100. */
101. static int dv_extract_audio(uint8_t* frame, uint8_t* pcm, uint8_t* pcm2,
^
102. const DVprofile *sys)
103. {
libavformat/dv.c:108:15: Call
106. const uint8_t* as_pack;
107.
108. as_pack = dv_extract_pack(frame, dv_audio_source);
^
109. if (!as_pack) /* No audio ? */
110. return 0;
libavformat/dv.c:72:1: Parameter `t`
70. * to have a fallback mechanism for complete search of missing packs.
71. */
72. static const uint8_t* dv_extract_pack(uint8_t* frame, enum dv_pack_type t)
^
73. {
74. int offs;
libavformat/dv.c:113:5: Assignment
111.
112. smpls = as_pack[1] & 0x3f; /* samples in this frame - min. samples */
113. freq = (as_pack[4] >> 3) & 0x07; /* 0 - 48KHz, 1 - 44,1kHz, 2 - 32 kHz */
^
114. quant = as_pack[4] & 0x07; /* 0 - 16bit linear, 1 - 12bit nonlinear */
115.
libavformat/dv.c:101:1: <Length trace>
99. * are converted into 16bit linear ones.
100. */
101. static int dv_extract_audio(uint8_t* frame, uint8_t* pcm, uint8_t* pcm2,
^
102. const DVprofile *sys)
103. {
libavformat/dv.c:101:1: Parameter `sys->audio_min_samples[*]`
99. * are converted into 16bit linear ones.
100. */
101. static int dv_extract_audio(uint8_t* frame, uint8_t* pcm, uint8_t* pcm2,
^
102. const DVprofile *sys)
103. {
libavformat/dv.c:119:13: Array access: Offset: [0, 7] Size: 3 by call to `dv_produce_packet`
117. return -1; /* Unsupported quantization */
118.
119. size = (sys->audio_min_samples[freq] + smpls) * 4; /* 2ch, 2bytes */
^
120. half_ch = sys->difseg_size/2;
121.
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/dv.c/#L119 |
d2a_code_trace_data_41544 | static int pbe_test_init(struct evp_test *t, const char *alg)
{
struct pbe_data *pdat;
int pbe_type = 0;
#ifndef OPENSSL_NO_SCRYPT
if (strcmp(alg, "scrypt") == 0)
pbe_type = PBE_TYPE_SCRYPT;
#endif
else if (strcmp(alg, "pbkdf2") == 0)
pbe_type = PBE_TYPE_PBKDF2;
else if (strcmp(alg, "pkcs12") == 0)
pbe_type = PBE_TYPE_PKCS12;
else
fprintf(stderr, "Unknown pbe algorithm %s\n", alg);
pdat = OPENSSL_malloc(sizeof(*pdat));
pdat->pbe_type = pbe_type;
pdat->pass = NULL;
pdat->salt = NULL;
pdat->N = 0;
pdat->r = 0;
pdat->p = 0;
pdat->maxmem = 0;
pdat->id = 0;
pdat->iter = 0;
pdat->md = NULL;
t->data = pdat;
return 1;
}
test/evp_test.c:1439: error: NULL_DEREFERENCE
pointer `pdat` last assigned on line 1438 could be null and is dereferenced at line 1439, column 5.
Showing all 17 steps of the trace
test/evp_test.c:1423:1: start of procedure pbe_test_init()
1421. }
1422.
1423. > static int pbe_test_init(struct evp_test *t, const char *alg)
1424. {
1425. struct pbe_data *pdat;
test/evp_test.c:1426:5:
1424. {
1425. struct pbe_data *pdat;
1426. > int pbe_type = 0;
1427.
1428. #ifndef OPENSSL_NO_SCRYPT
test/evp_test.c:1429:9: Taking false branch
1427.
1428. #ifndef OPENSSL_NO_SCRYPT
1429. if (strcmp(alg, "scrypt") == 0)
^
1430. pbe_type = PBE_TYPE_SCRYPT;
1431. #endif
test/evp_test.c:1432:14: Taking false branch
1430. pbe_type = PBE_TYPE_SCRYPT;
1431. #endif
1432. else if (strcmp(alg, "pbkdf2") == 0)
^
1433. pbe_type = PBE_TYPE_PBKDF2;
1434. else if (strcmp(alg, "pkcs12") == 0)
test/evp_test.c:1434:14: Taking false branch
1432. else if (strcmp(alg, "pbkdf2") == 0)
1433. pbe_type = PBE_TYPE_PBKDF2;
1434. else if (strcmp(alg, "pkcs12") == 0)
^
1435. pbe_type = PBE_TYPE_PKCS12;
1436. else
test/evp_test.c:1437:9:
1435. pbe_type = PBE_TYPE_PKCS12;
1436. else
1437. > fprintf(stderr, "Unknown pbe algorithm %s\n", alg);
1438. pdat = OPENSSL_malloc(sizeof(*pdat));
1439. pdat->pbe_type = pbe_type;
test/evp_test.c:1438:5:
1436. else
1437. fprintf(stderr, "Unknown pbe algorithm %s\n", alg);
1438. > pdat = OPENSSL_malloc(sizeof(*pdat));
1439. pdat->pbe_type = pbe_type;
1440. pdat->pass = NULL;
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
test/evp_test.c:1439:5:
1437. fprintf(stderr, "Unknown pbe algorithm %s\n", alg);
1438. pdat = OPENSSL_malloc(sizeof(*pdat));
1439. > pdat->pbe_type = pbe_type;
1440. pdat->pass = NULL;
1441. pdat->salt = NULL;
| https://github.com/openssl/openssl/blob/928623825cc59e272e2031cd3f07c5b7bbd605d4/test/evp_test.c/#L1439 |
d2a_code_trace_data_41545 | static int encode_test_init(struct evp_test *t, const char *encoding)
{
struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata));
if (strcmp(encoding, "canonical") == 0) {
edata->encoding = BASE64_CANONICAL_ENCODING;
} else if (strcmp(encoding, "valid") == 0) {
edata->encoding = BASE64_VALID_ENCODING;
} else if (strcmp(encoding, "invalid") == 0) {
edata->encoding = BASE64_INVALID_ENCODING;
t->expected_err = OPENSSL_strdup("DECODE_ERROR");
if (t->expected_err == NULL)
return 0;
} else {
fprintf(stderr, "Bad encoding: %s. Should be one of "
"{canonical, valid, invalid}\n", encoding);
return 0;
}
t->data = edata;
return 1;
}
test/evp_test.c:1561: error: NULL_DEREFERENCE
pointer `edata` last assigned on line 1554 could be null and is dereferenced at line 1561, column 9.
Showing all 20 steps of the trace
test/evp_test.c:1552:1: start of procedure encode_test_init()
1550. };
1551.
1552. > static int encode_test_init(struct evp_test *t, const char *encoding)
1553. {
1554. struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata));
test/evp_test.c:1554:5:
1552. static int encode_test_init(struct evp_test *t, const char *encoding)
1553. {
1554. > struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata));
1555.
1556. if (strcmp(encoding, "canonical") == 0) {
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking false branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
test/evp_test.c:1556:9: Taking false branch
1554. struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata));
1555.
1556. if (strcmp(encoding, "canonical") == 0) {
^
1557. edata->encoding = BASE64_CANONICAL_ENCODING;
1558. } else if (strcmp(encoding, "valid") == 0) {
test/evp_test.c:1558:16: Taking false branch
1556. if (strcmp(encoding, "canonical") == 0) {
1557. edata->encoding = BASE64_CANONICAL_ENCODING;
1558. } else if (strcmp(encoding, "valid") == 0) {
^
1559. edata->encoding = BASE64_VALID_ENCODING;
1560. } else if (strcmp(encoding, "invalid") == 0) {
test/evp_test.c:1560:16: Taking true branch
1558. } else if (strcmp(encoding, "valid") == 0) {
1559. edata->encoding = BASE64_VALID_ENCODING;
1560. } else if (strcmp(encoding, "invalid") == 0) {
^
1561. edata->encoding = BASE64_INVALID_ENCODING;
1562. t->expected_err = OPENSSL_strdup("DECODE_ERROR");
test/evp_test.c:1561:9:
1559. edata->encoding = BASE64_VALID_ENCODING;
1560. } else if (strcmp(encoding, "invalid") == 0) {
1561. > edata->encoding = BASE64_INVALID_ENCODING;
1562. t->expected_err = OPENSSL_strdup("DECODE_ERROR");
1563. if (t->expected_err == NULL)
| https://github.com/openssl/openssl/blob/928623825cc59e272e2031cd3f07c5b7bbd605d4/test/evp_test.c/#L1561 |
d2a_code_trace_data_41546 | 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:2642: error: Null Dereference
pointer `pb` last assigned on line 2630 could be null and is dereferenced by call to `avio_close()` at line 2642, column 5.
libavformat/utils.c:2623:1: start of procedure avformat_close_input()
2621. }
2622.
2623. void avformat_close_input(AVFormatContext **ps)
^
2624. {
2625. AVFormatContext *s = *ps;
libavformat/utils.c:2625:5:
2623. void avformat_close_input(AVFormatContext **ps)
2624. {
2625. AVFormatContext *s = *ps;
^
2626. AVIOContext *pb = s->pb;
2627.
libavformat/utils.c:2626:5:
2624. {
2625. AVFormatContext *s = *ps;
2626. AVIOContext *pb = s->pb;
^
2627.
2628. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
libavformat/utils.c:2628:10: Taking true branch
2626. AVIOContext *pb = s->pb;
2627.
2628. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
^
2629. (s->flags & AVFMT_FLAG_CUSTOM_IO))
2630. pb = NULL;
libavformat/utils.c:2628:24: Taking false branch
2626. AVIOContext *pb = s->pb;
2627.
2628. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
^
2629. (s->flags & AVFMT_FLAG_CUSTOM_IO))
2630. pb = NULL;
libavformat/utils.c:2629:10: Taking true branch
2627.
2628. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
2629. (s->flags & AVFMT_FLAG_CUSTOM_IO))
^
2630. pb = NULL;
2631.
libavformat/utils.c:2630:9:
2628. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
2629. (s->flags & AVFMT_FLAG_CUSTOM_IO))
2630. pb = NULL;
^
2631.
2632. flush_packet_queue(s);
libavformat/utils.c:2632:5: Skipping flush_packet_queue(): empty list of specs
2630. pb = NULL;
2631.
2632. flush_packet_queue(s);
^
2633.
2634. if (s->iformat)
libavformat/utils.c:2634:9: Taking true branch
2632. flush_packet_queue(s);
2633.
2634. if (s->iformat)
^
2635. if (s->iformat->read_close)
2636. s->iformat->read_close(s);
libavformat/utils.c:2635:13: Taking true branch
2633.
2634. if (s->iformat)
2635. if (s->iformat->read_close)
^
2636. s->iformat->read_close(s);
2637.
libavformat/utils.c:2636:13: Skipping __function_pointer__(): unresolved function pointer
2634. if (s->iformat)
2635. if (s->iformat->read_close)
2636. s->iformat->read_close(s);
^
2637.
2638. avformat_free_context(s);
libavformat/utils.c:2638:5: Skipping avformat_free_context(): empty list of specs
2636. s->iformat->read_close(s);
2637.
2638. avformat_free_context(s);
^
2639.
2640. *ps = NULL;
libavformat/utils.c:2640:5:
2638. avformat_free_context(s);
2639.
2640. *ps = NULL;
^
2641.
2642. avio_close(pb);
libavformat/utils.c:2642:5:
2640. *ps = NULL;
2641.
2642. avio_close(pb);
^
2643. }
2644.
libavformat/aviobuf.c:800:1: start of procedure avio_close()
798. }
799.
800. int avio_close(AVIOContext *s)
^
801. {
802. URLContext *h;
libavformat/aviobuf.c:804:10: Taking false branch
802. URLContext *h;
803.
804. if (!s)
^
805. return 0;
806.
libavformat/aviobuf.c:807:5:
805. return 0;
806.
807. avio_flush(s);
^
808. h = s->opaque;
809. 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/1eb57e1d9b59db0aa63348c21bf3290bd3f5efcb/libavformat/utils.c/#L2642 |
d2a_code_trace_data_41547 | BIGNUM *SRP_Calc_client_key(BIGNUM *N, BIGNUM *B, BIGNUM *g, BIGNUM *x,
BIGNUM *a, BIGNUM *u)
{
BIGNUM *tmp = NULL, *tmp2 = NULL, *tmp3 = NULL, *k = NULL, *K = NULL;
BN_CTX *bn_ctx;
if (u == NULL || B == NULL || N == NULL || g == NULL || x == NULL
|| a == NULL || (bn_ctx = BN_CTX_new()) == NULL)
return NULL;
if ((tmp = BN_new()) == NULL ||
(tmp2 = BN_new()) == NULL ||
(tmp3 = BN_new()) == NULL ||
(K = BN_new()) == NULL)
goto err;
if (!BN_mod_exp(tmp, g, x, N, bn_ctx))
goto err;
if ((k = srp_Calc_k(N, g)) == NULL)
goto err;
if (!BN_mod_mul(tmp2, tmp, k, N, bn_ctx))
goto err;
if (!BN_mod_sub(tmp, B, tmp2, N, bn_ctx))
goto err;
if (!BN_mod_mul(tmp3, u, x, N, bn_ctx))
goto err;
if (!BN_mod_add(tmp2, a, tmp3, N, bn_ctx))
goto err;
if (!BN_mod_exp(K, tmp, tmp2, N, bn_ctx))
goto err;
err:
BN_CTX_free(bn_ctx);
BN_clear_free(tmp);
BN_clear_free(tmp2);
BN_clear_free(tmp3);
BN_free(k);
return K;
}
crypto/srp/srp_lib.c:290: error: MEMORY_LEAK
memory dynamically allocated by call to `BN_new()` at line 267, column 16 is not reachable after line 290, column 5.
Showing all 172 steps of the trace
crypto/srp/srp_lib.c:257:1: start of procedure SRP_Calc_client_key()
255. }
256.
257. > BIGNUM *SRP_Calc_client_key(BIGNUM *N, BIGNUM *B, BIGNUM *g, BIGNUM *x,
258. BIGNUM *a, BIGNUM *u)
259. {
crypto/srp/srp_lib.c:260:5:
258. BIGNUM *a, BIGNUM *u)
259. {
260. > BIGNUM *tmp = NULL, *tmp2 = NULL, *tmp3 = NULL, *k = NULL, *K = NULL;
261. BN_CTX *bn_ctx;
262.
crypto/srp/srp_lib.c:263:9: Taking false branch
261. BN_CTX *bn_ctx;
262.
263. if (u == NULL || B == NULL || N == NULL || g == NULL || x == NULL
^
264. || a == NULL || (bn_ctx = BN_CTX_new()) == NULL)
265. return NULL;
crypto/srp/srp_lib.c:263:22: Taking false branch
261. BN_CTX *bn_ctx;
262.
263. if (u == NULL || B == NULL || N == NULL || g == NULL || x == NULL
^
264. || a == NULL || (bn_ctx = BN_CTX_new()) == NULL)
265. return NULL;
crypto/srp/srp_lib.c:263:35: Taking false branch
261. BN_CTX *bn_ctx;
262.
263. if (u == NULL || B == NULL || N == NULL || g == NULL || x == NULL
^
264. || a == NULL || (bn_ctx = BN_CTX_new()) == NULL)
265. return NULL;
crypto/srp/srp_lib.c:263:48: Taking false branch
261. BN_CTX *bn_ctx;
262.
263. if (u == NULL || B == NULL || N == NULL || g == NULL || x == NULL
^
264. || a == NULL || (bn_ctx = BN_CTX_new()) == NULL)
265. return NULL;
crypto/srp/srp_lib.c:263:61: Taking false branch
261. BN_CTX *bn_ctx;
262.
263. if (u == NULL || B == NULL || N == NULL || g == NULL || x == NULL
^
264. || a == NULL || (bn_ctx = BN_CTX_new()) == NULL)
265. return NULL;
crypto/srp/srp_lib.c:264:12: Taking false branch
262.
263. if (u == NULL || B == NULL || N == NULL || g == NULL || x == NULL
264. || a == NULL || (bn_ctx = BN_CTX_new()) == NULL)
^
265. return NULL;
266.
crypto/srp/srp_lib.c:264:25:
262.
263. if (u == NULL || B == NULL || N == NULL || g == NULL || x == NULL
264. > || a == NULL || (bn_ctx = BN_CTX_new()) == NULL)
265. return NULL;
266.
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/srp/srp_lib.c:264:25: Taking false branch
262.
263. if (u == NULL || B == NULL || N == NULL || g == NULL || x == NULL
264. || a == NULL || (bn_ctx = BN_CTX_new()) == NULL)
^
265. return NULL;
266.
crypto/srp/srp_lib.c:267:9:
265. return NULL;
266.
267. > if ((tmp = BN_new()) == NULL ||
268. (tmp2 = BN_new()) == NULL ||
269. (tmp3 = BN_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/srp/srp_lib.c:267:9: Taking false branch
265. return NULL;
266.
267. if ((tmp = BN_new()) == NULL ||
^
268. (tmp2 = BN_new()) == NULL ||
269. (tmp3 = BN_new()) == NULL ||
crypto/srp/srp_lib.c:268:9:
266.
267. if ((tmp = BN_new()) == NULL ||
268. > (tmp2 = BN_new()) == NULL ||
269. (tmp3 = BN_new()) == NULL ||
270. (K = BN_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/srp/srp_lib.c:268:9: Taking false branch
266.
267. if ((tmp = BN_new()) == NULL ||
268. (tmp2 = BN_new()) == NULL ||
^
269. (tmp3 = BN_new()) == NULL ||
270. (K = BN_new()) == NULL)
crypto/srp/srp_lib.c:269:9:
267. if ((tmp = BN_new()) == NULL ||
268. (tmp2 = BN_new()) == NULL ||
269. > (tmp3 = BN_new()) == NULL ||
270. (K = BN_new()) == NULL)
271. goto err;
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
crypto/srp/srp_lib.c:269:9: Taking false branch
267. if ((tmp = BN_new()) == NULL ||
268. (tmp2 = BN_new()) == NULL ||
269. (tmp3 = BN_new()) == NULL ||
^
270. (K = BN_new()) == NULL)
271. goto err;
crypto/srp/srp_lib.c:270:9:
268. (tmp2 = BN_new()) == NULL ||
269. (tmp3 = BN_new()) == NULL ||
270. > (K = BN_new()) == NULL)
271. goto err;
272.
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/srp/srp_lib.c:270:9: Taking false branch
268. (tmp2 = BN_new()) == NULL ||
269. (tmp3 = BN_new()) == NULL ||
270. (K = BN_new()) == NULL)
^
271. goto err;
272.
crypto/srp/srp_lib.c:273:10: Taking true branch
271. goto err;
272.
273. if (!BN_mod_exp(tmp, g, x, N, bn_ctx))
^
274. goto err;
275. if ((k = srp_Calc_k(N, g)) == NULL)
crypto/srp/srp_lib.c:288:2:
286. goto err;
287.
288. > err:
289. BN_CTX_free(bn_ctx);
290. BN_clear_free(tmp);
crypto/srp/srp_lib.c:289:5:
287.
288. err:
289. > BN_CTX_free(bn_ctx);
290. BN_clear_free(tmp);
291. BN_clear_free(tmp2);
crypto/bn/bn_ctx.c:212:1: start of procedure BN_CTX_free()
210. }
211.
212. > void BN_CTX_free(BN_CTX *ctx)
213. {
214. if (ctx == NULL)
crypto/bn/bn_ctx.c:214:9: Taking false branch
212. void BN_CTX_free(BN_CTX *ctx)
213. {
214. if (ctx == NULL)
^
215. return;
216. #ifdef BN_CTX_DEBUG
crypto/bn/bn_ctx.c:231:5:
229. }
230. #endif
231. > BN_STACK_finish(&ctx->stack);
232. BN_POOL_finish(&ctx->pool);
233. OPENSSL_free(ctx);
crypto/bn/bn_ctx.c:300:1: start of procedure BN_STACK_finish()
298. }
299.
300. > static void BN_STACK_finish(BN_STACK *st)
301. {
302. OPENSSL_free(st->indexes);
crypto/bn/bn_ctx.c:302:5:
300. static void BN_STACK_finish(BN_STACK *st)
301. {
302. > OPENSSL_free(st->indexes);
303. st->indexes = NULL;
304. }
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/bn/bn_ctx.c:303:5:
301. {
302. OPENSSL_free(st->indexes);
303. > st->indexes = NULL;
304. }
305.
crypto/bn/bn_ctx.c:304:1: return from a call to BN_STACK_finish
302. OPENSSL_free(st->indexes);
303. st->indexes = NULL;
304. > }
305.
306.
crypto/bn/bn_ctx.c:232:5:
230. #endif
231. BN_STACK_finish(&ctx->stack);
232. > BN_POOL_finish(&ctx->pool);
233. OPENSSL_free(ctx);
234. }
crypto/bn/bn_ctx.c:341:1: start of procedure BN_POOL_finish()
339. }
340.
341. > static void BN_POOL_finish(BN_POOL *p)
342. {
343. unsigned int loop;
crypto/bn/bn_ctx.c:346:12: Loop condition is false. Leaving loop
344. BIGNUM *bn;
345.
346. while (p->head) {
^
347. for (loop = 0, bn = p->head->vals; loop++ < BN_CTX_POOL_SIZE; bn++)
348. if (bn->d)
crypto/bn/bn_ctx.c:354:1: return from a call to BN_POOL_finish
352. p->head = p->current;
353. }
354. > }
355.
356.
crypto/bn/bn_ctx.c:233:5:
231. BN_STACK_finish(&ctx->stack);
232. BN_POOL_finish(&ctx->pool);
233. > OPENSSL_free(ctx);
234. }
235.
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/bn/bn_ctx.c:234:1: return from a call to BN_CTX_free
232. BN_POOL_finish(&ctx->pool);
233. OPENSSL_free(ctx);
234. > }
235.
236. void BN_CTX_start(BN_CTX *ctx)
crypto/srp/srp_lib.c:290:5:
288. err:
289. BN_CTX_free(bn_ctx);
290. > BN_clear_free(tmp);
291. BN_clear_free(tmp2);
292. BN_clear_free(tmp3);
crypto/bn/bn_lib.c:234:1: start of procedure BN_clear_free()
232.
233.
234. > void BN_clear_free(BIGNUM *a)
235. {
236. int i;
crypto/bn/bn_lib.c:238:9: Taking false branch
236. int i;
237.
238. if (a == NULL)
^
239. return;
240. bn_check_top(a);
crypto/bn/bn_lib.c:241:9: Taking true branch
239. return;
240. bn_check_top(a);
241. if (a->d != NULL) {
^
242. OPENSSL_cleanse(a->d, a->dmax * sizeof(a->d[0]));
243. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
crypto/bn/bn_lib.c:242:9: Skipping OPENSSL_cleanse(): method has no implementation
240. bn_check_top(a);
241. if (a->d != NULL) {
242. OPENSSL_cleanse(a->d, a->dmax * sizeof(a->d[0]));
^
243. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
244. bn_free_d(a);
crypto/bn/bn_lib.c:243:14:
241. if (a->d != NULL) {
242. OPENSSL_cleanse(a->d, a->dmax * sizeof(a->d[0]));
243. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
244. bn_free_d(a);
245. }
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:243:14: Taking false branch
241. if (a->d != NULL) {
242. OPENSSL_cleanse(a->d, a->dmax * sizeof(a->d[0]));
243. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
^
244. bn_free_d(a);
245. }
crypto/bn/bn_lib.c:246:5:
244. bn_free_d(a);
245. }
246. > i = BN_get_flags(a, BN_FLG_MALLOCED);
247. OPENSSL_cleanse(a, sizeof(*a));
248. if (i)
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:247:5: Skipping OPENSSL_cleanse(): method has no implementation
245. }
246. i = BN_get_flags(a, BN_FLG_MALLOCED);
247. OPENSSL_cleanse(a, sizeof(*a));
^
248. if (i)
249. OPENSSL_free(a);
crypto/bn/bn_lib.c:248:9: Taking false branch
246. i = BN_get_flags(a, BN_FLG_MALLOCED);
247. OPENSSL_cleanse(a, sizeof(*a));
248. if (i)
^
249. OPENSSL_free(a);
250. }
crypto/bn/bn_lib.c:248:5:
246. i = BN_get_flags(a, BN_FLG_MALLOCED);
247. OPENSSL_cleanse(a, sizeof(*a));
248. > if (i)
249. OPENSSL_free(a);
250. }
crypto/bn/bn_lib.c:250:1: return from a call to BN_clear_free
248. if (i)
249. OPENSSL_free(a);
250. > }
251.
252. void BN_free(BIGNUM *a)
| https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/srp/srp_lib.c/#L290 |
d2a_code_trace_data_41548 | static int opt_preset(const char *opt, const char *arg)
{
FILE *f=NULL;
char filename[1000], tmp[1000], tmp2[1000], line[1000];
char *codec_name = *opt == 'v' ? video_codec_name :
*opt == 'a' ? audio_codec_name :
subtitle_codec_name;
if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
fprintf(stderr, "File for preset '%s' not found\n", arg);
ffmpeg_exit(1);
}
while(!feof(f)){
int e= fscanf(f, "%999[^\n]\n", line) - 1;
if(line[0] == '#' && !e)
continue;
e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2;
if(e){
fprintf(stderr, "%s: Invalid syntax: '%s'\n", filename, line);
ffmpeg_exit(1);
}
if(!strcmp(tmp, "acodec")){
opt_audio_codec(tmp2);
}else if(!strcmp(tmp, "vcodec")){
opt_video_codec(tmp2);
}else if(!strcmp(tmp, "scodec")){
opt_subtitle_codec(tmp2);
}else if(opt_default(tmp, tmp2) < 0){
fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2);
ffmpeg_exit(1);
}
}
fclose(f);
return 0;
}
ffmpeg.c:4160: error: Null Dereference
pointer `f` last assigned on line 4155 could be null and is dereferenced by call to `feof()` at line 4160, column 12.
ffmpeg.c:4147:1: start of procedure opt_preset()
4145. }
4146.
4147. static int opt_preset(const char *opt, const char *arg)
^
4148. {
4149. FILE *f=NULL;
ffmpeg.c:4149:5:
4147. static int opt_preset(const char *opt, const char *arg)
4148. {
4149. FILE *f=NULL;
^
4150. char filename[1000], tmp[1000], tmp2[1000], line[1000];
4151. char *codec_name = *opt == 'v' ? video_codec_name :
ffmpeg.c:4151:24: Condition is false
4149. FILE *f=NULL;
4150. char filename[1000], tmp[1000], tmp2[1000], line[1000];
4151. char *codec_name = *opt == 'v' ? video_codec_name :
^
4152. *opt == 'a' ? audio_codec_name :
4153. subtitle_codec_name;
ffmpeg.c:4152:24: Condition is false
4150. char filename[1000], tmp[1000], tmp2[1000], line[1000];
4151. char *codec_name = *opt == 'v' ? video_codec_name :
4152. *opt == 'a' ? audio_codec_name :
^
4153. subtitle_codec_name;
4154.
ffmpeg.c:4151:24:
4149. FILE *f=NULL;
4150. char filename[1000], tmp[1000], tmp2[1000], line[1000];
4151. char *codec_name = *opt == 'v' ? video_codec_name :
^
4152. *opt == 'a' ? audio_codec_name :
4153. subtitle_codec_name;
ffmpeg.c:4151:5:
4149. FILE *f=NULL;
4150. char filename[1000], tmp[1000], tmp2[1000], line[1000];
4151. char *codec_name = *opt == 'v' ? video_codec_name :
^
4152. *opt == 'a' ? audio_codec_name :
4153. subtitle_codec_name;
ffmpeg.c:4155:64: Condition is false
4153. subtitle_codec_name;
4154.
4155. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
^
4156. fprintf(stderr, "File for preset '%s' not found\n", arg);
4157. ffmpeg_exit(1);
ffmpeg.c:4155:11: Taking true branch
4153. subtitle_codec_name;
4154.
4155. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
^
4156. fprintf(stderr, "File for preset '%s' not found\n", arg);
4157. ffmpeg_exit(1);
ffmpeg.c:4156:9:
4154.
4155. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
4156. fprintf(stderr, "File for preset '%s' not found\n", arg);
^
4157. ffmpeg_exit(1);
4158. }
ffmpeg.c:4157:9: Skipping ffmpeg_exit(): empty list of specs
4155. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
4156. fprintf(stderr, "File for preset '%s' not found\n", arg);
4157. ffmpeg_exit(1);
^
4158. }
4159.
ffmpeg.c:4160:12:
4158. }
4159.
4160. while(!feof(f)){
^
4161. int e= fscanf(f, "%999[^\n]\n", line) - 1;
4162. if(line[0] == '#' && !e)
| https://github.com/libav/libav/blob/2d777bb7a20041ac0564ffef85bf40619af8ccd1/ffmpeg.c/#L4160 |
d2a_code_trace_data_41549 | int show_help(void *optctx, const char *opt, const char *arg)
{
char *topic, *par;
av_log_set_callback(log_callback_help);
topic = av_strdup(arg ? arg : "");
par = strchr(topic, '=');
if (par)
*par++ = 0;
if (!*topic) {
show_help_default(topic, par);
} else if (!strcmp(topic, "decoder")) {
show_help_codec(par, 0);
} else if (!strcmp(topic, "encoder")) {
show_help_codec(par, 1);
} else if (!strcmp(topic, "demuxer")) {
show_help_demuxer(par);
} else if (!strcmp(topic, "muxer")) {
show_help_muxer(par);
#if CONFIG_AVFILTER
} else if (!strcmp(topic, "filter")) {
show_help_filter(par);
#endif
} else {
show_help_default(topic, par);
}
av_freep(&topic);
return 0;
}
cmdutils.c:1350: error: Null Dereference
pointer `topic` last assigned on line 1349 could be null and is dereferenced by call to `strchr()` at line 1350, column 11.
cmdutils.c:1344:1: start of procedure show_help()
1342. #endif
1343.
1344. int show_help(void *optctx, const char *opt, const char *arg)
^
1345. {
1346. char *topic, *par;
cmdutils.c:1347:5:
1345. {
1346. char *topic, *par;
1347. av_log_set_callback(log_callback_help);
^
1348.
1349. topic = av_strdup(arg ? arg : "");
libavutil/log.c:180:1: start of procedure av_log_set_callback()
178. }
179.
180. void av_log_set_callback(void (*callback)(void*, int, const char*, va_list))
^
181. {
182. av_log_callback = callback;
libavutil/log.c:182:5:
180. void av_log_set_callback(void (*callback)(void*, int, const char*, va_list))
181. {
182. av_log_callback = callback;
^
183. }
184.
libavutil/log.c:183:1: return from a call to av_log_set_callback
181. {
182. av_log_callback = callback;
183. }
^
184.
185. static void missing_feature_sample(int sample, void *avc, const char *msg,
cmdutils.c:1349:23: Condition is true
1347. av_log_set_callback(log_callback_help);
1348.
1349. topic = av_strdup(arg ? arg : "");
^
1350. par = strchr(topic, '=');
1351. if (par)
cmdutils.c:1349:5:
1347. av_log_set_callback(log_callback_help);
1348.
1349. topic = av_strdup(arg ? arg : "");
^
1350. par = strchr(topic, '=');
1351. if (par)
libavutil/mem.c:212:1: start of procedure av_strdup()
210. }
211.
212. char *av_strdup(const char *s)
^
213. {
214. char *ptr = NULL;
libavutil/mem.c:214:5:
212. char *av_strdup(const char *s)
213. {
214. char *ptr = NULL;
^
215. if (s) {
216. int len = strlen(s) + 1;
libavutil/mem.c:215:9: Taking true branch
213. {
214. char *ptr = NULL;
215. if (s) {
^
216. int len = strlen(s) + 1;
217. ptr = av_realloc(NULL, len);
libavutil/mem.c:216:9:
214. char *ptr = NULL;
215. if (s) {
216. int len = strlen(s) + 1;
^
217. ptr = av_realloc(NULL, len);
218. if (ptr)
libavutil/mem.c:217:9:
215. if (s) {
216. int len = strlen(s) + 1;
217. ptr = av_realloc(NULL, len);
^
218. if (ptr)
219. memcpy(ptr, s, len);
libavutil/mem.c:116:1: start of procedure av_realloc()
114. }
115.
116. void *av_realloc(void *ptr, size_t size)
^
117. {
118. #if CONFIG_MEMALIGN_HACK
libavutil/mem.c:123:9: Taking false branch
121.
122. /* let's disallow possibly ambiguous cases */
123. if (size > (INT_MAX - 16))
^
124. return NULL;
125.
libavutil/mem.c:135:5:
133. return _aligned_realloc(ptr, size, 32);
134. #else
135. return realloc(ptr, size);
^
136. #endif
137. }
libavutil/mem.c:137:1: return from a call to av_realloc
135. return realloc(ptr, size);
136. #endif
137. }
^
138.
139. int av_reallocp(void *ptr, size_t size)
libavutil/mem.c:218:13: Taking false branch
216. int len = strlen(s) + 1;
217. ptr = av_realloc(NULL, len);
218. if (ptr)
^
219. memcpy(ptr, s, len);
220. }
libavutil/mem.c:221:5:
219. memcpy(ptr, s, len);
220. }
221. return ptr;
^
222. }
223.
libavutil/mem.c:222:1: return from a call to av_strdup
220. }
221. return ptr;
222. }
^
223.
224. static void fill16(uint8_t *dst, int len)
cmdutils.c:1350:5:
1348.
1349. topic = av_strdup(arg ? arg : "");
1350. par = strchr(topic, '=');
^
1351. if (par)
1352. *par++ = 0;
| https://github.com/libav/libav/blob/72072bf9de3241848ea86f68d2297b7a5d6ad49b/cmdutils.c/#L1350 |
d2a_code_trace_data_41550 | static int ssl3_send_client_key_exchange(SSL *s)
{
unsigned char *p,*d;
int n;
unsigned long l;
#ifndef NO_RSA
unsigned char *q;
EVP_PKEY *pkey=NULL;
#endif
#ifndef NO_KRB5
KSSL_ERR kssl_err;
#endif
if (s->state == SSL3_ST_CW_KEY_EXCH_A)
{
d=(unsigned char *)s->init_buf->data;
p= &(d[4]);
l=s->s3->tmp.new_cipher->algorithms;
if (0) {}
#ifndef NO_RSA
else if (l & SSL_kRSA)
{
RSA *rsa;
unsigned char tmp_buf[SSL_MAX_MASTER_KEY_LENGTH];
if (s->session->sess_cert->peer_rsa_tmp != NULL)
rsa=s->session->sess_cert->peer_rsa_tmp;
else
{
pkey=X509_get_pubkey(s->session->sess_cert->peer_pkeys[SSL_PKEY_RSA_ENC].x509);
if ((pkey == NULL) ||
(pkey->type != EVP_PKEY_RSA) ||
(pkey->pkey.rsa == NULL))
{
SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,SSL_R_INTERNAL_ERROR);
goto err;
}
rsa=pkey->pkey.rsa;
EVP_PKEY_free(pkey);
}
tmp_buf[0]=s->client_version>>8;
tmp_buf[1]=s->client_version&0xff;
if (RAND_bytes(&(tmp_buf[2]),SSL_MAX_MASTER_KEY_LENGTH-2) <= 0)
goto err;
s->session->master_key_length=SSL_MAX_MASTER_KEY_LENGTH;
q=p;
if (s->version > SSL3_VERSION)
p+=2;
n=RSA_public_encrypt(SSL_MAX_MASTER_KEY_LENGTH,
tmp_buf,p,rsa,RSA_PKCS1_PADDING);
#ifdef PKCS1_CHECK
if (s->options & SSL_OP_PKCS1_CHECK_1) p[1]++;
if (s->options & SSL_OP_PKCS1_CHECK_2) tmp_buf[0]=0x70;
#endif
if (n <= 0)
{
SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,SSL_R_BAD_RSA_ENCRYPT);
goto err;
}
if (s->version > SSL3_VERSION)
{
s2n(n,q);
n+=2;
}
s->session->master_key_length=
s->method->ssl3_enc->generate_master_secret(s,
s->session->master_key,
tmp_buf,SSL_MAX_MASTER_KEY_LENGTH);
memset(tmp_buf,0,SSL_MAX_MASTER_KEY_LENGTH);
}
#endif
#ifndef NO_KRB5
else if (l & SSL_kKRB5)
{
krb5_error_code krb5rc;
KSSL_CTX *kssl_ctx = s->kssl_ctx;
krb5_data krb5_ap_req;
#ifdef KSSL_DEBUG
printf("ssl3_send_client_key_exchange(%lx & %lx)\n",
l, SSL_kKRB5);
#endif
krb5rc = kssl_cget_tkt(kssl_ctx, &krb5_ap_req,
&kssl_err);
#ifdef KSSL_DEBUG
{
printf("kssl_cget_tkt rtn %d\n", krb5rc);
kssl_ctx_show(kssl_ctx);
if (krb5rc && kssl_err.text)
printf("kssl_cget_tkt kssl_err=%s\n", kssl_err.text);
}
#endif
if (krb5rc)
{
ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_HANDSHAKE_FAILURE);
SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, kssl_err.reason);
goto err;
}
n = krb5_ap_req.length;
memcpy(p, krb5_ap_req.data, krb5_ap_req.length);
if (krb5_ap_req.data)
kssl_krb5_free_data_contents(NULL,&krb5_ap_req);
s->session->master_key_length=
s->method->ssl3_enc->generate_master_secret(s,
s->session->master_key, kssl_ctx->key,kssl_ctx->length);
}
#endif
#ifndef NO_DH
else if (l & (SSL_kEDH|SSL_kDHr|SSL_kDHd))
{
DH *dh_srvr,*dh_clnt;
if (s->session->sess_cert->peer_dh_tmp != NULL)
dh_srvr=s->session->sess_cert->peer_dh_tmp;
else
{
ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_HANDSHAKE_FAILURE);
SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,SSL_R_UNABLE_TO_FIND_DH_PARAMETERS);
goto err;
}
if ((dh_clnt=DHparams_dup(dh_srvr)) == NULL)
{
SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_DH_LIB);
goto err;
}
if (!DH_generate_key(dh_clnt))
{
SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_DH_LIB);
goto err;
}
n=DH_compute_key(p,dh_srvr->pub_key,dh_clnt);
if (n <= 0)
{
SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_DH_LIB);
goto err;
}
s->session->master_key_length=
s->method->ssl3_enc->generate_master_secret(s,
s->session->master_key,p,n);
memset(p,0,n);
n=BN_num_bytes(dh_clnt->pub_key);
s2n(n,p);
BN_bn2bin(dh_clnt->pub_key,p);
n+=2;
DH_free(dh_clnt);
}
#endif
else
{
ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_HANDSHAKE_FAILURE);
SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,SSL_R_INTERNAL_ERROR);
goto err;
}
*(d++)=SSL3_MT_CLIENT_KEY_EXCHANGE;
l2n3(n,d);
s->state=SSL3_ST_CW_KEY_EXCH_B;
s->init_num=n+4;
s->init_off=0;
}
return(ssl3_do_write(s,SSL3_RT_HANDSHAKE));
err:
return(-1);
}
ssl/s3_clnt.c:1557: error: UNINITIALIZED_VALUE
The value read from n was never initialized.
Showing all 1 steps of the trace
ssl/s3_clnt.c:1557:3:
1555.
1556. *(d++)=SSL3_MT_CLIENT_KEY_EXCHANGE;
1557. > l2n3(n,d);
1558.
1559. s->state=SSL3_ST_CW_KEY_EXCH_B;
| https://github.com/openssl/openssl/blob/f9b3bff6f7e38960bb87a5623fbcbc45ee952c49/ssl/s3_clnt.c/#L1557 |
d2a_code_trace_data_41551 | 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:98: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned64 by call to `SSL_free`.
Showing all 17 steps of the trace
test/sslapitest.c:84:10: Call
82. }
83.
84. if (!create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL, NULL)) {
^
85. printf("Unable to create SSL objects\n");
86. goto end;
test/ssltestlib.c:575:21: Call
573.
574. if (*sssl == NULL)
575. serverssl = SSL_new(serverctx);
^
576. else
577. serverssl = *sssl;
ssl/ssl_lib.c:520:1: Parameter `ctx->sessions->num_items`
518. }
519.
520. > SSL *SSL_new(SSL_CTX *ctx)
521. {
522. SSL *s;
test/sslapitest.c:98:5: Call
96. end:
97. X509_free(chaincert);
98. SSL_free(serverssl);
^
99. SSL_free(clientssl);
100. SSL_CTX_free(sctx);
ssl/ssl_lib.c:962:1: Parameter `s->initial_ctx->sessions->num_items`
960. }
961.
962. > void SSL_free(SSL *s)
963. {
964. int i;
ssl/ssl_lib.c:992:9: Call
990. /* Make the next call work :-) */
991. if (s->session != NULL) {
992. ssl_clear_bad_session(s);
^
993. SSL_SESSION_free(s->session);
994. }
ssl/ssl_sess.c:1008:1: Parameter `s->initial_ctx->sessions->num_items`
1006. }
1007.
1008. > int ssl_clear_bad_session(SSL *s)
1009. {
1010. if ((s->session != NULL) &&
ssl/ssl_sess.c:1013:9: Call
1011. !(s->shutdown & SSL_SENT_SHUTDOWN) &&
1012. !(SSL_in_init(s) || SSL_in_before(s))) {
1013. SSL_CTX_remove_session(s->session_ctx, s->session);
^
1014. return (1);
1015. } else
ssl/ssl_sess.c:697:1: Parameter `ctx->sessions->num_items`
695. }
696.
697. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
698. {
699. return remove_session_lock(ctx, c, 1);
ssl/ssl_sess.c:699:12: Call
697. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
698. {
699. return remove_session_lock(ctx, c, 1);
^
700. }
701.
ssl/ssl_sess.c:702:1: Parameter `ctx->sessions->num_items`
700. }
701.
702. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
703. {
704. SSL_SESSION *r;
ssl/ssl_sess.c:712:17: Call
710. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) {
711. ret = 1;
712. r = lh_SSL_SESSION_delete(ctx->sessions, c);
^
713. SSL_SESSION_list_remove(ctx, c);
714. }
ssl/ssl_locl.h:596:1: Parameter `lh->num_items`
594. };
595.
596. > DEFINE_LHASH_OF(SSL_SESSION);
597. /* Needed in ssl_cert.c */
598. DEFINE_LHASH_OF(X509_NAME);
ssl/ssl_locl.h:596:1: Call
594. };
595.
596. > DEFINE_LHASH_OF(SSL_SESSION);
597. /* Needed in ssl_cert.c */
598. 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/a6972f346248fbc37e42056bb943fae0896a2967/crypto/lhash/lhash.c/#L123 |
d2a_code_trace_data_41552 | int BN_num_bits_word(BN_ULONG l)
{
BN_ULONG x, mask;
int bits = (l != 0);
#if BN_BITS2 > 32
x = l >> 32;
mask = (0 - x) & BN_MASK2;
mask = (0 - (mask >> (BN_BITS2 - 1)));
bits += 32 & mask;
l ^= (x ^ l) & mask;
#endif
x = l >> 16;
mask = (0 - x) & BN_MASK2;
mask = (0 - (mask >> (BN_BITS2 - 1)));
bits += 16 & mask;
l ^= (x ^ l) & mask;
x = l >> 8;
mask = (0 - x) & BN_MASK2;
mask = (0 - (mask >> (BN_BITS2 - 1)));
bits += 8 & mask;
l ^= (x ^ l) & mask;
x = l >> 4;
mask = (0 - x) & BN_MASK2;
mask = (0 - (mask >> (BN_BITS2 - 1)));
bits += 4 & mask;
l ^= (x ^ l) & mask;
x = l >> 2;
mask = (0 - x) & BN_MASK2;
mask = (0 - (mask >> (BN_BITS2 - 1)));
bits += 2 & mask;
l ^= (x ^ l) & mask;
x = l >> 1;
mask = (0 - x) & BN_MASK2;
mask = (0 - (mask >> (BN_BITS2 - 1)));
bits += 1 & mask;
return bits;
}
crypto/ec/ecdsa_ossl.c:464: error: INTEGER_OVERFLOW_L2
(0 - [0, max(1, `eckey->group->order->top`)]):unsigned64 by call to `EC_POINT_mul`.
Showing all 28 steps of the trace
crypto/ec/ecdsa_ossl.c:377:1: Parameter `eckey->group->order->top`
375. }
376.
377. > int ossl_ecdsa_verify_sig(const unsigned char *dgst, int dgst_len,
378. const ECDSA_SIG *sig, EC_KEY *eckey)
379. {
crypto/ec/ecdsa_ossl.c:429:10: Call
427. }
428. /* calculate tmp1 = inv(S) mod order */
429. if (!ec_group_do_inverse_ord(group, u2, sig->s, ctx)) {
^
430. ECerr(EC_F_OSSL_ECDSA_VERIFY_SIG, ERR_R_BN_LIB);
431. 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/ecdsa_ossl.c:434:9: Call
432. }
433. /* digest -> m */
434. i = BN_num_bits(order);
^
435. /*
436. * 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:450:10: Call
448. }
449. /* u1 = m * tmp mod order */
450. if (!BN_mod_mul(u1, m, u2, order, ctx)) {
^
451. ECerr(EC_F_OSSL_ECDSA_VERIFY_SIG, ERR_R_BN_LIB);
452. goto err;
crypto/bn/bn_mod.c:73:1: Parameter `m->top`
71.
72. /* slow but works */
73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
74. BN_CTX *ctx)
75. {
crypto/ec/ecdsa_ossl.c:455:10: Call
453. }
454. /* u2 = r * w mod q */
455. if (!BN_mod_mul(u2, sig->r, u2, order, ctx)) {
^
456. ECerr(EC_F_OSSL_ECDSA_VERIFY_SIG, ERR_R_BN_LIB);
457. goto err;
crypto/bn/bn_mod.c:73:1: Parameter `m->top`
71.
72. /* slow but works */
73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
74. BN_CTX *ctx)
75. {
crypto/ec/ecdsa_ossl.c:464:10: Call
462. goto err;
463. }
464. if (!EC_POINT_mul(group, point, u1, pub_key, u2, ctx)) {
^
465. ECerr(EC_F_OSSL_ECDSA_VERIFY_SIG, ERR_R_EC_LIB);
466. goto err;
crypto/ec/ec_lib.c:929:1: Parameter `group->order->top`
927. }
928.
929. > int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar,
930. const EC_POINT *point, const BIGNUM *p_scalar, BN_CTX *ctx)
931. {
crypto/ec/ec_lib.c:940:12: Call
938. scalars[0] = p_scalar;
939.
940. return EC_POINTs_mul(group, r, g_scalar,
^
941. (point != NULL
942. && p_scalar != NULL), points, scalars, ctx);
crypto/ec/ec_lib.c:918:1: Parameter `group->order->top`
916. */
917.
918. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
919. size_t num, const EC_POINT *points[],
920. const BIGNUM *scalars[], BN_CTX *ctx)
crypto/ec/ec_lib.c:924:16: Call
922. if (group->meth->mul == 0)
923. /* use default */
924. return ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx);
^
925.
926. return group->meth->mul(group, r, scalar, num, points, scalars, ctx);
crypto/ec/ec_mult.c:354:1: Parameter `group->order->top`
352. * in the addition if scalar != NULL
353. */
354. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
355. size_t num, const EC_POINT *points[], const BIGNUM *scalars[],
356. BN_CTX *ctx)
crypto/ec/ec_mult.c:392:10: Call
390. }
391.
392. if (!BN_is_zero(group->order) && !BN_is_zero(group->cofactor)) {
^
393. /*-
394. * Handle the common cases where the scalar is secret, enforcing a constant
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/ec_mult.c:406:20: Call
404. * constant time version.
405. */
406. return ec_mul_consttime(group, r, scalar, NULL, ctx);
^
407. }
408. if ((scalar == NULL) && (num == 1)) {
crypto/ec/ec_mult.c:131:1: Parameter `group->order->top`
129. * Returns 1 on success, 0 otherwise.
130. */
131. > static int ec_mul_consttime(const EC_GROUP *group, EC_POINT *r,
132. const BIGNUM *scalar, const EC_POINT *point,
133. BN_CTX *ctx)
crypto/ec/ec_mult.c:165:23: Call
163. lambda = BN_CTX_get(ctx);
164. k = BN_CTX_get(ctx);
165. if (k == NULL || !BN_mul(cardinality, group->order, group->cofactor, ctx))
^
166. goto err;
167.
crypto/bn/bn_mul.c:497:1: Parameter `a->top`
495. #endif /* BN_RECURSION */
496.
497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
498. {
499. int ret = 0;
crypto/bn/bn_mul.c:514:5: Assignment
512. bn_check_top(r);
513.
514. al = a->top;
^
515. bl = b->top;
516.
crypto/bn/bn_mul.c:561:21: Call
559. */
560. if (i >= 0) {
561. j = BN_num_bits_word((BN_ULONG)al);
^
562. }
563. if (i == -1) {
crypto/bn/bn_lib.c:89:1: <RHS trace>
87. }
88.
89. > int BN_num_bits_word(BN_ULONG l)
90. {
91. BN_ULONG x, mask;
crypto/bn/bn_lib.c:89:1: Parameter `l`
87. }
88.
89. > int BN_num_bits_word(BN_ULONG l)
90. {
91. BN_ULONG x, mask;
crypto/bn/bn_lib.c:95:5: Assignment
93.
94. #if BN_BITS2 > 32
95. x = l >> 32;
^
96. mask = (0 - x) & BN_MASK2;
97. mask = (0 - (mask >> (BN_BITS2 - 1)));
crypto/bn/bn_lib.c:96:5: Binary operation: (0 - [0, max(1, eckey->group->order->top)]):unsigned64 by call to `EC_POINT_mul`
94. #if BN_BITS2 > 32
95. x = l >> 32;
96. mask = (0 - x) & BN_MASK2;
^
97. mask = (0 - (mask >> (BN_BITS2 - 1)));
98. bits += 32 & mask;
| https://github.com/openssl/openssl/blob/a9cf71a3716f8f624b711faa0d5ea391bb26d9f6/crypto/bn/bn_lib.c/#L96 |
d2a_code_trace_data_41553 | static void decode_gain_and_index(QCELPContext *q,
float *gain) {
int i, subframes_count, g1[16];
float slope;
if(q->bitrate >= RATE_QUARTER)
{
switch(q->bitrate)
{
case RATE_FULL: subframes_count = 16; break;
case RATE_HALF: subframes_count = 4; break;
default: subframes_count = 5;
}
for(i=0; i<subframes_count; i++)
{
g1[i] = 4 * q->frame.cbgain[i];
if(q->bitrate == RATE_FULL && !((i+1) & 3))
{
g1[i] += av_clip((g1[i-1] + g1[i-2] + g1[i-3]) / 3 - 6, 0, 32);
}
gain[i] = qcelp_g12ga[g1[i]];
if(q->frame.cbsign[i])
{
gain[i] = -gain[i];
q->frame.cindex[i] = (q->frame.cindex[i]-89) & 127;
}
}
q->prev_g1[0] = g1[i-2];
q->prev_g1[1] = g1[i-1];
q->last_codebook_gain = qcelp_g12ga[g1[i-1]];
if(q->bitrate == RATE_QUARTER)
{
gain[7] = gain[4];
gain[6] = 0.4*gain[3] + 0.6*gain[4];
gain[5] = gain[3];
gain[4] = 0.8*gain[2] + 0.2*gain[3];
gain[3] = 0.2*gain[1] + 0.8*gain[2];
gain[2] = gain[1];
gain[1] = 0.6*gain[0] + 0.4*gain[1];
}
}else
{
if(q->bitrate == RATE_OCTAVE)
{
g1[0] = 2 * q->frame.cbgain[0]
+ av_clip((q->prev_g1[0] + q->prev_g1[1]) / 2 - 5, 0, 54);
subframes_count = 8;
}else
{
assert(q->bitrate == I_F_Q);
g1[0] = q->prev_g1[1];
switch(q->erasure_count)
{
case 1 : break;
case 2 : g1[0] -= 1; break;
case 3 : g1[0] -= 2; break;
default: g1[0] -= 6;
}
if(g1[0] < 0)
g1[0] = 0;
subframes_count = 4;
}
slope = 0.5*(qcelp_g12ga[g1[0]] - q->last_codebook_gain) / subframes_count;
for(i=1; i<=subframes_count; i++)
gain[i-1] = q->last_codebook_gain + slope * i;
q->last_codebook_gain = gain[i-2];
q->prev_g1[0] = q->prev_g1[1];
q->prev_g1[1] = g1[0];
}
}
libavcodec/qcelpdec.c:233: error: Buffer Overrun L3
Offset: [-2, 13] Size: 16.
libavcodec/qcelpdec.c:224:29: <Offset trace>
222. switch(q->bitrate)
223. {
224. case RATE_FULL: subframes_count = 16; break;
^
225. case RATE_HALF: subframes_count = 4; break;
226. default: subframes_count = 5;
libavcodec/qcelpdec.c:224:29: Assignment
222. switch(q->bitrate)
223. {
224. case RATE_FULL: subframes_count = 16; break;
^
225. case RATE_HALF: subframes_count = 4; break;
226. default: subframes_count = 5;
libavcodec/qcelpdec.c:215:1: <Length trace>
213. * TIA/EIA/IS-733 2.4.6.2
214. */
215. static void decode_gain_and_index(QCELPContext *q,
^
216. float *gain) {
217. int i, subframes_count, g1[16];
libavcodec/qcelpdec.c:215:1: Array declaration
213. * TIA/EIA/IS-733 2.4.6.2
214. */
215. static void decode_gain_and_index(QCELPContext *q,
^
216. float *gain) {
217. int i, subframes_count, g1[16];
libavcodec/qcelpdec.c:233:45: Array access: Offset: [-2, 13] Size: 16
231. if(q->bitrate == RATE_FULL && !((i+1) & 3))
232. {
233. g1[i] += av_clip((g1[i-1] + g1[i-2] + g1[i-3]) / 3 - 6, 0, 32);
^
234. }
235.
| https://github.com/libav/libav/blob/ce60c2d133876b2878b724cb512b81d4a149c72e/libavcodec/qcelpdec.c/#L233 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.