id
stringlengths 25
25
| content
stringlengths 649
72.1k
| max_stars_repo_path
stringlengths 91
133
|
|---|---|---|
d2a_code_trace_data_42054
|
static int parse_oct(const char *t[], PROPERTY_DEFINITION *res)
{
const char *s = *t;
int64_t v = 0;
if (*s == '9' || *s == '8' || !ossl_isdigit(*s))
return 0;
do {
v = (v << 3) + (*s - '0');
} while (ossl_isdigit(*++s) && *s != '9' && *s != '8');
if (!ossl_isspace(*s) && *s != '\0' && *s != ',') {
ERR_raise_data(ERR_LIB_PROP, PROP_R_NOT_AN_OCTAL_DIGIT,
"HERE-->%s", *t);
return 0;
}
*t = skip_space(s);
res->type = PROPERTY_TYPE_NUMBER;
res->v.int_val = v;
return 1;
}
test/property_test.c:243: error: BUFFER_OVERRUN_L3
Offset: [2, +oo] (⇐ [1, +oo] + 1) Size: [1, 11] by call to `ossl_method_store_add`.
Showing all 23 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:274:9: Assignment
272. r = parse_hex(&s, res);
273. } else if (*s == '0' && ossl_isdigit(s[1])) {
274. s++;
^
275. r = parse_oct(&s, res);
276. } else if (ossl_isdigit(*s)) {
crypto/property/property_parse.c:275:13: Call
273. } else if (*s == '0' && ossl_isdigit(s[1])) {
274. s++;
275. r = parse_oct(&s, res);
^
276. } else if (ossl_isdigit(*s)) {
277. return parse_number(t, res);
crypto/property/property_parse.c:169:1: <Length trace>
167. }
168.
169. > static int parse_oct(const char *t[], PROPERTY_DEFINITION *res)
170. {
171. const char *s = *t;
crypto/property/property_parse.c:169:1: Parameter `**t`
167. }
168.
169. > static int parse_oct(const char *t[], PROPERTY_DEFINITION *res)
170. {
171. const char *s = *t;
crypto/property/property_parse.c:171:5: Assignment
169. static int parse_oct(const char *t[], PROPERTY_DEFINITION *res)
170. {
171. const char *s = *t;
^
172. int64_t v = 0;
173.
crypto/property/property_parse.c:178:14: Array access: Offset: [2, +oo] (⇐ [1, +oo] + 1) Size: [1, 11] by call to `ossl_method_store_add`
176. do {
177. v = (v << 3) + (*s - '0');
178. } while (ossl_isdigit(*++s) && *s != '9' && *s != '8');
^
179. if (!ossl_isspace(*s) && *s != '\0' && *s != ',') {
180. ERR_raise_data(ERR_LIB_PROP, PROP_R_NOT_AN_OCTAL_DIGIT,
|
https://github.com/openssl/openssl/blob/c1d56231ef6385b557ec72eec508e55ea26ca8b0/crypto/property/property_parse.c/#L178
|
d2a_code_trace_data_42055
|
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);
a->flags &= ~BN_FLG_FIXED_TOP;
bn_check_top(a);
return 1;
}
test/rsa_sp800_56b_test.c:356: error: BUFFER_OVERRUN_L3
Offset: 0 Size: [0, 8388607] by call to `BN_set_word`.
Showing all 10 steps of the trace
test/rsa_sp800_56b_test.c:355:14: Call
353. && TEST_ptr(q = BN_new())
354. && TEST_ptr(e = BN_new())
355. && TEST_true(BN_set_word(p, P))
^
356. && TEST_true(BN_set_word(q, Q))
357. && TEST_true(BN_set_word(e, E))
crypto/bn/bn_lib.c:361:1: Parameter `*a->d`
359. }
360.
361. > int BN_set_word(BIGNUM *a, BN_ULONG w)
362. {
363. bn_check_top(a);
crypto/bn/bn_lib.c:364:9: Call
362. {
363. bn_check_top(a);
364. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
365. return 0;
366. a->neg = 0;
crypto/bn/bn_lcl.h:660:1: Parameter `*a->d`
658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
659.
660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
661. {
662. if (bits > (INT_MAX - BN_BITS2 + 1))
test/rsa_sp800_56b_test.c:356:14: Call
354. && TEST_ptr(e = BN_new())
355. && TEST_true(BN_set_word(p, P))
356. && TEST_true(BN_set_word(q, Q))
^
357. && TEST_true(BN_set_word(e, E))
358. && TEST_true(RSA_set0_factors(key, p, q));
crypto/bn/bn_lib.c:361:1: <Length trace>
359. }
360.
361. > int BN_set_word(BIGNUM *a, BN_ULONG w)
362. {
363. bn_check_top(a);
crypto/bn/bn_lib.c:361:1: Parameter `*a->d`
359. }
360.
361. > int BN_set_word(BIGNUM *a, BN_ULONG w)
362. {
363. bn_check_top(a);
crypto/bn/bn_lib.c:364:9: Call
362. {
363. bn_check_top(a);
364. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
365. return 0;
366. a->neg = 0;
crypto/bn/bn_lcl.h:660:1: Parameter `*a->d`
658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
659.
660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
661. {
662. if (bits > (INT_MAX - BN_BITS2 + 1))
crypto/bn/bn_lib.c:367:5: Array access: Offset: 0 Size: [0, 8388607] by call to `BN_set_word`
365. return 0;
366. a->neg = 0;
367. a->d[0] = w;
^
368. a->top = (w ? 1 : 0);
369. a->flags &= ~BN_FLG_FIXED_TOP;
|
https://github.com/openssl/openssl/blob/260a16f33682a819414fcba6161708a5e6bdff50/crypto/bn/bn_lib.c/#L367
|
d2a_code_trace_data_42056
|
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:251: error: Integer Overflow L2
([1, +oo] - 4):unsigned32 by call to `bitstream_read`.
libavcodec/mpc7.c:251:36: Call
249. t = bitstream_read_vlc(&bc, hdr_vlc.table, MPC7_HDR_BITS, 1) - 5;
250. if (t == 4)
251. bands[i].res[ch] = bitstream_read(&bc, 4);
^
252. else bands[i].res[ch] = av_clip(bands[i-1].res[ch] + t, 0, 17);
253. }
libavcodec/bitstream.h:183:1: Parameter `n`
181.
182. /* Return n bits from the buffer. n has to be in the 0-32 range. */
183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n)
^
184. {
185. if (!n)
libavcodec/bitstream.h:194:12: Call
192. }
193.
194. return get_val(bc, n);
^
195. }
196.
libavcodec/bitstream.h:130:1: <LHS trace>
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:130:1: Parameter `bc->bits_left`
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:130:1: <RHS trace>
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:130:1: Parameter `n`
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:139:5: Binary operation: ([1, +oo] - 4):unsigned32 by call to `bitstream_read`
137. bc->bits <<= n;
138. #endif
139. bc->bits_left -= n;
^
140.
141. return ret;
|
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L139
|
d2a_code_trace_data_42057
|
EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md)
{
ssl_clear_hash_ctx(hash);
*hash = EVP_MD_CTX_new();
if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
EVP_MD_CTX_free(*hash);
*hash = NULL;
return NULL;
}
return *hash;
}
ssl/ssl_lib.c:3167: error: NULL_DEREFERENCE
pointer `*hash` last assigned on line 3165 could be null and is dereferenced by call to `EVP_MD_CTX_free()` at line 3167, column 9.
Showing all 26 steps of the trace
ssl/ssl_lib.c:3162:1: start of procedure ssl_replace_hash()
3160. */
3161.
3162. > EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md)
3163. {
3164. ssl_clear_hash_ctx(hash);
ssl/ssl_lib.c:3164:5:
3162. EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md)
3163. {
3164. > ssl_clear_hash_ctx(hash);
3165. *hash = EVP_MD_CTX_new();
3166. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
ssl/ssl_lib.c:3174:1: start of procedure ssl_clear_hash_ctx()
3172. }
3173.
3174. > void ssl_clear_hash_ctx(EVP_MD_CTX **hash)
3175. {
3176.
ssl/ssl_lib.c:3177:9: Taking false branch
3175. {
3176.
3177. if (*hash)
^
3178. EVP_MD_CTX_free(*hash);
3179. *hash = NULL;
ssl/ssl_lib.c:3179:5:
3177. if (*hash)
3178. EVP_MD_CTX_free(*hash);
3179. > *hash = NULL;
3180. }
3181.
ssl/ssl_lib.c:3180:1: return from a call to ssl_clear_hash_ctx
3178. EVP_MD_CTX_free(*hash);
3179. *hash = NULL;
3180. > }
3181.
3182. /* Retrieve handshake hashes */
ssl/ssl_lib.c:3165:5:
3163. {
3164. ssl_clear_hash_ctx(hash);
3165. > *hash = EVP_MD_CTX_new();
3166. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
3167. EVP_MD_CTX_free(*hash);
crypto/evp/digest.c:153:1: start of procedure EVP_MD_CTX_new()
151. }
152.
153. > EVP_MD_CTX *EVP_MD_CTX_new(void)
154. {
155. return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
crypto/evp/digest.c:155:5:
153. EVP_MD_CTX *EVP_MD_CTX_new(void)
154. {
155. > return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
156. }
157.
crypto/mem.c:312:1: start of procedure CRYPTO_zalloc()
310. }
311.
312. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
313. {
314. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:314:5:
312. void *CRYPTO_zalloc(size_t num, const char *file, int line)
313. {
314. > void *ret = CRYPTO_malloc(num, file, line);
315.
316. if (ret != NULL)
crypto/mem.c:279:1: start of procedure CRYPTO_malloc()
277. }
278.
279. > void *CRYPTO_malloc(size_t num, const char *file, int line)
280. {
281. void *ret = NULL;
crypto/mem.c:281:5:
279. void *CRYPTO_malloc(size_t num, const char *file, int line)
280. {
281. > void *ret = NULL;
282.
283. if (num <= 0)
crypto/mem.c:283:9: Taking false branch
281. void *ret = NULL;
282.
283. if (num <= 0)
^
284. return NULL;
285.
crypto/mem.c:286:9: Taking false branch
284. return NULL;
285.
286. if (allow_customize)
^
287. allow_customize = 0;
288. if (malloc_debug_func != NULL) {
crypto/mem.c:288:9: Taking false branch
286. if (allow_customize)
287. allow_customize = 0;
288. if (malloc_debug_func != NULL) {
^
289. if (allow_customize_debug)
290. allow_customize_debug = 0;
crypto/mem.c:293:5: Skipping __function_pointer__(): unresolved function pointer
291. malloc_debug_func(NULL, num, file, line, 0);
292. }
293. ret = malloc_ex_func(num, file, line);
^
294. if (malloc_debug_func != NULL)
295. malloc_debug_func(ret, num, file, line, 1);
crypto/mem.c:294:9: Taking false branch
292. }
293. ret = malloc_ex_func(num, file, line);
294. if (malloc_debug_func != NULL)
^
295. malloc_debug_func(ret, num, file, line, 1);
296.
crypto/mem.c:309:5:
307. #endif
308.
309. > return ret;
310. }
311.
crypto/mem.c:310:1: return from a call to CRYPTO_malloc
308.
309. return ret;
310. > }
311.
312. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:316:9: Taking false branch
314. void *ret = CRYPTO_malloc(num, file, line);
315.
316. if (ret != NULL)
^
317. memset(ret, 0, num);
318. return ret;
crypto/mem.c:318:5:
316. if (ret != NULL)
317. memset(ret, 0, num);
318. > return ret;
319. }
320.
crypto/mem.c:319:1: return from a call to CRYPTO_zalloc
317. memset(ret, 0, num);
318. return ret;
319. > }
320.
321. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/evp/digest.c:156:1: return from a call to EVP_MD_CTX_new
154. {
155. return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
156. > }
157.
158. void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
ssl/ssl_lib.c:3166:9: Taking true branch
3164. ssl_clear_hash_ctx(hash);
3165. *hash = EVP_MD_CTX_new();
3166. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
^
3167. EVP_MD_CTX_free(*hash);
3168. *hash = NULL;
ssl/ssl_lib.c:3167:9:
3165. *hash = EVP_MD_CTX_new();
3166. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) {
3167. > EVP_MD_CTX_free(*hash);
3168. *hash = NULL;
3169. return NULL;
|
https://github.com/openssl/openssl/blob/bc71f91064a3eec10310fa4cc14fe2a3fd9bc7bb/ssl/ssl_lib.c/#L3167
|
d2a_code_trace_data_42058
|
static void opt_vstats (void)
{
char filename[40];
time_t today2 = time(NULL);
struct tm *today = localtime(&today2);
snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
today->tm_sec);
opt_vstats_file(filename);
}
ffmpeg.c:4135: error: Null Dereference
pointer `today` last assigned on line 4133 could be null and is dereferenced at line 4135, column 69.
ffmpeg.c:4129:1: start of procedure opt_vstats()
4127. }
4128.
4129. static void opt_vstats (void)
^
4130. {
4131. char filename[40];
ffmpeg.c:4132:5:
4130. {
4131. char filename[40];
4132. time_t today2 = time(NULL);
^
4133. struct tm *today = localtime(&today2);
4134.
ffmpeg.c:4133:5:
4131. char filename[40];
4132. time_t today2 = time(NULL);
4133. struct tm *today = localtime(&today2);
^
4134.
4135. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
ffmpeg.c:4135:5:
4133. struct tm *today = localtime(&today2);
4134.
4135. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
^
4136. today->tm_sec);
4137. opt_vstats_file(filename);
|
https://github.com/libav/libav/blob/87e4d9b252bc6fa3b982f7050013069c9dc3e05b/ffmpeg.c/#L4135
|
d2a_code_trace_data_42059
|
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
{
BN_ULONG *a = NULL;
if (words > (INT_MAX / (4 * BN_BITS2))) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG);
return NULL;
}
if (BN_get_flags(b, BN_FLG_STATIC_DATA)) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
return NULL;
}
if (BN_get_flags(b, BN_FLG_SECURE))
a = OPENSSL_secure_zalloc(words * sizeof(*a));
else
a = OPENSSL_zalloc(words * sizeof(*a));
if (a == NULL) {
BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
return NULL;
}
assert(b->top <= words);
if (b->top > 0)
memcpy(a, b->d, sizeof(*a) * b->top);
return a;
}
crypto/sm2/sm2_sign.c:237: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_mod_add`.
Showing all 26 steps of the trace
crypto/sm2/sm2_sign.c:234:14: Call
232. }
233.
234. if (!EC_POINT_mul(group, kG, k, NULL, NULL, ctx)
^
235. || !EC_POINT_get_affine_coordinates(group, kG, x1, NULL,
236. ctx)
crypto/ec/ec_lib.c:962:12: Call
960. scalars[0] = p_scalar;
961.
962. return EC_POINTs_mul(group, r, g_scalar,
^
963. (point != NULL
964. && p_scalar != NULL), points, scalars, ctx);
crypto/ec/ec_lib.c:913:1: Parameter `r->Z->top`
911. */
912.
913. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
914. size_t num, const EC_POINT *points[],
915. const BIGNUM *scalars[], BN_CTX *ctx)
crypto/sm2/sm2_sign.c:237:21: Call
235. || !EC_POINT_get_affine_coordinates(group, kG, x1, NULL,
236. ctx)
237. || !BN_mod_add(r, e, x1, order, ctx)) {
^
238. SM2err(SM2_F_SM2_SIG_GEN, ERR_R_INTERNAL_ERROR);
239. goto done;
crypto/bn/bn_mod.c:28:1: Parameter `r->top`
26. }
27.
28. > int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m,
29. BN_CTX *ctx)
30. {
crypto/bn/bn_mod.c:31:10: Call
29. BN_CTX *ctx)
30. {
31. if (!BN_add(r, a, b))
^
32. return 0;
33. return BN_nnmod(r, r, m, ctx);
crypto/bn/bn_add.c:14:1: Parameter `r->top`
12.
13. /* signed add of b to a. */
14. > int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
15. {
16. int ret, r_neg, cmp_res;
crypto/bn/bn_add.c:23:15: Call
21. if (a->neg == b->neg) {
22. r_neg = a->neg;
23. ret = BN_uadd(r, a, b);
^
24. } else {
25. cmp_res = BN_ucmp(a, b);
crypto/bn/bn_add.c:76:1: Parameter `r->top`
74.
75. /* unsigned add of b to a, r can be equal to a or b. */
76. > int BN_uadd(BIGNUM *r, const BIGNUM *a, const BIGNUM *b)
77. {
78. int max, min, dif;
crypto/bn/bn_add.c:96:9: Call
94. dif = max - min;
95.
96. if (bn_wexpand(r, max + 1) == NULL)
^
97. return 0;
98.
crypto/bn/bn_lib.c:962:1: Parameter `a->top`
960. }
961.
962. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
963. {
964. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_lib.c:964:37: Call
962. BIGNUM *bn_wexpand(BIGNUM *a, int words)
963. {
964. return (words <= a->dmax) ? a : bn_expand2(a, words);
^
965. }
966.
crypto/bn/bn_lib.c:245:1: Parameter `b->top`
243. */
244.
245. > BIGNUM *bn_expand2(BIGNUM *b, int words)
246. {
247. if (words > b->dmax) {
crypto/bn/bn_lib.c:248:23: Call
246. {
247. if (words > b->dmax) {
248. BN_ULONG *a = bn_expand_internal(b, words);
^
249. if (!a)
250. return NULL;
crypto/bn/bn_lib.c:209:1: <Offset trace>
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: Parameter `b->top`
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: <Length trace>
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: Parameter `words`
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:224:13: Call
222. a = OPENSSL_secure_zalloc(words * sizeof(*a));
223. else
224. a = OPENSSL_zalloc(words * sizeof(*a));
^
225. if (a == NULL) {
226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
crypto/mem.c:228:1: Parameter `num`
226. }
227.
228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:230:17: Call
228. void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
^
231.
232. FAILTEST();
crypto/mem.c:201:9: Assignment
199.
200. if (num == 0)
201. return NULL;
^
202.
203. FAILTEST();
crypto/mem.c:230:5: Assignment
228. void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
^
231.
232. FAILTEST();
crypto/mem.c:235:5: Assignment
233. if (ret != NULL)
234. memset(ret, 0, num);
235. return ret;
^
236. }
237.
crypto/bn/bn_lib.c:224:9: Assignment
222. a = OPENSSL_secure_zalloc(words * sizeof(*a));
223. else
224. a = OPENSSL_zalloc(words * sizeof(*a));
^
225. if (a == NULL) {
226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_mod_add`
230. assert(b->top <= words);
231. if (b->top > 0)
232. memcpy(a, b->d, sizeof(*a) * b->top);
^
233.
234. return a;
|
https://github.com/openssl/openssl/blob/571286b0a463b02ef2f9040a7e5d602635854832/crypto/bn/bn_lib.c/#L232
|
d2a_code_trace_data_42060
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/ec/ecdsa_ossl.c:232: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `bn_to_mont_fixed_top`.
Showing all 15 steps of the trace
crypto/ec/ecdsa_ossl.c:212:18: Call
210. do {
211. if (in_kinv == NULL || in_r == NULL) {
212. if (!ecdsa_sign_setup(eckey, ctx, &kinv, &ret->r, dgst, dgst_len)) {
^
213. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_ECDSA_LIB);
214. goto err;
crypto/ec/ecdsa_ossl.c:33:1: Parameter `ctx_in->stack.depth`
31. }
32.
33. > static int ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in,
34. BIGNUM **kinvp, BIGNUM **rp,
35. const unsigned char *dgst, int dlen)
crypto/ec/ecdsa_ossl.c:232:14: Call
230. * below, returns user-visible value with removed zero padding.
231. */
232. if (!bn_to_mont_fixed_top(s, ret->r, group->mont_data, ctx)
^
233. || !bn_mul_mont_fixed_top(s, s, priv_key, group->mont_data, ctx)) {
234. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB);
crypto/bn/bn_mont.c:222:1: Parameter `ctx->stack.depth`
220. }
221.
222. > int bn_to_mont_fixed_top(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont,
223. BN_CTX *ctx)
224. {
crypto/bn/bn_mont.c:225:12: Call
223. BN_CTX *ctx)
224. {
225. return bn_mul_mont_fixed_top(r, a, &(mont->RR), mont, ctx);
^
226. }
227.
crypto/bn/bn_mont.c:60:5: Call
58. return 0;
59.
60. BN_CTX_start(ctx);
^
61. tmp = BN_CTX_get(ctx);
62. if (tmp == NULL)
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_mont.c:83:5: Call
81. ret = 1;
82. err:
83. BN_CTX_end(ctx);
^
84. return ret;
85. }
crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <Offset trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: <Length trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `bn_to_mont_fixed_top`
266. static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
^
269. }
270.
|
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
|
d2a_code_trace_data_42061
|
static int
matroska_parse_seekhead (MatroskaDemuxContext *matroska)
{
int res = 0;
uint32_t id;
av_log(matroska->ctx, AV_LOG_DEBUG, "parsing seekhead...\n");
while (res == 0) {
if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
res = AVERROR(EIO);
break;
} else if (matroska->level_up) {
matroska->level_up--;
break;
}
switch (id) {
case MATROSKA_ID_SEEKENTRY: {
uint32_t seek_id = 0, peek_id_cache = 0;
uint64_t seek_pos = (uint64_t) -1, t;
if ((res = ebml_read_master(matroska, &id)) < 0)
break;
while (res == 0) {
if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
res = AVERROR(EIO);
break;
} else if (matroska->level_up) {
matroska->level_up--;
break;
}
switch (id) {
case MATROSKA_ID_SEEKID:
res = ebml_read_uint(matroska, &id, &t);
seek_id = t;
break;
case MATROSKA_ID_SEEKPOSITION:
res = ebml_read_uint(matroska, &id, &seek_pos);
break;
default:
av_log(matroska->ctx, AV_LOG_INFO,
"Unknown seekhead ID 0x%x\n", id);
case EBML_ID_VOID:
res = ebml_read_skip(matroska);
break;
}
if (matroska->level_up) {
matroska->level_up--;
break;
}
}
if (!seek_id || seek_pos == (uint64_t) -1) {
av_log(matroska->ctx, AV_LOG_INFO,
"Incomplete seekhead entry (0x%x/%"PRIu64")\n",
seek_id, seek_pos);
break;
}
switch (seek_id) {
case MATROSKA_ID_CUES:
case MATROSKA_ID_TAGS: {
uint32_t level_up = matroska->level_up;
offset_t before_pos;
uint64_t length;
MatroskaLevel level;
peek_id_cache = matroska->peek_id;
before_pos = url_ftell(matroska->ctx->pb);
if ((res = ebml_read_seek(matroska, seek_pos +
matroska->segment_start)) < 0)
return res;
if (matroska->num_levels == EBML_MAX_DEPTH) {
av_log(matroska->ctx, AV_LOG_INFO,
"Max EBML element depth (%d) reached, "
"cannot parse further.\n", EBML_MAX_DEPTH);
return AVERROR_UNKNOWN;
}
level.start = 0;
level.length = (uint64_t)-1;
matroska->levels[matroska->num_levels] = level;
matroska->num_levels++;
if (!(id = ebml_peek_id (matroska,
&matroska->level_up)))
goto finish;
if (id != seek_id) {
av_log(matroska->ctx, AV_LOG_INFO,
"We looked for ID=0x%x but got "
"ID=0x%x (pos=%"PRIu64")",
seek_id, id, seek_pos +
matroska->segment_start);
goto finish;
}
if ((res = ebml_read_master(matroska, &id)) < 0)
goto finish;
switch (id) {
case MATROSKA_ID_CUES:
if (!(res = matroska_parse_index(matroska)) ||
url_feof(matroska->ctx->pb)) {
matroska->index_parsed = 1;
res = 0;
}
break;
case MATROSKA_ID_TAGS:
if (!(res = matroska_parse_metadata(matroska)) ||
url_feof(matroska->ctx->pb)) {
matroska->metadata_parsed = 1;
res = 0;
}
break;
}
finish:
while (matroska->num_levels) {
matroska->num_levels--;
length =
matroska->levels[matroska->num_levels].length;
if (length == (uint64_t)-1)
break;
}
if ((res = ebml_read_seek(matroska, before_pos)) < 0)
return res;
matroska->peek_id = peek_id_cache;
matroska->level_up = level_up;
break;
}
default:
av_log(matroska->ctx, AV_LOG_INFO,
"Ignoring seekhead entry for ID=0x%x\n",
seek_id);
break;
}
break;
}
default:
av_log(matroska->ctx, AV_LOG_INFO,
"Unknown seekhead ID 0x%x\n", id);
case EBML_ID_VOID:
res = ebml_read_skip(matroska);
break;
}
if (matroska->level_up) {
matroska->level_up--;
break;
}
}
return res;
}
libavformat/matroskadec.c:1827: error: Buffer Overrun L2
Offset: [-oo, max(16, `matroska->num_levels`)] Size: 16.
libavformat/matroskadec.c:1691:1: <Offset trace>
1689. }
1690.
1691. static int
^
1692. matroska_parse_seekhead (MatroskaDemuxContext *matroska)
1693. {
libavformat/matroskadec.c:1691:1: Parameter `matroska->num_levels`
1689. }
1690.
1691. static int
^
1692. matroska_parse_seekhead (MatroskaDemuxContext *matroska)
1693. {
libavformat/matroskadec.c:1700:20: Call
1698.
1699. while (res == 0) {
1700. if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
^
1701. res = AVERROR(EIO);
1702. break;
libavformat/matroskadec.c:306:1: Parameter `matroska->num_levels`
304. */
305.
306. static uint32_t
^
307. ebml_peek_id (MatroskaDemuxContext *matroska,
308. int *level_up)
libavformat/matroskadec.c:312:9: Call
310. uint32_t id;
311.
312. if (ebml_read_element_id(matroska, &id, level_up) < 0)
^
313. return 0;
314.
libavformat/matroskadec.c:256:1: Parameter `matroska->num_levels`
254. */
255.
256. static int
^
257. ebml_read_element_id (MatroskaDemuxContext *matroska,
258. uint32_t *id,
libavformat/matroskadec.c:1713:28: Call
1711. uint64_t seek_pos = (uint64_t) -1, t;
1712.
1713. if ((res = ebml_read_master(matroska, &id)) < 0)
^
1714. break;
1715.
libavformat/matroskadec.c:532:1: Parameter `matroska->num_levels`
530. */
531.
532. static int
^
533. ebml_read_master (MatroskaDemuxContext *matroska,
534. uint32_t *id)
libavformat/matroskadec.c:541:16: Call
539. int res;
540.
541. if ((res = ebml_read_element_id(matroska, id, NULL)) < 0 ||
^
542. (res = ebml_read_element_length(matroska, &length)) < 0)
543. return res;
libavformat/matroskadec.c:256:1: Parameter `matroska->num_levels`
254. */
255.
256. static int
^
257. ebml_read_element_id (MatroskaDemuxContext *matroska,
258. uint32_t *id,
libavformat/matroskadec.c:1787:25: Assignment
1785. level.length = (uint64_t)-1;
1786. matroska->levels[matroska->num_levels] = level;
1787. matroska->num_levels++;
^
1788.
1789. /* check ID */
libavformat/matroskadec.c:1790:36: Call
1788.
1789. /* check ID */
1790. if (!(id = ebml_peek_id (matroska,
^
1791. &matroska->level_up)))
1792. goto finish;
libavformat/matroskadec.c:306:1: Parameter `matroska->num_levels`
304. */
305.
306. static uint32_t
^
307. ebml_peek_id (MatroskaDemuxContext *matroska,
308. int *level_up)
libavformat/matroskadec.c:312:9: Call
310. uint32_t id;
311.
312. if (ebml_read_element_id(matroska, &id, level_up) < 0)
^
313. return 0;
314.
libavformat/matroskadec.c:256:1: Parameter `matroska->num_levels`
254. */
255.
256. static int
^
257. ebml_read_element_id (MatroskaDemuxContext *matroska,
258. uint32_t *id,
libavformat/matroskadec.c:1825:29: Assignment
1823. /* remove dummy level */
1824. while (matroska->num_levels) {
1825. matroska->num_levels--;
^
1826. length =
1827. matroska->levels[matroska->num_levels].length;
libavformat/matroskadec.c:1691:1: <Length trace>
1689. }
1690.
1691. static int
^
1692. matroska_parse_seekhead (MatroskaDemuxContext *matroska)
1693. {
libavformat/matroskadec.c:1691:1: Parameter `matroska->levels[*]`
1689. }
1690.
1691. static int
^
1692. matroska_parse_seekhead (MatroskaDemuxContext *matroska)
1693. {
libavformat/matroskadec.c:1827:33: Array access: Offset: [-oo, max(16, matroska->num_levels)] Size: 16
1825. matroska->num_levels--;
1826. length =
1827. matroska->levels[matroska->num_levels].length;
^
1828. if (length == (uint64_t)-1)
1829. break;
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/matroskadec.c/#L1827
|
d2a_code_trace_data_42062
|
int BN_bn2bin(const BIGNUM *a, unsigned char *to)
{
int n,i;
BN_ULONG l;
bn_check_top(a);
n=i=BN_num_bytes(a);
while (i--)
{
l=a->d[i/BN_BYTES];
*(to++)=(unsigned char)(l>>(8*(i%BN_BYTES)))&0xff;
}
return(n);
}
engines/ccgost/gost2001_keyx.c:51: error: BUFFER_OVERRUN_L3
Offset: [-10, +oo] Size: 64 by call to `store_bignum`.
Showing all 7 steps of the trace
engines/ccgost/gost2001_keyx.c:24:1: Array declaration
22.
23. /* Implementation of CryptoPro VKO 34.10-2001 algorithm */
24. > static int VKO_compute_key(unsigned char *shared_key,size_t shared_key_size,const EC_POINT *pub_key,EC_KEY *priv_key,const unsigned char *ukm)
25. {
26. unsigned char ukm_be[8],databuf[64],hashbuf[64];
engines/ccgost/gost2001_keyx.c:51:2: Call
49. /*Serialize elliptic curve point same way as we do it when saving
50. * key */
51. store_bignum(Y,databuf,32);
^
52. store_bignum(X,databuf+32,32);
53. /* And reverse byte order of whole buffer */
engines/ccgost/gost_sign.c:314:1: Parameter `len`
312. /* Pack bignum into byte buffer of given size, filling all leading bytes
313. * by zeros */
314. > int store_bignum(BIGNUM *bn, unsigned char *buf,int len)
315. {
316. int bytes = BN_num_bytes(bn);
engines/ccgost/gost_sign.c:319:2: Call
317. if (bytes>len) return 0;
318. memset(buf,0,len);
319. BN_bn2bin(bn,buf+len-bytes);
^
320. return 1;
321. }
crypto/bn/bn_lib.c:641:1: <Length trace>
639.
640. /* ignore negative */
641. > int BN_bn2bin(const BIGNUM *a, unsigned char *to)
642. {
643. int n,i;
crypto/bn/bn_lib.c:641:1: Parameter `*to`
639.
640. /* ignore negative */
641. > int BN_bn2bin(const BIGNUM *a, unsigned char *to)
642. {
643. int n,i;
crypto/bn/bn_lib.c:651:3: Array access: Offset: [-10, +oo] Size: 64 by call to `store_bignum`
649. {
650. l=a->d[i/BN_BYTES];
651. *(to++)=(unsigned char)(l>>(8*(i%BN_BYTES)))&0xff;
^
652. }
653. return(n);
|
https://github.com/openssl/openssl/blob/d40a1b865fddc3d67f8c06ff1f1466fad331c8f7/crypto/bn/bn_lib.c/#L651
|
d2a_code_trace_data_42063
|
static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
{
#ifdef BITSTREAM_READER_LE
uint64_t ret = bc->bits & ((UINT64_C(1) << n) - 1);
bc->bits >>= n;
#else
uint64_t ret = bc->bits >> (64 - n);
bc->bits <<= n;
#endif
bc->bits_left -= n;
return ret;
}
libavcodec/takdec.c:796: error: Integer Overflow L2
([1, +oo] - 4):unsigned32 by call to `bitstream_read`.
libavcodec/takdec.c:796:24: Call
794. int ch_mask = 0;
795.
796. chan = bitstream_read(bc, 4) + 1;
^
797. if (chan > avctx->channels)
798. return AVERROR_INVALIDDATA;
libavcodec/bitstream.h:183:1: Parameter `n`
181.
182. /* Return n bits from the buffer. n has to be in the 0-32 range. */
183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n)
^
184. {
185. if (!n)
libavcodec/bitstream.h:194:12: Call
192. }
193.
194. return get_val(bc, n);
^
195. }
196.
libavcodec/bitstream.h:130:1: <LHS trace>
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:130:1: Parameter `bc->bits_left`
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:130:1: <RHS trace>
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:130:1: Parameter `n`
128. }
129.
130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n)
^
131. {
132. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:139:5: Binary operation: ([1, +oo] - 4):unsigned32 by call to `bitstream_read`
137. bc->bits <<= n;
138. #endif
139. bc->bits_left -= n;
^
140.
141. return ret;
|
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L139
|
d2a_code_trace_data_42064
|
static int epzs_motion_search4(MpegEncContext * s,
int *mx_ptr, int *my_ptr, int P[10][2],
int src_index, int ref_index, int16_t (*last_mv)[2],
int ref_mv_scale)
{
MotionEstContext * const c= &s->me;
int best[2]={0, 0};
int d, dmin;
int map_generation;
const int penalty_factor= c->penalty_factor;
const int size=1;
const int h=8;
const int ref_mv_stride= s->mb_stride;
const int ref_mv_xy= s->mb_x + s->mb_y *ref_mv_stride;
me_cmp_func cmpf, chroma_cmpf;
LOAD_COMMON
int flags= c->flags;
LOAD_COMMON2
cmpf= s->dsp.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1];
map_generation= update_map_generation(c);
dmin = 1000000;
if (s->first_slice_line) {
CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift)
}else{
CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift)
CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift)
CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift)
CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
}
if(dmin>64*4){
CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16)
if(s->mb_y+1<s->end_mb_y)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
}
dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
*mx_ptr= best[0];
*my_ptr= best[1];
return dmin;
}
libavcodec/motion_est_template.c:1166: error: Uninitialized Value
The value read from xmin was never initialized.
libavcodec/motion_est_template.c:1166:9:
1164. CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift)
1165. //FIXME try some early stop
1166. CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift)
^
1167. CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
1168. CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift)
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1166
|
d2a_code_trace_data_42065
|
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);
X509_VERIFY_PARAM_set_purpose(vpm, i);
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_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:
X509_VERIFY_PARAM_set_flags(vpm, X509_V_FLAG_CB_ISSUER_CHECK);
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;
}
return 1;
}
apps/opt.c:511: error: NULL_DEREFERENCE
pointer `xptmp` last assigned on line 510 could be null and is dereferenced by call to `X509_PURPOSE_get_id()` at line 511, column 13.
Showing all 31 steps of the trace
apps/opt.c:480:1: start of procedure opt_verify()
478. enum range { OPT_V_ENUM };
479.
480. > int opt_verify(int opt, X509_VERIFY_PARAM *vpm)
481. {
482. int i;
apps/opt.c:483:5:
481. {
482. int i;
483. > ossl_intmax_t t = 0;
484. ASN1_OBJECT *otmp;
485. X509_PURPOSE *xptmp;
apps/opt.c:488:5: Condition is true
486. const X509_VERIFY_PARAM *vtmp;
487.
488. assert(vpm != NULL);
^
489. assert(opt > OPT_V__FIRST);
490. assert(opt < OPT_V__LAST);
apps/opt.c:489:5: Condition is true
487.
488. assert(vpm != NULL);
489. assert(opt > OPT_V__FIRST);
^
490. assert(opt < OPT_V__LAST);
491.
apps/opt.c:490:5: Condition is true
488. assert(vpm != NULL);
489. assert(opt > OPT_V__FIRST);
490. assert(opt < OPT_V__LAST);
^
491.
492. switch ((enum range)opt) {
apps/opt.c:492:5:
490. assert(opt < OPT_V__LAST);
491.
492. > switch ((enum range)opt) {
493. case OPT_V__FIRST:
494. case OPT_V__LAST:
apps/opt.c:493:5: Switch condition is false. Skipping switch case
491.
492. switch ((enum range)opt) {
493. case OPT_V__FIRST:
^
494. case OPT_V__LAST:
495. return 0;
apps/opt.c:494:5: Switch condition is false. Skipping switch case
492. switch ((enum range)opt) {
493. case OPT_V__FIRST:
494. case OPT_V__LAST:
^
495. return 0;
496. case OPT_V_POLICY:
apps/opt.c:496:5: Switch condition is false. Skipping switch case
494. case OPT_V__LAST:
495. return 0;
496. case OPT_V_POLICY:
^
497. otmp = OBJ_txt2obj(opt_arg(), 0);
498. if (otmp == NULL) {
apps/opt.c:504:5: Switch condition is true. Entering switch case
502. X509_VERIFY_PARAM_add0_policy(vpm, otmp);
503. break;
504. case OPT_V_PURPOSE:
^
505. i = X509_PURPOSE_get_by_sname(opt_arg());
506. if (i < 0) {
apps/opt.c:505:9:
503. break;
504. case OPT_V_PURPOSE:
505. > i = X509_PURPOSE_get_by_sname(opt_arg());
506. if (i < 0) {
507. BIO_printf(bio_err, "%s: Invalid purpose %s\n", prog, opt_arg());
apps/opt.c:772:1: start of procedure opt_arg()
770.
771. /* Return the most recent flag parameter. */
772. > char *opt_arg(void)
773. {
774. return arg;
apps/opt.c:774:5:
772. char *opt_arg(void)
773. {
774. > return arg;
775. }
776.
apps/opt.c:775:1: return from a call to opt_arg
773. {
774. return arg;
775. > }
776.
777. /* Return the most recent flag. */
apps/opt.c:505:9: Skipping X509_PURPOSE_get_by_sname(): empty list of specs
503. break;
504. case OPT_V_PURPOSE:
505. i = X509_PURPOSE_get_by_sname(opt_arg());
^
506. if (i < 0) {
507. BIO_printf(bio_err, "%s: Invalid purpose %s\n", prog, opt_arg());
apps/opt.c:506:13: Taking false branch
504. case OPT_V_PURPOSE:
505. i = X509_PURPOSE_get_by_sname(opt_arg());
506. if (i < 0) {
^
507. BIO_printf(bio_err, "%s: Invalid purpose %s\n", prog, opt_arg());
508. return 0;
apps/opt.c:510:9:
508. return 0;
509. }
510. > xptmp = X509_PURPOSE_get0(i);
511. i = X509_PURPOSE_get_id(xptmp);
512. X509_VERIFY_PARAM_set_purpose(vpm, i);
crypto/x509v3/v3_purp.c:162:1: start of procedure X509_PURPOSE_get0()
160. }
161.
162. > X509_PURPOSE *X509_PURPOSE_get0(int idx)
163. {
164. if (idx < 0)
crypto/x509v3/v3_purp.c:164:9: Taking false branch
162. X509_PURPOSE *X509_PURPOSE_get0(int idx)
163. {
164. if (idx < 0)
^
165. return NULL;
166. if (idx < (int)X509_PURPOSE_COUNT)
crypto/x509v3/v3_purp.c:166:9: Taking false branch
164. if (idx < 0)
165. return NULL;
166. if (idx < (int)X509_PURPOSE_COUNT)
^
167. return xstandard + idx;
168. return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);
crypto/x509v3/v3_purp.c:168:5:
166. if (idx < (int)X509_PURPOSE_COUNT)
167. return xstandard + idx;
168. > return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);
169. }
170.
include/openssl/x509v3.h:500:1: start of procedure sk_X509_PURPOSE_value()
498. # define X509V3_ADD_SILENT 0x10
499.
500. > DEFINE_STACK_OF(X509_PURPOSE)
501.
502. DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS)
crypto/stack/stack.c:324:1: start of procedure sk_value()
322. }
323.
324. > void *sk_value(const _STACK *st, int i)
325. {
326. if (!st || (i < 0) || (i >= st->num))
crypto/stack/stack.c:326:10: Taking true branch
324. void *sk_value(const _STACK *st, int i)
325. {
326. if (!st || (i < 0) || (i >= st->num))
^
327. return NULL;
328. return st->data[i];
crypto/stack/stack.c:327:9:
325. {
326. if (!st || (i < 0) || (i >= st->num))
327. > return NULL;
328. return st->data[i];
329. }
crypto/stack/stack.c:329:1: return from a call to sk_value
327. return NULL;
328. return st->data[i];
329. > }
330.
331. void *sk_set(_STACK *st, int i, void *value)
include/openssl/x509v3.h:500:1: return from a call to sk_X509_PURPOSE_value
498. # define X509V3_ADD_SILENT 0x10
499.
500. > DEFINE_STACK_OF(X509_PURPOSE)
501.
502. DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS)
crypto/x509v3/v3_purp.c:169:1: return from a call to X509_PURPOSE_get0
167. return xstandard + idx;
168. return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);
169. > }
170.
171. int X509_PURPOSE_get_by_sname(char *sname)
apps/opt.c:511:9:
509. }
510. xptmp = X509_PURPOSE_get0(i);
511. > i = X509_PURPOSE_get_id(xptmp);
512. X509_VERIFY_PARAM_set_purpose(vpm, i);
513. break;
crypto/x509v3/v3_purp.c:281:1: start of procedure X509_PURPOSE_get_id()
279. }
280.
281. > int X509_PURPOSE_get_id(X509_PURPOSE *xp)
282. {
283. return xp->purpose;
crypto/x509v3/v3_purp.c:283:5:
281. int X509_PURPOSE_get_id(X509_PURPOSE *xp)
282. {
283. > return xp->purpose;
284. }
285.
|
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/apps/opt.c/#L511
|
d2a_code_trace_data_42066
|
int dct_quantize_trellis_c(MpegEncContext *s,
DCTELEM *block, int n,
int qscale, int *overflow){
const int *qmat;
const uint8_t *scantable= s->intra_scantable.scantable;
const uint8_t *perm_scantable= s->intra_scantable.permutated;
int max=0;
unsigned int threshold1, threshold2;
int bias=0;
int run_tab[65];
int level_tab[65];
int score_tab[65];
int survivor[65];
int survivor_count;
int last_run=0;
int last_level=0;
int last_score= 0;
int last_i;
int coeff[2][64];
int coeff_count[64];
int qmul, qadd, start_i, last_non_zero, i, dc;
const int esc_length= s->ac_esc_length;
uint8_t * length;
uint8_t * last_length;
const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6);
s->dsp.fdct (block);
if(s->dct_error_sum)
s->denoise_dct(s, block);
qmul= qscale*16;
qadd= ((qscale-1)|1)*8;
if (s->mb_intra) {
int q;
if (!s->h263_aic) {
if (n < 4)
q = s->y_dc_scale;
else
q = s->c_dc_scale;
q = q << 3;
} else{
q = 1 << 3;
qadd=0;
}
block[0] = (block[0] + (q >> 1)) / q;
start_i = 1;
last_non_zero = 0;
qmat = s->q_intra_matrix[qscale];
if(s->mpeg_quant || s->out_format == FMT_MPEG1)
bias= 1<<(QMAT_SHIFT-1);
length = s->intra_ac_vlc_length;
last_length= s->intra_ac_vlc_last_length;
} else {
start_i = 0;
last_non_zero = -1;
qmat = s->q_inter_matrix[qscale];
length = s->inter_ac_vlc_length;
last_length= s->inter_ac_vlc_last_length;
}
last_i= start_i;
threshold1= (1<<QMAT_SHIFT) - bias - 1;
threshold2= (threshold1<<1);
for(i=63; i>=start_i; i--) {
const int j = scantable[i];
int level = block[j] * qmat[j];
if(((unsigned)(level+threshold1))>threshold2){
last_non_zero = i;
break;
}
}
for(i=start_i; i<=last_non_zero; i++) {
const int j = scantable[i];
int level = block[j] * qmat[j];
if(((unsigned)(level+threshold1))>threshold2){
if(level>0){
level= (bias + level)>>QMAT_SHIFT;
coeff[0][i]= level;
coeff[1][i]= level-1;
}else{
level= (bias - level)>>QMAT_SHIFT;
coeff[0][i]= -level;
coeff[1][i]= -level+1;
}
coeff_count[i]= FFMIN(level, 2);
assert(coeff_count[i]);
max |=level;
}else{
coeff[0][i]= (level>>31)|1;
coeff_count[i]= 1;
}
}
*overflow= s->max_qcoeff < max;
if(last_non_zero < start_i){
memset(block + start_i, 0, (64-start_i)*sizeof(DCTELEM));
return last_non_zero;
}
score_tab[start_i]= 0;
survivor[0]= start_i;
survivor_count= 1;
for(i=start_i; i<=last_non_zero; i++){
int level_index, j, zero_distoration;
int dct_coeff= FFABS(block[ scantable[i] ]);
int best_score=256*256*256*120;
if ( s->dsp.fdct == fdct_ifast
#ifndef FAAN_POSTSCALE
|| s->dsp.fdct == ff_faandct
#endif
)
dct_coeff= (dct_coeff*inv_aanscales[ scantable[i] ]) >> 12;
zero_distoration= dct_coeff*dct_coeff;
for(level_index=0; level_index < coeff_count[i]; level_index++){
int distoration;
int level= coeff[level_index][i];
const int alevel= FFABS(level);
int unquant_coeff;
assert(level);
if(s->out_format == FMT_H263){
unquant_coeff= alevel*qmul + qadd;
}else{
j= s->dsp.idct_permutation[ scantable[i] ];
if(s->mb_intra){
unquant_coeff = (int)( alevel * qscale * s->intra_matrix[j]) >> 3;
unquant_coeff = (unquant_coeff - 1) | 1;
}else{
unquant_coeff = ((( alevel << 1) + 1) * qscale * ((int) s->inter_matrix[j])) >> 4;
unquant_coeff = (unquant_coeff - 1) | 1;
}
unquant_coeff<<= 3;
}
distoration= (unquant_coeff - dct_coeff) * (unquant_coeff - dct_coeff) - zero_distoration;
level+=64;
if((level&(~127)) == 0){
for(j=survivor_count-1; j>=0; j--){
int run= i - survivor[j];
int score= distoration + length[UNI_AC_ENC_INDEX(run, level)]*lambda;
score += score_tab[i-run];
if(score < best_score){
best_score= score;
run_tab[i+1]= run;
level_tab[i+1]= level-64;
}
}
if(s->out_format == FMT_H263){
for(j=survivor_count-1; j>=0; j--){
int run= i - survivor[j];
int score= distoration + last_length[UNI_AC_ENC_INDEX(run, level)]*lambda;
score += score_tab[i-run];
if(score < last_score){
last_score= score;
last_run= run;
last_level= level-64;
last_i= i+1;
}
}
}
}else{
distoration += esc_length*lambda;
for(j=survivor_count-1; j>=0; j--){
int run= i - survivor[j];
int score= distoration + score_tab[i-run];
if(score < best_score){
best_score= score;
run_tab[i+1]= run;
level_tab[i+1]= level-64;
}
}
if(s->out_format == FMT_H263){
for(j=survivor_count-1; j>=0; j--){
int run= i - survivor[j];
int score= distoration + score_tab[i-run];
if(score < last_score){
last_score= score;
last_run= run;
last_level= level-64;
last_i= i+1;
}
}
}
}
}
score_tab[i+1]= best_score;
if(last_non_zero <= 27){
for(; survivor_count; survivor_count--){
if(score_tab[ survivor[survivor_count-1] ] <= best_score)
break;
}
}else{
for(; survivor_count; survivor_count--){
if(score_tab[ survivor[survivor_count-1] ] <= best_score + lambda)
break;
}
}
survivor[ survivor_count++ ]= i+1;
}
if(s->out_format != FMT_H263){
last_score= 256*256*256*120;
for(i= survivor[0]; i<=last_non_zero + 1; i++){
int score= score_tab[i];
if(i) score += lambda*2;
if(score < last_score){
last_score= score;
last_i= i;
last_level= level_tab[i];
last_run= run_tab[i];
}
}
}
s->coded_score[n] = last_score;
dc= FFABS(block[0]);
last_non_zero= last_i - 1;
memset(block + start_i, 0, (64-start_i)*sizeof(DCTELEM));
if(last_non_zero < start_i)
return last_non_zero;
if(last_non_zero == 0 && start_i == 0){
int best_level= 0;
int best_score= dc * dc;
for(i=0; i<coeff_count[0]; i++){
int level= coeff[i][0];
int alevel= FFABS(level);
int unquant_coeff, score, distortion;
if(s->out_format == FMT_H263){
unquant_coeff= (alevel*qmul + qadd)>>3;
}else{
unquant_coeff = ((( alevel << 1) + 1) * qscale * ((int) s->inter_matrix[0])) >> 4;
unquant_coeff = (unquant_coeff - 1) | 1;
}
unquant_coeff = (unquant_coeff + 4) >> 3;
unquant_coeff<<= 3 + 3;
distortion= (unquant_coeff - dc) * (unquant_coeff - dc);
level+=64;
if((level&(~127)) == 0) score= distortion + last_length[UNI_AC_ENC_INDEX(0, level)]*lambda;
else score= distortion + esc_length*lambda;
if(score < best_score){
best_score= score;
best_level= level - 64;
}
}
block[0]= best_level;
s->coded_score[n] = best_score - dc*dc;
if(best_level == 0) return -1;
else return last_non_zero;
}
i= last_i;
assert(last_level);
block[ perm_scantable[last_non_zero] ]= last_level;
i -= last_run + 1;
for(; i>start_i; i -= run_tab[i] + 1){
block[ perm_scantable[i-1] ]= level_tab[i];
}
return last_non_zero;
}
libavcodec/mpegvideo_enc.c:3199: error: Uninitialized Value
The value read from run_tab[_] was never initialized.
libavcodec/mpegvideo_enc.c:3199:17:
3197. last_i= i;
3198. last_level= level_tab[i];
3199. last_run= run_tab[i];
^
3200. }
3201. }
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo_enc.c/#L3199
|
d2a_code_trace_data_42067
|
void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,
const char *file, int line)
{
void *ret = NULL;
if (str == NULL)
return CRYPTO_malloc(num, file, line);
if (num == 0) {
CRYPTO_clear_free(str, old_len, file, line);
return NULL;
}
if (num < old_len) {
OPENSSL_cleanse((char*)str + num, old_len - num);
return str;
}
ret = CRYPTO_malloc(num, file, line);
if (ret != NULL) {
memcpy(ret, str, old_len);
CRYPTO_clear_free(str, old_len, file, line);
}
return ret;
}
ssl/statem/statem_dtls.c:720: error: INTEGER_OVERFLOW_L2
([2, max(2147483644, `s->init_buf->max`)] - [1, 2147483644]):unsigned64 by call to `dtls1_retrieve_buffered_fragment`.
Showing all 13 steps of the trace
ssl/statem/statem_dtls.c:708:1: Parameter `s->init_buf->max`
706. }
707.
708. > static int dtls_get_reassembled_message(SSL *s, int *errtype, size_t *len)
709. {
710. unsigned char wire[DTLS1_HM_HEADER_LENGTH];
ssl/statem/statem_dtls.c:720:9: Call
718. redo:
719. /* see if we have the required fragment already */
720. if (dtls1_retrieve_buffered_fragment(s, &frag_len)) {
^
721. s->init_num = frag_len;
722. *len = frag_len;
ssl/statem/statem_dtls.c:443:1: Parameter `s->init_buf->max`
441. }
442.
443. > static int dtls1_retrieve_buffered_fragment(SSL *s, size_t *len)
444. {
445. /*-
ssl/statem/statem_dtls.c:480:14: Call
478. pqueue_pop(s->d1->buffered_messages);
479.
480. al = dtls1_preprocess_fragment(s, &frag->msg_header);
^
481.
482. if (al == 0) { /* no alert */
ssl/statem/statem_dtls.c:401:1: Parameter `s->init_buf->max`
399. }
400.
401. > static int dtls1_preprocess_fragment(SSL *s, struct hm_header_st *msg_hdr)
402. {
403. size_t frag_off, frag_len, msg_len;
ssl/statem/statem_dtls.c:421:14: Call
419. * dtls_max_handshake_message_len(s) above
420. */
421. if (!BUF_MEM_grow_clean(s->init_buf, msg_len + DTLS1_HM_HEADER_LENGTH)) {
^
422. SSLerr(SSL_F_DTLS1_PREPROCESS_FRAGMENT, ERR_R_BUF_LIB);
423. return SSL_AD_INTERNAL_ERROR;
crypto/buffer/buffer.c:109:1: Parameter `len`
107. }
108.
109. > size_t BUF_MEM_grow_clean(BUF_MEM *str, size_t len)
110. {
111. char *ret;
crypto/buffer/buffer.c:134:15: Call
132. ret = sec_alloc_realloc(str, n);
133. else
134. ret = OPENSSL_clear_realloc(str->data, str->max, n);
^
135. if (ret == NULL) {
136. BUFerr(BUF_F_BUF_MEM_GROW_CLEAN, ERR_R_MALLOC_FAILURE);
crypto/mem.c:136:1: <LHS trace>
134. }
135.
136. > void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,
137. const char *file, int line)
138. {
crypto/mem.c:136:1: Parameter `num`
134. }
135.
136. > void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,
137. const char *file, int line)
138. {
crypto/mem.c:136:1: <RHS trace>
134. }
135.
136. > void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,
137. const char *file, int line)
138. {
crypto/mem.c:136:1: Parameter `num`
134. }
135.
136. > void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num,
137. const char *file, int line)
138. {
crypto/mem.c:151:9: Binary operation: ([2, max(2147483644, s->init_buf->max)] - [1, 2147483644]):unsigned64 by call to `dtls1_retrieve_buffered_fragment`
149. /* Can't shrink the buffer since memcpy below copies |old_len| bytes. */
150. if (num < old_len) {
151. OPENSSL_cleanse((char*)str + num, old_len - num);
^
152. return str;
153. }
|
https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/crypto/mem.c/#L151
|
d2a_code_trace_data_42068
|
int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
{
char *v;
int gmt = 0;
int i;
int y = 0, M = 0, d = 0, h = 0, m = 0, s = 0;
char *f = NULL;
int f_len = 0;
i = tm->length;
v = (char *)tm->data;
if (i < 12)
goto err;
if (v[i - 1] == 'Z')
gmt = 1;
for (i = 0; i < 12; i++)
if ((v[i] > '9') || (v[i] < '0'))
goto err;
y = (v[0] - '0') * 1000 + (v[1] - '0') * 100
+ (v[2] - '0') * 10 + (v[3] - '0');
M = (v[4] - '0') * 10 + (v[5] - '0');
if ((M > 12) || (M < 1))
goto err;
d = (v[6] - '0') * 10 + (v[7] - '0');
h = (v[8] - '0') * 10 + (v[9] - '0');
m = (v[10] - '0') * 10 + (v[11] - '0');
if (tm->length >= 14 &&
(v[12] >= '0') && (v[12] <= '9') &&
(v[13] >= '0') && (v[13] <= '9')) {
s = (v[12] - '0') * 10 + (v[13] - '0');
if (tm->length >= 15 && v[14] == '.') {
int l = tm->length;
f = &v[14];
f_len = 1;
while (14 + f_len < l && f[f_len] >= '0' && f[f_len] <= '9')
++f_len;
}
}
if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s",
_asn1_mon[M - 1], d, h, m, s, f_len, f, y,
(gmt) ? " GMT" : "") <= 0)
return (0);
else
return (1);
err:
BIO_write(bp, "Bad time value", 14);
return (0);
}
crypto/asn1/tasn_prn.c:541: error: BUFFER_OVERRUN_L3
Offset: [-529, +oo] Size: 12 by call to `ASN1_GENERALIZEDTIME_print`.
Showing all 7 steps of the trace
crypto/asn1/tasn_prn.c:541:15: Call
539.
540. case V_ASN1_GENERALIZEDTIME:
541. ret = ASN1_GENERALIZEDTIME_print(out, str);
^
542. break;
543.
crypto/asn1/a_gentm.c:266:1: <Offset trace>
264. };
265.
266. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
267. {
268. char *v;
crypto/asn1/a_gentm.c:266:1: Parameter `*tm->data`
264. };
265.
266. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
267. {
268. char *v;
crypto/asn1/a_gentm.c:287:5: Assignment
285. y = (v[0] - '0') * 1000 + (v[1] - '0') * 100
286. + (v[2] - '0') * 10 + (v[3] - '0');
287. M = (v[4] - '0') * 10 + (v[5] - '0');
^
288. if ((M > 12) || (M < 1))
289. goto err;
crypto/asn1/a_gentm.c:261:1: <Length trace>
259. }
260.
261. > const char *_asn1_mon[12] = {
262. "Jan", "Feb", "Mar", "Apr", "May", "Jun",
263. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
crypto/asn1/a_gentm.c:261:1: Array declaration
259. }
260.
261. > const char *_asn1_mon[12] = {
262. "Jan", "Feb", "Mar", "Apr", "May", "Jun",
263. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
crypto/asn1/a_gentm.c:308:20: Array access: Offset: [-529, +oo] Size: 12 by call to `ASN1_GENERALIZEDTIME_print`
306.
307. if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s",
308. _asn1_mon[M - 1], d, h, m, s, f_len, f, y,
^
309. (gmt) ? " GMT" : "") <= 0)
310. return (0);
|
https://github.com/openssl/openssl/blob/01b7851aa27aa144372f5484da916be042d9aa4f/crypto/asn1/a_gentm.c/#L308
|
d2a_code_trace_data_42069
|
static int select_server_ctx(SSL *s, void *arg, int ignore)
{
const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
HANDSHAKE_EX_DATA *ex_data =
(HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
if (servername == NULL) {
ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
return SSL_TLSEXT_ERR_NOACK;
}
if (strcmp(servername, "server2") == 0) {
SSL_CTX *new_ctx = (SSL_CTX*)arg;
SSL_set_SSL_CTX(s, new_ctx);
SSL_clear_options(s, 0xFFFFFFFFL);
SSL_set_options(s, SSL_CTX_get_options(new_ctx));
ex_data->servername = SSL_TEST_SERVERNAME_SERVER2;
return SSL_TLSEXT_ERR_OK;
} else if (strcmp(servername, "server1") == 0) {
ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
return SSL_TLSEXT_ERR_OK;
} else if (ignore) {
ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
return SSL_TLSEXT_ERR_NOACK;
} else {
return SSL_TLSEXT_ERR_ALERT_FATAL;
}
}
test/handshake_helper.c:131: error: NULL_DEREFERENCE
pointer `ex_data` last assigned on line 109 could be null and is dereferenced at line 131, column 9.
Showing all 21 steps of the trace
test/handshake_helper.c:106:1: start of procedure select_server_ctx()
104. * An empty SNI extension also returns SSL_TSLEXT_ERR_NOACK.
105. */
106. > static int select_server_ctx(SSL *s, void *arg, int ignore)
107. {
108. const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
test/handshake_helper.c:108:5:
106. static int select_server_ctx(SSL *s, void *arg, int ignore)
107. {
108. > const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
109. HANDSHAKE_EX_DATA *ex_data =
110. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
ssl/ssl_lib.c:2366:1: start of procedure SSL_get_servername()
2364. */
2365.
2366. > const char *SSL_get_servername(const SSL *s, const int type)
2367. {
2368. if (type != TLSEXT_NAMETYPE_host_name)
ssl/ssl_lib.c:2368:9: Taking false branch
2366. const char *SSL_get_servername(const SSL *s, const int type)
2367. {
2368. if (type != TLSEXT_NAMETYPE_host_name)
^
2369. return NULL;
2370.
ssl/ssl_lib.c:2371:12: Condition is true
2369. return NULL;
2370.
2371. return s->session && !s->ext.hostname ?
^
2372. s->session->ext.hostname : s->ext.hostname;
2373. }
ssl/ssl_lib.c:2371:27: Condition is true
2369. return NULL;
2370.
2371. return s->session && !s->ext.hostname ?
^
2372. s->session->ext.hostname : s->ext.hostname;
2373. }
ssl/ssl_lib.c:2371:12:
2369. return NULL;
2370.
2371. > return s->session && !s->ext.hostname ?
2372. s->session->ext.hostname : s->ext.hostname;
2373. }
ssl/ssl_lib.c:2371:5:
2369. return NULL;
2370.
2371. > return s->session && !s->ext.hostname ?
2372. s->session->ext.hostname : s->ext.hostname;
2373. }
ssl/ssl_lib.c:2373:1: return from a call to SSL_get_servername
2371. return s->session && !s->ext.hostname ?
2372. s->session->ext.hostname : s->ext.hostname;
2373. > }
2374.
2375. int SSL_get_servername_type(const SSL *s)
test/handshake_helper.c:109:5:
107. {
108. const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name);
109. > HANDSHAKE_EX_DATA *ex_data =
110. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
111.
ssl/ssl_lib.c:3729:1: start of procedure SSL_get_ex_data()
3727. }
3728.
3729. > void *SSL_get_ex_data(const SSL *s, int idx)
3730. {
3731. return (CRYPTO_get_ex_data(&s->ex_data, idx));
ssl/ssl_lib.c:3731:5:
3729. void *SSL_get_ex_data(const SSL *s, int idx)
3730. {
3731. > return (CRYPTO_get_ex_data(&s->ex_data, idx));
3732. }
3733.
crypto/ex_data.c:387:1: start of procedure CRYPTO_get_ex_data()
385. * particular index in the class used by this variable
386. */
387. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
388. {
389. if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
crypto/ex_data.c:389:9: Taking true branch
387. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
388. {
389. if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
^
390. return NULL;
391. return sk_void_value(ad->sk, idx);
crypto/ex_data.c:390:9:
388. {
389. if (ad->sk == NULL || idx >= sk_void_num(ad->sk))
390. > return NULL;
391. return sk_void_value(ad->sk, idx);
392. }
crypto/ex_data.c:392:1: return from a call to CRYPTO_get_ex_data
390. return NULL;
391. return sk_void_value(ad->sk, idx);
392. > }
ssl/ssl_lib.c:3732:1: return from a call to SSL_get_ex_data
3730. {
3731. return (CRYPTO_get_ex_data(&s->ex_data, idx));
3732. > }
3733.
3734. int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg)
test/handshake_helper.c:112:9: Taking false branch
110. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx));
111.
112. if (servername == NULL) {
^
113. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
114. return SSL_TLSEXT_ERR_NOACK;
test/handshake_helper.c:117:9: Taking false branch
115. }
116.
117. if (strcmp(servername, "server2") == 0) {
^
118. SSL_CTX *new_ctx = (SSL_CTX*)arg;
119. SSL_set_SSL_CTX(s, new_ctx);
test/handshake_helper.c:130:16: Taking true branch
128. ex_data->servername = SSL_TEST_SERVERNAME_SERVER2;
129. return SSL_TLSEXT_ERR_OK;
130. } else if (strcmp(servername, "server1") == 0) {
^
131. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
132. return SSL_TLSEXT_ERR_OK;
test/handshake_helper.c:131:9:
129. return SSL_TLSEXT_ERR_OK;
130. } else if (strcmp(servername, "server1") == 0) {
131. > ex_data->servername = SSL_TEST_SERVERNAME_SERVER1;
132. return SSL_TLSEXT_ERR_OK;
133. } else if (ignore) {
|
https://github.com/openssl/openssl/blob/0f5df0f1037590de12cc11eeab26fe29bf3f16a3/test/handshake_helper.c/#L131
|
d2a_code_trace_data_42070
|
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
{
int i, j, max;
const BN_ULONG *ap;
BN_ULONG *rp;
max = n * 2;
ap = a;
rp = r;
rp[0] = rp[max - 1] = 0;
rp++;
j = n;
if (--j > 0) {
ap++;
rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
rp += 2;
}
for (i = n - 2; i > 0; i--) {
j--;
ap++;
rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]);
rp += 2;
}
bn_add_words(r, r, r, max);
bn_sqr_words(tmp, a, n);
bn_add_words(r, r, tmp, max);
}
crypto/ec/ecdsa_ossl.c:140: error: BUFFER_OVERRUN_L3
Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `ec_group_do_inverse_ord`.
Showing all 27 steps of the trace
crypto/ec/ecdsa_ossl.c:83:10: Call
81. /* Preallocate space */
82. order_bits = BN_num_bits(order);
83. if (!BN_set_bit(k, order_bits)
^
84. || !BN_set_bit(r, order_bits)
85. || !BN_set_bit(X, order_bits))
crypto/bn/bn_lib.c:589:1: Parameter `a->top`
587. }
588.
589. > int BN_set_bit(BIGNUM *a, int n)
590. {
591. int i, j, k;
crypto/ec/ecdsa_ossl.c:140:10: Call
138.
139. /* compute the inverse of k */
140. if (!ec_group_do_inverse_ord(group, k, k, ctx)) {
^
141. ECerr(EC_F_ECDSA_SIGN_SETUP, ERR_R_BN_LIB);
142. goto err;
crypto/ec/ec_lib.c:1074:1: Parameter `x->top`
1072. * other functionality.
1073. */
1074. > int ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res,
1075. const BIGNUM *x, BN_CTX *ctx)
1076. {
crypto/ec/ec_lib.c:1080:16: Call
1078. return group->meth->field_inverse_mod_ord(group, res, x, ctx);
1079. else
1080. return ec_field_inverse_mod_ord(group, res, x, ctx);
^
1081. }
1082.
crypto/ec/ec_lib.c:1020:1: Parameter `x->top`
1018. }
1019.
1020. > static int ec_field_inverse_mod_ord(const EC_GROUP *group, BIGNUM *r,
1021. const BIGNUM *x, BN_CTX *ctx)
1022. {
crypto/ec/ec_lib.c:1049:10: Call
1047. * No need for scatter-gather or BN_FLG_CONSTTIME.
1048. */
1049. if (!BN_mod_exp_mont(r, x, e, group->order, ctx, group->mont_data))
^
1050. goto err;
1051.
crypto/bn/bn_exp.c:296:1: Parameter `a->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 `a->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:759:17: Call
757. if (!BN_to_montgomery(&am, &am, mont, ctx))
758. goto err;
759. } else if (!BN_to_montgomery(&am, a, mont, ctx))
^
760. goto err;
761.
crypto/bn/bn_lib.c:870:1: Parameter `a->top`
868. }
869.
870. > int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont,
871. BN_CTX *ctx)
872. {
crypto/bn/bn_lib.c:873:12: Call
871. BN_CTX *ctx)
872. {
873. return BN_mod_mul_montgomery(r, a, &(mont->RR), mont, ctx);
^
874. }
875.
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 `ec_group_do_inverse_ord`
118. if (--j > 0) {
119. ap++;
120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]);
^
121. rp += 2;
122. }
|
https://github.com/openssl/openssl/blob/b8c32081e02b7008a90d878eccce46da256dfe86/crypto/bn/bn_sqr.c/#L120
|
d2a_code_trace_data_42071
|
void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset,
MPA_INT *window, int *dither_state,
OUT_INT *samples, int incr,
int32_t sb_samples[SBLIMIT])
{
int32_t tmp[32];
register MPA_INT *synth_buf;
register const MPA_INT *w, *w2, *p;
int j, offset, v;
OUT_INT *samples2;
#if FRAC_BITS <= 15
int sum, sum2;
#else
int64_t sum, sum2;
#endif
dct32(tmp, sb_samples);
offset = *synth_buf_offset;
synth_buf = synth_buf_ptr + offset;
for(j=0;j<32;j++) {
v = tmp[j];
#if FRAC_BITS <= 15
v = av_clip_int16(v);
#endif
synth_buf[j] = v;
}
memcpy(synth_buf + 512, synth_buf, 32 * sizeof(MPA_INT));
samples2 = samples + 31 * incr;
w = window;
w2 = window + 31;
sum = *dither_state;
p = synth_buf + 16;
SUM8(sum, +=, w, p);
p = synth_buf + 48;
SUM8(sum, -=, w + 32, p);
*samples = round_sample(&sum);
samples += incr;
w++;
for(j=1;j<16;j++) {
sum2 = 0;
p = synth_buf + 16 + j;
SUM8P2(sum, +=, sum2, -=, w, w2, p);
p = synth_buf + 48 - j;
SUM8P2(sum, -=, sum2, -=, w + 32, w2 + 32, p);
*samples = round_sample(&sum);
samples += incr;
sum += sum2;
*samples2 = round_sample(&sum);
samples2 -= incr;
w++;
w2--;
}
p = synth_buf + 32;
SUM8(sum, -=, w + 32, p);
*samples = round_sample(&sum);
*dither_state= sum;
offset = (offset - 32) & 511;
*synth_buf_offset = offset;
}
libavcodec/mpc.c:60: error: Buffer Overrun L2
Offset: [353+min(0, `c->synth_buf_offset[*]`), 368+max(511, `c->synth_buf_offset[*]`)] (⇐ [33+min(0, `c->synth_buf_offset[*]`), 48+max(511, `c->synth_buf_offset[*]`)] + 320) Size: 2 by call to `ff_mpa_synth_filter`.
libavcodec/mpc.c:51:1: Parameter `c->synth_buf[*]`
49. * Process decoded Musepack data and produce PCM
50. */
51. static void mpc_synth(MPCContext *c, int16_t *out)
^
52. {
53. int dither_state = 0;
libavcodec/mpc.c:60:13: Call
58. samples_ptr = samples + ch;
59. for(i = 0; i < SAMPLES_PER_BAND; i++) {
60. ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]),
^
61. mpa_window, &dither_state,
62. samples_ptr, 2,
libavcodec/mpegaudiodec.c:906:9: <Length trace>
904. /* we calculate two samples at the same time to avoid one memory
905. access per two sample */
906. for(j=1;j<16;j++) {
^
907. sum2 = 0;
908. p = synth_buf + 16 + j;
libavcodec/mpegaudiodec.c:906:9: Assignment
904. /* we calculate two samples at the same time to avoid one memory
905. access per two sample */
906. for(j=1;j<16;j++) {
^
907. sum2 = 0;
908. p = synth_buf + 16 + j;
libavcodec/mpegaudiodec.c:910:9: Assignment
908. p = synth_buf + 16 + j;
909. SUM8P2(sum, +=, sum2, -=, w, w2, p);
910. p = synth_buf + 48 - j;
^
911. SUM8P2(sum, -=, sum2, -=, w + 32, w2 + 32, p);
912.
libavcodec/mpegaudiodec.c:911:9: Array access: Offset: [353+min(0, c->synth_buf_offset[*]), 368+max(511, c->synth_buf_offset[*])] (⇐ [33+min(0, c->synth_buf_offset[*]), 48+max(511, c->synth_buf_offset[*])] + 320) Size: 2 by call to `ff_mpa_synth_filter`
909. SUM8P2(sum, +=, sum2, -=, w, w2, p);
910. p = synth_buf + 48 - j;
911. SUM8P2(sum, -=, sum2, -=, w + 32, w2 + 32, p);
^
912.
913. *samples = round_sample(&sum);
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L911
|
d2a_code_trace_data_42072
|
int test_mul(BIO *bp)
{
BIGNUM *a, *b, *c, *d, *e;
int i;
BN_CTX *ctx;
ctx = BN_CTX_new();
if (ctx == NULL)
EXIT(1);
a = BN_new();
b = BN_new();
c = BN_new();
d = BN_new();
e = BN_new();
for (i = 0; i < num0 + num1; i++) {
if (i <= num1) {
BN_bntest_rand(a, 100, 0, 0);
BN_bntest_rand(b, 100, 0, 0);
} else
BN_bntest_rand(b, i - num1, 0, 0);
a->neg = rand_neg();
b->neg = rand_neg();
BN_mul(c, a, b, ctx);
if (bp != NULL) {
if (!results) {
BN_print(bp, a);
BIO_puts(bp, " * ");
BN_print(bp, b);
BIO_puts(bp, " - ");
}
BN_print(bp, c);
BIO_puts(bp, "\n");
}
BN_div(d, e, c, a, ctx);
BN_sub(d, d, b);
if (!BN_is_zero(d) || !BN_is_zero(e)) {
fprintf(stderr, "Multiplication test failed!\n");
return 0;
}
}
BN_free(a);
BN_free(b);
BN_free(c);
BN_free(d);
BN_free(e);
BN_CTX_free(ctx);
return (1);
}
test/bntest.c:680: error: MEMORY_LEAK
memory dynamically allocated by call to `BN_new()` at line 648, column 9 is not reachable after line 680, column 5.
Showing all 171 steps of the trace
test/bntest.c:637:1: start of procedure test_mul()
635. }
636.
637. > int test_mul(BIO *bp)
638. {
639. BIGNUM *a, *b, *c, *d, *e;
test/bntest.c:643:5:
641. BN_CTX *ctx;
642.
643. > ctx = BN_CTX_new();
644. if (ctx == NULL)
645. EXIT(1);
crypto/bn/bn_ctx.c:189:1: start of procedure BN_CTX_new()
187.
188.
189. > BN_CTX *BN_CTX_new(void)
190. {
191. BN_CTX *ret;
crypto/bn/bn_ctx.c:193:9:
191. BN_CTX *ret;
192.
193. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE);
195. return NULL;
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_ctx.c:193:9: Taking false branch
191. BN_CTX *ret;
192.
193. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
194. BNerr(BN_F_BN_CTX_NEW, ERR_R_MALLOC_FAILURE);
195. return NULL;
crypto/bn/bn_ctx.c:198:5:
196. }
197. /* Initialise the structure */
198. > BN_POOL_init(&ret->pool);
199. BN_STACK_init(&ret->stack);
200. return ret;
crypto/bn/bn_ctx.c:335:1: start of procedure BN_POOL_init()
333. /***********/
334.
335. > static void BN_POOL_init(BN_POOL *p)
336. {
337. p->head = p->current = p->tail = NULL;
crypto/bn/bn_ctx.c:337:5:
335. static void BN_POOL_init(BN_POOL *p)
336. {
337. > p->head = p->current = p->tail = NULL;
338. p->used = p->size = 0;
339. }
crypto/bn/bn_ctx.c:338:5:
336. {
337. p->head = p->current = p->tail = NULL;
338. > p->used = p->size = 0;
339. }
340.
crypto/bn/bn_ctx.c:339:1: return from a call to BN_POOL_init
337. p->head = p->current = p->tail = NULL;
338. p->used = p->size = 0;
339. > }
340.
341. static void BN_POOL_finish(BN_POOL *p)
crypto/bn/bn_ctx.c:199:5:
197. /* Initialise the structure */
198. BN_POOL_init(&ret->pool);
199. > BN_STACK_init(&ret->stack);
200. return ret;
201. }
crypto/bn/bn_ctx.c:294:1: start of procedure BN_STACK_init()
292. /************/
293.
294. > static void BN_STACK_init(BN_STACK *st)
295. {
296. st->indexes = NULL;
crypto/bn/bn_ctx.c:296:5:
294. static void BN_STACK_init(BN_STACK *st)
295. {
296. > st->indexes = NULL;
297. st->depth = st->size = 0;
298. }
crypto/bn/bn_ctx.c:297:5:
295. {
296. st->indexes = NULL;
297. > st->depth = st->size = 0;
298. }
299.
crypto/bn/bn_ctx.c:298:1: return from a call to BN_STACK_init
296. st->indexes = NULL;
297. st->depth = st->size = 0;
298. > }
299.
300. static void BN_STACK_finish(BN_STACK *st)
crypto/bn/bn_ctx.c:200:5:
198. BN_POOL_init(&ret->pool);
199. BN_STACK_init(&ret->stack);
200. > return ret;
201. }
202.
crypto/bn/bn_ctx.c:201:1: return from a call to BN_CTX_new
199. BN_STACK_init(&ret->stack);
200. return ret;
201. > }
202.
203. BN_CTX *BN_CTX_secure_new(void)
test/bntest.c:644:9: Taking false branch
642.
643. ctx = BN_CTX_new();
644. if (ctx == NULL)
^
645. EXIT(1);
646.
test/bntest.c:647:5:
645. EXIT(1);
646.
647. > a = BN_new();
648. b = BN_new();
649. c = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:648:5:
646.
647. a = BN_new();
648. > b = BN_new();
649. c = BN_new();
650. d = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:649:5:
647. a = BN_new();
648. b = BN_new();
649. > c = BN_new();
650. d = BN_new();
651. e = BN_new();
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:650:5:
648. b = BN_new();
649. c = BN_new();
650. > d = BN_new();
651. e = BN_new();
652.
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:651:5:
649. c = BN_new();
650. d = BN_new();
651. > e = BN_new();
652.
653. for (i = 0; i < num0 + num1; i++) {
crypto/bn/bn_lib.c:277:1: start of procedure BN_new()
275. }
276.
277. > BIGNUM *BN_new(void)
278. {
279. BIGNUM *ret;
crypto/bn/bn_lib.c:281:9:
279. BIGNUM *ret;
280.
281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
155. }
156.
157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:159:5:
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
158. {
159. > void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:161:9: Taking true branch
159. void *ret = CRYPTO_malloc(num, file, line);
160.
161. if (ret != NULL)
^
162. memset(ret, 0, num);
163. return ret;
crypto/mem.c:162:9:
160.
161. if (ret != NULL)
162. > memset(ret, 0, num);
163. return ret;
164. }
crypto/mem.c:163:5:
161. if (ret != NULL)
162. memset(ret, 0, num);
163. > return ret;
164. }
165.
crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
162. memset(ret, 0, num);
163. return ret;
164. > }
165.
166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/bn/bn_lib.c:281:9: Taking false branch
279. BIGNUM *ret;
280.
281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) {
^
282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE);
283. return (NULL);
crypto/bn/bn_lib.c:285:5:
283. return (NULL);
284. }
285. > ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. return (ret);
crypto/bn/bn_lib.c:287:5:
285. ret->flags = BN_FLG_MALLOCED;
286. bn_check_top(ret);
287. > return (ret);
288. }
289.
crypto/bn/bn_lib.c:288:1: return from a call to BN_new
286. bn_check_top(ret);
287. return (ret);
288. > }
289.
290. BIGNUM *BN_secure_new(void)
test/bntest.c:653:10:
651. e = BN_new();
652.
653. > for (i = 0; i < num0 + num1; i++) {
654. if (i <= num1) {
655. BN_bntest_rand(a, 100, 0, 0);
test/bntest.c:653:17: Loop condition is false. Leaving loop
651. e = BN_new();
652.
653. for (i = 0; i < num0 + num1; i++) {
^
654. if (i <= num1) {
655. BN_bntest_rand(a, 100, 0, 0);
test/bntest.c:679:5:
677. }
678. }
679. > BN_free(a);
680. BN_free(b);
681. BN_free(c);
crypto/bn/bn_lib.c:252:1: start of procedure BN_free()
250. }
251.
252. > void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
crypto/bn/bn_lib.c:254:9: Taking false branch
252. void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
^
255. return;
256. bn_check_top(a);
crypto/bn/bn_lib.c:257:10:
255. return;
256. bn_check_top(a);
257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
963. }
964.
965. > int BN_get_flags(const BIGNUM *b, int n)
966. {
967. return b->flags & n;
crypto/bn/bn_lib.c:967:5:
965. int BN_get_flags(const BIGNUM *b, int n)
966. {
967. > return b->flags & n;
968. }
969.
crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
966. {
967. return b->flags & n;
968. > }
969.
970. /* Populate a BN_GENCB structure with an "old"-style callback */
crypto/bn/bn_lib.c:257:10: Taking false branch
255. return;
256. bn_check_top(a);
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
^
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:259:9: Taking false branch
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
^
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:263:9:
261. else {
262. #if OPENSSL_API_COMPAT < 0x00908000L
263. > a->flags |= BN_FLG_FREE;
264. #endif
265. a->d = NULL;
crypto/bn/bn_lib.c:265:9:
263. a->flags |= BN_FLG_FREE;
264. #endif
265. > a->d = NULL;
266. }
267. }
crypto/bn/bn_lib.c:259:5:
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. > if (a->flags & BN_FLG_MALLOCED)
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:267:1: return from a call to BN_free
265. a->d = NULL;
266. }
267. > }
268.
269. void bn_init(BIGNUM *a)
test/bntest.c:680:5:
678. }
679. BN_free(a);
680. > BN_free(b);
681. BN_free(c);
682. BN_free(d);
crypto/bn/bn_lib.c:252:1: start of procedure BN_free()
250. }
251.
252. > void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
crypto/bn/bn_lib.c:254:9: Taking false branch
252. void BN_free(BIGNUM *a)
253. {
254. if (a == NULL)
^
255. return;
256. bn_check_top(a);
crypto/bn/bn_lib.c:257:10:
255. return;
256. bn_check_top(a);
257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags()
963. }
964.
965. > int BN_get_flags(const BIGNUM *b, int n)
966. {
967. return b->flags & n;
crypto/bn/bn_lib.c:967:5:
965. int BN_get_flags(const BIGNUM *b, int n)
966. {
967. > return b->flags & n;
968. }
969.
crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags
966. {
967. return b->flags & n;
968. > }
969.
970. /* Populate a BN_GENCB structure with an "old"-style callback */
crypto/bn/bn_lib.c:257:10: Taking false branch
255. return;
256. bn_check_top(a);
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
^
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
crypto/bn/bn_lib.c:259:9: Taking false branch
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. if (a->flags & BN_FLG_MALLOCED)
^
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:263:9:
261. else {
262. #if OPENSSL_API_COMPAT < 0x00908000L
263. > a->flags |= BN_FLG_FREE;
264. #endif
265. a->d = NULL;
crypto/bn/bn_lib.c:265:9:
263. a->flags |= BN_FLG_FREE;
264. #endif
265. > a->d = NULL;
266. }
267. }
crypto/bn/bn_lib.c:259:5:
257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA))
258. bn_free_d(a);
259. > if (a->flags & BN_FLG_MALLOCED)
260. OPENSSL_free(a);
261. else {
crypto/bn/bn_lib.c:267:1: return from a call to BN_free
265. a->d = NULL;
266. }
267. > }
268.
269. void bn_init(BIGNUM *a)
|
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L680
|
d2a_code_trace_data_42073
|
int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len)
{
SHA_LONG64 l;
unsigned char *p = c->u.p;
const unsigned char *data = (const unsigned char *)_data;
if (len == 0)
return 1;
l = (c->Nl + (((SHA_LONG64) len) << 3)) & U64(0xffffffffffffffff);
if (l < c->Nl)
c->Nh++;
if (sizeof(len) >= 8)
c->Nh += (((SHA_LONG64) len) >> 61);
c->Nl = l;
if (c->num != 0) {
size_t n = sizeof(c->u) - c->num;
if (len < n) {
memcpy(p + c->num, data, len), c->num += (unsigned int)len;
return 1;
} else {
memcpy(p + c->num, data, n), c->num = 0;
len -= n, data += n;
sha512_block_data_order(c, p, 1);
}
}
if (len >= sizeof(c->u)) {
#ifndef SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA
if ((size_t)data % sizeof(c->u.d[0]) != 0)
while (len >= sizeof(c->u))
memcpy(p, data, sizeof(c->u)),
sha512_block_data_order(c, p, 1),
len -= sizeof(c->u), data += sizeof(c->u);
else
#endif
sha512_block_data_order(c, data, len / sizeof(c->u)),
data += len, len %= sizeof(c->u), data -= len;
}
if (len != 0)
memcpy(p, data, len), c->num = (int)len;
return 1;
}
crypto/dsa/dsa_ossl.c:92: error: INTEGER_OVERFLOW_L2
([1, +oo] - [-125, 127]):unsigned64 by call to `dsa_sign_setup`.
Showing all 11 steps of the trace
crypto/dsa/dsa_ossl.c:59:1: Parameter `dlen`
57. }
58.
59. > static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa)
60. {
61. BIGNUM *kinv = NULL;
crypto/dsa/dsa_ossl.c:92:10: Call
90.
91. redo:
92. if (!dsa_sign_setup(dsa, ctx, &kinv, &ret->r, dgst, dlen))
^
93. goto err;
94.
crypto/dsa/dsa_ossl.c:175:1: Parameter `dlen`
173. }
174.
175. > static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in,
176. BIGNUM **kinvp, BIGNUM **rp,
177. const unsigned char *dgst, int dlen)
crypto/dsa/dsa_ossl.c:216:18: Call
214. * This protects the private key from a weak PRNG.
215. */
216. if (!BN_generate_dsa_nonce(k, dsa->q, dsa->priv_key, dgst,
^
217. dlen, ctx))
218. goto err;
crypto/bn/bn_rand.c:205:1: Parameter `message_len`
203. * used.
204. */
205. > int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range,
206. const BIGNUM *priv, const unsigned char *message,
207. size_t message_len, BN_CTX *ctx)
crypto/bn/bn_rand.c:247:9: Call
245. SHA512_Update(&sha, &done, sizeof(done));
246. SHA512_Update(&sha, private_bytes, sizeof(private_bytes));
247. SHA512_Update(&sha, message, message_len);
^
248. SHA512_Update(&sha, random_bytes, sizeof(random_bytes));
249. SHA512_Final(digest, &sha);
crypto/sha/sha512.c:264:1: <LHS trace>
262. }
263.
264. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len)
265. {
266. SHA_LONG64 l;
crypto/sha/sha512.c:264:1: Parameter `len`
262. }
263.
264. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len)
265. {
266. SHA_LONG64 l;
crypto/sha/sha512.c:264:1: <RHS trace>
262. }
263.
264. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len)
265. {
266. SHA_LONG64 l;
crypto/sha/sha512.c:264:1: Parameter `len`
262. }
263.
264. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len)
265. {
266. SHA_LONG64 l;
crypto/sha/sha512.c:288:13: Binary operation: ([1, +oo] - [-125, 127]):unsigned64 by call to `dsa_sign_setup`
286. } else {
287. memcpy(p + c->num, data, n), c->num = 0;
288. len -= n, data += n;
^
289. sha512_block_data_order(c, p, 1);
290. }
|
https://github.com/openssl/openssl/blob/a766aab93a282774e63ba918d0bb1c6680a5f292/crypto/sha/sha512.c/#L288
|
d2a_code_trace_data_42074
|
char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
{
X509_NAME_ENTRY *ne;
int i;
int n, lold, l, l1, l2, num, j, type;
const char *s;
char *p;
unsigned char *q;
BUF_MEM *b = NULL;
static const char hex[17] = "0123456789ABCDEF";
int gs_doit[4];
char tmp_buf[80];
#ifdef CHARSET_EBCDIC
unsigned char ebcdic_buf[1024];
#endif
if (buf == NULL) {
if ((b = BUF_MEM_new()) == NULL)
goto err;
if (!BUF_MEM_grow(b, 200))
goto err;
b->data[0] = '\0';
len = 200;
} else if (len == 0) {
return NULL;
}
if (a == NULL) {
if (b) {
buf = b->data;
OPENSSL_free(b);
}
strncpy(buf, "NO X509_NAME", len);
buf[len - 1] = '\0';
return buf;
}
len--;
l = 0;
for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
ne = sk_X509_NAME_ENTRY_value(a->entries, i);
n = OBJ_obj2nid(ne->object);
if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) {
i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object);
s = tmp_buf;
}
l1 = strlen(s);
type = ne->value->type;
num = ne->value->length;
if (num > NAME_ONELINE_MAX) {
X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG);
goto end;
}
q = ne->value->data;
#ifdef CHARSET_EBCDIC
if (type == V_ASN1_GENERALSTRING ||
type == V_ASN1_VISIBLESTRING ||
type == V_ASN1_PRINTABLESTRING ||
type == V_ASN1_TELETEXSTRING ||
type == V_ASN1_VISIBLESTRING || type == V_ASN1_IA5STRING) {
ascii2ebcdic(ebcdic_buf, q, (num > (int)sizeof(ebcdic_buf))
? (int)sizeof(ebcdic_buf) : num);
q = ebcdic_buf;
}
#endif
if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) {
gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0;
for (j = 0; j < num; j++)
if (q[j] != 0)
gs_doit[j & 3] = 1;
if (gs_doit[0] | gs_doit[1] | gs_doit[2])
gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1;
else {
gs_doit[0] = gs_doit[1] = gs_doit[2] = 0;
gs_doit[3] = 1;
}
} else
gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1;
for (l2 = j = 0; j < num; j++) {
if (!gs_doit[j & 3])
continue;
l2++;
#ifndef CHARSET_EBCDIC
if ((q[j] < ' ') || (q[j] > '~'))
l2 += 3;
#else
if ((os_toascii[q[j]] < os_toascii[' ']) ||
(os_toascii[q[j]] > os_toascii['~']))
l2 += 3;
#endif
}
lold = l;
l += 1 + l1 + 1 + l2;
if (l > NAME_ONELINE_MAX) {
X509err(X509_F_X509_NAME_ONELINE, X509_R_NAME_TOO_LONG);
goto end;
}
if (b != NULL) {
if (!BUF_MEM_grow(b, l + 1))
goto err;
p = &(b->data[lold]);
} else if (l > len) {
break;
} else
p = &(buf[lold]);
*(p++) = '/';
memcpy(p, s, (unsigned int)l1);
p += l1;
*(p++) = '=';
#ifndef CHARSET_EBCDIC
q = ne->value->data;
#endif
for (j = 0; j < num; j++) {
if (!gs_doit[j & 3])
continue;
#ifndef CHARSET_EBCDIC
n = q[j];
if ((n < ' ') || (n > '~')) {
*(p++) = '\\';
*(p++) = 'x';
*(p++) = hex[(n >> 4) & 0x0f];
*(p++) = hex[n & 0x0f];
} else
*(p++) = n;
#else
n = os_toascii[q[j]];
if ((n < os_toascii[' ']) || (n > os_toascii['~'])) {
*(p++) = '\\';
*(p++) = 'x';
*(p++) = hex[(n >> 4) & 0x0f];
*(p++) = hex[n & 0x0f];
} else
*(p++) = q[j];
#endif
}
*p = '\0';
}
if (b != NULL) {
p = b->data;
OPENSSL_free(b);
} else
p = buf;
if (i == 0)
*p = '\0';
return (p);
err:
X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE);
end:
BUF_MEM_free(b);
return (NULL);
}
apps/s_client.c:2586: error: BUFFER_OVERRUN_L3
Offset: [199, 8191] Size: [1, 2147483644] by call to `X509_NAME_oneline`.
Showing all 6 steps of the trace
apps/s_client.c:2586:17: Call
2584. BIO_printf(bio, "---\nCertificate chain\n");
2585. for (i = 0; i < sk_X509_num(sk); i++) {
2586. X509_NAME_oneline(X509_get_subject_name(sk_X509_value(sk, i)),
^
2587. buf, sizeof buf);
2588. BIO_printf(bio, "%2d s:%s\n", i, buf);
crypto/x509/x509_obj.c:73:1: <Offset trace>
71. #define NAME_ONELINE_MAX (1024 * 1024)
72.
73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
74. {
75. X509_NAME_ENTRY *ne;
crypto/x509/x509_obj.c:73:1: Parameter `len`
71. #define NAME_ONELINE_MAX (1024 * 1024)
72.
73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
74. {
75. X509_NAME_ENTRY *ne;
crypto/x509/x509_obj.c:73:1: <Length trace>
71. #define NAME_ONELINE_MAX (1024 * 1024)
72.
73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
74. {
75. X509_NAME_ENTRY *ne;
crypto/x509/x509_obj.c:73:1: Parameter `*buf`
71. #define NAME_ONELINE_MAX (1024 * 1024)
72.
73. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
74. {
75. X509_NAME_ENTRY *ne;
crypto/x509/x509_obj.c:105:9: Array access: Offset: [199, 8191] Size: [1, 2147483644] by call to `X509_NAME_oneline`
103. }
104. strncpy(buf, "NO X509_NAME", len);
105. buf[len - 1] = '\0';
^
106. return buf;
107. }
|
https://github.com/openssl/openssl/blob/24c2cd3967ed23acc0bd31a3781c4525e2e42a2c/crypto/x509/x509_obj.c/#L105
|
d2a_code_trace_data_42075
|
static int cipher_test_enc(EVP_TEST *t, int enc,
size_t out_misalign, size_t inp_misalign, int frag)
{
CIPHER_DATA *expected = t->data;
unsigned char *in, *expected_out, *tmp = NULL;
size_t in_len, out_len, donelen = 0;
int ok = 0, tmplen, chunklen, tmpflen;
EVP_CIPHER_CTX *ctx = NULL;
t->err = "TEST_FAILURE";
if (!TEST_ptr(ctx = EVP_CIPHER_CTX_new()))
goto err;
EVP_CIPHER_CTX_set_flags(ctx, EVP_CIPHER_CTX_FLAG_WRAP_ALLOW);
if (enc) {
in = expected->plaintext;
in_len = expected->plaintext_len;
expected_out = expected->ciphertext;
out_len = expected->ciphertext_len;
} else {
in = expected->ciphertext;
in_len = expected->ciphertext_len;
expected_out = expected->plaintext;
out_len = expected->plaintext_len;
}
if (inp_misalign == (size_t)-1) {
tmp = OPENSSL_malloc(out_misalign + in_len + 2 * EVP_MAX_BLOCK_LENGTH);
if (!tmp)
goto err;
in = memcpy(tmp + out_misalign, in, in_len);
} else {
inp_misalign += 16 - ((out_misalign + in_len) & 15);
tmp = OPENSSL_malloc(out_misalign + in_len + 2 * EVP_MAX_BLOCK_LENGTH +
inp_misalign + in_len);
if (!tmp)
goto err;
in = memcpy(tmp + out_misalign + in_len + 2 * EVP_MAX_BLOCK_LENGTH +
inp_misalign, in, in_len);
}
if (!EVP_CipherInit_ex(ctx, expected->cipher, NULL, NULL, NULL, enc)) {
t->err = "CIPHERINIT_ERROR";
goto err;
}
if (expected->iv) {
if (expected->aead) {
if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_IVLEN,
expected->iv_len, 0)) {
t->err = "INVALID_IV_LENGTH";
goto err;
}
} else if (expected->iv_len != (size_t)EVP_CIPHER_CTX_iv_length(ctx)) {
t->err = "INVALID_IV_LENGTH";
goto err;
}
}
if (expected->aead) {
unsigned char *tag;
if (enc || expected->aead == EVP_CIPH_OCB_MODE) {
t->err = "TAG_LENGTH_SET_ERROR";
tag = NULL;
} else {
t->err = "TAG_SET_ERROR";
tag = expected->tag;
}
if (tag || expected->aead != EVP_CIPH_GCM_MODE) {
if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG,
expected->tag_len, tag))
goto err;
}
}
if (!EVP_CIPHER_CTX_set_key_length(ctx, expected->key_len)) {
t->err = "INVALID_KEY_LENGTH";
goto err;
}
if (!EVP_CipherInit_ex(ctx, NULL, NULL, expected->key, expected->iv, -1)) {
t->err = "KEY_SET_ERROR";
goto err;
}
if (!enc && expected->aead == EVP_CIPH_OCB_MODE) {
if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG,
expected->tag_len, expected->tag)) {
t->err = "TAG_SET_ERROR";
goto err;
}
}
if (expected->aead == EVP_CIPH_CCM_MODE) {
if (!EVP_CipherUpdate(ctx, NULL, &tmplen, NULL, out_len)) {
t->err = "CCM_PLAINTEXT_LENGTH_SET_ERROR";
goto err;
}
}
if (expected->aad) {
t->err = "AAD_SET_ERROR";
if (!frag) {
if (!EVP_CipherUpdate(ctx, NULL, &chunklen, expected->aad,
expected->aad_len))
goto err;
} else {
if (expected->aad_len > 0) {
if (!EVP_CipherUpdate(ctx, NULL, &chunklen, expected->aad, 1))
goto err;
donelen++;
}
if (expected->aad_len > 2) {
if (!EVP_CipherUpdate(ctx, NULL, &chunklen,
expected->aad + donelen,
expected->aad_len - 2))
goto err;
donelen += expected->aad_len - 2;
}
if (expected->aad_len > 1
&& !EVP_CipherUpdate(ctx, NULL, &chunklen,
expected->aad + donelen, 1))
goto err;
}
}
EVP_CIPHER_CTX_set_padding(ctx, 0);
t->err = "CIPHERUPDATE_ERROR";
tmplen = 0;
if (!frag) {
if (!EVP_CipherUpdate(ctx, tmp + out_misalign, &tmplen, in, in_len))
goto err;
} else {
if (in_len > 0) {
if (!EVP_CipherUpdate(ctx, tmp + out_misalign, &chunklen, in, 1))
goto err;
tmplen += chunklen;
in++;
in_len--;
}
if (in_len > 1) {
if (!EVP_CipherUpdate(ctx, tmp + out_misalign + tmplen, &chunklen,
in, in_len - 1))
goto err;
tmplen += chunklen;
in += in_len - 1;
in_len = 1;
}
if (in_len > 0 ) {
if (!EVP_CipherUpdate(ctx, tmp + out_misalign + tmplen, &chunklen,
in, 1))
goto err;
tmplen += chunklen;
}
}
if (!EVP_CipherFinal_ex(ctx, tmp + out_misalign + tmplen, &tmpflen)) {
t->err = "CIPHERFINAL_ERROR";
goto err;
}
if (!TEST_mem_eq(expected_out, out_len,
tmp + out_misalign, tmplen + tmpflen)) {
t->err = "VALUE_MISMATCH";
goto err;
}
if (enc && expected->aead) {
unsigned char rtag[16];
if (!TEST_size_t_le(expected->tag_len, sizeof(rtag))) {
t->err = "TAG_LENGTH_INTERNAL_ERROR";
goto err;
}
if (!EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG,
expected->tag_len, rtag)) {
t->err = "TAG_RETRIEVE_ERROR";
goto err;
}
if (!TEST_mem_eq(expected->tag, expected->tag_len,
rtag, expected->tag_len)) {
t->err = "TAG_VALUE_MISMATCH";
goto err;
}
}
t->err = NULL;
ok = 1;
err:
OPENSSL_free(tmp);
EVP_CIPHER_CTX_free(ctx);
return ok;
}
test/evp_test.c:755: error: INTEGER_OVERFLOW_L1
([18446744073709551615, +oo] + [1, 16]):unsigned64 by call to `cipher_test_enc`.
Showing all 8 steps of the trace
test/evp_test.c:740:14: Assignment
738. static char aux_err[64];
739. t->aux_err = aux_err;
740. for (inp_misalign = (size_t)-1; inp_misalign != 2; inp_misalign++) {
^
741. if (inp_misalign == (size_t)-1) {
742. /* kludge: inp_misalign == -1 means "exercise in-place" */
test/evp_test.c:755:22: Call
753. }
754. if (cdat->enc) {
755. rv = cipher_test_enc(t, 1, out_misalign, inp_misalign, frag);
^
756. /* Not fatal errors: return */
757. if (rv != 1) {
test/evp_test.c:514:1: <LHS trace>
512. }
513.
514. > static int cipher_test_enc(EVP_TEST *t, int enc,
515. size_t out_misalign, size_t inp_misalign, int frag)
516. {
test/evp_test.c:514:1: Parameter `inp_misalign`
512. }
513.
514. > static int cipher_test_enc(EVP_TEST *t, int enc,
515. size_t out_misalign, size_t inp_misalign, int frag)
516. {
test/evp_test.c:514:1: <RHS trace>
512. }
513.
514. > static int cipher_test_enc(EVP_TEST *t, int enc,
515. size_t out_misalign, size_t inp_misalign, int frag)
516. {
test/evp_test.c:514:1: Parameter `t->data->plaintext_len`
512. }
513.
514. > static int cipher_test_enc(EVP_TEST *t, int enc,
515. size_t out_misalign, size_t inp_misalign, int frag)
516. {
test/evp_test.c:529:9: Assignment
527. if (enc) {
528. in = expected->plaintext;
529. in_len = expected->plaintext_len;
^
530. expected_out = expected->ciphertext;
531. out_len = expected->ciphertext_len;
test/evp_test.c:547:9: Binary operation: ([18446744073709551615, +oo] + [1, 16]):unsigned64 by call to `cipher_test_enc`
545. in = memcpy(tmp + out_misalign, in, in_len);
546. } else {
547. inp_misalign += 16 - ((out_misalign + in_len) & 15);
^
548. /*
549. * 'tmp' will store both output and copy of input. We make the copy
|
https://github.com/openssl/openssl/blob/7f7eb90b8ac55997c5c825bb3ebcfe28611e06f5/test/evp_test.c/#L547
|
d2a_code_trace_data_42076
|
PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx)
{
STACK_OF(PKCS7_RECIP_INFO) *rsk;
PKCS7_RECIP_INFO *ri;
int i;
i=OBJ_obj2nid(p7->type);
if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
rsk=p7->d.signed_and_enveloped->recipientinfo;
ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
return(ri->issuer_and_serial);
}
crypto/pkcs7/pk7_doit.c:869: error: NULL_DEREFERENCE
pointer `ri` last assigned on line 868 could be null and is dereferenced at line 869, column 8.
Showing all 39 steps of the trace
crypto/pkcs7/pk7_doit.c:857:1: start of procedure PKCS7_get_issuer_and_serial()
855. }
856.
857. > PKCS7_ISSUER_AND_SERIAL *PKCS7_get_issuer_and_serial(PKCS7 *p7, int idx)
858. {
859. STACK_OF(PKCS7_RECIP_INFO) *rsk;
crypto/pkcs7/pk7_doit.c:863:2:
861. int i;
862.
863. > i=OBJ_obj2nid(p7->type);
864. if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
865. rsk=p7->d.signed_and_enveloped->recipientinfo;
crypto/objects/obj_dat.c:366:1: start of procedure OBJ_obj2nid()
364. }
365.
366. > int OBJ_obj2nid(const ASN1_OBJECT *a)
367. {
368. ASN1_OBJECT **op;
crypto/objects/obj_dat.c:371:6: Taking false branch
369. ADDED_OBJ ad,*adp;
370.
371. if (a == NULL)
^
372. return(NID_undef);
373. if (a->nid != 0)
crypto/objects/obj_dat.c:373:6: Taking false branch
371. if (a == NULL)
372. return(NID_undef);
373. if (a->nid != 0)
^
374. return(a->nid);
375.
crypto/objects/obj_dat.c:376:6: Taking true branch
374. return(a->nid);
375.
376. if (added != NULL)
^
377. {
378. ad.type=ADDED_DATA;
crypto/objects/obj_dat.c:378:3:
376. if (added != NULL)
377. {
378. > ad.type=ADDED_DATA;
379. ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
380. adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
crypto/objects/obj_dat.c:379:3:
377. {
378. ad.type=ADDED_DATA;
379. > ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
380. adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
381. if (adp != NULL) return (adp->obj->nid);
crypto/objects/obj_dat.c:380:3:
378. ad.type=ADDED_DATA;
379. ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
380. > adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
381. if (adp != NULL) return (adp->obj->nid);
382. }
crypto/lhash/lhash.c:248:1: start of procedure lh_retrieve()
246. }
247.
248. > void *lh_retrieve(LHASH *lh, const void *data)
249. {
250. unsigned long hash;
crypto/lhash/lhash.c:254:2:
252. const void *ret;
253.
254. > lh->error=0;
255. rn=getrn(lh,data,&hash);
256.
crypto/lhash/lhash.c:255:2: Skipping getrn(): empty list of specs
253.
254. lh->error=0;
255. rn=getrn(lh,data,&hash);
^
256.
257. if (*rn == NULL)
crypto/lhash/lhash.c:257:6: Taking false branch
255. rn=getrn(lh,data,&hash);
256.
257. if (*rn == NULL)
^
258. {
259. lh->num_retrieve_miss++;
crypto/lhash/lhash.c:264:3:
262. else
263. {
264. > ret= (*rn)->data;
265. lh->num_retrieve++;
266. }
crypto/lhash/lhash.c:265:3:
263. {
264. ret= (*rn)->data;
265. > lh->num_retrieve++;
266. }
267. return((void *)ret);
crypto/lhash/lhash.c:267:2:
265. lh->num_retrieve++;
266. }
267. > return((void *)ret);
268. }
269.
crypto/lhash/lhash.c:268:2: return from a call to lh_retrieve
266. }
267. return((void *)ret);
268. }
^
269.
270. static void doall_util_fn(LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,
crypto/objects/obj_dat.c:381:7: Taking true branch
379. ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
380. adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
381. if (adp != NULL) return (adp->obj->nid);
^
382. }
383. op=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ,
crypto/objects/obj_dat.c:381:20:
379. ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
380. adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
381. > if (adp != NULL) return (adp->obj->nid);
382. }
383. op=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ,
crypto/objects/obj_dat.c:388:2: return from a call to OBJ_obj2nid
386. return(NID_undef);
387. return((*op)->nid);
388. }
^
389.
390. /* Convert an object name into an ASN1_OBJECT
crypto/pkcs7/pk7_doit.c:864:6: Taking false branch
862.
863. i=OBJ_obj2nid(p7->type);
864. if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
^
865. rsk=p7->d.signed_and_enveloped->recipientinfo;
866. ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
crypto/pkcs7/pk7_doit.c:865:2:
863. i=OBJ_obj2nid(p7->type);
864. if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
865. > rsk=p7->d.signed_and_enveloped->recipientinfo;
866. ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
867. if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
crypto/pkcs7/pk7_doit.c:866:2:
864. if (i != NID_pkcs7_signedAndEnveloped) return(NULL);
865. rsk=p7->d.signed_and_enveloped->recipientinfo;
866. > ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
867. if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
868. ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
crypto/stack/stack.c:308:1: start of procedure sk_value()
306. }
307.
308. > char *sk_value(const STACK *st, int i)
309. {
310. if(st == NULL) return NULL;
crypto/stack/stack.c:310:5: Taking true branch
308. char *sk_value(const STACK *st, int i)
309. {
310. if(st == NULL) return NULL;
^
311. return st->data[i];
312. }
crypto/stack/stack.c:310:17:
308. char *sk_value(const STACK *st, int i)
309. {
310. > if(st == NULL) return NULL;
311. return st->data[i];
312. }
crypto/stack/stack.c:312:1: return from a call to sk_value
310. if(st == NULL) return NULL;
311. return st->data[i];
312. > }
313.
314. char *sk_set(STACK *st, int i, char *value)
crypto/pkcs7/pk7_doit.c:867:6:
865. rsk=p7->d.signed_and_enveloped->recipientinfo;
866. ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
867. > if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
868. ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
869. return(ri->issuer_and_serial);
crypto/stack/stack.c:302:1: start of procedure sk_num()
300. }
301.
302. > int sk_num(const STACK *st)
303. {
304. if(st == NULL) return -1;
crypto/stack/stack.c:304:5: Taking true branch
302. int sk_num(const STACK *st)
303. {
304. if(st == NULL) return -1;
^
305. return st->num;
306. }
crypto/stack/stack.c:304:17:
302. int sk_num(const STACK *st)
303. {
304. > if(st == NULL) return -1;
305. return st->num;
306. }
crypto/stack/stack.c:306:1: return from a call to sk_num
304. if(st == NULL) return -1;
305. return st->num;
306. > }
307.
308. char *sk_value(const STACK *st, int i)
crypto/pkcs7/pk7_doit.c:867:6: Taking false branch
865. rsk=p7->d.signed_and_enveloped->recipientinfo;
866. ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
867. if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
^
868. ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
869. return(ri->issuer_and_serial);
crypto/pkcs7/pk7_doit.c:868:2:
866. ri=sk_PKCS7_RECIP_INFO_value(rsk,0);
867. if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
868. > ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
869. return(ri->issuer_and_serial);
870. }
crypto/stack/stack.c:308:1: start of procedure sk_value()
306. }
307.
308. > char *sk_value(const STACK *st, int i)
309. {
310. if(st == NULL) return NULL;
crypto/stack/stack.c:310:5: Taking true branch
308. char *sk_value(const STACK *st, int i)
309. {
310. if(st == NULL) return NULL;
^
311. return st->data[i];
312. }
crypto/stack/stack.c:310:17:
308. char *sk_value(const STACK *st, int i)
309. {
310. > if(st == NULL) return NULL;
311. return st->data[i];
312. }
crypto/stack/stack.c:312:1: return from a call to sk_value
310. if(st == NULL) return NULL;
311. return st->data[i];
312. > }
313.
314. char *sk_set(STACK *st, int i, char *value)
crypto/pkcs7/pk7_doit.c:869:2:
867. if (sk_PKCS7_RECIP_INFO_num(rsk) <= idx) return(NULL);
868. ri=sk_PKCS7_RECIP_INFO_value(rsk,idx);
869. > return(ri->issuer_and_serial);
870. }
871.
|
https://github.com/openssl/openssl/blob/aff0542844173a9b7fc66b121bdf93316d9e801d/crypto/pkcs7/pk7_doit.c/#L869
|
d2a_code_trace_data_42077
|
int is_partially_overlapping(const void *ptr1, const void *ptr2, int len)
{
PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2;
int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) |
(diff > (0 - (PTRDIFF_T)len)));
assert(!overlapped);
return overlapped;
}
crypto/pem/pvkfmt.c:700: error: INTEGER_OVERFLOW_L2
(0 - [-oo, 32]):unsigned64 by call to `EVP_DecryptUpdate`.
Showing all 7 steps of the trace
crypto/pem/pvkfmt.c:700:14: Call
698. if (!EVP_DecryptInit_ex(cctx, EVP_rc4(), NULL, keybuf, NULL))
699. goto err;
700. if (!EVP_DecryptUpdate(cctx, q, &enctmplen, p, inlen))
^
701. goto err;
702. if (!EVP_DecryptFinal_ex(cctx, q + enctmplen, &enctmplen))
crypto/evp/evp_enc.c:416:1: Parameter `ctx->cipher->block_size`
414. }
415.
416. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
417. const unsigned char *in, int inl)
418. {
crypto/evp/evp_enc.c:422:5: Assignment
420. unsigned int b;
421.
422. b = ctx->cipher->block_size;
^
423.
424. if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
crypto/evp/evp_enc.c:452:16: Call
450. /* see comment about PTRDIFF_T comparison above */
451. if (((PTRDIFF_T)out == (PTRDIFF_T)in)
452. || is_partially_overlapping(out, in, b)) {
^
453. EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING);
454. return 0;
crypto/evp/evp_enc.c:279:1: <RHS trace>
277. #endif
278.
279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len)
280. {
281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2;
crypto/evp/evp_enc.c:279:1: Parameter `len`
277. #endif
278.
279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len)
280. {
281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2;
crypto/evp/evp_enc.c:288:50: Binary operation: (0 - [-oo, 32]):unsigned64 by call to `EVP_DecryptUpdate`
286. */
287. int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) |
288. (diff > (0 - (PTRDIFF_T)len)));
^
289. assert(!overlapped);
290. return overlapped;
|
https://github.com/openssl/openssl/blob/7141ba31969d0b378d08104a51f8f99b9187b9d5/crypto/evp/evp_enc.c/#L288
|
d2a_code_trace_data_42078
|
int BUF_MEM_grow_clean(BUF_MEM *str, size_t len)
{
char *ret;
size_t n;
if (str->length >= len)
{
memset(&str->data[len],0,str->length-len);
str->length=len;
return(len);
}
if (str->max >= len)
{
memset(&str->data[str->length],0,len-str->length);
str->length=len;
return(len);
}
if (len > LIMIT_BEFORE_EXPANSION)
{
BUFerr(BUF_F_BUF_MEM_GROW_CLEAN,ERR_R_MALLOC_FAILURE);
return 0;
}
n=(len+3)/3*4;
if (str->data == NULL)
ret=OPENSSL_malloc(n);
else
ret=OPENSSL_realloc_clean(str->data,str->max,n);
if (ret == NULL)
{
BUFerr(BUF_F_BUF_MEM_GROW_CLEAN,ERR_R_MALLOC_FAILURE);
len=0;
}
else
{
str->data=ret;
str->max=n;
memset(&str->data[str->length],0,len-str->length);
str->length=len;
}
return(len);
}
ssl/d1_srvr.c:444: error: INTEGER_OVERFLOW_L2
([0, +oo] - 10):unsigned64 by call to `ssl3_send_server_certificate`.
Showing all 13 steps of the trace
ssl/d1_srvr.c:163:1: Parameter `s->init_buf->length`
161. DTLSv1_2_enc_data)
162.
163. > int dtls1_accept(SSL *s)
164. {
165. BUF_MEM *buf;
ssl/d1_srvr.c:444:9: Call
442. {
443. dtls1_start_timer(s);
444. ret=ssl3_send_server_certificate(s);
^
445. if (ret <= 0) goto end;
446. #ifndef OPENSSL_NO_TLSEXT
ssl/s3_srvr.c:3461:1: Parameter `s->init_buf->length`
3459. }
3460.
3461. > int ssl3_send_server_certificate(SSL *s)
3462. {
3463. CERT_PKEY *cpk;
ssl/s3_srvr.c:3479:8: Call
3477. }
3478.
3479. if (!ssl3_output_cert_chain(s,cpk))
^
3480. {
3481. SSLerr(SSL_F_SSL3_SEND_SERVER_CERTIFICATE,ERR_R_INTERNAL_ERROR);
ssl/s3_both.c:323:1: Parameter `s->init_buf->length`
321. }
322.
323. > unsigned long ssl3_output_cert_chain(SSL *s, CERT_PKEY *cpk)
324. {
325. unsigned char *p;
ssl/s3_both.c:328:7: Call
326. unsigned long l = 3 + SSL_HM_HEADER_LENGTH(s);
327.
328. if (!ssl_add_cert_chain(s, cpk, &l))
^
329. return 0;
330.
ssl/ssl_cert.c:1114:1: Parameter `s->init_buf->length`
1112.
1113. /* Add certificate chain to internal SSL BUF_MEM strcuture */
1114. > int ssl_add_cert_chain(SSL *s, CERT_PKEY *cpk, unsigned long *l)
1115. {
1116. BUF_MEM *buf = s->init_buf;
ssl/ssl_cert.c:1124:7: Call
1122.
1123. /* TLSv1 sends a chain with nothing in it, instead of an alert */
1124. if (!BUF_MEM_grow_clean(buf,10))
^
1125. {
1126. SSLerr(SSL_F_SSL_ADD_CERT_CHAIN,ERR_R_BUF_LIB);
crypto/buffer/buffer.c:139:1: <LHS trace>
137. }
138.
139. > int BUF_MEM_grow_clean(BUF_MEM *str, size_t len)
140. {
141. char *ret;
crypto/buffer/buffer.c:139:1: Parameter `len`
137. }
138.
139. > int BUF_MEM_grow_clean(BUF_MEM *str, size_t len)
140. {
141. char *ret;
crypto/buffer/buffer.c:139:1: <RHS trace>
137. }
138.
139. > int BUF_MEM_grow_clean(BUF_MEM *str, size_t len)
140. {
141. char *ret;
crypto/buffer/buffer.c:139:1: Parameter `len`
137. }
138.
139. > int BUF_MEM_grow_clean(BUF_MEM *str, size_t len)
140. {
141. char *ret;
crypto/buffer/buffer.c:146:3: Binary operation: ([0, +oo] - 10):unsigned64 by call to `ssl3_send_server_certificate`
144. if (str->length >= len)
145. {
146. memset(&str->data[len],0,str->length-len);
^
147. str->length=len;
148. return(len);
|
https://github.com/openssl/openssl/blob/66f96fe2d519147097c118d4bf60704c69ed0635/crypto/buffer/buffer.c/#L146
|
d2a_code_trace_data_42079
|
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;
}
apps/apps.c:1355: error: BUFFER_OVERRUN_L3
Offset: [-1, 165] Size: [1, 166] by call to `BN_rand`.
Showing all 12 steps of the trace
apps/apps.c:1355:10: Call
1353. return 0;
1354.
1355. if (!BN_rand(btmp, SERIAL_RAND_BITS, BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY))
^
1356. goto error;
1357. if (ai && !BN_to_ASN1_INTEGER(btmp, ai))
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, 165] Size: [1, 166] 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_42080
|
ngx_int_t
ngx_http_arg(ngx_http_request_t *r, u_char *name, size_t len, ngx_str_t *value)
{
u_char *p, *last;
if (r->args.len == 0) {
return NGX_DECLINED;
}
p = r->args.data;
last = p + r->args.len;
for ( ; p < last; p++) {
p = ngx_strlcasestrn(p, last - 1, name, len - 1);
if (p == NULL) {
return NGX_DECLINED;
}
if ((p == r->args.data || *(p - 1) == '&') && *(p + len) == '=') {
value->data = p + len + 1;
p = ngx_strlchr(p, last, '&');
if (p == NULL) {
p = r->args.data + r->args.len;
}
value->len = p - value->data;
return NGX_OK;
}
}
return NGX_DECLINED;
}
src/http/ngx_http_variables.c:1078: error: Integer Overflow L2
([0, +oo] - 1):unsigned64 by call to `ngx_http_arg`.
src/http/ngx_http_variables.c:1075:5: Assignment
1073. ngx_str_t value;
1074.
1075. len = name->len - (sizeof("arg_") - 1);
^
1076. arg = name->data + sizeof("arg_") - 1;
1077.
src/http/ngx_http_variables.c:1078:21: Call
1076. arg = name->data + sizeof("arg_") - 1;
1077.
1078. if (len == 0 || ngx_http_arg(r, arg, len, &value) != NGX_OK) {
^
1079. v->not_found = 1;
1080. return NGX_OK;
src/http/ngx_http_parse.c:2102:1: <LHS trace>
2100.
2101.
2102. ngx_int_t
^
2103. ngx_http_arg(ngx_http_request_t *r, u_char *name, size_t len, ngx_str_t *value)
2104. {
src/http/ngx_http_parse.c:2102:1: Parameter `len`
2100.
2101.
2102. ngx_int_t
^
2103. ngx_http_arg(ngx_http_request_t *r, u_char *name, size_t len, ngx_str_t *value)
2104. {
src/http/ngx_http_parse.c:2118:13: Binary operation: ([0, +oo] - 1):unsigned64 by call to `ngx_http_arg`
2116. /* we need '=' after name, so drop one char from last */
2117.
2118. p = ngx_strlcasestrn(p, last - 1, name, len - 1);
^
2119.
2120. if (p == NULL) {
|
https://github.com/nginx/nginx/blob/aa94ee82f6040c8e2cbde3ae4de931c23fade3f3/src/http/ngx_http_parse.c/#L2118
|
d2a_code_trace_data_42081
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/rsa/rsa_ossl.c:425: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `rsa_blinding_convert`.
Showing all 19 steps of the trace
crypto/rsa/rsa_ossl.c:382:5: Call
380. if ((ctx = BN_CTX_new()) == NULL)
381. goto err;
382. BN_CTX_start(ctx);
^
383. f = BN_CTX_get(ctx);
384. ret = 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_ossl.c:425:14: Call
423. goto err;
424. }
425. if (!rsa_blinding_convert(blinding, f, unblind, ctx))
^
426. goto err;
427. }
crypto/rsa/rsa_ossl.c:197:1: Parameter `ctx->stack.depth`
195. }
196.
197. > static int rsa_blinding_convert(BN_BLINDING *b, BIGNUM *f, BIGNUM *unblind,
198. BN_CTX *ctx)
199. {
crypto/rsa/rsa_ossl.c:204:16: Call
202. * Local blinding: store the unblinding factor in BN_BLINDING.
203. */
204. return BN_BLINDING_convert_ex(f, NULL, b, ctx);
^
205. } else {
206. /*
crypto/bn/bn_blind.c:134:1: Parameter `ctx->stack.depth`
132. }
133.
134. > int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx)
135. {
136. int ret = 1;
crypto/bn/bn_blind.c:148:15: Call
146. /* Fresh blinding, doesn't need updating. */
147. b->counter = 0;
148. else if (!BN_BLINDING_update(b, ctx))
^
149. return 0;
150.
crypto/bn/bn_blind.c:93:1: Parameter `ctx->stack.depth`
91. }
92.
93. > int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx)
94. {
95. int ret = 0;
crypto/bn/bn_blind.c:116:18: Call
114. goto err;
115. } else {
116. if (!BN_mod_mul(b->Ai, b->Ai, b->Ai, b->mod, ctx)
^
117. || !BN_mod_mul(b->A, b->A, b->A, b->mod, ctx))
118. goto err;
crypto/bn/bn_mod.c:203:5: Call
201. bn_check_top(m);
202.
203. BN_CTX_start(ctx);
^
204. if ((t = BN_CTX_get(ctx)) == NULL)
205. goto err;
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_mod.c:218:5: Call
216. ret = 1;
217. err:
218. BN_CTX_end(ctx);
^
219. return ret;
220. }
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 `rsa_blinding_convert`
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_42082
|
size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len)
{
unsigned int M = (ctx->nonce.c[0] >> 3) & 7;
M *= 2;
M += 2;
if (len < M)
return 0;
memcpy(tag, ctx->cmac.c, M);
return M;
}
crypto/evp/e_aes.c:1896: error: BUFFER_OVERRUN_L3
Offset added: [2, 16] Size: [0, +oo] by call to `CRYPTO_ccm128_tag`.
Showing all 7 steps of the trace
crypto/evp/e_aes.c:1860:1: Parameter `arg`
1858. BLOCK_CIPHER_custom(NID_aes, 256, 1, 16, xts, XTS, XTS_FLAGS)
1859.
1860. > static int aes_ccm_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr)
1861. {
1862. EVP_AES_CCM_CTX *cctx = c->cipher_data;
crypto/evp/e_aes.c:1896:14: Call
1894. if (!c->encrypt || !cctx->tag_set)
1895. return 0;
1896. if (!CRYPTO_ccm128_tag(&cctx->ccm, ptr, (size_t)arg))
^
1897. return 0;
1898. cctx->tag_set = 0;
crypto/modes/ccm128.c:469:1: <Offset trace>
467. }
468.
469. > size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len)
470. {
471. unsigned int M = (ctx->nonce.c[0] >> 3) & 7; /* the M parameter */
crypto/modes/ccm128.c:469:1: Parameter `len`
467. }
468.
469. > size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len)
470. {
471. unsigned int M = (ctx->nonce.c[0] >> 3) & 7; /* the M parameter */
crypto/modes/ccm128.c:469:1: <Length trace>
467. }
468.
469. > size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len)
470. {
471. unsigned int M = (ctx->nonce.c[0] >> 3) & 7; /* the M parameter */
crypto/modes/ccm128.c:469:1: Parameter `ctx->cmac.c[*]`
467. }
468.
469. > size_t CRYPTO_ccm128_tag(CCM128_CONTEXT *ctx, unsigned char *tag, size_t len)
470. {
471. unsigned int M = (ctx->nonce.c[0] >> 3) & 7; /* the M parameter */
crypto/modes/ccm128.c:477:5: Array access: Offset added: [2, 16] Size: [0, +oo] by call to `CRYPTO_ccm128_tag`
475. if (len < M)
476. return 0;
477. memcpy(tag, ctx->cmac.c, M);
^
478. return M;
479. }
|
https://github.com/openssl/openssl/blob/9c46f4b9cd4912b61cb546c48b678488d7f26ed6/crypto/modes/ccm128.c/#L477
|
d2a_code_trace_data_42083
|
static int opt_vstats(void *optctx, const char *opt, const char *arg)
{
char filename[40];
time_t today2 = time(NULL);
struct tm *today = localtime(&today2);
snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
today->tm_sec);
return opt_vstats_file(NULL, opt, filename);
}
avconv_opt.c:1749: error: Null Dereference
pointer `today` last assigned on line 1747 could be null and is dereferenced at line 1749, column 69.
avconv_opt.c:1743:1: start of procedure opt_vstats()
1741. }
1742.
1743. static int opt_vstats(void *optctx, const char *opt, const char *arg)
^
1744. {
1745. char filename[40];
avconv_opt.c:1746:5:
1744. {
1745. char filename[40];
1746. time_t today2 = time(NULL);
^
1747. struct tm *today = localtime(&today2);
1748.
avconv_opt.c:1747:5:
1745. char filename[40];
1746. time_t today2 = time(NULL);
1747. struct tm *today = localtime(&today2);
^
1748.
1749. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
avconv_opt.c:1749:5:
1747. struct tm *today = localtime(&today2);
1748.
1749. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min,
^
1750. today->tm_sec);
1751. return opt_vstats_file(NULL, opt, filename);
|
https://github.com/libav/libav/blob/e984f47873258b600fd88423f40e3cdaad179190/avconv_opt.c/#L1749
|
d2a_code_trace_data_42084
|
static int asn1_get_length(const unsigned char **pp, int *inf, long *rl,
int max)
{
const unsigned char *p = *pp;
unsigned long ret = 0;
unsigned int i;
if (max-- < 1)
return (0);
if (*p == 0x80) {
*inf = 1;
ret = 0;
p++;
} else {
*inf = 0;
i = *p & 0x7f;
if (*(p++) & 0x80) {
if (max < (int)i)
return 0;
while (i && *p == 0) {
p++;
i--;
}
if (i > sizeof(long))
return 0;
while (i-- > 0) {
ret <<= 8L;
ret |= *(p++);
}
} else
ret = i;
}
if (ret > LONG_MAX)
return 0;
*pp = p;
*rl = (long)ret;
return (1);
}
crypto/pem/pem_info.c:244: error: BUFFER_OVERRUN_L3
Offset: [2, +oo] Size: [1, 2147483644] by call to `d2i_PrivateKey`.
Showing all 28 steps of the trace
crypto/pem/pem_info.c:118:13: Call
116. raw = 0;
117. ptype = 0;
118. i = PEM_read_bio(bp, &name, &header, &data, &len);
^
119. if (i == 0) {
120. error = ERR_GET_REASON(ERR_peek_last_error());
crypto/pem/pem_lib.c:677:1: Parameter `**data`
675. #endif
676.
677. > int PEM_read_bio(BIO *bp, char **name, char **header, unsigned char **data,
678. long *len)
679. {
crypto/pem/pem_info.c:242:17: Assignment
240. if (!PEM_do_header(&cipher, data, &len, cb, u))
241. goto err;
242. p = data;
^
243. if (ptype) {
244. if (!d2i_PrivateKey(ptype, pp, &p, len)) {
crypto/pem/pem_info.c:244:26: Call
242. p = data;
243. if (ptype) {
244. if (!d2i_PrivateKey(ptype, pp, &p, len)) {
^
245. PEMerr(PEM_F_PEM_X509_INFO_READ_BIO, ERR_R_ASN1_LIB);
246. goto err;
crypto/asn1/d2i_pr.c:72:1: Parameter `**pp`
70. #include "internal/evp_int.h"
71.
72. > EVP_PKEY *d2i_PrivateKey(int type, EVP_PKEY **a, const unsigned char **pp,
73. long length)
74. {
crypto/asn1/d2i_pr.c:76:5: Assignment
74. {
75. EVP_PKEY *ret;
76. const unsigned char *p = *pp;
^
77.
78. if ((a == NULL) || (*a == NULL)) {
crypto/asn1/d2i_pr.c:102:18: Call
100. if (ret->ameth->priv_decode) {
101. PKCS8_PRIV_KEY_INFO *p8 = NULL;
102. p8 = d2i_PKCS8_PRIV_KEY_INFO(NULL, &p, length);
^
103. if (!p8)
104. goto err;
crypto/asn1/p8_pkey.c:87:1: Parameter `**in`
85. } ASN1_SEQUENCE_END_cb(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO)
86.
87. > IMPLEMENT_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO)
88.
89. int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj,
crypto/asn1/p8_pkey.c:87:1: Call
85. } ASN1_SEQUENCE_END_cb(PKCS8_PRIV_KEY_INFO, PKCS8_PRIV_KEY_INFO)
86.
87. > IMPLEMENT_ASN1_FUNCTIONS(PKCS8_PRIV_KEY_INFO)
88.
89. int PKCS8_pkey_set0(PKCS8_PRIV_KEY_INFO *priv, ASN1_OBJECT *aobj,
crypto/asn1/tasn_dec.c:144:1: Parameter `**in`
142. */
143.
144. > ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval,
145. const unsigned char **in, long len,
146. const ASN1_ITEM *it)
crypto/asn1/tasn_dec.c:153:9: Call
151. pval = &ptmpval;
152. asn1_tlc_clear_nc(&c);
153. if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0)
^
154. return *pval;
155. return NULL;
crypto/asn1/tasn_dec.c:158:1: Parameter `**in`
156. }
157.
158. > int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len,
159. const ASN1_ITEM *it,
160. int tag, int aclass, char opt, ASN1_TLC *ctx)
crypto/asn1/tasn_dec.c:163:10: Call
161. {
162. int rv;
163. rv = asn1_item_embed_d2i(pval, in, len, it, tag, aclass, opt, ctx);
^
164. if (rv <= 0)
165. ASN1_item_ex_free(pval, it);
crypto/asn1/tasn_dec.c:174:1: Parameter `**in`
172. */
173.
174. > static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in,
175. long len, const ASN1_ITEM *it,
176. int tag, int aclass, char opt, ASN1_TLC *ctx)
crypto/asn1/tasn_dec.c:218:9: Assignment
216.
217. case ASN1_ITYPE_MSTRING:
218. p = *in;
^
219. /* Just read in tag and class */
220. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL,
crypto/asn1/tasn_dec.c:220:15: Call
218. p = *in;
219. /* Just read in tag and class */
220. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL,
^
221. &p, len, -1, 0, 1, ctx);
222. if (!ret) {
crypto/asn1/tasn_dec.c:1098:1: Parameter `**in`
1096. */
1097.
1098. > static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass,
1099. char *inf, char *cst,
1100. const unsigned char **in, long len,
crypto/asn1/tasn_dec.c:1107:5: Assignment
1105. long plen;
1106. const unsigned char *p, *q;
1107. p = *in;
^
1108. q = p;
1109.
crypto/asn1/tasn_dec.c:1117:13: Call
1115. p += ctx->hdrlen;
1116. } else {
1117. i = ASN1_get_object(&p, &plen, &ptag, &pclass, len);
^
1118. if (ctx) {
1119. ctx->ret = i;
crypto/asn1/asn1_lib.c:92:1: Parameter `**pp`
90. }
91.
92. > int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag,
93. int *pclass, long omax)
94. {
crypto/asn1/asn1_lib.c:97:5: Assignment
95. int i, ret;
96. long l;
97. const unsigned char *p = *pp;
^
98. int tag, xclass, inf;
99. long max = omax;
crypto/asn1/asn1_lib.c:126:9: Assignment
124. } else {
125. tag = i;
126. p++;
^
127. if (--max == 0)
128. goto err;
crypto/asn1/asn1_lib.c:132:10: Call
130. *ptag = tag;
131. *pclass = xclass;
132. if (!asn1_get_length(&p, &inf, plength, (int)max))
^
133. goto err;
134.
crypto/asn1/asn1_lib.c:153:1: <Length trace>
151. }
152.
153. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl,
154. int max)
155. {
crypto/asn1/asn1_lib.c:153:1: Parameter `**pp`
151. }
152.
153. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl,
154. int max)
155. {
crypto/asn1/asn1_lib.c:156:5: Assignment
154. int max)
155. {
156. const unsigned char *p = *pp;
^
157. unsigned long ret = 0;
158. unsigned int i;
crypto/asn1/asn1_lib.c:169:15: Assignment
167. *inf = 0;
168. i = *p & 0x7f;
169. if (*(p++) & 0x80) {
^
170. if (max < (int)i)
171. return 0;
crypto/asn1/asn1_lib.c:173:25: Array access: Offset: [2, +oo] Size: [1, 2147483644] by call to `d2i_PrivateKey`
171. return 0;
172. /* Skip leading zeroes */
173. while (i && *p == 0) {
^
174. p++;
175. i--;
|
https://github.com/openssl/openssl/blob/bb56561adbb6d2728b05e2df08c0575c38a46249/crypto/asn1/asn1_lib.c/#L173
|
d2a_code_trace_data_42085
|
int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *x, int vfy)
{
int rv, start_idx, i;
if (x == NULL) {
x = sk_X509_value(sk, 0);
start_idx = 1;
} else
start_idx = 0;
rv = ssl_security_cert(s, NULL, x, vfy, 1);
if (rv != 1)
return rv;
for (i = start_idx; i < sk_X509_num(sk); i++) {
x = sk_X509_value(sk, i);
rv = ssl_security_cert(s, NULL, x, vfy, 0);
if (rv != 1)
return rv;
}
return 1;
}
ssl/t1_lib.c:4108: error: NULL_DEREFERENCE
pointer `null` is dereferenced by call to `ssl_security_cert()` at line 4108, column 10.
Showing all 4 steps of the trace
ssl/t1_lib.c:4099:1: start of procedure ssl_security_cert_chain()
4097. */
4098.
4099. > int ssl_security_cert_chain(SSL *s, STACK_OF(X509) *sk, X509 *x, int vfy)
4100. {
4101. int rv, start_idx, i;
ssl/t1_lib.c:4102:9: Taking false branch
4100. {
4101. int rv, start_idx, i;
4102. if (x == NULL) {
^
4103. x = sk_X509_value(sk, 0);
4104. start_idx = 1;
ssl/t1_lib.c:4106:9:
4104. start_idx = 1;
4105. } else
4106. > start_idx = 0;
4107.
4108. rv = ssl_security_cert(s, NULL, x, vfy, 1);
ssl/t1_lib.c:4108:5:
4106. start_idx = 0;
4107.
4108. > rv = ssl_security_cert(s, NULL, x, vfy, 1);
4109. if (rv != 1)
4110. return rv;
|
https://github.com/openssl/openssl/blob/35b1a433ed893f29adff490ad06160eaa86c2416/ssl/t1_lib.c/#L4108
|
d2a_code_trace_data_42086
|
void CRYPTO_free(void *str, const char *file, int line)
{
INCREMENT(free_count);
if (free_impl != NULL && free_impl != &CRYPTO_free) {
free_impl(str, file, line);
return;
}
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
if (call_malloc_debug) {
CRYPTO_mem_debug_free(str, 0, file, line);
free(str);
CRYPTO_mem_debug_free(str, 1, file, line);
} else {
free(str);
}
#else
free(str);
#endif
}
crypto/evp/pkey_mac.c:103: error: USE_AFTER_FREE
call to `pkey_mac_cleanup()` eventually accesses memory that was invalidated by call to `free()` on line 91 indirectly during the call to `ASN1_STRING_copy()`.
Showing all 31 steps of the trace
crypto/evp/pkey_mac.c:74:1: invalidation part of the trace starts here
72. static void pkey_mac_cleanup(EVP_PKEY_CTX *ctx);
73.
74. > static int pkey_mac_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)
75. {
76. MAC_PKEY_CTX *sctx, *dctx;
crypto/evp/pkey_mac.c:74:1: parameter `dst` of pkey_mac_copy
72. static void pkey_mac_cleanup(EVP_PKEY_CTX *ctx);
73.
74. > static int pkey_mac_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)
75. {
76. MAC_PKEY_CTX *sctx, *dctx;
crypto/evp/pkey_mac.c:82:12: passed as argument to `EVP_PKEY_CTX_get_data`
80.
81. sctx = EVP_PKEY_CTX_get_data(src);
82. dctx = EVP_PKEY_CTX_get_data(dst);
^
83.
84. if (!EVP_MAC_CTX_copy(dctx->ctx, sctx->ctx))
crypto/evp/pkey_mac.c:82:12: return from call to `EVP_PKEY_CTX_get_data`
80.
81. sctx = EVP_PKEY_CTX_get_data(src);
82. dctx = EVP_PKEY_CTX_get_data(dst);
^
83.
84. if (!EVP_MAC_CTX_copy(dctx->ctx, sctx->ctx))
crypto/evp/pkey_mac.c:82:5: assigned
80.
81. sctx = EVP_PKEY_CTX_get_data(src);
82. dctx = EVP_PKEY_CTX_get_data(dst);
^
83.
84. if (!EVP_MAC_CTX_copy(dctx->ctx, sctx->ctx))
crypto/evp/pkey_mac.c:91:14: when calling `ASN1_STRING_copy` here
89. dctx->raw_data.md = sctx->raw_data.md;
90. if (ASN1_STRING_get0_data(&sctx->raw_data.ktmp) != NULL &&
91. !ASN1_STRING_copy(&dctx->raw_data.ktmp, &sctx->raw_data.ktmp))
^
92. goto err;
93. break;
crypto/asn1/asn1_lib.c:243:1: parameter `dst` of ASN1_STRING_copy
241. }
242.
243. > int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str)
244. {
245. if (str == NULL)
crypto/asn1/asn1_lib.c:248:10: when calling `ASN1_STRING_set` here
246. return 0;
247. dst->type = str->type;
248. if (!ASN1_STRING_set(dst, str->data, str->length))
^
249. return 0;
250. /* Copy flags but preserve embed value */
crypto/asn1/asn1_lib.c:271:1: parameter `str` of ASN1_STRING_set
269. }
270.
271. > int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len)
272. {
273. unsigned char *c;
crypto/asn1/asn1_lib.c:283:9: assigned
281. }
282. if ((str->length <= len) || (str->data == NULL)) {
283. c = str->data;
^
284. str->data = OPENSSL_realloc(c, len + 1);
285. if (str->data == NULL) {
crypto/asn1/asn1_lib.c:284:21: when calling `CRYPTO_realloc` here
282. if ((str->length <= len) || (str->data == NULL)) {
283. c = str->data;
284. str->data = OPENSSL_realloc(c, len + 1);
^
285. if (str->data == NULL) {
286. ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE);
crypto/mem.c:238:1: parameter `str` of CRYPTO_realloc
236. }
237.
238. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
239. {
240. INCREMENT(realloc_count);
crypto/mem.c:249:9: when calling `CRYPTO_free` here
247.
248. if (num == 0) {
249. CRYPTO_free(str, file, line);
^
250. return NULL;
251. }
crypto/mem.c:295:1: parameter `str` of CRYPTO_free
293. }
294.
295. > void CRYPTO_free(void *str, const char *file, int line)
296. {
297. INCREMENT(free_count);
crypto/mem.c:312:5: was invalidated by call to `free()`
310. }
311. #else
312. free(str);
^
313. #endif
314. }
crypto/evp/pkey_mac.c:74:1: use-after-lifetime part of the trace starts here
72. static void pkey_mac_cleanup(EVP_PKEY_CTX *ctx);
73.
74. > static int pkey_mac_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)
75. {
76. MAC_PKEY_CTX *sctx, *dctx;
crypto/evp/pkey_mac.c:74:1: parameter `dst` of pkey_mac_copy
72. static void pkey_mac_cleanup(EVP_PKEY_CTX *ctx);
73.
74. > static int pkey_mac_copy(EVP_PKEY_CTX *dst, EVP_PKEY_CTX *src)
75. {
76. MAC_PKEY_CTX *sctx, *dctx;
crypto/evp/pkey_mac.c:82:12: passed as argument to `EVP_PKEY_CTX_get_data`
80.
81. sctx = EVP_PKEY_CTX_get_data(src);
82. dctx = EVP_PKEY_CTX_get_data(dst);
^
83.
84. if (!EVP_MAC_CTX_copy(dctx->ctx, sctx->ctx))
crypto/evp/pkey_mac.c:82:12: return from call to `EVP_PKEY_CTX_get_data`
80.
81. sctx = EVP_PKEY_CTX_get_data(src);
82. dctx = EVP_PKEY_CTX_get_data(dst);
^
83.
84. if (!EVP_MAC_CTX_copy(dctx->ctx, sctx->ctx))
crypto/evp/pkey_mac.c:82:5: assigned
80.
81. sctx = EVP_PKEY_CTX_get_data(src);
82. dctx = EVP_PKEY_CTX_get_data(dst);
^
83.
84. if (!EVP_MAC_CTX_copy(dctx->ctx, sctx->ctx))
crypto/evp/pkey_mac.c:91:14: passed as argument to `ASN1_STRING_copy`
89. dctx->raw_data.md = sctx->raw_data.md;
90. if (ASN1_STRING_get0_data(&sctx->raw_data.ktmp) != NULL &&
91. !ASN1_STRING_copy(&dctx->raw_data.ktmp, &sctx->raw_data.ktmp))
^
92. goto err;
93. break;
crypto/asn1/asn1_lib.c:243:1: parameter `dst` of ASN1_STRING_copy
241. }
242.
243. > int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str)
244. {
245. if (str == NULL)
crypto/asn1/asn1_lib.c:248:10: passed as argument to `ASN1_STRING_set`
246. return 0;
247. dst->type = str->type;
248. if (!ASN1_STRING_set(dst, str->data, str->length))
^
249. return 0;
250. /* Copy flags but preserve embed value */
crypto/asn1/asn1_lib.c:271:1: parameter `str` of ASN1_STRING_set
269. }
270.
271. > int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len)
272. {
273. unsigned char *c;
crypto/asn1/asn1_lib.c:283:9: assigned
281. }
282. if ((str->length <= len) || (str->data == NULL)) {
283. c = str->data;
^
284. str->data = OPENSSL_realloc(c, len + 1);
285. if (str->data == NULL) {
crypto/asn1/asn1_lib.c:287:13: assigned
285. if (str->data == NULL) {
286. ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE);
287. str->data = c;
^
288. return 0;
289. }
crypto/asn1/asn1_lib.c:248:10: return from call to `ASN1_STRING_set`
246. return 0;
247. dst->type = str->type;
248. if (!ASN1_STRING_set(dst, str->data, str->length))
^
249. return 0;
250. /* Copy flags but preserve embed value */
crypto/evp/pkey_mac.c:91:14: return from call to `ASN1_STRING_copy`
89. dctx->raw_data.md = sctx->raw_data.md;
90. if (ASN1_STRING_get0_data(&sctx->raw_data.ktmp) != NULL &&
91. !ASN1_STRING_copy(&dctx->raw_data.ktmp, &sctx->raw_data.ktmp))
^
92. goto err;
93. break;
crypto/evp/pkey_mac.c:103:5: when calling `pkey_mac_cleanup` here
101. return 1;
102. err:
103. pkey_mac_cleanup (dst);
^
104. return 0;
105. }
crypto/mem.c:295:1: parameter `str` of CRYPTO_free
293. }
294.
295. > void CRYPTO_free(void *str, const char *file, int line)
296. {
297. INCREMENT(free_count);
crypto/mem.c:312:5: invalid access occurs here
310. }
311. #else
312. free(str);
^
313. #endif
314. }
|
https://github.com/openssl/openssl/blob/388de53c274dee20c07eee7ff892108668fb3a61/crypto/mem.c/#L312
|
d2a_code_trace_data_42087
|
static char *shacrypt(const char *passwd, const char *magic, const char *salt)
{
static const char rounds_prefix[] = "rounds=";
# define SALT_LEN_MAX 16
# define ROUNDS_DEFAULT 5000
# define ROUNDS_MIN 1000
# define ROUNDS_MAX 999999999
static char out_buf[3 + 17 + 17 + 86 + 1];
unsigned char buf[SHA512_DIGEST_LENGTH];
unsigned char temp_buf[SHA512_DIGEST_LENGTH];
size_t buf_size = 0;
char ascii_magic[2];
char ascii_salt[17];
char *ascii_passwd = NULL;
size_t n;
EVP_MD_CTX *md = NULL, *md2 = NULL;
const EVP_MD *sha = NULL;
size_t passwd_len, salt_len, magic_len;
unsigned int rounds = 5000;
char rounds_custom = 0;
char *p_bytes = NULL;
char *s_bytes = NULL;
char *cp = NULL;
passwd_len = strlen(passwd);
magic_len = strlen(magic);
if (magic_len != 1)
return NULL;
switch (magic[0]) {
case '5':
sha = EVP_sha256();
buf_size = 32;
break;
case '6':
sha = EVP_sha512();
buf_size = 64;
break;
default:
return NULL;
}
if (strncmp(salt, rounds_prefix, sizeof(rounds_prefix) - 1) == 0) {
const char *num = salt + sizeof(rounds_prefix) - 1;
char *endp;
unsigned long int srounds = strtoul (num, &endp, 10);
if (*endp == '$') {
salt = endp + 1;
if (srounds > ROUNDS_MAX)
rounds = ROUNDS_MAX;
else if (srounds < ROUNDS_MIN)
rounds = ROUNDS_MIN;
else
rounds = (unsigned int)srounds;
rounds_custom = 1;
} else {
return NULL;
}
}
OPENSSL_strlcpy(ascii_magic, magic, sizeof(ascii_magic));
#ifdef CHARSET_EBCDIC
if ((magic[0] & 0x80) != 0)
ebcdic2ascii(ascii_magic, ascii_magic, magic_len);
#endif
OPENSSL_strlcpy(ascii_salt, salt, sizeof(ascii_salt));
salt_len = strlen(ascii_salt);
#ifdef CHARSET_EBCDIC
ebcdic2ascii(ascii_salt, ascii_salt, salt_len);
#endif
#ifdef CHARSET_EBCDIC
ascii_passwd = OPENSSL_strdup(passwd);
if (ascii_passwd == NULL)
return NULL;
ebcdic2ascii(ascii_passwd, ascii_passwd, passwd_len);
passwd = ascii_passwd;
#endif
out_buf[0] = 0;
OPENSSL_strlcat(out_buf, ascii_dollar, sizeof(out_buf));
OPENSSL_strlcat(out_buf, ascii_magic, sizeof(out_buf));
OPENSSL_strlcat(out_buf, ascii_dollar, sizeof(out_buf));
if (rounds_custom) {
char tmp_buf[80];
sprintf(tmp_buf, "rounds=%u", rounds);
#ifdef CHARSET_EBCDIC
if (tmp_buf[0] != 0x72)
ebcdic2ascii(tmp_buf, tmp_buf, strlen(tmp_buf));
#endif
OPENSSL_strlcat(out_buf, tmp_buf, sizeof(out_buf));
OPENSSL_strlcat(out_buf, ascii_dollar, sizeof(out_buf));
}
OPENSSL_strlcat(out_buf, ascii_salt, sizeof(out_buf));
if (strlen(out_buf) > 3 + 17 * rounds_custom + salt_len )
goto err;
md = EVP_MD_CTX_new();
if (md == NULL
|| !EVP_DigestInit_ex(md, sha, NULL)
|| !EVP_DigestUpdate(md, passwd, passwd_len)
|| !EVP_DigestUpdate(md, ascii_salt, salt_len))
goto err;
md2 = EVP_MD_CTX_new();
if (md2 == NULL
|| !EVP_DigestInit_ex(md2, sha, NULL)
|| !EVP_DigestUpdate(md2, passwd, passwd_len)
|| !EVP_DigestUpdate(md2, ascii_salt, salt_len)
|| !EVP_DigestUpdate(md2, passwd, passwd_len)
|| !EVP_DigestFinal_ex(md2, buf, NULL))
goto err;
for (n = passwd_len; n > buf_size; n -= buf_size) {
if (!EVP_DigestUpdate(md, buf, buf_size))
goto err;
}
if (!EVP_DigestUpdate(md, buf, n))
goto err;
n = passwd_len;
while (n) {
if (!EVP_DigestUpdate(md,
(n & 1) ? buf : (unsigned const char *)passwd,
(n & 1) ? buf_size : passwd_len))
goto err;
n >>= 1;
}
if (!EVP_DigestFinal_ex(md, buf, NULL))
return NULL;
if (!EVP_DigestInit_ex(md2, sha, NULL))
goto err;
for (n = passwd_len; n > 0; n--)
if (!EVP_DigestUpdate(md2, passwd, passwd_len))
goto err;
if (!EVP_DigestFinal_ex(md2, temp_buf, NULL))
return NULL;
if ((p_bytes = OPENSSL_zalloc(passwd_len)) == NULL)
goto err;
for (cp = p_bytes, n = passwd_len; n > buf_size; n -= buf_size, cp += buf_size)
memcpy(cp, temp_buf, buf_size);
memcpy(cp, temp_buf, n);
if (!EVP_DigestInit_ex(md2, sha, NULL))
goto err;
for (n = 16 + buf[0]; n > 0; n--)
if (!EVP_DigestUpdate(md2, ascii_salt, salt_len))
goto err;
if (!EVP_DigestFinal_ex(md2, temp_buf, NULL))
return NULL;
if ((s_bytes = OPENSSL_zalloc(salt_len)) == NULL)
goto err;
for (cp = s_bytes, n = salt_len; n > buf_size; n -= buf_size, cp += buf_size)
memcpy(cp, temp_buf, buf_size);
memcpy(cp, temp_buf, n);
for (n = 0; n < rounds; n++) {
if (!EVP_DigestInit_ex(md2, sha, NULL))
goto err;
if (!EVP_DigestUpdate(md2,
(n & 1) ? (unsigned const char *)p_bytes : buf,
(n & 1) ? passwd_len : buf_size))
goto err;
if (n % 3) {
if (!EVP_DigestUpdate(md2, s_bytes, salt_len))
goto err;
}
if (n % 7) {
if (!EVP_DigestUpdate(md2, p_bytes, passwd_len))
goto err;
}
if (!EVP_DigestUpdate(md2,
(n & 1) ? buf : (unsigned const char *)p_bytes,
(n & 1) ? buf_size : passwd_len))
goto err;
if (!EVP_DigestFinal_ex(md2, buf, NULL))
goto err;
}
EVP_MD_CTX_free(md2);
EVP_MD_CTX_free(md);
md2 = NULL;
md = NULL;
OPENSSL_free(p_bytes);
OPENSSL_free(s_bytes);
p_bytes = NULL;
s_bytes = NULL;
cp = out_buf + strlen(out_buf);
*cp++ = ascii_dollar[0];
# define b64_from_24bit(B2, B1, B0, N) \
do { \
unsigned int w = ((B2) << 16) | ((B1) << 8) | (B0); \
int i = (N); \
while (i-- > 0) \
{ \
*cp++ = cov_2char[w & 0x3f]; \
w >>= 6; \
} \
} while (0)
switch (magic[0]) {
case '5':
b64_from_24bit (buf[0], buf[10], buf[20], 4);
b64_from_24bit (buf[21], buf[1], buf[11], 4);
b64_from_24bit (buf[12], buf[22], buf[2], 4);
b64_from_24bit (buf[3], buf[13], buf[23], 4);
b64_from_24bit (buf[24], buf[4], buf[14], 4);
b64_from_24bit (buf[15], buf[25], buf[5], 4);
b64_from_24bit (buf[6], buf[16], buf[26], 4);
b64_from_24bit (buf[27], buf[7], buf[17], 4);
b64_from_24bit (buf[18], buf[28], buf[8], 4);
b64_from_24bit (buf[9], buf[19], buf[29], 4);
b64_from_24bit (0, buf[31], buf[30], 3);
break;
case '6':
b64_from_24bit (buf[0], buf[21], buf[42], 4);
b64_from_24bit (buf[22], buf[43], buf[1], 4);
b64_from_24bit (buf[44], buf[2], buf[23], 4);
b64_from_24bit (buf[3], buf[24], buf[45], 4);
b64_from_24bit (buf[25], buf[46], buf[4], 4);
b64_from_24bit (buf[47], buf[5], buf[26], 4);
b64_from_24bit (buf[6], buf[27], buf[48], 4);
b64_from_24bit (buf[28], buf[49], buf[7], 4);
b64_from_24bit (buf[50], buf[8], buf[29], 4);
b64_from_24bit (buf[9], buf[30], buf[51], 4);
b64_from_24bit (buf[31], buf[52], buf[10], 4);
b64_from_24bit (buf[53], buf[11], buf[32], 4);
b64_from_24bit (buf[12], buf[33], buf[54], 4);
b64_from_24bit (buf[34], buf[55], buf[13], 4);
b64_from_24bit (buf[56], buf[14], buf[35], 4);
b64_from_24bit (buf[15], buf[36], buf[57], 4);
b64_from_24bit (buf[37], buf[58], buf[16], 4);
b64_from_24bit (buf[59], buf[17], buf[38], 4);
b64_from_24bit (buf[18], buf[39], buf[60], 4);
b64_from_24bit (buf[40], buf[61], buf[19], 4);
b64_from_24bit (buf[62], buf[20], buf[41], 4);
b64_from_24bit (0, 0, buf[63], 2);
break;
default:
goto err;
}
*cp = '\0';
#ifdef CHARSET_EBCDIC
ascii2ebcdic(out_buf, out_buf, strlen(out_buf));
#endif
return out_buf;
err:
EVP_MD_CTX_free(md2);
EVP_MD_CTX_free(md);
OPENSSL_free(p_bytes);
OPENSSL_free(s_bytes);
OPENSSL_free(ascii_passwd);
return NULL;
}
apps/passwd.c:670: error: BUFFER_OVERRUN_L3
Offset added: [-31, 64] Size: 64.
Showing all 5 steps of the trace
apps/passwd.c:534:9: <Offset trace>
532. case '5':
533. sha = EVP_sha256();
534. buf_size = 32;
^
535. break;
536. case '6':
apps/passwd.c:534:9: Assignment
532. case '5':
533. sha = EVP_sha256();
534. buf_size = 32;
^
535. break;
536. case '6':
apps/passwd.c:493:1: <Length trace>
491. * (note that it's in the public domain)
492. */
493. > static char *shacrypt(const char *passwd, const char *magic, const char *salt)
494. {
495. /* Prefix for optional rounds specification. */
apps/passwd.c:493:1: Array declaration
491. * (note that it's in the public domain)
492. */
493. > static char *shacrypt(const char *passwd, const char *magic, const char *salt)
494. {
495. /* Prefix for optional rounds specification. */
apps/passwd.c:670:5: Array access: Offset added: [-31, 64] Size: 64
668. for (cp = s_bytes, n = salt_len; n > buf_size; n -= buf_size, cp += buf_size)
669. memcpy(cp, temp_buf, buf_size);
670. memcpy(cp, temp_buf, n);
^
671.
672. for (n = 0; n < rounds; n++) {
|
https://github.com/openssl/openssl/blob/8ae173bb57819a23717fd3c8e7c51cb62f4268d0/apps/passwd.c/#L670
|
d2a_code_trace_data_42088
|
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:150:12: Call
148. BN_GENCB *cb)
149. {
150. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb);
^
151. }
152.
crypto/bn/bn_prime.c:227:13: Call
225. /* now 1 <= check < a */
226.
227. j = witness(check, a, A1, A1_odd, k, ctx, mont);
^
228. if (j == -1)
229. goto err;
crypto/bn/bn_prime.c:253:10: Call
251. BN_MONT_CTX *mont)
252. {
253. if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */
^
254. return -1;
255. if (BN_is_one(w))
crypto/bn/bn_exp.c:350:14: Call
348.
349. if (a->neg || BN_ucmp(a, m) >= 0) {
350. if (!BN_nnmod(val[0], a, m, ctx))
^
351. goto err;
352. aa = val[0];
crypto/bn/bn_mod.c:20:11: Call
18. */
19.
20. if (!(BN_mod(r, m, d, ctx)))
^
21. return 0;
22. if (!r->neg)
crypto/bn/bn_div.c:140:1: Parameter `*dv->d`
138. * If 'dv' or 'rm' is NULL, the respective value is not returned.
139. */
140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
141. BN_CTX *ctx)
142. {
crypto/rsa/rsa_chk.c:66:10: Call
64.
65. /* n = p*q? */
66. if (!BN_mul(i, key->p, key->q, ctx)) {
^
67. ret = -1;
68. goto err;
crypto/bn/bn_mul.c:545:13: Assignment
543. if (bn_wexpand(rr, 16) == NULL)
544. goto err;
545. rr->top = 16;
^
546. bn_mul_comba8(rr->d, a->d, b->d);
547. goto end;
crypto/bn/bn_mul.c:639:5: Call
637. #endif
638. rr->neg = a->neg ^ b->neg;
639. bn_correct_top(rr);
^
640. if (r != rr && BN_copy(r, rr) == NULL)
641. goto err;
crypto/bn/bn_lib.c:953:1: <Offset trace>
951. }
952.
953. > void bn_correct_top(BIGNUM *a)
954. {
955. BN_ULONG *ftl;
crypto/bn/bn_lib.c:953:1: Parameter `a->top`
951. }
952.
953. > void bn_correct_top(BIGNUM *a)
954. {
955. BN_ULONG *ftl;
crypto/bn/bn_lib.c:956:5: Assignment
954. {
955. BN_ULONG *ftl;
956. int tmp_top = a->top;
^
957.
958. if (tmp_top > 0) {
crypto/bn/bn_lib.c:953:1: <Length trace>
951. }
952.
953. > void bn_correct_top(BIGNUM *a)
954. {
955. BN_ULONG *ftl;
crypto/bn/bn_lib.c:953:1: Parameter `*a->d`
951. }
952.
953. > void bn_correct_top(BIGNUM *a)
954. {
955. BN_ULONG *ftl;
crypto/bn/bn_lib.c:959:14: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mul`
957.
958. if (tmp_top > 0) {
959. for (ftl = &(a->d[tmp_top]); tmp_top > 0; tmp_top--) {
^
960. ftl--;
961. if (*ftl != 0)
|
https://github.com/openssl/openssl/blob/757264207ad8650a89ea903d48ad89f61d56ea9c/crypto/bn/bn_lib.c/#L959
|
d2a_code_trace_data_42089
|
int sws_isSupportedInput(enum AVPixelFormat pix_fmt)
{
return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
format_entries[pix_fmt].is_supported_in : 0;
}
cmdutils.c:1236: error: Buffer Overrun L1
Offset: -1 Size: 138 by call to `sws_isSupportedInput`.
cmdutils.c:1234:38: Call
1232.
1233. while ((pix_desc = av_pix_fmt_desc_next(pix_desc))) {
1234. enum AVPixelFormat pix_fmt = av_pix_fmt_desc_get_id(pix_desc);
^
1235. printf("%c%c%c%c%c %-16s %d %2d\n",
1236. sws_isSupportedInput (pix_fmt) ? 'I' : '.',
libavutil/pixdesc.c:1860:9: Assignment
1858. if (desc < av_pix_fmt_descriptors ||
1859. desc >= av_pix_fmt_descriptors + FF_ARRAY_ELEMS(av_pix_fmt_descriptors))
1860. return AV_PIX_FMT_NONE;
^
1861.
1862. return desc - av_pix_fmt_descriptors;
cmdutils.c:1234:9: Assignment
1232.
1233. while ((pix_desc = av_pix_fmt_desc_next(pix_desc))) {
1234. enum AVPixelFormat pix_fmt = av_pix_fmt_desc_get_id(pix_desc);
^
1235. printf("%c%c%c%c%c %-16s %d %2d\n",
1236. sws_isSupportedInput (pix_fmt) ? 'I' : '.',
cmdutils.c:1236:16: Call
1234. enum AVPixelFormat pix_fmt = av_pix_fmt_desc_get_id(pix_desc);
1235. printf("%c%c%c%c%c %-16s %d %2d\n",
1236. sws_isSupportedInput (pix_fmt) ? 'I' : '.',
^
1237. sws_isSupportedOutput(pix_fmt) ? 'O' : '.',
1238. pix_desc->flags & AV_PIX_FMT_FLAG_HWACCEL ? 'H' : '.',
libswscale/utils.c:198:1: <Offset trace>
196. };
197.
198. int sws_isSupportedInput(enum AVPixelFormat pix_fmt)
^
199. {
200. return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
libswscale/utils.c:198:1: Parameter `pix_fmt`
196. };
197.
198. int sws_isSupportedInput(enum AVPixelFormat pix_fmt)
^
199. {
200. return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
libswscale/utils.c:79:1: <Length trace>
77. } FormatEntry;
78.
79. static const FormatEntry format_entries[AV_PIX_FMT_NB] = {
^
80. [AV_PIX_FMT_YUV420P] = { 1, 1 },
81. [AV_PIX_FMT_YUYV422] = { 1, 1 },
libswscale/utils.c:79:1: Array declaration
77. } FormatEntry;
78.
79. static const FormatEntry format_entries[AV_PIX_FMT_NB] = {
^
80. [AV_PIX_FMT_YUV420P] = { 1, 1 },
81. [AV_PIX_FMT_YUYV422] = { 1, 1 },
libswscale/utils.c:201:12: Array access: Offset: -1 Size: 138 by call to `sws_isSupportedInput`
199. {
200. return (unsigned)pix_fmt < AV_PIX_FMT_NB ?
201. format_entries[pix_fmt].is_supported_in : 0;
^
202. }
203.
|
https://github.com/libav/libav/blob/2ec9fa5ec60dcd10e1cb10d8b4e4437e634ea428/libswscale/utils.c/#L201
|
d2a_code_trace_data_42090
|
static int error_check(DRBG_SELFTEST_DATA *td)
{
static char zero[sizeof(RAND_DRBG)];
RAND_DRBG *drbg = NULL;
TEST_CTX t;
unsigned char buff[1024];
unsigned int generate_counter_tmp;
int ret = 0;
if (!TEST_ptr(drbg = RAND_DRBG_new(0, 0, NULL)))
goto err;
if (!init(drbg, td, &t)
|| RAND_DRBG_instantiate(drbg, td->pers, drbg->max_perslen + 1) > 0)
goto err;
t.entropylen = 0;
if (TEST_int_le(RAND_DRBG_instantiate(drbg, td->pers, td->perslen), 0))
goto err;
if (!TEST_false(RAND_DRBG_generate(drbg, buff, td->exlen, 0,
td->adin, td->adinlen))
|| !uninstantiate(drbg))
goto err;
t.entropylen = drbg->min_entropylen - 1;
if (!init(drbg, td, &t)
|| RAND_DRBG_instantiate(drbg, td->pers, td->perslen) > 0
|| !uninstantiate(drbg))
goto err;
t.entropylen = drbg->max_entropylen + 1;
if (!init(drbg, td, &t)
|| RAND_DRBG_instantiate(drbg, td->pers, td->perslen) > 0
|| !uninstantiate(drbg))
goto err;
if (drbg->min_noncelen) {
t.noncelen = drbg->min_noncelen - 1;
if (!init(drbg, td, &t)
|| RAND_DRBG_instantiate(drbg, td->pers, td->perslen) > 0
|| !uninstantiate(drbg))
goto err;
}
if (drbg->max_noncelen) {
t.noncelen = drbg->max_noncelen + 1;
if (!init(drbg, td, &t)
|| RAND_DRBG_instantiate(drbg, td->pers, td->perslen) > 0
|| !uninstantiate(drbg))
goto err;
}
if (!instantiate(drbg, td, &t)
|| !TEST_true(RAND_DRBG_generate(drbg, buff, td->exlen, 0,
td->adin, td->adinlen)))
goto err;
if (!TEST_false(RAND_DRBG_generate(drbg, buff, drbg->max_request + 1, 0,
td->adin, td->adinlen)))
goto err;
if (!TEST_false(RAND_DRBG_generate(drbg, buff, td->exlen, 0,
td->adin, drbg->max_adinlen + 1)))
goto err;
t.entropylen = 0;
if (TEST_false(RAND_DRBG_generate(drbg, buff, td->exlen, 1,
td->adin, td->adinlen))
|| !uninstantiate(drbg))
goto err;
if (!instantiate(drbg, td, &t))
goto err;
generate_counter_tmp = drbg->generate_counter;
drbg->generate_counter = drbg->reseed_interval;
t.entropycnt = 0;
if (!TEST_true(RAND_DRBG_generate(drbg, buff, td->exlen, 0,
td->adin, td->adinlen))
|| !TEST_int_eq(t.entropycnt, 1)
|| !TEST_int_eq(drbg->generate_counter, generate_counter_tmp + 1)
|| !uninstantiate(drbg))
goto err;
t.entropylen = 0;
if (!TEST_false(RAND_DRBG_generate(drbg, buff, td->exlen, 1,
td->adin, td->adinlen))
|| !uninstantiate(drbg))
goto err;
if (!instantiate(drbg, td, &t))
goto err;
generate_counter_tmp = drbg->generate_counter;
drbg->generate_counter = drbg->reseed_interval;
t.entropycnt = 0;
if (!TEST_true(RAND_DRBG_generate(drbg, buff, td->exlen, 0,
td->adin, td->adinlen))
|| !TEST_int_eq(t.entropycnt, 1)
|| !TEST_int_eq(drbg->generate_counter, generate_counter_tmp + 1)
|| !uninstantiate(drbg))
goto err;
if (!init(drbg, td, &t)
|| RAND_DRBG_reseed(drbg, td->adin, drbg->max_adinlen + 1) > 0)
goto err;
t.entropylen = 0;
if (!TEST_int_le(RAND_DRBG_reseed(drbg, td->adin, td->adinlen), 0)
|| !uninstantiate(drbg))
goto err;
if (!init(drbg, td, &t))
goto err;
t.entropylen = drbg->max_entropylen + 1;
if (!TEST_int_le(RAND_DRBG_reseed(drbg, td->adin, td->adinlen), 0)
|| !uninstantiate(drbg))
goto err;
if (!init(drbg, td, &t))
goto err;
t.entropylen = drbg->min_entropylen - 1;
if (!TEST_int_le(RAND_DRBG_reseed(drbg, td->adin, td->adinlen), 0)
|| !uninstantiate(drbg))
goto err;
if (!TEST_mem_eq(zero, sizeof(drbg->data), &drbg->data, sizeof(drbg->data)))
goto err;
ret = 1;
err:
uninstantiate(drbg);
RAND_DRBG_free(drbg);
return ret;
}
test/drbgtest.c:311: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned64.
Showing all 6 steps of the trace
test/drbgtest.c:283:10: <LHS trace>
281. int ret = 0;
282.
283. if (!TEST_ptr(drbg = RAND_DRBG_new(0, 0, NULL)))
^
284. goto err;
285.
test/drbgtest.c:283:10: Call
281. int ret = 0;
282.
283. if (!TEST_ptr(drbg = RAND_DRBG_new(0, 0, NULL)))
^
284. goto err;
285.
crypto/rand/drbg_lib.c:199:12: Call
197. RAND_DRBG *RAND_DRBG_new(int type, unsigned int flags, RAND_DRBG *parent)
198. {
199. return rand_drbg_new(0, type, flags, parent);
^
200. }
201.
crypto/rand/drbg_lib.c:178:9: Call
176. drbg->fork_count = rand_fork_count;
177. drbg->parent = parent;
178. if (RAND_DRBG_set(drbg, type, flags) == 0)
^
179. goto err;
180.
crypto/rand/drbg_lib.c:128:1: Parameter `drbg->min_entropylen`
126. * Returns 1 on success, 0 on failure.
127. */
128. > int RAND_DRBG_set(RAND_DRBG *drbg, int nid, unsigned int flags)
129. {
130. int ret = 1;
test/drbgtest.c:311:5: Binary operation: ([0, +oo] - 1):unsigned64
309.
310. /* Test insufficient entropy */
311. t.entropylen = drbg->min_entropylen - 1;
^
312. if (!init(drbg, td, &t)
313. || RAND_DRBG_instantiate(drbg, td->pers, td->perslen) > 0
|
https://github.com/openssl/openssl/blob/97d37b85d4e1a218fdc61dbe0dff3e7c8ff36121/test/drbgtest.c/#L311
|
d2a_code_trace_data_42091
|
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);
a->flags &= ~BN_FLG_FIXED_TOP;
bn_check_top(a);
return 1;
}
test/bntest.c:616: error: BUFFER_OVERRUN_L3
Offset: 0 Size: [0, 8388607] by call to `BN_rand`.
Showing all 14 steps of the trace
test/bntest.c:616:15: Call
614.
615. for (i = 0; i < NUM0; i++) {
616. if (!(TEST_true(BN_rand(a, 512, 0, 0))
^
617. && TEST_ptr(BN_copy(b, BN_value_one()))))
618. goto err;
crypto/bn/bn_rand.c:106:1: Parameter `*rnd->d`
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:23:1: Parameter `*rnd->d`
21. } BNRAND_FLAG;
22.
23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom,
24. BN_CTX *ctx)
25. {
test/bntest.c:616:15: Call
614.
615. for (i = 0; i < NUM0; i++) {
616. if (!(TEST_true(BN_rand(a, 512, 0, 0))
^
617. && TEST_ptr(BN_copy(b, BN_value_one()))))
618. goto err;
crypto/bn/bn_rand.c:106:1: Parameter `*rnd->d`
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:23:1: Parameter `*rnd->d`
21. } BNRAND_FLAG;
22.
23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom,
24. BN_CTX *ctx)
25. {
crypto/bn/bn_rand.c:33:9: Call
31. if (top != BN_RAND_TOP_ANY || bottom != BN_RAND_BOTTOM_ANY)
32. goto toosmall;
33. BN_zero(rnd);
^
34. return 1;
35. }
crypto/bn/bn_lib.c:361:1: <Length trace>
359. }
360.
361. > int BN_set_word(BIGNUM *a, BN_ULONG w)
362. {
363. bn_check_top(a);
crypto/bn/bn_lib.c:361:1: Parameter `*a->d`
359. }
360.
361. > int BN_set_word(BIGNUM *a, BN_ULONG w)
362. {
363. bn_check_top(a);
crypto/bn/bn_lib.c:364:9: Call
362. {
363. bn_check_top(a);
364. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
^
365. return 0;
366. a->neg = 0;
crypto/bn/bn_lcl.h:660:1: Parameter `*a->d`
658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
659.
660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
661. {
662. if (bits > (INT_MAX - BN_BITS2 + 1))
crypto/bn/bn_lib.c:367:5: Array access: Offset: 0 Size: [0, 8388607] by call to `BN_rand`
365. return 0;
366. a->neg = 0;
367. a->d[0] = w;
^
368. a->top = (w ? 1 : 0);
369. a->flags &= ~BN_FLG_FIXED_TOP;
|
https://github.com/openssl/openssl/blob/bd01733fdd9a5a0acdc72cf5c6601d37e8ddd801/crypto/bn/bn_lib.c/#L367
|
d2a_code_trace_data_42092
|
int avfilter_init_str(AVFilterContext *filter, const char *args)
{
AVDictionary *options = NULL;
AVDictionaryEntry *e;
int ret = 0;
if (args && *args) {
if (!filter->filter->priv_class) {
av_log(filter, AV_LOG_ERROR, "This filter does not take any "
"options, but options were provided: %s.\n", args);
return AVERROR(EINVAL);
}
#if FF_API_OLD_FILTER_OPTS
if (!strcmp(filter->filter->name, "scale") &&
strchr(args, ':') && strchr(args, ':') < strchr(args, '=')) {
char *copy = av_strdup(args);
char *p;
av_log(filter, AV_LOG_WARNING, "The <w>:<h>:flags=<flags> option "
"syntax is deprecated. Use either <w>:<h>:<flags> or "
"w=<w>:h=<h>:flags=<flags>.\n");
if (!copy) {
ret = AVERROR(ENOMEM);
goto fail;
}
p = strrchr(copy, ':');
if (p) {
*p++ = 0;
ret = av_dict_parse_string(&options, p, "=", ":", 0);
}
if (ret >= 0)
ret = process_unnamed_options(filter, &options, copy);
av_freep(©);
if (ret < 0)
goto fail;
} else
#endif
if (strchr(args, '=')) {
ret = av_dict_parse_string(&options, args, "=", ":", 0);
if (ret < 0)
goto fail;
#if FF_API_OLD_FILTER_OPTS
} else if (!strcmp(filter->filter->name, "format") ||
!strcmp(filter->filter->name, "noformat") ||
!strcmp(filter->filter->name, "frei0r") ||
!strcmp(filter->filter->name, "frei0r_src") ||
!strcmp(filter->filter->name, "ocv")) {
char *copy = av_strdup(args);
char *p = copy;
int nb_leading = 0;
if (!copy) {
ret = AVERROR(ENOMEM);
goto fail;
}
if (!strcmp(filter->filter->name, "frei0r") ||
!strcmp(filter->filter->name, "ocv"))
nb_leading = 1;
else if (!strcmp(filter->filter->name, "frei0r_src"))
nb_leading = 3;
while (nb_leading--) {
p = strchr(p, ':');
if (!p) {
p = copy + strlen(copy);
break;
}
p++;
}
if (strchr(p, ':')) {
av_log(filter, AV_LOG_WARNING, "This syntax is deprecated. Use "
"'|' to separate the list items.\n");
}
while ((p = strchr(p, ':')))
*p++ = '|';
ret = process_unnamed_options(filter, &options, copy);
av_freep(©);
if (ret < 0)
goto fail;
#endif
} else {
ret = process_unnamed_options(filter, &options, args);
if (ret < 0)
goto fail;
}
}
ret = avfilter_init_dict(filter, &options);
if (ret < 0)
goto fail;
if ((e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX))) {
av_log(filter, AV_LOG_ERROR, "No such option: %s.\n", e->key);
ret = AVERROR_OPTION_NOT_FOUND;
goto fail;
}
fail:
av_dict_free(&options);
return ret;
}
libavfilter/avfilter.c:703: error: Memory Leak
memory dynamically allocated by call to `av_strdup()` at line 670, column 26 is not reachable after line 703, column 13.
libavfilter/avfilter.c:614:1: start of procedure avfilter_init_str()
612. }
613.
614. int avfilter_init_str(AVFilterContext *filter, const char *args)
^
615. {
616. AVDictionary *options = NULL;
libavfilter/avfilter.c:616:5:
614. int avfilter_init_str(AVFilterContext *filter, const char *args)
615. {
616. AVDictionary *options = NULL;
^
617. AVDictionaryEntry *e;
618. int ret = 0;
libavfilter/avfilter.c:618:5:
616. AVDictionary *options = NULL;
617. AVDictionaryEntry *e;
618. int ret = 0;
^
619.
620. if (args && *args) {
libavfilter/avfilter.c:620:9: Taking true branch
618. int ret = 0;
619.
620. if (args && *args) {
^
621. if (!filter->filter->priv_class) {
622. av_log(filter, AV_LOG_ERROR, "This filter does not take any "
libavfilter/avfilter.c:620:17: Taking true branch
618. int ret = 0;
619.
620. if (args && *args) {
^
621. if (!filter->filter->priv_class) {
622. av_log(filter, AV_LOG_ERROR, "This filter does not take any "
libavfilter/avfilter.c:621:14: Taking false branch
619.
620. if (args && *args) {
621. if (!filter->filter->priv_class) {
^
622. av_log(filter, AV_LOG_ERROR, "This filter does not take any "
623. "options, but options were provided: %s.\n", args);
libavfilter/avfilter.c:628:14: Taking false branch
626.
627. #if FF_API_OLD_FILTER_OPTS
628. if (!strcmp(filter->filter->name, "scale") &&
^
629. strchr(args, ':') && strchr(args, ':') < strchr(args, '=')) {
630. /* old w:h:flags=<flags> syntax */
libavfilter/avfilter.c:657:13: Taking false branch
655. #endif
656.
657. if (strchr(args, '=')) {
^
658. /* assume a list of key1=value1:key2=value2:... */
659. ret = av_dict_parse_string(&options, args, "=", ":", 0);
libavfilter/avfilter.c:663:21: Taking false branch
661. goto fail;
662. #if FF_API_OLD_FILTER_OPTS
663. } else if (!strcmp(filter->filter->name, "format") ||
^
664. !strcmp(filter->filter->name, "noformat") ||
665. !strcmp(filter->filter->name, "frei0r") ||
libavfilter/avfilter.c:664:21: Taking false branch
662. #if FF_API_OLD_FILTER_OPTS
663. } else if (!strcmp(filter->filter->name, "format") ||
664. !strcmp(filter->filter->name, "noformat") ||
^
665. !strcmp(filter->filter->name, "frei0r") ||
666. !strcmp(filter->filter->name, "frei0r_src") ||
libavfilter/avfilter.c:665:21: Taking false branch
663. } else if (!strcmp(filter->filter->name, "format") ||
664. !strcmp(filter->filter->name, "noformat") ||
665. !strcmp(filter->filter->name, "frei0r") ||
^
666. !strcmp(filter->filter->name, "frei0r_src") ||
667. !strcmp(filter->filter->name, "ocv")) {
libavfilter/avfilter.c:666:21: Taking false branch
664. !strcmp(filter->filter->name, "noformat") ||
665. !strcmp(filter->filter->name, "frei0r") ||
666. !strcmp(filter->filter->name, "frei0r_src") ||
^
667. !strcmp(filter->filter->name, "ocv")) {
668. /* a hack for compatibility with the old syntax
libavfilter/avfilter.c:667:21: Taking true branch
665. !strcmp(filter->filter->name, "frei0r") ||
666. !strcmp(filter->filter->name, "frei0r_src") ||
667. !strcmp(filter->filter->name, "ocv")) {
^
668. /* a hack for compatibility with the old syntax
669. * replace colons with |s */
libavfilter/avfilter.c:670:13:
668. /* a hack for compatibility with the old syntax
669. * replace colons with |s */
670. char *copy = av_strdup(args);
^
671. char *p = copy;
672. int nb_leading = 0; // number of leading colons to skip
libavutil/mem.c:196:1: start of procedure av_strdup()
194. }
195.
196. char *av_strdup(const char *s)
^
197. {
198. char *ptr = NULL;
libavutil/mem.c:198:5:
196. char *av_strdup(const char *s)
197. {
198. char *ptr = NULL;
^
199. if (s) {
200. int len = strlen(s) + 1;
libavutil/mem.c:199:9: Taking true branch
197. {
198. char *ptr = NULL;
199. if (s) {
^
200. int len = strlen(s) + 1;
201. ptr = av_realloc(NULL, len);
libavutil/mem.c:200:9:
198. char *ptr = NULL;
199. if (s) {
200. int len = strlen(s) + 1;
^
201. ptr = av_realloc(NULL, len);
202. if (ptr)
libavutil/mem.c:201:9:
199. if (s) {
200. int len = strlen(s) + 1;
201. ptr = av_realloc(NULL, len);
^
202. if (ptr)
203. memcpy(ptr, s, len);
libavutil/mem.c:107:1: start of procedure av_realloc()
105. }
106.
107. void *av_realloc(void *ptr, size_t size)
^
108. {
109. /* let's disallow possibly ambiguous cases */
libavutil/mem.c:110:9: Taking false branch
108. {
109. /* let's disallow possibly ambiguous cases */
110. if (size > (INT_MAX - 16))
^
111. return NULL;
112.
libavutil/mem.c:116:5:
114. return _aligned_realloc(ptr, size, 32);
115. #else
116. return realloc(ptr, size);
^
117. #endif
118. }
libavutil/mem.c:118:1: return from a call to av_realloc
116. return realloc(ptr, size);
117. #endif
118. }
^
119.
120. int av_reallocp(void *ptr, size_t size)
libavutil/mem.c:202:13: Taking true branch
200. int len = strlen(s) + 1;
201. ptr = av_realloc(NULL, len);
202. if (ptr)
^
203. memcpy(ptr, s, len);
204. }
libavutil/mem.c:203:13:
201. ptr = av_realloc(NULL, len);
202. if (ptr)
203. memcpy(ptr, s, len);
^
204. }
205. return ptr;
libavutil/mem.c:205:5:
203. memcpy(ptr, s, len);
204. }
205. return ptr;
^
206. }
207.
libavutil/mem.c:206:1: return from a call to av_strdup
204. }
205. return ptr;
206. }
^
207.
208. char *av_strndup(const char *s, size_t len)
libavfilter/avfilter.c:671:13:
669. * replace colons with |s */
670. char *copy = av_strdup(args);
671. char *p = copy;
^
672. int nb_leading = 0; // number of leading colons to skip
673.
libavfilter/avfilter.c:672:13:
670. char *copy = av_strdup(args);
671. char *p = copy;
672. int nb_leading = 0; // number of leading colons to skip
^
673.
674. if (!copy) {
libavfilter/avfilter.c:674:18: Taking false branch
672. int nb_leading = 0; // number of leading colons to skip
673.
674. if (!copy) {
^
675. ret = AVERROR(ENOMEM);
676. goto fail;
libavfilter/avfilter.c:679:18: Taking false branch
677. }
678.
679. if (!strcmp(filter->filter->name, "frei0r") ||
^
680. !strcmp(filter->filter->name, "ocv"))
681. nb_leading = 1;
libavfilter/avfilter.c:680:18: Taking false branch
678.
679. if (!strcmp(filter->filter->name, "frei0r") ||
680. !strcmp(filter->filter->name, "ocv"))
^
681. nb_leading = 1;
682. else if (!strcmp(filter->filter->name, "frei0r_src"))
libavfilter/avfilter.c:682:23: Taking false branch
680. !strcmp(filter->filter->name, "ocv"))
681. nb_leading = 1;
682. else if (!strcmp(filter->filter->name, "frei0r_src"))
^
683. nb_leading = 3;
684.
libavfilter/avfilter.c:685:20: Loop condition is false. Leaving loop
683. nb_leading = 3;
684.
685. while (nb_leading--) {
^
686. p = strchr(p, ':');
687. if (!p) {
libavfilter/avfilter.c:694:17: Taking true branch
692. }
693.
694. if (strchr(p, ':')) {
^
695. av_log(filter, AV_LOG_WARNING, "This syntax is deprecated. Use "
696. "'|' to separate the list items.\n");
libavfilter/avfilter.c:695:17: Skipping av_log(): empty list of specs
693.
694. if (strchr(p, ':')) {
695. av_log(filter, AV_LOG_WARNING, "This syntax is deprecated. Use "
^
696. "'|' to separate the list items.\n");
697. }
libavfilter/avfilter.c:699:21: Loop condition is false. Leaving loop
697. }
698.
699. while ((p = strchr(p, ':')))
^
700. *p++ = '|';
701.
libavfilter/avfilter.c:702:13: Skipping process_unnamed_options(): empty list of specs
700. *p++ = '|';
701.
702. ret = process_unnamed_options(filter, &options, copy);
^
703. av_freep(©);
704.
libavfilter/avfilter.c:703:13: Skipping av_freep(): empty list of specs
701.
702. ret = process_unnamed_options(filter, &options, copy);
703. av_freep(©);
^
704.
705. if (ret < 0)
|
https://github.com/libav/libav/blob/2e55e26b40e269816bba54da7d0e03955731b8fe/libavfilter/avfilter.c/#L703
|
d2a_code_trace_data_42093
|
static void dequant_lsps(double *lsps, int num,
const uint16_t *values,
const uint16_t *sizes,
int n_stages, const uint8_t *table,
const double *mul_q,
const double *base_q)
{
int n, m;
memset(lsps, 0, num * sizeof(*lsps));
for (n = 0; n < n_stages; n++) {
const uint8_t *t_off = &table[values[n] * num];
double base = base_q[n], mul = mul_q[n];
for (m = 0; m < num; m++)
lsps[m] += base + mul * t_off[m];
table += sizes[n] * num;
}
}
libavcodec/wmavoice.c:1791: error: Buffer Overrun L2
Offset: [2, 6] (⇐ 2 + [0, 4]) Size: 3 by call to `dequant_lsp16r`.
libavcodec/wmavoice.c:1734:1: Array declaration
1732. * fully parse the superframe
1733. */
1734. static int synth_superframe(AVCodecContext *ctx, AVFrame *frame,
^
1735. int *got_frame_ptr)
1736. {
libavcodec/wmavoice.c:1791:13: Call
1789. dequant_lsp10r(gb, lsps[2], prev_lsps, a1, a2, s->lsp_q_mode);
1790. } else /* s->lsps == 16 */
1791. dequant_lsp16r(gb, lsps[2], prev_lsps, a1, a2, s->lsp_q_mode);
^
1792.
1793. for (n = 0; n < s->lsps; n++) {
libavcodec/wmavoice.c:950:1: Parameter `*i_lsps`
948. * generate LSPs for the other frames from them (residual coding).
949. */
950. static void dequant_lsp16r(GetBitContext *gb,
^
951. double *i_lsps, const double *old,
952. double *a1, double *a2, int q_mode)
libavcodec/wmavoice.c:966:5: Call
964. int n;
965.
966. dequant_lsp16i(gb, i_lsps);
^
967.
968. interpol = get_bits(gb, 5);
libavcodec/wmavoice.c:917:1: Parameter `*lsps`
915. * Parse 16 independently-coded LSPs.
916. */
917. static void dequant_lsp16i(GetBitContext *gb, double *lsps)
^
918. {
919. static const uint16_t vec_sizes[5] = { 256, 64, 128, 64, 128 };
libavcodec/wmavoice.c:938:5: Call
936. v[4] = get_bits(gb, 7);
937.
938. dequant_lsps( lsps, 5, v, vec_sizes, 2,
^
939. wmavoice_dq_lsp16i1, mul_lsf, base_lsf);
940. dequant_lsps(&lsps[5], 5, &v[2], &vec_sizes[2], 2,
libavcodec/wmavoice.c:823:1: <Offset trace>
821. * @param base_q base (lowest) LSF values
822. */
823. static void dequant_lsps(double *lsps, int num,
^
824. const uint16_t *values,
825. const uint16_t *sizes,
libavcodec/wmavoice.c:823:1: Parameter `num`
821. * @param base_q base (lowest) LSF values
822. */
823. static void dequant_lsps(double *lsps, int num,
^
824. const uint16_t *values,
825. const uint16_t *sizes,
libavcodec/wmavoice.c:823:1: <Length trace>
821. * @param base_q base (lowest) LSF values
822. */
823. static void dequant_lsps(double *lsps, int num,
^
824. const uint16_t *values,
825. const uint16_t *sizes,
libavcodec/wmavoice.c:823:1: Parameter `*lsps`
821. * @param base_q base (lowest) LSF values
822. */
823. static void dequant_lsps(double *lsps, int num,
^
824. const uint16_t *values,
825. const uint16_t *sizes,
libavcodec/wmavoice.c:838:13: Array access: Offset: [2, 6] (⇐ 2 + [0, 4]) Size: 3 by call to `dequant_lsp16r`
836.
837. for (m = 0; m < num; m++)
838. lsps[m] += base + mul * t_off[m];
^
839.
840. table += sizes[n] * num;
|
https://github.com/libav/libav/blob/c6507946d428ee082676d5917fbb3eb0d1d7eb2e/libavcodec/wmavoice.c/#L838
|
d2a_code_trace_data_42094
|
static int truemotion1_decode_frame(AVCodecContext *avctx,
void *data, int *data_size,
const uint8_t *buf, int buf_size)
{
TrueMotion1Context *s = avctx->priv_data;
s->buf = buf;
s->size = buf_size;
if (truemotion1_decode_header(s) == -1)
return -1;
s->frame.reference = 1;
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID |
FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
if (avctx->reget_buffer(avctx, &s->frame) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1;
}
if (compression_types[s->compression].algorithm == ALGO_RGB24H) {
truemotion1_decode_24bit(s);
} else if (compression_types[s->compression].algorithm != ALGO_NOP) {
truemotion1_decode_16bit(s);
}
*data_size = sizeof(AVFrame);
*(AVFrame*)data = s->frame;
return buf_size;
}
libavcodec/truemotion1.c:867: error: Buffer Overrun L2
Offset: [-oo, max(17, `avctx->priv_data->compression`)] Size: 17.
libavcodec/truemotion1.c:847:1: <Offset trace>
845.
846.
847. static int truemotion1_decode_frame(AVCodecContext *avctx,
^
848. void *data, int *data_size,
849. const uint8_t *buf, int buf_size)
libavcodec/truemotion1.c:847:1: Parameter `avctx->priv_data->compression`
845.
846.
847. static int truemotion1_decode_frame(AVCodecContext *avctx,
^
848. void *data, int *data_size,
849. const uint8_t *buf, int buf_size)
libavcodec/truemotion1.c:856:9: Call
854. s->size = buf_size;
855.
856. if (truemotion1_decode_header(s) == -1)
^
857. return -1;
858.
libavcodec/truemotion1.c:322:1: Parameter `s->compression`
320. /* Returns the number of bytes consumed from the bytestream. Returns -1 if
321. * there was an error while decoding the header */
322. static int truemotion1_decode_header(TrueMotion1Context *s)
^
323. {
324. int i;
libavcodec/truemotion1.c:120:1: <Length trace>
118.
119. /* { valid for metatype }, algorithm, num of deltas, vert res, horiz res */
120. static comp_types compression_types[17] = {
^
121. { ALGO_NOP, 0, 0, 0 },
122.
libavcodec/truemotion1.c:120:1: Array declaration
118.
119. /* { valid for metatype }, algorithm, num of deltas, vert res, horiz res */
120. static comp_types compression_types[17] = {
^
121. { ALGO_NOP, 0, 0, 0 },
122.
libavcodec/truemotion1.c:867:9: Array access: Offset: [-oo, max(17, avctx->priv_data->compression)] Size: 17
865. }
866.
867. if (compression_types[s->compression].algorithm == ALGO_RGB24H) {
^
868. truemotion1_decode_24bit(s);
869. } else if (compression_types[s->compression].algorithm != ALGO_NOP) {
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/truemotion1.c/#L867
|
d2a_code_trace_data_42095
|
static inline void refill_32(BitstreamContext *bc)
{
if (bc->ptr >= bc->buffer_end)
return;
#ifdef BITSTREAM_READER_LE
bc->bits = (uint64_t)AV_RL32(bc->ptr) << bc->bits_left | bc->bits;
#else
bc->bits = bc->bits | (uint64_t)AV_RB32(bc->ptr) << (32 - bc->bits_left);
#endif
bc->ptr += 4;
bc->bits_left += 32;
}
libavcodec/takdec.c:311: error: Integer Overflow L2
(32 - [-1+min(64, `s->bc.bits_left`), -1+max(64, `s->bc.bits_left`)]):unsigned32 by call to `bitstream_read`.
libavcodec/takdec.c:286:1: Parameter `s->bc.bits_left`
284. }
285.
286. static int decode_residues(TAKDecContext *s, int32_t *decoded, int length)
^
287. {
288. BitstreamContext *bc = &s->bc;
libavcodec/takdec.c:294:9: Call
292. return AVERROR_INVALIDDATA;
293.
294. if (bitstream_read_bit(bc)) {
^
295. int wlength, rval;
296. int coding_mode[128];
libavcodec/bitstream.h:145:1: Parameter `bc->bits_left`
143.
144. /* Return one bit from the buffer. */
145. static inline unsigned bitstream_read_bit(BitstreamContext *bc)
^
146. {
147. if (!bc->bits_left)
libavcodec/bitstream.h:150:12: Call
148. refill_64(bc);
149.
150. return get_val(bc, 1);
^
151. }
152.
libavcodec/bitstream.h:130:1: 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: Assignment
137. bc->bits <<= n;
138. #endif
139. bc->bits_left -= n;
^
140.
141. return ret;
libavcodec/takdec.c:311:26: Call
309.
310. coding_mode[0] =
311. mode = bitstream_read(bc, 6);
^
312.
313. for (i = 1; i < wlength; i++) {
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:189:9: Call
187.
188. if (n > bc->bits_left) {
189. refill_32(bc);
^
190. if (bc->bits_left < 32)
191. bc->bits_left = n;
libavcodec/bitstream.h:60:1: <RHS trace>
58. }
59.
60. static inline void refill_32(BitstreamContext *bc)
^
61. {
62. if (bc->ptr >= bc->buffer_end)
libavcodec/bitstream.h:60:1: Parameter `bc->bits_left`
58. }
59.
60. static inline void refill_32(BitstreamContext *bc)
^
61. {
62. if (bc->ptr >= bc->buffer_end)
libavcodec/bitstream.h:68:5: Binary operation: (32 - [-1+min(64, s->bc.bits_left), -1+max(64, s->bc.bits_left)]):unsigned32 by call to `bitstream_read`
66. bc->bits = (uint64_t)AV_RL32(bc->ptr) << bc->bits_left | bc->bits;
67. #else
68. bc->bits = bc->bits | (uint64_t)AV_RB32(bc->ptr) << (32 - bc->bits_left);
^
69. #endif
70. bc->ptr += 4;
|
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L68
|
d2a_code_trace_data_42096
|
void 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,
unsigned 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);
unsigned md_size, md_block_size = 64;
unsigned 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;
unsigned int 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];
unsigned i, j, md_out_size_u;
EVP_MD_CTX md_ctx;
unsigned md_length_size = 8;
char length_is_big_endian = 1;
OPENSSL_assert(data_plus_mac_plus_padding_size < 1024*1024);
switch (EVP_MD_CTX_type(ctx))
{
case NID_md5:
MD5_Init((MD5_CTX*)md_state.c);
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:
SHA1_Init((SHA_CTX*)md_state.c);
md_final_raw = tls1_sha1_final_raw;
md_transform = (void(*)(void *ctx, const unsigned char *block)) SHA1_Transform;
md_size = 20;
break;
#ifndef OPENSSL_NO_SHA256
case NID_sha224:
SHA224_Init((SHA256_CTX*)md_state.c);
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:
SHA256_Init((SHA256_CTX*)md_state.c);
md_final_raw = tls1_sha256_final_raw;
md_transform = (void(*)(void *ctx, const unsigned char *block)) SHA256_Transform;
md_size = 32;
break;
#endif
#ifndef OPENSSL_NO_SHA512
case NID_sha384:
SHA384_Init((SHA512_CTX*)md_state.c);
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:
SHA512_Init((SHA512_CTX*)md_state.c);
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;
#endif
default:
OPENSSL_assert(0);
if (md_out_size)
*md_out_size = -1;
return;
}
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)
{
unsigned 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(i, index_a);
unsigned char is_block_b = constant_time_eq_8(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(j, c);
is_past_cp1 = is_block_a & constant_time_ge(j, c+1);
b = (b&~is_past_c) | (0x80&is_past_c);
b = b&~is_past_cp1;
b &= ~is_block_b | is_block_a;
if (j >= md_block_size - md_length_size)
{
b = (b&~is_block_b) | (is_block_b&length_bytes[j-(md_block_size-md_length_size)]);
}
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;
}
EVP_MD_CTX_init(&md_ctx);
EVP_DigestInit_ex(&md_ctx, ctx->digest, NULL );
if (is_sslv3)
{
memset(hmac_pad, 0x5c, sslv3_pad_length);
EVP_DigestUpdate(&md_ctx, mac_secret, mac_secret_length);
EVP_DigestUpdate(&md_ctx, hmac_pad, sslv3_pad_length);
EVP_DigestUpdate(&md_ctx, mac_out, md_size);
}
else
{
for (i = 0; i < md_block_size; i++)
hmac_pad[i] ^= 0x6a;
EVP_DigestUpdate(&md_ctx, hmac_pad, md_block_size);
EVP_DigestUpdate(&md_ctx, mac_out, md_size);
}
EVP_DigestFinal(&md_ctx, md_out, &md_out_size_u);
if (md_out_size)
*md_out_size = md_out_size_u;
EVP_MD_CTX_cleanup(&md_ctx);
}
ssl/t1_enc.c:1037: error: INTEGER_OVERFLOW_L2
([-51, +oo] - 1):unsigned32 by call to `ssl3_cbc_digest_record`.
Showing all 5 steps of the trace
ssl/t1_enc.c:971:1: Parameter `ssl->s3->read_mac_secret_size`
969. }
970.
971. > int tls1_mac(SSL *ssl, unsigned char *md, int send)
972. {
973. SSL3_RECORD *rec;
ssl/t1_enc.c:1037:3: Call
1035. * data we are hashing because that gives an attacker a
1036. * timing-oracle. */
1037. ssl3_cbc_digest_record(
^
1038. mac_ctx,
1039. md, &md_size,
ssl/s3_cbc.c:476:4: <LHS trace>
474. md_final_raw = tls1_md5_final_raw;
475. md_transform = (void(*)(void *ctx, const unsigned char *block)) MD5_Transform;
476. md_size = 16;
^
477. sslv3_pad_length = 48;
478. length_is_big_endian = 0;
ssl/s3_cbc.c:476:4: Assignment
474. md_final_raw = tls1_md5_final_raw;
475. md_transform = (void(*)(void *ctx, const unsigned char *block)) MD5_Transform;
476. md_size = 16;
^
477. sslv3_pad_length = 48;
478. length_is_big_endian = 0;
ssl/s3_cbc.c:566:2: Binary operation: ([-51, +oo] - 1):unsigned32 by call to `ssl3_cbc_digest_record`
564. /* max_mac_bytes contains the maximum bytes of bytes in the MAC, including
565. * |header|, assuming that there's no padding. */
566. max_mac_bytes = len - md_size - 1;
^
567. /* num_blocks is the maximum number of hash blocks. */
568. num_blocks = (max_mac_bytes + 1 + md_length_size + md_block_size - 1) / md_block_size;
|
https://github.com/openssl/openssl/blob/f93a41877d8d7a287debb7c63d7b646abaaf269c/ssl/s3_cbc.c/#L566
|
d2a_code_trace_data_42097
|
int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
{
char *v;
int gmt = 0;
int i;
int y = 0, M = 0, d = 0, h = 0, m = 0, s = 0;
char *f = NULL;
int f_len = 0;
i = tm->length;
v = (char *)tm->data;
if (i < 12)
goto err;
if (v[i - 1] == 'Z')
gmt = 1;
for (i = 0; i < 12; i++)
if ((v[i] > '9') || (v[i] < '0'))
goto err;
y = (v[0] - '0') * 1000 + (v[1] - '0') * 100
+ (v[2] - '0') * 10 + (v[3] - '0');
M = (v[4] - '0') * 10 + (v[5] - '0');
if ((M > 12) || (M < 1))
goto err;
d = (v[6] - '0') * 10 + (v[7] - '0');
h = (v[8] - '0') * 10 + (v[9] - '0');
m = (v[10] - '0') * 10 + (v[11] - '0');
if (tm->length >= 14 &&
(v[12] >= '0') && (v[12] <= '9') &&
(v[13] >= '0') && (v[13] <= '9')) {
s = (v[12] - '0') * 10 + (v[13] - '0');
if (tm->length >= 15 && v[14] == '.') {
int l = tm->length;
f = &v[14];
f_len = 1;
while (14 + f_len < l && f[f_len] >= '0' && f[f_len] <= '9')
++f_len;
}
}
if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s",
_asn1_mon[M - 1], d, h, m, s, f_len, f, y,
(gmt) ? " GMT" : "") <= 0)
return (0);
else
return (1);
err:
BIO_write(bp, "Bad time value", 14);
return (0);
}
crypto/x509/t_crl.c:108: error: BUFFER_OVERRUN_L3
Offset: [-529, +oo] Size: 12 by call to `ASN1_TIME_print`.
Showing all 19 steps of the trace
crypto/x509/t_crl.c:96:9: Call
94.
95. BIO_printf(out, "Certificate Revocation List (CRL):\n");
96. l = X509_CRL_get_version(x);
^
97. BIO_printf(out, "%8sVersion %lu (0x%lx)\n", "", l + 1, l);
98. X509_CRL_get0_signature(&sig, &sig_alg, x);
crypto/x509/x509cset.c:141:1: Parameter `*crl->crl.version->data`
139. }
140.
141. > long X509_CRL_get_version(X509_CRL *crl)
142. {
143. return ASN1_INTEGER_get(crl->crl.version);
crypto/x509/x509cset.c:143:12: Call
141. long X509_CRL_get_version(X509_CRL *crl)
142. {
143. return ASN1_INTEGER_get(crl->crl.version);
^
144. }
145.
crypto/asn1/a_int.c:608:1: Parameter `*a->data`
606. }
607.
608. > long ASN1_INTEGER_get(const ASN1_INTEGER *a)
609. {
610. int i;
crypto/x509/t_crl.c:100:5: Call
98. X509_CRL_get0_signature(&sig, &sig_alg, x);
99. i = X509_CRL_get_signature_nid(x);
100. X509_signature_print(out, sig_alg, NULL);
^
101. p = X509_NAME_oneline(X509_CRL_get_issuer(x), NULL, 0);
102. BIO_printf(out, "%8sIssuer: %s\n", "", p);
crypto/x509/t_x509.c:326:1: Parameter `*sig->data`
324. }
325.
326. > int X509_signature_print(BIO *bp, X509_ALGOR *sigalg, ASN1_STRING *sig)
327. {
328. int sig_nid;
crypto/x509/t_crl.c:101:9: Call
99. i = X509_CRL_get_signature_nid(x);
100. X509_signature_print(out, sig_alg, NULL);
101. p = X509_NAME_oneline(X509_CRL_get_issuer(x), NULL, 0);
^
102. BIO_printf(out, "%8sIssuer: %s\n", "", p);
103. OPENSSL_free(p);
crypto/x509/x509_obj.c:67:1: Parameter `*buf`
65. #include "internal/x509_int.h"
66.
67. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
68. {
69. X509_NAME_ENTRY *ne;
crypto/x509/t_crl.c:105:5: Call
103. OPENSSL_free(p);
104. BIO_printf(out, "%8sLast Update: ", "");
105. ASN1_TIME_print(out, X509_CRL_get_lastUpdate(x));
^
106. BIO_printf(out, "\n%8sNext Update: ", "");
107. if (X509_CRL_get_nextUpdate(x))
crypto/asn1/a_time.c:202:1: Parameter `*tm->data`
200. }
201.
202. > int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm)
203. {
204. if (tm->type == V_ASN1_UTCTIME)
crypto/x509/t_crl.c:108:9: Call
106. BIO_printf(out, "\n%8sNext Update: ", "");
107. if (X509_CRL_get_nextUpdate(x))
108. ASN1_TIME_print(out, X509_CRL_get_nextUpdate(x));
^
109. else
110. BIO_printf(out, "NONE");
crypto/asn1/a_time.c:202:1: Parameter `*tm->data`
200. }
201.
202. > int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm)
203. {
204. if (tm->type == V_ASN1_UTCTIME)
crypto/asn1/a_time.c:207:16: Call
205. return ASN1_UTCTIME_print(bp, tm);
206. if (tm->type == V_ASN1_GENERALIZEDTIME)
207. return ASN1_GENERALIZEDTIME_print(bp, tm);
^
208. BIO_write(bp, "Bad time value", 14);
209. return (0);
crypto/asn1/a_gentm.c:266:1: <Offset trace>
264. };
265.
266. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
267. {
268. char *v;
crypto/asn1/a_gentm.c:266:1: Parameter `*tm->data`
264. };
265.
266. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm)
267. {
268. char *v;
crypto/asn1/a_gentm.c:287:5: Assignment
285. y = (v[0] - '0') * 1000 + (v[1] - '0') * 100
286. + (v[2] - '0') * 10 + (v[3] - '0');
287. M = (v[4] - '0') * 10 + (v[5] - '0');
^
288. if ((M > 12) || (M < 1))
289. goto err;
crypto/asn1/a_gentm.c:261:1: <Length trace>
259. }
260.
261. > const char *_asn1_mon[12] = {
262. "Jan", "Feb", "Mar", "Apr", "May", "Jun",
263. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
crypto/asn1/a_gentm.c:261:1: Array declaration
259. }
260.
261. > const char *_asn1_mon[12] = {
262. "Jan", "Feb", "Mar", "Apr", "May", "Jun",
263. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
crypto/asn1/a_gentm.c:308:20: Array access: Offset: [-529, +oo] Size: 12 by call to `ASN1_TIME_print`
306.
307. if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s",
308. _asn1_mon[M - 1], d, h, m, s, f_len, f, y,
^
309. (gmt) ? " GMT" : "") <= 0)
310. return (0);
|
https://github.com/openssl/openssl/blob/01b7851aa27aa144372f5484da916be042d9aa4f/crypto/asn1/a_gentm.c/#L308
|
d2a_code_trace_data_42098
|
static int ocsp_add1_nonce(STACK_OF(X509_EXTENSION) **exts,
unsigned char *val, int len)
{
unsigned char *tmpval;
ASN1_OCTET_STRING os;
int ret = 0;
if (len <= 0)
len = OCSP_DEFAULT_NONCE_LENGTH;
os.length = ASN1_object_size(0, len, V_ASN1_OCTET_STRING);
os.data = OPENSSL_malloc(os.length);
if (os.data == NULL)
goto err;
tmpval = os.data;
ASN1_put_object(&tmpval, 0, len, V_ASN1_OCTET_STRING, V_ASN1_UNIVERSAL);
if (val)
memcpy(tmpval, val, len);
else if (RAND_bytes(tmpval, len) <= 0)
goto err;
if (!X509V3_add1_i2d(exts, NID_id_pkix_OCSP_Nonce,
&os, 0, X509V3_ADD_REPLACE))
goto err;
ret = 1;
err:
OPENSSL_free(os.data);
return ret;
}
crypto/ocsp/ocsp_ext.c:324: error: MEMORY_LEAK
memory dynamically allocated by call to `CRYPTO_malloc()` at line 315, column 15 is not reachable after line 324, column 10.
Showing all 47 steps of the trace
crypto/ocsp/ocsp_ext.c:300:1: start of procedure ocsp_add1_nonce()
298. */
299.
300. > static int ocsp_add1_nonce(STACK_OF(X509_EXTENSION) **exts,
301. unsigned char *val, int len)
302. {
crypto/ocsp/ocsp_ext.c:305:5:
303. unsigned char *tmpval;
304. ASN1_OCTET_STRING os;
305. > int ret = 0;
306. if (len <= 0)
307. len = OCSP_DEFAULT_NONCE_LENGTH;
crypto/ocsp/ocsp_ext.c:306:9: Taking false branch
304. ASN1_OCTET_STRING os;
305. int ret = 0;
306. if (len <= 0)
^
307. len = OCSP_DEFAULT_NONCE_LENGTH;
308. /*
crypto/ocsp/ocsp_ext.c:314:5:
312. * relies on library internals.
313. */
314. > os.length = ASN1_object_size(0, len, V_ASN1_OCTET_STRING);
315. os.data = OPENSSL_malloc(os.length);
316. if (os.data == NULL)
crypto/asn1/asn1_lib.c:256:1: start of procedure ASN1_object_size()
254. }
255.
256. > int ASN1_object_size(int constructed, int length, int tag)
257. {
258. int ret;
crypto/asn1/asn1_lib.c:260:5:
258. int ret;
259.
260. > ret = length;
261. ret++;
262. if (tag >= 31) {
crypto/asn1/asn1_lib.c:261:5:
259.
260. ret = length;
261. > ret++;
262. if (tag >= 31) {
263. while (tag > 0) {
crypto/asn1/asn1_lib.c:262:9: Taking false branch
260. ret = length;
261. ret++;
262. if (tag >= 31) {
^
263. while (tag > 0) {
264. tag >>= 7;
crypto/asn1/asn1_lib.c:268:9: Taking false branch
266. }
267. }
268. if (constructed == 2)
^
269. return ret + 3;
270. ret++;
crypto/asn1/asn1_lib.c:270:5:
268. if (constructed == 2)
269. return ret + 3;
270. > ret++;
271. if (length > 127) {
272. while (length > 0) {
crypto/asn1/asn1_lib.c:271:9: Taking true branch
269. return ret + 3;
270. ret++;
271. if (length > 127) {
^
272. while (length > 0) {
273. length >>= 8;
crypto/asn1/asn1_lib.c:272:16: Loop condition is true. Entering loop body
270. ret++;
271. if (length > 127) {
272. while (length > 0) {
^
273. length >>= 8;
274. ret++;
crypto/asn1/asn1_lib.c:273:13:
271. if (length > 127) {
272. while (length > 0) {
273. > length >>= 8;
274. ret++;
275. }
crypto/asn1/asn1_lib.c:274:13:
272. while (length > 0) {
273. length >>= 8;
274. > ret++;
275. }
276. }
crypto/asn1/asn1_lib.c:272:16: Loop condition is true. Entering loop body
270. ret++;
271. if (length > 127) {
272. while (length > 0) {
^
273. length >>= 8;
274. ret++;
crypto/asn1/asn1_lib.c:273:13:
271. if (length > 127) {
272. while (length > 0) {
273. > length >>= 8;
274. ret++;
275. }
crypto/asn1/asn1_lib.c:274:13:
272. while (length > 0) {
273. length >>= 8;
274. > ret++;
275. }
276. }
crypto/asn1/asn1_lib.c:272:16: Loop condition is false. Leaving loop
270. ret++;
271. if (length > 127) {
272. while (length > 0) {
^
273. length >>= 8;
274. ret++;
crypto/asn1/asn1_lib.c:277:5:
275. }
276. }
277. > return (ret);
278. }
279.
crypto/asn1/asn1_lib.c:278:1: return from a call to ASN1_object_size
276. }
277. return (ret);
278. > }
279.
280. int ASN1_STRING_copy(ASN1_STRING *dst, const ASN1_STRING *str)
crypto/ocsp/ocsp_ext.c:315:5:
313. */
314. os.length = ASN1_object_size(0, len, V_ASN1_OCTET_STRING);
315. > os.data = OPENSSL_malloc(os.length);
316. if (os.data == NULL)
317. goto err;
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/ocsp/ocsp_ext.c:316:9: Taking false branch
314. os.length = ASN1_object_size(0, len, V_ASN1_OCTET_STRING);
315. os.data = OPENSSL_malloc(os.length);
316. if (os.data == NULL)
^
317. goto err;
318. tmpval = os.data;
crypto/ocsp/ocsp_ext.c:318:5:
316. if (os.data == NULL)
317. goto err;
318. > tmpval = os.data;
319. ASN1_put_object(&tmpval, 0, len, V_ASN1_OCTET_STRING, V_ASN1_UNIVERSAL);
320. if (val)
crypto/ocsp/ocsp_ext.c:319:5: Skipping ASN1_put_object(): empty list of specs
317. goto err;
318. tmpval = os.data;
319. ASN1_put_object(&tmpval, 0, len, V_ASN1_OCTET_STRING, V_ASN1_UNIVERSAL);
^
320. if (val)
321. memcpy(tmpval, val, len);
crypto/ocsp/ocsp_ext.c:320:9: Taking false branch
318. tmpval = os.data;
319. ASN1_put_object(&tmpval, 0, len, V_ASN1_OCTET_STRING, V_ASN1_UNIVERSAL);
320. if (val)
^
321. memcpy(tmpval, val, len);
322. else if (RAND_bytes(tmpval, len) <= 0)
crypto/ocsp/ocsp_ext.c:322:14:
320. if (val)
321. memcpy(tmpval, val, len);
322. > else if (RAND_bytes(tmpval, len) <= 0)
323. goto err;
324. if (!X509V3_add1_i2d(exts, NID_id_pkix_OCSP_Nonce,
crypto/rand/rand_lib.c:155:1: start of procedure RAND_bytes()
153. }
154.
155. > int RAND_bytes(unsigned char *buf, int num)
156. {
157. const RAND_METHOD *meth = RAND_get_rand_method();
crypto/rand/rand_lib.c:157:5:
155. int RAND_bytes(unsigned char *buf, int num)
156. {
157. > const RAND_METHOD *meth = RAND_get_rand_method();
158. if (meth && meth->bytes)
159. return meth->bytes(buf, num);
crypto/rand/rand_lib.c:92:1: start of procedure RAND_get_rand_method()
90. }
91.
92. > const RAND_METHOD *RAND_get_rand_method(void)
93. {
94. if (!default_RAND_meth) {
crypto/rand/rand_lib.c:94:10: Taking false branch
92. const RAND_METHOD *RAND_get_rand_method(void)
93. {
94. if (!default_RAND_meth) {
^
95. #ifndef OPENSSL_NO_ENGINE
96. ENGINE *e = ENGINE_get_default_RAND();
crypto/rand/rand_lib.c:110:5:
108. default_RAND_meth = RAND_OpenSSL();
109. }
110. > return default_RAND_meth;
111. }
112.
crypto/rand/rand_lib.c:111:1: return from a call to RAND_get_rand_method
109. }
110. return default_RAND_meth;
111. > }
112.
113. #ifndef OPENSSL_NO_ENGINE
crypto/rand/rand_lib.c:158:9: Taking true branch
156. {
157. const RAND_METHOD *meth = RAND_get_rand_method();
158. if (meth && meth->bytes)
^
159. return meth->bytes(buf, num);
160. return (-1);
crypto/rand/rand_lib.c:158:17: Taking true branch
156. {
157. const RAND_METHOD *meth = RAND_get_rand_method();
158. if (meth && meth->bytes)
^
159. return meth->bytes(buf, num);
160. return (-1);
crypto/rand/rand_lib.c:159:9: Skipping __function_pointer__(): unresolved function pointer
157. const RAND_METHOD *meth = RAND_get_rand_method();
158. if (meth && meth->bytes)
159. return meth->bytes(buf, num);
^
160. return (-1);
161. }
crypto/rand/rand_lib.c:161:1: return from a call to RAND_bytes
159. return meth->bytes(buf, num);
160. return (-1);
161. > }
162.
163. #if OPENSSL_API_COMPAT < 0x10100000L
crypto/ocsp/ocsp_ext.c:322:14: Taking false branch
320. if (val)
321. memcpy(tmpval, val, len);
322. else if (RAND_bytes(tmpval, len) <= 0)
^
323. goto err;
324. if (!X509V3_add1_i2d(exts, NID_id_pkix_OCSP_Nonce,
crypto/ocsp/ocsp_ext.c:324:10: Skipping X509V3_add1_i2d(): empty list of specs
322. else if (RAND_bytes(tmpval, len) <= 0)
323. goto err;
324. if (!X509V3_add1_i2d(exts, NID_id_pkix_OCSP_Nonce,
^
325. &os, 0, X509V3_ADD_REPLACE))
326. goto err;
|
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/ocsp/ocsp_ext.c/#L324
|
d2a_code_trace_data_42099
|
char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
{
X509_NAME_ENTRY *ne;
int i;
int n, lold, l, l1, l2, num, j, type;
const char *s;
char *p;
unsigned char *q;
BUF_MEM *b = NULL;
static const char hex[17] = "0123456789ABCDEF";
int gs_doit[4];
char tmp_buf[80];
#ifdef CHARSET_EBCDIC
unsigned char ebcdic_buf[1024];
#endif
if (buf == NULL) {
if ((b = BUF_MEM_new()) == NULL)
goto err;
if (!BUF_MEM_grow(b, 200))
goto err;
b->data[0] = '\0';
len = 200;
} else if (len == 0) {
return NULL;
}
if (a == NULL) {
if (b) {
buf = b->data;
OPENSSL_free(b);
}
strncpy(buf, "NO X509_NAME", len);
buf[len - 1] = '\0';
return buf;
}
len--;
l = 0;
for (i = 0; i < sk_X509_NAME_ENTRY_num(a->entries); i++) {
ne = sk_X509_NAME_ENTRY_value(a->entries, i);
n = OBJ_obj2nid(ne->object);
if ((n == NID_undef) || ((s = OBJ_nid2sn(n)) == NULL)) {
i2t_ASN1_OBJECT(tmp_buf, sizeof(tmp_buf), ne->object);
s = tmp_buf;
}
l1 = strlen(s);
type = ne->value->type;
num = ne->value->length;
q = ne->value->data;
#ifdef CHARSET_EBCDIC
if (type == V_ASN1_GENERALSTRING ||
type == V_ASN1_VISIBLESTRING ||
type == V_ASN1_PRINTABLESTRING ||
type == V_ASN1_TELETEXSTRING ||
type == V_ASN1_VISIBLESTRING || type == V_ASN1_IA5STRING) {
ascii2ebcdic(ebcdic_buf, q, (num > (int)sizeof(ebcdic_buf))
? (int)sizeof(ebcdic_buf) : num);
q = ebcdic_buf;
}
#endif
if ((type == V_ASN1_GENERALSTRING) && ((num % 4) == 0)) {
gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 0;
for (j = 0; j < num; j++)
if (q[j] != 0)
gs_doit[j & 3] = 1;
if (gs_doit[0] | gs_doit[1] | gs_doit[2])
gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1;
else {
gs_doit[0] = gs_doit[1] = gs_doit[2] = 0;
gs_doit[3] = 1;
}
} else
gs_doit[0] = gs_doit[1] = gs_doit[2] = gs_doit[3] = 1;
for (l2 = j = 0; j < num; j++) {
if (!gs_doit[j & 3])
continue;
l2++;
#ifndef CHARSET_EBCDIC
if ((q[j] < ' ') || (q[j] > '~'))
l2 += 3;
#else
if ((os_toascii[q[j]] < os_toascii[' ']) ||
(os_toascii[q[j]] > os_toascii['~']))
l2 += 3;
#endif
}
lold = l;
l += 1 + l1 + 1 + l2;
if (b != NULL) {
if (!BUF_MEM_grow(b, l + 1))
goto err;
p = &(b->data[lold]);
} else if (l > len) {
break;
} else
p = &(buf[lold]);
*(p++) = '/';
memcpy(p, s, (unsigned int)l1);
p += l1;
*(p++) = '=';
#ifndef CHARSET_EBCDIC
q = ne->value->data;
#endif
for (j = 0; j < num; j++) {
if (!gs_doit[j & 3])
continue;
#ifndef CHARSET_EBCDIC
n = q[j];
if ((n < ' ') || (n > '~')) {
*(p++) = '\\';
*(p++) = 'x';
*(p++) = hex[(n >> 4) & 0x0f];
*(p++) = hex[n & 0x0f];
} else
*(p++) = n;
#else
n = os_toascii[q[j]];
if ((n < os_toascii[' ']) || (n > os_toascii['~'])) {
*(p++) = '\\';
*(p++) = 'x';
*(p++) = hex[(n >> 4) & 0x0f];
*(p++) = hex[n & 0x0f];
} else
*(p++) = q[j];
#endif
}
*p = '\0';
}
if (b != NULL) {
p = b->data;
OPENSSL_free(b);
} else
p = buf;
if (i == 0)
*p = '\0';
return (p);
err:
X509err(X509_F_X509_NAME_ONELINE, ERR_R_MALLOC_FAILURE);
BUF_MEM_free(b);
return (NULL);
}
apps/s_server.c:2639: error: BUFFER_OVERRUN_L3
Offset added: [200, 8192] Size: [1, 2147483644] by call to `X509_NAME_oneline`.
Showing all 6 steps of the trace
apps/s_server.c:2639:9: Call
2637. BIO_printf(bio_s_out, "Client certificate\n");
2638. PEM_write_bio_X509(bio_s_out, peer);
2639. X509_NAME_oneline(X509_get_subject_name(peer), buf, sizeof buf);
^
2640. BIO_printf(bio_s_out, "subject=%s\n", buf);
2641. X509_NAME_oneline(X509_get_issuer_name(peer), buf, sizeof buf);
crypto/x509/x509_obj.c:66:1: <Offset trace>
64. #include "internal/x509_int.h"
65.
66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
67. {
68. X509_NAME_ENTRY *ne;
crypto/x509/x509_obj.c:66:1: Parameter `len`
64. #include "internal/x509_int.h"
65.
66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
67. {
68. X509_NAME_ENTRY *ne;
crypto/x509/x509_obj.c:66:1: <Length trace>
64. #include "internal/x509_int.h"
65.
66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
67. {
68. X509_NAME_ENTRY *ne;
crypto/x509/x509_obj.c:66:1: Parameter `*buf`
64. #include "internal/x509_int.h"
65.
66. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len)
67. {
68. X509_NAME_ENTRY *ne;
crypto/x509/x509_obj.c:97:9: Array access: Offset added: [200, 8192] Size: [1, 2147483644] by call to `X509_NAME_oneline`
95. OPENSSL_free(b);
96. }
97. strncpy(buf, "NO X509_NAME", len);
^
98. buf[len - 1] = '\0';
99. return buf;
|
https://github.com/openssl/openssl/blob/b33d1141b6dcce947708b984c5e9e91dad3d675d/crypto/x509/x509_obj.c/#L97
|
d2a_code_trace_data_42100
|
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;
}
test/testutil/tests.c:646: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_dup`.
Showing all 11 steps of the trace
test/testutil/tests.c:638:1: Parameter `a->top`
636. }
637.
638. > int test_BN_abs_eq_word(const char *file, int line, const char *bns,
639. const char *ws, const BIGNUM *a, BN_ULONG w)
640. {
test/testutil/tests.c:646:10: Call
644. return 1;
645. bw = BN_new();
646. aa = BN_dup(a);
^
647. BN_set_negative(aa, 0);
648. BN_set_word(bw, w);
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/3f97052392cb10fca5309212bf720685262ad4a6/crypto/bn/bn_lib.c/#L333
|
d2a_code_trace_data_42101
|
static int check_cert(X509_STORE_CTX *ctx)
{
X509_CRL *crl = NULL, *dcrl = NULL;
X509 *x = NULL;
int ok = 0, cnum = 0;
unsigned int last_reasons = 0;
cnum = ctx->error_depth;
x = sk_X509_value(ctx->chain, cnum);
ctx->current_cert = x;
ctx->current_issuer = NULL;
ctx->current_crl_score = 0;
ctx->current_reasons = 0;
while (ctx->current_reasons != CRLDP_ALL_REASONS) {
last_reasons = ctx->current_reasons;
if (ctx->get_crl)
ok = ctx->get_crl(ctx, &crl, x);
else
ok = get_crl_delta(ctx, &crl, &dcrl, x);
if (!ok) {
ctx->error = X509_V_ERR_UNABLE_TO_GET_CRL;
ok = ctx->verify_cb(0, ctx);
goto err;
}
ctx->current_crl = crl;
ok = ctx->check_crl(ctx, crl);
if (!ok)
goto err;
if (dcrl) {
ok = ctx->check_crl(ctx, dcrl);
if (!ok)
goto err;
ok = ctx->cert_crl(ctx, dcrl, x);
if (!ok)
goto err;
} else
ok = 1;
if (ok != 2) {
ok = ctx->cert_crl(ctx, crl, x);
if (!ok)
goto err;
}
X509_CRL_free(crl);
X509_CRL_free(dcrl);
crl = NULL;
dcrl = NULL;
if (last_reasons == ctx->current_reasons) {
ctx->error = X509_V_ERR_UNABLE_TO_GET_CRL;
ok = ctx->verify_cb(0, ctx);
goto err;
}
}
err:
X509_CRL_free(crl);
X509_CRL_free(dcrl);
ctx->current_crl = NULL;
return ok;
}
crypto/x509/x509_vfy.c:682: error: NULL_DEREFERENCE
pointer `x` last assigned on line 671 could be null and is dereferenced by call to `get_crl_delta()` at line 682, column 18.
Showing all 29 steps of the trace
crypto/x509/x509_vfy.c:664:1: start of procedure check_cert()
662. }
663.
664. > static int check_cert(X509_STORE_CTX *ctx)
665. {
666. X509_CRL *crl = NULL, *dcrl = NULL;
crypto/x509/x509_vfy.c:666:5:
664. static int check_cert(X509_STORE_CTX *ctx)
665. {
666. > X509_CRL *crl = NULL, *dcrl = NULL;
667. X509 *x = NULL;
668. int ok = 0, cnum = 0;
crypto/x509/x509_vfy.c:667:5:
665. {
666. X509_CRL *crl = NULL, *dcrl = NULL;
667. > X509 *x = NULL;
668. int ok = 0, cnum = 0;
669. unsigned int last_reasons = 0;
crypto/x509/x509_vfy.c:668:5:
666. X509_CRL *crl = NULL, *dcrl = NULL;
667. X509 *x = NULL;
668. > int ok = 0, cnum = 0;
669. unsigned int last_reasons = 0;
670. cnum = ctx->error_depth;
crypto/x509/x509_vfy.c:669:5:
667. X509 *x = NULL;
668. int ok = 0, cnum = 0;
669. > unsigned int last_reasons = 0;
670. cnum = ctx->error_depth;
671. x = sk_X509_value(ctx->chain, cnum);
crypto/x509/x509_vfy.c:670:5:
668. int ok = 0, cnum = 0;
669. unsigned int last_reasons = 0;
670. > cnum = ctx->error_depth;
671. x = sk_X509_value(ctx->chain, cnum);
672. ctx->current_cert = x;
crypto/x509/x509_vfy.c:671:9: Condition is true
669. unsigned int last_reasons = 0;
670. cnum = ctx->error_depth;
671. x = sk_X509_value(ctx->chain, cnum);
^
672. ctx->current_cert = x;
673. ctx->current_issuer = NULL;
crypto/x509/x509_vfy.c:671:5:
669. unsigned int last_reasons = 0;
670. cnum = ctx->error_depth;
671. > x = sk_X509_value(ctx->chain, cnum);
672. ctx->current_cert = x;
673. ctx->current_issuer = NULL;
crypto/stack/stack.c:324:1: start of procedure sk_value()
322. }
323.
324. > void *sk_value(const _STACK *st, int i)
325. {
326. if (!st || (i < 0) || (i >= st->num))
crypto/stack/stack.c:326:10: Taking false branch
324. void *sk_value(const _STACK *st, int i)
325. {
326. if (!st || (i < 0) || (i >= st->num))
^
327. return NULL;
328. return st->data[i];
crypto/stack/stack.c:326:17: Taking false branch
324. void *sk_value(const _STACK *st, int i)
325. {
326. if (!st || (i < 0) || (i >= st->num))
^
327. return NULL;
328. return st->data[i];
crypto/stack/stack.c:326:28: Taking true branch
324. void *sk_value(const _STACK *st, int i)
325. {
326. if (!st || (i < 0) || (i >= st->num))
^
327. return NULL;
328. return st->data[i];
crypto/stack/stack.c:327:9:
325. {
326. if (!st || (i < 0) || (i >= st->num))
327. > return NULL;
328. return st->data[i];
329. }
crypto/stack/stack.c:329:1: return from a call to sk_value
327. return NULL;
328. return st->data[i];
329. > }
330.
331. void *sk_set(_STACK *st, int i, void *value)
crypto/x509/x509_vfy.c:672:5:
670. cnum = ctx->error_depth;
671. x = sk_X509_value(ctx->chain, cnum);
672. > ctx->current_cert = x;
673. ctx->current_issuer = NULL;
674. ctx->current_crl_score = 0;
crypto/x509/x509_vfy.c:673:5:
671. x = sk_X509_value(ctx->chain, cnum);
672. ctx->current_cert = x;
673. > ctx->current_issuer = NULL;
674. ctx->current_crl_score = 0;
675. ctx->current_reasons = 0;
crypto/x509/x509_vfy.c:674:5:
672. ctx->current_cert = x;
673. ctx->current_issuer = NULL;
674. > ctx->current_crl_score = 0;
675. ctx->current_reasons = 0;
676. while (ctx->current_reasons != CRLDP_ALL_REASONS) {
crypto/x509/x509_vfy.c:675:5:
673. ctx->current_issuer = NULL;
674. ctx->current_crl_score = 0;
675. > ctx->current_reasons = 0;
676. while (ctx->current_reasons != CRLDP_ALL_REASONS) {
677. last_reasons = ctx->current_reasons;
crypto/x509/x509_vfy.c:676:12: Loop condition is true. Entering loop body
674. ctx->current_crl_score = 0;
675. ctx->current_reasons = 0;
676. while (ctx->current_reasons != CRLDP_ALL_REASONS) {
^
677. last_reasons = ctx->current_reasons;
678. /* Try to retrieve relevant CRL */
crypto/x509/x509_vfy.c:677:9:
675. ctx->current_reasons = 0;
676. while (ctx->current_reasons != CRLDP_ALL_REASONS) {
677. > last_reasons = ctx->current_reasons;
678. /* Try to retrieve relevant CRL */
679. if (ctx->get_crl)
crypto/x509/x509_vfy.c:679:13: Taking false branch
677. last_reasons = ctx->current_reasons;
678. /* Try to retrieve relevant CRL */
679. if (ctx->get_crl)
^
680. ok = ctx->get_crl(ctx, &crl, x);
681. else
crypto/x509/x509_vfy.c:682:13:
680. ok = ctx->get_crl(ctx, &crl, x);
681. else
682. > ok = get_crl_delta(ctx, &crl, &dcrl, x);
683. /*
684. * If error looking up CRL, nothing we can do except notify callback
crypto/x509/x509_vfy.c:1230:1: start of procedure get_crl_delta()
1228. */
1229.
1230. > static int get_crl_delta(X509_STORE_CTX *ctx,
1231. X509_CRL **pcrl, X509_CRL **pdcrl, X509 *x)
1232. {
crypto/x509/x509_vfy.c:1234:5:
1232. {
1233. int ok;
1234. > X509 *issuer = NULL;
1235. int crl_score = 0;
1236. unsigned int reasons;
crypto/x509/x509_vfy.c:1235:5:
1233. int ok;
1234. X509 *issuer = NULL;
1235. > int crl_score = 0;
1236. unsigned int reasons;
1237. X509_CRL *crl = NULL, *dcrl = NULL;
crypto/x509/x509_vfy.c:1237:5:
1235. int crl_score = 0;
1236. unsigned int reasons;
1237. > X509_CRL *crl = NULL, *dcrl = NULL;
1238. STACK_OF(X509_CRL) *skcrl;
1239. X509_NAME *nm = X509_get_issuer_name(x);
crypto/x509/x509_vfy.c:1239:5:
1237. X509_CRL *crl = NULL, *dcrl = NULL;
1238. STACK_OF(X509_CRL) *skcrl;
1239. > X509_NAME *nm = X509_get_issuer_name(x);
1240. reasons = ctx->current_reasons;
1241. ok = get_crl_sk(ctx, &crl, &dcrl,
crypto/x509/x509_cmp.c:132:1: start of procedure X509_get_issuer_name()
130. }
131.
132. > X509_NAME *X509_get_issuer_name(X509 *a)
133. {
134. return (a->cert_info.issuer);
crypto/x509/x509_cmp.c:134:5:
132. X509_NAME *X509_get_issuer_name(X509 *a)
133. {
134. > return (a->cert_info.issuer);
135. }
136.
|
https://github.com/openssl/openssl/blob/e29c73c93b88a4b7f492c7c8c7343223e7548612/crypto/x509/x509_vfy.c/#L682
|
d2a_code_trace_data_42102
|
static int
ebml_read_element_level_up (MatroskaDemuxContext *matroska)
{
ByteIOContext *pb = matroska->ctx->pb;
offset_t pos = url_ftell(pb);
int num = 0;
while (matroska->num_levels > 0) {
MatroskaLevel *level = &matroska->levels[matroska->num_levels - 1];
if (pos >= level->start + level->length) {
matroska->num_levels--;
num++;
} else {
break;
}
}
return num;
}
libavformat/matroskadec.c:1790: error: Buffer Overrun L2
Offset: [0, max(16, `matroska->num_levels`)] Size: 16 by call to `ebml_peek_id`.
libavformat/matroskadec.c:1691:1: Parameter `matroska->num_levels`
1689. }
1690.
1691. static int
^
1692. matroska_parse_seekhead (MatroskaDemuxContext *matroska)
1693. {
libavformat/matroskadec.c:1700:20: Call
1698.
1699. while (res == 0) {
1700. if (!(id = ebml_peek_id(matroska, &matroska->level_up))) {
^
1701. res = AVERROR(EIO);
1702. break;
libavformat/matroskadec.c:306:1: Parameter `matroska->num_levels`
304. */
305.
306. static uint32_t
^
307. ebml_peek_id (MatroskaDemuxContext *matroska,
308. int *level_up)
libavformat/matroskadec.c:312:9: Call
310. uint32_t id;
311.
312. if (ebml_read_element_id(matroska, &id, level_up) < 0)
^
313. return 0;
314.
libavformat/matroskadec.c:256:1: Parameter `matroska->num_levels`
254. */
255.
256. static int
^
257. ebml_read_element_id (MatroskaDemuxContext *matroska,
258. uint32_t *id,
libavformat/matroskadec.c:1713:28: Call
1711. uint64_t seek_pos = (uint64_t) -1, t;
1712.
1713. if ((res = ebml_read_master(matroska, &id)) < 0)
^
1714. break;
1715.
libavformat/matroskadec.c:532:1: Parameter `matroska->num_levels`
530. */
531.
532. static int
^
533. ebml_read_master (MatroskaDemuxContext *matroska,
534. uint32_t *id)
libavformat/matroskadec.c:541:16: Call
539. int res;
540.
541. if ((res = ebml_read_element_id(matroska, id, NULL)) < 0 ||
^
542. (res = ebml_read_element_length(matroska, &length)) < 0)
543. return res;
libavformat/matroskadec.c:256:1: Parameter `matroska->num_levels`
254. */
255.
256. static int
^
257. ebml_read_element_id (MatroskaDemuxContext *matroska,
258. uint32_t *id,
libavformat/matroskadec.c:1787:25: Assignment
1785. level.length = (uint64_t)-1;
1786. matroska->levels[matroska->num_levels] = level;
1787. matroska->num_levels++;
^
1788.
1789. /* check ID */
libavformat/matroskadec.c:1790:36: Call
1788.
1789. /* check ID */
1790. if (!(id = ebml_peek_id (matroska,
^
1791. &matroska->level_up)))
1792. goto finish;
libavformat/matroskadec.c:306:1: Parameter `matroska->num_levels`
304. */
305.
306. static uint32_t
^
307. ebml_peek_id (MatroskaDemuxContext *matroska,
308. int *level_up)
libavformat/matroskadec.c:312:9: Call
310. uint32_t id;
311.
312. if (ebml_read_element_id(matroska, &id, level_up) < 0)
^
313. return 0;
314.
libavformat/matroskadec.c:256:1: Parameter `matroska->num_levels`
254. */
255.
256. static int
^
257. ebml_read_element_id (MatroskaDemuxContext *matroska,
258. uint32_t *id,
libavformat/matroskadec.c:279:21: Call
277. /* level tracking */
278. if (level_up)
279. *level_up = ebml_read_element_level_up(matroska);
^
280.
281. return read;
libavformat/matroskadec.c:175:1: <Offset trace>
173. */
174.
175. static int
^
176. ebml_read_element_level_up (MatroskaDemuxContext *matroska)
177. {
libavformat/matroskadec.c:175:1: Parameter `matroska->num_levels`
173. */
174.
175. static int
^
176. ebml_read_element_level_up (MatroskaDemuxContext *matroska)
177. {
libavformat/matroskadec.c:175:1: <Length trace>
173. */
174.
175. static int
^
176. ebml_read_element_level_up (MatroskaDemuxContext *matroska)
177. {
libavformat/matroskadec.c:175:1: Parameter `matroska->levels[*]`
173. */
174.
175. static int
^
176. ebml_read_element_level_up (MatroskaDemuxContext *matroska)
177. {
libavformat/matroskadec.c:183:9: Array access: Offset: [0, max(16, matroska->num_levels)] Size: 16 by call to `ebml_peek_id`
181.
182. while (matroska->num_levels > 0) {
183. MatroskaLevel *level = &matroska->levels[matroska->num_levels - 1];
^
184.
185. if (pos >= level->start + level->length) {
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/matroskadec.c/#L183
|
d2a_code_trace_data_42103
|
int is_partially_overlapping(const void *ptr1, const void *ptr2, int len)
{
PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2;
int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) |
(diff > (0 - (PTRDIFF_T)len)));
return overlapped;
}
crypto/cms/cms_pwri.c:202: error: INTEGER_OVERFLOW_L2
(0 - [-oo, 32]):unsigned64 by call to `EVP_DecryptUpdate`.
Showing all 7 steps of the trace
crypto/cms/cms_pwri.c:202:13: Call
200. * this works because buffer is at least two block lengths long.
201. */
202. || !EVP_DecryptUpdate(ctx, tmp, &outl,
^
203. tmp + inlen - blocklen, blocklen)
204. /* Can now decrypt first n - 1 blocks */
crypto/evp/evp_enc.c:416:1: Parameter `ctx->cipher->block_size`
414. }
415.
416. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
417. const unsigned char *in, int inl)
418. {
crypto/evp/evp_enc.c:422:5: Assignment
420. unsigned int b;
421.
422. b = ctx->cipher->block_size;
^
423.
424. if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) {
crypto/evp/evp_enc.c:452:16: Call
450. /* see comment about PTRDIFF_T comparison above */
451. if (((PTRDIFF_T)out == (PTRDIFF_T)in)
452. || is_partially_overlapping(out, in, b)) {
^
453. EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING);
454. return 0;
crypto/evp/evp_enc.c:279:1: <RHS trace>
277. #endif
278.
279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len)
280. {
281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2;
crypto/evp/evp_enc.c:279:1: Parameter `len`
277. #endif
278.
279. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len)
280. {
281. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2;
crypto/evp/evp_enc.c:288:50: Binary operation: (0 - [-oo, 32]):unsigned64 by call to `EVP_DecryptUpdate`
286. */
287. int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) |
288. (diff > (0 - (PTRDIFF_T)len)));
^
289.
290. return overlapped;
|
https://github.com/openssl/openssl/blob/b1531d8e6cc95837e38b10d875ae64144c6fdf7a/crypto/evp/evp_enc.c/#L288
|
d2a_code_trace_data_42104
|
void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset,
MPA_INT *window, int *dither_state,
OUT_INT *samples, int incr,
int32_t sb_samples[SBLIMIT])
{
int32_t tmp[32];
register MPA_INT *synth_buf;
register const MPA_INT *w, *w2, *p;
int j, offset, v;
OUT_INT *samples2;
#if FRAC_BITS <= 15
int sum, sum2;
#else
int64_t sum, sum2;
#endif
dct32(tmp, sb_samples);
offset = *synth_buf_offset;
synth_buf = synth_buf_ptr + offset;
for(j=0;j<32;j++) {
v = tmp[j];
#if FRAC_BITS <= 15
v = av_clip_int16(v);
#endif
synth_buf[j] = v;
}
memcpy(synth_buf + 512, synth_buf, 32 * sizeof(MPA_INT));
samples2 = samples + 31 * incr;
w = window;
w2 = window + 31;
sum = *dither_state;
p = synth_buf + 16;
SUM8(sum, +=, w, p);
p = synth_buf + 48;
SUM8(sum, -=, w + 32, p);
*samples = round_sample(&sum);
samples += incr;
w++;
for(j=1;j<16;j++) {
sum2 = 0;
p = synth_buf + 16 + j;
SUM8P2(sum, +=, sum2, -=, w, w2, p);
p = synth_buf + 48 - j;
SUM8P2(sum, -=, sum2, -=, w + 32, w2 + 32, p);
*samples = round_sample(&sum);
samples += incr;
sum += sum2;
*samples2 = round_sample(&sum);
samples2 -= incr;
w++;
w2--;
}
p = synth_buf + 32;
SUM8(sum, -=, w + 32, p);
*samples = round_sample(&sum);
*dither_state= sum;
offset = (offset - 32) & 511;
*synth_buf_offset = offset;
}
libavcodec/mpc.c:60: error: Buffer Overrun L2
Offset: [465+min(0, `c->synth_buf_offset[*]`), 480+max(511, `c->synth_buf_offset[*]`)] (⇐ [17+min(0, `c->synth_buf_offset[*]`), 32+max(511, `c->synth_buf_offset[*]`)] + 448) Size: 2 by call to `ff_mpa_synth_filter`.
libavcodec/mpc.c:51:1: Parameter `c->synth_buf[*]`
49. * Process decoded Musepack data and produce PCM
50. */
51. static void mpc_synth(MPCContext *c, int16_t *out)
^
52. {
53. int dither_state = 0;
libavcodec/mpc.c:60:13: Call
58. samples_ptr = samples + ch;
59. for(i = 0; i < SAMPLES_PER_BAND; i++) {
60. ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]),
^
61. mpa_window, &dither_state,
62. samples_ptr, 2,
libavcodec/mpegaudiodec.c:906:9: <Length trace>
904. /* we calculate two samples at the same time to avoid one memory
905. access per two sample */
906. for(j=1;j<16;j++) {
^
907. sum2 = 0;
908. p = synth_buf + 16 + j;
libavcodec/mpegaudiodec.c:906:9: Assignment
904. /* we calculate two samples at the same time to avoid one memory
905. access per two sample */
906. for(j=1;j<16;j++) {
^
907. sum2 = 0;
908. p = synth_buf + 16 + j;
libavcodec/mpegaudiodec.c:908:9: Assignment
906. for(j=1;j<16;j++) {
907. sum2 = 0;
908. p = synth_buf + 16 + j;
^
909. SUM8P2(sum, +=, sum2, -=, w, w2, p);
910. p = synth_buf + 48 - j;
libavcodec/mpegaudiodec.c:909:9: Array access: Offset: [465+min(0, c->synth_buf_offset[*]), 480+max(511, c->synth_buf_offset[*])] (⇐ [17+min(0, c->synth_buf_offset[*]), 32+max(511, c->synth_buf_offset[*])] + 448) Size: 2 by call to `ff_mpa_synth_filter`
907. sum2 = 0;
908. p = synth_buf + 16 + j;
909. SUM8P2(sum, +=, sum2, -=, w, w2, p);
^
910. p = synth_buf + 48 - j;
911. SUM8P2(sum, -=, sum2, -=, w + 32, w2 + 32, p);
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L909
|
d2a_code_trace_data_42105
|
static int spdif_header_aac(AVFormatContext *s, AVPacket *pkt)
{
IEC61937Context *ctx = s->priv_data;
AACADTSHeaderInfo hdr;
GetBitContext gbc;
int ret;
init_get_bits(&gbc, pkt->data, AAC_ADTS_HEADER_SIZE * 8);
ret = ff_aac_parse_header(&gbc, &hdr);
if (ret < 0) {
av_log(s, AV_LOG_ERROR, "Wrong AAC file format\n");
return AVERROR_INVALIDDATA;
}
ctx->pkt_offset = hdr.samples << 2;
switch (hdr.num_aac_frames) {
case 1:
ctx->data_type = IEC61937_MPEG2_AAC;
break;
case 2:
ctx->data_type = IEC61937_MPEG2_AAC_LSF_2048;
break;
case 4:
ctx->data_type = IEC61937_MPEG2_AAC_LSF_4096;
break;
default:
av_log(s, AV_LOG_ERROR, "%i samples in AAC frame not supported\n",
hdr.samples);
return AVERROR(EINVAL);
}
return 0;
}
libavformat/spdifenc.c:351: error: Null Dereference
pointer `&gbc->buffer` last assigned on line 350 could be null and is dereferenced by call to `ff_aac_parse_header()` at line 351, column 11.
libavformat/spdifenc.c:343:1: start of procedure spdif_header_aac()
341. }
342.
343. static int spdif_header_aac(AVFormatContext *s, AVPacket *pkt)
^
344. {
345. IEC61937Context *ctx = s->priv_data;
libavformat/spdifenc.c:345:5:
343. static int spdif_header_aac(AVFormatContext *s, AVPacket *pkt)
344. {
345. IEC61937Context *ctx = s->priv_data;
^
346. AACADTSHeaderInfo hdr;
347. GetBitContext gbc;
libavformat/spdifenc.c:350:5:
348. int ret;
349.
350. init_get_bits(&gbc, pkt->data, AAC_ADTS_HEADER_SIZE * 8);
^
351. ret = ff_aac_parse_header(&gbc, &hdr);
352. if (ret < 0) {
libavcodec/get_bits.h:391:1: start of procedure init_get_bits()
389. * responsible for checking for the buffer end yourself (take advantage of the padding)!
390. */
391. static inline void init_get_bits(GetBitContext *s,
^
392. const uint8_t *buffer, int bit_size)
393. {
libavcodec/get_bits.h:394:5:
392. const uint8_t *buffer, int bit_size)
393. {
394. int buffer_size = (bit_size+7)>>3;
^
395. if (buffer_size < 0 || bit_size < 0) {
396. buffer_size = bit_size = 0;
libavcodec/get_bits.h:395:9: Taking true branch
393. {
394. int buffer_size = (bit_size+7)>>3;
395. if (buffer_size < 0 || bit_size < 0) {
^
396. buffer_size = bit_size = 0;
397. buffer = NULL;
libavcodec/get_bits.h:396:9:
394. int buffer_size = (bit_size+7)>>3;
395. if (buffer_size < 0 || bit_size < 0) {
396. buffer_size = bit_size = 0;
^
397. buffer = NULL;
398. }
libavcodec/get_bits.h:397:9:
395. if (buffer_size < 0 || bit_size < 0) {
396. buffer_size = bit_size = 0;
397. buffer = NULL;
^
398. }
399.
libavcodec/get_bits.h:400:5:
398. }
399.
400. s->buffer = buffer;
^
401. s->size_in_bits = bit_size;
402. s->buffer_end = buffer + buffer_size;
libavcodec/get_bits.h:401:5:
399.
400. s->buffer = buffer;
401. s->size_in_bits = bit_size;
^
402. s->buffer_end = buffer + buffer_size;
403. #ifdef ALT_BITSTREAM_READER
libavcodec/get_bits.h:402:5:
400. s->buffer = buffer;
401. s->size_in_bits = bit_size;
402. s->buffer_end = buffer + buffer_size;
^
403. #ifdef ALT_BITSTREAM_READER
404. s->index = 0;
libavcodec/get_bits.h:404:5:
402. s->buffer_end = buffer + buffer_size;
403. #ifdef ALT_BITSTREAM_READER
404. s->index = 0;
^
405. #elif defined A32_BITSTREAM_READER
406. s->buffer_ptr = (uint32_t*)((intptr_t)buffer & ~3);
libavcodec/get_bits.h:410:1: return from a call to init_get_bits
408. skip_bits_long(s, 0);
409. #endif
410. }
^
411.
412. static inline void align_get_bits(GetBitContext *s)
libavformat/spdifenc.c:351:5:
349.
350. init_get_bits(&gbc, pkt->data, AAC_ADTS_HEADER_SIZE * 8);
351. ret = ff_aac_parse_header(&gbc, &hdr);
^
352. if (ret < 0) {
353. av_log(s, AV_LOG_ERROR, "Wrong AAC file format\n");
libavcodec/aacadtsdec.c:29:1: start of procedure ff_aac_parse_header()
27. #include "mpeg4audio.h"
28.
29. int ff_aac_parse_header(GetBitContext *gbc, AACADTSHeaderInfo *hdr)
^
30. {
31. int size, rdb, ch, sr;
libavcodec/aacadtsdec.c:34:8:
32. int aot, crc_abs;
33.
34. if(get_bits(gbc, 12) != 0xfff)
^
35. return AAC_AC3_PARSE_ERROR_SYNC;
36.
libavcodec/get_bits.h:282:1: start of procedure get_bits()
280. * Read 1-25 bits.
281. */
282. static inline unsigned int get_bits(GetBitContext *s, int n){
^
283. register int tmp;
284. OPEN_READER(re, s);
libavcodec/get_bits.h:284:5:
282. static inline unsigned int get_bits(GetBitContext *s, int n){
283. register int tmp;
284. OPEN_READER(re, s);
^
285. UPDATE_CACHE(re, s);
286. tmp = SHOW_UBITS(re, s, n);
libavcodec/get_bits.h:285:5:
283. register int tmp;
284. OPEN_READER(re, s);
285. UPDATE_CACHE(re, s);
^
286. tmp = SHOW_UBITS(re, s, n);
287. LAST_SKIP_BITS(re, s, n);
libavutil/bswap.h:66:1: start of procedure av_bswap32()
64.
65. #ifndef av_bswap32
66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
^
67. {
68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
libavutil/bswap.h:68:5:
66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
67. {
68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
^
69. x= (x>>16) | (x<<16);
70. return x;
libavutil/bswap.h:69:5:
67. {
68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
69. x= (x>>16) | (x<<16);
^
70. return x;
71. }
libavutil/bswap.h:70:5:
68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
69. x= (x>>16) | (x<<16);
70. return x;
^
71. }
72. #endif
libavutil/bswap.h:71:1: return from a call to av_bswap32
69. x= (x>>16) | (x<<16);
70. return x;
71. }
^
72. #endif
73.
libavcodec/get_bits.h:286:5:
284. OPEN_READER(re, s);
285. UPDATE_CACHE(re, s);
286. tmp = SHOW_UBITS(re, s, n);
^
287. LAST_SKIP_BITS(re, s, n);
288. CLOSE_READER(re, s);
libavcodec/get_bits.h:287:5:
285. UPDATE_CACHE(re, s);
286. tmp = SHOW_UBITS(re, s, n);
287. LAST_SKIP_BITS(re, s, n);
^
288. CLOSE_READER(re, s);
289. return tmp;
libavcodec/get_bits.h:288:5:
286. tmp = SHOW_UBITS(re, s, n);
287. LAST_SKIP_BITS(re, s, n);
288. CLOSE_READER(re, s);
^
289. return tmp;
290. }
libavcodec/get_bits.h:289:5:
287. LAST_SKIP_BITS(re, s, n);
288. CLOSE_READER(re, s);
289. return tmp;
^
290. }
291.
libavcodec/get_bits.h:290:1: return from a call to get_bits
288. CLOSE_READER(re, s);
289. return tmp;
290. }
^
291.
292. /**
libavcodec/aacadtsdec.c:34:8: Taking false branch
32. int aot, crc_abs;
33.
34. if(get_bits(gbc, 12) != 0xfff)
^
35. return AAC_AC3_PARSE_ERROR_SYNC;
36.
libavcodec/aacadtsdec.c:37:5:
35. return AAC_AC3_PARSE_ERROR_SYNC;
36.
37. skip_bits1(gbc); /* id */
^
38. skip_bits(gbc, 2); /* layer */
39. crc_abs = get_bits1(gbc); /* protection_absent */
libavcodec/get_bits.h:335:1: start of procedure skip_bits1()
333. }
334.
335. static inline void skip_bits1(GetBitContext *s){
^
336. skip_bits(s, 1);
337. }
libavcodec/get_bits.h:336:5:
334.
335. static inline void skip_bits1(GetBitContext *s){
336. skip_bits(s, 1);
^
337. }
338.
libavcodec/get_bits.h:303:1: start of procedure skip_bits()
301. }
302.
303. static inline void skip_bits(GetBitContext *s, int n){
^
304. //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
305. OPEN_READER(re, s);
libavcodec/get_bits.h:305:5:
303. static inline void skip_bits(GetBitContext *s, int n){
304. //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
305. OPEN_READER(re, s);
^
306. UPDATE_CACHE(re, s);
307. LAST_SKIP_BITS(re, s, n);
libavcodec/get_bits.h:306:5:
304. //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
305. OPEN_READER(re, s);
306. UPDATE_CACHE(re, s);
^
307. LAST_SKIP_BITS(re, s, n);
308. CLOSE_READER(re, s);
libavutil/bswap.h:66:1: start of procedure av_bswap32()
64.
65. #ifndef av_bswap32
66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
^
67. {
68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
libavutil/bswap.h:68:5:
66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
67. {
68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
^
69. x= (x>>16) | (x<<16);
70. return x;
libavutil/bswap.h:69:5:
67. {
68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
69. x= (x>>16) | (x<<16);
^
70. return x;
71. }
libavutil/bswap.h:70:5:
68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
69. x= (x>>16) | (x<<16);
70. return x;
^
71. }
72. #endif
libavutil/bswap.h:71:1: return from a call to av_bswap32
69. x= (x>>16) | (x<<16);
70. return x;
71. }
^
72. #endif
73.
libavcodec/get_bits.h:307:5:
305. OPEN_READER(re, s);
306. UPDATE_CACHE(re, s);
307. LAST_SKIP_BITS(re, s, n);
^
308. CLOSE_READER(re, s);
309. }
libavcodec/get_bits.h:308:5:
306. UPDATE_CACHE(re, s);
307. LAST_SKIP_BITS(re, s, n);
308. CLOSE_READER(re, s);
^
309. }
310.
libavcodec/get_bits.h:309:1: return from a call to skip_bits
307. LAST_SKIP_BITS(re, s, n);
308. CLOSE_READER(re, s);
309. }
^
310.
311. static inline unsigned int get_bits1(GetBitContext *s){
libavcodec/get_bits.h:337:1: return from a call to skip_bits1
335. static inline void skip_bits1(GetBitContext *s){
336. skip_bits(s, 1);
337. }
^
338.
339. /**
libavcodec/aacadtsdec.c:38:5:
36.
37. skip_bits1(gbc); /* id */
38. skip_bits(gbc, 2); /* layer */
^
39. crc_abs = get_bits1(gbc); /* protection_absent */
40. aot = get_bits(gbc, 2); /* profile_objecttype */
libavcodec/get_bits.h:303:1: start of procedure skip_bits()
301. }
302.
303. static inline void skip_bits(GetBitContext *s, int n){
^
304. //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
305. OPEN_READER(re, s);
libavcodec/get_bits.h:305:5:
303. static inline void skip_bits(GetBitContext *s, int n){
304. //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
305. OPEN_READER(re, s);
^
306. UPDATE_CACHE(re, s);
307. LAST_SKIP_BITS(re, s, n);
libavcodec/get_bits.h:306:5:
304. //Note gcc seems to optimize this to s->index+=n for the ALT_READER :))
305. OPEN_READER(re, s);
306. UPDATE_CACHE(re, s);
^
307. LAST_SKIP_BITS(re, s, n);
308. CLOSE_READER(re, s);
libavutil/bswap.h:66:1: start of procedure av_bswap32()
64.
65. #ifndef av_bswap32
66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
^
67. {
68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
libavutil/bswap.h:68:5:
66. static av_always_inline av_const uint32_t av_bswap32(uint32_t x)
67. {
68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
^
69. x= (x>>16) | (x<<16);
70. return x;
libavutil/bswap.h:69:5:
67. {
68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
69. x= (x>>16) | (x<<16);
^
70. return x;
71. }
libavutil/bswap.h:70:5:
68. x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF);
69. x= (x>>16) | (x<<16);
70. return x;
^
71. }
72. #endif
libavutil/bswap.h:71:1: return from a call to av_bswap32
69. x= (x>>16) | (x<<16);
70. return x;
71. }
^
72. #endif
73.
libavcodec/get_bits.h:307:5:
305. OPEN_READER(re, s);
306. UPDATE_CACHE(re, s);
307. LAST_SKIP_BITS(re, s, n);
^
308. CLOSE_READER(re, s);
309. }
libavcodec/get_bits.h:308:5:
306. UPDATE_CACHE(re, s);
307. LAST_SKIP_BITS(re, s, n);
308. CLOSE_READER(re, s);
^
309. }
310.
libavcodec/get_bits.h:309:1: return from a call to skip_bits
307. LAST_SKIP_BITS(re, s, n);
308. CLOSE_READER(re, s);
309. }
^
310.
311. static inline unsigned int get_bits1(GetBitContext *s){
libavcodec/aacadtsdec.c:39:5:
37. skip_bits1(gbc); /* id */
38. skip_bits(gbc, 2); /* layer */
39. crc_abs = get_bits1(gbc); /* protection_absent */
^
40. aot = get_bits(gbc, 2); /* profile_objecttype */
41. sr = get_bits(gbc, 4); /* sample_frequency_index */
libavcodec/get_bits.h:311:1: start of procedure get_bits1()
309. }
310.
311. static inline unsigned int get_bits1(GetBitContext *s){
^
312. #ifdef ALT_BITSTREAM_READER
313. unsigned int index = s->index;
libavcodec/get_bits.h:313:5:
311. static inline unsigned int get_bits1(GetBitContext *s){
312. #ifdef ALT_BITSTREAM_READER
313. unsigned int index = s->index;
^
314. uint8_t result = s->buffer[index>>3];
315. #ifdef ALT_BITSTREAM_READER_LE
libavcodec/get_bits.h:314:5:
312. #ifdef ALT_BITSTREAM_READER
313. unsigned int index = s->index;
314. uint8_t result = s->buffer[index>>3];
^
315. #ifdef ALT_BITSTREAM_READER_LE
316. result >>= index & 7;
|
https://github.com/libav/libav/blob/482d98f69b2eb7a7b0b5054101a43db384e9432b/libavformat/spdifenc.c/#L351
|
d2a_code_trace_data_42106
|
int ec_precompute_mont_data(EC_GROUP *group)
{
BN_CTX *ctx = BN_CTX_new();
int ret = 0;
BN_MONT_CTX_free(group->mont_data);
group->mont_data = NULL;
if (ctx == NULL)
goto err;
group->mont_data = BN_MONT_CTX_new();
if (group->mont_data == NULL)
goto err;
if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)) {
BN_MONT_CTX_free(group->mont_data);
group->mont_data = NULL;
goto err;
}
ret = 1;
err:
BN_CTX_free(ctx);
return ret;
}
crypto/ec/ec_lib.c:1010: error: MEMORY_LEAK
memory dynamically allocated to `group->mont_data` by call to `BN_MONT_CTX_new()` at line 1004, column 24 is not reachable after line 1010, column 9.
Showing all 66 steps of the trace
crypto/ec/ec_lib.c:993:1: start of procedure ec_precompute_mont_data()
991. * returns one on success. On error it returns zero.
992. */
993. > int ec_precompute_mont_data(EC_GROUP *group)
994. {
995. BN_CTX *ctx = BN_CTX_new();
crypto/ec/ec_lib.c:995:5: Skipping BN_CTX_new(): empty list of specs
993. int ec_precompute_mont_data(EC_GROUP *group)
994. {
995. BN_CTX *ctx = BN_CTX_new();
^
996. int ret = 0;
997.
crypto/ec/ec_lib.c:996:5:
994. {
995. BN_CTX *ctx = BN_CTX_new();
996. > int ret = 0;
997.
998. BN_MONT_CTX_free(group->mont_data);
crypto/ec/ec_lib.c:998:5: Skipping BN_MONT_CTX_free(): empty list of specs
996. int ret = 0;
997.
998. BN_MONT_CTX_free(group->mont_data);
^
999. group->mont_data = NULL;
1000.
crypto/ec/ec_lib.c:999:5:
997.
998. BN_MONT_CTX_free(group->mont_data);
999. > group->mont_data = NULL;
1000.
1001. if (ctx == NULL)
crypto/ec/ec_lib.c:1001:9: Taking false branch
999. group->mont_data = NULL;
1000.
1001. if (ctx == NULL)
^
1002. goto err;
1003.
crypto/ec/ec_lib.c:1004:5:
1002. goto err;
1003.
1004. > group->mont_data = BN_MONT_CTX_new();
1005. if (group->mont_data == NULL)
1006. goto err;
crypto/bn/bn_mont.c:314:1: start of procedure BN_MONT_CTX_new()
312. }
313.
314. > BN_MONT_CTX *BN_MONT_CTX_new(void)
315. {
316. BN_MONT_CTX *ret;
crypto/bn/bn_mont.c:318:9:
316. BN_MONT_CTX *ret;
317.
318. > if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
319. return (NULL);
320.
crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
117. }
118.
119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
120. {
121. void *ret = NULL;
crypto/mem.c:121:5:
119. void *CRYPTO_malloc(size_t num, const char *file, int line)
120. {
121. > void *ret = NULL;
122.
123. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
crypto/mem.c:123:9: Taking false branch
121. void *ret = NULL;
122.
123. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
124. return malloc_impl(num, file, line);
125.
crypto/mem.c:126:9: Taking false branch
124. return malloc_impl(num, file, line);
125.
126. if (num <= 0)
^
127. return NULL;
128.
crypto/mem.c:129:5:
127. return NULL;
128.
129. > allow_customize = 0;
130. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
131. if (call_malloc_debug) {
crypto/mem.c:139:5:
137. }
138. #else
139. > osslargused(file); osslargused(line);
140. ret = malloc(num);
141. #endif
crypto/mem.c:139:24:
137. }
138. #else
139. > osslargused(file); osslargused(line);
140. ret = malloc(num);
141. #endif
crypto/mem.c:140:5:
138. #else
139. osslargused(file); osslargused(line);
140. > ret = malloc(num);
141. #endif
142.
crypto/mem.c:143:5:
141. #endif
142.
143. > return ret;
144. }
145.
crypto/mem.c:144:1: return from a call to CRYPTO_malloc
142.
143. return ret;
144. > }
145.
146. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/bn/bn_mont.c:318:9: Taking false branch
316. BN_MONT_CTX *ret;
317.
318. if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
^
319. return (NULL);
320.
crypto/bn/bn_mont.c:321:5:
319. return (NULL);
320.
321. > BN_MONT_CTX_init(ret);
322. ret->flags = BN_FLG_MALLOCED;
323. return (ret);
crypto/bn/bn_mont.c:326:1: start of procedure BN_MONT_CTX_init()
324. }
325.
326. > void BN_MONT_CTX_init(BN_MONT_CTX *ctx)
327. {
328. ctx->ri = 0;
crypto/bn/bn_mont.c:328:5:
326. void BN_MONT_CTX_init(BN_MONT_CTX *ctx)
327. {
328. > ctx->ri = 0;
329. bn_init(&(ctx->RR));
330. bn_init(&(ctx->N));
crypto/bn/bn_mont.c:329:5: Skipping bn_init(): empty list of specs
327. {
328. ctx->ri = 0;
329. bn_init(&(ctx->RR));
^
330. bn_init(&(ctx->N));
331. bn_init(&(ctx->Ni));
crypto/bn/bn_mont.c:330:5: Skipping bn_init(): empty list of specs
328. ctx->ri = 0;
329. bn_init(&(ctx->RR));
330. bn_init(&(ctx->N));
^
331. bn_init(&(ctx->Ni));
332. ctx->n0[0] = ctx->n0[1] = 0;
crypto/bn/bn_mont.c:331:5: Skipping bn_init(): empty list of specs
329. bn_init(&(ctx->RR));
330. bn_init(&(ctx->N));
331. bn_init(&(ctx->Ni));
^
332. ctx->n0[0] = ctx->n0[1] = 0;
333. ctx->flags = 0;
crypto/bn/bn_mont.c:332:5:
330. bn_init(&(ctx->N));
331. bn_init(&(ctx->Ni));
332. > ctx->n0[0] = ctx->n0[1] = 0;
333. ctx->flags = 0;
334. }
crypto/bn/bn_mont.c:333:5:
331. bn_init(&(ctx->Ni));
332. ctx->n0[0] = ctx->n0[1] = 0;
333. > ctx->flags = 0;
334. }
335.
crypto/bn/bn_mont.c:334:1: return from a call to BN_MONT_CTX_init
332. ctx->n0[0] = ctx->n0[1] = 0;
333. ctx->flags = 0;
334. > }
335.
336. void BN_MONT_CTX_free(BN_MONT_CTX *mont)
crypto/bn/bn_mont.c:322:5:
320.
321. BN_MONT_CTX_init(ret);
322. > ret->flags = BN_FLG_MALLOCED;
323. return (ret);
324. }
crypto/bn/bn_mont.c:323:5:
321. BN_MONT_CTX_init(ret);
322. ret->flags = BN_FLG_MALLOCED;
323. > return (ret);
324. }
325.
crypto/bn/bn_mont.c:324:1: return from a call to BN_MONT_CTX_new
322. ret->flags = BN_FLG_MALLOCED;
323. return (ret);
324. > }
325.
326. void BN_MONT_CTX_init(BN_MONT_CTX *ctx)
crypto/ec/ec_lib.c:1005:9: Taking false branch
1003.
1004. group->mont_data = BN_MONT_CTX_new();
1005. if (group->mont_data == NULL)
^
1006. goto err;
1007.
crypto/ec/ec_lib.c:1008:10:
1006. goto err;
1007.
1008. > if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)) {
1009. BN_MONT_CTX_free(group->mont_data);
1010. group->mont_data = NULL;
crypto/bn/bn_mont.c:348:1: start of procedure BN_MONT_CTX_set()
346. }
347.
348. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
349. {
350. int ret = 0;
crypto/bn/bn_mont.c:350:5:
348. int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
349. {
350. > int ret = 0;
351. BIGNUM *Ri, *R;
352.
crypto/bn/bn_mont.c:353:9:
351. BIGNUM *Ri, *R;
352.
353. > if (BN_is_zero(mod))
354. return 0;
355.
crypto/bn/bn_lib.c:975:1: start of procedure BN_is_zero()
973. }
974.
975. > int BN_is_zero(const BIGNUM *a)
976. {
977. return a->top == 0;
crypto/bn/bn_lib.c:977:12: Condition is false
975. int BN_is_zero(const BIGNUM *a)
976. {
977. return a->top == 0;
^
978. }
979.
crypto/bn/bn_lib.c:977:5:
975. int BN_is_zero(const BIGNUM *a)
976. {
977. > return a->top == 0;
978. }
979.
crypto/bn/bn_lib.c:978:1: return from a call to BN_is_zero
976. {
977. return a->top == 0;
978. > }
979.
980. int BN_is_one(const BIGNUM *a)
crypto/bn/bn_mont.c:353:9: Taking false branch
351. BIGNUM *Ri, *R;
352.
353. if (BN_is_zero(mod))
^
354. return 0;
355.
crypto/bn/bn_mont.c:356:5:
354. return 0;
355.
356. > BN_CTX_start(ctx);
357. if ((Ri = BN_CTX_get(ctx)) == NULL)
358. goto err;
crypto/bn/bn_ctx.c:227:1: start of procedure BN_CTX_start()
225. }
226.
227. > void BN_CTX_start(BN_CTX *ctx)
228. {
229. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_ctx.c:231:9: Taking true branch
229. CTXDBG_ENTRY("BN_CTX_start", ctx);
230. /* If we're already overflowing ... */
231. if (ctx->err_stack || ctx->too_many)
^
232. ctx->err_stack++;
233. /* (Try to) get a new frame pointer */
crypto/bn/bn_ctx.c:232:9:
230. /* If we're already overflowing ... */
231. if (ctx->err_stack || ctx->too_many)
232. > ctx->err_stack++;
233. /* (Try to) get a new frame pointer */
234. else if (!BN_STACK_push(&ctx->stack, ctx->used)) {
crypto/bn/bn_ctx.c:231:5:
229. CTXDBG_ENTRY("BN_CTX_start", ctx);
230. /* If we're already overflowing ... */
231. > if (ctx->err_stack || ctx->too_many)
232. ctx->err_stack++;
233. /* (Try to) get a new frame pointer */
crypto/bn/bn_ctx.c:239:1: return from a call to BN_CTX_start
237. }
238. CTXDBG_EXIT(ctx);
239. > }
240.
241. void BN_CTX_end(BN_CTX *ctx)
crypto/bn/bn_mont.c:357:9:
355.
356. BN_CTX_start(ctx);
357. > if ((Ri = BN_CTX_get(ctx)) == NULL)
358. goto err;
359. R = &(mont->RR); /* grab RR as a temp */
crypto/bn/bn_ctx.c:258:1: start of procedure BN_CTX_get()
256. }
257.
258. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
259. {
260. BIGNUM *ret;
crypto/bn/bn_ctx.c:263:9: Taking true branch
261.
262. CTXDBG_ENTRY("BN_CTX_get", ctx);
263. if (ctx->err_stack || ctx->too_many)
^
264. return NULL;
265. if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) {
crypto/bn/bn_ctx.c:264:9:
262. CTXDBG_ENTRY("BN_CTX_get", ctx);
263. if (ctx->err_stack || ctx->too_many)
264. > return NULL;
265. if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) {
266. /*
crypto/bn/bn_ctx.c:279:1: return from a call to BN_CTX_get
277. CTXDBG_RET(ctx, ret);
278. return ret;
279. > }
280.
281. /************/
crypto/bn/bn_mont.c:357:9: Taking true branch
355.
356. BN_CTX_start(ctx);
357. if ((Ri = BN_CTX_get(ctx)) == NULL)
^
358. goto err;
359. R = &(mont->RR); /* grab RR as a temp */
crypto/bn/bn_mont.c:477:2:
475.
476. ret = 1;
477. > err:
478. BN_CTX_end(ctx);
479. return ret;
crypto/bn/bn_mont.c:478:5:
476. ret = 1;
477. err:
478. > BN_CTX_end(ctx);
479. return ret;
480. }
crypto/bn/bn_ctx.c:241:1: start of procedure BN_CTX_end()
239. }
240.
241. > void BN_CTX_end(BN_CTX *ctx)
242. {
243. CTXDBG_ENTRY("BN_CTX_end", ctx);
crypto/bn/bn_ctx.c:244:9: Taking true branch
242. {
243. CTXDBG_ENTRY("BN_CTX_end", ctx);
244. if (ctx->err_stack)
^
245. ctx->err_stack--;
246. else {
crypto/bn/bn_ctx.c:245:9:
243. CTXDBG_ENTRY("BN_CTX_end", ctx);
244. if (ctx->err_stack)
245. > ctx->err_stack--;
246. else {
247. unsigned int fp = BN_STACK_pop(&ctx->stack);
crypto/bn/bn_ctx.c:244:5:
242. {
243. CTXDBG_ENTRY("BN_CTX_end", ctx);
244. > if (ctx->err_stack)
245. ctx->err_stack--;
246. else {
crypto/bn/bn_ctx.c:256:1: return from a call to BN_CTX_end
254. }
255. CTXDBG_EXIT(ctx);
256. > }
257.
258. BIGNUM *BN_CTX_get(BN_CTX *ctx)
crypto/bn/bn_mont.c:479:5:
477. err:
478. BN_CTX_end(ctx);
479. > return ret;
480. }
481.
crypto/bn/bn_mont.c:480:1: return from a call to BN_MONT_CTX_set
478. BN_CTX_end(ctx);
479. return ret;
480. > }
481.
482. BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from)
crypto/ec/ec_lib.c:1008:10: Taking true branch
1006. goto err;
1007.
1008. if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)) {
^
1009. BN_MONT_CTX_free(group->mont_data);
1010. group->mont_data = NULL;
crypto/ec/ec_lib.c:1009:9: Skipping BN_MONT_CTX_free(): empty list of specs
1007.
1008. if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)) {
1009. BN_MONT_CTX_free(group->mont_data);
^
1010. group->mont_data = NULL;
1011. goto err;
crypto/ec/ec_lib.c:1010:9:
1008. if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)) {
1009. BN_MONT_CTX_free(group->mont_data);
1010. > group->mont_data = NULL;
1011. goto err;
1012. }
|
https://github.com/openssl/openssl/blob/6ea04154dc17c37083717d8a8bb86f4bc9f0dee5/crypto/ec/ec_lib.c/#L1010
|
d2a_code_trace_data_42107
|
int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
size_t num, const EC_POINT *points[], const BIGNUM *scalars[],
BN_CTX *ctx)
{
BN_CTX *new_ctx = NULL;
const EC_POINT *generator = NULL;
EC_POINT *tmp = NULL;
size_t totalnum;
size_t blocksize = 0, numblocks = 0;
size_t pre_points_per_block = 0;
size_t i, j;
int k;
int r_is_inverted = 0;
int r_is_at_infinity = 1;
size_t *wsize = NULL;
signed char **wNAF = NULL;
size_t *wNAF_len = NULL;
size_t max_len = 0;
size_t num_val;
EC_POINT **val = NULL;
EC_POINT **v;
EC_POINT ***val_sub = NULL;
const EC_PRE_COMP *pre_comp = NULL;
int num_scalar = 0;
int ret = 0;
if (group->meth != r->meth) {
ECerr(EC_F_EC_WNAF_MUL, EC_R_INCOMPATIBLE_OBJECTS);
return 0;
}
if ((scalar == NULL) && (num == 0)) {
return EC_POINT_set_to_infinity(group, r);
}
for (i = 0; i < num; i++) {
if (group->meth != points[i]->meth) {
ECerr(EC_F_EC_WNAF_MUL, EC_R_INCOMPATIBLE_OBJECTS);
return 0;
}
}
if (ctx == NULL) {
ctx = new_ctx = BN_CTX_new();
if (ctx == NULL)
goto err;
}
if (scalar != NULL) {
generator = EC_GROUP_get0_generator(group);
if (generator == NULL) {
ECerr(EC_F_EC_WNAF_MUL, EC_R_UNDEFINED_GENERATOR);
goto err;
}
pre_comp = group->pre_comp.ec;
if (pre_comp && pre_comp->numblocks
&& (EC_POINT_cmp(group, generator, pre_comp->points[0], ctx) ==
0)) {
blocksize = pre_comp->blocksize;
numblocks = (BN_num_bits(scalar) / blocksize) + 1;
if (numblocks > pre_comp->numblocks)
numblocks = pre_comp->numblocks;
pre_points_per_block = (size_t)1 << (pre_comp->w - 1);
if (pre_comp->num != (pre_comp->numblocks * pre_points_per_block)) {
ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR);
goto err;
}
} else {
pre_comp = NULL;
numblocks = 1;
num_scalar = 1;
}
}
totalnum = num + numblocks;
wsize = OPENSSL_malloc(totalnum * sizeof wsize[0]);
wNAF_len = OPENSSL_malloc(totalnum * sizeof wNAF_len[0]);
wNAF = OPENSSL_malloc((totalnum + 1) * sizeof wNAF[0]);
val_sub = OPENSSL_malloc(totalnum * sizeof val_sub[0]);
if (wNAF != NULL)
wNAF[0] = NULL;
if (wsize == NULL || wNAF_len == NULL || wNAF == NULL || val_sub == NULL) {
ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE);
goto err;
}
num_val = 0;
for (i = 0; i < num + num_scalar; i++) {
size_t bits;
bits = i < num ? BN_num_bits(scalars[i]) : BN_num_bits(scalar);
wsize[i] = EC_window_bits_for_scalar_size(bits);
num_val += (size_t)1 << (wsize[i] - 1);
wNAF[i + 1] = NULL;
wNAF[i] =
bn_compute_wNAF((i < num ? scalars[i] : scalar), wsize[i],
&wNAF_len[i]);
if (wNAF[i] == NULL)
goto err;
if (wNAF_len[i] > max_len)
max_len = wNAF_len[i];
}
if (numblocks) {
if (pre_comp == NULL) {
if (num_scalar != 1) {
ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR);
goto err;
}
} else {
signed char *tmp_wNAF = NULL;
size_t tmp_len = 0;
if (num_scalar != 0) {
ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR);
goto err;
}
wsize[num] = pre_comp->w;
tmp_wNAF = bn_compute_wNAF(scalar, wsize[num], &tmp_len);
if (!tmp_wNAF)
goto err;
if (tmp_len <= max_len) {
numblocks = 1;
totalnum = num + 1;
wNAF[num] = tmp_wNAF;
wNAF[num + 1] = NULL;
wNAF_len[num] = tmp_len;
val_sub[num] = pre_comp->points;
} else {
signed char *pp;
EC_POINT **tmp_points;
if (tmp_len < numblocks * blocksize) {
numblocks = (tmp_len + blocksize - 1) / blocksize;
if (numblocks > pre_comp->numblocks) {
ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR);
OPENSSL_free(tmp_wNAF);
goto err;
}
totalnum = num + numblocks;
}
pp = tmp_wNAF;
tmp_points = pre_comp->points;
for (i = num; i < totalnum; i++) {
if (i < totalnum - 1) {
wNAF_len[i] = blocksize;
if (tmp_len < blocksize) {
ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR);
OPENSSL_free(tmp_wNAF);
goto err;
}
tmp_len -= blocksize;
} else
wNAF_len[i] = tmp_len;
wNAF[i + 1] = NULL;
wNAF[i] = OPENSSL_malloc(wNAF_len[i]);
if (wNAF[i] == NULL) {
ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE);
OPENSSL_free(tmp_wNAF);
goto err;
}
memcpy(wNAF[i], pp, wNAF_len[i]);
if (wNAF_len[i] > max_len)
max_len = wNAF_len[i];
if (*tmp_points == NULL) {
ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR);
OPENSSL_free(tmp_wNAF);
goto err;
}
val_sub[i] = tmp_points;
tmp_points += pre_points_per_block;
pp += blocksize;
}
OPENSSL_free(tmp_wNAF);
}
}
}
val = OPENSSL_malloc((num_val + 1) * sizeof val[0]);
if (val == NULL) {
ECerr(EC_F_EC_WNAF_MUL, ERR_R_MALLOC_FAILURE);
goto err;
}
val[num_val] = NULL;
v = val;
for (i = 0; i < num + num_scalar; i++) {
val_sub[i] = v;
for (j = 0; j < ((size_t)1 << (wsize[i] - 1)); j++) {
*v = EC_POINT_new(group);
if (*v == NULL)
goto err;
v++;
}
}
if (!(v == val + num_val)) {
ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR);
goto err;
}
if ((tmp = EC_POINT_new(group)) == NULL)
goto err;
for (i = 0; i < num + num_scalar; i++) {
if (i < num) {
if (!EC_POINT_copy(val_sub[i][0], points[i]))
goto err;
} else {
if (!EC_POINT_copy(val_sub[i][0], generator))
goto err;
}
if (wsize[i] > 1) {
if (!EC_POINT_dbl(group, tmp, val_sub[i][0], ctx))
goto err;
for (j = 1; j < ((size_t)1 << (wsize[i] - 1)); j++) {
if (!EC_POINT_add
(group, val_sub[i][j], val_sub[i][j - 1], tmp, ctx))
goto err;
}
}
}
if (!EC_POINTs_make_affine(group, num_val, val, ctx))
goto err;
r_is_at_infinity = 1;
for (k = max_len - 1; k >= 0; k--) {
if (!r_is_at_infinity) {
if (!EC_POINT_dbl(group, r, r, ctx))
goto err;
}
for (i = 0; i < totalnum; i++) {
if (wNAF_len[i] > (size_t)k) {
int digit = wNAF[i][k];
int is_neg;
if (digit) {
is_neg = digit < 0;
if (is_neg)
digit = -digit;
if (is_neg != r_is_inverted) {
if (!r_is_at_infinity) {
if (!EC_POINT_invert(group, r, ctx))
goto err;
}
r_is_inverted = !r_is_inverted;
}
if (r_is_at_infinity) {
if (!EC_POINT_copy(r, val_sub[i][digit >> 1]))
goto err;
r_is_at_infinity = 0;
} else {
if (!EC_POINT_add
(group, r, r, val_sub[i][digit >> 1], ctx))
goto err;
}
}
}
}
}
if (r_is_at_infinity) {
if (!EC_POINT_set_to_infinity(group, r))
goto err;
} else {
if (r_is_inverted)
if (!EC_POINT_invert(group, r, ctx))
goto err;
}
ret = 1;
err:
BN_CTX_free(new_ctx);
EC_POINT_free(tmp);
OPENSSL_free(wsize);
OPENSSL_free(wNAF_len);
if (wNAF != NULL) {
signed char **w;
for (w = wNAF; *w != NULL; w++)
OPENSSL_free(*w);
OPENSSL_free(wNAF);
}
if (val != NULL) {
for (v = val; *v != NULL; v++)
EC_POINT_clear_free(*v);
OPENSSL_free(val);
}
OPENSSL_free(val_sub);
return ret;
}
test/ectest.c:619: error: BUFFER_OVERRUN_L3
Offset: [2, +oo] Size: [0, +oo] by call to `EC_POINTs_mul`.
Showing all 13 steps of the trace
test/ectest.c:619:10: Call
617.
618. /* z is still the group order */
619. if (!TEST_true(EC_POINTs_mul(group, P, NULL, 2, points, scalars, ctx))
^
620. || !TEST_true(EC_POINTs_mul(group, R, z, 2, points, scalars, ctx))
621. || !TEST_int_eq(0, EC_POINT_cmp(group, P, R, ctx))
crypto/ec/ec_lib.c:914:1: Parameter `num`
912. */
913.
914. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
915. size_t num, const EC_POINT *points[],
916. const BIGNUM *scalars[], BN_CTX *ctx)
crypto/ec/ec_lib.c:920:16: Call
918. if (group->meth->mul == 0)
919. /* use default */
920. return ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx);
^
921.
922. return group->meth->mul(group, r, scalar, num, points, scalars, ctx);
crypto/ec/ec_mult.c:129:1: <Offset trace>
127. * in the addition if scalar != NULL
128. */
129. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
130. size_t num, const EC_POINT *points[], const BIGNUM *scalars[],
131. BN_CTX *ctx)
crypto/ec/ec_mult.c:129:1: Parameter `num`
127. * in the addition if scalar != NULL
128. */
129. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
130. size_t num, const EC_POINT *points[], const BIGNUM *scalars[],
131. BN_CTX *ctx)
crypto/ec/ec_mult.c:223:5: Assignment
221. }
222.
223. totalnum = num + numblocks;
^
224.
225. wsize = OPENSSL_malloc(totalnum * sizeof wsize[0]);
crypto/ec/ec_mult.c:129:1: <Length trace>
127. * in the addition if scalar != NULL
128. */
129. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
130. size_t num, const EC_POINT *points[], const BIGNUM *scalars[],
131. BN_CTX *ctx)
crypto/ec/ec_mult.c:129:1: Parameter `num`
127. * in the addition if scalar != NULL
128. */
129. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar,
130. size_t num, const EC_POINT *points[], const BIGNUM *scalars[],
131. BN_CTX *ctx)
crypto/ec/ec_mult.c:223:5: Assignment
221. }
222.
223. totalnum = num + numblocks;
^
224.
225. wsize = OPENSSL_malloc(totalnum * sizeof wsize[0]);
crypto/ec/ec_mult.c:226:16: Call
224.
225. wsize = OPENSSL_malloc(totalnum * sizeof wsize[0]);
226. wNAF_len = OPENSSL_malloc(totalnum * sizeof wNAF_len[0]);
^
227. wNAF = OPENSSL_malloc((totalnum + 1) * sizeof wNAF[0]); /* includes space
228. * for pivot */
crypto/mem.c:166:9: Assignment
164.
165. if (num == 0)
166. return NULL;
^
167.
168. FAILTEST();
crypto/ec/ec_mult.c:226:5: Assignment
224.
225. wsize = OPENSSL_malloc(totalnum * sizeof wsize[0]);
226. wNAF_len = OPENSSL_malloc(totalnum * sizeof wNAF_len[0]);
^
227. wNAF = OPENSSL_malloc((totalnum + 1) * sizeof wNAF[0]); /* includes space
228. * for pivot */
crypto/ec/ec_mult.c:331:25: Array access: Offset: [2, +oo] Size: [0, +oo] by call to `EC_POINTs_mul`
329. for (i = num; i < totalnum; i++) {
330. if (i < totalnum - 1) {
331. wNAF_len[i] = blocksize;
^
332. if (tmp_len < blocksize) {
333. ECerr(EC_F_EC_WNAF_MUL, ERR_R_INTERNAL_ERROR);
|
https://github.com/openssl/openssl/blob/7671342e550ed2de676b23c79d0e7f45a381c76e/crypto/ec/ec_mult.c/#L331
|
d2a_code_trace_data_42108
|
static DSA_SIG * surewarehk_dsa_do_sign(const unsigned char *from, int flen, DSA *dsa)
{
int ret=0;
char *hptr=NULL;
DSA_SIG *psign=NULL;
char msg[64]="ENGINE_dsa_do_sign";
if (!p_surewarehk_Dsa_Sign)
{
SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,ENGINE_R_NOT_INITIALISED);
}
else if (!(hptr=DSA_get_ex_data(dsa, dsaHndidx)))
{
SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,SUREWARE_R_MISSING_KEY_COMPONENTS);
}
else
{
if((psign = DSA_SIG_new()) == NULL)
{
SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,ERR_R_MALLOC_FAILURE);
goto err;
}
psign->r=BN_new();
psign->s=BN_new();
bn_expand2(psign->r, 20/sizeof(BN_ULONG));
bn_expand2(psign->s, 20/sizeof(BN_ULONG));
if (!psign->r || psign->r->dmax!=20/sizeof(BN_ULONG) ||
!psign->s || psign->s->dmax!=20/sizeof(BN_ULONG))
goto err;
ret=p_surewarehk_Dsa_Sign(msg,flen,from,psign->r->d,psign->s->d,hptr);
surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,ret);
}
psign->r->top=20/sizeof(BN_ULONG);
bn_fix_top(psign->r);
psign->s->top=20/sizeof(BN_ULONG);
bn_fix_top(psign->s);
err:
if (psign)
{
DSA_SIG_free(psign);
psign=NULL;
}
return psign;
}
crypto/engine/hw_sureware.c:985: error: NULL_DEREFERENCE
pointer `psign` last assigned on line 957 could be null and is dereferenced at line 985, column 2.
Showing all 50 steps of the trace
crypto/engine/hw_sureware.c:953:1: start of procedure surewarehk_dsa_do_sign()
951. #ifndef OPENSSL_NO_DSA
952. /* DSA sign and verify */
953. > static DSA_SIG * surewarehk_dsa_do_sign(const unsigned char *from, int flen, DSA *dsa)
954. {
955. int ret=0;
crypto/engine/hw_sureware.c:955:2:
953. static DSA_SIG * surewarehk_dsa_do_sign(const unsigned char *from, int flen, DSA *dsa)
954. {
955. > int ret=0;
956. char *hptr=NULL;
957. DSA_SIG *psign=NULL;
crypto/engine/hw_sureware.c:956:2:
954. {
955. int ret=0;
956. > char *hptr=NULL;
957. DSA_SIG *psign=NULL;
958. char msg[64]="ENGINE_dsa_do_sign";
crypto/engine/hw_sureware.c:957:2:
955. int ret=0;
956. char *hptr=NULL;
957. > DSA_SIG *psign=NULL;
958. char msg[64]="ENGINE_dsa_do_sign";
959. if (!p_surewarehk_Dsa_Sign)
crypto/engine/hw_sureware.c:958:2:
956. char *hptr=NULL;
957. DSA_SIG *psign=NULL;
958. > char msg[64]="ENGINE_dsa_do_sign";
959. if (!p_surewarehk_Dsa_Sign)
960. {
crypto/engine/hw_sureware.c:959:7: Taking false branch
957. DSA_SIG *psign=NULL;
958. char msg[64]="ENGINE_dsa_do_sign";
959. if (!p_surewarehk_Dsa_Sign)
^
960. {
961. SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,ENGINE_R_NOT_INITIALISED);
crypto/engine/hw_sureware.c:964:13:
962. }
963. /* extract ref to private key */
964. > else if (!(hptr=DSA_get_ex_data(dsa, dsaHndidx)))
965. {
966. SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,SUREWARE_R_MISSING_KEY_COMPONENTS);
crypto/dsa/dsa_lib.c:254:1: start of procedure DSA_get_ex_data()
252. }
253.
254. > void *DSA_get_ex_data(DSA *d, int idx)
255. {
256. return(CRYPTO_get_ex_data(&d->ex_data,idx));
crypto/dsa/dsa_lib.c:256:2:
254. void *DSA_get_ex_data(DSA *d, int idx)
255. {
256. > return(CRYPTO_get_ex_data(&d->ex_data,idx));
257. }
258.
crypto/ex_data.c:626:1: start of procedure CRYPTO_get_ex_data()
624. /* For a given CRYPTO_EX_DATA_ variable, get the value corresponding to a
625. * particular index in the class used by this variable */
626. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
627. {
628. if (ad->sk == NULL)
crypto/ex_data.c:628:6: Taking false branch
626. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx)
627. {
628. if (ad->sk == NULL)
^
629. return(0);
630. else if (idx >= sk_num(ad->sk))
crypto/ex_data.c:630:11:
628. if (ad->sk == NULL)
629. return(0);
630. > else if (idx >= sk_num(ad->sk))
631. return(0);
632. else
crypto/stack/stack.c:301:1: start of procedure sk_num()
299. }
300.
301. > int sk_num(const STACK *st)
302. {
303. if(st == NULL) return -1;
crypto/stack/stack.c:303:5: Taking false branch
301. int sk_num(const STACK *st)
302. {
303. if(st == NULL) return -1;
^
304. return st->num;
305. }
crypto/stack/stack.c:304:2:
302. {
303. if(st == NULL) return -1;
304. > return st->num;
305. }
306.
crypto/stack/stack.c:305:1: return from a call to sk_num
303. if(st == NULL) return -1;
304. return st->num;
305. > }
306.
307. char *sk_value(const STACK *st, int i)
crypto/ex_data.c:630:11: Taking false branch
628. if (ad->sk == NULL)
629. return(0);
630. else if (idx >= sk_num(ad->sk))
^
631. return(0);
632. else
crypto/ex_data.c:633:3:
631. return(0);
632. else
633. > return(sk_value(ad->sk,idx));
634. }
635.
crypto/stack/stack.c:307:1: start of procedure sk_value()
305. }
306.
307. > char *sk_value(const STACK *st, int i)
308. {
309. if(st == NULL) return NULL;
crypto/stack/stack.c:309:5: Taking false branch
307. char *sk_value(const STACK *st, int i)
308. {
309. if(st == NULL) return NULL;
^
310. return st->data[i];
311. }
crypto/stack/stack.c:310:2:
308. {
309. if(st == NULL) return NULL;
310. > return st->data[i];
311. }
312.
crypto/stack/stack.c:311:1: return from a call to sk_value
309. if(st == NULL) return NULL;
310. return st->data[i];
311. > }
312.
313. char *sk_set(STACK *st, int i, char *value)
crypto/ex_data.c:634:2: return from a call to CRYPTO_get_ex_data
632. else
633. return(sk_value(ad->sk,idx));
634. }
^
635.
636. IMPLEMENT_STACK_OF(CRYPTO_EX_DATA_FUNCS)
crypto/dsa/dsa_lib.c:257:2: return from a call to DSA_get_ex_data
255. {
256. return(CRYPTO_get_ex_data(&d->ex_data,idx));
257. }
^
258.
259. #ifndef OPENSSL_NO_DH
crypto/engine/hw_sureware.c:964:13: Taking true branch
962. }
963. /* extract ref to private key */
964. else if (!(hptr=DSA_get_ex_data(dsa, dsaHndidx)))
^
965. {
966. SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,SUREWARE_R_MISSING_KEY_COMPONENTS);
crypto/engine/hw_sureware.c:966:3:
964. else if (!(hptr=DSA_get_ex_data(dsa, dsaHndidx)))
965. {
966. > SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,SUREWARE_R_MISSING_KEY_COMPONENTS);
967. }
968. else
crypto/engine/hw_sureware_err.c:145:1: start of procedure ERR_SUREWARE_error()
143. }
144.
145. > static void ERR_SUREWARE_error(int function, int reason, char *file, int line)
146. {
147. if (SUREWARE_lib_error_code == 0)
crypto/engine/hw_sureware_err.c:147:6: Taking true branch
145. static void ERR_SUREWARE_error(int function, int reason, char *file, int line)
146. {
147. if (SUREWARE_lib_error_code == 0)
^
148. SUREWARE_lib_error_code=ERR_get_next_error_library();
149. ERR_PUT_error(SUREWARE_lib_error_code,function,reason,file,line);
crypto/engine/hw_sureware_err.c:148:3:
146. {
147. if (SUREWARE_lib_error_code == 0)
148. > SUREWARE_lib_error_code=ERR_get_next_error_library();
149. ERR_PUT_error(SUREWARE_lib_error_code,function,reason,file,line);
150. }
crypto/err/err.c:971:1: start of procedure ERR_get_next_error_library()
969. }
970.
971. > int ERR_get_next_error_library(void)
972. {
973. err_fns_check();
crypto/err/err.c:973:2:
971. int ERR_get_next_error_library(void)
972. {
973. > err_fns_check();
974. return ERRFN(get_next_lib)();
975. }
crypto/err/err.c:276:1: start of procedure err_fns_check()
274. /* Internal function that checks whether "err_fns" is set and if not, sets it to
275. * the defaults. */
276. > static void err_fns_check(void)
277. {
278. if (err_fns) return;
crypto/err/err.c:278:6: Taking true branch
276. static void err_fns_check(void)
277. {
278. if (err_fns) return;
^
279.
280. CRYPTO_w_lock(CRYPTO_LOCK_ERR);
crypto/err/err.c:278:15:
276. static void err_fns_check(void)
277. {
278. > if (err_fns) return;
279.
280. CRYPTO_w_lock(CRYPTO_LOCK_ERR);
crypto/err/err.c:284:2: return from a call to err_fns_check
282. err_fns = &err_defaults;
283. CRYPTO_w_unlock(CRYPTO_LOCK_ERR);
284. }
^
285.
286. /* API functions to get or set the underlying ERR functions. */
crypto/err/err.c:974:2: Skipping __function_pointer__(): unresolved function pointer
972. {
973. err_fns_check();
974. return ERRFN(get_next_lib)();
^
975. }
976.
crypto/err/err.c:975:2: return from a call to ERR_get_next_error_library
973. err_fns_check();
974. return ERRFN(get_next_lib)();
975. }
^
976.
977. void ERR_set_error_data(char *data, int flags)
crypto/engine/hw_sureware_err.c:149:2:
147. if (SUREWARE_lib_error_code == 0)
148. SUREWARE_lib_error_code=ERR_get_next_error_library();
149. > ERR_PUT_error(SUREWARE_lib_error_code,function,reason,file,line);
150. }
crypto/err/err.c:615:1: start of procedure ERR_put_error()
613. /********************************************************/
614.
615. > void ERR_put_error(int lib, int func, int reason, const char *file,
616. int line)
617. {
crypto/err/err.c:639:2: Skipping ERR_get_state(): empty list of specs
637. }
638. #endif
639. es=ERR_get_state();
^
640.
641. es->top=(es->top+1)%ERR_NUM_ERRORS;
crypto/err/err.c:641:2:
639. es=ERR_get_state();
640.
641. > es->top=(es->top+1)%ERR_NUM_ERRORS;
642. if (es->top == es->bottom)
643. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
crypto/err/err.c:642:6: Taking false branch
640.
641. es->top=(es->top+1)%ERR_NUM_ERRORS;
642. if (es->top == es->bottom)
^
643. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
644. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
crypto/err/err.c:644:2:
642. if (es->top == es->bottom)
643. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
644. > es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
645. es->err_file[es->top]=file;
646. es->err_line[es->top]=line;
crypto/err/err.c:645:2:
643. es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
644. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
645. > es->err_file[es->top]=file;
646. es->err_line[es->top]=line;
647. err_clear_data(es,es->top);
crypto/err/err.c:646:2:
644. es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
645. es->err_file[es->top]=file;
646. > es->err_line[es->top]=line;
647. err_clear_data(es,es->top);
648. }
crypto/err/err.c:647:2: Taking true branch
645. es->err_file[es->top]=file;
646. es->err_line[es->top]=line;
647. err_clear_data(es,es->top);
^
648. }
649.
crypto/err/err.c:647:2: Taking false branch
645. es->err_file[es->top]=file;
646. es->err_line[es->top]=line;
647. err_clear_data(es,es->top);
^
648. }
649.
crypto/err/err.c:648:2: return from a call to ERR_put_error
646. es->err_line[es->top]=line;
647. err_clear_data(es,es->top);
648. }
^
649.
650. void ERR_clear_error(void)
crypto/engine/hw_sureware_err.c:150:2: return from a call to ERR_SUREWARE_error
148. SUREWARE_lib_error_code=ERR_get_next_error_library();
149. ERR_PUT_error(SUREWARE_lib_error_code,function,reason,file,line);
150. }
^
crypto/engine/hw_sureware.c:985:2:
983. surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,ret);
984. }
985. > psign->r->top=20/sizeof(BN_ULONG);
986. bn_fix_top(psign->r);
987. psign->s->top=20/sizeof(BN_ULONG);
|
https://github.com/openssl/openssl/blob/85b7b80434d4468ed95f5c0360ebb445a96b4943/crypto/engine/hw_sureware.c/#L985
|
d2a_code_trace_data_42109
|
u_char *
ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args)
{
u_char *p, zero, *last;
int d;
float f, scale;
size_t len, slen;
int64_t i64;
uint64_t ui64;
ngx_msec_t ms;
ngx_uint_t width, sign, hex, max_width, frac_width, i;
ngx_str_t *v;
ngx_variable_value_t *vv;
if (max == 0) {
return buf;
}
last = buf + max;
while (*fmt && buf < last) {
if (*fmt == '%') {
i64 = 0;
ui64 = 0;
zero = (u_char) ((*++fmt == '0') ? '0' : ' ');
width = 0;
sign = 1;
hex = 0;
max_width = 0;
frac_width = 0;
slen = (size_t) -1;
while (*fmt >= '0' && *fmt <= '9') {
width = width * 10 + *fmt++ - '0';
}
for ( ;; ) {
switch (*fmt) {
case 'u':
sign = 0;
fmt++;
continue;
case 'm':
max_width = 1;
fmt++;
continue;
case 'X':
hex = 2;
sign = 0;
fmt++;
continue;
case 'x':
hex = 1;
sign = 0;
fmt++;
continue;
case '.':
fmt++;
while (*fmt >= '0' && *fmt <= '9') {
frac_width = frac_width * 10 + *fmt++ - '0';
}
break;
case '*':
slen = va_arg(args, size_t);
fmt++;
continue;
default:
break;
}
break;
}
switch (*fmt) {
case 'V':
v = va_arg(args, ngx_str_t *);
len = v->len;
len = (buf + len < last) ? len : (size_t) (last - buf);
buf = ngx_cpymem(buf, v->data, len);
fmt++;
continue;
case 'v':
vv = va_arg(args, ngx_variable_value_t *);
len = vv->len;
len = (buf + len < last) ? len : (size_t) (last - buf);
buf = ngx_cpymem(buf, vv->data, len);
fmt++;
continue;
case 's':
p = va_arg(args, u_char *);
if (slen == (size_t) -1) {
while (*p && buf < last) {
*buf++ = *p++;
}
} else {
len = (buf + slen < last) ? slen : (size_t) (last - buf);
buf = ngx_cpymem(buf, p, len);
}
fmt++;
continue;
case 'O':
i64 = (int64_t) va_arg(args, off_t);
sign = 1;
break;
case 'P':
i64 = (int64_t) va_arg(args, ngx_pid_t);
sign = 1;
break;
case 'T':
i64 = (int64_t) va_arg(args, time_t);
sign = 1;
break;
case 'M':
ms = (ngx_msec_t) va_arg(args, ngx_msec_t);
if ((ngx_msec_int_t) ms == -1) {
sign = 1;
i64 = -1;
} else {
sign = 0;
ui64 = (uint64_t) ms;
}
break;
case 'z':
if (sign) {
i64 = (int64_t) va_arg(args, ssize_t);
} else {
ui64 = (uint64_t) va_arg(args, size_t);
}
break;
case 'i':
if (sign) {
i64 = (int64_t) va_arg(args, ngx_int_t);
} else {
ui64 = (uint64_t) va_arg(args, ngx_uint_t);
}
if (max_width) {
width = NGX_INT_T_LEN;
}
break;
case 'd':
if (sign) {
i64 = (int64_t) va_arg(args, int);
} else {
ui64 = (uint64_t) va_arg(args, u_int);
}
break;
case 'l':
if (sign) {
i64 = (int64_t) va_arg(args, long);
} else {
ui64 = (uint64_t) va_arg(args, u_long);
}
break;
case 'D':
if (sign) {
i64 = (int64_t) va_arg(args, int32_t);
} else {
ui64 = (uint64_t) va_arg(args, uint32_t);
}
break;
case 'L':
if (sign) {
i64 = va_arg(args, int64_t);
} else {
ui64 = va_arg(args, uint64_t);
}
break;
case 'A':
if (sign) {
i64 = (int64_t) va_arg(args, ngx_atomic_int_t);
} else {
ui64 = (uint64_t) va_arg(args, ngx_atomic_uint_t);
}
if (max_width) {
width = NGX_ATOMIC_T_LEN;
}
break;
case 'f':
f = (float) va_arg(args, double);
if (f < 0) {
*buf++ = '-';
f = -f;
}
ui64 = (int64_t) f;
buf = ngx_sprintf_num(buf, last, ui64, zero, 0, width);
if (frac_width) {
if (buf < last) {
*buf++ = '.';
}
scale = 1.0;
for (i = 0; i < frac_width; i++) {
scale *= 10.0;
}
ui64 = (uint64_t) ((f - (int64_t) ui64) * scale);
buf = ngx_sprintf_num(buf, last, ui64, '0', 0, frac_width);
}
fmt++;
continue;
#if !(NGX_WIN32)
case 'r':
i64 = (int64_t) va_arg(args, rlim_t);
sign = 1;
break;
#endif
case 'p':
ui64 = (uintptr_t) va_arg(args, void *);
hex = 2;
sign = 0;
zero = '0';
width = NGX_PTR_SIZE * 2;
break;
case 'c':
d = va_arg(args, int);
*buf++ = (u_char) (d & 0xff);
fmt++;
continue;
case 'Z':
*buf++ = '\0';
fmt++;
continue;
case 'N':
#if (NGX_WIN32)
*buf++ = CR;
#endif
*buf++ = LF;
fmt++;
continue;
case '%':
*buf++ = '%';
fmt++;
continue;
default:
*buf++ = *fmt++;
continue;
}
if (sign) {
if (i64 < 0) {
*buf++ = '-';
ui64 = (uint64_t) -i64;
} else {
ui64 = (uint64_t) i64;
}
}
buf = ngx_sprintf_num(buf, last, ui64, zero, hex, width);
fmt++;
} else {
*buf++ = *fmt++;
}
}
return buf;
}
src/http/ngx_http_header_filter_module.c:546: error: Buffer Overrun L3
Offset: [0, 327692] Size: [0, +oo] by call to `ngx_sprintf`.
src/http/ngx_http_header_filter_module.c:430:5: Assignment
428.
429. /* "HTTP/1.x " */
430. b->last = ngx_cpymem(b->last, "HTTP/1.1 ", sizeof("HTTP/1.x ") - 1);
^
431.
432. /* status line */
src/http/ngx_http_header_filter_module.c:546:23: Call
544.
545. if (clcf->keepalive_header) {
546. b->last = ngx_sprintf(b->last, "Keep-Alive: timeout=%T" CRLF,
^
547. clcf->keepalive_header);
548. }
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, 327692] 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_42110
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/bn/bn_gf2m.c:1018: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_sqr_arr`.
Showing all 20 steps of the trace
crypto/bn/bn_gf2m.c:983:1: Parameter `ctx->stack.depth`
981. * 0. Uses algorithms A.4.7 and A.4.6 from IEEE P1363.
982. */
983. > int BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a_, const int p[],
984. BN_CTX *ctx)
985. {
crypto/bn/bn_gf2m.c:997:5: Call
995. }
996.
997. BN_CTX_start(ctx);
^
998. a = BN_CTX_get(ctx);
999. z = 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_gf2m.c:998:9: Call
996.
997. BN_CTX_start(ctx);
998. a = BN_CTX_get(ctx);
^
999. z = BN_CTX_get(ctx);
1000. w = 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_gf2m.c:999:9: Call
997. BN_CTX_start(ctx);
998. a = BN_CTX_get(ctx);
999. z = BN_CTX_get(ctx);
^
1000. w = BN_CTX_get(ctx);
1001. if (w == 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_gf2m.c:1000:9: Call
998. a = BN_CTX_get(ctx);
999. z = BN_CTX_get(ctx);
1000. w = BN_CTX_get(ctx);
^
1001. if (w == NULL)
1002. 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_gf2m.c:1018:18: Call
1016. goto err;
1017. for (j = 1; j <= (p[0] - 1) / 2; j++) {
1018. if (!BN_GF2m_mod_sqr_arr(z, z, p, ctx))
^
1019. goto err;
1020. if (!BN_GF2m_mod_sqr_arr(z, z, p, ctx))
crypto/bn/bn_gf2m.c:496:5: Call
494.
495. bn_check_top(a);
496. BN_CTX_start(ctx);
^
497. if ((s = BN_CTX_get(ctx)) == NULL)
498. goto err;
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_gf2m.c:514:5: Call
512. ret = 1;
513. err:
514. BN_CTX_end(ctx);
^
515. return ret;
516. }
crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <Offset trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: <Length trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_sqr_arr`
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_42111
|
struct CRYPTO_dynlock_value *CRYPTO_get_dynlock_value(int i)
{
CRYPTO_dynlock *pointer = NULL;
if (i)
i = -i - 1;
CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK);
if (dyn_locks != NULL && i < sk_CRYPTO_dynlock_num(dyn_locks))
pointer = sk_CRYPTO_dynlock_value(dyn_locks, i);
if (pointer)
pointer->references++;
CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
if (pointer)
return pointer->data;
return NULL;
}
crypto/bn/bn_mont.c:507: error: USE_AFTER_FREE
call to `CRYPTO_lock()` eventually accesses memory that was invalidated by call to `free()` on line 505 indirectly during the call to `CRYPTO_lock()`.
Showing all 22 steps of the trace
crypto/bn/bn_mont.c:505:5: invalidation part of the trace starts here
503. BN_MONT_CTX *ret;
504.
505. CRYPTO_r_lock(lock);
^
506. ret = *pmont;
507. CRYPTO_r_unlock(lock);
crypto/bn/bn_mont.c:505:5: global variable `dyn_locks` accessed here
503. BN_MONT_CTX *ret;
504.
505. CRYPTO_r_lock(lock);
^
506. ret = *pmont;
507. CRYPTO_r_unlock(lock);
crypto/bn/bn_mont.c:505:5: when calling `CRYPTO_lock` here
503. BN_MONT_CTX *ret;
504.
505. CRYPTO_r_lock(lock);
^
506. ret = *pmont;
507. CRYPTO_r_unlock(lock);
crypto/lock.c:444:19: global variable `dyn_locks` accessed here
442. if (dynlock_lock_callback != NULL) {
443. struct CRYPTO_dynlock_value *pointer
444. = CRYPTO_get_dynlock_value(type);
^
445.
446. OPENSSL_assert(pointer != NULL);
crypto/lock.c:450:13: when calling `CRYPTO_destroy_dynlockid` here
448. dynlock_lock_callback(mode, pointer, file, line);
449.
450. CRYPTO_destroy_dynlockid(type);
^
451. }
452. } else if (locking_callback != NULL)
crypto/lock.c:301:9: global variable `dyn_locks` accessed here
299. CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK);
300.
301. if (dyn_locks == NULL || i >= sk_CRYPTO_dynlock_num(dyn_locks)) {
^
302. CRYPTO_w_unlock(CRYPTO_LOCK_DYNLOCK);
303. return;
crypto/lock.c:305:15: passed as argument to `sk_CRYPTO_dynlock_value`
303. return;
304. }
305. pointer = sk_CRYPTO_dynlock_value(dyn_locks, i);
^
306. if (pointer != NULL) {
307. --pointer->references;
crypto/lock.c:305:15: return from call to `sk_CRYPTO_dynlock_value`
303. return;
304. }
305. pointer = sk_CRYPTO_dynlock_value(dyn_locks, i);
^
306. if (pointer != NULL) {
307. --pointer->references;
crypto/lock.c:305:5: assigned
303. return;
304. }
305. pointer = sk_CRYPTO_dynlock_value(dyn_locks, i);
^
306. if (pointer != NULL) {
307. --pointer->references;
crypto/lock.c:323:9: when calling `CRYPTO_free` here
321. if (pointer) {
322. dynlock_destroy_callback(pointer->data, __FILE__, __LINE__);
323. OPENSSL_free(pointer);
^
324. }
325. }
crypto/mem.c:234:1: parameter `str` of CRYPTO_free
232. }
233.
234. > void CRYPTO_free(void *str)
235. {
236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
crypto/mem.c:245:5: was invalidated by call to `free()`
243. }
244. #else
245. free(str);
^
246. #endif
247. }
crypto/bn/bn_mont.c:505:5: use-after-lifetime part of the trace starts here
503. BN_MONT_CTX *ret;
504.
505. CRYPTO_r_lock(lock);
^
506. ret = *pmont;
507. CRYPTO_r_unlock(lock);
crypto/bn/bn_mont.c:505:5: global variable `dyn_locks` accessed here
503. BN_MONT_CTX *ret;
504.
505. CRYPTO_r_lock(lock);
^
506. ret = *pmont;
507. CRYPTO_r_unlock(lock);
crypto/bn/bn_mont.c:507:5: when calling `CRYPTO_lock` here
505. CRYPTO_r_lock(lock);
506. ret = *pmont;
507. CRYPTO_r_unlock(lock);
^
508. if (ret)
509. return ret;
crypto/lock.c:444:19: global variable `dyn_locks` accessed here
442. if (dynlock_lock_callback != NULL) {
443. struct CRYPTO_dynlock_value *pointer
444. = CRYPTO_get_dynlock_value(type);
^
445.
446. OPENSSL_assert(pointer != NULL);
crypto/lock.c:444:19: when calling `CRYPTO_get_dynlock_value` here
442. if (dynlock_lock_callback != NULL) {
443. struct CRYPTO_dynlock_value *pointer
444. = CRYPTO_get_dynlock_value(type);
^
445.
446. OPENSSL_assert(pointer != NULL);
crypto/lock.c:335:9: global variable `dyn_locks` accessed here
333. CRYPTO_w_lock(CRYPTO_LOCK_DYNLOCK);
334.
335. if (dyn_locks != NULL && i < sk_CRYPTO_dynlock_num(dyn_locks))
^
336. pointer = sk_CRYPTO_dynlock_value(dyn_locks, i);
337. if (pointer)
crypto/lock.c:336:19: passed as argument to `sk_CRYPTO_dynlock_value`
334.
335. if (dyn_locks != NULL && i < sk_CRYPTO_dynlock_num(dyn_locks))
336. pointer = sk_CRYPTO_dynlock_value(dyn_locks, i);
^
337. if (pointer)
338. pointer->references++;
crypto/lock.c:336:19: return from call to `sk_CRYPTO_dynlock_value`
334.
335. if (dyn_locks != NULL && i < sk_CRYPTO_dynlock_num(dyn_locks))
336. pointer = sk_CRYPTO_dynlock_value(dyn_locks, i);
^
337. if (pointer)
338. pointer->references++;
crypto/lock.c:336:9: assigned
334.
335. if (dyn_locks != NULL && i < sk_CRYPTO_dynlock_num(dyn_locks))
336. pointer = sk_CRYPTO_dynlock_value(dyn_locks, i);
^
337. if (pointer)
338. pointer->references++;
crypto/lock.c:343:16: invalid access occurs here
341.
342. if (pointer)
343. return pointer->data;
^
344. return NULL;
345. }
|
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/lock.c/#L343
|
d2a_code_trace_data_42112
|
static EVP_PKEY *
load_netscape_key(BIO *err, BIO *key, const char *file,
const char *key_descrip, int format)
{
EVP_PKEY *pkey;
BUF_MEM *buf;
RSA *rsa;
const unsigned char *p;
int size, i;
buf=BUF_MEM_new();
pkey = EVP_PKEY_new();
size = 0;
if (buf == NULL || pkey == NULL)
goto error;
for (;;)
{
if (!BUF_MEM_grow_clean(buf,size+1024*10))
goto error;
i = BIO_read(key, &(buf->data[size]), 1024*10);
size += i;
if (i == 0)
break;
if (i < 0)
{
BIO_printf(err, "Error reading %s %s",
key_descrip, file);
goto error;
}
}
p=(unsigned char *)buf->data;
rsa = d2i_RSA_NET(NULL,&p,(long)size,NULL,
(format == FORMAT_IISSGC ? 1 : 0));
if (rsa == NULL)
goto error;
BUF_MEM_free(buf);
EVP_PKEY_set1_RSA(pkey, rsa);
return pkey;
error:
BUF_MEM_free(buf);
EVP_PKEY_free(pkey);
return NULL;
}
apps/apps.c:1019: error: NULL_DEREFERENCE
pointer `pkey` last assigned on line 990 could be null and is dereferenced by call to `EVP_PKEY_free()` at line 1019, column 2.
Showing all 74 steps of the trace
apps/apps.c:979:1: start of procedure load_netscape_key()
977.
978. #if !defined(OPENSSL_NO_RC4) && !defined(OPENSSL_NO_RSA)
979. > static EVP_PKEY *
980. load_netscape_key(BIO *err, BIO *key, const char *file,
981. const char *key_descrip, int format)
apps/apps.c:989:2:
987. int size, i;
988.
989. > buf=BUF_MEM_new();
990. pkey = EVP_PKEY_new();
991. size = 0;
crypto/buffer/buffer.c:63:1: start of procedure BUF_MEM_new()
61. #include <openssl/buffer.h>
62.
63. > BUF_MEM *BUF_MEM_new(void)
64. {
65. BUF_MEM *ret;
crypto/buffer/buffer.c:67:2:
65. BUF_MEM *ret;
66.
67. > ret=OPENSSL_malloc(sizeof(BUF_MEM));
68. if (ret == NULL)
69. {
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:68:6: Taking true branch
66.
67. ret=OPENSSL_malloc(sizeof(BUF_MEM));
68. if (ret == NULL)
^
69. {
70. BUFerr(BUF_F_BUF_MEM_NEW,ERR_R_MALLOC_FAILURE);
crypto/buffer/buffer.c:70:3:
68. if (ret == NULL)
69. {
70. > BUFerr(BUF_F_BUF_MEM_NEW,ERR_R_MALLOC_FAILURE);
71. return(NULL);
72. }
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 false 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: 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:71:3:
69. {
70. BUFerr(BUF_F_BUF_MEM_NEW,ERR_R_MALLOC_FAILURE);
71. > return(NULL);
72. }
73. ret->length=0;
crypto/buffer/buffer.c:77:2: return from a call to BUF_MEM_new
75. ret->data=NULL;
76. return(ret);
77. }
^
78.
79. void BUF_MEM_free(BUF_MEM *a)
apps/apps.c:990:2:
988.
989. buf=BUF_MEM_new();
990. > pkey = EVP_PKEY_new();
991. size = 0;
992. if (buf == NULL || pkey == NULL)
crypto/evp/p_lib.c:298:1: start of procedure EVP_PKEY_new()
296. }
297.
298. > EVP_PKEY *EVP_PKEY_new(void)
299. {
300. EVP_PKEY *ret;
crypto/evp/p_lib.c:302:2:
300. EVP_PKEY *ret;
301.
302. > ret=(EVP_PKEY *)OPENSSL_malloc(sizeof(EVP_PKEY));
303. if (ret == NULL)
304. {
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/evp/p_lib.c:303:6: Taking true branch
301.
302. ret=(EVP_PKEY *)OPENSSL_malloc(sizeof(EVP_PKEY));
303. if (ret == NULL)
^
304. {
305. EVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE);
crypto/evp/p_lib.c:305:3:
303. if (ret == NULL)
304. {
305. > EVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE);
306. return(NULL);
307. }
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 false 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: 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/evp/p_lib.c:306:3:
304. {
305. EVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE);
306. > return(NULL);
307. }
308. ret->type=EVP_PKEY_NONE;
crypto/evp/p_lib.c:314:2: return from a call to EVP_PKEY_new
312. ret->save_parameters=1;
313. return(ret);
314. }
^
315.
316. int EVP_PKEY_assign(EVP_PKEY *pkey, int type, char *key)
apps/apps.c:991:2:
989. buf=BUF_MEM_new();
990. pkey = EVP_PKEY_new();
991. > size = 0;
992. if (buf == NULL || pkey == NULL)
993. goto error;
apps/apps.c:992:6: Taking true branch
990. pkey = EVP_PKEY_new();
991. size = 0;
992. if (buf == NULL || pkey == NULL)
^
993. goto error;
994. for (;;)
apps/apps.c:1017:1:
1015. EVP_PKEY_set1_RSA(pkey, rsa);
1016. return pkey;
1017. > error:
1018. BUF_MEM_free(buf);
1019. EVP_PKEY_free(pkey);
apps/apps.c:1018:2:
1016. return pkey;
1017. error:
1018. > BUF_MEM_free(buf);
1019. EVP_PKEY_free(pkey);
1020. return NULL;
crypto/buffer/buffer.c:79:1: start of procedure BUF_MEM_free()
77. }
78.
79. > void BUF_MEM_free(BUF_MEM *a)
80. {
81. if(a == NULL)
crypto/buffer/buffer.c:81:5: Taking true branch
79. void BUF_MEM_free(BUF_MEM *a)
80. {
81. if(a == NULL)
^
82. return;
83.
crypto/buffer/buffer.c:82:6:
80. {
81. if(a == NULL)
82. > return;
83.
84. if (a->data != NULL)
crypto/buffer/buffer.c:90:2: return from a call to BUF_MEM_free
88. }
89. OPENSSL_free(a);
90. }
^
91.
92. int BUF_MEM_grow(BUF_MEM *str, int len)
apps/apps.c:1019:2:
1017. error:
1018. BUF_MEM_free(buf);
1019. > EVP_PKEY_free(pkey);
1020. return NULL;
1021. }
|
https://github.com/openssl/openssl/blob/03ddbdd9b99ea60d0967b831ffc1fe93ae7f9792/apps/apps.c/#L1019
|
d2a_code_trace_data_42113
|
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
{
BN_ULONG *a = NULL;
bn_check_top(b);
if (words > (INT_MAX / (4 * BN_BITS2))) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG);
return NULL;
}
if (BN_get_flags(b, BN_FLG_STATIC_DATA)) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
return (NULL);
}
if (BN_get_flags(b, BN_FLG_SECURE))
a = OPENSSL_secure_zalloc(words * sizeof(*a));
else
a = OPENSSL_zalloc(words * sizeof(*a));
if (a == NULL) {
BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
return (NULL);
}
assert(b->top <= words);
if (b->top > 0)
memcpy(a, b->d, sizeof(*a) * b->top);
return a;
}
crypto/rsa/rsa_chk.c:66: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, +oo] by call to `BN_mul`.
Showing all 19 steps of the trace
crypto/rsa/rsa_chk.c:60:9: Call
58.
59. /* q prime? */
60. if (BN_is_prime_ex(key->q, BN_prime_checks, NULL, cb) != 1) {
^
61. ret = 0;
62. RSAerr(RSA_F_RSA_CHECK_KEY_EX, RSA_R_Q_NOT_PRIME);
crypto/bn/bn_prime.c:150:12: Call
148. BN_GENCB *cb)
149. {
150. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb);
^
151. }
152.
crypto/bn/bn_prime.c:227:13: Call
225. /* now 1 <= check < a */
226.
227. j = witness(check, a, A1, A1_odd, k, ctx, mont);
^
228. if (j == -1)
229. goto err;
crypto/bn/bn_prime.c:253:10: Call
251. BN_MONT_CTX *mont)
252. {
253. if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */
^
254. return -1;
255. if (BN_is_one(w))
crypto/bn/bn_exp.c:350:14: Call
348.
349. if (a->neg || BN_ucmp(a, m) >= 0) {
350. if (!BN_nnmod(val[0], a, m, ctx))
^
351. goto err;
352. aa = val[0];
crypto/bn/bn_mod.c:20:11: Call
18. */
19.
20. if (!(BN_mod(r, m, d, ctx)))
^
21. return 0;
22. if (!r->neg)
crypto/bn/bn_div.c:140:1: Parameter `*dv->d`
138. * If 'dv' or 'rm' is NULL, the respective value is not returned.
139. */
140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
141. BN_CTX *ctx)
142. {
crypto/rsa/rsa_chk.c:66:10: Call
64.
65. /* n = p*q? */
66. if (!BN_mul(i, key->p, key->q, ctx)) {
^
67. ret = -1;
68. goto err;
crypto/bn/bn_mul.c:495:1: Parameter `*r->d`
493. #endif /* BN_RECURSION */
494.
495. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
496. {
497. int ret = 0;
crypto/bn/bn_mul.c:573:21: Call
571. if (bn_wexpand(t, k * 4) == NULL)
572. goto err;
573. if (bn_wexpand(rr, k * 4) == NULL)
^
574. goto err;
575. bn_mul_part_recursive(rr->d, a->d, b->d,
crypto/bn/bn_lib.c:948:1: Parameter `*a->d`
946. }
947.
948. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
949. {
950. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_lib.c:950:37: Call
948. BIGNUM *bn_wexpand(BIGNUM *a, int words)
949. {
950. return (words <= a->dmax) ? a : bn_expand2(a, words);
^
951. }
952.
crypto/bn/bn_lib.c:284:1: Parameter `*b->d`
282. */
283.
284. > BIGNUM *bn_expand2(BIGNUM *b, int words)
285. {
286. bn_check_top(b);
crypto/bn/bn_lib.c:289:23: Call
287.
288. if (words > b->dmax) {
289. BN_ULONG *a = bn_expand_internal(b, words);
^
290. if (!a)
291. return NULL;
crypto/bn/bn_lib.c:246:1: <Offset trace>
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:246:1: Parameter `b->top`
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:246:1: <Length trace>
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:246:1: Parameter `*b->d`
244. /* This is used by bn_expand2() */
245. /* The caller MUST check that words > b->dmax before calling this */
246. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
247. {
248. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:271:9: Array access: Offset added: [8, +oo] Size: [0, +oo] by call to `BN_mul`
269. assert(b->top <= words);
270. if (b->top > 0)
271. memcpy(a, b->d, sizeof(*a) * b->top);
^
272.
273. return a;
|
https://github.com/openssl/openssl/blob/757264207ad8650a89ea903d48ad89f61d56ea9c/crypto/bn/bn_lib.c/#L271
|
d2a_code_trace_data_42114
|
static int error_check(DRBG_SELFTEST_DATA *td)
{
static char zero[sizeof(RAND_DRBG)];
RAND_DRBG *drbg = NULL;
TEST_CTX t;
unsigned char buff[1024];
unsigned int reseed_counter_tmp;
int ret = 0;
if (!TEST_ptr(drbg = RAND_DRBG_new(0, 0, NULL)))
goto err;
if (!init(drbg, td, &t)
|| RAND_DRBG_instantiate(drbg, td->pers, drbg->max_pers + 1) > 0)
goto err;
t.entlen = 0;
if (TEST_int_le(RAND_DRBG_instantiate(drbg, td->pers, td->perslen), 0))
goto err;
if (!TEST_false(RAND_DRBG_generate(drbg, buff, td->exlen, 0,
td->adin, td->adinlen))
|| !uninstantiate(drbg))
goto err;
t.entlen = drbg->min_entropy - 1;
if (!init(drbg, td, &t)
|| RAND_DRBG_instantiate(drbg, td->pers, td->perslen) > 0
|| !uninstantiate(drbg))
goto err;
t.entlen = drbg->max_entropy + 1;
if (!init(drbg, td, &t)
|| RAND_DRBG_instantiate(drbg, td->pers, td->perslen) > 0
|| !uninstantiate(drbg))
goto err;
if (drbg->min_nonce) {
t.noncelen = drbg->min_nonce - 1;
if (!init(drbg, td, &t)
|| RAND_DRBG_instantiate(drbg, td->pers, td->perslen) > 0
|| !uninstantiate(drbg))
goto err;
}
if (drbg->max_nonce) {
t.noncelen = drbg->max_nonce + 1;
if (!init(drbg, td, &t)
|| RAND_DRBG_instantiate(drbg, td->pers, td->perslen) > 0
|| !uninstantiate(drbg))
goto err;
}
if (!instantiate(drbg, td, &t)
|| !TEST_true(RAND_DRBG_generate(drbg, buff, td->exlen, 0,
td->adin, td->adinlen)))
goto err;
if (!TEST_false(RAND_DRBG_generate(drbg, buff, drbg->max_request + 1, 0,
td->adin, td->adinlen)))
goto err;
if (!TEST_false(RAND_DRBG_generate(drbg, buff, td->exlen, 0,
td->adin, drbg->max_adin + 1)))
goto err;
t.entlen = 0;
if (TEST_false(RAND_DRBG_generate(drbg, buff, td->exlen, 1,
td->adin, td->adinlen))
|| !uninstantiate(drbg))
goto err;
if (!instantiate(drbg, td, &t))
goto err;
reseed_counter_tmp = drbg->reseed_counter;
drbg->reseed_counter = drbg->reseed_interval;
t.entcnt = 0;
if (!TEST_true(RAND_DRBG_generate(drbg, buff, td->exlen, 0,
td->adin, td->adinlen))
|| !TEST_int_eq(t.entcnt, 1)
|| !TEST_int_eq(drbg->reseed_counter, reseed_counter_tmp + 1)
|| !uninstantiate(drbg))
goto err;
t.entlen = 0;
if (!TEST_false(RAND_DRBG_generate(drbg, buff, td->exlen, 1,
td->adin, td->adinlen))
|| !uninstantiate(drbg))
goto err;
if (!instantiate(drbg, td, &t))
goto err;
reseed_counter_tmp = drbg->reseed_counter;
drbg->reseed_counter = drbg->reseed_interval;
t.entcnt = 0;
if (!TEST_true(RAND_DRBG_generate(drbg, buff, td->exlen, 0,
td->adin, td->adinlen))
|| !TEST_int_eq(t.entcnt, 1)
|| !TEST_int_eq(drbg->reseed_counter, reseed_counter_tmp + 1)
|| !uninstantiate(drbg))
goto err;
if (!init(drbg, td, &t)
|| RAND_DRBG_reseed(drbg, td->adin, drbg->max_adin + 1) > 0)
goto err;
t.entlen = 0;
if (!TEST_int_le(RAND_DRBG_reseed(drbg, td->adin, td->adinlen), 0)
|| !uninstantiate(drbg))
goto err;
if (!init(drbg, td, &t))
goto err;
t.entlen = drbg->max_entropy + 1;
if (!TEST_int_le(RAND_DRBG_reseed(drbg, td->adin, td->adinlen), 0)
|| !uninstantiate(drbg))
goto err;
if (!init(drbg, td, &t))
goto err;
t.entlen = drbg->min_entropy - 1;
if (!TEST_int_le(RAND_DRBG_reseed(drbg, td->adin, td->adinlen), 0)
|| !uninstantiate(drbg))
goto err;
if (!TEST_mem_eq(zero, sizeof(drbg->ctr), &drbg->ctr, sizeof(drbg->ctr)))
goto err;
ret = 1;
err:
uninstantiate(drbg);
RAND_DRBG_free(drbg);
return ret;
}
test/drbgtest.c:308: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned64.
Showing all 5 steps of the trace
test/drbgtest.c:280:10: <LHS trace>
278. int ret = 0;
279.
280. if (!TEST_ptr(drbg = RAND_DRBG_new(0, 0, NULL)))
^
281. goto err;
282.
test/drbgtest.c:280:10: Call
278. int ret = 0;
279.
280. if (!TEST_ptr(drbg = RAND_DRBG_new(0, 0, NULL)))
^
281. goto err;
282.
crypto/rand/drbg_lib.c:77:9: Call
75. drbg->fork_count = rand_fork_count;
76. drbg->parent = parent;
77. if (RAND_DRBG_set(drbg, type, flags) < 0)
^
78. goto err;
79.
crypto/rand/drbg_lib.c:33:1: Parameter `drbg->min_entropy`
31. * failure.
32. */
33. > int RAND_DRBG_set(RAND_DRBG *drbg, int nid, unsigned int flags)
34. {
35. int ret = 1;
test/drbgtest.c:308:5: Binary operation: ([0, +oo] - 1):unsigned64
306.
307. /* Test insufficient entropy */
308. t.entlen = drbg->min_entropy - 1;
^
309. if (!init(drbg, td, &t)
310. || RAND_DRBG_instantiate(drbg, td->pers, td->perslen) > 0
|
https://github.com/openssl/openssl/blob/a35f607c9f9112c649b367d05639394fc1c30771/test/drbgtest.c/#L308
|
d2a_code_trace_data_42115
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/bn/bn_sqrt.c:144: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_sqr`.
Showing all 42 steps of the trace
crypto/bn/bn_sqrt.c:13:1: Parameter `ctx->stack.depth`
11. #include "bn_lcl.h"
12.
13. > BIGNUM *BN_mod_sqrt(BIGNUM *in, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx)
14. /*
15. * Returns 'ret' such that ret^2 == a (mod p), using the Tonelli/Shanks
crypto/bn/bn_sqrt.c:59:5: Call
57. }
58.
59. BN_CTX_start(ctx);
^
60. A = BN_CTX_get(ctx);
61. 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_sqrt.c:60:9: Call
58.
59. BN_CTX_start(ctx);
60. A = BN_CTX_get(ctx);
^
61. b = BN_CTX_get(ctx);
62. q = 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_sqrt.c:61:9: Call
59. BN_CTX_start(ctx);
60. A = BN_CTX_get(ctx);
61. b = BN_CTX_get(ctx);
^
62. q = BN_CTX_get(ctx);
63. 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_sqrt.c:62:9: Call
60. A = BN_CTX_get(ctx);
61. b = BN_CTX_get(ctx);
62. q = BN_CTX_get(ctx);
^
63. t = BN_CTX_get(ctx);
64. 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_sqrt.c:63:9: Call
61. b = BN_CTX_get(ctx);
62. q = BN_CTX_get(ctx);
63. t = BN_CTX_get(ctx);
^
64. x = BN_CTX_get(ctx);
65. 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_sqrt.c:64:9: Call
62. q = BN_CTX_get(ctx);
63. t = BN_CTX_get(ctx);
64. x = BN_CTX_get(ctx);
^
65. y = BN_CTX_get(ctx);
66. 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_sqrt.c:65:9: Call
63. t = BN_CTX_get(ctx);
64. x = BN_CTX_get(ctx);
65. y = BN_CTX_get(ctx);
^
66. if (y == NULL)
67. goto end;
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_sqrt.c:75:10: Call
73.
74. /* A = a mod p */
75. if (!BN_nnmod(A, a, p, ctx))
^
76. goto end;
77.
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_sqrt.c:140:14: Call
138. goto end;
139. q->neg = 0;
140. if (!BN_mod_exp(b, t, q, p, ctx))
^
141. goto end;
142.
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:141:19: Call
139. && (BN_get_flags(m, BN_FLG_CONSTTIME) == 0)) {
140. BN_ULONG A = a->d[0];
141. ret = BN_mod_exp_mont_word(r, A, p, m, ctx, NULL);
^
142. } else
143. # endif
crypto/bn/bn_exp.c:1129:1: Parameter `ctx->stack.depth`
1127. }
1128.
1129. > int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p,
1130. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
1131. {
crypto/bn/bn_sqrt.c:144:14: Call
142.
143. /* y := b^2 */
144. if (!BN_mod_sqr(y, b, p, ctx))
^
145. goto end;
146.
crypto/bn/bn_mod.c:222:1: Parameter `ctx->stack.depth`
220. }
221.
222. > int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx)
223. {
224. if (!BN_sqr(r, a, ctx))
crypto/bn/bn_mod.c:224:10: Call
222. int BN_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx)
223. {
224. if (!BN_sqr(r, a, ctx))
^
225. return 0;
226. /* r->neg == 0, thus we don't need BN_nnmod */
crypto/bn/bn_sqr.c:17:1: Parameter `ctx->stack.depth`
15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96
16. */
17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
18. {
19. int ret = bn_sqr_fixed_top(r, a, ctx);
crypto/bn/bn_sqr.c:19:15: Call
17. int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
18. {
19. int ret = bn_sqr_fixed_top(r, a, ctx);
^
20.
21. bn_correct_top(r);
crypto/bn/bn_sqr.c:27:1: Parameter `ctx->stack.depth`
25. }
26.
27. > int bn_sqr_fixed_top(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
28. {
29. int max, al;
crypto/bn/bn_mod.c:227:12: Call
225. return 0;
226. /* r->neg == 0, thus we don't need BN_nnmod */
227. return BN_mod(r, r, m, ctx);
^
228. }
229.
crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth`
207. * If 'dv' or 'rm' is NULL, the respective value is not returned.
208. */
209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
210. BN_CTX *ctx)
211. {
crypto/bn/bn_div.c:229:11: Call
227. }
228.
229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx);
^
230.
231. if (ret) {
crypto/bn/bn_div.c:280:5: Call
278. bn_check_top(rm);
279.
280. BN_CTX_start(ctx);
^
281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv;
282. tmp = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_div.c:450:5: Call
448. if (rm != NULL)
449. bn_rshift_fixed_top(rm, snum, norm_shift);
450. BN_CTX_end(ctx);
^
451. return 1;
452. err:
crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <Offset trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: <Length trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_sqr`
266. static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
^
269. }
270.
|
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
|
d2a_code_trace_data_42116
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/ec/ecdh_ossl.c:117: 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/ecdh_ossl.c:52:5: Call
50. if ((ctx = BN_CTX_new()) == NULL)
51. goto err;
52. BN_CTX_start(ctx);
^
53. x = BN_CTX_get(ctx);
54. if (x == 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/ec/ecdh_ossl.c:117:9: Call
115. EC_POINT_free(tmp);
116. if (ctx)
117. BN_CTX_end(ctx);
^
118. BN_CTX_free(ctx);
119. OPENSSL_free(buf);
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_42117
|
SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username)
{
int i;
SRP_user_pwd *user;
unsigned char digv[SHA_DIGEST_LENGTH];
unsigned char digs[SHA_DIGEST_LENGTH];
EVP_MD_CTX *ctxt = NULL;
if (vb == NULL)
return NULL;
for (i = 0; i < sk_SRP_user_pwd_num(vb->users_pwd); i++) {
user = sk_SRP_user_pwd_value(vb->users_pwd, i);
if (strcmp(user->id, username) == 0)
return user;
}
if ((vb->seed_key == NULL) ||
(vb->default_g == NULL) || (vb->default_N == NULL))
return NULL;
if ((user = SRP_user_pwd_new()) == NULL)
return NULL;
SRP_user_pwd_set_gN(user, vb->default_g, vb->default_N);
if (!SRP_user_pwd_set_ids(user, username, NULL))
goto err;
if (RAND_bytes(digv, SHA_DIGEST_LENGTH) <= 0)
goto err;
ctxt = EVP_MD_CTX_new();
EVP_DigestInit_ex(ctxt, EVP_sha1(), NULL);
EVP_DigestUpdate(ctxt, vb->seed_key, strlen(vb->seed_key));
EVP_DigestUpdate(ctxt, username, strlen(username));
EVP_DigestFinal_ex(ctxt, digs, NULL);
EVP_MD_CTX_free(ctxt);
ctxt = NULL;
if (SRP_user_pwd_set_sv_BN(user,
BN_bin2bn(digs, SHA_DIGEST_LENGTH, NULL),
BN_bin2bn(digv, SHA_DIGEST_LENGTH, NULL)))
return user;
err:
EVP_MD_CTX_free(ctxt);
SRP_user_pwd_free(user);
return NULL;
}
crypto/srp/srp_vfy.c:516: error: MEMORY_LEAK
memory dynamically allocated by call to `SRP_user_pwd_new()` at line 492, column 17 is not reachable after line 516, column 5.
Showing all 89 steps of the trace
crypto/srp/srp_vfy.c:471:1: start of procedure SRP_VBASE_get_by_user()
469. }
470.
471. > SRP_user_pwd *SRP_VBASE_get_by_user(SRP_VBASE *vb, char *username)
472. {
473. int i;
crypto/srp/srp_vfy.c:477:5:
475. unsigned char digv[SHA_DIGEST_LENGTH];
476. unsigned char digs[SHA_DIGEST_LENGTH];
477. > EVP_MD_CTX *ctxt = NULL;
478.
479. if (vb == NULL)
crypto/srp/srp_vfy.c:479:9: Taking false branch
477. EVP_MD_CTX *ctxt = NULL;
478.
479. if (vb == NULL)
^
480. return NULL;
481. for (i = 0; i < sk_SRP_user_pwd_num(vb->users_pwd); i++) {
crypto/srp/srp_vfy.c:481:10:
479. if (vb == NULL)
480. return NULL;
481. > for (i = 0; i < sk_SRP_user_pwd_num(vb->users_pwd); i++) {
482. user = sk_SRP_user_pwd_value(vb->users_pwd, i);
483. if (strcmp(user->id, username) == 0)
crypto/srp/srp_vfy.c:481:17:
479. if (vb == NULL)
480. return NULL;
481. > for (i = 0; i < sk_SRP_user_pwd_num(vb->users_pwd); i++) {
482. user = sk_SRP_user_pwd_value(vb->users_pwd, i);
483. if (strcmp(user->id, username) == 0)
include/openssl/srp.h:97:1: start of procedure sk_SRP_user_pwd_num()
95. } SRP_user_pwd;
96.
97. > DEFINE_STACK_OF(SRP_user_pwd)
98.
99. typedef struct SRP_VBASE_st {
crypto/stack/stack.c:317:1: start of procedure sk_num()
315. }
316.
317. > int sk_num(const _STACK *st)
318. {
319. if (st == NULL)
crypto/stack/stack.c:319:9: Taking true branch
317. int sk_num(const _STACK *st)
318. {
319. if (st == NULL)
^
320. return -1;
321. return st->num;
crypto/stack/stack.c:320:9:
318. {
319. if (st == NULL)
320. > return -1;
321. return st->num;
322. }
crypto/stack/stack.c:322:1: return from a call to sk_num
320. return -1;
321. return st->num;
322. > }
323.
324. void *sk_value(const _STACK *st, int i)
include/openssl/srp.h:97:1: return from a call to sk_SRP_user_pwd_num
95. } SRP_user_pwd;
96.
97. > DEFINE_STACK_OF(SRP_user_pwd)
98.
99. typedef struct SRP_VBASE_st {
crypto/srp/srp_vfy.c:481:17: Loop condition is false. Leaving loop
479. if (vb == NULL)
480. return NULL;
481. for (i = 0; i < sk_SRP_user_pwd_num(vb->users_pwd); i++) {
^
482. user = sk_SRP_user_pwd_value(vb->users_pwd, i);
483. if (strcmp(user->id, username) == 0)
crypto/srp/srp_vfy.c:486:10: Taking false branch
484. return user;
485. }
486. if ((vb->seed_key == NULL) ||
^
487. (vb->default_g == NULL) || (vb->default_N == NULL))
488. return NULL;
crypto/srp/srp_vfy.c:487:10: Taking false branch
485. }
486. if ((vb->seed_key == NULL) ||
487. (vb->default_g == NULL) || (vb->default_N == NULL))
^
488. return NULL;
489.
crypto/srp/srp_vfy.c:487:37: Taking false branch
485. }
486. if ((vb->seed_key == NULL) ||
487. (vb->default_g == NULL) || (vb->default_N == NULL))
^
488. return NULL;
489.
crypto/srp/srp_vfy.c:492:9:
490. /* if the user is unknown we set parameters as well if we have a seed_key */
491.
492. > if ((user = SRP_user_pwd_new()) == NULL)
493. return NULL;
494.
crypto/srp/srp_vfy.c:199:1: start of procedure SRP_user_pwd_new()
197. }
198.
199. > static SRP_user_pwd *SRP_user_pwd_new(void)
200. {
201. SRP_user_pwd *ret = OPENSSL_malloc(sizeof(*ret));
crypto/srp/srp_vfy.c:201:5:
199. static SRP_user_pwd *SRP_user_pwd_new(void)
200. {
201. > SRP_user_pwd *ret = OPENSSL_malloc(sizeof(*ret));
202. if (ret == NULL)
203. return NULL;
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/srp/srp_vfy.c:202:9: Taking false branch
200. {
201. SRP_user_pwd *ret = OPENSSL_malloc(sizeof(*ret));
202. if (ret == NULL)
^
203. return NULL;
204. ret->N = NULL;
crypto/srp/srp_vfy.c:204:5:
202. if (ret == NULL)
203. return NULL;
204. > ret->N = NULL;
205. ret->g = NULL;
206. ret->s = NULL;
crypto/srp/srp_vfy.c:205:5:
203. return NULL;
204. ret->N = NULL;
205. > ret->g = NULL;
206. ret->s = NULL;
207. ret->v = NULL;
crypto/srp/srp_vfy.c:206:5:
204. ret->N = NULL;
205. ret->g = NULL;
206. > ret->s = NULL;
207. ret->v = NULL;
208. ret->id = NULL;
crypto/srp/srp_vfy.c:207:5:
205. ret->g = NULL;
206. ret->s = NULL;
207. > ret->v = NULL;
208. ret->id = NULL;
209. ret->info = NULL;
crypto/srp/srp_vfy.c:208:5:
206. ret->s = NULL;
207. ret->v = NULL;
208. > ret->id = NULL;
209. ret->info = NULL;
210. return ret;
crypto/srp/srp_vfy.c:209:5:
207. ret->v = NULL;
208. ret->id = NULL;
209. > ret->info = NULL;
210. return ret;
211. }
crypto/srp/srp_vfy.c:210:5:
208. ret->id = NULL;
209. ret->info = NULL;
210. > return ret;
211. }
212.
crypto/srp/srp_vfy.c:211:1: return from a call to SRP_user_pwd_new
209. ret->info = NULL;
210. return ret;
211. > }
212.
213. static void SRP_user_pwd_set_gN(SRP_user_pwd *vinfo, const BIGNUM *g,
crypto/srp/srp_vfy.c:492:9: Taking false branch
490. /* if the user is unknown we set parameters as well if we have a seed_key */
491.
492. if ((user = SRP_user_pwd_new()) == NULL)
^
493. return NULL;
494.
crypto/srp/srp_vfy.c:495:5:
493. return NULL;
494.
495. > SRP_user_pwd_set_gN(user, vb->default_g, vb->default_N);
496.
497. if (!SRP_user_pwd_set_ids(user, username, NULL))
crypto/srp/srp_vfy.c:213:1: start of procedure SRP_user_pwd_set_gN()
211. }
212.
213. > static void SRP_user_pwd_set_gN(SRP_user_pwd *vinfo, const BIGNUM *g,
214. const BIGNUM *N)
215. {
crypto/srp/srp_vfy.c:216:5:
214. const BIGNUM *N)
215. {
216. > vinfo->N = N;
217. vinfo->g = g;
218. }
crypto/srp/srp_vfy.c:217:5:
215. {
216. vinfo->N = N;
217. > vinfo->g = g;
218. }
219.
crypto/srp/srp_vfy.c:218:1: return from a call to SRP_user_pwd_set_gN
216. vinfo->N = N;
217. vinfo->g = g;
218. > }
219.
220. static int SRP_user_pwd_set_ids(SRP_user_pwd *vinfo, const char *id,
crypto/srp/srp_vfy.c:497:10:
495. SRP_user_pwd_set_gN(user, vb->default_g, vb->default_N);
496.
497. > if (!SRP_user_pwd_set_ids(user, username, NULL))
498. goto err;
499.
crypto/srp/srp_vfy.c:220:1: start of procedure SRP_user_pwd_set_ids()
218. }
219.
220. > static int SRP_user_pwd_set_ids(SRP_user_pwd *vinfo, const char *id,
221. const char *info)
222. {
crypto/srp/srp_vfy.c:223:9: Taking true branch
221. const char *info)
222. {
223. if (id != NULL && NULL == (vinfo->id = OPENSSL_strdup(id)))
^
224. return 0;
225. return (info == NULL || NULL != (vinfo->info = OPENSSL_strdup(info)));
crypto/srp/srp_vfy.c:223:23:
221. const char *info)
222. {
223. > if (id != NULL && NULL == (vinfo->id = OPENSSL_strdup(id)))
224. return 0;
225. return (info == NULL || NULL != (vinfo->info = OPENSSL_strdup(info)));
crypto/o_str.c:121:1: start of procedure CRYPTO_strdup()
119. }
120.
121. > char *CRYPTO_strdup(const char *str, const char* file, int line)
122. {
123. char *ret;
crypto/o_str.c:125:9: Taking false branch
123. char *ret;
124.
125. if (str == NULL)
^
126. return NULL;
127. ret = CRYPTO_malloc(strlen(str) + 1, file, line);
crypto/o_str.c:127:5:
125. if (str == NULL)
126. return NULL;
127. > ret = CRYPTO_malloc(strlen(str) + 1, file, line);
128. if (ret != NULL)
129. strcpy(ret, str);
crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
118. }
119.
120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. void *ret = NULL;
crypto/mem.c:122:5:
120. void *CRYPTO_malloc(size_t num, const char *file, int line)
121. {
122. > void *ret = NULL;
123.
124. if (num <= 0)
crypto/mem.c:124:9: Taking false branch
122. void *ret = NULL;
123.
124. if (num <= 0)
^
125. return NULL;
126.
crypto/mem.c:127:5:
125. return NULL;
126.
127. > allow_customize = 0;
128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
129. if (call_malloc_debug) {
crypto/mem.c:137:5:
135. }
136. #else
137. > (void)file;
138. (void)line;
139. ret = malloc(num);
crypto/mem.c:138:5:
136. #else
137. (void)file;
138. > (void)line;
139. ret = malloc(num);
140. #endif
crypto/mem.c:139:5:
137. (void)file;
138. (void)line;
139. > ret = malloc(num);
140. #endif
141.
crypto/mem.c:154:5:
152. #endif
153.
154. > return ret;
155. }
156.
crypto/mem.c:155:1: return from a call to CRYPTO_malloc
153.
154. return ret;
155. > }
156.
157. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/o_str.c:128:9: Taking true branch
126. return NULL;
127. ret = CRYPTO_malloc(strlen(str) + 1, file, line);
128. if (ret != NULL)
^
129. strcpy(ret, str);
130. return ret;
crypto/o_str.c:129:9:
127. ret = CRYPTO_malloc(strlen(str) + 1, file, line);
128. if (ret != NULL)
129. > strcpy(ret, str);
130. return ret;
131. }
crypto/o_str.c:130:5:
128. if (ret != NULL)
129. strcpy(ret, str);
130. > return ret;
131. }
132.
crypto/o_str.c:131:1: return from a call to CRYPTO_strdup
129. strcpy(ret, str);
130. return ret;
131. > }
132.
133. char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)
crypto/srp/srp_vfy.c:223:23: Taking false branch
221. const char *info)
222. {
223. if (id != NULL && NULL == (vinfo->id = OPENSSL_strdup(id)))
^
224. return 0;
225. return (info == NULL || NULL != (vinfo->info = OPENSSL_strdup(info)));
crypto/srp/srp_vfy.c:225:13: Condition is true
223. if (id != NULL && NULL == (vinfo->id = OPENSSL_strdup(id)))
224. return 0;
225. return (info == NULL || NULL != (vinfo->info = OPENSSL_strdup(info)));
^
226. }
227.
crypto/srp/srp_vfy.c:225:5:
223. if (id != NULL && NULL == (vinfo->id = OPENSSL_strdup(id)))
224. return 0;
225. > return (info == NULL || NULL != (vinfo->info = OPENSSL_strdup(info)));
226. }
227.
crypto/srp/srp_vfy.c:226:1: return from a call to SRP_user_pwd_set_ids
224. return 0;
225. return (info == NULL || NULL != (vinfo->info = OPENSSL_strdup(info)));
226. > }
227.
228. static int SRP_user_pwd_set_sv(SRP_user_pwd *vinfo, const char *s,
crypto/srp/srp_vfy.c:497:10: Taking false branch
495. SRP_user_pwd_set_gN(user, vb->default_g, vb->default_N);
496.
497. if (!SRP_user_pwd_set_ids(user, username, NULL))
^
498. goto err;
499.
crypto/srp/srp_vfy.c:500:9:
498. goto err;
499.
500. > if (RAND_bytes(digv, SHA_DIGEST_LENGTH) <= 0)
501. goto err;
502. ctxt = EVP_MD_CTX_new();
crypto/rand/rand_lib.c:155:1: start of procedure RAND_bytes()
153. }
154.
155. > int RAND_bytes(unsigned char *buf, int num)
156. {
157. const RAND_METHOD *meth = RAND_get_rand_method();
crypto/rand/rand_lib.c:157:5:
155. int RAND_bytes(unsigned char *buf, int num)
156. {
157. > const RAND_METHOD *meth = RAND_get_rand_method();
158. if (meth && meth->bytes)
159. return meth->bytes(buf, num);
crypto/rand/rand_lib.c:92:1: start of procedure RAND_get_rand_method()
90. }
91.
92. > const RAND_METHOD *RAND_get_rand_method(void)
93. {
94. if (!default_RAND_meth) {
crypto/rand/rand_lib.c:94:10: Taking false branch
92. const RAND_METHOD *RAND_get_rand_method(void)
93. {
94. if (!default_RAND_meth) {
^
95. #ifndef OPENSSL_NO_ENGINE
96. ENGINE *e = ENGINE_get_default_RAND();
crypto/rand/rand_lib.c:110:5:
108. default_RAND_meth = RAND_OpenSSL();
109. }
110. > return default_RAND_meth;
111. }
112.
crypto/rand/rand_lib.c:111:1: return from a call to RAND_get_rand_method
109. }
110. return default_RAND_meth;
111. > }
112.
113. #ifndef OPENSSL_NO_ENGINE
crypto/rand/rand_lib.c:158:9: Taking true branch
156. {
157. const RAND_METHOD *meth = RAND_get_rand_method();
158. if (meth && meth->bytes)
^
159. return meth->bytes(buf, num);
160. return (-1);
crypto/rand/rand_lib.c:158:17: Taking false branch
156. {
157. const RAND_METHOD *meth = RAND_get_rand_method();
158. if (meth && meth->bytes)
^
159. return meth->bytes(buf, num);
160. return (-1);
crypto/rand/rand_lib.c:160:5:
158. if (meth && meth->bytes)
159. return meth->bytes(buf, num);
160. > return (-1);
161. }
162.
crypto/rand/rand_lib.c:161:1: return from a call to RAND_bytes
159. return meth->bytes(buf, num);
160. return (-1);
161. > }
162.
163. #if OPENSSL_API_COMPAT < 0x10100000L
crypto/srp/srp_vfy.c:500:9: Taking true branch
498. goto err;
499.
500. if (RAND_bytes(digv, SHA_DIGEST_LENGTH) <= 0)
^
501. goto err;
502. ctxt = EVP_MD_CTX_new();
crypto/srp/srp_vfy.c:514:2:
512. return user;
513.
514. > err:
515. EVP_MD_CTX_free(ctxt);
516. SRP_user_pwd_free(user);
crypto/srp/srp_vfy.c:515:5:
513.
514. err:
515. > EVP_MD_CTX_free(ctxt);
516. SRP_user_pwd_free(user);
517. return NULL;
crypto/evp/digest.c:158:1: start of procedure EVP_MD_CTX_free()
156. }
157.
158. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
159. {
160. EVP_MD_CTX_reset(ctx);
crypto/evp/digest.c:160:5: Skipping EVP_MD_CTX_reset(): empty list of specs
158. void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
159. {
160. EVP_MD_CTX_reset(ctx);
^
161. OPENSSL_free(ctx);
162. }
crypto/evp/digest.c:161:5:
159. {
160. EVP_MD_CTX_reset(ctx);
161. > OPENSSL_free(ctx);
162. }
163.
crypto/mem.c:234:1: start of procedure CRYPTO_free()
232. }
233.
234. > void CRYPTO_free(void *str)
235. {
236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
crypto/mem.c:245:5:
243. }
244. #else
245. > free(str);
246. #endif
247. }
crypto/mem.c:247:1: return from a call to CRYPTO_free
245. free(str);
246. #endif
247. > }
248.
249. void CRYPTO_clear_free(void *str, size_t num)
crypto/evp/digest.c:162:1: return from a call to EVP_MD_CTX_free
160. EVP_MD_CTX_reset(ctx);
161. OPENSSL_free(ctx);
162. > }
163.
164. int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
crypto/srp/srp_vfy.c:516:5: Skipping SRP_user_pwd_free(): empty list of specs
514. err:
515. EVP_MD_CTX_free(ctxt);
516. SRP_user_pwd_free(user);
^
517. return NULL;
518. }
|
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/srp/srp_vfy.c/#L516
|
d2a_code_trace_data_42118
|
static int query_formats(AVFilterContext *ctx)
{
AVFilterFormats *formats = NULL;
ff_add_format(&formats, AV_SAMPLE_FMT_FLT);
ff_add_format(&formats, AV_SAMPLE_FMT_FLTP);
ff_set_common_formats(ctx, formats);
ff_set_common_channel_layouts(ctx, ff_all_channel_layouts());
ff_set_common_samplerates(ctx, ff_all_samplerates());
return 0;
}
libavfilter/af_amix.c:538: error: Use After Free
accessing memory that was invalidated by call to `free()` on line 537 indirectly during the call to `ff_add_format()`.
libavfilter/af_amix.c:535:5: invalidation part of the trace starts here
533. static int query_formats(AVFilterContext *ctx)
534. {
535. AVFilterFormats *formats = NULL;
^
536. ff_add_format(&formats, AV_SAMPLE_FMT_FLT);
537. ff_add_format(&formats, AV_SAMPLE_FMT_FLTP);
libavfilter/af_amix.c:535:5: variable `formats` declared here
533. static int query_formats(AVFilterContext *ctx)
534. {
535. AVFilterFormats *formats = NULL;
^
536. ff_add_format(&formats, AV_SAMPLE_FMT_FLT);
537. ff_add_format(&formats, AV_SAMPLE_FMT_FLTP);
libavfilter/af_amix.c:537:5: when calling `ff_add_format` here
535. AVFilterFormats *formats = NULL;
536. ff_add_format(&formats, AV_SAMPLE_FMT_FLT);
537. ff_add_format(&formats, AV_SAMPLE_FMT_FLTP);
^
538. ff_set_common_formats(ctx, formats);
539. ff_set_common_channel_layouts(ctx, ff_all_channel_layouts());
libavfilter/formats.c:201:1: parameter `avff` of ff_add_format
199. } while (0)
200.
201. int ff_add_format(AVFilterFormats **avff, int fmt)
^
202. {
203. ADD_FORMAT(avff, fmt, int, formats, nb_formats);
libavfilter/formats.c:203:5: when calling `av_freep` here
201. int ff_add_format(AVFilterFormats **avff, int fmt)
202. {
203. ADD_FORMAT(avff, fmt, int, formats, nb_formats);
^
204. }
205.
libavutil/mem.c:198:1: parameter `arg` of av_freep
196. }
197.
198. void av_freep(void *arg)
^
199. {
200. void **ptr = (void **)arg;
libavutil/mem.c:200:5: assigned
198. void av_freep(void *arg)
199. {
200. void **ptr = (void **)arg;
^
201. av_free(*ptr);
202. *ptr = NULL;
libavutil/mem.c:201:5: when calling `av_free` here
199. {
200. void **ptr = (void **)arg;
201. av_free(*ptr);
^
202. *ptr = NULL;
203. }
libavutil/mem.c:186:1: parameter `ptr` of av_free
184. }
185.
186. void av_free(void *ptr)
^
187. {
188. #if CONFIG_MEMALIGN_HACK
libavutil/mem.c:194:5: was invalidated by call to `free()`
192. _aligned_free(ptr);
193. #else
194. free(ptr);
^
195. #endif
196. }
libavfilter/af_amix.c:535:5: use-after-lifetime part of the trace starts here
533. static int query_formats(AVFilterContext *ctx)
534. {
535. AVFilterFormats *formats = NULL;
^
536. ff_add_format(&formats, AV_SAMPLE_FMT_FLT);
537. ff_add_format(&formats, AV_SAMPLE_FMT_FLTP);
libavfilter/af_amix.c:535:5: variable `formats` declared here
533. static int query_formats(AVFilterContext *ctx)
534. {
535. AVFilterFormats *formats = NULL;
^
536. ff_add_format(&formats, AV_SAMPLE_FMT_FLT);
537. ff_add_format(&formats, AV_SAMPLE_FMT_FLTP);
libavfilter/af_amix.c:538:32: invalid access occurs here
536. ff_add_format(&formats, AV_SAMPLE_FMT_FLT);
537. ff_add_format(&formats, AV_SAMPLE_FMT_FLTP);
538. ff_set_common_formats(ctx, formats);
^
539. ff_set_common_channel_layouts(ctx, ff_all_channel_layouts());
540. ff_set_common_samplerates(ctx, ff_all_samplerates());
|
https://github.com/libav/libav/blob/f726fc21ef76a8ba3445448066f7b2a687fbca16/libavfilter/af_amix.c/#L538
|
d2a_code_trace_data_42119
|
static inline void skip_remaining(BitstreamContext *bc, unsigned n)
{
#ifdef BITSTREAM_READER_LE
bc->bits >>= n;
#else
bc->bits <<= n;
#endif
bc->bits_left -= n;
}
libavcodec/takdec.c:873: error: Integer Overflow L2
([0, +oo] - 24):unsigned32 by call to `bitstream_skip`.
libavcodec/takdec.c:872:5: Call
870. }
871.
872. bitstream_align(bc);
^
873. bitstream_skip(bc, 24);
874. if (bitstream_bits_left(bc) < 0)
libavcodec/bitstream.h:271:1: Parameter `bc->bits_left`
269.
270. /* Skip bits to a byte boundary. */
271. static inline const uint8_t *bitstream_align(BitstreamContext *bc)
^
272. {
273. unsigned n = -bitstream_tell(bc) & 7;
libavcodec/takdec.c:873:5: Call
871.
872. bitstream_align(bc);
873. bitstream_skip(bc, 24);
^
874. if (bitstream_bits_left(bc) < 0)
875. av_log(avctx, AV_LOG_DEBUG, "overread\n");
libavcodec/bitstream.h:241:1: Parameter `n`
239.
240. /* Skip n bits in the buffer. */
241. static inline void bitstream_skip(BitstreamContext *bc, unsigned n)
^
242. {
243. if (n <= bc->bits_left)
libavcodec/bitstream.h:244:9: Call
242. {
243. if (n <= bc->bits_left)
244. skip_remaining(bc, n);
^
245. else {
246. n -= bc->bits_left;
libavcodec/bitstream.h:230:1: <LHS trace>
228. }
229.
230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
^
231. {
232. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:230:1: Parameter `bc->bits_left`
228. }
229.
230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
^
231. {
232. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:230:1: <RHS trace>
228. }
229.
230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
^
231. {
232. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:230:1: Parameter `n`
228. }
229.
230. static inline void skip_remaining(BitstreamContext *bc, unsigned n)
^
231. {
232. #ifdef BITSTREAM_READER_LE
libavcodec/bitstream.h:237:5: Binary operation: ([0, +oo] - 24):unsigned32 by call to `bitstream_skip`
235. bc->bits <<= n;
236. #endif
237. bc->bits_left -= n;
^
238. }
239.
|
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L237
|
d2a_code_trace_data_42120
|
static inline void pred_direct_motion(H264Context * const h, int *mb_type){
MpegEncContext * const s = &h->s;
const int mb_xy = s->mb_x + s->mb_y*s->mb_stride;
const int b8_xy = 2*s->mb_x + 2*s->mb_y*h->b8_stride;
const int b4_xy = 4*s->mb_x + 4*s->mb_y*h->b_stride;
const int mb_type_col = h->ref_list[1][0].mb_type[mb_xy];
const int16_t (*l1mv0)[2] = (const int16_t (*)[2]) &h->ref_list[1][0].motion_val[0][b4_xy];
const int16_t (*l1mv1)[2] = (const int16_t (*)[2]) &h->ref_list[1][0].motion_val[1][b4_xy];
const int8_t *l1ref0 = &h->ref_list[1][0].ref_index[0][b8_xy];
const int8_t *l1ref1 = &h->ref_list[1][0].ref_index[1][b8_xy];
const int is_b8x8 = IS_8X8(*mb_type);
unsigned int sub_mb_type;
int i8, i4;
#define MB_TYPE_16x16_OR_INTRA (MB_TYPE_16x16|MB_TYPE_INTRA4x4|MB_TYPE_INTRA16x16|MB_TYPE_INTRA_PCM)
if(IS_8X8(mb_type_col) && !h->sps.direct_8x8_inference_flag){
sub_mb_type = MB_TYPE_8x8|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2;
*mb_type = MB_TYPE_8x8|MB_TYPE_L0L1;
}else if(!is_b8x8 && (mb_type_col & MB_TYPE_16x16_OR_INTRA)){
sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2;
*mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2;
}else{
sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2;
*mb_type = MB_TYPE_8x8|MB_TYPE_L0L1;
}
if(!is_b8x8)
*mb_type |= MB_TYPE_DIRECT2;
if(MB_FIELD)
*mb_type |= MB_TYPE_INTERLACED;
tprintf(s->avctx, "mb_type = %08x, sub_mb_type = %08x, is_b8x8 = %d, mb_type_col = %08x\n", *mb_type, sub_mb_type, is_b8x8, mb_type_col);
if(h->direct_spatial_mv_pred){
int ref[2];
int mv[2][2];
int list;
for(list=0; list<2; list++){
int refa = h->ref_cache[list][scan8[0] - 1];
int refb = h->ref_cache[list][scan8[0] - 8];
int refc = h->ref_cache[list][scan8[0] - 8 + 4];
if(refc == -2)
refc = h->ref_cache[list][scan8[0] - 8 - 1];
ref[list] = refa;
if(ref[list] < 0 || (refb < ref[list] && refb >= 0))
ref[list] = refb;
if(ref[list] < 0 || (refc < ref[list] && refc >= 0))
ref[list] = refc;
if(ref[list] < 0)
ref[list] = -1;
}
if(ref[0] < 0 && ref[1] < 0){
ref[0] = ref[1] = 0;
mv[0][0] = mv[0][1] =
mv[1][0] = mv[1][1] = 0;
}else{
for(list=0; list<2; list++){
if(ref[list] >= 0)
pred_motion(h, 0, 4, list, ref[list], &mv[list][0], &mv[list][1]);
else
mv[list][0] = mv[list][1] = 0;
}
}
if(ref[1] < 0){
if(!is_b8x8)
*mb_type &= ~MB_TYPE_L1;
sub_mb_type &= ~MB_TYPE_L1;
}else if(ref[0] < 0){
if(!is_b8x8)
*mb_type &= ~MB_TYPE_L0;
sub_mb_type &= ~MB_TYPE_L0;
}
if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col)){
int pair_xy = s->mb_x + (s->mb_y&~1)*s->mb_stride;
int mb_types_col[2];
int b8_stride = h->b8_stride;
int b4_stride = h->b_stride;
*mb_type = (*mb_type & ~MB_TYPE_16x16) | MB_TYPE_8x8;
if(IS_INTERLACED(*mb_type)){
mb_types_col[0] = h->ref_list[1][0].mb_type[pair_xy];
mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy+s->mb_stride];
if(s->mb_y&1){
l1ref0 -= 2*b8_stride;
l1ref1 -= 2*b8_stride;
l1mv0 -= 4*b4_stride;
l1mv1 -= 4*b4_stride;
}
b8_stride *= 3;
b4_stride *= 6;
}else{
int cur_poc = s->current_picture_ptr->poc;
int *col_poc = h->ref_list[1]->field_poc;
int col_parity = FFABS(col_poc[0] - cur_poc) >= FFABS(col_poc[1] - cur_poc);
int dy = 2*col_parity - (s->mb_y&1);
mb_types_col[0] =
mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy + col_parity*s->mb_stride];
l1ref0 += dy*b8_stride;
l1ref1 += dy*b8_stride;
l1mv0 += 2*dy*b4_stride;
l1mv1 += 2*dy*b4_stride;
b8_stride = 0;
}
for(i8=0; i8<4; i8++){
int x8 = i8&1;
int y8 = i8>>1;
int xy8 = x8+y8*b8_stride;
int xy4 = 3*x8+y8*b4_stride;
int a=0, b=0;
if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8]))
continue;
h->sub_mb_type[i8] = sub_mb_type;
fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1);
fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1);
if(!IS_INTRA(mb_types_col[y8])
&& ( (l1ref0[xy8] == 0 && FFABS(l1mv0[xy4][0]) <= 1 && FFABS(l1mv0[xy4][1]) <= 1)
|| (l1ref0[xy8] < 0 && l1ref1[xy8] == 0 && FFABS(l1mv1[xy4][0]) <= 1 && FFABS(l1mv1[xy4][1]) <= 1))){
if(ref[0] > 0)
a= pack16to32(mv[0][0],mv[0][1]);
if(ref[1] > 0)
b= pack16to32(mv[1][0],mv[1][1]);
}else{
a= pack16to32(mv[0][0],mv[0][1]);
b= pack16to32(mv[1][0],mv[1][1]);
}
fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, a, 4);
fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, b, 4);
}
}else if(IS_16X16(*mb_type)){
int a=0, b=0;
fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, (uint8_t)ref[0], 1);
fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, (uint8_t)ref[1], 1);
if(!IS_INTRA(mb_type_col)
&& ( (l1ref0[0] == 0 && FFABS(l1mv0[0][0]) <= 1 && FFABS(l1mv0[0][1]) <= 1)
|| (l1ref0[0] < 0 && l1ref1[0] == 0 && FFABS(l1mv1[0][0]) <= 1 && FFABS(l1mv1[0][1]) <= 1
&& (h->x264_build>33 || !h->x264_build)))){
if(ref[0] > 0)
a= pack16to32(mv[0][0],mv[0][1]);
if(ref[1] > 0)
b= pack16to32(mv[1][0],mv[1][1]);
}else{
a= pack16to32(mv[0][0],mv[0][1]);
b= pack16to32(mv[1][0],mv[1][1]);
}
fill_rectangle(&h->mv_cache[0][scan8[0]], 4, 4, 8, a, 4);
fill_rectangle(&h->mv_cache[1][scan8[0]], 4, 4, 8, b, 4);
}else{
for(i8=0; i8<4; i8++){
const int x8 = i8&1;
const int y8 = i8>>1;
if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8]))
continue;
h->sub_mb_type[i8] = sub_mb_type;
fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mv[0][0],mv[0][1]), 4);
fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mv[1][0],mv[1][1]), 4);
fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1);
fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1);
if(!IS_INTRA(mb_type_col) && ( l1ref0[x8 + y8*h->b8_stride] == 0
|| (l1ref0[x8 + y8*h->b8_stride] < 0 && l1ref1[x8 + y8*h->b8_stride] == 0
&& (h->x264_build>33 || !h->x264_build)))){
const int16_t (*l1mv)[2]= l1ref0[x8 + y8*h->b8_stride] == 0 ? l1mv0 : l1mv1;
if(IS_SUB_8X8(sub_mb_type)){
const int16_t *mv_col = l1mv[x8*3 + y8*3*h->b_stride];
if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){
if(ref[0] == 0)
fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4);
if(ref[1] == 0)
fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4);
}
}else
for(i4=0; i4<4; i4++){
const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*h->b_stride];
if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){
if(ref[0] == 0)
*(uint32_t*)h->mv_cache[0][scan8[i8*4+i4]] = 0;
if(ref[1] == 0)
*(uint32_t*)h->mv_cache[1][scan8[i8*4+i4]] = 0;
}
}
}
}
}
}else{
const int *map_col_to_list0[2] = {h->map_col_to_list0[0], h->map_col_to_list0[1]};
const int *dist_scale_factor = h->dist_scale_factor;
if(FRAME_MBAFF){
if(IS_INTERLACED(*mb_type)){
map_col_to_list0[0] = h->map_col_to_list0_field[0];
map_col_to_list0[1] = h->map_col_to_list0_field[1];
dist_scale_factor = h->dist_scale_factor_field;
}
if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col)){
const int pair_xy = s->mb_x + (s->mb_y&~1)*s->mb_stride;
int mb_types_col[2];
int y_shift;
*mb_type = MB_TYPE_8x8|MB_TYPE_L0L1
| (is_b8x8 ? 0 : MB_TYPE_DIRECT2)
| (*mb_type & MB_TYPE_INTERLACED);
sub_mb_type = MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2|MB_TYPE_16x16;
if(IS_INTERLACED(*mb_type)){
mb_types_col[0] = h->ref_list[1][0].mb_type[pair_xy];
mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy+s->mb_stride];
if(s->mb_y&1){
l1ref0 -= 2*h->b8_stride;
l1ref1 -= 2*h->b8_stride;
l1mv0 -= 4*h->b_stride;
l1mv1 -= 4*h->b_stride;
}
y_shift = 0;
if( (mb_types_col[0] & MB_TYPE_16x16_OR_INTRA)
&& (mb_types_col[1] & MB_TYPE_16x16_OR_INTRA)
&& !is_b8x8)
*mb_type |= MB_TYPE_16x8;
else
*mb_type |= MB_TYPE_8x8;
}else{
int dy = (s->mb_y&1) ? 1 : 2;
mb_types_col[0] =
mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy+s->mb_stride];
l1ref0 += dy*h->b8_stride;
l1ref1 += dy*h->b8_stride;
l1mv0 += 2*dy*h->b_stride;
l1mv1 += 2*dy*h->b_stride;
y_shift = 2;
if((mb_types_col[0] & (MB_TYPE_16x16_OR_INTRA|MB_TYPE_16x8))
&& !is_b8x8)
*mb_type |= MB_TYPE_16x16;
else
*mb_type |= MB_TYPE_8x8;
}
for(i8=0; i8<4; i8++){
const int x8 = i8&1;
const int y8 = i8>>1;
int ref0, scale;
const int16_t (*l1mv)[2]= l1mv0;
if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8]))
continue;
h->sub_mb_type[i8] = sub_mb_type;
fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, 0, 1);
if(IS_INTRA(mb_types_col[y8])){
fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, 0, 1);
fill_rectangle(&h-> mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4);
fill_rectangle(&h-> mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4);
continue;
}
ref0 = l1ref0[x8 + (y8*2>>y_shift)*h->b8_stride];
if(ref0 >= 0)
ref0 = map_col_to_list0[0][ref0*2>>y_shift];
else{
ref0 = map_col_to_list0[1][l1ref1[x8 + (y8*2>>y_shift)*h->b8_stride]*2>>y_shift];
l1mv= l1mv1;
}
scale = dist_scale_factor[ref0];
fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1);
{
const int16_t *mv_col = l1mv[x8*3 + (y8*6>>y_shift)*h->b_stride];
int my_col = (mv_col[1]<<y_shift)/2;
int mx = (scale * mv_col[0] + 128) >> 8;
int my = (scale * my_col + 128) >> 8;
fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mx,my), 4);
fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mx-mv_col[0],my-my_col), 4);
}
}
return;
}
}
if(IS_16X16(*mb_type)){
int ref, mv0, mv1;
fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, 0, 1);
if(IS_INTRA(mb_type_col)){
ref=mv0=mv1=0;
}else{
const int ref0 = l1ref0[0] >= 0 ? map_col_to_list0[0][l1ref0[0]]
: map_col_to_list0[1][l1ref1[0]];
const int scale = dist_scale_factor[ref0];
const int16_t *mv_col = l1ref0[0] >= 0 ? l1mv0[0] : l1mv1[0];
int mv_l0[2];
mv_l0[0] = (scale * mv_col[0] + 128) >> 8;
mv_l0[1] = (scale * mv_col[1] + 128) >> 8;
ref= ref0;
mv0= pack16to32(mv_l0[0],mv_l0[1]);
mv1= pack16to32(mv_l0[0]-mv_col[0],mv_l0[1]-mv_col[1]);
}
fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, ref, 1);
fill_rectangle(&h-> mv_cache[0][scan8[0]], 4, 4, 8, mv0, 4);
fill_rectangle(&h-> mv_cache[1][scan8[0]], 4, 4, 8, mv1, 4);
}else{
for(i8=0; i8<4; i8++){
const int x8 = i8&1;
const int y8 = i8>>1;
int ref0, scale;
const int16_t (*l1mv)[2]= l1mv0;
if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8]))
continue;
h->sub_mb_type[i8] = sub_mb_type;
fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, 0, 1);
if(IS_INTRA(mb_type_col)){
fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, 0, 1);
fill_rectangle(&h-> mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4);
fill_rectangle(&h-> mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4);
continue;
}
ref0 = l1ref0[x8 + y8*h->b8_stride];
if(ref0 >= 0)
ref0 = map_col_to_list0[0][ref0];
else{
ref0 = map_col_to_list0[1][l1ref1[x8 + y8*h->b8_stride]];
l1mv= l1mv1;
}
scale = dist_scale_factor[ref0];
fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1);
if(IS_SUB_8X8(sub_mb_type)){
const int16_t *mv_col = l1mv[x8*3 + y8*3*h->b_stride];
int mx = (scale * mv_col[0] + 128) >> 8;
int my = (scale * mv_col[1] + 128) >> 8;
fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mx,my), 4);
fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mx-mv_col[0],my-mv_col[1]), 4);
}else
for(i4=0; i4<4; i4++){
const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*h->b_stride];
int16_t *mv_l0 = h->mv_cache[0][scan8[i8*4+i4]];
mv_l0[0] = (scale * mv_col[0] + 128) >> 8;
mv_l0[1] = (scale * mv_col[1] + 128) >> 8;
*(uint32_t*)h->mv_cache[1][scan8[i8*4+i4]] =
pack16to32(mv_l0[0]-mv_col[0],mv_l0[1]-mv_col[1]);
}
}
}
}
}
libavcodec/h264.c:1019: error: Uninitialized Value
The value read from ref[_] was never initialized.
libavcodec/h264.c:1019:21:
1017. for(list=0; list<2; list++){
1018. if(ref[list] >= 0)
1019. pred_motion(h, 0, 4, list, ref[list], &mv[list][0], &mv[list][1]);
^
1020. else
1021. mv[list][0] = mv[list][1] = 0;
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L1019
|
d2a_code_trace_data_42121
|
static int var_diamond_search(MpegEncContext * s, int *best, int dmin,
int src_index, int ref_index, int const penalty_factor,
int size, int h, int flags)
{
MotionEstContext * const c= &s->me;
me_cmp_func cmpf, chroma_cmpf;
int dia_size;
LOAD_COMMON
LOAD_COMMON2
int map_generation= c->map_generation;
cmpf= s->dsp.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1];
for(dia_size=1; dia_size<=c->dia_size; dia_size++){
int dir, start, end;
const int x= best[0];
const int y= best[1];
start= FFMAX(0, y + dia_size - ymax);
end = FFMIN(dia_size, xmax - x + 1);
for(dir= start; dir<end; dir++){
int d;
CHECK_MV(x + dir , y + dia_size - dir);
}
start= FFMAX(0, x + dia_size - xmax);
end = FFMIN(dia_size, y - ymin + 1);
for(dir= start; dir<end; dir++){
int d;
CHECK_MV(x + dia_size - dir, y - dir );
}
start= FFMAX(0, -y + dia_size + ymin );
end = FFMIN(dia_size, x - xmin + 1);
for(dir= start; dir<end; dir++){
int d;
CHECK_MV(x - dir , y - dia_size + dir);
}
start= FFMAX(0, -x + dia_size + xmin );
end = FFMIN(dia_size, ymax - y + 1);
for(dir= start; dir<end; dir++){
int d;
CHECK_MV(x - dia_size + dir, y + dir );
}
if(x!=best[0] || y!=best[1])
dia_size=0;
#if 0
{
int dx, dy, i;
static int stats[8*8];
dx= FFABS(x-best[0]);
dy= FFABS(y-best[1]);
stats[dy*8 + dx] ++;
if(256*256*256*64 % (stats[0]+1)==0){
for(i=0; i<64; i++){
if((i&7)==0) printf("\n");
printf("%6d ", stats[i]);
}
printf("\n");
}
}
#endif
}
return dmin;
}
libavcodec/motion_est_template.c:921: error: Uninitialized Value
The value read from xmax was never initialized.
libavcodec/motion_est_template.c:921:13:
919.
920. //check(x + dir,y + dia_size - dir,0, a0)
921. CHECK_MV(x + dir , y + dia_size - dir);
^
922. }
923.
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L921
|
d2a_code_trace_data_42122
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/ec/ec_lib.c:1076: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_exp_mont`.
Showing all 52 steps of the trace
crypto/ec/ec_lib.c:1047:1: Parameter `ctx->stack.depth`
1045. }
1046.
1047. > static int ec_field_inverse_mod_ord(const EC_GROUP *group, BIGNUM *r,
1048. const BIGNUM *x, BN_CTX *ctx)
1049. {
crypto/ec/ec_lib.c:1060:5: Call
1058. return 0;
1059.
1060. BN_CTX_start(ctx);
^
1061. if ((e = BN_CTX_get(ctx)) == NULL)
1062. 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/ec/ec_lib.c:1076:10: Call
1074. * No need for scatter-gather or BN_FLG_CONSTTIME.
1075. */
1076. if (!BN_mod_exp_mont(r, x, e, group->order, ctx, group->mont_data))
^
1077. goto err;
1078.
crypto/bn/bn_exp.c:296:1: Parameter `ctx->stack.depth`
294. }
295.
296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
297. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
298. {
crypto/bn/bn_exp.c:310:16: Call
308. || BN_get_flags(a, BN_FLG_CONSTTIME) != 0
309. || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) {
310. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);
^
311. }
312.
crypto/bn/bn_exp.c:592:1: Parameter `ctx->stack.depth`
590. * http://www.daemonology.net/hyperthreading-considered-harmful/)
591. */
592. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
593. const BIGNUM *m, BN_CTX *ctx,
594. BN_MONT_CTX *in_mont)
crypto/bn/bn_exp.c:636:5: Call
634. }
635.
636. BN_CTX_start(ctx);
^
637.
638. /*
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_exp.c:647:14: Call
645. if ((mont = BN_MONT_CTX_new()) == NULL)
646. goto err;
647. if (!BN_MONT_CTX_set(mont, m, ctx))
^
648. goto err;
649. }
crypto/bn/bn_mont.c:263:1: Parameter `ctx->stack.depth`
261. }
262.
263. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
264. {
265. int i, ret = 0;
crypto/bn/bn_mont.c:271:5: Call
269. return 0;
270.
271. BN_CTX_start(ctx);
^
272. if ((Ri = BN_CTX_get(ctx)) == NULL)
273. goto err;
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_mont.c:272:15: Call
270.
271. BN_CTX_start(ctx);
272. if ((Ri = BN_CTX_get(ctx)) == NULL)
^
273. goto err;
274. R = &(mont->RR); /* grab RR as a temp */
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_mont.c:351:19: Call
349. if (BN_is_one(&tmod))
350. BN_zero(Ri);
351. else if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL)
^
352. goto err;
353. if (!BN_lshift(Ri, Ri, BN_BITS2))
crypto/bn/bn_gcd.c:124:1: Parameter `ctx->stack.depth`
122. BN_CTX *ctx);
123.
124. > BIGNUM *BN_mod_inverse(BIGNUM *in,
125. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx)
126. {
crypto/bn/bn_gcd.c:129:10: Call
127. BIGNUM *rv;
128. int noinv;
129. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv);
^
130. if (noinv)
131. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE);
crypto/bn/bn_gcd.c:135:1: Parameter `ctx->stack.depth`
133. }
134.
135. > BIGNUM *int_bn_mod_inverse(BIGNUM *in,
136. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx,
137. int *pnoinv)
crypto/bn/bn_gcd.c:155:16: Call
153. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0)
154. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) {
155. return BN_mod_inverse_no_branch(in, a, n, ctx);
^
156. }
157.
crypto/bn/bn_gcd.c:458:1: Parameter `ctx->stack.depth`
456. * not contain branches that may leak sensitive information.
457. */
458. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in,
459. const BIGNUM *a, const BIGNUM *n,
460. BN_CTX *ctx)
crypto/bn/bn_gcd.c:469:5: Call
467. bn_check_top(n);
468.
469. BN_CTX_start(ctx);
^
470. A = BN_CTX_get(ctx);
471. B = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_gcd.c:470:9: Call
468.
469. BN_CTX_start(ctx);
470. A = BN_CTX_get(ctx);
^
471. B = BN_CTX_get(ctx);
472. X = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_gcd.c:471:9: Call
469. BN_CTX_start(ctx);
470. A = BN_CTX_get(ctx);
471. B = BN_CTX_get(ctx);
^
472. X = BN_CTX_get(ctx);
473. D = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_gcd.c:472:9: Call
470. A = BN_CTX_get(ctx);
471. B = BN_CTX_get(ctx);
472. X = BN_CTX_get(ctx);
^
473. D = BN_CTX_get(ctx);
474. M = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_gcd.c:473:9: Call
471. B = BN_CTX_get(ctx);
472. X = BN_CTX_get(ctx);
473. D = BN_CTX_get(ctx);
^
474. M = BN_CTX_get(ctx);
475. Y = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_gcd.c:474:9: Call
472. X = BN_CTX_get(ctx);
473. D = BN_CTX_get(ctx);
474. M = BN_CTX_get(ctx);
^
475. Y = BN_CTX_get(ctx);
476. T = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_gcd.c:475:9: Call
473. D = BN_CTX_get(ctx);
474. M = BN_CTX_get(ctx);
475. Y = BN_CTX_get(ctx);
^
476. T = BN_CTX_get(ctx);
477. if (T == NULL)
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_gcd.c:476:9: Call
474. M = BN_CTX_get(ctx);
475. Y = BN_CTX_get(ctx);
476. T = BN_CTX_get(ctx);
^
477. if (T == NULL)
478. goto err;
crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth`
200. }
201.
202. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
203. {
204. BIGNUM *ret;
crypto/bn/bn_gcd.c:504:18: Call
502. bn_init(&local_B);
503. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME);
504. if (!BN_nnmod(B, &local_B, A, ctx))
^
505. goto err;
506. /* Ensure local_B goes out of scope before any further use of B */
crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth`
11. #include "bn_lcl.h"
12.
13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx)
14. {
15. /*
crypto/bn/bn_mod.c:20:11: Call
18. */
19.
20. if (!(BN_mod(r, m, d, ctx)))
^
21. return 0;
22. if (!r->neg)
crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth`
207. * If 'dv' or 'rm' is NULL, the respective value is not returned.
208. */
209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
210. BN_CTX *ctx)
211. {
crypto/bn/bn_div.c:229:11: Call
227. }
228.
229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx);
^
230.
231. if (ret) {
crypto/bn/bn_div.c:280:5: Call
278. bn_check_top(rm);
279.
280. BN_CTX_start(ctx);
^
281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv;
282. tmp = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes`
169. }
170.
171. > void BN_CTX_start(BN_CTX *ctx)
172. {
173. CTXDBG("ENTER BN_CTX_start()", ctx);
crypto/bn/bn_div.c:450:5: Call
448. if (rm != NULL)
449. bn_rshift_fixed_top(rm, snum, norm_shift);
450. BN_CTX_end(ctx);
^
451. return 1;
452. err:
crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes`
183. }
184.
185. > void BN_CTX_end(BN_CTX *ctx)
186. {
187. CTXDBG("ENTER BN_CTX_end()", ctx);
crypto/bn/bn_ctx.c:191:27: Call
189. ctx->err_stack--;
190. else {
191. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
192. /* Does this stack frame have anything to release? */
193. if (fp < ctx->used)
crypto/bn/bn_ctx.c:266:1: <Offset trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `st->depth`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: <Length trace>
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes`
264. }
265.
266. > static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_exp_mont`
266. static unsigned int BN_STACK_pop(BN_STACK *st)
267. {
268. return st->indexes[--(st->depth)];
^
269. }
270.
|
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
|
d2a_code_trace_data_42123
|
BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d)
{
BN_ULONG dh,dl,q,ret=0,th,tl,t;
int i,count=2;
if (d == 0) return(BN_MASK2);
i=BN_num_bits_word(d);
assert((i == BN_BITS2) || (h > (BN_ULONG)1<<i));
i=BN_BITS2-i;
if (h >= d) h-=d;
if (i)
{
d<<=i;
h=(h<<i)|(l>>(BN_BITS2-i));
l<<=i;
}
dh=(d&BN_MASK2h)>>BN_BITS4;
dl=(d&BN_MASK2l);
for (;;)
{
if ((h>>BN_BITS4) == dh)
q=BN_MASK2l;
else
q=h/dh;
th=q*dh;
tl=dl*q;
for (;;)
{
t=h-th;
if ((t&BN_MASK2h) ||
((tl) <= (
(t<<BN_BITS4)|
((l&BN_MASK2h)>>BN_BITS4))))
break;
q--;
th-=dh;
tl-=dl;
}
t=(tl>>BN_BITS4);
tl=(tl<<BN_BITS4)&BN_MASK2h;
th+=t;
if (l < tl) th++;
l-=tl;
if (h < th)
{
h+=d;
q--;
}
h-=th;
if (--count == 0) break;
ret=q<<BN_BITS4;
h=((h<<BN_BITS4)|(l>>BN_BITS4))&BN_MASK2;
l=(l&BN_MASK2l)<<BN_BITS4;
}
ret|=q;
return(ret);
}
crypto/bn/bn_print.c:135: error: INTEGER_OVERFLOW_L2
([1, 4294967295] - [1, 1000000000]):unsigned64 by call to `BN_div_word`.
Showing all 8 steps of the trace
crypto/bn/bn_print.c:135:8: Call
133. while (!BN_is_zero(t))
134. {
135. *lp=BN_div_word(t,BN_DEC_CONV);
^
136. lp++;
137. }
crypto/bn/bn_word.c:88:2: Assignment
86. BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w)
87. {
88. BN_ULONG ret = 0;
^
89. int i;
90.
crypto/bn/bn_word.c:104:5: Call
102.
103. l=a->d[i];
104. d=bn_div_words(ret,l,w);
^
105. ret=(l-((d*w)&BN_MASK2))&BN_MASK2;
106. a->d[i]=d;
crypto/bn/bn_asm.c:232:1: <LHS trace>
230. /* Divide h,l by d and return the result. */
231. /* I need to test this some more :-( */
232. > BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d)
233. {
234. BN_ULONG dh,dl,q,ret=0,th,tl,t;
crypto/bn/bn_asm.c:232:1: Parameter `d`
230. /* Divide h,l by d and return the result. */
231. /* I need to test this some more :-( */
232. > BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d)
233. {
234. BN_ULONG dh,dl,q,ret=0,th,tl,t;
crypto/bn/bn_asm.c:232:1: <RHS trace>
230. /* Divide h,l by d and return the result. */
231. /* I need to test this some more :-( */
232. > BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d)
233. {
234. BN_ULONG dh,dl,q,ret=0,th,tl,t;
crypto/bn/bn_asm.c:232:1: Parameter `d`
230. /* Divide h,l by d and return the result. */
231. /* I need to test this some more :-( */
232. > BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d)
233. {
234. BN_ULONG dh,dl,q,ret=0,th,tl,t;
crypto/bn/bn_asm.c:243:14: Binary operation: ([1, 4294967295] - [1, 1000000000]):unsigned64 by call to `BN_div_word`
241.
242. i=BN_BITS2-i;
243. if (h >= d) h-=d;
^
244.
245. if (i)
|
https://github.com/openssl/openssl/blob/6defae04f3c44087d9129994fa88b4f9271b153f/crypto/bn/bn_asm.c/#L243
|
d2a_code_trace_data_42124
|
static void floor_encode(venc_context_t * venc, floor_t * fc, PutBitContext * pb, uint_fast16_t * posts, float * floor, int samples) {
int range = 255 / fc->multiplier + 1;
int coded[fc->values];
int i, counter;
put_bits(pb, 1, 1);
put_bits(pb, ilog(range - 1), posts[0]);
put_bits(pb, ilog(range - 1), posts[1]);
coded[0] = coded[1] = 1;
for (i = 2; i < fc->values; i++) {
int predicted = render_point(fc->list[fc->list[i].low].x,
posts[fc->list[i].low],
fc->list[fc->list[i].high].x,
posts[fc->list[i].high],
fc->list[i].x);
int highroom = range - predicted;
int lowroom = predicted;
int room = FFMIN(highroom, lowroom);
if (predicted == posts[i]) {
coded[i] = 0;
continue;
} else {
if (!coded[fc->list[i].low ]) coded[fc->list[i].low ] = -1;
if (!coded[fc->list[i].high]) coded[fc->list[i].high] = -1;
}
if (posts[i] > predicted) {
if (posts[i] - predicted > room)
coded[i] = posts[i] - predicted + lowroom;
else
coded[i] = (posts[i] - predicted) << 1;
} else {
if (predicted - posts[i] > room)
coded[i] = predicted - posts[i] + highroom - 1;
else
coded[i] = ((predicted - posts[i]) << 1) - 1;
}
}
counter = 2;
for (i = 0; i < fc->partitions; i++) {
floor_class_t * c = &fc->classes[fc->partition_to_class[i]];
int k, cval = 0, csub = 1<<c->subclass;
if (c->subclass) {
codebook_t * book = &venc->codebooks[c->masterbook];
int cshift = 0;
for (k = 0; k < c->dim; k++) {
int l;
for (l = 0; l < csub; l++) {
int maxval = 1;
if (c->books[l] != -1)
maxval = venc->codebooks[c->books[l]].nentries;
if (coded[counter + k] < maxval) break;
}
assert(l != csub);
cval |= l << cshift;
cshift += c->subclass;
}
put_codeword(pb, book, cval);
}
for (k = 0; k < c->dim; k++) {
int book = c->books[cval & (csub-1)];
int entry = coded[counter++];
cval >>= c->subclass;
if (book == -1) continue;
if (entry == -1) entry = 0;
put_codeword(pb, &venc->codebooks[book], entry);
}
}
ff_vorbis_floor1_render_list(fc->list, fc->values, posts, coded, fc->multiplier, floor, samples);
}
libavcodec/vorbis_enc.c:992: error: Buffer Overrun L3
Offset: [2, +oo] Size: [0, +oo] by call to `floor_encode`.
libavcodec/vorbis_enc.c:972:10: Call
970. int i;
971.
972. if (!apply_window_and_mdct(venc, audio, samples)) return 0;
^
973. samples = 1 << (venc->log2_blocksize[0] - 1);
974.
libavcodec/vorbis_enc.c:885:1: Parameter `venc->floor->re`
883. }
884.
885. static int apply_window_and_mdct(venc_context_t * venc, signed short * audio, int samples) {
^
886. int i, j, channel;
887. const float * win = venc->win[0];
libavcodec/vorbis_enc.c:990:29: Array declaration
988. for (i = 0; i < venc->channels; i++) {
989. floor_t * fc = &venc->floors[mapping->floor[mapping->mux[i]]];
990. uint_fast16_t posts[fc->values];
^
991. floor_fit(venc, fc, &venc->coeffs[i * samples], posts, samples);
992. floor_encode(venc, fc, &pb, posts, &venc->floor[i * samples], samples);
libavcodec/vorbis_enc.c:992:9: Call
990. uint_fast16_t posts[fc->values];
991. floor_fit(venc, fc, &venc->coeffs[i * samples], posts, samples);
992. floor_encode(venc, fc, &pb, posts, &venc->floor[i * samples], samples);
^
993. }
994.
libavcodec/vorbis_enc.c:707:1: <Offset trace>
705. }
706.
707. static void floor_encode(venc_context_t * venc, floor_t * fc, PutBitContext * pb, uint_fast16_t * posts, float * floor, int samples) {
^
708. int range = 255 / fc->multiplier + 1;
709. int coded[fc->values]; // first 2 values are unused
libavcodec/vorbis_enc.c:707:1: Parameter `fc->values`
705. }
706.
707. static void floor_encode(venc_context_t * venc, floor_t * fc, PutBitContext * pb, uint_fast16_t * posts, float * floor, int samples) {
^
708. int range = 255 / fc->multiplier + 1;
709. int coded[fc->values]; // first 2 values are unused
libavcodec/vorbis_enc.c:707:1: <Length trace>
705. }
706.
707. static void floor_encode(venc_context_t * venc, floor_t * fc, PutBitContext * pb, uint_fast16_t * posts, float * floor, int samples) {
^
708. int range = 255 / fc->multiplier + 1;
709. int coded[fc->values]; // first 2 values are unused
libavcodec/vorbis_enc.c:707:1: Parameter `*posts`
705. }
706.
707. static void floor_encode(venc_context_t * venc, floor_t * fc, PutBitContext * pb, uint_fast16_t * posts, float * floor, int samples) {
^
708. int range = 255 / fc->multiplier + 1;
709. int coded[fc->values]; // first 2 values are unused
libavcodec/vorbis_enc.c:726:26: Array access: Offset: [2, +oo] Size: [0, +oo] by call to `floor_encode`
724. int lowroom = predicted;
725. int room = FFMIN(highroom, lowroom);
726. if (predicted == posts[i]) {
^
727. coded[i] = 0; // must be used later as flag!
728. continue;
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vorbis_enc.c/#L726
|
d2a_code_trace_data_42125
|
static int sab_diamond_search(MpegEncContext * s, int *best, int dmin,
int src_index, int ref_index, int const penalty_factor,
int size, int h, int flags)
{
MotionEstContext * const c= &s->me;
me_cmp_func cmpf, chroma_cmpf;
Minima minima[MAX_SAB_SIZE];
const int minima_count= FFABS(c->dia_size);
int i, j;
LOAD_COMMON
LOAD_COMMON2
int map_generation= c->map_generation;
cmpf= s->dsp.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1];
for(j=i=0; i<ME_MAP_SIZE && j<MAX_SAB_SIZE; i++){
uint32_t key= map[i];
key += (1<<(ME_MAP_MV_BITS-1)) + (1<<(2*ME_MAP_MV_BITS-1));
if((key&((-1)<<(2*ME_MAP_MV_BITS))) != map_generation) continue;
minima[j].height= score_map[i];
minima[j].x= key & ((1<<ME_MAP_MV_BITS)-1); key>>=ME_MAP_MV_BITS;
minima[j].y= key & ((1<<ME_MAP_MV_BITS)-1);
minima[j].x-= (1<<(ME_MAP_MV_BITS-1));
minima[j].y-= (1<<(ME_MAP_MV_BITS-1));
if( minima[j].x > xmax || minima[j].x < xmin
|| minima[j].y > ymax || minima[j].y < ymin)
continue;
minima[j].checked=0;
if(minima[j].x || minima[j].y)
minima[j].height+= (mv_penalty[((minima[j].x)<<shift)-pred_x] + mv_penalty[((minima[j].y)<<shift)-pred_y])*penalty_factor;
j++;
}
qsort(minima, j, sizeof(Minima), minima_cmp);
for(; j<minima_count; j++){
minima[j].height=256*256*256*64;
minima[j].checked=0;
minima[j].x= minima[j].y=0;
}
for(i=0; i<minima_count; i++){
const int x= minima[i].x;
const int y= minima[i].y;
int d;
if(minima[i].checked) continue;
if( x >= xmax || x <= xmin
|| y >= ymax || y <= ymin)
continue;
SAB_CHECK_MV(x-1, y)
SAB_CHECK_MV(x+1, y)
SAB_CHECK_MV(x , y-1)
SAB_CHECK_MV(x , y+1)
minima[i].checked= 1;
}
best[0]= minima[0].x;
best[1]= minima[0].y;
dmin= minima[0].height;
if( best[0] < xmax && best[0] > xmin
&& best[1] < ymax && best[1] > ymin){
int d;
CHECK_MV(best[0]-1, best[1])
CHECK_MV(best[0]+1, best[1])
CHECK_MV(best[0], best[1]-1)
CHECK_MV(best[0], best[1]+1)
}
return dmin;
}
libavcodec/motion_est_template.c:869: error: Uninitialized Value
The value read from ymin was never initialized.
libavcodec/motion_est_template.c:869:28:
867.
868. if( x >= xmax || x <= xmin
869. || y >= ymax || y <= ymin)
^
870. continue;
871.
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L869
|
d2a_code_trace_data_42126
|
int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
const char *dir)
{
DIR *d;
struct dirent *dstruct;
int ret = 0;
CRYPTO_w_lock(CRYPTO_LOCK_READDIR);
d = opendir(dir);
if(!d)
{
SYSerr(SYS_F_OPENDIR, get_last_sys_error());
ERR_add_error_data(3, "opendir('", dir, "')");
SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK, ERR_R_SYS_LIB);
goto err;
}
while((dstruct=readdir(d)))
{
char buf[1024];
int r;
if(strlen(dir)+strlen(dstruct->d_name)+2 > sizeof buf)
{
SSLerr(SSL_F_SSL_ADD_DIR_CERT_SUBJECTS_TO_STACK,SSL_R_PATH_TOO_LONG);
goto err;
}
r = BIO_snprintf(buf,sizeof buf,"%s/%s",dir,dstruct->d_name);
if (r <= 0 || r >= sizeof buf)
goto err;
if(!SSL_add_file_cert_subjects_to_stack(stack,buf))
goto err;
}
ret = 1;
err:
CRYPTO_w_unlock(CRYPTO_LOCK_READDIR);
return ret;
}
ssl/ssl_cert.c:769: error: RESOURCE_LEAK
resource acquired to `ret` by call to `opendir()` at line 741, column 6 is not released after line 769, column 2.
Showing all 13 steps of the trace
ssl/ssl_cert.c:733:1: start of procedure SSL_add_dir_cert_subjects_to_stack()
731. #ifndef MAC_OS_pre_X
732.
733. > int SSL_add_dir_cert_subjects_to_stack(STACK_OF(X509_NAME) *stack,
734. const char *dir)
735. {
ssl/ssl_cert.c:738:2:
736. DIR *d;
737. struct dirent *dstruct;
738. > int ret = 0;
739.
740. CRYPTO_w_lock(CRYPTO_LOCK_READDIR);
ssl/ssl_cert.c:740:2:
738. int ret = 0;
739.
740. > CRYPTO_w_lock(CRYPTO_LOCK_READDIR);
741. d = opendir(dir);
742.
crypto/cryptlib.c:374:1: start of procedure CRYPTO_lock()
372. }
373.
374. > void CRYPTO_lock(int mode, int type, const char *file, int line)
375. {
376. #ifdef LOCK_DEBUG
crypto/cryptlib.c:399:6: Taking false branch
397. }
398. #endif
399. if (type < 0)
^
400. {
401. struct CRYPTO_dynlock_value *pointer
crypto/cryptlib.c:412:7: Taking true branch
410. }
411. else
412. if (locking_callback != NULL)
^
413. locking_callback(mode,type,file,line);
414. }
crypto/cryptlib.c:413:4: Skipping __function_pointer__(): unresolved function pointer
411. else
412. if (locking_callback != NULL)
413. locking_callback(mode,type,file,line);
^
414. }
415.
crypto/cryptlib.c:399:2:
397. }
398. #endif
399. > if (type < 0)
400. {
401. struct CRYPTO_dynlock_value *pointer
crypto/cryptlib.c:414:2: return from a call to CRYPTO_lock
412. if (locking_callback != NULL)
413. locking_callback(mode,type,file,line);
414. }
^
415.
416. int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,
ssl/ssl_cert.c:741:2:
739.
740. CRYPTO_w_lock(CRYPTO_LOCK_READDIR);
741. > d = opendir(dir);
742.
743. /* Note that a side effect is that the CAs will be sorted by name */
ssl/ssl_cert.c:744:6: Taking false branch
742.
743. /* Note that a side effect is that the CAs will be sorted by name */
744. if(!d)
^
745. {
746. SYSerr(SYS_F_OPENDIR, get_last_sys_error());
ssl/ssl_cert.c:752:9: Loop condition is false. Leaving loop
750. }
751.
752. while((dstruct=readdir(d)))
^
753. {
754. char buf[1024];
ssl/ssl_cert.c:769:2:
767. goto err;
768. }
769. > ret = 1;
770.
771. err:
|
https://github.com/openssl/openssl/blob/467889703a79df3ff98a1913b7556c41130025a4/ssl/ssl_cert.c/#L769
|
d2a_code_trace_data_42127
|
static int http_parse_request(HTTPContext *c)
{
char *p;
enum RedirType redir_type;
char cmd[32];
char info[1024], filename[1024];
char url[1024], *q;
char protocol[32];
char msg[1024];
const char *mime_type;
FFStream *stream;
int i;
char ratebuf[32];
char *useragent = 0;
p = c->buffer;
get_word(cmd, sizeof(cmd), (const char **)&p);
av_strlcpy(c->method, cmd, sizeof(c->method));
if (!strcmp(cmd, "GET"))
c->post = 0;
else if (!strcmp(cmd, "POST"))
c->post = 1;
else
return -1;
get_word(url, sizeof(url), (const char **)&p);
av_strlcpy(c->url, url, sizeof(c->url));
get_word(protocol, sizeof(protocol), (const char **)&p);
if (strcmp(protocol, "HTTP/1.0") && strcmp(protocol, "HTTP/1.1"))
return -1;
av_strlcpy(c->protocol, protocol, sizeof(c->protocol));
if (ffserver_debug)
http_log("New connection: %s %s\n", cmd, url);
p = strchr(url, '?');
if (p) {
av_strlcpy(info, p, sizeof(info));
*p = '\0';
} else
info[0] = '\0';
av_strlcpy(filename, url + ((*url == '/') ? 1 : 0), sizeof(filename)-1);
for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
if (strncasecmp(p, "User-Agent:", 11) == 0) {
useragent = p + 11;
if (*useragent && *useragent != '\n' && isspace(*useragent))
useragent++;
break;
}
p = strchr(p, '\n');
if (!p)
break;
p++;
}
redir_type = REDIR_NONE;
if (match_ext(filename, "asx")) {
redir_type = REDIR_ASX;
filename[strlen(filename)-1] = 'f';
} else if (match_ext(filename, "asf") &&
(!useragent || strncasecmp(useragent, "NSPlayer", 8) != 0)) {
redir_type = REDIR_ASF;
} else if (match_ext(filename, "rpm,ram")) {
redir_type = REDIR_RAM;
strcpy(filename + strlen(filename)-2, "m");
} else if (match_ext(filename, "rtsp")) {
redir_type = REDIR_RTSP;
compute_real_filename(filename, sizeof(filename) - 1);
} else if (match_ext(filename, "sdp")) {
redir_type = REDIR_SDP;
compute_real_filename(filename, sizeof(filename) - 1);
}
if (!strlen(filename))
av_strlcpy(filename, "index.html", sizeof(filename) - 1);
stream = first_stream;
while (stream != NULL) {
if (!strcmp(stream->filename, filename) && validate_acl(stream, c))
break;
stream = stream->next;
}
if (stream == NULL) {
snprintf(msg, sizeof(msg), "File '%s' not found", url);
goto send_error;
}
c->stream = stream;
memcpy(c->feed_streams, stream->feed_streams, sizeof(c->feed_streams));
memset(c->switch_feed_streams, -1, sizeof(c->switch_feed_streams));
if (stream->stream_type == STREAM_TYPE_REDIRECT) {
c->http_error = 301;
q = c->buffer;
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 301 Moved\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Location: %s\r\n", stream->feed_filename);
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: text/html\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<html><head><title>Moved</title></head><body>\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "You should be <a href=\"%s\">redirected</a>.\r\n", stream->feed_filename);
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "</body></html>\r\n");
c->buffer_ptr = c->buffer;
c->buffer_end = q;
c->state = HTTPSTATE_SEND_HEADER;
return 0;
}
if (extract_rates(ratebuf, sizeof(ratebuf), c->buffer)) {
if (modify_current_stream(c, ratebuf)) {
for (i = 0; i < sizeof(c->feed_streams) / sizeof(c->feed_streams[0]); i++) {
if (c->switch_feed_streams[i] >= 0)
do_switch_stream(c, i);
}
}
}
if (stream->feed_opened) {
snprintf(msg, sizeof(msg), "This feed is already being received.");
goto send_error;
}
if (c->post == 0 && stream->stream_type == STREAM_TYPE_LIVE)
current_bandwidth += stream->bandwidth;
if (c->post == 0 && max_bandwidth < current_bandwidth) {
c->http_error = 200;
q = c->buffer;
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 Server too busy\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: text/html\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<html><head><title>Too busy</title></head><body>\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<p>The server is too busy to serve your request at this time.</p>\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<p>The bandwidth being served (including your stream) is %dkbit/sec, and this exceeds the limit of %dkbit/sec.</p>\r\n",
current_bandwidth, max_bandwidth);
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "</body></html>\r\n");
c->buffer_ptr = c->buffer;
c->buffer_end = q;
c->state = HTTPSTATE_SEND_HEADER;
return 0;
}
if (redir_type != REDIR_NONE) {
char *hostinfo = 0;
for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
if (strncasecmp(p, "Host:", 5) == 0) {
hostinfo = p + 5;
break;
}
p = strchr(p, '\n');
if (!p)
break;
p++;
}
if (hostinfo) {
char *eoh;
char hostbuf[260];
while (isspace(*hostinfo))
hostinfo++;
eoh = strchr(hostinfo, '\n');
if (eoh) {
if (eoh[-1] == '\r')
eoh--;
if (eoh - hostinfo < sizeof(hostbuf) - 1) {
memcpy(hostbuf, hostinfo, eoh - hostinfo);
hostbuf[eoh - hostinfo] = 0;
c->http_error = 200;
q = c->buffer;
switch(redir_type) {
case REDIR_ASX:
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 ASX Follows\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: video/x-ms-asf\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<ASX Version=\"3\">\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<ENTRY><REF HREF=\"http://%s/%s%s\"/></ENTRY>\r\n",
hostbuf, filename, info);
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "</ASX>\r\n");
break;
case REDIR_RAM:
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 RAM Follows\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: audio/x-pn-realaudio\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "# Autogenerated by ffserver\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "http://%s/%s%s\r\n",
hostbuf, filename, info);
break;
case REDIR_ASF:
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 ASF Redirect follows\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: video/x-ms-asf\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "[Reference]\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Ref1=http://%s/%s%s\r\n",
hostbuf, filename, info);
break;
case REDIR_RTSP:
{
char hostname[256], *p;
av_strlcpy(hostname, hostbuf, sizeof(hostname));
p = strrchr(hostname, ':');
if (p)
*p = '\0';
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 RTSP Redirect follows\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: application/x-rtsp\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "rtsp://%s:%d/%s\r\n",
hostname, ntohs(my_rtsp_addr.sin_port),
filename);
}
break;
case REDIR_SDP:
{
uint8_t *sdp_data;
int sdp_data_size, len;
struct sockaddr_in my_addr;
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 OK\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: application/sdp\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
len = sizeof(my_addr);
getsockname(c->fd, (struct sockaddr *)&my_addr, &len);
sdp_data_size = prepare_sdp_description(stream,
&sdp_data,
my_addr.sin_addr);
if (sdp_data_size > 0) {
memcpy(q, sdp_data, sdp_data_size);
q += sdp_data_size;
*q = '\0';
av_free(sdp_data);
}
}
break;
default:
abort();
break;
}
c->buffer_ptr = c->buffer;
c->buffer_end = q;
c->state = HTTPSTATE_SEND_HEADER;
return 0;
}
}
}
snprintf(msg, sizeof(msg), "ASX/RAM file not handled");
goto send_error;
}
stream->conns_served++;
if (c->post) {
if (!stream->is_feed) {
char *logline = 0;
int client_id = 0;
for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
if (strncasecmp(p, "Pragma: log-line=", 17) == 0) {
logline = p;
break;
}
if (strncasecmp(p, "Pragma: client-id=", 18) == 0)
client_id = strtol(p + 18, 0, 10);
p = strchr(p, '\n');
if (!p)
break;
p++;
}
if (logline) {
char *eol = strchr(logline, '\n');
logline += 17;
if (eol) {
if (eol[-1] == '\r')
eol--;
http_log("%.*s\n", (int) (eol - logline), logline);
c->suppress_log = 1;
}
}
#ifdef DEBUG_WMP
http_log("\nGot request:\n%s\n", c->buffer);
#endif
if (client_id && extract_rates(ratebuf, sizeof(ratebuf), c->buffer)) {
HTTPContext *wmpc;
for (wmpc = first_http_ctx; wmpc; wmpc = wmpc->next) {
if (wmpc->wmp_client_id == client_id)
break;
}
if (wmpc && modify_current_stream(wmpc, ratebuf))
wmpc->switch_pending = 1;
}
snprintf(msg, sizeof(msg), "POST command not handled");
c->stream = 0;
goto send_error;
}
if (http_start_receive_data(c) < 0) {
snprintf(msg, sizeof(msg), "could not open feed");
goto send_error;
}
c->http_error = 0;
c->state = HTTPSTATE_RECEIVE_DATA;
return 0;
}
#ifdef DEBUG_WMP
if (strcmp(stream->filename + strlen(stream->filename) - 4, ".asf") == 0)
http_log("\nGot request:\n%s\n", c->buffer);
#endif
if (c->stream->stream_type == STREAM_TYPE_STATUS)
goto send_stats;
if (open_input_stream(c, info) < 0) {
snprintf(msg, sizeof(msg), "Input stream corresponding to '%s' not found", url);
goto send_error;
}
q = c->buffer;
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 200 OK\r\n");
mime_type = c->stream->fmt->mime_type;
if (!mime_type)
mime_type = "application/x-octet-stream";
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Pragma: no-cache\r\n");
if (!strcmp(c->stream->fmt->name,"asf_stream")) {
c->wmp_client_id = av_random(&random_state) & 0x7fffffff;
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Server: Cougar 4.1.0.3923\r\nCache-Control: no-cache\r\nPragma: client-id=%d\r\nPragma: features=\"broadcast\"\r\n", c->wmp_client_id);
}
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-Type: %s\r\n", mime_type);
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
c->http_error = 0;
c->buffer_ptr = c->buffer;
c->buffer_end = q;
c->state = HTTPSTATE_SEND_HEADER;
return 0;
send_error:
c->http_error = 404;
q = c->buffer;
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "HTTP/1.0 404 Not Found\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "Content-type: %s\r\n", "text/html");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "\r\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<HTML>\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<HEAD><TITLE>404 Not Found</TITLE></HEAD>\n");
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "<BODY>%s</BODY>\n", msg);
q += snprintf(q, q - (char *) c->buffer + c->buffer_size, "</HTML>\n");
c->buffer_ptr = c->buffer;
c->buffer_end = q;
c->state = HTTPSTATE_SEND_HEADER;
return 0;
send_stats:
compute_stats(c);
c->http_error = 200;
c->state = HTTPSTATE_SEND_HEADER;
return 0;
}
ffserver.c:1239: error: Integer Overflow L2
([0, +oo] - 1):unsigned64.
ffserver.c:1174:1: <LHS trace>
1172.
1173. /* parse http request and prepare header */
1174. static int http_parse_request(HTTPContext *c)
^
1175. {
1176. char *p;
ffserver.c:1174:1: Array declaration
1172.
1173. /* parse http request and prepare header */
1174. static int http_parse_request(HTTPContext *c)
^
1175. {
1176. char *p;
ffserver.c:1220:5: Call
1218. info[0] = '\0';
1219.
1220. av_strlcpy(filename, url + ((*url == '/') ? 1 : 0), sizeof(filename)-1);
^
1221.
1222. for (p = c->buffer; *p && *p != '\r' && *p != '\n'; ) {
libavutil/string.c:50:1: Parameter `*dst`
48. }
49.
50. size_t av_strlcpy(char *dst, const char *src, size_t size)
^
51. {
52. size_t len = 0;
ffserver.c:1239:9: Binary operation: ([0, +oo] - 1):unsigned64
1237. if (match_ext(filename, "asx")) {
1238. redir_type = REDIR_ASX;
1239. filename[strlen(filename)-1] = 'f';
^
1240. } else if (match_ext(filename, "asf") &&
1241. (!useragent || strncasecmp(useragent, "NSPlayer", 8) != 0)) {
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/ffserver.c/#L1239
|
d2a_code_trace_data_42128
|
static int nss_keylog_int(const char *prefix,
SSL *ssl,
const uint8_t *parameter_1,
size_t parameter_1_len,
const uint8_t *parameter_2,
size_t parameter_2_len)
{
char *out = NULL;
char *cursor = NULL;
size_t out_len = 0;
size_t i;
size_t prefix_len;
if (ssl->ctx->keylog_callback == NULL) return 1;
prefix_len = strlen(prefix);
out_len = prefix_len + (2*parameter_1_len) + (2*parameter_2_len) + 3;
if ((out = cursor = OPENSSL_malloc(out_len)) == NULL) {
SSLerr(SSL_F_NSS_KEYLOG_INT, ERR_R_MALLOC_FAILURE);
return 0;
}
strcpy(cursor, prefix);
cursor += prefix_len;
*cursor++ = ' ';
for (i = 0; i < parameter_1_len; i++) {
sprintf(cursor, "%02x", parameter_1[i]);
cursor += 2;
}
*cursor++ = ' ';
for (i = 0; i < parameter_2_len; i++) {
sprintf(cursor, "%02x", parameter_2[i]);
cursor += 2;
}
*cursor = '\0';
ssl->ctx->keylog_callback(ssl, (const char *)out);
OPENSSL_free(out);
return 1;
}
ssl/statem/statem_clnt.c:2538: error: BUFFER_OVERRUN_L3
Offset: [4, +oo] Size: [1, 118] by call to `ssl_log_rsa_client_key_exchange`.
Showing all 10 steps of the trace
ssl/statem/statem_clnt.c:2488:5: Assignment
2486. }
2487.
2488. pmslen = SSL_MAX_MASTER_KEY_LENGTH;
^
2489. pms = OPENSSL_malloc(pmslen);
2490. if (pms == NULL) {
ssl/statem/statem_clnt.c:2538:10: Call
2536.
2537. /* Log the premaster secret, if logging is enabled. */
2538. if (!ssl_log_rsa_client_key_exchange(s, encdata, enclen, pms, pmslen))
^
2539. goto err;
2540.
ssl/ssl_lib.c:4410:1: Parameter `premaster_len`
4408. }
4409.
4410. > int ssl_log_rsa_client_key_exchange(SSL *ssl,
4411. const uint8_t *encrypted_premaster,
4412. size_t encrypted_premaster_len,
ssl/ssl_lib.c:4422:12: Call
4420.
4421. /* We only want the first 8 bytes of the encrypted premaster as a tag. */
4422. return nss_keylog_int("RSA",
^
4423. ssl,
4424. encrypted_premaster,
ssl/ssl_lib.c:4358:1: <Length trace>
4356. }
4357.
4358. > static int nss_keylog_int(const char *prefix,
4359. SSL *ssl,
4360. const uint8_t *parameter_1,
ssl/ssl_lib.c:4358:1: Parameter `prefix->strlen`
4356. }
4357.
4358. > static int nss_keylog_int(const char *prefix,
4359. SSL *ssl,
4360. const uint8_t *parameter_1,
ssl/ssl_lib.c:4381:5: Assignment
4379. * hexadecimal, so we need a buffer that is twice their lengths.
4380. */
4381. prefix_len = strlen(prefix);
^
4382. out_len = prefix_len + (2*parameter_1_len) + (2*parameter_2_len) + 3;
4383. if ((out = cursor = OPENSSL_malloc(out_len)) == NULL) {
ssl/ssl_lib.c:4389:5: Assignment
4387.
4388. strcpy(cursor, prefix);
4389. cursor += prefix_len;
^
4390. *cursor++ = ' ';
4391.
ssl/ssl_lib.c:4390:6: Assignment
4388. strcpy(cursor, prefix);
4389. cursor += prefix_len;
4390. *cursor++ = ' ';
^
4391.
4392. for (i = 0; i < parameter_1_len; i++) {
ssl/ssl_lib.c:4396:5: Array access: Offset: [4, +oo] Size: [1, 118] by call to `ssl_log_rsa_client_key_exchange`
4394. cursor += 2;
4395. }
4396. *cursor++ = ' ';
^
4397.
4398. for (i = 0; i < parameter_2_len; i++) {
|
https://github.com/openssl/openssl/blob/6f8950a3cc466a7e2660dd9d7c8e9d11f47643ed/ssl/ssl_lib.c/#L4396
|
d2a_code_trace_data_42129
|
SSL *SSL_new(SSL_CTX *ctx)
{
SSL *s;
if (ctx == NULL) {
SSLerr(SSL_F_SSL_NEW, SSL_R_NULL_SSL_CTX);
return (NULL);
}
if (ctx->method == NULL) {
SSLerr(SSL_F_SSL_NEW, SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION);
return (NULL);
}
s = OPENSSL_zalloc(sizeof(*s));
if (s == NULL)
goto err;
s->lock = CRYPTO_THREAD_lock_new();
if (s->lock == NULL) {
SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE);
OPENSSL_free(s);
return NULL;
}
RECORD_LAYER_init(&s->rlayer, s);
s->options = ctx->options;
s->dane.flags = ctx->dane.flags;
s->min_proto_version = ctx->min_proto_version;
s->max_proto_version = ctx->max_proto_version;
s->mode = ctx->mode;
s->max_cert_list = ctx->max_cert_list;
s->references = 1;
s->max_early_data = ctx->max_early_data;
s->cert = ssl_cert_dup(ctx->cert);
if (s->cert == NULL)
goto err;
RECORD_LAYER_set_read_ahead(&s->rlayer, ctx->read_ahead);
s->msg_callback = ctx->msg_callback;
s->msg_callback_arg = ctx->msg_callback_arg;
s->verify_mode = ctx->verify_mode;
s->not_resumable_session_cb = ctx->not_resumable_session_cb;
s->record_padding_cb = ctx->record_padding_cb;
s->record_padding_arg = ctx->record_padding_arg;
s->block_padding = ctx->block_padding;
s->sid_ctx_length = ctx->sid_ctx_length;
if (!ossl_assert(s->sid_ctx_length <= sizeof s->sid_ctx))
goto err;
memcpy(&s->sid_ctx, &ctx->sid_ctx, sizeof(s->sid_ctx));
s->verify_callback = ctx->default_verify_callback;
s->generate_session_id = ctx->generate_session_id;
s->param = X509_VERIFY_PARAM_new();
if (s->param == NULL)
goto err;
X509_VERIFY_PARAM_inherit(s->param, ctx->param);
s->quiet_shutdown = ctx->quiet_shutdown;
s->max_send_fragment = ctx->max_send_fragment;
s->split_send_fragment = ctx->split_send_fragment;
s->max_pipelines = ctx->max_pipelines;
if (s->max_pipelines > 1)
RECORD_LAYER_set_read_ahead(&s->rlayer, 1);
if (ctx->default_read_buf_len > 0)
SSL_set_default_read_buffer_len(s, ctx->default_read_buf_len);
SSL_CTX_up_ref(ctx);
s->ctx = ctx;
s->ext.debug_cb = 0;
s->ext.debug_arg = NULL;
s->ext.ticket_expected = 0;
s->ext.status_type = ctx->ext.status_type;
s->ext.status_expected = 0;
s->ext.ocsp.ids = NULL;
s->ext.ocsp.exts = NULL;
s->ext.ocsp.resp = NULL;
s->ext.ocsp.resp_len = 0;
SSL_CTX_up_ref(ctx);
s->session_ctx = ctx;
#ifndef OPENSSL_NO_EC
if (ctx->ext.ecpointformats) {
s->ext.ecpointformats =
OPENSSL_memdup(ctx->ext.ecpointformats,
ctx->ext.ecpointformats_len);
if (!s->ext.ecpointformats)
goto err;
s->ext.ecpointformats_len =
ctx->ext.ecpointformats_len;
}
if (ctx->ext.supportedgroups) {
s->ext.supportedgroups =
OPENSSL_memdup(ctx->ext.supportedgroups,
ctx->ext.supportedgroups_len);
if (!s->ext.supportedgroups)
goto err;
s->ext.supportedgroups_len = ctx->ext.supportedgroups_len;
}
#endif
#ifndef OPENSSL_NO_NEXTPROTONEG
s->ext.npn = NULL;
#endif
if (s->ctx->ext.alpn) {
s->ext.alpn = OPENSSL_malloc(s->ctx->ext.alpn_len);
if (s->ext.alpn == NULL)
goto err;
memcpy(s->ext.alpn, s->ctx->ext.alpn, s->ctx->ext.alpn_len);
s->ext.alpn_len = s->ctx->ext.alpn_len;
}
s->verified_chain = NULL;
s->verify_result = X509_V_OK;
s->default_passwd_callback = ctx->default_passwd_callback;
s->default_passwd_callback_userdata = ctx->default_passwd_callback_userdata;
s->method = ctx->method;
s->key_update = SSL_KEY_UPDATE_NONE;
if (!s->method->ssl_new(s))
goto err;
s->server = (ctx->method->ssl_accept == ssl_undefined_function) ? 0 : 1;
if (!SSL_clear(s))
goto err;
if (!CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL, s, &s->ex_data))
goto err;
#ifndef OPENSSL_NO_PSK
s->psk_client_callback = ctx->psk_client_callback;
s->psk_server_callback = ctx->psk_server_callback;
#endif
s->psk_find_session_cb = ctx->psk_find_session_cb;
s->psk_use_session_cb = ctx->psk_use_session_cb;
s->job = NULL;
#ifndef OPENSSL_NO_CT
if (!SSL_set_ct_validation_callback(s, ctx->ct_validation_callback,
ctx->ct_validation_callback_arg))
goto err;
#endif
return s;
err:
SSL_free(s);
SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE);
return NULL;
}
ssl/ssl_lib.c:628: error: MEMORY_LEAK
memory dynamically allocated by call to `CRYPTO_THREAD_lock_new()` at line 621, column 15 is not reachable after line 628, column 5.
Showing all 46 steps of the trace
ssl/ssl_lib.c:604:1: start of procedure SSL_new()
602. }
603.
604. > SSL *SSL_new(SSL_CTX *ctx)
605. {
606. SSL *s;
ssl/ssl_lib.c:608:9: Taking false branch
606. SSL *s;
607.
608. if (ctx == NULL) {
^
609. SSLerr(SSL_F_SSL_NEW, SSL_R_NULL_SSL_CTX);
610. return (NULL);
ssl/ssl_lib.c:612:9: Taking false branch
610. return (NULL);
611. }
612. if (ctx->method == NULL) {
^
613. SSLerr(SSL_F_SSL_NEW, SSL_R_SSL_CTX_HAS_NO_DEFAULT_SSL_VERSION);
614. return (NULL);
ssl/ssl_lib.c:617:5:
615. }
616.
617. > s = OPENSSL_zalloc(sizeof(*s));
618. if (s == NULL)
619. goto err;
crypto/mem.c:197:1: start of procedure CRYPTO_zalloc()
195. }
196.
197. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
198. {
199. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:199:5:
197. void *CRYPTO_zalloc(size_t num, const char *file, int line)
198. {
199. > void *ret = CRYPTO_malloc(num, file, line);
200.
201. FAILTEST();
crypto/mem.c:169:1: start of procedure CRYPTO_malloc()
167. #endif
168.
169. > void *CRYPTO_malloc(size_t num, const char *file, int line)
170. {
171. void *ret = NULL;
crypto/mem.c:171:5:
169. void *CRYPTO_malloc(size_t num, const char *file, int line)
170. {
171. > void *ret = NULL;
172.
173. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
crypto/mem.c:173:9: Taking false branch
171. void *ret = NULL;
172.
173. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
174. return malloc_impl(num, file, line);
175.
crypto/mem.c:176:9: Taking false branch
174. return malloc_impl(num, file, line);
175.
176. if (num == 0)
^
177. return NULL;
178.
crypto/mem.c:180:5:
178.
179. FAILTEST();
180. > allow_customize = 0;
181. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
182. if (call_malloc_debug) {
crypto/mem.c:190:5:
188. }
189. #else
190. > osslargused(file); osslargused(line);
191. ret = malloc(num);
192. #endif
crypto/mem.c:190:24:
188. }
189. #else
190. > osslargused(file); osslargused(line);
191. ret = malloc(num);
192. #endif
crypto/mem.c:191:5:
189. #else
190. osslargused(file); osslargused(line);
191. > ret = malloc(num);
192. #endif
193.
crypto/mem.c:194:5:
192. #endif
193.
194. > return ret;
195. }
196.
crypto/mem.c:195:1: return from a call to CRYPTO_malloc
193.
194. return ret;
195. > }
196.
197. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:202:9: Taking true branch
200.
201. FAILTEST();
202. if (ret != NULL)
^
203. memset(ret, 0, num);
204. return ret;
crypto/mem.c:203:9:
201. FAILTEST();
202. if (ret != NULL)
203. > memset(ret, 0, num);
204. return ret;
205. }
crypto/mem.c:204:5:
202. if (ret != NULL)
203. memset(ret, 0, num);
204. > return ret;
205. }
206.
crypto/mem.c:205:1: return from a call to CRYPTO_zalloc
203. memset(ret, 0, num);
204. return ret;
205. > }
206.
207. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
ssl/ssl_lib.c:618:9: Taking false branch
616.
617. s = OPENSSL_zalloc(sizeof(*s));
618. if (s == NULL)
^
619. goto err;
620.
ssl/ssl_lib.c:621:5:
619. goto err;
620.
621. > s->lock = CRYPTO_THREAD_lock_new();
622. if (s->lock == NULL) {
623. SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE);
crypto/threads_pthread.c:19:1: start of procedure CRYPTO_THREAD_lock_new()
17. # endif
18.
19. > CRYPTO_RWLOCK *CRYPTO_THREAD_lock_new(void)
20. {
21. # ifdef USE_RWLOCK
crypto/threads_pthread.c:22:5:
20. {
21. # ifdef USE_RWLOCK
22. > CRYPTO_RWLOCK *lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t));
23. if (lock == NULL)
24. return NULL;
crypto/mem.c:197:1: start of procedure CRYPTO_zalloc()
195. }
196.
197. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
198. {
199. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:199:5:
197. void *CRYPTO_zalloc(size_t num, const char *file, int line)
198. {
199. > void *ret = CRYPTO_malloc(num, file, line);
200.
201. FAILTEST();
crypto/mem.c:169:1: start of procedure CRYPTO_malloc()
167. #endif
168.
169. > void *CRYPTO_malloc(size_t num, const char *file, int line)
170. {
171. void *ret = NULL;
crypto/mem.c:171:5:
169. void *CRYPTO_malloc(size_t num, const char *file, int line)
170. {
171. > void *ret = NULL;
172.
173. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
crypto/mem.c:173:9: Taking false branch
171. void *ret = NULL;
172.
173. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
174. return malloc_impl(num, file, line);
175.
crypto/mem.c:176:9: Taking false branch
174. return malloc_impl(num, file, line);
175.
176. if (num == 0)
^
177. return NULL;
178.
crypto/mem.c:180:5:
178.
179. FAILTEST();
180. > allow_customize = 0;
181. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
182. if (call_malloc_debug) {
crypto/mem.c:190:5:
188. }
189. #else
190. > osslargused(file); osslargused(line);
191. ret = malloc(num);
192. #endif
crypto/mem.c:190:24:
188. }
189. #else
190. > osslargused(file); osslargused(line);
191. ret = malloc(num);
192. #endif
crypto/mem.c:191:5:
189. #else
190. osslargused(file); osslargused(line);
191. > ret = malloc(num);
192. #endif
193.
crypto/mem.c:194:5:
192. #endif
193.
194. > return ret;
195. }
196.
crypto/mem.c:195:1: return from a call to CRYPTO_malloc
193.
194. return ret;
195. > }
196.
197. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:202:9: Taking true branch
200.
201. FAILTEST();
202. if (ret != NULL)
^
203. memset(ret, 0, num);
204. return ret;
crypto/mem.c:203:9:
201. FAILTEST();
202. if (ret != NULL)
203. > memset(ret, 0, num);
204. return ret;
205. }
crypto/mem.c:204:5:
202. if (ret != NULL)
203. memset(ret, 0, num);
204. > return ret;
205. }
206.
crypto/mem.c:205:1: return from a call to CRYPTO_zalloc
203. memset(ret, 0, num);
204. return ret;
205. > }
206.
207. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/threads_pthread.c:23:9: Taking false branch
21. # ifdef USE_RWLOCK
22. CRYPTO_RWLOCK *lock = OPENSSL_zalloc(sizeof(pthread_rwlock_t));
23. if (lock == NULL)
^
24. return NULL;
25.
crypto/threads_pthread.c:26:9: Taking false branch
24. return NULL;
25.
26. if (pthread_rwlock_init(lock, NULL) != 0) {
^
27. OPENSSL_free(lock);
28. return NULL;
crypto/threads_pthread.c:48:5:
46. # endif
47.
48. > return lock;
49. }
50.
crypto/threads_pthread.c:49:1: return from a call to CRYPTO_THREAD_lock_new
47.
48. return lock;
49. > }
50.
51. int CRYPTO_THREAD_read_lock(CRYPTO_RWLOCK *lock)
ssl/ssl_lib.c:622:9: Taking false branch
620.
621. s->lock = CRYPTO_THREAD_lock_new();
622. if (s->lock == NULL) {
^
623. SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE);
624. OPENSSL_free(s);
ssl/ssl_lib.c:628:5: Skipping RECORD_LAYER_init(): empty list of specs
626. }
627.
628. RECORD_LAYER_init(&s->rlayer, s);
^
629.
630. s->options = ctx->options;
|
https://github.com/openssl/openssl/blob/810ef917070902f729e3913f1656371c9b0855f8/ssl/ssl_lib.c/#L628
|
d2a_code_trace_data_42130
|
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_prime.c:227: error: BUFFER_OVERRUN_L3
Offset: [1, +oo] Size: [0, 8388607] by call to `witness`.
Showing all 20 steps of the trace
crypto/bn/bn_prime.c:197:10: Call
195.
196. /* compute A1 := a - 1 */
197. if (!BN_copy(A1, a))
^
198. goto err;
199. if (!BN_sub_word(A1, 1))
crypto/bn/bn_lib.c:323:1: Parameter `a->top`
321. }
322.
323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b)
324. {
325. bn_check_top(b);
crypto/bn/bn_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 `w->top`
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:294:1: Parameter `a->top`
292. }
293.
294. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
295. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont)
296. {
crypto/bn/bn_exp.c:306:16: Call
304.
305. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) {
306. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont);
^
307. }
308.
crypto/bn/bn_exp.c:594:1: Parameter `a->top`
592. * http://www.daemonology.net/hyperthreading-considered-harmful/)
593. */
594. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
595. const BIGNUM *m, BN_CTX *ctx,
596. BN_MONT_CTX *in_mont)
crypto/bn/bn_exp.c:747:14: Call
745. /* prepare a^1 in Montgomery domain */
746. if (a->neg || BN_ucmp(a, m) >= 0) {
747. if (!BN_mod(&am, a, m, ctx))
^
748. goto err;
749. if (!BN_to_montgomery(&am, &am, mont, ctx))
crypto/bn/bn_div.c:140:1: Parameter `num->top`
138. * If 'dv' or 'rm' is NULL, the respective value is not returned.
139. */
140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
141. BN_CTX *ctx)
142. {
crypto/bn/bn_div.c:210:11: Call
208. sdiv->neg = 0;
209. norm_shift += BN_BITS2;
210. if (!(BN_lshift(snum, num, norm_shift)))
^
211. goto err;
212. snum->neg = 0;
crypto/bn/bn_shift.c:83:1: <Offset trace>
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:83:1: Parameter `n`
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:97:5: Assignment
95. }
96.
97. nw = n / BN_BITS2;
^
98. if (bn_wexpand(r, a->top + nw + 1) == NULL)
99. return (0);
crypto/bn/bn_shift.c:83:1: <Length trace>
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:83:1: Parameter `*r->d`
81. }
82.
83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
84. {
85. int i, nw, lb, rb;
crypto/bn/bn_shift.c:98:9: Call
96.
97. nw = n / BN_BITS2;
98. if (bn_wexpand(r, a->top + nw + 1) == NULL)
^
99. return (0);
100. r->neg = a->neg;
crypto/bn/bn_lib.c:948:1: Parameter `*a->d`
946. }
947.
948. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
949. {
950. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_shift.c:104:5: Assignment
102. rb = BN_BITS2 - lb;
103. f = a->d;
104. t = r->d;
^
105. t[a->top + nw] = 0;
106. if (lb == 0)
crypto/bn/bn_shift.c:112:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `witness`
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/757264207ad8650a89ea903d48ad89f61d56ea9c/crypto/bn/bn_shift.c/#L112
|
d2a_code_trace_data_42131
|
void 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,
unsigned 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);
unsigned md_size, md_block_size = 64;
unsigned 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;
unsigned int 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];
unsigned i, j, md_out_size_u;
EVP_MD_CTX md_ctx;
unsigned 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:
MD5_Init((MD5_CTX *)md_state.c);
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:
SHA1_Init((SHA_CTX *)md_state.c);
md_final_raw = tls1_sha1_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))SHA1_Transform;
md_size = 20;
break;
#ifndef OPENSSL_NO_SHA256
case NID_sha224:
SHA224_Init((SHA256_CTX *)md_state.c);
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:
SHA256_Init((SHA256_CTX *)md_state.c);
md_final_raw = tls1_sha256_final_raw;
md_transform =
(void (*)(void *ctx, const unsigned char *block))SHA256_Transform;
md_size = 32;
break;
#endif
#ifndef OPENSSL_NO_SHA512
case NID_sha384:
SHA384_Init((SHA512_CTX *)md_state.c);
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:
SHA512_Init((SHA512_CTX *)md_state.c);
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;
#endif
default:
OPENSSL_assert(0);
if (md_out_size)
*md_out_size = -1;
return;
}
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) {
unsigned 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(i, index_a);
unsigned char is_block_b = constant_time_eq_8(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(j, c);
is_past_cp1 = is_block_a & constant_time_ge_8(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;
}
EVP_MD_CTX_init(&md_ctx);
EVP_DigestInit_ex(&md_ctx, ctx->digest, NULL );
if (is_sslv3) {
memset(hmac_pad, 0x5c, sslv3_pad_length);
EVP_DigestUpdate(&md_ctx, mac_secret, mac_secret_length);
EVP_DigestUpdate(&md_ctx, hmac_pad, sslv3_pad_length);
EVP_DigestUpdate(&md_ctx, mac_out, md_size);
} else {
for (i = 0; i < md_block_size; i++)
hmac_pad[i] ^= 0x6a;
EVP_DigestUpdate(&md_ctx, hmac_pad, md_block_size);
EVP_DigestUpdate(&md_ctx, mac_out, md_size);
}
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_cleanup(&md_ctx);
}
ssl/s3_enc.c:772: error: BUFFER_OVERRUN_L3
Offset added: [-51, +oo] (⇐ [64, 128] + [-115, +oo]) Size: 600 by call to `ssl3_cbc_digest_record`.
Showing all 8 steps of the trace
ssl/s3_enc.c:713:1: Array declaration
711. }
712.
713. > int n_ssl3_mac(SSL *ssl, unsigned char *md, int send)
714. {
715. SSL3_RECORD *rec;
ssl/s3_enc.c:772:9: Call
770.
771. /* Final param == is SSLv3 */
772. ssl3_cbc_digest_record(hash,
^
773. md, &md_size,
774. header, rec->input,
ssl/s3_cbc.c:425:5: <Offset trace>
423. void (*md_final_raw) (void *ctx, unsigned char *md_out);
424. void (*md_transform) (void *ctx, const unsigned char *block);
425. unsigned md_size, md_block_size = 64;
^
426. unsigned sslv3_pad_length = 40, header_length, variance_blocks,
427. len, max_mac_bytes, num_blocks,
ssl/s3_cbc.c:425:5: Assignment
423. void (*md_final_raw) (void *ctx, unsigned char *md_out);
424. void (*md_transform) (void *ctx, const unsigned char *block);
425. unsigned md_size, md_block_size = 64;
^
426. unsigned sslv3_pad_length = 40, header_length, variance_blocks,
427. len, max_mac_bytes, num_blocks,
ssl/s3_cbc.c:642:13: Assignment
640. * consumes: either 7 bytes (SHA1) or 11 bytes (MD5).
641. */
642. unsigned overhang = header_length - md_block_size;
^
643. md_transform(md_state.c, header);
644. memcpy(first_block, header + md_block_size, overhang);
ssl/s3_cbc.c:409:1: <Length trace>
407. * padding too. )
408. */
409. > void ssl3_cbc_digest_record(const EVP_MD_CTX *ctx,
410. unsigned char *md_out,
411. size_t *md_out_size,
ssl/s3_cbc.c:409:1: Parameter `*header`
407. * padding too. )
408. */
409. > void ssl3_cbc_digest_record(const EVP_MD_CTX *ctx,
410. unsigned char *md_out,
411. size_t *md_out_size,
ssl/s3_cbc.c:644:13: Array access: Offset added: [-51, +oo] (⇐ [64, 128] + [-115, +oo]) Size: 600 by call to `ssl3_cbc_digest_record`
642. unsigned overhang = header_length - md_block_size;
643. md_transform(md_state.c, header);
644. memcpy(first_block, header + md_block_size, overhang);
^
645. memcpy(first_block + overhang, data, md_block_size - overhang);
646. md_transform(md_state.c, first_block);
|
https://github.com/openssl/openssl/blob/9c46f4b9cd4912b61cb546c48b678488d7f26ed6/ssl/s3_cbc.c/#L644
|
d2a_code_trace_data_42132
|
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;
}
r->neg = a->neg;
nw = n / BN_BITS2;
if (bn_wexpand(r, a->top + nw + 1) == NULL)
return (0);
lb = n % BN_BITS2;
rb = BN_BITS2 - lb;
f = a->d;
t = r->d;
t[a->top + nw] = 0;
if (lb == 0)
for (i = a->top - 1; i >= 0; i--)
t[nw + i] = f[i];
else
for (i = a->top - 1; i >= 0; i--) {
l = f[i];
t[nw + i + 1] |= (l >> rb) & BN_MASK2;
t[nw + i] = (l << lb) & BN_MASK2;
}
memset(t, 0, sizeof(*t) * nw);
r->top = a->top + nw + 1;
bn_correct_top(r);
bn_check_top(r);
return (1);
}
crypto/ec/ec_ameth.c:200: error: BUFFER_OVERRUN_L3
Offset: [1, +oo] Size: [0, 8388607] by call to `d2i_ECPrivateKey`.
Showing all 33 steps of the trace
crypto/ec/ec_ameth.c:194:13: Call
192. X509_ALGOR_get0(NULL, &ptype, &pval, palg);
193.
194. eckey = eckey_type2param(ptype, pval);
^
195.
196. if (!eckey)
crypto/ec/ec_ameth.c:116:17: Call
114. goto ecerr;
115. }
116. group = EC_GROUP_new_by_curve_name(OBJ_obj2nid(poid));
^
117. if (group == NULL)
118. goto ecerr;
crypto/ec/ec_curve.c:3095:19: Call
3093. for (i = 0; i < curve_list_length; i++)
3094. if (curve_list[i].nid == nid) {
3095. ret = ec_group_new_from_data(curve_list[i]);
^
3096. break;
3097. }
crypto/ec/ec_curve.c:3008:14: Call
3006. params += seed_len; /* skip seed */
3007.
3008. if ((p = BN_bin2bn(params + 0 * param_len, param_len, NULL)) == NULL
^
3009. || (a = BN_bin2bn(params + 1 * param_len, param_len, NULL)) == NULL
3010. || (b = BN_bin2bn(params + 2 * param_len, param_len, NULL)) == NULL) {
crypto/bn/bn_lib.c:475:1: Parameter `ret->top`
473. }
474.
475. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
476. {
477. unsigned int i, m;
crypto/ec/ec_ameth.c:200:10: Call
198.
199. /* We have parameters now set private key */
200. if (!d2i_ECPrivateKey(&eckey, &p, pklen)) {
^
201. ECerr(EC_F_ECKEY_PRIV_DECODE, EC_R_DECODE_ERROR);
202. goto ecerr;
crypto/ec/ec_asn1.c:918:1: Parameter `(*a)->group->field->top`
916. /* some EC_KEY functions */
917.
918. > EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const unsigned char **in, long len)
919. {
920. EC_KEY *ret = NULL;
crypto/ec/ec_asn1.c:972:14: Call
970. pub_oct = ASN1_STRING_get0_data(priv_key->publicKey);
971. pub_oct_len = ASN1_STRING_length(priv_key->publicKey);
972. if (!EC_KEY_oct2key(ret, pub_oct, pub_oct_len, NULL)) {
^
973. ECerr(EC_F_D2I_ECPRIVATEKEY, ERR_R_EC_LIB);
974. goto err;
crypto/ec/ec_key.c:526:1: Parameter `key->group->field->top`
524. }
525.
526. > int EC_KEY_oct2key(EC_KEY *key, const unsigned char *buf, size_t len,
527. BN_CTX *ctx)
528. {
crypto/ec/ec_key.c:535:9: Call
533. if (key->pub_key == NULL)
534. return 0;
535. if (EC_POINT_oct2point(key->group, key->pub_key, buf, len, ctx) == 0)
^
536. return 0;
537. /*
crypto/ec/ec_oct.c:118:1: Parameter `group->field->top`
116. }
117.
118. > int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point,
119. const unsigned char *buf, size_t len, BN_CTX *ctx)
120. {
crypto/ec/ec_oct.c:140:20: Call
138. }
139. #else
140. return ec_GF2m_simple_oct2point(group, point, buf, len, ctx);
^
141. #endif
142. }
crypto/ec/ec2_oct.c:249:1: Parameter `group->field->top`
247. * simple implementation only uses affine coordinates.
248. */
249. > int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point,
250. const unsigned char *buf, size_t len,
251. BN_CTX *ctx)
crypto/ec/ec2_oct.c:318:14: Call
316.
317. if (form == POINT_CONVERSION_COMPRESSED) {
318. if (!EC_POINT_set_compressed_coordinates_GF2m
^
319. (group, point, x, y_bit, ctx))
320. goto err;
crypto/ec/ec_oct.c:59:1: Parameter `group->field->top`
57.
58. #ifndef OPENSSL_NO_EC2M
59. > int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group,
60. EC_POINT *point, const BIGNUM *x,
61. int y_bit, BN_CTX *ctx)
crypto/ec/ec_oct.c:76:20: Call
74. if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) {
75. if (group->meth->field_type == NID_X9_62_prime_field)
76. return ec_GFp_simple_set_compressed_coordinates(group, point, x,
^
77. y_bit, ctx);
78. else
crypto/ec/ecp_oct.c:21:1: Parameter `group->field->top`
19. #include "ec_lcl.h"
20.
21. > int ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group,
22. EC_POINT *point,
23. const BIGNUM *x_, int y_bit,
crypto/ec/ecp_oct.c:56:10: Call
54.
55. /* tmp1 := x^3 */
56. if (!BN_nnmod(x, x_, group->field, ctx))
^
57. goto err;
58. if (group->meth->field_decode == 0) {
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:205:31: Call
203.
204. /* First we normalise the numbers */
205. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
^
206. if (!(BN_lshift(sdiv, divisor, norm_shift)))
207. goto err;
crypto/bn/bn_lib.c:167:9: Assignment
165.
166. if (BN_is_zero(a))
167. return 0;
^
168. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i]));
169. }
crypto/bn/bn_div.c:205:5: Assignment
203.
204. /* First we normalise the numbers */
205. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
^
206. if (!(BN_lshift(sdiv, divisor, norm_shift)))
207. goto err;
crypto/bn/bn_div.c:206:11: Call
204. /* First we normalise the numbers */
205. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2);
206. if (!(BN_lshift(sdiv, divisor, norm_shift)))
^
207. goto err;
208. sdiv->neg = 0;
crypto/bn/bn_shift.c:81:1: <Offset trace>
79. }
80.
81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
82. {
83. int i, nw, lb, rb;
crypto/bn/bn_shift.c:81:1: Parameter `n`
79. }
80.
81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
82. {
83. int i, nw, lb, rb;
crypto/bn/bn_shift.c:96:5: Assignment
94.
95. r->neg = a->neg;
96. nw = n / BN_BITS2;
^
97. if (bn_wexpand(r, a->top + nw + 1) == NULL)
98. return (0);
crypto/bn/bn_shift.c:81:1: <Length trace>
79. }
80.
81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
82. {
83. int i, nw, lb, rb;
crypto/bn/bn_shift.c:81:1: Parameter `*r->d`
79. }
80.
81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n)
82. {
83. int i, nw, lb, rb;
crypto/bn/bn_shift.c:97:9: Call
95. r->neg = a->neg;
96. nw = n / BN_BITS2;
97. if (bn_wexpand(r, a->top + nw + 1) == NULL)
^
98. return (0);
99. lb = n % BN_BITS2;
crypto/bn/bn_lib.c:1016:1: Parameter `*a->d`
1014. }
1015.
1016. > BIGNUM *bn_wexpand(BIGNUM *a, int words)
1017. {
1018. return (words <= a->dmax) ? a : bn_expand2(a, words);
crypto/bn/bn_shift.c:102:5: Assignment
100. rb = BN_BITS2 - lb;
101. f = a->d;
102. t = r->d;
^
103. t[a->top + nw] = 0;
104. if (lb == 0)
crypto/bn/bn_shift.c:110:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `d2i_ECPrivateKey`
108. for (i = a->top - 1; i >= 0; i--) {
109. l = f[i];
110. t[nw + i + 1] |= (l >> rb) & BN_MASK2;
^
111. t[nw + i] = (l << lb) & BN_MASK2;
112. }
|
https://github.com/openssl/openssl/blob/2238119751bb95efc1dfafabf0e70e86f71fc6f6/crypto/bn/bn_shift.c/#L110
|
d2a_code_trace_data_42133
|
void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){
int i;
InternalBuffer *buf, *last;
AVCodecInternal *avci = s->internal;
assert(s->codec_type == AVMEDIA_TYPE_VIDEO);
assert(pic->type==FF_BUFFER_TYPE_INTERNAL);
assert(avci->buffer_count);
if (avci->buffer) {
buf = NULL;
for (i = 0; i < avci->buffer_count; i++) {
buf = &avci->buffer[i];
if (buf->data[0] == pic->data[0])
break;
}
assert(i < avci->buffer_count);
avci->buffer_count--;
last = &avci->buffer[avci->buffer_count];
if (buf != last)
FFSWAP(InternalBuffer, *buf, *last);
}
for (i = 0; i < AV_NUM_DATA_POINTERS; i++) {
pic->data[i]=NULL;
}
if(s->debug&FF_DEBUG_BUFFERS)
av_log(s, AV_LOG_DEBUG, "default_release_buffer called on pic %p, %d "
"buffers used\n", pic, avci->buffer_count);
}
libavcodec/utils.c:503: error: Null Dereference
pointer `buf` last assigned on line 492 could be null and is dereferenced at line 503, column 13.
libavcodec/utils.c:481:1: start of procedure avcodec_default_release_buffer()
479. }
480.
481. void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic){
^
482. int i;
483. InternalBuffer *buf, *last;
libavcodec/utils.c:484:5:
482. int i;
483. InternalBuffer *buf, *last;
484. AVCodecInternal *avci = s->internal;
^
485.
486. assert(s->codec_type == AVMEDIA_TYPE_VIDEO);
libavcodec/utils.c:486:5:
484. AVCodecInternal *avci = s->internal;
485.
486. assert(s->codec_type == AVMEDIA_TYPE_VIDEO);
^
487.
488. assert(pic->type==FF_BUFFER_TYPE_INTERNAL);
libavcodec/utils.c:488:5:
486. assert(s->codec_type == AVMEDIA_TYPE_VIDEO);
487.
488. assert(pic->type==FF_BUFFER_TYPE_INTERNAL);
^
489. assert(avci->buffer_count);
490.
libavcodec/utils.c:489:5:
487.
488. assert(pic->type==FF_BUFFER_TYPE_INTERNAL);
489. assert(avci->buffer_count);
^
490.
491. if (avci->buffer) {
libavcodec/utils.c:491:9: Taking true branch
489. assert(avci->buffer_count);
490.
491. if (avci->buffer) {
^
492. buf = NULL; /* avoids warning */
493. for (i = 0; i < avci->buffer_count; i++) { //just 3-5 checks so is not worth to optimize
libavcodec/utils.c:492:9:
490.
491. if (avci->buffer) {
492. buf = NULL; /* avoids warning */
^
493. for (i = 0; i < avci->buffer_count; i++) { //just 3-5 checks so is not worth to optimize
494. buf = &avci->buffer[i];
libavcodec/utils.c:493:14:
491. if (avci->buffer) {
492. buf = NULL; /* avoids warning */
493. for (i = 0; i < avci->buffer_count; i++) { //just 3-5 checks so is not worth to optimize
^
494. buf = &avci->buffer[i];
495. if (buf->data[0] == pic->data[0])
libavcodec/utils.c:493:21: Loop condition is false. Leaving loop
491. if (avci->buffer) {
492. buf = NULL; /* avoids warning */
493. for (i = 0; i < avci->buffer_count; i++) { //just 3-5 checks so is not worth to optimize
^
494. buf = &avci->buffer[i];
495. if (buf->data[0] == pic->data[0])
libavcodec/utils.c:498:9:
496. break;
497. }
498. assert(i < avci->buffer_count);
^
499. avci->buffer_count--;
500. last = &avci->buffer[avci->buffer_count];
libavcodec/utils.c:499:9:
497. }
498. assert(i < avci->buffer_count);
499. avci->buffer_count--;
^
500. last = &avci->buffer[avci->buffer_count];
501.
libavcodec/utils.c:500:9:
498. assert(i < avci->buffer_count);
499. avci->buffer_count--;
500. last = &avci->buffer[avci->buffer_count];
^
501.
502. if (buf != last)
libavcodec/utils.c:502:13: Taking true branch
500. last = &avci->buffer[avci->buffer_count];
501.
502. if (buf != last)
^
503. FFSWAP(InternalBuffer, *buf, *last);
504. }
libavcodec/utils.c:503:13:
501.
502. if (buf != last)
503. FFSWAP(InternalBuffer, *buf, *last);
^
504. }
505.
|
https://github.com/libav/libav/blob/9f3c77dd2a4fa4accf102c2af1f22567652b8e0f/libavcodec/utils.c/#L503
|
d2a_code_trace_data_42134
|
static OSSL_PROVIDER *provider_new(const char *name,
OSSL_provider_init_fn *init_function)
{
OSSL_PROVIDER *prov = NULL;
if ((prov = OPENSSL_zalloc(sizeof(*prov))) == NULL
#ifndef HAVE_ATOMICS
|| (prov->refcnt_lock = CRYPTO_THREAD_lock_new()) == NULL
#endif
|| !ossl_provider_upref(prov)
|| (prov->name = OPENSSL_strdup(name)) == NULL) {
ossl_provider_free(prov);
CRYPTOerr(CRYPTO_F_PROVIDER_NEW, ERR_R_MALLOC_FAILURE);
return NULL;
}
prov->init_function = init_function;
return prov;
}
crypto/provider_core.c:184: error: MEMORY_LEAK
memory dynamically allocated by call to `CRYPTO_zalloc()` at line 178, column 17 is not reachable after line 184, column 9.
Showing all 47 steps of the trace
crypto/provider_core.c:173:1: start of procedure provider_new()
171. */
172.
173. > static OSSL_PROVIDER *provider_new(const char *name,
174. OSSL_provider_init_fn *init_function)
175. {
crypto/provider_core.c:176:5:
174. OSSL_provider_init_fn *init_function)
175. {
176. > OSSL_PROVIDER *prov = NULL;
177.
178. if ((prov = OPENSSL_zalloc(sizeof(*prov))) == NULL
crypto/provider_core.c:178:9:
176. OSSL_PROVIDER *prov = NULL;
177.
178. > if ((prov = OPENSSL_zalloc(sizeof(*prov))) == NULL
179. #ifndef HAVE_ATOMICS
180. || (prov->refcnt_lock = CRYPTO_THREAD_lock_new()) == NULL
crypto/mem.c:228:1: start of procedure CRYPTO_zalloc()
226. }
227.
228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:230:5:
228. void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. > void *ret = CRYPTO_malloc(num, file, line);
231.
232. FAILTEST();
crypto/mem.c:192:1: start of procedure CRYPTO_malloc()
190. #endif
191.
192. > void *CRYPTO_malloc(size_t num, const char *file, int line)
193. {
194. void *ret = NULL;
crypto/mem.c:194:5:
192. void *CRYPTO_malloc(size_t num, const char *file, int line)
193. {
194. > void *ret = NULL;
195.
196. INCREMENT(malloc_count);
crypto/mem.c:197:9: Taking false branch
195.
196. INCREMENT(malloc_count);
197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
198. return malloc_impl(num, file, line);
199.
crypto/mem.c:200:9: Taking false branch
198. return malloc_impl(num, file, line);
199.
200. if (num == 0)
^
201. return NULL;
202.
crypto/mem.c:204:9: Taking true branch
202.
203. FAILTEST();
204. if (allow_customize) {
^
205. /*
206. * Disallow customization after the first allocation. We only set this
crypto/mem.c:210:9:
208. * allocation.
209. */
210. > allow_customize = 0;
211. }
212. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
crypto/mem.c:221:5:
219. }
220. #else
221. > (void)(file); (void)(line);
222. ret = malloc(num);
223. #endif
crypto/mem.c:221:19:
219. }
220. #else
221. > (void)(file); (void)(line);
222. ret = malloc(num);
223. #endif
crypto/mem.c:222:5:
220. #else
221. (void)(file); (void)(line);
222. > ret = malloc(num);
223. #endif
224.
crypto/mem.c:225:5:
223. #endif
224.
225. > return ret;
226. }
227.
crypto/mem.c:226:1: return from a call to CRYPTO_malloc
224.
225. return ret;
226. > }
227.
228. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/mem.c:233:9: Taking true branch
231.
232. FAILTEST();
233. if (ret != NULL)
^
234. memset(ret, 0, num);
235. return ret;
crypto/mem.c:234:9:
232. FAILTEST();
233. if (ret != NULL)
234. > memset(ret, 0, num);
235. return ret;
236. }
crypto/mem.c:235:5:
233. if (ret != NULL)
234. memset(ret, 0, num);
235. > return ret;
236. }
237.
crypto/mem.c:236:1: return from a call to CRYPTO_zalloc
234. memset(ret, 0, num);
235. return ret;
236. > }
237.
238. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
crypto/provider_core.c:178:9: Taking false branch
176. OSSL_PROVIDER *prov = NULL;
177.
178. if ((prov = OPENSSL_zalloc(sizeof(*prov))) == NULL
^
179. #ifndef HAVE_ATOMICS
180. || (prov->refcnt_lock = CRYPTO_THREAD_lock_new()) == NULL
crypto/provider_core.c:182:13:
180. || (prov->refcnt_lock = CRYPTO_THREAD_lock_new()) == NULL
181. #endif
182. > || !ossl_provider_upref(prov) /* +1 One reference to be returned */
183. || (prov->name = OPENSSL_strdup(name)) == NULL) {
184. ossl_provider_free(prov);
crypto/provider_core.c:193:1: start of procedure ossl_provider_upref()
191. }
192.
193. > int ossl_provider_upref(OSSL_PROVIDER *prov)
194. {
195. int ref = 0;
crypto/provider_core.c:195:5:
193. int ossl_provider_upref(OSSL_PROVIDER *prov)
194. {
195. > int ref = 0;
196.
197. CRYPTO_UP_REF(&prov->refcnt, &ref, prov->refcnt_lock);
crypto/provider_core.c:197:5:
195. int ref = 0;
196.
197. > CRYPTO_UP_REF(&prov->refcnt, &ref, prov->refcnt_lock);
198. return ref;
199. }
include/internal/refcount.h:33:1: start of procedure CRYPTO_UP_REF()
31. typedef _Atomic int CRYPTO_REF_COUNT;
32.
33. > static inline int CRYPTO_UP_REF(_Atomic int *val, int *ret, void *lock)
34. {
35. *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1;
include/internal/refcount.h:35:5:
33. static inline int CRYPTO_UP_REF(_Atomic int *val, int *ret, void *lock)
34. {
35. > *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1;
36. return 1;
37. }
include/internal/refcount.h:36:5:
34. {
35. *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1;
36. > return 1;
37. }
38.
include/internal/refcount.h:37:1: return from a call to CRYPTO_UP_REF
35. *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1;
36. return 1;
37. > }
38.
39. /*
crypto/provider_core.c:198:5:
196.
197. CRYPTO_UP_REF(&prov->refcnt, &ref, prov->refcnt_lock);
198. > return ref;
199. }
200.
crypto/provider_core.c:199:1: return from a call to ossl_provider_upref
197. CRYPTO_UP_REF(&prov->refcnt, &ref, prov->refcnt_lock);
198. return ref;
199. > }
200.
201. OSSL_PROVIDER *ossl_provider_new(OPENSSL_CTX *libctx, const char *name,
crypto/provider_core.c:182:13: Taking false branch
180. || (prov->refcnt_lock = CRYPTO_THREAD_lock_new()) == NULL
181. #endif
182. || !ossl_provider_upref(prov) /* +1 One reference to be returned */
^
183. || (prov->name = OPENSSL_strdup(name)) == NULL) {
184. ossl_provider_free(prov);
crypto/provider_core.c:183:12:
181. #endif
182. || !ossl_provider_upref(prov) /* +1 One reference to be returned */
183. > || (prov->name = OPENSSL_strdup(name)) == NULL) {
184. ossl_provider_free(prov);
185. CRYPTOerr(CRYPTO_F_PROVIDER_NEW, ERR_R_MALLOC_FAILURE);
crypto/o_str.c:27:1: start of procedure CRYPTO_strdup()
25. }
26.
27. > char *CRYPTO_strdup(const char *str, const char* file, int line)
28. {
29. char *ret;
crypto/o_str.c:31:9: Taking false branch
29. char *ret;
30.
31. if (str == NULL)
^
32. return NULL;
33. ret = CRYPTO_malloc(strlen(str) + 1, file, line);
crypto/o_str.c:33:5:
31. if (str == NULL)
32. return NULL;
33. > ret = CRYPTO_malloc(strlen(str) + 1, file, line);
34. if (ret != NULL)
35. strcpy(ret, str);
crypto/mem.c:192:1: start of procedure CRYPTO_malloc()
190. #endif
191.
192. > void *CRYPTO_malloc(size_t num, const char *file, int line)
193. {
194. void *ret = NULL;
crypto/mem.c:194:5:
192. void *CRYPTO_malloc(size_t num, const char *file, int line)
193. {
194. > void *ret = NULL;
195.
196. INCREMENT(malloc_count);
crypto/mem.c:197:9: Taking true branch
195.
196. INCREMENT(malloc_count);
197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
198. return malloc_impl(num, file, line);
199.
crypto/mem.c:197:32: Taking true branch
195.
196. INCREMENT(malloc_count);
197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
198. return malloc_impl(num, file, line);
199.
crypto/mem.c:198:9: Skipping __function_pointer__(): unresolved function pointer
196. INCREMENT(malloc_count);
197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
198. return malloc_impl(num, file, line);
^
199.
200. if (num == 0)
crypto/mem.c:226:1: return from a call to CRYPTO_malloc
224.
225. return ret;
226. > }
227.
228. void *CRYPTO_zalloc(size_t num, const char *file, int line)
crypto/o_str.c:34:9: Taking false branch
32. return NULL;
33. ret = CRYPTO_malloc(strlen(str) + 1, file, line);
34. if (ret != NULL)
^
35. strcpy(ret, str);
36. return ret;
crypto/o_str.c:36:5:
34. if (ret != NULL)
35. strcpy(ret, str);
36. > return ret;
37. }
38.
crypto/o_str.c:37:1: return from a call to CRYPTO_strdup
35. strcpy(ret, str);
36. return ret;
37. > }
38.
39. char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)
crypto/provider_core.c:183:12: Taking true branch
181. #endif
182. || !ossl_provider_upref(prov) /* +1 One reference to be returned */
183. || (prov->name = OPENSSL_strdup(name)) == NULL) {
^
184. ossl_provider_free(prov);
185. CRYPTOerr(CRYPTO_F_PROVIDER_NEW, ERR_R_MALLOC_FAILURE);
crypto/provider_core.c:184:9: Skipping ossl_provider_free(): empty list of specs
182. || !ossl_provider_upref(prov) /* +1 One reference to be returned */
183. || (prov->name = OPENSSL_strdup(name)) == NULL) {
184. ossl_provider_free(prov);
^
185. CRYPTOerr(CRYPTO_F_PROVIDER_NEW, ERR_R_MALLOC_FAILURE);
186. return NULL;
|
https://github.com/openssl/openssl/blob/905c9a72a708701597891527b422c7f374125c52/crypto/provider_core.c/#L184
|
d2a_code_trace_data_42135
|
static int opt_preset(const char *opt, const char *arg)
{
FILE *f=NULL;
char filename[1000], tmp[1000], tmp2[1000], line[1000];
char *codec_name = *opt == 'v' ? video_codec_name :
*opt == 'a' ? audio_codec_name :
subtitle_codec_name;
if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
fprintf(stderr, "File for preset '%s' not found\n", arg);
ffmpeg_exit(1);
}
while(!feof(f)){
int e= fscanf(f, "%999[^\n]\n", line) - 1;
if(line[0] == '#' && !e)
continue;
e|= sscanf(line, "%999[^=]=%999[^\n]\n", tmp, tmp2) - 2;
if(e){
fprintf(stderr, "%s: Invalid syntax: '%s'\n", filename, line);
ffmpeg_exit(1);
}
if(!strcmp(tmp, "acodec")){
opt_audio_codec(tmp, tmp2);
}else if(!strcmp(tmp, "vcodec")){
opt_video_codec(tmp, tmp2);
}else if(!strcmp(tmp, "scodec")){
opt_subtitle_codec(tmp, tmp2);
}else if(!strcmp(tmp, "dcodec")){
opt_data_codec(tmp, tmp2);
}else if(opt_default(tmp, tmp2) < 0){
fprintf(stderr, "%s: Invalid option or argument: '%s', parsed as '%s' = '%s'\n", filename, line, tmp, tmp2);
ffmpeg_exit(1);
}
}
fclose(f);
return 0;
}
ffmpeg.c:4212: error: Null Dereference
pointer `f` last assigned on line 4207 could be null and is dereferenced by call to `feof()` at line 4212, column 12.
ffmpeg.c:4199:1: start of procedure opt_preset()
4197. }
4198.
4199. static int opt_preset(const char *opt, const char *arg)
^
4200. {
4201. FILE *f=NULL;
ffmpeg.c:4201:5:
4199. static int opt_preset(const char *opt, const char *arg)
4200. {
4201. FILE *f=NULL;
^
4202. char filename[1000], tmp[1000], tmp2[1000], line[1000];
4203. char *codec_name = *opt == 'v' ? video_codec_name :
ffmpeg.c:4203:24: Condition is false
4201. FILE *f=NULL;
4202. char filename[1000], tmp[1000], tmp2[1000], line[1000];
4203. char *codec_name = *opt == 'v' ? video_codec_name :
^
4204. *opt == 'a' ? audio_codec_name :
4205. subtitle_codec_name;
ffmpeg.c:4204:24: Condition is false
4202. char filename[1000], tmp[1000], tmp2[1000], line[1000];
4203. char *codec_name = *opt == 'v' ? video_codec_name :
4204. *opt == 'a' ? audio_codec_name :
^
4205. subtitle_codec_name;
4206.
ffmpeg.c:4203:24:
4201. FILE *f=NULL;
4202. char filename[1000], tmp[1000], tmp2[1000], line[1000];
4203. char *codec_name = *opt == 'v' ? video_codec_name :
^
4204. *opt == 'a' ? audio_codec_name :
4205. subtitle_codec_name;
ffmpeg.c:4203:5:
4201. FILE *f=NULL;
4202. char filename[1000], tmp[1000], tmp2[1000], line[1000];
4203. char *codec_name = *opt == 'v' ? video_codec_name :
^
4204. *opt == 'a' ? audio_codec_name :
4205. subtitle_codec_name;
ffmpeg.c:4207:64: Condition is false
4205. subtitle_codec_name;
4206.
4207. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
^
4208. fprintf(stderr, "File for preset '%s' not found\n", arg);
4209. ffmpeg_exit(1);
ffmpeg.c:4207:11: Taking true branch
4205. subtitle_codec_name;
4206.
4207. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
^
4208. fprintf(stderr, "File for preset '%s' not found\n", arg);
4209. ffmpeg_exit(1);
ffmpeg.c:4208:9:
4206.
4207. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
4208. fprintf(stderr, "File for preset '%s' not found\n", arg);
^
4209. ffmpeg_exit(1);
4210. }
ffmpeg.c:4209:9: Skipping ffmpeg_exit(): empty list of specs
4207. if (!(f = get_preset_file(filename, sizeof(filename), arg, *opt == 'f', codec_name))) {
4208. fprintf(stderr, "File for preset '%s' not found\n", arg);
4209. ffmpeg_exit(1);
^
4210. }
4211.
ffmpeg.c:4212:12:
4210. }
4211.
4212. while(!feof(f)){
^
4213. int e= fscanf(f, "%999[^\n]\n", line) - 1;
4214. if(line[0] == '#' && !e)
|
https://github.com/libav/libav/blob/eb97dbb05a990266b04830ea8e179e0428656b98/ffmpeg.c/#L4212
|
d2a_code_trace_data_42136
|
static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type)
{
OutputStream *ost;
AVStream *st = avformat_new_stream(oc, NULL);
int idx = oc->nb_streams - 1, ret = 0;
char *bsf = NULL, *next, *codec_tag = NULL;
AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL;
double qscale = -1;
char *buf = NULL, *arg = NULL, *preset = NULL;
AVIOContext *s = NULL;
if (!st) {
av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n");
exit_program(1);
}
if (oc->nb_streams - 1 < o->nb_streamid_map)
st->id = o->streamid_map[oc->nb_streams - 1];
output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams,
nb_output_streams + 1);
ost = &output_streams[nb_output_streams - 1];
ost->file_index = nb_output_files;
ost->index = idx;
ost->st = st;
st->codec->codec_type = type;
choose_encoder(o, oc, ost);
if (ost->enc) {
ost->opts = filter_codec_opts(codec_opts, ost->enc->id, oc, st);
}
avcodec_get_context_defaults3(st->codec, ost->enc);
st->codec->codec_type = type;
MATCH_PER_STREAM_OPT(presets, str, preset, oc, st);
if (preset && (!(ret = get_preset_file_2(preset, ost->enc->name, &s)))) {
do {
buf = get_line(s);
if (!buf[0] || buf[0] == '#') {
av_free(buf);
continue;
}
if (!(arg = strchr(buf, '='))) {
av_log(NULL, AV_LOG_FATAL, "Invalid line found in the preset file.\n");
exit_program(1);
}
*arg++ = 0;
av_dict_set(&ost->opts, buf, arg, AV_DICT_DONT_OVERWRITE);
av_free(buf);
} while (!s->eof_reached);
avio_close(s);
}
if (ret) {
av_log(NULL, AV_LOG_FATAL,
"Preset %s specified for stream %d:%d, but could not be opened.\n",
preset, ost->file_index, ost->index);
exit_program(1);
}
ost->max_frames = INT64_MAX;
MATCH_PER_STREAM_OPT(max_frames, i64, ost->max_frames, oc, st);
MATCH_PER_STREAM_OPT(bitstream_filters, str, bsf, oc, st);
while (bsf) {
if (next = strchr(bsf, ','))
*next++ = 0;
if (!(bsfc = av_bitstream_filter_init(bsf))) {
av_log(NULL, AV_LOG_FATAL, "Unknown bitstream filter %s\n", bsf);
exit_program(1);
}
if (bsfc_prev)
bsfc_prev->next = bsfc;
else
ost->bitstream_filters = bsfc;
bsfc_prev = bsfc;
bsf = next;
}
MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, oc, st);
if (codec_tag) {
uint32_t tag = strtol(codec_tag, &next, 0);
if (*next)
tag = AV_RL32(codec_tag);
st->codec->codec_tag = tag;
}
MATCH_PER_STREAM_OPT(qscale, dbl, qscale, oc, st);
if (qscale >= 0 || same_quant) {
st->codec->flags |= CODEC_FLAG_QSCALE;
st->codec->global_quality = FF_QP2LAMBDA * qscale;
}
if (oc->oformat->flags & AVFMT_GLOBALHEADER)
st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
av_opt_get_int(sws_opts, "sws_flags", 0, &ost->sws_flags);
return ost;
}
avconv.c:3436: error: Null Dereference
pointer `st` last assigned on line 3422 could be null and is dereferenced at line 3436, column 9.
avconv.c:3419:1: start of procedure new_output_stream()
3417. }
3418.
3419. static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type)
^
3420. {
3421. OutputStream *ost;
avconv.c:3422:5:
3420. {
3421. OutputStream *ost;
3422. AVStream *st = avformat_new_stream(oc, NULL);
^
3423. int idx = oc->nb_streams - 1, ret = 0;
3424. char *bsf = NULL, *next, *codec_tag = NULL;
libavformat/utils.c:2742:1: start of procedure avformat_new_stream()
2740. #endif
2741.
2742. AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c)
^
2743. {
2744. AVStream *st;
libavformat/utils.c:2748:9: Taking true branch
2746. AVStream **streams;
2747.
2748. if (s->nb_streams >= INT_MAX/sizeof(*streams))
^
2749. return NULL;
2750. streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams));
libavformat/utils.c:2749:9:
2747.
2748. if (s->nb_streams >= INT_MAX/sizeof(*streams))
2749. return NULL;
^
2750. streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams));
2751. if (!streams)
libavformat/utils.c:2790:1: return from a call to avformat_new_stream
2788. s->streams[s->nb_streams++] = st;
2789. return st;
2790. }
^
2791.
2792. AVProgram *av_new_program(AVFormatContext *ac, int id)
avconv.c:3423:5:
3421. OutputStream *ost;
3422. AVStream *st = avformat_new_stream(oc, NULL);
3423. int idx = oc->nb_streams - 1, ret = 0;
^
3424. char *bsf = NULL, *next, *codec_tag = NULL;
3425. AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL;
avconv.c:3424:5:
3422. AVStream *st = avformat_new_stream(oc, NULL);
3423. int idx = oc->nb_streams - 1, ret = 0;
3424. char *bsf = NULL, *next, *codec_tag = NULL;
^
3425. AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL;
3426. double qscale = -1;
avconv.c:3425:5:
3423. int idx = oc->nb_streams - 1, ret = 0;
3424. char *bsf = NULL, *next, *codec_tag = NULL;
3425. AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL;
^
3426. double qscale = -1;
3427. char *buf = NULL, *arg = NULL, *preset = NULL;
avconv.c:3426:5:
3424. char *bsf = NULL, *next, *codec_tag = NULL;
3425. AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL;
3426. double qscale = -1;
^
3427. char *buf = NULL, *arg = NULL, *preset = NULL;
3428. AVIOContext *s = NULL;
avconv.c:3427:5:
3425. AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL;
3426. double qscale = -1;
3427. char *buf = NULL, *arg = NULL, *preset = NULL;
^
3428. AVIOContext *s = NULL;
3429.
avconv.c:3428:5:
3426. double qscale = -1;
3427. char *buf = NULL, *arg = NULL, *preset = NULL;
3428. AVIOContext *s = NULL;
^
3429.
3430. if (!st) {
avconv.c:3430:10: Taking true branch
3428. AVIOContext *s = NULL;
3429.
3430. if (!st) {
^
3431. av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n");
3432. exit_program(1);
avconv.c:3431:9: Skipping av_log(): empty list of specs
3429.
3430. if (!st) {
3431. av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n");
^
3432. exit_program(1);
3433. }
avconv.c:3432:9: Skipping exit_program(): empty list of specs
3430. if (!st) {
3431. av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n");
3432. exit_program(1);
^
3433. }
3434.
avconv.c:3435:9: Taking true branch
3433. }
3434.
3435. if (oc->nb_streams - 1 < o->nb_streamid_map)
^
3436. st->id = o->streamid_map[oc->nb_streams - 1];
3437.
avconv.c:3436:9:
3434.
3435. if (oc->nb_streams - 1 < o->nb_streamid_map)
3436. st->id = o->streamid_map[oc->nb_streams - 1];
^
3437.
3438. output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams,
|
https://github.com/libav/libav/blob/e1e369049e3d2f88eed6ed38eb3dd704681c7f1a/avconv.c/#L3436
|
d2a_code_trace_data_42137
|
static int
JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result)
{
if (data->bufferbytesleft==0)
{
uint32 m;
if (data->filebytesleft==0)
return(0);
if (!data->filepositioned)
{
TIFFSeekFile(data->tif,data->fileoffset,SEEK_SET);
data->filepositioned=1;
}
m=data->buffersize;
if ((uint64)m>data->filebytesleft)
m=(uint32)data->filebytesleft;
assert(m<0x80000000UL);
if (TIFFReadFile(data->tif,data->buffer,(tmsize_t)m)!=(tmsize_t)m)
return(0);
data->buffercurrentbyte=data->buffer;
data->bufferbytesleft=m;
data->fileoffset+=m;
data->filebytesleft-=m;
}
*result=*data->buffercurrentbyte;
data->buffercurrentbyte++;
data->bufferbytesleft--;
return(1);
}
libtiff/tif_jpeg.c:808: error: Integer Overflow L2
([1, +oo] - [0, 2147483647]):unsigned64 by call to `JPEGFixupTagsSubsamplingReadWord`.
libtiff/tif_jpeg.c:743:1: Parameter `data->filebytesleft`
741. }
742.
743. static int
^
744. JPEGFixupTagsSubsamplingSec(struct JPEGFixupTagsSubsamplingData* data)
745. {
libtiff/tif_jpeg.c:752:9: Call
750. while (1)
751. {
752. if (!JPEGFixupTagsSubsamplingReadByte(data,&m))
^
753. return(0);
754. if (m==255)
libtiff/tif_jpeg.c:855:1: Parameter `data->filebytesleft`
853. }
854.
855. static int
^
856. JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result)
857. {
libtiff/tif_jpeg.c:759:9: Call
757. while (1)
758. {
759. if (!JPEGFixupTagsSubsamplingReadByte(data,&m))
^
760. return(0);
761. if (m!=255)
libtiff/tif_jpeg.c:855:1: Parameter `data->filebytesleft`
853. }
854.
855. static int
^
856. JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result)
857. {
libtiff/tif_jpeg.c:808:11: Call
806. uint8 p;
807. uint8 ph,pv;
808. if (!JPEGFixupTagsSubsamplingReadWord(data,&n))
^
809. return(0);
810. if (n!=8+data->tif->tif_dir.td_samplesperpixel*3)
libtiff/tif_jpeg.c:885:1: Parameter `data->filebytesleft`
883. }
884.
885. static int
^
886. JPEGFixupTagsSubsamplingReadWord(struct JPEGFixupTagsSubsamplingData* data, uint16* result)
887. {
libtiff/tif_jpeg.c:890:7: Call
888. uint8 ma;
889. uint8 mb;
890. if (!JPEGFixupTagsSubsamplingReadByte(data,&ma))
^
891. return(0);
892. if (!JPEGFixupTagsSubsamplingReadByte(data,&mb))
libtiff/tif_jpeg.c:855:1: <LHS trace>
853. }
854.
855. static int
^
856. JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result)
857. {
libtiff/tif_jpeg.c:855:1: Parameter `data->filebytesleft`
853. }
854.
855. static int
^
856. JPEGFixupTagsSubsamplingReadByte(struct JPEGFixupTagsSubsamplingData* data, uint8* result)
857. {
libtiff/tif_jpeg.c:872:7: <RHS trace>
870. m=(uint32)data->filebytesleft;
871. assert(m<0x80000000UL);
872. if (TIFFReadFile(data->tif,data->buffer,(tmsize_t)m)!=(tmsize_t)m)
^
873. return(0);
874. data->buffercurrentbyte=data->buffer;
libtiff/tif_jpeg.c:872:7: Unknown value from: non-const function
870. m=(uint32)data->filebytesleft;
871. assert(m<0x80000000UL);
872. if (TIFFReadFile(data->tif,data->buffer,(tmsize_t)m)!=(tmsize_t)m)
^
873. return(0);
874. data->buffercurrentbyte=data->buffer;
libtiff/tif_jpeg.c:877:3: Binary operation: ([1, +oo] - [0, 2147483647]):unsigned64 by call to `JPEGFixupTagsSubsamplingReadWord`
875. data->bufferbytesleft=m;
876. data->fileoffset+=m;
877. data->filebytesleft-=m;
^
878. }
879. *result=*data->buffercurrentbyte;
|
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_jpeg.c/#L877
|
d2a_code_trace_data_42138
|
static int sab_diamond_search(MpegEncContext * s, int *best, int dmin,
int src_index, int ref_index, int const penalty_factor,
int size, int h, int flags)
{
MotionEstContext * const c= &s->me;
me_cmp_func cmpf, chroma_cmpf;
Minima minima[MAX_SAB_SIZE];
const int minima_count= FFABS(c->dia_size);
int i, j;
LOAD_COMMON
LOAD_COMMON2
int map_generation= c->map_generation;
cmpf= s->dsp.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1];
for(j=i=0; i<ME_MAP_SIZE && j<MAX_SAB_SIZE; i++){
uint32_t key= map[i];
key += (1<<(ME_MAP_MV_BITS-1)) + (1<<(2*ME_MAP_MV_BITS-1));
if((key&((-1)<<(2*ME_MAP_MV_BITS))) != map_generation) continue;
minima[j].height= score_map[i];
minima[j].x= key & ((1<<ME_MAP_MV_BITS)-1); key>>=ME_MAP_MV_BITS;
minima[j].y= key & ((1<<ME_MAP_MV_BITS)-1);
minima[j].x-= (1<<(ME_MAP_MV_BITS-1));
minima[j].y-= (1<<(ME_MAP_MV_BITS-1));
if( minima[j].x > xmax || minima[j].x < xmin
|| minima[j].y > ymax || minima[j].y < ymin)
continue;
minima[j].checked=0;
if(minima[j].x || minima[j].y)
minima[j].height+= (mv_penalty[((minima[j].x)<<shift)-pred_x] + mv_penalty[((minima[j].y)<<shift)-pred_y])*penalty_factor;
j++;
}
qsort(minima, j, sizeof(Minima), minima_cmp);
for(; j<minima_count; j++){
minima[j].height=256*256*256*64;
minima[j].checked=0;
minima[j].x= minima[j].y=0;
}
for(i=0; i<minima_count; i++){
const int x= minima[i].x;
const int y= minima[i].y;
int d;
if(minima[i].checked) continue;
if( x >= xmax || x <= xmin
|| y >= ymax || y <= ymin)
continue;
SAB_CHECK_MV(x-1, y)
SAB_CHECK_MV(x+1, y)
SAB_CHECK_MV(x , y-1)
SAB_CHECK_MV(x , y+1)
minima[i].checked= 1;
}
best[0]= minima[0].x;
best[1]= minima[0].y;
dmin= minima[0].height;
if( best[0] < xmax && best[0] > xmin
&& best[1] < ymax && best[1] > ymin){
int d;
CHECK_MV(best[0]-1, best[1])
CHECK_MV(best[0]+1, best[1])
CHECK_MV(best[0], best[1]-1)
CHECK_MV(best[0], best[1]+1)
}
return dmin;
}
libavcodec/motion_est_template.c:885: error: Uninitialized Value
The value read from ymin was never initialized.
libavcodec/motion_est_template.c:885:29:
883.
884. if( best[0] < xmax && best[0] > xmin
885. && best[1] < ymax && best[1] > ymin){
^
886. int d;
887. //ensure that the refernece samples for hpel refinement are in the map
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L885
|
d2a_code_trace_data_42139
|
static int expand(OPENSSL_LHASH *lh)
{
OPENSSL_LH_NODE **n, **n1, **n2, *np;
unsigned int p, i, j;
unsigned long hash, nni;
lh->num_nodes++;
lh->num_expands++;
p = (int)lh->p++;
n1 = &(lh->b[p]);
n2 = &(lh->b[p + (int)lh->pmax]);
*n2 = NULL;
nni = lh->num_alloc_nodes;
for (np = *n1; np != NULL;) {
hash = np->hash;
if ((hash % nni) != p) {
*n1 = (*n1)->next;
np->next = *n2;
*n2 = np;
} else
n1 = &((*n1)->next);
np = *n1;
}
if ((lh->p) >= lh->pmax) {
j = (int)lh->num_alloc_nodes * 2;
n = OPENSSL_realloc(lh->b, (int)(sizeof(OPENSSL_LH_NODE *) * j));
if (n == NULL) {
lh->error++;
lh->num_nodes--;
lh->p = 0;
return 0;
}
for (i = (int)lh->num_alloc_nodes; i < j; i++)
n[i] = NULL;
lh->pmax = lh->num_alloc_nodes;
lh->num_alloc_nodes = j;
lh->num_expand_reallocs++;
lh->p = 0;
lh->b = n;
}
return 1;
}
crypto/txt_db/txt_db.c:171: error: BUFFER_OVERRUN_L3
Offset: [16, +oo] Size: [1, +oo] by call to `lh_OPENSSL_STRING_insert`.
Showing all 16 steps of the trace
crypto/txt_db/txt_db.c:162:44: Call
160. }
161. /* FIXME: we lose type checking at this point */
162. if ((idx = (LHASH_OF(OPENSSL_STRING) *)OPENSSL_LH_new(hash, cmp)) == NULL) {
^
163. db->error = DB_ERROR_MALLOC;
164. return (0);
crypto/lhash/lhash.c:38:5: Assignment
36. ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h);
37. ret->num_nodes = MIN_NODES / 2;
38. ret->num_alloc_nodes = MIN_NODES;
^
39. ret->pmax = MIN_NODES / 2;
40. ret->up_load = UP_LOAD;
crypto/txt_db/txt_db.c:171:18: Call
169. if ((qual != NULL) && (qual(r) == 0))
170. continue;
171. if ((k = lh_OPENSSL_STRING_insert(idx, r)) != NULL) {
^
172. db->error = DB_ERROR_INDEX_CLASH;
173. db->arg1 = sk_OPENSSL_PSTRING_find(db->data, k);
include/openssl/lhash.h:197:1: Parameter `lh->num_alloc_nodes`
195. LHASH_OF(type)
196.
197. > DEFINE_LHASH_OF(OPENSSL_STRING);
198. # ifdef _MSC_VER
199. /*
include/openssl/lhash.h:197:1: Call
195. LHASH_OF(type)
196.
197. > DEFINE_LHASH_OF(OPENSSL_STRING);
198. # ifdef _MSC_VER
199. /*
crypto/lhash/lhash.c:70:1: Parameter `lh->num_alloc_nodes`
68. }
69.
70. > void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data)
71. {
72. unsigned long hash;
crypto/lhash/lhash.c:77:77: Call
75.
76. lh->error = 0;
77. if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh))
^
78. return NULL; /* 'lh->error++' already done in 'expand' */
79.
crypto/lhash/lhash.c:187:1: <Offset trace>
185. }
186.
187. > static int expand(OPENSSL_LHASH *lh)
188. {
189. OPENSSL_LH_NODE **n, **n1, **n2, *np;
crypto/lhash/lhash.c:187:1: Parameter `lh->num_alloc_nodes`
185. }
186.
187. > static int expand(OPENSSL_LHASH *lh)
188. {
189. OPENSSL_LH_NODE **n, **n1, **n2, *np;
crypto/lhash/lhash.c:213:9: Assignment
211.
212. if ((lh->p) >= lh->pmax) {
213. j = (int)lh->num_alloc_nodes * 2;
^
214. n = OPENSSL_realloc(lh->b, (int)(sizeof(OPENSSL_LH_NODE *) * j));
215. if (n == NULL) {
crypto/lhash/lhash.c:187:1: <Length trace>
185. }
186.
187. > static int expand(OPENSSL_LHASH *lh)
188. {
189. OPENSSL_LH_NODE **n, **n1, **n2, *np;
crypto/lhash/lhash.c:187:1: Parameter `*lh->b`
185. }
186.
187. > static int expand(OPENSSL_LHASH *lh)
188. {
189. OPENSSL_LH_NODE **n, **n1, **n2, *np;
crypto/lhash/lhash.c:214:13: Call
212. if ((lh->p) >= lh->pmax) {
213. j = (int)lh->num_alloc_nodes * 2;
214. n = OPENSSL_realloc(lh->b, (int)(sizeof(OPENSSL_LH_NODE *) * j));
^
215. if (n == NULL) {
216. lh->error++;
crypto/mem.c:207:9: Assignment
205. if (num == 0) {
206. CRYPTO_free(str, file, line);
207. return NULL;
^
208. }
209.
crypto/lhash/lhash.c:214:9: Assignment
212. if ((lh->p) >= lh->pmax) {
213. j = (int)lh->num_alloc_nodes * 2;
214. n = OPENSSL_realloc(lh->b, (int)(sizeof(OPENSSL_LH_NODE *) * j));
^
215. if (n == NULL) {
216. lh->error++;
crypto/lhash/lhash.c:222:13: Array access: Offset: [16, +oo] Size: [1, +oo] by call to `lh_OPENSSL_STRING_insert`
220. }
221. for (i = (int)lh->num_alloc_nodes; i < j; i++) /* 26/02/92 eay */
222. n[i] = NULL; /* 02/03/92 eay */
^
223. lh->pmax = lh->num_alloc_nodes;
224. lh->num_alloc_nodes = j;
|
https://github.com/openssl/openssl/blob/3f97052392cb10fca5309212bf720685262ad4a6/crypto/lhash/lhash.c/#L222
|
d2a_code_trace_data_42140
|
static int sdp_read_header(AVFormatContext *s)
{
RTSPState *rt = s->priv_data;
RTSPStream *rtsp_st;
int size, i, err;
char *content;
char url[1024];
if (!ff_network_init())
return AVERROR(EIO);
if (s->max_delay < 0)
s->max_delay = DEFAULT_REORDERING_DELAY;
if (rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)
rt->lower_transport = RTSP_LOWER_TRANSPORT_CUSTOM;
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];
if (!(rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)) {
getnameinfo((struct sockaddr*) &rtsp_st->sdp_ip, sizeof(rtsp_st->sdp_ip),
namebuf, sizeof(namebuf), NULL, 0, NI_NUMERICHOST);
ff_url_join(url, sizeof(url), "rtp", NULL,
namebuf, rtsp_st->sdp_port,
"?localport=%d&ttl=%d&connect=%d", rtsp_st->sdp_port,
rtsp_st->sdp_ttl,
rt->rtsp_flags & RTSP_FLAG_FILTER_SRC ? 1 : 0);
if (ffurl_open(&rtsp_st->rtp_handle, url, AVIO_FLAG_READ_WRITE,
&s->interrupt_callback, NULL) < 0) {
err = AVERROR_INVALIDDATA;
goto fail;
}
}
if ((err = ff_rtsp_open_transport_ctx(s, rtsp_st)))
goto fail;
}
return 0;
fail:
ff_rtsp_close_streams(s);
ff_network_close();
return err;
}
libavformat/rtsp.c:2046: error: Null Dereference
pointer `content` last assigned on line 2040 could be null and is dereferenced at line 2046, column 5.
libavformat/rtsp.c:2022:1: start of procedure sdp_read_header()
2020. }
2021.
2022. static int sdp_read_header(AVFormatContext *s)
^
2023. {
2024. RTSPState *rt = s->priv_data;
libavformat/rtsp.c:2024:5:
2022. static int sdp_read_header(AVFormatContext *s)
2023. {
2024. RTSPState *rt = s->priv_data;
^
2025. RTSPStream *rtsp_st;
2026. int size, i, err;
libavformat/rtsp.c:2030:10:
2028. char url[1024];
2029.
2030. if (!ff_network_init())
^
2031. return AVERROR(EIO);
2032.
libavformat/network.c:121:1: start of procedure ff_network_init()
119. int ff_network_inited_globally;
120.
121. int ff_network_init(void)
^
122. {
123. #if HAVE_WINSOCK2_H
libavformat/network.c:127:10: Taking true branch
125. #endif
126.
127. if (!ff_network_inited_globally)
^
128. av_log(NULL, AV_LOG_WARNING, "Using network protocols without global "
129. "network initialization. Please use "
libavformat/network.c:128:9: Skipping av_log(): empty list of specs
126.
127. if (!ff_network_inited_globally)
128. av_log(NULL, AV_LOG_WARNING, "Using network protocols without global "
^
129. "network initialization. Please use "
130. "avformat_network_init(), this will "
libavformat/network.c:136:5:
134. return 0;
135. #endif
136. return 1;
^
137. }
138.
libavformat/network.c:137:1: return from a call to ff_network_init
135. #endif
136. return 1;
137. }
^
138.
139. int ff_network_wait_fd(int fd, int write)
libavformat/rtsp.c:2030:10: Taking false branch
2028. char url[1024];
2029.
2030. if (!ff_network_init())
^
2031. return AVERROR(EIO);
2032.
libavformat/rtsp.c:2033:9: Taking false branch
2031. return AVERROR(EIO);
2032.
2033. if (s->max_delay < 0) /* Not set by the caller */
^
2034. s->max_delay = DEFAULT_REORDERING_DELAY;
2035. if (rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)
libavformat/rtsp.c:2035:9: Taking true branch
2033. if (s->max_delay < 0) /* Not set by the caller */
2034. s->max_delay = DEFAULT_REORDERING_DELAY;
2035. if (rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)
^
2036. rt->lower_transport = RTSP_LOWER_TRANSPORT_CUSTOM;
2037.
libavformat/rtsp.c:2036:9:
2034. s->max_delay = DEFAULT_REORDERING_DELAY;
2035. if (rt->rtsp_flags & RTSP_FLAG_CUSTOM_IO)
2036. rt->lower_transport = RTSP_LOWER_TRANSPORT_CUSTOM;
^
2037.
2038. /* read the whole sdp file */
libavformat/rtsp.c:2040:5:
2038. /* read the whole sdp file */
2039. /* XXX: better loading */
2040. content = av_malloc(SDP_MAX_SIZE);
^
2041. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
2042. if (size <= 0) {
libavutil/mem.c:61:1: start of procedure av_malloc()
59. * linker will do it automatically. */
60.
61. void *av_malloc(size_t size)
^
62. {
63. void *ptr = NULL;
libavutil/mem.c:63:5:
61. void *av_malloc(size_t size)
62. {
63. void *ptr = NULL;
^
64. #if CONFIG_MEMALIGN_HACK
65. long diff;
libavutil/mem.c:69:9: Taking false branch
67.
68. /* let's disallow possible ambiguous cases */
69. if (size > (INT_MAX - 32) || !size)
^
70. return NULL;
71.
libavutil/mem.c:69:35: Taking false branch
67.
68. /* let's disallow possible ambiguous cases */
69. if (size > (INT_MAX - 32) || !size)
^
70. return NULL;
71.
libavutil/mem.c:80:9: Taking true branch
78. ((char *)ptr)[-1] = diff;
79. #elif HAVE_POSIX_MEMALIGN
80. if (posix_memalign(&ptr, 32, size))
^
81. ptr = NULL;
82. #elif HAVE_ALIGNED_MALLOC
libavutil/mem.c:81:9:
79. #elif HAVE_POSIX_MEMALIGN
80. if (posix_memalign(&ptr, 32, size))
81. ptr = NULL;
^
82. #elif HAVE_ALIGNED_MALLOC
83. ptr = _aligned_malloc(size, 32);
libavutil/mem.c:113:5:
111. ptr = malloc(size);
112. #endif
113. return ptr;
^
114. }
115.
libavutil/mem.c:114:1: return from a call to av_malloc
112. #endif
113. return ptr;
114. }
^
115.
116. void *av_realloc(void *ptr, size_t size)
libavformat/rtsp.c:2041:5: Skipping avio_read(): empty list of specs
2039. /* XXX: better loading */
2040. content = av_malloc(SDP_MAX_SIZE);
2041. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
^
2042. if (size <= 0) {
2043. av_free(content);
libavformat/rtsp.c:2042:9: Taking false branch
2040. content = av_malloc(SDP_MAX_SIZE);
2041. size = avio_read(s->pb, content, SDP_MAX_SIZE - 1);
2042. if (size <= 0) {
^
2043. av_free(content);
2044. return AVERROR_INVALIDDATA;
libavformat/rtsp.c:2046:5:
2044. return AVERROR_INVALIDDATA;
2045. }
2046. content[size] ='\0';
^
2047.
2048. err = ff_sdp_parse(s, content);
|
https://github.com/libav/libav/blob/92e354b655613b88c3c202a7e19e7037daed37eb/libavformat/rtsp.c/#L2046
|
d2a_code_trace_data_42141
|
unsigned char *next_protos_parse(size_t *outlen, const char *in)
{
size_t len;
unsigned char *out;
size_t i, start = 0;
len = strlen(in);
if (len >= 65535)
return NULL;
out = app_malloc(strlen(in) + 1, "NPN buffer");
for (i = 0; i <= len; ++i) {
if (i == len || in[i] == ',') {
if (i - start > 255) {
OPENSSL_free(out);
return NULL;
}
out[start] = (unsigned char)(i - start);
start = i + 1;
} else {
out[i + 1] = in[i];
}
}
*outlen = len + 1;
return out;
}
apps/apps.c:1815: error: NULL_DEREFERENCE
pointer `out` last assigned on line 1805 could be null and is dereferenced at line 1815, column 13.
Showing all 25 steps of the trace
apps/apps.c:1795:1: start of procedure next_protos_parse()
1793. * returns: a malloc'd buffer or NULL on failure.
1794. */
1795. > unsigned char *next_protos_parse(size_t *outlen, const char *in)
1796. {
1797. size_t len;
apps/apps.c:1799:5:
1797. size_t len;
1798. unsigned char *out;
1799. > size_t i, start = 0;
1800.
1801. len = strlen(in);
apps/apps.c:1801:5:
1799. size_t i, start = 0;
1800.
1801. > len = strlen(in);
1802. if (len >= 65535)
1803. return NULL;
apps/apps.c:1802:9: Taking false branch
1800.
1801. len = strlen(in);
1802. if (len >= 65535)
^
1803. return NULL;
1804.
apps/apps.c:1805:5:
1803. return NULL;
1804.
1805. > out = app_malloc(strlen(in) + 1, "NPN buffer");
1806. for (i = 0; i <= len; ++i) {
1807. if (i == len || in[i] == ',') {
test/testutil/apps_mem.c:14:1: start of procedure app_malloc()
12. /* shim that avoids sucking in too much from apps/apps.c */
13.
14. > void* app_malloc(int sz, const char *what)
15. {
16. void *vp = OPENSSL_malloc(sz);
test/testutil/apps_mem.c:16:5:
14. void* app_malloc(int sz, const char *what)
15. {
16. > void *vp = OPENSSL_malloc(sz);
17.
18. return vp;
crypto/mem.c:192:1: start of procedure CRYPTO_malloc()
190. #endif
191.
192. > void *CRYPTO_malloc(size_t num, const char *file, int line)
193. {
194. void *ret = NULL;
crypto/mem.c:194:5:
192. void *CRYPTO_malloc(size_t num, const char *file, int line)
193. {
194. > void *ret = NULL;
195.
196. INCREMENT(malloc_count);
crypto/mem.c:197:9: Taking false branch
195.
196. INCREMENT(malloc_count);
197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
^
198. return malloc_impl(num, file, line);
199.
crypto/mem.c:200:9: Taking false branch
198. return malloc_impl(num, file, line);
199.
200. if (num == 0)
^
201. return NULL;
202.
crypto/mem.c:204:9: Taking true branch
202.
203. FAILTEST();
204. if (allow_customize) {
^
205. /*
206. * Disallow customization after the first allocation. We only set this
crypto/mem.c:210:9:
208. * allocation.
209. */
210. > allow_customize = 0;
211. }
212. #ifndef OPENSSL_NO_CRYPTO_MDEBUG
crypto/mem.c:221:5:
219. }
220. #else
221. > (void)(file); (void)(line);
222. ret = malloc(num);
223. #endif
crypto/mem.c:221:19:
219. }
220. #else
221. > (void)(file); (void)(line);
222. ret = malloc(num);
223. #endif
crypto/mem.c:222:5:
220. #else
221. (void)(file); (void)(line);
222. > ret = malloc(num);
223. #endif
224.
crypto/mem.c:225:5:
223. #endif
224.
225. > return ret;
226. }
227.
crypto/mem.c:226:1: return from a call to CRYPTO_malloc
224.
225. return ret;
226. > }
227.
228. void *CRYPTO_zalloc(size_t num, const char *file, int line)
test/testutil/apps_mem.c:18:5:
16. void *vp = OPENSSL_malloc(sz);
17.
18. > return vp;
19. }
test/testutil/apps_mem.c:19:1: return from a call to app_malloc
17.
18. return vp;
19. > }
apps/apps.c:1806:10:
1804.
1805. out = app_malloc(strlen(in) + 1, "NPN buffer");
1806. > for (i = 0; i <= len; ++i) {
1807. if (i == len || in[i] == ',') {
1808. if (i - start > 255) {
apps/apps.c:1806:17: Loop condition is true. Entering loop body
1804.
1805. out = app_malloc(strlen(in) + 1, "NPN buffer");
1806. for (i = 0; i <= len; ++i) {
^
1807. if (i == len || in[i] == ',') {
1808. if (i - start > 255) {
apps/apps.c:1807:13: Taking false branch
1805. out = app_malloc(strlen(in) + 1, "NPN buffer");
1806. for (i = 0; i <= len; ++i) {
1807. if (i == len || in[i] == ',') {
^
1808. if (i - start > 255) {
1809. OPENSSL_free(out);
apps/apps.c:1807:25: Taking false branch
1805. out = app_malloc(strlen(in) + 1, "NPN buffer");
1806. for (i = 0; i <= len; ++i) {
1807. if (i == len || in[i] == ',') {
^
1808. if (i - start > 255) {
1809. OPENSSL_free(out);
apps/apps.c:1815:13:
1813. start = i + 1;
1814. } else {
1815. > out[i + 1] = in[i];
1816. }
1817. }
|
https://github.com/openssl/openssl/blob/d3620841cc39aaa4a3d75ea32e94ccd110b5bef4/apps/apps.c/#L1815
|
d2a_code_trace_data_42142
|
static void unpack(unsigned short *tgt, const unsigned char *src, unsigned int len)
{
int x,y,z;
int n,temp;
int buffer[len];
for (x=0;x<len;tgt[x++]=0)
buffer[x]=9+(x&1);
for (x=y=z=0;x<len ;x++) {
n=buffer[y]-z;
temp=src[x];
if (n<8) temp&=255>>(8-n);
tgt[y]+=temp<<z;
if (n<=8) {
tgt[++y]+=src[x]>>n;
z=8-n;
} else z+=8;
}
}
libavcodec/ra288.c:62: error: Uninitialized Value
The value read from buffer[_] was never initialized.
libavcodec/ra288.c:62:5:
60.
61. for (x=y=z=0;x<len/*was 38*/;x++) {
62. n=buffer[y]-z;
^
63. temp=src[x];
64. if (n<8) temp&=255>>(8-n);
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ra288.c/#L62
|
d2a_code_trace_data_42143
|
SwsVector *sws_getConstVec(double c, int length){
int i;
double *coeff= av_malloc(length*sizeof(double));
SwsVector *vec= av_malloc(sizeof(SwsVector));
vec->coeff= coeff;
vec->length= length;
for (i=0; i<length; i++)
coeff[i]= c;
return vec;
}
libswscale/swscale.c:2914: error: Null Dereference
pointer `vec` last assigned on line 2912 could be null and is dereferenced at line 2914, column 5.
libswscale/swscale.c:2909:1: start of procedure sws_getConstVec()
2907. }
2908.
2909. SwsVector *sws_getConstVec(double c, int length){
^
2910. int i;
2911. double *coeff= av_malloc(length*sizeof(double));
libswscale/swscale.c:2911:5:
2909. SwsVector *sws_getConstVec(double c, int length){
2910. int i;
2911. double *coeff= av_malloc(length*sizeof(double));
^
2912. SwsVector *vec= av_malloc(sizeof(SwsVector));
2913.
libavutil/mem.c:47:1: start of procedure av_malloc()
45. linker will do it automatically. */
46.
47. void *av_malloc(unsigned int size)
^
48. {
49. void *ptr = NULL;
libavutil/mem.c:49:5:
47. void *av_malloc(unsigned int size)
48. {
49. void *ptr = NULL;
^
50. #if CONFIG_MEMALIGN_HACK
51. long diff;
libavutil/mem.c:55:8: Taking false branch
53.
54. /* let's disallow possible ambiguous cases */
55. if(size > (INT_MAX-16) )
^
56. return NULL;
57.
libavutil/mem.c:66:9: Taking false branch
64. ((char*)ptr)[-1]= diff;
65. #elif HAVE_POSIX_MEMALIGN
66. if (posix_memalign(&ptr,16,size))
^
67. ptr = NULL;
68. #elif HAVE_MEMALIGN
libavutil/mem.c:99:5:
97. ptr = malloc(size);
98. #endif
99. return ptr;
^
100. }
101.
libavutil/mem.c:100:1: return from a call to av_malloc
98. #endif
99. return ptr;
100. }
^
101.
102. void *av_realloc(void *ptr, unsigned int size)
libswscale/swscale.c:2912:5:
2910. int i;
2911. double *coeff= av_malloc(length*sizeof(double));
2912. SwsVector *vec= av_malloc(sizeof(SwsVector));
^
2913.
2914. vec->coeff= coeff;
libavutil/mem.c:47:1: start of procedure av_malloc()
45. linker will do it automatically. */
46.
47. void *av_malloc(unsigned int size)
^
48. {
49. void *ptr = NULL;
libavutil/mem.c:49:5:
47. void *av_malloc(unsigned int size)
48. {
49. void *ptr = NULL;
^
50. #if CONFIG_MEMALIGN_HACK
51. long diff;
libavutil/mem.c:55:8: Taking false branch
53.
54. /* let's disallow possible ambiguous cases */
55. if(size > (INT_MAX-16) )
^
56. return NULL;
57.
libavutil/mem.c:66:9: Taking true branch
64. ((char*)ptr)[-1]= diff;
65. #elif HAVE_POSIX_MEMALIGN
66. if (posix_memalign(&ptr,16,size))
^
67. ptr = NULL;
68. #elif HAVE_MEMALIGN
libavutil/mem.c:67:9:
65. #elif HAVE_POSIX_MEMALIGN
66. if (posix_memalign(&ptr,16,size))
67. ptr = NULL;
^
68. #elif HAVE_MEMALIGN
69. ptr = memalign(16,size);
libavutil/mem.c:99:5:
97. ptr = malloc(size);
98. #endif
99. return ptr;
^
100. }
101.
libavutil/mem.c:100:1: return from a call to av_malloc
98. #endif
99. return ptr;
100. }
^
101.
102. void *av_realloc(void *ptr, unsigned int size)
libswscale/swscale.c:2914:5:
2912. SwsVector *vec= av_malloc(sizeof(SwsVector));
2913.
2914. vec->coeff= coeff;
^
2915. vec->length= length;
2916.
|
https://github.com/libav/libav/blob/184bc53db4fded8857af09cee2adc7197940deb7/libswscale/swscale.c/#L2914
|
d2a_code_trace_data_42144
|
static void imdct36(int *out, int *buf, int *in, int *win)
{
int i, j, t0, t1, t2, t3, s0, s1, s2, s3;
int tmp[18], *tmp1, *in1;
for(i=17;i>=1;i--)
in[i] += in[i-1];
for(i=17;i>=3;i-=2)
in[i] += in[i-2];
for(j=0;j<2;j++) {
tmp1 = tmp + j;
in1 = in + j;
#if 0
int64_t t0, t1, t2, t3;
t2 = in1[2*4] + in1[2*8] - in1[2*2];
t3 = (in1[2*0] + (int64_t)(in1[2*6]>>1))<<32;
t1 = in1[2*0] - in1[2*6];
tmp1[ 6] = t1 - (t2>>1);
tmp1[16] = t1 + t2;
t0 = MUL64(2*(in1[2*2] + in1[2*4]), C2);
t1 = MUL64( in1[2*4] - in1[2*8] , -2*C8);
t2 = MUL64(2*(in1[2*2] + in1[2*8]), -C4);
tmp1[10] = (t3 - t0 - t2) >> 32;
tmp1[ 2] = (t3 + t0 + t1) >> 32;
tmp1[14] = (t3 + t2 - t1) >> 32;
tmp1[ 4] = MULH(2*(in1[2*5] + in1[2*7] - in1[2*1]), -C3);
t2 = MUL64(2*(in1[2*1] + in1[2*5]), C1);
t3 = MUL64( in1[2*5] - in1[2*7] , -2*C7);
t0 = MUL64(2*in1[2*3], C3);
t1 = MUL64(2*(in1[2*1] + in1[2*7]), -C5);
tmp1[ 0] = (t2 + t3 + t0) >> 32;
tmp1[12] = (t2 + t1 - t0) >> 32;
tmp1[ 8] = (t3 - t1 - t0) >> 32;
#else
t2 = in1[2*4] + in1[2*8] - in1[2*2];
t3 = in1[2*0] + (in1[2*6]>>1);
t1 = in1[2*0] - in1[2*6];
tmp1[ 6] = t1 - (t2>>1);
tmp1[16] = t1 + t2;
t0 = MULH(2*(in1[2*2] + in1[2*4]), C2);
t1 = MULH( in1[2*4] - in1[2*8] , -2*C8);
t2 = MULH(2*(in1[2*2] + in1[2*8]), -C4);
tmp1[10] = t3 - t0 - t2;
tmp1[ 2] = t3 + t0 + t1;
tmp1[14] = t3 + t2 - t1;
tmp1[ 4] = MULH(2*(in1[2*5] + in1[2*7] - in1[2*1]), -C3);
t2 = MULH(2*(in1[2*1] + in1[2*5]), C1);
t3 = MULH( in1[2*5] - in1[2*7] , -2*C7);
t0 = MULH(2*in1[2*3], C3);
t1 = MULH(2*(in1[2*1] + in1[2*7]), -C5);
tmp1[ 0] = t2 + t3 + t0;
tmp1[12] = t2 + t1 - t0;
tmp1[ 8] = t3 - t1 - t0;
#endif
}
i = 0;
for(j=0;j<4;j++) {
t0 = tmp[i];
t1 = tmp[i + 2];
s0 = t1 + t0;
s2 = t1 - t0;
t2 = tmp[i + 1];
t3 = tmp[i + 3];
s1 = MULH(2*(t3 + t2), icos36h[j]);
s3 = MULL(t3 - t2, icos36[8 - j]);
t0 = s0 + s1;
t1 = s0 - s1;
out[(9 + j)*SBLIMIT] = MULH(t1, win[9 + j]) + buf[9 + j];
out[(8 - j)*SBLIMIT] = MULH(t1, win[8 - j]) + buf[8 - j];
buf[9 + j] = MULH(t0, win[18 + 9 + j]);
buf[8 - j] = MULH(t0, win[18 + 8 - j]);
t0 = s2 + s3;
t1 = s2 - s3;
out[(9 + 8 - j)*SBLIMIT] = MULH(t1, win[9 + 8 - j]) + buf[9 + 8 - j];
out[( j)*SBLIMIT] = MULH(t1, win[ j]) + buf[ j];
buf[9 + 8 - j] = MULH(t0, win[18 + 9 + 8 - j]);
buf[ + j] = MULH(t0, win[18 + j]);
i += 4;
}
s0 = tmp[16];
s1 = MULH(2*tmp[17], icos36h[4]);
t0 = s0 + s1;
t1 = s0 - s1;
out[(9 + 4)*SBLIMIT] = MULH(t1, win[9 + 4]) + buf[9 + 4];
out[(8 - 4)*SBLIMIT] = MULH(t1, win[8 - 4]) + buf[8 - 4];
buf[9 + 4] = MULH(t0, win[18 + 9 + 4]);
buf[8 - 4] = MULH(t0, win[18 + 8 - 4]);
}
libavcodec/mpegaudiodec.c:2278: error: Buffer Overrun L2
Offset: [0, 97] (⇐ [0, 1] + [0, 96]) Size: 32 by call to `compute_imdct`.
libavcodec/mpegaudiodec.c:2015:1: Parameter `s->sb_samples[*][*][*]`
2013.
2014. /* main layer3 decoding function */
2015. static int mp_decode_layer3(MPADecodeContext *s)
^
2016. {
2017. int nb_granules, main_data_begin, private_bits;
libavcodec/mpegaudiodec.c:2278:13: Call
2276. sample_dump(1, g->sb_hybrid, 576);
2277. #endif
2278. compute_imdct(s, g, &s->sb_samples[ch][18 * gr][0], s->mdct_buf[ch]);
^
2279. #if defined(DEBUG)
2280. sample_dump(2, &s->sb_samples[ch][18 * gr][0], 576);
libavcodec/mpegaudiodec.c:1881:1: Parameter `*sb_samples`
1879. }
1880.
1881. static void compute_imdct(MPADecodeContext *s,
^
1882. GranuleDef *g,
1883. int32_t *sb_samples,
libavcodec/mpegaudiodec.c:1915:9: Assignment
1913. for(j=0;j<mdct_long_end;j++) {
1914. /* apply window & overlap with previous buffer */
1915. out_ptr = sb_samples + j;
^
1916. /* select window */
1917. if (g->switch_point && j < 2)
libavcodec/mpegaudiodec.c:1923:9: Call
1921. /* select frequency inversion */
1922. win = win1 + ((4 * 36) & -(j & 1));
1923. imdct36(out_ptr, buf, ptr, win);
^
1924. out_ptr += 18*SBLIMIT;
1925. ptr += 18;
libavcodec/mpegaudiodec.c:1085:9: <Offset trace>
1083.
1084. i = 0;
1085. for(j=0;j<4;j++) {
^
1086. t0 = tmp[i];
1087. t1 = tmp[i + 2];
libavcodec/mpegaudiodec.c:1085:9: Assignment
1083.
1084. i = 0;
1085. for(j=0;j<4;j++) {
^
1086. t0 = tmp[i];
1087. t1 = tmp[i + 2];
libavcodec/mpegaudiodec.c:1014:1: <Length trace>
1012.
1013. /* using Lee like decomposition followed by hand coded 9 points DCT */
1014. static void imdct36(int *out, int *buf, int *in, int *win)
^
1015. {
1016. int i, j, t0, t1, t2, t3, s0, s1, s2, s3;
libavcodec/mpegaudiodec.c:1014:1: Parameter `*out`
1012.
1013. /* using Lee like decomposition followed by hand coded 9 points DCT */
1014. static void imdct36(int *out, int *buf, int *in, int *win)
^
1015. {
1016. int i, j, t0, t1, t2, t3, s0, s1, s2, s3;
libavcodec/mpegaudiodec.c:1106:9: Array access: Offset: [0, 97] (⇐ [0, 1] + [0, 96]) Size: 32 by call to `compute_imdct`
1104. t1 = s2 - s3;
1105. out[(9 + 8 - j)*SBLIMIT] = MULH(t1, win[9 + 8 - j]) + buf[9 + 8 - j];
1106. out[( j)*SBLIMIT] = MULH(t1, win[ j]) + buf[ j];
^
1107. buf[9 + 8 - j] = MULH(t0, win[18 + 9 + 8 - j]);
1108. buf[ + j] = MULH(t0, win[18 + j]);
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L1106
|
d2a_code_trace_data_42145
|
static int mpegvideo_probe(AVProbeData *p)
{
uint32_t code= -1;
int pic=0, seq=0, slice=0, pspack=0, pes=0;
int i;
for(i=0; i<p->buf_size; i++){
code = (code<<8) + p->buf[i];
if ((code & 0xffffff00) == 0x100) {
switch(code){
case SEQ_START_CODE: seq++; break;
case PICTURE_START_CODE: pic++; break;
case SLICE_START_CODE: slice++; break;
case PACK_START_CODE: pspack++; break;
}
if ((code & 0x1f0) == VIDEO_ID) pes++;
else if((code & 0x1e0) == AUDIO_ID) pes++;
}
}
if(seq && seq*9<=pic*10 && pic*9<=slice*10 && !pspack && !pes)
return AVPROBE_SCORE_MAX/2+1;
return 0;
}
libavformat/raw.c:346: error: Integer Overflow L1
([1099511627520, +oo] + `*p->buf`):unsigned32.
libavformat/raw.c:341:5: <LHS trace>
339. static int mpegvideo_probe(AVProbeData *p)
340. {
341. uint32_t code= -1;
^
342. int pic=0, seq=0, slice=0, pspack=0, pes=0;
343. int i;
libavformat/raw.c:341:5: Assignment
339. static int mpegvideo_probe(AVProbeData *p)
340. {
341. uint32_t code= -1;
^
342. int pic=0, seq=0, slice=0, pspack=0, pes=0;
343. int i;
libavformat/raw.c:339:1: <RHS trace>
337. #define AUDIO_ID 0x000001c0
338.
339. static int mpegvideo_probe(AVProbeData *p)
^
340. {
341. uint32_t code= -1;
libavformat/raw.c:339:1: Parameter `*p->buf`
337. #define AUDIO_ID 0x000001c0
338.
339. static int mpegvideo_probe(AVProbeData *p)
^
340. {
341. uint32_t code= -1;
libavformat/raw.c:346:9: Binary operation: ([1099511627520, +oo] + *p->buf):unsigned32
344.
345. for(i=0; i<p->buf_size; i++){
346. code = (code<<8) + p->buf[i];
^
347. if ((code & 0xffffff00) == 0x100) {
348. switch(code){
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/raw.c/#L346
|
d2a_code_trace_data_42146
|
int BUF_MEM_grow_clean(BUF_MEM *str, size_t len)
{
char *ret;
size_t n;
if (str->length >= len)
{
memset(&str->data[len],0,str->length-len);
str->length=len;
return(len);
}
if (str->max >= len)
{
memset(&str->data[str->length],0,len-str->length);
str->length=len;
return(len);
}
if (len > LIMIT_BEFORE_EXPANSION)
{
BUFerr(BUF_F_BUF_MEM_GROW_CLEAN,ERR_R_MALLOC_FAILURE);
return 0;
}
n=(len+3)/3*4;
if (str->data == NULL)
ret=OPENSSL_malloc(n);
else
ret=OPENSSL_realloc_clean(str->data,str->max,n);
if (ret == NULL)
{
BUFerr(BUF_F_BUF_MEM_GROW_CLEAN,ERR_R_MALLOC_FAILURE);
len=0;
}
else
{
str->data=ret;
str->max=n;
memset(&str->data[str->length],0,len-str->length);
str->length=len;
}
return(len);
}
ssl/d1_srvr.c:425: error: INTEGER_OVERFLOW_L2
([0, +oo] - 10):unsigned64 by call to `dtls1_send_server_certificate`.
Showing all 13 steps of the trace
ssl/d1_srvr.c:145:1: Parameter `s->init_buf->length`
143. dtls1_get_server_method)
144.
145. > int dtls1_accept(SSL *s)
146. {
147. BUF_MEM *buf;
ssl/d1_srvr.c:425:9: Call
423. {
424. dtls1_start_timer(s);
425. ret=dtls1_send_server_certificate(s);
^
426. if (ret <= 0) goto end;
427. #ifndef OPENSSL_NO_TLSEXT
ssl/d1_srvr.c:1569:1: Parameter `s->init_buf->length`
1567. }
1568.
1569. > int dtls1_send_server_certificate(SSL *s)
1570. {
1571. unsigned long l;
ssl/d1_srvr.c:1588:5: Call
1586. }
1587.
1588. l=dtls1_output_cert_chain(s,cpk);
^
1589. s->state=SSL3_ST_SW_CERT_B;
1590. s->init_num=(int)l;
ssl/d1_both.c:996:1: Parameter `s->init_buf->length`
994. }
995.
996. > unsigned long dtls1_output_cert_chain(SSL *s, CERT_PKEY *cpk)
997. {
998. unsigned char *p;
ssl/d1_both.c:1002:7: Call
1000. BUF_MEM *buf=s->init_buf;
1001.
1002. if (!ssl_add_cert_chain(s, cpk, &l))
^
1003. return 0;
1004.
ssl/ssl_cert.c:1053:1: Parameter `s->init_buf->length`
1051.
1052. /* Add certificate chain to internal SSL BUF_MEM strcuture */
1053. > int ssl_add_cert_chain(SSL *s, CERT_PKEY *cpk, unsigned long *l)
1054. {
1055. BUF_MEM *buf = s->init_buf;
ssl/ssl_cert.c:1087:7: Call
1085.
1086. /* TLSv1 sends a chain with nothing in it, instead of an alert */
1087. if (!BUF_MEM_grow_clean(buf,10))
^
1088. {
1089. SSLerr(SSL_F_SSL_ADD_CERT_CHAIN,ERR_R_BUF_LIB);
crypto/buffer/buffer.c:139:1: <LHS trace>
137. }
138.
139. > int BUF_MEM_grow_clean(BUF_MEM *str, size_t len)
140. {
141. char *ret;
crypto/buffer/buffer.c:139:1: Parameter `len`
137. }
138.
139. > int BUF_MEM_grow_clean(BUF_MEM *str, size_t len)
140. {
141. char *ret;
crypto/buffer/buffer.c:139:1: <RHS trace>
137. }
138.
139. > int BUF_MEM_grow_clean(BUF_MEM *str, size_t len)
140. {
141. char *ret;
crypto/buffer/buffer.c:139:1: Parameter `len`
137. }
138.
139. > int BUF_MEM_grow_clean(BUF_MEM *str, size_t len)
140. {
141. char *ret;
crypto/buffer/buffer.c:146:3: Binary operation: ([0, +oo] - 10):unsigned64 by call to `dtls1_send_server_certificate`
144. if (str->length >= len)
145. {
146. memset(&str->data[len],0,str->length-len);
^
147. str->length=len;
148. return(len);
|
https://github.com/openssl/openssl/blob/80ccc66d7eedb2d06050130c77c482ae1584199a/crypto/buffer/buffer.c/#L146
|
d2a_code_trace_data_42147
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
test/bntest.c:362: error: BUFFER_OVERRUN_L3
Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_exp_mont_consttime`.
Showing all 29 steps of the trace
test/bntest.c:362:10: Call
360. BN_bntest_rand(a, 1024, 0, 0);
361. BN_zero(p);
362. if (!TEST_true(BN_mod_exp_mont_consttime(d, a, p, m, ctx, NULL)))
^
363. goto err;
364. if (!TEST_BN_eq_one(d))
crypto/bn/bn_exp.c:594:1: Parameter `ctx->stack.depth`
592. * http://www.daemonology.net/hyperthreading-considered-harmful/)
593. */
594. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
595. const BIGNUM *m, BN_CTX *ctx,
596. BN_MONT_CTX *in_mont)
crypto/bn/bn_exp.c:634:5: Call
632. }
633.
634. BN_CTX_start(ctx);
^
635.
636. /*
crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_exp.c:645:14: Call
643. if ((mont = BN_MONT_CTX_new()) == NULL)
644. goto err;
645. if (!BN_MONT_CTX_set(mont, m, ctx))
^
646. goto err;
647. }
crypto/bn/bn_mont.c:247:1: Parameter `ctx->stack.depth`
245. }
246.
247. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
248. {
249. int ret = 0;
crypto/bn/bn_mont.c:255:5: Call
253. return 0;
254.
255. BN_CTX_start(ctx);
^
256. if ((Ri = BN_CTX_get(ctx)) == NULL)
257. goto err;
crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_mont.c:326:14: Call
324. tmod.top = buf[0] != 0 ? 1 : 0;
325. /* Ri = R^-1 mod N */
326. if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL)
^
327. goto err;
328. 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:148:16: Call
146. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0)
147. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) {
148. return BN_mod_inverse_no_branch(in, a, n, ctx);
^
149. }
150.
crypto/bn/bn_gcd.c:451:1: Parameter `ctx->stack.depth`
449. * not contain branches that may leak sensitive information.
450. */
451. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in,
452. const BIGNUM *a, const BIGNUM *n,
453. BN_CTX *ctx)
crypto/bn/bn_gcd.c:462:5: Call
460. bn_check_top(n);
461.
462. BN_CTX_start(ctx);
^
463. A = BN_CTX_get(ctx);
464. B = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_gcd.c:497:18: Call
495. bn_init(&local_B);
496. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME);
497. if (!BN_nnmod(B, &local_B, A, ctx))
^
498. goto err;
499. /* 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:193:5: Call
191. }
192.
193. BN_CTX_start(ctx);
^
194. tmp = BN_CTX_get(ctx);
195. snum = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_div.c:416:5: Call
414. if (no_branch)
415. bn_correct_top(res);
416. BN_CTX_end(ctx);
^
417. return (1);
418. err:
crypto/bn/bn_ctx.c:195:1: Parameter `*ctx->stack.indexes`
193. }
194.
195. > void BN_CTX_end(BN_CTX *ctx)
196. {
197. CTXDBG_ENTRY("BN_CTX_end", ctx);
crypto/bn/bn_ctx.c:201:27: Call
199. ctx->err_stack--;
200. else {
201. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
202. /* Does this stack frame have anything to release? */
203. if (fp < ctx->used)
crypto/bn/bn_ctx.c:271:1: <Offset trace>
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:271:1: Parameter `st->depth`
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:271:1: <Length trace>
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:271:1: Parameter `*st->indexes`
269. }
270.
271. > static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
crypto/bn/bn_ctx.c:273:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_exp_mont_consttime`
271. static unsigned int BN_STACK_pop(BN_STACK *st)
272. {
273. return st->indexes[--(st->depth)];
^
274. }
275.
|
https://github.com/openssl/openssl/blob/3f97052392cb10fca5309212bf720685262ad4a6/crypto/bn/bn_ctx.c/#L273
|
d2a_code_trace_data_42148
|
static inline void packet_forward(PACKET *pkt, size_t len)
{
pkt->curr += len;
pkt->remaining -= len;
}
ssl/s3_clnt.c:1093: error: INTEGER_OVERFLOW_L2
([0, +oo] - 2):unsigned64 by call to `PACKET_get_bytes`.
Showing all 18 steps of the trace
ssl/s3_clnt.c:974:10: Call
972. }
973.
974. if (!PACKET_buf_init(&pkt, s->init_msg, n)) {
^
975. al = SSL_AD_INTERNAL_ERROR;
976. SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, ERR_R_INTERNAL_ERROR);
ssl/packet_locl.h:110:8: Parameter `pkt->remaining`
108. * is being used.
109. */
110. __owur static inline int PACKET_buf_init(PACKET *pkt, unsigned char *buf,
^
111. size_t len)
112. {
ssl/s3_clnt.c:983:14: Call
981. unsigned int sversion;
982.
983. if (!PACKET_get_net_2(&pkt, &sversion)) {
^
984. al = SSL_AD_DECODE_ERROR;
985. SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_LENGTH_MISMATCH);
ssl/packet_locl.h:188:8: Parameter `pkt->remaining`
186. /* Equivalent of n2s */
187. /* Get 2 bytes in network order from |pkt| and store the value in |*data| */
188. __owur static inline int PACKET_get_net_2(PACKET *pkt, unsigned int *data)
^
189. {
190. if (!PACKET_peek_net_2(pkt, data))
ssl/packet_locl.h:190:10: Call
188. __owur static inline int PACKET_get_net_2(PACKET *pkt, unsigned int *data)
189. {
190. if (!PACKET_peek_net_2(pkt, data))
^
191. return 0;
192.
ssl/packet_locl.h:174:8: Parameter `pkt->remaining`
172. * |*data|
173. */
174. __owur static inline int PACKET_peek_net_2(const PACKET *pkt,
^
175. unsigned int *data)
176. {
ssl/s3_clnt.c:1071:10: Call
1069. /* load the server hello data */
1070. /* load the server random */
1071. if (!PACKET_copy_bytes(&pkt, s->s3->server_random, SSL3_RANDOM_SIZE)) {
^
1072. al = SSL_AD_DECODE_ERROR;
1073. SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_LENGTH_MISMATCH);
ssl/packet_locl.h:359:8: Parameter `pkt->remaining`
357. * The caller is responsible for ensuring that |data| can hold |len| bytes.
358. */
359. __owur static inline int PACKET_copy_bytes(PACKET *pkt, unsigned char *data,
^
360. size_t len)
361. {
ssl/packet_locl.h:362:10: Call
360. size_t len)
361. {
362. if (!PACKET_peek_copy_bytes(pkt, data, len))
^
363. return 0;
364.
ssl/packet_locl.h:344:8: Parameter `len`
342.
343. /* Peek ahead at |len| bytes from |pkt| and copy them to |data| */
344. __owur static inline int PACKET_peek_copy_bytes(const PACKET *pkt,
^
345. unsigned char *data, size_t len)
346. {
ssl/s3_clnt.c:1093:10: Call
1091. }
1092.
1093. if (!PACKET_get_bytes(&pkt, &cipherchars, TLS_CIPHER_LEN)) {
^
1094. SSLerr(SSL_F_SSL3_GET_SERVER_HELLO, SSL_R_LENGTH_MISMATCH);
1095. al = SSL_AD_DECODE_ERROR;
ssl/packet_locl.h:332:8: Parameter `len`
330. * freed
331. */
332. __owur static inline int PACKET_get_bytes(PACKET *pkt, unsigned char **data,
^
333. size_t len)
334. {
ssl/packet_locl.h:338:5: Call
336. return 0;
337.
338. packet_forward(pkt, len);
^
339.
340. return 1;
ssl/packet_locl.h:80:1: <LHS trace>
78.
79. /* Internal unchecked shorthand; don't use outside this file. */
80. > static inline void packet_forward(PACKET *pkt, size_t len)
81. {
82. pkt->curr += len;
ssl/packet_locl.h:80:1: Parameter `pkt->remaining`
78.
79. /* Internal unchecked shorthand; don't use outside this file. */
80. > static inline void packet_forward(PACKET *pkt, size_t len)
81. {
82. pkt->curr += len;
ssl/packet_locl.h:80:1: <RHS trace>
78.
79. /* Internal unchecked shorthand; don't use outside this file. */
80. > static inline void packet_forward(PACKET *pkt, size_t len)
81. {
82. pkt->curr += len;
ssl/packet_locl.h:80:1: Parameter `len`
78.
79. /* Internal unchecked shorthand; don't use outside this file. */
80. > static inline void packet_forward(PACKET *pkt, size_t len)
81. {
82. pkt->curr += len;
ssl/packet_locl.h:83:5: Binary operation: ([0, +oo] - 2):unsigned64 by call to `PACKET_get_bytes`
81. {
82. pkt->curr += len;
83. pkt->remaining -= len;
^
84. }
85.
|
https://github.com/openssl/openssl/blob/f8e0a5573820bd7318782d4954c6643ff7e58102/ssl/packet_locl.h/#L83
|
d2a_code_trace_data_42149
|
int is_partially_overlapping(const void *ptr1, const void *ptr2, int len)
{
PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2;
int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) |
(diff > (0 - (PTRDIFF_T)len)));
return overlapped;
}
crypto/rand/drbg_ctr.c:340: error: INTEGER_OVERFLOW_L2
(0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate`.
Showing all 10 steps of the trace
crypto/rand/drbg_ctr.c:309:8: Parameter `drbg->data.ctr.cipher->block_size`
307. }
308.
309. __owur static int drbg_ctr_generate(RAND_DRBG *drbg,
^
310. unsigned char *out, size_t outlen,
311. const unsigned char *adin, size_t adinlen)
crypto/rand/drbg_ctr.c:340:14: Call
338. break;
339. }
340. if (!EVP_CipherUpdate(ctr->ctx, out, &outl, ctr->V, AES_BLOCK_SIZE)
^
341. || outl != AES_BLOCK_SIZE)
342. return 0;
crypto/evp/evp_enc.c:209:1: Parameter `ctx->cipher->block_size`
207. }
208.
209. > int EVP_CipherUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
210. const unsigned char *in, int inl)
211. {
crypto/evp/evp_enc.c:215:16: Call
213. return EVP_EncryptUpdate(ctx, out, outl, in, inl);
214. else
215. return EVP_DecryptUpdate(ctx, out, outl, in, inl);
^
216. }
217.
crypto/evp/evp_enc.c:423:1: Parameter `ctx->cipher->block_size`
421. }
422.
423. > int EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl,
424. const unsigned char *in, int inl)
425. {
crypto/evp/evp_enc.c:429:5: Assignment
427. unsigned int b;
428.
429. b = ctx->cipher->block_size;
^
430.
431. if (EVP_CIPHER_CTX_test_flags(ctx, EVP_CIPH_FLAG_LENGTH_BITS))
crypto/evp/evp_enc.c:462:16: Call
460. /* see comment about PTRDIFF_T comparison above */
461. if (((PTRDIFF_T)out == (PTRDIFF_T)in)
462. || is_partially_overlapping(out, in, b)) {
^
463. EVPerr(EVP_F_EVP_DECRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING);
464. return 0;
crypto/evp/evp_enc.c:283:1: <RHS trace>
281. #endif
282.
283. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len)
284. {
285. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2;
crypto/evp/evp_enc.c:283:1: Parameter `len`
281. #endif
282.
283. > int is_partially_overlapping(const void *ptr1, const void *ptr2, int len)
284. {
285. PTRDIFF_T diff = (PTRDIFF_T)ptr1-(PTRDIFF_T)ptr2;
crypto/evp/evp_enc.c:292:50: Binary operation: (0 - [-oo, 32]):unsigned64 by call to `EVP_CipherUpdate`
290. */
291. int overlapped = (len > 0) & (diff != 0) & ((diff < (PTRDIFF_T)len) |
292. (diff > (0 - (PTRDIFF_T)len)));
^
293.
294. return overlapped;
|
https://github.com/openssl/openssl/blob/e613b1eff40f21cd99240f9884cd3396b0ab50f1/crypto/evp/evp_enc.c/#L292
|
d2a_code_trace_data_42150
|
static unsigned int BN_STACK_pop(BN_STACK *st)
{
return st->indexes[--(st->depth)];
}
crypto/ec/ecdsa_ossl.c:415: error: INTEGER_OVERFLOW_L2
([0, +oo] - 1):unsigned32 by call to `BN_mod_inverse`.
Showing all 22 steps of the trace
crypto/ec/ecdsa_ossl.c:389:5: Call
387. return -1;
388. }
389. BN_CTX_start(ctx);
^
390. u1 = BN_CTX_get(ctx);
391. u2 = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/ec/ecdsa_ossl.c:415:14: Call
413. /* Check if optimized inverse is implemented */
414. if (EC_GROUP_do_inverse_ord(group, u2, sig->s, ctx) == 0) {
415. if (!BN_mod_inverse(u2, sig->s, order, ctx)) {
^
416. ECerr(EC_F_OSSL_ECDSA_VERIFY_SIG, ERR_R_BN_LIB);
417. goto err;
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:148:16: Call
146. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0)
147. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) {
148. return BN_mod_inverse_no_branch(in, a, n, ctx);
^
149. }
150.
crypto/bn/bn_gcd.c:451:1: Parameter `ctx->stack.depth`
449. * not contain branches that may leak sensitive information.
450. */
451. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in,
452. const BIGNUM *a, const BIGNUM *n,
453. BN_CTX *ctx)
crypto/bn/bn_gcd.c:462:5: Call
460. bn_check_top(n);
461.
462. BN_CTX_start(ctx);
^
463. A = BN_CTX_get(ctx);
464. B = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_gcd.c:497:18: Call
495. bn_init(&local_B);
496. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME);
497. if (!BN_nnmod(B, &local_B, A, ctx))
^
498. goto err;
499. /* 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:137:1: Parameter `ctx->stack.depth`
135. * If 'dv' or 'rm' is NULL, the respective value is not returned.
136. */
137. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor,
138. BN_CTX *ctx)
139. {
crypto/bn/bn_div.c:190:5: Call
188. }
189.
190. BN_CTX_start(ctx);
^
191. res = (dv == NULL) ? BN_CTX_get(ctx) : dv;
192. tmp = BN_CTX_get(ctx);
crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth`
179. }
180.
181. > void BN_CTX_start(BN_CTX *ctx)
182. {
183. CTXDBG_ENTRY("BN_CTX_start", ctx);
crypto/bn/bn_div.c:410:5: Call
408. if (no_branch)
409. bn_correct_top(res);
410. BN_CTX_end(ctx);
^
411. return 1;
412. err:
crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.depth`
193. }
194.
195. > void BN_CTX_end(BN_CTX *ctx)
196. {
197. CTXDBG_ENTRY("BN_CTX_end", ctx);
crypto/bn/bn_ctx.c:201:27: Call
199. ctx->err_stack--;
200. else {
201. unsigned int fp = BN_STACK_pop(&ctx->stack);
^
202. /* Does this stack frame have anything to release? */
203. if (fp < ctx->used)
crypto/bn/bn_ctx.c:271:1: <LHS 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:273:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_inverse`
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/10bc3409459a525654d6b986b3cd49d22dd95460/crypto/bn/bn_ctx.c/#L273
|
d2a_code_trace_data_42151
|
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
{
BN_ULONG *a = NULL;
if (words > (INT_MAX / (4 * BN_BITS2))) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG);
return NULL;
}
if (BN_get_flags(b, BN_FLG_STATIC_DATA)) {
BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA);
return NULL;
}
if (BN_get_flags(b, BN_FLG_SECURE))
a = OPENSSL_secure_zalloc(words * sizeof(*a));
else
a = OPENSSL_zalloc(words * sizeof(*a));
if (a == NULL) {
BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
return NULL;
}
assert(b->top <= words);
if (b->top > 0)
memcpy(a, b->d, sizeof(*a) * b->top);
return a;
}
crypto/ec/ecp_smpl.c:1393: error: BUFFER_OVERRUN_L3
Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_priv_rand_range`.
Showing all 26 steps of the trace
crypto/ec/ecp_smpl.c:1393:14: Call
1391.
1392. do {
1393. if (!BN_priv_rand_range(e, group->field))
^
1394. goto err;
1395. } while (BN_is_zero(e));
crypto/bn/bn_rand.c:184:12: Call
182. int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range)
183. {
184. return bnrand_range(PRIVATE, r, range);
^
185. }
186.
crypto/bn/bn_rand.c:113:1: Parameter `r->top`
111.
112. /* random number r: 0 <= r < range */
113. > static int bnrand_range(BNRAND_FLAG flag, BIGNUM *r, const BIGNUM *range)
114. {
115. int n;
crypto/ec/ecp_smpl.c:1393:14: Call
1391.
1392. do {
1393. if (!BN_priv_rand_range(e, group->field))
^
1394. goto err;
1395. } while (BN_is_zero(e));
crypto/bn/bn_rand.c:182:1: Parameter `r->top`
180. }
181.
182. > int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range)
183. {
184. return bnrand_range(PRIVATE, r, range);
crypto/bn/bn_rand.c:184:12: Call
182. int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range)
183. {
184. return bnrand_range(PRIVATE, r, range);
^
185. }
186.
crypto/bn/bn_rand.c:113:1: Parameter `r->top`
111.
112. /* random number r: 0 <= r < range */
113. > static int bnrand_range(BNRAND_FLAG flag, BIGNUM *r, const BIGNUM *range)
114. {
115. int n;
crypto/bn/bn_rand.c:128:9: Call
126.
127. if (n == 1)
128. BN_zero(r);
^
129. else if (!BN_is_bit_set(range, n - 2) && !BN_is_bit_set(range, n - 3)) {
130. /*
crypto/bn/bn_lib.c:359:1: Parameter `a->top`
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->top`
658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx);
659.
660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits)
661. {
662. if (bits > (INT_MAX - BN_BITS2 + 1))
crypto/bn/bn_lcl.h:668:12: Call
666. return a;
667.
668. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2);
^
669. }
670.
crypto/bn/bn_lib.c:245:1: Parameter `b->top`
243. */
244.
245. > BIGNUM *bn_expand2(BIGNUM *b, int words)
246. {
247. if (words > b->dmax) {
crypto/bn/bn_lib.c:248:23: Call
246. {
247. if (words > b->dmax) {
248. BN_ULONG *a = bn_expand_internal(b, words);
^
249. if (!a)
250. return NULL;
crypto/bn/bn_lib.c:209:1: <Offset trace>
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: Parameter `b->top`
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: <Length trace>
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:209:1: Parameter `words`
207. /* This is used by bn_expand2() */
208. /* The caller MUST check that words > b->dmax before calling this */
209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words)
210. {
211. BN_ULONG *a = NULL;
crypto/bn/bn_lib.c:224:13: Call
222. a = OPENSSL_secure_zalloc(words * sizeof(*a));
223. else
224. a = OPENSSL_zalloc(words * sizeof(*a));
^
225. if (a == NULL) {
226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
crypto/mem.c:228:1: Parameter `num`
226. }
227.
228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
crypto/mem.c:230:17: Call
228. void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
^
231.
232. FAILTEST();
crypto/mem.c:201:9: Assignment
199.
200. if (num == 0)
201. return NULL;
^
202.
203. FAILTEST();
crypto/mem.c:230:5: Assignment
228. void *CRYPTO_zalloc(size_t num, const char *file, int line)
229. {
230. void *ret = CRYPTO_malloc(num, file, line);
^
231.
232. FAILTEST();
crypto/mem.c:235:5: Assignment
233. if (ret != NULL)
234. memset(ret, 0, num);
235. return ret;
^
236. }
237.
crypto/bn/bn_lib.c:224:9: Assignment
222. a = OPENSSL_secure_zalloc(words * sizeof(*a));
223. else
224. a = OPENSSL_zalloc(words * sizeof(*a));
^
225. if (a == NULL) {
226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE);
crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_priv_rand_range`
230. assert(b->top <= words);
231. if (b->top > 0)
232. memcpy(a, b->d, sizeof(*a) * b->top);
^
233.
234. return a;
|
https://github.com/openssl/openssl/blob/8f58ede09572dcc6a7e6c01280dd348240199568/crypto/bn/bn_lib.c/#L232
|
d2a_code_trace_data_42152
|
static int epzs_motion_search4(MpegEncContext * s,
int *mx_ptr, int *my_ptr, int P[10][2],
int src_index, int ref_index, int16_t (*last_mv)[2],
int ref_mv_scale)
{
MotionEstContext * const c= &s->me;
int best[2]={0, 0};
int d, dmin;
int map_generation;
const int penalty_factor= c->penalty_factor;
const int size=1;
const int h=8;
const int ref_mv_stride= s->mb_stride;
const int ref_mv_xy= s->mb_x + s->mb_y *ref_mv_stride;
me_cmp_func cmpf, chroma_cmpf;
LOAD_COMMON
int flags= c->flags;
LOAD_COMMON2
cmpf= s->dsp.me_cmp[size];
chroma_cmpf= s->dsp.me_cmp[size+1];
map_generation= update_map_generation(c);
dmin = 1000000;
if (s->first_slice_line) {
CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift)
}else{
CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift)
CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift)
CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift)
CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift)
CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
}
if(dmin>64*4){
CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16)
if(s->mb_y+1<s->end_mb_y)
CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
(last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
}
dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags);
*mx_ptr= best[0];
*my_ptr= best[1];
return dmin;
}
libavcodec/motion_est_template.c:1177: error: Uninitialized Value
The value read from ymax was never initialized.
libavcodec/motion_est_template.c:1177:13:
1175. (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16)
1176. if(s->mb_y+1<s->end_mb_y) //FIXME replace at least with last_slice_line
1177. CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16,
^
1178. (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16)
1179. }
|
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1177
|
d2a_code_trace_data_42153
|
void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len)
{
#ifdef POLY1305_ASM
poly1305_blocks_f poly1305_blocks_p = ctx->func.blocks;
#endif
size_t rem, num;
if ((num = ctx->num)) {
rem = POLY1305_BLOCK_SIZE - num;
if (len >= rem) {
memcpy(ctx->data + num, inp, rem);
poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 1);
inp += rem;
len -= rem;
} else {
memcpy(ctx->data + num, inp, len);
ctx->num = num + len;
return;
}
}
rem = len % POLY1305_BLOCK_SIZE;
len -= rem;
if (len >= POLY1305_BLOCK_SIZE) {
poly1305_blocks(ctx->opaque, inp, len, 1);
inp += len;
}
if (rem)
memcpy(ctx->data, inp, rem);
ctx->num = rem;
}
crypto/evp/e_chacha20_poly1305.c:303: error: INTEGER_OVERFLOW_L2
([1, 31] - [-26-max(1, `ctx->cipher_data->num`), 15]):unsigned64 by call to `Poly1305_Update`.
Showing all 7 steps of the trace
crypto/evp/e_chacha20_poly1305.c:233:1: Parameter `ctx->cipher_data->num`
231. }
232.
233. > static int chacha20_poly1305_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
234. const unsigned char *in, size_t len)
235. {
crypto/evp/e_chacha20_poly1305.c:303:13: Call
301.
302. if ((rem = (size_t)actx->len.text % POLY1305_BLOCK_SIZE))
303. Poly1305_Update(POLY1305_ctx(actx), zero,
^
304. POLY1305_BLOCK_SIZE - rem);
305.
crypto/poly1305/poly1305.c:466:1: <LHS trace>
464. #endif
465.
466. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len)
467. {
468. #ifdef POLY1305_ASM
crypto/poly1305/poly1305.c:466:1: Parameter `len`
464. #endif
465.
466. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len)
467. {
468. #ifdef POLY1305_ASM
crypto/poly1305/poly1305.c:466:1: <RHS trace>
464. #endif
465.
466. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len)
467. {
468. #ifdef POLY1305_ASM
crypto/poly1305/poly1305.c:466:1: Parameter `len`
464. #endif
465.
466. > void Poly1305_Update(POLY1305 *ctx, const unsigned char *inp, size_t len)
467. {
468. #ifdef POLY1305_ASM
crypto/poly1305/poly1305.c:485:13: Binary operation: ([1, 31] - [-26-max(1, ctx->cipher_data->num), 15]):unsigned64 by call to `Poly1305_Update`
483. poly1305_blocks(ctx->opaque, ctx->data, POLY1305_BLOCK_SIZE, 1);
484. inp += rem;
485. len -= rem;
^
486. } else {
487. /* Still not enough data to process a block. */
|
https://github.com/openssl/openssl/blob/740b2b9a6cf31b02916a4d18f868e8a95934c083/crypto/poly1305/poly1305.c/#L485
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.