id
stringlengths
25
25
content
stringlengths
649
72.1k
max_stars_repo_path
stringlengths
91
133
d2a_code_trace_data_41754
int o2i_SCT_signature(SCT *sct, const unsigned char **in, size_t len) { size_t siglen; size_t len_remaining = len; const unsigned char *p; if (sct->version != SCT_VERSION_V1) { CTerr(CT_F_O2I_SCT_SIGNATURE, CT_R_UNSUPPORTED_VERSION); return -1; } if (len <= 4) { CTerr(CT_F_O2I_SCT_SIGNATURE, CT_R_SCT_INVALID_SIGNATURE); return -1; } p = *in; sct->hash_alg = *p++; sct->sig_alg = *p++; if (SCT_get_signature_nid(sct) == NID_undef) { CTerr(CT_F_O2I_SCT_SIGNATURE, CT_R_SCT_INVALID_SIGNATURE); return -1; } n2s(p, siglen); len_remaining -= (p - *in); if (siglen > len_remaining) { CTerr(CT_F_O2I_SCT_SIGNATURE, CT_R_SCT_INVALID_SIGNATURE); return -1; } if (SCT_set1_signature(sct, p, siglen) != 1) return -1; len_remaining -= siglen; *in = p + siglen; return len - len_remaining; } test/ct_test.c:523: error: BUFFER_OVERRUN_L3 Offset: 3 (⇐ 2 + 1) Size: [1, 300] by call to `SCT_new_from_base64`. Showing all 13 steps of the trace test/ct_test.c:516:5: Array declaration 514. const uint64_t timestamp = 1; 515. const char extensions[] = ""; 516. const char signature[] = "BAMARzBAMiBIL2dRrzXbplQ2vh/WZA89v5pBQpSVkkUwKI+j5" ^ 517. "eI+BgIhAOTtwNs6xXKx4vXoq2poBlOYfc9BAn3+/6EFUZ2J7b8I"; 518. SCT *sct = NULL; test/ct_test.c:523:11: Call 521. 522. fixture.sct_list = sk_SCT_new_null(); 523. sct = SCT_new_from_base64(SCT_VERSION_V1, log_id, ^ 524. CT_LOG_ENTRY_TYPE_X509, timestamp, 525. extensions, signature); crypto/ct/ct_b64.c:60:1: Parameter `signature_base64->strlen` 58. } 59. 60. > SCT *SCT_new_from_base64(unsigned char version, const char *logid_base64, 61. ct_log_entry_type_t entry_type, uint64_t timestamp, 62. const char *extensions_base64, crypto/ct/ct_b64.c:101:14: Call 99. dec = NULL; 100. 101. declen = ct_base64_decode(signature_base64, &dec); ^ 102. if (declen < 0) { 103. CTerr(CT_F_SCT_NEW_FROM_BASE64, X509_R_BASE64_DECODE_ERROR); crypto/ct/ct_b64.c:24:1: Parameter `**out` 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:107:5: Assignment 105. } 106. 107. p = dec; ^ 108. if (o2i_SCT_signature(sct, &p, declen) <= 0) 109. goto err; crypto/ct/ct_b64.c:108:9: Call 106. 107. p = dec; 108. if (o2i_SCT_signature(sct, &p, declen) <= 0) ^ 109. goto err; 110. OPENSSL_free(dec); crypto/ct/ct_oct.c:24:1: <Length trace> 22. #include "ct_locl.h" 23. 24. > int o2i_SCT_signature(SCT *sct, const unsigned char **in, size_t len) 25. { 26. size_t siglen; crypto/ct/ct_oct.c:24:1: Parameter `**in` 22. #include "ct_locl.h" 23. 24. > int o2i_SCT_signature(SCT *sct, const unsigned char **in, size_t len) 25. { 26. size_t siglen; crypto/ct/ct_oct.c:46:5: Assignment 44. } 45. 46. p = *in; ^ 47. /* Get hash and signature algorithm */ 48. sct->hash_alg = *p++; crypto/ct/ct_oct.c:48:22: Assignment 46. p = *in; 47. /* Get hash and signature algorithm */ 48. sct->hash_alg = *p++; ^ 49. sct->sig_alg = *p++; 50. if (SCT_get_signature_nid(sct) == NID_undef) { crypto/ct/ct_oct.c:49:21: Assignment 47. /* Get hash and signature algorithm */ 48. sct->hash_alg = *p++; 49. sct->sig_alg = *p++; ^ 50. if (SCT_get_signature_nid(sct) == NID_undef) { 51. CTerr(CT_F_O2I_SCT_SIGNATURE, CT_R_SCT_INVALID_SIGNATURE); crypto/ct/ct_oct.c:55:5: Array access: Offset: 3 (⇐ 2 + 1) Size: [1, 300] by call to `SCT_new_from_base64` 53. } 54. /* Retrieve signature and check it is consistent with the buffer length */ 55. n2s(p, siglen); ^ 56. len_remaining -= (p - *in); 57. if (siglen > len_remaining) {
https://github.com/openssl/openssl/blob/2d13250fd695eba777fe7e2af4beb1b7d356bd8f/crypto/ct/ct_oct.c/#L55
d2a_code_trace_data_41755
static int stream_reqbody_read(proxy_http_req_t *req, apr_bucket_brigade *bb, int nonblocking) { request_rec *r = req->r; proxy_conn_rec *p_conn = req->backend; apr_bucket_alloc_t *bucket_alloc = req->bucket_alloc; apr_read_type_e block = nonblocking ? APR_NONBLOCK_READ : APR_BLOCK_READ; apr_status_t status; int rv; for (;;) { status = ap_get_brigade(r->input_filters, bb, AP_MODE_READBYTES, block, HUGE_STRING_LEN); if (block == APR_BLOCK_READ || (!APR_STATUS_IS_EAGAIN(status) && (status != APR_SUCCESS || !APR_BRIGADE_EMPTY(bb)))) { break; } apr_brigade_cleanup(bb); rv = ap_proxy_pass_brigade(bucket_alloc, r, p_conn, req->origin, bb, 1); if (rv != OK) { return rv; } block = APR_BLOCK_READ; } if (status != APR_SUCCESS) { conn_rec *c = r->connection; ap_log_rerror(APLOG_MARK, APLOG_ERR, status, r, APLOGNO(02608) "read request body failed to %pI (%s)" " from %s (%s)", p_conn->addr, p_conn->hostname ? p_conn->hostname: "", c->client_ip, c->remote_host ? c->remote_host: ""); return ap_map_http_request_error(status, HTTP_BAD_REQUEST); } return OK; } modules/proxy/mod_proxy_http.c:300: error: UNINITIALIZED_VALUE The value read from status was never initialized. modules/proxy/mod_proxy_http.c:300:16: 298. p_conn->hostname ? p_conn->hostname: "", 299. c->client_ip, c->remote_host ? c->remote_host: ""); 300. return ap_map_http_request_error(status, HTTP_BAD_REQUEST); ^ 301. } 302.
https://github.com/apache/httpd/blob/04b4d0f94f75bdcc6338baf129b08c9c6c6ce87e/modules/proxy/mod_proxy_http.c/#L300
d2a_code_trace_data_41756
void curve448_scalar_halve(curve448_scalar_t out, const curve448_scalar_t a) { c448_word_t mask = 0 - (a->limb[0] & 1); c448_dword_t chain = 0; unsigned int i; for (i = 0; i < C448_SCALAR_LIMBS; i++) { chain = (chain + a->limb[i]) + (sc_p->limb[i] & mask); out->limb[i] = (c448_word_t)chain; chain >>= C448_WORD_BITS; } for (i = 0; i < C448_SCALAR_LIMBS - 1; i++) out->limb[i] = out->limb[i] >> 1 | out->limb[i + 1] << (WBITS - 1); out->limb[i] = out->limb[i] >> 1 | (c448_word_t)(chain << (WBITS - 1)); } crypto/ec/curve448/curve448.c:508: error: INTEGER_OVERFLOW_L2 (0 - [0, 1]):unsigned32 by call to `curve448_scalar_halve`. Showing all 6 steps of the trace crypto/ec/curve448/curve448.c:504:5: Call 502. scalar2[X_PRIVATE_BYTES - 1] |= 1 << ((X_PRIVATE_BITS + 7) % 8); 503. 504. curve448_scalar_decode_long(the_scalar, scalar2, sizeof(scalar2)); ^ 505. 506. /* Compensate for the encoding ratio */ crypto/ec/curve448/scalar.c:174:1: Parameter `s->limb[*]` 172. } 173. 174. > void curve448_scalar_decode_long(curve448_scalar_t s, 175. const unsigned char *ser, size_t ser_len) 176. { crypto/ec/curve448/curve448.c:508:9: Call 506. /* Compensate for the encoding ratio */ 507. for (i = 1; i < X448_ENCODE_RATIO; i <<= 1) { 508. curve448_scalar_halve(the_scalar, the_scalar); ^ 509. } 510. curve448_precomputed_scalarmul(p, curve448_precomputed_base, the_scalar); crypto/ec/curve448/scalar.c:222:1: <RHS trace> 220. } 221. 222. > void curve448_scalar_halve(curve448_scalar_t out, const curve448_scalar_t a) 223. { 224. c448_word_t mask = 0 - (a->limb[0] & 1); crypto/ec/curve448/scalar.c:222:1: Parameter `a->limb[*]` 220. } 221. 222. > void curve448_scalar_halve(curve448_scalar_t out, const curve448_scalar_t a) 223. { 224. c448_word_t mask = 0 - (a->limb[0] & 1); crypto/ec/curve448/scalar.c:224:5: Binary operation: (0 - [0, 1]):unsigned32 by call to `curve448_scalar_halve` 222. void curve448_scalar_halve(curve448_scalar_t out, const curve448_scalar_t a) 223. { 224. c448_word_t mask = 0 - (a->limb[0] & 1); ^ 225. c448_dword_t chain = 0; 226. unsigned int i;
https://github.com/openssl/openssl/blob/0cdcdacc337005e08a906b2e07d4e44e3ee48138/crypto/ec/curve448/scalar.c/#L224
d2a_code_trace_data_41757
void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) { unsigned long hash; OPENSSL_LH_NODE *nn, **rn; void *ret; lh->error = 0; rn = getrn(lh, data, &hash); if (*rn == NULL) { lh->num_no_delete++; return (NULL); } else { nn = *rn; *rn = nn->next; ret = nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))) contract(lh); return (ret); } test/sslapitest.c:107: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `SSL_free`. Showing all 17 steps of the trace test/sslapitest.c:93:10: Call 91. } 92. 93. if (!create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL, NULL)) { ^ 94. printf("Unable to create SSL objects\n"); 95. goto end; test/ssltestlib.c:579:21: Call 577. 578. if (*sssl == NULL) 579. serverssl = SSL_new(serverctx); ^ 580. else 581. serverssl = *sssl; ssl/ssl_lib.c:519:1: Parameter `ctx->sessions->num_items` 517. } 518. 519. > SSL *SSL_new(SSL_CTX *ctx) 520. { 521. SSL *s; test/sslapitest.c:107:5: Call 105. end: 106. X509_free(chaincert); 107. SSL_free(serverssl); ^ 108. SSL_free(clientssl); 109. SSL_CTX_free(sctx); ssl/ssl_lib.c:961:1: Parameter `s->initial_ctx->sessions->num_items` 959. } 960. 961. > void SSL_free(SSL *s) 962. { 963. int i; ssl/ssl_lib.c:991:9: Call 989. /* Make the next call work :-) */ 990. if (s->session != NULL) { 991. ssl_clear_bad_session(s); ^ 992. SSL_SESSION_free(s->session); 993. } ssl/ssl_sess.c:1026:1: Parameter `s->initial_ctx->sessions->num_items` 1024. } 1025. 1026. > int ssl_clear_bad_session(SSL *s) 1027. { 1028. if ((s->session != NULL) && ssl/ssl_sess.c:1031:9: Call 1029. !(s->shutdown & SSL_SENT_SHUTDOWN) && 1030. !(SSL_in_init(s) || SSL_in_before(s))) { 1031. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 1032. return (1); 1033. } else ssl/ssl_sess.c:715:1: Parameter `ctx->sessions->num_items` 713. } 714. 715. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 716. { 717. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:717:12: Call 715. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 716. { 717. return remove_session_lock(ctx, c, 1); ^ 718. } 719. ssl/ssl_sess.c:720:1: Parameter `ctx->sessions->num_items` 718. } 719. 720. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 721. { 722. SSL_SESSION *r; ssl/ssl_sess.c:730:17: Call 728. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 729. ret = 1; 730. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 731. SSL_SESSION_list_remove(ctx, c); 732. } ssl/ssl_locl.h:605:1: Parameter `lh->num_items` 603. }; 604. 605. > DEFINE_LHASH_OF(SSL_SESSION); 606. /* Needed in ssl_cert.c */ 607. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:605:1: Call 603. }; 604. 605. > DEFINE_LHASH_OF(SSL_SESSION); 606. /* Needed in ssl_cert.c */ 607. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:103:1: <LHS trace> 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:103:1: Parameter `lh->num_items` 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:123:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `SSL_free` 121. } 122. 123. lh->num_items--; ^ 124. if ((lh->num_nodes > MIN_NODES) && 125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
https://github.com/openssl/openssl/blob/82e089308bd9a7794a45f0fa3973d7659420fbd8/crypto/lhash/lhash.c/#L123
d2a_code_trace_data_41758
static int select_server_ctx(SSL *s, void *arg, int ignore) { const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); HANDSHAKE_EX_DATA *ex_data = (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); if (servername == NULL) { ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; return SSL_TLSEXT_ERR_NOACK; } if (strcmp(servername, "server2") == 0) { SSL_CTX *new_ctx = (SSL_CTX*)arg; SSL_set_SSL_CTX(s, new_ctx); SSL_clear_options(s, 0xFFFFFFFFL); SSL_set_options(s, SSL_CTX_get_options(new_ctx)); ex_data->servername = SSL_TEST_SERVERNAME_SERVER2; return SSL_TLSEXT_ERR_OK; } else if (strcmp(servername, "server1") == 0) { ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; return SSL_TLSEXT_ERR_OK; } else if (ignore) { ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; return SSL_TLSEXT_ERR_NOACK; } else { return SSL_TLSEXT_ERR_ALERT_FATAL; } } test/handshake_helper.c:113: error: NULL_DEREFERENCE pointer `ex_data` last assigned on line 109 could be null and is dereferenced at line 113, column 9. Showing all 19 steps of the trace test/handshake_helper.c:106:1: start of procedure select_server_ctx() 104. * An empty SNI extension also returns SSL_TSLEXT_ERR_NOACK. 105. */ 106. > static int select_server_ctx(SSL *s, void *arg, int ignore) 107. { 108. const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); test/handshake_helper.c:108:5: 106. static int select_server_ctx(SSL *s, void *arg, int ignore) 107. { 108. > const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); 109. HANDSHAKE_EX_DATA *ex_data = 110. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); ssl/ssl_lib.c:2366:1: start of procedure SSL_get_servername() 2364. */ 2365. 2366. > const char *SSL_get_servername(const SSL *s, const int type) 2367. { 2368. if (type != TLSEXT_NAMETYPE_host_name) ssl/ssl_lib.c:2368:9: Taking false branch 2366. const char *SSL_get_servername(const SSL *s, const int type) 2367. { 2368. if (type != TLSEXT_NAMETYPE_host_name) ^ 2369. return NULL; 2370. ssl/ssl_lib.c:2371:12: Condition is true 2369. return NULL; 2370. 2371. return s->session && !s->ext.hostname ? ^ 2372. s->session->ext.hostname : s->ext.hostname; 2373. } ssl/ssl_lib.c:2371:27: Condition is true 2369. return NULL; 2370. 2371. return s->session && !s->ext.hostname ? ^ 2372. s->session->ext.hostname : s->ext.hostname; 2373. } ssl/ssl_lib.c:2371:12: 2369. return NULL; 2370. 2371. > return s->session && !s->ext.hostname ? 2372. s->session->ext.hostname : s->ext.hostname; 2373. } ssl/ssl_lib.c:2371:5: 2369. return NULL; 2370. 2371. > return s->session && !s->ext.hostname ? 2372. s->session->ext.hostname : s->ext.hostname; 2373. } ssl/ssl_lib.c:2373:1: return from a call to SSL_get_servername 2371. return s->session && !s->ext.hostname ? 2372. s->session->ext.hostname : s->ext.hostname; 2373. > } 2374. 2375. int SSL_get_servername_type(const SSL *s) test/handshake_helper.c:109:5: 107. { 108. const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); 109. > HANDSHAKE_EX_DATA *ex_data = 110. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); 111. ssl/ssl_lib.c:3729:1: start of procedure SSL_get_ex_data() 3727. } 3728. 3729. > void *SSL_get_ex_data(const SSL *s, int idx) 3730. { 3731. return (CRYPTO_get_ex_data(&s->ex_data, idx)); ssl/ssl_lib.c:3731:5: 3729. void *SSL_get_ex_data(const SSL *s, int idx) 3730. { 3731. > return (CRYPTO_get_ex_data(&s->ex_data, idx)); 3732. } 3733. crypto/ex_data.c:387:1: start of procedure CRYPTO_get_ex_data() 385. * particular index in the class used by this variable 386. */ 387. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 388. { 389. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) crypto/ex_data.c:389:9: Taking true branch 387. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 388. { 389. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) ^ 390. return NULL; 391. return sk_void_value(ad->sk, idx); crypto/ex_data.c:390:9: 388. { 389. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) 390. > return NULL; 391. return sk_void_value(ad->sk, idx); 392. } crypto/ex_data.c:392:1: return from a call to CRYPTO_get_ex_data 390. return NULL; 391. return sk_void_value(ad->sk, idx); 392. > } ssl/ssl_lib.c:3732:1: return from a call to SSL_get_ex_data 3730. { 3731. return (CRYPTO_get_ex_data(&s->ex_data, idx)); 3732. > } 3733. 3734. int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg) test/handshake_helper.c:112:9: Taking true branch 110. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); 111. 112. if (servername == NULL) { ^ 113. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 114. return SSL_TLSEXT_ERR_NOACK; test/handshake_helper.c:113:9: 111. 112. if (servername == NULL) { 113. > ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 114. return SSL_TLSEXT_ERR_NOACK; 115. }
https://github.com/openssl/openssl/blob/0f5df0f1037590de12cc11eeab26fe29bf3f16a3/test/handshake_helper.c/#L113
d2a_code_trace_data_41759
static void new_data_stream(AVFormatContext *oc, int file_idx) { AVStream *st; AVCodec *codec=NULL; AVCodecContext *data_enc; st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); if (!st) { fprintf(stderr, "Could not alloc stream\n"); ffmpeg_exit(1); } new_output_stream(oc, file_idx); data_enc = st->codec; output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); if (!data_stream_copy) { fprintf(stderr, "Data stream encoding not supported yet (only streamcopy)\n"); ffmpeg_exit(1); } avcodec_get_context_defaults3(st->codec, codec); data_enc->codec_type = AVMEDIA_TYPE_DATA; if (data_codec_tag) data_enc->codec_tag= data_codec_tag; if (oc->oformat->flags & AVFMT_GLOBALHEADER) { data_enc->flags |= CODEC_FLAG_GLOBAL_HEADER; avcodec_opts[AVMEDIA_TYPE_DATA]->flags |= CODEC_FLAG_GLOBAL_HEADER; } if (data_stream_copy) { st->stream_copy = 1; } data_disable = 0; av_freep(&data_codec_name); data_stream_copy = 0; } ffmpeg.c:3635: error: Null Dereference pointer `st` last assigned on line 3629 could be null and is dereferenced at line 3635, column 16. ffmpeg.c:3623:1: start of procedure new_data_stream() 3621. } 3622. 3623. static void new_data_stream(AVFormatContext *oc, int file_idx) ^ 3624. { 3625. AVStream *st; ffmpeg.c:3626:5: 3624. { 3625. AVStream *st; 3626. AVCodec *codec=NULL; ^ 3627. AVCodecContext *data_enc; 3628. ffmpeg.c:3629:28: Condition is true 3627. AVCodecContext *data_enc; 3628. 3629. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); ^ 3630. if (!st) { 3631. fprintf(stderr, "Could not alloc stream\n"); ffmpeg.c:3629:5: 3627. AVCodecContext *data_enc; 3628. 3629. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); ^ 3630. if (!st) { 3631. fprintf(stderr, "Could not alloc stream\n"); libavformat/utils.c:2582:1: start of procedure av_new_stream() 2580. } 2581. 2582. AVStream *av_new_stream(AVFormatContext *s, int id) ^ 2583. { 2584. AVStream *st; libavformat/utils.c:2588:9: Taking true branch 2586. AVStream **streams; 2587. 2588. if (s->nb_streams >= INT_MAX/sizeof(*streams)) ^ 2589. return NULL; 2590. streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams)); libavformat/utils.c:2589:9: 2587. 2588. if (s->nb_streams >= INT_MAX/sizeof(*streams)) 2589. return NULL; ^ 2590. streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams)); 2591. if (!streams) libavformat/utils.c:2631:1: return from a call to av_new_stream 2629. s->streams[s->nb_streams++] = st; 2630. return st; 2631. } ^ 2632. 2633. AVProgram *av_new_program(AVFormatContext *ac, int id) ffmpeg.c:3630:10: Taking true branch 3628. 3629. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); 3630. if (!st) { ^ 3631. fprintf(stderr, "Could not alloc stream\n"); 3632. ffmpeg_exit(1); ffmpeg.c:3631:9: 3629. st = av_new_stream(oc, oc->nb_streams < nb_streamid_map ? streamid_map[oc->nb_streams] : 0); 3630. if (!st) { 3631. fprintf(stderr, "Could not alloc stream\n"); ^ 3632. ffmpeg_exit(1); 3633. } ffmpeg.c:3632:9: Skipping ffmpeg_exit(): empty list of specs 3630. if (!st) { 3631. fprintf(stderr, "Could not alloc stream\n"); 3632. ffmpeg_exit(1); ^ 3633. } 3634. new_output_stream(oc, file_idx); ffmpeg.c:3634:5: Skipping new_output_stream(): empty list of specs 3632. ffmpeg_exit(1); 3633. } 3634. new_output_stream(oc, file_idx); ^ 3635. data_enc = st->codec; 3636. output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); ffmpeg.c:3635:5: 3633. } 3634. new_output_stream(oc, file_idx); 3635. data_enc = st->codec; ^ 3636. output_codecs = grow_array(output_codecs, sizeof(*output_codecs), &nb_output_codecs, nb_output_codecs + 1); 3637. if (!data_stream_copy) {
https://github.com/libav/libav/blob/a6286bda0956bfe15b4e1a9f96e1689666e1d866/ffmpeg.c/#L3635
d2a_code_trace_data_41760
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: [368+min(0, `c->synth_buf_offset[*]`), 369+max(511, `c->synth_buf_offset[*]`)] (⇐ [48+min(0, `c->synth_buf_offset[*]`), 49+max(511, `c->synth_buf_offset[*]`)] + 320) Size: 2 by call to `ff_mpa_synth_filter`. libavcodec/mpc.c:51:1: Parameter `c->synth_buf[*]` 49. * Process decoded Musepack data and produce PCM 50. */ 51. static void mpc_synth(MPCContext *c, int16_t *out) ^ 52. { 53. int dither_state = 0; libavcodec/mpc.c:60:13: Call 58. samples_ptr = samples + ch; 59. for(i = 0; i < SAMPLES_PER_BAND; i++) { 60. ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]), ^ 61. mpa_window, &dither_state, 62. samples_ptr, 2, libavcodec/mpegaudiodec.c: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:898:5: Assignment 896. p = synth_buf + 16; 897. SUM8(sum, +=, w, p); 898. p = synth_buf + 48; ^ 899. SUM8(sum, -=, w + 32, p); 900. *samples = round_sample(&sum); libavcodec/mpegaudiodec.c:899:5: Array access: Offset: [368+min(0, c->synth_buf_offset[*]), 369+max(511, c->synth_buf_offset[*])] (⇐ [48+min(0, c->synth_buf_offset[*]), 49+max(511, c->synth_buf_offset[*])] + 320) Size: 2 by call to `ff_mpa_synth_filter` 897. SUM8(sum, +=, w, p); 898. p = synth_buf + 48; 899. SUM8(sum, -=, w + 32, p); ^ 900. *samples = round_sample(&sum); 901. samples += incr;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegaudiodec.c/#L899
d2a_code_trace_data_41761
int ff_wma_init(AVCodecContext * avctx, int flags2) { WMACodecContext *s = avctx->priv_data; int i; float *window; float bps1, high_freq; volatile float bps; int sample_rate1; int coef_vlc_table; if( avctx->sample_rate<=0 || avctx->sample_rate>50000 || avctx->channels<=0 || avctx->channels>8 || avctx->bit_rate<=0) return -1; s->sample_rate = avctx->sample_rate; s->nb_channels = avctx->channels; s->bit_rate = avctx->bit_rate; s->block_align = avctx->block_align; dsputil_init(&s->dsp, avctx); if (avctx->codec->id == CODEC_ID_WMAV1) { s->version = 1; } else { s->version = 2; } if (s->sample_rate <= 16000) { s->frame_len_bits = 9; } else if (s->sample_rate <= 22050 || (s->sample_rate <= 32000 && s->version == 1)) { s->frame_len_bits = 10; } else { s->frame_len_bits = 11; } s->frame_len = 1 << s->frame_len_bits; if (s->use_variable_block_len) { int nb_max, nb; nb = ((flags2 >> 3) & 3) + 1; if ((s->bit_rate / s->nb_channels) >= 32000) nb += 2; nb_max = s->frame_len_bits - BLOCK_MIN_BITS; if (nb > nb_max) nb = nb_max; s->nb_block_sizes = nb + 1; } else { s->nb_block_sizes = 1; } s->use_noise_coding = 1; high_freq = s->sample_rate * 0.5; sample_rate1 = s->sample_rate; if (s->version == 2) { if (sample_rate1 >= 44100) sample_rate1 = 44100; else if (sample_rate1 >= 22050) sample_rate1 = 22050; else if (sample_rate1 >= 16000) sample_rate1 = 16000; else if (sample_rate1 >= 11025) sample_rate1 = 11025; else if (sample_rate1 >= 8000) sample_rate1 = 8000; } bps = (float)s->bit_rate / (float)(s->nb_channels * s->sample_rate); s->byte_offset_bits = av_log2((int)(bps * s->frame_len / 8.0 + 0.5)) + 2; bps1 = bps; if (s->nb_channels == 2) bps1 = bps * 1.6; if (sample_rate1 == 44100) { if (bps1 >= 0.61) s->use_noise_coding = 0; else high_freq = high_freq * 0.4; } else if (sample_rate1 == 22050) { if (bps1 >= 1.16) s->use_noise_coding = 0; else if (bps1 >= 0.72) high_freq = high_freq * 0.7; else high_freq = high_freq * 0.6; } else if (sample_rate1 == 16000) { if (bps > 0.5) high_freq = high_freq * 0.5; else high_freq = high_freq * 0.3; } else if (sample_rate1 == 11025) { high_freq = high_freq * 0.7; } else if (sample_rate1 == 8000) { if (bps <= 0.625) { high_freq = high_freq * 0.5; } else if (bps > 0.75) { s->use_noise_coding = 0; } else { high_freq = high_freq * 0.65; } } else { if (bps >= 0.8) { high_freq = high_freq * 0.75; } else if (bps >= 0.6) { high_freq = high_freq * 0.6; } else { high_freq = high_freq * 0.5; } } dprintf(s->avctx, "flags2=0x%x\n", flags2); dprintf(s->avctx, "version=%d channels=%d sample_rate=%d bitrate=%d block_align=%d\n", s->version, s->nb_channels, s->sample_rate, s->bit_rate, s->block_align); dprintf(s->avctx, "bps=%f bps1=%f high_freq=%f bitoffset=%d\n", bps, bps1, high_freq, s->byte_offset_bits); dprintf(s->avctx, "use_noise_coding=%d use_exp_vlc=%d nb_block_sizes=%d\n", s->use_noise_coding, s->use_exp_vlc, s->nb_block_sizes); { int a, b, pos, lpos, k, block_len, i, j, n; const uint8_t *table; if (s->version == 1) { s->coefs_start = 3; } else { s->coefs_start = 0; } for(k = 0; k < s->nb_block_sizes; k++) { block_len = s->frame_len >> k; if (s->version == 1) { lpos = 0; for(i=0;i<25;i++) { a = wma_critical_freqs[i]; b = s->sample_rate; pos = ((block_len * 2 * a) + (b >> 1)) / b; if (pos > block_len) pos = block_len; s->exponent_bands[0][i] = pos - lpos; if (pos >= block_len) { i++; break; } lpos = pos; } s->exponent_sizes[0] = i; } else { table = NULL; a = s->frame_len_bits - BLOCK_MIN_BITS - k; if (a < 3) { if (s->sample_rate >= 44100) table = exponent_band_44100[a]; else if (s->sample_rate >= 32000) table = exponent_band_32000[a]; else if (s->sample_rate >= 22050) table = exponent_band_22050[a]; } if (table) { n = *table++; for(i=0;i<n;i++) s->exponent_bands[k][i] = table[i]; s->exponent_sizes[k] = n; } else { j = 0; lpos = 0; for(i=0;i<25;i++) { a = wma_critical_freqs[i]; b = s->sample_rate; pos = ((block_len * 2 * a) + (b << 1)) / (4 * b); pos <<= 2; if (pos > block_len) pos = block_len; if (pos > lpos) s->exponent_bands[k][j++] = pos - lpos; if (pos >= block_len) break; lpos = pos; } s->exponent_sizes[k] = j; } } s->coefs_end[k] = (s->frame_len - ((s->frame_len * 9) / 100)) >> k; s->high_band_start[k] = (int)((block_len * 2 * high_freq) / s->sample_rate + 0.5); n = s->exponent_sizes[k]; j = 0; pos = 0; for(i=0;i<n;i++) { int start, end; start = pos; pos += s->exponent_bands[k][i]; end = pos; if (start < s->high_band_start[k]) start = s->high_band_start[k]; if (end > s->coefs_end[k]) end = s->coefs_end[k]; if (end > start) s->exponent_high_bands[k][j++] = end - start; } s->exponent_high_sizes[k] = j; #if 0 tprintf(s->avctx, "%5d: coefs_end=%d high_band_start=%d nb_high_bands=%d: ", s->frame_len >> k, s->coefs_end[k], s->high_band_start[k], s->exponent_high_sizes[k]); for(j=0;j<s->exponent_high_sizes[k];j++) tprintf(s->avctx, " %d", s->exponent_high_bands[k][j]); tprintf(s->avctx, "\n"); #endif } } #ifdef TRACE { int i, j; for(i = 0; i < s->nb_block_sizes; i++) { tprintf(s->avctx, "%5d: n=%2d:", s->frame_len >> i, s->exponent_sizes[i]); for(j=0;j<s->exponent_sizes[i];j++) tprintf(s->avctx, " %d", s->exponent_bands[i][j]); tprintf(s->avctx, "\n"); } } #endif for(i = 0; i < s->nb_block_sizes; i++) { int n, j; float alpha; n = 1 << (s->frame_len_bits - i); window = av_malloc(sizeof(float) * n); alpha = M_PI / (2.0 * n); for(j=0;j<n;j++) { window[j] = sin((j + 0.5) * alpha); } s->windows[i] = window; } s->reset_block_lengths = 1; if (s->use_noise_coding) { if (s->use_exp_vlc) s->noise_mult = 0.02; else s->noise_mult = 0.04; #ifdef TRACE for(i=0;i<NOISE_TAB_SIZE;i++) s->noise_table[i] = 1.0 * s->noise_mult; #else { unsigned int seed; float norm; seed = 1; norm = (1.0 / (float)(1LL << 31)) * sqrt(3) * s->noise_mult; for(i=0;i<NOISE_TAB_SIZE;i++) { seed = seed * 314159 + 1; s->noise_table[i] = (float)((int)seed) * norm; } } #endif } coef_vlc_table = 2; if (s->sample_rate >= 32000) { if (bps1 < 0.72) coef_vlc_table = 0; else if (bps1 < 1.16) coef_vlc_table = 1; } s->coef_vlcs[0]= &coef_vlcs[coef_vlc_table * 2 ]; s->coef_vlcs[1]= &coef_vlcs[coef_vlc_table * 2 + 1]; init_coef_vlc(&s->coef_vlc[0], &s->run_table[0], &s->level_table[0], &s->int_table[0], s->coef_vlcs[0]); init_coef_vlc(&s->coef_vlc[1], &s->run_table[1], &s->level_table[1], &s->int_table[1], s->coef_vlcs[1]); return 0; } libavcodec/wma.c:225: error: Buffer Overrun L3 Offset: [-2, 2] Size: 3. libavcodec/wma.c:95:9: <Offset trace> 93. /* compute MDCT block size */ 94. if (s->sample_rate <= 16000) { 95. s->frame_len_bits = 9; ^ 96. } else if (s->sample_rate <= 22050 || 97. (s->sample_rate <= 32000 && s->version == 1)) { libavcodec/wma.c:95:9: Assignment 93. /* compute MDCT block size */ 94. if (s->sample_rate <= 16000) { 95. s->frame_len_bits = 9; ^ 96. } else if (s->sample_rate <= 22050 || 97. (s->sample_rate <= 32000 && s->version == 1)) { libavcodec/wma.c:220:17: Assignment 218. /* hardcoded tables */ 219. table = NULL; 220. a = s->frame_len_bits - BLOCK_MIN_BITS - k; ^ 221. if (a < 3) { 222. if (s->sample_rate >= 44100) libavcodec/wmadata.h:47:1: <Length trace> 45. }; 46. 47. static const uint8_t exponent_band_32000[3][25] = { ^ 48. { 11, 4, 4, 8, 4, 4, 12, 16, 24, 20, 28, 4, }, 49. { 15, 4, 8, 4, 4, 8, 8, 16, 20, 12, 20, 20, 28, 40, 56, 8, }, libavcodec/wmadata.h:47:1: Array declaration 45. }; 46. 47. static const uint8_t exponent_band_32000[3][25] = { ^ 48. { 11, 4, 4, 8, 4, 4, 12, 16, 24, 20, 28, 4, }, 49. { 15, 4, 8, 4, 4, 8, 8, 16, 20, 12, 20, 20, 28, 40, 56, 8, }, libavcodec/wma.c:225:25: Array access: Offset: [-2, 2] Size: 3 223. table = exponent_band_44100[a]; 224. else if (s->sample_rate >= 32000) 225. table = exponent_band_32000[a]; ^ 226. else if (s->sample_rate >= 22050) 227. table = exponent_band_22050[a];
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/wma.c/#L225
d2a_code_trace_data_41762
static int tls_decrypt_ticket(SSL *s, const unsigned char *etick, int eticklen, const unsigned char *sess_id, int sesslen, SSL_SESSION **psess) { SSL_SESSION *sess; unsigned char *sdec; const unsigned char *p; int slen, mlen, renew_ticket = 0, ret = -1; unsigned char tick_hmac[EVP_MAX_MD_SIZE]; HMAC_CTX *hctx = NULL; EVP_CIPHER_CTX *ctx; SSL_CTX *tctx = s->initial_ctx; if (eticklen < 48) return 2; hctx = HMAC_CTX_new(); if (hctx == NULL) return -2; ctx = EVP_CIPHER_CTX_new(); if (ctx == NULL) { ret = -2; goto err; } if (tctx->tlsext_ticket_key_cb) { unsigned char *nctick = (unsigned char *)etick; int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16, ctx, hctx, 0); if (rv < 0) goto err; if (rv == 0) { ret = 2; goto err; } if (rv == 2) renew_ticket = 1; } else { if (memcmp(etick, tctx->tlsext_tick_key_name, sizeof(tctx->tlsext_tick_key_name)) != 0) { ret = 2; goto err; } if (HMAC_Init_ex(hctx, tctx->tlsext_tick_hmac_key, sizeof(tctx->tlsext_tick_hmac_key), EVP_sha256(), NULL) <= 0 || EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, tctx->tlsext_tick_aes_key, etick + sizeof(tctx->tlsext_tick_key_name)) <= 0) { goto err; } } mlen = HMAC_size(hctx); if (mlen < 0) { goto err; } eticklen -= mlen; if (HMAC_Update(hctx, etick, eticklen) <= 0 || HMAC_Final(hctx, tick_hmac, NULL) <= 0) { goto err; } HMAC_CTX_free(hctx); if (CRYPTO_memcmp(tick_hmac, etick + eticklen, mlen)) { EVP_CIPHER_CTX_free(ctx); return 2; } p = etick + 16 + EVP_CIPHER_CTX_iv_length(ctx); eticklen -= 16 + EVP_CIPHER_CTX_iv_length(ctx); sdec = OPENSSL_malloc(eticklen); if (sdec == NULL || EVP_DecryptUpdate(ctx, sdec, &slen, p, eticklen) <= 0) { EVP_CIPHER_CTX_free(ctx); OPENSSL_free(sdec); return -1; } if (EVP_DecryptFinal(ctx, sdec + slen, &mlen) <= 0) { EVP_CIPHER_CTX_free(ctx); OPENSSL_free(sdec); return 2; } slen += mlen; EVP_CIPHER_CTX_free(ctx); ctx = NULL; p = sdec; sess = d2i_SSL_SESSION(NULL, &p, slen); OPENSSL_free(sdec); if (sess) { if (sesslen) memcpy(sess->session_id, sess_id, sesslen); sess->session_id_length = sesslen; *psess = sess; if (renew_ticket) return 4; else return 3; } ERR_clear_error(); return 2; err: EVP_CIPHER_CTX_free(ctx); HMAC_CTX_free(hctx); return ret; } ssl/t1_lib.c:3081: error: MEMORY_LEAK memory dynamically allocated by call to `EVP_CIPHER_CTX_new()` at line 2984, column 11 is not reachable after line 3081, column 5. Showing all 55 steps of the trace ssl/t1_lib.c:2965:1: start of procedure tls_decrypt_ticket() 2963. * 4: same as 3, but the ticket needs to be renewed. 2964. */ 2965. > static int tls_decrypt_ticket(SSL *s, const unsigned char *etick, 2966. int eticklen, const unsigned char *sess_id, 2967. int sesslen, SSL_SESSION **psess) ssl/t1_lib.c:2972:5: 2970. unsigned char *sdec; 2971. const unsigned char *p; 2972. > int slen, mlen, renew_ticket = 0, ret = -1; 2973. unsigned char tick_hmac[EVP_MAX_MD_SIZE]; 2974. HMAC_CTX *hctx = NULL; ssl/t1_lib.c:2974:5: 2972. int slen, mlen, renew_ticket = 0, ret = -1; 2973. unsigned char tick_hmac[EVP_MAX_MD_SIZE]; 2974. > HMAC_CTX *hctx = NULL; 2975. EVP_CIPHER_CTX *ctx; 2976. SSL_CTX *tctx = s->initial_ctx; ssl/t1_lib.c:2976:5: 2974. HMAC_CTX *hctx = NULL; 2975. EVP_CIPHER_CTX *ctx; 2976. > SSL_CTX *tctx = s->initial_ctx; 2977. /* Need at least keyname + iv + some encrypted data */ 2978. if (eticklen < 48) ssl/t1_lib.c:2978:9: Taking false branch 2976. SSL_CTX *tctx = s->initial_ctx; 2977. /* Need at least keyname + iv + some encrypted data */ 2978. if (eticklen < 48) ^ 2979. return 2; 2980. /* Initialize session ticket encryption and HMAC contexts */ ssl/t1_lib.c:2981:5: Skipping HMAC_CTX_new(): empty list of specs 2979. return 2; 2980. /* Initialize session ticket encryption and HMAC contexts */ 2981. hctx = HMAC_CTX_new(); ^ 2982. if (hctx == NULL) 2983. return -2; ssl/t1_lib.c:2982:9: Taking false branch 2980. /* Initialize session ticket encryption and HMAC contexts */ 2981. hctx = HMAC_CTX_new(); 2982. if (hctx == NULL) ^ 2983. return -2; 2984. ctx = EVP_CIPHER_CTX_new(); ssl/t1_lib.c:2984:5: 2982. if (hctx == NULL) 2983. return -2; 2984. > ctx = EVP_CIPHER_CTX_new(); 2985. if (ctx == NULL) { 2986. ret = -2; crypto/evp/evp_enc.c:39:1: start of procedure EVP_CIPHER_CTX_new() 37. } 38. 39. > EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void) 40. { 41. return OPENSSL_zalloc(sizeof(EVP_CIPHER_CTX)); crypto/evp/evp_enc.c:41:5: 39. EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void) 40. { 41. > return OPENSSL_zalloc(sizeof(EVP_CIPHER_CTX)); 42. } 43. crypto/mem.c:98:1: start of procedure CRYPTO_zalloc() 96. } 97. 98. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 99. { 100. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:100:5: 98. void *CRYPTO_zalloc(size_t num, const char *file, int line) 99. { 100. > void *ret = CRYPTO_malloc(num, file, line); 101. 102. if (ret != NULL) crypto/mem.c:71:1: start of procedure CRYPTO_malloc() 69. } 70. 71. > void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. void *ret = NULL; crypto/mem.c:73:5: 71. void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. > void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:75:9: Taking false branch 73. void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 76. return malloc_impl(num, file, line); 77. crypto/mem.c:78:9: Taking false branch 76. return malloc_impl(num, file, line); 77. 78. if (num <= 0) ^ 79. return NULL; 80. crypto/mem.c:81:5: 79. return NULL; 80. 81. > allow_customize = 0; 82. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 83. if (call_malloc_debug) { crypto/mem.c:91:5: 89. } 90. #else 91. > osslargused(file); osslargused(line); 92. ret = malloc(num); 93. #endif crypto/mem.c:91:24: 89. } 90. #else 91. > osslargused(file); osslargused(line); 92. ret = malloc(num); 93. #endif crypto/mem.c:92:5: 90. #else 91. osslargused(file); osslargused(line); 92. > ret = malloc(num); 93. #endif 94. crypto/mem.c:95:5: 93. #endif 94. 95. > return ret; 96. } 97. crypto/mem.c:96:1: return from a call to CRYPTO_malloc 94. 95. return ret; 96. > } 97. 98. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:102:9: Taking true branch 100. void *ret = CRYPTO_malloc(num, file, line); 101. 102. if (ret != NULL) ^ 103. memset(ret, 0, num); 104. return ret; crypto/mem.c:103:9: 101. 102. if (ret != NULL) 103. > memset(ret, 0, num); 104. return ret; 105. } crypto/mem.c:104:5: 102. if (ret != NULL) 103. memset(ret, 0, num); 104. > return ret; 105. } 106. crypto/mem.c:105:1: return from a call to CRYPTO_zalloc 103. memset(ret, 0, num); 104. return ret; 105. > } 106. 107. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/evp/evp_enc.c:42:1: return from a call to EVP_CIPHER_CTX_new 40. { 41. return OPENSSL_zalloc(sizeof(EVP_CIPHER_CTX)); 42. > } 43. 44. void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx) ssl/t1_lib.c:2985:9: Taking false branch 2983. return -2; 2984. ctx = EVP_CIPHER_CTX_new(); 2985. if (ctx == NULL) { ^ 2986. ret = -2; 2987. goto err; ssl/t1_lib.c:2989:9: Taking true branch 2987. goto err; 2988. } 2989. if (tctx->tlsext_ticket_key_cb) { ^ 2990. unsigned char *nctick = (unsigned char *)etick; 2991. int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16, ssl/t1_lib.c:2990:9: 2988. } 2989. if (tctx->tlsext_ticket_key_cb) { 2990. > unsigned char *nctick = (unsigned char *)etick; 2991. int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16, 2992. ctx, hctx, 0); ssl/t1_lib.c:2991:9: Skipping __function_pointer__(): unresolved function pointer 2989. if (tctx->tlsext_ticket_key_cb) { 2990. unsigned char *nctick = (unsigned char *)etick; 2991. int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16, ^ 2992. ctx, hctx, 0); 2993. if (rv < 0) ssl/t1_lib.c:2993:13: Taking false branch 2991. int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16, 2992. ctx, hctx, 0); 2993. if (rv < 0) ^ 2994. goto err; 2995. if (rv == 0) { ssl/t1_lib.c:2995:13: Taking false branch 2993. if (rv < 0) 2994. goto err; 2995. if (rv == 0) { ^ 2996. ret = 2; 2997. goto err; ssl/t1_lib.c:2999:13: Taking false branch 2997. goto err; 2998. } 2999. if (rv == 2) ^ 3000. renew_ticket = 1; 3001. } else { ssl/t1_lib.c:3021:5: 3019. * checks on ticket. 3020. */ 3021. > mlen = HMAC_size(hctx); 3022. if (mlen < 0) { 3023. goto err; crypto/hmac/hmac.c:119:1: start of procedure HMAC_size() 117. } 118. 119. > size_t HMAC_size(const HMAC_CTX *ctx) 120. { 121. return EVP_MD_size((ctx)->md); crypto/hmac/hmac.c:121:5: 119. size_t HMAC_size(const HMAC_CTX *ctx) 120. { 121. > return EVP_MD_size((ctx)->md); 122. } 123. crypto/evp/evp_lib.c:301:1: start of procedure EVP_MD_size() 299. } 300. 301. > int EVP_MD_size(const EVP_MD *md) 302. { 303. if (!md) { crypto/evp/evp_lib.c:303:10: Taking false branch 301. int EVP_MD_size(const EVP_MD *md) 302. { 303. if (!md) { ^ 304. EVPerr(EVP_F_EVP_MD_SIZE, EVP_R_MESSAGE_DIGEST_IS_NULL); 305. return -1; crypto/evp/evp_lib.c:307:5: 305. return -1; 306. } 307. > return md->md_size; 308. } 309. crypto/evp/evp_lib.c:308:1: return from a call to EVP_MD_size 306. } 307. return md->md_size; 308. > } 309. 310. unsigned long EVP_MD_flags(const EVP_MD *md) crypto/hmac/hmac.c:122:1: return from a call to HMAC_size 120. { 121. return EVP_MD_size((ctx)->md); 122. > } 123. 124. HMAC_CTX *HMAC_CTX_new(void) ssl/t1_lib.c:3022:9: Taking false branch 3020. */ 3021. mlen = HMAC_size(hctx); 3022. if (mlen < 0) { ^ 3023. goto err; 3024. } ssl/t1_lib.c:3025:5: 3023. goto err; 3024. } 3025. > eticklen -= mlen; 3026. /* Check HMAC of encrypted ticket */ 3027. if (HMAC_Update(hctx, etick, eticklen) <= 0 ssl/t1_lib.c:3027:9: 3025. eticklen -= mlen; 3026. /* Check HMAC of encrypted ticket */ 3027. > if (HMAC_Update(hctx, etick, eticklen) <= 0 3028. || HMAC_Final(hctx, tick_hmac, NULL) <= 0) { 3029. goto err; crypto/hmac/hmac.c:91:1: start of procedure HMAC_Update() 89. #endif 90. 91. > int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len) 92. { 93. if (!ctx->md) crypto/hmac/hmac.c:93:10: Taking false branch 91. int HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len) 92. { 93. if (!ctx->md) ^ 94. return 0; 95. return EVP_DigestUpdate(ctx->md_ctx, data, len); crypto/hmac/hmac.c:95:5: 93. if (!ctx->md) 94. return 0; 95. > return EVP_DigestUpdate(ctx->md_ctx, data, len); 96. } 97. crypto/evp/digest.c:146:1: start of procedure EVP_DigestUpdate() 144. } 145. 146. > int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, size_t count) 147. { 148. return ctx->update(ctx, data, count); crypto/evp/digest.c:148:5: Skipping __function_pointer__(): unresolved function pointer 146. int EVP_DigestUpdate(EVP_MD_CTX *ctx, const void *data, size_t count) 147. { 148. return ctx->update(ctx, data, count); ^ 149. } 150. crypto/evp/digest.c:149:1: return from a call to EVP_DigestUpdate 147. { 148. return ctx->update(ctx, data, count); 149. > } 150. 151. /* The caller can assume that this removes any secret data from the context */ crypto/hmac/hmac.c:96:1: return from a call to HMAC_Update 94. return 0; 95. return EVP_DigestUpdate(ctx->md_ctx, data, len); 96. > } 97. 98. int HMAC_Final(HMAC_CTX *ctx, unsigned char *md, unsigned int *len) ssl/t1_lib.c:3027:9: Taking true branch 3025. eticklen -= mlen; 3026. /* Check HMAC of encrypted ticket */ 3027. if (HMAC_Update(hctx, etick, eticklen) <= 0 ^ 3028. || HMAC_Final(hctx, tick_hmac, NULL) <= 0) { 3029. goto err; ssl/t1_lib.c:3080:1: 3078. */ 3079. return 2; 3080. > err: 3081. EVP_CIPHER_CTX_free(ctx); 3082. HMAC_CTX_free(hctx); ssl/t1_lib.c:3081:5: Skipping EVP_CIPHER_CTX_free(): empty list of specs 3079. return 2; 3080. err: 3081. EVP_CIPHER_CTX_free(ctx); ^ 3082. HMAC_CTX_free(hctx); 3083. return ret;
https://github.com/openssl/openssl/blob/70c22888c1648fe8652e77107f3c74bf2212de36/ssl/t1_lib.c/#L3081
d2a_code_trace_data_41763
static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, const int size, const int h, int ref_index, int src_index, me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ MotionEstContext * const c= &s->me; const int stride= c->stride; const int uvstride= c->uvstride; const int qpel= flags&FLAG_QPEL; const int chroma= flags&FLAG_CHROMA; const int dxy= subx + (suby<<(1+qpel)); const int hx= subx + (x<<(1+qpel)); const int hy= suby + (y<<(1+qpel)); uint8_t * const * const ref= c->ref[ref_index]; uint8_t * const * const src= c->src[src_index]; int d; if(flags&FLAG_DIRECT){ assert(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)); if(x >= c->xmin && hx <= c->xmax<<(qpel+1) && y >= c->ymin && hy <= c->ymax<<(qpel+1)){ const int time_pp= s->pp_time; const int time_pb= s->pb_time; const int mask= 2*qpel+1; if(s->mv_type==MV_TYPE_8X8){ int i; for(i=0; i<4; i++){ int fx = c->direct_basis_mv[i][0] + hx; int fy = c->direct_basis_mv[i][1] + hy; int bx = hx ? fx - c->co_located_mv[i][0] : c->co_located_mv[i][0]*(time_pb - time_pp)/time_pp + ((i &1)<<(qpel+4)); int by = hy ? fy - c->co_located_mv[i][1] : c->co_located_mv[i][1]*(time_pb - time_pp)/time_pp + ((i>>1)<<(qpel+4)); int fxy= (fx&mask) + ((fy&mask)<<(qpel+1)); int bxy= (bx&mask) + ((by&mask)<<(qpel+1)); uint8_t *dst= c->temp + 8*(i&1) + 8*stride*(i>>1); if(qpel){ c->qpel_put[1][fxy](dst, ref[0] + (fx>>2) + (fy>>2)*stride, stride); c->qpel_avg[1][bxy](dst, ref[8] + (bx>>2) + (by>>2)*stride, stride); }else{ c->hpel_put[1][fxy](dst, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 8); c->hpel_avg[1][bxy](dst, ref[8] + (bx>>1) + (by>>1)*stride, stride, 8); } } }else{ int fx = c->direct_basis_mv[0][0] + hx; int fy = c->direct_basis_mv[0][1] + hy; int bx = hx ? fx - c->co_located_mv[0][0] : (c->co_located_mv[0][0]*(time_pb - time_pp)/time_pp); int by = hy ? fy - c->co_located_mv[0][1] : (c->co_located_mv[0][1]*(time_pb - time_pp)/time_pp); int fxy= (fx&mask) + ((fy&mask)<<(qpel+1)); int bxy= (bx&mask) + ((by&mask)<<(qpel+1)); if(qpel){ c->qpel_put[1][fxy](c->temp , ref[0] + (fx>>2) + (fy>>2)*stride , stride); c->qpel_put[1][fxy](c->temp + 8 , ref[0] + (fx>>2) + (fy>>2)*stride + 8 , stride); c->qpel_put[1][fxy](c->temp + 8*stride, ref[0] + (fx>>2) + (fy>>2)*stride + 8*stride, stride); c->qpel_put[1][fxy](c->temp + 8 + 8*stride, ref[0] + (fx>>2) + (fy>>2)*stride + 8 + 8*stride, stride); c->qpel_avg[1][bxy](c->temp , ref[8] + (bx>>2) + (by>>2)*stride , stride); c->qpel_avg[1][bxy](c->temp + 8 , ref[8] + (bx>>2) + (by>>2)*stride + 8 , stride); c->qpel_avg[1][bxy](c->temp + 8*stride, ref[8] + (bx>>2) + (by>>2)*stride + 8*stride, stride); c->qpel_avg[1][bxy](c->temp + 8 + 8*stride, ref[8] + (bx>>2) + (by>>2)*stride + 8 + 8*stride, stride); }else{ assert((fx>>1) + 16*s->mb_x >= -16); assert((fy>>1) + 16*s->mb_y >= -16); assert((fx>>1) + 16*s->mb_x <= s->width); assert((fy>>1) + 16*s->mb_y <= s->height); assert((bx>>1) + 16*s->mb_x >= -16); assert((by>>1) + 16*s->mb_y >= -16); assert((bx>>1) + 16*s->mb_x <= s->width); assert((by>>1) + 16*s->mb_y <= s->height); c->hpel_put[0][fxy](c->temp, ref[0] + (fx>>1) + (fy>>1)*stride, stride, 16); c->hpel_avg[0][bxy](c->temp, ref[8] + (bx>>1) + (by>>1)*stride, stride, 16); } } d = cmp_func(s, c->temp, src[0], stride, 16); }else d= 256*256*256*32; }else{ int uvdxy; if(dxy){ if(qpel){ c->qpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride); if(chroma){ int cx= hx/2; int cy= hy/2; cx= (cx>>1)|(cx&1); cy= (cy>>1)|(cy&1); uvdxy= (cx&1) + 2*(cy&1); } }else{ c->hpel_put[size][dxy](c->temp, ref[0] + x + y*stride, stride, h); if(chroma) uvdxy= dxy | (x&1) | (2*(y&1)); } d = cmp_func(s, c->temp, src[0], stride, h); }else{ d = cmp_func(s, src[0], ref[0] + x + y*stride, stride, h); if(chroma) uvdxy= (x&1) + 2*(y&1); } if(chroma){ uint8_t * const uvtemp= c->temp + 16*stride; c->hpel_put[size+1][uvdxy](uvtemp , ref[1] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1); c->hpel_put[size+1][uvdxy](uvtemp+8, ref[2] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1); d += chroma_cmp_func(s, uvtemp , src[1], uvstride, h>>1); d += chroma_cmp_func(s, uvtemp+8, src[2], uvstride, h>>1); } } #if 0 if(full_pel){ const int index= (((y)<<ME_MAP_SHIFT) + (x))&(ME_MAP_SIZE-1); score_map[index]= d; } d += (c->mv_penalty[hx - c->pred_x] + c->mv_penalty[hy - c->pred_y])*c->penalty_factor; #endif return d; } libavcodec/motion_est.c:1109: error: Buffer Overrun L2 Offset: [3, 4] (⇐ [2, 3] + 1) Size: 4 by call to `cmp`. libavcodec/motion_est.c:1025:1: Parameter `*s->current_picture_ptr->ref_index[*]` 1023. } 1024. 1025. static inline int check_input_motion(MpegEncContext * s, int mb_x, int mb_y, int p_type){ ^ 1026. MotionEstContext * const c= &s->me; 1027. Picture *p= s->current_picture_ptr; libavcodec/motion_est.c:1091:13: Assignment 1089. } 1090. if(USES_LIST(mb_type, 1)){ 1091. int field_select0= p->ref_index[1][xy ]; ^ 1092. int field_select1= p->ref_index[1][xy2]; 1093. assert(field_select0==0 ||field_select0==1); libavcodec/motion_est.c:1109:17: Call 1107. x= p->motion_val[1][xy ][0]; 1108. y= p->motion_val[1][xy ][1]; 1109. d = cmp(s, x>>shift, y>>shift, x&mask, y&mask, 0, 8, field_select0+2, 0, cmpf, chroma_cmpf, flags); ^ 1110. x= p->motion_val[1][xy2][0]; 1111. y= p->motion_val[1][xy2][1]; libavcodec/motion_est.c:108:1: <Length trace> 106. against a proposed motion-compensated prediction of that block 107. */ 108. static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, ^ 109. const int size, const int h, int ref_index, int src_index, 110. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ libavcodec/motion_est.c:108:1: Parameter `ref_index` 106. against a proposed motion-compensated prediction of that block 107. */ 108. static av_always_inline int cmp(MpegEncContext *s, const int x, const int y, const int subx, const int suby, ^ 109. const int size, const int h, int ref_index, int src_index, 110. me_cmp_func cmp_func, me_cmp_func chroma_cmp_func, const int flags){ libavcodec/motion_est.c:119:5: Assignment 117. const int hx= subx + (x<<(1+qpel)); 118. const int hy= suby + (y<<(1+qpel)); 119. uint8_t * const * const ref= c->ref[ref_index]; ^ 120. uint8_t * const * const src= c->src[src_index]; 121. int d; libavcodec/motion_est.c:208:50: Array access: Offset: [3, 4] (⇐ [2, 3] + 1) Size: 4 by call to `cmp` 206. if(chroma){ 207. uint8_t * const uvtemp= c->temp + 16*stride; 208. c->hpel_put[size+1][uvdxy](uvtemp , ref[1] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1); ^ 209. c->hpel_put[size+1][uvdxy](uvtemp+8, ref[2] + (x>>1) + (y>>1)*uvstride, uvstride, h>>1); 210. d += chroma_cmp_func(s, uvtemp , src[1], uvstride, h>>1);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est.c/#L208
d2a_code_trace_data_41764
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ecp_smpl.c:1272: 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:1181:1: Parameter `ctx->stack.depth` 1179. 1180. 1181. > int ec_GFp_simple_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT *points[], BN_CTX *ctx) 1182. { 1183. BN_CTX *new_ctx = NULL; crypto/ec/ecp_smpl.c:1200:2: Call 1198. } 1199. 1200. BN_CTX_start(ctx); ^ 1201. tmp0 = BN_CTX_get(ctx); 1202. tmp1 = 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:1272:8: Call 1270. if (!BN_is_zero(heap[1])) 1271. { 1272. if (!BN_mod_inverse(heap[1], heap[1], &group->field, ctx)) ^ 1273. { 1274. ECerr(EC_F_EC_GFP_SIMPLE_POINTS_MAKE_AFFINE, 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_41765
ERR_STATE *ERR_get_state(void) { ERR_STATE *state; int saveerrno = get_last_sys_error(); if (!OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL)) return NULL; if (!RUN_ONCE(&err_init, err_do_init)) return NULL; state = CRYPTO_THREAD_get_local(&err_thread_local); if (state == (ERR_STATE*)-1) return NULL; if (state == NULL) { if (!CRYPTO_THREAD_set_local(&err_thread_local, (ERR_STATE*)-1)) return NULL; if ((state = OPENSSL_zalloc(sizeof(*state))) == NULL) { CRYPTO_THREAD_set_local(&err_thread_local, NULL); return NULL; } if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE) || !CRYPTO_THREAD_set_local(&err_thread_local, state)) { ERR_STATE_free(state); CRYPTO_THREAD_set_local(&err_thread_local, NULL); return NULL; } OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CRYPTO_STRINGS, NULL); } set_sys_error(saveerrno); return state; } crypto/err/err.c:743: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_zalloc()` at line 736, column 22 is not reachable after line 743, column 13. Showing all 49 steps of the trace crypto/err/err.c:717:1: start of procedure ERR_get_state() 715. } 716. 717. > ERR_STATE *ERR_get_state(void) 718. { 719. ERR_STATE *state; crypto/err/err.c:720:5: 718. { 719. ERR_STATE *state; 720. > int saveerrno = get_last_sys_error(); 721. 722. if (!OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL)) crypto/err/err.c:722:10: Taking false branch 720. int saveerrno = get_last_sys_error(); 721. 722. if (!OPENSSL_init_crypto(OPENSSL_INIT_BASE_ONLY, NULL)) ^ 723. return NULL; 724. crypto/err/err.c:725:10: 723. return NULL; 724. 725. > if (!RUN_ONCE(&err_init, err_do_init)) 726. return NULL; 727. crypto/threads_pthread.c:111:1: start of procedure CRYPTO_THREAD_run_once() 109. } 110. 111. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 112. { 113. if (pthread_once(once, init) != 0) crypto/threads_pthread.c:113:9: Taking false branch 111. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 112. { 113. if (pthread_once(once, init) != 0) ^ 114. return 0; 115. crypto/threads_pthread.c:116:5: 114. return 0; 115. 116. > return 1; 117. } 118. crypto/threads_pthread.c:117:1: return from a call to CRYPTO_THREAD_run_once 115. 116. return 1; 117. > } 118. 119. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)) crypto/err/err.c:725:10: Condition is true 723. return NULL; 724. 725. if (!RUN_ONCE(&err_init, err_do_init)) ^ 726. return NULL; 727. crypto/err/err.c:725:10: Taking false branch 723. return NULL; 724. 725. if (!RUN_ONCE(&err_init, err_do_init)) ^ 726. return NULL; 727. crypto/err/err.c:728:5: 726. return NULL; 727. 728. > state = CRYPTO_THREAD_get_local(&err_thread_local); 729. if (state == (ERR_STATE*)-1) 730. return NULL; crypto/threads_pthread.c:127:1: start of procedure CRYPTO_THREAD_get_local() 125. } 126. 127. > void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key) 128. { 129. return pthread_getspecific(*key); crypto/threads_pthread.c:129:5: Skipping pthread_getspecific(): method has no implementation 127. void *CRYPTO_THREAD_get_local(CRYPTO_THREAD_LOCAL *key) 128. { 129. return pthread_getspecific(*key); ^ 130. } 131. crypto/threads_pthread.c:130:1: return from a call to CRYPTO_THREAD_get_local 128. { 129. return pthread_getspecific(*key); 130. > } 131. 132. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) crypto/err/err.c:729:9: Taking false branch 727. 728. state = CRYPTO_THREAD_get_local(&err_thread_local); 729. if (state == (ERR_STATE*)-1) ^ 730. return NULL; 731. crypto/err/err.c:732:9: Taking true branch 730. return NULL; 731. 732. if (state == NULL) { ^ 733. if (!CRYPTO_THREAD_set_local(&err_thread_local, (ERR_STATE*)-1)) 734. return NULL; crypto/err/err.c:733:14: 731. 732. if (state == NULL) { 733. > if (!CRYPTO_THREAD_set_local(&err_thread_local, (ERR_STATE*)-1)) 734. return NULL; 735. crypto/threads_pthread.c:132:1: start of procedure CRYPTO_THREAD_set_local() 130. } 131. 132. > int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) 133. { 134. if (pthread_setspecific(*key, val) != 0) crypto/threads_pthread.c:134:9: Taking false branch 132. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) 133. { 134. if (pthread_setspecific(*key, val) != 0) ^ 135. return 0; 136. crypto/threads_pthread.c:137:5: 135. return 0; 136. 137. > return 1; 138. } 139. crypto/threads_pthread.c:138:1: return from a call to CRYPTO_THREAD_set_local 136. 137. return 1; 138. > } 139. 140. int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key) crypto/err/err.c:733:14: Taking false branch 731. 732. if (state == NULL) { 733. if (!CRYPTO_THREAD_set_local(&err_thread_local, (ERR_STATE*)-1)) ^ 734. return NULL; 735. crypto/err/err.c:736:13: 734. return NULL; 735. 736. > if ((state = OPENSSL_zalloc(sizeof(*state))) == NULL) { 737. CRYPTO_THREAD_set_local(&err_thread_local, NULL); 738. return NULL; crypto/mem.c:228:1: start of procedure CRYPTO_zalloc() 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:5: 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. > void *ret = CRYPTO_malloc(num, file, line); 231. 232. FAILTEST(); crypto/mem.c:192:1: start of procedure CRYPTO_malloc() 190. #endif 191. 192. > void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. void *ret = NULL; crypto/mem.c:194:5: 192. void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. > void *ret = NULL; 195. 196. INCREMENT(malloc_count); crypto/mem.c:197:9: Taking false branch 195. 196. INCREMENT(malloc_count); 197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 198. return malloc_impl(num, file, line); 199. crypto/mem.c:200:9: Taking false branch 198. return malloc_impl(num, file, line); 199. 200. if (num == 0) ^ 201. return NULL; 202. crypto/mem.c:204:9: Taking true branch 202. 203. FAILTEST(); 204. if (allow_customize) { ^ 205. /* 206. * Disallow customization after the first allocation. We only set this crypto/mem.c:210:9: 208. * allocation. 209. */ 210. > allow_customize = 0; 211. } 212. #if !defined(OPENSSL_NO_CRYPTO_MDEBUG) && !defined(FIPS_MODE) crypto/mem.c:221:5: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:221:19: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:222:5: 220. #else 221. (void)(file); (void)(line); 222. > ret = malloc(num); 223. #endif 224. crypto/mem.c:225:5: 223. #endif 224. 225. > return ret; 226. } 227. crypto/mem.c:226:1: return from a call to CRYPTO_malloc 224. 225. return ret; 226. > } 227. 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:233:9: Taking true branch 231. 232. FAILTEST(); 233. if (ret != NULL) ^ 234. memset(ret, 0, num); 235. return ret; crypto/mem.c:234:9: 232. FAILTEST(); 233. if (ret != NULL) 234. > memset(ret, 0, num); 235. return ret; 236. } crypto/mem.c:235:5: 233. if (ret != NULL) 234. memset(ret, 0, num); 235. > return ret; 236. } 237. crypto/mem.c:236:1: return from a call to CRYPTO_zalloc 234. memset(ret, 0, num); 235. return ret; 236. > } 237. 238. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/err/err.c:736:13: Taking false branch 734. return NULL; 735. 736. if ((state = OPENSSL_zalloc(sizeof(*state))) == NULL) { ^ 737. CRYPTO_THREAD_set_local(&err_thread_local, NULL); 738. return NULL; crypto/err/err.c:741:14: Taking false branch 739. } 740. 741. if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE) ^ 742. || !CRYPTO_THREAD_set_local(&err_thread_local, state)) { 743. ERR_STATE_free(state); crypto/err/err.c:742:21: 740. 741. if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE) 742. > || !CRYPTO_THREAD_set_local(&err_thread_local, state)) { 743. ERR_STATE_free(state); 744. CRYPTO_THREAD_set_local(&err_thread_local, NULL); crypto/threads_pthread.c:132:1: start of procedure CRYPTO_THREAD_set_local() 130. } 131. 132. > int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) 133. { 134. if (pthread_setspecific(*key, val) != 0) crypto/threads_pthread.c:134:9: Taking true branch 132. int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) 133. { 134. if (pthread_setspecific(*key, val) != 0) ^ 135. return 0; 136. crypto/threads_pthread.c:135:9: 133. { 134. if (pthread_setspecific(*key, val) != 0) 135. > return 0; 136. 137. return 1; crypto/threads_pthread.c:138:1: return from a call to CRYPTO_THREAD_set_local 136. 137. return 1; 138. > } 139. 140. int CRYPTO_THREAD_cleanup_local(CRYPTO_THREAD_LOCAL *key) crypto/err/err.c:742:21: Taking true branch 740. 741. if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE) 742. || !CRYPTO_THREAD_set_local(&err_thread_local, state)) { ^ 743. ERR_STATE_free(state); 744. CRYPTO_THREAD_set_local(&err_thread_local, NULL); crypto/err/err.c:743:13: Skipping ERR_STATE_free(): empty list of specs 741. if (!ossl_init_thread_start(OPENSSL_INIT_THREAD_ERR_STATE) 742. || !CRYPTO_THREAD_set_local(&err_thread_local, state)) { 743. ERR_STATE_free(state); ^ 744. CRYPTO_THREAD_set_local(&err_thread_local, NULL); 745. return NULL;
https://github.com/openssl/openssl/blob/915bf45ee32826ed9eb612e4f82034a138dfeb41/crypto/err/err.c/#L743
d2a_code_trace_data_41766
void RAND_add(const void *buf, int num, double randomness) { const RAND_METHOD *meth = RAND_get_rand_method(); if (meth->add != NULL) meth->add(buf, num, randomness); } crypto/rand/rand_lib.c:794: error: NULL_DEREFERENCE pointer `meth` last assigned on line 792 could be null and is dereferenced at line 794, column 9. Showing all 6 steps of the trace crypto/rand/rand_lib.c:790:1: start of procedure RAND_add() 788. } 789. 790. > void RAND_add(const void *buf, int num, double randomness) 791. { 792. const RAND_METHOD *meth = RAND_get_rand_method(); crypto/rand/rand_lib.c:792:5: 790. void RAND_add(const void *buf, int num, double randomness) 791. { 792. > const RAND_METHOD *meth = RAND_get_rand_method(); 793. 794. if (meth->add != NULL) crypto/rand/rand_lib.c:722:1: start of procedure RAND_get_rand_method() 720. #endif 721. 722. > const RAND_METHOD *RAND_get_rand_method(void) 723. { 724. #ifdef FIPS_MODE crypto/rand/rand_lib.c:725:5: 723. { 724. #ifdef FIPS_MODE 725. > return NULL; 726. #else 727. const RAND_METHOD *tmp_meth = NULL; crypto/rand/rand_lib.c:754:1: return from a call to RAND_get_rand_method 752. return tmp_meth; 753. #endif 754. > } 755. 756. #if !defined(OPENSSL_NO_ENGINE) && !defined(FIPS_MODE) crypto/rand/rand_lib.c:794:9: 792. const RAND_METHOD *meth = RAND_get_rand_method(); 793. 794. > if (meth->add != NULL) 795. meth->add(buf, num, randomness); 796. }
https://github.com/openssl/openssl/blob/363e941ed43c648adf4d6d0874077ddd80041e1f/crypto/rand/rand_lib.c/#L794
d2a_code_trace_data_41767
int X509_NAME_print(BIO *bp, X509_NAME *name, int obase) { char *s, *c, *b; int l, i; l = 80 - 2 - obase; b = X509_NAME_oneline(name, NULL, 0); if (!b) return 0; if (!*b) { OPENSSL_free(b); return 1; } s = b + 1; c = s; for (;;) { #ifndef CHARSET_EBCDIC if (((*s == '/') && ((s[1] >= 'A') && (s[1] <= 'Z') && ((s[2] == '=') || ((s[2] >= 'A') && (s[2] <= 'Z') && (s[3] == '=')) ))) || (*s == '\0')) #else if (((*s == '/') && (isupper(s[1]) && ((s[2] == '=') || (isupper(s[2]) && (s[3] == '=')) ))) || (*s == '\0')) #endif { i = s - c; if (BIO_write(bp, c, i) != i) goto err; c = s + 1; if (*s != '\0') { if (BIO_write(bp, ", ", 2) != 2) goto err; } l--; } if (*s == '\0') break; s++; l--; } OPENSSL_free(b); return 1; err: X509err(X509_F_X509_NAME_PRINT, ERR_R_BUF_LIB); OPENSSL_free(b); return 0; } crypto/x509/x_name.c:552: error: BUFFER_OVERRUN_L3 Offset: [4, +oo] (⇐ [1, +oo] + 3) Size: [1, 2147483644]. Showing all 6 steps of the trace crypto/x509/x_name.c:536:9: <Length trace> 534. l = 80 - 2 - obase; 535. 536. b = X509_NAME_oneline(name, NULL, 0); ^ 537. if (!b) 538. return 0; crypto/x509/x_name.c:536:9: Call 534. l = 80 - 2 - obase; 535. 536. b = X509_NAME_oneline(name, NULL, 0); ^ 537. if (!b) 538. return 0; crypto/x509/x509_obj.c:90:9: Assignment 88. len = 200; 89. } else if (len == 0) { 90. return NULL; ^ 91. } 92. if (a == NULL) { crypto/x509/x_name.c:536:5: Assignment 534. l = 80 - 2 - obase; 535. 536. b = X509_NAME_oneline(name, NULL, 0); ^ 537. if (!b) 538. return 0; crypto/x509/x_name.c:543:5: Assignment 541. return 1; 542. } 543. s = b + 1; /* skip the first slash */ ^ 544. 545. c = s; crypto/x509/x_name.c:552:55: Array access: Offset: [4, +oo] (⇐ [1, +oo] + 3) Size: [1, 2147483644] 550. ((s[2] >= 'A') 551. && (s[2] <= 'Z') 552. && (s[3] == '=')) ^ 553. ))) || (*s == '\0')) 554. #else
https://github.com/openssl/openssl/blob/b33d1141b6dcce947708b984c5e9e91dad3d675d/crypto/x509/x_name.c/#L552
d2a_code_trace_data_41768
int BN_set_word(BIGNUM *a, BN_ULONG w) { bn_check_top(a); if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) return (0); a->neg = 0; a->d[0] = w; a->top = (w ? 1 : 0); bn_check_top(a); return (1); } crypto/dsa/dsa_ossl.c:208: error: BUFFER_OVERRUN_L3 Offset: 0 Size: [0, 8388607] by call to `BN_div`. Showing all 11 steps of the trace crypto/dsa/dsa_ossl.c:133:1: Parameter `(*rp)->d` 131. } 132. 133. > static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, 134. BIGNUM **kinvp, BIGNUM **rp, 135. const unsigned char *dgst, int dlen) crypto/dsa/dsa_ossl.c:208:10: Call 206. 207. 208. if (!BN_mod(r, r, dsa->q, ctx)) ^ 209. goto err; 210. 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:409:9: Call 407. */ 408. int neg = num->neg; 409. BN_rshift(rm, snum, norm_shift); ^ 410. if (!BN_is_zero(rm)) 411. rm->neg = neg; crypto/bn/bn_shift.c:120:1: Parameter `*r->d` 118. } 119. 120. > int BN_rshift(BIGNUM *r, const BIGNUM *a, int n) 121. { 122. int i, j, nw, lb, rb; crypto/bn/bn_shift.c:138:9: Call 136. lb = BN_BITS2 - rb; 137. if (nw >= a->top || a->top == 0) { 138. BN_zero(r); ^ 139. return (1); 140. } crypto/bn/bn_lib.c:463:1: <Length trace> 461. } 462. 463. > int BN_set_word(BIGNUM *a, BN_ULONG w) 464. { 465. bn_check_top(a); crypto/bn/bn_lib.c:463:1: Parameter `*a->d` 461. } 462. 463. > int BN_set_word(BIGNUM *a, BN_ULONG w) 464. { 465. bn_check_top(a); crypto/bn/bn_lib.c:466:9: Call 464. { 465. bn_check_top(a); 466. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 467. return (0); 468. a->neg = 0; crypto/bn/bn_lcl.h:676:1: Parameter `*a->d` 674. int bn_probable_prime_dh_coprime(BIGNUM *rnd, int bits, BN_CTX *ctx); 675. 676. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 677. { 678. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_lib.c:469:5: Array access: Offset: 0 Size: [0, 8388607] by call to `BN_div` 467. return (0); 468. a->neg = 0; 469. a->d[0] = w; ^ 470. a->top = (w ? 1 : 0); 471. bn_check_top(a);
https://github.com/openssl/openssl/blob/ec772a817afc0f788c38006f623204a7d76221ec/crypto/bn/bn_lib.c/#L469
d2a_code_trace_data_41769
static void ocb_block_lshift(const unsigned char *in, size_t shift, unsigned char *out) { unsigned char shift_mask; int i; unsigned char mask[15]; shift_mask = 0xff; shift_mask <<= (8 - shift); for (i = 15; i >= 0; i--) { if (i > 0) { mask[i - 1] = in[i] & shift_mask; mask[i - 1] >>= 8 - shift; } out[i] = in[i] << shift; if (i != 15) { out[i] ^= mask[i]; } } } crypto/modes/ocb128.c:98: error: UNINITIALIZED_VALUE The value read from mask[_] was never initialized. Showing all 1 steps of the trace crypto/modes/ocb128.c:98:13: 96. 97. if (i != 15) { 98. > out[i] ^= mask[i]; 99. } 100. }
https://github.com/openssl/openssl/blob/1c86d8fd41458d35736ef5b04d7a76cbcf1a274c/crypto/modes/ocb128.c/#L98
d2a_code_trace_data_41770
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: [400+min(0, `c->synth_buf_offset[*]`), 401+max(511, `c->synth_buf_offset[*]`)] (⇐ [16+min(0, `c->synth_buf_offset[*]`), 17+max(511, `c->synth_buf_offset[*]`)] + 384) 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: [400+min(0, c->synth_buf_offset[*]), 401+max(511, c->synth_buf_offset[*])] (⇐ [16+min(0, c->synth_buf_offset[*]), 17+max(511, c->synth_buf_offset[*])] + 384) 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_41771
static int mpeg4video_probe(AVProbeData *probe_packet) { uint32_t temp_buffer= -1; int VO=0, VOL=0, VOP = 0, VISO = 0, res=0; int i; for(i=0; i<probe_packet->buf_size; i++){ temp_buffer = (temp_buffer<<8) + probe_packet->buf[i]; if ((temp_buffer & 0xffffff00) != 0x100) continue; if (temp_buffer == VOP_START_CODE) VOP++; else if (temp_buffer == VISUAL_OBJECT_START_CODE) VISO++; else if (temp_buffer < 0x120) VO++; else if (temp_buffer < 0x130) VOL++; else if ( !(0x1AF < temp_buffer && temp_buffer < 0x1B7) && !(0x1B9 < temp_buffer && temp_buffer < 0x1C4)) res++; } if ( VOP >= VISO && VOP >= VOL && VO >= VOL && VOL > 0 && res==0) return AVPROBE_SCORE_MAX/2; return 0; } libavformat/raw.c:373: error: Integer Overflow L1 ([1099511627520, +oo] + `*probe_packet->buf`):unsigned32. libavformat/raw.c:368:5: <LHS trace> 366. static int mpeg4video_probe(AVProbeData *probe_packet) 367. { 368. uint32_t temp_buffer= -1; ^ 369. int VO=0, VOL=0, VOP = 0, VISO = 0, res=0; 370. int i; libavformat/raw.c:368:5: Assignment 366. static int mpeg4video_probe(AVProbeData *probe_packet) 367. { 368. uint32_t temp_buffer= -1; ^ 369. int VO=0, VOL=0, VOP = 0, VISO = 0, res=0; 370. int i; libavformat/raw.c:366:1: <RHS trace> 364. #define VOP_START_CODE 0x000001b6 365. 366. static int mpeg4video_probe(AVProbeData *probe_packet) ^ 367. { 368. uint32_t temp_buffer= -1; libavformat/raw.c:366:1: Parameter `*probe_packet->buf` 364. #define VOP_START_CODE 0x000001b6 365. 366. static int mpeg4video_probe(AVProbeData *probe_packet) ^ 367. { 368. uint32_t temp_buffer= -1; libavformat/raw.c:373:9: Binary operation: ([1099511627520, +oo] + *probe_packet->buf):unsigned32 371. 372. for(i=0; i<probe_packet->buf_size; i++){ 373. temp_buffer = (temp_buffer<<8) + probe_packet->buf[i]; ^ 374. if ((temp_buffer & 0xffffff00) != 0x100) 375. continue;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/raw.c/#L373
d2a_code_trace_data_41772
void avfilter_unref_buffer(AVFilterBufferRef *ref) { if(!(--ref->buf->refcount)) ref->buf->free(ref->buf); av_free(ref->video); av_free(ref); } libavfilter/defaults.c:101: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer`. libavfilter/defaults.c:101:5: Call 99. out = link->dst->outputs[0]; 100. 101. avfilter_unref_buffer(link->cur_buf); ^ 102. link->cur_buf = NULL; 103. libavfilter/avfilter.c:61:1: <LHS trace> 59. } 60. 61. void avfilter_unref_buffer(AVFilterBufferRef *ref) ^ 62. { 63. if(!(--ref->buf->refcount)) libavfilter/avfilter.c:61:1: Parameter `ref->buf->refcount` 59. } 60. 61. void avfilter_unref_buffer(AVFilterBufferRef *ref) ^ 62. { 63. if(!(--ref->buf->refcount)) libavfilter/avfilter.c:63:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `avfilter_unref_buffer` 61. void avfilter_unref_buffer(AVFilterBufferRef *ref) 62. { 63. if(!(--ref->buf->refcount)) ^ 64. ref->buf->free(ref->buf); 65. av_free(ref->video);
https://github.com/libav/libav/blob/ad0d70c964f852a18e9ab8124f0e7aa8876cac6e/libavfilter/avfilter.c/#L63
d2a_code_trace_data_41773
int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) { char *v; int gmt = 0; int i; int y = 0, M = 0, d = 0, h = 0, m = 0, s = 0; char *f = NULL; int f_len = 0; i = tm->length; v = (char *)tm->data; if (i < 12) goto err; if (v[i - 1] == 'Z') gmt = 1; for (i = 0; i < 12; i++) if ((v[i] > '9') || (v[i] < '0')) goto err; y = (v[0] - '0') * 1000 + (v[1] - '0') * 100 + (v[2] - '0') * 10 + (v[3] - '0'); M = (v[4] - '0') * 10 + (v[5] - '0'); if ((M > 12) || (M < 1)) goto err; d = (v[6] - '0') * 10 + (v[7] - '0'); h = (v[8] - '0') * 10 + (v[9] - '0'); m = (v[10] - '0') * 10 + (v[11] - '0'); if (tm->length >= 14 && (v[12] >= '0') && (v[12] <= '9') && (v[13] >= '0') && (v[13] <= '9')) { s = (v[12] - '0') * 10 + (v[13] - '0'); if (tm->length >= 15 && v[14] == '.') { int l = tm->length; f = &v[14]; f_len = 1; while (14 + f_len < l && f[f_len] >= '0' && f[f_len] <= '9') ++f_len; } } if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s", mon[M - 1], d, h, m, s, f_len, f, y, (gmt) ? " GMT" : "") <= 0) return (0); else return (1); err: BIO_write(bp, "Bad time value", 14); return (0); } crypto/x509v3/v3_ocsp.c:183: error: BUFFER_OVERRUN_L3 Offset: [-529, +oo] Size: 12 by call to `ASN1_GENERALIZEDTIME_print`. Showing all 9 steps of the trace crypto/x509v3/v3_ocsp.c:167:14: Call 165. if (BIO_printf(bp, "%*scrlUrl: ", ind, "") <= 0) 166. goto err; 167. if (!ASN1_STRING_print(bp, (ASN1_STRING *)a->crlUrl)) ^ 168. goto err; 169. if (BIO_write(bp, "\n", 1) <= 0) crypto/asn1/t_x509.c:363:1: Parameter `*v->data` 361. } 362. 363. > int ASN1_STRING_print(BIO *bp, const ASN1_STRING *v) 364. { 365. int i, n; crypto/x509v3/v3_ocsp.c:183:14: Call 181. if (BIO_printf(bp, "%*scrlTime: ", ind, "") <= 0) 182. goto err; 183. if (!ASN1_GENERALIZEDTIME_print(bp, a->crlTime)) ^ 184. goto err; 185. if (BIO_write(bp, "\n", 1) <= 0) crypto/asn1/t_x509.c:407:1: <Offset trace> 405. }; 406. 407. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 408. { 409. char *v; crypto/asn1/t_x509.c:407:1: Parameter `*tm->data` 405. }; 406. 407. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 408. { 409. char *v; crypto/asn1/t_x509.c:428:5: Assignment 426. y = (v[0] - '0') * 1000 + (v[1] - '0') * 100 427. + (v[2] - '0') * 10 + (v[3] - '0'); 428. M = (v[4] - '0') * 10 + (v[5] - '0'); ^ 429. if ((M > 12) || (M < 1)) 430. goto err; crypto/asn1/t_x509.c:402:1: <Length trace> 400. } 401. 402. > static const char *mon[12] = { 403. "Jan", "Feb", "Mar", "Apr", "May", "Jun", 404. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" crypto/asn1/t_x509.c:402:1: Array declaration 400. } 401. 402. > static const char *mon[12] = { 403. "Jan", "Feb", "Mar", "Apr", "May", "Jun", 404. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" crypto/asn1/t_x509.c:449:20: Array access: Offset: [-529, +oo] Size: 12 by call to `ASN1_GENERALIZEDTIME_print` 447. 448. if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s", 449. mon[M - 1], d, h, m, s, f_len, f, y, ^ 450. (gmt) ? " GMT" : "") <= 0) 451. return (0);
https://github.com/openssl/openssl/blob/9c46f4b9cd4912b61cb546c48b678488d7f26ed6/crypto/asn1/t_x509.c/#L449
d2a_code_trace_data_41774
static void subshift(uint8_t s0[2][16], int s, uint8_t *box){ uint8_t (*s1)[16]= s0[0] - s; uint8_t (*s3)[16]= s0[0] + s; s0[0][0]=box[s0[1][ 0]]; s0[0][ 4]=box[s0[1][ 4]]; s0[0][ 8]=box[s0[1][ 8]]; s0[0][12]=box[s0[1][12]]; s1[0][3]=box[s1[1][ 7]]; s1[0][ 7]=box[s1[1][11]]; s1[0][11]=box[s1[1][15]]; s1[0][15]=box[s1[1][ 3]]; s0[0][2]=box[s0[1][10]]; s0[0][10]=box[s0[1][ 2]]; s0[0][ 6]=box[s0[1][14]]; s0[0][14]=box[s0[1][ 6]]; s3[0][1]=box[s3[1][13]]; s3[0][13]=box[s3[1][ 9]]; s3[0][ 9]=box[s3[1][ 5]]; s3[0][ 5]=box[s3[1][ 1]]; } libavutil/aes.c:102: error: Buffer Overrun L1 Offset: -2 Size: 4 by call to `crypt`. libavutil/aes.c:102:13: Call 100. }else{ 101. if(iv) addkey(a->state[1], a->state[1], iv); 102. crypt(a, 2, sbox, enc_multbl); ^ 103. addkey(dst, a->state[0], a->round_key[0]); 104. if(iv) memcpy(iv, dst, 16); libavutil/aes.c:80:1: Parameter `s` 78. } 79. 80. static inline void crypt(AVAES *a, int s, uint8_t *sbox, uint32_t *multbl){ ^ 81. int r; 82. libavutil/aes.c:87:5: Call 85. addkey(a->state[1], a->state[0], a->round_key[r]); 86. } 87. subshift(a->state[0][0], s, sbox); ^ 88. } 89. libavutil/aes.c:55:1: <Length trace> 53. } 54. 55. static void subshift(uint8_t s0[2][16], int s, uint8_t *box){ ^ 56. uint8_t (*s1)[16]= s0[0] - s; 57. uint8_t (*s3)[16]= s0[0] + s; libavutil/aes.c:55:1: Parameter `s` 53. } 54. 55. static void subshift(uint8_t s0[2][16], int s, uint8_t *box){ ^ 56. uint8_t (*s1)[16]= s0[0] - s; 57. uint8_t (*s3)[16]= s0[0] + s; libavutil/aes.c:56:5: Assignment 54. 55. static void subshift(uint8_t s0[2][16], int s, uint8_t *box){ 56. uint8_t (*s1)[16]= s0[0] - s; ^ 57. uint8_t (*s3)[16]= s0[0] + s; 58. s0[0][0]=box[s0[1][ 0]]; s0[0][ 4]=box[s0[1][ 4]]; s0[0][ 8]=box[s0[1][ 8]]; s0[0][12]=box[s0[1][12]]; libavutil/aes.c:59:5: Array access: Offset: -2 Size: 4 by call to `crypt` 57. uint8_t (*s3)[16]= s0[0] + s; 58. s0[0][0]=box[s0[1][ 0]]; s0[0][ 4]=box[s0[1][ 4]]; s0[0][ 8]=box[s0[1][ 8]]; s0[0][12]=box[s0[1][12]]; 59. s1[0][3]=box[s1[1][ 7]]; s1[0][ 7]=box[s1[1][11]]; s1[0][11]=box[s1[1][15]]; s1[0][15]=box[s1[1][ 3]]; ^ 60. s0[0][2]=box[s0[1][10]]; s0[0][10]=box[s0[1][ 2]]; s0[0][ 6]=box[s0[1][14]]; s0[0][14]=box[s0[1][ 6]]; 61. s3[0][1]=box[s3[1][13]]; s3[0][13]=box[s3[1][ 9]]; s3[0][ 9]=box[s3[1][ 5]]; s3[0][ 5]=box[s3[1][ 1]];
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavutil/aes.c/#L59
d2a_code_trace_data_41775
int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) { char *v; int gmt = 0; int i; int y = 0, M = 0, d = 0, h = 0, m = 0, s = 0; char *f = NULL; int f_len = 0; i = tm->length; v = (char *)tm->data; if (i < 12) goto err; if (v[i - 1] == 'Z') gmt = 1; for (i = 0; i < 12; i++) if ((v[i] > '9') || (v[i] < '0')) goto err; y = (v[0] - '0') * 1000 + (v[1] - '0') * 100 + (v[2] - '0') * 10 + (v[3] - '0'); M = (v[4] - '0') * 10 + (v[5] - '0'); if ((M > 12) || (M < 1)) goto err; d = (v[6] - '0') * 10 + (v[7] - '0'); h = (v[8] - '0') * 10 + (v[9] - '0'); m = (v[10] - '0') * 10 + (v[11] - '0'); if (tm->length >= 14 && (v[12] >= '0') && (v[12] <= '9') && (v[13] >= '0') && (v[13] <= '9')) { s = (v[12] - '0') * 10 + (v[13] - '0'); if (tm->length >= 15 && v[14] == '.') { int l = tm->length; f = &v[14]; f_len = 1; while (14 + f_len < l && f[f_len] >= '0' && f[f_len] <= '9') ++f_len; } } if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s", _asn1_mon[M - 1], d, h, m, s, f_len, f, y, (gmt) ? " GMT" : "") <= 0) return (0); else return (1); err: BIO_write(bp, "Bad time value", 14); return (0); } crypto/x509/t_crl.c:104: error: BUFFER_OVERRUN_L3 Offset: [-529, +oo] Size: 12 by call to `ASN1_TIME_print`. Showing all 17 steps of the trace crypto/x509/t_crl.c:96:9: Call 94. 95. BIO_printf(out, "Certificate Revocation List (CRL):\n"); 96. l = X509_CRL_get_version(x); ^ 97. BIO_printf(out, "%8sVersion %lu (0x%lx)\n", "", l + 1, l); 98. X509_CRL_get0_signature(&sig, &sig_alg, x); crypto/x509/x509cset.c:141:1: Parameter `*crl->crl.version->data` 139. } 140. 141. > long X509_CRL_get_version(X509_CRL *crl) 142. { 143. return ASN1_INTEGER_get(crl->crl.version); crypto/x509/x509cset.c:143:12: Call 141. long X509_CRL_get_version(X509_CRL *crl) 142. { 143. return ASN1_INTEGER_get(crl->crl.version); ^ 144. } 145. crypto/asn1/a_int.c:608:1: Parameter `*a->data` 606. } 607. 608. > long ASN1_INTEGER_get(const ASN1_INTEGER *a) 609. { 610. int i; crypto/x509/t_crl.c:99:5: Call 97. BIO_printf(out, "%8sVersion %lu (0x%lx)\n", "", l + 1, l); 98. X509_CRL_get0_signature(&sig, &sig_alg, x); 99. X509_signature_print(out, sig_alg, NULL); ^ 100. p = X509_NAME_oneline(X509_CRL_get_issuer(x), NULL, 0); 101. BIO_printf(out, "%8sIssuer: %s\n", "", p); crypto/x509/t_x509.c:326:1: Parameter `*sig->data` 324. } 325. 326. > int X509_signature_print(BIO *bp, X509_ALGOR *sigalg, ASN1_STRING *sig) 327. { 328. int sig_nid; crypto/x509/t_crl.c:100:9: Call 98. X509_CRL_get0_signature(&sig, &sig_alg, x); 99. X509_signature_print(out, sig_alg, NULL); 100. p = X509_NAME_oneline(X509_CRL_get_issuer(x), NULL, 0); ^ 101. BIO_printf(out, "%8sIssuer: %s\n", "", p); 102. OPENSSL_free(p); crypto/x509/x509_obj.c:67:1: Parameter `*buf` 65. #include "internal/x509_int.h" 66. 67. > char *X509_NAME_oneline(X509_NAME *a, char *buf, int len) 68. { 69. X509_NAME_ENTRY *ne; crypto/x509/t_crl.c:104:5: Call 102. OPENSSL_free(p); 103. BIO_printf(out, "%8sLast Update: ", ""); 104. ASN1_TIME_print(out, X509_CRL_get_lastUpdate(x)); ^ 105. BIO_printf(out, "\n%8sNext Update: ", ""); 106. if (X509_CRL_get_nextUpdate(x)) crypto/asn1/a_time.c:202:1: Parameter `*tm->data` 200. } 201. 202. > int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm) 203. { 204. if (tm->type == V_ASN1_UTCTIME) crypto/asn1/a_time.c:207:16: Call 205. return ASN1_UTCTIME_print(bp, tm); 206. if (tm->type == V_ASN1_GENERALIZEDTIME) 207. return ASN1_GENERALIZEDTIME_print(bp, tm); ^ 208. BIO_write(bp, "Bad time value", 14); 209. return (0); crypto/asn1/a_gentm.c:266:1: <Offset trace> 264. }; 265. 266. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 267. { 268. char *v; crypto/asn1/a_gentm.c:266:1: Parameter `*tm->data` 264. }; 265. 266. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 267. { 268. char *v; crypto/asn1/a_gentm.c:287:5: Assignment 285. y = (v[0] - '0') * 1000 + (v[1] - '0') * 100 286. + (v[2] - '0') * 10 + (v[3] - '0'); 287. M = (v[4] - '0') * 10 + (v[5] - '0'); ^ 288. if ((M > 12) || (M < 1)) 289. goto err; crypto/asn1/a_gentm.c:261:1: <Length trace> 259. } 260. 261. > const char *_asn1_mon[12] = { 262. "Jan", "Feb", "Mar", "Apr", "May", "Jun", 263. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" crypto/asn1/a_gentm.c:261:1: Array declaration 259. } 260. 261. > const char *_asn1_mon[12] = { 262. "Jan", "Feb", "Mar", "Apr", "May", "Jun", 263. "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" crypto/asn1/a_gentm.c:308:20: Array access: Offset: [-529, +oo] Size: 12 by call to `ASN1_TIME_print` 306. 307. if (BIO_printf(bp, "%s %2d %02d:%02d:%02d%.*s %d%s", 308. _asn1_mon[M - 1], d, h, m, s, f_len, f, y, ^ 309. (gmt) ? " GMT" : "") <= 0) 310. return (0);
https://github.com/openssl/openssl/blob/84cf97af0691290d53c0a51807fa15f0843219ef/crypto/asn1/a_gentm.c/#L308
d2a_code_trace_data_41776
static void unpack_input(const unsigned char *input, unsigned int *output) { unsigned int outbuffer[28]; unsigned short inbuffer[10]; unsigned int x; unsigned int *ptr; for (x=0;x<20;x+=2) inbuffer[x/2]=(input[x]<<8)+input[x+1]; ptr=outbuffer; *(ptr++)=27; *(ptr++)=(inbuffer[0]>>10)&0x3f; *(ptr++)=(inbuffer[0]>>5)&0x1f; *(ptr++)=inbuffer[0]&0x1f; *(ptr++)=(inbuffer[1]>>12)&0xf; *(ptr++)=(inbuffer[1]>>8)&0xf; *(ptr++)=(inbuffer[1]>>5)&7; *(ptr++)=(inbuffer[1]>>2)&7; *(ptr++)=((inbuffer[1]<<1)&6)|((inbuffer[2]>>15)&1); *(ptr++)=(inbuffer[2]>>12)&7; *(ptr++)=(inbuffer[2]>>10)&3; *(ptr++)=(inbuffer[2]>>5)&0x1f; *(ptr++)=((inbuffer[2]<<2)&0x7c)|((inbuffer[3]>>14)&3); *(ptr++)=(inbuffer[3]>>6)&0xff; *(ptr++)=((inbuffer[3]<<1)&0x7e)|((inbuffer[4]>>15)&1); *(ptr++)=(inbuffer[4]>>8)&0x7f; *(ptr++)=(inbuffer[4]>>1)&0x7f; *(ptr++)=((inbuffer[4]<<7)&0x80)|((inbuffer[5]>>9)&0x7f); *(ptr++)=(inbuffer[5]>>2)&0x7f; *(ptr++)=((inbuffer[5]<<5)&0x60)|((inbuffer[6]>>11)&0x1f); *(ptr++)=(inbuffer[6]>>4)&0x7f; *(ptr++)=((inbuffer[6]<<4)&0xf0)|((inbuffer[7]>>12)&0xf); *(ptr++)=(inbuffer[7]>>5)&0x7f; *(ptr++)=((inbuffer[7]<<2)&0x7c)|((inbuffer[8]>>14)&3); *(ptr++)=(inbuffer[8]>>7)&0x7f; *(ptr++)=((inbuffer[8]<<1)&0xfe)|((inbuffer[9]>>15)&1); *(ptr++)=(inbuffer[9]>>8)&0x7f; *(ptr++)=(inbuffer[9]>>1)&0x7f; *(output++)=outbuffer[11]; for (x=1;x<11;*(output++)=outbuffer[x++]); ptr=outbuffer+12; for (x=0;x<16;x+=4) { *(output++)=ptr[x]; *(output++)=ptr[x+2]; *(output++)=ptr[x+3]; *(output++)=ptr[x+1]; } } libavcodec/ra144.c:293: error: Uninitialized Value The value read from inbuffer[_] was never initialized. libavcodec/ra144.c:293:3: 291. *(ptr++)=(inbuffer[8]>>7)&0x7f; 292. *(ptr++)=((inbuffer[8]<<1)&0xfe)|((inbuffer[9]>>15)&1); 293. *(ptr++)=(inbuffer[9]>>8)&0x7f; ^ 294. *(ptr++)=(inbuffer[9]>>1)&0x7f; 295.
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ra144.c/#L293
d2a_code_trace_data_41777
int X509_check_purpose(X509 *x, int id, int ca) { int idx; const X509_PURPOSE *pt; x509v3_cache_extensions(x); if (id == -1) return 1; idx = X509_PURPOSE_get_by_id(id); if (idx == -1) return -1; pt = X509_PURPOSE_get0(idx); return pt->check_purpose(pt, x, ca); } crypto/x509v3/v3_purp.c:92: error: NULL_DEREFERENCE pointer `pt` last assigned on line 91 could be null and is dereferenced at line 92, column 12. Showing all 34 steps of the trace crypto/x509v3/v3_purp.c:78:1: start of procedure X509_check_purpose() 76. * things. 77. */ 78. > int X509_check_purpose(X509 *x, int id, int ca) 79. { 80. int idx; crypto/x509v3/v3_purp.c:83:5: Skipping x509v3_cache_extensions(): empty list of specs 81. const X509_PURPOSE *pt; 82. 83. x509v3_cache_extensions(x); ^ 84. 85. /* Return if side-effect only call */ crypto/x509v3/v3_purp.c:86:9: Taking false branch 84. 85. /* Return if side-effect only call */ 86. if (id == -1) ^ 87. return 1; 88. idx = X509_PURPOSE_get_by_id(id); crypto/x509v3/v3_purp.c:88:5: 86. if (id == -1) 87. return 1; 88. > idx = X509_PURPOSE_get_by_id(id); 89. if (idx == -1) 90. return -1; crypto/x509v3/v3_purp.c:133:1: start of procedure X509_PURPOSE_get_by_id() 131. } 132. 133. > int X509_PURPOSE_get_by_id(int purpose) 134. { 135. X509_PURPOSE tmp; crypto/x509v3/v3_purp.c:138:10: Taking true branch 136. int idx; 137. 138. if ((purpose >= X509_PURPOSE_MIN) && (purpose <= X509_PURPOSE_MAX)) ^ 139. return purpose - X509_PURPOSE_MIN; 140. if (xptable == NULL) crypto/x509v3/v3_purp.c:138:43: Taking false branch 136. int idx; 137. 138. if ((purpose >= X509_PURPOSE_MIN) && (purpose <= X509_PURPOSE_MAX)) ^ 139. return purpose - X509_PURPOSE_MIN; 140. if (xptable == NULL) crypto/x509v3/v3_purp.c:140:9: Taking false branch 138. if ((purpose >= X509_PURPOSE_MIN) && (purpose <= X509_PURPOSE_MAX)) 139. return purpose - X509_PURPOSE_MIN; 140. if (xptable == NULL) ^ 141. return -1; 142. tmp.purpose = purpose; crypto/x509v3/v3_purp.c:142:5: 140. if (xptable == NULL) 141. return -1; 142. > tmp.purpose = purpose; 143. idx = sk_X509_PURPOSE_find(xptable, &tmp); 144. if (idx < 0) crypto/x509v3/v3_purp.c:143:5: 141. return -1; 142. tmp.purpose = purpose; 143. > idx = sk_X509_PURPOSE_find(xptable, &tmp); 144. if (idx < 0) 145. return -1; include/openssl/x509v3.h:448:1: start of procedure sk_X509_PURPOSE_find() 446. # define X509V3_ADD_SILENT 0x10 447. 448. > DEFINE_STACK_OF(X509_PURPOSE) 449. 450. DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS) crypto/stack/stack.c:316:1: start of procedure OPENSSL_sk_find() 314. } 315. 316. > int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data) 317. { 318. return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH); crypto/stack/stack.c:318:5: 316. int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data) 317. { 318. > return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH); 319. } 320. crypto/stack/stack.c:287:1: start of procedure internal_find() 285. } 286. 287. > static int internal_find(OPENSSL_STACK *st, const void *data, 288. int ret_val_options) 289. { crypto/stack/stack.c:293:9: Taking false branch 291. int i; 292. 293. if (st == NULL || st->num == 0) ^ 294. return -1; 295. crypto/stack/stack.c:293:23: Taking false branch 291. int i; 292. 293. if (st == NULL || st->num == 0) ^ 294. return -1; 295. crypto/stack/stack.c:296:9: Taking true branch 294. return -1; 295. 296. if (st->comp == NULL) { ^ 297. for (i = 0; i < st->num; i++) 298. if (st->data[i] == data) crypto/stack/stack.c:297:14: 295. 296. if (st->comp == NULL) { 297. > for (i = 0; i < st->num; i++) 298. if (st->data[i] == data) 299. return i; crypto/stack/stack.c:297:21: Loop condition is true. Entering loop body 295. 296. if (st->comp == NULL) { 297. for (i = 0; i < st->num; i++) ^ 298. if (st->data[i] == data) 299. return i; crypto/stack/stack.c:298:17: Taking true branch 296. if (st->comp == NULL) { 297. for (i = 0; i < st->num; i++) 298. if (st->data[i] == data) ^ 299. return i; 300. return -1; crypto/stack/stack.c:299:17: 297. for (i = 0; i < st->num; i++) 298. if (st->data[i] == data) 299. > return i; 300. return -1; 301. } crypto/stack/stack.c:314:1: return from a call to internal_find 312. 313. return r == NULL ? -1 : (int)((const void **)r - st->data); 314. > } 315. 316. int OPENSSL_sk_find(OPENSSL_STACK *st, const void *data) crypto/stack/stack.c:319:1: return from a call to OPENSSL_sk_find 317. { 318. return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH); 319. > } 320. 321. int OPENSSL_sk_find_ex(OPENSSL_STACK *st, const void *data) include/openssl/x509v3.h:448:1: return from a call to sk_X509_PURPOSE_find 446. # define X509V3_ADD_SILENT 0x10 447. 448. > DEFINE_STACK_OF(X509_PURPOSE) 449. 450. DECLARE_ASN1_FUNCTIONS(BASIC_CONSTRAINTS) crypto/x509v3/v3_purp.c:144:9: Taking false branch 142. tmp.purpose = purpose; 143. idx = sk_X509_PURPOSE_find(xptable, &tmp); 144. if (idx < 0) ^ 145. return -1; 146. return idx + X509_PURPOSE_COUNT; crypto/x509v3/v3_purp.c:146:5: 144. if (idx < 0) 145. return -1; 146. > return idx + X509_PURPOSE_COUNT; 147. } 148. crypto/x509v3/v3_purp.c:147:1: return from a call to X509_PURPOSE_get_by_id 145. return -1; 146. return idx + X509_PURPOSE_COUNT; 147. > } 148. 149. int X509_PURPOSE_add(int id, int trust, int flags, crypto/x509v3/v3_purp.c:89:9: Taking false branch 87. return 1; 88. idx = X509_PURPOSE_get_by_id(id); 89. if (idx == -1) ^ 90. return -1; 91. pt = X509_PURPOSE_get0(idx); crypto/x509v3/v3_purp.c:91:5: 89. if (idx == -1) 90. return -1; 91. > pt = X509_PURPOSE_get0(idx); 92. return pt->check_purpose(pt, x, ca); 93. } crypto/x509v3/v3_purp.c:112:1: start of procedure X509_PURPOSE_get0() 110. } 111. 112. > X509_PURPOSE *X509_PURPOSE_get0(int idx) 113. { 114. if (idx < 0) crypto/x509v3/v3_purp.c:114:9: Taking true branch 112. X509_PURPOSE *X509_PURPOSE_get0(int idx) 113. { 114. if (idx < 0) ^ 115. return NULL; 116. if (idx < (int)X509_PURPOSE_COUNT) crypto/x509v3/v3_purp.c:115:9: 113. { 114. if (idx < 0) 115. > return NULL; 116. if (idx < (int)X509_PURPOSE_COUNT) 117. return xstandard + idx; crypto/x509v3/v3_purp.c:119:1: return from a call to X509_PURPOSE_get0 117. return xstandard + idx; 118. return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT); 119. > } 120. 121. int X509_PURPOSE_get_by_sname(const char *sname) crypto/x509v3/v3_purp.c:92:5: 90. return -1; 91. pt = X509_PURPOSE_get0(idx); 92. > return pt->check_purpose(pt, x, ca); 93. } 94.
https://github.com/openssl/openssl/blob/d0d0e8a71918816f7039f1f5443ebb3e28c06393/crypto/x509v3/v3_purp.c/#L92
d2a_code_trace_data_41778
static int encode_test_init(struct evp_test *t, const char *encoding) { struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata)); if (strcmp(encoding, "canonical") == 0) { edata->encoding = BASE64_CANONICAL_ENCODING; } else if (strcmp(encoding, "valid") == 0) { edata->encoding = BASE64_VALID_ENCODING; } else if (strcmp(encoding, "invalid") == 0) { edata->encoding = BASE64_INVALID_ENCODING; t->expected_err = OPENSSL_strdup("DECODE_ERROR"); if (t->expected_err == NULL) return 0; } else { fprintf(stderr, "Bad encoding: %s. Should be one of " "{canonical, valid, invalid}\n", encoding); return 0; } t->data = edata; return 1; } test/evp_test.c:1563: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_zalloc()` at line 1551, column 33 is not reachable after line 1563, column 17. Showing all 21 steps of the trace test/evp_test.c:1549:1: start of procedure encode_test_init() 1547. }; 1548. 1549. > static int encode_test_init(struct evp_test *t, const char *encoding) 1550. { 1551. struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata)); test/evp_test.c:1551:5: 1549. static int encode_test_init(struct evp_test *t, const char *encoding) 1550. { 1551. > struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata)); 1552. 1553. if (strcmp(encoding, "canonical") == 0) { crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking 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) test/evp_test.c:1553:9: Taking false branch 1551. struct encode_data *edata = OPENSSL_zalloc(sizeof(*edata)); 1552. 1553. if (strcmp(encoding, "canonical") == 0) { ^ 1554. edata->encoding = BASE64_CANONICAL_ENCODING; 1555. } else if (strcmp(encoding, "valid") == 0) { test/evp_test.c:1555:16: Taking false branch 1553. if (strcmp(encoding, "canonical") == 0) { 1554. edata->encoding = BASE64_CANONICAL_ENCODING; 1555. } else if (strcmp(encoding, "valid") == 0) { ^ 1556. edata->encoding = BASE64_VALID_ENCODING; 1557. } else if (strcmp(encoding, "invalid") == 0) { test/evp_test.c:1557:16: Taking false branch 1555. } else if (strcmp(encoding, "valid") == 0) { 1556. edata->encoding = BASE64_VALID_ENCODING; 1557. } else if (strcmp(encoding, "invalid") == 0) { ^ 1558. edata->encoding = BASE64_INVALID_ENCODING; 1559. t->expected_err = OPENSSL_strdup("DECODE_ERROR"); test/evp_test.c:1563:9: 1561. return 0; 1562. } else { 1563. > fprintf(stderr, "Bad encoding: %s. Should be one of " 1564. "{canonical, valid, invalid}\n", encoding); 1565. return 0;
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/evp_test.c/#L1563
d2a_code_trace_data_41779
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; bn_check_top(b); if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } crypto/ec/ec_key.c:221: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_priv_rand_range`. Showing all 24 steps of the trace crypto/ec/ec_key.c:198:1: Parameter `eckey->priv_key->top` 196. } 197. 198. > int ec_key_simple_generate_key(EC_KEY *eckey) 199. { 200. int ok = 0; crypto/ec/ec_key.c:221:14: Call 219. 220. do 221. if (!BN_priv_rand_range(priv_key, order)) ^ 222. goto err; 223. while (BN_is_zero(priv_key)) ; crypto/bn/bn_rand.c:182:1: Parameter `r->top` 180. } 181. 182. > int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range) 183. { 184. return bnrand_range(PRIVATE, r, range); crypto/bn/bn_rand.c:184:12: Call 182. int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range) 183. { 184. return bnrand_range(PRIVATE, r, range); ^ 185. } 186. crypto/bn/bn_rand.c:113:1: Parameter `r->top` 111. 112. /* random number r: 0 <= r < range */ 113. > static int bnrand_range(BNRAND_FLAG flag, BIGNUM *r, const BIGNUM *range) 114. { 115. int n; crypto/bn/bn_rand.c:128:9: Call 126. 127. if (n == 1) 128. BN_zero(r); ^ 129. else if (!BN_is_bit_set(range, n - 2) && !BN_is_bit_set(range, n - 3)) { 130. /* crypto/bn/bn_lib.c:357:1: Parameter `a->top` 355. } 356. 357. > int BN_set_word(BIGNUM *a, BN_ULONG w) 358. { 359. bn_check_top(a); crypto/bn/bn_lib.c:360:9: Call 358. { 359. bn_check_top(a); 360. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 361. return 0; 362. a->neg = 0; crypto/bn/bn_lcl.h:651:1: Parameter `a->top` 649. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 650. 651. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 652. { 653. if (bits > (INT_MAX - BN_BITS2 + 1)) crypto/bn/bn_lcl.h:659:12: Call 657. return a; 658. 659. return bn_expand2((a),(bits+BN_BITS2-1)/BN_BITS2); ^ 660. } 661. crypto/bn/bn_lib.c:246:1: Parameter `b->top` 244. */ 245. 246. > BIGNUM *bn_expand2(BIGNUM *b, int words) 247. { 248. bn_check_top(b); crypto/bn/bn_lib.c:251:23: Call 249. 250. if (words > b->dmax) { 251. BN_ULONG *a = bn_expand_internal(b, words); ^ 252. if (!a) 253. return NULL; crypto/bn/bn_lib.c:208:1: <Offset trace> 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:208:1: Parameter `b->top` 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:208:1: <Length trace> 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:208:1: Parameter `words` 206. /* This is used by bn_expand2() */ 207. /* The caller MUST check that words > b->dmax before calling this */ 208. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 209. { 210. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:225:13: Call 223. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 224. else 225. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 226. if (a == NULL) { 227. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/mem.c:228:1: Parameter `num` 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:17: Call 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/mem.c:230:5: Assignment 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:235:5: Assignment 233. if (ret != NULL) 234. memset(ret, 0, num); 235. return ret; ^ 236. } 237. crypto/bn/bn_lib.c:225:9: Assignment 223. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 224. else 225. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 226. if (a == NULL) { 227. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:233:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_priv_rand_range` 231. assert(b->top <= words); 232. if (b->top > 0) 233. memcpy(a, b->d, sizeof(*a) * b->top); ^ 234. 235. return a;
https://github.com/openssl/openssl/blob/49cd47eaababc8c57871b929080fc1357e2ad7b8/crypto/bn/bn_lib.c/#L233
d2a_code_trace_data_41780
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/statem/extensions_srvr.c:890: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: 29 by call to `tls_curve_allowed`. Showing all 8 steps of the trace ssl/statem/extensions_srvr.c:900:22: Call 898. 899. /* Add extension header */ 900. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_supported_groups) ^ 901. /* Sub-packet for supported_groups extension */ 902. || !WPACKET_start_sub_packet_u16(pkt) ssl/packet.c:312:1: Parameter `*pkt->buf->data` 310. } 311. 312. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 313. { 314. unsigned char *data; ssl/statem/extensions_srvr.c:890:13: Call 888. /* Copy group ID if supported */ 889. for (i = 0; i < numgroups; i++, groups += 2) { 890. if (tls_curve_allowed(s, groups, SSL_SECOP_CURVE_SUPPORTED)) { ^ 891. if (first) { 892. /* ssl/t1_lib.c:268:1: <Offset trace> 266. 267. /* See if curve is allowed by security callback */ 268. > int tls_curve_allowed(SSL *s, const unsigned char *curve, int op) 269. { 270. const tls_curve_info *cinfo; ssl/t1_lib.c:268:1: Parameter `*curve` 266. 267. /* See if curve is allowed by security callback */ 268. > int tls_curve_allowed(SSL *s, const unsigned char *curve, int op) 269. { 270. const tls_curve_info *cinfo; ssl/t1_lib.c:137:1: <Length trace> 135. * table: the index of each entry is one less than the TLS curve id. 136. */ 137. > static const tls_curve_info nid_list[] = { 138. {NID_sect163k1, 80, TLS_CURVE_CHAR2}, /* sect163k1 (1) */ 139. {NID_sect163r1, 80, TLS_CURVE_CHAR2}, /* sect163r1 (2) */ ssl/t1_lib.c:137:1: Array declaration 135. * table: the index of each entry is one less than the TLS curve id. 136. */ 137. > static const tls_curve_info nid_list[] = { 138. {NID_sect163k1, 80, TLS_CURVE_CHAR2}, /* sect163k1 (1) */ 139. {NID_sect163r1, 80, TLS_CURVE_CHAR2}, /* sect163r1 (2) */ ssl/t1_lib.c:275:5: Array access: Offset: [-1, +oo] Size: 29 by call to `tls_curve_allowed` 273. if ((curve[1] < 1) || ((size_t)curve[1] > OSSL_NELEM(nid_list))) 274. return 0; 275. cinfo = &nid_list[curve[1] - 1]; ^ 276. # ifdef OPENSSL_NO_EC2M 277. if (cinfo->flags & TLS_CURVE_CHAR2)
https://github.com/openssl/openssl/blob/7671342e550ed2de676b23c79d0e7f45a381c76e/ssl/t1_lib.c/#L275
d2a_code_trace_data_41781
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) { int i, nw, lb, rb; BN_ULONG *t, *f; BN_ULONG l; bn_check_top(r); bn_check_top(a); if (n < 0) { BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT); return 0; } nw = n / BN_BITS2; if (bn_wexpand(r, a->top + nw + 1) == NULL) return (0); r->neg = a->neg; lb = n % BN_BITS2; rb = BN_BITS2 - lb; f = a->d; t = r->d; t[a->top + nw] = 0; if (lb == 0) for (i = a->top - 1; i >= 0; i--) t[nw + i] = f[i]; else for (i = a->top - 1; i >= 0; i--) { l = f[i]; t[nw + i + 1] |= (l >> rb) & BN_MASK2; t[nw + i] = (l << lb) & BN_MASK2; } memset(t, 0, sizeof(*t) * nw); r->top = a->top + nw + 1; bn_correct_top(r); bn_check_top(r); return (1); } crypto/dh/dh_check.c:102: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_div`. Showing all 21 steps of the trace crypto/dh/dh_check.c:65:1: Parameter `dh->q->top` 63. */ 64. 65. > int DH_check(const DH *dh, int *ret) 66. { 67. int ok = 0, r; crypto/dh/dh_check.c:96:13: Call 94. *ret |= DH_NOT_SUITABLE_GENERATOR; 95. } 96. r = BN_is_prime_ex(dh->q, BN_prime_checks, ctx, NULL); ^ 97. if (r < 0) 98. goto err; crypto/bn/bn_prime.c:147:1: Parameter `a->top` 145. } 146. 147. > int BN_is_prime_ex(const BIGNUM *a, int checks, BN_CTX *ctx_passed, 148. BN_GENCB *cb) 149. { crypto/bn/bn_prime.c:150:12: Call 148. BN_GENCB *cb) 149. { 150. return BN_is_prime_fasttest_ex(a, checks, ctx_passed, 0, cb); ^ 151. } 152. crypto/bn/bn_prime.c: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/dh/dh_check.c:102:14: Call 100. *ret |= DH_CHECK_Q_NOT_PRIME; 101. /* Check p == 1 mod q i.e. q divides p - 1 */ 102. if (!BN_div(t1, t2, dh->p, dh->q, ctx)) ^ 103. goto err; 104. if (!BN_is_one(t2)) crypto/bn/bn_div.c:205:31: Call 203. 204. /* First we normalise the numbers */ 205. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 206. if (!(BN_lshift(sdiv, divisor, norm_shift))) 207. goto err; crypto/bn/bn_lib.c:167:9: Assignment 165. 166. if (BN_is_zero(a)) 167. return 0; ^ 168. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); 169. } crypto/bn/bn_div.c:205:5: Assignment 203. 204. /* First we normalise the numbers */ 205. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 206. if (!(BN_lshift(sdiv, divisor, norm_shift))) 207. goto err; crypto/bn/bn_div.c:206:11: Call 204. /* First we normalise the numbers */ 205. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); 206. if (!(BN_lshift(sdiv, divisor, norm_shift))) ^ 207. goto err; 208. sdiv->neg = 0; crypto/bn/bn_shift.c:83:1: <Offset trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `n` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:5: Assignment 95. } 96. 97. nw = n / BN_BITS2; ^ 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) 99. return (0); crypto/bn/bn_shift.c:83:1: <Length trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `*r->d` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:98:9: Call 96. 97. nw = n / BN_BITS2; 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 99. return (0); 100. r->neg = a->neg; crypto/bn/bn_lib.c:948:1: Parameter `*a->d` 946. } 947. 948. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:104:5: Assignment 102. rb = BN_BITS2 - lb; 103. f = a->d; 104. t = r->d; ^ 105. t[a->top + nw] = 0; 106. if (lb == 0) crypto/bn/bn_shift.c:112:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_div` 110. for (i = a->top - 1; i >= 0; i--) { 111. l = f[i]; 112. t[nw + i + 1] |= (l >> rb) & BN_MASK2; ^ 113. t[nw + i] = (l << lb) & BN_MASK2; 114. }
https://github.com/openssl/openssl/blob/757264207ad8650a89ea903d48ad89f61d56ea9c/crypto/bn/bn_shift.c/#L112
d2a_code_trace_data_41782
static int asn1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt) { const ASN1_ITEM *it = ASN1_ITEM_ptr(tt->item); int embed = tt->flags & ASN1_TFLG_EMBED; ASN1_VALUE *tval; int ret; if (embed) { tval = (ASN1_VALUE *)pval; pval = &tval; } if (tt->flags & ASN1_TFLG_OPTIONAL) { asn1_template_clear(pval, tt); return 1; } if (tt->flags & ASN1_TFLG_ADB_MASK) { *pval = NULL; return 1; } #ifndef OPENSSL_NO_CRYPTO_MDEBUG OPENSSL_mem_debug_push(tt->field_name ? tt->field_name : "asn1_template_new"); #endif if (tt->flags & ASN1_TFLG_SK_MASK) { STACK_OF(ASN1_VALUE) *skval; skval = sk_ASN1_VALUE_new_null(); if (!skval) { ASN1err(ASN1_F_ASN1_TEMPLATE_NEW, ERR_R_MALLOC_FAILURE); ret = 0; goto done; } *pval = (ASN1_VALUE *)skval; ret = 1; goto done; } ret = asn1_item_embed_new(pval, it, embed); done: #ifndef OPENSSL_NO_CRYPTO_MDEBUG OPENSSL_mem_debug_pop(); #endif return ret; } crypto/asn1/tasn_new.c:286: error: MEMORY_LEAK memory dynamically allocated by call to `sk_ASN1_VALUE_new_null()` at line 269, column 17 is not reachable after line 286, column 1. Showing all 60 steps of the trace crypto/asn1/tasn_new.c:242:1: start of procedure asn1_template_new() 240. } 241. 242. > static int asn1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt) 243. { 244. const ASN1_ITEM *it = ASN1_ITEM_ptr(tt->item); crypto/asn1/tasn_new.c:244:5: 242. static int asn1_template_new(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt) 243. { 244. > const ASN1_ITEM *it = ASN1_ITEM_ptr(tt->item); 245. int embed = tt->flags & ASN1_TFLG_EMBED; 246. ASN1_VALUE *tval; crypto/asn1/tasn_new.c:245:5: 243. { 244. const ASN1_ITEM *it = ASN1_ITEM_ptr(tt->item); 245. > int embed = tt->flags & ASN1_TFLG_EMBED; 246. ASN1_VALUE *tval; 247. int ret; crypto/asn1/tasn_new.c:248:9: Taking true branch 246. ASN1_VALUE *tval; 247. int ret; 248. if (embed) { ^ 249. tval = (ASN1_VALUE *)pval; 250. pval = &tval; crypto/asn1/tasn_new.c:249:9: 247. int ret; 248. if (embed) { 249. > tval = (ASN1_VALUE *)pval; 250. pval = &tval; 251. } crypto/asn1/tasn_new.c:250:9: 248. if (embed) { 249. tval = (ASN1_VALUE *)pval; 250. > pval = &tval; 251. } 252. if (tt->flags & ASN1_TFLG_OPTIONAL) { crypto/asn1/tasn_new.c:252:9: Taking false branch 250. pval = &tval; 251. } 252. if (tt->flags & ASN1_TFLG_OPTIONAL) { ^ 253. asn1_template_clear(pval, tt); 254. return 1; crypto/asn1/tasn_new.c:258:9: Taking false branch 256. /* If ANY DEFINED BY nothing to do */ 257. 258. if (tt->flags & ASN1_TFLG_ADB_MASK) { ^ 259. *pval = NULL; 260. return 1; crypto/asn1/tasn_new.c:267:9: Taking true branch 265. #endif 266. /* If SET OF or SEQUENCE OF, its a STACK */ 267. if (tt->flags & ASN1_TFLG_SK_MASK) { ^ 268. STACK_OF(ASN1_VALUE) *skval; 269. skval = sk_ASN1_VALUE_new_null(); crypto/asn1/tasn_new.c:269:9: 267. if (tt->flags & ASN1_TFLG_SK_MASK) { 268. STACK_OF(ASN1_VALUE) *skval; 269. > skval = sk_ASN1_VALUE_new_null(); 270. if (!skval) { 271. ASN1err(ASN1_F_ASN1_TEMPLATE_NEW, ERR_R_MALLOC_FAILURE); include/openssl/asn1t.h:967:1: start of procedure sk_ASN1_VALUE_new_null() 965. DECLARE_ASN1_ITEM(ZLONG) 966. 967. > DEFINE_STACK_OF(ASN1_VALUE) 968. 969. /* Functions used internally by the ASN1 code */ crypto/stack/stack.c:145:1: start of procedure sk_new_null() 143. } 144. 145. > _STACK *sk_new_null(void) 146. { 147. return sk_new((int (*)(const void *, const void *))0); crypto/stack/stack.c:147:5: 145. _STACK *sk_new_null(void) 146. { 147. > return sk_new((int (*)(const void *, const void *))0); 148. } 149. crypto/stack/stack.c:150:1: start of procedure sk_new() 148. } 149. 150. > _STACK *sk_new(int (*c) (const void *, const void *)) 151. { 152. _STACK *ret; crypto/stack/stack.c:154:9: 152. _STACK *ret; 153. 154. > if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == 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/stack/stack.c:154:9: Taking false branch 152. _STACK *ret; 153. 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) ^ 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) crypto/stack/stack.c:156:9: 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. > if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) 157. goto err; 158. ret->comp = c; 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/stack/stack.c:156:9: Taking false branch 154. if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL) 155. goto err; 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) ^ 157. goto err; 158. ret->comp = c; crypto/stack/stack.c:158:5: 156. if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL) 157. goto err; 158. > ret->comp = c; 159. ret->num_alloc = MIN_NODES; 160. return (ret); crypto/stack/stack.c:159:5: 157. goto err; 158. ret->comp = c; 159. > ret->num_alloc = MIN_NODES; 160. return (ret); 161. crypto/stack/stack.c:160:5: 158. ret->comp = c; 159. ret->num_alloc = MIN_NODES; 160. > return (ret); 161. 162. err: crypto/stack/stack.c:165:1: return from a call to sk_new 163. OPENSSL_free(ret); 164. return (NULL); 165. > } 166. 167. int sk_insert(_STACK *st, void *data, int loc) crypto/stack/stack.c:148:1: return from a call to sk_new_null 146. { 147. return sk_new((int (*)(const void *, const void *))0); 148. > } 149. 150. _STACK *sk_new(int (*c) (const void *, const void *)) include/openssl/asn1t.h:967:1: return from a call to sk_ASN1_VALUE_new_null 965. DECLARE_ASN1_ITEM(ZLONG) 966. 967. > DEFINE_STACK_OF(ASN1_VALUE) 968. 969. /* Functions used internally by the ASN1 code */ crypto/asn1/tasn_new.c:270:14: Taking false branch 268. STACK_OF(ASN1_VALUE) *skval; 269. skval = sk_ASN1_VALUE_new_null(); 270. if (!skval) { ^ 271. ASN1err(ASN1_F_ASN1_TEMPLATE_NEW, ERR_R_MALLOC_FAILURE); 272. ret = 0; crypto/asn1/tasn_new.c:275:9: 273. goto done; 274. } 275. > *pval = (ASN1_VALUE *)skval; 276. ret = 1; 277. goto done; crypto/asn1/tasn_new.c:276:9: 274. } 275. *pval = (ASN1_VALUE *)skval; 276. > ret = 1; 277. goto done; 278. } crypto/asn1/tasn_new.c:281:2: 279. /* Otherwise pass it back to the item routine */ 280. ret = asn1_item_embed_new(pval, it, embed); 281. > done: 282. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 283. OPENSSL_mem_debug_pop(); crypto/asn1/tasn_new.c:285:5: 283. OPENSSL_mem_debug_pop(); 284. #endif 285. > return ret; 286. } 287. crypto/asn1/tasn_new.c:286:1: return from a call to asn1_template_new 284. #endif 285. return ret; 286. > } 287. 288. static void asn1_template_clear(ASN1_VALUE **pval, const ASN1_TEMPLATE *tt)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/asn1/tasn_new.c/#L286
d2a_code_trace_data_41783
static int opt_vstats(void *optctx, const char *opt, const char *arg) { char filename[40]; time_t today2 = time(NULL); struct tm *today = localtime(&today2); snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, today->tm_sec); return opt_vstats_file(NULL, opt, filename); } avconv_opt.c:1815: error: Null Dereference pointer `today` last assigned on line 1813 could be null and is dereferenced at line 1815, column 69. avconv_opt.c:1809:1: start of procedure opt_vstats() 1807. } 1808. 1809. static int opt_vstats(void *optctx, const char *opt, const char *arg) ^ 1810. { 1811. char filename[40]; avconv_opt.c:1812:5: 1810. { 1811. char filename[40]; 1812. time_t today2 = time(NULL); ^ 1813. struct tm *today = localtime(&today2); 1814. avconv_opt.c:1813:5: 1811. char filename[40]; 1812. time_t today2 = time(NULL); 1813. struct tm *today = localtime(&today2); ^ 1814. 1815. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, avconv_opt.c:1815:5: 1813. struct tm *today = localtime(&today2); 1814. 1815. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, ^ 1816. today->tm_sec); 1817. return opt_vstats_file(NULL, opt, filename);
https://github.com/libav/libav/blob/2852740e23f91d6775714d7cc29b9a73e1111ce0/avconv_opt.c/#L1815
d2a_code_trace_data_41784
int tls_construct_client_verify(SSL *s) { unsigned char *p; EVP_PKEY *pkey; const EVP_MD *md = s->s3->tmp.md[s->cert->key - s->cert->pkeys]; EVP_MD_CTX *mctx; unsigned u = 0; unsigned long n = 0; long hdatalen = 0; void *hdata; mctx = EVP_MD_CTX_new(); if (mctx == NULL) { SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_MALLOC_FAILURE); goto err; } p = ssl_handshake_start(s); pkey = s->cert->key->privatekey; hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata); if (hdatalen <= 0) { SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_INTERNAL_ERROR); goto err; } if (SSL_USE_SIGALGS(s)) { if (!tls12_get_sigandhash(p, pkey, md)) { SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_INTERNAL_ERROR); goto err; } p += 2; n = 2; } #ifdef SSL_DEBUG fprintf(stderr, "Using client alg %s\n", EVP_MD_name(md)); #endif if (!EVP_SignInit_ex(mctx, md, NULL) || !EVP_SignUpdate(mctx, hdata, hdatalen) || (s->version == SSL3_VERSION && !EVP_MD_CTX_ctrl(mctx, EVP_CTRL_SSL3_MASTER_SECRET, s->session->master_key_length, s->session->master_key)) || !EVP_SignFinal(mctx, p + 2, &u, pkey)) { SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_EVP_LIB); goto err; } #ifndef OPENSSL_NO_GOST { int pktype = EVP_PKEY_id(pkey); if (pktype == NID_id_GostR3410_2001 || pktype == NID_id_GostR3410_2012_256 || pktype == NID_id_GostR3410_2012_512) BUF_reverse(p + 2, NULL, u); } #endif s2n(u, p); n += u + 2; if (!ssl3_digest_cached_records(s, 0)) goto err; if (!ssl_set_handshake_header(s, SSL3_MT_CERTIFICATE_VERIFY, n)) { SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_INTERNAL_ERROR); goto err; } EVP_MD_CTX_free(mctx); return 1; err: EVP_MD_CTX_free(mctx); return 0; } ssl/statem/statem_clnt.c:2675: error: MEMORY_LEAK memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 2617, column 12 is not reachable after line 2675, column 5. Showing all 50 steps of the trace ssl/statem/statem_clnt.c:2606:1: start of procedure tls_construct_client_verify() 2604. } 2605. 2606. > int tls_construct_client_verify(SSL *s) 2607. { 2608. unsigned char *p; ssl/statem/statem_clnt.c:2610:5: 2608. unsigned char *p; 2609. EVP_PKEY *pkey; 2610. > const EVP_MD *md = s->s3->tmp.md[s->cert->key - s->cert->pkeys]; 2611. EVP_MD_CTX *mctx; 2612. unsigned u = 0; ssl/statem/statem_clnt.c:2612:5: 2610. const EVP_MD *md = s->s3->tmp.md[s->cert->key - s->cert->pkeys]; 2611. EVP_MD_CTX *mctx; 2612. > unsigned u = 0; 2613. unsigned long n = 0; 2614. long hdatalen = 0; ssl/statem/statem_clnt.c:2613:5: 2611. EVP_MD_CTX *mctx; 2612. unsigned u = 0; 2613. > unsigned long n = 0; 2614. long hdatalen = 0; 2615. void *hdata; ssl/statem/statem_clnt.c:2614:5: 2612. unsigned u = 0; 2613. unsigned long n = 0; 2614. > long hdatalen = 0; 2615. void *hdata; 2616. ssl/statem/statem_clnt.c:2617:5: 2615. void *hdata; 2616. 2617. > mctx = EVP_MD_CTX_new(); 2618. if (mctx == NULL) { 2619. SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_MALLOC_FAILURE); crypto/evp/digest.c:44:1: start of procedure EVP_MD_CTX_new() 42. } 43. 44. > EVP_MD_CTX *EVP_MD_CTX_new(void) 45. { 46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); crypto/evp/digest.c:46:5: 44. EVP_MD_CTX *EVP_MD_CTX_new(void) 45. { 46. > return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 47. } 48. crypto/mem.c:98:1: start of procedure CRYPTO_zalloc() 96. } 97. 98. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 99. { 100. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:100:5: 98. void *CRYPTO_zalloc(size_t num, const char *file, int line) 99. { 100. > void *ret = CRYPTO_malloc(num, file, line); 101. 102. if (ret != NULL) crypto/mem.c:71:1: start of procedure CRYPTO_malloc() 69. } 70. 71. > void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. void *ret = NULL; crypto/mem.c:73:5: 71. void *CRYPTO_malloc(size_t num, const char *file, int line) 72. { 73. > void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:75:9: Taking false branch 73. void *ret = NULL; 74. 75. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 76. return malloc_impl(num, file, line); 77. crypto/mem.c:78:9: Taking false branch 76. return malloc_impl(num, file, line); 77. 78. if (num <= 0) ^ 79. return NULL; 80. crypto/mem.c:81:5: 79. return NULL; 80. 81. > allow_customize = 0; 82. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 83. if (call_malloc_debug) { crypto/mem.c:91:5: 89. } 90. #else 91. > osslargused(file); osslargused(line); 92. ret = malloc(num); 93. #endif crypto/mem.c:91:24: 89. } 90. #else 91. > osslargused(file); osslargused(line); 92. ret = malloc(num); 93. #endif crypto/mem.c:92:5: 90. #else 91. osslargused(file); osslargused(line); 92. > ret = malloc(num); 93. #endif 94. crypto/mem.c:95:5: 93. #endif 94. 95. > return ret; 96. } 97. crypto/mem.c:96:1: return from a call to CRYPTO_malloc 94. 95. return ret; 96. > } 97. 98. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:102:9: Taking true branch 100. void *ret = CRYPTO_malloc(num, file, line); 101. 102. if (ret != NULL) ^ 103. memset(ret, 0, num); 104. return ret; crypto/mem.c:103:9: 101. 102. if (ret != NULL) 103. > memset(ret, 0, num); 104. return ret; 105. } crypto/mem.c:104:5: 102. if (ret != NULL) 103. memset(ret, 0, num); 104. > return ret; 105. } 106. crypto/mem.c:105:1: return from a call to CRYPTO_zalloc 103. memset(ret, 0, num); 104. return ret; 105. > } 106. 107. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/evp/digest.c:47:1: return from a call to EVP_MD_CTX_new 45. { 46. return OPENSSL_zalloc(sizeof(EVP_MD_CTX)); 47. > } 48. 49. void EVP_MD_CTX_free(EVP_MD_CTX *ctx) ssl/statem/statem_clnt.c:2618:9: Taking false branch 2616. 2617. mctx = EVP_MD_CTX_new(); 2618. if (mctx == NULL) { ^ 2619. SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_MALLOC_FAILURE); 2620. goto err; ssl/statem/statem_clnt.c:2623:5: 2621. } 2622. 2623. > p = ssl_handshake_start(s); 2624. pkey = s->cert->key->privatekey; 2625. ssl/statem/statem_clnt.c:2624:5: 2622. 2623. p = ssl_handshake_start(s); 2624. > pkey = s->cert->key->privatekey; 2625. 2626. hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata); ssl/statem/statem_clnt.c:2626:5: 2624. pkey = s->cert->key->privatekey; 2625. 2626. > hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata); 2627. if (hdatalen <= 0) { 2628. SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_INTERNAL_ERROR); crypto/bio/bio_lib.c:343:1: start of procedure BIO_ctrl() 341. } 342. 343. > long BIO_ctrl(BIO *b, int cmd, long larg, void *parg) 344. { 345. long ret; crypto/bio/bio_lib.c:348:9: Taking false branch 346. long (*cb) (BIO *, int, const char *, int, long, long); 347. 348. if (b == NULL) ^ 349. return (0); 350. crypto/bio/bio_lib.c:351:10: Taking false branch 349. return (0); 350. 351. if ((b->method == NULL) || (b->method->ctrl == NULL)) { ^ 352. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); 353. return (-2); crypto/bio/bio_lib.c:351:33: Taking true branch 349. return (0); 350. 351. if ((b->method == NULL) || (b->method->ctrl == NULL)) { ^ 352. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); 353. return (-2); crypto/bio/bio_lib.c:352:9: Skipping ERR_put_error(): empty list of specs 350. 351. if ((b->method == NULL) || (b->method->ctrl == NULL)) { 352. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); ^ 353. return (-2); 354. } crypto/bio/bio_lib.c:353:9: 351. if ((b->method == NULL) || (b->method->ctrl == NULL)) { 352. BIOerr(BIO_F_BIO_CTRL, BIO_R_UNSUPPORTED_METHOD); 353. > return (-2); 354. } 355. crypto/bio/bio_lib.c:367:1: return from a call to BIO_ctrl 365. ret = cb(b, BIO_CB_CTRL | BIO_CB_RETURN, parg, cmd, larg, ret); 366. return (ret); 367. > } 368. 369. long BIO_callback_ctrl(BIO *b, int cmd, ssl/statem/statem_clnt.c:2627:9: Taking true branch 2625. 2626. hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata); 2627. if (hdatalen <= 0) { ^ 2628. SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_INTERNAL_ERROR); 2629. goto err; ssl/statem/statem_clnt.c:2628:9: Skipping ERR_put_error(): empty list of specs 2626. hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata); 2627. if (hdatalen <= 0) { 2628. SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_VERIFY, ERR_R_INTERNAL_ERROR); ^ 2629. goto err; 2630. } ssl/statem/statem_clnt.c:2674:2: 2672. EVP_MD_CTX_free(mctx); 2673. return 1; 2674. > err: 2675. EVP_MD_CTX_free(mctx); 2676. return 0; ssl/statem/statem_clnt.c:2675:5: 2673. return 1; 2674. err: 2675. > EVP_MD_CTX_free(mctx); 2676. return 0; 2677. } 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: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 true 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:165:30: Taking true 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:166:9: Skipping __function_pointer__(): unresolved function pointer 164. { 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { 166. free_impl(str, file, line); ^ 167. return; 168. } crypto/mem.c:167:9: 165. if (free_impl != NULL && free_impl != &CRYPTO_free) { 166. free_impl(str, file, line); 167. > return; 168. } 169. 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/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)
https://github.com/openssl/openssl/blob/70c22888c1648fe8652e77107f3c74bf2212de36/ssl/statem/statem_clnt.c/#L2675
d2a_code_trace_data_41785
static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) { AVIContext *avi = s->priv_data; ByteIOContext *pb = s->pb; uint32_t tag, tag1, handler; int codec_type, stream_index, frame_period, bit_rate; unsigned int size, nb_frames; int i; AVStream *st; AVIStream *ast = NULL; char str_track[4]; int avih_width=0, avih_height=0; int amv_file_format=0; avi->stream_index= -1; if (get_riff(avi, pb) < 0) return -1; avi->fsize = url_fsize(pb); if(avi->fsize<=0) avi->fsize= avi->riff_end; stream_index = -1; codec_type = -1; frame_period = 0; for(;;) { if (url_feof(pb)) goto fail; tag = get_le32(pb); size = get_le32(pb); #ifdef DEBUG print_tag("tag", tag, size); #endif switch(tag) { case MKTAG('L', 'I', 'S', 'T'): tag1 = get_le32(pb); #ifdef DEBUG print_tag("list", tag1, 0); #endif if (tag1 == MKTAG('m', 'o', 'v', 'i')) { avi->movi_list = url_ftell(pb) - 4; if(size) avi->movi_end = avi->movi_list + size + (size & 1); else avi->movi_end = url_fsize(pb); #ifdef DEBUG printf("movi end=%"PRIx64"\n", avi->movi_end); #endif goto end_of_header; } break; case MKTAG('d', 'm', 'l', 'h'): avi->is_odml = 1; url_fskip(pb, size + (size & 1)); break; case MKTAG('a', 'm', 'v', 'h'): amv_file_format=1; case MKTAG('a', 'v', 'i', 'h'): frame_period = get_le32(pb); bit_rate = get_le32(pb) * 8; get_le32(pb); avi->non_interleaved |= get_le32(pb) & AVIF_MUSTUSEINDEX; url_fskip(pb, 2 * 4); get_le32(pb); get_le32(pb); avih_width=get_le32(pb); avih_height=get_le32(pb); url_fskip(pb, size - 10 * 4); break; case MKTAG('s', 't', 'r', 'h'): tag1 = get_le32(pb); handler = get_le32(pb); if(tag1 == MKTAG('p', 'a', 'd', 's')){ url_fskip(pb, size - 8); break; }else{ stream_index++; st = av_new_stream(s, stream_index); if (!st) goto fail; ast = av_mallocz(sizeof(AVIStream)); if (!ast) goto fail; st->priv_data = ast; } if(amv_file_format) tag1 = stream_index ? MKTAG('a','u','d','s') : MKTAG('v','i','d','s'); #ifdef DEBUG print_tag("strh", tag1, -1); #endif if(tag1 == MKTAG('i', 'a', 'v', 's') || tag1 == MKTAG('i', 'v', 'a', 's')){ int64_t dv_dur; if (s->nb_streams != 1) goto fail; if (handler != MKTAG('d', 'v', 's', 'd') && handler != MKTAG('d', 'v', 'h', 'd') && handler != MKTAG('d', 'v', 's', 'l')) goto fail; ast = s->streams[0]->priv_data; av_freep(&s->streams[0]->codec->extradata); av_freep(&s->streams[0]); s->nb_streams = 0; if (ENABLE_DV_DEMUXER) { avi->dv_demux = dv_init_demux(s); if (!avi->dv_demux) goto fail; } s->streams[0]->priv_data = ast; url_fskip(pb, 3 * 4); ast->scale = get_le32(pb); ast->rate = get_le32(pb); url_fskip(pb, 4); dv_dur = get_le32(pb); if (ast->scale > 0 && ast->rate > 0 && dv_dur > 0) { dv_dur *= AV_TIME_BASE; s->duration = av_rescale(dv_dur, ast->scale, ast->rate); } stream_index = s->nb_streams - 1; url_fskip(pb, size - 9*4); break; } assert(stream_index < s->nb_streams); st->codec->stream_codec_tag= handler; get_le32(pb); get_le16(pb); get_le16(pb); get_le32(pb); ast->scale = get_le32(pb); ast->rate = get_le32(pb); if(ast->scale && ast->rate){ }else if(frame_period){ ast->rate = 1000000; ast->scale = frame_period; }else{ ast->rate = 25; ast->scale = 1; } av_set_pts_info(st, 64, ast->scale, ast->rate); ast->cum_len=get_le32(pb); nb_frames = get_le32(pb); st->start_time = 0; st->duration = nb_frames; get_le32(pb); get_le32(pb); ast->sample_size = get_le32(pb); ast->cum_len *= FFMAX(1, ast->sample_size); switch(tag1) { case MKTAG('v', 'i', 'd', 's'): codec_type = CODEC_TYPE_VIDEO; ast->sample_size = 0; break; case MKTAG('a', 'u', 'd', 's'): codec_type = CODEC_TYPE_AUDIO; break; case MKTAG('t', 'x', 't', 's'): codec_type = CODEC_TYPE_DATA; break; default: av_log(s, AV_LOG_ERROR, "unknown stream type %X\n", tag1); goto fail; } ast->frame_offset= ast->cum_len; url_fskip(pb, size - 12 * 4); break; case MKTAG('s', 't', 'r', 'f'): if (stream_index >= (unsigned)s->nb_streams || avi->dv_demux) { url_fskip(pb, size); } else { st = s->streams[stream_index]; switch(codec_type) { case CODEC_TYPE_VIDEO: if(amv_file_format){ st->codec->width=avih_width; st->codec->height=avih_height; st->codec->codec_type = CODEC_TYPE_VIDEO; st->codec->codec_id = CODEC_ID_AMV; url_fskip(pb, size); break; } get_le32(pb); st->codec->width = get_le32(pb); st->codec->height = get_le32(pb); get_le16(pb); st->codec->bits_per_sample= get_le16(pb); tag1 = get_le32(pb); get_le32(pb); get_le32(pb); get_le32(pb); get_le32(pb); get_le32(pb); if (tag1 == MKTAG('D', 'X', 'S', 'B')) { st->codec->codec_type = CODEC_TYPE_SUBTITLE; st->codec->codec_tag = tag1; st->codec->codec_id = CODEC_ID_XSUB; break; } if(size > 10*4 && size<(1<<30)){ st->codec->extradata_size= size - 10*4; st->codec->extradata= av_malloc(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE); get_buffer(pb, st->codec->extradata, st->codec->extradata_size); } if(st->codec->extradata_size & 1) get_byte(pb); if (st->codec->extradata_size && (st->codec->bits_per_sample <= 8)) { st->codec->palctrl = av_mallocz(sizeof(AVPaletteControl)); #ifdef WORDS_BIGENDIAN for (i = 0; i < FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)/4; i++) st->codec->palctrl->palette[i] = bswap_32(((uint32_t*)st->codec->extradata)[i]); #else memcpy(st->codec->palctrl->palette, st->codec->extradata, FFMIN(st->codec->extradata_size, AVPALETTE_SIZE)); #endif st->codec->palctrl->palette_changed = 1; } #ifdef DEBUG print_tag("video", tag1, 0); #endif st->codec->codec_type = CODEC_TYPE_VIDEO; st->codec->codec_tag = tag1; st->codec->codec_id = codec_get_id(codec_bmp_tags, tag1); st->need_parsing = AVSTREAM_PARSE_HEADERS; break; case CODEC_TYPE_AUDIO: get_wav_header(pb, st->codec, size); if(ast->sample_size && st->codec->block_align && ast->sample_size != st->codec->block_align){ av_log(s, AV_LOG_WARNING, "sample size (%d) != block align (%d)\n", ast->sample_size, st->codec->block_align); ast->sample_size= st->codec->block_align; } if (size%2) url_fskip(pb, 1); st->need_parsing = AVSTREAM_PARSE_TIMESTAMPS; if (st->codec->codec_id == CODEC_ID_AAC && st->codec->extradata_size) st->need_parsing = AVSTREAM_PARSE_NONE; if (st->codec->stream_codec_tag == ff_get_fourcc("Axan")){ st->codec->codec_id = CODEC_ID_XAN_DPCM; st->codec->codec_tag = 0; } if (amv_file_format) st->codec->codec_id = CODEC_ID_ADPCM_IMA_AMV; break; default: st->codec->codec_type = CODEC_TYPE_DATA; st->codec->codec_id= CODEC_ID_NONE; st->codec->codec_tag= 0; url_fskip(pb, size); break; } } break; case MKTAG('i', 'n', 'd', 'x'): i= url_ftell(pb); if(!url_is_streamed(pb) && !(s->flags & AVFMT_FLAG_IGNIDX)){ read_braindead_odml_indx(s, 0); } url_fseek(pb, i+size, SEEK_SET); break; case MKTAG('v', 'p', 'r', 'p'): if(stream_index < (unsigned)s->nb_streams && size > 9*4){ AVRational active, active_aspect; st = s->streams[stream_index]; get_le32(pb); get_le32(pb); get_le32(pb); get_le32(pb); get_le32(pb); active_aspect.den= get_le16(pb); active_aspect.num= get_le16(pb); active.num = get_le32(pb); active.den = get_le32(pb); get_le32(pb); if(active_aspect.num && active_aspect.den && active.num && active.den){ st->codec->sample_aspect_ratio= av_div_q(active_aspect, active); } size -= 9*4; } url_fseek(pb, size, SEEK_CUR); break; case MKTAG('I', 'N', 'A', 'M'): avi_read_tag(pb, s->title, sizeof(s->title), size); break; case MKTAG('I', 'A', 'R', 'T'): avi_read_tag(pb, s->author, sizeof(s->author), size); break; case MKTAG('I', 'C', 'O', 'P'): avi_read_tag(pb, s->copyright, sizeof(s->copyright), size); break; case MKTAG('I', 'C', 'M', 'T'): avi_read_tag(pb, s->comment, sizeof(s->comment), size); break; case MKTAG('I', 'G', 'N', 'R'): avi_read_tag(pb, s->genre, sizeof(s->genre), size); break; case MKTAG('I', 'P', 'R', 'D'): avi_read_tag(pb, s->album, sizeof(s->album), size); break; case MKTAG('I', 'P', 'R', 'T'): avi_read_tag(pb, str_track, sizeof(str_track), size); sscanf(str_track, "%d", &s->track); break; default: if(size > 1000000){ av_log(s, AV_LOG_ERROR, "well something went wrong during header parsing, " "ill ignore it and try to continue anyway\n"); avi->movi_list = url_ftell(pb) - 4; avi->movi_end = url_fsize(pb); goto end_of_header; } size += (size & 1); url_fskip(pb, size); break; } } end_of_header: if (stream_index != s->nb_streams - 1) { fail: for(i=0;i<s->nb_streams;i++) { av_freep(&s->streams[i]->codec->extradata); av_freep(&s->streams[i]); } return -1; } if(!avi->index_loaded && !url_is_streamed(pb)) avi_load_index(s); avi->index_loaded = 1; avi->non_interleaved |= guess_ni_flag(s); if(avi->non_interleaved) clean_index(s); return 0; } libavformat/avidec.c:593: error: Integer Overflow L2 ([0, max(20, `s->nb_streams`)] - 1):unsigned32. libavformat/avidec.c:227:1: <LHS trace> 225. } 226. 227. static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap) ^ 228. { 229. AVIContext *avi = s->priv_data; 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:593:9: Binary operation: ([0, max(20, s->nb_streams)] - 1):unsigned32 591. end_of_header: 592. /* check stream number */ 593. if (stream_index != s->nb_streams - 1) { ^ 594. fail: 595. for(i=0;i<s->nb_streams;i++) {
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/avidec.c/#L593
d2a_code_trace_data_41786
static void print_key_details(BIO *out, EVP_PKEY *key) { int keyid = EVP_PKEY_id(key); #ifndef OPENSSL_NO_EC if (keyid == EVP_PKEY_EC) { EC_KEY *ec = EVP_PKEY_get1_EC_KEY(key); int nid; const char *cname; nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec)); EC_KEY_free(ec); cname = EC_curve_nid2nist(nid); if (!cname) cname = OBJ_nid2sn(nid); BIO_printf(out, "%d bits EC (%s)", EVP_PKEY_bits(key), cname); } else #endif { const char *algname; switch (keyid) { case EVP_PKEY_RSA: algname = "RSA"; break; case EVP_PKEY_DSA: algname = "DSA"; break; case EVP_PKEY_DH: algname = "DH"; break; default: algname = OBJ_nid2sn(keyid); break; } BIO_printf(out, "%d bits %s", EVP_PKEY_bits(key), algname); } } test/ssltest_old.c:811: error: NULL_DEREFERENCE pointer `ec` last assigned on line 808 could be null and is dereferenced by call to `EC_KEY_get0_group()` at line 811, column 39. Showing all 19 steps of the trace test/ssltest_old.c:803:1: start of procedure print_key_details() 801. } 802. 803. > static void print_key_details(BIO *out, EVP_PKEY *key) 804. { 805. int keyid = EVP_PKEY_id(key); test/ssltest_old.c:805:5: 803. static void print_key_details(BIO *out, EVP_PKEY *key) 804. { 805. > int keyid = EVP_PKEY_id(key); 806. #ifndef OPENSSL_NO_EC 807. if (keyid == EVP_PKEY_EC) { crypto/evp/p_lib.c:378:1: start of procedure EVP_PKEY_id() 376. } 377. 378. > int EVP_PKEY_id(const EVP_PKEY *pkey) 379. { 380. return pkey->type; crypto/evp/p_lib.c:380:5: 378. int EVP_PKEY_id(const EVP_PKEY *pkey) 379. { 380. > return pkey->type; 381. } 382. crypto/evp/p_lib.c:381:1: return from a call to EVP_PKEY_id 379. { 380. return pkey->type; 381. > } 382. 383. int EVP_PKEY_base_id(const EVP_PKEY *pkey) test/ssltest_old.c:807:9: Taking true branch 805. int keyid = EVP_PKEY_id(key); 806. #ifndef OPENSSL_NO_EC 807. if (keyid == EVP_PKEY_EC) { ^ 808. EC_KEY *ec = EVP_PKEY_get1_EC_KEY(key); 809. int nid; test/ssltest_old.c:808:9: 806. #ifndef OPENSSL_NO_EC 807. if (keyid == EVP_PKEY_EC) { 808. > EC_KEY *ec = EVP_PKEY_get1_EC_KEY(key); 809. int nid; 810. const char *cname; crypto/evp/p_lib.c:325:1: start of procedure EVP_PKEY_get1_EC_KEY() 323. } 324. 325. > EC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey) 326. { 327. EC_KEY *ret = EVP_PKEY_get0_EC_KEY(pkey); crypto/evp/p_lib.c:327:5: 325. EC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey) 326. { 327. > EC_KEY *ret = EVP_PKEY_get0_EC_KEY(pkey); 328. if (ret != NULL) 329. EC_KEY_up_ref(ret); crypto/evp/p_lib.c:316:1: start of procedure EVP_PKEY_get0_EC_KEY() 314. } 315. 316. > EC_KEY *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey) 317. { 318. if (pkey->type != EVP_PKEY_EC) { crypto/evp/p_lib.c:318:9: Taking false branch 316. EC_KEY *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey) 317. { 318. if (pkey->type != EVP_PKEY_EC) { ^ 319. EVPerr(EVP_F_EVP_PKEY_GET0_EC_KEY, EVP_R_EXPECTING_A_EC_KEY); 320. return NULL; crypto/evp/p_lib.c:322:5: 320. return NULL; 321. } 322. > return pkey->pkey.ec; 323. } 324. crypto/evp/p_lib.c:323:1: return from a call to EVP_PKEY_get0_EC_KEY 321. } 322. return pkey->pkey.ec; 323. > } 324. 325. EC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey) crypto/evp/p_lib.c:328:9: Taking false branch 326. { 327. EC_KEY *ret = EVP_PKEY_get0_EC_KEY(pkey); 328. if (ret != NULL) ^ 329. EC_KEY_up_ref(ret); 330. return ret; crypto/evp/p_lib.c:330:5: 328. if (ret != NULL) 329. EC_KEY_up_ref(ret); 330. > return ret; 331. } 332. #endif crypto/evp/p_lib.c:331:1: return from a call to EVP_PKEY_get1_EC_KEY 329. EC_KEY_up_ref(ret); 330. return ret; 331. > } 332. #endif 333. test/ssltest_old.c:811:9: 809. int nid; 810. const char *cname; 811. > nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec)); 812. EC_KEY_free(ec); 813. cname = EC_curve_nid2nist(nid); crypto/ec/ec_key.c:419:1: start of procedure EC_KEY_get0_group() 417. } 418. 419. > const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key) 420. { 421. return key->group; crypto/ec/ec_key.c:421:5: 419. const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key) 420. { 421. > return key->group; 422. } 423.
https://github.com/openssl/openssl/blob/f7a39a5a3f7f91e0d1ba0030323eef26bc8ccddf/test/ssltest_old.c/#L811
d2a_code_trace_data_41787
static char *t_tob64(char *dst, const unsigned char *src, int size) { int c, pos = size % 3; unsigned char b0 = 0, b1 = 0, b2 = 0, notleading = 0; char *olddst = dst; switch (pos) { case 1: b2 = src[0]; break; case 2: b1 = src[0]; b2 = src[1]; break; } while (1) { c = (b0 & 0xfc) >> 2; if (notleading || c != 0) { *dst++ = b64table[c]; notleading = 1; } c = ((b0 & 3) << 4) | ((b1 & 0xf0) >> 4); if (notleading || c != 0) { *dst++ = b64table[c]; notleading = 1; } c = ((b1 & 0xf) << 2) | ((b2 & 0xc0) >> 6); if (notleading || c != 0) { *dst++ = b64table[c]; notleading = 1; } c = b2 & 0x3f; if (notleading || c != 0) { *dst++ = b64table[c]; notleading = 1; } if (pos >= size) break; else { b0 = src[pos++]; b1 = src[pos++]; b2 = src[pos++]; } } *dst++ = '\0'; return olddst; } crypto/srp/srp_vfy.c:568: error: BUFFER_OVERRUN_L3 Offset: [-2, +oo] Size: 2500 by call to `t_tob64`. Showing all 7 steps of the trace crypto/srp/srp_vfy.c:520:1: Array declaration 518. * create a verifier (*salt,*verifier,g and N are in base64) 519. */ 520. > char *SRP_create_verifier(const char *user, const char *pass, char **salt, 521. char **verifier, const char *N, const char *g) 522. { crypto/srp/srp_vfy.c:568:5: Call 566. if (((vf = OPENSSL_malloc(BN_num_bytes(v) * 2)) == NULL)) 567. goto err; 568. t_tob64(vf, tmp, BN_num_bytes(v)); ^ 569. 570. *verifier = vf; crypto/srp/srp_vfy.c:138:1: <Offset trace> 136. * Convert a raw byte string into a null-terminated base64 ASCII string. 137. */ 138. > static char *t_tob64(char *dst, const unsigned char *src, int size) 139. { 140. int c, pos = size % 3; crypto/srp/srp_vfy.c:138:1: Parameter `size` 136. * Convert a raw byte string into a null-terminated base64 ASCII string. 137. */ 138. > static char *t_tob64(char *dst, const unsigned char *src, int size) 139. { 140. int c, pos = size % 3; crypto/srp/srp_vfy.c:138:1: <Length trace> 136. * Convert a raw byte string into a null-terminated base64 ASCII string. 137. */ 138. > static char *t_tob64(char *dst, const unsigned char *src, int size) 139. { 140. int c, pos = size % 3; crypto/srp/srp_vfy.c:138:1: Parameter `*src` 136. * Convert a raw byte string into a null-terminated base64 ASCII string. 137. */ 138. > static char *t_tob64(char *dst, const unsigned char *src, int size) 139. { 140. int c, pos = size % 3; crypto/srp/srp_vfy.c:178:18: Array access: Offset: [-2, +oo] Size: 2500 by call to `t_tob64` 176. break; 177. else { 178. b0 = src[pos++]; ^ 179. b1 = src[pos++]; 180. b2 = src[pos++];
https://github.com/openssl/openssl/blob/9c46f4b9cd4912b61cb546c48b678488d7f26ed6/crypto/srp/srp_vfy.c/#L178
d2a_code_trace_data_41788
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:482: 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:472:5: Array declaration 470. const char log_id[] = "3xwuwRUAlFJHqWFoMl3cXHlZ6PfG04j8AC4LvT9012Q="; 471. const uint64_t timestamp = 1; 472. const char extensions[] = ""; ^ 473. const char signature[] = "BAMARzBAMiBIL2dRrzXbplQ2vh/WZA89v5pBQpSVkkUwKI+j5" 474. "eI+BgIhAOTtwNs6xXKx4vXoq2poBlOYfc9BAn3+/6EFUZ2J7b8I"; test/ct_test.c:482:10: Call 480. 481. fixture->sct_list = sk_SCT_new_null(); 482. if (!TEST_ptr(sct = SCT_new_from_base64(SCT_VERSION_V1, log_id, ^ 483. CT_LOG_ENTRY_TYPE_X509, timestamp, 484. 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/a35f607c9f9112c649b367d05639394fc1c30771/crypto/ct/ct_b64.c/#L50
d2a_code_trace_data_41789
static int mov_write_ctts_tag(AVIOContext *pb, MOVTrack *track) { MOVStts *ctts_entries; uint32_t entries = 0; uint32_t atom_size; int i; ctts_entries = av_malloc((track->entry + 1) * sizeof(*ctts_entries)); ctts_entries[0].count = 1; ctts_entries[0].duration = track->cluster[0].cts; for (i=1; i<track->entry; i++) { if (track->cluster[i].cts == ctts_entries[entries].duration) { ctts_entries[entries].count++; } else { entries++; ctts_entries[entries].duration = track->cluster[i].cts; ctts_entries[entries].count = 1; } } entries++; atom_size = 16 + (entries * 8); avio_wb32(pb, atom_size); ffio_wfourcc(pb, "ctts"); avio_wb32(pb, 0); avio_wb32(pb, entries); for (i=0; i<entries; i++) { avio_wb32(pb, ctts_entries[i].count); avio_wb32(pb, ctts_entries[i].duration); } av_free(ctts_entries); return atom_size; } libavformat/movenc.c:948: error: Null Dereference pointer `ctts_entries` last assigned on line 947 could be null and is dereferenced at line 948, column 5. libavformat/movenc.c:940:1: start of procedure mov_write_ctts_tag() 938. } 939. 940. static int mov_write_ctts_tag(AVIOContext *pb, MOVTrack *track) ^ 941. { 942. MOVStts *ctts_entries; libavformat/movenc.c:943:5: 941. { 942. MOVStts *ctts_entries; 943. uint32_t entries = 0; ^ 944. uint32_t atom_size; 945. int i; libavformat/movenc.c:947:5: 945. int i; 946. 947. ctts_entries = av_malloc((track->entry + 1) * sizeof(*ctts_entries)); /* worst case */ ^ 948. ctts_entries[0].count = 1; 949. ctts_entries[0].duration = track->cluster[0].cts; 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:948:5: 946. 947. ctts_entries = av_malloc((track->entry + 1) * sizeof(*ctts_entries)); /* worst case */ 948. ctts_entries[0].count = 1; ^ 949. ctts_entries[0].duration = track->cluster[0].cts; 950. for (i=1; i<track->entry; i++) {
https://github.com/libav/libav/blob/4bf3c8f226252e18de8051fd0d417c1d39857b67/libavformat/movenc.c/#L948
d2a_code_trace_data_41790
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { AVFrame *frame = data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; LclDecContext * const c = avctx->priv_data; unsigned int pixel_ptr; int row, col; unsigned char *encoded, *outptr; uint8_t *y_out, *u_out, *v_out; unsigned int width = avctx->width; unsigned int height = avctx->height; unsigned int mszh_dlen; unsigned char yq, y1q, uq, vq; int uqvq, ret; unsigned int mthread_inlen, mthread_outlen; unsigned int len = buf_size; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } outptr = frame->data[0]; switch (avctx->codec_id) { case AV_CODEC_ID_MSZH: switch (c->compression) { case COMP_MSZH: if (c->flags & FLAG_MULTITHREAD) { mthread_inlen = AV_RL32(buf); mthread_inlen = FFMIN(mthread_inlen, len - 8); mthread_outlen = AV_RL32(buf + 4); mthread_outlen = FFMIN(mthread_outlen, c->decomp_size); mszh_dlen = mszh_decomp(buf + 8, mthread_inlen, c->decomp_buf, c->decomp_size); if (mthread_outlen != mszh_dlen) { av_log(avctx, AV_LOG_ERROR, "Mthread1 decoded size differs (%d != %d)\n", mthread_outlen, mszh_dlen); return AVERROR_INVALIDDATA; } mszh_dlen = mszh_decomp(buf + 8 + mthread_inlen, len - 8 - mthread_inlen, c->decomp_buf + mthread_outlen, c->decomp_size - mthread_outlen); if (mthread_outlen != mszh_dlen) { av_log(avctx, AV_LOG_ERROR, "Mthread2 decoded size differs (%d != %d)\n", mthread_outlen, mszh_dlen); return AVERROR_INVALIDDATA; } encoded = c->decomp_buf; len = c->decomp_size; } else { mszh_dlen = mszh_decomp(buf, len, c->decomp_buf, c->decomp_size); if (c->decomp_size != mszh_dlen) { av_log(avctx, AV_LOG_ERROR, "Decoded size differs (%d != %d)\n", c->decomp_size, mszh_dlen); return AVERROR_INVALIDDATA; } encoded = c->decomp_buf; len = mszh_dlen; } break; case COMP_MSZH_NOCOMP: { int bppx2; switch (c->imgtype) { case IMGTYPE_YUV111: case IMGTYPE_RGB24: bppx2 = 6; break; case IMGTYPE_YUV422: case IMGTYPE_YUV211: bppx2 = 4; break; case IMGTYPE_YUV411: case IMGTYPE_YUV420: bppx2 = 3; break; default: bppx2 = 0; break; } if (len < ((width * height * bppx2) >> 1)) return AVERROR_INVALIDDATA; break; } default: av_log(avctx, AV_LOG_ERROR, "BUG! Unknown MSZH compression in frame decoder.\n"); return AVERROR_INVALIDDATA; } break; #if CONFIG_ZLIB_DECODER case AV_CODEC_ID_ZLIB: if (c->compression == COMP_ZLIB_NORMAL && c->imgtype == IMGTYPE_RGB24 && len == width * height * 3) { if (c->flags & FLAG_PNGFILTER) { memcpy(c->decomp_buf, buf, len); encoded = c->decomp_buf; } else { break; } } else if (c->flags & FLAG_MULTITHREAD) { mthread_inlen = AV_RL32(buf); mthread_inlen = FFMIN(mthread_inlen, len - 8); mthread_outlen = AV_RL32(buf + 4); mthread_outlen = FFMIN(mthread_outlen, c->decomp_size); ret = zlib_decomp(avctx, buf + 8, mthread_inlen, 0, mthread_outlen); if (ret < 0) return ret; ret = zlib_decomp(avctx, buf + 8 + mthread_inlen, len - 8 - mthread_inlen, mthread_outlen, mthread_outlen); if (ret < 0) return ret; } else { int ret = zlib_decomp(avctx, buf, len, 0, c->decomp_size); if (ret < 0) return ret; } encoded = c->decomp_buf; len = c->decomp_size; break; #endif default: av_log(avctx, AV_LOG_ERROR, "BUG! Unknown codec in frame decoder compression switch.\n"); return AVERROR_INVALIDDATA; } if (avctx->codec_id == AV_CODEC_ID_ZLIB && (c->flags & FLAG_PNGFILTER)) { switch (c->imgtype) { case IMGTYPE_YUV111: case IMGTYPE_RGB24: for (row = 0; row < height; row++) { pixel_ptr = row * width * 3; yq = encoded[pixel_ptr++]; uqvq = AV_RL16(encoded+pixel_ptr); pixel_ptr += 2; for (col = 1; col < width; col++) { encoded[pixel_ptr] = yq -= encoded[pixel_ptr]; uqvq -= AV_RL16(encoded+pixel_ptr+1); AV_WL16(encoded+pixel_ptr+1, uqvq); pixel_ptr += 3; } } break; case IMGTYPE_YUV422: for (row = 0; row < height; row++) { pixel_ptr = row * width * 2; yq = uq = vq =0; for (col = 0; col < width/4; col++) { encoded[pixel_ptr] = yq -= encoded[pixel_ptr]; encoded[pixel_ptr+1] = yq -= encoded[pixel_ptr+1]; encoded[pixel_ptr+2] = yq -= encoded[pixel_ptr+2]; encoded[pixel_ptr+3] = yq -= encoded[pixel_ptr+3]; encoded[pixel_ptr+4] = uq -= encoded[pixel_ptr+4]; encoded[pixel_ptr+5] = uq -= encoded[pixel_ptr+5]; encoded[pixel_ptr+6] = vq -= encoded[pixel_ptr+6]; encoded[pixel_ptr+7] = vq -= encoded[pixel_ptr+7]; pixel_ptr += 8; } } break; case IMGTYPE_YUV411: for (row = 0; row < height; row++) { pixel_ptr = row * width / 2 * 3; yq = uq = vq =0; for (col = 0; col < width/4; col++) { encoded[pixel_ptr] = yq -= encoded[pixel_ptr]; encoded[pixel_ptr+1] = yq -= encoded[pixel_ptr+1]; encoded[pixel_ptr+2] = yq -= encoded[pixel_ptr+2]; encoded[pixel_ptr+3] = yq -= encoded[pixel_ptr+3]; encoded[pixel_ptr+4] = uq -= encoded[pixel_ptr+4]; encoded[pixel_ptr+5] = vq -= encoded[pixel_ptr+5]; pixel_ptr += 6; } } break; case IMGTYPE_YUV211: for (row = 0; row < height; row++) { pixel_ptr = row * width * 2; yq = uq = vq =0; for (col = 0; col < width/2; col++) { encoded[pixel_ptr] = yq -= encoded[pixel_ptr]; encoded[pixel_ptr+1] = yq -= encoded[pixel_ptr+1]; encoded[pixel_ptr+2] = uq -= encoded[pixel_ptr+2]; encoded[pixel_ptr+3] = vq -= encoded[pixel_ptr+3]; pixel_ptr += 4; } } break; case IMGTYPE_YUV420: for (row = 0; row < height/2; row++) { pixel_ptr = row * width * 3; yq = y1q = uq = vq =0; for (col = 0; col < width/2; col++) { encoded[pixel_ptr] = yq -= encoded[pixel_ptr]; encoded[pixel_ptr+1] = yq -= encoded[pixel_ptr+1]; encoded[pixel_ptr+2] = y1q -= encoded[pixel_ptr+2]; encoded[pixel_ptr+3] = y1q -= encoded[pixel_ptr+3]; encoded[pixel_ptr+4] = uq -= encoded[pixel_ptr+4]; encoded[pixel_ptr+5] = vq -= encoded[pixel_ptr+5]; pixel_ptr += 6; } } break; default: av_log(avctx, AV_LOG_ERROR, "BUG! Unknown imagetype in pngfilter switch.\n"); return AVERROR_INVALIDDATA; } } y_out = frame->data[0] + (height - 1) * frame->linesize[0]; u_out = frame->data[1] + (height - 1) * frame->linesize[1]; v_out = frame->data[2] + (height - 1) * frame->linesize[2]; switch (c->imgtype) { case IMGTYPE_YUV111: for (row = 0; row < height; row++) { for (col = 0; col < width; col++) { y_out[col] = *encoded++; u_out[col] = *encoded++ + 128; v_out[col] = *encoded++ + 128; } y_out -= frame->linesize[0]; u_out -= frame->linesize[1]; v_out -= frame->linesize[2]; } break; case IMGTYPE_YUV422: for (row = 0; row < height; row++) { for (col = 0; col < width - 3; col += 4) { memcpy(y_out + col, encoded, 4); encoded += 4; u_out[ col >> 1 ] = *encoded++ + 128; u_out[(col >> 1) + 1] = *encoded++ + 128; v_out[ col >> 1 ] = *encoded++ + 128; v_out[(col >> 1) + 1] = *encoded++ + 128; } y_out -= frame->linesize[0]; u_out -= frame->linesize[1]; v_out -= frame->linesize[2]; } break; case IMGTYPE_RGB24: for (row = height - 1; row >= 0; row--) { pixel_ptr = row * frame->linesize[0]; memcpy(outptr + pixel_ptr, encoded, 3 * width); encoded += 3 * width; } break; case IMGTYPE_YUV411: for (row = 0; row < height; row++) { for (col = 0; col < width - 3; col += 4) { memcpy(y_out + col, encoded, 4); encoded += 4; u_out[col >> 2] = *encoded++ + 128; v_out[col >> 2] = *encoded++ + 128; } y_out -= frame->linesize[0]; u_out -= frame->linesize[1]; v_out -= frame->linesize[2]; } break; case IMGTYPE_YUV211: for (row = 0; row < height; row++) { for (col = 0; col < width - 1; col += 2) { memcpy(y_out + col, encoded, 2); encoded += 2; u_out[col >> 1] = *encoded++ + 128; v_out[col >> 1] = *encoded++ + 128; } y_out -= frame->linesize[0]; u_out -= frame->linesize[1]; v_out -= frame->linesize[2]; } break; case IMGTYPE_YUV420: u_out = frame->data[1] + ((height >> 1) - 1) * frame->linesize[1]; v_out = frame->data[2] + ((height >> 1) - 1) * frame->linesize[2]; for (row = 0; row < height - 1; row += 2) { for (col = 0; col < width - 1; col += 2) { memcpy(y_out + col, encoded, 2); encoded += 2; memcpy(y_out + col - frame->linesize[0], encoded, 2); encoded += 2; u_out[col >> 1] = *encoded++ + 128; v_out[col >> 1] = *encoded++ + 128; } y_out -= frame->linesize[0] << 1; u_out -= frame->linesize[1]; v_out -= frame->linesize[2]; } break; default: av_log(avctx, AV_LOG_ERROR, "BUG! Unknown imagetype in image decoder.\n"); return AVERROR_INVALIDDATA; } *got_frame = 1; return buf_size; } libavcodec/lcldec.c:377: error: Uninitialized Value The value read from encoded was never initialized. libavcodec/lcldec.c:377:31: 375. for (row = 0; row < height; row++) { 376. for (col = 0; col < width; col++) { 377. y_out[col] = *encoded++; ^ 378. u_out[col] = *encoded++ + 128; 379. v_out[col] = *encoded++ + 128;
https://github.com/libav/libav/blob/fbc0b8659967ea54a8472b5f795270d38bb085dd/libavcodec/lcldec.c/#L377
d2a_code_trace_data_41791
static void dct32(INTFLOAT *out, const INTFLOAT *tab) { INTFLOAT tmp0, tmp1; INTFLOAT val0 , val1 , val2 , val3 , val4 , val5 , val6 , val7 , val8 , val9 , val10, val11, val12, val13, val14, val15, val16, val17, val18, val19, val20, val21, val22, val23, val24, val25, val26, val27, val28, val29, val30, val31; BF0( 0, 31, COS0_0 , 1); BF0(15, 16, COS0_15, 5); BF( 0, 15, COS1_0 , 1); BF(16, 31,-COS1_0 , 1); BF0( 7, 24, COS0_7 , 1); BF0( 8, 23, COS0_8 , 1); BF( 7, 8, COS1_7 , 4); BF(23, 24,-COS1_7 , 4); BF( 0, 7, COS2_0 , 1); BF( 8, 15,-COS2_0 , 1); BF(16, 23, COS2_0 , 1); BF(24, 31,-COS2_0 , 1); BF0( 3, 28, COS0_3 , 1); BF0(12, 19, COS0_12, 2); BF( 3, 12, COS1_3 , 1); BF(19, 28,-COS1_3 , 1); BF0( 4, 27, COS0_4 , 1); BF0(11, 20, COS0_11, 2); BF( 4, 11, COS1_4 , 1); BF(20, 27,-COS1_4 , 1); BF( 3, 4, COS2_3 , 3); BF(11, 12,-COS2_3 , 3); BF(19, 20, COS2_3 , 3); BF(27, 28,-COS2_3 , 3); BF( 0, 3, COS3_0 , 1); BF( 4, 7,-COS3_0 , 1); BF( 8, 11, COS3_0 , 1); BF(12, 15,-COS3_0 , 1); BF(16, 19, COS3_0 , 1); BF(20, 23,-COS3_0 , 1); BF(24, 27, COS3_0 , 1); BF(28, 31,-COS3_0 , 1); BF0( 1, 30, COS0_1 , 1); BF0(14, 17, COS0_14, 3); BF( 1, 14, COS1_1 , 1); BF(17, 30,-COS1_1 , 1); BF0( 6, 25, COS0_6 , 1); BF0( 9, 22, COS0_9 , 1); BF( 6, 9, COS1_6 , 2); BF(22, 25,-COS1_6 , 2); BF( 1, 6, COS2_1 , 1); BF( 9, 14,-COS2_1 , 1); BF(17, 22, COS2_1 , 1); BF(25, 30,-COS2_1 , 1); BF0( 2, 29, COS0_2 , 1); BF0(13, 18, COS0_13, 3); BF( 2, 13, COS1_2 , 1); BF(18, 29,-COS1_2 , 1); BF0( 5, 26, COS0_5 , 1); BF0(10, 21, COS0_10, 1); BF( 5, 10, COS1_5 , 2); BF(21, 26,-COS1_5 , 2); BF( 2, 5, COS2_2 , 1); BF(10, 13,-COS2_2 , 1); BF(18, 21, COS2_2 , 1); BF(26, 29,-COS2_2 , 1); BF( 1, 2, COS3_1 , 2); BF( 5, 6,-COS3_1 , 2); BF( 9, 10, COS3_1 , 2); BF(13, 14,-COS3_1 , 2); BF(17, 18, COS3_1 , 2); BF(21, 22,-COS3_1 , 2); BF(25, 26, COS3_1 , 2); BF(29, 30,-COS3_1 , 2); BF1( 0, 1, 2, 3); BF2( 4, 5, 6, 7); BF1( 8, 9, 10, 11); BF2(12, 13, 14, 15); BF1(16, 17, 18, 19); BF2(20, 21, 22, 23); BF1(24, 25, 26, 27); BF2(28, 29, 30, 31); ADD( 8, 12); ADD(12, 10); ADD(10, 14); ADD(14, 9); ADD( 9, 13); ADD(13, 11); ADD(11, 15); out[ 0] = val0; out[16] = val1; out[ 8] = val2; out[24] = val3; out[ 4] = val4; out[20] = val5; out[12] = val6; out[28] = val7; out[ 2] = val8; out[18] = val9; out[10] = val10; out[26] = val11; out[ 6] = val12; out[22] = val13; out[14] = val14; out[30] = val15; ADD(24, 28); ADD(28, 26); ADD(26, 30); ADD(30, 25); ADD(25, 29); ADD(29, 27); ADD(27, 31); out[ 1] = val16 + val24; out[17] = val17 + val25; out[ 9] = val18 + val26; out[25] = val19 + val27; out[ 5] = val20 + val28; out[21] = val21 + val29; out[13] = val22 + val30; out[29] = val23 + val31; out[ 3] = val24 + val20; out[19] = val25 + val21; out[11] = val26 + val22; out[27] = val27 + val23; out[ 7] = val28 + val18; out[23] = val29 + val19; out[15] = val30 + val17; out[31] = val31; } libavcodec/mpc.c:54: error: Buffer Overrun L2 Offset: [7+min(0, `c->synth_buf_offset[*]`), 8+max(511, `c->synth_buf_offset[*]`)] (⇐ [min(0, `c->synth_buf_offset[*]`), 1+max(511, `c->synth_buf_offset[*]`)] + 7) Size: 2 by call to `ff_mpa_synth_filter`. libavcodec/mpc.c:45:1: Parameter `c->synth_buf[*]` 43. * Process decoded Musepack data and produce PCM 44. */ 45. static void mpc_synth(MPCContext *c, int16_t *out) ^ 46. { 47. int dither_state = 0; libavcodec/mpc.c:54:13: Call 52. samples_ptr = samples + ch; 53. for(i = 0; i < SAMPLES_PER_BAND; i++) { 54. ff_mpa_synth_filter(c->synth_buf[ch], &(c->synth_buf_offset[ch]), ^ 55. ff_mpa_synth_window, &dither_state, 56. samples_ptr, 2, libavcodec/mpegaudiodec.c:705:1: Parameter `*synth_buf_ptr` 703. /* XXX: optimize by avoiding ring buffer usage */ 704. #if !CONFIG_FLOAT 705. void ff_mpa_synth_filter(MPA_INT *synth_buf_ptr, int *synth_buf_offset, ^ 706. MPA_INT *window, int *dither_state, 707. OUT_INT *samples, int incr, libavcodec/mpegaudiodec.c:718:5: Assignment 716. 717. offset = *synth_buf_offset; 718. synth_buf = synth_buf_ptr + offset; ^ 719. 720. #if FRAC_BITS <= 15 libavcodec/mpegaudiodec.c:728:5: Call 726. } 727. #else 728. dct32(synth_buf, sb_samples); ^ 729. #endif 730. libavcodec/dct32.c:106:1: <Length trace> 104. 105. /* DCT32 without 1/sqrt(2) coef zero scaling. */ 106. static void dct32(INTFLOAT *out, const INTFLOAT *tab) ^ 107. { 108. INTFLOAT tmp0, tmp1; libavcodec/dct32.c:106:1: Parameter `*out` 104. 105. /* DCT32 without 1/sqrt(2) coef zero scaling. */ 106. static void dct32(INTFLOAT *out, const INTFLOAT *tab) ^ 107. { 108. INTFLOAT tmp0, tmp1; libavcodec/dct32.c:263:5: Array access: Offset: [7+min(0, c->synth_buf_offset[*]), 8+max(511, c->synth_buf_offset[*])] (⇐ [min(0, c->synth_buf_offset[*]), 1+max(511, c->synth_buf_offset[*])] + 7) Size: 2 by call to `ff_mpa_synth_filter` 261. out[11] = val26 + val22; 262. out[27] = val27 + val23; 263. out[ 7] = val28 + val18; ^ 264. out[23] = val29 + val19; 265. out[15] = val30 + val17;
https://github.com/libav/libav/blob/63e8d9760f23a4edf81e9ae58c4f6d3baa6ff4dd/libavcodec/dct32.c/#L263
d2a_code_trace_data_41792
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; } avconv.c:2548: error: Integer Overflow L2 ([1, 2147483616] + 32):signed32 by call to `process_input_packet`. avconv.c:2543:9: Assignment 2541. exit_program(1); 2542. } 2543. ifile->eof_reached = 1; ^ 2544. 2545. for (i = 0; i < ifile->nb_streams; i++) { avconv.c:2548:17: Call 2546. ist = input_streams[ifile->ist_index + i]; 2547. if (ist->decoding_needed) 2548. process_input_packet(ist, NULL, 0); ^ 2549. 2550. /* mark all outputs that don't go through lavfi as finished */ avconv.c:1373:1: Parameter `ist->decoded_frame->nb_samples` 1371. 1372. /* pkt = NULL means EOF (needed to flush decoder buffers) */ 1373. static void process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eof) ^ 1374. { 1375. int i; avconv.c:1404:19: Call 1402. switch (ist->dec_ctx->codec_type) { 1403. case AVMEDIA_TYPE_AUDIO: 1404. ret = decode_audio (ist, repeating ? NULL : &avpkt, &got_output); ^ 1405. break; 1406. case AVMEDIA_TYPE_VIDEO: avconv.c:1164:1: Parameter `ist->decoded_frame->nb_samples` 1162. } 1163. 1164. static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output) ^ 1165. { 1166. AVFrame *decoded_frame, *f; avconv.c:1240:19: Call 1238. if (i < ist->nb_filters - 1) { 1239. f = ist->filter_frame; 1240. err = av_frame_ref(f, decoded_frame); ^ 1241. if (err < 0) 1242. break; libavutil/frame.c:199:1: Parameter `src->nb_samples` 197. } 198. 199. int av_frame_ref(AVFrame *dst, const AVFrame *src) ^ 200. { 201. int i, ret = 0; libavutil/frame.c:207:5: Assignment 205. dst->height = src->height; 206. dst->channel_layout = src->channel_layout; 207. dst->nb_samples = src->nb_samples; ^ 208. 209. ret = av_frame_copy_props(dst, src); libavutil/frame.c:215:15: Call 213. /* duplicate the frame data if it's not refcounted */ 214. if (!src->buf[0]) { 215. ret = av_frame_get_buffer(dst, 32); ^ 216. if (ret < 0) 217. return ret; libavutil/frame.c:186:1: Parameter `frame->nb_samples` 184. } 185. 186. int av_frame_get_buffer(AVFrame *frame, int align) ^ 187. { 188. if (frame->format < 0) libavutil/frame.c:194:16: Call 192. return get_video_buffer(frame, align); 193. else if (frame->nb_samples > 0 && frame->channel_layout) 194. return get_audio_buffer(frame, align); ^ 195. 196. return AVERROR(EINVAL); libavutil/frame.c:137:1: Parameter `frame->nb_samples` 135. } 136. 137. static int get_audio_buffer(AVFrame *frame, int align) ^ 138. { 139. int channels = av_get_channel_layout_nb_channels(frame->channel_layout); libavutil/frame.c:145:15: Call 143. 144. if (!frame->linesize[0]) { 145. ret = av_samples_get_buffer_size(&frame->linesize[0], channels, ^ 146. frame->nb_samples, frame->format, 147. align); libavutil/samplefmt.c:108:1: <LHS trace> 106. } 107. 108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, ^ 109. enum AVSampleFormat sample_fmt, int align) 110. { libavutil/samplefmt.c:108:1: Parameter `nb_samples` 106. } 107. 108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, ^ 109. enum AVSampleFormat sample_fmt, int align) 110. { libavutil/samplefmt.c:124:9: Binary operation: ([1, 2147483616] + 32):signed32 by call to `process_input_packet` 122. return AVERROR(EINVAL); 123. align = 1; 124. nb_samples = FFALIGN(nb_samples, 32); ^ 125. } 126.
https://github.com/libav/libav/blob/ccea588f831906084b8c8235222920e6984beb72/libavutil/samplefmt.c/#L124
d2a_code_trace_data_41793
static int opt_streamid(const char *opt, const char *arg) { int idx; char *p; char idx_str[16]; strncpy(idx_str, arg, sizeof(idx_str)); idx_str[sizeof(idx_str)-1] = '\0'; 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, MAX_STREAMS-1); 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:3544: error: Null Dereference pointer `streamid_map` last assigned on line 3543 could be null and is dereferenced at line 3544, column 5. ffmpeg.c:3526:1: start of procedure opt_streamid() 3524. 3525. /* arg format is "output-stream-index:streamid-value". */ 3526. static int opt_streamid(const char *opt, const char *arg) ^ 3527. { 3528. int idx; ffmpeg.c:3532:5: 3530. char idx_str[16]; 3531. 3532. strncpy(idx_str, arg, sizeof(idx_str)); ^ 3533. idx_str[sizeof(idx_str)-1] = '\0'; 3534. p = strchr(idx_str, ':'); ffmpeg.c:3533:5: 3531. 3532. strncpy(idx_str, arg, sizeof(idx_str)); 3533. idx_str[sizeof(idx_str)-1] = '\0'; ^ 3534. p = strchr(idx_str, ':'); 3535. if (!p) { ffmpeg.c:3534:5: 3532. strncpy(idx_str, arg, sizeof(idx_str)); 3533. idx_str[sizeof(idx_str)-1] = '\0'; 3534. p = strchr(idx_str, ':'); ^ 3535. if (!p) { 3536. fprintf(stderr, ffmpeg.c:3535:10: Taking false branch 3533. idx_str[sizeof(idx_str)-1] = '\0'; 3534. p = strchr(idx_str, ':'); 3535. if (!p) { ^ 3536. fprintf(stderr, 3537. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", ffmpeg.c:3541:5: 3539. ffmpeg_exit(1); 3540. } 3541. *p++ = '\0'; ^ 3542. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1); 3543. streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1); ffmpeg.c:3542:5: Skipping parse_number_or_die(): empty list of specs 3540. } 3541. *p++ = '\0'; 3542. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1); ^ 3543. streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1); 3544. streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); ffmpeg.c:3543:5: 3541. *p++ = '\0'; 3542. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1); 3543. streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1); ^ 3544. streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); 3545. return 0; ffmpeg.c:566:1: start of procedure grow_array() 564. 565. /* similar to ff_dynarray_add() and av_fast_realloc() */ 566. static void *grow_array(void *array, int elem_size, int *size, int new_size) ^ 567. { 568. if (new_size >= INT_MAX / elem_size) { ffmpeg.c:568:9: Taking false branch 566. static void *grow_array(void *array, int elem_size, int *size, int new_size) 567. { 568. if (new_size >= INT_MAX / elem_size) { ^ 569. fprintf(stderr, "Array too big.\n"); 570. ffmpeg_exit(1); ffmpeg.c:572:9: Taking true branch 570. ffmpeg_exit(1); 571. } 572. if (*size < new_size) { ^ 573. uint8_t *tmp = av_realloc(array, new_size*elem_size); 574. if (!tmp) { ffmpeg.c:573:9: 571. } 572. if (*size < new_size) { 573. uint8_t *tmp = av_realloc(array, new_size*elem_size); ^ 574. if (!tmp) { 575. fprintf(stderr, "Could not alloc buffer.\n"); libavutil/mem.c:119:1: start of procedure av_realloc() 117. } 118. 119. void *av_realloc(void *ptr, unsigned int size) ^ 120. { 121. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:126:8: Taking true branch 124. 125. /* let's disallow possible ambiguous cases */ 126. if(size > (INT_MAX-16) ) ^ 127. return NULL; 128. libavutil/mem.c:127:9: 125. /* let's disallow possible ambiguous cases */ 126. if(size > (INT_MAX-16) ) 127. return NULL; ^ 128. 129. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:137:1: return from a call to av_realloc 135. return realloc(ptr, size); 136. #endif 137. } ^ 138. 139. void av_free(void *ptr) ffmpeg.c:574:14: Taking true branch 572. if (*size < new_size) { 573. uint8_t *tmp = av_realloc(array, new_size*elem_size); 574. if (!tmp) { ^ 575. fprintf(stderr, "Could not alloc buffer.\n"); 576. ffmpeg_exit(1); ffmpeg.c:575:13: 573. uint8_t *tmp = av_realloc(array, new_size*elem_size); 574. if (!tmp) { 575. fprintf(stderr, "Could not alloc buffer.\n"); ^ 576. ffmpeg_exit(1); 577. } ffmpeg.c:576:13: Skipping ffmpeg_exit(): empty list of specs 574. if (!tmp) { 575. fprintf(stderr, "Could not alloc buffer.\n"); 576. ffmpeg_exit(1); ^ 577. } 578. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); ffmpeg.c:578:9: 576. ffmpeg_exit(1); 577. } 578. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); ^ 579. *size = new_size; 580. return tmp; ffmpeg.c:579:9: 577. } 578. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); 579. *size = new_size; ^ 580. return tmp; 581. } ffmpeg.c:580:9: 578. memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size); 579. *size = new_size; 580. return tmp; ^ 581. } 582. return array; ffmpeg.c:583:1: return from a call to grow_array 581. } 582. return array; 583. } ^ 584. 585. static void choose_sample_fmt(AVStream *st, AVCodec *codec) ffmpeg.c:3544:5: Skipping parse_number_or_die(): empty list of specs 3542. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, MAX_STREAMS-1); 3543. streamid_map = grow_array(streamid_map, sizeof(*streamid_map), &nb_streamid_map, idx+1); 3544. streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); ^ 3545. return 0; 3546. }
https://github.com/libav/libav/blob/eced8fa02ea237abd9c6a6e9287bb7524addb8f4/ffmpeg.c/#L3544
d2a_code_trace_data_41794
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dh/dh_key.c:171: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_MONT_CTX_set_locked`. Showing all 29 steps of the trace crypto/dh/dh_key.c:160:5: Call 158. if (ctx == NULL) 159. goto err; 160. BN_CTX_start(ctx); ^ 161. tmp = BN_CTX_get(ctx); 162. 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/dh/dh_key.c:171:16: Call 169. 170. if (dh->flags & DH_FLAG_CACHE_MONT_P) { 171. mont = BN_MONT_CTX_set_locked(&dh->method_mont_p, ^ 172. dh->lock, dh->p, ctx); 173. BN_set_flags(dh->priv_key, BN_FLG_CONSTTIME); 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/07a38fd2bfbf1fa3cc1ad9a92f1bcf5d5611ae16/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_41795
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/sslapitest.c:3897: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `SRP_create_verifier_BN`. Showing all 16 steps of the trace test/sslapitest.c:3897:10: Call 3895. goto end; 3896. 3897. if (!TEST_true(SRP_create_verifier_BN(userid, password, &salt, &verifier, ^ 3898. lgN->N, lgN->g))) 3899. goto end; crypto/srp/srp_vfy.c:662:1: Parameter `N->top` 660. * BIGNUMS. 661. */ 662. > int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt, 663. BIGNUM **verifier, const BIGNUM *N, 664. const BIGNUM *g) crypto/srp/srp_vfy.c:693:10: Call 691. goto err; 692. 693. if (!BN_mod_exp(*verifier, g, x, N, bn_ctx)) { ^ 694. BN_clear_free(*verifier); 695. goto err; 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:829:1: Parameter `a->top` 827. } 828. 829. > int BN_is_odd(const BIGNUM *a) 830. { 831. return (a->top > 0) && (a->d[0] & 1); crypto/bn/bn_exp.c:149:15: Call 147. #ifdef RECP_MUL_MOD 148. { 149. ret = BN_mod_exp_recp(r, a, p, m, ctx); ^ 150. } 151. #else crypto/bn/bn_exp.c:161:1: Parameter `m->top` 159. } 160. 161. > int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 162. const BIGNUM *m, BN_CTX *ctx) 163. { crypto/bn/bn_exp.c:200:14: Call 198. if (m->neg) { 199. /* ignore sign of 'm' */ 200. if (!BN_copy(aa, m)) ^ 201. goto err; 202. aa->neg = 0; crypto/bn/bn_lib.c:285:1: <Offset trace> 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); 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_lib.c:285:1: <Length trace> 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_lib.c:285:1: Parameter `*a->d` 283. } 284. 285. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 286. { 287. bn_check_top(b); crypto/bn/bn_lib.c:291:9: Call 289. if (a == b) 290. return a; 291. if (bn_wexpand(a, b->top) == NULL) ^ 292. return NULL; 293. crypto/bn/bn_lib.c:910:1: Parameter `*a->d` 908. } 909. 910. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 911. { 912. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:295:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `SRP_create_verifier_BN` 293. 294. if (b->top > 0) 295. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); ^ 296. 297. a->top = b->top;
https://github.com/openssl/openssl/blob/a8ca496ddb532d7f7dc356fd2b026697388d2384/crypto/bn/bn_lib.c/#L295
d2a_code_trace_data_41796
PUT_HEVC_QPEL_HV(2, 1) libavcodec/hevcdsp_template.c:983: error: Buffer Overrun L3 Offset: [-64, +oo] (⇐ [0, +oo] + [-64, -61]) Size: 4544 by call to `put_hevc_qpel_h2v1_8`. libavcodec/hevcdsp_template.c:983:1: Call 981. QPEL(12) 982. QPEL(8) 983. QPEL(4) ^ 984. 985. static inline void FUNC(put_hevc_epel_pixels)(int16_t *dst, ptrdiff_t dststride, libavcodec/hevcdsp_template.c:904:1: <Offset trace> 902. PUT_HEVC_QPEL_HV(1, 2) 903. PUT_HEVC_QPEL_HV(1, 3) 904. PUT_HEVC_QPEL_HV(2, 1) ^ 905. PUT_HEVC_QPEL_HV(2, 2) 906. PUT_HEVC_QPEL_HV(2, 3) libavcodec/hevcdsp_template.c:904:1: Assignment 902. PUT_HEVC_QPEL_HV(1, 2) 903. PUT_HEVC_QPEL_HV(1, 3) 904. PUT_HEVC_QPEL_HV(2, 1) ^ 905. PUT_HEVC_QPEL_HV(2, 2) 906. PUT_HEVC_QPEL_HV(2, 3) libavcodec/hevcdsp_template.c:904:1: <Length trace> 902. PUT_HEVC_QPEL_HV(1, 2) 903. PUT_HEVC_QPEL_HV(1, 3) 904. PUT_HEVC_QPEL_HV(2, 1) ^ 905. PUT_HEVC_QPEL_HV(2, 2) 906. PUT_HEVC_QPEL_HV(2, 3) libavcodec/hevcdsp_template.c:904:1: Array declaration 902. PUT_HEVC_QPEL_HV(1, 2) 903. PUT_HEVC_QPEL_HV(1, 3) 904. PUT_HEVC_QPEL_HV(2, 1) ^ 905. PUT_HEVC_QPEL_HV(2, 2) 906. PUT_HEVC_QPEL_HV(2, 3) libavcodec/hevcdsp_template.c:904:1: Assignment 902. PUT_HEVC_QPEL_HV(1, 2) 903. PUT_HEVC_QPEL_HV(1, 3) 904. PUT_HEVC_QPEL_HV(2, 1) ^ 905. PUT_HEVC_QPEL_HV(2, 2) 906. PUT_HEVC_QPEL_HV(2, 3) libavcodec/hevcdsp_template.c:904:1: Array access: Offset: [-64, +oo] (⇐ [0, +oo] + [-64, -61]) Size: 4544 by call to `put_hevc_qpel_h2v1_8` 902. PUT_HEVC_QPEL_HV(1, 2) 903. PUT_HEVC_QPEL_HV(1, 3) 904. PUT_HEVC_QPEL_HV(2, 1) ^ 905. PUT_HEVC_QPEL_HV(2, 2) 906. PUT_HEVC_QPEL_HV(2, 3)
https://github.com/libav/libav/blob/688417399c69aadd4c287bdb0dec82ef8799011c/libavcodec/hevcdsp_template.c/#L904
d2a_code_trace_data_41797
void CRYPTO_free(void *str) { #ifndef OPENSSL_NO_CRYPTO_MDEBUG if (call_malloc_debug) { CRYPTO_mem_debug_free(str, 0); free(str); CRYPTO_mem_debug_free(str, 1); } else { free(str); } #else free(str); #endif } crypto/evp/digest.c:289: error: USE_AFTER_FREE call to `EVP_MD_CTX_copy_ex()` eventually accesses memory that was invalidated by call to `free()` on line 288 indirectly during the call to `EVP_MD_CTX_reset()`. Showing all 14 steps of the trace crypto/evp/digest.c:286:1: invalidation part of the trace starts here 284. } 285. 286. > int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in) 287. { 288. EVP_MD_CTX_reset(out); crypto/evp/digest.c:286:1: parameter `out` of EVP_MD_CTX_copy 284. } 285. 286. > int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in) 287. { 288. EVP_MD_CTX_reset(out); crypto/evp/digest.c:288:5: when calling `EVP_MD_CTX_reset` here 286. int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in) 287. { 288. EVP_MD_CTX_reset(out); ^ 289. return EVP_MD_CTX_copy_ex(out, in); 290. } crypto/evp/digest.c:123:1: parameter `ctx` of EVP_MD_CTX_reset 121. 122. /* This call frees resources associated with the context */ 123. > int EVP_MD_CTX_reset(EVP_MD_CTX *ctx) 124. { 125. if (ctx == NULL) crypto/evp/digest.c:137:9: when calling `CRYPTO_clear_free` here 135. if (ctx->digest && ctx->digest->ctx_size && ctx->md_data 136. && !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE)) { 137. OPENSSL_clear_free(ctx->md_data, ctx->digest->ctx_size); ^ 138. } 139. EVP_PKEY_CTX_free(ctx->pctx); crypto/mem.c:249:1: parameter `str` of CRYPTO_clear_free 247. } 248. 249. > void CRYPTO_clear_free(void *str, size_t num) 250. { 251. if (str == NULL) crypto/mem.c:255:5: when calling `CRYPTO_free` here 253. if (num) 254. OPENSSL_cleanse(str, num); 255. CRYPTO_free(str); ^ 256. } crypto/mem.c:234:1: parameter `str` of CRYPTO_free 232. } 233. 234. > void CRYPTO_free(void *str) 235. { 236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:245:5: was invalidated by call to `free()` 243. } 244. #else 245. free(str); ^ 246. #endif 247. } crypto/evp/digest.c:286:1: use-after-lifetime part of the trace starts here 284. } 285. 286. > int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in) 287. { 288. EVP_MD_CTX_reset(out); crypto/evp/digest.c:286:1: parameter `out` of EVP_MD_CTX_copy 284. } 285. 286. > int EVP_MD_CTX_copy(EVP_MD_CTX *out, const EVP_MD_CTX *in) 287. { 288. EVP_MD_CTX_reset(out); crypto/evp/digest.c:289:12: when calling `EVP_MD_CTX_copy_ex` here 287. { 288. EVP_MD_CTX_reset(out); 289. return EVP_MD_CTX_copy_ex(out, in); ^ 290. } 291. crypto/mem.c:234:1: parameter `str` of CRYPTO_free 232. } 233. 234. > void CRYPTO_free(void *str) 235. { 236. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:245:5: invalid access occurs here 243. } 244. #else 245. free(str); ^ 246. #endif 247. }
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/mem.c/#L245
d2a_code_trace_data_41798
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) { int i, nw, lb, rb; BN_ULONG *t, *f; BN_ULONG l; bn_check_top(r); bn_check_top(a); if (n < 0) { BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT); return 0; } nw = n / BN_BITS2; if (bn_wexpand(r, a->top + nw + 1) == NULL) return 0; r->neg = a->neg; lb = n % BN_BITS2; rb = BN_BITS2 - lb; f = a->d; t = r->d; t[a->top + nw] = 0; if (lb == 0) for (i = a->top - 1; i >= 0; i--) t[nw + i] = f[i]; else for (i = a->top - 1; i >= 0; i--) { l = f[i]; t[nw + i + 1] |= (l >> rb) & BN_MASK2; t[nw + i] = (l << lb) & BN_MASK2; } memset(t, 0, sizeof(*t) * nw); r->top = a->top + nw + 1; bn_correct_top(r); bn_check_top(r); return 1; } crypto/sm2/sm2_sign.c:108: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mod_add`. Showing all 21 steps of the trace crypto/sm2/sm2_sign.c:102:13: Call 100. BN_priv_rand_range(k, order); 101. 102. if (EC_POINT_mul(group, kG, k, NULL, NULL, ctx) == 0) ^ 103. goto done; 104. crypto/ec/ec_lib.c:932:12: Call 930. scalars[0] = p_scalar; 931. 932. return EC_POINTs_mul(group, r, g_scalar, ^ 933. (point != NULL 934. && p_scalar != NULL), points, scalars, ctx); crypto/ec/ec_lib.c:910:1: Parameter `(*scalars)->top` 908. */ 909. 910. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 911. size_t num, const EC_POINT *points[], 912. const BIGNUM *scalars[], BN_CTX *ctx) crypto/sm2/sm2_sign.c:108:13: Call 106. goto done; 107. 108. if (BN_mod_add(r, e, x1, order, ctx) == 0) ^ 109. goto done; 110. crypto/bn/bn_mod.c:28:1: Parameter `m->top` 26. } 27. 28. > int BN_mod_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 29. BN_CTX *ctx) 30. { crypto/bn/bn_mod.c:33:12: Call 31. if (!BN_add(r, a, b)) 32. return 0; 33. return BN_nnmod(r, r, m, ctx); ^ 34. } 35. crypto/bn/bn_mod.c:13:1: Parameter `d->top` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:199:31: Call 197. 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) 201. goto err; crypto/bn/bn_lib.c:140:9: Assignment 138. 139. if (BN_is_zero(a)) 140. return 0; ^ 141. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); 142. } crypto/bn/bn_div.c:199:5: Assignment 197. 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) 201. goto err; crypto/bn/bn_div.c:200:11: Call 198. /* First we normalise the numbers */ 199. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); 200. if (!(BN_lshift(sdiv, divisor, norm_shift))) ^ 201. goto err; 202. sdiv->neg = 0; crypto/bn/bn_shift.c:83:1: <Offset trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `n` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:5: Assignment 95. } 96. 97. nw = n / BN_BITS2; ^ 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) 99. return 0; crypto/bn/bn_shift.c:83:1: <Length trace> 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:83:1: Parameter `*r->d` 81. } 82. 83. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 84. { 85. int i, nw, lb, rb; crypto/bn/bn_shift.c:98:9: Call 96. 97. nw = n / BN_BITS2; 98. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 99. return 0; 100. r->neg = a->neg; crypto/bn/bn_lib.c:910:1: Parameter `*a->d` 908. } 909. 910. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 911. { 912. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:104:5: Assignment 102. rb = BN_BITS2 - lb; 103. f = a->d; 104. t = r->d; ^ 105. t[a->top + nw] = 0; 106. if (lb == 0) crypto/bn/bn_shift.c:112:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `BN_mod_add` 110. for (i = a->top - 1; i >= 0; i--) { 111. l = f[i]; 112. t[nw + i + 1] |= (l >> rb) & BN_MASK2; ^ 113. t[nw + i] = (l << lb) & BN_MASK2; 114. }
https://github.com/openssl/openssl/blob/440bce8f813fa661437ce52378c3df38e2fd073b/crypto/bn/bn_shift.c/#L112
d2a_code_trace_data_41799
static const char *skip_space(const char *s) { while (ossl_isspace(*s)) s++; return s; } test/property_test.c:232: error: BUFFER_OVERRUN_L3 Offset: [2, +oo] Size: [1, 11] by call to `ossl_method_store_add`. Showing all 25 steps of the trace test/property_test.c:218:9: Array declaration 216. char *impl; 217. } impls[] = { 218. { 6, "position=1", "a" }, ^ 219. { 6, "position=2", "b" }, 220. { 6, "position=3", "c" }, test/property_test.c:232:14: Call 230. 231. for (i = 0; i < OSSL_NELEM(impls); i++) 232. if (!TEST_true(ossl_method_store_add(store, impls[i].nid, impls[i].prop, ^ 233. impls[i].impl, NULL))) { 234. TEST_note("iteration %zd", i + 1); crypto/property/property.c: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:252:9: Assignment 250. 251. if (*s == '"' || *s == '\'') { 252. s++; ^ 253. r = parse_string(ctx, &s, s[-1], res, create); 254. } else if (*s == '+') { crypto/property/property_parse.c:253:13: Call 251. if (*s == '"' || *s == '\'') { 252. s++; 253. r = parse_string(ctx, &s, s[-1], res, create); ^ 254. } else if (*s == '+') { 255. s++; crypto/property/property_parse.c:184:1: Parameter `**t` 182. } 183. 184. > static int parse_string(OPENSSL_CTX *ctx, const char *t[], char delim, 185. PROPERTY_DEFINITION *res, const int create) 186. { crypto/property/property_parse.c:188:5: Assignment 186. { 187. char v[1000]; 188. const char *s = *t; ^ 189. size_t i = 0; 190. int err = 0; crypto/property/property_parse.c:205:10: Call 203. } 204. v[i] = '\0'; 205. *t = skip_space(s + 1); ^ 206. if (err) 207. PROPerr(PROP_F_PARSE_STRING, PROP_R_STRING_TOO_LONG); crypto/property/property_parse.c:50:1: <Length trace> 48. DEFINE_STACK_OF(PROPERTY_DEFINITION) 49. 50. > static const char *skip_space(const char *s) 51. { 52. while (ossl_isspace(*s)) crypto/property/property_parse.c:50:1: Parameter `*s` 48. DEFINE_STACK_OF(PROPERTY_DEFINITION) 49. 50. > static const char *skip_space(const char *s) 51. { 52. while (ossl_isspace(*s)) crypto/property/property_parse.c:52:12: Array access: Offset: [2, +oo] Size: [1, 11] by call to `ossl_method_store_add` 50. static const char *skip_space(const char *s) 51. { 52. while (ossl_isspace(*s)) ^ 53. s++; 54. return s;
https://github.com/openssl/openssl/blob/260a16f33682a819414fcba6161708a5e6bdff50/crypto/property/property_parse.c/#L52
d2a_code_trace_data_41800
int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) { char *v; int gmt=0; int i; int y=0,M=0,d=0,h=0,m=0,s=0; char *f = NULL; int f_len = 0; i=tm->length; v=(char *)tm->data; if (i < 12) goto err; if (v[i-1] == 'Z') gmt=1; for (i=0; i<12; i++) if ((v[i] > '9') || (v[i] < '0')) goto err; y= (v[0]-'0')*1000+(v[1]-'0')*100 + (v[2]-'0')*10+(v[3]-'0'); M= (v[4]-'0')*10+(v[5]-'0'); if ((M > 12) || (M < 1)) goto err; d= (v[6]-'0')*10+(v[7]-'0'); h= (v[8]-'0')*10+(v[9]-'0'); m= (v[10]-'0')*10+(v[11]-'0'); if ( (v[12] >= '0') && (v[12] <= '9') && (v[13] >= '0') && (v[13] <= '9')) { s= (v[12]-'0')*10+(v[13]-'0'); if (v[14] == '.') { int l = tm->length; f = &v[14]; f_len = 1; while (14 + f_len < l && f[f_len] >= '0' && f[f_len] <= '9') ++f_len; } } if (BIO_printf(bp,"%s %2d %02d:%02d:%02d%.*s %d%s", mon[M-1],d,h,m,s,f_len,f,y,(gmt)?" GMT":"") <= 0) return(0); else return(1); err: BIO_write(bp,"Bad time value",14); return(0); } apps/ca.c:2102: error: BUFFER_OVERRUN_L3 Offset: [-529, +oo] Size: 12 by call to `X509_print_ex`. Showing all 15 steps of the trace apps/ca.c:2012:7: Call 2010. else ASN1_UTCTIME_set_string(X509_get_notAfter(ret),enddate); 2011. 2012. if (!X509_set_subject_name(ret,subject)) goto err; ^ 2013. 2014. pktmp=X509_REQ_get_pubkey(req); crypto/x509/x509_set.c:101:1: Parameter `*x->cert_info->subject` 99. } 100. 101. > int X509_set_subject_name(X509 *x, X509_NAME *name) 102. { 103. if ((x == NULL) || (x->cert_info == NULL)) return(0); apps/ca.c:2094:8: Call 2092. if( email_dn == 0 ) 2093. { 2094. if (!X509_set_subject_name(ret,dn_subject)) goto err; ^ 2095. } 2096. crypto/x509/x509_set.c:101:1: Parameter `*x->cert_info->subject` 99. } 100. 101. > int X509_set_subject_name(X509 *x, X509_NAME *name) 102. { 103. if ((x == NULL) || (x->cert_info == NULL)) return(0); apps/ca.c:2102:3: Call 2100. /* Never print signature details because signature not present */ 2101. certopt |= X509_FLAG_NO_SIGDUMP | X509_FLAG_NO_SIGNAME; 2102. X509_print_ex(bio_err, ret, nameopt, certopt); ^ 2103. } 2104. crypto/asn1/t_x509.c:104:1: Parameter `*x->cert_info->validity->notBefore->data` 102. } 103. 104. > int X509_print_ex(BIO *bp, X509 *x, unsigned long nmflags, unsigned long cflag) 105. { 106. long l; crypto/asn1/t_x509.c:188:8: Call 186. if (BIO_write(bp," Validity\n",17) <= 0) goto err; 187. if (BIO_write(bp," Not Before: ",24) <= 0) goto err; 188. if (!ASN1_TIME_print(bp,X509_get_notBefore(x))) goto err; ^ 189. if (BIO_write(bp,"\n Not After : ",25) <= 0) goto err; 190. if (!ASN1_TIME_print(bp,X509_get_notAfter(x))) goto err; crypto/asn1/t_x509.c:336:1: Parameter `*tm->data` 334. } 335. 336. > int ASN1_TIME_print(BIO *bp, const ASN1_TIME *tm) 337. { 338. if(tm->type == V_ASN1_UTCTIME) return ASN1_UTCTIME_print(bp, tm); crypto/asn1/t_x509.c:340:12: Call 338. if(tm->type == V_ASN1_UTCTIME) return ASN1_UTCTIME_print(bp, tm); 339. if(tm->type == V_ASN1_GENERALIZEDTIME) 340. return ASN1_GENERALIZEDTIME_print(bp, tm); ^ 341. BIO_write(bp,"Bad time value",14); 342. return(0); crypto/asn1/t_x509.c:351:1: <Offset trace> 349. }; 350. 351. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 352. { 353. char *v; crypto/asn1/t_x509.c:351:1: Parameter `*tm->data` 349. }; 350. 351. > int ASN1_GENERALIZEDTIME_print(BIO *bp, const ASN1_GENERALIZEDTIME *tm) 352. { 353. char *v; crypto/asn1/t_x509.c:368:2: Assignment 366. if ((v[i] > '9') || (v[i] < '0')) goto err; 367. y= (v[0]-'0')*1000+(v[1]-'0')*100 + (v[2]-'0')*10+(v[3]-'0'); 368. M= (v[4]-'0')*10+(v[5]-'0'); ^ 369. if ((M > 12) || (M < 1)) goto err; 370. d= (v[6]-'0')*10+(v[7]-'0'); crypto/asn1/t_x509.c:345:1: <Length trace> 343. } 344. 345. > static const char *mon[12]= 346. { 347. "Jan","Feb","Mar","Apr","May","Jun", crypto/asn1/t_x509.c:345:1: Array declaration 343. } 344. 345. > static const char *mon[12]= 346. { 347. "Jan","Feb","Mar","Apr","May","Jun", crypto/asn1/t_x509.c:389:3: Array access: Offset: [-529, +oo] Size: 12 by call to `X509_print_ex` 387. 388. if (BIO_printf(bp,"%s %2d %02d:%02d:%02d%.*s %d%s", 389. mon[M-1],d,h,m,s,f_len,f,y,(gmt)?" GMT":"") <= 0) ^ 390. return(0); 391. else
https://github.com/openssl/openssl/blob/985de8634000df9b33b8ac4519fa10a99e43b314/crypto/asn1/t_x509.c/#L389
d2a_code_trace_data_41801
static const char *skip_space(const char *s) { while (ossl_isspace(*s)) s++; return s; } test/property_test.c:339: error: BUFFER_OVERRUN_L3 Offset: [2, +oo] Size: [1, 50] by call to `ossl_method_store_add`. Showing all 25 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:252:9: Assignment 250. 251. if (*s == '"' || *s == '\'') { 252. s++; ^ 253. r = parse_string(ctx, &s, s[-1], res, create); 254. } else if (*s == '+') { crypto/property/property_parse.c:253:13: Call 251. if (*s == '"' || *s == '\'') { 252. s++; 253. r = parse_string(ctx, &s, s[-1], res, create); ^ 254. } else if (*s == '+') { 255. s++; crypto/property/property_parse.c:184:1: Parameter `**t` 182. } 183. 184. > static int parse_string(OPENSSL_CTX *ctx, const char *t[], char delim, 185. PROPERTY_DEFINITION *res, const int create) 186. { crypto/property/property_parse.c:188:5: Assignment 186. { 187. char v[1000]; 188. const char *s = *t; ^ 189. size_t i = 0; 190. int err = 0; crypto/property/property_parse.c:205:10: Call 203. } 204. v[i] = '\0'; 205. *t = skip_space(s + 1); ^ 206. if (err) 207. PROPerr(PROP_F_PARSE_STRING, PROP_R_STRING_TOO_LONG); crypto/property/property_parse.c:50:1: <Length trace> 48. DEFINE_STACK_OF(PROPERTY_DEFINITION) 49. 50. > static const char *skip_space(const char *s) 51. { 52. while (ossl_isspace(*s)) crypto/property/property_parse.c:50:1: Parameter `*s` 48. DEFINE_STACK_OF(PROPERTY_DEFINITION) 49. 50. > static const char *skip_space(const char *s) 51. { 52. while (ossl_isspace(*s)) crypto/property/property_parse.c:52:12: Array access: Offset: [2, +oo] Size: [1, 50] by call to `ossl_method_store_add` 50. static const char *skip_space(const char *s) 51. { 52. while (ossl_isspace(*s)) ^ 53. s++; 54. return s;
https://github.com/openssl/openssl/blob/260a16f33682a819414fcba6161708a5e6bdff50/crypto/property/property_parse.c/#L52
d2a_code_trace_data_41802
void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) { unsigned long hash; OPENSSL_LH_NODE *nn, **rn; void *ret; lh->error = 0; rn = getrn(lh, data, &hash); if (*rn == NULL) { lh->num_no_delete++; return (NULL); } else { nn = *rn; *rn = nn->next; ret = nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))) contract(lh); return (ret); } ssl/ssl_lib.c:669: error: INTEGER_OVERFLOW_L2 ([0, max(0, `ctx->sessions->num_items`)] - 1):unsigned64 by call to `SSL_free`. Showing all 15 steps of the trace ssl/ssl_lib.c:518:1: Parameter `ctx->sessions->num_items` 516. } 517. 518. > SSL *SSL_new(SSL_CTX *ctx) 519. { 520. SSL *s; ssl/ssl_lib.c:669:5: Call 667. return s; 668. err: 669. SSL_free(s); ^ 670. SSLerr(SSL_F_SSL_NEW, ERR_R_MALLOC_FAILURE); 671. return NULL; ssl/ssl_lib.c:926:1: Parameter `s->initial_ctx->sessions->num_items` 924. } 925. 926. > void SSL_free(SSL *s) 927. { 928. int i; ssl/ssl_lib.c:963:9: Call 961. /* Make the next call work :-) */ 962. if (s->session != NULL) { 963. ssl_clear_bad_session(s); ^ 964. SSL_SESSION_free(s->session); 965. } ssl/ssl_sess.c:986:1: Parameter `s->initial_ctx->sessions->num_items` 984. } 985. 986. > int ssl_clear_bad_session(SSL *s) 987. { 988. if ((s->session != NULL) && ssl/ssl_sess.c:991:9: Call 989. !(s->shutdown & SSL_SENT_SHUTDOWN) && 990. !(SSL_in_init(s) || SSL_in_before(s))) { 991. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 992. return (1); 993. } else ssl/ssl_sess.c:693:1: Parameter `ctx->sessions->num_items` 691. } 692. 693. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 694. { 695. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:695:12: Call 693. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 694. { 695. return remove_session_lock(ctx, c, 1); ^ 696. } 697. ssl/ssl_sess.c:698:1: Parameter `ctx->sessions->num_items` 696. } 697. 698. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 699. { 700. SSL_SESSION *r; ssl/ssl_sess.c:708:17: Call 706. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 707. ret = 1; 708. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 709. SSL_SESSION_list_remove(ctx, c); 710. } ssl/ssl_locl.h:581:1: Parameter `lh->num_items` 579. }; 580. 581. > DEFINE_LHASH_OF(SSL_SESSION); 582. /* Needed in ssl_cert.c */ 583. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:581:1: Call 579. }; 580. 581. > DEFINE_LHASH_OF(SSL_SESSION); 582. /* Needed in ssl_cert.c */ 583. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:103:1: <LHS trace> 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:103:1: Parameter `lh->num_items` 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:123:5: Binary operation: ([0, max(0, ctx->sessions->num_items)] - 1):unsigned64 by call to `SSL_free` 121. } 122. 123. lh->num_items--; ^ 124. if ((lh->num_nodes > MIN_NODES) && 125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
https://github.com/openssl/openssl/blob/2dca984babedf93c560aba54da3f4c9222ee0d12/crypto/lhash/lhash.c/#L123
d2a_code_trace_data_41803
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) { int i, j, max; const BN_ULONG *ap; BN_ULONG *rp; max = n * 2; ap = a; rp = r; rp[0] = rp[max - 1] = 0; rp++; j = n; if (--j > 0) { ap++; rp[j] = bn_mul_words(rp, ap, j, ap[-1]); rp += 2; } for (i = n - 2; i > 0; i--) { j--; ap++; rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]); rp += 2; } bn_add_words(r, r, r, max); bn_sqr_words(tmp, a, n); bn_add_words(r, r, tmp, max); } test/bntest.c:1924: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_mod_exp`. Showing all 26 steps of the trace test/bntest.c:1922:5: Call 1920. || !TEST_ptr(r = BN_new())) 1921. goto err; 1922. BN_zero(zero); ^ 1923. 1924. if (!TEST_true(BN_mod_exp(r, a, zero, BN_value_one(), NULL)) crypto/bn/bn_lib.c:402:15: Assignment 400. a->neg = 0; 401. a->d[0] = w; 402. a->top = (w ? 1 : 0); ^ 403. bn_check_top(a); 404. return (1); crypto/bn/bn_lib.c:402:5: Assignment 400. a->neg = 0; 401. a->d[0] = w; 402. a->top = (w ? 1 : 0); ^ 403. bn_check_top(a); 404. return (1); test/bntest.c:1924:10: Call 1922. BN_zero(zero); 1923. 1924. if (!TEST_true(BN_mod_exp(r, a, zero, BN_value_one(), NULL)) ^ 1925. || !TEST_BN_eq_zero(r) 1926. || !TEST_true(BN_mod_exp_mont(r, a, zero, BN_value_one(), crypto/bn/bn_exp.c:91:1: Parameter `a->top` 89. } 90. 91. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 92. BN_CTX *ctx) 93. { crypto/bn/bn_exp.c:144:19: Call 142. } else 143. # endif 144. ret = BN_mod_exp_mont(r, a, p, m, ctx, NULL); ^ 145. } else 146. #endif crypto/bn/bn_exp.c:294:1: Parameter `a->top` 292. } 293. 294. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 295. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 296. { crypto/bn/bn_exp.c:306:16: Call 304. 305. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { 306. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 307. } 308. crypto/bn/bn_exp.c:594:1: Parameter `a->top` 592. * http://www.daemonology.net/hyperthreading-considered-harmful/) 593. */ 594. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 595. const BIGNUM *m, BN_CTX *ctx, 596. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:751:17: Call 749. if (!BN_to_montgomery(&am, &am, mont, ctx)) 750. goto err; 751. } else if (!BN_to_montgomery(&am, a, mont, ctx)) ^ 752. goto err; 753. crypto/bn/bn_lib.c:877:1: Parameter `a->top` 875. } 876. 877. > int BN_to_montgomery(BIGNUM *r, const BIGNUM *a, BN_MONT_CTX *mont, 878. BN_CTX *ctx) 879. { crypto/bn/bn_lib.c:880:12: Call 878. BN_CTX *ctx) 879. { 880. return BN_mod_mul_montgomery(r, a, &(mont->RR), mont, ctx); ^ 881. } 882. crypto/bn/bn_mont.c:26:1: Parameter `a->top` 24. #endif 25. 26. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 27. BN_MONT_CTX *mont, BN_CTX *ctx) 28. { crypto/bn/bn_mont.c:53:14: Call 51. bn_check_top(tmp); 52. if (a == b) { 53. if (!BN_sqr(tmp, a, ctx)) ^ 54. goto err; 55. } else { crypto/bn/bn_sqr.c:17:1: Parameter `a->top` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int max, al; crypto/bn/bn_sqr.c:25:5: Assignment 23. bn_check_top(a); 24. 25. al = a->top; ^ 26. if (al <= 0) { 27. r->top = 0; crypto/bn/bn_sqr.c:74:17: Call 72. if (bn_wexpand(tmp, max) == NULL) 73. goto err; 74. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 75. } 76. } crypto/bn/bn_sqr.c:105:1: <Offset trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `n` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:116:5: Assignment 114. rp[0] = rp[max - 1] = 0; 115. rp++; 116. j = n; ^ 117. 118. if (--j > 0) { crypto/bn/bn_sqr.c:118:9: Assignment 116. j = n; 117. 118. if (--j > 0) { ^ 119. ap++; 120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); crypto/bn/bn_sqr.c:105:1: <Length trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `*r` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:113:5: Assignment 111. max = n * 2; 112. ap = a; 113. rp = r; ^ 114. rp[0] = rp[max - 1] = 0; 115. rp++; crypto/bn/bn_sqr.c:115:5: Assignment 113. rp = r; 114. rp[0] = rp[max - 1] = 0; 115. rp++; ^ 116. j = n; 117. crypto/bn/bn_sqr.c:120:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_mod_exp` 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/3f97052392cb10fca5309212bf720685262ad4a6/crypto/bn/bn_sqr.c/#L120
d2a_code_trace_data_41804
void BN_consttime_swap(BN_ULONG condition, BIGNUM *a, BIGNUM *b, int nwords) { BN_ULONG t; int i; bn_wcheck_size(a, nwords); bn_wcheck_size(b, nwords); assert(a != b); assert((condition & (condition - 1)) == 0); assert(sizeof(BN_ULONG) >= sizeof(int)); condition = ((condition - 1) >> (BN_BITS2 - 1)) - 1; t = (a->top ^ b->top) & condition; a->top ^= t; b->top ^= t; #define BN_CONSTTIME_SWAP(ind) \ do { \ t = (a->d[ind] ^ b->d[ind]) & condition; \ a->d[ind] ^= t; \ b->d[ind] ^= t; \ } while (0) switch (nwords) { default: for (i = 10; i < nwords; i++) BN_CONSTTIME_SWAP(i); case 10: BN_CONSTTIME_SWAP(9); case 9: BN_CONSTTIME_SWAP(8); case 8: BN_CONSTTIME_SWAP(7); case 7: BN_CONSTTIME_SWAP(6); case 6: BN_CONSTTIME_SWAP(5); case 5: BN_CONSTTIME_SWAP(4); case 4: BN_CONSTTIME_SWAP(3); case 3: BN_CONSTTIME_SWAP(2); case 2: BN_CONSTTIME_SWAP(1); case 1: BN_CONSTTIME_SWAP(0); } #undef BN_CONSTTIME_SWAP } crypto/ec/ec2_mult.c:290: error: BUFFER_OVERRUN_L3 Offset: 9 Size: [0, 8388607] by call to `BN_consttime_swap`. Showing all 6 steps of the trace crypto/ec/ec2_mult.c:292:18: Call 290. BN_consttime_swap(word & mask, x1, x2, group_top); 291. BN_consttime_swap(word & mask, z1, z2, group_top); 292. if (!gf2m_Madd(group, point->X, x2, z2, x1, z1, ctx)) ^ 293. goto err; 294. if (!gf2m_Mdouble(group, x1, z1, ctx)) crypto/ec/ec2_mult.c:81:1: Parameter `x1->d` 79. * GF(2^m) without precomputation" (CHES '99, LNCS 1717). 80. */ 81. > static int gf2m_Madd(const EC_GROUP *group, const BIGNUM *x, BIGNUM *x1, 82. BIGNUM *z1, const BIGNUM *x2, const BIGNUM *z2, 83. BN_CTX *ctx) crypto/ec/ec2_mult.c:290:13: Call 288. word = bn_get_words(scalar)[i]; 289. while (mask) { 290. BN_consttime_swap(word & mask, x1, x2, group_top); ^ 291. BN_consttime_swap(word & mask, z1, z2, group_top); 292. if (!gf2m_Madd(group, point->X, x2, z2, x1, z1, ctx)) crypto/bn/bn_lib.c:830:1: <Length trace> 828. * a and b cannot be the same number 829. */ 830. > void BN_consttime_swap(BN_ULONG condition, BIGNUM *a, BIGNUM *b, int nwords) 831. { 832. BN_ULONG t; crypto/bn/bn_lib.c:830:1: Parameter `*b->d` 828. * a and b cannot be the same number 829. */ 830. > void BN_consttime_swap(BN_ULONG condition, BIGNUM *a, BIGNUM *b, int nwords) 831. { 832. BN_ULONG t; crypto/bn/bn_lib.c:861:9: Array access: Offset: 9 Size: [0, 8388607] by call to `BN_consttime_swap` 859. /* Fallthrough */ 860. case 10: 861. BN_CONSTTIME_SWAP(9); /* Fallthrough */ ^ 862. case 9: 863. BN_CONSTTIME_SWAP(8); /* Fallthrough */
https://github.com/openssl/openssl/blob/d7c42d71ba407a4b3c26ed58263ae225976bbac3/crypto/bn/bn_lib.c/#L861
d2a_code_trace_data_41805
static int ccm_tls_cipher(PROV_CCM_CTX *ctx, unsigned char *out, size_t *padlen, const unsigned char *in, size_t len) { int rv = 0; size_t olen = 0; if (out != in || len < (EVP_CCM_TLS_EXPLICIT_IV_LEN + (size_t)ctx->m)) goto err; if (ctx->enc) memcpy(out, ctx->buf, EVP_CCM_TLS_EXPLICIT_IV_LEN); memcpy(ctx->iv + EVP_CCM_TLS_FIXED_IV_LEN, in, EVP_CCM_TLS_EXPLICIT_IV_LEN); len -= EVP_CCM_TLS_EXPLICIT_IV_LEN + ctx->m; if (!ccm_set_iv(ctx, len)) goto err; if (!ctx->hw->setaad(ctx, ctx->buf, ctx->tls_aad_len)) goto err; in += EVP_CCM_TLS_EXPLICIT_IV_LEN; out += EVP_CCM_TLS_EXPLICIT_IV_LEN; if (ctx->enc) { if (!ctx->hw->auth_encrypt(ctx, in, out, len, out + len, ctx->m)) goto err; olen = len + EVP_CCM_TLS_EXPLICIT_IV_LEN + ctx->m; } else { if (!ctx->hw->auth_decrypt(ctx, in, out, len, (unsigned char *)in + len, ctx->m)) goto err; olen = len; } rv = 1; err: *padlen = olen; return rv; } providers/common/ciphers/cipher_ccm.c:254: error: INTEGER_OVERFLOW_L1 (0 - [8+max(0, `vctx->m`), 8+max(0, `vctx->m`)]):unsigned64 by call to `ccm_cipher_internal`. Showing all 9 steps of the trace providers/common/ciphers/cipher_ccm.c:248:1: Parameter `vctx->m` 246. } 247. 248. > int ccm_stream_final(void *vctx, unsigned char *out, size_t *outl, 249. size_t outsize) 250. { providers/common/ciphers/cipher_ccm.c:254:9: Call 252. int i; 253. 254. i = ccm_cipher_internal(ctx, out, outl, NULL, 0); ^ 255. if (i <= 0) 256. return 0; providers/common/ciphers/cipher_ccm.c:335:1: Parameter `len` 333. } 334. 335. > static int ccm_cipher_internal(PROV_CCM_CTX *ctx, unsigned char *out, 336. size_t *padlen, const unsigned char *in, 337. size_t len) providers/common/ciphers/cipher_ccm.c:348:16: Call 346. 347. if (ctx->tls_aad_len >= 0) 348. return ccm_tls_cipher(ctx, out, padlen, in, len); ^ 349. 350. /* EVP_*Final() doesn't return any data */ providers/common/ciphers/cipher_ccm.c:291:1: <LHS trace> 289. } 290. 291. > static int ccm_tls_cipher(PROV_CCM_CTX *ctx, 292. unsigned char *out, size_t *padlen, 293. const unsigned char *in, size_t len) providers/common/ciphers/cipher_ccm.c:291:1: Parameter `len` 289. } 290. 291. > static int ccm_tls_cipher(PROV_CCM_CTX *ctx, 292. unsigned char *out, size_t *padlen, 293. const unsigned char *in, size_t len) providers/common/ciphers/cipher_ccm.c:291:1: <RHS trace> 289. } 290. 291. > static int ccm_tls_cipher(PROV_CCM_CTX *ctx, 292. unsigned char *out, size_t *padlen, 293. const unsigned char *in, size_t len) providers/common/ciphers/cipher_ccm.c:291:1: Parameter `len` 289. } 290. 291. > static int ccm_tls_cipher(PROV_CCM_CTX *ctx, 292. unsigned char *out, size_t *padlen, 293. const unsigned char *in, size_t len) providers/common/ciphers/cipher_ccm.c:308:5: Binary operation: (0 - [8+max(0, vctx->m), 8+max(0, vctx->m)]):unsigned64 by call to `ccm_cipher_internal` 306. memcpy(ctx->iv + EVP_CCM_TLS_FIXED_IV_LEN, in, EVP_CCM_TLS_EXPLICIT_IV_LEN); 307. /* Correct length value */ 308. len -= EVP_CCM_TLS_EXPLICIT_IV_LEN + ctx->m; ^ 309. if (!ccm_set_iv(ctx, len)) 310. goto err;
https://github.com/openssl/openssl/blob/e1178600cc5d40b1e21c4a01d224afd2d8c7498a/providers/common/ciphers/cipher_ccm.c/#L308
d2a_code_trace_data_41806
static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { BinkAudioContext *s = avctx->priv_data; GetBitContext *gb = &s->gb; int ret, consumed = 0; if (!get_bits_left(gb)) { uint8_t *buf; if (!avpkt->size) { *got_frame_ptr = 0; return 0; } if (avpkt->size < 4) { av_log(avctx, AV_LOG_ERROR, "Packet is too small\n"); return AVERROR_INVALIDDATA; } buf = av_realloc(s->packet_buffer, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE); if (!buf) return AVERROR(ENOMEM); s->packet_buffer = buf; memcpy(s->packet_buffer, avpkt->data, avpkt->size); init_get_bits(gb, s->packet_buffer, avpkt->size * 8); consumed = avpkt->size; skip_bits_long(gb, 32); } s->frame.nb_samples = s->frame_len; if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } if (decode_block(s, (float **)s->frame.extended_data, avctx->codec->id == AV_CODEC_ID_BINKAUDIO_DCT)) { av_log(avctx, AV_LOG_ERROR, "Incomplete packet\n"); return AVERROR_INVALIDDATA; } get_bits_align32(gb); s->frame.nb_samples = s->block_size / avctx->channels; *got_frame_ptr = 1; *(AVFrame *)data = s->frame; return consumed; } libavcodec/binkaudio.c:333: error: Memory Leak memory dynamically allocated by call to `av_realloc()` at line 314, column 15 is not reachable after line 333, column 9. libavcodec/binkaudio.c:296:1: start of procedure decode_frame() 294. } 295. 296. static int decode_frame(AVCodecContext *avctx, void *data, ^ 297. int *got_frame_ptr, AVPacket *avpkt) 298. { libavcodec/binkaudio.c:299:5: 297. int *got_frame_ptr, AVPacket *avpkt) 298. { 299. BinkAudioContext *s = avctx->priv_data; ^ 300. GetBitContext *gb = &s->gb; 301. int ret, consumed = 0; libavcodec/binkaudio.c:300:5: 298. { 299. BinkAudioContext *s = avctx->priv_data; 300. GetBitContext *gb = &s->gb; ^ 301. int ret, consumed = 0; 302. libavcodec/binkaudio.c:301:5: 299. BinkAudioContext *s = avctx->priv_data; 300. GetBitContext *gb = &s->gb; 301. int ret, consumed = 0; ^ 302. 303. if (!get_bits_left(gb)) { libavcodec/binkaudio.c:303:10: 301. int ret, consumed = 0; 302. 303. if (!get_bits_left(gb)) { ^ 304. uint8_t *buf; 305. /* handle end-of-stream */ libavcodec/get_bits.h:505:1: start of procedure get_bits_left() 503. } 504. 505. static inline int get_bits_left(GetBitContext *gb) ^ 506. { 507. return gb->size_in_bits - get_bits_count(gb); libavcodec/get_bits.h:507:5: 505. static inline int get_bits_left(GetBitContext *gb) 506. { 507. return gb->size_in_bits - get_bits_count(gb); ^ 508. } 509. libavcodec/get_bits.h:192:1: start of procedure get_bits_count() 190. #define GET_CACHE(name, gb) ((uint32_t)name##_cache) 191. 192. static inline int get_bits_count(const GetBitContext *s) ^ 193. { 194. return s->index; libavcodec/get_bits.h:194:5: 192. static inline int get_bits_count(const GetBitContext *s) 193. { 194. return s->index; ^ 195. } 196. libavcodec/get_bits.h:195:1: return from a call to get_bits_count 193. { 194. return s->index; 195. } ^ 196. 197. static inline void skip_bits_long(GetBitContext *s, int n){ libavcodec/get_bits.h:508:1: return from a call to get_bits_left 506. { 507. return gb->size_in_bits - get_bits_count(gb); 508. } ^ 509. 510. //#define TRACE libavcodec/binkaudio.c:303:10: Taking true branch 301. int ret, consumed = 0; 302. 303. if (!get_bits_left(gb)) { ^ 304. uint8_t *buf; 305. /* handle end-of-stream */ libavcodec/binkaudio.c:306:14: Taking false branch 304. uint8_t *buf; 305. /* handle end-of-stream */ 306. if (!avpkt->size) { ^ 307. *got_frame_ptr = 0; 308. return 0; libavcodec/binkaudio.c:310:13: Taking false branch 308. return 0; 309. } 310. if (avpkt->size < 4) { ^ 311. av_log(avctx, AV_LOG_ERROR, "Packet is too small\n"); 312. return AVERROR_INVALIDDATA; libavcodec/binkaudio.c:314:9: 312. return AVERROR_INVALIDDATA; 313. } 314. buf = av_realloc(s->packet_buffer, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE); ^ 315. if (!buf) 316. return AVERROR(ENOMEM); libavutil/mem.c:119:1: start of procedure av_realloc() 117. } 118. 119. void *av_realloc(void *ptr, size_t size) ^ 120. { 121. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:126:8: Taking false branch 124. 125. /* let's disallow possible ambiguous cases */ 126. if(size > (INT_MAX-16) ) ^ 127. return NULL; 128. libavutil/mem.c:137:5: 135. return _aligned_realloc(ptr, size, 32); 136. #else 137. return realloc(ptr, size); ^ 138. #endif 139. } libavutil/mem.c:139:1: return from a call to av_realloc 137. return realloc(ptr, size); 138. #endif 139. } ^ 140. 141. void av_free(void *ptr) libavcodec/binkaudio.c:315:14: Taking false branch 313. } 314. buf = av_realloc(s->packet_buffer, avpkt->size + FF_INPUT_BUFFER_PADDING_SIZE); 315. if (!buf) ^ 316. return AVERROR(ENOMEM); 317. s->packet_buffer = buf; libavcodec/binkaudio.c:317:9: 315. if (!buf) 316. return AVERROR(ENOMEM); 317. s->packet_buffer = buf; ^ 318. memcpy(s->packet_buffer, avpkt->data, avpkt->size); 319. init_get_bits(gb, s->packet_buffer, avpkt->size * 8); libavcodec/binkaudio.c:318:9: 316. return AVERROR(ENOMEM); 317. s->packet_buffer = buf; 318. memcpy(s->packet_buffer, avpkt->data, avpkt->size); ^ 319. init_get_bits(gb, s->packet_buffer, avpkt->size * 8); 320. consumed = avpkt->size; libavcodec/binkaudio.c:319:9: 317. s->packet_buffer = buf; 318. memcpy(s->packet_buffer, avpkt->data, avpkt->size); 319. init_get_bits(gb, s->packet_buffer, avpkt->size * 8); ^ 320. consumed = avpkt->size; 321. 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/binkaudio.c:320:9: 318. memcpy(s->packet_buffer, avpkt->data, avpkt->size); 319. init_get_bits(gb, s->packet_buffer, avpkt->size * 8); 320. consumed = avpkt->size; ^ 321. 322. /* skip reported size */ libavcodec/binkaudio.c:323:9: 321. 322. /* skip reported size */ 323. skip_bits_long(gb, 32); ^ 324. } 325. libavcodec/get_bits.h:197:1: start of procedure skip_bits_long() 195. } 196. 197. static inline void skip_bits_long(GetBitContext *s, int n){ ^ 198. #if UNCHECKED_BITSTREAM_READER 199. s->index += n; libavcodec/get_bits.h:199:5: 197. static inline void skip_bits_long(GetBitContext *s, int n){ 198. #if UNCHECKED_BITSTREAM_READER 199. s->index += n; ^ 200. #else 201. s->index += av_clip(n, -s->index, s->size_in_bits_plus8 - s->index); libavcodec/get_bits.h:203:1: return from a call to skip_bits_long 201. s->index += av_clip(n, -s->index, s->size_in_bits_plus8 - s->index); 202. #endif 203. } ^ 204. 205. /** libavcodec/binkaudio.c:327:5: 325. 326. /* get output buffer */ 327. s->frame.nb_samples = s->frame_len; ^ 328. if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { 329. av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); libavcodec/binkaudio.c:328:9: Taking false branch 326. /* get output buffer */ 327. s->frame.nb_samples = s->frame_len; 328. if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { ^ 329. av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); 330. return ret; libavcodec/binkaudio.c:334:22: Condition is false 332. 333. if (decode_block(s, (float **)s->frame.extended_data, 334. avctx->codec->id == AV_CODEC_ID_BINKAUDIO_DCT)) { ^ 335. av_log(avctx, AV_LOG_ERROR, "Incomplete packet\n"); 336. return AVERROR_INVALIDDATA; libavcodec/binkaudio.c:333:9: Skipping decode_block(): empty list of specs 331. } 332. 333. if (decode_block(s, (float **)s->frame.extended_data, ^ 334. avctx->codec->id == AV_CODEC_ID_BINKAUDIO_DCT)) { 335. av_log(avctx, AV_LOG_ERROR, "Incomplete packet\n");
https://github.com/libav/libav/blob/7bfd1766d1c18f07b0a2dd042418a874d49ea60d/libavcodec/binkaudio.c/#L333
d2a_code_trace_data_41807
void TIFFSwabArrayOfShort(register uint16* wp, tmsize_t n) { register unsigned char* cp; register unsigned char t; assert(sizeof(uint16)==2); while (n-- > 0) { cp = (unsigned char*) wp; t = cp[1]; cp[1] = cp[0]; cp[0] = t; wp++; } } libtiff/tif_dirwrite.c:1710: error: Buffer Overrun L3 Offset: [1, +oo] (⇐ [0, +oo] + 1) Size: [0, +oo] by call to `TIFFWriteDirectoryTagCheckedShortArray`. libtiff/tif_dirwrite.c:1686:3: Assignment 1684. */ 1685. if (n>3) 1686. n=3; ^ 1687. if (n==3) 1688. { libtiff/tif_dirwrite.c:1699:4: Call 1697. if (n==0) 1698. n=1; 1699. o=_TIFFmalloc(n*m*sizeof(uint16)); ^ 1700. if (o==NULL) 1701. { libtiff/tif_unix.c:253:1: Parameter `s` 251. #endif 252. 253. void* ^ 254. _TIFFmalloc(tmsize_t s) 255. { libtiff/tif_unix.c:256:10: Array declaration 254. _TIFFmalloc(tmsize_t s) 255. { 256. return (malloc((size_t) s)); ^ 257. } 258. libtiff/tif_unix.c:256:2: Assignment 254. _TIFFmalloc(tmsize_t s) 255. { 256. return (malloc((size_t) s)); ^ 257. } 258. libtiff/tif_dirwrite.c:1699:2: Assignment 1697. if (n==0) 1698. n=1; 1699. o=_TIFFmalloc(n*m*sizeof(uint16)); ^ 1700. if (o==NULL) 1701. { libtiff/tif_dirwrite.c:1710:4: Call 1708. if (n>2) 1709. _TIFFmemcpy(&o[2*m],tif->tif_dir.td_transferfunction[2],m*sizeof(uint16)); 1710. p=TIFFWriteDirectoryTagCheckedShortArray(tif,ndir,dir,TIFFTAG_TRANSFERFUNCTION,n*m,o); ^ 1711. _TIFFfree(o); 1712. return(p); libtiff/tif_dirwrite.c:1830:1: Parameter `*value` 1828. } 1829. 1830. static int ^ 1831. TIFFWriteDirectoryTagCheckedShortArray(TIFF* tif, uint32* ndir, TIFFDirEntry* dir, uint16 tag, uint32 count, uint16* value) 1832. { libtiff/tif_dirwrite.c:1836:3: Call 1834. assert(sizeof(uint16)==2); 1835. if (tif->tif_flags&TIFF_SWAB) 1836. TIFFSwabArrayOfShort(value,count); ^ 1837. return(TIFFWriteDirectoryTagData(tif,ndir,dir,tag,TIFF_SHORT,count,count*2,value)); 1838. } libtiff/tif_swab.c:72:1: <Length trace> 70. 71. #ifndef TIFFSwabArrayOfShort 72. void ^ 73. TIFFSwabArrayOfShort(register uint16* wp, tmsize_t n) 74. { libtiff/tif_swab.c:72:1: Parameter `*wp` 70. 71. #ifndef TIFFSwabArrayOfShort 72. void ^ 73. TIFFSwabArrayOfShort(register uint16* wp, tmsize_t n) 74. { libtiff/tif_swab.c:80:3: Assignment 78. /* XXX unroll loop some */ 79. while (n-- > 0) { 80. cp = (unsigned char*) wp; ^ 81. t = cp[1]; cp[1] = cp[0]; cp[0] = t; 82. wp++; libtiff/tif_swab.c:81:7: Array access: Offset: [1, +oo] (⇐ [0, +oo] + 1) Size: [0, +oo] by call to `TIFFWriteDirectoryTagCheckedShortArray` 79. while (n-- > 0) { 80. cp = (unsigned char*) wp; 81. t = cp[1]; cp[1] = cp[0]; cp[0] = t; ^ 82. wp++; 83. }
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_swab.c/#L81
d2a_code_trace_data_41808
static int TIFFStartTile(TIFF* tif, uint32 tile) { TIFFDirectory *td = &tif->tif_dir; if ((tif->tif_flags & TIFF_CODERSETUP) == 0) { if (!(*tif->tif_setupdecode)(tif)) return (0); tif->tif_flags |= TIFF_CODERSETUP; } tif->tif_curtile = tile; tif->tif_row = (tile % TIFFhowmany_32(td->td_imagewidth, td->td_tilewidth)) * td->td_tilelength; tif->tif_col = (tile % TIFFhowmany_32(td->td_imagelength, td->td_tilelength)) * td->td_tilewidth; tif->tif_flags &= ~TIFF_BUF4WRITE; if (tif->tif_flags&TIFF_NOREADRAW) { tif->tif_rawcp = NULL; tif->tif_rawcc = 0; } else { tif->tif_rawcp = tif->tif_rawdata; tif->tif_rawcc = (tmsize_t)td->td_stripbytecount[tile]; } return ((*tif->tif_predecode)(tif, (uint16)(tile/td->td_stripsperimage))); } tools/tiffcrop.c:809: error: Integer Overflow L2 ([0, `in->tif_dir.td_tilelength`] - 1):unsigned32 by call to `TIFFReadTile`. tools/tiffcrop.c:779:1: Parameter `in->tif_dir.td_tilelength` 777. } 778. 779. static int readSeparateTilesIntoBuffer (TIFF* in, uint8 *buf, ^ 780. uint32 imagelength, uint32 imagewidth, uint16 spp) 781. { tools/tiffcrop.c:784:17: Call 782. int status = 1; 783. uint32 imagew = TIFFRasterScanlineSize(in); 784. uint32 tilew = TIFFTileRowSize(in); ^ 785. int iskew = imagew - tilew*spp; 786. tdata_t tilebuf = _TIFFmalloc(TIFFTileSize(in)); libtiff/tif_tile.c:184:1: Parameter `tif->tif_dir.td_tilelength` 182. return (TIFFhowmany8_64(rowsize)); 183. } 184. tmsize_t ^ 185. TIFFTileRowSize(TIFF* tif) 186. { libtiff/tif_tile.c:190:4: Call 188. uint64 m; 189. tmsize_t n; 190. m=TIFFTileRowSize64(tif); ^ 191. n=(tmsize_t)m; 192. if ((uint64)n!=m) libtiff/tif_tile.c:169:1: Parameter `tif->tif_dir.td_tilelength` 167. * Compute the # bytes in each row of a tile. 168. */ 169. uint64 ^ 170. TIFFTileRowSize64(TIFF* tif) 171. { tools/tiffcrop.c:786:32: Call 784. uint32 tilew = TIFFTileRowSize(in); 785. int iskew = imagew - tilew*spp; 786. tdata_t tilebuf = _TIFFmalloc(TIFFTileSize(in)); ^ 787. uint8* bufp = (uint8*) buf; 788. uint32 tw, tl; libtiff/tif_tile.c:274:1: Parameter `tif->tif_dir.td_tilelength` 272. return (TIFFVTileSize64(tif, tif->tif_dir.td_tilelength)); 273. } 274. tmsize_t ^ 275. TIFFTileSize(TIFF* tif) 276. { libtiff/tif_tile.c:280:4: Call 278. uint64 m; 279. tmsize_t n; 280. m=TIFFTileSize64(tif); ^ 281. n=(tmsize_t)m; 282. if ((uint64)n!=m) libtiff/tif_tile.c:269:1: Parameter `tif->tif_dir.td_tilelength` 267. * Compute the # bytes in a row-aligned tile. 268. */ 269. uint64 ^ 270. TIFFTileSize64(TIFF* tif) 271. { libtiff/tif_tile.c:272:10: Call 270. TIFFTileSize64(TIFF* tif) 271. { 272. return (TIFFVTileSize64(tif, tif->tif_dir.td_tilelength)); ^ 273. } 274. tmsize_t libtiff/tif_tile.c:203:1: Parameter `tif->tif_dir.td_tilelength` 201. * Compute the # bytes in a variable length, row-aligned tile. 202. */ 203. uint64 ^ 204. TIFFVTileSize64(TIFF* tif, uint32 nrows) 205. { tools/tiffcrop.c:809:9: Call 807. 808. for (s = 0; s < spp; s++) { 809. if (TIFFReadTile(in, tilebuf, col, row, 0, s) < 0 ^ 810. && !ignore) { 811. TIFFError(TIFFFileName(in), libtiff/tif_read.c:415:1: Parameter `tif->tif_dir.td_tilelength` 413. * tile is selected by the (x,y,z,s) coordinates. 414. */ 415. tmsize_t ^ 416. TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s) 417. { libtiff/tif_read.c:420:10: Call 418. if (!TIFFCheckRead(tif, 1) || !TIFFCheckTile(tif, x, y, z, s)) 419. return ((tmsize_t)(-1)); 420. return (TIFFReadEncodedTile(tif, ^ 421. TIFFComputeTile(tif, x, y, z, s), buf, (tmsize_t)(-1))); 422. } libtiff/tif_read.c:428:1: Parameter `tif->tif_dir.td_tilelength` 426. * amount into the user-supplied buffer. 427. */ 428. tmsize_t ^ 429. TIFFReadEncodedTile(TIFF* tif, uint32 tile, void* buf, tmsize_t size) 430. { libtiff/tif_read.c:447:6: Call 445. else if (size > tilesize) 446. size = tilesize; 447. if (TIFFFillTile(tif, tile) && (*tif->tif_decodetile)(tif, ^ 448. (uint8*) buf, size, (uint16)(tile/td->td_stripsperimage))) { 449. (*tif->tif_postdecode)(tif, (uint8*) buf, size); libtiff/tif_read.c:568:1: Parameter `tif->tif_dir.td_tilelength` 566. * expanded, as necessary, to hold the tile's data. 567. */ 568. int ^ 569. TIFFFillTile(TIFF* tif, uint32 tile) 570. { libtiff/tif_read.c:657:10: Call 655. } 656. } 657. return (TIFFStartTile(tif, tile)); ^ 658. } 659. libtiff/tif_read.c:737:1: <LHS trace> 735. * tile has just been read in. 736. */ 737. static int ^ 738. TIFFStartTile(TIFF* tif, uint32 tile) 739. { libtiff/tif_read.c:737:1: Parameter `tif->tif_dir.td_tilelength` 735. * tile has just been read in. 736. */ 737. static int ^ 738. TIFFStartTile(TIFF* tif, uint32 tile) 739. { libtiff/tif_read.c:751:2: Binary operation: ([0, in->tif_dir.td_tilelength] - 1):unsigned32 by call to `TIFFReadTile` 749. (tile % TIFFhowmany_32(td->td_imagewidth, td->td_tilewidth)) * 750. td->td_tilelength; 751. tif->tif_col = ^ 752. (tile % TIFFhowmany_32(td->td_imagelength, td->td_tilelength)) * 753. td->td_tilewidth;
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_read.c/#L751
d2a_code_trace_data_41809
int ssl3_send_client_key_exchange(SSL *s) { unsigned char *p; int n; #ifndef OPENSSL_NO_PSK size_t pskhdrlen = 0; #endif unsigned long alg_k; #ifndef OPENSSL_NO_RSA unsigned char *q; EVP_PKEY *pkey = NULL; #endif #ifndef OPENSSL_NO_EC EC_KEY *clnt_ecdh = NULL; const EC_POINT *srvr_ecpoint = NULL; EVP_PKEY *srvr_pub_pkey = NULL; unsigned char *encodedPoint = NULL; int encoded_pt_len = 0; BN_CTX *bn_ctx = NULL; #endif unsigned char *pms = NULL; size_t pmslen = 0; alg_k = s->s3->tmp.new_cipher->algorithm_mkey; if (s->state == SSL3_ST_CW_KEY_EXCH_A) { p = ssl_handshake_start(s); #ifndef OPENSSL_NO_PSK if (alg_k & SSL_PSK) { int psk_err = 1; char identity[PSK_MAX_IDENTITY_LEN + 1]; size_t identitylen; unsigned char psk[PSK_MAX_PSK_LEN]; size_t psklen; if (s->psk_client_callback == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, SSL_R_PSK_NO_CLIENT_CB); goto err; } memset(identity, 0, sizeof(identity)); psklen = s->psk_client_callback(s, s->session->psk_identity_hint, identity, sizeof(identity) - 1, psk, sizeof(psk)); if (psklen > PSK_MAX_PSK_LEN) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto psk_err; } else if (psklen == 0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, SSL_R_PSK_IDENTITY_NOT_FOUND); goto psk_err; } OPENSSL_free(s->s3->tmp.psk); s->s3->tmp.psk = BUF_memdup(psk, psklen); OPENSSL_cleanse(psk, psklen); if (s->s3->tmp.psk == NULL) { OPENSSL_cleanse(identity, sizeof(identity)); goto memerr; } s->s3->tmp.psklen = psklen; identitylen = strlen(identity); if (identitylen > PSK_MAX_IDENTITY_LEN) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto psk_err; } OPENSSL_free(s->session->psk_identity); s->session->psk_identity = BUF_strdup(identity); if (s->session->psk_identity == NULL) { OPENSSL_cleanse(identity, sizeof(identity)); goto memerr; } s2n(identitylen, p); memcpy(p, identity, identitylen); pskhdrlen = 2 + identitylen; p += identitylen; psk_err = 0; psk_err: OPENSSL_cleanse(identity, sizeof(identity)); if (psk_err != 0) { ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE); goto err; } } if (alg_k & SSL_kPSK) { n = 0; } else #endif if (0) { } #ifndef OPENSSL_NO_RSA else if (alg_k & (SSL_kRSA | SSL_kRSAPSK)) { RSA *rsa; pmslen = SSL_MAX_MASTER_KEY_LENGTH; pms = OPENSSL_malloc(pmslen); if (!pms) goto memerr; if (s->session->peer == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } if (s->s3->peer_rsa_tmp != NULL) rsa = s->s3->peer_rsa_tmp; else { pkey = X509_get_pubkey(s->session->peer); if ((pkey == NULL) || (pkey->type != EVP_PKEY_RSA) || (pkey->pkey.rsa == NULL)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); EVP_PKEY_free(pkey); goto err; } rsa = pkey->pkey.rsa; EVP_PKEY_free(pkey); } pms[0] = s->client_version >> 8; pms[1] = s->client_version & 0xff; if (RAND_bytes(pms + 2, pmslen - 2) <= 0) goto err; q = p; if (s->version > SSL3_VERSION) p += 2; n = RSA_public_encrypt(pmslen, pms, p, rsa, RSA_PKCS1_PADDING); # ifdef PKCS1_CHECK if (s->options & SSL_OP_PKCS1_CHECK_1) p[1]++; if (s->options & SSL_OP_PKCS1_CHECK_2) tmp_buf[0] = 0x70; # endif if (n <= 0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, SSL_R_BAD_RSA_ENCRYPT); goto err; } if (s->version > SSL3_VERSION) { s2n(n, q); n += 2; } } #endif #ifndef OPENSSL_NO_DH else if (alg_k & (SSL_kDHE | SSL_kDHr | SSL_kDHd | SSL_kDHEPSK)) { DH *dh_srvr, *dh_clnt; if (s->s3->peer_dh_tmp != NULL) dh_srvr = s->s3->peer_dh_tmp; else { EVP_PKEY *spkey = NULL; dh_srvr = NULL; spkey = X509_get_pubkey(s->session->peer); if (spkey) { dh_srvr = EVP_PKEY_get1_DH(spkey); EVP_PKEY_free(spkey); } if (dh_srvr == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } } if (s->s3->flags & TLS1_FLAGS_SKIP_CERT_VERIFY) { EVP_PKEY *clkey = s->cert->key->privatekey; dh_clnt = NULL; if (clkey) dh_clnt = EVP_PKEY_get1_DH(clkey); if (dh_clnt == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } } else { if ((dh_clnt = DHparams_dup(dh_srvr)) == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_DH_LIB); goto err; } if (!DH_generate_key(dh_clnt)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_DH_LIB); DH_free(dh_clnt); goto err; } } pmslen = DH_size(dh_clnt); pms = OPENSSL_malloc(pmslen); if (!pms) goto memerr; n = DH_compute_key(pms, dh_srvr->pub_key, dh_clnt); if (s->s3->peer_dh_tmp == NULL) DH_free(dh_srvr); if (n <= 0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_DH_LIB); DH_free(dh_clnt); goto err; } pmslen = n; if (s->s3->flags & TLS1_FLAGS_SKIP_CERT_VERIFY) n = 0; else { n = BN_num_bytes(dh_clnt->pub_key); s2n(n, p); BN_bn2bin(dh_clnt->pub_key, p); n += 2; } DH_free(dh_clnt); } #endif #ifndef OPENSSL_NO_EC else if (alg_k & (SSL_kECDHE | SSL_kECDHr | SSL_kECDHe | SSL_kECDHEPSK)) { const EC_GROUP *srvr_group = NULL; EC_KEY *tkey; int ecdh_clnt_cert = 0; int field_size = 0; if ((alg_k & (SSL_kECDHr | SSL_kECDHe)) && (s->cert != NULL)) { } if (s->s3->peer_ecdh_tmp != NULL) { tkey = s->s3->peer_ecdh_tmp; } else { srvr_pub_pkey = X509_get_pubkey(s->session->peer); if ((srvr_pub_pkey == NULL) || (srvr_pub_pkey->type != EVP_PKEY_EC) || (srvr_pub_pkey->pkey.ec == NULL)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } tkey = srvr_pub_pkey->pkey.ec; } srvr_group = EC_KEY_get0_group(tkey); srvr_ecpoint = EC_KEY_get0_public_key(tkey); if ((srvr_group == NULL) || (srvr_ecpoint == NULL)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } if ((clnt_ecdh = EC_KEY_new()) == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE); goto err; } if (!EC_KEY_set_group(clnt_ecdh, srvr_group)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_EC_LIB); goto err; } if (ecdh_clnt_cert) { const BIGNUM *priv_key; tkey = s->cert->key->privatekey->pkey.ec; priv_key = EC_KEY_get0_private_key(tkey); if (priv_key == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE); goto err; } if (!EC_KEY_set_private_key(clnt_ecdh, priv_key)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_EC_LIB); goto err; } } else { if (!(EC_KEY_generate_key(clnt_ecdh))) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_ECDH_LIB); goto err; } } field_size = EC_GROUP_get_degree(srvr_group); if (field_size <= 0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_ECDH_LIB); goto err; } pmslen = (field_size + 7) / 8; pms = OPENSSL_malloc(pmslen); if (!pms) goto memerr; n = ECDH_compute_key(pms, pmslen, srvr_ecpoint, clnt_ecdh, NULL); if (n <= 0 || pmslen != (size_t)n) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_ECDH_LIB); goto err; } if (ecdh_clnt_cert) { n = 0; } else { encoded_pt_len = EC_POINT_point2oct(srvr_group, EC_KEY_get0_public_key(clnt_ecdh), POINT_CONVERSION_UNCOMPRESSED, NULL, 0, NULL); encodedPoint = (unsigned char *) OPENSSL_malloc(encoded_pt_len * sizeof(unsigned char)); bn_ctx = BN_CTX_new(); if ((encodedPoint == NULL) || (bn_ctx == NULL)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE); goto err; } n = EC_POINT_point2oct(srvr_group, EC_KEY_get0_public_key(clnt_ecdh), POINT_CONVERSION_UNCOMPRESSED, encodedPoint, encoded_pt_len, bn_ctx); *p = n; p += 1; memcpy(p, encodedPoint, n); n += 1; } BN_CTX_free(bn_ctx); OPENSSL_free(encodedPoint); EC_KEY_free(clnt_ecdh); EVP_PKEY_free(srvr_pub_pkey); } #endif else if (alg_k & SSL_kGOST) { EVP_PKEY_CTX *pkey_ctx; X509 *peer_cert; size_t msglen; unsigned int md_len; unsigned char shared_ukm[32], tmp[256]; EVP_MD_CTX *ukm_hash; EVP_PKEY *pub_key; pmslen = 32; pms = OPENSSL_malloc(pmslen); if (!pms) goto memerr; peer_cert = s->session->peer; if (!peer_cert) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER); goto err; } pkey_ctx = EVP_PKEY_CTX_new(pub_key = X509_get_pubkey(peer_cert), NULL); EVP_PKEY_encrypt_init(pkey_ctx); if (RAND_bytes(pms, pmslen) <= 0) { EVP_PKEY_CTX_free(pkey_ctx); SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; }; if (s->s3->tmp.cert_req && s->cert->key->privatekey) { if (EVP_PKEY_derive_set_peer (pkey_ctx, s->cert->key->privatekey) <= 0) { ERR_clear_error(); } } ukm_hash = EVP_MD_CTX_create(); EVP_DigestInit(ukm_hash, EVP_get_digestbynid(NID_id_GostR3411_94)); EVP_DigestUpdate(ukm_hash, s->s3->client_random, SSL3_RANDOM_SIZE); EVP_DigestUpdate(ukm_hash, s->s3->server_random, SSL3_RANDOM_SIZE); EVP_DigestFinal_ex(ukm_hash, shared_ukm, &md_len); EVP_MD_CTX_destroy(ukm_hash); if (EVP_PKEY_CTX_ctrl (pkey_ctx, -1, EVP_PKEY_OP_ENCRYPT, EVP_PKEY_CTRL_SET_IV, 8, shared_ukm) < 0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, SSL_R_LIBRARY_BUG); goto err; } *(p++) = V_ASN1_SEQUENCE | V_ASN1_CONSTRUCTED; msglen = 255; if (EVP_PKEY_encrypt(pkey_ctx, tmp, &msglen, pms, pmslen) < 0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, SSL_R_LIBRARY_BUG); goto err; } if (msglen >= 0x80) { *(p++) = 0x81; *(p++) = msglen & 0xff; n = msglen + 3; } else { *(p++) = msglen & 0xff; n = msglen + 2; } memcpy(p, tmp, msglen); if (EVP_PKEY_CTX_ctrl (pkey_ctx, -1, -1, EVP_PKEY_CTRL_PEER_KEY, 2, NULL) > 0) { s->s3->flags |= TLS1_FLAGS_SKIP_CERT_VERIFY; } EVP_PKEY_CTX_free(pkey_ctx); EVP_PKEY_free(pub_key); } #ifndef OPENSSL_NO_SRP else if (alg_k & SSL_kSRP) { if (s->srp_ctx.A != NULL) { n = BN_num_bytes(s->srp_ctx.A); s2n(n, p); BN_bn2bin(s->srp_ctx.A, p); n += 2; } else { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } OPENSSL_free(s->session->srp_username); s->session->srp_username = BUF_strdup(s->srp_ctx.login); if (s->session->srp_username == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE); goto err; } } #endif else { ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE); SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } #ifndef OPENSSL_NO_PSK n += pskhdrlen; #endif if (!ssl_set_handshake_header(s, SSL3_MT_CLIENT_KEY_EXCHANGE, n)) { ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE); SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } s->state = SSL3_ST_CW_KEY_EXCH_B; } n = ssl_do_write(s); #ifndef OPENSSL_NO_SRP if (alg_k & SSL_kSRP) { if (n > 0) { if (!srp_generate_client_master_secret(s)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } } } else #endif if (n <= 0) { s->s3->tmp.pms = pms; s->s3->tmp.pmslen = pmslen; } else { if (pms == NULL) { pms = s->s3->tmp.pms; pmslen = s->s3->tmp.pmslen; } if (pms == NULL && !(alg_k & SSL_kPSK)) { ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_INTERNAL_ERROR); SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE); goto err; } if (!ssl_generate_master_secret(s, pms, pmslen, 1)) { ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_INTERNAL_ERROR); SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } } return n; memerr: ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_INTERNAL_ERROR); SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE); err: OPENSSL_clear_free(pms, pmslen); s->s3->tmp.pms = NULL; #ifndef OPENSSL_NO_EC BN_CTX_free(bn_ctx); OPENSSL_free(encodedPoint); EC_KEY_free(clnt_ecdh); EVP_PKEY_free(srvr_pub_pkey); #endif #ifndef OPENSSL_NO_PSK OPENSSL_clear_free(s->s3->tmp.psk, s->s3->tmp.psklen); s->s3->tmp.psk = NULL; #endif s->state = SSL_ST_ERR; return (-1); } ssl/s3_clnt.c:2825: error: UNINITIALIZED_VALUE The value read from n was never initialized. Showing all 1 steps of the trace ssl/s3_clnt.c:2825:9: 2823. 2824. #ifndef OPENSSL_NO_PSK 2825. > n += pskhdrlen; 2826. #endif 2827.
https://github.com/openssl/openssl/blob/f8e0a5573820bd7318782d4954c6643ff7e58102/ssl/s3_clnt.c/#L2825
d2a_code_trace_data_41810
EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags, const char *pem_str, const char *info) { EVP_PKEY_ASN1_METHOD *ameth = OPENSSL_zalloc(sizeof(*ameth)); if (ameth == NULL) return NULL; ameth->pkey_id = id; ameth->pkey_base_id = id; ameth->pkey_flags = flags | ASN1_PKEY_DYNAMIC; if (info) { ameth->info = OPENSSL_strdup(info); if (!ameth->info) goto err; } if (pem_str) { ameth->pem_str = OPENSSL_strdup(pem_str); if (!ameth->pem_str) goto err; } return ameth; err: EVP_PKEY_asn1_free(ameth); return NULL; } crypto/asn1/ameth_lib.c:301: error: MEMORY_LEAK memory dynamically allocated by call to `CRYPTO_zalloc()` at line 277, column 35 is not reachable after line 301, column 5. Showing all 65 steps of the trace crypto/asn1/ameth_lib.c:274:1: start of procedure EVP_PKEY_asn1_new() 272. } 273. 274. > EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_new(int id, int flags, 275. const char *pem_str, const char *info) 276. { crypto/asn1/ameth_lib.c:277:5: 275. const char *pem_str, const char *info) 276. { 277. > EVP_PKEY_ASN1_METHOD *ameth = OPENSSL_zalloc(sizeof(*ameth)); 278. 279. if (ameth == 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/asn1/ameth_lib.c:279:9: Taking false branch 277. EVP_PKEY_ASN1_METHOD *ameth = OPENSSL_zalloc(sizeof(*ameth)); 278. 279. if (ameth == NULL) ^ 280. return NULL; 281. crypto/asn1/ameth_lib.c:282:5: 280. return NULL; 281. 282. > ameth->pkey_id = id; 283. ameth->pkey_base_id = id; 284. ameth->pkey_flags = flags | ASN1_PKEY_DYNAMIC; crypto/asn1/ameth_lib.c:283:5: 281. 282. ameth->pkey_id = id; 283. > ameth->pkey_base_id = id; 284. ameth->pkey_flags = flags | ASN1_PKEY_DYNAMIC; 285. crypto/asn1/ameth_lib.c:284:5: 282. ameth->pkey_id = id; 283. ameth->pkey_base_id = id; 284. > ameth->pkey_flags = flags | ASN1_PKEY_DYNAMIC; 285. 286. if (info) { crypto/asn1/ameth_lib.c:286:9: Taking true branch 284. ameth->pkey_flags = flags | ASN1_PKEY_DYNAMIC; 285. 286. if (info) { ^ 287. ameth->info = OPENSSL_strdup(info); 288. if (!ameth->info) crypto/asn1/ameth_lib.c:287:9: 285. 286. if (info) { 287. > ameth->info = OPENSSL_strdup(info); 288. if (!ameth->info) 289. goto err; crypto/o_str.c:121:1: start of procedure CRYPTO_strdup() 119. } 120. 121. > char *CRYPTO_strdup(const char *str, const char* file, int line) 122. { 123. char *ret; crypto/o_str.c:125:9: Taking false branch 123. char *ret; 124. 125. if (str == NULL) ^ 126. return NULL; 127. ret = CRYPTO_malloc(strlen(str) + 1, file, line); crypto/o_str.c:127:5: 125. if (str == NULL) 126. return NULL; 127. > ret = CRYPTO_malloc(strlen(str) + 1, file, line); 128. if (ret != NULL) 129. strcpy(ret, str); crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/o_str.c:128:9: Taking true branch 126. return NULL; 127. ret = CRYPTO_malloc(strlen(str) + 1, file, line); 128. if (ret != NULL) ^ 129. strcpy(ret, str); 130. return ret; crypto/o_str.c:129:9: 127. ret = CRYPTO_malloc(strlen(str) + 1, file, line); 128. if (ret != NULL) 129. > strcpy(ret, str); 130. return ret; 131. } crypto/o_str.c:130:5: 128. if (ret != NULL) 129. strcpy(ret, str); 130. > return ret; 131. } 132. crypto/o_str.c:131:1: return from a call to CRYPTO_strdup 129. strcpy(ret, str); 130. return ret; 131. > } 132. 133. char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line) crypto/asn1/ameth_lib.c:288:14: Taking false branch 286. if (info) { 287. ameth->info = OPENSSL_strdup(info); 288. if (!ameth->info) ^ 289. goto err; 290. } crypto/asn1/ameth_lib.c:292:9: Taking true branch 290. } 291. 292. if (pem_str) { ^ 293. ameth->pem_str = OPENSSL_strdup(pem_str); 294. if (!ameth->pem_str) crypto/asn1/ameth_lib.c:293:9: 291. 292. if (pem_str) { 293. > ameth->pem_str = OPENSSL_strdup(pem_str); 294. if (!ameth->pem_str) 295. goto err; crypto/o_str.c:121:1: start of procedure CRYPTO_strdup() 119. } 120. 121. > char *CRYPTO_strdup(const char *str, const char* file, int line) 122. { 123. char *ret; crypto/o_str.c:125:9: Taking false branch 123. char *ret; 124. 125. if (str == NULL) ^ 126. return NULL; 127. ret = CRYPTO_malloc(strlen(str) + 1, file, line); crypto/o_str.c:127:5: 125. if (str == NULL) 126. return NULL; 127. > ret = CRYPTO_malloc(strlen(str) + 1, file, line); 128. if (ret != NULL) 129. strcpy(ret, str); crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/o_str.c:128:9: Taking false branch 126. return NULL; 127. ret = CRYPTO_malloc(strlen(str) + 1, file, line); 128. if (ret != NULL) ^ 129. strcpy(ret, str); 130. return ret; crypto/o_str.c:130:5: 128. if (ret != NULL) 129. strcpy(ret, str); 130. > return ret; 131. } 132. crypto/o_str.c:131:1: return from a call to CRYPTO_strdup 129. strcpy(ret, str); 130. return ret; 131. > } 132. 133. char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line) crypto/asn1/ameth_lib.c:294:14: Taking true branch 292. if (pem_str) { 293. ameth->pem_str = OPENSSL_strdup(pem_str); 294. if (!ameth->pem_str) ^ 295. goto err; 296. } crypto/asn1/ameth_lib.c:300:2: 298. return ameth; 299. 300. > err: 301. EVP_PKEY_asn1_free(ameth); 302. return NULL; crypto/asn1/ameth_lib.c:301:5: 299. 300. err: 301. > EVP_PKEY_asn1_free(ameth); 302. return NULL; 303. crypto/asn1/ameth_lib.c:340:1: start of procedure EVP_PKEY_asn1_free() 338. } 339. 340. > void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth) 341. { 342. if (ameth && (ameth->pkey_flags & ASN1_PKEY_DYNAMIC)) { crypto/asn1/ameth_lib.c:342:9: Taking true branch 340. void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth) 341. { 342. if (ameth && (ameth->pkey_flags & ASN1_PKEY_DYNAMIC)) { ^ 343. OPENSSL_free(ameth->pem_str); 344. OPENSSL_free(ameth->info); crypto/asn1/ameth_lib.c:342:19: Taking false branch 340. void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth) 341. { 342. if (ameth && (ameth->pkey_flags & ASN1_PKEY_DYNAMIC)) { ^ 343. OPENSSL_free(ameth->pem_str); 344. OPENSSL_free(ameth->info); crypto/asn1/ameth_lib.c:342:5: 340. void EVP_PKEY_asn1_free(EVP_PKEY_ASN1_METHOD *ameth) 341. { 342. > if (ameth && (ameth->pkey_flags & ASN1_PKEY_DYNAMIC)) { 343. OPENSSL_free(ameth->pem_str); 344. OPENSSL_free(ameth->info); crypto/asn1/ameth_lib.c:347:1: return from a call to EVP_PKEY_asn1_free 345. OPENSSL_free(ameth); 346. } 347. > } 348. 349. void EVP_PKEY_asn1_set_public(EVP_PKEY_ASN1_METHOD *ameth,
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/asn1/ameth_lib.c/#L301
d2a_code_trace_data_41811
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_dprintf_link(NULL, link, 0); dprintf(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_dprintf_link(NULL, link, 0); dprintf(NULL, " returning "); ff_dprintf_ref(NULL, ret, 1); return ret; } libavfilter/avfilter.c:288: error: Null Dereference pointer `ret` last assigned on line 283 could be null and is dereferenced by call to `ff_dprintf_ref()` at line 288, column 109. libavfilter/avfilter.c:271:1: start of procedure avfilter_get_video_buffer() 269. } 270. 271. AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) ^ 272. { 273. AVFilterBufferRef *ret = NULL; libavfilter/avfilter.c:273:5: 271. AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) 272. { 273. AVFilterBufferRef *ret = NULL; ^ 274. 275. av_unused char buf[16]; libavfilter/avfilter.c:276:47: 274. 275. av_unused char buf[16]; 276. FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0); ^ 277. dprintf(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, sizeof(buf), perms), w, h); 278. libavfilter/avfilter.c:247:1: start of procedure ff_dprintf_link() 245. } 246. 247. void ff_dprintf_link(void *ctx, AVFilterLink *link, int end) ^ 248. { 249. if (link->type == AVMEDIA_TYPE_VIDEO) { libavfilter/avfilter.c:249:9: Taking false branch 247. void ff_dprintf_link(void *ctx, AVFilterLink *link, int end) 248. { 249. if (link->type == AVMEDIA_TYPE_VIDEO) { ^ 250. dprintf(ctx, 251. "link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s", libavfilter/avfilter.c:259:9: Skipping av_get_channel_layout_string(): empty list of specs 257. } else { 258. char buf[128]; 259. av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout); ^ 260. 261. dprintf(ctx, libavfilter/avfilter.c:249:5: 247. void ff_dprintf_link(void *ctx, AVFilterLink *link, int end) 248. { 249. if (link->type == AVMEDIA_TYPE_VIDEO) { ^ 250. dprintf(ctx, 251. "link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s", libavfilter/avfilter.c:269:1: return from a call to ff_dprintf_link 267. end ? "\n" : ""); 268. } 269. } ^ 270. 271. AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) libavfilter/avfilter.c:279:9: Taking true branch 277. dprintf(NULL, " perms:%s w:%d h:%d\n", ff_get_ref_perms_string(buf, sizeof(buf), perms), w, h); 278. 279. if (link->dstpad->get_video_buffer) ^ 280. ret = link->dstpad->get_video_buffer(link, perms, w, h); 281. libavfilter/avfilter.c:280:9: Skipping __function_pointer__(): unresolved function pointer 278. 279. if (link->dstpad->get_video_buffer) 280. ret = link->dstpad->get_video_buffer(link, perms, w, h); ^ 281. 282. if (!ret) libavfilter/avfilter.c:282:10: Taking true branch 280. ret = link->dstpad->get_video_buffer(link, perms, w, h); 281. 282. if (!ret) ^ 283. ret = avfilter_default_get_video_buffer(link, perms, w, h); 284. libavfilter/avfilter.c:283:9: Skipping avfilter_default_get_video_buffer(): empty list of specs 281. 282. if (!ret) 283. ret = avfilter_default_get_video_buffer(link, perms, w, h); ^ 284. 285. if (ret) libavfilter/avfilter.c:285:9: Taking false branch 283. ret = avfilter_default_get_video_buffer(link, perms, w, h); 284. 285. if (ret) ^ 286. ret->type = AVMEDIA_TYPE_VIDEO; 287. libavfilter/avfilter.c:288:47: 286. ret->type = AVMEDIA_TYPE_VIDEO; 287. 288. FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " returning "); ff_dprintf_ref(NULL, ret, 1); ^ 289. 290. return ret; libavfilter/avfilter.c:247:1: start of procedure ff_dprintf_link() 245. } 246. 247. void ff_dprintf_link(void *ctx, AVFilterLink *link, int end) ^ 248. { 249. if (link->type == AVMEDIA_TYPE_VIDEO) { libavfilter/avfilter.c:249:9: Taking false branch 247. void ff_dprintf_link(void *ctx, AVFilterLink *link, int end) 248. { 249. if (link->type == AVMEDIA_TYPE_VIDEO) { ^ 250. dprintf(ctx, 251. "link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s", libavfilter/avfilter.c:259:9: Skipping av_get_channel_layout_string(): empty list of specs 257. } else { 258. char buf[128]; 259. av_get_channel_layout_string(buf, sizeof(buf), -1, link->channel_layout); ^ 260. 261. dprintf(ctx, libavfilter/avfilter.c:249:5: 247. void ff_dprintf_link(void *ctx, AVFilterLink *link, int end) 248. { 249. if (link->type == AVMEDIA_TYPE_VIDEO) { ^ 250. dprintf(ctx, 251. "link[%p s:%dx%d fmt:%-16s %-16s->%-16s]%s", libavfilter/avfilter.c:269:1: return from a call to ff_dprintf_link 267. end ? "\n" : ""); 268. } 269. } ^ 270. 271. AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int w, int h) libavfilter/avfilter.c:288:109: 286. ret->type = AVMEDIA_TYPE_VIDEO; 287. 288. FF_DPRINTF_START(NULL, get_video_buffer); ff_dprintf_link(NULL, link, 0); dprintf(NULL, " returning "); ff_dprintf_ref(NULL, ret, 1); ^ 289. 290. return ret; libavfilter/avfilter.c:219:1: start of procedure ff_dprintf_ref() 217. } 218. 219. void ff_dprintf_ref(void *ctx, AVFilterBufferRef *ref, int end) ^ 220. { 221. av_unused char buf[16]; libavfilter/avfilter.c:228:9: Taking false branch 226. ref->pts, ref->pos); 227. 228. if (ref->video) { ^ 229. dprintf(ctx, " a:%d/%d s:%dx%d i:%c", 230. ref->video->pixel_aspect.num, ref->video->pixel_aspect.den,
https://github.com/libav/libav/blob/1d5b1885183f38673ccb64b0f143dde7946b94a6/libavfilter/avfilter.c/#L288
d2a_code_trace_data_41812
static ngx_int_t ngx_http_upstream_addr_variable(ngx_http_request_t *r, ngx_http_variable_value_t *v, uintptr_t data) { u_char *p; size_t len; ngx_uint_t i; ngx_http_upstream_state_t *state; v->valid = 1; v->no_cacheable = 0; v->not_found = 0; if (r->upstream_states == NULL || r->upstream_states->nelts == 0) { v->not_found = 1; return NGX_OK; } len = 0; state = r->upstream_states->elts; for (i = 0; i < r->upstream_states->nelts; i++) { if (state[i].peer) { len += state[i].peer->len + 2; } else { len += 3; } } p = ngx_pnalloc(r->pool, len); if (p == NULL) { return NGX_ERROR; } v->data = p; i = 0; for ( ;; ) { if (state[i].peer) { p = ngx_cpymem(p, state[i].peer->data, state[i].peer->len); } if (++i == r->upstream_states->nelts) { break; } if (state[i].peer) { *p++ = ','; *p++ = ' '; } else { *p++ = ' '; *p++ = ':'; *p++ = ' '; if (++i == r->upstream_states->nelts) { break; } continue; } } v->len = p - v->data; return NGX_OK; } src/http/ngx_http_upstream.c:3425: error: Buffer Overrun L3 Offset: [1, +oo] Size: [0, +oo]. src/http/ngx_http_upstream.c:3393:5: <Length trace> 3391. } 3392. 3393. len = 0; ^ 3394. state = r->upstream_states->elts; 3395. src/http/ngx_http_upstream.c:3393:5: Assignment 3391. } 3392. 3393. len = 0; ^ 3394. state = r->upstream_states->elts; 3395. src/http/ngx_http_upstream.c:3405:9: Call 3403. } 3404. 3405. p = ngx_pnalloc(r->pool, len); ^ 3406. if (p == NULL) { 3407. 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_upstream.c:3405:5: Assignment 3403. } 3404. 3405. p = ngx_pnalloc(r->pool, len); ^ 3406. if (p == NULL) { 3407. return NGX_ERROR; src/http/ngx_http_upstream.c:3424:14: Assignment 3422. 3423. if (state[i].peer) { 3424. *p++ = ','; ^ 3425. *p++ = ' '; 3426. src/http/ngx_http_upstream.c:3425:13: Array access: Offset: [1, +oo] Size: [0, +oo] 3423. if (state[i].peer) { 3424. *p++ = ','; 3425. *p++ = ' '; ^ 3426. 3427. } else {
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/http/ngx_http_upstream.c/#L3425
d2a_code_trace_data_41813
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_prime.c:306: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_gcd`. Showing all 33 steps of the trace crypto/bn/bn_prime.c:249:1: Parameter `ctx->stack.depth` 247. * returns 0 if there was an error, otherwise it returns 1. 248. */ 249. > int bn_miller_rabin_is_prime(const BIGNUM *w, int iterations, BN_CTX *ctx, 250. BN_GENCB *cb, int enhanced, int *status) 251. { crypto/bn/bn_prime.c:260:5: Call 258. return 0; 259. 260. BN_CTX_start(ctx); ^ 261. g = BN_CTX_get(ctx); 262. w1 = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_prime.c:261:9: Call 259. 260. BN_CTX_start(ctx); 261. g = BN_CTX_get(ctx); ^ 262. w1 = BN_CTX_get(ctx); 263. w3 = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_prime.c:262:10: Call 260. BN_CTX_start(ctx); 261. g = BN_CTX_get(ctx); 262. w1 = BN_CTX_get(ctx); ^ 263. w3 = BN_CTX_get(ctx); 264. x = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_prime.c:263:10: Call 261. g = BN_CTX_get(ctx); 262. w1 = BN_CTX_get(ctx); 263. w3 = BN_CTX_get(ctx); ^ 264. x = BN_CTX_get(ctx); 265. m = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_prime.c:264:9: Call 262. w1 = BN_CTX_get(ctx); 263. w3 = BN_CTX_get(ctx); 264. x = BN_CTX_get(ctx); ^ 265. m = BN_CTX_get(ctx); 266. z = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_prime.c:265:9: Call 263. w3 = BN_CTX_get(ctx); 264. x = BN_CTX_get(ctx); 265. m = BN_CTX_get(ctx); ^ 266. z = BN_CTX_get(ctx); 267. b = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_prime.c:266:9: Call 264. x = BN_CTX_get(ctx); 265. m = BN_CTX_get(ctx); 266. z = BN_CTX_get(ctx); ^ 267. b = BN_CTX_get(ctx); 268. crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_prime.c:267:9: Call 265. m = BN_CTX_get(ctx); 266. z = BN_CTX_get(ctx); 267. b = BN_CTX_get(ctx); ^ 268. 269. if (!(b != NULL crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_prime.c:292:26: Call 290. /* Montgomery setup for computations mod a */ 291. mont = BN_MONT_CTX_new(); 292. if (mont == NULL || !BN_MONT_CTX_set(mont, w, ctx)) ^ 293. goto err; 294. crypto/bn/bn_mont.c:263:1: Parameter `ctx->stack.depth` 261. } 262. 263. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 264. { 265. int i, ret = 0; crypto/bn/bn_prime.c:306:18: Call 304. if (enhanced) { 305. /* (Step 4.3) */ 306. if (!BN_gcd(g, b, w, ctx)) ^ 307. goto err; 308. /* (Step 4.4) */ crypto/bn/bn_gcd.c:15:1: Parameter `ctx->stack.depth` 13. static BIGNUM *euclid(BIGNUM *a, BIGNUM *b); 14. 15. > int BN_gcd(BIGNUM *r, const BIGNUM *in_a, const BIGNUM *in_b, BN_CTX *ctx) 16. { 17. BIGNUM *a, *b, *t; crypto/bn/bn_gcd.c:23:5: Call 21. bn_check_top(in_b); 22. 23. BN_CTX_start(ctx); ^ 24. a = BN_CTX_get(ctx); 25. b = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gcd.c:24:9: Call 22. 23. BN_CTX_start(ctx); 24. a = BN_CTX_get(ctx); ^ 25. b = BN_CTX_get(ctx); 26. if (b == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:25:9: Call 23. BN_CTX_start(ctx); 24. a = BN_CTX_get(ctx); 25. b = BN_CTX_get(ctx); ^ 26. if (b == NULL) 27. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:49:5: Call 47. ret = 1; 48. err: 49. BN_CTX_end(ctx); ^ 50. bn_check_top(r); 51. return ret; crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <LHS trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_gcd` 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_41814
static int init_output_stream_streamcopy(OutputStream *ost) { OutputFile *of = output_files[ost->file_index]; InputStream *ist = get_input_stream(ost); AVCodecParameters *par_dst = ost->st->codecpar; AVCodecParameters *par_src = ist->st->codecpar; AVRational sar; int i; uint64_t extra_size; extra_size = (uint64_t)par_src->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE; if (extra_size > INT_MAX) { return AVERROR(EINVAL); } ost->st->disposition = ist->st->disposition; par_dst->codec_id = par_src->codec_id; par_dst->codec_type = par_src->codec_type; if (!par_dst->codec_tag) { if (!of->ctx->oformat->codec_tag || av_codec_get_id (of->ctx->oformat->codec_tag, par_src->codec_tag) == par_dst->codec_id || av_codec_get_tag(of->ctx->oformat->codec_tag, par_src->codec_id) <= 0) par_dst->codec_tag = par_src->codec_tag; } par_dst->bit_rate = par_src->bit_rate; par_dst->field_order = par_src->field_order; par_dst->chroma_location = par_src->chroma_location; if (par_src->extradata) { par_dst->extradata = av_mallocz(extra_size); if (!par_dst->extradata) { return AVERROR(ENOMEM); } memcpy(par_dst->extradata, par_src->extradata, par_src->extradata_size); par_dst->extradata_size = par_src->extradata_size; } ost->st->time_base = ist->st->time_base; if (ist->st->nb_side_data) { ost->st->side_data = av_realloc_array(NULL, ist->st->nb_side_data, sizeof(*ist->st->side_data)); if (!ost->st->side_data) return AVERROR(ENOMEM); for (i = 0; i < ist->st->nb_side_data; i++) { const AVPacketSideData *sd_src = &ist->st->side_data[i]; AVPacketSideData *sd_dst = &ost->st->side_data[i]; sd_dst->data = av_malloc(sd_src->size); if (!sd_dst->data) return AVERROR(ENOMEM); memcpy(sd_dst->data, sd_src->data, sd_src->size); sd_dst->size = sd_src->size; sd_dst->type = sd_src->type; ost->st->nb_side_data++; } } ost->parser = av_parser_init(par_dst->codec_id); ost->parser_avctx = avcodec_alloc_context3(NULL); if (!ost->parser_avctx) return AVERROR(ENOMEM); switch (par_dst->codec_type) { case AVMEDIA_TYPE_AUDIO: if (audio_volume != 256) { av_log(NULL, AV_LOG_FATAL, "-acodec copy and -vol are incompatible (frames are not decoded)\n"); exit_program(1); } par_dst->channel_layout = par_src->channel_layout; par_dst->sample_rate = par_src->sample_rate; par_dst->channels = par_src->channels; par_dst->block_align = par_src->block_align; break; case AVMEDIA_TYPE_VIDEO: par_dst->format = par_src->format; par_dst->width = par_src->width; par_dst->height = par_src->height; if (ost->frame_aspect_ratio) sar = av_d2q(ost->frame_aspect_ratio * par_dst->height / par_dst->width, 255); else if (ist->st->sample_aspect_ratio.num) sar = ist->st->sample_aspect_ratio; else sar = par_src->sample_aspect_ratio; ost->st->sample_aspect_ratio = par_dst->sample_aspect_ratio = sar; break; case AVMEDIA_TYPE_SUBTITLE: par_dst->width = par_src->width; par_dst->height = par_src->height; break; case AVMEDIA_TYPE_DATA: case AVMEDIA_TYPE_ATTACHMENT: break; default: abort(); } return 0; } avconv.c:1803: error: Null Dereference pointer `ist` last assigned on line 1801 could be null and is dereferenced at line 1803, column 34. avconv.c:1798:1: start of procedure init_output_stream_streamcopy() 1796. } 1797. 1798. static int init_output_stream_streamcopy(OutputStream *ost) ^ 1799. { 1800. OutputFile *of = output_files[ost->file_index]; avconv.c:1800:5: 1798. static int init_output_stream_streamcopy(OutputStream *ost) 1799. { 1800. OutputFile *of = output_files[ost->file_index]; ^ 1801. InputStream *ist = get_input_stream(ost); 1802. AVCodecParameters *par_dst = ost->st->codecpar; avconv.c:1801:5: 1799. { 1800. OutputFile *of = output_files[ost->file_index]; 1801. InputStream *ist = get_input_stream(ost); ^ 1802. AVCodecParameters *par_dst = ost->st->codecpar; 1803. AVCodecParameters *par_src = ist->st->codecpar; avconv.c:1689:1: start of procedure get_input_stream() 1687. } 1688. 1689. static InputStream *get_input_stream(OutputStream *ost) ^ 1690. { 1691. if (ost->source_index >= 0) avconv.c:1691:9: Taking false branch 1689. static InputStream *get_input_stream(OutputStream *ost) 1690. { 1691. if (ost->source_index >= 0) ^ 1692. return input_streams[ost->source_index]; 1693. avconv.c:1694:9: Taking true branch 1692. return input_streams[ost->source_index]; 1693. 1694. if (ost->filter) { ^ 1695. FilterGraph *fg = ost->filter->graph; 1696. int i; avconv.c:1695:9: 1693. 1694. if (ost->filter) { 1695. FilterGraph *fg = ost->filter->graph; ^ 1696. int i; 1697. avconv.c:1698:14: 1696. int i; 1697. 1698. for (i = 0; i < fg->nb_inputs; i++) ^ 1699. if (fg->inputs[i]->ist->dec_ctx->codec_type == ost->enc_ctx->codec_type) 1700. return fg->inputs[i]->ist; avconv.c:1698:21: Loop condition is true. Entering loop body 1696. int i; 1697. 1698. for (i = 0; i < fg->nb_inputs; i++) ^ 1699. if (fg->inputs[i]->ist->dec_ctx->codec_type == ost->enc_ctx->codec_type) 1700. return fg->inputs[i]->ist; avconv.c:1699:17: Taking false branch 1697. 1698. for (i = 0; i < fg->nb_inputs; i++) 1699. if (fg->inputs[i]->ist->dec_ctx->codec_type == ost->enc_ctx->codec_type) ^ 1700. return fg->inputs[i]->ist; 1701. } avconv.c:1698:40: 1696. int i; 1697. 1698. for (i = 0; i < fg->nb_inputs; i++) ^ 1699. if (fg->inputs[i]->ist->dec_ctx->codec_type == ost->enc_ctx->codec_type) 1700. return fg->inputs[i]->ist; avconv.c:1698:21: Loop condition is false. Leaving loop 1696. int i; 1697. 1698. for (i = 0; i < fg->nb_inputs; i++) ^ 1699. if (fg->inputs[i]->ist->dec_ctx->codec_type == ost->enc_ctx->codec_type) 1700. return fg->inputs[i]->ist; avconv.c:1703:5: 1701. } 1702. 1703. return NULL; ^ 1704. } 1705. avconv.c:1704:1: return from a call to get_input_stream 1702. 1703. return NULL; 1704. } ^ 1705. 1706. /* open the muxer when all the streams are initialized */ avconv.c:1802:5: 1800. OutputFile *of = output_files[ost->file_index]; 1801. InputStream *ist = get_input_stream(ost); 1802. AVCodecParameters *par_dst = ost->st->codecpar; ^ 1803. AVCodecParameters *par_src = ist->st->codecpar; 1804. AVRational sar; avconv.c:1803:5: 1801. InputStream *ist = get_input_stream(ost); 1802. AVCodecParameters *par_dst = ost->st->codecpar; 1803. AVCodecParameters *par_src = ist->st->codecpar; ^ 1804. AVRational sar; 1805. int i;
https://github.com/libav/libav/blob/bd31c61cf94d01dbe1051cf65874e7b2c0ac5454/avconv.c/#L1803
d2a_code_trace_data_41815
int tls13_enc(SSL *s, SSL3_RECORD *recs, size_t n_recs, int sending) { EVP_CIPHER_CTX *ctx; unsigned char iv[EVP_MAX_IV_LENGTH]; size_t ivlen, taglen, offset, loop; unsigned char *staticiv; unsigned char *seq; int lenu, lenf; SSL3_RECORD *rec = &recs[0]; uint32_t alg_enc; if (n_recs != 1) { return -1; } if (sending) { ctx = s->enc_write_ctx; staticiv = s->write_iv; seq = RECORD_LAYER_get_write_sequence(&s->rlayer); } else { ctx = s->enc_read_ctx; staticiv = s->read_iv; seq = RECORD_LAYER_get_read_sequence(&s->rlayer); } if (ctx == NULL) { memmove(rec->data, rec->input, rec->length); rec->input = rec->data; return 1; } ivlen = EVP_CIPHER_CTX_iv_length(ctx); if (s->early_data_state == SSL_EARLY_DATA_WRITING || s->early_data_state == SSL_EARLY_DATA_WRITE_RETRY) { alg_enc = s->session->cipher->algorithm_enc; } else { assert(s->s3->tmp.new_cipher != NULL); if (s->s3->tmp.new_cipher == NULL) return -1; alg_enc = s->s3->tmp.new_cipher->algorithm_enc; } if (alg_enc & SSL_AESCCM) { if (alg_enc & (SSL_AES128CCM8 | SSL_AES256CCM8)) taglen = EVP_CCM8_TLS_TAG_LEN; else taglen = EVP_CCM_TLS_TAG_LEN; if (sending && EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, taglen, NULL) <= 0) return -1; } else if (alg_enc & SSL_AESGCM) { taglen = EVP_GCM_TLS_TAG_LEN; } else if (alg_enc & SSL_CHACHA20) { taglen = EVP_CHACHAPOLY_TLS_TAG_LEN; } else { return -1; } if (!sending) { if (rec->length < taglen + 1) return 0; rec->length -= taglen; } if (ivlen < SEQ_NUM_SIZE) { return -1; } offset = ivlen - SEQ_NUM_SIZE; memcpy(iv, staticiv, offset); for (loop = 0; loop < SEQ_NUM_SIZE; loop++) iv[offset + loop] = staticiv[offset + loop] ^ seq[loop]; for (loop = SEQ_NUM_SIZE; loop > 0; loop--) { ++seq[loop - 1]; if (seq[loop - 1] != 0) break; } if (loop == 0) { return -1; } if (EVP_CipherInit_ex(ctx, NULL, NULL, NULL, iv, sending) <= 0 || (!sending && EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_SET_TAG, taglen, rec->data + rec->length) <= 0) || EVP_CipherUpdate(ctx, rec->data, &lenu, rec->input, (unsigned int)rec->length) <= 0 || EVP_CipherFinal_ex(ctx, rec->data + lenu, &lenf) <= 0 || (size_t)(lenu + lenf) != rec->length) { return -1; } if (sending) { if (EVP_CIPHER_CTX_ctrl(ctx, EVP_CTRL_AEAD_GET_TAG, taglen, rec->data + rec->length) <= 0) return -1; rec->length += taglen; } return 1; } test/tls13encryptiontest.c:360: error: INTEGER_OVERFLOW_L2 ([9, +oo] - [8, 16]):unsigned64 by call to `tls13_enc`. Showing all 8 steps of the trace test/tls13encryptiontest.c:340:14: Call 338. /* Load the record */ 339. ivlen = EVP_CIPHER_iv_length(ciph); 340. if (!load_record(&rec, &refdata[ctr], &key, s->read_iv, ivlen, ^ 341. RECORD_LAYER_get_read_sequence(&s->rlayer))) { 342. TEST_error("Failed loading key into EVP_CIPHER_CTX"); test/tls13encryptiontest.c:234:1: Parameter `rec->length` 232. } 233. 234. > static int load_record(SSL3_RECORD *rec, RECORD_DATA *recd, unsigned char **key, 235. unsigned char *iv, size_t ivlen, unsigned char *seq) 236. { test/tls13encryptiontest.c:360:14: Call 358. 359. /* Encrypt it */ 360. if (!TEST_size_t_eq(tls13_enc(s, &rec, 1, 1), 1)) { ^ 361. TEST_info("Failed to encrypt record %"OSSLzu"", ctr); 362. goto err; ssl/record/ssl3_record_tls13.c:24:1: <LHS trace> 22. * an internal error occurred. 23. */ 24. > int tls13_enc(SSL *s, SSL3_RECORD *recs, size_t n_recs, int sending) 25. { 26. EVP_CIPHER_CTX *ctx; ssl/record/ssl3_record_tls13.c:24:1: Parameter `recs->length` 22. * an internal error occurred. 23. */ 24. > int tls13_enc(SSL *s, SSL3_RECORD *recs, size_t n_recs, int sending) 25. { 26. EVP_CIPHER_CTX *ctx; ssl/record/ssl3_record_tls13.c:24:1: <RHS trace> 22. * an internal error occurred. 23. */ 24. > int tls13_enc(SSL *s, SSL3_RECORD *recs, size_t n_recs, int sending) 25. { 26. EVP_CIPHER_CTX *ctx; ssl/record/ssl3_record_tls13.c:24:1: Parameter `recs->length` 22. * an internal error occurred. 23. */ 24. > int tls13_enc(SSL *s, SSL3_RECORD *recs, size_t n_recs, int sending) 25. { 26. EVP_CIPHER_CTX *ctx; ssl/record/ssl3_record_tls13.c:96:9: Binary operation: ([9, +oo] - [8, 16]):unsigned64 by call to `tls13_enc` 94. if (rec->length < taglen + 1) 95. return 0; 96. rec->length -= taglen; ^ 97. } 98.
https://github.com/openssl/openssl/blob/424aa352458486d67e1e9cd3d3990dc06a60ba4a/ssl/record/ssl3_record_tls13.c/#L96
d2a_code_trace_data_41816
STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line) { char *p, *q, c; char *ntmp, *vtmp; STACK_OF(CONF_VALUE) *values = NULL; char *linebuf; int state; linebuf = OPENSSL_strdup(line); if (linebuf == NULL) { X509V3err(X509V3_F_X509V3_PARSE_LIST, ERR_R_MALLOC_FAILURE); goto err; } state = HDR_NAME; ntmp = NULL; for (p = linebuf, q = linebuf; (c = *p) && (c != '\r') && (c != '\n'); p++) { switch (state) { case HDR_NAME: if (c == ':') { state = HDR_VALUE; *p = 0; ntmp = strip_spaces(q); if (!ntmp) { X509V3err(X509V3_F_X509V3_PARSE_LIST, X509V3_R_INVALID_NULL_NAME); goto err; } q = p + 1; } else if (c == ',') { *p = 0; ntmp = strip_spaces(q); q = p + 1; if (!ntmp) { X509V3err(X509V3_F_X509V3_PARSE_LIST, X509V3_R_INVALID_NULL_NAME); goto err; } X509V3_add_value(ntmp, NULL, &values); } break; case HDR_VALUE: if (c == ',') { state = HDR_NAME; *p = 0; vtmp = strip_spaces(q); if (!vtmp) { X509V3err(X509V3_F_X509V3_PARSE_LIST, X509V3_R_INVALID_NULL_VALUE); goto err; } X509V3_add_value(ntmp, vtmp, &values); ntmp = NULL; q = p + 1; } } } if (state == HDR_VALUE) { vtmp = strip_spaces(q); if (!vtmp) { X509V3err(X509V3_F_X509V3_PARSE_LIST, X509V3_R_INVALID_NULL_VALUE); goto err; } X509V3_add_value(ntmp, vtmp, &values); } else { ntmp = strip_spaces(q); if (!ntmp) { X509V3err(X509V3_F_X509V3_PARSE_LIST, X509V3_R_INVALID_NULL_NAME); goto err; } X509V3_add_value(ntmp, NULL, &values); } OPENSSL_free(linebuf); return values; err: OPENSSL_free(linebuf); sk_CONF_VALUE_pop_free(values, X509V3_conf_free); return NULL; } crypto/x509v3/v3_utl.c:367: error: NULL_DEREFERENCE pointer `&values` last assigned on line 295 could be null and is dereferenced by call to `X509V3_add_value()` at line 367, column 9. Showing all 54 steps of the trace crypto/x509v3/v3_utl.c:291:1: start of procedure X509V3_parse_list() 289. */ 290. 291. > STACK_OF(CONF_VALUE) *X509V3_parse_list(const char *line) 292. { 293. char *p, *q, c; crypto/x509v3/v3_utl.c:295:5: 293. char *p, *q, c; 294. char *ntmp, *vtmp; 295. > STACK_OF(CONF_VALUE) *values = NULL; 296. char *linebuf; 297. int state; crypto/x509v3/v3_utl.c:299:5: 297. int state; 298. /* We are going to modify the line so copy it first */ 299. > linebuf = OPENSSL_strdup(line); 300. if (linebuf == NULL) { 301. X509V3err(X509V3_F_X509V3_PARSE_LIST, ERR_R_MALLOC_FAILURE); crypto/o_str.c:121:1: start of procedure CRYPTO_strdup() 119. } 120. 121. > char *CRYPTO_strdup(const char *str, const char* file, int line) 122. { 123. char *ret; crypto/o_str.c:125:9: Taking false branch 123. char *ret; 124. 125. if (str == NULL) ^ 126. return NULL; 127. ret = CRYPTO_malloc(strlen(str) + 1, file, line); crypto/o_str.c:127:5: 125. if (str == NULL) 126. return NULL; 127. > ret = CRYPTO_malloc(strlen(str) + 1, file, line); 128. if (ret != NULL) 129. strcpy(ret, str); crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/o_str.c:128:9: Taking true branch 126. return NULL; 127. ret = CRYPTO_malloc(strlen(str) + 1, file, line); 128. if (ret != NULL) ^ 129. strcpy(ret, str); 130. return ret; crypto/o_str.c:129:9: 127. ret = CRYPTO_malloc(strlen(str) + 1, file, line); 128. if (ret != NULL) 129. > strcpy(ret, str); 130. return ret; 131. } crypto/o_str.c:130:5: 128. if (ret != NULL) 129. strcpy(ret, str); 130. > return ret; 131. } 132. crypto/o_str.c:131:1: return from a call to CRYPTO_strdup 129. strcpy(ret, str); 130. return ret; 131. > } 132. 133. char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line) crypto/x509v3/v3_utl.c:300:9: Taking false branch 298. /* We are going to modify the line so copy it first */ 299. linebuf = OPENSSL_strdup(line); 300. if (linebuf == NULL) { ^ 301. X509V3err(X509V3_F_X509V3_PARSE_LIST, ERR_R_MALLOC_FAILURE); 302. goto err; crypto/x509v3/v3_utl.c:304:5: 302. goto err; 303. } 304. > state = HDR_NAME; 305. ntmp = NULL; 306. /* Go through all characters */ crypto/x509v3/v3_utl.c:305:5: 303. } 304. state = HDR_NAME; 305. > ntmp = NULL; 306. /* Go through all characters */ 307. for (p = linebuf, q = linebuf; (c = *p) && (c != '\r') && (c != '\n'); crypto/x509v3/v3_utl.c:307:10: 305. ntmp = NULL; 306. /* Go through all characters */ 307. > for (p = linebuf, q = linebuf; (c = *p) && (c != '\r') && (c != '\n'); 308. p++) { 309. crypto/x509v3/v3_utl.c:307:37: 305. ntmp = NULL; 306. /* Go through all characters */ 307. > for (p = linebuf, q = linebuf; (c = *p) && (c != '\r') && (c != '\n'); 308. p++) { 309. crypto/x509v3/v3_utl.c:307:36: Loop condition is true. Entering loop body 305. ntmp = NULL; 306. /* Go through all characters */ 307. for (p = linebuf, q = linebuf; (c = *p) && (c != '\r') && (c != '\n'); ^ 308. p++) { 309. crypto/x509v3/v3_utl.c:307:49: Loop condition is false. Leaving loop 305. ntmp = NULL; 306. /* Go through all characters */ 307. for (p = linebuf, q = linebuf; (c = *p) && (c != '\r') && (c != '\n'); ^ 308. p++) { 309. crypto/x509v3/v3_utl.c:353:9: Taking false branch 351. } 352. 353. if (state == HDR_VALUE) { ^ 354. vtmp = strip_spaces(q); 355. if (!vtmp) { crypto/x509v3/v3_utl.c:362:9: Skipping strip_spaces(): empty list of specs 360. X509V3_add_value(ntmp, vtmp, &values); 361. } else { 362. ntmp = strip_spaces(q); ^ 363. if (!ntmp) { 364. X509V3err(X509V3_F_X509V3_PARSE_LIST, X509V3_R_INVALID_NULL_NAME); crypto/x509v3/v3_utl.c:363:14: Taking false branch 361. } else { 362. ntmp = strip_spaces(q); 363. if (!ntmp) { ^ 364. X509V3err(X509V3_F_X509V3_PARSE_LIST, X509V3_R_INVALID_NULL_NAME); 365. goto err; crypto/x509v3/v3_utl.c:367:9: 365. goto err; 366. } 367. > X509V3_add_value(ntmp, NULL, &values); 368. } 369. OPENSSL_free(linebuf); crypto/x509v3/v3_utl.c:83:1: start of procedure X509V3_add_value() 81. /* Add a CONF_VALUE name value pair to stack */ 82. 83. > int X509V3_add_value(const char *name, const char *value, 84. STACK_OF(CONF_VALUE) **extlist) 85. { crypto/x509v3/v3_utl.c:86:5: 84. STACK_OF(CONF_VALUE) **extlist) 85. { 86. > CONF_VALUE *vtmp = NULL; 87. char *tname = NULL, *tvalue = NULL; 88. crypto/x509v3/v3_utl.c:87:5: 85. { 86. CONF_VALUE *vtmp = NULL; 87. > char *tname = NULL, *tvalue = NULL; 88. 89. if (name && (tname = OPENSSL_strdup(name)) == NULL) crypto/x509v3/v3_utl.c:89:9: Taking false branch 87. char *tname = NULL, *tvalue = NULL; 88. 89. if (name && (tname = OPENSSL_strdup(name)) == NULL) ^ 90. goto err; 91. if (value && (tvalue = OPENSSL_strdup(value)) == NULL) crypto/x509v3/v3_utl.c:91:9: Taking false branch 89. if (name && (tname = OPENSSL_strdup(name)) == NULL) 90. goto err; 91. if (value && (tvalue = OPENSSL_strdup(value)) == NULL) ^ 92. goto err; 93. if ((vtmp = OPENSSL_malloc(sizeof(*vtmp))) == NULL) crypto/x509v3/v3_utl.c:93:9: 91. if (value && (tvalue = OPENSSL_strdup(value)) == NULL) 92. goto err; 93. > if ((vtmp = OPENSSL_malloc(sizeof(*vtmp))) == NULL) 94. goto err; 95. if (*extlist == NULL && (*extlist = sk_CONF_VALUE_new_null()) == 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/x509v3/v3_utl.c:93:9: Taking false branch 91. if (value && (tvalue = OPENSSL_strdup(value)) == NULL) 92. goto err; 93. if ((vtmp = OPENSSL_malloc(sizeof(*vtmp))) == NULL) ^ 94. goto err; 95. if (*extlist == NULL && (*extlist = sk_CONF_VALUE_new_null()) == NULL) crypto/x509v3/v3_utl.c:95:9: Taking false branch 93. if ((vtmp = OPENSSL_malloc(sizeof(*vtmp))) == NULL) 94. goto err; 95. if (*extlist == NULL && (*extlist = sk_CONF_VALUE_new_null()) == NULL) ^ 96. goto err; 97. vtmp->section = NULL; crypto/x509v3/v3_utl.c:97:5: 95. if (*extlist == NULL && (*extlist = sk_CONF_VALUE_new_null()) == NULL) 96. goto err; 97. > vtmp->section = NULL; 98. vtmp->name = tname; 99. vtmp->value = tvalue; crypto/x509v3/v3_utl.c:98:5: 96. goto err; 97. vtmp->section = NULL; 98. > vtmp->name = tname; 99. vtmp->value = tvalue; 100. if (!sk_CONF_VALUE_push(*extlist, vtmp)) crypto/x509v3/v3_utl.c:99:5: 97. vtmp->section = NULL; 98. vtmp->name = tname; 99. > vtmp->value = tvalue; 100. if (!sk_CONF_VALUE_push(*extlist, vtmp)) 101. goto err; crypto/x509v3/v3_utl.c:100:10: 98. vtmp->name = tname; 99. vtmp->value = tvalue; 100. > if (!sk_CONF_VALUE_push(*extlist, vtmp)) 101. goto err; 102. return 1; include/openssl/conf.h:80:1: start of procedure sk_CONF_VALUE_push() 78. } CONF_VALUE; 79. 80. > DEFINE_STACK_OF(CONF_VALUE) 81. DECLARE_LHASH_OF(CONF_VALUE); 82. crypto/stack/stack.c:259:1: start of procedure sk_push() 257. } 258. 259. > int sk_push(_STACK *st, void *data) 260. { 261. return (sk_insert(st, data, st->num)); crypto/stack/stack.c:261:5: 259. int sk_push(_STACK *st, void *data) 260. { 261. > return (sk_insert(st, data, st->num)); 262. } 263.
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/x509v3/v3_utl.c/#L367
d2a_code_trace_data_41817
static int encode_test_init(EVP_TEST *t, const char *encoding) { ENCODE_DATA *edata = OPENSSL_zalloc(sizeof(*edata)); if (strcmp(encoding, "canonical") == 0) { edata->encoding = BASE64_CANONICAL_ENCODING; } else if (strcmp(encoding, "valid") == 0) { edata->encoding = BASE64_VALID_ENCODING; } else if (strcmp(encoding, "invalid") == 0) { edata->encoding = BASE64_INVALID_ENCODING; t->expected_err = OPENSSL_strdup("DECODE_ERROR"); if (t->expected_err == NULL) return 0; } else { TEST_info("Bad encoding: %s. Should be one of " "{canonical, valid, invalid}", encoding); return 0; } t->data = edata; return 1; } test/evp_test.c:1767: error: NULL_DEREFERENCE pointer `edata` last assigned on line 1760 could be null and is dereferenced at line 1767, column 9. Showing all 17 steps of the trace test/evp_test.c:1758:1: start of procedure encode_test_init() 1756. } ENCODE_DATA; 1757. 1758. > static int encode_test_init(EVP_TEST *t, const char *encoding) 1759. { 1760. ENCODE_DATA *edata = OPENSSL_zalloc(sizeof(*edata)); test/evp_test.c:1760:5: 1758. static int encode_test_init(EVP_TEST *t, const char *encoding) 1759. { 1760. > ENCODE_DATA *edata = OPENSSL_zalloc(sizeof(*edata)); 1761. 1762. if (strcmp(encoding, "canonical") == 0) { crypto/mem.c:186:1: start of procedure CRYPTO_zalloc() 184. } 185. 186. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:188:5: 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. > void *ret = CRYPTO_malloc(num, file, line); 189. 190. FAILTEST(); crypto/mem.c:158:1: start of procedure CRYPTO_malloc() 156. #endif 157. 158. > void *CRYPTO_malloc(size_t num, const char *file, int line) 159. { 160. void *ret = NULL; crypto/mem.c:160:5: 158. void *CRYPTO_malloc(size_t num, const char *file, int line) 159. { 160. > void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:162:9: Taking true branch 160. void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 163. return malloc_impl(num, file, line); 164. crypto/mem.c:162:32: Taking true branch 160. void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 163. return malloc_impl(num, file, line); 164. crypto/mem.c:163:9: Skipping __function_pointer__(): unresolved function pointer 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) 163. return malloc_impl(num, file, line); ^ 164. 165. if (num == 0) crypto/mem.c:184:1: return from a call to CRYPTO_malloc 182. 183. return ret; 184. > } 185. 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:191:9: Taking false branch 189. 190. FAILTEST(); 191. if (ret != NULL) ^ 192. memset(ret, 0, num); 193. return ret; crypto/mem.c:193:5: 191. if (ret != NULL) 192. memset(ret, 0, num); 193. > return ret; 194. } 195. crypto/mem.c:194:1: return from a call to CRYPTO_zalloc 192. memset(ret, 0, num); 193. return ret; 194. > } 195. 196. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) test/evp_test.c:1762:9: Taking false branch 1760. ENCODE_DATA *edata = OPENSSL_zalloc(sizeof(*edata)); 1761. 1762. if (strcmp(encoding, "canonical") == 0) { ^ 1763. edata->encoding = BASE64_CANONICAL_ENCODING; 1764. } else if (strcmp(encoding, "valid") == 0) { test/evp_test.c:1764:16: Taking false branch 1762. if (strcmp(encoding, "canonical") == 0) { 1763. edata->encoding = BASE64_CANONICAL_ENCODING; 1764. } else if (strcmp(encoding, "valid") == 0) { ^ 1765. edata->encoding = BASE64_VALID_ENCODING; 1766. } else if (strcmp(encoding, "invalid") == 0) { test/evp_test.c:1766:16: Taking true branch 1764. } else if (strcmp(encoding, "valid") == 0) { 1765. edata->encoding = BASE64_VALID_ENCODING; 1766. } else if (strcmp(encoding, "invalid") == 0) { ^ 1767. edata->encoding = BASE64_INVALID_ENCODING; 1768. t->expected_err = OPENSSL_strdup("DECODE_ERROR"); test/evp_test.c:1767:9: 1765. edata->encoding = BASE64_VALID_ENCODING; 1766. } else if (strcmp(encoding, "invalid") == 0) { 1767. > edata->encoding = BASE64_INVALID_ENCODING; 1768. t->expected_err = OPENSSL_strdup("DECODE_ERROR"); 1769. if (t->expected_err == NULL)
https://github.com/openssl/openssl/blob/69b4c01fd26e6eb72b156ed3014522c3295a7669/test/evp_test.c/#L1767
d2a_code_trace_data_41818
int dct_quantize_trellis_c(MpegEncContext *s, DCTELEM *block, int n, int qscale, int *overflow){ const int *qmat; const uint8_t *scantable= s->intra_scantable.scantable; const uint8_t *perm_scantable= s->intra_scantable.permutated; int max=0; unsigned int threshold1, threshold2; int bias=0; int run_tab[65]; int level_tab[65]; int score_tab[65]; int survivor[65]; int survivor_count; int last_run=0; int last_level=0; int last_score= 0; int last_i; int coeff[2][64]; int coeff_count[64]; int qmul, qadd, start_i, last_non_zero, i, dc; const int esc_length= s->ac_esc_length; uint8_t * length; uint8_t * last_length; const int lambda= s->lambda2 >> (FF_LAMBDA_SHIFT - 6); s->dsp.fdct (block); if(s->dct_error_sum) s->denoise_dct(s, block); qmul= qscale*16; qadd= ((qscale-1)|1)*8; if (s->mb_intra) { int q; if (!s->h263_aic) { if (n < 4) q = s->y_dc_scale; else q = s->c_dc_scale; q = q << 3; } else{ q = 1 << 3; qadd=0; } block[0] = (block[0] + (q >> 1)) / q; start_i = 1; last_non_zero = 0; qmat = s->q_intra_matrix[qscale]; if(s->mpeg_quant || s->out_format == FMT_MPEG1) bias= 1<<(QMAT_SHIFT-1); length = s->intra_ac_vlc_length; last_length= s->intra_ac_vlc_last_length; } else { start_i = 0; last_non_zero = -1; qmat = s->q_inter_matrix[qscale]; length = s->inter_ac_vlc_length; last_length= s->inter_ac_vlc_last_length; } last_i= start_i; threshold1= (1<<QMAT_SHIFT) - bias - 1; threshold2= (threshold1<<1); for(i=63; i>=start_i; i--) { const int j = scantable[i]; int level = block[j] * qmat[j]; if(((unsigned)(level+threshold1))>threshold2){ last_non_zero = i; break; } } for(i=start_i; i<=last_non_zero; i++) { const int j = scantable[i]; int level = block[j] * qmat[j]; if(((unsigned)(level+threshold1))>threshold2){ if(level>0){ level= (bias + level)>>QMAT_SHIFT; coeff[0][i]= level; coeff[1][i]= level-1; }else{ level= (bias - level)>>QMAT_SHIFT; coeff[0][i]= -level; coeff[1][i]= -level+1; } coeff_count[i]= FFMIN(level, 2); assert(coeff_count[i]); max |=level; }else{ coeff[0][i]= (level>>31)|1; coeff_count[i]= 1; } } *overflow= s->max_qcoeff < max; if(last_non_zero < start_i){ memset(block + start_i, 0, (64-start_i)*sizeof(DCTELEM)); return last_non_zero; } score_tab[start_i]= 0; survivor[0]= start_i; survivor_count= 1; for(i=start_i; i<=last_non_zero; i++){ int level_index, j, zero_distoration; int dct_coeff= FFABS(block[ scantable[i] ]); int best_score=256*256*256*120; if ( s->dsp.fdct == fdct_ifast #ifndef FAAN_POSTSCALE || s->dsp.fdct == ff_faandct #endif ) dct_coeff= (dct_coeff*inv_aanscales[ scantable[i] ]) >> 12; zero_distoration= dct_coeff*dct_coeff; for(level_index=0; level_index < coeff_count[i]; level_index++){ int distoration; int level= coeff[level_index][i]; const int alevel= FFABS(level); int unquant_coeff; assert(level); if(s->out_format == FMT_H263){ unquant_coeff= alevel*qmul + qadd; }else{ j= s->dsp.idct_permutation[ scantable[i] ]; if(s->mb_intra){ unquant_coeff = (int)( alevel * qscale * s->intra_matrix[j]) >> 3; unquant_coeff = (unquant_coeff - 1) | 1; }else{ unquant_coeff = ((( alevel << 1) + 1) * qscale * ((int) s->inter_matrix[j])) >> 4; unquant_coeff = (unquant_coeff - 1) | 1; } unquant_coeff<<= 3; } distoration= (unquant_coeff - dct_coeff) * (unquant_coeff - dct_coeff) - zero_distoration; level+=64; if((level&(~127)) == 0){ for(j=survivor_count-1; j>=0; j--){ int run= i - survivor[j]; int score= distoration + length[UNI_AC_ENC_INDEX(run, level)]*lambda; score += score_tab[i-run]; if(score < best_score){ best_score= score; run_tab[i+1]= run; level_tab[i+1]= level-64; } } if(s->out_format == FMT_H263){ for(j=survivor_count-1; j>=0; j--){ int run= i - survivor[j]; int score= distoration + last_length[UNI_AC_ENC_INDEX(run, level)]*lambda; score += score_tab[i-run]; if(score < last_score){ last_score= score; last_run= run; last_level= level-64; last_i= i+1; } } } }else{ distoration += esc_length*lambda; for(j=survivor_count-1; j>=0; j--){ int run= i - survivor[j]; int score= distoration + score_tab[i-run]; if(score < best_score){ best_score= score; run_tab[i+1]= run; level_tab[i+1]= level-64; } } if(s->out_format == FMT_H263){ for(j=survivor_count-1; j>=0; j--){ int run= i - survivor[j]; int score= distoration + score_tab[i-run]; if(score < last_score){ last_score= score; last_run= run; last_level= level-64; last_i= i+1; } } } } } score_tab[i+1]= best_score; if(last_non_zero <= 27){ for(; survivor_count; survivor_count--){ if(score_tab[ survivor[survivor_count-1] ] <= best_score) break; } }else{ for(; survivor_count; survivor_count--){ if(score_tab[ survivor[survivor_count-1] ] <= best_score + lambda) break; } } survivor[ survivor_count++ ]= i+1; } if(s->out_format != FMT_H263){ last_score= 256*256*256*120; for(i= survivor[0]; i<=last_non_zero + 1; i++){ int score= score_tab[i]; if(i) score += lambda*2; if(score < last_score){ last_score= score; last_i= i; last_level= level_tab[i]; last_run= run_tab[i]; } } } s->coded_score[n] = last_score; dc= FFABS(block[0]); last_non_zero= last_i - 1; memset(block + start_i, 0, (64-start_i)*sizeof(DCTELEM)); if(last_non_zero < start_i) return last_non_zero; if(last_non_zero == 0 && start_i == 0){ int best_level= 0; int best_score= dc * dc; for(i=0; i<coeff_count[0]; i++){ int level= coeff[i][0]; int alevel= FFABS(level); int unquant_coeff, score, distortion; if(s->out_format == FMT_H263){ unquant_coeff= (alevel*qmul + qadd)>>3; }else{ unquant_coeff = ((( alevel << 1) + 1) * qscale * ((int) s->inter_matrix[0])) >> 4; unquant_coeff = (unquant_coeff - 1) | 1; } unquant_coeff = (unquant_coeff + 4) >> 3; unquant_coeff<<= 3 + 3; distortion= (unquant_coeff - dc) * (unquant_coeff - dc); level+=64; if((level&(~127)) == 0) score= distortion + last_length[UNI_AC_ENC_INDEX(0, level)]*lambda; else score= distortion + esc_length*lambda; if(score < best_score){ best_score= score; best_level= level - 64; } } block[0]= best_level; s->coded_score[n] = best_score - dc*dc; if(best_level == 0) return -1; else return last_non_zero; } i= last_i; assert(last_level); block[ perm_scantable[last_non_zero] ]= last_level; i -= last_run + 1; for(; i>start_i; i -= run_tab[i] + 1){ block[ perm_scantable[i-1] ]= level_tab[i]; } return last_non_zero; } libavcodec/mpegvideo_enc.c:3093: error: Uninitialized Value The value read from coeff_count[_] was never initialized. libavcodec/mpegvideo_enc.c:3093:28: 3091. zero_distoration= dct_coeff*dct_coeff; 3092. 3093. for(level_index=0; level_index < coeff_count[i]; level_index++){ ^ 3094. int distoration; 3095. int level= coeff[level_index][i];
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo_enc.c/#L3093
d2a_code_trace_data_41819
int test_gf2m_mod(BIO *bp) { BIGNUM *a, *b[2], *c, *d, *e; int i, j, 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, 1024, 0, 0); for (j = 0; j < 2; j++) { BN_GF2m_mod(c, a, b[j]); BN_GF2m_add(d, a, c); BN_GF2m_mod(e, d, b[j]); if (!BN_is_zero(e)) { fprintf(stderr, "GF(2^m) modulo test failed!\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:1301: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 1276, column 9 is not reachable after line 1301, column 5. Showing all 155 steps of the trace test/bntest.c:1269:1: start of procedure test_gf2m_mod() 1267. } 1268. 1269. > int test_gf2m_mod(BIO *bp) 1270. { 1271. BIGNUM *a, *b[2], *c, *d, *e; test/bntest.c:1272:5: 1270. { 1271. BIGNUM *a, *b[2], *c, *d, *e; 1272. > int i, j, ret = 0; 1273. int p0[] = { 163, 7, 6, 3, 0, -1 }; 1274. int p1[] = { 193, 15, 0, -1 }; test/bntest.c:1273:5: 1271. BIGNUM *a, *b[2], *c, *d, *e; 1272. int i, j, ret = 0; 1273. > int p0[] = { 163, 7, 6, 3, 0, -1 }; 1274. int p1[] = { 193, 15, 0, -1 }; 1275. test/bntest.c:1274:5: 1272. int i, j, ret = 0; 1273. int p0[] = { 163, 7, 6, 3, 0, -1 }; 1274. > int p1[] = { 193, 15, 0, -1 }; 1275. 1276. a = BN_new(); test/bntest.c:1276:5: 1274. int p1[] = { 193, 15, 0, -1 }; 1275. 1276. > a = BN_new(); 1277. b[0] = BN_new(); 1278. 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:1277:5: 1275. 1276. a = BN_new(); 1277. > b[0] = BN_new(); 1278. b[1] = BN_new(); 1279. 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:1278:5: 1276. a = BN_new(); 1277. b[0] = BN_new(); 1278. > b[1] = BN_new(); 1279. c = BN_new(); 1280. 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:1279:5: 1277. b[0] = BN_new(); 1278. b[1] = BN_new(); 1279. > c = BN_new(); 1280. d = BN_new(); 1281. 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:1280:5: 1278. b[1] = BN_new(); 1279. c = BN_new(); 1280. > d = BN_new(); 1281. e = BN_new(); 1282. 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:1281:5: 1279. c = BN_new(); 1280. d = BN_new(); 1281. > e = BN_new(); 1282. 1283. 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:1283:5: Skipping BN_GF2m_arr2poly(): empty list of specs 1281. e = BN_new(); 1282. 1283. BN_GF2m_arr2poly(p0, b[0]); ^ 1284. BN_GF2m_arr2poly(p1, b[1]); 1285. test/bntest.c:1284:5: Skipping BN_GF2m_arr2poly(): empty list of specs 1282. 1283. BN_GF2m_arr2poly(p0, b[0]); 1284. BN_GF2m_arr2poly(p1, b[1]); ^ 1285. 1286. for (i = 0; i < num0; i++) { test/bntest.c:1286:10: 1284. BN_GF2m_arr2poly(p1, b[1]); 1285. 1286. > for (i = 0; i < num0; i++) { 1287. BN_bntest_rand(a, 1024, 0, 0); 1288. for (j = 0; j < 2; j++) { test/bntest.c:1286:17: Loop condition is false. Leaving loop 1284. BN_GF2m_arr2poly(p1, b[1]); 1285. 1286. for (i = 0; i < num0; i++) { ^ 1287. BN_bntest_rand(a, 1024, 0, 0); 1288. for (j = 0; j < 2; j++) { test/bntest.c:1299:5: 1297. } 1298. } 1299. > ret = 1; 1300. err: 1301. BN_free(a); test/bntest.c:1300:2: 1298. } 1299. ret = 1; 1300. > err: 1301. BN_free(a); 1302. BN_free(b[0]); test/bntest.c:1301:5: 1299. ret = 1; 1300. err: 1301. > BN_free(a); 1302. BN_free(b[0]); 1303. 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/#L1301
d2a_code_trace_data_41820
int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info) { const char *p; char tag[128], *q; p = info; if (*p == '?') p++; for(;;) { q = tag; while (*p != '\0' && *p != '=' && *p != '&') { if ((q - tag) < sizeof(tag) - 1) *q++ = *p; p++; } *q = '\0'; q = arg; if (*p == '=') { p++; while (*p != '&' && *p != '\0') { if ((q - arg) < arg_size - 1) { if (*p == '+') *q++ = ' '; else *q++ = *p; } p++; } *q = '\0'; } if (!strcmp(tag, tag1)) return 1; if (*p != '&') break; p++; } return 0; } ffserver.c:2076: error: Buffer Overrun L1 Offset: [1, +oo] Size: 1 by call to `open_input_stream`. ffserver.c:2076:33: Call 2074. av_close_input_file(c->fmt_in); 2075. c->fmt_in = NULL; 2076. if (open_input_stream(c, "") < 0) ^ 2077. goto no_loop; 2078. goto redo; ffserver.c:1882:1: Parameter `*info` 1880. } 1881. 1882. static int open_input_stream(HTTPContext *c, const char *info) ^ 1883. { 1884. char buf[128]; ffserver.c:1901:18: Call 1899. return -1; 1900. } 1901. else if (find_info_tag(buf, sizeof(buf), "buffer", info)) { ^ 1902. int prebuffer = strtol(buf, 0, 10); 1903. stream_pos = av_gettime() - prebuffer * (int64_t)1000000; libavformat/utils.c:2810:1: <Length trace> 2808. } 2809. 2810. int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info) ^ 2811. { 2812. const char *p; libavformat/utils.c:2810:1: Parameter `*info` 2808. } 2809. 2810. int find_info_tag(char *arg, int arg_size, const char *tag1, const char *info) ^ 2811. { 2812. const char *p; libavformat/utils.c:2815:5: Assignment 2813. char tag[128], *q; 2814. 2815. p = info; ^ 2816. if (*p == '?') 2817. p++; libavformat/utils.c:2828:13: Assignment 2826. q = arg; 2827. if (*p == '=') { 2828. p++; ^ 2829. while (*p != '&' && *p != '\0') { 2830. if ((q - arg) < arg_size - 1) { libavformat/utils.c:2829:20: Array access: Offset: [1, +oo] Size: 1 by call to `open_input_stream` 2827. if (*p == '=') { 2828. p++; 2829. while (*p != '&' && *p != '\0') { ^ 2830. if ((q - arg) < arg_size - 1) { 2831. if (*p == '+')
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/utils.c/#L2829
d2a_code_trace_data_41821
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:264: error: Integer Overflow L2 ([1, +oo] - 3):unsigned32 by call to `bitstream_read`. libavcodec/takdec.c:264:38: Call 262. int scale = get_unary(bc, 1, 9); 263. if (scale == 9) { 264. int scale_bits = bitstream_read(bc, 3); ^ 265. if (scale_bits > 0) { 266. if (scale_bits == 7) { libavcodec/bitstream.h:183:1: Parameter `n` 181. 182. /* Return n bits from the buffer. n has to be in the 0-32 range. */ 183. static inline uint32_t bitstream_read(BitstreamContext *bc, unsigned n) ^ 184. { 185. if (!n) libavcodec/bitstream.h:194:12: Call 192. } 193. 194. return get_val(bc, n); ^ 195. } 196. libavcodec/bitstream.h:130:1: <LHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `bc->bits_left` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: <RHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Binary operation: ([1, +oo] - 3):unsigned32 by call to `bitstream_read` 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret;
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L139
d2a_code_trace_data_41822
int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) { BIGNUM *b, *c, *u, *v, *tmp; int ret = 0; bn_check_top(a); bn_check_top(p); BN_CTX_start(ctx); if ((b = BN_CTX_get(ctx))==NULL) goto err; if ((c = BN_CTX_get(ctx))==NULL) goto err; if ((u = BN_CTX_get(ctx))==NULL) goto err; if ((v = BN_CTX_get(ctx))==NULL) goto err; if (!BN_GF2m_mod(u, a, p)) goto err; if (BN_is_zero(u)) goto err; if (!BN_copy(v, p)) goto err; #if 0 if (!BN_one(b)) goto err; while (1) { while (!BN_is_odd(u)) { if (!BN_rshift1(u, u)) goto err; if (BN_is_odd(b)) { if (!BN_GF2m_add(b, b, p)) goto err; } if (!BN_rshift1(b, b)) goto err; } if (BN_abs_is_word(u, 1)) break; if (BN_num_bits(u) < BN_num_bits(v)) { tmp = u; u = v; v = tmp; tmp = b; b = c; c = tmp; } if (!BN_GF2m_add(u, u, v)) goto err; if (!BN_GF2m_add(b, b, c)) goto err; } #else { int i, ubits = BN_num_bits(u), vbits = BN_num_bits(v), top = p->top; BN_ULONG *udp,*bdp,*vdp,*cdp; bn_wexpand(u,top); udp = u->d; for (i=u->top;i<top;i++) udp[i] = 0; u->top = top; bn_wexpand(b,top); bdp = b->d; bdp[0] = 1; for (i=1;i<top;i++) bdp[i] = 0; b->top = top; bn_wexpand(c,top); cdp = c->d; for (i=0;i<top;i++) cdp[i] = 0; c->top = top; vdp = v->d; while (1) { while (ubits && !(udp[0]&1)) { BN_ULONG u0,u1,b0,b1,mask; u0 = udp[0]; b0 = bdp[0]; mask = (BN_ULONG)0-(b0&1); b0 ^= p->d[0]&mask; for (i=0;i<top-1;i++) { u1 = udp[i+1]; udp[i] = ((u0>>1)|(u1<<(BN_BITS2-1)))&BN_MASK2; u0 = u1; b1 = bdp[i+1]^(p->d[i+1]&mask); bdp[i] = ((b0>>1)|(b1<<(BN_BITS2-1)))&BN_MASK2; b0 = b1; } udp[i] = u0>>1; bdp[i] = b0>>1; ubits--; } if (ubits<=BN_BITS2 && udp[0]==1) break; if (ubits<vbits) { i = ubits; ubits = vbits; vbits = i; tmp = u; u = v; v = tmp; tmp = b; b = c; c = tmp; udp = vdp; vdp = v->d; bdp = cdp; cdp = c->d; } for(i=0;i<top;i++) { udp[i] ^= vdp[i]; bdp[i] ^= cdp[i]; } if (ubits==vbits) { bn_fix_top(u); ubits = BN_num_bits(u); } } bn_fix_top(b); } #endif if (!BN_copy(r, b)) goto err; bn_check_top(r); ret = 1; err: BN_CTX_end(ctx); return ret; } crypto/bn/bn_gf2m.c:599: error: INTEGER_OVERFLOW_L2 (0 - [0, 1]):unsigned32. Showing all 4 steps of the trace crypto/bn/bn_gf2m.c:581:5: <RHS trace> 579. u->top = top; 580. bn_wexpand(b,top); bdp = b->d; 581. bdp[0] = 1; ^ 582. for (i=1;i<top;i++) bdp[i] = 0; 583. b->top = top; crypto/bn/bn_gf2m.c:581:5: Assignment 579. u->top = top; 580. bn_wexpand(b,top); bdp = b->d; 581. bdp[0] = 1; ^ 582. for (i=1;i<top;i++) bdp[i] = 0; 583. b->top = top; crypto/bn/bn_gf2m.c:598:4: Assignment 596. 597. u0 = udp[0]; 598. b0 = bdp[0]; ^ 599. mask = (BN_ULONG)0-(b0&1); 600. b0 ^= p->d[0]&mask; crypto/bn/bn_gf2m.c:599:4: Binary operation: (0 - [0, 1]):unsigned32 597. u0 = udp[0]; 598. b0 = bdp[0]; 599. mask = (BN_ULONG)0-(b0&1); ^ 600. b0 ^= p->d[0]&mask; 601. for (i=0;i<top-1;i++)
https://github.com/openssl/openssl/blob/0b59755f434eca1ed621974ae9f95663dcdcac35/crypto/bn/bn_gf2m.c/#L599
d2a_code_trace_data_41823
static AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder) { const char *codec_string = encoder ? "encoder" : "decoder"; AVCodec *codec; codec = encoder ? avcodec_find_encoder_by_name(name) : avcodec_find_decoder_by_name(name); if(!codec) { av_log(NULL, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name); exit_program(1); } if(codec->type != type) { av_log(NULL, AV_LOG_FATAL, "Invalid %s type '%s'\n", codec_string, name); exit_program(1); } return codec; } avconv.c:2876: error: Null Dereference pointer `codec` last assigned on line 2869 could be null and is dereferenced at line 2876, column 8. avconv.c:2864:1: start of procedure find_codec_or_die() 2862. } 2863. 2864. static AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder) ^ 2865. { 2866. const char *codec_string = encoder ? "encoder" : "decoder"; avconv.c:2866:32: Condition is true 2864. static AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder) 2865. { 2866. const char *codec_string = encoder ? "encoder" : "decoder"; ^ 2867. AVCodec *codec; 2868. avconv.c:2866:5: 2864. static AVCodec *find_codec_or_die(const char *name, enum AVMediaType type, int encoder) 2865. { 2866. const char *codec_string = encoder ? "encoder" : "decoder"; ^ 2867. AVCodec *codec; 2868. avconv.c:2869:13: Condition is true 2867. AVCodec *codec; 2868. 2869. codec = encoder ? ^ 2870. avcodec_find_encoder_by_name(name) : 2871. avcodec_find_decoder_by_name(name); avconv.c:2869:5: 2867. AVCodec *codec; 2868. 2869. codec = encoder ? ^ 2870. avcodec_find_encoder_by_name(name) : 2871. avcodec_find_decoder_by_name(name); avconv.c:2872:9: Taking true branch 2870. avcodec_find_encoder_by_name(name) : 2871. avcodec_find_decoder_by_name(name); 2872. if(!codec) { ^ 2873. av_log(NULL, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name); 2874. exit_program(1); avconv.c:2873:9: Skipping av_log(): empty list of specs 2871. avcodec_find_decoder_by_name(name); 2872. if(!codec) { 2873. av_log(NULL, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name); ^ 2874. exit_program(1); 2875. } avconv.c:2874:9: Skipping exit_program(): empty list of specs 2872. if(!codec) { 2873. av_log(NULL, AV_LOG_FATAL, "Unknown %s '%s'\n", codec_string, name); 2874. exit_program(1); ^ 2875. } 2876. if(codec->type != type) { avconv.c:2876:8: 2874. exit_program(1); 2875. } 2876. if(codec->type != type) { ^ 2877. av_log(NULL, AV_LOG_FATAL, "Invalid %s type '%s'\n", codec_string, name); 2878. exit_program(1);
https://github.com/libav/libav/blob/4bf3c8f226252e18de8051fd0d417c1d39857b67/avconv.c/#L2876
d2a_code_trace_data_41824
void t2p_read_tiff_size_tile(T2P* t2p, TIFF* input, ttile_t tile){ uint64* tbc = NULL; uint16 edge=0; #ifdef JPEG_SUPPORT unsigned char* jpt; #endif edge |= t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile); edge |= t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile); if(t2p->pdf_transcode==T2P_TRANSCODE_RAW){ if(edge #if defined(JPEG_SUPPORT) || defined(OJPEG_SUPPORT) && !(t2p->pdf_compression==T2P_COMPRESS_JPEG) #endif ){ t2p->tiff_datasize=TIFFTileSize(input); return; } else { TIFFGetField(input, TIFFTAG_TILEBYTECOUNTS, &tbc); t2p->tiff_datasize=(tmsize_t)tbc[tile]; #ifdef OJPEG_SUPPORT if(t2p->tiff_compression==COMPRESSION_OJPEG){ t2p->tiff_datasize+=2048; return; } #endif #ifdef JPEG_SUPPORT if(t2p->tiff_compression==COMPRESSION_JPEG) { uint32 count = 0; if(TIFFGetField(input, TIFFTAG_JPEGTABLES, &count, &jpt)!=0){ if(count > 4){ t2p->tiff_datasize += count; t2p->tiff_datasize -= 2; } } } #endif return; } } t2p->tiff_datasize=TIFFTileSize(input); if(t2p->tiff_planar==PLANARCONFIG_SEPARATE){ t2p->tiff_datasize*= t2p->tiff_samplesperpixel; } return; } tools/tiff2pdf.c:1904: error: Null Dereference pointer `tbc` last assigned on line 1885 could be null and is dereferenced at line 1904, column 33. tools/tiff2pdf.c:1883:1: start of procedure t2p_read_tiff_size_tile() 1881. */ 1882. 1883. void t2p_read_tiff_size_tile(T2P* t2p, TIFF* input, ttile_t tile){ ^ 1884. 1885. uint64* tbc = NULL; tools/tiff2pdf.c:1885:2: 1883. void t2p_read_tiff_size_tile(T2P* t2p, TIFF* input, ttile_t tile){ 1884. 1885. uint64* tbc = NULL; ^ 1886. uint16 edge=0; 1887. #ifdef JPEG_SUPPORT tools/tiff2pdf.c:1886:2: 1884. 1885. uint64* tbc = NULL; 1886. uint16 edge=0; ^ 1887. #ifdef JPEG_SUPPORT 1888. unsigned char* jpt; tools/tiff2pdf.c:1891:2: 1889. #endif 1890. 1891. edge |= t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile); ^ 1892. edge |= t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile); 1893. tools/tiff2pdf.c:1938:1: start of procedure t2p_tile_is_right_edge() 1936. */ 1937. 1938. int t2p_tile_is_right_edge(T2P_TILES tiles, ttile_t tile){ ^ 1939. 1940. if( ((tile+1) % tiles.tiles_tilecountx == 0) tools/tiff2pdf.c:1940:7: Taking false branch 1938. int t2p_tile_is_right_edge(T2P_TILES tiles, ttile_t tile){ 1939. 1940. if( ((tile+1) % tiles.tiles_tilecountx == 0) ^ 1941. && (tiles.tiles_edgetilewidth != 0) ){ 1942. return(1); tools/tiff2pdf.c:1944:3: 1942. return(1); 1943. } else { 1944. return(0); ^ 1945. } 1946. } tools/tiff2pdf.c:1946:1: return from a call to t2p_tile_is_right_edge 1944. return(0); 1945. } 1946. } ^ 1947. 1948. /* tools/tiff2pdf.c:1892:2: 1890. 1891. edge |= t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile); 1892. edge |= t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile); ^ 1893. 1894. if(t2p->pdf_transcode==T2P_TRANSCODE_RAW){ tools/tiff2pdf.c:1953:1: start of procedure t2p_tile_is_bottom_edge() 1951. */ 1952. 1953. int t2p_tile_is_bottom_edge(T2P_TILES tiles, ttile_t tile){ ^ 1954. 1955. if( ((tile+1) > (tiles.tiles_tilecount-tiles.tiles_tilecountx) ) tools/tiff2pdf.c:1955:7: Taking false branch 1953. int t2p_tile_is_bottom_edge(T2P_TILES tiles, ttile_t tile){ 1954. 1955. if( ((tile+1) > (tiles.tiles_tilecount-tiles.tiles_tilecountx) ) ^ 1956. && (tiles.tiles_edgetilelength != 0) ){ 1957. return(1); tools/tiff2pdf.c:1959:3: 1957. return(1); 1958. } else { 1959. return(0); ^ 1960. } 1961. } tools/tiff2pdf.c:1961:1: return from a call to t2p_tile_is_bottom_edge 1959. return(0); 1960. } 1961. } ^ 1962. 1963. /* tools/tiff2pdf.c:1894:5: Taking true branch 1892. edge |= t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile); 1893. 1894. if(t2p->pdf_transcode==T2P_TRANSCODE_RAW){ ^ 1895. if(edge 1896. #if defined(JPEG_SUPPORT) || defined(OJPEG_SUPPORT) tools/tiff2pdf.c:1895:6: Taking false branch 1893. 1894. if(t2p->pdf_transcode==T2P_TRANSCODE_RAW){ 1895. if(edge ^ 1896. #if defined(JPEG_SUPPORT) || defined(OJPEG_SUPPORT) 1897. && !(t2p->pdf_compression==T2P_COMPRESS_JPEG) tools/tiff2pdf.c:1903:4: 1901. return; 1902. } else { 1903. TIFFGetField(input, TIFFTAG_TILEBYTECOUNTS, &tbc); ^ 1904. t2p->tiff_datasize=(tmsize_t)tbc[tile]; 1905. #ifdef OJPEG_SUPPORT libtiff/tif_dir.c:1100:1: start of procedure TIFFGetField() 1098. * internal directory structure. 1099. */ 1100. int ^ 1101. TIFFGetField(TIFF* tif, uint32 tag, ...) 1102. { libtiff/tif_dir.c:1106:2: 1104. va_list ap; 1105. 1106. va_start(ap, tag); ^ 1107. status = TIFFVGetField(tif, tag, ap); 1108. va_end(ap); libtiff/tif_dir.c:1107:2: Skipping TIFFVGetField(): empty list of specs 1105. 1106. va_start(ap, tag); 1107. status = TIFFVGetField(tif, tag, ap); ^ 1108. va_end(ap); 1109. return (status); libtiff/tif_dir.c:1108:2: 1106. va_start(ap, tag); 1107. status = TIFFVGetField(tif, tag, ap); 1108. va_end(ap); ^ 1109. return (status); 1110. } libtiff/tif_dir.c:1109:2: 1107. status = TIFFVGetField(tif, tag, ap); 1108. va_end(ap); 1109. return (status); ^ 1110. } 1111. libtiff/tif_dir.c:1110:1: return from a call to TIFFGetField 1108. va_end(ap); 1109. return (status); 1110. } ^ 1111. 1112. /* tools/tiff2pdf.c:1904:4: 1902. } else { 1903. TIFFGetField(input, TIFFTAG_TILEBYTECOUNTS, &tbc); 1904. t2p->tiff_datasize=(tmsize_t)tbc[tile]; ^ 1905. #ifdef OJPEG_SUPPORT 1906. if(t2p->tiff_compression==COMPRESSION_OJPEG){
https://gitlab.com/libtiff/libtiff/blob/b69a1998bedfabc32cd541408bffdef05bd01e45/tools/tiff2pdf.c/#L1904
d2a_code_trace_data_41825
static int encode_test_init(EVP_TEST *t, const char *encoding) { ENCODE_DATA *edata = OPENSSL_zalloc(sizeof(*edata)); if (strcmp(encoding, "canonical") == 0) { edata->encoding = BASE64_CANONICAL_ENCODING; } else if (strcmp(encoding, "valid") == 0) { edata->encoding = BASE64_VALID_ENCODING; } else if (strcmp(encoding, "invalid") == 0) { edata->encoding = BASE64_INVALID_ENCODING; t->expected_err = OPENSSL_strdup("DECODE_ERROR"); if (t->expected_err == NULL) return 0; } else { TEST_info("Bad encoding: %s. Should be one of " "{canonical, valid, invalid}", encoding); return 0; } t->data = edata; return 1; } test/evp_test.c:1770: error: MEMORY_LEAK memory dynamically allocated to `return` by call to `CRYPTO_zalloc()` at line 1760, column 26 is not reachable after line 1770, column 13. Showing all 38 steps of the trace test/evp_test.c:1758:1: start of procedure encode_test_init() 1756. } ENCODE_DATA; 1757. 1758. > static int encode_test_init(EVP_TEST *t, const char *encoding) 1759. { 1760. ENCODE_DATA *edata = OPENSSL_zalloc(sizeof(*edata)); test/evp_test.c:1760:5: 1758. static int encode_test_init(EVP_TEST *t, const char *encoding) 1759. { 1760. > ENCODE_DATA *edata = OPENSSL_zalloc(sizeof(*edata)); 1761. 1762. if (strcmp(encoding, "canonical") == 0) { crypto/mem.c:186:1: start of procedure CRYPTO_zalloc() 184. } 185. 186. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:188:5: 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) 187. { 188. > void *ret = CRYPTO_malloc(num, file, line); 189. 190. FAILTEST(); crypto/mem.c:158:1: start of procedure CRYPTO_malloc() 156. #endif 157. 158. > void *CRYPTO_malloc(size_t num, const char *file, int line) 159. { 160. void *ret = NULL; crypto/mem.c:160:5: 158. void *CRYPTO_malloc(size_t num, const char *file, int line) 159. { 160. > void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:162:9: Taking 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) crypto/mem.c:191:9: Taking true branch 189. 190. FAILTEST(); 191. if (ret != NULL) ^ 192. memset(ret, 0, num); 193. return ret; crypto/mem.c:192:9: 190. FAILTEST(); 191. if (ret != NULL) 192. > memset(ret, 0, num); 193. return ret; 194. } crypto/mem.c:193:5: 191. if (ret != NULL) 192. memset(ret, 0, num); 193. > return ret; 194. } 195. crypto/mem.c:194:1: return from a call to CRYPTO_zalloc 192. memset(ret, 0, num); 193. return ret; 194. > } 195. 196. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) test/evp_test.c:1762:9: Taking false branch 1760. ENCODE_DATA *edata = OPENSSL_zalloc(sizeof(*edata)); 1761. 1762. if (strcmp(encoding, "canonical") == 0) { ^ 1763. edata->encoding = BASE64_CANONICAL_ENCODING; 1764. } else if (strcmp(encoding, "valid") == 0) { test/evp_test.c:1764:16: Taking false branch 1762. if (strcmp(encoding, "canonical") == 0) { 1763. edata->encoding = BASE64_CANONICAL_ENCODING; 1764. } else if (strcmp(encoding, "valid") == 0) { ^ 1765. edata->encoding = BASE64_VALID_ENCODING; 1766. } else if (strcmp(encoding, "invalid") == 0) { test/evp_test.c:1766:16: Taking true branch 1764. } else if (strcmp(encoding, "valid") == 0) { 1765. edata->encoding = BASE64_VALID_ENCODING; 1766. } else if (strcmp(encoding, "invalid") == 0) { ^ 1767. edata->encoding = BASE64_INVALID_ENCODING; 1768. t->expected_err = OPENSSL_strdup("DECODE_ERROR"); test/evp_test.c:1767:9: 1765. edata->encoding = BASE64_VALID_ENCODING; 1766. } else if (strcmp(encoding, "invalid") == 0) { 1767. > edata->encoding = BASE64_INVALID_ENCODING; 1768. t->expected_err = OPENSSL_strdup("DECODE_ERROR"); 1769. if (t->expected_err == NULL) test/evp_test.c:1768:9: 1766. } else if (strcmp(encoding, "invalid") == 0) { 1767. edata->encoding = BASE64_INVALID_ENCODING; 1768. > t->expected_err = OPENSSL_strdup("DECODE_ERROR"); 1769. if (t->expected_err == NULL) 1770. return 0; 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:158:1: start of procedure CRYPTO_malloc() 156. #endif 157. 158. > void *CRYPTO_malloc(size_t num, const char *file, int line) 159. { 160. void *ret = NULL; crypto/mem.c:160:5: 158. void *CRYPTO_malloc(size_t num, const char *file, int line) 159. { 160. > void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) crypto/mem.c:162:9: Taking true branch 160. void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 163. return malloc_impl(num, file, line); 164. crypto/mem.c:162:32: Taking true branch 160. void *ret = NULL; 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 163. return malloc_impl(num, file, line); 164. crypto/mem.c:163:9: Skipping __function_pointer__(): unresolved function pointer 161. 162. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) 163. return malloc_impl(num, file, line); ^ 164. 165. if (num == 0) crypto/mem.c:184:1: return from a call to CRYPTO_malloc 182. 183. return ret; 184. > } 185. 186. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/o_str.c:37:9: Taking false 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: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) test/evp_test.c:1769:13: Taking true branch 1767. edata->encoding = BASE64_INVALID_ENCODING; 1768. t->expected_err = OPENSSL_strdup("DECODE_ERROR"); 1769. if (t->expected_err == NULL) ^ 1770. return 0; 1771. } else { test/evp_test.c:1770:13: 1768. t->expected_err = OPENSSL_strdup("DECODE_ERROR"); 1769. if (t->expected_err == NULL) 1770. > return 0; 1771. } else { 1772. TEST_info("Bad encoding: %s. Should be one of "
https://github.com/openssl/openssl/blob/69b4c01fd26e6eb72b156ed3014522c3295a7669/test/evp_test.c/#L1770
d2a_code_trace_data_41826
int OPENSSL_SA_set(OPENSSL_SA *sa, ossl_uintmax_t posn, void *val) { int i, level = 1; ossl_uintmax_t n = posn; void **p; if (sa == NULL) return 0; for (level = 1; level < SA_BLOCK_MAX_LEVELS; level++) if ((n >>= OPENSSL_SA_BLOCK_BITS) == 0) break; for (;sa->levels < level; sa->levels++) { p = alloc_node(); if (p == NULL) return 0; p[0] = sa->nodes; sa->nodes = p; } if (sa->top < posn) sa->top = posn; p = sa->nodes; for (level = sa->levels - 1; level > 0; level--) { i = (posn >> (OPENSSL_SA_BLOCK_BITS * level)) & SA_BLOCK_MASK; if (p[i] == NULL && (p[i] = alloc_node()) == NULL) return 0; p = p[i]; } p += posn & SA_BLOCK_MASK; if (val == NULL && *p != NULL) sa->nelem--; else if (val != NULL && *p == NULL) sa->nelem++; *p = val; return 1; } test/sparse_array_test.c:163: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `ossl_sa_char_set`. Showing all 10 steps of the trace test/sparse_array_test.c:163:14: Call 161. doall_data.sa = NULL; 162. for (i = 0; i < OSSL_NELEM(cases); i++) 163. if (!TEST_true(ossl_sa_char_set(sa, cases[i].n, cases[i].v))) { ^ 164. TEST_note("failed at iteration %zu", i + 1); 165. goto err; test/sparse_array_test.c:28:1: Parameter `sa->nelem` 26. #endif 27. 28. > DEFINE_SPARSE_ARRAY_OF(char); 29. 30. static int test_sparse_array(void) test/sparse_array_test.c:28:1: Call 26. #endif 27. 28. > DEFINE_SPARSE_ARRAY_OF(char); 29. 30. static int test_sparse_array(void) crypto/sparse_array.c:183:1: Parameter `sa->nelem` 181. } 182. 183. > int OPENSSL_SA_set(OPENSSL_SA *sa, ossl_uintmax_t posn, void *val) 184. { 185. int i, level = 1; test/sparse_array_test.c:163:14: Call 161. doall_data.sa = NULL; 162. for (i = 0; i < OSSL_NELEM(cases); i++) 163. if (!TEST_true(ossl_sa_char_set(sa, cases[i].n, cases[i].v))) { ^ 164. TEST_note("failed at iteration %zu", i + 1); 165. goto err; test/sparse_array_test.c:28:1: Parameter `sa->nelem` 26. #endif 27. 28. > DEFINE_SPARSE_ARRAY_OF(char); 29. 30. static int test_sparse_array(void) test/sparse_array_test.c:28:1: Call 26. #endif 27. 28. > DEFINE_SPARSE_ARRAY_OF(char); 29. 30. static int test_sparse_array(void) crypto/sparse_array.c:183:1: <LHS trace> 181. } 182. 183. > int OPENSSL_SA_set(OPENSSL_SA *sa, ossl_uintmax_t posn, void *val) 184. { 185. int i, level = 1; crypto/sparse_array.c:183:1: Parameter `sa->nelem` 181. } 182. 183. > int OPENSSL_SA_set(OPENSSL_SA *sa, ossl_uintmax_t posn, void *val) 184. { 185. int i, level = 1; crypto/sparse_array.c:215:9: Binary operation: ([0, +oo] - 1):unsigned64 by call to `ossl_sa_char_set` 213. p += posn & SA_BLOCK_MASK; 214. if (val == NULL && *p != NULL) 215. sa->nelem--; ^ 216. else if (val != NULL && *p == NULL) 217. sa->nelem++;
https://github.com/openssl/openssl/blob/8ab53b193a8e95bb2998744bc184146eb1ddcc23/crypto/sparse_array.c/#L215
d2a_code_trace_data_41827
int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, const void *data, int len) { ASN1_TYPE *ttmp; ASN1_STRING *stmp = NULL; int atype = 0; if (!attr) return 0; if (attrtype & MBSTRING_FLAG) { stmp = ASN1_STRING_set_by_NID(NULL, data, len, attrtype, OBJ_obj2nid(attr->object)); if (!stmp) { X509err(X509_F_X509_ATTRIBUTE_SET1_DATA, ERR_R_ASN1_LIB); return 0; } atype = stmp->type; } else if (len != -1) { if ((stmp = ASN1_STRING_type_new(attrtype)) == NULL) goto err; if (!ASN1_STRING_set(stmp, data, len)) goto err; atype = attrtype; } if (attrtype == 0) return 1; if ((ttmp = ASN1_TYPE_new()) == NULL) goto err; if ((len == -1) && !(attrtype & MBSTRING_FLAG)) { if (!ASN1_TYPE_set1(ttmp, attrtype, data)) goto err; } else ASN1_TYPE_set(ttmp, atype, stmp); if (!sk_ASN1_TYPE_push(attr->set, ttmp)) goto err; return 1; err: X509err(X509_F_X509_ATTRIBUTE_SET1_DATA, ERR_R_MALLOC_FAILURE); return 0; } crypto/x509/x509_att.c:324: error: MEMORY_LEAK memory dynamically allocated to `return` by call to `ASN1_STRING_type_new()` at line 312, column 21 is not reachable after line 324, column 9. Showing all 55 steps of the trace crypto/x509/x509_att.c:295:1: start of procedure X509_ATTRIBUTE_set1_data() 293. } 294. 295. > int X509_ATTRIBUTE_set1_data(X509_ATTRIBUTE *attr, int attrtype, 296. const void *data, int len) 297. { crypto/x509/x509_att.c:299:5: 297. { 298. ASN1_TYPE *ttmp; 299. > ASN1_STRING *stmp = NULL; 300. int atype = 0; 301. if (!attr) crypto/x509/x509_att.c:300:5: 298. ASN1_TYPE *ttmp; 299. ASN1_STRING *stmp = NULL; 300. > int atype = 0; 301. if (!attr) 302. return 0; crypto/x509/x509_att.c:301:10: Taking false branch 299. ASN1_STRING *stmp = NULL; 300. int atype = 0; 301. if (!attr) ^ 302. return 0; 303. if (attrtype & MBSTRING_FLAG) { crypto/x509/x509_att.c:303:9: Taking false branch 301. if (!attr) 302. return 0; 303. if (attrtype & MBSTRING_FLAG) { ^ 304. stmp = ASN1_STRING_set_by_NID(NULL, data, len, attrtype, 305. OBJ_obj2nid(attr->object)); crypto/x509/x509_att.c:311:16: Taking true branch 309. } 310. atype = stmp->type; 311. } else if (len != -1) { ^ 312. if ((stmp = ASN1_STRING_type_new(attrtype)) == NULL) 313. goto err; crypto/x509/x509_att.c:312:13: 310. atype = stmp->type; 311. } else if (len != -1) { 312. > if ((stmp = ASN1_STRING_type_new(attrtype)) == NULL) 313. goto err; 314. if (!ASN1_STRING_set(stmp, data, len)) 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/x509/x509_att.c:312:13: Taking false branch 310. atype = stmp->type; 311. } else if (len != -1) { 312. if ((stmp = ASN1_STRING_type_new(attrtype)) == NULL) ^ 313. goto err; 314. if (!ASN1_STRING_set(stmp, data, len)) crypto/x509/x509_att.c:314:14: 312. if ((stmp = ASN1_STRING_type_new(attrtype)) == NULL) 313. goto err; 314. > if (!ASN1_STRING_set(stmp, data, len)) 315. goto err; 316. atype = attrtype; 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/x509/x509_att.c:314:14: Taking false branch 312. if ((stmp = ASN1_STRING_type_new(attrtype)) == NULL) 313. goto err; 314. if (!ASN1_STRING_set(stmp, data, len)) ^ 315. goto err; 316. atype = attrtype; crypto/x509/x509_att.c:316:9: 314. if (!ASN1_STRING_set(stmp, data, len)) 315. goto err; 316. > atype = attrtype; 317. } 318. /* crypto/x509/x509_att.c:323:9: Taking true branch 321. * this. 322. */ 323. if (attrtype == 0) ^ 324. return 1; 325. if ((ttmp = ASN1_TYPE_new()) == NULL) crypto/x509/x509_att.c:324:9: 322. */ 323. if (attrtype == 0) 324. > return 1; 325. if ((ttmp = ASN1_TYPE_new()) == NULL) 326. goto err;
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/x509/x509_att.c/#L324
d2a_code_trace_data_41828
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/ca.c:2110: error: BUFFER_OVERRUN_L3 Offset added: [0, 200] Size: [1, 2147483644] by call to `X509_NAME_oneline`. Showing all 6 steps of the trace apps/ca.c:2110:20: Call 2108. for (i = 0; i < DB_NUMBER; i++) 2109. row[i] = NULL; 2110. row[DB_name] = X509_NAME_oneline(X509_get_subject_name(x509), NULL, 0); ^ 2111. bn = ASN1_INTEGER_to_BN(X509_get_serialNumber(x509), NULL); 2112. if (!bn) 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:104:9: Array access: Offset added: [0, 200] Size: [1, 2147483644] by call to `X509_NAME_oneline` 102. OPENSSL_free(b); 103. } 104. strncpy(buf, "NO X509_NAME", len); ^ 105. buf[len - 1] = '\0'; 106. return buf;
https://github.com/openssl/openssl/blob/24c2cd3967ed23acc0bd31a3781c4525e2e42a2c/crypto/x509/x509_obj.c/#L104
d2a_code_trace_data_41829
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/ec/ecdh_ossl.c:81: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `EC_POINT_mul`. Showing all 16 steps of the trace crypto/ec/ecdh_ossl.c:81:10: Call 79. } 80. 81. if (!EC_POINT_mul(group, tmp, NULL, pub_key, priv_key, ctx)) { ^ 82. ECerr(EC_F_ECDH_SIMPLE_COMPUTE_KEY, EC_R_POINT_ARITHMETIC_FAILURE); 83. goto err; crypto/ec/ec_lib.c:971:1: Parameter `g_scalar->top` 969. } 970. 971. > int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, 972. const EC_POINT *point, const BIGNUM *p_scalar, BN_CTX *ctx) 973. { crypto/ec/ec_lib.c:982:12: Call 980. scalars[0] = p_scalar; 981. 982. return EC_POINTs_mul(group, r, g_scalar, ^ 983. (point != NULL 984. && p_scalar != NULL), points, scalars, ctx); crypto/ec/ec_lib.c:933:1: Parameter `scalar->top` 931. */ 932. 933. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 934. size_t num, const EC_POINT *points[], 935. const BIGNUM *scalars[], BN_CTX *ctx) crypto/ec/ec_lib.c:965:15: Call 963. else 964. /* use default */ 965. ret = ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx); ^ 966. 967. BN_CTX_free(new_ctx); crypto/ec/ec_mult.c:410:1: Parameter `scalar->top` 408. * in the addition if scalar != NULL 409. */ 410. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 411. size_t num, const EC_POINT *points[], const BIGNUM *scalars[], 412. BN_CTX *ctx) crypto/ec/ec_mult.c:453:20: Call 451. * always call the ladder version. 452. */ 453. return ec_scalar_mul_ladder(group, r, scalar, NULL, ctx); ^ 454. } 455. if ((scalar == NULL) && (num == 1) && (scalars[0] != group->order)) { crypto/ec/ec_mult.c:139:1: Parameter `scalar->top` 137. * Returns 1 on success, 0 otherwise. 138. */ 139. > int ec_scalar_mul_ladder(const EC_GROUP *group, EC_POINT *r, 140. const BIGNUM *scalar, const EC_POINT *point, 141. BN_CTX *ctx) crypto/ec/ec_mult.c:215:10: Call 213. } 214. 215. if (!BN_copy(k, scalar)) { ^ 216. ECerr(EC_F_EC_SCALAR_MUL_LADDER, ERR_R_BN_LIB); 217. goto err; crypto/bn/bn_lib.c:281:1: <Offset trace> 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:281:1: Parameter `b->top` 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:281:1: <Length trace> 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:281:1: Parameter `*a->d` 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/bn/bn_lib.c:287:9: Call 285. if (a == b) 286. return a; 287. if (bn_wexpand(a, b->top) == NULL) ^ 288. return NULL; 289. crypto/bn/bn_lib.c:962:1: Parameter `*a->d` 960. } 961. 962. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 963. { 964. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:291:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `EC_POINT_mul` 289. 290. if (b->top > 0) 291. memcpy(a->d, b->d, sizeof(b->d[0]) * b->top); ^ 292. 293. a->neg = b->neg;
https://github.com/openssl/openssl/blob/3051bf2afab7ac8b7b9c64e68755d1addd2fb8ff/crypto/bn/bn_lib.c/#L291
d2a_code_trace_data_41830
int test_div_word(BIO *bp) { BIGNUM *a, *b; BN_ULONG r, s; int i; a = BN_new(); b = BN_new(); for (i = 0; i < num0; i++) { do { BN_bntest_rand(a, 512, -1, 0); BN_bntest_rand(b, BN_BITS2, -1, 0); } while (BN_is_zero(b)); s = b->d[0]; BN_copy(b, a); r = BN_div_word(b, s); if (bp != NULL) { if (!results) { BN_print(bp, a); BIO_puts(bp, " / "); print_word(bp, s); BIO_puts(bp, " - "); } BN_print(bp, b); BIO_puts(bp, "\n"); if (!results) { BN_print(bp, a); BIO_puts(bp, " % "); print_word(bp, s); BIO_puts(bp, " - "); } print_word(bp, r); BIO_puts(bp, "\n"); } BN_mul_word(b, s); BN_add_word(b, r); BN_sub(b, a, b); if (!BN_is_zero(b)) { fprintf(stderr, "Division (word) test failed!\n"); return 0; } } BN_free(a); BN_free(b); return (1); } test/bntest.c:567: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 527, column 9 is not reachable after line 567, column 5. Showing all 73 steps of the trace test/bntest.c:520:1: start of procedure test_div_word() 518. } 519. 520. > int test_div_word(BIO *bp) 521. { 522. BIGNUM *a, *b; test/bntest.c:526:5: 524. int i; 525. 526. > a = BN_new(); 527. b = BN_new(); 528. 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:527:5: 525. 526. a = BN_new(); 527. > b = BN_new(); 528. 529. 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:529:10: 527. b = BN_new(); 528. 529. > for (i = 0; i < num0; i++) { 530. do { 531. BN_bntest_rand(a, 512, -1, 0); test/bntest.c:529:17: Loop condition is false. Leaving loop 527. b = BN_new(); 528. 529. for (i = 0; i < num0; i++) { ^ 530. do { 531. BN_bntest_rand(a, 512, -1, 0); test/bntest.c:566:5: 564. } 565. } 566. > BN_free(a); 567. BN_free(b); 568. 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:567:5: 565. } 566. BN_free(a); 567. > BN_free(b); 568. return (1); 569. } 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/#L567
d2a_code_trace_data_41831
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_context3(NULL); track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE; for (i = 0; i < s->nb_chapters; i++) { AVChapter *c = s->chapters[i]; AVDictionaryEntry *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_dict_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:2983: error: Null Dereference pointer `pkt.data` last assigned on line 2982 could be null and is dereferenced at line 2983, column 13. libavformat/movenc.c:2958:1: start of procedure mov_create_chapter_track() 2956. // QuickTime chapters involve an additional text track with the chapter names 2957. // as samples, and a tref pointing from the other tracks to the chapter one. 2958. static void mov_create_chapter_track(AVFormatContext *s, int tracknum) ^ 2959. { 2960. MOVMuxContext *mov = s->priv_data; libavformat/movenc.c:2960:5: 2958. static void mov_create_chapter_track(AVFormatContext *s, int tracknum) 2959. { 2960. MOVMuxContext *mov = s->priv_data; ^ 2961. MOVTrack *track = &mov->tracks[tracknum]; 2962. AVPacket pkt = { .stream_index = tracknum, .flags = AV_PKT_FLAG_KEY }; libavformat/movenc.c:2961:5: 2959. { 2960. MOVMuxContext *mov = s->priv_data; 2961. MOVTrack *track = &mov->tracks[tracknum]; ^ 2962. AVPacket pkt = { .stream_index = tracknum, .flags = AV_PKT_FLAG_KEY }; 2963. int i, len; libavformat/movenc.c:2962:5: 2960. MOVMuxContext *mov = s->priv_data; 2961. MOVTrack *track = &mov->tracks[tracknum]; 2962. AVPacket pkt = { .stream_index = tracknum, .flags = AV_PKT_FLAG_KEY }; ^ 2963. int i, len; 2964. libavformat/movenc.c:2965:5: 2963. int i, len; 2964. 2965. track->mode = mov->mode; ^ 2966. track->tag = MKTAG('t','e','x','t'); 2967. track->timescale = MOV_TIMESCALE; libavformat/movenc.c:2966:5: 2964. 2965. track->mode = mov->mode; 2966. track->tag = MKTAG('t','e','x','t'); ^ 2967. track->timescale = MOV_TIMESCALE; 2968. track->enc = avcodec_alloc_context3(NULL); libavformat/movenc.c:2967:5: 2965. track->mode = mov->mode; 2966. track->tag = MKTAG('t','e','x','t'); 2967. track->timescale = MOV_TIMESCALE; ^ 2968. track->enc = avcodec_alloc_context3(NULL); 2969. track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE; libavformat/movenc.c:2968:5: 2966. track->tag = MKTAG('t','e','x','t'); 2967. track->timescale = MOV_TIMESCALE; 2968. track->enc = avcodec_alloc_context3(NULL); ^ 2969. track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE; 2970. libavcodec/options.c:123:1: start of procedure avcodec_alloc_context3() 121. } 122. 123. AVCodecContext *avcodec_alloc_context3(AVCodec *codec){ ^ 124. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); 125. libavcodec/options.c:124:5: 122. 123. AVCodecContext *avcodec_alloc_context3(AVCodec *codec){ 124. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); ^ 125. 126. 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: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_MEMALIGN libavutil/mem.c:116:5: 114. ptr = malloc(size); 115. #endif 116. return ptr; ^ 117. } 118. libavutil/mem.c:117:1: return from a call to av_malloc 115. #endif 116. return ptr; 117. } ^ 118. 119. void *av_realloc(void *ptr, size_t size) libavcodec/options.c:126:8: Taking false branch 124. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); 125. 126. if(avctx==NULL) return NULL; ^ 127. 128. if(avcodec_get_context_defaults3(avctx, codec) < 0){ libavcodec/options.c:128:8: Taking false branch 126. if(avctx==NULL) return NULL; 127. 128. if(avcodec_get_context_defaults3(avctx, codec) < 0){ ^ 129. av_free(avctx); 130. return NULL; libavcodec/options.c:133:5: 131. } 132. 133. return avctx; ^ 134. } 135. libavcodec/options.c:134:1: return from a call to avcodec_alloc_context3 132. 133. return avctx; 134. } ^ 135. 136. int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src) libavformat/movenc.c:2969:5: 2967. track->timescale = MOV_TIMESCALE; 2968. track->enc = avcodec_alloc_context3(NULL); 2969. track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE; ^ 2970. 2971. for (i = 0; i < s->nb_chapters; i++) { libavformat/movenc.c:2971:10: 2969. track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE; 2970. 2971. for (i = 0; i < s->nb_chapters; i++) { ^ 2972. AVChapter *c = s->chapters[i]; 2973. AVDictionaryEntry *t; libavformat/movenc.c:2971:17: Loop condition is true. Entering loop body 2969. track->enc->codec_type = AVMEDIA_TYPE_SUBTITLE; 2970. 2971. for (i = 0; i < s->nb_chapters; i++) { ^ 2972. AVChapter *c = s->chapters[i]; 2973. AVDictionaryEntry *t; libavformat/movenc.c:2972:9: 2970. 2971. for (i = 0; i < s->nb_chapters; i++) { 2972. AVChapter *c = s->chapters[i]; ^ 2973. AVDictionaryEntry *t; 2974. libavformat/movenc.c:2975:9: 2973. AVDictionaryEntry *t; 2974. 2975. int64_t end = av_rescale_q(c->end, c->time_base, (AVRational){1,MOV_TIMESCALE}); ^ 2976. pkt.pts = pkt.dts = av_rescale_q(c->start, c->time_base, (AVRational){1,MOV_TIMESCALE}); 2977. pkt.duration = end - pkt.dts; libavutil/mathematics.c:141:1: start of procedure av_rescale_q() 139. } 140. 141. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) ^ 142. { 143. return av_rescale_q_rnd(a, bq, cq, AV_ROUND_NEAR_INF); libavutil/mathematics.c:143:5: 141. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) 142. { 143. return av_rescale_q_rnd(a, bq, cq, AV_ROUND_NEAR_INF); ^ 144. } 145. libavutil/mathematics.c:133:1: start of procedure av_rescale_q_rnd() 131. } 132. 133. int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq, ^ 134. enum AVRounding rnd) 135. { libavutil/mathematics.c:136:5: 134. enum AVRounding rnd) 135. { 136. int64_t b= bq.num * (int64_t)cq.den; ^ 137. int64_t c= cq.num * (int64_t)bq.den; 138. return av_rescale_rnd(a, b, c, rnd); libavutil/mathematics.c:137:5: 135. { 136. int64_t b= bq.num * (int64_t)cq.den; 137. int64_t c= cq.num * (int64_t)bq.den; ^ 138. return av_rescale_rnd(a, b, c, rnd); 139. } libavutil/mathematics.c:138:5: Skipping av_rescale_rnd(): empty list of specs 136. int64_t b= bq.num * (int64_t)cq.den; 137. int64_t c= cq.num * (int64_t)bq.den; 138. return av_rescale_rnd(a, b, c, rnd); ^ 139. } 140. libavutil/mathematics.c:139:1: return from a call to av_rescale_q_rnd 137. int64_t c= cq.num * (int64_t)bq.den; 138. return av_rescale_rnd(a, b, c, rnd); 139. } ^ 140. 141. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) libavutil/mathematics.c:144:1: return from a call to av_rescale_q 142. { 143. return av_rescale_q_rnd(a, bq, cq, AV_ROUND_NEAR_INF); 144. } ^ 145. 146. int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b){ libavformat/movenc.c:2976:9: 2974. 2975. int64_t end = av_rescale_q(c->end, c->time_base, (AVRational){1,MOV_TIMESCALE}); 2976. pkt.pts = pkt.dts = av_rescale_q(c->start, c->time_base, (AVRational){1,MOV_TIMESCALE}); ^ 2977. pkt.duration = end - pkt.dts; 2978. libavutil/mathematics.c:141:1: start of procedure av_rescale_q() 139. } 140. 141. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) ^ 142. { 143. return av_rescale_q_rnd(a, bq, cq, AV_ROUND_NEAR_INF); libavutil/mathematics.c:143:5: 141. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) 142. { 143. return av_rescale_q_rnd(a, bq, cq, AV_ROUND_NEAR_INF); ^ 144. } 145. libavutil/mathematics.c:133:1: start of procedure av_rescale_q_rnd() 131. } 132. 133. int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq, ^ 134. enum AVRounding rnd) 135. { libavutil/mathematics.c:136:5: 134. enum AVRounding rnd) 135. { 136. int64_t b= bq.num * (int64_t)cq.den; ^ 137. int64_t c= cq.num * (int64_t)bq.den; 138. return av_rescale_rnd(a, b, c, rnd); libavutil/mathematics.c:137:5: 135. { 136. int64_t b= bq.num * (int64_t)cq.den; 137. int64_t c= cq.num * (int64_t)bq.den; ^ 138. return av_rescale_rnd(a, b, c, rnd); 139. } libavutil/mathematics.c:138:5: Skipping av_rescale_rnd(): empty list of specs 136. int64_t b= bq.num * (int64_t)cq.den; 137. int64_t c= cq.num * (int64_t)bq.den; 138. return av_rescale_rnd(a, b, c, rnd); ^ 139. } 140. libavutil/mathematics.c:139:1: return from a call to av_rescale_q_rnd 137. int64_t c= cq.num * (int64_t)bq.den; 138. return av_rescale_rnd(a, b, c, rnd); 139. } ^ 140. 141. int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) libavutil/mathematics.c:144:1: return from a call to av_rescale_q 142. { 143. return av_rescale_q_rnd(a, bq, cq, AV_ROUND_NEAR_INF); 144. } ^ 145. 146. int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b){ libavformat/movenc.c:2977:9: 2975. int64_t end = av_rescale_q(c->end, c->time_base, (AVRational){1,MOV_TIMESCALE}); 2976. pkt.pts = pkt.dts = av_rescale_q(c->start, c->time_base, (AVRational){1,MOV_TIMESCALE}); 2977. pkt.duration = end - pkt.dts; ^ 2978. 2979. if ((t = av_dict_get(c->metadata, "title", NULL, 0))) { libavformat/movenc.c:2979:14: Taking true branch 2977. pkt.duration = end - pkt.dts; 2978. 2979. if ((t = av_dict_get(c->metadata, "title", NULL, 0))) { ^ 2980. len = strlen(t->value); 2981. pkt.size = len+2; libavformat/movenc.c:2980:13: 2978. 2979. if ((t = av_dict_get(c->metadata, "title", NULL, 0))) { 2980. len = strlen(t->value); ^ 2981. pkt.size = len+2; 2982. pkt.data = av_malloc(pkt.size); libavformat/movenc.c:2981:13: 2979. if ((t = av_dict_get(c->metadata, "title", NULL, 0))) { 2980. len = strlen(t->value); 2981. pkt.size = len+2; ^ 2982. pkt.data = av_malloc(pkt.size); 2983. AV_WB16(pkt.data, len); libavformat/movenc.c:2982:13: 2980. len = strlen(t->value); 2981. pkt.size = len+2; 2982. pkt.data = av_malloc(pkt.size); ^ 2983. AV_WB16(pkt.data, len); 2984. 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:71:5: 69. #endif 70. 71. assert(size); ^ 72. 73. /* let's disallow possible ambiguous cases */ libavutil/mem.c:74:9: Taking true branch 72. 73. /* let's disallow possible ambiguous cases */ 74. if (size > (INT_MAX-32) || !size) ^ 75. return NULL; 76. libavutil/mem.c:75:9: 73. /* let's disallow possible ambiguous cases */ 74. if (size > (INT_MAX-32) || !size) 75. return NULL; ^ 76. 77. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:117:1: return from a call to av_malloc 115. #endif 116. return ptr; 117. } ^ 118. 119. void *av_realloc(void *ptr, size_t size) libavformat/movenc.c:2983:13: 2981. pkt.size = len+2; 2982. pkt.data = av_malloc(pkt.size); 2983. AV_WB16(pkt.data, len); ^ 2984. memcpy(pkt.data+2, t->value, len); 2985. 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/ed7bdd8647a3d0f534c2af0d244fc8744ff262a0/libavformat/movenc.c/#L2983
d2a_code_trace_data_41832
static inline void skip_remaining(BitstreamContext *bc, unsigned n) { #ifdef BITSTREAM_READER_LE bc->bits >>= n; #else bc->bits <<= n; #endif bc->bits_left -= n; } libavcodec/tak.c:146: error: Integer Overflow L2 ([0, +oo] - 25):unsigned32 by call to `bitstream_skip`. libavcodec/tak.c:145:13: Call 143. avpriv_tak_parse_streaminfo(bc, ti); 144. 145. if (bitstream_read(bc, 6)) ^ 146. bitstream_skip(bc, 25); 147. bitstream_align(bc); 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:146:13: Call 144. 145. if (bitstream_read(bc, 6)) 146. bitstream_skip(bc, 25); ^ 147. bitstream_align(bc); 148. } libavcodec/bitstream.h:241:1: Parameter `n` 239. 240. /* Skip n bits in the buffer. */ 241. static inline void bitstream_skip(BitstreamContext *bc, unsigned n) ^ 242. { 243. if (n <= bc->bits_left) libavcodec/bitstream.h:244:9: Call 242. { 243. if (n <= bc->bits_left) 244. skip_remaining(bc, n); ^ 245. else { 246. n -= bc->bits_left; libavcodec/bitstream.h:230:1: <LHS trace> 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:230:1: Parameter `bc->bits_left` 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:230:1: <RHS trace> 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:230:1: Parameter `n` 228. } 229. 230. static inline void skip_remaining(BitstreamContext *bc, unsigned n) ^ 231. { 232. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:237:5: Binary operation: ([0, +oo] - 25):unsigned32 by call to `bitstream_skip` 235. bc->bits <<= n; 236. #endif 237. bc->bits_left -= n; ^ 238. } 239.
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L237
d2a_code_trace_data_41833
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) { int i, j, max; const BN_ULONG *ap; BN_ULONG *rp; max = n * 2; ap = a; rp = r; rp[0] = rp[max - 1] = 0; rp++; j = n; if (--j > 0) { ap++; rp[j] = bn_mul_words(rp, ap, j, ap[-1]); rp += 2; } for (i = n - 2; i > 0; i--) { j--; ap++; rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]); rp += 2; } bn_add_words(r, r, r, max); bn_sqr_words(tmp, a, n); bn_add_words(r, r, tmp, max); } ssl/tls_srp.c:294: error: BUFFER_OVERRUN_L3 Offset: [31, +oo] Size: [0, 8388607] by call to `SRP_Calc_server_key`. Showing all 22 steps of the trace ssl/tls_srp.c:284:1: Parameter `s->srp_ctx.A->top` 282. } 283. 284. > int srp_generate_server_master_secret(SSL *s) 285. { 286. BIGNUM *K = NULL, *u = NULL; ssl/tls_srp.c:290:10: Call 288. unsigned char *tmp = NULL; 289. 290. if (!SRP_Verify_A_mod_N(s->srp_ctx.A, s->srp_ctx.N)) ^ 291. goto err; 292. if ((u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) == NULL) crypto/srp/srp_lib.c:274:1: Parameter `A->top` 272. } 273. 274. > int SRP_Verify_A_mod_N(const BIGNUM *A, const BIGNUM *N) 275. { 276. /* Checks if A % N == 0 */ crypto/srp/srp_lib.c:277:12: Call 275. { 276. /* Checks if A % N == 0 */ 277. return SRP_Verify_B_mod_N(A, N); ^ 278. } 279. crypto/srp/srp_lib.c:253:1: Parameter `B->top` 251. } 252. 253. > int SRP_Verify_B_mod_N(const BIGNUM *B, const BIGNUM *N) 254. { 255. BIGNUM *r; ssl/tls_srp.c:292:14: Call 290. if (!SRP_Verify_A_mod_N(s->srp_ctx.A, s->srp_ctx.N)) 291. goto err; 292. if ((u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) == NULL) ^ 293. goto err; 294. if ((K = SRP_Calc_server_key(s->srp_ctx.A, s->srp_ctx.v, u, s->srp_ctx.b, crypto/srp/srp_lib.c:55:1: Parameter `A->top` 53. } 54. 55. > BIGNUM *SRP_Calc_u(const BIGNUM *A, const BIGNUM *B, const BIGNUM *N) 56. { 57. /* k = SHA1(PAD(A) || PAD(B) ) -- tls-srp draft 8 */ ssl/tls_srp.c:294:14: Call 292. if ((u = SRP_Calc_u(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N)) == NULL) 293. goto err; 294. if ((K = SRP_Calc_server_key(s->srp_ctx.A, s->srp_ctx.v, u, s->srp_ctx.b, ^ 295. s->srp_ctx.N)) == NULL) 296. goto err; crypto/srp/srp_lib.c:98:1: Parameter `A->top` 96. } 97. 98. > BIGNUM *SRP_Calc_server_key(const BIGNUM *A, const BIGNUM *v, const BIGNUM *u, 99. const BIGNUM *b, const BIGNUM *N) 100. { crypto/srp/srp_lib.c:114:10: Call 112. if (!BN_mod_exp(tmp, v, u, N, bn_ctx)) 113. goto err; 114. if (!BN_mod_mul(tmp, A, tmp, N, bn_ctx)) ^ 115. goto err; 116. crypto/bn/bn_mod.c:73:1: Parameter `a->top` 71. 72. /* slow but works */ 73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 74. BN_CTX *ctx) 75. { crypto/bn/bn_mod.c:87:14: Call 85. goto err; 86. if (a == b) { 87. if (!BN_sqr(t, a, ctx)) ^ 88. goto err; 89. } else { crypto/bn/bn_sqr.c:17:1: Parameter `a->top` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int max, al; crypto/bn/bn_sqr.c:25:5: Assignment 23. bn_check_top(a); 24. 25. al = a->top; ^ 26. if (al <= 0) { 27. r->top = 0; crypto/bn/bn_sqr.c:74:17: Call 72. if (bn_wexpand(tmp, max) == NULL) 73. goto err; 74. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 75. } 76. } crypto/bn/bn_sqr.c:104:1: <Offset trace> 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:104:1: Parameter `n` 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:110:5: Assignment 108. BN_ULONG *rp; 109. 110. max = n * 2; ^ 111. ap = a; 112. rp = r; crypto/bn/bn_sqr.c:104:1: <Length trace> 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:104:1: Parameter `*r` 102. 103. /* tmp must have 2*n words */ 104. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 105. { 106. int i, j, max; crypto/bn/bn_sqr.c:112:5: Assignment 110. max = n * 2; 111. ap = a; 112. rp = r; ^ 113. rp[0] = rp[max - 1] = 0; 114. rp++; crypto/bn/bn_sqr.c:113:13: Array access: Offset: [31, +oo] Size: [0, 8388607] by call to `SRP_Calc_server_key` 111. ap = a; 112. rp = r; 113. rp[0] = rp[max - 1] = 0; ^ 114. rp++; 115. j = n;
https://github.com/openssl/openssl/blob/4973a60cb92dc121fc09246bff3815afc0f8ab9a/crypto/bn/bn_sqr.c/#L113
d2a_code_trace_data_41834
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:764: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_GF2m_mod_sqr`. Showing all 16 steps of the trace test/bntest.c:761:17: Call 759. BN_bntest_rand(a, 512, 0, 0); 760. for (j = 0; j < 2; j++) { 761. t = BN_GF2m_mod_solve_quad(c, a, b[j], ctx); ^ 762. if (t) { 763. s++; crypto/bn/bn_gf2m.c:1145:1: Parameter `ctx->stack.depth` 1143. * for best performance, use the BN_GF2m_mod_solve_quad_arr function. 1144. */ 1145. > int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 1146. BN_CTX *ctx) 1147. { test/bntest.c:761:17: Call 759. BN_bntest_rand(a, 512, 0, 0); 760. for (j = 0; j < 2; j++) { 761. t = BN_GF2m_mod_solve_quad(c, a, b[j], ctx); ^ 762. if (t) { 763. s++; crypto/bn/bn_gf2m.c:1145:1: Parameter `ctx->stack.depth` 1143. * for best performance, use the BN_GF2m_mod_solve_quad_arr function. 1144. */ 1145. > int BN_GF2m_mod_solve_quad(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 1146. BN_CTX *ctx) 1147. { test/bntest.c:764:17: Call 762. if (t) { 763. s++; 764. BN_GF2m_mod_sqr(d, c, b[j], ctx); ^ 765. BN_GF2m_add(d, c, d); 766. BN_GF2m_mod(e, a, b[j]); crypto/bn/bn_gf2m.c:532:1: Parameter `ctx->stack.depth` 530. * use the BN_GF2m_mod_sqr_arr function. 531. */ 532. > int BN_GF2m_mod_sqr(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) 533. { 534. int ret = 0; crypto/bn/bn_gf2m.c:547:11: Call 545. goto err; 546. } 547. ret = BN_GF2m_mod_sqr_arr(r, a, arr, ctx); ^ 548. bn_check_top(r); 549. err: crypto/bn/bn_gf2m.c:497:1: Parameter `ctx->stack.depth` 495. 496. /* Square a, reduce the result mod p, and store it in a. r could be a. */ 497. > int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[], 498. BN_CTX *ctx) 499. { crypto/bn/bn_gf2m.c:504:5: Call 502. 503. bn_check_top(a); 504. BN_CTX_start(ctx); ^ 505. if ((s = BN_CTX_get(ctx)) == NULL) 506. goto err; crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gf2m.c:522:5: Call 520. ret = 1; 521. err: 522. BN_CTX_end(ctx); ^ 523. return ret; 524. } crypto/bn/bn_ctx.c:195:1: Parameter `ctx->stack.depth` 193. } 194. 195. > void BN_CTX_end(BN_CTX *ctx) 196. { 197. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:201:27: Call 199. ctx->err_stack--; 200. else { 201. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 202. /* Does this stack frame have anything to release? */ 203. if (fp < ctx->used) crypto/bn/bn_ctx.c:271:1: <LHS trace> 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:271:1: Parameter `st->depth` 269. } 270. 271. > static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:273:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_GF2m_mod_sqr` 271. static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; ^ 274. } 275.
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_41835
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { if (!ossl_assert(pkt->subs != NULL && len != 0)) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } if (allocbytes != NULL) *allocbytes = WPACKET_get_curr(pkt); return 1; } ssl/statem/statem_srvr.c:3760: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 4]):unsigned64 by call to `WPACKET_put_bytes__`. Showing all 12 steps of the trace ssl/statem/statem_srvr.c:3751:10: Call 3749. * timeout. 3750. */ 3751. if (!WPACKET_put_bytes_u32(pkt, ^ 3752. (s->hit && !SSL_IS_TLS13(s)) 3753. ? 0 : s->session->timeout)) { ssl/packet.c:309:1: Parameter `pkt->buf->length` 307. } 308. 309. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 310. { 311. unsigned char *data; ssl/statem/statem_srvr.c:3760:14: Call 3758. 3759. if (SSL_IS_TLS13(s)) { 3760. if (!WPACKET_put_bytes_u32(pkt, age_add) ^ 3761. || !WPACKET_sub_memcpy_u8(pkt, tick_nonce, TICKET_NONCE_SIZE)) { 3762. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_CREATE_TICKET_PREQUEL, ssl/packet.c:309:1: Parameter `pkt->written` 307. } 308. 309. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 310. { 311. unsigned char *data; ssl/packet.c:315:17: Call 313. /* Internal API, so should not fail */ 314. if (!ossl_assert(size <= sizeof(unsigned int)) 315. || !WPACKET_allocate_bytes(pkt, size, &data) ^ 316. || !put_value(data, val, size)) 317. return 0; ssl/packet.c:16:1: Parameter `pkt->written` 14. #define DEFAULT_BUF_SIZE 256 15. 16. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 17. { 18. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ssl/packet.c:18:10: Call 16. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 17. { 18. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ^ 19. return 0; 20. ssl/packet.c:40:1: <LHS trace> 38. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 39. 40. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 41. { 42. /* Internal API, so should not fail */ ssl/packet.c:40:1: Parameter `pkt->buf->length` 38. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 39. 40. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 41. { 42. /* Internal API, so should not fail */ ssl/packet.c:40:1: <RHS trace> 38. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 39. 40. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 41. { 42. /* Internal API, so should not fail */ ssl/packet.c:40:1: Parameter `len` 38. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 39. 40. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 41. { 42. /* Internal API, so should not fail */ ssl/packet.c:49:36: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 4]):unsigned64 by call to `WPACKET_put_bytes__` 47. return 0; 48. 49. if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) { ^ 50. size_t newlen; 51. size_t reflen;
https://github.com/openssl/openssl/blob/41145c35bfee8f2b0822288fcb23a807d06d8e89/ssl/packet.c/#L49
d2a_code_trace_data_41836
static ossl_inline void packet_forward(PACKET *pkt, size_t len) { pkt->curr += len; pkt->remaining -= len; } test/packettest.c:161: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 4):unsigned64 by call to `PACKET_get_bytes`. Showing all 10 steps of the trace test/packettest.c:160:10: Call 158. PACKET pkt; 159. 160. if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN)) ^ 161. || !TEST_true(PACKET_get_bytes(&pkt, &bytes, 4)) 162. || !TEST_uchar_eq(bytes[0], 2) ssl/packet_locl.h:72:8: Parameter `pkt->remaining` 70. * is being used. 71. */ 72. __owur static ossl_inline int PACKET_buf_init(PACKET *pkt, ^ 73. const unsigned char *buf, 74. size_t len) test/packettest.c:161:17: Call 159. 160. if (!TEST_true(PACKET_buf_init(&pkt, smbuf, BUF_LEN)) 161. || !TEST_true(PACKET_get_bytes(&pkt, &bytes, 4)) ^ 162. || !TEST_uchar_eq(bytes[0], 2) 163. || !TEST_uchar_eq(bytes[1], 4) ssl/packet_locl.h:350:8: Parameter `len` 348. * freed 349. */ 350. __owur static ossl_inline int PACKET_get_bytes(PACKET *pkt, ^ 351. const unsigned char **data, 352. size_t len) ssl/packet_locl.h:357:5: Call 355. return 0; 356. 357. packet_forward(pkt, len); ^ 358. 359. return 1; ssl/packet_locl.h:33:1: <LHS trace> 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: Parameter `pkt->remaining` 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: <RHS trace> 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:33:1: Parameter `len` 31. 32. /* Internal unchecked shorthand; don't use outside this file. */ 33. > static ossl_inline void packet_forward(PACKET *pkt, size_t len) 34. { 35. pkt->curr += len; ssl/packet_locl.h:36:5: Binary operation: ([0, +oo] - 4):unsigned64 by call to `PACKET_get_bytes` 34. { 35. pkt->curr += len; 36. pkt->remaining -= len; ^ 37. } 38.
https://github.com/openssl/openssl/blob/424aa352458486d67e1e9cd3d3990dc06a60ba4a/ssl/packet_locl.h/#L36
d2a_code_trace_data_41837
static void new_subtitle_stream(AVFormatContext *oc) { AVStream *st; AVCodecContext *subtitle_enc; st = av_new_stream(oc, streamid_map[oc->nb_streams]); if (!st) { fprintf(stderr, "Could not alloc stream\n"); av_exit(1); } avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_SUBTITLE); bitstream_filters[nb_output_files][oc->nb_streams - 1]= subtitle_bitstream_filters; subtitle_bitstream_filters= NULL; subtitle_enc = st->codec; subtitle_enc->codec_type = AVMEDIA_TYPE_SUBTITLE; if(subtitle_codec_tag) subtitle_enc->codec_tag= subtitle_codec_tag; if (subtitle_stream_copy) { st->stream_copy = 1; } else { set_context_opts(avcodec_opts[AVMEDIA_TYPE_SUBTITLE], subtitle_enc, AV_OPT_FLAG_SUBTITLE_PARAM | AV_OPT_FLAG_ENCODING_PARAM); subtitle_enc->codec_id = find_codec_or_die(subtitle_codec_name, AVMEDIA_TYPE_SUBTITLE, 1, subtitle_enc->strict_std_compliance); output_codecs[nb_ocodecs] = avcodec_find_encoder_by_name(subtitle_codec_name); } nb_ocodecs++; 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:3571: error: Null Dereference pointer `st` last assigned on line 3566 could be null and is dereferenced at line 3571, column 35. ffmpeg.c:3561:1: start of procedure new_subtitle_stream() 3559. } 3560. 3561. static void new_subtitle_stream(AVFormatContext *oc) ^ 3562. { 3563. AVStream *st; ffmpeg.c:3566:5: 3564. AVCodecContext *subtitle_enc; 3565. 3566. st = av_new_stream(oc, streamid_map[oc->nb_streams]); ^ 3567. if (!st) { 3568. fprintf(stderr, "Could not alloc stream\n"); libavformat/utils.c:2500:1: start of procedure av_new_stream() 2498. } 2499. 2500. AVStream *av_new_stream(AVFormatContext *s, int id) ^ 2501. { 2502. AVStream *st; libavformat/utils.c:2505:9: Taking true branch 2503. int i; 2504. 2505. if (s->nb_streams >= MAX_STREAMS){ ^ 2506. av_log(s, AV_LOG_ERROR, "Too many streams\n"); 2507. return NULL; libavformat/utils.c:2506:9: Skipping av_log(): empty list of specs 2504. 2505. if (s->nb_streams >= MAX_STREAMS){ 2506. av_log(s, AV_LOG_ERROR, "Too many streams\n"); ^ 2507. return NULL; 2508. } libavformat/utils.c:2507:9: 2505. if (s->nb_streams >= MAX_STREAMS){ 2506. av_log(s, AV_LOG_ERROR, "Too many streams\n"); 2507. return NULL; ^ 2508. } 2509. libavformat/utils.c:2542:1: return from a call to av_new_stream 2540. s->streams[s->nb_streams++] = st; 2541. return st; 2542. } ^ 2543. 2544. AVProgram *av_new_program(AVFormatContext *ac, int id) ffmpeg.c:3567:10: Taking true branch 3565. 3566. st = av_new_stream(oc, streamid_map[oc->nb_streams]); 3567. if (!st) { ^ 3568. fprintf(stderr, "Could not alloc stream\n"); 3569. av_exit(1); ffmpeg.c:3568:9: 3566. st = av_new_stream(oc, streamid_map[oc->nb_streams]); 3567. if (!st) { 3568. fprintf(stderr, "Could not alloc stream\n"); ^ 3569. av_exit(1); 3570. } ffmpeg.c:3569:9: Skipping av_exit(): empty list of specs 3567. if (!st) { 3568. fprintf(stderr, "Could not alloc stream\n"); 3569. av_exit(1); ^ 3570. } 3571. avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_SUBTITLE); ffmpeg.c:3571:5: 3569. av_exit(1); 3570. } 3571. avcodec_get_context_defaults2(st->codec, AVMEDIA_TYPE_SUBTITLE); ^ 3572. 3573. bitstream_filters[nb_output_files][oc->nb_streams - 1]= subtitle_bitstream_filters;
https://github.com/libav/libav/blob/66b84e4ab2fc96222dab32173d84f4a403129deb/ffmpeg.c/#L3571
d2a_code_trace_data_41838
static int do_not_call_session_ticket_cb(SSL *s, unsigned char *key_name, unsigned char *iv, EVP_CIPHER_CTX *ctx, HMAC_CTX *hctx, int enc) { HANDSHAKE_EX_DATA *ex_data = (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); ex_data->session_ticket_do_not_call = 1; return 0; } test/handshake_helper.c:325: error: NULL_DEREFERENCE pointer `ex_data` last assigned on line 323 could be null and is dereferenced at line 325, column 5. Showing all 10 steps of the trace test/handshake_helper.c:318:1: start of procedure do_not_call_session_ticket_cb() 316. } 317. 318. > static int do_not_call_session_ticket_cb(SSL *s, unsigned char *key_name, 319. unsigned char *iv, 320. EVP_CIPHER_CTX *ctx, test/handshake_helper.c:323:5: 321. HMAC_CTX *hctx, int enc) 322. { 323. > HANDSHAKE_EX_DATA *ex_data = 324. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); 325. ex_data->session_ticket_do_not_call = 1; ssl/ssl_lib.c:4014:1: start of procedure SSL_get_ex_data() 4012. } 4013. 4014. > void *SSL_get_ex_data(const SSL *s, int idx) 4015. { 4016. return CRYPTO_get_ex_data(&s->ex_data, idx); ssl/ssl_lib.c:4016:5: 4014. void *SSL_get_ex_data(const SSL *s, int idx) 4015. { 4016. > return CRYPTO_get_ex_data(&s->ex_data, idx); 4017. } 4018. crypto/ex_data.c:393:1: start of procedure CRYPTO_get_ex_data() 391. * particular index in the class used by this variable 392. */ 393. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 394. { 395. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) crypto/ex_data.c:395:9: Taking true branch 393. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 394. { 395. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) ^ 396. return NULL; 397. return sk_void_value(ad->sk, idx); crypto/ex_data.c:396:9: 394. { 395. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) 396. > return NULL; 397. return sk_void_value(ad->sk, idx); 398. } crypto/ex_data.c:398:1: return from a call to CRYPTO_get_ex_data 396. return NULL; 397. return sk_void_value(ad->sk, idx); 398. > } ssl/ssl_lib.c:4017:1: return from a call to SSL_get_ex_data 4015. { 4016. return CRYPTO_get_ex_data(&s->ex_data, idx); 4017. > } 4018. 4019. int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg) test/handshake_helper.c:325:5: 323. HANDSHAKE_EX_DATA *ex_data = 324. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); 325. > ex_data->session_ticket_do_not_call = 1; 326. return 0; 327. }
https://github.com/openssl/openssl/blob/e43e6b1951de931ca500c6964496e76651332f5e/test/handshake_helper.c/#L325
d2a_code_trace_data_41839
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_blind.c:275: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `int_bn_mod_inverse`. Showing all 36 steps of the trace crypto/bn/bn_blind.c:233:1: Parameter `ctx->stack.depth` 231. } 232. 233. > BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, 234. const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, 235. int (*bn_mod_exp) (BIGNUM *r, crypto/bn/bn_blind.c:275:13: Call 273. if (!BN_priv_rand_range(ret->A, ret->mod)) 274. goto err; 275. if (int_bn_mod_inverse(ret->Ai, ret->A, ret->mod, ctx, &rv)) ^ 276. break; 277. crypto/bn/bn_gcd.c:135:1: Parameter `ctx->stack.depth` 133. } 134. 135. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 136. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 137. int *pnoinv) crypto/bn/bn_gcd.c:155:16: Call 153. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) 154. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) { 155. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 156. } 157. crypto/bn/bn_gcd.c:458:1: Parameter `ctx->stack.depth` 456. * not contain branches that may leak sensitive information. 457. */ 458. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 459. const BIGNUM *a, const BIGNUM *n, 460. BN_CTX *ctx) crypto/bn/bn_gcd.c:469:5: Call 467. bn_check_top(n); 468. 469. BN_CTX_start(ctx); ^ 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gcd.c:470:9: Call 468. 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); ^ 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:471:9: Call 469. BN_CTX_start(ctx); 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); ^ 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:472:9: Call 470. A = BN_CTX_get(ctx); 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); ^ 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:473:9: Call 471. B = BN_CTX_get(ctx); 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); ^ 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:474:9: Call 472. X = BN_CTX_get(ctx); 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); ^ 475. Y = BN_CTX_get(ctx); 476. T = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:475:9: Call 473. D = BN_CTX_get(ctx); 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); ^ 476. T = BN_CTX_get(ctx); 477. if (T == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:476:9: Call 474. M = BN_CTX_get(ctx); 475. Y = BN_CTX_get(ctx); 476. T = BN_CTX_get(ctx); ^ 477. if (T == NULL) 478. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gcd.c:504:18: Call 502. bn_init(&local_B); 503. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME); 504. if (!BN_nnmod(B, &local_B, A, ctx)) ^ 505. goto err; 506. /* Ensure local_B goes out of scope before any further use of B */ crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth` 207. * If 'dv' or 'rm' is NULL, the respective value is not returned. 208. */ 209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 210. BN_CTX *ctx) 211. { crypto/bn/bn_div.c:229:11: Call 227. } 228. 229. ret = bn_div_fixed_top(dv, rm, num, divisor, ctx); ^ 230. 231. if (ret) { crypto/bn/bn_div.c:280:5: Call 278. bn_check_top(rm); 279. 280. BN_CTX_start(ctx); ^ 281. res = (dv == NULL) ? BN_CTX_get(ctx) : dv; 282. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_div.c:450:5: Call 448. if (rm != NULL) 449. bn_rshift_fixed_top(rm, snum, norm_shift); 450. BN_CTX_end(ctx); ^ 451. return 1; 452. err: crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `int_bn_mod_inverse` 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_41840
static inline void pred_direct_motion(H264Context * const h, int *mb_type){ MpegEncContext * const s = &h->s; const int mb_xy = s->mb_x + s->mb_y*s->mb_stride; const int b8_xy = 2*s->mb_x + 2*s->mb_y*h->b8_stride; const int b4_xy = 4*s->mb_x + 4*s->mb_y*h->b_stride; const int mb_type_col = h->ref_list[1][0].mb_type[mb_xy]; const int16_t (*l1mv0)[2] = (const int16_t (*)[2]) &h->ref_list[1][0].motion_val[0][b4_xy]; const int16_t (*l1mv1)[2] = (const int16_t (*)[2]) &h->ref_list[1][0].motion_val[1][b4_xy]; const int8_t *l1ref0 = &h->ref_list[1][0].ref_index[0][b8_xy]; const int8_t *l1ref1 = &h->ref_list[1][0].ref_index[1][b8_xy]; const int is_b8x8 = IS_8X8(*mb_type); unsigned int sub_mb_type; int i8, i4; #define MB_TYPE_16x16_OR_INTRA (MB_TYPE_16x16|MB_TYPE_INTRA4x4|MB_TYPE_INTRA16x16|MB_TYPE_INTRA_PCM) if(IS_8X8(mb_type_col) && !h->sps.direct_8x8_inference_flag){ sub_mb_type = MB_TYPE_8x8|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; *mb_type = MB_TYPE_8x8|MB_TYPE_L0L1; }else if(!is_b8x8 && (mb_type_col & MB_TYPE_16x16_OR_INTRA)){ sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; *mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; }else{ sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; *mb_type = MB_TYPE_8x8|MB_TYPE_L0L1; } if(!is_b8x8) *mb_type |= MB_TYPE_DIRECT2; if(MB_FIELD) *mb_type |= MB_TYPE_INTERLACED; tprintf(s->avctx, "mb_type = %08x, sub_mb_type = %08x, is_b8x8 = %d, mb_type_col = %08x\n", *mb_type, sub_mb_type, is_b8x8, mb_type_col); if(h->direct_spatial_mv_pred){ int ref[2]; int mv[2][2]; int list; for(list=0; list<2; list++){ int refa = h->ref_cache[list][scan8[0] - 1]; int refb = h->ref_cache[list][scan8[0] - 8]; int refc = h->ref_cache[list][scan8[0] - 8 + 4]; if(refc == -2) refc = h->ref_cache[list][scan8[0] - 8 - 1]; ref[list] = refa; if(ref[list] < 0 || (refb < ref[list] && refb >= 0)) ref[list] = refb; if(ref[list] < 0 || (refc < ref[list] && refc >= 0)) ref[list] = refc; if(ref[list] < 0) ref[list] = -1; } if(ref[0] < 0 && ref[1] < 0){ ref[0] = ref[1] = 0; mv[0][0] = mv[0][1] = mv[1][0] = mv[1][1] = 0; }else{ for(list=0; list<2; list++){ if(ref[list] >= 0) pred_motion(h, 0, 4, list, ref[list], &mv[list][0], &mv[list][1]); else mv[list][0] = mv[list][1] = 0; } } if(ref[1] < 0){ if(!is_b8x8) *mb_type &= ~MB_TYPE_L1; sub_mb_type &= ~MB_TYPE_L1; }else if(ref[0] < 0){ if(!is_b8x8) *mb_type &= ~MB_TYPE_L0; sub_mb_type &= ~MB_TYPE_L0; } if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col)){ int pair_xy = s->mb_x + (s->mb_y&~1)*s->mb_stride; int mb_types_col[2]; int b8_stride = h->b8_stride; int b4_stride = h->b_stride; *mb_type = (*mb_type & ~MB_TYPE_16x16) | MB_TYPE_8x8; if(IS_INTERLACED(*mb_type)){ mb_types_col[0] = h->ref_list[1][0].mb_type[pair_xy]; mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy+s->mb_stride]; if(s->mb_y&1){ l1ref0 -= 2*b8_stride; l1ref1 -= 2*b8_stride; l1mv0 -= 4*b4_stride; l1mv1 -= 4*b4_stride; } b8_stride *= 3; b4_stride *= 6; }else{ int cur_poc = s->current_picture_ptr->poc; int *col_poc = h->ref_list[1]->field_poc; int col_parity = FFABS(col_poc[0] - cur_poc) >= FFABS(col_poc[1] - cur_poc); int dy = 2*col_parity - (s->mb_y&1); mb_types_col[0] = mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy + col_parity*s->mb_stride]; l1ref0 += dy*b8_stride; l1ref1 += dy*b8_stride; l1mv0 += 2*dy*b4_stride; l1mv1 += 2*dy*b4_stride; b8_stride = 0; } for(i8=0; i8<4; i8++){ int x8 = i8&1; int y8 = i8>>1; int xy8 = x8+y8*b8_stride; int xy4 = 3*x8+y8*b4_stride; int a=0, b=0; if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) continue; h->sub_mb_type[i8] = sub_mb_type; fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1); fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1); if(!IS_INTRA(mb_types_col[y8]) && ( (l1ref0[xy8] == 0 && FFABS(l1mv0[xy4][0]) <= 1 && FFABS(l1mv0[xy4][1]) <= 1) || (l1ref0[xy8] < 0 && l1ref1[xy8] == 0 && FFABS(l1mv1[xy4][0]) <= 1 && FFABS(l1mv1[xy4][1]) <= 1))){ if(ref[0] > 0) a= pack16to32(mv[0][0],mv[0][1]); if(ref[1] > 0) b= pack16to32(mv[1][0],mv[1][1]); }else{ a= pack16to32(mv[0][0],mv[0][1]); b= pack16to32(mv[1][0],mv[1][1]); } fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, a, 4); fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, b, 4); } }else if(IS_16X16(*mb_type)){ int a=0, b=0; fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, (uint8_t)ref[0], 1); fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, (uint8_t)ref[1], 1); if(!IS_INTRA(mb_type_col) && ( (l1ref0[0] == 0 && FFABS(l1mv0[0][0]) <= 1 && FFABS(l1mv0[0][1]) <= 1) || (l1ref0[0] < 0 && l1ref1[0] == 0 && FFABS(l1mv1[0][0]) <= 1 && FFABS(l1mv1[0][1]) <= 1 && (h->x264_build>33 || !h->x264_build)))){ if(ref[0] > 0) a= pack16to32(mv[0][0],mv[0][1]); if(ref[1] > 0) b= pack16to32(mv[1][0],mv[1][1]); }else{ a= pack16to32(mv[0][0],mv[0][1]); b= pack16to32(mv[1][0],mv[1][1]); } fill_rectangle(&h->mv_cache[0][scan8[0]], 4, 4, 8, a, 4); fill_rectangle(&h->mv_cache[1][scan8[0]], 4, 4, 8, b, 4); }else{ for(i8=0; i8<4; i8++){ const int x8 = i8&1; const int y8 = i8>>1; if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) continue; h->sub_mb_type[i8] = sub_mb_type; fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mv[0][0],mv[0][1]), 4); fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mv[1][0],mv[1][1]), 4); fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1); fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1); if(!IS_INTRA(mb_type_col) && ( l1ref0[x8 + y8*h->b8_stride] == 0 || (l1ref0[x8 + y8*h->b8_stride] < 0 && l1ref1[x8 + y8*h->b8_stride] == 0 && (h->x264_build>33 || !h->x264_build)))){ const int16_t (*l1mv)[2]= l1ref0[x8 + y8*h->b8_stride] == 0 ? l1mv0 : l1mv1; if(IS_SUB_8X8(sub_mb_type)){ const int16_t *mv_col = l1mv[x8*3 + y8*3*h->b_stride]; if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){ if(ref[0] == 0) fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4); if(ref[1] == 0) fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4); } }else for(i4=0; i4<4; i4++){ const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*h->b_stride]; if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){ if(ref[0] == 0) *(uint32_t*)h->mv_cache[0][scan8[i8*4+i4]] = 0; if(ref[1] == 0) *(uint32_t*)h->mv_cache[1][scan8[i8*4+i4]] = 0; } } } } } }else{ const int *map_col_to_list0[2] = {h->map_col_to_list0[0], h->map_col_to_list0[1]}; const int *dist_scale_factor = h->dist_scale_factor; if(FRAME_MBAFF){ if(IS_INTERLACED(*mb_type)){ map_col_to_list0[0] = h->map_col_to_list0_field[0]; map_col_to_list0[1] = h->map_col_to_list0_field[1]; dist_scale_factor = h->dist_scale_factor_field; } if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col)){ const int pair_xy = s->mb_x + (s->mb_y&~1)*s->mb_stride; int mb_types_col[2]; int y_shift; *mb_type = MB_TYPE_8x8|MB_TYPE_L0L1 | (is_b8x8 ? 0 : MB_TYPE_DIRECT2) | (*mb_type & MB_TYPE_INTERLACED); sub_mb_type = MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2|MB_TYPE_16x16; if(IS_INTERLACED(*mb_type)){ mb_types_col[0] = h->ref_list[1][0].mb_type[pair_xy]; mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy+s->mb_stride]; if(s->mb_y&1){ l1ref0 -= 2*h->b8_stride; l1ref1 -= 2*h->b8_stride; l1mv0 -= 4*h->b_stride; l1mv1 -= 4*h->b_stride; } y_shift = 0; if( (mb_types_col[0] & MB_TYPE_16x16_OR_INTRA) && (mb_types_col[1] & MB_TYPE_16x16_OR_INTRA) && !is_b8x8) *mb_type |= MB_TYPE_16x8; else *mb_type |= MB_TYPE_8x8; }else{ int dy = (s->mb_y&1) ? 1 : 2; mb_types_col[0] = mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy+s->mb_stride]; l1ref0 += dy*h->b8_stride; l1ref1 += dy*h->b8_stride; l1mv0 += 2*dy*h->b_stride; l1mv1 += 2*dy*h->b_stride; y_shift = 2; if((mb_types_col[0] & (MB_TYPE_16x16_OR_INTRA|MB_TYPE_16x8)) && !is_b8x8) *mb_type |= MB_TYPE_16x16; else *mb_type |= MB_TYPE_8x8; } for(i8=0; i8<4; i8++){ const int x8 = i8&1; const int y8 = i8>>1; int ref0, scale; const int16_t (*l1mv)[2]= l1mv0; if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) continue; h->sub_mb_type[i8] = sub_mb_type; fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, 0, 1); if(IS_INTRA(mb_types_col[y8])){ fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, 0, 1); fill_rectangle(&h-> mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4); fill_rectangle(&h-> mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4); continue; } ref0 = l1ref0[x8 + (y8*2>>y_shift)*h->b8_stride]; if(ref0 >= 0) ref0 = map_col_to_list0[0][ref0*2>>y_shift]; else{ ref0 = map_col_to_list0[1][l1ref1[x8 + (y8*2>>y_shift)*h->b8_stride]*2>>y_shift]; l1mv= l1mv1; } scale = dist_scale_factor[ref0]; fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1); { const int16_t *mv_col = l1mv[x8*3 + (y8*6>>y_shift)*h->b_stride]; int my_col = (mv_col[1]<<y_shift)/2; int mx = (scale * mv_col[0] + 128) >> 8; int my = (scale * my_col + 128) >> 8; fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mx,my), 4); fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mx-mv_col[0],my-my_col), 4); } } return; } } if(IS_16X16(*mb_type)){ int ref, mv0, mv1; fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, 0, 1); if(IS_INTRA(mb_type_col)){ ref=mv0=mv1=0; }else{ const int ref0 = l1ref0[0] >= 0 ? map_col_to_list0[0][l1ref0[0]] : map_col_to_list0[1][l1ref1[0]]; const int scale = dist_scale_factor[ref0]; const int16_t *mv_col = l1ref0[0] >= 0 ? l1mv0[0] : l1mv1[0]; int mv_l0[2]; mv_l0[0] = (scale * mv_col[0] + 128) >> 8; mv_l0[1] = (scale * mv_col[1] + 128) >> 8; ref= ref0; mv0= pack16to32(mv_l0[0],mv_l0[1]); mv1= pack16to32(mv_l0[0]-mv_col[0],mv_l0[1]-mv_col[1]); } fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, ref, 1); fill_rectangle(&h-> mv_cache[0][scan8[0]], 4, 4, 8, mv0, 4); fill_rectangle(&h-> mv_cache[1][scan8[0]], 4, 4, 8, mv1, 4); }else{ for(i8=0; i8<4; i8++){ const int x8 = i8&1; const int y8 = i8>>1; int ref0, scale; const int16_t (*l1mv)[2]= l1mv0; if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) continue; h->sub_mb_type[i8] = sub_mb_type; fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, 0, 1); if(IS_INTRA(mb_type_col)){ fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, 0, 1); fill_rectangle(&h-> mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4); fill_rectangle(&h-> mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4); continue; } ref0 = l1ref0[x8 + y8*h->b8_stride]; if(ref0 >= 0) ref0 = map_col_to_list0[0][ref0]; else{ ref0 = map_col_to_list0[1][l1ref1[x8 + y8*h->b8_stride]]; l1mv= l1mv1; } scale = dist_scale_factor[ref0]; fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1); if(IS_SUB_8X8(sub_mb_type)){ const int16_t *mv_col = l1mv[x8*3 + y8*3*h->b_stride]; int mx = (scale * mv_col[0] + 128) >> 8; int my = (scale * mv_col[1] + 128) >> 8; fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mx,my), 4); fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mx-mv_col[0],my-mv_col[1]), 4); }else for(i4=0; i4<4; i4++){ const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*h->b_stride]; int16_t *mv_l0 = h->mv_cache[0][scan8[i8*4+i4]]; mv_l0[0] = (scale * mv_col[0] + 128) >> 8; mv_l0[1] = (scale * mv_col[1] + 128) >> 8; *(uint32_t*)h->mv_cache[1][scan8[i8*4+i4]] = pack16to32(mv_l0[0]-mv_col[0],mv_l0[1]-mv_col[1]); } } } } } libavcodec/h264.c:1084: error: Uninitialized Value The value read from ref[_] was never initialized. libavcodec/h264.c:1084:24: 1082. && ( (l1ref0[xy8] == 0 && FFABS(l1mv0[xy4][0]) <= 1 && FFABS(l1mv0[xy4][1]) <= 1) 1083. || (l1ref0[xy8] < 0 && l1ref1[xy8] == 0 && FFABS(l1mv1[xy4][0]) <= 1 && FFABS(l1mv1[xy4][1]) <= 1))){ 1084. if(ref[0] > 0) ^ 1085. a= pack16to32(mv[0][0],mv[0][1]); 1086. if(ref[1] > 0)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L1084
d2a_code_trace_data_41841
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:299: error: Null Dereference pointer `smk->mclr_tbl` last assigned on line 298 could be null and is dereferenced at line 299, 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 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: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 {
https://github.com/libav/libav/blob/33bb63cb3e1de6d78c475cf14384089ef3f1867d/libavcodec/smacker.c/#L299
d2a_code_trace_data_41842
int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w) { return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0)); } test/ec_internal_test.c:34: error: BUFFER_OVERRUN_L3 Offset: 0 Size: [0, 8388607] by call to `BN_is_one`. Showing all 11 steps of the trace test/ec_internal_test.c:29:9: Call 27. 28. BN_CTX_start(ctx); 29. a = BN_CTX_get(ctx); ^ 30. b = BN_CTX_get(ctx); 31. if (!TEST_ptr(c = BN_CTX_get(ctx)) crypto/bn/bn_ctx.c:229:5: Call 227. } 228. /* OK, make sure the returned bignum is "zero" */ 229. BN_zero(ret); ^ 230. ctx->used++; 231. CTXDBG_RET(ctx, ret); crypto/bn/bn_lib.c:359:1: Parameter `*a->d` 357. } 358. 359. > int BN_set_word(BIGNUM *a, BN_ULONG w) 360. { 361. bn_check_top(a); crypto/bn/bn_lib.c:362:9: Call 360. { 361. bn_check_top(a); 362. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 363. return 0; 364. a->neg = 0; crypto/bn/bn_lcl.h:660:1: Parameter `*a->d` 658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 659. 660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 661. { 662. if (bits > (INT_MAX - BN_BITS2 + 1)) test/ec_internal_test.c:34:13: Call 32. /* 1/1 = 1 */ 33. || !TEST_true(group->meth->field_inv(group, b, BN_value_one(), ctx)) 34. || !TEST_true(BN_is_one(b)) ^ 35. /* (1/a)*a = 1 */ 36. || !TEST_true(BN_pseudo_rand(a, BN_num_bits(group->field) - 1, crypto/bn/bn_lib.c:848:1: Parameter `*a->d` 846. } 847. 848. > int BN_is_one(const BIGNUM *a) 849. { 850. return BN_abs_is_word(a, 1) && !a->neg; crypto/bn/bn_lib.c:850:12: Call 848. int BN_is_one(const BIGNUM *a) 849. { 850. return BN_abs_is_word(a, 1) && !a->neg; ^ 851. } 852. crypto/bn/bn_lib.c:838:1: <Length trace> 836. } 837. 838. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w) 839. { 840. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0)); crypto/bn/bn_lib.c:838:1: Parameter `*a->d` 836. } 837. 838. > int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w) 839. { 840. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0)); crypto/bn/bn_lib.c:840:31: Array access: Offset: 0 Size: [0, 8388607] by call to `BN_is_one` 838. int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w) 839. { 840. return ((a->top == 1) && (a->d[0] == w)) || ((w == 0) && (a->top == 0)); ^ 841. } 842.
https://github.com/openssl/openssl/blob/8f58ede09572dcc6a7e6c01280dd348240199568/crypto/bn/bn_lib.c/#L840
d2a_code_trace_data_41843
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; } ssl/statem/statem_srvr.c:3314: error: INTEGER_OVERFLOW_L2 (0 - [-oo, 65280]):unsigned64 by call to `EVP_EncryptUpdate`. Showing all 9 steps of the trace ssl/statem/statem_srvr.c:3208:17: Call 3206. 3207. /* get session encoding length */ 3208. slen_full = i2d_SSL_SESSION(s->session, NULL); ^ 3209. /* 3210. * Some length values are 16 bits, so forget it if session is too ssl/ssl_asn1.c:147:9: Assignment 145. 146. if ((in == NULL) || ((in->cipher == NULL) && (in->cipher_id == 0))) 147. return 0; ^ 148. 149. memset(&as, 0, sizeof(as)); ssl/statem/statem_srvr.c:3208:5: Assignment 3206. 3207. /* get session encoding length */ 3208. slen_full = i2d_SSL_SESSION(s->session, NULL); ^ 3209. /* 3210. * Some length values are 16 bits, so forget it if session is too ssl/statem/statem_srvr.c:3314:17: Call 3312. &encdata1) 3313. /* Encrypt session data */ 3314. || !EVP_EncryptUpdate(ctx, encdata1, &len, senc, slen) ^ 3315. || !WPACKET_allocate_bytes(pkt, len, &encdata2) 3316. || encdata1 != encdata2 crypto/evp/evp_enc.c:293:1: Parameter `inl` 291. } 292. 293. > int EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out, int *outl, 294. const unsigned char *in, int inl) 295. { crypto/evp/evp_enc.c:302:24: Call 300. if (ctx->cipher->flags & EVP_CIPH_FLAG_CUSTOM_CIPHER) { 301. /* If block size > 1 then the cipher will have to do this check */ 302. if (bl == 1 && is_partially_overlapping(out, in, inl)) { ^ 303. EVPerr(EVP_F_EVP_ENCRYPTUPDATE, EVP_R_PARTIALLY_OVERLAPPING); 304. 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, 65280]):unsigned64 by call to `EVP_EncryptUpdate` 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_41844
void ff_MPV_frame_end(MpegEncContext *s) { int i; if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) { ff_xvmc_field_end(s); } else if ((s->er.error_count || s->encoding) && !s->avctx->hwaccel && s->unrestricted_mv && s->current_picture.reference && !s->intra_only && !(s->flags & CODEC_FLAG_EMU_EDGE)) { const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); int hshift = desc->log2_chroma_w; int vshift = desc->log2_chroma_h; s->dsp.draw_edges(s->current_picture.f.data[0], s->linesize, s->h_edge_pos, s->v_edge_pos, EDGE_WIDTH, EDGE_WIDTH, EDGE_TOP | EDGE_BOTTOM); s->dsp.draw_edges(s->current_picture.f.data[1], s->uvlinesize, s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_TOP | EDGE_BOTTOM); s->dsp.draw_edges(s->current_picture.f.data[2], s->uvlinesize, s->h_edge_pos >> hshift, s->v_edge_pos >> vshift, EDGE_WIDTH >> hshift, EDGE_WIDTH >> vshift, EDGE_TOP | EDGE_BOTTOM); } emms_c(); s->last_pict_type = s->pict_type; s->last_lambda_for [s->pict_type] = s->current_picture_ptr->f.quality; if (s->pict_type!= AV_PICTURE_TYPE_B) { s->last_non_b_pict_type = s->pict_type; } #if 0 for (i = 0; i < MAX_PICTURE_COUNT; i++) { if (s->picture[i].f.data[0] == s->current_picture.f.data[0]) { s->picture[i] = s->current_picture; break; } } assert(i < MAX_PICTURE_COUNT); #endif if (s->encoding) { for (i = 0; i < MAX_PICTURE_COUNT; i++) { if (!s->picture[i].reference) ff_mpeg_unref_picture(s, &s->picture[i]); } } #if 0 memset(&s->last_picture, 0, sizeof(Picture)); memset(&s->next_picture, 0, sizeof(Picture)); memset(&s->current_picture, 0, sizeof(Picture)); #endif s->avctx->coded_frame = &s->current_picture_ptr->f; if (s->current_picture.reference) ff_thread_report_progress(&s->current_picture_ptr->tf, INT_MAX, 0); } libavcodec/mpegvideo.c:1699: error: Null Dereference pointer `desc` last assigned on line 1698 could be null and is dereferenced at line 1699, column 21. libavcodec/mpegvideo.c:1685:1: start of procedure ff_MPV_frame_end() 1683. /* generic function for encode/decode called after a 1684. * frame has been coded/decoded. */ 1685. void ff_MPV_frame_end(MpegEncContext *s) ^ 1686. { 1687. int i; libavcodec/mpegvideo.c:1690:9: Taking false branch 1688. /* redraw edges for the frame if decoding didn't complete */ 1689. // just to make sure that all data is rendered. 1690. if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) { ^ 1691. ff_xvmc_field_end(s); 1692. } else if ((s->er.error_count || s->encoding) && libavcodec/mpegvideo.c:1692:16: Taking false branch 1690. if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) { 1691. ff_xvmc_field_end(s); 1692. } else if ((s->er.error_count || s->encoding) && ^ 1693. !s->avctx->hwaccel && 1694. s->unrestricted_mv && libavcodec/mpegvideo.c:1692:37: Taking true branch 1690. if (CONFIG_MPEG_XVMC_DECODER && s->avctx->xvmc_acceleration) { 1691. ff_xvmc_field_end(s); 1692. } else if ((s->er.error_count || s->encoding) && ^ 1693. !s->avctx->hwaccel && 1694. s->unrestricted_mv && libavcodec/mpegvideo.c:1693:16: Taking true branch 1691. ff_xvmc_field_end(s); 1692. } else if ((s->er.error_count || s->encoding) && 1693. !s->avctx->hwaccel && ^ 1694. s->unrestricted_mv && 1695. s->current_picture.reference && libavcodec/mpegvideo.c:1694:15: Taking true branch 1692. } else if ((s->er.error_count || s->encoding) && 1693. !s->avctx->hwaccel && 1694. s->unrestricted_mv && ^ 1695. s->current_picture.reference && 1696. !s->intra_only && libavcodec/mpegvideo.c:1695:15: Taking true branch 1693. !s->avctx->hwaccel && 1694. s->unrestricted_mv && 1695. s->current_picture.reference && ^ 1696. !s->intra_only && 1697. !(s->flags & CODEC_FLAG_EMU_EDGE)) { libavcodec/mpegvideo.c:1696:16: Taking true branch 1694. s->unrestricted_mv && 1695. s->current_picture.reference && 1696. !s->intra_only && ^ 1697. !(s->flags & CODEC_FLAG_EMU_EDGE)) { 1698. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); libavcodec/mpegvideo.c:1697:17: Taking true branch 1695. s->current_picture.reference && 1696. !s->intra_only && 1697. !(s->flags & CODEC_FLAG_EMU_EDGE)) { ^ 1698. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); 1699. int hshift = desc->log2_chroma_w; libavcodec/mpegvideo.c:1698:8: 1696. !s->intra_only && 1697. !(s->flags & CODEC_FLAG_EMU_EDGE)) { 1698. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); ^ 1699. int hshift = desc->log2_chroma_w; 1700. int vshift = desc->log2_chroma_h; libavutil/pixdesc.c:1504:1: start of procedure av_pix_fmt_desc_get() 1502. } 1503. 1504. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) ^ 1505. { 1506. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) libavutil/pixdesc.c:1506:9: Taking false branch 1504. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1505. { 1506. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1507. return NULL; 1508. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1506:24: Taking true branch 1504. const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt) 1505. { 1506. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) ^ 1507. return NULL; 1508. return &av_pix_fmt_descriptors[pix_fmt]; libavutil/pixdesc.c:1507:9: 1505. { 1506. if (pix_fmt < 0 || pix_fmt >= AV_PIX_FMT_NB) 1507. return NULL; ^ 1508. return &av_pix_fmt_descriptors[pix_fmt]; 1509. } libavutil/pixdesc.c:1509:1: return from a call to av_pix_fmt_desc_get 1507. return NULL; 1508. return &av_pix_fmt_descriptors[pix_fmt]; 1509. } ^ 1510. 1511. const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev) libavcodec/mpegvideo.c:1699:8: 1697. !(s->flags & CODEC_FLAG_EMU_EDGE)) { 1698. const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->avctx->pix_fmt); 1699. int hshift = desc->log2_chroma_w; ^ 1700. int vshift = desc->log2_chroma_h; 1701. s->dsp.draw_edges(s->current_picture.f.data[0], s->linesize,
https://github.com/libav/libav/blob/72072bf9de3241848ea86f68d2297b7a5d6ad49b/libavcodec/mpegvideo.c/#L1699
d2a_code_trace_data_41845
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_gf2m.c:870: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_GF2m_mod_arr`. Showing all 16 steps of the trace crypto/bn/bn_gf2m.c:867:14: Call 865. 866. BN_CTX_start(ctx); 867. if ((u = BN_CTX_get(ctx)) == NULL) ^ 868. goto err; 869. 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_gf2m.c:870:10: Call 868. goto err; 869. 870. if (!BN_GF2m_mod_arr(u, a, p)) ^ 871. goto err; 872. crypto/bn/bn_gf2m.c:292:1: Parameter `*r->d` 290. 291. /* Performs modular reduction of a and store result in r. r could be a. */ 292. > int BN_GF2m_mod_arr(BIGNUM *r, const BIGNUM *a, const int p[]) 293. { 294. int j, k; crypto/bn/bn_gf2m.c:311:14: Call 309. */ 310. if (a != r) { 311. if (!bn_wexpand(r, a->top)) ^ 312. return 0; 313. for (j = 0; j < a->top; j++) { crypto/bn/bn_lib.c:960:1: Parameter `*a->d` 958. } 959. 960. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 961. { 962. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:962:37: Call 960. BIGNUM *bn_wexpand(BIGNUM *a, int words) 961. { 962. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 963. } 964. crypto/bn/bn_lib.c:245:1: Parameter `*b->d` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `*b->d` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_GF2m_mod_arr` 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_41846
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) { int i, j, max; const BN_ULONG *ap; BN_ULONG *rp; max = n * 2; ap = a; rp = r; rp[0] = rp[max - 1] = 0; rp++; j = n; if (--j > 0) { ap++; rp[j] = bn_mul_words(rp, ap, j, ap[-1]); rp += 2; } for (i = n - 2; i > 0; i--) { j--; ap++; rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]); rp += 2; } bn_add_words(r, r, r, max); bn_sqr_words(tmp, a, n); bn_add_words(r, r, tmp, max); } test/rsa_mp_test.c:205: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `RSA_check_key_ex`. Showing all 20 steps of the trace test/rsa_mp_test.c:201:12: Call 199. if (!TEST_ptr(key)) 200. goto err; 201. clen = key2048p3(key); ^ 202. if (!TEST_int_eq(clen, 256)) 203. goto err; test/rsa_mp_test.c:136:10: Call 134. int rv = 256; /* public key length */ 135. 136. if (!TEST_int_eq(RSA_set0_key(key, ^ 137. BN_bin2bn(n, sizeof(n) - 1, NULL), 138. BN_bin2bn(e, sizeof(e) - 1, NULL), crypto/bn/bn_lib.c:399:1: Parameter `ret->top` 397. } 398. 399. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) 400. { 401. unsigned int i, m; test/rsa_mp_test.c:205:10: Call 203. goto err; 204. 205. if (!TEST_true(RSA_check_key_ex(key, NULL))) ^ 206. goto err; 207. crypto/rsa/rsa_chk.c:19:1: Parameter `key->d->top` 17. } 18. 19. > int RSA_check_key_ex(const RSA *key, BN_GENCB *cb) 20. { 21. BIGNUM *i, *j, *k, *l, *m; 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:73:1: Parameter `a->top` 71. 72. /* slow but works */ 73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 74. BN_CTX *ctx) 75. { crypto/bn/bn_mod.c:87:14: Call 85. goto err; 86. if (a == b) { 87. if (!BN_sqr(t, a, ctx)) ^ 88. goto err; 89. } else { crypto/bn/bn_sqr.c:17:1: Parameter `a->top` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int max, al; crypto/bn/bn_sqr.c:25:5: Assignment 23. bn_check_top(a); 24. 25. al = a->top; ^ 26. if (al <= 0) { 27. r->top = 0; crypto/bn/bn_sqr.c:74:17: Call 72. if (bn_wexpand(tmp, max) == NULL) 73. goto err; 74. bn_sqr_normal(rr->d, a->d, al, tmp->d); ^ 75. } 76. } crypto/bn/bn_sqr.c:105:1: <Offset trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `n` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:116:5: Assignment 114. rp[0] = rp[max - 1] = 0; 115. rp++; 116. j = n; ^ 117. 118. if (--j > 0) { crypto/bn/bn_sqr.c:118:9: Assignment 116. j = n; 117. 118. if (--j > 0) { ^ 119. ap++; 120. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); crypto/bn/bn_sqr.c:105:1: <Length trace> 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:105:1: Parameter `*r` 103. 104. /* tmp must have 2*n words */ 105. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 106. { 107. int i, j, max; crypto/bn/bn_sqr.c:113:5: Assignment 111. max = n * 2; 112. ap = a; 113. rp = r; ^ 114. rp[0] = rp[max - 1] = 0; 115. rp++; crypto/bn/bn_sqr.c:115:5: Assignment 113. rp = r; 114. rp[0] = rp[max - 1] = 0; 115. rp++; ^ 116. j = n; 117. crypto/bn/bn_sqr.c:120:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `RSA_check_key_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/92b1b9a8871530f26ef7df972111297ffa721be2/crypto/bn/bn_sqr.c/#L120
d2a_code_trace_data_41847
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:1060: error: Uninitialized Value The value read from ymax was never initialized. libavcodec/motion_est_template.c:1060:9: 1058. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1) 1059. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)-1, (P_MEDIAN[1]>>shift) ) 1060. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift)+1, (P_MEDIAN[1]>>shift) ) ^ 1061. CHECK_CLIPPED_MV((last_mv[ref_mv_xy][0]*ref_mv_scale + (1<<15))>>16, 1062. (last_mv[ref_mv_xy][1]*ref_mv_scale + (1<<15))>>16)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1060
d2a_code_trace_data_41848
static int estimate_best_b_count(MpegEncContext *s) { AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id); AVCodecContext *c = avcodec_alloc_context3(NULL); const int scale = s->avctx->brd_scale; int i, j, out_size, p_lambda, b_lambda, lambda2; int64_t best_rd = INT64_MAX; int best_b_count = -1; assert(scale >= 0 && scale <= 3); p_lambda = s->last_lambda_for[AV_PICTURE_TYPE_P]; b_lambda = s->last_lambda_for[AV_PICTURE_TYPE_B]; if (!b_lambda) b_lambda = p_lambda; lambda2 = (b_lambda * b_lambda + (1 << FF_LAMBDA_SHIFT) / 2) >> FF_LAMBDA_SHIFT; c->width = s->width >> scale; c->height = s->height >> scale; c->flags = CODEC_FLAG_QSCALE | CODEC_FLAG_PSNR; c->flags |= s->avctx->flags & CODEC_FLAG_QPEL; c->mb_decision = s->avctx->mb_decision; c->me_cmp = s->avctx->me_cmp; c->mb_cmp = s->avctx->mb_cmp; c->me_sub_cmp = s->avctx->me_sub_cmp; c->pix_fmt = AV_PIX_FMT_YUV420P; c->time_base = s->avctx->time_base; c->max_b_frames = s->max_b_frames; if (avcodec_open2(c, codec, NULL) < 0) return -1; for (i = 0; i < s->max_b_frames + 2; i++) { Picture pre_input, *pre_input_ptr = i ? s->input_picture[i - 1] : s->next_picture_ptr; if (pre_input_ptr && (!i || s->input_picture[i - 1])) { pre_input = *pre_input_ptr; if (!pre_input.shared && i) { pre_input.f->data[0] += INPLACE_OFFSET; pre_input.f->data[1] += INPLACE_OFFSET; pre_input.f->data[2] += INPLACE_OFFSET; } s->dsp.shrink[scale](s->tmp_frames[i]->data[0], s->tmp_frames[i]->linesize[0], pre_input.f->data[0], pre_input.f->linesize[0], c->width, c->height); s->dsp.shrink[scale](s->tmp_frames[i]->data[1], s->tmp_frames[i]->linesize[1], pre_input.f->data[1], pre_input.f->linesize[1], c->width >> 1, c->height >> 1); s->dsp.shrink[scale](s->tmp_frames[i]->data[2], s->tmp_frames[i]->linesize[2], pre_input.f->data[2], pre_input.f->linesize[2], c->width >> 1, c->height >> 1); } } for (j = 0; j < s->max_b_frames + 1; j++) { int64_t rd = 0; if (!s->input_picture[j]) break; c->error[0] = c->error[1] = c->error[2] = 0; s->tmp_frames[0]->pict_type = AV_PICTURE_TYPE_I; s->tmp_frames[0]->quality = 1 * FF_QP2LAMBDA; out_size = encode_frame(c, s->tmp_frames[0]); for (i = 0; i < s->max_b_frames + 1; i++) { int is_p = i % (j + 1) == j || i == s->max_b_frames; s->tmp_frames[i + 1]->pict_type = is_p ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_B; s->tmp_frames[i + 1]->quality = is_p ? p_lambda : b_lambda; out_size = encode_frame(c, s->tmp_frames[i + 1]); rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3); } while (out_size) { out_size = encode_frame(c, NULL); rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3); } rd += c->error[0] + c->error[1] + c->error[2]; if (rd < best_rd) { best_rd = rd; best_b_count = j; } } avcodec_close(c); av_freep(&c); return best_b_count; } libavcodec/mpegvideo_enc.c:1099: error: Null Dereference pointer `c` last assigned on line 1081 could be null and is dereferenced at line 1099, column 5. libavcodec/mpegvideo_enc.c:1078:1: start of procedure estimate_best_b_count() 1076. } 1077. 1078. static int estimate_best_b_count(MpegEncContext *s) ^ 1079. { 1080. AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id); libavcodec/mpegvideo_enc.c:1080:5: 1078. static int estimate_best_b_count(MpegEncContext *s) 1079. { 1080. AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id); ^ 1081. AVCodecContext *c = avcodec_alloc_context3(NULL); 1082. const int scale = s->avctx->brd_scale; libavcodec/utils.c:1745:1: start of procedure avcodec_find_encoder() 1743. } 1744. 1745. AVCodec *avcodec_find_encoder(enum AVCodecID id) ^ 1746. { 1747. return find_encdec(id, 1); libavcodec/utils.c:1747:5: Skipping find_encdec(): empty list of specs 1745. AVCodec *avcodec_find_encoder(enum AVCodecID id) 1746. { 1747. return find_encdec(id, 1); ^ 1748. } 1749. libavcodec/utils.c:1748:1: return from a call to avcodec_find_encoder 1746. { 1747. return find_encdec(id, 1); 1748. } ^ 1749. 1750. AVCodec *avcodec_find_encoder_by_name(const char *name) libavcodec/mpegvideo_enc.c:1081:5: 1079. { 1080. AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id); 1081. AVCodecContext *c = avcodec_alloc_context3(NULL); ^ 1082. const int scale = s->avctx->brd_scale; 1083. int i, j, out_size, p_lambda, b_lambda, lambda2; libavcodec/options.c:124:1: start of procedure avcodec_alloc_context3() 122. } 123. 124. AVCodecContext *avcodec_alloc_context3(const AVCodec *codec) ^ 125. { 126. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); libavcodec/options.c:126:5: 124. AVCodecContext *avcodec_alloc_context3(const AVCodec *codec) 125. { 126. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); ^ 127. 128. if(avctx==NULL) return NULL; libavutil/mem.c:62:1: start of procedure av_malloc() 60. * linker will do it automatically. */ 61. 62. void *av_malloc(size_t size) ^ 63. { 64. void *ptr = NULL; libavutil/mem.c:64:5: 62. void *av_malloc(size_t size) 63. { 64. void *ptr = NULL; ^ 65. #if CONFIG_MEMALIGN_HACK 66. long diff; libavutil/mem.c:70:9: Taking false branch 68. 69. /* let's disallow possibly ambiguous cases */ 70. if (size > (INT_MAX - 32) || !size) ^ 71. return NULL; 72. libavutil/mem.c:70:35: Taking false branch 68. 69. /* let's disallow possibly ambiguous cases */ 70. if (size > (INT_MAX - 32) || !size) ^ 71. return NULL; 72. libavutil/mem.c:81:9: Taking false branch 79. ((char *)ptr)[-1] = diff; 80. #elif HAVE_POSIX_MEMALIGN 81. if (posix_memalign(&ptr, 32, size)) ^ 82. ptr = NULL; 83. #elif HAVE_ALIGNED_MALLOC 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:128:8: Taking true branch 126. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); 127. 128. if(avctx==NULL) return NULL; ^ 129. 130. if(avcodec_get_context_defaults3(avctx, codec) < 0){ libavcodec/options.c:128:21: 126. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); 127. 128. if(avctx==NULL) return NULL; ^ 129. 130. if(avcodec_get_context_defaults3(avctx, codec) < 0){ libavcodec/options.c:136:1: return from a call to avcodec_alloc_context3 134. 135. return avctx; 136. } ^ 137. 138. void avcodec_free_context(AVCodecContext **pavctx) libavcodec/mpegvideo_enc.c:1082:5: 1080. AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id); 1081. AVCodecContext *c = avcodec_alloc_context3(NULL); 1082. const int scale = s->avctx->brd_scale; ^ 1083. int i, j, out_size, p_lambda, b_lambda, lambda2; 1084. int64_t best_rd = INT64_MAX; libavcodec/mpegvideo_enc.c:1084:5: 1082. const int scale = s->avctx->brd_scale; 1083. int i, j, out_size, p_lambda, b_lambda, lambda2; 1084. int64_t best_rd = INT64_MAX; ^ 1085. int best_b_count = -1; 1086. libavcodec/mpegvideo_enc.c:1085:5: 1083. int i, j, out_size, p_lambda, b_lambda, lambda2; 1084. int64_t best_rd = INT64_MAX; 1085. int best_b_count = -1; ^ 1086. 1087. assert(scale >= 0 && scale <= 3); libavcodec/mpegvideo_enc.c:1087:5: 1085. int best_b_count = -1; 1086. 1087. assert(scale >= 0 && scale <= 3); ^ 1088. 1089. //emms_c(); libavcodec/mpegvideo_enc.c:1091:5: 1089. //emms_c(); 1090. //s->next_picture_ptr->quality; 1091. p_lambda = s->last_lambda_for[AV_PICTURE_TYPE_P]; ^ 1092. //p_lambda * FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; 1093. b_lambda = s->last_lambda_for[AV_PICTURE_TYPE_B]; libavcodec/mpegvideo_enc.c:1093:5: 1091. p_lambda = s->last_lambda_for[AV_PICTURE_TYPE_P]; 1092. //p_lambda * FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; 1093. b_lambda = s->last_lambda_for[AV_PICTURE_TYPE_B]; ^ 1094. if (!b_lambda) // FIXME we should do this somewhere else 1095. b_lambda = p_lambda; libavcodec/mpegvideo_enc.c:1094:10: Taking false branch 1092. //p_lambda * FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; 1093. b_lambda = s->last_lambda_for[AV_PICTURE_TYPE_B]; 1094. if (!b_lambda) // FIXME we should do this somewhere else ^ 1095. b_lambda = p_lambda; 1096. lambda2 = (b_lambda * b_lambda + (1 << FF_LAMBDA_SHIFT) / 2) >> libavcodec/mpegvideo_enc.c:1096:5: 1094. if (!b_lambda) // FIXME we should do this somewhere else 1095. b_lambda = p_lambda; 1096. lambda2 = (b_lambda * b_lambda + (1 << FF_LAMBDA_SHIFT) / 2) >> ^ 1097. FF_LAMBDA_SHIFT; 1098. libavcodec/mpegvideo_enc.c:1099:5: 1097. FF_LAMBDA_SHIFT; 1098. 1099. c->width = s->width >> scale; ^ 1100. c->height = s->height >> scale; 1101. c->flags = CODEC_FLAG_QSCALE | CODEC_FLAG_PSNR;
https://github.com/libav/libav/blob/d6d767d93e532246cacf3567e6bcad76a821f838/libavcodec/mpegvideo_enc.c/#L1099
d2a_code_trace_data_41849
static void pred8x8l_horizontal_up_c(uint8_t *src, int has_topleft, int has_topright, int stride) { PREDICT_8x8_LOAD_LEFT; SRC(0,0)= (l0 + l1 + 1) >> 1; SRC(1,0)= (l0 + 2*l1 + l2 + 2) >> 2; SRC(0,1)=SRC(2,0)= (l1 + l2 + 1) >> 1; SRC(1,1)=SRC(3,0)= (l1 + 2*l2 + l3 + 2) >> 2; SRC(0,2)=SRC(2,1)=SRC(4,0)= (l2 + l3 + 1) >> 1; SRC(1,2)=SRC(3,1)=SRC(5,0)= (l2 + 2*l3 + l4 + 2) >> 2; SRC(0,3)=SRC(2,2)=SRC(4,1)=SRC(6,0)= (l3 + l4 + 1) >> 1; SRC(1,3)=SRC(3,2)=SRC(5,1)=SRC(7,0)= (l3 + 2*l4 + l5 + 2) >> 2; SRC(0,4)=SRC(2,3)=SRC(4,2)=SRC(6,1)= (l4 + l5 + 1) >> 1; SRC(1,4)=SRC(3,3)=SRC(5,2)=SRC(7,1)= (l4 + 2*l5 + l6 + 2) >> 2; SRC(0,5)=SRC(2,4)=SRC(4,3)=SRC(6,2)= (l5 + l6 + 1) >> 1; SRC(1,5)=SRC(3,4)=SRC(5,3)=SRC(7,2)= (l5 + 2*l6 + l7 + 2) >> 2; SRC(0,6)=SRC(2,5)=SRC(4,4)=SRC(6,3)= (l6 + l7 + 1) >> 1; SRC(1,6)=SRC(3,5)=SRC(5,4)=SRC(7,3)= (l6 + 3*l7 + 2) >> 2; SRC(0,7)=SRC(1,7)=SRC(2,6)=SRC(2,7)=SRC(3,6)= SRC(3,7)=SRC(4,5)=SRC(4,6)=SRC(4,7)=SRC(5,5)= SRC(5,6)=SRC(5,7)=SRC(6,4)=SRC(6,5)=SRC(6,6)= SRC(6,7)=SRC(7,4)=SRC(7,5)=SRC(7,6)=SRC(7,7)= l7; } libavcodec/h264pred.c:972: error: Uninitialized Value The value read from l7 was never initialized. libavcodec/h264pred.c:972:32: 970. SRC(0,5)=SRC(2,4)=SRC(4,3)=SRC(6,2)= (l5 + l6 + 1) >> 1; 971. SRC(1,5)=SRC(3,4)=SRC(5,3)=SRC(7,2)= (l5 + 2*l6 + l7 + 2) >> 2; 972. SRC(0,6)=SRC(2,5)=SRC(4,4)=SRC(6,3)= (l6 + l7 + 1) >> 1; ^ 973. SRC(1,6)=SRC(3,5)=SRC(5,4)=SRC(7,3)= (l6 + 3*l7 + 2) >> 2; 974. SRC(0,7)=SRC(1,7)=SRC(2,6)=SRC(2,7)=SRC(3,6)=
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264pred.c/#L972
d2a_code_trace_data_41850
const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end) { const uint8_t *a = p + 4 - ((long)p & 3); for( end -= 3; p < a && p < end; p++ ) { if( p[0] == 0 && p[1] == 0 && p[2] == 1 ) return p; } for( end -= 3; p < end; p += 4 ) { uint32_t x = *(const uint32_t*)p; if( (x - 0x01010101) & (~x) & 0x80808080 ) { if( p[1] == 0 ) { if( p[0] == 0 && p[2] == 1 ) return p-1; if( p[2] == 0 && p[3] == 1 ) return p; } if( p[3] == 0 ) { if( p[2] == 0 && p[4] == 1 ) return p+1; if( p[4] == 0 && p[5] == 1 ) return p+2; } } } for( end += 3; p < end; p++ ) { if( p[0] == 0 && p[1] == 0 && p[2] == 1 ) return p; } return end + 3; } libavformat/avc.c:37: error: Integer Overflow L2 ([0, `*p`] - 16843009):unsigned32. libavformat/avc.c:24:1: <LHS trace> 22. #include "avio.h" 23. 24. const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end) ^ 25. { 26. const uint8_t *a = p + 4 - ((long)p & 3); libavformat/avc.c:24:1: Parameter `*p` 22. #include "avio.h" 23. 24. const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end) ^ 25. { 26. const uint8_t *a = p + 4 - ((long)p & 3); libavformat/avc.c:34:9: Assignment 32. 33. for( end -= 3; p < end; p += 4 ) { 34. uint32_t x = *(const uint32_t*)p; ^ 35. // if( (x - 0x01000100) & (~x) & 0x80008000 ) // little endian 36. // if( (x - 0x00010001) & (~x) & 0x00800080 ) // big endian libavformat/avc.c:37:13: Binary operation: ([0, *p] - 16843009):unsigned32 35. // if( (x - 0x01000100) & (~x) & 0x80008000 ) // little endian 36. // if( (x - 0x00010001) & (~x) & 0x00800080 ) // big endian 37. if( (x - 0x01010101) & (~x) & 0x80808080 ) { // generic ^ 38. if( p[1] == 0 ) { 39. if( p[0] == 0 && p[2] == 1 )
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/avc.c/#L37
d2a_code_trace_data_41851
static inline void pred_direct_motion(H264Context * const h, int *mb_type){ MpegEncContext * const s = &h->s; const int mb_xy = s->mb_x + s->mb_y*s->mb_stride; const int b8_xy = 2*s->mb_x + 2*s->mb_y*h->b8_stride; const int b4_xy = 4*s->mb_x + 4*s->mb_y*h->b_stride; const int mb_type_col = h->ref_list[1][0].mb_type[mb_xy]; const int16_t (*l1mv0)[2] = (const int16_t (*)[2]) &h->ref_list[1][0].motion_val[0][b4_xy]; const int16_t (*l1mv1)[2] = (const int16_t (*)[2]) &h->ref_list[1][0].motion_val[1][b4_xy]; const int8_t *l1ref0 = &h->ref_list[1][0].ref_index[0][b8_xy]; const int8_t *l1ref1 = &h->ref_list[1][0].ref_index[1][b8_xy]; const int is_b8x8 = IS_8X8(*mb_type); unsigned int sub_mb_type; int i8, i4; #define MB_TYPE_16x16_OR_INTRA (MB_TYPE_16x16|MB_TYPE_INTRA4x4|MB_TYPE_INTRA16x16|MB_TYPE_INTRA_PCM) if(IS_8X8(mb_type_col) && !h->sps.direct_8x8_inference_flag){ sub_mb_type = MB_TYPE_8x8|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; *mb_type = MB_TYPE_8x8|MB_TYPE_L0L1; }else if(!is_b8x8 && (mb_type_col & MB_TYPE_16x16_OR_INTRA)){ sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; *mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; }else{ sub_mb_type = MB_TYPE_16x16|MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2; *mb_type = MB_TYPE_8x8|MB_TYPE_L0L1; } if(!is_b8x8) *mb_type |= MB_TYPE_DIRECT2; if(MB_FIELD) *mb_type |= MB_TYPE_INTERLACED; tprintf(s->avctx, "mb_type = %08x, sub_mb_type = %08x, is_b8x8 = %d, mb_type_col = %08x\n", *mb_type, sub_mb_type, is_b8x8, mb_type_col); if(h->direct_spatial_mv_pred){ int ref[2]; int mv[2][2]; int list; for(list=0; list<2; list++){ int refa = h->ref_cache[list][scan8[0] - 1]; int refb = h->ref_cache[list][scan8[0] - 8]; int refc = h->ref_cache[list][scan8[0] - 8 + 4]; if(refc == -2) refc = h->ref_cache[list][scan8[0] - 8 - 1]; ref[list] = refa; if(ref[list] < 0 || (refb < ref[list] && refb >= 0)) ref[list] = refb; if(ref[list] < 0 || (refc < ref[list] && refc >= 0)) ref[list] = refc; if(ref[list] < 0) ref[list] = -1; } if(ref[0] < 0 && ref[1] < 0){ ref[0] = ref[1] = 0; mv[0][0] = mv[0][1] = mv[1][0] = mv[1][1] = 0; }else{ for(list=0; list<2; list++){ if(ref[list] >= 0) pred_motion(h, 0, 4, list, ref[list], &mv[list][0], &mv[list][1]); else mv[list][0] = mv[list][1] = 0; } } if(ref[1] < 0){ if(!is_b8x8) *mb_type &= ~MB_TYPE_L1; sub_mb_type &= ~MB_TYPE_L1; }else if(ref[0] < 0){ if(!is_b8x8) *mb_type &= ~MB_TYPE_L0; sub_mb_type &= ~MB_TYPE_L0; } if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col)){ int pair_xy = s->mb_x + (s->mb_y&~1)*s->mb_stride; int mb_types_col[2]; int b8_stride = h->b8_stride; int b4_stride = h->b_stride; *mb_type = (*mb_type & ~MB_TYPE_16x16) | MB_TYPE_8x8; if(IS_INTERLACED(*mb_type)){ mb_types_col[0] = h->ref_list[1][0].mb_type[pair_xy]; mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy+s->mb_stride]; if(s->mb_y&1){ l1ref0 -= 2*b8_stride; l1ref1 -= 2*b8_stride; l1mv0 -= 4*b4_stride; l1mv1 -= 4*b4_stride; } b8_stride *= 3; b4_stride *= 6; }else{ int cur_poc = s->current_picture_ptr->poc; int *col_poc = h->ref_list[1]->field_poc; int col_parity = FFABS(col_poc[0] - cur_poc) >= FFABS(col_poc[1] - cur_poc); int dy = 2*col_parity - (s->mb_y&1); mb_types_col[0] = mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy + col_parity*s->mb_stride]; l1ref0 += dy*b8_stride; l1ref1 += dy*b8_stride; l1mv0 += 2*dy*b4_stride; l1mv1 += 2*dy*b4_stride; b8_stride = 0; } for(i8=0; i8<4; i8++){ int x8 = i8&1; int y8 = i8>>1; int xy8 = x8+y8*b8_stride; int xy4 = 3*x8+y8*b4_stride; int a=0, b=0; if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) continue; h->sub_mb_type[i8] = sub_mb_type; fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1); fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1); if(!IS_INTRA(mb_types_col[y8]) && ( (l1ref0[xy8] == 0 && FFABS(l1mv0[xy4][0]) <= 1 && FFABS(l1mv0[xy4][1]) <= 1) || (l1ref0[xy8] < 0 && l1ref1[xy8] == 0 && FFABS(l1mv1[xy4][0]) <= 1 && FFABS(l1mv1[xy4][1]) <= 1))){ if(ref[0] > 0) a= pack16to32(mv[0][0],mv[0][1]); if(ref[1] > 0) b= pack16to32(mv[1][0],mv[1][1]); }else{ a= pack16to32(mv[0][0],mv[0][1]); b= pack16to32(mv[1][0],mv[1][1]); } fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, a, 4); fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, b, 4); } }else if(IS_16X16(*mb_type)){ int a=0, b=0; fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, (uint8_t)ref[0], 1); fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, (uint8_t)ref[1], 1); if(!IS_INTRA(mb_type_col) && ( (l1ref0[0] == 0 && FFABS(l1mv0[0][0]) <= 1 && FFABS(l1mv0[0][1]) <= 1) || (l1ref0[0] < 0 && l1ref1[0] == 0 && FFABS(l1mv1[0][0]) <= 1 && FFABS(l1mv1[0][1]) <= 1 && (h->x264_build>33 || !h->x264_build)))){ if(ref[0] > 0) a= pack16to32(mv[0][0],mv[0][1]); if(ref[1] > 0) b= pack16to32(mv[1][0],mv[1][1]); }else{ a= pack16to32(mv[0][0],mv[0][1]); b= pack16to32(mv[1][0],mv[1][1]); } fill_rectangle(&h->mv_cache[0][scan8[0]], 4, 4, 8, a, 4); fill_rectangle(&h->mv_cache[1][scan8[0]], 4, 4, 8, b, 4); }else{ for(i8=0; i8<4; i8++){ const int x8 = i8&1; const int y8 = i8>>1; if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) continue; h->sub_mb_type[i8] = sub_mb_type; fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mv[0][0],mv[0][1]), 4); fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mv[1][0],mv[1][1]), 4); fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[0], 1); fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, (uint8_t)ref[1], 1); if(!IS_INTRA(mb_type_col) && ( l1ref0[x8 + y8*h->b8_stride] == 0 || (l1ref0[x8 + y8*h->b8_stride] < 0 && l1ref1[x8 + y8*h->b8_stride] == 0 && (h->x264_build>33 || !h->x264_build)))){ const int16_t (*l1mv)[2]= l1ref0[x8 + y8*h->b8_stride] == 0 ? l1mv0 : l1mv1; if(IS_SUB_8X8(sub_mb_type)){ const int16_t *mv_col = l1mv[x8*3 + y8*3*h->b_stride]; if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){ if(ref[0] == 0) fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4); if(ref[1] == 0) fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4); } }else for(i4=0; i4<4; i4++){ const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*h->b_stride]; if(FFABS(mv_col[0]) <= 1 && FFABS(mv_col[1]) <= 1){ if(ref[0] == 0) *(uint32_t*)h->mv_cache[0][scan8[i8*4+i4]] = 0; if(ref[1] == 0) *(uint32_t*)h->mv_cache[1][scan8[i8*4+i4]] = 0; } } } } } }else{ const int *map_col_to_list0[2] = {h->map_col_to_list0[0], h->map_col_to_list0[1]}; const int *dist_scale_factor = h->dist_scale_factor; if(FRAME_MBAFF){ if(IS_INTERLACED(*mb_type)){ map_col_to_list0[0] = h->map_col_to_list0_field[0]; map_col_to_list0[1] = h->map_col_to_list0_field[1]; dist_scale_factor = h->dist_scale_factor_field; } if(IS_INTERLACED(*mb_type) != IS_INTERLACED(mb_type_col)){ const int pair_xy = s->mb_x + (s->mb_y&~1)*s->mb_stride; int mb_types_col[2]; int y_shift; *mb_type = MB_TYPE_8x8|MB_TYPE_L0L1 | (is_b8x8 ? 0 : MB_TYPE_DIRECT2) | (*mb_type & MB_TYPE_INTERLACED); sub_mb_type = MB_TYPE_P0L0|MB_TYPE_P0L1|MB_TYPE_DIRECT2|MB_TYPE_16x16; if(IS_INTERLACED(*mb_type)){ mb_types_col[0] = h->ref_list[1][0].mb_type[pair_xy]; mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy+s->mb_stride]; if(s->mb_y&1){ l1ref0 -= 2*h->b8_stride; l1ref1 -= 2*h->b8_stride; l1mv0 -= 4*h->b_stride; l1mv1 -= 4*h->b_stride; } y_shift = 0; if( (mb_types_col[0] & MB_TYPE_16x16_OR_INTRA) && (mb_types_col[1] & MB_TYPE_16x16_OR_INTRA) && !is_b8x8) *mb_type |= MB_TYPE_16x8; else *mb_type |= MB_TYPE_8x8; }else{ int dy = (s->mb_y&1) ? 1 : 2; mb_types_col[0] = mb_types_col[1] = h->ref_list[1][0].mb_type[pair_xy+s->mb_stride]; l1ref0 += dy*h->b8_stride; l1ref1 += dy*h->b8_stride; l1mv0 += 2*dy*h->b_stride; l1mv1 += 2*dy*h->b_stride; y_shift = 2; if((mb_types_col[0] & (MB_TYPE_16x16_OR_INTRA|MB_TYPE_16x8)) && !is_b8x8) *mb_type |= MB_TYPE_16x16; else *mb_type |= MB_TYPE_8x8; } for(i8=0; i8<4; i8++){ const int x8 = i8&1; const int y8 = i8>>1; int ref0, scale; const int16_t (*l1mv)[2]= l1mv0; if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) continue; h->sub_mb_type[i8] = sub_mb_type; fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, 0, 1); if(IS_INTRA(mb_types_col[y8])){ fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, 0, 1); fill_rectangle(&h-> mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4); fill_rectangle(&h-> mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4); continue; } ref0 = l1ref0[x8 + (y8*2>>y_shift)*h->b8_stride]; if(ref0 >= 0) ref0 = map_col_to_list0[0][ref0*2>>y_shift]; else{ ref0 = map_col_to_list0[1][l1ref1[x8 + (y8*2>>y_shift)*h->b8_stride]*2>>y_shift]; l1mv= l1mv1; } scale = dist_scale_factor[ref0]; fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1); { const int16_t *mv_col = l1mv[x8*3 + (y8*6>>y_shift)*h->b_stride]; int my_col = (mv_col[1]<<y_shift)/2; int mx = (scale * mv_col[0] + 128) >> 8; int my = (scale * my_col + 128) >> 8; fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mx,my), 4); fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mx-mv_col[0],my-my_col), 4); } } return; } } if(IS_16X16(*mb_type)){ int ref, mv0, mv1; fill_rectangle(&h->ref_cache[1][scan8[0]], 4, 4, 8, 0, 1); if(IS_INTRA(mb_type_col)){ ref=mv0=mv1=0; }else{ const int ref0 = l1ref0[0] >= 0 ? map_col_to_list0[0][l1ref0[0]] : map_col_to_list0[1][l1ref1[0]]; const int scale = dist_scale_factor[ref0]; const int16_t *mv_col = l1ref0[0] >= 0 ? l1mv0[0] : l1mv1[0]; int mv_l0[2]; mv_l0[0] = (scale * mv_col[0] + 128) >> 8; mv_l0[1] = (scale * mv_col[1] + 128) >> 8; ref= ref0; mv0= pack16to32(mv_l0[0],mv_l0[1]); mv1= pack16to32(mv_l0[0]-mv_col[0],mv_l0[1]-mv_col[1]); } fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, ref, 1); fill_rectangle(&h-> mv_cache[0][scan8[0]], 4, 4, 8, mv0, 4); fill_rectangle(&h-> mv_cache[1][scan8[0]], 4, 4, 8, mv1, 4); }else{ for(i8=0; i8<4; i8++){ const int x8 = i8&1; const int y8 = i8>>1; int ref0, scale; const int16_t (*l1mv)[2]= l1mv0; if(is_b8x8 && !IS_DIRECT(h->sub_mb_type[i8])) continue; h->sub_mb_type[i8] = sub_mb_type; fill_rectangle(&h->ref_cache[1][scan8[i8*4]], 2, 2, 8, 0, 1); if(IS_INTRA(mb_type_col)){ fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, 0, 1); fill_rectangle(&h-> mv_cache[0][scan8[i8*4]], 2, 2, 8, 0, 4); fill_rectangle(&h-> mv_cache[1][scan8[i8*4]], 2, 2, 8, 0, 4); continue; } ref0 = l1ref0[x8 + y8*h->b8_stride]; if(ref0 >= 0) ref0 = map_col_to_list0[0][ref0]; else{ ref0 = map_col_to_list0[1][l1ref1[x8 + y8*h->b8_stride]]; l1mv= l1mv1; } scale = dist_scale_factor[ref0]; fill_rectangle(&h->ref_cache[0][scan8[i8*4]], 2, 2, 8, ref0, 1); if(IS_SUB_8X8(sub_mb_type)){ const int16_t *mv_col = l1mv[x8*3 + y8*3*h->b_stride]; int mx = (scale * mv_col[0] + 128) >> 8; int my = (scale * mv_col[1] + 128) >> 8; fill_rectangle(&h->mv_cache[0][scan8[i8*4]], 2, 2, 8, pack16to32(mx,my), 4); fill_rectangle(&h->mv_cache[1][scan8[i8*4]], 2, 2, 8, pack16to32(mx-mv_col[0],my-mv_col[1]), 4); }else for(i4=0; i4<4; i4++){ const int16_t *mv_col = l1mv[x8*2 + (i4&1) + (y8*2 + (i4>>1))*h->b_stride]; int16_t *mv_l0 = h->mv_cache[0][scan8[i8*4+i4]]; mv_l0[0] = (scale * mv_col[0] + 128) >> 8; mv_l0[1] = (scale * mv_col[1] + 128) >> 8; *(uint32_t*)h->mv_cache[1][scan8[i8*4+i4]] = pack16to32(mv_l0[0]-mv_col[0],mv_l0[1]-mv_col[1]); } } } } } libavcodec/h264.c:1025: error: Uninitialized Value The value read from ref[_] was never initialized. libavcodec/h264.c:1025:12: 1023. } 1024. 1025. if(ref[1] < 0){ ^ 1026. if(!is_b8x8) 1027. *mb_type &= ~MB_TYPE_L1;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L1025
d2a_code_trace_data_41852
int test_mont(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b, *c, *d, *A, *B; BIGNUM *n; int i; BN_MONT_CTX *mont; a = BN_new(); b = BN_new(); c = BN_new(); d = BN_new(); A = BN_new(); B = BN_new(); n = BN_new(); mont = BN_MONT_CTX_new(); if (mont == NULL) return 0; BN_zero(n); if (BN_MONT_CTX_set(mont, n, ctx)) { fprintf(stderr, "BN_MONT_CTX_set succeeded for zero modulus!\n"); return 0; } BN_set_word(n, 16); if (BN_MONT_CTX_set(mont, n, ctx)) { fprintf(stderr, "BN_MONT_CTX_set succeeded for even modulus!\n"); return 0; } BN_bntest_rand(a, 100, 0, 0); BN_bntest_rand(b, 100, 0, 0); for (i = 0; i < num2; i++) { int bits = (200 * (i + 1)) / num2; if (bits == 0) continue; BN_bntest_rand(n, bits, 0, 1); BN_MONT_CTX_set(mont, n, ctx); BN_nnmod(a, a, n, ctx); BN_nnmod(b, b, n, ctx); BN_to_montgomery(A, a, mont, ctx); BN_to_montgomery(B, b, mont, ctx); BN_mod_mul_montgomery(c, A, B, mont, ctx); BN_from_montgomery(A, c, mont, ctx); if (bp != NULL) { if (!results) { BN_print(bp, a); BIO_puts(bp, " * "); BN_print(bp, b); BIO_puts(bp, " % "); BN_print(bp, &mont->N); BIO_puts(bp, " - "); } BN_print(bp, A); BIO_puts(bp, "\n"); } BN_mod_mul(d, a, b, n, ctx); BN_sub(d, d, A); if (!BN_is_zero(d)) { fprintf(stderr, "Montgomery multiplication test failed!\n"); return 0; } } BN_MONT_CTX_free(mont); BN_free(a); BN_free(b); BN_free(c); BN_free(d); BN_free(A); BN_free(B); BN_free(n); return (1); } test/bntest.c:802: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 784, column 9 is not reachable after line 802, column 17. Showing all 204 steps of the trace test/bntest.c:775:1: start of procedure test_mont() 773. } 774. 775. > int test_mont(BIO *bp, BN_CTX *ctx) 776. { 777. BIGNUM *a, *b, *c, *d, *A, *B; test/bntest.c:782:5: 780. BN_MONT_CTX *mont; 781. 782. > a = BN_new(); 783. b = BN_new(); 784. 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:783:5: 781. 782. a = BN_new(); 783. > b = BN_new(); 784. c = BN_new(); 785. 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:784:5: 782. a = BN_new(); 783. b = BN_new(); 784. > c = BN_new(); 785. d = BN_new(); 786. A = 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:785:5: 783. b = BN_new(); 784. c = BN_new(); 785. > d = BN_new(); 786. A = BN_new(); 787. B = 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:786:5: 784. c = BN_new(); 785. d = BN_new(); 786. > A = BN_new(); 787. B = BN_new(); 788. n = 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:787:5: 785. d = BN_new(); 786. A = BN_new(); 787. > B = BN_new(); 788. n = BN_new(); 789. 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:788:5: 786. A = BN_new(); 787. B = BN_new(); 788. > n = BN_new(); 789. 790. mont = BN_MONT_CTX_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:790:5: 788. n = BN_new(); 789. 790. > mont = BN_MONT_CTX_new(); 791. if (mont == NULL) 792. return 0; 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) test/bntest.c:791:9: Taking false branch 789. 790. mont = BN_MONT_CTX_new(); 791. if (mont == NULL) ^ 792. return 0; 793. test/bntest.c:794:5: 792. return 0; 793. 794. > BN_zero(n); 795. if (BN_MONT_CTX_set(mont, n, ctx)) { 796. fprintf(stderr, "BN_MONT_CTX_set succeeded for zero modulus!\n"); crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is false 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:795:9: Taking false branch 793. 794. BN_zero(n); 795. if (BN_MONT_CTX_set(mont, n, ctx)) { ^ 796. fprintf(stderr, "BN_MONT_CTX_set succeeded for zero modulus!\n"); 797. return 0; test/bntest.c:800:5: 798. } 799. 800. > BN_set_word(n, 16); 801. if (BN_MONT_CTX_set(mont, n, ctx)) { 802. fprintf(stderr, "BN_MONT_CTX_set succeeded for even modulus!\n"); crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is true 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) test/bntest.c:801:9: Taking true branch 799. 800. BN_set_word(n, 16); 801. if (BN_MONT_CTX_set(mont, n, ctx)) { ^ 802. fprintf(stderr, "BN_MONT_CTX_set succeeded for even modulus!\n"); 803. return 0; test/bntest.c:802:9: 800. BN_set_word(n, 16); 801. if (BN_MONT_CTX_set(mont, n, ctx)) { 802. > fprintf(stderr, "BN_MONT_CTX_set succeeded for even modulus!\n"); 803. return 0; 804. }
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L802
d2a_code_trace_data_41853
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) { int i, nw, lb, rb; BN_ULONG *t, *f; BN_ULONG l; bn_check_top(r); bn_check_top(a); if (n < 0) { BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT); return 0; } r->neg = a->neg; nw = n / BN_BITS2; if (bn_wexpand(r, a->top + nw + 1) == NULL) return (0); lb = n % BN_BITS2; rb = BN_BITS2 - lb; f = a->d; t = r->d; t[a->top + nw] = 0; if (lb == 0) for (i = a->top - 1; i >= 0; i--) t[nw + i] = f[i]; else for (i = a->top - 1; i >= 0; i--) { l = f[i]; t[nw + i + 1] |= (l >> rb) & BN_MASK2; t[nw + i] = (l << lb) & BN_MASK2; } memset(t, 0, sizeof(*t) * nw); r->top = a->top + nw + 1; bn_correct_top(r); bn_check_top(r); return (1); } apps/s_client.c:312: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `srp_Verify_N_and_g`. Showing all 29 steps of the trace apps/s_client.c:293:9: Call 291. BIO_printf(bio_err, "SRP parameters:\n"); 292. BIO_printf(bio_err, "\tN="); 293. BN_print(bio_err, N); ^ 294. BIO_printf(bio_err, "\n\tg="); 295. BN_print(bio_err, g); crypto/bn/bn_print.c:296:1: Parameter `a->top` 294. # endif 295. 296. > int BN_print(BIO *bp, const BIGNUM *a) 297. { 298. int i, j, v, z = 0; apps/s_client.c:295:9: Call 293. BN_print(bio_err, N); 294. BIO_printf(bio_err, "\n\tg="); 295. BN_print(bio_err, g); ^ 296. BIO_printf(bio_err, "\n"); 297. } crypto/bn/bn_print.c:296:1: Parameter `a->top` 294. # endif 295. 296. > int BN_print(BIO *bp, const BIGNUM *a) 297. { 298. int i, j, v, z = 0; apps/s_client.c:299:9: Call 297. } 298. 299. if (SRP_check_known_gN_param(g, N)) ^ 300. return 1; 301. crypto/srp/srp_lib.c:296:1: Parameter `g->top` 294. * from the ietf-tls-srp draft version 8 295. */ 296. > char *SRP_check_known_gN_param(const BIGNUM *g, const BIGNUM *N) 297. { 298. size_t i; apps/s_client.c:312:13: Call 310. * has already been tested. 311. */ 312. if (BN_num_bits(g) <= BN_BITS && srp_Verify_N_and_g(N, g)) ^ 313. return 1; 314. } crypto/bn/bn_lib.c:166:9: Call 164. bn_check_top(a); 165. 166. if (BN_is_zero(a)) ^ 167. return 0; 168. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); crypto/bn/bn_lib.c:920:1: Parameter `a->top` 918. } 919. 920. > int BN_is_zero(const BIGNUM *a) 921. { 922. return a->top == 0; apps/s_client.c:312:42: Call 310. * has already been tested. 311. */ 312. if (BN_num_bits(g) <= BN_BITS && srp_Verify_N_and_g(N, g)) ^ 313. return 1; 314. } apps/s_client.c:245:1: Parameter `g->top` 243. # define SRP_NUMBER_ITERATIONS_FOR_PRIME 64 244. 245. > static int srp_Verify_N_and_g(const BIGNUM *N, const BIGNUM *g) 246. { 247. BN_CTX *bn_ctx = BN_CTX_new(); apps/s_client.c:258:9: Call 256. r != NULL && 257. /* verify g^((N-1)/2) == -1 (mod N) */ 258. BN_mod_exp(r, g, p, N, bn_ctx) && ^ 259. BN_add_word(r, 1) && BN_cmp(r, N) == 0; 260. crypto/bn/bn_exp.c:90:1: Parameter `a->top` 88. } 89. 90. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 91. BN_CTX *ctx) 92. { crypto/bn/bn_exp.c:150:19: Call 148. } else 149. # endif 150. ret = BN_mod_exp_mont(r, a, p, m, ctx, NULL); ^ 151. } else 152. #endif crypto/bn/bn_exp.c:300:1: Parameter `a->top` 298. } 299. 300. > int BN_mod_exp_mont(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 301. const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *in_mont) 302. { crypto/bn/bn_exp.c:312:16: Call 310. 311. if (BN_get_flags(p, BN_FLG_CONSTTIME) != 0) { 312. return BN_mod_exp_mont_consttime(rr, a, p, m, ctx, in_mont); ^ 313. } 314. crypto/bn/bn_exp.c:600:1: Parameter `a->top` 598. * http://www.daemonology.net/hyperthreading-considered-harmful/) 599. */ 600. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 601. const BIGNUM *m, BN_CTX *ctx, 602. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:753:14: Call 751. /* prepare a^1 in Montgomery domain */ 752. if (a->neg || BN_ucmp(a, m) >= 0) { 753. if (!BN_mod(&am, a, m, ctx)) ^ 754. goto err; 755. if (!BN_to_montgomery(&am, &am, mont, ctx)) crypto/bn/bn_div.c:140:1: Parameter `num->top` 138. * If 'dv' or 'rm' is NULL, the respective value is not returned. 139. */ 140. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 141. BN_CTX *ctx) 142. { crypto/bn/bn_div.c:210:11: Call 208. sdiv->neg = 0; 209. norm_shift += BN_BITS2; 210. if (!(BN_lshift(snum, num, norm_shift))) ^ 211. goto err; 212. snum->neg = 0; crypto/bn/bn_shift.c:81:1: <Offset trace> 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:81:1: Parameter `n` 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:96:5: Assignment 94. 95. r->neg = a->neg; 96. nw = n / BN_BITS2; ^ 97. if (bn_wexpand(r, a->top + nw + 1) == NULL) 98. return (0); crypto/bn/bn_shift.c:81:1: <Length trace> 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:81:1: Parameter `*r->d` 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:9: Call 95. r->neg = a->neg; 96. nw = n / BN_BITS2; 97. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 98. return (0); 99. lb = n % BN_BITS2; crypto/bn/bn_lib.c:1016:1: Parameter `*a->d` 1014. } 1015. 1016. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 1017. { 1018. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:102:5: Assignment 100. rb = BN_BITS2 - lb; 101. f = a->d; 102. t = r->d; ^ 103. t[a->top + nw] = 0; 104. if (lb == 0) crypto/bn/bn_shift.c:110:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `srp_Verify_N_and_g` 108. for (i = a->top - 1; i >= 0; i--) { 109. l = f[i]; 110. t[nw + i + 1] |= (l >> rb) & BN_MASK2; ^ 111. t[nw + i] = (l << lb) & BN_MASK2; 112. }
https://github.com/openssl/openssl/blob/4973a60cb92dc121fc09246bff3815afc0f8ab9a/crypto/bn/bn_shift.c/#L110