id
stringlengths
25
25
content
stringlengths
649
72.1k
max_stars_repo_path
stringlengths
91
133
d2a_code_trace_data_45954
static int client_hello_select_server_ctx(SSL *s, void *arg, int ignore) { const char *servername; const unsigned char *p; size_t len, remaining; HANDSHAKE_EX_DATA *ex_data = (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); if (!SSL_client_hello_get0_ext(s, TLSEXT_TYPE_server_name, &p, &remaining) || remaining <= 2) return 0; len = (*(p++) << 8); len += *(p++); if (len + 2 != remaining) return 0; remaining = len; if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name) return 0; remaining--; if (remaining <= 2) return 0; len = (*(p++) << 8); len += *(p++); if (len + 2 > remaining) return 0; remaining = len; servername = (const char *)p; if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) { SSL_CTX *new_ctx = arg; SSL_set_SSL_CTX(s, new_ctx); SSL_clear_options(s, 0xFFFFFFFFL); SSL_set_options(s, SSL_CTX_get_options(new_ctx)); ex_data->servername = SSL_TEST_SERVERNAME_SERVER2; return 1; } else if (len == strlen("server1") && strncmp(servername, "server1", len) == 0) { ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; return 1; } else if (ignore) { ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; return 1; } return 0; } test/handshake_helper.c:190: error: NULL_DEREFERENCE pointer `ex_data` last assigned on line 145 could be null and is dereferenced at line 190, column 9. Showing all 71 steps of the trace test/handshake_helper.c:140:1: start of procedure client_hello_select_server_ctx() 138. } 139. 140. > static int client_hello_select_server_ctx(SSL *s, void *arg, int ignore) 141. { 142. const char *servername; test/handshake_helper.c:145:5: 143. const unsigned char *p; 144. size_t len, remaining; 145. > HANDSHAKE_EX_DATA *ex_data = 146. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); 147. ssl/ssl_lib.c:3889:1: start of procedure SSL_get_ex_data() 3887. } 3888. 3889. > void *SSL_get_ex_data(const SSL *s, int idx) 3890. { 3891. return (CRYPTO_get_ex_data(&s->ex_data, idx)); ssl/ssl_lib.c:3891:5: 3889. void *SSL_get_ex_data(const SSL *s, int idx) 3890. { 3891. > return (CRYPTO_get_ex_data(&s->ex_data, idx)); 3892. } 3893. crypto/ex_data.c:394:1: start of procedure CRYPTO_get_ex_data() 392. * particular index in the class used by this variable 393. */ 394. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 395. { 396. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) crypto/ex_data.c:396:9: Taking true branch 394. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 395. { 396. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) ^ 397. return NULL; 398. return sk_void_value(ad->sk, idx); crypto/ex_data.c:397:9: 395. { 396. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) 397. > return NULL; 398. return sk_void_value(ad->sk, idx); 399. } crypto/ex_data.c:399:1: return from a call to CRYPTO_get_ex_data 397. return NULL; 398. return sk_void_value(ad->sk, idx); 399. > } ssl/ssl_lib.c:3892:1: return from a call to SSL_get_ex_data 3890. { 3891. return (CRYPTO_get_ex_data(&s->ex_data, idx)); 3892. > } 3893. 3894. int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg) test/handshake_helper.c:152:10: Taking false branch 150. * was written, so parsing the normal case is a bit complex. 151. */ 152. if (!SSL_client_hello_get0_ext(s, TLSEXT_TYPE_server_name, &p, ^ 153. &remaining) || 154. remaining <= 2) test/handshake_helper.c:154:9: Taking false branch 152. if (!SSL_client_hello_get0_ext(s, TLSEXT_TYPE_server_name, &p, 153. &remaining) || 154. remaining <= 2) ^ 155. return 0; 156. /* Extract the length of the supplied list of names. */ test/handshake_helper.c:157:5: 155. return 0; 156. /* Extract the length of the supplied list of names. */ 157. > len = (*(p++) << 8); 158. len += *(p++); 159. if (len + 2 != remaining) test/handshake_helper.c:158:5: 156. /* Extract the length of the supplied list of names. */ 157. len = (*(p++) << 8); 158. > len += *(p++); 159. if (len + 2 != remaining) 160. return 0; test/handshake_helper.c:159:9: Taking false branch 157. len = (*(p++) << 8); 158. len += *(p++); 159. if (len + 2 != remaining) ^ 160. return 0; 161. remaining = len; test/handshake_helper.c:161:5: 159. if (len + 2 != remaining) 160. return 0; 161. > remaining = len; 162. /* 163. * The list in practice only has a single element, so we only consider test/handshake_helper.c:166:9: Taking false branch 164. * the first one. 165. */ 166. if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name) ^ 167. return 0; 168. remaining--; test/handshake_helper.c:166:27: Taking false branch 164. * the first one. 165. */ 166. if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name) ^ 167. return 0; 168. remaining--; test/handshake_helper.c:168:5: 166. if (remaining == 0 || *p++ != TLSEXT_NAMETYPE_host_name) 167. return 0; 168. > remaining--; 169. /* Now we can finally pull out the byte array with the actual hostname. */ 170. if (remaining <= 2) test/handshake_helper.c:170:9: Taking false branch 168. remaining--; 169. /* Now we can finally pull out the byte array with the actual hostname. */ 170. if (remaining <= 2) ^ 171. return 0; 172. len = (*(p++) << 8); test/handshake_helper.c:172:5: 170. if (remaining <= 2) 171. return 0; 172. > len = (*(p++) << 8); 173. len += *(p++); 174. if (len + 2 > remaining) test/handshake_helper.c:173:5: 171. return 0; 172. len = (*(p++) << 8); 173. > len += *(p++); 174. if (len + 2 > remaining) 175. return 0; test/handshake_helper.c:174:9: Taking false branch 172. len = (*(p++) << 8); 173. len += *(p++); 174. if (len + 2 > remaining) ^ 175. return 0; 176. remaining = len; test/handshake_helper.c:176:5: 174. if (len + 2 > remaining) 175. return 0; 176. > remaining = len; 177. servername = (const char *)p; 178. test/handshake_helper.c:177:5: 175. return 0; 176. remaining = len; 177. > servername = (const char *)p; 178. 179. if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) { test/handshake_helper.c:179:9: Taking true branch 177. servername = (const char *)p; 178. 179. if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) { ^ 180. SSL_CTX *new_ctx = arg; 181. SSL_set_SSL_CTX(s, new_ctx); test/handshake_helper.c:179:37: Taking true branch 177. servername = (const char *)p; 178. 179. if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) { ^ 180. SSL_CTX *new_ctx = arg; 181. SSL_set_SSL_CTX(s, new_ctx); test/handshake_helper.c:180:9: 178. 179. if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) { 180. > SSL_CTX *new_ctx = arg; 181. SSL_set_SSL_CTX(s, new_ctx); 182. /* test/handshake_helper.c:181:9: 179. if (len == strlen("server2") && strncmp(servername, "server2", len) == 0) { 180. SSL_CTX *new_ctx = arg; 181. > SSL_set_SSL_CTX(s, new_ctx); 182. /* 183. * Copy over all the SSL_CTX options - reasonable behavior ssl/ssl_lib.c:3726:1: start of procedure SSL_set_SSL_CTX() 3724. } 3725. 3726. > SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx) 3727. { 3728. CERT *new_cert; ssl/ssl_lib.c:3729:9: Taking false branch 3727. { 3728. CERT *new_cert; 3729. if (ssl->ctx == ctx) ^ 3730. return ssl->ctx; 3731. if (ctx == NULL) ssl/ssl_lib.c:3731:9: Taking false branch 3729. if (ssl->ctx == ctx) 3730. return ssl->ctx; 3731. if (ctx == NULL) ^ 3732. ctx = ssl->session_ctx; 3733. new_cert = ssl_cert_dup(ctx->cert); ssl/ssl_lib.c:3733:5: Skipping ssl_cert_dup(): empty list of specs 3731. if (ctx == NULL) 3732. ctx = ssl->session_ctx; 3733. new_cert = ssl_cert_dup(ctx->cert); ^ 3734. if (new_cert == NULL) { 3735. return NULL; ssl/ssl_lib.c:3734:9: Taking false branch 3732. ctx = ssl->session_ctx; 3733. new_cert = ssl_cert_dup(ctx->cert); 3734. if (new_cert == NULL) { ^ 3735. return NULL; 3736. } ssl/ssl_lib.c:3738:10: Taking false branch 3736. } 3737. 3738. if (!custom_exts_copy_flags(&new_cert->custext, &ssl->cert->custext)) { ^ 3739. ssl_cert_free(new_cert); 3740. return NULL; ssl/ssl_lib.c:3743:5: 3741. } 3742. 3743. > ssl_cert_free(ssl->cert); 3744. ssl->cert = new_cert; 3745. ssl/ssl_cert.c:225:1: start of procedure ssl_cert_free() 223. } 224. 225. > void ssl_cert_free(CERT *c) 226. { 227. int i; ssl/ssl_cert.c:229:9: Taking true branch 227. int i; 228. 229. if (c == NULL) ^ 230. return; 231. ssl/ssl_cert.c:230:9: 228. 229. if (c == NULL) 230. > return; 231. 232. CRYPTO_DOWN_REF(&c->references, &i, c->lock); ssl/ssl_cert.c:255:1: return from a call to ssl_cert_free 253. CRYPTO_THREAD_lock_free(c->lock); 254. OPENSSL_free(c); 255. > } 256. 257. int ssl_cert_set0_chain(SSL *s, SSL_CTX *ctx, STACK_OF(X509) *chain) ssl/ssl_lib.c:3744:5: 3742. 3743. ssl_cert_free(ssl->cert); 3744. > ssl->cert = new_cert; 3745. 3746. /* ssl/ssl_lib.c:3750:10: Condition is true 3748. * so setter APIs must prevent invalid lengths from entering the system. 3749. */ 3750. if (!ossl_assert(ssl->sid_ctx_length <= sizeof(ssl->sid_ctx))) ^ 3751. return NULL; 3752. ssl/ssl_lib.c:3750:10: Taking false branch 3748. * so setter APIs must prevent invalid lengths from entering the system. 3749. */ 3750. if (!ossl_assert(ssl->sid_ctx_length <= sizeof(ssl->sid_ctx))) ^ 3751. return NULL; 3752. ssl/ssl_lib.c:3759:10: Taking false branch 3757. * leave it unchanged. 3758. */ 3759. if ((ssl->ctx != NULL) && ^ 3760. (ssl->sid_ctx_length == ssl->ctx->sid_ctx_length) && 3761. (memcmp(ssl->sid_ctx, ssl->ctx->sid_ctx, ssl->sid_ctx_length) == 0)) { ssl/ssl_lib.c:3766:5: 3764. } 3765. 3766. > SSL_CTX_up_ref(ctx); 3767. SSL_CTX_free(ssl->ctx); /* decrement reference count */ 3768. ssl->ctx = ctx; ssl/ssl_lib.c:2889:1: start of procedure SSL_CTX_up_ref() 2887. } 2888. 2889. > int SSL_CTX_up_ref(SSL_CTX *ctx) 2890. { 2891. int i; ssl/ssl_lib.c:2893:9: 2891. int i; 2892. 2893. > if (CRYPTO_UP_REF(&ctx->references, &i, ctx->lock) <= 0) 2894. return 0; 2895. include/internal/refcount.h:32:1: start of procedure CRYPTO_UP_REF() 30. typedef _Atomic int CRYPTO_REF_COUNT; 31. 32. > static ossl_inline int CRYPTO_UP_REF(_Atomic int *val, int *ret, void *lock) 33. { 34. *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1; include/internal/refcount.h:34:5: 32. static ossl_inline int CRYPTO_UP_REF(_Atomic int *val, int *ret, void *lock) 33. { 34. > *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1; 35. return 1; 36. } include/internal/refcount.h:35:5: 33. { 34. *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1; 35. > return 1; 36. } 37. include/internal/refcount.h:36:1: return from a call to CRYPTO_UP_REF 34. *ret = atomic_fetch_add_explicit(val, 1, memory_order_relaxed) + 1; 35. return 1; 36. > } 37. 38. static ossl_inline int CRYPTO_DOWN_REF(_Atomic int *val, int *ret, void *lock) ssl/ssl_lib.c:2893:9: Taking false branch 2891. int i; 2892. 2893. if (CRYPTO_UP_REF(&ctx->references, &i, ctx->lock) <= 0) ^ 2894. return 0; 2895. ssl/ssl_lib.c:2898:14: Condition is false 2896. REF_PRINT_COUNT("SSL_CTX", ctx); 2897. REF_ASSERT_ISNT(i < 2); 2898. return ((i > 1) ? 1 : 0); ^ 2899. } 2900. ssl/ssl_lib.c:2898:13: 2896. REF_PRINT_COUNT("SSL_CTX", ctx); 2897. REF_ASSERT_ISNT(i < 2); 2898. > return ((i > 1) ? 1 : 0); 2899. } 2900. ssl/ssl_lib.c:2898:5: 2896. REF_PRINT_COUNT("SSL_CTX", ctx); 2897. REF_ASSERT_ISNT(i < 2); 2898. > return ((i > 1) ? 1 : 0); 2899. } 2900. ssl/ssl_lib.c:2899:1: return from a call to SSL_CTX_up_ref 2897. REF_ASSERT_ISNT(i < 2); 2898. return ((i > 1) ? 1 : 0); 2899. > } 2900. 2901. void SSL_CTX_free(SSL_CTX *a) ssl/ssl_lib.c:3767:5: Skipping SSL_CTX_free(): empty list of specs 3765. 3766. SSL_CTX_up_ref(ctx); 3767. SSL_CTX_free(ssl->ctx); /* decrement reference count */ ^ 3768. ssl->ctx = ctx; 3769. ssl/ssl_lib.c:3768:5: 3766. SSL_CTX_up_ref(ctx); 3767. SSL_CTX_free(ssl->ctx); /* decrement reference count */ 3768. > ssl->ctx = ctx; 3769. 3770. return ssl->ctx; ssl/ssl_lib.c:3770:5: 3768. ssl->ctx = ctx; 3769. 3770. > return ssl->ctx; 3771. } 3772. ssl/ssl_lib.c:3771:1: return from a call to SSL_set_SSL_CTX 3769. 3770. return ssl->ctx; 3771. > } 3772. 3773. int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx) test/handshake_helper.c:187:9: 185. * contexts differ/conflict 186. */ 187. > SSL_clear_options(s, 0xFFFFFFFFL); 188. SSL_set_options(s, SSL_CTX_get_options(new_ctx)); 189. ssl/ssl_lib.c:4307:1: start of procedure SSL_clear_options() 4305. } 4306. 4307. > unsigned long SSL_clear_options(SSL *s, unsigned long op) 4308. { 4309. return s->options &= ~op; ssl/ssl_lib.c:4309:5: 4307. unsigned long SSL_clear_options(SSL *s, unsigned long op) 4308. { 4309. > return s->options &= ~op; 4310. } 4311. ssl/ssl_lib.c:4310:1: return from a call to SSL_clear_options 4308. { 4309. return s->options &= ~op; 4310. > } 4311. 4312. STACK_OF(X509) *SSL_get0_verified_chain(const SSL *s) test/handshake_helper.c:188:9: 186. */ 187. SSL_clear_options(s, 0xFFFFFFFFL); 188. > SSL_set_options(s, SSL_CTX_get_options(new_ctx)); 189. 190. ex_data->servername = SSL_TEST_SERVERNAME_SERVER2; ssl/ssl_lib.c:4282:1: start of procedure SSL_CTX_get_options() 4280. * control interface. 4281. */ 4282. > unsigned long SSL_CTX_get_options(const SSL_CTX *ctx) 4283. { 4284. return ctx->options; ssl/ssl_lib.c:4284:5: 4282. unsigned long SSL_CTX_get_options(const SSL_CTX *ctx) 4283. { 4284. > return ctx->options; 4285. } 4286. ssl/ssl_lib.c:4285:1: return from a call to SSL_CTX_get_options 4283. { 4284. return ctx->options; 4285. > } 4286. 4287. unsigned long SSL_get_options(const SSL *s) ssl/ssl_lib.c:4297:1: start of procedure SSL_set_options() 4295. } 4296. 4297. > unsigned long SSL_set_options(SSL *s, unsigned long op) 4298. { 4299. return s->options |= op; ssl/ssl_lib.c:4299:5: 4297. unsigned long SSL_set_options(SSL *s, unsigned long op) 4298. { 4299. > return s->options |= op; 4300. } 4301. ssl/ssl_lib.c:4300:1: return from a call to SSL_set_options 4298. { 4299. return s->options |= op; 4300. > } 4301. 4302. unsigned long SSL_CTX_clear_options(SSL_CTX *ctx, unsigned long op) test/handshake_helper.c:190:9: 188. SSL_set_options(s, SSL_CTX_get_options(new_ctx)); 189. 190. > ex_data->servername = SSL_TEST_SERVERNAME_SERVER2; 191. return 1; 192. } else if (len == strlen("server1") &&
https://github.com/openssl/openssl/blob/f1b97da1fd90cf3935eafedc8df0d0165cb75f2f/test/handshake_helper.c/#L190
d2a_code_trace_data_45955
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); } test/bntest.c:2037: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `BN_div`. Showing all 14 steps of the trace test/bntest.c:2020:5: Call 2018. d = BN_new(); 2019. e = BN_new(); 2020. BN_one(c); ^ 2021. 2022. BN_bntest_rand(a, 200, 0, 0); crypto/bn/bn_lib.c:463:1: Parameter `a->top` 461. } 462. 463. > int BN_set_word(BIGNUM *a, BN_ULONG w) 464. { 465. bn_check_top(a); test/bntest.c:2037:9: Call 2035. BIO_puts(bp, "\n"); 2036. } 2037. BN_div(d, e, a, c, ctx); ^ 2038. BN_sub(d, d, b); 2039. if (!BN_is_zero(d)) { 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 `BN_div` 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/b3618f44a7b8504bfb0a64e8a33e6b8e56d4d516/crypto/bn/bn_shift.c/#L110
d2a_code_trace_data_45956
int BN_hex2bn(BIGNUM **bn, const char *a) { BIGNUM *ret = NULL; BN_ULONG l = 0; int neg = 0, h, m, i, j, k, c; int num; if (a == NULL || *a == '\0') return 0; if (*a == '-') { neg = 1; a++; } for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++) continue; if (i == 0 || i > INT_MAX / 4) goto err; num = i + neg; if (bn == NULL) return num; if (*bn == NULL) { if ((ret = BN_new()) == NULL) return 0; } else { ret = *bn; BN_zero(ret); } if (bn_expand(ret, i * 4) == NULL) goto err; j = i; m = 0; h = 0; while (j > 0) { m = (BN_BYTES * 2 <= j) ? BN_BYTES * 2 : j; l = 0; for (;;) { c = a[j - m]; k = OPENSSL_hexchar2int(c); if (k < 0) k = 0; l = (l << 4) | k; if (--m <= 0) { ret->d[h++] = l; break; } } j -= BN_BYTES * 2; } ret->top = h; bn_correct_top(ret); *bn = ret; bn_check_top(ret); if (ret->top != 0) ret->neg = neg; return num; err: if (*bn == NULL) BN_free(ret); return 0; } test/params_test.c:508: error: BUFFER_OVERRUN_L2 Offset: [0, 536870912] (⇐ [0, 1] + [0, 536870911]) Size: 9 by call to `BN_hex2bn`. Showing all 6 steps of the trace test/params_test.c:508:10: Call 506. verify_p3 = NULL; 507. 508. if (!TEST_true(BN_hex2bn(&verify_p3, app_p3_init))) { ^ 509. errcnt++; 510. goto fin; crypto/bn/bn_print.c:141:10: <Offset trace> 139. } 140. 141. for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++) ^ 142. continue; 143. crypto/bn/bn_print.c:141:10: Assignment 139. } 140. 141. for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++) ^ 142. continue; 143. crypto/bn/bn_print.c:126:1: <Length trace> 124. } 125. 126. > int BN_hex2bn(BIGNUM **bn, const char *a) 127. { 128. BIGNUM *ret = NULL; crypto/bn/bn_print.c:126:1: Parameter `*a` 124. } 125. 126. > int BN_hex2bn(BIGNUM **bn, const char *a) 127. { 128. BIGNUM *ret = NULL; crypto/bn/bn_print.c:141:37: Array access: Offset: [0, 536870912] (⇐ [0, 1] + [0, 536870911]) Size: 9 by call to `BN_hex2bn` 139. } 140. 141. for (i = 0; i <= INT_MAX / 4 && ossl_isxdigit(a[i]); i++) ^ 142. continue; 143.
https://github.com/openssl/openssl/blob/fff684168c7923aa85e6b4381d71d933396e32b0/crypto/bn/bn_print.c/#L141
d2a_code_trace_data_45957
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bntest.c:997: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mod_exp`. Showing all 19 steps of the trace crypto/bn/bntest.c:980:1: Parameter `ctx->stack.depth` 978. } 979. 980. > int test_mod_exp(BIO *bp, BN_CTX *ctx) 981. { 982. BIGNUM *a,*b,*c,*d,*e; crypto/bn/bntest.c:997:8: Call 995. BN_bntest_rand(b,2+i,0,0); /**/ 996. 997. if (!BN_mod_exp(d,a,b,c,ctx)) ^ 998. return(0); 999. crypto/bn/bn_exp.c:194:1: Parameter `ctx->stack.depth` 192. 193. 194. > int BN_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, 195. BN_CTX *ctx) 196. { crypto/bn/bn_exp.c:260:9: Call 258. #endif 259. #ifdef RECP_MUL_MOD 260. { ret=BN_mod_exp_recp(r,a,p,m,ctx); } ^ 261. #else 262. { ret=BN_mod_exp_simple(r,a,p,m,ctx); } crypto/bn/bn_exp.c:270:1: Parameter `ctx->stack.depth` 268. 269. 270. > int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 271. const BIGNUM *m, BN_CTX *ctx) 272. { crypto/bn/bn_exp.c:295:2: Call 293. } 294. 295. BN_CTX_start(ctx); ^ 296. aa = BN_CTX_get(ctx); 297. val[0] = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:257:1: Parameter `ctx->stack.depth` 255. } 256. 257. > void BN_CTX_start(BN_CTX *ctx) 258. { 259. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_exp.c:313:7: Call 311. } 312. 313. if (!BN_nnmod(val[0],a,m,ctx)) goto err; /* 1 */ ^ 314. if (BN_is_zero(val[0])) 315. { crypto/bn/bn_mod.c:129:1: Parameter `ctx->stack.depth` 127. 128. 129. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 130. { 131. /* like BN_mod, but returns non-negative remainder crypto/bn/bn_mod.c:134:8: Call 132. * (i.e., 0 <= r < |d| always holds) */ 133. 134. if (!(BN_mod(r,m,d,ctx))) ^ 135. return 0; 136. if (!r->neg) crypto/bn/bn_div.c:183:1: Parameter `ctx->stack.depth` 181. * If 'dv' or 'rm' is NULL, the respective value is not returned. 182. */ 183. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 184. BN_CTX *ctx) 185. { crypto/bn/bn_div.c:230:2: Call 228. } 229. 230. BN_CTX_start(ctx); ^ 231. tmp=BN_CTX_get(ctx); 232. snum=BN_CTX_get(ctx); crypto/bn/bn_ctx.c:257:1: Parameter `ctx->stack.depth` 255. } 256. 257. > void BN_CTX_start(BN_CTX *ctx) 258. { 259. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:445:2: Call 443. } 444. if (no_branch) bn_correct_top(res); 445. BN_CTX_end(ctx); ^ 446. return(1); 447. err: crypto/bn/bn_ctx.c:272:1: Parameter `ctx->stack.depth` 270. } 271. 272. > void BN_CTX_end(BN_CTX *ctx) 273. { 274. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:279:21: Call 277. else 278. { 279. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 280. /* Does this stack frame have anything to release? */ 281. if(fp < ctx->used) crypto/bn/bn_ctx.c:353:1: <LHS trace> 351. } 352. 353. > static unsigned int BN_STACK_pop(BN_STACK *st) 354. { 355. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:353:1: Parameter `st->depth` 351. } 352. 353. > static unsigned int BN_STACK_pop(BN_STACK *st) 354. { 355. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:355:9: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_mod_exp` 353. static unsigned int BN_STACK_pop(BN_STACK *st) 354. { 355. return st->indexes[--(st->depth)]; ^ 356. } 357.
https://github.com/openssl/openssl/blob/732192a0796c4ecbef3b13ccc8ee8ab23e28f483/crypto/bn/bn_ctx.c/#L355