id stringlengths 25 25 | content stringlengths 649 72.1k | max_stars_repo_path stringlengths 91 133 |
|---|---|---|
d2a_code_trace_data_42354 | static void unpack_input(const unsigned char *input, unsigned int *output)
{
unsigned int outbuffer[28];
unsigned short inbuffer[10];
unsigned int x;
unsigned int *ptr;
for (x=0;x<20;x+=2)
inbuffer[x/2]=(input[x]<<8)+input[x+1];
ptr=outbuffer;
*(ptr++)=27;
*(ptr++)=(inbuffer[0]>>10)&0x3f;
*(ptr++)=(inbuffer[0]>>5)&0x1f;
*(ptr++)=inbuffer[0]&0x1f;
*(ptr++)=(inbuffer[1]>>12)&0xf;
*(ptr++)=(inbuffer[1]>>8)&0xf;
*(ptr++)=(inbuffer[1]>>5)&7;
*(ptr++)=(inbuffer[1]>>2)&7;
*(ptr++)=((inbuffer[1]<<1)&6)|((inbuffer[2]>>15)&1);
*(ptr++)=(inbuffer[2]>>12)&7;
*(ptr++)=(inbuffer[2]>>10)&3;
*(ptr++)=(inbuffer[2]>>5)&0x1f;
*(ptr++)=((inbuffer[2]<<2)&0x7c)|((inbuffer[3]>>14)&3);
*(ptr++)=(inbuffer[3]>>6)&0xff;
*(ptr++)=((inbuffer[3]<<1)&0x7e)|((inbuffer[4]>>15)&1);
*(ptr++)=(inbuffer[4]>>8)&0x7f;
*(ptr++)=(inbuffer[4]>>1)&0x7f;
*(ptr++)=((inbuffer[4]<<7)&0x80)|((inbuffer[5]>>9)&0x7f);
*(ptr++)=(inbuffer[5]>>2)&0x7f;
*(ptr++)=((inbuffer[5]<<5)&0x60)|((inbuffer[6]>>11)&0x1f);
*(ptr++)=(inbuffer[6]>>4)&0x7f;
*(ptr++)=((inbuffer[6]<<4)&0xf0)|((inbuffer[7]>>12)&0xf);
*(ptr++)=(inbuffer[7]>>5)&0x7f;
*(ptr++)=((inbuffer[7]<<2)&0x7c)|((inbuffer[8]>>14)&3);
*(ptr++)=(inbuffer[8]>>7)&0x7f;
*(ptr++)=((inbuffer[8]<<1)&0xfe)|((inbuffer[9]>>15)&1);
*(ptr++)=(inbuffer[9]>>8)&0x7f;
*(ptr++)=(inbuffer[9]>>1)&0x7f;
*(output++)=outbuffer[11];
for (x=1;x<11;*(output++)=outbuffer[x++]);
ptr=outbuffer+12;
for (x=0;x<16;x+=4)
{
*(output++)=ptr[x];
*(output++)=ptr[x+2];
*(output++)=ptr[x+3];
*(output++)=ptr[x+1];
}
}
libavcodec/ra144.c:292: error: Uninitialized Value
The value read from inbuffer[_] was never initialized.
libavcodec/ra144.c:292:3:
290. *(ptr++)=((inbuffer[7]<<2)&0x7c)|((inbuffer[8]>>14)&3);
291. *(ptr++)=(inbuffer[8]>>7)&0x7f;
292. *(ptr++)=((inbuffer[8]<<1)&0xfe)|((inbuffer[9]>>15)&1);
^
293. *(ptr++)=(inbuffer[9]>>8)&0x7f;
294. *(ptr++)=(inbuffer[9]>>1)&0x7f;
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ra144.c/#L292 |
d2a_code_trace_data_42355 | static void contract(OPENSSL_LHASH *lh)
{
OPENSSL_LH_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 = OPENSSL_realloc(lh->b,
(unsigned int)(sizeof(OPENSSL_LH_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;
}
}
include/openssl/lhash.h:197: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `OPENSSL_LH_delete`.
Showing all 10 steps of the trace
include/openssl/lhash.h:197:1: Parameter `lh->pmax`
195. LHASH_OF(type)
196.
197. > DEFINE_LHASH_OF(OPENSSL_STRING);
198. DEFINE_LHASH_OF(OPENSSL_CSTRING);
199.
include/openssl/lhash.h:197:1: Call
195. LHASH_OF(type)
196.
197. > DEFINE_LHASH_OF(OPENSSL_STRING);
198. DEFINE_LHASH_OF(OPENSSL_CSTRING);
199.
crypto/lhash/lhash.c:103:1: Parameter `lh->pmax`
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:126:9: Call
124. if ((lh->num_nodes > MIN_NODES) &&
125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
126. contract(lh);
^
127.
128. return (ret);
crypto/lhash/lhash.c:232:1: <Offset trace>
230. }
231.
232. > static void contract(OPENSSL_LHASH *lh)
233. {
234. OPENSSL_LH_NODE **n, *n1, *np;
crypto/lhash/lhash.c:232:1: Parameter `lh->p`
230. }
231.
232. > static void contract(OPENSSL_LHASH *lh)
233. {
234. OPENSSL_LH_NODE **n, *n1, *np;
crypto/lhash/lhash.c:252:9: Assignment
250. lh->b = n;
251. } else
252. lh->p--;
^
253.
254. lh->num_nodes--;
crypto/lhash/lhash.c:232:1: <Length trace>
230. }
231.
232. > static void contract(OPENSSL_LHASH *lh)
233. {
234. OPENSSL_LH_NODE **n, *n1, *np;
crypto/lhash/lhash.c:232:1: Parameter `*lh->b`
230. }
231.
232. > static void contract(OPENSSL_LHASH *lh)
233. {
234. OPENSSL_LH_NODE **n, *n1, *np;
crypto/lhash/lhash.c:257:10: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `OPENSSL_LH_delete`
255. lh->num_contracts++;
256.
257. n1 = lh->b[(int)lh->p];
^
258. if (n1 == NULL)
259. lh->b[(int)lh->p] = np;
| https://github.com/openssl/openssl/blob/1b8f19379a521ec11ce37e12316dd3edc0acfb82/crypto/lhash/lhash.c/#L257 |
d2a_code_trace_data_42356 | int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx,
unsigned char *md_out,
size_t *md_out_size,
const unsigned char header[13],
const unsigned char *data,
size_t data_plus_mac_size,
size_t data_plus_mac_plus_padding_size,
const unsigned char *mac_secret,
size_t mac_secret_length, char is_sslv3)
{
union {
double align;
unsigned char c[sizeof(LARGEST_DIGEST_CTX)];
} md_state;
void (*md_final_raw) (void *ctx, unsigned char *md_out);
void (*md_transform) (void *ctx, const unsigned char *block);
size_t md_size, md_block_size = 64;
size_t sslv3_pad_length = 40, header_length, variance_blocks,
len, max_mac_bytes, num_blocks,
num_starting_blocks, k, mac_end_offset, c, index_a, index_b;
size_t bits;
unsigned char length_bytes[MAX_HASH_BIT_COUNT_BYTES];
unsigned char hmac_pad[MAX_HASH_BLOCK_SIZE];
unsigned char first_block[MAX_HASH_BLOCK_SIZE];
unsigned char mac_out[EVP_MAX_MD_SIZE];
size_t i, j;
unsigned md_out_size_u;
EVP_MD_CTX *md_ctx = NULL;
size_t md_length_size = 8;
char length_is_big_endian = 1;
int ret;
OPENSSL_assert(data_plus_mac_plus_padding_size < 1024 * 1024);
switch (EVP_MD_CTX_type(ctx)) {
case NID_md5:
if (MD5_Init((MD5_CTX *)md_state.c) <= 0)
return 0;
md_final_raw = tls1_md5_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))MD5_Transform;
md_size = 16;
sslv3_pad_length = 48;
length_is_big_endian = 0;
break;
case NID_sha1:
if (SHA1_Init((SHA_CTX *)md_state.c) <= 0)
return 0;
md_final_raw = tls1_sha1_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))SHA1_Transform;
md_size = 20;
break;
case NID_sha224:
if (SHA224_Init((SHA256_CTX *)md_state.c) <= 0)
return 0;
md_final_raw = tls1_sha256_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))SHA256_Transform;
md_size = 224 / 8;
break;
case NID_sha256:
if (SHA256_Init((SHA256_CTX *)md_state.c) <= 0)
return 0;
md_final_raw = tls1_sha256_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))SHA256_Transform;
md_size = 32;
break;
case NID_sha384:
if (SHA384_Init((SHA512_CTX *)md_state.c) <= 0)
return 0;
md_final_raw = tls1_sha512_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))SHA512_Transform;
md_size = 384 / 8;
md_block_size = 128;
md_length_size = 16;
break;
case NID_sha512:
if (SHA512_Init((SHA512_CTX *)md_state.c) <= 0)
return 0;
md_final_raw = tls1_sha512_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))SHA512_Transform;
md_size = 64;
md_block_size = 128;
md_length_size = 16;
break;
default:
OPENSSL_assert(0);
if (md_out_size)
*md_out_size = 0;
return 0;
}
OPENSSL_assert(md_length_size <= MAX_HASH_BIT_COUNT_BYTES);
OPENSSL_assert(md_block_size <= MAX_HASH_BLOCK_SIZE);
OPENSSL_assert(md_size <= EVP_MAX_MD_SIZE);
header_length = 13;
if (is_sslv3) {
header_length = mac_secret_length + sslv3_pad_length + 8 +
1 +
2 ;
}
variance_blocks = is_sslv3 ? 2 : 6;
len = data_plus_mac_plus_padding_size + header_length;
max_mac_bytes = len - md_size - 1;
num_blocks =
(max_mac_bytes + 1 + md_length_size + md_block_size -
1) / md_block_size;
num_starting_blocks = 0;
k = 0;
mac_end_offset = data_plus_mac_size + header_length - md_size;
c = mac_end_offset % md_block_size;
index_a = mac_end_offset / md_block_size;
index_b = (mac_end_offset + md_length_size) / md_block_size;
if (num_blocks > variance_blocks + (is_sslv3 ? 1 : 0)) {
num_starting_blocks = num_blocks - variance_blocks;
k = md_block_size * num_starting_blocks;
}
bits = 8 * mac_end_offset;
if (!is_sslv3) {
bits += 8 * md_block_size;
memset(hmac_pad, 0, md_block_size);
OPENSSL_assert(mac_secret_length <= sizeof(hmac_pad));
memcpy(hmac_pad, mac_secret, mac_secret_length);
for (i = 0; i < md_block_size; i++)
hmac_pad[i] ^= 0x36;
md_transform(md_state.c, hmac_pad);
}
if (length_is_big_endian) {
memset(length_bytes, 0, md_length_size - 4);
length_bytes[md_length_size - 4] = (unsigned char)(bits >> 24);
length_bytes[md_length_size - 3] = (unsigned char)(bits >> 16);
length_bytes[md_length_size - 2] = (unsigned char)(bits >> 8);
length_bytes[md_length_size - 1] = (unsigned char)bits;
} else {
memset(length_bytes, 0, md_length_size);
length_bytes[md_length_size - 5] = (unsigned char)(bits >> 24);
length_bytes[md_length_size - 6] = (unsigned char)(bits >> 16);
length_bytes[md_length_size - 7] = (unsigned char)(bits >> 8);
length_bytes[md_length_size - 8] = (unsigned char)bits;
}
if (k > 0) {
if (is_sslv3) {
size_t overhang;
if (header_length <= md_block_size) {
return 0;
}
overhang = header_length - md_block_size;
md_transform(md_state.c, header);
memcpy(first_block, header + md_block_size, overhang);
memcpy(first_block + overhang, data, md_block_size - overhang);
md_transform(md_state.c, first_block);
for (i = 1; i < k / md_block_size - 1; i++)
md_transform(md_state.c, data + md_block_size * i - overhang);
} else {
memcpy(first_block, header, 13);
memcpy(first_block + 13, data, md_block_size - 13);
md_transform(md_state.c, first_block);
for (i = 1; i < k / md_block_size; i++)
md_transform(md_state.c, data + md_block_size * i - 13);
}
}
memset(mac_out, 0, sizeof(mac_out));
for (i = num_starting_blocks; i <= num_starting_blocks + variance_blocks;
i++) {
unsigned char block[MAX_HASH_BLOCK_SIZE];
unsigned char is_block_a = constant_time_eq_8_s(i, index_a);
unsigned char is_block_b = constant_time_eq_8_s(i, index_b);
for (j = 0; j < md_block_size; j++) {
unsigned char b = 0, is_past_c, is_past_cp1;
if (k < header_length)
b = header[k];
else if (k < data_plus_mac_plus_padding_size + header_length)
b = data[k - header_length];
k++;
is_past_c = is_block_a & constant_time_ge_8_s(j, c);
is_past_cp1 = is_block_a & constant_time_ge_8_s(j, c + 1);
b = constant_time_select_8(is_past_c, 0x80, b);
b = b & ~is_past_cp1;
b &= ~is_block_b | is_block_a;
if (j >= md_block_size - md_length_size) {
b = constant_time_select_8(is_block_b,
length_bytes[j -
(md_block_size -
md_length_size)], b);
}
block[j] = b;
}
md_transform(md_state.c, block);
md_final_raw(md_state.c, block);
for (j = 0; j < md_size; j++)
mac_out[j] |= block[j] & is_block_b;
}
md_ctx = EVP_MD_CTX_new();
if (md_ctx == NULL)
goto err;
if (EVP_DigestInit_ex(md_ctx, EVP_MD_CTX_md(ctx), NULL ) <= 0)
goto err;
if (is_sslv3) {
memset(hmac_pad, 0x5c, sslv3_pad_length);
if (EVP_DigestUpdate(md_ctx, mac_secret, mac_secret_length) <= 0
|| EVP_DigestUpdate(md_ctx, hmac_pad, sslv3_pad_length) <= 0
|| EVP_DigestUpdate(md_ctx, mac_out, md_size) <= 0)
goto err;
} else {
for (i = 0; i < md_block_size; i++)
hmac_pad[i] ^= 0x6a;
if (EVP_DigestUpdate(md_ctx, hmac_pad, md_block_size) <= 0
|| EVP_DigestUpdate(md_ctx, mac_out, md_size) <= 0)
goto err;
}
ret = EVP_DigestFinal(md_ctx, md_out, &md_out_size_u);
if (ret && md_out_size)
*md_out_size = md_out_size_u;
EVP_MD_CTX_free(md_ctx);
return 1;
err:
EVP_MD_CTX_free(md_ctx);
return 0;
}
ssl/s3_cbc.c:410: error: INTEGER_OVERFLOW_L2
([13, `mac_secret_length` + 1048633] - [14-min(1, `data_plus_mac_plus_padding_size`), `mac_secret_length` + 59]):unsigned64.
Showing all 5 steps of the trace
ssl/s3_cbc.c:129:1: <LHS trace>
127. * Returns 1 on success or 0 on error
128. */
129. > int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx,
130. unsigned char *md_out,
131. size_t *md_out_size,
ssl/s3_cbc.c:129:1: Parameter `data_plus_mac_plus_padding_size`
127. * Returns 1 on success or 0 on error
128. */
129. > int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx,
130. unsigned char *md_out,
131. size_t *md_out_size,
ssl/s3_cbc.c:129:1: <RHS trace>
127. * Returns 1 on success or 0 on error
128. */
129. > int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx,
130. unsigned char *md_out,
131. size_t *md_out_size,
ssl/s3_cbc.c:129:1: Parameter `data_plus_mac_plus_padding_size`
127. * Returns 1 on success or 0 on error
128. */
129. > int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx,
130. unsigned char *md_out,
131. size_t *md_out_size,
ssl/s3_cbc.c:410:21: Binary operation: ([13, mac_secret_length + 1048633] - [14-min(1, data_plus_mac_plus_padding_size), mac_secret_length + 59]):unsigned64
408. b = header[k];
409. else if (k < data_plus_mac_plus_padding_size + header_length)
410. b = data[k - header_length];
^
411. k++;
412.
| https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/ssl/s3_cbc.c/#L410 |
d2a_code_trace_data_42357 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
test/ectest.c:95: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mul`.
Showing all 13 steps of the trace
test/ectest.c:68:13: Call
66. || !TEST_true(EC_POINT_mul(group, Q, order, NULL, NULL, ctx))
67. || !TEST_true(EC_POINT_is_at_infinity(group, Q))
68. || !TEST_true(EC_GROUP_precompute_mult(group, ctx))
^
69. || !TEST_true(EC_POINT_mul(group, Q, order, NULL, NULL, ctx))
70. || !TEST_true(EC_POINT_is_at_infinity(group, Q)))
crypto/ec/ec_lib.c:941:1: Parameter `ctx->stack.depth`
939. }
940.
941. > int EC_GROUP_precompute_mult(EC_GROUP *group, BN_CTX *ctx)
942. {
943. if (group->meth->mul == 0)
test/ectest.c:95:17: Call
93.
94. /* n2 = (1 - order) * (1 + order) = 1 - order^2 */
95. || !TEST_true(BN_mul(n2, n1, n2, ctx))
^
96. || !TEST_true(EC_POINT_mul(group, Q, NULL, P, n2, ctx))
97. || !TEST_int_eq(0, EC_POINT_cmp(group, Q, P, ctx)))
crypto/bn/bn_mul.c:521:5: Call
519. top = al + bl;
520.
521. BN_CTX_start(ctx);
^
522. if ((r == a) || (r == b)) {
523. if ((rr = BN_CTX_get(ctx)) == NULL)
crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_mul.c:646:5: Call
644. err:
645. bn_check_top(r);
646. BN_CTX_end(ctx);
^
647. return (ret);
648. }
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_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/7671342e550ed2de676b23c79d0e7f45a381c76e/crypto/bn/bn_ctx.c/#L273 |
d2a_code_trace_data_42358 | static int mac_test_init(EVP_TEST *t, const char *alg)
{
int type;
MAC_DATA *mdat;
if (strcmp(alg, "HMAC") == 0) {
type = EVP_PKEY_HMAC;
} else if (strcmp(alg, "CMAC") == 0) {
#ifndef OPENSSL_NO_CMAC
type = EVP_PKEY_CMAC;
#else
t->skip = 1;
return 1;
#endif
} else if (strcmp(alg, "Poly1305") == 0) {
#ifndef OPENSSL_NO_POLY1305
type = EVP_PKEY_POLY1305;
#else
t->skip = 1;
return 1;
#endif
} else if (strcmp(alg, "SipHash") == 0) {
#ifndef OPENSSL_NO_SIPHASH
type = EVP_PKEY_SIPHASH;
#else
t->skip = 1;
return 1;
#endif
} else
return 0;
mdat = OPENSSL_zalloc(sizeof(*mdat));
mdat->type = type;
t->data = mdat;
return 1;
}
test/evp_test.c:1150: error: NULL_DEREFERENCE
pointer `mdat` last assigned on line 1149 could be null and is dereferenced at line 1150, column 5.
Showing all 16 steps of the trace
test/evp_test.c:1118:1: start of procedure mac_test_init()
1116. } MAC_DATA;
1117.
1118. > static int mac_test_init(EVP_TEST *t, const char *alg)
1119. {
1120. int type;
test/evp_test.c:1123:9: Taking true branch
1121. MAC_DATA *mdat;
1122.
1123. if (strcmp(alg, "HMAC") == 0) {
^
1124. type = EVP_PKEY_HMAC;
1125. } else if (strcmp(alg, "CMAC") == 0) {
test/evp_test.c:1124:9:
1122.
1123. if (strcmp(alg, "HMAC") == 0) {
1124. > type = EVP_PKEY_HMAC;
1125. } else if (strcmp(alg, "CMAC") == 0) {
1126. #ifndef OPENSSL_NO_CMAC
test/evp_test.c:1149:5:
1147. return 0;
1148.
1149. > mdat = OPENSSL_zalloc(sizeof(*mdat));
1150. mdat->type = type;
1151. t->data = mdat;
crypto/mem.c:186:1: start of procedure CRYPTO_zalloc()
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:5:
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:158:1: start of procedure CRYPTO_malloc()
156. #endif
157.
158. > void *CRYPTO_malloc(size_t num, const char *file, int line)
159. {
160. void *ret = NULL;
crypto/mem.c:160:5:
158. void *CRYPTO_malloc(size_t num, const char *file, int line)
159. {
160. > void *ret = NULL;
161.
162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
crypto/mem.c:162:9: Taking true branch
160. void *ret = NULL;
161.
162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
163. return malloc_impl(num, file, line);
164.
crypto/mem.c:162:32: Taking true branch
160. void *ret = NULL;
161.
162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
163. return malloc_impl(num, file, line);
164.
crypto/mem.c:163:9: Skipping __function_pointer__(): unresolved function pointer
161.
162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
163. return malloc_impl(num, file, line);
^
164.
165. if (num == 0)
crypto/mem.c:184:1: return from a call to CRYPTO_malloc
182.
183. return ret;
184. > }
185.
186. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:191:9: Taking false branch
189.
190. FAILTEST();
191. if (ret != NULL)
^
192. memset(ret, 0, num);
193. return ret;
crypto/mem.c:193:5:
191. if (ret != NULL)
192. memset(ret, 0, num);
193. > return ret;
194. }
195.
crypto/mem.c:194:1: return from a call to CRYPTO_zalloc
192. memset(ret, 0, num);
193. return ret;
194. > }
195.
196. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
test/evp_test.c:1150:5:
1148.
1149. mdat = OPENSSL_zalloc(sizeof(*mdat));
1150. > mdat->type = type;
1151. t->data = mdat;
1152. return 1;
| https://github.com/openssl/openssl/blob/69b4c01fd26e6eb72b156ed3014522c3295a7669/test/evp_test.c/#L1150 |
d2a_code_trace_data_42359 | BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
{
bn_check_top(b);
if (a == b)
return a;
if (bn_wexpand(a, b->top) == NULL)
return NULL;
if (b->top > 0)
memcpy(a->d, b->d, sizeof(b->d[0]) * b->top);
a->neg = b->neg;
a->top = b->top;
a->flags |= b->flags & BN_FLG_FIXED_TOP;
bn_check_top(a);
return a;
}
test/ectest.c:1140: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 536870848] by call to `EC_GROUP_check`.
Showing all 24 steps of the trace
test/ectest.c:1135:10: Call
1133. int nid = curves[n].nid;
1134.
1135. if (!TEST_ptr(group = EC_GROUP_new_by_curve_name(nid))) {
^
1136. TEST_info("EC_GROUP_new_curve_name() failed with curve %s\n",
1137. OBJ_nid2sn(nid));
crypto/ec/ec_curve.c:3131:19: Call
3129. for (i = 0; i < curve_list_length; i++)
3130. if (curve_list[i].nid == nid) {
3131. ret = ec_group_new_from_data(curve_list[i]);
^
3132. break;
3133. }
crypto/ec/ec_curve.c:3042:14: Call
3040. params += seed_len; /* skip seed */
3041.
3042. if ((p = BN_bin2bn(params + 0 * param_len, param_len, NULL)) == NULL
^
3043. || (a = BN_bin2bn(params + 1 * param_len, param_len, NULL)) == NULL
3044. || (b = BN_bin2bn(params + 2 * param_len, param_len, NULL)) == NULL) {
crypto/bn/bn_lib.c:374:1: Parameter `ret->top`
372. }
373.
374. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
375. {
376. unsigned int i, m;
test/ectest.c:1140:10: Call
1138. return 0;
1139. }
1140. if (!TEST_true(EC_GROUP_check(group, NULL))) {
^
1141. TEST_info("EC_GROUP_check() failed with curve %s\n", OBJ_nid2sn(nid));
1142. EC_GROUP_free(group);
crypto/ec/ec_check.c:23:1: Parameter `group->order->top`
21. }
22.
23. > int EC_GROUP_check(const EC_GROUP *group, BN_CTX *ctx)
24. {
25. int ret = 0;
crypto/ec/ec_check.c:69:9: Call
67. if (order == NULL)
68. goto err;
69. if (BN_is_zero(order)) {
^
70. ECerr(EC_F_EC_GROUP_CHECK, EC_R_UNDEFINED_ORDER);
71. goto err;
crypto/bn/bn_lib.c:866:1: Parameter `a->top`
864. }
865.
866. > int BN_is_zero(const BIGNUM *a)
867. {
868. return a->top == 0;
crypto/ec/ec_check.c:74:10: Call
72. }
73.
74. if (!EC_POINT_mul(group, point, order, NULL, NULL, ctx))
^
75. goto err;
76. if (!EC_POINT_is_at_infinity(group, point)) {
crypto/ec/ec_lib.c:971:1: Parameter `g_scalar->top`
969. }
970.
971. > int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar,
972. const EC_POINT *point, const BIGNUM *p_scalar, BN_CTX *ctx)
973. {
crypto/ec/ec_lib.c:982:12: Call
980. scalars[0] = p_scalar;
981.
982. return EC_POINTs_mul(group, r, g_scalar,
^
983. (point != NULL
984. && p_scalar != NULL), points, scalars, ctx);
crypto/ec/ec_lib.c:933:1: Parameter `scalar->top`
931. */
932.
933. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
934. size_t num, const EC_POINT *points[],
935. const BIGNUM *scalars[], BN_CTX *ctx)
crypto/ec/ec_lib.c:965:15: Call
963. else
964. /* use default */
965. ret = ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx);
^
966.
967. BN_CTX_free(new_ctx);
crypto/ec/ec_mult.c:410:1: Parameter `scalar->top`
408. * in the addition if scalar != NULL
409. */
410. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
411. size_t num, const EC_POINT *points[], const BIGNUM *scalars[],
412. BN_CTX *ctx)
crypto/ec/ec_mult.c:453:20: Call
451. * always call the ladder version.
452. */
453. return ec_scalar_mul_ladder(group, r, scalar, NULL, ctx);
^
454. }
455. if ((scalar == NULL) && (num == 1) && (scalars[0] != group->order)) {
crypto/ec/ec_mult.c:139:1: Parameter `scalar->top`
137. * Returns 1 on success, 0 otherwise.
138. */
139. > int ec_scalar_mul_ladder(const EC_GROUP *group, EC_POINT *r,
140. const BIGNUM *scalar, const EC_POINT *point,
141. BN_CTX *ctx)
crypto/ec/ec_mult.c:215:10: Call
213. }
214.
215. if (!BN_copy(k, scalar)) {
^
216. ECerr(EC_F_EC_SCALAR_MUL_LADDER, ERR_R_BN_LIB);
217. goto err;
crypto/bn/bn_lib.c:281:1: <Offset trace>
279. }
280.
281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
282. {
283. bn_check_top(b);
crypto/bn/bn_lib.c:281:1: Parameter `b->top`
279. }
280.
281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
282. {
283. bn_check_top(b);
crypto/bn/bn_lib.c:281:1: <Length trace>
279. }
280.
281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
282. {
283. bn_check_top(b);
crypto/bn/bn_lib.c:281:1: Parameter `*a->d`
279. }
280.
281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
282. {
283. bn_check_top(b);
crypto/bn/bn_lib.c:287:9: Call
285. if (a == b)
286. return a;
287. if (bn_wexpand(a, b->top) == NULL)
^
288. return NULL;
289.
crypto/bn/bn_lib.c:962:1: Parameter `*a->d`
960. }
961.
962. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
963. {
964. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_lib.c:291:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `EC_GROUP_check`
289.
290. if (b->top > 0)
291. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top);
^
292.
293. a->neg = b->neg;
| https://github.com/openssl/openssl/blob/3051bf2afab7ac8b7b9c64e68755d1addd2fb8ff/crypto/bn/bn_lib.c/#L291 |
d2a_code_trace_data_42360 | static ossl_inline unsigned int constant_time_lt(unsigned int a,
unsigned int b)
{
return constant_time_msb(a ^ ((a ^ b) | ((a - b) ^ b)));
}
crypto/rsa/rsa_ssl.c:125: error: INTEGER_OVERFLOW_L2
([0, +oo] - 8):unsigned32 by call to `constant_time_ge`.
Showing all 9 steps of the trace
crypto/rsa/rsa_ssl.c:103:5: Assignment
101. /* scan over padding data */
102. found_zero_byte = 0;
103. threes_in_row = 0;
^
104. for (i = 2; i < num; i++) {
105. unsigned int equals0 = constant_time_is_zero(em[i]);
crypto/rsa/rsa_ssl.c:125:13: Call
123. mask = ~good;
124.
125. good &= constant_time_ge(threes_in_row, 8);
^
126. err = constant_time_select_int(mask | good, err,
127. RSA_R_SSLV3_ROLLBACK_ATTACK);
include/internal/constant_time_locl.h:142:1: Parameter `a`
140. }
141.
142. > static ossl_inline unsigned int constant_time_ge(unsigned int a,
143. unsigned int b)
144. {
include/internal/constant_time_locl.h:145:13: Call
143. unsigned int b)
144. {
145. return ~constant_time_lt(a, b);
^
146. }
147.
include/internal/constant_time_locl.h:120:1: <LHS trace>
118. }
119.
120. > static ossl_inline unsigned int constant_time_lt(unsigned int a,
121. unsigned int b)
122. {
include/internal/constant_time_locl.h:120:1: Parameter `a`
118. }
119.
120. > static ossl_inline unsigned int constant_time_lt(unsigned int a,
121. unsigned int b)
122. {
include/internal/constant_time_locl.h:120:1: <RHS trace>
118. }
119.
120. > static ossl_inline unsigned int constant_time_lt(unsigned int a,
121. unsigned int b)
122. {
include/internal/constant_time_locl.h:120:1: Parameter `b`
118. }
119.
120. > static ossl_inline unsigned int constant_time_lt(unsigned int a,
121. unsigned int b)
122. {
include/internal/constant_time_locl.h:123:12: Binary operation: ([0, +oo] - 8):unsigned32 by call to `constant_time_ge`
121. unsigned int b)
122. {
123. return constant_time_msb(a ^ ((a ^ b) | ((a - b) ^ b)));
^
124. }
125.
| https://github.com/openssl/openssl/blob/4c2883a9bf59c5ee31e8e2e101b3894a16c06950/include/internal/constant_time_locl.h/#L123 |
d2a_code_trace_data_42361 | static ngx_int_t
ngx_parse_unix_domain_url(ngx_pool_t *pool, ngx_url_t *u)
{
#if (NGX_HAVE_UNIX_DOMAIN)
u_char *path, *uri, *last;
size_t len;
struct sockaddr_un *saun;
len = u->url.len;
path = u->url.data;
path += 5;
len -= 5;
if (u->uri_part) {
last = path + len;
uri = ngx_strlchr(path, last, ':');
if (uri) {
len = uri - path;
uri++;
u->uri.len = last - uri;
u->uri.data = uri;
}
}
if (len == 0) {
u->err = "no path in the unix domain socket";
return NGX_ERROR;
}
u->host.len = len++;
u->host.data = path;
if (len > sizeof(saun->sun_path)) {
u->err = "too long path in the unix domain socket";
return NGX_ERROR;
}
u->socklen = sizeof(struct sockaddr_un);
saun = (struct sockaddr_un *) &u->sockaddr;
saun->sun_family = AF_UNIX;
(void) ngx_cpystrn((u_char *) saun->sun_path, path, len);
u->addrs = ngx_pcalloc(pool, sizeof(ngx_peer_addr_t));
if (u->addrs == NULL) {
return NGX_ERROR;
}
saun = ngx_pcalloc(pool, sizeof(struct sockaddr_un));
if (saun == NULL) {
return NGX_ERROR;
}
u->family = AF_UNIX;
u->naddrs = 1;
saun->sun_family = AF_UNIX;
(void) ngx_cpystrn((u_char *) saun->sun_path, path, len);
u->addrs[0].sockaddr = (struct sockaddr *) saun;
u->addrs[0].socklen = sizeof(struct sockaddr_un);
u->addrs[0].name.len = len + 4;
u->addrs[0].name.data = u->url.data;
return NGX_OK;
#else
u->err = "the unix domain sockets are not supported on this platform";
return NGX_ERROR;
#endif
}
src/http/modules/ngx_http_fastcgi_module.c:2436: error: Integer Overflow L2
([0, +oo] - 5):unsigned64 by call to `ngx_http_upstream_add`.
src/http/modules/ngx_http_fastcgi_module.c:2436:31: Call
2434. u.no_resolve = 1;
2435.
2436. flcf->upstream.upstream = ngx_http_upstream_add(cf, &u, 0);
^
2437. if (flcf->upstream.upstream == NULL) {
2438. return NGX_CONF_ERROR;
src/http/ngx_http_upstream.c:3902:1: Parameter `u->url.len`
3900.
3901.
3902. ngx_http_upstream_srv_conf_t *
^
3903. ngx_http_upstream_add(ngx_conf_t *cf, ngx_url_t *u, ngx_uint_t flags)
3904. {
src/http/ngx_http_upstream.c:3912:13: Call
3910. if (!(flags & NGX_HTTP_UPSTREAM_CREATE)) {
3911.
3912. if (ngx_parse_url(cf->pool, u) != NGX_OK) {
^
3913. if (u->err) {
3914. ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
src/core/ngx_inet.c:285:1: Parameter `u->url.len`
283.
284.
285. ngx_int_t
^
286. ngx_parse_url(ngx_pool_t *pool, ngx_url_t *u)
287. {
src/core/ngx_inet.c:293:16: Call
291.
292. if (ngx_strncasecmp(p, (u_char *) "unix:", 5) == 0) {
293. return ngx_parse_unix_domain_url(pool, u);
^
294. }
295.
src/core/ngx_inet.c:309:1: <LHS trace>
307.
308.
309. static ngx_int_t
^
310. ngx_parse_unix_domain_url(ngx_pool_t *pool, ngx_url_t *u)
311. {
src/core/ngx_inet.c:309:1: Parameter `u->url.len`
307.
308.
309. static ngx_int_t
^
310. ngx_parse_unix_domain_url(ngx_pool_t *pool, ngx_url_t *u)
311. {
src/core/ngx_inet.c:317:5: Assignment
315. struct sockaddr_un *saun;
316.
317. len = u->url.len;
^
318. path = u->url.data;
319.
src/core/ngx_inet.c:321:5: Binary operation: ([0, +oo] - 5):unsigned64 by call to `ngx_http_upstream_add`
319.
320. path += 5;
321. len -= 5;
^
322.
323. if (u->uri_part) {
| https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_inet.c/#L321 |
d2a_code_trace_data_42362 | u_char *
ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
{
u_char *p, zero, *last;
int d;
float f, scale;
size_t len, slen;
int64_t i64;
uint64_t ui64;
ngx_msec_t ms;
ngx_uint_t width, sign, hex, max_width, frac_width, i;
ngx_str_t *v;
ngx_variable_value_t *vv;
if (max == 0) {
return buf;
}
last = buf + max;
while (*fmt && buf < last) {
if (*fmt == '%') {
i64 = 0;
ui64 = 0;
zero = (u_char) ((*++fmt == '0') ? '0' : ' ');
width = 0;
sign = 1;
hex = 0;
max_width = 0;
frac_width = 0;
slen = (size_t) -1;
while (*fmt >= '0' && *fmt <= '9') {
width = width * 10 + *fmt++ - '0';
}
for ( ;; ) {
switch (*fmt) {
case 'u':
sign = 0;
fmt++;
continue;
case 'm':
max_width = 1;
fmt++;
continue;
case 'X':
hex = 2;
sign = 0;
fmt++;
continue;
case 'x':
hex = 1;
sign = 0;
fmt++;
continue;
case '.':
fmt++;
while (*fmt >= '0' && *fmt <= '9') {
frac_width = frac_width * 10 + *fmt++ - '0';
}
break;
case '*':
slen = va_arg(args, size_t);
fmt++;
continue;
default:
break;
}
break;
}
switch (*fmt) {
case 'V':
v = va_arg(args, ngx_str_t *);
len = v->len;
len = (buf + len < last) ? len : (size_t) (last - buf);
buf = ngx_cpymem(buf, v->data, len);
fmt++;
continue;
case 'v':
vv = va_arg(args, ngx_variable_value_t *);
len = vv->len;
len = (buf + len < last) ? len : (size_t) (last - buf);
buf = ngx_cpymem(buf, vv->data, len);
fmt++;
continue;
case 's':
p = va_arg(args, u_char *);
if (slen == (size_t) -1) {
while (*p && buf < last) {
*buf++ = *p++;
}
} else {
len = (buf + slen < last) ? slen : (size_t) (last - buf);
buf = ngx_cpymem(buf, p, len);
}
fmt++;
continue;
case 'O':
i64 = (int64_t) va_arg(args, off_t);
sign = 1;
break;
case 'P':
i64 = (int64_t) va_arg(args, ngx_pid_t);
sign = 1;
break;
case 'T':
i64 = (int64_t) va_arg(args, time_t);
sign = 1;
break;
case 'M':
ms = (ngx_msec_t) va_arg(args, ngx_msec_t);
if ((ngx_msec_int_t) ms == -1) {
sign = 1;
i64 = -1;
} else {
sign = 0;
ui64 = (uint64_t) ms;
}
break;
case 'z':
if (sign) {
i64 = (int64_t) va_arg(args, ssize_t);
} else {
ui64 = (uint64_t) va_arg(args, size_t);
}
break;
case 'i':
if (sign) {
i64 = (int64_t) va_arg(args, ngx_int_t);
} else {
ui64 = (uint64_t) va_arg(args, ngx_uint_t);
}
if (max_width) {
width = NGX_INT_T_LEN;
}
break;
case 'd':
if (sign) {
i64 = (int64_t) va_arg(args, int);
} else {
ui64 = (uint64_t) va_arg(args, u_int);
}
break;
case 'l':
if (sign) {
i64 = (int64_t) va_arg(args, long);
} else {
ui64 = (uint64_t) va_arg(args, u_long);
}
break;
case 'D':
if (sign) {
i64 = (int64_t) va_arg(args, int32_t);
} else {
ui64 = (uint64_t) va_arg(args, uint32_t);
}
break;
case 'L':
if (sign) {
i64 = va_arg(args, int64_t);
} else {
ui64 = va_arg(args, uint64_t);
}
break;
case 'A':
if (sign) {
i64 = (int64_t) va_arg(args, ngx_atomic_int_t);
} else {
ui64 = (uint64_t) va_arg(args, ngx_atomic_uint_t);
}
if (max_width) {
width = NGX_ATOMIC_T_LEN;
}
break;
case 'f':
f = (float) va_arg(args, double);
if (f < 0) {
*buf++ = '-';
f = -f;
}
ui64 = (int64_t) f;
buf = ngx_sprintf_num(buf, last, ui64, zero, 0, width);
if (frac_width) {
if (buf < last) {
*buf++ = '.';
}
scale = 1.0;
for (i = 0; i < frac_width; i++) {
scale *= 10.0;
}
ui64 = (uint64_t) ((f - (int64_t) ui64) * scale);
buf = ngx_sprintf_num(buf, last, ui64, '0', 0, frac_width);
}
fmt++;
continue;
#if !(NGX_WIN32)
case 'r':
i64 = (int64_t) va_arg(args, rlim_t);
sign = 1;
break;
#endif
case 'p':
ui64 = (uintptr_t) va_arg(args, void *);
hex = 2;
sign = 0;
zero = '0';
width = NGX_PTR_SIZE * 2;
break;
case 'c':
d = va_arg(args, int);
*buf++ = (u_char) (d & 0xff);
fmt++;
continue;
case 'Z':
*buf++ = '\0';
fmt++;
continue;
case 'N':
#if (NGX_WIN32)
*buf++ = CR;
#endif
*buf++ = LF;
fmt++;
continue;
case '%':
*buf++ = '%';
fmt++;
continue;
default:
*buf++ = *fmt++;
continue;
}
if (sign) {
if (i64 < 0) {
*buf++ = '-';
ui64 = (uint64_t) -i64;
} else {
ui64 = (uint64_t) i64;
}
}
buf = ngx_sprintf_num(buf, last, ui64, zero, hex, width);
fmt++;
} else {
*buf++ = *fmt++;
}
}
return buf;
}
src/http/modules/ngx_http_charset_filter_module.c:791: error: Buffer Overrun L3
Offset: [0, 65535] Size: [0, +oo] by call to `ngx_sprintf`.
src/http/modules/ngx_http_charset_filter_module.c:608:1: Parameter `*buf->last`
606.
607.
608. static ngx_chain_t *
^
609. ngx_http_charset_recode_from_utf8(ngx_pool_t *pool, ngx_buf_t *buf,
610. ngx_http_charset_ctx_t *ctx)
src/http/modules/ngx_http_charset_filter_module.c:757:5: Assignment
755. }
756.
757. size = buf->last - buf->pos;
^
758.
759. if (size < NGX_HTML_ENTITY_LEN) {
src/http/modules/ngx_http_charset_filter_module.c:763:10: Call
761. }
762.
763. cl = ngx_http_charset_get_buffer(pool, ctx, size);
^
764. if (cl == NULL) {
765. return NULL;
src/http/modules/ngx_http_charset_filter_module.c:1050:1: Parameter `size`
1048.
1049.
1050. static ngx_chain_t *
^
1051. ngx_http_charset_get_buffer(ngx_pool_t *pool, ngx_http_charset_ctx_t *ctx,
1052. size_t size)
src/http/modules/ngx_http_charset_filter_module.c:1080:15: Call
1078. }
1079.
1080. cl->buf = ngx_create_temp_buf(pool, size);
^
1081. if (cl->buf == NULL) {
1082. return NULL;
src/core/ngx_buf.c:11:1: Parameter `size`
9.
10.
11. ngx_buf_t *
^
12. ngx_create_temp_buf(ngx_pool_t *pool, size_t size)
13. {
src/core/ngx_buf.c:21:16: Call
19. }
20.
21. b->start = ngx_palloc(pool, size);
^
22. if (b->start == NULL) {
23. return NULL;
src/core/ngx_palloc.c:125:13: Assignment
123.
124. do {
125. m = ngx_align_ptr(p->d.last, NGX_ALIGNMENT);
^
126.
127. if ((size_t) (p->d.end - m) >= size) {
src/core/ngx_palloc.c:130:17: Assignment
128. p->d.last = m + size;
129.
130. return m;
^
131. }
132.
src/core/ngx_buf.c:21:5: Assignment
19. }
20.
21. b->start = ngx_palloc(pool, size);
^
22. if (b->start == NULL) {
23. return NULL;
src/core/ngx_buf.c:37:5: Assignment
35. */
36.
37. b->pos = b->start;
^
38. b->last = b->start;
39. b->end = b->last + size;
src/http/modules/ngx_http_charset_filter_module.c:771:5: Assignment
769.
770. b = cl->buf;
771. dst = b->pos;
^
772.
773. if (c) {
src/http/modules/ngx_http_charset_filter_module.c:791:15: Call
789.
790. } else {
791. dst = ngx_sprintf(dst, "&#%uD;", n);
^
792. }
793.
src/core/ngx_string.c:95:1: Parameter `*buf`
93.
94.
95. u_char * ngx_cdecl
^
96. ngx_sprintf(u_char *buf, const char *fmt, ...)
97. {
src/core/ngx_string.c:102:9: Call
100.
101. va_start(args, fmt);
102. p = ngx_vsnprintf(buf, /* STUB */ 65536, fmt, args);
^
103. va_end(args);
104.
src/core/ngx_string.c:123:1: <Length trace>
121.
122.
123. u_char *
^
124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
125. {
src/core/ngx_string.c:123:1: Parameter `*buf`
121.
122.
123. u_char *
^
124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
125. {
src/core/ngx_string.c:244:25: Array access: Offset: [0, 65535] Size: [0, +oo] by call to `ngx_sprintf`
242. if (slen == (size_t) -1) {
243. while (*p && buf < last) {
244. *buf++ = *p++;
^
245. }
246.
| https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_string.c/#L244 |
d2a_code_trace_data_42363 | int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx,
unsigned char *md_out,
size_t *md_out_size,
const unsigned char header[13],
const unsigned char *data,
size_t data_plus_mac_size,
size_t data_plus_mac_plus_padding_size,
const unsigned char *mac_secret,
size_t mac_secret_length, char is_sslv3)
{
union {
double align;
unsigned char c[sizeof(LARGEST_DIGEST_CTX)];
} md_state;
void (*md_final_raw) (void *ctx, unsigned char *md_out);
void (*md_transform) (void *ctx, const unsigned char *block);
size_t md_size, md_block_size = 64;
size_t sslv3_pad_length = 40, header_length, variance_blocks,
len, max_mac_bytes, num_blocks,
num_starting_blocks, k, mac_end_offset, c, index_a, index_b;
size_t bits;
unsigned char length_bytes[MAX_HASH_BIT_COUNT_BYTES];
unsigned char hmac_pad[MAX_HASH_BLOCK_SIZE];
unsigned char first_block[MAX_HASH_BLOCK_SIZE];
unsigned char mac_out[EVP_MAX_MD_SIZE];
size_t i, j;
unsigned md_out_size_u;
EVP_MD_CTX *md_ctx = NULL;
size_t md_length_size = 8;
char length_is_big_endian = 1;
int ret;
OPENSSL_assert(data_plus_mac_plus_padding_size < 1024 * 1024);
switch (EVP_MD_CTX_type(ctx)) {
case NID_md5:
if (MD5_Init((MD5_CTX *)md_state.c) <= 0)
return 0;
md_final_raw = tls1_md5_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))MD5_Transform;
md_size = 16;
sslv3_pad_length = 48;
length_is_big_endian = 0;
break;
case NID_sha1:
if (SHA1_Init((SHA_CTX *)md_state.c) <= 0)
return 0;
md_final_raw = tls1_sha1_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))SHA1_Transform;
md_size = 20;
break;
case NID_sha224:
if (SHA224_Init((SHA256_CTX *)md_state.c) <= 0)
return 0;
md_final_raw = tls1_sha256_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))SHA256_Transform;
md_size = 224 / 8;
break;
case NID_sha256:
if (SHA256_Init((SHA256_CTX *)md_state.c) <= 0)
return 0;
md_final_raw = tls1_sha256_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))SHA256_Transform;
md_size = 32;
break;
case NID_sha384:
if (SHA384_Init((SHA512_CTX *)md_state.c) <= 0)
return 0;
md_final_raw = tls1_sha512_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))SHA512_Transform;
md_size = 384 / 8;
md_block_size = 128;
md_length_size = 16;
break;
case NID_sha512:
if (SHA512_Init((SHA512_CTX *)md_state.c) <= 0)
return 0;
md_final_raw = tls1_sha512_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))SHA512_Transform;
md_size = 64;
md_block_size = 128;
md_length_size = 16;
break;
default:
OPENSSL_assert(0);
if (md_out_size)
*md_out_size = 0;
return 0;
}
OPENSSL_assert(md_length_size <= MAX_HASH_BIT_COUNT_BYTES);
OPENSSL_assert(md_block_size <= MAX_HASH_BLOCK_SIZE);
OPENSSL_assert(md_size <= EVP_MAX_MD_SIZE);
header_length = 13;
if (is_sslv3) {
header_length = mac_secret_length + sslv3_pad_length + 8 +
1 +
2 ;
}
variance_blocks = is_sslv3 ? 2 : 6;
len = data_plus_mac_plus_padding_size + header_length;
max_mac_bytes = len - md_size - 1;
num_blocks =
(max_mac_bytes + 1 + md_length_size + md_block_size -
1) / md_block_size;
num_starting_blocks = 0;
k = 0;
mac_end_offset = data_plus_mac_size + header_length - md_size;
c = mac_end_offset % md_block_size;
index_a = mac_end_offset / md_block_size;
index_b = (mac_end_offset + md_length_size) / md_block_size;
if (num_blocks > variance_blocks + (is_sslv3 ? 1 : 0)) {
num_starting_blocks = num_blocks - variance_blocks;
k = md_block_size * num_starting_blocks;
}
bits = 8 * mac_end_offset;
if (!is_sslv3) {
bits += 8 * md_block_size;
memset(hmac_pad, 0, md_block_size);
OPENSSL_assert(mac_secret_length <= sizeof(hmac_pad));
memcpy(hmac_pad, mac_secret, mac_secret_length);
for (i = 0; i < md_block_size; i++)
hmac_pad[i] ^= 0x36;
md_transform(md_state.c, hmac_pad);
}
if (length_is_big_endian) {
memset(length_bytes, 0, md_length_size - 4);
length_bytes[md_length_size - 4] = (unsigned char)(bits >> 24);
length_bytes[md_length_size - 3] = (unsigned char)(bits >> 16);
length_bytes[md_length_size - 2] = (unsigned char)(bits >> 8);
length_bytes[md_length_size - 1] = (unsigned char)bits;
} else {
memset(length_bytes, 0, md_length_size);
length_bytes[md_length_size - 5] = (unsigned char)(bits >> 24);
length_bytes[md_length_size - 6] = (unsigned char)(bits >> 16);
length_bytes[md_length_size - 7] = (unsigned char)(bits >> 8);
length_bytes[md_length_size - 8] = (unsigned char)bits;
}
if (k > 0) {
if (is_sslv3) {
size_t overhang;
if (header_length <= md_block_size) {
return 0;
}
overhang = header_length - md_block_size;
md_transform(md_state.c, header);
memcpy(first_block, header + md_block_size, overhang);
memcpy(first_block + overhang, data, md_block_size - overhang);
md_transform(md_state.c, first_block);
for (i = 1; i < k / md_block_size - 1; i++)
md_transform(md_state.c, data + md_block_size * i - overhang);
} else {
memcpy(first_block, header, 13);
memcpy(first_block + 13, data, md_block_size - 13);
md_transform(md_state.c, first_block);
for (i = 1; i < k / md_block_size; i++)
md_transform(md_state.c, data + md_block_size * i - 13);
}
}
memset(mac_out, 0, sizeof(mac_out));
for (i = num_starting_blocks; i <= num_starting_blocks + variance_blocks;
i++) {
unsigned char block[MAX_HASH_BLOCK_SIZE];
unsigned char is_block_a = constant_time_eq_8_s(i, index_a);
unsigned char is_block_b = constant_time_eq_8_s(i, index_b);
for (j = 0; j < md_block_size; j++) {
unsigned char b = 0, is_past_c, is_past_cp1;
if (k < header_length)
b = header[k];
else if (k < data_plus_mac_plus_padding_size + header_length)
b = data[k - header_length];
k++;
is_past_c = is_block_a & constant_time_ge_8_s(j, c);
is_past_cp1 = is_block_a & constant_time_ge_8_s(j, c + 1);
b = constant_time_select_8(is_past_c, 0x80, b);
b = b & ~is_past_cp1;
b &= ~is_block_b | is_block_a;
if (j >= md_block_size - md_length_size) {
b = constant_time_select_8(is_block_b,
length_bytes[j -
(md_block_size -
md_length_size)], b);
}
block[j] = b;
}
md_transform(md_state.c, block);
md_final_raw(md_state.c, block);
for (j = 0; j < md_size; j++)
mac_out[j] |= block[j] & is_block_b;
}
md_ctx = EVP_MD_CTX_new();
if (md_ctx == NULL)
goto err;
if (EVP_DigestInit_ex(md_ctx, EVP_MD_CTX_md(ctx), NULL ) <= 0)
goto err;
if (is_sslv3) {
memset(hmac_pad, 0x5c, sslv3_pad_length);
if (EVP_DigestUpdate(md_ctx, mac_secret, mac_secret_length) <= 0
|| EVP_DigestUpdate(md_ctx, hmac_pad, sslv3_pad_length) <= 0
|| EVP_DigestUpdate(md_ctx, mac_out, md_size) <= 0)
goto err;
} else {
for (i = 0; i < md_block_size; i++)
hmac_pad[i] ^= 0x6a;
if (EVP_DigestUpdate(md_ctx, hmac_pad, md_block_size) <= 0
|| EVP_DigestUpdate(md_ctx, mac_out, md_size) <= 0)
goto err;
}
ret = EVP_DigestFinal(md_ctx, md_out, &md_out_size_u);
if (ret && md_out_size)
*md_out_size = md_out_size_u;
EVP_MD_CTX_free(md_ctx);
return 1;
err:
EVP_MD_CTX_free(md_ctx);
return 0;
}
ssl/record/ssl3_record.c:1038: error: BUFFER_OVERRUN_L2
Offset added: [71-min(70, `ssl->s3->read_mac_secret_size`), `ssl->s3->read_mac_secret_size` + 123] (⇐ [64, 128] + [7-min(70, `ssl->s3->read_mac_secret_size`), `ssl->s3->read_mac_secret_size` - 5]) Size: 104 by call to `ssl3_cbc_digest_record`.
Showing all 8 steps of the trace
ssl/record/ssl3_record.c:978:1: Array declaration
976. }
977.
978. > int tls1_mac(SSL *ssl, SSL3_RECORD *rec, unsigned char *md, int send)
979. {
980. unsigned char *seq;
ssl/record/ssl3_record.c:1038:13: Call
1036. */
1037. /* Final param == not SSLv3 */
1038. if (ssl3_cbc_digest_record(mac_ctx,
^
1039. md, &md_size,
1040. header, rec->input,
ssl/s3_cbc.c:145:5: <Offset trace>
143. void (*md_final_raw) (void *ctx, unsigned char *md_out);
144. void (*md_transform) (void *ctx, const unsigned char *block);
145. size_t md_size, md_block_size = 64;
^
146. size_t sslv3_pad_length = 40, header_length, variance_blocks,
147. len, max_mac_bytes, num_blocks,
ssl/s3_cbc.c:145:5: Assignment
143. void (*md_final_raw) (void *ctx, unsigned char *md_out);
144. void (*md_transform) (void *ctx, const unsigned char *block);
145. size_t md_size, md_block_size = 64;
^
146. size_t sslv3_pad_length = 40, header_length, variance_blocks,
147. len, max_mac_bytes, num_blocks,
ssl/s3_cbc.c:375:13: Assignment
373. return 0;
374. }
375. overhang = header_length - md_block_size;
^
376. md_transform(md_state.c, header);
377. memcpy(first_block, header + md_block_size, overhang);
ssl/s3_cbc.c:129:1: <Length trace>
127. * Returns 1 on success or 0 on error
128. */
129. > int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx,
130. unsigned char *md_out,
131. size_t *md_out_size,
ssl/s3_cbc.c:129:1: Parameter `*header`
127. * Returns 1 on success or 0 on error
128. */
129. > int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx,
130. unsigned char *md_out,
131. size_t *md_out_size,
ssl/s3_cbc.c:377:13: Array access: Offset added: [71-min(70, ssl->s3->read_mac_secret_size), ssl->s3->read_mac_secret_size + 123] (⇐ [64, 128] + [7-min(70, ssl->s3->read_mac_secret_size), ssl->s3->read_mac_secret_size - 5]) Size: 104 by call to `ssl3_cbc_digest_record`
375. overhang = header_length - md_block_size;
376. md_transform(md_state.c, header);
377. memcpy(first_block, header + md_block_size, overhang);
^
378. memcpy(first_block + overhang, data, md_block_size - overhang);
379. md_transform(md_state.c, first_block);
| https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/ssl/s3_cbc.c/#L377 |
d2a_code_trace_data_42364 | static int srp_Verify_N_and_g(const BIGNUM *N, const BIGNUM *g)
{
BN_CTX *bn_ctx = BN_CTX_new();
BIGNUM *p = BN_new();
BIGNUM *r = BN_new();
int ret =
g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) &&
BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 &&
p != NULL && BN_rshift1(p, N) &&
BN_is_prime_ex(p, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 &&
r != NULL &&
BN_mod_exp(r, g, p, N, bn_ctx) &&
BN_add_word(r, 1) && BN_cmp(r, N) == 0;
BN_free(r);
BN_free(p);
BN_CTX_free(bn_ctx);
return ret;
}
apps/s_client.c:291: error: NULL_DEREFERENCE
pointer `bn_ctx` last assigned on line 275 could be null and is dereferenced by call to `BN_CTX_free()` at line 291, column 5.
Showing all 27 steps of the trace
apps/s_client.c:273:1: start of procedure srp_Verify_N_and_g()
271. # define SRP_NUMBER_ITERATIONS_FOR_PRIME 64
272.
273. > static int srp_Verify_N_and_g(const BIGNUM *N, const BIGNUM *g)
274. {
275. BN_CTX *bn_ctx = BN_CTX_new();
apps/s_client.c:275:5: Skipping BN_CTX_new(): empty list of specs
273. static int srp_Verify_N_and_g(const BIGNUM *N, const BIGNUM *g)
274. {
275. BN_CTX *bn_ctx = BN_CTX_new();
^
276. BIGNUM *p = BN_new();
277. BIGNUM *r = BN_new();
apps/s_client.c:276:5: Skipping BN_new(): empty list of specs
274. {
275. BN_CTX *bn_ctx = BN_CTX_new();
276. BIGNUM *p = BN_new();
^
277. BIGNUM *r = BN_new();
278. int ret =
apps/s_client.c:277:5: Skipping BN_new(): empty list of specs
275. BN_CTX *bn_ctx = BN_CTX_new();
276. BIGNUM *p = BN_new();
277. BIGNUM *r = BN_new();
^
278. int ret =
279. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) &&
apps/s_client.c:279:9: Condition is true
277. BIGNUM *r = BN_new();
278. int ret =
279. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) &&
^
280. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 &&
281. p != NULL && BN_rshift1(p, N) &&
apps/s_client.c:279:22: Condition is true
277. BIGNUM *r = BN_new();
278. int ret =
279. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) &&
^
280. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 &&
281. p != NULL && BN_rshift1(p, N) &&
apps/s_client.c:279:35: Condition is false
277. BIGNUM *r = BN_new();
278. int ret =
279. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) &&
^
280. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 &&
281. p != NULL && BN_rshift1(p, N) &&
apps/s_client.c:279:9:
277. BIGNUM *r = BN_new();
278. int ret =
279. > g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) &&
280. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 &&
281. p != NULL && BN_rshift1(p, N) &&
apps/s_client.c:278:5:
276. BIGNUM *p = BN_new();
277. BIGNUM *r = BN_new();
278. > int ret =
279. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) &&
280. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 &&
apps/s_client.c:289:5: Skipping BN_free(): empty list of specs
287. BN_add_word(r, 1) && BN_cmp(r, N) == 0;
288.
289. BN_free(r);
^
290. BN_free(p);
291. BN_CTX_free(bn_ctx);
apps/s_client.c:290:5: Skipping BN_free(): empty list of specs
288.
289. BN_free(r);
290. BN_free(p);
^
291. BN_CTX_free(bn_ctx);
292. return ret;
apps/s_client.c:291:5:
289. BN_free(r);
290. BN_free(p);
291. > BN_CTX_free(bn_ctx);
292. return ret;
293. }
crypto/bn/bn_ctx.c:157:1: start of procedure BN_CTX_free()
155. }
156.
157. > void BN_CTX_free(BN_CTX *ctx)
158. {
159. #ifdef BN_CTX_DEBUG
crypto/bn/bn_ctx.c:174:5:
172. }
173. #endif
174. > BN_STACK_finish(&ctx->stack);
175. BN_POOL_finish(&ctx->pool);
176. OPENSSL_free(ctx);
crypto/bn/bn_ctx.c:243:1: start of procedure BN_STACK_finish()
241. }
242.
243. > static void BN_STACK_finish(BN_STACK *st)
244. {
245. OPENSSL_free(st->indexes);
crypto/bn/bn_ctx.c:245:5:
243. static void BN_STACK_finish(BN_STACK *st)
244. {
245. > OPENSSL_free(st->indexes);
246. st->indexes = NULL;
247. }
crypto/mem.c:295:1: start of procedure CRYPTO_free()
293. }
294.
295. > void CRYPTO_free(void *str, const char *file, int line)
296. {
297. INCREMENT(free_count);
crypto/mem.c:298:9: Taking true branch
296. {
297. INCREMENT(free_count);
298. if (free_impl != NULL && free_impl != &CRYPTO_free) {
^
299. free_impl(str, file, line);
300. return;
crypto/mem.c:298:30: Taking true branch
296. {
297. INCREMENT(free_count);
298. if (free_impl != NULL && free_impl != &CRYPTO_free) {
^
299. free_impl(str, file, line);
300. return;
crypto/mem.c:299:9: Skipping __function_pointer__(): unresolved function pointer
297. INCREMENT(free_count);
298. if (free_impl != NULL && free_impl != &CRYPTO_free) {
299. free_impl(str, file, line);
^
300. return;
301. }
crypto/mem.c:300:9:
298. if (free_impl != NULL && free_impl != &CRYPTO_free) {
299. free_impl(str, file, line);
300. > return;
301. }
302.
crypto/mem.c:314:1: return from a call to CRYPTO_free
312. free(str);
313. #endif
314. > }
315.
316. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)
crypto/bn/bn_ctx.c:246:5:
244. {
245. OPENSSL_free(st->indexes);
246. > st->indexes = NULL;
247. }
248.
crypto/bn/bn_ctx.c:247:1: return from a call to BN_STACK_finish
245. OPENSSL_free(st->indexes);
246. st->indexes = NULL;
247. > }
248.
249.
crypto/bn/bn_ctx.c:175:5:
173. #endif
174. BN_STACK_finish(&ctx->stack);
175. > BN_POOL_finish(&ctx->pool);
176. OPENSSL_free(ctx);
177. }
crypto/bn/bn_ctx.c:284:1: start of procedure BN_POOL_finish()
282. }
283.
284. > static void BN_POOL_finish(BN_POOL *p)
285. {
286. unsigned int loop;
crypto/bn/bn_ctx.c:289:12: Loop condition is false. Leaving loop
287. BIGNUM *bn;
288.
289. while (p->head) {
^
290. for (loop = 0, bn = p->head->vals; loop++ < BN_CTX_POOL_SIZE; bn++)
291. if (bn->d)
| https://github.com/openssl/openssl/blob/98c03302fb7b855647aa14022f61f5fb272e514a/apps/s_client.c/#L291 |
d2a_code_trace_data_42365 | static int chacha20_poly1305_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
const unsigned char *in, size_t len)
{
EVP_CHACHA_AEAD_CTX *actx = aead_data(ctx);
size_t tail, tohash_len, buf_len, plen = actx->tls_payload_length;
unsigned char *buf, *tohash, *ctr, storage[sizeof(zero) + 32];
if (len != plen + POLY1305_BLOCK_SIZE)
return -1;
buf = storage + ((0 - (size_t)storage) & 15);
ctr = buf + CHACHA_BLK_SIZE;
tohash = buf + CHACHA_BLK_SIZE - POLY1305_BLOCK_SIZE;
# ifdef XOR128_HELPERS
if (plen <= 3 * CHACHA_BLK_SIZE) {
actx->key.counter[0] = 0;
buf_len = (plen + 2 * CHACHA_BLK_SIZE - 1) & (0 - CHACHA_BLK_SIZE);
ChaCha20_ctr32(buf, zero, buf_len, actx->key.key.d,
actx->key.counter);
Poly1305_Init(POLY1305_ctx(actx), buf);
actx->key.partial_len = 0;
memcpy(tohash, actx->tls_aad, POLY1305_BLOCK_SIZE);
tohash_len = POLY1305_BLOCK_SIZE;
actx->len.aad = EVP_AEAD_TLS1_AAD_LEN;
actx->len.text = plen;
if (plen) {
if (ctx->encrypt)
ctr = xor128_encrypt_n_pad(out, in, ctr, plen);
else
ctr = xor128_decrypt_n_pad(out, in, ctr, plen);
in += plen;
out += plen;
tohash_len = (size_t)(ctr - tohash);
}
}
# else
if (plen <= CHACHA_BLK_SIZE) {
size_t i;
actx->key.counter[0] = 0;
ChaCha20_ctr32(buf, zero, (buf_len = 2 * CHACHA_BLK_SIZE),
actx->key.key.d, actx->key.counter);
Poly1305_Init(POLY1305_ctx(actx), buf);
actx->key.partial_len = 0;
memcpy(tohash, actx->tls_aad, POLY1305_BLOCK_SIZE);
tohash_len = POLY1305_BLOCK_SIZE;
actx->len.aad = EVP_AEAD_TLS1_AAD_LEN;
actx->len.text = plen;
if (ctx->encrypt) {
for (i = 0; i < plen; i++) {
out[i] = ctr[i] ^= in[i];
}
} else {
for (i = 0; i < plen; i++) {
unsigned char c = in[i];
out[i] = ctr[i] ^ c;
ctr[i] = c;
}
}
in += i;
out += i;
tail = (0 - i) & (POLY1305_BLOCK_SIZE - 1);
memset(ctr + i, 0, tail);
ctr += i + tail;
tohash_len += i + tail;
}
# endif
else {
actx->key.counter[0] = 0;
ChaCha20_ctr32(buf, zero, (buf_len = CHACHA_BLK_SIZE),
actx->key.key.d, actx->key.counter);
Poly1305_Init(POLY1305_ctx(actx), buf);
actx->key.counter[0] = 1;
actx->key.partial_len = 0;
Poly1305_Update(POLY1305_ctx(actx), actx->tls_aad, POLY1305_BLOCK_SIZE);
tohash = ctr;
tohash_len = 0;
actx->len.aad = EVP_AEAD_TLS1_AAD_LEN;
actx->len.text = plen;
if (ctx->encrypt) {
ChaCha20_ctr32(out, in, plen, actx->key.key.d, actx->key.counter);
Poly1305_Update(POLY1305_ctx(actx), out, plen);
} else {
Poly1305_Update(POLY1305_ctx(actx), in, plen);
ChaCha20_ctr32(out, in, plen, actx->key.key.d, actx->key.counter);
}
in += plen;
out += plen;
tail = (0 - plen) & (POLY1305_BLOCK_SIZE - 1);
Poly1305_Update(POLY1305_ctx(actx), zero, tail);
}
{
const union {
long one;
char little;
} is_endian = { 1 };
if (is_endian.little) {
memcpy(ctr, (unsigned char *)&actx->len, POLY1305_BLOCK_SIZE);
} else {
ctr[0] = (unsigned char)(actx->len.aad);
ctr[1] = (unsigned char)(actx->len.aad>>8);
ctr[2] = (unsigned char)(actx->len.aad>>16);
ctr[3] = (unsigned char)(actx->len.aad>>24);
ctr[4] = (unsigned char)(actx->len.aad>>32);
ctr[5] = (unsigned char)(actx->len.aad>>40);
ctr[6] = (unsigned char)(actx->len.aad>>48);
ctr[7] = (unsigned char)(actx->len.aad>>56);
ctr[8] = (unsigned char)(actx->len.text);
ctr[9] = (unsigned char)(actx->len.text>>8);
ctr[10] = (unsigned char)(actx->len.text>>16);
ctr[11] = (unsigned char)(actx->len.text>>24);
ctr[12] = (unsigned char)(actx->len.text>>32);
ctr[13] = (unsigned char)(actx->len.text>>40);
ctr[14] = (unsigned char)(actx->len.text>>48);
ctr[15] = (unsigned char)(actx->len.text>>56);
}
tohash_len += POLY1305_BLOCK_SIZE;
}
Poly1305_Update(POLY1305_ctx(actx), tohash, tohash_len);
OPENSSL_cleanse(buf, buf_len);
Poly1305_Final(POLY1305_ctx(actx), ctx->encrypt ? actx->tag
: tohash);
actx->tls_payload_length = NO_TLS_PAYLOAD_LENGTH;
if (ctx->encrypt) {
memcpy(out, actx->tag, POLY1305_BLOCK_SIZE);
} else {
if (CRYPTO_memcmp(tohash, in, POLY1305_BLOCK_SIZE)) {
memset(out - (len - POLY1305_BLOCK_SIZE), 0,
len - POLY1305_BLOCK_SIZE);
return -1;
}
}
return len;
}
crypto/evp/e_chacha20_poly1305.c:277: error: INTEGER_OVERFLOW_L2
(0 - [max(0, `ctx->cipher_data->tls_payload_length`), 64]):unsigned64.
Showing all 3 steps of the trace
crypto/evp/e_chacha20_poly1305.c:210:1: <RHS trace>
208. # endif
209.
210. > static int chacha20_poly1305_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
211. const unsigned char *in, size_t len)
212. {
crypto/evp/e_chacha20_poly1305.c:210:1: Parameter `len`
208. # endif
209.
210. > static int chacha20_poly1305_tls_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
211. const unsigned char *in, size_t len)
212. {
crypto/evp/e_chacha20_poly1305.c:277:9: Binary operation: (0 - [max(0, ctx->cipher_data->tls_payload_length), 64]):unsigned64
275. out += i;
276.
277. tail = (0 - i) & (POLY1305_BLOCK_SIZE - 1);
^
278. memset(ctr + i, 0, tail);
279. ctr += i + tail;
| https://github.com/openssl/openssl/blob/3e0076c213ec2d1149a9a89f9bc141d1a1a44630/crypto/evp/e_chacha20_poly1305.c/#L277 |
d2a_code_trace_data_42366 | 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:118: 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:118:9: Call
116. break;
117. case BIO_CB_RETURN | BIO_CB_READ:
118. BIO_snprintf(p, p_maxlen, "read return %ld\n", ret);
^
119. break;
120. case BIO_CB_RETURN | BIO_CB_WRITE:
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 |
d2a_code_trace_data_42367 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/rsa/rsa_chk.c:117: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mul`.
Showing all 25 steps of the trace
crypto/rsa/rsa_chk.c:65:9: Call
63.
64. /* p prime? */
65. if (BN_is_prime_ex(key->p, BN_prime_checks, NULL, cb) != 1) {
^
66. ret = 0;
67. RSAerr(RSA_F_RSA_CHECK_KEY_EX, RSA_R_P_NOT_PRIME);
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. {
crypto/rsa/rsa_chk.c:71:9: Call
69.
70. /* q prime? */
71. if (BN_is_prime_ex(key->q, BN_prime_checks, NULL, cb) != 1) {
^
72. ret = 0;
73. RSAerr(RSA_F_RSA_CHECK_KEY_EX, RSA_R_Q_NOT_PRIME);
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. {
crypto/rsa/rsa_chk.c:86:10: Call
84.
85. /* n = p*q * r_3...r_i? */
86. if (!BN_mul(i, key->p, key->q, ctx)) {
^
87. ret = -1;
88. goto err;
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:507:1: Parameter `ctx->stack.depth`
505. }
506.
507. > int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
508. {
509. int ret = 0;
crypto/rsa/rsa_chk.c:117:10: Call
115.
116. /* now compute k = \lambda(n) = LCM(i, j, r_3 - 1...) */
117. if (!BN_mul(l, i, j, ctx)) {
^
118. ret = -1;
119. goto err;
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_42368 | 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:3436: error: Integer Overflow L2
([0, +oo] - 1):unsigned32 by call to `av_close_input_file`.
ffserver.c:3393:29: Unknown value from: printf
3391. if (sf->index != ss->index ||
3392. sf->id != ss->id) {
3393. printf("Index & Id do not match for stream %d (%s)\n",
^
3394. i, feed->feed_filename);
3395. matches = 0;
ffserver.c:3436:17: Call
3434. feed->feed_filename, s->nb_streams, feed->nb_streams);
3435.
3436. av_close_input_file(s);
^
3437. } else
3438. printf("Deleting feed file '%s' as it appears to be corrupt\n",
libavformat/utils.c:2152:1: Parameter `s->nb_programs`
2150. }
2151.
2152. void av_close_input_file(AVFormatContext *s)
^
2153. {
2154. ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb;
libavformat/utils.c:2155:5: Call
2153. {
2154. ByteIOContext *pb = s->iformat->flags & AVFMT_NOFILE ? NULL : s->pb;
2155. av_close_input_stream(s);
^
2156. if (pb)
2157. url_fclose(pb);
libavformat/utils.c:2118:1: <LHS trace>
2116. }
2117.
2118. void av_close_input_stream(AVFormatContext *s)
^
2119. {
2120. int i;
libavformat/utils.c:2118:1: Parameter `s->nb_programs`
2116. }
2117.
2118. void av_close_input_stream(AVFormatContext *s)
^
2119. {
2120. int i;
libavformat/utils.c:2141:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `av_close_input_file`
2139. av_free(st);
2140. }
2141. for(i=s->nb_programs-1; i>=0; i--) {
^
2142. av_freep(&s->programs[i]->provider_name);
2143. av_freep(&s->programs[i]->name);
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/utils.c/#L2141 |
d2a_code_trace_data_42369 | BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
{
bn_check_top(b);
if (a == b)
return a;
if (bn_wexpand(a, b->top) == NULL)
return NULL;
if (b->top > 0)
memcpy(a->d, b->d, sizeof(b->d[0]) * b->top);
if (BN_get_flags(b, BN_FLG_CONSTTIME) != 0)
BN_set_flags(a, BN_FLG_CONSTTIME);
a->top = b->top;
a->neg = b->neg;
bn_check_top(a);
return a;
}
ssl/tls_srp.c:302: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 536870848] by call to `SRP_Calc_client_key`.
Showing all 26 steps of the trace
ssl/tls_srp.c:275:1: Parameter `s->srp_ctx.N->top`
273.
274. /* client side */
275. > int srp_generate_client_master_secret(SSL *s)
276. {
277. BIGNUM *x = NULL, *u = NULL, *K = NULL;
ssl/tls_srp.c:285:9: Call
283. * Checks if b % n == 0
284. */
285. if (SRP_Verify_B_mod_N(s->srp_ctx.B, s->srp_ctx.N) == 0
^
286. || (u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N))
287. == NULL
crypto/srp/srp_lib.c:212:1: Parameter `N->top`
210. }
211.
212. > int SRP_Verify_B_mod_N(const BIGNUM *B, const BIGNUM *N)
213. {
214. BIGNUM *r;
ssl/tls_srp.c:286:21: Call
284. */
285. if (SRP_Verify_B_mod_N(s->srp_ctx.B, s->srp_ctx.N) == 0
286. || (u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N))
^
287. == NULL
288. || s->srp_ctx.SRP_give_srp_client_pwd_callback == NULL) {
crypto/srp/srp_lib.c:47:1: Parameter `N->top`
45. }
46.
47. > BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N)
48. {
49. /* k = SHA1(PAD(A) || PAD(B) ) -- tls-srp draft 8 */
crypto/srp/srp_lib.c:50:12: Call
48. {
49. /* k = SHA1(PAD(A) || PAD(B) ) -- tls-srp draft 8 */
50. return srp_Calc_xy(A, B, N);
^
51. }
52.
crypto/srp/srp_lib.c:19:1: Parameter `N->top`
17. /* calculate = SHA1(PAD(x) || PAD(y)) */
18.
19. > static BIGNUM *srp_Calc_xy(const BIGNUM *x, const BIGNUM *y, const BIGNUM *N)
20. {
21. unsigned char digest[SHA_DIGEST_LENGTH];
crypto/srp/srp_lib.c:23:16: Call
21. unsigned char digest[SHA_DIGEST_LENGTH];
22. unsigned char *tmp = NULL;
23. int numN = BN_num_bytes(N);
^
24. BIGNUM *res = NULL;
25. if (x != N && BN_ucmp(x, N) >= 0)
crypto/bn/bn_lib.c:166:9: Call
164. bn_check_top(a);
165.
166. if (BN_is_zero(a))
^
167. return 0;
168. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
crypto/bn/bn_lib.c:844:1: Parameter `a->top`
842. }
843.
844. > int BN_is_zero(const BIGNUM *a)
845. {
846. return a->top == 0;
ssl/tls_srp.c:302:21: Call
300. }
301. if ((x = SRP_Calc_x(s->srp_ctx.s, s->srp_ctx.login, passwd)) == NULL
302. || (K = SRP_Calc_client_key(s->srp_ctx.N, s->srp_ctx.B,
^
303. s->srp_ctx.g, x,
304. s->srp_ctx.a, u)) == NULL) {
crypto/srp/srp_lib.c:170:1: Parameter `N->top`
168. }
169.
170. > BIGNUM *SRP_Calc_client_key(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g,
171. const BIGNUM *x, const BIGNUM *a, const BIGNUM *u)
172. {
crypto/srp/srp_lib.c:185:10: Call
183. goto err;
184.
185. if (!BN_mod_exp(tmp, g, x, N, bn_ctx))
^
186. goto err;
187. if ((k = srp_Calc_k(N, g)) == NULL)
crypto/bn/bn_exp.c:89:1: Parameter `m->top`
87. }
88.
89. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
90. BN_CTX *ctx)
91. {
crypto/bn/bn_exp.c:134:9: Call
132.
133. #ifdef MONT_MUL_MOD
134. if (BN_is_odd(m)) {
^
135. # ifdef MONT_EXP_WORD
136. if (a->top == 1 && !a->neg
crypto/bn/bn_lib.c:859:1: Parameter `a->top`
857. }
858.
859. > int BN_is_odd(const BIGNUM *a)
860. {
861. return (a->top > 0) && (a->d[0] & 1);
crypto/bn/bn_exp.c:149:15: Call
147. #ifdef RECP_MUL_MOD
148. {
149. ret = BN_mod_exp_recp(r, a, p, m, ctx);
^
150. }
151. #else
crypto/bn/bn_exp.c:161:1: Parameter `m->top`
159. }
160.
161. > int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
162. const BIGNUM *m, BN_CTX *ctx)
163. {
crypto/bn/bn_exp.c:200:14: Call
198. if (m->neg) {
199. /* ignore sign of 'm' */
200. if (!BN_copy(aa, m))
^
201. goto err;
202. aa->neg = 0;
crypto/bn/bn_lib.c:312:1: <Offset trace>
310. }
311.
312. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
313. {
314. bn_check_top(b);
crypto/bn/bn_lib.c:312:1: Parameter `b->top`
310. }
311.
312. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
313. {
314. bn_check_top(b);
crypto/bn/bn_lib.c:312:1: <Length trace>
310. }
311.
312. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
313. {
314. bn_check_top(b);
crypto/bn/bn_lib.c:312:1: Parameter `*a->d`
310. }
311.
312. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
313. {
314. bn_check_top(b);
crypto/bn/bn_lib.c:318:9: Call
316. if (a == b)
317. return a;
318. if (bn_wexpand(a, b->top) == NULL)
^
319. return NULL;
320.
crypto/bn/bn_lib.c:940:1: Parameter `*a->d`
938. }
939.
940. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
941. {
942. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_lib.c:322:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `SRP_Calc_client_key`
320.
321. if (b->top > 0)
322. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top);
^
323.
324. if (BN_get_flags(b, BN_FLG_CONSTTIME) != 0)
| https://github.com/openssl/openssl/blob/e7d961e994620dd5dee6d80794a07fb9de1bab66/crypto/bn/bn_lib.c/#L322 |
d2a_code_trace_data_42370 | int opt_verify(int opt, X509_VERIFY_PARAM *vpm)
{
int i;
ossl_intmax_t t = 0;
ASN1_OBJECT *otmp;
X509_PURPOSE *xptmp;
const X509_VERIFY_PARAM *vtmp;
assert(vpm != NULL);
assert(opt > OPT_V__FIRST);
assert(opt < OPT_V__LAST);
switch ((enum range)opt) {
case OPT_V__FIRST:
case OPT_V__LAST:
return 0;
case OPT_V_POLICY:
otmp = OBJ_txt2obj(opt_arg(), 0);
if (otmp == NULL) {
BIO_printf(bio_err, "%s: Invalid Policy %s\n", prog, opt_arg());
return 0;
}
X509_VERIFY_PARAM_add0_policy(vpm, otmp);
break;
case OPT_V_PURPOSE:
i = X509_PURPOSE_get_by_sname(opt_arg());
if (i < 0) {
BIO_printf(bio_err, "%s: Invalid purpose %s\n", prog, opt_arg());
return 0;
}
xptmp = X509_PURPOSE_get0(i);
i = X509_PURPOSE_get_id(xptmp);
if (!X509_VERIFY_PARAM_set_purpose(vpm, i)) {
BIO_printf(bio_err,
"%s: Internal error setting purpose %s\n",
prog, opt_arg());
return 0;
}
break;
case OPT_V_VERIFY_NAME:
vtmp = X509_VERIFY_PARAM_lookup(opt_arg());
if (vtmp == NULL) {
BIO_printf(bio_err, "%s: Invalid verify name %s\n",
prog, opt_arg());
return 0;
}
X509_VERIFY_PARAM_set1(vpm, vtmp);
break;
case OPT_V_VERIFY_DEPTH:
i = atoi(opt_arg());
if (i >= 0)
X509_VERIFY_PARAM_set_depth(vpm, i);
break;
case OPT_V_VERIFY_AUTH_LEVEL:
i = atoi(opt_arg());
if (i >= 0)
X509_VERIFY_PARAM_set_auth_level(vpm, i);
break;
case OPT_V_ATTIME:
if (!opt_imax(opt_arg(), &t))
return 0;
if (t != (time_t)t) {
BIO_printf(bio_err, "%s: epoch time out of range %s\n",
prog, opt_arg());
return 0;
}
X509_VERIFY_PARAM_set_time(vpm, (time_t)t);
break;
case OPT_V_VERIFY_HOSTNAME:
if (!X509_VERIFY_PARAM_set1_host(vpm, opt_arg(), 0))
return 0;
break;
case OPT_V_VERIFY_EMAIL:
if (!X509_VERIFY_PARAM_set1_email(vpm, opt_arg(), 0))
return 0;
break;
case OPT_V_VERIFY_IP:
if (!X509_VERIFY_PARAM_set1_ip_asc(vpm, opt_arg()))
return 0;
break;
case OPT_V_IGNORE_CRITICAL:
X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_IGNORE_CRITICAL);
break;
case OPT_V_ISSUER_CHECKS:
break;
case OPT_V_CRL_CHECK:
X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_CRL_CHECK);
break;
case OPT_V_CRL_CHECK_ALL:
X509_VERIFY_PARAM_set_flags(vpm,
X509_V_FLAG_CRL_CHECK |
X509_V_FLAG_CRL_CHECK_ALL);
break;
case OPT_V_POLICY_CHECK:
X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_POLICY_CHECK);
break;
case OPT_V_EXPLICIT_POLICY:
X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_EXPLICIT_POLICY);
break;
case OPT_V_INHIBIT_ANY:
X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_INHIBIT_ANY);
break;
case OPT_V_INHIBIT_MAP:
X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_INHIBIT_MAP);
break;
case OPT_V_X509_STRICT:
X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_X509_STRICT);
break;
case OPT_V_EXTENDED_CRL:
X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_EXTENDED_CRL_SUPPORT);
break;
case OPT_V_USE_DELTAS:
X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_USE_DELTAS);
break;
case OPT_V_POLICY_PRINT:
X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_NOTIFY_POLICY);
break;
case OPT_V_CHECK_SS_SIG:
X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_CHECK_SS_SIGNATURE);
break;
case OPT_V_TRUSTED_FIRST:
X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_TRUSTED_FIRST);
break;
case OPT_V_SUITEB_128_ONLY:
X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_SUITEB_128_LOS_ONLY);
break;
case OPT_V_SUITEB_128:
X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_SUITEB_128_LOS);
break;
case OPT_V_SUITEB_192:
X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_SUITEB_192_LOS);
break;
case OPT_V_PARTIAL_CHAIN:
X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_PARTIAL_CHAIN);
break;
case OPT_V_NO_ALT_CHAINS:
X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_NO_ALT_CHAINS);
break;
case OPT_V_NO_CHECK_TIME:
X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_NO_CHECK_TIME);
break;
case OPT_V_ALLOW_PROXY_CERTS:
X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_ALLOW_PROXY_CERTS);
break;
}
return 1;
}
apps/opt.c:489: error: NULL_DEREFERENCE
pointer `xptmp` last assigned on line 486 could be null and is dereferenced by call to `X509_PURPOSE_get_id()` at line 489, column 13.
Showing all 31 steps of the trace
apps/opt.c:453:1: start of procedure opt_verify()
451. enum range { OPT_V_ENUM };
452.
453. > int opt_verify(int opt, X509_VERIFY_PARAM *vpm)
454. {
455. int i;
apps/opt.c:456:5:
454. {
455. int i;
456. > ossl_intmax_t t = 0;
457. ASN1_OBJECT *otmp;
458. X509_PURPOSE *xptmp;
apps/opt.c:461:5:
459. const X509_VERIFY_PARAM *vtmp;
460.
461. > assert(vpm != NULL);
462. assert(opt > OPT_V__FIRST);
463. assert(opt < OPT_V__LAST);
apps/opt.c:462:5:
460.
461. assert(vpm != NULL);
462. > assert(opt > OPT_V__FIRST);
463. assert(opt < OPT_V__LAST);
464.
apps/opt.c:463:5:
461. assert(vpm != NULL);
462. assert(opt > OPT_V__FIRST);
463. > assert(opt < OPT_V__LAST);
464.
465. switch ((enum range)opt) {
apps/opt.c:465:5:
463. assert(opt < OPT_V__LAST);
464.
465. > switch ((enum range)opt) {
466. case OPT_V__FIRST:
467. case OPT_V__LAST:
apps/opt.c:466:5: Switch condition is false. Skipping switch case
464.
465. switch ((enum range)opt) {
466. case OPT_V__FIRST:
^
467. case OPT_V__LAST:
468. return 0;
apps/opt.c:467:5: Switch condition is false. Skipping switch case
465. switch ((enum range)opt) {
466. case OPT_V__FIRST:
467. case OPT_V__LAST:
^
468. return 0;
469. case OPT_V_POLICY:
apps/opt.c:469:5: Switch condition is false. Skipping switch case
467. case OPT_V__LAST:
468. return 0;
469. case OPT_V_POLICY:
^
470. otmp = OBJ_txt2obj(opt_arg(), 0);
471. if (otmp == NULL) {
apps/opt.c:477:5: Switch condition is true. Entering switch case
475. X509_VERIFY_PARAM_add0_policy(vpm, otmp);
476. break;
477. case OPT_V_PURPOSE:
^
478. /* purpose name -> purpose index */
479. i = X509_PURPOSE_get_by_sname(opt_arg());
apps/opt.c:479:9:
477. case OPT_V_PURPOSE:
478. /* purpose name -> purpose index */
479. > i = X509_PURPOSE_get_by_sname(opt_arg());
480. if (i < 0) {
481. BIO_printf(bio_err, "%s: Invalid purpose %s\n", prog, opt_arg());
apps/opt.c:758:1: start of procedure opt_arg()
756.
757. /* Return the most recent flag parameter. */
758. > char *opt_arg(void)
759. {
760. return arg;
apps/opt.c:760:5:
758. char *opt_arg(void)
759. {
760. > return arg;
761. }
762.
apps/opt.c:761:1: return from a call to opt_arg
759. {
760. return arg;
761. > }
762.
763. /* Return the most recent flag. */
apps/opt.c:479:9: Skipping X509_PURPOSE_get_by_sname(): empty list of specs
477. case OPT_V_PURPOSE:
478. /* purpose name -> purpose index */
479. i = X509_PURPOSE_get_by_sname(opt_arg());
^
480. if (i < 0) {
481. BIO_printf(bio_err, "%s: Invalid purpose %s\n", prog, opt_arg());
apps/opt.c:480:13: Taking false branch
478. /* purpose name -> purpose index */
479. i = X509_PURPOSE_get_by_sname(opt_arg());
480. if (i < 0) {
^
481. BIO_printf(bio_err, "%s: Invalid purpose %s\n", prog, opt_arg());
482. return 0;
apps/opt.c:486:9:
484.
485. /* purpose index -> purpose object */
486. > xptmp = X509_PURPOSE_get0(i);
487.
488. /* purpose object -> purpose value */
crypto/x509v3/v3_purp.c:112:1: start of procedure X509_PURPOSE_get0()
110. }
111.
112. > X509_PURPOSE *X509_PURPOSE_get0(int idx)
113. {
114. if (idx < 0)
crypto/x509v3/v3_purp.c:114:9: Taking false branch
112. X509_PURPOSE *X509_PURPOSE_get0(int idx)
113. {
114. if (idx < 0)
^
115. return NULL;
116. if (idx < (int)X509_PURPOSE_COUNT)
crypto/x509v3/v3_purp.c:116:9: Taking false branch
114. if (idx < 0)
115. return NULL;
116. if (idx < (int)X509_PURPOSE_COUNT)
^
117. return xstandard + idx;
118. return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);
crypto/x509v3/v3_purp.c:118:5:
116. if (idx < (int)X509_PURPOSE_COUNT)
117. return xstandard + idx;
118. > return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);
119. }
120.
include/openssl/x509v3.h:448:1: start of procedure sk_X509_PURPOSE_value()
446. # define X509V3_ADD_SILENT 0x10
447.
448. > DEFINE_STACK_OF(X509_PURPOSE)
449.
450. DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS)
crypto/stack/stack.c:385:1: start of procedure OPENSSL_sk_value()
383. }
384.
385. > void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
386. {
387. if (st == NULL || i < 0 || i >= st->num)
crypto/stack/stack.c:387:9: Taking true branch
385. void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)
386. {
387. if (st == NULL || i < 0 || i >= st->num)
^
388. return NULL;
389. return (void *)st->data[i];
crypto/stack/stack.c:388:9:
386. {
387. if (st == NULL || i < 0 || i >= st->num)
388. > return NULL;
389. return (void *)st->data[i];
390. }
crypto/stack/stack.c:390:1: return from a call to OPENSSL_sk_value
388. return NULL;
389. return (void *)st->data[i];
390. > }
391.
392. void *OPENSSL_sk_set(OPENSSL_STACK *st, int i, const void *data)
include/openssl/x509v3.h:448:1: return from a call to sk_X509_PURPOSE_value
446. # define X509V3_ADD_SILENT 0x10
447.
448. > DEFINE_STACK_OF(X509_PURPOSE)
449.
450. DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS)
crypto/x509v3/v3_purp.c:119:1: return from a call to X509_PURPOSE_get0
117. return xstandard + idx;
118. return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);
119. > }
120.
121. int X509_PURPOSE_get_by_sname(const char *sname)
apps/opt.c:489:9:
487.
488. /* purpose object -> purpose value */
489. > i = X509_PURPOSE_get_id(xptmp);
490.
491. if (!X509_VERIFY_PARAM_set_purpose(vpm, i)) {
crypto/x509v3/v3_purp.c:236:1: start of procedure X509_PURPOSE_get_id()
234. }
235.
236. > int X509_PURPOSE_get_id(const X509_PURPOSE *xp)
237. {
238. return xp->purpose;
crypto/x509v3/v3_purp.c:238:5:
236. int X509_PURPOSE_get_id(const X509_PURPOSE *xp)
237. {
238. > return xp->purpose;
239. }
240.
| https://github.com/openssl/openssl/blob/95658c32436017aeeef3d8598957071baf6769a9/apps/opt.c/#L489 |
d2a_code_trace_data_42371 | static int bn_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont)
{
BIGNUM *n;
BN_ULONG *ap, *np, *rp, n0, v, carry;
int nl, max, i;
unsigned int rtop;
n = &(mont->N);
nl = n->top;
if (nl == 0) {
ret->top = 0;
return 1;
}
max = (2 * nl);
if (bn_wexpand(r, max) == NULL)
return 0;
r->neg ^= n->neg;
np = n->d;
rp = r->d;
for (rtop = r->top, i = 0; i < max; i++) {
v = (BN_ULONG)0 - ((i - rtop) >> (8 * sizeof(rtop) - 1));
rp[i] &= v;
}
r->top = max;
r->flags |= BN_FLG_FIXED_TOP;
n0 = mont->n0[0];
for (carry = 0, i = 0; i < nl; i++, rp++) {
v = bn_mul_add_words(rp, np, nl, (rp[0] * n0) & BN_MASK2);
v = (v + carry + rp[nl]) & BN_MASK2;
carry |= (v != rp[nl]);
carry &= (v <= rp[nl]);
rp[nl] = v;
}
if (bn_wexpand(ret, nl) == NULL)
return 0;
ret->top = nl;
ret->flags |= BN_FLG_FIXED_TOP;
ret->neg = r->neg;
rp = ret->d;
ap = &(r->d[nl]);
carry -= bn_sub_words(rp, ap, np, nl);
for (i = 0; i < nl; i++) {
rp[i] = (carry & ap[i]) | (~carry & rp[i]);
ap[i] = 0;
}
return 1;
}
crypto/bn/bn_mont.c:75: error: BUFFER_OVERRUN_S2
Offset: [max(1, `mont->N.top`), +oo] (⇐ [0, +oo] + [max(1, `mont->N.top`), `mont->N.top`]) Size: [0, 8388607] by call to `bn_from_montgomery_word`.
Showing all 10 steps of the trace
crypto/bn/bn_mont.c:37:1: Parameter `mont->N.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:125:21: <Offset trace>
123. * includes |carry| which is stored separately.
124. */
125. for (carry = 0, i = 0; i < nl; i++, rp++) {
^
126. v = bn_mul_add_words(rp, np, nl, (rp[0] * n0) & BN_MASK2);
127. v = (v + carry + rp[nl]) & BN_MASK2;
crypto/bn/bn_mont.c:125:21: Assignment
123. * includes |carry| which is stored separately.
124. */
125. for (carry = 0, i = 0; i < nl; i++, rp++) {
^
126. v = bn_mul_add_words(rp, np, nl, (rp[0] * n0) & BN_MASK2);
127. v = (v + carry + rp[nl]) & BN_MASK2;
crypto/bn/bn_mont.c:88:1: <Length trace>
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:88:1: Parameter `*r->d`
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:103:9: Call
101.
102. max = (2 * nl); /* carry is stored separately */
103. if (bn_wexpand(r, max) == NULL)
^
104. return 0;
105.
crypto/bn/bn_lib.c:960:1: Parameter `*a->d`
958. }
959.
960. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
961. {
962. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_mont.c:108:5: Assignment
106. r->neg ^= n->neg;
107. np = n->d;
108. rp = r->d;
^
109.
110. /* clear the top words of T */
crypto/bn/bn_mont.c:129:24: Array access: Offset: [max(1, mont->N.top), +oo] (⇐ [0, +oo] + [max(1, mont->N.top), mont->N.top]) Size: [0, 8388607] by call to `bn_from_montgomery_word`
127. v = (v + carry + rp[nl]) & BN_MASK2;
128. carry |= (v != rp[nl]);
129. carry &= (v <= rp[nl]);
^
130. rp[nl] = v;
131. }
| https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_mont.c/#L129 |
d2a_code_trace_data_42372 | void avformat_free_context(AVFormatContext *s)
{
int i, j;
AVStream *st;
if (!s)
return;
av_opt_free(s);
if (s->iformat && s->iformat->priv_class && s->priv_data)
av_opt_free(s->priv_data);
for (i = 0; i < s->nb_streams; i++) {
st = s->streams[i];
for (j = 0; j < st->nb_side_data; j++)
av_freep(&st->side_data[j].data);
av_freep(&st->side_data);
st->nb_side_data = 0;
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_freep(&s->internal);
av_free(s);
}
libavformat/segment.c:333: error: Integer Overflow L2
([0, +oo] - 1):unsigned32 by call to `seg_free_context`.
libavformat/segment.c:329:11: Call
327. }
328.
329. ret = ff_write_chained(oc, pkt->stream_index, pkt, s);
^
330.
331. fail:
libavformat/mux.c:656:12: Call
654. src->streams[pkt->stream_index]->time_base,
655. dst->streams[dst_stream]->time_base);
656. return av_write_frame(dst, &local_pkt);
^
657. }
libavformat/mux.c:402:9: Assignment
400.
401. if (ret >= 0)
402. s->streams[pkt->stream_index]->nb_frames++;
^
403. return ret;
404. }
libavformat/segment.c:333:9: Call
331. fail:
332. if (ret < 0)
333. seg_free_context(seg);
^
334.
335. return ret;
libavformat/segment.c:187:1: Parameter `seg->avf->nb_programs`
185. }
186.
187. static void seg_free_context(SegmentContext *seg)
^
188. {
189. avio_closep(&seg->pb);
libavformat/segment.c:190:5: Call
188. {
189. avio_closep(&seg->pb);
190. avformat_free_context(seg->avf);
^
191. seg->avf = NULL;
192. }
libavformat/utils.c:2432:1: <LHS trace>
2430. }
2431.
2432. void avformat_free_context(AVFormatContext *s)
^
2433. {
2434. int i, j;
libavformat/utils.c:2432:1: Parameter `s->nb_programs`
2430. }
2431.
2432. void avformat_free_context(AVFormatContext *s)
^
2433. {
2434. int i, j;
libavformat/utils.c:2468:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `seg_free_context`
2466. av_free(st);
2467. }
2468. for (i = s->nb_programs - 1; i >= 0; i--) {
^
2469. av_dict_free(&s->programs[i]->metadata);
2470. av_freep(&s->programs[i]->stream_index);
| https://github.com/libav/libav/blob/2dbd35b00c6433e587d5f44d5dbc8972ebbaa88e/libavformat/utils.c/#L2468 |
d2a_code_trace_data_42373 | int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold, ASN1_GENERALIZEDTIME **pinvtm, char *str)
{
char *tmp = NULL;
char *rtime_str, *reason_str = NULL, *arg_str = NULL, *p;
int reason_code = -1;
int ret = 0;
unsigned int i;
ASN1_OBJECT *hold = NULL;
ASN1_GENERALIZEDTIME *comp_time = NULL;
tmp = BUF_strdup(str);
p = strchr(tmp, ',');
rtime_str = tmp;
if (p)
{
*p = '\0';
p++;
reason_str = p;
p = strchr(p, ',');
if (p)
{
*p = '\0';
arg_str = p + 1;
}
}
if (prevtm)
{
*prevtm = ASN1_UTCTIME_new();
if (!ASN1_UTCTIME_set_string(*prevtm, rtime_str))
{
BIO_printf(bio_err, "invalid revocation date %s\n", rtime_str);
goto err;
}
}
if (reason_str)
{
for (i = 0; i < NUM_REASONS; i++)
{
if(!strcasecmp(reason_str, crl_reasons[i]))
{
reason_code = i;
break;
}
}
if (reason_code == OCSP_REVOKED_STATUS_NOSTATUS)
{
BIO_printf(bio_err, "invalid reason code %s\n", reason_str);
goto err;
}
if (reason_code == 7)
reason_code = OCSP_REVOKED_STATUS_REMOVEFROMCRL;
else if (reason_code == 8)
{
if (!arg_str)
{
BIO_printf(bio_err, "missing hold instruction\n");
goto err;
}
reason_code = OCSP_REVOKED_STATUS_CERTIFICATEHOLD;
hold = OBJ_txt2obj(arg_str, 0);
if (!hold)
{
BIO_printf(bio_err, "invalid object identifier %s\n", arg_str);
goto err;
}
if (phold) *phold = hold;
}
else if ((reason_code == 9) || (reason_code == 10))
{
if (!arg_str)
{
BIO_printf(bio_err, "missing compromised time\n");
goto err;
}
comp_time = ASN1_GENERALIZEDTIME_new();
if (!ASN1_GENERALIZEDTIME_set_string(comp_time, arg_str))
{
BIO_printf(bio_err, "invalid compromised time %s\n", arg_str);
goto err;
}
if (reason_code == 9)
reason_code = OCSP_REVOKED_STATUS_KEYCOMPROMISE;
else
reason_code = OCSP_REVOKED_STATUS_CACOMPROMISE;
}
}
if (preason) *preason = reason_code;
if (pinvtm) *pinvtm = comp_time;
else ASN1_GENERALIZEDTIME_free(comp_time);
ret = 1;
err:
if (tmp) OPENSSL_free(tmp);
if (!phold) ASN1_OBJECT_free(hold);
if (!pinvtm) ASN1_GENERALIZEDTIME_free(comp_time);
return ret;
}
apps/ca.c:2882: error: NULL_DEREFERENCE
pointer `tmp` last assigned on line 2880 could be null and is dereferenced by call to `strchr()` at line 2882, column 6.
Showing all 53 steps of the trace
apps/ca.c:2871:1: start of procedure unpack_revinfo()
2869. }
2870.
2871. > int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold, ASN1_GENERALIZEDTIME **pinvtm, char *str)
2872. {
2873. char *tmp = NULL;
apps/ca.c:2873:2:
2871. int unpack_revinfo(ASN1_TIME **prevtm, int *preason, ASN1_OBJECT **phold, ASN1_GENERALIZEDTIME **pinvtm, char *str)
2872. {
2873. > char *tmp = NULL;
2874. char *rtime_str, *reason_str = NULL, *arg_str = NULL, *p;
2875. int reason_code = -1;
apps/ca.c:2874:2:
2872. {
2873. char *tmp = NULL;
2874. > char *rtime_str, *reason_str = NULL, *arg_str = NULL, *p;
2875. int reason_code = -1;
2876. int ret = 0;
apps/ca.c:2875:2:
2873. char *tmp = NULL;
2874. char *rtime_str, *reason_str = NULL, *arg_str = NULL, *p;
2875. > int reason_code = -1;
2876. int ret = 0;
2877. unsigned int i;
apps/ca.c:2876:2:
2874. char *rtime_str, *reason_str = NULL, *arg_str = NULL, *p;
2875. int reason_code = -1;
2876. > int ret = 0;
2877. unsigned int i;
2878. ASN1_OBJECT *hold = NULL;
apps/ca.c:2878:2:
2876. int ret = 0;
2877. unsigned int i;
2878. > ASN1_OBJECT *hold = NULL;
2879. ASN1_GENERALIZEDTIME *comp_time = NULL;
2880. tmp = BUF_strdup(str);
apps/ca.c:2879:2:
2877. unsigned int i;
2878. ASN1_OBJECT *hold = NULL;
2879. > ASN1_GENERALIZEDTIME *comp_time = NULL;
2880. tmp = BUF_strdup(str);
2881.
apps/ca.c:2880:2:
2878. ASN1_OBJECT *hold = NULL;
2879. ASN1_GENERALIZEDTIME *comp_time = NULL;
2880. > tmp = BUF_strdup(str);
2881.
2882. p = strchr(tmp, ',');
crypto/buffer/buffer.c:165:1: start of procedure BUF_strdup()
163. }
164.
165. > char *BUF_strdup(const char *str)
166. {
167. if (str == NULL) return(NULL);
crypto/buffer/buffer.c:167:6: Taking false branch
165. char *BUF_strdup(const char *str)
166. {
167. if (str == NULL) return(NULL);
^
168. return BUF_strndup(str, strlen(str));
169. }
crypto/buffer/buffer.c:168:2:
166. {
167. if (str == NULL) return(NULL);
168. > return BUF_strndup(str, strlen(str));
169. }
170.
crypto/buffer/buffer.c:171:1: start of procedure BUF_strndup()
169. }
170.
171. > char *BUF_strndup(const char *str, size_t siz)
172. {
173. char *ret;
crypto/buffer/buffer.c:175:6: Taking false branch
173. char *ret;
174.
175. if (str == NULL) return(NULL);
^
176.
177. ret=OPENSSL_malloc(siz+1);
crypto/buffer/buffer.c:177:2:
175. if (str == NULL) return(NULL);
176.
177. > ret=OPENSSL_malloc(siz+1);
178. if (ret == NULL)
179. {
crypto/mem.c:291:1: start of procedure CRYPTO_malloc()
289. }
290.
291. > void *CRYPTO_malloc(int num, const char *file, int line)
292. {
293. void *ret = NULL;
crypto/mem.c:293:2:
291. void *CRYPTO_malloc(int num, const char *file, int line)
292. {
293. > void *ret = NULL;
294. extern unsigned char cleanse_ctr;
295.
crypto/mem.c:296:6: Taking false branch
294. extern unsigned char cleanse_ctr;
295.
296. if (num < 0) return NULL;
^
297.
298. allow_customize = 0;
crypto/mem.c:298:2:
296. if (num < 0) return NULL;
297.
298. > allow_customize = 0;
299. if (malloc_debug_func != NULL)
300. {
crypto/mem.c:299:6: Taking true branch
297.
298. allow_customize = 0;
299. if (malloc_debug_func != NULL)
^
300. {
301. allow_customize_debug = 0;
crypto/mem.c:301:3:
299. if (malloc_debug_func != NULL)
300. {
301. > allow_customize_debug = 0;
302. malloc_debug_func(NULL, num, file, line, 0);
303. }
crypto/mem.c:302:3: Skipping __function_pointer__(): unresolved function pointer
300. {
301. allow_customize_debug = 0;
302. malloc_debug_func(NULL, num, file, line, 0);
^
303. }
304. ret = malloc_ex_func(num,file,line);
crypto/mem.c:304:2: Skipping __function_pointer__(): unresolved function pointer
302. malloc_debug_func(NULL, num, file, line, 0);
303. }
304. ret = malloc_ex_func(num,file,line);
^
305. #ifdef LEVITTE_DEBUG_MEM
306. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num);
crypto/mem.c:308:6: Taking true branch
306. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num);
307. #endif
308. if (malloc_debug_func != NULL)
^
309. malloc_debug_func(ret, num, file, line, 1);
310.
crypto/mem.c:309:3: Skipping __function_pointer__(): unresolved function pointer
307. #endif
308. if (malloc_debug_func != NULL)
309. malloc_debug_func(ret, num, file, line, 1);
^
310.
311. /* Create a dependency on the value of 'cleanse_ctr' so our memory
crypto/mem.c:314:12: Taking false branch
312. * sanitisation function can't be optimised out. NB: We only do
313. * this for >2Kb so the overhead doesn't bother us. */
314. if(ret && (num > 2048))
^
315. ((unsigned char *)ret)[0] = cleanse_ctr;
316.
crypto/mem.c:317:2:
315. ((unsigned char *)ret)[0] = cleanse_ctr;
316.
317. > return ret;
318. }
319.
crypto/mem.c:318:2: return from a call to CRYPTO_malloc
316.
317. return ret;
318. }
^
319.
320. void *CRYPTO_realloc(void *str, int num, const char *file, int line)
crypto/buffer/buffer.c:178:6: Taking true branch
176.
177. ret=OPENSSL_malloc(siz+1);
178. if (ret == NULL)
^
179. {
180. BUFerr(BUF_F_BUF_STRNDUP,ERR_R_MALLOC_FAILURE);
crypto/buffer/buffer.c:180:3:
178. if (ret == NULL)
179. {
180. > BUFerr(BUF_F_BUF_STRNDUP,ERR_R_MALLOC_FAILURE);
181. return(NULL);
182. }
crypto/err/err.c:664:1: start of procedure ERR_put_error()
662. /********************************************************/
663.
664. > void ERR_put_error(int lib, int func, int reason, const char *file,
665. int line)
666. {
crypto/err/err.c:688:2: Skipping ERR_get_state(): empty list of specs
686. }
687. #endif
688. es=ERR_get_state();
^
689.
690. es->top=(es->top+1)%ERR_NUM_ERRORS;
crypto/err/err.c:690:2:
688. es=ERR_get_state();
689.
690. > es->top=(es->top+1)%ERR_NUM_ERRORS;
691. if (es->top == es->bottom)
692. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
crypto/err/err.c:691:6: Taking false branch
689.
690. es->top=(es->top+1)%ERR_NUM_ERRORS;
691. if (es->top == es->bottom)
^
692. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
693. es->err_flags[es->top]=0;
crypto/err/err.c:693:2:
691. if (es->top == es->bottom)
692. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
693. > es->err_flags[es->top]=0;
694. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
695. es->err_file[es->top]=file;
crypto/err/err.c:694:2:
692. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
693. es->err_flags[es->top]=0;
694. > es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
695. es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
crypto/err/err.c:695:2:
693. es->err_flags[es->top]=0;
694. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
695. > es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
crypto/err/err.c:696:2:
694. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
695. es->err_file[es->top]=file;
696. > es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
698. }
crypto/err/err.c:697:2: Taking true branch
695. es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
^
698. }
699.
crypto/err/err.c:697:2: Taking true branch
695. es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
^
698. }
699.
crypto/mem.c:371:1: start of procedure CRYPTO_free()
369. }
370.
371. > void CRYPTO_free(void *str)
372. {
373. if (free_debug_func != NULL)
crypto/mem.c:373:6: Taking true branch
371. void CRYPTO_free(void *str)
372. {
373. if (free_debug_func != NULL)
^
374. free_debug_func(str, 0);
375. #ifdef LEVITTE_DEBUG_MEM
crypto/mem.c:374:3: Skipping __function_pointer__(): unresolved function pointer
372. {
373. if (free_debug_func != NULL)
374. free_debug_func(str, 0);
^
375. #ifdef LEVITTE_DEBUG_MEM
376. fprintf(stderr, "LEVITTE_DEBUG_MEM: < 0x%p\n", str);
crypto/mem.c:378:2: Skipping __function_pointer__(): unresolved function pointer
376. fprintf(stderr, "LEVITTE_DEBUG_MEM: < 0x%p\n", str);
377. #endif
378. free_func(str);
^
379. if (free_debug_func != NULL)
380. free_debug_func(NULL, 1);
crypto/mem.c:379:6: Taking true branch
377. #endif
378. free_func(str);
379. if (free_debug_func != NULL)
^
380. free_debug_func(NULL, 1);
381. }
crypto/mem.c:380:3: Skipping __function_pointer__(): unresolved function pointer
378. free_func(str);
379. if (free_debug_func != NULL)
380. free_debug_func(NULL, 1);
^
381. }
382.
crypto/mem.c:379:2:
377. #endif
378. free_func(str);
379. > if (free_debug_func != NULL)
380. free_debug_func(NULL, 1);
381. }
crypto/mem.c:381:2: return from a call to CRYPTO_free
379. if (free_debug_func != NULL)
380. free_debug_func(NULL, 1);
381. }
^
382.
383. void *CRYPTO_remalloc(void *a, int num, const char *file, int line)
crypto/err/err.c:697:2: Loop condition is false. Leaving loop
695. es->err_file[es->top]=file;
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
^
698. }
699.
crypto/err/err.c:698:2: return from a call to ERR_put_error
696. es->err_line[es->top]=line;
697. err_clear_data(es,es->top);
698. }
^
699.
700. void ERR_clear_error(void)
crypto/buffer/buffer.c:181:3:
179. {
180. BUFerr(BUF_F_BUF_STRNDUP,ERR_R_MALLOC_FAILURE);
181. > return(NULL);
182. }
183. BUF_strlcpy(ret,str,siz+1);
crypto/buffer/buffer.c:185:2: return from a call to BUF_strndup
183. BUF_strlcpy(ret,str,siz+1);
184. return(ret);
185. }
^
186.
187. void *BUF_memdup(const void *data, size_t siz)
crypto/buffer/buffer.c:169:2: return from a call to BUF_strdup
167. if (str == NULL) return(NULL);
168. return BUF_strndup(str, strlen(str));
169. }
^
170.
171. char *BUF_strndup(const char *str, size_t siz)
apps/ca.c:2882:2:
2880. tmp = BUF_strdup(str);
2881.
2882. > p = strchr(tmp, ',');
2883.
2884. rtime_str = tmp;
| https://github.com/openssl/openssl/blob/03ddbdd9b99ea60d0967b831ffc1fe93ae7f9792/apps/ca.c/#L2882 |
d2a_code_trace_data_42374 | 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:1075: error: Integer Overflow L2
([0, `h`] - 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 `h`
1067. * 8-bit palette => colormap/RGB
1068. */
1069. DECLAREContigPutFunc(put8bitcmaptile)
^
1070. {
1071. uint32** PALmap = img->PALmap;
libtiff/tif_getimage.c:1075:12: Binary operation: ([0, h] - 1):unsigned32
1073.
1074. (void) y;
1075. while (h-- > 0) {
^
1076. for (x = w; x-- > 0;)
1077. {
| https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_getimage.c/#L1075 |
d2a_code_trace_data_42375 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/ec/ecp_smpl.c:710: 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:638:5: Call
636. }
637.
638. BN_CTX_start(ctx);
^
639. n0 = BN_CTX_get(ctx);
640. n1 = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/ec/ecp_smpl.c:710:13: Call
708. if (BN_is_zero(n6)) {
709. /* a is the same point as b */
710. BN_CTX_end(ctx);
^
711. ret = EC_POINT_dbl(group, r, a, ctx);
712. ctx = NULL;
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_42376 | static char *
ngx_http_core_error_page(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
ngx_http_core_loc_conf_t *clcf = conf;
u_char *p;
ngx_int_t overwrite;
ngx_str_t *value, uri, args;
ngx_uint_t i, n;
ngx_http_err_page_t *err;
ngx_http_complex_value_t cv;
ngx_http_compile_complex_value_t ccv;
if (clcf->error_pages == NULL) {
clcf->error_pages = ngx_array_create(cf->pool, 4,
sizeof(ngx_http_err_page_t));
if (clcf->error_pages == NULL) {
return NGX_CONF_ERROR;
}
}
value = cf->args->elts;
i = cf->args->nelts - 2;
if (value[i].data[0] == '=') {
if (i == 1) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"invalid value \"%V\"", &value[i]);
return NGX_CONF_ERROR;
}
if (value[i].len > 1) {
overwrite = ngx_atoi(&value[i].data[1], value[i].len - 1);
if (overwrite == NGX_ERROR) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"invalid value \"%V\"", &value[i]);
return NGX_CONF_ERROR;
}
} else {
overwrite = 0;
}
n = 2;
} else {
overwrite = -1;
n = 1;
}
uri = value[cf->args->nelts - 1];
ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
ccv.cf = cf;
ccv.value = &uri;
ccv.complex_value = &cv;
if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
return NGX_CONF_ERROR;
}
ngx_str_null(&args);
if (cv.lengths == NULL && uri.data[0] == '/') {
p = (u_char *) ngx_strchr(uri.data, '?');
if (p) {
cv.value.len = p - uri.data;
cv.value.data = uri.data;
p++;
args.len = (uri.data + uri.len) - p;
args.data = p;
}
}
for (i = 1; i < cf->args->nelts - n; i++) {
err = ngx_array_push(clcf->error_pages);
if (err == NULL) {
return NGX_CONF_ERROR;
}
err->status = ngx_atoi(value[i].data, value[i].len);
if (err->status == NGX_ERROR || err->status == 499) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"invalid value \"%V\"", &value[i]);
return NGX_CONF_ERROR;
}
if (err->status < 300 || err->status > 599) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"value \"%V\" must be between 300 and 599",
&value[i]);
return NGX_CONF_ERROR;
}
if (overwrite >= 0) {
err->overwrite = overwrite;
} else {
switch (err->status) {
case NGX_HTTP_TO_HTTPS:
case NGX_HTTPS_CERT_ERROR:
case NGX_HTTPS_NO_CERT:
err->overwrite = NGX_HTTP_BAD_REQUEST;
break;
default:
err->overwrite = err->status;
break;
}
}
err->value = cv;
err->args = args;
}
return NGX_CONF_OK;
}
src/http/ngx_http_core_module.c:4004: error: Uninitialized Value
The value read from cv.lengths was never initialized.
src/http/ngx_http_core_module.c:4004:9:
4002. ngx_str_null(&args);
4003.
4004. if (cv.lengths == NULL && uri.data[0] == '/') {
^
4005. p = (u_char *) ngx_strchr(uri.data, '?');
4006.
| https://github.com/nginx/nginx/blob/bcd78e22e97d4c870b5104d0c540caaa972176ed/src/http/ngx_http_core_module.c/#L4004 |
d2a_code_trace_data_42377 | int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
enum AVSampleFormat sample_fmt, int align)
{
int line_size;
int sample_size = av_get_bytes_per_sample(sample_fmt);
int planar = av_sample_fmt_is_planar(sample_fmt);
if (!sample_size || nb_samples <= 0 || nb_channels <= 0)
return AVERROR(EINVAL);
if (!align) {
if (nb_samples > INT_MAX - 31)
return AVERROR(EINVAL);
align = 1;
nb_samples = FFALIGN(nb_samples, 32);
}
if (nb_channels > INT_MAX / align ||
(int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size)
return AVERROR(EINVAL);
line_size = planar ? FFALIGN(nb_samples * sample_size, align) :
FFALIGN(nb_samples * sample_size * nb_channels, align);
if (linesize)
*linesize = line_size;
return planar ? line_size * nb_channels : line_size;
}
libavcodec/mpegvideo_enc.c:952: error: Integer Overflow L2
([1, 2147483616] + 32):signed32 by call to `ff_alloc_picture`.
libavcodec/mpegvideo_enc.c:952:17: Call
950. pic->reference = 3;
951.
952. if (ff_alloc_picture(s, pic, 0) < 0) {
^
953. return -1;
954. }
libavcodec/mpegvideo.c:587:1: Parameter `pic->f.nb_samples`
585. * The pixels are allocated/set by calling get_buffer() if shared = 0
586. */
587. int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared)
^
588. {
589. int i, ret;
libavcodec/mpegvideo.c:597:13: Call
595. assert(!pic->f.buf[0]);
596.
597. if (alloc_frame_buffer(s, pic) < 0)
^
598. return -1;
599.
libavcodec/mpegvideo.c:424:1: Parameter `pic->f.nb_samples`
422. * Allocate a frame buffer
423. */
424. static int alloc_frame_buffer(MpegEncContext *s, Picture *pic)
^
425. {
426. int edges_needed = av_codec_is_encoder(s->avctx->codec);
libavcodec/mpegvideo.c:444:13: Call
442. pic->f.height = s->avctx->height;
443. pic->f.format = s->avctx->pix_fmt;
444. r = avcodec_default_get_buffer2(s->avctx, &pic->f, 0);
^
445. }
446.
libavcodec/utils.c:524:1: Parameter `frame->nb_samples`
522. }
523.
524. int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags)
^
525. {
526. int ret;
libavcodec/utils.c:528:16: Call
526. int ret;
527.
528. if ((ret = update_frame_pool(avctx, frame)) < 0)
^
529. return ret;
530.
libavcodec/utils.c:327:1: Parameter `frame->nb_samples`
325. }
326.
327. static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame)
^
328. {
329. FramePool *pool = avctx->internal->pool;
libavcodec/utils.c:399:15: Call
397.
398. av_buffer_pool_uninit(&pool->pools[0]);
399. ret = av_samples_get_buffer_size(&pool->linesize[0], ch,
^
400. frame->nb_samples, frame->format, 0);
401. if (ret < 0)
libavutil/samplefmt.c:108:1: <LHS trace>
106. }
107.
108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
^
109. enum AVSampleFormat sample_fmt, int align)
110. {
libavutil/samplefmt.c:108:1: Parameter `nb_samples`
106. }
107.
108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
^
109. enum AVSampleFormat sample_fmt, int align)
110. {
libavutil/samplefmt.c:124:9: Binary operation: ([1, 2147483616] + 32):signed32 by call to `ff_alloc_picture`
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_42378 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
test/rsa_sp800_56b_test.c:513: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `rsa_sp800_56b_derive_params_from_pq`.
Showing all 30 steps of the trace
test/rsa_sp800_56b_test.c:488:5: Call
486. if (!(TEST_ptr(key = RSA_new()) && TEST_ptr(ctx = BN_CTX_new())))
487. goto err;
488. BN_CTX_start(ctx);
^
489.
490. e = bn_load(ctx, cav_e, sizeof(cav_e));
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);
test/rsa_sp800_56b_test.c:513:14: Call
511. Xp2, q1, q2, NULL, Xq, Xq1,
512. Xq2, 2048, e, ctx, NULL))
513. && TEST_true(rsa_sp800_56b_derive_params_from_pq(key, 2048, e, ctx))
^
514. && TEST_BN_eq(p1_exp, p1)
515. && TEST_BN_eq(p2_exp, p2)
crypto/rsa/rsa_sp800_56b_gen.c:180:1: Parameter `ctx->stack.depth`
178. * 1 = success.
179. */
180. > int rsa_sp800_56b_derive_params_from_pq(RSA *rsa, int nbits,
181. const BIGNUM *e, BN_CTX *ctx)
182. {
crypto/rsa/rsa_sp800_56b_gen.c:186:5: Call
184. BIGNUM *p1, *q1, *lcm, *p1q1, *gcd;
185.
186. BN_CTX_start(ctx);
^
187. p1 = BN_CTX_get(ctx);
188. q1 = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/rsa/rsa_sp800_56b_gen.c:187:10: Call
185.
186. BN_CTX_start(ctx);
187. p1 = BN_CTX_get(ctx);
^
188. q1 = BN_CTX_get(ctx);
189. lcm = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/rsa/rsa_sp800_56b_gen.c:188:10: Call
186. BN_CTX_start(ctx);
187. p1 = BN_CTX_get(ctx);
188. q1 = BN_CTX_get(ctx);
^
189. lcm = BN_CTX_get(ctx);
190. p1q1 = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/rsa/rsa_sp800_56b_gen.c:189:11: Call
187. p1 = BN_CTX_get(ctx);
188. q1 = BN_CTX_get(ctx);
189. lcm = BN_CTX_get(ctx);
^
190. p1q1 = BN_CTX_get(ctx);
191. gcd = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/rsa/rsa_sp800_56b_gen.c:190:12: Call
188. q1 = BN_CTX_get(ctx);
189. lcm = BN_CTX_get(ctx);
190. p1q1 = BN_CTX_get(ctx);
^
191. gcd = BN_CTX_get(ctx);
192. if (gcd == NULL)
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/rsa/rsa_sp800_56b_gen.c:191:11: Call
189. lcm = BN_CTX_get(ctx);
190. p1q1 = BN_CTX_get(ctx);
191. gcd = BN_CTX_get(ctx);
^
192. if (gcd == NULL)
193. 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/rsa/rsa_sp800_56b_gen.c:196:9: Call
194.
195. /* LCM((p-1, q-1)) */
196. if (rsa_get_lcm(ctx, rsa->p, rsa->q, lcm, gcd, p1, q1, p1q1) != 1)
^
197. goto err;
198.
crypto/rsa/rsa_sp800_56b_check.c:220:1: Parameter `ctx->stack.depth`
218.
219. /* return LCM(p-1, q-1) */
220. > int rsa_get_lcm(BN_CTX *ctx, const BIGNUM *p, const BIGNUM *q,
221. BIGNUM *lcm, BIGNUM *gcd, BIGNUM *p1, BIGNUM *q1,
222. BIGNUM *p1q1)
crypto/rsa/rsa_sp800_56b_check.c:226:15: Call
224. return BN_sub(p1, p, BN_value_one()) /* p-1 */
225. && BN_sub(q1, q, BN_value_one()) /* q-1 */
226. && BN_mul(p1q1, p1, q1, ctx) /* (p-1)(q-1) */
^
227. && BN_gcd(gcd, p1, q1, ctx)
228. && BN_div(lcm, NULL, p1q1, gcd, ctx); /* LCM((p-1, q-1)) */
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:507:1: Parameter `ctx->stack.depth`
505. }
506.
507. > int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
508. {
509. int ret = 0;
crypto/bn/bn_mul.c: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.depth`
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.depth`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <LHS trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `rsa_sp800_56b_derive_params_from_pq`
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_42379 | static void load_module(const char *filename)
{
void *dll;
void (*init_func)(void);
dll = dlopen(filename, RTLD_NOW);
if (!dll) {
fprintf(stderr, "Could not load module '%s' - %s\n",
filename, dlerror());
return;
}
init_func = dlsym(dll, "avserver_module_init");
if (!init_func) {
fprintf(stderr,
"%s: init function 'avserver_module_init()' not found\n",
filename);
dlclose(dll);
}
init_func();
}
avserver.c:3909: error: Null Dereference
pointer `init_func` last assigned on line 3901 could be null and is dereferenced at line 3909, column 5.
avserver.c:3890:1: start of procedure load_module()
3888.
3889. #if HAVE_DLOPEN
3890. static void load_module(const char *filename)
^
3891. {
3892. void *dll;
avserver.c:3894:5: Skipping dlopen(): method has no implementation
3892. void *dll;
3893. void (*init_func)(void);
3894. dll = dlopen(filename, RTLD_NOW);
^
3895. if (!dll) {
3896. fprintf(stderr, "Could not load module '%s' - %s\n",
avserver.c:3895:10: Taking false branch
3893. void (*init_func)(void);
3894. dll = dlopen(filename, RTLD_NOW);
3895. if (!dll) {
^
3896. fprintf(stderr, "Could not load module '%s' - %s\n",
3897. filename, dlerror());
avserver.c:3901:5: Skipping dlsym(): method has no implementation
3899. }
3900.
3901. init_func = dlsym(dll, "avserver_module_init");
^
3902. if (!init_func) {
3903. fprintf(stderr,
avserver.c:3902:10: Taking true branch
3900.
3901. init_func = dlsym(dll, "avserver_module_init");
3902. if (!init_func) {
^
3903. fprintf(stderr,
3904. "%s: init function 'avserver_module_init()' not found\n",
avserver.c:3903:9:
3901. init_func = dlsym(dll, "avserver_module_init");
3902. if (!init_func) {
3903. fprintf(stderr,
^
3904. "%s: init function 'avserver_module_init()' not found\n",
3905. filename);
avserver.c:3906:9: Skipping dlclose(): method has no implementation
3904. "%s: init function 'avserver_module_init()' not found\n",
3905. filename);
3906. dlclose(dll);
^
3907. }
3908.
avserver.c:3909:5:
3907. }
3908.
3909. init_func();
^
3910. }
3911. #endif
| https://github.com/libav/libav/blob/e1e369049e3d2f88eed6ed38eb3dd704681c7f1a/avserver.c/#L3909 |
d2a_code_trace_data_42380 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/rsa/rsa_crpt.c:180: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `rsa_get_public_exp`.
Showing all 17 steps of the trace
crypto/rsa/rsa_crpt.c:160:1: Parameter `in_ctx->stack.depth`
158. }
159.
160. > BN_BLINDING *RSA_setup_blinding(RSA *rsa, BN_CTX *in_ctx)
161. {
162. BIGNUM *e;
crypto/rsa/rsa_crpt.c:172:5: Call
170. ctx = in_ctx;
171.
172. BN_CTX_start(ctx);
^
173. e = BN_CTX_get(ctx);
174. if (e == NULL) {
crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth`
234. }
235.
236. > void BN_CTX_start(BN_CTX *ctx)
237. {
238. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/rsa/rsa_crpt.c:180:13: Call
178.
179. if (rsa->e == NULL) {
180. e = rsa_get_public_exp(rsa->d, rsa->p, rsa->q, ctx);
^
181. if (e == NULL) {
182. RSAerr(RSA_F_RSA_SETUP_BLINDING, RSA_R_NO_PUBLIC_EXPONENT);
crypto/rsa/rsa_crpt.c:132:1: Parameter `ctx->stack.depth`
130. }
131.
132. > static BIGNUM *rsa_get_public_exp(const BIGNUM *d, const BIGNUM *p,
133. const BIGNUM *q, BN_CTX *ctx)
134. {
crypto/rsa/rsa_crpt.c:140:5: Call
138. return NULL;
139.
140. BN_CTX_start(ctx);
^
141. r0 = BN_CTX_get(ctx);
142. r1 = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth`
234. }
235.
236. > void BN_CTX_start(BN_CTX *ctx)
237. {
238. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/rsa/rsa_crpt.c:151:10: Call
149. if (!BN_sub(r2, q, BN_value_one()))
150. goto err;
151. if (!BN_mul(r0, r1, r2, ctx))
^
152. goto err;
153.
crypto/bn/bn_mul.c:883:1: Parameter `ctx->stack.depth`
881. #endif /* BN_RECURSION */
882.
883. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
884. {
885. int ret = 0;
crypto/bn/bn_mul.c:909:5: Call
907. top = al + bl;
908.
909. BN_CTX_start(ctx);
^
910. if ((r == a) || (r == b)) {
911. if ((rr = BN_CTX_get(ctx)) == NULL)
crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth`
234. }
235.
236. > void BN_CTX_start(BN_CTX *ctx)
237. {
238. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_mul.c:1033:5: Call
1031. err:
1032. bn_check_top(r);
1033. BN_CTX_end(ctx);
^
1034. return (ret);
1035. }
crypto/bn/bn_ctx.c:250:1: Parameter `ctx->stack.depth`
248. }
249.
250. > void BN_CTX_end(BN_CTX *ctx)
251. {
252. CTXDBG_ENTRY("BN_CTX_end", ctx);
crypto/bn/bn_ctx.c:256:27: Call
254. ctx->err_stack--;
255. else {
256. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
257. /* Does this stack frame have anything to release? */
258. if (fp < ctx->used)
crypto/bn/bn_ctx.c:326:1: <LHS trace>
324. }
325.
326. > static unsigned int BN_STACK_pop(BN_STACK *st)
327. {
328. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:326:1: Parameter `st->depth`
324. }
325.
326. > static unsigned int BN_STACK_pop(BN_STACK *st)
327. {
328. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:328:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `rsa_get_public_exp`
326. static unsigned int BN_STACK_pop(BN_STACK *st)
327. {
328. return st->indexes[--(st->depth)];
^
329. }
330.
| https://github.com/openssl/openssl/blob/e113c9c59dcb419dd00525cec431edb854a6c897/crypto/bn/bn_ctx.c/#L328 |
d2a_code_trace_data_42381 | static int init_output_stream_streamcopy(OutputStream *ost)
{
OutputFile *of = output_files[ost->file_index];
InputStream *ist = get_input_stream(ost);
AVCodecParameters *par_dst = ost->st->codecpar;
AVCodecParameters *par_src = ist->st->codecpar;
AVRational sar;
uint32_t codec_tag = par_dst->codec_tag;
int i, ret;
if (!codec_tag) {
if (!of->ctx->oformat->codec_tag ||
av_codec_get_id (of->ctx->oformat->codec_tag, par_src->codec_tag) == par_src->codec_id ||
av_codec_get_tag(of->ctx->oformat->codec_tag, par_src->codec_id) <= 0)
codec_tag = par_src->codec_tag;
}
ret = avcodec_parameters_copy(par_dst, par_src);
if (ret < 0)
return ret;
par_dst->codec_tag = codec_tag;
ost->st->disposition = ist->st->disposition;
ost->st->time_base = ist->st->time_base;
if (ist->st->nb_side_data) {
ost->st->side_data = av_realloc_array(NULL, ist->st->nb_side_data,
sizeof(*ist->st->side_data));
if (!ost->st->side_data)
return AVERROR(ENOMEM);
for (i = 0; i < ist->st->nb_side_data; i++) {
const AVPacketSideData *sd_src = &ist->st->side_data[i];
AVPacketSideData *sd_dst = &ost->st->side_data[i];
sd_dst->data = av_malloc(sd_src->size);
if (!sd_dst->data)
return AVERROR(ENOMEM);
memcpy(sd_dst->data, sd_src->data, sd_src->size);
sd_dst->size = sd_src->size;
sd_dst->type = sd_src->type;
ost->st->nb_side_data++;
}
}
ost->parser = av_parser_init(par_dst->codec_id);
ost->parser_avctx = avcodec_alloc_context3(NULL);
if (!ost->parser_avctx)
return AVERROR(ENOMEM);
if (par_dst->codec_type == AVMEDIA_TYPE_VIDEO) {
if (ost->frame_aspect_ratio)
sar = av_d2q(ost->frame_aspect_ratio * par_dst->height / par_dst->width, 255);
else if (ist->st->sample_aspect_ratio.num)
sar = ist->st->sample_aspect_ratio;
else
sar = par_src->sample_aspect_ratio;
ost->st->sample_aspect_ratio = par_dst->sample_aspect_ratio = sar;
}
return 0;
}
avconv.c:1817: error: Null Dereference
pointer `ist` last assigned on line 1815 could be null and is dereferenced at line 1817, column 34.
avconv.c:1812:1: start of procedure init_output_stream_streamcopy()
1810. }
1811.
1812. static int init_output_stream_streamcopy(OutputStream *ost)
^
1813. {
1814. OutputFile *of = output_files[ost->file_index];
avconv.c:1814:5:
1812. static int init_output_stream_streamcopy(OutputStream *ost)
1813. {
1814. OutputFile *of = output_files[ost->file_index];
^
1815. InputStream *ist = get_input_stream(ost);
1816. AVCodecParameters *par_dst = ost->st->codecpar;
avconv.c:1815:5:
1813. {
1814. OutputFile *of = output_files[ost->file_index];
1815. InputStream *ist = get_input_stream(ost);
^
1816. AVCodecParameters *par_dst = ost->st->codecpar;
1817. AVCodecParameters *par_src = ist->st->codecpar;
avconv.c:1703:1: start of procedure get_input_stream()
1701. }
1702.
1703. static InputStream *get_input_stream(OutputStream *ost)
^
1704. {
1705. if (ost->source_index >= 0)
avconv.c:1705:9: Taking false branch
1703. static InputStream *get_input_stream(OutputStream *ost)
1704. {
1705. if (ost->source_index >= 0)
^
1706. return input_streams[ost->source_index];
1707.
avconv.c:1708:9: Taking true branch
1706. return input_streams[ost->source_index];
1707.
1708. if (ost->filter) {
^
1709. FilterGraph *fg = ost->filter->graph;
1710. int i;
avconv.c:1709:9:
1707.
1708. if (ost->filter) {
1709. FilterGraph *fg = ost->filter->graph;
^
1710. int i;
1711.
avconv.c:1712:14:
1710. int i;
1711.
1712. for (i = 0; i < fg->nb_inputs; i++)
^
1713. if (fg->inputs[i]->ist->dec_ctx->codec_type == ost->enc_ctx->codec_type)
1714. return fg->inputs[i]->ist;
avconv.c:1712:21: Loop condition is true. Entering loop body
1710. int i;
1711.
1712. for (i = 0; i < fg->nb_inputs; i++)
^
1713. if (fg->inputs[i]->ist->dec_ctx->codec_type == ost->enc_ctx->codec_type)
1714. return fg->inputs[i]->ist;
avconv.c:1713:17: Taking false branch
1711.
1712. for (i = 0; i < fg->nb_inputs; i++)
1713. if (fg->inputs[i]->ist->dec_ctx->codec_type == ost->enc_ctx->codec_type)
^
1714. return fg->inputs[i]->ist;
1715. }
avconv.c:1712:40:
1710. int i;
1711.
1712. for (i = 0; i < fg->nb_inputs; i++)
^
1713. if (fg->inputs[i]->ist->dec_ctx->codec_type == ost->enc_ctx->codec_type)
1714. return fg->inputs[i]->ist;
avconv.c:1712:21: Loop condition is false. Leaving loop
1710. int i;
1711.
1712. for (i = 0; i < fg->nb_inputs; i++)
^
1713. if (fg->inputs[i]->ist->dec_ctx->codec_type == ost->enc_ctx->codec_type)
1714. return fg->inputs[i]->ist;
avconv.c:1717:5:
1715. }
1716.
1717. return NULL;
^
1718. }
1719.
avconv.c:1718:1: return from a call to get_input_stream
1716.
1717. return NULL;
1718. }
^
1719.
1720. /* open the muxer when all the streams are initialized */
avconv.c:1816:5:
1814. OutputFile *of = output_files[ost->file_index];
1815. InputStream *ist = get_input_stream(ost);
1816. AVCodecParameters *par_dst = ost->st->codecpar;
^
1817. AVCodecParameters *par_src = ist->st->codecpar;
1818. AVRational sar;
avconv.c:1817:5:
1815. InputStream *ist = get_input_stream(ost);
1816. AVCodecParameters *par_dst = ost->st->codecpar;
1817. AVCodecParameters *par_src = ist->st->codecpar;
^
1818. AVRational sar;
1819. uint32_t codec_tag = par_dst->codec_tag;
| https://github.com/libav/libav/blob/25bacd0a0c32ae682e6f411b1ac9020aeaabca72/avconv.c/#L1817 |
d2a_code_trace_data_42382 | int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
{
int i, j, bits, ret = 0, wstart, wend, window, wvalue;
int start = 1;
BIGNUM *d, *r;
const BIGNUM *aa;
BIGNUM *val[TABLE_SIZE];
BN_MONT_CTX *mont = NULL;
if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) {
return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);
}
bn_check_top(a);
bn_check_top(p);
bn_check_top(m);
if (!BN_is_odd(m)) {
BNerr(BN_F_BN_MOD_EXP_MONT, BN_R_CALLED_WITH_EVEN_MODULUS);
return (0);
}
bits = BN_num_bits(p);
if (bits == 0) {
if (BN_is_one(m)) {
ret = 1;
BN_zero(rr);
} else {
ret = BN_one(rr);
}
return ret;
}
BN_CTX_start(ctx);
d = BN_CTX_get(ctx);
r = BN_CTX_get(ctx);
val[0] = BN_CTX_get(ctx);
if (!d || !r || !val[0])
goto err;
if (in_mont != NULL)
mont = in_mont;
else {
if ((mont = BN_MONT_CTX_new()) == NULL)
goto err;
if (!BN_MONT_CTX_set(mont, m, ctx))
goto err;
}
if (a->neg || BN_ucmp(a, m) >= 0) {
if (!BN_nnmod(val[0], a, m, ctx))
goto err;
aa = val[0];
} else
aa = a;
if (BN_is_zero(aa)) {
BN_zero(rr);
ret = 1;
goto err;
}
if (!BN_to_montgomery(val[0], aa, mont, ctx))
goto err;
window = BN_window_bits_for_exponent_size(bits);
if (window > 1) {
if (!BN_mod_mul_montgomery(d, val[0], val[0], mont, ctx))
goto err;
j = 1 << (window - 1);
for (i = 1; i < j; i++) {
if (((val[i] = BN_CTX_get(ctx)) == NULL) ||
!BN_mod_mul_montgomery(val[i], val[i - 1], d, mont, ctx))
goto err;
}
}
start = 1;
wvalue = 0;
wstart = bits - 1;
wend = 0;
#if 1
j = m->top;
if (m->d[j - 1] & (((BN_ULONG)1) << (BN_BITS2 - 1))) {
if (bn_wexpand(r, j) == NULL)
goto err;
r->d[0] = (0 - m->d[0]) & BN_MASK2;
for (i = 1; i < j; i++)
r->d[i] = (~m->d[i]) & BN_MASK2;
r->top = j;
bn_correct_top(r);
} else
#endif
if (!BN_to_montgomery(r, BN_value_one(), mont, ctx))
goto err;
for (;;) {
if (BN_is_bit_set(p, wstart) == 0) {
if (!start) {
if (!BN_mod_mul_montgomery(r, r, r, mont, ctx))
goto err;
}
if (wstart == 0)
break;
wstart--;
continue;
}
j = wstart;
wvalue = 1;
wend = 0;
for (i = 1; i < window; i++) {
if (wstart - i < 0)
break;
if (BN_is_bit_set(p, wstart - i)) {
wvalue <<= (i - wend);
wvalue |= 1;
wend = i;
}
}
j = wend + 1;
if (!start)
for (i = 0; i < j; i++) {
if (!BN_mod_mul_montgomery(r, r, r, mont, ctx))
goto err;
}
if (!BN_mod_mul_montgomery(r, r, val[wvalue >> 1], mont, ctx))
goto err;
wstart -= wend + 1;
wvalue = 0;
start = 0;
if (wstart < 0)
break;
}
#if defined(SPARC_T4_MONT)
if (OPENSSL_sparcv9cap_P[0] & (SPARCV9_VIS3 | SPARCV9_PREFER_FPU)) {
j = mont->N.top;
val[0]->d[0] = 1;
for (i = 1; i < j; i++)
val[0]->d[i] = 0;
val[0]->top = j;
if (!BN_mod_mul_montgomery(rr, r, val[0], mont, ctx))
goto err;
} else
#endif
if (!BN_from_montgomery(rr, r, mont, ctx))
goto err;
ret = 1;
err:
if (in_mont == NULL)
BN_MONT_CTX_free(mont);
BN_CTX_end(ctx);
bn_check_top(rr);
return (ret);
}
test/bntest.c:2096: error: BUFFER_OVERRUN_L3
Offset: [1, +oo] Size: [0, 8388607] by call to `BN_is_prime_fasttest_ex`.
Showing all 14 steps of the trace
test/bntest.c:2095:10: Call
2093. * do_trial_division was set. */
2094. if (r == NULL ||
2095. !BN_set_word(r, 3) ||
^
2096. BN_is_prime_fasttest_ex(r, 3 /* nchecks */, ctx,
2097. 0 /* do_trial_division */, NULL) != 1 ||
crypto/bn/bn_lib.c:395:1: Parameter `*a->d`
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->d`
658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
659.
660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
661. {
662. if (bits > (INT_MAX - BN_BITS2 + 1))
test/bntest.c:2096:9: Call
2094. if (r == NULL ||
2095. !BN_set_word(r, 3) ||
2096. BN_is_prime_fasttest_ex(r, 3 /* nchecks */, ctx,
^
2097. 0 /* do_trial_division */, NULL) != 1 ||
2098. BN_is_prime_fasttest_ex(r, 3 /* nchecks */, ctx,
crypto/bn/bn_prime.c:153:1: Parameter `*a->d`
151. }
152.
153. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
154. int do_trial_division, BN_GENCB *cb)
155. {
crypto/bn/bn_prime.c:227:13: Call
225. /* now 1 <= check < a */
226.
227. j = witness(check, a, A1, A1_odd, k, ctx, mont);
^
228. if (j == -1)
229. goto err;
crypto/bn/bn_prime.c:249:1: Parameter `*a->d`
247. }
248.
249. > static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1,
250. const BIGNUM *a1_odd, int k, BN_CTX *ctx,
251. BN_MONT_CTX *mont)
crypto/bn/bn_prime.c:253:10: Call
251. BN_MONT_CTX *mont)
252. {
253. if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */
^
254. return -1;
255. if (BN_is_one(w))
crypto/bn/bn_exp.c:389:14: <Offset trace>
387. /* 2^(top*BN_BITS2) - m */
388. r->d[0] = (0 - m->d[0]) & BN_MASK2;
389. for (i = 1; i < j; i++)
^
390. r->d[i] = (~m->d[i]) & BN_MASK2;
391. r->top = j;
crypto/bn/bn_exp.c:389:14: Assignment
387. /* 2^(top*BN_BITS2) - m */
388. r->d[0] = (0 - m->d[0]) & BN_MASK2;
389. for (i = 1; i < j; i++)
^
390. r->d[i] = (~m->d[i]) & BN_MASK2;
391. r->top = j;
crypto/bn/bn_exp.c:294:1: <Length trace>
292. }
293.
294. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
295. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
296. {
crypto/bn/bn_exp.c:294:1: Parameter `*m->d`
292. }
293.
294. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
295. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
296. {
crypto/bn/bn_exp.c:390:25: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_is_prime_fasttest_ex`
388. r->d[0] = (0 - m->d[0]) & BN_MASK2;
389. for (i = 1; i < j; i++)
390. r->d[i] = (~m->d[i]) & BN_MASK2;
^
391. r->top = j;
392. /*
| https://github.com/openssl/openssl/blob/757264207ad8650a89ea903d48ad89f61d56ea9c/crypto/bn/bn_exp.c/#L390 |
d2a_code_trace_data_42383 | 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/record/rec_layer_s3.c:1375: error: INTEGER_OVERFLOW_L2
([0, max(0, `s->initial_ctx->sessions->num_items`)] - 1):unsigned64 by call to `SSL_CTX_remove_session`.
Showing all 11 steps of the trace
ssl/record/rec_layer_s3.c:969:1: Parameter `s->initial_ctx->sessions->num_items`
967. * none of our business
968. */
969. > int ssl3_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf,
970. int len, int peek)
971. {
ssl/record/rec_layer_s3.c:1375:13: Call
1373. ERR_add_error_data(2, "SSL alert number ", tmp);
1374. s->shutdown |= SSL_RECEIVED_SHUTDOWN;
1375. SSL_CTX_remove_session(s->session_ctx, s->session);
^
1376. return (0);
1377. } else {
ssl/ssl_sess.c:691:1: Parameter `ctx->sessions->num_items`
689. }
690.
691. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
692. {
693. return remove_session_lock(ctx, c, 1);
ssl/ssl_sess.c:693:12: Call
691. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
692. {
693. return remove_session_lock(ctx, c, 1);
^
694. }
695.
ssl/ssl_sess.c:696:1: Parameter `ctx->sessions->num_items`
694. }
695.
696. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
697. {
698. SSL_SESSION *r;
ssl/ssl_sess.c:706:17: Call
704. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) {
705. ret = 1;
706. r = lh_SSL_SESSION_delete(ctx->sessions, c);
^
707. SSL_SESSION_list_remove(ctx, c);
708. }
ssl/ssl_locl.h:581:1: Parameter `lh->num_items`
579. };
580.
581. > DEFINE_LHASH_OF(SSL_SESSION);
582. /* Needed in ssl_cert.c */
583. DEFINE_LHASH_OF(X509_NAME);
ssl/ssl_locl.h:581:1: Call
579. };
580.
581. > DEFINE_LHASH_OF(SSL_SESSION);
582. /* Needed in ssl_cert.c */
583. DEFINE_LHASH_OF(X509_NAME);
crypto/lhash/lhash.c:103:1: <LHS trace>
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:103:1: Parameter `lh->num_items`
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:123:5: Binary operation: ([0, max(0, s->initial_ctx->sessions->num_items)] - 1):unsigned64 by call to `SSL_CTX_remove_session`
121. }
122.
123. lh->num_items--;
^
124. if ((lh->num_nodes > MIN_NODES) &&
125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
| https://github.com/openssl/openssl/blob/2a7de0fd5d9baf946ef4d2c51096b04dd47a8143/crypto/lhash/lhash.c/#L123 |
d2a_code_trace_data_42384 | static void pred8x8l_vertical_right_c(uint8_t *src, int has_topleft, int has_topright, int stride)
{
PREDICT_8x8_LOAD_TOP;
PREDICT_8x8_LOAD_LEFT;
PREDICT_8x8_LOAD_TOPLEFT;
SRC(0,6)= (l5 + 2*l4 + l3 + 2) >> 2;
SRC(0,7)= (l6 + 2*l5 + l4 + 2) >> 2;
SRC(0,4)=SRC(1,6)= (l3 + 2*l2 + l1 + 2) >> 2;
SRC(0,5)=SRC(1,7)= (l4 + 2*l3 + l2 + 2) >> 2;
SRC(0,2)=SRC(1,4)=SRC(2,6)= (l1 + 2*l0 + lt + 2) >> 2;
SRC(0,3)=SRC(1,5)=SRC(2,7)= (l2 + 2*l1 + l0 + 2) >> 2;
SRC(0,1)=SRC(1,3)=SRC(2,5)=SRC(3,7)= (l0 + 2*lt + t0 + 2) >> 2;
SRC(0,0)=SRC(1,2)=SRC(2,4)=SRC(3,6)= (lt + t0 + 1) >> 1;
SRC(1,1)=SRC(2,3)=SRC(3,5)=SRC(4,7)= (lt + 2*t0 + t1 + 2) >> 2;
SRC(1,0)=SRC(2,2)=SRC(3,4)=SRC(4,6)= (t0 + t1 + 1) >> 1;
SRC(2,1)=SRC(3,3)=SRC(4,5)=SRC(5,7)= (t0 + 2*t1 + t2 + 2) >> 2;
SRC(2,0)=SRC(3,2)=SRC(4,4)=SRC(5,6)= (t1 + t2 + 1) >> 1;
SRC(3,1)=SRC(4,3)=SRC(5,5)=SRC(6,7)= (t1 + 2*t2 + t3 + 2) >> 2;
SRC(3,0)=SRC(4,2)=SRC(5,4)=SRC(6,6)= (t2 + t3 + 1) >> 1;
SRC(4,1)=SRC(5,3)=SRC(6,5)=SRC(7,7)= (t2 + 2*t3 + t4 + 2) >> 2;
SRC(4,0)=SRC(5,2)=SRC(6,4)=SRC(7,6)= (t3 + t4 + 1) >> 1;
SRC(5,1)=SRC(6,3)=SRC(7,5)= (t3 + 2*t4 + t5 + 2) >> 2;
SRC(5,0)=SRC(6,2)=SRC(7,4)= (t4 + t5 + 1) >> 1;
SRC(6,1)=SRC(7,3)= (t4 + 2*t5 + t6 + 2) >> 2;
SRC(6,0)=SRC(7,2)= (t5 + t6 + 1) >> 1;
SRC(7,1)= (t5 + 2*t6 + t7 + 2) >> 2;
SRC(7,0)= (t6 + t7 + 1) >> 1;
}
libavcodec/h264pred.c:900: error: Uninitialized Value
The value read from t7 was never initialized.
libavcodec/h264pred.c:900:5:
898. SRC(6,0)=SRC(7,2)= (t5 + t6 + 1) >> 1;
899. SRC(7,1)= (t5 + 2*t6 + t7 + 2) >> 2;
900. SRC(7,0)= (t6 + t7 + 1) >> 1;
^
901. }
902. static void pred8x8l_horizontal_down_c(uint8_t *src, int has_topleft, int has_topright, int stride)
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264pred.c/#L900 |
d2a_code_trace_data_42385 | static ossl_inline size_t constant_time_is_zero_s(size_t a)
{
return constant_time_msb_s(~a & (a - 1));
}
include/internal/constant_time_locl.h:173: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned64 by call to `constant_time_is_zero_s`.
Showing all 5 steps of the trace
include/internal/constant_time_locl.h:171:1: Parameter `a`
169. }
170.
171. > static ossl_inline size_t constant_time_eq_s(size_t a, size_t b)
172. {
173. return constant_time_is_zero_s(a ^ b);
include/internal/constant_time_locl.h:173:12: Call
171. static ossl_inline size_t constant_time_eq_s(size_t a, size_t b)
172. {
173. return constant_time_is_zero_s(a ^ b);
^
174. }
175.
include/internal/constant_time_locl.h:155:1: <LHS trace>
153. }
154.
155. > static ossl_inline size_t constant_time_is_zero_s(size_t a)
156. {
157. return constant_time_msb_s(~a & (a - 1));
include/internal/constant_time_locl.h:155:1: Parameter `a`
153. }
154.
155. > static ossl_inline size_t constant_time_is_zero_s(size_t a)
156. {
157. return constant_time_msb_s(~a & (a - 1));
include/internal/constant_time_locl.h:157:12: Binary operation: ([0, +oo] - 1):unsigned64 by call to `constant_time_is_zero_s`
155. static ossl_inline size_t constant_time_is_zero_s(size_t a)
156. {
157. return constant_time_msb_s(~a & (a - 1));
^
158. }
159.
| https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/include/internal/constant_time_locl.h/#L157 |
d2a_code_trace_data_42386 | static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
RTSPState *rt = s->priv_data;
RTSPStream *rtsp_st;
int size, i, err;
char *content;
char url[1024];
if (!ff_network_init())
return AVERROR(EIO);
content = av_malloc(SDP_MAX_SIZE);
size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
if (size <= 0) {
av_free(content);
return AVERROR_INVALIDDATA;
}
content[size] ='\0';
err = ff_sdp_parse(s, content);
av_free(content);
if (err) goto fail;
for (i = 0; i < rt->nb_rtsp_streams; i++) {
char namebuf[50];
rtsp_st = rt->rtsp_streams[i];
getnameinfo((struct sockaddr*) &rtsp_st->sdp_ip, sizeof(rtsp_st->sdp_ip),
namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);
ff_url_join(url, sizeof(url), "rtp", NULL,
namebuf, rtsp_st->sdp_port,
"?localport=%d&ttl=%d", rtsp_st->sdp_port,
rtsp_st->sdp_ttl);
if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE) < 0) {
err = AVERROR_INVALIDDATA;
goto fail;
}
if ((err = rtsp_open_transport_ctx(s, rtsp_st)))
goto fail;
}
return 0;
fail:
ff_rtsp_close_streams(s);
ff_network_close();
return err;
}
libavformat/rtsp.c:1797: error: Null Dereference
pointer `content` last assigned on line 1791 could be null and is dereferenced at line 1797, column 5.
libavformat/rtsp.c:1778:1: start of procedure sdp_read_header()
1776. }
1777.
1778. static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap)
^
1779. {
1780. RTSPState *rt = s->priv_data;
libavformat/rtsp.c:1780:5:
1778. static int sdp_read_header(AVFormatContext *s, AVFormatParameters *ap)
1779. {
1780. RTSPState *rt = s->priv_data;
^
1781. RTSPStream *rtsp_st;
1782. int size, i, err;
libavformat/rtsp.c:1786:10:
1784. char url[1024];
1785.
1786. if (!ff_network_init())
^
1787. return AVERROR(EIO);
1788.
libavformat/network.h:65:1: start of procedure ff_network_init()
63. int ff_socket_nonblock(int socket, int enable);
64.
65. static inline int ff_network_init(void)
^
66. {
67. #if HAVE_WINSOCK2_H
libavformat/network.h:72:5:
70. return 0;
71. #endif
72. return 1;
^
73. }
74.
libavformat/network.h:73:1: return from a call to ff_network_init
71. #endif
72. return 1;
73. }
^
74.
75. static inline int ff_network_wait_fd(int fd, int write)
libavformat/rtsp.c:1786:10: Taking false branch
1784. char url[1024];
1785.
1786. if (!ff_network_init())
^
1787. return AVERROR(EIO);
1788.
libavformat/rtsp.c:1791:5:
1789. /* read the whole sdp file */
1790. /* XXX: better loading */
1791. content = av_malloc(SDP_MAX_SIZE);
^
1792. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
1793. if (size <= 0) {
libavutil/mem.c:64:1: start of procedure av_malloc()
62. linker will do it automatically. */
63.
64. void *av_malloc(size_t size)
^
65. {
66. void *ptr = NULL;
libavutil/mem.c:66:5:
64. void *av_malloc(size_t size)
65. {
66. void *ptr = NULL;
^
67. #if CONFIG_MEMALIGN_HACK
68. long diff;
libavutil/mem.c:72:8: Taking false branch
70.
71. /* let's disallow possible ambiguous cases */
72. if(size > (INT_MAX-32) )
^
73. return NULL;
74.
libavutil/mem.c:83:9: Taking true branch
81. ((char*)ptr)[-1]= diff;
82. #elif HAVE_POSIX_MEMALIGN
83. if (posix_memalign(&ptr,32,size))
^
84. ptr = NULL;
85. #elif HAVE_MEMALIGN
libavutil/mem.c:84:9:
82. #elif HAVE_POSIX_MEMALIGN
83. if (posix_memalign(&ptr,32,size))
84. ptr = NULL;
^
85. #elif HAVE_MEMALIGN
86. ptr = memalign(32,size);
libavutil/mem.c:114:5:
112. ptr = malloc(size);
113. #endif
114. return ptr;
^
115. }
116.
libavutil/mem.c:115:1: return from a call to av_malloc
113. #endif
114. return ptr;
115. }
^
116.
117. void *av_realloc(void *ptr, size_t size)
libavformat/rtsp.c:1792:5: Skipping avio_read(): empty list of specs
1790. /* XXX: better loading */
1791. content = av_malloc(SDP_MAX_SIZE);
1792. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
^
1793. if (size <= 0) {
1794. av_free(content);
libavformat/rtsp.c:1793:9: Taking false branch
1791. content = av_malloc(SDP_MAX_SIZE);
1792. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
1793. if (size <= 0) {
^
1794. av_free(content);
1795. return AVERROR_INVALIDDATA;
libavformat/rtsp.c:1797:5:
1795. return AVERROR_INVALIDDATA;
1796. }
1797. content[size] ='\0';
^
1798.
1799. err = ff_sdp_parse(s, content);
| https://github.com/libav/libav/blob/771339ca206468636a64a6041852068be2da3dd2/libavformat/rtsp.c/#L1797 |
d2a_code_trace_data_42387 | int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples,
enum AVSampleFormat sample_fmt, int align)
{
int line_size;
int sample_size = av_get_bytes_per_sample(sample_fmt);
int planar = av_sample_fmt_is_planar(sample_fmt);
if (!sample_size || nb_samples <= 0 || nb_channels <= 0)
return AVERROR(EINVAL);
if (!align) {
if (nb_samples > INT_MAX - 31)
return AVERROR(EINVAL);
align = 1;
nb_samples = FFALIGN(nb_samples, 32);
}
if (nb_channels > INT_MAX / align ||
(int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size)
return AVERROR(EINVAL);
line_size = planar ? FFALIGN(nb_samples * sample_size, align) :
FFALIGN(nb_samples * sample_size * nb_channels, align);
if (linesize)
*linesize = line_size;
return planar ? line_size * nb_channels : line_size;
}
libavcodec/vp3.c:2090: error: Integer Overflow L2
([1, 2147483616] + 32):signed32 by call to `av_frame_ref`.
libavcodec/vp3.c:2081:9: Call
2079. s->last_slice_end = 0;
2080. for (i = 0; i < s->c_superblock_height; i++)
2081. render_slice(s, i);
^
2082.
2083. // filter the last row
libavcodec/vp3.c:1457:1: Parameter `s->qmat[*][*][*][*]`
1455. * The slice number ranges from 0..(c_superblock_height - 1).
1456. */
1457. static void render_slice(Vp3DecodeContext *s, int slice)
^
1458. {
1459. int x, y, i, j, fragment;
libavcodec/vp3.c:2090:16: Call
2088. vp3_draw_horiz_band(s, s->avctx->height);
2089.
2090. if ((ret = av_frame_ref(data, s->current_frame.f)) < 0)
^
2091. return ret;
2092. *got_frame = 1;
libavutil/frame.c:174:1: Parameter `src->nb_samples`
172. }
173.
174. int av_frame_ref(AVFrame *dst, const AVFrame *src)
^
175. {
176. int i, ret = 0;
libavutil/frame.c:182:5: Assignment
180. dst->height = src->height;
181. dst->channel_layout = src->channel_layout;
182. dst->nb_samples = src->nb_samples;
^
183.
184. ret = av_frame_copy_props(dst, src);
libavutil/frame.c:190:15: Call
188. /* duplicate the frame data if it's not refcounted */
189. if (!src->buf[0]) {
190. ret = av_frame_get_buffer(dst, 32);
^
191. if (ret < 0)
192. return ret;
libavutil/frame.c:161:1: Parameter `frame->nb_samples`
159. }
160.
161. int av_frame_get_buffer(AVFrame *frame, int align)
^
162. {
163. if (frame->format < 0)
libavutil/frame.c:169:16: Call
167. return get_video_buffer(frame, align);
168. else if (frame->nb_samples > 0 && frame->channel_layout)
169. return get_audio_buffer(frame, align);
^
170.
171. return AVERROR(EINVAL);
libavutil/frame.c:112:1: Parameter `frame->nb_samples`
110. }
111.
112. static int get_audio_buffer(AVFrame *frame, int align)
^
113. {
114. int channels = av_get_channel_layout_nb_channels(frame->channel_layout);
libavutil/frame.c:120:15: Call
118.
119. if (!frame->linesize[0]) {
120. ret = av_samples_get_buffer_size(&frame->linesize[0], channels,
^
121. frame->nb_samples, frame->format,
122. align);
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_frame_ref`
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_42388 | static unsigned int
fixup_vorbis_headers(AVFormatContext * as, struct oggvorbis_private *priv,
uint8_t **buf)
{
int i,offset, len;
unsigned char *ptr;
len = priv->len[0] + priv->len[1] + priv->len[2];
ptr = *buf = av_mallocz(len + len/255 + 64);
ptr[0] = 2;
offset = 1;
offset += av_xiphlacing(&ptr[offset], priv->len[0]);
offset += av_xiphlacing(&ptr[offset], priv->len[1]);
for (i = 0; i < 3; i++) {
memcpy(&ptr[offset], priv->packet[i], priv->len[i]);
offset += priv->len[i];
av_freep(&priv->packet[i]);
}
*buf = av_realloc(*buf, offset + FF_INPUT_BUFFER_PADDING_SIZE);
return offset;
}
libavformat/oggparsevorbis.c:182: error: Null Dereference
pointer `ptr` last assigned on line 180 could be null and is dereferenced at line 182, column 5.
libavformat/oggparsevorbis.c:172:1: start of procedure fixup_vorbis_headers()
170.
171.
172. static unsigned int
^
173. fixup_vorbis_headers(AVFormatContext * as, struct oggvorbis_private *priv,
174. uint8_t **buf)
libavformat/oggparsevorbis.c:179:5:
177. unsigned char *ptr;
178.
179. len = priv->len[0] + priv->len[1] + priv->len[2];
^
180. ptr = *buf = av_mallocz(len + len/255 + 64);
181.
libavformat/oggparsevorbis.c:180:5:
178.
179. len = priv->len[0] + priv->len[1] + priv->len[2];
180. ptr = *buf = av_mallocz(len + len/255 + 64);
^
181.
182. ptr[0] = 2;
libavutil/mem.c:154:1: start of procedure av_mallocz()
152. }
153.
154. void *av_mallocz(size_t size)
^
155. {
156. void *ptr = av_malloc(size);
libavutil/mem.c:156:5:
154. void *av_mallocz(size_t size)
155. {
156. void *ptr = av_malloc(size);
^
157. if (ptr)
158. memset(ptr, 0, size);
libavutil/mem.c:64:1: start of procedure av_malloc()
62. linker will do it automatically. */
63.
64. void *av_malloc(size_t size)
^
65. {
66. void *ptr = NULL;
libavutil/mem.c:66:5:
64. void *av_malloc(size_t size)
65. {
66. void *ptr = NULL;
^
67. #if CONFIG_MEMALIGN_HACK
68. long diff;
libavutil/mem.c:72:8: Taking true branch
70.
71. /* let's disallow possible ambiguous cases */
72. if(size > (INT_MAX-32) )
^
73. return NULL;
74.
libavutil/mem.c:73:9:
71. /* let's disallow possible ambiguous cases */
72. if(size > (INT_MAX-32) )
73. return NULL;
^
74.
75. #if CONFIG_MEMALIGN_HACK
libavutil/mem.c:115:1: return from a call to av_malloc
113. #endif
114. return ptr;
115. }
^
116.
117. void *av_realloc(void *ptr, size_t size)
libavutil/mem.c:157:9: Taking false branch
155. {
156. void *ptr = av_malloc(size);
157. if (ptr)
^
158. memset(ptr, 0, size);
159. return ptr;
libavutil/mem.c:159:5:
157. if (ptr)
158. memset(ptr, 0, size);
159. return ptr;
^
160. }
161.
libavutil/mem.c:160:1: return from a call to av_mallocz
158. memset(ptr, 0, size);
159. return ptr;
160. }
^
161.
162. char *av_strdup(const char *s)
libavformat/oggparsevorbis.c:182:5:
180. ptr = *buf = av_mallocz(len + len/255 + 64);
181.
182. ptr[0] = 2;
^
183. offset = 1;
184. offset += av_xiphlacing(&ptr[offset], priv->len[0]);
| https://github.com/libav/libav/blob/e056f8d37dfc1252a288b0272256a7562a870003/libavformat/oggparsevorbis.c/#L182 |
d2a_code_trace_data_42389 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/bn/bn_x931p.c:86: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mul`.
Showing all 26 steps of the trace
crypto/bn/bn_x931p.c:51:1: Parameter `ctx->stack.depth`
49. */
50.
51. > int BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2,
52. const BIGNUM *Xp, const BIGNUM *Xp1,
53. const BIGNUM *Xp2, const BIGNUM *e, BN_CTX *ctx,
crypto/bn/bn_x931p.c:64:5: Call
62. return 0;
63.
64. BN_CTX_start(ctx);
^
65. if (p1 == NULL)
66. p1 = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_x931p.c:71:9: Call
69. p2 = BN_CTX_get(ctx);
70.
71. t = BN_CTX_get(ctx);
^
72.
73. p1p2 = 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_x931p.c:73:12: Call
71. t = BN_CTX_get(ctx);
72.
73. p1p2 = BN_CTX_get(ctx);
^
74.
75. pm1 = 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_x931p.c:75:11: Call
73. p1p2 = BN_CTX_get(ctx);
74.
75. pm1 = BN_CTX_get(ctx);
^
76.
77. if (pm1 == 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_x931p.c:80:10: Call
78. goto err;
79.
80. if (!bn_x931_derive_pi(p1, Xp1, ctx, cb))
^
81. goto err;
82.
crypto/bn/bn_x931p.c:21:1: Parameter `ctx->stack.depth`
19. */
20.
21. > static int bn_x931_derive_pi(BIGNUM *pi, const BIGNUM *Xpi, BN_CTX *ctx,
22. BN_GENCB *cb)
23. {
crypto/bn/bn_x931p.c:83:10: Call
81. goto err;
82.
83. if (!bn_x931_derive_pi(p2, Xp2, ctx, cb))
^
84. goto err;
85.
crypto/bn/bn_x931p.c:21:1: Parameter `ctx->stack.depth`
19. */
20.
21. > static int bn_x931_derive_pi(BIGNUM *pi, const BIGNUM *Xpi, BN_CTX *ctx,
22. BN_GENCB *cb)
23. {
crypto/bn/bn_x931p.c:86:10: Call
84. goto err;
85.
86. if (!BN_mul(p1p2, p1, p2, ctx))
^
87. goto err;
88.
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_42390 | void avformat_close_input(AVFormatContext **ps)
{
AVFormatContext *s = *ps;
AVIOContext *pb = s->pb;
if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
(s->flags & AVFMT_FLAG_CUSTOM_IO))
pb = NULL;
flush_packet_queue(s);
if (s->iformat)
if (s->iformat->read_close)
s->iformat->read_close(s);
avformat_free_context(s);
*ps = NULL;
avio_close(pb);
}
libavformat/utils.c:2518: error: Null Dereference
pointer `pb` last assigned on line 2506 could be null and is dereferenced by call to `avio_close()` at line 2518, column 5.
libavformat/utils.c:2499:1: start of procedure avformat_close_input()
2497. }
2498.
2499. void avformat_close_input(AVFormatContext **ps)
^
2500. {
2501. AVFormatContext *s = *ps;
libavformat/utils.c:2501:5:
2499. void avformat_close_input(AVFormatContext **ps)
2500. {
2501. AVFormatContext *s = *ps;
^
2502. AVIOContext *pb = s->pb;
2503.
libavformat/utils.c:2502:5:
2500. {
2501. AVFormatContext *s = *ps;
2502. AVIOContext *pb = s->pb;
^
2503.
2504. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
libavformat/utils.c:2504:10: Taking true branch
2502. AVIOContext *pb = s->pb;
2503.
2504. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
^
2505. (s->flags & AVFMT_FLAG_CUSTOM_IO))
2506. pb = NULL;
libavformat/utils.c:2504:24: Taking false branch
2502. AVIOContext *pb = s->pb;
2503.
2504. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
^
2505. (s->flags & AVFMT_FLAG_CUSTOM_IO))
2506. pb = NULL;
libavformat/utils.c:2505:10: Taking true branch
2503.
2504. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
2505. (s->flags & AVFMT_FLAG_CUSTOM_IO))
^
2506. pb = NULL;
2507.
libavformat/utils.c:2506:9:
2504. if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) ||
2505. (s->flags & AVFMT_FLAG_CUSTOM_IO))
2506. pb = NULL;
^
2507.
2508. flush_packet_queue(s);
libavformat/utils.c:2508:5:
2506. pb = NULL;
2507.
2508. flush_packet_queue(s);
^
2509.
2510. if (s->iformat)
libavformat/utils.c:1038:1: start of procedure flush_packet_queue()
1036.
1037. /* XXX: suppress the packet queue */
1038. static void flush_packet_queue(AVFormatContext *s)
^
1039. {
1040. free_packet_buffer(&s->internal->parse_queue, &s->internal->parse_queue_end);
libavformat/utils.c:1040:5: Skipping free_packet_buffer(): empty list of specs
1038. static void flush_packet_queue(AVFormatContext *s)
1039. {
1040. free_packet_buffer(&s->internal->parse_queue, &s->internal->parse_queue_end);
^
1041. free_packet_buffer(&s->internal->packet_buffer, &s->internal->packet_buffer_end);
1042. free_packet_buffer(&s->internal->raw_packet_buffer, &s->internal->raw_packet_buffer_end);
libavformat/utils.c:1041:5: Skipping free_packet_buffer(): empty list of specs
1039. {
1040. free_packet_buffer(&s->internal->parse_queue, &s->internal->parse_queue_end);
1041. free_packet_buffer(&s->internal->packet_buffer, &s->internal->packet_buffer_end);
^
1042. free_packet_buffer(&s->internal->raw_packet_buffer, &s->internal->raw_packet_buffer_end);
1043.
libavformat/utils.c:1042:5: Skipping free_packet_buffer(): empty list of specs
1040. free_packet_buffer(&s->internal->parse_queue, &s->internal->parse_queue_end);
1041. free_packet_buffer(&s->internal->packet_buffer, &s->internal->packet_buffer_end);
1042. free_packet_buffer(&s->internal->raw_packet_buffer, &s->internal->raw_packet_buffer_end);
^
1043.
1044. s->internal->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
libavformat/utils.c:1044:5:
1042. free_packet_buffer(&s->internal->raw_packet_buffer, &s->internal->raw_packet_buffer_end);
1043.
1044. s->internal->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
^
1045. }
1046.
libavformat/utils.c:1045:1: return from a call to flush_packet_queue
1043.
1044. s->internal->raw_packet_buffer_remaining_size = RAW_PACKET_BUFFER_SIZE;
1045. }
^
1046.
1047. /*******************************************************/
libavformat/utils.c:2510:9: Taking true branch
2508. flush_packet_queue(s);
2509.
2510. if (s->iformat)
^
2511. if (s->iformat->read_close)
2512. s->iformat->read_close(s);
libavformat/utils.c:2511:13: Taking true branch
2509.
2510. if (s->iformat)
2511. if (s->iformat->read_close)
^
2512. s->iformat->read_close(s);
2513.
libavformat/utils.c:2512:13: Skipping __function_pointer__(): unresolved function pointer
2510. if (s->iformat)
2511. if (s->iformat->read_close)
2512. s->iformat->read_close(s);
^
2513.
2514. avformat_free_context(s);
libavformat/utils.c:2514:5: Skipping avformat_free_context(): empty list of specs
2512. s->iformat->read_close(s);
2513.
2514. avformat_free_context(s);
^
2515.
2516. *ps = NULL;
libavformat/utils.c:2516:5:
2514. avformat_free_context(s);
2515.
2516. *ps = NULL;
^
2517.
2518. avio_close(pb);
libavformat/utils.c:2518:5:
2516. *ps = NULL;
2517.
2518. avio_close(pb);
^
2519. }
2520.
libavformat/aviobuf.c:816:1: start of procedure avio_close()
814. }
815.
816. int avio_close(AVIOContext *s)
^
817. {
818. URLContext *h;
libavformat/aviobuf.c:820:10: Taking false branch
818. URLContext *h;
819.
820. if (!s)
^
821. return 0;
822.
libavformat/aviobuf.c:823:5:
821. return 0;
822.
823. avio_flush(s);
^
824. h = s->opaque;
825. av_freep(&s->buffer);
libavformat/aviobuf.c:180:1: start of procedure avio_flush()
178. }
179.
180. void avio_flush(AVIOContext *s)
^
181. {
182. flush_buffer(s);
libavformat/aviobuf.c:182:5:
180. void avio_flush(AVIOContext *s)
181. {
182. flush_buffer(s);
^
183. s->must_flush = 0;
184. }
libavformat/aviobuf.c:124:1: start of procedure flush_buffer()
122. }
123.
124. static void flush_buffer(AVIOContext *s)
^
125. {
126. if (s->buf_ptr > s->buffer) {
libavformat/aviobuf.c:126:9:
124. static void flush_buffer(AVIOContext *s)
125. {
126. if (s->buf_ptr > s->buffer) {
^
127. if (s->write_packet && !s->error) {
128. int ret = s->write_packet(s->opaque, s->buffer,
| https://github.com/libav/libav/blob/1720791e36f9cc24c05efea5bb275ab52156ce50/libavformat/utils.c/#L2518 |
d2a_code_trace_data_42391 | static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, const int16_t bS[7], int bsi, int qp ) {
const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);
int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;
int alpha = alpha_table[index_a];
int beta = beta_table[qp - qp_bd_offset + h->slice_beta_offset];
if (alpha ==0 || beta == 0) return;
if( bS[0] < 4 ) {
int8_t tc[4];
tc[0] = tc0_table[index_a][bS[0*bsi]];
tc[1] = tc0_table[index_a][bS[1*bsi]];
tc[2] = tc0_table[index_a][bS[2*bsi]];
tc[3] = tc0_table[index_a][bS[3*bsi]];
h->h264dsp.h264_h_loop_filter_luma_mbaff(pix, stride, alpha, beta, tc);
} else {
h->h264dsp.h264_h_loop_filter_luma_mbaff_intra(pix, stride, alpha, beta);
}
}
libavcodec/h264_loopfilter.c:729: error: Buffer Overrun L2
Offset: [1, 4] Size: 4 by call to `filter_mb_mbaff_edgev`.
libavcodec/h264_loopfilter.c:684:21: Assignment
682.
683. if( IS_INTRA( mbn_type ) )
684. bS[i] = 4;
^
685. else{
686. bS[i] = 1 + !!(h->non_zero_count_cache[12+8*(i>>1)] |
libavcodec/h264_loopfilter.c:729:13: Call
727. }
728. }else{
729. filter_mb_mbaff_edgev ( h, img_y , 2* linesize, bS , 2, qp [0] );
^
730. filter_mb_mbaff_edgev ( h, img_y + linesize, 2* linesize, bS+1, 2, qp [1] );
731. if (chroma){
libavcodec/h264_loopfilter.c:140:1: <Offset trace>
138. }
139.
140. static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, const int16_t bS[7], int bsi, int qp ) {
^
141. const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);
142. int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;
libavcodec/h264_loopfilter.c:140:1: Parameter `*bS`
138. }
139.
140. static void filter_mb_mbaff_edgev( H264Context *h, uint8_t *pix, int stride, const int16_t bS[7], int bsi, int qp ) {
^
141. const int qp_bd_offset = 6 * (h->sps.bit_depth_luma - 8);
142. int index_a = qp - qp_bd_offset + h->slice_alpha_c0_offset;
libavcodec/h264_loopfilter.c:73:1: <Length trace>
71. 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
72. };
73. static const uint8_t tc0_table[52*3][4] = {
^
74. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
75. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
libavcodec/h264_loopfilter.c:73:1: Array declaration
71. 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
72. };
73. static const uint8_t tc0_table[52*3][4] = {
^
74. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
75. {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 }, {-1, 0, 0, 0 },
libavcodec/h264_loopfilter.c:149:17: Array access: Offset: [1, 4] Size: 4 by call to `filter_mb_mbaff_edgev`
147. if( bS[0] < 4 ) {
148. int8_t tc[4];
149. tc[0] = tc0_table[index_a][bS[0*bsi]];
^
150. tc[1] = tc0_table[index_a][bS[1*bsi]];
151. tc[2] = tc0_table[index_a][bS[2*bsi]];
| https://github.com/libav/libav/blob/ecf026f1aa8ffe170b5b8c577cae56a405ebafc8/libavcodec/h264_loopfilter.c/#L149 |
d2a_code_trace_data_42392 | int RAND_pseudo_bytes(unsigned char *buf, int num)
{
const RAND_METHOD *meth = RAND_get_rand_method();
if (meth->pseudorand != NULL)
return meth->pseudorand(buf, num);
return -1;
}
crypto/rand/rand_lib.c:784: error: NULL_DEREFERENCE
pointer `meth` last assigned on line 782 could be null and is dereferenced at line 784, column 9.
Showing all 14 steps of the trace
crypto/rand/rand_lib.c:780:1: start of procedure RAND_pseudo_bytes()
778.
779. #if !OPENSSL_API_1_1_0 && !defined(FIPS_MODE)
780. > int RAND_pseudo_bytes(unsigned char *buf, int num)
781. {
782. const RAND_METHOD *meth = RAND_get_rand_method();
crypto/rand/rand_lib.c:782:5:
780. int RAND_pseudo_bytes(unsigned char *buf, int num)
781. {
782. > const RAND_METHOD *meth = RAND_get_rand_method();
783.
784. if (meth->pseudorand != NULL)
crypto/rand/rand_lib.c:671:1: start of procedure RAND_get_rand_method()
669. #endif
670.
671. > const RAND_METHOD *RAND_get_rand_method(void)
672. {
673. #ifdef FIPS_MODE
crypto/rand/rand_lib.c:676:5:
674. return NULL;
675. #else
676. > const RAND_METHOD *tmp_meth = NULL;
677.
678. if (!RUN_ONCE(&rand_init, do_rand_init))
crypto/rand/rand_lib.c:678:10:
676. const RAND_METHOD *tmp_meth = NULL;
677.
678. > if (!RUN_ONCE(&rand_init, do_rand_init))
679. return NULL;
680.
crypto/threads_pthread.c:111:1: start of procedure CRYPTO_THREAD_run_once()
109. }
110.
111. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
112. {
113. if (pthread_once(once, init) != 0)
crypto/threads_pthread.c:113:9: Taking true branch
111. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void))
112. {
113. if (pthread_once(once, init) != 0)
^
114. return 0;
115.
crypto/threads_pthread.c:114:9:
112. {
113. if (pthread_once(once, init) != 0)
114. > return 0;
115.
116. return 1;
crypto/threads_pthread.c:117:1: return from a call to CRYPTO_THREAD_run_once
115.
116. return 1;
117. > }
118.
119. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *))
crypto/rand/rand_lib.c:678:10: Condition is false
676. const RAND_METHOD *tmp_meth = NULL;
677.
678. if (!RUN_ONCE(&rand_init, do_rand_init))
^
679. return NULL;
680.
crypto/rand/rand_lib.c:678:10: Taking true branch
676. const RAND_METHOD *tmp_meth = NULL;
677.
678. if (!RUN_ONCE(&rand_init, do_rand_init))
^
679. return NULL;
680.
crypto/rand/rand_lib.c:679:9:
677.
678. if (!RUN_ONCE(&rand_init, do_rand_init))
679. > return NULL;
680.
681. CRYPTO_THREAD_write_lock(rand_meth_lock);
crypto/rand/rand_lib.c:703:1: return from a call to RAND_get_rand_method
701. return tmp_meth;
702. #endif
703. > }
704.
705. #if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE)
crypto/rand/rand_lib.c:784:9:
782. const RAND_METHOD *meth = RAND_get_rand_method();
783.
784. > if (meth->pseudorand != NULL)
785. return meth->pseudorand(buf, num);
786. return -1;
| https://github.com/openssl/openssl/blob/37ca204b96b036f949b8bc8389c1f8e806e1cbec/crypto/rand/rand_lib.c/#L784 |
d2a_code_trace_data_42393 | int SHA512_Final(unsigned char *md, SHA512_CTX *c)
{
unsigned char *p = (unsigned char *)c->u.p;
size_t n = c->num;
p[n] = 0x80;
n++;
if (n > (sizeof(c->u) - 16)) {
memset(p + n, 0, sizeof(c->u) - n);
n = 0;
sha512_block_data_order(c, p, 1);
}
memset(p + n, 0, sizeof(c->u) - 16 - n);
#ifdef B_ENDIAN
c->u.d[SHA_LBLOCK - 2] = c->Nh;
c->u.d[SHA_LBLOCK - 1] = c->Nl;
#else
p[sizeof(c->u) - 1] = (unsigned char)(c->Nl);
p[sizeof(c->u) - 2] = (unsigned char)(c->Nl >> 8);
p[sizeof(c->u) - 3] = (unsigned char)(c->Nl >> 16);
p[sizeof(c->u) - 4] = (unsigned char)(c->Nl >> 24);
p[sizeof(c->u) - 5] = (unsigned char)(c->Nl >> 32);
p[sizeof(c->u) - 6] = (unsigned char)(c->Nl >> 40);
p[sizeof(c->u) - 7] = (unsigned char)(c->Nl >> 48);
p[sizeof(c->u) - 8] = (unsigned char)(c->Nl >> 56);
p[sizeof(c->u) - 9] = (unsigned char)(c->Nh);
p[sizeof(c->u) - 10] = (unsigned char)(c->Nh >> 8);
p[sizeof(c->u) - 11] = (unsigned char)(c->Nh >> 16);
p[sizeof(c->u) - 12] = (unsigned char)(c->Nh >> 24);
p[sizeof(c->u) - 13] = (unsigned char)(c->Nh >> 32);
p[sizeof(c->u) - 14] = (unsigned char)(c->Nh >> 40);
p[sizeof(c->u) - 15] = (unsigned char)(c->Nh >> 48);
p[sizeof(c->u) - 16] = (unsigned char)(c->Nh >> 56);
#endif
sha512_block_data_order(c, p, 1);
if (md == 0)
return 0;
switch (c->md_len) {
case SHA384_DIGEST_LENGTH:
for (n = 0; n < SHA384_DIGEST_LENGTH / 8; n++) {
SHA_LONG64 t = c->h[n];
*(md++) = (unsigned char)(t >> 56);
*(md++) = (unsigned char)(t >> 48);
*(md++) = (unsigned char)(t >> 40);
*(md++) = (unsigned char)(t >> 32);
*(md++) = (unsigned char)(t >> 24);
*(md++) = (unsigned char)(t >> 16);
*(md++) = (unsigned char)(t >> 8);
*(md++) = (unsigned char)(t);
}
break;
case SHA512_DIGEST_LENGTH:
for (n = 0; n < SHA512_DIGEST_LENGTH / 8; n++) {
SHA_LONG64 t = c->h[n];
*(md++) = (unsigned char)(t >> 56);
*(md++) = (unsigned char)(t >> 48);
*(md++) = (unsigned char)(t >> 40);
*(md++) = (unsigned char)(t >> 32);
*(md++) = (unsigned char)(t >> 24);
*(md++) = (unsigned char)(t >> 16);
*(md++) = (unsigned char)(t >> 8);
*(md++) = (unsigned char)(t);
}
break;
default:
return 0;
}
return 1;
}
crypto/ec/curve25519.c:4662: error: INTEGER_OVERFLOW_L2
(128 - [113, 380]):unsigned64 by call to `SHA512_Final`.
Showing all 14 steps of the trace
crypto/ec/curve25519.c:4658:3: Call
4656. memcpy(scopy, signature + 32, 32);
4657.
4658. SHA512_Init(&hash_ctx);
^
4659. SHA512_Update(&hash_ctx, signature, 32);
4660. SHA512_Update(&hash_ctx, public_key, 32);
crypto/sha/sha512.c:94:5: Assignment
92. c->Nl = 0;
93. c->Nh = 0;
94. c->num = 0;
^
95. c->md_len = SHA512_DIGEST_LENGTH;
96. return 1;
crypto/ec/curve25519.c:4659:3: Call
4657.
4658. SHA512_Init(&hash_ctx);
4659. SHA512_Update(&hash_ctx, signature, 32);
^
4660. SHA512_Update(&hash_ctx, public_key, 32);
4661. SHA512_Update(&hash_ctx, message, message_len);
crypto/sha/sha512.c:188:1: Parameter `c->num`
186. }
187.
188. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len)
189. {
190. SHA_LONG64 l;
crypto/ec/curve25519.c:4660:3: Call
4658. SHA512_Init(&hash_ctx);
4659. SHA512_Update(&hash_ctx, signature, 32);
4660. SHA512_Update(&hash_ctx, public_key, 32);
^
4661. SHA512_Update(&hash_ctx, message, message_len);
4662. SHA512_Final(h, &hash_ctx);
crypto/sha/sha512.c:188:1: Parameter `c->num`
186. }
187.
188. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len)
189. {
190. SHA_LONG64 l;
crypto/ec/curve25519.c:4661:3: Call
4659. SHA512_Update(&hash_ctx, signature, 32);
4660. SHA512_Update(&hash_ctx, public_key, 32);
4661. SHA512_Update(&hash_ctx, message, message_len);
^
4662. SHA512_Final(h, &hash_ctx);
4663.
crypto/sha/sha512.c:188:1: Parameter `c->num`
186. }
187.
188. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len)
189. {
190. SHA_LONG64 l;
crypto/ec/curve25519.c:4662:3: Call
4660. SHA512_Update(&hash_ctx, public_key, 32);
4661. SHA512_Update(&hash_ctx, message, message_len);
4662. SHA512_Final(h, &hash_ctx);
^
4663.
4664. x25519_sc_reduce(h);
crypto/sha/sha512.c:104:1: <RHS trace>
102. void sha512_block_data_order(SHA512_CTX *ctx, const void *in, size_t num);
103.
104. > int SHA512_Final(unsigned char *md, SHA512_CTX *c)
105. {
106. unsigned char *p = (unsigned char *)c->u.p;
crypto/sha/sha512.c:104:1: Parameter `c->num`
102. void sha512_block_data_order(SHA512_CTX *ctx, const void *in, size_t num);
103.
104. > int SHA512_Final(unsigned char *md, SHA512_CTX *c)
105. {
106. unsigned char *p = (unsigned char *)c->u.p;
crypto/sha/sha512.c:107:5: Assignment
105. {
106. unsigned char *p = (unsigned char *)c->u.p;
107. size_t n = c->num;
^
108.
109. p[n] = 0x80; /* There always is a room for one */
crypto/sha/sha512.c:110:5: Assignment
108.
109. p[n] = 0x80; /* There always is a room for one */
110. n++;
^
111. if (n > (sizeof(c->u) - 16)) {
112. memset(p + n, 0, sizeof(c->u) - n);
crypto/sha/sha512.c:112:9: Binary operation: (128 - [113, 380]):unsigned64 by call to `SHA512_Final`
110. n++;
111. if (n > (sizeof(c->u) - 16)) {
112. memset(p + n, 0, sizeof(c->u) - n);
^
113. n = 0;
114. sha512_block_data_order(c, p, 1);
| https://github.com/openssl/openssl/blob/04dec1ab34df70c1588d42cc394e8fa8b5f3191c/crypto/sha/sha512.c/#L112 |
d2a_code_trace_data_42394 | 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/statem_srvr.c:3664: error: INTEGER_OVERFLOW_L2
([0, +oo] - [`pkt->written`, `pkt->written` + 4]):unsigned64 by call to `tls_construct_extensions`.
Showing all 14 steps of the trace
ssl/statem/statem_srvr.c:3662:10: Call
3660. * (should be s->version)
3661. */
3662. if (!WPACKET_put_bytes_u16(pkt, TLS1_3_VERSION_DRAFT)
^
3663. || !s->method->put_cipher_by_char(s->s3->tmp.new_cipher, pkt, &len)
3664. || !tls_construct_extensions(s, pkt,
ssl/packet.c:312:1: Parameter `pkt->buf->length`
310. }
311.
312. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size)
313. {
314. unsigned char *data;
ssl/statem/statem_srvr.c:3664:17: Call
3662. if (!WPACKET_put_bytes_u16(pkt, TLS1_3_VERSION_DRAFT)
3663. || !s->method->put_cipher_by_char(s->s3->tmp.new_cipher, pkt, &len)
3664. || !tls_construct_extensions(s, pkt,
^
3665. SSL_EXT_TLS1_3_HELLO_RETRY_REQUEST,
3666. NULL, 0, &al)) {
ssl/statem/extensions.c:649:1: Parameter `pkt->written`
647. * failure construction stops at the first extension to fail to construct.
648. */
649. > int tls_construct_extensions(SSL *s, WPACKET *pkt, unsigned int context,
650. X509 *x, size_t chainidx, int *al)
651. {
ssl/statem/extensions.c:662:10: Call
660. tmpal = SSL_AD_INTERNAL_ERROR;
661.
662. if (!WPACKET_start_sub_packet_u16(pkt)
^
663. /*
664. * If extensions are of zero length then we don't even add the
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 + 4]):unsigned64 by call to `tls_construct_extensions`
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/e128f891de71bbdba8391355af8d6d47d20b1969/ssl/packet.c/#L49 |
d2a_code_trace_data_42395 | 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:1059: error: INTEGER_OVERFLOW_L2
([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + 12]):unsigned64 by call to `WPACKET_start_sub_packet_len`.
Showing all 10 steps of the trace
ssl/t1_lib.c:1057:21: Call
1055. if (!WPACKET_put_bytes(pkt, TLSEXT_TYPE_server_name, 2)
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:190:1: Parameter `pkt->buf->length`
188. }
189.
190. > int WPACKET_start_sub_packet_len(WPACKET *pkt, size_t lenbytes)
191. {
192. WPACKET_SUB *sub;
ssl/t1_lib.c:1059:21: Call
1057. || !WPACKET_start_sub_packet_u16(pkt)
1058. /* Sub-packet for servername list (always 1 hostname)*/
1059. || !WPACKET_start_sub_packet_u16(pkt)
^
1060. || !WPACKET_put_bytes(pkt, TLSEXT_NAMETYPE_host_name, 1)
1061. || !WPACKET_sub_memcpy(pkt, s->tlsext_hostname,
ssl/packet.c:190:1: Parameter `pkt->written`
188. }
189.
190. > int WPACKET_start_sub_packet_len(WPACKET *pkt, size_t lenbytes)
191. {
192. WPACKET_SUB *sub;
ssl/packet.c:214:10: Call
212. }
213.
214. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars))
^
215. return 0;
216. sub->packet_len = lenchars - (unsigned char *)pkt->buf->data;
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 + 12]):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/c0f9e23c6b8d1076796987d5a84557d410682d85/ssl/packet.c/#L25 |
d2a_code_trace_data_42396 | static int dv_extract_audio(uint8_t* frame, uint8_t* pcm, uint8_t* pcm2,
const DVprofile *sys)
{
int size, chan, i, j, d, of, smpls, freq, quant, half_ch;
uint16_t lc, rc;
const uint8_t* as_pack;
as_pack = dv_extract_pack(frame, dv_audio_source);
if (!as_pack)
return 0;
smpls = as_pack[1] & 0x3f;
freq = (as_pack[4] >> 3) & 0x07;
quant = as_pack[4] & 0x07;
if (quant > 1)
return -1;
size = (sys->audio_min_samples[freq] + smpls) * 4;
half_ch = sys->difseg_size/2;
for (chan = 0; chan < sys->n_difchan; chan++) {
for (i = 0; i < sys->difseg_size; i++) {
frame += 6 * 80;
if (quant == 1 && i == half_ch) {
if (!pcm2)
break;
else
pcm = pcm2;
}
for (j = 0; j < 9; j++) {
for (d = 8; d < 80; d += 2) {
if (quant == 0) {
of = sys->audio_shuffle[i][j] + (d - 8)/2 * sys->audio_stride;
if (of*2 >= size)
continue;
pcm[of*2] = frame[d+1];
pcm[of*2+1] = frame[d];
if (pcm[of*2+1] == 0x80 && pcm[of*2] == 0x00)
pcm[of*2+1] = 0;
} else {
lc = ((uint16_t)frame[d] << 4) |
((uint16_t)frame[d+2] >> 4);
rc = ((uint16_t)frame[d+1] << 4) |
((uint16_t)frame[d+2] & 0x0f);
lc = (lc == 0x800 ? 0 : dv_audio_12to16(lc));
rc = (rc == 0x800 ? 0 : dv_audio_12to16(rc));
of = sys->audio_shuffle[i%half_ch][j] + (d - 8)/3 * sys->audio_stride;
if (of*2 >= size)
continue;
pcm[of*2] = lc & 0xff;
pcm[of*2+1] = lc >> 8;
of = sys->audio_shuffle[i%half_ch+half_ch][j] +
(d - 8)/3 * sys->audio_stride;
pcm[of*2] = rc & 0xff;
pcm[of*2+1] = rc >> 8;
++d;
}
}
frame += 16 * 80;
}
}
if(!pcm2)
break;
pcm = pcm2;
}
return size;
}
libavformat/mov.c:1769: error: Buffer Overrun L2
Offset: [0, 7] Size: 3 by call to `dv_produce_packet`.
libavformat/mov.c:1766:5: Call
1764. return -1;
1765. }
1766. av_get_packet(sc->pb, pkt, sample->size);
^
1767. #ifdef CONFIG_DV_DEMUXER
1768. if (mov->dv_demux && sc->dv_audio_container) {
libavformat/utils.c:222:1: Parameter `*pkt->data`
220. }
221.
222. int av_get_packet(ByteIOContext *s, AVPacket *pkt, int size)
^
223. {
224. int ret= av_new_packet(pkt, size);
libavformat/mov.c:1769:9: Call
1767. #ifdef CONFIG_DV_DEMUXER
1768. if (mov->dv_demux && sc->dv_audio_container) {
1769. dv_produce_packet(mov->dv_demux, pkt, pkt->data, pkt->size);
^
1770. av_free(pkt->data);
1771. pkt->size = 0;
libavformat/dv.c:309:1: Parameter `*buf`
307. }
308.
309. int dv_produce_packet(DVDemuxContext *c, AVPacket *pkt,
^
310. uint8_t* buf, int buf_size)
311. {
libavformat/dv.c:315:20: Call
313.
314. if (buf_size < DV_PROFILE_BYTES ||
315. !(c->sys = dv_frame_profile(buf)) ||
^
316. buf_size < c->sys->frame_size) {
317. return -1; /* Broken frame, or not enough data */
libavcodec/dvdata.h:2664:1: Parameter `*frame`
2662. #define DV_MAX_FRAME_SIZE 288000
2663.
2664. static inline const DVprofile* dv_frame_profile(const uint8_t* frame)
^
2665. {
2666. if ((frame[3] & 0x80) == 0) { /* DSF flag */
libavformat/dv.c:322:12: Call
320. /* Queueing audio packet */
321. /* FIXME: in case of no audio/bad audio we have to do something */
322. size = dv_extract_audio_info(c, buf);
^
323. for (i=0; i<c->ach; i++) {
324. c->audio_pkt[i].size = size;
libavformat/dv.c:182:1: Parameter `*frame`
180. }
181.
182. static int dv_extract_audio_info(DVDemuxContext* c, uint8_t* frame)
^
183. {
184. const uint8_t* as_pack;
libavformat/dv.c:187:15: Call
185. int freq, stype, smpls, quant, i, ach;
186.
187. as_pack = dv_extract_pack(frame, dv_audio_source);
^
188. if (!as_pack || !c->sys) { /* No audio ? */
189. c->ach = 0;
libavformat/dv.c:72:1: Parameter `t`
70. * to have a fallback mechanism for complete search of missing packs.
71. */
72. static const uint8_t* dv_extract_pack(uint8_t* frame, enum dv_pack_type t)
^
73. {
74. int offs;
libavformat/dv.c:327:5: Call
325. c->audio_pkt[i].pts = c->abytes * 30000*8 / c->ast[i]->codec->bit_rate;
326. }
327. dv_extract_audio(buf, c->audio_buf[0], c->audio_buf[1], c->sys);
^
328. c->abytes += size;
329.
libavformat/dv.c:101:1: <Offset trace>
99. * are converted into 16bit linear ones.
100. */
101. static int dv_extract_audio(uint8_t* frame, uint8_t* pcm, uint8_t* pcm2,
^
102. const DVprofile *sys)
103. {
libavformat/dv.c:101:1: Parameter `*frame`
99. * are converted into 16bit linear ones.
100. */
101. static int dv_extract_audio(uint8_t* frame, uint8_t* pcm, uint8_t* pcm2,
^
102. const DVprofile *sys)
103. {
libavformat/dv.c:108:15: Call
106. const uint8_t* as_pack;
107.
108. as_pack = dv_extract_pack(frame, dv_audio_source);
^
109. if (!as_pack) /* No audio ? */
110. return 0;
libavformat/dv.c:72:1: Parameter `t`
70. * to have a fallback mechanism for complete search of missing packs.
71. */
72. static const uint8_t* dv_extract_pack(uint8_t* frame, enum dv_pack_type t)
^
73. {
74. int offs;
libavformat/dv.c:113:5: Assignment
111.
112. smpls = as_pack[1] & 0x3f; /* samples in this frame - min. samples */
113. freq = (as_pack[4] >> 3) & 0x07; /* 0 - 48KHz, 1 - 44,1kHz, 2 - 32 kHz */
^
114. quant = as_pack[4] & 0x07; /* 0 - 16bit linear, 1 - 12bit nonlinear */
115.
libavformat/dv.c:101:1: <Length trace>
99. * are converted into 16bit linear ones.
100. */
101. static int dv_extract_audio(uint8_t* frame, uint8_t* pcm, uint8_t* pcm2,
^
102. const DVprofile *sys)
103. {
libavformat/dv.c:101:1: Parameter `sys->audio_min_samples[*]`
99. * are converted into 16bit linear ones.
100. */
101. static int dv_extract_audio(uint8_t* frame, uint8_t* pcm, uint8_t* pcm2,
^
102. const DVprofile *sys)
103. {
libavformat/dv.c:119:13: Array access: Offset: [0, 7] Size: 3 by call to `dv_produce_packet`
117. return -1; /* Unsupported quantization */
118.
119. size = (sys->audio_min_samples[freq] + smpls) * 4; /* 2ch, 2bytes */
^
120. half_ch = sys->difseg_size/2;
121.
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/dv.c/#L119 |
d2a_code_trace_data_42397 | 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/bn/bn_x931p.c:33: error: BUFFER_OVERRUN_L3
Offset: [1, +oo] Size: [0, 8388607] by call to `BN_is_prime_fasttest_ex`.
Showing all 49 steps of the trace
crypto/bn/bn_x931p.c:25:10: Call
23. {
24. int i = 0, is_prime;
25. if (!BN_copy(pi, Xpi))
^
26. return 0;
27. if (!BN_is_odd(pi) && !BN_add_word(pi, 1))
crypto/bn/bn_lib.c:285:1: Parameter `a->top`
283. }
284.
285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
286. {
287. bn_check_top(b);
crypto/bn/bn_x931p.c:27:10: Call
25. if (!BN_copy(pi, Xpi))
26. return 0;
27. if (!BN_is_odd(pi) && !BN_add_word(pi, 1))
^
28. return 0;
29. for (;;) {
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_x931p.c:33:20: Call
31. BN_GENCB_call(cb, 0, i);
32. /* NB 27 MR is specified in X9.31 */
33. is_prime = BN_is_prime_fasttest_ex(pi, 27, ctx, 1, cb);
^
34. if (is_prime < 0)
35. return 0;
crypto/bn/bn_prime.c:151:1: Parameter `a->top`
149. }
150.
151. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed,
152. int do_trial_division, BN_GENCB *cb)
153. {
crypto/bn/bn_prime.c:161:9: Call
159.
160. /* Take care of the really small primes 2 & 3 */
161. if (BN_is_word(a, 2) || BN_is_word(a, 3))
^
162. return 1;
163.
crypto/bn/bn_lib.c:855:1: Parameter `a->top`
853. }
854.
855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w)
856. {
857. return BN_abs_is_word(a, w) && (!w || !a->neg);
crypto/bn/bn_lib.c:857:12: Call
855. int BN_is_word(const BIGNUM *a, const BN_ULONG w)
856. {
857. return BN_abs_is_word(a, w) && (!w || !a->neg);
^
858. }
859.
crypto/bn/bn_lib.c:840:1: Parameter `a->top`
838. }
839.
840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
841. {
842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
crypto/bn/bn_prime.c:161:29: Call
159.
160. /* Take care of the really small primes 2 & 3 */
161. if (BN_is_word(a, 2) || BN_is_word(a, 3))
^
162. return 1;
163.
crypto/bn/bn_lib.c:855:1: Parameter `a->top`
853. }
854.
855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w)
856. {
857. return BN_abs_is_word(a, w) && (!w || !a->neg);
crypto/bn/bn_lib.c:857:12: Call
855. int BN_is_word(const BIGNUM *a, const BN_ULONG w)
856. {
857. return BN_abs_is_word(a, w) && (!w || !a->neg);
^
858. }
859.
crypto/bn/bn_lib.c:840:1: Parameter `a->top`
838. }
839.
840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w)
841. {
842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0));
crypto/bn/bn_prime.c:165:10: Call
163.
164. /* Check odd and bigger than 1 */
165. if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0)
^
166. return 0;
167.
crypto/bn/bn_lib.c:860:1: Parameter `a->top`
858. }
859.
860. > int BN_is_odd(const BIGNUM *a)
861. {
862. return (a->top > 0) && (a->d[0] & 1);
crypto/bn/bn_prime.c:165:26: Call
163.
164. /* Check odd and bigger than 1 */
165. if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0)
^
166. return 0;
167.
crypto/bn/bn_lib.c:542:1: Parameter `a->top`
540. }
541.
542. > int BN_cmp(const BIGNUM *a, const BIGNUM *b)
543. {
544. int i;
crypto/bn/bn_prime.c:198:10: Call
196.
197. /* compute A1 := a - 1 */
198. if (!BN_copy(A1, a) || !BN_sub_word(A1, 1))
^
199. goto err;
200. /* compute A3 := a - 3 */
crypto/bn/bn_lib.c:285:1: Parameter `b->top`
283. }
284.
285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
286. {
287. bn_check_top(b);
crypto/bn/bn_prime.c:201:10: Call
199. goto err;
200. /* compute A3 := a - 3 */
201. if (!BN_copy(A3, a) || !BN_sub_word(A3, 3))
^
202. goto err;
203.
crypto/bn/bn_lib.c:285:1: Parameter `b->top`
283. }
284.
285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
286. {
287. bn_check_top(b);
crypto/bn/bn_prime.c:215:10: Call
213. if (mont == NULL)
214. goto err;
215. if (!BN_MONT_CTX_set(mont, a, ctx))
^
216. goto err;
217.
crypto/bn/bn_mont.c:238:9: Call
236. BIGNUM *Ri, *R;
237.
238. if (BN_is_zero(mod))
^
239. return 0;
240.
crypto/bn/bn_lib.c:845:1: Parameter `a->top`
843. }
844.
845. > int BN_is_zero(const BIGNUM *a)
846. {
847. return a->top == 0;
crypto/bn/bn_prime.c:223:13: Call
221. goto err;
222.
223. j = witness(check, a, A1, A1_odd, k, ctx, mont);
^
224. if (j == -1)
225. goto err;
crypto/bn/bn_prime.c:245:1: Parameter `a->top`
243. }
244.
245. > static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1,
246. const BIGNUM *a1_odd, int k, BN_CTX *ctx,
247. BN_MONT_CTX *mont)
crypto/bn/bn_prime.c:249:10: Call
247. BN_MONT_CTX *mont)
248. {
249. if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */
^
250. return -1;
251. if (BN_is_one(w))
crypto/bn/bn_exp.c:296:1: Parameter `m->top`
294. }
295.
296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
297. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
298. {
crypto/bn/bn_exp.c:310:16: Call
308. || BN_get_flags(a, BN_FLG_CONSTTIME) != 0
309. || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {
310. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);
^
311. }
312.
crypto/bn/bn_exp.c: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_42398 | X509_EXTENSION *OCSP_archive_cutoff_new(char *tim)
{
X509_EXTENSION *x = NULL;
ASN1_GENERALIZEDTIME *gt = NULL;
if ((gt = ASN1_GENERALIZEDTIME_new()) == NULL)
goto err;
if (!(ASN1_GENERALIZEDTIME_set_string(gt, tim)))
goto err;
x = X509V3_EXT_i2d(NID_id_pkix_OCSP_archiveCutoff, 0, gt);
err:
ASN1_GENERALIZEDTIME_free(gt);
return x;
}
crypto/ocsp/ocsp_ext.c:477: error: MEMORY_LEAK
memory dynamically allocated by call to `ASN1_GENERALIZEDTIME_new()` at line 471, column 15 is not reachable after line 477, column 5.
Showing all 51 steps of the trace
crypto/ocsp/ocsp_ext.c:466:1: start of procedure OCSP_archive_cutoff_new()
464.
465. /* ArchiveCutoff ::= GeneralizedTime */
466. > X509_EXTENSION *OCSP_archive_cutoff_new(char *tim)
467. {
468. X509_EXTENSION *x = NULL;
crypto/ocsp/ocsp_ext.c:468:5:
466. X509_EXTENSION *OCSP_archive_cutoff_new(char *tim)
467. {
468. > X509_EXTENSION *x = NULL;
469. ASN1_GENERALIZEDTIME *gt = NULL;
470.
crypto/ocsp/ocsp_ext.c:469:5:
467. {
468. X509_EXTENSION *x = NULL;
469. > ASN1_GENERALIZEDTIME *gt = NULL;
470.
471. if ((gt = ASN1_GENERALIZEDTIME_new()) == NULL)
crypto/ocsp/ocsp_ext.c:471:9:
469. ASN1_GENERALIZEDTIME *gt = NULL;
470.
471. > if ((gt = ASN1_GENERALIZEDTIME_new()) == NULL)
472. goto err;
473. if (!(ASN1_GENERALIZEDTIME_set_string(gt, tim)))
crypto/asn1/tasn_typ.c:87:1: start of procedure ASN1_GENERALIZEDTIME_new()
85. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALSTRING)
86. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UTCTIME)
87. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALIZEDTIME)
88. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_VISIBLESTRING)
89. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UNIVERSALSTRING)
crypto/asn1/asn1_lib.c:349:1: start of procedure ASN1_STRING_type_new()
347. }
348.
349. > ASN1_STRING *ASN1_STRING_type_new(int type)
350. {
351. ASN1_STRING *ret;
crypto/asn1/asn1_lib.c:353:5:
351. ASN1_STRING *ret;
352.
353. > ret = OPENSSL_zalloc(sizeof(*ret));
354. if (ret == NULL) {
355. ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);
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/asn1/asn1_lib.c:354:9: Taking false branch
352.
353. ret = OPENSSL_zalloc(sizeof(*ret));
354. if (ret == NULL) {
^
355. ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);
356. return (NULL);
crypto/asn1/asn1_lib.c:358:5:
356. return (NULL);
357. }
358. > ret->type = type;
359. return (ret);
360. }
crypto/asn1/asn1_lib.c:359:5:
357. }
358. ret->type = type;
359. > return (ret);
360. }
361.
crypto/asn1/asn1_lib.c:360:1: return from a call to ASN1_STRING_type_new
358. ret->type = type;
359. return (ret);
360. > }
361.
362. void ASN1_STRING_free(ASN1_STRING *a)
crypto/asn1/tasn_typ.c:87:1: return from a call to ASN1_GENERALIZEDTIME_new
85. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALSTRING)
86. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UTCTIME)
87. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALIZEDTIME)
88. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_VISIBLESTRING)
89. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UNIVERSALSTRING)
crypto/ocsp/ocsp_ext.c:471:9: Taking false branch
469. ASN1_GENERALIZEDTIME *gt = NULL;
470.
471. if ((gt = ASN1_GENERALIZEDTIME_new()) == NULL)
^
472. goto err;
473. if (!(ASN1_GENERALIZEDTIME_set_string(gt, tim)))
crypto/ocsp/ocsp_ext.c:473:11:
471. if ((gt = ASN1_GENERALIZEDTIME_new()) == NULL)
472. goto err;
473. > if (!(ASN1_GENERALIZEDTIME_set_string(gt, tim)))
474. goto err;
475. x = X509V3_EXT_i2d(NID_id_pkix_OCSP_archiveCutoff, 0, gt);
crypto/asn1/a_gentm.c:191:1: start of procedure ASN1_GENERALIZEDTIME_set_string()
189. }
190.
191. > int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str)
192. {
193. ASN1_GENERALIZEDTIME t;
crypto/asn1/a_gentm.c:195:5:
193. ASN1_GENERALIZEDTIME t;
194.
195. > t.type = V_ASN1_GENERALIZEDTIME;
196. t.length = strlen(str);
197. t.data = (unsigned char *)str;
crypto/asn1/a_gentm.c:196:5:
194.
195. t.type = V_ASN1_GENERALIZEDTIME;
196. > t.length = strlen(str);
197. t.data = (unsigned char *)str;
198. if (ASN1_GENERALIZEDTIME_check(&t)) {
crypto/asn1/a_gentm.c:197:5:
195. t.type = V_ASN1_GENERALIZEDTIME;
196. t.length = strlen(str);
197. > t.data = (unsigned char *)str;
198. if (ASN1_GENERALIZEDTIME_check(&t)) {
199. if (s != NULL) {
crypto/asn1/a_gentm.c:198:9:
196. t.length = strlen(str);
197. t.data = (unsigned char *)str;
198. > if (ASN1_GENERALIZEDTIME_check(&t)) {
199. if (s != NULL) {
200. if (!ASN1_STRING_set((ASN1_STRING *)s,
crypto/asn1/a_gentm.c:186:1: start of procedure ASN1_GENERALIZEDTIME_check()
184. }
185.
186. > int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *d)
187. {
188. return asn1_generalizedtime_to_tm(NULL, d);
crypto/asn1/a_gentm.c:188:5: Skipping asn1_generalizedtime_to_tm(): empty list of specs
186. int ASN1_GENERALIZEDTIME_check(const ASN1_GENERALIZEDTIME *d)
187. {
188. return asn1_generalizedtime_to_tm(NULL, d);
^
189. }
190.
crypto/asn1/a_gentm.c:189:1: return from a call to ASN1_GENERALIZEDTIME_check
187. {
188. return asn1_generalizedtime_to_tm(NULL, d);
189. > }
190.
191. int ASN1_GENERALIZEDTIME_set_string(ASN1_GENERALIZEDTIME *s, const char *str)
crypto/asn1/a_gentm.c:198:9: Taking false branch
196. t.length = strlen(str);
197. t.data = (unsigned char *)str;
198. if (ASN1_GENERALIZEDTIME_check(&t)) {
^
199. if (s != NULL) {
200. if (!ASN1_STRING_set((ASN1_STRING *)s,
crypto/asn1/a_gentm.c:207:9:
205. return (1);
206. } else
207. > return (0);
208. }
209.
crypto/asn1/a_gentm.c:208:1: return from a call to ASN1_GENERALIZEDTIME_set_string
206. } else
207. return (0);
208. > }
209.
210. ASN1_GENERALIZEDTIME *ASN1_GENERALIZEDTIME_set(ASN1_GENERALIZEDTIME *s,
crypto/ocsp/ocsp_ext.c:473:11: Taking true branch
471. if ((gt = ASN1_GENERALIZEDTIME_new()) == NULL)
472. goto err;
473. if (!(ASN1_GENERALIZEDTIME_set_string(gt, tim)))
^
474. goto err;
475. x = X509V3_EXT_i2d(NID_id_pkix_OCSP_archiveCutoff, 0, gt);
crypto/ocsp/ocsp_ext.c:476:2:
474. goto err;
475. x = X509V3_EXT_i2d(NID_id_pkix_OCSP_archiveCutoff, 0, gt);
476. > err:
477. ASN1_GENERALIZEDTIME_free(gt);
478. return x;
crypto/ocsp/ocsp_ext.c:477:5:
475. x = X509V3_EXT_i2d(NID_id_pkix_OCSP_archiveCutoff, 0, gt);
476. err:
477. > ASN1_GENERALIZEDTIME_free(gt);
478. return x;
479. }
crypto/asn1/tasn_typ.c:87:1: start of procedure ASN1_GENERALIZEDTIME_free()
85. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALSTRING)
86. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UTCTIME)
87. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALIZEDTIME)
88. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_VISIBLESTRING)
89. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UNIVERSALSTRING)
crypto/asn1/asn1_lib.c:362:1: start of procedure ASN1_STRING_free()
360. }
361.
362. > void ASN1_STRING_free(ASN1_STRING *a)
363. {
364. if (a == NULL)
crypto/asn1/asn1_lib.c:364:9: Taking false branch
362. void ASN1_STRING_free(ASN1_STRING *a)
363. {
364. if (a == NULL)
^
365. return;
366. if (!(a->flags & ASN1_STRING_FLAG_NDEF))
crypto/asn1/asn1_lib.c:366:11: Taking false branch
364. if (a == NULL)
365. return;
366. if (!(a->flags & ASN1_STRING_FLAG_NDEF))
^
367. OPENSSL_free(a->data);
368. if (!(a->flags & ASN1_STRING_FLAG_EMBED))
crypto/asn1/asn1_lib.c:368:11: Taking false branch
366. if (!(a->flags & ASN1_STRING_FLAG_NDEF))
367. OPENSSL_free(a->data);
368. if (!(a->flags & ASN1_STRING_FLAG_EMBED))
^
369. OPENSSL_free(a);
370. }
crypto/asn1/asn1_lib.c:368:5:
366. if (!(a->flags & ASN1_STRING_FLAG_NDEF))
367. OPENSSL_free(a->data);
368. > if (!(a->flags & ASN1_STRING_FLAG_EMBED))
369. OPENSSL_free(a);
370. }
crypto/asn1/asn1_lib.c:370:1: return from a call to ASN1_STRING_free
368. if (!(a->flags & ASN1_STRING_FLAG_EMBED))
369. OPENSSL_free(a);
370. > }
371.
372. void ASN1_STRING_clear_free(ASN1_STRING *a)
crypto/asn1/tasn_typ.c:87:1: return from a call to ASN1_GENERALIZEDTIME_free
85. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALSTRING)
86. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UTCTIME)
87. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_GENERALIZEDTIME)
88. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_VISIBLESTRING)
89. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_UNIVERSALSTRING)
| https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/ocsp/ocsp_ext.c/#L477 |
d2a_code_trace_data_42399 | static void iv_Decode_Chunk(Indeo3DecodeContext *s,
unsigned char *cur, unsigned char *ref, int width, int height,
const unsigned char *buf1, long fflags2, const unsigned char *hdr,
const unsigned char *buf2, int min_width_160)
{
unsigned char bit_buf;
unsigned long bit_pos, lv, lv1, lv2;
long *width_tbl, width_tbl_arr[10];
const signed char *ref_vectors;
unsigned char *cur_frm_pos, *ref_frm_pos, *cp, *cp2;
uint32_t *cur_lp, *ref_lp;
const uint32_t *correction_lp[2], *correctionloworder_lp[2], *correctionhighorder_lp[2];
unsigned short *correction_type_sp[2];
ustr_t strip_tbl[20], *strip;
int i, j, k, lp1, lp2, flag1, cmd, blks_width, blks_height, region_160_width,
rle_v1, rle_v2, rle_v3;
unsigned short res;
bit_buf = 0;
ref_vectors = NULL;
width_tbl = width_tbl_arr + 1;
i = (width < 0 ? width + 3 : width)/4;
for(j = -1; j < 8; j++)
width_tbl[j] = i * j;
strip = strip_tbl;
for(region_160_width = 0; region_160_width < (width - min_width_160); region_160_width += min_width_160);
strip->ypos = strip->xpos = 0;
for(strip->width = min_width_160; width > strip->width; strip->width *= 2);
strip->height = height;
strip->split_direction = 0;
strip->split_flag = 0;
strip->usl7 = 0;
bit_pos = 0;
rle_v1 = rle_v2 = rle_v3 = 0;
while(strip >= strip_tbl) {
if(bit_pos <= 0) {
bit_pos = 8;
bit_buf = *buf1++;
}
bit_pos -= 2;
cmd = (bit_buf >> bit_pos) & 0x03;
if(cmd == 0) {
strip++;
memcpy(strip, strip-1, sizeof(ustr_t));
strip->split_flag = 1;
strip->split_direction = 0;
strip->height = (strip->height > 8 ? ((strip->height+8)>>4)<<3 : 4);
continue;
} else if(cmd == 1) {
strip++;
memcpy(strip, strip-1, sizeof(ustr_t));
strip->split_flag = 1;
strip->split_direction = 1;
strip->width = (strip->width > 8 ? ((strip->width+8)>>4)<<3 : 4);
continue;
} else if(cmd == 2) {
if(strip->usl7 == 0) {
strip->usl7 = 1;
ref_vectors = NULL;
continue;
}
} else if(cmd == 3) {
if(strip->usl7 == 0) {
strip->usl7 = 1;
ref_vectors = (const signed char*)buf2 + (*buf1 * 2);
buf1++;
continue;
}
}
cur_frm_pos = cur + width * strip->ypos + strip->xpos;
if((blks_width = strip->width) < 0)
blks_width += 3;
blks_width >>= 2;
blks_height = strip->height;
if(ref_vectors != NULL) {
ref_frm_pos = ref + (ref_vectors[0] + strip->ypos) * width +
ref_vectors[1] + strip->xpos;
} else
ref_frm_pos = cur_frm_pos - width_tbl[4];
if(cmd == 2) {
if(bit_pos <= 0) {
bit_pos = 8;
bit_buf = *buf1++;
}
bit_pos -= 2;
cmd = (bit_buf >> bit_pos) & 0x03;
if(cmd == 0 || ref_vectors != NULL) {
for(lp1 = 0; lp1 < blks_width; lp1++) {
for(i = 0, j = 0; i < blks_height; i++, j += width_tbl[1])
((uint32_t *)cur_frm_pos)[j] = ((uint32_t *)ref_frm_pos)[j];
cur_frm_pos += 4;
ref_frm_pos += 4;
}
} else if(cmd != 1)
return;
} else {
k = *buf1 >> 4;
j = *buf1 & 0x0f;
buf1++;
lv = j + fflags2;
if((lv - 8) <= 7 && (k == 0 || k == 3 || k == 10)) {
cp2 = s->ModPred + ((lv - 8) << 7);
cp = ref_frm_pos;
for(i = 0; i < blks_width << 2; i++) {
int v = *cp >> 1;
*(cp++) = cp2[v];
}
}
if(k == 1 || k == 4) {
lv = (hdr[j] & 0xf) + fflags2;
correction_type_sp[0] = s->corrector_type + (lv << 8);
correction_lp[0] = correction + (lv << 8);
lv = (hdr[j] >> 4) + fflags2;
correction_lp[1] = correction + (lv << 8);
correction_type_sp[1] = s->corrector_type + (lv << 8);
} else {
correctionloworder_lp[0] = correctionloworder_lp[1] = correctionloworder + (lv << 8);
correctionhighorder_lp[0] = correctionhighorder_lp[1] = correctionhighorder + (lv << 8);
correction_type_sp[0] = correction_type_sp[1] = s->corrector_type + (lv << 8);
correction_lp[0] = correction_lp[1] = correction + (lv << 8);
}
switch(k) {
case 1:
case 0:
for( ; blks_height > 0; blks_height -= 4) {
for(lp1 = 0; lp1 < blks_width; lp1++) {
for(lp2 = 0; lp2 < 4; ) {
k = *buf1++;
cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2];
ref_lp = ((uint32_t *)ref_frm_pos) + width_tbl[lp2];
switch(correction_type_sp[0][k]) {
case 0:
*cur_lp = le2me_32(((le2me_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
lp2++;
break;
case 1:
res = ((le2me_16(((unsigned short *)(ref_lp))[0]) >> 1) + correction_lp[lp2 & 0x01][*buf1]) << 1;
((unsigned short *)cur_lp)[0] = le2me_16(res);
res = ((le2me_16(((unsigned short *)(ref_lp))[1]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1;
((unsigned short *)cur_lp)[1] = le2me_16(res);
buf1++;
lp2++;
break;
case 2:
if(lp2 == 0) {
for(i = 0, j = 0; i < 2; i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
lp2 += 2;
}
break;
case 3:
if(lp2 < 2) {
for(i = 0, j = 0; i < (3 - lp2); i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
lp2 = 3;
}
break;
case 8:
if(lp2 == 0) {
RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
if(rle_v1 == 1 || ref_vectors != NULL) {
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
}
RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
break;
} else {
rle_v1 = 1;
rle_v2 = *buf1 - 1;
}
case 5:
LP2_CHECK(buf1,rle_v3,lp2)
case 4:
for(i = 0, j = 0; i < (4 - lp2); i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
lp2 = 4;
break;
case 7:
if(rle_v3 != 0)
rle_v3 = 0;
else {
buf1--;
rle_v3 = 1;
}
case 6:
if(ref_vectors != NULL) {
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
}
lp2 = 4;
break;
case 9:
lv1 = *buf1++;
lv = (lv1 & 0x7F) << 1;
lv += (lv << 8);
lv += (lv << 16);
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
cur_lp[j] = lv;
LV1_CHECK(buf1,rle_v3,lv1,lp2)
break;
default:
return;
}
}
cur_frm_pos += 4;
ref_frm_pos += 4;
}
cur_frm_pos += ((width - blks_width) * 4);
ref_frm_pos += ((width - blks_width) * 4);
}
break;
case 4:
case 3:
if(ref_vectors != NULL)
return;
flag1 = 1;
for( ; blks_height > 0; blks_height -= 8) {
for(lp1 = 0; lp1 < blks_width; lp1++) {
for(lp2 = 0; lp2 < 4; ) {
k = *buf1++;
cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
ref_lp = ((uint32_t *)cur_frm_pos) + width_tbl[(lp2 * 2) - 1];
switch(correction_type_sp[lp2 & 0x01][k]) {
case 0:
cur_lp[width_tbl[1]] = le2me_32(((le2me_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
if(lp2 > 0 || flag1 == 0 || strip->ypos != 0)
cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
else
cur_lp[0] = le2me_32(((le2me_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
lp2++;
break;
case 1:
res = ((le2me_16(((unsigned short *)ref_lp)[0]) >> 1) + correction_lp[lp2 & 0x01][*buf1]) << 1;
((unsigned short *)cur_lp)[width_tbl[2]] = le2me_16(res);
res = ((le2me_16(((unsigned short *)ref_lp)[1]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1;
((unsigned short *)cur_lp)[width_tbl[2]+1] = le2me_16(res);
if(lp2 > 0 || flag1 == 0 || strip->ypos != 0)
cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
else
cur_lp[0] = cur_lp[width_tbl[1]];
buf1++;
lp2++;
break;
case 2:
if(lp2 == 0) {
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
cur_lp[j] = *ref_lp;
lp2 += 2;
}
break;
case 3:
if(lp2 < 2) {
for(i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1])
cur_lp[j] = *ref_lp;
lp2 = 3;
}
break;
case 6:
lp2 = 4;
break;
case 7:
if(rle_v3 != 0)
rle_v3 = 0;
else {
buf1--;
rle_v3 = 1;
}
lp2 = 4;
break;
case 8:
if(lp2 == 0) {
RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
if(rle_v1 == 1) {
for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
}
RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
break;
} else {
rle_v2 = (*buf1) - 1;
rle_v1 = 1;
}
case 5:
LP2_CHECK(buf1,rle_v3,lp2)
case 4:
for(i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1])
cur_lp[j] = *ref_lp;
lp2 = 4;
break;
case 9:
av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
lv1 = *buf1++;
lv = (lv1 & 0x7F) << 1;
lv += (lv << 8);
lv += (lv << 16);
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
cur_lp[j] = lv;
LV1_CHECK(buf1,rle_v3,lv1,lp2)
break;
default:
return;
}
}
cur_frm_pos += 4;
}
cur_frm_pos += (((width * 2) - blks_width) * 4);
flag1 = 0;
}
break;
case 10:
if(ref_vectors == NULL) {
flag1 = 1;
for( ; blks_height > 0; blks_height -= 8) {
for(lp1 = 0; lp1 < blks_width; lp1 += 2) {
for(lp2 = 0; lp2 < 4; ) {
k = *buf1++;
cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
ref_lp = ((uint32_t *)cur_frm_pos) + width_tbl[(lp2 * 2) - 1];
lv1 = ref_lp[0];
lv2 = ref_lp[1];
if(lp2 == 0 && flag1 != 0) {
#ifdef WORDS_BIGENDIAN
lv1 = lv1 & 0xFF00FF00;
lv1 = (lv1 >> 8) | lv1;
lv2 = lv2 & 0xFF00FF00;
lv2 = (lv2 >> 8) | lv2;
#else
lv1 = lv1 & 0x00FF00FF;
lv1 = (lv1 << 8) | lv1;
lv2 = lv2 & 0x00FF00FF;
lv2 = (lv2 << 8) | lv2;
#endif
}
switch(correction_type_sp[lp2 & 0x01][k]) {
case 0:
cur_lp[width_tbl[1]] = le2me_32(((le2me_32(lv1) >> 1) + correctionloworder_lp[lp2 & 0x01][k]) << 1);
cur_lp[width_tbl[1]+1] = le2me_32(((le2me_32(lv2) >> 1) + correctionhighorder_lp[lp2 & 0x01][k]) << 1);
if(lp2 > 0 || strip->ypos != 0 || flag1 == 0) {
cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
} else {
cur_lp[0] = cur_lp[width_tbl[1]];
cur_lp[1] = cur_lp[width_tbl[1]+1];
}
lp2++;
break;
case 1:
cur_lp[width_tbl[1]] = le2me_32(((le2me_32(lv1) >> 1) + correctionloworder_lp[lp2 & 0x01][*buf1]) << 1);
cur_lp[width_tbl[1]+1] = le2me_32(((le2me_32(lv2) >> 1) + correctionloworder_lp[lp2 & 0x01][k]) << 1);
if(lp2 > 0 || strip->ypos != 0 || flag1 == 0) {
cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
} else {
cur_lp[0] = cur_lp[width_tbl[1]];
cur_lp[1] = cur_lp[width_tbl[1]+1];
}
buf1++;
lp2++;
break;
case 2:
if(lp2 == 0) {
if(flag1 != 0) {
for(i = 0, j = width_tbl[1]; i < 3; i++, j += width_tbl[1]) {
cur_lp[j] = lv1;
cur_lp[j+1] = lv2;
}
cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
} else {
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1]) {
cur_lp[j] = lv1;
cur_lp[j+1] = lv2;
}
}
lp2 += 2;
}
break;
case 3:
if(lp2 < 2) {
if(lp2 == 0 && flag1 != 0) {
for(i = 0, j = width_tbl[1]; i < 5; i++, j += width_tbl[1]) {
cur_lp[j] = lv1;
cur_lp[j+1] = lv2;
}
cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
} else {
for(i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1]) {
cur_lp[j] = lv1;
cur_lp[j+1] = lv2;
}
}
lp2 = 3;
}
break;
case 8:
if(lp2 == 0) {
RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
if(rle_v1 == 1) {
if(flag1 != 0) {
for(i = 0, j = width_tbl[1]; i < 7; i++, j += width_tbl[1]) {
cur_lp[j] = lv1;
cur_lp[j+1] = lv2;
}
cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
} else {
for(i = 0, j = 0; i < 8; i++, j += width_tbl[1]) {
cur_lp[j] = lv1;
cur_lp[j+1] = lv2;
}
}
}
RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
break;
} else {
rle_v1 = 1;
rle_v2 = (*buf1) - 1;
}
case 5:
LP2_CHECK(buf1,rle_v3,lp2)
case 4:
if(lp2 == 0 && flag1 != 0) {
for(i = 0, j = width_tbl[1]; i < 7; i++, j += width_tbl[1]) {
cur_lp[j] = lv1;
cur_lp[j+1] = lv2;
}
cur_lp[0] = ((cur_lp[-width_tbl[1]] >> 1) + (cur_lp[width_tbl[1]] >> 1)) & 0xFEFEFEFE;
cur_lp[1] = ((cur_lp[-width_tbl[1]+1] >> 1) + (cur_lp[width_tbl[1]+1] >> 1)) & 0xFEFEFEFE;
} else {
for(i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1]) {
cur_lp[j] = lv1;
cur_lp[j+1] = lv2;
}
}
lp2 = 4;
break;
case 6:
lp2 = 4;
break;
case 7:
if(lp2 == 0) {
if(rle_v3 != 0)
rle_v3 = 0;
else {
buf1--;
rle_v3 = 1;
}
lp2 = 4;
}
break;
case 9:
av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
lv1 = *buf1;
lv = (lv1 & 0x7F) << 1;
lv += (lv << 8);
lv += (lv << 16);
for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
cur_lp[j] = lv;
LV1_CHECK(buf1,rle_v3,lv1,lp2)
break;
default:
return;
}
}
cur_frm_pos += 8;
}
cur_frm_pos += (((width * 2) - blks_width) * 4);
flag1 = 0;
}
} else {
for( ; blks_height > 0; blks_height -= 8) {
for(lp1 = 0; lp1 < blks_width; lp1 += 2) {
for(lp2 = 0; lp2 < 4; ) {
k = *buf1++;
cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
ref_lp = ((uint32_t *)ref_frm_pos) + width_tbl[lp2 * 2];
switch(correction_type_sp[lp2 & 0x01][k]) {
case 0:
lv1 = correctionloworder_lp[lp2 & 0x01][k];
lv2 = correctionhighorder_lp[lp2 & 0x01][k];
cur_lp[0] = le2me_32(((le2me_32(ref_lp[0]) >> 1) + lv1) << 1);
cur_lp[1] = le2me_32(((le2me_32(ref_lp[1]) >> 1) + lv2) << 1);
cur_lp[width_tbl[1]] = le2me_32(((le2me_32(ref_lp[width_tbl[1]]) >> 1) + lv1) << 1);
cur_lp[width_tbl[1]+1] = le2me_32(((le2me_32(ref_lp[width_tbl[1]+1]) >> 1) + lv2) << 1);
lp2++;
break;
case 1:
lv1 = correctionloworder_lp[lp2 & 0x01][*buf1++];
lv2 = correctionloworder_lp[lp2 & 0x01][k];
cur_lp[0] = le2me_32(((le2me_32(ref_lp[0]) >> 1) + lv1) << 1);
cur_lp[1] = le2me_32(((le2me_32(ref_lp[1]) >> 1) + lv2) << 1);
cur_lp[width_tbl[1]] = le2me_32(((le2me_32(ref_lp[width_tbl[1]]) >> 1) + lv1) << 1);
cur_lp[width_tbl[1]+1] = le2me_32(((le2me_32(ref_lp[width_tbl[1]+1]) >> 1) + lv2) << 1);
lp2++;
break;
case 2:
if(lp2 == 0) {
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1]) {
cur_lp[j] = ref_lp[j];
cur_lp[j+1] = ref_lp[j+1];
}
lp2 += 2;
}
break;
case 3:
if(lp2 < 2) {
for(i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1]) {
cur_lp[j] = ref_lp[j];
cur_lp[j+1] = ref_lp[j+1];
}
lp2 = 3;
}
break;
case 8:
if(lp2 == 0) {
RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
for(i = 0, j = 0; i < 8; i++, j += width_tbl[1]) {
((uint32_t *)cur_frm_pos)[j] = ((uint32_t *)ref_frm_pos)[j];
((uint32_t *)cur_frm_pos)[j+1] = ((uint32_t *)ref_frm_pos)[j+1];
}
RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
break;
} else {
rle_v1 = 1;
rle_v2 = (*buf1) - 1;
}
case 5:
case 7:
LP2_CHECK(buf1,rle_v3,lp2)
case 6:
case 4:
for(i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1]) {
cur_lp[j] = ref_lp[j];
cur_lp[j+1] = ref_lp[j+1];
}
lp2 = 4;
break;
case 9:
av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
lv1 = *buf1;
lv = (lv1 & 0x7F) << 1;
lv += (lv << 8);
lv += (lv << 16);
for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
((uint32_t *)cur_frm_pos)[j] = ((uint32_t *)cur_frm_pos)[j+1] = lv;
LV1_CHECK(buf1,rle_v3,lv1,lp2)
break;
default:
return;
}
}
cur_frm_pos += 8;
ref_frm_pos += 8;
}
cur_frm_pos += (((width * 2) - blks_width) * 4);
ref_frm_pos += (((width * 2) - blks_width) * 4);
}
}
break;
case 11:
if(ref_vectors == NULL)
return;
for( ; blks_height > 0; blks_height -= 8) {
for(lp1 = 0; lp1 < blks_width; lp1++) {
for(lp2 = 0; lp2 < 4; ) {
k = *buf1++;
cur_lp = ((uint32_t *)cur_frm_pos) + width_tbl[lp2 * 2];
ref_lp = ((uint32_t *)ref_frm_pos) + width_tbl[lp2 * 2];
switch(correction_type_sp[lp2 & 0x01][k]) {
case 0:
cur_lp[0] = le2me_32(((le2me_32(*ref_lp) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
cur_lp[width_tbl[1]] = le2me_32(((le2me_32(ref_lp[width_tbl[1]]) >> 1) + correction_lp[lp2 & 0x01][k]) << 1);
lp2++;
break;
case 1:
lv1 = (unsigned short)(correction_lp[lp2 & 0x01][*buf1++]);
lv2 = (unsigned short)(correction_lp[lp2 & 0x01][k]);
res = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[0]) >> 1) + lv1) << 1);
((unsigned short *)cur_lp)[0] = le2me_16(res);
res = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[1]) >> 1) + lv2) << 1);
((unsigned short *)cur_lp)[1] = le2me_16(res);
res = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[width_tbl[2]]) >> 1) + lv1) << 1);
((unsigned short *)cur_lp)[width_tbl[2]] = le2me_16(res);
res = (unsigned short)(((le2me_16(((unsigned short *)ref_lp)[width_tbl[2]+1]) >> 1) + lv2) << 1);
((unsigned short *)cur_lp)[width_tbl[2]+1] = le2me_16(res);
lp2++;
break;
case 2:
if(lp2 == 0) {
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
lp2 += 2;
}
break;
case 3:
if(lp2 < 2) {
for(i = 0, j = 0; i < 6 - (lp2 * 2); i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
lp2 = 3;
}
break;
case 8:
if(lp2 == 0) {
RLE_V3_CHECK(buf1,rle_v1,rle_v2,rle_v3)
for(i = 0, j = 0; i < 8; i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
RLE_V2_CHECK(buf1,rle_v2, rle_v3,lp2)
break;
} else {
rle_v1 = 1;
rle_v2 = (*buf1) - 1;
}
case 5:
case 7:
LP2_CHECK(buf1,rle_v3,lp2)
case 4:
case 6:
for(i = 0, j = 0; i < 8 - (lp2 * 2); i++, j += width_tbl[1])
cur_lp[j] = ref_lp[j];
lp2 = 4;
break;
case 9:
av_log(s->avctx, AV_LOG_ERROR, "UNTESTED.\n");
lv1 = *buf1++;
lv = (lv1 & 0x7F) << 1;
lv += (lv << 8);
lv += (lv << 16);
for(i = 0, j = 0; i < 4; i++, j += width_tbl[1])
cur_lp[j] = lv;
LV1_CHECK(buf1,rle_v3,lv1,lp2)
break;
default:
return;
}
}
cur_frm_pos += 4;
ref_frm_pos += 4;
}
cur_frm_pos += (((width * 2) - blks_width) * 4);
ref_frm_pos += (((width * 2) - blks_width) * 4);
}
break;
default:
return;
}
}
if(strip < strip_tbl)
return;
for( ; strip >= strip_tbl; strip--) {
if(strip->split_flag != 0) {
strip->split_flag = 0;
strip->usl7 = (strip-1)->usl7;
if(strip->split_direction) {
strip->xpos += strip->width;
strip->width = (strip-1)->width - strip->width;
if(region_160_width <= strip->xpos && width < strip->width + strip->xpos)
strip->width = width - strip->xpos;
} else {
strip->ypos += strip->height;
strip->height = (strip-1)->height - strip->height;
}
break;
}
}
}
}
libavcodec/indeo3.c:346: error: Integer Overflow L2
([1, +oo] - 2):unsigned64.
libavcodec/indeo3.c:336:3: <LHS trace>
334. strip->usl7 = 0;
335.
336. bit_pos = 0;
^
337.
338. rle_v1 = rle_v2 = rle_v3 = 0;
libavcodec/indeo3.c:336:3: Assignment
334. strip->usl7 = 0;
335.
336. bit_pos = 0;
^
337.
338. rle_v1 = rle_v2 = rle_v3 = 0;
libavcodec/indeo3.c:346:5: Binary operation: ([1, +oo] - 2):unsigned64
344. }
345.
346. bit_pos -= 2;
^
347. cmd = (bit_buf >> bit_pos) & 0x03;
348.
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/indeo3.c/#L346 |
d2a_code_trace_data_42400 | static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg,
OPENSSL_LH_DOALL_FUNC func,
OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg)
{
int i;
OPENSSL_LH_NODE *a, *n;
if (lh == NULL)
return;
for (i = lh->num_nodes - 1; i >= 0; i--) {
a = lh->b[i];
while (a != NULL) {
n = a->next;
if (use_arg)
func_arg(a->data, arg);
else
func(a->data);
a = n;
}
}
}
test/servername_test.c:209: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `SSL_free`.
Showing all 17 steps of the trace
test/servername_test.c:191:17: Call
189. TLS1_VERSION, TLS_MAX_VERSION,
190. &sctx, &cctx, cert, privkey))
191. || !TEST_true(create_ssl_objects(sctx, cctx, &serverssl, &clientssl,
^
192. NULL, NULL)))
193. goto end;
test/ssltestlib.c:635:15: Call
633. if (*sssl != NULL)
634. serverssl = *sssl;
635. else if (!TEST_ptr(serverssl = SSL_new(serverctx)))
^
636. goto error;
637. if (*cssl != NULL)
ssl/ssl_lib.c:669:1: Parameter `ctx->sessions->num_nodes`
667. }
668.
669. > SSL *SSL_new(SSL_CTX *ctx)
670. {
671. SSL *s;
test/servername_test.c:209:5: Call
207. testresult = 1;
208. end:
209. SSL_free(serverssl);
^
210. SSL_free(clientssl);
211. SSL_CTX_free(sctx);
ssl/ssl_lib.c:1131:1: Parameter `s->ctx->sessions->num_nodes`
1129. }
1130.
1131. > void SSL_free(SSL *s)
1132. {
1133. int i;
ssl/ssl_lib.c:1203:5: Call
1201. RECORD_LAYER_release(&s->rlayer);
1202.
1203. SSL_CTX_free(s->ctx);
^
1204.
1205. ASYNC_WAIT_CTX_free(s->waitctx);
ssl/ssl_lib.c:3072:1: Parameter `a->sessions->num_nodes`
3070. }
3071.
3072. > void SSL_CTX_free(SSL_CTX *a)
3073. {
3074. int i;
ssl/ssl_lib.c:3098:9: Call
3096. */
3097. if (a->sessions != NULL)
3098. SSL_CTX_flush_sessions(a, 0);
^
3099.
3100. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data);
ssl/ssl_sess.c:1106:1: Parameter `s->sessions->num_nodes`
1104. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM);
1105.
1106. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t)
1107. {
1108. unsigned long i;
ssl/ssl_sess.c:1119:5: Call
1117. i = lh_SSL_SESSION_get_down_load(s->sessions);
1118. lh_SSL_SESSION_set_down_load(s->sessions, 0);
1119. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp);
^
1120. lh_SSL_SESSION_set_down_load(s->sessions, i);
1121. CRYPTO_THREAD_unlock(s->lock);
ssl/ssl_sess.c:1104:1: Parameter `lh->num_nodes`
1102. }
1103.
1104. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM);
1105.
1106. void SSL_CTX_flush_sessions(SSL_CTX *s, long t)
ssl/ssl_sess.c:1104:1: Call
1102. }
1103.
1104. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM);
1105.
1106. void SSL_CTX_flush_sessions(SSL_CTX *s, long t)
crypto/lhash/lhash.c:209:1: Parameter `lh->num_nodes`
207. }
208.
209. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg)
210. {
211. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg);
crypto/lhash/lhash.c:211:5: Call
209. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg)
210. {
211. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg);
^
212. }
213.
crypto/lhash/lhash.c:177:1: <LHS trace>
175. }
176.
177. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg,
178. OPENSSL_LH_DOALL_FUNC func,
179. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg)
crypto/lhash/lhash.c:177:1: Parameter `lh->num_nodes`
175. }
176.
177. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg,
178. OPENSSL_LH_DOALL_FUNC func,
179. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg)
crypto/lhash/lhash.c:191:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `SSL_free`
189. * memory leaks otherwise
190. */
191. for (i = lh->num_nodes - 1; i >= 0; i--) {
^
192. a = lh->b[i];
193. while (a != NULL) {
| https://github.com/openssl/openssl/blob/427e91d928ce7a1c583e4bba761cb17a85ac95b4/crypto/lhash/lhash.c/#L191 |
d2a_code_trace_data_42401 | void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
{
int i, j, max;
const BN_ULONG *ap;
BN_ULONG *rp;
max = n * 2;
ap = a;
rp = r;
rp[0] = rp[max - 1] = 0;
rp++;
j = n;
if (--j > 0) {
ap++;
rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
rp += 2;
}
for (i = n - 2; i > 0; i--) {
j--;
ap++;
rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]);
rp += 2;
}
bn_add_words(r, r, r, max);
bn_sqr_words(tmp, a, n);
bn_add_words(r, r, tmp, max);
}
test/bntest.c:2168: error: BUFFER_OVERRUN_L3
Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_is_prime_fasttest_ex`.
Showing all 50 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:745:14: Assignment
743. /* 2^(top*BN_BITS2) - m */
744. tmp.d[0] = (0 - m->d[0]) & BN_MASK2;
745. for (i = 1; i < top; i++)
^
746. tmp.d[i] = (~m->d[i]) & BN_MASK2;
747. tmp.top = top;
crypto/bn/bn_exp.c:1062:14: Call
1060. bits -= window0;
1061. wvalue = bn_get_bits(p, bits) & wmask;
1062. if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&tmp, top, powerbuf, wvalue,
^
1063. window))
1064. goto err;
crypto/bn/bn_exp.c:520:1: Parameter `top`
518. }
519.
520. > static int MOD_EXP_CTIME_COPY_FROM_PREBUF(BIGNUM *b, int top,
521. unsigned char *buf, int idx,
522. int window)
crypto/bn/bn_exp.c:577:5: Assignment
575. }
576.
577. b->top = top;
^
578. bn_correct_top(b);
579. return 1;
crypto/bn/bn_exp.c:578:5: Call
576.
577. b->top = top;
578. bn_correct_top(b);
^
579. return 1;
580. }
crypto/bn/bn_lib.c:946:1: Parameter `a->top`
944. }
945.
946. > void bn_correct_top(BIGNUM *a)
947. {
948. BN_ULONG *ftl;
crypto/bn/bn_exp.c:1075:22: Call
1073. /* Square the result window-size times */
1074. for (i = 0; i < window; i++)
1075. if (!BN_mod_mul_montgomery(&tmp, &tmp, &tmp, mont, ctx))
^
1076. goto err;
1077.
crypto/bn/bn_mont.c:26:1: Parameter `a->top`
24. #endif
25.
26. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
27. BN_MONT_CTX *mont, BN_CTX *ctx)
28. {
crypto/bn/bn_mont.c:53:14: Call
51. bn_check_top(tmp);
52. if (a == b) {
53. if (!BN_sqr(tmp, a, ctx))
^
54. goto err;
55. } else {
crypto/bn/bn_sqr.c:17:1: Parameter `a->top`
15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96
16. */
17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
18. {
19. int max, al;
crypto/bn/bn_sqr.c:25:5: Assignment
23. bn_check_top(a);
24.
25. al = a->top;
^
26. if (al <= 0) {
27. r->top = 0;
crypto/bn/bn_sqr.c:74:17: Call
72. if (bn_wexpand(tmp, max) == NULL)
73. goto err;
74. bn_sqr_normal(rr->d, a->d, al, tmp->d);
^
75. }
76. }
crypto/bn/bn_sqr.c:105:1: <Offset trace>
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:105:1: Parameter `n`
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:116:5: Assignment
114. rp[0] = rp[max - 1] = 0;
115. rp++;
116. j = n;
^
117.
118. if (--j > 0) {
crypto/bn/bn_sqr.c:118:9: Assignment
116. j = n;
117.
118. if (--j > 0) {
^
119. ap++;
120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
crypto/bn/bn_sqr.c:105:1: <Length trace>
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:105:1: Parameter `*r`
103.
104. /* tmp must have 2*n words */
105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
106. {
107. int i, j, max;
crypto/bn/bn_sqr.c:113:5: Assignment
111. max = n * 2;
112. ap = a;
113. rp = r;
^
114. rp[0] = rp[max - 1] = 0;
115. rp++;
crypto/bn/bn_sqr.c:115:5: Assignment
113. rp = r;
114. rp[0] = rp[max - 1] = 0;
115. rp++;
^
116. j = n;
117.
crypto/bn/bn_sqr.c:120:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_is_prime_fasttest_ex`
118. if (--j > 0) {
119. ap++;
120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
^
121. rp += 2;
122. }
| https://github.com/openssl/openssl/blob/b48d4397b8ee4256f0b0a115eb99f27ae89995e0/crypto/bn/bn_sqr.c/#L120 |
d2a_code_trace_data_42402 | 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:1075: error: Uninitialized Value
The value read from xmin was never initialized.
libavcodec/motion_est_template.c:1075:13:
1073. (last_mv[ref_mv_xy-ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
1074. }else{
1075. CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16,
^
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
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1075 |
d2a_code_trace_data_42403 | static int group_field_test(void)
{
int r = 1;
BIGNUM *secp521r1_field = NULL;
BIGNUM *sect163r2_field = NULL;
EC_GROUP *secp521r1_group = NULL;
EC_GROUP *sect163r2_group = NULL;
BN_hex2bn(&secp521r1_field,
"01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
"FFFF");
BN_hex2bn(§163r2_field,
"08000000000000000000000000000000"
"00000000C9");
secp521r1_group = EC_GROUP_new_by_curve_name(NID_secp521r1);
if (BN_cmp(secp521r1_field, EC_GROUP_get0_field(secp521r1_group)))
r = 0;
# ifndef OPENSSL_NO_EC2M
sect163r2_group = EC_GROUP_new_by_curve_name(NID_sect163r2);
if (BN_cmp(sect163r2_field, EC_GROUP_get0_field(sect163r2_group)))
r = 0;
# endif
EC_GROUP_free(secp521r1_group);
EC_GROUP_free(sect163r2_group);
BN_free(secp521r1_field);
BN_free(sect163r2_field);
return r;
}
test/ectest.c:1189: error: NULL_DEREFERENCE
pointer `sect163r2_group` last assigned on line 1188 could be null and is dereferenced by call to `EC_GROUP_get0_field()` at line 1189, column 33.
Showing all 40 steps of the trace
test/ectest.c:1163:1: start of procedure group_field_test()
1161. }
1162.
1163. > static int group_field_test(void)
1164. {
1165. int r = 1;
test/ectest.c:1165:5:
1163. static int group_field_test(void)
1164. {
1165. > int r = 1;
1166. BIGNUM *secp521r1_field = NULL;
1167. BIGNUM *sect163r2_field = NULL;
test/ectest.c:1166:5:
1164. {
1165. int r = 1;
1166. > BIGNUM *secp521r1_field = NULL;
1167. BIGNUM *sect163r2_field = NULL;
1168. EC_GROUP *secp521r1_group = NULL;
test/ectest.c:1167:5:
1165. int r = 1;
1166. BIGNUM *secp521r1_field = NULL;
1167. > BIGNUM *sect163r2_field = NULL;
1168. EC_GROUP *secp521r1_group = NULL;
1169. EC_GROUP *sect163r2_group = NULL;
test/ectest.c:1168:5:
1166. BIGNUM *secp521r1_field = NULL;
1167. BIGNUM *sect163r2_field = NULL;
1168. > EC_GROUP *secp521r1_group = NULL;
1169. EC_GROUP *sect163r2_group = NULL;
1170.
test/ectest.c:1169:5:
1167. BIGNUM *sect163r2_field = NULL;
1168. EC_GROUP *secp521r1_group = NULL;
1169. > EC_GROUP *sect163r2_group = NULL;
1170.
1171. BN_hex2bn(&secp521r1_field,
test/ectest.c:1171:5: Skipping BN_hex2bn(): empty list of specs
1169. EC_GROUP *sect163r2_group = NULL;
1170.
1171. BN_hex2bn(&secp521r1_field,
^
1172. "01FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
1173. "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"
test/ectest.c:1179:5: Skipping BN_hex2bn(): empty list of specs
1177.
1178.
1179. BN_hex2bn(§163r2_field,
^
1180. "08000000000000000000000000000000"
1181. "00000000C9");
test/ectest.c:1183:5:
1181. "00000000C9");
1182.
1183. > secp521r1_group = EC_GROUP_new_by_curve_name(NID_secp521r1);
1184. if (BN_cmp(secp521r1_field, EC_GROUP_get0_field(secp521r1_group)))
1185. r = 0;
crypto/ec/ec_curve.c:3121:1: start of procedure EC_GROUP_new_by_curve_name()
3119. }
3120.
3121. > EC_GROUP *EC_GROUP_new_by_curve_name(int nid)
3122. {
3123. size_t i;
crypto/ec/ec_curve.c:3124:5:
3122. {
3123. size_t i;
3124. > EC_GROUP *ret = NULL;
3125.
3126. if (nid <= 0)
crypto/ec/ec_curve.c:3126:9: Taking false branch
3124. EC_GROUP *ret = NULL;
3125.
3126. if (nid <= 0)
^
3127. return NULL;
3128.
crypto/ec/ec_curve.c:3129:10:
3127. return NULL;
3128.
3129. > for (i = 0; i < curve_list_length; i++)
3130. if (curve_list[i].nid == nid) {
3131. ret = ec_group_new_from_data(curve_list[i]);
crypto/ec/ec_curve.c:3129:17: Loop condition is true. Entering loop body
3127. return NULL;
3128.
3129. for (i = 0; i < curve_list_length; i++)
^
3130. if (curve_list[i].nid == nid) {
3131. ret = ec_group_new_from_data(curve_list[i]);
crypto/ec/ec_curve.c:3130:13: Taking true branch
3128.
3129. for (i = 0; i < curve_list_length; i++)
3130. if (curve_list[i].nid == nid) {
^
3131. ret = ec_group_new_from_data(curve_list[i]);
3132. break;
crypto/ec/ec_curve.c:3131:13: Skipping ec_group_new_from_data(): empty list of specs
3129. for (i = 0; i < curve_list_length; i++)
3130. if (curve_list[i].nid == nid) {
3131. ret = ec_group_new_from_data(curve_list[i]);
^
3132. break;
3133. }
crypto/ec/ec_curve.c:3135:9: Taking false branch
3133. }
3134.
3135. if (ret == NULL) {
^
3136. ECerr(EC_F_EC_GROUP_NEW_BY_CURVE_NAME, EC_R_UNKNOWN_GROUP);
3137. return NULL;
crypto/ec/ec_curve.c:3140:5:
3138. }
3139.
3140. > return ret;
3141. }
3142.
crypto/ec/ec_curve.c:3141:1: return from a call to EC_GROUP_new_by_curve_name
3139.
3140. return ret;
3141. > }
3142.
3143. size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems)
test/ectest.c:1184:9:
1182.
1183. secp521r1_group = EC_GROUP_new_by_curve_name(NID_secp521r1);
1184. > if (BN_cmp(secp521r1_field, EC_GROUP_get0_field(secp521r1_group)))
1185. r = 0;
1186.
crypto/ec/ec_lib.c:369:1: start of procedure EC_GROUP_get0_field()
367. }
368.
369. > const BIGNUM *EC_GROUP_get0_field(const EC_GROUP *group)
370. {
371. return group->field;
crypto/ec/ec_lib.c:371:5:
369. const BIGNUM *EC_GROUP_get0_field(const EC_GROUP *group)
370. {
371. > return group->field;
372. }
373.
crypto/ec/ec_lib.c:372:1: return from a call to EC_GROUP_get0_field
370. {
371. return group->field;
372. > }
373.
374. void EC_GROUP_set_asn1_flag(EC_GROUP *group, int flag)
test/ectest.c:1184:9: Taking true branch
1182.
1183. secp521r1_group = EC_GROUP_new_by_curve_name(NID_secp521r1);
1184. if (BN_cmp(secp521r1_field, EC_GROUP_get0_field(secp521r1_group)))
^
1185. r = 0;
1186.
test/ectest.c:1185:7:
1183. secp521r1_group = EC_GROUP_new_by_curve_name(NID_secp521r1);
1184. if (BN_cmp(secp521r1_field, EC_GROUP_get0_field(secp521r1_group)))
1185. > r = 0;
1186.
1187. # ifndef OPENSSL_NO_EC2M
test/ectest.c:1188:5:
1186.
1187. # ifndef OPENSSL_NO_EC2M
1188. > sect163r2_group = EC_GROUP_new_by_curve_name(NID_sect163r2);
1189. if (BN_cmp(sect163r2_field, EC_GROUP_get0_field(sect163r2_group)))
1190. r = 0;
crypto/ec/ec_curve.c:3121:1: start of procedure EC_GROUP_new_by_curve_name()
3119. }
3120.
3121. > EC_GROUP *EC_GROUP_new_by_curve_name(int nid)
3122. {
3123. size_t i;
crypto/ec/ec_curve.c:3124:5:
3122. {
3123. size_t i;
3124. > EC_GROUP *ret = NULL;
3125.
3126. if (nid <= 0)
crypto/ec/ec_curve.c:3126:9: Taking false branch
3124. EC_GROUP *ret = NULL;
3125.
3126. if (nid <= 0)
^
3127. return NULL;
3128.
crypto/ec/ec_curve.c:3129:10:
3127. return NULL;
3128.
3129. > for (i = 0; i < curve_list_length; i++)
3130. if (curve_list[i].nid == nid) {
3131. ret = ec_group_new_from_data(curve_list[i]);
crypto/ec/ec_curve.c:3129:17: Loop condition is true. Entering loop body
3127. return NULL;
3128.
3129. for (i = 0; i < curve_list_length; i++)
^
3130. if (curve_list[i].nid == nid) {
3131. ret = ec_group_new_from_data(curve_list[i]);
crypto/ec/ec_curve.c:3130:13: Taking true branch
3128.
3129. for (i = 0; i < curve_list_length; i++)
3130. if (curve_list[i].nid == nid) {
^
3131. ret = ec_group_new_from_data(curve_list[i]);
3132. break;
crypto/ec/ec_curve.c:3131:13: Skipping ec_group_new_from_data(): empty list of specs
3129. for (i = 0; i < curve_list_length; i++)
3130. if (curve_list[i].nid == nid) {
3131. ret = ec_group_new_from_data(curve_list[i]);
^
3132. break;
3133. }
crypto/ec/ec_curve.c:3135:9: Taking true branch
3133. }
3134.
3135. if (ret == NULL) {
^
3136. ECerr(EC_F_EC_GROUP_NEW_BY_CURVE_NAME, EC_R_UNKNOWN_GROUP);
3137. return NULL;
crypto/ec/ec_curve.c:3136:9: Skipping ERR_put_error(): empty list of specs
3134.
3135. if (ret == NULL) {
3136. ECerr(EC_F_EC_GROUP_NEW_BY_CURVE_NAME, EC_R_UNKNOWN_GROUP);
^
3137. return NULL;
3138. }
crypto/ec/ec_curve.c:3137:9:
3135. if (ret == NULL) {
3136. ECerr(EC_F_EC_GROUP_NEW_BY_CURVE_NAME, EC_R_UNKNOWN_GROUP);
3137. > return NULL;
3138. }
3139.
crypto/ec/ec_curve.c:3141:1: return from a call to EC_GROUP_new_by_curve_name
3139.
3140. return ret;
3141. > }
3142.
3143. size_t EC_get_builtin_curves(EC_builtin_curve *r, size_t nitems)
test/ectest.c:1189:9:
1187. # ifndef OPENSSL_NO_EC2M
1188. sect163r2_group = EC_GROUP_new_by_curve_name(NID_sect163r2);
1189. > if (BN_cmp(sect163r2_field, EC_GROUP_get0_field(sect163r2_group)))
1190. r = 0;
1191. # endif
crypto/ec/ec_lib.c:369:1: start of procedure EC_GROUP_get0_field()
367. }
368.
369. > const BIGNUM *EC_GROUP_get0_field(const EC_GROUP *group)
370. {
371. return group->field;
crypto/ec/ec_lib.c:371:5:
369. const BIGNUM *EC_GROUP_get0_field(const EC_GROUP *group)
370. {
371. > return group->field;
372. }
373.
| https://github.com/openssl/openssl/blob/8d4f150f70d70d6c3e62661ed7cc16c2f751d8a1/test/ectest.c/#L1189 |
d2a_code_trace_data_42404 | static void unpack_input(const unsigned char *input, unsigned int *output)
{
unsigned int outbuffer[28];
unsigned short inbuffer[10];
unsigned int x;
unsigned int *ptr;
for (x=0;x<20;x+=2)
inbuffer[x/2]=(input[x]<<8)+input[x+1];
ptr=outbuffer;
*(ptr++)=27;
*(ptr++)=(inbuffer[0]>>10)&0x3f;
*(ptr++)=(inbuffer[0]>>5)&0x1f;
*(ptr++)=inbuffer[0]&0x1f;
*(ptr++)=(inbuffer[1]>>12)&0xf;
*(ptr++)=(inbuffer[1]>>8)&0xf;
*(ptr++)=(inbuffer[1]>>5)&7;
*(ptr++)=(inbuffer[1]>>2)&7;
*(ptr++)=((inbuffer[1]<<1)&6)|((inbuffer[2]>>15)&1);
*(ptr++)=(inbuffer[2]>>12)&7;
*(ptr++)=(inbuffer[2]>>10)&3;
*(ptr++)=(inbuffer[2]>>5)&0x1f;
*(ptr++)=((inbuffer[2]<<2)&0x7c)|((inbuffer[3]>>14)&3);
*(ptr++)=(inbuffer[3]>>6)&0xff;
*(ptr++)=((inbuffer[3]<<1)&0x7e)|((inbuffer[4]>>15)&1);
*(ptr++)=(inbuffer[4]>>8)&0x7f;
*(ptr++)=(inbuffer[4]>>1)&0x7f;
*(ptr++)=((inbuffer[4]<<7)&0x80)|((inbuffer[5]>>9)&0x7f);
*(ptr++)=(inbuffer[5]>>2)&0x7f;
*(ptr++)=((inbuffer[5]<<5)&0x60)|((inbuffer[6]>>11)&0x1f);
*(ptr++)=(inbuffer[6]>>4)&0x7f;
*(ptr++)=((inbuffer[6]<<4)&0xf0)|((inbuffer[7]>>12)&0xf);
*(ptr++)=(inbuffer[7]>>5)&0x7f;
*(ptr++)=((inbuffer[7]<<2)&0x7c)|((inbuffer[8]>>14)&3);
*(ptr++)=(inbuffer[8]>>7)&0x7f;
*(ptr++)=((inbuffer[8]<<1)&0xfe)|((inbuffer[9]>>15)&1);
*(ptr++)=(inbuffer[9]>>8)&0x7f;
*(ptr++)=(inbuffer[9]>>1)&0x7f;
*(output++)=outbuffer[11];
for (x=1;x<11;*(output++)=outbuffer[x++]);
ptr=outbuffer+12;
for (x=0;x<16;x+=4)
{
*(output++)=ptr[x];
*(output++)=ptr[x+2];
*(output++)=ptr[x+3];
*(output++)=ptr[x+1];
}
}
libavcodec/ra144.c:294: error: Uninitialized Value
The value read from inbuffer[_] was never initialized.
libavcodec/ra144.c:294:3:
292. *(ptr++)=((inbuffer[8]<<1)&0xfe)|((inbuffer[9]>>15)&1);
293. *(ptr++)=(inbuffer[9]>>8)&0x7f;
294. *(ptr++)=(inbuffer[9]>>1)&0x7f;
^
295.
296. *(output++)=outbuffer[11];
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ra144.c/#L294 |
d2a_code_trace_data_42405 | static AVEvalExpr * parse_primary(Parser *p) {
AVEvalExpr * d = av_mallocz(sizeof(AVEvalExpr));
char *next= p->s;
int i;
d->value = av_strtod(p->s, &next);
if(next != p->s){
d->type = e_value;
p->s= next;
return d;
}
d->value = 1;
for(i=0; p->const_name && p->const_name[i]; i++){
if(strmatch(p->s, p->const_name[i])){
p->s+= strlen(p->const_name[i]);
d->type = e_const;
d->a.const_index = i;
return d;
}
}
p->s= strchr(p->s, '(');
if(p->s==NULL){
*p->error = "missing (";
p->s= next;
ff_eval_free(d);
return NULL;
}
p->s++;
if (*next == '(') {
av_freep(&d);
d = parse_expr(p);
if(p->s[0] != ')'){
*p->error = "missing )";
ff_eval_free(d);
return NULL;
}
p->s++;
return d;
}
d->param[0] = parse_expr(p);
if(p->s[0]== ','){
p->s++;
d->param[1] = parse_expr(p);
}
if(p->s[0] != ')'){
*p->error = "missing )";
ff_eval_free(d);
return NULL;
}
p->s++;
d->type = e_func0;
if( strmatch(next, "sinh" ) ) d->a.func0 = sinh;
else if( strmatch(next, "cosh" ) ) d->a.func0 = cosh;
else if( strmatch(next, "tanh" ) ) d->a.func0 = tanh;
else if( strmatch(next, "sin" ) ) d->a.func0 = sin;
else if( strmatch(next, "cos" ) ) d->a.func0 = cos;
else if( strmatch(next, "tan" ) ) d->a.func0 = tan;
else if( strmatch(next, "atan" ) ) d->a.func0 = atan;
else if( strmatch(next, "asin" ) ) d->a.func0 = asin;
else if( strmatch(next, "acos" ) ) d->a.func0 = acos;
else if( strmatch(next, "exp" ) ) d->a.func0 = exp;
else if( strmatch(next, "log" ) ) d->a.func0 = log;
else if( strmatch(next, "abs" ) ) d->a.func0 = fabs;
else if( strmatch(next, "squish") ) d->type = e_squish;
else if( strmatch(next, "gauss" ) ) d->type = e_gauss;
else if( strmatch(next, "mod" ) ) d->type = e_mod;
else if( strmatch(next, "max" ) ) d->type = e_max;
else if( strmatch(next, "min" ) ) d->type = e_min;
else if( strmatch(next, "eq" ) ) d->type = e_eq;
else if( strmatch(next, "gte" ) ) d->type = e_gte;
else if( strmatch(next, "gt" ) ) d->type = e_gt;
else if( strmatch(next, "lte" ) ) { AVEvalExpr * tmp = d->param[1]; d->param[1] = d->param[0]; d->param[0] = tmp; d->type = e_gt; }
else if( strmatch(next, "lt" ) ) { AVEvalExpr * tmp = d->param[1]; d->param[1] = d->param[0]; d->param[0] = tmp; d->type = e_gte; }
else if( strmatch(next, "ld" ) ) d->type = e_ld;
else if( strmatch(next, "st" ) ) d->type = e_st;
else if( strmatch(next, "while" ) ) d->type = e_while;
else {
for(i=0; p->func1_name && p->func1_name[i]; i++){
if(strmatch(next, p->func1_name[i])){
d->a.func1 = p->func1[i];
d->type = e_func1;
return d;
}
}
for(i=0; p->func2_name && p->func2_name[i]; i++){
if(strmatch(next, p->func2_name[i])){
d->a.func2 = p->func2[i];
d->type = e_func2;
return d;
}
}
*p->error = "unknown function";
ff_eval_free(d);
return NULL;
}
return d;
}
libavcodec/opt.c:164: error: Buffer Overrun L3
Offset: [0, 1] Size: [1, 256] by call to `ff_eval2`.
libavcodec/opt.c:118:1: Array declaration
116. }
117.
118. const AVOption *av_set_string(void *obj, const char *name, const char *val){
^
119. const AVOption *o= av_find_opt(obj, name, NULL, 0, 0);
120. if(o && o->offset==0 && o->type == FF_OPT_TYPE_CONST && o->unit){
libavcodec/opt.c:164:17: Call
162. val+= i;
163.
164. d = ff_eval2(buf, const_values, const_names, NULL, NULL, NULL, NULL, NULL, &error);
^
165. if(isnan(d)) {
166. const AVOption *o_named= av_find_opt(obj, buf, o->unit, 0, 0);
libavcodec/eval.c:415:1: Parameter `s->strlen`
413. }
414.
415. double ff_eval2(const char *s, double *const_value, const char **const_name,
^
416. double (**func1)(void *, double), const char **func1_name,
417. double (**func2)(void *, double, double), char **func2_name,
libavcodec/eval.c:419:22: Call
417. double (**func2)(void *, double, double), char **func2_name,
418. void *opaque, const char **error){
419. AVEvalExpr * e = ff_parse(s, const_name, func1, func1_name, func2, func2_name, error);
^
420. double d;
421. if (!e) return NAN;
libavcodec/eval.c:378:1: Parameter `s->strlen`
376. }
377.
378. AVEvalExpr * ff_parse(const char *s, const char **const_name,
^
379. double (**func1)(void *, double), const char **func1_name,
380. double (**func2)(void *, double, double), char **func2_name,
libavcodec/eval.c:384:12: Array declaration
382. Parser p;
383. AVEvalExpr * e;
384. char w[strlen(s) + 1], * wp = w;
^
385.
386. while (*s)
libavcodec/eval.c:391:5: Assignment
389.
390. p.stack_index=100;
391. p.s= w;
^
392. p.const_name = const_name;
393. p.func1 = func1;
libavcodec/eval.c:399:9: Call
397. p.error= error;
398.
399. e = parse_expr(&p);
^
400. if (!verify_expr(e)) {
401. ff_eval_free(e);
libavcodec/eval.c:345:1: Parameter `*p->s`
343. }
344.
345. static AVEvalExpr * parse_expr(Parser *p) {
^
346. AVEvalExpr * e;
347.
libavcodec/eval.c:352:9: Call
350. p->stack_index--;
351.
352. e = parse_subexpr(p);
^
353.
354. while(*p->s == ';') {
libavcodec/eval.c:336:1: Parameter `*p->s`
334. }
335.
336. static AVEvalExpr * parse_subexpr(Parser *p) {
^
337. AVEvalExpr * e = parse_term(p);
338. while(*p->s == '+' || *p->s == '-') {
libavcodec/eval.c:337:22: Call
335.
336. static AVEvalExpr * parse_subexpr(Parser *p) {
337. AVEvalExpr * e = parse_term(p);
^
338. while(*p->s == '+' || *p->s == '-') {
339. e= new_eval_expr(e_add, 1, e, parse_term(p));
libavcodec/eval.c:327:1: Parameter `*p->s`
325. }
326.
327. static AVEvalExpr * parse_term(Parser *p){
^
328. AVEvalExpr * e = parse_factor(p);
329. while(p->s[0]=='*' || p->s[0]=='/'){
libavcodec/eval.c:328:22: Call
326.
327. static AVEvalExpr * parse_term(Parser *p){
328. AVEvalExpr * e = parse_factor(p);
^
329. while(p->s[0]=='*' || p->s[0]=='/'){
330. int c= *p->s++;
libavcodec/eval.c:315:1: Parameter `*p->s`
313. }
314.
315. static AVEvalExpr * parse_factor(Parser *p){
^
316. int sign, sign2;
317. AVEvalExpr * e = parse_pow(p, &sign);
libavcodec/eval.c:317:22: Call
315. static AVEvalExpr * parse_factor(Parser *p){
316. int sign, sign2;
317. AVEvalExpr * e = parse_pow(p, &sign);
^
318. while(p->s[0]=='^'){
319. p->s++;
libavcodec/eval.c:309:1: Parameter `*p->s`
307. }
308.
309. static AVEvalExpr * parse_pow(Parser *p, int *sign){
^
310. *sign= (*p->s == '+') - (*p->s == '-');
311. p->s += *sign&1;
libavcodec/eval.c:311:5: Assignment
309. static AVEvalExpr * parse_pow(Parser *p, int *sign){
310. *sign= (*p->s == '+') - (*p->s == '-');
311. p->s += *sign&1;
^
312. return parse_primary(p);
313. }
libavcodec/eval.c:312:12: Call
310. *sign= (*p->s == '+') - (*p->s == '-');
311. p->s += *sign&1;
312. return parse_primary(p);
^
313. }
314.
libavcodec/eval.c:194:1: <Length trace>
192. }
193.
194. static AVEvalExpr * parse_primary(Parser *p) {
^
195. AVEvalExpr * d = av_mallocz(sizeof(AVEvalExpr));
196. char *next= p->s;
libavcodec/eval.c:194:1: Parameter `*p->s`
192. }
193.
194. static AVEvalExpr * parse_primary(Parser *p) {
^
195. AVEvalExpr * d = av_mallocz(sizeof(AVEvalExpr));
196. char *next= p->s;
libavcodec/eval.c:226:9: Array access: Offset: [0, 1] Size: [1, 256] by call to `ff_eval2`
224. }
225. p->s++; // "("
226. if (*next == '(') { // special case do-nothing
^
227. av_freep(&d);
228. d = parse_expr(p);
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/eval.c/#L226 |
d2a_code_trace_data_42406 | 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 (!ec_point_is_compat(r, group)) {
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);
}
if (!BN_is_zero(group->order) && !BN_is_zero(group->cofactor)) {
if ((scalar != NULL) && (num == 0)) {
return ec_scalar_mul_ladder(group, r, scalar, NULL, ctx);
}
if ((scalar == NULL) && (num == 1)) {
return ec_scalar_mul_ladder(group, r, scalars[0], points[0], ctx);
}
}
for (i = 0; i < num; i++) {
if (!ec_point_is_compat(points[i], group)) {
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:582: error: INTEGER_OVERFLOW_L2
([0, +oo] - [0, 8]):unsigned64 by call to `EC_POINTs_mul`.
Showing all 13 steps of the trace
test/ectest.c:323:13: Call
321. || !TEST_BN_eq(y, z)
322. || !TEST_int_eq(EC_GROUP_get_degree(group), 160)
323. || !group_order_tests(group)
^
324. || !TEST_ptr(P_160 = EC_GROUP_new(EC_GROUP_method_of(group)))
325. || !TEST_true(EC_GROUP_copy(P_160, group))
test/ectest.c:52:13: Call
50. || !TEST_true(EC_POINT_mul(group, Q, order, NULL, NULL, ctx))
51. || !TEST_true(EC_POINT_is_at_infinity(group, Q))
52. || !TEST_true(EC_GROUP_precompute_mult(group, ctx))
^
53. || !TEST_true(EC_POINT_mul(group, Q, order, NULL, NULL, ctx))
54. || !TEST_true(EC_POINT_is_at_infinity(group, Q))
crypto/ec/ec_lib.c:949:16: Call
947. if (group->meth->mul == 0)
948. /* use default */
949. return ec_wNAF_precompute_mult(group, ctx);
^
950.
951. if (group->meth->precompute_mult != 0)
crypto/ec/ec_mult.c:874:5: Assignment
872. * efficiency.
873. */
874. blocksize = 8;
^
875. w = 4;
876. if (EC_window_bits_for_scalar_size(bits) > w) {
crypto/ec/ec_mult.c:955:5: Assignment
953.
954. pre_comp->group = group;
955. pre_comp->blocksize = blocksize;
^
956. pre_comp->numblocks = numblocks;
957. pre_comp->w = w;
test/ectest.c:582:10: Call
580.
581. /* z is still the group order */
582. if (!TEST_true(EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx))
^
583. || !TEST_true(EC_POINTs_mul(group, R, z, 2, points, scalars, ctx))
584. || !TEST_int_eq(0, EC_POINT_cmp(group, P, R, ctx))
crypto/ec/ec_lib.c:918:1: Parameter `group->pre_comp.ec->blocksize`
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:401:1: <LHS trace>
399. * in the addition if scalar != NULL
400. */
401. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
402. size_t num, const EC_POINT *points[], const BIGNUM *scalars[],
403. BN_CTX *ctx)
crypto/ec/ec_mult.c:401:1: Parameter `group->pre_comp.ec->numblocks`
399. * in the addition if scalar != NULL
400. */
401. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
402. size_t num, const EC_POINT *points[], const BIGNUM *scalars[],
403. BN_CTX *ctx)
crypto/ec/ec_mult.c:401:1: <RHS trace>
399. * in the addition if scalar != NULL
400. */
401. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
402. size_t num, const EC_POINT *points[], const BIGNUM *scalars[],
403. BN_CTX *ctx)
crypto/ec/ec_mult.c:401:1: Parameter `group->pre_comp.ec->numblocks`
399. * in the addition if scalar != NULL
400. */
401. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
402. size_t num, const EC_POINT *points[], const BIGNUM *scalars[],
403. BN_CTX *ctx)
crypto/ec/ec_mult.c:638:25: Binary operation: ([0, +oo] - [0, 8]):unsigned64 by call to `EC_POINTs_mul`
636. goto err;
637. }
638. tmp_len -= blocksize;
^
639. } else
640. /*
| https://github.com/openssl/openssl/blob/66b0bca887eb4ad1f5758e56c45905fb3fc36667/crypto/ec/ec_mult.c/#L638 |
d2a_code_trace_data_42407 | int ossl_prop_defn_set(const char *prop, OSSL_PROPERTY_LIST *pl)
{
PROPERTY_DEFN_ELEM elem, *old, *p = NULL;
size_t len;
if (prop == NULL)
return 1;
if (pl == NULL) {
elem.prop = prop;
lh_PROPERTY_DEFN_ELEM_delete(property_defns, &elem);
return 1;
}
len = strlen(prop);
p = OPENSSL_malloc(sizeof(*p) + len);
if (p != NULL) {
p->prop = p->body;
p->defn = pl;
memcpy(p->body, prop, len + 1);
old = lh_PROPERTY_DEFN_ELEM_insert(property_defns, p);
if (old != NULL) {
property_defn_free(old);
return 1;
}
if (!lh_PROPERTY_DEFN_ELEM_error(property_defns))
return 1;
}
OPENSSL_free(p);
return 0;
}
test/property_test.c:232: error: BUFFER_OVERRUN_L3
Offset added: [1, 11] Size: [0, +oo] by call to `ossl_method_store_add`.
Showing all 10 steps of the trace
test/property_test.c:218:9: Array declaration
216. char *impl;
217. } impls[] = {
218. { 6, "position=1", "a" },
^
219. { 6, "position=2", "b" },
220. { 6, "position=3", "c" },
test/property_test.c:232:14: Call
230.
231. for (i = 0; i < OSSL_NELEM(impls); i++)
232. if (!TEST_true(ossl_method_store_add(store, impls[i].nid, impls[i].prop,
^
233. impls[i].impl, NULL))) {
234. TEST_note("iteration %zd", i + 1);
crypto/property/property.c:186:1: Parameter `*properties`
184. }
185.
186. > int ossl_method_store_add(OSSL_METHOD_STORE *store,
187. int nid, const char *properties,
188. void *method, void (*method_destruct)(void *))
crypto/property/property.c:217:9: Call
215. if ((impl->properties = ossl_parse_property(properties)) == NULL)
216. goto err;
217. ossl_prop_defn_set(properties, impl->properties);
^
218. }
219.
crypto/property/defn_cache.c:76:1: <Offset trace>
74. }
75.
76. > int ossl_prop_defn_set(const char *prop, OSSL_PROPERTY_LIST *pl)
77. {
78. PROPERTY_DEFN_ELEM elem, *old, *p = NULL;
crypto/property/defn_cache.c:76:1: Parameter `prop->strlen`
74. }
75.
76. > int ossl_prop_defn_set(const char *prop, OSSL_PROPERTY_LIST *pl)
77. {
78. PROPERTY_DEFN_ELEM elem, *old, *p = NULL;
crypto/property/defn_cache.c:89:5: Assignment
87. return 1;
88. }
89. len = strlen(prop);
^
90. p = OPENSSL_malloc(sizeof(*p) + len);
91. if (p != NULL) {
crypto/property/defn_cache.c:76:1: <Length trace>
74. }
75.
76. > int ossl_prop_defn_set(const char *prop, OSSL_PROPERTY_LIST *pl)
77. {
78. PROPERTY_DEFN_ELEM elem, *old, *p = NULL;
crypto/property/defn_cache.c:76:1: Parameter `*prop`
74. }
75.
76. > int ossl_prop_defn_set(const char *prop, OSSL_PROPERTY_LIST *pl)
77. {
78. PROPERTY_DEFN_ELEM elem, *old, *p = NULL;
crypto/property/defn_cache.c:94:9: Array access: Offset added: [1, 11] Size: [0, +oo] by call to `ossl_method_store_add`
92. p->prop = p->body;
93. p->defn = pl;
94. memcpy(p->body, prop, len + 1);
^
95. old = lh_PROPERTY_DEFN_ELEM_insert(property_defns, p);
96. if (old != NULL) {
| https://github.com/openssl/openssl/blob/4460ad90af0338abe31286f29b36baf2e41abf19/crypto/property/defn_cache.c/#L94 |
d2a_code_trace_data_42408 | static const char *skip_space(const char *s)
{
while (ossl_isspace(*s))
s++;
return s;
}
test/property_test.c:243: error: BUFFER_OVERRUN_L3
Offset: [2, +oo] Size: [1, 11] by call to `ossl_method_store_add`.
Showing all 25 steps of the trace
test/property_test.c:229:9: Array declaration
227. char *impl;
228. } impls[] = {
229. { 6, "position=1", "a" },
^
230. { 6, "position=2", "b" },
231. { 6, "position=3", "c" },
test/property_test.c:243:14: Call
241.
242. for (i = 0; i < OSSL_NELEM(impls); i++)
243. if (!TEST_true(ossl_method_store_add(store, NULL, impls[i].nid,
^
244. impls[i].prop, impls[i].impl,
245. NULL, NULL))) {
crypto/property/property.c:177:1: Parameter `*properties`
175. }
176.
177. > int ossl_method_store_add(OSSL_METHOD_STORE *store, const OSSL_PROVIDER *prov,
178. int nid, const char *properties, void *method,
179. int (*method_up_ref)(void *),
crypto/property/property.c:213:28: Call
211. ossl_method_cache_flush(store, nid);
212. if ((impl->properties = ossl_prop_defn_get(store->ctx, properties)) == NULL) {
213. impl->properties = ossl_parse_property(store->ctx, properties);
^
214. if (impl->properties == NULL)
215. goto err;
crypto/property/property_parse.c:329:1: Parameter `*defn`
327. }
328.
329. > OSSL_PROPERTY_LIST *ossl_parse_property(OPENSSL_CTX *ctx, const char *defn)
330. {
331. PROPERTY_DEFINITION *prop = NULL;
crypto/property/property_parse.c:334:5: Assignment
332. OSSL_PROPERTY_LIST *res = NULL;
333. STACK_OF(PROPERTY_DEFINITION) *sk;
334. const char *s = defn;
^
335. int done;
336.
crypto/property/property_parse.c:340:9: Call
338. return NULL;
339.
340. s = skip_space(s);
^
341. done = *s == '\0';
342. while (!done) {
crypto/property/property_parse.c:52:1: Parameter `*s`
50. DEFINE_STACK_OF(PROPERTY_DEFINITION)
51.
52. > static const char *skip_space(const char *s)
53. {
54. while (ossl_isspace(*s))
crypto/property/property_parse.c:56:5: Assignment
54. while (ossl_isspace(*s))
55. s++;
56. return s;
^
57. }
58.
crypto/property/property_parse.c:340:5: Assignment
338. return NULL;
339.
340. s = skip_space(s);
^
341. done = *s == '\0';
342. while (!done) {
crypto/property/property_parse.c:350:14: Call
348. memset(&prop->v, 0, sizeof(prop->v));
349. prop->optional = 0;
350. if (!parse_name(ctx, &s, 1, &prop->name_idx))
^
351. goto err;
352. prop->oper = PROPERTY_OPER_EQ;
crypto/property/property_parse.c:83:1: Parameter `**t`
81. }
82.
83. > static int parse_name(OPENSSL_CTX *ctx, const char *t[], int create,
84. OSSL_PROPERTY_IDX *idx)
85. {
crypto/property/property_parse.c:358:13: Call
356. goto err;
357. }
358. if (match_ch(&s, '=')) {
^
359. if (!parse_value(ctx, &s, prop, 1)) {
360. ERR_raise_data(ERR_LIB_PROP, PROP_R_NO_VALUE,
crypto/property/property_parse.c:59:1: Parameter `**t`
57. }
58.
59. > static int match_ch(const char *t[], char m)
60. {
61. const char *s = *t;
crypto/property/property_parse.c:359:18: Call
357. }
358. if (match_ch(&s, '=')) {
359. if (!parse_value(ctx, &s, prop, 1)) {
^
360. ERR_raise_data(ERR_LIB_PROP, PROP_R_NO_VALUE,
361. "HERE-->%s", start);
crypto/property/property_parse.c:254:1: Parameter `**t`
252. }
253.
254. > static int parse_value(OPENSSL_CTX *ctx, const char *t[],
255. PROPERTY_DEFINITION *res, int create)
256. {
crypto/property/property_parse.c:257:5: Assignment
255. PROPERTY_DEFINITION *res, int create)
256. {
257. const char *s = *t;
^
258. int r = 0;
259.
crypto/property/property_parse.c:261:9: Assignment
259.
260. if (*s == '"' || *s == '\'') {
261. s++;
^
262. r = parse_string(ctx, &s, s[-1], res, create);
263. } else if (*s == '+') {
crypto/property/property_parse.c:262:13: Call
260. if (*s == '"' || *s == '\'') {
261. s++;
262. r = parse_string(ctx, &s, s[-1], res, create);
^
263. } else if (*s == '+') {
264. s++;
crypto/property/property_parse.c:190:1: Parameter `**t`
188. }
189.
190. > static int parse_string(OPENSSL_CTX *ctx, const char *t[], char delim,
191. PROPERTY_DEFINITION *res, const int create)
192. {
crypto/property/property_parse.c:194:5: Assignment
192. {
193. char v[1000];
194. const char *s = *t;
^
195. size_t i = 0;
196. int err = 0;
crypto/property/property_parse.c:216:10: Call
214. res->v.str_val = ossl_property_value(ctx, v, create);
215. }
216. *t = skip_space(s + 1);
^
217. res->type = PROPERTY_TYPE_STRING;
218. return !err;
crypto/property/property_parse.c:52:1: <Length trace>
50. DEFINE_STACK_OF(PROPERTY_DEFINITION)
51.
52. > static const char *skip_space(const char *s)
53. {
54. while (ossl_isspace(*s))
crypto/property/property_parse.c:52:1: Parameter `*s`
50. DEFINE_STACK_OF(PROPERTY_DEFINITION)
51.
52. > static const char *skip_space(const char *s)
53. {
54. while (ossl_isspace(*s))
crypto/property/property_parse.c:54:12: Array access: Offset: [2, +oo] Size: [1, 11] by call to `ossl_method_store_add`
52. static const char *skip_space(const char *s)
53. {
54. while (ossl_isspace(*s))
^
55. s++;
56. return s;
| https://github.com/openssl/openssl/blob/c1d56231ef6385b557ec72eec508e55ea26ca8b0/crypto/property/property_parse.c/#L54 |
d2a_code_trace_data_42409 | void RAND_add(const void *buf, int num, double randomness)
{
const RAND_METHOD *meth = RAND_get_rand_method();
if (meth->add != NULL)
meth->add(buf, num, randomness);
}
crypto/rand/rand_lib.c:758: error: NULL_DEREFERENCE
pointer `meth` last assigned on line 756 could be null and is dereferenced at line 758, column 9.
Showing all 6 steps of the trace
crypto/rand/rand_lib.c:754:1: start of procedure RAND_add()
752. }
753.
754. > void RAND_add(const void *buf, int num, double randomness)
755. {
756. const RAND_METHOD *meth = RAND_get_rand_method();
crypto/rand/rand_lib.c:756:5:
754. void RAND_add(const void *buf, int num, double randomness)
755. {
756. > const RAND_METHOD *meth = RAND_get_rand_method();
757.
758. if (meth->add != NULL)
crypto/rand/rand_lib.c:686:1: start of procedure RAND_get_rand_method()
684. #endif
685.
686. > const RAND_METHOD *RAND_get_rand_method(void)
687. {
688. #ifdef FIPS_MODE
crypto/rand/rand_lib.c:689:5:
687. {
688. #ifdef FIPS_MODE
689. > return NULL;
690. #else
691. const RAND_METHOD *tmp_meth = NULL;
crypto/rand/rand_lib.c:718:1: return from a call to RAND_get_rand_method
716. return tmp_meth;
717. #endif
718. > }
719.
720. #if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE)
crypto/rand/rand_lib.c:758:9:
756. const RAND_METHOD *meth = RAND_get_rand_method();
757.
758. > if (meth->add != NULL)
759. meth->add(buf, num, randomness);
760. }
| https://github.com/openssl/openssl/blob/2cafb1dff3ef13c470c4d2d7b1d8a1f7142d8813/crypto/rand/rand_lib.c/#L758 |
d2a_code_trace_data_42410 | void bn_correct_top(BIGNUM *a)
{
BN_ULONG *ftl;
int tmp_top = a->top;
if (tmp_top > 0) {
for (ftl = &(a->d[tmp_top]); tmp_top > 0; tmp_top--) {
ftl--;
if (*ftl != 0)
break;
}
a->top = tmp_top;
}
if (a->top == 0)
a->neg = 0;
bn_pollute(a);
}
crypto/rsa/rsa_chk.c:66: error: BUFFER_OVERRUN_L3
Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mul`.
Showing all 16 steps of the trace
crypto/rsa/rsa_chk.c:60:9: Call
58.
59. /* q prime? */
60. if (BN_is_prime_ex(key->q, BN_prime_checks, NULL, cb) != 1) {
^
61. ret = 0;
62. RSAerr(RSA_F_RSA_CHECK_KEY_EX, RSA_R_Q_NOT_PRIME);
crypto/bn/bn_prime.c:197:12: Call
195. BN_GENCB *cb)
196. {
197. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb);
^
198. }
199.
crypto/bn/bn_prime.c:286:13: Call
284. /* now 1 <= check < A */
285.
286. j = witness(check, A, A1, A1_odd, k, ctx, mont);
^
287. if (j == -1)
288. goto err;
crypto/bn/bn_prime.c:389:10: Call
387. BN_MONT_CTX *mont)
388. {
389. if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */
^
390. return -1;
391. if (BN_is_one(w))
crypto/bn/bn_exp.c:357:14: Call
355.
356. if (a->neg || BN_ucmp(a, m) >= 0) {
357. if (!BN_nnmod(val[0], a, m, ctx))
^
358. goto err;
359. aa = val[0];
crypto/bn/bn_mod.c:20:11: Call
18. */
19.
20. if (!(BN_mod(r, m, d, ctx)))
^
21. return 0;
22. if (!r->neg)
crypto/bn/bn_div.c:140:1: Parameter `*dv->d`
138. * If 'dv' or 'rm' is NULL, the respective value is not returned.
139. */
140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
141. BN_CTX *ctx)
142. {
crypto/rsa/rsa_chk.c:66:10: Call
64.
65. /* n = p*q? */
66. if (!BN_mul(i, key->p, key->q, ctx)) {
^
67. ret = -1;
68. goto err;
crypto/bn/bn_mul.c:879:13: Assignment
877. if (bn_wexpand(rr, 16) == NULL)
878. goto err;
879. rr->top = 16;
^
880. bn_mul_comba8(rr->d, a->d, b->d);
881. goto end;
crypto/bn/bn_mul.c:972:5: Call
970. end:
971. #endif
972. bn_correct_top(rr);
^
973. if (r != rr && BN_copy(r, rr) == NULL)
974. goto err;
crypto/bn/bn_lib.c:1021:1: <Offset trace>
1019. }
1020.
1021. > void bn_correct_top(BIGNUM *a)
1022. {
1023. BN_ULONG *ftl;
crypto/bn/bn_lib.c:1021:1: Parameter `a->top`
1019. }
1020.
1021. > void bn_correct_top(BIGNUM *a)
1022. {
1023. BN_ULONG *ftl;
crypto/bn/bn_lib.c:1024:5: Assignment
1022. {
1023. BN_ULONG *ftl;
1024. int tmp_top = a->top;
^
1025.
1026. if (tmp_top > 0) {
crypto/bn/bn_lib.c:1021:1: <Length trace>
1019. }
1020.
1021. > void bn_correct_top(BIGNUM *a)
1022. {
1023. BN_ULONG *ftl;
crypto/bn/bn_lib.c:1021:1: Parameter `*a->d`
1019. }
1020.
1021. > void bn_correct_top(BIGNUM *a)
1022. {
1023. BN_ULONG *ftl;
crypto/bn/bn_lib.c:1027:14: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mul`
1025.
1026. if (tmp_top > 0) {
1027. for (ftl = &(a->d[tmp_top]); tmp_top > 0; tmp_top--) {
^
1028. ftl--;
1029. if (*ftl != 0)
| https://github.com/openssl/openssl/blob/d7c42d71ba407a4b3c26ed58263ae225976bbac3/crypto/bn/bn_lib.c/#L1027 |
d2a_code_trace_data_42411 | static int opt_metadata(const char *opt, const char *arg)
{
char *mid= strchr(arg, '=');
if(!mid){
fprintf(stderr, "Missing =\n");
exit_program(1);
}
*mid++= 0;
av_dict_set(&metadata, arg, mid, 0);
return 0;
}
avconv.c:2525: error: Null Dereference
pointer `mid` last assigned on line 2525 could be null and is dereferenced at line 2525, column 5.
avconv.c:2517:1: start of procedure opt_metadata()
2515. }
2516.
2517. static int opt_metadata(const char *opt, const char *arg)
^
2518. {
2519. char *mid= strchr(arg, '=');
avconv.c:2519:5:
2517. static int opt_metadata(const char *opt, const char *arg)
2518. {
2519. char *mid= strchr(arg, '=');
^
2520.
2521. if(!mid){
avconv.c:2521:9: Taking true branch
2519. char *mid= strchr(arg, '=');
2520.
2521. if(!mid){
^
2522. fprintf(stderr, "Missing =\n");
2523. exit_program(1);
avconv.c:2522:9:
2520.
2521. if(!mid){
2522. fprintf(stderr, "Missing =\n");
^
2523. exit_program(1);
2524. }
avconv.c:2523:9: Skipping exit_program(): empty list of specs
2521. if(!mid){
2522. fprintf(stderr, "Missing =\n");
2523. exit_program(1);
^
2524. }
2525. *mid++= 0;
avconv.c:2525:5:
2523. exit_program(1);
2524. }
2525. *mid++= 0;
^
2526.
2527. av_dict_set(&metadata, arg, mid, 0);
| https://github.com/libav/libav/blob/eb97dbb05a990266b04830ea8e179e0428656b98/avconv.c/#L2525 |
d2a_code_trace_data_42412 | static const char *skip_space(const char *s)
{
while (ossl_isspace(*s))
s++;
return s;
}
test/property_test.c:299: error: BUFFER_OVERRUN_L3
Offset: [2, +oo] Size: [1, 37] by call to `ossl_method_store_add`.
Showing all 25 steps of the trace
test/property_test.c:265:9: Array declaration
263. char *impl;
264. } impls[] = {
265. { 1, "fast=no, colour=green", "a" },
^
266. { 1, "fast, colour=blue", "b" },
267. { 1, "", "-" },
test/property_test.c:299:14: Call
297.
298. for (i = 0; i < OSSL_NELEM(impls); i++)
299. if (!TEST_true(ossl_method_store_add(store, impls[i].nid, impls[i].prop,
^
300. impls[i].impl, NULL))) {
301. TEST_note("iteration %zd", i + 1);
crypto/property/property.c:186:1: Parameter `*properties`
184. }
185.
186. > int ossl_method_store_add(OSSL_METHOD_STORE *store,
187. int nid, const char *properties,
188. void *method, void (*method_destruct)(void *))
crypto/property/property.c:215:33: Call
213. ossl_method_cache_flush(store, nid);
214. if ((impl->properties = ossl_prop_defn_get(properties)) == NULL) {
215. if ((impl->properties = ossl_parse_property(properties)) == NULL)
^
216. goto err;
217. ossl_prop_defn_set(properties, impl->properties);
crypto/property/property_parse.c:315:1: Parameter `*defn`
313. }
314.
315. > OSSL_PROPERTY_LIST *ossl_parse_property(const char *defn)
316. {
317. PROPERTY_DEFINITION *prop = NULL;
crypto/property/property_parse.c:320:5: Assignment
318. OSSL_PROPERTY_LIST *res = NULL;
319. STACK_OF(PROPERTY_DEFINITION) *sk;
320. const char *s = defn;
^
321. int done;
322.
crypto/property/property_parse.c:326:9: Call
324. return NULL;
325.
326. s = skip_space(s);
^
327. done = *s == '\0';
328. while (!done) {
crypto/property/property_parse.c:50:1: Parameter `*s`
48. DEFINE_STACK_OF(PROPERTY_DEFINITION)
49.
50. > static const char *skip_space(const char *s)
51. {
52. while (ossl_isspace(*s))
crypto/property/property_parse.c:54:5: Assignment
52. while (ossl_isspace(*s))
53. s++;
54. return s;
^
55. }
56.
crypto/property/property_parse.c:326:5: Assignment
324. return NULL;
325.
326. s = skip_space(s);
^
327. done = *s == '\0';
328. while (!done) {
crypto/property/property_parse.c:333:14: Call
331. goto err;
332. memset(&prop->v, 0, sizeof(prop->v));
333. if (!parse_name(&s, 1, &prop->name_idx))
^
334. goto err;
335. prop->oper = PROPERTY_OPER_EQ;
crypto/property/property_parse.c:81:1: Parameter `**t`
79. }
80.
81. > static int parse_name(const char *t[], int create, OSSL_PROPERTY_IDX *idx)
82. {
83. char name[100];
crypto/property/property_parse.c:340:13: Call
338. goto err;
339. }
340. if (match_ch(&s, '=')) {
^
341. if (!parse_value(&s, prop, 1)) {
342. PROPerr(PROP_F_OSSL_PARSE_PROPERTY, PROP_R_NO_VALUE);
crypto/property/property_parse.c:57:1: Parameter `**t`
55. }
56.
57. > static int match_ch(const char *t[], char m)
58. {
59. const char *s = *t;
crypto/property/property_parse.c:341:18: Call
339. }
340. if (match_ch(&s, '=')) {
341. if (!parse_value(&s, prop, 1)) {
^
342. PROPerr(PROP_F_OSSL_PARSE_PROPERTY, PROP_R_NO_VALUE);
343. goto err;
crypto/property/property_parse.c:244:1: Parameter `**t`
242. }
243.
244. > static int parse_value(const char *t[], PROPERTY_DEFINITION *res, int create)
245. {
246. const char *s = *t;
crypto/property/property_parse.c:246:5: Assignment
244. static int parse_value(const char *t[], PROPERTY_DEFINITION *res, int create)
245. {
246. const char *s = *t;
^
247. int r = 0;
248.
crypto/property/property_parse.c:250:9: Assignment
248.
249. if (*s == '"' || *s == '\'') {
250. s++;
^
251. r = parse_string(&s, s[-1], res, create);
252. } else if (*s == '+') {
crypto/property/property_parse.c:251:13: Call
249. if (*s == '"' || *s == '\'') {
250. s++;
251. r = parse_string(&s, s[-1], res, create);
^
252. } else if (*s == '+') {
253. s++;
crypto/property/property_parse.c:183:1: Parameter `**t`
181. }
182.
183. > static int parse_string(const char *t[], char delim, PROPERTY_DEFINITION *res,
184. const int create)
185. {
crypto/property/property_parse.c:187:5: Assignment
185. {
186. char v[1000];
187. const char *s = *t;
^
188. size_t i = 0;
189. int err = 0;
crypto/property/property_parse.c:204:10: Call
202. }
203. v[i] = '\0';
204. *t = skip_space(s + 1);
^
205. if (err)
206. PROPerr(PROP_F_PARSE_STRING, PROP_R_STRING_TOO_LONG);
crypto/property/property_parse.c:50:1: <Length trace>
48. DEFINE_STACK_OF(PROPERTY_DEFINITION)
49.
50. > static const char *skip_space(const char *s)
51. {
52. while (ossl_isspace(*s))
crypto/property/property_parse.c:50:1: Parameter `*s`
48. DEFINE_STACK_OF(PROPERTY_DEFINITION)
49.
50. > static const char *skip_space(const char *s)
51. {
52. while (ossl_isspace(*s))
crypto/property/property_parse.c:52:12: Array access: Offset: [2, +oo] Size: [1, 37] by call to `ossl_method_store_add`
50. static const char *skip_space(const char *s)
51. {
52. while (ossl_isspace(*s))
^
53. s++;
54. return s;
| https://github.com/openssl/openssl/blob/4460ad90af0338abe31286f29b36baf2e41abf19/crypto/property/property_parse.c/#L52 |
d2a_code_trace_data_42413 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/srp/srp_lib.c:191: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_exp`.
Showing all 31 steps of the trace
crypto/srp/srp_lib.c:191:10: Call
189. goto err;
190.
191. if (!BN_mod_exp(tmp, g, x, N, bn_ctx))
^
192. goto err;
193. if ((k = srp_Calc_k(N, g)) == NULL)
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_42414 | 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/statem_srvr.c:2523: error: INTEGER_OVERFLOW_L2
([0, +oo] - [`pkt->written`, `pkt->written` + 1]):unsigned64 by call to `ssl3_get_req_cert_type`.
Showing all 14 steps of the trace
ssl/statem/statem_srvr.c:2522:10: Call
2520.
2521. /* get the list of acceptable cert types */
2522. if (!WPACKET_start_sub_packet_u8(pkt)
^
2523. || !ssl3_get_req_cert_type(s, pkt) || !WPACKET_close(pkt)) {
2524. SSLerr(SSL_F_TLS_CONSTRUCT_CERTIFICATE_REQUEST, ERR_R_INTERNAL_ERROR);
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/statem_srvr.c:2523:13: Call
2521. /* get the list of acceptable cert types */
2522. if (!WPACKET_start_sub_packet_u8(pkt)
2523. || !ssl3_get_req_cert_type(s, pkt) || !WPACKET_close(pkt)) {
^
2524. SSLerr(SSL_F_TLS_CONSTRUCT_CERTIFICATE_REQUEST, ERR_R_INTERNAL_ERROR);
2525. goto err;
ssl/s3_lib.c:3774:1: Parameter `pkt->written`
3772. }
3773.
3774. > int ssl3_get_req_cert_type(SSL *s, WPACKET *pkt)
3775. {
3776. uint32_t alg_k, alg_a = 0;
ssl/s3_lib.c:3780:16: Call
3778. /* If we have custom certificate types set, use them */
3779. if (s->cert->ctype)
3780. return WPACKET_memcpy(pkt, s->cert->ctype, s->cert->ctype_len);
^
3781. /* Get mask of algorithms disabled by signature list */
3782. ssl_set_sig_mask(&alg_a, s, SSL_SECOP_SIGALG_MASK);
ssl/packet.c:353:1: Parameter `pkt->written`
351. }
352.
353. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len)
354. {
355. unsigned char *dest;
ssl/packet.c:360:10: Call
358. return 1;
359.
360. if (!WPACKET_allocate_bytes(pkt, len, &dest))
^
361. return 0;
362.
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 + 1]):unsigned64 by call to `ssl3_get_req_cert_type`
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_42415 | void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
{
unsigned long hash;
OPENSSL_LH_NODE *nn, **rn;
void *ret;
lh->error = 0;
rn = getrn(lh, data, &hash);
if (*rn == NULL) {
lh->num_no_delete++;
return (NULL);
} else {
nn = *rn;
*rn = nn->next;
ret = nn->data;
OPENSSL_free(nn);
lh->num_delete++;
}
lh->num_items--;
if ((lh->num_nodes > MIN_NODES) &&
(lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
contract(lh);
return (ret);
}
ssl/ssl_lib.c:3149: error: INTEGER_OVERFLOW_L2
([0, max(0, `s->ctx->sessions->num_items`)] - 1):unsigned64 by call to `SSL_free`.
Showing all 17 steps of the trace
ssl/ssl_lib.c:3029:1: Parameter `s->ctx->sessions->num_items`
3027. }
3028.
3029. > SSL *SSL_dup(SSL *s)
3030. {
3031. STACK_OF(X509_NAME) *sk;
ssl/ssl_lib.c:3045:16: Call
3043. * Otherwise, copy configuration state, and session if set.
3044. */
3045. if ((ret = SSL_new(SSL_get_SSL_CTX(s))) == NULL)
^
3046. return (NULL);
3047.
ssl/ssl_lib.c:518:1: Parameter `ctx->sessions->num_items`
516. }
517.
518. > SSL *SSL_new(SSL_CTX *ctx)
519. {
520. SSL *s;
ssl/ssl_lib.c:3149:5: Call
3147.
3148. err:
3149. SSL_free(ret);
^
3150. return NULL;
3151. }
ssl/ssl_lib.c:926:1: Parameter `s->initial_ctx->sessions->num_items`
924. }
925.
926. > void SSL_free(SSL *s)
927. {
928. int i;
ssl/ssl_lib.c:963:9: Call
961. /* Make the next call work :-) */
962. if (s->session != NULL) {
963. ssl_clear_bad_session(s);
^
964. SSL_SESSION_free(s->session);
965. }
ssl/ssl_sess.c:992:1: Parameter `s->initial_ctx->sessions->num_items`
990. }
991.
992. > int ssl_clear_bad_session(SSL *s)
993. {
994. if ((s->session != NULL) &&
ssl/ssl_sess.c:997:9: Call
995. !(s->shutdown & SSL_SENT_SHUTDOWN) &&
996. !(SSL_in_init(s) || SSL_in_before(s))) {
997. SSL_CTX_remove_session(s->session_ctx, s->session);
^
998. return (1);
999. } else
ssl/ssl_sess.c:691:1: Parameter `ctx->sessions->num_items`
689. }
690.
691. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
692. {
693. return remove_session_lock(ctx, c, 1);
ssl/ssl_sess.c:693:12: Call
691. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
692. {
693. return remove_session_lock(ctx, c, 1);
^
694. }
695.
ssl/ssl_sess.c:696:1: Parameter `ctx->sessions->num_items`
694. }
695.
696. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
697. {
698. SSL_SESSION *r;
ssl/ssl_sess.c:706:17: Call
704. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) {
705. ret = 1;
706. r = lh_SSL_SESSION_delete(ctx->sessions, c);
^
707. SSL_SESSION_list_remove(ctx, c);
708. }
ssl/ssl_locl.h:581:1: Parameter `lh->num_items`
579. };
580.
581. > DEFINE_LHASH_OF(SSL_SESSION);
582. /* Needed in ssl_cert.c */
583. DEFINE_LHASH_OF(X509_NAME);
ssl/ssl_locl.h:581:1: Call
579. };
580.
581. > DEFINE_LHASH_OF(SSL_SESSION);
582. /* Needed in ssl_cert.c */
583. DEFINE_LHASH_OF(X509_NAME);
crypto/lhash/lhash.c:103:1: <LHS trace>
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:103:1: Parameter `lh->num_items`
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:123:5: Binary operation: ([0, max(0, s->ctx->sessions->num_items)] - 1):unsigned64 by call to `SSL_free`
121. }
122.
123. lh->num_items--;
^
124. if ((lh->num_nodes > MIN_NODES) &&
125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
| https://github.com/openssl/openssl/blob/2a7de0fd5d9baf946ef4d2c51096b04dd47a8143/crypto/lhash/lhash.c/#L123 |
d2a_code_trace_data_42416 | int ossl_prop_defn_set(OPENSSL_CTX *ctx, const char *prop,
OSSL_PROPERTY_LIST *pl)
{
PROPERTY_DEFN_ELEM elem, *old, *p = NULL;
size_t len;
LHASH_OF(PROPERTY_DEFN_ELEM) *property_defns;
property_defns = openssl_ctx_get_data(ctx, OPENSSL_CTX_PROPERTY_DEFN_INDEX,
&property_defns_method);
if (property_defns == NULL)
return 0;
if (prop == NULL)
return 1;
if (pl == NULL) {
elem.prop = prop;
lh_PROPERTY_DEFN_ELEM_delete(property_defns, &elem);
return 1;
}
len = strlen(prop);
p = OPENSSL_malloc(sizeof(*p) + len);
if (p != NULL) {
p->prop = p->body;
p->defn = pl;
memcpy(p->body, prop, len + 1);
old = lh_PROPERTY_DEFN_ELEM_insert(property_defns, p);
if (old != NULL) {
property_defn_free(old);
return 1;
}
if (!lh_PROPERTY_DEFN_ELEM_error(property_defns))
return 1;
}
OPENSSL_free(p);
return 0;
}
test/property_test.c:299: error: BUFFER_OVERRUN_L3
Offset added: [1, 37] Size: [0, +oo] by call to `ossl_method_store_add`.
Showing all 10 steps of the trace
test/property_test.c:265:9: Array declaration
263. char *impl;
264. } impls[] = {
265. { 1, "fast=no, colour=green", "a" },
^
266. { 1, "fast, colour=blue", "b" },
267. { 1, "", "-" },
test/property_test.c:299:14: Call
297.
298. for (i = 0; i < OSSL_NELEM(impls); i++)
299. if (!TEST_true(ossl_method_store_add(store, impls[i].nid, impls[i].prop,
^
300. impls[i].impl, NULL))) {
301. TEST_note("iteration %zd", i + 1);
crypto/property/property.c:176:1: Parameter `*properties`
174. }
175.
176. > int ossl_method_store_add(OSSL_METHOD_STORE *store,
177. int nid, const char *properties,
178. void *method, void (*method_destruct)(void *))
crypto/property/property.c:208:9: Call
206. if (impl->properties == NULL)
207. goto err;
208. ossl_prop_defn_set(store->ctx, properties, impl->properties);
^
209. }
210.
crypto/property/defn_cache.c:84:1: <Offset trace>
82. }
83.
84. > int ossl_prop_defn_set(OPENSSL_CTX *ctx, const char *prop,
85. OSSL_PROPERTY_LIST *pl)
86. {
crypto/property/defn_cache.c:84:1: Parameter `prop->strlen`
82. }
83.
84. > int ossl_prop_defn_set(OPENSSL_CTX *ctx, const char *prop,
85. OSSL_PROPERTY_LIST *pl)
86. {
crypto/property/defn_cache.c:104:5: Assignment
102. return 1;
103. }
104. len = strlen(prop);
^
105. p = OPENSSL_malloc(sizeof(*p) + len);
106. if (p != NULL) {
crypto/property/defn_cache.c:84:1: <Length trace>
82. }
83.
84. > int ossl_prop_defn_set(OPENSSL_CTX *ctx, const char *prop,
85. OSSL_PROPERTY_LIST *pl)
86. {
crypto/property/defn_cache.c:84:1: Parameter `*prop`
82. }
83.
84. > int ossl_prop_defn_set(OPENSSL_CTX *ctx, const char *prop,
85. OSSL_PROPERTY_LIST *pl)
86. {
crypto/property/defn_cache.c:109:9: Array access: Offset added: [1, 37] Size: [0, +oo] by call to `ossl_method_store_add`
107. p->prop = p->body;
108. p->defn = pl;
109. memcpy(p->body, prop, len + 1);
^
110. old = lh_PROPERTY_DEFN_ELEM_insert(property_defns, p);
111. if (old != NULL) {
| https://github.com/openssl/openssl/blob/260a16f33682a819414fcba6161708a5e6bdff50/crypto/property/defn_cache.c/#L109 |
d2a_code_trace_data_42417 | 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/ecdsatest.c:144: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_dec2bn`.
Showing all 19 steps of the trace
test/ecdsatest.c:127:10: Call
125.
126. /* create the key */
127. if (!TEST_ptr(key = EC_KEY_new_by_curve_name(nid)))
^
128. goto x962_int_err;
129. use_fake = 1;
crypto/ec/ec_key.c:25:19: Call
23. EC_KEY *EC_KEY_new_by_curve_name(int nid)
24. {
25. EC_KEY *ret = EC_KEY_new();
^
26. if (ret == NULL)
27. return NULL;
crypto/ec/ec_key.c:20:12: Call
18. EC_KEY *EC_KEY_new(void)
19. {
20. return EC_KEY_new_method(NULL);
^
21. }
22.
crypto/ec/ec_kmeth.c:123:5: Call
121.
122. err:
123. EC_KEY_free(ret);
^
124. return NULL;
125. }
crypto/ec/ec_key.c:41:1: Parameter `r->priv_key->d`
39. }
40.
41. > void EC_KEY_free(EC_KEY *r)
42. {
43. int i;
test/ecdsatest.c:144:10: Call
142. if (!TEST_ptr(r = BN_new()) || !TEST_ptr(s = BN_new()))
143. goto x962_int_err;
144. if (!TEST_true(BN_dec2bn(&r, r_in)) || !TEST_true(BN_dec2bn(&s, s_in)))
^
145. goto x962_int_err;
146. ECDSA_SIG_get0(signature, &sig_r, &sig_s);
crypto/bn/bn_print.c:199:1: Parameter `*(*bn)->d`
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:359:1: Parameter `*a->d`
357. }
358.
359. > int BN_set_word(BIGNUM *a, BN_ULONG w)
360. {
361. bn_check_top(a);
crypto/bn/bn_lib.c:362:9: Call
360. {
361. bn_check_top(a);
362. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
363. return 0;
364. a->neg = 0;
crypto/bn/bn_lcl.h:660:1: Parameter `*a->d`
658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
659.
660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
661. {
662. if (bits > (INT_MAX - BN_BITS2 + 1))
crypto/bn/bn_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_dec2bn`
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/2eb2b4f3a12d0b8807447913a3b16f21104c701b/crypto/bn/bn_lib.c/#L232 |
d2a_code_trace_data_42418 | ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone)
{
ASN1_INTEGER *izone;
ASN1_OCTET_STRING *oct;
if ((izone = ASN1_INTEGER_new()) == NULL
|| !ASN1_INTEGER_set(izone, lzone)) {
X509V3err(X509V3_F_SXNET_GET_ID_ULONG, ERR_R_MALLOC_FAILURE);
ASN1_INTEGER_free(izone);
return NULL;
}
oct = SXNET_get_id_INTEGER(sx, izone);
ASN1_INTEGER_free(izone);
return oct;
}
crypto/x509v3/v3_sxnet.c:262: error: MEMORY_LEAK
memory dynamically allocated by call to `ASN1_INTEGER_new()` at line 255, column 18 is not reachable after line 262, column 5.
Showing all 90 steps of the trace
crypto/x509v3/v3_sxnet.c:250:1: start of procedure SXNET_get_id_ulong()
248. }
249.
250. > ASN1_OCTET_STRING *SXNET_get_id_ulong(SXNET *sx, unsigned long lzone)
251. {
252. ASN1_INTEGER *izone;
crypto/x509v3/v3_sxnet.c:255:9:
253. ASN1_OCTET_STRING *oct;
254.
255. > if ((izone = ASN1_INTEGER_new()) == NULL
256. || !ASN1_INTEGER_set(izone, lzone)) {
257. X509V3err(X509V3_F_SXNET_GET_ID_ULONG, ERR_R_MALLOC_FAILURE);
crypto/asn1/tasn_typ.c:78:1: start of procedure ASN1_INTEGER_new()
76.
77. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
78. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
79. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)
80. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_BIT_STRING)
crypto/asn1/asn1_lib.c:349:1: start of procedure ASN1_STRING_type_new()
347. }
348.
349. > ASN1_STRING *ASN1_STRING_type_new(int type)
350. {
351. ASN1_STRING *ret;
crypto/asn1/asn1_lib.c:353:5:
351. ASN1_STRING *ret;
352.
353. > ret = OPENSSL_zalloc(sizeof(*ret));
354. if (ret == NULL) {
355. ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);
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/asn1/asn1_lib.c:354:9: Taking false branch
352.
353. ret = OPENSSL_zalloc(sizeof(*ret));
354. if (ret == NULL) {
^
355. ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);
356. return (NULL);
crypto/asn1/asn1_lib.c:358:5:
356. return (NULL);
357. }
358. > ret->type = type;
359. return (ret);
360. }
crypto/asn1/asn1_lib.c:359:5:
357. }
358. ret->type = type;
359. > return (ret);
360. }
361.
crypto/asn1/asn1_lib.c:360:1: return from a call to ASN1_STRING_type_new
358. ret->type = type;
359. return (ret);
360. > }
361.
362. void ASN1_STRING_free(ASN1_STRING *a)
crypto/asn1/tasn_typ.c:78:1: return from a call to ASN1_INTEGER_new
76.
77. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
78. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
79. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)
80. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_BIT_STRING)
crypto/x509v3/v3_sxnet.c:255:9: Taking false branch
253. ASN1_OCTET_STRING *oct;
254.
255. if ((izone = ASN1_INTEGER_new()) == NULL
^
256. || !ASN1_INTEGER_set(izone, lzone)) {
257. X509V3err(X509V3_F_SXNET_GET_ID_ULONG, ERR_R_MALLOC_FAILURE);
crypto/x509v3/v3_sxnet.c:256:13:
254.
255. if ((izone = ASN1_INTEGER_new()) == NULL
256. > || !ASN1_INTEGER_set(izone, lzone)) {
257. X509V3err(X509V3_F_SXNET_GET_ID_ULONG, ERR_R_MALLOC_FAILURE);
258. ASN1_INTEGER_free(izone);
crypto/asn1/a_int.c:603:1: start of procedure ASN1_INTEGER_set()
601. }
602.
603. > int ASN1_INTEGER_set(ASN1_INTEGER *a, long v)
604. {
605. return ASN1_INTEGER_set_int64(a, v);
crypto/asn1/a_int.c:605:5:
603. int ASN1_INTEGER_set(ASN1_INTEGER *a, long v)
604. {
605. > return ASN1_INTEGER_set_int64(a, v);
606. }
607.
crypto/asn1/a_int.c:588:1: start of procedure ASN1_INTEGER_set_int64()
586. }
587.
588. > int ASN1_INTEGER_set_int64(ASN1_INTEGER *a, int64_t r)
589. {
590. return asn1_string_set_int64(a, r, V_ASN1_INTEGER);
crypto/asn1/a_int.c:590:5:
588. int ASN1_INTEGER_set_int64(ASN1_INTEGER *a, int64_t r)
589. {
590. > return asn1_string_set_int64(a, r, V_ASN1_INTEGER);
591. }
592.
crypto/asn1/a_int.c:405:1: start of procedure asn1_string_set_int64()
403. }
404.
405. > static int asn1_string_set_int64(ASN1_STRING *a, int64_t r, int itype)
406. {
407. unsigned char tbuf[sizeof(r)];
crypto/asn1/a_int.c:409:5:
407. unsigned char tbuf[sizeof(r)];
408. size_t l;
409. > a->type = itype;
410. if (r < 0) {
411. l = asn1_put_uint64(tbuf, -r);
crypto/asn1/a_int.c:410:9: Taking false branch
408. size_t l;
409. a->type = itype;
410. if (r < 0) {
^
411. l = asn1_put_uint64(tbuf, -r);
412. a->type |= V_ASN1_NEG;
crypto/asn1/a_int.c:414:9:
412. a->type |= V_ASN1_NEG;
413. } else {
414. > l = asn1_put_uint64(tbuf, r);
415. a->type &= ~V_ASN1_NEG;
416. }
crypto/asn1/a_int.c:292:1: start of procedure asn1_put_uint64()
290. }
291.
292. > static size_t asn1_put_uint64(unsigned char *b, uint64_t r)
293. {
294. if (r >= 0x100) {
crypto/asn1/a_int.c:294:9: Taking false branch
292. static size_t asn1_put_uint64(unsigned char *b, uint64_t r)
293. {
294. if (r >= 0x100) {
^
295. unsigned char *p;
296. uint64_t rtmp = r;
crypto/asn1/a_int.c:316:5:
314. }
315.
316. > b[0] = (unsigned char)r;
317. return 1;
318.
crypto/asn1/a_int.c:317:5:
315.
316. b[0] = (unsigned char)r;
317. > return 1;
318.
319. }
crypto/asn1/a_int.c:319:1: return from a call to asn1_put_uint64
317. return 1;
318.
319. > }
320.
321. /*
crypto/asn1/a_int.c:415:9:
413. } else {
414. l = asn1_put_uint64(tbuf, r);
415. > a->type &= ~V_ASN1_NEG;
416. }
417. if (l == 0)
crypto/asn1/a_int.c:417:9: Taking false branch
415. a->type &= ~V_ASN1_NEG;
416. }
417. if (l == 0)
^
418. return 0;
419. return ASN1_STRING_set(a, tbuf, l);
crypto/asn1/a_int.c:419:5:
417. if (l == 0)
418. return 0;
419. > return ASN1_STRING_set(a, tbuf, l);
420. }
421.
crypto/asn1/asn1_lib.c:308:1: start of procedure ASN1_STRING_set()
306. }
307.
308. > int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len)
309. {
310. unsigned char *c;
crypto/asn1/asn1_lib.c:311:5:
309. {
310. unsigned char *c;
311. > const char *data = _data;
312.
313. if (len < 0) {
crypto/asn1/asn1_lib.c:313:9: Taking false branch
311. const char *data = _data;
312.
313. if (len < 0) {
^
314. if (data == NULL)
315. return (0);
crypto/asn1/asn1_lib.c:319:10: Taking true branch
317. len = strlen(data);
318. }
319. if ((str->length < len) || (str->data == NULL)) {
^
320. c = str->data;
321. str->data = OPENSSL_realloc(c, len + 1);
crypto/asn1/asn1_lib.c:320:9:
318. }
319. if ((str->length < len) || (str->data == NULL)) {
320. > c = str->data;
321. str->data = OPENSSL_realloc(c, len + 1);
322. if (str->data == NULL) {
crypto/asn1/asn1_lib.c:321:9:
319. if ((str->length < len) || (str->data == NULL)) {
320. c = str->data;
321. > str->data = OPENSSL_realloc(c, len + 1);
322. if (str->data == NULL) {
323. ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE);
crypto/mem.c:166:1: start of procedure CRYPTO_realloc()
164. }
165.
166. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
167. {
168. if (str == NULL)
crypto/mem.c:168:9: Taking false branch
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
167. {
168. if (str == NULL)
^
169. return CRYPTO_malloc(num, file, line);
170.
crypto/mem.c:171:9: Taking false branch
169. return CRYPTO_malloc(num, file, line);
170.
171. if (num == 0) {
^
172. CRYPTO_free(str);
173. return NULL;
crypto/mem.c:176:5:
174. }
175.
176. > allow_customize = 0;
177. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
178. if (call_malloc_debug) {
crypto/mem.c:186:5:
184. }
185. #else
186. > (void)file;
187. (void)line;
188. #endif
crypto/mem.c:187:5:
185. #else
186. (void)file;
187. > (void)line;
188. #endif
189. return realloc(str, num);
crypto/mem.c:189:5:
187. (void)line;
188. #endif
189. > return realloc(str, num);
190.
191. }
crypto/mem.c:191:1: return from a call to CRYPTO_realloc
189. return realloc(str, num);
190.
191. > }
192.
193. void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,
crypto/asn1/asn1_lib.c:322:13: Taking false branch
320. c = str->data;
321. str->data = OPENSSL_realloc(c, len + 1);
322. if (str->data == NULL) {
^
323. ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE);
324. str->data = c;
crypto/asn1/asn1_lib.c:328:5:
326. }
327. }
328. > str->length = len;
329. if (data != NULL) {
330. memcpy(str->data, data, len);
crypto/asn1/asn1_lib.c:329:9: Taking true branch
327. }
328. str->length = len;
329. if (data != NULL) {
^
330. memcpy(str->data, data, len);
331. /* an allowance for strings :-) */
crypto/asn1/asn1_lib.c:330:9:
328. str->length = len;
329. if (data != NULL) {
330. > memcpy(str->data, data, len);
331. /* an allowance for strings :-) */
332. str->data[len] = '\0';
crypto/asn1/asn1_lib.c:332:9:
330. memcpy(str->data, data, len);
331. /* an allowance for strings :-) */
332. > str->data[len] = '\0';
333. }
334. return (1);
crypto/asn1/asn1_lib.c:334:5:
332. str->data[len] = '\0';
333. }
334. > return (1);
335. }
336.
crypto/asn1/asn1_lib.c:335:1: return from a call to ASN1_STRING_set
333. }
334. return (1);
335. > }
336.
337. void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len)
crypto/asn1/a_int.c:420:1: return from a call to asn1_string_set_int64
418. return 0;
419. return ASN1_STRING_set(a, tbuf, l);
420. > }
421.
422. static int asn1_string_get_uint64(uint64_t *pr, const ASN1_STRING *a,
crypto/asn1/a_int.c:591:1: return from a call to ASN1_INTEGER_set_int64
589. {
590. return asn1_string_set_int64(a, r, V_ASN1_INTEGER);
591. > }
592.
593. int ASN1_INTEGER_get_uint64(uint64_t *pr, const ASN1_INTEGER *a)
crypto/asn1/a_int.c:606:1: return from a call to ASN1_INTEGER_set
604. {
605. return ASN1_INTEGER_set_int64(a, v);
606. > }
607.
608. long ASN1_INTEGER_get(const ASN1_INTEGER *a)
crypto/x509v3/v3_sxnet.c:256:13: Taking false branch
254.
255. if ((izone = ASN1_INTEGER_new()) == NULL
256. || !ASN1_INTEGER_set(izone, lzone)) {
^
257. X509V3err(X509V3_F_SXNET_GET_ID_ULONG, ERR_R_MALLOC_FAILURE);
258. ASN1_INTEGER_free(izone);
crypto/x509v3/v3_sxnet.c:261:5:
259. return NULL;
260. }
261. > oct = SXNET_get_id_INTEGER(sx, izone);
262. ASN1_INTEGER_free(izone);
263. return oct;
crypto/x509v3/v3_sxnet.c:266:1: start of procedure SXNET_get_id_INTEGER()
264. }
265.
266. > ASN1_OCTET_STRING *SXNET_get_id_INTEGER(SXNET *sx, ASN1_INTEGER *zone)
267. {
268. SXNETID *id;
crypto/x509v3/v3_sxnet.c:270:10:
268. SXNETID *id;
269. int i;
270. > for (i = 0; i < sk_SXNETID_num(sx->ids); i++) {
271. id = sk_SXNETID_value(sx->ids, i);
272. if (!ASN1_INTEGER_cmp(id->zone, zone))
crypto/x509v3/v3_sxnet.c:270:17:
268. SXNETID *id;
269. int i;
270. > for (i = 0; i < sk_SXNETID_num(sx->ids); i++) {
271. id = sk_SXNETID_value(sx->ids, i);
272. if (!ASN1_INTEGER_cmp(id->zone, zone))
include/openssl/x509v3.h:274:1: start of procedure sk_SXNETID_num()
272. } SXNETID;
273.
274. > DEFINE_STACK_OF(SXNETID)
275.
276. typedef struct SXNET_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/x509v3.h:274:1: return from a call to sk_SXNETID_num
272. } SXNETID;
273.
274. > DEFINE_STACK_OF(SXNETID)
275.
276. typedef struct SXNET_st {
crypto/x509v3/v3_sxnet.c:270:17: Loop condition is false. Leaving loop
268. SXNETID *id;
269. int i;
270. for (i = 0; i < sk_SXNETID_num(sx->ids); i++) {
^
271. id = sk_SXNETID_value(sx->ids, i);
272. if (!ASN1_INTEGER_cmp(id->zone, zone))
crypto/x509v3/v3_sxnet.c:275:5:
273. return id->user;
274. }
275. > return NULL;
276. }
crypto/x509v3/v3_sxnet.c:276:1: return from a call to SXNET_get_id_INTEGER
274. }
275. return NULL;
276. > }
crypto/x509v3/v3_sxnet.c:262:5:
260. }
261. oct = SXNET_get_id_INTEGER(sx, izone);
262. > ASN1_INTEGER_free(izone);
263. return oct;
264. }
crypto/asn1/tasn_typ.c:78:1: start of procedure ASN1_INTEGER_free()
76.
77. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
78. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
79. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)
80. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_BIT_STRING)
crypto/asn1/asn1_lib.c:362:1: start of procedure ASN1_STRING_free()
360. }
361.
362. > void ASN1_STRING_free(ASN1_STRING *a)
363. {
364. if (a == NULL)
crypto/asn1/asn1_lib.c:364:9: Taking false branch
362. void ASN1_STRING_free(ASN1_STRING *a)
363. {
364. if (a == NULL)
^
365. return;
366. if (!(a->flags & ASN1_STRING_FLAG_NDEF))
crypto/asn1/asn1_lib.c:366:11: Taking false branch
364. if (a == NULL)
365. return;
366. if (!(a->flags & ASN1_STRING_FLAG_NDEF))
^
367. OPENSSL_free(a->data);
368. if (!(a->flags & ASN1_STRING_FLAG_EMBED))
crypto/asn1/asn1_lib.c:368:11: Taking false branch
366. if (!(a->flags & ASN1_STRING_FLAG_NDEF))
367. OPENSSL_free(a->data);
368. if (!(a->flags & ASN1_STRING_FLAG_EMBED))
^
369. OPENSSL_free(a);
370. }
crypto/asn1/asn1_lib.c:368:5:
366. if (!(a->flags & ASN1_STRING_FLAG_NDEF))
367. OPENSSL_free(a->data);
368. > if (!(a->flags & ASN1_STRING_FLAG_EMBED))
369. OPENSSL_free(a);
370. }
crypto/asn1/asn1_lib.c:370:1: return from a call to ASN1_STRING_free
368. if (!(a->flags & ASN1_STRING_FLAG_EMBED))
369. OPENSSL_free(a);
370. > }
371.
372. void ASN1_STRING_clear_free(ASN1_STRING *a)
crypto/asn1/tasn_typ.c:78:1: return from a call to ASN1_INTEGER_free
76.
77. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
78. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
79. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)
80. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_BIT_STRING)
| https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/x509v3/v3_sxnet.c/#L262 |
d2a_code_trace_data_42419 | BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
{
bn_check_top(b);
if (a == b)
return a;
if (bn_wexpand(a, b->top) == NULL)
return NULL;
if (b->top > 0)
memcpy(a->d, b->d, sizeof(b->d[0]) * b->top);
a->top = b->top;
a->neg = b->neg;
bn_check_top(a);
return a;
}
crypto/bn/bn_print.c:78: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_dup`.
Showing all 14 steps of the trace
crypto/bn/bn_print.c:53:1: Parameter `a->top`
51.
52. /* Must 'OPENSSL_free' the returned data */
53. > char *BN_bn2dec(const BIGNUM *a)
54. {
55. int i = 0, num, ok = 0, n, tbytes;
crypto/bn/bn_print.c:68:9: Call
66. * <= 3 * BN_num_bits(a) / 10 + 3 * BN_num_bits / 1000 + 1 + 1
67. */
68. i = BN_num_bits(a) * 3;
^
69. num = (i / 10 + i / 1000 + 1) + 1;
70. tbytes = num + 3; /* negative and terminator and one spare? */
crypto/bn/bn_lib.c:166:9: Call
164. bn_check_top(a);
165.
166. if (BN_is_zero(a))
^
167. return 0;
168. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
crypto/bn/bn_lib.c:852:1: Parameter `a->top`
850. }
851.
852. > int BN_is_zero(const BIGNUM *a)
853. {
854. return a->top == 0;
crypto/bn/bn_print.c:78:14: Call
76. goto err;
77. }
78. if ((t = BN_dup(a)) == NULL)
^
79. goto err;
80.
crypto/bn/bn_lib.c:304:1: Parameter `a->top`
302. }
303.
304. > BIGNUM *BN_dup(const BIGNUM *a)
305. {
306. BIGNUM *t;
crypto/bn/bn_lib.c:315:10: Call
313. if (t == NULL)
314. return NULL;
315. if (!BN_copy(t, a)) {
^
316. BN_free(t);
317. return NULL;
crypto/bn/bn_lib.c:323:1: <Offset trace>
321. }
322.
323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
324. {
325. bn_check_top(b);
crypto/bn/bn_lib.c:323:1: Parameter `b->top`
321. }
322.
323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
324. {
325. bn_check_top(b);
crypto/bn/bn_lib.c:323:1: <Length trace>
321. }
322.
323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
324. {
325. bn_check_top(b);
crypto/bn/bn_lib.c:323:1: Parameter `*a->d`
321. }
322.
323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
324. {
325. bn_check_top(b);
crypto/bn/bn_lib.c:329:9: Call
327. if (a == b)
328. return a;
329. if (bn_wexpand(a, b->top) == NULL)
^
330. return NULL;
331.
crypto/bn/bn_lib.c:948:1: Parameter `*a->d`
946. }
947.
948. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
949. {
950. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_lib.c:333:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_dup`
331.
332. if (b->top > 0)
333. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top);
^
334.
335. a->top = b->top;
| https://github.com/openssl/openssl/blob/de2f409ef9de775df6db2c7de69b7bb0df21e380/crypto/bn/bn_lib.c/#L333 |
d2a_code_trace_data_42420 | OCSP_RESPONSE *process_responder(OCSP_REQUEST *req,
const char *host, const char *path,
const char *port, int use_ssl,
STACK_OF(CONF_VALUE) *headers,
int req_timeout)
{
BIO *cbio = NULL;
SSL_CTX *ctx = NULL;
OCSP_RESPONSE *resp = NULL;
cbio = BIO_new_connect(host);
if (cbio == NULL) {
BIO_printf(bio_err, "Error creating connect BIO\n");
goto end;
}
if (port != NULL)
BIO_set_conn_port(cbio, port);
if (use_ssl == 1) {
BIO *sbio;
ctx = SSL_CTX_new(TLS_client_method());
if (ctx == NULL) {
BIO_printf(bio_err, "Error creating SSL context.\n");
goto end;
}
SSL_CTX_set_mode(ctx, SSL_MODE_AUTO_RETRY);
sbio = BIO_new_ssl(ctx, 1);
cbio = BIO_push(sbio, cbio);
}
resp = query_responder(cbio, host, path, headers, req, req_timeout);
if (resp == NULL)
BIO_printf(bio_err, "Error querying OCSP responder\n");
end:
BIO_free_all(cbio);
SSL_CTX_free(ctx);
return resp;
}
apps/ocsp.c:1643: error: NULL_DEREFERENCE
pointer `ctx` last assigned on line 1616 could be null and is dereferenced by call to `SSL_CTX_free()` at line 1643, column 5.
Showing all 133 steps of the trace
apps/ocsp.c:1609:1: start of procedure process_responder()
1607. }
1608.
1609. > OCSP_RESPONSE *process_responder(OCSP_REQUEST *req,
1610. const char *host, const char *path,
1611. const char *port, int use_ssl,
apps/ocsp.c:1615:5:
1613. int req_timeout)
1614. {
1615. > BIO *cbio = NULL;
1616. SSL_CTX *ctx = NULL;
1617. OCSP_RESPONSE *resp = NULL;
apps/ocsp.c:1616:5:
1614. {
1615. BIO *cbio = NULL;
1616. > SSL_CTX *ctx = NULL;
1617. OCSP_RESPONSE *resp = NULL;
1618.
apps/ocsp.c:1617:5:
1615. BIO *cbio = NULL;
1616. SSL_CTX *ctx = NULL;
1617. > OCSP_RESPONSE *resp = NULL;
1618.
1619. cbio = BIO_new_connect(host);
apps/ocsp.c:1619:5:
1617. OCSP_RESPONSE *resp = NULL;
1618.
1619. > cbio = BIO_new_connect(host);
1620. if (cbio == NULL) {
1621. BIO_printf(bio_err, "Error creating connect BIO\n");
crypto/bio/bss_conn.c:527:1: start of procedure BIO_new_connect()
525. }
526.
527. > BIO *BIO_new_connect(const char *str)
528. {
529. BIO *ret;
crypto/bio/bss_conn.c:531:5:
529. BIO *ret;
530.
531. > ret = BIO_new(BIO_s_connect());
532. if (ret == NULL)
533. return NULL;
crypto/bio/bss_conn.c:245:1: start of procedure BIO_s_connect()
243. }
244.
245. > const BIO_METHOD *BIO_s_connect(void)
246. {
247. return &methods_connectp;
crypto/bio/bss_conn.c:247:5:
245. const BIO_METHOD *BIO_s_connect(void)
246. {
247. > return &methods_connectp;
248. }
249.
crypto/bio/bss_conn.c:248:1: return from a call to BIO_s_connect
246. {
247. return &methods_connectp;
248. > }
249.
250. static int conn_new(BIO *bi)
crypto/bio/bss_conn.c:531:5: Skipping BIO_new(): empty list of specs
529. BIO *ret;
530.
531. ret = BIO_new(BIO_s_connect());
^
532. if (ret == NULL)
533. return NULL;
crypto/bio/bss_conn.c:532:9: Taking false branch
530.
531. ret = BIO_new(BIO_s_connect());
532. if (ret == NULL)
^
533. return NULL;
534. if (BIO_set_conn_hostname(ret, str))
crypto/bio/bss_conn.c:534:9:
532. if (ret == NULL)
533. return NULL;
534. > if (BIO_set_conn_hostname(ret, str))
535. return ret;
536. BIO_free(ret);
crypto/bio/bio_lib.c:510:1: start of procedure BIO_ctrl()
508. }
509.
510. > long BIO_ctrl(BIO *b, int cmd, long larg, void *parg)
511. {
512. long ret;
crypto/bio/bio_lib.c:514:9: Taking false branch
512. long ret;
513.
514. if (b == NULL)
^
515. return 0;
516.
crypto/bio/bio_lib.c:517:10: Taking false branch
515. return 0;
516.
517. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
^
518. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
519. return -2;
crypto/bio/bio_lib.c:517:33: Taking true branch
515. return 0;
516.
517. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
^
518. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
519. return -2;
crypto/bio/bio_lib.c:518:9:
516.
517. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
518. > BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
519. return -2;
520. }
providers/fips/fipsprov.c:435:1: start of procedure ERR_put_error()
433. }
434.
435. > void ERR_put_error(int lib, int func, int reason, const char *file, int line)
436. {
437. /*
providers/fips/fipsprov.c:442:5: Skipping __function_pointer__(): unresolved function pointer
440. * a OPENSSL_CTX pointer.
441. */
442. c_put_error(NULL, ERR_PACK(lib, func, reason), file, line);
^
443. ERR_add_error_data(1, "(in the FIPS module)");
444. }
providers/fips/fipsprov.c:443:5: Skipping ERR_add_error_data(): empty list of specs
441. */
442. c_put_error(NULL, ERR_PACK(lib, func, reason), file, line);
443. ERR_add_error_data(1, "(in the FIPS module)");
^
444. }
445.
providers/fips/fipsprov.c:444:1: return from a call to ERR_put_error
442. c_put_error(NULL, ERR_PACK(lib, func, reason), file, line);
443. ERR_add_error_data(1, "(in the FIPS module)");
444. > }
445.
446. void ERR_add_error_data(int num, ...)
crypto/bio/bio_lib.c:519:9:
517. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
518. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
519. > return -2;
520. }
521.
crypto/bio/bio_lib.c:535:1: return from a call to BIO_ctrl
533.
534. return ret;
535. > }
536.
537. long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)
crypto/bio/bss_conn.c:534:9: Taking true branch
532. if (ret == NULL)
533. return NULL;
534. if (BIO_set_conn_hostname(ret, str))
^
535. return ret;
536. BIO_free(ret);
crypto/bio/bss_conn.c:535:9:
533. return NULL;
534. if (BIO_set_conn_hostname(ret, str))
535. > return ret;
536. BIO_free(ret);
537. return NULL;
crypto/bio/bss_conn.c:538:1: return from a call to BIO_new_connect
536. BIO_free(ret);
537. return NULL;
538. > }
539.
540. #endif
apps/ocsp.c:1620:9: Taking false branch
1618.
1619. cbio = BIO_new_connect(host);
1620. if (cbio == NULL) {
^
1621. BIO_printf(bio_err, "Error creating connect BIO\n");
1622. goto end;
apps/ocsp.c:1624:9: Taking true branch
1622. goto end;
1623. }
1624. if (port != NULL)
^
1625. BIO_set_conn_port(cbio, port);
1626. if (use_ssl == 1) {
apps/ocsp.c:1625:9:
1623. }
1624. if (port != NULL)
1625. > BIO_set_conn_port(cbio, port);
1626. if (use_ssl == 1) {
1627. BIO *sbio;
crypto/bio/bio_lib.c:510:1: start of procedure BIO_ctrl()
508. }
509.
510. > long BIO_ctrl(BIO *b, int cmd, long larg, void *parg)
511. {
512. long ret;
crypto/bio/bio_lib.c:514:9: Taking false branch
512. long ret;
513.
514. if (b == NULL)
^
515. return 0;
516.
crypto/bio/bio_lib.c:517:10: Taking false branch
515. return 0;
516.
517. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
^
518. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
519. return -2;
crypto/bio/bio_lib.c:517:33: Taking true branch
515. return 0;
516.
517. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
^
518. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
519. return -2;
crypto/bio/bio_lib.c:518:9:
516.
517. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
518. > BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
519. return -2;
520. }
providers/fips/fipsprov.c:435:1: start of procedure ERR_put_error()
433. }
434.
435. > void ERR_put_error(int lib, int func, int reason, const char *file, int line)
436. {
437. /*
providers/fips/fipsprov.c:442:5: Skipping __function_pointer__(): unresolved function pointer
440. * a OPENSSL_CTX pointer.
441. */
442. c_put_error(NULL, ERR_PACK(lib, func, reason), file, line);
^
443. ERR_add_error_data(1, "(in the FIPS module)");
444. }
providers/fips/fipsprov.c:443:5: Skipping ERR_add_error_data(): empty list of specs
441. */
442. c_put_error(NULL, ERR_PACK(lib, func, reason), file, line);
443. ERR_add_error_data(1, "(in the FIPS module)");
^
444. }
445.
providers/fips/fipsprov.c:444:1: return from a call to ERR_put_error
442. c_put_error(NULL, ERR_PACK(lib, func, reason), file, line);
443. ERR_add_error_data(1, "(in the FIPS module)");
444. > }
445.
446. void ERR_add_error_data(int num, ...)
crypto/bio/bio_lib.c:519:9:
517. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
518. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
519. > return -2;
520. }
521.
crypto/bio/bio_lib.c:535:1: return from a call to BIO_ctrl
533.
534. return ret;
535. > }
536.
537. long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)
apps/ocsp.c:1626:9: Taking false branch
1624. if (port != NULL)
1625. BIO_set_conn_port(cbio, port);
1626. if (use_ssl == 1) {
^
1627. BIO *sbio;
1628. ctx = SSL_CTX_new(TLS_client_method());
apps/ocsp.c:1638:5:
1636. }
1637.
1638. > resp = query_responder(cbio, host, path, headers, req, req_timeout);
1639. if (resp == NULL)
1640. BIO_printf(bio_err, "Error querying OCSP responder\n");
apps/ocsp.c:1516:1: start of procedure query_responder()
1514.
1515. # ifndef OPENSSL_NO_SOCK
1516. > static OCSP_RESPONSE *query_responder(BIO *cbio, const char *host,
1517. const char *path,
1518. const STACK_OF(CONF_VALUE) *headers,
apps/ocsp.c:1524:5:
1522. int rv;
1523. int i;
1524. > int add_host = 1;
1525. OCSP_REQ_CTX *ctx = NULL;
1526. OCSP_RESPONSE *rsp = NULL;
apps/ocsp.c:1525:5:
1523. int i;
1524. int add_host = 1;
1525. > OCSP_REQ_CTX *ctx = NULL;
1526. OCSP_RESPONSE *rsp = NULL;
1527. fd_set confds;
apps/ocsp.c:1526:5:
1524. int add_host = 1;
1525. OCSP_REQ_CTX *ctx = NULL;
1526. > OCSP_RESPONSE *rsp = NULL;
1527. fd_set confds;
1528. struct timeval tv;
apps/ocsp.c:1530:9: Taking true branch
1528. struct timeval tv;
1529.
1530. if (req_timeout != -1)
^
1531. BIO_set_nbio(cbio, 1);
1532.
apps/ocsp.c:1531:9:
1529.
1530. if (req_timeout != -1)
1531. > BIO_set_nbio(cbio, 1);
1532.
1533. rv = BIO_do_connect(cbio);
crypto/bio/bio_lib.c:510:1: start of procedure BIO_ctrl()
508. }
509.
510. > long BIO_ctrl(BIO *b, int cmd, long larg, void *parg)
511. {
512. long ret;
crypto/bio/bio_lib.c:514:9: Taking false branch
512. long ret;
513.
514. if (b == NULL)
^
515. return 0;
516.
crypto/bio/bio_lib.c:517:10: Taking false branch
515. return 0;
516.
517. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
^
518. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
519. return -2;
crypto/bio/bio_lib.c:517:33: Taking true branch
515. return 0;
516.
517. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
^
518. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
519. return -2;
crypto/bio/bio_lib.c:518:9:
516.
517. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
518. > BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
519. return -2;
520. }
providers/fips/fipsprov.c:435:1: start of procedure ERR_put_error()
433. }
434.
435. > void ERR_put_error(int lib, int func, int reason, const char *file, int line)
436. {
437. /*
providers/fips/fipsprov.c:442:5: Skipping __function_pointer__(): unresolved function pointer
440. * a OPENSSL_CTX pointer.
441. */
442. c_put_error(NULL, ERR_PACK(lib, func, reason), file, line);
^
443. ERR_add_error_data(1, "(in the FIPS module)");
444. }
providers/fips/fipsprov.c:443:5: Skipping ERR_add_error_data(): empty list of specs
441. */
442. c_put_error(NULL, ERR_PACK(lib, func, reason), file, line);
443. ERR_add_error_data(1, "(in the FIPS module)");
^
444. }
445.
providers/fips/fipsprov.c:444:1: return from a call to ERR_put_error
442. c_put_error(NULL, ERR_PACK(lib, func, reason), file, line);
443. ERR_add_error_data(1, "(in the FIPS module)");
444. > }
445.
446. void ERR_add_error_data(int num, ...)
crypto/bio/bio_lib.c:519:9:
517. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
518. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
519. > return -2;
520. }
521.
crypto/bio/bio_lib.c:535:1: return from a call to BIO_ctrl
533.
534. return ret;
535. > }
536.
537. long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)
apps/ocsp.c:1533:5:
1531. BIO_set_nbio(cbio, 1);
1532.
1533. > rv = BIO_do_connect(cbio);
1534.
1535. if ((rv <= 0) && ((req_timeout == -1) || !BIO_should_retry(cbio))) {
crypto/bio/bio_lib.c:510:1: start of procedure BIO_ctrl()
508. }
509.
510. > long BIO_ctrl(BIO *b, int cmd, long larg, void *parg)
511. {
512. long ret;
crypto/bio/bio_lib.c:514:9: Taking false branch
512. long ret;
513.
514. if (b == NULL)
^
515. return 0;
516.
crypto/bio/bio_lib.c:517:10: Taking false branch
515. return 0;
516.
517. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
^
518. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
519. return -2;
crypto/bio/bio_lib.c:517:33: Taking true branch
515. return 0;
516.
517. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
^
518. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
519. return -2;
crypto/bio/bio_lib.c:518:9:
516.
517. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
518. > BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
519. return -2;
520. }
providers/fips/fipsprov.c:435:1: start of procedure ERR_put_error()
433. }
434.
435. > void ERR_put_error(int lib, int func, int reason, const char *file, int line)
436. {
437. /*
providers/fips/fipsprov.c:442:5: Skipping __function_pointer__(): unresolved function pointer
440. * a OPENSSL_CTX pointer.
441. */
442. c_put_error(NULL, ERR_PACK(lib, func, reason), file, line);
^
443. ERR_add_error_data(1, "(in the FIPS module)");
444. }
providers/fips/fipsprov.c:443:5: Skipping ERR_add_error_data(): empty list of specs
441. */
442. c_put_error(NULL, ERR_PACK(lib, func, reason), file, line);
443. ERR_add_error_data(1, "(in the FIPS module)");
^
444. }
445.
providers/fips/fipsprov.c:444:1: return from a call to ERR_put_error
442. c_put_error(NULL, ERR_PACK(lib, func, reason), file, line);
443. ERR_add_error_data(1, "(in the FIPS module)");
444. > }
445.
446. void ERR_add_error_data(int num, ...)
crypto/bio/bio_lib.c:519:9:
517. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
518. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
519. > return -2;
520. }
521.
crypto/bio/bio_lib.c:535:1: return from a call to BIO_ctrl
533.
534. return ret;
535. > }
536.
537. long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)
apps/ocsp.c:1535:10: Taking true branch
1533. rv = BIO_do_connect(cbio);
1534.
1535. if ((rv <= 0) && ((req_timeout == -1) || !BIO_should_retry(cbio))) {
^
1536. BIO_puts(bio_err, "Error connecting BIO\n");
1537. return NULL;
apps/ocsp.c:1535:24: Taking false branch
1533. rv = BIO_do_connect(cbio);
1534.
1535. if ((rv <= 0) && ((req_timeout == -1) || !BIO_should_retry(cbio))) {
^
1536. BIO_puts(bio_err, "Error connecting BIO\n");
1537. return NULL;
apps/ocsp.c:1535:47:
1533. rv = BIO_do_connect(cbio);
1534.
1535. > if ((rv <= 0) && ((req_timeout == -1) || !BIO_should_retry(cbio))) {
1536. BIO_puts(bio_err, "Error connecting BIO\n");
1537. return NULL;
crypto/bio/bio_lib.c:195:1: start of procedure BIO_test_flags()
193. }
194.
195. > int BIO_test_flags(const BIO *b, int flags)
196. {
197. return (b->flags & flags);
crypto/bio/bio_lib.c:197:5:
195. int BIO_test_flags(const BIO *b, int flags)
196. {
197. > return (b->flags & flags);
198. }
199.
crypto/bio/bio_lib.c:198:1: return from a call to BIO_test_flags
196. {
197. return (b->flags & flags);
198. > }
199.
200. void BIO_set_flags(BIO *b, int flags)
apps/ocsp.c:1535:47: Taking false branch
1533. rv = BIO_do_connect(cbio);
1534.
1535. if ((rv <= 0) && ((req_timeout == -1) || !BIO_should_retry(cbio))) {
^
1536. BIO_puts(bio_err, "Error connecting BIO\n");
1537. return NULL;
apps/ocsp.c:1540:9:
1538. }
1539.
1540. > if (BIO_get_fd(cbio, &fd) < 0) {
1541. BIO_puts(bio_err, "Can't get connection fd\n");
1542. goto err;
crypto/bio/bio_lib.c:510:1: start of procedure BIO_ctrl()
508. }
509.
510. > long BIO_ctrl(BIO *b, int cmd, long larg, void *parg)
511. {
512. long ret;
crypto/bio/bio_lib.c:514:9: Taking false branch
512. long ret;
513.
514. if (b == NULL)
^
515. return 0;
516.
crypto/bio/bio_lib.c:517:10: Taking false branch
515. return 0;
516.
517. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
^
518. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
519. return -2;
crypto/bio/bio_lib.c:517:33: Taking true branch
515. return 0;
516.
517. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
^
518. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
519. return -2;
crypto/bio/bio_lib.c:518:9:
516.
517. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
518. > BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
519. return -2;
520. }
providers/fips/fipsprov.c:435:1: start of procedure ERR_put_error()
433. }
434.
435. > void ERR_put_error(int lib, int func, int reason, const char *file, int line)
436. {
437. /*
providers/fips/fipsprov.c:442:5: Skipping __function_pointer__(): unresolved function pointer
440. * a OPENSSL_CTX pointer.
441. */
442. c_put_error(NULL, ERR_PACK(lib, func, reason), file, line);
^
443. ERR_add_error_data(1, "(in the FIPS module)");
444. }
providers/fips/fipsprov.c:443:5: Skipping ERR_add_error_data(): empty list of specs
441. */
442. c_put_error(NULL, ERR_PACK(lib, func, reason), file, line);
443. ERR_add_error_data(1, "(in the FIPS module)");
^
444. }
445.
providers/fips/fipsprov.c:444:1: return from a call to ERR_put_error
442. c_put_error(NULL, ERR_PACK(lib, func, reason), file, line);
443. ERR_add_error_data(1, "(in the FIPS module)");
444. > }
445.
446. void ERR_add_error_data(int num, ...)
crypto/bio/bio_lib.c:519:9:
517. if ((b->method == NULL) || (b->method->ctrl == NULL)) {
518. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD);
519. > return -2;
520. }
521.
crypto/bio/bio_lib.c:535:1: return from a call to BIO_ctrl
533.
534. return ret;
535. > }
536.
537. long BIO_callback_ctrl(BIO *b, int cmd, BIO_info_cb *fp)
apps/ocsp.c:1540:9: Taking true branch
1538. }
1539.
1540. if (BIO_get_fd(cbio, &fd) < 0) {
^
1541. BIO_puts(bio_err, "Can't get connection fd\n");
1542. goto err;
apps/ocsp.c:1541:9:
1539.
1540. if (BIO_get_fd(cbio, &fd) < 0) {
1541. > BIO_puts(bio_err, "Can't get connection fd\n");
1542. goto err;
1543. }
crypto/bio/bio_lib.c:387:1: start of procedure BIO_puts()
385. }
386.
387. > int BIO_puts(BIO *b, const char *buf)
388. {
389. int ret;
crypto/bio/bio_lib.c:390:5:
388. {
389. int ret;
390. > size_t written = 0;
391.
392. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
crypto/bio/bio_lib.c:392:10: Taking false branch
390. size_t written = 0;
391.
392. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
^
393. BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD);
394. return -2;
crypto/bio/bio_lib.c:392:25: Taking false branch
390. size_t written = 0;
391.
392. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
^
393. BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD);
394. return -2;
crypto/bio/bio_lib.c:392:48: Taking false branch
390. size_t written = 0;
391.
392. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) {
^
393. BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD);
394. return -2;
crypto/bio/bio_lib.c:397:9: Taking false branch
395. }
396.
397. if (b->callback != NULL || b->callback_ex != NULL) {
^
398. ret = (int)bio_call_callback(b, BIO_CB_PUTS, buf, 0, 0, 0L, 1L, NULL);
399. if (ret <= 0)
crypto/bio/bio_lib.c:397:32: Taking false branch
395. }
396.
397. if (b->callback != NULL || b->callback_ex != NULL) {
^
398. ret = (int)bio_call_callback(b, BIO_CB_PUTS, buf, 0, 0, 0L, 1L, NULL);
399. if (ret <= 0)
crypto/bio/bio_lib.c:403:10: Taking true branch
401. }
402.
403. if (!b->init) {
^
404. BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED);
405. return -2;
crypto/bio/bio_lib.c:404:9:
402.
403. if (!b->init) {
404. > BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED);
405. return -2;
406. }
providers/fips/fipsprov.c:435:1: start of procedure ERR_put_error()
433. }
434.
435. > void ERR_put_error(int lib, int func, int reason, const char *file, int line)
436. {
437. /*
providers/fips/fipsprov.c:442:5: Skipping __function_pointer__(): unresolved function pointer
440. * a OPENSSL_CTX pointer.
441. */
442. c_put_error(NULL, ERR_PACK(lib, func, reason), file, line);
^
443. ERR_add_error_data(1, "(in the FIPS module)");
444. }
providers/fips/fipsprov.c:443:5: Skipping ERR_add_error_data(): empty list of specs
441. */
442. c_put_error(NULL, ERR_PACK(lib, func, reason), file, line);
443. ERR_add_error_data(1, "(in the FIPS module)");
^
444. }
445.
providers/fips/fipsprov.c:444:1: return from a call to ERR_put_error
442. c_put_error(NULL, ERR_PACK(lib, func, reason), file, line);
443. ERR_add_error_data(1, "(in the FIPS module)");
444. > }
445.
446. void ERR_add_error_data(int num, ...)
crypto/bio/bio_lib.c:405:9:
403. if (!b->init) {
404. BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED);
405. > return -2;
406. }
407.
crypto/bio/bio_lib.c:430:1: return from a call to BIO_puts
428.
429. return ret;
430. > }
431.
432. int BIO_gets(BIO *b, char *buf, int size)
apps/ocsp.c:1603:2:
1601.
1602. }
1603. > err:
1604. OCSP_REQ_CTX_free(ctx);
1605.
apps/ocsp.c:1604:5:
1602. }
1603. err:
1604. > OCSP_REQ_CTX_free(ctx);
1605.
1606. return rsp;
crypto/ocsp/ocsp_ht.c:86:1: start of procedure OCSP_REQ_CTX_free()
84. }
85.
86. > void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx)
87. {
88. if (!rctx)
crypto/ocsp/ocsp_ht.c:88:10: Taking true branch
86. void OCSP_REQ_CTX_free(OCSP_REQ_CTX *rctx)
87. {
88. if (!rctx)
^
89. return;
90. BIO_free(rctx->mem);
crypto/ocsp/ocsp_ht.c:89:9:
87. {
88. if (!rctx)
89. > return;
90. BIO_free(rctx->mem);
91. OPENSSL_free(rctx->iobuf);
crypto/ocsp/ocsp_ht.c:93:1: return from a call to OCSP_REQ_CTX_free
91. OPENSSL_free(rctx->iobuf);
92. OPENSSL_free(rctx);
93. > }
94.
95. BIO *OCSP_REQ_CTX_get0_mem_bio(OCSP_REQ_CTX *rctx)
apps/ocsp.c:1606:5:
1604. OCSP_REQ_CTX_free(ctx);
1605.
1606. > return rsp;
1607. }
1608.
apps/ocsp.c:1607:1: return from a call to query_responder
1605.
1606. return rsp;
1607. > }
1608.
1609. OCSP_RESPONSE *process_responder(OCSP_REQUEST *req,
apps/ocsp.c:1639:9: Taking true branch
1637.
1638. resp = query_responder(cbio, host, path, headers, req, req_timeout);
1639. if (resp == NULL)
^
1640. BIO_printf(bio_err, "Error querying OCSP responder\n");
1641. end:
apps/ocsp.c:1640:9: Skipping BIO_printf(): empty list of specs
1638. resp = query_responder(cbio, host, path, headers, req, req_timeout);
1639. if (resp == NULL)
1640. BIO_printf(bio_err, "Error querying OCSP responder\n");
^
1641. end:
1642. BIO_free_all(cbio);
apps/ocsp.c:1641:2:
1639. if (resp == NULL)
1640. BIO_printf(bio_err, "Error querying OCSP responder\n");
1641. > end:
1642. BIO_free_all(cbio);
1643. SSL_CTX_free(ctx);
apps/ocsp.c:1642:5: Skipping BIO_free_all(): empty list of specs
1640. BIO_printf(bio_err, "Error querying OCSP responder\n");
1641. end:
1642. BIO_free_all(cbio);
^
1643. SSL_CTX_free(ctx);
1644. return resp;
apps/ocsp.c:1643:5:
1641. end:
1642. BIO_free_all(cbio);
1643. > SSL_CTX_free(ctx);
1644. return resp;
1645. }
ssl/ssl_lib.c:3239:1: start of procedure SSL_CTX_free()
3237. }
3238.
3239. > void SSL_CTX_free(SSL_CTX *a)
3240. {
3241. int i;
ssl/ssl_lib.c:3243:9: Taking false branch
3241. int i;
3242.
3243. if (a == NULL)
^
3244. return;
3245.
ssl/ssl_lib.c:3246:5:
3244. return;
3245.
3246. > CRYPTO_DOWN_REF(&a->references, &i, a->lock);
3247. REF_PRINT_COUNT("SSL_CTX", a);
3248. if (i > 0)
include/internal/refcount.h:49:1: start of procedure CRYPTO_DOWN_REF()
47. * otherwise imply an acquire fence. Hence conditional acquire fence...
48. */
49. > static inline int CRYPTO_DOWN_REF(_Atomic int *val, int *ret, void *lock)
50. {
51. *ret = atomic_fetch_sub_explicit(val, 1, memory_order_relaxed) - 1;
include/internal/refcount.h:51:5:
49. static inline int CRYPTO_DOWN_REF(_Atomic int *val, int *ret, void *lock)
50. {
51. > *ret = atomic_fetch_sub_explicit(val, 1, memory_order_relaxed) - 1;
52. if (*ret == 0)
53. atomic_thread_fence(memory_order_acquire);
include/internal/refcount.h:52:9: Taking true branch
50. {
51. *ret = atomic_fetch_sub_explicit(val, 1, memory_order_relaxed) - 1;
52. if (*ret == 0)
^
53. atomic_thread_fence(memory_order_acquire);
54. return 1;
include/internal/refcount.h:53:9: Skipping __c11_atomic_thread_fence(): method has no implementation
51. *ret = atomic_fetch_sub_explicit(val, 1, memory_order_relaxed) - 1;
52. if (*ret == 0)
53. atomic_thread_fence(memory_order_acquire);
^
54. return 1;
55. }
include/internal/refcount.h:54:5:
52. if (*ret == 0)
53. atomic_thread_fence(memory_order_acquire);
54. > return 1;
55. }
56.
include/internal/refcount.h:55:1: return from a call to CRYPTO_DOWN_REF
53. atomic_thread_fence(memory_order_acquire);
54. return 1;
55. > }
56.
57. # elif defined(__GNUC__) && defined(__ATOMIC_RELAXED) && __GCC_ATOMIC_INT_LOCK_FREE > 0
ssl/ssl_lib.c:3248:9: Taking true branch
3246. CRYPTO_DOWN_REF(&a->references, &i, a->lock);
3247. REF_PRINT_COUNT("SSL_CTX", a);
3248. if (i > 0)
^
3249. return;
3250. REF_ASSERT_ISNT(i < 0);
ssl/ssl_lib.c:3249:9:
3247. REF_PRINT_COUNT("SSL_CTX", a);
3248. if (i > 0)
3249. > return;
3250. REF_ASSERT_ISNT(i < 0);
3251.
ssl/ssl_lib.c:3301:1: return from a call to SSL_CTX_free
3299.
3300. OPENSSL_free(a);
3301. > }
3302.
3303. void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb)
| https://github.com/openssl/openssl/blob/5fe499cb75469fbda08d96facd13d14a402a6d44/apps/ocsp.c/#L1643 |
d2a_code_trace_data_42421 | 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;
}
libavformat/movenc.c:257: error: Integer Overflow L2
([1, +oo] - 6):unsigned32 by call to `bitstream_read`.
libavformat/movenc.c:257:18: Call
255. bitstream_init(&bc, track->vos_data + 4, (track->vos_len - 4) * 8);
256. fscod = bitstream_read(&bc, 2);
257. frmsizecod = bitstream_read(&bc, 6);
^
258. bsid = bitstream_read(&bc, 5);
259. bsmod = bitstream_read(&bc, 3);
libavcodec/bitstream.h:183:1: Parameter `n`
181.
182. /* Return n bits from the buffer. n has to be in the 0-32 range. */
183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n)
^
184. {
185. if (!n)
libavcodec/bitstream.h:194:12: Call
192. }
193.
194. return get_val(bc, n);
^
195. }
196.
libavcodec/bitstream.h:130:1: <LHS trace>
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:130:1: Parameter `bc->bits_left`
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:130:1: <RHS trace>
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:130:1: Parameter `n`
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:139:5: Binary operation: ([1, +oo] - 6):unsigned32 by call to `bitstream_read`
137. bc->bits <<= n;
138. #endif
139. bc->bits_left -= n;
^
140.
141. return ret;
| https://github.com/libav/libav/blob/7ff018c1cb43a5fe5ee2049d325cdd785852067a/libavcodec/bitstream.h/#L139 |
d2a_code_trace_data_42422 | static void await_references(H264Context *h){
MpegEncContext * const s = &h->s;
const int mb_xy= h->mb_xy;
const int mb_type= s->current_picture.mb_type[mb_xy];
int refs[2][48];
int nrefs[2] = {0};
int ref, list;
memset(refs, -1, sizeof(refs));
if(IS_16X16(mb_type)){
get_lowest_part_y(h, refs, 0, 16, 0,
IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);
}else if(IS_16X8(mb_type)){
get_lowest_part_y(h, refs, 0, 8, 0,
IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);
get_lowest_part_y(h, refs, 8, 8, 8,
IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1), nrefs);
}else if(IS_8X16(mb_type)){
get_lowest_part_y(h, refs, 0, 16, 0,
IS_DIR(mb_type, 0, 0), IS_DIR(mb_type, 0, 1), nrefs);
get_lowest_part_y(h, refs, 4, 16, 0,
IS_DIR(mb_type, 1, 0), IS_DIR(mb_type, 1, 1), nrefs);
}else{
int i;
assert(IS_8X8(mb_type));
for(i=0; i<4; i++){
const int sub_mb_type= h->sub_mb_type[i];
const int n= 4*i;
int y_offset= (i&2)<<2;
if(IS_SUB_8X8(sub_mb_type)){
get_lowest_part_y(h, refs, n , 8, y_offset,
IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
}else if(IS_SUB_8X4(sub_mb_type)){
get_lowest_part_y(h, refs, n , 4, y_offset,
IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
get_lowest_part_y(h, refs, n+2, 4, y_offset+4,
IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
}else if(IS_SUB_4X8(sub_mb_type)){
get_lowest_part_y(h, refs, n , 8, y_offset,
IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
get_lowest_part_y(h, refs, n+1, 8, y_offset,
IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
}else{
int j;
assert(IS_SUB_4X4(sub_mb_type));
for(j=0; j<4; j++){
int sub_y_offset= y_offset + 2*(j&2);
get_lowest_part_y(h, refs, n+j, 4, sub_y_offset,
IS_DIR(sub_mb_type, 0, 0), IS_DIR(sub_mb_type, 0, 1), nrefs);
}
}
}
}
for(list=h->list_count-1; list>=0; list--){
for(ref=0; ref<48 && nrefs[list]; ref++){
int row = refs[list][ref];
if(row >= 0){
Picture *ref_pic = &h->ref_list[list][ref];
int ref_field = ref_pic->reference - 1;
int ref_field_picture = ref_pic->field_picture;
int pic_height = 16*s->mb_height >> ref_field_picture;
row <<= MB_MBAFF;
nrefs[list]--;
if(!FIELD_PICTURE && ref_field_picture){
ff_thread_await_progress((AVFrame*)ref_pic, FFMIN((row >> 1) - !(row&1), pic_height-1), 1);
ff_thread_await_progress((AVFrame*)ref_pic, FFMIN((row >> 1) , pic_height-1), 0);
}else if(FIELD_PICTURE && !ref_field_picture){
ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row*2 + ref_field , pic_height-1), 0);
}else if(FIELD_PICTURE){
ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row, pic_height-1), ref_field);
}else{
ff_thread_await_progress((AVFrame*)ref_pic, FFMIN(row, pic_height-1), 0);
}
}
}
}
}
libavcodec/vc1dec.c:3742: error: Integer Overflow L2
([0, +oo] - 1):unsigned32 by call to `ff_er_frame_end`.
libavcodec/vc1dec.c:3742:9: Call
3740. // if(get_bits_count(&s->gb) > buf_size * 8)
3741. // return -1;
3742. ff_er_frame_end(s);
^
3743. }
3744.
libavcodec/error_resilience.c:776:1: Parameter `s->list_count`
774. }
775.
776. void ff_er_frame_end(MpegEncContext *s){
^
777. int i, mb_x, mb_y, error, error_type, dc_error, mv_error, ac_error;
778. int distance;
libavcodec/error_resilience.c:995:13: Call
993. s->mb_x= mb_x;
994. s->mb_y= mb_y;
995. decode_mb(s, 0/*FIXME h264 partitioned slices need this set*/);
^
996. }
997. }
libavcodec/error_resilience.c:43:1: Parameter `s->list_count`
41. #undef mb_intra
42.
43. static void decode_mb(MpegEncContext *s, int ref){
^
44. s->dest[0] = s->current_picture.data[0] + (s->mb_y * 16* s->linesize ) + s->mb_x * 16;
45. s->dest[1] = s->current_picture.data[1] + (s->mb_y * (16>>s->chroma_y_shift) * s->uvlinesize) + s->mb_x * (16>>s->chroma_x_shift);
libavcodec/error_resilience.c:59:9: Call
57. fill_rectangle(h->mv_cache[0][ scan8[0] ], 4, 4, 8, pack16to32(s->mv[0][0][0],s->mv[0][0][1]), 4);
58. assert(!FRAME_MBAFF);
59. ff_h264_hl_decode_mb(h);
^
60. }else{
61. assert(ref==0);
libavcodec/h264.c:1847:1: Parameter `h->list_count`
1845. }
1846.
1847. void ff_h264_hl_decode_mb(H264Context *h){
^
1848. MpegEncContext * const s = &h->s;
1849. const int mb_xy= h->mb_xy;
libavcodec/h264.c:1854:9: Call
1852.
1853. if (is_complex) {
1854. hl_decode_mb_complex(h);
^
1855. } else if (h->pixel_shift) {
1856. hl_decode_mb_simple_16(h);
libavcodec/h264.c:1843:1: Parameter `h->list_count`
1841. * Process a macroblock; this handles edge cases, such as interlacing.
1842. */
1843. static void av_noinline hl_decode_mb_complex(H264Context *h){
^
1844. hl_decode_mb_internal(h, 0, h->pixel_shift);
1845. }
libavcodec/h264.c:1844:5: Call
1842. */
1843. static void av_noinline hl_decode_mb_complex(H264Context *h){
1844. hl_decode_mb_internal(h, 0, h->pixel_shift);
^
1845. }
1846.
libavcodec/h264.c:1541:1: Parameter `h->list_count`
1539. }
1540.
1541. static av_always_inline void hl_decode_mb_internal(H264Context *h, int simple, int pixel_shift){
^
1542. MpegEncContext * const s = &h->s;
1543. const int mb_x= s->mb_x;
libavcodec/h264.c:1735:17: Call
1733. }else if(is_h264){
1734. if (pixel_shift) {
1735. hl_motion_16(h, dest_y, dest_cb, dest_cr,
^
1736. s->me.qpel_put, s->dsp.put_h264_chroma_pixels_tab,
1737. s->me.qpel_avg, s->dsp.avg_h264_chroma_pixels_tab,
libavcodec/h264.c:762:1: Parameter `h->list_count`
760. }
761. hl_motion_fn(0, 8);
762. hl_motion_fn(1, 16);
^
763.
764. static void free_tables(H264Context *h, int free_rbsp){
libavcodec/h264.c:762:1: Call
760. }
761. hl_motion_fn(0, 8);
762. hl_motion_fn(1, 16);
^
763.
764. static void free_tables(H264Context *h, int free_rbsp){
libavcodec/h264.c:646:1: Parameter `h->list_count`
644. }
645.
646. static av_always_inline void hl_motion(H264Context *h, uint8_t *dest_y, uint8_t *dest_cb, uint8_t *dest_cr,
^
647. qpel_mc_func (*qpix_put)[16], h264_chroma_mc_func (*chroma_put),
648. qpel_mc_func (*qpix_avg)[16], h264_chroma_mc_func (*chroma_avg),
libavcodec/h264.c:658:9: Call
656.
657. if(HAVE_PTHREADS && (s->avctx->active_thread_type & FF_THREAD_FRAME))
658. await_references(h);
^
659. prefetch_motion(h, 0, pixel_shift);
660.
libavcodec/h264.c:299:1: <LHS trace>
297. * @param h the H264 context
298. */
299. static void await_references(H264Context *h){
^
300. MpegEncContext * const s = &h->s;
301. const int mb_xy= h->mb_xy;
libavcodec/h264.c:299:1: Parameter `h->list_count`
297. * @param h the H264 context
298. */
299. static void await_references(H264Context *h){
^
300. MpegEncContext * const s = &h->s;
301. const int mb_xy= h->mb_xy;
libavcodec/h264.c:357:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `ff_er_frame_end`
355. }
356.
357. for(list=h->list_count-1; list>=0; list--){
^
358. for(ref=0; ref<48 && nrefs[list]; ref++){
359. int row = refs[list][ref];
| https://github.com/libav/libav/blob/6a9c85944427e3c4355bce67d7f677ec69527bff/libavcodec/h264.c/#L357 |
d2a_code_trace_data_42423 | static char *
ngx_http_proxy_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
ngx_http_proxy_loc_conf_t *plcf = conf;
size_t add;
u_short port;
ngx_str_t *value, *url;
ngx_url_t u;
ngx_uint_t n;
ngx_http_core_loc_conf_t *clcf;
ngx_http_script_compile_t sc;
if (plcf->upstream.upstream || plcf->proxy_lengths) {
return "is duplicate";
}
clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
value = cf->args->elts;
url = &value[1];
n = ngx_http_script_variables_count(url);
if (n) {
ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
sc.cf = cf;
sc.source = url;
sc.lengths = &plcf->proxy_lengths;
sc.values = &plcf->proxy_values;
sc.variables = n;
sc.complete_lengths = 1;
sc.complete_values = 1;
if (ngx_http_script_compile(&sc) != NGX_OK) {
return NGX_CONF_ERROR;
}
#if (NGX_HTTP_SSL)
if (ngx_http_proxy_set_ssl(cf, plcf) != NGX_OK) {
return NGX_CONF_ERROR;
}
#endif
clcf->handler = ngx_http_proxy_handler;
return NGX_CONF_OK;
}
if (ngx_strncasecmp(url->data, (u_char *) "http://", 7) == 0) {
add = 7;
port = 80;
} else if (ngx_strncasecmp(url->data, (u_char *) "https://", 8) == 0) {
#if (NGX_HTTP_SSL)
if (ngx_http_proxy_set_ssl(cf, plcf) != NGX_OK) {
return NGX_CONF_ERROR;
}
add = 8;
port = 443;
#else
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"https protocol requires SSL support");
return NGX_CONF_ERROR;
#endif
} else {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "invalid URL prefix");
return NGX_CONF_ERROR;
}
ngx_memzero(&u, sizeof(ngx_url_t));
u.url.len = url->len - add;
u.url.data = url->data + add;
u.default_port = port;
u.uri_part = 1;
u.no_resolve = 1;
plcf->upstream.upstream = ngx_http_upstream_add(cf, &u, 0);
if (plcf->upstream.upstream == NULL) {
return NGX_CONF_ERROR;
}
plcf->vars.schema.len = add;
plcf->vars.schema.data = url->data;
plcf->vars.key_start = plcf->vars.schema;
ngx_http_proxy_set_vars(&u, &plcf->vars);
clcf->handler = ngx_http_proxy_handler;
plcf->location = clcf->name;
if (clcf->named
#if (NGX_PCRE)
|| clcf->regex
#endif
|| clcf->noname)
{
if (plcf->vars.uri.len) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"\"proxy_pass\" may not have URI part in "
"location given by regular expression, "
"or inside named location, "
"or inside the \"if\" statement, "
"or inside the \"limit_except\" block");
return NGX_CONF_ERROR;
}
plcf->location.len = 0;
}
plcf->url = *url;
if (clcf->name.data[clcf->name.len - 1] == '/') {
clcf->auto_redirect = 1;
}
return NGX_CONF_OK;
}
src/http/modules/ngx_http_proxy_module.c:2606: error: Integer Overflow L2
([0, +oo] - 7):unsigned64.
src/http/modules/ngx_http_proxy_module.c:2551:9: <LHS trace>
2549. url = &value[1];
2550.
2551. n = ngx_http_script_variables_count(url);
^
2552.
2553. if (n) {
src/http/modules/ngx_http_proxy_module.c:2551:9: Call
2549. url = &value[1];
2550.
2551. n = ngx_http_script_variables_count(url);
^
2552.
2553. if (n) {
src/http/ngx_http_script.c:214:1: Parameter `value->len`
212.
213.
214. ngx_uint_t
^
215. ngx_http_script_variables_count(ngx_str_t *value)
216. {
src/http/modules/ngx_http_proxy_module.c:2581:9: <RHS trace>
2579.
2580. if (ngx_strncasecmp(url->data, (u_char *) "http://", 7) == 0) {
2581. add = 7;
^
2582. port = 80;
2583.
src/http/modules/ngx_http_proxy_module.c:2581:9: Assignment
2579.
2580. if (ngx_strncasecmp(url->data, (u_char *) "http://", 7) == 0) {
2581. add = 7;
^
2582. port = 80;
2583.
src/http/modules/ngx_http_proxy_module.c:2606:5: Binary operation: ([0, +oo] - 7):unsigned64
2604. ngx_memzero(&u, sizeof(ngx_url_t));
2605.
2606. u.url.len = url->len - add;
^
2607. u.url.data = url->data + add;
2608. u.default_port = port;
| https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/http/modules/ngx_http_proxy_module.c/#L2606 |
d2a_code_trace_data_42424 | void parse_options(int argc, char **argv, const OptionDef *options,
void (* parse_arg_function)(const char*))
{
const char *opt, *arg;
int optindex, handleoptions=1;
const OptionDef *po;
optindex = 1;
while (optindex < argc) {
opt = argv[optindex++];
if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
if (opt[1] == '-' && opt[2] == '\0') {
handleoptions = 0;
continue;
}
po= find_option(options, opt + 1);
if (!po->name)
po= find_option(options, "default");
if (!po->name) {
unknown_opt:
fprintf(stderr, "%s: unrecognized option '%s'\n", argv[0], opt);
exit(1);
}
arg = NULL;
if (po->flags & HAS_ARG) {
arg = argv[optindex++];
if (!arg) {
fprintf(stderr, "%s: missing argument for option '%s'\n", argv[0], opt);
exit(1);
}
}
if (po->flags & OPT_STRING) {
char *str;
str = av_strdup(arg);
*po->u.str_arg = str;
} else if (po->flags & OPT_BOOL) {
*po->u.int_arg = 1;
} else if (po->flags & OPT_INT) {
*po->u.int_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT_MIN, INT_MAX);
} else if (po->flags & OPT_INT64) {
*po->u.int64_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT64_MIN, INT64_MAX);
} else if (po->flags & OPT_FLOAT) {
*po->u.float_arg = parse_number_or_die(opt+1, arg, OPT_FLOAT, -1.0/0.0, 1.0/0.0);
} else if (po->flags & OPT_FUNC2) {
if(po->u.func2_arg(opt+1, arg)<0)
goto unknown_opt;
} else {
po->u.func_arg(arg);
}
if(po->flags & OPT_EXIT)
exit(0);
} else {
if (parse_arg_function)
parse_arg_function(opt);
}
}
}
cmdutils.c:157: error: Null Dereference
pointer `arg` last assigned on line 142 could be null and is dereferenced by call to `parse_number_or_die()` at line 157, column 34.
cmdutils.c:117:1: start of procedure parse_options()
115. }
116.
117. void parse_options(int argc, char **argv, const OptionDef *options,
^
118. void (* parse_arg_function)(const char*))
119. {
cmdutils.c:121:5:
119. {
120. const char *opt, *arg;
121. int optindex, handleoptions=1;
^
122. const OptionDef *po;
123.
cmdutils.c:125:5:
123.
124. /* parse options */
125. optindex = 1;
^
126. while (optindex < argc) {
127. opt = argv[optindex++];
cmdutils.c:126:12: Loop condition is true. Entering loop body
124. /* parse options */
125. optindex = 1;
126. while (optindex < argc) {
^
127. opt = argv[optindex++];
128.
cmdutils.c:127:9:
125. optindex = 1;
126. while (optindex < argc) {
127. opt = argv[optindex++];
^
128.
129. if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
cmdutils.c:129:13: Taking true branch
127. opt = argv[optindex++];
128.
129. if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
^
130. if (opt[1] == '-' && opt[2] == '\0') {
131. handleoptions = 0;
cmdutils.c:129:30: Taking true branch
127. opt = argv[optindex++];
128.
129. if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
^
130. if (opt[1] == '-' && opt[2] == '\0') {
131. handleoptions = 0;
cmdutils.c:129:47: Taking true branch
127. opt = argv[optindex++];
128.
129. if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
^
130. if (opt[1] == '-' && opt[2] == '\0') {
131. handleoptions = 0;
cmdutils.c:130:17: Taking false branch
128.
129. if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
130. if (opt[1] == '-' && opt[2] == '\0') {
^
131. handleoptions = 0;
132. continue;
cmdutils.c:134:13: Skipping find_option(): empty list of specs
132. continue;
133. }
134. po= find_option(options, opt + 1);
^
135. if (!po->name)
136. po= find_option(options, "default");
cmdutils.c:135:18: Taking false branch
133. }
134. po= find_option(options, opt + 1);
135. if (!po->name)
^
136. po= find_option(options, "default");
137. if (!po->name) {
cmdutils.c:137:18: Taking false branch
135. if (!po->name)
136. po= find_option(options, "default");
137. if (!po->name) {
^
138. unknown_opt:
139. fprintf(stderr, "%s: unrecognized option '%s'\n", argv[0], opt);
cmdutils.c:142:13:
140. exit(1);
141. }
142. arg = NULL;
^
143. if (po->flags & HAS_ARG) {
144. arg = argv[optindex++];
cmdutils.c:143:17: Taking false branch
141. }
142. arg = NULL;
143. if (po->flags & HAS_ARG) {
^
144. arg = argv[optindex++];
145. if (!arg) {
cmdutils.c:150:17: Taking false branch
148. }
149. }
150. if (po->flags & OPT_STRING) {
^
151. char *str;
152. str = av_strdup(arg);
cmdutils.c:154:24: Taking false branch
152. str = av_strdup(arg);
153. *po->u.str_arg = str;
154. } else if (po->flags & OPT_BOOL) {
^
155. *po->u.int_arg = 1;
156. } else if (po->flags & OPT_INT) {
cmdutils.c:156:24: Taking true branch
154. } else if (po->flags & OPT_BOOL) {
155. *po->u.int_arg = 1;
156. } else if (po->flags & OPT_INT) {
^
157. *po->u.int_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT_MIN, INT_MAX);
158. } else if (po->flags & OPT_INT64) {
cmdutils.c:157:17:
155. *po->u.int_arg = 1;
156. } else if (po->flags & OPT_INT) {
157. *po->u.int_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT_MIN, INT_MAX);
^
158. } else if (po->flags & OPT_INT64) {
159. *po->u.int64_arg = parse_number_or_die(opt+1, arg, OPT_INT64, INT64_MIN, INT64_MAX);
cmdutils.c:57:1: start of procedure parse_number_or_die()
55. struct SwsContext *sws_opts;
56.
57. double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max)
^
58. {
59. char *tail;
cmdutils.c:61:5:
59. char *tail;
60. const char *error;
61. double d = strtod(numstr, &tail);
^
62. if (*tail)
63. error= "Expected number for %s but found: %s\n";
cmdutils.c:62:9: Taking false branch
60. const char *error;
61. double d = strtod(numstr, &tail);
62. if (*tail)
^
63. error= "Expected number for %s but found: %s\n";
64. else if (d < min || d > max)
cmdutils.c:64:14: Taking false branch
62. if (*tail)
63. error= "Expected number for %s but found: %s\n";
64. else if (d < min || d > max)
^
65. error= "The value for %s was %s which is not within %f - %f\n";
66. else if(type == OPT_INT64 && (int64_t)d != d)
cmdutils.c:64:25: Taking false branch
62. if (*tail)
63. error= "Expected number for %s but found: %s\n";
64. else if (d < min || d > max)
^
65. error= "The value for %s was %s which is not within %f - %f\n";
66. else if(type == OPT_INT64 && (int64_t)d != d)
cmdutils.c:66:13: Taking false branch
64. else if (d < min || d > max)
65. error= "The value for %s was %s which is not within %f - %f\n";
66. else if(type == OPT_INT64 && (int64_t)d != d)
^
67. error= "Expected int64 for %s but found %s\n";
68. else
cmdutils.c:69:9:
67. error= "Expected int64 for %s but found %s\n";
68. else
69. return d;
^
70. fprintf(stderr, error, context, numstr, min, max);
71. exit(1);
cmdutils.c:72:1: return from a call to parse_number_or_die
70. fprintf(stderr, error, context, numstr, min, max);
71. exit(1);
72. }
^
73.
74. int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration)
| https://github.com/libav/libav/blob/712ca84c21a4d7faf97fa79732bf5c347ec6fbc3/cmdutils.c/#L157 |
d2a_code_trace_data_42425 | 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/ectest.c:920: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_rand`.
Showing all 14 steps of the trace
test/ectest.c:920:14: Call
918. goto err;
919.
920. if (!TEST_true(BN_rand(y, BN_num_bits(y), 0, 0))
^
921. || !TEST_true(BN_add(z, z, y)))
922. goto err;
crypto/bn/bn_lib.c:141:9: Assignment
139.
140. if (BN_is_zero(a))
141. return 0;
^
142. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
143. }
test/ectest.c:920:14: Call
918. goto err;
919.
920. if (!TEST_true(BN_rand(y, BN_num_bits(y), 0, 0))
^
921. || !TEST_true(BN_add(z, z, y)))
922. goto err;
crypto/bn/bn_rand.c:106:1: Parameter `bits`
104. return bnrand(NORMAL, rnd, bits, top, bottom, ctx);
105. }
106. > int BN_rand(BIGNUM *rnd, int bits, int top, int bottom)
107. {
108. return bnrand(NORMAL, rnd, bits, top, bottom, NULL);
crypto/bn/bn_rand.c:108:12: Call
106. int BN_rand(BIGNUM *rnd, int bits, int top, int bottom)
107. {
108. return bnrand(NORMAL, rnd, bits, top, bottom, NULL);
^
109. }
110.
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, +oo] Size: [1, +oo] by call to `BN_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_42426 | int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x)
{
X509_OBJECT *obj;
int ret = 1;
if (x == NULL)
return 0;
obj = OPENSSL_malloc(sizeof(*obj));
if (obj == NULL) {
X509err(X509_F_X509_STORE_ADD_CRL, ERR_R_MALLOC_FAILURE);
return 0;
}
obj->type = X509_LU_CRL;
obj->data.crl = x;
CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
X509_OBJECT_up_ref_count(obj);
if (X509_OBJECT_retrieve_match(ctx->objs, obj)) {
X509_OBJECT_free_contents(obj);
OPENSSL_free(obj);
X509err(X509_F_X509_STORE_ADD_CRL, X509_R_CERT_ALREADY_IN_HASH_TABLE);
ret = 0;
} else
sk_X509_OBJECT_push(ctx->objs, obj);
CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
return ret;
}
crypto/x509/x509_lu.c:386: error: MEMORY_LEAK
memory dynamically allocated by call to `CRYPTO_malloc()` at line 368, column 11 is not reachable after line 386, column 9.
Showing all 62 steps of the trace
crypto/x509/x509_lu.c:361:1: start of procedure X509_STORE_add_crl()
359. }
360.
361. > int X509_STORE_add_crl(X509_STORE *ctx, X509_CRL *x)
362. {
363. X509_OBJECT *obj;
crypto/x509/x509_lu.c:364:5:
362. {
363. X509_OBJECT *obj;
364. > int ret = 1;
365.
366. if (x == NULL)
crypto/x509/x509_lu.c:366:9: Taking false branch
364. int ret = 1;
365.
366. if (x == NULL)
^
367. return 0;
368. obj = OPENSSL_malloc(sizeof(*obj));
crypto/x509/x509_lu.c:368:5:
366. if (x == NULL)
367. return 0;
368. > obj = OPENSSL_malloc(sizeof(*obj));
369. if (obj == NULL) {
370. X509err(X509_F_X509_STORE_ADD_CRL, ERR_R_MALLOC_FAILURE);
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/x509/x509_lu.c:369:9: Taking false branch
367. return 0;
368. obj = OPENSSL_malloc(sizeof(*obj));
369. if (obj == NULL) {
^
370. X509err(X509_F_X509_STORE_ADD_CRL, ERR_R_MALLOC_FAILURE);
371. return 0;
crypto/x509/x509_lu.c:373:5:
371. return 0;
372. }
373. > obj->type = X509_LU_CRL;
374. obj->data.crl = x;
375.
crypto/x509/x509_lu.c:374:5:
372. }
373. obj->type = X509_LU_CRL;
374. > obj->data.crl = x;
375.
376. CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
crypto/x509/x509_lu.c:376:5:
374. obj->data.crl = x;
375.
376. > CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
377.
378. X509_OBJECT_up_ref_count(obj);
crypto/lock.c:414:1: start of procedure CRYPTO_lock()
412. }
413.
414. > void CRYPTO_lock(int mode, int type, const char *file, int line)
415. {
416. #ifdef LOCK_DEBUG
crypto/lock.c:441:9: Taking false branch
439. }
440. #endif
441. if (type < 0) {
^
442. if (dynlock_lock_callback != NULL) {
443. struct CRYPTO_dynlock_value *pointer
crypto/lock.c:452:16: Taking true branch
450. CRYPTO_destroy_dynlockid(type);
451. }
452. } else if (locking_callback != NULL)
^
453. locking_callback(mode, type, file, line);
454. }
crypto/lock.c:453:9: Skipping __function_pointer__(): unresolved function pointer
451. }
452. } else if (locking_callback != NULL)
453. locking_callback(mode, type, file, line);
^
454. }
455.
crypto/lock.c:441:5:
439. }
440. #endif
441. > if (type < 0) {
442. if (dynlock_lock_callback != NULL) {
443. struct CRYPTO_dynlock_value *pointer
crypto/lock.c:454:1: return from a call to CRYPTO_lock
452. } else if (locking_callback != NULL)
453. locking_callback(mode, type, file, line);
454. > }
455.
456. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,
crypto/x509/x509_lu.c:378:5:
376. CRYPTO_w_lock(CRYPTO_LOCK_X509_STORE);
377.
378. > X509_OBJECT_up_ref_count(obj);
379.
380. if (X509_OBJECT_retrieve_match(ctx->objs, obj)) {
crypto/x509/x509_lu.c:393:1: start of procedure X509_OBJECT_up_ref_count()
391. }
392.
393. > void X509_OBJECT_up_ref_count(X509_OBJECT *a)
394. {
395. switch (a->type) {
crypto/x509/x509_lu.c:395:5:
393. void X509_OBJECT_up_ref_count(X509_OBJECT *a)
394. {
395. > switch (a->type) {
396. default:
397. break;
crypto/x509/x509_lu.c:398:5: Switch condition is false. Skipping switch case
396. default:
397. break;
398. case X509_LU_X509:
^
399. X509_up_ref(a->data.x509);
400. break;
crypto/x509/x509_lu.c:401:5: Switch condition is true. Entering switch case
399. X509_up_ref(a->data.x509);
400. break;
401. case X509_LU_CRL:
^
402. X509_CRL_up_ref(a->data.crl);
403. break;
crypto/x509/x509_lu.c:402:9:
400. break;
401. case X509_LU_CRL:
402. > X509_CRL_up_ref(a->data.crl);
403. break;
404. }
crypto/x509/x509cset.c:136:1: start of procedure X509_CRL_up_ref()
134. }
135.
136. > void X509_CRL_up_ref(X509_CRL *crl)
137. {
138. CRYPTO_add(&crl->references, 1, CRYPTO_LOCK_X509_CRL);
crypto/x509/x509cset.c:138:5:
136. void X509_CRL_up_ref(X509_CRL *crl)
137. {
138. > CRYPTO_add(&crl->references, 1, CRYPTO_LOCK_X509_CRL);
139. }
140.
crypto/lock.c:456:1: start of procedure CRYPTO_add_lock()
454. }
455.
456. > int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,
457. int line)
458. {
crypto/lock.c:459:5:
457. int line)
458. {
459. > int ret = 0;
460.
461. if (add_lock_callback != NULL) {
crypto/lock.c:461:9: Taking true branch
459. int ret = 0;
460.
461. if (add_lock_callback != NULL) {
^
462. #ifdef LOCK_DEBUG
463. int before = *pointer;
crypto/lock.c:466:9: Skipping __function_pointer__(): unresolved function pointer
464. #endif
465.
466. ret = add_lock_callback(pointer, amount, type, file, line);
^
467. #ifdef LOCK_DEBUG
468. {
crypto/lock.c:493:5:
491. CRYPTO_lock(CRYPTO_UNLOCK | CRYPTO_WRITE, type, file, line);
492. }
493. > return (ret);
494. }
495.
crypto/lock.c:494:1: return from a call to CRYPTO_add_lock
492. }
493. return (ret);
494. > }
495.
496. const char *CRYPTO_get_lock_name(int type)
crypto/x509/x509cset.c:139:1: return from a call to X509_CRL_up_ref
137. {
138. CRYPTO_add(&crl->references, 1, CRYPTO_LOCK_X509_CRL);
139. > }
140.
141. long X509_CRL_get_version(X509_CRL *crl)
crypto/x509/x509_lu.c:405:1: return from a call to X509_OBJECT_up_ref_count
403. break;
404. }
405. > }
406.
407. void X509_OBJECT_free_contents(X509_OBJECT *a)
crypto/x509/x509_lu.c:380:9: Taking false branch
378. X509_OBJECT_up_ref_count(obj);
379.
380. if (X509_OBJECT_retrieve_match(ctx->objs, obj)) {
^
381. X509_OBJECT_free_contents(obj);
382. OPENSSL_free(obj);
crypto/x509/x509_lu.c:386:9:
384. ret = 0;
385. } else
386. > sk_X509_OBJECT_push(ctx->objs, obj);
387.
388. CRYPTO_w_unlock(CRYPTO_LOCK_X509_STORE);
include/openssl/x509_vfy.h:124:1: start of procedure sk_X509_OBJECT_push()
122.
123. DEFINE_STACK_OF(X509_LOOKUP)
124. > DEFINE_STACK_OF(X509_OBJECT)
125.
126. /* This is a static that defines the function interface */
crypto/stack/stack.c:259:1: start of procedure sk_push()
257. }
258.
259. > int sk_push(_STACK *st, void *data)
260. {
261. return (sk_insert(st, data, st->num));
crypto/stack/stack.c:261:5:
259. int sk_push(_STACK *st, void *data)
260. {
261. > return (sk_insert(st, data, st->num));
262. }
263.
crypto/stack/stack.c:167:1: start of procedure sk_insert()
165. }
166.
167. > int sk_insert(_STACK *st, void *data, int loc)
168. {
169. char **s;
crypto/stack/stack.c:171:9: Taking false branch
169. char **s;
170.
171. if (st == NULL)
^
172. return 0;
173. if (st->num_alloc <= st->num + 1) {
crypto/stack/stack.c:173:9: Taking true branch
171. if (st == NULL)
172. return 0;
173. if (st->num_alloc <= st->num + 1) {
^
174. s = OPENSSL_realloc((char *)st->data,
175. (unsigned int)sizeof(char *) * st->num_alloc * 2);
crypto/stack/stack.c:174:9:
172. return 0;
173. if (st->num_alloc <= st->num + 1) {
174. > s = OPENSSL_realloc((char *)st->data,
175. (unsigned int)sizeof(char *) * st->num_alloc * 2);
176. if (s == NULL)
crypto/mem.c:166:1: start of procedure CRYPTO_realloc()
164. }
165.
166. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
167. {
168. if (str == NULL)
crypto/mem.c:168:9: Taking true branch
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
167. {
168. if (str == NULL)
^
169. return CRYPTO_malloc(num, file, line);
170.
crypto/mem.c:169:9:
167. {
168. if (str == NULL)
169. > return CRYPTO_malloc(num, file, line);
170.
171. if (num == 0) {
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 true branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:125:9:
123.
124. if (num <= 0)
125. > return NULL;
126.
127. allow_customize = 0;
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:191:1: return from a call to CRYPTO_realloc
189. return realloc(str, num);
190.
191. > }
192.
193. void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,
crypto/stack/stack.c:176:13: Taking true branch
174. s = OPENSSL_realloc((char *)st->data,
175. (unsigned int)sizeof(char *) * st->num_alloc * 2);
176. if (s == NULL)
^
177. return (0);
178. st->data = s;
crypto/stack/stack.c:177:13:
175. (unsigned int)sizeof(char *) * st->num_alloc * 2);
176. if (s == NULL)
177. > return (0);
178. st->data = s;
179. st->num_alloc *= 2;
crypto/stack/stack.c:191:1: return from a call to sk_insert
189. st->sorted = 0;
190. return (st->num);
191. > }
192.
193. void *sk_delete_ptr(_STACK *st, void *p)
crypto/stack/stack.c:262:1: return from a call to sk_push
260. {
261. return (sk_insert(st, data, st->num));
262. > }
263.
264. int sk_unshift(_STACK *st, void *data)
include/openssl/x509_vfy.h:124:1: return from a call to sk_X509_OBJECT_push
122.
123. DEFINE_STACK_OF(X509_LOOKUP)
124. > DEFINE_STACK_OF(X509_OBJECT)
125.
126. /* This is a static that defines the function interface */
| https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/x509/x509_lu.c/#L386 |
d2a_code_trace_data_42427 | static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr,
int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2],
int ref_mv_scale, int flags, int size, int h)
{
MotionEstContext * const c= &s->me;
int best[2]={0, 0};
int d;
int dmin;
int map_generation;
int penalty_factor;
const int ref_mv_stride= s->mb_stride;
const int ref_mv_xy= s->mb_x + s->mb_y*ref_mv_stride;
me_cmp_func cmpf, chroma_cmpf;
LOAD_COMMON
LOAD_COMMON2
if(c->pre_pass){
penalty_factor= c->pre_penalty_factor;
cmpf= s->dsp.me_pre_cmp[size];
chroma_cmpf= s->dsp.me_pre_cmp[size+1];
}else{
penalty_factor= c->penalty_factor;
cmpf= s->dsp.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1];
}
map_generation= update_map_generation(c);
assert(cmpf);
dmin= cmp(s, 0, 0, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags);
map[0]= map_generation;
score_map[0]= dmin;
if((s->pict_type == FF_B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0)
dmin += (mv_penalty[pred_x] + mv_penalty[pred_y])*penalty_factor;
if (s->first_slice_line) {
CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
}else{
if(dmin<((h*h*s->avctx->mv0_threshold)>>8)
&& ( P_LEFT[0] |P_LEFT[1]
|P_TOP[0] |P_TOP[1]
|P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){
*mx_ptr= 0;
*my_ptr= 0;
c->skip=1;
return dmin;
}
CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift)
CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1)
CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1)
CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) )
CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) )
CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift)
CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift)
CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
}
if(dmin>h*h*4){
if(c->pre_pass){
CHECK_CLIPPED_MV((last_mv[ref_mv_xy-1][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy-1][1]*ref_mv_scale + (1<<15))>>16)
if(!s->first_slice_line)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy-ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy-ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
}else{
CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16)
if(s->mb_y+1<s->end_mb_y)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
}
}
if(c->avctx->last_predictor_count){
const int count= c->avctx->last_predictor_count;
const int xstart= FFMAX(0, s->mb_x - count);
const int ystart= FFMAX(0, s->mb_y - count);
const int xend= FFMIN(s->mb_width , s->mb_x + count + 1);
const int yend= FFMIN(s->mb_height, s->mb_y + count + 1);
int mb_y;
for(mb_y=ystart; mb_y<yend; mb_y++){
int mb_x;
for(mb_x=xstart; mb_x<xend; mb_x++){
const int xy= mb_x + 1 + (mb_y + 1)*ref_mv_stride;
int mx= (last_mv[xy][0]*ref_mv_scale + (1<<15))>>16;
int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16;
if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue;
CHECK_MV(mx,my)
}
}
}
dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
*mx_ptr= best[0];
*my_ptr= best[1];
return dmin;
}
libavcodec/motion_est_template.c:1063: error: Uninitialized Value
The value read from xmin was never initialized.
libavcodec/motion_est_template.c:1063:9:
1061. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
1062. (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
1063. CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift)
^
1064. CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift)
1065. CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1063 |
d2a_code_trace_data_42428 | static void fill_decode_caches(H264Context *h, int mb_type){
MpegEncContext * const s = &h->s;
int topleft_xy, top_xy, topright_xy, left_xy[2];
int topleft_type, top_type, topright_type, left_type[2];
const uint8_t * left_block= h->left_block;
int i;
topleft_xy = h->topleft_mb_xy ;
top_xy = h->top_mb_xy ;
topright_xy = h->topright_mb_xy;
left_xy[0] = h->left_mb_xy[0] ;
left_xy[1] = h->left_mb_xy[1] ;
topleft_type = h->topleft_type ;
top_type = h->top_type ;
topright_type= h->topright_type ;
left_type[0] = h->left_type[0] ;
left_type[1] = h->left_type[1] ;
if(!IS_SKIP(mb_type)){
if(IS_INTRA(mb_type)){
int type_mask= h->pps.constrained_intra_pred ? IS_INTRA(-1) : -1;
h->topleft_samples_available=
h->top_samples_available=
h->left_samples_available= 0xFFFF;
h->topright_samples_available= 0xEEEA;
if(!(top_type & type_mask)){
h->topleft_samples_available= 0xB3FF;
h->top_samples_available= 0x33FF;
h->topright_samples_available= 0x26EA;
}
if(IS_INTERLACED(mb_type) != IS_INTERLACED(left_type[0])){
if(IS_INTERLACED(mb_type)){
if(!(left_type[0] & type_mask)){
h->topleft_samples_available&= 0xDFFF;
h->left_samples_available&= 0x5FFF;
}
if(!(left_type[1] & type_mask)){
h->topleft_samples_available&= 0xFF5F;
h->left_samples_available&= 0xFF5F;
}
}else{
int left_typei = h->slice_table[left_xy[0] + s->mb_stride ] == h->slice_num
? s->current_picture.mb_type[left_xy[0] + s->mb_stride] : 0;
assert(left_xy[0] == left_xy[1]);
if(!((left_typei & type_mask) && (left_type[0] & type_mask))){
h->topleft_samples_available&= 0xDF5F;
h->left_samples_available&= 0x5F5F;
}
}
}else{
if(!(left_type[0] & type_mask)){
h->topleft_samples_available&= 0xDF5F;
h->left_samples_available&= 0x5F5F;
}
}
if(!(topleft_type & type_mask))
h->topleft_samples_available&= 0x7FFF;
if(!(topright_type & type_mask))
h->topright_samples_available&= 0xFBFF;
if(IS_INTRA4x4(mb_type)){
if(IS_INTRA4x4(top_type)){
AV_COPY32(h->intra4x4_pred_mode_cache+4+8*0, h->intra4x4_pred_mode + h->mb2br_xy[top_xy]);
}else{
h->intra4x4_pred_mode_cache[4+8*0]=
h->intra4x4_pred_mode_cache[5+8*0]=
h->intra4x4_pred_mode_cache[6+8*0]=
h->intra4x4_pred_mode_cache[7+8*0]= 2 - 3*!(top_type & type_mask);
}
for(i=0; i<2; i++){
if(IS_INTRA4x4(left_type[i])){
int8_t *mode= h->intra4x4_pred_mode + h->mb2br_xy[left_xy[i]];
h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= mode[6-left_block[0+2*i]];
h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= mode[6-left_block[1+2*i]];
}else{
h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]=
h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= 2 - 3*!(left_type[i] & type_mask);
}
}
}
}
if(top_type){
AV_COPY32(&h->non_zero_count_cache[4+8*0], &h->non_zero_count[top_xy][4+3*8]);
h->non_zero_count_cache[1+8*0]= h->non_zero_count[top_xy][1+1*8];
h->non_zero_count_cache[2+8*0]= h->non_zero_count[top_xy][2+1*8];
h->non_zero_count_cache[1+8*3]= h->non_zero_count[top_xy][1+2*8];
h->non_zero_count_cache[2+8*3]= h->non_zero_count[top_xy][2+2*8];
}else {
h->non_zero_count_cache[1+8*0]=
h->non_zero_count_cache[2+8*0]=
h->non_zero_count_cache[1+8*3]=
h->non_zero_count_cache[2+8*3]=
AV_WN32A(&h->non_zero_count_cache[4+8*0], CABAC && !IS_INTRA(mb_type) ? 0 : 0x40404040);
}
for (i=0; i<2; i++) {
if(left_type[i]){
h->non_zero_count_cache[3+8*1 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[8+0+2*i]];
h->non_zero_count_cache[3+8*2 + 2*8*i]= h->non_zero_count[left_xy[i]][left_block[8+1+2*i]];
h->non_zero_count_cache[0+8*1 + 8*i]= h->non_zero_count[left_xy[i]][left_block[8+4+2*i]];
h->non_zero_count_cache[0+8*4 + 8*i]= h->non_zero_count[left_xy[i]][left_block[8+5+2*i]];
}else{
h->non_zero_count_cache[3+8*1 + 2*8*i]=
h->non_zero_count_cache[3+8*2 + 2*8*i]=
h->non_zero_count_cache[0+8*1 + 8*i]=
h->non_zero_count_cache[0+8*4 + 8*i]= CABAC && !IS_INTRA(mb_type) ? 0 : 64;
}
}
if( CABAC ) {
if(top_type) {
h->top_cbp = h->cbp_table[top_xy];
} else if(IS_INTRA(mb_type)) {
h->top_cbp = 0x1CF;
} else {
h->top_cbp = 0x00F;
}
if (left_type[0]) {
h->left_cbp = h->cbp_table[left_xy[0]] & 0x1f0;
} else if(IS_INTRA(mb_type)) {
h->left_cbp = 0x1CF;
} else {
h->left_cbp = 0x00F;
}
if (left_type[0]) {
h->left_cbp |= ((h->cbp_table[left_xy[0]]>>((left_block[0]&(~1))+1))&0x1) << 1;
}
if (left_type[1]) {
h->left_cbp |= ((h->cbp_table[left_xy[1]]>>((left_block[2]&(~1))+1))&0x1) << 3;
}
}
}
#if 1
if(IS_INTER(mb_type) || (IS_DIRECT(mb_type) && h->direct_spatial_mv_pred)){
int list;
for(list=0; list<h->list_count; list++){
if(!USES_LIST(mb_type, list)){
continue;
}
assert(!(IS_DIRECT(mb_type) && !h->direct_spatial_mv_pred));
h->mv_cache_clean[list]= 0;
if(USES_LIST(top_type, list)){
const int b_xy= h->mb2b_xy[top_xy] + 3*h->b_stride;
const int b8_xy= h->mb2b8_xy[top_xy] + h->b8_stride;
AV_COPY128(h->mv_cache[list][scan8[0] + 0 - 1*8], s->current_picture.motion_val[list][b_xy + 0]);
h->ref_cache[list][scan8[0] + 0 - 1*8]=
h->ref_cache[list][scan8[0] + 1 - 1*8]= s->current_picture.ref_index[list][b8_xy + 0];
h->ref_cache[list][scan8[0] + 2 - 1*8]=
h->ref_cache[list][scan8[0] + 3 - 1*8]= s->current_picture.ref_index[list][b8_xy + 1];
}else{
AV_ZERO128(h->mv_cache[list][scan8[0] + 0 - 1*8]);
AV_WN32A(&h->ref_cache[list][scan8[0] + 0 - 1*8], ((top_type ? LIST_NOT_USED : PART_NOT_AVAILABLE)&0xFF)*0x01010101);
}
for(i=0; i<2; i++){
int cache_idx = scan8[0] - 1 + i*2*8;
if(USES_LIST(left_type[i], list)){
const int b_xy= h->mb2b_xy[left_xy[i]] + 3;
const int b8_xy= h->mb2b8_xy[left_xy[i]] + 1;
AV_COPY32(h->mv_cache[list][cache_idx ], s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[0+i*2]]);
AV_COPY32(h->mv_cache[list][cache_idx+8], s->current_picture.motion_val[list][b_xy + h->b_stride*left_block[1+i*2]]);
h->ref_cache[list][cache_idx ]= s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[0+i*2]>>1)];
h->ref_cache[list][cache_idx+8]= s->current_picture.ref_index[list][b8_xy + h->b8_stride*(left_block[1+i*2]>>1)];
}else{
AV_ZERO32(h->mv_cache [list][cache_idx ]);
AV_ZERO32(h->mv_cache [list][cache_idx+8]);
h->ref_cache[list][cache_idx ]=
h->ref_cache[list][cache_idx+8]= (left_type[i]) ? LIST_NOT_USED : PART_NOT_AVAILABLE;
}
}
if(USES_LIST(topleft_type, list)){
const int b_xy = h->mb2b_xy [topleft_xy] + 3 + h->b_stride + (h->topleft_partition & 2*h->b_stride);
const int b8_xy= h->mb2b8_xy[topleft_xy] + 1 + (h->topleft_partition & h->b8_stride);
AV_COPY32(h->mv_cache[list][scan8[0] - 1 - 1*8], s->current_picture.motion_val[list][b_xy]);
h->ref_cache[list][scan8[0] - 1 - 1*8]= s->current_picture.ref_index[list][b8_xy];
}else{
AV_ZERO32(h->mv_cache[list][scan8[0] - 1 - 1*8]);
h->ref_cache[list][scan8[0] - 1 - 1*8]= topleft_type ? LIST_NOT_USED : PART_NOT_AVAILABLE;
}
if(USES_LIST(topright_type, list)){
const int b_xy= h->mb2b_xy[topright_xy] + 3*h->b_stride;
const int b8_xy= h->mb2b8_xy[topright_xy] + h->b8_stride;
AV_COPY32(h->mv_cache[list][scan8[0] + 4 - 1*8], s->current_picture.motion_val[list][b_xy]);
h->ref_cache[list][scan8[0] + 4 - 1*8]= s->current_picture.ref_index[list][b8_xy];
}else{
AV_ZERO32(h->mv_cache [list][scan8[0] + 4 - 1*8]);
h->ref_cache[list][scan8[0] + 4 - 1*8]= topright_type ? LIST_NOT_USED : PART_NOT_AVAILABLE;
}
if((mb_type&(MB_TYPE_SKIP|MB_TYPE_DIRECT2)) && !FRAME_MBAFF)
continue;
if(!(mb_type&(MB_TYPE_SKIP|MB_TYPE_DIRECT2))) {
h->ref_cache[list][scan8[5 ]+1] =
h->ref_cache[list][scan8[7 ]+1] =
h->ref_cache[list][scan8[13]+1] =
h->ref_cache[list][scan8[4 ]] =
h->ref_cache[list][scan8[12]] = PART_NOT_AVAILABLE;
AV_ZERO32(h->mv_cache [list][scan8[5 ]+1]);
AV_ZERO32(h->mv_cache [list][scan8[7 ]+1]);
AV_ZERO32(h->mv_cache [list][scan8[13]+1]);
AV_ZERO32(h->mv_cache [list][scan8[4 ]]);
AV_ZERO32(h->mv_cache [list][scan8[12]]);
if( CABAC ) {
if(USES_LIST(top_type, list)){
const int b_xy= h->mb2br_xy[top_xy];
AV_COPY64(h->mvd_cache[list][scan8[0] + 0 - 1*8], h->mvd_table[list][b_xy + 0]);
}else{
AV_ZERO64(h->mvd_cache[list][scan8[0] + 0 - 1*8]);
}
if(USES_LIST(left_type[0], list)){
const int b_xy= h->mb2br_xy[left_xy[0]] + 6;
AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 0*8], h->mvd_table[list][b_xy - left_block[0]]);
AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 1*8], h->mvd_table[list][b_xy - left_block[1]]);
}else{
AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 0*8]);
AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 1*8]);
}
if(USES_LIST(left_type[1], list)){
const int b_xy= h->mb2br_xy[left_xy[1]] + 6;
AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 2*8], h->mvd_table[list][b_xy - left_block[2]]);
AV_COPY16(h->mvd_cache[list][scan8[0] - 1 + 3*8], h->mvd_table[list][b_xy - left_block[3]]);
}else{
AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 2*8]);
AV_ZERO16(h->mvd_cache [list][scan8[0] - 1 + 3*8]);
}
AV_ZERO16(h->mvd_cache [list][scan8[5 ]+1]);
AV_ZERO16(h->mvd_cache [list][scan8[7 ]+1]);
AV_ZERO16(h->mvd_cache [list][scan8[13]+1]);
AV_ZERO16(h->mvd_cache [list][scan8[4 ]]);
AV_ZERO16(h->mvd_cache [list][scan8[12]]);
if(h->slice_type_nos == FF_B_TYPE){
fill_rectangle(&h->direct_cache[scan8[0]], 4, 4, 8, MB_TYPE_16x16>>1, 1);
if(IS_DIRECT(top_type)){
AV_WN32A(&h->direct_cache[scan8[0] - 1*8], 0x01010101*(MB_TYPE_DIRECT2>>1));
}else if(IS_8X8(top_type)){
int b8_xy = 4*top_xy;
h->direct_cache[scan8[0] + 0 - 1*8]= h->direct_table[b8_xy + 2];
h->direct_cache[scan8[0] + 2 - 1*8]= h->direct_table[b8_xy + 3];
}else{
AV_WN32A(&h->direct_cache[scan8[0] - 1*8], 0x01010101*(MB_TYPE_16x16>>1));
}
if(IS_DIRECT(left_type[0]))
h->direct_cache[scan8[0] - 1 + 0*8]= MB_TYPE_DIRECT2>>1;
else if(IS_8X8(left_type[0]))
h->direct_cache[scan8[0] - 1 + 0*8]= h->direct_table[4*left_xy[0] + 1 + (left_block[0]&~1)];
else
h->direct_cache[scan8[0] - 1 + 0*8]= MB_TYPE_16x16>>1;
if(IS_DIRECT(left_type[1]))
h->direct_cache[scan8[0] - 1 + 2*8]= MB_TYPE_DIRECT2>>1;
else if(IS_8X8(left_type[1]))
h->direct_cache[scan8[0] - 1 + 2*8]= h->direct_table[4*left_xy[1] + 1 + (left_block[2]&~1)];
else
h->direct_cache[scan8[0] - 1 + 2*8]= MB_TYPE_16x16>>1;
}
}
}
if(FRAME_MBAFF){
#define MAP_MVS\
MAP_F2F(scan8[0] - 1 - 1*8, topleft_type)\
MAP_F2F(scan8[0] + 0 - 1*8, top_type)\
MAP_F2F(scan8[0] + 1 - 1*8, top_type)\
MAP_F2F(scan8[0] + 2 - 1*8, top_type)\
MAP_F2F(scan8[0] + 3 - 1*8, top_type)\
MAP_F2F(scan8[0] + 4 - 1*8, topright_type)\
MAP_F2F(scan8[0] - 1 + 0*8, left_type[0])\
MAP_F2F(scan8[0] - 1 + 1*8, left_type[0])\
MAP_F2F(scan8[0] - 1 + 2*8, left_type[1])\
MAP_F2F(scan8[0] - 1 + 3*8, left_type[1])
if(MB_FIELD){
#define MAP_F2F(idx, mb_type)\
if(!IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0){\
h->ref_cache[list][idx] <<= 1;\
h->mv_cache[list][idx][1] /= 2;\
h->mvd_cache[list][idx][1] >>=1;\
}
MAP_MVS
#undef MAP_F2F
}else{
#define MAP_F2F(idx, mb_type)\
if(IS_INTERLACED(mb_type) && h->ref_cache[list][idx] >= 0){\
h->ref_cache[list][idx] >>= 1;\
h->mv_cache[list][idx][1] <<= 1;\
h->mvd_cache[list][idx][1] <<= 1;\
}
MAP_MVS
#undef MAP_F2F
}
}
}
}
#endif
h->neighbor_transform_size= !!IS_8x8DCT(top_type) + !!IS_8x8DCT(left_type[0]);
}
libavcodec/h264_cavlc.c:625: error: Buffer Overrun L2
Offset: [1, 6] (⇐ [0, 3] + [1, 3]) Size: 4 by call to `fill_decode_caches`.
libavcodec/h264_cavlc.c:624:5: Call
622. }
623.
624. fill_decode_neighbors(h, mb_type);
^
625. fill_decode_caches(h, mb_type);
626.
libavcodec/h264.h:759:5: Array declaration
757. const int mb_xy= h->mb_xy;
758. int topleft_xy, top_xy, topright_xy, left_xy[2];
759. static const uint8_t left_block_options[4][16]={
^
760. {0,1,2,3,7,10,8,11,7+0*8, 7+1*8, 7+2*8, 7+3*8, 2+0*8, 2+3*8, 2+1*8, 2+2*8},
761. {2,2,3,3,8,11,8,11,7+2*8, 7+2*8, 7+3*8, 7+3*8, 2+1*8, 2+2*8, 2+1*8, 2+2*8},
libavcodec/h264.h:776:5: Assignment
774. topright_xy= top_xy + 1;
775. left_xy[1] = left_xy[0] = mb_xy-1;
776. h->left_block = left_block_options[0];
^
777. if(FRAME_MBAFF){
778. const int left_mb_field_flag = IS_INTERLACED(s->current_picture.mb_type[mb_xy-1]);
libavcodec/h264_cavlc.c:625:5: Call
623.
624. fill_decode_neighbors(h, mb_type);
625. fill_decode_caches(h, mb_type);
^
626.
627. //mb_pred
libavcodec/h264.h:896:21: <Offset trace>
894. h->intra4x4_pred_mode_cache[7+8*0]= 2 - 3*!(top_type & type_mask);
895. }
896. for(i=0; i<2; i++){
^
897. if(IS_INTRA4x4(left_type[i])){
898. int8_t *mode= h->intra4x4_pred_mode + h->mb2br_xy[left_xy[i]];
libavcodec/h264.h:896:21: Assignment
894. h->intra4x4_pred_mode_cache[7+8*0]= 2 - 3*!(top_type & type_mask);
895. }
896. for(i=0; i<2; i++){
^
897. if(IS_INTRA4x4(left_type[i])){
898. int8_t *mode= h->intra4x4_pred_mode + h->mb2br_xy[left_xy[i]];
libavcodec/h264.h:824:1: <Length trace>
822. }
823.
824. static void fill_decode_caches(H264Context *h, int mb_type){
^
825. MpegEncContext * const s = &h->s;
826. int topleft_xy, top_xy, topright_xy, left_xy[2];
libavcodec/h264.h:824:1: Parameter `*h->left_block`
822. }
823.
824. static void fill_decode_caches(H264Context *h, int mb_type){
^
825. MpegEncContext * const s = &h->s;
826. int topleft_xy, top_xy, topright_xy, left_xy[2];
libavcodec/h264.h:828:5: Assignment
826. int topleft_xy, top_xy, topright_xy, left_xy[2];
827. int topleft_type, top_type, topright_type, left_type[2];
828. const uint8_t * left_block= h->left_block;
^
829. int i;
830.
libavcodec/h264.h:900:76: Array access: Offset: [1, 6] (⇐ [0, 3] + [1, 3]) Size: 4 by call to `fill_decode_caches`
898. int8_t *mode= h->intra4x4_pred_mode + h->mb2br_xy[left_xy[i]];
899. h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]= mode[6-left_block[0+2*i]];
900. h->intra4x4_pred_mode_cache[3+8*2 + 2*8*i]= mode[6-left_block[1+2*i]];
^
901. }else{
902. h->intra4x4_pred_mode_cache[3+8*1 + 2*8*i]=
| https://github.com/libav/libav/blob/479e1e617078476f14598cd62769b4c9ca4025e2/libavcodec/h264.h/#L900 |
d2a_code_trace_data_42429 | 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:1059: error: INTEGER_OVERFLOW_L2
([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + 11]):unsigned64 by call to `WPACKET_start_sub_packet_len__`.
Showing all 10 steps of the trace
ssl/t1_lib.c:1057:14: Call
1055. if (s->tlsext_hostname != NULL) {
1056. /* Add TLS extension servername to the Client Hello message */
1057. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_server_name)
^
1058. /* Sub-packet for server_name extension */
1059. || !WPACKET_start_sub_packet_u16(pkt)
ssl/packet.c:242:1: Parameter `pkt->buf->length`
240. }
241.
242. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size)
243. {
244. unsigned char *data;
ssl/t1_lib.c:1059:21: Call
1057. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_server_name)
1058. /* Sub-packet for server_name extension */
1059. || !WPACKET_start_sub_packet_u16(pkt)
^
1060. /* Sub-packet for servername list (always 1 hostname)*/
1061. || !WPACKET_start_sub_packet_u16(pkt)
ssl/packet.c:205:1: Parameter `pkt->written`
203. }
204.
205. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes)
206. {
207. WPACKET_SUB *sub;
ssl/packet.c:229:10: Call
227. }
228.
229. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars))
^
230. return 0;
231. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */
ssl/packet.c:15:1: <LHS trace>
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:15:1: Parameter `pkt->buf->length`
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:15:1: <RHS trace>
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:15:1: Parameter `len`
13. #define DEFAULT_BUF_SIZE 256
14.
15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes)
16. {
17. /* Internal API, so should not fail */
ssl/packet.c:25:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + pkt->written + 11]):unsigned64 by call to `WPACKET_start_sub_packet_len__`
23. return 0;
24.
25. if (pkt->buf->length - pkt->written < len) {
^
26. size_t newlen;
27. size_t reflen;
| https://github.com/openssl/openssl/blob/a6972f346248fbc37e42056bb943fae0896a2967/ssl/packet.c/#L25 |
d2a_code_trace_data_42430 | int ff_h264_find_frame_end(H264Context *h, const uint8_t *buf, int buf_size)
{
int i;
uint32_t state;
ParseContext *pc = &(h->s.parse_context);
state= pc->state;
if(state>13)
state= 7;
for(i=0; i<buf_size; i++){
if(state==7){
for(; i<buf_size; i++){
if(!buf[i]){
state=2;
break;
}
}
}else if(state<=2){
if(buf[i]==1) state^= 5;
else if(buf[i]) state = 7;
else state>>=1;
}else if(state<=5){
int v= buf[i] & 0x1F;
if(v==7 || v==8 || v==9){
if(pc->frame_start_found){
i++;
found:
pc->state=7;
pc->frame_start_found= 0;
return i-(state&5);
}
}else if(v==1 || v==2 || v==5){
if(pc->frame_start_found){
state+=8;
continue;
}else
pc->frame_start_found = 1;
}
state= 7;
}else{
if(buf[i] & 0x80)
goto found;
state= 7;
}
}
pc->state= state;
return END_NOT_FOUND;
}
libavcodec/h264_parser.c:65: error: Integer Overflow L2
([0, `buf_size`] - [0, 5]):unsigned32.
libavcodec/h264_parser.c:34:1: <LHS trace>
32.
33.
34. int ff_h264_find_frame_end(H264Context *h, const uint8_t *buf, int buf_size)
^
35. {
36. int i;
libavcodec/h264_parser.c:34:1: Parameter `buf_size`
32.
33.
34. int ff_h264_find_frame_end(H264Context *h, const uint8_t *buf, int buf_size)
^
35. {
36. int i;
libavcodec/h264_parser.c:43:9: <RHS trace>
41. state= pc->state;
42. if(state>13)
43. state= 7;
^
44.
45. for(i=0; i<buf_size; i++){
libavcodec/h264_parser.c:43:9: Assignment
41. state= pc->state;
42. if(state>13)
43. state= 7;
^
44.
45. for(i=0; i<buf_size; i++){
libavcodec/h264_parser.c:65:21: Binary operation: ([0, buf_size] - [0, 5]):unsigned32
63. pc->state=7;
64. pc->frame_start_found= 0;
65. return i-(state&5);
^
66. }
67. }else if(v==1 || v==2 || v==5){
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264_parser.c/#L65 |
d2a_code_trace_data_42431 | static void copy_parameter_set(void **to, void **from, int count, int size)
{
int i;
for (i = 0; i < count; i++) {
if (to[i] && !from[i])
av_freep(&to[i]);
else if (from[i] && !to[i])
to[i] = av_malloc(size);
if (from[i])
memcpy(to[i], from[i], size);
}
}
libavcodec/h264.c:1277: error: Null Dereference
pointer `*to[i]` last assigned on line 1274 could be null and is dereferenced by call to `memcpy()` at line 1277, column 13.
libavcodec/h264.c:1266:1: start of procedure copy_parameter_set()
1264. }
1265.
1266. static void copy_parameter_set(void **to, void **from, int count, int size)
^
1267. {
1268. int i;
libavcodec/h264.c:1270:10:
1268. int i;
1269.
1270. for (i = 0; i < count; i++) {
^
1271. if (to[i] && !from[i])
1272. av_freep(&to[i]);
libavcodec/h264.c:1270:17: Loop condition is true. Entering loop body
1268. int i;
1269.
1270. for (i = 0; i < count; i++) {
^
1271. if (to[i] && !from[i])
1272. av_freep(&to[i]);
libavcodec/h264.c:1271:13: Taking false branch
1269.
1270. for (i = 0; i < count; i++) {
1271. if (to[i] && !from[i])
^
1272. av_freep(&to[i]);
1273. else if (from[i] && !to[i])
libavcodec/h264.c:1273:18: Taking true branch
1271. if (to[i] && !from[i])
1272. av_freep(&to[i]);
1273. else if (from[i] && !to[i])
^
1274. to[i] = av_malloc(size);
1275.
libavcodec/h264.c:1273:30: Taking true branch
1271. if (to[i] && !from[i])
1272. av_freep(&to[i]);
1273. else if (from[i] && !to[i])
^
1274. to[i] = av_malloc(size);
1275.
libavcodec/h264.c:1274:13:
1272. av_freep(&to[i]);
1273. else if (from[i] && !to[i])
1274. to[i] = av_malloc(size);
^
1275.
1276. if (from[i])
libavutil/mem.c:64:1: start of procedure av_malloc()
62. linker will do it automatically. */
63.
64. void *av_malloc(size_t size)
^
65. {
66. void *ptr = NULL;
libavutil/mem.c:66:5:
64. void *av_malloc(size_t size)
65. {
66. void *ptr = NULL;
^
67. #if CONFIG_MEMALIGN_HACK
68. long diff;
libavutil/mem.c:72:8: Taking true branch
70.
71. /* let's disallow possible ambiguous cases */
72. if(size > (INT_MAX-32) )
^
73. return NULL;
74.
libavutil/mem.c:73:9:
71. /* let's disallow possible ambiguous cases */
72. if(size > (INT_MAX-32) )
73. return NULL;
^
74.
75. #if CONFIG_MEMALIGN_HACK
libavutil/mem.c:115:1: return from a call to av_malloc
113. #endif
114. return ptr;
115. }
^
116.
117. void *av_realloc(void *ptr, size_t size)
libavcodec/h264.c:1276:13: Taking true branch
1274. to[i] = av_malloc(size);
1275.
1276. if (from[i])
^
1277. memcpy(to[i], from[i], size);
1278. }
libavcodec/h264.c:1277:13:
1275.
1276. if (from[i])
1277. memcpy(to[i], from[i], size);
^
1278. }
1279. }
| https://github.com/libav/libav/blob/20234a4bd7e187ae31f9a66b5c40e98666bc30e4/libavcodec/h264.c/#L1277 |
d2a_code_trace_data_42432 | 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/extensions_srvr.c:1954: error: INTEGER_OVERFLOW_L2
([0, +oo] - [`pkt->written`, `pkt->written` + 4]):unsigned64 by call to `WPACKET_put_bytes__`.
Showing all 12 steps of the trace
ssl/statem/extensions_srvr.c:1953:17: Call
1951.
1952. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_psk)
1953. || !WPACKET_start_sub_packet_u16(pkt)
^
1954. || !WPACKET_put_bytes_u16(pkt, s->ext.tick_identity)
1955. || !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/statem/extensions_srvr.c:1954:17: Call
1952. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_psk)
1953. || !WPACKET_start_sub_packet_u16(pkt)
1954. || !WPACKET_put_bytes_u16(pkt, s->ext.tick_identity)
^
1955. || !WPACKET_close(pkt)) {
1956. SSLfatal(s, SSL_AD_INTERNAL_ERROR,
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/packet.c:315:17: Call
313. /* Internal API, so should not fail */
314. if (!ossl_assert(size <= sizeof(unsigned int))
315. || !WPACKET_allocate_bytes(pkt, size, &data)
^
316. || !put_value(data, val, size))
317. return 0;
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 + 4]):unsigned64 by call to `WPACKET_put_bytes__`
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/8ab53b193a8e95bb2998744bc184146eb1ddcc23/ssl/packet.c/#L49 |
d2a_code_trace_data_42433 | static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt)
{
#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) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, 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) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, 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) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,
ERR_R_MALLOC_FAILURE);
return 0;
}
pms[0] = s->client_version >> 8;
pms[1] = s->client_version & 0xff;
if (RAND_bytes(pms + 2, (int)(pmslen - 2)) <= 0) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,
ERR_R_MALLOC_FAILURE);
goto err;
}
if (s->version > SSL3_VERSION && !WPACKET_start_sub_packet_u16(pkt)) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, 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) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, 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) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,
SSL_R_BAD_RSA_ENCRYPT);
goto err;
}
EVP_PKEY_CTX_free(pctx);
pctx = NULL;
if (s->version > SSL3_VERSION && !WPACKET_close(pkt)) {
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,
ERR_R_INTERNAL_ERROR);
goto err;
}
if (!ssl_log_rsa_client_key_exchange(s, encdata, enclen, pms, pmslen)) {
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
SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,
ERR_R_INTERNAL_ERROR);
return 0;
#endif
}
ssl/statem/statem_clnt.c:2956: error: NULL_DEREFERENCE
pointer `pkey` last assigned on line 2955 could be null and is dereferenced by call to `EVP_PKEY_get0_RSA()` at line 2956, column 9.
Showing all 30 steps of the trace
ssl/statem/statem_clnt.c:2936:1: start of procedure tls_construct_cke_rsa()
2934. }
2935.
2936. > static int tls_construct_cke_rsa(SSL *s, WPACKET *pkt)
2937. {
2938. #ifndef OPENSSL_NO_RSA
ssl/statem/statem_clnt.c:2939:5:
2937. {
2938. #ifndef OPENSSL_NO_RSA
2939. > unsigned char *encdata = NULL;
2940. EVP_PKEY *pkey = NULL;
2941. EVP_PKEY_CTX *pctx = NULL;
ssl/statem/statem_clnt.c:2940:5:
2938. #ifndef OPENSSL_NO_RSA
2939. unsigned char *encdata = NULL;
2940. > EVP_PKEY *pkey = NULL;
2941. EVP_PKEY_CTX *pctx = NULL;
2942. size_t enclen;
ssl/statem/statem_clnt.c:2941:5:
2939. unsigned char *encdata = NULL;
2940. EVP_PKEY *pkey = NULL;
2941. > EVP_PKEY_CTX *pctx = NULL;
2942. size_t enclen;
2943. unsigned char *pms = NULL;
ssl/statem/statem_clnt.c:2943:5:
2941. EVP_PKEY_CTX *pctx = NULL;
2942. size_t enclen;
2943. > unsigned char *pms = NULL;
2944. size_t pmslen = 0;
2945.
ssl/statem/statem_clnt.c:2944:5:
2942. size_t enclen;
2943. unsigned char *pms = NULL;
2944. > size_t pmslen = 0;
2945.
2946. if (s->session->peer == NULL) {
ssl/statem/statem_clnt.c:2946:9: Taking false branch
2944. size_t pmslen = 0;
2945.
2946. if (s->session->peer == NULL) {
^
2947. /*
2948. * We should always have a server certificate with SSL_kRSA.
ssl/statem/statem_clnt.c:2955:5:
2953. }
2954.
2955. > pkey = X509_get0_pubkey(s->session->peer);
2956. if (EVP_PKEY_get0_RSA(pkey) == NULL) {
2957. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,
crypto/x509/x509_cmp.c:264:1: start of procedure X509_get0_pubkey()
262. }
263.
264. > EVP_PKEY *X509_get0_pubkey(const X509 *x)
265. {
266. if (x == NULL)
crypto/x509/x509_cmp.c:266:9: Taking false branch
264. EVP_PKEY *X509_get0_pubkey(const X509 *x)
265. {
266. if (x == NULL)
^
267. return NULL;
268. return X509_PUBKEY_get0(x->cert_info.key);
crypto/x509/x509_cmp.c:268:5:
266. if (x == NULL)
267. return NULL;
268. > return X509_PUBKEY_get0(x->cert_info.key);
269. }
270.
crypto/x509/x_pubkey.c:140:1: start of procedure X509_PUBKEY_get0()
138. }
139.
140. > EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key)
141. {
142. EVP_PKEY *ret = NULL;
crypto/x509/x_pubkey.c:142:5:
140. EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key)
141. {
142. > EVP_PKEY *ret = NULL;
143.
144. if (key == NULL || key->public_key == NULL)
crypto/x509/x_pubkey.c:144:9: Taking false branch
142. EVP_PKEY *ret = NULL;
143.
144. if (key == NULL || key->public_key == NULL)
^
145. return NULL;
146.
crypto/x509/x_pubkey.c:144:24: Taking false branch
142. EVP_PKEY *ret = NULL;
143.
144. if (key == NULL || key->public_key == NULL)
^
145. return NULL;
146.
crypto/x509/x_pubkey.c:147:9: Taking false branch
145. return NULL;
146.
147. if (key->pkey != NULL)
^
148. return key->pkey;
149.
crypto/x509/x_pubkey.c:158:5:
156. * in the queue.
157. */
158. > x509_pubkey_decode(&ret, key);
159. /* If decode doesn't fail something bad happened */
160. if (ret != NULL) {
crypto/x509/x_pubkey.c:103:1: start of procedure x509_pubkey_decode()
101.
102.
103. > static int x509_pubkey_decode(EVP_PKEY **ppkey, X509_PUBKEY *key)
104. {
105. EVP_PKEY *pkey = EVP_PKEY_new();
crypto/x509/x_pubkey.c:105:5: Skipping EVP_PKEY_new(): empty list of specs
103. static int x509_pubkey_decode(EVP_PKEY **ppkey, X509_PUBKEY *key)
104. {
105. EVP_PKEY *pkey = EVP_PKEY_new();
^
106.
107. if (pkey == NULL) {
crypto/x509/x_pubkey.c:107:9: Taking true branch
105. EVP_PKEY *pkey = EVP_PKEY_new();
106.
107. if (pkey == NULL) {
^
108. X509err(X509_F_X509_PUBKEY_DECODE, ERR_R_MALLOC_FAILURE);
109. return -1;
crypto/x509/x_pubkey.c:108:9: Skipping ERR_put_error(): empty list of specs
106.
107. if (pkey == NULL) {
108. X509err(X509_F_X509_PUBKEY_DECODE, ERR_R_MALLOC_FAILURE);
^
109. return -1;
110. }
crypto/x509/x_pubkey.c:109:9:
107. if (pkey == NULL) {
108. X509err(X509_F_X509_PUBKEY_DECODE, ERR_R_MALLOC_FAILURE);
109. > return -1;
110. }
111.
crypto/x509/x_pubkey.c:138:1: return from a call to x509_pubkey_decode
136. EVP_PKEY_free(pkey);
137. return 0;
138. > }
139.
140. EVP_PKEY *X509_PUBKEY_get0(X509_PUBKEY *key)
crypto/x509/x_pubkey.c:160:9: Taking false branch
158. x509_pubkey_decode(&ret, key);
159. /* If decode doesn't fail something bad happened */
160. if (ret != NULL) {
^
161. X509err(X509_F_X509_PUBKEY_GET0, ERR_R_INTERNAL_ERROR);
162. EVP_PKEY_free(ret);
crypto/x509/x_pubkey.c:165:5:
163. }
164.
165. > return NULL;
166. }
167.
crypto/x509/x_pubkey.c:166:1: return from a call to X509_PUBKEY_get0
164.
165. return NULL;
166. > }
167.
168. EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
crypto/x509/x509_cmp.c:269:1: return from a call to X509_get0_pubkey
267. return NULL;
268. return X509_PUBKEY_get0(x->cert_info.key);
269. > }
270.
271. EVP_PKEY *X509_get_pubkey(X509 *x)
ssl/statem/statem_clnt.c:2956:9:
2954.
2955. pkey = X509_get0_pubkey(s->session->peer);
2956. > if (EVP_PKEY_get0_RSA(pkey) == NULL) {
2957. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_CONSTRUCT_CKE_RSA,
2958. ERR_R_INTERNAL_ERROR);
crypto/evp/p_lib.c:461:1: start of procedure EVP_PKEY_get0_RSA()
459. }
460.
461. > RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
462. {
463. if (pkey->type != EVP_PKEY_RSA) {
crypto/evp/p_lib.c:463:9:
461. RSA *EVP_PKEY_get0_RSA(EVP_PKEY *pkey)
462. {
463. > if (pkey->type != EVP_PKEY_RSA) {
464. EVPerr(EVP_F_EVP_PKEY_GET0_RSA, EVP_R_EXPECTING_AN_RSA_KEY);
465. return NULL;
| https://github.com/openssl/openssl/blob/d5487a454c485eb6f9aef7fb0cb1c0681a06fd25/ssl/statem/statem_clnt.c/#L2956 |
d2a_code_trace_data_42434 | DECLAREContigPutFunc(putRGBUAcontig8bittile)
{
int samplesperpixel = img->samplesperpixel;
(void) y;
fromskew *= samplesperpixel;
while (h-- > 0) {
uint32 r, g, b, a;
uint8* m;
for (x = w; x-- > 0;) {
a = pp[3];
m = img->UaToAa+(a<<8);
r = m[pp[0]];
g = m[pp[1]];
b = m[pp[2]];
*cp++ = PACK4(r,g,b,a);
pp += samplesperpixel;
}
cp += toskew;
pp += fromskew;
}
}
libtiff/tif_getimage.c:1282: error: Integer Overflow L2
([0, `w`] - 1):unsigned32.
libtiff/tif_getimage.c:1274:1: <LHS trace>
1272. * (known to have Map == NULL)
1273. */
1274. DECLAREContigPutFunc(putRGBUAcontig8bittile)
^
1275. {
1276. int samplesperpixel = img->samplesperpixel;
libtiff/tif_getimage.c:1274:1: Parameter `w`
1272. * (known to have Map == NULL)
1273. */
1274. DECLAREContigPutFunc(putRGBUAcontig8bittile)
^
1275. {
1276. int samplesperpixel = img->samplesperpixel;
libtiff/tif_getimage.c:1282:8: Assignment
1280. uint32 r, g, b, a;
1281. uint8* m;
1282. for (x = w; x-- > 0;) {
^
1283. a = pp[3];
1284. m = img->UaToAa+(a<<8);
libtiff/tif_getimage.c:1282:15: Binary operation: ([0, w] - 1):unsigned32
1280. uint32 r, g, b, a;
1281. uint8* m;
1282. for (x = w; x-- > 0;) {
^
1283. a = pp[3];
1284. m = img->UaToAa+(a<<8);
| https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_getimage.c/#L1282 |
d2a_code_trace_data_42435 | void *lh_delete(LHASH *lh, 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;
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_pkt.c:772: error: INTEGER_OVERFLOW_L2
([0, `s->ctx->sessions->num_items`] - 1):unsigned64 by call to `ssl3_get_record`.
Showing all 13 steps of the trace
ssl/s3_pkt.c:710:1: Parameter `s->ctx->sessions->num_items`
708. * none of our business
709. */
710. > int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len)
711. {
712. int al,i,j,n,ret;
ssl/s3_pkt.c:772:7: Call
770. if ((rr->length == 0) || (s->rstate == SSL_ST_READ_BODY))
771. {
772. ret=ssl3_get_record(s);
^
773. if (ret <= 0) return(ret);
774. }
ssl/s3_pkt.c:231:1: Parameter `s->ctx->sessions->num_items`
229. */
230. /* used only by ssl3_read_bytes */
231. > static int ssl3_get_record(SSL *s)
232. {
233. int ssl_major,ssl_minor,al;
ssl/s3_pkt.c:431:2: Call
429. return(1);
430. f_err:
431. ssl3_send_alert(s,SSL3_AL_FATAL,al);
^
432. err:
433. return(ret);
ssl/s3_pkt.c:1142:1: Parameter `s->ctx->sessions->num_items`
1140. }
1141.
1142. > void ssl3_send_alert(SSL *s, int level, int desc)
1143. {
1144. /* Map tls/ssl alert value to correct one */
ssl/s3_pkt.c:1149:3: Call
1147. /* If a fatal one, remove from cache */
1148. if ((level == 2) && (s->session != NULL))
1149. SSL_CTX_remove_session(s->ctx,s->session);
^
1150.
1151. s->s3->alert_dispatch=1;
ssl/ssl_sess.c:413:1: Parameter `ctx->sessions->num_items`
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->num_items`
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: <LHS trace>
215. }
216.
217. > void *lh_delete(LHASH *lh, 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, void *data)
218. {
219. unsigned long hash;
crypto/lhash/lhash.c:240:2: Binary operation: ([0, s->ctx->sessions->num_items] - 1):unsigned64 by call to `ssl3_get_record`
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/dab6f09573742df94c4767663565aca3863f8173/crypto/lhash/lhash.c/#L240 |
d2a_code_trace_data_42436 | static inline void shuffle_bytes_2103_c(const uint8_t *src, uint8_t *dst, int src_size)
{
int idx = 15 - src_size;
const uint8_t *s = src-idx;
uint8_t *d = dst-idx;
for (; idx<15; idx+=4) {
register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
v &= 0xff00ff;
*(uint32_t *)&d[idx] = (v>>16) + g + (v<<16);
}
}
libswscale/rgb2rgb_template.c:335: error: Integer Overflow L2
([0, 255+min(4278255360, `*src`)] + [0, 1095233372160]):signed32.
libswscale/rgb2rgb_template.c:327:1: <LHS trace>
325. }
326.
327. static inline void shuffle_bytes_2103_c(const uint8_t *src, uint8_t *dst, int src_size)
^
328. {
329. int idx = 15 - src_size;
libswscale/rgb2rgb_template.c:327:1: Parameter `*src`
325. }
326.
327. static inline void shuffle_bytes_2103_c(const uint8_t *src, uint8_t *dst, int src_size)
^
328. {
329. int idx = 15 - src_size;
libswscale/rgb2rgb_template.c:333:9: Assignment
331. uint8_t *d = dst-idx;
332. for (; idx<15; idx+=4) {
333. register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
^
334. v &= 0xff00ff;
335. *(uint32_t *)&d[idx] = (v>>16) + g + (v<<16);
libswscale/rgb2rgb_template.c:333:9: Assignment
331. uint8_t *d = dst-idx;
332. for (; idx<15; idx+=4) {
333. register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
^
334. v &= 0xff00ff;
335. *(uint32_t *)&d[idx] = (v>>16) + g + (v<<16);
libswscale/rgb2rgb_template.c:327:1: <RHS trace>
325. }
326.
327. static inline void shuffle_bytes_2103_c(const uint8_t *src, uint8_t *dst, int src_size)
^
328. {
329. int idx = 15 - src_size;
libswscale/rgb2rgb_template.c:327:1: Parameter `*src`
325. }
326.
327. static inline void shuffle_bytes_2103_c(const uint8_t *src, uint8_t *dst, int src_size)
^
328. {
329. int idx = 15 - src_size;
libswscale/rgb2rgb_template.c:333:9: Assignment
331. uint8_t *d = dst-idx;
332. for (; idx<15; idx+=4) {
333. register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
^
334. v &= 0xff00ff;
335. *(uint32_t *)&d[idx] = (v>>16) + g + (v<<16);
libswscale/rgb2rgb_template.c:334:9: Assignment
332. for (; idx<15; idx+=4) {
333. register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
334. v &= 0xff00ff;
^
335. *(uint32_t *)&d[idx] = (v>>16) + g + (v<<16);
336. }
libswscale/rgb2rgb_template.c:335:9: Binary operation: ([0, 255+min(4278255360, *src)] + [0, 1095233372160]):signed32
333. register int v = *(const uint32_t *)&s[idx], g = v & 0xff00ff00;
334. v &= 0xff00ff;
335. *(uint32_t *)&d[idx] = (v>>16) + g + (v<<16);
^
336. }
337. }
| https://github.com/libav/libav/blob/e01e05ee66f7ea26dd7574501e329aa5b8e788ef/libswscale/rgb2rgb_template.c/#L335 |
d2a_code_trace_data_42437 | static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose)
{
size_t packlen = pkt->written - sub->pwritten;
if (packlen == 0
&& (sub->flags & WPACKET_FLAGS_NON_ZERO_LENGTH) != 0)
return 0;
if (packlen == 0
&& sub->flags & WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH) {
if (!doclose)
return 0;
if ((pkt->curr - sub->lenbytes) == sub->packet_len) {
pkt->written -= sub->lenbytes;
pkt->curr -= sub->lenbytes;
}
sub->packet_len = 0;
sub->lenbytes = 0;
}
if (sub->lenbytes > 0
&& !put_value(&GETBUF(pkt)[sub->packet_len], packlen,
sub->lenbytes))
return 0;
if (doclose) {
pkt->subs = sub->parent;
OPENSSL_free(sub);
}
return 1;
}
test/wpackettest.c:192: error: INTEGER_OVERFLOW_L2
([0, +oo] - [0, 1]):unsigned64 by call to `WPACKET_close`.
Showing all 11 steps of the trace
test/wpackettest.c:190:17: Call
188. /* Single sub-packet with length prefix */
189. if (!TEST_true(WPACKET_init(&pkt, buf))
190. || !TEST_true(WPACKET_start_sub_packet_u8(&pkt))
^
191. || !TEST_true(WPACKET_put_bytes_u8(&pkt, 0xff))
192. || !TEST_true(WPACKET_close(&pkt))
ssl/packet.c:275:1: Parameter `lenbytes`
273. }
274.
275. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes)
276. {
277. WPACKET_SUB *sub;
ssl/packet.c:292:5: Assignment
290. pkt->subs = sub;
291. sub->pwritten = pkt->written + lenbytes;
292. sub->lenbytes = lenbytes;
^
293.
294. if (lenbytes == 0) {
test/wpackettest.c:192:17: Call
190. || !TEST_true(WPACKET_start_sub_packet_u8(&pkt))
191. || !TEST_true(WPACKET_put_bytes_u8(&pkt, 0xff))
192. || !TEST_true(WPACKET_close(&pkt))
^
193. || !TEST_true(WPACKET_finish(&pkt))
194. || !TEST_true(WPACKET_get_total_written(&pkt, &written))
ssl/packet.c:243:1: Parameter `pkt->curr`
241. }
242.
243. > int WPACKET_close(WPACKET *pkt)
244. {
245. /*
ssl/packet.c:252:12: Call
250. return 0;
251.
252. return wpacket_intern_close(pkt, pkt->subs, 1);
^
253. }
254.
ssl/packet.c:188:1: <LHS trace>
186. * (i.e. it fills in all the lengths), but doesn't actually close anything.
187. */
188. > static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose)
189. {
190. size_t packlen = pkt->written - sub->pwritten;
ssl/packet.c:188:1: Parameter `pkt->curr`
186. * (i.e. it fills in all the lengths), but doesn't actually close anything.
187. */
188. > static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose)
189. {
190. size_t packlen = pkt->written - sub->pwritten;
ssl/packet.c:188:1: <RHS trace>
186. * (i.e. it fills in all the lengths), but doesn't actually close anything.
187. */
188. > static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose)
189. {
190. size_t packlen = pkt->written - sub->pwritten;
ssl/packet.c:188:1: Parameter `sub->lenbytes`
186. * (i.e. it fills in all the lengths), but doesn't actually close anything.
187. */
188. > static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose)
189. {
190. size_t packlen = pkt->written - sub->pwritten;
ssl/packet.c:203:13: Binary operation: ([0, +oo] - [0, 1]):unsigned64 by call to `WPACKET_close`
201.
202. /* Deallocate any bytes allocated for the length of the WPACKET */
203. if ((pkt->curr - sub->lenbytes) == sub->packet_len) {
^
204. pkt->written -= sub->lenbytes;
205. pkt->curr -= sub->lenbytes;
| https://github.com/openssl/openssl/blob/424aa352458486d67e1e9cd3d3990dc06a60ba4a/ssl/packet.c/#L203 |
d2a_code_trace_data_42438 | void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
{
unsigned long hash;
OPENSSL_LH_NODE *nn, **rn;
void *ret;
lh->error = 0;
rn = getrn(lh, data, &hash);
if (*rn == NULL) {
lh->num_no_delete++;
return (NULL);
} else {
nn = *rn;
*rn = nn->next;
ret = nn->data;
OPENSSL_free(nn);
lh->num_delete++;
}
lh->num_items--;
if ((lh->num_nodes > MIN_NODES) &&
(lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
contract(lh);
return (ret);
}
apps/ciphers.c:248: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned64 by call to `SSL_free`.
Showing all 16 steps of the trace
apps/ciphers.c:188:11: Call
186. }
187. }
188. ssl = SSL_new(ctx);
^
189. if (ssl == NULL)
190. goto err;
ssl/ssl_lib.c:522:1: Parameter `ctx->sessions->num_items`
520. }
521.
522. > SSL *SSL_new(SSL_CTX *ctx)
523. {
524. SSL *s;
apps/ciphers.c:248:5: Call
246. sk_SSL_CIPHER_free(sk);
247. SSL_CTX_free(ctx);
248. SSL_free(ssl);
^
249. return (ret);
250. }
ssl/ssl_lib.c:968:1: Parameter `s->session_ctx->sessions->num_items`
966. }
967.
968. > void SSL_free(SSL *s)
969. {
970. int i;
ssl/ssl_lib.c:999:9: Call
997. /* Make the next call work :-) */
998. if (s->session != NULL) {
999. ssl_clear_bad_session(s);
^
1000. SSL_SESSION_free(s->session);
1001. }
ssl/ssl_sess.c:1049:1: Parameter `s->session_ctx->sessions->num_items`
1047. }
1048.
1049. > int ssl_clear_bad_session(SSL *s)
1050. {
1051. if ((s->session != NULL) &&
ssl/ssl_sess.c:1054:9: Call
1052. !(s->shutdown & SSL_SENT_SHUTDOWN) &&
1053. !(SSL_in_init(s) || SSL_in_before(s))) {
1054. SSL_CTX_remove_session(s->session_ctx, s->session);
^
1055. return (1);
1056. } else
ssl/ssl_sess.c:725:1: Parameter `ctx->sessions->num_items`
723. }
724.
725. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
726. {
727. return remove_session_lock(ctx, c, 1);
ssl/ssl_sess.c:727:12: Call
725. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c)
726. {
727. return remove_session_lock(ctx, c, 1);
^
728. }
729.
ssl/ssl_sess.c:730:1: Parameter `ctx->sessions->num_items`
728. }
729.
730. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck)
731. {
732. SSL_SESSION *r;
ssl/ssl_sess.c:740:17: Call
738. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) {
739. ret = 1;
740. r = lh_SSL_SESSION_delete(ctx->sessions, c);
^
741. SSL_SESSION_list_remove(ctx, c);
742. }
ssl/ssl_locl.h:721:1: Parameter `lh->num_items`
719. } TLSEXT_INDEX;
720.
721. > DEFINE_LHASH_OF(SSL_SESSION);
722. /* Needed in ssl_cert.c */
723. DEFINE_LHASH_OF(X509_NAME);
ssl/ssl_locl.h:721:1: Call
719. } TLSEXT_INDEX;
720.
721. > DEFINE_LHASH_OF(SSL_SESSION);
722. /* Needed in ssl_cert.c */
723. DEFINE_LHASH_OF(X509_NAME);
crypto/lhash/lhash.c:103:1: <LHS trace>
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:103:1: Parameter `lh->num_items`
101. }
102.
103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data)
104. {
105. unsigned long hash;
crypto/lhash/lhash.c:123:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `SSL_free`
121. }
122.
123. lh->num_items--;
^
124. if ((lh->num_nodes > MIN_NODES) &&
125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
| https://github.com/openssl/openssl/blob/7f7eb90b8ac55997c5c825bb3ebcfe28611e06f5/crypto/lhash/lhash.c/#L123 |
d2a_code_trace_data_42439 | int BN_set_word(BIGNUM *a, BN_ULONG w)
{
bn_check_top(a);
if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
return (0);
a->neg = 0;
a->d[0] = w;
a->top = (w ? 1 : 0);
bn_check_top(a);
return (1);
}
crypto/dh/dh_check.c:154: error: BUFFER_OVERRUN_L3
Offset: 0 Size: [0, 8388607] by call to `BN_set_word`.
Showing all 7 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:154:25: Call
152. BN_CTX_start(ctx);
153. tmp = BN_CTX_get(ctx);
154. if (tmp == NULL || !BN_set_word(tmp, 1))
^
155. goto err;
156. if (BN_cmp(pub_key, tmp) <= 0)
crypto/bn/bn_lib.c:520:1: <Length trace>
518. }
519.
520. > int BN_set_word(BIGNUM *a, BN_ULONG w)
521. {
522. bn_check_top(a);
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:526:5: Array access: Offset: 0 Size: [0, 8388607] by call to `BN_set_word`
524. return (0);
525. a->neg = 0;
526. a->d[0] = w;
^
527. a->top = (w ? 1 : 0);
528. bn_check_top(a);
| https://github.com/openssl/openssl/blob/c10d1bc81cb047cbd53f8cc430632b6a4a70252d/crypto/bn/bn_lib.c/#L526 |
d2a_code_trace_data_42440 | static av_cold int vp3_decode_init(AVCodecContext *avctx)
{
Vp3DecodeContext *s = avctx->priv_data;
int i, inter, plane;
int c_width;
int c_height;
int y_superblock_count;
int c_superblock_count;
if (avctx->codec_tag == MKTAG('V','P','3','0'))
s->version = 0;
else
s->version = 1;
s->avctx = avctx;
s->width = (avctx->width + 15) & 0xFFFFFFF0;
s->height = (avctx->height + 15) & 0xFFFFFFF0;
avctx->pix_fmt = PIX_FMT_YUV420P;
if(avctx->idct_algo==FF_IDCT_AUTO)
avctx->idct_algo=FF_IDCT_VP3;
dsputil_init(&s->dsp, avctx);
ff_init_scantable(s->dsp.idct_permutation, &s->scantable, ff_zigzag_direct);
s->quality_index = -1;
s->y_superblock_width = (s->width + 31) / 32;
s->y_superblock_height = (s->height + 31) / 32;
y_superblock_count = s->y_superblock_width * s->y_superblock_height;
c_width = s->width / 2;
c_height = s->height / 2;
s->c_superblock_width = (c_width + 31) / 32;
s->c_superblock_height = (c_height + 31) / 32;
c_superblock_count = s->c_superblock_width * s->c_superblock_height;
s->superblock_count = y_superblock_count + (c_superblock_count * 2);
s->u_superblock_start = y_superblock_count;
s->v_superblock_start = s->u_superblock_start + c_superblock_count;
s->superblock_coding = av_malloc(s->superblock_count);
s->macroblock_width = (s->width + 15) / 16;
s->macroblock_height = (s->height + 15) / 16;
s->macroblock_count = s->macroblock_width * s->macroblock_height;
s->fragment_width = s->width / FRAGMENT_PIXELS;
s->fragment_height = s->height / FRAGMENT_PIXELS;
s->fragment_count = s->fragment_width * s->fragment_height * 3 / 2;
s->fragment_start[1] = s->fragment_width * s->fragment_height;
s->fragment_start[2] = s->fragment_width * s->fragment_height * 5 / 4;
debug_init(" Y plane: %d x %d\n", s->width, s->height);
debug_init(" C plane: %d x %d\n", c_width, c_height);
debug_init(" Y superblocks: %d x %d, %d total\n",
s->y_superblock_width, s->y_superblock_height, y_superblock_count);
debug_init(" C superblocks: %d x %d, %d total\n",
s->c_superblock_width, s->c_superblock_height, c_superblock_count);
debug_init(" total superblocks = %d, U starts @ %d, V starts @ %d\n",
s->superblock_count, s->u_superblock_start, s->v_superblock_start);
debug_init(" macroblocks: %d x %d, %d total\n",
s->macroblock_width, s->macroblock_height, s->macroblock_count);
debug_init(" %d fragments, %d x %d, u starts @ %d, v starts @ %d\n",
s->fragment_count,
s->fragment_width,
s->fragment_height,
s->fragment_start[1],
s->fragment_start[2]);
s->all_fragments = av_malloc(s->fragment_count * sizeof(Vp3Fragment));
s->coeffs = av_malloc(s->fragment_count * sizeof(Coeff) * 65);
s->coded_fragment_list = av_malloc(s->fragment_count * sizeof(int));
s->pixel_addresses_initialized = 0;
if (!s->theora_tables)
{
for (i = 0; i < 64; i++) {
s->coded_dc_scale_factor[i] = vp31_dc_scale_factor[i];
s->coded_ac_scale_factor[i] = vp31_ac_scale_factor[i];
s->base_matrix[0][i] = vp31_intra_y_dequant[i];
s->base_matrix[1][i] = vp31_intra_c_dequant[i];
s->base_matrix[2][i] = vp31_inter_dequant[i];
s->filter_limit_values[i] = vp31_filter_limit_values[i];
}
for(inter=0; inter<2; inter++){
for(plane=0; plane<3; plane++){
s->qr_count[inter][plane]= 1;
s->qr_size [inter][plane][0]= 63;
s->qr_base [inter][plane][0]=
s->qr_base [inter][plane][1]= 2*inter + (!!plane)*!inter;
}
}
for (i = 0; i < 16; i++) {
init_vlc(&s->dc_vlc[i], 5, 32,
&dc_bias[i][0][1], 4, 2,
&dc_bias[i][0][0], 4, 2, 0);
init_vlc(&s->ac_vlc_1[i], 5, 32,
&ac_bias_0[i][0][1], 4, 2,
&ac_bias_0[i][0][0], 4, 2, 0);
init_vlc(&s->ac_vlc_2[i], 5, 32,
&ac_bias_1[i][0][1], 4, 2,
&ac_bias_1[i][0][0], 4, 2, 0);
init_vlc(&s->ac_vlc_3[i], 5, 32,
&ac_bias_2[i][0][1], 4, 2,
&ac_bias_2[i][0][0], 4, 2, 0);
init_vlc(&s->ac_vlc_4[i], 5, 32,
&ac_bias_3[i][0][1], 4, 2,
&ac_bias_3[i][0][0], 4, 2, 0);
}
} else {
for (i = 0; i < 16; i++) {
init_vlc(&s->dc_vlc[i], 5, 32,
&s->huffman_table[i][0][1], 4, 2,
&s->huffman_table[i][0][0], 4, 2, 0);
init_vlc(&s->ac_vlc_1[i], 5, 32,
&s->huffman_table[i+16][0][1], 4, 2,
&s->huffman_table[i+16][0][0], 4, 2, 0);
init_vlc(&s->ac_vlc_2[i], 5, 32,
&s->huffman_table[i+16*2][0][1], 4, 2,
&s->huffman_table[i+16*2][0][0], 4, 2, 0);
init_vlc(&s->ac_vlc_3[i], 5, 32,
&s->huffman_table[i+16*3][0][1], 4, 2,
&s->huffman_table[i+16*3][0][0], 4, 2, 0);
init_vlc(&s->ac_vlc_4[i], 5, 32,
&s->huffman_table[i+16*4][0][1], 4, 2,
&s->huffman_table[i+16*4][0][0], 4, 2, 0);
}
}
init_vlc(&s->superblock_run_length_vlc, 6, 34,
&superblock_run_length_vlc_table[0][1], 4, 2,
&superblock_run_length_vlc_table[0][0], 4, 2, 0);
init_vlc(&s->fragment_run_length_vlc, 5, 30,
&fragment_run_length_vlc_table[0][1], 4, 2,
&fragment_run_length_vlc_table[0][0], 4, 2, 0);
init_vlc(&s->mode_code_vlc, 3, 8,
&mode_code_vlc_table[0][1], 2, 1,
&mode_code_vlc_table[0][0], 2, 1, 0);
init_vlc(&s->motion_vector_vlc, 6, 63,
&motion_vector_vlc_table[0][1], 2, 1,
&motion_vector_vlc_table[0][0], 2, 1, 0);
s->superblock_fragments = av_malloc(s->superblock_count * 16 * sizeof(int));
s->superblock_macroblocks = av_malloc(s->superblock_count * 4 * sizeof(int));
s->macroblock_fragments = av_malloc(s->macroblock_count * 6 * sizeof(int));
s->macroblock_coding = av_malloc(s->macroblock_count + 1);
init_block_mapping(s);
for (i = 0; i < 3; i++) {
s->current_frame.data[i] = NULL;
s->last_frame.data[i] = NULL;
s->golden_frame.data[i] = NULL;
}
return 0;
}
libavcodec/vp3.c:1964: error: Integer Overflow L2
([0, 4294967280] + 31):signed32.
libavcodec/vp3.c:1936:1: <LHS trace>
1934. * This is the ffmpeg/libavcodec API init function.
1935. */
1936. static av_cold int vp3_decode_init(AVCodecContext *avctx)
^
1937. {
1938. Vp3DecodeContext *s = avctx->priv_data;
libavcodec/vp3.c:1936:1: Parameter `avctx->width`
1934. * This is the ffmpeg/libavcodec API init function.
1935. */
1936. static av_cold int vp3_decode_init(AVCodecContext *avctx)
^
1937. {
1938. Vp3DecodeContext *s = avctx->priv_data;
libavcodec/vp3.c:1951:5: Assignment
1949.
1950. s->avctx = avctx;
1951. s->width = (avctx->width + 15) & 0xFFFFFFF0;
^
1952. s->height = (avctx->height + 15) & 0xFFFFFFF0;
1953. avctx->pix_fmt = PIX_FMT_YUV420P;
libavcodec/vp3.c:1964:5: Binary operation: ([0, 4294967280] + 31):signed32
1962. s->quality_index = -1;
1963.
1964. s->y_superblock_width = (s->width + 31) / 32;
^
1965. s->y_superblock_height = (s->height + 31) / 32;
1966. y_superblock_count = s->y_superblock_width * s->y_superblock_height;
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vp3.c/#L1964 |
d2a_code_trace_data_42441 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/bn/bn_prime.c:224: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `bn_miller_rabin_is_prime`.
Showing all 67 steps of the trace
crypto/bn/bn_prime.c:187:1: Parameter `ctx_passed->stack.depth`
185.
186. /* See FIPS 186-4 C.3.1 Miller Rabin Probabilistic Primality Test. */
187. > int BN_is_prime_fasttest_ex(const BIGNUM *w, int checks, BN_CTX *ctx_passed,
188. int do_trial_division, BN_GENCB *cb)
189. {
crypto/bn/bn_prime.c:224:11: Call
222. goto err;
223.
224. ret = bn_miller_rabin_is_prime(w, checks, ctx, cb, 0, &status);
^
225. if (!ret)
226. goto err;
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_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_miller_rabin_is_prime`
266. static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
^
269. }
270.
| https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_ctx.c/#L268 |
d2a_code_trace_data_42442 | void gf_mul(gf_s * RESTRICT cs, const gf as, const gf bs)
{
const uint32_t *a = as->limb, *b = bs->limb;
uint32_t *c = cs->limb;
uint64_t accum0 = 0, accum1 = 0, accum2 = 0;
uint32_t mask = (1 << 28) - 1;
uint32_t aa[8], bb[8];
int i, j;
for (i = 0; i < 8; i++) {
aa[i] = a[i] + a[i + 8];
bb[i] = b[i] + b[i + 8];
}
FOR_LIMB(j, 0, 8, {
accum2 = 0;
FOR_LIMB(i, 0, j + 1, {
accum2 += widemul(a[j - i], b[i]);
accum1 += widemul(aa[j - i], bb[i]);
accum0 += widemul(a[8 + j - i], b[8 + i]);
}
); accum1 -= accum2; accum0 += accum2;
accum2 = 0;
FOR_LIMB(i, j + 1, 8, {
accum0 -=
widemul(a[8 + j - i], b[i]);
accum2 +=
widemul(aa[8 + j - i],
bb[i]);
accum1 += widemul(a[16 + j - i], b[8 + i]);
}
);
accum1 += accum2;
accum0 += accum2;
c[j] = ((uint32_t)(accum0)) & mask;
c[j + 8] = ((uint32_t)(accum1)) & mask;
accum0 >>= 28; accum1 >>= 28;
});
accum0 += accum1;
accum0 += c[8];
accum1 += c[0];
c[8] = ((uint32_t)(accum0)) & mask;
c[0] = ((uint32_t)(accum1)) & mask;
accum0 >>= 28;
accum1 >>= 28;
c[9] += ((uint32_t)(accum0));
c[1] += ((uint32_t)(accum1));
}
crypto/ec/curve448/arch_32/f_impl.c:37: error: BUFFER_OVERRUN_L2
Offset: [1, 14] Size: 8.
Showing all 5 steps of the trace
crypto/ec/curve448/arch_32/f_impl.c:37:5: <Offset trace>
35. }
36.
37. FOR_LIMB(j, 0, 8, {
^
38. accum2 = 0;
39. FOR_LIMB(i, 0, j + 1, {
crypto/ec/curve448/arch_32/f_impl.c:37:5: Assignment
35. }
36.
37. FOR_LIMB(j, 0, 8, {
^
38. accum2 = 0;
39. FOR_LIMB(i, 0, j + 1, {
crypto/ec/curve448/arch_32/f_impl.c:23:1: <Length trace>
21. #endif
22.
23. > void gf_mul(gf_s * RESTRICT cs, const gf as, const gf bs)
24. {
25. const uint32_t *a = as->limb, *b = bs->limb;
crypto/ec/curve448/arch_32/f_impl.c:23:1: Array declaration
21. #endif
22.
23. > void gf_mul(gf_s * RESTRICT cs, const gf as, const gf bs)
24. {
25. const uint32_t *a = as->limb, *b = bs->limb;
crypto/ec/curve448/arch_32/f_impl.c:37:5: Array access: Offset: [1, 14] Size: 8
35. }
36.
37. FOR_LIMB(j, 0, 8, {
^
38. accum2 = 0;
39. FOR_LIMB(i, 0, j + 1, {
| https://github.com/openssl/openssl/blob/0cdcdacc337005e08a906b2e07d4e44e3ee48138/crypto/ec/curve448/arch_32/f_impl.c/#L37 |
d2a_code_trace_data_42443 | static int add_DN_object(X509_NAME *n, char *text, const char *def,
char *value, int nid, int n_min, int n_max,
unsigned long chtype, int mval)
{
int i, ret = 0;
MS_STATIC char buf[1024];
start:
if (!batch)
BIO_printf(bio_err, "%s [%s]:", text, def);
(void)BIO_flush(bio_err);
if (value != NULL) {
BUF_strlcpy(buf, value, sizeof buf);
BUF_strlcat(buf, "\n", sizeof buf);
BIO_printf(bio_err, "%s\n", value);
} else {
buf[0] = '\0';
if (!batch) {
if (!fgets(buf, sizeof buf, stdin))
return 0;
} else {
buf[0] = '\n';
buf[1] = '\0';
}
}
if (buf[0] == '\0')
return (0);
else if (buf[0] == '\n') {
if ((def == NULL) || (def[0] == '\0'))
return (1);
BUF_strlcpy(buf, def, sizeof buf);
BUF_strlcat(buf, "\n", sizeof buf);
} else if ((buf[0] == '.') && (buf[1] == '\n'))
return (1);
i = strlen(buf);
if (buf[i - 1] != '\n') {
BIO_printf(bio_err, "weird input :-(\n");
return (0);
}
buf[--i] = '\0';
#ifdef CHARSET_EBCDIC
ebcdic2ascii(buf, buf, i);
#endif
if (!req_check_len(i, n_min, n_max)) {
if (batch || value)
return 0;
goto start;
}
if (!X509_NAME_add_entry_by_NID(n, nid, chtype,
(unsigned char *)buf, -1, -1, mval))
goto err;
ret = 1;
err:
return (ret);
}
apps/req.c:1388: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: 1024.
Showing all 6 steps of the trace
apps/req.c:1352:1: <Offset trace>
1350. }
1351.
1352. > static int add_DN_object(X509_NAME *n, char *text, const char *def,
1353. char *value, int nid, int n_min, int n_max,
1354. unsigned long chtype, int mval)
apps/req.c:1352:1: Array declaration
1350. }
1351.
1352. > static int add_DN_object(X509_NAME *n, char *text, const char *def,
1353. char *value, int nid, int n_min, int n_max,
1354. unsigned long chtype, int mval)
apps/req.c:1387:5: Assignment
1385. return (1);
1386.
1387. i = strlen(buf);
^
1388. if (buf[i - 1] != '\n') {
1389. BIO_printf(bio_err, "weird input :-(\n");
apps/req.c:1352:1: <Length trace>
1350. }
1351.
1352. > static int add_DN_object(X509_NAME *n, char *text, const char *def,
1353. char *value, int nid, int n_min, int n_max,
1354. unsigned long chtype, int mval)
apps/req.c:1352:1: Array declaration
1350. }
1351.
1352. > static int add_DN_object(X509_NAME *n, char *text, const char *def,
1353. char *value, int nid, int n_min, int n_max,
1354. unsigned long chtype, int mval)
apps/req.c:1388:9: Array access: Offset: [-1, +oo] Size: 1024
1386.
1387. i = strlen(buf);
1388. if (buf[i - 1] != '\n') {
^
1389. BIO_printf(bio_err, "weird input :-(\n");
1390. return (0);
| https://github.com/openssl/openssl/blob/9c46f4b9cd4912b61cb546c48b678488d7f26ed6/apps/req.c/#L1388 |
d2a_code_trace_data_42444 | ngx_int_t
ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names, ngx_uint_t nelts)
{
u_char *elts;
size_t len;
u_short *test;
ngx_uint_t i, n, key, size, start, bucket_size;
ngx_hash_elt_t *elt, **buckets;
for (n = 0; n < nelts; n++) {
if (names[n].key.len >= 255) {
ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0,
"the \"%V\" value to hash is to long: %uz bytes, "
"the maximum length can be 255 bytes only",
&names[n].key, names[n].key.len);
return NGX_ERROR;
}
if (hinit->bucket_size < NGX_HASH_ELT_SIZE(&names[n]) + sizeof(void *))
{
ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0,
"could not build the %s, you should "
"increase %s_bucket_size: %i",
hinit->name, hinit->name, hinit->bucket_size);
return NGX_ERROR;
}
}
test = ngx_alloc(hinit->max_size * sizeof(u_short), hinit->pool->log);
if (test == NULL) {
return NGX_ERROR;
}
bucket_size = hinit->bucket_size - sizeof(void *);
start = nelts / (bucket_size / (2 * sizeof(void *)));
start = start ? start : 1;
if (hinit->max_size > 10000 && hinit->max_size / nelts < 100) {
start = hinit->max_size - 1000;
}
for (size = start; size < hinit->max_size; size++) {
ngx_memzero(test, size * sizeof(u_short));
for (n = 0; n < nelts; n++) {
if (names[n].key.data == NULL) {
continue;
}
key = names[n].key_hash % size;
test[key] = (u_short) (test[key] + NGX_HASH_ELT_SIZE(&names[n]));
#if 0
ngx_log_error(NGX_LOG_ALERT, hinit->pool->log, 0,
"%ui: %ui %ui \"%V\"",
size, key, test[key], &names[n].key);
#endif
if (test[key] > (u_short) bucket_size) {
goto next;
}
}
goto found;
next:
continue;
}
ngx_log_error(NGX_LOG_EMERG, hinit->pool->log, 0,
"could not build the %s, you should increase "
"either %s_max_size: %i or %s_bucket_size: %i",
hinit->name, hinit->name, hinit->max_size,
hinit->name, hinit->bucket_size);
ngx_free(test);
return NGX_ERROR;
found:
for (i = 0; i < size; i++) {
test[i] = sizeof(void *);
}
for (n = 0; n < nelts; n++) {
if (names[n].key.data == NULL) {
continue;
}
key = names[n].key_hash % size;
test[key] = (u_short) (test[key] + NGX_HASH_ELT_SIZE(&names[n]));
}
len = 0;
for (i = 0; i < size; i++) {
if (test[i] == sizeof(void *)) {
continue;
}
test[i] = (u_short) (ngx_align(test[i], ngx_cacheline_size));
len += test[i];
}
if (hinit->hash == NULL) {
hinit->hash = ngx_pcalloc(hinit->pool, sizeof(ngx_hash_wildcard_t)
+ size * sizeof(ngx_hash_elt_t *));
if (hinit->hash == NULL) {
ngx_free(test);
return NGX_ERROR;
}
buckets = (ngx_hash_elt_t **)
((u_char *) hinit->hash + sizeof(ngx_hash_wildcard_t));
} else {
buckets = ngx_pcalloc(hinit->pool, size * sizeof(ngx_hash_elt_t *));
if (buckets == NULL) {
ngx_free(test);
return NGX_ERROR;
}
}
elts = ngx_palloc(hinit->pool, len + ngx_cacheline_size);
if (elts == NULL) {
ngx_free(test);
return NGX_ERROR;
}
elts = ngx_align_ptr(elts, ngx_cacheline_size);
for (i = 0; i < size; i++) {
if (test[i] == sizeof(void *)) {
continue;
}
buckets[i] = (ngx_hash_elt_t *) elts;
elts += test[i];
}
for (i = 0; i < size; i++) {
test[i] = 0;
}
for (n = 0; n < nelts; n++) {
if (names[n].key.data == NULL) {
continue;
}
key = names[n].key_hash % size;
elt = (ngx_hash_elt_t *) ((u_char *) buckets[key] + test[key]);
elt->value = names[n].value;
elt->len = (u_char) names[n].key.len;
ngx_strlow(elt->name, names[n].key.data, names[n].key.len);
test[key] = (u_short) (test[key] + NGX_HASH_ELT_SIZE(&names[n]));
}
for (i = 0; i < size; i++) {
if (buckets[i] == NULL) {
continue;
}
elt = (ngx_hash_elt_t *) ((u_char *) buckets[i] + test[i]);
elt->value = NULL;
}
ngx_free(test);
hinit->hash->buckets = buckets;
hinit->hash->size = size;
#if 0
for (i = 0; i < size; i++) {
ngx_str_t val;
ngx_uint_t key;
elt = buckets[i];
if (elt == NULL) {
ngx_log_error(NGX_LOG_ALERT, hinit->pool->log, 0,
"%ui: NULL", i);
continue;
}
while (elt->value) {
val.len = elt->len;
val.data = &elt->name[0];
key = hinit->key(val.data, val.len);
ngx_log_error(NGX_LOG_ALERT, hinit->pool->log, 0,
"%ui: %p \"%V\" %ui", i, elt, &val, key);
elt = (ngx_hash_elt_t *) ngx_align_ptr(&elt->name[0] + elt->len,
sizeof(void *));
}
}
#endif
return NGX_OK;
}
src/http/modules/ngx_http_ssi_filter_module.c:2721: error: Buffer Overrun L3
Offset: [0, 1046] (⇐ [0, 24] + [0, 1022]) Size: [0, +oo] by call to `ngx_hash_init`.
src/http/modules/ngx_http_ssi_filter_module.c:2715:5: Assignment
2713. hash.hash = &smcf->hash;
2714. hash.key = ngx_hash_key;
2715. hash.max_size = 1024;
^
2716. hash.bucket_size = ngx_cacheline_size;
2717. hash.name = "ssi_command_hash";
src/http/modules/ngx_http_ssi_filter_module.c:2721:9: Call
2719. hash.temp_pool = NULL;
2720.
2721. if (ngx_hash_init(&hash, smcf->commands.keys.elts,
^
2722. smcf->commands.keys.nelts)
2723. != NGX_OK)
src/core/ngx_hash.c:250:1: <Offset trace>
248. (sizeof(void *) + ngx_align((name)->key.len + 1, sizeof(void *)))
249.
250. ngx_int_t
^
251. ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names, ngx_uint_t nelts)
252. {
src/core/ngx_hash.c:250:1: Parameter `hinit->max_size`
248. (sizeof(void *) + ngx_align((name)->key.len + 1, sizeof(void *)))
249.
250. ngx_int_t
^
251. ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names, ngx_uint_t nelts)
252. {
src/core/ngx_hash.c:250:1: <Length trace>
248. (sizeof(void *) + ngx_align((name)->key.len + 1, sizeof(void *)))
249.
250. ngx_int_t
^
251. ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names, ngx_uint_t nelts)
252. {
src/core/ngx_hash.c:250:1: Parameter `hinit->max_size`
248. (sizeof(void *) + ngx_align((name)->key.len + 1, sizeof(void *)))
249.
250. ngx_int_t
^
251. ngx_hash_init(ngx_hash_init_t *hinit, ngx_hash_key_t *names, ngx_uint_t nelts)
252. {
src/core/ngx_hash.c:371:19: Call
369.
370. } else {
371. buckets = ngx_pcalloc(hinit->pool, size * sizeof(ngx_hash_elt_t *));
^
372. if (buckets == NULL) {
373. ngx_free(test);
src/core/ngx_palloc.c:283:1: Parameter `size`
281.
282.
283. void *
^
284. ngx_pcalloc(ngx_pool_t *pool, size_t size)
285. {
src/core/ngx_palloc.c:288:9: Call
286. void *p;
287.
288. p = ngx_palloc(pool, size);
^
289. if (p) {
290. ngx_memzero(p, size);
src/core/ngx_palloc.c:125:13: Assignment
123.
124. do {
125. m = ngx_align_ptr(p->d.last, NGX_ALIGNMENT);
^
126.
127. if ((size_t) (p->d.end - m) >= size) {
src/core/ngx_palloc.c:130:17: Assignment
128. p->d.last = m + size;
129.
130. return m;
^
131. }
132.
src/core/ngx_palloc.c:288:5: Assignment
286. void *p;
287.
288. p = ngx_palloc(pool, size);
^
289. if (p) {
290. ngx_memzero(p, size);
src/core/ngx_palloc.c:293:5: Assignment
291. }
292.
293. return p;
^
294. }
295.
src/core/ngx_hash.c:371:9: Assignment
369.
370. } else {
371. buckets = ngx_pcalloc(hinit->pool, size * sizeof(ngx_hash_elt_t *));
^
372. if (buckets == NULL) {
373. ngx_free(test);
src/core/ngx_hash.c:391:9: Array access: Offset: [0, 1046] (⇐ [0, 24] + [0, 1022]) Size: [0, +oo] by call to `ngx_hash_init`
389. }
390.
391. buckets[i] = (ngx_hash_elt_t *) elts;
^
392. elts += test[i];
393.
| https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_hash.c/#L391 |
d2a_code_trace_data_42445 | int ssl3_read_n(SSL *s, int n, int max, int extend)
{
int i,len,left;
long align=0;
unsigned char *pkt;
SSL3_BUFFER *rb;
if (n <= 0) return n;
rb = &(s->s3->rbuf);
left = rb->left;
#if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=0
align = (long)rb->buf + SSL3_RT_HEADER_LENGTH;
align = (-align)&(SSL3_ALIGN_PAYLOAD-1);
#endif
if (!extend)
{
if (left == 0)
rb->offset = align;
else if (align != 0 && left >= SSL3_RT_HEADER_LENGTH)
{
pkt = rb->buf + rb->offset;
if (pkt[0] == SSL3_RT_APPLICATION_DATA
&& (pkt[3]<<8|pkt[4]) >= 128)
{
memmove (rb->buf+align,pkt,left);
rb->offset = align;
}
}
s->packet = rb->buf + rb->offset;
s->packet_length = 0;
}
if ( SSL_version(s) == DTLS1_VERSION &&
extend)
{
if ( left > 0 && n > left)
n = left;
}
if (left >= n)
{
s->packet_length+=n;
rb->left=left-n;
rb->offset+=n;
return(n);
}
len = s->packet_length;
pkt = rb->buf+align;
if (s->packet != pkt)
{
memmove(pkt, s->packet, len+left);
s->packet = pkt;
rb->offset = len + align;
}
max = rb->len - rb->offset;
if (n > max)
{
SSLerr(SSL_F_SSL3_READ_N,ERR_R_INTERNAL_ERROR);
return -1;
}
if (!s->read_ahead)
max=n;
while (left < n)
{
clear_sys_error();
if (s->rbio != NULL)
{
s->rwstate=SSL_READING;
i=BIO_read(s->rbio,pkt+len+left, max-left);
}
else
{
SSLerr(SSL_F_SSL3_READ_N,SSL_R_READ_BIO_NOT_SET);
i = -1;
}
if (i <= 0)
{
rb->left = left;
return(i);
}
left+=i;
}
rb->offset += n;
rb->left = left - n;
s->packet_length += n;
s->rwstate=SSL_NOTHING;
return(n);
}
ssl/d1_pkt.c:551: error: BUFFER_OVERRUN_L3
Offset added: [5, +oo] Size: [0, +oo] by call to `ssl3_read_n`.
Showing all 8 steps of the trace
ssl/d1_pkt.c:522:1: Parameter `s->s3->rbuf.left`
520. */
521. /* used only by dtls1_read_bytes */
522. > int dtls1_get_record(SSL *s)
523. {
524. int ssl_major,ssl_minor,al;
ssl/d1_pkt.c:551:5: Call
549. (s->packet_length < DTLS1_RT_HEADER_LENGTH))
550. {
551. n=ssl3_read_n(s, DTLS1_RT_HEADER_LENGTH, s->s3->rbuf.len, 0);
^
552. /* read timeout is handled by dtls1_read_bytes */
553. if (n <= 0) return(n); /* error or non-blocking */
ssl/s3_pkt.c:123:1: <Offset trace>
121. static int ssl3_get_record(SSL *s);
122.
123. > int ssl3_read_n(SSL *s, int n, int max, int extend)
124. {
125. /* If extend == 0, obtain new n-byte packet; if extend == 1, increase
ssl/s3_pkt.c:123:1: Parameter `s->s3->rbuf.left`
121. static int ssl3_get_record(SSL *s);
122.
123. > int ssl3_read_n(SSL *s, int n, int max, int extend)
124. {
125. /* If extend == 0, obtain new n-byte packet; if extend == 1, increase
ssl/s3_pkt.c:140:2: Assignment
138.
139. rb = &(s->s3->rbuf);
140. left = rb->left;
^
141. #if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=0
142. align = (long)rb->buf + SSL3_RT_HEADER_LENGTH;
ssl/s3_pkt.c:123:1: <Length trace>
121. static int ssl3_get_record(SSL *s);
122.
123. > int ssl3_read_n(SSL *s, int n, int max, int extend)
124. {
125. /* If extend == 0, obtain new n-byte packet; if extend == 1, increase
ssl/s3_pkt.c:123:1: Parameter `*s->s3->rbuf.buf`
121. static int ssl3_get_record(SSL *s);
122.
123. > int ssl3_read_n(SSL *s, int n, int max, int extend)
124. {
125. /* If extend == 0, obtain new n-byte packet; if extend == 1, increase
ssl/s3_pkt.c:166:5: Array access: Offset added: [5, +oo] Size: [0, +oo] by call to `ssl3_read_n`
164. * arguments and therefore no buffer
165. * overrun can be triggered. */
166. memmove (rb->buf+align,pkt,left);
^
167. rb->offset = align;
168. }
| https://github.com/openssl/openssl/blob/c313e32a8b9514868f3fae09a8af025df76a4a8d/ssl/s3_pkt.c/#L166 |
d2a_code_trace_data_42446 | static void unpack_input(const unsigned char *input, unsigned int *output)
{
unsigned int outbuffer[28];
unsigned short inbuffer[10];
unsigned int x;
unsigned int *ptr;
for (x=0;x<20;x+=2)
inbuffer[x/2]=(input[x]<<8)+input[x+1];
ptr=outbuffer;
*(ptr++)=27;
*(ptr++)=(inbuffer[0]>>10)&0x3f;
*(ptr++)=(inbuffer[0]>>5)&0x1f;
*(ptr++)=inbuffer[0]&0x1f;
*(ptr++)=(inbuffer[1]>>12)&0xf;
*(ptr++)=(inbuffer[1]>>8)&0xf;
*(ptr++)=(inbuffer[1]>>5)&7;
*(ptr++)=(inbuffer[1]>>2)&7;
*(ptr++)=((inbuffer[1]<<1)&6)|((inbuffer[2]>>15)&1);
*(ptr++)=(inbuffer[2]>>12)&7;
*(ptr++)=(inbuffer[2]>>10)&3;
*(ptr++)=(inbuffer[2]>>5)&0x1f;
*(ptr++)=((inbuffer[2]<<2)&0x7c)|((inbuffer[3]>>14)&3);
*(ptr++)=(inbuffer[3]>>6)&0xff;
*(ptr++)=((inbuffer[3]<<1)&0x7e)|((inbuffer[4]>>15)&1);
*(ptr++)=(inbuffer[4]>>8)&0x7f;
*(ptr++)=(inbuffer[4]>>1)&0x7f;
*(ptr++)=((inbuffer[4]<<7)&0x80)|((inbuffer[5]>>9)&0x7f);
*(ptr++)=(inbuffer[5]>>2)&0x7f;
*(ptr++)=((inbuffer[5]<<5)&0x60)|((inbuffer[6]>>11)&0x1f);
*(ptr++)=(inbuffer[6]>>4)&0x7f;
*(ptr++)=((inbuffer[6]<<4)&0xf0)|((inbuffer[7]>>12)&0xf);
*(ptr++)=(inbuffer[7]>>5)&0x7f;
*(ptr++)=((inbuffer[7]<<2)&0x7c)|((inbuffer[8]>>14)&3);
*(ptr++)=(inbuffer[8]>>7)&0x7f;
*(ptr++)=((inbuffer[8]<<1)&0xfe)|((inbuffer[9]>>15)&1);
*(ptr++)=(inbuffer[9]>>8)&0x7f;
*(ptr++)=(inbuffer[9]>>1)&0x7f;
*(output++)=outbuffer[11];
for (x=1;x<11;*(output++)=outbuffer[x++]);
ptr=outbuffer+12;
for (x=0;x<16;x+=4)
{
*(output++)=ptr[x];
*(output++)=ptr[x+2];
*(output++)=ptr[x+3];
*(output++)=ptr[x+1];
}
}
libavcodec/ra144.c:272: error: Uninitialized Value
The value read from inbuffer[_] was never initialized.
libavcodec/ra144.c:272:3:
270. *(ptr++)=inbuffer[0]&0x1f;
271. *(ptr++)=(inbuffer[1]>>12)&0xf;
272. *(ptr++)=(inbuffer[1]>>8)&0xf;
^
273. *(ptr++)=(inbuffer[1]>>5)&7;
274. *(ptr++)=(inbuffer[1]>>2)&7;
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ra144.c/#L272 |
d2a_code_trace_data_42447 | static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
{
#ifdef BITSTREAM_READER_LE
uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1);
bc->bits >>= n;
#else
uint64_t ret = bc->bits >> (64 - n);
bc->bits <<= n;
#endif
bc->bits_left -= n;
return ret;
}
libavcodec/mpc7.c:182: error: Integer Overflow L2
([1, +oo] - [-1+max(8, `idx`), 16]):unsigned32 by call to `bitstream_read`.
libavcodec/mpc7.c:147:1: Parameter `idx`
145. * Fill samples for given subband
146. */
147. static inline void idx_to_quant(MPCContext *c, BitstreamContext *bc, int idx, int *dst)
^
148. {
149. int i, i1, t;
libavcodec/mpc7.c:182:22: Call
180. t = (1 << (idx - 2)) - 1;
181. for(i = 0; i < SAMPLES_PER_BAND; i++)
182. *dst++ = bitstream_read(bc, idx - 1) - t;
^
183. break;
184. default: // case 0 and -2..-17
libavcodec/bitstream.h:183:1: Parameter `n`
181.
182. /* Return n bits from the buffer. n has to be in the 0-32 range. */
183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n)
^
184. {
185. if (!n)
libavcodec/bitstream.h:194:12: Call
192. }
193.
194. return get_val(bc, n);
^
195. }
196.
libavcodec/bitstream.h:130:1: <LHS trace>
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:130:1: Parameter `bc->bits_left`
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:130:1: <RHS trace>
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:130:1: Parameter `n`
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:139:5: Binary operation: ([1, +oo] - [-1+max(8, idx), 16]):unsigned32 by call to `bitstream_read`
137. bc->bits <<= n;
138. #endif
139. bc->bits_left -= n;
^
140.
141. return ret;
| https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L139 |
d2a_code_trace_data_42448 | static int ssl_add_cert_to_buf(BUF_MEM *buf, unsigned long *l, X509 *x)
{
int n;
unsigned char *p;
n = i2d_X509(x, NULL);
if (n < 0 || !BUF_MEM_grow_clean(buf, (int)(n + (*l) + 3))) {
SSLerr(SSL_F_SSL_ADD_CERT_TO_BUF, ERR_R_BUF_LIB);
return 0;
}
p = (unsigned char *)&(buf->data[*l]);
l2n3(n, p);
n = i2d_X509(x, &p);
if (n < 0) {
SSLerr(SSL_F_SSL_ADD_CERT_TO_BUF, ERR_R_BUF_LIB);
return 0;
}
*l += n + 3;
return 1;
}
ssl/statem/statem_lib.c:256: error: BUFFER_OVERRUN_S2
Offset: [`s->method->ssl3_enc->hhlen` + 3, `s->method->ssl3_enc->hhlen` + 3] Size: [1, 2147483644] by call to `ssl_add_cert_chain`.
Showing all 9 steps of the trace
ssl/statem/statem_lib.c:251:1: Parameter `s->method->ssl3_enc->hhlen`
249. }
250.
251. > unsigned long ssl3_output_cert_chain(SSL *s, CERT_PKEY *cpk)
252. {
253. unsigned char *p;
ssl/statem/statem_lib.c:254:5: Assignment
252. {
253. unsigned char *p;
254. unsigned long l = 3 + SSL_HM_HEADER_LENGTH(s);
^
255.
256. if (!ssl_add_cert_chain(s, cpk, &l))
ssl/statem/statem_lib.c:256:10: Call
254. unsigned long l = 3 + SSL_HM_HEADER_LENGTH(s);
255.
256. if (!ssl_add_cert_chain(s, cpk, &l))
^
257. return 0;
258.
ssl/ssl_cert.c:771:1: Parameter `*l`
769.
770. /* Add certificate chain to internal SSL BUF_MEM structure */
771. > int ssl_add_cert_chain(SSL *s, CERT_PKEY *cpk, unsigned long *l)
772. {
773. BUF_MEM *buf = s->init_buf;
ssl/ssl_cert.c:856:14: Call
854. return 0;
855. }
856. if (!ssl_add_cert_to_buf(buf, l, x))
^
857. return 0;
858. for (i = 0; i < sk_X509_num(extra_certs); i++) {
ssl/ssl_cert.c:747:1: <Length trace>
745. /* Add a certificate to a BUF_MEM structure */
746.
747. > static int ssl_add_cert_to_buf(BUF_MEM *buf, unsigned long *l, X509 *x)
748. {
749. int n;
ssl/ssl_cert.c:747:1: Parameter `*l`
745. /* Add a certificate to a BUF_MEM structure */
746.
747. > static int ssl_add_cert_to_buf(BUF_MEM *buf, unsigned long *l, X509 *x)
748. {
749. int n;
ssl/ssl_cert.c:757:5: Assignment
755. return 0;
756. }
757. p = (unsigned char *)&(buf->data[*l]);
^
758. l2n3(n, p);
759. n = i2d_X509(x, &p);
ssl/ssl_cert.c:758:5: Array access: Offset: [s->method->ssl3_enc->hhlen + 3, s->method->ssl3_enc->hhlen + 3] Size: [1, 2147483644] by call to `ssl_add_cert_chain`
756. }
757. p = (unsigned char *)&(buf->data[*l]);
758. l2n3(n, p);
^
759. n = i2d_X509(x, &p);
760. if (n < 0) {
| https://github.com/openssl/openssl/blob/0685b15a68db1cd24678432f38b88f217495cbb9/ssl/ssl_cert.c/#L758 |
d2a_code_trace_data_42449 | int BN_set_bit(BIGNUM *a, int n)
{
int i, j, k;
if (n < 0)
return 0;
i = n / BN_BITS2;
j = n % BN_BITS2;
if (a->top <= i) {
if (bn_wexpand(a, i + 1) == NULL)
return (0);
for (k = a->top; k < i + 1; k++)
a->d[k] = 0;
a->top = i + 1;
}
a->d[i] |= (((BN_ULONG)1) << j);
bn_check_top(a);
return (1);
}
test/bntest.c:493: error: BUFFER_OVERRUN_L3
Offset: [0, 193] Size: [0, 8388607] by call to `BN_GF2m_arr2poly`.
Showing all 9 steps of the trace
test/bntest.c:480:16: Assignment
478. int i, j, st = 0;
479. int p0[] = { 163, 7, 6, 3, 0, -1 };
480. int p1[] = { 193, 15, 0, -1 };
^
481.
482. a = BN_new();
test/bntest.c:493:5: Call
491.
492. BN_GF2m_arr2poly(p0, b[0]);
493. BN_GF2m_arr2poly(p1, b[1]);
^
494.
495. for (i = 0; i < NUM0; i++) {
crypto/bn/bn_gf2m.c:1209:1: Parameter `*p`
1207. * bit-string. The array must be terminated by -1.
1208. */
1209. > int BN_GF2m_arr2poly(const int p[], BIGNUM *a)
1210. {
1211. int i;
crypto/bn/bn_gf2m.c:1216:13: Call
1214. BN_zero(a);
1215. for (i = 0; p[i] != -1; i++) {
1216. if (BN_set_bit(a, p[i]) == 0)
^
1217. return 0;
1218. }
crypto/bn/bn_lib.c:692:1: <Offset trace>
690. }
691.
692. > int BN_set_bit(BIGNUM *a, int n)
693. {
694. int i, j, k;
crypto/bn/bn_lib.c:692:1: Parameter `a->top`
690. }
691.
692. > int BN_set_bit(BIGNUM *a, int n)
693. {
694. int i, j, k;
crypto/bn/bn_lib.c:692:1: <Length trace>
690. }
691.
692. > int BN_set_bit(BIGNUM *a, int n)
693. {
694. int i, j, k;
crypto/bn/bn_lib.c:692:1: Parameter `*a->d`
690. }
691.
692. > int BN_set_bit(BIGNUM *a, int n)
693. {
694. int i, j, k;
crypto/bn/bn_lib.c:709:5: Array access: Offset: [0, 193] Size: [0, 8388607] by call to `BN_GF2m_arr2poly`
707. }
708.
709. a->d[i] |= (((BN_ULONG)1) << j);
^
710. bn_check_top(a);
711. return (1);
| https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_lib.c/#L709 |
d2a_code_trace_data_42450 | static ossl_inline void packet_forward(PACKET *pkt, size_t len)
{
pkt->curr += len;
pkt->remaining -= len;
}
ssl/statem/statem_srvr.c:3484: error: INTEGER_OVERFLOW_L2
([1, +oo] - 2):unsigned64 by call to `PACKET_copy_bytes`.
Showing all 16 steps of the trace
ssl/statem/statem_srvr.c:3482:18: Call
3480. PACKET_remaining(&sslv2ciphers) > 0;
3481. raw += TLS_CIPHER_LEN) {
3482. if (!PACKET_get_1(&sslv2ciphers, &leadbyte)
^
3483. || (leadbyte == 0
3484. && !PACKET_copy_bytes(&sslv2ciphers, raw,
ssl/packet_locl.h:271:8: Parameter `pkt->remaining`
269.
270. /* Get 1 byte from |pkt| and store the value in |*data| */
271. __owur static ossl_inline int PACKET_get_1(PACKET *pkt, unsigned int *data)
^
272. {
273. if (!PACKET_peek_1(pkt, data))
ssl/packet_locl.h:273:10: Call
271. __owur static ossl_inline int PACKET_get_1(PACKET *pkt, unsigned int *data)
272. {
273. if (!PACKET_peek_1(pkt, data))
^
274. return 0;
275.
ssl/packet_locl.h:259:8: Parameter `pkt->remaining`
257.
258. /* Peek ahead at 1 byte from |pkt| and store the value in |*data| */
259. __owur static ossl_inline int PACKET_peek_1(const PACKET *pkt,
^
260. unsigned int *data)
261. {
ssl/statem/statem_srvr.c:3482:18: Call
3480. PACKET_remaining(&sslv2ciphers) > 0;
3481. raw += TLS_CIPHER_LEN) {
3482. if (!PACKET_get_1(&sslv2ciphers, &leadbyte)
^
3483. || (leadbyte == 0
3484. && !PACKET_copy_bytes(&sslv2ciphers, raw,
ssl/packet_locl.h:271:8: Parameter `pkt->remaining`
269.
270. /* Get 1 byte from |pkt| and store the value in |*data| */
271. __owur static ossl_inline int PACKET_get_1(PACKET *pkt, unsigned int *data)
^
272. {
273. if (!PACKET_peek_1(pkt, data))
ssl/packet_locl.h:273:10: Call
271. __owur static ossl_inline int PACKET_get_1(PACKET *pkt, unsigned int *data)
272. {
273. if (!PACKET_peek_1(pkt, data))
^
274. return 0;
275.
ssl/packet_locl.h:259:8: Parameter `pkt->remaining`
257.
258. /* Peek ahead at 1 byte from |pkt| and store the value in |*data| */
259. __owur static ossl_inline int PACKET_peek_1(const PACKET *pkt,
^
260. unsigned int *data)
261. {
ssl/statem/statem_srvr.c:3484:29: Call
3482. if (!PACKET_get_1(&sslv2ciphers, &leadbyte)
3483. || (leadbyte == 0
3484. && !PACKET_copy_bytes(&sslv2ciphers, raw,
^
3485. TLS_CIPHER_LEN))
3486. || (leadbyte != 0
ssl/packet_locl.h:379:8: Parameter `len`
377. * The caller is responsible for ensuring that |data| can hold |len| bytes.
378. */
379. __owur static ossl_inline int PACKET_copy_bytes(PACKET *pkt,
^
380. unsigned char *data, size_t len)
381. {
ssl/packet_locl.h:385:5: Call
383. return 0;
384.
385. packet_forward(pkt, len);
^
386.
387. return 1;
ssl/packet_locl.h:33:1: <LHS trace>
31.
32. /* Internal unchecked shorthand; don't use outside this file. */
33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len)
34. {
35. pkt->curr += len;
ssl/packet_locl.h:33:1: Parameter `pkt->remaining`
31.
32. /* Internal unchecked shorthand; don't use outside this file. */
33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len)
34. {
35. pkt->curr += len;
ssl/packet_locl.h:33:1: <RHS trace>
31.
32. /* Internal unchecked shorthand; don't use outside this file. */
33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len)
34. {
35. pkt->curr += len;
ssl/packet_locl.h:33:1: Parameter `len`
31.
32. /* Internal unchecked shorthand; don't use outside this file. */
33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len)
34. {
35. pkt->curr += len;
ssl/packet_locl.h:36:5: Binary operation: ([1, +oo] - 2):unsigned64 by call to `PACKET_copy_bytes`
34. {
35. pkt->curr += len;
36. pkt->remaining -= len;
^
37. }
38.
| https://github.com/openssl/openssl/blob/f1429b85c5821e55224e5878da9d0fa420a41f71/ssl/packet_locl.h/#L36 |
d2a_code_trace_data_42451 | static int srp_Verify_N_and_g(const BIGNUM *N, const BIGNUM *g)
{
BN_CTX *bn_ctx = BN_CTX_new();
BIGNUM *p = BN_new();
BIGNUM *r = BN_new();
int ret =
g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) &&
BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) &&
p != NULL && BN_rshift1(p, N) &&
BN_is_prime_ex(p, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) &&
r != NULL &&
BN_mod_exp(r, g, p, N, bn_ctx) &&
BN_add_word(r, 1) && BN_cmp(r, N) == 0;
BN_free(r);
BN_free(p);
BN_CTX_free(bn_ctx);
return ret;
}
apps/s_client.c:338: error: MEMORY_LEAK
memory dynamically allocated by call to `BN_new()` at line 324, column 17 is not reachable after line 338, column 5.
Showing all 115 steps of the trace
apps/s_client.c:321:1: start of procedure srp_Verify_N_and_g()
319. # define SRP_NUMBER_ITERATIONS_FOR_PRIME 64
320.
321. > static int srp_Verify_N_and_g(const BIGNUM *N, const BIGNUM *g)
322. {
323. BN_CTX *bn_ctx = BN_CTX_new();
apps/s_client.c:323:5:
321. static int srp_Verify_N_and_g(const BIGNUM *N, const BIGNUM *g)
322. {
323. > BN_CTX *bn_ctx = BN_CTX_new();
324. BIGNUM *p = BN_new();
325. BIGNUM *r = BN_new();
crypto/bn/bn_ctx.c:189:1: start of procedure BN_CTX_new()
187.
188.
189. > BN_CTX *BN_CTX_new(void)
190. {
191. BN_CTX *ret;
crypto/bn/bn_ctx.c:193:9:
191. BN_CTX *ret;
192.
193. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE);
195. return NULL;
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_ctx.c:193:9: Taking false branch
191. BN_CTX *ret;
192.
193. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE);
195. return NULL;
crypto/bn/bn_ctx.c:198:5:
196. }
197. /* Initialise the structure */
198. > BN_POOL_init(&ret->pool);
199. BN_STACK_init(&ret->stack);
200. return ret;
crypto/bn/bn_ctx.c:335:1: start of procedure BN_POOL_init()
333. /***********/
334.
335. > static void BN_POOL_init(BN_POOL *p)
336. {
337. p->head = p->current = p->tail = NULL;
crypto/bn/bn_ctx.c:337:5:
335. static void BN_POOL_init(BN_POOL *p)
336. {
337. > p->head = p->current = p->tail = NULL;
338. p->used = p->size = 0;
339. }
crypto/bn/bn_ctx.c:338:5:
336. {
337. p->head = p->current = p->tail = NULL;
338. > p->used = p->size = 0;
339. }
340.
crypto/bn/bn_ctx.c:339:1: return from a call to BN_POOL_init
337. p->head = p->current = p->tail = NULL;
338. p->used = p->size = 0;
339. > }
340.
341. static void BN_POOL_finish(BN_POOL *p)
crypto/bn/bn_ctx.c:199:5:
197. /* Initialise the structure */
198. BN_POOL_init(&ret->pool);
199. > BN_STACK_init(&ret->stack);
200. return ret;
201. }
crypto/bn/bn_ctx.c:294:1: start of procedure BN_STACK_init()
292. /************/
293.
294. > static void BN_STACK_init(BN_STACK *st)
295. {
296. st->indexes = NULL;
crypto/bn/bn_ctx.c:296:5:
294. static void BN_STACK_init(BN_STACK *st)
295. {
296. > st->indexes = NULL;
297. st->depth = st->size = 0;
298. }
crypto/bn/bn_ctx.c:297:5:
295. {
296. st->indexes = NULL;
297. > st->depth = st->size = 0;
298. }
299.
crypto/bn/bn_ctx.c:298:1: return from a call to BN_STACK_init
296. st->indexes = NULL;
297. st->depth = st->size = 0;
298. > }
299.
300. static void BN_STACK_finish(BN_STACK *st)
crypto/bn/bn_ctx.c:200:5:
198. BN_POOL_init(&ret->pool);
199. BN_STACK_init(&ret->stack);
200. > return ret;
201. }
202.
crypto/bn/bn_ctx.c:201:1: return from a call to BN_CTX_new
199. BN_STACK_init(&ret->stack);
200. return ret;
201. > }
202.
203. BN_CTX *BN_CTX_secure_new(void)
apps/s_client.c:324:5:
322. {
323. BN_CTX *bn_ctx = BN_CTX_new();
324. > BIGNUM *p = BN_new();
325. BIGNUM *r = BN_new();
326. int ret =
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)
apps/s_client.c:325:5:
323. BN_CTX *bn_ctx = BN_CTX_new();
324. BIGNUM *p = BN_new();
325. > BIGNUM *r = BN_new();
326. int ret =
327. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) &&
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)
apps/s_client.c:327:9: Condition is true
325. BIGNUM *r = BN_new();
326. int ret =
327. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) &&
^
328. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) &&
329. p != NULL && BN_rshift1(p, N) &&
apps/s_client.c:327:22: Condition is true
325. BIGNUM *r = BN_new();
326. int ret =
327. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) &&
^
328. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) &&
329. p != NULL && BN_rshift1(p, N) &&
apps/s_client.c:327:35: Condition is true
325. BIGNUM *r = BN_new();
326. int ret =
327. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) &&
^
328. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) &&
329. p != NULL && BN_rshift1(p, N) &&
apps/s_client.c:327:53:
325. BIGNUM *r = BN_new();
326. int ret =
327. > g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) &&
328. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) &&
329. p != NULL && BN_rshift1(p, N) &&
crypto/bn/bn_lib.c:914:1: start of procedure BN_is_odd()
912. }
913.
914. > int BN_is_odd(const BIGNUM *a)
915. {
916. return (a->top > 0) && (a->d[0] & 1);
crypto/bn/bn_lib.c:916:13: Condition is true
914. int BN_is_odd(const BIGNUM *a)
915. {
916. return (a->top > 0) && (a->d[0] & 1);
^
917. }
918.
crypto/bn/bn_lib.c:916:29: Condition is false
914. int BN_is_odd(const BIGNUM *a)
915. {
916. return (a->top > 0) && (a->d[0] & 1);
^
917. }
918.
crypto/bn/bn_lib.c:916:12:
914. int BN_is_odd(const BIGNUM *a)
915. {
916. > return (a->top > 0) && (a->d[0] & 1);
917. }
918.
crypto/bn/bn_lib.c:916:5:
914. int BN_is_odd(const BIGNUM *a)
915. {
916. > return (a->top > 0) && (a->d[0] & 1);
917. }
918.
crypto/bn/bn_lib.c:917:1: return from a call to BN_is_odd
915. {
916. return (a->top > 0) && (a->d[0] & 1);
917. > }
918.
919. int BN_is_negative(const BIGNUM *a)
apps/s_client.c:327:53: Condition is false
325. BIGNUM *r = BN_new();
326. int ret =
327. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) &&
^
328. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) &&
329. p != NULL && BN_rshift1(p, N) &&
apps/s_client.c:327:9:
325. BIGNUM *r = BN_new();
326. int ret =
327. > g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) &&
328. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) &&
329. p != NULL && BN_rshift1(p, N) &&
apps/s_client.c:326:5:
324. BIGNUM *p = BN_new();
325. BIGNUM *r = BN_new();
326. > int ret =
327. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) &&
328. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) &&
apps/s_client.c:337:5:
335. BN_add_word(r, 1) && BN_cmp(r, N) == 0;
336.
337. > BN_free(r);
338. BN_free(p);
339. BN_CTX_free(bn_ctx);
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)
apps/s_client.c:338:5:
336.
337. BN_free(r);
338. > BN_free(p);
339. BN_CTX_free(bn_ctx);
340. return ret;
crypto/bn/bn_lib.c:252:1: start of procedure BN_free()
250. }
251.
252. > void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
crypto/bn/bn_lib.c:254:9: Taking false branch
252. void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
^
255. return;
256. bn_check_top(a);
crypto/bn/bn_lib.c:257:10:
255. return;
256. bn_check_top(a);
257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
963. }
964.
965. > int BN_get_flags(const BIGNUM *b, int n)
966. {
967. return b->flags & n;
crypto/bn/bn_lib.c:967:5:
965. int BN_get_flags(const BIGNUM *b, int n)
966. {
967. > return b->flags & n;
968. }
969.
crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
966. {
967. return b->flags & n;
968. > }
969.
970. /* Populate a BN_GENCB structure with an "old"-style callback */
crypto/bn/bn_lib.c:257:10: Taking false branch
255. return;
256. bn_check_top(a);
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
^
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:259:9: Taking false branch
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
^
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:263:9:
261. else {
262. #if OPENSSL_API_COMPAT < 0x00908000L
263. > a->flags |= BN_FLG_FREE;
264. #endif
265. a->d = NULL;
crypto/bn/bn_lib.c:265:9:
263. a->flags |= BN_FLG_FREE;
264. #endif
265. > a->d = NULL;
266. }
267. }
crypto/bn/bn_lib.c:259:5:
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. > if (a->flags & BN_FLG_MALLOCED)
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:267:1: return from a call to BN_free
265. a->d = NULL;
266. }
267. > }
268.
269. void bn_init(BIGNUM *a)
| https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/apps/s_client.c/#L338 |
d2a_code_trace_data_42452 | static int tm2_decode_blocks(TM2Context *ctx, AVFrame *p)
{
int i, j;
int bw, bh;
int type;
int keyframe = 1;
uint8_t *Y, *U, *V;
int *src;
bw = ctx->avctx->width >> 2;
bh = ctx->avctx->height >> 2;
for(i = 0; i < TM2_NUM_STREAMS; i++)
ctx->tok_ptrs[i] = 0;
if (ctx->tok_lens[TM2_TYPE]<bw*bh){
av_log(ctx->avctx,AV_LOG_ERROR,"Got %i tokens for %i blocks\n",ctx->tok_lens[TM2_TYPE],bw*bh);
return -1;
}
memset(ctx->last, 0, 4 * bw * sizeof(int));
memset(ctx->clast, 0, 4 * bw * sizeof(int));
for(j = 0; j < bh; j++) {
memset(ctx->D, 0, 4 * sizeof(int));
memset(ctx->CD, 0, 4 * sizeof(int));
for(i = 0; i < bw; i++) {
type = GET_TOK(ctx, TM2_TYPE);
switch(type) {
case TM2_HI_RES:
tm2_hi_res_block(ctx, p, i, j);
break;
case TM2_MED_RES:
tm2_med_res_block(ctx, p, i, j);
break;
case TM2_LOW_RES:
tm2_low_res_block(ctx, p, i, j);
break;
case TM2_NULL_RES:
tm2_null_res_block(ctx, p, i, j);
break;
case TM2_UPDATE:
tm2_update_block(ctx, p, i, j);
keyframe = 0;
break;
case TM2_STILL:
tm2_still_block(ctx, p, i, j);
keyframe = 0;
break;
case TM2_MOTION:
tm2_motion_block(ctx, p, i, j);
keyframe = 0;
break;
default:
av_log(ctx->avctx, AV_LOG_ERROR, "Skipping unknown block type %i\n", type);
}
}
}
Y = p->data[0];
src = (ctx->cur?ctx->Y2:ctx->Y1);
for(j = 0; j < ctx->avctx->height; j++){
for(i = 0; i < ctx->avctx->width; i++){
Y[i] = av_clip_uint8(*src++);
}
Y += p->linesize[0];
}
U = p->data[2];
src = (ctx->cur?ctx->U2:ctx->U1);
for(j = 0; j < (ctx->avctx->height + 1) >> 1; j++){
for(i = 0; i < (ctx->avctx->width + 1) >> 1; i++){
U[i] = av_clip_uint8(*src++);
}
U += p->linesize[2];
}
V = p->data[1];
src = (ctx->cur?ctx->V2:ctx->V1);
for(j = 0; j < (ctx->avctx->height + 1) >> 1; j++){
for(i = 0; i < (ctx->avctx->width + 1) >> 1; i++){
V[i] = av_clip_uint8(*src++);
}
V += p->linesize[1];
}
return keyframe;
}
libavcodec/truemotion2.c:696: error: Buffer Overrun L3
Offset added: 16 Size: [0, +oo].
libavcodec/truemotion2.c:672:1: <Length trace>
670. }
671.
672. static int tm2_decode_blocks(TM2Context *ctx, AVFrame *p)
^
673. {
674. int i, j;
libavcodec/truemotion2.c:672:1: Parameter `ctx->D[*]`
670. }
671.
672. static int tm2_decode_blocks(TM2Context *ctx, AVFrame *p)
^
673. {
674. int i, j;
libavcodec/truemotion2.c:696:9: Array access: Offset added: 16 Size: [0, +oo]
694.
695. for(j = 0; j < bh; j++) {
696. memset(ctx->D, 0, 4 * sizeof(int));
^
697. memset(ctx->CD, 0, 4 * sizeof(int));
698. for(i = 0; i < bw; i++) {
| https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/truemotion2.c/#L696 |
d2a_code_trace_data_42453 | static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/rsa/rsa_eay.c:227: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set_locked`.
Showing all 26 steps of the trace
crypto/rsa/rsa_eay.c:184:2: Call
182.
183. if ((ctx=BN_CTX_new()) == NULL) goto err;
184. BN_CTX_start(ctx);
^
185. f = BN_CTX_get(ctx);
186. ret = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth`
253. }
254.
255. > void BN_CTX_start(BN_CTX *ctx)
256. {
257. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/rsa/rsa_eay.c:227:8: Call
225.
226. if (rsa->flags & RSA_FLAG_CACHE_PUBLIC)
227. if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_n, CRYPTO_LOCK_RSA, rsa->n, ctx))
^
228. goto err;
229.
crypto/bn/bn_mont.c:478:1: Parameter `ctx->stack.depth`
476. }
477.
478. > BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock,
479. const BIGNUM *mod, BN_CTX *ctx)
480. {
crypto/bn/bn_mont.c:494:16: Call
492. {
493. ret = BN_MONT_CTX_new();
494. if (ret && !BN_MONT_CTX_set(ret, mod, ctx))
^
495. BN_MONT_CTX_free(ret);
496. else
crypto/bn/bn_mont.c:355:1: Parameter `ctx->stack.depth`
353. }
354.
355. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
356. {
357. int ret = 0;
crypto/bn/bn_mont.c:360:2: Call
358. BIGNUM *Ri,*R;
359.
360. BN_CTX_start(ctx);
^
361. if((Ri = BN_CTX_get(ctx)) == NULL) goto err;
362. R= &(mont->RR); /* grab RR as a temp */
crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth`
253. }
254.
255. > void BN_CTX_start(BN_CTX *ctx)
256. {
257. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_mont.c:421:8: Call
419. tmod.top = buf[0] != 0 ? 1 : 0;
420. /* Ri = R^-1 mod N*/
421. if ((BN_mod_inverse(Ri,R,&tmod,ctx)) == NULL)
^
422. goto err;
423. if (!BN_lshift(Ri,Ri,BN_BITS2)) goto err; /* R*Ri */
crypto/bn/bn_gcd.c:209:1: Parameter `ctx->stack.depth`
207. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx);
208.
209. > BIGNUM *BN_mod_inverse(BIGNUM *in,
210. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx)
211. {
crypto/bn/bn_gcd.c:218:10: Call
216. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0))
217. {
218. return BN_mod_inverse_no_branch(in, a, n, ctx);
^
219. }
220.
crypto/bn/bn_gcd.c:507:1: Parameter `ctx->stack.depth`
505. * It does not contain branches that may leak sensitive information.
506. */
507. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in,
508. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx)
509. {
crypto/bn/bn_gcd.c:519:2: Call
517. bn_check_top(n);
518.
519. BN_CTX_start(ctx);
^
520. A = BN_CTX_get(ctx);
521. B = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth`
253. }
254.
255. > void BN_CTX_start(BN_CTX *ctx)
256. {
257. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_gcd.c:548:8: Call
546. pB = &local_B;
547. BN_with_flags(pB, B, BN_FLG_CONSTTIME);
548. if (!BN_nnmod(B, pB, A, ctx)) goto err;
^
549. }
550. sign = -1;
crypto/bn/bn_mod.c:127:1: Parameter `ctx->stack.depth`
125.
126.
127. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
128. {
129. /* like BN_mod, but returns non-negative remainder
crypto/bn/bn_mod.c:132:8: Call
130. * (i.e., 0 <= r < |d| always holds) */
131.
132. if (!(BN_mod(r,m,d,ctx)))
^
133. return 0;
134. if (!r->neg)
crypto/bn/bn_div.c:181:1: Parameter `ctx->stack.depth`
179. * If 'dv' or 'rm' is NULL, the respective value is not returned.
180. */
181. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
182. BN_CTX *ctx)
183. {
crypto/bn/bn_div.c:226:2: Call
224. }
225.
226. BN_CTX_start(ctx);
^
227. tmp=BN_CTX_get(ctx);
228. snum=BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth`
253. }
254.
255. > void BN_CTX_start(BN_CTX *ctx)
256. {
257. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_div.c:441:2: Call
439. }
440. if (no_branch) bn_correct_top(res);
441. BN_CTX_end(ctx);
^
442. return(1);
443. err:
crypto/bn/bn_ctx.c:270:1: Parameter `ctx->stack.depth`
268. }
269.
270. > void BN_CTX_end(BN_CTX *ctx)
271. {
272. CTXDBG_ENTRY("BN_CTX_end", ctx);
crypto/bn/bn_ctx.c:277:21: Call
275. else
276. {
277. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
278. /* Does this stack frame have anything to release? */
279. if(fp < ctx->used)
crypto/bn/bn_ctx.c:351:1: <LHS trace>
349. }
350.
351. > static unsigned int BN_STACK_pop(BN_STACK *st)
352. {
353. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:351:1: Parameter `st->depth`
349. }
350.
351. > static unsigned int BN_STACK_pop(BN_STACK *st)
352. {
353. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:353:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set_locked`
351. static unsigned int BN_STACK_pop(BN_STACK *st)
352. {
353. return st->indexes[--(st->depth)];
^
354. }
355.
| https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/bn/bn_ctx.c/#L353 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.