id
stringlengths
25
25
content
stringlengths
649
72.1k
max_stars_repo_path
stringlengths
91
133
d2a_code_trace_data_43054
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 != ',') { PROPerr(PROP_F_PARSE_OCT, PROP_R_NOT_AN_OCTAL_DIGIT); return 0; } *t = skip_space(s); res->type = PROPERTY_TYPE_NUMBER; res->v.int_val = v; return 1; } test/property_test.c:339: error: BUFFER_OVERRUN_L3 Offset: [2, +oo] (⇐ [1, +oo] + 1) Size: [1, 50] by call to `ossl_method_store_add`. Showing all 23 steps of the trace test/property_test.c:322:1: Array declaration 320. } 321. 322. > static int test_query_cache_stochastic(void) 323. { 324. const int max = 10000, tail = 10; test/property_test.c:339:14: Call 337. v[i] = 2 * i; 338. BIO_snprintf(buf, sizeof(buf), "n=%d\n", i); 339. if (!TEST_true(ossl_method_store_add(store, i, buf, "abc", NULL)) ^ 340. || !TEST_true(ossl_method_store_cache_set(store, i, buf, v + i)) 341. || !TEST_true(ossl_method_store_cache_set(store, i, "n=1234", crypto/property/property.c:176:1: Parameter `*properties` 174. } 175. 176. > int ossl_method_store_add(OSSL_METHOD_STORE *store, 177. int nid, const char *properties, 178. void *method, void (*method_destruct)(void *)) crypto/property/property.c:205:28: Call 203. ossl_method_cache_flush(store, nid); 204. if ((impl->properties = ossl_prop_defn_get(store->ctx, properties)) == NULL) { 205. impl->properties = ossl_parse_property(store->ctx, properties); ^ 206. if (impl->properties == NULL) 207. goto err; crypto/property/property_parse.c:317:1: Parameter `*defn` 315. } 316. 317. > OSSL_PROPERTY_LIST *ossl_parse_property(OPENSSL_CTX *ctx, const char *defn) 318. { 319. PROPERTY_DEFINITION *prop = NULL; crypto/property/property_parse.c:322:5: Assignment 320. OSSL_PROPERTY_LIST *res = NULL; 321. STACK_OF(PROPERTY_DEFINITION) *sk; 322. const char *s = defn; ^ 323. int done; 324. crypto/property/property_parse.c:328:9: Call 326. return NULL; 327. 328. s = skip_space(s); ^ 329. done = *s == '\0'; 330. while (!done) { crypto/property/property_parse.c:50:1: Parameter `*s` 48. DEFINE_STACK_OF(PROPERTY_DEFINITION) 49. 50. > static const char *skip_space(const char *s) 51. { 52. while (ossl_isspace(*s)) crypto/property/property_parse.c:54:5: Assignment 52. while (ossl_isspace(*s)) 53. s++; 54. return s; ^ 55. } 56. crypto/property/property_parse.c:328:5: Assignment 326. return NULL; 327. 328. s = skip_space(s); ^ 329. done = *s == '\0'; 330. while (!done) { crypto/property/property_parse.c:335:14: Call 333. goto err; 334. memset(&prop->v, 0, sizeof(prop->v)); 335. if (!parse_name(ctx, &s, 1, &prop->name_idx)) ^ 336. goto err; 337. prop->oper = PROPERTY_OPER_EQ; crypto/property/property_parse.c:81:1: Parameter `**t` 79. } 80. 81. > static int parse_name(OPENSSL_CTX *ctx, const char *t[], int create, 82. OSSL_PROPERTY_IDX *idx) 83. { crypto/property/property_parse.c:342:13: Call 340. goto err; 341. } 342. if (match_ch(&s, '=')) { ^ 343. if (!parse_value(ctx, &s, prop, 1)) { 344. PROPerr(PROP_F_OSSL_PARSE_PROPERTY, PROP_R_NO_VALUE); crypto/property/property_parse.c:57:1: Parameter `**t` 55. } 56. 57. > static int match_ch(const char *t[], char m) 58. { 59. const char *s = *t; crypto/property/property_parse.c:343:18: Call 341. } 342. if (match_ch(&s, '=')) { 343. if (!parse_value(ctx, &s, prop, 1)) { ^ 344. PROPerr(PROP_F_OSSL_PARSE_PROPERTY, PROP_R_NO_VALUE); 345. goto err; crypto/property/property_parse.c:245:1: Parameter `**t` 243. } 244. 245. > static int parse_value(OPENSSL_CTX *ctx, const char *t[], 246. PROPERTY_DEFINITION *res, int create) 247. { crypto/property/property_parse.c:248:5: Assignment 246. PROPERTY_DEFINITION *res, int create) 247. { 248. const char *s = *t; ^ 249. int r = 0; 250. crypto/property/property_parse.c:265:9: Assignment 263. r = parse_hex(&s, res); 264. } else if (*s == '0' && ossl_isdigit(s[1])) { 265. s++; ^ 266. r = parse_oct(&s, res); 267. } else if (ossl_isdigit(*s)) { crypto/property/property_parse.c:266:13: Call 264. } else if (*s == '0' && ossl_isdigit(s[1])) { 265. s++; 266. r = parse_oct(&s, res); ^ 267. } else if (ossl_isdigit(*s)) { 268. return parse_number(t, res); crypto/property/property_parse.c:164:1: <Length trace> 162. } 163. 164. > static int parse_oct(const char *t[], PROPERTY_DEFINITION *res) 165. { 166. const char *s = *t; crypto/property/property_parse.c:164:1: Parameter `**t` 162. } 163. 164. > static int parse_oct(const char *t[], PROPERTY_DEFINITION *res) 165. { 166. const char *s = *t; crypto/property/property_parse.c:166:5: Assignment 164. static int parse_oct(const char *t[], PROPERTY_DEFINITION *res) 165. { 166. const char *s = *t; ^ 167. int64_t v = 0; 168. crypto/property/property_parse.c:173:14: Array access: Offset: [2, +oo] (⇐ [1, +oo] + 1) Size: [1, 50] by call to `ossl_method_store_add` 171. do { 172. v = (v << 3) + (*s - '0'); 173. } while (ossl_isdigit(*++s) && *s != '9' && *s != '8'); ^ 174. if (!ossl_isspace(*s) && *s != '\0' && *s != ',') { 175. PROPerr(PROP_F_PARSE_OCT, PROP_R_NOT_AN_OCTAL_DIGIT);
https://github.com/openssl/openssl/blob/260a16f33682a819414fcba6161708a5e6bdff50/crypto/property/property_parse.c/#L173
d2a_code_trace_data_43055
static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func, LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg) { int i; LHASH_NODE *a,*n; if (lh == NULL) return; for (i=lh->num_nodes-1; i>=0; i--) { a=lh->b[i]; while (a != NULL) { n=a->next; if(use_arg) func_arg(a->data,arg); else func(a->data); a=n; } } } apps/s_server.c:2361: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `SSL_free`. Showing all 16 steps of the trace apps/s_server.c:1989:7: Call 1987. 1988. if (con == NULL) { 1989. con=SSL_new(ctx); ^ 1990. #ifndef OPENSSL_NO_TLSEXT 1991. if (s_tlsextdebug) ssl/ssl_lib.c:275:1: Parameter `ctx->sessions->num_nodes` 273. } 274. 275. > SSL *SSL_new(SSL_CTX *ctx) 276. { 277. SSL *s; apps/s_server.c:2015:2: Call 2013. strlen((char *)context)); 2014. } 2015. SSL_clear(con); ^ 2016. #if 0 2017. #ifdef TLSEXT_TYPE_opaque_prf_input ssl/ssl_lib.c:185:1: Parameter `s->ctx->sessions->num_nodes` 183. }; 184. 185. > int SSL_clear(SSL *s) 186. { 187. apps/s_server.c:2361:3: Call 2359. SSL_shutdown(con); 2360. #endif 2361. SSL_free(con); ^ 2362. } 2363. BIO_printf(bio_s_out,"CONNECTION CLOSED\n"); ssl/ssl_lib.c:505:1: Parameter `s->initial_ctx->sessions->num_nodes` 503. } 504. 505. > void SSL_free(SSL *s) 506. { 507. int i; ssl/ssl_lib.c:568:22: Call 566. if (s->tlsext_hostname) 567. OPENSSL_free(s->tlsext_hostname); 568. if (s->initial_ctx) SSL_CTX_free(s->initial_ctx); ^ 569. #ifndef OPENSSL_NO_EC 570. if (s->tlsext_ecpointformatlist) OPENSSL_free(s->tlsext_ecpointformatlist); ssl/ssl_lib.c:1899:1: Parameter `a->sessions->num_nodes` 1897. #endif 1898. 1899. > void SSL_CTX_free(SSL_CTX *a) 1900. { 1901. int i; ssl/ssl_lib.c:1931:3: Call 1929. */ 1930. if (a->sessions != NULL) 1931. SSL_CTX_flush_sessions(a,0); ^ 1932. 1933. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:985:1: Parameter `s->sessions->num_nodes` 983. static IMPLEMENT_LHASH_DOALL_ARG_FN(timeout, SSL_SESSION, TIMEOUT_PARAM) 984. 985. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 986. { 987. unsigned long i; ssl/ssl_sess.c:997:2: Call 995. i=CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load; 996. CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load=0; 997. lh_SSL_SESSION_doall_arg(tp.cache, LHASH_DOALL_ARG_FN(timeout), ^ 998. TIMEOUT_PARAM, &tp); 999. CHECKED_LHASH_OF(SSL_SESSION, tp.cache)->down_load=i; crypto/lhash/lhash.c:305:1: Parameter `lh->num_nodes` 303. } 304. 305. > void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg) 306. { 307. doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg); crypto/lhash/lhash.c:307:2: Call 305. void lh_doall_arg(_LHASH *lh, LHASH_DOALL_ARG_FN_TYPE func, void *arg) 306. { 307. doall_util_fn(lh, 1, (LHASH_DOALL_FN_TYPE)0, func, arg); ^ 308. } 309. crypto/lhash/lhash.c:270:1: <LHS trace> 268. } 269. 270. > static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func, 271. LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg) 272. { crypto/lhash/lhash.c:270:1: Parameter `lh->num_nodes` 268. } 269. 270. > static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func, 271. LHASH_DOALL_ARG_FN_TYPE func_arg, void *arg) 272. { crypto/lhash/lhash.c:281:7: Binary operation: ([0, +oo] - 1):unsigned32 by call to `SSL_free` 279. /* reverse the order so we search from 'top to bottom' 280. * We were having memory leaks otherwise */ 281. for (i=lh->num_nodes-1; i>=0; i--) ^ 282. { 283. a=lh->b[i];
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/lhash/lhash.c/#L281
d2a_code_trace_data_43056
ssize_t ngx_parse_size(ngx_str_t *line) { u_char unit; size_t len; ssize_t size; ngx_int_t scale; len = line->len; unit = line->data[len - 1]; switch (unit) { case 'K': case 'k': len--; scale = 1024; break; case 'M': case 'm': len--; scale = 1024 * 1024; break; default: scale = 1; } size = ngx_atosz(line->data, len); if (size == NGX_ERROR) { return NGX_ERROR; } size *= scale; return size; } src/core/ngx_conf_file.c:1325: error: Integer Overflow L2 ([0, +oo] - 1):unsigned64 by call to `ngx_parse_size`. src/core/ngx_conf_file.c:1325:18: Call 1323. } 1324. 1325. bufs->size = ngx_parse_size(&value[2]); ^ 1326. if (bufs->size == (size_t) NGX_ERROR || bufs->size == 0) { 1327. return "invalid value"; src/core/ngx_parse.c:11:1: <LHS trace> 9. 10. 11. ssize_t ^ 12. ngx_parse_size(ngx_str_t *line) 13. { src/core/ngx_parse.c:11:1: Parameter `line->len` 9. 10. 11. ssize_t ^ 12. ngx_parse_size(ngx_str_t *line) 13. { src/core/ngx_parse.c:19:5: Assignment 17. ngx_int_t scale; 18. 19. len = line->len; ^ 20. unit = line->data[len - 1]; 21. src/core/ngx_parse.c:20:12: Binary operation: ([0, +oo] - 1):unsigned64 by call to `ngx_parse_size` 18. 19. len = line->len; 20. unit = line->data[len - 1]; ^ 21. 22. switch (unit) {
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_parse.c/#L20
d2a_code_trace_data_43057
static RSA *tmp_rsa_cb(SSL *s, int is_export, int keylength) { BIGNUM *bn = NULL; static RSA *rsa_tmp = NULL; if (!rsa_tmp && ((bn = BN_new()) == NULL)) BIO_printf(bio_err, "Allocation error in generating RSA key\n"); if (!rsa_tmp && bn) { if (!s_quiet) { BIO_printf(bio_err, "Generating temp (%d bit) RSA key...", keylength); (void)BIO_flush(bio_err); } if (!BN_set_word(bn, RSA_F4) || ((rsa_tmp = RSA_new()) == NULL) || !RSA_generate_key_ex(rsa_tmp, keylength, bn, NULL)) { RSA_free(rsa_tmp); rsa_tmp = NULL; } if (!s_quiet) { BIO_printf(bio_err, "\n"); (void)BIO_flush(bio_err); } BN_free(bn); } return (rsa_tmp); } apps/s_server.c:3170: error: NULL_DEREFERENCE pointer `rsa_tmp` last assigned on line 3168 could be null and is dereferenced by call to `RSA_free()` at line 3170, column 13. Showing all 26 steps of the trace apps/s_server.c:3155:1: start of procedure tmp_rsa_cb() 3153. 3154. #ifndef OPENSSL_NO_RSA 3155. > static RSA *tmp_rsa_cb(SSL *s, int is_export, int keylength) 3156. { 3157. BIGNUM *bn = NULL; apps/s_server.c:3157:5: 3155. static RSA *tmp_rsa_cb(SSL *s, int is_export, int keylength) 3156. { 3157. > BIGNUM *bn = NULL; 3158. static RSA *rsa_tmp = NULL; 3159. apps/s_server.c:3158:5: 3156. { 3157. BIGNUM *bn = NULL; 3158. > static RSA *rsa_tmp = NULL; 3159. 3160. if (!rsa_tmp && ((bn = BN_new()) == NULL)) apps/s_server.c:3160:10: Taking true branch 3158. static RSA *rsa_tmp = NULL; 3159. 3160. if (!rsa_tmp && ((bn = BN_new()) == NULL)) ^ 3161. BIO_printf(bio_err, "Allocation error in generating RSA key\n"); 3162. if (!rsa_tmp && bn) { apps/s_server.c:3160:22: Taking false branch 3158. static RSA *rsa_tmp = NULL; 3159. 3160. if (!rsa_tmp && ((bn = BN_new()) == NULL)) ^ 3161. BIO_printf(bio_err, "Allocation error in generating RSA key\n"); 3162. if (!rsa_tmp && bn) { apps/s_server.c:3162:10: Taking true branch 3160. if (!rsa_tmp && ((bn = BN_new()) == NULL)) 3161. BIO_printf(bio_err, "Allocation error in generating RSA key\n"); 3162. if (!rsa_tmp && bn) { ^ 3163. if (!s_quiet) { 3164. BIO_printf(bio_err, "Generating temp (%d bit) RSA key...", apps/s_server.c:3162:21: Taking true branch 3160. if (!rsa_tmp && ((bn = BN_new()) == NULL)) 3161. BIO_printf(bio_err, "Allocation error in generating RSA key\n"); 3162. if (!rsa_tmp && bn) { ^ 3163. if (!s_quiet) { 3164. BIO_printf(bio_err, "Generating temp (%d bit) RSA key...", apps/s_server.c:3163:14: Taking false branch 3161. BIO_printf(bio_err, "Allocation error in generating RSA key\n"); 3162. if (!rsa_tmp && bn) { 3163. if (!s_quiet) { ^ 3164. BIO_printf(bio_err, "Generating temp (%d bit) RSA key...", 3165. keylength); apps/s_server.c:3168:14: 3166. (void)BIO_flush(bio_err); 3167. } 3168. > if (!BN_set_word(bn, RSA_F4) || ((rsa_tmp = RSA_new()) == NULL) || 3169. !RSA_generate_key_ex(rsa_tmp, keylength, bn, NULL)) { 3170. RSA_free(rsa_tmp); crypto/bn/bn_lib.c:527:1: start of procedure BN_set_word() 525. } 526. 527. > int BN_set_word(BIGNUM *a, BN_ULONG w) 528. { 529. bn_check_top(a); crypto/bn/bn_lib.c:530:9: Condition is true 528. { 529. bn_check_top(a); 530. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 531. return (0); 532. a->neg = 0; crypto/bn/bn_lib.c:530:9: Taking false branch 528. { 529. bn_check_top(a); 530. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 531. return (0); 532. a->neg = 0; crypto/bn/bn_lib.c:532:5: 530. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 531. return (0); 532. > a->neg = 0; 533. a->d[0] = w; 534. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:533:5: 531. return (0); 532. a->neg = 0; 533. > a->d[0] = w; 534. a->top = (w ? 1 : 0); 535. bn_check_top(a); crypto/bn/bn_lib.c:534:15: Condition is true 532. a->neg = 0; 533. a->d[0] = w; 534. a->top = (w ? 1 : 0); ^ 535. bn_check_top(a); 536. return (1); crypto/bn/bn_lib.c:534:5: 532. a->neg = 0; 533. a->d[0] = w; 534. > a->top = (w ? 1 : 0); 535. bn_check_top(a); 536. return (1); crypto/bn/bn_lib.c:536:5: 534. a->top = (w ? 1 : 0); 535. bn_check_top(a); 536. > return (1); 537. } 538. crypto/bn/bn_lib.c:537:1: return from a call to BN_set_word 535. bn_check_top(a); 536. return (1); 537. > } 538. 539. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) apps/s_server.c:3168:14: Taking false branch 3166. (void)BIO_flush(bio_err); 3167. } 3168. if (!BN_set_word(bn, RSA_F4) || ((rsa_tmp = RSA_new()) == NULL) || ^ 3169. !RSA_generate_key_ex(rsa_tmp, keylength, bn, NULL)) { 3170. RSA_free(rsa_tmp); apps/s_server.c:3168:42: 3166. (void)BIO_flush(bio_err); 3167. } 3168. > if (!BN_set_word(bn, RSA_F4) || ((rsa_tmp = RSA_new()) == NULL) || 3169. !RSA_generate_key_ex(rsa_tmp, keylength, bn, NULL)) { 3170. RSA_free(rsa_tmp); crypto/rsa/rsa_lib.c:72:1: start of procedure RSA_new() 70. static const RSA_METHOD *default_RSA_meth = NULL; 71. 72. > RSA *RSA_new(void) 73. { 74. RSA *r = RSA_new_method(NULL); crypto/rsa/rsa_lib.c:74:5: Skipping RSA_new_method(): empty list of specs 72. RSA *RSA_new(void) 73. { 74. RSA *r = RSA_new_method(NULL); ^ 75. 76. return r; crypto/rsa/rsa_lib.c:76:5: 74. RSA *r = RSA_new_method(NULL); 75. 76. > return r; 77. } 78. crypto/rsa/rsa_lib.c:77:1: return from a call to RSA_new 75. 76. return r; 77. > } 78. 79. void RSA_set_default_method(const RSA_METHOD *meth) apps/s_server.c:3168:42: Taking true branch 3166. (void)BIO_flush(bio_err); 3167. } 3168. if (!BN_set_word(bn, RSA_F4) || ((rsa_tmp = RSA_new()) == NULL) || ^ 3169. !RSA_generate_key_ex(rsa_tmp, keylength, bn, NULL)) { 3170. RSA_free(rsa_tmp); apps/s_server.c:3170:13: 3168. if (!BN_set_word(bn, RSA_F4) || ((rsa_tmp = RSA_new()) == NULL) || 3169. !RSA_generate_key_ex(rsa_tmp, keylength, bn, NULL)) { 3170. > RSA_free(rsa_tmp); 3171. rsa_tmp = NULL; 3172. }
https://github.com/openssl/openssl/blob/5705e05037938623f701092ec84dae90d191091c/apps/s_server.c/#L3170
d2a_code_trace_data_43058
static void gcm_init_4bit(u128 Htable[16], u64 H[2]) { u128 V; #if defined(OPENSSL_SMALL_FOOTPRINT) int i; #endif #define REDUCE(V) do { \ if (sizeof(size_t)==8) { \ u64 T = U64(0xe100000000000000) & (0-(V.lo&1)); \ V.lo = (V.hi<<63)|(V.lo>>1); \ V.hi = (V.hi>>1 )^T; \ } \ else { \ u32 T = 0xe1000000U & (0-(u32)(V.lo&1)); \ V.lo = (V.hi<<63)|(V.lo>>1); \ V.hi = (V.hi>>1 )^((u64)T<<32); \ } \ } while(0) Htable[0].hi = 0; Htable[0].lo = 0; V.hi = H[0]; V.lo = H[1]; #if defined(OPENSSL_SMALL_FOOTPRINT) for (Htable[8]=V, i=4; i>0; i>>=1) { REDUCE(V); Htable[i] = V; } for (i=2; i<16; i<<=1) { u128 *Hi = Htable+i; int j; for (V=*Hi, j=1; j<i; ++j) { Hi[j].hi = V.hi^Htable[j].hi; Hi[j].lo = V.lo^Htable[j].lo; } } #else Htable[8] = V; REDUCE(V); Htable[4] = V; REDUCE(V); Htable[2] = V; REDUCE(V); Htable[1] = V; Htable[3].hi = V.hi^Htable[2].hi, Htable[3].lo = V.lo^Htable[2].lo; V=Htable[4]; Htable[5].hi = V.hi^Htable[1].hi, Htable[5].lo = V.lo^Htable[1].lo; Htable[6].hi = V.hi^Htable[2].hi, Htable[6].lo = V.lo^Htable[2].lo; Htable[7].hi = V.hi^Htable[3].hi, Htable[7].lo = V.lo^Htable[3].lo; V=Htable[8]; Htable[9].hi = V.hi^Htable[1].hi, Htable[9].lo = V.lo^Htable[1].lo; Htable[10].hi = V.hi^Htable[2].hi, Htable[10].lo = V.lo^Htable[2].lo; Htable[11].hi = V.hi^Htable[3].hi, Htable[11].lo = V.lo^Htable[3].lo; Htable[12].hi = V.hi^Htable[4].hi, Htable[12].lo = V.lo^Htable[4].lo; Htable[13].hi = V.hi^Htable[5].hi, Htable[13].lo = V.lo^Htable[5].lo; Htable[14].hi = V.hi^Htable[6].hi, Htable[14].lo = V.lo^Htable[6].lo; Htable[15].hi = V.hi^Htable[7].hi, Htable[15].lo = V.lo^Htable[7].lo; #endif #if defined(GHASH_ASM) && (defined(__arm__) || defined(__arm)) { int j; const union { long one; char little; } is_endian = {1}; if (is_endian.little) for (j=0;j<16;++j) { V = Htable[j]; Htable[j].hi = V.lo; Htable[j].lo = V.hi; } else for (j=0;j<16;++j) { V = Htable[j]; Htable[j].hi = V.lo<<32|V.lo>>32; Htable[j].lo = V.hi<<32|V.hi>>32; } } #endif #undef REDUCE } crypto/modes/gcm128.c:277: error: INTEGER_OVERFLOW_L2 (0 - [0, 1]):unsigned64. Showing all 5 steps of the trace crypto/modes/gcm128.c:235:1: <RHS trace> 233. #elif TABLE_BITS==4 234. 235. > static void gcm_init_4bit(u128 Htable[16], u64 H[2]) 236. { 237. u128 V; crypto/modes/gcm128.c:235:1: Parameter `*H` 233. #elif TABLE_BITS==4 234. 235. > static void gcm_init_4bit(u128 Htable[16], u64 H[2]) 236. { 237. u128 V; crypto/modes/gcm128.c:256:2: Assignment 254. Htable[0].hi = 0; 255. Htable[0].lo = 0; 256. V.hi = H[0]; ^ 257. V.lo = H[1]; 258. crypto/modes/gcm128.c:275:2: Assignment 273. #else 274. Htable[8] = V; 275. REDUCE(V); ^ 276. Htable[4] = V; 277. REDUCE(V); crypto/modes/gcm128.c:277:2: Binary operation: (0 - [0, 1]):unsigned64 275. REDUCE(V); 276. Htable[4] = V; 277. REDUCE(V); ^ 278. Htable[2] = V; 279. REDUCE(V);
https://github.com/openssl/openssl/blob/ea7239cf15b7eeb8555db5b7801e6da7406566ea/crypto/modes/gcm128.c/#L277
d2a_code_trace_data_43059
static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict) { const char *codec_string = encoder ? "encoder" : "decoder"; AVCodec *codec; if(!name) return CODEC_ID_NONE; codec = encoder ? avcodec_find_encoder_by_name(name) : avcodec_find_decoder_by_name(name); if(!codec) { fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); ffmpeg_exit(1); } if(codec->type != type) { fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name); ffmpeg_exit(1); } if(codec->capabilities & CODEC_CAP_EXPERIMENTAL && strict > FF_COMPLIANCE_EXPERIMENTAL) { fprintf(stderr, "%s '%s' is experimental and might produce bad " "results.\nAdd '-strict experimental' if you want to use it.\n", codec_string, codec->name); codec = encoder ? avcodec_find_encoder(codec->id) : avcodec_find_decoder(codec->id); if (!(codec->capabilities & CODEC_CAP_EXPERIMENTAL)) fprintf(stderr, "Or use the non experimental %s '%s'.\n", codec_string, codec->name); ffmpeg_exit(1); } return codec->id; } ffmpeg.c:3075: error: Null Dereference pointer `codec` last assigned on line 3068 could be null and is dereferenced at line 3075, column 8. ffmpeg.c:3061:1: start of procedure find_codec_or_die() 3059. } 3060. 3061. static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict) ^ 3062. { 3063. const char *codec_string = encoder ? "encoder" : "decoder"; ffmpeg.c:3063:32: Condition is true 3061. static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict) 3062. { 3063. const char *codec_string = encoder ? "encoder" : "decoder"; ^ 3064. AVCodec *codec; 3065. ffmpeg.c:3063:5: 3061. static enum CodecID find_codec_or_die(const char *name, int type, int encoder, int strict) 3062. { 3063. const char *codec_string = encoder ? "encoder" : "decoder"; ^ 3064. AVCodec *codec; 3065. ffmpeg.c:3066:9: Taking false branch 3064. AVCodec *codec; 3065. 3066. if(!name) ^ 3067. return CODEC_ID_NONE; 3068. codec = encoder ? ffmpeg.c:3068:13: Condition is true 3066. if(!name) 3067. return CODEC_ID_NONE; 3068. codec = encoder ? ^ 3069. avcodec_find_encoder_by_name(name) : 3070. avcodec_find_decoder_by_name(name); ffmpeg.c:3068:5: 3066. if(!name) 3067. return CODEC_ID_NONE; 3068. codec = encoder ? ^ 3069. avcodec_find_encoder_by_name(name) : 3070. avcodec_find_decoder_by_name(name); ffmpeg.c:3071:9: Taking true branch 3069. avcodec_find_encoder_by_name(name) : 3070. avcodec_find_decoder_by_name(name); 3071. if(!codec) { ^ 3072. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); 3073. ffmpeg_exit(1); ffmpeg.c:3072:9: 3070. avcodec_find_decoder_by_name(name); 3071. if(!codec) { 3072. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); ^ 3073. ffmpeg_exit(1); 3074. } ffmpeg.c:3073:9: Skipping ffmpeg_exit(): empty list of specs 3071. if(!codec) { 3072. fprintf(stderr, "Unknown %s '%s'\n", codec_string, name); 3073. ffmpeg_exit(1); ^ 3074. } 3075. if(codec->type != type) { ffmpeg.c:3075:8: 3073. ffmpeg_exit(1); 3074. } 3075. if(codec->type != type) { ^ 3076. fprintf(stderr, "Invalid %s type '%s'\n", codec_string, name); 3077. ffmpeg_exit(1);
https://github.com/libav/libav/blob/d0005d347d0831c904630fe70408c9fd4eec18e8/ffmpeg.c/#L3075
d2a_code_trace_data_43060
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_ossl.c:616: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_MONT_CTX_set_locked`. Showing all 32 steps of the trace crypto/rsa/rsa_ossl.c:587:1: Parameter `ctx->stack.depth` 585. } 586. 587. > static int rsa_ossl_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) 588. { 589. BIGNUM *r1, *m1, *vrfy; crypto/rsa/rsa_ossl.c:592:5: Call 590. int ret = 0; 591. 592. BN_CTX_start(ctx); ^ 593. 594. r1 = 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/rsa/rsa_ossl.c:614:18: Call 612. 613. if (rsa->flags & RSA_FLAG_CACHE_PRIVATE) { 614. if (!BN_MONT_CTX_set_locked ^ 615. (&rsa->_method_mod_p, rsa->lock, p, ctx) 616. || !BN_MONT_CTX_set_locked(&rsa->_method_mod_q, crypto/bn/bn_mont.c:398:1: Parameter `ctx->stack.depth` 396. } 397. 398. > BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_RWLOCK *lock, 399. const BIGNUM *mod, BN_CTX *ctx) 400. { crypto/rsa/rsa_ossl.c:616:21: Call 614. if (!BN_MONT_CTX_set_locked 615. (&rsa->_method_mod_p, rsa->lock, p, ctx) 616. || !BN_MONT_CTX_set_locked(&rsa->_method_mod_q, ^ 617. rsa->lock, q, ctx)) { 618. BN_free(p); crypto/bn/bn_mont.c:398:1: Parameter `ctx->stack.depth` 396. } 397. 398. > BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, CRYPTO_RWLOCK *lock, 399. const BIGNUM *mod, BN_CTX *ctx) 400. { crypto/bn/bn_mont.c:420:10: Call 418. if (ret == NULL) 419. return NULL; 420. if (!BN_MONT_CTX_set(ret, mod, ctx)) { ^ 421. BN_MONT_CTX_free(ret); 422. return NULL; 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:455:1: Parameter `ctx->stack.depth` 453. * not contain branches that may leak sensitive information. 454. */ 455. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 456. const BIGNUM *a, const BIGNUM *n, 457. BN_CTX *ctx) crypto/bn/bn_gcd.c:466:5: Call 464. bn_check_top(n); 465. 466. BN_CTX_start(ctx); ^ 467. A = BN_CTX_get(ctx); 468. 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:501:18: Call 499. bn_init(&local_B); 500. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME); 501. if (!BN_nnmod(B, &local_B, A, ctx)) ^ 502. goto err; 503. /* 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_MONT_CTX_set_locked` 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/ec772a817afc0f788c38006f623204a7d76221ec/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_43061
static void do_video_stats(AVFormatContext *os, OutputStream *ost, int frame_size) { AVCodecContext *enc; int frame_number; double ti1, bitrate, avg_bitrate; if (!vstats_file) { vstats_file = fopen(vstats_filename, "w"); if (!vstats_file) { perror("fopen"); exit_program(1); } } enc = ost->st->codec; if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { frame_number = ost->frame_number; fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA); if (enc->flags&CODEC_FLAG_PSNR) fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0]/(enc->width*enc->height*255.0*255.0))); fprintf(vstats_file,"f_size= %6d ", frame_size); ti1 = ost->sync_opts * av_q2d(enc->time_base); if (ti1 < 0.01) ti1 = 0.01; bitrate = (frame_size * 8) / av_q2d(enc->time_base) / 1000.0; avg_bitrate = (double)(video_size * 8) / ti1 / 1000.0; fprintf(vstats_file, "s_size= %8.0fkB time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ", (double)video_size / 1024, ti1, bitrate, avg_bitrate); fprintf(vstats_file, "type= %c\n", av_get_picture_type_char(enc->coded_frame->pict_type)); } } avconv.c:1242: error: Null Dereference pointer `vstats_file` last assigned on line 1232 could be null and is dereferenced by call to `fprintf()` at line 1242, column 9. avconv.c:1223:1: start of procedure do_video_stats() 1221. } 1222. 1223. static void do_video_stats(AVFormatContext *os, OutputStream *ost, ^ 1224. int frame_size) 1225. { avconv.c:1231:10: Taking true branch 1229. 1230. /* this is executed just the first time do_video_stats is called */ 1231. if (!vstats_file) { ^ 1232. vstats_file = fopen(vstats_filename, "w"); 1233. if (!vstats_file) { avconv.c:1232:9: 1230. /* this is executed just the first time do_video_stats is called */ 1231. if (!vstats_file) { 1232. vstats_file = fopen(vstats_filename, "w"); ^ 1233. if (!vstats_file) { 1234. perror("fopen"); avconv.c:1233:14: Taking true branch 1231. if (!vstats_file) { 1232. vstats_file = fopen(vstats_filename, "w"); 1233. if (!vstats_file) { ^ 1234. perror("fopen"); 1235. exit_program(1); avconv.c:1234:13: 1232. vstats_file = fopen(vstats_filename, "w"); 1233. if (!vstats_file) { 1234. perror("fopen"); ^ 1235. exit_program(1); 1236. } avconv.c:1235:13: Skipping exit_program(): empty list of specs 1233. if (!vstats_file) { 1234. perror("fopen"); 1235. exit_program(1); ^ 1236. } 1237. } avconv.c:1239:5: 1237. } 1238. 1239. enc = ost->st->codec; ^ 1240. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { 1241. frame_number = ost->frame_number; avconv.c:1240:9: Taking true branch 1238. 1239. enc = ost->st->codec; 1240. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { ^ 1241. frame_number = ost->frame_number; 1242. fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA); avconv.c:1241:9: 1239. enc = ost->st->codec; 1240. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { 1241. frame_number = ost->frame_number; ^ 1242. fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA); 1243. if (enc->flags&CODEC_FLAG_PSNR) avconv.c:1242:9: 1240. if (enc->codec_type == AVMEDIA_TYPE_VIDEO) { 1241. frame_number = ost->frame_number; 1242. fprintf(vstats_file, "frame= %5d q= %2.1f ", frame_number, enc->coded_frame->quality/(float)FF_QP2LAMBDA); ^ 1243. if (enc->flags&CODEC_FLAG_PSNR) 1244. fprintf(vstats_file, "PSNR= %6.2f ", psnr(enc->coded_frame->error[0]/(enc->width*enc->height*255.0*255.0)));
https://github.com/libav/libav/blob/eb97dbb05a990266b04830ea8e179e0428656b98/avconv.c/#L1242
d2a_code_trace_data_43062
int ff_pre_estimate_p_frame_motion(MpegEncContext * s, int mb_x, int mb_y) { MotionEstContext * const c= &s->me; int mx, my, dmin; int P[10][2]; const int shift= 1+s->quarter_sample; const int xy= mb_x + mb_y*s->mb_stride; init_ref(c, s->new_picture.f->data, s->last_picture.f->data, NULL, 16*mb_x, 16*mb_y, 0); assert(s->quarter_sample==0 || s->quarter_sample==1); c->pre_penalty_factor = get_penalty_factor(s->lambda, s->lambda2, c->avctx->me_pre_cmp); c->current_mv_penalty= c->mv_penalty[s->f_code] + MAX_MV; get_limits(s, 16*mb_x, 16*mb_y); c->skip=0; P_LEFT[0] = s->p_mv_table[xy + 1][0]; P_LEFT[1] = s->p_mv_table[xy + 1][1]; if(P_LEFT[0] < (c->xmin<<shift)) P_LEFT[0] = (c->xmin<<shift); if (s->first_slice_line) { c->pred_x= P_LEFT[0]; c->pred_y= P_LEFT[1]; P_TOP[0]= P_TOPRIGHT[0]= P_MEDIAN[0]= P_TOP[1]= P_TOPRIGHT[1]= P_MEDIAN[1]= 0; } else { P_TOP[0] = s->p_mv_table[xy + s->mb_stride ][0]; P_TOP[1] = s->p_mv_table[xy + s->mb_stride ][1]; P_TOPRIGHT[0] = s->p_mv_table[xy + s->mb_stride - 1][0]; P_TOPRIGHT[1] = s->p_mv_table[xy + s->mb_stride - 1][1]; if(P_TOP[1] < (c->ymin<<shift)) P_TOP[1] = (c->ymin<<shift); if(P_TOPRIGHT[0] > (c->xmax<<shift)) P_TOPRIGHT[0]= (c->xmax<<shift); if(P_TOPRIGHT[1] < (c->ymin<<shift)) P_TOPRIGHT[1]= (c->ymin<<shift); P_MEDIAN[0]= mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]); P_MEDIAN[1]= mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]); c->pred_x = P_MEDIAN[0]; c->pred_y = P_MEDIAN[1]; } dmin = ff_epzs_motion_search(s, &mx, &my, P, 0, 0, s->p_mv_table, (1<<16)>>shift, 0, 16); s->p_mv_table[xy][0] = mx<<shift; s->p_mv_table[xy][1] = my<<shift; return dmin; } libavcodec/motion_est.c:1058: error: Null Dereference pointer `null` is dereferenced by call to `init_ref()` at line 1058, column 5. libavcodec/motion_est.c:1050:1: start of procedure ff_pre_estimate_p_frame_motion() 1048. } 1049. 1050. int ff_pre_estimate_p_frame_motion(MpegEncContext * s, ^ 1051. int mb_x, int mb_y) 1052. { libavcodec/motion_est.c:1053:5: 1051. int mb_x, int mb_y) 1052. { 1053. MotionEstContext * const c= &s->me; ^ 1054. int mx, my, dmin; 1055. int P[10][2]; libavcodec/motion_est.c:1056:5: 1054. int mx, my, dmin; 1055. int P[10][2]; 1056. const int shift= 1+s->quarter_sample; ^ 1057. const int xy= mb_x + mb_y*s->mb_stride; 1058. init_ref(c, s->new_picture.f->data, s->last_picture.f->data, NULL, 16*mb_x, 16*mb_y, 0); libavcodec/motion_est.c:1057:5: 1055. int P[10][2]; 1056. const int shift= 1+s->quarter_sample; 1057. const int xy= mb_x + mb_y*s->mb_stride; ^ 1058. init_ref(c, s->new_picture.f->data, s->last_picture.f->data, NULL, 16*mb_x, 16*mb_y, 0); 1059. libavcodec/motion_est.c:1058:5: 1056. const int shift= 1+s->quarter_sample; 1057. const int xy= mb_x + mb_y*s->mb_stride; 1058. init_ref(c, s->new_picture.f->data, s->last_picture.f->data, NULL, 16*mb_x, 16*mb_y, 0); ^ 1059. 1060. assert(s->quarter_sample==0 || s->quarter_sample==1); libavcodec/motion_est.c:86:1: start of procedure init_ref() 84. #define FLAG_DIRECT 4 85. 86. static inline void init_ref(MotionEstContext *c, uint8_t *src[3], uint8_t *ref[3], uint8_t *ref2[3], int x, int y, int ref_index){ ^ 87. const int offset[3]= { 88. y*c-> stride + x, libavcodec/motion_est.c:87:5: 85. 86. static inline void init_ref(MotionEstContext *c, uint8_t *src[3], uint8_t *ref[3], uint8_t *ref2[3], int x, int y, int ref_index){ 87. const int offset[3]= { ^ 88. y*c-> stride + x, 89. ((y*c->uvstride + x)>>1), libavcodec/motion_est.c:93:9: 91. }; 92. int i; 93. for(i=0; i<3; i++){ ^ 94. c->src[0][i]= src [i] + offset[i]; 95. c->ref[0][i]= ref [i] + offset[i]; libavcodec/motion_est.c:93:14: Loop condition is true. Entering loop body 91. }; 92. int i; 93. for(i=0; i<3; i++){ ^ 94. c->src[0][i]= src [i] + offset[i]; 95. c->ref[0][i]= ref [i] + offset[i]; libavcodec/motion_est.c:94:9: 92. int i; 93. for(i=0; i<3; i++){ 94. c->src[0][i]= src [i] + offset[i]; ^ 95. c->ref[0][i]= ref [i] + offset[i]; 96. } libavcodec/motion_est.c:95:9: 93. for(i=0; i<3; i++){ 94. c->src[0][i]= src [i] + offset[i]; 95. c->ref[0][i]= ref [i] + offset[i]; ^ 96. } 97. if(ref_index){ libavcodec/motion_est.c:93:19: 91. }; 92. int i; 93. for(i=0; i<3; i++){ ^ 94. c->src[0][i]= src [i] + offset[i]; 95. c->ref[0][i]= ref [i] + offset[i]; libavcodec/motion_est.c:93:14: Loop condition is true. Entering loop body 91. }; 92. int i; 93. for(i=0; i<3; i++){ ^ 94. c->src[0][i]= src [i] + offset[i]; 95. c->ref[0][i]= ref [i] + offset[i]; libavcodec/motion_est.c:94:9: 92. int i; 93. for(i=0; i<3; i++){ 94. c->src[0][i]= src [i] + offset[i]; ^ 95. c->ref[0][i]= ref [i] + offset[i]; 96. } libavcodec/motion_est.c:95:9: 93. for(i=0; i<3; i++){ 94. c->src[0][i]= src [i] + offset[i]; 95. c->ref[0][i]= ref [i] + offset[i]; ^ 96. } 97. if(ref_index){ libavcodec/motion_est.c:93:19: 91. }; 92. int i; 93. for(i=0; i<3; i++){ ^ 94. c->src[0][i]= src [i] + offset[i]; 95. c->ref[0][i]= ref [i] + offset[i]; libavcodec/motion_est.c:93:14: Loop condition is false. Leaving loop 91. }; 92. int i; 93. for(i=0; i<3; i++){ ^ 94. c->src[0][i]= src [i] + offset[i]; 95. c->ref[0][i]= ref [i] + offset[i]; libavcodec/motion_est.c:97:8: Taking true branch 95. c->ref[0][i]= ref [i] + offset[i]; 96. } 97. if(ref_index){ ^ 98. for(i=0; i<3; i++){ 99. c->ref[ref_index][i]= ref2[i] + offset[i]; libavcodec/motion_est.c:98:13: 96. } 97. if(ref_index){ 98. for(i=0; i<3; i++){ ^ 99. c->ref[ref_index][i]= ref2[i] + offset[i]; 100. } libavcodec/motion_est.c:98:18: Loop condition is true. Entering loop body 96. } 97. if(ref_index){ 98. for(i=0; i<3; i++){ ^ 99. c->ref[ref_index][i]= ref2[i] + offset[i]; 100. } libavcodec/motion_est.c:99:13: 97. if(ref_index){ 98. for(i=0; i<3; i++){ 99. c->ref[ref_index][i]= ref2[i] + offset[i]; ^ 100. } 101. }
https://github.com/libav/libav/blob/7a6cf2771414c7ab8bca0811d589f6091a6e2b71/libavcodec/motion_est.c/#L1058
d2a_code_trace_data_43063
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_chk.c:144: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul`. Showing all 31 steps of the trace crypto/rsa/rsa_chk.c:65:9: Call 63. 64. /* p prime? */ 65. if (BN_is_prime_ex(key->p, BN_prime_checks, NULL, cb) != 1) { ^ 66. ret = 0; 67. RSAerr(RSA_F_RSA_CHECK_KEY_EX, RSA_R_P_NOT_PRIME); crypto/bn/bn_prime.c:145:1: Parameter `ctx_passed->stack.depth` 143. } 144. 145. > int BN_is_prime_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 146. BN_GENCB *cb) 147. { crypto/bn/bn_prime.c:148:12: Call 146. BN_GENCB *cb) 147. { 148. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb); ^ 149. } 150. crypto/bn/bn_prime.c:151:1: Parameter `ctx_passed->stack.depth` 149. } 150. 151. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 152. int do_trial_division, BN_GENCB *cb) 153. { crypto/rsa/rsa_chk.c:71:9: Call 69. 70. /* q prime? */ 71. if (BN_is_prime_ex(key->q, BN_prime_checks, NULL, cb) != 1) { ^ 72. ret = 0; 73. RSAerr(RSA_F_RSA_CHECK_KEY_EX, RSA_R_Q_NOT_PRIME); crypto/bn/bn_prime.c:145:1: Parameter `ctx_passed->stack.depth` 143. } 144. 145. > int BN_is_prime_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 146. BN_GENCB *cb) 147. { crypto/bn/bn_prime.c:148:12: Call 146. BN_GENCB *cb) 147. { 148. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb); ^ 149. } 150. crypto/bn/bn_prime.c:151:1: Parameter `ctx_passed->stack.depth` 149. } 150. 151. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 152. int do_trial_division, BN_GENCB *cb) 153. { crypto/rsa/rsa_chk.c:86:10: Call 84. 85. /* n = p*q * r_3...r_i? */ 86. if (!BN_mul(i, key->p, key->q, ctx)) { ^ 87. ret = -1; 88. goto err; crypto/bn/bn_mul.c:497:1: Parameter `ctx->stack.depth` 495. #endif /* BN_RECURSION */ 496. 497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); crypto/bn/bn_mul.c:499:15: Call 497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); ^ 500. 501. bn_correct_top(r); crypto/bn/bn_mul.c:507:1: Parameter `ctx->stack.depth` 505. } 506. 507. > int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 508. { 509. int ret = 0; crypto/rsa/rsa_chk.c:144:10: Call 142. goto err; 143. } 144. if (!BN_mod_mul(i, key->d, key->e, k, ctx)) { ^ 145. ret = -1; 146. goto err; crypto/bn/bn_mod.c:193:1: Parameter `ctx->stack.depth` 191. 192. /* slow but works */ 193. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 194. BN_CTX *ctx) 195. { crypto/bn/bn_mod.c:203:5: Call 201. bn_check_top(m); 202. 203. BN_CTX_start(ctx); ^ 204. if ((t = BN_CTX_get(ctx)) == NULL) 205. goto err; crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_mod.c:204:14: Call 202. 203. BN_CTX_start(ctx); 204. if ((t = BN_CTX_get(ctx)) == NULL) ^ 205. goto err; 206. if (a == b) { crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_mod.c:207:14: Call 205. goto err; 206. if (a == b) { 207. if (!BN_sqr(t, a, ctx)) ^ 208. goto err; 209. } else { 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:42:5: Call 40. } 41. 42. BN_CTX_start(ctx); ^ 43. rr = (a != r) ? r : BN_CTX_get(ctx); 44. 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_sqr.c:104:5: Call 102. bn_check_top(rr); 103. bn_check_top(tmp); 104. BN_CTX_end(ctx); ^ 105. return ret; 106. } crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_43064
static int tls_curve_allowed(SSL *s, const unsigned char *curve, int op) { const tls_curve_info *cinfo; if (curve[0]) return 1; if ((curve[1] < 1) || ((size_t)curve[1] > OSSL_NELEM(nid_list))) return 0; cinfo = &nid_list[curve[1] - 1]; # ifdef OPENSSL_NO_EC2M if (cinfo->flags & TLS_CURVE_CHAR2) return 0; # endif return ssl_security(s, op, cinfo->secbits, cinfo->nid, (void *)curve); } ssl/t1_lib.c:1139: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: 29 by call to `tls_curve_allowed`. Showing all 7 steps of the trace ssl/t1_lib.c:1026:1: Parameter `*s->session->tlsext_supportedgroupslist` 1024. } 1025. 1026. > int ssl_add_clienthello_tlsext(SSL *s, WPACKET *pkt, int *al) 1027. { 1028. #ifndef OPENSSL_NO_EC ssl/t1_lib.c:1139:17: Call 1137. /* Copy curve ID if supported */ 1138. for (i = 0; i < num_curves; i++, pcurves += 2) { 1139. if (tls_curve_allowed(s, pcurves, SSL_SECOP_CURVE_SUPPORTED)) { ^ 1140. if (!WPACKET_put_bytes_u8(pkt, pcurves[0]) 1141. || !WPACKET_put_bytes_u8(pkt, pcurves[1])) { ssl/t1_lib.c:312:1: <Offset trace> 310. 311. /* See if curve is allowed by security callback */ 312. > static int tls_curve_allowed(SSL *s, const unsigned char *curve, int op) 313. { 314. const tls_curve_info *cinfo; ssl/t1_lib.c:312:1: Parameter `*curve` 310. 311. /* See if curve is allowed by security callback */ 312. > static int tls_curve_allowed(SSL *s, const unsigned char *curve, int op) 313. { 314. const tls_curve_info *cinfo; ssl/t1_lib.c:144:1: <Length trace> 142. * table: the index of each entry is one less than the TLS curve id. 143. */ 144. > static const tls_curve_info nid_list[] = { 145. {NID_sect163k1, 80, TLS_CURVE_CHAR2}, /* sect163k1 (1) */ 146. {NID_sect163r1, 80, TLS_CURVE_CHAR2}, /* sect163r1 (2) */ ssl/t1_lib.c:144:1: Array declaration 142. * table: the index of each entry is one less than the TLS curve id. 143. */ 144. > static const tls_curve_info nid_list[] = { 145. {NID_sect163k1, 80, TLS_CURVE_CHAR2}, /* sect163k1 (1) */ 146. {NID_sect163r1, 80, TLS_CURVE_CHAR2}, /* sect163r1 (2) */ ssl/t1_lib.c:319:5: Array access: Offset: [-1, +oo] Size: 29 by call to `tls_curve_allowed` 317. if ((curve[1] < 1) || ((size_t)curve[1] > OSSL_NELEM(nid_list))) 318. return 0; 319. cinfo = &nid_list[curve[1] - 1]; ^ 320. # ifdef OPENSSL_NO_EC2M 321. if (cinfo->flags & TLS_CURVE_CHAR2)
https://github.com/openssl/openssl/blob/b4eee58a5f9dfa493d6cc34b4af871415c67beda/ssl/t1_lib.c/#L319
d2a_code_trace_data_43065
static int dct_quantize_refine(MpegEncContext *s, DCTELEM *block, int16_t *weight, DCTELEM *orig, int n, int qscale){ int16_t rem[64]; DECLARE_ALIGNED_16(DCTELEM, d1[64]); const int *qmat; const uint8_t *scantable= s->intra_scantable.scantable; const uint8_t *perm_scantable= s->intra_scantable.permutated; int run_tab[65]; int prev_run=0; int prev_level=0; int qmul, qadd, start_i, last_non_zero, i, dc; uint8_t * length; uint8_t * last_length; int lambda; int rle_index, run, q = 1, sum; #ifdef REFINE_STATS static int count=0; static int after_last=0; static int to_zero=0; static int from_zero=0; static int raise=0; static int lower=0; static int messed_sign=0; #endif if(basis[0][0] == 0) build_basis(s->dsp.idct_permutation); qmul= qscale*2; qadd= (qscale-1)|1; if (s->mb_intra) { if (!s->h263_aic) { if (n < 4) q = s->y_dc_scale; else q = s->c_dc_scale; } else{ q = 1; qadd=0; } q <<= RECON_SHIFT-3; dc= block[0]*q; start_i = 1; qmat = s->q_intra_matrix[qscale]; length = s->intra_ac_vlc_length; last_length= s->intra_ac_vlc_last_length; } else { dc= 0; start_i = 0; qmat = s->q_inter_matrix[qscale]; length = s->inter_ac_vlc_length; last_length= s->inter_ac_vlc_last_length; } last_non_zero = s->block_last_index[n]; #ifdef REFINE_STATS {START_TIMER #endif dc += (1<<(RECON_SHIFT-1)); for(i=0; i<64; i++){ rem[i]= dc - (orig[i]<<RECON_SHIFT); } #ifdef REFINE_STATS STOP_TIMER("memset rem[]")} #endif sum=0; for(i=0; i<64; i++){ int one= 36; int qns=4; int w; w= FFABS(weight[i]) + qns*one; w= 15 + (48*qns*one + w/2)/w; weight[i] = w; assert(w>0); assert(w<(1<<6)); sum += w*w; } lambda= sum*(uint64_t)s->lambda2 >> (FF_LAMBDA_SHIFT - 6 + 6 + 6 + 6); #ifdef REFINE_STATS {START_TIMER #endif run=0; rle_index=0; for(i=start_i; i<=last_non_zero; i++){ int j= perm_scantable[i]; const int level= block[j]; int coeff; if(level){ if(level<0) coeff= qmul*level - qadd; else coeff= qmul*level + qadd; run_tab[rle_index++]=run; run=0; s->dsp.add_8x8basis(rem, basis[j], coeff); }else{ run++; } } #ifdef REFINE_STATS if(last_non_zero>0){ STOP_TIMER("init rem[]") } } {START_TIMER #endif for(;;){ int best_score=s->dsp.try_8x8basis(rem, weight, basis[0], 0); int best_coeff=0; int best_change=0; int run2, best_unquant_change=0, analyze_gradient; #ifdef REFINE_STATS {START_TIMER #endif analyze_gradient = last_non_zero > 2 || s->avctx->quantizer_noise_shaping >= 3; if(analyze_gradient){ #ifdef REFINE_STATS {START_TIMER #endif for(i=0; i<64; i++){ int w= weight[i]; d1[i] = (rem[i]*w*w + (1<<(RECON_SHIFT+12-1)))>>(RECON_SHIFT+12); } #ifdef REFINE_STATS STOP_TIMER("rem*w*w")} {START_TIMER #endif s->dsp.fdct(d1); #ifdef REFINE_STATS STOP_TIMER("dct")} #endif } if(start_i){ const int level= block[0]; int change, old_coeff; assert(s->mb_intra); old_coeff= q*level; for(change=-1; change<=1; change+=2){ int new_level= level + change; int score, new_coeff; new_coeff= q*new_level; if(new_coeff >= 2048 || new_coeff < 0) continue; score= s->dsp.try_8x8basis(rem, weight, basis[0], new_coeff - old_coeff); if(score<best_score){ best_score= score; best_coeff= 0; best_change= change; best_unquant_change= new_coeff - old_coeff; } } } run=0; rle_index=0; run2= run_tab[rle_index++]; prev_level=0; prev_run=0; for(i=start_i; i<64; i++){ int j= perm_scantable[i]; const int level= block[j]; int change, old_coeff; if(s->avctx->quantizer_noise_shaping < 3 && i > last_non_zero + 1) break; if(level){ if(level<0) old_coeff= qmul*level - qadd; else old_coeff= qmul*level + qadd; run2= run_tab[rle_index++]; }else{ old_coeff=0; run2--; assert(run2>=0 || i >= last_non_zero ); } for(change=-1; change<=1; change+=2){ int new_level= level + change; int score, new_coeff, unquant_change; score=0; if(s->avctx->quantizer_noise_shaping < 2 && FFABS(new_level) > FFABS(level)) continue; if(new_level){ if(new_level<0) new_coeff= qmul*new_level - qadd; else new_coeff= qmul*new_level + qadd; if(new_coeff >= 2048 || new_coeff <= -2048) continue; if(level){ if(level < 63 && level > -63){ if(i < last_non_zero) score += length[UNI_AC_ENC_INDEX(run, new_level+64)] - length[UNI_AC_ENC_INDEX(run, level+64)]; else score += last_length[UNI_AC_ENC_INDEX(run, new_level+64)] - last_length[UNI_AC_ENC_INDEX(run, level+64)]; } }else{ assert(FFABS(new_level)==1); if(analyze_gradient){ int g= d1[ scantable[i] ]; if(g && (g^new_level) >= 0) continue; } if(i < last_non_zero){ int next_i= i + run2 + 1; int next_level= block[ perm_scantable[next_i] ] + 64; if(next_level&(~127)) next_level= 0; if(next_i < last_non_zero) score += length[UNI_AC_ENC_INDEX(run, 65)] + length[UNI_AC_ENC_INDEX(run2, next_level)] - length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)]; else score += length[UNI_AC_ENC_INDEX(run, 65)] + last_length[UNI_AC_ENC_INDEX(run2, next_level)] - last_length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)]; }else{ score += last_length[UNI_AC_ENC_INDEX(run, 65)]; if(prev_level){ score += length[UNI_AC_ENC_INDEX(prev_run, prev_level)] - last_length[UNI_AC_ENC_INDEX(prev_run, prev_level)]; } } } }else{ new_coeff=0; assert(FFABS(level)==1); if(i < last_non_zero){ int next_i= i + run2 + 1; int next_level= block[ perm_scantable[next_i] ] + 64; if(next_level&(~127)) next_level= 0; if(next_i < last_non_zero) score += length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)] - length[UNI_AC_ENC_INDEX(run2, next_level)] - length[UNI_AC_ENC_INDEX(run, 65)]; else score += last_length[UNI_AC_ENC_INDEX(run + run2 + 1, next_level)] - last_length[UNI_AC_ENC_INDEX(run2, next_level)] - length[UNI_AC_ENC_INDEX(run, 65)]; }else{ score += -last_length[UNI_AC_ENC_INDEX(run, 65)]; if(prev_level){ score += last_length[UNI_AC_ENC_INDEX(prev_run, prev_level)] - length[UNI_AC_ENC_INDEX(prev_run, prev_level)]; } } } score *= lambda; unquant_change= new_coeff - old_coeff; assert((score < 100*lambda && score > -100*lambda) || lambda==0); score+= s->dsp.try_8x8basis(rem, weight, basis[j], unquant_change); if(score<best_score){ best_score= score; best_coeff= i; best_change= change; best_unquant_change= unquant_change; } } if(level){ prev_level= level + 64; if(prev_level&(~127)) prev_level= 0; prev_run= run; run=0; }else{ run++; } } #ifdef REFINE_STATS STOP_TIMER("iterative step")} #endif if(best_change){ int j= perm_scantable[ best_coeff ]; block[j] += best_change; if(best_coeff > last_non_zero){ last_non_zero= best_coeff; assert(block[j]); #ifdef REFINE_STATS after_last++; #endif }else{ #ifdef REFINE_STATS if(block[j]){ if(block[j] - best_change){ if(FFABS(block[j]) > FFABS(block[j] - best_change)){ raise++; }else{ lower++; } }else{ from_zero++; } }else{ to_zero++; } #endif for(; last_non_zero>=start_i; last_non_zero--){ if(block[perm_scantable[last_non_zero]]) break; } } #ifdef REFINE_STATS count++; if(256*256*256*64 % count == 0){ printf("after_last:%d to_zero:%d from_zero:%d raise:%d lower:%d sign:%d xyp:%d/%d/%d\n", after_last, to_zero, from_zero, raise, lower, messed_sign, s->mb_x, s->mb_y, s->picture_number); } #endif run=0; rle_index=0; for(i=start_i; i<=last_non_zero; i++){ int j= perm_scantable[i]; const int level= block[j]; if(level){ run_tab[rle_index++]=run; run=0; }else{ run++; } } s->dsp.add_8x8basis(rem, basis[j], best_unquant_change); }else{ break; } } #ifdef REFINE_STATS if(last_non_zero>0){ STOP_TIMER("iterative search") } } #endif return last_non_zero; } libavcodec/mpegvideo_enc.c:3458: error: Uninitialized Value The value read from run_tab[_] was never initialized. libavcodec/mpegvideo_enc.c:3458:9: 3456. run=0; 3457. rle_index=0; 3458. run2= run_tab[rle_index++]; ^ 3459. prev_level=0; 3460. prev_run=0;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo_enc.c/#L3458
d2a_code_trace_data_43066
int test_gf2m_mod_solve_quad(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b[2], *c, *d, *e; int i, j, s = 0, t, ret = 0; int p0[] = { 163, 7, 6, 3, 0, -1 }; int p1[] = { 193, 15, 0, -1 }; a = BN_new(); b[0] = BN_new(); b[1] = BN_new(); c = BN_new(); d = BN_new(); e = BN_new(); BN_GF2m_arr2poly(p0, b[0]); BN_GF2m_arr2poly(p1, b[1]); for (i = 0; i < num0; i++) { BN_bntest_rand(a, 512, 0, 0); for (j = 0; j < 2; j++) { t = BN_GF2m_mod_solve_quad(c, a, b[j], ctx); if (t) { s++; BN_GF2m_mod_sqr(d, c, b[j], ctx); BN_GF2m_add(d, c, d); BN_GF2m_mod(e, a, b[j]); BN_GF2m_add(e, e, d); if (!BN_is_zero(e)) { fprintf(stderr, "GF(2^m) modular solve quadratic test failed!\n"); goto err; } } } } if (s == 0) { fprintf(stderr, "All %i tests of GF(2^m) modular solve quadratic resulted in no roots;\n", num0); fprintf(stderr, "this is very unlikely and probably indicates an error.\n"); goto err; } ret = 1; err: BN_free(a); BN_free(b[0]); BN_free(b[1]); BN_free(c); BN_free(d); BN_free(e); return ret; } test/bntest.c:1627: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 1585, column 9 is not reachable after line 1627, column 5. Showing all 157 steps of the trace test/bntest.c:1578:1: start of procedure test_gf2m_mod_solve_quad() 1576. } 1577. 1578. > int test_gf2m_mod_solve_quad(BIO *bp, BN_CTX *ctx) 1579. { 1580. BIGNUM *a, *b[2], *c, *d, *e; test/bntest.c:1581:5: 1579. { 1580. BIGNUM *a, *b[2], *c, *d, *e; 1581. > int i, j, s = 0, t, ret = 0; 1582. int p0[] = { 163, 7, 6, 3, 0, -1 }; 1583. int p1[] = { 193, 15, 0, -1 }; test/bntest.c:1582:5: 1580. BIGNUM *a, *b[2], *c, *d, *e; 1581. int i, j, s = 0, t, ret = 0; 1582. > int p0[] = { 163, 7, 6, 3, 0, -1 }; 1583. int p1[] = { 193, 15, 0, -1 }; 1584. test/bntest.c:1583:5: 1581. int i, j, s = 0, t, ret = 0; 1582. int p0[] = { 163, 7, 6, 3, 0, -1 }; 1583. > int p1[] = { 193, 15, 0, -1 }; 1584. 1585. a = BN_new(); test/bntest.c:1585:5: 1583. int p1[] = { 193, 15, 0, -1 }; 1584. 1585. > a = BN_new(); 1586. b[0] = BN_new(); 1587. b[1] = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1586:5: 1584. 1585. a = BN_new(); 1586. > b[0] = BN_new(); 1587. b[1] = BN_new(); 1588. 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:1587:5: 1585. a = BN_new(); 1586. b[0] = BN_new(); 1587. > b[1] = BN_new(); 1588. c = BN_new(); 1589. 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:1588:5: 1586. b[0] = BN_new(); 1587. b[1] = BN_new(); 1588. > c = BN_new(); 1589. d = BN_new(); 1590. 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:1589:5: 1587. b[1] = BN_new(); 1588. c = BN_new(); 1589. > d = BN_new(); 1590. e = BN_new(); 1591. 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:1590:5: 1588. c = BN_new(); 1589. d = BN_new(); 1590. > e = BN_new(); 1591. 1592. BN_GF2m_arr2poly(p0, b[0]); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1592:5: Skipping BN_GF2m_arr2poly(): empty list of specs 1590. e = BN_new(); 1591. 1592. BN_GF2m_arr2poly(p0, b[0]); ^ 1593. BN_GF2m_arr2poly(p1, b[1]); 1594. test/bntest.c:1593:5: Skipping BN_GF2m_arr2poly(): empty list of specs 1591. 1592. BN_GF2m_arr2poly(p0, b[0]); 1593. BN_GF2m_arr2poly(p1, b[1]); ^ 1594. 1595. for (i = 0; i < num0; i++) { test/bntest.c:1595:10: 1593. BN_GF2m_arr2poly(p1, b[1]); 1594. 1595. > for (i = 0; i < num0; i++) { 1596. BN_bntest_rand(a, 512, 0, 0); 1597. for (j = 0; j < 2; j++) { test/bntest.c:1595:17: Loop condition is false. Leaving loop 1593. BN_GF2m_arr2poly(p1, b[1]); 1594. 1595. for (i = 0; i < num0; i++) { ^ 1596. BN_bntest_rand(a, 512, 0, 0); 1597. for (j = 0; j < 2; j++) { test/bntest.c:1617:9: Taking true branch 1615. } 1616. } 1617. if (s == 0) { ^ 1618. fprintf(stderr, 1619. "All %i tests of GF(2^m) modular solve quadratic resulted in no roots;\n", test/bntest.c:1618:9: 1616. } 1617. if (s == 0) { 1618. > fprintf(stderr, 1619. "All %i tests of GF(2^m) modular solve quadratic resulted in no roots;\n", 1620. num0); test/bntest.c:1621:9: 1619. "All %i tests of GF(2^m) modular solve quadratic resulted in no roots;\n", 1620. num0); 1621. > fprintf(stderr, 1622. "this is very unlikely and probably indicates an error.\n"); 1623. goto err; test/bntest.c:1626:2: 1624. } 1625. ret = 1; 1626. > err: 1627. BN_free(a); 1628. BN_free(b[0]); test/bntest.c:1627:5: 1625. ret = 1; 1626. err: 1627. > BN_free(a); 1628. BN_free(b[0]); 1629. BN_free(b[1]); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L1627
d2a_code_trace_data_43067
int ssl3_cbc_digest_record(const EVP_MD_CTX *ctx, unsigned char *md_out, size_t *md_out_size, const unsigned char header[13], const unsigned char *data, size_t data_plus_mac_size, size_t data_plus_mac_plus_padding_size, const unsigned char *mac_secret, size_t mac_secret_length, char is_sslv3) { union { double align; unsigned char c[sizeof(LARGEST_DIGEST_CTX)]; } md_state; void (*md_final_raw) (void *ctx, unsigned char *md_out); void (*md_transform) (void *ctx, const unsigned char *block); size_t md_size, md_block_size = 64; size_t sslv3_pad_length = 40, header_length, variance_blocks, len, max_mac_bytes, num_blocks, num_starting_blocks, k, mac_end_offset, c, index_a, index_b; size_t bits; unsigned char length_bytes[MAX_HASH_BIT_COUNT_BYTES]; unsigned char hmac_pad[MAX_HASH_BLOCK_SIZE]; unsigned char first_block[MAX_HASH_BLOCK_SIZE]; unsigned char mac_out[EVP_MAX_MD_SIZE]; size_t i, j; unsigned md_out_size_u; EVP_MD_CTX *md_ctx = NULL; size_t md_length_size = 8; char length_is_big_endian = 1; int ret; OPENSSL_assert(data_plus_mac_plus_padding_size < 1024 * 1024); switch (EVP_MD_CTX_type(ctx)) { case NID_md5: if (MD5_Init((MD5_CTX *)md_state.c) <= 0) return 0; md_final_raw = tls1_md5_final_raw; md_transform = (void (*)(void *ctx, const unsigned char *block))MD5_Transform; md_size = 16; sslv3_pad_length = 48; length_is_big_endian = 0; break; case NID_sha1: if (SHA1_Init((SHA_CTX *)md_state.c) <= 0) return 0; md_final_raw = tls1_sha1_final_raw; md_transform = (void (*)(void *ctx, const unsigned char *block))SHA1_Transform; md_size = 20; break; case NID_sha224: if (SHA224_Init((SHA256_CTX *)md_state.c) <= 0) return 0; md_final_raw = tls1_sha256_final_raw; md_transform = (void (*)(void *ctx, const unsigned char *block))SHA256_Transform; md_size = 224 / 8; break; case NID_sha256: if (SHA256_Init((SHA256_CTX *)md_state.c) <= 0) return 0; md_final_raw = tls1_sha256_final_raw; md_transform = (void (*)(void *ctx, const unsigned char *block))SHA256_Transform; md_size = 32; break; case NID_sha384: if (SHA384_Init((SHA512_CTX *)md_state.c) <= 0) return 0; md_final_raw = tls1_sha512_final_raw; md_transform = (void (*)(void *ctx, const unsigned char *block))SHA512_Transform; md_size = 384 / 8; md_block_size = 128; md_length_size = 16; break; case NID_sha512: if (SHA512_Init((SHA512_CTX *)md_state.c) <= 0) return 0; md_final_raw = tls1_sha512_final_raw; md_transform = (void (*)(void *ctx, const unsigned char *block))SHA512_Transform; md_size = 64; md_block_size = 128; md_length_size = 16; break; default: OPENSSL_assert(0); if (md_out_size) *md_out_size = 0; return 0; } OPENSSL_assert(md_length_size <= MAX_HASH_BIT_COUNT_BYTES); OPENSSL_assert(md_block_size <= MAX_HASH_BLOCK_SIZE); OPENSSL_assert(md_size <= EVP_MAX_MD_SIZE); header_length = 13; if (is_sslv3) { header_length = mac_secret_length + sslv3_pad_length + 8 + 1 + 2 ; } variance_blocks = is_sslv3 ? 2 : 6; len = data_plus_mac_plus_padding_size + header_length; max_mac_bytes = len - md_size - 1; num_blocks = (max_mac_bytes + 1 + md_length_size + md_block_size - 1) / md_block_size; num_starting_blocks = 0; k = 0; mac_end_offset = data_plus_mac_size + header_length - md_size; c = mac_end_offset % md_block_size; index_a = mac_end_offset / md_block_size; index_b = (mac_end_offset + md_length_size) / md_block_size; if (num_blocks > variance_blocks + (is_sslv3 ? 1 : 0)) { num_starting_blocks = num_blocks - variance_blocks; k = md_block_size * num_starting_blocks; } bits = 8 * mac_end_offset; if (!is_sslv3) { bits += 8 * md_block_size; memset(hmac_pad, 0, md_block_size); OPENSSL_assert(mac_secret_length <= sizeof(hmac_pad)); memcpy(hmac_pad, mac_secret, mac_secret_length); for (i = 0; i < md_block_size; i++) hmac_pad[i] ^= 0x36; md_transform(md_state.c, hmac_pad); } if (length_is_big_endian) { memset(length_bytes, 0, md_length_size - 4); length_bytes[md_length_size - 4] = (unsigned char)(bits >> 24); length_bytes[md_length_size - 3] = (unsigned char)(bits >> 16); length_bytes[md_length_size - 2] = (unsigned char)(bits >> 8); length_bytes[md_length_size - 1] = (unsigned char)bits; } else { memset(length_bytes, 0, md_length_size); length_bytes[md_length_size - 5] = (unsigned char)(bits >> 24); length_bytes[md_length_size - 6] = (unsigned char)(bits >> 16); length_bytes[md_length_size - 7] = (unsigned char)(bits >> 8); length_bytes[md_length_size - 8] = (unsigned char)bits; } if (k > 0) { if (is_sslv3) { size_t overhang; if (header_length <= md_block_size) { return 0; } overhang = header_length - md_block_size; md_transform(md_state.c, header); memcpy(first_block, header + md_block_size, overhang); memcpy(first_block + overhang, data, md_block_size - overhang); md_transform(md_state.c, first_block); for (i = 1; i < k / md_block_size - 1; i++) md_transform(md_state.c, data + md_block_size * i - overhang); } else { memcpy(first_block, header, 13); memcpy(first_block + 13, data, md_block_size - 13); md_transform(md_state.c, first_block); for (i = 1; i < k / md_block_size; i++) md_transform(md_state.c, data + md_block_size * i - 13); } } memset(mac_out, 0, sizeof(mac_out)); for (i = num_starting_blocks; i <= num_starting_blocks + variance_blocks; i++) { unsigned char block[MAX_HASH_BLOCK_SIZE]; unsigned char is_block_a = constant_time_eq_8_s(i, index_a); unsigned char is_block_b = constant_time_eq_8_s(i, index_b); for (j = 0; j < md_block_size; j++) { unsigned char b = 0, is_past_c, is_past_cp1; if (k < header_length) b = header[k]; else if (k < data_plus_mac_plus_padding_size + header_length) b = data[k - header_length]; k++; is_past_c = is_block_a & constant_time_ge_8_s(j, c); is_past_cp1 = is_block_a & constant_time_ge_8_s(j, c + 1); b = constant_time_select_8(is_past_c, 0x80, b); b = b & ~is_past_cp1; b &= ~is_block_b | is_block_a; if (j >= md_block_size - md_length_size) { b = constant_time_select_8(is_block_b, length_bytes[j - (md_block_size - md_length_size)], b); } block[j] = b; } md_transform(md_state.c, block); md_final_raw(md_state.c, block); for (j = 0; j < md_size; j++) mac_out[j] |= block[j] & is_block_b; } md_ctx = EVP_MD_CTX_new(); if (md_ctx == NULL) goto err; if (EVP_DigestInit_ex(md_ctx, EVP_MD_CTX_md(ctx), NULL ) <= 0) goto err; if (is_sslv3) { memset(hmac_pad, 0x5c, sslv3_pad_length); if (EVP_DigestUpdate(md_ctx, mac_secret, mac_secret_length) <= 0 || EVP_DigestUpdate(md_ctx, hmac_pad, sslv3_pad_length) <= 0 || EVP_DigestUpdate(md_ctx, mac_out, md_size) <= 0) goto err; } else { for (i = 0; i < md_block_size; i++) hmac_pad[i] ^= 0x6a; if (EVP_DigestUpdate(md_ctx, hmac_pad, md_block_size) <= 0 || EVP_DigestUpdate(md_ctx, mac_out, md_size) <= 0) goto err; } ret = EVP_DigestFinal(md_ctx, md_out, &md_out_size_u); if (ret && md_out_size) *md_out_size = md_out_size_u; EVP_MD_CTX_free(md_ctx); return 1; err: EVP_MD_CTX_free(md_ctx); return 0; } ssl/record/ssl3_record.c:937: error: INTEGER_OVERFLOW_L2 ([65, +oo] - [64, 128]):unsigned64 by call to `ssl3_cbc_digest_record`. Showing all 10 steps of the trace ssl/record/ssl3_record.c:901:9: Call 899. } 900. 901. t = EVP_MD_CTX_size(hash); ^ 902. if (t < 0) 903. return 0; crypto/evp/evp_lib.c:305:9: Assignment 303. if (!md) { 304. EVPerr(EVP_F_EVP_MD_SIZE, EVP_R_MESSAGE_DIGEST_IS_NULL); 305. return -1; ^ 306. } 307. return md->md_size; ssl/record/ssl3_record.c:901:5: Assignment 899. } 900. 901. t = EVP_MD_CTX_size(hash); ^ 902. if (t < 0) 903. return 0; ssl/record/ssl3_record.c:904:5: Assignment 902. if (t < 0) 903. return 0; 904. md_size = t; ^ 905. npad = (48 / md_size) * md_size; 906. ssl/record/ssl3_record.c:937:13: Call 935. 936. /* Final param == is SSLv3 */ 937. if (ssl3_cbc_digest_record(hash, ^ 938. md, &md_size, 939. header, rec->input, ssl/s3_cbc.c:145:5: <LHS trace> 143. void (*md_final_raw) (void *ctx, unsigned char *md_out); 144. void (*md_transform) (void *ctx, const unsigned char *block); 145. size_t md_size, md_block_size = 64; ^ 146. size_t sslv3_pad_length = 40, header_length, variance_blocks, 147. len, max_mac_bytes, num_blocks, ssl/s3_cbc.c:145:5: Assignment 143. void (*md_final_raw) (void *ctx, unsigned char *md_out); 144. void (*md_transform) (void *ctx, const unsigned char *block); 145. size_t md_size, md_block_size = 64; ^ 146. size_t sslv3_pad_length = 40, header_length, variance_blocks, 147. len, max_mac_bytes, num_blocks, ssl/s3_cbc.c:145:5: <RHS trace> 143. void (*md_final_raw) (void *ctx, unsigned char *md_out); 144. void (*md_transform) (void *ctx, const unsigned char *block); 145. size_t md_size, md_block_size = 64; ^ 146. size_t sslv3_pad_length = 40, header_length, variance_blocks, 147. len, max_mac_bytes, num_blocks, ssl/s3_cbc.c:145:5: Assignment 143. void (*md_final_raw) (void *ctx, unsigned char *md_out); 144. void (*md_transform) (void *ctx, const unsigned char *block); 145. size_t md_size, md_block_size = 64; ^ 146. size_t sslv3_pad_length = 40, header_length, variance_blocks, 147. len, max_mac_bytes, num_blocks, ssl/s3_cbc.c:375:13: Binary operation: ([65, +oo] - [64, 128]):unsigned64 by call to `ssl3_cbc_digest_record` 373. return 0; 374. } 375. overhang = header_length - md_block_size; ^ 376. md_transform(md_state.c, header); 377. memcpy(first_block, header + md_block_size, overhang);
https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/ssl/s3_cbc.c/#L375
d2a_code_trace_data_43068
static int decode_header_trees(SmackVContext *smk) { GetBitContext gb; int mmap_size, mclr_size, full_size, type_size; mmap_size = AV_RL32(smk->avctx->extradata); mclr_size = AV_RL32(smk->avctx->extradata + 4); full_size = AV_RL32(smk->avctx->extradata + 8); type_size = AV_RL32(smk->avctx->extradata + 12); init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8); if(!get_bits1(&gb)) { av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n"); smk->mmap_tbl = av_malloc(sizeof(int) * 2); smk->mmap_tbl[0] = 0; smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1; } else { if (smacker_decode_header_tree(smk, &gb, &smk->mmap_tbl, smk->mmap_last, mmap_size)) return -1; } if(!get_bits1(&gb)) { av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n"); smk->mclr_tbl = av_malloc(sizeof(int) * 2); smk->mclr_tbl[0] = 0; smk->mclr_last[0] = smk->mclr_last[1] = smk->mclr_last[2] = 1; } else { if (smacker_decode_header_tree(smk, &gb, &smk->mclr_tbl, smk->mclr_last, mclr_size)) return -1; } if(!get_bits1(&gb)) { av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n"); smk->full_tbl = av_malloc(sizeof(int) * 2); smk->full_tbl[0] = 0; smk->full_last[0] = smk->full_last[1] = smk->full_last[2] = 1; } else { if (smacker_decode_header_tree(smk, &gb, &smk->full_tbl, smk->full_last, full_size)) return -1; } if(!get_bits1(&gb)) { av_log(smk->avctx, AV_LOG_INFO, "Skipping TYPE tree\n"); smk->type_tbl = av_malloc(sizeof(int) * 2); smk->type_tbl[0] = 0; smk->type_last[0] = smk->type_last[1] = smk->type_last[2] = 1; } else { if (smacker_decode_header_tree(smk, &gb, &smk->type_tbl, smk->type_last, type_size)) return -1; } return 0; } libavcodec/smacker.c:317: error: Null Dereference pointer `smk->type_tbl` last assigned on line 316 could be null and is dereferenced at line 317, column 9. libavcodec/smacker.c:276:1: start of procedure decode_header_trees() 274. } 275. 276. static int decode_header_trees(SmackVContext *smk) { ^ 277. GetBitContext gb; 278. int mmap_size, mclr_size, full_size, type_size; libavcodec/smacker.c:280:5: 278. int mmap_size, mclr_size, full_size, type_size; 279. 280. mmap_size = AV_RL32(smk->avctx->extradata); ^ 281. mclr_size = AV_RL32(smk->avctx->extradata + 4); 282. full_size = AV_RL32(smk->avctx->extradata + 8); libavcodec/smacker.c:281:5: 279. 280. mmap_size = AV_RL32(smk->avctx->extradata); 281. mclr_size = AV_RL32(smk->avctx->extradata + 4); ^ 282. full_size = AV_RL32(smk->avctx->extradata + 8); 283. type_size = AV_RL32(smk->avctx->extradata + 12); libavcodec/smacker.c:282:5: 280. mmap_size = AV_RL32(smk->avctx->extradata); 281. mclr_size = AV_RL32(smk->avctx->extradata + 4); 282. full_size = AV_RL32(smk->avctx->extradata + 8); ^ 283. type_size = AV_RL32(smk->avctx->extradata + 12); 284. libavcodec/smacker.c:283:5: 281. mclr_size = AV_RL32(smk->avctx->extradata + 4); 282. full_size = AV_RL32(smk->avctx->extradata + 8); 283. type_size = AV_RL32(smk->avctx->extradata + 12); ^ 284. 285. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8); libavcodec/smacker.c:285:5: 283. type_size = AV_RL32(smk->avctx->extradata + 12); 284. 285. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8); ^ 286. 287. if(!get_bits1(&gb)) { libavcodec/get_bits.h:352:1: start of procedure init_get_bits() 350. * @param bit_size the size of the buffer in bits 351. */ 352. static inline void init_get_bits(GetBitContext *s, const uint8_t *buffer, ^ 353. int bit_size) 354. { libavcodec/get_bits.h:355:5: 353. int bit_size) 354. { 355. int buffer_size = (bit_size+7)>>3; ^ 356. if (buffer_size < 0 || bit_size < 0) { 357. buffer_size = bit_size = 0; libavcodec/get_bits.h:356:9: Taking false branch 354. { 355. int buffer_size = (bit_size+7)>>3; 356. if (buffer_size < 0 || bit_size < 0) { ^ 357. buffer_size = bit_size = 0; 358. buffer = NULL; libavcodec/get_bits.h:356:28: Taking false branch 354. { 355. int buffer_size = (bit_size+7)>>3; 356. if (buffer_size < 0 || bit_size < 0) { ^ 357. buffer_size = bit_size = 0; 358. buffer = NULL; libavcodec/get_bits.h:361:5: 359. } 360. 361. s->buffer = buffer; ^ 362. s->size_in_bits = bit_size; 363. #if !UNCHECKED_BITSTREAM_READER libavcodec/get_bits.h:362:5: 360. 361. s->buffer = buffer; 362. s->size_in_bits = bit_size; ^ 363. #if !UNCHECKED_BITSTREAM_READER 364. s->size_in_bits_plus8 = bit_size + 8; libavcodec/get_bits.h:364:5: 362. s->size_in_bits = bit_size; 363. #if !UNCHECKED_BITSTREAM_READER 364. s->size_in_bits_plus8 = bit_size + 8; ^ 365. #endif 366. s->buffer_end = buffer + buffer_size; libavcodec/get_bits.h:366:5: 364. s->size_in_bits_plus8 = bit_size + 8; 365. #endif 366. s->buffer_end = buffer + buffer_size; ^ 367. s->index = 0; 368. } libavcodec/get_bits.h:367:5: 365. #endif 366. s->buffer_end = buffer + buffer_size; 367. s->index = 0; ^ 368. } 369. libavcodec/get_bits.h:368:1: return from a call to init_get_bits 366. s->buffer_end = buffer + buffer_size; 367. s->index = 0; 368. } ^ 369. 370. static inline void align_get_bits(GetBitContext *s) libavcodec/smacker.c:287:9: 285. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8); 286. 287. if(!get_bits1(&gb)) { ^ 288. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n"); 289. smk->mmap_tbl = av_malloc(sizeof(int) * 2); libavcodec/get_bits.h:268:1: start of procedure get_bits1() 266. } 267. 268. static inline unsigned int get_bits1(GetBitContext *s) ^ 269. { 270. unsigned int index = s->index; libavcodec/get_bits.h:270:5: 268. static inline unsigned int get_bits1(GetBitContext *s) 269. { 270. unsigned int index = s->index; ^ 271. uint8_t result = s->buffer[index>>3]; 272. #ifdef BITSTREAM_READER_LE libavcodec/get_bits.h:271:5: 269. { 270. unsigned int index = s->index; 271. uint8_t result = s->buffer[index>>3]; ^ 272. #ifdef BITSTREAM_READER_LE 273. result >>= index & 7; libavcodec/get_bits.h:273:5: 271. uint8_t result = s->buffer[index>>3]; 272. #ifdef BITSTREAM_READER_LE 273. result >>= index & 7; ^ 274. result &= 1; 275. #else libavcodec/get_bits.h:274:5: 272. #ifdef BITSTREAM_READER_LE 273. result >>= index & 7; 274. result &= 1; ^ 275. #else 276. result <<= index & 7; libavcodec/get_bits.h:280:9: Taking false branch 278. #endif 279. #if !UNCHECKED_BITSTREAM_READER 280. if (s->index < s->size_in_bits_plus8) ^ 281. #endif 282. index++; libavcodec/get_bits.h:283:5: 281. #endif 282. index++; 283. s->index = index; ^ 284. 285. return result; libavcodec/get_bits.h:285:5: 283. s->index = index; 284. 285. return result; ^ 286. } 287. libavcodec/get_bits.h:286:1: return from a call to get_bits1 284. 285. return result; 286. } ^ 287. 288. static inline unsigned int show_bits1(GetBitContext *s) libavcodec/smacker.c:287:9: Taking true branch 285. init_get_bits(&gb, smk->avctx->extradata + 16, (smk->avctx->extradata_size - 16) * 8); 286. 287. if(!get_bits1(&gb)) { ^ 288. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n"); 289. smk->mmap_tbl = av_malloc(sizeof(int) * 2); libavcodec/smacker.c:288:9: Skipping av_log(): empty list of specs 286. 287. if(!get_bits1(&gb)) { 288. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n"); ^ 289. smk->mmap_tbl = av_malloc(sizeof(int) * 2); 290. smk->mmap_tbl[0] = 0; libavcodec/smacker.c:289:9: 287. if(!get_bits1(&gb)) { 288. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n"); 289. smk->mmap_tbl = av_malloc(sizeof(int) * 2); ^ 290. smk->mmap_tbl[0] = 0; 291. smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1; libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:71:5: 69. #endif 70. 71. assert(size); ^ 72. 73. /* let's disallow possible ambiguous cases */ libavutil/mem.c:74:9: Taking false branch 72. 73. /* let's disallow possible ambiguous cases */ 74. if (size > (INT_MAX-32) || !size) ^ 75. return NULL; 76. libavutil/mem.c:74:33: Taking false branch 72. 73. /* let's disallow possible ambiguous cases */ 74. if (size > (INT_MAX-32) || !size) ^ 75. return NULL; 76. libavutil/mem.c:85:9: Taking false branch 83. ((char*)ptr)[-1]= diff; 84. #elif HAVE_POSIX_MEMALIGN 85. if (posix_memalign(&ptr,32,size)) ^ 86. ptr = NULL; 87. #elif HAVE_ALIGNED_MALLOC libavutil/mem.c:118:5: 116. ptr = malloc(size); 117. #endif 118. return ptr; ^ 119. } 120. libavutil/mem.c:119:1: return from a call to av_malloc 117. #endif 118. return ptr; 119. } ^ 120. 121. void *av_realloc(void *ptr, size_t size) libavcodec/smacker.c:290:9: 288. av_log(smk->avctx, AV_LOG_INFO, "Skipping MMAP tree\n"); 289. smk->mmap_tbl = av_malloc(sizeof(int) * 2); 290. smk->mmap_tbl[0] = 0; ^ 291. smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1; 292. } else { libavcodec/smacker.c:291:9: 289. smk->mmap_tbl = av_malloc(sizeof(int) * 2); 290. smk->mmap_tbl[0] = 0; 291. smk->mmap_last[0] = smk->mmap_last[1] = smk->mmap_last[2] = 1; ^ 292. } else { 293. if (smacker_decode_header_tree(smk, &gb, &smk->mmap_tbl, smk->mmap_last, mmap_size)) libavcodec/smacker.c:296:9: 294. return -1; 295. } 296. if(!get_bits1(&gb)) { ^ 297. av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n"); 298. smk->mclr_tbl = av_malloc(sizeof(int) * 2); libavcodec/get_bits.h:268:1: start of procedure get_bits1() 266. } 267. 268. static inline unsigned int get_bits1(GetBitContext *s) ^ 269. { 270. unsigned int index = s->index; libavcodec/get_bits.h:270:5: 268. static inline unsigned int get_bits1(GetBitContext *s) 269. { 270. unsigned int index = s->index; ^ 271. uint8_t result = s->buffer[index>>3]; 272. #ifdef BITSTREAM_READER_LE libavcodec/get_bits.h:271:5: 269. { 270. unsigned int index = s->index; 271. uint8_t result = s->buffer[index>>3]; ^ 272. #ifdef BITSTREAM_READER_LE 273. result >>= index & 7; libavcodec/get_bits.h:273:5: 271. uint8_t result = s->buffer[index>>3]; 272. #ifdef BITSTREAM_READER_LE 273. result >>= index & 7; ^ 274. result &= 1; 275. #else libavcodec/get_bits.h:274:5: 272. #ifdef BITSTREAM_READER_LE 273. result >>= index & 7; 274. result &= 1; ^ 275. #else 276. result <<= index & 7; libavcodec/get_bits.h:280:9: Taking false branch 278. #endif 279. #if !UNCHECKED_BITSTREAM_READER 280. if (s->index < s->size_in_bits_plus8) ^ 281. #endif 282. index++; libavcodec/get_bits.h:283:5: 281. #endif 282. index++; 283. s->index = index; ^ 284. 285. return result; libavcodec/get_bits.h:285:5: 283. s->index = index; 284. 285. return result; ^ 286. } 287. libavcodec/get_bits.h:286:1: return from a call to get_bits1 284. 285. return result; 286. } ^ 287. 288. static inline unsigned int show_bits1(GetBitContext *s) libavcodec/smacker.c:296:9: Taking true branch 294. return -1; 295. } 296. if(!get_bits1(&gb)) { ^ 297. av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n"); 298. smk->mclr_tbl = av_malloc(sizeof(int) * 2); libavcodec/smacker.c:297:9: Skipping av_log(): empty list of specs 295. } 296. if(!get_bits1(&gb)) { 297. av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n"); ^ 298. smk->mclr_tbl = av_malloc(sizeof(int) * 2); 299. smk->mclr_tbl[0] = 0; libavcodec/smacker.c:298:9: 296. if(!get_bits1(&gb)) { 297. av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n"); 298. smk->mclr_tbl = av_malloc(sizeof(int) * 2); ^ 299. smk->mclr_tbl[0] = 0; 300. smk->mclr_last[0] = smk->mclr_last[1] = smk->mclr_last[2] = 1; libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:71:5: 69. #endif 70. 71. assert(size); ^ 72. 73. /* let's disallow possible ambiguous cases */ libavutil/mem.c:74:9: Taking false branch 72. 73. /* let's disallow possible ambiguous cases */ 74. if (size > (INT_MAX-32) || !size) ^ 75. return NULL; 76. libavutil/mem.c:74:33: Taking false branch 72. 73. /* let's disallow possible ambiguous cases */ 74. if (size > (INT_MAX-32) || !size) ^ 75. return NULL; 76. libavutil/mem.c:85:9: Taking false branch 83. ((char*)ptr)[-1]= diff; 84. #elif HAVE_POSIX_MEMALIGN 85. if (posix_memalign(&ptr,32,size)) ^ 86. ptr = NULL; 87. #elif HAVE_ALIGNED_MALLOC libavutil/mem.c:118:5: 116. ptr = malloc(size); 117. #endif 118. return ptr; ^ 119. } 120. libavutil/mem.c:119:1: return from a call to av_malloc 117. #endif 118. return ptr; 119. } ^ 120. 121. void *av_realloc(void *ptr, size_t size) libavcodec/smacker.c:299:9: 297. av_log(smk->avctx, AV_LOG_INFO, "Skipping MCLR tree\n"); 298. smk->mclr_tbl = av_malloc(sizeof(int) * 2); 299. smk->mclr_tbl[0] = 0; ^ 300. smk->mclr_last[0] = smk->mclr_last[1] = smk->mclr_last[2] = 1; 301. } else { libavcodec/smacker.c:300:9: 298. smk->mclr_tbl = av_malloc(sizeof(int) * 2); 299. smk->mclr_tbl[0] = 0; 300. smk->mclr_last[0] = smk->mclr_last[1] = smk->mclr_last[2] = 1; ^ 301. } else { 302. if (smacker_decode_header_tree(smk, &gb, &smk->mclr_tbl, smk->mclr_last, mclr_size)) libavcodec/smacker.c:305:9: 303. return -1; 304. } 305. if(!get_bits1(&gb)) { ^ 306. av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n"); 307. smk->full_tbl = av_malloc(sizeof(int) * 2); libavcodec/get_bits.h:268:1: start of procedure get_bits1() 266. } 267. 268. static inline unsigned int get_bits1(GetBitContext *s) ^ 269. { 270. unsigned int index = s->index; libavcodec/get_bits.h:270:5: 268. static inline unsigned int get_bits1(GetBitContext *s) 269. { 270. unsigned int index = s->index; ^ 271. uint8_t result = s->buffer[index>>3]; 272. #ifdef BITSTREAM_READER_LE libavcodec/get_bits.h:271:5: 269. { 270. unsigned int index = s->index; 271. uint8_t result = s->buffer[index>>3]; ^ 272. #ifdef BITSTREAM_READER_LE 273. result >>= index & 7; libavcodec/get_bits.h:273:5: 271. uint8_t result = s->buffer[index>>3]; 272. #ifdef BITSTREAM_READER_LE 273. result >>= index & 7; ^ 274. result &= 1; 275. #else libavcodec/get_bits.h:274:5: 272. #ifdef BITSTREAM_READER_LE 273. result >>= index & 7; 274. result &= 1; ^ 275. #else 276. result <<= index & 7; libavcodec/get_bits.h:280:9: Taking false branch 278. #endif 279. #if !UNCHECKED_BITSTREAM_READER 280. if (s->index < s->size_in_bits_plus8) ^ 281. #endif 282. index++; libavcodec/get_bits.h:283:5: 281. #endif 282. index++; 283. s->index = index; ^ 284. 285. return result; libavcodec/get_bits.h:285:5: 283. s->index = index; 284. 285. return result; ^ 286. } 287. libavcodec/get_bits.h:286:1: return from a call to get_bits1 284. 285. return result; 286. } ^ 287. 288. static inline unsigned int show_bits1(GetBitContext *s) libavcodec/smacker.c:305:9: Taking true branch 303. return -1; 304. } 305. if(!get_bits1(&gb)) { ^ 306. av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n"); 307. smk->full_tbl = av_malloc(sizeof(int) * 2); libavcodec/smacker.c:306:9: Skipping av_log(): empty list of specs 304. } 305. if(!get_bits1(&gb)) { 306. av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n"); ^ 307. smk->full_tbl = av_malloc(sizeof(int) * 2); 308. smk->full_tbl[0] = 0; libavcodec/smacker.c:307:9: 305. if(!get_bits1(&gb)) { 306. av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n"); 307. smk->full_tbl = av_malloc(sizeof(int) * 2); ^ 308. smk->full_tbl[0] = 0; 309. smk->full_last[0] = smk->full_last[1] = smk->full_last[2] = 1; libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:71:5: 69. #endif 70. 71. assert(size); ^ 72. 73. /* let's disallow possible ambiguous cases */ libavutil/mem.c:74:9: Taking false branch 72. 73. /* let's disallow possible ambiguous cases */ 74. if (size > (INT_MAX-32) || !size) ^ 75. return NULL; 76. libavutil/mem.c:74:33: Taking false branch 72. 73. /* let's disallow possible ambiguous cases */ 74. if (size > (INT_MAX-32) || !size) ^ 75. return NULL; 76. libavutil/mem.c:85:9: Taking false branch 83. ((char*)ptr)[-1]= diff; 84. #elif HAVE_POSIX_MEMALIGN 85. if (posix_memalign(&ptr,32,size)) ^ 86. ptr = NULL; 87. #elif HAVE_ALIGNED_MALLOC libavutil/mem.c:118:5: 116. ptr = malloc(size); 117. #endif 118. return ptr; ^ 119. } 120. libavutil/mem.c:119:1: return from a call to av_malloc 117. #endif 118. return ptr; 119. } ^ 120. 121. void *av_realloc(void *ptr, size_t size) libavcodec/smacker.c:308:9: 306. av_log(smk->avctx, AV_LOG_INFO, "Skipping FULL tree\n"); 307. smk->full_tbl = av_malloc(sizeof(int) * 2); 308. smk->full_tbl[0] = 0; ^ 309. smk->full_last[0] = smk->full_last[1] = smk->full_last[2] = 1; 310. } else { libavcodec/smacker.c:309:9: 307. smk->full_tbl = av_malloc(sizeof(int) * 2); 308. smk->full_tbl[0] = 0; 309. smk->full_last[0] = smk->full_last[1] = smk->full_last[2] = 1; ^ 310. } else { 311. if (smacker_decode_header_tree(smk, &gb, &smk->full_tbl, smk->full_last, full_size)) libavcodec/smacker.c:314:9: 312. return -1; 313. } 314. if(!get_bits1(&gb)) { ^ 315. av_log(smk->avctx, AV_LOG_INFO, "Skipping TYPE tree\n"); 316. smk->type_tbl = av_malloc(sizeof(int) * 2); libavcodec/get_bits.h:268:1: start of procedure get_bits1() 266. } 267. 268. static inline unsigned int get_bits1(GetBitContext *s) ^ 269. { 270. unsigned int index = s->index; libavcodec/get_bits.h:270:5: 268. static inline unsigned int get_bits1(GetBitContext *s) 269. { 270. unsigned int index = s->index; ^ 271. uint8_t result = s->buffer[index>>3]; 272. #ifdef BITSTREAM_READER_LE libavcodec/get_bits.h:271:5: 269. { 270. unsigned int index = s->index; 271. uint8_t result = s->buffer[index>>3]; ^ 272. #ifdef BITSTREAM_READER_LE 273. result >>= index & 7; libavcodec/get_bits.h:273:5: 271. uint8_t result = s->buffer[index>>3]; 272. #ifdef BITSTREAM_READER_LE 273. result >>= index & 7; ^ 274. result &= 1; 275. #else libavcodec/get_bits.h:274:5: 272. #ifdef BITSTREAM_READER_LE 273. result >>= index & 7; 274. result &= 1; ^ 275. #else 276. result <<= index & 7; libavcodec/get_bits.h:280:9: Taking false branch 278. #endif 279. #if !UNCHECKED_BITSTREAM_READER 280. if (s->index < s->size_in_bits_plus8) ^ 281. #endif 282. index++; libavcodec/get_bits.h:283:5: 281. #endif 282. index++; 283. s->index = index; ^ 284. 285. return result; libavcodec/get_bits.h:285:5: 283. s->index = index; 284. 285. return result; ^ 286. } 287. libavcodec/get_bits.h:286:1: return from a call to get_bits1 284. 285. return result; 286. } ^ 287. 288. static inline unsigned int show_bits1(GetBitContext *s) libavcodec/smacker.c:314:9: Taking true branch 312. return -1; 313. } 314. if(!get_bits1(&gb)) { ^ 315. av_log(smk->avctx, AV_LOG_INFO, "Skipping TYPE tree\n"); 316. smk->type_tbl = av_malloc(sizeof(int) * 2); libavcodec/smacker.c:315:9: Skipping av_log(): empty list of specs 313. } 314. if(!get_bits1(&gb)) { 315. av_log(smk->avctx, AV_LOG_INFO, "Skipping TYPE tree\n"); ^ 316. smk->type_tbl = av_malloc(sizeof(int) * 2); 317. smk->type_tbl[0] = 0; libavcodec/smacker.c:316:9: 314. if(!get_bits1(&gb)) { 315. av_log(smk->avctx, AV_LOG_INFO, "Skipping TYPE tree\n"); 316. smk->type_tbl = av_malloc(sizeof(int) * 2); ^ 317. smk->type_tbl[0] = 0; 318. smk->type_last[0] = smk->type_last[1] = smk->type_last[2] = 1; libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:71:5: 69. #endif 70. 71. assert(size); ^ 72. 73. /* let's disallow possible ambiguous cases */ libavutil/mem.c:74:9: Taking false branch 72. 73. /* let's disallow possible ambiguous cases */ 74. if (size > (INT_MAX-32) || !size) ^ 75. return NULL; 76. libavutil/mem.c:74:33: Taking false branch 72. 73. /* let's disallow possible ambiguous cases */ 74. if (size > (INT_MAX-32) || !size) ^ 75. return NULL; 76. libavutil/mem.c:85:9: Taking true branch 83. ((char*)ptr)[-1]= diff; 84. #elif HAVE_POSIX_MEMALIGN 85. if (posix_memalign(&ptr,32,size)) ^ 86. ptr = NULL; 87. #elif HAVE_ALIGNED_MALLOC libavutil/mem.c:86:9: 84. #elif HAVE_POSIX_MEMALIGN 85. if (posix_memalign(&ptr,32,size)) 86. ptr = NULL; ^ 87. #elif HAVE_ALIGNED_MALLOC 88. ptr = _aligned_malloc(size, 32); libavutil/mem.c:118:5: 116. ptr = malloc(size); 117. #endif 118. return ptr; ^ 119. } 120. libavutil/mem.c:119:1: return from a call to av_malloc 117. #endif 118. return ptr; 119. } ^ 120. 121. void *av_realloc(void *ptr, size_t size) libavcodec/smacker.c:317:9: 315. av_log(smk->avctx, AV_LOG_INFO, "Skipping TYPE tree\n"); 316. smk->type_tbl = av_malloc(sizeof(int) * 2); 317. smk->type_tbl[0] = 0; ^ 318. smk->type_last[0] = smk->type_last[1] = smk->type_last[2] = 1; 319. } else {
https://github.com/libav/libav/blob/33bb63cb3e1de6d78c475cf14384089ef3f1867d/libavcodec/smacker.c/#L317
d2a_code_trace_data_43069
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) { bn_check_top(b); if (a == b) return a; if (bn_wexpand(a, b->top) == NULL) return NULL; if (b->top > 0) memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); a->top = b->top; a->neg = b->neg; bn_check_top(a); return a; } crypto/bn/bn_prime.c:227: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `witness`. Showing all 30 steps of the trace crypto/bn/bn_prime.c:153:1: Parameter `a->top` 151. } 152. 153. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 154. int do_trial_division, BN_GENCB *cb) 155. { crypto/bn/bn_prime.c:162:9: Call 160. BN_MONT_CTX *mont = NULL; 161. 162. if (BN_cmp(a, BN_value_one()) <= 0) ^ 163. return 0; 164. crypto/bn/bn_lib.c:577:1: Parameter `a->top` 575. } 576. 577. > int BN_cmp(const BIGNUM *a, const BIGNUM *b) 578. { 579. int i; crypto/bn/bn_prime.c:169:10: Call 167. 168. /* first look for small factors */ 169. if (!BN_is_odd(a)) ^ 170. /* a is even => a is prime if and only if a == 2 */ 171. return BN_is_word(a, 2); crypto/bn/bn_lib.c:867:1: Parameter `a->top` 865. } 866. 867. > int BN_is_odd(const BIGNUM *a) 868. { 869. return (a->top > 0) && (a->d[0] & 1); 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 `b->top` 321. } 322. 323. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 324. { 325. bn_check_top(b); crypto/bn/bn_prime.c:217:10: Call 215. if (mont == NULL) 216. goto err; 217. if (!BN_MONT_CTX_set(mont, a, ctx)) ^ 218. goto err; 219. crypto/bn/bn_mont.c:252:9: Call 250. BIGNUM *Ri, *R; 251. 252. if (BN_is_zero(mod)) ^ 253. return 0; 254. crypto/bn/bn_lib.c:852:1: Parameter `a->top` 850. } 851. 852. > int BN_is_zero(const BIGNUM *a) 853. { 854. return a->top == 0; crypto/bn/bn_prime.c:227:13: Call 225. /* now 1 <= check < a */ 226. 227. j = witness(check, a, A1, A1_odd, k, ctx, mont); ^ 228. if (j == -1) 229. goto err; crypto/bn/bn_prime.c:249:1: Parameter `a->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 `m->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 `m->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:615:10: Call 613. bn_check_top(m); 614. 615. if (!BN_is_odd(m)) { ^ 616. BNerr(BN_F_BN_MOD_EXP_MONT_CONSTTIME, BN_R_CALLED_WITH_EVEN_MODULUS); 617. return (0); crypto/bn/bn_lib.c:867:1: Parameter `a->top` 865. } 866. 867. > int BN_is_odd(const BIGNUM *a) 868. { 869. return (a->top > 0) && (a->d[0] & 1); 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 `mod->top` 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:252:9: Call 250. BIGNUM *Ri, *R; 251. 252. if (BN_is_zero(mod)) ^ 253. return 0; 254. crypto/bn/bn_lib.c:852:1: Parameter `a->top` 850. } 851. 852. > int BN_is_zero(const BIGNUM *a) 853. { 854. return a->top == 0; crypto/bn/bn_mont.c:259:10: Call 257. goto err; 258. R = &(mont->RR); /* grab RR as a temp */ 259. if (!BN_copy(&(mont->N), mod)) ^ 260. goto err; /* Set N */ 261. mont->N.neg = 0; 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 `witness` 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/757264207ad8650a89ea903d48ad89f61d56ea9c/crypto/bn/bn_lib.c/#L333
d2a_code_trace_data_43070
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } crypto/bn/bn_recp.c:132: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_rshift`. Showing all 23 steps of the trace crypto/bn/bn_recp.c:91:29: Call 89. 90. BN_CTX_start(ctx); 91. d = (dv != NULL) ? dv : BN_CTX_get(ctx); ^ 92. r = (rem != NULL) ? rem : BN_CTX_get(ctx); 93. a = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:219:5: Call 217. } 218. /* OK, make sure the returned bignum is "zero" */ 219. BN_zero(ret); ^ 220. /* clear BN_FLG_CONSTTIME if leaked from previous frames */ 221. ret->flags &= (~BN_FLG_CONSTTIME); crypto/bn/bn_lib.c:366:15: Assignment 364. a->neg = 0; 365. a->d[0] = w; 366. a->top = (w ? 1 : 0); ^ 367. a->flags &= ~BN_FLG_FIXED_TOP; 368. bn_check_top(a); crypto/bn/bn_lib.c:366:5: Assignment 364. a->neg = 0; 365. a->d[0] = w; 366. a->top = (w ? 1 : 0); ^ 367. a->flags &= ~BN_FLG_FIXED_TOP; 368. bn_check_top(a); crypto/bn/bn_recp.c:132:10: Call 130. * = |m/N| 131. */ 132. if (!BN_rshift(a, m, recp->num_bits)) ^ 133. goto err; 134. if (!BN_mul(b, a, &(recp->Nr), ctx)) crypto/bn/bn_shift.c:153:1: Parameter `r->top` 151. } 152. 153. > int BN_rshift(BIGNUM *r, const BIGNUM *a, int n) 154. { 155. int i, j, nw, lb, rb; crypto/bn/bn_shift.c:176:13: Call 174. i = (BN_num_bits(a) - n + (BN_BITS2 - 1)) / BN_BITS2; 175. if (r != a) { 176. if (bn_wexpand(r, i) == NULL) ^ 177. return 0; 178. r->neg = a->neg; crypto/bn/bn_lib.c:960:1: Parameter `a->top` 958. } 959. 960. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 961. { 962. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:962:37: Call 960. BIGNUM *bn_wexpand(BIGNUM *a, int words) 961. { 962. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 963. } 964. crypto/bn/bn_lib.c:245:1: Parameter `b->top` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `words` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:224:13: Call 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/mem.c:228:1: Parameter `num` 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:17: Call 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/mem.c:230:5: Assignment 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:235:5: Assignment 233. if (ret != NULL) 234. memset(ret, 0, num); 235. return ret; ^ 236. } 237. crypto/bn/bn_lib.c:224:9: Assignment 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_rshift` 230. assert(b->top <= words); 231. if (b->top > 0) 232. memcpy(a, b->d, sizeof(*a) * b->top); ^ 233. 234. return a;
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_43071
int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, size_t len, size_t *written) { int i; SSL3_BUFFER *wb = s->rlayer.wbuf; size_t currbuf = 0; size_t tmpwrit = 0; if ((s->rlayer.wpend_tot > len) || ((s->rlayer.wpend_buf != buf) && !(s->mode & SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER)) || (s->rlayer.wpend_type != type)) { SSLerr(SSL_F_SSL3_WRITE_PENDING, SSL_R_BAD_WRITE_RETRY); return -1; } for (;;) { if (SSL3_BUFFER_get_left(&wb[currbuf]) == 0 && currbuf < s->rlayer.numwpipes - 1) { currbuf++; continue; } clear_sys_error(); if (s->wbio != NULL) { s->rwstate = SSL_WRITING; i = BIO_write(s->wbio, (char *) &(SSL3_BUFFER_get_buf(&wb[currbuf]) [SSL3_BUFFER_get_offset(&wb[currbuf])]), (unsigned int)SSL3_BUFFER_get_left(&wb[currbuf])); if (i >= 0) tmpwrit = i; } else { SSLerr(SSL_F_SSL3_WRITE_PENDING, SSL_R_BIO_NOT_SET); i = -1; } if (i > 0 && tmpwrit == SSL3_BUFFER_get_left(&wb[currbuf])) { SSL3_BUFFER_set_left(&wb[currbuf], 0); SSL3_BUFFER_add_offset(&wb[currbuf], tmpwrit); if (currbuf + 1 < s->rlayer.numwpipes) continue; s->rwstate = SSL_NOTHING; *written = s->rlayer.wpend_ret; return 1; } else if (i <= 0) { if (SSL_IS_DTLS(s)) { SSL3_BUFFER_set_left(&wb[currbuf], 0); } return -1; } SSL3_BUFFER_add_offset(&wb[currbuf], tmpwrit); SSL3_BUFFER_sub_left(&wb[currbuf], tmpwrit); } } ssl/statem/statem.c:789: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `statem_do_write`. Showing all 11 steps of the trace ssl/statem/statem.c:704:1: Parameter `s->rlayer.numwpipes` 702. * result in an NBIO event. 703. */ 704. > static SUB_STATE_RETURN write_state_machine(SSL *s) 705. { 706. OSSL_STATEM *st = &s->statem; ssl/statem/statem.c:789:19: Call 787. dtls1_start_timer(s); 788. } 789. ret = statem_do_write(s); ^ 790. if (ret <= 0) { 791. return SUB_STATE_ERROR; ssl/statem/statem.c:648:1: Parameter `s->rlayer.numwpipes` 646. * Send a previously constructed message to the peer. 647. */ 648. > static int statem_do_write(SSL *s) 649. { 650. OSSL_STATEM *st = &s->statem; ssl/statem/statem.c:657:20: Call 655. return dtls1_do_write(s, SSL3_RT_CHANGE_CIPHER_SPEC); 656. else 657. return ssl3_do_write(s, SSL3_RT_CHANGE_CIPHER_SPEC); ^ 658. } else { 659. return ssl_do_write(s); ssl/statem/statem_lib.c:30:1: Parameter `s->rlayer.numwpipes` 28. * SSL3_RT_CHANGE_CIPHER_SPEC) 29. */ 30. > int ssl3_do_write(SSL *s, int type) 31. { 32. int ret; ssl/statem/statem_lib.c:35:11: Call 33. size_t written = 0; 34. 35. ret = ssl3_write_bytes(s, type, &s->init_buf->data[s->init_off], ^ 36. s->init_num, &written); 37. if (ret < 0) ssl/record/rec_layer_s3.c:349:1: Parameter `s->rlayer.numwpipes` 347. * not all data has been sent or non-blocking IO. 348. */ 349. > int ssl3_write_bytes(SSL *s, int type, const void *buf_, size_t len, 350. size_t *written) 351. { ssl/record/rec_layer_s3.c:395:13: Call 393. */ 394. if (wb->left != 0) { 395. i = ssl3_write_pending(s, type, &buf[tot], s->rlayer.wpend_tot, ^ 396. &tmpwrit); 397. if (i <= 0) { ssl/record/rec_layer_s3.c:905:1: <LHS trace> 903. * <0 Failure (may be retryable) 904. */ 905. > int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, size_t len, 906. size_t *written) 907. { ssl/record/rec_layer_s3.c:905:1: Parameter `s->rlayer.numwpipes` 903. * <0 Failure (may be retryable) 904. */ 905. > int ssl3_write_pending(SSL *s, int type, const unsigned char *buf, size_t len, 906. size_t *written) 907. { ssl/record/rec_layer_s3.c:924:16: Binary operation: ([0, +oo] - 1):unsigned64 by call to `statem_do_write` 922. /* Loop until we find a buffer we haven't written out yet */ 923. if (SSL3_BUFFER_get_left(&wb[currbuf]) == 0 924. && currbuf < s->rlayer.numwpipes - 1) { ^ 925. currbuf++; 926. continue;
https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/ssl/record/rec_layer_s3.c/#L924
d2a_code_trace_data_43072
static int config_props(AVFilterLink *link) { UnsharpContext *unsharp = link->dst->priv; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format); unsharp->hsub = desc->log2_chroma_w; unsharp->vsub = desc->log2_chroma_h; init_filter_param(link->dst, &unsharp->luma, "luma", link->w); init_filter_param(link->dst, &unsharp->chroma, "chroma", AV_CEIL_RSHIFT(link->w, unsharp->hsub)); return 0; } libavfilter/vf_unsharp.c:178: error: Null Dereference pointer `desc` last assigned on line 176 could be null and is dereferenced at line 178, column 21. libavfilter/vf_unsharp.c:173:1: start of procedure config_props() 171. } 172. 173. static int config_props(AVFilterLink *link) ^ 174. { 175. UnsharpContext *unsharp = link->dst->priv; libavfilter/vf_unsharp.c:175:5: 173. static int config_props(AVFilterLink *link) 174. { 175. UnsharpContext *unsharp = link->dst->priv; ^ 176. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format); 177. libavfilter/vf_unsharp.c:176:5: 174. { 175. UnsharpContext *unsharp = link->dst->priv; 176. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format); ^ 177. 178. unsharp->hsub = desc->log2_chroma_w; libavutil/pixdesc.c:1685:1: start of procedure av_pix_fmt_desc_get() 1683. } 1684. 1685. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) ^ 1686. { 1687. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) libavutil/pixdesc.c:1687:9: Taking false branch 1685. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1686. { 1687. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1688. return NULL; 1689. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1687:24: Taking true branch 1685. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1686. { 1687. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1688. return NULL; 1689. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1688:9: 1686. { 1687. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) 1688. return NULL; ^ 1689. return &av_pix_fmt_descriptors[pix_fmt]; 1690. } libavutil/pixdesc.c:1690:1: return from a call to av_pix_fmt_desc_get 1688. return NULL; 1689. return &av_pix_fmt_descriptors[pix_fmt]; 1690. } ^ 1691. 1692. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) libavfilter/vf_unsharp.c:178:5: 176. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(link->format); 177. 178. unsharp->hsub = desc->log2_chroma_w; ^ 179. unsharp->vsub = desc->log2_chroma_h; 180.
https://github.com/libav/libav/blob/bf50607ab76157ba251a01f5baa5cf67b23b2ee9/libavfilter/vf_unsharp.c/#L178
d2a_code_trace_data_43073
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) { int line_size; int sample_size = av_get_bytes_per_sample(sample_fmt); int planar = av_sample_fmt_is_planar(sample_fmt); if (!sample_size || nb_samples <= 0 || nb_channels <= 0) return AVERROR(EINVAL); if (!align) { if (nb_samples > INT_MAX - 31) return AVERROR(EINVAL); align = 1; nb_samples = FFALIGN(nb_samples, 32); } if (nb_channels > INT_MAX / align || (int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size) return AVERROR(EINVAL); line_size = planar ? FFALIGN(nb_samples * sample_size, align) : FFALIGN(nb_samples * sample_size * nb_channels, align); if (linesize) *linesize = line_size; return planar ? line_size * nb_channels : line_size; } libavcodec/mpegvideo.c:1680: error: Integer Overflow L2 ([1, 2147483616] + 32):signed32 by call to `ff_alloc_picture`. libavcodec/mpegvideo.c:1680:9: Call 1678. pic->f.coded_picture_number = s->coded_picture_number++; 1679. 1680. if (ff_alloc_picture(s, pic, 0) < 0) ^ 1681. return -1; 1682. libavcodec/mpegvideo.c:587:1: Parameter `pic->f.nb_samples` 585. * The pixels are allocated/set by calling get_buffer() if shared = 0 586. */ 587. int ff_alloc_picture(MpegEncContext *s, Picture *pic, int shared) ^ 588. { 589. int i, ret; libavcodec/mpegvideo.c:597:13: Call 595. assert(!pic->f.buf[0]); 596. 597. if (alloc_frame_buffer(s, pic) < 0) ^ 598. return -1; 599. libavcodec/mpegvideo.c:424:1: Parameter `pic->f.nb_samples` 422. * Allocate a frame buffer 423. */ 424. static int alloc_frame_buffer(MpegEncContext *s, Picture *pic) ^ 425. { 426. int edges_needed = av_codec_is_encoder(s->avctx->codec); libavcodec/mpegvideo.c:444:13: Call 442. pic->f.height = s->avctx->height; 443. pic->f.format = s->avctx->pix_fmt; 444. r = avcodec_default_get_buffer2(s->avctx, &pic->f, 0); ^ 445. } 446. libavcodec/utils.c:524:1: Parameter `frame->nb_samples` 522. } 523. 524. int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags) ^ 525. { 526. int ret; libavcodec/utils.c:528:16: Call 526. int ret; 527. 528. if ((ret = update_frame_pool(avctx, frame)) < 0) ^ 529. return ret; 530. libavcodec/utils.c:327:1: Parameter `frame->nb_samples` 325. } 326. 327. static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame) ^ 328. { 329. FramePool *pool = avctx->internal->pool; libavcodec/utils.c:399:15: Call 397. 398. av_buffer_pool_uninit(&pool->pools[0]); 399. ret = av_samples_get_buffer_size(&pool->linesize[0], ch, ^ 400. frame->nb_samples, frame->format, 0); 401. if (ret < 0) libavutil/samplefmt.c:108:1: <LHS trace> 106. } 107. 108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, ^ 109. enum AVSampleFormat sample_fmt, int align) 110. { libavutil/samplefmt.c:108:1: Parameter `nb_samples` 106. } 107. 108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, ^ 109. enum AVSampleFormat sample_fmt, int align) 110. { libavutil/samplefmt.c:124:9: Binary operation: ([1, 2147483616] + 32):signed32 by call to `ff_alloc_picture` 122. return AVERROR(EINVAL); 123. align = 1; 124. nb_samples = FFALIGN(nb_samples, 32); ^ 125. } 126.
https://github.com/libav/libav/blob/0e830094ad0dc251613a0aa3234d9c5c397e02e6/libavutil/samplefmt.c/#L124
d2a_code_trace_data_43074
static int opt_streamid(const char *opt, const char *arg) { int idx; char *p; char idx_str[16]; av_strlcpy(idx_str, arg, sizeof(idx_str)); p = strchr(idx_str, ':'); if (!p) { fprintf(stderr, "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", arg, opt); ffmpeg_exit(1); } *p++ = '\0'; idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX); streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1); streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); return 0; } ffmpeg.c:3723: error: Null Dereference pointer `p` last assigned on line 3723 could be null and is dereferenced at line 3723, column 5. ffmpeg.c:3709:1: start of procedure opt_streamid() 3707. 3708. /* arg format is "output-stream-index:streamid-value". */ 3709. static int opt_streamid(const char *opt, const char *arg) ^ 3710. { 3711. int idx; ffmpeg.c:3715:5: 3713. char idx_str[16]; 3714. 3715. av_strlcpy(idx_str, arg, sizeof(idx_str)); ^ 3716. p = strchr(idx_str, ':'); 3717. if (!p) { libavutil/avstring.c:64:1: start of procedure av_strlcpy() 62. } 63. 64. size_t av_strlcpy(char *dst, const char *src, size_t size) ^ 65. { 66. size_t len = 0; libavutil/avstring.c:66:5: 64. size_t av_strlcpy(char *dst, const char *src, size_t size) 65. { 66. size_t len = 0; ^ 67. while (++len < size && *src) 68. *dst++ = *src++; libavutil/avstring.c:67:12: Loop condition is true. Entering loop body 65. { 66. size_t len = 0; 67. while (++len < size && *src) ^ 68. *dst++ = *src++; 69. if (len <= size) libavutil/avstring.c:67:28: Loop condition is false. Leaving loop 65. { 66. size_t len = 0; 67. while (++len < size && *src) ^ 68. *dst++ = *src++; 69. if (len <= size) libavutil/avstring.c:69:9: Taking true branch 67. while (++len < size && *src) 68. *dst++ = *src++; 69. if (len <= size) ^ 70. *dst = 0; 71. return len + strlen(src) - 1; libavutil/avstring.c:70:9: 68. *dst++ = *src++; 69. if (len <= size) 70. *dst = 0; ^ 71. return len + strlen(src) - 1; 72. } libavutil/avstring.c:71:5: 69. if (len <= size) 70. *dst = 0; 71. return len + strlen(src) - 1; ^ 72. } 73. libavutil/avstring.c:72:1: return from a call to av_strlcpy 70. *dst = 0; 71. return len + strlen(src) - 1; 72. } ^ 73. 74. size_t av_strlcat(char *dst, const char *src, size_t size) ffmpeg.c:3716:5: 3714. 3715. av_strlcpy(idx_str, arg, sizeof(idx_str)); 3716. p = strchr(idx_str, ':'); ^ 3717. if (!p) { 3718. fprintf(stderr, ffmpeg.c:3717:10: Taking true branch 3715. av_strlcpy(idx_str, arg, sizeof(idx_str)); 3716. p = strchr(idx_str, ':'); 3717. if (!p) { ^ 3718. fprintf(stderr, 3719. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", ffmpeg.c:3718:9: 3716. p = strchr(idx_str, ':'); 3717. if (!p) { 3718. fprintf(stderr, ^ 3719. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", 3720. arg, opt); ffmpeg.c:3721:9: Skipping ffmpeg_exit(): empty list of specs 3719. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", 3720. arg, opt); 3721. ffmpeg_exit(1); ^ 3722. } 3723. *p++ = '\0'; ffmpeg.c:3723:5: 3721. ffmpeg_exit(1); 3722. } 3723. *p++ = '\0'; ^ 3724. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX); 3725. streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1);
https://github.com/libav/libav/blob/eb97dbb05a990266b04830ea8e179e0428656b98/ffmpeg.c/#L3723
d2a_code_trace_data_43075
static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, OPENSSL_LH_DOALL_FUNC func, OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) { int i; OPENSSL_LH_NODE *a, *n; if (lh == NULL) return; for (i = lh->num_nodes - 1; i >= 0; i--) { a = lh->b[i]; while (a != NULL) { n = a->next; if (use_arg) func_arg(a->data, arg); else func(a->data); a = n; } } } test/servername_test.c:215: error: INTEGER_OVERFLOW_L2 ([0, 8] - 1):unsigned32 by call to `SSL_free`. Showing all 18 steps of the trace test/servername_test.c:186:11: Call 184. 185. /* use TLS_server_method to choose 'server-side' */ 186. ctx = SSL_CTX_new(TLS_server_method()); ^ 187. if (!TEST_ptr(ctx)) 188. goto end; ssl/ssl_lib.c:2765:21: Call 2763. goto err; 2764. 2765. ret->sessions = lh_SSL_SESSION_new(ssl_session_hash, ssl_session_cmp); ^ 2766. if (ret->sessions == NULL) 2767. goto err; ssl/ssl_locl.h:702:1: Call 700. } TLSEXT_INDEX; 701. 702. > DEFINE_LHASH_OF(SSL_SESSION); 703. /* Needed in ssl_cert.c */ 704. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:39:5: Assignment 37. ret->comp = ((c == NULL) ? (OPENSSL_LH_COMPFUNC)strcmp : c); 38. ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h); 39. ret->num_nodes = MIN_NODES / 2; ^ 40. ret->num_alloc_nodes = MIN_NODES; 41. ret->pmax = MIN_NODES / 2; test/servername_test.c:215:5: Call 213. ret = 1; 214. end: 215. SSL_free(con); ^ 216. SSL_CTX_free(ctx); 217. return ret; ssl/ssl_lib.c:1051:1: Parameter `s->ctx->sessions->num_nodes` 1049. } 1050. 1051. > void SSL_free(SSL *s) 1052. { 1053. int i; ssl/ssl_lib.c:1120:5: Call 1118. RECORD_LAYER_release(&s->rlayer); 1119. 1120. SSL_CTX_free(s->ctx); ^ 1121. 1122. ASYNC_WAIT_CTX_free(s->waitctx); ssl/ssl_lib.c:2882:1: Parameter `a->sessions->num_nodes` 2880. } 2881. 2882. > void SSL_CTX_free(SSL_CTX *a) 2883. { 2884. int i; ssl/ssl_lib.c:2908:9: Call 2906. */ 2907. if (a->sessions != NULL) 2908. SSL_CTX_flush_sessions(a, 0); ^ 2909. 2910. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:1044:1: Parameter `s->sessions->num_nodes` 1042. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1043. 1044. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 1045. { 1046. unsigned long i; ssl/ssl_sess.c:1057:5: Call 1055. i = lh_SSL_SESSION_get_down_load(s->sessions); 1056. lh_SSL_SESSION_set_down_load(s->sessions, 0); 1057. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp); ^ 1058. lh_SSL_SESSION_set_down_load(s->sessions, i); 1059. CRYPTO_THREAD_unlock(s->lock); ssl/ssl_sess.c:1042:1: Parameter `lh->num_nodes` 1040. } 1041. 1042. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1043. 1044. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) ssl/ssl_sess.c:1042:1: Call 1040. } 1041. 1042. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1043. 1044. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) crypto/lhash/lhash.c:186:1: Parameter `lh->num_nodes` 184. } 185. 186. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 187. { 188. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); crypto/lhash/lhash.c:188:5: Call 186. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 187. { 188. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); ^ 189. } 190. crypto/lhash/lhash.c:154:1: <LHS trace> 152. } 153. 154. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 155. OPENSSL_LH_DOALL_FUNC func, 156. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:154:1: Parameter `lh->num_nodes` 152. } 153. 154. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 155. OPENSSL_LH_DOALL_FUNC func, 156. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:168:10: Binary operation: ([0, 8] - 1):unsigned32 by call to `SSL_free` 166. * memory leaks otherwise 167. */ 168. for (i = lh->num_nodes - 1; i >= 0; i--) { ^ 169. a = lh->b[i]; 170. while (a != NULL) {
https://github.com/openssl/openssl/blob/190b9a03b72a8029c27e4bd0ab000129e240a413/crypto/lhash/lhash.c/#L168
d2a_code_trace_data_43076
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ecp_smpl.c:595: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_inverse`. Showing all 21 steps of the trace crypto/ec/ecp_smpl.c:528:1: Parameter `ctx->stack.depth` 526. 527. 528. > int ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *point, 529. BIGNUM *x, BIGNUM *y, BN_CTX *ctx) 530. { crypto/ec/ecp_smpl.c:549:2: Call 547. } 548. 549. BN_CTX_start(ctx); ^ 550. Z = BN_CTX_get(ctx); 551. Z_1 = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/ec/ecp_smpl.c:595:8: Call 593. else 594. { 595. if (!BN_mod_inverse(Z_1, Z_, &group->field, ctx)) ^ 596. { 597. ECerr(EC_F_EC_GFP_SIMPLE_POINT_GET_AFFINE_COORDINATES, ERR_R_BN_LIB); crypto/bn/bn_gcd.c:209:1: Parameter `ctx->stack.depth` 207. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx); 208. 209. > BIGNUM *BN_mod_inverse(BIGNUM *in, 210. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 211. { crypto/bn/bn_gcd.c:218:10: Call 216. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) 217. { 218. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 219. } 220. crypto/bn/bn_gcd.c:507:1: Parameter `ctx->stack.depth` 505. * It does not contain branches that may leak sensitive information. 506. */ 507. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 508. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 509. { crypto/bn/bn_gcd.c:519:2: Call 517. bn_check_top(n); 518. 519. BN_CTX_start(ctx); ^ 520. A = BN_CTX_get(ctx); 521. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gcd.c:548:8: Call 546. pB = &local_B; 547. BN_with_flags(pB, B, BN_FLG_CONSTTIME); 548. if (!BN_nnmod(B, pB, A, ctx)) goto err; ^ 549. } 550. sign = -1; crypto/bn/bn_mod.c:127:1: Parameter `ctx->stack.depth` 125. 126. 127. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 128. { 129. /* like BN_mod, but returns non-negative remainder crypto/bn/bn_mod.c:132:8: Call 130. * (i.e., 0 <= r < |d| always holds) */ 131. 132. if (!(BN_mod(r,m,d,ctx))) ^ 133. return 0; 134. if (!r->neg) crypto/bn/bn_div.c:181:1: Parameter `ctx->stack.depth` 179. * If 'dv' or 'rm' is NULL, the respective value is not returned. 180. */ 181. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 182. BN_CTX *ctx) 183. { crypto/bn/bn_div.c:226:2: Call 224. } 225. 226. BN_CTX_start(ctx); ^ 227. tmp=BN_CTX_get(ctx); 228. snum=BN_CTX_get(ctx); crypto/bn/bn_ctx.c:255:1: Parameter `ctx->stack.depth` 253. } 254. 255. > void BN_CTX_start(BN_CTX *ctx) 256. { 257. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:441:2: Call 439. } 440. if (no_branch) bn_correct_top(res); 441. BN_CTX_end(ctx); ^ 442. return(1); 443. err: crypto/bn/bn_ctx.c:270:1: Parameter `ctx->stack.depth` 268. } 269. 270. > void BN_CTX_end(BN_CTX *ctx) 271. { 272. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:277:21: Call 275. else 276. { 277. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 278. /* Does this stack frame have anything to release? */ 279. if(fp < ctx->used) crypto/bn/bn_ctx.c:351:1: <LHS trace> 349. } 350. 351. > static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:351:1: Parameter `st->depth` 349. } 350. 351. > static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:353:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_inverse` 351. static unsigned int BN_STACK_pop(BN_STACK *st) 352. { 353. return st->indexes[--(st->depth)]; ^ 354. } 355.
https://github.com/openssl/openssl/blob/4af793036f6ef4f0a1078e5d7155426a98d50e37/crypto/bn/bn_ctx.c/#L353
d2a_code_trace_data_43077
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; return 1; } ssl/t1_lib.c:1445: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `s->s3->previous_server_finished_len` + `pkt->written` + 23]):unsigned64 by call to `WPACKET_sub_memcpy__`. Showing all 14 steps of the trace ssl/t1_lib.c:1444:21: Call 1442. 1443. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats) 1444. || !WPACKET_start_sub_packet_u16(pkt) ^ 1445. || !WPACKET_sub_memcpy_u8(pkt, plist, plistlen) 1446. || !WPACKET_close(pkt)) { ssl/packet.c:224:1: Parameter `pkt->buf->length` 222. } 223. 224. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 225. { 226. WPACKET_SUB *sub; ssl/t1_lib.c:1445:21: Call 1443. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats) 1444. || !WPACKET_start_sub_packet_u16(pkt) 1445. || !WPACKET_sub_memcpy_u8(pkt, plist, plistlen) ^ 1446. || !WPACKET_close(pkt)) { 1447. SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); ssl/packet.c:317:1: Parameter `pkt->written` 315. } 316. 317. > int WPACKET_sub_memcpy__(WPACKET *pkt, const void *src, size_t len, 318. size_t lenbytes) 319. { ssl/packet.c:320:10: Call 318. size_t lenbytes) 319. { 320. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) ^ 321. || !WPACKET_memcpy(pkt, src, len) 322. || !WPACKET_close(pkt)) ssl/packet.c:224:1: Parameter `pkt->written` 222. } 223. 224. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 225. { 226. WPACKET_SUB *sub; ssl/packet.c:248:10: Call 246. } 247. 248. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 249. return 0; 250. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */ ssl/packet.c:15:1: Parameter `pkt->written` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ssl/packet.c:17:10: Call 15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ^ 18. return 0; 19. ssl/packet.c:36:1: <LHS trace> 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: Parameter `pkt->buf->length` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: <RHS trace> 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:36:1: Parameter `len` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:46:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + s->s3->previous_server_finished_len + pkt->written + 23]):unsigned64 by call to `WPACKET_sub_memcpy__` 44. return 0; 45. 46. if (pkt->buf->length - pkt->written < len) { ^ 47. size_t newlen; 48. size_t reflen;
https://github.com/openssl/openssl/blob/e4e1aa903e624044d3319622fc50222f1b2c7328/ssl/packet.c/#L46
d2a_code_trace_data_43078
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ecp_nist.c:159: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_sqr`. Showing all 14 steps of the trace crypto/ec/ecp_nist.c:145:1: Parameter `ctx->stack.depth` 143. } 144. 145. > int ec_GFp_nist_field_sqr(const EC_GROUP *group, BIGNUM *r, const BIGNUM *a, 146. BN_CTX *ctx) 147. { crypto/ec/ecp_nist.c:159:10: Call 157. goto err; 158. 159. if (!BN_sqr(r, a, ctx)) ^ 160. goto err; 161. if (!group->field_mod_func(r, r, group->field, ctx)) 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:42:5: Call 40. } 41. 42. BN_CTX_start(ctx); ^ 43. rr = (a != r) ? r : BN_CTX_get(ctx); 44. 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_sqr.c:104:5: Call 102. bn_check_top(rr); 103. bn_check_top(tmp); 104. BN_CTX_end(ctx); ^ 105. return ret; 106. } 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_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_43079
static MYOBJ *MYOBJ_new() { static int count = 0; MYOBJ *obj = OPENSSL_malloc(sizeof(*obj)); obj->id = ++count; obj->st = CRYPTO_new_ex_data(CRYPTO_EX_INDEX_APP, obj, &obj->ex_data); OPENSSL_assert(obj->st != 0); return obj; } test/exdatatest.c:57: error: NULL_DEREFERENCE pointer `obj` last assigned on line 55 could be null and is dereferenced at line 57, column 5. Showing all 14 steps of the trace test/exdatatest.c:52:1: start of procedure MYOBJ_new() 50. } MYOBJ; 51. 52. > static MYOBJ *MYOBJ_new() 53. { 54. static int count = 0; test/exdatatest.c:54:5: 52. static MYOBJ *MYOBJ_new() 53. { 54. > static int count = 0; 55. MYOBJ *obj = OPENSSL_malloc(sizeof(*obj)); 56. test/exdatatest.c:55:5: 53. { 54. static int count = 0; 55. > MYOBJ *obj = OPENSSL_malloc(sizeof(*obj)); 56. 57. obj->id = ++count; crypto/mem.c:158:1: start of procedure CRYPTO_malloc() 156. #endif 157. 158. > void *CRYPTO_malloc(size_t num, const char *file, int line) 159. { 160. void *ret = NULL; crypto/mem.c:160:5: 158. void *CRYPTO_malloc(size_t num, const char *file, int line) 159. { 160. > void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:162:9: Taking false branch 160. void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 163. return malloc_impl(num, file, line); 164. crypto/mem.c:165:9: Taking false branch 163. return malloc_impl(num, file, line); 164. 165. if (num == 0) ^ 166. return NULL; 167. crypto/mem.c:169:5: 167. 168. FAILTEST(); 169. > allow_customize = 0; 170. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 171. if (call_malloc_debug) { crypto/mem.c:179:5: 177. } 178. #else 179. > osslargused(file); osslargused(line); 180. ret = malloc(num); 181. #endif crypto/mem.c:179:24: 177. } 178. #else 179. > osslargused(file); osslargused(line); 180. ret = malloc(num); 181. #endif crypto/mem.c:180:5: 178. #else 179. osslargused(file); osslargused(line); 180. > ret = malloc(num); 181. #endif 182. crypto/mem.c:183:5: 181. #endif 182. 183. > return ret; 184. } 185. crypto/mem.c:184:1: return from a call to CRYPTO_malloc 182. 183. return ret; 184. > } 185. 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) test/exdatatest.c:57:5: 55. MYOBJ *obj = OPENSSL_malloc(sizeof(*obj)); 56. 57. > obj->id = ++count; 58. obj->st = CRYPTO_new_ex_data(CRYPTO_EX_INDEX_APP, obj, &obj->ex_data); 59. OPENSSL_assert(obj->st != 0);
https://github.com/openssl/openssl/blob/b3c31a6572bd7b89f469deb3c78f85f6e303df47/test/exdatatest.c/#L57
d2a_code_trace_data_43080
int MAIN(int argc, char **argv) { ENGINE *e = NULL; int ret=1; X509_REQ *req=NULL; X509 *x=NULL,*xca=NULL; ASN1_OBJECT *objtmp; STACK_OF(OPENSSL_STRING) *sigopts = NULL; EVP_PKEY *Upkey=NULL,*CApkey=NULL, *fkey = NULL; ASN1_INTEGER *sno = NULL; int i,num,badops=0; BIO *out=NULL; BIO *STDout=NULL; STACK_OF(ASN1_OBJECT) *trust = NULL, *reject = NULL; int informat,outformat,keyformat,CAformat,CAkeyformat; char *infile=NULL,*outfile=NULL,*keyfile=NULL,*CAfile=NULL; char *CAkeyfile=NULL,*CAserial=NULL; char *fkeyfile=NULL; char *alias=NULL; int text=0,serial=0,subject=0,issuer=0,startdate=0,enddate=0; int next_serial=0; int subject_hash=0,issuer_hash=0,ocspid=0; #ifndef OPENSSL_NO_MD5 int subject_hash_old=0,issuer_hash_old=0; #endif int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0,email=0; int ocsp_uri=0; int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0; int C=0; int x509req=0,days=DEF_DAYS,modulus=0,pubkey=0; int pprint = 0; const char **pp; X509_STORE *ctx=NULL; X509_REQ *rq=NULL; int fingerprint=0; char buf[256]; const EVP_MD *md_alg,*digest=NULL; CONF *extconf = NULL; char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL; int need_rand = 0; int checkend=0,checkoffset=0; unsigned long nmflag = 0, certflag = 0; #ifndef OPENSSL_NO_ENGINE char *engine=NULL; #endif reqfile=0; apps_startup(); if (bio_err == NULL) bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); if (!load_config(bio_err, NULL)) goto end; STDout=BIO_new_fp(stdout,BIO_NOCLOSE); #ifdef OPENSSL_SYS_VMS { BIO *tmpbio = BIO_new(BIO_f_linebuffer()); STDout = BIO_push(tmpbio, STDout); } #endif informat=FORMAT_PEM; outformat=FORMAT_PEM; keyformat=FORMAT_PEM; CAformat=FORMAT_PEM; CAkeyformat=FORMAT_PEM; ctx=X509_STORE_new(); if (ctx == NULL) goto end; X509_STORE_set_verify_cb(ctx,callb); argc--; argv++; num=0; while (argc >= 1) { if (strcmp(*argv,"-inform") == 0) { if (--argc < 1) goto bad; informat=str2fmt(*(++argv)); } else if (strcmp(*argv,"-outform") == 0) { if (--argc < 1) goto bad; outformat=str2fmt(*(++argv)); } else if (strcmp(*argv,"-keyform") == 0) { if (--argc < 1) goto bad; keyformat=str2fmt(*(++argv)); } else if (strcmp(*argv,"-req") == 0) { reqfile=1; need_rand = 1; } else if (strcmp(*argv,"-CAform") == 0) { if (--argc < 1) goto bad; CAformat=str2fmt(*(++argv)); } else if (strcmp(*argv,"-CAkeyform") == 0) { if (--argc < 1) goto bad; CAkeyformat=str2fmt(*(++argv)); } else if (strcmp(*argv,"-sigopt") == 0) { if (--argc < 1) goto bad; if (!sigopts) sigopts = sk_OPENSSL_STRING_new_null(); if (!sigopts || !sk_OPENSSL_STRING_push(sigopts, *(++argv))) goto bad; } else if (strcmp(*argv,"-days") == 0) { if (--argc < 1) goto bad; days=atoi(*(++argv)); if (days == 0) { BIO_printf(bio_err,"bad number of days\n"); goto bad; } } else if (strcmp(*argv,"-passin") == 0) { if (--argc < 1) goto bad; passargin= *(++argv); } else if (strcmp(*argv,"-extfile") == 0) { if (--argc < 1) goto bad; extfile= *(++argv); } else if (strcmp(*argv,"-extensions") == 0) { if (--argc < 1) goto bad; extsect= *(++argv); } else if (strcmp(*argv,"-in") == 0) { if (--argc < 1) goto bad; infile= *(++argv); } else if (strcmp(*argv,"-out") == 0) { if (--argc < 1) goto bad; outfile= *(++argv); } else if (strcmp(*argv,"-signkey") == 0) { if (--argc < 1) goto bad; keyfile= *(++argv); sign_flag= ++num; need_rand = 1; } else if (strcmp(*argv,"-CA") == 0) { if (--argc < 1) goto bad; CAfile= *(++argv); CA_flag= ++num; need_rand = 1; } else if (strcmp(*argv,"-CAkey") == 0) { if (--argc < 1) goto bad; CAkeyfile= *(++argv); } else if (strcmp(*argv,"-CAserial") == 0) { if (--argc < 1) goto bad; CAserial= *(++argv); } else if (strcmp(*argv,"-set_serial") == 0) { if (--argc < 1) goto bad; if (!(sno = s2i_ASN1_INTEGER(NULL, *(++argv)))) goto bad; } else if (strcmp(*argv,"-force_pubkey") == 0) { if (--argc < 1) goto bad; fkeyfile= *(++argv); } else if (strcmp(*argv,"-addtrust") == 0) { if (--argc < 1) goto bad; if (!(objtmp = OBJ_txt2obj(*(++argv), 0))) { BIO_printf(bio_err, "Invalid trust object value %s\n", *argv); goto bad; } if (!trust) trust = sk_ASN1_OBJECT_new_null(); sk_ASN1_OBJECT_push(trust, objtmp); trustout = 1; } else if (strcmp(*argv,"-addreject") == 0) { if (--argc < 1) goto bad; if (!(objtmp = OBJ_txt2obj(*(++argv), 0))) { BIO_printf(bio_err, "Invalid reject object value %s\n", *argv); goto bad; } if (!reject) reject = sk_ASN1_OBJECT_new_null(); sk_ASN1_OBJECT_push(reject, objtmp); trustout = 1; } else if (strcmp(*argv,"-setalias") == 0) { if (--argc < 1) goto bad; alias= *(++argv); trustout = 1; } else if (strcmp(*argv,"-certopt") == 0) { if (--argc < 1) goto bad; if (!set_cert_ex(&certflag, *(++argv))) goto bad; } else if (strcmp(*argv,"-nameopt") == 0) { if (--argc < 1) goto bad; if (!set_name_ex(&nmflag, *(++argv))) goto bad; } #ifndef OPENSSL_NO_ENGINE else if (strcmp(*argv,"-engine") == 0) { if (--argc < 1) goto bad; engine= *(++argv); } #endif else if (strcmp(*argv,"-C") == 0) C= ++num; else if (strcmp(*argv,"-email") == 0) email= ++num; else if (strcmp(*argv,"-ocsp_uri") == 0) ocsp_uri= ++num; else if (strcmp(*argv,"-serial") == 0) serial= ++num; else if (strcmp(*argv,"-next_serial") == 0) next_serial= ++num; else if (strcmp(*argv,"-modulus") == 0) modulus= ++num; else if (strcmp(*argv,"-pubkey") == 0) pubkey= ++num; else if (strcmp(*argv,"-x509toreq") == 0) x509req= ++num; else if (strcmp(*argv,"-text") == 0) text= ++num; else if (strcmp(*argv,"-hash") == 0 || strcmp(*argv,"-subject_hash") == 0) subject_hash= ++num; #ifndef OPENSSL_NO_MD5 else if (strcmp(*argv,"-subject_hash_old") == 0) subject_hash_old= ++num; #endif else if (strcmp(*argv,"-issuer_hash") == 0) issuer_hash= ++num; #ifndef OPENSSL_NO_MD5 else if (strcmp(*argv,"-issuer_hash_old") == 0) issuer_hash_old= ++num; #endif else if (strcmp(*argv,"-subject") == 0) subject= ++num; else if (strcmp(*argv,"-issuer") == 0) issuer= ++num; else if (strcmp(*argv,"-fingerprint") == 0) fingerprint= ++num; else if (strcmp(*argv,"-dates") == 0) { startdate= ++num; enddate= ++num; } else if (strcmp(*argv,"-purpose") == 0) pprint= ++num; else if (strcmp(*argv,"-startdate") == 0) startdate= ++num; else if (strcmp(*argv,"-enddate") == 0) enddate= ++num; else if (strcmp(*argv,"-checkend") == 0) { if (--argc < 1) goto bad; checkoffset=atoi(*(++argv)); checkend=1; } else if (strcmp(*argv,"-noout") == 0) noout= ++num; else if (strcmp(*argv,"-trustout") == 0) trustout= 1; else if (strcmp(*argv,"-clrtrust") == 0) clrtrust= ++num; else if (strcmp(*argv,"-clrreject") == 0) clrreject= ++num; else if (strcmp(*argv,"-alias") == 0) aliasout= ++num; else if (strcmp(*argv,"-CAcreateserial") == 0) CA_createserial= ++num; else if (strcmp(*argv,"-clrext") == 0) clrext = 1; #if 1 else if (strcmp(*argv,"-crlext") == 0) { BIO_printf(bio_err,"use -clrext instead of -crlext\n"); clrext = 1; } #endif else if (strcmp(*argv,"-ocspid") == 0) ocspid= ++num; else if ((md_alg=EVP_get_digestbyname(*argv + 1))) { digest=md_alg; } else { BIO_printf(bio_err,"unknown option %s\n",*argv); badops=1; break; } argc--; argv++; } if (badops) { bad: for (pp=x509_usage; (*pp != NULL); pp++) BIO_printf(bio_err,"%s",*pp); goto end; } #ifndef OPENSSL_NO_ENGINE e = setup_engine(bio_err, engine, 0); #endif if (need_rand) app_RAND_load_file(NULL, bio_err, 0); ERR_load_crypto_strings(); if (!app_passwd(bio_err, passargin, NULL, &passin, NULL)) { BIO_printf(bio_err, "Error getting password\n"); goto end; } if (!X509_STORE_set_default_paths(ctx)) { ERR_print_errors(bio_err); goto end; } if (fkeyfile) { fkey = load_pubkey(bio_err, fkeyfile, keyformat, 0, NULL, e, "Forced key"); if (fkey == NULL) goto end; } if ((CAkeyfile == NULL) && (CA_flag) && (CAformat == FORMAT_PEM)) { CAkeyfile=CAfile; } else if ((CA_flag) && (CAkeyfile == NULL)) { BIO_printf(bio_err,"need to specify a CAkey if using the CA command\n"); goto end; } if (extfile) { long errorline = -1; X509V3_CTX ctx2; extconf = NCONF_new(NULL); if (!NCONF_load(extconf, extfile,&errorline)) { if (errorline <= 0) BIO_printf(bio_err, "error loading the config file '%s'\n", extfile); else BIO_printf(bio_err, "error on line %ld of config file '%s'\n" ,errorline,extfile); goto end; } if (!extsect) { extsect = NCONF_get_string(extconf, "default", "extensions"); if (!extsect) { ERR_clear_error(); extsect = "default"; } } X509V3_set_ctx_test(&ctx2); X509V3_set_nconf(&ctx2, extconf); if (!X509V3_EXT_add_nconf(extconf, &ctx2, extsect, NULL)) { BIO_printf(bio_err, "Error Loading extension section %s\n", extsect); ERR_print_errors(bio_err); goto end; } } if (reqfile) { EVP_PKEY *pkey; BIO *in; if (!sign_flag && !CA_flag) { BIO_printf(bio_err,"We need a private key to sign with\n"); goto end; } in=BIO_new(BIO_s_file()); if (in == NULL) { ERR_print_errors(bio_err); goto end; } if (infile == NULL) BIO_set_fp(in,stdin,BIO_NOCLOSE|BIO_FP_TEXT); else { if (BIO_read_filename(in,infile) <= 0) { perror(infile); BIO_free(in); goto end; } } req=PEM_read_bio_X509_REQ(in,NULL,NULL,NULL); BIO_free(in); if (req == NULL) { ERR_print_errors(bio_err); goto end; } if ( (req->req_info == NULL) || (req->req_info->pubkey == NULL) || (req->req_info->pubkey->public_key == NULL) || (req->req_info->pubkey->public_key->data == NULL)) { BIO_printf(bio_err,"The certificate request appears to corrupted\n"); BIO_printf(bio_err,"It does not contain a public key\n"); goto end; } if ((pkey=X509_REQ_get_pubkey(req)) == NULL) { BIO_printf(bio_err,"error unpacking public key\n"); goto end; } i=X509_REQ_verify(req,pkey); EVP_PKEY_free(pkey); if (i < 0) { BIO_printf(bio_err,"Signature verification error\n"); ERR_print_errors(bio_err); goto end; } if (i == 0) { BIO_printf(bio_err,"Signature did not match the certificate request\n"); goto end; } else BIO_printf(bio_err,"Signature ok\n"); print_name(bio_err, "subject=", X509_REQ_get_subject_name(req), nmflag); if ((x=X509_new()) == NULL) goto end; if (sno == NULL) { sno = ASN1_INTEGER_new(); if (!sno || !rand_serial(NULL, sno)) goto end; if (!X509_set_serialNumber(x, sno)) goto end; ASN1_INTEGER_free(sno); sno = NULL; } else if (!X509_set_serialNumber(x, sno)) goto end; if (!X509_set_issuer_name(x,req->req_info->subject)) goto end; if (!X509_set_subject_name(x,req->req_info->subject)) goto end; X509_gmtime_adj(X509_get_notBefore(x),0); X509_time_adj_ex(X509_get_notAfter(x),days, 0, NULL); if (fkey) X509_set_pubkey(x, fkey); else { pkey = X509_REQ_get_pubkey(req); X509_set_pubkey(x,pkey); EVP_PKEY_free(pkey); } } else x=load_cert(bio_err,infile,informat,NULL,e,"Certificate"); if (x == NULL) goto end; if (CA_flag) { xca=load_cert(bio_err,CAfile,CAformat,NULL,e,"CA Certificate"); if (xca == NULL) goto end; } if (!noout || text || next_serial) { OBJ_create("2.99999.3", "SET.ex3","SET x509v3 extension 3"); out=BIO_new(BIO_s_file()); if (out == NULL) { ERR_print_errors(bio_err); goto end; } if (outfile == NULL) { BIO_set_fp(out,stdout,BIO_NOCLOSE); #ifdef OPENSSL_SYS_VMS { BIO *tmpbio = BIO_new(BIO_f_linebuffer()); out = BIO_push(tmpbio, out); } #endif } else { if (BIO_write_filename(out,outfile) <= 0) { perror(outfile); goto end; } } } if (alias) X509_alias_set1(x, (unsigned char *)alias, -1); if (clrtrust) X509_trust_clear(x); if (clrreject) X509_reject_clear(x); if (trust) { for (i = 0; i < sk_ASN1_OBJECT_num(trust); i++) { objtmp = sk_ASN1_OBJECT_value(trust, i); X509_add1_trust_object(x, objtmp); } } if (reject) { for (i = 0; i < sk_ASN1_OBJECT_num(reject); i++) { objtmp = sk_ASN1_OBJECT_value(reject, i); X509_add1_reject_object(x, objtmp); } } if (num) { for (i=1; i<=num; i++) { if (issuer == i) { print_name(STDout, "issuer= ", X509_get_issuer_name(x), nmflag); } else if (subject == i) { print_name(STDout, "subject= ", X509_get_subject_name(x), nmflag); } else if (serial == i) { BIO_printf(STDout,"serial="); i2a_ASN1_INTEGER(STDout, X509_get_serialNumber(x)); BIO_printf(STDout,"\n"); } else if (next_serial == i) { BIGNUM *bnser; ASN1_INTEGER *ser; ser = X509_get_serialNumber(x); bnser = ASN1_INTEGER_to_BN(ser, NULL); if (!bnser) goto end; if (!BN_add_word(bnser, 1)) goto end; ser = BN_to_ASN1_INTEGER(bnser, NULL); if (!ser) goto end; BN_free(bnser); i2a_ASN1_INTEGER(out, ser); ASN1_INTEGER_free(ser); BIO_puts(out, "\n"); } else if ((email == i) || (ocsp_uri == i)) { int j; STACK_OF(OPENSSL_STRING) *emlst; if (email == i) emlst = X509_get1_email(x); else emlst = X509_get1_ocsp(x); for (j = 0; j < sk_OPENSSL_STRING_num(emlst); j++) BIO_printf(STDout, "%s\n", sk_OPENSSL_STRING_value(emlst, j)); X509_email_free(emlst); } else if (aliasout == i) { unsigned char *alstr; alstr = X509_alias_get0(x, NULL); if (alstr) BIO_printf(STDout,"%s\n", alstr); else BIO_puts(STDout,"<No Alias>\n"); } else if (subject_hash == i) { BIO_printf(STDout,"%08lx\n",X509_subject_name_hash(x)); } #ifndef OPENSSL_NO_MD5 else if (subject_hash_old == i) { BIO_printf(STDout,"%08lx\n",X509_subject_name_hash_old(x)); } #endif else if (issuer_hash == i) { BIO_printf(STDout,"%08lx\n",X509_issuer_name_hash(x)); } #ifndef OPENSSL_NO_MD5 else if (issuer_hash_old == i) { BIO_printf(STDout,"%08lx\n",X509_issuer_name_hash_old(x)); } #endif else if (pprint == i) { X509_PURPOSE *ptmp; int j; BIO_printf(STDout, "Certificate purposes:\n"); for (j = 0; j < X509_PURPOSE_get_count(); j++) { ptmp = X509_PURPOSE_get0(j); purpose_print(STDout, x, ptmp); } } else if (modulus == i) { EVP_PKEY *pkey; pkey=X509_get_pubkey(x); if (pkey == NULL) { BIO_printf(bio_err,"Modulus=unavailable\n"); ERR_print_errors(bio_err); goto end; } BIO_printf(STDout,"Modulus="); #ifndef OPENSSL_NO_RSA if (pkey->type == EVP_PKEY_RSA) BN_print(STDout,pkey->pkey.rsa->n); else #endif #ifndef OPENSSL_NO_DSA if (pkey->type == EVP_PKEY_DSA) BN_print(STDout,pkey->pkey.dsa->pub_key); else #endif BIO_printf(STDout,"Wrong Algorithm type"); BIO_printf(STDout,"\n"); EVP_PKEY_free(pkey); } else if (pubkey == i) { EVP_PKEY *pkey; pkey=X509_get_pubkey(x); if (pkey == NULL) { BIO_printf(bio_err,"Error getting public key\n"); ERR_print_errors(bio_err); goto end; } PEM_write_bio_PUBKEY(STDout, pkey); EVP_PKEY_free(pkey); } else if (C == i) { unsigned char *d; char *m; int y,z; X509_NAME_oneline(X509_get_subject_name(x), buf,sizeof buf); BIO_printf(STDout,"/* subject:%s */\n",buf); m=X509_NAME_oneline( X509_get_issuer_name(x),buf, sizeof buf); BIO_printf(STDout,"/* issuer :%s */\n",buf); z=i2d_X509(x,NULL); m=OPENSSL_malloc(z); d=(unsigned char *)m; z=i2d_X509_NAME(X509_get_subject_name(x),&d); BIO_printf(STDout,"unsigned char XXX_subject_name[%d]={\n",z); d=(unsigned char *)m; for (y=0; y<z; y++) { BIO_printf(STDout,"0x%02X,",d[y]); if ((y & 0x0f) == 0x0f) BIO_printf(STDout,"\n"); } if (y%16 != 0) BIO_printf(STDout,"\n"); BIO_printf(STDout,"};\n"); z=i2d_X509_PUBKEY(X509_get_X509_PUBKEY(x),&d); BIO_printf(STDout,"unsigned char XXX_public_key[%d]={\n",z); d=(unsigned char *)m; for (y=0; y<z; y++) { BIO_printf(STDout,"0x%02X,",d[y]); if ((y & 0x0f) == 0x0f) BIO_printf(STDout,"\n"); } if (y%16 != 0) BIO_printf(STDout,"\n"); BIO_printf(STDout,"};\n"); z=i2d_X509(x,&d); BIO_printf(STDout,"unsigned char XXX_certificate[%d]={\n",z); d=(unsigned char *)m; for (y=0; y<z; y++) { BIO_printf(STDout,"0x%02X,",d[y]); if ((y & 0x0f) == 0x0f) BIO_printf(STDout,"\n"); } if (y%16 != 0) BIO_printf(STDout,"\n"); BIO_printf(STDout,"};\n"); OPENSSL_free(m); } else if (text == i) { X509_print_ex(STDout,x,nmflag, certflag); } else if (startdate == i) { BIO_puts(STDout,"notBefore="); ASN1_TIME_print(STDout,X509_get_notBefore(x)); BIO_puts(STDout,"\n"); } else if (enddate == i) { BIO_puts(STDout,"notAfter="); ASN1_TIME_print(STDout,X509_get_notAfter(x)); BIO_puts(STDout,"\n"); } else if (fingerprint == i) { int j; unsigned int n; unsigned char md[EVP_MAX_MD_SIZE]; const EVP_MD *fdig = digest; if (!fdig) fdig = EVP_sha1(); if (!X509_digest(x,fdig,md,&n)) { BIO_printf(bio_err,"out of memory\n"); goto end; } BIO_printf(STDout,"%s Fingerprint=", OBJ_nid2sn(EVP_MD_type(fdig))); for (j=0; j<(int)n; j++) { BIO_printf(STDout,"%02X%c",md[j], (j+1 == (int)n) ?'\n':':'); } } else if ((sign_flag == i) && (x509req == 0)) { BIO_printf(bio_err,"Getting Private key\n"); if (Upkey == NULL) { Upkey=load_key(bio_err, keyfile, keyformat, 0, passin, e, "Private key"); if (Upkey == NULL) goto end; } assert(need_rand); if (!sign(x,Upkey,days,clrext,digest, extconf, extsect)) goto end; } else if (CA_flag == i) { BIO_printf(bio_err,"Getting CA Private Key\n"); if (CAkeyfile != NULL) { CApkey=load_key(bio_err, CAkeyfile, CAkeyformat, 0, passin, e, "CA Private Key"); if (CApkey == NULL) goto end; } assert(need_rand); if (!x509_certify(ctx,CAfile,digest,x,xca, CApkey, sigopts, CAserial,CA_createserial,days, clrext, extconf, extsect, sno)) goto end; } else if (x509req == i) { EVP_PKEY *pk; BIO_printf(bio_err,"Getting request Private Key\n"); if (keyfile == NULL) { BIO_printf(bio_err,"no request key file specified\n"); goto end; } else { pk=load_key(bio_err, keyfile, keyformat, 0, passin, e, "request key"); if (pk == NULL) goto end; } BIO_printf(bio_err,"Generating certificate request\n"); rq=X509_to_X509_REQ(x,pk,digest); EVP_PKEY_free(pk); if (rq == NULL) { ERR_print_errors(bio_err); goto end; } if (!noout) { X509_REQ_print(out,rq); PEM_write_bio_X509_REQ(out,rq); } noout=1; } else if (ocspid == i) { X509_ocspid_print(out, x); } } } if (checkend) { time_t tcheck=time(NULL) + checkoffset; if (X509_cmp_time(X509_get_notAfter(x), &tcheck) < 0) { BIO_printf(out,"Certificate will expire\n"); ret=1; } else { BIO_printf(out,"Certificate will not expire\n"); ret=0; } goto end; } if (noout) { ret=0; goto end; } if (outformat == FORMAT_ASN1) i=i2d_X509_bio(out,x); else if (outformat == FORMAT_PEM) { if (trustout) i=PEM_write_bio_X509_AUX(out,x); else i=PEM_write_bio_X509(out,x); } else if (outformat == FORMAT_NETSCAPE) { NETSCAPE_X509 nx; ASN1_OCTET_STRING hdr; hdr.data=(unsigned char *)NETSCAPE_CERT_HDR; hdr.length=strlen(NETSCAPE_CERT_HDR); nx.header= &hdr; nx.cert=x; i=ASN1_item_i2d_bio(ASN1_ITEM_rptr(NETSCAPE_X509),out,&nx); } else { BIO_printf(bio_err,"bad output format specified for outfile\n"); goto end; } if (!i) { BIO_printf(bio_err,"unable to write certificate\n"); ERR_print_errors(bio_err); goto end; } ret=0; end: if (need_rand) app_RAND_write_file(NULL, bio_err); OBJ_cleanup(); NCONF_free(extconf); BIO_free_all(out); BIO_free_all(STDout); X509_STORE_free(ctx); X509_REQ_free(req); X509_free(x); X509_free(xca); EVP_PKEY_free(Upkey); EVP_PKEY_free(CApkey); EVP_PKEY_free(fkey); if (sigopts) sk_OPENSSL_STRING_free(sigopts); X509_REQ_free(rq); ASN1_INTEGER_free(sno); sk_ASN1_OBJECT_pop_free(trust, ASN1_OBJECT_free); sk_ASN1_OBJECT_pop_free(reject, ASN1_OBJECT_free); if (passin) OPENSSL_free(passin); apps_shutdown(); OPENSSL_EXIT(ret); } apps/x509.c:1107: error: NULL_DEREFERENCE pointer `ctx` last assigned on line 201 could be null and is dereferenced by call to `X509_STORE_free()` at line 1107, column 2. Showing all 62 steps of the trace apps/x509.c:169:1: start of procedure x509_main() 167. int MAIN(int, char **); 168. 169. > int MAIN(int argc, char **argv) 170. { 171. ENGINE *e = NULL; apps/x509.c:171:2: 169. int MAIN(int argc, char **argv) 170. { 171. > ENGINE *e = NULL; 172. int ret=1; 173. X509_REQ *req=NULL; apps/x509.c:172:2: 170. { 171. ENGINE *e = NULL; 172. > int ret=1; 173. X509_REQ *req=NULL; 174. X509 *x=NULL,*xca=NULL; apps/x509.c:173:2: 171. ENGINE *e = NULL; 172. int ret=1; 173. > X509_REQ *req=NULL; 174. X509 *x=NULL,*xca=NULL; 175. ASN1_OBJECT *objtmp; apps/x509.c:174:2: 172. int ret=1; 173. X509_REQ *req=NULL; 174. > X509 *x=NULL,*xca=NULL; 175. ASN1_OBJECT *objtmp; 176. STACK_OF(OPENSSL_STRING) *sigopts = NULL; apps/x509.c:176:2: 174. X509 *x=NULL,*xca=NULL; 175. ASN1_OBJECT *objtmp; 176. > STACK_OF(OPENSSL_STRING) *sigopts = NULL; 177. EVP_PKEY *Upkey=NULL,*CApkey=NULL, *fkey = NULL; 178. ASN1_INTEGER *sno = NULL; apps/x509.c:177:2: 175. ASN1_OBJECT *objtmp; 176. STACK_OF(OPENSSL_STRING) *sigopts = NULL; 177. > EVP_PKEY *Upkey=NULL,*CApkey=NULL, *fkey = NULL; 178. ASN1_INTEGER *sno = NULL; 179. int i,num,badops=0; apps/x509.c:178:2: 176. STACK_OF(OPENSSL_STRING) *sigopts = NULL; 177. EVP_PKEY *Upkey=NULL,*CApkey=NULL, *fkey = NULL; 178. > ASN1_INTEGER *sno = NULL; 179. int i,num,badops=0; 180. BIO *out=NULL; apps/x509.c:179:2: 177. EVP_PKEY *Upkey=NULL,*CApkey=NULL, *fkey = NULL; 178. ASN1_INTEGER *sno = NULL; 179. > int i,num,badops=0; 180. BIO *out=NULL; 181. BIO *STDout=NULL; apps/x509.c:180:2: 178. ASN1_INTEGER *sno = NULL; 179. int i,num,badops=0; 180. > BIO *out=NULL; 181. BIO *STDout=NULL; 182. STACK_OF(ASN1_OBJECT) *trust = NULL, *reject = NULL; apps/x509.c:181:2: 179. int i,num,badops=0; 180. BIO *out=NULL; 181. > BIO *STDout=NULL; 182. STACK_OF(ASN1_OBJECT) *trust = NULL, *reject = NULL; 183. int informat,outformat,keyformat,CAformat,CAkeyformat; apps/x509.c:182:2: 180. BIO *out=NULL; 181. BIO *STDout=NULL; 182. > STACK_OF(ASN1_OBJECT) *trust = NULL, *reject = NULL; 183. int informat,outformat,keyformat,CAformat,CAkeyformat; 184. char *infile=NULL,*outfile=NULL,*keyfile=NULL,*CAfile=NULL; apps/x509.c:184:2: 182. STACK_OF(ASN1_OBJECT) *trust = NULL, *reject = NULL; 183. int informat,outformat,keyformat,CAformat,CAkeyformat; 184. > char *infile=NULL,*outfile=NULL,*keyfile=NULL,*CAfile=NULL; 185. char *CAkeyfile=NULL,*CAserial=NULL; 186. char *fkeyfile=NULL; apps/x509.c:185:2: 183. int informat,outformat,keyformat,CAformat,CAkeyformat; 184. char *infile=NULL,*outfile=NULL,*keyfile=NULL,*CAfile=NULL; 185. > char *CAkeyfile=NULL,*CAserial=NULL; 186. char *fkeyfile=NULL; 187. char *alias=NULL; apps/x509.c:186:2: 184. char *infile=NULL,*outfile=NULL,*keyfile=NULL,*CAfile=NULL; 185. char *CAkeyfile=NULL,*CAserial=NULL; 186. > char *fkeyfile=NULL; 187. char *alias=NULL; 188. int text=0,serial=0,subject=0,issuer=0,startdate=0,enddate=0; apps/x509.c:187:2: 185. char *CAkeyfile=NULL,*CAserial=NULL; 186. char *fkeyfile=NULL; 187. > char *alias=NULL; 188. int text=0,serial=0,subject=0,issuer=0,startdate=0,enddate=0; 189. int next_serial=0; apps/x509.c:188:2: 186. char *fkeyfile=NULL; 187. char *alias=NULL; 188. > int text=0,serial=0,subject=0,issuer=0,startdate=0,enddate=0; 189. int next_serial=0; 190. int subject_hash=0,issuer_hash=0,ocspid=0; apps/x509.c:189:2: 187. char *alias=NULL; 188. int text=0,serial=0,subject=0,issuer=0,startdate=0,enddate=0; 189. > int next_serial=0; 190. int subject_hash=0,issuer_hash=0,ocspid=0; 191. #ifndef OPENSSL_NO_MD5 apps/x509.c:190:2: 188. int text=0,serial=0,subject=0,issuer=0,startdate=0,enddate=0; 189. int next_serial=0; 190. > int subject_hash=0,issuer_hash=0,ocspid=0; 191. #ifndef OPENSSL_NO_MD5 192. int subject_hash_old=0,issuer_hash_old=0; apps/x509.c:192:2: 190. int subject_hash=0,issuer_hash=0,ocspid=0; 191. #ifndef OPENSSL_NO_MD5 192. > int subject_hash_old=0,issuer_hash_old=0; 193. #endif 194. int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0,email=0; apps/x509.c:194:2: 192. int subject_hash_old=0,issuer_hash_old=0; 193. #endif 194. > int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0,email=0; 195. int ocsp_uri=0; 196. int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0; apps/x509.c:195:2: 193. #endif 194. int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0,email=0; 195. > int ocsp_uri=0; 196. int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0; 197. int C=0; apps/x509.c:196:2: 194. int noout=0,sign_flag=0,CA_flag=0,CA_createserial=0,email=0; 195. int ocsp_uri=0; 196. > int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0; 197. int C=0; 198. int x509req=0,days=DEF_DAYS,modulus=0,pubkey=0; apps/x509.c:197:2: 195. int ocsp_uri=0; 196. int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0; 197. > int C=0; 198. int x509req=0,days=DEF_DAYS,modulus=0,pubkey=0; 199. int pprint = 0; apps/x509.c:198:2: 196. int trustout=0,clrtrust=0,clrreject=0,aliasout=0,clrext=0; 197. int C=0; 198. > int x509req=0,days=DEF_DAYS,modulus=0,pubkey=0; 199. int pprint = 0; 200. const char **pp; apps/x509.c:199:2: 197. int C=0; 198. int x509req=0,days=DEF_DAYS,modulus=0,pubkey=0; 199. > int pprint = 0; 200. const char **pp; 201. X509_STORE *ctx=NULL; apps/x509.c:201:2: 199. int pprint = 0; 200. const char **pp; 201. > X509_STORE *ctx=NULL; 202. X509_REQ *rq=NULL; 203. int fingerprint=0; apps/x509.c:202:2: 200. const char **pp; 201. X509_STORE *ctx=NULL; 202. > X509_REQ *rq=NULL; 203. int fingerprint=0; 204. char buf[256]; apps/x509.c:203:2: 201. X509_STORE *ctx=NULL; 202. X509_REQ *rq=NULL; 203. > int fingerprint=0; 204. char buf[256]; 205. const EVP_MD *md_alg,*digest=NULL; apps/x509.c:205:2: 203. int fingerprint=0; 204. char buf[256]; 205. > const EVP_MD *md_alg,*digest=NULL; 206. CONF *extconf = NULL; 207. char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL; apps/x509.c:206:2: 204. char buf[256]; 205. const EVP_MD *md_alg,*digest=NULL; 206. > CONF *extconf = NULL; 207. char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL; 208. int need_rand = 0; apps/x509.c:207:2: 205. const EVP_MD *md_alg,*digest=NULL; 206. CONF *extconf = NULL; 207. > char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL; 208. int need_rand = 0; 209. int checkend=0,checkoffset=0; apps/x509.c:208:2: 206. CONF *extconf = NULL; 207. char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL; 208. > int need_rand = 0; 209. int checkend=0,checkoffset=0; 210. unsigned long nmflag = 0, certflag = 0; apps/x509.c:209:2: 207. char *extsect = NULL, *extfile = NULL, *passin = NULL, *passargin = NULL; 208. int need_rand = 0; 209. > int checkend=0,checkoffset=0; 210. unsigned long nmflag = 0, certflag = 0; 211. #ifndef OPENSSL_NO_ENGINE apps/x509.c:210:2: 208. int need_rand = 0; 209. int checkend=0,checkoffset=0; 210. > unsigned long nmflag = 0, certflag = 0; 211. #ifndef OPENSSL_NO_ENGINE 212. char *engine=NULL; apps/x509.c:212:2: 210. unsigned long nmflag = 0, certflag = 0; 211. #ifndef OPENSSL_NO_ENGINE 212. > char *engine=NULL; 213. #endif 214. apps/x509.c:215:2: 213. #endif 214. 215. > reqfile=0; 216. 217. apps_startup(); apps/x509.c:217:2: 215. reqfile=0; 216. 217. > apps_startup(); 218. 219. if (bio_err == NULL) apps/x509.c:219:6: Taking false branch 217. apps_startup(); 218. 219. if (bio_err == NULL) ^ 220. bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); 221. apps/x509.c:222:7: Taking true branch 220. bio_err=BIO_new_fp(stderr,BIO_NOCLOSE); 221. 222. if (!load_config(bio_err, NULL)) ^ 223. goto end; 224. STDout=BIO_new_fp(stdout,BIO_NOCLOSE); apps/x509.c:1100:1: 1098. } 1099. ret=0; 1100. > end: 1101. if (need_rand) 1102. app_RAND_write_file(NULL, bio_err); apps/x509.c:1101:6: Taking false branch 1099. ret=0; 1100. end: 1101. if (need_rand) ^ 1102. app_RAND_write_file(NULL, bio_err); 1103. OBJ_cleanup(); apps/x509.c:1103:2: 1101. if (need_rand) 1102. app_RAND_write_file(NULL, bio_err); 1103. > OBJ_cleanup(); 1104. NCONF_free(extconf); 1105. BIO_free_all(out); crypto/objects/obj_dat.c:222:1: start of procedure OBJ_cleanup() 220. } 221. 222. > void OBJ_cleanup(void) 223. { 224. if (obj_cleanup_defer) crypto/objects/obj_dat.c:224:6: Taking false branch 222. void OBJ_cleanup(void) 223. { 224. if (obj_cleanup_defer) ^ 225. { 226. obj_cleanup_defer = 2; crypto/objects/obj_dat.c:229:6: Taking true branch 227. return ; 228. } 229. if (added == NULL) return; ^ 230. lh_ADDED_OBJ_down_load(added) = 0; 231. lh_ADDED_OBJ_doall(added,LHASH_DOALL_FN(cleanup1)); /* zero counters */ crypto/objects/obj_dat.c:229:21: 227. return ; 228. } 229. > if (added == NULL) return; 230. lh_ADDED_OBJ_down_load(added) = 0; 231. lh_ADDED_OBJ_doall(added,LHASH_DOALL_FN(cleanup1)); /* zero counters */ crypto/objects/obj_dat.c:236:2: return from a call to OBJ_cleanup 234. lh_ADDED_OBJ_free(added); 235. added=NULL; 236. } ^ 237. 238. int OBJ_new_nid(int num) apps/x509.c:1104:2: 1102. app_RAND_write_file(NULL, bio_err); 1103. OBJ_cleanup(); 1104. > NCONF_free(extconf); 1105. BIO_free_all(out); 1106. BIO_free_all(STDout); crypto/conf/conf_lib.c:251:1: start of procedure NCONF_free() 249. } 250. 251. > void NCONF_free(CONF *conf) 252. { 253. if (conf == NULL) crypto/conf/conf_lib.c:253:6: Taking true branch 251. void NCONF_free(CONF *conf) 252. { 253. if (conf == NULL) ^ 254. return; 255. conf->meth->destroy(conf); crypto/conf/conf_lib.c:254:3: 252. { 253. if (conf == NULL) 254. > return; 255. conf->meth->destroy(conf); 256. } crypto/conf/conf_lib.c:256:2: return from a call to NCONF_free 254. return; 255. conf->meth->destroy(conf); 256. } ^ 257. 258. void NCONF_free_data(CONF *conf) apps/x509.c:1105:2: 1103. OBJ_cleanup(); 1104. NCONF_free(extconf); 1105. > BIO_free_all(out); 1106. BIO_free_all(STDout); 1107. X509_STORE_free(ctx); crypto/bio/bio_lib.c:506:1: start of procedure BIO_free_all() 504. } 505. 506. > void BIO_free_all(BIO *bio) 507. { 508. BIO *b; crypto/bio/bio_lib.c:511:9: Loop condition is false. Leaving loop 509. int ref; 510. 511. while (bio != NULL) ^ 512. { 513. b=bio; crypto/bio/bio_lib.c:520:2: return from a call to BIO_free_all 518. if (ref > 1) break; 519. } 520. } ^ 521. 522. BIO *BIO_dup_chain(BIO *in) apps/x509.c:1106:2: 1104. NCONF_free(extconf); 1105. BIO_free_all(out); 1106. > BIO_free_all(STDout); 1107. X509_STORE_free(ctx); 1108. X509_REQ_free(req); crypto/bio/bio_lib.c:506:1: start of procedure BIO_free_all() 504. } 505. 506. > void BIO_free_all(BIO *bio) 507. { 508. BIO *b; crypto/bio/bio_lib.c:511:9: Loop condition is false. Leaving loop 509. int ref; 510. 511. while (bio != NULL) ^ 512. { 513. b=bio; crypto/bio/bio_lib.c:520:2: return from a call to BIO_free_all 518. if (ref > 1) break; 519. } 520. } ^ 521. 522. BIO *BIO_dup_chain(BIO *in) apps/x509.c:1107:2: 1105. BIO_free_all(out); 1106. BIO_free_all(STDout); 1107. > X509_STORE_free(ctx); 1108. X509_REQ_free(req); 1109. X509_free(x);
https://github.com/openssl/openssl/blob/ec4a50b3c3f2f50caccfd52e939857a5d6f02fd1/apps/x509.c/#L1107
d2a_code_trace_data_43081
static int dnxhd_init_rc(DNXHDEncContext *ctx) { CHECKED_ALLOCZ(ctx->mb_rc, 8160*ctx->m.avctx->qmax*sizeof(RCEntry)); if (ctx->m.avctx->mb_decision != FF_MB_DECISION_RD) CHECKED_ALLOCZ(ctx->mb_cmp, ctx->m.mb_num*sizeof(RCCMPEntry)); ctx->frame_bits = (ctx->cid_table->coding_unit_size - 640 - 4) * 8; ctx->qscale = 1; ctx->lambda = 2<<LAMBDA_FRAC_BITS; return 0; fail: return -1; } libavcodec/dnxhdenc.c:210: error: Integer Overflow L2 ([-640, +oo] - 4):unsigned32 by call to `dnxhd_init_rc`. libavcodec/dnxhdenc.c:188:5: Call 186. ctx->m.h263_aic = 1; 187. 188. dsputil_init(&ctx->m.dsp, avctx); ^ 189. ff_dct_common_init(&ctx->m); 190. if (!ctx->m.dct_quantize) libavcodec/dsputil.c:4115:1: Parameter `c->idct_permutation[*]` 4113. } 4114. 4115. void dsputil_init(DSPContext* c, AVCodecContext *avctx) ^ 4116. { 4117. int i; libavcodec/dnxhdenc.c:189:5: Call 187. 188. dsputil_init(&ctx->m.dsp, avctx); 189. ff_dct_common_init(&ctx->m); ^ 190. if (!ctx->m.dct_quantize) 191. ctx->m.dct_quantize = dct_quantize_c; libavcodec/mpegvideo.c:113:1: Parameter `s->intra_v_scantable.raster_end[*].*.strlen` 111. 112. /* init common dct for both encoder and decoder */ 113. int ff_dct_common_init(MpegEncContext *s) ^ 114. { 115. s->dct_unquantize_h263_intra = dct_unquantize_h263_intra_c; libavcodec/mpegvideo.c:151:5: Call 149. } 150. ff_init_scantable(s->dsp.idct_permutation, &s->intra_h_scantable, ff_alternate_horizontal_scan); 151. ff_init_scantable(s->dsp.idct_permutation, &s->intra_v_scantable, ff_alternate_vertical_scan); ^ 152. 153. return 0; libavcodec/dsputil.c:154:1: Parameter `st->raster_end[*]` 152. }; 153. 154. void ff_init_scantable(uint8_t *permutation, ScanTable *st, const uint8_t *src_scantable){ ^ 155. int i; 156. int end; libavcodec/dnxhdenc.c:205:9: Call 203. if (avctx->intra_quant_bias != FF_DEFAULT_QUANT_BIAS) 204. ctx->m.intra_quant_bias = avctx->intra_quant_bias; 205. if (dnxhd_init_qmat(ctx, ctx->m.intra_quant_bias, 0) < 0) // XXX tune lbias/cbias ^ 206. return -1; 207. libavcodec/dnxhdenc.c:120:1: Parameter `ctx->m.dsp.idct_permutation[*]` 118. } 119. 120. static int dnxhd_init_qmat(DNXHDEncContext *ctx, int lbias, int cbias) ^ 121. { 122. // init first elem to 1 to avoid div by 0 in convert_matrix libavcodec/dnxhdenc.c:208:9: Call 206. return -1; 207. 208. if (dnxhd_init_vlc(ctx) < 0) ^ 209. return -1; 210. if (dnxhd_init_rc(ctx) < 0) libavcodec/dnxhdenc.c:91:1: Parameter `*ctx->cid_table->run_codes` 89. #define LAMBDA_FRAC_BITS 10 90. 91. static int dnxhd_init_vlc(DNXHDEncContext *ctx) ^ 92. { 93. int i; libavcodec/dnxhdenc.c:210:9: Call 208. if (dnxhd_init_vlc(ctx) < 0) 209. return -1; 210. if (dnxhd_init_rc(ctx) < 0) ^ 211. return -1; 212. libavcodec/dnxhdenc.c:155:1: <LHS trace> 153. } 154. 155. static int dnxhd_init_rc(DNXHDEncContext *ctx) ^ 156. { 157. CHECKED_ALLOCZ(ctx->mb_rc, 8160*ctx->m.avctx->qmax*sizeof(RCEntry)); libavcodec/dnxhdenc.c:155:1: Parameter `ctx->cid_table->coding_unit_size` 153. } 154. 155. static int dnxhd_init_rc(DNXHDEncContext *ctx) ^ 156. { 157. CHECKED_ALLOCZ(ctx->mb_rc, 8160*ctx->m.avctx->qmax*sizeof(RCEntry)); libavcodec/dnxhdenc.c:161:5: Binary operation: ([-640, +oo] - 4):unsigned32 by call to `dnxhd_init_rc` 159. CHECKED_ALLOCZ(ctx->mb_cmp, ctx->m.mb_num*sizeof(RCCMPEntry)); 160. 161. ctx->frame_bits = (ctx->cid_table->coding_unit_size - 640 - 4) * 8; ^ 162. ctx->qscale = 1; 163. ctx->lambda = 2<<LAMBDA_FRAC_BITS; // qscale 2
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dnxhdenc.c/#L161
d2a_code_trace_data_43082
int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; if (pkt->buf->length > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = (pkt->buf->length == 0) ? DEFAULT_BUF_SIZE : pkt->buf->length * 2; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; pkt->written += len; pkt->curr += len; return 1; } ssl/t1_lib.c:1102: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + `s->srp_ctx.login->strlen` + `s->tlsext_hostname->strlen` + 33]):unsigned64 by call to `WPACKET_sub_memcpy__`. Showing all 12 steps of the trace ssl/t1_lib.c:1101:21: Call 1099. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats) 1100. /* Sub-packet for formats extension */ 1101. || !WPACKET_start_sub_packet_u16(pkt) ^ 1102. || !WPACKET_sub_memcpy_u8(pkt, pformats, num_formats) 1103. || !WPACKET_close(pkt)) { ssl/packet.c:201:1: Parameter `pkt->buf->length` 199. } 200. 201. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 202. { 203. WPACKET_SUB *sub; ssl/t1_lib.c:1102:21: Call 1100. /* Sub-packet for formats extension */ 1101. || !WPACKET_start_sub_packet_u16(pkt) 1102. || !WPACKET_sub_memcpy_u8(pkt, pformats, num_formats) ^ 1103. || !WPACKET_close(pkt)) { 1104. SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); ssl/packet.c:294:1: Parameter `pkt->written` 292. } 293. 294. > int WPACKET_sub_memcpy__(WPACKET *pkt, const void *src, size_t len, 295. size_t lenbytes) 296. { ssl/packet.c:297:10: Call 295. size_t lenbytes) 296. { 297. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) ^ 298. || !WPACKET_memcpy(pkt, src, len) 299. || !WPACKET_close(pkt)) ssl/packet.c:201:1: Parameter `pkt->written` 199. } 200. 201. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 202. { 203. WPACKET_SUB *sub; ssl/packet.c:225:10: Call 223. } 224. 225. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 226. return 0; 227. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */ ssl/packet.c:15:1: <LHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `pkt->buf->length` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: <RHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `len` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:25:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + pkt->written + s->srp_ctx.login->strlen + s->tlsext_hostname->strlen + 33]):unsigned64 by call to `WPACKET_sub_memcpy__` 23. return 0; 24. 25. if (pkt->buf->length - pkt->written < len) { ^ 26. size_t newlen; 27.
https://github.com/openssl/openssl/blob/84d5549e692e63a16fa1b11603e4098fc31746e9/ssl/packet.c/#L25
d2a_code_trace_data_43083
int BN_num_bits_word(BN_ULONG l) { BN_ULONG x, mask; int bits = (l != 0); #if BN_BITS2 > 32 x = l >> 32; mask = (0 - x) & BN_MASK2; mask = (0 - (mask >> (BN_BITS2 - 1))); bits += 32 & mask; l ^= (x ^ l) & mask; #endif x = l >> 16; mask = (0 - x) & BN_MASK2; mask = (0 - (mask >> (BN_BITS2 - 1))); bits += 16 & mask; l ^= (x ^ l) & mask; x = l >> 8; mask = (0 - x) & BN_MASK2; mask = (0 - (mask >> (BN_BITS2 - 1))); bits += 8 & mask; l ^= (x ^ l) & mask; x = l >> 4; mask = (0 - x) & BN_MASK2; mask = (0 - (mask >> (BN_BITS2 - 1))); bits += 4 & mask; l ^= (x ^ l) & mask; x = l >> 2; mask = (0 - x) & BN_MASK2; mask = (0 - (mask >> (BN_BITS2 - 1))); bits += 2 & mask; l ^= (x ^ l) & mask; x = l >> 1; mask = (0 - x) & BN_MASK2; mask = (0 - (mask >> (BN_BITS2 - 1))); bits += 1 & mask; return bits; } crypto/ec/ecdsa_ossl.c:464: error: INTEGER_OVERFLOW_L2 (0 - [0, max(1, `eckey->group->order->top`)]):unsigned64 by call to `EC_POINT_mul`. Showing all 28 steps of the trace crypto/ec/ecdsa_ossl.c:377:1: Parameter `eckey->group->order->top` 375. } 376. 377. > int ossl_ecdsa_verify_sig(const unsigned char *dgst, int dgst_len, 378. const ECDSA_SIG *sig, EC_KEY *eckey) 379. { crypto/ec/ecdsa_ossl.c:429:10: Call 427. } 428. /* calculate tmp1 = inv(S) mod order */ 429. if (!ec_group_do_inverse_ord(group, u2, sig->s, ctx)) { ^ 430. ECerr(EC_F_OSSL_ECDSA_VERIFY_SIG, ERR_R_BN_LIB); 431. goto err; crypto/ec/ec_lib.c:1074:1: Parameter `group->order->top` 1072. * other functionality. 1073. */ 1074. > int ec_group_do_inverse_ord(const EC_GROUP *group, BIGNUM *res, 1075. const BIGNUM *x, BN_CTX *ctx) 1076. { crypto/ec/ecdsa_ossl.c:434:9: Call 432. } 433. /* digest -> m */ 434. i = BN_num_bits(order); ^ 435. /* 436. * Need to truncate digest if it is too long: first truncate whole bytes. crypto/bn/bn_lib.c:140:9: Call 138. bn_check_top(a); 139. 140. if (BN_is_zero(a)) ^ 141. return 0; 142. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); crypto/bn/bn_lib.c:853:1: Parameter `a->top` 851. } 852. 853. > int BN_is_zero(const BIGNUM *a) 854. { 855. return a->top == 0; crypto/ec/ecdsa_ossl.c:450:10: Call 448. } 449. /* u1 = m * tmp mod order */ 450. if (!BN_mod_mul(u1, m, u2, order, ctx)) { ^ 451. ECerr(EC_F_OSSL_ECDSA_VERIFY_SIG, ERR_R_BN_LIB); 452. goto err; crypto/bn/bn_mod.c:73:1: Parameter `m->top` 71. 72. /* slow but works */ 73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 74. BN_CTX *ctx) 75. { crypto/ec/ecdsa_ossl.c:455:10: Call 453. } 454. /* u2 = r * w mod q */ 455. if (!BN_mod_mul(u2, sig->r, u2, order, ctx)) { ^ 456. ECerr(EC_F_OSSL_ECDSA_VERIFY_SIG, ERR_R_BN_LIB); 457. goto err; crypto/bn/bn_mod.c:73:1: Parameter `m->top` 71. 72. /* slow but works */ 73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 74. BN_CTX *ctx) 75. { crypto/ec/ecdsa_ossl.c:464:10: Call 462. goto err; 463. } 464. if (!EC_POINT_mul(group, point, u1, pub_key, u2, ctx)) { ^ 465. ECerr(EC_F_OSSL_ECDSA_VERIFY_SIG, ERR_R_EC_LIB); 466. goto err; crypto/ec/ec_lib.c:929:1: Parameter `group->order->top` 927. } 928. 929. > int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, 930. const EC_POINT *point, const BIGNUM *p_scalar, BN_CTX *ctx) 931. { crypto/ec/ec_lib.c:940:12: Call 938. scalars[0] = p_scalar; 939. 940. return EC_POINTs_mul(group, r, g_scalar, ^ 941. (point != NULL 942. && p_scalar != NULL), points, scalars, ctx); crypto/ec/ec_lib.c:918:1: Parameter `group->order->top` 916. */ 917. 918. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 919. size_t num, const EC_POINT *points[], 920. const BIGNUM *scalars[], BN_CTX *ctx) crypto/ec/ec_lib.c:924:16: Call 922. if (group->meth->mul == 0) 923. /* use default */ 924. return ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx); ^ 925. 926. return group->meth->mul(group, r, scalar, num, points, scalars, ctx); crypto/ec/ec_mult.c:401:1: Parameter `group->order->top` 399. * in the addition if scalar != NULL 400. */ 401. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 402. size_t num, const EC_POINT *points[], const BIGNUM *scalars[], 403. BN_CTX *ctx) crypto/ec/ec_mult.c:439:10: Call 437. } 438. 439. if (!BN_is_zero(group->order) && !BN_is_zero(group->cofactor)) { ^ 440. /*- 441. * Handle the common cases where the scalar is secret, enforcing a crypto/bn/bn_lib.c:853:1: Parameter `a->top` 851. } 852. 853. > int BN_is_zero(const BIGNUM *a) 854. { 855. return a->top == 0; crypto/ec/ec_mult.c:454:20: Call 452. * always call the ladder version. 453. */ 454. return ec_scalar_mul_ladder(group, r, scalar, NULL, ctx); ^ 455. } 456. if ((scalar == NULL) && (num == 1)) { crypto/ec/ec_mult.c:133:1: Parameter `group->order->top` 131. * Returns 1 on success, 0 otherwise. 132. */ 133. > static 134. int ec_scalar_mul_ladder(const EC_GROUP *group, EC_POINT *r, 135. const BIGNUM *scalar, const EC_POINT *point, crypto/ec/ec_mult.c:186:10: Call 184. } 185. 186. if (!BN_mul(cardinality, group->order, group->cofactor, ctx)) { ^ 187. ECerr(EC_F_EC_SCALAR_MUL_LADDER, ERR_R_BN_LIB); 188. goto err; crypto/bn/bn_mul.c:497:1: Parameter `a->top` 495. #endif /* BN_RECURSION */ 496. 497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = 0; crypto/bn/bn_mul.c:514:5: Assignment 512. bn_check_top(r); 513. 514. al = a->top; ^ 515. bl = b->top; 516. crypto/bn/bn_mul.c:561:21: Call 559. */ 560. if (i >= 0) { 561. j = BN_num_bits_word((BN_ULONG)al); ^ 562. } 563. if (i == -1) { crypto/bn/bn_lib.c:90:1: <RHS trace> 88. } 89. 90. > int BN_num_bits_word(BN_ULONG l) 91. { 92. BN_ULONG x, mask; crypto/bn/bn_lib.c:90:1: Parameter `l` 88. } 89. 90. > int BN_num_bits_word(BN_ULONG l) 91. { 92. BN_ULONG x, mask; crypto/bn/bn_lib.c:96:5: Assignment 94. 95. #if BN_BITS2 > 32 96. x = l >> 32; ^ 97. mask = (0 - x) & BN_MASK2; 98. mask = (0 - (mask >> (BN_BITS2 - 1))); crypto/bn/bn_lib.c:97:5: Binary operation: (0 - [0, max(1, eckey->group->order->top)]):unsigned64 by call to `EC_POINT_mul` 95. #if BN_BITS2 > 32 96. x = l >> 32; 97. mask = (0 - x) & BN_MASK2; ^ 98. mask = (0 - (mask >> (BN_BITS2 - 1))); 99. bits += 32 & mask;
https://github.com/openssl/openssl/blob/66b0bca887eb4ad1f5758e56c45905fb3fc36667/crypto/bn/bn_lib.c/#L97
d2a_code_trace_data_43084
static int pbe_test_init(EVP_TEST *t, const char *alg) { PBE_DATA *pdat; int pbe_type = 0; if (strcmp(alg, "scrypt") == 0) { #ifndef OPENSSL_NO_SCRYPT pbe_type = PBE_TYPE_SCRYPT; #else t->skip = 1; return 1; #endif } else if (strcmp(alg, "pbkdf2") == 0) { pbe_type = PBE_TYPE_PBKDF2; } else if (strcmp(alg, "pkcs12") == 0) { pbe_type = PBE_TYPE_PKCS12; } else { TEST_error("Unknown pbe algorithm %s", alg); } pdat = OPENSSL_malloc(sizeof(*pdat)); pdat->pbe_type = pbe_type; pdat->pass = NULL; pdat->salt = NULL; pdat->N = 0; pdat->r = 0; pdat->p = 0; pdat->maxmem = 0; pdat->id = 0; pdat->iter = 0; pdat->md = NULL; t->data = pdat; return 1; } test/evp_test.c:1641: error: NULL_DEREFERENCE pointer `pdat` last assigned on line 1640 could be null and is dereferenced at line 1641, column 5. Showing all 23 steps of the trace test/evp_test.c:1621:1: start of procedure pbe_test_init() 1619. } 1620. 1621. > static int pbe_test_init(EVP_TEST *t, const char *alg) 1622. { 1623. PBE_DATA *pdat; test/evp_test.c:1624:5: 1622. { 1623. PBE_DATA *pdat; 1624. > int pbe_type = 0; 1625. 1626. if (strcmp(alg, "scrypt") == 0) { test/evp_test.c:1626:9: Taking false branch 1624. int pbe_type = 0; 1625. 1626. if (strcmp(alg, "scrypt") == 0) { ^ 1627. #ifndef OPENSSL_NO_SCRYPT 1628. pbe_type = PBE_TYPE_SCRYPT; test/evp_test.c:1633:16: Taking false branch 1631. return 1; 1632. #endif 1633. } else if (strcmp(alg, "pbkdf2") == 0) { ^ 1634. pbe_type = PBE_TYPE_PBKDF2; 1635. } else if (strcmp(alg, "pkcs12") == 0) { test/evp_test.c:1635:16: Taking false branch 1633. } else if (strcmp(alg, "pbkdf2") == 0) { 1634. pbe_type = PBE_TYPE_PBKDF2; 1635. } else if (strcmp(alg, "pkcs12") == 0) { ^ 1636. pbe_type = PBE_TYPE_PKCS12; 1637. } else { test/evp_test.c:1638:9: 1636. pbe_type = PBE_TYPE_PKCS12; 1637. } else { 1638. > TEST_error("Unknown pbe algorithm %s", alg); 1639. } 1640. pdat = OPENSSL_malloc(sizeof(*pdat)); test/testutil/tests.c:386:1: start of procedure test_error() 384. } 385. 386. > void test_error(const char *file, int line, const char *desc, ...) 387. { 388. va_list ap; test/testutil/tests.c:390:5: 388. va_list ap; 389. 390. > va_start(ap, desc); 391. test_fail_message_va(NULL, file, line, NULL, NULL, NULL, NULL, desc, ap); 392. va_end(ap); test/testutil/tests.c:391:5: Skipping test_fail_message_va(): empty list of specs 389. 390. va_start(ap, desc); 391. test_fail_message_va(NULL, file, line, NULL, NULL, NULL, NULL, desc, ap); ^ 392. va_end(ap); 393. } test/testutil/tests.c:392:5: 390. va_start(ap, desc); 391. test_fail_message_va(NULL, file, line, NULL, NULL, NULL, NULL, desc, ap); 392. > va_end(ap); 393. } 394. test/testutil/tests.c:393:1: return from a call to test_error 391. test_fail_message_va(NULL, file, line, NULL, NULL, NULL, NULL, desc, ap); 392. va_end(ap); 393. > } 394. 395. void test_openssl_errors(void) test/evp_test.c:1640:5: 1638. TEST_error("Unknown pbe algorithm %s", alg); 1639. } 1640. > pdat = OPENSSL_malloc(sizeof(*pdat)); 1641. pdat->pbe_type = pbe_type; 1642. pdat->pass = NULL; crypto/mem.c:158:1: start of procedure CRYPTO_malloc() 156. #endif 157. 158. > void *CRYPTO_malloc(size_t num, const char *file, int line) 159. { 160. void *ret = NULL; crypto/mem.c:160:5: 158. void *CRYPTO_malloc(size_t num, const char *file, int line) 159. { 160. > void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:162:9: Taking false branch 160. void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 163. return malloc_impl(num, file, line); 164. crypto/mem.c:165:9: Taking false branch 163. return malloc_impl(num, file, line); 164. 165. if (num == 0) ^ 166. return NULL; 167. crypto/mem.c:169:5: 167. 168. FAILTEST(); 169. > allow_customize = 0; 170. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 171. if (call_malloc_debug) { crypto/mem.c:179:5: 177. } 178. #else 179. > osslargused(file); osslargused(line); 180. ret = malloc(num); 181. #endif crypto/mem.c:179:24: 177. } 178. #else 179. > osslargused(file); osslargused(line); 180. ret = malloc(num); 181. #endif crypto/mem.c:180:5: 178. #else 179. osslargused(file); osslargused(line); 180. > ret = malloc(num); 181. #endif 182. crypto/mem.c:183:5: 181. #endif 182. 183. > return ret; 184. } 185. crypto/mem.c:184:1: return from a call to CRYPTO_malloc 182. 183. return ret; 184. > } 185. 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) test/evp_test.c:1641:5: 1639. } 1640. pdat = OPENSSL_malloc(sizeof(*pdat)); 1641. > pdat->pbe_type = pbe_type; 1642. pdat->pass = NULL; 1643. pdat->salt = NULL;
https://github.com/openssl/openssl/blob/69b4c01fd26e6eb72b156ed3014522c3295a7669/test/evp_test.c/#L1641
d2a_code_trace_data_43085
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:616: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `bitstream_read_bit`. libavcodec/takdec.c:615:24: Call 613. return AVERROR_INVALIDDATA; 614. 615. dshift = bits_esc4(bc); ^ 616. filter_order = 8 << bitstream_read_bit(bc); 617. dval1 = bitstream_read_bit(bc); libavcodec/takdec.c:370:16: Call 368. { 369. if (bitstream_read_bit(bc)) 370. return bitstream_read(bc, 4) + 1; ^ 371. else 372. return 0; libavcodec/bitstream.h:183:1: Parameter `bc->bits_left` 181. 182. /* Return n bits from the buffer. n has to be in the 0-32 range. */ 183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n) ^ 184. { 185. if (!n) libavcodec/takdec.c:616:29: Call 614. 615. dshift = bits_esc4(bc); 616. filter_order = 8 << bitstream_read_bit(bc); ^ 617. dval1 = bitstream_read_bit(bc); 618. dval2 = bitstream_read_bit(bc); libavcodec/bitstream.h:145:1: Parameter `bc->bits_left` 143. 144. /* Return one bit from the buffer. */ 145. static inline unsigned bitstream_read_bit(BitstreamContext *bc) ^ 146. { 147. if (!bc->bits_left) libavcodec/bitstream.h:150:12: Call 148. refill_64(bc); 149. 150. return get_val(bc, 1); ^ 151. } 152. libavcodec/bitstream.h:130:1: <LHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `bc->bits_left` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: <RHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `bitstream_read_bit` 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_43086
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) { bn_check_top(b); if (a == b) return a; if (bn_wexpand(a, b->top) == NULL) return NULL; if (b->top > 0) memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); a->neg = b->neg; a->top = b->top; a->flags |= b->flags & BN_FLG_FIXED_TOP; bn_check_top(a); return a; } crypto/srp/srp_lib.c:204: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_mod_exp`. Showing all 38 steps of the trace crypto/srp/srp_lib.c:176:1: Parameter `N->top` 174. } 175. 176. > BIGNUM *SRP_Calc_client_key(const BIGNUM *N, const BIGNUM *B, const BIGNUM *g, 177. const BIGNUM *x, const BIGNUM *a, const BIGNUM *u) 178. { crypto/srp/srp_lib.c:191:10: Call 189. goto err; 190. 191. if (!BN_mod_exp(tmp, g, x, N, bn_ctx)) ^ 192. goto err; 193. if ((k = srp_Calc_k(N, g)) == NULL) crypto/bn/bn_exp.c:89:1: Parameter `m->top` 87. } 88. 89. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 90. BN_CTX *ctx) 91. { crypto/bn/bn_exp.c:134:9: Call 132. 133. #ifdef MONT_MUL_MOD 134. if (BN_is_odd(m)) { ^ 135. # ifdef MONT_EXP_WORD 136. if (a->top == 1 && !a->neg crypto/bn/bn_lib.c:858:1: Parameter `a->top` 856. } 857. 858. > int BN_is_odd(const BIGNUM *a) 859. { 860. return (a->top > 0) && (a->d[0] & 1); 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:1127:1: Parameter `m->top` 1125. } 1126. 1127. > int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p, 1128. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 1129. { crypto/srp/srp_lib.c:193:14: Call 191. if (!BN_mod_exp(tmp, g, x, N, bn_ctx)) 192. goto err; 193. if ((k = srp_Calc_k(N, g)) == NULL) ^ 194. goto err; 195. if (!BN_mod_mul(tmp2, tmp, k, N, bn_ctx)) crypto/srp/srp_lib.c:46:1: Parameter `N->top` 44. } 45. 46. > static BIGNUM *srp_Calc_k(const BIGNUM *N, const BIGNUM *g) 47. { 48. /* k = SHA1(N | PAD(g)) -- tls-srp RFC 5054 */ crypto/srp/srp_lib.c:49:12: Call 47. { 48. /* k = SHA1(N | PAD(g)) -- tls-srp RFC 5054 */ 49. return srp_Calc_xy(N, g, N); ^ 50. } 51. crypto/srp/srp_lib.c:23:1: Parameter `N->top` 21. /* calculate = SHA1(PAD(x) || PAD(y)) */ 22. 23. > static BIGNUM *srp_Calc_xy(const BIGNUM *x, const BIGNUM *y, const BIGNUM *N) 24. { 25. unsigned char digest[SHA_DIGEST_LENGTH]; crypto/srp/srp_lib.c:27:16: Call 25. unsigned char digest[SHA_DIGEST_LENGTH]; 26. unsigned char *tmp = NULL; 27. int numN = BN_num_bytes(N); ^ 28. BIGNUM *res = NULL; 29. crypto/bn/bn_lib.c:140:9: Call 138. bn_check_top(a); 139. 140. if (BN_is_zero(a)) ^ 141. return 0; 142. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); crypto/bn/bn_lib.c:843:1: Parameter `a->top` 841. } 842. 843. > int BN_is_zero(const BIGNUM *a) 844. { 845. return a->top == 0; crypto/srp/srp_lib.c:195:10: Call 193. if ((k = srp_Calc_k(N, g)) == NULL) 194. goto err; 195. if (!BN_mod_mul(tmp2, tmp, k, N, bn_ctx)) ^ 196. goto err; 197. if (!BN_mod_sub(tmp, B, tmp2, N, bn_ctx)) crypto/bn/bn_mod.c:193:1: Parameter `m->top` 191. 192. /* slow but works */ 193. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 194. BN_CTX *ctx) 195. { crypto/srp/srp_lib.c:197:10: Call 195. if (!BN_mod_mul(tmp2, tmp, k, N, bn_ctx)) 196. goto err; 197. if (!BN_mod_sub(tmp, B, tmp2, N, bn_ctx)) ^ 198. goto err; 199. if (!BN_mul(tmp3, u, x, bn_ctx)) crypto/bn/bn_mod.c:106:1: Parameter `m->top` 104. } 105. 106. > int BN_mod_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 107. BN_CTX *ctx) 108. { crypto/srp/srp_lib.c:204:23: Call 202. goto err; 203. K = BN_new(); 204. if (K != NULL && !BN_mod_exp(K, tmp, tmp2, N, bn_ctx)) { ^ 205. BN_free(K); 206. K = NULL; crypto/bn/bn_exp.c:89:1: Parameter `m->top` 87. } 88. 89. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 90. BN_CTX *ctx) 91. { crypto/bn/bn_exp.c:134:9: Call 132. 133. #ifdef MONT_MUL_MOD 134. if (BN_is_odd(m)) { ^ 135. # ifdef MONT_EXP_WORD 136. if (a->top == 1 && !a->neg crypto/bn/bn_lib.c:858:1: Parameter `a->top` 856. } 857. 858. > int BN_is_odd(const BIGNUM *a) 859. { 860. return (a->top > 0) && (a->d[0] & 1); 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:1127:1: Parameter `m->top` 1125. } 1126. 1127. > int BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p, 1128. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 1129. { crypto/bn/bn_exp.c:1163:10: Call 1161. bn_check_top(m); 1162. 1163. if (!BN_is_odd(m)) { ^ 1164. BNerr(BN_F_BN_MOD_EXP_MONT_WORD, BN_R_CALLED_WITH_EVEN_MODULUS); 1165. return 0; crypto/bn/bn_lib.c:858:1: Parameter `a->top` 856. } 857. 858. > int BN_is_odd(const BIGNUM *a) 859. { 860. return (a->top > 0) && (a->d[0] & 1); crypto/bn/bn_exp.c:1198:14: Call 1196. if ((mont = BN_MONT_CTX_new()) == NULL) 1197. goto err; 1198. if (!BN_MONT_CTX_set(mont, m, ctx)) ^ 1199. goto err; 1200. } crypto/bn/bn_mont.c:263:1: Parameter `mod->top` 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:268:9: Call 266. BIGNUM *Ri, *R; 267. 268. if (BN_is_zero(mod)) ^ 269. return 0; 270. crypto/bn/bn_lib.c:843:1: Parameter `a->top` 841. } 842. 843. > int BN_is_zero(const BIGNUM *a) 844. { 845. return a->top == 0; crypto/bn/bn_mont.c:275:10: Call 273. goto err; 274. R = &(mont->RR); /* grab RR as a temp */ 275. if (!BN_copy(&(mont->N), mod)) ^ 276. goto err; /* Set N */ 277. if (BN_get_flags(mod, BN_FLG_CONSTTIME) != 0) crypto/bn/bn_lib.c:281:1: <Offset trace> 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:281:1: Parameter `b->top` 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:281:1: <Length trace> 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:281:1: Parameter `*a->d` 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:287:9: Call 285. if (a == b) 286. return a; 287. if (bn_wexpand(a, b->top) == NULL) ^ 288. return NULL; 289. crypto/bn/bn_lib.c:939:1: Parameter `*a->d` 937. } 938. 939. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 940. { 941. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:291:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_mod_exp` 289. 290. if (b->top > 0) 291. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); ^ 292. 293. a->neg = b->neg;
https://github.com/openssl/openssl/blob/ea09abc80892920ee5db4de82bed7a193b5896f0/crypto/bn/bn_lib.c/#L291
d2a_code_trace_data_43087
static void build_file_streams(void) { FFStream *stream, *stream_next; int i, ret; for(stream = first_stream; stream != NULL; stream = stream_next) { AVFormatContext *infile = NULL; stream_next = stream->next; if (stream->stream_type == STREAM_TYPE_LIVE && !stream->feed) { if (stream->fmt && !strcmp(stream->fmt->name, "rtp")) { av_dict_set(&stream->in_opts, "mpeg2ts_compute_pcr", "1", 0); } http_log("Opening file '%s'\n", stream->feed_filename); if ((ret = avformat_open_input(&infile, stream->feed_filename, stream->ifmt, &stream->in_opts)) < 0) { http_log("Could not open '%s': %d\n", stream->feed_filename, ret); fail: remove_stream(stream); } else { if (avformat_find_stream_info(infile, NULL) < 0) { http_log("Could not find codec parameters from '%s'\n", stream->feed_filename); avformat_close_input(&infile); goto fail; } extract_mpeg4_header(infile); for(i=0;i<infile->nb_streams;i++) add_av_stream1(stream, infile->streams[i]->codec, 1); avformat_close_input(&infile); } } } } avserver.c:3617: error: Memory Leak `stream` is not reachable after line 3617, column 14. avserver.c:3607:1: start of procedure build_file_streams() 3605. 3606. /* compute the needed AVStream for each file */ 3607. static void build_file_streams(void) ^ 3608. { 3609. FFStream *stream, *stream_next; avserver.c:3613:9: 3611. 3612. /* gather all streams */ 3613. for(stream = first_stream; stream != NULL; stream = stream_next) { ^ 3614. AVFormatContext *infile = NULL; 3615. stream_next = stream->next; avserver.c:3613:32: Loop condition is true. Entering loop body 3611. 3612. /* gather all streams */ 3613. for(stream = first_stream; stream != NULL; stream = stream_next) { ^ 3614. AVFormatContext *infile = NULL; 3615. stream_next = stream->next; avserver.c:3614:9: 3612. /* gather all streams */ 3613. for(stream = first_stream; stream != NULL; stream = stream_next) { 3614. AVFormatContext *infile = NULL; ^ 3615. stream_next = stream->next; 3616. if (stream->stream_type == STREAM_TYPE_LIVE && avserver.c:3615:9: 3613. for(stream = first_stream; stream != NULL; stream = stream_next) { 3614. AVFormatContext *infile = NULL; 3615. stream_next = stream->next; ^ 3616. if (stream->stream_type == STREAM_TYPE_LIVE && 3617. !stream->feed) { avserver.c:3616:13: Taking true branch 3614. AVFormatContext *infile = NULL; 3615. stream_next = stream->next; 3616. if (stream->stream_type == STREAM_TYPE_LIVE && ^ 3617. !stream->feed) { 3618. /* the stream comes from a file */ avserver.c:3617:14: Taking true branch 3615. stream_next = stream->next; 3616. if (stream->stream_type == STREAM_TYPE_LIVE && 3617. !stream->feed) { ^ 3618. /* the stream comes from a file */ 3619. /* try to open the file */ avserver.c:3621:17: Taking false branch 3619. /* try to open the file */ 3620. /* open stream */ 3621. if (stream->fmt && !strcmp(stream->fmt->name, "rtp")) { ^ 3622. /* specific case : if transport stream output to RTP, 3623. we use a raw transport stream reader */ avserver.c:3627:13: 3625. } 3626. 3627. http_log("Opening file '%s'\n", stream->feed_filename); ^ 3628. if ((ret = avformat_open_input(&infile, stream->feed_filename, stream->ifmt, &stream->in_opts)) < 0) { 3629. http_log("Could not open '%s': %d\n", stream->feed_filename, ret); avserver.c:420:1: start of procedure http_log() 418. 419. #ifdef __GNUC__ 420. __attribute__ ((format (printf, 1, 2))) ^ 421. #endif 422. static void http_log(const char *fmt, ...) avserver.c:425:5: 423. { 424. va_list vargs; 425. va_start(vargs, fmt); ^ 426. http_vlog(fmt, vargs); 427. va_end(vargs); avserver.c:426:5: 424. va_list vargs; 425. va_start(vargs, fmt); 426. http_vlog(fmt, vargs); ^ 427. va_end(vargs); 428. } avserver.c:404:1: start of procedure http_vlog() 402. } 403. 404. static void http_vlog(const char *fmt, va_list vargs) ^ 405. { 406. static int print_prefix = 1; avserver.c:406:5: 404. static void http_vlog(const char *fmt, va_list vargs) 405. { 406. static int print_prefix = 1; ^ 407. if (logfile) { 408. if (print_prefix) { avserver.c:407:9: Taking true branch 405. { 406. static int print_prefix = 1; 407. if (logfile) { ^ 408. if (print_prefix) { 409. char buf[32]; avserver.c:408:13: Taking true branch 406. static int print_prefix = 1; 407. if (logfile) { 408. if (print_prefix) { ^ 409. char buf[32]; 410. ctime1(buf); avserver.c:410:13: Skipping ctime1(): empty list of specs 408. if (print_prefix) { 409. char buf[32]; 410. ctime1(buf); ^ 411. fprintf(logfile, "%s ", buf); 412. } avserver.c:411:13: 409. char buf[32]; 410. ctime1(buf); 411. fprintf(logfile, "%s ", buf); ^ 412. } 413. print_prefix = strstr(fmt, "\n") != NULL; avserver.c:413:24: Condition is true 411. fprintf(logfile, "%s ", buf); 412. } 413. print_prefix = strstr(fmt, "\n") != NULL; ^ 414. vfprintf(logfile, fmt, vargs); 415. fflush(logfile); avserver.c:413:9: 411. fprintf(logfile, "%s ", buf); 412. } 413. print_prefix = strstr(fmt, "\n") != NULL; ^ 414. vfprintf(logfile, fmt, vargs); 415. fflush(logfile); avserver.c:414:9: 412. } 413. print_prefix = strstr(fmt, "\n") != NULL; 414. vfprintf(logfile, fmt, vargs); ^ 415. fflush(logfile); 416. } avserver.c:415:9: 413. print_prefix = strstr(fmt, "\n") != NULL; 414. vfprintf(logfile, fmt, vargs); 415. fflush(logfile); ^ 416. } 417. } avserver.c:407:5: 405. { 406. static int print_prefix = 1; 407. if (logfile) { ^ 408. if (print_prefix) { 409. char buf[32]; avserver.c:417:1: return from a call to http_vlog 415. fflush(logfile); 416. } 417. } ^ 418. 419. #ifdef __GNUC__ avserver.c:427:5: 425. va_start(vargs, fmt); 426. http_vlog(fmt, vargs); 427. va_end(vargs); ^ 428. } 429. avserver.c:428:1: return from a call to http_log 426. http_vlog(fmt, vargs); 427. va_end(vargs); 428. } ^ 429. 430. static void http_av_log(void *ptr, int level, const char *fmt, va_list vargs) avserver.c:3628:17: 3626. 3627. http_log("Opening file '%s'\n", stream->feed_filename); 3628. if ((ret = avformat_open_input(&infile, stream->feed_filename, stream->ifmt, &stream->in_opts)) < 0) { ^ 3629. http_log("Could not open '%s': %d\n", stream->feed_filename, ret); 3630. /* remove stream (no need to spend more time on it) */ libavformat/utils.c:381:1: start of procedure avformat_open_input() 379. } 380. 381. int avformat_open_input(AVFormatContext **ps, const char *filename, ^ 382. AVInputFormat *fmt, AVDictionary **options) 383. { libavformat/utils.c:384:5: 382. AVInputFormat *fmt, AVDictionary **options) 383. { 384. AVFormatContext *s = *ps; ^ 385. int ret = 0; 386. AVDictionary *tmp = NULL; libavformat/utils.c:385:5: 383. { 384. AVFormatContext *s = *ps; 385. int ret = 0; ^ 386. AVDictionary *tmp = NULL; 387. ID3v2ExtraMeta *id3v2_extra_meta = NULL; libavformat/utils.c:386:5: 384. AVFormatContext *s = *ps; 385. int ret = 0; 386. AVDictionary *tmp = NULL; ^ 387. ID3v2ExtraMeta *id3v2_extra_meta = NULL; 388. libavformat/utils.c:387:5: 385. int ret = 0; 386. AVDictionary *tmp = NULL; 387. ID3v2ExtraMeta *id3v2_extra_meta = NULL; ^ 388. 389. if (!s && !(s = avformat_alloc_context())) libavformat/utils.c:389:10: Taking true branch 387. ID3v2ExtraMeta *id3v2_extra_meta = NULL; 388. 389. if (!s && !(s = avformat_alloc_context())) ^ 390. return AVERROR(ENOMEM); 391. if (fmt) libavformat/utils.c:389:17: Taking true branch 387. ID3v2ExtraMeta *id3v2_extra_meta = NULL; 388. 389. if (!s && !(s = avformat_alloc_context())) ^ 390. return AVERROR(ENOMEM); 391. if (fmt) libavformat/utils.c:390:9: 388. 389. if (!s && !(s = avformat_alloc_context())) 390. return AVERROR(ENOMEM); ^ 391. if (fmt) 392. s->iformat = fmt; libavformat/utils.c:464:1: return from a call to avformat_open_input 462. *ps = NULL; 463. return ret; 464. } ^ 465. 466. /*******************************************************/ avserver.c:3628:17: Taking true branch 3626. 3627. http_log("Opening file '%s'\n", stream->feed_filename); 3628. if ((ret = avformat_open_input(&infile, stream->feed_filename, stream->ifmt, &stream->in_opts)) < 0) { ^ 3629. http_log("Could not open '%s': %d\n", stream->feed_filename, ret); 3630. /* remove stream (no need to spend more time on it) */ avserver.c:3629:17: 3627. http_log("Opening file '%s'\n", stream->feed_filename); 3628. if ((ret = avformat_open_input(&infile, stream->feed_filename, stream->ifmt, &stream->in_opts)) < 0) { 3629. http_log("Could not open '%s': %d\n", stream->feed_filename, ret); ^ 3630. /* remove stream (no need to spend more time on it) */ 3631. fail: avserver.c:420:1: start of procedure http_log() 418. 419. #ifdef __GNUC__ 420. __attribute__ ((format (printf, 1, 2))) ^ 421. #endif 422. static void http_log(const char *fmt, ...) avserver.c:425:5: 423. { 424. va_list vargs; 425. va_start(vargs, fmt); ^ 426. http_vlog(fmt, vargs); 427. va_end(vargs); avserver.c:426:5: 424. va_list vargs; 425. va_start(vargs, fmt); 426. http_vlog(fmt, vargs); ^ 427. va_end(vargs); 428. } avserver.c:404:1: start of procedure http_vlog() 402. } 403. 404. static void http_vlog(const char *fmt, va_list vargs) ^ 405. { 406. static int print_prefix = 1; avserver.c:406:5: 404. static void http_vlog(const char *fmt, va_list vargs) 405. { 406. static int print_prefix = 1; ^ 407. if (logfile) { 408. if (print_prefix) { avserver.c:407:9: Taking true branch 405. { 406. static int print_prefix = 1; 407. if (logfile) { ^ 408. if (print_prefix) { 409. char buf[32]; avserver.c:408:13: Taking true branch 406. static int print_prefix = 1; 407. if (logfile) { 408. if (print_prefix) { ^ 409. char buf[32]; 410. ctime1(buf); avserver.c:410:13: Skipping ctime1(): empty list of specs 408. if (print_prefix) { 409. char buf[32]; 410. ctime1(buf); ^ 411. fprintf(logfile, "%s ", buf); 412. } avserver.c:411:13: 409. char buf[32]; 410. ctime1(buf); 411. fprintf(logfile, "%s ", buf); ^ 412. } 413. print_prefix = strstr(fmt, "\n") != NULL; avserver.c:413:24: Condition is true 411. fprintf(logfile, "%s ", buf); 412. } 413. print_prefix = strstr(fmt, "\n") != NULL; ^ 414. vfprintf(logfile, fmt, vargs); 415. fflush(logfile); avserver.c:413:9: 411. fprintf(logfile, "%s ", buf); 412. } 413. print_prefix = strstr(fmt, "\n") != NULL; ^ 414. vfprintf(logfile, fmt, vargs); 415. fflush(logfile); avserver.c:414:9: 412. } 413. print_prefix = strstr(fmt, "\n") != NULL; 414. vfprintf(logfile, fmt, vargs); ^ 415. fflush(logfile); 416. } avserver.c:415:9: 413. print_prefix = strstr(fmt, "\n") != NULL; 414. vfprintf(logfile, fmt, vargs); 415. fflush(logfile); ^ 416. } 417. } avserver.c:407:5: 405. { 406. static int print_prefix = 1; 407. if (logfile) { ^ 408. if (print_prefix) { 409. char buf[32]; avserver.c:417:1: return from a call to http_vlog 415. fflush(logfile); 416. } 417. } ^ 418. 419. #ifdef __GNUC__ avserver.c:427:5: 425. va_start(vargs, fmt); 426. http_vlog(fmt, vargs); 427. va_end(vargs); ^ 428. } 429. avserver.c:428:1: return from a call to http_log 426. http_vlog(fmt, vargs); 427. va_end(vargs); 428. } ^ 429. 430. static void http_av_log(void *ptr, int level, const char *fmt, va_list vargs) avserver.c:3631:13: 3629. http_log("Could not open '%s': %d\n", stream->feed_filename, ret); 3630. /* remove stream (no need to spend more time on it) */ 3631. fail: ^ 3632. remove_stream(stream); 3633. } else { avserver.c:3632:17: Skipping remove_stream(): empty list of specs 3630. /* remove stream (no need to spend more time on it) */ 3631. fail: 3632. remove_stream(stream); ^ 3633. } else { 3634. /* find all the AVStreams inside and reference them in avserver.c:3613:48: 3611. 3612. /* gather all streams */ 3613. for(stream = first_stream; stream != NULL; stream = stream_next) { ^ 3614. AVFormatContext *infile = NULL; 3615. stream_next = stream->next; avserver.c:3613:32: Loop condition is true. Entering loop body 3611. 3612. /* gather all streams */ 3613. for(stream = first_stream; stream != NULL; stream = stream_next) { ^ 3614. AVFormatContext *infile = NULL; 3615. stream_next = stream->next; avserver.c:3614:9: 3612. /* gather all streams */ 3613. for(stream = first_stream; stream != NULL; stream = stream_next) { 3614. AVFormatContext *infile = NULL; ^ 3615. stream_next = stream->next; 3616. if (stream->stream_type == STREAM_TYPE_LIVE && avserver.c:3615:9: 3613. for(stream = first_stream; stream != NULL; stream = stream_next) { 3614. AVFormatContext *infile = NULL; 3615. stream_next = stream->next; ^ 3616. if (stream->stream_type == STREAM_TYPE_LIVE && 3617. !stream->feed) { avserver.c:3616:13: Taking true branch 3614. AVFormatContext *infile = NULL; 3615. stream_next = stream->next; 3616. if (stream->stream_type == STREAM_TYPE_LIVE && ^ 3617. !stream->feed) { 3618. /* the stream comes from a file */ avserver.c:3617:14: Taking false branch 3615. stream_next = stream->next; 3616. if (stream->stream_type == STREAM_TYPE_LIVE && 3617. !stream->feed) { ^ 3618. /* the stream comes from a file */ 3619. /* try to open the file */
https://github.com/libav/libav/blob/e46ad30a808744ddf3855567e162292a4eaabac7/avserver.c/#L3617
d2a_code_trace_data_43088
DECLAREContigPutFunc(put16bitbwtile) { int samplesperpixel = img->samplesperpixel; uint32** BWmap = img->BWmap; (void) y; while (h-- > 0) { uint16 *wp = (uint16 *) pp; for (x = w; x-- > 0;) { *cp++ = BWmap[*wp >> 8][0]; pp += 2 * samplesperpixel; wp += samplesperpixel; } cp += toskew; pp += fromskew; } } libtiff/tif_getimage.c:1169: error: Integer Overflow L2 ([0, `w`] - 1):unsigned32. libtiff/tif_getimage.c:1160:1: <LHS trace> 1158. * 16-bit greyscale => colormap/RGB 1159. */ 1160. DECLAREContigPutFunc(put16bitbwtile) ^ 1161. { 1162. int samplesperpixel = img->samplesperpixel; libtiff/tif_getimage.c:1160:1: Parameter `w` 1158. * 16-bit greyscale => colormap/RGB 1159. */ 1160. DECLAREContigPutFunc(put16bitbwtile) ^ 1161. { 1162. int samplesperpixel = img->samplesperpixel; libtiff/tif_getimage.c:1169:7: Assignment 1167. uint16 *wp = (uint16 *) pp; 1168. 1169. for (x = w; x-- > 0;) ^ 1170. { 1171. /* use high order byte of 16bit value */ libtiff/tif_getimage.c:1169:14: Binary operation: ([0, w] - 1):unsigned32 1167. uint16 *wp = (uint16 *) pp; 1168. 1169. for (x = w; x-- > 0;) ^ 1170. { 1171. /* use high order byte of 16bit value */
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_getimage.c/#L1169
d2a_code_trace_data_43089
static void contract(LHASH *lh) { LHASH_NODE **n,*n1,*np; np=lh->b[lh->p+lh->pmax-1]; lh->b[lh->p+lh->pmax-1]=NULL; if (lh->p == 0) { n=(LHASH_NODE **)OPENSSL_realloc(lh->b, (unsigned int)(sizeof(LHASH_NODE *)*lh->pmax)); if (n == NULL) { lh->error++; return; } lh->num_contract_reallocs++; lh->num_alloc_nodes/=2; lh->pmax/=2; lh->p=lh->pmax-1; lh->b=n; } else lh->p--; lh->num_nodes--; lh->num_contracts++; n1=lh->b[(int)lh->p]; if (n1 == NULL) lh->b[(int)lh->p]=np; else { while (n1->next != NULL) n1=n1->next; n1->next=np; } } ssl/s3_srvr.c:1486: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `ssl3_send_alert`. Showing all 14 steps of the trace ssl/s3_srvr.c:1272:4: Call 1270. #endif /* NO_KRB5 */ 1271. 1272. n=ssl3_get_message(s, ^ 1273. SSL3_ST_SR_KEY_EXCH_A, 1274. SSL3_ST_SR_KEY_EXCH_B, ssl/s3_both.c:337:1: Parameter `s->ctx->sessions->p` 335. * the body is read in state 'stn'. 336. */ 337. > long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok) 338. { 339. unsigned char *p; ssl/s3_srvr.c:1486:2: Call 1484. return(1); 1485. f_err: 1486. ssl3_send_alert(s,SSL3_AL_FATAL,al); ^ 1487. #if !defined(NO_DH) || !defined(NO_RSA) 1488. err: ssl/s3_pkt.c:1149:1: Parameter `s->ctx->sessions->p` 1147. } 1148. 1149. > void ssl3_send_alert(SSL *s, int level, int desc) 1150. { 1151. /* Map tls/ssl alert value to correct one */ ssl/s3_pkt.c:1156:3: Call 1154. /* If a fatal one, remove from cache */ 1155. if ((level == 2) && (s->session != NULL)) 1156. SSL_CTX_remove_session(s->ctx,s->session); ^ 1157. 1158. s->s3->alert_dispatch=1; ssl/ssl_sess.c:413:1: Parameter `ctx->sessions->p` 411. } 412. 413. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 414. { 415. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:415:9: Call 413. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 414. { 415. return remove_session_lock(ctx, c, 1); ^ 416. } 417. ssl/ssl_sess.c:418:1: Parameter `ctx->sessions->p` 416. } 417. 418. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 419. { 420. SSL_SESSION *r; ssl/ssl_sess.c:426:20: Call 424. { 425. if(lck) CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX); 426. r=(SSL_SESSION *)lh_delete(ctx->sessions,c); ^ 427. if (r != NULL) 428. { crypto/lhash/lhash.c:217:1: Parameter `lh->pmax` 215. } 216. 217. > void *lh_delete(LHASH *lh, void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:243:3: Call 241. if ((lh->num_nodes > MIN_NODES) && 242. (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes))) 243. contract(lh); ^ 244. 245. return(ret); crypto/lhash/lhash.c:352:1: <LHS trace> 350. } 351. 352. > static void contract(LHASH *lh) 353. { 354. LHASH_NODE **n,*n1,*np; crypto/lhash/lhash.c:352:1: Parameter `lh->p` 350. } 351. 352. > static void contract(LHASH *lh) 353. { 354. LHASH_NODE **n,*n1,*np; crypto/lhash/lhash.c:356:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `ssl3_send_alert` 354. LHASH_NODE **n,*n1,*np; 355. 356. np=lh->b[lh->p+lh->pmax-1]; ^ 357. lh->b[lh->p+lh->pmax-1]=NULL; /* 24/07-92 - eay - weird but :-( */ 358. if (lh->p == 0)
https://github.com/openssl/openssl/blob/f9b3bff6f7e38960bb87a5623fbcbc45ee952c49/crypto/lhash/lhash.c/#L356
d2a_code_trace_data_43090
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } apps/s_client.c:290: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_exp`. Showing all 61 steps of the trace apps/s_client.c:284:9: Call 282. int ret = 283. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && 284. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 && ^ 285. p != NULL && BN_rshift1(p, N) && 286. /* p = (N-1)/2 */ crypto/bn/bn_prime.c:183:12: Call 181. BN_GENCB *cb) 182. { 183. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb); ^ 184. } 185. crypto/bn/bn_prime.c:187:1: Parameter `ctx_passed->stack.depth` 185. 186. /* See FIPS 186-4 C.3.1 Miller Rabin Probabilistic Primality Test. */ 187. > int BN_is_prime_fasttest_ex(const BIGNUM *w, int checks, BN_CTX *ctx_passed, 188. int do_trial_division, BN_GENCB *cb) 189. { apps/s_client.c:290:9: Call 288. r != NULL && 289. /* verify g^((N-1)/2) == -1 (mod N) */ 290. BN_mod_exp(r, g, p, N, bn_ctx) && ^ 291. BN_add_word(r, 1) && BN_cmp(r, N) == 0; 292. crypto/bn/bn_exp.c:89:1: Parameter `ctx->stack.depth` 87. } 88. 89. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 90. BN_CTX *ctx) 91. { crypto/bn/bn_exp.c: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_exp.c:1189:5: Call 1187. } 1188. 1189. BN_CTX_start(ctx); ^ 1190. r = BN_CTX_get(ctx); 1191. t = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_exp.c:1190:9: Call 1188. 1189. BN_CTX_start(ctx); 1190. r = BN_CTX_get(ctx); ^ 1191. t = BN_CTX_get(ctx); 1192. 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_exp.c:1191:9: Call 1189. BN_CTX_start(ctx); 1190. r = BN_CTX_get(ctx); 1191. t = BN_CTX_get(ctx); ^ 1192. if (t == NULL) 1193. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_exp.c:1200:14: Call 1198. if ((mont = BN_MONT_CTX_new()) == NULL) 1199. goto err; 1200. if (!BN_MONT_CTX_set(mont, m, ctx)) ^ 1201. goto err; 1202. } crypto/bn/bn_mont.c:263:1: Parameter `ctx->stack.depth` 261. } 262. 263. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 264. { 265. int i, ret = 0; crypto/bn/bn_mont.c:271:5: Call 269. return 0; 270. 271. BN_CTX_start(ctx); ^ 272. if ((Ri = BN_CTX_get(ctx)) == NULL) 273. goto err; crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_mont.c:272:15: Call 270. 271. BN_CTX_start(ctx); 272. if ((Ri = BN_CTX_get(ctx)) == NULL) ^ 273. goto err; 274. R = &(mont->RR); /* grab RR as a temp */ crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_mont.c:351:19: Call 349. if (BN_is_one(&tmod)) 350. BN_zero(Ri); 351. else if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL) ^ 352. goto err; 353. if (!BN_lshift(Ri, Ri, BN_BITS2)) crypto/bn/bn_gcd.c:124:1: Parameter `ctx->stack.depth` 122. BN_CTX *ctx); 123. 124. > BIGNUM *BN_mod_inverse(BIGNUM *in, 125. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 126. { crypto/bn/bn_gcd.c:129:10: Call 127. BIGNUM *rv; 128. int noinv; 129. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv); ^ 130. if (noinv) 131. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); crypto/bn/bn_gcd.c:135:1: Parameter `ctx->stack.depth` 133. } 134. 135. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 136. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 137. int *pnoinv) crypto/bn/bn_gcd.c:155:16: Call 153. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) 154. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) { 155. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 156. } 157. crypto/bn/bn_gcd.c:458:1: Parameter `ctx->stack.depth` 456. * not contain branches that may leak sensitive information. 457. */ 458. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 459. const BIGNUM *a, const BIGNUM *n, 460. BN_CTX *ctx) crypto/bn/bn_gcd.c:469:5: Call 467. bn_check_top(n); 468. 469. BN_CTX_start(ctx); ^ 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gcd.c:470:9: Call 468. 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); ^ 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:471:9: Call 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); ^ 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:472:9: Call 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); ^ 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:473:9: Call 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); ^ 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:474:9: Call 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); ^ 475. Y = BN_CTX_get(ctx); 476. T = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:475:9: Call 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); ^ 476. T = BN_CTX_get(ctx); 477. if (T == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:476:9: Call 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); 476. T = BN_CTX_get(ctx); ^ 477. if (T == NULL) 478. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:504:18: Call 502. bn_init(&local_B); 503. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME); 504. if (!BN_nnmod(B, &local_B, A, ctx)) ^ 505. goto err; 506. /* Ensure local_B goes out of scope before any further use of B */ crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth` 207. * If 'dv' or 'rm' is NULL, the respective value is not returned. 208. */ 209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 210. BN_CTX *ctx) 211. { crypto/bn/bn_div.c:229:11: Call 227. } 228. 229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx); ^ 230. 231. if (ret) { crypto/bn/bn_div.c:264:1: Parameter `ctx->stack.depth` 262. * divisor's length is considered public; 263. */ 264. > int bn_div_fixed_top(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, 265. const BIGNUM *divisor, BN_CTX *ctx) 266. { crypto/bn/bn_div.c:280:5: Call 278. bn_check_top(rm); 279. 280. BN_CTX_start(ctx); ^ 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_div.c:282:11: Call 280. BN_CTX_start(ctx); 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); ^ 283. snum = BN_CTX_get(ctx); 284. sdiv = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_div.c:283:12: Call 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); 283. snum = BN_CTX_get(ctx); ^ 284. sdiv = BN_CTX_get(ctx); 285. if (sdiv == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_div.c:284:12: Call 282. tmp = BN_CTX_get(ctx); 283. snum = BN_CTX_get(ctx); 284. sdiv = BN_CTX_get(ctx); ^ 285. if (sdiv == NULL) 286. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_div.c:450:5: Call 448. if (rm != NULL) 449. bn_rshift_fixed_top(rm, snum, norm_shift); 450. BN_CTX_end(ctx); ^ 451. return 1; 452. err: crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <LHS trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_exp` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_43091
BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) { bn_check_top(b); if (a == b) return a; if (bn_wexpand(a, b->top) == NULL) return NULL; if (b->top > 0) memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); if (BN_get_flags(b, BN_FLG_CONSTTIME) != 0) BN_set_flags(a, BN_FLG_CONSTTIME); a->top = b->top; a->neg = b->neg; bn_check_top(a); return a; } ssl/statem/statem_srvr.c:3094: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `srp_generate_server_master_secret`. Showing all 20 steps of the trace ssl/statem/statem_srvr.c:3076:25: Call 3074. return 0; 3075. } 3076. if ((s->srp_ctx.A = BN_bin2bn(data, i, NULL)) == NULL) { ^ 3077. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CKE_SRP, 3078. ERR_R_BN_LIB); crypto/bn/bn_lib.c:416:9: Assignment 414. n = len; 415. if (n == 0) { 416. ret->top = 0; ^ 417. return ret; 418. } ssl/statem/statem_srvr.c:3094:10: Call 3092. } 3093. 3094. if (!srp_generate_server_master_secret(s)) { ^ 3095. /* SSLfatal() already called */ 3096. return 0; ssl/tls_srp.c:245:1: Parameter `s->srp_ctx.A->top` 243. } 244. 245. > int srp_generate_server_master_secret(SSL *s) 246. { 247. BIGNUM *K = NULL, *u = NULL; ssl/tls_srp.c:251:10: Call 249. unsigned char *tmp = NULL; 250. 251. if (!SRP_Verify_A_mod_N(s->srp_ctx.A, s->srp_ctx.N)) ^ 252. goto err; 253. if ((u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) == NULL) crypto/srp/srp_lib.c:233:1: Parameter `A->top` 231. } 232. 233. > int SRP_Verify_A_mod_N(const BIGNUM *A, const BIGNUM *N) 234. { 235. /* Checks if A % N == 0 */ crypto/srp/srp_lib.c:236:12: Call 234. { 235. /* Checks if A % N == 0 */ 236. return SRP_Verify_B_mod_N(A, N); ^ 237. } 238. crypto/srp/srp_lib.c:212:1: Parameter `B->top` 210. } 211. 212. > int SRP_Verify_B_mod_N(const BIGNUM *B, const BIGNUM *N) 213. { 214. BIGNUM *r; crypto/srp/srp_lib.c:224:10: Call 222. goto err; 223. /* Checks if B % N == 0 */ 224. if (!BN_nnmod(r, B, N, bn_ctx)) ^ 225. goto err; 226. ret = !BN_is_zero(r); crypto/bn/bn_mod.c:13:1: Parameter `m->top` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:137:1: Parameter `num->top` 135. * If 'dv' or 'rm' is NULL, the respective value is not returned. 136. */ 137. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 138. BN_CTX *ctx) 139. { crypto/bn/bn_div.c:182:17: Call 180. if (!no_branch && BN_ucmp(num, divisor) < 0) { 181. if (rm != NULL) { 182. if (BN_copy(rm, num) == NULL) ^ 183. return 0; 184. } crypto/bn/bn_lib.c:312:1: <Offset trace> 310. } 311. 312. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 313. { 314. bn_check_top(b); crypto/bn/bn_lib.c:312:1: Parameter `b->top` 310. } 311. 312. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 313. { 314. bn_check_top(b); crypto/bn/bn_lib.c:312:1: <Length trace> 310. } 311. 312. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 313. { 314. bn_check_top(b); crypto/bn/bn_lib.c:312:1: Parameter `*a->d` 310. } 311. 312. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 313. { 314. bn_check_top(b); crypto/bn/bn_lib.c:318:9: Call 316. if (a == b) 317. return a; 318. if (bn_wexpand(a, b->top) == NULL) ^ 319. return NULL; 320. crypto/bn/bn_lib.c:940:1: Parameter `*a->d` 938. } 939. 940. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 941. { 942. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:322:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `srp_generate_server_master_secret` 320. 321. if (b->top > 0) 322. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); ^ 323. 324. if (BN_get_flags(b, BN_FLG_CONSTTIME) != 0)
https://github.com/openssl/openssl/blob/e7d961e994620dd5dee6d80794a07fb9de1bab66/crypto/bn/bn_lib.c/#L322
d2a_code_trace_data_43092
char *glue_strings(const char *list[], size_t *out_len) { size_t len = 0; char *p, *ret; int i; for (i = 0; list[i] != NULL; i++) len += strlen(list[i]); if (out_len != NULL) *out_len = len; if (!TEST_ptr(ret = p = OPENSSL_malloc(len + 1))) return NULL; for (i = 0; list[i] != NULL; i++) p += strlen(strcpy(p, list[i])); return ret; } test/bntest.c:486: error: BUFFER_OVERRUN_L3 Offset: [54, 64] Size: [55, 65] by call to `parse_bigBN`. Showing all 9 steps of the trace test/bntest.c:455:37: Array declaration 453. /* Regression test for carry bug in bn_sqrx8x_internal */ 454. { 455. static const char *ahex[] = { ^ 456. "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", 457. "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", test/bntest.c:486:15: Call 484. }; 485. 486. if (!(TEST_true(parse_bigBN(&a, ahex)) ^ 487. && TEST_true(parse_bigBN(&n, nhex)))) 488. goto err; test/bntest.c:73:1: Parameter `**bn_strings` 71. * Parse BIGNUM from sparse hex-strings, return |BN_hex2bn| result. 72. */ 73. > static int parse_bigBN(BIGNUM **out, const char *bn_strings[]) 74. { 75. char *bigstring = glue_strings(bn_strings, NULL); test/bntest.c:75:23: Call 73. static int parse_bigBN(BIGNUM **out, const char *bn_strings[]) 74. { 75. char *bigstring = glue_strings(bn_strings, NULL); ^ 76. int ret = BN_hex2bn(out, bigstring); 77. test/testutil/driver.c:421:1: <Offset trace> 419. * Optionally return the whole length of this string in |out_len| 420. */ 421. > char *glue_strings(const char *list[], size_t *out_len) 422. { 423. size_t len = 0; test/testutil/driver.c:421:1: Parameter `(*list)->strlen` 419. * Optionally return the whole length of this string in |out_len| 420. */ 421. > char *glue_strings(const char *list[], size_t *out_len) 422. { 423. size_t len = 0; test/testutil/driver.c:421:1: <Length trace> 419. * Optionally return the whole length of this string in |out_len| 420. */ 421. > char *glue_strings(const char *list[], size_t *out_len) 422. { 423. size_t len = 0; test/testutil/driver.c:421:1: Parameter `**list` 419. * Optionally return the whole length of this string in |out_len| 420. */ 421. > char *glue_strings(const char *list[], size_t *out_len) 422. { 423. size_t len = 0; test/testutil/driver.c:437:21: Array access: Offset: [54, 64] Size: [55, 65] by call to `parse_bigBN` 435. 436. for (i = 0; list[i] != NULL; i++) 437. p += strlen(strcpy(p, list[i])); ^ 438. 439. return ret;
https://github.com/openssl/openssl/blob/8ae173bb57819a23717fd3c8e7c51cb62f4268d0/test/testutil/driver.c/#L437
d2a_code_trace_data_43093
static av_always_inline int epzs_motion_search_internal(MpegEncContext * s, int *mx_ptr, int *my_ptr, int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], int ref_mv_scale, int flags, int size, int h) { MotionEstContext * const c= &s->me; int best[2]={0, 0}; int d; int dmin; int map_generation; int penalty_factor; const int ref_mv_stride= s->mb_stride; const int ref_mv_xy= s->mb_x + s->mb_y*ref_mv_stride; me_cmp_func cmpf, chroma_cmpf; LOAD_COMMON LOAD_COMMON2 if(c->pre_pass){ penalty_factor= c->pre_penalty_factor; cmpf= s->dsp.me_pre_cmp[size]; chroma_cmpf= s->dsp.me_pre_cmp[size+1]; }else{ penalty_factor= c->penalty_factor; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; } map_generation= update_map_generation(c); assert(cmpf); dmin= cmp(s, 0, 0, 0, 0, size, h, ref_index, src_index, cmpf, chroma_cmpf, flags); map[0]= map_generation; score_map[0]= dmin; if((s->pict_type == FF_B_TYPE && !(c->flags & FLAG_DIRECT)) || s->flags&CODEC_FLAG_MV0) dmin += (mv_penalty[pred_x] + mv_penalty[pred_y])*penalty_factor; if (s->first_slice_line) { CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) }else{ if(dmin<((h*h*s->avctx->mv0_threshold)>>8) && ( P_LEFT[0] |P_LEFT[1] |P_TOP[0] |P_TOP[1] |P_TOPRIGHT[0]|P_TOPRIGHT[1])==0){ *mx_ptr= 0; *my_ptr= 0; c->skip=1; return dmin; } CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) ) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) CHECK_MV(P_LEFT[0] >>shift, P_LEFT[1] >>shift) CHECK_MV(P_TOP[0] >>shift, P_TOP[1] >>shift) CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) } if(dmin>h*h*4){ if(c->pre_pass){ CHECK_CLIPPED_MV((last_mv[ref_mv_xy-1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy-1][1]*ref_mv_scale + (1<<15))>>16) if(!s->first_slice_line) CHECK_CLIPPED_MV((last_mv[ref_mv_xy-ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy-ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) }else{ CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) if(s->mb_y+1<s->end_mb_y) CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) } } if(c->avctx->last_predictor_count){ const int count= c->avctx->last_predictor_count; const int xstart= FFMAX(0, s->mb_x - count); const int ystart= FFMAX(0, s->mb_y - count); const int xend= FFMIN(s->mb_width , s->mb_x + count + 1); const int yend= FFMIN(s->mb_height, s->mb_y + count + 1); int mb_y; for(mb_y=ystart; mb_y<yend; mb_y++){ int mb_x; for(mb_x=xstart; mb_x<xend; mb_x++){ const int xy= mb_x + 1 + (mb_y + 1)*ref_mv_stride; int mx= (last_mv[xy][0]*ref_mv_scale + (1<<15))>>16; int my= (last_mv[xy][1]*ref_mv_scale + (1<<15))>>16; if(mx>xmax || mx<xmin || my>ymax || my<ymin) continue; CHECK_MV(mx,my) } } } dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); *mx_ptr= best[0]; *my_ptr= best[1]; return dmin; } libavcodec/motion_est_template.c:1043: error: Uninitialized Value The value read from xmax was never initialized. libavcodec/motion_est_template.c:1043:9: 1041. /* first line */ 1042. if (s->first_slice_line) { 1043. CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) ^ 1044. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, 1045. (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1043
d2a_code_trace_data_43094
void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) { unsigned long hash; OPENSSL_LH_NODE *nn, **rn; void *ret; lh->error = 0; rn = getrn(lh, data, &hash); if (*rn == NULL) { lh->num_no_delete++; return (NULL); } else { nn = *rn; *rn = nn->next; ret = nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))) contract(lh); return (ret); } ssl/statem/statem.c:514: error: INTEGER_OVERFLOW_L2 ([0, max(0, `s->initial_ctx->sessions->num_items`)] - 1):unsigned64 by call to `tls_get_message_header`. Showing all 15 steps of the trace ssl/statem/statem.c:474:1: Parameter `s->initial_ctx->sessions->num_items` 472. * will resume in the same state where we left off. 473. */ 474. > static SUB_STATE_RETURN read_state_machine(SSL *s) { 475. OSSL_STATEM *st = &s->statem; 476. int ret, mt; ssl/statem/statem.c:514:23: Call 512. ret = dtls_get_message(s, &mt, &len); 513. } else { 514. ret = tls_get_message_header(s, &mt); ^ 515. } 516. ssl/statem/statem_lib.c:339:1: Parameter `s->initial_ctx->sessions->num_items` 337. } 338. 339. > int tls_get_message_header(SSL *s, int *mt) 340. { 341. /* s->init_num < SSL3_HM_HEADER_LENGTH */ ssl/statem/statem_lib.c:443:5: Call 441. return 1; 442. f_err: 443. ssl3_send_alert(s, SSL3_AL_FATAL, al); ^ 444. err: 445. return 0; ssl/s3_msg.c:64:1: Parameter `s->initial_ctx->sessions->num_items` 62. } 63. 64. > int ssl3_send_alert(SSL *s, int level, int desc) 65. { 66. /* Map tls/ssl alert value to correct one */ ssl/s3_msg.c:75:9: Call 73. /* If a fatal one, remove from cache */ 74. if ((level == SSL3_AL_FATAL) && (s->session != NULL)) 75. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 76. 77. s->s3->alert_dispatch = 1; ssl/ssl_sess.c:691:1: Parameter `ctx->sessions->num_items` 689. } 690. 691. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 692. { 693. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:693:12: Call 691. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 692. { 693. return remove_session_lock(ctx, c, 1); ^ 694. } 695. ssl/ssl_sess.c:696:1: Parameter `ctx->sessions->num_items` 694. } 695. 696. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 697. { 698. SSL_SESSION *r; ssl/ssl_sess.c:706:17: Call 704. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 705. ret = 1; 706. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 707. SSL_SESSION_list_remove(ctx, c); 708. } ssl/ssl_locl.h:581:1: Parameter `lh->num_items` 579. }; 580. 581. > DEFINE_LHASH_OF(SSL_SESSION); 582. /* Needed in ssl_cert.c */ 583. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:581:1: Call 579. }; 580. 581. > DEFINE_LHASH_OF(SSL_SESSION); 582. /* Needed in ssl_cert.c */ 583. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:103:1: <LHS trace> 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:103:1: Parameter `lh->num_items` 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:123:5: Binary operation: ([0, max(0, s->initial_ctx->sessions->num_items)] - 1):unsigned64 by call to `tls_get_message_header` 121. } 122. 123. lh->num_items--; ^ 124. if ((lh->num_nodes > MIN_NODES) && 125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
https://github.com/openssl/openssl/blob/2a7de0fd5d9baf946ef4d2c51096b04dd47a8143/crypto/lhash/lhash.c/#L123
d2a_code_trace_data_43095
CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name) { CTLOG *ret = CTLOG_new_null(); if (ret == NULL) return NULL; ret->name = OPENSSL_strdup(name); if (ret->name == NULL) { CTerr(CT_F_CTLOG_NEW, ERR_R_MALLOC_FAILURE); goto err; } ret->public_key = public_key; if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1) goto err; return ret; err: CTLOG_free(ret); return NULL; } crypto/ct/ct_log.c:254: error: MEMORY_LEAK memory dynamically allocated by call to `CTLOG_new_null()` at line 237, column 18 is not reachable after line 254, column 5. Showing all 64 steps of the trace crypto/ct/ct_log.c:235:1: start of procedure CTLOG_new() 233. * Copies the name. 234. */ 235. > CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name) 236. { 237. CTLOG *ret = CTLOG_new_null(); crypto/ct/ct_log.c:237:5: 235. CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name) 236. { 237. > CTLOG *ret = CTLOG_new_null(); 238. 239. if (ret == NULL) crypto/ct/ct_log.c:258:1: start of procedure CTLOG_new_null() 256. } 257. 258. > CTLOG *CTLOG_new_null(void) 259. { 260. CTLOG *ret = OPENSSL_zalloc(sizeof(*ret)); crypto/ct/ct_log.c:260:5: 258. CTLOG *CTLOG_new_null(void) 259. { 260. > CTLOG *ret = OPENSSL_zalloc(sizeof(*ret)); 261. 262. if (ret == NULL) crypto/mem.c:98:1: start of procedure CRYPTO_zalloc() 96. } 97. 98. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 99. { 100. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:100:5: 98. void *CRYPTO_zalloc(size_t num, const char *file, int line) 99. { 100. > void *ret = CRYPTO_malloc(num, file, line); 101. 102. if (ret != NULL) crypto/mem.c:71:1: start of procedure CRYPTO_malloc() 69. } 70. 71. > void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. void *ret = NULL; crypto/mem.c:73:5: 71. void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. > void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:75:9: Taking false branch 73. void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 76. return malloc_impl(num, file, line); 77. crypto/mem.c:78:9: Taking false branch 76. return malloc_impl(num, file, line); 77. 78. if (num <= 0) ^ 79. return NULL; 80. crypto/mem.c:81:5: 79. return NULL; 80. 81. > allow_customize = 0; 82. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 83. if (call_malloc_debug) { crypto/mem.c:91:5: 89. } 90. #else 91. > osslargused(file); osslargused(line); 92. ret = malloc(num); 93. #endif crypto/mem.c:91:24: 89. } 90. #else 91. > osslargused(file); osslargused(line); 92. ret = malloc(num); 93. #endif crypto/mem.c:92:5: 90. #else 91. osslargused(file); osslargused(line); 92. > ret = malloc(num); 93. #endif 94. crypto/mem.c:95:5: 93. #endif 94. 95. > return ret; 96. } 97. crypto/mem.c:96:1: return from a call to CRYPTO_malloc 94. 95. return ret; 96. > } 97. 98. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:102:9: Taking true branch 100. void *ret = CRYPTO_malloc(num, file, line); 101. 102. if (ret != NULL) ^ 103. memset(ret, 0, num); 104. return ret; crypto/mem.c:103:9: 101. 102. if (ret != NULL) 103. > memset(ret, 0, num); 104. return ret; 105. } crypto/mem.c:104:5: 102. if (ret != NULL) 103. memset(ret, 0, num); 104. > return ret; 105. } 106. crypto/mem.c:105:1: return from a call to CRYPTO_zalloc 103. memset(ret, 0, num); 104. return ret; 105. > } 106. 107. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/ct/ct_log.c:262:9: Taking false branch 260. CTLOG *ret = OPENSSL_zalloc(sizeof(*ret)); 261. 262. if (ret == NULL) ^ 263. CTerr(CT_F_CTLOG_NEW_NULL, ERR_R_MALLOC_FAILURE); 264. crypto/ct/ct_log.c:265:5: 263. CTerr(CT_F_CTLOG_NEW_NULL, ERR_R_MALLOC_FAILURE); 264. 265. > return ret; 266. } 267. crypto/ct/ct_log.c:266:1: return from a call to CTLOG_new_null 264. 265. return ret; 266. > } 267. 268. /* Frees CT log and associated structures */ crypto/ct/ct_log.c:239:9: Taking false branch 237. CTLOG *ret = CTLOG_new_null(); 238. 239. if (ret == NULL) ^ 240. return NULL; 241. crypto/ct/ct_log.c:242:5: 240. return NULL; 241. 242. > ret->name = OPENSSL_strdup(name); 243. if (ret->name == NULL) { 244. CTerr(CT_F_CTLOG_NEW, ERR_R_MALLOC_FAILURE); crypto/o_str.c:28:1: start of procedure CRYPTO_strdup() 26. } 27. 28. > char *CRYPTO_strdup(const char *str, const char* file, int line) 29. { 30. char *ret; crypto/o_str.c:33:9: Taking false branch 31. size_t size; 32. 33. if (str == NULL) ^ 34. return NULL; 35. size = strlen(str) + 1; crypto/o_str.c:35:5: 33. if (str == NULL) 34. return NULL; 35. > size = strlen(str) + 1; 36. ret = CRYPTO_malloc(size, file, line); 37. if (ret != NULL) crypto/o_str.c:36:5: 34. return NULL; 35. size = strlen(str) + 1; 36. > ret = CRYPTO_malloc(size, file, line); 37. if (ret != NULL) 38. memcpy(ret, str, size); crypto/mem.c:71:1: start of procedure CRYPTO_malloc() 69. } 70. 71. > void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. void *ret = NULL; crypto/mem.c:73:5: 71. void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. > void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:75:9: Taking true branch 73. void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 76. return malloc_impl(num, file, line); 77. crypto/mem.c:75:32: Taking true branch 73. void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 76. return malloc_impl(num, file, line); 77. crypto/mem.c:76:9: Skipping __function_pointer__(): unresolved function pointer 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) 76. return malloc_impl(num, file, line); ^ 77. 78. if (num <= 0) crypto/mem.c:96:1: return from a call to CRYPTO_malloc 94. 95. return ret; 96. > } 97. 98. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/o_str.c:37:9: Taking true branch 35. size = strlen(str) + 1; 36. ret = CRYPTO_malloc(size, file, line); 37. if (ret != NULL) ^ 38. memcpy(ret, str, size); 39. return ret; crypto/o_str.c:38:9: 36. ret = CRYPTO_malloc(size, file, line); 37. if (ret != NULL) 38. > memcpy(ret, str, size); 39. return ret; 40. } crypto/o_str.c:39:5: 37. if (ret != NULL) 38. memcpy(ret, str, size); 39. > return ret; 40. } 41. crypto/o_str.c:40:1: return from a call to CRYPTO_strdup 38. memcpy(ret, str, size); 39. return ret; 40. > } 41. 42. char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line) crypto/ct/ct_log.c:243:9: Taking false branch 241. 242. ret->name = OPENSSL_strdup(name); 243. if (ret->name == NULL) { ^ 244. CTerr(CT_F_CTLOG_NEW, ERR_R_MALLOC_FAILURE); 245. goto err; crypto/ct/ct_log.c:248:5: 246. } 247. 248. > ret->public_key = public_key; 249. if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1) 250. goto err; crypto/ct/ct_log.c:249:9: 247. 248. ret->public_key = public_key; 249. > if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1) 250. goto err; 251. crypto/ct/ct_log.c:73:1: start of procedure ct_v1_log_id_from_pkey() 71. 72. /* Converts a log's public key into a SHA256 log ID */ 73. > static int ct_v1_log_id_from_pkey(EVP_PKEY *pkey, 74. unsigned char log_id[CT_V1_HASHLEN]) 75. { crypto/ct/ct_log.c:76:5: 74. unsigned char log_id[CT_V1_HASHLEN]) 75. { 76. > int ret = 0; 77. unsigned char *pkey_der = NULL; 78. int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der); crypto/ct/ct_log.c:77:5: 75. { 76. int ret = 0; 77. > unsigned char *pkey_der = NULL; 78. int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der); 79. crypto/ct/ct_log.c:78:5: 76. int ret = 0; 77. unsigned char *pkey_der = NULL; 78. > int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der); 79. 80. if (pkey_der_len <= 0) { crypto/x509/x_pubkey.c:202:1: start of procedure i2d_PUBKEY() 200. } 201. 202. > int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp) 203. { 204. X509_PUBKEY *xpk = NULL; crypto/x509/x_pubkey.c:204:5: 202. int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp) 203. { 204. > X509_PUBKEY *xpk = NULL; 205. int ret; 206. if (!a) crypto/x509/x_pubkey.c:206:10: Taking true branch 204. X509_PUBKEY *xpk = NULL; 205. int ret; 206. if (!a) ^ 207. return 0; 208. if (!X509_PUBKEY_set(&xpk, a)) crypto/x509/x_pubkey.c:207:9: 205. int ret; 206. if (!a) 207. > return 0; 208. if (!X509_PUBKEY_set(&xpk, a)) 209. return 0; crypto/x509/x_pubkey.c:213:1: return from a call to i2d_PUBKEY 211. X509_PUBKEY_free(xpk); 212. return ret; 213. > } 214. 215. /* crypto/ct/ct_log.c:80:9: Taking true branch 78. int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der); 79. 80. if (pkey_der_len <= 0) { ^ 81. CTerr(CT_F_CT_V1_LOG_ID_FROM_PKEY, CT_R_LOG_KEY_INVALID); 82. goto err; crypto/ct/ct_log.c:81:9: Skipping ERR_put_error(): empty list of specs 79. 80. if (pkey_der_len <= 0) { 81. CTerr(CT_F_CT_V1_LOG_ID_FROM_PKEY, CT_R_LOG_KEY_INVALID); ^ 82. goto err; 83. } crypto/ct/ct_log.c:87:1: 85. SHA256(pkey_der, pkey_der_len, log_id); 86. ret = 1; 87. > err: 88. OPENSSL_free(pkey_der); 89. return ret; crypto/ct/ct_log.c:88:5: 86. ret = 1; 87. err: 88. > OPENSSL_free(pkey_der); 89. return ret; 90. } crypto/mem.c:163:1: start of procedure CRYPTO_free() 161. } 162. 163. > void CRYPTO_free(void *str, const char *file, int line) 164. { 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { crypto/mem.c:165:9: Taking false branch 163. void CRYPTO_free(void *str, const char *file, int line) 164. { 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 166. free_impl(str, file, line); 167. return; crypto/mem.c:179:5: 177. } 178. #else 179. > free(str); 180. #endif 181. } crypto/mem.c:181:1: return from a call to CRYPTO_free 179. free(str); 180. #endif 181. > } 182. 183. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/ct/ct_log.c:89:5: 87. err: 88. OPENSSL_free(pkey_der); 89. > return ret; 90. } 91. crypto/ct/ct_log.c:90:1: return from a call to ct_v1_log_id_from_pkey 88. OPENSSL_free(pkey_der); 89. return ret; 90. > } 91. 92. CTLOG_STORE *CTLOG_STORE_new(void) crypto/ct/ct_log.c:249:9: Taking true branch 247. 248. ret->public_key = public_key; 249. if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1) ^ 250. goto err; 251. crypto/ct/ct_log.c:253:1: 251. 252. return ret; 253. > err: 254. CTLOG_free(ret); 255. return NULL; crypto/ct/ct_log.c:254:5: Skipping CTLOG_free(): empty list of specs 252. return ret; 253. err: 254. CTLOG_free(ret); ^ 255. return NULL; 256. }
https://github.com/openssl/openssl/blob/b2de11c58b57e7f0d58c6f8a1d4177705650647e/crypto/ct/ct_log.c/#L254
d2a_code_trace_data_43096
int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; pkt->written += len; pkt->curr += len; return 1; } ssl/t1_lib.c:1442: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `s->s3->previous_server_finished_len` + `pkt->written` + 24]):unsigned64 by call to `WPACKET_sub_memcpy__`. Showing all 18 steps of the trace ssl/t1_lib.c:1395:1: Parameter `pkt->written` 1393. } 1394. 1395. > int ssl_add_serverhello_tlsext(SSL *s, WPACKET *pkt, int *al) 1396. { 1397. #ifndef OPENSSL_NO_NEXTPROTONEG ssl/t1_lib.c:1407:10: Call 1405. #endif 1406. 1407. if (!WPACKET_start_sub_packet_u16(pkt) ^ 1408. || !WPACKET_set_flags(pkt, WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH)) { 1409. SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); ssl/packet.c:205:1: Parameter `pkt->written` 203. } 204. 205. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 206. { 207. WPACKET_SUB *sub; ssl/t1_lib.c:1440:14: Call 1438. tls1_get_formatlist(s, &plist, &plistlen); 1439. 1440. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats) ^ 1441. || !WPACKET_start_sub_packet_u16(pkt) 1442. || !WPACKET_sub_memcpy_u8(pkt, plist, plistlen) ssl/packet.c:242:1: Parameter `pkt->written` 240. } 241. 242. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 243. { 244. unsigned char *data; ssl/t1_lib.c:1441:21: Call 1439. 1440. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats) 1441. || !WPACKET_start_sub_packet_u16(pkt) ^ 1442. || !WPACKET_sub_memcpy_u8(pkt, plist, plistlen) 1443. || !WPACKET_close(pkt)) { ssl/packet.c:205:1: Parameter `pkt->written` 203. } 204. 205. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 206. { 207. WPACKET_SUB *sub; ssl/t1_lib.c:1442:21: Call 1440. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_ec_point_formats) 1441. || !WPACKET_start_sub_packet_u16(pkt) 1442. || !WPACKET_sub_memcpy_u8(pkt, plist, plistlen) ^ 1443. || !WPACKET_close(pkt)) { 1444. SSLerr(SSL_F_SSL_ADD_SERVERHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); ssl/packet.c:301:10: Call 299. size_t lenbytes) 300. { 301. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) ^ 302. || !WPACKET_memcpy(pkt, src, len) 303. || !WPACKET_close(pkt)) ssl/packet.c:205:1: Parameter `pkt->buf->length` 203. } 204. 205. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 206. { 207. WPACKET_SUB *sub; ssl/packet.c:302:17: Call 300. { 301. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) 302. || !WPACKET_memcpy(pkt, src, len) ^ 303. || !WPACKET_close(pkt)) 304. return 0; ssl/packet.c:283:1: Parameter `pkt->written` 281. } 282. 283. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) 284. { 285. unsigned char *dest; ssl/packet.c:290:10: Call 288. return 1; 289. 290. if (!WPACKET_allocate_bytes(pkt, len, &dest)) ^ 291. return 0; 292. ssl/packet.c:15:1: <LHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `pkt->buf->length` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: <RHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `len` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:25:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + s->s3->previous_server_finished_len + pkt->written + 24]):unsigned64 by call to `WPACKET_sub_memcpy__` 23. return 0; 24. 25. if (pkt->buf->length - pkt->written < len) { ^ 26. size_t newlen; 27. size_t reflen;
https://github.com/openssl/openssl/blob/7507e73d409b8f3046d6efcc3f4c0b6208b59b64/ssl/packet.c/#L25
d2a_code_trace_data_43097
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:4115: error: MEMORY_LEAK memory dynamically allocated to `*hash` by call to `EVP_MD_CTX_new()` at line 4112, column 13 is not reachable after line 4115, column 9. Showing all 49 steps of the trace ssl/ssl_lib.c:4109:1: start of procedure ssl_replace_hash() 4107. */ 4108. 4109. > EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md) 4110. { 4111. ssl_clear_hash_ctx(hash); ssl/ssl_lib.c:4111:5: 4109. EVP_MD_CTX *ssl_replace_hash(EVP_MD_CTX **hash, const EVP_MD *md) 4110. { 4111. > ssl_clear_hash_ctx(hash); 4112. *hash = EVP_MD_CTX_new(); 4113. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ssl/ssl_lib.c:4121:1: start of procedure ssl_clear_hash_ctx() 4119. } 4120. 4121. > void ssl_clear_hash_ctx(EVP_MD_CTX **hash) 4122. { 4123. ssl/ssl_lib.c:4124:5: 4122. { 4123. 4124. > EVP_MD_CTX_free(*hash); 4125. *hash = NULL; 4126. } crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_free() 47. } 48. 49. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 50. { 51. EVP_MD_CTX_reset(ctx); crypto/evp/digest.c:51:5: Skipping EVP_MD_CTX_reset(): empty list of specs 49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 50. { 51. EVP_MD_CTX_reset(ctx); ^ 52. OPENSSL_free(ctx); 53. } crypto/evp/digest.c:52:5: 50. { 51. EVP_MD_CTX_reset(ctx); 52. > OPENSSL_free(ctx); 53. } 54. crypto/mem.c:264:1: start of procedure CRYPTO_free() 262. } 263. 264. > void CRYPTO_free(void *str, const char *file, int line) 265. { 266. if (free_impl != NULL && free_impl != &CRYPTO_free) { crypto/mem.c:266:9: Taking false branch 264. void CRYPTO_free(void *str, const char *file, int line) 265. { 266. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 267. free_impl(str, file, line); 268. return; crypto/mem.c:280:5: 278. } 279. #else 280. > free(str); 281. #endif 282. } crypto/mem.c:282:1: return from a call to CRYPTO_free 280. free(str); 281. #endif 282. > } 283. 284. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/evp/digest.c:53:1: return from a call to EVP_MD_CTX_free 51. EVP_MD_CTX_reset(ctx); 52. OPENSSL_free(ctx); 53. > } 54. 55. int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) ssl/ssl_lib.c:4125:5: 4123. 4124. EVP_MD_CTX_free(*hash); 4125. > *hash = NULL; 4126. } 4127. ssl/ssl_lib.c:4126:1: return from a call to ssl_clear_hash_ctx 4124. EVP_MD_CTX_free(*hash); 4125. *hash = NULL; 4126. > } 4127. 4128. /* Retrieve handshake hashes */ ssl/ssl_lib.c:4112:5: 4110. { 4111. ssl_clear_hash_ctx(hash); 4112. > *hash = EVP_MD_CTX_new(); 4113. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { 4114. EVP_MD_CTX_free(*hash); crypto/evp/digest.c:44:1: start of procedure EVP_MD_CTX_new() 42. } 43. 44. > EVP_MD_CTX *EVP_MD_CTX_new(void) 45. { 46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); crypto/evp/digest.c:46:5: 44. EVP_MD_CTX *EVP_MD_CTX_new(void) 45. { 46. > return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 47. } 48. crypto/mem.c: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/evp/digest.c:47:1: return from a call to EVP_MD_CTX_new 45. { 46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 47. > } 48. 49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) ssl/ssl_lib.c:4113:9: Taking false branch 4111. ssl_clear_hash_ctx(hash); 4112. *hash = EVP_MD_CTX_new(); 4113. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ^ 4114. EVP_MD_CTX_free(*hash); 4115. *hash = NULL; ssl/ssl_lib.c:4113:27: Taking true branch 4111. ssl_clear_hash_ctx(hash); 4112. *hash = EVP_MD_CTX_new(); 4113. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ^ 4114. EVP_MD_CTX_free(*hash); 4115. *hash = NULL; ssl/ssl_lib.c:4113:33: Taking true branch 4111. ssl_clear_hash_ctx(hash); 4112. *hash = EVP_MD_CTX_new(); 4113. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { ^ 4114. EVP_MD_CTX_free(*hash); 4115. *hash = NULL; ssl/ssl_lib.c:4114:9: 4112. *hash = EVP_MD_CTX_new(); 4113. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { 4114. > EVP_MD_CTX_free(*hash); 4115. *hash = NULL; 4116. return NULL; crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_free() 47. } 48. 49. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 50. { 51. EVP_MD_CTX_reset(ctx); crypto/evp/digest.c:51:5: Skipping EVP_MD_CTX_reset(): empty list of specs 49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) 50. { 51. EVP_MD_CTX_reset(ctx); ^ 52. OPENSSL_free(ctx); 53. } crypto/evp/digest.c:52:5: 50. { 51. EVP_MD_CTX_reset(ctx); 52. > OPENSSL_free(ctx); 53. } 54. crypto/mem.c:264:1: start of procedure CRYPTO_free() 262. } 263. 264. > void CRYPTO_free(void *str, const char *file, int line) 265. { 266. if (free_impl != NULL && free_impl != &CRYPTO_free) { crypto/mem.c:266:9: Taking true branch 264. void CRYPTO_free(void *str, const char *file, int line) 265. { 266. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 267. free_impl(str, file, line); 268. return; crypto/mem.c:266:30: Taking true branch 264. void CRYPTO_free(void *str, const char *file, int line) 265. { 266. if (free_impl != NULL && free_impl != &CRYPTO_free) { ^ 267. free_impl(str, file, line); 268. return; crypto/mem.c:267:9: Skipping __function_pointer__(): unresolved function pointer 265. { 266. if (free_impl != NULL && free_impl != &CRYPTO_free) { 267. free_impl(str, file, line); ^ 268. return; 269. } crypto/mem.c:268:9: 266. if (free_impl != NULL && free_impl != &CRYPTO_free) { 267. free_impl(str, file, line); 268. > return; 269. } 270. crypto/mem.c:282:1: return from a call to CRYPTO_free 280. free(str); 281. #endif 282. > } 283. 284. void CRYPTO_clear_free(void *str, size_t num, const char *file, int line) crypto/evp/digest.c:53:1: return from a call to EVP_MD_CTX_free 51. EVP_MD_CTX_reset(ctx); 52. OPENSSL_free(ctx); 53. > } 54. 55. int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type) ssl/ssl_lib.c:4115:9: 4113. if (*hash == NULL || (md && EVP_DigestInit_ex(*hash, md, NULL) <= 0)) { 4114. EVP_MD_CTX_free(*hash); 4115. > *hash = NULL; 4116. return NULL; 4117. }
https://github.com/openssl/openssl/blob/810ef917070902f729e3913f1656371c9b0855f8/ssl/ssl_lib.c/#L4115
d2a_code_trace_data_43098
void *lh_delete(LHASH *lh, const void *data) { unsigned long hash; LHASH_NODE *nn,**rn; const void *ret; lh->error=0; rn=getrn(lh,data,&hash); if (*rn == NULL) { lh->num_no_delete++; return(NULL); } else { nn= *rn; *rn=nn->next; ret=nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes))) contract(lh); return((void *)ret); } apps/s_client.c:892: error: INTEGER_OVERFLOW_L1 (0 - 1):unsigned64 by call to `SSL_free`. Showing all 15 steps of the trace apps/s_client.c:463:6: Call 461. } 462. 463. ctx=SSL_CTX_new(meth); ^ 464. if (ctx == NULL) 465. { ssl/ssl_lib.c:1337:16: Call 1335. ret->client_cert_cb=0; 1336. 1337. ret->sessions=lh_new(LHASH_HASH_FN(SSL_SESSION_hash), ^ 1338. LHASH_COMP_FN(SSL_SESSION_cmp)); 1339. if (ret->sessions == NULL) goto err; crypto/lhash/lhash.c:133:2: Assignment 131. ret->up_load=UP_LOAD; 132. ret->down_load=DOWN_LOAD; 133. ret->num_items=0; ^ 134. 135. ret->num_expands=0; apps/s_client.c:892:19: Call 890. end: 891. if(prexit) print_stuff(bio_c_out,con,1); 892. if (con != NULL) SSL_free(con); ^ 893. if (con2 != NULL) SSL_free(con2); 894. if (ctx != NULL) SSL_CTX_free(ctx); ssl/ssl_lib.c:408:1: Parameter `s->ctx->sessions->num_items` 406. } 407. 408. > void SSL_free(SSL *s) 409. { 410. int i; ssl/ssl_lib.c:454:3: Call 452. if (s->session != NULL) 453. { 454. ssl_clear_bad_session(s); ^ 455. SSL_SESSION_free(s->session); 456. } ssl/ssl_sess.c:678:1: Parameter `s->ctx->sessions->num_items` 676. } 677. 678. > int ssl_clear_bad_session(SSL *s) 679. { 680. if ( (s->session != NULL) && ssl/ssl_sess.c:684:3: Call 682. !(SSL_in_init(s) || SSL_in_before(s))) 683. { 684. SSL_CTX_remove_session(s->ctx,s->session); ^ 685. return(1); 686. } ssl/ssl_sess.c:464:1: Parameter `ctx->sessions->num_items` 462. } 463. 464. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 465. { 466. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:466:9: Call 464. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 465. { 466. return remove_session_lock(ctx, c, 1); ^ 467. } 468. ssl/ssl_sess.c:469:1: Parameter `ctx->sessions->num_items` 467. } 468. 469. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 470. { 471. SSL_SESSION *r; ssl/ssl_sess.c:480:21: Call 478. { 479. ret=1; 480. r=(SSL_SESSION *)lh_delete(ctx->sessions,c); ^ 481. SSL_SESSION_list_remove(ctx,c); 482. } crypto/lhash/lhash.c:217:1: <LHS trace> 215. } 216. 217. > void *lh_delete(LHASH *lh, const void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:217:1: Parameter `lh->num_items` 215. } 216. 217. > void *lh_delete(LHASH *lh, const void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:240:2: Binary operation: (0 - 1):unsigned64 by call to `SSL_free` 238. } 239. 240. lh->num_items--; ^ 241. if ((lh->num_nodes > MIN_NODES) && 242. (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)))
https://github.com/openssl/openssl/blob/80e1495b99ac6a614137db595e420b013c76554a/crypto/lhash/lhash.c/#L240
d2a_code_trace_data_43099
int BN_rshift(BIGNUM *r, const BIGNUM *a, int n) { int i, j, nw, lb, rb; BN_ULONG *t, *f; BN_ULONG l, tmp; bn_check_top(r); bn_check_top(a); if (n < 0) { BNerr(BN_F_BN_RSHIFT, BN_R_INVALID_SHIFT); return 0; } nw = n / BN_BITS2; rb = n % BN_BITS2; lb = BN_BITS2 - rb; if (nw >= a->top || a->top == 0) { BN_zero(r); return 1; } i = (BN_num_bits(a) - n + (BN_BITS2 - 1)) / BN_BITS2; if (r != a) { if (bn_wexpand(r, i) == NULL) return 0; r->neg = a->neg; } else { if (n == 0) return 1; } f = &(a->d[nw]); t = r->d; j = a->top - nw; r->top = i; if (rb == 0) { for (i = j; i != 0; i--) *(t++) = *(f++); } else { l = *(f++); for (i = j - 1; i != 0; i--) { tmp = (l >> rb) & BN_MASK2; l = *(f++); *(t++) = (tmp | (l << lb)) & BN_MASK2; } if ((l = (l >> rb) & BN_MASK2)) *(t) = l; } if (!r->top) r->neg = 0; bn_check_top(r); return 1; } crypto/ec/ecdsa_ossl.c:217: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_rshift`. Showing all 8 steps of the trace crypto/ec/ecdsa_ossl.c:212:10: Call 210. if (8 * dgst_len > i) 211. dgst_len = (i + 7) / 8; 212. if (!BN_bin2bn(dgst, dgst_len, m)) { ^ 213. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB); 214. goto err; crypto/bn/bn_lib.c:372:1: Parameter `*ret->d` 370. } 371. 372. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) 373. { 374. unsigned int i, m; crypto/ec/ecdsa_ossl.c:217:32: Call 215. } 216. /* If still too long, truncate remaining bits with a shift */ 217. if ((8 * dgst_len > i) && !BN_rshift(m, m, 8 - (i & 0x7))) { ^ 218. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB); 219. goto err; crypto/bn/bn_shift.c:122:1: <Length trace> 120. } 121. 122. > int BN_rshift(BIGNUM *r, const BIGNUM *a, int n) 123. { 124. int i, j, nw, lb, rb; crypto/bn/bn_shift.c:122:1: Parameter `*a->d` 120. } 121. 122. > int BN_rshift(BIGNUM *r, const BIGNUM *a, int n) 123. { 124. int i, j, nw, lb, rb; crypto/bn/bn_shift.c:153:5: Assignment 151. } 152. 153. f = &(a->d[nw]); ^ 154. t = r->d; 155. j = a->top - nw; crypto/bn/bn_shift.c:162:15: Assignment 160. *(t++) = *(f++); 161. } else { 162. l = *(f++); ^ 163. for (i = j - 1; i != 0; i--) { 164. tmp = (l >> rb) & BN_MASK2; crypto/bn/bn_shift.c:165:17: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_rshift` 163. for (i = j - 1; i != 0; i--) { 164. tmp = (l >> rb) & BN_MASK2; 165. l = *(f++); ^ 166. *(t++) = (tmp | (l << lb)) & BN_MASK2; 167. }
https://github.com/openssl/openssl/blob/4cc968df403ed9321d0df722aba33323ae575ce0/crypto/bn/bn_shift.c/#L165
d2a_code_trace_data_43100
static size_t kat_entropy(DRBG_CTX *dctx, unsigned char **pout, int entropy, size_t min_len, size_t max_len) { TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(dctx, app_data_index); t->entcnt++; *pout = (unsigned char *)t->ent; return t->entlen; } test/drbgtest.c:122: error: NULL_DEREFERENCE pointer `t` last assigned on line 120 could be null and is dereferenced at line 122, column 5. Showing all 10 steps of the trace test/drbgtest.c:117:1: start of procedure kat_entropy() 115. } TEST_CTX; 116. 117. > static size_t kat_entropy(DRBG_CTX *dctx, unsigned char **pout, 118. int entropy, size_t min_len, size_t max_len) 119. { test/drbgtest.c:120:5: 118. int entropy, size_t min_len, size_t max_len) 119. { 120. > TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(dctx, app_data_index); 121. 122. t->entcnt++; crypto/rand/drbg_lib.c:346:1: start of procedure RAND_DRBG_get_ex_data() 344. } 345. 346. > void *RAND_DRBG_get_ex_data(const DRBG_CTX *dctx, int idx) 347. { 348. return CRYPTO_get_ex_data(&dctx->ex_data, idx); crypto/rand/drbg_lib.c:348:5: 346. void *RAND_DRBG_get_ex_data(const DRBG_CTX *dctx, int idx) 347. { 348. > return CRYPTO_get_ex_data(&dctx->ex_data, idx); 349. } crypto/ex_data.c:394:1: start of procedure CRYPTO_get_ex_data() 392. * particular index in the class used by this variable 393. */ 394. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 395. { 396. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) crypto/ex_data.c:396:9: Taking true branch 394. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 395. { 396. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) ^ 397. return NULL; 398. return sk_void_value(ad->sk, idx); crypto/ex_data.c:397:9: 395. { 396. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) 397. > return NULL; 398. return sk_void_value(ad->sk, idx); 399. } crypto/ex_data.c:399:1: return from a call to CRYPTO_get_ex_data 397. return NULL; 398. return sk_void_value(ad->sk, idx); 399. > } crypto/rand/drbg_lib.c:349:1: return from a call to RAND_DRBG_get_ex_data 347. { 348. return CRYPTO_get_ex_data(&dctx->ex_data, idx); 349. > } test/drbgtest.c:122:5: 120. TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(dctx, app_data_index); 121. 122. > t->entcnt++; 123. *pout = (unsigned char *)t->ent; 124. return t->entlen;
https://github.com/openssl/openssl/blob/12fb8c3d2dd00f3d4f1b084385403d26ed64a596/test/drbgtest.c/#L122
d2a_code_trace_data_43101
int test_gf2m_add(BIO *bp) { BIGNUM *a, *b, *c; int i, ret = 0; a = BN_new(); b = BN_new(); c = BN_new(); for (i = 0; i < num0; i++) { BN_rand(a, 512, 0, 0); BN_copy(b, BN_value_one()); a->neg = rand_neg(); b->neg = rand_neg(); BN_GF2m_add(c, a, b); if ((BN_is_odd(a) && BN_is_odd(c)) || (!BN_is_odd(a) && !BN_is_odd(c))) { fprintf(stderr, "GF(2^m) addition test (a) failed!\n"); goto err; } BN_GF2m_add(c, c, c); if (!BN_is_zero(c)) { fprintf(stderr, "GF(2^m) addition test (b) failed!\n"); goto err; } } ret = 1; err: BN_free(a); BN_free(b); BN_free(c); return ret; } test/bntest.c:1254: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 1229, column 9 is not reachable after line 1254, column 5. Showing all 98 steps of the trace test/bntest.c:1223:1: start of procedure test_gf2m_add() 1221. 1222. #ifndef OPENSSL_NO_EC2M 1223. > int test_gf2m_add(BIO *bp) 1224. { 1225. BIGNUM *a, *b, *c; test/bntest.c:1226:5: 1224. { 1225. BIGNUM *a, *b, *c; 1226. > int i, ret = 0; 1227. 1228. a = BN_new(); test/bntest.c:1228:5: 1226. int i, ret = 0; 1227. 1228. > a = BN_new(); 1229. b = BN_new(); 1230. 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:1229:5: 1227. 1228. a = BN_new(); 1229. > b = BN_new(); 1230. c = BN_new(); 1231. 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:1230:5: 1228. a = BN_new(); 1229. b = BN_new(); 1230. > c = BN_new(); 1231. 1232. for (i = 0; i < num0; 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:1232:10: 1230. c = BN_new(); 1231. 1232. > for (i = 0; i < num0; i++) { 1233. BN_rand(a, 512, 0, 0); 1234. BN_copy(b, BN_value_one()); test/bntest.c:1232:17: Loop condition is false. Leaving loop 1230. c = BN_new(); 1231. 1232. for (i = 0; i < num0; i++) { ^ 1233. BN_rand(a, 512, 0, 0); 1234. BN_copy(b, BN_value_one()); test/bntest.c:1251:5: 1249. } 1250. } 1251. > ret = 1; 1252. err: 1253. BN_free(a); test/bntest.c:1252:2: 1250. } 1251. ret = 1; 1252. > err: 1253. BN_free(a); 1254. BN_free(b); test/bntest.c:1253:5: 1251. ret = 1; 1252. err: 1253. > BN_free(a); 1254. BN_free(b); 1255. 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:1254:5: 1252. err: 1253. BN_free(a); 1254. > BN_free(b); 1255. BN_free(c); 1256. return ret; crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a)
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L1254
d2a_code_trace_data_43102
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: [16+min(0, `c->synth_buf_offset[*]`), 17+max(511, `c->synth_buf_offset[*]`)] Size: 2 by call to `ff_mpa_synth_filter`. libavcodec/mpc.c:51:1: Parameter `c->synth_buf[*]` 49. * Process decoded Musepack data and produce PCM 50. */ 51. static void mpc_synth(MPCContext *c, int16_t *out) ^ 52. { 53. int dither_state = 0; libavcodec/mpc.c:60:13: Call 58. samples_ptr = samples + ch; 59. for(i = 0; i < SAMPLES_PER_BAND; i++) { 60. ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]), ^ 61. mpa_window, &dither_state, 62. samples_ptr, 2, libavcodec/mpegaudiodec.c:858:1: <Length trace> 856. 32 samples. */ 857. /* XXX: optimize by avoiding ring buffer usage */ 858. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ^ 859. MPA_INT *window, int *dither_state, 860. OUT_INT *samples, int incr, libavcodec/mpegaudiodec.c:858:1: Parameter `*synth_buf_ptr` 856. 32 samples. */ 857. /* XXX: optimize by avoiding ring buffer usage */ 858. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ^ 859. MPA_INT *window, int *dither_state, 860. OUT_INT *samples, int incr, libavcodec/mpegaudiodec.c:877:5: Assignment 875. 876. offset = *synth_buf_offset; 877. synth_buf = synth_buf_ptr + offset; ^ 878. 879. for(j=0;j<32;j++) { libavcodec/mpegaudiodec.c:896:5: Assignment 894. 895. sum = *dither_state; 896. p = synth_buf + 16; ^ 897. SUM8(sum, +=, w, p); 898. p = synth_buf + 48; libavcodec/mpegaudiodec.c:897:5: Array access: Offset: [16+min(0, c->synth_buf_offset[*]), 17+max(511, c->synth_buf_offset[*])] Size: 2 by call to `ff_mpa_synth_filter` 895. sum = *dither_state; 896. p = synth_buf + 16; 897. SUM8(sum, +=, w, p); ^ 898. p = synth_buf + 48; 899. SUM8(sum, -=, w + 32, p);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L897
d2a_code_trace_data_43103
BIO *OSSL_trace_begin(int category) { BIO *channel = NULL; #ifndef OPENSSL_NO_TRACE char *prefix = NULL; category = ossl_trace_get_category(category); channel = trace_channels[category].bio; prefix = trace_channels[category].prefix; if (channel != NULL) { CRYPTO_THREAD_write_lock(trace_lock); current_channel = channel; switch (trace_channels[category].type) { case t_channel: if (prefix != NULL) { (void)BIO_puts(channel, prefix); (void)BIO_puts(channel, "\n"); } break; case t_callback: (void)BIO_ctrl(channel, OSSL_TRACE_CTRL_BEGIN, prefix == NULL ? 0 : strlen(prefix), prefix); break; } } #endif return channel; } crypto/trace.c:446: error: BUFFER_OVERRUN_L3 Offset: [-1, 12] Size: 13. Showing all 7 steps of the trace crypto/trace.c:445:16: <Offset trace> 443. char *prefix = NULL; 444. 445. category = ossl_trace_get_category(category); ^ 446. channel = trace_channels[category].bio; 447. prefix = trace_channels[category].prefix; crypto/trace.c:445:16: Call 443. char *prefix = NULL; 444. 445. category = ossl_trace_get_category(category); ^ 446. channel = trace_channels[category].bio; 447. prefix = trace_channels[category].prefix; crypto/trace.c:422:9: Assignment 420. { 421. if (category < 0 || category >= OSSL_TRACE_CATEGORY_NUM) 422. return -1; ^ 423. if (trace_channels[category].bio != NULL) 424. return category; crypto/trace.c:445:5: Assignment 443. char *prefix = NULL; 444. 445. category = ossl_trace_get_category(category); ^ 446. channel = trace_channels[category].bio; 447. prefix = trace_channels[category].prefix; crypto/trace.c:160:1: <Length trace> 158. 159. /* We use one trace channel for each trace category */ 160. > static struct { 161. enum { t_channel, t_callback } type; 162. BIO *bio; crypto/trace.c:160:1: Array declaration 158. 159. /* We use one trace channel for each trace category */ 160. > static struct { 161. enum { t_channel, t_callback } type; 162. BIO *bio; crypto/trace.c:446:15: Array access: Offset: [-1, 12] Size: 13 444. 445. category = ossl_trace_get_category(category); 446. channel = trace_channels[category].bio; ^ 447. prefix = trace_channels[category].prefix; 448.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/trace.c/#L446
d2a_code_trace_data_43104
static unsigned constant_time_ge(unsigned a, unsigned b) { a -= b; return DUPLICATE_MSB_TO_ALL(~a); } ssl/s3_pkt.c:457: error: INTEGER_OVERFLOW_L2 ([0, 34111] - [0, 34112]):unsigned32 by call to `ssl3_cbc_copy_mac`. Showing all 9 steps of the trace ssl/s3_pkt.c:284:1: Parameter `s->packet_length` 282. */ 283. /* used only by ssl3_read_bytes */ 284. > static int ssl3_get_record(SSL *s) 285. { 286. int ssl_major,ssl_minor,al; ssl/s3_pkt.c:457:4: Call 455. * */ 456. mac = mac_tmp; 457. ssl3_cbc_copy_mac(mac_tmp, rr, mac_size); ^ 458. rr->length -= mac_size; 459. } ssl/s3_cbc.c:251:1: Parameter `md_size` 249. #define CBC_MAC_ROTATE_IN_PLACE 250. 251. > void ssl3_cbc_copy_mac(unsigned char* out, 252. const SSL3_RECORD *rec, 253. unsigned md_size) ssl/s3_cbc.c:297:29: Call 295. { 296. unsigned char mac_started = constant_time_ge(i, mac_start); 297. unsigned char mac_ended = constant_time_ge(i, mac_end); ^ 298. unsigned char b = rec->data[i]; 299. rotated_mac[j++] |= b & mac_started & ~mac_ended; ssl/s3_cbc.c:87:1: <LHS trace> 85. 86. /* constant_time_ge returns 0xff if a>=b and 0x00 otherwise. */ 87. > static unsigned constant_time_ge(unsigned a, unsigned b) 88. { 89. a -= b; ssl/s3_cbc.c:87:1: Parameter `a` 85. 86. /* constant_time_ge returns 0xff if a>=b and 0x00 otherwise. */ 87. > static unsigned constant_time_ge(unsigned a, unsigned b) 88. { 89. a -= b; ssl/s3_cbc.c:87:1: <RHS trace> 85. 86. /* constant_time_ge returns 0xff if a>=b and 0x00 otherwise. */ 87. > static unsigned constant_time_ge(unsigned a, unsigned b) 88. { 89. a -= b; ssl/s3_cbc.c:87:1: Parameter `b` 85. 86. /* constant_time_ge returns 0xff if a>=b and 0x00 otherwise. */ 87. > static unsigned constant_time_ge(unsigned a, unsigned b) 88. { 89. a -= b; ssl/s3_cbc.c:89:2: Binary operation: ([0, 34111] - [0, 34112]):unsigned32 by call to `ssl3_cbc_copy_mac` 87. static unsigned constant_time_ge(unsigned a, unsigned b) 88. { 89. a -= b; ^ 90. return DUPLICATE_MSB_TO_ALL(~a); 91. }
https://github.com/openssl/openssl/blob/f93a41877d8d7a287debb7c63d7b646abaaf269c/ssl/s3_cbc.c/#L89
d2a_code_trace_data_43105
static size_t kat_nonce(RAND_DRBG *drbg, unsigned char **pout, int entropy, size_t min_len, size_t max_len) { TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); t->noncecnt++; *pout = (unsigned char *)t->nonce; return t->noncelen; } test/drbgtest.c:153: error: NULL_DEREFERENCE pointer `t` last assigned on line 151 could be null and is dereferenced at line 153, column 5. Showing all 10 steps of the trace test/drbgtest.c:148:1: start of procedure kat_nonce() 146. } 147. 148. > static size_t kat_nonce(RAND_DRBG *drbg, unsigned char **pout, 149. int entropy, size_t min_len, size_t max_len) 150. { test/drbgtest.c:151:5: 149. int entropy, size_t min_len, size_t max_len) 150. { 151. > TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); 152. 153. t->noncecnt++; crypto/rand/drbg_lib.c:929:1: start of procedure RAND_DRBG_get_ex_data() 927. } 928. 929. > void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx) 930. { 931. return CRYPTO_get_ex_data(&drbg->ex_data, idx); crypto/rand/drbg_lib.c:931:5: 929. void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx) 930. { 931. > return CRYPTO_get_ex_data(&drbg->ex_data, idx); 932. } 933. crypto/ex_data.c:429:1: start of procedure CRYPTO_get_ex_data() 427. * particular index in the class used by this variable 428. */ 429. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 430. { 431. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) crypto/ex_data.c:431:9: Taking true branch 429. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 430. { 431. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) ^ 432. return NULL; 433. return sk_void_value(ad->sk, idx); crypto/ex_data.c:432:9: 430. { 431. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) 432. > return NULL; 433. return sk_void_value(ad->sk, idx); 434. } crypto/ex_data.c:434:1: return from a call to CRYPTO_get_ex_data 432. return NULL; 433. return sk_void_value(ad->sk, idx); 434. > } crypto/rand/drbg_lib.c:932:1: return from a call to RAND_DRBG_get_ex_data 930. { 931. return CRYPTO_get_ex_data(&drbg->ex_data, idx); 932. > } 933. 934. test/drbgtest.c:153:5: 151. TEST_CTX *t = (TEST_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); 152. 153. > t->noncecnt++; 154. *pout = (unsigned char *)t->nonce; 155. return t->noncelen;
https://github.com/openssl/openssl/blob/8d4f150f70d70d6c3e62661ed7cc16c2f751d8a1/test/drbgtest.c/#L153
d2a_code_trace_data_43106
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/ectest.c:214: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `EC_POINT_set_compressed_coordinates_GFp`. Showing all 18 steps of the trace test/ectest.c:171:13: Call 169. || !TEST_ptr(a = BN_new()) 170. || !TEST_ptr(b = BN_new()) 171. || !TEST_true(BN_hex2bn(&p, "17")) ^ 172. || !TEST_true(BN_hex2bn(&a, "1")) 173. || !TEST_true(BN_hex2bn(&b, "1")) crypto/bn/bn_print.c:126:1: Parameter `(*bn)->top` 124. } 125. 126. > int BN_hex2bn(BIGNUM **bn, const char *a) 127. { 128. BIGNUM *ret = NULL; test/ectest.c:214:13: Call 212. || !TEST_ptr(yplusone = BN_new()) 213. || !TEST_true(BN_hex2bn(&x, "D")) 214. || !TEST_true(EC_POINT_set_compressed_coordinates_GFp(group, Q, x, 1, ^ 215. ctx))) 216. goto err; crypto/ec/ec_oct.c:23:1: Parameter `x->top` 21. #include "ec_lcl.h" 22. 23. > int EC_POINT_set_compressed_coordinates_GFp(const EC_GROUP *group, 24. EC_POINT *point, const BIGNUM *x, 25. int y_bit, BN_CTX *ctx) crypto/ec/ec_oct.c:40:20: Call 38. if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) { 39. if (group->meth->field_type == NID_X9_62_prime_field) 40. return ec_GFp_simple_set_compressed_coordinates(group, point, x, ^ 41. y_bit, ctx); 42. else crypto/ec/ecp_oct.c:21:1: Parameter `x_->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 `*r->d` 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:140:1: Parameter `*rm->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/bn/bn_div.c:185:17: Call 183. if (!no_branch && BN_ucmp(num, divisor) < 0) { 184. if (rm != NULL) { 185. if (BN_copy(rm, num) == NULL) ^ 186. return (0); 187. } 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, 536870848] by call to `EC_POINT_set_compressed_coordinates_GFp` 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/7671342e550ed2de676b23c79d0e7f45a381c76e/crypto/bn/bn_lib.c/#L333
d2a_code_trace_data_43107
static void contract(LHASH *lh) { LHASH_NODE **n,*n1,*np; np=lh->b[lh->p+lh->pmax-1]; lh->b[lh->p+lh->pmax-1]=NULL; if (lh->p == 0) { n=(LHASH_NODE **)OPENSSL_realloc(lh->b, (unsigned int)(sizeof(LHASH_NODE *)*lh->pmax)); if (n == NULL) { lh->error++; return; } lh->num_contract_reallocs++; lh->num_alloc_nodes/=2; lh->pmax/=2; lh->p=lh->pmax-1; lh->b=n; } else lh->p--; lh->num_nodes--; lh->num_contracts++; n1=lh->b[(int)lh->p]; if (n1 == NULL) lh->b[(int)lh->p]=np; else { while (n1->next != NULL) n1=n1->next; n1->next=np; } } ssl/d1_clnt.c:249: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `ssl3_get_server_hello`. Showing all 17 steps of the trace ssl/d1_clnt.c:144:1: Parameter `s->ctx->sessions->p` 142. dtls1_get_client_method) 143. 144. > int dtls1_connect(SSL *s) 145. { 146. BUF_MEM *buf=NULL; ssl/d1_clnt.c:249:8: Call 247. case SSL3_ST_CR_SRVR_HELLO_A: 248. case SSL3_ST_CR_SRVR_HELLO_B: 249. ret=ssl3_get_server_hello(s); ^ 250. if (ret <= 0) goto end; 251. else ssl/s3_clnt.c:658:1: Parameter `s->ctx->sessions->p` 656. } 657. 658. > int ssl3_get_server_hello(SSL *s) 659. { 660. STACK_OF(SSL_CIPHER) *sk; ssl/s3_clnt.c:834:7: Call 832. goto f_err; 833. } 834. if (ssl_check_serverhello_tlsext(s) <= 0) ^ 835. { 836. SSLerr(SSL_F_SSL3_CONNECT,SSL_R_SERVERHELLO_TLSEXT); ssl/t1_lib.c:795:1: Parameter `s->ctx->sessions->p` 793. } 794. 795. > int ssl_check_serverhello_tlsext(SSL *s) 796. { 797. int ret=SSL_TLSEXT_ERR_NOACK; ssl/t1_lib.c:844:4: Call 842. { 843. case SSL_TLSEXT_ERR_ALERT_FATAL: 844. ssl3_send_alert(s,SSL3_AL_FATAL,al); ^ 845. return -1; 846. ssl/s3_pkt.c:1317:1: Parameter `s->ctx->sessions->p` 1315. } 1316. 1317. > void ssl3_send_alert(SSL *s, int level, int desc) 1318. { 1319. /* Map tls/ssl alert value to correct one */ ssl/s3_pkt.c:1326:3: Call 1324. /* If a fatal one, remove from cache */ 1325. if ((level == 2) && (s->session != NULL)) 1326. SSL_CTX_remove_session(s->ctx,s->session); ^ 1327. 1328. s->s3->alert_dispatch=1; ssl/ssl_sess.c:614:1: Parameter `ctx->sessions->p` 612. } 613. 614. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 615. { 616. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:616:9: Call 614. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 615. { 616. return remove_session_lock(ctx, c, 1); ^ 617. } 618. ssl/ssl_sess.c:619:1: Parameter `ctx->sessions->pmax` 617. } 618. 619. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 620. { 621. SSL_SESSION *r; ssl/ssl_sess.c:630:21: Call 628. { 629. ret=1; 630. r=(SSL_SESSION *)lh_delete(ctx->sessions,c); ^ 631. SSL_SESSION_list_remove(ctx,c); 632. } crypto/lhash/lhash.c:217:1: Parameter `lh->pmax` 215. } 216. 217. > void *lh_delete(LHASH *lh, const void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:243:3: Call 241. if ((lh->num_nodes > MIN_NODES) && 242. (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes))) 243. contract(lh); ^ 244. 245. return(ret); crypto/lhash/lhash.c:364:1: <LHS trace> 362. } 363. 364. > static void contract(LHASH *lh) 365. { 366. LHASH_NODE **n,*n1,*np; crypto/lhash/lhash.c:364:1: Parameter `lh->p` 362. } 363. 364. > static void contract(LHASH *lh) 365. { 366. LHASH_NODE **n,*n1,*np; crypto/lhash/lhash.c:368:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `ssl3_get_server_hello` 366. LHASH_NODE **n,*n1,*np; 367. 368. np=lh->b[lh->p+lh->pmax-1]; ^ 369. lh->b[lh->p+lh->pmax-1]=NULL; /* 24/07-92 - eay - weird but :-( */ 370. if (lh->p == 0)
https://github.com/openssl/openssl/blob/02756aa8ba36af6e718d7a07c4e6bd8ad12e7ba1/crypto/lhash/lhash.c/#L368
d2a_code_trace_data_43108
static int ct_base64_decode(const char *in, unsigned char **out) { size_t inlen = strlen(in); int outlen, i; unsigned char *outbuf = NULL; if (inlen == 0) { *out = NULL; return 0; } outlen = (inlen / 4) * 3; outbuf = OPENSSL_malloc(outlen); if (outbuf == NULL) { CTerr(CT_F_CT_BASE64_DECODE, ERR_R_MALLOC_FAILURE); goto err; } outlen = EVP_DecodeBlock(outbuf, (unsigned char *)in, inlen); if (outlen < 0) { CTerr(CT_F_CT_BASE64_DECODE, CT_R_BASE64_DECODE_ERROR); goto err; } i = 0; while (in[--inlen] == '=') { --outlen; if (++i > 2) goto err; } *out = outbuf; return outlen; err: OPENSSL_free(outbuf); return -1; } test/ct_test.c:456: error: INTEGER_OVERFLOW_L1 ([-oo, 0] - 1):unsigned64 by call to `SCT_new_from_base64`. Showing all 8 steps of the trace test/ct_test.c:448:5: Array declaration 446. const char log_id[] = "3xwuwRUAlFJHqWFoMl3cXHlZ6PfG04j8AC4LvT9012Q="; 447. const uint64_t timestamp = 1; 448. const char extensions[] = ""; ^ 449. const char signature[] = "BAMARzBAMiBIL2dRrzXbplQ2vh/WZA89v5pBQpSVkkUwKI+j5" 450. "eI+BgIhAOTtwNs6xXKx4vXoq2poBlOYfc9BAn3+/6EFUZ2J7b8I"; test/ct_test.c:456:10: Call 454. 455. fixture.sct_list = sk_SCT_new_null(); 456. if (!TEST_ptr(sct = SCT_new_from_base64(SCT_VERSION_V1, log_id, ^ 457. CT_LOG_ENTRY_TYPE_X509, timestamp, 458. extensions, signature))) crypto/ct/ct_b64.c:63:1: Parameter `extensions_base64->strlen` 61. } 62. 63. > SCT *SCT_new_from_base64(unsigned char version, const char *logid_base64, 64. ct_log_entry_type_t entry_type, uint64_t timestamp, 65. const char *extensions_base64, crypto/ct/ct_b64.c:96:14: Call 94. dec = NULL; 95. 96. declen = ct_base64_decode(extensions_base64, &dec); ^ 97. if (declen < 0) { 98. CTerr(CT_F_SCT_NEW_FROM_BASE64, X509_R_BASE64_DECODE_ERROR); crypto/ct/ct_b64.c:24:1: <LHS trace> 22. * the caller. Do not provide a pre-allocated string in |out|. 23. */ 24. > static int ct_base64_decode(const char *in, unsigned char **out) 25. { 26. size_t inlen = strlen(in); crypto/ct/ct_b64.c:24:1: Parameter `in->strlen` 22. * the caller. Do not provide a pre-allocated string in |out|. 23. */ 24. > static int ct_base64_decode(const char *in, unsigned char **out) 25. { 26. size_t inlen = strlen(in); crypto/ct/ct_b64.c:26:5: Assignment 24. static int ct_base64_decode(const char *in, unsigned char **out) 25. { 26. size_t inlen = strlen(in); ^ 27. int outlen, i; 28. unsigned char *outbuf = NULL; crypto/ct/ct_b64.c:50:12: Binary operation: ([-oo, 0] - 1):unsigned64 by call to `SCT_new_from_base64` 48. /* Subtract padding bytes from |outlen|. Any more than 2 is malformed. */ 49. i = 0; 50. while (in[--inlen] == '=') { ^ 51. --outlen; 52. if (++i > 2)
https://github.com/openssl/openssl/blob/62b0a0dea612e3683c6bd4bef359fceda00238e8/crypto/ct/ct_b64.c/#L50
d2a_code_trace_data_43109
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/apps.c:1239: error: BUFFER_OVERRUN_L3 Offset: [-1, 199] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace apps/apps.c:1239:15: Call 1237. } 1238. if (lflags == XN_FLAG_COMPAT) { 1239. buf = X509_NAME_oneline(nm, 0, 0); ^ 1240. BIO_puts(out, buf); 1241. BIO_puts(out, "\n"); 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: [-1, 199] 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_43110
static int update_index(CA_DB *db, char **row) { char **irow; int i; irow = app_malloc(sizeof(*irow) * (DB_NUMBER + 1), "row pointers"); for (i = 0; i < DB_NUMBER; i++) { irow[i] = row[i]; row[i] = NULL; } irow[DB_NUMBER] = NULL; if (!TXT_DB_insert(db->db, irow)) { BIO_printf(bio_err, "failed to update srpvfile\n"); BIO_printf(bio_err, "TXT_DB error number %ld\n", db->db->error); OPENSSL_free(irow); return 0; } return 1; } apps/srp.c:153: error: MEMORY_LEAK memory dynamically allocated to `return` by call to `app_malloc()` at line 140, column 12 is not reachable after line 153, column 5. Showing all 25 steps of the trace apps/srp.c:135:1: start of procedure update_index() 133. } 134. 135. > static int update_index(CA_DB *db, char **row) 136. { 137. char **irow; apps/srp.c:140:5: 138. int i; 139. 140. > irow = app_malloc(sizeof(*irow) * (DB_NUMBER + 1), "row pointers"); 141. for (i = 0; i < DB_NUMBER; i++) { 142. irow[i] = row[i]; apps/apps.c:976:1: start of procedure app_malloc() 974. } 975. 976. > void* app_malloc(int sz, const char *what) 977. { 978. void *vp = OPENSSL_malloc(sz); apps/apps.c:978:5: 976. void* app_malloc(int sz, const char *what) 977. { 978. > void *vp = OPENSSL_malloc(sz); 979. 980. if (vp == 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) apps/apps.c:980:9: Taking false branch 978. void *vp = OPENSSL_malloc(sz); 979. 980. if (vp == NULL) { ^ 981. BIO_printf(bio_err, "%s: Could not allocate %d bytes for %s\n", 982. opt_getprog(), sz, what); apps/apps.c:986:5: 984. exit(1); 985. } 986. > return vp; 987. } 988. apps/apps.c:987:1: return from a call to app_malloc 985. } 986. return vp; 987. > } 988. 989. apps/srp.c:141:10: 139. 140. irow = app_malloc(sizeof(*irow) * (DB_NUMBER + 1), "row pointers"); 141. > for (i = 0; i < DB_NUMBER; i++) { 142. irow[i] = row[i]; 143. row[i] = NULL; apps/srp.c:141:17: Loop condition is true. Entering loop body 139. 140. irow = app_malloc(sizeof(*irow) * (DB_NUMBER + 1), "row pointers"); 141. for (i = 0; i < DB_NUMBER; i++) { ^ 142. irow[i] = row[i]; 143. row[i] = NULL; apps/srp.c:142:9: 140. irow = app_malloc(sizeof(*irow) * (DB_NUMBER + 1), "row pointers"); 141. for (i = 0; i < DB_NUMBER; i++) { 142. > irow[i] = row[i]; 143. row[i] = NULL; 144. } apps/srp.c:143:9: 141. for (i = 0; i < DB_NUMBER; i++) { 142. irow[i] = row[i]; 143. > row[i] = NULL; 144. } 145. irow[DB_NUMBER] = NULL; apps/srp.c:141:32: 139. 140. irow = app_malloc(sizeof(*irow) * (DB_NUMBER + 1), "row pointers"); 141. > for (i = 0; i < DB_NUMBER; i++) { 142. irow[i] = row[i]; 143. row[i] = NULL; apps/srp.c:141:17: Loop condition is false. Leaving loop 139. 140. irow = app_malloc(sizeof(*irow) * (DB_NUMBER + 1), "row pointers"); 141. for (i = 0; i < DB_NUMBER; i++) { ^ 142. irow[i] = row[i]; 143. row[i] = NULL; apps/srp.c:145:5: 143. row[i] = NULL; 144. } 145. > irow[DB_NUMBER] = NULL; 146. 147. if (!TXT_DB_insert(db->db, irow)) { apps/srp.c:147:10: Taking false branch 145. irow[DB_NUMBER] = NULL; 146. 147. if (!TXT_DB_insert(db->db, irow)) { ^ 148. BIO_printf(bio_err, "failed to update srpvfile\n"); 149. BIO_printf(bio_err, "TXT_DB error number %ld\n", db->db->error); apps/srp.c:153:5: 151. return 0; 152. } 153. > return 1; 154. } 155.
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/apps/srp.c/#L153
d2a_code_trace_data_43111
static int cert_status_cb(SSL *s, void *arg) { tlsextstatusctx *srctx = arg; BIO *err = srctx->err; char *host, *port, *path; int use_ssl; unsigned char *rspder = NULL; int rspderlen; STACK_OF(OPENSSL_STRING) *aia = NULL; X509 *x = NULL; X509_STORE_CTX inctx; X509_OBJECT obj; OCSP_REQUEST *req = NULL; OCSP_RESPONSE *resp = NULL; OCSP_CERTID *id = NULL; STACK_OF(X509_EXTENSION) *exts; int ret = SSL_TLSEXT_ERR_NOACK; int i; #if 0 STACK_OF(OCSP_RESPID) *ids; SSL_get_tlsext_status_ids(s, &ids); BIO_printf(err, "cert_status: received %d ids\n", sk_OCSP_RESPID_num(ids)); #endif if (srctx->verbose) BIO_puts(err, "cert_status: callback called\n"); x = SSL_get_certificate(s); aia = X509_get1_ocsp(x); if (aia) { if (!OCSP_parse_url(sk_OPENSSL_STRING_value(aia, 0), &host, &port, &path, &use_ssl)) { BIO_puts(err, "cert_status: can't parse AIA URL\n"); goto err; } if (srctx->verbose) BIO_printf(err, "cert_status: AIA URL: %s\n", sk_OPENSSL_STRING_value(aia, 0)); } else { if (!srctx->host) { BIO_puts(srctx->err, "cert_status: no AIA and no default responder URL\n"); goto done; } host = srctx->host; path = srctx->path; port = srctx->port; use_ssl = srctx->use_ssl; } if (!X509_STORE_CTX_init(&inctx, SSL_CTX_get_cert_store(SSL_get_SSL_CTX(s)), NULL, NULL)) goto err; if (X509_STORE_get_by_subject(&inctx,X509_LU_X509, X509_get_issuer_name(x),&obj) <= 0) { BIO_puts(err, "cert_status: Can't retrieve issuer certificate.\n"); X509_STORE_CTX_cleanup(&inctx); goto done; } req = OCSP_REQUEST_new(); if (!req) goto err; id = OCSP_cert_to_id(NULL, x, obj.data.x509); X509_free(obj.data.x509); X509_STORE_CTX_cleanup(&inctx); if (!id) goto err; if (!OCSP_request_add0_id(req, id)) goto err; id = NULL; SSL_get_tlsext_status_exts(s, &exts); for (i = 0; i < sk_X509_EXTENSION_num(exts); i++) { X509_EXTENSION *ext = sk_X509_EXTENSION_value(exts, i); if (!OCSP_REQUEST_add_ext(req, ext, -1)) goto err; } resp = process_responder(err, req, host, path, port, use_ssl, NULL, srctx->timeout); if (!resp) { BIO_puts(err, "cert_status: error querying responder\n"); goto done; } rspderlen = i2d_OCSP_RESPONSE(resp, &rspder); if (rspderlen <= 0) goto err; SSL_set_tlsext_status_ocsp_resp(s, rspder, rspderlen); if (srctx->verbose) { BIO_puts(err, "cert_status: ocsp response sent:\n"); OCSP_RESPONSE_print(err, resp, 2); } ret = SSL_TLSEXT_ERR_OK; done: if (ret != SSL_TLSEXT_ERR_OK) ERR_print_errors(err); if (aia) { OPENSSL_free(host); OPENSSL_free(path); OPENSSL_free(port); X509_email_free(aia); } if (id) OCSP_CERTID_free(id); if (req) OCSP_REQUEST_free(req); if (resp) OCSP_RESPONSE_free(resp); return ret; err: ret = SSL_TLSEXT_ERR_ALERT_FATAL; goto done; } apps/s_server.c:739: error: NULL_DEREFERENCE pointer `x` last assigned on line 738 could be null and is dereferenced by call to `X509_get1_ocsp()` at line 739, column 8. Showing all 31 steps of the trace apps/s_server.c:712:1: start of procedure cert_status_cb() 710. */ 711. 712. > static int cert_status_cb(SSL *s, void *arg) 713. { 714. tlsextstatusctx *srctx = arg; apps/s_server.c:714:2: 712. static int cert_status_cb(SSL *s, void *arg) 713. { 714. > tlsextstatusctx *srctx = arg; 715. BIO *err = srctx->err; 716. char *host, *port, *path; apps/s_server.c:715:2: 713. { 714. tlsextstatusctx *srctx = arg; 715. > BIO *err = srctx->err; 716. char *host, *port, *path; 717. int use_ssl; apps/s_server.c:718:2: 716. char *host, *port, *path; 717. int use_ssl; 718. > unsigned char *rspder = NULL; 719. int rspderlen; 720. STACK_OF(OPENSSL_STRING) *aia = NULL; apps/s_server.c:720:2: 718. unsigned char *rspder = NULL; 719. int rspderlen; 720. > STACK_OF(OPENSSL_STRING) *aia = NULL; 721. X509 *x = NULL; 722. X509_STORE_CTX inctx; apps/s_server.c:721:2: 719. int rspderlen; 720. STACK_OF(OPENSSL_STRING) *aia = NULL; 721. > X509 *x = NULL; 722. X509_STORE_CTX inctx; 723. X509_OBJECT obj; apps/s_server.c:724:2: 722. X509_STORE_CTX inctx; 723. X509_OBJECT obj; 724. > OCSP_REQUEST *req = NULL; 725. OCSP_RESPONSE *resp = NULL; 726. OCSP_CERTID *id = NULL; apps/s_server.c:725:2: 723. X509_OBJECT obj; 724. OCSP_REQUEST *req = NULL; 725. > OCSP_RESPONSE *resp = NULL; 726. OCSP_CERTID *id = NULL; 727. STACK_OF(X509_EXTENSION) *exts; apps/s_server.c:726:2: 724. OCSP_REQUEST *req = NULL; 725. OCSP_RESPONSE *resp = NULL; 726. > OCSP_CERTID *id = NULL; 727. STACK_OF(X509_EXTENSION) *exts; 728. int ret = SSL_TLSEXT_ERR_NOACK; apps/s_server.c:728:2: 726. OCSP_CERTID *id = NULL; 727. STACK_OF(X509_EXTENSION) *exts; 728. > int ret = SSL_TLSEXT_ERR_NOACK; 729. int i; 730. #if 0 apps/s_server.c:735:6: Taking true branch 733. BIO_printf(err, "cert_status: received %d ids\n", sk_OCSP_RESPID_num(ids)); 734. #endif 735. if (srctx->verbose) ^ 736. BIO_puts(err, "cert_status: callback called\n"); 737. /* Build up OCSP query from server certificate */ apps/s_server.c:736:3: 734. #endif 735. if (srctx->verbose) 736. > BIO_puts(err, "cert_status: callback called\n"); 737. /* Build up OCSP query from server certificate */ 738. x = SSL_get_certificate(s); crypto/bio/bio_lib.c:257:1: start of procedure BIO_puts() 255. } 256. 257. > int BIO_puts(BIO *b, const char *in) 258. { 259. int i; crypto/bio/bio_lib.c:262:7: Taking false branch 260. long (*cb)(BIO *,int,const char *,int,long,long); 261. 262. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) ^ 263. { 264. BIOerr(BIO_F_BIO_PUTS,BIO_R_UNSUPPORTED_METHOD); crypto/bio/bio_lib.c:262:22: Taking false branch 260. long (*cb)(BIO *,int,const char *,int,long,long); 261. 262. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) ^ 263. { 264. BIOerr(BIO_F_BIO_PUTS,BIO_R_UNSUPPORTED_METHOD); crypto/bio/bio_lib.c:262:45: Taking false branch 260. long (*cb)(BIO *,int,const char *,int,long,long); 261. 262. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) ^ 263. { 264. BIOerr(BIO_F_BIO_PUTS,BIO_R_UNSUPPORTED_METHOD); crypto/bio/bio_lib.c:268:2: 266. } 267. 268. > cb=b->callback; 269. 270. if ((cb != NULL) && crypto/bio/bio_lib.c:270:7: Taking false branch 268. cb=b->callback; 269. 270. if ((cb != NULL) && ^ 271. ((i=(int)cb(b,BIO_CB_PUTS,in,0,0L,1L)) <= 0)) 272. return(i); crypto/bio/bio_lib.c:274:7: Taking false branch 272. return(i); 273. 274. if (!b->init) ^ 275. { 276. BIOerr(BIO_F_BIO_PUTS,BIO_R_UNINITIALIZED); crypto/bio/bio_lib.c:280:2: Skipping __function_pointer__(): unresolved function pointer 278. } 279. 280. i=b->method->bputs(b,in); ^ 281. 282. if (i > 0) b->num_write+=(unsigned long)i; crypto/bio/bio_lib.c:282:6: Taking true branch 280. i=b->method->bputs(b,in); 281. 282. if (i > 0) b->num_write+=(unsigned long)i; ^ 283. 284. if (cb != NULL) crypto/bio/bio_lib.c:282:13: 280. i=b->method->bputs(b,in); 281. 282. > if (i > 0) b->num_write+=(unsigned long)i; 283. 284. if (cb != NULL) crypto/bio/bio_lib.c:284:6: Taking false branch 282. if (i > 0) b->num_write+=(unsigned long)i; 283. 284. if (cb != NULL) ^ 285. i=(int)cb(b,BIO_CB_PUTS|BIO_CB_RETURN,in,0, 286. 0L,(long)i); crypto/bio/bio_lib.c:287:2: 285. i=(int)cb(b,BIO_CB_PUTS|BIO_CB_RETURN,in,0, 286. 0L,(long)i); 287. > return(i); 288. } 289. crypto/bio/bio_lib.c:288:2: return from a call to BIO_puts 286. 0L,(long)i); 287. return(i); 288. } ^ 289. 290. int BIO_gets(BIO *b, char *in, int inl) apps/s_server.c:738:2: 736. BIO_puts(err, "cert_status: callback called\n"); 737. /* Build up OCSP query from server certificate */ 738. > x = SSL_get_certificate(s); 739. aia = X509_get1_ocsp(x); 740. if (aia) ssl/ssl_lib.c:2601:1: start of procedure SSL_get_certificate() 2599. 2600. /* Fix this function so that it takes an optional type parameter */ 2601. > X509 *SSL_get_certificate(const SSL *s) 2602. { 2603. if (s->cert != NULL) ssl/ssl_lib.c:2603:6: Taking false branch 2601. X509 *SSL_get_certificate(const SSL *s) 2602. { 2603. if (s->cert != NULL) ^ 2604. return(s->cert->key->x509); 2605. else ssl/ssl_lib.c:2606:3: 2604. return(s->cert->key->x509); 2605. else 2606. > return(NULL); 2607. } 2608. ssl/ssl_lib.c:2607:2: return from a call to SSL_get_certificate 2605. else 2606. return(NULL); 2607. } ^ 2608. 2609. /* Fix this function so that it takes an optional type parameter */ apps/s_server.c:739:2: 737. /* Build up OCSP query from server certificate */ 738. x = SSL_get_certificate(s); 739. > aia = X509_get1_ocsp(x); 740. if (aia) 741. {
https://github.com/openssl/openssl/blob/3fc2efd241bdded36dbc099d5d8016ed39311753/apps/s_server.c/#L739
d2a_code_trace_data_43112
int BN_set_bit(BIGNUM *a, int n) { int i, j, k; if (n < 0) return 0; i = n / BN_BITS2; j = n % BN_BITS2; if (a->top <= i) { if (bn_wexpand(a, i + 1) == NULL) return (0); for (k = a->top; k < i + 1; k++) a->d[k] = 0; a->top = i + 1; } a->d[i] |= (((BN_ULONG)1) << j); bn_check_top(a); return (1); } test/bntest.c:449: error: BUFFER_OVERRUN_L3 Offset: [0, 193] Size: [0, 8388607] by call to `BN_GF2m_arr2poly`. Showing all 9 steps of the trace test/bntest.c:437:23: Assignment 435. { 436. static int p0[] = { 163, 7, 6, 3, 0, -1 }; 437. static int p1[] = { 193, 15, 0, -1 }; ^ 438. BIGNUM *a, *b[2], *c, *d, *e; 439. int i, j, st = 0; test/bntest.c:449:5: Call 447. 448. BN_GF2m_arr2poly(p0, b[0]); 449. BN_GF2m_arr2poly(p1, b[1]); ^ 450. 451. for (i = 0; i < NUM0; i++) { crypto/bn/bn_gf2m.c:1209:1: Parameter `*p` 1207. * bit-string. The array must be terminated by -1. 1208. */ 1209. > int BN_GF2m_arr2poly(const int p[], BIGNUM *a) 1210. { 1211. int i; crypto/bn/bn_gf2m.c:1216:13: Call 1214. BN_zero(a); 1215. for (i = 0; p[i] != -1; i++) { 1216. if (BN_set_bit(a, p[i]) == 0) ^ 1217. return 0; 1218. } crypto/bn/bn_lib.c:692:1: <Offset trace> 690. } 691. 692. > int BN_set_bit(BIGNUM *a, int n) 693. { 694. int i, j, k; crypto/bn/bn_lib.c:692:1: Parameter `a->top` 690. } 691. 692. > int BN_set_bit(BIGNUM *a, int n) 693. { 694. int i, j, k; crypto/bn/bn_lib.c:692:1: <Length trace> 690. } 691. 692. > int BN_set_bit(BIGNUM *a, int n) 693. { 694. int i, j, k; crypto/bn/bn_lib.c:692:1: Parameter `*a->d` 690. } 691. 692. > int BN_set_bit(BIGNUM *a, int n) 693. { 694. int i, j, k; crypto/bn/bn_lib.c:709:5: Array access: Offset: [0, 193] Size: [0, 8388607] by call to `BN_GF2m_arr2poly` 707. } 708. 709. a->d[i] |= (((BN_ULONG)1) << j); ^ 710. bn_check_top(a); 711. return (1);
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_lib.c/#L709
d2a_code_trace_data_43113
int test_sub(BIO *bp) { BIGNUM *a, *b, *c; int i; a = BN_new(); b = BN_new(); c = BN_new(); for (i = 0; i < num0 + num1; i++) { if (i < num1) { BN_bntest_rand(a, 512, 0, 0); BN_copy(b, a); if (BN_set_bit(a, i) == 0) return (0); BN_add_word(b, i); } else { BN_bntest_rand(b, 400 + i - num1, 0, 0); a->neg = rand_neg(); b->neg = rand_neg(); } BN_sub(c, a, b); 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_add(c, c, b); BN_sub(c, c, a); if (!BN_is_zero(c)) { fprintf(stderr, "Subtract test failed!\n"); return 0; } } BN_free(a); BN_free(b); BN_free(c); return (1); } test/bntest.c:445: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 411, column 9 is not reachable after line 445, column 5. Showing all 108 steps of the trace test/bntest.c:404:1: start of procedure test_sub() 402. } 403. 404. > int test_sub(BIO *bp) 405. { 406. BIGNUM *a, *b, *c; test/bntest.c:409:5: 407. int i; 408. 409. > a = BN_new(); 410. b = BN_new(); 411. 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:410:5: 408. 409. a = BN_new(); 410. > b = BN_new(); 411. c = BN_new(); 412. 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:411:5: 409. a = BN_new(); 410. b = BN_new(); 411. > c = BN_new(); 412. 413. 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:413:10: 411. c = BN_new(); 412. 413. > for (i = 0; i < num0 + num1; i++) { 414. if (i < num1) { 415. BN_bntest_rand(a, 512, 0, 0); test/bntest.c:413:17: Loop condition is false. Leaving loop 411. c = BN_new(); 412. 413. for (i = 0; i < num0 + num1; i++) { ^ 414. if (i < num1) { 415. BN_bntest_rand(a, 512, 0, 0); test/bntest.c:443:5: 441. } 442. } 443. > BN_free(a); 444. BN_free(b); 445. 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:444:5: 442. } 443. BN_free(a); 444. > BN_free(b); 445. BN_free(c); 446. return (1); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a) test/bntest.c:445:5: 443. BN_free(a); 444. BN_free(b); 445. > BN_free(c); 446. return (1); 447. } crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L445
d2a_code_trace_data_43114
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ecdsa_ossl.c:244: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `bn_mul_mont_fixed_top`. Showing all 17 steps of the trace crypto/ec/ecdsa_ossl.c:223:18: Call 221. do { 222. if (in_kinv == NULL || in_r == NULL) { 223. if (!ecdsa_sign_setup(eckey, ctx, &kinv, &ret->r, dgst, dgst_len)) { ^ 224. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_ECDSA_LIB); 225. goto err; crypto/ec/ecdsa_ossl.c:33:1: Parameter `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:244:17: Call 242. */ 243. if (!bn_to_mont_fixed_top(s, ret->r, group->mont_data, ctx) 244. || !bn_mul_mont_fixed_top(s, s, priv_key, group->mont_data, ctx)) { ^ 245. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB); 246. goto err; crypto/bn/bn_mont.c:37:1: Parameter `ctx->stack.depth` 35. } 36. 37. > int bn_mul_mont_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 38. BN_MONT_CTX *mont, BN_CTX *ctx) 39. { crypto/bn/bn_mont.c:60:5: Call 58. return 0; 59. 60. BN_CTX_start(ctx); ^ 61. tmp = BN_CTX_get(ctx); 62. if (tmp == NULL) crypto/bn/bn_ctx.c: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:67:14: Call 65. bn_check_top(tmp); 66. if (a == b) { 67. if (!BN_sqr(tmp, a, ctx)) ^ 68. goto err; 69. } else { crypto/bn/bn_sqr.c:32:5: Call 30. } 31. 32. BN_CTX_start(ctx); ^ 33. rr = (a != r) ? r : BN_CTX_get(ctx); 34. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:181:1: Parameter `*ctx->stack.indexes` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_sqr.c:94:5: Call 92. bn_check_top(rr); 93. bn_check_top(tmp); 94. BN_CTX_end(ctx); ^ 95. return ret; 96. } 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:274:1: <Offset trace> 272. } 273. 274. > static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:274:1: Parameter `st->depth` 272. } 273. 274. > static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:274:1: <Length trace> 272. } 273. 274. > static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:274:1: Parameter `*st->indexes` 272. } 273. 274. > static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:276:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `bn_mul_mont_fixed_top` 274. static unsigned int BN_STACK_pop(BN_STACK *st) 275. { 276. return st->indexes[--(st->depth)]; ^ 277. } 278.
https://github.com/openssl/openssl/blob/4cc968df403ed9321d0df722aba33323ae575ce0/crypto/bn/bn_ctx.c/#L276
d2a_code_trace_data_43115
static int dv_audio_frame_size(const DVprofile* sys, int frame) { return sys->audio_samples_dist[frame % (sizeof(sys->audio_samples_dist)/ sizeof(sys->audio_samples_dist[0]))]; } libavformat/dvenc.c:66: error: Buffer Overrun L3 Offset: [-4, 4] Size: 5. libavformat/dvenc.c:64:1: <Offset trace> 62. }; 63. 64. static int dv_audio_frame_size(const DVprofile* sys, int frame) ^ 65. { 66. return sys->audio_samples_dist[frame % (sizeof(sys->audio_samples_dist)/ libavformat/dvenc.c:64:1: Parameter `frame` 62. }; 63. 64. static int dv_audio_frame_size(const DVprofile* sys, int frame) ^ 65. { 66. return sys->audio_samples_dist[frame % (sizeof(sys->audio_samples_dist)/ libavformat/dvenc.c:64:1: <Length trace> 62. }; 63. 64. static int dv_audio_frame_size(const DVprofile* sys, int frame) ^ 65. { 66. return sys->audio_samples_dist[frame % (sizeof(sys->audio_samples_dist)/ libavformat/dvenc.c:64:1: Parameter `sys->audio_samples_dist[*]` 62. }; 63. 64. static int dv_audio_frame_size(const DVprofile* sys, int frame) ^ 65. { 66. return sys->audio_samples_dist[frame % (sizeof(sys->audio_samples_dist)/ libavformat/dvenc.c:66:12: Array access: Offset: [-4, 4] Size: 5 64. static int dv_audio_frame_size(const DVprofile* sys, int frame) 65. { 66. return sys->audio_samples_dist[frame % (sizeof(sys->audio_samples_dist)/ ^ 67. sizeof(sys->audio_samples_dist[0]))]; 68. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/dvenc.c/#L66
d2a_code_trace_data_43116
int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) { unsigned char *dest; if (len == 0) return 1; if (!WPACKET_allocate_bytes(pkt, len, &dest)) return 0; memcpy(dest, src, len); return 1; } ssl/statem/statem_srvr.c:1548: error: BUFFER_OVERRUN_S2 Offset added: [`pkt->curr` + 32, `pkt->curr` + 36] (⇐ [`pkt->curr`, `pkt->curr` + 4] + 32) Size: [1, 2147483644] by call to `WPACKET_memcpy`. Showing all 13 steps of the trace ssl/statem/statem_srvr.c:1538:1: Parameter `pkt->curr` 1536. } 1537. 1538. > int tls_construct_server_hello(SSL *s, WPACKET *pkt) 1539. { 1540. int compm, al = SSL_AD_INTERNAL_ERROR; ssl/statem/statem_srvr.c:1543:10: Call 1541. size_t sl, len; 1542. 1543. if (!WPACKET_put_bytes_u16(pkt, s->version) ^ 1544. /* 1545. * Random stuff. Filling of the server_random takes place in ssl/packet.c:261:1: Parameter `pkt->curr` 259. } 260. 261. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 262. { 263. unsigned char *data; ssl/statem/statem_srvr.c:1548:17: Call 1546. * tls_process_client_hello() 1547. */ 1548. || !WPACKET_memcpy(pkt, s->s3->server_random, SSL3_RANDOM_SIZE)) { ^ 1549. SSLerr(SSL_F_TLS_CONSTRUCT_SERVER_HELLO, ERR_R_INTERNAL_ERROR); 1550. goto err; ssl/packet.c:302:1: <Offset trace> 300. } 301. 302. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) 303. { 304. unsigned char *dest; ssl/packet.c:302:1: Parameter `len` 300. } 301. 302. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) 303. { 304. unsigned char *dest; ssl/packet.c:302:1: <Length trace> 300. } 301. 302. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) 303. { 304. unsigned char *dest; ssl/packet.c:302:1: Parameter `*pkt->buf->data` 300. } 301. 302. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) 303. { 304. unsigned char *dest; ssl/packet.c:309:10: Call 307. return 1; 308. 309. if (!WPACKET_allocate_bytes(pkt, len, &dest)) ^ 310. return 0; 311. ssl/packet.c:15:1: Parameter `**allocbytes` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ssl/packet.c:17:10: Call 15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ^ 18. return 0; 19. ssl/packet.c:36:1: Parameter `**allocbytes` 34. } 35. 36. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 37. { 38. /* Internal API, so should not fail */ ssl/packet.c:312:5: Array access: Offset added: [pkt->curr + 32, pkt->curr + 36] (⇐ [pkt->curr, pkt->curr + 4] + 32) Size: [1, 2147483644] by call to `WPACKET_memcpy` 310. return 0; 311. 312. memcpy(dest, src, len); ^ 313. 314. return 1;
https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/ssl/packet.c/#L312
d2a_code_trace_data_43117
static inline void idct4col_add(uint8_t *dest, ptrdiff_t line_size, const int16_t *col) { int c0, c1, c2, c3, a0, a1, a2, a3; a0 = col[8*0]; a1 = col[8*1]; a2 = col[8*2]; a3 = col[8*3]; c0 = (a0 + a2)*C3 + (1 << (C_SHIFT - 1)); c2 = (a0 - a2)*C3 + (1 << (C_SHIFT - 1)); c1 = a1 * C1 + a3 * C2; c3 = a1 * C2 - a3 * C1; dest[0] = av_clip_uint8(dest[0] + ((c0 + c1) >> C_SHIFT)); dest += line_size; dest[0] = av_clip_uint8(dest[0] + ((c2 + c3) >> C_SHIFT)); dest += line_size; dest[0] = av_clip_uint8(dest[0] + ((c2 - c3) >> C_SHIFT)); dest += line_size; dest[0] = av_clip_uint8(dest[0] + ((c0 - c1) >> C_SHIFT)); } libavcodec/wmv2.c:97: error: Buffer Overrun L1 Offset: [29, 36] (⇐ [5, 12] + 24) Size: 6 by call to `wmv2_add_block`. libavcodec/wmv2.c:97:5: Call 95. 96. wmv2_add_block(w, block1[4], dest_cb, s->uvlinesize, 4); 97. wmv2_add_block(w, block1[5], dest_cr, s->uvlinesize, 5); ^ 98. } 99. libavcodec/wmv2.c:57:1: Parameter `n` 55. } 56. 57. static void wmv2_add_block(Wmv2Context *w, int16_t *block1, ^ 58. uint8_t *dst, int stride, int n) 59. { libavcodec/wmv2.c:69:13: Call 67. case 1: 68. ff_simple_idct84_add(dst, stride, block1); 69. ff_simple_idct84_add(dst + 4 * stride, stride, w->abt_block2[n]); ^ 70. s->bdsp.clear_block(w->abt_block2[n]); 71. break; libavcodec/simple_idct.c:176:1: Parameter `*block` 174. } 175. 176. void ff_simple_idct84_add(uint8_t *dest, ptrdiff_t line_size, int16_t *block) ^ 177. { 178. int i; libavcodec/simple_idct.c:187:9: Call 185. /* IDCT4 and store */ 186. for(i=0;i<8;i++) { 187. idct4col_add(dest + i, line_size, block + i); ^ 188. } 189. } libavcodec/simple_idct.c:131:1: <Length trace> 129. #define C3 C_FIX(0.5) 130. #define C_SHIFT (4+1+12) 131. static inline void idct4col_add(uint8_t *dest, ptrdiff_t line_size, const int16_t *col) ^ 132. { 133. int c0, c1, c2, c3, a0, a1, a2, a3; libavcodec/simple_idct.c:131:1: Parameter `*col` 129. #define C3 C_FIX(0.5) 130. #define C_SHIFT (4+1+12) 131. static inline void idct4col_add(uint8_t *dest, ptrdiff_t line_size, const int16_t *col) ^ 132. { 133. int c0, c1, c2, c3, a0, a1, a2, a3; libavcodec/simple_idct.c:138:10: Array access: Offset: [29, 36] (⇐ [5, 12] + 24) Size: 6 by call to `wmv2_add_block` 136. a1 = col[8*1]; 137. a2 = col[8*2]; 138. a3 = col[8*3]; ^ 139. c0 = (a0 + a2)*C3 + (1 << (C_SHIFT - 1)); 140. c2 = (a0 - a2)*C3 + (1 << (C_SHIFT - 1));
https://github.com/libav/libav/blob/2ec9fa5ec60dcd10e1cb10d8b4e4437e634ea428/libavcodec/simple_idct.c/#L138
d2a_code_trace_data_43118
AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) { AVFilterBufferRef *ret = NULL; av_unused char buf[16]; FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, sizeof(buf), perms), w, h); if (link->dstpad->get_video_buffer) ret = link->dstpad->get_video_buffer(link, perms, w, h); if (!ret) ret = avfilter_default_get_video_buffer(link, perms, w, h); if (ret) ret->type = AVMEDIA_TYPE_VIDEO; FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " returning "); ff_dlog_ref(NULL, ret, 1); return ret; } libavfilter/avfilter.c:306: error: Null Dereference pointer `ret` last assigned on line 301 could be null and is dereferenced by call to `ff_dlog_ref()` at line 306, column 106. libavfilter/avfilter.c:289:1: start of procedure avfilter_get_video_buffer() 287. #define FF_DPRINTF_START(ctx, func) av_dlog(NULL, "%-16s: ", #func) 288. 289. AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) ^ 290. { 291. AVFilterBufferRef *ret = NULL; libavfilter/avfilter.c:291:5: 289. AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) 290. { 291. AVFilterBufferRef *ret = NULL; ^ 292. 293. av_unused char buf[16]; libavfilter/avfilter.c:294:47: 292. 293. av_unused char buf[16]; 294. FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0); ^ 295. av_dlog(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, sizeof(buf), perms), w, h); 296. libavfilter/avfilter.c:263:1: start of procedure ff_dlog_link() 261. } 262. 263. static void ff_dlog_link(void *ctx, AVFilterLink *link, int end) ^ 264. { 265. if (link->type == AVMEDIA_TYPE_VIDEO) { libavfilter/avfilter.c:265:9: Taking false branch 263. static void ff_dlog_link(void *ctx, AVFilterLink *link, int end) 264. { 265. if (link->type == AVMEDIA_TYPE_VIDEO) { ^ 266. av_dlog(ctx, 267. "link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s", libavfilter/avfilter.c:275:9: Skipping av_get_channel_layout_string(): empty list of specs 273. } else { 274. char buf[128]; 275. av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout); ^ 276. 277. av_dlog(ctx, libavfilter/avfilter.c:265:5: 263. static void ff_dlog_link(void *ctx, AVFilterLink *link, int end) 264. { 265. if (link->type == AVMEDIA_TYPE_VIDEO) { ^ 266. av_dlog(ctx, 267. "link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s", libavfilter/avfilter.c:285:1: return from a call to ff_dlog_link 283. end ? "\n" : ""); 284. } 285. } ^ 286. 287. #define FF_DPRINTF_START(ctx, func) av_dlog(NULL, "%-16s: ", #func) libavfilter/avfilter.c:297:9: Taking true branch 295. av_dlog(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, sizeof(buf), perms), w, h); 296. 297. if (link->dstpad->get_video_buffer) ^ 298. ret = link->dstpad->get_video_buffer(link, perms, w, h); 299. libavfilter/avfilter.c:298:9: Skipping __function_pointer__(): unresolved function pointer 296. 297. if (link->dstpad->get_video_buffer) 298. ret = link->dstpad->get_video_buffer(link, perms, w, h); ^ 299. 300. if (!ret) libavfilter/avfilter.c:300:10: Taking true branch 298. ret = link->dstpad->get_video_buffer(link, perms, w, h); 299. 300. if (!ret) ^ 301. ret = avfilter_default_get_video_buffer(link, perms, w, h); 302. libavfilter/avfilter.c:301:9: Skipping avfilter_default_get_video_buffer(): empty list of specs 299. 300. if (!ret) 301. ret = avfilter_default_get_video_buffer(link, perms, w, h); ^ 302. 303. if (ret) libavfilter/avfilter.c:303:9: Taking false branch 301. ret = avfilter_default_get_video_buffer(link, perms, w, h); 302. 303. if (ret) ^ 304. ret->type = AVMEDIA_TYPE_VIDEO; 305. libavfilter/avfilter.c:306:47: 304. ret->type = AVMEDIA_TYPE_VIDEO; 305. 306. FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " returning "); ff_dlog_ref(NULL, ret, 1); ^ 307. 308. return ret; libavfilter/avfilter.c:263:1: start of procedure ff_dlog_link() 261. } 262. 263. static void ff_dlog_link(void *ctx, AVFilterLink *link, int end) ^ 264. { 265. if (link->type == AVMEDIA_TYPE_VIDEO) { libavfilter/avfilter.c:265:9: Taking false branch 263. static void ff_dlog_link(void *ctx, AVFilterLink *link, int end) 264. { 265. if (link->type == AVMEDIA_TYPE_VIDEO) { ^ 266. av_dlog(ctx, 267. "link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s", libavfilter/avfilter.c:275:9: Skipping av_get_channel_layout_string(): empty list of specs 273. } else { 274. char buf[128]; 275. av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout); ^ 276. 277. av_dlog(ctx, libavfilter/avfilter.c:265:5: 263. static void ff_dlog_link(void *ctx, AVFilterLink *link, int end) 264. { 265. if (link->type == AVMEDIA_TYPE_VIDEO) { ^ 266. av_dlog(ctx, 267. "link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s", libavfilter/avfilter.c:285:1: return from a call to ff_dlog_link 283. end ? "\n" : ""); 284. } 285. } ^ 286. 287. #define FF_DPRINTF_START(ctx, func) av_dlog(NULL, "%-16s: ", #func) libavfilter/avfilter.c:306:106: 304. ret->type = AVMEDIA_TYPE_VIDEO; 305. 306. FF_DPRINTF_START(NULL, get_video_buffer); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " returning "); ff_dlog_ref(NULL, ret, 1); ^ 307. 308. return ret; libavfilter/avfilter.c:233:1: start of procedure ff_dlog_ref() 231. #endif 232. 233. static void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end) ^ 234. { 235. av_unused char buf[16]; libavfilter/avfilter.c:242:9: Taking false branch 240. ref->pts, ref->pos); 241. 242. if (ref->video) { ^ 243. av_dlog(ctx, " a:%d/%d s:%dx%d i:%c iskey:%d type:%c", 244. ref->video->pixel_aspect.num, ref->video->pixel_aspect.den,
https://github.com/libav/libav/blob/1c9e340d35351858907f11c45b2691db708f3903/libavfilter/avfilter.c/#L306
d2a_code_trace_data_43119
static int check_bits_for_superframe(GetBitContext *orig_gb, WMAVoiceContext *s) { GetBitContext s_gb, *gb = &s_gb; int n, need_bits, bd_idx; const struct frame_type_desc *frame_desc; init_get_bits(gb, orig_gb->buffer, orig_gb->size_in_bits); skip_bits_long(gb, get_bits_count(orig_gb)); assert(get_bits_left(gb) == get_bits_left(orig_gb)); if (get_bits_left(gb) < 14) return 1; if (!get_bits1(gb)) return AVERROR(ENOSYS); if (get_bits1(gb)) skip_bits(gb, 12); if (s->has_residual_lsps) { if (get_bits_left(gb) < s->sframe_lsp_bitsize) return 1; skip_bits_long(gb, s->sframe_lsp_bitsize); } for (n = 0; n < MAX_FRAMES; n++) { int aw_idx_is_ext = 0; if (!s->has_residual_lsps) { if (get_bits_left(gb) < s->frame_lsp_bitsize) return 1; skip_bits_long(gb, s->frame_lsp_bitsize); } bd_idx = s->vbm_tree[get_vlc2(gb, frame_type_vlc.table, 6, 3)]; if (bd_idx < 0) return AVERROR_INVALIDDATA; frame_desc = &frame_descs[bd_idx]; if (frame_desc->acb_type == ACB_TYPE_ASYMMETRIC) { if (get_bits_left(gb) < s->pitch_nbits) return 1; skip_bits_long(gb, s->pitch_nbits); } if (frame_desc->fcb_type == FCB_TYPE_SILENCE) { skip_bits(gb, 8); } else if (frame_desc->fcb_type == FCB_TYPE_AW_PULSES) { int tmp = get_bits(gb, 6); if (tmp >= 0x36) { skip_bits(gb, 2); aw_idx_is_ext = 1; } } if (frame_desc->acb_type == ACB_TYPE_HAMMING) { need_bits = s->block_pitch_nbits + (frame_desc->n_blocks - 1) * s->block_delta_pitch_nbits; } else if (frame_desc->fcb_type == FCB_TYPE_AW_PULSES) { need_bits = 2 * !aw_idx_is_ext; } else need_bits = 0; need_bits += frame_desc->frame_size; if (get_bits_left(gb) < need_bits) return 1; skip_bits_long(gb, need_bits); } return 0; } libavcodec/wmavoice.c:1682: error: Null Dereference pointer `gb->buffer` last assigned on line 1675 could be null and is dereferenced by call to `get_bits1()` at line 1682, column 10. libavcodec/wmavoice.c:1667:1: start of procedure check_bits_for_superframe() 1665. * @return < 0 on error, 1 on not enough bits or 0 if OK. 1666. */ 1667. static int check_bits_for_superframe(GetBitContext *orig_gb, ^ 1668. WMAVoiceContext *s) 1669. { libavcodec/wmavoice.c:1670:5: 1668. WMAVoiceContext *s) 1669. { 1670. GetBitContext s_gb, *gb = &s_gb; ^ 1671. int n, need_bits, bd_idx; 1672. const struct frame_type_desc *frame_desc; libavcodec/wmavoice.c:1675:5: 1673. 1674. /* initialize a copy */ 1675. init_get_bits(gb, orig_gb->buffer, orig_gb->size_in_bits); ^ 1676. skip_bits_long(gb, get_bits_count(orig_gb)); 1677. assert(get_bits_left(gb) == get_bits_left(orig_gb)); libavcodec/get_bits.h:376:1: start of procedure init_get_bits() 374. * @return 0 on success, AVERROR_INVALIDDATA if the buffer_size would overflow. 375. */ 376. static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer, ^ 377. int bit_size) 378. { libavcodec/get_bits.h:380:5: 378. { 379. int buffer_size; 380. int ret = 0; ^ 381. 382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { libavcodec/get_bits.h:382:9: Taking true branch 380. int ret = 0; 381. 382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { ^ 383. bit_size = 0; 384. buffer = NULL; libavcodec/get_bits.h:383:9: 381. 382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { 383. bit_size = 0; ^ 384. buffer = NULL; 385. ret = AVERROR_INVALIDDATA; libavcodec/get_bits.h:384:9: 382. if (bit_size > INT_MAX - 7 || bit_size < 0 || !buffer) { 383. bit_size = 0; 384. buffer = NULL; ^ 385. ret = AVERROR_INVALIDDATA; 386. } libavcodec/get_bits.h:385:9: 383. bit_size = 0; 384. buffer = NULL; 385. ret = AVERROR_INVALIDDATA; ^ 386. } 387. libavcodec/get_bits.h:388:5: 386. } 387. 388. buffer_size = (bit_size + 7) >> 3; ^ 389. 390. s->buffer = buffer; libavcodec/get_bits.h:390:5: 388. buffer_size = (bit_size + 7) >> 3; 389. 390. s->buffer = buffer; ^ 391. s->size_in_bits = bit_size; 392. #if !UNCHECKED_BITSTREAM_READER libavcodec/get_bits.h:391:5: 389. 390. s->buffer = buffer; 391. s->size_in_bits = bit_size; ^ 392. #if !UNCHECKED_BITSTREAM_READER 393. s->size_in_bits_plus8 = bit_size + 8; libavcodec/get_bits.h:393:5: 391. s->size_in_bits = bit_size; 392. #if !UNCHECKED_BITSTREAM_READER 393. s->size_in_bits_plus8 = bit_size + 8; ^ 394. #endif 395. s->buffer_end = buffer + buffer_size; libavcodec/get_bits.h:395:5: 393. s->size_in_bits_plus8 = bit_size + 8; 394. #endif 395. s->buffer_end = buffer + buffer_size; ^ 396. s->index = 0; 397. libavcodec/get_bits.h:396:5: 394. #endif 395. s->buffer_end = buffer + buffer_size; 396. s->index = 0; ^ 397. 398. return ret; libavcodec/get_bits.h:398:5: 396. s->index = 0; 397. 398. return ret; ^ 399. } 400. libavcodec/get_bits.h:399:1: return from a call to init_get_bits 397. 398. return ret; 399. } ^ 400. 401. /** libavcodec/wmavoice.c:1676:5: 1674. /* initialize a copy */ 1675. init_get_bits(gb, orig_gb->buffer, orig_gb->size_in_bits); 1676. skip_bits_long(gb, get_bits_count(orig_gb)); ^ 1677. assert(get_bits_left(gb) == get_bits_left(orig_gb)); 1678. libavcodec/get_bits.h:195:1: start of procedure get_bits_count() 193. #define GET_CACHE(name, gb) ((uint32_t) name ## _cache) 194. 195. static inline int get_bits_count(const GetBitContext *s) ^ 196. { 197. return s->index; libavcodec/get_bits.h:197:5: 195. static inline int get_bits_count(const GetBitContext *s) 196. { 197. return s->index; ^ 198. } 199. libavcodec/get_bits.h:198:1: return from a call to get_bits_count 196. { 197. return s->index; 198. } ^ 199. 200. static inline void skip_bits_long(GetBitContext *s, int n) libavcodec/get_bits.h:200:1: start of procedure skip_bits_long() 198. } 199. 200. static inline void skip_bits_long(GetBitContext *s, int n) ^ 201. { 202. #if UNCHECKED_BITSTREAM_READER libavcodec/get_bits.h:203:5: 201. { 202. #if UNCHECKED_BITSTREAM_READER 203. s->index += n; ^ 204. #else 205. s->index += av_clip(n, -s->index, s->size_in_bits_plus8 - s->index); libavcodec/get_bits.h:207:1: return from a call to skip_bits_long 205. s->index += av_clip(n, -s->index, s->size_in_bits_plus8 - s->index); 206. #endif 207. } ^ 208. 209. /** libavcodec/wmavoice.c:1677:5: 1675. init_get_bits(gb, orig_gb->buffer, orig_gb->size_in_bits); 1676. skip_bits_long(gb, get_bits_count(orig_gb)); 1677. assert(get_bits_left(gb) == get_bits_left(orig_gb)); ^ 1678. 1679. /* superframe header */ libavcodec/wmavoice.c:1680:9: 1678. 1679. /* superframe header */ 1680. if (get_bits_left(gb) < 14) ^ 1681. return 1; 1682. if (!get_bits1(gb)) libavcodec/get_bits.h:556:1: start of procedure get_bits_left() 554. } 555. 556. static inline int get_bits_left(GetBitContext *gb) ^ 557. { 558. return gb->size_in_bits - get_bits_count(gb); libavcodec/get_bits.h:558:5: 556. static inline int get_bits_left(GetBitContext *gb) 557. { 558. return gb->size_in_bits - get_bits_count(gb); ^ 559. } 560. libavcodec/get_bits.h:195:1: start of procedure get_bits_count() 193. #define GET_CACHE(name, gb) ((uint32_t) name ## _cache) 194. 195. static inline int get_bits_count(const GetBitContext *s) ^ 196. { 197. return s->index; libavcodec/get_bits.h:197:5: 195. static inline int get_bits_count(const GetBitContext *s) 196. { 197. return s->index; ^ 198. } 199. libavcodec/get_bits.h:198:1: return from a call to get_bits_count 196. { 197. return s->index; 198. } ^ 199. 200. static inline void skip_bits_long(GetBitContext *s, int n) libavcodec/get_bits.h:559:1: return from a call to get_bits_left 557. { 558. return gb->size_in_bits - get_bits_count(gb); 559. } ^ 560. 561. //#define TRACE libavcodec/wmavoice.c:1680:9: Taking false branch 1678. 1679. /* superframe header */ 1680. if (get_bits_left(gb) < 14) ^ 1681. return 1; 1682. if (!get_bits1(gb)) libavcodec/wmavoice.c:1682:10: 1680. if (get_bits_left(gb) < 14) 1681. return 1; 1682. if (!get_bits1(gb)) ^ 1683. return AVERROR(ENOSYS); // WMAPro-in-WMAVoice superframe 1684. if (get_bits1(gb)) skip_bits(gb, 12); // number of samples in superframe libavcodec/get_bits.h:272:1: start of procedure get_bits1() 270. } 271. 272. static inline unsigned int get_bits1(GetBitContext *s) ^ 273. { 274. unsigned int index = s->index; libavcodec/get_bits.h:274:5: 272. static inline unsigned int get_bits1(GetBitContext *s) 273. { 274. unsigned int index = s->index; ^ 275. uint8_t result = s->buffer[index >> 3]; 276. #ifdef BITSTREAM_READER_LE libavcodec/get_bits.h:275:5: 273. { 274. unsigned int index = s->index; 275. uint8_t result = s->buffer[index >> 3]; ^ 276. #ifdef BITSTREAM_READER_LE 277. result >>= index & 7;
https://github.com/libav/libav/blob/77ab341c0c6cdf2bd437bb48d429e797d1e60da2/libavcodec/wmavoice.c/#L1682
d2a_code_trace_data_43120
static void mov_create_chapter_track(AVFormatContext *s, int tracknum) { MOVMuxContext *mov = s->priv_data; MOVTrack *track = &mov->tracks[tracknum]; AVPacket pkt = { .stream_index = tracknum, .flags = AV_PKT_FLAG_KEY }; int i, len; track->mode = mov->mode; track->tag = MKTAG('t','e','x','t'); track->timescale = MOV_TIMESCALE; track->enc = avcodec_alloc_context(); track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE; for (i = 0; i < s->nb_chapters; i++) { AVChapter *c = s->chapters[i]; AVMetadataTag *t; int64_t end = av_rescale_q(c->end, c->time_base, (AVRational){1,MOV_TIMESCALE}); pkt.pts = pkt.dts = av_rescale_q(c->start, c->time_base, (AVRational){1,MOV_TIMESCALE}); pkt.duration = end - pkt.dts; if ((t = av_metadata_get(c->metadata, "title", NULL, 0))) { len = strlen(t->value); pkt.size = len+2; pkt.data = av_malloc(pkt.size); AV_WB16(pkt.data, len); memcpy(pkt.data+2, t->value, len); ff_mov_write_packet(s, &pkt); av_freep(&pkt.data); } } } libavformat/movenc.c:2080: error: Null Dereference pointer `pkt.data` last assigned on line 2079 could be null and is dereferenced at line 2080, column 13. libavformat/movenc.c:2055:1: start of procedure mov_create_chapter_track() 2053. // QuickTime chapters involve an additional text track with the chapter names 2054. // as samples, and a tref pointing from the other tracks to the chapter one. 2055. static void mov_create_chapter_track(AVFormatContext *s, int tracknum) ^ 2056. { 2057. MOVMuxContext *mov = s->priv_data; libavformat/movenc.c:2057:5: 2055. static void mov_create_chapter_track(AVFormatContext *s, int tracknum) 2056. { 2057. MOVMuxContext *mov = s->priv_data; ^ 2058. MOVTrack *track = &mov->tracks[tracknum]; 2059. AVPacket pkt = { .stream_index = tracknum, .flags = AV_PKT_FLAG_KEY }; libavformat/movenc.c:2058:5: 2056. { 2057. MOVMuxContext *mov = s->priv_data; 2058. MOVTrack *track = &mov->tracks[tracknum]; ^ 2059. AVPacket pkt = { .stream_index = tracknum, .flags = AV_PKT_FLAG_KEY }; 2060. int i, len; libavformat/movenc.c:2059:5: 2057. MOVMuxContext *mov = s->priv_data; 2058. MOVTrack *track = &mov->tracks[tracknum]; 2059. AVPacket pkt = { .stream_index = tracknum, .flags = AV_PKT_FLAG_KEY }; ^ 2060. int i, len; 2061. libavformat/movenc.c:2062:5: 2060. int i, len; 2061. 2062. track->mode = mov->mode; ^ 2063. track->tag = MKTAG('t','e','x','t'); 2064. track->timescale = MOV_TIMESCALE; libavformat/movenc.c:2063:5: 2061. 2062. track->mode = mov->mode; 2063. track->tag = MKTAG('t','e','x','t'); ^ 2064. track->timescale = MOV_TIMESCALE; 2065. track->enc = avcodec_alloc_context(); libavformat/movenc.c:2064:5: 2062. track->mode = mov->mode; 2063. track->tag = MKTAG('t','e','x','t'); 2064. track->timescale = MOV_TIMESCALE; ^ 2065. track->enc = avcodec_alloc_context(); 2066. track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE; libavformat/movenc.c:2065:5: 2063. track->tag = MKTAG('t','e','x','t'); 2064. track->timescale = MOV_TIMESCALE; 2065. track->enc = avcodec_alloc_context(); ^ 2066. track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE; 2067. libavcodec/options.c:530:1: start of procedure avcodec_alloc_context() 528. } 529. 530. AVCodecContext *avcodec_alloc_context(void){ ^ 531. return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN); 532. } libavcodec/options.c:531:5: 529. 530. AVCodecContext *avcodec_alloc_context(void){ 531. return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN); ^ 532. } 533. libavcodec/options.c:516:1: start of procedure avcodec_alloc_context2() 514. } 515. 516. AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){ ^ 517. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); 518. libavcodec/options.c:517:5: 515. 516. AVCodecContext *avcodec_alloc_context2(enum AVMediaType codec_type){ 517. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); ^ 518. 519. if(avctx==NULL) return NULL; libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) ^ 73. return NULL; 74. libavutil/mem.c:83:9: Taking false branch 81. ((char*)ptr)[-1]= diff; 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,32,size)) ^ 84. ptr = NULL; 85. #elif HAVE_MEMALIGN libavutil/mem.c:114:5: 112. ptr = malloc(size); 113. #endif 114. return ptr; ^ 115. } 116. libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavcodec/options.c:519:8: Taking false branch 517. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); 518. 519. if(avctx==NULL) return NULL; ^ 520. 521. avcodec_get_context_defaults2(avctx, codec_type); libavcodec/options.c:521:5: Skipping avcodec_get_context_defaults2(): empty list of specs 519. if(avctx==NULL) return NULL; 520. 521. avcodec_get_context_defaults2(avctx, codec_type); ^ 522. 523. return avctx; libavcodec/options.c:523:5: 521. avcodec_get_context_defaults2(avctx, codec_type); 522. 523. return avctx; ^ 524. } 525. libavcodec/options.c:524:1: return from a call to avcodec_alloc_context2 522. 523. return avctx; 524. } ^ 525. 526. void avcodec_get_context_defaults(AVCodecContext *s){ libavcodec/options.c:532:1: return from a call to avcodec_alloc_context 530. AVCodecContext *avcodec_alloc_context(void){ 531. return avcodec_alloc_context2(AVMEDIA_TYPE_UNKNOWN); 532. } ^ 533. 534. int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src) libavformat/movenc.c:2066:5: 2064. track->timescale = MOV_TIMESCALE; 2065. track->enc = avcodec_alloc_context(); 2066. track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE; ^ 2067. 2068. for (i = 0; i < s->nb_chapters; i++) { libavformat/movenc.c:2068:10: 2066. track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE; 2067. 2068. for (i = 0; i < s->nb_chapters; i++) { ^ 2069. AVChapter *c = s->chapters[i]; 2070. AVMetadataTag *t; libavformat/movenc.c:2068:17: Loop condition is true. Entering loop body 2066. track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE; 2067. 2068. for (i = 0; i < s->nb_chapters; i++) { ^ 2069. AVChapter *c = s->chapters[i]; 2070. AVMetadataTag *t; libavformat/movenc.c:2069:9: 2067. 2068. for (i = 0; i < s->nb_chapters; i++) { 2069. AVChapter *c = s->chapters[i]; ^ 2070. AVMetadataTag *t; 2071. libavformat/movenc.c:2072:9: 2070. AVMetadataTag *t; 2071. 2072. int64_t end = av_rescale_q(c->end, c->time_base, (AVRational){1,MOV_TIMESCALE}); ^ 2073. pkt.pts = pkt.dts = av_rescale_q(c->start, c->time_base, (AVRational){1,MOV_TIMESCALE}); 2074. pkt.duration = end - pkt.dts; libavutil/mathematics.c:133:1: start of procedure av_rescale_q() 131. } 132. 133. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq){ ^ 134. int64_t b= bq.num * (int64_t)cq.den; 135. int64_t c= cq.num * (int64_t)bq.den; libavutil/mathematics.c:134:5: 132. 133. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq){ 134. int64_t b= bq.num * (int64_t)cq.den; ^ 135. int64_t c= cq.num * (int64_t)bq.den; 136. return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF); libavutil/mathematics.c:135:5: 133. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq){ 134. int64_t b= bq.num * (int64_t)cq.den; 135. int64_t c= cq.num * (int64_t)bq.den; ^ 136. return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF); 137. } libavutil/mathematics.c:136:5: Skipping av_rescale_rnd(): empty list of specs 134. int64_t b= bq.num * (int64_t)cq.den; 135. int64_t c= cq.num * (int64_t)bq.den; 136. return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF); ^ 137. } 138. libavutil/mathematics.c:137:1: return from a call to av_rescale_q 135. int64_t c= cq.num * (int64_t)bq.den; 136. return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF); 137. } ^ 138. 139. int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b){ libavformat/movenc.c:2073:9: 2071. 2072. int64_t end = av_rescale_q(c->end, c->time_base, (AVRational){1,MOV_TIMESCALE}); 2073. pkt.pts = pkt.dts = av_rescale_q(c->start, c->time_base, (AVRational){1,MOV_TIMESCALE}); ^ 2074. pkt.duration = end - pkt.dts; 2075. libavutil/mathematics.c:133:1: start of procedure av_rescale_q() 131. } 132. 133. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq){ ^ 134. int64_t b= bq.num * (int64_t)cq.den; 135. int64_t c= cq.num * (int64_t)bq.den; libavutil/mathematics.c:134:5: 132. 133. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq){ 134. int64_t b= bq.num * (int64_t)cq.den; ^ 135. int64_t c= cq.num * (int64_t)bq.den; 136. return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF); libavutil/mathematics.c:135:5: 133. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq){ 134. int64_t b= bq.num * (int64_t)cq.den; 135. int64_t c= cq.num * (int64_t)bq.den; ^ 136. return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF); 137. } libavutil/mathematics.c:136:5: Skipping av_rescale_rnd(): empty list of specs 134. int64_t b= bq.num * (int64_t)cq.den; 135. int64_t c= cq.num * (int64_t)bq.den; 136. return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF); ^ 137. } 138. libavutil/mathematics.c:137:1: return from a call to av_rescale_q 135. int64_t c= cq.num * (int64_t)bq.den; 136. return av_rescale_rnd(a, b, c, AV_ROUND_NEAR_INF); 137. } ^ 138. 139. int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b){ libavformat/movenc.c:2074:9: 2072. int64_t end = av_rescale_q(c->end, c->time_base, (AVRational){1,MOV_TIMESCALE}); 2073. pkt.pts = pkt.dts = av_rescale_q(c->start, c->time_base, (AVRational){1,MOV_TIMESCALE}); 2074. pkt.duration = end - pkt.dts; ^ 2075. 2076. if ((t = av_metadata_get(c->metadata, "title", NULL, 0))) { libavformat/movenc.c:2076:14: Taking true branch 2074. pkt.duration = end - pkt.dts; 2075. 2076. if ((t = av_metadata_get(c->metadata, "title", NULL, 0))) { ^ 2077. len = strlen(t->value); 2078. pkt.size = len+2; libavformat/movenc.c:2077:13: 2075. 2076. if ((t = av_metadata_get(c->metadata, "title", NULL, 0))) { 2077. len = strlen(t->value); ^ 2078. pkt.size = len+2; 2079. pkt.data = av_malloc(pkt.size); libavformat/movenc.c:2078:13: 2076. if ((t = av_metadata_get(c->metadata, "title", NULL, 0))) { 2077. len = strlen(t->value); 2078. pkt.size = len+2; ^ 2079. pkt.data = av_malloc(pkt.size); 2080. AV_WB16(pkt.data, len); libavformat/movenc.c:2079:13: 2077. len = strlen(t->value); 2078. pkt.size = len+2; 2079. pkt.data = av_malloc(pkt.size); ^ 2080. AV_WB16(pkt.data, len); 2081. memcpy(pkt.data+2, t->value, len); libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking true branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) ^ 73. return NULL; 74. libavutil/mem.c:73:9: 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) 73. return NULL; ^ 74. 75. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavformat/movenc.c:2080:13: 2078. pkt.size = len+2; 2079. pkt.data = av_malloc(pkt.size); 2080. AV_WB16(pkt.data, len); ^ 2081. memcpy(pkt.data+2, t->value, len); 2082. ff_mov_write_packet(s, &pkt); libavutil/bswap.h:58:1: start of procedure av_bswap16() 56. 57. #ifndef av_bswap16 58. static av_always_inline av_const uint16_t av_bswap16(uint16_t x) ^ 59. { 60. x= (x>>8) | (x<<8); libavutil/bswap.h:60:5: 58. static av_always_inline av_const uint16_t av_bswap16(uint16_t x) 59. { 60. x= (x>>8) | (x<<8); ^ 61. return x; 62. } libavutil/bswap.h:61:5: 59. { 60. x= (x>>8) | (x<<8); 61. return x; ^ 62. } 63. #endif libavutil/bswap.h:62:1: return from a call to av_bswap16 60. x= (x>>8) | (x<<8); 61. return x; 62. } ^ 63. #endif 64.
https://github.com/libav/libav/blob/304e983dc760176501b748ca99bcde23e7851013/libavformat/movenc.c/#L2080
d2a_code_trace_data_43121
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dsa/dsa_gen.c:499: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_div`. Showing all 15 steps of the trace crypto/dsa/dsa_gen.c:372:5: Call 370. goto err; 371. 372. BN_CTX_start(ctx); ^ 373. r0 = BN_CTX_get(ctx); 374. g = 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/dsa/dsa_gen.c:499:18: Call 497. if (!BN_lshift1(r0, q)) 498. goto err; 499. if (!BN_mod(c, X, r0, ctx)) ^ 500. goto err; 501. if (!BN_sub(r0, c, BN_value_one())) 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_div` 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_43122
void *lh_delete(LHASH *lh, const void *data) { unsigned long hash; LHASH_NODE *nn,**rn; const void *ret; lh->error=0; rn=getrn(lh,data,&hash); if (*rn == NULL) { lh->num_no_delete++; return(NULL); } else { nn= *rn; *rn=nn->next; ret=nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes))) contract(lh); return((void *)ret); } ssl/s3_clnt.c:1171: error: INTEGER_OVERFLOW_L2 ([0, `s->ctx->sessions->num_items`] - 1):unsigned64 by call to `ssl3_send_alert`. Showing all 13 steps of the trace ssl/s3_clnt.c:870:1: Parameter `s->ctx->sessions->num_items` 868. } 869. 870. > static int ssl3_get_key_exchange(SSL *s) 871. { 872. #ifndef OPENSSL_NO_RSA ssl/s3_clnt.c:889:4: Call 887. /* use same message size as in ssl3_get_certificate_request() 888. * as ServerKeyExchange message may be skipped */ 889. n=ssl3_get_message(s, ^ 890. SSL3_ST_CR_KEY_EXCH_A, 891. SSL3_ST_CR_KEY_EXCH_B, ssl/s3_both.c:337:1: Parameter `s->ctx->sessions->num_items` 335. * the body is read in state 'stn'. 336. */ 337. > long ssl3_get_message(SSL *s, int st1, int stn, int mt, long max, int *ok) 338. { 339. unsigned char *p; ssl/s3_clnt.c:1171:2: Call 1169. return(1); 1170. f_err: 1171. ssl3_send_alert(s,SSL3_AL_FATAL,al); ^ 1172. err: 1173. EVP_PKEY_free(pkey); ssl/s3_pkt.c:1155:1: Parameter `s->ctx->sessions->num_items` 1153. } 1154. 1155. > void ssl3_send_alert(SSL *s, int level, int desc) 1156. { 1157. /* Map tls/ssl alert value to correct one */ ssl/s3_pkt.c:1162:3: Call 1160. /* If a fatal one, remove from cache */ 1161. if ((level == 2) && (s->session != NULL)) 1162. SSL_CTX_remove_session(s->ctx,s->session); ^ 1163. 1164. s->s3->alert_dispatch=1; ssl/ssl_sess.c:468:1: Parameter `ctx->sessions->num_items` 466. } 467. 468. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 469. { 470. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:470:9: Call 468. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 469. { 470. return remove_session_lock(ctx, c, 1); ^ 471. } 472. ssl/ssl_sess.c:473:1: Parameter `ctx->sessions->num_items` 471. } 472. 473. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 474. { 475. SSL_SESSION *r; ssl/ssl_sess.c:481:20: Call 479. { 480. if(lck) CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX); 481. r=(SSL_SESSION *)lh_delete(ctx->sessions,c); ^ 482. if (r != NULL) 483. { crypto/lhash/lhash.c:217:1: <LHS trace> 215. } 216. 217. > void *lh_delete(LHASH *lh, const void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:217:1: Parameter `lh->num_items` 215. } 216. 217. > void *lh_delete(LHASH *lh, const void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:240:2: Binary operation: ([0, s->ctx->sessions->num_items] - 1):unsigned64 by call to `ssl3_send_alert` 238. } 239. 240. lh->num_items--; ^ 241. if ((lh->num_nodes > MIN_NODES) && 242. (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes)))
https://github.com/openssl/openssl/blob/9e09eebf94c933686077a1b1b2d60248acb9ba67/crypto/lhash/lhash.c/#L240
d2a_code_trace_data_43123
static void sbr_make_f_tablelim(SpectralBandReplication *sbr) { int k; if (sbr->bs_limiter_bands > 0) { static const float bands_warped[3] = { 1.32715174233856803909f, 1.18509277094158210129f, 1.11987160404675912501f }; const float lim_bands_per_octave_warped = bands_warped[sbr->bs_limiter_bands - 1]; int16_t patch_borders[7]; uint16_t *in = sbr->f_tablelim + 1, *out = sbr->f_tablelim; patch_borders[0] = sbr->kx[1]; for (k = 1; k <= sbr->num_patches; k++) patch_borders[k] = patch_borders[k-1] + sbr->patch_num_subbands[k-1]; memcpy(sbr->f_tablelim, sbr->f_tablelow, (sbr->n[0] + 1) * sizeof(sbr->f_tablelow[0])); if (sbr->num_patches > 1) memcpy(sbr->f_tablelim + sbr->n[0] + 1, patch_borders + 1, (sbr->num_patches - 1) * sizeof(patch_borders[0])); qsort(sbr->f_tablelim, sbr->num_patches + sbr->n[0], sizeof(sbr->f_tablelim[0]), qsort_comparison_function_int16); sbr->n_lim = sbr->n[0] + sbr->num_patches - 1; while (out < sbr->f_tablelim + sbr->n_lim) { if (*in >= *out * lim_bands_per_octave_warped) { *++out = *in++; } else if (*in == *out || !in_table_int16(patch_borders, sbr->num_patches, *in)) { in++; sbr->n_lim--; } else if (!in_table_int16(patch_borders, sbr->num_patches, *out)) { *out = *in++; sbr->n_lim--; } else { *++out = *in++; } } } else { sbr->f_tablelim[0] = sbr->f_tablelow[0]; sbr->f_tablelim[1] = sbr->f_tablelow[sbr->n[0]]; sbr->n_lim = 1; } } libavcodec/aacdec.c:2139: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `decode_extension_payload`. libavcodec/aacdec.c:2072:13: Call 2070. 2071. if (show_bits(gb, 12) == 0xfff) { 2072. if (parse_adts_frame_header(ac, gb) < 0) { ^ 2073. av_log(avctx, AV_LOG_ERROR, "Error decoding AAC frame header.\n"); 2074. return -1; libavcodec/aacdec.c:2024:1: Parameter `ac->avctx->sample_rate` 2022. } 2023. 2024. static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb) ^ 2025. { 2026. int size; libavcodec/aacdec.c:2139:28: Call 2137. } 2138. while (elem_id > 0) 2139. elem_id -= decode_extension_payload(ac, gb, elem_id, che_prev, elem_type_prev); ^ 2140. err = 0; /* FIXME */ 2141. break; libavcodec/aacdec.c:1629:1: Parameter `che->sbr.n[*]` 1627. * @return Returns number of bytes consumed 1628. */ 1629. static int decode_extension_payload(AACContext *ac, GetBitContext *gb, int cnt, ^ 1630. ChannelElement *che, enum RawDataBlockType elem_type) 1631. { libavcodec/aacdec.c:1656:15: Call 1654. ac->m4ac.sbr = 1; 1655. } 1656. res = ff_decode_sbr_extension(ac, &che->sbr, gb, crc_flag, cnt, elem_type); ^ 1657. break; 1658. case EXT_DYNAMIC_RANGE: libavcodec/aacsbr.c:1044:1: Parameter `sbr->n[*]` 1042. * @return Returns number of bytes consumed from the TYPE_FIL element. 1043. */ 1044. int ff_decode_sbr_extension(AACContext *ac, SpectralBandReplication *sbr, ^ 1045. GetBitContext *gb_host, int crc, int cnt, int id_aac) 1046. { libavcodec/aacsbr.c:1070:25: Call 1068. num_sbr_bits++; 1069. if (get_bits1(gb)) // bs_header_flag 1070. num_sbr_bits += read_sbr_header(sbr, gb); ^ 1071. 1072. if (sbr->reset) libavcodec/aacsbr.c:207:1: Parameter `sbr->n[*]` 205. } 206. 207. static unsigned int read_sbr_header(SpectralBandReplication *sbr, GetBitContext *gb) ^ 208. { 209. unsigned int cnt = get_bits_count(gb); libavcodec/aacsbr.c:256:9: Call 254. 255. if (sbr->bs_limiter_bands != old_bs_limiter_bands && !sbr->reset) 256. sbr_make_f_tablelim(sbr); ^ 257. 258. return get_bits_count(gb) - cnt; libavcodec/aacsbr.c:160:1: <LHS trace> 158. 159. /// Limiter Frequency Band Table (14496-3 sp04 p198) 160. static void sbr_make_f_tablelim(SpectralBandReplication *sbr) ^ 161. { 162. int k; libavcodec/aacsbr.c:160:1: Parameter `sbr->n[*]` 158. 159. /// Limiter Frequency Band Table (14496-3 sp04 p198) 160. static void sbr_make_f_tablelim(SpectralBandReplication *sbr) ^ 161. { 162. int k; libavcodec/aacsbr.c:185:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `decode_extension_payload` 183. qsort_comparison_function_int16); 184. 185. sbr->n_lim = sbr->n[0] + sbr->num_patches - 1; ^ 186. while (out < sbr->f_tablelim + sbr->n_lim) { 187. if (*in >= *out * lim_bands_per_octave_warped) {
https://github.com/libav/libav/blob/1c69c79f2b11627cb50f1bc571de97ad8cbfefb7/libavcodec/aacsbr.c/#L185
d2a_code_trace_data_43124
static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, long max) { const unsigned char *p = *pp; unsigned long ret = 0; int i; if (max-- < 1) return 0; if (*p == 0x80) { *inf = 1; p++; } else { *inf = 0; i = *p & 0x7f; if (*p++ & 0x80) { if (max < i + 1) return 0; while (i > 0 && *p == 0) { p++; i--; } if (i > (int)sizeof(long)) return 0; while (i > 0) { ret <<= 8; ret |= *p++; i--; } if (ret > LONG_MAX) return 0; } else ret = i; } *pp = p; *rl = (long)ret; return 1; } crypto/pkcs12/p12_decr.c:110: error: BUFFER_OVERRUN_L3 Offset: [2, +oo] Size: [1, +oo] by call to `ASN1_item_d2i`. Showing all 23 steps of the trace crypto/pkcs12/p12_decr.c:91:10: Call 89. int outlen; 90. 91. if (!PKCS12_pbe_crypt(algor, pass, passlen, oct->data, oct->length, ^ 92. &out, &outlen, 0)) { 93. PKCS12err(PKCS12_F_PKCS12_ITEM_DECRYPT_D2I, crypto/pkcs12/p12_decr.c:23:1: Parameter `**data` 21. * OPENSSL_malloc'ed buffer 22. */ 23. > unsigned char *PKCS12_pbe_crypt(const X509_ALGOR *algor, 24. const char *pass, int passlen, 25. const unsigned char *in, int inlen, crypto/pkcs12/p12_decr.c:97:5: Assignment 95. return NULL; 96. } 97. p = out; ^ 98. #ifdef OPENSSL_DEBUG_DECRYPT 99. { crypto/pkcs12/p12_decr.c:110:11: Call 108. } 109. #endif 110. ret = ASN1_item_d2i(NULL, &p, outlen, it); ^ 111. if (zbuf) 112. OPENSSL_cleanse(out, outlen); crypto/asn1/tasn_dec.c:95:1: Parameter `**in` 93. */ 94. 95. > ASN1_VALUE *ASN1_item_d2i(ASN1_VALUE **pval, 96. const unsigned char **in, long len, 97. const ASN1_ITEM *it) crypto/asn1/tasn_dec.c:104:9: Call 102. pval = &ptmpval; 103. asn1_tlc_clear_nc(&c); 104. if (ASN1_item_ex_d2i(pval, in, len, it, -1, 0, 0, &c) > 0) ^ 105. return *pval; 106. return NULL; crypto/asn1/tasn_dec.c:109:1: Parameter `**in` 107. } 108. 109. > int ASN1_item_ex_d2i(ASN1_VALUE **pval, const unsigned char **in, long len, 110. const ASN1_ITEM *it, 111. int tag, int aclass, char opt, ASN1_TLC *ctx) crypto/asn1/tasn_dec.c:114:10: Call 112. { 113. int rv; 114. rv = asn1_item_embed_d2i(pval, in, len, it, tag, aclass, opt, ctx); ^ 115. if (rv <= 0) 116. ASN1_item_ex_free(pval, it); crypto/asn1/tasn_dec.c:125:1: Parameter `**in` 123. */ 124. 125. > static int asn1_item_embed_d2i(ASN1_VALUE **pval, const unsigned char **in, 126. long len, const ASN1_ITEM *it, 127. int tag, int aclass, char opt, ASN1_TLC *ctx) crypto/asn1/tasn_dec.c:169:9: Assignment 167. 168. case ASN1_ITYPE_MSTRING: 169. p = *in; ^ 170. /* Just read in tag and class */ 171. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, crypto/asn1/tasn_dec.c:171:15: Call 169. p = *in; 170. /* Just read in tag and class */ 171. ret = asn1_check_tlen(NULL, &otag, &oclass, NULL, NULL, ^ 172. &p, len, -1, 0, 1, ctx); 173. if (!ret) { crypto/asn1/tasn_dec.c:1060:1: Parameter `**in` 1058. */ 1059. 1060. > static int asn1_check_tlen(long *olen, int *otag, unsigned char *oclass, 1061. char *inf, char *cst, 1062. const unsigned char **in, long len, crypto/asn1/tasn_dec.c:1069:5: Assignment 1067. long plen; 1068. const unsigned char *p, *q; 1069. p = *in; ^ 1070. q = p; 1071. crypto/asn1/tasn_dec.c:1079:13: Call 1077. p += ctx->hdrlen; 1078. } else { 1079. i = ASN1_get_object(&p, &plen, &ptag, &pclass, len); ^ 1080. if (ctx) { 1081. ctx->ret = i; crypto/asn1/asn1_lib.c:44:1: Parameter `**pp` 42. } 43. 44. > int ASN1_get_object(const unsigned char **pp, long *plength, int *ptag, 45. int *pclass, long omax) 46. { crypto/asn1/asn1_lib.c:49:5: Assignment 47. int i, ret; 48. long l; 49. const unsigned char *p = *pp; ^ 50. int tag, xclass, inf; 51. long max = omax; crypto/asn1/asn1_lib.c:78:9: Assignment 76. } else { 77. tag = i; 78. p++; ^ 79. if (--max == 0) 80. goto err; crypto/asn1/asn1_lib.c:84:10: Call 82. *ptag = tag; 83. *pclass = xclass; 84. if (!asn1_get_length(&p, &inf, plength, max)) ^ 85. goto err; 86. crypto/asn1/asn1_lib.c:112:1: <Length trace> 110. * are stored most significant digit first. 111. */ 112. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, 113. long max) 114. { crypto/asn1/asn1_lib.c:112:1: Parameter `**pp` 110. * are stored most significant digit first. 111. */ 112. > static int asn1_get_length(const unsigned char **pp, int *inf, long *rl, 113. long max) 114. { crypto/asn1/asn1_lib.c:115:5: Assignment 113. long max) 114. { 115. const unsigned char *p = *pp; ^ 116. unsigned long ret = 0; 117. int i; crypto/asn1/asn1_lib.c:127:14: Assignment 125. *inf = 0; 126. i = *p & 0x7f; 127. if (*p++ & 0x80) { ^ 128. if (max < i + 1) 129. return 0; crypto/asn1/asn1_lib.c:131:29: Array access: Offset: [2, +oo] Size: [1, +oo] by call to `ASN1_item_d2i` 129. return 0; 130. /* Skip leading zeroes */ 131. while (i > 0 && *p == 0) { ^ 132. p++; 133. i--;
https://github.com/openssl/openssl/blob/c784a838e0947fcca761ee62def7d077dc06d37f/crypto/asn1/asn1_lib.c/#L131
d2a_code_trace_data_43125
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:830: error: INTEGER_OVERFLOW_L2 (0 - [-oo, 32]):unsigned64 by call to `EVP_DecryptUpdate`. Showing all 7 steps of the trace crypto/pem/pvkfmt.c:830:14: Call 828. goto error; 829. OPENSSL_cleanse(keybuf, 20); 830. if (!EVP_DecryptUpdate(cctx, p, &enctmplen, p, pklen - 8)) ^ 831. goto error; 832. if (!EVP_DecryptFinal_ex(cctx, p + 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_43126
int dsa_paramgen_check_g(DSA *dsa) { BN_CTX *ctx; BIGNUM *tmp; BN_MONT_CTX *mont = NULL; int rv = -1; ctx = BN_CTX_new(); if (ctx == NULL) return -1; BN_CTX_start(ctx); if (BN_cmp(dsa->g, BN_value_one()) <= 0) return 0; if (BN_cmp(dsa->g, dsa->p) >= 0) return 0; tmp = BN_CTX_get(ctx); if (!tmp) goto err; if ((mont = BN_MONT_CTX_new()) == NULL) goto err; if (!BN_MONT_CTX_set(mont, dsa->p, ctx)) goto err; if (!BN_mod_exp_mont(tmp, dsa->g, dsa->q, dsa->p, ctx, mont)) goto err; if (!BN_cmp(tmp, BN_value_one())) rv = 1; else rv = 0; err: BN_CTX_end(ctx); BN_MONT_CTX_free(mont); BN_CTX_free(ctx); return rv; } crypto/dsa/dsa_gen.c:666: error: MEMORY_LEAK memory dynamically allocated by call to `BN_CTX_start()` at line 656, column 5 is not reachable after line 666, column 10. Showing all 122 steps of the trace crypto/dsa/dsa_gen.c:647:1: start of procedure dsa_paramgen_check_g() 645. } 646. 647. > int dsa_paramgen_check_g(DSA *dsa) 648. { 649. BN_CTX *ctx; crypto/dsa/dsa_gen.c:651:5: 649. BN_CTX *ctx; 650. BIGNUM *tmp; 651. > BN_MONT_CTX *mont = NULL; 652. int rv = -1; 653. ctx = BN_CTX_new(); crypto/dsa/dsa_gen.c:652:5: 650. BIGNUM *tmp; 651. BN_MONT_CTX *mont = NULL; 652. > int rv = -1; 653. ctx = BN_CTX_new(); 654. if (ctx == NULL) crypto/dsa/dsa_gen.c:653:5: 651. BN_MONT_CTX *mont = NULL; 652. int rv = -1; 653. > ctx = BN_CTX_new(); 654. if (ctx == NULL) 655. return -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) crypto/dsa/dsa_gen.c:654:9: Taking false branch 652. int rv = -1; 653. ctx = BN_CTX_new(); 654. if (ctx == NULL) ^ 655. return -1; 656. BN_CTX_start(ctx); crypto/dsa/dsa_gen.c:656:5: 654. if (ctx == NULL) 655. return -1; 656. > BN_CTX_start(ctx); 657. if (BN_cmp(dsa->g, BN_value_one()) <= 0) 658. return 0; crypto/bn/bn_ctx.c:236:1: start of procedure BN_CTX_start() 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_ctx.c:240:9: Taking false branch 238. CTXDBG_ENTRY("BN_CTX_start", ctx); 239. /* If we're already overflowing ... */ 240. if (ctx->err_stack || ctx->too_many) ^ 241. ctx->err_stack++; 242. /* (Try to) get a new frame pointer */ crypto/bn/bn_ctx.c:240:27: Taking false branch 238. CTXDBG_ENTRY("BN_CTX_start", ctx); 239. /* If we're already overflowing ... */ 240. if (ctx->err_stack || ctx->too_many) ^ 241. ctx->err_stack++; 242. /* (Try to) get a new frame pointer */ crypto/bn/bn_ctx.c:243:15: 241. ctx->err_stack++; 242. /* (Try to) get a new frame pointer */ 243. > else if (!BN_STACK_push(&ctx->stack, ctx->used)) { 244. BNerr(BN_F_BN_CTX_START, BN_R_TOO_MANY_TEMPORARY_VARIABLES); 245. ctx->err_stack++; crypto/bn/bn_ctx.c:307:1: start of procedure BN_STACK_push() 305. 306. 307. > static int BN_STACK_push(BN_STACK *st, unsigned int idx) 308. { 309. if (st->depth == st->size) { crypto/bn/bn_ctx.c:309:9: Taking true branch 307. static int BN_STACK_push(BN_STACK *st, unsigned int idx) 308. { 309. if (st->depth == st->size) { ^ 310. /* Need to expand */ 311. unsigned int newsize = crypto/bn/bn_ctx.c:312:13: Condition is false 310. /* Need to expand */ 311. unsigned int newsize = 312. st->size ? (st->size * 3 / 2) : BN_CTX_START_FRAMES; ^ 313. unsigned int *newitems = OPENSSL_malloc(sizeof(*newitems) * newsize); 314. if (newitems == NULL) crypto/bn/bn_ctx.c:311:9: 309. if (st->depth == st->size) { 310. /* Need to expand */ 311. > unsigned int newsize = 312. st->size ? (st->size * 3 / 2) : BN_CTX_START_FRAMES; 313. unsigned int *newitems = OPENSSL_malloc(sizeof(*newitems) * newsize); crypto/bn/bn_ctx.c:313:9: 311. unsigned int newsize = 312. st->size ? (st->size * 3 / 2) : BN_CTX_START_FRAMES; 313. > unsigned int *newitems = OPENSSL_malloc(sizeof(*newitems) * newsize); 314. if (newitems == NULL) 315. return 0; crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/bn/bn_ctx.c:314:13: Taking false branch 312. st->size ? (st->size * 3 / 2) : BN_CTX_START_FRAMES; 313. unsigned int *newitems = OPENSSL_malloc(sizeof(*newitems) * newsize); 314. if (newitems == NULL) ^ 315. return 0; 316. if (st->depth) crypto/bn/bn_ctx.c:316:13: Taking false branch 314. if (newitems == NULL) 315. return 0; 316. if (st->depth) ^ 317. memcpy(newitems, st->indexes, sizeof(*newitems) * st->depth); 318. OPENSSL_free(st->indexes); crypto/bn/bn_ctx.c:318:9: 316. if (st->depth) 317. memcpy(newitems, st->indexes, sizeof(*newitems) * st->depth); 318. > OPENSSL_free(st->indexes); 319. st->indexes = newitems; 320. st->size = newsize; crypto/mem.c:234:1: start of procedure CRYPTO_free() 232. } 233. 234. > void CRYPTO_free(void *str) 235. { 236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:245:5: 243. } 244. #else 245. > free(str); 246. #endif 247. } crypto/mem.c:247:1: return from a call to CRYPTO_free 245. free(str); 246. #endif 247. > } 248. 249. void CRYPTO_clear_free(void *str, size_t num) crypto/bn/bn_ctx.c:319:9: 317. memcpy(newitems, st->indexes, sizeof(*newitems) * st->depth); 318. OPENSSL_free(st->indexes); 319. > st->indexes = newitems; 320. st->size = newsize; 321. } crypto/bn/bn_ctx.c:320:9: 318. OPENSSL_free(st->indexes); 319. st->indexes = newitems; 320. > st->size = newsize; 321. } 322. st->indexes[(st->depth)++] = idx; crypto/bn/bn_ctx.c:322:5: 320. st->size = newsize; 321. } 322. > st->indexes[(st->depth)++] = idx; 323. return 1; 324. } crypto/bn/bn_ctx.c:323:5: 321. } 322. st->indexes[(st->depth)++] = idx; 323. > return 1; 324. } 325. crypto/bn/bn_ctx.c:324:1: return from a call to BN_STACK_push 322. st->indexes[(st->depth)++] = idx; 323. return 1; 324. > } 325. 326. static unsigned int BN_STACK_pop(BN_STACK *st) crypto/bn/bn_ctx.c:243:15: Taking false branch 241. ctx->err_stack++; 242. /* (Try to) get a new frame pointer */ 243. else if (!BN_STACK_push(&ctx->stack, ctx->used)) { ^ 244. BNerr(BN_F_BN_CTX_START, BN_R_TOO_MANY_TEMPORARY_VARIABLES); 245. ctx->err_stack++; crypto/bn/bn_ctx.c:240:5: 238. CTXDBG_ENTRY("BN_CTX_start", ctx); 239. /* If we're already overflowing ... */ 240. > if (ctx->err_stack || ctx->too_many) 241. ctx->err_stack++; 242. /* (Try to) get a new frame pointer */ crypto/bn/bn_ctx.c:248:1: return from a call to BN_CTX_start 246. } 247. CTXDBG_EXIT(ctx); 248. > } 249. 250. void BN_CTX_end(BN_CTX *ctx) crypto/dsa/dsa_gen.c:657:9: 655. return -1; 656. BN_CTX_start(ctx); 657. > if (BN_cmp(dsa->g, BN_value_one()) <= 0) 658. return 0; 659. if (BN_cmp(dsa->g, dsa->p) >= 0) crypto/bn/bn_lib.c:134:1: start of procedure BN_value_one() 132. #endif 133. 134. > const BIGNUM *BN_value_one(void) 135. { 136. static const BN_ULONG data_one = 1L; crypto/bn/bn_lib.c:136:5: 134. const BIGNUM *BN_value_one(void) 135. { 136. > static const BN_ULONG data_one = 1L; 137. static const BIGNUM const_one = 138. { (BN_ULONG *)&data_one, 1, 1, 0, BN_FLG_STATIC_DATA }; crypto/bn/bn_lib.c:137:5: 135. { 136. static const BN_ULONG data_one = 1L; 137. > static const BIGNUM const_one = 138. { (BN_ULONG *)&data_one, 1, 1, 0, BN_FLG_STATIC_DATA }; 139. crypto/bn/bn_lib.c:140:5: 138. { (BN_ULONG *)&data_one, 1, 1, 0, BN_FLG_STATIC_DATA }; 139. 140. > return (&const_one); 141. } 142. crypto/bn/bn_lib.c:141:1: return from a call to BN_value_one 139. 140. return (&const_one); 141. > } 142. 143. int BN_num_bits_word(BN_ULONG l) crypto/dsa/dsa_gen.c:657:9: Taking false branch 655. return -1; 656. BN_CTX_start(ctx); 657. if (BN_cmp(dsa->g, BN_value_one()) <= 0) ^ 658. return 0; 659. if (BN_cmp(dsa->g, dsa->p) >= 0) crypto/dsa/dsa_gen.c:659:9: Taking false branch 657. if (BN_cmp(dsa->g, BN_value_one()) <= 0) 658. return 0; 659. if (BN_cmp(dsa->g, dsa->p) >= 0) ^ 660. return 0; 661. tmp = BN_CTX_get(ctx); crypto/dsa/dsa_gen.c:661:5: 659. if (BN_cmp(dsa->g, dsa->p) >= 0) 660. return 0; 661. > tmp = BN_CTX_get(ctx); 662. if (!tmp) 663. goto err; crypto/bn/bn_ctx.c:267:1: start of procedure BN_CTX_get() 265. } 266. 267. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 268. { 269. BIGNUM *ret; crypto/bn/bn_ctx.c:272:9: Taking false branch 270. 271. CTXDBG_ENTRY("BN_CTX_get", ctx); 272. if (ctx->err_stack || ctx->too_many) ^ 273. return NULL; 274. if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) { crypto/bn/bn_ctx.c:272:27: Taking false branch 270. 271. CTXDBG_ENTRY("BN_CTX_get", ctx); 272. if (ctx->err_stack || ctx->too_many) ^ 273. return NULL; 274. if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) { crypto/bn/bn_ctx.c:274:9: Taking false branch 272. if (ctx->err_stack || ctx->too_many) 273. return NULL; 274. if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) { ^ 275. /* 276. * Setting too_many prevents repeated "get" attempts from cluttering crypto/bn/bn_ctx.c:284:5: 282. } 283. /* OK, make sure the returned bignum is "zero" */ 284. > BN_zero(ret); 285. ctx->used++; 286. CTXDBG_RET(ctx, ret); crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is false 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) crypto/bn/bn_ctx.c:285:5: 283. /* OK, make sure the returned bignum is "zero" */ 284. BN_zero(ret); 285. > ctx->used++; 286. CTXDBG_RET(ctx, ret); 287. return ret; crypto/bn/bn_ctx.c:287:5: 285. ctx->used++; 286. CTXDBG_RET(ctx, ret); 287. > return ret; 288. } 289. crypto/bn/bn_ctx.c:288:1: return from a call to BN_CTX_get 286. CTXDBG_RET(ctx, ret); 287. return ret; 288. > } 289. 290. /************/ crypto/dsa/dsa_gen.c:662:10: Taking false branch 660. return 0; 661. tmp = BN_CTX_get(ctx); 662. if (!tmp) ^ 663. goto err; 664. if ((mont = BN_MONT_CTX_new()) == NULL) crypto/dsa/dsa_gen.c:664:9: 662. if (!tmp) 663. goto err; 664. > if ((mont = BN_MONT_CTX_new()) == NULL) 665. goto err; 666. if (!BN_MONT_CTX_set(mont, dsa->p, ctx)) crypto/bn/bn_mont.c:315:1: start of procedure BN_MONT_CTX_new() 313. } 314. 315. > BN_MONT_CTX *BN_MONT_CTX_new(void) 316. { 317. BN_MONT_CTX *ret; crypto/bn/bn_mont.c:319:9: 317. BN_MONT_CTX *ret; 318. 319. > if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) 320. return (NULL); 321. crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/bn/bn_mont.c:319:9: Taking false branch 317. BN_MONT_CTX *ret; 318. 319. if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL) ^ 320. return (NULL); 321. crypto/bn/bn_mont.c:322:5: 320. return (NULL); 321. 322. > BN_MONT_CTX_init(ret); 323. ret->flags = BN_FLG_MALLOCED; 324. return (ret); crypto/bn/bn_mont.c:327:1: start of procedure BN_MONT_CTX_init() 325. } 326. 327. > void BN_MONT_CTX_init(BN_MONT_CTX *ctx) 328. { 329. ctx->ri = 0; crypto/bn/bn_mont.c:329:5: 327. void BN_MONT_CTX_init(BN_MONT_CTX *ctx) 328. { 329. > ctx->ri = 0; 330. bn_init(&(ctx->RR)); 331. bn_init(&(ctx->N)); crypto/bn/bn_mont.c:330:5: Skipping bn_init(): empty list of specs 328. { 329. ctx->ri = 0; 330. bn_init(&(ctx->RR)); ^ 331. bn_init(&(ctx->N)); 332. bn_init(&(ctx->Ni)); crypto/bn/bn_mont.c:331:5: Skipping bn_init(): empty list of specs 329. ctx->ri = 0; 330. bn_init(&(ctx->RR)); 331. bn_init(&(ctx->N)); ^ 332. bn_init(&(ctx->Ni)); 333. ctx->n0[0] = ctx->n0[1] = 0; crypto/bn/bn_mont.c:332:5: Skipping bn_init(): empty list of specs 330. bn_init(&(ctx->RR)); 331. bn_init(&(ctx->N)); 332. bn_init(&(ctx->Ni)); ^ 333. ctx->n0[0] = ctx->n0[1] = 0; 334. ctx->flags = 0; crypto/bn/bn_mont.c:333:5: 331. bn_init(&(ctx->N)); 332. bn_init(&(ctx->Ni)); 333. > ctx->n0[0] = ctx->n0[1] = 0; 334. ctx->flags = 0; 335. } crypto/bn/bn_mont.c:334:5: 332. bn_init(&(ctx->Ni)); 333. ctx->n0[0] = ctx->n0[1] = 0; 334. > ctx->flags = 0; 335. } 336. crypto/bn/bn_mont.c:335:1: return from a call to BN_MONT_CTX_init 333. ctx->n0[0] = ctx->n0[1] = 0; 334. ctx->flags = 0; 335. > } 336. 337. void BN_MONT_CTX_free(BN_MONT_CTX *mont) crypto/bn/bn_mont.c:323:5: 321. 322. BN_MONT_CTX_init(ret); 323. > ret->flags = BN_FLG_MALLOCED; 324. return (ret); 325. } crypto/bn/bn_mont.c:324:5: 322. BN_MONT_CTX_init(ret); 323. ret->flags = BN_FLG_MALLOCED; 324. > return (ret); 325. } 326. crypto/bn/bn_mont.c:325:1: return from a call to BN_MONT_CTX_new 323. ret->flags = BN_FLG_MALLOCED; 324. return (ret); 325. > } 326. 327. void BN_MONT_CTX_init(BN_MONT_CTX *ctx) crypto/dsa/dsa_gen.c:664:9: Taking false branch 662. if (!tmp) 663. goto err; 664. if ((mont = BN_MONT_CTX_new()) == NULL) ^ 665. goto err; 666. if (!BN_MONT_CTX_set(mont, dsa->p, ctx)) crypto/dsa/dsa_gen.c:666:10: Skipping BN_MONT_CTX_set(): empty list of specs 664. if ((mont = BN_MONT_CTX_new()) == NULL) 665. goto err; 666. if (!BN_MONT_CTX_set(mont, dsa->p, ctx)) ^ 667. goto err; 668. /* Work out g^q mod p */
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/dsa/dsa_gen.c/#L666
d2a_code_trace_data_43127
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/tak.c:98: error: Integer Overflow L2 ([0, +oo] - [0, 35]):unsigned32 by call to `bitstream_read_63`. libavcodec/tak.c:97:18: Call 95. bitstream_skip(bc, TAK_ENCODER_PROFILE_BITS); 96. 97. frame_type = bitstream_read(bc, TAK_SIZE_FRAME_DURATION_BITS); ^ 98. s->samples = bitstream_read_63(bc, TAK_SIZE_SAMPLES_NUM_BITS); 99. libavcodec/bitstream.h:183:1: Parameter `bc->bits_left` 181. 182. /* Return n bits from the buffer. n has to be in the 0-32 range. */ 183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n) ^ 184. { 185. if (!n) libavcodec/tak.c:98:18: Call 96. 97. frame_type = bitstream_read(bc, TAK_SIZE_FRAME_DURATION_BITS); 98. s->samples = bitstream_read_63(bc, TAK_SIZE_SAMPLES_NUM_BITS); ^ 99. 100. s->data_type = bitstream_read(bc, TAK_FORMAT_DATA_TYPE_BITS); libavcodec/bitstream.h:154:1: Parameter `n` 152. 153. /* Return n bits from the buffer. n has to be in the 0-63 range. */ 154. static inline uint64_t bitstream_read_63(BitstreamContext *bc, unsigned n) ^ 155. { 156. uint64_t ret = 0; libavcodec/bitstream.h:174:11: Call 172. 173. #ifdef BITSTREAM_READER_LE 174. ret = get_val(bc, n) << left | ret; ^ 175. #else 176. ret = get_val(bc, n) | ret << n; libavcodec/bitstream.h:130:1: <LHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `bc->bits_left` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: <RHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Binary operation: ([0, +oo] - [0, 35]):unsigned32 by call to `bitstream_read_63` 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_43128
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); } apps/s_client.c:284: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_is_prime_ex`. Showing all 53 steps of the trace apps/s_client.c:282:22: Call 280. g != NULL && N != NULL && bn_ctx != NULL && BN_is_odd(N) && 281. BN_is_prime_ex(N, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 && 282. p != NULL && BN_rshift1(p, N) && ^ 283. /* p = (N-1)/2 */ 284. BN_is_prime_ex(p, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 && crypto/bn/bn_shift.c:60:14: Assignment 58. i = a->top; 59. ap = a->d; 60. j = i - (ap[i - 1] == 1); ^ 61. if (a != r) { 62. if (bn_wexpand(r, j) == NULL) crypto/bn/bn_shift.c:60:5: Assignment 58. i = a->top; 59. ap = a->d; 60. j = i - (ap[i - 1] == 1); ^ 61. if (a != r) { 62. if (bn_wexpand(r, j) == NULL) crypto/bn/bn_shift.c:76:5: Assignment 74. c = (t & 1) ? BN_TBIT : 0; 75. } 76. r->top = j; ^ 77. if (!r->top) 78. r->neg = 0; /* don't allow negative zero */ apps/s_client.c:284:9: Call 282. p != NULL && BN_rshift1(p, N) && 283. /* p = (N-1)/2 */ 284. BN_is_prime_ex(p, SRP_NUMBER_ITERATIONS_FOR_PRIME, bn_ctx, NULL) == 1 && ^ 285. r != NULL && 286. /* verify g^((N-1)/2) == -1 (mod N) */ crypto/bn/bn_prime.c:145:1: Parameter `a->top` 143. } 144. 145. > int BN_is_prime_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 146. BN_GENCB *cb) 147. { crypto/bn/bn_prime.c:148:12: Call 146. BN_GENCB *cb) 147. { 148. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb); ^ 149. } 150. crypto/bn/bn_prime.c:151:1: Parameter `a->top` 149. } 150. 151. > int BN_is_prime_fasttest_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 152. int do_trial_division, BN_GENCB *cb) 153. { crypto/bn/bn_prime.c:161:9: Call 159. 160. /* Take care of the really small primes 2 & 3 */ 161. if (BN_is_word(a, 2) || BN_is_word(a, 3)) ^ 162. return 1; 163. crypto/bn/bn_lib.c:855:1: Parameter `a->top` 853. } 854. 855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); crypto/bn/bn_lib.c:857:12: Call 855. int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); ^ 858. } 859. crypto/bn/bn_lib.c:840:1: Parameter `a->top` 838. } 839. 840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w) 841. { 842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0)); crypto/bn/bn_prime.c:161:29: Call 159. 160. /* Take care of the really small primes 2 & 3 */ 161. if (BN_is_word(a, 2) || BN_is_word(a, 3)) ^ 162. return 1; 163. crypto/bn/bn_lib.c:855:1: Parameter `a->top` 853. } 854. 855. > int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); crypto/bn/bn_lib.c:857:12: Call 855. int BN_is_word(const BIGNUM *a, const BN_ULONG w) 856. { 857. return BN_abs_is_word(a, w) && (!w || !a->neg); ^ 858. } 859. crypto/bn/bn_lib.c:840:1: Parameter `a->top` 838. } 839. 840. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w) 841. { 842. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0)); crypto/bn/bn_prime.c:165:10: Call 163. 164. /* Check odd and bigger than 1 */ 165. if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0) ^ 166. return 0; 167. crypto/bn/bn_lib.c:860:1: Parameter `a->top` 858. } 859. 860. > int BN_is_odd(const BIGNUM *a) 861. { 862. return (a->top > 0) && (a->d[0] & 1); crypto/bn/bn_prime.c:165:26: Call 163. 164. /* Check odd and bigger than 1 */ 165. if (!BN_is_odd(a) || BN_cmp(a, BN_value_one()) <= 0) ^ 166. return 0; 167. crypto/bn/bn_lib.c:542:1: Parameter `a->top` 540. } 541. 542. > int BN_cmp(const BIGNUM *a, const BIGNUM *b) 543. { 544. int i; crypto/bn/bn_prime.c:198:10: Call 196. 197. /* compute A1 := a - 1 */ 198. if (!BN_copy(A1, a) || !BN_sub_word(A1, 1)) ^ 199. goto err; 200. /* compute A3 := a - 3 */ crypto/bn/bn_lib.c:285:1: Parameter `b->top` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_prime.c:201:10: Call 199. goto err; 200. /* compute A3 := a - 3 */ 201. if (!BN_copy(A3, a) || !BN_sub_word(A3, 3)) ^ 202. goto err; 203. crypto/bn/bn_lib.c:285:1: Parameter `b->top` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_prime.c:215:10: Call 213. if (mont == NULL) 214. goto err; 215. if (!BN_MONT_CTX_set(mont, a, ctx)) ^ 216. goto err; 217. crypto/bn/bn_mont.c:238:9: Call 236. BIGNUM *Ri, *R; 237. 238. if (BN_is_zero(mod)) ^ 239. return 0; 240. crypto/bn/bn_lib.c:845:1: Parameter `a->top` 843. } 844. 845. > int BN_is_zero(const BIGNUM *a) 846. { 847. return a->top == 0; crypto/bn/bn_prime.c:223:13: Call 221. goto err; 222. 223. j = witness(check, a, A1, A1_odd, k, ctx, mont); ^ 224. if (j == -1) 225. goto err; crypto/bn/bn_prime.c:245:1: Parameter `a->top` 243. } 244. 245. > static int witness(BIGNUM *w, const BIGNUM *a, const BIGNUM *a1, 246. const BIGNUM *a1_odd, int k, BN_CTX *ctx, 247. BN_MONT_CTX *mont) crypto/bn/bn_prime.c:249:10: Call 247. BN_MONT_CTX *mont) 248. { 249. if (!BN_mod_exp_mont(w, w, a1_odd, a, ctx, mont)) /* w := w^a1_odd mod a */ ^ 250. return -1; 251. if (BN_is_one(w)) crypto/bn/bn_exp.c:296:1: Parameter `m->top` 294. } 295. 296. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 297. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 298. { crypto/bn/bn_exp.c:310:16: Call 308. || BN_get_flags(a, BN_FLG_CONSTTIME) != 0 309. || BN_get_flags(m, BN_FLG_CONSTTIME) != 0) { 310. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 311. } 312. crypto/bn/bn_exp.c:745:14: Assignment 743. /* 2^(top*BN_BITS2) - m */ 744. tmp.d[0] = (0 - m->d[0]) & BN_MASK2; 745. for (i = 1; i < top; i++) ^ 746. tmp.d[i] = (~m->d[i]) & BN_MASK2; 747. tmp.top = top; crypto/bn/bn_exp.c:1062:14: Call 1060. bits -= window0; 1061. wvalue = bn_get_bits(p, bits) & wmask; 1062. if (!MOD_EXP_CTIME_COPY_FROM_PREBUF(&tmp, top, powerbuf, wvalue, ^ 1063. window)) 1064. goto err; crypto/bn/bn_exp.c:520:1: Parameter `top` 518. } 519. 520. > static int MOD_EXP_CTIME_COPY_FROM_PREBUF(BIGNUM *b, int top, 521. unsigned char *buf, int idx, 522. int window) crypto/bn/bn_exp.c:577:5: Assignment 575. } 576. 577. b->top = top; ^ 578. bn_correct_top(b); 579. return 1; crypto/bn/bn_exp.c:578:5: Call 576. 577. b->top = top; 578. bn_correct_top(b); ^ 579. return 1; 580. } crypto/bn/bn_lib.c:946:1: Parameter `a->top` 944. } 945. 946. > void bn_correct_top(BIGNUM *a) 947. { 948. BN_ULONG *ftl; crypto/bn/bn_exp.c:1075:22: Call 1073. /* Square the result window-size times */ 1074. for (i = 0; i < window; i++) 1075. if (!BN_mod_mul_montgomery(&tmp, &tmp, &tmp, mont, ctx)) ^ 1076. goto err; 1077. crypto/bn/bn_mont.c:26:1: Parameter `a->top` 24. #endif 25. 26. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 27. BN_MONT_CTX *mont, BN_CTX *ctx) 28. { crypto/bn/bn_mont.c:53:14: Call 51. bn_check_top(tmp); 52. if (a == b) { 53. if (!BN_sqr(tmp, a, ctx)) ^ 54. goto err; 55. } else { crypto/bn/bn_sqr.c:17:1: Parameter `a->top` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int max, al; crypto/bn/bn_sqr.c:25:5: Assignment 23. bn_check_top(a); 24. 25. al = a->top; ^ 26. if (al <= 0) { 27. r->top = 0; crypto/bn/bn_sqr.c:74:17: Call 72. if (bn_wexpand(tmp, max) == NULL) 73. goto err; 74. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 75. } 76. } crypto/bn/bn_sqr.c:105:1: <Offset trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `n` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:116:5: Assignment 114. rp[0] = rp[max - 1] = 0; 115. rp++; 116. j = n; ^ 117. 118. if (--j > 0) { crypto/bn/bn_sqr.c:118:9: Assignment 116. j = n; 117. 118. if (--j > 0) { ^ 119. ap++; 120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); crypto/bn/bn_sqr.c:105:1: <Length trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `*r` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:113:5: Assignment 111. max = n * 2; 112. ap = a; 113. rp = r; ^ 114. rp[0] = rp[max - 1] = 0; 115. rp++; crypto/bn/bn_sqr.c:115:5: Assignment 113. rp = r; 114. rp[0] = rp[max - 1] = 0; 115. rp++; ^ 116. j = n; 117. crypto/bn/bn_sqr.c:120:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_is_prime_ex` 118. if (--j > 0) { 119. ap++; 120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); ^ 121. rp += 2; 122. }
https://github.com/openssl/openssl/blob/b48d4397b8ee4256f0b0a115eb99f27ae89995e0/crypto/bn/bn_sqr.c/#L120
d2a_code_trace_data_43129
static void pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, int stride, int sx, int sy, int b_w, int b_h, BlockNode *block, int plane_index, int w, int h){ if(block->type & BLOCK_INTRA){ int x, y; const int color = block->color[plane_index]; const int color4= color*0x01010101; if(b_w==32){ for(y=0; y < b_h; y++){ *(uint32_t*)&dst[0 + y*stride]= color4; *(uint32_t*)&dst[4 + y*stride]= color4; *(uint32_t*)&dst[8 + y*stride]= color4; *(uint32_t*)&dst[12+ y*stride]= color4; *(uint32_t*)&dst[16+ y*stride]= color4; *(uint32_t*)&dst[20+ y*stride]= color4; *(uint32_t*)&dst[24+ y*stride]= color4; *(uint32_t*)&dst[28+ y*stride]= color4; } }else if(b_w==16){ for(y=0; y < b_h; y++){ *(uint32_t*)&dst[0 + y*stride]= color4; *(uint32_t*)&dst[4 + y*stride]= color4; *(uint32_t*)&dst[8 + y*stride]= color4; *(uint32_t*)&dst[12+ y*stride]= color4; } }else if(b_w==8){ for(y=0; y < b_h; y++){ *(uint32_t*)&dst[0 + y*stride]= color4; *(uint32_t*)&dst[4 + y*stride]= color4; } }else if(b_w==4){ for(y=0; y < b_h; y++){ *(uint32_t*)&dst[0 + y*stride]= color4; } }else{ for(y=0; y < b_h; y++){ for(x=0; x < b_w; x++){ dst[x + y*stride]= color; } } } }else{ uint8_t *src= s->last_picture[block->ref].data[plane_index]; const int scale= plane_index ? s->mv_scale : 2*s->mv_scale; int mx= block->mx*scale; int my= block->my*scale; const int dx= mx&15; const int dy= my&15; const int tab_index= 3 - (b_w>>2) + (b_w>>4); sx += (mx>>4) - (HTAPS_MAX/2-1); sy += (my>>4) - (HTAPS_MAX/2-1); src += sx + sy*stride; if( (unsigned)sx >= w - b_w - (HTAPS_MAX-2) || (unsigned)sy >= h - b_h - (HTAPS_MAX-2)){ ff_emulated_edge_mc(tmp + MB_SIZE, src, stride, b_w+HTAPS_MAX-1, b_h+HTAPS_MAX-1, sx, sy, w, h); src= tmp + MB_SIZE; } assert(b_w>1 && b_h>1); assert((tab_index>=0 && tab_index<4) || b_w==32); if((dx&3) || (dy&3) || !(b_w == b_h || 2*b_w == b_h || b_w == 2*b_h) || (b_w&(b_w-1)) || !s->plane[plane_index].fast_mc ) mc_block(&s->plane[plane_index], dst, src, tmp, stride, b_w, b_h, dx, dy); else if(b_w==32){ int y; for(y=0; y<b_h; y+=16){ s->dsp.put_h264_qpel_pixels_tab[0][dy+(dx>>2)](dst + y*stride, src + 3 + (y+3)*stride,stride); s->dsp.put_h264_qpel_pixels_tab[0][dy+(dx>>2)](dst + 16 + y*stride, src + 19 + (y+3)*stride,stride); } }else if(b_w==b_h) s->dsp.put_h264_qpel_pixels_tab[tab_index ][dy+(dx>>2)](dst,src + 3 + 3*stride,stride); else if(b_w==2*b_h){ s->dsp.put_h264_qpel_pixels_tab[tab_index+1][dy+(dx>>2)](dst ,src + 3 + 3*stride,stride); s->dsp.put_h264_qpel_pixels_tab[tab_index+1][dy+(dx>>2)](dst+b_h,src + 3 + b_h + 3*stride,stride); }else{ assert(2*b_w==b_h); s->dsp.put_h264_qpel_pixels_tab[tab_index ][dy+(dx>>2)](dst ,src + 3 + 3*stride ,stride); s->dsp.put_h264_qpel_pixels_tab[tab_index ][dy+(dx>>2)](dst+b_w*stride,src + 3 + 3*stride+b_w*stride,stride); } } } libavcodec/snow.c:2376: error: Buffer Overrun L2 Offset: [0, 18] Size: 16. libavcodec/snow.c:2302:1: <Offset trace> 2300. mca( 8, 8,8) 2301. 2302. static void pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, int stride, int sx, int sy, int b_w, int b_h, BlockNode *block, int plane_index, int w, int h){ ^ 2303. if(block->type & BLOCK_INTRA){ 2304. int x, y; libavcodec/snow.c:2302:1: Parameter `s->mv_scale` 2300. mca( 8, 8,8) 2301. 2302. static void pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, int stride, int sx, int sy, int b_w, int b_h, BlockNode *block, int plane_index, int w, int h){ ^ 2303. if(block->type & BLOCK_INTRA){ 2304. int x, y; libavcodec/snow.c:2343:26: Assignment 2341. }else{ 2342. uint8_t *src= s->last_picture[block->ref].data[plane_index]; 2343. const int scale= plane_index ? s->mv_scale : 2*s->mv_scale; ^ 2344. int mx= block->mx*scale; 2345. int my= block->my*scale; libavcodec/snow.c:2343:9: Assignment 2341. }else{ 2342. uint8_t *src= s->last_picture[block->ref].data[plane_index]; 2343. const int scale= plane_index ? s->mv_scale : 2*s->mv_scale; ^ 2344. int mx= block->mx*scale; 2345. int my= block->my*scale; libavcodec/snow.c:2344:9: Assignment 2342. uint8_t *src= s->last_picture[block->ref].data[plane_index]; 2343. const int scale= plane_index ? s->mv_scale : 2*s->mv_scale; 2344. int mx= block->mx*scale; ^ 2345. int my= block->my*scale; 2346. const int dx= mx&15; libavcodec/snow.c:2346:9: Assignment 2344. int mx= block->mx*scale; 2345. int my= block->my*scale; 2346. const int dx= mx&15; ^ 2347. const int dy= my&15; 2348. const int tab_index= 3 - (b_w>>2) + (b_w>>4); libavcodec/snow.c:2302:1: <Length trace> 2300. mca( 8, 8,8) 2301. 2302. static void pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, int stride, int sx, int sy, int b_w, int b_h, BlockNode *block, int plane_index, int w, int h){ ^ 2303. if(block->type & BLOCK_INTRA){ 2304. int x, y; libavcodec/snow.c:2302:1: Parameter `s->dsp.put_h264_qpel_pixels_tab[*][*]` 2300. mca( 8, 8,8) 2301. 2302. static void pred_block(SnowContext *s, uint8_t *dst, uint8_t *tmp, int stride, int sx, int sy, int b_w, int b_h, BlockNode *block, int plane_index, int w, int h){ ^ 2303. if(block->type & BLOCK_INTRA){ 2304. int x, y; libavcodec/snow.c:2376:13: Array access: Offset: [0, 18] Size: 16 2374. }else{ 2375. assert(2*b_w==b_h); 2376. s->dsp.put_h264_qpel_pixels_tab[tab_index ][dy+(dx>>2)](dst ,src + 3 + 3*stride ,stride); ^ 2377. s->dsp.put_h264_qpel_pixels_tab[tab_index ][dy+(dx>>2)](dst+b_w*stride,src + 3 + 3*stride+b_w*stride,stride); 2378. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/snow.c/#L2376
d2a_code_trace_data_43130
static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, OPENSSL_LH_DOALL_FUNC func, OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) { int i; OPENSSL_LH_NODE *a, *n; if (lh == NULL) return; for (i = lh->num_nodes - 1; i >= 0; i--) { a = lh->b[i]; while (a != NULL) { n = a->next; if (use_arg) func_arg(a->data, arg); else func(a->data); a = n; } } } apps/s_time.c:422: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `SSL_free`. Showing all 16 steps of the trace apps/s_time.c:385:21: Call 383. 384. if (scon == NULL) 385. serverCon = SSL_new(ctx); ^ 386. else { 387. serverCon = scon; ssl/ssl_lib.c:518:1: Parameter `ctx->sessions->num_nodes` 516. } 517. 518. > SSL *SSL_new(SSL_CTX *ctx) 519. { 520. SSL *s; apps/s_time.c:422:13: Call 420. ERR_print_errors(bio_err); 421. if (scon == NULL) 422. SSL_free(serverCon); ^ 423. return NULL; 424. } ssl/ssl_lib.c:926:1: Parameter `s->ctx->sessions->num_nodes` 924. } 925. 926. > void SSL_free(SSL *s) 927. { 928. int i; ssl/ssl_lib.c:998:5: Call 996. RECORD_LAYER_release(&s->rlayer); 997. 998. SSL_CTX_free(s->ctx); ^ 999. 1000. ASYNC_WAIT_CTX_free(s->waitctx); ssl/ssl_lib.c:2429:1: Parameter `a->sessions->num_nodes` 2427. } 2428. 2429. > void SSL_CTX_free(SSL_CTX *a) 2430. { 2431. int i; ssl/ssl_lib.c:2455:9: Call 2453. */ 2454. if (a->sessions != NULL) 2455. SSL_CTX_flush_sessions(a, 0); ^ 2456. 2457. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:974:1: Parameter `s->sessions->num_nodes` 972. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 973. 974. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 975. { 976. unsigned long i; ssl/ssl_sess.c:987:5: Call 985. i = lh_SSL_SESSION_get_down_load(s->sessions); 986. lh_SSL_SESSION_set_down_load(s->sessions, 0); 987. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp); ^ 988. lh_SSL_SESSION_set_down_load(s->sessions, i); 989. CRYPTO_THREAD_unlock(s->lock); ssl/ssl_sess.c:972:1: Parameter `lh->num_nodes` 970. } 971. 972. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 973. 974. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) ssl/ssl_sess.c:972:1: Call 970. } 971. 972. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 973. 974. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) crypto/lhash/lhash.c:182:1: Parameter `lh->num_nodes` 180. } 181. 182. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); crypto/lhash/lhash.c:184:5: Call 182. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); ^ 185. } 186. crypto/lhash/lhash.c:150:1: <LHS trace> 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:150:1: Parameter `lh->num_nodes` 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:164:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `SSL_free` 162. * memory leaks otherwise 163. */ 164. for (i = lh->num_nodes - 1; i >= 0; i--) { ^ 165. a = lh->b[i]; 166. while (a != NULL) {
https://github.com/openssl/openssl/blob/2a7de0fd5d9baf946ef4d2c51096b04dd47a8143/crypto/lhash/lhash.c/#L164
d2a_code_trace_data_43131
static int expand(OPENSSL_LHASH *lh) { OPENSSL_LH_NODE **n, **n1, **n2, *np; unsigned int p, pmax, nni, j; unsigned long hash; nni = lh->num_alloc_nodes; p = lh->p; pmax = lh->pmax; if (p + 1 >= pmax) { j = nni * 2; n = OPENSSL_realloc(lh->b, sizeof(OPENSSL_LH_NODE *) * j); if (n == NULL) { lh->error++; return 0; } lh->b = n; memset(n + nni, 0, sizeof(*n) * (j - nni)); lh->pmax = nni; lh->num_alloc_nodes = j; lh->num_expand_reallocs++; lh->p = 0; } else { lh->p++; } lh->num_nodes++; lh->num_expands++; n1 = &(lh->b[p]); n2 = &(lh->b[p + pmax]); *n2 = NULL; for (np = *n1; np != NULL;) { hash = np->hash; if ((hash % nni) != p) { *n1 = (*n1)->next; np->next = *n2; *n2 = np; } else n1 = &((*n1)->next); np = *n1; } return 1; } test/sslapitest.c:4730: error: BUFFER_OVERRUN_L3 Offset added: [272, +oo] (⇐ [16, +oo] + [256, +oo]) Size: [1, +oo] by call to `TXT_DB_insert`. Showing all 24 steps of the trace test/sslapitest.c:4706:12: Call 4704. goto end; 4705. 4706. gNid = SRP_create_verifier(userid, password, &row[DB_srpsalt], ^ 4707. &row[DB_srpverifier], NULL, NULL); 4708. if (!TEST_ptr(gNid)) crypto/srp/srp_vfy.c:649:10: Call 647. goto err; 648. 649. if (!SRP_create_verifier_BN(user, pass, &s, &v, N_bn, g_bn)) ^ 650. goto err; 651. crypto/srp/srp_vfy.c:722:9: Call 720. } 721. 722. x = SRP_Calc_x(salttmp, user, pass); ^ 723. if (x == NULL) 724. goto err; crypto/srp/srp_lib.c:136:10: Call 134. goto err; 135. 136. if (!EVP_DigestInit_ex(ctxt, EVP_sha1(), NULL) ^ 137. || !EVP_DigestUpdate(ctxt, user, strlen(user)) 138. || !EVP_DigestUpdate(ctxt, ":", 1) crypto/evp/digest.c:93:20: Call 91. } else { 92. /* Ask if an ENGINE is reserved for this job */ 93. impl = ENGINE_get_digest_engine(type->type); ^ 94. } 95. if (impl != NULL) { crypto/engine/tb_digest.c:65:12: Call 63. ENGINE *ENGINE_get_digest_engine(int nid) 64. { 65. return engine_table_select(&digest_table, nid); ^ 66. } 67. crypto/engine/eng_table.c:216:10: Call 214. * operations. But don't worry about a fprintf(stderr). 215. */ 216. if (!int_table_check(table, 0)) ^ 217. goto end; 218. tmplate.nid = nid; crypto/engine/eng_table.c:72:15: Call 70. if (!create) 71. return 0; 72. if ((lh = lh_ENGINE_PILE_new(engine_pile_hash, engine_pile_cmp)) == NULL) ^ 73. return 0; 74. *t = (ENGINE_TABLE *)lh; crypto/engine/eng_int.h:169:1: Call 167. typedef struct st_engine_pile ENGINE_PILE; 168. 169. > DEFINE_LHASH_OF(ENGINE_PILE); 170. 171. #endif /* HEADER_ENGINE_INT_H */ crypto/lhash/lhash.c:64:5: Assignment 62. ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h); 63. ret->num_nodes = MIN_NODES / 2; 64. ret->num_alloc_nodes = MIN_NODES; ^ 65. ret->pmax = MIN_NODES / 2; 66. ret->up_load = UP_LOAD; test/sslapitest.c:4730:17: Call 4728. || !TEST_ptr(row[DB_srptype]) 4729. || !TEST_ptr(row[DB_srpgN]) 4730. || !TEST_true(TXT_DB_insert(db, row))) ^ 4731. goto end; 4732. crypto/txt_db/txt_db.c:237:1: Parameter `(*db->index)->num_alloc_nodes` 235. } 236. 237. > int TXT_DB_insert(TXT_DB *db, OPENSSL_STRING *row) 238. { 239. int i; crypto/txt_db/txt_db.c:260:19: Call 258. if ((db->qual[i] != NULL) && (db->qual[i] (row) == 0)) 259. continue; 260. (void)lh_OPENSSL_STRING_insert(db->index[i], row); ^ 261. if (lh_OPENSSL_STRING_retrieve(db->index[i], row) == NULL) 262. goto err1; include/openssl/lhash.h:197:1: Parameter `lh->num_alloc_nodes` 195. LHASH_OF(type) 196. 197. > DEFINE_LHASH_OF(OPENSSL_STRING); 198. # ifdef _MSC_VER 199. /* include/openssl/lhash.h:197:1: Call 195. LHASH_OF(type) 196. 197. > DEFINE_LHASH_OF(OPENSSL_STRING); 198. # ifdef _MSC_VER 199. /* crypto/lhash/lhash.c:96:1: Parameter `lh->num_alloc_nodes` 94. } 95. 96. > void *OPENSSL_LH_insert(OPENSSL_LHASH *lh, void *data) 97. { 98. unsigned long hash; crypto/lhash/lhash.c:103:77: Call 101. 102. lh->error = 0; 103. if ((lh->up_load <= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)) && !expand(lh)) ^ 104. return NULL; /* 'lh->error++' already done in 'expand' */ 105. crypto/lhash/lhash.c:214:1: <Offset trace> 212. } 213. 214. > static int expand(OPENSSL_LHASH *lh) 215. { 216. OPENSSL_LH_NODE **n, **n1, **n2, *np; crypto/lhash/lhash.c:214:1: Parameter `lh->num_alloc_nodes` 212. } 213. 214. > static int expand(OPENSSL_LHASH *lh) 215. { 216. OPENSSL_LH_NODE **n, **n1, **n2, *np; crypto/lhash/lhash.c:220:5: Assignment 218. unsigned long hash; 219. 220. nni = lh->num_alloc_nodes; ^ 221. p = lh->p; 222. pmax = lh->pmax; crypto/lhash/lhash.c:214:1: <Length trace> 212. } 213. 214. > static int expand(OPENSSL_LHASH *lh) 215. { 216. OPENSSL_LH_NODE **n, **n1, **n2, *np; crypto/lhash/lhash.c:214:1: Parameter `lh->num_alloc_nodes` 212. } 213. 214. > static int expand(OPENSSL_LHASH *lh) 215. { 216. OPENSSL_LH_NODE **n, **n1, **n2, *np; crypto/lhash/lhash.c:220:5: Assignment 218. unsigned long hash; 219. 220. nni = lh->num_alloc_nodes; ^ 221. p = lh->p; 222. pmax = lh->pmax; crypto/lhash/lhash.c:231:9: Array access: Offset added: [272, +oo] (⇐ [16, +oo] + [256, +oo]) Size: [1, +oo] by call to `TXT_DB_insert` 229. } 230. lh->b = n; 231. memset(n + nni, 0, sizeof(*n) * (j - nni)); ^ 232. lh->pmax = nni; 233. lh->num_alloc_nodes = j;
https://github.com/openssl/openssl/blob/ea09abc80892920ee5db4de82bed7a193b5896f0/crypto/lhash/lhash.c/#L231
d2a_code_trace_data_43132
DH *ssl_get_auto_dh(SSL *s) { int dh_secbits = 80; if (s->cert->dh_tmp_auto == 2) return DH_get_1024_160(); if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) { if (s->s3->tmp.new_cipher->strength_bits == 256) dh_secbits = 128; else dh_secbits = 80; } else { CERT_PKEY *cpk = ssl_get_server_send_pkey(s); dh_secbits = EVP_PKEY_security_bits(cpk->privatekey); } if (dh_secbits >= 128) { DH *dhp = DH_new(); if (dhp == NULL) return NULL; dhp->g = BN_new(); if (dhp->g != NULL) BN_set_word(dhp->g, 2); if (dh_secbits >= 192) dhp->p = get_rfc3526_prime_8192(NULL); else dhp->p = get_rfc3526_prime_3072(NULL); if (dhp->p == NULL || dhp->g == NULL) { DH_free(dhp); return NULL; } return dhp; } if (dh_secbits >= 112) return DH_get_2048_224(); return DH_get_1024_160(); } ssl/t1_lib.c:4245: error: NULL_DEREFERENCE pointer `cpk` last assigned on line 4244 could be null and is dereferenced at line 4245, column 45. Showing all 32 steps of the trace ssl/t1_lib.c:4233:1: start of procedure ssl_get_auto_dh() 4231. 4232. #ifndef OPENSSL_NO_DH 4233. > DH *ssl_get_auto_dh(SSL *s) 4234. { 4235. int dh_secbits = 80; ssl/t1_lib.c:4235:5: 4233. DH *ssl_get_auto_dh(SSL *s) 4234. { 4235. > int dh_secbits = 80; 4236. if (s->cert->dh_tmp_auto == 2) 4237. return DH_get_1024_160(); ssl/t1_lib.c:4236:9: Taking false branch 4234. { 4235. int dh_secbits = 80; 4236. if (s->cert->dh_tmp_auto == 2) ^ 4237. return DH_get_1024_160(); 4238. if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) { ssl/t1_lib.c:4238:9: Taking false branch 4236. if (s->cert->dh_tmp_auto == 2) 4237. return DH_get_1024_160(); 4238. if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) { ^ 4239. if (s->s3->tmp.new_cipher->strength_bits == 256) 4240. dh_secbits = 128; ssl/t1_lib.c:4244:9: 4242. dh_secbits = 80; 4243. } else { 4244. > CERT_PKEY *cpk = ssl_get_server_send_pkey(s); 4245. dh_secbits = EVP_PKEY_security_bits(cpk->privatekey); 4246. } ssl/ssl_lib.c:2201:1: start of procedure ssl_get_server_send_pkey() 2199. } 2200. 2201. > CERT_PKEY *ssl_get_server_send_pkey(SSL *s) 2202. { 2203. CERT *c; ssl/ssl_lib.c:2206:5: 2204. int i; 2205. 2206. > c = s->cert; 2207. if (!s->s3 || !s->s3->tmp.new_cipher) 2208. return NULL; ssl/ssl_lib.c:2207:10: Taking false branch 2205. 2206. c = s->cert; 2207. if (!s->s3 || !s->s3->tmp.new_cipher) ^ 2208. return NULL; 2209. ssl_set_masks(s, s->s3->tmp.new_cipher); ssl/ssl_lib.c:2207:20: Taking false branch 2205. 2206. c = s->cert; 2207. if (!s->s3 || !s->s3->tmp.new_cipher) ^ 2208. return NULL; 2209. ssl_set_masks(s, s->s3->tmp.new_cipher); ssl/ssl_lib.c:2209:5: Skipping ssl_set_masks(): empty list of specs 2207. if (!s->s3 || !s->s3->tmp.new_cipher) 2208. return NULL; 2209. ssl_set_masks(s, s->s3->tmp.new_cipher); ^ 2210. 2211. #ifdef OPENSSL_SSL_DEBUG_BROKEN_PROTOCOL ssl/ssl_lib.c:2220:5: 2218. #endif 2219. 2220. > i = ssl_get_server_cert_index(s); 2221. 2222. /* This may or may not be an error. */ ssl/ssl_lib.c:2180:1: start of procedure ssl_get_server_cert_index() 2178. #endif 2179. 2180. > static int ssl_get_server_cert_index(const SSL *s) 2181. { 2182. int idx; ssl/ssl_lib.c:2183:5: 2181. { 2182. int idx; 2183. > idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher); 2184. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509) 2185. idx = SSL_PKEY_RSA_SIGN; ssl/ssl_ciph.c:1949:1: start of procedure ssl_cipher_get_cert_index() 1947. 1948. /* For a cipher return the index corresponding to the certificate type */ 1949. > int ssl_cipher_get_cert_index(const SSL_CIPHER *c) 1950. { 1951. uint32_t alg_k, alg_a; ssl/ssl_ciph.c:1953:5: 1951. uint32_t alg_k, alg_a; 1952. 1953. > alg_k = c->algorithm_mkey; 1954. alg_a = c->algorithm_auth; 1955. ssl/ssl_ciph.c:1954:5: 1952. 1953. alg_k = c->algorithm_mkey; 1954. > alg_a = c->algorithm_auth; 1955. 1956. if (alg_k & (SSL_kECDHr | SSL_kECDHe)) { ssl/ssl_ciph.c:1956:9: Taking false branch 1954. alg_a = c->algorithm_auth; 1955. 1956. if (alg_k & (SSL_kECDHr | SSL_kECDHe)) { ^ 1957. /* 1958. * we don't need to look at SSL_kECDHE since no certificate is needed ssl/ssl_ciph.c:1966:16: Taking false branch 1964. */ 1965. return SSL_PKEY_ECC; 1966. } else if (alg_a & SSL_aECDSA) ^ 1967. return SSL_PKEY_ECC; 1968. else if (alg_a & SSL_aDSS) ssl/ssl_ciph.c:1968:14: Taking false branch 1966. } else if (alg_a & SSL_aECDSA) 1967. return SSL_PKEY_ECC; 1968. else if (alg_a & SSL_aDSS) ^ 1969. return SSL_PKEY_DSA_SIGN; 1970. else if (alg_a & SSL_aRSA) ssl/ssl_ciph.c:1970:14: Taking true branch 1968. else if (alg_a & SSL_aDSS) 1969. return SSL_PKEY_DSA_SIGN; 1970. else if (alg_a & SSL_aRSA) ^ 1971. return SSL_PKEY_RSA_ENC; 1972. else if (alg_a & SSL_aGOST12) ssl/ssl_ciph.c:1971:9: 1969. return SSL_PKEY_DSA_SIGN; 1970. else if (alg_a & SSL_aRSA) 1971. > return SSL_PKEY_RSA_ENC; 1972. else if (alg_a & SSL_aGOST12) 1973. return SSL_PKEY_GOST_EC; ssl/ssl_ciph.c:1978:1: return from a call to ssl_cipher_get_cert_index 1976. 1977. return -1; 1978. > } 1979. 1980. const SSL_CIPHER *ssl_get_cipher_by_char(SSL *ssl, const unsigned char *ptr) ssl/ssl_lib.c:2184:9: Taking true branch 2182. int idx; 2183. idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher); 2184. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509) ^ 2185. idx = SSL_PKEY_RSA_SIGN; 2186. if (idx == SSL_PKEY_GOST_EC) { ssl/ssl_lib.c:2184:37: Taking false branch 2182. int idx; 2183. idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher); 2184. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509) ^ 2185. idx = SSL_PKEY_RSA_SIGN; 2186. if (idx == SSL_PKEY_GOST_EC) { ssl/ssl_lib.c:2186:9: Taking false branch 2184. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509) 2185. idx = SSL_PKEY_RSA_SIGN; 2186. if (idx == SSL_PKEY_GOST_EC) { ^ 2187. if (s->cert->pkeys[SSL_PKEY_GOST12_512].x509) 2188. idx = SSL_PKEY_GOST12_512; ssl/ssl_lib.c:2196:9: Taking false branch 2194. idx = -1; 2195. } 2196. if (idx == -1) ^ 2197. SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR); 2198. return idx; ssl/ssl_lib.c:2198:5: 2196. if (idx == -1) 2197. SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR); 2198. > return idx; 2199. } 2200. ssl/ssl_lib.c:2199:1: return from a call to ssl_get_server_cert_index 2197. SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR); 2198. return idx; 2199. > } 2200. 2201. CERT_PKEY *ssl_get_server_send_pkey(SSL *s) ssl/ssl_lib.c:2223:9: Taking true branch 2221. 2222. /* This may or may not be an error. */ 2223. if (i < 0) ^ 2224. return NULL; 2225. ssl/ssl_lib.c:2224:9: 2222. /* This may or may not be an error. */ 2223. if (i < 0) 2224. > return NULL; 2225. 2226. /* May be NULL. */ ssl/ssl_lib.c:2228:1: return from a call to ssl_get_server_send_pkey 2226. /* May be NULL. */ 2227. return &c->pkeys[i]; 2228. > } 2229. 2230. EVP_PKEY *ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *cipher, ssl/t1_lib.c:4245:9: 4243. } else { 4244. CERT_PKEY *cpk = ssl_get_server_send_pkey(s); 4245. > dh_secbits = EVP_PKEY_security_bits(cpk->privatekey); 4246. } 4247.
https://github.com/openssl/openssl/blob/bc71f91064a3eec10310fa4cc14fe2a3fd9bc7bb/ssl/t1_lib.c/#L4245
d2a_code_trace_data_43133
int ssl3_get_cert_verify(SSL *s) { EVP_PKEY *pkey=NULL; unsigned char *p; int al,ok,ret=0; long n; int type=0,i,j; X509 *peer; const EVP_MD *md = NULL; EVP_MD_CTX mctx; EVP_MD_CTX_init(&mctx); n=s->method->ssl_get_message(s, SSL3_ST_SR_CERT_VRFY_A, SSL3_ST_SR_CERT_VRFY_B, -1, SSL3_RT_MAX_PLAIN_LENGTH, &ok); if (!ok) return((int)n); if (s->session->peer != NULL) { peer=s->session->peer; pkey=X509_get_pubkey(peer); type=X509_certificate_type(peer,pkey); } else { peer=NULL; pkey=NULL; } if (s->s3->tmp.message_type != SSL3_MT_CERTIFICATE_VERIFY) { s->s3->tmp.reuse_message=1; if ((peer != NULL) && (type & EVP_PKT_SIGN)) { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_MISSING_VERIFY_MESSAGE); goto f_err; } ret=1; goto end; } if (peer == NULL) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_NO_CLIENT_CERT_RECEIVED); al=SSL_AD_UNEXPECTED_MESSAGE; goto f_err; } if (!(type & EVP_PKT_SIGN)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE); al=SSL_AD_ILLEGAL_PARAMETER; goto f_err; } if (s->s3->change_cipher_spec) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_CCS_RECEIVED_EARLY); al=SSL_AD_UNEXPECTED_MESSAGE; goto f_err; } p=(unsigned char *)s->init_msg; if (n==64 && (pkey->type==NID_id_GostR3410_94 || pkey->type == NID_id_GostR3410_2001) ) { i=64; } else { if (SSL_USE_SIGALGS(s)) { int rv = tls12_check_peer_sigalg(&md, s, p, pkey); if (rv == -1) { al = SSL_AD_INTERNAL_ERROR; goto f_err; } else if (rv == 0) { al = SSL_AD_DECODE_ERROR; goto f_err; } #ifdef SSL_DEBUG fprintf(stderr, "USING TLSv1.2 HASH %s\n", EVP_MD_name(md)); #endif p += 2; n -= 2; } n2s(p,i); n-=2; if (i > n) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_LENGTH_MISMATCH); al=SSL_AD_DECODE_ERROR; goto f_err; } } j=EVP_PKEY_size(pkey); if ((i > j) || (n > j) || (n <= 0)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_WRONG_SIGNATURE_SIZE); al=SSL_AD_DECODE_ERROR; goto f_err; } if (SSL_USE_SIGALGS(s)) { long hdatalen = 0; void *hdata; hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata); if (hdatalen <= 0) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR); al=SSL_AD_INTERNAL_ERROR; goto f_err; } #ifdef SSL_DEBUG fprintf(stderr, "Using TLS 1.2 with client verify alg %s\n", EVP_MD_name(md)); #endif if (!EVP_VerifyInit_ex(&mctx, md, NULL) || !EVP_VerifyUpdate(&mctx, hdata, hdatalen)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_EVP_LIB); al=SSL_AD_INTERNAL_ERROR; goto f_err; } if (EVP_VerifyFinal(&mctx, p , i, pkey) <= 0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_SIGNATURE); goto f_err; } } else #ifndef OPENSSL_NO_RSA if (pkey->type == EVP_PKEY_RSA) { i=RSA_verify(NID_md5_sha1, s->s3->tmp.cert_verify_md, MD5_DIGEST_LENGTH+SHA_DIGEST_LENGTH, p, i, pkey->pkey.rsa); if (i < 0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_RSA_DECRYPT); goto f_err; } if (i == 0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_RSA_SIGNATURE); goto f_err; } } else #endif #ifndef OPENSSL_NO_DSA if (pkey->type == EVP_PKEY_DSA) { j=DSA_verify(pkey->save_type, &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]), SHA_DIGEST_LENGTH,p,i,pkey->pkey.dsa); if (j <= 0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_DSA_SIGNATURE); goto f_err; } } else #endif #ifndef OPENSSL_NO_ECDSA if (pkey->type == EVP_PKEY_EC) { j=ECDSA_verify(pkey->save_type, &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]), SHA_DIGEST_LENGTH,p,i,pkey->pkey.ec); if (j <= 0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE); goto f_err; } } else #endif if (pkey->type == NID_id_GostR3410_94 || pkey->type == NID_id_GostR3410_2001) { unsigned char signature[64]; int idx; EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new(pkey,NULL); EVP_PKEY_verify_init(pctx); if (i!=64) { fprintf(stderr,"GOST signature length is %d",i); } for (idx=0;idx<64;idx++) { signature[63-idx]=p[idx]; } j=EVP_PKEY_verify(pctx,signature,64,s->s3->tmp.cert_verify_md,32); EVP_PKEY_CTX_free(pctx); if (j<=0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE); goto f_err; } } else { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,ERR_R_INTERNAL_ERROR); al=SSL_AD_UNSUPPORTED_CERTIFICATE; goto f_err; } ret=1; if (0) { f_err: ssl3_send_alert(s,SSL3_AL_FATAL,al); } end: if (s->s3->handshake_buffer) { BIO_free(s->s3->handshake_buffer); s->s3->handshake_buffer = NULL; s->s3->flags &= ~TLS1_FLAGS_KEEP_HANDSHAKE; } EVP_MD_CTX_cleanup(&mctx); EVP_PKEY_free(pkey); return(ret); } ssl/s3_srvr.c:3135: error: NULL_DEREFERENCE pointer `pkey` last assigned on line 3087 could be null and is dereferenced at line 3135, column 16. Showing all 27 steps of the trace ssl/s3_srvr.c:3063:1: start of procedure ssl3_get_cert_verify() 3061. } 3062. 3063. > int ssl3_get_cert_verify(SSL *s) 3064. { 3065. EVP_PKEY *pkey=NULL; ssl/s3_srvr.c:3065:2: 3063. int ssl3_get_cert_verify(SSL *s) 3064. { 3065. > EVP_PKEY *pkey=NULL; 3066. unsigned char *p; 3067. int al,ok,ret=0; ssl/s3_srvr.c:3067:2: 3065. EVP_PKEY *pkey=NULL; 3066. unsigned char *p; 3067. > int al,ok,ret=0; 3068. long n; 3069. int type=0,i,j; ssl/s3_srvr.c:3069:2: 3067. int al,ok,ret=0; 3068. long n; 3069. > int type=0,i,j; 3070. X509 *peer; 3071. const EVP_MD *md = NULL; ssl/s3_srvr.c:3071:2: 3069. int type=0,i,j; 3070. X509 *peer; 3071. > const EVP_MD *md = NULL; 3072. EVP_MD_CTX mctx; 3073. EVP_MD_CTX_init(&mctx); ssl/s3_srvr.c:3073:2: 3071. const EVP_MD *md = NULL; 3072. EVP_MD_CTX mctx; 3073. > EVP_MD_CTX_init(&mctx); 3074. 3075. n=s->method->ssl_get_message(s, crypto/evp/digest.c:120:1: start of procedure EVP_MD_CTX_init() 118. #endif 119. 120. > void EVP_MD_CTX_init(EVP_MD_CTX *ctx) 121. { 122. memset(ctx,'\0',sizeof *ctx); crypto/evp/digest.c:122:2: 120. void EVP_MD_CTX_init(EVP_MD_CTX *ctx) 121. { 122. > memset(ctx,'\0',sizeof *ctx); 123. } 124. crypto/evp/digest.c:123:2: return from a call to EVP_MD_CTX_init 121. { 122. memset(ctx,'\0',sizeof *ctx); 123. } ^ 124. 125. EVP_MD_CTX *EVP_MD_CTX_create(void) ssl/s3_srvr.c:3075:2: Skipping __function_pointer__(): unresolved function pointer 3073. EVP_MD_CTX_init(&mctx); 3074. 3075. n=s->method->ssl_get_message(s, ^ 3076. SSL3_ST_SR_CERT_VRFY_A, 3077. SSL3_ST_SR_CERT_VRFY_B, ssl/s3_srvr.c:3082:7: Taking false branch 3080. &ok); 3081. 3082. if (!ok) return((int)n); ^ 3083. 3084. if (s->session->peer != NULL) ssl/s3_srvr.c:3084:6: Taking true branch 3082. if (!ok) return((int)n); 3083. 3084. if (s->session->peer != NULL) ^ 3085. { 3086. peer=s->session->peer; ssl/s3_srvr.c:3086:3: 3084. if (s->session->peer != NULL) 3085. { 3086. > peer=s->session->peer; 3087. pkey=X509_get_pubkey(peer); 3088. type=X509_certificate_type(peer,pkey); ssl/s3_srvr.c:3087:3: 3085. { 3086. peer=s->session->peer; 3087. > pkey=X509_get_pubkey(peer); 3088. type=X509_certificate_type(peer,pkey); 3089. } crypto/x509/x509_cmp.c:313:1: start of procedure X509_get_pubkey() 311. } 312. 313. > EVP_PKEY *X509_get_pubkey(X509 *x) 314. { 315. if ((x == NULL) || (x->cert_info == NULL)) crypto/x509/x509_cmp.c:315:7: Taking false branch 313. EVP_PKEY *X509_get_pubkey(X509 *x) 314. { 315. if ((x == NULL) || (x->cert_info == NULL)) ^ 316. return(NULL); 317. return(X509_PUBKEY_get(x->cert_info->key)); crypto/x509/x509_cmp.c:315:22: Taking true branch 313. EVP_PKEY *X509_get_pubkey(X509 *x) 314. { 315. if ((x == NULL) || (x->cert_info == NULL)) ^ 316. return(NULL); 317. return(X509_PUBKEY_get(x->cert_info->key)); crypto/x509/x509_cmp.c:316:3: 314. { 315. if ((x == NULL) || (x->cert_info == NULL)) 316. > return(NULL); 317. return(X509_PUBKEY_get(x->cert_info->key)); 318. } crypto/x509/x509_cmp.c:318:2: return from a call to X509_get_pubkey 316. return(NULL); 317. return(X509_PUBKEY_get(x->cert_info->key)); 318. } ^ 319. 320. ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x) ssl/s3_srvr.c:3088:3: Skipping X509_certificate_type(): empty list of specs 3086. peer=s->session->peer; 3087. pkey=X509_get_pubkey(peer); 3088. type=X509_certificate_type(peer,pkey); ^ 3089. } 3090. else ssl/s3_srvr.c:3096:6: Taking false branch 3094. } 3095. 3096. if (s->s3->tmp.message_type != SSL3_MT_CERTIFICATE_VERIFY) ^ 3097. { 3098. s->s3->tmp.reuse_message=1; ssl/s3_srvr.c:3109:6: Taking false branch 3107. } 3108. 3109. if (peer == NULL) ^ 3110. { 3111. SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_NO_CLIENT_CERT_RECEIVED); ssl/s3_srvr.c:3116:8: Taking false branch 3114. } 3115. 3116. if (!(type & EVP_PKT_SIGN)) ^ 3117. { 3118. SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE); ssl/s3_srvr.c:3123:6: Taking false branch 3121. } 3122. 3123. if (s->s3->change_cipher_spec) ^ 3124. { 3125. SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_CCS_RECEIVED_EARLY); ssl/s3_srvr.c:3131:2: 3129. 3130. /* we now have a signature that we need to verify */ 3131. > p=(unsigned char *)s->init_msg; 3132. /* Check for broken implementations of GOST ciphersuites */ 3133. /* If key is GOST and n is exactly 64, it is bare ssl/s3_srvr.c:3135:6: Taking true branch 3133. /* If key is GOST and n is exactly 64, it is bare 3134. * signature without length field */ 3135. if (n==64 && (pkey->type==NID_id_GostR3410_94 || ^ 3136. pkey->type == NID_id_GostR3410_2001) ) 3137. { ssl/s3_srvr.c:3135:16: 3133. /* If key is GOST and n is exactly 64, it is bare 3134. * signature without length field */ 3135. > if (n==64 && (pkey->type==NID_id_GostR3410_94 || 3136. pkey->type == NID_id_GostR3410_2001) ) 3137. {
https://github.com/openssl/openssl/blob/9e189b9dc10786c755919e6792e923c584c918a1/ssl/s3_srvr.c/#L3135
d2a_code_trace_data_43134
static ossl_inline size_t constant_time_lt_s(size_t a, size_t b) { return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b))); } ssl/record/ssl3_record.c:649: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`*inrecs->data` + 1, `*inrecs->data` + 1]):unsigned64 by call to `ssl3_cbc_remove_padding`. Showing all 11 steps of the trace ssl/record/ssl3_record.c:578:1: Parameter `*inrecs->data` 576. * occurred. 577. */ 578. > int ssl3_enc(SSL *s, SSL3_RECORD *inrecs, size_t n_recs, int send) 579. { 580. SSL3_RECORD *rec; ssl/record/ssl3_record.c:649:20: Call 647. } 648. if ((bs != 1) && !send) 649. return ssl3_cbc_remove_padding(rec, bs, mac_size); ^ 650. } 651. return (1); ssl/record/ssl3_record.c:1111:1: Parameter `block_size` 1109. * -1: otherwise. 1110. */ 1111. > int ssl3_cbc_remove_padding(SSL3_RECORD *rec, 1112. size_t block_size, size_t mac_size) 1113. { ssl/record/ssl3_record.c:1127:13: Call 1125. good = constant_time_ge_s(rec->length, padding_length + overhead); 1126. /* SSLv3 requires that the padding is minimal. */ 1127. good &= constant_time_ge_s(block_size, padding_length + 1); ^ 1128. rec->length -= good & (padding_length + 1); 1129. return constant_time_select_int_s(good, 1, -1); include/internal/constant_time_locl.h:134:1: Parameter `a` 132. } 133. 134. > static ossl_inline size_t constant_time_ge_s(size_t a, size_t b) 135. { 136. return ~constant_time_lt_s(a, b); include/internal/constant_time_locl.h:136:13: Call 134. static ossl_inline size_t constant_time_ge_s(size_t a, size_t b) 135. { 136. return ~constant_time_lt_s(a, b); ^ 137. } 138. include/internal/constant_time_locl.h:117:1: <LHS trace> 115. } 116. 117. > static ossl_inline size_t constant_time_lt_s(size_t a, size_t b) 118. { 119. return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b))); include/internal/constant_time_locl.h:117:1: Parameter `a` 115. } 116. 117. > static ossl_inline size_t constant_time_lt_s(size_t a, size_t b) 118. { 119. return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b))); include/internal/constant_time_locl.h:117:1: <RHS trace> 115. } 116. 117. > static ossl_inline size_t constant_time_lt_s(size_t a, size_t b) 118. { 119. return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b))); include/internal/constant_time_locl.h:117:1: Parameter `b` 115. } 116. 117. > static ossl_inline size_t constant_time_lt_s(size_t a, size_t b) 118. { 119. return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b))); include/internal/constant_time_locl.h:119:12: Binary operation: ([0, +oo] - [*inrecs->data + 1, *inrecs->data + 1]):unsigned64 by call to `ssl3_cbc_remove_padding` 117. static ossl_inline size_t constant_time_lt_s(size_t a, size_t b) 118. { 119. return constant_time_msb_s(a ^ ((a ^ b) | ((a - b) ^ b))); ^ 120. } 121.
https://github.com/openssl/openssl/blob/6438632420cee9821409221ef6717edc5ee408c1/include/internal/constant_time_locl.h/#L119
d2a_code_trace_data_43135
static int mkv_add_cuepoint(mkv_cues *cues, int stream, int64_t ts, int64_t cluster_pos) { int err; if (ts < 0) return 0; if ((err = av_reallocp_array(&cues->entries, cues->num_entries + 1, sizeof(*cues->entries))) < 0) { cues->num_entries = 0; return err; } cues->entries[cues->num_entries].pts = ts; cues->entries[cues->num_entries].tracknum = stream + 1; cues->entries[cues->num_entries++].cluster_pos = cluster_pos - cues->segment_offset; return 0; } libavformat/matroskaenc.c:394: error: Null Dereference pointer `cues->entries` last assigned on line 388 could be null and is dereferenced at line 394, column 5. libavformat/matroskaenc.c:381:1: start of procedure mkv_add_cuepoint() 379. } 380. 381. static int mkv_add_cuepoint(mkv_cues *cues, int stream, int64_t ts, int64_t cluster_pos) ^ 382. { 383. int err; libavformat/matroskaenc.c:385:9: Taking false branch 383. int err; 384. 385. if (ts < 0) ^ 386. return 0; 387. libavformat/matroskaenc.c:388:9: 386. return 0; 387. 388. if ((err = av_reallocp_array(&cues->entries, cues->num_entries + 1, ^ 389. sizeof(*cues->entries))) < 0) { 390. cues->num_entries = 0; libavutil/mem.c:167:1: start of procedure av_reallocp_array() 165. } 166. 167. int av_reallocp_array(void *ptr, size_t nmemb, size_t size) ^ 168. { 169. void **ptrptr = ptr; libavutil/mem.c:169:5: 167. int av_reallocp_array(void *ptr, size_t nmemb, size_t size) 168. { 169. void **ptrptr = ptr; ^ 170. void *ret; 171. if (!size || nmemb >= INT_MAX / size) libavutil/mem.c:171:10: Taking false branch 169. void **ptrptr = ptr; 170. void *ret; 171. if (!size || nmemb >= INT_MAX / size) ^ 172. return AVERROR(ENOMEM); 173. if (!nmemb) { libavutil/mem.c:171:18: Taking false branch 169. void **ptrptr = ptr; 170. void *ret; 171. if (!size || nmemb >= INT_MAX / size) ^ 172. return AVERROR(ENOMEM); 173. if (!nmemb) { libavutil/mem.c:173:10: Taking true branch 171. if (!size || nmemb >= INT_MAX / size) 172. return AVERROR(ENOMEM); 173. if (!nmemb) { ^ 174. av_freep(ptr); 175. return 0; libavutil/mem.c:174:9: 172. return AVERROR(ENOMEM); 173. if (!nmemb) { 174. av_freep(ptr); ^ 175. return 0; 176. } libavutil/mem.c:198:1: start of procedure av_freep() 196. } 197. 198. void av_freep(void *arg) ^ 199. { 200. void **ptr = (void **)arg; libavutil/mem.c:200:5: 198. void av_freep(void *arg) 199. { 200. void **ptr = (void **)arg; ^ 201. av_free(*ptr); 202. *ptr = NULL; libavutil/mem.c:201:5: 199. { 200. void **ptr = (void **)arg; 201. av_free(*ptr); ^ 202. *ptr = NULL; 203. } libavutil/mem.c:186:1: start of procedure av_free() 184. } 185. 186. void av_free(void *ptr) ^ 187. { 188. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:194:5: 192. _aligned_free(ptr); 193. #else 194. free(ptr); ^ 195. #endif 196. } libavutil/mem.c:196:1: return from a call to av_free 194. free(ptr); 195. #endif 196. } ^ 197. 198. void av_freep(void *arg) libavutil/mem.c:202:5: 200. void **ptr = (void **)arg; 201. av_free(*ptr); 202. *ptr = NULL; ^ 203. } 204. libavutil/mem.c:203:1: return from a call to av_freep 201. av_free(*ptr); 202. *ptr = NULL; 203. } ^ 204. 205. void *av_mallocz(size_t size) libavutil/mem.c:175:9: 173. if (!nmemb) { 174. av_freep(ptr); 175. return 0; ^ 176. } 177. ret = av_realloc(*ptrptr, nmemb * size); libavutil/mem.c:184:1: return from a call to av_reallocp_array 182. *ptrptr = ret; 183. return 0; 184. } ^ 185. 186. void av_free(void *ptr) libavformat/matroskaenc.c:388:9: Taking false branch 386. return 0; 387. 388. if ((err = av_reallocp_array(&cues->entries, cues->num_entries + 1, ^ 389. sizeof(*cues->entries))) < 0) { 390. cues->num_entries = 0; libavformat/matroskaenc.c:394:5: 392. } 393. 394. cues->entries[cues->num_entries].pts = ts; ^ 395. cues->entries[cues->num_entries].tracknum = stream + 1; 396. cues->entries[cues->num_entries++].cluster_pos = cluster_pos - cues->segment_offset;
https://github.com/libav/libav/blob/558b20d729bc296d8e6a69f03cd509ad26a4827d/libavformat/matroskaenc.c/#L394
d2a_code_trace_data_43136
static int ssl_excert_prepend(SSL_EXCERT **pexc) { SSL_EXCERT *exc = app_malloc(sizeof(*exc), "prepend cert"); memset(exc, 0, sizeof(*exc)); exc->next = *pexc; *pexc = exc; if (exc->next) { exc->certform = exc->next->certform; exc->keyform = exc->next->keyform; exc->next->prev = exc; } else { exc->certform = FORMAT_PEM; exc->keyform = FORMAT_PEM; } return 1; } apps/s_cb.c:906: error: NULL_DEREFERENCE pointer `exc` last assigned on line 904 could be null and is dereferenced by call to `memset()` at line 906, column 5. Showing all 19 steps of the trace apps/s_cb.c:902:1: start of procedure ssl_excert_prepend() 900. } 901. 902. > static int ssl_excert_prepend(SSL_EXCERT **pexc) 903. { 904. SSL_EXCERT *exc = app_malloc(sizeof(*exc), "prepend cert"); apps/s_cb.c:904:5: 902. static int ssl_excert_prepend(SSL_EXCERT **pexc) 903. { 904. > SSL_EXCERT *exc = app_malloc(sizeof(*exc), "prepend cert"); 905. 906. memset(exc, 0, sizeof(*exc)); 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 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 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/s_cb.c:906:5: 904. SSL_EXCERT *exc = app_malloc(sizeof(*exc), "prepend cert"); 905. 906. > memset(exc, 0, sizeof(*exc)); 907. 908. exc->next = *pexc;
https://github.com/openssl/openssl/blob/ce506d27ab5e7d17dfe3fe649768a0d19b6c86ee/apps/s_cb.c/#L906
d2a_code_trace_data_43137
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:948: error: Uninitialized Value The value read from ymin was never initialized. libavcodec/motion_est_template.c:948:13: 946. 947. //check(x - dia_size + dir, y + dir,0, a3) 948. CHECK_MV(x - dia_size + dir, y + dir ); ^ 949. } 950.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L948
d2a_code_trace_data_43138
int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; if (pkt->buf->length > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = (pkt->buf->length == 0) ? DEFAULT_BUF_SIZE : pkt->buf->length * 2; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; pkt->written += len; pkt->curr += len; return 1; } ssl/t1_lib.c:1101: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + `s->srp_ctx.login->strlen` + `s->tlsext_hostname->strlen` + 31]):unsigned64 by call to `WPACKET_start_sub_packet_len`. Showing all 10 steps of the trace ssl/t1_lib.c:1099:14: Call 1097. tls1_get_formatlist(s, &pformats, &num_formats); 1098. 1099. if (!WPACKET_put_bytes(pkt, TLSEXT_TYPE_ec_point_formats, 2) ^ 1100. /* Sub-packet for formats extension */ 1101. || !WPACKET_start_sub_packet_u16(pkt) ssl/packet.c:226:1: Parameter `pkt->buf->length` 224. } 225. 226. > int WPACKET_put_bytes(WPACKET *pkt, unsigned int val, size_t size) 227. { 228. unsigned char *data; ssl/t1_lib.c:1101:21: Call 1099. if (!WPACKET_put_bytes(pkt, TLSEXT_TYPE_ec_point_formats, 2) 1100. /* Sub-packet for formats extension */ 1101. || !WPACKET_start_sub_packet_u16(pkt) ^ 1102. || !WPACKET_sub_memcpy(pkt, pformats, num_formats, 1) 1103. || !WPACKET_close(pkt)) { ssl/packet.c:190:1: Parameter `pkt->written` 188. } 189. 190. > int WPACKET_start_sub_packet_len(WPACKET *pkt, size_t lenbytes) 191. { 192. WPACKET_SUB *sub; ssl/packet.c:214:10: Call 212. } 213. 214. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 215. return 0; 216. sub->packet_len = lenchars - (unsigned char *)pkt->buf->data; ssl/packet.c:15:1: <LHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `pkt->buf->length` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: <RHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `len` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:25:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + pkt->written + s->srp_ctx.login->strlen + s->tlsext_hostname->strlen + 31]):unsigned64 by call to `WPACKET_start_sub_packet_len` 23. return 0; 24. 25. if (pkt->buf->length - pkt->written < len) { ^ 26. size_t newlen; 27.
https://github.com/openssl/openssl/blob/c0f9e23c6b8d1076796987d5a84557d410682d85/ssl/packet.c/#L25
d2a_code_trace_data_43139
int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const int p[], BN_CTX *ctx) { int zlen, i, j, k, ret = 0; BIGNUM *s; BN_ULONG x1, x0, y1, y0, zz[4]; bn_check_top(a); bn_check_top(b); if (a == b) { return BN_GF2m_mod_sqr_arr(r, a, p, ctx); } BN_CTX_start(ctx); if ((s = BN_CTX_get(ctx)) == NULL) goto err; zlen = a->top + b->top + 4; if (!bn_wexpand(s, zlen)) goto err; s->top = zlen; for (i = 0; i < zlen; i++) s->d[i] = 0; for (j = 0; j < b->top; j += 2) { y0 = b->d[j]; y1 = ((j + 1) == b->top) ? 0 : b->d[j + 1]; for (i = 0; i < a->top; i += 2) { x0 = a->d[i]; x1 = ((i + 1) == a->top) ? 0 : a->d[i + 1]; bn_GF2m_mul_2x2(zz, x1, x0, y1, y0); for (k = 0; k < 4; k++) s->d[i + j + k] ^= zz[k]; } } bn_correct_top(s); if (BN_GF2m_mod_arr(r, s, p)) ret = 1; bn_check_top(r); err: BN_CTX_end(ctx); return ret; } crypto/bn/bn_gf2m.c:741: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_GF2m_mod_mul`. Showing all 11 steps of the trace crypto/bn/bn_gf2m.c:735:14: Call 733. /* generate blinding value */ 734. do { 735. if (!BN_priv_rand(b, BN_num_bits(p) - 1, ^ 736. BN_RAND_TOP_ANY, BN_RAND_BOTTOM_ANY)) 737. goto err; crypto/bn/bn_rand.c:123:12: Call 121. int BN_priv_rand(BIGNUM *rnd, int bits, int top, int bottom) 122. { 123. return bnrand(PRIVATE, rnd, bits, top, bottom, NULL); ^ 124. } 125. crypto/bn/bn_rand.c:23:1: Parameter `rnd->top` 21. } BNRAND_FLAG; 22. 23. > static int bnrand(BNRAND_FLAG flag, BIGNUM *rnd, int bits, int top, int bottom, 24. BN_CTX *ctx) 25. { crypto/bn/bn_gf2m.c:741:10: Call 739. 740. /* r := a * b */ 741. if (!BN_GF2m_mod_mul(r, a, b, p, ctx)) ^ 742. goto err; 743. crypto/bn/bn_gf2m.c:465:1: Parameter `*b->d` 463. * BN_GF2m_mod_mul_arr function. 464. */ 465. > int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 466. const BIGNUM *p, BN_CTX *ctx) 467. { crypto/bn/bn_gf2m.c:481:11: Call 479. goto err; 480. } 481. ret = BN_GF2m_mod_mul_arr(r, a, b, arr, ctx); ^ 482. bn_check_top(r); 483. err: crypto/bn/bn_gf2m.c:410:1: <Offset trace> 408. * the result in r. r could be a or b; a could be b. 409. */ 410. > int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 411. const int p[], BN_CTX *ctx) 412. { crypto/bn/bn_gf2m.c:410:1: Parameter `b->top` 408. * the result in r. r could be a or b; a could be b. 409. */ 410. > int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 411. const int p[], BN_CTX *ctx) 412. { crypto/bn/bn_gf2m.c:410:1: <Length trace> 408. * the result in r. r could be a or b; a could be b. 409. */ 410. > int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 411. const int p[], BN_CTX *ctx) 412. { crypto/bn/bn_gf2m.c:410:1: Parameter `*b->d` 408. * the result in r. r could be a or b; a could be b. 409. */ 410. > int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 411. const int p[], BN_CTX *ctx) 412. { crypto/bn/bn_gf2m.c:438:40: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_GF2m_mod_mul` 436. for (j = 0; j < b->top; j += 2) { 437. y0 = b->d[j]; 438. y1 = ((j + 1) == b->top) ? 0 : b->d[j + 1]; ^ 439. for (i = 0; i < a->top; i += 2) { 440. x0 = a->d[i];
https://github.com/openssl/openssl/blob/bd01733fdd9a5a0acdc72cf5c6601d37e8ddd801/crypto/bn/bn_gf2m.c/#L438
d2a_code_trace_data_43140
static int old_hmac_decode(EVP_PKEY *pkey, const unsigned char **pder, int derlen) { ASN1_OCTET_STRING *os; os = ASN1_OCTET_STRING_new(); if (os == NULL || !ASN1_OCTET_STRING_set(os, *pder, derlen)) goto err; if (!EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, os)) goto err; return 1; err: ASN1_OCTET_STRING_free(os); return 0; } crypto/hmac/hm_ameth.c:117: error: MEMORY_LEAK memory dynamically allocated by call to `ASN1_OCTET_STRING_new()` at line 109, column 10 is not reachable after line 117, column 5. Showing all 73 steps of the trace crypto/hmac/hm_ameth.c:105:1: start of procedure old_hmac_decode() 103. */ 104. 105. > static int old_hmac_decode(EVP_PKEY *pkey, 106. const unsigned char **pder, int derlen) 107. { crypto/hmac/hm_ameth.c:109:5: 107. { 108. ASN1_OCTET_STRING *os; 109. > os = ASN1_OCTET_STRING_new(); 110. if (os == NULL || !ASN1_OCTET_STRING_set(os, *pder, derlen)) 111. goto err; crypto/asn1/tasn_typ.c:77:1: start of procedure ASN1_OCTET_STRING_new() 75. } 76. 77. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING) 78. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER) 79. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED) crypto/asn1/asn1_lib.c:349:1: start of procedure ASN1_STRING_type_new() 347. } 348. 349. > ASN1_STRING *ASN1_STRING_type_new(int type) 350. { 351. ASN1_STRING *ret; crypto/asn1/asn1_lib.c:353:5: 351. ASN1_STRING *ret; 352. 353. > ret = OPENSSL_zalloc(sizeof(*ret)); 354. if (ret == NULL) { 355. ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/asn1/asn1_lib.c:354:9: Taking false branch 352. 353. ret = OPENSSL_zalloc(sizeof(*ret)); 354. if (ret == NULL) { ^ 355. ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE); 356. return (NULL); crypto/asn1/asn1_lib.c:358:5: 356. return (NULL); 357. } 358. > ret->type = type; 359. return (ret); 360. } crypto/asn1/asn1_lib.c:359:5: 357. } 358. ret->type = type; 359. > return (ret); 360. } 361. crypto/asn1/asn1_lib.c:360:1: return from a call to ASN1_STRING_type_new 358. ret->type = type; 359. return (ret); 360. > } 361. 362. void ASN1_STRING_free(ASN1_STRING *a) crypto/asn1/tasn_typ.c:77:1: return from a call to ASN1_OCTET_STRING_new 75. } 76. 77. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING) 78. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER) 79. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED) crypto/hmac/hm_ameth.c:110:9: Taking false branch 108. ASN1_OCTET_STRING *os; 109. os = ASN1_OCTET_STRING_new(); 110. if (os == NULL || !ASN1_OCTET_STRING_set(os, *pder, derlen)) ^ 111. goto err; 112. if (!EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, os)) crypto/hmac/hm_ameth.c:110:24: 108. ASN1_OCTET_STRING *os; 109. os = ASN1_OCTET_STRING_new(); 110. > if (os == NULL || !ASN1_OCTET_STRING_set(os, *pder, derlen)) 111. goto err; 112. if (!EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, os)) crypto/asn1/a_octet.c:74:1: start of procedure ASN1_OCTET_STRING_set() 72. } 73. 74. > int ASN1_OCTET_STRING_set(ASN1_OCTET_STRING *x, const unsigned char *d, 75. int len) 76. { crypto/asn1/a_octet.c:77:5: 75. int len) 76. { 77. > return ASN1_STRING_set(x, d, len); 78. } crypto/asn1/asn1_lib.c:308:1: start of procedure ASN1_STRING_set() 306. } 307. 308. > int ASN1_STRING_set(ASN1_STRING *str, const void *_data, int len) 309. { 310. unsigned char *c; crypto/asn1/asn1_lib.c:311:5: 309. { 310. unsigned char *c; 311. > const char *data = _data; 312. 313. if (len < 0) { crypto/asn1/asn1_lib.c:313:9: Taking false branch 311. const char *data = _data; 312. 313. if (len < 0) { ^ 314. if (data == NULL) 315. return (0); crypto/asn1/asn1_lib.c:319:10: Taking true branch 317. len = strlen(data); 318. } 319. if ((str->length < len) || (str->data == NULL)) { ^ 320. c = str->data; 321. str->data = OPENSSL_realloc(c, len + 1); crypto/asn1/asn1_lib.c:320:9: 318. } 319. if ((str->length < len) || (str->data == NULL)) { 320. > c = str->data; 321. str->data = OPENSSL_realloc(c, len + 1); 322. if (str->data == NULL) { crypto/asn1/asn1_lib.c:321:9: 319. if ((str->length < len) || (str->data == NULL)) { 320. c = str->data; 321. > str->data = OPENSSL_realloc(c, len + 1); 322. if (str->data == NULL) { 323. ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE); crypto/mem.c:166:1: start of procedure CRYPTO_realloc() 164. } 165. 166. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) 167. { 168. if (str == NULL) crypto/mem.c:168:9: Taking false branch 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) 167. { 168. if (str == NULL) ^ 169. return CRYPTO_malloc(num, file, line); 170. crypto/mem.c:171:9: Taking false branch 169. return CRYPTO_malloc(num, file, line); 170. 171. if (num == 0) { ^ 172. CRYPTO_free(str); 173. return NULL; crypto/mem.c:176:5: 174. } 175. 176. > allow_customize = 0; 177. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 178. if (call_malloc_debug) { crypto/mem.c:186:5: 184. } 185. #else 186. > (void)file; 187. (void)line; 188. #endif crypto/mem.c:187:5: 185. #else 186. (void)file; 187. > (void)line; 188. #endif 189. return realloc(str, num); crypto/mem.c:189:5: 187. (void)line; 188. #endif 189. > return realloc(str, num); 190. 191. } crypto/mem.c:191:1: return from a call to CRYPTO_realloc 189. return realloc(str, num); 190. 191. > } 192. 193. void *CRYPTO_clear_realloc(void *str, size_t old_len, size_t num, crypto/asn1/asn1_lib.c:322:13: Taking false branch 320. c = str->data; 321. str->data = OPENSSL_realloc(c, len + 1); 322. if (str->data == NULL) { ^ 323. ASN1err(ASN1_F_ASN1_STRING_SET, ERR_R_MALLOC_FAILURE); 324. str->data = c; crypto/asn1/asn1_lib.c:328:5: 326. } 327. } 328. > str->length = len; 329. if (data != NULL) { 330. memcpy(str->data, data, len); crypto/asn1/asn1_lib.c:329:9: Taking true branch 327. } 328. str->length = len; 329. if (data != NULL) { ^ 330. memcpy(str->data, data, len); 331. /* an allowance for strings :-) */ crypto/asn1/asn1_lib.c:330:9: 328. str->length = len; 329. if (data != NULL) { 330. > memcpy(str->data, data, len); 331. /* an allowance for strings :-) */ 332. str->data[len] = '\0'; crypto/asn1/asn1_lib.c:332:9: 330. memcpy(str->data, data, len); 331. /* an allowance for strings :-) */ 332. > str->data[len] = '\0'; 333. } 334. return (1); crypto/asn1/asn1_lib.c:334:5: 332. str->data[len] = '\0'; 333. } 334. > return (1); 335. } 336. crypto/asn1/asn1_lib.c:335:1: return from a call to ASN1_STRING_set 333. } 334. return (1); 335. > } 336. 337. void ASN1_STRING_set0(ASN1_STRING *str, void *data, int len) crypto/asn1/a_octet.c:78:1: return from a call to ASN1_OCTET_STRING_set 76. { 77. return ASN1_STRING_set(x, d, len); 78. > } crypto/hmac/hm_ameth.c:110:24: Taking false branch 108. ASN1_OCTET_STRING *os; 109. os = ASN1_OCTET_STRING_new(); 110. if (os == NULL || !ASN1_OCTET_STRING_set(os, *pder, derlen)) ^ 111. goto err; 112. if (!EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, os)) crypto/hmac/hm_ameth.c:112:10: 110. if (os == NULL || !ASN1_OCTET_STRING_set(os, *pder, derlen)) 111. goto err; 112. > if (!EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, os)) 113. goto err; 114. return 1; crypto/evp/p_lib.c:270:1: start of procedure EVP_PKEY_assign() 268. } 269. 270. > int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key) 271. { 272. if (pkey == NULL || !EVP_PKEY_set_type(pkey, type)) crypto/evp/p_lib.c:272:9: Taking false branch 270. int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key) 271. { 272. if (pkey == NULL || !EVP_PKEY_set_type(pkey, type)) ^ 273. return 0; 274. pkey->pkey.ptr = key; crypto/evp/p_lib.c:272:26: 270. int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key) 271. { 272. > if (pkey == NULL || !EVP_PKEY_set_type(pkey, type)) 273. return 0; 274. pkey->pkey.ptr = key; crypto/evp/p_lib.c:260:1: start of procedure EVP_PKEY_set_type() 258. } 259. 260. > int EVP_PKEY_set_type(EVP_PKEY *pkey, int type) 261. { 262. return pkey_set_type(pkey, type, NULL, -1); crypto/evp/p_lib.c:262:5: Skipping pkey_set_type(): empty list of specs 260. int EVP_PKEY_set_type(EVP_PKEY *pkey, int type) 261. { 262. return pkey_set_type(pkey, type, NULL, -1); ^ 263. } 264. crypto/evp/p_lib.c:263:1: return from a call to EVP_PKEY_set_type 261. { 262. return pkey_set_type(pkey, type, NULL, -1); 263. > } 264. 265. int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len) crypto/evp/p_lib.c:272:26: Taking true branch 270. int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key) 271. { 272. if (pkey == NULL || !EVP_PKEY_set_type(pkey, type)) ^ 273. return 0; 274. pkey->pkey.ptr = key; crypto/evp/p_lib.c:273:9: 271. { 272. if (pkey == NULL || !EVP_PKEY_set_type(pkey, type)) 273. > return 0; 274. pkey->pkey.ptr = key; 275. return (key != NULL); crypto/evp/p_lib.c:276:1: return from a call to EVP_PKEY_assign 274. pkey->pkey.ptr = key; 275. return (key != NULL); 276. > } 277. 278. void *EVP_PKEY_get0(EVP_PKEY *pkey) crypto/hmac/hm_ameth.c:112:10: Taking true branch 110. if (os == NULL || !ASN1_OCTET_STRING_set(os, *pder, derlen)) 111. goto err; 112. if (!EVP_PKEY_assign(pkey, EVP_PKEY_HMAC, os)) ^ 113. goto err; 114. return 1; crypto/hmac/hm_ameth.c:116:2: 114. return 1; 115. 116. > err: 117. ASN1_OCTET_STRING_free(os); 118. return 0; crypto/hmac/hm_ameth.c:117:5: 115. 116. err: 117. > ASN1_OCTET_STRING_free(os); 118. return 0; 119. } crypto/asn1/tasn_typ.c:77:1: start of procedure ASN1_OCTET_STRING_free() 75. } 76. 77. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING) 78. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER) 79. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED) crypto/asn1/asn1_lib.c:362:1: start of procedure ASN1_STRING_free() 360. } 361. 362. > void ASN1_STRING_free(ASN1_STRING *a) 363. { 364. if (a == NULL) crypto/asn1/asn1_lib.c:364:9: Taking false branch 362. void ASN1_STRING_free(ASN1_STRING *a) 363. { 364. if (a == NULL) ^ 365. return; 366. if (!(a->flags & ASN1_STRING_FLAG_NDEF)) crypto/asn1/asn1_lib.c:366:11: Taking false branch 364. if (a == NULL) 365. return; 366. if (!(a->flags & ASN1_STRING_FLAG_NDEF)) ^ 367. OPENSSL_free(a->data); 368. if (!(a->flags & ASN1_STRING_FLAG_EMBED)) crypto/asn1/asn1_lib.c:368:11: Taking false branch 366. if (!(a->flags & ASN1_STRING_FLAG_NDEF)) 367. OPENSSL_free(a->data); 368. if (!(a->flags & ASN1_STRING_FLAG_EMBED)) ^ 369. OPENSSL_free(a); 370. } crypto/asn1/asn1_lib.c:368:5: 366. if (!(a->flags & ASN1_STRING_FLAG_NDEF)) 367. OPENSSL_free(a->data); 368. > if (!(a->flags & ASN1_STRING_FLAG_EMBED)) 369. OPENSSL_free(a); 370. } crypto/asn1/asn1_lib.c:370:1: return from a call to ASN1_STRING_free 368. if (!(a->flags & ASN1_STRING_FLAG_EMBED)) 369. OPENSSL_free(a); 370. > } 371. 372. void ASN1_STRING_clear_free(ASN1_STRING *a) crypto/asn1/tasn_typ.c:77:1: return from a call to ASN1_OCTET_STRING_free 75. } 76. 77. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING) 78. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER) 79. IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/hmac/hm_ameth.c/#L117
d2a_code_trace_data_43141
static int write_begin(URLContext *s) { RTMPContext *rt = s->priv_data; PutByteContext pbc; RTMPPacket spkt = { 0 }; int ret; if ((ret = ff_rtmp_packet_create(&spkt, RTMP_NETWORK_CHANNEL, RTMP_PT_PING, 0, 6)) < 0) { av_log(s, AV_LOG_ERROR, "Unable to create response packet\n"); return ret; } bytestream2_init_writer(&pbc, spkt.data, spkt.size); bytestream2_put_be16(&pbc, 0); bytestream2_put_be32(&pbc, rt->nb_streamid); ret = ff_rtmp_packet_write(rt->stream, &spkt, rt->out_chunk_size, &rt->prev_pkt[1], &rt->nb_prev_pkt[1]); ff_rtmp_packet_destroy(&spkt); return ret; } libavformat/rtmpproto.c:1839: error: Memory Leak memory dynamically allocated to `spkt.data` by call to `ff_rtmp_packet_create()` at line 1823, column 16 is not reachable after line 1839, column 1. libavformat/rtmpproto.c:1815:1: start of procedure write_begin() 1813. } 1814. 1815. static int write_begin(URLContext *s) ^ 1816. { 1817. RTMPContext *rt = s->priv_data; libavformat/rtmpproto.c:1817:5: 1815. static int write_begin(URLContext *s) 1816. { 1817. RTMPContext *rt = s->priv_data; ^ 1818. PutByteContext pbc; 1819. RTMPPacket spkt = { 0 }; libavformat/rtmpproto.c:1819:5: 1817. RTMPContext *rt = s->priv_data; 1818. PutByteContext pbc; 1819. RTMPPacket spkt = { 0 }; ^ 1820. int ret; 1821. libavformat/rtmpproto.c:1823:9: 1821. 1822. // Send Stream Begin 1 1823. if ((ret = ff_rtmp_packet_create(&spkt, RTMP_NETWORK_CHANNEL, ^ 1824. RTMP_PT_PING, 0, 6)) < 0) { 1825. av_log(s, AV_LOG_ERROR, "Unable to create response packet\n"); libavformat/rtmppkt.c:401:1: start of procedure ff_rtmp_packet_create() 399. } 400. 401. int ff_rtmp_packet_create(RTMPPacket *pkt, int channel_id, RTMPPacketType type, ^ 402. int timestamp, int size) 403. { libavformat/rtmppkt.c:404:9: Taking true branch 402. int timestamp, int size) 403. { 404. if (size) { ^ 405. pkt->data = av_realloc(NULL, size); 406. if (!pkt->data) libavformat/rtmppkt.c:405:9: 403. { 404. if (size) { 405. pkt->data = av_realloc(NULL, size); ^ 406. if (!pkt->data) 407. return AVERROR(ENOMEM); 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) libavformat/rtmppkt.c:406:14: Taking false branch 404. if (size) { 405. pkt->data = av_realloc(NULL, size); 406. if (!pkt->data) ^ 407. return AVERROR(ENOMEM); 408. } libavformat/rtmppkt.c:409:5: 407. return AVERROR(ENOMEM); 408. } 409. pkt->size = size; ^ 410. pkt->channel_id = channel_id; 411. pkt->type = type; libavformat/rtmppkt.c:410:5: 408. } 409. pkt->size = size; 410. pkt->channel_id = channel_id; ^ 411. pkt->type = type; 412. pkt->timestamp = timestamp; libavformat/rtmppkt.c:411:5: 409. pkt->size = size; 410. pkt->channel_id = channel_id; 411. pkt->type = type; ^ 412. pkt->timestamp = timestamp; 413. pkt->extra = 0; libavformat/rtmppkt.c:412:5: 410. pkt->channel_id = channel_id; 411. pkt->type = type; 412. pkt->timestamp = timestamp; ^ 413. pkt->extra = 0; 414. pkt->ts_field = 0; libavformat/rtmppkt.c:413:5: 411. pkt->type = type; 412. pkt->timestamp = timestamp; 413. pkt->extra = 0; ^ 414. pkt->ts_field = 0; 415. libavformat/rtmppkt.c:414:5: 412. pkt->timestamp = timestamp; 413. pkt->extra = 0; 414. pkt->ts_field = 0; ^ 415. 416. return 0; libavformat/rtmppkt.c:416:5: 414. pkt->ts_field = 0; 415. 416. return 0; ^ 417. } 418. libavformat/rtmppkt.c:417:1: return from a call to ff_rtmp_packet_create 415. 416. return 0; 417. } ^ 418. 419. void ff_rtmp_packet_destroy(RTMPPacket *pkt) libavformat/rtmpproto.c:1823:9: Taking false branch 1821. 1822. // Send Stream Begin 1 1823. if ((ret = ff_rtmp_packet_create(&spkt, RTMP_NETWORK_CHANNEL, ^ 1824. RTMP_PT_PING, 0, 6)) < 0) { 1825. av_log(s, AV_LOG_ERROR, "Unable to create response packet\n"); libavformat/rtmpproto.c:1829:5: 1827. } 1828. 1829. bytestream2_init_writer(&pbc, spkt.data, spkt.size); ^ 1830. bytestream2_put_be16(&pbc, 0); // 0 -> Stream Begin 1831. bytestream2_put_be32(&pbc, rt->nb_streamid); libavcodec/bytestream.h:141:1: start of procedure bytestream2_init_writer() 139. } 140. 141. static av_always_inline void bytestream2_init_writer(PutByteContext *p, ^ 142. uint8_t *buf, 143. int buf_size) libavcodec/bytestream.h:145:5: 143. int buf_size) 144. { 145. p->buffer = buf; ^ 146. p->buffer_start = buf; 147. p->buffer_end = buf + buf_size; libavcodec/bytestream.h:146:5: 144. { 145. p->buffer = buf; 146. p->buffer_start = buf; ^ 147. p->buffer_end = buf + buf_size; 148. p->eof = 0; libavcodec/bytestream.h:147:5: 145. p->buffer = buf; 146. p->buffer_start = buf; 147. p->buffer_end = buf + buf_size; ^ 148. p->eof = 0; 149. } libavcodec/bytestream.h:148:5: 146. p->buffer_start = buf; 147. p->buffer_end = buf + buf_size; 148. p->eof = 0; ^ 149. } 150. libavcodec/bytestream.h:149:1: return from a call to bytestream2_init_writer 147. p->buffer_end = buf + buf_size; 148. p->eof = 0; 149. } ^ 150. 151. static av_always_inline unsigned int bytestream2_get_bytes_left(GetByteContext *g) libavformat/rtmpproto.c:1830:5: 1828. 1829. bytestream2_init_writer(&pbc, spkt.data, spkt.size); 1830. bytestream2_put_be16(&pbc, 0); // 0 -> Stream Begin ^ 1831. bytestream2_put_be32(&pbc, rt->nb_streamid); 1832. libavcodec/bytestream.h:93:1: start of procedure bytestream2_put_be16() 91. DEF(unsigned int, be32, 4, AV_RB32, AV_WB32) 92. DEF(unsigned int, be24, 3, AV_RB24, AV_WB24) 93. DEF(unsigned int, be16, 2, AV_RB16, AV_WB16) ^ 94. DEF(unsigned int, byte, 1, AV_RB8 , AV_WB8) 95. libavcodec/bytestream.h:93:1: Taking true branch 91. DEF(unsigned int, be32, 4, AV_RB32, AV_WB32) 92. DEF(unsigned int, be24, 3, AV_RB24, AV_WB24) 93. DEF(unsigned int, be16, 2, AV_RB16, AV_WB16) ^ 94. DEF(unsigned int, byte, 1, AV_RB8 , AV_WB8) 95. libavcodec/bytestream.h:93:1: Taking true branch 91. DEF(unsigned int, be32, 4, AV_RB32, AV_WB32) 92. DEF(unsigned int, be24, 3, AV_RB24, AV_WB24) 93. DEF(unsigned int, be16, 2, AV_RB16, AV_WB16) ^ 94. DEF(unsigned int, byte, 1, AV_RB8 , AV_WB8) 95. libavutil/ppc/intreadwrite.h:54:1: start of procedure av_write_bswap16() 52. } 53. 54. static av_always_inline void av_write_bswap16(void *p, uint16_t v) ^ 55. { 56. __asm__ ("sthbrx %1, %y0" : "=Z"(*(uint16_t*)p) : "r"(v)); libavutil/ppc/intreadwrite.h:56:5: Skipping __infer_skip_gcc_asm_stmt(): function or method not found 54. static av_always_inline void av_write_bswap16(void *p, uint16_t v) 55. { 56. __asm__ ("sthbrx %1, %y0" : "=Z"(*(uint16_t*)p) : "r"(v)); ^ 57. } 58. libavutil/ppc/intreadwrite.h:57:1: return from a call to av_write_bswap16 55. { 56. __asm__ ("sthbrx %1, %y0" : "=Z"(*(uint16_t*)p) : "r"(v)); 57. } ^ 58. 59. static av_always_inline uint32_t av_read_bswap32(const void *p) libavcodec/bytestream.h:93:1: return from a call to bytestream2_put_be16 91. DEF(unsigned int, be32, 4, AV_RB32, AV_WB32) 92. DEF(unsigned int, be24, 3, AV_RB24, AV_WB24) 93. DEF(unsigned int, be16, 2, AV_RB16, AV_WB16) ^ 94. DEF(unsigned int, byte, 1, AV_RB8 , AV_WB8) 95. libavformat/rtmpproto.c:1831:5: 1829. bytestream2_init_writer(&pbc, spkt.data, spkt.size); 1830. bytestream2_put_be16(&pbc, 0); // 0 -> Stream Begin 1831. bytestream2_put_be32(&pbc, rt->nb_streamid); ^ 1832. 1833. ret = ff_rtmp_packet_write(rt->stream, &spkt, rt->out_chunk_size, libavcodec/bytestream.h:91:1: start of procedure bytestream2_put_be32() 89. DEF(unsigned int, le16, 2, AV_RL16, AV_WL16) 90. DEF(uint64_t, be64, 8, AV_RB64, AV_WB64) 91. DEF(unsigned int, be32, 4, AV_RB32, AV_WB32) ^ 92. DEF(unsigned int, be24, 3, AV_RB24, AV_WB24) 93. DEF(unsigned int, be16, 2, AV_RB16, AV_WB16) libavcodec/bytestream.h:91:1: Taking true branch 89. DEF(unsigned int, le16, 2, AV_RL16, AV_WL16) 90. DEF(uint64_t, be64, 8, AV_RB64, AV_WB64) 91. DEF(unsigned int, be32, 4, AV_RB32, AV_WB32) ^ 92. DEF(unsigned int, be24, 3, AV_RB24, AV_WB24) 93. DEF(unsigned int, be16, 2, AV_RB16, AV_WB16) libavcodec/bytestream.h:91:1: Taking true branch 89. DEF(unsigned int, le16, 2, AV_RL16, AV_WL16) 90. DEF(uint64_t, be64, 8, AV_RB64, AV_WB64) 91. DEF(unsigned int, be32, 4, AV_RB32, AV_WB32) ^ 92. DEF(unsigned int, be24, 3, AV_RB24, AV_WB24) 93. DEF(unsigned int, be16, 2, AV_RB16, AV_WB16) libavutil/ppc/intreadwrite.h:66:1: start of procedure av_write_bswap32() 64. } 65. 66. static av_always_inline void av_write_bswap32(void *p, uint32_t v) ^ 67. { 68. __asm__ ("stwbrx %1, %y0" : "=Z"(*(uint32_t*)p) : "r"(v)); libavutil/ppc/intreadwrite.h:68:5: Skipping __infer_skip_gcc_asm_stmt(): function or method not found 66. static av_always_inline void av_write_bswap32(void *p, uint32_t v) 67. { 68. __asm__ ("stwbrx %1, %y0" : "=Z"(*(uint32_t*)p) : "r"(v)); ^ 69. } 70. libavutil/ppc/intreadwrite.h:69:1: return from a call to av_write_bswap32 67. { 68. __asm__ ("stwbrx %1, %y0" : "=Z"(*(uint32_t*)p) : "r"(v)); 69. } ^ 70. 71. #if HAVE_LDBRX libavcodec/bytestream.h:91:1: return from a call to bytestream2_put_be32 89. DEF(unsigned int, le16, 2, AV_RL16, AV_WL16) 90. DEF(uint64_t, be64, 8, AV_RB64, AV_WB64) 91. DEF(unsigned int, be32, 4, AV_RB32, AV_WB32) ^ 92. DEF(unsigned int, be24, 3, AV_RB24, AV_WB24) 93. DEF(unsigned int, be16, 2, AV_RB16, AV_WB16) libavformat/rtmpproto.c:1833:5: Skipping ff_rtmp_packet_write(): empty list of specs 1831. bytestream2_put_be32(&pbc, rt->nb_streamid); 1832. 1833. ret = ff_rtmp_packet_write(rt->stream, &spkt, rt->out_chunk_size, ^ 1834. &rt->prev_pkt[1], &rt->nb_prev_pkt[1]); 1835. libavformat/rtmpproto.c:1836:5: 1834. &rt->prev_pkt[1], &rt->nb_prev_pkt[1]); 1835. 1836. ff_rtmp_packet_destroy(&spkt); ^ 1837. 1838. return ret; libavformat/rtmppkt.c:419:1: start of procedure ff_rtmp_packet_destroy() 417. } 418. 419. void ff_rtmp_packet_destroy(RTMPPacket *pkt) ^ 420. { 421. if (!pkt) libavformat/rtmppkt.c:421:10: Taking false branch 419. void ff_rtmp_packet_destroy(RTMPPacket *pkt) 420. { 421. if (!pkt) ^ 422. return; 423. av_freep(&pkt->data); libavformat/rtmppkt.c:423:5: Skipping av_freep(): empty list of specs 421. if (!pkt) 422. return; 423. av_freep(&pkt->data); ^ 424. pkt->size = 0; 425. } libavformat/rtmppkt.c:424:5: 422. return; 423. av_freep(&pkt->data); 424. pkt->size = 0; ^ 425. } 426. libavformat/rtmppkt.c:425:1: return from a call to ff_rtmp_packet_destroy 423. av_freep(&pkt->data); 424. pkt->size = 0; 425. } ^ 426. 427. int ff_amf_tag_size(const uint8_t *data, const uint8_t *data_end) libavformat/rtmpproto.c:1838:5: 1836. ff_rtmp_packet_destroy(&spkt); 1837. 1838. return ret; ^ 1839. } 1840. libavformat/rtmpproto.c:1839:1: return from a call to write_begin 1837. 1838. return ret; 1839. } ^ 1840. 1841. static int write_status(URLContext *s, RTMPPacket *pkt,
https://github.com/libav/libav/blob/4abe3b049d987420eb891f74a35af2cebbf52144/libavformat/rtmpproto.c/#L1839
d2a_code_trace_data_43142
static int opt_metadata(const char *opt, const char *arg) { char *mid= strchr(arg, '='); if(!mid){ fprintf(stderr, "Missing =\n"); ffmpeg_exit(1); } *mid++= 0; av_dict_set(&metadata, arg, mid, 0); return 0; } ffmpeg.c:2841: error: Null Dereference pointer `mid` last assigned on line 2841 could be null and is dereferenced at line 2841, column 5. ffmpeg.c:2833:1: start of procedure opt_metadata() 2831. } 2832. 2833. static int opt_metadata(const char *opt, const char *arg) ^ 2834. { 2835. char *mid= strchr(arg, '='); ffmpeg.c:2835:5: 2833. static int opt_metadata(const char *opt, const char *arg) 2834. { 2835. char *mid= strchr(arg, '='); ^ 2836. 2837. if(!mid){ ffmpeg.c:2837:9: Taking true branch 2835. char *mid= strchr(arg, '='); 2836. 2837. if(!mid){ ^ 2838. fprintf(stderr, "Missing =\n"); 2839. ffmpeg_exit(1); ffmpeg.c:2838:9: 2836. 2837. if(!mid){ 2838. fprintf(stderr, "Missing =\n"); ^ 2839. ffmpeg_exit(1); 2840. } ffmpeg.c:2839:9: Skipping ffmpeg_exit(): empty list of specs 2837. if(!mid){ 2838. fprintf(stderr, "Missing =\n"); 2839. ffmpeg_exit(1); ^ 2840. } 2841. *mid++= 0; ffmpeg.c:2841:5: 2839. ffmpeg_exit(1); 2840. } 2841. *mid++= 0; ^ 2842. 2843. av_dict_set(&metadata, arg, mid, 0);
https://github.com/libav/libav/blob/a6286bda0956bfe15b4e1a9f96e1689666e1d866/ffmpeg.c/#L2841
d2a_code_trace_data_43143
static void vp5_parse_coeff(vp56_context_t *s) { vp56_range_coder_t *c = &s->c; vp56_model_t *model = s->modelp; uint8_t *permute = s->scantable.permutated; uint8_t *model1, *model2; int coeff, sign, coeff_idx; int b, i, cg, idx, ctx, ctx_last; int pt = 0; for (b=0; b<6; b++) { int ct = 1; if (b > 3) pt = 1; ctx = 6*s->coeff_ctx[vp56_b6to4[b]][0] + s->above_blocks[s->above_block_idx[b]].not_null_dc; model1 = model->coeff_dccv[pt]; model2 = model->coeff_dcct[pt][ctx]; for (coeff_idx=0; coeff_idx<64; ) { if (vp56_rac_get_prob(c, model2[0])) { if (vp56_rac_get_prob(c, model2[2])) { if (vp56_rac_get_prob(c, model2[3])) { s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 4; idx = vp56_rac_get_tree(c, vp56_pc_tree, model1); sign = vp56_rac_get(c); coeff = vp56_coeff_bias[idx+5]; for (i=vp56_coeff_bit_length[idx]; i>=0; i--) coeff += vp56_rac_get_prob(c, vp56_coeff_parse_table[idx][i]) << i; } else { if (vp56_rac_get_prob(c, model2[4])) { coeff = 3 + vp56_rac_get_prob(c, model1[5]); s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 3; } else { coeff = 2; s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 2; } sign = vp56_rac_get(c); } ct = 2; } else { ct = 1; s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 1; sign = vp56_rac_get(c); coeff = 1; } coeff = (coeff ^ -sign) + sign; if (coeff_idx) coeff *= s->dequant_ac; s->block_coeff[b][permute[coeff_idx]] = coeff; } else { if (ct && !vp56_rac_get_prob(c, model2[1])) break; ct = 0; s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 0; } cg = vp5_coeff_groups[++coeff_idx]; ctx = s->coeff_ctx[vp56_b6to4[b]][coeff_idx]; model1 = model->coeff_ract[pt][ct][cg]; model2 = cg > 2 ? model1 : model->coeff_acct[pt][ct][cg][ctx]; } ctx_last = FFMIN(s->coeff_ctx_last[vp56_b6to4[b]], 24); s->coeff_ctx_last[vp56_b6to4[b]] = coeff_idx; if (coeff_idx < ctx_last) for (i=coeff_idx; i<=ctx_last; i++) s->coeff_ctx[vp56_b6to4[b]][i] = 5; s->above_blocks[s->above_block_idx[b]].not_null_dc = s->coeff_ctx[vp56_b6to4[b]][0]; } } libavcodec/vp5.c:212: error: Buffer Overrun L1 Offset: [5, +oo] (⇐ [0, +oo] + 5) Size: 2. libavcodec/vp5.c:180:1: <Length trace> 178. } 179. 180. static void vp5_parse_coeff(vp56_context_t *s) ^ 181. { 182. vp56_range_coder_t *c = &s->c; libavcodec/vp5.c:180:1: Parameter `s->modelp->coeff_dccv[*]` 178. } 179. 180. static void vp5_parse_coeff(vp56_context_t *s) ^ 181. { 182. vp56_range_coder_t *c = &s->c; libavcodec/vp5.c:197:9: Assignment 195. ctx = 6*s->coeff_ctx[vp56_b6to4[b]][0] 196. + s->above_blocks[s->above_block_idx[b]].not_null_dc; 197. model1 = model->coeff_dccv[pt]; ^ 198. model2 = model->coeff_dcct[pt][ctx]; 199. libavcodec/vp5.c:212:62: Array access: Offset: [5, +oo] (⇐ [0, +oo] + 5) Size: 2 210. } else { 211. if (vp56_rac_get_prob(c, model2[4])) { 212. coeff = 3 + vp56_rac_get_prob(c, model1[5]); ^ 213. s->coeff_ctx[vp56_b6to4[b]][coeff_idx] = 3; 214. } else {
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/vp5.c/#L212
d2a_code_trace_data_43144
static void new_subtitle_stream(AVFormatContext *oc, int file_idx) { AVStream *st; AVOutputStream *ost; AVCodec *codec=NULL; AVCodecContext *subtitle_enc; enum CodecID codec_id = CODEC_ID_NONE; st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); if (!st) { fprintf(stderr, "Could not alloc stream\n"); ffmpeg_exit(1); } ost = new_output_stream(oc, file_idx); subtitle_enc = st->codec; output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); if(!subtitle_stream_copy){ if (subtitle_codec_name) { codec_id = find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 1, avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->strict_std_compliance); codec= output_codecs[nb_output_codecs-1] = avcodec_find_encoder_by_name(subtitle_codec_name); } else { codec_id = av_guess_codec(oc->oformat, NULL, oc->filename, NULL, AVMEDIA_TYPE_SUBTITLE); codec = avcodec_find_encoder(codec_id); } } avcodec_get_context_defaults3(st->codec, codec); ost->bitstream_filters = subtitle_bitstream_filters; subtitle_bitstream_filters= NULL; subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE; if(subtitle_codec_tag) subtitle_enc->codec_tag= subtitle_codec_tag; if (oc->oformat->flags & AVFMT_GLOBALHEADER) { subtitle_enc->flags |= CODEC_FLAG_GLOBAL_HEADER; avcodec_opts[AVMEDIA_TYPE_SUBTITLE]->flags |= CODEC_FLAG_GLOBAL_HEADER; } if (subtitle_stream_copy) { st->stream_copy = 1; } else { subtitle_enc->codec_id = codec_id; set_context_opts(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM, codec); } if (subtitle_language) { av_metadata_set2(&st->metadata, "language", subtitle_language, 0); av_freep(&subtitle_language); } subtitle_disable = 0; av_freep(&subtitle_codec_name); subtitle_stream_copy = 0; } ffmpeg.c:3598: error: Null Dereference pointer `st` last assigned on line 3592 could be null and is dereferenced at line 3598, column 20. ffmpeg.c:3584:1: start of procedure new_subtitle_stream() 3582. } 3583. 3584. static void new_subtitle_stream(AVFormatContext *oc, int file_idx) ^ 3585. { 3586. AVStream *st; ffmpeg.c:3588:5: 3586. AVStream *st; 3587. AVOutputStream *ost; 3588. AVCodec *codec=NULL; ^ 3589. AVCodecContext *subtitle_enc; 3590. enum CodecID codec_id = CODEC_ID_NONE; ffmpeg.c:3590:5: 3588. AVCodec *codec=NULL; 3589. AVCodecContext *subtitle_enc; 3590. enum CodecID codec_id = CODEC_ID_NONE; ^ 3591. 3592. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); ffmpeg.c:3592:28: Condition is true 3590. enum CodecID codec_id = CODEC_ID_NONE; 3591. 3592. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); ^ 3593. if (!st) { 3594. fprintf(stderr, "Could not alloc stream\n"); ffmpeg.c:3592:5: 3590. enum CodecID codec_id = CODEC_ID_NONE; 3591. 3592. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); ^ 3593. if (!st) { 3594. fprintf(stderr, "Could not alloc stream\n"); libavformat/utils.c:2627:1: start of procedure av_new_stream() 2625. } 2626. 2627. AVStream *av_new_stream(AVFormatContext *s, int id) ^ 2628. { 2629. AVStream *st; libavformat/utils.c:2633:9: Taking true branch 2631. 2632. #if FF_API_MAX_STREAMS 2633. if (s->nb_streams >= MAX_STREAMS){ ^ 2634. av_log(s, AV_LOG_ERROR, "Too many streams\n"); 2635. return NULL; libavformat/utils.c:2634:9: Skipping av_log(): empty list of specs 2632. #if FF_API_MAX_STREAMS 2633. if (s->nb_streams >= MAX_STREAMS){ 2634. av_log(s, AV_LOG_ERROR, "Too many streams\n"); ^ 2635. return NULL; 2636. } libavformat/utils.c:2635:9: 2633. if (s->nb_streams >= MAX_STREAMS){ 2634. av_log(s, AV_LOG_ERROR, "Too many streams\n"); 2635. return NULL; ^ 2636. } 2637. #else libavformat/utils.c:2684:1: return from a call to av_new_stream 2682. s->streams[s->nb_streams++] = st; 2683. return st; 2684. } ^ 2685. 2686. AVProgram *av_new_program(AVFormatContext *ac, int id) ffmpeg.c:3593:10: Taking true branch 3591. 3592. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); 3593. if (!st) { ^ 3594. fprintf(stderr, "Could not alloc stream\n"); 3595. ffmpeg_exit(1); ffmpeg.c:3594:9: 3592. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); 3593. if (!st) { 3594. fprintf(stderr, "Could not alloc stream\n"); ^ 3595. ffmpeg_exit(1); 3596. } ffmpeg.c:3595:9: Skipping ffmpeg_exit(): empty list of specs 3593. if (!st) { 3594. fprintf(stderr, "Could not alloc stream\n"); 3595. ffmpeg_exit(1); ^ 3596. } 3597. ost = new_output_stream(oc, file_idx); ffmpeg.c:3597:5: Skipping new_output_stream(): empty list of specs 3595. ffmpeg_exit(1); 3596. } 3597. ost = new_output_stream(oc, file_idx); ^ 3598. subtitle_enc = st->codec; 3599. output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); ffmpeg.c:3598:5: 3596. } 3597. ost = new_output_stream(oc, file_idx); 3598. subtitle_enc = st->codec; ^ 3599. output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); 3600. if(!subtitle_stream_copy){
https://github.com/libav/libav/blob/f4c79d1e0b2e797012304db57903e4091b0c2d7c/ffmpeg.c/#L3598
d2a_code_trace_data_43145
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:689: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 657, column 9 is not reachable after line 689, column 5. Showing all 158 steps of the trace test/bntest.c:647:1: start of procedure test_mul() 645. } 646. 647. > int test_mul(BIO *bp) 648. { 649. BIGNUM *a, *b, *c, *d, *e; test/bntest.c:653:5: 651. BN_CTX *ctx; 652. 653. > ctx = BN_CTX_new(); 654. if (ctx == NULL) 655. 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:654:9: Taking false branch 652. 653. ctx = BN_CTX_new(); 654. if (ctx == NULL) ^ 655. EXIT(1); 656. test/bntest.c:657:5: 655. EXIT(1); 656. 657. > a = BN_new(); 658. b = BN_new(); 659. 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:658:5: 656. 657. a = BN_new(); 658. > b = BN_new(); 659. c = BN_new(); 660. 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:659:5: 657. a = BN_new(); 658. b = BN_new(); 659. > c = BN_new(); 660. d = BN_new(); 661. 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:660:5: 658. b = BN_new(); 659. c = BN_new(); 660. > d = BN_new(); 661. e = BN_new(); 662. 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:661:5: 659. c = BN_new(); 660. d = BN_new(); 661. > e = BN_new(); 662. 663. 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:663:10: 661. e = BN_new(); 662. 663. > for (i = 0; i < num0 + num1; i++) { 664. if (i <= num1) { 665. BN_bntest_rand(a, 100, 0, 0); test/bntest.c:663:17: Loop condition is false. Leaving loop 661. e = BN_new(); 662. 663. for (i = 0; i < num0 + num1; i++) { ^ 664. if (i <= num1) { 665. BN_bntest_rand(a, 100, 0, 0); test/bntest.c:689:5: 687. } 688. } 689. > BN_free(a); 690. BN_free(b); 691. 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)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L689
d2a_code_trace_data_43146
static int epzs_motion_search4(MpegEncContext * s, int *mx_ptr, int *my_ptr, int P[10][2], int src_index, int ref_index, int16_t (*last_mv)[2], int ref_mv_scale) { MotionEstContext * const c= &s->me; int best[2]={0, 0}; int d, dmin; int map_generation; const int penalty_factor= c->penalty_factor; const int size=1; const int h=8; const int ref_mv_stride= s->mb_stride; const int ref_mv_xy= s->mb_x + s->mb_y *ref_mv_stride; me_cmp_func cmpf, chroma_cmpf; LOAD_COMMON int flags= c->flags; LOAD_COMMON2 cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; map_generation= update_map_generation(c); dmin = 1000000; if (s->first_slice_line) { CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift) }else{ CHECK_MV(P_MV1[0]>>shift, P_MV1[1]>>shift) CHECK_MV(P_MEDIAN[0]>>shift, P_MEDIAN[1]>>shift) CHECK_MV(P_LEFT[0]>>shift, P_LEFT[1]>>shift) CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift) CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) } if(dmin>64*4){ CHECK_CLIPPED_MV((last_mv[ref_mv_xy+1][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+1][1]*ref_mv_scale + (1<<15))>>16) if(s->mb_y+1<s->end_mb_y) CHECK_CLIPPED_MV((last_mv[ref_mv_xy+ref_mv_stride][0]*ref_mv_scale + (1<<15))>>16, (last_mv[ref_mv_xy+ref_mv_stride][1]*ref_mv_scale + (1<<15))>>16) } dmin= diamond_search(s, best, dmin, src_index, ref_index, penalty_factor, size, h, flags); *mx_ptr= best[0]; *my_ptr= best[1]; return dmin; } libavcodec/motion_est_template.c:1170: error: Uninitialized Value The value read from xmin was never initialized. libavcodec/motion_est_template.c:1170:9: 1168. CHECK_MV(P_TOP[0]>>shift, P_TOP[1]>>shift) 1169. CHECK_MV(P_TOPRIGHT[0]>>shift, P_TOPRIGHT[1]>>shift) 1170. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, ^ 1171. (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16) 1172. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1170
d2a_code_trace_data_43147
static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, OPENSSL_LH_DOALL_FUNC func, OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) { int i; OPENSSL_LH_NODE *a, *n; if (lh == NULL) return; for (i = lh->num_nodes - 1; i >= 0; i--) { a = lh->b[i]; while (a != NULL) { n = a->next; if (use_arg) func_arg(a->data, arg); else func(a->data); a = n; } } } apps/s_time.c:264: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `SSL_free`. Showing all 17 steps of the trace apps/s_time.c:231:21: Call 229. break; 230. 231. if ((scon = doConnection(NULL, host, ctx)) == NULL) ^ 232. goto end; 233. apps/s_time.c:385:21: Call 383. 384. if (scon == NULL) 385. serverCon = SSL_new(ctx); ^ 386. else { 387. serverCon = scon; ssl/ssl_lib.c:518:1: Parameter `ctx->sessions->num_nodes` 516. } 517. 518. > SSL *SSL_new(SSL_CTX *ctx) 519. { 520. SSL *s; apps/s_time.c:264:9: Call 262. fflush(stdout); 263. 264. SSL_free(scon); ^ 265. scon = NULL; 266. } ssl/ssl_lib.c:926:1: Parameter `s->ctx->sessions->num_nodes` 924. } 925. 926. > void SSL_free(SSL *s) 927. { 928. int i; ssl/ssl_lib.c:998:5: Call 996. RECORD_LAYER_release(&s->rlayer); 997. 998. SSL_CTX_free(s->ctx); ^ 999. 1000. ASYNC_WAIT_CTX_free(s->waitctx); ssl/ssl_lib.c:2429:1: Parameter `a->sessions->num_nodes` 2427. } 2428. 2429. > void SSL_CTX_free(SSL_CTX *a) 2430. { 2431. int i; ssl/ssl_lib.c:2455:9: Call 2453. */ 2454. if (a->sessions != NULL) 2455. SSL_CTX_flush_sessions(a, 0); ^ 2456. 2457. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:974:1: Parameter `s->sessions->num_nodes` 972. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 973. 974. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 975. { 976. unsigned long i; ssl/ssl_sess.c:987:5: Call 985. i = lh_SSL_SESSION_get_down_load(s->sessions); 986. lh_SSL_SESSION_set_down_load(s->sessions, 0); 987. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp); ^ 988. lh_SSL_SESSION_set_down_load(s->sessions, i); 989. CRYPTO_THREAD_unlock(s->lock); ssl/ssl_sess.c:972:1: Parameter `lh->num_nodes` 970. } 971. 972. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 973. 974. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) ssl/ssl_sess.c:972:1: Call 970. } 971. 972. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 973. 974. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) crypto/lhash/lhash.c:182:1: Parameter `lh->num_nodes` 180. } 181. 182. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); crypto/lhash/lhash.c:184:5: Call 182. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); ^ 185. } 186. crypto/lhash/lhash.c:150:1: <LHS trace> 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:150:1: Parameter `lh->num_nodes` 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:164:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `SSL_free` 162. * memory leaks otherwise 163. */ 164. for (i = lh->num_nodes - 1; i >= 0; i--) { ^ 165. a = lh->b[i]; 166. while (a != NULL) {
https://github.com/openssl/openssl/blob/2a7de0fd5d9baf946ef4d2c51096b04dd47a8143/crypto/lhash/lhash.c/#L164
d2a_code_trace_data_43148
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_variables.c:1539: error: Buffer Overrun L2 Offset: [0, 65535] Size: 20 by call to `ngx_sprintf`. src/http/ngx_http_variables.c:1534:9: Call 1532. u_char *p; 1533. 1534. p = ngx_pnalloc(r->pool, NGX_INT64_LEN); ^ 1535. if (p == NULL) { 1536. return NGX_ERROR; src/core/ngx_palloc.c:155:13: Assignment 153. 154. do { 155. m = p->d.last; ^ 156. 157. if ((size_t) (p->d.end - m) >= size) { src/core/ngx_palloc.c:160:17: Assignment 158. p->d.last = m + size; 159. 160. return m; ^ 161. } 162. src/http/ngx_http_variables.c:1534:5: Assignment 1532. u_char *p; 1533. 1534. p = ngx_pnalloc(r->pool, NGX_INT64_LEN); ^ 1535. if (p == NULL) { 1536. return NGX_ERROR; src/http/ngx_http_variables.c:1539:14: Call 1537. } 1538. 1539. v->len = ngx_sprintf(p, "%P", ngx_pid) - p; ^ 1540. v->valid = 1; 1541. v->no_cacheable = 0; src/core/ngx_string.c:95:1: Parameter `*buf` 93. 94. 95. u_char * ngx_cdecl ^ 96. ngx_sprintf(u_char *buf, const char *fmt, ...) 97. { src/core/ngx_string.c:102:9: Call 100. 101. va_start(args, fmt); 102. p = ngx_vsnprintf(buf, /* STUB */ 65536, fmt, args); ^ 103. va_end(args); 104. src/core/ngx_string.c:123:1: <Length trace> 121. 122. 123. u_char * ^ 124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) 125. { src/core/ngx_string.c:123:1: Parameter `*buf` 121. 122. 123. u_char * ^ 124. ngx_vsnprintf(u_char *buf, size_t max, const char *fmt, va_list args) 125. { src/core/ngx_string.c:244:25: Array access: Offset: [0, 65535] Size: 20 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_43149
static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, OPENSSL_LH_DOALL_FUNC func, OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) { int i; OPENSSL_LH_NODE *a, *n; if (lh == NULL) return; for (i = lh->num_nodes - 1; i >= 0; i--) { a = lh->b[i]; while (a != NULL) { n = a->next; if (use_arg) func_arg(a->data, arg); else func(a->data); a = n; } } } test/sslcorrupttest.c:169: error: INTEGER_OVERFLOW_L2 ([0, 8] - 1):unsigned32 by call to `SSL_free`. Showing all 18 steps of the trace test/sslcorrupttest.c:144:11: Call 142. int i, numciphers; 143. 144. ctx = SSL_CTX_new(TLS_server_method()); ^ 145. TEST_check(ctx != NULL); 146. ssl = SSL_new(ctx); ssl/ssl_lib.c:2470:21: Call 2468. goto err; 2469. 2470. ret->sessions = lh_SSL_SESSION_new(ssl_session_hash, ssl_session_cmp); ^ 2471. if (ret->sessions == NULL) 2472. goto err; ssl/ssl_locl.h:602:1: Call 600. }; 601. 602. > DEFINE_LHASH_OF(SSL_SESSION); 603. /* Needed in ssl_cert.c */ 604. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:37:5: Assignment 35. ret->comp = ((c == NULL) ? (OPENSSL_LH_COMPFUNC)strcmp : c); 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; test/sslcorrupttest.c:169:5: Call 167. 168. sk_SSL_CIPHER_free(sk_ciphers); 169. SSL_free(ssl); ^ 170. SSL_CTX_free(ctx); 171. ssl/ssl_lib.c:961:1: Parameter `s->ctx->sessions->num_nodes` 959. } 960. 961. > void SSL_free(SSL *s) 962. { 963. int i; ssl/ssl_lib.c:1026:5: Call 1024. RECORD_LAYER_release(&s->rlayer); 1025. 1026. SSL_CTX_free(s->ctx); ^ 1027. 1028. ASYNC_WAIT_CTX_free(s->waitctx); ssl/ssl_lib.c:2581:1: Parameter `a->sessions->num_nodes` 2579. } 2580. 2581. > void SSL_CTX_free(SSL_CTX *a) 2582. { 2583. int i; ssl/ssl_lib.c:2607:9: Call 2605. */ 2606. if (a->sessions != NULL) 2607. SSL_CTX_flush_sessions(a, 0); ^ 2608. 2609. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:991:1: Parameter `s->sessions->num_nodes` 989. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 990. 991. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 992. { 993. unsigned long i; ssl/ssl_sess.c:1004:5: Call 1002. i = lh_SSL_SESSION_get_down_load(s->sessions); 1003. lh_SSL_SESSION_set_down_load(s->sessions, 0); 1004. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp); ^ 1005. lh_SSL_SESSION_set_down_load(s->sessions, i); 1006. CRYPTO_THREAD_unlock(s->lock); ssl/ssl_sess.c:989:1: Parameter `lh->num_nodes` 987. } 988. 989. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 990. 991. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) ssl/ssl_sess.c:989:1: Call 987. } 988. 989. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 990. 991. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) crypto/lhash/lhash.c:182:1: Parameter `lh->num_nodes` 180. } 181. 182. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); crypto/lhash/lhash.c:184:5: Call 182. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); ^ 185. } 186. crypto/lhash/lhash.c:150:1: <LHS trace> 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:150:1: Parameter `lh->num_nodes` 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:164:10: Binary operation: ([0, 8] - 1):unsigned32 by call to `SSL_free` 162. * memory leaks otherwise 163. */ 164. for (i = lh->num_nodes - 1; i >= 0; i--) { ^ 165. a = lh->b[i]; 166. while (a != NULL) {
https://github.com/openssl/openssl/blob/6a69e8694af23dae1d1927813932f4296d133416/crypto/lhash/lhash.c/#L164
d2a_code_trace_data_43150
static int avi_read_idx1(AVFormatContext *s, int size) { AVIContext *avi = s->priv_data; ByteIOContext *pb = s->pb; int nb_index_entries, i; AVStream *st; AVIStream *ast; unsigned int index, tag, flags, pos, len; unsigned last_pos= -1; nb_index_entries = size / 16; if (nb_index_entries <= 0) return -1; for(i = 0; i < nb_index_entries; i++) { tag = get_le32(pb); flags = get_le32(pb); pos = get_le32(pb); len = get_le32(pb); #if defined(DEBUG_SEEK) av_log(NULL, AV_LOG_DEBUG, "%d: tag=0x%x flags=0x%x pos=0x%x len=%d/", i, tag, flags, pos, len); #endif if(i==0 && pos > avi->movi_list) avi->movi_list= 0; pos += avi->movi_list; index = ((tag & 0xff) - '0') * 10; index += ((tag >> 8) & 0xff) - '0'; if (index >= s->nb_streams) continue; st = s->streams[index]; ast = st->priv_data; #if defined(DEBUG_SEEK) av_log(NULL, AV_LOG_DEBUG, "%d cum_len=%"PRId64"\n", len, ast->cum_len); #endif if(last_pos == pos) avi->non_interleaved= 1; else av_add_index_entry(st, pos, ast->cum_len / FFMAX(1, ast->sample_size), len, 0, (flags&AVIIF_INDEX) ? AVINDEX_KEYFRAME : 0); if(ast->sample_size) ast->cum_len += len; else ast->cum_len ++; last_pos= pos; } return 0; } libavformat/avidec.c:603: error: Buffer Overrun L2 Offset: [-528, 2277] Size: 20 by call to `avi_load_index`. libavformat/avidec.c:227:1: Parameter `s->nb_streams` 225. } 226. 227. static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) ^ 228. { 229. AVIContext *avi = s->priv_data; libavformat/avidec.c:603:9: Call 601. 602. if(!avi->index_loaded && !url_is_streamed(pb)) 603. avi_load_index(s); ^ 604. avi->index_loaded = 1; 605. avi->non_interleaved |= guess_ni_flag(s); libavformat/avidec.c:927:1: Parameter `s->nb_streams` 925. } 926. 927. static int avi_load_index(AVFormatContext *s) ^ 928. { 929. AVIContext *avi = s->priv_data; libavformat/avidec.c:953:17: Call 951. switch(tag) { 952. case MKTAG('i', 'd', 'x', '1'): 953. if (avi_read_idx1(s, size) < 0) ^ 954. goto skip; 955. else libavformat/avidec.c:856:1: <Offset trace> 854. /* XXX: we make the implicit supposition that the position are sorted 855. for each stream */ 856. static int avi_read_idx1(AVFormatContext *s, int size) ^ 857. { 858. AVIContext *avi = s->priv_data; libavformat/avidec.c:856:1: Parameter `s->nb_streams` 854. /* XXX: we make the implicit supposition that the position are sorted 855. for each stream */ 856. static int avi_read_idx1(AVFormatContext *s, int size) ^ 857. { 858. AVIContext *avi = s->priv_data; libavformat/avidec.c:856:1: <Length trace> 854. /* XXX: we make the implicit supposition that the position are sorted 855. for each stream */ 856. static int avi_read_idx1(AVFormatContext *s, int size) ^ 857. { 858. AVIContext *avi = s->priv_data; libavformat/avidec.c:856:1: Parameter `s->streams[*]` 854. /* XXX: we make the implicit supposition that the position are sorted 855. for each stream */ 856. static int avi_read_idx1(AVFormatContext *s, int size) ^ 857. { 858. AVIContext *avi = s->priv_data; libavformat/avidec.c:888:14: Array access: Offset: [-528, 2277] Size: 20 by call to `avi_load_index` 886. if (index >= s->nb_streams) 887. continue; 888. st = s->streams[index]; ^ 889. ast = st->priv_data; 890.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/avidec.c/#L888
d2a_code_trace_data_43151
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/ec/curve25519.c:4622: error: INTEGER_OVERFLOW_L2 (128 - [1, 253]):unsigned64 by call to `SHA512_Update`. Showing all 10 steps of the trace crypto/ec/curve25519.c:4619:3: Call 4617. ge_p3_tobytes(out_sig, &R); 4618. 4619. SHA512_Init(&hash_ctx); ^ 4620. SHA512_Update(&hash_ctx, out_sig, 32); 4621. SHA512_Update(&hash_ctx, public_key, 32); crypto/sha/sha512.c:94:5: Assignment 92. c->Nl = 0; 93. c->Nh = 0; 94. c->num = 0; ^ 95. c->md_len = SHA512_DIGEST_LENGTH; 96. return 1; crypto/ec/curve25519.c:4620:3: Call 4618. 4619. SHA512_Init(&hash_ctx); 4620. SHA512_Update(&hash_ctx, out_sig, 32); ^ 4621. SHA512_Update(&hash_ctx, public_key, 32); 4622. SHA512_Update(&hash_ctx, message, message_len); crypto/sha/sha512.c:188:1: Parameter `c->num` 186. } 187. 188. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len) 189. { 190. SHA_LONG64 l; crypto/ec/curve25519.c:4621:3: Call 4619. SHA512_Init(&hash_ctx); 4620. SHA512_Update(&hash_ctx, out_sig, 32); 4621. SHA512_Update(&hash_ctx, public_key, 32); ^ 4622. SHA512_Update(&hash_ctx, message, message_len); 4623. SHA512_Final(hram, &hash_ctx); crypto/sha/sha512.c:188:1: Parameter `c->num` 186. } 187. 188. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len) 189. { 190. SHA_LONG64 l; crypto/ec/curve25519.c:4622:3: Call 4620. SHA512_Update(&hash_ctx, out_sig, 32); 4621. SHA512_Update(&hash_ctx, public_key, 32); 4622. SHA512_Update(&hash_ctx, message, message_len); ^ 4623. SHA512_Final(hram, &hash_ctx); 4624. crypto/sha/sha512.c:188:1: <RHS trace> 186. } 187. 188. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len) 189. { 190. SHA_LONG64 l; crypto/sha/sha512.c:188:1: Parameter `c->num` 186. } 187. 188. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len) 189. { 190. SHA_LONG64 l; crypto/sha/sha512.c:205:9: Binary operation: (128 - [1, 253]):unsigned64 by call to `SHA512_Update` 203. 204. if (c->num != 0) { 205. size_t n = sizeof(c->u) - c->num; ^ 206. 207. if (len < n) {
https://github.com/openssl/openssl/blob/04dec1ab34df70c1588d42cc394e8fa8b5f3191c/crypto/sha/sha512.c/#L205
d2a_code_trace_data_43152
BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n) { BN_ULONG t1,t2; int c=0; assert(n >= 0); if (n <= 0) return((BN_ULONG)0); #ifndef OPENSSL_SMALL_FOOTPRINT while (n&~3) { t1=a[0]; t2=b[0]; r[0]=(t1-t2-c)&BN_MASK2; if (t1 != t2) c=(t1 < t2); t1=a[1]; t2=b[1]; r[1]=(t1-t2-c)&BN_MASK2; if (t1 != t2) c=(t1 < t2); t1=a[2]; t2=b[2]; r[2]=(t1-t2-c)&BN_MASK2; if (t1 != t2) c=(t1 < t2); t1=a[3]; t2=b[3]; r[3]=(t1-t2-c)&BN_MASK2; if (t1 != t2) c=(t1 < t2); a+=4; b+=4; r+=4; n-=4; } #endif while (n) { t1=a[0]; t2=b[0]; r[0]=(t1-t2-c)&BN_MASK2; if (t1 != t2) c=(t1 < t2); a++; b++; r++; n--; } return(c); } crypto/bn/bn_exp.c:733: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, max(4294967295, `*in_mont->N.d`)]):unsigned32 by call to `BN_mod_mul_montgomery`. Showing all 13 steps of the trace crypto/bn/bn_exp.c:625:1: Parameter `*in_mont->N.d` 623. * http://www.daemonology.net/hyperthreading-considered-harmful/) 624. */ 625. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 626. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 627. { crypto/bn/bn_exp.c:733:12: Call 731. if (!BN_to_montgomery(&am,&am,mont,ctx)) goto err; 732. } 733. else if (!BN_to_montgomery(&am,a,mont,ctx)) goto err; ^ 734. 735. #if defined(OPENSSL_BN_ASM_MONT) && (defined(__sparc__) || defined(__sparc)) crypto/bn/bn_mont.c:131:1: Parameter `*mont->N.d` 129. #endif 130. 131. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 132. BN_MONT_CTX *mont, BN_CTX *ctx) 133. { crypto/bn/bn_mont.c:167:7: Call 165. /* reduce from aRR to aR */ 166. #ifdef MONT_WORD 167. if (!BN_from_montgomery_word(r,tmp,mont)) goto err; ^ 168. #else 169. if (!BN_from_montgomery(r,tmp,mont,ctx)) goto err; crypto/bn/bn_mont.c:179:1: Parameter `*r->d` 177. 178. #ifdef MONT_WORD 179. > static int BN_from_montgomery_word(BIGNUM *ret, BIGNUM *r, BN_MONT_CTX *mont) 180. { 181. BIGNUM *n; crypto/bn/bn_mont.c:247:4: Call 245. size_t m; 246. 247. v=bn_sub_words(rp,ap,np,nl)-carry; ^ 248. /* if subtraction result is real, then 249. * trick unconditional memcpy below to perform in-place crypto/bn/bn_asm.c:394:1: <LHS trace> 392. #endif /* !BN_LLONG */ 393. 394. > BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n) 395. { 396. BN_ULONG t1,t2; crypto/bn/bn_asm.c:394:1: Parameter `*a` 392. #endif /* !BN_LLONG */ 393. 394. > BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n) 395. { 396. BN_ULONG t1,t2; crypto/bn/bn_asm.c:405:3: Assignment 403. while (n&~3) 404. { 405. t1=a[0]; t2=b[0]; ^ 406. r[0]=(t1-t2-c)&BN_MASK2; 407. if (t1 != t2) c=(t1 < t2); crypto/bn/bn_asm.c:394:1: <RHS trace> 392. #endif /* !BN_LLONG */ 393. 394. > BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n) 395. { 396. BN_ULONG t1,t2; crypto/bn/bn_asm.c:394:1: Parameter `*b` 392. #endif /* !BN_LLONG */ 393. 394. > BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, int n) 395. { 396. BN_ULONG t1,t2; crypto/bn/bn_asm.c:405:12: Assignment 403. while (n&~3) 404. { 405. t1=a[0]; t2=b[0]; ^ 406. r[0]=(t1-t2-c)&BN_MASK2; 407. if (t1 != t2) c=(t1 < t2); crypto/bn/bn_asm.c:406:3: Binary operation: ([0, +oo] - [0, max(4294967295, *in_mont->N.d)]):unsigned32 by call to `BN_mod_mul_montgomery` 404. { 405. t1=a[0]; t2=b[0]; 406. r[0]=(t1-t2-c)&BN_MASK2; ^ 407. if (t1 != t2) c=(t1 < t2); 408. t1=a[1]; t2=b[1];
https://github.com/openssl/openssl/blob/a9d14832fd98cb0c13b53fddea39765fb259358c/crypto/bn/bn_asm.c/#L406
d2a_code_trace_data_43153
static int drbg_bytes(unsigned char *out, int count) { DRBG_CTX *dctx = RAND_DRBG_get_default(); int ret = 0; CRYPTO_THREAD_write_lock(dctx->lock); do { size_t rcnt; if (count > (int)dctx->max_request) rcnt = dctx->max_request; else rcnt = count; ret = RAND_DRBG_generate(dctx, out, rcnt, 0, NULL, 0); if (!ret) goto err; out += rcnt; count -= rcnt; } while (count); ret = 1; err: CRYPTO_THREAD_unlock(dctx->lock); return ret; } crypto/rand/drbg_rand.c:396: error: NULL_DEREFERENCE pointer `dctx` last assigned on line 393 could be null and is dereferenced at line 396, column 30. Showing all 14 steps of the trace crypto/rand/drbg_rand.c:391:1: start of procedure drbg_bytes() 389. } 390. 391. > static int drbg_bytes(unsigned char *out, int count) 392. { 393. DRBG_CTX *dctx = RAND_DRBG_get_default(); crypto/rand/drbg_rand.c:393:5: 391. static int drbg_bytes(unsigned char *out, int count) 392. { 393. > DRBG_CTX *dctx = RAND_DRBG_get_default(); 394. int ret = 0; 395. crypto/rand/drbg_rand.c:384:1: start of procedure RAND_DRBG_get_default() 382. */ 383. 384. > DRBG_CTX *RAND_DRBG_get_default(void) 385. { 386. if (!RUN_ONCE(&ossl_drbg_init, do_ossl_drbg_init)) crypto/rand/drbg_rand.c:386:10: 384. DRBG_CTX *RAND_DRBG_get_default(void) 385. { 386. > if (!RUN_ONCE(&ossl_drbg_init, do_ossl_drbg_init)) 387. return NULL; 388. return &ossl_drbg; crypto/threads_pthread.c:105:1: start of procedure CRYPTO_THREAD_run_once() 103. } 104. 105. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 106. { 107. if (pthread_once(once, init) != 0) crypto/threads_pthread.c:107:9: Taking true branch 105. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 106. { 107. if (pthread_once(once, init) != 0) ^ 108. return 0; 109. crypto/threads_pthread.c:108:9: 106. { 107. if (pthread_once(once, init) != 0) 108. > return 0; 109. 110. return 1; crypto/threads_pthread.c:111:1: return from a call to CRYPTO_THREAD_run_once 109. 110. return 1; 111. > } 112. 113. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)) crypto/rand/drbg_rand.c:386:10: Condition is false 384. DRBG_CTX *RAND_DRBG_get_default(void) 385. { 386. if (!RUN_ONCE(&ossl_drbg_init, do_ossl_drbg_init)) ^ 387. return NULL; 388. return &ossl_drbg; crypto/rand/drbg_rand.c:386:10: Taking true branch 384. DRBG_CTX *RAND_DRBG_get_default(void) 385. { 386. if (!RUN_ONCE(&ossl_drbg_init, do_ossl_drbg_init)) ^ 387. return NULL; 388. return &ossl_drbg; crypto/rand/drbg_rand.c:387:9: 385. { 386. if (!RUN_ONCE(&ossl_drbg_init, do_ossl_drbg_init)) 387. > return NULL; 388. return &ossl_drbg; 389. } crypto/rand/drbg_rand.c:389:1: return from a call to RAND_DRBG_get_default 387. return NULL; 388. return &ossl_drbg; 389. > } 390. 391. static int drbg_bytes(unsigned char *out, int count) crypto/rand/drbg_rand.c:394:5: 392. { 393. DRBG_CTX *dctx = RAND_DRBG_get_default(); 394. > int ret = 0; 395. 396. CRYPTO_THREAD_write_lock(dctx->lock); crypto/rand/drbg_rand.c:396:5: 394. int ret = 0; 395. 396. > CRYPTO_THREAD_write_lock(dctx->lock); 397. do { 398. size_t rcnt;
https://github.com/openssl/openssl/blob/12fb8c3d2dd00f3d4f1b084385403d26ed64a596/crypto/rand/drbg_rand.c/#L396