id
stringlengths 25
25
| content
stringlengths 649
72.1k
| max_stars_repo_path
stringlengths 91
133
|
|---|---|---|
d2a_code_trace_data_42554
|
static void contract(LHASH *lh)
{
LHASH_NODE **n,*n1,*np;
np=lh->b[lh->p+lh->pmax-1];
lh->b[lh->p+lh->pmax-1]=NULL;
if (lh->p == 0)
{
n=(LHASH_NODE **)OPENSSL_realloc(lh->b,
(unsigned int)(sizeof(LHASH_NODE *)*lh->pmax));
if (n == NULL)
{
lh->error++;
return;
}
lh->num_contract_reallocs++;
lh->num_alloc_nodes/=2;
lh->pmax/=2;
lh->p=lh->pmax-1;
lh->b=n;
}
else
lh->p--;
lh->num_nodes--;
lh->num_contracts++;
n1=lh->b[(int)lh->p];
if (n1 == NULL)
lh->b[(int)lh->p]=np;
else
{
while (n1->next != NULL)
n1=n1->next;
n1->next=np;
}
}
ssl/s3_clnt.c:856: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `ssl3_send_alert`.
Showing all 14 steps of the trace
ssl/s3_clnt.c:696:4: Call
694. int need_cert = 1; /* VRS: 0=> will allow null cert if auth == KRB5 */
695.
696. n=ssl3_get_message(s,
^
697. SSL3_ST_CR_CERT_A,
698. SSL3_ST_CR_CERT_B,
ssl/s3_both.c:337:1: Parameter `s->ctx->sessions->p`
335. * the body is read in state 'stn'.
336. */
337. > long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok)
338. {
339. unsigned char *p;
ssl/s3_clnt.c:856:3: Call
854. {
855. f_err:
856. ssl3_send_alert(s,SSL3_AL_FATAL,al);
^
857. }
858. err:
ssl/s3_pkt.c:1149:1: Parameter `s->ctx->sessions->p`
1147. }
1148.
1149. > void ssl3_send_alert(SSL *s, int level, int desc)
1150. {
1151. /* Map tls/ssl alert value to correct one */
ssl/s3_pkt.c:1156:3: Call
1154. /* If a fatal one, remove from cache */
1155. if ((level == 2) && (s->session != NULL))
1156. SSL_CTX_remove_session(s->ctx,s->session);
^
1157.
1158. s->s3->alert_dispatch=1;
ssl/ssl_sess.c:413:1: Parameter `ctx->sessions->p`
411. }
412.
413. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
414. {
415. return remove_session_lock(ctx, c, 1);
ssl/ssl_sess.c:415:9: Call
413. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
414. {
415. return remove_session_lock(ctx, c, 1);
^
416. }
417.
ssl/ssl_sess.c:418:1: Parameter `ctx->sessions->p`
416. }
417.
418. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
419. {
420. SSL_SESSION *r;
ssl/ssl_sess.c:426:20: Call
424. {
425. if(lck) CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX);
426. r=(SSL_SESSION *)lh_delete(ctx->sessions,c);
^
427. if (r != NULL)
428. {
crypto/lhash/lhash.c:217:1: Parameter `lh->pmax`
215. }
216.
217. > void *lh_delete(LHASH *lh, void *data)
218. {
219. unsigned long hash;
crypto/lhash/lhash.c:243:3: Call
241. if ((lh->num_nodes > MIN_NODES) &&
242. (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)))
243. contract(lh);
^
244.
245. return(ret);
crypto/lhash/lhash.c:352:1: <LHS trace>
350. }
351.
352. > static void contract(LHASH *lh)
353. {
354. LHASH_NODE **n,*n1,*np;
crypto/lhash/lhash.c:352:1: Parameter `lh->p`
350. }
351.
352. > static void contract(LHASH *lh)
353. {
354. LHASH_NODE **n,*n1,*np;
crypto/lhash/lhash.c:356:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `ssl3_send_alert`
354. LHASH_NODE **n,*n1,*np;
355.
356. np=lh->b[lh->p+lh->pmax-1];
^
357. lh->b[lh->p+lh->pmax-1]=NULL; /* 24/07-92 - eay - weird but :-( */
358. if (lh->p == 0)
|
https://github.com/openssl/openssl/blob/f9b3bff6f7e38960bb87a5623fbcbc45ee952c49/crypto/lhash/lhash.c/#L356
|
d2a_code_trace_data_42555
|
int vp56_decode_frame(AVCodecContext *avctx, void *data, int *data_size,
const uint8_t *buf, int buf_size)
{
vp56_context_t *s = avctx->priv_data;
AVFrame *const p = s->framep[VP56_FRAME_CURRENT];
int is_alpha, alpha_offset;
if (s->has_alpha) {
alpha_offset = bytestream_get_be24(&buf);
buf_size -= 3;
}
for (is_alpha=0; is_alpha < 1+s->has_alpha; is_alpha++) {
int mb_row, mb_col, mb_row_flip, mb_offset = 0;
int block, y, uv, stride_y, stride_uv;
int golden_frame = 0;
int res;
s->modelp = &s->models[is_alpha];
res = s->parse_header(s, buf, buf_size, &golden_frame);
if (!res)
return -1;
if (!is_alpha) {
p->reference = 1;
if (avctx->get_buffer(avctx, p) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
if (res == 2)
if (vp56_size_changed(avctx)) {
avctx->release_buffer(avctx, p);
return -1;
}
}
if (p->key_frame) {
p->pict_type = FF_I_TYPE;
s->default_models_init(s);
for (block=0; block<s->mb_height*s->mb_width; block++)
s->macroblocks[block].type = VP56_MB_INTRA;
} else {
p->pict_type = FF_P_TYPE;
vp56_parse_mb_type_models(s);
s->parse_vector_models(s);
s->mb_type = VP56_MB_INTER_NOVEC_PF;
}
s->parse_coeff_models(s);
memset(s->prev_dc, 0, sizeof(s->prev_dc));
s->prev_dc[1][VP56_FRAME_CURRENT] = 128;
s->prev_dc[2][VP56_FRAME_CURRENT] = 128;
for (block=0; block < 4*s->mb_width+6; block++) {
s->above_blocks[block].ref_frame = -1;
s->above_blocks[block].dc_coeff = 0;
s->above_blocks[block].not_null_dc = 0;
}
s->above_blocks[2*s->mb_width + 2].ref_frame = 0;
s->above_blocks[3*s->mb_width + 4].ref_frame = 0;
stride_y = p->linesize[0];
stride_uv = p->linesize[1];
if (s->flip < 0)
mb_offset = 7;
for (mb_row=0; mb_row<s->mb_height; mb_row++) {
if (s->flip < 0)
mb_row_flip = s->mb_height - mb_row - 1;
else
mb_row_flip = mb_row;
for (block=0; block<4; block++) {
s->left_block[block].ref_frame = -1;
s->left_block[block].dc_coeff = 0;
s->left_block[block].not_null_dc = 0;
}
memset(s->coeff_ctx, 0, sizeof(s->coeff_ctx));
memset(s->coeff_ctx_last, 24, sizeof(s->coeff_ctx_last));
s->above_block_idx[0] = 1;
s->above_block_idx[1] = 2;
s->above_block_idx[2] = 1;
s->above_block_idx[3] = 2;
s->above_block_idx[4] = 2*s->mb_width + 2 + 1;
s->above_block_idx[5] = 3*s->mb_width + 4 + 1;
s->block_offset[s->frbi] = (mb_row_flip*16 + mb_offset) * stride_y;
s->block_offset[s->srbi] = s->block_offset[s->frbi] + 8*stride_y;
s->block_offset[1] = s->block_offset[0] + 8;
s->block_offset[3] = s->block_offset[2] + 8;
s->block_offset[4] = (mb_row_flip*8 + mb_offset) * stride_uv;
s->block_offset[5] = s->block_offset[4];
for (mb_col=0; mb_col<s->mb_width; mb_col++) {
vp56_decode_mb(s, mb_row, mb_col, is_alpha);
for (y=0; y<4; y++) {
s->above_block_idx[y] += 2;
s->block_offset[y] += 16;
}
for (uv=4; uv<6; uv++) {
s->above_block_idx[uv] += 1;
s->block_offset[uv] += 8;
}
}
}
if (p->key_frame || golden_frame) {
if (s->framep[VP56_FRAME_GOLDEN]->data[0] &&
s->framep[VP56_FRAME_GOLDEN] != s->framep[VP56_FRAME_GOLDEN2])
avctx->release_buffer(avctx, s->framep[VP56_FRAME_GOLDEN]);
s->framep[VP56_FRAME_GOLDEN] = p;
}
if (s->has_alpha) {
FFSWAP(AVFrame *, s->framep[VP56_FRAME_GOLDEN],
s->framep[VP56_FRAME_GOLDEN2]);
buf += alpha_offset;
buf_size -= alpha_offset;
}
}
if (s->framep[VP56_FRAME_PREVIOUS] == s->framep[VP56_FRAME_GOLDEN] ||
s->framep[VP56_FRAME_PREVIOUS] == s->framep[VP56_FRAME_GOLDEN2]) {
if (s->framep[VP56_FRAME_UNUSED] != s->framep[VP56_FRAME_GOLDEN] &&
s->framep[VP56_FRAME_UNUSED] != s->framep[VP56_FRAME_GOLDEN2])
FFSWAP(AVFrame *, s->framep[VP56_FRAME_PREVIOUS],
s->framep[VP56_FRAME_UNUSED]);
else
FFSWAP(AVFrame *, s->framep[VP56_FRAME_PREVIOUS],
s->framep[VP56_FRAME_UNUSED2]);
} else if (s->framep[VP56_FRAME_PREVIOUS]->data[0])
avctx->release_buffer(avctx, s->framep[VP56_FRAME_PREVIOUS]);
FFSWAP(AVFrame *, s->framep[VP56_FRAME_CURRENT],
s->framep[VP56_FRAME_PREVIOUS]);
*(AVFrame*)data = *p;
*data_size = sizeof(AVFrame);
return buf_size;
}
libavcodec/vp56.c:621: error: Uninitialized Value
The value read from alpha_offset was never initialized.
libavcodec/vp56.c:621:13:
619. FFSWAP(AVFrame *, s->framep[VP56_FRAME_GOLDEN],
620. s->framep[VP56_FRAME_GOLDEN2]);
621. buf += alpha_offset;
^
622. buf_size -= alpha_offset;
623. }
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vp56.c/#L621
|
d2a_code_trace_data_42556
|
STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
STACK_OF(SSL_CIPHER) **cipher_list,
STACK_OF(SSL_CIPHER) **cipher_list_by_id,
const char *rule_str, CERT *c)
{
int ok, num_of_ciphers, num_of_alias_max, num_of_group_aliases;
unsigned long disabled_mkey, disabled_auth, disabled_enc, disabled_mac, disabled_ssl;
STACK_OF(SSL_CIPHER) *cipherstack, *tmp_cipher_list;
const char *rule_p;
CIPHER_ORDER *co_list = NULL, *head = NULL, *tail = NULL, *curr;
const SSL_CIPHER **ca_list = NULL;
if (rule_str == NULL || cipher_list == NULL || cipher_list_by_id == NULL)
return NULL;
#ifndef OPENSSL_NO_EC
if (!check_suiteb_cipher_list(ssl_method, c, &rule_str))
return NULL;
#endif
ssl_cipher_get_disabled(&disabled_mkey, &disabled_auth, &disabled_enc, &disabled_mac, &disabled_ssl);
num_of_ciphers = ssl_method->num_ciphers();
#ifdef KSSL_DEBUG
printf("ssl_create_cipher_list() for %d ciphers\n", num_of_ciphers);
#endif
co_list = (CIPHER_ORDER *)OPENSSL_malloc(sizeof(CIPHER_ORDER) * num_of_ciphers);
if (co_list == NULL)
{
SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST,ERR_R_MALLOC_FAILURE);
return(NULL);
}
ssl_cipher_collect_ciphers(ssl_method, num_of_ciphers,
disabled_mkey, disabled_auth, disabled_enc, disabled_mac, disabled_ssl,
co_list, &head, &tail);
ssl_cipher_apply_rule(0, SSL_kECDHE, 0, 0, 0, 0, 0, CIPHER_ADD, -1, &head, &tail);
ssl_cipher_apply_rule(0, SSL_kECDHE, 0, 0, 0, 0, 0, CIPHER_DEL, -1, &head, &tail);
ssl_cipher_apply_rule(0, 0, 0, SSL_AES, 0, 0, 0, CIPHER_ADD, -1, &head, &tail);
ssl_cipher_apply_rule(0, 0, 0, 0, 0, 0, 0, CIPHER_ADD, -1, &head, &tail);
ssl_cipher_apply_rule(0, 0, 0, 0, SSL_MD5, 0, 0, CIPHER_ORD, -1, &head, &tail);
ssl_cipher_apply_rule(0, 0, SSL_aNULL, 0, 0, 0, 0, CIPHER_ORD, -1, &head, &tail);
ssl_cipher_apply_rule(0, 0, SSL_aECDH, 0, 0, 0, 0, CIPHER_ORD, -1, &head, &tail);
ssl_cipher_apply_rule(0, SSL_kRSA, 0, 0, 0, 0, 0, CIPHER_ORD, -1, &head, &tail);
ssl_cipher_apply_rule(0, SSL_kPSK, 0,0, 0, 0, 0, CIPHER_ORD, -1, &head, &tail);
ssl_cipher_apply_rule(0, SSL_kKRB5, 0,0, 0, 0, 0, CIPHER_ORD, -1, &head, &tail);
ssl_cipher_apply_rule(0, 0, 0, SSL_RC4, 0, 0, 0, CIPHER_ORD, -1, &head, &tail);
if (!ssl_cipher_strength_sort(&head, &tail))
{
OPENSSL_free(co_list);
return NULL;
}
ssl_cipher_apply_rule(0, 0, 0, 0, 0, 0, 0, CIPHER_DEL, -1, &head, &tail);
num_of_group_aliases = sizeof(cipher_aliases) / sizeof(SSL_CIPHER);
num_of_alias_max = num_of_ciphers + num_of_group_aliases + 1;
ca_list = OPENSSL_malloc(sizeof(SSL_CIPHER *) * num_of_alias_max);
if (ca_list == NULL)
{
OPENSSL_free(co_list);
SSLerr(SSL_F_SSL_CREATE_CIPHER_LIST,ERR_R_MALLOC_FAILURE);
return(NULL);
}
ssl_cipher_collect_aliases(ca_list, num_of_group_aliases,
disabled_mkey, disabled_auth, disabled_enc,
disabled_mac, disabled_ssl, head);
ok = 1;
rule_p = rule_str;
if (strncmp(rule_str,"DEFAULT",7) == 0)
{
ok = ssl_cipher_process_rulestr(SSL_DEFAULT_CIPHER_LIST,
&head, &tail, ca_list, c);
rule_p += 7;
if (*rule_p == ':')
rule_p++;
}
if (ok && (strlen(rule_p) > 0))
ok = ssl_cipher_process_rulestr(rule_p, &head, &tail, ca_list, c);
OPENSSL_free((void *)ca_list);
if (!ok)
{
OPENSSL_free(co_list);
return(NULL);
}
if ((cipherstack = sk_SSL_CIPHER_new_null()) == NULL)
{
OPENSSL_free(co_list);
return(NULL);
}
for (curr = head; curr != NULL; curr = curr->next)
{
#ifdef OPENSSL_FIPS
if (curr->active && (!FIPS_mode() || curr->cipher->algo_strength & SSL_FIPS))
#else
if (curr->active)
#endif
{
sk_SSL_CIPHER_push(cipherstack, curr->cipher);
#ifdef CIPHER_DEBUG
printf("<%s>\n",curr->cipher->name);
#endif
}
}
OPENSSL_free(co_list);
tmp_cipher_list = sk_SSL_CIPHER_dup(cipherstack);
if (tmp_cipher_list == NULL)
{
sk_SSL_CIPHER_free(cipherstack);
return NULL;
}
if (*cipher_list != NULL)
sk_SSL_CIPHER_free(*cipher_list);
*cipher_list = cipherstack;
if (*cipher_list_by_id != NULL)
sk_SSL_CIPHER_free(*cipher_list_by_id);
*cipher_list_by_id = tmp_cipher_list;
(void)sk_SSL_CIPHER_set_cmp_func(*cipher_list_by_id,ssl_cipher_ptr_id_cmp);
sk_SSL_CIPHER_sort(*cipher_list_by_id);
return(cipherstack);
}
ssl/ssl_lib.c:2069: error: BUFFER_OVERRUN_L3
Offset: 7 Size: [6, 25] by call to `ssl_create_cipher_list`.
Showing all 9 steps of the trace
ssl/ssl_lib.c:2071:3: Array declaration
2069. ssl_create_cipher_list(ret->method,
2070. &ret->cipher_list,&ret->cipher_list_by_id,
2071. meth->version == SSL2_VERSION ? "SSLv2" : SSL_DEFAULT_CIPHER_LIST, ret->cert);
^
2072. if (ret->cipher_list == NULL
2073. || sk_SSL_CIPHER_num(ret->cipher_list) <= 0)
ssl/ssl_lib.c:2069:2: Call
2067. if (ret->cert_store == NULL) goto err;
2068.
2069. ssl_create_cipher_list(ret->method,
^
2070. &ret->cipher_list,&ret->cipher_list_by_id,
2071. meth->version == SSL2_VERSION ? "SSLv2" : SSL_DEFAULT_CIPHER_LIST, ret->cert);
ssl/ssl_ciph.c:1460:1: <Length trace>
1458. #endif
1459.
1460. > STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
1461. STACK_OF(SSL_CIPHER) **cipher_list,
1462. STACK_OF(SSL_CIPHER) **cipher_list_by_id,
ssl/ssl_ciph.c:1460:1: Parameter `*rule_str`
1458. #endif
1459.
1460. > STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
1461. STACK_OF(SSL_CIPHER) **cipher_list,
1462. STACK_OF(SSL_CIPHER) **cipher_list_by_id,
ssl/ssl_ciph.c:1478:7: Call
1476. return NULL;
1477. #ifndef OPENSSL_NO_EC
1478. if (!check_suiteb_cipher_list(ssl_method, c, &rule_str))
^
1479. return NULL;
1480. #endif
ssl/ssl_ciph.c:1400:1: Parameter `**prule_str`
1398. }
1399. #ifndef OPENSSL_NO_EC
1400. > static int check_suiteb_cipher_list(const SSL_METHOD *meth, CERT *c,
1401. const char **prule_str)
1402. {
ssl/ssl_ciph.c:1577:2: Assignment
1575. */
1576. ok = 1;
1577. rule_p = rule_str;
^
1578. if (strncmp(rule_str,"DEFAULT",7) == 0)
1579. {
ssl/ssl_ciph.c:1582:3: Assignment
1580. ok = ssl_cipher_process_rulestr(SSL_DEFAULT_CIPHER_LIST,
1581. &head, &tail, ca_list, c);
1582. rule_p += 7;
^
1583. if (*rule_p == ':')
1584. rule_p++;
ssl/ssl_ciph.c:1583:7: Array access: Offset: 7 Size: [6, 25] by call to `ssl_create_cipher_list`
1581. &head, &tail, ca_list, c);
1582. rule_p += 7;
1583. if (*rule_p == ':')
^
1584. rule_p++;
1585. }
|
https://github.com/openssl/openssl/blob/dbb7654dc189992966ecd95ca66f7a3bb011ab9b/ssl/ssl_ciph.c/#L1583
|
d2a_code_trace_data_42557
|
static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
int64_t total_size = 0;
MOVAtom a;
int i;
if (atom.size < 0)
atom.size = INT64_MAX;
while (total_size + 8 < atom.size && !pb->eof_reached) {
int (*parse)(MOVContext*, AVIOContext*, MOVAtom) = NULL;
a.size = atom.size;
a.type=0;
if (atom.size >= 8) {
a.size = avio_rb32(pb);
a.type = avio_rl32(pb);
}
av_dlog(c->fc, "type: %08x '%.4s' parent:'%.4s' sz: %"PRId64" %"PRId64" %"PRId64"\n",
a.type, (char*)&a.type, (char*)&atom.type, a.size, total_size, atom.size);
total_size += 8;
if (a.size == 1) {
a.size = avio_rb64(pb) - 8;
total_size += 8;
}
if (a.size == 0) {
a.size = atom.size - total_size;
if (a.size <= 8)
break;
}
a.size -= 8;
if (a.size < 0)
break;
a.size = FFMIN(a.size, atom.size - total_size);
for (i = 0; mov_default_parse_table[i].type; i++)
if (mov_default_parse_table[i].type == a.type) {
parse = mov_default_parse_table[i].parse;
break;
}
if (!parse && (atom.type == MKTAG('u','d','t','a') ||
atom.type == MKTAG('i','l','s','t')))
parse = mov_read_udta_string;
if (!parse) {
avio_skip(pb, a.size);
} else {
int64_t start_pos = avio_tell(pb);
int64_t left;
int err = parse(c, pb, a);
if (err < 0)
return err;
if (c->found_moov && c->found_mdat &&
((!pb->seekable || c->fc->flags & AVFMT_FLAG_IGNIDX) ||
start_pos + a.size == avio_size(pb))) {
if (!pb->seekable || c->fc->flags & AVFMT_FLAG_IGNIDX)
c->next_root_atom = start_pos + a.size;
return 0;
}
left = a.size - avio_tell(pb) + start_pos;
if (left > 0)
avio_skip(pb, left);
}
total_size += a.size;
}
if (total_size < atom.size && atom.size < 0x7ffff)
avio_skip(pb, atom.size - total_size);
return 0;
}
libavformat/mov.c:2514: error: Integer Overflow L2
([-oo, -1+max(9223372036854775807, `atom.size`)] + 8):signed64.
libavformat/mov.c:2493:1: <LHS trace>
2491. };
2492.
2493. static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
^
2494. {
2495. int64_t total_size = 0;
libavformat/mov.c:2493:1: Parameter `atom.size`
2491. };
2492.
2493. static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
^
2494. {
2495. int64_t total_size = 0;
libavformat/mov.c:2511:9: Assignment
2509. av_dlog(c->fc, "type: %08x '%.4s' parent:'%.4s' sz: %"PRId64" %"PRId64" %"PRId64"\n",
2510. a.type, (char*)&a.type, (char*)&atom.type, a.size, total_size, atom.size);
2511. total_size += 8;
^
2512. if (a.size == 1) { /* 64 bit extended size */
2513. a.size = avio_rb64(pb) - 8;
libavformat/mov.c:2514:13: Binary operation: ([-oo, -1+max(9223372036854775807, atom.size)] + 8):signed64
2512. if (a.size == 1) { /* 64 bit extended size */
2513. a.size = avio_rb64(pb) - 8;
2514. total_size += 8;
^
2515. }
2516. if (a.size == 0) {
|
https://github.com/libav/libav/blob/723b266d7285776e5134a42503e468447940decb/libavformat/mov.c/#L2514
|
d2a_code_trace_data_42558
|
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/wavpack.c:692: error: Integer Overflow L2
([0, +oo] - 1):unsigned32 by call to `wv_get_value_float`.
libavcodec/wavpack.c:648:1: Parameter `s->bc_extra_bits.bits_left`
646. }
647.
648. static inline int wv_unpack_mono(WavpackFrameContext *s, BitstreamContext *bc,
^
649. void *dst, const int type)
650. {
libavcodec/wavpack.c:692:24: Call
690.
691. if (type == AV_SAMPLE_FMT_FLTP) {
692. *dstfl++ = wv_get_value_float(s, &crc_extra_bits, S);
^
693. } else if (type == AV_SAMPLE_FMT_S32P) {
694. *dst32++ = wv_get_value_integer(s, &crc_extra_bits, S);
libavcodec/wavpack.c:435:1: Parameter `s->bc_extra_bits.bits_left`
433. }
434.
435. static float wv_get_value_float(WavpackFrameContext *s, uint32_t *crc, int S)
^
436. {
437. union {
libavcodec/wavpack.c:459:38: Call
457. S = -S;
458. if (S >= 0x1000000) {
459. if (s->got_extra_bits && bitstream_read_bit(&s->bc_extra_bits))
^
460. S = bitstream_read(&s->bc_extra_bits, 23);
461. else
libavcodec/bitstream.h:145:1: Parameter `bc->bits_left`
143.
144. /* Return one bit from the buffer. */
145. static inline unsigned bitstream_read_bit(BitstreamContext *bc)
^
146. {
147. if (!bc->bits_left)
libavcodec/bitstream.h:150:12: Call
148. refill_64(bc);
149.
150. return get_val(bc, 1);
^
151. }
152.
libavcodec/bitstream.h:130:1: <LHS trace>
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:130:1: Parameter `bc->bits_left`
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:130:1: <RHS trace>
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:130:1: Parameter `n`
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:139:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `wv_get_value_float`
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_42559
|
int BN_hex2bn(BIGNUM **bn, const char *a)
{
BIGNUM *ret = NULL;
BN_ULONG l = 0;
int neg = 0, h, m, i, j, k, c;
int num;
if (a == NULL || *a == '\0')
return 0;
if (*a == '-') {
neg = 1;
a++;
}
for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++)
continue;
if (i == 0 || i > INT_MAX / 4)
goto err;
num = i + neg;
if (bn == NULL)
return num;
if (*bn == NULL) {
if ((ret = BN_new()) == NULL)
return 0;
} else {
ret = *bn;
BN_zero(ret);
}
if (bn_expand(ret, i * 4) == NULL)
goto err;
j = i;
m = 0;
h = 0;
while (j > 0) {
m = (BN_BYTES * 2 <= j) ? BN_BYTES * 2 : j;
l = 0;
for (;;) {
c = a[j - m];
k = OPENSSL_hexchar2int(c);
if (k < 0)
k = 0;
l = (l << 4) | k;
if (--m <= 0) {
ret->d[h++] = l;
break;
}
}
j -= BN_BYTES * 2;
}
ret->top = h;
bn_correct_top(ret);
*bn = ret;
bn_check_top(ret);
if (ret->top != 0)
ret->neg = neg;
return num;
err:
if (*bn == NULL)
BN_free(ret);
return 0;
}
test/sm2_internal_test.c:214: error: BUFFER_OVERRUN_L2
Offset: [0, 536870912] (⇐ [0, 1] + [0, 536870911]) Size: 2 by call to `create_EC_group`.
Showing all 8 steps of the trace
test/sm2_internal_test.c:214:9: Call
212. int testresult = 0;
213. EC_GROUP *test_group =
214. create_EC_group
^
215. ("8542D69E4C044F18E8B92435BF6FF7DE457283915C45517D722EDB8B08F1DFC3",
216. "787968B4FA32C3FD2417842E73BBFEFF2F3C848B6831D7E0EC65228B3937E498",
test/sm2_internal_test.c:79:1: Parameter `*cof_hex`
77. }
78.
79. > static EC_GROUP *create_EC_group(const char *p_hex, const char *a_hex,
80. const char *b_hex, const char *x_hex,
81. const char *y_hex, const char *order_hex,
test/sm2_internal_test.c:115:17: Call
113.
114. if (!TEST_true(BN_hex2bn(&order, order_hex))
115. || !TEST_true(BN_hex2bn(&cof, cof_hex))
^
116. || !TEST_true(EC_GROUP_set_generator(group, generator, order, cof)))
117. goto done;
crypto/bn/bn_print.c:141:10: <Offset trace>
139. }
140.
141. for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++)
^
142. continue;
143.
crypto/bn/bn_print.c:141:10: Assignment
139. }
140.
141. for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++)
^
142. continue;
143.
crypto/bn/bn_print.c:126:1: <Length trace>
124. }
125.
126. > int BN_hex2bn(BIGNUM **bn, const char *a)
127. {
128. BIGNUM *ret = NULL;
crypto/bn/bn_print.c:126:1: Parameter `*a`
124. }
125.
126. > int BN_hex2bn(BIGNUM **bn, const char *a)
127. {
128. BIGNUM *ret = NULL;
crypto/bn/bn_print.c:141:37: Array access: Offset: [0, 536870912] (⇐ [0, 1] + [0, 536870911]) Size: 2 by call to `create_EC_group`
139. }
140.
141. for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++)
^
142. continue;
143.
|
https://github.com/openssl/openssl/blob/eaf39a9fe6f55feb5251e235069e02f7f50d9a49/crypto/bn/bn_print.c/#L141
|
d2a_code_trace_data_42560
|
int ff_fill_linesize(AVPicture *picture, int pix_fmt, int width)
{
int w2;
const PixFmtInfo *pinfo;
memset(picture->linesize, 0, sizeof(picture->linesize));
pinfo = &pix_fmt_info[pix_fmt];
switch(pix_fmt) {
case PIX_FMT_YUV420P:
case PIX_FMT_YUV422P:
case PIX_FMT_YUV444P:
case PIX_FMT_YUV410P:
case PIX_FMT_YUV411P:
case PIX_FMT_YUV440P:
case PIX_FMT_YUVJ420P:
case PIX_FMT_YUVJ422P:
case PIX_FMT_YUVJ444P:
case PIX_FMT_YUVJ440P:
w2 = (width + (1 << pinfo->x_chroma_shift) - 1) >> pinfo->x_chroma_shift;
picture->linesize[0] = width;
picture->linesize[1] = w2;
picture->linesize[2] = w2;
break;
case PIX_FMT_YUVA420P:
w2 = (width + (1 << pinfo->x_chroma_shift) - 1) >> pinfo->x_chroma_shift;
picture->linesize[0] = width;
picture->linesize[1] = w2;
picture->linesize[2] = w2;
picture->linesize[3] = width;
break;
case PIX_FMT_NV12:
case PIX_FMT_NV21:
w2 = (width + (1 << pinfo->x_chroma_shift) - 1) >> pinfo->x_chroma_shift;
picture->linesize[0] = width;
picture->linesize[1] = w2;
break;
case PIX_FMT_RGB24:
case PIX_FMT_BGR24:
picture->linesize[0] = width * 3;
break;
case PIX_FMT_RGB32:
case PIX_FMT_BGR32:
case PIX_FMT_RGB32_1:
case PIX_FMT_BGR32_1:
picture->linesize[0] = width * 4;
break;
case PIX_FMT_GRAY16BE:
case PIX_FMT_GRAY16LE:
case PIX_FMT_BGR555:
case PIX_FMT_BGR565:
case PIX_FMT_RGB555:
case PIX_FMT_RGB565:
case PIX_FMT_YUYV422:
picture->linesize[0] = width * 2;
break;
case PIX_FMT_UYVY422:
picture->linesize[0] = width * 2;
break;
case PIX_FMT_UYYVYY411:
picture->linesize[0] = width + width/2;
break;
case PIX_FMT_RGB8:
case PIX_FMT_BGR8:
case PIX_FMT_RGB4_BYTE:
case PIX_FMT_BGR4_BYTE:
case PIX_FMT_GRAY8:
picture->linesize[0] = width;
break;
case PIX_FMT_RGB4:
case PIX_FMT_BGR4:
picture->linesize[0] = width / 2;
break;
case PIX_FMT_MONOWHITE:
case PIX_FMT_MONOBLACK:
picture->linesize[0] = (width + 7) >> 3;
break;
case PIX_FMT_PAL8:
picture->linesize[0] = width;
picture->linesize[1] = 4;
break;
default:
return -1;
}
return 0;
}
libavdevice/v4l2.c:566: error: Buffer Overrun L3
Offset: [-1, 1] Size: 40 by call to `avpicture_get_size`.
libavdevice/v4l2.c:519:5: Call
517. return AVERROR(ENOMEM);
518. }
519. av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in us */
^
520.
521. s->width = width;
libavformat/utils.c:3039:1: Parameter `pts_num`
3037. }
3038.
3039. void av_set_pts_info(AVStream *s, int pts_wrap_bits,
^
3040. int pts_num, int pts_den)
3041. {
libavformat/utils.c:3043:5: Assignment
3041. {
3042. s->pts_wrap_bits = pts_wrap_bits;
3043. s->time_base.num = pts_num;
^
3044. s->time_base.den = pts_den;
3045. }
libavdevice/v4l2.c:565:26: Call
563. return AVERROR(EIO);
564.
565. st->codec->pix_fmt = fmt_v4l2ff(desired_format);
^
566. s->frame_size = avpicture_get_size(st->codec->pix_fmt, width, height);
567. if (capabilities & V4L2_CAP_STREAMING) {
libavdevice/v4l2.c:226:5: Assignment
224. }
225.
226. return -1;
^
227. }
228.
libavdevice/v4l2.c:565:5: Assignment
563. return AVERROR(EIO);
564.
565. st->codec->pix_fmt = fmt_v4l2ff(desired_format);
^
566. s->frame_size = avpicture_get_size(st->codec->pix_fmt, width, height);
567. if (capabilities & V4L2_CAP_STREAMING) {
libavdevice/v4l2.c:566:21: Call
564.
565. st->codec->pix_fmt = fmt_v4l2ff(desired_format);
566. s->frame_size = avpicture_get_size(st->codec->pix_fmt, width, height);
^
567. if (capabilities & V4L2_CAP_STREAMING) {
568. s->io_method = io_mmap;
libavcodec/imgconvert.c:670:1: Parameter `pix_fmt`
668. }
669.
670. int avpicture_get_size(int pix_fmt, int width, int height)
^
671. {
672. AVPicture dummy_pict;
libavcodec/imgconvert.c:673:12: Call
671. {
672. AVPicture dummy_pict;
673. return avpicture_fill(&dummy_pict, NULL, pix_fmt, width, height);
^
674. }
675.
libavcodec/imgconvert.c:604:1: Parameter `pix_fmt`
602. }
603.
604. int avpicture_fill(AVPicture *picture, uint8_t *ptr,
^
605. int pix_fmt, int width, int height)
606. {
libavcodec/imgconvert.c:611:9: Call
609. return -1;
610.
611. if (ff_fill_linesize(picture, pix_fmt, width))
^
612. return -1;
613.
libavcodec/imgconvert.c:429:1: <Offset trace>
427. }
428.
429. int ff_fill_linesize(AVPicture *picture, int pix_fmt, int width)
^
430. {
431. int w2;
libavcodec/imgconvert.c:429:1: Parameter `pix_fmt`
427. }
428.
429. int ff_fill_linesize(AVPicture *picture, int pix_fmt, int width)
^
430. {
431. int w2;
libavcodec/imgconvert.c:65:1: <Length trace>
63.
64. /* this table gives more information about formats */
65. static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
^
66. /* YUV formats */
67. [PIX_FMT_YUV420P] = {
libavcodec/imgconvert.c:65:1: Array declaration
63.
64. /* this table gives more information about formats */
65. static const PixFmtInfo pix_fmt_info[PIX_FMT_NB] = {
^
66. /* YUV formats */
67. [PIX_FMT_YUV420P] = {
libavcodec/imgconvert.c:436:5: Array access: Offset: [-1, 1] Size: 40 by call to `avpicture_get_size`
434. memset(picture->linesize, 0, sizeof(picture->linesize));
435.
436. pinfo = &pix_fmt_info[pix_fmt];
^
437. switch(pix_fmt) {
438. case PIX_FMT_YUV420P:
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/imgconvert.c/#L436
|
d2a_code_trace_data_42561
|
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:378: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_add`.
Showing all 28 steps of the trace
crypto/bn/bn_prime.c:365:10: Call
363. goto err;
364.
365. if (!BN_rand(rnd, bits, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD))
^
366. goto err;
367.
crypto/bn/bn_rand.c:99:12: Call
97. int BN_rand(BIGNUM *rnd, int bits, int top, int bottom)
98. {
99. return bnrand(NORMAL, rnd, bits, top, bottom);
^
100. }
101.
crypto/bn/bn_rand.c:21:1: Parameter `rnd->top`
19. } BNRAND_FLAG;
20.
21. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom)
22. {
23. unsigned char *buf = NULL;
crypto/bn/bn_prime.c:370:10: Call
368. /* we need ((rnd-rem) % add) == 0 */
369.
370. if (!BN_mod(t1, rnd, add, ctx))
^
371. goto err;
372. if (!BN_sub(rnd, rnd, t1))
crypto/bn/bn_div.c:209:1: Parameter `num->top`
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_prime.c:372:10: Call
370. if (!BN_mod(t1, rnd, add, ctx))
371. goto err;
372. if (!BN_sub(rnd, rnd, t1))
^
373. goto err;
374. if (rem == NULL) {
crypto/bn/bn_add.c:45:1: Parameter `a->top`
43.
44. /* signed sub of b from a. */
45. > int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
46. {
47. int ret, r_neg, cmp_res;
crypto/bn/bn_prime.c:378:14: Call
376. goto err;
377. } else {
378. if (!BN_add(rnd, rnd, rem))
^
379. goto err;
380. }
crypto/bn/bn_add.c:14:1: Parameter `r->top`
12.
13. /* signed add of b to a. */
14. > int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
15. {
16. int ret, r_neg, cmp_res;
crypto/bn/bn_add.c:31:19: Call
29. } else if (cmp_res < 0) {
30. r_neg = b->neg;
31. ret = BN_usub(r, b, a);
^
32. } else {
33. r_neg = 0;
crypto/bn/bn_add.c:125:1: Parameter `r->top`
123.
124. /* unsigned subtraction of b from a, a must be larger than b. */
125. > int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
126. {
127. int max, min, dif;
crypto/bn/bn_add.c:143:9: Call
141. }
142.
143. if (bn_wexpand(r, max) == NULL)
^
144. return 0;
145.
crypto/bn/bn_lib.c:960:1: Parameter `a->top`
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->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_add`
230. assert(b->top <= words);
231. if (b->top > 0)
232. memcpy(a, b->d, sizeof(*a) * b->top);
^
233.
234. return a;
|
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_lib.c/#L232
|
d2a_code_trace_data_42562
|
static void qmf_32_subbands(DCAContext * s, int chans,
float samples_in[32][8], float *samples_out,
float scale, float bias)
{
const float *prCoeff;
int i, j, k;
float praXin[33], *raXin = &praXin[1];
float *subband_fir_hist = s->subband_fir_hist[chans];
float *subband_fir_hist2 = s->subband_fir_noidea[chans];
int chindex = 0, subindex;
praXin[0] = 0.0;
if (!s->multirate_inter)
prCoeff = fir_32bands_nonperfect;
else
prCoeff = fir_32bands_perfect;
for (subindex = 0; subindex < 8; subindex++) {
float t1, t2, sum[16], diff[16];
for (i = 0; i < s->subband_activity[chans]; i++)
raXin[i] = samples_in[i][subindex];
for (; i < 32; i++)
raXin[i] = 0.0;
for (j = 0, k = 0; k < 16; k++) {
t1 = 0.0;
t2 = 0.0;
for (i = 0; i < 16; i++, j++){
t1 += (raXin[2 * i] + raXin[2 * i + 1]) * cos_mod[j];
t2 += (raXin[2 * i] + raXin[2 * i - 1]) * cos_mod[j + 256];
}
sum[k] = t1 + t2;
diff[k] = t1 - t2;
}
j = 512;
for (k = 0; k < 16; k++)
subband_fir_hist[k] = cos_mod[j++] * sum[k];
for (k = 0; k < 16; k++)
subband_fir_hist[32-k-1] = cos_mod[j++] * diff[k];
for (k = 31, i = 0; i < 32; i++, k--)
for (j = 0; j < 512; j += 64){
subband_fir_hist2[i] += prCoeff[i+j] * ( subband_fir_hist[i+j] - subband_fir_hist[j+k]);
subband_fir_hist2[i+32] += prCoeff[i+j+32]*(-subband_fir_hist[i+j] - subband_fir_hist[j+k]);
}
for (i = 0; i < 32; i++)
samples_out[chindex++] = subband_fir_hist2[i] * scale + bias;
memmove(&subband_fir_hist[32], &subband_fir_hist[0], (512 - 32) * sizeof(float));
memmove(&subband_fir_hist2[0], &subband_fir_hist2[32], 32 * sizeof(float));
memset(&subband_fir_hist2[32], 0, 32 * sizeof(float));
}
}
libavcodec/dca.c:992: error: Buffer Overrun L1
Offset: [32, `s->prim_channels` + 62] (⇐ [0, `s->prim_channels` - 1] + [32, 63]) Size: 5 by call to `qmf_32_subbands`.
libavcodec/dca.c:848:1: Parameter `s->prim_channels`
846. static const uint8_t abits_levels[7] = { 3, 5, 7, 9, 13, 17, 25 };
847.
848. static int dca_subsubframe(DCAContext * s)
^
849. {
850. int k, l;
libavcodec/dca.c:992:10: Call
990. /* static float pcm_to_double[8] =
991. {32768.0, 32768.0, 524288.0, 524288.0, 0, 8388608.0, 8388608.0};*/
992. qmf_32_subbands(s, k, subband_samples[k], &s->samples[256 * k],
^
993. 2.0 / 3 /*pcm_to_double[s->source_pcm_res] */ ,
994. 0 /*s->bias */ );
libavcodec/dca.c:705:22: <Offset trace>
703.
704. /* Multiply by filter coefficients */
705. for (k = 31, i = 0; i < 32; i++, k--)
^
706. for (j = 0; j < 512; j += 64){
707. subband_fir_hist2[i] += prCoeff[i+j] * ( subband_fir_hist[i+j] - subband_fir_hist[j+k]);
libavcodec/dca.c:705:22: Assignment
703.
704. /* Multiply by filter coefficients */
705. for (k = 31, i = 0; i < 32; i++, k--)
^
706. for (j = 0; j < 512; j += 64){
707. subband_fir_hist2[i] += prCoeff[i+j] * ( subband_fir_hist[i+j] - subband_fir_hist[j+k]);
libavcodec/dca.c:653:1: <Length trace>
651. }
652.
653. static void qmf_32_subbands(DCAContext * s, int chans,
^
654. float samples_in[32][8], float *samples_out,
655. float scale, float bias)
libavcodec/dca.c:653:1: Parameter `chans`
651. }
652.
653. static void qmf_32_subbands(DCAContext * s, int chans,
^
654. float samples_in[32][8], float *samples_out,
655. float scale, float bias)
libavcodec/dca.c:662:5: Assignment
660.
661. float *subband_fir_hist = s->subband_fir_hist[chans];
662. float *subband_fir_hist2 = s->subband_fir_noidea[chans];
^
663.
664. int chindex = 0, subindex;
libavcodec/dca.c:708:17: Array access: Offset: [32, s->prim_channels + 62] (⇐ [0, s->prim_channels - 1] + [32, 63]) Size: 5 by call to `qmf_32_subbands`
706. for (j = 0; j < 512; j += 64){
707. subband_fir_hist2[i] += prCoeff[i+j] * ( subband_fir_hist[i+j] - subband_fir_hist[j+k]);
708. subband_fir_hist2[i+32] += prCoeff[i+j+32]*(-subband_fir_hist[i+j] - subband_fir_hist[j+k]);
^
709. }
710.
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dca.c/#L708
|
d2a_code_trace_data_42563
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/bn/bn_prime.c:316: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `BN_mod_exp_mont`.
Showing all 73 steps of the trace
crypto/bn/bn_prime.c:249:1: Parameter `ctx->stack.depth`
247. * returns 0 if there was an error, otherwise it returns 1.
248. */
249. > int bn_miller_rabin_is_prime(const BIGNUM *w, int iterations, BN_CTX *ctx,
250. BN_GENCB *cb, int enhanced, int *status)
251. {
crypto/bn/bn_prime.c:260:5: Call
258. return 0;
259.
260. BN_CTX_start(ctx);
^
261. g = BN_CTX_get(ctx);
262. w1 = 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_prime.c:261:9: Call
259.
260. BN_CTX_start(ctx);
261. g = BN_CTX_get(ctx);
^
262. w1 = BN_CTX_get(ctx);
263. w3 = 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_prime.c:262:10: Call
260. BN_CTX_start(ctx);
261. g = BN_CTX_get(ctx);
262. w1 = BN_CTX_get(ctx);
^
263. w3 = BN_CTX_get(ctx);
264. x = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_prime.c:263:10: Call
261. g = BN_CTX_get(ctx);
262. w1 = BN_CTX_get(ctx);
263. w3 = BN_CTX_get(ctx);
^
264. x = BN_CTX_get(ctx);
265. m = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_prime.c:264:9: Call
262. w1 = BN_CTX_get(ctx);
263. w3 = BN_CTX_get(ctx);
264. x = BN_CTX_get(ctx);
^
265. m = BN_CTX_get(ctx);
266. z = 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_prime.c:265:9: Call
263. w3 = BN_CTX_get(ctx);
264. x = BN_CTX_get(ctx);
265. m = BN_CTX_get(ctx);
^
266. z = BN_CTX_get(ctx);
267. b = 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_prime.c:266:9: Call
264. x = BN_CTX_get(ctx);
265. m = BN_CTX_get(ctx);
266. z = BN_CTX_get(ctx);
^
267. b = BN_CTX_get(ctx);
268.
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_prime.c:267:9: Call
265. m = BN_CTX_get(ctx);
266. z = BN_CTX_get(ctx);
267. b = BN_CTX_get(ctx);
^
268.
269. 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_prime.c:292:26: Call
290. /* Montgomery setup for computations mod a */
291. mont = BN_MONT_CTX_new();
292. if (mont == NULL || !BN_MONT_CTX_set(mont, w, ctx))
^
293. goto err;
294.
crypto/bn/bn_mont.c:263:1: Parameter `ctx->stack.depth`
261. }
262.
263. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
264. {
265. int i, ret = 0;
crypto/bn/bn_prime.c:316:14: Call
314. }
315. /* (Step 4.5) z = b^m mod w */
316. if (!BN_mod_exp_mont(z, b, m, w, ctx, mont))
^
317. goto err;
318. /* (Step 4.6) if (z = 1 or z = w-1) */
crypto/bn/bn_exp.c:296:1: Parameter `ctx->stack.depth`
294. }
295.
296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
297. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
298. {
crypto/bn/bn_exp.c: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:592:1: Parameter `ctx->stack.depth`
590. * http://www.daemonology.net/hyperthreading-considered-harmful/)
591. */
592. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
593. const BIGNUM *m, BN_CTX *ctx,
594. BN_MONT_CTX *in_mont)
crypto/bn/bn_exp.c:636:5: Call
634. }
635.
636. BN_CTX_start(ctx);
^
637.
638. /*
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_exp.c:647:14: Call
645. if ((mont = BN_MONT_CTX_new()) == NULL)
646. goto err;
647. if (!BN_MONT_CTX_set(mont, m, ctx))
^
648. goto err;
649. }
crypto/bn/bn_mont.c:263:1: Parameter `ctx->stack.depth`
261. }
262.
263. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
264. {
265. int i, ret = 0;
crypto/bn/bn_mont.c:271:5: Call
269. return 0;
270.
271. BN_CTX_start(ctx);
^
272. if ((Ri = BN_CTX_get(ctx)) == NULL)
273. goto err;
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_mont.c:272:15: Call
270.
271. BN_CTX_start(ctx);
272. if ((Ri = BN_CTX_get(ctx)) == NULL)
^
273. goto err;
274. R = &(mont->RR); /* grab RR as a temp */
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_mont.c:351:19: Call
349. if (BN_is_one(&tmod))
350. BN_zero(Ri);
351. else if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL)
^
352. goto err;
353. if (!BN_lshift(Ri, Ri, BN_BITS2))
crypto/bn/bn_gcd.c:124:1: Parameter `ctx->stack.depth`
122. BN_CTX *ctx);
123.
124. > BIGNUM *BN_mod_inverse(BIGNUM *in,
125. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx)
126. {
crypto/bn/bn_gcd.c:129:10: Call
127. BIGNUM *rv;
128. int noinv;
129. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv);
^
130. if (noinv)
131. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE);
crypto/bn/bn_gcd.c:135:1: Parameter `ctx->stack.depth`
133. }
134.
135. > BIGNUM *int_bn_mod_inverse(BIGNUM *in,
136. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx,
137. int *pnoinv)
crypto/bn/bn_gcd.c:155:16: Call
153. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0)
154. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) {
155. return BN_mod_inverse_no_branch(in, a, n, ctx);
^
156. }
157.
crypto/bn/bn_gcd.c:458:1: Parameter `ctx->stack.depth`
456. * not contain branches that may leak sensitive information.
457. */
458. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in,
459. const BIGNUM *a, const BIGNUM *n,
460. BN_CTX *ctx)
crypto/bn/bn_gcd.c:469:5: Call
467. bn_check_top(n);
468.
469. BN_CTX_start(ctx);
^
470. A = BN_CTX_get(ctx);
471. B = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_gcd.c:470:9: Call
468.
469. BN_CTX_start(ctx);
470. A = BN_CTX_get(ctx);
^
471. B = BN_CTX_get(ctx);
472. X = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_gcd.c:471:9: Call
469. BN_CTX_start(ctx);
470. A = BN_CTX_get(ctx);
471. B = BN_CTX_get(ctx);
^
472. X = BN_CTX_get(ctx);
473. D = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_gcd.c:472:9: Call
470. A = BN_CTX_get(ctx);
471. B = BN_CTX_get(ctx);
472. X = BN_CTX_get(ctx);
^
473. D = BN_CTX_get(ctx);
474. M = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_gcd.c:473:9: Call
471. B = BN_CTX_get(ctx);
472. X = BN_CTX_get(ctx);
473. D = BN_CTX_get(ctx);
^
474. M = BN_CTX_get(ctx);
475. Y = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_gcd.c:474:9: Call
472. X = BN_CTX_get(ctx);
473. D = BN_CTX_get(ctx);
474. M = BN_CTX_get(ctx);
^
475. Y = BN_CTX_get(ctx);
476. T = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_gcd.c:475:9: Call
473. D = BN_CTX_get(ctx);
474. M = BN_CTX_get(ctx);
475. Y = BN_CTX_get(ctx);
^
476. T = BN_CTX_get(ctx);
477. if (T == NULL)
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_gcd.c:476:9: Call
474. M = BN_CTX_get(ctx);
475. Y = BN_CTX_get(ctx);
476. T = BN_CTX_get(ctx);
^
477. if (T == NULL)
478. goto err;
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_gcd.c:504:18: Call
502. bn_init(&local_B);
503. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME);
504. if (!BN_nnmod(B, &local_B, A, ctx))
^
505. goto err;
506. /* Ensure local_B goes out of scope before any further use of B */
crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth`
11. #include "bn_lcl.h"
12.
13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
14. {
15. /*
crypto/bn/bn_mod.c:20:11: Call
18. */
19.
20. if (!(BN_mod(r, m, d, ctx)))
^
21. return 0;
22. if (!r->neg)
crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth`
207. * If 'dv' or 'rm' is NULL, the respective value is not returned.
208. */
209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
210. BN_CTX *ctx)
211. {
crypto/bn/bn_div.c:229:11: Call
227. }
228.
229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx);
^
230.
231. if (ret) {
crypto/bn/bn_div.c:264:1: Parameter `ctx->stack.depth`
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:280:5: Call
278. bn_check_top(rm);
279.
280. BN_CTX_start(ctx);
^
281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv;
282. tmp = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_div.c:282:11: Call
280. BN_CTX_start(ctx);
281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv;
282. tmp = BN_CTX_get(ctx);
^
283. snum = BN_CTX_get(ctx);
284. sdiv = 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_div.c:283:12: Call
281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv;
282. tmp = BN_CTX_get(ctx);
283. snum = BN_CTX_get(ctx);
^
284. sdiv = BN_CTX_get(ctx);
285. if (sdiv == 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_div.c:284:12: Call
282. tmp = BN_CTX_get(ctx);
283. snum = BN_CTX_get(ctx);
284. sdiv = BN_CTX_get(ctx);
^
285. if (sdiv == NULL)
286. 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_div.c:450:5: Call
448. if (rm != NULL)
449. bn_rshift_fixed_top(rm, snum, norm_shift);
450. BN_CTX_end(ctx);
^
451. return 1;
452. err:
crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.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_mod_exp_mont`
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_42564
|
static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
{
int ret, i, type, size, flags, is_audio, next, pos;
unsigned dts;
AVStream *st = NULL;
retry:
for(;;){
pos = url_ftell(s->pb);
url_fskip(s->pb, 4);
type = get_byte(s->pb);
size = get_be24(s->pb);
dts = get_be24(s->pb);
dts |= get_byte(s->pb) << 24;
if (url_feof(s->pb))
return AVERROR(EIO);
url_fskip(s->pb, 3);
flags = 0;
if(size == 0)
continue;
next= size + url_ftell(s->pb);
if (type == FLV_TAG_TYPE_AUDIO) {
is_audio=1;
flags = get_byte(s->pb);
size--;
} else if (type == FLV_TAG_TYPE_VIDEO) {
is_audio=0;
flags = get_byte(s->pb);
size--;
if ((flags & 0xf0) == 0x50)
goto skip;
} else {
if (type == FLV_TAG_TYPE_META && size > 13+1+4)
flv_read_metabody(s, next);
else
av_log(s, AV_LOG_ERROR, "skipping flv packet: type %d, size %d, flags %d\n", type, size, flags);
skip:
url_fseek(s->pb, next, SEEK_SET);
continue;
}
if (!size)
continue;
for(i=0;i<s->nb_streams;i++) {
st = s->streams[i];
if (st->id == is_audio)
break;
}
if(i == s->nb_streams){
av_log(NULL, AV_LOG_ERROR, "invalid stream\n");
st= create_stream(s, is_audio);
s->ctx_flags &= ~AVFMTCTX_NOHEADER;
}
if( (st->discard >= AVDISCARD_NONKEY && !((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY || is_audio))
||(st->discard >= AVDISCARD_BIDIR && ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_DISP_INTER && !is_audio))
|| st->discard >= AVDISCARD_ALL
){
url_fseek(s->pb, next, SEEK_SET);
continue;
}
if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY)
av_add_index_entry(st, pos, dts, size, 0, AVINDEX_KEYFRAME);
break;
}
if(!url_is_streamed(s->pb) && s->duration==AV_NOPTS_VALUE){
int size;
const int pos= url_ftell(s->pb);
const int fsize= url_fsize(s->pb);
url_fseek(s->pb, fsize-4, SEEK_SET);
size= get_be32(s->pb);
url_fseek(s->pb, fsize-3-size, SEEK_SET);
if(size == get_be24(s->pb) + 11){
s->duration= get_be24(s->pb) * (int64_t)AV_TIME_BASE / 1000;
}
url_fseek(s->pb, pos, SEEK_SET);
}
if(is_audio){
if(!st->codec->sample_rate || !st->codec->bits_per_sample || (!st->codec->codec_id && !st->codec->codec_tag)) {
st->codec->channels = (flags & FLV_AUDIO_CHANNEL_MASK) == FLV_STEREO ? 2 : 1;
if((flags & FLV_AUDIO_CODECID_MASK) == FLV_CODECID_NELLYMOSER_8HZ_MONO)
st->codec->sample_rate= 8000;
else
st->codec->sample_rate = (44100 << ((flags & FLV_AUDIO_SAMPLERATE_MASK) >> FLV_AUDIO_SAMPLERATE_OFFSET) >> 3);
st->codec->bits_per_sample = (flags & FLV_AUDIO_SAMPLESIZE_MASK) ? 16 : 8;
flv_set_audio_codec(s, st, flags & FLV_AUDIO_CODECID_MASK);
}
}else{
size -= flv_set_video_codec(s, st, flags & FLV_VIDEO_CODECID_MASK);
}
if (st->codec->codec_id == CODEC_ID_AAC ||
st->codec->codec_id == CODEC_ID_H264) {
int type = get_byte(s->pb);
size--;
if (st->codec->codec_id == CODEC_ID_H264) {
get_be24(s->pb);
}
if (type == 0) {
if ((ret = flv_get_extradata(s, st, size)) < 0)
return ret;
goto retry;
}
}
ret= av_get_packet(s->pb, pkt, size);
if (ret <= 0) {
return AVERROR(EIO);
}
pkt->size = ret;
pkt->dts = dts;
pkt->stream_index = st->index;
if (is_audio || ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY))
pkt->flags |= PKT_FLAG_KEY;
return ret;
}
libavformat/flvdec.c:414: error: Uninitialized Value
The value read from size was never initialized.
libavformat/flvdec.c:414:10:
412. }
413.
414. ret= av_get_packet(s->pb, pkt, size);
^
415. if (ret <= 0) {
416. return AVERROR(EIO);
|
https://github.com/libav/libav/blob/f0319383436e1abc3fc1464fe4e5f4dc40db3419/libavformat/flvdec.c/#L414
|
d2a_code_trace_data_42565
|
void BF_set_key(BF_KEY *key, int len, const unsigned char *data)
#ifdef OPENSSL_FIPS
{
fips_cipher_abort(BLOWFISH);
private_BF_set_key(key, len, data);
}
void private_BF_set_key(BF_KEY *key, int len, const unsigned char *data)
#endif
{
int i;
BF_LONG *p,ri,in[2];
const unsigned char *d,*end;
memcpy(key,&bf_init,sizeof(BF_KEY));
p=key->P;
if (len > ((BF_ROUNDS+2)*4)) len=(BF_ROUNDS+2)*4;
d=data;
end= &(data[len]);
for (i=0; i<(BF_ROUNDS+2); i++)
{
ri= *(d++);
if (d >= end) d=data;
ri<<=8;
ri|= *(d++);
if (d >= end) d=data;
ri<<=8;
ri|= *(d++);
if (d >= end) d=data;
ri<<=8;
ri|= *(d++);
if (d >= end) d=data;
p[i]^=ri;
}
in[0]=0L;
in[1]=0L;
for (i=0; i<(BF_ROUNDS+2); i+=2)
{
BF_encrypt(in,key);
p[i ]=in[0];
p[i+1]=in[1];
}
p=key->S;
for (i=0; i<4*256; i+=2)
{
BF_encrypt(in,key);
p[i ]=in[0];
p[i+1]=in[1];
}
}
crypto/bf/bftest.c:374: error: BUFFER_OVERRUN_L2
Offset: [0, 71] Size: 16 by call to `BF_set_key`.
Showing all 6 steps of the trace
crypto/bf/bftest.c:82:1: Array declaration
80. #endif
81.
82. > static char *bf_key[2]={
83. "abcdefghijklmnopqrstuvwxyz",
84. "Who is John Galt?"
crypto/bf/bftest.c:374:3: Call
372. ebcdic2ascii(bf_key[n], bf_key[n], strlen(bf_key[n]));
373. #endif
374. BF_set_key(&key,strlen(bf_key[n]),(unsigned char *)bf_key[n]);
^
375.
376. data[0]=bf_plain[n][0];
crypto/bf/bf_skey.c:66:1: <Length trace>
64. #include "bf_pi.h"
65.
66. > void BF_set_key(BF_KEY *key, int len, const unsigned char *data)
67. #ifdef OPENSSL_FIPS
68. {
crypto/bf/bf_skey.c:66:1: Parameter `*data`
64. #include "bf_pi.h"
65.
66. > void BF_set_key(BF_KEY *key, int len, const unsigned char *data)
67. #ifdef OPENSSL_FIPS
68. {
crypto/bf/bf_skey.c:85:2: Assignment
83. if (len > ((BF_ROUNDS+2)*4)) len=(BF_ROUNDS+2)*4;
84.
85. d=data;
^
86. end= &(data[len]);
87. for (i=0; i<(BF_ROUNDS+2); i++)
crypto/bf/bf_skey.c:89:7: Array access: Offset: [0, 71] Size: 16 by call to `BF_set_key`
87. for (i=0; i<(BF_ROUNDS+2); i++)
88. {
89. ri= *(d++);
^
90. if (d >= end) d=data;
91.
|
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/bf/bf_skey.c/#L89
|
d2a_code_trace_data_42566
|
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/servername_test.c:98: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned64 by call to `SSL_new`.
Showing all 16 steps of the trace
test/servername_test.c:98:11: Call
96. goto end;
97.
98. con = SSL_new(ctx);
^
99. if (!TEST_ptr(con))
100. goto end;
ssl/ssl_lib.c:669:1: Parameter `ctx->sessions->num_items`
667. }
668.
669. > SSL *SSL_new(SSL_CTX *ctx)
670. {
671. SSL *s;
ssl/ssl_lib.c:818:10: Call
816. s->server = (ctx->method->ssl_accept == ssl_undefined_function) ? 0 : 1;
817.
818. if (!SSL_clear(s))
^
819. goto err;
820.
ssl/ssl_lib.c:577:1: Parameter `s->session_ctx->sessions->num_items`
575. }
576.
577. > int SSL_clear(SSL *s)
578. {
579. if (s->method == NULL) {
ssl/ssl_lib.c:584:9: Call
582. }
583.
584. if (ssl_clear_bad_session(s)) {
^
585. SSL_SESSION_free(s->session);
586. s->session = NULL;
ssl/ssl_sess.c:1124:1: Parameter `s->session_ctx->sessions->num_items`
1122. }
1123.
1124. > int ssl_clear_bad_session(SSL *s)
1125. {
1126. if ((s->session != NULL) &&
ssl/ssl_sess.c:1129:9: Call
1127. !(s->shutdown & SSL_SENT_SHUTDOWN) &&
1128. !(SSL_in_init(s) || SSL_in_before(s))) {
1129. SSL_CTX_remove_session(s->session_ctx, s->session);
^
1130. return 1;
1131. } else
ssl/ssl_sess.c:742:1: Parameter `ctx->sessions->num_items`
740. }
741.
742. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
743. {
744. return remove_session_lock(ctx, c, 1);
ssl/ssl_sess.c:744:12: Call
742. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
743. {
744. return remove_session_lock(ctx, c, 1);
^
745. }
746.
ssl/ssl_sess.c:747:1: Parameter `ctx->sessions->num_items`
745. }
746.
747. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
748. {
749. SSL_SESSION *r;
ssl/ssl_sess.c:757:17: Call
755. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) != NULL) {
756. ret = 1;
757. r = lh_SSL_SESSION_delete(ctx->sessions, r);
^
758. SSL_SESSION_list_remove(ctx, r);
759. }
ssl/ssl_locl.h:728:1: Parameter `lh->num_items`
726. } TLSEXT_INDEX;
727.
728. > DEFINE_LHASH_OF(SSL_SESSION);
729. /* Needed in ssl_cert.c */
730. DEFINE_LHASH_OF(X509_NAME);
ssl/ssl_locl.h:728:1: Call
726. } TLSEXT_INDEX;
727.
728. > DEFINE_LHASH_OF(SSL_SESSION);
729. /* Needed in ssl_cert.c */
730. DEFINE_LHASH_OF(X509_NAME);
crypto/lhash/lhash.c:128:1: <LHS trace>
126. }
127.
128. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
129. {
130. unsigned long hash;
crypto/lhash/lhash.c:128:1: Parameter `lh->num_items`
126. }
127.
128. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
129. {
130. unsigned long hash;
crypto/lhash/lhash.c:148:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `SSL_new`
146. }
147.
148. lh->num_items--;
^
149. if ((lh->num_nodes > MIN_NODES) &&
150. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
|
https://github.com/openssl/openssl/blob/427e91d928ce7a1c583e4bba761cb17a85ac95b4/crypto/lhash/lhash.c/#L148
|
d2a_code_trace_data_42567
|
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
{
assert(pkt->subs != NULL && len != 0);
if (pkt->subs == NULL || len == 0)
return 0;
if (pkt->maxsize - pkt->written < len)
return 0;
if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) {
size_t newlen;
size_t reflen;
reflen = (len > pkt->buf->length) ? len : pkt->buf->length;
if (reflen > SIZE_MAX / 2) {
newlen = SIZE_MAX;
} else {
newlen = reflen * 2;
if (newlen < DEFAULT_BUF_SIZE)
newlen = DEFAULT_BUF_SIZE;
}
if (BUF_MEM_grow(pkt->buf, newlen) == 0)
return 0;
}
if (allocbytes != NULL)
*allocbytes = WPACKET_get_curr(pkt);
return 1;
}
ssl/statem/extensions.c:1002: error: INTEGER_OVERFLOW_L2
([0, +oo] - [`pkt->written`, `pkt->written` + 6]):unsigned64 by call to `construct_ca_names`.
Showing all 14 steps of the trace
ssl/statem/extensions.c:1001:13: Call
999.
1000. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_certificate_authorities)
1001. || !WPACKET_start_sub_packet_u16(pkt)
^
1002. || !construct_ca_names(s, pkt)
1003. || !WPACKET_close(pkt)) {
ssl/packet.c:275:1: Parameter `pkt->buf->length`
273. }
274.
275. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes)
276. {
277. WPACKET_SUB *sub;
ssl/statem/extensions.c:1002:13: Call
1000. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_certificate_authorities)
1001. || !WPACKET_start_sub_packet_u16(pkt)
1002. || !construct_ca_names(s, pkt)
^
1003. || !WPACKET_close(pkt)) {
1004. SSLerr(SSL_F_TLS_CONSTRUCT_CERTIFICATE_AUTHORITIES,
ssl/statem/statem_lib.c:1974:1: Parameter `pkt->written`
1972. }
1973.
1974. > int construct_ca_names(SSL *s, WPACKET *pkt)
1975. {
1976. STACK_OF(X509_NAME) *ca_sk = SSL_get_client_CA_list(s);
ssl/statem/statem_lib.c:1979:10: Call
1977.
1978. /* Start sub-packet for client CA list */
1979. if (!WPACKET_start_sub_packet_u16(pkt))
^
1980. return 0;
1981.
ssl/packet.c:275:1: Parameter `pkt->written`
273. }
274.
275. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes)
276. {
277. WPACKET_SUB *sub;
ssl/packet.c:299:10: Call
297. }
298.
299. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars))
^
300. return 0;
301. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */
ssl/packet.c:15:1: Parameter `pkt->written`
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes))
ssl/packet.c:17:10: Call
15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes))
^
18. return 0;
19.
ssl/packet.c:39:1: <LHS trace>
37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data)
38.
39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
40. {
41. /* Internal API, so should not fail */
ssl/packet.c:39:1: Parameter `pkt->buf->length`
37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data)
38.
39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
40. {
41. /* Internal API, so should not fail */
ssl/packet.c:39:1: <RHS trace>
37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data)
38.
39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
40. {
41. /* Internal API, so should not fail */
ssl/packet.c:39:1: Parameter `len`
37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data)
38.
39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
40. {
41. /* Internal API, so should not fail */
ssl/packet.c:49:36: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 6]):unsigned64 by call to `construct_ca_names`
47. return 0;
48.
49. if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) {
^
50. size_t newlen;
51. size_t reflen;
|
https://github.com/openssl/openssl/blob/6d0b5ee1d6163732b886bc0567dbce08aeade4c1/ssl/packet.c/#L49
|
d2a_code_trace_data_42568
|
static BN_ULONG bn_get_bits(const BIGNUM *a, int bitpos)
{
BN_ULONG ret = 0;
int wordpos;
wordpos = bitpos / BN_BITS2;
bitpos %= BN_BITS2;
if (wordpos >= 0 && wordpos < a->top) {
ret = a->d[wordpos] & BN_MASK2;
if (bitpos) {
ret >>= bitpos;
if (++wordpos < a->top)
ret |= a->d[wordpos] << (BN_BITS2 - bitpos);
}
}
return ret & BN_MASK2;
}
crypto/ec/ecp_mont.c:241: error: BUFFER_OVERRUN_L3
Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mod_exp_mont`.
Showing all 13 steps of the trace
crypto/ec/ecp_mont.c:235:10: Call
233. if (!BN_set_word(e, 2))
234. goto err;
235. if (!BN_sub(e, group->field, e))
^
236. goto err;
237. /*-
crypto/bn/bn_add.c:59:19: Call
57. if (cmp_res > 0) {
58. r_neg = a->neg;
59. ret = BN_usub(r, a, b);
^
60. } else if (cmp_res < 0) {
61. r_neg = !b->neg;
crypto/bn/bn_add.c:125:1: Parameter `r->top`
123.
124. /* unsigned subtraction of b from a, a must be larger than b. */
125. > int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
126. {
127. int max, min, dif;
crypto/ec/ecp_mont.c:241:10: Call
239. * No need for scatter-gather or BN_FLG_CONSTTIME.
240. */
241. if (!BN_mod_exp_mont(r, a, e, group->field, ctx, group->field_data1))
^
242. goto err;
243.
crypto/bn/bn_exp.c:296:1: Parameter `*p->d`
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:592:1: Parameter `*p->d`
590. * http://www.daemonology.net/hyperthreading-considered-harmful/)
591. */
592. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
593. const BIGNUM *m, BN_CTX *ctx,
594. BN_MONT_CTX *in_mont)
crypto/bn/bn_exp.c:1059:18: Call
1057. wmask = (1 << window0) - 1;
1058. bits -= window0;
1059. wvalue = bn_get_bits(p, bits) & wmask;
^
1060. if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&tmp, top, powerbuf, wvalue,
1061. window))
crypto/bn/bn_exp.c:472:1: <Offset trace>
470. }
471.
472. > static BN_ULONG bn_get_bits(const BIGNUM *a, int bitpos)
473. {
474. BN_ULONG ret = 0;
crypto/bn/bn_exp.c:472:1: Parameter `a->top`
470. }
471.
472. > static BN_ULONG bn_get_bits(const BIGNUM *a, int bitpos)
473. {
474. BN_ULONG ret = 0;
crypto/bn/bn_exp.c:472:1: <Length trace>
470. }
471.
472. > static BN_ULONG bn_get_bits(const BIGNUM *a, int bitpos)
473. {
474. BN_ULONG ret = 0;
crypto/bn/bn_exp.c:472:1: Parameter `*a->d`
470. }
471.
472. > static BN_ULONG bn_get_bits(const BIGNUM *a, int bitpos)
473. {
474. BN_ULONG ret = 0;
crypto/bn/bn_exp.c:484:24: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mod_exp_mont`
482. ret >>= bitpos;
483. if (++wordpos < a->top)
484. ret |= a->d[wordpos] << (BN_BITS2 - bitpos);
^
485. }
486. }
|
https://github.com/openssl/openssl/blob/8f58ede09572dcc6a7e6c01280dd348240199568/crypto/bn/bn_exp.c/#L484
|
d2a_code_trace_data_42569
|
static int epzs_motion_search4(MpegEncContext * s,
int *mx_ptr, int *my_ptr, int P[10][2],
int src_index, int ref_index, int16_t (*last_mv)[2],
int ref_mv_scale)
{
MotionEstContext * const c= &s->me;
int best[2]={0, 0};
int d, dmin;
int map_generation;
const int penalty_factor= c->penalty_factor;
const int size=1;
const int h=8;
const int ref_mv_stride= s->mb_stride;
const int ref_mv_xy= s->mb_x + s->mb_y *ref_mv_stride;
me_cmp_func cmpf, chroma_cmpf;
LOAD_COMMON
int flags= c->flags;
LOAD_COMMON2
cmpf= s->dsp.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1];
map_generation= update_map_generation(c);
dmin = 1000000;
if (s->first_slice_line) {
CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift)
}else{
CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift)
CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift)
CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift)
CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
}
if(dmin>64*4){
CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16)
if(s->mb_y+1<s->end_mb_y)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
}
dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
*mx_ptr= best[0];
*my_ptr= best[1];
return dmin;
}
libavcodec/motion_est_template.c:1170: error: Uninitialized Value
The value read from ymin was never initialized.
libavcodec/motion_est_template.c:1170:9:
1168. CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift)
1169. CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
1170. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
^
1171. (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
1172. }
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1170
|
d2a_code_trace_data_42570
|
void *lh_delete(_LHASH *lh, const void *data)
{
unsigned long hash;
LHASH_NODE *nn,**rn;
void *ret;
lh->error=0;
rn=getrn(lh,data,&hash);
if (*rn == NULL)
{
lh->num_no_delete++;
return(NULL);
}
else
{
nn= *rn;
*rn=nn->next;
ret=nn->data;
OPENSSL_free(nn);
lh->num_delete++;
}
lh->num_items--;
if ((lh->num_nodes > MIN_NODES) &&
(lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)))
contract(lh);
return(ret);
}
ssl/s3_srvr.c:1186: error: INTEGER_OVERFLOW_L2
([0, max(0, `s->ctx->sessions->num_items`)] - 1):unsigned64 by call to `ssl_check_clienthello_tlsext_early`.
Showing all 13 steps of the trace
ssl/s3_srvr.c:916:1: Parameter `s->ctx->sessions->num_items`
914. }
915.
916. > int ssl3_get_client_hello(SSL *s)
917. {
918. int i,j,ok,al,ret= -1;
ssl/s3_srvr.c:1186:7: Call
1184. }
1185. }
1186. if (ssl_check_clienthello_tlsext_early(s) <= 0) {
^
1187. SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_CLIENTHELLO_TLSEXT);
1188. goto err;
ssl/t1_lib.c:1776:1: Parameter `s->ctx->sessions->num_items`
1774. }
1775.
1776. > int ssl_check_clienthello_tlsext_early(SSL *s)
1777. {
1778. int ret=SSL_TLSEXT_ERR_NOACK;
ssl/t1_lib.c:1857:4: Call
1855. {
1856. case SSL_TLSEXT_ERR_ALERT_FATAL:
1857. ssl3_send_alert(s,SSL3_AL_FATAL,al);
^
1858. return -1;
1859.
ssl/s3_pkt.c:1468:1: Parameter `s->ctx->sessions->num_items`
1466. }
1467.
1468. > int ssl3_send_alert(SSL *s, int level, int desc)
1469. {
1470. /* Map tls/ssl alert value to correct one */
ssl/s3_pkt.c:1477:3: Call
1475. /* If a fatal one, remove from cache */
1476. if ((level == 2) && (s->session != NULL))
1477. SSL_CTX_remove_session(s->ctx,s->session);
^
1478.
1479. s->s3->alert_dispatch=1;
ssl/ssl_sess.c:698:1: Parameter `ctx->sessions->num_items`
696. }
697.
698. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
699. {
700. return remove_session_lock(ctx, c, 1);
ssl/ssl_sess.c:700:9: Call
698. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
699. {
700. return remove_session_lock(ctx, c, 1);
^
701. }
702.
ssl/ssl_sess.c:703:1: Parameter `ctx->sessions->num_items`
701. }
702.
703. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
704. {
705. SSL_SESSION *r;
ssl/ssl_sess.c:714:6: Call
712. {
713. ret=1;
714. r=lh_SSL_SESSION_delete(ctx->sessions,c);
^
715. SSL_SESSION_list_remove(ctx,c);
716. }
crypto/lhash/lhash.c:217:1: <LHS trace>
215. }
216.
217. > void *lh_delete(_LHASH *lh, const void *data)
218. {
219. unsigned long hash;
crypto/lhash/lhash.c:217:1: Parameter `lh->num_items`
215. }
216.
217. > void *lh_delete(_LHASH *lh, const void *data)
218. {
219. unsigned long hash;
crypto/lhash/lhash.c:240:2: Binary operation: ([0, max(0, s->ctx->sessions->num_items)] - 1):unsigned64 by call to `ssl_check_clienthello_tlsext_early`
238. }
239.
240. lh->num_items--;
^
241. if ((lh->num_nodes > MIN_NODES) &&
242. (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)))
|
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/lhash/lhash.c/#L240
|
d2a_code_trace_data_42571
|
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);
}
crypto/err/err.c:343: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned64 by call to `lh_ERR_STRING_DATA_delete`.
Showing all 10 steps of the trace
crypto/err/err.c:343:15: Call
341. */
342. for (; str->error; str++)
343. (void)lh_ERR_STRING_DATA_delete(int_error_hash, str);
^
344. CRYPTO_THREAD_unlock(err_string_lock);
345.
include/openssl/err.h:206:1: Parameter `lh->num_items`
204. } ERR_STRING_DATA;
205.
206. > DEFINE_LHASH_OF(ERR_STRING_DATA);
207.
208. void ERR_put_error(int lib, int func, int reason, const char *file, int line);
include/openssl/err.h:206:1: Call
204. } ERR_STRING_DATA;
205.
206. > DEFINE_LHASH_OF(ERR_STRING_DATA);
207.
208. void ERR_put_error(int lib, int func, int reason, const char *file, int line);
crypto/lhash/lhash.c:106:1: Parameter `lh->num_items`
104. }
105.
106. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
107. {
108. unsigned long hash;
crypto/err/err.c:343:15: Call
341. */
342. for (; str->error; str++)
343. (void)lh_ERR_STRING_DATA_delete(int_error_hash, str);
^
344. CRYPTO_THREAD_unlock(err_string_lock);
345.
include/openssl/err.h:206:1: Parameter `lh->num_items`
204. } ERR_STRING_DATA;
205.
206. > DEFINE_LHASH_OF(ERR_STRING_DATA);
207.
208. void ERR_put_error(int lib, int func, int reason, const char *file, int line);
include/openssl/err.h:206:1: Call
204. } ERR_STRING_DATA;
205.
206. > DEFINE_LHASH_OF(ERR_STRING_DATA);
207.
208. void ERR_put_error(int lib, int func, int reason, const char *file, int line);
crypto/lhash/lhash.c:106:1: <LHS trace>
104. }
105.
106. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
107. {
108. unsigned long hash;
crypto/lhash/lhash.c:106:1: Parameter `lh->num_items`
104. }
105.
106. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
107. {
108. unsigned long hash;
crypto/lhash/lhash.c:126:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `lh_ERR_STRING_DATA_delete`
124. }
125.
126. lh->num_items--;
^
127. if ((lh->num_nodes > MIN_NODES) &&
128. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
|
https://github.com/openssl/openssl/blob/61ced34f8d7a7f1dedaa5a5b3554c4dcdec610df/crypto/lhash/lhash.c/#L126
|
d2a_code_trace_data_42572
|
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:2854: error: Null Dereference
pointer `mid` last assigned on line 2854 could be null and is dereferenced at line 2854, column 5.
ffmpeg.c:2846:1: start of procedure opt_metadata()
2844. }
2845.
2846. static int opt_metadata(const char *opt, const char *arg)
^
2847. {
2848. char *mid= strchr(arg, '=');
ffmpeg.c:2848:5:
2846. static int opt_metadata(const char *opt, const char *arg)
2847. {
2848. char *mid= strchr(arg, '=');
^
2849.
2850. if(!mid){
ffmpeg.c:2850:9: Taking true branch
2848. char *mid= strchr(arg, '=');
2849.
2850. if(!mid){
^
2851. fprintf(stderr, "Missing =\n");
2852. ffmpeg_exit(1);
ffmpeg.c:2851:9:
2849.
2850. if(!mid){
2851. fprintf(stderr, "Missing =\n");
^
2852. ffmpeg_exit(1);
2853. }
ffmpeg.c:2852:9: Skipping ffmpeg_exit(): empty list of specs
2850. if(!mid){
2851. fprintf(stderr, "Missing =\n");
2852. ffmpeg_exit(1);
^
2853. }
2854. *mid++= 0;
ffmpeg.c:2854:5:
2852. ffmpeg_exit(1);
2853. }
2854. *mid++= 0;
^
2855.
2856. av_metadata_set2(&metadata, arg, mid, 0);
|
https://github.com/libav/libav/blob/2d777bb7a20041ac0564ffef85bf40619af8ccd1/ffmpeg.c/#L2854
|
d2a_code_trace_data_42573
|
static void dequant_lsps(double *lsps, int num,
const uint16_t *values,
const uint16_t *sizes,
int n_stages, const uint8_t *table,
const double *mul_q,
const double *base_q)
{
int n, m;
memset(lsps, 0, num * sizeof(*lsps));
for (n = 0; n < n_stages; n++) {
const uint8_t *t_off = &table[values[n] * num];
double base = base_q[n], mul = mul_q[n];
for (m = 0; m < num; m++)
lsps[m] += base + mul * t_off[m];
table += sizes[n] * num;
}
}
libavcodec/wmavoice.c:1819: error: Buffer Overrun L1
Offset: [5, 11] (⇐ [5, 7] + [0, 4]) Size: 3 by call to `dequant_lsp16i`.
libavcodec/wmavoice.c:1734:1: Array declaration
1732. * fully parse the superframe
1733. */
1734. static int synth_superframe(AVCodecContext *ctx, AVFrame *frame,
^
1735. int *got_frame_ptr)
1736. {
libavcodec/wmavoice.c:1819:17: Call
1817. dequant_lsp10i(gb, lsps[n]);
1818. } else /* s->lsps == 16 */
1819. dequant_lsp16i(gb, lsps[n]);
^
1820.
1821. for (m = 0; m < s->lsps; m++)
libavcodec/wmavoice.c:917:1: Parameter `*lsps`
915. * Parse 16 independently-coded LSPs.
916. */
917. static void dequant_lsp16i(GetBitContext *gb, double *lsps)
^
918. {
919. static const uint16_t vec_sizes[5] = { 256, 64, 128, 64, 128 };
libavcodec/wmavoice.c:940:5: Call
938. dequant_lsps( lsps, 5, v, vec_sizes, 2,
939. wmavoice_dq_lsp16i1, mul_lsf, base_lsf);
940. dequant_lsps(&lsps[5], 5, &v[2], &vec_sizes[2], 2,
^
941. wmavoice_dq_lsp16i2, &mul_lsf[2], &base_lsf[2]);
942. dequant_lsps(&lsps[10], 6, &v[4], &vec_sizes[4], 1,
libavcodec/wmavoice.c:823:1: <Offset trace>
821. * @param base_q base (lowest) LSF values
822. */
823. static void dequant_lsps(double *lsps, int num,
^
824. const uint16_t *values,
825. const uint16_t *sizes,
libavcodec/wmavoice.c:823:1: Parameter `num`
821. * @param base_q base (lowest) LSF values
822. */
823. static void dequant_lsps(double *lsps, int num,
^
824. const uint16_t *values,
825. const uint16_t *sizes,
libavcodec/wmavoice.c:823:1: <Length trace>
821. * @param base_q base (lowest) LSF values
822. */
823. static void dequant_lsps(double *lsps, int num,
^
824. const uint16_t *values,
825. const uint16_t *sizes,
libavcodec/wmavoice.c:823:1: Parameter `*lsps`
821. * @param base_q base (lowest) LSF values
822. */
823. static void dequant_lsps(double *lsps, int num,
^
824. const uint16_t *values,
825. const uint16_t *sizes,
libavcodec/wmavoice.c:838:13: Array access: Offset: [5, 11] (⇐ [5, 7] + [0, 4]) Size: 3 by call to `dequant_lsp16i`
836.
837. for (m = 0; m < num; m++)
838. lsps[m] += base + mul * t_off[m];
^
839.
840. table += sizes[n] * num;
|
https://github.com/libav/libav/blob/c6507946d428ee082676d5917fbb3eb0d1d7eb2e/libavcodec/wmavoice.c/#L838
|
d2a_code_trace_data_42574
|
DECLAREContigPutFunc(put8bitcmaptile)
{
uint32** PALmap = img->PALmap;
int samplesperpixel = img->samplesperpixel;
(void) y;
while (h-- > 0) {
for (x = w; x-- > 0;)
{
*cp++ = PALmap[*pp][0];
pp += samplesperpixel;
}
cp += toskew;
pp += fromskew;
}
}
libtiff/tif_getimage.c:1076: error: Integer Overflow L2
([0, `w`] - 1):unsigned32.
libtiff/tif_getimage.c:1069:1: <LHS trace>
1067. * 8-bit palette => colormap/RGB
1068. */
1069. DECLAREContigPutFunc(put8bitcmaptile)
^
1070. {
1071. uint32** PALmap = img->PALmap;
libtiff/tif_getimage.c:1069:1: Parameter `w`
1067. * 8-bit palette => colormap/RGB
1068. */
1069. DECLAREContigPutFunc(put8bitcmaptile)
^
1070. {
1071. uint32** PALmap = img->PALmap;
libtiff/tif_getimage.c:1076:7: Assignment
1074. (void) y;
1075. while (h-- > 0) {
1076. for (x = w; x-- > 0;)
^
1077. {
1078. *cp++ = PALmap[*pp][0];
libtiff/tif_getimage.c:1076:14: Binary operation: ([0, w] - 1):unsigned32
1074. (void) y;
1075. while (h-- > 0) {
1076. for (x = w; x-- > 0;)
^
1077. {
1078. *cp++ = PALmap[*pp][0];
|
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_getimage.c/#L1076
|
d2a_code_trace_data_42575
|
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_blind.c:194: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_mod_mul_montgomery`.
Showing all 24 steps of the trace
crypto/bn/bn_blind.c:167:1: Parameter `n->top`
165. }
166.
167. > int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b,
168. BN_CTX *ctx)
169. {
crypto/bn/bn_blind.c:194:15: Call
192. n->flags |= (BN_FLG_FIXED_TOP & ~mask);
193. }
194. ret = BN_mod_mul_montgomery(n, n, r, b->m_ctx, ctx);
^
195. } else {
196. ret = BN_mod_mul(n, n, r, b->mod, ctx);
crypto/bn/bn_mont.c:26:1: Parameter `r->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: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 `r->top`
35. }
36.
37. > int bn_mul_mont_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
38. BN_MONT_CTX *mont, BN_CTX *ctx)
39. {
crypto/bn/bn_mont.c:75:10: Call
73. /* reduce from aRR to aR */
74. #ifdef MONT_WORD
75. if (!bn_from_montgomery_word(r, tmp, mont))
^
76. goto err;
77. #else
crypto/bn/bn_mont.c:88:1: Parameter `ret->top`
86.
87. #ifdef MONT_WORD
88. > static int bn_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont)
89. {
90. BIGNUM *n;
crypto/bn/bn_mont.c:133:9: Call
131. }
132.
133. if (bn_wexpand(ret, nl) == NULL)
^
134. return 0;
135. ret->top = nl;
crypto/bn/bn_lib.c:960:1: Parameter `a->top`
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->top`
243. */
244.
245. > BIGNUM *bn_expand2(BIGNUM *b, int words)
246. {
247. if (words > b->dmax) {
crypto/bn/bn_lib.c:248:23: Call
246. {
247. if (words > b->dmax) {
248. BN_ULONG *a = bn_expand_internal(b, words);
^
249. if (!a)
250. return NULL;
crypto/bn/bn_lib.c:209:1: <Offset trace>
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: Parameter `b->top`
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: <Length trace>
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: Parameter `words`
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:224:13: Call
222. a = OPENSSL_secure_zalloc(words * sizeof(*a));
223. else
224. a = OPENSSL_zalloc(words * sizeof(*a));
^
225. if (a == NULL) {
226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
crypto/mem.c:228:1: Parameter `num`
226. }
227.
228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:230:17: Call
228. void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
^
231.
232. FAILTEST();
crypto/mem.c:201:9: Assignment
199.
200. if (num == 0)
201. return NULL;
^
202.
203. FAILTEST();
crypto/mem.c:230:5: Assignment
228. void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
^
231.
232. FAILTEST();
crypto/mem.c:235:5: Assignment
233. if (ret != NULL)
234. memset(ret, 0, num);
235. return ret;
^
236. }
237.
crypto/bn/bn_lib.c:224:9: Assignment
222. a = OPENSSL_secure_zalloc(words * sizeof(*a));
223. else
224. a = OPENSSL_zalloc(words * sizeof(*a));
^
225. if (a == NULL) {
226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_mod_mul_montgomery`
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_42576
|
static int read_sl_header(PESContext *pes, SLConfigDescr *sl, const uint8_t *buf, int buf_size)
{
GetBitContext gb;
int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0;
int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0;
int dts_flag = -1, cts_flag = -1;
int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE;
init_get_bits(&gb, buf, buf_size*8);
if (sl->use_au_start)
au_start_flag = get_bits1(&gb);
if (sl->use_au_end)
au_end_flag = get_bits1(&gb);
if (!sl->use_au_start && !sl->use_au_end)
au_start_flag = au_end_flag = 1;
if (sl->ocr_len > 0)
ocr_flag = get_bits1(&gb);
if (sl->use_idle)
idle_flag = get_bits1(&gb);
if (sl->use_padding)
padding_flag = get_bits1(&gb);
if (padding_flag)
padding_bits = get_bits(&gb, 3);
if (!idle_flag && (!padding_flag || padding_bits != 0)) {
if (sl->packet_seq_num_len)
skip_bits_long(&gb, sl->packet_seq_num_len);
if (sl->degr_prior_len)
if (get_bits1(&gb))
skip_bits(&gb, sl->degr_prior_len);
if (ocr_flag)
skip_bits_long(&gb, sl->ocr_len);
if (au_start_flag) {
if (sl->use_rand_acc_pt)
get_bits1(&gb);
if (sl->au_seq_num_len > 0)
skip_bits_long(&gb, sl->au_seq_num_len);
if (sl->use_timestamps) {
dts_flag = get_bits1(&gb);
cts_flag = get_bits1(&gb);
}
}
if (sl->inst_bitrate_len)
inst_bitrate_flag = get_bits1(&gb);
if (dts_flag == 1)
dts = get_bits64(&gb, sl->timestamp_len);
if (cts_flag == 1)
cts = get_bits64(&gb, sl->timestamp_len);
if (sl->au_len > 0)
skip_bits_long(&gb, sl->au_len);
if (inst_bitrate_flag)
skip_bits_long(&gb, sl->inst_bitrate_len);
}
if (dts != AV_NOPTS_VALUE)
pes->dts = dts;
if (cts != AV_NOPTS_VALUE)
pes->pts = cts;
if (sl->timestamp_len && sl->timestamp_res)
avpriv_set_pts_info(pes->st, sl->timestamp_len, 1, sl->timestamp_res);
return (get_bits_count(&gb) + 7) >> 3;
}
libavformat/mpegts.c:694: error: Null Dereference
pointer `&gb->buffer` last assigned on line 689 could be null and is dereferenced by call to `get_bits1()` at line 694, column 23.
libavformat/mpegts.c:682:1: start of procedure read_sl_header()
680. }
681.
682. static int read_sl_header(PESContext *pes, SLConfigDescr *sl, const uint8_t *buf, int buf_size)
^
683. {
684. GetBitContext gb;
libavformat/mpegts.c:685:5:
683. {
684. GetBitContext gb;
685. int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0;
^
686. int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0;
687. int dts_flag = -1, cts_flag = -1;
libavformat/mpegts.c:686:5:
684. GetBitContext gb;
685. int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0;
686. int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0;
^
687. int dts_flag = -1, cts_flag = -1;
688. int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE;
libavformat/mpegts.c:687:5:
685. int au_start_flag = 0, au_end_flag = 0, ocr_flag = 0, idle_flag = 0;
686. int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0;
687. int dts_flag = -1, cts_flag = -1;
^
688. int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE;
689. init_get_bits(&gb, buf, buf_size*8);
libavformat/mpegts.c:688:5:
686. int padding_flag = 0, padding_bits = 0, inst_bitrate_flag = 0;
687. int dts_flag = -1, cts_flag = -1;
688. int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE;
^
689. init_get_bits(&gb, buf, buf_size*8);
690.
libavformat/mpegts.c:689:5:
687. int dts_flag = -1, cts_flag = -1;
688. int64_t dts = AV_NOPTS_VALUE, cts = AV_NOPTS_VALUE;
689. init_get_bits(&gb, buf, buf_size*8);
^
690.
691. if (sl->use_au_start)
libavcodec/get_bits.h:352:1: start of procedure init_get_bits()
350. * @param bit_size the size of the buffer in bits
351. */
352. static inline void init_get_bits(GetBitContext *s, const uint8_t *buffer,
^
353. int bit_size)
354. {
libavcodec/get_bits.h:355:5:
353. int bit_size)
354. {
355. int buffer_size = (bit_size+7)>>3;
^
356. if (buffer_size < 0 || bit_size < 0) {
357. buffer_size = bit_size = 0;
libavcodec/get_bits.h:356:9: Taking true branch
354. {
355. int buffer_size = (bit_size+7)>>3;
356. if (buffer_size < 0 || bit_size < 0) {
^
357. buffer_size = bit_size = 0;
358. buffer = NULL;
libavcodec/get_bits.h:357:9:
355. int buffer_size = (bit_size+7)>>3;
356. if (buffer_size < 0 || bit_size < 0) {
357. buffer_size = bit_size = 0;
^
358. buffer = NULL;
359. }
libavcodec/get_bits.h:358:9:
356. if (buffer_size < 0 || bit_size < 0) {
357. buffer_size = bit_size = 0;
358. buffer = NULL;
^
359. }
360.
libavcodec/get_bits.h:361:5:
359. }
360.
361. s->buffer = buffer;
^
362. s->size_in_bits = bit_size;
363. #if !UNCHECKED_BITSTREAM_READER
libavcodec/get_bits.h:362:5:
360.
361. s->buffer = buffer;
362. s->size_in_bits = bit_size;
^
363. #if !UNCHECKED_BITSTREAM_READER
364. s->size_in_bits_plus8 = bit_size + 8;
libavcodec/get_bits.h:364:5:
362. s->size_in_bits = bit_size;
363. #if !UNCHECKED_BITSTREAM_READER
364. s->size_in_bits_plus8 = bit_size + 8;
^
365. #endif
366. s->buffer_end = buffer + buffer_size;
libavcodec/get_bits.h:366:5:
364. s->size_in_bits_plus8 = bit_size + 8;
365. #endif
366. s->buffer_end = buffer + buffer_size;
^
367. s->index = 0;
368. }
libavcodec/get_bits.h:367:5:
365. #endif
366. s->buffer_end = buffer + buffer_size;
367. s->index = 0;
^
368. }
369.
libavcodec/get_bits.h:368:1: return from a call to init_get_bits
366. s->buffer_end = buffer + buffer_size;
367. s->index = 0;
368. }
^
369.
370. static inline void align_get_bits(GetBitContext *s)
libavformat/mpegts.c:691:9: Taking false branch
689. init_get_bits(&gb, buf, buf_size*8);
690.
691. if (sl->use_au_start)
^
692. au_start_flag = get_bits1(&gb);
693. if (sl->use_au_end)
libavformat/mpegts.c:693:9: Taking true branch
691. if (sl->use_au_start)
692. au_start_flag = get_bits1(&gb);
693. if (sl->use_au_end)
^
694. au_end_flag = get_bits1(&gb);
695. if (!sl->use_au_start && !sl->use_au_end)
libavformat/mpegts.c:694:9:
692. au_start_flag = get_bits1(&gb);
693. if (sl->use_au_end)
694. au_end_flag = get_bits1(&gb);
^
695. if (!sl->use_au_start && !sl->use_au_end)
696. au_start_flag = au_end_flag = 1;
libavcodec/get_bits.h:268:1: start of procedure get_bits1()
266. }
267.
268. static inline unsigned int get_bits1(GetBitContext *s)
^
269. {
270. unsigned int index = s->index;
libavcodec/get_bits.h:270:5:
268. static inline unsigned int get_bits1(GetBitContext *s)
269. {
270. unsigned int index = s->index;
^
271. uint8_t result = s->buffer[index>>3];
272. #ifdef BITSTREAM_READER_LE
libavcodec/get_bits.h:271:5:
269. {
270. unsigned int index = s->index;
271. uint8_t result = s->buffer[index>>3];
^
272. #ifdef BITSTREAM_READER_LE
273. result >>= index & 7;
|
https://github.com/libav/libav/blob/e5356ebf2216918ad6351d4caa8b58c881c4b0ea/libavformat/mpegts.c/#L694
|
d2a_code_trace_data_42577
|
int is_partially_overlapping(const void *ptr1, const void *ptr2, int len)
{
PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2;
int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) |
(diff > (0 - (PTRDIFF_T)len)));
return overlapped;
}
crypto/evp/bio_enc.c:201: error: INTEGER_OVERFLOW_L2
(0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate`.
Showing all 9 steps of the trace
crypto/evp/bio_enc.c:201:18: Call
199. if (i > ENC_MIN_CHUNK)
200. i = ENC_MIN_CHUNK;
201. if (!EVP_CipherUpdate(ctx->cipher,
^
202. ctx->buf, &ctx->buf_len,
203. ctx->read_start, i)) {
crypto/evp/evp_enc.c:205:1: Parameter `ctx->cipher->block_size`
203. }
204.
205. > int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
206. const unsigned char *in, int inl)
207. {
crypto/evp/evp_enc.c:211:16: Call
209. return EVP_EncryptUpdate(ctx, out, outl, in, inl);
210. else
211. return EVP_DecryptUpdate(ctx, out, outl, in, inl);
^
212. }
213.
crypto/evp/evp_enc.c:416:1: Parameter `ctx->cipher->block_size`
414. }
415.
416. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
417. const unsigned char *in, int inl)
418. {
crypto/evp/evp_enc.c:422:5: Assignment
420. unsigned int b;
421.
422. b = ctx->cipher->block_size;
^
423.
424. if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
crypto/evp/evp_enc.c:452:16: Call
450. /* see comment about PTRDIFF_T comparison above */
451. if (((PTRDIFF_T)out == (PTRDIFF_T)in)
452. || is_partially_overlapping(out, in, b)) {
^
453. EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING);
454. return 0;
crypto/evp/evp_enc.c:279:1: <RHS trace>
277. #endif
278.
279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len)
280. {
281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2;
crypto/evp/evp_enc.c:279:1: Parameter `len`
277. #endif
278.
279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len)
280. {
281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2;
crypto/evp/evp_enc.c:288:50: Binary operation: (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate`
286. */
287. int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) |
288. (diff > (0 - (PTRDIFF_T)len)));
^
289.
290. return overlapped;
|
https://github.com/openssl/openssl/blob/b1531d8e6cc95837e38b10d875ae64144c6fdf7a/crypto/evp/evp_enc.c/#L288
|
d2a_code_trace_data_42578
|
BIO *bio_open_owner(const char *filename, int format, int private)
{
FILE *fp = NULL;
BIO *b = NULL;
int fd = -1, bflags, mode, binmode;
if (!private || filename == NULL || strcmp(filename, "-") == 0)
return bio_open_default(filename, 'w', format);
mode = O_WRONLY;
#ifdef O_CREAT
mode |= O_CREAT;
#endif
#ifdef O_TRUNC
mode |= O_TRUNC;
#endif
binmode = istext(format);
if (binmode) {
#ifdef O_BINARY
mode |= O_BINARY;
#elif defined(_O_BINARY)
mode |= _O_BINARY;
#endif
}
fd = open(filename, mode, 0600);
if (fd < 0)
goto err;
fp = fdopen(fd, modestr('w', format));
if (fp == NULL)
goto err;
bflags = BIO_CLOSE;
if (!binmode)
bflags |= BIO_FP_TEXT;
b = BIO_new_fp(fp, bflags);
if (b)
return b;
err:
BIO_printf(bio_err, "%s: Can't open \"%s\" for writing, %s\n",
opt_getprog(), filename, strerror(errno));
ERR_print_errors(bio_err);
if (fp)
fclose(fp);
else if (fd >= 0)
close(fd);
return NULL;
}
apps/apps.c:2819: error: RESOURCE_LEAK
resource of type `_IO_FILE` acquired by call to `fdopen()` at line 2811, column 10 is not released after line 2819, column 16.
Showing all 33 steps of the trace
apps/apps.c:2783:1: start of procedure bio_open_owner()
2781. * Open a file for writing, owner-read-only.
2782. */
2783. > BIO *bio_open_owner(const char *filename, int format, int private)
2784. {
2785. FILE *fp = NULL;
apps/apps.c:2785:5:
2783. BIO *bio_open_owner(const char *filename, int format, int private)
2784. {
2785. > FILE *fp = NULL;
2786. BIO *b = NULL;
2787. int fd = -1, bflags, mode, binmode;
apps/apps.c:2786:5:
2784. {
2785. FILE *fp = NULL;
2786. > BIO *b = NULL;
2787. int fd = -1, bflags, mode, binmode;
2788.
apps/apps.c:2787:5:
2785. FILE *fp = NULL;
2786. BIO *b = NULL;
2787. > int fd = -1, bflags, mode, binmode;
2788.
2789. if (!private || filename == NULL || strcmp(filename, "-") == 0)
apps/apps.c:2789:10: Taking false branch
2787. int fd = -1, bflags, mode, binmode;
2788.
2789. if (!private || filename == NULL || strcmp(filename, "-") == 0)
^
2790. return bio_open_default(filename, 'w', format);
2791.
apps/apps.c:2789:21: Taking false branch
2787. int fd = -1, bflags, mode, binmode;
2788.
2789. if (!private || filename == NULL || strcmp(filename, "-") == 0)
^
2790. return bio_open_default(filename, 'w', format);
2791.
apps/apps.c:2789:41: Taking false branch
2787. int fd = -1, bflags, mode, binmode;
2788.
2789. if (!private || filename == NULL || strcmp(filename, "-") == 0)
^
2790. return bio_open_default(filename, 'w', format);
2791.
apps/apps.c:2792:5:
2790. return bio_open_default(filename, 'w', format);
2791.
2792. > mode = O_WRONLY;
2793. #ifdef O_CREAT
2794. mode |= O_CREAT;
apps/apps.c:2794:5:
2792. mode = O_WRONLY;
2793. #ifdef O_CREAT
2794. > mode |= O_CREAT;
2795. #endif
2796. #ifdef O_TRUNC
apps/apps.c:2797:5:
2795. #endif
2796. #ifdef O_TRUNC
2797. > mode |= O_TRUNC;
2798. #endif
2799. binmode = istext(format);
apps/apps.c:2799:5:
2797. mode |= O_TRUNC;
2798. #endif
2799. > binmode = istext(format);
2800. if (binmode) {
2801. #ifdef O_BINARY
apps/apps.c:2724:1: start of procedure istext()
2722. * text and binary input/output on non-Unix platforms
2723. */
2724. > static int istext(int format)
2725. {
2726. return (format & B_FORMAT_TEXT) == B_FORMAT_TEXT;
apps/apps.c:2726:12: Condition is true
2724. static int istext(int format)
2725. {
2726. return (format & B_FORMAT_TEXT) == B_FORMAT_TEXT;
^
2727. }
2728.
apps/apps.c:2726:5:
2724. static int istext(int format)
2725. {
2726. > return (format & B_FORMAT_TEXT) == B_FORMAT_TEXT;
2727. }
2728.
apps/apps.c:2727:1: return from a call to istext
2725. {
2726. return (format & B_FORMAT_TEXT) == B_FORMAT_TEXT;
2727. > }
2728.
2729. BIO *dup_bio_in(int format)
apps/apps.c:2800:9: Taking true branch
2798. #endif
2799. binmode = istext(format);
2800. if (binmode) {
^
2801. #ifdef O_BINARY
2802. mode |= O_BINARY;
apps/apps.c:2808:5:
2806. }
2807.
2808. > fd = open(filename, mode, 0600);
2809. if (fd < 0)
2810. goto err;
apps/apps.c:2809:9: Taking false branch
2807.
2808. fd = open(filename, mode, 0600);
2809. if (fd < 0)
^
2810. goto err;
2811. fp = fdopen(fd, modestr('w', format));
apps/apps.c:2811:5:
2809. if (fd < 0)
2810. goto err;
2811. > fp = fdopen(fd, modestr('w', format));
2812. if (fp == NULL)
2813. goto err;
apps/apps.c:2751:1: start of procedure modestr()
2749. }
2750.
2751. > static const char *modestr(char mode, int format)
2752. {
2753. OPENSSL_assert(mode == 'a' || mode == 'r' || mode == 'w');
apps/apps.c:2753:5: Condition is true
2751. static const char *modestr(char mode, int format)
2752. {
2753. OPENSSL_assert(mode == 'a' || mode == 'r' || mode == 'w');
^
2754.
2755. switch (mode) {
apps/apps.c:2755:5:
2753. OPENSSL_assert(mode == 'a' || mode == 'r' || mode == 'w');
2754.
2755. > switch (mode) {
2756. case 'a':
2757. return istext(format) ? "a" : "ab";
apps/apps.c:2756:5: Switch condition is false. Skipping switch case
2754.
2755. switch (mode) {
2756. case 'a':
^
2757. return istext(format) ? "a" : "ab";
2758. case 'r':
apps/apps.c:2758:5: Switch condition is false. Skipping switch case
2756. case 'a':
2757. return istext(format) ? "a" : "ab";
2758. case 'r':
^
2759. return istext(format) ? "r" : "rb";
2760. case 'w':
apps/apps.c:2760:5: Switch condition is false. Skipping switch case
2758. case 'r':
2759. return istext(format) ? "r" : "rb";
2760. case 'w':
^
2761. return istext(format) ? "w" : "wb";
2762. }
apps/apps.c:2764:5:
2762. }
2763. /* The assert above should make sure we never reach this point */
2764. > return NULL;
2765. }
2766.
apps/apps.c:2765:1: return from a call to modestr
2763. /* The assert above should make sure we never reach this point */
2764. return NULL;
2765. > }
2766.
2767. static const char *modeverb(char mode)
apps/apps.c:2812:9: Taking false branch
2810. goto err;
2811. fp = fdopen(fd, modestr('w', format));
2812. if (fp == NULL)
^
2813. goto err;
2814. bflags = BIO_CLOSE;
apps/apps.c:2814:5:
2812. if (fp == NULL)
2813. goto err;
2814. > bflags = BIO_CLOSE;
2815. if (!binmode)
2816. bflags |= BIO_FP_TEXT;
apps/apps.c:2815:10: Taking false branch
2813. goto err;
2814. bflags = BIO_CLOSE;
2815. if (!binmode)
^
2816. bflags |= BIO_FP_TEXT;
2817. b = BIO_new_fp(fp, bflags);
apps/apps.c:2817:5: Skipping BIO_new_fp(): empty list of specs
2815. if (!binmode)
2816. bflags |= BIO_FP_TEXT;
2817. b = BIO_new_fp(fp, bflags);
^
2818. if (b)
2819. return b;
apps/apps.c:2818:9: Taking true branch
2816. bflags |= BIO_FP_TEXT;
2817. b = BIO_new_fp(fp, bflags);
2818. if (b)
^
2819. return b;
2820.
apps/apps.c:2819:9:
2817. b = BIO_new_fp(fp, bflags);
2818. if (b)
2819. > return b;
2820.
2821. err:
|
https://github.com/openssl/openssl/blob/aec27d4d5210234560deab85c97bd453535f66ae/apps/apps.c/#L2819
|
d2a_code_trace_data_42579
|
static int read_old_huffman_tables(HYuvContext *s){
#if 1
GetBitContext gb;
int i;
init_get_bits(&gb, classic_shift_luma, sizeof(classic_shift_luma)*8);
read_len_table(s->len[0], &gb);
init_get_bits(&gb, classic_shift_chroma, sizeof(classic_shift_chroma)*8);
read_len_table(s->len[1], &gb);
for(i=0; i<256; i++) s->bits[0][i] = classic_add_luma [i];
for(i=0; i<256; i++) s->bits[1][i] = classic_add_chroma[i];
if(s->bitstream_bpp >= 24){
memcpy(s->bits[1], s->bits[0], 256*sizeof(uint32_t));
memcpy(s->len[1] , s->len [0], 256*sizeof(uint8_t));
}
memcpy(s->bits[2], s->bits[1], 256*sizeof(uint32_t));
memcpy(s->len[2] , s->len [1], 256*sizeof(uint8_t));
for(i=0; i<3; i++){
free_vlc(&s->vlc[i]);
init_vlc(&s->vlc[i], VLC_BITS, 256, s->len[i], 1, 1, s->bits[i], 4, 4, 0);
}
generate_joint_tables(s);
return 0;
#else
av_log(s->avctx, AV_LOG_DEBUG, "v1 huffyuv is not supported \n");
return -1;
#endif
}
libavcodec/huffyuv.c:434: error: Buffer Overrun L3
Offset added: 1024 Size: [0, +oo].
libavcodec/huffyuv.c:417:1: <Length trace>
415. }
416.
417. static int read_old_huffman_tables(HYuvContext *s){
^
418. #if 1
419. GetBitContext gb;
libavcodec/huffyuv.c:417:1: Parameter `s->bits[*][*]`
415. }
416.
417. static int read_old_huffman_tables(HYuvContext *s){
^
418. #if 1
419. GetBitContext gb;
libavcodec/huffyuv.c:434:5: Array access: Offset added: 1024 Size: [0, +oo]
432. memcpy(s->len[1] , s->len [0], 256*sizeof(uint8_t));
433. }
434. memcpy(s->bits[2], s->bits[1], 256*sizeof(uint32_t));
^
435. memcpy(s->len[2] , s->len [1], 256*sizeof(uint8_t));
436.
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/huffyuv.c/#L434
|
d2a_code_trace_data_42580
|
void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset,
MPA_INT *window, int *dither_state,
OUT_INT *samples, int incr,
int32_t sb_samples[SBLIMIT])
{
int32_t tmp[32];
register MPA_INT *synth_buf;
register const MPA_INT *w, *w2, *p;
int j, offset, v;
OUT_INT *samples2;
#if FRAC_BITS <= 15
int sum, sum2;
#else
int64_t sum, sum2;
#endif
dct32(tmp, sb_samples);
offset = *synth_buf_offset;
synth_buf = synth_buf_ptr + offset;
for(j=0;j<32;j++) {
v = tmp[j];
#if FRAC_BITS <= 15
v = av_clip_int16(v);
#endif
synth_buf[j] = v;
}
memcpy(synth_buf + 512, synth_buf, 32 * sizeof(MPA_INT));
samples2 = samples + 31 * incr;
w = window;
w2 = window + 31;
sum = *dither_state;
p = synth_buf + 16;
SUM8(sum, +=, w, p);
p = synth_buf + 48;
SUM8(sum, -=, w + 32, p);
*samples = round_sample(&sum);
samples += incr;
w++;
for(j=1;j<16;j++) {
sum2 = 0;
p = synth_buf + 16 + j;
SUM8P2(sum, +=, sum2, -=, w, w2, p);
p = synth_buf + 48 - j;
SUM8P2(sum, -=, sum2, -=, w + 32, w2 + 32, p);
*samples = round_sample(&sum);
samples += incr;
sum += sum2;
*samples2 = round_sample(&sum);
samples2 -= incr;
w++;
w2--;
}
p = synth_buf + 32;
SUM8(sum, -=, w + 32, p);
*samples = round_sample(&sum);
*dither_state= sum;
offset = (offset - 32) & 511;
*synth_buf_offset = offset;
}
libavcodec/mpc.c:60: error: Buffer Overrun L2
Offset: [224+min(0, `c->synth_buf_offset[*]`), 225+max(511, `c->synth_buf_offset[*]`)] (⇐ [32+min(0, `c->synth_buf_offset[*]`), 33+max(511, `c->synth_buf_offset[*]`)] + 192) Size: 2 by call to `ff_mpa_synth_filter`.
libavcodec/mpc.c:51:1: Parameter `c->synth_buf[*]`
49. * Process decoded Musepack data and produce PCM
50. */
51. static void mpc_synth(MPCContext *c, int16_t *out)
^
52. {
53. int dither_state = 0;
libavcodec/mpc.c:60:13: Call
58. samples_ptr = samples + ch;
59. for(i = 0; i < SAMPLES_PER_BAND; i++) {
60. ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]),
^
61. mpa_window, &dither_state,
62. samples_ptr, 2,
libavcodec/mpegaudiodec.c:858:1: <Length trace>
856. 32 samples. */
857. /* XXX: optimize by avoiding ring buffer usage */
858. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset,
^
859. MPA_INT *window, int *dither_state,
860. OUT_INT *samples, int incr,
libavcodec/mpegaudiodec.c:858:1: Parameter `*synth_buf_ptr`
856. 32 samples. */
857. /* XXX: optimize by avoiding ring buffer usage */
858. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset,
^
859. MPA_INT *window, int *dither_state,
860. OUT_INT *samples, int incr,
libavcodec/mpegaudiodec.c:877:5: Assignment
875.
876. offset = *synth_buf_offset;
877. synth_buf = synth_buf_ptr + offset;
^
878.
879. for(j=0;j<32;j++) {
libavcodec/mpegaudiodec.c:922:5: Assignment
920. }
921.
922. p = synth_buf + 32;
^
923. SUM8(sum, -=, w + 32, p);
924. *samples = round_sample(&sum);
libavcodec/mpegaudiodec.c:923:5: Array access: Offset: [224+min(0, c->synth_buf_offset[*]), 225+max(511, c->synth_buf_offset[*])] (⇐ [32+min(0, c->synth_buf_offset[*]), 33+max(511, c->synth_buf_offset[*])] + 192) Size: 2 by call to `ff_mpa_synth_filter`
921.
922. p = synth_buf + 32;
923. SUM8(sum, -=, w + 32, p);
^
924. *samples = round_sample(&sum);
925. *dither_state= sum;
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L923
|
d2a_code_trace_data_42581
|
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
{
int i, j, max;
const BN_ULONG *ap;
BN_ULONG *rp;
max = n * 2;
ap = a;
rp = r;
rp[0] = rp[max - 1] = 0;
rp++;
j = n;
if (--j > 0) {
ap++;
rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
rp += 2;
}
for (i = n - 2; i > 0; i--) {
j--;
ap++;
rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]);
rp += 2;
}
bn_add_words(r, r, r, max);
bn_sqr_words(tmp, a, n);
bn_add_words(r, r, tmp, max);
}
crypto/rsa/rsa_ossl.c:434: error: BUFFER_OVERRUN_L3
Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `rsa_blinding_convert`.
Showing all 21 steps of the trace
crypto/rsa/rsa_ossl.c:412:9: Call
410.
411. /* make data into a big number */
412. if (BN_bin2bn(from, (int)flen, f) == NULL)
^
413. goto err;
414.
crypto/bn/bn_lib.c:407:1: Parameter `ret->top`
405. }
406.
407. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
408. {
409. unsigned int i, m;
crypto/rsa/rsa_ossl.c:434:14: Call
432. goto err;
433. }
434. if (!rsa_blinding_convert(blinding, f, unblind, ctx))
^
435. goto err;
436. }
crypto/rsa/rsa_ossl.c:200:1: Parameter `f->top`
198. }
199.
200. > static int rsa_blinding_convert(BN_BLINDING *b, BIGNUM *f, BIGNUM *unblind,
201. BN_CTX *ctx)
202. {
crypto/rsa/rsa_ossl.c:207:16: Call
205. * Local blinding: store the unblinding factor in BN_BLINDING.
206. */
207. return BN_BLINDING_convert_ex(f, NULL, b, ctx);
^
208. } else {
209. /*
crypto/bn/bn_blind.c:130:1: Parameter `n->top`
128. }
129.
130. > int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx)
131. {
132. int ret = 1;
crypto/bn/bn_blind.c:152:10: Call
150. }
151.
152. if (!BN_mod_mul(n, n, b->A, b->mod, ctx))
^
153. ret = 0;
154.
crypto/bn/bn_mod.c:73:1: Parameter `a->top`
71.
72. /* slow but works */
73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
74. BN_CTX *ctx)
75. {
crypto/bn/bn_mod.c:87:14: Call
85. goto err;
86. if (a == b) {
87. if (!BN_sqr(t, a, ctx))
^
88. goto err;
89. } else {
crypto/bn/bn_sqr.c:17:1: Parameter `a->top`
15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96
16. */
17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
18. {
19. int max, al;
crypto/bn/bn_sqr.c:25:5: Assignment
23. bn_check_top(a);
24.
25. al = a->top;
^
26. if (al <= 0) {
27. r->top = 0;
crypto/bn/bn_sqr.c:74:17: Call
72. if (bn_wexpand(tmp, max) == NULL)
73. goto err;
74. bn_sqr_normal(rr->d, a->d, al, tmp->d);
^
75. }
76. }
crypto/bn/bn_sqr.c:105:1: <Offset trace>
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:105:1: Parameter `n`
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c: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 `rsa_blinding_convert`
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/aa048aef0b9146f90c06333dedfc105d1f9e2c22/crypto/bn/bn_sqr.c/#L120
|
d2a_code_trace_data_42582
|
PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt(int pbe_nid,
const char *pass,
int passlen,
unsigned char *salt,
int saltlen, int iter,
PKCS8_PRIV_KEY_INFO *p8inf)
{
PKCS12_SAFEBAG *bag;
const EVP_CIPHER *pbe_ciph;
X509_SIG *p8;
pbe_ciph = EVP_get_cipherbynid(pbe_nid);
if (pbe_ciph)
pbe_nid = -1;
p8 = PKCS8_encrypt(pbe_nid, pbe_ciph, pass, passlen, salt, saltlen, iter,
p8inf);
if (p8 == NULL) {
PKCS12err(PKCS12_F_PKCS12_SAFEBAG_CREATE_PKCS8_ENCRYPT, ERR_R_MALLOC_FAILURE);
return NULL;
}
bag = PKCS12_SAFEBAG_create0_pkcs8(p8);
if (bag == NULL) {
PKCS12err(PKCS12_F_PKCS12_SAFEBAG_CREATE_PKCS8_ENCRYPT, ERR_R_MALLOC_FAILURE);
X509_SIG_free(p8);
return NULL;
}
return bag;
}
crypto/pkcs12/p12_sbag.c:153: error: NULL_DEREFERENCE
pointer `pbe_ciph` last assigned on line 148 could be null and is dereferenced by call to `PKCS8_encrypt()` at line 153, column 10.
Showing all 39 steps of the trace
crypto/pkcs12/p12_sbag.c:137:1: start of procedure PKCS12_SAFEBAG_create_pkcs8_encrypt()
135. }
136.
137. > PKCS12_SAFEBAG *PKCS12_SAFEBAG_create_pkcs8_encrypt(int pbe_nid,
138. const char *pass,
139. int passlen,
crypto/pkcs12/p12_sbag.c:148:5:
146. X509_SIG *p8;
147.
148. > pbe_ciph = EVP_get_cipherbynid(pbe_nid);
149.
150. if (pbe_ciph)
crypto/objects/obj_dat.c:247:1: start of procedure OBJ_nid2sn()
245. }
246.
247. > const char *OBJ_nid2sn(int n)
248. {
249. ADDED_OBJ ad, *adp;
crypto/objects/obj_dat.c:252:10: Taking true branch
250. ASN1_OBJECT ob;
251.
252. if ((n >= 0) && (n < NUM_NID)) {
^
253. if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) {
254. OBJerr(OBJ_F_OBJ_NID2SN, OBJ_R_UNKNOWN_NID);
crypto/objects/obj_dat.c:252:22: Taking false branch
250. ASN1_OBJECT ob;
251.
252. if ((n >= 0) && (n < NUM_NID)) {
^
253. if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) {
254. OBJerr(OBJ_F_OBJ_NID2SN, OBJ_R_UNKNOWN_NID);
crypto/objects/obj_dat.c:258:16: Taking false branch
256. }
257. return nid_objs[n].sn;
258. } else if (added == NULL)
^
259. return NULL;
260. else {
crypto/objects/obj_dat.c:261:9:
259. return NULL;
260. else {
261. > ad.type = ADDED_NID;
262. ad.obj = &ob;
263. ob.nid = n;
crypto/objects/obj_dat.c:262:9:
260. else {
261. ad.type = ADDED_NID;
262. > ad.obj = &ob;
263. ob.nid = n;
264. adp = lh_ADDED_OBJ_retrieve(added, &ad);
crypto/objects/obj_dat.c:263:9:
261. ad.type = ADDED_NID;
262. ad.obj = &ob;
263. > ob.nid = n;
264. adp = lh_ADDED_OBJ_retrieve(added, &ad);
265. if (adp != NULL)
crypto/objects/obj_dat.c:264:9:
262. ad.obj = &ob;
263. ob.nid = n;
264. > adp = lh_ADDED_OBJ_retrieve(added, &ad);
265. if (adp != NULL)
266. return adp->obj->sn;
crypto/objects/obj_lcl.h:14:1: start of procedure lh_ADDED_OBJ_retrieve()
12. DEFINE_LHASH_OF(OBJ_NAME);
13. typedef struct added_obj_st ADDED_OBJ;
14. > DEFINE_LHASH_OF(ADDED_OBJ);
crypto/lhash/lhash.c:134:1: start of procedure OPENSSL_LH_retrieve()
132. }
133.
134. > void *OPENSSL_LH_retrieve(OPENSSL_LHASH *lh, const void *data)
135. {
136. unsigned long hash;
crypto/lhash/lhash.c:141:5:
139. int scratch;
140.
141. > lh->error = 0;
142. rn = getrn(lh, data, &hash);
143.
crypto/lhash/lhash.c:142:5: Skipping getrn(): empty list of specs
140.
141. lh->error = 0;
142. rn = getrn(lh, data, &hash);
^
143.
144. if (*rn == NULL) {
crypto/lhash/lhash.c:144:9: Taking false branch
142. rn = getrn(lh, data, &hash);
143.
144. if (*rn == NULL) {
^
145. CRYPTO_atomic_add(&lh->num_retrieve_miss, 1, &scratch, lh->retrieve_stats_lock);
146. return NULL;
crypto/lhash/lhash.c:148:9:
146. return NULL;
147. } else {
148. > ret = (*rn)->data;
149. CRYPTO_atomic_add(&lh->num_retrieve, 1, &scratch, lh->retrieve_stats_lock);
150. }
crypto/lhash/lhash.c:149:9:
147. } else {
148. ret = (*rn)->data;
149. > CRYPTO_atomic_add(&lh->num_retrieve, 1, &scratch, lh->retrieve_stats_lock);
150. }
151. return ret;
crypto/threads_pthread.c:152:1: start of procedure CRYPTO_atomic_add()
150. }
151.
152. > int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock)
153. {
154. # if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL)
crypto/threads_pthread.c:155:9: Taking false branch
153. {
154. # if defined(__GNUC__) && defined(__ATOMIC_ACQ_REL)
155. if (__atomic_is_lock_free(sizeof(*val), val)) {
^
156. *ret = __atomic_add_fetch(val, amount, __ATOMIC_ACQ_REL);
157. return 1;
crypto/threads_pthread.c:160:10:
158. }
159. # endif
160. > if (!CRYPTO_THREAD_write_lock(lock))
161. return 0;
162.
crypto/threads_pthread.c:64:1: start of procedure CRYPTO_THREAD_write_lock()
62. }
63.
64. > int CRYPTO_THREAD_write_lock(CRYPTO_RWLOCK *lock)
65. {
66. # ifdef USE_RWLOCK
crypto/threads_pthread.c:67:9: Taking true branch
65. {
66. # ifdef USE_RWLOCK
67. if (pthread_rwlock_wrlock(lock) != 0)
^
68. return 0;
69. # else
crypto/threads_pthread.c:68:9:
66. # ifdef USE_RWLOCK
67. if (pthread_rwlock_wrlock(lock) != 0)
68. > return 0;
69. # else
70. if (pthread_mutex_lock(lock) != 0)
crypto/threads_pthread.c:75:1: return from a call to CRYPTO_THREAD_write_lock
73.
74. return 1;
75. > }
76.
77. int CRYPTO_THREAD_unlock(CRYPTO_RWLOCK *lock)
crypto/threads_pthread.c:160:10: Taking true branch
158. }
159. # endif
160. if (!CRYPTO_THREAD_write_lock(lock))
^
161. return 0;
162.
crypto/threads_pthread.c:161:9:
159. # endif
160. if (!CRYPTO_THREAD_write_lock(lock))
161. > return 0;
162.
163. *val += amount;
crypto/threads_pthread.c:170:1: return from a call to CRYPTO_atomic_add
168.
169. return 1;
170. > }
171.
172. # ifdef OPENSSL_SYS_UNIX
crypto/lhash/lhash.c:151:5:
149. CRYPTO_atomic_add(&lh->num_retrieve, 1, &scratch, lh->retrieve_stats_lock);
150. }
151. > return ret;
152. }
153.
crypto/lhash/lhash.c:152:1: return from a call to OPENSSL_LH_retrieve
150. }
151. return ret;
152. > }
153.
154. static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg,
crypto/objects/obj_lcl.h:14:1: return from a call to lh_ADDED_OBJ_retrieve
12. DEFINE_LHASH_OF(OBJ_NAME);
13. typedef struct added_obj_st ADDED_OBJ;
14. > DEFINE_LHASH_OF(ADDED_OBJ);
crypto/objects/obj_dat.c:265:13: Taking true branch
263. ob.nid = n;
264. adp = lh_ADDED_OBJ_retrieve(added, &ad);
265. if (adp != NULL)
^
266. return adp->obj->sn;
267. else {
crypto/objects/obj_dat.c:266:13:
264. adp = lh_ADDED_OBJ_retrieve(added, &ad);
265. if (adp != NULL)
266. > return adp->obj->sn;
267. else {
268. OBJerr(OBJ_F_OBJ_NID2SN, OBJ_R_UNKNOWN_NID);
crypto/objects/obj_dat.c:272:1: return from a call to OBJ_nid2sn
270. }
271. }
272. > }
273.
274. const char *OBJ_nid2ln(int n)
crypto/evp/names.c:58:1: start of procedure EVP_get_cipherbyname()
56. }
57.
58. > const EVP_CIPHER *EVP_get_cipherbyname(const char *name)
59. {
60. const EVP_CIPHER *cp;
crypto/evp/names.c:62:10: Taking true branch
60. const EVP_CIPHER *cp;
61.
62. if (!OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS, NULL))
^
63. return NULL;
64.
crypto/evp/names.c:63:9:
61.
62. if (!OPENSSL_init_crypto(OPENSSL_INIT_ADD_ALL_CIPHERS, NULL))
63. > return NULL;
64.
65. cp = (const EVP_CIPHER *)OBJ_NAME_get(name, OBJ_NAME_TYPE_CIPHER_METH);
crypto/evp/names.c:67:1: return from a call to EVP_get_cipherbyname
65. cp = (const EVP_CIPHER *)OBJ_NAME_get(name, OBJ_NAME_TYPE_CIPHER_METH);
66. return (cp);
67. > }
68.
69. const EVP_MD *EVP_get_digestbyname(const char *name)
crypto/pkcs12/p12_sbag.c:150:9: Taking false branch
148. pbe_ciph = EVP_get_cipherbynid(pbe_nid);
149.
150. if (pbe_ciph)
^
151. pbe_nid = -1;
152.
crypto/pkcs12/p12_sbag.c:153:5:
151. pbe_nid = -1;
152.
153. > p8 = PKCS8_encrypt(pbe_nid, pbe_ciph, pass, passlen, salt, saltlen, iter,
154. p8inf);
155.
|
https://github.com/openssl/openssl/blob/b842fcbb37cf3cded72dd7706abd8d54a10cd508/crypto/pkcs12/p12_sbag.c/#L153
|
d2a_code_trace_data_42583
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
test/bntest.c:764: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_sqr`.
Showing all 17 steps of the trace
test/bntest.c:761:17: Call
759. BN_bntest_rand(a, 512, 0, 0);
760. for (j = 0; j < 2; j++) {
761. t = BN_GF2m_mod_solve_quad(c, a, b[j], ctx);
^
762. if (t) {
763. s++;
crypto/bn/bn_gf2m.c:1145:1: Parameter `ctx->stack.depth`
1143. * for best performance, use the BN_GF2m_mod_solve_quad_arr function.
1144. */
1145. > int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
1146. BN_CTX *ctx)
1147. {
test/bntest.c:761:17: Call
759. BN_bntest_rand(a, 512, 0, 0);
760. for (j = 0; j < 2; j++) {
761. t = BN_GF2m_mod_solve_quad(c, a, b[j], ctx);
^
762. if (t) {
763. s++;
crypto/bn/bn_gf2m.c:1145:1: Parameter `ctx->stack.depth`
1143. * for best performance, use the BN_GF2m_mod_solve_quad_arr function.
1144. */
1145. > int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
1146. BN_CTX *ctx)
1147. {
test/bntest.c:764:17: Call
762. if (t) {
763. s++;
764. BN_GF2m_mod_sqr(d, c, b[j], ctx);
^
765. BN_GF2m_add(d, c, d);
766. BN_GF2m_mod(e, a, b[j]);
crypto/bn/bn_gf2m.c:532:1: Parameter `ctx->stack.depth`
530. * use the BN_GF2m_mod_sqr_arr function.
531. */
532. > int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
533. {
534. int ret = 0;
crypto/bn/bn_gf2m.c:547:11: Call
545. goto err;
546. }
547. ret = BN_GF2m_mod_sqr_arr(r, a, arr, ctx);
^
548. bn_check_top(r);
549. err:
crypto/bn/bn_gf2m.c:504:5: Call
502.
503. bn_check_top(a);
504. BN_CTX_start(ctx);
^
505. if ((s = BN_CTX_get(ctx)) == NULL)
506. goto err;
crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_gf2m.c:522:5: Call
520. ret = 1;
521. err:
522. BN_CTX_end(ctx);
^
523. return ret;
524. }
crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.indexes`
193. }
194.
195. > void BN_CTX_end(BN_CTX *ctx)
196. {
197. CTXDBG_ENTRY("BN_CTX_end", ctx);
crypto/bn/bn_ctx.c:201:27: Call
199. ctx->err_stack--;
200. else {
201. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
202. /* Does this stack frame have anything to release? */
203. if (fp < ctx->used)
crypto/bn/bn_ctx.c:271:1: <Offset trace>
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:271:1: Parameter `st->depth`
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:271:1: <Length trace>
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:271:1: Parameter `*st->indexes`
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:273:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_sqr`
271. static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
^
274. }
275.
|
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_ctx.c/#L273
|
d2a_code_trace_data_42584
|
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
{
int i, j, max;
const BN_ULONG *ap;
BN_ULONG *rp;
max = n * 2;
ap = a;
rp = r;
rp[0] = rp[max - 1] = 0;
rp++;
j = n;
if (--j > 0) {
ap++;
rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
rp += 2;
}
for (i = n - 2; i > 0; i--) {
j--;
ap++;
rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]);
rp += 2;
}
bn_add_words(r, r, r, max);
bn_sqr_words(tmp, a, n);
bn_add_words(r, r, tmp, max);
}
ssl/statem/statem_srvr.c:2379: error: BUFFER_OVERRUN_L3
Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `srp_generate_server_master_secret`.
Showing all 27 steps of the trace
ssl/statem/statem_srvr.c:2361:29: Call
2359. goto f_err;
2360. }
2361. if ((s->srp_ctx.A = BN_bin2bn(data, i, NULL)) == NULL) {
^
2362. SSLerr(SSL_F_TLS_PROCESS_CLIENT_KEY_EXCHANGE, ERR_R_BN_LIB);
2363. goto err;
crypto/bn/bn_lib.c:492:9: Assignment
490. n = len;
491. if (n == 0) {
492. ret->top = 0;
^
493. return (ret);
494. }
ssl/statem/statem_srvr.c:2379:14: Call
2377. }
2378.
2379. if (!srp_generate_server_master_secret(s)) {
^
2380. SSLerr(SSL_F_TLS_PROCESS_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR);
2381. goto err;
ssl/tls_srp.c:284:1: Parameter `s->srp_ctx.A->top`
282. }
283.
284. > int srp_generate_server_master_secret(SSL *s)
285. {
286. BIGNUM *K = NULL, *u = NULL;
ssl/tls_srp.c:290:10: Call
288. unsigned char *tmp = NULL;
289.
290. if (!SRP_Verify_A_mod_N(s->srp_ctx.A, s->srp_ctx.N))
^
291. goto err;
292. if ((u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) == NULL)
crypto/srp/srp_lib.c:274:1: Parameter `A->top`
272. }
273.
274. > int SRP_Verify_A_mod_N(const BIGNUM *A, const BIGNUM *N)
275. {
276. /* Checks if A % N == 0 */
crypto/srp/srp_lib.c:277:12: Call
275. {
276. /* Checks if A % N == 0 */
277. return SRP_Verify_B_mod_N(A, N);
^
278. }
279.
crypto/srp/srp_lib.c:253:1: Parameter `B->top`
251. }
252.
253. > int SRP_Verify_B_mod_N(const BIGNUM *B, const BIGNUM *N)
254. {
255. BIGNUM *r;
ssl/tls_srp.c:292:14: Call
290. if (!SRP_Verify_A_mod_N(s->srp_ctx.A, s->srp_ctx.N))
291. goto err;
292. if ((u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) == NULL)
^
293. goto err;
294. if ((K = SRP_Calc_server_key(s->srp_ctx.A, s->srp_ctx.v, u, s->srp_ctx.b,
crypto/srp/srp_lib.c:55:1: Parameter `A->top`
53. }
54.
55. > BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N)
56. {
57. /* k = SHA1(PAD(A) || PAD(B) ) -- tls-srp draft 8 */
ssl/tls_srp.c:294:14: Call
292. if ((u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) == NULL)
293. goto err;
294. if ((K = SRP_Calc_server_key(s->srp_ctx.A, s->srp_ctx.v, u, s->srp_ctx.b,
^
295. s->srp_ctx.N)) == NULL)
296. goto err;
crypto/srp/srp_lib.c:98:1: Parameter `A->top`
96. }
97.
98. > BIGNUM *SRP_Calc_server_key(const BIGNUM *A, const BIGNUM *v, const BIGNUM *u,
99. const BIGNUM *b, const BIGNUM *N)
100. {
crypto/srp/srp_lib.c:114:10: Call
112. if (!BN_mod_exp(tmp, v, u, N, bn_ctx))
113. goto err;
114. if (!BN_mod_mul(tmp, A, tmp, N, bn_ctx))
^
115. goto err;
116.
crypto/bn/bn_mod.c:73:1: Parameter `a->top`
71.
72. /* slow but works */
73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
74. BN_CTX *ctx)
75. {
crypto/bn/bn_mod.c:87:14: Call
85. goto err;
86. if (a == b) {
87. if (!BN_sqr(t, a, ctx))
^
88. goto err;
89. } else {
crypto/bn/bn_sqr.c:17:1: Parameter `a->top`
15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96
16. */
17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
18. {
19. int max, al;
crypto/bn/bn_sqr.c:25:5: Assignment
23. bn_check_top(a);
24.
25. al = a->top;
^
26. if (al <= 0) {
27. r->top = 0;
crypto/bn/bn_sqr.c:74:17: Call
72. if (bn_wexpand(tmp, max) == NULL)
73. goto err;
74. bn_sqr_normal(rr->d, a->d, al, tmp->d);
^
75. }
76. }
crypto/bn/bn_sqr.c:104:1: <Offset trace>
102.
103. /* tmp must have 2*n words */
104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
105. {
106. int i, j, max;
crypto/bn/bn_sqr.c:104:1: Parameter `n`
102.
103. /* tmp must have 2*n words */
104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
105. {
106. int i, j, max;
crypto/bn/bn_sqr.c:115:5: Assignment
113. rp[0] = rp[max - 1] = 0;
114. rp++;
115. j = n;
^
116.
117. if (--j > 0) {
crypto/bn/bn_sqr.c:117:9: Assignment
115. j = n;
116.
117. if (--j > 0) {
^
118. ap++;
119. rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
crypto/bn/bn_sqr.c:104:1: <Length trace>
102.
103. /* tmp must have 2*n words */
104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
105. {
106. int i, j, max;
crypto/bn/bn_sqr.c:104:1: Parameter `*r`
102.
103. /* tmp must have 2*n words */
104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
105. {
106. int i, j, max;
crypto/bn/bn_sqr.c:112:5: Assignment
110. max = n * 2;
111. ap = a;
112. rp = r;
^
113. rp[0] = rp[max - 1] = 0;
114. rp++;
crypto/bn/bn_sqr.c:114:5: Assignment
112. rp = r;
113. rp[0] = rp[max - 1] = 0;
114. rp++;
^
115. j = n;
116.
crypto/bn/bn_sqr.c:119:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `srp_generate_server_master_secret`
117. if (--j > 0) {
118. ap++;
119. rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
^
120. rp += 2;
121. }
|
https://github.com/openssl/openssl/blob/4973a60cb92dc121fc09246bff3815afc0f8ab9a/crypto/bn/bn_sqr.c/#L119
|
d2a_code_trace_data_42585
|
int BN_hex2bn(BIGNUM **bn, const char *a)
{
BIGNUM *ret = NULL;
BN_ULONG l = 0;
int neg = 0, h, m, i, j, k, c;
int num;
if ((a == NULL) || (*a == '\0'))
return (0);
if (*a == '-') {
neg = 1;
a++;
}
for (i = 0; i <= (INT_MAX/4) && isxdigit((unsigned char)a[i]); i++)
continue;
if (i == 0 || i > INT_MAX/4)
goto err;
num = i + neg;
if (bn == NULL)
return (num);
if (*bn == NULL) {
if ((ret = BN_new()) == NULL)
return (0);
} else {
ret = *bn;
BN_zero(ret);
}
if (bn_expand(ret, i * 4) == NULL)
goto err;
j = i;
m = 0;
h = 0;
while (j > 0) {
m = ((BN_BYTES * 2) <= j) ? (BN_BYTES * 2) : j;
l = 0;
for (;;) {
c = a[j - m];
k = OPENSSL_hexchar2int(c);
if (k < 0)
k = 0;
l = (l << 4) | k;
if (--m <= 0) {
ret->d[h++] = l;
break;
}
}
j -= (BN_BYTES * 2);
}
ret->top = h;
bn_correct_top(ret);
*bn = ret;
bn_check_top(ret);
if (ret->top != 0)
ret->neg = neg;
return (num);
err:
if (*bn == NULL)
BN_free(ret);
return (0);
}
test/bntest.c:1578: error: BUFFER_OVERRUN_L2
Offset: [-15, 536870911] (⇐ [0, 1] + [-15, 536870910]) Size: 2 by call to `parseBN`.
Showing all 9 steps of the trace
test/bntest.c:1578:11: Call
1576. int ret, st = 0;
1577.
1578. ret = parseBN(&bn, "0");
^
1579. if (ret != 1 || !BN_is_zero(bn) || BN_is_negative(bn)) {
1580. fprintf(stderr, "BN_hex2bn(0) gave a bad result.\n");
test/bntest.c:92:1: Parameter `*in`
90. * Parse BIGNUM, return number of bytes parsed.
91. */
92. > static int parseBN(BIGNUM **out, const char *in)
93. {
94. *out = NULL;
test/bntest.c:95:12: Call
93. {
94. *out = NULL;
95. return BN_hex2bn(out, in);
^
96. }
97.
crypto/bn/bn_print.c:141:10: <Offset trace>
139. }
140.
141. for (i = 0; i <= (INT_MAX/4) && isxdigit((unsigned char)a[i]); i++)
^
142. continue;
143.
crypto/bn/bn_print.c:141:10: Assignment
139. }
140.
141. for (i = 0; i <= (INT_MAX/4) && isxdigit((unsigned char)a[i]); i++)
^
142. continue;
143.
crypto/bn/bn_print.c:164:5: Assignment
162. goto err;
163.
164. j = i; /* least significant 'hex' */
^
165. m = 0;
166. h = 0;
crypto/bn/bn_print.c:126:1: <Length trace>
124. }
125.
126. > int BN_hex2bn(BIGNUM **bn, const char *a)
127. {
128. BIGNUM *ret = NULL;
crypto/bn/bn_print.c:126:1: Parameter `*a`
124. }
125.
126. > int BN_hex2bn(BIGNUM **bn, const char *a)
127. {
128. BIGNUM *ret = NULL;
crypto/bn/bn_print.c:171:17: Array access: Offset: [-15, 536870911] (⇐ [0, 1] + [-15, 536870910]) Size: 2 by call to `parseBN`
169. l = 0;
170. for (;;) {
171. c = a[j - m];
^
172. k = OPENSSL_hexchar2int(c);
173. if (k < 0)
|
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_print.c/#L171
|
d2a_code_trace_data_42586
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/bn/bntest.c:708: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `BN_sqr`.
Showing all 11 steps of the trace
crypto/bn/bntest.c:690:1: Parameter `ctx->stack.depth`
688. }
689.
690. > int test_sqr(BIO *bp, BN_CTX *ctx)
691. {
692. BIGNUM *a,*c,*d,*e;
crypto/bn/bntest.c:708:3: Call
706. BN_bntest_rand(a,40+i*10,0,0);
707. a->neg=rand_neg();
708. BN_sqr(c,a,ctx);
^
709. if (bp != NULL)
710. {
crypto/bn/bn_sqr.c:64:1: Parameter `ctx->stack.depth`
62. /* r must not be a */
63. /* I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 */
64. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
65. {
66. int max,al;
crypto/bn/bn_sqr.c:80:2: Call
78. }
79.
80. BN_CTX_start(ctx);
^
81. rr=(a != r) ? r : BN_CTX_get(ctx);
82. tmp=BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:257:1: Parameter `ctx->stack.depth`
255. }
256.
257. > void BN_CTX_start(BN_CTX *ctx)
258. {
259. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_sqr.c:150:2: Call
148. bn_check_top(rr);
149. bn_check_top(tmp);
150. BN_CTX_end(ctx);
^
151. return(ret);
152. }
crypto/bn/bn_ctx.c:272:1: Parameter `ctx->stack.depth`
270. }
271.
272. > void BN_CTX_end(BN_CTX *ctx)
273. {
274. CTXDBG_ENTRY("BN_CTX_end", ctx);
crypto/bn/bn_ctx.c:279:21: Call
277. else
278. {
279. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
280. /* Does this stack frame have anything to release? */
281. if(fp < ctx->used)
crypto/bn/bn_ctx.c:353:1: <LHS trace>
351. }
352.
353. > static unsigned int BN_STACK_pop(BN_STACK *st)
354. {
355. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:353:1: Parameter `st->depth`
351. }
352.
353. > static unsigned int BN_STACK_pop(BN_STACK *st)
354. {
355. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:355:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_sqr`
353. static unsigned int BN_STACK_pop(BN_STACK *st)
354. {
355. return st->indexes[--(st->depth)];
^
356. }
357.
|
https://github.com/openssl/openssl/blob/732192a0796c4ecbef3b13ccc8ee8ab23e28f483/crypto/bn/bn_ctx.c/#L355
|
d2a_code_trace_data_42587
|
static int http_parse_request(HTTPContext *c)
{
char *p;
enum RedirType redir_type;
char cmd[32];
char info[1024], filename[1024];
char url[1024], *q;
char protocol[32];
char msg[1024];
const char *mime_type;
FFStream *stream;
int i;
char ratebuf[32];
char *useragent = 0;
p = c->buffer;
get_word(cmd, sizeof(cmd), (const char **)&p);
av_strlcpy(c->method, cmd, sizeof(c->method));
if (!strcmp(cmd, "GET"))
c->post = 0;
else if (!strcmp(cmd, "POST"))
c->post = 1;
else
return -1;
get_word(url, sizeof(url), (const char **)&p);
av_strlcpy(c->url, url, sizeof(c->url));
get_word(protocol, sizeof(protocol), (const char **)&p);
if (strcmp(protocol, "HTTP/1.0") && strcmp(protocol, "HTTP/1.1"))
return -1;
av_strlcpy(c->protocol, protocol, sizeof(c->protocol));
if (ffserver_debug)
http_log("New connection: %s %s\n", cmd, url);
p = strchr(url, '?');
if (p) {
av_strlcpy(info, p, sizeof(info));
*p = '\0';
} else
info[0] = '\0';
av_strlcpy(filename, url + ((*url == '/') ? 1 : 0), sizeof(filename)-1);
for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
if (strncasecmp(p, "User-Agent:", 11) == 0) {
useragent = p + 11;
if (*useragent && *useragent != '\n' && isspace(*useragent))
useragent++;
break;
}
p = strchr(p, '\n');
if (!p)
break;
p++;
}
redir_type = REDIR_NONE;
if (match_ext(filename, "asx")) {
redir_type = REDIR_ASX;
filename[strlen(filename)-1] = 'f';
} else if (match_ext(filename, "asf") &&
(!useragent || strncasecmp(useragent, "NSPlayer", 8) != 0)) {
redir_type = REDIR_ASF;
} else if (match_ext(filename, "rpm,ram")) {
redir_type = REDIR_RAM;
strcpy(filename + strlen(filename)-2, "m");
} else if (match_ext(filename, "rtsp")) {
redir_type = REDIR_RTSP;
compute_real_filename(filename, sizeof(filename) - 1);
} else if (match_ext(filename, "sdp")) {
redir_type = REDIR_SDP;
compute_real_filename(filename, sizeof(filename) - 1);
}
if (!strlen(filename))
av_strlcpy(filename, "index.html", sizeof(filename) - 1);
stream = first_stream;
while (stream != NULL) {
if (!strcmp(stream->filename, filename) && validate_acl(stream, c))
break;
stream = stream->next;
}
if (stream == NULL) {
snprintf(msg, sizeof(msg), "File '%s' not found", url);
goto send_error;
}
c->stream = stream;
memcpy(c->feed_streams, stream->feed_streams, sizeof(c->feed_streams));
memset(c->switch_feed_streams, -1, sizeof(c->switch_feed_streams));
if (stream->stream_type == STREAM_TYPE_REDIRECT) {
c->http_error = 301;
q = c->buffer;
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 301 Moved\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Location: %s\r\n", stream->feed_filename);
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: text/html\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<html><head><title>Moved</title></head><body>\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "You should be <a href=\"%s\">redirected</a>.\r\n", stream->feed_filename);
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "</body></html>\r\n");
c->buffer_ptr = c->buffer;
c->buffer_end = q;
c->state = HTTPSTATE_SEND_HEADER;
return 0;
}
if (extract_rates(ratebuf, sizeof(ratebuf), c->buffer)) {
if (modify_current_stream(c, ratebuf)) {
for (i = 0; i < sizeof(c->feed_streams) / sizeof(c->feed_streams[0]); i++) {
if (c->switch_feed_streams[i] >= 0)
do_switch_stream(c, i);
}
}
}
if (stream->feed_opened) {
snprintf(msg, sizeof(msg), "This feed is already being received.");
goto send_error;
}
if (c->post == 0 && stream->stream_type == STREAM_TYPE_LIVE)
current_bandwidth += stream->bandwidth;
if (c->post == 0 && max_bandwidth < current_bandwidth) {
c->http_error = 200;
q = c->buffer;
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 Server too busy\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: text/html\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<html><head><title>Too busy</title></head><body>\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<p>The server is too busy to serve your request at this time.</p>\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<p>The bandwidth being served (including your stream) is %dkbit/sec, and this exceeds the limit of %dkbit/sec.</p>\r\n",
current_bandwidth, max_bandwidth);
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "</body></html>\r\n");
c->buffer_ptr = c->buffer;
c->buffer_end = q;
c->state = HTTPSTATE_SEND_HEADER;
return 0;
}
if (redir_type != REDIR_NONE) {
char *hostinfo = 0;
for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
if (strncasecmp(p, "Host:", 5) == 0) {
hostinfo = p + 5;
break;
}
p = strchr(p, '\n');
if (!p)
break;
p++;
}
if (hostinfo) {
char *eoh;
char hostbuf[260];
while (isspace(*hostinfo))
hostinfo++;
eoh = strchr(hostinfo, '\n');
if (eoh) {
if (eoh[-1] == '\r')
eoh--;
if (eoh - hostinfo < sizeof(hostbuf) - 1) {
memcpy(hostbuf, hostinfo, eoh - hostinfo);
hostbuf[eoh - hostinfo] = 0;
c->http_error = 200;
q = c->buffer;
switch(redir_type) {
case REDIR_ASX:
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 ASX Follows\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: video/x-ms-asf\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<ASX Version=\"3\">\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<ENTRY><REF HREF=\"http://%s/%s%s\"/></ENTRY>\r\n",
hostbuf, filename, info);
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "</ASX>\r\n");
break;
case REDIR_RAM:
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 RAM Follows\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: audio/x-pn-realaudio\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "# Autogenerated by ffserver\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "http://%s/%s%s\r\n",
hostbuf, filename, info);
break;
case REDIR_ASF:
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 ASF Redirect follows\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: video/x-ms-asf\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "[Reference]\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Ref1=http://%s/%s%s\r\n",
hostbuf, filename, info);
break;
case REDIR_RTSP:
{
char hostname[256], *p;
av_strlcpy(hostname, hostbuf, sizeof(hostname));
p = strrchr(hostname, ':');
if (p)
*p = '\0';
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 RTSP Redirect follows\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: application/x-rtsp\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "rtsp://%s:%d/%s\r\n",
hostname, ntohs(my_rtsp_addr.sin_port),
filename);
}
break;
case REDIR_SDP:
{
uint8_t *sdp_data;
int sdp_data_size, len;
struct sockaddr_in my_addr;
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 OK\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: application/sdp\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
len = sizeof(my_addr);
getsockname(c->fd, (struct sockaddr *)&my_addr, &len);
sdp_data_size = prepare_sdp_description(stream,
&sdp_data,
my_addr.sin_addr);
if (sdp_data_size > 0) {
memcpy(q, sdp_data, sdp_data_size);
q += sdp_data_size;
*q = '\0';
av_free(sdp_data);
}
}
break;
default:
abort();
break;
}
c->buffer_ptr = c->buffer;
c->buffer_end = q;
c->state = HTTPSTATE_SEND_HEADER;
return 0;
}
}
}
snprintf(msg, sizeof(msg), "ASX/RAM file not handled");
goto send_error;
}
stream->conns_served++;
if (c->post) {
if (!stream->is_feed) {
char *logline = 0;
int client_id = 0;
for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
if (strncasecmp(p, "Pragma: log-line=", 17) == 0) {
logline = p;
break;
}
if (strncasecmp(p, "Pragma: client-id=", 18) == 0)
client_id = strtol(p + 18, 0, 10);
p = strchr(p, '\n');
if (!p)
break;
p++;
}
if (logline) {
char *eol = strchr(logline, '\n');
logline += 17;
if (eol) {
if (eol[-1] == '\r')
eol--;
http_log("%.*s\n", (int) (eol - logline), logline);
c->suppress_log = 1;
}
}
#ifdef DEBUG_WMP
http_log("\nGot request:\n%s\n", c->buffer);
#endif
if (client_id && extract_rates(ratebuf, sizeof(ratebuf), c->buffer)) {
HTTPContext *wmpc;
for (wmpc = first_http_ctx; wmpc; wmpc = wmpc->next) {
if (wmpc->wmp_client_id == client_id)
break;
}
if (wmpc && modify_current_stream(wmpc, ratebuf))
wmpc->switch_pending = 1;
}
snprintf(msg, sizeof(msg), "POST command not handled");
c->stream = 0;
goto send_error;
}
if (http_start_receive_data(c) < 0) {
snprintf(msg, sizeof(msg), "could not open feed");
goto send_error;
}
c->http_error = 0;
c->state = HTTPSTATE_RECEIVE_DATA;
return 0;
}
#ifdef DEBUG_WMP
if (strcmp(stream->filename + strlen(stream->filename) - 4, ".asf") == 0)
http_log("\nGot request:\n%s\n", c->buffer);
#endif
if (c->stream->stream_type == STREAM_TYPE_STATUS)
goto send_stats;
if (open_input_stream(c, info) < 0) {
snprintf(msg, sizeof(msg), "Input stream corresponding to '%s' not found", url);
goto send_error;
}
q = c->buffer;
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 OK\r\n");
mime_type = c->stream->fmt->mime_type;
if (!mime_type)
mime_type = "application/x-octet-stream";
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Pragma: no-cache\r\n");
if (!strcmp(c->stream->fmt->name,"asf_stream")) {
c->wmp_client_id = av_random(&random_state) & 0x7fffffff;
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Server: Cougar 4.1.0.3923\r\nCache-Control: no-cache\r\nPragma: client-id=%d\r\nPragma: features=\"broadcast\"\r\n", c->wmp_client_id);
}
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-Type: %s\r\n", mime_type);
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
c->http_error = 0;
c->buffer_ptr = c->buffer;
c->buffer_end = q;
c->state = HTTPSTATE_SEND_HEADER;
return 0;
send_error:
c->http_error = 404;
q = c->buffer;
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 404 Not Found\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: %s\r\n", "text/html");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<HTML>\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<HEAD><TITLE>404 Not Found</TITLE></HEAD>\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<BODY>%s</BODY>\n", msg);
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "</HTML>\n");
c->buffer_ptr = c->buffer;
c->buffer_end = q;
c->state = HTTPSTATE_SEND_HEADER;
return 0;
send_stats:
compute_stats(c);
c->http_error = 200;
c->state = HTTPSTATE_SEND_HEADER;
return 0;
}
ffserver.c:1272: error: Buffer Overrun L3
Offset added: 80 Size: [0, +oo].
ffserver.c:1174:1: <Length trace>
1172.
1173. /* parse http request and prepare header */
1174. static int http_parse_request(HTTPContext *c)
^
1175. {
1176. char *p;
ffserver.c:1174:1: Parameter `c->switch_feed_streams[*]`
1172.
1173. /* parse http request and prepare header */
1174. static int http_parse_request(HTTPContext *c)
^
1175. {
1176. char *p;
ffserver.c:1272:5: Array access: Offset added: 80 Size: [0, +oo]
1270. c->stream = stream;
1271. memcpy(c->feed_streams, stream->feed_streams, sizeof(c->feed_streams));
1272. memset(c->switch_feed_streams, -1, sizeof(c->switch_feed_streams));
^
1273.
1274. if (stream->stream_type == STREAM_TYPE_REDIRECT) {
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/ffserver.c/#L1272
|
d2a_code_trace_data_42588
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
apps/s_client.c:290: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_exp`.
Showing all 35 steps of the trace
apps/s_client.c:284:9: Call
282. int ret =
283. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) &&
284. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 &&
^
285. p != NULL && BN_rshift1(p, N) &&
286. /* p = (N-1)/2 */
crypto/bn/bn_prime.c:145:1: Parameter `ctx_passed->stack.depth`
143. }
144.
145. > int BN_is_prime_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
146. BN_GENCB *cb)
147. {
crypto/bn/bn_prime.c:148:12: Call
146. BN_GENCB *cb)
147. {
148. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb);
^
149. }
150.
crypto/bn/bn_prime.c:151:1: Parameter `ctx_passed->stack.depth`
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. {
apps/s_client.c:290:9: Call
288. r != NULL &&
289. /* verify g^((N-1)/2) == -1 (mod N) */
290. BN_mod_exp(r, g, p, N, bn_ctx) &&
^
291. BN_add_word(r, 1) && BN_cmp(r, N) == 0;
292.
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_42589
|
static int mov_read_ctts(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
{
AVStream *st = c->fc->streams[c->fc->nb_streams-1];
MOVStreamContext *sc = st->priv_data;
unsigned int i, entries;
get_byte(pb);
get_be24(pb);
entries = get_be32(pb);
if(entries >= UINT_MAX / sizeof(MOV_stts_t))
return -1;
sc->ctts_count = entries;
sc->ctts_data = av_malloc(entries * sizeof(MOV_stts_t));
if (!sc->ctts_data)
return -1;
dprintf(c->fc, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries);
for(i=0; i<entries; i++) {
int count =get_be32(pb);
int duration =get_be32(pb);
if (duration < 0) {
av_log(c->fc, AV_LOG_ERROR, "negative ctts, ignoring\n");
sc->ctts_count = 0;
url_fskip(pb, 8 * (entries - i - 1));
break;
}
sc->ctts_data[i].count = count;
sc->ctts_data[i].duration= duration;
sc->time_rate= ff_gcd(sc->time_rate, duration);
}
return 0;
}
libavformat/mov.c:1102: error: Integer Overflow L2
([-536870908, 536870910] - 1):unsigned32.
libavformat/mov.c:1095:9: <LHS trace>
1093. dprintf(c->fc, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries);
1094.
1095. for(i=0; i<entries; i++) {
^
1096. int count =get_be32(pb);
1097. int duration =get_be32(pb);
libavformat/mov.c:1095:9: Assignment
1093. dprintf(c->fc, "track[%i].ctts.entries = %i\n", c->fc->nb_streams-1, entries);
1094.
1095. for(i=0; i<entries; i++) {
^
1096. int count =get_be32(pb);
1097. int duration =get_be32(pb);
libavformat/mov.c:1102:13: Binary operation: ([-536870908, 536870910] - 1):unsigned32
1100. av_log(c->fc, AV_LOG_ERROR, "negative ctts, ignoring\n");
1101. sc->ctts_count = 0;
1102. url_fskip(pb, 8 * (entries - i - 1));
^
1103. break;
1104. }
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/mov.c/#L1102
|
d2a_code_trace_data_42590
|
static int sdp_read_header(AVFormatContext *s)
{
RTSPState *rt = s->priv_data;
RTSPStream *rtsp_st;
int size, i, err;
char *content;
char url[1024];
if (!ff_network_init())
return AVERROR(EIO);
if (s->max_delay < 0)
s->max_delay = DEFAULT_REORDERING_DELAY;
content = av_malloc(SDP_MAX_SIZE);
size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
if (size <= 0) {
av_free(content);
return AVERROR_INVALIDDATA;
}
content[size] ='\0';
err = ff_sdp_parse(s, content);
av_free(content);
if (err) goto fail;
for (i = 0; i < rt->nb_rtsp_streams; i++) {
char namebuf[50];
rtsp_st = rt->rtsp_streams[i];
getnameinfo((struct sockaddr*) &rtsp_st->sdp_ip, sizeof(rtsp_st->sdp_ip),
namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);
ff_url_join(url, sizeof(url), "rtp", NULL,
namebuf, rtsp_st->sdp_port,
"?localport=%d&ttl=%d&connect=%d", rtsp_st->sdp_port,
rtsp_st->sdp_ttl,
rt->rtsp_flags & RTSP_FLAG_FILTER_SRC ? 1 : 0);
if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE,
&s->interrupt_callback, NULL) < 0) {
err = AVERROR_INVALIDDATA;
goto fail;
}
if ((err = ff_rtsp_open_transport_ctx(s, rtsp_st)))
goto fail;
}
return 0;
fail:
ff_rtsp_close_streams(s);
ff_network_close();
return err;
}
libavformat/rtsp.c:1984: error: Null Dereference
pointer `content` last assigned on line 1978 could be null and is dereferenced at line 1984, column 5.
libavformat/rtsp.c:1962:1: start of procedure sdp_read_header()
1960. }
1961.
1962. static int sdp_read_header(AVFormatContext *s)
^
1963. {
1964. RTSPState *rt = s->priv_data;
libavformat/rtsp.c:1964:5:
1962. static int sdp_read_header(AVFormatContext *s)
1963. {
1964. RTSPState *rt = s->priv_data;
^
1965. RTSPStream *rtsp_st;
1966. int size, i, err;
libavformat/rtsp.c:1970:10:
1968. char url[1024];
1969.
1970. if (!ff_network_init())
^
1971. return AVERROR(EIO);
1972.
libavformat/network.c:123:1: start of procedure ff_network_init()
121. int ff_network_inited_globally;
122.
123. int ff_network_init(void)
^
124. {
125. #if HAVE_WINSOCK2_H
libavformat/network.c:129:10: Taking true branch
127. #endif
128.
129. if (!ff_network_inited_globally)
^
130. av_log(NULL, AV_LOG_WARNING, "Using network protocols without global "
131. "network initialization. Please use "
libavformat/network.c:130:9: Skipping av_log(): empty list of specs
128.
129. if (!ff_network_inited_globally)
130. av_log(NULL, AV_LOG_WARNING, "Using network protocols without global "
^
131. "network initialization. Please use "
132. "avformat_network_init(), this will "
libavformat/network.c:138:5:
136. return 0;
137. #endif
138. return 1;
^
139. }
140.
libavformat/network.c:139:1: return from a call to ff_network_init
137. #endif
138. return 1;
139. }
^
140.
141. int ff_network_wait_fd(int fd, int write)
libavformat/rtsp.c:1970:10: Taking false branch
1968. char url[1024];
1969.
1970. if (!ff_network_init())
^
1971. return AVERROR(EIO);
1972.
libavformat/rtsp.c:1973:9: Taking false branch
1971. return AVERROR(EIO);
1972.
1973. if (s->max_delay < 0) /* Not set by the caller */
^
1974. s->max_delay = DEFAULT_REORDERING_DELAY;
1975.
libavformat/rtsp.c:1978:5:
1976. /* read the whole sdp file */
1977. /* XXX: better loading */
1978. content = av_malloc(SDP_MAX_SIZE);
^
1979. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
1980. if (size <= 0) {
libavutil/mem.c:66:1: start of procedure av_malloc()
64. * linker will do it automatically. */
65.
66. void *av_malloc(size_t size)
^
67. {
68. void *ptr = NULL;
libavutil/mem.c:68:5:
66. void *av_malloc(size_t size)
67. {
68. void *ptr = NULL;
^
69. #if CONFIG_MEMALIGN_HACK
70. long diff;
libavutil/mem.c:74:9: Taking false branch
72.
73. /* let's disallow possible ambiguous cases */
74. if (size > (INT_MAX - 32) || !size)
^
75. return NULL;
76.
libavutil/mem.c:74:35: Taking false branch
72.
73. /* let's disallow possible ambiguous cases */
74. if (size > (INT_MAX - 32) || !size)
^
75. return NULL;
76.
libavutil/mem.c:85:9: Taking true branch
83. ((char *)ptr)[-1] = diff;
84. #elif HAVE_POSIX_MEMALIGN
85. if (posix_memalign(&ptr, 32, size))
^
86. ptr = NULL;
87. #elif HAVE_ALIGNED_MALLOC
libavutil/mem.c:86:9:
84. #elif HAVE_POSIX_MEMALIGN
85. if (posix_memalign(&ptr, 32, size))
86. ptr = NULL;
^
87. #elif HAVE_ALIGNED_MALLOC
88. ptr = _aligned_malloc(size, 32);
libavutil/mem.c:118:5:
116. ptr = malloc(size);
117. #endif
118. return ptr;
^
119. }
120.
libavutil/mem.c:119:1: return from a call to av_malloc
117. #endif
118. return ptr;
119. }
^
120.
121. void *av_realloc(void *ptr, size_t size)
libavformat/rtsp.c:1979:5: Skipping avio_read(): empty list of specs
1977. /* XXX: better loading */
1978. content = av_malloc(SDP_MAX_SIZE);
1979. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
^
1980. if (size <= 0) {
1981. av_free(content);
libavformat/rtsp.c:1980:9: Taking false branch
1978. content = av_malloc(SDP_MAX_SIZE);
1979. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
1980. if (size <= 0) {
^
1981. av_free(content);
1982. return AVERROR_INVALIDDATA;
libavformat/rtsp.c:1984:5:
1982. return AVERROR_INVALIDDATA;
1983. }
1984. content[size] ='\0';
^
1985.
1986. err = ff_sdp_parse(s, content);
|
https://github.com/libav/libav/blob/72c758f1fd06e812a2075bae836ec18891d99852/libavformat/rtsp.c/#L1984
|
d2a_code_trace_data_42591
|
void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
{
unsigned long hash;
OPENSSL_LH_NODE *nn, **rn;
void *ret;
lh->error = 0;
rn = getrn(lh, data, &hash);
if (*rn == NULL) {
lh->num_no_delete++;
return (NULL);
} else {
nn = *rn;
*rn = nn->next;
ret = nn->data;
OPENSSL_free(nn);
lh->num_delete++;
}
lh->num_items--;
if ((lh->num_nodes > MIN_NODES) &&
(lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
contract(lh);
return (ret);
}
ssl/bio_ssl.c:80: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned64 by call to `SSL_free`.
Showing all 14 steps of the trace
ssl/bio_ssl.c:80:13: Call
78. if (BIO_get_shutdown(a)) {
79. if (BIO_get_init(a))
80. SSL_free(bs->ssl);
^
81. /* Clear all flags */
82. BIO_clear_flags(a, ~0);
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:986:1: Parameter `s->initial_ctx->sessions->num_items`
984. }
985.
986. > int ssl_clear_bad_session(SSL *s)
987. {
988. if ((s->session != NULL) &&
ssl/ssl_sess.c:991:9: Call
989. !(s->shutdown & SSL_SENT_SHUTDOWN) &&
990. !(SSL_in_init(s) || SSL_in_before(s))) {
991. SSL_CTX_remove_session(s->session_ctx, s->session);
^
992. return (1);
993. } else
ssl/ssl_sess.c:693:1: Parameter `ctx->sessions->num_items`
691. }
692.
693. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
694. {
695. return remove_session_lock(ctx, c, 1);
ssl/ssl_sess.c:695:12: Call
693. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
694. {
695. return remove_session_lock(ctx, c, 1);
^
696. }
697.
ssl/ssl_sess.c:698:1: Parameter `ctx->sessions->num_items`
696. }
697.
698. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
699. {
700. SSL_SESSION *r;
ssl/ssl_sess.c:708:17: Call
706. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) {
707. ret = 1;
708. r = lh_SSL_SESSION_delete(ctx->sessions, c);
^
709. SSL_SESSION_list_remove(ctx, c);
710. }
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/2dca984babedf93c560aba54da3f4c9222ee0d12/crypto/lhash/lhash.c/#L123
|
d2a_code_trace_data_42592
|
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
{
BN_ULONG *a = NULL;
bn_check_top(b);
if (words > (INT_MAX / (4 * BN_BITS2))) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG);
return NULL;
}
if (BN_get_flags(b, BN_FLG_STATIC_DATA)) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
return (NULL);
}
if (BN_get_flags(b, BN_FLG_SECURE))
a = OPENSSL_secure_zalloc(words * sizeof(*a));
else
a = OPENSSL_zalloc(words * sizeof(*a));
if (a == NULL) {
BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
return (NULL);
}
assert(b->top <= words);
if (b->top > 0)
memcpy(a, b->d, sizeof(*a) * b->top);
return a;
}
test/bntest.c:1662: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_asc2bn`.
Showing all 23 steps of the trace
test/bntest.c:1662:10: Call
1660. goto err;
1661.
1662. if (!TEST_true(BN_asc2bn(&bn, "0"))
^
1663. || !TEST_BN_eq_zero(bn)
1664. || !TEST_BN_ge_zero(bn))
crypto/bn/bn_print.c:267:1: Parameter `(*bn)->top`
265. }
266.
267. > int BN_asc2bn(BIGNUM **bn, const char *a)
268. {
269. const char *p = a;
crypto/bn/bn_print.c:278:14: Call
276. return 0;
277. } else {
278. if (!BN_dec2bn(bn, p))
^
279. return 0;
280. }
crypto/bn/bn_print.c:197:1: Parameter `(*bn)->top`
195. }
196.
197. > int BN_dec2bn(BIGNUM **bn, const char *a)
198. {
199. BIGNUM *ret = NULL;
crypto/bn/bn_print.c:230:9: Call
228. } else {
229. ret = *bn;
230. BN_zero(ret);
^
231. }
232.
crypto/bn/bn_lib.c:395:1: Parameter `a->top`
393. }
394.
395. > int BN_set_word(BIGNUM *a, BN_ULONG w)
396. {
397. bn_check_top(a);
crypto/bn/bn_lib.c:398:9: Call
396. {
397. bn_check_top(a);
398. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
399. return (0);
400. a->neg = 0;
crypto/bn/bn_lcl.h:660:1: Parameter `a->top`
658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
659.
660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
661. {
662. if (bits > (INT_MAX - BN_BITS2 + 1))
crypto/bn/bn_lcl.h:668:12: Call
666. return a;
667.
668. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2);
^
669. }
670.
crypto/bn/bn_lib.c:284:1: Parameter `b->top`
282. */
283.
284. > BIGNUM *bn_expand2(BIGNUM *b, int words)
285. {
286. bn_check_top(b);
crypto/bn/bn_lib.c:289:23: Call
287.
288. if (words > b->dmax) {
289. BN_ULONG *a = bn_expand_internal(b, words);
^
290. if (!a)
291. return NULL;
crypto/bn/bn_lib.c:246:1: <Offset trace>
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:246:1: Parameter `b->top`
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:246:1: <Length trace>
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:246:1: Parameter `words`
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:263:13: Call
261. a = OPENSSL_secure_zalloc(words * sizeof(*a));
262. else
263. a = OPENSSL_zalloc(words * sizeof(*a));
^
264. if (a == NULL) {
265. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
crypto/mem.c:186:1: Parameter `num`
184. }
185.
186. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
187. {
188. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:188:17: Call
186. void *CRYPTO_zalloc(size_t num, const char *file, int line)
187. {
188. void *ret = CRYPTO_malloc(num, file, line);
^
189.
190. FAILTEST();
crypto/mem.c:166:9: Assignment
164.
165. if (num == 0)
166. return NULL;
^
167.
168. FAILTEST();
crypto/mem.c:188:5: Assignment
186. void *CRYPTO_zalloc(size_t num, const char *file, int line)
187. {
188. void *ret = CRYPTO_malloc(num, file, line);
^
189.
190. FAILTEST();
crypto/mem.c:193:5: Assignment
191. if (ret != NULL)
192. memset(ret, 0, num);
193. return ret;
^
194. }
195.
crypto/bn/bn_lib.c:263:9: Assignment
261. a = OPENSSL_secure_zalloc(words * sizeof(*a));
262. else
263. a = OPENSSL_zalloc(words * sizeof(*a));
^
264. if (a == NULL) {
265. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
crypto/bn/bn_lib.c:271:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_asc2bn`
269. assert(b->top <= words);
270. if (b->top > 0)
271. memcpy(a, b->d, sizeof(*a) * b->top);
^
272.
273. return a;
|
https://github.com/openssl/openssl/blob/3f97052392cb10fca5309212bf720685262ad4a6/crypto/bn/bn_lib.c/#L271
|
d2a_code_trace_data_42593
|
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 xmax 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_42594
|
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
{
if (!ossl_assert(pkt->subs != NULL && len != 0))
return 0;
if (pkt->maxsize - pkt->written < len)
return 0;
if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) {
size_t newlen;
size_t reflen;
reflen = (len > pkt->buf->length) ? len : pkt->buf->length;
if (reflen > SIZE_MAX / 2) {
newlen = SIZE_MAX;
} else {
newlen = reflen * 2;
if (newlen < DEFAULT_BUF_SIZE)
newlen = DEFAULT_BUF_SIZE;
}
if (BUF_MEM_grow(pkt->buf, newlen) == 0)
return 0;
}
if (allocbytes != NULL)
*allocbytes = WPACKET_get_curr(pkt);
return 1;
}
ssl/statem/statem_srvr.c:3761: error: INTEGER_OVERFLOW_L2
([0, +oo] - [`pkt->written`, `pkt->written` + 9]):unsigned64 by call to `WPACKET_sub_memcpy__`.
Showing all 18 steps of the trace
ssl/statem/statem_srvr.c:3742:1: Parameter `pkt->written`
3740. }
3741.
3742. > static int create_ticket_prequel(SSL *s, WPACKET *pkt, uint32_t age_add,
3743. unsigned char *tick_nonce)
3744. {
ssl/statem/statem_srvr.c:3751:10: Call
3749. * timeout.
3750. */
3751. if (!WPACKET_put_bytes_u32(pkt,
^
3752. (s->hit && !SSL_IS_TLS13(s))
3753. ? 0 : s->session->timeout)) {
ssl/packet.c:309:1: Parameter `pkt->written`
307. }
308.
309. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size)
310. {
311. unsigned char *data;
ssl/statem/statem_srvr.c:3760:14: Call
3758.
3759. if (SSL_IS_TLS13(s)) {
3760. if (!WPACKET_put_bytes_u32(pkt, age_add)
^
3761. || !WPACKET_sub_memcpy_u8(pkt, tick_nonce, TICKET_NONCE_SIZE)) {
3762. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_CREATE_TICKET_PREQUEL,
ssl/packet.c:309:1: Parameter `pkt->written`
307. }
308.
309. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size)
310. {
311. unsigned char *data;
ssl/statem/statem_srvr.c:3761:21: Call
3759. if (SSL_IS_TLS13(s)) {
3760. if (!WPACKET_put_bytes_u32(pkt, age_add)
3761. || !WPACKET_sub_memcpy_u8(pkt, tick_nonce, TICKET_NONCE_SIZE)) {
^
3762. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_CREATE_TICKET_PREQUEL,
3763. ERR_R_INTERNAL_ERROR);
ssl/packet.c:380:10: Call
378. size_t lenbytes)
379. {
380. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes)
^
381. || !WPACKET_memcpy(pkt, src, len)
382. || !WPACKET_close(pkt))
ssl/packet.c:272:1: Parameter `pkt->buf->length`
270. }
271.
272. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes)
273. {
274. WPACKET_SUB *sub;
ssl/packet.c:381:17: Call
379. {
380. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes)
381. || !WPACKET_memcpy(pkt, src, len)
^
382. || !WPACKET_close(pkt))
383. return 0;
ssl/packet.c:362:1: Parameter `pkt->written`
360. }
361.
362. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len)
363. {
364. unsigned char *dest;
ssl/packet.c:369:10: Call
367. return 1;
368.
369. if (!WPACKET_allocate_bytes(pkt, len, &dest))
^
370. return 0;
371.
ssl/packet.c:16:1: Parameter `pkt->written`
14. #define DEFAULT_BUF_SIZE 256
15.
16. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
17. {
18. if (!WPACKET_reserve_bytes(pkt, len, allocbytes))
ssl/packet.c:18:10: Call
16. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
17. {
18. if (!WPACKET_reserve_bytes(pkt, len, allocbytes))
^
19. return 0;
20.
ssl/packet.c:40:1: <LHS trace>
38. ? (p)->staticbuf : (unsigned char *)(p)->buf->data)
39.
40. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
41. {
42. /* Internal API, so should not fail */
ssl/packet.c:40:1: Parameter `pkt->buf->length`
38. ? (p)->staticbuf : (unsigned char *)(p)->buf->data)
39.
40. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
41. {
42. /* Internal API, so should not fail */
ssl/packet.c:40:1: <RHS trace>
38. ? (p)->staticbuf : (unsigned char *)(p)->buf->data)
39.
40. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
41. {
42. /* Internal API, so should not fail */
ssl/packet.c:40:1: Parameter `len`
38. ? (p)->staticbuf : (unsigned char *)(p)->buf->data)
39.
40. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
41. {
42. /* Internal API, so should not fail */
ssl/packet.c:49:36: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 9]):unsigned64 by call to `WPACKET_sub_memcpy__`
47. return 0;
48.
49. if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) {
^
50. size_t newlen;
51. size_t reflen;
|
https://github.com/openssl/openssl/blob/41145c35bfee8f2b0822288fcb23a807d06d8e89/ssl/packet.c/#L49
|
d2a_code_trace_data_42595
|
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:2168: error: BUFFER_OVERRUN_L3
Offset: [1, +oo] Size: [0, 8388607] by call to `BN_is_prime_fasttest_ex`.
Showing all 48 steps of the trace
test/bntest.c:2167:14: Call
2165.
2166. for (trial = 0; trial <= 1; ++trial) {
2167. if (!TEST_true(BN_set_word(r, not_primes[i]))
^
2168. || !TEST_false(BN_is_prime_fasttest_ex(r, 1, ctx, trial, NULL)))
2169. goto err;
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;
test/bntest.c:2168:21: Call
2166. for (trial = 0; trial <= 1; ++trial) {
2167. if (!TEST_true(BN_set_word(r, not_primes[i]))
2168. || !TEST_false(BN_is_prime_fasttest_ex(r, 1, ctx, trial, NULL)))
^
2169. goto err;
2170. }
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:596:1: Parameter `m->top`
594. * http://www.daemonology.net/hyperthreading-considered-harmful/)
595. */
596. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
597. const BIGNUM *m, BN_CTX *ctx,
598. BN_MONT_CTX *in_mont)
crypto/bn/bn_exp.c:617:10: Call
615. bn_check_top(m);
616.
617. if (!BN_is_odd(m)) {
^
618. BNerr(BN_F_BN_MOD_EXP_MONT_CONSTTIME, BN_R_CALLED_WITH_EVEN_MODULUS);
619. return 0;
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_exp.c:755:14: Call
753. /* prepare a^1 in Montgomery domain */
754. if (a->neg || BN_ucmp(a, m) >= 0) {
755. if (!BN_nnmod(&am, a, m, ctx))
^
756. goto err;
757. if (!BN_to_montgomery(&am, &am, mont, ctx))
crypto/bn/bn_mod.c:13:1: Parameter `d->top`
11. #include "bn_lcl.h"
12.
13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
14. {
15. /*
crypto/bn/bn_mod.c:20:11: Call
18. */
19.
20. if (!(BN_mod(r, m, d, ctx)))
^
21. return 0;
22. if (!r->neg)
crypto/bn/bn_div.c:199:31: Call
197.
198. /* First we normalise the numbers */
199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
^
200. if (!(BN_lshift(sdiv, divisor, norm_shift)))
201. goto err;
crypto/bn/bn_lib.c:140:9: Assignment
138.
139. if (BN_is_zero(a))
140. return 0;
^
141. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
142. }
crypto/bn/bn_div.c:199:5: Assignment
197.
198. /* First we normalise the numbers */
199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
^
200. if (!(BN_lshift(sdiv, divisor, norm_shift)))
201. goto err;
crypto/bn/bn_div.c:200:11: Call
198. /* First we normalise the numbers */
199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
200. if (!(BN_lshift(sdiv, divisor, norm_shift)))
^
201. goto err;
202. sdiv->neg = 0;
crypto/bn/bn_shift.c:83:1: <Offset trace>
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:83:1: Parameter `n`
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:97:5: Assignment
95. }
96.
97. nw = n / BN_BITS2;
^
98. if (bn_wexpand(r, a->top + nw + 1) == NULL)
99. return 0;
crypto/bn/bn_shift.c:83:1: <Length trace>
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:83:1: Parameter `*r->d`
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:98:9: Call
96.
97. nw = n / BN_BITS2;
98. if (bn_wexpand(r, a->top + nw + 1) == NULL)
^
99. return 0;
100. r->neg = a->neg;
crypto/bn/bn_lib.c: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_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_is_prime_fasttest_ex`
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/b48d4397b8ee4256f0b0a115eb99f27ae89995e0/crypto/bn/bn_shift.c/#L112
|
d2a_code_trace_data_42596
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/ec/ecp_nist.c:134: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mul`.
Showing all 14 steps of the trace
crypto/ec/ecp_nist.c:120:1: Parameter `ctx->stack.depth`
118. }
119.
120. > int ec_GFp_nist_field_mul(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a,
121. const BIGNUM *b, BN_CTX *ctx)
122. {
crypto/ec/ecp_nist.c:134:10: Call
132. goto err;
133.
134. if (!BN_mul(r, a, b, ctx))
^
135. goto err;
136. if (!group->field_mod_func(r, r, group->field, ctx))
crypto/bn/bn_mul.c:497:1: Parameter `ctx->stack.depth`
495. #endif /* BN_RECURSION */
496.
497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
498. {
499. int ret = bn_mul_fixed_top(r, a, b, ctx);
crypto/bn/bn_mul.c:499:15: Call
497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
498. {
499. int ret = bn_mul_fixed_top(r, a, b, ctx);
^
500.
501. bn_correct_top(r);
crypto/bn/bn_mul.c:533:5: Call
531. top = al + bl;
532.
533. BN_CTX_start(ctx);
^
534. if ((r == a) || (r == b)) {
535. if ((rr = BN_CTX_get(ctx)) == NULL)
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_mul.c:618:5: Call
616. err:
617. bn_check_top(r);
618. BN_CTX_end(ctx);
^
619. return ret;
620. }
crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <Offset trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: <Length trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mul`
266. static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
^
269. }
270.
|
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
|
d2a_code_trace_data_42597
|
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/srp/srp_vfy.c:569: error: BUFFER_OVERRUN_L3
Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `SRP_create_verifier_BN`.
Showing all 27 steps of the trace
crypto/srp/srp_vfy.c:542:22: Call
540. if ((len = t_fromb64(tmp, N)) == 0)
541. goto err;
542. N_bn_alloc = BN_bin2bn(tmp, len, NULL);
^
543. N_bn = N_bn_alloc;
544. if ((len = t_fromb64(tmp, g)) == 0)
crypto/bn/bn_lib.c:492:9: Assignment
490. n = len;
491. if (n == 0) {
492. ret->top = 0;
^
493. return (ret);
494. }
crypto/srp/srp_vfy.c:569:10: Call
567. }
568.
569. if (!SRP_create_verifier_BN(user, pass, &s, &v, N_bn, g_bn))
^
570. goto err;
571.
crypto/srp/srp_vfy.c:610:1: Parameter `g->top`
608. * BIGNUMS.
609. */
610. > int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,
611. BIGNUM **verifier, const BIGNUM *N,
612. const BIGNUM *g)
crypto/srp/srp_vfy.c:641:10: Call
639. goto err;
640.
641. if (!BN_mod_exp(*verifier, g, x, N, bn_ctx)) {
^
642. BN_clear_free(*verifier);
643. goto err;
crypto/bn/bn_exp.c:90:1: Parameter `a->top`
88. }
89.
90. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
91. BN_CTX *ctx)
92. {
crypto/bn/bn_exp.c:150:19: Call
148. } else
149. # endif
150. ret = BN_mod_exp_mont(r, a, p, m, ctx, NULL);
^
151. } else
152. #endif
crypto/bn/bn_exp.c:300:1: Parameter `a->top`
298. }
299.
300. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
301. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
302. {
crypto/bn/bn_exp.c:312:16: Call
310.
311. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) {
312. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);
^
313. }
314.
crypto/bn/bn_exp.c:600:1: Parameter `a->top`
598. * http://www.daemonology.net/hyperthreading-considered-harmful/)
599. */
600. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
601. const BIGNUM *m, BN_CTX *ctx,
602. BN_MONT_CTX *in_mont)
crypto/bn/bn_exp.c:757:17: Call
755. if (!BN_to_montgomery(&am, &am, mont, ctx))
756. goto err;
757. } else if (!BN_to_montgomery(&am, a, mont, ctx))
^
758. goto err;
759.
crypto/bn/bn_lib.c:945:1: Parameter `a->top`
943. }
944.
945. > int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont,
946. BN_CTX *ctx)
947. {
crypto/bn/bn_lib.c:948:12: Call
946. BN_CTX *ctx)
947. {
948. return BN_mod_mul_montgomery(r, a, &(mont->RR), mont, ctx);
^
949. }
950.
crypto/bn/bn_mont.c:26:1: Parameter `a->top`
24. #endif
25.
26. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
27. BN_MONT_CTX *mont, BN_CTX *ctx)
28. {
crypto/bn/bn_mont.c:53:14: Call
51. bn_check_top(tmp);
52. if (a == b) {
53. if (!BN_sqr(tmp, a, ctx))
^
54. goto err;
55. } else {
crypto/bn/bn_sqr.c:17:1: Parameter `a->top`
15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96
16. */
17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
18. {
19. int max, al;
crypto/bn/bn_sqr.c:25:5: Assignment
23. bn_check_top(a);
24.
25. al = a->top;
^
26. if (al <= 0) {
27. r->top = 0;
crypto/bn/bn_sqr.c:74:17: Call
72. if (bn_wexpand(tmp, max) == NULL)
73. goto err;
74. bn_sqr_normal(rr->d, a->d, al, tmp->d);
^
75. }
76. }
crypto/bn/bn_sqr.c:104:1: <Offset trace>
102.
103. /* tmp must have 2*n words */
104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
105. {
106. int i, j, max;
crypto/bn/bn_sqr.c:104:1: Parameter `n`
102.
103. /* tmp must have 2*n words */
104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
105. {
106. int i, j, max;
crypto/bn/bn_sqr.c:115:5: Assignment
113. rp[0] = rp[max - 1] = 0;
114. rp++;
115. j = n;
^
116.
117. if (--j > 0) {
crypto/bn/bn_sqr.c:117:9: Assignment
115. j = n;
116.
117. if (--j > 0) {
^
118. ap++;
119. rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
crypto/bn/bn_sqr.c:104:1: <Length trace>
102.
103. /* tmp must have 2*n words */
104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
105. {
106. int i, j, max;
crypto/bn/bn_sqr.c:104:1: Parameter `*r`
102.
103. /* tmp must have 2*n words */
104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
105. {
106. int i, j, max;
crypto/bn/bn_sqr.c:112:5: Assignment
110. max = n * 2;
111. ap = a;
112. rp = r;
^
113. rp[0] = rp[max - 1] = 0;
114. rp++;
crypto/bn/bn_sqr.c:114:5: Assignment
112. rp = r;
113. rp[0] = rp[max - 1] = 0;
114. rp++;
^
115. j = n;
116.
crypto/bn/bn_sqr.c:119:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `SRP_create_verifier_BN`
117. if (--j > 0) {
118. ap++;
119. rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
^
120. rp += 2;
121. }
|
https://github.com/openssl/openssl/blob/4973a60cb92dc121fc09246bff3815afc0f8ab9a/crypto/bn/bn_sqr.c/#L119
|
d2a_code_trace_data_42598
|
int test_div(BIO *bp, BN_CTX *ctx)
{
BIGNUM *a, *b, *c, *d, *e;
int i;
a = BN_new();
b = BN_new();
c = BN_new();
d = BN_new();
e = BN_new();
BN_one(a);
BN_zero(b);
if (BN_div(d, c, a, b, ctx)) {
fprintf(stderr, "Division by zero succeeded!\n");
return 0;
}
for (i = 0; i < num0 + num1; i++) {
if (i < num1) {
BN_bntest_rand(a, 400, 0, 0);
BN_copy(b, a);
BN_lshift(a, a, i);
BN_add_word(a, i);
} else
BN_bntest_rand(b, 50 + 3 * (i - num1), 0, 0);
a->neg = rand_neg();
b->neg = rand_neg();
BN_div(d, c, a, b, ctx);
if (bp != NULL) {
if (!results) {
BN_print(bp, a);
BIO_puts(bp, " / ");
BN_print(bp, b);
BIO_puts(bp, " - ");
}
BN_print(bp, d);
BIO_puts(bp, "\n");
if (!results) {
BN_print(bp, a);
BIO_puts(bp, " % ");
BN_print(bp, b);
BIO_puts(bp, " - ");
}
BN_print(bp, c);
BIO_puts(bp, "\n");
}
BN_mul(e, d, b, ctx);
BN_add(d, e, c);
BN_sub(d, d, a);
if (!BN_is_zero(d)) {
fprintf(stderr, "Division test failed!\n");
return 0;
}
}
BN_free(a);
BN_free(b);
BN_free(c);
BN_free(d);
BN_free(e);
return (1);
}
test/bntest.c:497: error: MEMORY_LEAK
memory dynamically allocated by call to `BN_new()` at line 445, column 9 is not reachable after line 497, column 5.
Showing all 160 steps of the trace
test/bntest.c:439:1: start of procedure test_div()
437. }
438.
439. > int test_div(BIO *bp, BN_CTX *ctx)
440. {
441. BIGNUM *a, *b, *c, *d, *e;
test/bntest.c:444:5:
442. int i;
443.
444. > a = BN_new();
445. b = BN_new();
446. c = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:445:5:
443.
444. a = BN_new();
445. > b = BN_new();
446. c = BN_new();
447. d = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:446:5:
444. a = BN_new();
445. b = BN_new();
446. > c = BN_new();
447. d = BN_new();
448. e = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:447:5:
445. b = BN_new();
446. c = BN_new();
447. > d = BN_new();
448. e = BN_new();
449.
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:448:5:
446. c = BN_new();
447. d = BN_new();
448. > e = BN_new();
449.
450. BN_one(a);
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:450:5:
448. e = BN_new();
449.
450. > BN_one(a);
451. BN_zero(b);
452.
crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word()
528. }
529.
530. > int BN_set_word(BIGNUM *a, BN_ULONG w)
531. {
532. bn_check_top(a);
crypto/bn/bn_lib.c:533:9: Condition is true
531. {
532. bn_check_top(a);
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
534. return (0);
535. a->neg = 0;
crypto/bn/bn_lib.c:533:9: Taking false branch
531. {
532. bn_check_top(a);
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
534. return (0);
535. a->neg = 0;
crypto/bn/bn_lib.c:535:5:
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
534. return (0);
535. > a->neg = 0;
536. a->d[0] = w;
537. a->top = (w ? 1 : 0);
crypto/bn/bn_lib.c:536:5:
534. return (0);
535. a->neg = 0;
536. > a->d[0] = w;
537. a->top = (w ? 1 : 0);
538. bn_check_top(a);
crypto/bn/bn_lib.c:537:15: Condition is true
535. a->neg = 0;
536. a->d[0] = w;
537. a->top = (w ? 1 : 0);
^
538. bn_check_top(a);
539. return (1);
crypto/bn/bn_lib.c:537:5:
535. a->neg = 0;
536. a->d[0] = w;
537. > a->top = (w ? 1 : 0);
538. bn_check_top(a);
539. return (1);
crypto/bn/bn_lib.c:539:5:
537. a->top = (w ? 1 : 0);
538. bn_check_top(a);
539. > return (1);
540. }
541.
crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word
538. bn_check_top(a);
539. return (1);
540. > }
541.
542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
test/bntest.c:451:5:
449.
450. BN_one(a);
451. > BN_zero(b);
452.
453. if (BN_div(d, c, a, b, ctx)) {
crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word()
528. }
529.
530. > int BN_set_word(BIGNUM *a, BN_ULONG w)
531. {
532. bn_check_top(a);
crypto/bn/bn_lib.c:533:9: Condition is true
531. {
532. bn_check_top(a);
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
534. return (0);
535. a->neg = 0;
crypto/bn/bn_lib.c:533:9: Taking false branch
531. {
532. bn_check_top(a);
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
534. return (0);
535. a->neg = 0;
crypto/bn/bn_lib.c:535:5:
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
534. return (0);
535. > a->neg = 0;
536. a->d[0] = w;
537. a->top = (w ? 1 : 0);
crypto/bn/bn_lib.c:536:5:
534. return (0);
535. a->neg = 0;
536. > a->d[0] = w;
537. a->top = (w ? 1 : 0);
538. bn_check_top(a);
crypto/bn/bn_lib.c:537:15: Condition is false
535. a->neg = 0;
536. a->d[0] = w;
537. a->top = (w ? 1 : 0);
^
538. bn_check_top(a);
539. return (1);
crypto/bn/bn_lib.c:537:5:
535. a->neg = 0;
536. a->d[0] = w;
537. > a->top = (w ? 1 : 0);
538. bn_check_top(a);
539. return (1);
crypto/bn/bn_lib.c:539:5:
537. a->top = (w ? 1 : 0);
538. bn_check_top(a);
539. > return (1);
540. }
541.
crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word
538. bn_check_top(a);
539. return (1);
540. > }
541.
542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
test/bntest.c:453:9: Taking false branch
451. BN_zero(b);
452.
453. if (BN_div(d, c, a, b, ctx)) {
^
454. fprintf(stderr, "Division by zero succeeded!\n");
455. return 0;
test/bntest.c:458:10:
456. }
457.
458. > for (i = 0; i < num0 + num1; i++) {
459. if (i < num1) {
460. BN_bntest_rand(a, 400, 0, 0);
test/bntest.c:458:17: Loop condition is false. Leaving loop
456. }
457.
458. for (i = 0; i < num0 + num1; i++) {
^
459. if (i < num1) {
460. BN_bntest_rand(a, 400, 0, 0);
test/bntest.c:496:5:
494. }
495. }
496. > BN_free(a);
497. BN_free(b);
498. BN_free(c);
crypto/bn/bn_lib.c:252:1: start of procedure BN_free()
250. }
251.
252. > void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
crypto/bn/bn_lib.c:254:9: Taking false branch
252. void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
^
255. return;
256. bn_check_top(a);
crypto/bn/bn_lib.c:257:10:
255. return;
256. bn_check_top(a);
257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
963. }
964.
965. > int BN_get_flags(const BIGNUM *b, int n)
966. {
967. return b->flags & n;
crypto/bn/bn_lib.c:967:5:
965. int BN_get_flags(const BIGNUM *b, int n)
966. {
967. > return b->flags & n;
968. }
969.
crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
966. {
967. return b->flags & n;
968. > }
969.
970. /* Populate a BN_GENCB structure with an "old"-style callback */
crypto/bn/bn_lib.c:257:10: Taking false branch
255. return;
256. bn_check_top(a);
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
^
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:259:9: Taking false branch
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
^
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:263:9:
261. else {
262. #if OPENSSL_API_COMPAT < 0x00908000L
263. > a->flags |= BN_FLG_FREE;
264. #endif
265. a->d = NULL;
crypto/bn/bn_lib.c:265:9:
263. a->flags |= BN_FLG_FREE;
264. #endif
265. > a->d = NULL;
266. }
267. }
crypto/bn/bn_lib.c:259:5:
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. > if (a->flags & BN_FLG_MALLOCED)
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:267:1: return from a call to BN_free
265. a->d = NULL;
266. }
267. > }
268.
269. void bn_init(BIGNUM *a)
test/bntest.c:497:5:
495. }
496. BN_free(a);
497. > BN_free(b);
498. BN_free(c);
499. BN_free(d);
crypto/bn/bn_lib.c:252:1: start of procedure BN_free()
250. }
251.
252. > void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
crypto/bn/bn_lib.c:254:9: Taking false branch
252. void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
^
255. return;
256. bn_check_top(a);
crypto/bn/bn_lib.c:257:10:
255. return;
256. bn_check_top(a);
257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
963. }
964.
965. > int BN_get_flags(const BIGNUM *b, int n)
966. {
967. return b->flags & n;
crypto/bn/bn_lib.c:967:5:
965. int BN_get_flags(const BIGNUM *b, int n)
966. {
967. > return b->flags & n;
968. }
969.
crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
966. {
967. return b->flags & n;
968. > }
969.
970. /* Populate a BN_GENCB structure with an "old"-style callback */
crypto/bn/bn_lib.c:257:10: Taking false branch
255. return;
256. bn_check_top(a);
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
^
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:259:9: Taking false branch
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
^
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:263:9:
261. else {
262. #if OPENSSL_API_COMPAT < 0x00908000L
263. > a->flags |= BN_FLG_FREE;
264. #endif
265. a->d = NULL;
crypto/bn/bn_lib.c:265:9:
263. a->flags |= BN_FLG_FREE;
264. #endif
265. > a->d = NULL;
266. }
267. }
crypto/bn/bn_lib.c:259:5:
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. > if (a->flags & BN_FLG_MALLOCED)
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:267:1: return from a call to BN_free
265. a->d = NULL;
266. }
267. > }
268.
269. void bn_init(BIGNUM *a)
|
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L497
|
d2a_code_trace_data_42599
|
void avformat_free_context(AVFormatContext *s)
{
int i;
AVStream *st;
av_opt_free(s);
if (s->iformat && s->iformat->priv_class && s->priv_data)
av_opt_free(s->priv_data);
for(i=0;i<s->nb_streams;i++) {
st = s->streams[i];
if (st->parser) {
av_parser_close(st->parser);
}
if (st->attached_pic.data)
av_free_packet(&st->attached_pic);
av_dict_free(&st->metadata);
av_freep(&st->probe_data.buf);
av_free(st->index_entries);
av_free(st->codec->extradata);
av_free(st->codec->subtitle_header);
av_free(st->codec);
av_free(st->priv_data);
av_free(st->info);
av_free(st);
}
for(i=s->nb_programs-1; i>=0; i--) {
av_dict_free(&s->programs[i]->metadata);
av_freep(&s->programs[i]->stream_index);
av_freep(&s->programs[i]);
}
av_freep(&s->programs);
av_freep(&s->priv_data);
while(s->nb_chapters--) {
av_dict_free(&s->chapters[s->nb_chapters]->metadata);
av_free(s->chapters[s->nb_chapters]);
}
av_freep(&s->chapters);
av_dict_free(&s->metadata);
av_freep(&s->streams);
av_free(s);
}
libavformat/movenc.c:3232: error: Integer Overflow L2
([0, +oo] - 1):unsigned32 by call to `ff_mov_close_hinting`.
libavformat/movenc.c:3224:9: Call
3222. } else {
3223. mov_flush_fragment(s);
3224. mov_write_mfra_tag(pb, mov);
^
3225. }
3226.
libavformat/movenc.c:2431:1: Parameter `mov->tracks->nb_frag_info`
2429. }
2430.
2431. static int mov_write_mfra_tag(AVIOContext *pb, MOVMuxContext *mov)
^
2432. {
2433. int64_t pos = avio_tell(pb);
libavformat/movenc.c:3232:13: Call
3230. for (i = 0; i < mov->nb_streams; i++) {
3231. if (mov->tracks[i].tag == MKTAG('r','t','p',' '))
3232. ff_mov_close_hinting(&mov->tracks[i]);
^
3233. if (mov->flags & FF_MOV_FLAG_FRAGMENT &&
3234. mov->tracks[i].vc1_info.struct_offset && s->pb->seekable) {
libavformat/movenchint.c:448:1: Parameter `track->rtp_ctx->nb_programs`
446. }
447.
448. void ff_mov_close_hinting(MOVTrack *track)
^
449. {
450. AVFormatContext *rtp_ctx = track->rtp_ctx;
libavformat/movenchint.c:462:5: Call
460. av_free(ptr);
461. }
462. avformat_free_context(rtp_ctx);
^
463. }
libavformat/utils.c:2494:1: <LHS trace>
2492. }
2493.
2494. void avformat_free_context(AVFormatContext *s)
^
2495. {
2496. int i;
libavformat/utils.c:2494:1: Parameter `s->nb_programs`
2492. }
2493.
2494. void avformat_free_context(AVFormatContext *s)
^
2495. {
2496. int i;
libavformat/utils.c:2521:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `ff_mov_close_hinting`
2519. av_free(st);
2520. }
2521. for(i=s->nb_programs-1; i>=0; i--) {
^
2522. av_dict_free(&s->programs[i]->metadata);
2523. av_freep(&s->programs[i]->stream_index);
|
https://github.com/libav/libav/blob/636ced8e1dc8248a1353b416240b93d70ad03edb/libavformat/utils.c/#L2521
|
d2a_code_trace_data_42600
|
int ssl3_get_cert_verify(SSL *s)
{
EVP_PKEY *pkey=NULL;
unsigned char *p;
int al,ok,ret=0;
long n;
int type=0,i,j;
X509 *peer;
const EVP_MD *md = NULL;
EVP_MD_CTX mctx;
EVP_MD_CTX_init(&mctx);
n=s->method->ssl_get_message(s,
SSL3_ST_SR_CERT_VRFY_A,
SSL3_ST_SR_CERT_VRFY_B,
-1,
516,
&ok);
if (!ok) return((int)n);
if (s->session->peer != NULL)
{
peer=s->session->peer;
pkey=X509_get_pubkey(peer);
type=X509_certificate_type(peer,pkey);
}
else
{
peer=NULL;
pkey=NULL;
}
if (s->s3->tmp.message_type != SSL3_MT_CERTIFICATE_VERIFY)
{
s->s3->tmp.reuse_message=1;
if ((peer != NULL) && (type & EVP_PKT_SIGN))
{
al=SSL_AD_UNEXPECTED_MESSAGE;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_MISSING_VERIFY_MESSAGE);
goto f_err;
}
ret=1;
goto end;
}
if (peer == NULL)
{
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_NO_CLIENT_CERT_RECEIVED);
al=SSL_AD_UNEXPECTED_MESSAGE;
goto f_err;
}
if (!(type & EVP_PKT_SIGN))
{
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE);
al=SSL_AD_ILLEGAL_PARAMETER;
goto f_err;
}
if (s->s3->change_cipher_spec)
{
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_CCS_RECEIVED_EARLY);
al=SSL_AD_UNEXPECTED_MESSAGE;
goto f_err;
}
p=(unsigned char *)s->init_msg;
if (n==64 && (pkey->type==NID_id_GostR3410_94 ||
pkey->type == NID_id_GostR3410_2001) )
{
i=64;
}
else
{
if (SSL_USE_SIGALGS(s))
{
int rv = tls12_check_peer_sigalg(&md, s, p, pkey);
if (rv == -1)
{
al = SSL_AD_INTERNAL_ERROR;
goto f_err;
}
else if (rv == 0)
{
al = SSL_AD_DECODE_ERROR;
goto f_err;
}
#ifdef SSL_DEBUG
fprintf(stderr, "USING TLSv1.2 HASH %s\n", EVP_MD_name(md));
#endif
p += 2;
n -= 2;
}
n2s(p,i);
n-=2;
if (i > n)
{
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_LENGTH_MISMATCH);
al=SSL_AD_DECODE_ERROR;
goto f_err;
}
}
j=EVP_PKEY_size(pkey);
if ((i > j) || (n > j) || (n <= 0))
{
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_WRONG_SIGNATURE_SIZE);
al=SSL_AD_DECODE_ERROR;
goto f_err;
}
if (SSL_USE_SIGALGS(s))
{
long hdatalen = 0;
void *hdata;
hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata);
if (hdatalen <= 0)
{
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR);
al=SSL_AD_INTERNAL_ERROR;
goto f_err;
}
#ifdef SSL_DEBUG
fprintf(stderr, "Using TLS 1.2 with client verify alg %s\n",
EVP_MD_name(md));
#endif
if (!EVP_VerifyInit_ex(&mctx, md, NULL)
|| !EVP_VerifyUpdate(&mctx, hdata, hdatalen))
{
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_EVP_LIB);
al=SSL_AD_INTERNAL_ERROR;
goto f_err;
}
if (EVP_VerifyFinal(&mctx, p , i, pkey) <= 0)
{
al=SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_SIGNATURE);
goto f_err;
}
}
else
#ifndef OPENSSL_NO_RSA
if (pkey->type == EVP_PKEY_RSA)
{
i=RSA_verify(NID_md5_sha1, s->s3->tmp.cert_verify_md,
MD5_DIGEST_LENGTH+SHA_DIGEST_LENGTH, p, i,
pkey->pkey.rsa);
if (i < 0)
{
al=SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_RSA_DECRYPT);
goto f_err;
}
if (i == 0)
{
al=SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_RSA_SIGNATURE);
goto f_err;
}
}
else
#endif
#ifndef OPENSSL_NO_DSA
if (pkey->type == EVP_PKEY_DSA)
{
j=DSA_verify(pkey->save_type,
&(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]),
SHA_DIGEST_LENGTH,p,i,pkey->pkey.dsa);
if (j <= 0)
{
al=SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_DSA_SIGNATURE);
goto f_err;
}
}
else
#endif
#ifndef OPENSSL_NO_ECDSA
if (pkey->type == EVP_PKEY_EC)
{
j=ECDSA_verify(pkey->save_type,
&(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]),
SHA_DIGEST_LENGTH,p,i,pkey->pkey.ec);
if (j <= 0)
{
al=SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,
SSL_R_BAD_ECDSA_SIGNATURE);
goto f_err;
}
}
else
#endif
if (pkey->type == NID_id_GostR3410_94 || pkey->type == NID_id_GostR3410_2001)
{ unsigned char signature[64];
int idx;
EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new(pkey,NULL);
EVP_PKEY_verify_init(pctx);
if (i!=64) {
fprintf(stderr,"GOST signature length is %d",i);
}
for (idx=0;idx<64;idx++) {
signature[63-idx]=p[idx];
}
j=EVP_PKEY_verify(pctx,signature,64,s->s3->tmp.cert_verify_md,32);
EVP_PKEY_CTX_free(pctx);
if (j<=0)
{
al=SSL_AD_DECRYPT_ERROR;
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,
SSL_R_BAD_ECDSA_SIGNATURE);
goto f_err;
}
}
else
{
SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,ERR_R_INTERNAL_ERROR);
al=SSL_AD_UNSUPPORTED_CERTIFICATE;
goto f_err;
}
ret=1;
if (0)
{
f_err:
ssl3_send_alert(s,SSL3_AL_FATAL,al);
}
end:
if (s->s3->handshake_buffer)
{
BIO_free(s->s3->handshake_buffer);
s->s3->handshake_buffer = NULL;
s->s3->flags &= ~TLS1_FLAGS_KEEP_HANDSHAKE;
}
EVP_MD_CTX_cleanup(&mctx);
EVP_PKEY_free(pkey);
return(ret);
}
ssl/s3_srvr.c:3111: error: NULL_DEREFERENCE
pointer `pkey` last assigned on line 3063 could be null and is dereferenced at line 3111, column 16.
Showing all 27 steps of the trace
ssl/s3_srvr.c:3039:1: start of procedure ssl3_get_cert_verify()
3037. }
3038.
3039. > int ssl3_get_cert_verify(SSL *s)
3040. {
3041. EVP_PKEY *pkey=NULL;
ssl/s3_srvr.c:3041:2:
3039. int ssl3_get_cert_verify(SSL *s)
3040. {
3041. > EVP_PKEY *pkey=NULL;
3042. unsigned char *p;
3043. int al,ok,ret=0;
ssl/s3_srvr.c:3043:2:
3041. EVP_PKEY *pkey=NULL;
3042. unsigned char *p;
3043. > int al,ok,ret=0;
3044. long n;
3045. int type=0,i,j;
ssl/s3_srvr.c:3045:2:
3043. int al,ok,ret=0;
3044. long n;
3045. > int type=0,i,j;
3046. X509 *peer;
3047. const EVP_MD *md = NULL;
ssl/s3_srvr.c:3047:2:
3045. int type=0,i,j;
3046. X509 *peer;
3047. > const EVP_MD *md = NULL;
3048. EVP_MD_CTX mctx;
3049. EVP_MD_CTX_init(&mctx);
ssl/s3_srvr.c:3049:2:
3047. const EVP_MD *md = NULL;
3048. EVP_MD_CTX mctx;
3049. > EVP_MD_CTX_init(&mctx);
3050.
3051. n=s->method->ssl_get_message(s,
crypto/evp/digest.c:120:1: start of procedure EVP_MD_CTX_init()
118. #endif
119.
120. > void EVP_MD_CTX_init(EVP_MD_CTX *ctx)
121. {
122. memset(ctx,'\0',sizeof *ctx);
crypto/evp/digest.c:122:2:
120. void EVP_MD_CTX_init(EVP_MD_CTX *ctx)
121. {
122. > memset(ctx,'\0',sizeof *ctx);
123. }
124.
crypto/evp/digest.c:123:2: return from a call to EVP_MD_CTX_init
121. {
122. memset(ctx,'\0',sizeof *ctx);
123. }
^
124.
125. EVP_MD_CTX *EVP_MD_CTX_create(void)
ssl/s3_srvr.c:3051:2: Skipping __function_pointer__(): unresolved function pointer
3049. EVP_MD_CTX_init(&mctx);
3050.
3051. n=s->method->ssl_get_message(s,
^
3052. SSL3_ST_SR_CERT_VRFY_A,
3053. SSL3_ST_SR_CERT_VRFY_B,
ssl/s3_srvr.c:3058:7: Taking false branch
3056. &ok);
3057.
3058. if (!ok) return((int)n);
^
3059.
3060. if (s->session->peer != NULL)
ssl/s3_srvr.c:3060:6: Taking true branch
3058. if (!ok) return((int)n);
3059.
3060. if (s->session->peer != NULL)
^
3061. {
3062. peer=s->session->peer;
ssl/s3_srvr.c:3062:3:
3060. if (s->session->peer != NULL)
3061. {
3062. > peer=s->session->peer;
3063. pkey=X509_get_pubkey(peer);
3064. type=X509_certificate_type(peer,pkey);
ssl/s3_srvr.c:3063:3:
3061. {
3062. peer=s->session->peer;
3063. > pkey=X509_get_pubkey(peer);
3064. type=X509_certificate_type(peer,pkey);
3065. }
crypto/x509/x509_cmp.c:313:1: start of procedure X509_get_pubkey()
311. }
312.
313. > EVP_PKEY *X509_get_pubkey(X509 *x)
314. {
315. if ((x == NULL) || (x->cert_info == NULL))
crypto/x509/x509_cmp.c:315:7: Taking false branch
313. EVP_PKEY *X509_get_pubkey(X509 *x)
314. {
315. if ((x == NULL) || (x->cert_info == NULL))
^
316. return(NULL);
317. return(X509_PUBKEY_get(x->cert_info->key));
crypto/x509/x509_cmp.c:315:22: Taking true branch
313. EVP_PKEY *X509_get_pubkey(X509 *x)
314. {
315. if ((x == NULL) || (x->cert_info == NULL))
^
316. return(NULL);
317. return(X509_PUBKEY_get(x->cert_info->key));
crypto/x509/x509_cmp.c:316:3:
314. {
315. if ((x == NULL) || (x->cert_info == NULL))
316. > return(NULL);
317. return(X509_PUBKEY_get(x->cert_info->key));
318. }
crypto/x509/x509_cmp.c:318:2: return from a call to X509_get_pubkey
316. return(NULL);
317. return(X509_PUBKEY_get(x->cert_info->key));
318. }
^
319.
320. ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x)
ssl/s3_srvr.c:3064:3: Skipping X509_certificate_type(): empty list of specs
3062. peer=s->session->peer;
3063. pkey=X509_get_pubkey(peer);
3064. type=X509_certificate_type(peer,pkey);
^
3065. }
3066. else
ssl/s3_srvr.c:3072:6: Taking false branch
3070. }
3071.
3072. if (s->s3->tmp.message_type != SSL3_MT_CERTIFICATE_VERIFY)
^
3073. {
3074. s->s3->tmp.reuse_message=1;
ssl/s3_srvr.c:3085:6: Taking false branch
3083. }
3084.
3085. if (peer == NULL)
^
3086. {
3087. SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_NO_CLIENT_CERT_RECEIVED);
ssl/s3_srvr.c:3092:8: Taking false branch
3090. }
3091.
3092. if (!(type & EVP_PKT_SIGN))
^
3093. {
3094. SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE);
ssl/s3_srvr.c:3099:6: Taking false branch
3097. }
3098.
3099. if (s->s3->change_cipher_spec)
^
3100. {
3101. SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_CCS_RECEIVED_EARLY);
ssl/s3_srvr.c:3107:2:
3105.
3106. /* we now have a signature that we need to verify */
3107. > p=(unsigned char *)s->init_msg;
3108. /* Check for broken implementations of GOST ciphersuites */
3109. /* If key is GOST and n is exactly 64, it is bare
ssl/s3_srvr.c:3111:6: Taking true branch
3109. /* If key is GOST and n is exactly 64, it is bare
3110. * signature without length field */
3111. if (n==64 && (pkey->type==NID_id_GostR3410_94 ||
^
3112. pkey->type == NID_id_GostR3410_2001) )
3113. {
ssl/s3_srvr.c:3111:16:
3109. /* If key is GOST and n is exactly 64, it is bare
3110. * signature without length field */
3111. > if (n==64 && (pkey->type==NID_id_GostR3410_94 ||
3112. pkey->type == NID_id_GostR3410_2001) )
3113. {
|
https://github.com/openssl/openssl/blob/fc923969761c996515ff13aed2686d999deaca15/ssl/s3_srvr.c/#L3111
|
d2a_code_trace_data_42601
|
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
{
BN_ULONG *A, *a = NULL;
const BN_ULONG *B;
int i;
bn_check_top(b);
if (words > (INT_MAX / (4 * BN_BITS2))) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG);
return NULL;
}
if (BN_get_flags(b, BN_FLG_STATIC_DATA)) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
return (NULL);
}
if (BN_get_flags(b,BN_FLG_SECURE))
a = A = OPENSSL_secure_zalloc(words * sizeof(*a));
else
a = A = OPENSSL_zalloc(words * sizeof(*a));
if (A == NULL) {
BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
return (NULL);
}
#if 1
B = b->d;
if (B != NULL) {
for (i = b->top >> 2; i > 0; i--, A += 4, B += 4) {
BN_ULONG a0, a1, a2, a3;
a0 = B[0];
a1 = B[1];
a2 = B[2];
a3 = B[3];
A[0] = a0;
A[1] = a1;
A[2] = a2;
A[3] = a3;
}
switch (b->top & 3) {
case 3:
A[2] = B[2];
case 2:
A[1] = B[1];
case 1:
A[0] = B[0];
case 0:
;
}
}
#else
memset(A, 0, sizeof(*A) * words);
memcpy(A, b->d, sizeof(b->d[0]) * b->top);
#endif
return (a);
}
crypto/dh/dh_check.c:165: error: BUFFER_OVERRUN_L3
Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, 8388607] by call to `BN_mod_exp`.
Showing all 16 steps of the trace
crypto/dh/dh_check.c:153:11: Call
151. goto err;
152. BN_CTX_start(ctx);
153. tmp = BN_CTX_get(ctx);
^
154. if (tmp == NULL || !BN_set_word(tmp, 1))
155. goto err;
crypto/bn/bn_ctx.c:283:5: Call
281. }
282. /* OK, make sure the returned bignum is "zero" */
283. BN_zero(ret);
^
284. ctx->used++;
285. CTXDBG_RET(ctx, ret);
crypto/bn/bn_lib.c:520:1: Parameter `*a->d`
518. }
519.
520. > int BN_set_word(BIGNUM *a, BN_ULONG w)
521. {
522. bn_check_top(a);
crypto/dh/dh_check.c:165:14: Call
163. if (dh->q != NULL) {
164. /* Check pub_key^q == 1 mod p */
165. if (!BN_mod_exp(tmp, pub_key, dh->q, dh->p, ctx))
^
166. goto err;
167. if (!BN_is_one(tmp))
crypto/bn/bn_exp.c:190:1: Parameter `*r->d`
188. }
189.
190. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
191. BN_CTX *ctx)
192. {
crypto/bn/bn_exp.c:247:19: Call
245. && (BN_get_flags(p, BN_FLG_CONSTTIME) == 0)) {
246. BN_ULONG A = a->d[0];
247. ret = BN_mod_exp_mont_word(r, A, p, m, ctx, NULL);
^
248. } else
249. # endif
crypto/bn/bn_exp.c:1151:1: Parameter `*rr->d`
1149. }
1150.
1151. > int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p,
1152. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
1153. {
crypto/bn/bn_exp.c:1198:13: Call
1196. if (BN_is_one(m)) {
1197. ret = 1;
1198. BN_zero(rr);
^
1199. } else {
1200. ret = BN_one(rr);
crypto/bn/bn_lib.c:520:1: Parameter `*a->d`
518. }
519.
520. > int BN_set_word(BIGNUM *a, BN_ULONG w)
521. {
522. bn_check_top(a);
crypto/bn/bn_lib.c:523:9: Call
521. {
522. bn_check_top(a);
523. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
524. return (0);
525. a->neg = 0;
crypto/bn/bn_lib.c:380:1: Parameter `*b->d`
378. */
379.
380. > BIGNUM *bn_expand2(BIGNUM *b, int words)
381. {
382. bn_check_top(b);
crypto/bn/bn_lib.c:385:23: Call
383.
384. if (words > b->dmax) {
385. BN_ULONG *a = bn_expand_internal(b, words);
^
386. if (!a)
387. return NULL;
crypto/bn/bn_lib.c:299:1: <Length trace>
297. /* This is used by bn_expand2() */
298. /* The caller MUST check that words > b->dmax before calling this */
299. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
300. {
301. BN_ULONG *A, *a = NULL;
crypto/bn/bn_lib.c:299:1: Parameter `*b->d`
297. /* This is used by bn_expand2() */
298. /* The caller MUST check that words > b->dmax before calling this */
299. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
300. {
301. BN_ULONG *A, *a = NULL;
crypto/bn/bn_lib.c:325:5: Assignment
323.
324. #if 1
325. B = b->d;
^
326. /* Check if the previous number needs to be copied */
327. if (B != NULL) {
crypto/bn/bn_lib.c:342:18: Array access: Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, 8388607] by call to `BN_mod_exp`
340. a1 = B[1];
341. a2 = B[2];
342. a3 = B[3];
^
343. A[0] = a0;
344. A[1] = a1;
|
https://github.com/openssl/openssl/blob/c10d1bc81cb047cbd53f8cc430632b6a4a70252d/crypto/bn/bn_lib.c/#L342
|
d2a_code_trace_data_42602
|
static int kek_unwrap_key(unsigned char *out, size_t *outlen,
const unsigned char *in, size_t inlen,
EVP_CIPHER_CTX *ctx)
{
size_t blocklen = EVP_CIPHER_CTX_block_size(ctx);
unsigned char *tmp;
int outl, rv = 0;
if (inlen < 2 * blocklen) {
return 0;
}
if (inlen % blocklen) {
return 0;
}
if ((tmp = OPENSSL_malloc(inlen)) == NULL) {
CMSerr(CMS_F_KEK_UNWRAP_KEY, ERR_R_MALLOC_FAILURE);
return 0;
}
if (!EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, &outl,
in + inlen - 2 * blocklen, blocklen * 2)
|| !EVP_DecryptUpdate(ctx, tmp, &outl,
tmp + inlen - blocklen, blocklen)
|| !EVP_DecryptUpdate(ctx, tmp, &outl, in, inlen - blocklen)
|| !EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, NULL)
|| !EVP_DecryptUpdate(ctx, tmp, &outl, tmp, inlen))
goto err;
if (((tmp[1] ^ tmp[4]) & (tmp[2] ^ tmp[5]) & (tmp[3] ^ tmp[6])) != 0xff) {
goto err;
}
if (inlen < (size_t)(tmp[0] - 4)) {
goto err;
}
*outlen = (size_t)tmp[0];
memcpy(out, tmp + 4, *outlen);
rv = 1;
err:
OPENSSL_clear_free(tmp, inlen);
return rv;
}
crypto/cms/cms_smime.c:636: error: BUFFER_OVERRUN_L3
Offset added: [4, +oo] (⇐ 4 + [0, +oo]) Size: [1, +oo] by call to `CMS_RecipientInfo_decrypt`.
Showing all 17 steps of the trace
crypto/cms/cms_smime.c:633:28: Call
631. * all.
632. */
633. else if (!cert || !CMS_RecipientInfo_ktri_cert_cmp(ri, cert)) {
^
634. EVP_PKEY_up_ref(pk);
635. CMS_RecipientInfo_set0_pkey(ri, pk);
crypto/cms/cms_env.c:269:1: Parameter `ri->d.ktri->rid->d.issuerAndSerialNumber->issuer->length`
267. }
268.
269. > int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert)
270. {
271. if (ri->type != CMS_RECIPINFO_TRANS) {
crypto/cms/cms_smime.c:636:17: Call
634. EVP_PKEY_up_ref(pk);
635. CMS_RecipientInfo_set0_pkey(ri, pk);
636. r = CMS_RecipientInfo_decrypt(cms, ri);
^
637. CMS_RecipientInfo_set0_pkey(ri, NULL);
638. if (cert) {
crypto/cms/cms_env.c:739:1: Parameter `ri->d.pwri->encryptedKey->length`
737. }
738.
739. > int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri)
740. {
741. switch (ri->type) {
crypto/cms/cms_env.c:749:16: Call
747.
748. case CMS_RECIPINFO_PASS:
749. return cms_RecipientInfo_pwri_crypt(cms, ri, 0);
^
750.
751. default:
crypto/cms/cms_pwri.c:276:1: Parameter `ri->d.pwri->encryptedKey->length`
274. /* Encrypt/Decrypt content key in PWRI recipient info */
275.
276. > int cms_RecipientInfo_pwri_crypt(const CMS_ContentInfo *cms, CMS_RecipientInfo *ri,
277. int en_de)
278. {
crypto/cms/cms_pwri.c:369:14: Call
367. goto err;
368. }
369. if (!kek_unwrap_key(key, &keylen,
^
370. pwri->encryptedKey->data,
371. pwri->encryptedKey->length, kekctx)) {
crypto/cms/cms_pwri.c:211:13: <Offset trace>
209. || !EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, NULL)
210. /* Decrypt again */
211. || !EVP_DecryptUpdate(ctx, tmp, &outl, tmp, inlen))
^
212. goto err;
213. /* Check check bytes */
crypto/cms/cms_pwri.c:211:13: Call
209. || !EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, NULL)
210. /* Decrypt again */
211. || !EVP_DecryptUpdate(ctx, tmp, &outl, tmp, inlen))
^
212. goto err;
213. /* Check check bytes */
crypto/evp/evp_enc.c:443:1: Parameter `ctx->buf[*]`
441. }
442.
443. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
444. const unsigned char *in, int inl)
445. {
crypto/cms/cms_pwri.c:222:5: Assignment
220. goto err;
221. }
222. *outlen = (size_t)tmp[0];
^
223. memcpy(out, tmp + 4, *outlen);
224. rv = 1;
crypto/cms/cms_pwri.c:176:1: <Length trace>
174. */
175.
176. > static int kek_unwrap_key(unsigned char *out, size_t *outlen,
177. const unsigned char *in, size_t inlen,
178. EVP_CIPHER_CTX *ctx)
crypto/cms/cms_pwri.c:176:1: Parameter `inlen`
174. */
175.
176. > static int kek_unwrap_key(unsigned char *out, size_t *outlen,
177. const unsigned char *in, size_t inlen,
178. EVP_CIPHER_CTX *ctx)
crypto/cms/cms_pwri.c:191:16: Call
189. return 0;
190. }
191. if ((tmp = OPENSSL_malloc(inlen)) == NULL) {
^
192. CMSerr(CMS_F_KEK_UNWRAP_KEY, ERR_R_MALLOC_FAILURE);
193. return 0;
crypto/mem.c:201:9: Assignment
199.
200. if (num == 0)
201. return NULL;
^
202.
203. FAILTEST();
crypto/cms/cms_pwri.c:191:10: Assignment
189. return 0;
190. }
191. if ((tmp = OPENSSL_malloc(inlen)) == NULL) {
^
192. CMSerr(CMS_F_KEK_UNWRAP_KEY, ERR_R_MALLOC_FAILURE);
193. return 0;
crypto/cms/cms_pwri.c:223:5: Array access: Offset added: [4, +oo] (⇐ 4 + [0, +oo]) Size: [1, +oo] by call to `CMS_RecipientInfo_decrypt`
221. }
222. *outlen = (size_t)tmp[0];
223. memcpy(out, tmp + 4, *outlen);
^
224. rv = 1;
225. err:
|
https://github.com/openssl/openssl/blob/bcf082d130a413a728a382bd6e6bfdbf2cedba45/crypto/cms/cms_pwri.c/#L223
|
d2a_code_trace_data_42603
|
static inline int w_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int w, int h, int type){
int s, i, j;
const int dec_count= w==8 ? 3 : 4;
int tmp[32*32];
int level, ori;
static const int scale[2][2][4][4]={
{
{
{268, 239, 239, 213},
{ 0, 224, 224, 152},
{ 0, 135, 135, 110},
},{
{344, 310, 310, 280},
{ 0, 320, 320, 228},
{ 0, 175, 175, 136},
{ 0, 129, 129, 102},
}
},{
{
{275, 245, 245, 218},
{ 0, 230, 230, 156},
{ 0, 138, 138, 113},
},{
{352, 317, 317, 286},
{ 0, 328, 328, 233},
{ 0, 180, 180, 140},
{ 0, 132, 132, 105},
}
}
};
for (i = 0; i < h; i++) {
for (j = 0; j < w; j+=4) {
tmp[32*i+j+0] = (pix1[j+0] - pix2[j+0])<<4;
tmp[32*i+j+1] = (pix1[j+1] - pix2[j+1])<<4;
tmp[32*i+j+2] = (pix1[j+2] - pix2[j+2])<<4;
tmp[32*i+j+3] = (pix1[j+3] - pix2[j+3])<<4;
}
pix1 += line_size;
pix2 += line_size;
}
ff_spatial_dwt(tmp, w, h, 32, type, dec_count);
s=0;
assert(w==h);
for(level=0; level<dec_count; level++){
for(ori= level ? 1 : 0; ori<4; ori++){
int size= w>>(dec_count-level);
int sx= (ori&1) ? size : 0;
int stride= 32<<(dec_count-level);
int sy= (ori&2) ? stride>>1 : 0;
for(i=0; i<size; i++){
for(j=0; j<size; j++){
int v= tmp[sx + sy + i*stride + j] * scale[type][dec_count-3][level][ori];
s += FFABS(v);
}
}
}
}
assert(s>=0);
return s>>9;
}
libavcodec/snow.c:2850: error: Buffer Overrun L2
Offset: [3, 1026] Size: 1024 by call to `w53_32_c`.
libavcodec/snow.c:2850:26: Call
2848. distortion = w97_32_c(&s->m, src + sx + sy*ref_stride, dst + sx + sy*ref_stride, ref_stride, 32);
2849. else if(s->avctx->me_cmp == FF_CMP_W53)
2850. distortion = w53_32_c(&s->m, src + sx + sy*ref_stride, dst + sx + sy*ref_stride, ref_stride, 32);
^
2851. else{
2852. distortion = 0;
libavcodec/dsputil.c:421:1: Parameter `h`
419. }
420.
421. int w53_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){
^
422. return w_c(v, pix1, pix2, line_size, 32, h, 1);
423. }
libavcodec/dsputil.c:422:12: Call
420.
421. int w53_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){
422. return w_c(v, pix1, pix2, line_size, 32, h, 1);
^
423. }
424.
libavcodec/dsputil.c:336:1: <Offset trace>
334.
335. #ifdef CONFIG_SNOW_ENCODER //dwt is in snow.c
336. static inline int w_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int w, int h, int type){
^
337. int s, i, j;
338. const int dec_count= w==8 ? 3 : 4;
libavcodec/dsputil.c:336:1: Parameter `w`
334.
335. #ifdef CONFIG_SNOW_ENCODER //dwt is in snow.c
336. static inline int w_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int w, int h, int type){
^
337. int s, i, j;
338. const int dec_count= w==8 ? 3 : 4;
libavcodec/dsputil.c:336:1: <Length trace>
334.
335. #ifdef CONFIG_SNOW_ENCODER //dwt is in snow.c
336. static inline int w_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int w, int h, int type){
^
337. int s, i, j;
338. const int dec_count= w==8 ? 3 : 4;
libavcodec/dsputil.c:336:1: Array declaration
334.
335. #ifdef CONFIG_SNOW_ENCODER //dwt is in snow.c
336. static inline int w_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int w, int h, int type){
^
337. int s, i, j;
338. const int dec_count= w==8 ? 3 : 4;
libavcodec/dsputil.c:376:13: Array access: Offset: [3, 1026] Size: 1024 by call to `w53_32_c`
374. tmp[32*i+j+1] = (pix1[j+1] - pix2[j+1])<<4;
375. tmp[32*i+j+2] = (pix1[j+2] - pix2[j+2])<<4;
376. tmp[32*i+j+3] = (pix1[j+3] - pix2[j+3])<<4;
^
377. }
378. pix1 += line_size;
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dsputil.c/#L376
|
d2a_code_trace_data_42604
|
static TS_VERIFY_CTX *create_verify_ctx(char *data, char *digest,
char *queryfile,
char *CApath, char *CAfile,
char *untrusted,
X509_VERIFY_PARAM *vpm)
{
TS_VERIFY_CTX *ctx = NULL;
BIO *input = NULL;
TS_REQ *request = NULL;
int ret = 0;
int f = 0;
if (data != NULL || digest != NULL) {
if ((ctx = TS_VERIFY_CTX_new()) == NULL)
goto err;
f = TS_VFY_VERSION | TS_VFY_SIGNER;
if (data != NULL) {
f |= TS_VFY_DATA;
if (TS_VERIFY_CTX_set_data(ctx, BIO_new_file(data, "rb")) == NULL)
goto err;
} else if (digest != NULL) {
long imprint_len;
unsigned char *hexstr = string_to_hex(digest, &imprint_len);
f |= TS_VFY_IMPRINT;
if (TS_VERIFY_CTX_set_imprint(ctx, hexstr, imprint_len) == NULL) {
BIO_printf(bio_err, "invalid digest string\n");
goto err;
}
}
} else if (queryfile != NULL) {
if ((input = BIO_new_file(queryfile, "rb")) == NULL)
goto err;
if ((request = d2i_TS_REQ_bio(input, NULL)) == NULL)
goto err;
if ((ctx = TS_REQ_to_TS_VERIFY_CTX(request, NULL)) == NULL)
goto err;
} else
return NULL;
TS_VERIFY_CTX_add_flags(ctx, f | TS_VFY_SIGNATURE);
if (TS_VERIFY_CTX_set_store(ctx, create_cert_store(CApath, CAfile, vpm))
== NULL)
goto err;
if (untrusted
&& TS_VERIFY_CTS_set_certs(ctx, TS_CONF_load_certs(untrusted)) == NULL)
goto err;
ret = 1;
err:
if (!ret) {
TS_VERIFY_CTX_free(ctx);
ctx = NULL;
}
BIO_free_all(input);
TS_REQ_free(request);
return ctx;
}
apps/ts.c:976: error: MEMORY_LEAK
memory dynamically allocated by call to `TS_VERIFY_CTX_new()` at line 933, column 20 is not reachable after line 976, column 9.
Showing all 74 steps of the trace
apps/ts.c:920:1: start of procedure create_verify_ctx()
918. }
919.
920. > static TS_VERIFY_CTX *create_verify_ctx(char *data, char *digest,
921. char *queryfile,
922. char *CApath, char *CAfile,
apps/ts.c:926:5:
924. X509_VERIFY_PARAM *vpm)
925. {
926. > TS_VERIFY_CTX *ctx = NULL;
927. BIO *input = NULL;
928. TS_REQ *request = NULL;
apps/ts.c:927:5:
925. {
926. TS_VERIFY_CTX *ctx = NULL;
927. > BIO *input = NULL;
928. TS_REQ *request = NULL;
929. int ret = 0;
apps/ts.c:928:5:
926. TS_VERIFY_CTX *ctx = NULL;
927. BIO *input = NULL;
928. > TS_REQ *request = NULL;
929. int ret = 0;
930. int f = 0;
apps/ts.c:929:5:
927. BIO *input = NULL;
928. TS_REQ *request = NULL;
929. > int ret = 0;
930. int f = 0;
931.
apps/ts.c:930:5:
928. TS_REQ *request = NULL;
929. int ret = 0;
930. > int f = 0;
931.
932. if (data != NULL || digest != NULL) {
apps/ts.c:932:9: Taking true branch
930. int f = 0;
931.
932. if (data != NULL || digest != NULL) {
^
933. if ((ctx = TS_VERIFY_CTX_new()) == NULL)
934. goto err;
apps/ts.c:933:13:
931.
932. if (data != NULL || digest != NULL) {
933. > if ((ctx = TS_VERIFY_CTX_new()) == NULL)
934. goto err;
935. f = TS_VFY_VERSION | TS_VFY_SIGNER;
crypto/ts/ts_verify_ctx.c:64:1: start of procedure TS_VERIFY_CTX_new()
62. #include "ts_lcl.h"
63.
64. > TS_VERIFY_CTX *TS_VERIFY_CTX_new(void)
65. {
66. TS_VERIFY_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
crypto/ts/ts_verify_ctx.c:66:5:
64. TS_VERIFY_CTX *TS_VERIFY_CTX_new(void)
65. {
66. > TS_VERIFY_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
67.
68. if (ctx == 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/ts/ts_verify_ctx.c:68:9: Taking false branch
66. TS_VERIFY_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
67.
68. if (ctx == NULL)
^
69. TSerr(TS_F_TS_VERIFY_CTX_NEW, ERR_R_MALLOC_FAILURE);
70. return ctx;
crypto/ts/ts_verify_ctx.c:70:5:
68. if (ctx == NULL)
69. TSerr(TS_F_TS_VERIFY_CTX_NEW, ERR_R_MALLOC_FAILURE);
70. > return ctx;
71. }
72.
crypto/ts/ts_verify_ctx.c:71:1: return from a call to TS_VERIFY_CTX_new
69. TSerr(TS_F_TS_VERIFY_CTX_NEW, ERR_R_MALLOC_FAILURE);
70. return ctx;
71. > }
72.
73. void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx)
apps/ts.c:933:13: Taking false branch
931.
932. if (data != NULL || digest != NULL) {
933. if ((ctx = TS_VERIFY_CTX_new()) == NULL)
^
934. goto err;
935. f = TS_VFY_VERSION | TS_VFY_SIGNER;
apps/ts.c:935:9:
933. if ((ctx = TS_VERIFY_CTX_new()) == NULL)
934. goto err;
935. > f = TS_VFY_VERSION | TS_VFY_SIGNER;
936. if (data != NULL) {
937. f |= TS_VFY_DATA;
apps/ts.c:936:13: Taking true branch
934. goto err;
935. f = TS_VFY_VERSION | TS_VFY_SIGNER;
936. if (data != NULL) {
^
937. f |= TS_VFY_DATA;
938. if (TS_VERIFY_CTX_set_data(ctx, BIO_new_file(data, "rb")) == NULL)
apps/ts.c:937:13:
935. f = TS_VFY_VERSION | TS_VFY_SIGNER;
936. if (data != NULL) {
937. > f |= TS_VFY_DATA;
938. if (TS_VERIFY_CTX_set_data(ctx, BIO_new_file(data, "rb")) == NULL)
939. goto err;
apps/ts.c:938:17:
936. if (data != NULL) {
937. f |= TS_VFY_DATA;
938. > if (TS_VERIFY_CTX_set_data(ctx, BIO_new_file(data, "rb")) == NULL)
939. goto err;
940. } else if (digest != NULL) {
crypto/bio/bss_file.c:163:1: start of procedure BIO_new_file()
161. }
162.
163. > BIO *BIO_new_file(const char *filename, const char *mode)
164. {
165. BIO *ret;
crypto/bio/bss_file.c:166:5:
164. {
165. BIO *ret;
166. > FILE *file = file_fopen(filename, mode);
167. int fp_flags = BIO_CLOSE;
168.
crypto/bio/bss_file.c:112:1: start of procedure file_fopen()
110. };
111.
112. > static FILE *file_fopen(const char *filename, const char *mode)
113. {
114. FILE *file = NULL;
crypto/bio/bss_file.c:114:5:
112. static FILE *file_fopen(const char *filename, const char *mode)
113. {
114. > FILE *file = NULL;
115.
116. # if defined(_WIN32) && defined(CP_UTF8)
crypto/bio/bss_file.c:158:5:
156. }
157. # else
158. > file = fopen(filename, mode);
159. # endif
160. return (file);
crypto/bio/bss_file.c:160:5:
158. file = fopen(filename, mode);
159. # endif
160. > return (file);
161. }
162.
crypto/bio/bss_file.c:161:1: return from a call to file_fopen
159. # endif
160. return (file);
161. > }
162.
163. BIO *BIO_new_file(const char *filename, const char *mode)
crypto/bio/bss_file.c:167:5:
165. BIO *ret;
166. FILE *file = file_fopen(filename, mode);
167. > int fp_flags = BIO_CLOSE;
168.
169. if (strchr(mode, 'b') == NULL)
crypto/bio/bss_file.c:169:9: Taking false branch
167. int fp_flags = BIO_CLOSE;
168.
169. if (strchr(mode, 'b') == NULL)
^
170. fp_flags |= BIO_FP_TEXT;
171.
crypto/bio/bss_file.c:172:9: Taking true branch
170. fp_flags |= BIO_FP_TEXT;
171.
172. if (file == NULL) {
^
173. SYSerr(SYS_F_FOPEN, get_last_sys_error());
174. ERR_add_error_data(5, "fopen('", filename, "','", mode, "')");
crypto/bio/bss_file.c:173:9:
171.
172. if (file == NULL) {
173. > SYSerr(SYS_F_FOPEN, get_last_sys_error());
174. ERR_add_error_data(5, "fopen('", filename, "','", mode, "')");
175. if (errno == ENOENT)
crypto/bio/bss_file.c:174:9:
172. if (file == NULL) {
173. SYSerr(SYS_F_FOPEN, get_last_sys_error());
174. > ERR_add_error_data(5, "fopen('", filename, "','", mode, "')");
175. if (errno == ENOENT)
176. BIOerr(BIO_F_BIO_NEW_FILE, BIO_R_NO_SUCH_FILE);
crypto/err/err.c:814:1: start of procedure ERR_add_error_data()
812. }
813.
814. > void ERR_add_error_data(int num, ...)
815. {
816. va_list args;
crypto/err/err.c:817:5:
815. {
816. va_list args;
817. > va_start(args, num);
818. ERR_add_error_vdata(num, args);
819. va_end(args);
crypto/err/err.c:818:5: Skipping ERR_add_error_vdata(): empty list of specs
816. va_list args;
817. va_start(args, num);
818. ERR_add_error_vdata(num, args);
^
819. va_end(args);
820. }
crypto/err/err.c:819:5:
817. va_start(args, num);
818. ERR_add_error_vdata(num, args);
819. > va_end(args);
820. }
821.
crypto/err/err.c:820:1: return from a call to ERR_add_error_data
818. ERR_add_error_vdata(num, args);
819. va_end(args);
820. > }
821.
822. void ERR_add_error_vdata(int num, va_list args)
crypto/bio/bss_file.c:175:13: Taking false branch
173. SYSerr(SYS_F_FOPEN, get_last_sys_error());
174. ERR_add_error_data(5, "fopen('", filename, "','", mode, "')");
175. if (errno == ENOENT)
^
176. BIOerr(BIO_F_BIO_NEW_FILE, BIO_R_NO_SUCH_FILE);
177. else
crypto/bio/bss_file.c:178:13: Skipping ERR_put_error(): empty list of specs
176. BIOerr(BIO_F_BIO_NEW_FILE, BIO_R_NO_SUCH_FILE);
177. else
178. BIOerr(BIO_F_BIO_NEW_FILE, ERR_R_SYS_LIB);
^
179. return (NULL);
180. }
crypto/bio/bss_file.c:179:9:
177. else
178. BIOerr(BIO_F_BIO_NEW_FILE, ERR_R_SYS_LIB);
179. > return (NULL);
180. }
181. if ((ret = BIO_new(BIO_s_file())) == NULL) {
crypto/bio/bss_file.c:190:1: return from a call to BIO_new_file
188. BIO_set_fp(ret, file, fp_flags);
189. return (ret);
190. > }
191.
192. BIO *BIO_new_fp(FILE *stream, int close_flag)
crypto/ts/ts_verify_ctx.c:100:1: start of procedure TS_VERIFY_CTX_set_data()
98. }
99.
100. > BIO *TS_VERIFY_CTX_set_data(TS_VERIFY_CTX *ctx, BIO *b)
101. {
102. ctx->data = b;
crypto/ts/ts_verify_ctx.c:102:5:
100. BIO *TS_VERIFY_CTX_set_data(TS_VERIFY_CTX *ctx, BIO *b)
101. {
102. > ctx->data = b;
103. return ctx->data;
104. }
crypto/ts/ts_verify_ctx.c:103:5:
101. {
102. ctx->data = b;
103. > return ctx->data;
104. }
105.
crypto/ts/ts_verify_ctx.c:104:1: return from a call to TS_VERIFY_CTX_set_data
102. ctx->data = b;
103. return ctx->data;
104. > }
105.
106. X509_STORE *TS_VERIFY_CTX_set_store(TS_VERIFY_CTX *ctx, X509_STORE *s)
apps/ts.c:938:17: Taking true branch
936. if (data != NULL) {
937. f |= TS_VFY_DATA;
938. if (TS_VERIFY_CTX_set_data(ctx, BIO_new_file(data, "rb")) == NULL)
^
939. goto err;
940. } else if (digest != NULL) {
apps/ts.c:974:2:
972. ret = 1;
973.
974. > err:
975. if (!ret) {
976. TS_VERIFY_CTX_free(ctx);
apps/ts.c:975:10: Taking true branch
973.
974. err:
975. if (!ret) {
^
976. TS_VERIFY_CTX_free(ctx);
977. ctx = NULL;
apps/ts.c:976:9:
974. err:
975. if (!ret) {
976. > TS_VERIFY_CTX_free(ctx);
977. ctx = NULL;
978. }
crypto/ts/ts_verify_ctx.c:79:1: start of procedure TS_VERIFY_CTX_free()
77. }
78.
79. > void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx)
80. {
81. if (!ctx)
crypto/ts/ts_verify_ctx.c:81:10: Taking false branch
79. void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx)
80. {
81. if (!ctx)
^
82. return;
83.
crypto/ts/ts_verify_ctx.c:84:5: Skipping TS_VERIFY_CTX_cleanup(): empty list of specs
82. return;
83.
84. TS_VERIFY_CTX_cleanup(ctx);
^
85. OPENSSL_free(ctx);
86. }
crypto/ts/ts_verify_ctx.c:85:5:
83.
84. TS_VERIFY_CTX_cleanup(ctx);
85. > OPENSSL_free(ctx);
86. }
87.
crypto/mem.c:210:1: start of procedure CRYPTO_free()
208. }
209.
210. > void CRYPTO_free(void *str, const char *file, int line)
211. {
212. if (free_impl != NULL && free_impl != &CRYPTO_free) {
crypto/mem.c:212:9: Taking true branch
210. void CRYPTO_free(void *str, const char *file, int line)
211. {
212. if (free_impl != NULL && free_impl != &CRYPTO_free) {
^
213. free_impl(str, file, line);
214. return;
crypto/mem.c:212:30: Taking true branch
210. void CRYPTO_free(void *str, const char *file, int line)
211. {
212. if (free_impl != NULL && free_impl != &CRYPTO_free) {
^
213. free_impl(str, file, line);
214. return;
crypto/mem.c:213:9: Skipping __function_pointer__(): unresolved function pointer
211. {
212. if (free_impl != NULL && free_impl != &CRYPTO_free) {
213. free_impl(str, file, line);
^
214. return;
215. }
crypto/mem.c:214:9:
212. if (free_impl != NULL && free_impl != &CRYPTO_free) {
213. free_impl(str, file, line);
214. > return;
215. }
216.
crypto/mem.c:228:1: return from a call to CRYPTO_free
226. free(str);
227. #endif
228. > }
229.
230. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
crypto/ts/ts_verify_ctx.c:86:1: return from a call to TS_VERIFY_CTX_free
84. TS_VERIFY_CTX_cleanup(ctx);
85. OPENSSL_free(ctx);
86. > }
87.
88. int TS_VERIFY_CTX_add_flags(TS_VERIFY_CTX *ctx, int f)
|
https://github.com/openssl/openssl/blob/6457615ac82d688a965c9b2cce9611e0559635be/apps/ts.c/#L976
|
d2a_code_trace_data_42605
|
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
enum AVSampleFormat sample_fmt, int align)
{
int line_size;
int sample_size = av_get_bytes_per_sample(sample_fmt);
int planar = av_sample_fmt_is_planar(sample_fmt);
if (!sample_size || nb_samples <= 0 || nb_channels <= 0)
return AVERROR(EINVAL);
if (!align) {
if (nb_samples > INT_MAX - 31)
return AVERROR(EINVAL);
align = 1;
nb_samples = FFALIGN(nb_samples, 32);
}
if (nb_channels > INT_MAX / align ||
(int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size)
return AVERROR(EINVAL);
line_size = planar ? FFALIGN(nb_samples * sample_size, align) :
FFALIGN(nb_samples * sample_size * nb_channels, align);
if (linesize)
*linesize = line_size;
return planar ? line_size * nb_channels : line_size;
}
libavutil/audio_fifo.c:124: error: Integer Overflow L2
([1, 2147483616] + 32):signed32 by call to `av_audio_fifo_realloc`.
libavutil/audio_fifo.c:113:1: Parameter `nb_samples`
111. }
112.
113. int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples)
^
114. {
115. int i, ret, size;
libavutil/audio_fifo.c:124:20: Call
122. return AVERROR(EINVAL);
123. /* reallocate buffers */
124. if ((ret = av_audio_fifo_realloc(af, 2 * (current_size + nb_samples))) < 0)
^
125. return ret;
126. }
libavutil/audio_fifo.c:97:1: Parameter `nb_samples`
95. }
96.
97. int av_audio_fifo_realloc(AVAudioFifo *af, int nb_samples)
^
98. {
99. int i, ret, buf_size;
libavutil/audio_fifo.c:101:16: Call
99. int i, ret, buf_size;
100.
101. if ((ret = av_samples_get_buffer_size(&buf_size, af->channels, nb_samples,
^
102. af->sample_fmt, 1)) < 0)
103. return ret;
libavutil/samplefmt.c:108:1: <LHS trace>
106. }
107.
108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
^
109. enum AVSampleFormat sample_fmt, int align)
110. {
libavutil/samplefmt.c:108:1: Parameter `nb_samples`
106. }
107.
108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
^
109. enum AVSampleFormat sample_fmt, int align)
110. {
libavutil/samplefmt.c:124:9: Binary operation: ([1, 2147483616] + 32):signed32 by call to `av_audio_fifo_realloc`
122. return AVERROR(EINVAL);
123. align = 1;
124. nb_samples = FFALIGN(nb_samples, 32);
^
125. }
126.
|
https://github.com/libav/libav/blob/0e830094ad0dc251613a0aa3234d9c5c397e02e6/libavutil/samplefmt.c/#L124
|
d2a_code_trace_data_42606
|
static int client_hello_select_server_ctx(SSL *s, void *arg, int ignore)
{
const char *servername;
const unsigned char *p;
size_t len, remaining;
HANDSHAKE_EX_DATA *ex_data =
(HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
if (!SSL_client_hello_get0_ext(s, TLSEXT_TYPE_server_name, &p,
&remaining) ||
remaining <= 2)
return 0;
len = (*(p++) << 8);
len += *(p++);
if (len + 2 != remaining)
return 0;
remaining = len;
if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name)
return 0;
remaining--;
if (remaining <= 2)
return 0;
len = (*(p++) << 8);
len += *(p++);
if (len + 2 > remaining)
return 0;
remaining = len;
servername = (const char *)p;
if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) {
SSL_CTX *new_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 1;
} else if (len == strlen("server1") &&
strncmp(servername, "server1", len) == 0) {
ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
return 1;
} else if (ignore) {
ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
return 1;
}
return 0;
}
test/handshake_helper.c:196: error: NULL_DEREFERENCE
pointer `ex_data` last assigned on line 151 could be null and is dereferenced at line 196, column 9.
Showing all 68 steps of the trace
test/handshake_helper.c:146:1: start of procedure client_hello_select_server_ctx()
144. }
145.
146. > static int client_hello_select_server_ctx(SSL *s, void *arg, int ignore)
147. {
148. const char *servername;
test/handshake_helper.c:151:5:
149. const unsigned char *p;
150. size_t len, remaining;
151. > HANDSHAKE_EX_DATA *ex_data =
152. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
153.
ssl/ssl_lib.c:4154:1: start of procedure SSL_get_ex_data()
4152. }
4153.
4154. > void *SSL_get_ex_data(const SSL *s, int idx)
4155. {
4156. return CRYPTO_get_ex_data(&s->ex_data, idx);
ssl/ssl_lib.c:4156:5:
4154. void *SSL_get_ex_data(const SSL *s, int idx)
4155. {
4156. > return CRYPTO_get_ex_data(&s->ex_data, idx);
4157. }
4158.
crypto/ex_data.c:393:1: start of procedure CRYPTO_get_ex_data()
391. * particular index in the class used by this variable
392. */
393. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
394. {
395. if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
crypto/ex_data.c:395:9: Taking true branch
393. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
394. {
395. if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
^
396. return NULL;
397. return sk_void_value(ad->sk, idx);
crypto/ex_data.c:396:9:
394. {
395. if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
396. > return NULL;
397. return sk_void_value(ad->sk, idx);
398. }
crypto/ex_data.c:398:1: return from a call to CRYPTO_get_ex_data
396. return NULL;
397. return sk_void_value(ad->sk, idx);
398. > }
ssl/ssl_lib.c:4157:1: return from a call to SSL_get_ex_data
4155. {
4156. return CRYPTO_get_ex_data(&s->ex_data, idx);
4157. > }
4158.
4159. int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg)
test/handshake_helper.c:158:10: Taking false branch
156. * was written, so parsing the normal case is a bit complex.
157. */
158. if (!SSL_client_hello_get0_ext(s, TLSEXT_TYPE_server_name, &p,
^
159. &remaining) ||
160. remaining <= 2)
test/handshake_helper.c:160:9: Taking false branch
158. if (!SSL_client_hello_get0_ext(s, TLSEXT_TYPE_server_name, &p,
159. &remaining) ||
160. remaining <= 2)
^
161. return 0;
162. /* Extract the length of the supplied list of names. */
test/handshake_helper.c:163:5:
161. return 0;
162. /* Extract the length of the supplied list of names. */
163. > len = (*(p++) << 8);
164. len += *(p++);
165. if (len + 2 != remaining)
test/handshake_helper.c:164:5:
162. /* Extract the length of the supplied list of names. */
163. len = (*(p++) << 8);
164. > len += *(p++);
165. if (len + 2 != remaining)
166. return 0;
test/handshake_helper.c:165:9: Taking false branch
163. len = (*(p++) << 8);
164. len += *(p++);
165. if (len + 2 != remaining)
^
166. return 0;
167. remaining = len;
test/handshake_helper.c:167:5:
165. if (len + 2 != remaining)
166. return 0;
167. > remaining = len;
168. /*
169. * The list in practice only has a single element, so we only consider
test/handshake_helper.c:172:9: Taking false branch
170. * the first one.
171. */
172. if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name)
^
173. return 0;
174. remaining--;
test/handshake_helper.c:172:27: Taking false branch
170. * the first one.
171. */
172. if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name)
^
173. return 0;
174. remaining--;
test/handshake_helper.c:174:5:
172. if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name)
173. return 0;
174. > remaining--;
175. /* Now we can finally pull out the byte array with the actual hostname. */
176. if (remaining <= 2)
test/handshake_helper.c:176:9: Taking false branch
174. remaining--;
175. /* Now we can finally pull out the byte array with the actual hostname. */
176. if (remaining <= 2)
^
177. return 0;
178. len = (*(p++) << 8);
test/handshake_helper.c:178:5:
176. if (remaining <= 2)
177. return 0;
178. > len = (*(p++) << 8);
179. len += *(p++);
180. if (len + 2 > remaining)
test/handshake_helper.c:179:5:
177. return 0;
178. len = (*(p++) << 8);
179. > len += *(p++);
180. if (len + 2 > remaining)
181. return 0;
test/handshake_helper.c:180:9: Taking false branch
178. len = (*(p++) << 8);
179. len += *(p++);
180. if (len + 2 > remaining)
^
181. return 0;
182. remaining = len;
test/handshake_helper.c:182:5:
180. if (len + 2 > remaining)
181. return 0;
182. > remaining = len;
183. servername = (const char *)p;
184.
test/handshake_helper.c:183:5:
181. return 0;
182. remaining = len;
183. > servername = (const char *)p;
184.
185. if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) {
test/handshake_helper.c:185:9: Taking true branch
183. servername = (const char *)p;
184.
185. if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) {
^
186. SSL_CTX *new_ctx = arg;
187. SSL_set_SSL_CTX(s, new_ctx);
test/handshake_helper.c:185:37: Taking true branch
183. servername = (const char *)p;
184.
185. if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) {
^
186. SSL_CTX *new_ctx = arg;
187. SSL_set_SSL_CTX(s, new_ctx);
test/handshake_helper.c:186:9:
184.
185. if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) {
186. > SSL_CTX *new_ctx = arg;
187. SSL_set_SSL_CTX(s, new_ctx);
188. /*
test/handshake_helper.c:187:9:
185. if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) {
186. SSL_CTX *new_ctx = arg;
187. > SSL_set_SSL_CTX(s, new_ctx);
188. /*
189. * Copy over all the SSL_CTX options - reasonable behavior
ssl/ssl_lib.c:3991:1: start of procedure SSL_set_SSL_CTX()
3989. }
3990.
3991. > SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx)
3992. {
3993. CERT *new_cert;
ssl/ssl_lib.c:3994:9: Taking false branch
3992. {
3993. CERT *new_cert;
3994. if (ssl->ctx == ctx)
^
3995. return ssl->ctx;
3996. if (ctx == NULL)
ssl/ssl_lib.c:3996:9: Taking false branch
3994. if (ssl->ctx == ctx)
3995. return ssl->ctx;
3996. if (ctx == NULL)
^
3997. ctx = ssl->session_ctx;
3998. new_cert = ssl_cert_dup(ctx->cert);
ssl/ssl_lib.c:3998:5: Skipping ssl_cert_dup(): empty list of specs
3996. if (ctx == NULL)
3997. ctx = ssl->session_ctx;
3998. new_cert = ssl_cert_dup(ctx->cert);
^
3999. if (new_cert == NULL) {
4000. return NULL;
ssl/ssl_lib.c:3999:9: Taking false branch
3997. ctx = ssl->session_ctx;
3998. new_cert = ssl_cert_dup(ctx->cert);
3999. if (new_cert == NULL) {
^
4000. return NULL;
4001. }
ssl/ssl_lib.c:4003:10: Taking false branch
4001. }
4002.
4003. if (!custom_exts_copy_flags(&new_cert->custext, &ssl->cert->custext)) {
^
4004. ssl_cert_free(new_cert);
4005. return NULL;
ssl/ssl_lib.c:4008:5: Skipping ssl_cert_free(): empty list of specs
4006. }
4007.
4008. ssl_cert_free(ssl->cert);
^
4009. ssl->cert = new_cert;
4010.
ssl/ssl_lib.c:4009:5:
4007.
4008. ssl_cert_free(ssl->cert);
4009. > ssl->cert = new_cert;
4010.
4011. /*
ssl/ssl_lib.c:4015:10: Condition is true
4013. * so setter APIs must prevent invalid lengths from entering the system.
4014. */
4015. if (!ossl_assert(ssl->sid_ctx_length <= sizeof(ssl->sid_ctx)))
^
4016. return NULL;
4017.
ssl/ssl_lib.c:4015:10: Taking false branch
4013. * so setter APIs must prevent invalid lengths from entering the system.
4014. */
4015. if (!ossl_assert(ssl->sid_ctx_length <= sizeof(ssl->sid_ctx)))
^
4016. return NULL;
4017.
ssl/ssl_lib.c:4024:10: Taking true branch
4022. * leave it unchanged.
4023. */
4024. if ((ssl->ctx != NULL) &&
^
4025. (ssl->sid_ctx_length == ssl->ctx->sid_ctx_length) &&
4026. (memcmp(ssl->sid_ctx, ssl->ctx->sid_ctx, ssl->sid_ctx_length) == 0)) {
ssl/ssl_lib.c:4025:10: Taking false branch
4023. */
4024. if ((ssl->ctx != NULL) &&
4025. (ssl->sid_ctx_length == ssl->ctx->sid_ctx_length) &&
^
4026. (memcmp(ssl->sid_ctx, ssl->ctx->sid_ctx, ssl->sid_ctx_length) == 0)) {
4027. ssl->sid_ctx_length = ctx->sid_ctx_length;
ssl/ssl_lib.c:4031:5:
4029. }
4030.
4031. > SSL_CTX_up_ref(ctx);
4032. SSL_CTX_free(ssl->ctx); /* decrement reference count */
4033. ssl->ctx = ctx;
ssl/ssl_lib.c:3125:1: start of procedure SSL_CTX_up_ref()
3123. }
3124.
3125. > int SSL_CTX_up_ref(SSL_CTX *ctx)
3126. {
3127. int i;
ssl/ssl_lib.c:3129:9:
3127. int i;
3128.
3129. > if (CRYPTO_UP_REF(&ctx->references, &i, ctx->lock) <= 0)
3130. return 0;
3131.
include/internal/refcount.h:32:1: start of procedure CRYPTO_UP_REF()
30. typedef _Atomic int CRYPTO_REF_COUNT;
31.
32. > static ossl_inline int CRYPTO_UP_REF(_Atomic int *val, int *ret, void *lock)
33. {
34. *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1;
include/internal/refcount.h:34:5:
32. static ossl_inline int CRYPTO_UP_REF(_Atomic int *val, int *ret, void *lock)
33. {
34. > *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1;
35. return 1;
36. }
include/internal/refcount.h:35:5:
33. {
34. *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1;
35. > return 1;
36. }
37.
include/internal/refcount.h:36:1: return from a call to CRYPTO_UP_REF
34. *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1;
35. return 1;
36. > }
37.
38. static ossl_inline int CRYPTO_DOWN_REF(_Atomic int *val, int *ret, void *lock)
ssl/ssl_lib.c:3129:9: Taking false branch
3127. int i;
3128.
3129. if (CRYPTO_UP_REF(&ctx->references, &i, ctx->lock) <= 0)
^
3130. return 0;
3131.
ssl/ssl_lib.c:3134:14: Condition is false
3132. REF_PRINT_COUNT("SSL_CTX", ctx);
3133. REF_ASSERT_ISNT(i < 2);
3134. return ((i > 1) ? 1 : 0);
^
3135. }
3136.
ssl/ssl_lib.c:3134:13:
3132. REF_PRINT_COUNT("SSL_CTX", ctx);
3133. REF_ASSERT_ISNT(i < 2);
3134. > return ((i > 1) ? 1 : 0);
3135. }
3136.
ssl/ssl_lib.c:3134:5:
3132. REF_PRINT_COUNT("SSL_CTX", ctx);
3133. REF_ASSERT_ISNT(i < 2);
3134. > return ((i > 1) ? 1 : 0);
3135. }
3136.
ssl/ssl_lib.c:3135:1: return from a call to SSL_CTX_up_ref
3133. REF_ASSERT_ISNT(i < 2);
3134. return ((i > 1) ? 1 : 0);
3135. > }
3136.
3137. void SSL_CTX_free(SSL_CTX *a)
ssl/ssl_lib.c:4032:5: Skipping SSL_CTX_free(): empty list of specs
4030.
4031. SSL_CTX_up_ref(ctx);
4032. SSL_CTX_free(ssl->ctx); /* decrement reference count */
^
4033. ssl->ctx = ctx;
4034.
ssl/ssl_lib.c:4033:5:
4031. SSL_CTX_up_ref(ctx);
4032. SSL_CTX_free(ssl->ctx); /* decrement reference count */
4033. > ssl->ctx = ctx;
4034.
4035. return ssl->ctx;
ssl/ssl_lib.c:4035:5:
4033. ssl->ctx = ctx;
4034.
4035. > return ssl->ctx;
4036. }
4037.
ssl/ssl_lib.c:4036:1: return from a call to SSL_set_SSL_CTX
4034.
4035. return ssl->ctx;
4036. > }
4037.
4038. int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx)
test/handshake_helper.c:193:9:
191. * contexts differ/conflict
192. */
193. > SSL_clear_options(s, 0xFFFFFFFFL);
194. SSL_set_options(s, SSL_CTX_get_options(new_ctx));
195.
ssl/ssl_lib.c:4578:1: start of procedure SSL_clear_options()
4576. }
4577.
4578. > unsigned long SSL_clear_options(SSL *s, unsigned long op)
4579. {
4580. return s->options &= ~op;
ssl/ssl_lib.c:4580:5:
4578. unsigned long SSL_clear_options(SSL *s, unsigned long op)
4579. {
4580. > return s->options &= ~op;
4581. }
4582.
ssl/ssl_lib.c:4581:1: return from a call to SSL_clear_options
4579. {
4580. return s->options &= ~op;
4581. > }
4582.
4583. STACK_OF(X509) *SSL_get0_verified_chain(const SSL *s)
test/handshake_helper.c:194:9:
192. */
193. SSL_clear_options(s, 0xFFFFFFFFL);
194. > SSL_set_options(s, SSL_CTX_get_options(new_ctx));
195.
196. ex_data->servername = SSL_TEST_SERVERNAME_SERVER2;
ssl/ssl_lib.c:4553:1: start of procedure SSL_CTX_get_options()
4551. * control interface.
4552. */
4553. > unsigned long SSL_CTX_get_options(const SSL_CTX *ctx)
4554. {
4555. return ctx->options;
ssl/ssl_lib.c:4555:5:
4553. unsigned long SSL_CTX_get_options(const SSL_CTX *ctx)
4554. {
4555. > return ctx->options;
4556. }
4557.
ssl/ssl_lib.c:4556:1: return from a call to SSL_CTX_get_options
4554. {
4555. return ctx->options;
4556. > }
4557.
4558. unsigned long SSL_get_options(const SSL *s)
ssl/ssl_lib.c:4568:1: start of procedure SSL_set_options()
4566. }
4567.
4568. > unsigned long SSL_set_options(SSL *s, unsigned long op)
4569. {
4570. return s->options |= op;
ssl/ssl_lib.c:4570:5:
4568. unsigned long SSL_set_options(SSL *s, unsigned long op)
4569. {
4570. > return s->options |= op;
4571. }
4572.
ssl/ssl_lib.c:4571:1: return from a call to SSL_set_options
4569. {
4570. return s->options |= op;
4571. > }
4572.
4573. unsigned long SSL_CTX_clear_options(SSL_CTX *ctx, unsigned long op)
test/handshake_helper.c:196:9:
194. SSL_set_options(s, SSL_CTX_get_options(new_ctx));
195.
196. > ex_data->servername = SSL_TEST_SERVERNAME_SERVER2;
197. return 1;
198. } else if (len == strlen("server1") &&
|
https://github.com/openssl/openssl/blob/f770d75b1cac264d6280ec7326277daff6965cbb/test/handshake_helper.c/#L196
|
d2a_code_trace_data_42607
|
X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h,
X509_OBJECT *x)
{
int idx, i;
X509_OBJECT *obj;
idx = sk_X509_OBJECT_find(h, x);
if (idx == -1)
return NULL;
if ((x->type != X509_LU_X509) && (x->type != X509_LU_CRL))
return sk_X509_OBJECT_value(h, idx);
for (i = idx; i < sk_X509_OBJECT_num(h); i++) {
obj = sk_X509_OBJECT_value(h, i);
if (x509_object_cmp
((const X509_OBJECT **)&obj, (const X509_OBJECT **)&x))
return NULL;
if (x->type == X509_LU_X509) {
if (!X509_cmp(obj->data.x509, x->data.x509))
return obj;
} else if (x->type == X509_LU_CRL) {
if (!X509_CRL_match(obj->data.crl, x->data.crl))
return obj;
} else
return obj;
}
return NULL;
}
crypto/x509/x509_lu.c:565: error: NULL_DEREFERENCE
pointer `&obj` last assigned on line 564 could be null and is dereferenced by call to `x509_object_cmp()` at line 565, column 13.
Showing all 41 steps of the trace
crypto/x509/x509_lu.c:553:1: start of procedure X509_OBJECT_retrieve_match()
551. }
552.
553. > X509_OBJECT *X509_OBJECT_retrieve_match(STACK_OF(X509_OBJECT) *h,
554. X509_OBJECT *x)
555. {
crypto/x509/x509_lu.c:558:5:
556. int idx, i;
557. X509_OBJECT *obj;
558. > idx = sk_X509_OBJECT_find(h, x);
559. if (idx == -1)
560. return NULL;
include/openssl/x509_vfy.h:58:1: start of procedure sk_X509_OBJECT_find()
56.
57. DEFINE_STACK_OF(X509_LOOKUP)
58. > DEFINE_STACK_OF(X509_OBJECT)
59. DEFINE_STACK_OF(X509_VERIFY_PARAM)
60.
crypto/stack/stack.c:311:1: start of procedure OPENSSL_sk_find()
309. }
310.
311. > int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data)
312. {
313. return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);
crypto/stack/stack.c:313:5:
311. int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data)
312. {
313. > return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);
314. }
315.
crypto/stack/stack.c:282:1: start of procedure internal_find()
280. }
281.
282. > static int internal_find(OPENSSL_STACK *st, const void *data,
283. int ret_val_options)
284. {
crypto/stack/stack.c:288:9: Taking false branch
286. int i;
287.
288. if (st == NULL || st->num == 0)
^
289. return -1;
290.
crypto/stack/stack.c:288:23: Taking false branch
286. int i;
287.
288. if (st == NULL || st->num == 0)
^
289. return -1;
290.
crypto/stack/stack.c:291:9: Taking true branch
289. return -1;
290.
291. if (st->comp == NULL) {
^
292. for (i = 0; i < st->num; i++)
293. if (st->data[i] == data)
crypto/stack/stack.c:292:14:
290.
291. if (st->comp == NULL) {
292. > for (i = 0; i < st->num; i++)
293. if (st->data[i] == data)
294. return i;
crypto/stack/stack.c:292:21: Loop condition is true. Entering loop body
290.
291. if (st->comp == NULL) {
292. for (i = 0; i < st->num; i++)
^
293. if (st->data[i] == data)
294. return i;
crypto/stack/stack.c:293:17: Taking false branch
291. if (st->comp == NULL) {
292. for (i = 0; i < st->num; i++)
293. if (st->data[i] == data)
^
294. return i;
295. return -1;
crypto/stack/stack.c:292:34:
290.
291. if (st->comp == NULL) {
292. > for (i = 0; i < st->num; i++)
293. if (st->data[i] == data)
294. return i;
crypto/stack/stack.c:292:21: Loop condition is true. Entering loop body
290.
291. if (st->comp == NULL) {
292. for (i = 0; i < st->num; i++)
^
293. if (st->data[i] == data)
294. return i;
crypto/stack/stack.c:293:17: Taking true branch
291. if (st->comp == NULL) {
292. for (i = 0; i < st->num; i++)
293. if (st->data[i] == data)
^
294. return i;
295. return -1;
crypto/stack/stack.c:294:17:
292. for (i = 0; i < st->num; i++)
293. if (st->data[i] == data)
294. > return i;
295. return -1;
296. }
crypto/stack/stack.c:309:1: return from a call to internal_find
307.
308. return r == NULL ? -1 : (int)((const void **)r - st->data);
309. > }
310.
311. int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data)
crypto/stack/stack.c:314:1: return from a call to OPENSSL_sk_find
312. {
313. return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);
314. > }
315.
316. int OPENSSL_sk_find_ex(OPENSSL_STACK *st, const void *data)
include/openssl/x509_vfy.h:58:1: return from a call to sk_X509_OBJECT_find
56.
57. DEFINE_STACK_OF(X509_LOOKUP)
58. > DEFINE_STACK_OF(X509_OBJECT)
59. DEFINE_STACK_OF(X509_VERIFY_PARAM)
60.
crypto/x509/x509_lu.c:559:9: Taking false branch
557. X509_OBJECT *obj;
558. idx = sk_X509_OBJECT_find(h, x);
559. if (idx == -1)
^
560. return NULL;
561. if ((x->type != X509_LU_X509) && (x->type != X509_LU_CRL))
crypto/x509/x509_lu.c:561:10: Taking false branch
559. if (idx == -1)
560. return NULL;
561. if ((x->type != X509_LU_X509) && (x->type != X509_LU_CRL))
^
562. return sk_X509_OBJECT_value(h, idx);
563. for (i = idx; i < sk_X509_OBJECT_num(h); i++) {
crypto/x509/x509_lu.c:563:10:
561. if ((x->type != X509_LU_X509) && (x->type != X509_LU_CRL))
562. return sk_X509_OBJECT_value(h, idx);
563. > for (i = idx; i < sk_X509_OBJECT_num(h); i++) {
564. obj = sk_X509_OBJECT_value(h, i);
565. if (x509_object_cmp
crypto/x509/x509_lu.c:563:19:
561. if ((x->type != X509_LU_X509) && (x->type != X509_LU_CRL))
562. return sk_X509_OBJECT_value(h, idx);
563. > for (i = idx; i < sk_X509_OBJECT_num(h); i++) {
564. obj = sk_X509_OBJECT_value(h, i);
565. if (x509_object_cmp
include/openssl/x509_vfy.h:58:1: start of procedure sk_X509_OBJECT_num()
56.
57. DEFINE_STACK_OF(X509_LOOKUP)
58. > DEFINE_STACK_OF(X509_OBJECT)
59. DEFINE_STACK_OF(X509_VERIFY_PARAM)
60.
crypto/stack/stack.c:375:1: start of procedure OPENSSL_sk_num()
373. }
374.
375. > int OPENSSL_sk_num(const OPENSSL_STACK *st)
376. {
377. return st == NULL ? -1 : st->num;
crypto/stack/stack.c:377:12: Condition is false
375. int OPENSSL_sk_num(const OPENSSL_STACK *st)
376. {
377. return st == NULL ? -1 : st->num;
^
378. }
379.
crypto/stack/stack.c:377:5:
375. int OPENSSL_sk_num(const OPENSSL_STACK *st)
376. {
377. > return st == NULL ? -1 : st->num;
378. }
379.
crypto/stack/stack.c:378:1: return from a call to OPENSSL_sk_num
376. {
377. return st == NULL ? -1 : st->num;
378. > }
379.
380. void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
include/openssl/x509_vfy.h:58:1: return from a call to sk_X509_OBJECT_num
56.
57. DEFINE_STACK_OF(X509_LOOKUP)
58. > DEFINE_STACK_OF(X509_OBJECT)
59. DEFINE_STACK_OF(X509_VERIFY_PARAM)
60.
crypto/x509/x509_lu.c:563:19: Loop condition is true. Entering loop body
561. if ((x->type != X509_LU_X509) && (x->type != X509_LU_CRL))
562. return sk_X509_OBJECT_value(h, idx);
563. for (i = idx; i < sk_X509_OBJECT_num(h); i++) {
^
564. obj = sk_X509_OBJECT_value(h, i);
565. if (x509_object_cmp
crypto/x509/x509_lu.c:564:9:
562. return sk_X509_OBJECT_value(h, idx);
563. for (i = idx; i < sk_X509_OBJECT_num(h); i++) {
564. > obj = sk_X509_OBJECT_value(h, i);
565. if (x509_object_cmp
566. ((const X509_OBJECT **)&obj, (const X509_OBJECT **)&x))
include/openssl/x509_vfy.h:58:1: start of procedure sk_X509_OBJECT_value()
56.
57. DEFINE_STACK_OF(X509_LOOKUP)
58. > DEFINE_STACK_OF(X509_OBJECT)
59. DEFINE_STACK_OF(X509_VERIFY_PARAM)
60.
crypto/stack/stack.c:380:1: start of procedure OPENSSL_sk_value()
378. }
379.
380. > void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
381. {
382. if (st == NULL || i < 0 || i >= st->num)
crypto/stack/stack.c:382:9: Taking false branch
380. void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
381. {
382. if (st == NULL || i < 0 || i >= st->num)
^
383. return NULL;
384. return (void *)st->data[i];
crypto/stack/stack.c:382:23: Taking true branch
380. void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
381. {
382. if (st == NULL || i < 0 || i >= st->num)
^
383. return NULL;
384. return (void *)st->data[i];
crypto/stack/stack.c:383:9:
381. {
382. if (st == NULL || i < 0 || i >= st->num)
383. > return NULL;
384. return (void *)st->data[i];
385. }
crypto/stack/stack.c:385:1: return from a call to OPENSSL_sk_value
383. return NULL;
384. return (void *)st->data[i];
385. > }
386.
387. void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data)
include/openssl/x509_vfy.h:58:1: return from a call to sk_X509_OBJECT_value
56.
57. DEFINE_STACK_OF(X509_LOOKUP)
58. > DEFINE_STACK_OF(X509_OBJECT)
59. DEFINE_STACK_OF(X509_VERIFY_PARAM)
60.
crypto/x509/x509_lu.c:565:13:
563. for (i = idx; i < sk_X509_OBJECT_num(h); i++) {
564. obj = sk_X509_OBJECT_value(h, i);
565. > if (x509_object_cmp
566. ((const X509_OBJECT **)&obj, (const X509_OBJECT **)&x))
567. return NULL;
crypto/x509/x509_lu.c:120:1: start of procedure x509_object_cmp()
118. }
119.
120. > static int x509_object_cmp(const X509_OBJECT *const *a,
121. const X509_OBJECT *const *b)
122. {
crypto/x509/x509_lu.c:125:5:
123. int ret;
124.
125. > ret = ((*a)->type - (*b)->type);
126. if (ret)
127. return ret;
|
https://github.com/openssl/openssl/blob/f770d75b1cac264d6280ec7326277daff6965cbb/crypto/x509/x509_lu.c/#L565
|
d2a_code_trace_data_42608
|
static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt, int *al)
{
#ifndef OPENSSL_NO_RSA
unsigned char *encdata = NULL;
EVP_PKEY *pkey = NULL;
EVP_PKEY_CTX *pctx = NULL;
size_t enclen;
unsigned char *pms = NULL;
size_t pmslen = 0;
if (s->session->peer == NULL) {
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR);
return 0;
}
pkey = X509_get0_pubkey(s->session->peer);
if (EVP_PKEY_get0_RSA(pkey) == NULL) {
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR);
return 0;
}
pmslen = SSL_MAX_MASTER_KEY_LENGTH;
pms = OPENSSL_malloc(pmslen);
if (pms == NULL) {
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_MALLOC_FAILURE);
*al = SSL_AD_INTERNAL_ERROR;
return 0;
}
pms[0] = s->client_version >> 8;
pms[1] = s->client_version & 0xff;
if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) {
goto err;
}
if (s->version > SSL3_VERSION && !WPACKET_start_sub_packet_u16(pkt)) {
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR);
goto err;
}
pctx = EVP_PKEY_CTX_new(pkey, NULL);
if (pctx == NULL || EVP_PKEY_encrypt_init(pctx) <= 0
|| EVP_PKEY_encrypt(pctx, NULL, &enclen, pms, pmslen) <= 0) {
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_EVP_LIB);
goto err;
}
if (!WPACKET_allocate_bytes(pkt, enclen, &encdata)
|| EVP_PKEY_encrypt(pctx, encdata, &enclen, pms, pmslen) <= 0) {
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, SSL_R_BAD_RSA_ENCRYPT);
goto err;
}
EVP_PKEY_CTX_free(pctx);
pctx = NULL;
# 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 (s->version > SSL3_VERSION && !WPACKET_close(pkt)) {
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR);
goto err;
}
s->s3->tmp.pms = pms;
s->s3->tmp.pmslen = pmslen;
return 1;
err:
OPENSSL_clear_free(pms, pmslen);
EVP_PKEY_CTX_free(pctx);
return 0;
#else
SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR);
*al = SSL_AD_INTERNAL_ERROR;
return 0;
#endif
}
ssl/statem/statem_clnt.c:2458: error: NULL_DEREFERENCE
pointer `pkey` last assigned on line 2457 could be null and is dereferenced by call to `EVP_PKEY_get0_RSA()` at line 2458, column 9.
Showing all 30 steps of the trace
ssl/statem/statem_clnt.c:2439:1: start of procedure tls_construct_cke_rsa()
2437. }
2438.
2439. > static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt, int *al)
2440. {
2441. #ifndef OPENSSL_NO_RSA
ssl/statem/statem_clnt.c:2442:5:
2440. {
2441. #ifndef OPENSSL_NO_RSA
2442. > unsigned char *encdata = NULL;
2443. EVP_PKEY *pkey = NULL;
2444. EVP_PKEY_CTX *pctx = NULL;
ssl/statem/statem_clnt.c:2443:5:
2441. #ifndef OPENSSL_NO_RSA
2442. unsigned char *encdata = NULL;
2443. > EVP_PKEY *pkey = NULL;
2444. EVP_PKEY_CTX *pctx = NULL;
2445. size_t enclen;
ssl/statem/statem_clnt.c:2444:5:
2442. unsigned char *encdata = NULL;
2443. EVP_PKEY *pkey = NULL;
2444. > EVP_PKEY_CTX *pctx = NULL;
2445. size_t enclen;
2446. unsigned char *pms = NULL;
ssl/statem/statem_clnt.c:2446:5:
2444. EVP_PKEY_CTX *pctx = NULL;
2445. size_t enclen;
2446. > unsigned char *pms = NULL;
2447. size_t pmslen = 0;
2448.
ssl/statem/statem_clnt.c:2447:5:
2445. size_t enclen;
2446. unsigned char *pms = NULL;
2447. > size_t pmslen = 0;
2448.
2449. if (s->session->peer == NULL) {
ssl/statem/statem_clnt.c:2449:9: Taking false branch
2447. size_t pmslen = 0;
2448.
2449. if (s->session->peer == NULL) {
^
2450. /*
2451. * We should always have a server certificate with SSL_kRSA.
ssl/statem/statem_clnt.c:2457:5:
2455. }
2456.
2457. > pkey = X509_get0_pubkey(s->session->peer);
2458. if (EVP_PKEY_get0_RSA(pkey) == NULL) {
2459. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR);
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_clnt.c:2458:9:
2456.
2457. pkey = X509_get0_pubkey(s->session->peer);
2458. > if (EVP_PKEY_get0_RSA(pkey) == NULL) {
2459. SSLerr(SSL_F_TLS_CONSTRUCT_CKE_RSA, ERR_R_INTERNAL_ERROR);
2460. return 0;
crypto/evp/p_lib.c:261:1: start of procedure EVP_PKEY_get0_RSA()
259. }
260.
261. > RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
262. {
263. if (pkey->type != EVP_PKEY_RSA) {
crypto/evp/p_lib.c:263:9:
261. RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
262. {
263. > if (pkey->type != EVP_PKEY_RSA) {
264. EVPerr(EVP_F_EVP_PKEY_GET0_RSA, EVP_R_EXPECTING_AN_RSA_KEY);
265. return NULL;
|
https://github.com/openssl/openssl/blob/4954fd13b3c71f0f74677b78533f1176e13de032/ssl/statem/statem_clnt.c/#L2458
|
d2a_code_trace_data_42609
|
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:1425: error: INTEGER_OVERFLOW_L2
([0, +oo] - [0, `s->s3->previous_client_finished_len` + `s->s3->previous_server_finished_len` + `pkt->written` + 9]):unsigned64 by call to `WPACKET_put_bytes__`.
Showing all 10 steps of the trace
ssl/t1_lib.c:1407:10: Call
1405. #endif
1406.
1407. if (!WPACKET_start_sub_packet_u16(pkt)
^
1408. || !WPACKET_set_flags(pkt, WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH)) {
1409. SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
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:1425:14: Call
1423. if (!s->hit && s->servername_done == 1
1424. && s->session->tlsext_hostname != NULL) {
1425. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_server_name)
^
1426. || !WPACKET_put_bytes_u16(pkt, 0)) {
1427. SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR);
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/packet.c:250:17: Call
248.
249. if (size > sizeof(unsigned int)
250. || !WPACKET_allocate_bytes(pkt, size, &data)
^
251. || !put_value(data, val, size))
252. 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 + s->s3->previous_server_finished_len + pkt->written + 9]):unsigned64 by call to `WPACKET_put_bytes__`
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/7507e73d409b8f3046d6efcc3f4c0b6208b59b64/ssl/packet.c/#L25
|
d2a_code_trace_data_42610
|
static void do_video_stats(AVFormatContext *os, AVOutputStream *ost,
int frame_size)
{
AVCodecContext *enc;
int frame_number;
double ti1, bitrate, avg_bitrate;
if (!vstats_file) {
vstats_file = fopen(vstats_filename, "w");
if (!vstats_file) {
perror("fopen");
av_exit(1);
}
}
enc = ost->st->codec;
if (enc->codec_type == CODEC_TYPE_VIDEO) {
frame_number = ost->frame_number;
fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA);
if (enc->flags&CODEC_FLAG_PSNR)
fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0]/(enc->width*enc->height*255.0*255.0)));
fprintf(vstats_file,"f_size= %6d ", frame_size);
ti1 = ost->sync_opts * av_q2d(enc->time_base);
if (ti1 < 0.01)
ti1 = 0.01;
bitrate = (frame_size * 8) / av_q2d(enc->time_base) / 1000.0;
avg_bitrate = (double)(video_size * 8) / ti1 / 1000.0;
fprintf(vstats_file, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ",
(double)video_size / 1024, ti1, bitrate, avg_bitrate);
fprintf(vstats_file,"type= %c\n", av_get_pict_type_char(enc->coded_frame->pict_type));
}
}
ffmpeg.c:1027: error: Null Dereference
pointer `vstats_file` last assigned on line 1017 could be null and is dereferenced by call to `fprintf()` at line 1027, column 9.
ffmpeg.c:1008:1: start of procedure do_video_stats()
1006. }
1007.
1008. static void do_video_stats(AVFormatContext *os, AVOutputStream *ost,
^
1009. int frame_size)
1010. {
ffmpeg.c:1016:10: Taking true branch
1014.
1015. /* this is executed just the first time do_video_stats is called */
1016. if (!vstats_file) {
^
1017. vstats_file = fopen(vstats_filename, "w");
1018. if (!vstats_file) {
ffmpeg.c:1017:9:
1015. /* this is executed just the first time do_video_stats is called */
1016. if (!vstats_file) {
1017. vstats_file = fopen(vstats_filename, "w");
^
1018. if (!vstats_file) {
1019. perror("fopen");
ffmpeg.c:1018:14: Taking true branch
1016. if (!vstats_file) {
1017. vstats_file = fopen(vstats_filename, "w");
1018. if (!vstats_file) {
^
1019. perror("fopen");
1020. av_exit(1);
ffmpeg.c:1019:13:
1017. vstats_file = fopen(vstats_filename, "w");
1018. if (!vstats_file) {
1019. perror("fopen");
^
1020. av_exit(1);
1021. }
ffmpeg.c:1020:13: Skipping av_exit(): empty list of specs
1018. if (!vstats_file) {
1019. perror("fopen");
1020. av_exit(1);
^
1021. }
1022. }
ffmpeg.c:1024:5:
1022. }
1023.
1024. enc = ost->st->codec;
^
1025. if (enc->codec_type == CODEC_TYPE_VIDEO) {
1026. frame_number = ost->frame_number;
ffmpeg.c:1025:9: Taking true branch
1023.
1024. enc = ost->st->codec;
1025. if (enc->codec_type == CODEC_TYPE_VIDEO) {
^
1026. frame_number = ost->frame_number;
1027. fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA);
ffmpeg.c:1026:9:
1024. enc = ost->st->codec;
1025. if (enc->codec_type == CODEC_TYPE_VIDEO) {
1026. frame_number = ost->frame_number;
^
1027. fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA);
1028. if (enc->flags&CODEC_FLAG_PSNR)
ffmpeg.c:1027:9:
1025. if (enc->codec_type == CODEC_TYPE_VIDEO) {
1026. frame_number = ost->frame_number;
1027. fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA);
^
1028. if (enc->flags&CODEC_FLAG_PSNR)
1029. fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0]/(enc->width*enc->height*255.0*255.0)));
|
https://github.com/libav/libav/blob/9aaa2077e5879b153d2ce6bea2e42f0c349a083f/ffmpeg.c/#L1027
|
d2a_code_trace_data_42611
|
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/srp/srp_vfy.c:622: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_bin2bn`.
Showing all 14 steps of the trace
crypto/srp/srp_vfy.c:616:22: Call
614. if ((len = t_fromb64(tmp, sizeof(tmp), N)) <= 0)
615. goto err;
616. N_bn_alloc = BN_bin2bn(tmp, len, NULL);
^
617. if (N_bn_alloc == NULL)
618. goto err;
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/srp/srp_vfy.c:622:22: Call
620. if ((len = t_fromb64(tmp, sizeof(tmp) ,g)) <= 0)
621. goto err;
622. g_bn_alloc = BN_bin2bn(tmp, len, NULL);
^
623. if (g_bn_alloc == NULL)
624. goto err;
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/ea09abc80892920ee5db4de82bed7a193b5896f0/crypto/bn/bn_lib.c/#L232
|
d2a_code_trace_data_42612
|
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/bntest.c:408: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_bntest_rand`.
Showing all 19 steps of the trace
test/bntest.c:406:11: Call
404.
405. /* must be odd for montgomery */
406. if (!(TEST_true(BN_bntest_rand(m, 1024, 0, 1))
^
407. /* Zero exponent */
408. && TEST_true(BN_bntest_rand(a, 1024, 0, 0))))
crypto/bn/bn_rand.c:113:12: Call
111. int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom)
112. {
113. return bnrand(TESTING, rnd, bits, top, bottom, NULL);
^
114. }
115.
crypto/bn/bn_rand.c:23:1: Parameter `rnd->top`
21. } BNRAND_FLAG;
22.
23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom,
24. BN_CTX *ctx)
25. {
test/bntest.c:408:16: Call
406. if (!(TEST_true(BN_bntest_rand(m, 1024, 0, 1))
407. /* Zero exponent */
408. && TEST_true(BN_bntest_rand(a, 1024, 0, 0))))
^
409. goto err;
410. BN_zero(p);
crypto/bn/bn_rand.c:111:1: Parameter `*rnd->d`
109. }
110.
111. > int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom)
112. {
113. return bnrand(TESTING, rnd, bits, top, bottom, NULL);
crypto/bn/bn_rand.c:113:12: Call
111. int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom)
112. {
113. return bnrand(TESTING, rnd, bits, top, bottom, NULL);
^
114. }
115.
crypto/bn/bn_rand.c:23:1: Parameter `*rnd->d`
21. } BNRAND_FLAG;
22.
23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom,
24. BN_CTX *ctx)
25. {
crypto/bn/bn_rand.c:33:9: Call
31. if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY)
32. goto toosmall;
33. BN_zero(rnd);
^
34. return 1;
35. }
crypto/bn/bn_lib.c:361:1: Parameter `*a->d`
359. }
360.
361. > int BN_set_word(BIGNUM *a, BN_ULONG w)
362. {
363. bn_check_top(a);
crypto/bn/bn_lib.c:364:9: Call
362. {
363. bn_check_top(a);
364. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
365. return 0;
366. a->neg = 0;
crypto/bn/bn_lcl.h:660:1: Parameter `*a->d`
658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
659.
660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
661. {
662. if (bits > (INT_MAX - BN_BITS2 + 1))
crypto/bn/bn_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->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_bntest_rand`
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_42613
|
void BF_set_key(BF_KEY *key, int len, const unsigned char *data)
#ifdef OPENSSL_FIPS
{
fips_cipher_abort(BLOWFISH);
private_BF_set_key(key, len, data);
}
void private_BF_set_key(BF_KEY *key, int len, const unsigned char *data)
#endif
{
int i;
BF_LONG *p,ri,in[2];
const unsigned char *d,*end;
memcpy(key,&bf_init,sizeof(BF_KEY));
p=key->P;
if (len > ((BF_ROUNDS+2)*4)) len=(BF_ROUNDS+2)*4;
d=data;
end= &(data[len]);
for (i=0; i<(BF_ROUNDS+2); i++)
{
ri= *(d++);
if (d >= end) d=data;
ri<<=8;
ri|= *(d++);
if (d >= end) d=data;
ri<<=8;
ri|= *(d++);
if (d >= end) d=data;
ri<<=8;
ri|= *(d++);
if (d >= end) d=data;
p[i]^=ri;
}
in[0]=0L;
in[1]=0L;
for (i=0; i<(BF_ROUNDS+2); i+=2)
{
BF_encrypt(in,key);
p[i ]=in[0];
p[i+1]=in[1];
}
p=key->S;
for (i=0; i<4*256; i+=2)
{
BF_encrypt(in,key);
p[i ]=in[0];
p[i+1]=in[1];
}
}
apps/speed.c:1249: error: BUFFER_OVERRUN_L1
Offset: [16, 72] Size: 16 by call to `BF_set_key`.
Showing all 7 steps of the trace
apps/speed.c:425:2: Array declaration
423. CAST_KEY cast_ks;
424. #endif
425. static const unsigned char key16[16]=
^
426. {0x12,0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,
427. 0x34,0x56,0x78,0x9a,0xbc,0xde,0xf0,0x12};
apps/speed.c:1249:2: Call
1247. #endif
1248. #ifndef OPENSSL_NO_BF
1249. BF_set_key(&bf_ks,16,key16);
^
1250. #endif
1251. #ifndef OPENSSL_NO_CAST
crypto/bf/bf_skey.c:66:1: <Offset trace>
64. #include "bf_pi.h"
65.
66. > void BF_set_key(BF_KEY *key, int len, const unsigned char *data)
67. #ifdef OPENSSL_FIPS
68. {
crypto/bf/bf_skey.c:66:1: Parameter `len`
64. #include "bf_pi.h"
65.
66. > void BF_set_key(BF_KEY *key, int len, const unsigned char *data)
67. #ifdef OPENSSL_FIPS
68. {
crypto/bf/bf_skey.c:66:1: <Length trace>
64. #include "bf_pi.h"
65.
66. > void BF_set_key(BF_KEY *key, int len, const unsigned char *data)
67. #ifdef OPENSSL_FIPS
68. {
crypto/bf/bf_skey.c:66:1: Parameter `*data`
64. #include "bf_pi.h"
65.
66. > void BF_set_key(BF_KEY *key, int len, const unsigned char *data)
67. #ifdef OPENSSL_FIPS
68. {
crypto/bf/bf_skey.c:86:2: Array access: Offset: [16, 72] Size: 16 by call to `BF_set_key`
84.
85. d=data;
86. end= &(data[len]);
^
87. for (i=0; i<(BF_ROUNDS+2); i++)
88. {
|
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/bf/bf_skey.c/#L86
|
d2a_code_trace_data_42614
|
int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
const unsigned char *in, int inl)
{
int i, j, bl;
if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
i = ctx->cipher->do_cipher(ctx, out, in, inl);
if (i < 0)
return 0;
else
*outl = i;
return 1;
}
if (inl <= 0) {
*outl = 0;
return inl == 0;
}
if (ctx->buf_len == 0 && (inl & (ctx->block_mask)) == 0) {
if (ctx->cipher->do_cipher(ctx, out, in, inl)) {
*outl = inl;
return 1;
} else {
*outl = 0;
return 0;
}
}
i = ctx->buf_len;
bl = ctx->cipher->block_size;
OPENSSL_assert(bl <= (int)sizeof(ctx->buf));
if (i != 0) {
if (i + inl < bl) {
memcpy(&(ctx->buf[i]), in, inl);
ctx->buf_len += inl;
*outl = 0;
return 1;
} else {
j = bl - i;
memcpy(&(ctx->buf[i]), in, j);
if (!ctx->cipher->do_cipher(ctx, out, ctx->buf, bl))
return 0;
inl -= j;
in += j;
out += bl;
*outl = bl;
}
} else
*outl = 0;
i = inl & (bl - 1);
inl -= i;
if (inl > 0) {
if (!ctx->cipher->do_cipher(ctx, out, in, inl))
return 0;
*outl += inl;
}
if (i != 0)
memcpy(ctx->buf, &(in[inl]), i);
ctx->buf_len = i;
return 1;
}
ssl/statem/statem_srvr.c:3034: error: BUFFER_OVERRUN_L3
Offset added: [1, 65280] Size: [8, 522240] by call to `EVP_EncryptUpdate`.
Showing all 9 steps of the trace
ssl/statem/statem_srvr.c:2941:17: Call
2939.
2940. /* get session encoding length */
2941. slen_full = i2d_SSL_SESSION(s->session, NULL);
^
2942. /*
2943. * Some length values are 16 bits, so forget it if session is too
ssl/ssl_asn1.c:195:9: Assignment
193.
194. if ((in == NULL) || ((in->cipher == NULL) && (in->cipher_id == 0)))
195. return 0;
^
196.
197. memset(&as, 0, sizeof(as));
ssl/statem/statem_srvr.c:2941:5: Assignment
2939.
2940. /* get session encoding length */
2941. slen_full = i2d_SSL_SESSION(s->session, NULL);
^
2942. /*
2943. * Some length values are 16 bits, so forget it if session is too
ssl/statem/statem_srvr.c:3034:10: Call
3032. p += EVP_CIPHER_CTX_iv_length(ctx);
3033. /* Encrypt session data */
3034. if (!EVP_EncryptUpdate(ctx, p, &len, senc, slen))
^
3035. goto err;
3036. p += len;
crypto/evp/evp_enc.c:310:1: <Offset trace>
308. }
309.
310. > int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
311. const unsigned char *in, int inl)
312. {
crypto/evp/evp_enc.c:310:1: Parameter `inl`
308. }
309.
310. > int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
311. const unsigned char *in, int inl)
312. {
crypto/evp/evp_enc.c:310:1: <Length trace>
308. }
309.
310. > int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
311. const unsigned char *in, int inl)
312. {
crypto/evp/evp_enc.c:310:1: Parameter `*in`
308. }
309.
310. > int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
311. const unsigned char *in, int inl)
312. {
crypto/evp/evp_enc.c:343:13: Array access: Offset added: [1, 65280] Size: [8, 522240] by call to `EVP_EncryptUpdate`
341. if (i != 0) {
342. if (i + inl < bl) {
343. memcpy(&(ctx->buf[i]), in, inl);
^
344. ctx->buf_len += inl;
345. *outl = 0;
|
https://github.com/openssl/openssl/blob/846ec07d904f9cc81d486db0db14fb84f61ff6e5/crypto/evp/evp_enc.c/#L343
|
d2a_code_trace_data_42615
|
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_upstream.c:1359: error: Buffer Overrun L2
Offset: [0, 4048] Size: 2048 by call to `ngx_log_error_core`.
src/http/ngx_http_upstream.c:1342:13: Unknown value from: non-const function
1340. for ( ;; ) {
1341.
1342. n = c->recv(c, u->buffer.last, u->buffer.end - u->buffer.last);
^
1343.
1344. if (n == NGX_AGAIN) {
src/http/ngx_http_upstream.c:1359:13: Call
1357.
1358. if (n == 0) {
1359. ngx_log_error(NGX_LOG_ERR, c->log, 0,
^
1360. "upstream prematurely closed connection");
1361. }
src/core/ngx_log.c:67:1: Array declaration
65. #if (NGX_HAVE_VARIADIC_MACROS)
66.
67. void
^
68. ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,
69. const char *fmt, ...)
src/core/ngx_log.c:88:5: Assignment
86. }
87.
88. last = errstr + NGX_MAX_ERROR_STR;
^
89.
90. ngx_memcpy(errstr, ngx_cached_err_log_time.data,
src/core/ngx_log.c:133:13: Call
131. ? " (%d: " : " (%Xd: ", err);
132. #else
133. p = ngx_snprintf(p, last - p, " (%d: ", err);
^
134. #endif
135.
src/core/ngx_string.c:109:1: Parameter `max`
107.
108.
109. u_char * ngx_cdecl
^
110. ngx_snprintf(u_char *buf, size_t max, const char *fmt, ...)
111. {
src/core/ngx_string.c:116:9: Call
114.
115. va_start(args, fmt);
116. p = ngx_vsnprintf(buf, max, fmt, args);
^
117. va_end(args);
118.
src/core/ngx_string.c:123:1: <Length trace>
121.
122.
123. u_char *
^
124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
125. {
src/core/ngx_string.c:123:1: Parameter `*buf`
121.
122.
123. u_char *
^
124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
125. {
src/core/ngx_string.c:244:25: Array access: Offset: [0, 4048] Size: 2048 by call to `ngx_log_error_core`
242. if (slen == (size_t) -1) {
243. while (*p && buf < last) {
244. *buf++ = *p++;
^
245. }
246.
|
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_string.c/#L244
|
d2a_code_trace_data_42616
|
ngx_int_t
ngx_atoi(u_char *line, size_t n)
{
ngx_int_t value, cutoff, cutlim;
if (n == 0) {
return NGX_ERROR;
}
cutoff = NGX_MAX_INT_T_VALUE / 10;
cutlim = NGX_MAX_INT_T_VALUE % 10;
for (value = 0; n--; line++) {
if (*line < '0' || *line > '9') {
return NGX_ERROR;
}
if (value >= cutoff && (value > cutoff || *line - '0' > cutlim)) {
return NGX_ERROR;
}
value = value * 10 + (*line - '0');
}
return value;
}
src/http/ngx_http_file_cache.c:2671: error: Integer Overflow L2
([0, 9223372036854775800] + [0, 9]):signed64 by call to `ngx_atoi`.
src/http/ngx_http_file_cache.c:2665:13: Unknown value from: strcmp
2663. for (i = 1; i < n; i++) {
2664.
2665. if (ngx_strcmp(value[i].data, "any") == 0) {
^
2666.
2667. status = 0;
src/http/ngx_http_file_cache.c:2671:22: Call
2669. } else {
2670.
2671. status = ngx_atoi(value[i].data, value[i].len);
^
2672. if (status < 100 || status > 599) {
2673. ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
src/core/ngx_string.c:926:5: <LHS trace>
924. }
925.
926. cutoff = NGX_MAX_INT_T_VALUE / 10;
^
927. cutlim = NGX_MAX_INT_T_VALUE % 10;
928.
src/core/ngx_string.c:926:5: Assignment
924. }
925.
926. cutoff = NGX_MAX_INT_T_VALUE / 10;
^
927. cutlim = NGX_MAX_INT_T_VALUE % 10;
928.
src/core/ngx_string.c:917:1: <RHS trace>
915.
916.
917. ngx_int_t
^
918. ngx_atoi(u_char *line, size_t n)
919. {
src/core/ngx_string.c:917:1: Parameter `*line`
915.
916.
917. ngx_int_t
^
918. ngx_atoi(u_char *line, size_t n)
919. {
src/core/ngx_string.c:938:9: Binary operation: ([0, 9223372036854775800] + [0, 9]):signed64 by call to `ngx_atoi`
936. }
937.
938. value = value * 10 + (*line - '0');
^
939. }
940.
|
https://github.com/nginx/nginx/blob/1065455289d72b140f9e63a420b531eaae2d4039/src/core/ngx_string.c/#L938
|
d2a_code_trace_data_42617
|
c448_error_t x448_int(uint8_t out[X_PUBLIC_BYTES],
const uint8_t base[X_PUBLIC_BYTES],
const uint8_t scalar[X_PRIVATE_BYTES])
{
gf x1, x2, z2, x3, z3, t1, t2;
int t;
mask_t swap = 0;
mask_t nz;
ignore_result(gf_deserialize(x1, base, 1, 0));
gf_copy(x2, ONE);
gf_copy(z2, ZERO);
gf_copy(x3, x1);
gf_copy(z3, ONE);
for (t = X_PRIVATE_BITS - 1; t >= 0; t--) {
uint8_t sb = scalar[t / 8];
mask_t k_t;
if (t / 8 == 0)
sb &= -(uint8_t)COFACTOR;
else if (t == X_PRIVATE_BITS - 1)
sb = -1;
k_t = (sb >> (t % 8)) & 1;
k_t = 0 - k_t;
swap ^= k_t;
gf_cond_swap(x2, x3, swap);
gf_cond_swap(z2, z3, swap);
swap = k_t;
gf_add_nr(t1, x2, z2);
gf_sub_nr(t2, x2, z2);
gf_sub_nr(z2, x3, z3);
gf_mul(x2, t1, z2);
gf_add_nr(z2, z3, x3);
gf_mul(x3, t2, z2);
gf_sub_nr(z3, x2, x3);
gf_sqr(z2, z3);
gf_mul(z3, x1, z2);
gf_add_nr(z2, x2, x3);
gf_sqr(x3, z2);
gf_sqr(z2, t1);
gf_sqr(t1, t2);
gf_mul(x2, z2, t1);
gf_sub_nr(t2, z2, t1);
gf_mulw(t1, t2, -EDWARDS_D);
gf_add_nr(t1, t1, z2);
gf_mul(z2, t2, t1);
}
gf_cond_swap(x2, x3, swap);
gf_cond_swap(z2, z3, swap);
gf_invert(z2, z2, 0);
gf_mul(x1, x2, z2);
gf_serialize(out, x1, 1);
nz = ~gf_eq(x1, ZERO);
OPENSSL_cleanse(x1, sizeof(x1));
OPENSSL_cleanse(x2, sizeof(x2));
OPENSSL_cleanse(z2, sizeof(z2));
OPENSSL_cleanse(x3, sizeof(x3));
OPENSSL_cleanse(z3, sizeof(z3));
OPENSSL_cleanse(t1, sizeof(t1));
OPENSSL_cleanse(t2, sizeof(t2));
return c448_succeed_if(mask_to_bool(nz));
}
crypto/ec/curve448/curve448.c:428: error: INTEGER_OVERFLOW_L2
(0 - [0, 1]):unsigned32.
Showing all 4 steps of the trace
crypto/ec/curve448/curve448.c:417:10: <RHS trace>
415. gf_copy(z3, ONE);
416.
417. for (t = X_PRIVATE_BITS - 1; t >= 0; t--) {
^
418. uint8_t sb = scalar[t / 8];
419. mask_t k_t;
crypto/ec/curve448/curve448.c:417:10: Assignment
415. gf_copy(z3, ONE);
416.
417. for (t = X_PRIVATE_BITS - 1; t >= 0; t--) {
^
418. uint8_t sb = scalar[t / 8];
419. mask_t k_t;
crypto/ec/curve448/curve448.c:427:9: Assignment
425. sb = -1;
426.
427. k_t = (sb >> (t % 8)) & 1;
^
428. k_t = 0 - k_t; /* set to all 0s or all 1s */
429.
crypto/ec/curve448/curve448.c:428:9: Binary operation: (0 - [0, 1]):unsigned32
426.
427. k_t = (sb >> (t % 8)) & 1;
428. k_t = 0 - k_t; /* set to all 0s or all 1s */
^
429.
430. swap ^= k_t;
|
https://github.com/openssl/openssl/blob/0cdcdacc337005e08a906b2e07d4e44e3ee48138/crypto/ec/curve448/curve448.c/#L428
|
d2a_code_trace_data_42618
|
DECLAREContigPutFunc(put1bitbwtile)
{
uint32** BWmap = img->BWmap;
(void) x; (void) y;
fromskew /= 8;
while (h-- > 0) {
uint32* bw;
UNROLL8(w, bw = BWmap[*pp++], *cp++ = *bw++);
cp += toskew;
pp += fromskew;
}
}
libtiff/tif_getimage.c:1191: error: Integer Overflow L2
([0, `h`] - 1):unsigned32.
libtiff/tif_getimage.c:1185:1: <LHS trace>
1183. * 1-bit bilevel => colormap/RGB
1184. */
1185. DECLAREContigPutFunc(put1bitbwtile)
^
1186. {
1187. uint32** BWmap = img->BWmap;
libtiff/tif_getimage.c:1185:1: Parameter `h`
1183. * 1-bit bilevel => colormap/RGB
1184. */
1185. DECLAREContigPutFunc(put1bitbwtile)
^
1186. {
1187. uint32** BWmap = img->BWmap;
libtiff/tif_getimage.c:1191:12: Binary operation: ([0, h] - 1):unsigned32
1189. (void) x; (void) y;
1190. fromskew /= 8;
1191. while (h-- > 0) {
^
1192. uint32* bw;
1193. UNROLL8(w, bw = BWmap[*pp++], *cp++ = *bw++);
|
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_getimage.c/#L1191
|
d2a_code_trace_data_42619
|
int BN_hex2bn(BIGNUM **bn, const char *a)
{
BIGNUM *ret = NULL;
BN_ULONG l = 0;
int neg = 0, h, m, i, j, k, c;
int num;
if (a == NULL || *a == '\0')
return 0;
if (*a == '-') {
neg = 1;
a++;
}
for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++)
continue;
if (i == 0 || i > INT_MAX / 4)
goto err;
num = i + neg;
if (bn == NULL)
return num;
if (*bn == NULL) {
if ((ret = BN_new()) == NULL)
return 0;
} else {
ret = *bn;
BN_zero(ret);
}
if (bn_expand(ret, i * 4) == NULL)
goto err;
j = i;
m = 0;
h = 0;
while (j > 0) {
m = (BN_BYTES * 2 <= j) ? BN_BYTES * 2 : j;
l = 0;
for (;;) {
c = a[j - m];
k = OPENSSL_hexchar2int(c);
if (k < 0)
k = 0;
l = (l << 4) | k;
if (--m <= 0) {
ret->d[h++] = l;
break;
}
}
j -= BN_BYTES * 2;
}
ret->top = h;
bn_correct_top(ret);
*bn = ret;
bn_check_top(ret);
if (ret->top != 0)
ret->neg = neg;
return num;
err:
if (*bn == NULL)
BN_free(ret);
return 0;
}
test/params_test.c:508: error: BUFFER_OVERRUN_L2
Offset: [-15, 536870911] (⇐ [0, 1] + [-15, 536870910]) Size: 9 by call to `BN_hex2bn`.
Showing all 7 steps of the trace
test/params_test.c:508:10: Call
506. verify_p3 = NULL;
507.
508. if (!TEST_true(BN_hex2bn(&verify_p3, app_p3_init))) {
^
509. errcnt++;
510. goto fin;
crypto/bn/bn_print.c:141:10: <Offset trace>
139. }
140.
141. for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++)
^
142. continue;
143.
crypto/bn/bn_print.c:141:10: Assignment
139. }
140.
141. for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++)
^
142. continue;
143.
crypto/bn/bn_print.c:164:5: Assignment
162. goto err;
163.
164. j = i; /* least significant 'hex' */
^
165. m = 0;
166. h = 0;
crypto/bn/bn_print.c:126:1: <Length trace>
124. }
125.
126. > int BN_hex2bn(BIGNUM **bn, const char *a)
127. {
128. BIGNUM *ret = NULL;
crypto/bn/bn_print.c:126:1: Parameter `*a`
124. }
125.
126. > int BN_hex2bn(BIGNUM **bn, const char *a)
127. {
128. BIGNUM *ret = NULL;
crypto/bn/bn_print.c:171:17: Array access: Offset: [-15, 536870911] (⇐ [0, 1] + [-15, 536870910]) Size: 9 by call to `BN_hex2bn`
169. l = 0;
170. for (;;) {
171. c = a[j - m];
^
172. k = OPENSSL_hexchar2int(c);
173. if (k < 0)
|
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_print.c/#L171
|
d2a_code_trace_data_42620
|
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:952: error: Buffer Overrun L2
Offset: [0, 17] Size: 16.
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: Array declaration
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:952:37: Array access: Offset: [0, 17] Size: 16
950. for (k = 0; k < run; k++) {
951. tmp[k][0] = samples[k];
952. tmp[k][1] = (sign_bits[(j + k) / 8]) ? -samples[k] : samples[k];
^
953. }
954. for (chs = 0; chs < q->nb_channels; chs++)
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/qdm2.c/#L952
|
d2a_code_trace_data_42621
|
static void decode_const_block_data(ALSDecContext *ctx, ALSBlockData *bd)
{
int smp = bd->block_length - 1;
int32_t val = *bd->raw_samples;
int32_t *dst = bd->raw_samples + 1;
for (; smp; smp--)
*dst++ = val;
}
libavcodec/alsdec.c:1125: error: Integer Overflow L2
([0, +oo] - 1):unsigned32 by call to `read_decode_block`.
libavcodec/alsdec.c:1083:28: Assignment
1081. unsigned int b;
1082. int ret;
1083. ALSBlockData bd[2] = { { 0 } };
^
1084.
1085. bd[0].ra_block = ra_frame;
libavcodec/alsdec.c:1125:20: Call
1123.
1124. if ((ret = read_decode_block(ctx, &bd[0])) < 0 ||
1125. (ret = read_decode_block(ctx, &bd[1])) < 0)
^
1126. goto fail;
1127.
libavcodec/alsdec.c:1006:1: Parameter `bd->block_length`
1004. /** Read and decode block data successively.
1005. */
1006. static int read_decode_block(ALSDecContext *ctx, ALSBlockData *bd)
^
1007. {
1008. int ret;
libavcodec/alsdec.c:1013:12: Call
1011. return ret;
1012.
1013. return decode_block(ctx, bd);
^
1014. }
1015.
libavcodec/alsdec.c:980:1: Parameter `bd->block_length`
978. /** Decode the block data.
979. */
980. static int decode_block(ALSDecContext *ctx, ALSBlockData *bd)
^
981. {
982. unsigned int smp;
libavcodec/alsdec.c:987:9: Call
985. // read block type flag and read the samples accordingly
986. if (*bd->const_block)
987. decode_const_block_data(ctx, bd);
^
988. else
989. ret = decode_var_block_data(ctx, bd); // always return 0
libavcodec/alsdec.c:577:1: <LHS trace>
575. /** Decode the block data for a constant block
576. */
577. static void decode_const_block_data(ALSDecContext *ctx, ALSBlockData *bd)
^
578. {
579. int smp = bd->block_length - 1;
libavcodec/alsdec.c:577:1: Parameter `bd->block_length`
575. /** Decode the block data for a constant block
576. */
577. static void decode_const_block_data(ALSDecContext *ctx, ALSBlockData *bd)
^
578. {
579. int smp = bd->block_length - 1;
libavcodec/alsdec.c:579:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `read_decode_block`
577. static void decode_const_block_data(ALSDecContext *ctx, ALSBlockData *bd)
578. {
579. int smp = bd->block_length - 1;
^
580. int32_t val = *bd->raw_samples;
581. int32_t *dst = bd->raw_samples + 1;
|
https://github.com/libav/libav/blob/582963a8156522582e55466be4a59974a8d909a5/libavcodec/alsdec.c/#L579
|
d2a_code_trace_data_42622
|
int ssl3_get_record(SSL *s)
{
int enc_err, rret;
int i;
size_t more, n;
SSL3_RECORD *rr, *thisrr;
SSL3_BUFFER *rbuf;
SSL_SESSION *sess;
unsigned char *p;
unsigned char md[EVP_MAX_MD_SIZE];
unsigned int version;
size_t mac_size;
int imac_size;
size_t num_recs = 0, max_recs, j;
PACKET pkt, sslv2pkt;
size_t first_rec_len;
rr = RECORD_LAYER_get_rrec(&s->rlayer);
rbuf = RECORD_LAYER_get_rbuf(&s->rlayer);
max_recs = s->max_pipelines;
if (max_recs == 0)
max_recs = 1;
sess = s->session;
do {
thisrr = &rr[num_recs];
if ((RECORD_LAYER_get_rstate(&s->rlayer) != SSL_ST_READ_BODY) ||
(RECORD_LAYER_get_packet_length(&s->rlayer)
< SSL3_RT_HEADER_LENGTH)) {
size_t sslv2len;
unsigned int type;
rret = ssl3_read_n(s, SSL3_RT_HEADER_LENGTH,
SSL3_BUFFER_get_len(rbuf), 0,
num_recs == 0 ? 1 : 0, &n);
if (rret <= 0)
return rret;
RECORD_LAYER_set_rstate(&s->rlayer, SSL_ST_READ_BODY);
p = RECORD_LAYER_get_packet(&s->rlayer);
if (!PACKET_buf_init(&pkt, RECORD_LAYER_get_packet(&s->rlayer),
RECORD_LAYER_get_packet_length(&s->rlayer))) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_GET_RECORD,
ERR_R_INTERNAL_ERROR);
return -1;
}
sslv2pkt = pkt;
if (!PACKET_get_net_2_len(&sslv2pkt, &sslv2len)
|| !PACKET_get_1(&sslv2pkt, &type)) {
SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_SSL3_GET_RECORD,
ERR_R_INTERNAL_ERROR);
return -1;
}
if (s->server && RECORD_LAYER_is_first_record(&s->rlayer)
&& (sslv2len & 0x8000) != 0
&& (type == SSL2_MT_CLIENT_HELLO)) {
thisrr->type = SSL3_RT_HANDSHAKE;
thisrr->rec_version = SSL2_VERSION;
thisrr->length = sslv2len & 0x7fff;
if (thisrr->length > SSL3_BUFFER_get_len(rbuf)
- SSL2_RT_HEADER_LENGTH) {
SSLfatal(s, SSL_AD_RECORD_OVERFLOW, SSL_F_SSL3_GET_RECORD,
SSL_R_PACKET_LENGTH_TOO_LONG);
return -1;
}
if (thisrr->length < MIN_SSL2_RECORD_LEN) {
SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_SSL3_GET_RECORD,
SSL_R_LENGTH_TOO_SHORT);
return -1;
}
} else {
if (s->msg_callback)
s->msg_callback(0, 0, SSL3_RT_HEADER, p, 5, s,
s->msg_callback_arg);
if (!PACKET_get_1(&pkt, &type)
|| !PACKET_get_net_2(&pkt, &version)
|| !PACKET_get_net_2_len(&pkt, &thisrr->length)) {
SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_SSL3_GET_RECORD,
ERR_R_INTERNAL_ERROR);
return -1;
}
thisrr->type = type;
thisrr->rec_version = version;
if (!s->first_packet && !SSL_IS_TLS13(s)
&& !s->hello_retry_request
&& version != (unsigned int)s->version) {
if ((s->version & 0xFF00) == (version & 0xFF00)
&& !s->enc_write_ctx && !s->write_hash) {
if (thisrr->type == SSL3_RT_ALERT) {
SSLfatal(s, SSL_AD_NO_ALERT, SSL_F_SSL3_GET_RECORD,
SSL_R_WRONG_VERSION_NUMBER);
return -1;
}
s->version = (unsigned short)version;
}
SSLfatal(s, SSL_AD_PROTOCOL_VERSION, SSL_F_SSL3_GET_RECORD,
SSL_R_WRONG_VERSION_NUMBER);
return -1;
}
if ((version >> 8) != SSL3_VERSION_MAJOR) {
if (RECORD_LAYER_is_first_record(&s->rlayer)) {
p = RECORD_LAYER_get_packet(&s->rlayer);
if (strncmp((char *)p, "GET ", 4) == 0 ||
strncmp((char *)p, "POST ", 5) == 0 ||
strncmp((char *)p, "HEAD ", 5) == 0 ||
strncmp((char *)p, "PUT ", 4) == 0) {
SSLfatal(s, SSL_AD_NO_ALERT, SSL_F_SSL3_GET_RECORD,
SSL_R_HTTP_REQUEST);
return -1;
} else if (strncmp((char *)p, "CONNE", 5) == 0) {
SSLfatal(s, SSL_AD_NO_ALERT, SSL_F_SSL3_GET_RECORD,
SSL_R_HTTPS_PROXY_REQUEST);
return -1;
}
SSLfatal(s, SSL_AD_NO_ALERT, SSL_F_SSL3_GET_RECORD,
SSL_R_WRONG_VERSION_NUMBER);
return -1;
} else {
SSLfatal(s, SSL_AD_PROTOCOL_VERSION,
SSL_F_SSL3_GET_RECORD,
SSL_R_WRONG_VERSION_NUMBER);
return -1;
}
}
if (SSL_IS_TLS13(s) && s->enc_read_ctx != NULL
&& thisrr->type != SSL3_RT_APPLICATION_DATA) {
SSLfatal(s, SSL_AD_UNEXPECTED_MESSAGE,
SSL_F_SSL3_GET_RECORD, SSL_R_BAD_RECORD_TYPE);
return -1;
}
if (thisrr->length >
SSL3_BUFFER_get_len(rbuf) - SSL3_RT_HEADER_LENGTH) {
SSLfatal(s, SSL_AD_RECORD_OVERFLOW, SSL_F_SSL3_GET_RECORD,
SSL_R_PACKET_LENGTH_TOO_LONG);
return -1;
}
}
}
if (SSL_IS_TLS13(s)) {
if (thisrr->length > SSL3_RT_MAX_TLS13_ENCRYPTED_LENGTH) {
SSLfatal(s, SSL_AD_RECORD_OVERFLOW, SSL_F_SSL3_GET_RECORD,
SSL_R_ENCRYPTED_LENGTH_TOO_LONG);
return -1;
}
} else {
size_t len = SSL3_RT_MAX_ENCRYPTED_LENGTH;
#ifndef OPENSSL_NO_COMP
if (s->expand == NULL)
len -= SSL3_RT_MAX_COMPRESSED_OVERHEAD;
#endif
if (thisrr->length > len) {
SSLfatal(s, SSL_AD_RECORD_OVERFLOW, SSL_F_SSL3_GET_RECORD,
SSL_R_ENCRYPTED_LENGTH_TOO_LONG);
return -1;
}
}
if (thisrr->rec_version == SSL2_VERSION) {
more = thisrr->length + SSL2_RT_HEADER_LENGTH
- SSL3_RT_HEADER_LENGTH;
} else {
more = thisrr->length;
}
if (more > 0) {
rret = ssl3_read_n(s, more, more, 1, 0, &n);
if (rret <= 0)
return rret;
}
RECORD_LAYER_set_rstate(&s->rlayer, SSL_ST_READ_HEADER);
if (thisrr->rec_version == SSL2_VERSION) {
thisrr->input =
&(RECORD_LAYER_get_packet(&s->rlayer)[SSL2_RT_HEADER_LENGTH]);
} else {
thisrr->input =
&(RECORD_LAYER_get_packet(&s->rlayer)[SSL3_RT_HEADER_LENGTH]);
}
thisrr->data = thisrr->input;
thisrr->orig_len = thisrr->length;
thisrr->read = 0;
num_recs++;
RECORD_LAYER_reset_packet_length(&s->rlayer);
RECORD_LAYER_clear_first_record(&s->rlayer);
} while (num_recs < max_recs
&& thisrr->type == SSL3_RT_APPLICATION_DATA
&& SSL_USE_EXPLICIT_IV(s)
&& s->enc_read_ctx != NULL
&& (EVP_CIPHER_flags(EVP_CIPHER_CTX_cipher(s->enc_read_ctx))
& EVP_CIPH_FLAG_PIPELINE)
&& ssl3_record_app_data_waiting(s));
if (SSL_READ_ETM(s) && s->read_hash) {
unsigned char *mac;
imac_size = EVP_MD_CTX_size(s->read_hash);
if (!ossl_assert(imac_size >= 0 && imac_size <= EVP_MAX_MD_SIZE)) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_GET_RECORD,
ERR_LIB_EVP);
return -1;
}
mac_size = (size_t)imac_size;
for (j = 0; j < num_recs; j++) {
thisrr = &rr[j];
if (thisrr->length < mac_size) {
SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_SSL3_GET_RECORD,
SSL_R_LENGTH_TOO_SHORT);
return -1;
}
thisrr->length -= mac_size;
mac = thisrr->data + thisrr->length;
i = s->method->ssl3_enc->mac(s, thisrr, md, 0 );
if (i == 0 || CRYPTO_memcmp(md, mac, mac_size) != 0) {
SSLfatal(s, SSL_AD_BAD_RECORD_MAC, SSL_F_SSL3_GET_RECORD,
SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC);
return -1;
}
}
}
first_rec_len = rr[0].length;
enc_err = s->method->ssl3_enc->enc(s, rr, num_recs, 0);
if (enc_err == 0) {
if (ossl_statem_in_error(s)) {
return -1;
}
if (num_recs == 1 && ossl_statem_skip_early_data(s)) {
thisrr = &rr[0];
if (!early_data_count_ok(s, thisrr->length,
EARLY_DATA_CIPHERTEXT_OVERHEAD, 0)) {
return -1;
}
thisrr->length = 0;
thisrr->read = 1;
RECORD_LAYER_set_numrpipes(&s->rlayer, 1);
RECORD_LAYER_reset_read_sequence(&s->rlayer);
return 1;
}
SSLfatal(s, SSL_AD_DECRYPTION_FAILED, SSL_F_SSL3_GET_RECORD,
SSL_R_BLOCK_CIPHER_PAD_IS_WRONG);
return -1;
}
#ifdef SSL_DEBUG
printf("dec %"OSSLzu"\n", rr[0].length);
{
size_t z;
for (z = 0; z < rr[0].length; z++)
printf("%02X%c", rr[0].data[z], ((z + 1) % 16) ? ' ' : '\n');
}
printf("\n");
#endif
if ((sess != NULL) &&
(s->enc_read_ctx != NULL) &&
(!SSL_READ_ETM(s) && EVP_MD_CTX_md(s->read_hash) != NULL)) {
unsigned char *mac = NULL;
unsigned char mac_tmp[EVP_MAX_MD_SIZE];
mac_size = EVP_MD_CTX_size(s->read_hash);
if (!ossl_assert(mac_size <= EVP_MAX_MD_SIZE)) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_GET_RECORD,
ERR_R_INTERNAL_ERROR);
return -1;
}
for (j = 0; j < num_recs; j++) {
thisrr = &rr[j];
if (thisrr->orig_len < mac_size ||
(EVP_CIPHER_CTX_mode(s->enc_read_ctx) == EVP_CIPH_CBC_MODE &&
thisrr->orig_len < mac_size + 1)) {
SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_SSL3_GET_RECORD,
SSL_R_LENGTH_TOO_SHORT);
return -1;
}
if (EVP_CIPHER_CTX_mode(s->enc_read_ctx) == EVP_CIPH_CBC_MODE) {
mac = mac_tmp;
if (!ssl3_cbc_copy_mac(mac_tmp, thisrr, mac_size)) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL3_GET_RECORD,
ERR_R_INTERNAL_ERROR);
return -1;
}
thisrr->length -= mac_size;
} else {
thisrr->length -= mac_size;
mac = &thisrr->data[thisrr->length];
}
i = s->method->ssl3_enc->mac(s, thisrr, md, 0 );
if (i == 0 || mac == NULL
|| CRYPTO_memcmp(md, mac, (size_t)mac_size) != 0)
enc_err = -1;
if (thisrr->length > SSL3_RT_MAX_COMPRESSED_LENGTH + mac_size)
enc_err = -1;
}
}
if (enc_err < 0) {
if (ossl_statem_in_error(s)) {
return -1;
}
if (num_recs == 1 && ossl_statem_skip_early_data(s)) {
if (!early_data_count_ok(s, first_rec_len,
EARLY_DATA_CIPHERTEXT_OVERHEAD, 0)) {
return -1;
}
thisrr = &rr[0];
thisrr->length = 0;
thisrr->read = 1;
RECORD_LAYER_set_numrpipes(&s->rlayer, 1);
RECORD_LAYER_reset_read_sequence(&s->rlayer);
return 1;
}
SSLfatal(s, SSL_AD_BAD_RECORD_MAC, SSL_F_SSL3_GET_RECORD,
SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC);
return -1;
}
for (j = 0; j < num_recs; j++) {
thisrr = &rr[j];
if (s->expand != NULL) {
if (thisrr->length > SSL3_RT_MAX_COMPRESSED_LENGTH) {
SSLfatal(s, SSL_AD_RECORD_OVERFLOW, SSL_F_SSL3_GET_RECORD,
SSL_R_COMPRESSED_LENGTH_TOO_LONG);
return -1;
}
if (!ssl3_do_uncompress(s, thisrr)) {
SSLfatal(s, SSL_AD_DECOMPRESSION_FAILURE, SSL_F_SSL3_GET_RECORD,
SSL_R_BAD_DECOMPRESSION);
return -1;
}
}
if (SSL_IS_TLS13(s) && s->enc_read_ctx != NULL) {
size_t end;
if (thisrr->length == 0
|| thisrr->type != SSL3_RT_APPLICATION_DATA) {
SSLfatal(s, SSL_AD_UNEXPECTED_MESSAGE, SSL_F_SSL3_GET_RECORD,
SSL_R_BAD_RECORD_TYPE);
return -1;
}
for (end = thisrr->length - 1; end > 0 && thisrr->data[end] == 0;
end--)
continue;
thisrr->length = end;
thisrr->type = thisrr->data[end];
if (thisrr->type != SSL3_RT_APPLICATION_DATA
&& thisrr->type != SSL3_RT_ALERT
&& thisrr->type != SSL3_RT_HANDSHAKE) {
SSLfatal(s, SSL_AD_UNEXPECTED_MESSAGE, SSL_F_SSL3_GET_RECORD,
SSL_R_BAD_RECORD_TYPE);
return -1;
}
if (s->msg_callback)
s->msg_callback(0, s->version, SSL3_RT_INNER_CONTENT_TYPE,
&thisrr->data[end], 1, s, s->msg_callback_arg);
}
if (SSL_IS_TLS13(s)
&& (thisrr->type == SSL3_RT_HANDSHAKE
|| thisrr->type == SSL3_RT_ALERT)
&& thisrr->length == 0) {
SSLfatal(s, SSL_AD_UNEXPECTED_MESSAGE, SSL_F_SSL3_GET_RECORD,
SSL_R_BAD_LENGTH);
return -1;
}
if (thisrr->length > SSL3_RT_MAX_PLAIN_LENGTH) {
SSLfatal(s, SSL_AD_RECORD_OVERFLOW, SSL_F_SSL3_GET_RECORD,
SSL_R_DATA_LENGTH_TOO_LONG);
return -1;
}
if (s->session != NULL && USE_MAX_FRAGMENT_LENGTH_EXT(s->session)
&& thisrr->length > GET_MAX_FRAGMENT_LENGTH(s->session)) {
SSLfatal(s, SSL_AD_RECORD_OVERFLOW, SSL_F_SSL3_GET_RECORD,
SSL_R_DATA_LENGTH_TOO_LONG);
return -1;
}
thisrr->off = 0;
if (thisrr->length == 0) {
RECORD_LAYER_inc_empty_record_count(&s->rlayer);
if (RECORD_LAYER_get_empty_record_count(&s->rlayer)
> MAX_EMPTY_RECORDS) {
SSLfatal(s, SSL_AD_UNEXPECTED_MESSAGE, SSL_F_SSL3_GET_RECORD,
SSL_R_RECORD_TOO_SMALL);
return -1;
}
} else {
RECORD_LAYER_reset_empty_record_count(&s->rlayer);
}
}
if (s->early_data_state == SSL_EARLY_DATA_READING) {
thisrr = &rr[0];
if (thisrr->type == SSL3_RT_APPLICATION_DATA
&& !early_data_count_ok(s, thisrr->length, 0, 0)) {
return -1;
}
}
RECORD_LAYER_set_numrpipes(&s->rlayer, num_recs);
return 1;
}
ssl/record/ssl3_record.c:243: error: INTEGER_OVERFLOW_L2
([0, +oo] - 2):unsigned64.
Showing all 4 steps of the trace
ssl/record/ssl3_record.c:202:20: <LHS trace>
200. unsigned int type;
201.
202. rret = ssl3_read_n(s, SSL3_RT_HEADER_LENGTH,
^
203. SSL3_BUFFER_get_len(rbuf), 0,
204. num_recs == 0 ? 1 : 0, &n);
ssl/record/ssl3_record.c:202:20: Call
200. unsigned int type;
201.
202. rret = ssl3_read_n(s, SSL3_RT_HEADER_LENGTH,
^
203. SSL3_BUFFER_get_len(rbuf), 0,
204. num_recs == 0 ? 1 : 0, &n);
ssl/record/rec_layer_s3.c:169:1: Parameter `n`
167. * Return values are as per SSL_read()
168. */
169. > int ssl3_read_n(SSL *s, size_t n, size_t max, int extend, int clearold,
170. size_t *readbytes)
171. {
ssl/record/ssl3_record.c:243:21: Binary operation: ([0, +oo] - 2):unsigned64
241. thisrr->length = sslv2len & 0x7fff;
242.
243. if (thisrr->length > SSL3_BUFFER_get_len(rbuf)
^
244. - SSL2_RT_HEADER_LENGTH) {
245. SSLfatal(s, SSL_AD_RECORD_OVERFLOW, SSL_F_SSL3_GET_RECORD,
|
https://github.com/openssl/openssl/blob/a8ea8018fa187e22fb4989450b550589e20f62c2/ssl/record/ssl3_record.c/#L243
|
d2a_code_trace_data_42623
|
static int flv_read_packet(AVFormatContext *s, AVPacket *pkt)
{
int ret, i, type, size, pts, flags, is_audio, next, pos;
AVStream *st = NULL;
for(;;){
pos = url_ftell(s->pb);
url_fskip(s->pb, 4);
type = get_byte(s->pb);
size = get_be24(s->pb);
pts = get_be24(s->pb);
pts |= get_byte(s->pb) << 24;
if (url_feof(s->pb))
return AVERROR(EIO);
url_fskip(s->pb, 3);
flags = 0;
if(size == 0)
continue;
next= size + url_ftell(s->pb);
if (type == FLV_TAG_TYPE_AUDIO) {
is_audio=1;
flags = get_byte(s->pb);
} else if (type == FLV_TAG_TYPE_VIDEO) {
is_audio=0;
flags = get_byte(s->pb);
} else {
if (type == FLV_TAG_TYPE_META && size > 13+1+4)
flv_read_metabody(s, next);
else
av_log(s, AV_LOG_ERROR, "skipping flv packet: type %d, size %d, flags %d\n", type, size, flags);
url_fseek(s->pb, next, SEEK_SET);
continue;
}
for(i=0;i<s->nb_streams;i++) {
st = s->streams[i];
if (st->id == is_audio)
break;
}
if(i == s->nb_streams){
av_log(NULL, AV_LOG_ERROR, "invalid stream\n");
st= create_stream(s, is_audio);
}
if( (st->discard >= AVDISCARD_NONKEY && !((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY || is_audio))
||(st->discard >= AVDISCARD_BIDIR && ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_DISP_INTER && !is_audio))
|| st->discard >= AVDISCARD_ALL
){
url_fseek(s->pb, next, SEEK_SET);
continue;
}
if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY)
av_add_index_entry(st, pos, pts, size, 0, AVINDEX_KEYFRAME);
break;
}
if(!url_is_streamed(s->pb) && s->duration==AV_NOPTS_VALUE){
int size;
const int pos= url_ftell(s->pb);
const int fsize= url_fsize(s->pb);
url_fseek(s->pb, fsize-4, SEEK_SET);
size= get_be32(s->pb);
url_fseek(s->pb, fsize-3-size, SEEK_SET);
if(size == get_be24(s->pb) + 11){
s->duration= get_be24(s->pb) * (int64_t)AV_TIME_BASE / 1000;
}
url_fseek(s->pb, pos, SEEK_SET);
}
if(is_audio){
if(!st->codec->sample_rate || !st->codec->bits_per_sample || (!st->codec->codec_id && !st->codec->codec_tag)) {
st->codec->channels = (flags & FLV_AUDIO_CHANNEL_MASK) == FLV_STEREO ? 2 : 1;
if((flags & FLV_AUDIO_CODECID_MASK) == FLV_CODECID_NELLYMOSER_8HZ_MONO)
st->codec->sample_rate= 8000;
else
st->codec->sample_rate = (44100 << ((flags & FLV_AUDIO_SAMPLERATE_MASK) >> FLV_AUDIO_SAMPLERATE_OFFSET) >> 3);
st->codec->bits_per_sample = (flags & FLV_AUDIO_SAMPLESIZE_MASK) ? 16 : 8;
flv_set_audio_codec(s, st, flags & FLV_AUDIO_CODECID_MASK);
}
}else{
size -= flv_set_video_codec(s, st, flags & FLV_VIDEO_CODECID_MASK);
}
ret= av_get_packet(s->pb, pkt, size - 1);
if (ret <= 0) {
return AVERROR(EIO);
}
pkt->size = ret;
pkt->pts = pts;
pkt->stream_index = st->index;
if (is_audio || ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY))
pkt->flags |= PKT_FLAG_KEY;
return ret;
}
libavformat/flvdec.c:359: error: Uninitialized Value
The value read from flags was never initialized.
libavformat/flvdec.c:359:43:
357. else
358. st->codec->sample_rate = (44100 << ((flags & FLV_AUDIO_SAMPLERATE_MASK) >> FLV_AUDIO_SAMPLERATE_OFFSET) >> 3);
359. st->codec->bits_per_sample = (flags & FLV_AUDIO_SAMPLESIZE_MASK) ? 16 : 8;
^
360. flv_set_audio_codec(s, st, flags & FLV_AUDIO_CODECID_MASK);
361. }
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/flvdec.c/#L359
|
d2a_code_trace_data_42624
|
int i2o_SCT(const SCT *sct, unsigned char **out)
{
size_t len;
unsigned char *p = NULL;
if (!SCT_is_complete(sct)) {
CTerr(CT_F_I2O_SCT, CT_R_SCT_NOT_SET);
goto err;
}
if (sct->version == SCT_VERSION_V1)
len = 43 + sct->ext_len + 4 + sct->sig_len;
else
len = sct->sct_len;
if (out == NULL)
return len;
if (*out != NULL) {
p = *out;
*out += len;
} else {
p = OPENSSL_malloc(len);
if (p == NULL) {
CTerr(CT_F_I2O_SCT, ERR_R_MALLOC_FAILURE);
goto err;
}
*out = p;
}
if (sct->version == SCT_VERSION_V1) {
*p++ = sct->version;
memcpy(p, sct->log_id, CT_V1_HASHLEN);
p += CT_V1_HASHLEN;
l2n8(sct->timestamp, p);
s2n(sct->ext_len, p);
if (sct->ext_len > 0) {
memcpy(p, sct->ext, sct->ext_len);
p += sct->ext_len;
}
if (i2o_SCT_signature(sct, &p) <= 0)
goto err;
} else {
memcpy(p, sct->sct, len);
}
return len;
err:
OPENSSL_free(p);
return -1;
}
crypto/ct/ct_oct.c:310: error: BUFFER_OVERRUN_S2
Offset added: [43+max(1, `sct->ext_len`), `sct->ext_len` + 43] (⇐ 43 + [max(1, `sct->ext_len`), `sct->ext_len`]) Size: [1, +oo].
Showing all 17 steps of the trace
crypto/ct/ct_oct.c:268:1: <Offset trace>
266. }
267.
268. > int i2o_SCT(const SCT *sct, unsigned char **out)
269. {
270. size_t len;
crypto/ct/ct_oct.c:268:1: Parameter `sct->ext_len`
266. }
267.
268. > int i2o_SCT(const SCT *sct, unsigned char **out)
269. {
270. size_t len;
crypto/ct/ct_oct.c:268:1: <Length trace>
266. }
267.
268. > int i2o_SCT(const SCT *sct, unsigned char **out)
269. {
270. size_t len;
crypto/ct/ct_oct.c:268:1: Parameter `**out`
266. }
267.
268. > int i2o_SCT(const SCT *sct, unsigned char **out)
269. {
270. size_t len;
crypto/ct/ct_oct.c:292:9: Assignment
290.
291. if (*out != NULL) {
292. p = *out;
^
293. *out += len;
294. } else {
crypto/ct/ct_oct.c:304:10: Assignment
302.
303. if (sct->version == SCT_VERSION_V1) {
304. *p++ = sct->version;
^
305. memcpy(p, sct->log_id, CT_V1_HASHLEN);
306. p += CT_V1_HASHLEN;
crypto/ct/ct_oct.c:306:9: Assignment
304. *p++ = sct->version;
305. memcpy(p, sct->log_id, CT_V1_HASHLEN);
306. p += CT_V1_HASHLEN;
^
307. l2n8(sct->timestamp, p);
308. s2n(sct->ext_len, p);
crypto/ct/ct_oct.c:307:9: Assignment
305. memcpy(p, sct->log_id, CT_V1_HASHLEN);
306. p += CT_V1_HASHLEN;
307. l2n8(sct->timestamp, p);
^
308. s2n(sct->ext_len, p);
309. if (sct->ext_len > 0) {
crypto/ct/ct_oct.c:307:9: Assignment
305. memcpy(p, sct->log_id, CT_V1_HASHLEN);
306. p += CT_V1_HASHLEN;
307. l2n8(sct->timestamp, p);
^
308. s2n(sct->ext_len, p);
309. if (sct->ext_len > 0) {
crypto/ct/ct_oct.c:307:9: Assignment
305. memcpy(p, sct->log_id, CT_V1_HASHLEN);
306. p += CT_V1_HASHLEN;
307. l2n8(sct->timestamp, p);
^
308. s2n(sct->ext_len, p);
309. if (sct->ext_len > 0) {
crypto/ct/ct_oct.c:307:9: Assignment
305. memcpy(p, sct->log_id, CT_V1_HASHLEN);
306. p += CT_V1_HASHLEN;
307. l2n8(sct->timestamp, p);
^
308. s2n(sct->ext_len, p);
309. if (sct->ext_len > 0) {
crypto/ct/ct_oct.c:307:9: Assignment
305. memcpy(p, sct->log_id, CT_V1_HASHLEN);
306. p += CT_V1_HASHLEN;
307. l2n8(sct->timestamp, p);
^
308. s2n(sct->ext_len, p);
309. if (sct->ext_len > 0) {
crypto/ct/ct_oct.c:307:9: Assignment
305. memcpy(p, sct->log_id, CT_V1_HASHLEN);
306. p += CT_V1_HASHLEN;
307. l2n8(sct->timestamp, p);
^
308. s2n(sct->ext_len, p);
309. if (sct->ext_len > 0) {
crypto/ct/ct_oct.c:307:9: Assignment
305. memcpy(p, sct->log_id, CT_V1_HASHLEN);
306. p += CT_V1_HASHLEN;
307. l2n8(sct->timestamp, p);
^
308. s2n(sct->ext_len, p);
309. if (sct->ext_len > 0) {
crypto/ct/ct_oct.c:307:9: Assignment
305. memcpy(p, sct->log_id, CT_V1_HASHLEN);
306. p += CT_V1_HASHLEN;
307. l2n8(sct->timestamp, p);
^
308. s2n(sct->ext_len, p);
309. if (sct->ext_len > 0) {
crypto/ct/ct_oct.c:308:9: Assignment
306. p += CT_V1_HASHLEN;
307. l2n8(sct->timestamp, p);
308. s2n(sct->ext_len, p);
^
309. if (sct->ext_len > 0) {
310. memcpy(p, sct->ext, sct->ext_len);
crypto/ct/ct_oct.c:310:13: Array access: Offset added: [43+max(1, sct->ext_len), sct->ext_len + 43] (⇐ 43 + [max(1, sct->ext_len), sct->ext_len]) Size: [1, +oo]
308. s2n(sct->ext_len, p);
309. if (sct->ext_len > 0) {
310. memcpy(p, sct->ext, sct->ext_len);
^
311. p += sct->ext_len;
312. }
|
https://github.com/openssl/openssl/blob/0cea8832df37d8fd3e664caec8abbdaa002122b1/crypto/ct/ct_oct.c/#L310
|
d2a_code_trace_data_42625
|
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:114: 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:114:14: Call
112. points[0] = points[1] = P;
113.
114. if (!TEST_true(EC_POINTs_mul(group, R, NULL, 2, points, scalars, ctx))
^
115. || !TEST_true(EC_POINT_dbl(group, S, points[0], ctx))
116. || !TEST_int_eq(0, EC_POINT_cmp(group, R, S, 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_42626
|
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
{
BN_ULONG *a = NULL;
bn_check_top(b);
if (words > (INT_MAX / (4 * BN_BITS2))) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG);
return NULL;
}
if (BN_get_flags(b, BN_FLG_STATIC_DATA)) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
return NULL;
}
if (BN_get_flags(b, BN_FLG_SECURE))
a = OPENSSL_secure_zalloc(words * sizeof(*a));
else
a = OPENSSL_zalloc(words * sizeof(*a));
if (a == NULL) {
BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
return NULL;
}
assert(b->top <= words);
if (b->top > 0)
memcpy(a, b->d, sizeof(*a) * b->top);
return a;
}
test/bntest.c:2143: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_set_word`.
Showing all 22 steps of the trace
test/bntest.c:2143:14: Call
2141.
2142. for (trial = 0; trial <= 1; ++trial) {
2143. if (!TEST_true(BN_set_word(r, primes[i]))
^
2144. || !TEST_int_eq(BN_is_prime_fasttest_ex(r, 1, ctx, trial, NULL),
2145. 1))
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;
test/bntest.c:2143:14: Call
2141.
2142. for (trial = 0; trial <= 1; ++trial) {
2143. if (!TEST_true(BN_set_word(r, primes[i]))
^
2144. || !TEST_int_eq(BN_is_prime_fasttest_ex(r, 1, ctx, trial, NULL),
2145. 1))
crypto/bn/bn_lib.c:360:1: Parameter `a->top`
358. }
359.
360. > int BN_set_word(BIGNUM *a, BN_ULONG w)
361. {
362. bn_check_top(a);
crypto/bn/bn_lib.c:363:9: Call
361. {
362. bn_check_top(a);
363. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
364. return 0;
365. a->neg = 0;
crypto/bn/bn_lcl.h:651:1: Parameter `a->top`
649. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
650.
651. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
652. {
653. if (bits > (INT_MAX - BN_BITS2 + 1))
crypto/bn/bn_lcl.h:659:12: Call
657. return a;
658.
659. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2);
^
660. }
661.
crypto/bn/bn_lib.c:246:1: Parameter `b->top`
244. */
245.
246. > BIGNUM *bn_expand2(BIGNUM *b, int words)
247. {
248. bn_check_top(b);
crypto/bn/bn_lib.c:251:23: Call
249.
250. if (words > b->dmax) {
251. BN_ULONG *a = bn_expand_internal(b, words);
^
252. if (!a)
253. return NULL;
crypto/bn/bn_lib.c:208:1: <Offset trace>
206. /* This is used by bn_expand2() */
207. /* The caller MUST check that words > b->dmax before calling this */
208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
209. {
210. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:208:1: Parameter `b->top`
206. /* This is used by bn_expand2() */
207. /* The caller MUST check that words > b->dmax before calling this */
208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
209. {
210. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:208:1: <Length trace>
206. /* This is used by bn_expand2() */
207. /* The caller MUST check that words > b->dmax before calling this */
208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
209. {
210. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:208:1: Parameter `words`
206. /* This is used by bn_expand2() */
207. /* The caller MUST check that words > b->dmax before calling this */
208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
209. {
210. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:225:13: Call
223. a = OPENSSL_secure_zalloc(words * sizeof(*a));
224. else
225. a = OPENSSL_zalloc(words * sizeof(*a));
^
226. if (a == NULL) {
227. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
crypto/mem.c:228:1: Parameter `num`
226. }
227.
228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:230:17: Call
228. void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
^
231.
232. FAILTEST();
crypto/mem.c:201:9: Assignment
199.
200. if (num == 0)
201. return NULL;
^
202.
203. FAILTEST();
crypto/mem.c:230:5: Assignment
228. void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
^
231.
232. FAILTEST();
crypto/mem.c:235:5: Assignment
233. if (ret != NULL)
234. memset(ret, 0, num);
235. return ret;
^
236. }
237.
crypto/bn/bn_lib.c:225:9: Assignment
223. a = OPENSSL_secure_zalloc(words * sizeof(*a));
224. else
225. a = OPENSSL_zalloc(words * sizeof(*a));
^
226. if (a == NULL) {
227. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
crypto/bn/bn_lib.c:233:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_set_word`
231. assert(b->top <= words);
232. if (b->top > 0)
233. memcpy(a, b->d, sizeof(*a) * b->top);
^
234.
235. return a;
|
https://github.com/openssl/openssl/blob/b48d4397b8ee4256f0b0a115eb99f27ae89995e0/crypto/bn/bn_lib.c/#L233
|
d2a_code_trace_data_42627
|
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:1056: error: Uninitialized Value
The value read from xmax was never initialized.
libavcodec/motion_est_template.c:1056:9:
1054. return dmin;
1055. }
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)
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1056
|
d2a_code_trace_data_42628
|
static void new_data_stream(AVFormatContext *oc, int file_idx)
{
AVStream *st;
AVOutputStream *ost;
AVCodec *codec=NULL;
AVCodecContext *data_enc;
st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
if (!st) {
fprintf(stderr, "Could not alloc stream\n");
ffmpeg_exit(1);
}
ost = new_output_stream(oc, file_idx);
data_enc = st->codec;
output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1);
if (!data_stream_copy) {
fprintf(stderr, "Data stream encoding not supported yet (only streamcopy)\n");
ffmpeg_exit(1);
}
avcodec_get_context_defaults3(st->codec, codec);
data_enc->codec_type = AVMEDIA_TYPE_DATA;
if (data_codec_tag)
data_enc->codec_tag= data_codec_tag;
if (oc->oformat->flags & AVFMT_GLOBALHEADER) {
data_enc->flags |= CODEC_FLAG_GLOBAL_HEADER;
avcodec_opts[AVMEDIA_TYPE_DATA]->flags |= CODEC_FLAG_GLOBAL_HEADER;
}
if (data_stream_copy) {
st->stream_copy = 1;
}
data_disable = 0;
av_freep(&data_codec_name);
data_stream_copy = 0;
}
ffmpeg.c:3596: error: Null Dereference
pointer `st` last assigned on line 3590 could be null and is dereferenced at line 3596, column 16.
ffmpeg.c:3583:1: start of procedure new_data_stream()
3581. }
3582.
3583. static void new_data_stream(AVFormatContext *oc, int file_idx)
^
3584. {
3585. AVStream *st;
ffmpeg.c:3587:5:
3585. AVStream *st;
3586. AVOutputStream *ost;
3587. AVCodec *codec=NULL;
^
3588. AVCodecContext *data_enc;
3589.
ffmpeg.c:3590:28: Condition is true
3588. AVCodecContext *data_enc;
3589.
3590. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
^
3591. if (!st) {
3592. fprintf(stderr, "Could not alloc stream\n");
ffmpeg.c:3590:5:
3588. AVCodecContext *data_enc;
3589.
3590. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
^
3591. if (!st) {
3592. fprintf(stderr, "Could not alloc stream\n");
libavformat/utils.c:2585:1: start of procedure av_new_stream()
2583. }
2584.
2585. AVStream *av_new_stream(AVFormatContext *s, int id)
^
2586. {
2587. AVStream *st;
libavformat/utils.c:2591:9: Taking true branch
2589. AVStream **streams;
2590.
2591. if (s->nb_streams >= INT_MAX/sizeof(*streams))
^
2592. return NULL;
2593. streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams));
libavformat/utils.c:2592:9:
2590.
2591. if (s->nb_streams >= INT_MAX/sizeof(*streams))
2592. return NULL;
^
2593. streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams));
2594. if (!streams)
libavformat/utils.c:2634:1: return from a call to av_new_stream
2632. s->streams[s->nb_streams++] = st;
2633. return st;
2634. }
^
2635.
2636. AVProgram *av_new_program(AVFormatContext *ac, int id)
ffmpeg.c:3591:10: Taking true branch
3589.
3590. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
3591. if (!st) {
^
3592. fprintf(stderr, "Could not alloc stream\n");
3593. ffmpeg_exit(1);
ffmpeg.c:3592:9:
3590. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0);
3591. if (!st) {
3592. fprintf(stderr, "Could not alloc stream\n");
^
3593. ffmpeg_exit(1);
3594. }
ffmpeg.c:3593:9: Skipping ffmpeg_exit(): empty list of specs
3591. if (!st) {
3592. fprintf(stderr, "Could not alloc stream\n");
3593. ffmpeg_exit(1);
^
3594. }
3595. ost = new_output_stream(oc, file_idx);
ffmpeg.c:3595:5: Skipping new_output_stream(): empty list of specs
3593. ffmpeg_exit(1);
3594. }
3595. ost = new_output_stream(oc, file_idx);
^
3596. data_enc = st->codec;
3597. output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1);
ffmpeg.c:3596:5:
3594. }
3595. ost = new_output_stream(oc, file_idx);
3596. data_enc = st->codec;
^
3597. output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1);
3598. if (!data_stream_copy) {
|
https://github.com/libav/libav/blob/b568d6d94bda607e4ebb35be68181a8c2a9f5c50/ffmpeg.c/#L3596
|
d2a_code_trace_data_42629
|
SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username)
{
int i;
SRP_user_pwd *user;
unsigned char digv[SHA_DIGEST_LENGTH];
unsigned char digs[SHA_DIGEST_LENGTH];
EVP_MD_CTX *ctxt = NULL;
if (vb == NULL)
return NULL;
for (i = 0; i < sk_SRP_user_pwd_num(vb->users_pwd); i++) {
user = sk_SRP_user_pwd_value(vb->users_pwd, i);
if (strcmp(user->id, username) == 0)
return user;
}
if ((vb->seed_key == NULL) ||
(vb->default_g == NULL) || (vb->default_N == NULL))
return NULL;
if ((user = SRP_user_pwd_new()) == NULL)
return NULL;
SRP_user_pwd_set_gN(user, vb->default_g, vb->default_N);
if (!SRP_user_pwd_set_ids(user, username, NULL))
goto err;
if (RAND_bytes(digv, SHA_DIGEST_LENGTH) <= 0)
goto err;
ctxt = EVP_MD_CTX_new();
EVP_DigestInit_ex(ctxt, EVP_sha1(), NULL);
EVP_DigestUpdate(ctxt, vb->seed_key, strlen(vb->seed_key));
EVP_DigestUpdate(ctxt, username, strlen(username));
EVP_DigestFinal_ex(ctxt, digs, NULL);
EVP_MD_CTX_free(ctxt);
ctxt = NULL;
if (SRP_user_pwd_set_sv_BN(user,
BN_bin2bn(digs, SHA_DIGEST_LENGTH, NULL),
BN_bin2bn(digv, SHA_DIGEST_LENGTH, NULL)))
return user;
err:
EVP_MD_CTX_free(ctxt);
SRP_user_pwd_free(user);
return NULL;
}
crypto/srp/srp_vfy.c:516: error: MEMORY_LEAK
memory dynamically allocated by call to `SRP_user_pwd_set_ids()` at line 497, column 10 is not reachable after line 516, column 5.
Showing all 89 steps of the trace
crypto/srp/srp_vfy.c:471:1: start of procedure SRP_VBASE_get_by_user()
469. }
470.
471. > SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username)
472. {
473. int i;
crypto/srp/srp_vfy.c:477:5:
475. unsigned char digv[SHA_DIGEST_LENGTH];
476. unsigned char digs[SHA_DIGEST_LENGTH];
477. > EVP_MD_CTX *ctxt = NULL;
478.
479. if (vb == NULL)
crypto/srp/srp_vfy.c:479:9: Taking false branch
477. EVP_MD_CTX *ctxt = NULL;
478.
479. if (vb == NULL)
^
480. return NULL;
481. for (i = 0; i < sk_SRP_user_pwd_num(vb->users_pwd); i++) {
crypto/srp/srp_vfy.c:481:10:
479. if (vb == NULL)
480. return NULL;
481. > for (i = 0; i < sk_SRP_user_pwd_num(vb->users_pwd); i++) {
482. user = sk_SRP_user_pwd_value(vb->users_pwd, i);
483. if (strcmp(user->id, username) == 0)
crypto/srp/srp_vfy.c:481:17:
479. if (vb == NULL)
480. return NULL;
481. > for (i = 0; i < sk_SRP_user_pwd_num(vb->users_pwd); i++) {
482. user = sk_SRP_user_pwd_value(vb->users_pwd, i);
483. if (strcmp(user->id, username) == 0)
include/openssl/srp.h:97:1: start of procedure sk_SRP_user_pwd_num()
95. } SRP_user_pwd;
96.
97. > DEFINE_STACK_OF(SRP_user_pwd)
98.
99. typedef struct SRP_VBASE_st {
crypto/stack/stack.c:317:1: start of procedure sk_num()
315. }
316.
317. > int sk_num(const _STACK *st)
318. {
319. if (st == NULL)
crypto/stack/stack.c:319:9: Taking true branch
317. int sk_num(const _STACK *st)
318. {
319. if (st == NULL)
^
320. return -1;
321. return st->num;
crypto/stack/stack.c:320:9:
318. {
319. if (st == NULL)
320. > return -1;
321. return st->num;
322. }
crypto/stack/stack.c:322:1: return from a call to sk_num
320. return -1;
321. return st->num;
322. > }
323.
324. void *sk_value(const _STACK *st, int i)
include/openssl/srp.h:97:1: return from a call to sk_SRP_user_pwd_num
95. } SRP_user_pwd;
96.
97. > DEFINE_STACK_OF(SRP_user_pwd)
98.
99. typedef struct SRP_VBASE_st {
crypto/srp/srp_vfy.c:481:17: Loop condition is false. Leaving loop
479. if (vb == NULL)
480. return NULL;
481. for (i = 0; i < sk_SRP_user_pwd_num(vb->users_pwd); i++) {
^
482. user = sk_SRP_user_pwd_value(vb->users_pwd, i);
483. if (strcmp(user->id, username) == 0)
crypto/srp/srp_vfy.c:486:10: Taking false branch
484. return user;
485. }
486. if ((vb->seed_key == NULL) ||
^
487. (vb->default_g == NULL) || (vb->default_N == NULL))
488. return NULL;
crypto/srp/srp_vfy.c:487:10: Taking false branch
485. }
486. if ((vb->seed_key == NULL) ||
487. (vb->default_g == NULL) || (vb->default_N == NULL))
^
488. return NULL;
489.
crypto/srp/srp_vfy.c:487:37: Taking false branch
485. }
486. if ((vb->seed_key == NULL) ||
487. (vb->default_g == NULL) || (vb->default_N == NULL))
^
488. return NULL;
489.
crypto/srp/srp_vfy.c:492:9:
490. /* if the user is unknown we set parameters as well if we have a seed_key */
491.
492. > if ((user = SRP_user_pwd_new()) == NULL)
493. return NULL;
494.
crypto/srp/srp_vfy.c:199:1: start of procedure SRP_user_pwd_new()
197. }
198.
199. > static SRP_user_pwd *SRP_user_pwd_new(void)
200. {
201. SRP_user_pwd *ret = OPENSSL_malloc(sizeof(*ret));
crypto/srp/srp_vfy.c:201:5:
199. static SRP_user_pwd *SRP_user_pwd_new(void)
200. {
201. > SRP_user_pwd *ret = OPENSSL_malloc(sizeof(*ret));
202. if (ret == NULL)
203. return NULL;
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/srp/srp_vfy.c:202:9: Taking false branch
200. {
201. SRP_user_pwd *ret = OPENSSL_malloc(sizeof(*ret));
202. if (ret == NULL)
^
203. return NULL;
204. ret->N = NULL;
crypto/srp/srp_vfy.c:204:5:
202. if (ret == NULL)
203. return NULL;
204. > ret->N = NULL;
205. ret->g = NULL;
206. ret->s = NULL;
crypto/srp/srp_vfy.c:205:5:
203. return NULL;
204. ret->N = NULL;
205. > ret->g = NULL;
206. ret->s = NULL;
207. ret->v = NULL;
crypto/srp/srp_vfy.c:206:5:
204. ret->N = NULL;
205. ret->g = NULL;
206. > ret->s = NULL;
207. ret->v = NULL;
208. ret->id = NULL;
crypto/srp/srp_vfy.c:207:5:
205. ret->g = NULL;
206. ret->s = NULL;
207. > ret->v = NULL;
208. ret->id = NULL;
209. ret->info = NULL;
crypto/srp/srp_vfy.c:208:5:
206. ret->s = NULL;
207. ret->v = NULL;
208. > ret->id = NULL;
209. ret->info = NULL;
210. return ret;
crypto/srp/srp_vfy.c:209:5:
207. ret->v = NULL;
208. ret->id = NULL;
209. > ret->info = NULL;
210. return ret;
211. }
crypto/srp/srp_vfy.c:210:5:
208. ret->id = NULL;
209. ret->info = NULL;
210. > return ret;
211. }
212.
crypto/srp/srp_vfy.c:211:1: return from a call to SRP_user_pwd_new
209. ret->info = NULL;
210. return ret;
211. > }
212.
213. static void SRP_user_pwd_set_gN(SRP_user_pwd *vinfo, const BIGNUM *g,
crypto/srp/srp_vfy.c:492:9: Taking false branch
490. /* if the user is unknown we set parameters as well if we have a seed_key */
491.
492. if ((user = SRP_user_pwd_new()) == NULL)
^
493. return NULL;
494.
crypto/srp/srp_vfy.c:495:5:
493. return NULL;
494.
495. > SRP_user_pwd_set_gN(user, vb->default_g, vb->default_N);
496.
497. if (!SRP_user_pwd_set_ids(user, username, NULL))
crypto/srp/srp_vfy.c:213:1: start of procedure SRP_user_pwd_set_gN()
211. }
212.
213. > static void SRP_user_pwd_set_gN(SRP_user_pwd *vinfo, const BIGNUM *g,
214. const BIGNUM *N)
215. {
crypto/srp/srp_vfy.c:216:5:
214. const BIGNUM *N)
215. {
216. > vinfo->N = N;
217. vinfo->g = g;
218. }
crypto/srp/srp_vfy.c:217:5:
215. {
216. vinfo->N = N;
217. > vinfo->g = g;
218. }
219.
crypto/srp/srp_vfy.c:218:1: return from a call to SRP_user_pwd_set_gN
216. vinfo->N = N;
217. vinfo->g = g;
218. > }
219.
220. static int SRP_user_pwd_set_ids(SRP_user_pwd *vinfo, const char *id,
crypto/srp/srp_vfy.c:497:10:
495. SRP_user_pwd_set_gN(user, vb->default_g, vb->default_N);
496.
497. > if (!SRP_user_pwd_set_ids(user, username, NULL))
498. goto err;
499.
crypto/srp/srp_vfy.c:220:1: start of procedure SRP_user_pwd_set_ids()
218. }
219.
220. > static int SRP_user_pwd_set_ids(SRP_user_pwd *vinfo, const char *id,
221. const char *info)
222. {
crypto/srp/srp_vfy.c:223:9: Taking true branch
221. const char *info)
222. {
223. if (id != NULL && NULL == (vinfo->id = OPENSSL_strdup(id)))
^
224. return 0;
225. return (info == NULL || NULL != (vinfo->info = OPENSSL_strdup(info)));
crypto/srp/srp_vfy.c:223:23:
221. const char *info)
222. {
223. > if (id != NULL && NULL == (vinfo->id = OPENSSL_strdup(id)))
224. return 0;
225. return (info == NULL || NULL != (vinfo->info = OPENSSL_strdup(info)));
crypto/o_str.c:121:1: start of procedure CRYPTO_strdup()
119. }
120.
121. > char *CRYPTO_strdup(const char *str, const char* file, int line)
122. {
123. char *ret;
crypto/o_str.c:125:9: Taking false branch
123. char *ret;
124.
125. if (str == NULL)
^
126. return NULL;
127. ret = CRYPTO_malloc(strlen(str) + 1, file, line);
crypto/o_str.c:127:5:
125. if (str == NULL)
126. return NULL;
127. > ret = CRYPTO_malloc(strlen(str) + 1, file, line);
128. if (ret != NULL)
129. strcpy(ret, str);
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/o_str.c:128:9: Taking true branch
126. return NULL;
127. ret = CRYPTO_malloc(strlen(str) + 1, file, line);
128. if (ret != NULL)
^
129. strcpy(ret, str);
130. return ret;
crypto/o_str.c:129:9:
127. ret = CRYPTO_malloc(strlen(str) + 1, file, line);
128. if (ret != NULL)
129. > strcpy(ret, str);
130. return ret;
131. }
crypto/o_str.c:130:5:
128. if (ret != NULL)
129. strcpy(ret, str);
130. > return ret;
131. }
132.
crypto/o_str.c:131:1: return from a call to CRYPTO_strdup
129. strcpy(ret, str);
130. return ret;
131. > }
132.
133. char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)
crypto/srp/srp_vfy.c:223:23: Taking false branch
221. const char *info)
222. {
223. if (id != NULL && NULL == (vinfo->id = OPENSSL_strdup(id)))
^
224. return 0;
225. return (info == NULL || NULL != (vinfo->info = OPENSSL_strdup(info)));
crypto/srp/srp_vfy.c:225:13: Condition is true
223. if (id != NULL && NULL == (vinfo->id = OPENSSL_strdup(id)))
224. return 0;
225. return (info == NULL || NULL != (vinfo->info = OPENSSL_strdup(info)));
^
226. }
227.
crypto/srp/srp_vfy.c:225:5:
223. if (id != NULL && NULL == (vinfo->id = OPENSSL_strdup(id)))
224. return 0;
225. > return (info == NULL || NULL != (vinfo->info = OPENSSL_strdup(info)));
226. }
227.
crypto/srp/srp_vfy.c:226:1: return from a call to SRP_user_pwd_set_ids
224. return 0;
225. return (info == NULL || NULL != (vinfo->info = OPENSSL_strdup(info)));
226. > }
227.
228. static int SRP_user_pwd_set_sv(SRP_user_pwd *vinfo, const char *s,
crypto/srp/srp_vfy.c:497:10: Taking false branch
495. SRP_user_pwd_set_gN(user, vb->default_g, vb->default_N);
496.
497. if (!SRP_user_pwd_set_ids(user, username, NULL))
^
498. goto err;
499.
crypto/srp/srp_vfy.c:500:9:
498. goto err;
499.
500. > if (RAND_bytes(digv, SHA_DIGEST_LENGTH) <= 0)
501. goto err;
502. ctxt = EVP_MD_CTX_new();
crypto/rand/rand_lib.c:155:1: start of procedure RAND_bytes()
153. }
154.
155. > int RAND_bytes(unsigned char *buf, int num)
156. {
157. const RAND_METHOD *meth = RAND_get_rand_method();
crypto/rand/rand_lib.c:157:5:
155. int RAND_bytes(unsigned char *buf, int num)
156. {
157. > const RAND_METHOD *meth = RAND_get_rand_method();
158. if (meth && meth->bytes)
159. return meth->bytes(buf, num);
crypto/rand/rand_lib.c:92:1: start of procedure RAND_get_rand_method()
90. }
91.
92. > const RAND_METHOD *RAND_get_rand_method(void)
93. {
94. if (!default_RAND_meth) {
crypto/rand/rand_lib.c:94:10: Taking false branch
92. const RAND_METHOD *RAND_get_rand_method(void)
93. {
94. if (!default_RAND_meth) {
^
95. #ifndef OPENSSL_NO_ENGINE
96. ENGINE *e = ENGINE_get_default_RAND();
crypto/rand/rand_lib.c:110:5:
108. default_RAND_meth = RAND_OpenSSL();
109. }
110. > return default_RAND_meth;
111. }
112.
crypto/rand/rand_lib.c:111:1: return from a call to RAND_get_rand_method
109. }
110. return default_RAND_meth;
111. > }
112.
113. #ifndef OPENSSL_NO_ENGINE
crypto/rand/rand_lib.c:158:9: Taking true branch
156. {
157. const RAND_METHOD *meth = RAND_get_rand_method();
158. if (meth && meth->bytes)
^
159. return meth->bytes(buf, num);
160. return (-1);
crypto/rand/rand_lib.c:158:17: Taking false branch
156. {
157. const RAND_METHOD *meth = RAND_get_rand_method();
158. if (meth && meth->bytes)
^
159. return meth->bytes(buf, num);
160. return (-1);
crypto/rand/rand_lib.c:160:5:
158. if (meth && meth->bytes)
159. return meth->bytes(buf, num);
160. > return (-1);
161. }
162.
crypto/rand/rand_lib.c:161:1: return from a call to RAND_bytes
159. return meth->bytes(buf, num);
160. return (-1);
161. > }
162.
163. #if OPENSSL_API_COMPAT < 0x10100000L
crypto/srp/srp_vfy.c:500:9: Taking true branch
498. goto err;
499.
500. if (RAND_bytes(digv, SHA_DIGEST_LENGTH) <= 0)
^
501. goto err;
502. ctxt = EVP_MD_CTX_new();
crypto/srp/srp_vfy.c:514:2:
512. return user;
513.
514. > err:
515. EVP_MD_CTX_free(ctxt);
516. SRP_user_pwd_free(user);
crypto/srp/srp_vfy.c:515:5:
513.
514. err:
515. > EVP_MD_CTX_free(ctxt);
516. SRP_user_pwd_free(user);
517. return NULL;
crypto/evp/digest.c:158:1: start of procedure EVP_MD_CTX_free()
156. }
157.
158. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
159. {
160. EVP_MD_CTX_reset(ctx);
crypto/evp/digest.c:160:5: Skipping EVP_MD_CTX_reset(): empty list of specs
158. void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
159. {
160. EVP_MD_CTX_reset(ctx);
^
161. OPENSSL_free(ctx);
162. }
crypto/evp/digest.c:161:5:
159. {
160. EVP_MD_CTX_reset(ctx);
161. > OPENSSL_free(ctx);
162. }
163.
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/evp/digest.c:162:1: return from a call to EVP_MD_CTX_free
160. EVP_MD_CTX_reset(ctx);
161. OPENSSL_free(ctx);
162. > }
163.
164. int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
crypto/srp/srp_vfy.c:516:5: Skipping SRP_user_pwd_free(): empty list of specs
514. err:
515. EVP_MD_CTX_free(ctxt);
516. SRP_user_pwd_free(user);
^
517. return NULL;
518. }
|
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/srp/srp_vfy.c/#L516
|
d2a_code_trace_data_42630
|
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
{
BN_ULONG *a = NULL;
bn_check_top(b);
if (words > (INT_MAX / (4 * BN_BITS2))) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG);
return NULL;
}
if (BN_get_flags(b, BN_FLG_STATIC_DATA)) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
return (NULL);
}
if (BN_get_flags(b, BN_FLG_SECURE))
a = OPENSSL_secure_zalloc(words * sizeof(*a));
else
a = OPENSSL_zalloc(words * sizeof(*a));
if (a == NULL) {
BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
return (NULL);
}
assert(b->top <= words);
if (b->top > 0)
memcpy(a, b->d, sizeof(*a) * b->top);
return a;
}
test/ecdsatest.c:113: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_dec2bn`.
Showing all 21 steps of the trace
test/ecdsatest.c:113:10: Call
111. if (!TEST_ptr(tmp = BN_new()))
112. return 0;
113. if (!TEST_true(BN_dec2bn(&tmp, numbers[fbytes_counter]))) {
^
114. BN_free(tmp);
115. return 0;
crypto/bn/bn_print.c:199:1: Parameter `(*bn)->top`
197. }
198.
199. > int BN_dec2bn(BIGNUM **bn, const char *a)
200. {
201. BIGNUM *ret = NULL;
crypto/bn/bn_print.c:232:9: Call
230. } else {
231. ret = *bn;
232. BN_zero(ret);
^
233. }
234.
crypto/bn/bn_lib.c:395:1: Parameter `a->top`
393. }
394.
395. > int BN_set_word(BIGNUM *a, BN_ULONG w)
396. {
397. bn_check_top(a);
crypto/bn/bn_lib.c:398:9: Call
396. {
397. bn_check_top(a);
398. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
399. return (0);
400. a->neg = 0;
crypto/bn/bn_lcl.h:660:1: Parameter `a->top`
658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
659.
660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
661. {
662. if (bits > (INT_MAX - BN_BITS2 + 1))
crypto/bn/bn_lcl.h:668:12: Call
666. return a;
667.
668. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2);
^
669. }
670.
crypto/bn/bn_lib.c:284:1: Parameter `b->top`
282. */
283.
284. > BIGNUM *bn_expand2(BIGNUM *b, int words)
285. {
286. bn_check_top(b);
crypto/bn/bn_lib.c:289:23: Call
287.
288. if (words > b->dmax) {
289. BN_ULONG *a = bn_expand_internal(b, words);
^
290. if (!a)
291. return NULL;
crypto/bn/bn_lib.c:246:1: <Offset trace>
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:246:1: Parameter `b->top`
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:246:1: <Length trace>
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:246:1: Parameter `words`
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:263:13: Call
261. a = OPENSSL_secure_zalloc(words * sizeof(*a));
262. else
263. a = OPENSSL_zalloc(words * sizeof(*a));
^
264. if (a == NULL) {
265. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
crypto/mem.c:186:1: Parameter `num`
184. }
185.
186. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
187. {
188. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:188:17: Call
186. void *CRYPTO_zalloc(size_t num, const char *file, int line)
187. {
188. void *ret = CRYPTO_malloc(num, file, line);
^
189.
190. FAILTEST();
crypto/mem.c:166:9: Assignment
164.
165. if (num == 0)
166. return NULL;
^
167.
168. FAILTEST();
crypto/mem.c:188:5: Assignment
186. void *CRYPTO_zalloc(size_t num, const char *file, int line)
187. {
188. void *ret = CRYPTO_malloc(num, file, line);
^
189.
190. FAILTEST();
crypto/mem.c:193:5: Assignment
191. if (ret != NULL)
192. memset(ret, 0, num);
193. return ret;
^
194. }
195.
crypto/bn/bn_lib.c:263:9: Assignment
261. a = OPENSSL_secure_zalloc(words * sizeof(*a));
262. else
263. a = OPENSSL_zalloc(words * sizeof(*a));
^
264. if (a == NULL) {
265. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
crypto/bn/bn_lib.c:271:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_dec2bn`
269. assert(b->top <= words);
270. if (b->top > 0)
271. memcpy(a, b->d, sizeof(*a) * b->top);
^
272.
273. return a;
|
https://github.com/openssl/openssl/blob/b66411f6cda6970c01283ddde6d8063c57b3b7d9/crypto/bn/bn_lib.c/#L271
|
d2a_code_trace_data_42631
|
void av_close_input_stream(AVFormatContext *s)
{
int i;
AVStream *st;
if (s->iformat->read_close)
s->iformat->read_close(s);
for(i=0;i<s->nb_streams;i++) {
st = s->streams[i];
if (st->parser) {
av_parser_close(st->parser);
av_free_packet(&st->cur_pkt);
}
av_metadata_free(&st->metadata);
av_free(st->index_entries);
av_free(st->codec->extradata);
av_free(st->codec);
#if LIBAVFORMAT_VERSION_INT < (53<<16)
av_free(st->filename);
#endif
av_free(st->priv_data);
av_free(st);
}
for(i=s->nb_programs-1; i>=0; i--) {
#if LIBAVFORMAT_VERSION_INT < (53<<16)
av_freep(&s->programs[i]->provider_name);
av_freep(&s->programs[i]->name);
#endif
av_metadata_free(&s->programs[i]->metadata);
av_freep(&s->programs[i]->stream_index);
av_freep(&s->programs[i]);
}
av_freep(&s->programs);
flush_packet_queue(s);
av_freep(&s->priv_data);
while(s->nb_chapters--) {
#if LIBAVFORMAT_VERSION_INT < (53<<16)
av_free(s->chapters[s->nb_chapters]->title);
#endif
av_metadata_free(&s->chapters[s->nb_chapters]->metadata);
av_free(s->chapters[s->nb_chapters]);
}
av_freep(&s->chapters);
av_metadata_free(&s->metadata);
av_free(s);
}
libavformat/rtpdec_asf.c:108: error: Integer Overflow L2
([0, +oo] - 1):unsigned32 by call to `av_close_input_stream`.
libavformat/rtpdec_asf.c:101:9: Call
99. int len = strlen(p) * 6 / 8;
100. char *buf = av_mallocz(len);
101. av_base64_decode(buf, p, len);
^
102.
103. if (rtp_asf_fix_header(buf, len) < 0)
libavutil/base64.c:45:1: Parameter `out->strlen`
43. };
44.
45. int av_base64_decode(uint8_t *out, const char *in, int out_size)
^
46. {
47. int i, v;
libavformat/rtpdec_asf.c:103:13: Call
101. av_base64_decode(buf, p, len);
102.
103. if (rtp_asf_fix_header(buf, len) < 0)
^
104. av_log(s, AV_LOG_ERROR,
105. "Failed to fix invalid RTSP-MS/ASF min_pktsize\n");
libavformat/rtpdec_asf.c:43:1: Parameter `buf->l`
41. * @return 0 on success, <0 on failure (currently -1).
42. */
43. static int rtp_asf_fix_header(uint8_t *buf, int len)
^
44. {
45. uint8_t *p = buf, *end = buf + len;
libavformat/rtpdec_asf.c:108:13: Call
106. init_packetizer(&pb, buf, len);
107. if (rt->asf_ctx) {
108. av_close_input_stream(rt->asf_ctx);
^
109. rt->asf_ctx = NULL;
110. }
libavformat/utils.c:2444:1: <LHS trace>
2442. }
2443.
2444. void av_close_input_stream(AVFormatContext *s)
^
2445. {
2446. int i;
libavformat/utils.c:2444:1: Parameter `s->nb_programs`
2442. }
2443.
2444. void av_close_input_stream(AVFormatContext *s)
^
2445. {
2446. int i;
libavformat/utils.c:2468:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `av_close_input_stream`
2466. av_free(st);
2467. }
2468. for(i=s->nb_programs-1; i>=0; i--) {
^
2469. #if LIBAVFORMAT_VERSION_INT < (53<<16)
2470. av_freep(&s->programs[i]->provider_name);
|
https://github.com/libav/libav/blob/748db0fcc486417225d4cb45d7d5488a00dcc4e3/libavformat/utils.c/#L2468
|
d2a_code_trace_data_42632
|
static void frame_end(MpegEncContext *s)
{
int i;
if (s->unrestricted_mv &&
s->current_picture.reference &&
!s->intra_only) {
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
int hshift = desc->log2_chroma_w;
int vshift = desc->log2_chroma_h;
s->mpvencdsp.draw_edges(s->current_picture.f->data[0], s->linesize,
s->h_edge_pos, s->v_edge_pos,
EDGE_WIDTH, EDGE_WIDTH,
EDGE_TOP | EDGE_BOTTOM);
s->mpvencdsp.draw_edges(s->current_picture.f->data[1], s->uvlinesize,
s->h_edge_pos >> hshift,
s->v_edge_pos >> vshift,
EDGE_WIDTH >> hshift,
EDGE_WIDTH >> vshift,
EDGE_TOP | EDGE_BOTTOM);
s->mpvencdsp.draw_edges(s->current_picture.f->data[2], s->uvlinesize,
s->h_edge_pos >> hshift,
s->v_edge_pos >> vshift,
EDGE_WIDTH >> hshift,
EDGE_WIDTH >> vshift,
EDGE_TOP | EDGE_BOTTOM);
}
emms_c();
s->last_pict_type = s->pict_type;
s->last_lambda_for [s->pict_type] = s->current_picture_ptr->f->quality;
if (s->pict_type!= AV_PICTURE_TYPE_B)
s->last_non_b_pict_type = s->pict_type;
if (s->encoding) {
for (i = 0; i < MAX_PICTURE_COUNT; i++) {
if (!s->picture[i].reference)
ff_mpeg_unref_picture(s->avctx, &s->picture[i]);
}
}
#if FF_API_CODED_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
av_frame_copy_props(s->avctx->coded_frame, s->current_picture.f);
FF_ENABLE_DEPRECATION_WARNINGS
#endif
#if FF_API_ERROR_FRAME
FF_DISABLE_DEPRECATION_WARNINGS
memcpy(s->current_picture.f->error, s->current_picture.encoding_error,
sizeof(s->current_picture.encoding_error));
FF_ENABLE_DEPRECATION_WARNINGS
#endif
}
libavcodec/mpegvideo_enc.c:1454: error: Null Dereference
pointer `desc` last assigned on line 1453 could be null and is dereferenced at line 1454, column 22.
libavcodec/mpegvideo_enc.c:1446:1: start of procedure frame_end()
1444. }
1445.
1446. static void frame_end(MpegEncContext *s)
^
1447. {
1448. int i;
libavcodec/mpegvideo_enc.c:1450:9: Taking true branch
1448. int i;
1449.
1450. if (s->unrestricted_mv &&
^
1451. s->current_picture.reference &&
1452. !s->intra_only) {
libavcodec/mpegvideo_enc.c:1451:9: Taking true branch
1449.
1450. if (s->unrestricted_mv &&
1451. s->current_picture.reference &&
^
1452. !s->intra_only) {
1453. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
libavcodec/mpegvideo_enc.c:1452:10: Taking true branch
1450. if (s->unrestricted_mv &&
1451. s->current_picture.reference &&
1452. !s->intra_only) {
^
1453. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
1454. int hshift = desc->log2_chroma_w;
libavcodec/mpegvideo_enc.c:1453:9:
1451. s->current_picture.reference &&
1452. !s->intra_only) {
1453. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
^
1454. int hshift = desc->log2_chroma_w;
1455. int vshift = desc->log2_chroma_h;
libavutil/pixdesc.c:1686:1: start of procedure av_pix_fmt_desc_get()
1684. }
1685.
1686. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
^
1687. {
1688. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
libavutil/pixdesc.c:1688:9: Taking false branch
1686. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1687. {
1688. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
^
1689. return NULL;
1690. return &av_pix_fmt_descriptors[pix_fmt];
libavutil/pixdesc.c:1688:24: Taking true branch
1686. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
1687. {
1688. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
^
1689. return NULL;
1690. return &av_pix_fmt_descriptors[pix_fmt];
libavutil/pixdesc.c:1689:9:
1687. {
1688. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB)
1689. return NULL;
^
1690. return &av_pix_fmt_descriptors[pix_fmt];
1691. }
libavutil/pixdesc.c:1691:1: return from a call to av_pix_fmt_desc_get
1689. return NULL;
1690. return &av_pix_fmt_descriptors[pix_fmt];
1691. }
^
1692.
1693. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev)
libavcodec/mpegvideo_enc.c:1454:9:
1452. !s->intra_only) {
1453. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt);
1454. int hshift = desc->log2_chroma_w;
^
1455. int vshift = desc->log2_chroma_h;
1456. s->mpvencdsp.draw_edges(s->current_picture.f->data[0], s->linesize,
|
https://github.com/libav/libav/blob/fe66671bd5f446f8d0a9c70968ba8fe891efe028/libavcodec/mpegvideo_enc.c/#L1454
|
d2a_code_trace_data_42633
|
int ossl_init_thread_start(uint64_t opts)
{
struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
if (locals == NULL)
return 0;
if (opts & OPENSSL_INIT_THREAD_ASYNC) {
#ifdef OPENSSL_INIT_DEBUG
fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "
"marking thread for async\n");
#endif
locals->async = 1;
}
if (opts & OPENSSL_INIT_THREAD_ERR_STATE) {
#ifdef OPENSSL_INIT_DEBUG
fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "
"marking thread for err_state\n");
#endif
locals->err_state = 1;
}
return 1;
}
crypto/init.c:388: error: MEMORY_LEAK
memory dynamically allocated to `locals` by call to `ossl_init_get_thread_local()` at line 375, column 44 is not reachable after line 388, column 9.
Showing all 37 steps of the trace
crypto/init.c:373:1: start of procedure ossl_init_thread_start()
371. }
372.
373. > int ossl_init_thread_start(uint64_t opts)
374. {
375. struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
crypto/init.c:375:5:
373. int ossl_init_thread_start(uint64_t opts)
374. {
375. > struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
376.
377. if (locals == NULL)
crypto/init.c:87:1: start of procedure ossl_init_get_thread_local()
85. }
86.
87. > static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc)
88. {
89. struct thread_local_inits_st *local =
crypto/init.c:89:5:
87. static struct thread_local_inits_st *ossl_init_get_thread_local(int alloc)
88. {
89. > struct thread_local_inits_st *local =
90. CRYPTO_THREAD_get_local(&threadstopkey);
91.
crypto/threads_pthread.c:120:1: start of procedure CRYPTO_THREAD_get_local()
118. }
119.
120. > void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key)
121. {
122. return pthread_getspecific(*key);
crypto/threads_pthread.c:122:5: Skipping pthread_getspecific(): method has no implementation
120. void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key)
121. {
122. return pthread_getspecific(*key);
^
123. }
124.
crypto/threads_pthread.c:123:1: return from a call to CRYPTO_THREAD_get_local
121. {
122. return pthread_getspecific(*key);
123. > }
124.
125. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)
crypto/init.c:92:9: Taking true branch
90. CRYPTO_THREAD_get_local(&threadstopkey);
91.
92. if (local == NULL && alloc) {
^
93. local = OPENSSL_zalloc(sizeof *local);
94. CRYPTO_THREAD_set_local(&threadstopkey, local);
crypto/init.c:92:26: Taking true branch
90. CRYPTO_THREAD_get_local(&threadstopkey);
91.
92. if (local == NULL && alloc) {
^
93. local = OPENSSL_zalloc(sizeof *local);
94. CRYPTO_THREAD_set_local(&threadstopkey, local);
crypto/init.c:93:9:
91.
92. if (local == NULL && alloc) {
93. > local = OPENSSL_zalloc(sizeof *local);
94. CRYPTO_THREAD_set_local(&threadstopkey, local);
95. }
crypto/mem.c:146:1: start of procedure CRYPTO_zalloc()
144. }
145.
146. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
147. {
148. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:148:5:
146. void *CRYPTO_zalloc(size_t num, const char *file, int line)
147. {
148. > void *ret = CRYPTO_malloc(num, file, line);
149.
150. if (ret != NULL)
crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
117. }
118.
119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
120. {
121. void *ret = NULL;
crypto/mem.c:121:5:
119. void *CRYPTO_malloc(size_t num, const char *file, int line)
120. {
121. > void *ret = NULL;
122.
123. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
crypto/mem.c:123:9: Taking false branch
121. void *ret = NULL;
122.
123. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
124. return malloc_impl(num, file, line);
125.
crypto/mem.c:126:9: Taking false branch
124. return malloc_impl(num, file, line);
125.
126. if (num <= 0)
^
127. return NULL;
128.
crypto/mem.c:129:5:
127. return NULL;
128.
129. > allow_customize = 0;
130. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
131. if (call_malloc_debug) {
crypto/mem.c:139:5:
137. }
138. #else
139. > osslargused(file); osslargused(line);
140. ret = malloc(num);
141. #endif
crypto/mem.c:139:24:
137. }
138. #else
139. > osslargused(file); osslargused(line);
140. ret = malloc(num);
141. #endif
crypto/mem.c:140:5:
138. #else
139. osslargused(file); osslargused(line);
140. > ret = malloc(num);
141. #endif
142.
crypto/mem.c:143:5:
141. #endif
142.
143. > return ret;
144. }
145.
crypto/mem.c:144:1: return from a call to CRYPTO_malloc
142.
143. return ret;
144. > }
145.
146. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:150:9: Taking true branch
148. void *ret = CRYPTO_malloc(num, file, line);
149.
150. if (ret != NULL)
^
151. memset(ret, 0, num);
152. return ret;
crypto/mem.c:151:9:
149.
150. if (ret != NULL)
151. > memset(ret, 0, num);
152. return ret;
153. }
crypto/mem.c:152:5:
150. if (ret != NULL)
151. memset(ret, 0, num);
152. > return ret;
153. }
154.
crypto/mem.c:153:1: return from a call to CRYPTO_zalloc
151. memset(ret, 0, num);
152. return ret;
153. > }
154.
155. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/init.c:94:9:
92. if (local == NULL && alloc) {
93. local = OPENSSL_zalloc(sizeof *local);
94. > CRYPTO_THREAD_set_local(&threadstopkey, local);
95. }
96. if (!alloc) {
crypto/threads_pthread.c:125:1: start of procedure CRYPTO_THREAD_set_local()
123. }
124.
125. > int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)
126. {
127. if (pthread_setspecific(*key, val) != 0)
crypto/threads_pthread.c:127:9: Taking true branch
125. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val)
126. {
127. if (pthread_setspecific(*key, val) != 0)
^
128. return 0;
129.
crypto/threads_pthread.c:128:9:
126. {
127. if (pthread_setspecific(*key, val) != 0)
128. > return 0;
129.
130. return 1;
crypto/threads_pthread.c:131:1: return from a call to CRYPTO_THREAD_set_local
129.
130. return 1;
131. > }
132.
133. int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key)
crypto/init.c:96:10: Taking false branch
94. CRYPTO_THREAD_set_local(&threadstopkey, local);
95. }
96. if (!alloc) {
^
97. CRYPTO_THREAD_set_local(&threadstopkey, NULL);
98. }
crypto/init.c:100:5:
98. }
99.
100. > return local;
101. }
102.
crypto/init.c:101:1: return from a call to ossl_init_get_thread_local
99.
100. return local;
101. > }
102.
103. typedef struct ossl_init_stop_st OPENSSL_INIT_STOP;
crypto/init.c:377:9: Taking false branch
375. struct thread_local_inits_st *locals = ossl_init_get_thread_local(1);
376.
377. if (locals == NULL)
^
378. return 0;
379.
crypto/init.c:380:9: Taking false branch
378. return 0;
379.
380. if (opts & OPENSSL_INIT_THREAD_ASYNC) {
^
381. #ifdef OPENSSL_INIT_DEBUG
382. fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "
crypto/init.c:388:9: Taking false branch
386. }
387.
388. if (opts & OPENSSL_INIT_THREAD_ERR_STATE) {
^
389. #ifdef OPENSSL_INIT_DEBUG
390. fprintf(stderr, "OPENSSL_INIT: ossl_init_thread_start: "
|
https://github.com/openssl/openssl/blob/91056e72693b4ee8cb5339d9091871ffc3b6f776/crypto/init.c/#L388
|
d2a_code_trace_data_42634
|
static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom,
BN_CTX *ctx)
{
unsigned char *buf = NULL;
int b, ret = 0, bit, bytes, mask;
OPENSSL_CTX *libctx = bn_get_lib_ctx(ctx);
if (bits == 0) {
if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY)
goto toosmall;
BN_zero(rnd);
return 1;
}
if (bits < 0 || (bits == 1 && top > 0))
goto toosmall;
bytes = (bits + 7) / 8;
bit = (bits - 1) % 8;
mask = 0xff << (bit + 1);
buf = OPENSSL_malloc(bytes);
if (buf == NULL) {
BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE);
goto err;
}
b = flag == NORMAL ? rand_bytes_ex(libctx, buf, bytes)
: rand_priv_bytes_ex(libctx, buf, bytes);
if (b <= 0)
goto err;
if (flag == TESTING) {
int i;
unsigned char c;
for (i = 0; i < bytes; i++) {
if (rand_bytes_ex(libctx, &c, 1) <= 0)
goto err;
if (c >= 128 && i > 0)
buf[i] = buf[i - 1];
else if (c < 42)
buf[i] = 0;
else if (c < 84)
buf[i] = 255;
}
}
if (top >= 0) {
if (top) {
if (bit == 0) {
buf[0] = 1;
buf[1] |= 0x80;
} else {
buf[0] |= (3 << (bit - 1));
}
} else {
buf[0] |= (1 << bit);
}
}
buf[0] &= ~mask;
if (bottom)
buf[bytes - 1] |= 1;
if (!BN_bin2bn(buf, bytes, rnd))
goto err;
ret = 1;
err:
OPENSSL_clear_free(buf, bytes);
bn_check_top(rnd);
return ret;
toosmall:
BNerr(BN_F_BNRAND, BN_R_BITS_TOO_SMALL);
return 0;
}
test/bntest.c:237: error: BUFFER_OVERRUN_L3
Offset: [-1, 518] Size: [1, 519] by call to `BN_bntest_rand`.
Showing all 12 steps of the trace
test/bntest.c:237:19: Call
235. for (i = 0; i < NUM0 + NUM1; i++) {
236. if (i < NUM1) {
237. if (!(TEST_true(BN_bntest_rand(a, 512, 0, 0)))
^
238. && TEST_ptr(BN_copy(b, a))
239. && TEST_int_ne(BN_set_bit(a, i), 0)
crypto/bn/bn_rand.c:111:1: Parameter `bits`
109. }
110.
111. > int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom)
112. {
113. return bnrand(TESTING, rnd, bits, top, bottom, NULL);
crypto/bn/bn_rand.c:113:12: Call
111. int BN_bntest_rand(BIGNUM *rnd, int bits, int top, int bottom)
112. {
113. return bnrand(TESTING, rnd, bits, top, bottom, NULL);
^
114. }
115.
crypto/bn/bn_rand.c:62:14: <Offset trace>
60. unsigned char c;
61.
62. for (i = 0; i < bytes; i++) {
^
63. if (rand_bytes_ex(libctx, &c, 1) <= 0)
64. goto err;
crypto/bn/bn_rand.c:62:14: Assignment
60. unsigned char c;
61.
62. for (i = 0; i < bytes; i++) {
^
63. if (rand_bytes_ex(libctx, &c, 1) <= 0)
64. goto err;
crypto/bn/bn_rand.c:23:1: <Length trace>
21. } BNRAND_FLAG;
22.
23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom,
24. BN_CTX *ctx)
25. {
crypto/bn/bn_rand.c:23:1: Parameter `bits`
21. } BNRAND_FLAG;
22.
23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom,
24. BN_CTX *ctx)
25. {
crypto/bn/bn_rand.c:39:5: Assignment
37. goto toosmall;
38.
39. bytes = (bits + 7) / 8;
^
40. bit = (bits - 1) % 8;
41. mask = 0xff << (bit + 1);
crypto/bn/bn_rand.c:43:11: Call
41. mask = 0xff << (bit + 1);
42.
43. buf = OPENSSL_malloc(bytes);
^
44. if (buf == NULL) {
45. BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE);
crypto/mem.c:201:9: Assignment
199.
200. if (num == 0)
201. return NULL;
^
202.
203. FAILTEST();
crypto/bn/bn_rand.c:43:5: Assignment
41. mask = 0xff << (bit + 1);
42.
43. buf = OPENSSL_malloc(bytes);
^
44. if (buf == NULL) {
45. BNerr(BN_F_BNRAND, ERR_R_MALLOC_FAILURE);
crypto/bn/bn_rand.c:88:9: Array access: Offset: [-1, 518] Size: [1, 519] by call to `BN_bntest_rand`
86. buf[0] &= ~mask;
87. if (bottom) /* set bottom bit if requested */
88. buf[bytes - 1] |= 1;
^
89. if (!BN_bin2bn(buf, bytes, rnd))
90. goto err;
|
https://github.com/openssl/openssl/blob/bd01733fdd9a5a0acdc72cf5c6601d37e8ddd801/crypto/bn/bn_rand.c/#L88
|
d2a_code_trace_data_42635
|
int test_kron(BIO *bp, BN_CTX *ctx)
{
BN_GENCB cb;
BIGNUM *a, *b, *r, *t;
int i;
int legendre, kronecker;
int ret = 0;
a = BN_new();
b = BN_new();
r = BN_new();
t = BN_new();
if (a == NULL || b == NULL || r == NULL || t == NULL)
goto err;
BN_GENCB_set(&cb, genprime_cb, NULL);
if (!BN_generate_prime_ex(b, 512, 0, NULL, NULL, &cb))
goto err;
b->neg = rand_neg();
putc('\n', stderr);
for (i = 0; i < num0; i++) {
if (!BN_bntest_rand(a, 512, 0, 0))
goto err;
a->neg = rand_neg();
if (!BN_copy(t, b))
goto err;
t->neg = 0;
if (!BN_sub_word(t, 1))
goto err;
if (!BN_rshift1(t, t))
goto err;
b->neg = 0;
if (!BN_mod_exp_recp(r, a, t, b, ctx))
goto err;
b->neg = 1;
if (BN_is_word(r, 1))
legendre = 1;
else if (BN_is_zero(r))
legendre = 0;
else {
if (!BN_add_word(r, 1))
goto err;
if (0 != BN_ucmp(r, b)) {
fprintf(stderr, "Legendre symbol computation failed\n");
goto err;
}
legendre = -1;
}
kronecker = BN_kronecker(a, b, ctx);
if (kronecker < -1)
goto err;
if (a->neg && b->neg)
kronecker = -kronecker;
if (legendre != kronecker) {
fprintf(stderr, "legendre != kronecker; a = ");
BN_print_fp(stderr, a);
fprintf(stderr, ", b = ");
BN_print_fp(stderr, b);
fprintf(stderr, "\n");
goto err;
}
putc('.', stderr);
fflush(stderr);
}
putc('\n', stderr);
fflush(stderr);
ret = 1;
err:
BN_free(a);
BN_free(b);
BN_free(r);
BN_free(t);
return ret;
}
test/bntest.c:1734: error: MEMORY_LEAK
memory dynamically allocated by call to `BN_new()` at line 1652, column 9 is not reachable after line 1734, column 5.
Showing all 129 steps of the trace
test/bntest.c:1643:1: start of procedure test_kron()
1641. }
1642.
1643. > int test_kron(BIO *bp, BN_CTX *ctx)
1644. {
1645. BN_GENCB cb;
test/bntest.c:1649:5:
1647. int i;
1648. int legendre, kronecker;
1649. > int ret = 0;
1650.
1651. a = BN_new();
test/bntest.c:1651:5:
1649. int ret = 0;
1650.
1651. > a = BN_new();
1652. b = BN_new();
1653. r = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:1652:5:
1650.
1651. a = BN_new();
1652. > b = BN_new();
1653. r = BN_new();
1654. t = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:1653:5:
1651. a = BN_new();
1652. b = BN_new();
1653. > r = BN_new();
1654. t = BN_new();
1655. if (a == NULL || b == NULL || r == NULL || t == 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)
test/bntest.c:1654:5:
1652. b = BN_new();
1653. r = BN_new();
1654. > t = BN_new();
1655. if (a == NULL || b == NULL || r == NULL || t == NULL)
1656. 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)
test/bntest.c:1655:9: Taking false branch
1653. r = BN_new();
1654. t = BN_new();
1655. if (a == NULL || b == NULL || r == NULL || t == NULL)
^
1656. goto err;
1657.
test/bntest.c:1655:22: Taking false branch
1653. r = BN_new();
1654. t = BN_new();
1655. if (a == NULL || b == NULL || r == NULL || t == NULL)
^
1656. goto err;
1657.
test/bntest.c:1655:35: Taking false branch
1653. r = BN_new();
1654. t = BN_new();
1655. if (a == NULL || b == NULL || r == NULL || t == NULL)
^
1656. goto err;
1657.
test/bntest.c:1655:48: Taking false branch
1653. r = BN_new();
1654. t = BN_new();
1655. if (a == NULL || b == NULL || r == NULL || t == NULL)
^
1656. goto err;
1657.
test/bntest.c:1658:5:
1656. goto err;
1657.
1658. > BN_GENCB_set(&cb, genprime_cb, NULL);
1659.
1660. /*
crypto/bn/bn_lib.c:981:1: start of procedure BN_GENCB_set()
979.
980. /* Populate a BN_GENCB structure with a "new"-style callback */
981. > void BN_GENCB_set(BN_GENCB *gencb, int (*callback) (int, int, BN_GENCB *),
982. void *cb_arg)
983. {
crypto/bn/bn_lib.c:984:5:
982. void *cb_arg)
983. {
984. > BN_GENCB *tmp_gencb = gencb;
985. tmp_gencb->ver = 2;
986. tmp_gencb->arg = cb_arg;
crypto/bn/bn_lib.c:985:5:
983. {
984. BN_GENCB *tmp_gencb = gencb;
985. > tmp_gencb->ver = 2;
986. tmp_gencb->arg = cb_arg;
987. tmp_gencb->cb.cb_2 = callback;
crypto/bn/bn_lib.c:986:5:
984. BN_GENCB *tmp_gencb = gencb;
985. tmp_gencb->ver = 2;
986. > tmp_gencb->arg = cb_arg;
987. tmp_gencb->cb.cb_2 = callback;
988. }
crypto/bn/bn_lib.c:987:5:
985. tmp_gencb->ver = 2;
986. tmp_gencb->arg = cb_arg;
987. > tmp_gencb->cb.cb_2 = callback;
988. }
989.
crypto/bn/bn_lib.c:988:1: return from a call to BN_GENCB_set
986. tmp_gencb->arg = cb_arg;
987. tmp_gencb->cb.cb_2 = callback;
988. > }
989.
990. void *BN_GENCB_get_arg(BN_GENCB *cb)
test/bntest.c:1670:10: Taking true branch
1668. */
1669.
1670. if (!BN_generate_prime_ex(b, 512, 0, NULL, NULL, &cb))
^
1671. goto err;
1672. b->neg = rand_neg();
test/bntest.c:1732:2:
1730. fflush(stderr);
1731. ret = 1;
1732. > err:
1733. BN_free(a);
1734. BN_free(b);
test/bntest.c:1733:5:
1731. ret = 1;
1732. err:
1733. > BN_free(a);
1734. BN_free(b);
1735. BN_free(r);
crypto/bn/bn_lib.c:252:1: start of procedure BN_free()
250. }
251.
252. > void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
crypto/bn/bn_lib.c:254:9: Taking false branch
252. void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
^
255. return;
256. bn_check_top(a);
crypto/bn/bn_lib.c:257:10:
255. return;
256. bn_check_top(a);
257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
963. }
964.
965. > int BN_get_flags(const BIGNUM *b, int n)
966. {
967. return b->flags & n;
crypto/bn/bn_lib.c:967:5:
965. int BN_get_flags(const BIGNUM *b, int n)
966. {
967. > return b->flags & n;
968. }
969.
crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
966. {
967. return b->flags & n;
968. > }
969.
970. /* Populate a BN_GENCB structure with an "old"-style callback */
crypto/bn/bn_lib.c:257:10: Taking false branch
255. return;
256. bn_check_top(a);
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
^
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:259:9: Taking false branch
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
^
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:263:9:
261. else {
262. #if OPENSSL_API_COMPAT < 0x00908000L
263. > a->flags |= BN_FLG_FREE;
264. #endif
265. a->d = NULL;
crypto/bn/bn_lib.c:265:9:
263. a->flags |= BN_FLG_FREE;
264. #endif
265. > a->d = NULL;
266. }
267. }
crypto/bn/bn_lib.c:259:5:
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. > if (a->flags & BN_FLG_MALLOCED)
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:267:1: return from a call to BN_free
265. a->d = NULL;
266. }
267. > }
268.
269. void bn_init(BIGNUM *a)
test/bntest.c:1734:5:
1732. err:
1733. BN_free(a);
1734. > BN_free(b);
1735. BN_free(r);
1736. BN_free(t);
crypto/bn/bn_lib.c:252:1: start of procedure BN_free()
250. }
251.
252. > void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
crypto/bn/bn_lib.c:254:9: Taking false branch
252. void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
^
255. return;
256. bn_check_top(a);
crypto/bn/bn_lib.c:257:10:
255. return;
256. bn_check_top(a);
257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
963. }
964.
965. > int BN_get_flags(const BIGNUM *b, int n)
966. {
967. return b->flags & n;
crypto/bn/bn_lib.c:967:5:
965. int BN_get_flags(const BIGNUM *b, int n)
966. {
967. > return b->flags & n;
968. }
969.
crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
966. {
967. return b->flags & n;
968. > }
969.
970. /* Populate a BN_GENCB structure with an "old"-style callback */
crypto/bn/bn_lib.c:257:10: Taking false branch
255. return;
256. bn_check_top(a);
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
^
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:259:9: Taking false branch
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
^
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:263:9:
261. else {
262. #if OPENSSL_API_COMPAT < 0x00908000L
263. > a->flags |= BN_FLG_FREE;
264. #endif
265. a->d = NULL;
crypto/bn/bn_lib.c:265:9:
263. a->flags |= BN_FLG_FREE;
264. #endif
265. > a->d = NULL;
266. }
267. }
crypto/bn/bn_lib.c:259:5:
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. > if (a->flags & BN_FLG_MALLOCED)
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:267:1: return from a call to BN_free
265. a->d = NULL;
266. }
267. > }
268.
269. void bn_init(BIGNUM *a)
|
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L1734
|
d2a_code_trace_data_42636
|
static enum CodecID find_codec_or_die(const char *name, int type, int encoder)
{
const char *codec_string = encoder ? "encoder" : "decoder";
AVCodec *codec;
if(!name)
return CODEC_ID_NONE;
codec = encoder ?
avcodec_find_encoder_by_name(name) :
avcodec_find_decoder_by_name(name);
if(!codec) {
fprintf(stderr, "Unknown %s '%s'\n", codec_string, name);
av_exit(1);
}
if(codec->type != type) {
fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name);
av_exit(1);
}
return codec->id;
}
ffmpeg.c:2747: error: Null Dereference
pointer `codec` last assigned on line 2740 could be null and is dereferenced at line 2747, column 8.
ffmpeg.c:2733:1: start of procedure find_codec_or_die()
2731. }
2732.
2733. static enum CodecID find_codec_or_die(const char *name, int type, int encoder)
^
2734. {
2735. const char *codec_string = encoder ? "encoder" : "decoder";
ffmpeg.c:2735:32: Condition is true
2733. static enum CodecID find_codec_or_die(const char *name, int type, int encoder)
2734. {
2735. const char *codec_string = encoder ? "encoder" : "decoder";
^
2736. AVCodec *codec;
2737.
ffmpeg.c:2735:5:
2733. static enum CodecID find_codec_or_die(const char *name, int type, int encoder)
2734. {
2735. const char *codec_string = encoder ? "encoder" : "decoder";
^
2736. AVCodec *codec;
2737.
ffmpeg.c:2738:9: Taking false branch
2736. AVCodec *codec;
2737.
2738. if(!name)
^
2739. return CODEC_ID_NONE;
2740. codec = encoder ?
ffmpeg.c:2740:13: Condition is true
2738. if(!name)
2739. return CODEC_ID_NONE;
2740. codec = encoder ?
^
2741. avcodec_find_encoder_by_name(name) :
2742. avcodec_find_decoder_by_name(name);
ffmpeg.c:2740:5:
2738. if(!name)
2739. return CODEC_ID_NONE;
2740. codec = encoder ?
^
2741. avcodec_find_encoder_by_name(name) :
2742. avcodec_find_decoder_by_name(name);
ffmpeg.c:2743:9: Taking true branch
2741. avcodec_find_encoder_by_name(name) :
2742. avcodec_find_decoder_by_name(name);
2743. if(!codec) {
^
2744. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name);
2745. av_exit(1);
ffmpeg.c:2744:9:
2742. avcodec_find_decoder_by_name(name);
2743. if(!codec) {
2744. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name);
^
2745. av_exit(1);
2746. }
ffmpeg.c:2745:9: Skipping av_exit(): empty list of specs
2743. if(!codec) {
2744. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name);
2745. av_exit(1);
^
2746. }
2747. if(codec->type != type) {
ffmpeg.c:2747:8:
2745. av_exit(1);
2746. }
2747. if(codec->type != type) {
^
2748. fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name);
2749. av_exit(1);
|
https://github.com/libav/libav/blob/9aaa2077e5879b153d2ce6bea2e42f0c349a083f/ffmpeg.c/#L2747
|
d2a_code_trace_data_42637
|
static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg,
OPENSSL_LH_DOALL_FUNC func,
OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg)
{
int i;
OPENSSL_LH_NODE *a, *n;
if (lh == NULL)
return;
for (i = lh->num_nodes - 1; i >= 0; i--) {
a = lh->b[i];
while (a != NULL) {
n = a->next;
if (use_arg)
func_arg(a->data, arg);
else
func(a->data);
a = n;
}
}
}
ssl/ssl_lib.c:1002: error: INTEGER_OVERFLOW_L2
([0, max(0, `s->session_ctx->sessions->num_nodes`)] - 1):unsigned32 by call to `SSL_CTX_free`.
Showing all 13 steps of the trace
ssl/ssl_lib.c:962:1: Parameter `s->session_ctx->sessions->num_nodes`
960. }
961.
962. > void SSL_free(SSL *s)
963. {
964. int i;
ssl/ssl_lib.c:1002:5: Call
1000.
1001. OPENSSL_free(s->ext.hostname);
1002. SSL_CTX_free(s->session_ctx);
^
1003. #ifndef OPENSSL_NO_EC
1004. OPENSSL_free(s->ext.ecpointformats);
ssl/ssl_lib.c:2621:1: Parameter `a->sessions->num_nodes`
2619. }
2620.
2621. > void SSL_CTX_free(SSL_CTX *a)
2622. {
2623. int i;
ssl/ssl_lib.c:2647:9: Call
2645. */
2646. if (a->sessions != NULL)
2647. SSL_CTX_flush_sessions(a, 0);
^
2648.
2649. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data);
ssl/ssl_sess.c:1013:1: Parameter `s->sessions->num_nodes`
1011. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM);
1012.
1013. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t)
1014. {
1015. unsigned long i;
ssl/ssl_sess.c:1026:5: Call
1024. i = lh_SSL_SESSION_get_down_load(s->sessions);
1025. lh_SSL_SESSION_set_down_load(s->sessions, 0);
1026. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp);
^
1027. lh_SSL_SESSION_set_down_load(s->sessions, i);
1028. CRYPTO_THREAD_unlock(s->lock);
ssl/ssl_sess.c:1011:1: Parameter `lh->num_nodes`
1009. }
1010.
1011. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM);
1012.
1013. void SSL_CTX_flush_sessions(SSL_CTX *s, long t)
ssl/ssl_sess.c:1011:1: Call
1009. }
1010.
1011. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM);
1012.
1013. void SSL_CTX_flush_sessions(SSL_CTX *s, long t)
crypto/lhash/lhash.c:182:1: Parameter `lh->num_nodes`
180. }
181.
182. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg)
183. {
184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg);
crypto/lhash/lhash.c:184:5: Call
182. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg)
183. {
184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg);
^
185. }
186.
crypto/lhash/lhash.c:150:1: <LHS trace>
148. }
149.
150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg,
151. OPENSSL_LH_DOALL_FUNC func,
152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg)
crypto/lhash/lhash.c:150:1: Parameter `lh->num_nodes`
148. }
149.
150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg,
151. OPENSSL_LH_DOALL_FUNC func,
152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg)
crypto/lhash/lhash.c:164:10: Binary operation: ([0, max(0, s->session_ctx->sessions->num_nodes)] - 1):unsigned32 by call to `SSL_CTX_free`
162. * memory leaks otherwise
163. */
164. for (i = lh->num_nodes - 1; i >= 0; i--) {
^
165. a = lh->b[i];
166. while (a != NULL) {
|
https://github.com/openssl/openssl/blob/d2b53fcdef9e7b482ff1e2d5f305ae798f3d1be2/crypto/lhash/lhash.c/#L164
|
d2a_code_trace_data_42638
|
static int kek_unwrap_key(unsigned char *out, size_t *outlen,
const unsigned char *in, size_t inlen,
EVP_CIPHER_CTX *ctx)
{
size_t blocklen = EVP_CIPHER_CTX_block_size(ctx);
unsigned char *tmp;
int outl, rv = 0;
if (inlen < 2 * blocklen) {
return 0;
}
if (inlen % blocklen) {
return 0;
}
tmp = OPENSSL_malloc(inlen);
if (tmp == NULL)
return 0;
if (!EVP_DecryptUpdate(ctx, tmp + inlen - 2 * blocklen, &outl,
in + inlen - 2 * blocklen, blocklen * 2)
|| !EVP_DecryptUpdate(ctx, tmp, &outl,
tmp + inlen - blocklen, blocklen)
|| !EVP_DecryptUpdate(ctx, tmp, &outl, in, inlen - blocklen)
|| !EVP_DecryptInit_ex(ctx, NULL, NULL, NULL, NULL)
|| !EVP_DecryptUpdate(ctx, tmp, &outl, tmp, inlen))
goto err;
if (((tmp[1] ^ tmp[4]) & (tmp[2] ^ tmp[5]) & (tmp[3] ^ tmp[6])) != 0xff) {
goto err;
}
if (inlen < (size_t)(tmp[0] - 4)) {
goto err;
}
*outlen = (size_t)tmp[0];
memcpy(out, tmp + 4, *outlen);
rv = 1;
err:
OPENSSL_clear_free(tmp, inlen);
return rv;
}
crypto/cms/cms_smime.c:679: error: BUFFER_OVERRUN_L3
Offset added: [4, +oo] (⇐ 4 + [0, +oo]) Size: [1, +oo] by call to `CMS_RecipientInfo_decrypt`.
Showing all 16 steps of the trace
crypto/cms/cms_smime.c:677:28: Call
675. * all.
676. */
677. else if (!cert || !CMS_RecipientInfo_ktri_cert_cmp(ri, cert)) {
^
678. CMS_RecipientInfo_set0_pkey(ri, pk);
679. r = CMS_RecipientInfo_decrypt(cms, ri);
crypto/cms/cms_env.c:313:1: Parameter `ri->d.ktri->rid->d.issuerAndSerialNumber->issuer->length`
311. }
312.
313. > int CMS_RecipientInfo_ktri_cert_cmp(CMS_RecipientInfo *ri, X509 *cert)
314. {
315. if (ri->type != CMS_RECIPINFO_TRANS) {
crypto/cms/cms_smime.c:679:17: Call
677. else if (!cert || !CMS_RecipientInfo_ktri_cert_cmp(ri, cert)) {
678. CMS_RecipientInfo_set0_pkey(ri, pk);
679. r = CMS_RecipientInfo_decrypt(cms, ri);
^
680. CMS_RecipientInfo_set0_pkey(ri, NULL);
681. if (cert) {
crypto/cms/cms_env.c:782:1: Parameter `ri->d.pwri->encryptedKey->length`
780. }
781.
782. > int CMS_RecipientInfo_decrypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri)
783. {
784. switch (ri->type) {
crypto/cms/cms_env.c:792:16: Call
790.
791. case CMS_RECIPINFO_PASS:
792. return cms_RecipientInfo_pwri_crypt(cms, ri, 0);
^
793.
794. default:
crypto/cms/cms_pwri.c:320:1: Parameter `ri->d.pwri->encryptedKey->length`
318. /* Encrypt/Decrypt content key in PWRI recipient info */
319.
320. > int cms_RecipientInfo_pwri_crypt(CMS_ContentInfo *cms, CMS_RecipientInfo *ri,
321. int en_de)
322. {
crypto/cms/cms_pwri.c:409:14: Call
407. goto err;
408. }
409. if (!kek_unwrap_key(key, &keylen,
^
410. pwri->encryptedKey->data,
411. pwri->encryptedKey->length, kekctx)) {
crypto/cms/cms_pwri.c:221:1: <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_decrypt`
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_42639
|
static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
SpectrumParameters *spectrum)
{
unsigned int temp, max_qmf_subbands;
unsigned int start_min, stop_min;
int k;
const int8_t *sbr_offset_ptr;
int16_t stop_dk[13];
if (sbr->sample_rate < 32000) {
temp = 3000;
} else if (sbr->sample_rate < 64000) {
temp = 4000;
} else
temp = 5000;
start_min = ((temp << 7) + (sbr->sample_rate >> 1)) / sbr->sample_rate;
stop_min = ((temp << 8) + (sbr->sample_rate >> 1)) / sbr->sample_rate;
switch (sbr->sample_rate) {
case 16000:
sbr_offset_ptr = sbr_offset[0];
break;
case 22050:
sbr_offset_ptr = sbr_offset[1];
break;
case 24000:
sbr_offset_ptr = sbr_offset[2];
break;
case 32000:
sbr_offset_ptr = sbr_offset[3];
break;
case 44100: case 48000: case 64000:
sbr_offset_ptr = sbr_offset[4];
break;
case 88200: case 96000: case 128000: case 176400: case 192000:
sbr_offset_ptr = sbr_offset[5];
break;
default:
av_log(ac->avctx, AV_LOG_ERROR,
"Unsupported sample rate for SBR: %d\n", sbr->sample_rate);
return -1;
}
sbr->k[0] = start_min + sbr_offset_ptr[spectrum->bs_start_freq];
if (spectrum->bs_stop_freq < 14) {
sbr->k[2] = stop_min;
make_bands(stop_dk, stop_min, 64, 13);
qsort(stop_dk, 13, sizeof(stop_dk[0]), qsort_comparison_function_int16);
for (k = 0; k < spectrum->bs_stop_freq; k++)
sbr->k[2] += stop_dk[k];
} else if (spectrum->bs_stop_freq == 14) {
sbr->k[2] = 2*sbr->k[0];
} else if (spectrum->bs_stop_freq == 15) {
sbr->k[2] = 3*sbr->k[0];
} else {
av_log(ac->avctx, AV_LOG_ERROR,
"Invalid bs_stop_freq: %d\n", spectrum->bs_stop_freq);
return -1;
}
sbr->k[2] = FFMIN(64, sbr->k[2]);
if (sbr->sample_rate <= 32000) {
max_qmf_subbands = 48;
} else if (sbr->sample_rate == 44100) {
max_qmf_subbands = 35;
} else if (sbr->sample_rate >= 48000)
max_qmf_subbands = 32;
if (sbr->k[2] - sbr->k[0] > max_qmf_subbands) {
av_log(ac->avctx, AV_LOG_ERROR,
"Invalid bitstream, too many QMF subbands: %d\n", sbr->k[2] - sbr->k[0]);
return -1;
}
if (!spectrum->bs_freq_scale) {
int dk, k2diff;
dk = spectrum->bs_alter_scale + 1;
sbr->n_master = ((sbr->k[2] - sbr->k[0] + (dk&2)) >> dk) << 1;
if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band))
return -1;
for (k = 1; k <= sbr->n_master; k++)
sbr->f_master[k] = dk;
k2diff = sbr->k[2] - sbr->k[0] - sbr->n_master * dk;
if (k2diff < 0) {
sbr->f_master[1]--;
sbr->f_master[2]-= (k2diff < -1);
} else if (k2diff) {
sbr->f_master[sbr->n_master]++;
}
sbr->f_master[0] = sbr->k[0];
for (k = 1; k <= sbr->n_master; k++)
sbr->f_master[k] += sbr->f_master[k - 1];
} else {
int half_bands = 7 - spectrum->bs_freq_scale;
int two_regions, num_bands_0;
int vdk0_max, vdk1_min;
int16_t vk0[49];
if (49 * sbr->k[2] > 110 * sbr->k[0]) {
two_regions = 1;
sbr->k[1] = 2 * sbr->k[0];
} else {
two_regions = 0;
sbr->k[1] = sbr->k[2];
}
num_bands_0 = lrintf(half_bands * log2f(sbr->k[1] / (float)sbr->k[0])) * 2;
if (num_bands_0 <= 0) {
av_log(ac->avctx, AV_LOG_ERROR, "Invalid num_bands_0: %d\n", num_bands_0);
return -1;
}
vk0[0] = 0;
make_bands(vk0+1, sbr->k[0], sbr->k[1], num_bands_0);
qsort(vk0 + 1, num_bands_0, sizeof(vk0[1]), qsort_comparison_function_int16);
vdk0_max = vk0[num_bands_0];
vk0[0] = sbr->k[0];
for (k = 1; k <= num_bands_0; k++) {
if (vk0[k] <= 0) {
av_log(ac->avctx, AV_LOG_ERROR, "Invalid vDk0[%d]: %d\n", k, vk0[k]);
return -1;
}
vk0[k] += vk0[k-1];
}
if (two_regions) {
int16_t vk1[49];
float invwarp = spectrum->bs_alter_scale ? 0.76923076923076923077f
: 1.0f;
int num_bands_1 = lrintf(half_bands * invwarp *
log2f(sbr->k[2] / (float)sbr->k[1])) * 2;
make_bands(vk1+1, sbr->k[1], sbr->k[2], num_bands_1);
vdk1_min = array_min_int16(vk1 + 1, num_bands_1);
if (vdk1_min < vdk0_max) {
int change;
qsort(vk1 + 1, num_bands_1, sizeof(vk1[1]), qsort_comparison_function_int16);
change = FFMIN(vdk0_max - vk1[1], (vk1[num_bands_1] - vk1[1]) >> 1);
vk1[1] += change;
vk1[num_bands_1] -= change;
}
qsort(vk1 + 1, num_bands_1, sizeof(vk1[1]), qsort_comparison_function_int16);
vk1[0] = sbr->k[1];
for (k = 1; k <= num_bands_1; k++) {
if (vk1[k] <= 0) {
av_log(ac->avctx, AV_LOG_ERROR, "Invalid vDk1[%d]: %d\n", k, vk1[k]);
return -1;
}
vk1[k] += vk1[k-1];
}
sbr->n_master = num_bands_0 + num_bands_1;
if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band))
return -1;
memcpy(&sbr->f_master[0], vk0,
(num_bands_0 + 1) * sizeof(sbr->f_master[0]));
memcpy(&sbr->f_master[num_bands_0 + 1], vk1 + 1,
num_bands_1 * sizeof(sbr->f_master[0]));
} else {
sbr->n_master = num_bands_0;
if (check_n_master(ac->avctx, sbr->n_master, sbr->spectrum_params.bs_xover_band))
return -1;
memcpy(sbr->f_master, vk0, (num_bands_0 + 1) * sizeof(sbr->f_master[0]));
}
}
return 0;
}
libavcodec/aacsbr.c:395: error: Integer Overflow L2
([-1+min(1, `sbr->f_master[*]`), +oo] - [0, 1]):unsigned16.
libavcodec/aacsbr.c:304:1: <LHS trace>
302.
303. /// Master Frequency Band Table (14496-3 sp04 p194)
304. static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
^
305. SpectrumParameters *spectrum)
306. {
libavcodec/aacsbr.c:304:1: Parameter `sbr->f_master[*]`
302.
303. /// Master Frequency Band Table (14496-3 sp04 p194)
304. static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr,
^
305. SpectrumParameters *spectrum)
306. {
libavcodec/aacsbr.c:395:33: <RHS trace>
393. if (k2diff < 0) {
394. sbr->f_master[1]--;
395. sbr->f_master[2]-= (k2diff < -1);
^
396. } else if (k2diff) {
397. sbr->f_master[sbr->n_master]++;
libavcodec/aacsbr.c:395:33: Assignment
393. if (k2diff < 0) {
394. sbr->f_master[1]--;
395. sbr->f_master[2]-= (k2diff < -1);
^
396. } else if (k2diff) {
397. sbr->f_master[sbr->n_master]++;
libavcodec/aacsbr.c:395:13: Binary operation: ([-1+min(1, sbr->f_master[*]), +oo] - [0, 1]):unsigned16
393. if (k2diff < 0) {
394. sbr->f_master[1]--;
395. sbr->f_master[2]-= (k2diff < -1);
^
396. } else if (k2diff) {
397. sbr->f_master[sbr->n_master]++;
|
https://github.com/libav/libav/blob/5634f30c4a25c17c1de26703948efeafb733413d/libavcodec/aacsbr.c/#L395
|
d2a_code_trace_data_42640
|
int av_seek_frame_binary(AVFormatContext *s, int stream_index, int64_t target_ts, int flags){
AVInputFormat *avif= s->iformat;
int64_t pos_min, pos_max, pos, pos_limit;
int64_t ts_min, ts_max, ts;
int index;
AVStream *st;
if (stream_index < 0)
return -1;
#ifdef DEBUG_SEEK
av_log(s, AV_LOG_DEBUG, "read_seek: %d %"PRId64"\n", stream_index, target_ts);
#endif
ts_max=
ts_min= AV_NOPTS_VALUE;
pos_limit= -1;
st= s->streams[stream_index];
if(st->index_entries){
AVIndexEntry *e;
index= av_index_search_timestamp(st, target_ts, flags | AVSEEK_FLAG_BACKWARD);
index= FFMAX(index, 0);
e= &st->index_entries[index];
if(e->timestamp <= target_ts || e->pos == e->min_distance){
pos_min= e->pos;
ts_min= e->timestamp;
#ifdef DEBUG_SEEK
av_log(s, AV_LOG_DEBUG, "using cached pos_min=0x%"PRIx64" dts_min=%"PRId64"\n",
pos_min,ts_min);
#endif
}else{
assert(index==0);
}
index= av_index_search_timestamp(st, target_ts, flags & ~AVSEEK_FLAG_BACKWARD);
assert(index < st->nb_index_entries);
if(index >= 0){
e= &st->index_entries[index];
assert(e->timestamp >= target_ts);
pos_max= e->pos;
ts_max= e->timestamp;
pos_limit= pos_max - e->min_distance;
#ifdef DEBUG_SEEK
av_log(s, AV_LOG_DEBUG, "using cached pos_max=0x%"PRIx64" pos_limit=0x%"PRIx64" dts_max=%"PRId64"\n",
pos_max,pos_limit, ts_max);
#endif
}
}
pos= av_gen_search(s, stream_index, target_ts, pos_min, pos_max, pos_limit, ts_min, ts_max, flags, &ts, avif->read_timestamp);
if(pos<0)
return -1;
url_fseek(s->pb, pos, SEEK_SET);
av_update_cur_dts(s, st, ts);
return 0;
}
libavformat/utils.c:1179: error: Uninitialized Value
The value read from pos_max was never initialized.
libavformat/utils.c:1179:10:
1177. }
1178.
1179. pos= av_gen_search(s, stream_index, target_ts, pos_min, pos_max, pos_limit, ts_min, ts_max, flags, &ts, avif->read_timestamp);
^
1180. if(pos<0)
1181. return -1;
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/utils.c/#L1179
|
d2a_code_trace_data_42641
|
int test_mod_exp(BIO *bp, BN_CTX *ctx)
{
BIGNUM *a, *b, *c, *d, *e;
int i;
a = BN_new();
b = BN_new();
c = BN_new();
d = BN_new();
e = BN_new();
BN_one(a);
BN_one(b);
BN_zero(c);
if (BN_mod_exp(d, a, b, c, ctx)) {
fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n");
return 0;
}
BN_bntest_rand(c, 30, 0, 1);
for (i = 0; i < num2; i++) {
BN_bntest_rand(a, 20 + i * 5, 0, 0);
BN_bntest_rand(b, 2 + i, 0, 0);
if (!BN_mod_exp(d, a, b, c, ctx))
return (0);
if (bp != NULL) {
if (!results) {
BN_print(bp, a);
BIO_puts(bp, " ^ ");
BN_print(bp, b);
BIO_puts(bp, " % ");
BN_print(bp, c);
BIO_puts(bp, " - ");
}
BN_print(bp, d);
BIO_puts(bp, "\n");
}
BN_exp(e, a, b, ctx);
BN_sub(e, e, d);
BN_div(a, b, e, c, ctx);
if (!BN_is_zero(b)) {
fprintf(stderr, "Modulo exponentiation test failed!\n");
return 0;
}
}
BN_hex2bn(&a, "050505050505");
BN_hex2bn(&b, "02");
BN_hex2bn(&c,
"4141414141414141414141274141414141414141414141414141414141414141"
"4141414141414141414141414141414141414141414141414141414141414141"
"4141414141414141414141800000000000000000000000000000000000000000"
"0000000000000000000000000000000000000000000000000000000000000000"
"0000000000000000000000000000000000000000000000000000000000000000"
"0000000000000000000000000000000000000000000000000000000001");
BN_mod_exp(d, a, b, c, ctx);
BN_mul(e, a, a, ctx);
if (BN_cmp(d, e)) {
fprintf(stderr, "BN_mod_exp and BN_mul produce different results!\n");
return 0;
}
BN_free(a);
BN_free(b);
BN_free(c);
BN_free(d);
BN_free(e);
return (1);
}
test/bntest.c:1050: error: MEMORY_LEAK
memory dynamically allocated to `c` by call to `BN_new()` at line 986, column 9 is not reachable after line 1050, column 1.
Showing all 145 steps of the trace
test/bntest.c:979:1: start of procedure test_mod_exp()
977. }
978.
979. > int test_mod_exp(BIO *bp, BN_CTX *ctx)
980. {
981. BIGNUM *a, *b, *c, *d, *e;
test/bntest.c:984:5:
982. int i;
983.
984. > a = BN_new();
985. b = BN_new();
986. c = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:985:5:
983.
984. a = BN_new();
985. > b = BN_new();
986. c = BN_new();
987. d = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:986:5:
984. a = BN_new();
985. b = BN_new();
986. > c = BN_new();
987. d = BN_new();
988. e = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:987:5:
985. b = BN_new();
986. c = BN_new();
987. > d = BN_new();
988. e = BN_new();
989.
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:988:5:
986. c = BN_new();
987. d = BN_new();
988. > e = BN_new();
989.
990. BN_one(a);
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:990:5:
988. e = BN_new();
989.
990. > BN_one(a);
991. BN_one(b);
992. BN_zero(c);
crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word()
528. }
529.
530. > int BN_set_word(BIGNUM *a, BN_ULONG w)
531. {
532. bn_check_top(a);
crypto/bn/bn_lib.c:533:9: Condition is true
531. {
532. bn_check_top(a);
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
534. return (0);
535. a->neg = 0;
crypto/bn/bn_lib.c:533:9: Taking false branch
531. {
532. bn_check_top(a);
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
534. return (0);
535. a->neg = 0;
crypto/bn/bn_lib.c:535:5:
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
534. return (0);
535. > a->neg = 0;
536. a->d[0] = w;
537. a->top = (w ? 1 : 0);
crypto/bn/bn_lib.c:536:5:
534. return (0);
535. a->neg = 0;
536. > a->d[0] = w;
537. a->top = (w ? 1 : 0);
538. bn_check_top(a);
crypto/bn/bn_lib.c:537:15: Condition is true
535. a->neg = 0;
536. a->d[0] = w;
537. a->top = (w ? 1 : 0);
^
538. bn_check_top(a);
539. return (1);
crypto/bn/bn_lib.c:537:5:
535. a->neg = 0;
536. a->d[0] = w;
537. > a->top = (w ? 1 : 0);
538. bn_check_top(a);
539. return (1);
crypto/bn/bn_lib.c:539:5:
537. a->top = (w ? 1 : 0);
538. bn_check_top(a);
539. > return (1);
540. }
541.
crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word
538. bn_check_top(a);
539. return (1);
540. > }
541.
542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
test/bntest.c:991:5:
989.
990. BN_one(a);
991. > BN_one(b);
992. BN_zero(c);
993. if (BN_mod_exp(d, a, b, c, ctx)) {
crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word()
528. }
529.
530. > int BN_set_word(BIGNUM *a, BN_ULONG w)
531. {
532. bn_check_top(a);
crypto/bn/bn_lib.c:533:9: Condition is true
531. {
532. bn_check_top(a);
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
534. return (0);
535. a->neg = 0;
crypto/bn/bn_lib.c:533:9: Taking false branch
531. {
532. bn_check_top(a);
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
534. return (0);
535. a->neg = 0;
crypto/bn/bn_lib.c:535:5:
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
534. return (0);
535. > a->neg = 0;
536. a->d[0] = w;
537. a->top = (w ? 1 : 0);
crypto/bn/bn_lib.c:536:5:
534. return (0);
535. a->neg = 0;
536. > a->d[0] = w;
537. a->top = (w ? 1 : 0);
538. bn_check_top(a);
crypto/bn/bn_lib.c:537:15: Condition is true
535. a->neg = 0;
536. a->d[0] = w;
537. a->top = (w ? 1 : 0);
^
538. bn_check_top(a);
539. return (1);
crypto/bn/bn_lib.c:537:5:
535. a->neg = 0;
536. a->d[0] = w;
537. > a->top = (w ? 1 : 0);
538. bn_check_top(a);
539. return (1);
crypto/bn/bn_lib.c:539:5:
537. a->top = (w ? 1 : 0);
538. bn_check_top(a);
539. > return (1);
540. }
541.
crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word
538. bn_check_top(a);
539. return (1);
540. > }
541.
542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
test/bntest.c:992:5:
990. BN_one(a);
991. BN_one(b);
992. > BN_zero(c);
993. if (BN_mod_exp(d, a, b, c, ctx)) {
994. fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n");
crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word()
528. }
529.
530. > int BN_set_word(BIGNUM *a, BN_ULONG w)
531. {
532. bn_check_top(a);
crypto/bn/bn_lib.c:533:9: Condition is true
531. {
532. bn_check_top(a);
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
534. return (0);
535. a->neg = 0;
crypto/bn/bn_lib.c:533:9: Taking false branch
531. {
532. bn_check_top(a);
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
534. return (0);
535. a->neg = 0;
crypto/bn/bn_lib.c:535:5:
533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
534. return (0);
535. > a->neg = 0;
536. a->d[0] = w;
537. a->top = (w ? 1 : 0);
crypto/bn/bn_lib.c:536:5:
534. return (0);
535. a->neg = 0;
536. > a->d[0] = w;
537. a->top = (w ? 1 : 0);
538. bn_check_top(a);
crypto/bn/bn_lib.c:537:15: Condition is false
535. a->neg = 0;
536. a->d[0] = w;
537. a->top = (w ? 1 : 0);
^
538. bn_check_top(a);
539. return (1);
crypto/bn/bn_lib.c:537:5:
535. a->neg = 0;
536. a->d[0] = w;
537. > a->top = (w ? 1 : 0);
538. bn_check_top(a);
539. return (1);
crypto/bn/bn_lib.c:539:5:
537. a->top = (w ? 1 : 0);
538. bn_check_top(a);
539. > return (1);
540. }
541.
crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word
538. bn_check_top(a);
539. return (1);
540. > }
541.
542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
test/bntest.c:993:9: Taking true branch
991. BN_one(b);
992. BN_zero(c);
993. if (BN_mod_exp(d, a, b, c, ctx)) {
^
994. fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n");
995. return 0;
test/bntest.c:994:9:
992. BN_zero(c);
993. if (BN_mod_exp(d, a, b, c, ctx)) {
994. > fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n");
995. return 0;
996. }
test/bntest.c:995:9:
993. if (BN_mod_exp(d, a, b, c, ctx)) {
994. fprintf(stderr, "BN_mod_exp with zero modulus succeeded!\n");
995. > return 0;
996. }
997.
test/bntest.c:1050:1: return from a call to test_mod_exp
1048. BN_free(e);
1049. return (1);
1050. > }
1051.
1052. int test_mod_exp_mont_consttime(BIO *bp, BN_CTX *ctx)
|
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L1050
|
d2a_code_trace_data_42642
|
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
{
int i, nw, lb, rb;
BN_ULONG *t, *f;
BN_ULONG l;
bn_check_top(r);
bn_check_top(a);
if (n < 0) {
BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT);
return 0;
}
nw = n / BN_BITS2;
if (bn_wexpand(r, a->top + nw + 1) == NULL)
return 0;
r->neg = a->neg;
lb = n % BN_BITS2;
rb = BN_BITS2 - lb;
f = a->d;
t = r->d;
t[a->top + nw] = 0;
if (lb == 0)
for (i = a->top - 1; i >= 0; i--)
t[nw + i] = f[i];
else
for (i = a->top - 1; i >= 0; i--) {
l = f[i];
t[nw + i + 1] |= (l >> rb) & BN_MASK2;
t[nw + i] = (l << lb) & BN_MASK2;
}
memset(t, 0, sizeof(*t) * nw);
r->top = a->top + nw + 1;
bn_correct_top(r);
bn_check_top(r);
return 1;
}
crypto/sm2/sm2_sign.c:115: error: BUFFER_OVERRUN_L3
Offset: [1, +oo] Size: [0, 8388607] by call to `EC_POINT_mul`.
Showing all 37 steps of the trace
crypto/sm2/sm2_sign.c:118:21: Call
116. || !EC_POINT_get_affine_coordinates_GFp(group, kG, x1, NULL,
117. ctx)
118. || !BN_mod_add(r, e, x1, order, ctx)) {
^
119. SM2err(SM2_F_SM2_SIG_GEN, ERR_R_INTERNAL_ERROR);
120. goto done;
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:28:19: Call
26. if (cmp_res > 0) {
27. r_neg = a->neg;
28. ret = BN_usub(r, a, b);
^
29. } else if (cmp_res < 0) {
30. r_neg = b->neg;
crypto/bn/bn_add.c:125:1: Parameter `r->top`
123.
124. /* unsigned subtraction of b from a, a must be larger than b. */
125. > int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
126. {
127. int max, min, dif;
crypto/sm2/sm2_sign.c:124:13: Call
122.
123. /* try again if r == 0 or r+k == n */
124. if (BN_is_zero(r))
^
125. continue;
126.
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/sm2/sm2_sign.c:110:14: Call
108.
109. for (;;) {
110. if (!BN_priv_rand_range(k, order)) {
^
111. SM2err(SM2_F_SM2_SIG_GEN, ERR_R_INTERNAL_ERROR);
112. goto done;
crypto/bn/bn_rand.c:182:1: Parameter `range->top`
180. }
181.
182. > int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range)
183. {
184. return bnrand_range(PRIVATE, r, range);
crypto/bn/bn_rand.c:184:12: Call
182. int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range)
183. {
184. return bnrand_range(PRIVATE, r, range);
^
185. }
186.
crypto/bn/bn_rand.c:113:1: Parameter `range->top`
111.
112. /* random number r: 0 <= r < range */
113. > static int bnrand_range(BNRAND_FLAG flag, BIGNUM *r, const BIGNUM *range)
114. {
115. int n;
crypto/sm2/sm2_sign.c:115:14: Call
113. }
114.
115. if (!EC_POINT_mul(group, kG, k, NULL, NULL, ctx)
^
116. || !EC_POINT_get_affine_coordinates_GFp(group, kG, x1, NULL,
117. ctx)
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:342:1: Parameter `group->order->top`
340. * in the addition if scalar != NULL
341. */
342. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
343. size_t num, const EC_POINT *points[], const BIGNUM *scalars[],
344. BN_CTX *ctx)
crypto/ec/ec_mult.c:393:16: Call
391. * constant time version.
392. */
393. return ec_mul_consttime(group, r, scalar, NULL, ctx);
^
394. }
395. if ((scalar == NULL) && (num == 1)) {
crypto/ec/ec_mult.c:131:1: Parameter `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:147:18: Call
145. BN_CTX_start(ctx);
146.
147. order_bits = BN_num_bits(group->order);
^
148.
149. s = EC_POINT_new(group);
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/ec_mult.c:189:14: Call
187. * constant-timeness
188. */
189. if (!BN_nnmod(k, k, group->order, ctx))
^
190. goto err;
191. }
crypto/bn/bn_mod.c:13:1: Parameter `d->top`
11. #include "bn_lcl.h"
12.
13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
14. {
15. /*
crypto/bn/bn_mod.c:20:11: Call
18. */
19.
20. if (!(BN_mod(r, m, d, ctx)))
^
21. return 0;
22. if (!r->neg)
crypto/bn/bn_div.c:199:31: Call
197.
198. /* First we normalise the numbers */
199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
^
200. if (!(BN_lshift(sdiv, divisor, norm_shift)))
201. goto err;
crypto/bn/bn_lib.c:140:9: Assignment
138.
139. if (BN_is_zero(a))
140. return 0;
^
141. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
142. }
crypto/bn/bn_div.c:199:5: Assignment
197.
198. /* First we normalise the numbers */
199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
^
200. if (!(BN_lshift(sdiv, divisor, norm_shift)))
201. goto err;
crypto/bn/bn_div.c:200:11: Call
198. /* First we normalise the numbers */
199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
200. if (!(BN_lshift(sdiv, divisor, norm_shift)))
^
201. goto err;
202. sdiv->neg = 0;
crypto/bn/bn_shift.c:83:1: <Offset trace>
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:83:1: Parameter `n`
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:97:5: Assignment
95. }
96.
97. nw = n / BN_BITS2;
^
98. if (bn_wexpand(r, a->top + nw + 1) == NULL)
99. return 0;
crypto/bn/bn_shift.c:83:1: <Length trace>
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:83:1: Parameter `*r->d`
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:98:9: Call
96.
97. nw = n / BN_BITS2;
98. if (bn_wexpand(r, a->top + nw + 1) == NULL)
^
99. return 0;
100. r->neg = a->neg;
crypto/bn/bn_lib.c: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_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 `EC_POINT_mul`
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/630fe1da888490b7dfef3fe0928b813ddff5d51a/crypto/bn/bn_shift.c/#L112
|
d2a_code_trace_data_42643
|
int ssl3_cbc_copy_mac(unsigned char *out,
const SSL3_RECORD *rec, size_t md_size)
{
#if defined(CBC_MAC_ROTATE_IN_PLACE)
unsigned char rotated_mac_buf[64 + EVP_MAX_MD_SIZE];
unsigned char *rotated_mac;
#else
unsigned char rotated_mac[EVP_MAX_MD_SIZE];
#endif
size_t mac_end = rec->length;
size_t mac_start = mac_end - md_size;
size_t in_mac;
size_t scan_start = 0;
size_t i, j;
size_t rotate_offset;
if (!ossl_assert(rec->orig_len >= md_size
&& md_size <= EVP_MAX_MD_SIZE))
return 0;
#if defined(CBC_MAC_ROTATE_IN_PLACE)
rotated_mac = rotated_mac_buf + ((0 - (size_t)rotated_mac_buf) & 63);
#endif
if (rec->orig_len > md_size + 255 + 1)
scan_start = rec->orig_len - (md_size + 255 + 1);
in_mac = 0;
rotate_offset = 0;
memset(rotated_mac, 0, md_size);
for (i = scan_start, j = 0; i < rec->orig_len; i++) {
size_t mac_started = constant_time_eq_s(i, mac_start);
size_t mac_ended = constant_time_lt_s(i, mac_end);
unsigned char b = rec->data[i];
in_mac |= mac_started;
in_mac &= mac_ended;
rotate_offset |= j & mac_started;
rotated_mac[j++] |= b & in_mac;
j &= constant_time_lt_s(j, md_size);
}
#if defined(CBC_MAC_ROTATE_IN_PLACE)
j = 0;
for (i = 0; i < md_size; i++) {
((volatile unsigned char *)rotated_mac)[rotate_offset ^ 32];
out[j++] = rotated_mac[rotate_offset++];
rotate_offset &= constant_time_lt_s(rotate_offset, md_size);
}
#else
memset(out, 0, md_size);
rotate_offset = md_size - rotate_offset;
rotate_offset &= constant_time_lt_s(rotate_offset, md_size);
for (i = 0; i < md_size; i++) {
for (j = 0; j < md_size; j++)
out[j] |= rotated_mac[i] & constant_time_eq_8_s(j, rotate_offset);
rotate_offset++;
rotate_offset &= constant_time_lt_s(rotate_offset, md_size);
}
#endif
return 1;
}
ssl/record/ssl3_record.c:547: error: INTEGER_OVERFLOW_L2
([0, +oo] - [256, 320]):unsigned64 by call to `ssl3_cbc_copy_mac`.
Showing all 9 steps of the trace
ssl/record/ssl3_record.c:256:29: Call
254. if (!PACKET_get_1(&pkt, &type)
255. || !PACKET_get_net_2(&pkt, &version)
256. || !PACKET_get_net_2_len(&pkt, &thisrr->length)) {
^
257. al = SSL_AD_DECODE_ERROR;
258. SSLerr(SSL_F_SSL3_GET_RECORD, ERR_R_INTERNAL_ERROR);
ssl/packet_locl.h:164:8: Parameter `*data`
162.
163. /* Same as PACKET_get_net_2() but for a size_t */
164. __owur static ossl_inline int PACKET_get_net_2_len(PACKET *pkt, size_t *data)
^
165. {
166. unsigned int i;
ssl/record/ssl3_record.c:412:9: Assignment
410. /* decrypt in place in 'thisrr->input' */
411. thisrr->data = thisrr->input;
412. thisrr->orig_len = thisrr->length;
^
413.
414. /* Mark this record as not read by upper layers yet */
ssl/record/ssl3_record.c:547:22: Call
545. */
546. mac = mac_tmp;
547. if (!ssl3_cbc_copy_mac(mac_tmp, thisrr, mac_size)) {
^
548. al = SSL_AD_INTERNAL_ERROR;
549. SSLerr(SSL_F_SSL3_GET_RECORD, ERR_R_INTERNAL_ERROR);
ssl/record/ssl3_record.c:1420:1: <LHS trace>
1418. #define CBC_MAC_ROTATE_IN_PLACE
1419.
1420. > int ssl3_cbc_copy_mac(unsigned char *out,
1421. const SSL3_RECORD *rec, size_t md_size)
1422. {
ssl/record/ssl3_record.c:1420:1: Parameter `md_size`
1418. #define CBC_MAC_ROTATE_IN_PLACE
1419.
1420. > int ssl3_cbc_copy_mac(unsigned char *out,
1421. const SSL3_RECORD *rec, size_t md_size)
1422. {
ssl/record/ssl3_record.c:1420:1: <RHS trace>
1418. #define CBC_MAC_ROTATE_IN_PLACE
1419.
1420. > int ssl3_cbc_copy_mac(unsigned char *out,
1421. const SSL3_RECORD *rec, size_t md_size)
1422. {
ssl/record/ssl3_record.c:1420:1: Parameter `md_size`
1418. #define CBC_MAC_ROTATE_IN_PLACE
1419.
1420. > int ssl3_cbc_copy_mac(unsigned char *out,
1421. const SSL3_RECORD *rec, size_t md_size)
1422. {
ssl/record/ssl3_record.c:1454:9: Binary operation: ([0, +oo] - [256, 320]):unsigned64 by call to `ssl3_cbc_copy_mac`
1452. /* This information is public so it's safe to branch based on it. */
1453. if (rec->orig_len > md_size + 255 + 1)
1454. scan_start = rec->orig_len - (md_size + 255 + 1);
^
1455.
1456. in_mac = 0;
|
https://github.com/openssl/openssl/blob/7f7eb90b8ac55997c5c825bb3ebcfe28611e06f5/ssl/record/ssl3_record.c/#L1454
|
d2a_code_trace_data_42644
|
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:1078: error: Uninitialized Value
The value read from xmax was never initialized.
libavcodec/motion_est_template.c:1078:17:
1076. (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16)
1077. if(s->mb_y+1<s->end_mb_y) //FIXME replace at least with last_slice_line
1078. CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
^
1079. (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
1080. }
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1078
|
d2a_code_trace_data_42645
|
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:297: error: INTEGER_OVERFLOW_L2
(16 - [1, 28+max(1, `ctx->cipher_data->num`)]):unsigned64 by call to `Poly1305_Update`.
Showing all 6 steps of the trace
crypto/evp/e_chacha20_poly1305.c:233:1: Parameter `ctx->cipher_data->num`
231. }
232.
233. > static int chacha20_poly1305_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
234. const unsigned char *in, size_t len)
235. {
crypto/evp/e_chacha20_poly1305.c:297:17: Call
295. if (actx->aad) { /* wrap up aad */
296. if ((rem = (size_t)actx->len.aad % POLY1305_BLOCK_SIZE))
297. Poly1305_Update(POLY1305_ctx(actx), zero,
^
298. POLY1305_BLOCK_SIZE - rem);
299. actx->aad = 0;
crypto/poly1305/poly1305.c:466:1: <RHS trace>
464. #endif
465.
466. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len)
467. {
468. #ifdef POLY1305_ASM
crypto/poly1305/poly1305.c:466:1: Parameter `ctx->num`
464. #endif
465.
466. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len)
467. {
468. #ifdef POLY1305_ASM
crypto/poly1305/poly1305.c:479:10: Assignment
477. size_t rem, num;
478.
479. if ((num = ctx->num)) {
^
480. rem = POLY1305_BLOCK_SIZE - num;
481. if (len >= rem) {
crypto/poly1305/poly1305.c:480:9: Binary operation: (16 - [1, 28+max(1, ctx->cipher_data->num)]):unsigned64 by call to `Poly1305_Update`
478.
479. if ((num = ctx->num)) {
480. rem = POLY1305_BLOCK_SIZE - num;
^
481. if (len >= rem) {
482. memcpy(ctx->data + num, inp, rem);
|
https://github.com/openssl/openssl/blob/740b2b9a6cf31b02916a4d18f868e8a95934c083/crypto/poly1305/poly1305.c/#L480
|
d2a_code_trace_data_42646
|
int UI_dup_verify_string(UI *ui, const char *prompt, int flags,
char *result_buf, int minsize, int maxsize,
const char *test_buf)
{
char *prompt_copy = NULL;
if (prompt) {
prompt_copy = OPENSSL_strdup(prompt);
if (prompt_copy == NULL) {
UIerr(UI_F_UI_DUP_VERIFY_STRING, ERR_R_MALLOC_FAILURE);
return -1;
}
}
return general_allocate_string(ui, prompt_copy, 1,
UIT_VERIFY, flags, result_buf, minsize,
maxsize, test_buf);
}
crypto/ui/ui_lib.c:242: error: MEMORY_LEAK
memory dynamically allocated by call to `CRYPTO_strdup()` at line 235, column 23 is not reachable after line 242, column 5.
Showing all 30 steps of the trace
crypto/ui/ui_lib.c:228:1: start of procedure UI_dup_verify_string()
226. }
227.
228. > int UI_dup_verify_string(UI *ui, const char *prompt, int flags,
229. char *result_buf, int minsize, int maxsize,
230. const char *test_buf)
crypto/ui/ui_lib.c:232:5:
230. const char *test_buf)
231. {
232. > char *prompt_copy = NULL;
233.
234. if (prompt) {
crypto/ui/ui_lib.c:234:9: Taking true branch
232. char *prompt_copy = NULL;
233.
234. if (prompt) {
^
235. prompt_copy = OPENSSL_strdup(prompt);
236. if (prompt_copy == NULL) {
crypto/ui/ui_lib.c:235:9:
233.
234. if (prompt) {
235. > prompt_copy = OPENSSL_strdup(prompt);
236. if (prompt_copy == NULL) {
237. UIerr(UI_F_UI_DUP_VERIFY_STRING, ERR_R_MALLOC_FAILURE);
crypto/o_str.c:28:1: start of procedure CRYPTO_strdup()
26. }
27.
28. > char *CRYPTO_strdup(const char *str, const char* file, int line)
29. {
30. char *ret;
crypto/o_str.c:33:9: Taking false branch
31. size_t size;
32.
33. if (str == NULL)
^
34. return NULL;
35. size = strlen(str) + 1;
crypto/o_str.c:35:5:
33. if (str == NULL)
34. return NULL;
35. > size = strlen(str) + 1;
36. ret = CRYPTO_malloc(size, file, line);
37. if (ret != NULL)
crypto/o_str.c:36:5:
34. return NULL;
35. size = strlen(str) + 1;
36. > ret = CRYPTO_malloc(size, file, line);
37. if (ret != NULL)
38. memcpy(ret, str, size);
crypto/mem.c:71:1: start of procedure CRYPTO_malloc()
69. }
70.
71. > void *CRYPTO_malloc(size_t num, const char *file, int line)
72. {
73. void *ret = NULL;
crypto/mem.c:73:5:
71. void *CRYPTO_malloc(size_t num, const char *file, int line)
72. {
73. > void *ret = NULL;
74.
75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
crypto/mem.c:75:9: Taking false branch
73. void *ret = NULL;
74.
75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
76. return malloc_impl(num, file, line);
77.
crypto/mem.c:78:9: Taking false branch
76. return malloc_impl(num, file, line);
77.
78. if (num <= 0)
^
79. return NULL;
80.
crypto/mem.c:81:5:
79. return NULL;
80.
81. > allow_customize = 0;
82. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
83. if (call_malloc_debug) {
crypto/mem.c:91:5:
89. }
90. #else
91. > osslargused(file); osslargused(line);
92. ret = malloc(num);
93. #endif
crypto/mem.c:91:24:
89. }
90. #else
91. > osslargused(file); osslargused(line);
92. ret = malloc(num);
93. #endif
crypto/mem.c:92:5:
90. #else
91. osslargused(file); osslargused(line);
92. > ret = malloc(num);
93. #endif
94.
crypto/mem.c:95:5:
93. #endif
94.
95. > return ret;
96. }
97.
crypto/mem.c:96:1: return from a call to CRYPTO_malloc
94.
95. return ret;
96. > }
97.
98. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/o_str.c:37:9: Taking true branch
35. size = strlen(str) + 1;
36. ret = CRYPTO_malloc(size, file, line);
37. if (ret != NULL)
^
38. memcpy(ret, str, size);
39. return ret;
crypto/o_str.c:38:9:
36. ret = CRYPTO_malloc(size, file, line);
37. if (ret != NULL)
38. > memcpy(ret, str, size);
39. return ret;
40. }
crypto/o_str.c:39:5:
37. if (ret != NULL)
38. memcpy(ret, str, size);
39. > return ret;
40. }
41.
crypto/o_str.c:40:1: return from a call to CRYPTO_strdup
38. memcpy(ret, str, size);
39. return ret;
40. > }
41.
42. char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)
crypto/ui/ui_lib.c:236:13: Taking false branch
234. if (prompt) {
235. prompt_copy = OPENSSL_strdup(prompt);
236. if (prompt_copy == NULL) {
^
237. UIerr(UI_F_UI_DUP_VERIFY_STRING, ERR_R_MALLOC_FAILURE);
238. return -1;
crypto/ui/ui_lib.c:242:5:
240. }
241.
242. > return general_allocate_string(ui, prompt_copy, 1,
243. UIT_VERIFY, flags, result_buf, minsize,
244. maxsize, test_buf);
crypto/ui/ui_lib.c:113:1: start of procedure general_allocate_string()
111. }
112.
113. > static int general_allocate_string(UI *ui, const char *prompt,
114. int prompt_freeable,
115. enum UI_string_types type, int input_flags,
crypto/ui/ui_lib.c:119:5:
117. const char *test_buf)
118. {
119. > int ret = -1;
120. UI_STRING *s = general_allocate_prompt(ui, prompt, prompt_freeable,
121. type, input_flags, result_buf);
crypto/ui/ui_lib.c:120:5: Skipping general_allocate_prompt(): empty list of specs
118. {
119. int ret = -1;
120. UI_STRING *s = general_allocate_prompt(ui, prompt, prompt_freeable,
^
121. type, input_flags, result_buf);
122.
crypto/ui/ui_lib.c:123:9: Taking false branch
121. type, input_flags, result_buf);
122.
123. if (s) {
^
124. if (allocate_string_stack(ui) >= 0) {
125. s->_.string_data.result_minsize = minsize;
crypto/ui/ui_lib.c:137:5:
135. free_string(s);
136. }
137. > return ret;
138. }
139.
crypto/ui/ui_lib.c:138:1: return from a call to general_allocate_string
136. }
137. return ret;
138. > }
139.
140. static int general_allocate_boolean(UI *ui,
|
https://github.com/openssl/openssl/blob/b2de11c58b57e7f0d58c6f8a1d4177705650647e/crypto/ui/ui_lib.c/#L242
|
d2a_code_trace_data_42647
|
static ossl_inline unsigned int constant_time_is_zero(unsigned int a)
{
return constant_time_msb(~a & (a - 1));
}
crypto/rsa/rsa_pmeth.c:329: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `RSA_padding_check_PKCS1_OAEP_mgf1`.
Showing all 9 steps of the trace
crypto/rsa/rsa_pmeth.c:319:14: Call
317. if (rctx->pad_mode == RSA_PKCS1_OAEP_PADDING) {
318. int i;
319. if (!setup_tbuf(rctx, ctx))
^
320. return -1;
321. ret = RSA_private_decrypt(inlen, in, rctx->tbuf,
crypto/rsa/rsa_pmeth.c:101:17: Call
99. if (ctx->tbuf != NULL)
100. return 1;
101. ctx->tbuf = OPENSSL_malloc(EVP_PKEY_size(pk->pkey));
^
102. if (ctx->tbuf == NULL)
103. return 0;
crypto/mem.c:76:16: Unknown value from: non-const function
74.
75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
76. return malloc_impl(num, file, line);
^
77.
78. if (num <= 0)
crypto/rsa/rsa_pmeth.c:329:15: Call
327. break;
328. }
329. ret = RSA_padding_check_PKCS1_OAEP_mgf1(out, ret, rctx->tbuf + i,
^
330. ret - i, ret,
331. rctx->oaep_label,
crypto/rsa/rsa_oaep.c:115:1: Parameter `*from`
113. }
114.
115. > int RSA_padding_check_PKCS1_OAEP_mgf1(unsigned char *to, int tlen,
116. const unsigned char *from, int flen,
117. int num, const unsigned char *param,
crypto/rsa/rsa_oaep.c:176:12: Call
174. * Optimal Asymmetric Encryption Padding (OAEP) [...]", CRYPTO 2001).
175. */
176. good = constant_time_is_zero(em[0]);
^
177.
178. maskedseed = em + 1;
include/internal/constant_time_locl.h:150:1: <LHS trace>
148. }
149.
150. > static ossl_inline unsigned int constant_time_is_zero(unsigned int a)
151. {
152. return constant_time_msb(~a & (a - 1));
include/internal/constant_time_locl.h:150:1: Parameter `a`
148. }
149.
150. > static ossl_inline unsigned int constant_time_is_zero(unsigned int a)
151. {
152. return constant_time_msb(~a & (a - 1));
include/internal/constant_time_locl.h:152:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `RSA_padding_check_PKCS1_OAEP_mgf1`
150. static ossl_inline unsigned int constant_time_is_zero(unsigned int a)
151. {
152. return constant_time_msb(~a & (a - 1));
^
153. }
154.
|
https://github.com/openssl/openssl/blob/76951372af95091bfc224a308e8cd9fb7b1db769/include/internal/constant_time_locl.h/#L152
|
d2a_code_trace_data_42648
|
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:372: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_sub`.
Showing all 26 steps of the trace
crypto/bn/bn_prime.c:365:10: Call
363. goto err;
364.
365. if (!BN_rand(rnd, bits, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD))
^
366. goto err;
367.
crypto/bn/bn_rand.c:99:12: Call
97. int BN_rand(BIGNUM *rnd, int bits, int top, int bottom)
98. {
99. return bnrand(NORMAL, rnd, bits, top, bottom);
^
100. }
101.
crypto/bn/bn_rand.c:21:1: Parameter `rnd->top`
19. } BNRAND_FLAG;
20.
21. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom)
22. {
23. unsigned char *buf = NULL;
crypto/bn/bn_prime.c:370:10: Call
368. /* we need ((rnd-rem) % add) == 0 */
369.
370. if (!BN_mod(t1, rnd, add, ctx))
^
371. goto err;
372. if (!BN_sub(rnd, rnd, t1))
crypto/bn/bn_div.c:209:1: Parameter `num->top`
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_prime.c:372:10: Call
370. if (!BN_mod(t1, rnd, add, ctx))
371. goto err;
372. if (!BN_sub(rnd, rnd, t1))
^
373. goto err;
374. if (rem == NULL) {
crypto/bn/bn_add.c:45:1: Parameter `r->top`
43.
44. /* signed sub of b from a. */
45. > int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
46. {
47. int ret, r_neg, cmp_res;
crypto/bn/bn_add.c:59:19: Call
57. if (cmp_res > 0) {
58. r_neg = a->neg;
59. ret = BN_usub(r, a, b);
^
60. } else if (cmp_res < 0) {
61. r_neg = !b->neg;
crypto/bn/bn_add.c:125:1: Parameter `r->top`
123.
124. /* unsigned subtraction of b from a, a must be larger than b. */
125. > int BN_usub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
126. {
127. int max, min, dif;
crypto/bn/bn_add.c:143:9: Call
141. }
142.
143. if (bn_wexpand(r, max) == NULL)
^
144. return 0;
145.
crypto/bn/bn_lib.c:960:1: Parameter `a->top`
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->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_sub`
230. assert(b->top <= words);
231. if (b->top > 0)
232. memcpy(a, b->d, sizeof(*a) * b->top);
^
233.
234. return a;
|
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_lib.c/#L232
|
d2a_code_trace_data_42649
|
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:1057: error: INTEGER_OVERFLOW_L2
([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + 10]):unsigned64 by call to `WPACKET_start_sub_packet_len__`.
Showing all 10 steps of the trace
ssl/t1_lib.c:1055:14: Call
1053. if (s->tlsext_hostname != NULL) {
1054. /* Add TLS extension servername to the Client Hello message */
1055. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_server_name)
^
1056. /* Sub-packet for server_name extension */
1057. || !WPACKET_start_sub_packet_u16(pkt)
ssl/packet.c:238:1: Parameter `pkt->buf->length`
236. }
237.
238. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size)
239. {
240. unsigned char *data;
ssl/t1_lib.c:1057:21: Call
1055. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_server_name)
1056. /* Sub-packet for server_name extension */
1057. || !WPACKET_start_sub_packet_u16(pkt)
^
1058. /* Sub-packet for servername list (always 1 hostname)*/
1059. || !WPACKET_start_sub_packet_u16(pkt)
ssl/packet.c:201:1: Parameter `pkt->written`
199. }
200.
201. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes)
202. {
203. WPACKET_SUB *sub;
ssl/packet.c:225:10: Call
223. }
224.
225. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars))
^
226. return 0;
227. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */
ssl/packet.c:15:1: <LHS trace>
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:15:1: Parameter `pkt->buf->length`
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:15:1: <RHS trace>
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:15:1: Parameter `len`
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:25:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + pkt->written + 10]):unsigned64 by call to `WPACKET_start_sub_packet_len__`
23. return 0;
24.
25. if (pkt->buf->length - pkt->written < len) {
^
26. size_t newlen;
27.
|
https://github.com/openssl/openssl/blob/84d5549e692e63a16fa1b11603e4098fc31746e9/ssl/packet.c/#L25
|
d2a_code_trace_data_42650
|
void av_close_input_stream(AVFormatContext *s)
{
int i;
AVStream *st;
if (s->cur_st && s->cur_st->parser)
av_free_packet(&s->cur_pkt);
if (s->iformat->read_close)
s->iformat->read_close(s);
for(i=0;i<s->nb_streams;i++) {
st = s->streams[i];
if (st->parser) {
av_parser_close(st->parser);
}
av_free(st->index_entries);
av_free(st->codec->extradata);
av_free(st->codec);
av_free(st->filename);
av_free(st);
}
for(i=s->nb_programs-1; i>=0; i--) {
av_freep(&s->programs[i]->provider_name);
av_freep(&s->programs[i]->name);
av_freep(&s->programs[i]->stream_index);
av_freep(&s->programs[i]);
}
flush_packet_queue(s);
av_freep(&s->priv_data);
av_free(s);
}
ffserver.c:2997: error: Integer Overflow L2
([0, +oo] - 1):unsigned32 by call to `close_connection`.
ffserver.c:2988:13: Call
2986. char session_id[32];
2987.
2988. rtp_c = find_rtp_session_with_url(url, h->session_id);
^
2989. if (!rtp_c) {
2990. rtsp_reply_error(c, RTSP_STATUS_SESSION);
ffserver.c:2912:9: Unknown value from: strcmp
2910. if (*path == '/')
2911. path++;
2912. if(!strcmp(path, rtp_c->stream->filename)) return rtp_c;
^
2913. for(s=0; s<rtp_c->stream->nb_streams; ++s) {
2914. snprintf(buf, sizeof(buf), "%s/streamid=%d",
ffserver.c:2994:5: Call
2992. }
2993.
2994. av_strlcpy(session_id, rtp_c->session_id, sizeof(session_id));
^
2995.
2996. /* abort the session */
libavutil/string.c:50:1: Parameter `*src`
48. }
49.
50. size_t av_strlcpy(char *dst, const char *src, size_t size)
^
51. {
52. size_t len = 0;
ffserver.c:2997:5: Call
2995.
2996. /* abort the session */
2997. close_connection(rtp_c);
^
2998.
2999. /* now everything is OK, so we can send the connection parameters */
ffserver.c:696:1: Parameter `c->fmt_in->nb_programs`
694. }
695.
696. static void close_connection(HTTPContext *c)
^
697. {
698. HTTPContext **cp, *c1;
ffserver.c:730:9: Call
728. avcodec_close(st->codec);
729. }
730. av_close_input_file(c->fmt_in);
^
731. }
732.
libavformat/utils.c:2152:1: Parameter `s->nb_programs`
2150. }
2151.
2152. void av_close_input_file(AVFormatContext *s)
^
2153. {
2154. ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb;
libavformat/utils.c:2155:5: Call
2153. {
2154. ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb;
2155. av_close_input_stream(s);
^
2156. if (pb)
2157. url_fclose(pb);
libavformat/utils.c:2118:1: <LHS trace>
2116. }
2117.
2118. void av_close_input_stream(AVFormatContext *s)
^
2119. {
2120. int i;
libavformat/utils.c:2118:1: Parameter `s->nb_programs`
2116. }
2117.
2118. void av_close_input_stream(AVFormatContext *s)
^
2119. {
2120. int i;
libavformat/utils.c:2141:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `close_connection`
2139. av_free(st);
2140. }
2141. for(i=s->nb_programs-1; i>=0; i--) {
^
2142. av_freep(&s->programs[i]->provider_name);
2143. av_freep(&s->programs[i]->name);
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/utils.c/#L2141
|
d2a_code_trace_data_42651
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/srp/srp_lib.c:147: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul`.
Showing all 19 steps of the trace
crypto/srp/srp_lib.c:145:10: Call
143. /* B = g**b + k*v */
144.
145. if (!BN_mod_exp(gb, g, b, N, bn_ctx)
^
146. || (k = srp_Calc_k(N, g)) == NULL
147. || !BN_mod_mul(kv, v, k, N, bn_ctx)
crypto/bn/bn_exp.c:90:1: Parameter `ctx->stack.depth`
88. }
89.
90. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
91. BN_CTX *ctx)
92. {
crypto/bn/bn_exp.c:147:19: Call
145. && (BN_get_flags(p, BN_FLG_CONSTTIME) == 0)) {
146. BN_ULONG A = a->d[0];
147. ret = BN_mod_exp_mont_word(r, A, p, m, ctx, NULL);
^
148. } else
149. # endif
crypto/bn/bn_exp.c:1097:1: Parameter `ctx->stack.depth`
1095. }
1096.
1097. > int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p,
1098. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
1099. {
crypto/srp/srp_lib.c:147:13: Call
145. if (!BN_mod_exp(gb, g, b, N, bn_ctx)
146. || (k = srp_Calc_k(N, g)) == NULL
147. || !BN_mod_mul(kv, v, k, N, bn_ctx)
^
148. || !BN_mod_add(B, gb, kv, N, bn_ctx)) {
149. BN_free(B);
crypto/bn/bn_mod.c:73:1: Parameter `ctx->stack.depth`
71.
72. /* slow but works */
73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
74. BN_CTX *ctx)
75. {
crypto/bn/bn_mod.c:83:5: Call
81. bn_check_top(m);
82.
83. BN_CTX_start(ctx);
^
84. if ((t = BN_CTX_get(ctx)) == NULL)
85. goto err;
crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_mod.c:87:14: Call
85. goto err;
86. if (a == b) {
87. if (!BN_sqr(t, a, ctx))
^
88. goto err;
89. } else {
crypto/bn/bn_sqr.c:32:5: Call
30. }
31.
32. BN_CTX_start(ctx);
^
33. rr = (a != r) ? r : BN_CTX_get(ctx);
34. tmp = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_sqr.c:99:5: Call
97. bn_check_top(rr);
98. bn_check_top(tmp);
99. BN_CTX_end(ctx);
^
100. return (ret);
101. }
crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.indexes`
193. }
194.
195. > void BN_CTX_end(BN_CTX *ctx)
196. {
197. CTXDBG_ENTRY("BN_CTX_end", ctx);
crypto/bn/bn_ctx.c:201:27: Call
199. ctx->err_stack--;
200. else {
201. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
202. /* Does this stack frame have anything to release? */
203. if (fp < ctx->used)
crypto/bn/bn_ctx.c:271:1: <Offset trace>
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:271:1: Parameter `st->depth`
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:271:1: <Length trace>
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:271:1: Parameter `*st->indexes`
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:273:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul`
271. static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
^
274. }
275.
|
https://github.com/openssl/openssl/blob/0685b15a68db1cd24678432f38b88f217495cbb9/crypto/bn/bn_ctx.c/#L273
|
d2a_code_trace_data_42652
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/ec/ecp_smpl.c:605: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end`.
Showing all 10 steps of the trace
crypto/ec/ecp_smpl.c:518:5: Call
516. }
517.
518. BN_CTX_start(ctx);
^
519. Z = BN_CTX_get(ctx);
520. Z_1 = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/ec/ecp_smpl.c:605:5: Call
603.
604. err:
605. BN_CTX_end(ctx);
^
606. BN_CTX_free(new_ctx);
607. return ret;
crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <Offset trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: <Length trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end`
266. static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
^
269. }
270.
|
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
|
d2a_code_trace_data_42653
|
static void
doapr_outch(char **sbuffer,
char **buffer, size_t *currlen, size_t *maxlen, int c)
{
assert(*sbuffer != NULL || buffer != NULL);
if (buffer) {
while (*currlen >= *maxlen) {
if (*buffer == NULL) {
if (*maxlen == 0)
*maxlen = 1024;
*buffer = OPENSSL_malloc(*maxlen);
if(!*buffer) {
return;
}
if (*currlen > 0) {
assert(*sbuffer != NULL);
memcpy(*buffer, *sbuffer, *currlen);
}
*sbuffer = NULL;
} else {
*maxlen += 1024;
*buffer = OPENSSL_realloc(*buffer, *maxlen);
if(!*buffer) {
return;
}
}
}
assert(*sbuffer != NULL || *buffer != NULL);
}
if (*currlen < *maxlen) {
if (*sbuffer)
(*sbuffer)[(*currlen)++] = (char)c;
else
(*buffer)[(*currlen)++] = (char)c;
}
return;
}
crypto/bio/bio_cb.c:86: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] (⇐ [-1, 2147483647] + [0, +oo]) Size: 256 by call to `BIO_snprintf`.
Showing all 14 steps of the trace
crypto/bio/bio_cb.c:66:1: Array declaration
64. #include <openssl/err.h>
65.
66. > long BIO_debug_callback(BIO *bio, int cmd, const char *argp,
67. int argi, long argl, long ret)
68. {
crypto/bio/bio_cb.c:81:5: Assignment
79. len = BIO_snprintf(buf,sizeof buf,"BIO[%p]: ",(void *)bio);
80.
81. p = buf + len;
^
82. p_maxlen = sizeof(buf) - len;
83.
crypto/bio/bio_cb.c:86:9: Call
84. switch (cmd) {
85. case BIO_CB_FREE:
86. BIO_snprintf(p, p_maxlen, "Free - %s\n", bio->method->name);
^
87. break;
88. case BIO_CB_READ:
crypto/bio/b_print.c:794:1: Parameter `*buf`
792. * function should be renamed, but to what?)
793. */
794. > int BIO_snprintf(char *buf, size_t n, const char *format, ...)
795. {
796. va_list args;
crypto/bio/b_print.c:801:11: Call
799. va_start(args, format);
800.
801. ret = BIO_vsnprintf(buf, n, format, args);
^
802.
803. va_end(args);
crypto/bio/b_print.c:807:1: Parameter `*buf`
805. }
806.
807. > int BIO_vsnprintf(char *buf, size_t n, const char *format, va_list args)
808. {
809. size_t retlen;
crypto/bio/b_print.c:812:5: Call
810. int truncated;
811.
812. _dopr(&buf, NULL, &n, &retlen, &truncated, format, args);
^
813.
814. if (truncated)
crypto/bio/b_print.c:168:1: Parameter `*maxlen`
166. #define OSSL_MAX(p,q) ((p >= q) ? p : q)
167.
168. > static void
169. _dopr(char **sbuffer,
170. char **buffer,
crypto/bio/b_print.c:199:17: Call
197. state = DP_S_FLAGS;
198. else
199. doapr_outch(sbuffer, buffer, &currlen, maxlen, ch);
^
200. ch = *format++;
201. break;
crypto/bio/b_print.c:703:1: <Offset trace>
701. }
702.
703. > static void
704. doapr_outch(char **sbuffer,
705. char **buffer, size_t *currlen, size_t *maxlen, int c)
crypto/bio/b_print.c:703:1: Parameter `*maxlen`
701. }
702.
703. > static void
704. doapr_outch(char **sbuffer,
705. char **buffer, size_t *currlen, size_t *maxlen, int c)
crypto/bio/b_print.c:703:1: <Length trace>
701. }
702.
703. > static void
704. doapr_outch(char **sbuffer,
705. char **buffer, size_t *currlen, size_t *maxlen, int c)
crypto/bio/b_print.c:703:1: Parameter `**sbuffer`
701. }
702.
703. > static void
704. doapr_outch(char **sbuffer,
705. char **buffer, size_t *currlen, size_t *maxlen, int c)
crypto/bio/b_print.c:740:13: Array access: Offset: [-1, +oo] (⇐ [-1, 2147483647] + [0, +oo]) Size: 256 by call to `BIO_snprintf`
738. if (*currlen < *maxlen) {
739. if (*sbuffer)
740. (*sbuffer)[(*currlen)++] = (char)c;
^
741. else
742. (*buffer)[(*currlen)++] = (char)c;
|
https://github.com/openssl/openssl/blob/ac5a110621ca48f0bebd5b4d76d081de403da29e/crypto/bio/b_print.c/#L740
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.