id
stringlengths
25
25
content
stringlengths
649
72.1k
max_stars_repo_path
stringlengths
91
133
d2a_code_trace_data_43554
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:566: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 526, column 9 is not reachable after line 566, column 5. Showing all 60 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)
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L566
d2a_code_trace_data_43555
static ossl_inline unsigned int constant_time_is_zero(unsigned int a) { return constant_time_msb(~a & (a - 1)); } ssl/statem/statem_srvr.c:2902: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `constant_time_is_zero_8`. Showing all 8 steps of the trace ssl/statem/statem_srvr.c:2849:19: Call 2847. } 2848. 2849. rsa_decrypt = OPENSSL_malloc(RSA_size(rsa)); ^ 2850. if (rsa_decrypt == NULL) { 2851. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CKE_RSA, crypto/mem.c:195:16: Unknown value from: non-const function 193. INCREMENT(malloc_count); 194. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) 195. return malloc_impl(num, file, line); ^ 196. 197. if (num == 0) ssl/statem/statem_srvr.c:2902:26: Call 2900. constant_time_eq_int_8(rsa_decrypt[1], 2); 2901. for (j = 2; j < padding_len - 1; j++) { 2902. decrypt_good &= ~constant_time_is_zero_8(rsa_decrypt[j]); ^ 2903. } 2904. decrypt_good &= constant_time_is_zero_8(rsa_decrypt[padding_len - 1]); include/internal/constant_time_locl.h:162:1: Parameter `a` 160. } 161. 162. > static ossl_inline unsigned char constant_time_is_zero_8(unsigned int a) 163. { 164. return (unsigned char)constant_time_is_zero(a); include/internal/constant_time_locl.h:164:27: Call 162. static ossl_inline unsigned char constant_time_is_zero_8(unsigned int a) 163. { 164. return (unsigned char)constant_time_is_zero(a); ^ 165. } 166. include/internal/constant_time_locl.h:152:1: <LHS trace> 150. } 151. 152. > static ossl_inline unsigned int constant_time_is_zero(unsigned int a) 153. { 154. return constant_time_msb(~a & (a - 1)); include/internal/constant_time_locl.h:152:1: Parameter `a` 150. } 151. 152. > static ossl_inline unsigned int constant_time_is_zero(unsigned int a) 153. { 154. return constant_time_msb(~a & (a - 1)); include/internal/constant_time_locl.h:154:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `constant_time_is_zero_8` 152. static ossl_inline unsigned int constant_time_is_zero(unsigned int a) 153. { 154. return constant_time_msb(~a & (a - 1)); ^ 155. } 156.
https://github.com/openssl/openssl/blob/10bc3409459a525654d6b986b3cd49d22dd95460/include/internal/constant_time_locl.h/#L154
d2a_code_trace_data_43556
off_t ngx_parse_offset(ngx_str_t *line) { u_char unit; off_t offset; size_t len; ngx_int_t scale; len = line->len; unit = line->data[len - 1]; switch (unit) { case 'K': case 'k': len--; scale = 1024; break; case 'M': case 'm': len--; scale = 1024 * 1024; break; case 'G': case 'g': len--; scale = 1024 * 1024 * 1024; break; default: scale = 1; } offset = ngx_atoof(line->data, len); if (offset == NGX_ERROR) { return NGX_ERROR; } offset *= scale; return offset; } src/http/ngx_http_core_module.c:3807: error: Integer Overflow L2 ([0, +oo] - 1):unsigned64 by call to `ngx_parse_offset`. src/http/ngx_http_core_module.c:3807:22: Call 3805. } 3806. 3807. clcf->directio = ngx_parse_offset(&value[1]); ^ 3808. if (clcf->directio == (off_t) NGX_ERROR) { 3809. return "invalid value"; src/core/ngx_parse.c:50:1: <LHS trace> 48. 49. 50. off_t ^ 51. ngx_parse_offset(ngx_str_t *line) 52. { src/core/ngx_parse.c:50:1: Parameter `line->len` 48. 49. 50. off_t ^ 51. ngx_parse_offset(ngx_str_t *line) 52. { src/core/ngx_parse.c:58:5: Assignment 56. ngx_int_t scale; 57. 58. len = line->len; ^ 59. unit = line->data[len - 1]; 60. src/core/ngx_parse.c:59:12: Binary operation: ([0, +oo] - 1):unsigned64 by call to `ngx_parse_offset` 57. 58. len = line->len; 59. unit = line->data[len - 1]; ^ 60. 61. switch (unit) {
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_parse.c/#L59
d2a_code_trace_data_43557
static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type) { OutputStream *ost; AVStream *st = avformat_new_stream(oc, NULL); int idx = oc->nb_streams - 1, ret = 0; char *bsf = NULL, *next, *codec_tag = NULL; AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; double qscale = -1; char *buf = NULL, *arg = NULL, *preset = NULL; AVIOContext *s = NULL; if (!st) { av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n"); exit_program(1); } if (oc->nb_streams - 1 < o->nb_streamid_map) st->id = o->streamid_map[oc->nb_streams - 1]; output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams, nb_output_streams + 1); ost = &output_streams[nb_output_streams - 1]; ost->file_index = nb_output_files; ost->index = idx; ost->st = st; st->codec->codec_type = type; choose_encoder(o, oc, ost); if (ost->enc) { ost->opts = filter_codec_opts(codec_opts, ost->enc->id, oc, st); } avcodec_get_context_defaults3(st->codec, ost->enc); st->codec->codec_type = type; MATCH_PER_STREAM_OPT(presets, str, preset, oc, st); if (preset && (!(ret = get_preset_file_2(preset, ost->enc->name, &s)))) { do { buf = get_line(s); if (!buf[0] || buf[0] == '#') { av_free(buf); continue; } if (!(arg = strchr(buf, '='))) { av_log(NULL, AV_LOG_FATAL, "Invalid line found in the preset file.\n"); exit_program(1); } *arg++ = 0; av_dict_set(&ost->opts, buf, arg, AV_DICT_DONT_OVERWRITE); av_free(buf); } while (!s->eof_reached); avio_close(s); } if (ret) { av_log(NULL, AV_LOG_FATAL, "Preset %s specified for stream %d:%d, but could not be opened.\n", preset, ost->file_index, ost->index); exit_program(1); } ost->max_frames = INT64_MAX; MATCH_PER_STREAM_OPT(max_frames, i64, ost->max_frames, oc, st); MATCH_PER_STREAM_OPT(bitstream_filters, str, bsf, oc, st); while (bsf) { if (next = strchr(bsf, ',')) *next++ = 0; if (!(bsfc = av_bitstream_filter_init(bsf))) { av_log(NULL, AV_LOG_FATAL, "Unknown bitstream filter %s\n", bsf); exit_program(1); } if (bsfc_prev) bsfc_prev->next = bsfc; else ost->bitstream_filters = bsfc; bsfc_prev = bsfc; bsf = next; } MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, oc, st); if (codec_tag) { uint32_t tag = strtol(codec_tag, &next, 0); if (*next) tag = AV_RL32(codec_tag); st->codec->codec_tag = tag; } MATCH_PER_STREAM_OPT(qscale, dbl, qscale, oc, st); if (qscale >= 0 || same_quant) { st->codec->flags |= CODEC_FLAG_QSCALE; st->codec->global_quality = FF_QP2LAMBDA * qscale; } if (oc->oformat->flags & AVFMT_GLOBALHEADER) st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER; av_opt_get_int(sws_opts, "sws_flags", 0, &ost->sws_flags); return ost; } avconv.c:3170: error: Null Dereference pointer `st` last assigned on line 3156 could be null and is dereferenced at line 3170, column 9. avconv.c:3153:1: start of procedure new_output_stream() 3151. } 3152. 3153. static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type) ^ 3154. { 3155. OutputStream *ost; avconv.c:3156:5: 3154. { 3155. OutputStream *ost; 3156. AVStream *st = avformat_new_stream(oc, NULL); ^ 3157. int idx = oc->nb_streams - 1, ret = 0; 3158. char *bsf = NULL, *next, *codec_tag = NULL; libavformat/utils.c:2701:1: start of procedure avformat_new_stream() 2699. #endif 2700. 2701. AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c) ^ 2702. { 2703. AVStream *st; libavformat/utils.c:2707:9: Taking true branch 2705. AVStream **streams; 2706. 2707. if (s->nb_streams >= INT_MAX/sizeof(*streams)) ^ 2708. return NULL; 2709. streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams)); libavformat/utils.c:2708:9: 2706. 2707. if (s->nb_streams >= INT_MAX/sizeof(*streams)) 2708. return NULL; ^ 2709. streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams)); 2710. if (!streams) libavformat/utils.c:2749:1: return from a call to avformat_new_stream 2747. s->streams[s->nb_streams++] = st; 2748. return st; 2749. } ^ 2750. 2751. AVProgram *av_new_program(AVFormatContext *ac, int id) avconv.c:3157:5: 3155. OutputStream *ost; 3156. AVStream *st = avformat_new_stream(oc, NULL); 3157. int idx = oc->nb_streams - 1, ret = 0; ^ 3158. char *bsf = NULL, *next, *codec_tag = NULL; 3159. AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; avconv.c:3158:5: 3156. AVStream *st = avformat_new_stream(oc, NULL); 3157. int idx = oc->nb_streams - 1, ret = 0; 3158. char *bsf = NULL, *next, *codec_tag = NULL; ^ 3159. AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; 3160. double qscale = -1; avconv.c:3159:5: 3157. int idx = oc->nb_streams - 1, ret = 0; 3158. char *bsf = NULL, *next, *codec_tag = NULL; 3159. AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; ^ 3160. double qscale = -1; 3161. char *buf = NULL, *arg = NULL, *preset = NULL; avconv.c:3160:5: 3158. char *bsf = NULL, *next, *codec_tag = NULL; 3159. AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; 3160. double qscale = -1; ^ 3161. char *buf = NULL, *arg = NULL, *preset = NULL; 3162. AVIOContext *s = NULL; avconv.c:3161:5: 3159. AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; 3160. double qscale = -1; 3161. char *buf = NULL, *arg = NULL, *preset = NULL; ^ 3162. AVIOContext *s = NULL; 3163. avconv.c:3162:5: 3160. double qscale = -1; 3161. char *buf = NULL, *arg = NULL, *preset = NULL; 3162. AVIOContext *s = NULL; ^ 3163. 3164. if (!st) { avconv.c:3164:10: Taking true branch 3162. AVIOContext *s = NULL; 3163. 3164. if (!st) { ^ 3165. av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n"); 3166. exit_program(1); avconv.c:3165:9: Skipping av_log(): empty list of specs 3163. 3164. if (!st) { 3165. av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n"); ^ 3166. exit_program(1); 3167. } avconv.c:3166:9: Skipping exit_program(): empty list of specs 3164. if (!st) { 3165. av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n"); 3166. exit_program(1); ^ 3167. } 3168. avconv.c:3169:9: Taking true branch 3167. } 3168. 3169. if (oc->nb_streams - 1 < o->nb_streamid_map) ^ 3170. st->id = o->streamid_map[oc->nb_streams - 1]; 3171. avconv.c:3170:9: 3168. 3169. if (oc->nb_streams - 1 < o->nb_streamid_map) 3170. st->id = o->streamid_map[oc->nb_streams - 1]; ^ 3171. 3172. output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams,
https://github.com/libav/libav/blob/e1edfbcb240cace69d92701e6910c2b03555b7d7/avconv.c/#L3170
d2a_code_trace_data_43558
static int build_chain(X509_STORE_CTX *ctx) { int (*cb) (int, X509_STORE_CTX *) = ctx->verify_cb; int num = sk_X509_num(ctx->chain); X509 *cert = sk_X509_value(ctx->chain, num - 1); int ss = cert_self_signed(cert); STACK_OF(X509) *sktmp = NULL; unsigned int search; int may_trusted = 1; int may_alternate = 0; int trust = X509_TRUST_UNTRUSTED; int alt_untrusted = 0; int depth; int ok = 0; int i; OPENSSL_assert(num == 1 && ctx->num_untrusted == num); #define S_DOUNTRUSTED (1 << 0) #define S_DOTRUSTED (1 << 1) #define S_DOALTERNATE (1 << 2) search = (ctx->untrusted != NULL) ? S_DOUNTRUSTED : 0; if (search == 0 || ctx->param->flags & X509_V_FLAG_TRUSTED_FIRST) search |= S_DOTRUSTED; else if (!(ctx->param->flags & X509_V_FLAG_NO_ALT_CHAINS)) may_alternate = 1; if (ctx->untrusted && (sktmp = sk_X509_dup(ctx->untrusted)) == NULL) { X509err(X509_F_BUILD_CHAIN, ERR_R_MALLOC_FAILURE); return 0; } if (ctx->param->depth > INT_MAX/2) ctx->param->depth = INT_MAX/2; depth = ctx->param->depth + 1; while (search != 0) { X509 *x; X509 *xtmp = NULL; if ((search & S_DOTRUSTED) != 0) { STACK_OF(X509) *hide = ctx->chain; i = num = sk_X509_num(ctx->chain); if ((search & S_DOALTERNATE) != 0) { i = alt_untrusted; } x = sk_X509_value(ctx->chain, i-1); ctx->chain = NULL; ok = (depth < num) ? 0 : ctx->get_issuer(&xtmp, ctx, x); ctx->chain = hide; if (ok < 0) { trust = X509_TRUST_REJECTED; search = 0; continue; } if (ok > 0) { if ((search & S_DOALTERNATE) != 0) { OPENSSL_assert(num > i && i > 0 && ss == 0); search &= ~S_DOALTERNATE; for (; num > i; --num) X509_free(sk_X509_pop(ctx->chain)); ctx->num_untrusted = num; } if (ss == 0) { if (!sk_X509_push(ctx->chain, x = xtmp)) { X509_free(xtmp); X509err(X509_F_BUILD_CHAIN, ERR_R_MALLOC_FAILURE); trust = X509_TRUST_REJECTED; search = 0; continue; } ss = cert_self_signed(x); } else if (num == ctx->num_untrusted) { if (X509_cmp(x, xtmp) != 0) { X509_free(xtmp); ok = 0; } else { X509_free(x); ctx->num_untrusted = --num; (void) sk_X509_set(ctx->chain, num, x = xtmp); } } if (ok) { OPENSSL_assert(ctx->num_untrusted <= num); search &= ~S_DOUNTRUSTED; switch (trust = check_trust(ctx, num)) { case X509_TRUST_TRUSTED: case X509_TRUST_REJECTED: search = 0; continue; } if (ss == 0) continue; } } if ((search & S_DOUNTRUSTED) == 0) { if ((search & S_DOALTERNATE) != 0 && --alt_untrusted > 0) continue; if (!may_alternate || (search & S_DOALTERNATE) != 0 || ctx->num_untrusted < 2) break; search |= S_DOALTERNATE; alt_untrusted = ctx->num_untrusted - 1; ss = 0; } } if ((search & S_DOUNTRUSTED) != 0) { num = sk_X509_num(ctx->chain); OPENSSL_assert(num == ctx->num_untrusted); x = sk_X509_value(ctx->chain, num-1); xtmp = (depth < num) ? NULL : find_issuer(ctx, sktmp, x); if (xtmp == NULL) { search &= ~S_DOUNTRUSTED; if (may_trusted) search |= S_DOTRUSTED; continue; } if (!sk_X509_push(ctx->chain, x = xtmp)) { X509err(X509_F_BUILD_CHAIN, ERR_R_MALLOC_FAILURE); trust = X509_TRUST_REJECTED; search = 0; continue; } X509_up_ref(x); ++ctx->num_untrusted; ss = cert_self_signed(xtmp); (void) sk_X509_delete_ptr(sktmp, x); } } sk_X509_free(sktmp); if (sk_X509_num(ctx->chain) <= depth) { if (trust == X509_TRUST_UNTRUSTED && sk_X509_num(ctx->chain) == ctx->num_untrusted) trust = check_trust(ctx, 1); } switch (trust) { case X509_TRUST_TRUSTED: return 1; case X509_TRUST_REJECTED: return 0; case X509_TRUST_UNTRUSTED: default: num = sk_X509_num(ctx->chain); ctx->current_cert = sk_X509_value(ctx->chain, num - 1); ctx->error_depth = num-1; if (num > depth) ctx->error = X509_V_ERR_CERT_CHAIN_TOO_LONG; else if (ss && sk_X509_num(ctx->chain) == 1) ctx->error = X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT; else if (ss) ctx->error = X509_V_ERR_SELF_SIGNED_CERT_IN_CHAIN; else if (ctx->num_untrusted == num) ctx->error = X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY; else ctx->error = X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT; return cb(0, ctx); } } crypto/x509/x509_vfy.c:2271: error: NULL_DEREFERENCE pointer `cert` last assigned on line 2270 could be null and is dereferenced by call to `cert_self_signed()` at line 2271, column 14. Showing all 19 steps of the trace crypto/x509/x509_vfy.c:2266:1: start of procedure build_chain() 2264. } 2265. 2266. > static int build_chain(X509_STORE_CTX *ctx) 2267. { 2268. int (*cb) (int, X509_STORE_CTX *) = ctx->verify_cb; crypto/x509/x509_vfy.c:2268:5: 2266. static int build_chain(X509_STORE_CTX *ctx) 2267. { 2268. > int (*cb) (int, X509_STORE_CTX *) = ctx->verify_cb; 2269. int num = sk_X509_num(ctx->chain); 2270. X509 *cert = sk_X509_value(ctx->chain, num - 1); crypto/x509/x509_vfy.c:2269:15: Condition is true 2267. { 2268. int (*cb) (int, X509_STORE_CTX *) = ctx->verify_cb; 2269. int num = sk_X509_num(ctx->chain); ^ 2270. X509 *cert = sk_X509_value(ctx->chain, num - 1); 2271. int ss = cert_self_signed(cert); crypto/x509/x509_vfy.c:2269:5: 2267. { 2268. int (*cb) (int, X509_STORE_CTX *) = ctx->verify_cb; 2269. > int num = sk_X509_num(ctx->chain); 2270. X509 *cert = sk_X509_value(ctx->chain, num - 1); 2271. int ss = cert_self_signed(cert); crypto/stack/stack.c:317:1: start of procedure sk_num() 315. } 316. 317. > int sk_num(const _STACK *st) 318. { 319. if (st == NULL) crypto/stack/stack.c:319:9: Taking false branch 317. int sk_num(const _STACK *st) 318. { 319. if (st == NULL) ^ 320. return -1; 321. return st->num; crypto/stack/stack.c:321:5: 319. if (st == NULL) 320. return -1; 321. > return st->num; 322. } 323. crypto/stack/stack.c:322:1: return from a call to sk_num 320. return -1; 321. return st->num; 322. > } 323. 324. void *sk_value(const _STACK *st, int i) crypto/x509/x509_vfy.c:2270:18: Condition is true 2268. int (*cb) (int, X509_STORE_CTX *) = ctx->verify_cb; 2269. int num = sk_X509_num(ctx->chain); 2270. X509 *cert = sk_X509_value(ctx->chain, num - 1); ^ 2271. int ss = cert_self_signed(cert); 2272. STACK_OF(X509) *sktmp = NULL; crypto/x509/x509_vfy.c:2270:5: 2268. int (*cb) (int, X509_STORE_CTX *) = ctx->verify_cb; 2269. int num = sk_X509_num(ctx->chain); 2270. > X509 *cert = sk_X509_value(ctx->chain, num - 1); 2271. int ss = cert_self_signed(cert); 2272. STACK_OF(X509) *sktmp = NULL; crypto/stack/stack.c:324:1: start of procedure sk_value() 322. } 323. 324. > void *sk_value(const _STACK *st, int i) 325. { 326. if (!st || (i < 0) || (i >= st->num)) crypto/stack/stack.c:326:10: Taking false branch 324. void *sk_value(const _STACK *st, int i) 325. { 326. if (!st || (i < 0) || (i >= st->num)) ^ 327. return NULL; 328. return st->data[i]; crypto/stack/stack.c:326:17: Taking true branch 324. void *sk_value(const _STACK *st, int i) 325. { 326. if (!st || (i < 0) || (i >= st->num)) ^ 327. return NULL; 328. return st->data[i]; crypto/stack/stack.c:327:9: 325. { 326. if (!st || (i < 0) || (i >= st->num)) 327. > return NULL; 328. return st->data[i]; 329. } crypto/stack/stack.c:329:1: return from a call to sk_value 327. return NULL; 328. return st->data[i]; 329. > } 330. 331. void *sk_set(_STACK *st, int i, void *value) crypto/x509/x509_vfy.c:2271:5: 2269. int num = sk_X509_num(ctx->chain); 2270. X509 *cert = sk_X509_value(ctx->chain, num - 1); 2271. > int ss = cert_self_signed(cert); 2272. STACK_OF(X509) *sktmp = NULL; 2273. unsigned int search; crypto/x509/x509_vfy.c:152:1: start of procedure cert_self_signed() 150. 151. /* Return 1 is a certificate is self signed */ 152. > static int cert_self_signed(X509 *x) 153. { 154. /* crypto/x509/x509_vfy.c:159:5: Skipping X509_check_purpose(): empty list of specs 157. * parse errors, rather than memory pressure! 158. */ 159. X509_check_purpose(x, -1, 0); ^ 160. if (x->ex_flags & EXFLAG_SS) 161. return 1; crypto/x509/x509_vfy.c:160:9: 158. */ 159. X509_check_purpose(x, -1, 0); 160. > if (x->ex_flags & EXFLAG_SS) 161. return 1; 162. else
https://github.com/openssl/openssl/blob/e29c73c93b88a4b7f492c7c8c7343223e7548612/crypto/x509/x509_vfy.c/#L2271
d2a_code_trace_data_43559
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { if (!ossl_assert(pkt->subs != NULL && len != 0)) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } if (allocbytes != NULL) *allocbytes = WPACKET_get_curr(pkt); return 1; } ssl/statem/extensions.c:1214: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 4]):unsigned64 by call to `construct_ca_names`. Showing all 14 steps of the trace ssl/statem/extensions.c:1207:13: Call 1205. 1206. if (!WPACKET_put_bytes_u16(pkt, TLSEXT_TYPE_certificate_authorities) 1207. || !WPACKET_start_sub_packet_u16(pkt)) { ^ 1208. SSLfatal(s, SSL_AD_INTERNAL_ERROR, 1209. SSL_F_TLS_CONSTRUCT_CERTIFICATE_AUTHORITIES, ssl/packet.c:272:1: Parameter `pkt->buf->length` 270. } 271. 272. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 273. { 274. WPACKET_SUB *sub; ssl/statem/extensions.c:1214:10: Call 1212. } 1213. 1214. if (!construct_ca_names(s, ca_sk, pkt)) { ^ 1215. /* SSLfatal() already called */ 1216. return EXT_RETURN_FAIL; ssl/statem/statem_lib.c:2306:1: Parameter `pkt->written` 2304. } 2305. 2306. > int construct_ca_names(SSL *s, const STACK_OF(X509_NAME) *ca_sk, WPACKET *pkt) 2307. { 2308. /* Start sub-packet for client CA list */ ssl/statem/statem_lib.c:2309:10: Call 2307. { 2308. /* Start sub-packet for client CA list */ 2309. if (!WPACKET_start_sub_packet_u16(pkt)) { ^ 2310. SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_CONSTRUCT_CA_NAMES, 2311. ERR_R_INTERNAL_ERROR); ssl/packet.c:272:1: Parameter `pkt->written` 270. } 271. 272. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 273. { 274. WPACKET_SUB *sub; ssl/packet.c:296:10: Call 294. } 295. 296. if (!WPACKET_allocate_bytes(pkt, lenbytes, &lenchars)) ^ 297. return 0; 298. /* Convert to an offset in case the underlying BUF_MEM gets realloc'd */ 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 `construct_ca_names` 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/6e68dae85a8f91944370125561c7ec0d5da46c20/ssl/packet.c/#L49
d2a_code_trace_data_43560
char *BN_bn2dec(const BIGNUM *a) { int i = 0, num, ok = 0; char *buf = NULL; char *p; BIGNUM *t = NULL; BN_ULONG *bn_data = NULL, *lp; int bn_data_num; i = BN_num_bits(a) * 3; num = (i / 10 + i / 1000 + 1) + 1; bn_data_num = num / BN_DEC_NUM + 1; bn_data = OPENSSL_malloc(bn_data_num * sizeof(BN_ULONG)); buf = OPENSSL_malloc(num + 3); if ((buf == NULL) || (bn_data == NULL)) { BNerr(BN_F_BN_BN2DEC, ERR_R_MALLOC_FAILURE); goto err; } if ((t = BN_dup(a)) == NULL) goto err; #define BUF_REMAIN (num+3 - (size_t)(p - buf)) p = buf; lp = bn_data; if (BN_is_zero(t)) { *(p++) = '0'; *(p++) = '\0'; } else { if (BN_is_negative(t)) *p++ = '-'; while (!BN_is_zero(t)) { if (lp - bn_data >= bn_data_num) goto err; *lp = BN_div_word(t, BN_DEC_CONV); if (*lp == (BN_ULONG)-1) goto err; lp++; } lp--; BIO_snprintf(p, BUF_REMAIN, BN_DEC_FMT1, *lp); while (*p) p++; while (lp != bn_data) { lp--; BIO_snprintf(p, BUF_REMAIN, BN_DEC_FMT2, *lp); while (*p) p++; } } ok = 1; err: OPENSSL_free(bn_data); BN_free(t); if (ok) return buf; OPENSSL_free(buf); return NULL; } crypto/bn/bn_print.c:104: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [0, +oo]. Showing all 12 steps of the trace crypto/bn/bn_print.c:68:9: <Length trace> 66. * <= 3 * BN_num_bits(a) / 10 + 3 * BN_num_bits / 1000 + 1 + 1 67. */ 68. i = BN_num_bits(a) * 3; ^ 69. num = (i / 10 + i / 1000 + 1) + 1; 70. bn_data_num = num / BN_DEC_NUM + 1; crypto/bn/bn_print.c:68:9: Call 66. * <= 3 * BN_num_bits(a) / 10 + 3 * BN_num_bits / 1000 + 1 + 1 67. */ 68. i = BN_num_bits(a) * 3; ^ 69. num = (i / 10 + i / 1000 + 1) + 1; 70. bn_data_num = num / BN_DEC_NUM + 1; 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_print.c:68:5: Assignment 66. * <= 3 * BN_num_bits(a) / 10 + 3 * BN_num_bits / 1000 + 1 + 1 67. */ 68. i = BN_num_bits(a) * 3; ^ 69. num = (i / 10 + i / 1000 + 1) + 1; 70. bn_data_num = num / BN_DEC_NUM + 1; crypto/bn/bn_print.c:69:5: Assignment 67. */ 68. i = BN_num_bits(a) * 3; 69. num = (i / 10 + i / 1000 + 1) + 1; ^ 70. bn_data_num = num / BN_DEC_NUM + 1; 71. bn_data = OPENSSL_malloc(bn_data_num * sizeof(BN_ULONG)); crypto/bn/bn_print.c:70:5: Assignment 68. i = BN_num_bits(a) * 3; 69. num = (i / 10 + i / 1000 + 1) + 1; 70. bn_data_num = num / BN_DEC_NUM + 1; ^ 71. bn_data = OPENSSL_malloc(bn_data_num * sizeof(BN_ULONG)); 72. buf = OPENSSL_malloc(num + 3); crypto/bn/bn_print.c:71:15: Call 69. num = (i / 10 + i / 1000 + 1) + 1; 70. bn_data_num = num / BN_DEC_NUM + 1; 71. bn_data = OPENSSL_malloc(bn_data_num * sizeof(BN_ULONG)); ^ 72. buf = OPENSSL_malloc(num + 3); 73. if ((buf == NULL) || (bn_data == NULL)) { crypto/mem.c:166:9: Assignment 164. 165. if (num == 0) 166. return NULL; ^ 167. 168. FAILTEST(); crypto/bn/bn_print.c:71:5: Assignment 69. num = (i / 10 + i / 1000 + 1) + 1; 70. bn_data_num = num / BN_DEC_NUM + 1; 71. bn_data = OPENSSL_malloc(bn_data_num * sizeof(BN_ULONG)); ^ 72. buf = OPENSSL_malloc(num + 3); 73. if ((buf == NULL) || (bn_data == NULL)) { crypto/bn/bn_print.c:82:5: Assignment 80. #define BUF_REMAIN (num+3 - (size_t)(p - buf)) 81. p = buf; 82. lp = bn_data; ^ 83. if (BN_is_zero(t)) { 84. *(p++) = '0'; crypto/bn/bn_print.c:98:9: Assignment 96. lp++; 97. } 98. lp--; ^ 99. /* 100. * We now have a series of blocks, BN_DEC_NUM chars in length, where crypto/bn/bn_print.c:104:50: Array access: Offset: [-1, +oo] Size: [0, +oo] 102. * order. 103. */ 104. BIO_snprintf(p, BUF_REMAIN, BN_DEC_FMT1, *lp); ^ 105. while (*p) 106. p++;
https://github.com/openssl/openssl/blob/3f97052392cb10fca5309212bf720685262ad4a6/crypto/bn/bn_print.c/#L104
d2a_code_trace_data_43561
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) { int i, j, max; const BN_ULONG *ap; BN_ULONG *rp; max = n * 2; ap = a; rp = r; rp[0] = rp[max - 1] = 0; rp++; j = n; if (--j > 0) { ap++; rp[j] = bn_mul_words(rp, ap, j, ap[-1]); rp += 2; } for (i = n - 2; i > 0; i--) { j--; ap++; rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]); rp += 2; } bn_add_words(r, r, r, max); bn_sqr_words(tmp, a, n); bn_add_words(r, r, tmp, max); } crypto/dsa/dsa_ossl.c:285: error: BUFFER_OVERRUN_L3 Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_mod_mul`. Showing all 17 steps of the trace crypto/dsa/dsa_ossl.c:281:10: Call 279. 280. /* u1 = M * w mod q */ 281. if (!BN_mod_mul(u1, u1, u2, dsa->q, ctx)) ^ 282. goto err; 283. crypto/bn/bn_mod.c:73:1: Parameter `r->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/dsa/dsa_ossl.c:285:10: Call 283. 284. /* u2 = r * w mod q */ 285. if (!BN_mod_mul(u2, r, u2, dsa->q, ctx)) ^ 286. goto err; 287. 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:115:5: Assignment 113. rp[0] = rp[max - 1] = 0; 114. rp++; 115. j = n; ^ 116. 117. if (--j > 0) { crypto/bn/bn_sqr.c:117:9: Assignment 115. j = n; 116. 117. if (--j > 0) { ^ 118. ap++; 119. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); 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:114:5: Assignment 112. rp = r; 113. rp[0] = rp[max - 1] = 0; 114. rp++; ^ 115. j = n; 116. crypto/bn/bn_sqr.c:119:9: Array access: Offset: [16, +oo] (⇐ 1 + [15, +oo]) Size: [0, 8388607] by call to `BN_mod_mul` 117. if (--j > 0) { 118. ap++; 119. rp[j] = bn_mul_words(rp, ap, j, ap[-1]); ^ 120. rp += 2; 121. }
https://github.com/openssl/openssl/blob/aa951ef3d745aa0c32b984fd9be2cc21382b97f6/crypto/bn/bn_sqr.c/#L119
d2a_code_trace_data_43562
void TIFFSwabLong8(uint64* lp) { register unsigned char* cp = (unsigned char*) lp; unsigned char t; assert(sizeof(uint64)==8); t = cp[7]; cp[7] = cp[0]; cp[0] = t; t = cp[6]; cp[6] = cp[1]; cp[1] = t; t = cp[5]; cp[5] = cp[2]; cp[2] = t; t = cp[4]; cp[4] = cp[3]; cp[3] = t; } libtiff/tif_dirread.c:1143: error: Buffer Overrun L3 Offset: [7, +oo] (⇐ [0, +oo] + 7) Size: [0, +oo] by call to `TIFFSwabLong8`. libtiff/tif_dirread.c:1022:6: Call 1020. return(TIFFReadDirEntryErrType); 1021. } 1022. err=TIFFReadDirEntryArray(tif,direntry,&count,1,&origdata); ^ 1023. if ((err!=TIFFReadDirEntryErrOk)||(origdata==0)) 1024. { libtiff/tif_dirread.c:756:1: Parameter `**value` 754. } 755. 756. static enum TIFFReadDirEntryErr TIFFReadDirEntryArray(TIFF* tif, TIFFDirEntry* direntry, uint32* count, uint32 desttypesize, void** value) ^ 757. { 758. int typesize; libtiff/tif_dirread.c:1138:5: Assignment 1136. int8* mb; 1137. uint32 n; 1138. ma=(uint64*)origdata; ^ 1139. mb=data; 1140. for (n=0; n<count; n++) libtiff/tif_dirread.c:1143:7: Call 1141. { 1142. if (tif->tif_flags&TIFF_SWAB) 1143. TIFFSwabLong8(ma); ^ 1144. err=TIFFReadDirEntryCheckRangeSbyteLong8(*ma); 1145. if (err!=TIFFReadDirEntryErrOk) libtiff/tif_swab.c:58:1: <Length trace> 56. 57. #ifndef TIFFSwabLong8 58. void ^ 59. TIFFSwabLong8(uint64* lp) 60. { libtiff/tif_swab.c:58:1: Parameter `*lp` 56. 57. #ifndef TIFFSwabLong8 58. void ^ 59. TIFFSwabLong8(uint64* lp) 60. { libtiff/tif_swab.c:61:2: Assignment 59. TIFFSwabLong8(uint64* lp) 60. { 61. register unsigned char* cp = (unsigned char*) lp; ^ 62. unsigned char t; 63. assert(sizeof(uint64)==8); libtiff/tif_swab.c:64:6: Array access: Offset: [7, +oo] (⇐ [0, +oo] + 7) Size: [0, +oo] by call to `TIFFSwabLong8` 62. unsigned char t; 63. assert(sizeof(uint64)==8); 64. t = cp[7]; cp[7] = cp[0]; cp[0] = t; ^ 65. t = cp[6]; cp[6] = cp[1]; cp[1] = t; 66. t = cp[5]; cp[5] = cp[2]; cp[2] = t;
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_swab.c/#L64
d2a_code_trace_data_43563
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/sm2/sm2_crypt.c:171: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `BN_priv_rand_range`. Showing all 20 steps of the trace crypto/sm2/sm2_crypt.c:150:9: Call 148. 149. BN_CTX_start(ctx); 150. k = BN_CTX_get(ctx); ^ 151. x1 = BN_CTX_get(ctx); 152. x2 = 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:367:15: Assignment 365. a->neg = 0; 366. a->d[0] = w; 367. a->top = (w ? 1 : 0); ^ 368. bn_check_top(a); 369. return 1; crypto/bn/bn_lib.c:367:5: Assignment 365. a->neg = 0; 366. a->d[0] = w; 367. a->top = (w ? 1 : 0); ^ 368. bn_check_top(a); 369. return 1; crypto/sm2/sm2_crypt.c:171:10: Call 169. memset(ciphertext_buf, 0, *ciphertext_len); 170. 171. if (!BN_priv_rand_range(k, order)) { ^ 172. SM2err(SM2_F_SM2_ENCRYPT, ERR_R_INTERNAL_ERROR); 173. goto done; crypto/bn/bn_rand.c:182:1: Parameter `*r->d` 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->d` 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:360:1: Parameter `*a->d` 358. } 359. 360. > int BN_set_word(BIGNUM *a, BN_ULONG w) 361. { 362. bn_check_top(a); crypto/bn/bn_lib.c:363:9: Call 361. { 362. bn_check_top(a); 363. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 364. return 0; 365. a->neg = 0; crypto/bn/bn_lcl.h:651:1: Parameter `*a->d` 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->d` 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 `*b->d` 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:233:9: Array access: Offset added: [8, +oo] Size: [0, 536870848] 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/630fe1da888490b7dfef3fe0928b813ddff5d51a/crypto/bn/bn_lib.c/#L233
d2a_code_trace_data_43564
static void opt_output_file(const char *filename) { AVFormatContext *oc; int err, use_video, use_audio, use_subtitle, use_data; int input_has_video, input_has_audio, input_has_subtitle, input_has_data; AVFormatParameters params, *ap = &params; AVOutputFormat *file_oformat; if (!strcmp(filename, "-")) filename = "pipe:"; oc = avformat_alloc_context(); if (!oc) { print_error(filename, AVERROR(ENOMEM)); ffmpeg_exit(1); } if (last_asked_format) { file_oformat = av_guess_format(last_asked_format, NULL, NULL); if (!file_oformat) { fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format); ffmpeg_exit(1); } last_asked_format = NULL; } else { file_oformat = av_guess_format(NULL, filename, NULL); if (!file_oformat) { fprintf(stderr, "Unable to find a suitable output format for '%s'\n", filename); ffmpeg_exit(1); } } oc->oformat = file_oformat; av_strlcpy(oc->filename, filename, sizeof(oc->filename)); if (!strcmp(file_oformat->name, "ffm") && av_strstart(filename, "http:", NULL)) { int err = read_ffserver_streams(oc, filename); if (err < 0) { print_error(filename, err); ffmpeg_exit(1); } } else { use_video = file_oformat->video_codec != CODEC_ID_NONE || video_stream_copy || video_codec_name; use_audio = file_oformat->audio_codec != CODEC_ID_NONE || audio_stream_copy || audio_codec_name; use_subtitle = file_oformat->subtitle_codec != CODEC_ID_NONE || subtitle_stream_copy || subtitle_codec_name; use_data = data_stream_copy || data_codec_name; if (nb_input_files > 0) { check_inputs(&input_has_video, &input_has_audio, &input_has_subtitle, &input_has_data); if (!input_has_video) use_video = 0; if (!input_has_audio) use_audio = 0; if (!input_has_subtitle) use_subtitle = 0; if (!input_has_data) use_data = 0; } if (audio_disable) use_audio = 0; if (video_disable) use_video = 0; if (subtitle_disable) use_subtitle = 0; if (data_disable) use_data = 0; if (use_video) new_video_stream(oc, nb_output_files); if (use_audio) new_audio_stream(oc, nb_output_files); if (use_subtitle) new_subtitle_stream(oc, nb_output_files); if (use_data) new_data_stream(oc, nb_output_files); oc->timestamp = recording_timestamp; av_metadata_copy(&oc->metadata, metadata, 0); av_metadata_free(&metadata); } output_files[nb_output_files++] = oc; if (oc->oformat->flags & AVFMT_NEEDNUMBER) { if (!av_filename_number_test(oc->filename)) { print_error(oc->filename, AVERROR(EINVAL)); ffmpeg_exit(1); } } if (!(oc->oformat->flags & AVFMT_NOFILE)) { if (!file_overwrite && (strchr(filename, ':') == NULL || filename[1] == ':' || av_strstart(filename, "file:", NULL))) { if (avio_check(filename, 0) == 0) { if (!using_stdin) { fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename); fflush(stderr); if (!read_yesno()) { fprintf(stderr, "Not overwriting - exiting\n"); ffmpeg_exit(1); } } else { fprintf(stderr,"File '%s' already exists. Exiting.\n", filename); ffmpeg_exit(1); } } } if ((err = avio_open(&oc->pb, filename, AVIO_FLAG_WRITE)) < 0) { print_error(filename, err); ffmpeg_exit(1); } } memset(ap, 0, sizeof(*ap)); if (av_set_parameters(oc, ap) < 0) { fprintf(stderr, "%s: Invalid encoding parameters\n", oc->filename); ffmpeg_exit(1); } oc->preload= (int)(mux_preload*AV_TIME_BASE); oc->max_delay= (int)(mux_max_delay*AV_TIME_BASE); oc->loop_output = loop_output; oc->flags |= AVFMT_FLAG_NONBLOCK; set_context_opts(oc, avformat_opts, AV_OPT_FLAG_ENCODING_PARAM, NULL); av_freep(&forced_key_frames); uninit_opts(); init_opts(); } ffmpeg.c:3752: error: Null Dereference pointer `oc` last assigned on line 3730 could be null and is dereferenced at line 3752, column 5. ffmpeg.c:3719:1: start of procedure opt_output_file() 3717. } 3718. 3719. static void opt_output_file(const char *filename) ^ 3720. { 3721. AVFormatContext *oc; ffmpeg.c:3724:5: 3722. int err, use_video, use_audio, use_subtitle, use_data; 3723. int input_has_video, input_has_audio, input_has_subtitle, input_has_data; 3724. AVFormatParameters params, *ap = &params; ^ 3725. AVOutputFormat *file_oformat; 3726. ffmpeg.c:3727:10: Taking false branch 3725. AVOutputFormat *file_oformat; 3726. 3727. if (!strcmp(filename, "-")) ^ 3728. filename = "pipe:"; 3729. ffmpeg.c:3730:5: 3728. filename = "pipe:"; 3729. 3730. oc = avformat_alloc_context(); ^ 3731. if (!oc) { 3732. print_error(filename, AVERROR(ENOMEM)); libavformat/options.c:78:1: start of procedure avformat_alloc_context() 76. } 77. 78. AVFormatContext *avformat_alloc_context(void) ^ 79. { 80. AVFormatContext *ic; libavformat/options.c:81:5: 79. { 80. AVFormatContext *ic; 81. ic = av_malloc(sizeof(AVFormatContext)); ^ 82. if (!ic) return ic; 83. avformat_get_context_defaults(ic); libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) ^ 73. return NULL; 74. libavutil/mem.c:83:9: Taking false branch 81. ((char*)ptr)[-1]= diff; 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,32,size)) ^ 84. ptr = NULL; 85. #elif HAVE_MEMALIGN libavutil/mem.c:114:5: 112. ptr = malloc(size); 113. #endif 114. return ptr; ^ 115. } 116. libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavformat/options.c:82:10: Taking true branch 80. AVFormatContext *ic; 81. ic = av_malloc(sizeof(AVFormatContext)); 82. if (!ic) return ic; ^ 83. avformat_get_context_defaults(ic); 84. ic->av_class = &av_format_context_class; libavformat/options.c:82:14: 80. AVFormatContext *ic; 81. ic = av_malloc(sizeof(AVFormatContext)); 82. if (!ic) return ic; ^ 83. avformat_get_context_defaults(ic); 84. ic->av_class = &av_format_context_class; libavformat/options.c:86:1: return from a call to avformat_alloc_context 84. ic->av_class = &av_format_context_class; 85. return ic; 86. } ^ ffmpeg.c:3731:10: Taking true branch 3729. 3730. oc = avformat_alloc_context(); 3731. if (!oc) { ^ 3732. print_error(filename, AVERROR(ENOMEM)); 3733. ffmpeg_exit(1); ffmpeg.c:3732:9: 3730. oc = avformat_alloc_context(); 3731. if (!oc) { 3732. print_error(filename, AVERROR(ENOMEM)); ^ 3733. ffmpeg_exit(1); 3734. } cmdutils.c:437:1: start of procedure print_error() 435. } 436. 437. void print_error(const char *filename, int err) ^ 438. { 439. char errbuf[128]; cmdutils.c:440:5: 438. { 439. char errbuf[128]; 440. const char *errbuf_ptr = errbuf; ^ 441. 442. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) cmdutils.c:442:9: Taking true branch 440. const char *errbuf_ptr = errbuf; 441. 442. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) ^ 443. errbuf_ptr = strerror(AVUNERROR(err)); 444. fprintf(stderr, "%s: %s\n", filename, errbuf_ptr); cmdutils.c:443:9: Skipping strerror(): method has no implementation 441. 442. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) 443. errbuf_ptr = strerror(AVUNERROR(err)); ^ 444. fprintf(stderr, "%s: %s\n", filename, errbuf_ptr); 445. } cmdutils.c:444:5: 442. if (av_strerror(err, errbuf, sizeof(errbuf)) < 0) 443. errbuf_ptr = strerror(AVUNERROR(err)); 444. fprintf(stderr, "%s: %s\n", filename, errbuf_ptr); ^ 445. } 446. cmdutils.c:445:1: return from a call to print_error 443. errbuf_ptr = strerror(AVUNERROR(err)); 444. fprintf(stderr, "%s: %s\n", filename, errbuf_ptr); 445. } ^ 446. 447. static int warned_cfg = 0; ffmpeg.c:3733:9: Skipping ffmpeg_exit(): empty list of specs 3731. if (!oc) { 3732. print_error(filename, AVERROR(ENOMEM)); 3733. ffmpeg_exit(1); ^ 3734. } 3735. ffmpeg.c:3736:9: Taking true branch 3734. } 3735. 3736. if (last_asked_format) { ^ 3737. file_oformat = av_guess_format(last_asked_format, NULL, NULL); 3738. if (!file_oformat) { ffmpeg.c:3737:9: Skipping av_guess_format(): empty list of specs 3735. 3736. if (last_asked_format) { 3737. file_oformat = av_guess_format(last_asked_format, NULL, NULL); ^ 3738. if (!file_oformat) { 3739. fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format); ffmpeg.c:3738:14: Taking false branch 3736. if (last_asked_format) { 3737. file_oformat = av_guess_format(last_asked_format, NULL, NULL); 3738. if (!file_oformat) { ^ 3739. fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format); 3740. ffmpeg_exit(1); ffmpeg.c:3742:9: 3740. ffmpeg_exit(1); 3741. } 3742. last_asked_format = NULL; ^ 3743. } else { 3744. file_oformat = av_guess_format(NULL, filename, NULL); ffmpeg.c:3752:5: 3750. } 3751. 3752. oc->oformat = file_oformat; ^ 3753. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); 3754.
https://github.com/libav/libav/blob/b568d6d94bda607e4ebb35be68181a8c2a9f5c50/ffmpeg.c/#L3752
d2a_code_trace_data_43565
DH *ssl_get_auto_dh(SSL *s) { int dh_secbits = 80; if (s->cert->dh_tmp_auto == 2) return DH_get_1024_160(); if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) { if (s->s3->tmp.new_cipher->strength_bits == 256) dh_secbits = 128; else dh_secbits = 80; } else { CERT_PKEY *cpk = ssl_get_server_send_pkey(s); dh_secbits = EVP_PKEY_security_bits(cpk->privatekey); } if (dh_secbits >= 128) { DH *dhp = DH_new(); if (dhp == NULL) return NULL; dhp->g = BN_new(); if (dhp->g != NULL) BN_set_word(dhp->g, 2); if (dh_secbits >= 192) dhp->p = get_rfc3526_prime_8192(NULL); else dhp->p = get_rfc3526_prime_3072(NULL); if (dhp->p == NULL || dhp->g == NULL) { DH_free(dhp); return NULL; } return dhp; } if (dh_secbits >= 112) return DH_get_2048_224(); return DH_get_1024_160(); } ssl/t1_lib.c:4026: error: NULL_DEREFERENCE pointer `cpk` last assigned on line 4025 could be null and is dereferenced at line 4026, column 45. Showing all 30 steps of the trace ssl/t1_lib.c:4014:1: start of procedure ssl_get_auto_dh() 4012. 4013. #ifndef OPENSSL_NO_DH 4014. > DH *ssl_get_auto_dh(SSL *s) 4015. { 4016. int dh_secbits = 80; ssl/t1_lib.c:4016:5: 4014. DH *ssl_get_auto_dh(SSL *s) 4015. { 4016. > int dh_secbits = 80; 4017. if (s->cert->dh_tmp_auto == 2) 4018. return DH_get_1024_160(); ssl/t1_lib.c:4017:9: Taking false branch 4015. { 4016. int dh_secbits = 80; 4017. if (s->cert->dh_tmp_auto == 2) ^ 4018. return DH_get_1024_160(); 4019. if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) { ssl/t1_lib.c:4019:9: Taking false branch 4017. if (s->cert->dh_tmp_auto == 2) 4018. return DH_get_1024_160(); 4019. if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) { ^ 4020. if (s->s3->tmp.new_cipher->strength_bits == 256) 4021. dh_secbits = 128; ssl/t1_lib.c:4025:9: 4023. dh_secbits = 80; 4024. } else { 4025. > CERT_PKEY *cpk = ssl_get_server_send_pkey(s); 4026. dh_secbits = EVP_PKEY_security_bits(cpk->privatekey); 4027. } ssl/ssl_lib.c:2683:1: start of procedure ssl_get_server_send_pkey() 2681. } 2682. 2683. > CERT_PKEY *ssl_get_server_send_pkey(SSL *s) 2684. { 2685. CERT *c; ssl/ssl_lib.c:2688:5: 2686. int i; 2687. 2688. > c = s->cert; 2689. if (!s->s3 || !s->s3->tmp.new_cipher) 2690. return NULL; ssl/ssl_lib.c:2689:10: Taking false branch 2687. 2688. c = s->cert; 2689. if (!s->s3 || !s->s3->tmp.new_cipher) ^ 2690. return NULL; 2691. ssl_set_masks(s); ssl/ssl_lib.c:2689:20: Taking false branch 2687. 2688. c = s->cert; 2689. if (!s->s3 || !s->s3->tmp.new_cipher) ^ 2690. return NULL; 2691. ssl_set_masks(s); ssl/ssl_lib.c:2691:5: Skipping ssl_set_masks(): empty list of specs 2689. if (!s->s3 || !s->s3->tmp.new_cipher) 2690. return NULL; 2691. ssl_set_masks(s); ^ 2692. 2693. i = ssl_get_server_cert_index(s); ssl/ssl_lib.c:2693:5: 2691. ssl_set_masks(s); 2692. 2693. > i = ssl_get_server_cert_index(s); 2694. 2695. /* This may or may not be an error. */ ssl/ssl_lib.c:2662:1: start of procedure ssl_get_server_cert_index() 2660. #endif 2661. 2662. > static int ssl_get_server_cert_index(const SSL *s) 2663. { 2664. int idx; ssl/ssl_lib.c:2665:5: 2663. { 2664. int idx; 2665. > idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher); 2666. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509) 2667. idx = SSL_PKEY_RSA_SIGN; ssl/ssl_ciph.c:1919:1: start of procedure ssl_cipher_get_cert_index() 1917. 1918. /* For a cipher return the index corresponding to the certificate type */ 1919. > int ssl_cipher_get_cert_index(const SSL_CIPHER *c) 1920. { 1921. uint32_t alg_a; ssl/ssl_ciph.c:1923:5: 1921. uint32_t alg_a; 1922. 1923. > alg_a = c->algorithm_auth; 1924. 1925. if (alg_a & SSL_aECDSA) ssl/ssl_ciph.c:1925:9: Taking false branch 1923. alg_a = c->algorithm_auth; 1924. 1925. if (alg_a & SSL_aECDSA) ^ 1926. return SSL_PKEY_ECC; 1927. else if (alg_a & SSL_aDSS) ssl/ssl_ciph.c:1927:14: Taking false branch 1925. if (alg_a & SSL_aECDSA) 1926. return SSL_PKEY_ECC; 1927. else if (alg_a & SSL_aDSS) ^ 1928. return SSL_PKEY_DSA_SIGN; 1929. else if (alg_a & SSL_aRSA) ssl/ssl_ciph.c:1929:14: Taking true branch 1927. else if (alg_a & SSL_aDSS) 1928. return SSL_PKEY_DSA_SIGN; 1929. else if (alg_a & SSL_aRSA) ^ 1930. return SSL_PKEY_RSA_ENC; 1931. else if (alg_a & SSL_aGOST12) ssl/ssl_ciph.c:1930:9: 1928. return SSL_PKEY_DSA_SIGN; 1929. else if (alg_a & SSL_aRSA) 1930. > return SSL_PKEY_RSA_ENC; 1931. else if (alg_a & SSL_aGOST12) 1932. return SSL_PKEY_GOST_EC; ssl/ssl_ciph.c:1937:1: return from a call to ssl_cipher_get_cert_index 1935. 1936. return -1; 1937. > } 1938. 1939. const SSL_CIPHER *ssl_get_cipher_by_char(SSL *ssl, const unsigned char *ptr) ssl/ssl_lib.c:2666:9: Taking true branch 2664. int idx; 2665. idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher); 2666. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509) ^ 2667. idx = SSL_PKEY_RSA_SIGN; 2668. if (idx == SSL_PKEY_GOST_EC) { ssl/ssl_lib.c:2666:37: Taking false branch 2664. int idx; 2665. idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher); 2666. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509) ^ 2667. idx = SSL_PKEY_RSA_SIGN; 2668. if (idx == SSL_PKEY_GOST_EC) { ssl/ssl_lib.c:2668:9: Taking false branch 2666. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509) 2667. idx = SSL_PKEY_RSA_SIGN; 2668. if (idx == SSL_PKEY_GOST_EC) { ^ 2669. if (s->cert->pkeys[SSL_PKEY_GOST12_512].x509) 2670. idx = SSL_PKEY_GOST12_512; ssl/ssl_lib.c:2678:9: Taking false branch 2676. idx = -1; 2677. } 2678. if (idx == -1) ^ 2679. SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR); 2680. return idx; ssl/ssl_lib.c:2680:5: 2678. if (idx == -1) 2679. SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR); 2680. > return idx; 2681. } 2682. ssl/ssl_lib.c:2681:1: return from a call to ssl_get_server_cert_index 2679. SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR); 2680. return idx; 2681. > } 2682. 2683. CERT_PKEY *ssl_get_server_send_pkey(SSL *s) ssl/ssl_lib.c:2696:9: Taking true branch 2694. 2695. /* This may or may not be an error. */ 2696. if (i < 0) ^ 2697. return NULL; 2698. ssl/ssl_lib.c:2697:9: 2695. /* This may or may not be an error. */ 2696. if (i < 0) 2697. > return NULL; 2698. 2699. /* May be NULL. */ ssl/ssl_lib.c:2701:1: return from a call to ssl_get_server_send_pkey 2699. /* May be NULL. */ 2700. return &c->pkeys[i]; 2701. > } 2702. 2703. EVP_PKEY *ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *cipher, ssl/t1_lib.c:4026:9: 4024. } else { 4025. CERT_PKEY *cpk = ssl_get_server_send_pkey(s); 4026. > dh_secbits = EVP_PKEY_security_bits(cpk->privatekey); 4027. } 4028.
https://github.com/openssl/openssl/blob/924ec89a2499ad18009412c6688b02452735a858/ssl/t1_lib.c/#L4026
d2a_code_trace_data_43566
int ff_read_packet(AVFormatContext *s, AVPacket *pkt) { int ret, i, err; AVStream *st; for (;;) { AVPacketList *pktl = s->internal->raw_packet_buffer; if (pktl) { *pkt = pktl->pkt; st = s->streams[pkt->stream_index]; if (st->codecpar->codec_id != AV_CODEC_ID_PROBE || !st->probe_packets || s->internal->raw_packet_buffer_remaining_size < pkt->size) { AVProbeData *pd; if (st->probe_packets) if ((err = probe_codec(s, st, NULL)) < 0) return err; pd = &st->probe_data; av_freep(&pd->buf); pd->buf_size = 0; s->internal->raw_packet_buffer = pktl->next; s->internal->raw_packet_buffer_remaining_size += pkt->size; av_free(pktl); return 0; } } pkt->data = NULL; pkt->size = 0; av_init_packet(pkt); ret = s->iformat->read_packet(s, pkt); if (ret < 0) { if (!pktl || ret == AVERROR(EAGAIN)) return ret; for (i = 0; i < s->nb_streams; i++) { st = s->streams[i]; if (st->probe_packets) if ((err = probe_codec(s, st, NULL)) < 0) return err; } continue; } if (!pkt->buf) { AVPacket tmp = { 0 }; ret = av_packet_ref(&tmp, pkt); if (ret < 0) return ret; *pkt = tmp; } if ((s->flags & AVFMT_FLAG_DISCARD_CORRUPT) && (pkt->flags & AV_PKT_FLAG_CORRUPT)) { av_log(s, AV_LOG_WARNING, "Dropped corrupted packet (stream = %d)\n", pkt->stream_index); av_packet_unref(pkt); continue; } st = s->streams[pkt->stream_index]; switch (st->codecpar->codec_type) { case AVMEDIA_TYPE_VIDEO: if (s->video_codec_id) st->codecpar->codec_id = s->video_codec_id; break; case AVMEDIA_TYPE_AUDIO: if (s->audio_codec_id) st->codecpar->codec_id = s->audio_codec_id; break; case AVMEDIA_TYPE_SUBTITLE: if (s->subtitle_codec_id) st->codecpar->codec_id = s->subtitle_codec_id; break; } if (!pktl && (st->codecpar->codec_id != AV_CODEC_ID_PROBE || !st->probe_packets)) return ret; err = add_to_pktbuf(&s->internal->raw_packet_buffer, pkt, &s->internal->raw_packet_buffer_end, 0); if (err) return err; s->internal->raw_packet_buffer_remaining_size -= pkt->size; if ((err = probe_codec(s, st, pkt)) < 0) return err; } } libavformat/utils.c:462: error: Null Dereference pointer `&tmp->side_data` last assigned on line 461 could be null and is dereferenced by call to `av_packet_ref()` at line 462, column 19. libavformat/utils.c:416:1: start of procedure ff_read_packet() 414. } 415. 416. int ff_read_packet(AVFormatContext *s, AVPacket *pkt) ^ 417. { 418. int ret, i, err; libavformat/utils.c:506:5: Loop condition is true. Entering loop body 504. if ((err = probe_codec(s, st, pkt)) < 0) 505. return err; 506. } ^ 507. } 508. libavformat/utils.c:422:9: 420. 421. for (;;) { 422. AVPacketList *pktl = s->internal->raw_packet_buffer; ^ 423. 424. if (pktl) { libavformat/utils.c:424:13: Taking false branch 422. AVPacketList *pktl = s->internal->raw_packet_buffer; 423. 424. if (pktl) { ^ 425. *pkt = pktl->pkt; 426. st = s->streams[pkt->stream_index]; libavformat/utils.c:444:9: 442. } 443. 444. pkt->data = NULL; ^ 445. pkt->size = 0; 446. av_init_packet(pkt); libavformat/utils.c:445:9: 443. 444. pkt->data = NULL; 445. pkt->size = 0; ^ 446. av_init_packet(pkt); 447. ret = s->iformat->read_packet(s, pkt); libavformat/utils.c:446:9: 444. pkt->data = NULL; 445. pkt->size = 0; 446. av_init_packet(pkt); ^ 447. ret = s->iformat->read_packet(s, pkt); 448. if (ret < 0) { libavcodec/avpacket.c:31:1: start of procedure av_init_packet() 29. #include "avcodec.h" 30. 31. void av_init_packet(AVPacket *pkt) ^ 32. { 33. pkt->pts = AV_NOPTS_VALUE; libavcodec/avpacket.c:33:5: 31. void av_init_packet(AVPacket *pkt) 32. { 33. pkt->pts = AV_NOPTS_VALUE; ^ 34. pkt->dts = AV_NOPTS_VALUE; 35. pkt->pos = -1; libavcodec/avpacket.c:34:5: 32. { 33. pkt->pts = AV_NOPTS_VALUE; 34. pkt->dts = AV_NOPTS_VALUE; ^ 35. pkt->pos = -1; 36. pkt->duration = 0; libavcodec/avpacket.c:35:5: 33. pkt->pts = AV_NOPTS_VALUE; 34. pkt->dts = AV_NOPTS_VALUE; 35. pkt->pos = -1; ^ 36. pkt->duration = 0; 37. #if FF_API_CONVERGENCE_DURATION libavcodec/avpacket.c:36:5: 34. pkt->dts = AV_NOPTS_VALUE; 35. pkt->pos = -1; 36. pkt->duration = 0; ^ 37. #if FF_API_CONVERGENCE_DURATION 38. FF_DISABLE_DEPRECATION_WARNINGS libavcodec/avpacket.c:39:5: 37. #if FF_API_CONVERGENCE_DURATION 38. FF_DISABLE_DEPRECATION_WARNINGS 39. pkt->convergence_duration = 0; ^ 40. FF_ENABLE_DEPRECATION_WARNINGS 41. #endif libavcodec/avpacket.c:42:5: 40. FF_ENABLE_DEPRECATION_WARNINGS 41. #endif 42. pkt->flags = 0; ^ 43. pkt->stream_index = 0; 44. pkt->buf = NULL; libavcodec/avpacket.c:43:5: 41. #endif 42. pkt->flags = 0; 43. pkt->stream_index = 0; ^ 44. pkt->buf = NULL; 45. pkt->side_data = NULL; libavcodec/avpacket.c:44:5: 42. pkt->flags = 0; 43. pkt->stream_index = 0; 44. pkt->buf = NULL; ^ 45. pkt->side_data = NULL; 46. pkt->side_data_elems = 0; libavcodec/avpacket.c:45:5: 43. pkt->stream_index = 0; 44. pkt->buf = NULL; 45. pkt->side_data = NULL; ^ 46. pkt->side_data_elems = 0; 47. } libavcodec/avpacket.c:46:5: 44. pkt->buf = NULL; 45. pkt->side_data = NULL; 46. pkt->side_data_elems = 0; ^ 47. } 48. libavcodec/avpacket.c:47:1: return from a call to av_init_packet 45. pkt->side_data = NULL; 46. pkt->side_data_elems = 0; 47. } ^ 48. 49. AVPacket *av_packet_alloc(void) libavformat/utils.c:447:9: Skipping __function_pointer__(): unresolved function pointer 445. pkt->size = 0; 446. av_init_packet(pkt); 447. ret = s->iformat->read_packet(s, pkt); ^ 448. if (ret < 0) { 449. if (!pktl || ret == AVERROR(EAGAIN)) libavformat/utils.c:448:13: Taking false branch 446. av_init_packet(pkt); 447. ret = s->iformat->read_packet(s, pkt); 448. if (ret < 0) { ^ 449. if (!pktl || ret == AVERROR(EAGAIN)) 450. return ret; libavformat/utils.c:460:14: Taking true branch 458. } 459. 460. if (!pkt->buf) { ^ 461. AVPacket tmp = { 0 }; 462. ret = av_packet_ref(&tmp, pkt); libavformat/utils.c:461:13: 459. 460. if (!pkt->buf) { 461. AVPacket tmp = { 0 }; ^ 462. ret = av_packet_ref(&tmp, pkt); 463. if (ret < 0) libavformat/utils.c:462:13: 460. if (!pkt->buf) { 461. AVPacket tmp = { 0 }; 462. ret = av_packet_ref(&tmp, pkt); ^ 463. if (ret < 0) 464. return ret; libavcodec/avpacket.c:355:1: start of procedure av_packet_ref() 353. } 354. 355. int av_packet_ref(AVPacket *dst, const AVPacket *src) ^ 356. { 357. int ret; libavcodec/avpacket.c:359:5: 357. int ret; 358. 359. ret = av_packet_copy_props(dst, src); ^ 360. if (ret < 0) 361. return ret; libavcodec/avpacket.c:314:1: start of procedure av_packet_copy_props() 312. } 313. 314. int av_packet_copy_props(AVPacket *dst, const AVPacket *src) ^ 315. { 316. int i; libavcodec/avpacket.c:318:5: 316. int i; 317. 318. dst->pts = src->pts; ^ 319. dst->dts = src->dts; 320. dst->pos = src->pos; libavcodec/avpacket.c:319:5: 317. 318. dst->pts = src->pts; 319. dst->dts = src->dts; ^ 320. dst->pos = src->pos; 321. dst->duration = src->duration; libavcodec/avpacket.c:320:5: 318. dst->pts = src->pts; 319. dst->dts = src->dts; 320. dst->pos = src->pos; ^ 321. dst->duration = src->duration; 322. #if FF_API_CONVERGENCE_DURATION libavcodec/avpacket.c:321:5: 319. dst->dts = src->dts; 320. dst->pos = src->pos; 321. dst->duration = src->duration; ^ 322. #if FF_API_CONVERGENCE_DURATION 323. FF_DISABLE_DEPRECATION_WARNINGS libavcodec/avpacket.c:324:5: 322. #if FF_API_CONVERGENCE_DURATION 323. FF_DISABLE_DEPRECATION_WARNINGS 324. dst->convergence_duration = src->convergence_duration; ^ 325. FF_ENABLE_DEPRECATION_WARNINGS 326. #endif libavcodec/avpacket.c:327:5: 325. FF_ENABLE_DEPRECATION_WARNINGS 326. #endif 327. dst->flags = src->flags; ^ 328. dst->stream_index = src->stream_index; 329. libavcodec/avpacket.c:328:5: 326. #endif 327. dst->flags = src->flags; 328. dst->stream_index = src->stream_index; ^ 329. 330. for (i = 0; i < src->side_data_elems; i++) { libavcodec/avpacket.c:330:10: 328. dst->stream_index = src->stream_index; 329. 330. for (i = 0; i < src->side_data_elems; i++) { ^ 331. enum AVPacketSideDataType type = src->side_data[i].type; 332. int size = src->side_data[i].size; libavcodec/avpacket.c:330:17: Loop condition is false. Leaving loop 328. dst->stream_index = src->stream_index; 329. 330. for (i = 0; i < src->side_data_elems; i++) { ^ 331. enum AVPacketSideDataType type = src->side_data[i].type; 332. int size = src->side_data[i].size; libavcodec/avpacket.c:343:5: 341. } 342. 343. return 0; ^ 344. } 345. libavcodec/avpacket.c:344:1: return from a call to av_packet_copy_props 342. 343. return 0; 344. } ^ 345. 346. void av_packet_unref(AVPacket *pkt) libavcodec/avpacket.c:360:9: Taking false branch 358. 359. ret = av_packet_copy_props(dst, src); 360. if (ret < 0) ^ 361. return ret; 362. libavcodec/avpacket.c:363:10: Taking true branch 361. return ret; 362. 363. if (!src->buf) { ^ 364. ret = packet_alloc(&dst->buf, src->size); 365. if (ret < 0) libavcodec/avpacket.c:364:9: 362. 363. if (!src->buf) { 364. ret = packet_alloc(&dst->buf, src->size); ^ 365. if (ret < 0) 366. goto fail; libavcodec/avpacket.c:69:1: start of procedure packet_alloc() 67. } 68. 69. static int packet_alloc(AVBufferRef **buf, int size) ^ 70. { 71. int ret; libavcodec/avpacket.c:72:9: Taking false branch 70. { 71. int ret; 72. if (size < 0 || size >= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) ^ 73. return AVERROR(EINVAL); 74. libavcodec/avpacket.c:72:21: Taking false branch 70. { 71. int ret; 72. if (size < 0 || size >= INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) ^ 73. return AVERROR(EINVAL); 74. libavcodec/avpacket.c:75:5: 73. return AVERROR(EINVAL); 74. 75. ret = av_buffer_realloc(buf, size + AV_INPUT_BUFFER_PADDING_SIZE); ^ 76. if (ret < 0) 77. return ret; libavutil/buffer.c:148:1: start of procedure av_buffer_realloc() 146. } 147. 148. int av_buffer_realloc(AVBufferRef **pbuf, int size) ^ 149. { 150. AVBufferRef *buf = *pbuf; libavutil/buffer.c:150:5: 148. int av_buffer_realloc(AVBufferRef **pbuf, int size) 149. { 150. AVBufferRef *buf = *pbuf; ^ 151. uint8_t *tmp; 152. libavutil/buffer.c:153:10: Taking false branch 151. uint8_t *tmp; 152. 153. if (!buf) { ^ 154. /* allocate a new buffer with av_realloc(), so it will be reallocatable 155. * later */ libavutil/buffer.c:170:16: Taking false branch 168. 169. return 0; 170. } else if (buf->size == size) ^ 171. return 0; 172. libavutil/buffer.c:173:11: Taking false branch 171. return 0; 172. 173. if (!(buf->buffer->flags & BUFFER_FLAG_REALLOCATABLE) || ^ 174. !av_buffer_is_writable(buf) || buf->data != buf->buffer->data) { 175. /* cannot realloc, allocate a new reallocable buffer and copy data */ libavutil/buffer.c:174:10: 172. 173. if (!(buf->buffer->flags & BUFFER_FLAG_REALLOCATABLE) || 174. !av_buffer_is_writable(buf) || buf->data != buf->buffer->data) { ^ 175. /* cannot realloc, allocate a new reallocable buffer and copy data */ 176. AVBufferRef *new = NULL; libavutil/buffer.c:122:1: start of procedure av_buffer_is_writable() 120. } 121. 122. int av_buffer_is_writable(const AVBufferRef *buf) ^ 123. { 124. if (buf->buffer->flags & AV_BUFFER_FLAG_READONLY) libavutil/buffer.c:124:9: Taking false branch 122. int av_buffer_is_writable(const AVBufferRef *buf) 123. { 124. if (buf->buffer->flags & AV_BUFFER_FLAG_READONLY) ^ 125. return 0; 126. libavutil/buffer.c:127:12: Condition is true 125. return 0; 126. 127. return atomic_load(&buf->buffer->refcount) == 1; ^ 128. } 129. libavutil/buffer.c:127:5: 125. return 0; 126. 127. return atomic_load(&buf->buffer->refcount) == 1; ^ 128. } 129. libavutil/buffer.c:128:1: return from a call to av_buffer_is_writable 126. 127. return atomic_load(&buf->buffer->refcount) == 1; 128. } ^ 129. 130. int av_buffer_make_writable(AVBufferRef **pbuf) libavutil/buffer.c:174:10: Taking false branch 172. 173. if (!(buf->buffer->flags & BUFFER_FLAG_REALLOCATABLE) || 174. !av_buffer_is_writable(buf) || buf->data != buf->buffer->data) { ^ 175. /* cannot realloc, allocate a new reallocable buffer and copy data */ 176. AVBufferRef *new = NULL; libavutil/buffer.c:174:40: Taking false branch 172. 173. if (!(buf->buffer->flags & BUFFER_FLAG_REALLOCATABLE) || 174. !av_buffer_is_writable(buf) || buf->data != buf->buffer->data) { ^ 175. /* cannot realloc, allocate a new reallocable buffer and copy data */ 176. AVBufferRef *new = NULL; libavutil/buffer.c:189:5: 187. } 188. 189. tmp = av_realloc(buf->buffer->data, size); ^ 190. if (!tmp) 191. return AVERROR(ENOMEM); libavutil/mem.c:107:1: start of procedure av_realloc() 105. } 106. 107. void *av_realloc(void *ptr, size_t size) ^ 108. { 109. /* let's disallow possibly ambiguous cases */ libavutil/mem.c:110:9: Taking false branch 108. { 109. /* let's disallow possibly ambiguous cases */ 110. if (size > (INT_MAX - 16)) ^ 111. return NULL; 112. libavutil/mem.c:116:5: 114. return _aligned_realloc(ptr, size, 32); 115. #else 116. return realloc(ptr, size); ^ 117. #endif 118. } libavutil/mem.c:118:1: return from a call to av_realloc 116. return realloc(ptr, size); 117. #endif 118. } ^ 119. 120. int av_reallocp(void *ptr, size_t size) libavutil/buffer.c:190:10: Taking false branch 188. 189. tmp = av_realloc(buf->buffer->data, size); 190. if (!tmp) ^ 191. return AVERROR(ENOMEM); 192. libavutil/buffer.c:193:5: 191. return AVERROR(ENOMEM); 192. 193. buf->buffer->data = buf->data = tmp; ^ 194. buf->buffer->size = buf->size = size; 195. return 0; libavutil/buffer.c:194:5: 192. 193. buf->buffer->data = buf->data = tmp; 194. buf->buffer->size = buf->size = size; ^ 195. return 0; 196. } libavutil/buffer.c:195:5: 193. buf->buffer->data = buf->data = tmp; 194. buf->buffer->size = buf->size = size; 195. return 0; ^ 196. } 197. libavutil/buffer.c:196:1: return from a call to av_buffer_realloc 194. buf->buffer->size = buf->size = size; 195. return 0; 196. } ^ 197. 198. AVBufferPool *av_buffer_pool_init2(int size, void *opaque, libavcodec/avpacket.c:76:9: Taking false branch 74. 75. ret = av_buffer_realloc(buf, size + AV_INPUT_BUFFER_PADDING_SIZE); 76. if (ret < 0) ^ 77. return ret; 78. libavcodec/avpacket.c:79:5: 77. return ret; 78. 79. memset((*buf)->data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); ^ 80. 81. return 0; libavcodec/avpacket.c:81:5: 79. memset((*buf)->data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); 80. 81. return 0; ^ 82. } 83. libavcodec/avpacket.c:82:1: return from a call to packet_alloc 80. 81. return 0; 82. } ^ 83. 84. int av_new_packet(AVPacket *pkt, int size) libavcodec/avpacket.c:365:13: Taking false branch 363. if (!src->buf) { 364. ret = packet_alloc(&dst->buf, src->size); 365. if (ret < 0) ^ 366. goto fail; 367. memcpy(dst->buf->data, src->data, src->size); libavcodec/avpacket.c:367:9: 365. if (ret < 0) 366. goto fail; 367. memcpy(dst->buf->data, src->data, src->size); ^ 368. 369. dst->data = dst->buf->data; libavcodec/avpacket.c:369:9: 367. memcpy(dst->buf->data, src->data, src->size); 368. 369. dst->data = dst->buf->data; ^ 370. } else { 371. dst->buf = av_buffer_ref(src->buf); libavcodec/avpacket.c:379:5: 377. } 378. 379. dst->size = src->size; ^ 380. 381. return 0; libavcodec/avpacket.c:381:5: 379. dst->size = src->size; 380. 381. return 0; ^ 382. fail: 383. av_packet_free_side_data(dst); libavcodec/avpacket.c:385:1: return from a call to av_packet_ref 383. av_packet_free_side_data(dst); 384. return ret; 385. } ^ 386. 387. AVPacket *av_packet_clone(const AVPacket *src)
https://github.com/libav/libav/blob/9d7026574bbbe67d004a1c32911da75375692967/libavformat/utils.c/#L462
d2a_code_trace_data_43567
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_ossl.c:755: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set_locked`. Showing all 31 steps of the trace crypto/rsa/rsa_ossl.c:716:1: Parameter `ctx->stack.depth` 714. } 715. 716. > static int rsa_ossl_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx) 717. { 718. BIGNUM *r1, *m1, *vrfy; crypto/rsa/rsa_ossl.c:721:5: Call 719. int ret = 0; 720. 721. BN_CTX_start(ctx); ^ 722. 723. r1 = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/rsa/rsa_ossl.c:753:18: Call 751. 752. if (rsa->flags & RSA_FLAG_CACHE_PRIVATE) { 753. if (!BN_MONT_CTX_set_locked ^ 754. (&rsa->_method_mod_p, CRYPTO_LOCK_RSA, p, ctx) 755. || !BN_MONT_CTX_set_locked(&rsa->_method_mod_q, crypto/bn/bn_mont.c:500:1: Parameter `ctx->stack.depth` 498. } 499. 500. > BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock, 501. const BIGNUM *mod, BN_CTX *ctx) 502. { crypto/rsa/rsa_ossl.c:755:21: Call 753. if (!BN_MONT_CTX_set_locked 754. (&rsa->_method_mod_p, CRYPTO_LOCK_RSA, p, ctx) 755. || !BN_MONT_CTX_set_locked(&rsa->_method_mod_q, ^ 756. CRYPTO_LOCK_RSA, q, ctx)) { 757. BN_free(local_p); crypto/bn/bn_mont.c:500:1: Parameter `ctx->stack.depth` 498. } 499. 500. > BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock, 501. const BIGNUM *mod, BN_CTX *ctx) 502. { crypto/bn/bn_mont.c:522:10: Call 520. if (ret == NULL) 521. return NULL; 522. if (!BN_MONT_CTX_set(ret, mod, ctx)) { ^ 523. BN_MONT_CTX_free(ret); 524. return NULL; crypto/bn/bn_mont.c:349:1: Parameter `ctx->stack.depth` 347. } 348. 349. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 350. { 351. int ret = 0; crypto/bn/bn_mont.c:357:5: Call 355. return 0; 356. 357. BN_CTX_start(ctx); ^ 358. if ((Ri = BN_CTX_get(ctx)) == NULL) 359. goto err; crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mont.c:428:14: Call 426. tmod.top = buf[0] != 0 ? 1 : 0; 427. /* Ri = R^-1 mod N */ 428. if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL) ^ 429. goto err; 430. if (!BN_lshift(Ri, Ri, BN_BITS2)) crypto/bn/bn_gcd.c:226:1: Parameter `ctx->stack.depth` 224. BN_CTX *ctx); 225. 226. > BIGNUM *BN_mod_inverse(BIGNUM *in, 227. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 228. { crypto/bn/bn_gcd.c:231:10: Call 229. BIGNUM *rv; 230. int noinv; 231. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv); ^ 232. if (noinv) 233. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); crypto/bn/bn_gcd.c:237:1: Parameter `ctx->stack.depth` 235. } 236. 237. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 238. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 239. int *pnoinv) crypto/bn/bn_gcd.c:250:16: Call 248. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) 249. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) { 250. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 251. } 252. crypto/bn/bn_gcd.c:557:1: Parameter `ctx->stack.depth` 555. * not contain branches that may leak sensitive information. 556. */ 557. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 558. const BIGNUM *a, const BIGNUM *n, 559. BN_CTX *ctx) crypto/bn/bn_gcd.c:568:5: Call 566. bn_check_top(n); 567. 568. BN_CTX_start(ctx); ^ 569. A = BN_CTX_get(ctx); 570. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gcd.c:603:18: Call 601. BN_init(&local_B); 602. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME); 603. if (!BN_nnmod(B, &local_B, A, ctx)) ^ 604. goto err; 605. /* Ensure local_B goes out of scope before any further use of B */ crypto/bn/bn_mod.c:119:1: Parameter `ctx->stack.depth` 117. #include "bn_lcl.h" 118. 119. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 120. { 121. /* crypto/bn/bn_mod.c:126:11: Call 124. */ 125. 126. if (!(BN_mod(r, m, d, ctx))) ^ 127. return 0; 128. if (!r->neg) crypto/bn/bn_div.c:189:1: Parameter `ctx->stack.depth` 187. * If 'dv' or 'rm' is NULL, the respective value is not returned. 188. */ 189. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 190. BN_CTX *ctx) 191. { crypto/bn/bn_div.c:242:5: Call 240. } 241. 242. BN_CTX_start(ctx); ^ 243. tmp = BN_CTX_get(ctx); 244. snum = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:469:5: Call 467. if (no_branch) 468. bn_correct_top(res); 469. BN_CTX_end(ctx); ^ 470. return (1); 471. err: crypto/bn/bn_ctx.c:250:1: Parameter `ctx->stack.depth` 248. } 249. 250. > void BN_CTX_end(BN_CTX *ctx) 251. { 252. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:256:27: Call 254. ctx->err_stack--; 255. else { 256. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 257. /* Does this stack frame have anything to release? */ 258. if (fp < ctx->used) crypto/bn/bn_ctx.c:326:1: <LHS trace> 324. } 325. 326. > static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:326:1: Parameter `st->depth` 324. } 325. 326. > static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:328:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set_locked` 326. static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; ^ 329. } 330.
https://github.com/openssl/openssl/blob/e113c9c59dcb419dd00525cec431edb854a6c897/crypto/bn/bn_ctx.c/#L328
d2a_code_trace_data_43568
static void rtmp_calc_digest(const uint8_t *src, int len, int gap, const uint8_t *key, int keylen, uint8_t *dst) { struct AVSHA *sha; uint8_t hmac_buf[64+32] = {0}; int i; sha = av_mallocz(av_sha_size); if (keylen < 64) { memcpy(hmac_buf, key, keylen); } else { av_sha_init(sha, 256); av_sha_update(sha,key, keylen); av_sha_final(sha, hmac_buf); } for (i = 0; i < 64; i++) hmac_buf[i] ^= HMAC_IPAD_VAL; av_sha_init(sha, 256); av_sha_update(sha, hmac_buf, 64); if (gap <= 0) { av_sha_update(sha, src, len); } else { av_sha_update(sha, src, gap); av_sha_update(sha, src + gap + 32, len - gap - 32); } av_sha_final(sha, hmac_buf + 64); for (i = 0; i < 64; i++) hmac_buf[i] ^= HMAC_IPAD_VAL ^ HMAC_OPAD_VAL; av_sha_init(sha, 256); av_sha_update(sha, hmac_buf, 64+32); av_sha_final(sha, dst); av_free(sha); } libavformat/rtmpproto.c:411: error: Null Dereference pointer `sha` last assigned on line 406 could be null and is dereferenced by call to `av_sha_init()` at line 411, column 9. libavformat/rtmpproto.c:399:1: start of procedure rtmp_calc_digest() 397. * @param dst buffer where calculated digest will be stored (32 bytes) 398. */ 399. static void rtmp_calc_digest(const uint8_t *src, int len, int gap, ^ 400. const uint8_t *key, int keylen, uint8_t *dst) 401. { libavformat/rtmpproto.c:403:5: 401. { 402. struct AVSHA *sha; 403. uint8_t hmac_buf[64+32] = {0}; ^ 404. int i; 405. libavformat/rtmpproto.c:406:5: 404. int i; 405. 406. sha = av_mallocz(av_sha_size); ^ 407. 408. if (keylen < 64) { libavutil/mem.c:156:1: start of procedure av_mallocz() 154. } 155. 156. void *av_mallocz(size_t size) ^ 157. { 158. void *ptr = av_malloc(size); libavutil/mem.c:158:5: 156. void *av_mallocz(size_t size) 157. { 158. void *ptr = av_malloc(size); ^ 159. if (ptr) 160. memset(ptr, 0, size); libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c: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) libavutil/mem.c:159:9: Taking false branch 157. { 158. void *ptr = av_malloc(size); 159. if (ptr) ^ 160. memset(ptr, 0, size); 161. return ptr; libavutil/mem.c:161:5: 159. if (ptr) 160. memset(ptr, 0, size); 161. return ptr; ^ 162. } 163. libavutil/mem.c:162:1: return from a call to av_mallocz 160. memset(ptr, 0, size); 161. return ptr; 162. } ^ 163. 164. char *av_strdup(const char *s) libavformat/rtmpproto.c:408:9: Taking false branch 406. sha = av_mallocz(av_sha_size); 407. 408. if (keylen < 64) { ^ 409. memcpy(hmac_buf, key, keylen); 410. } else { libavformat/rtmpproto.c:411:9: 409. memcpy(hmac_buf, key, keylen); 410. } else { 411. av_sha_init(sha, 256); ^ 412. av_sha_update(sha,key, keylen); 413. av_sha_final(sha, hmac_buf); libavutil/sha.c:246:1: start of procedure av_sha_init() 244. 245. 246. int av_sha_init(AVSHA* ctx, int bits) ^ 247. { 248. ctx->digest_len = bits >> 5; libavutil/sha.c:248:5: 246. int av_sha_init(AVSHA* ctx, int bits) 247. { 248. ctx->digest_len = bits >> 5; ^ 249. switch (bits) { 250. case 160: // SHA-1
https://github.com/libav/libav/blob/af2f655c02c69aa615eb2a06000a1aa35916967a/libavformat/rtmpproto.c/#L411
d2a_code_trace_data_43569
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:285: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_div_recp`. Showing all 25 steps of the trace test/bntest.c:285:9: Call 283. BN_set_negative(b, rand_neg()); 284. BN_RECP_CTX_set(recp, b, ctx); 285. BN_div_recp(d, c, a, recp, ctx); ^ 286. BN_mul(e, d, b, ctx); 287. BN_add(d, e, c); crypto/bn/bn_recp.c:84:1: Parameter `ctx->stack.depth` 82. } 83. 84. > int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, 85. BN_RECP_CTX *recp, BN_CTX *ctx) 86. { crypto/bn/bn_recp.c:90:5: Call 88. BIGNUM *a, *b, *d, *r; 89. 90. BN_CTX_start(ctx); ^ 91. d = (dv != NULL) ? dv : BN_CTX_get(ctx); 92. r = (rem != NULL) ? rem : BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_recp.c:93:9: Call 91. d = (dv != NULL) ? dv : BN_CTX_get(ctx); 92. r = (rem != NULL) ? rem : BN_CTX_get(ctx); 93. a = BN_CTX_get(ctx); ^ 94. b = BN_CTX_get(ctx); 95. 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_recp.c:94:9: Call 92. r = (rem != NULL) ? rem : BN_CTX_get(ctx); 93. a = BN_CTX_get(ctx); 94. b = BN_CTX_get(ctx); ^ 95. if (b == NULL) 96. 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_recp.c:101:13: Call 99. BN_zero(d); 100. if (!BN_copy(r, m)) { 101. BN_CTX_end(ctx); ^ 102. return 0; 103. } crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); test/bntest.c:286:9: Call 284. BN_RECP_CTX_set(recp, b, ctx); 285. BN_div_recp(d, c, a, recp, ctx); 286. BN_mul(e, d, b, ctx); ^ 287. BN_add(d, e, c); 288. BN_sub(d, d, a); crypto/bn/bn_mul.c:497:1: Parameter `ctx->stack.depth` 495. #endif /* BN_RECURSION */ 496. 497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); crypto/bn/bn_mul.c:499:15: Call 497. int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = bn_mul_fixed_top(r, a, b, ctx); ^ 500. 501. bn_correct_top(r); crypto/bn/bn_mul.c:507:1: Parameter `ctx->stack.depth` 505. } 506. 507. > int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 508. { 509. int ret = 0; test/bntest.c:285:9: Call 283. BN_set_negative(b, rand_neg()); 284. BN_RECP_CTX_set(recp, b, ctx); 285. BN_div_recp(d, c, a, recp, ctx); ^ 286. BN_mul(e, d, b, ctx); 287. BN_add(d, e, c); crypto/bn/bn_recp.c:90:5: Call 88. BIGNUM *a, *b, *d, *r; 89. 90. BN_CTX_start(ctx); ^ 91. d = (dv != NULL) ? dv : BN_CTX_get(ctx); 92. r = (rem != NULL) ? rem : BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_recp.c:101:13: Call 99. BN_zero(d); 100. if (!BN_copy(r, m)) { 101. BN_CTX_end(ctx); ^ 102. return 0; 103. } crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_div_recp` 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_43570
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:280: error: Uninitialized Value The value read from inbuffer[_] was never initialized. libavcodec/ra144.c:280:3: 278. *(ptr++)=(inbuffer[2]>>5)&0x1f; 279. *(ptr++)=((inbuffer[2]<<2)&0x7c)|((inbuffer[3]>>14)&3); 280. *(ptr++)=(inbuffer[3]>>6)&0xff; ^ 281. *(ptr++)=((inbuffer[3]<<1)&0x7e)|((inbuffer[4]>>15)&1); 282. *(ptr++)=(inbuffer[4]>>8)&0x7f;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ra144.c/#L280
d2a_code_trace_data_43571
static ASN1_INTEGER *x509_load_serial(const char *CAfile, const char *serialfile, int create) { char *buf = NULL; ASN1_INTEGER *bs = NULL; BIGNUM *serial = NULL; if (serialfile == NULL) { const char *p = strrchr(CAfile, '.'); size_t len = p != NULL ? (size_t)(p - CAfile) : strlen(CAfile); buf = app_malloc(len + sizeof(POSTFIX), "serial# buffer"); memcpy(buf, CAfile, len); memcpy(buf + len, POSTFIX, sizeof(POSTFIX)); serialfile = buf; } serial = load_serial(serialfile, create, NULL); if (serial == NULL) goto end; if (!BN_add_word(serial, 1)) { BIO_printf(bio_err, "add_word failure\n"); goto end; } if (!save_serial(serialfile, NULL, serial, &bs)) goto end; end: OPENSSL_free(buf); BN_free(serial); return bs; } apps/x509.c:922: error: NULL_DEREFERENCE pointer `buf` last assigned on line 921 could be null and is dereferenced by call to `memcpy()` at line 922, column 9. Showing all 26 steps of the trace apps/x509.c:910:1: start of procedure x509_load_serial() 908. } 909. 910. > static ASN1_INTEGER *x509_load_serial(const char *CAfile, 911. const char *serialfile, int create) 912. { apps/x509.c:913:5: 911. const char *serialfile, int create) 912. { 913. > char *buf = NULL; 914. ASN1_INTEGER *bs = NULL; 915. BIGNUM *serial = NULL; apps/x509.c:914:5: 912. { 913. char *buf = NULL; 914. > ASN1_INTEGER *bs = NULL; 915. BIGNUM *serial = NULL; 916. apps/x509.c:915:5: 913. char *buf = NULL; 914. ASN1_INTEGER *bs = NULL; 915. > BIGNUM *serial = NULL; 916. 917. if (serialfile == NULL) { apps/x509.c:917:9: Taking true branch 915. BIGNUM *serial = NULL; 916. 917. if (serialfile == NULL) { ^ 918. const char *p = strrchr(CAfile, '.'); 919. size_t len = p != NULL ? (size_t)(p - CAfile) : strlen(CAfile); apps/x509.c:918:9: 916. 917. if (serialfile == NULL) { 918. > const char *p = strrchr(CAfile, '.'); 919. size_t len = p != NULL ? (size_t)(p - CAfile) : strlen(CAfile); 920. apps/x509.c:919:22: Condition is false 917. if (serialfile == NULL) { 918. const char *p = strrchr(CAfile, '.'); 919. size_t len = p != NULL ? (size_t)(p - CAfile) : strlen(CAfile); ^ 920. 921. buf = app_malloc(len + sizeof(POSTFIX), "serial# buffer"); apps/x509.c:919:9: 917. if (serialfile == NULL) { 918. const char *p = strrchr(CAfile, '.'); 919. > size_t len = p != NULL ? (size_t)(p - CAfile) : strlen(CAfile); 920. 921. buf = app_malloc(len + sizeof(POSTFIX), "serial# buffer"); apps/x509.c:921:9: 919. size_t len = p != NULL ? (size_t)(p - CAfile) : strlen(CAfile); 920. 921. > buf = app_malloc(len + sizeof(POSTFIX), "serial# buffer"); 922. memcpy(buf, CAfile, len); 923. memcpy(buf + len, POSTFIX, sizeof(POSTFIX)); test/testutil/apps_mem.c:14:1: start of procedure app_malloc() 12. /* shim that avoids sucking in too much from apps/apps.c */ 13. 14. > void* app_malloc(int sz, const char *what) 15. { 16. void *vp = OPENSSL_malloc(sz); test/testutil/apps_mem.c:16:5: 14. void* app_malloc(int sz, const char *what) 15. { 16. > void *vp = OPENSSL_malloc(sz); 17. 18. return vp; crypto/mem.c:192:1: start of procedure CRYPTO_malloc() 190. #endif 191. 192. > void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. void *ret = NULL; crypto/mem.c:194:5: 192. void *CRYPTO_malloc(size_t num, const char *file, int line) 193. { 194. > void *ret = NULL; 195. 196. INCREMENT(malloc_count); crypto/mem.c:197:9: Taking true branch 195. 196. INCREMENT(malloc_count); 197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 198. return malloc_impl(num, file, line); 199. crypto/mem.c:197:32: Taking false branch 195. 196. INCREMENT(malloc_count); 197. if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc) ^ 198. return malloc_impl(num, file, line); 199. crypto/mem.c:200:9: Taking false branch 198. return malloc_impl(num, file, line); 199. 200. if (num == 0) ^ 201. return NULL; 202. crypto/mem.c:204:9: Taking true branch 202. 203. FAILTEST(); 204. if (allow_customize) { ^ 205. /* 206. * Disallow customization after the first allocation. We only set this crypto/mem.c:210:9: 208. * allocation. 209. */ 210. > allow_customize = 0; 211. } 212. #ifndef OPENSSL_NO_CRYPTO_MDEBUG crypto/mem.c:221:5: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:221:19: 219. } 220. #else 221. > (void)(file); (void)(line); 222. ret = malloc(num); 223. #endif crypto/mem.c:222:5: 220. #else 221. (void)(file); (void)(line); 222. > ret = malloc(num); 223. #endif 224. crypto/mem.c:225:5: 223. #endif 224. 225. > return ret; 226. } 227. crypto/mem.c:226:1: return from a call to CRYPTO_malloc 224. 225. return ret; 226. > } 227. 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) test/testutil/apps_mem.c:18:5: 16. void *vp = OPENSSL_malloc(sz); 17. 18. > return vp; 19. } test/testutil/apps_mem.c:19:1: return from a call to app_malloc 17. 18. return vp; 19. > } apps/x509.c:922:9: 920. 921. buf = app_malloc(len + sizeof(POSTFIX), "serial# buffer"); 922. > memcpy(buf, CAfile, len); 923. memcpy(buf + len, POSTFIX, sizeof(POSTFIX)); 924. serialfile = buf;
https://github.com/openssl/openssl/blob/ce506d27ab5e7d17dfe3fe649768a0d19b6c86ee/apps/x509.c/#L922
d2a_code_trace_data_43572
static int save_avio_options(AVFormatContext *s) { HLSContext *c = s->priv_data; const char *opts[] = { "headers", "user_agent", NULL }, **opt = opts; uint8_t *buf; int ret = 0; while (*opt) { if (av_opt_get(s->pb, *opt, AV_OPT_SEARCH_CHILDREN, &buf) >= 0) { ret = av_dict_set(&c->avio_opts, *opt, buf, AV_DICT_DONT_STRDUP_VAL); if (ret < 0) return ret; } opt++; } return ret; } libavformat/hls.c:511: error: Memory Leak memory dynamically allocated to `buf` by call to `av_opt_get()` at line 501, column 13 is not reachable after line 511, column 1. libavformat/hls.c:493:1: start of procedure save_avio_options() 491. } 492. 493. static int save_avio_options(AVFormatContext *s) ^ 494. { 495. HLSContext *c = s->priv_data; libavformat/hls.c:495:5: 493. static int save_avio_options(AVFormatContext *s) 494. { 495. HLSContext *c = s->priv_data; ^ 496. const char *opts[] = { "headers", "user_agent", NULL }, **opt = opts; 497. uint8_t *buf; libavformat/hls.c:496:5: 494. { 495. HLSContext *c = s->priv_data; 496. const char *opts[] = { "headers", "user_agent", NULL }, **opt = opts; ^ 497. uint8_t *buf; 498. int ret = 0; libavformat/hls.c:498:5: 496. const char *opts[] = { "headers", "user_agent", NULL }, **opt = opts; 497. uint8_t *buf; 498. int ret = 0; ^ 499. 500. while (*opt) { libavformat/hls.c:500:12: Loop condition is true. Entering loop body 498. int ret = 0; 499. 500. while (*opt) { ^ 501. if (av_opt_get(s->pb, *opt, AV_OPT_SEARCH_CHILDREN, &buf) >= 0) { 502. ret = av_dict_set(&c->avio_opts, *opt, buf, libavformat/hls.c:501:13: 499. 500. while (*opt) { 501. if (av_opt_get(s->pb, *opt, AV_OPT_SEARCH_CHILDREN, &buf) >= 0) { ^ 502. ret = av_dict_set(&c->avio_opts, *opt, buf, 503. AV_DICT_DONT_STRDUP_VAL); libavutil/opt.c:330:1: start of procedure av_opt_get() 328. } 329. 330. int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val) ^ 331. { 332. void *dst, *target_obj; libavutil/opt.c:333:5: Skipping av_opt_find2(): empty list of specs 331. { 332. void *dst, *target_obj; 333. const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj); ^ 334. uint8_t *bin, buf[128]; 335. int len, i, ret; libavutil/opt.c:337:10: Taking false branch 335. int len, i, ret; 336. 337. if (!o || !target_obj) ^ 338. return AVERROR_OPTION_NOT_FOUND; 339. libavutil/opt.c:337:16: Taking false branch 335. int len, i, ret; 336. 337. if (!o || !target_obj) ^ 338. return AVERROR_OPTION_NOT_FOUND; 339. libavutil/opt.c:340:5: 338. return AVERROR_OPTION_NOT_FOUND; 339. 340. dst = (uint8_t*)target_obj + o->offset; ^ 341. 342. buf[0] = 0; libavutil/opt.c:342:5: 340. dst = (uint8_t*)target_obj + o->offset; 341. 342. buf[0] = 0; ^ 343. switch (o->type) { 344. case AV_OPT_TYPE_FLAGS: ret = snprintf(buf, sizeof(buf), "0x%08X", *(int *)dst);break; libavutil/opt.c:343:5: 341. 342. buf[0] = 0; 343. switch (o->type) { ^ 344. case AV_OPT_TYPE_FLAGS: ret = snprintf(buf, sizeof(buf), "0x%08X", *(int *)dst);break; 345. case AV_OPT_TYPE_INT: ret = snprintf(buf, sizeof(buf), "%d" , *(int *)dst);break; libavutil/opt.c:344:5: Switch condition is false. Skipping switch case 342. buf[0] = 0; 343. switch (o->type) { 344. case AV_OPT_TYPE_FLAGS: ret = snprintf(buf, sizeof(buf), "0x%08X", *(int *)dst);break; ^ 345. case AV_OPT_TYPE_INT: ret = snprintf(buf, sizeof(buf), "%d" , *(int *)dst);break; 346. case AV_OPT_TYPE_INT64: ret = snprintf(buf, sizeof(buf), "%"PRId64, *(int64_t*)dst);break; libavutil/opt.c:345:5: Switch condition is false. Skipping switch case 343. switch (o->type) { 344. case AV_OPT_TYPE_FLAGS: ret = snprintf(buf, sizeof(buf), "0x%08X", *(int *)dst);break; 345. case AV_OPT_TYPE_INT: ret = snprintf(buf, sizeof(buf), "%d" , *(int *)dst);break; ^ 346. case AV_OPT_TYPE_INT64: ret = snprintf(buf, sizeof(buf), "%"PRId64, *(int64_t*)dst);break; 347. case AV_OPT_TYPE_FLOAT: ret = snprintf(buf, sizeof(buf), "%f" , *(float *)dst);break; libavutil/opt.c:346:5: Switch condition is false. Skipping switch case 344. case AV_OPT_TYPE_FLAGS: ret = snprintf(buf, sizeof(buf), "0x%08X", *(int *)dst);break; 345. case AV_OPT_TYPE_INT: ret = snprintf(buf, sizeof(buf), "%d" , *(int *)dst);break; 346. case AV_OPT_TYPE_INT64: ret = snprintf(buf, sizeof(buf), "%"PRId64, *(int64_t*)dst);break; ^ 347. case AV_OPT_TYPE_FLOAT: ret = snprintf(buf, sizeof(buf), "%f" , *(float *)dst);break; 348. case AV_OPT_TYPE_DOUBLE: ret = snprintf(buf, sizeof(buf), "%f" , *(double *)dst);break; libavutil/opt.c:347:5: Switch condition is false. Skipping switch case 345. case AV_OPT_TYPE_INT: ret = snprintf(buf, sizeof(buf), "%d" , *(int *)dst);break; 346. case AV_OPT_TYPE_INT64: ret = snprintf(buf, sizeof(buf), "%"PRId64, *(int64_t*)dst);break; 347. case AV_OPT_TYPE_FLOAT: ret = snprintf(buf, sizeof(buf), "%f" , *(float *)dst);break; ^ 348. case AV_OPT_TYPE_DOUBLE: ret = snprintf(buf, sizeof(buf), "%f" , *(double *)dst);break; 349. case AV_OPT_TYPE_RATIONAL: ret = snprintf(buf, sizeof(buf), "%d/%d", ((AVRational*)dst)->num, ((AVRational*)dst)->den);break; libavutil/opt.c:348:5: Switch condition is false. Skipping switch case 346. case AV_OPT_TYPE_INT64: ret = snprintf(buf, sizeof(buf), "%"PRId64, *(int64_t*)dst);break; 347. case AV_OPT_TYPE_FLOAT: ret = snprintf(buf, sizeof(buf), "%f" , *(float *)dst);break; 348. case AV_OPT_TYPE_DOUBLE: ret = snprintf(buf, sizeof(buf), "%f" , *(double *)dst);break; ^ 349. case AV_OPT_TYPE_RATIONAL: ret = snprintf(buf, sizeof(buf), "%d/%d", ((AVRational*)dst)->num, ((AVRational*)dst)->den);break; 350. case AV_OPT_TYPE_STRING: libavutil/opt.c:349:5: Switch condition is false. Skipping switch case 347. case AV_OPT_TYPE_FLOAT: ret = snprintf(buf, sizeof(buf), "%f" , *(float *)dst);break; 348. case AV_OPT_TYPE_DOUBLE: ret = snprintf(buf, sizeof(buf), "%f" , *(double *)dst);break; 349. case AV_OPT_TYPE_RATIONAL: ret = snprintf(buf, sizeof(buf), "%d/%d", ((AVRational*)dst)->num, ((AVRational*)dst)->den);break; ^ 350. case AV_OPT_TYPE_STRING: 351. if (*(uint8_t**)dst) libavutil/opt.c:350:5: Switch condition is true. Entering switch case 348. case AV_OPT_TYPE_DOUBLE: ret = snprintf(buf, sizeof(buf), "%f" , *(double *)dst);break; 349. case AV_OPT_TYPE_RATIONAL: ret = snprintf(buf, sizeof(buf), "%d/%d", ((AVRational*)dst)->num, ((AVRational*)dst)->den);break; 350. case AV_OPT_TYPE_STRING: ^ 351. if (*(uint8_t**)dst) 352. *out_val = av_strdup(*(uint8_t**)dst); libavutil/opt.c:351:13: Taking false branch 349. case AV_OPT_TYPE_RATIONAL: ret = snprintf(buf, sizeof(buf), "%d/%d", ((AVRational*)dst)->num, ((AVRational*)dst)->den);break; 350. case AV_OPT_TYPE_STRING: 351. if (*(uint8_t**)dst) ^ 352. *out_val = av_strdup(*(uint8_t**)dst); 353. else libavutil/opt.c:354:13: 352. *out_val = av_strdup(*(uint8_t**)dst); 353. else 354. *out_val = av_strdup(""); ^ 355. return *out_val ? 0 : AVERROR(ENOMEM); 356. case AV_OPT_TYPE_BINARY: libavutil/mem.c:219:1: start of procedure av_strdup() 217. } 218. 219. char *av_strdup(const char *s) ^ 220. { 221. char *ptr = NULL; libavutil/mem.c:221:5: 219. char *av_strdup(const char *s) 220. { 221. char *ptr = NULL; ^ 222. if (s) { 223. int len = strlen(s) + 1; libavutil/mem.c:222:9: Taking true branch 220. { 221. char *ptr = NULL; 222. if (s) { ^ 223. int len = strlen(s) + 1; 224. ptr = av_realloc(NULL, len); libavutil/mem.c:223:9: 221. char *ptr = NULL; 222. if (s) { 223. int len = strlen(s) + 1; ^ 224. ptr = av_realloc(NULL, len); 225. if (ptr) libavutil/mem.c:224:9: 222. if (s) { 223. int len = strlen(s) + 1; 224. ptr = av_realloc(NULL, len); ^ 225. if (ptr) 226. memcpy(ptr, s, len); libavutil/mem.c:117:1: start of procedure av_realloc() 115. } 116. 117. void *av_realloc(void *ptr, size_t size) ^ 118. { 119. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:124:9: Taking false branch 122. 123. /* let's disallow possibly ambiguous cases */ 124. if (size > (INT_MAX - 16)) ^ 125. return NULL; 126. libavutil/mem.c:136:5: 134. return _aligned_realloc(ptr, size, 32); 135. #else 136. return realloc(ptr, size); ^ 137. #endif 138. } libavutil/mem.c:138:1: return from a call to av_realloc 136. return realloc(ptr, size); 137. #endif 138. } ^ 139. 140. int av_reallocp(void *ptr, size_t size) libavutil/mem.c:225:13: Taking true branch 223. int len = strlen(s) + 1; 224. ptr = av_realloc(NULL, len); 225. if (ptr) ^ 226. memcpy(ptr, s, len); 227. } libavutil/mem.c:226:13: 224. ptr = av_realloc(NULL, len); 225. if (ptr) 226. memcpy(ptr, s, len); ^ 227. } 228. return ptr; libavutil/mem.c:228:5: 226. memcpy(ptr, s, len); 227. } 228. return ptr; ^ 229. } 230. libavutil/mem.c:229:1: return from a call to av_strdup 227. } 228. return ptr; 229. } ^ 230. 231. char *av_strndup(const char *s, size_t len) libavutil/opt.c:355:16: Condition is true 353. else 354. *out_val = av_strdup(""); 355. return *out_val ? 0 : AVERROR(ENOMEM); ^ 356. case AV_OPT_TYPE_BINARY: 357. len = *(int*)(((uint8_t *)dst) + sizeof(uint8_t *)); libavutil/opt.c:355:9: 353. else 354. *out_val = av_strdup(""); 355. return *out_val ? 0 : AVERROR(ENOMEM); ^ 356. case AV_OPT_TYPE_BINARY: 357. len = *(int*)(((uint8_t *)dst) + sizeof(uint8_t *)); libavutil/opt.c:374:1: return from a call to av_opt_get 372. *out_val = av_strdup(buf); 373. return *out_val ? 0 : AVERROR(ENOMEM); 374. } ^ 375. 376. static int get_number(void *obj, const char *name, double *num, int *den, int64_t *intnum, libavformat/hls.c:501:13: Taking true branch 499. 500. while (*opt) { 501. if (av_opt_get(s->pb, *opt, AV_OPT_SEARCH_CHILDREN, &buf) >= 0) { ^ 502. ret = av_dict_set(&c->avio_opts, *opt, buf, 503. AV_DICT_DONT_STRDUP_VAL); libavformat/hls.c:502:13: 500. while (*opt) { 501. if (av_opt_get(s->pb, *opt, AV_OPT_SEARCH_CHILDREN, &buf) >= 0) { 502. ret = av_dict_set(&c->avio_opts, *opt, buf, ^ 503. AV_DICT_DONT_STRDUP_VAL); 504. if (ret < 0) libavutil/dict.c:68:1: start of procedure av_dict_set() 66. } 67. 68. int av_dict_set(AVDictionary **pm, const char *key, const char *value, ^ 69. int flags) 70. { libavutil/dict.c:71:5: 69. int flags) 70. { 71. AVDictionary *m = *pm; ^ 72. AVDictionaryEntry *tag = av_dict_get(m, key, NULL, flags); 73. char *oldval = NULL; libavutil/dict.c:72:5: Skipping av_dict_get(): empty list of specs 70. { 71. AVDictionary *m = *pm; 72. AVDictionaryEntry *tag = av_dict_get(m, key, NULL, flags); ^ 73. char *oldval = NULL; 74. int allocated = !!m; libavutil/dict.c:73:5: 71. AVDictionary *m = *pm; 72. AVDictionaryEntry *tag = av_dict_get(m, key, NULL, flags); 73. char *oldval = NULL; ^ 74. int allocated = !!m; 75. libavutil/dict.c:74:23: Condition is false 72. AVDictionaryEntry *tag = av_dict_get(m, key, NULL, flags); 73. char *oldval = NULL; 74. int allocated = !!m; ^ 75. 76. if (!m) libavutil/dict.c:74:21: 72. AVDictionaryEntry *tag = av_dict_get(m, key, NULL, flags); 73. char *oldval = NULL; 74. int allocated = !!m; ^ 75. 76. if (!m) libavutil/dict.c:74:5: 72. AVDictionaryEntry *tag = av_dict_get(m, key, NULL, flags); 73. char *oldval = NULL; 74. int allocated = !!m; ^ 75. 76. if (!m) libavutil/dict.c:76:10: Taking false branch 74. int allocated = !!m; 75. 76. if (!m) ^ 77. m = *pm = av_mallocz(sizeof(*m)); 78. if (!m) libavutil/dict.c:78:10: Taking false branch 76. if (!m) 77. m = *pm = av_mallocz(sizeof(*m)); 78. if (!m) ^ 79. return AVERROR(ENOMEM); 80. libavutil/dict.c:81:9: Taking false branch 79. return AVERROR(ENOMEM); 80. 81. if (tag) { ^ 82. if (flags & AV_DICT_DONT_OVERWRITE) { 83. if (flags & AV_DICT_DONT_STRDUP_KEY) av_free(key); libavutil/dict.c:94:9: 92. *tag = m->elems[--m->count]; 93. } else { 94. int ret = av_reallocp_array(&m->elems, ^ 95. m->count + 1, sizeof(*m->elems)); 96. if (ret < 0) { libavutil/mem.c:168:1: start of procedure av_reallocp_array() 166. } 167. 168. int av_reallocp_array(void *ptr, size_t nmemb, size_t size) ^ 169. { 170. void *val; libavutil/mem.c:172:10: Taking false branch 170. void *val; 171. 172. if (!size || nmemb >= INT_MAX / size) ^ 173. return AVERROR(ENOMEM); 174. if (!nmemb) { libavutil/mem.c:172:18: Taking true branch 170. void *val; 171. 172. if (!size || nmemb >= INT_MAX / size) ^ 173. return AVERROR(ENOMEM); 174. if (!nmemb) { libavutil/mem.c:173:9: 171. 172. if (!size || nmemb >= INT_MAX / size) 173. return AVERROR(ENOMEM); ^ 174. if (!nmemb) { 175. av_freep(ptr); libavutil/mem.c:188:1: return from a call to av_reallocp_array 186. memcpy(ptr, &val, sizeof(val)); 187. return 0; 188. } ^ 189. 190. void av_free(void *ptr) libavutil/dict.c:96:13: Taking true branch 94. int ret = av_reallocp_array(&m->elems, 95. m->count + 1, sizeof(*m->elems)); 96. if (ret < 0) { ^ 97. if (allocated) 98. av_freep(pm); libavutil/dict.c:97:17: Taking true branch 95. m->count + 1, sizeof(*m->elems)); 96. if (ret < 0) { 97. if (allocated) ^ 98. av_freep(pm); 99. libavutil/dict.c:98:17: Skipping av_freep(): empty list of specs 96. if (ret < 0) { 97. if (allocated) 98. av_freep(pm); ^ 99. 100. return ret; libavutil/dict.c:100:13: 98. av_freep(pm); 99. 100. return ret; ^ 101. } 102. } libavutil/dict.c:126:1: return from a call to av_dict_set 124. 125. return 0; 126. } ^ 127. 128. static int parse_key_value_pair(AVDictionary **pm, const char **buf, libavformat/hls.c:504:17: Taking true branch 502. ret = av_dict_set(&c->avio_opts, *opt, buf, 503. AV_DICT_DONT_STRDUP_VAL); 504. if (ret < 0) ^ 505. return ret; 506. } libavformat/hls.c:505:17: 503. AV_DICT_DONT_STRDUP_VAL); 504. if (ret < 0) 505. return ret; ^ 506. } 507. opt++; libavformat/hls.c:511:1: return from a call to save_avio_options 509. 510. return ret; 511. } ^ 512. 513. static int hls_read_header(AVFormatContext *s)
https://github.com/libav/libav/blob/fdbc544d29176ba69d67dd879df4696f0a19052e/libavformat/hls.c/#L511
d2a_code_trace_data_43573
static size_t get_entropy_hook(RAND_DRBG *drbg, unsigned char **pout, int entropy, size_t min_len, size_t max_len) { size_t ret; HOOK_CTX *ctx = get_hook_ctx(drbg); if (ctx->fail != 0) return 0; ret = ctx->get_entropy( drbg, pout, entropy, min_len, max_len); if (ret != 0) ctx->reseed_count++; return ret; } test/drbgtest.c:509: error: NULL_DEREFERENCE pointer `ctx` last assigned on line 507 could be null and is dereferenced at line 509, column 9. Showing all 13 steps of the trace test/drbgtest.c:503:1: start of procedure get_entropy_hook() 501. 502. /* Intercepts and counts calls to the get_entropy() callback */ 503. > static size_t get_entropy_hook(RAND_DRBG *drbg, unsigned char **pout, 504. int entropy, size_t min_len, size_t max_len) 505. { test/drbgtest.c:507:5: 505. { 506. size_t ret; 507. > HOOK_CTX *ctx = get_hook_ctx(drbg); 508. 509. if (ctx->fail != 0) test/drbgtest.c:497:1: start of procedure get_hook_ctx() 495. static HOOK_CTX master_ctx, public_ctx, private_ctx; 496. 497. > static HOOK_CTX *get_hook_ctx(RAND_DRBG *drbg) 498. { 499. return (HOOK_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); test/drbgtest.c:499:5: 497. static HOOK_CTX *get_hook_ctx(RAND_DRBG *drbg) 498. { 499. > return (HOOK_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); 500. } 501. crypto/rand/drbg_lib.c:617:1: start of procedure RAND_DRBG_get_ex_data() 615. } 616. 617. > void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx) 618. { 619. return CRYPTO_get_ex_data(&drbg->ex_data, idx); crypto/rand/drbg_lib.c:619:5: 617. void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx) 618. { 619. > return CRYPTO_get_ex_data(&drbg->ex_data, idx); 620. } 621. 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. > } crypto/rand/drbg_lib.c:620:1: return from a call to RAND_DRBG_get_ex_data 618. { 619. return CRYPTO_get_ex_data(&drbg->ex_data, idx); 620. > } 621. 622. test/drbgtest.c:500:1: return from a call to get_hook_ctx 498. { 499. return (HOOK_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); 500. > } 501. 502. /* Intercepts and counts calls to the get_entropy() callback */ test/drbgtest.c:509:9: 507. HOOK_CTX *ctx = get_hook_ctx(drbg); 508. 509. > if (ctx->fail != 0) 510. return 0; 511.
https://github.com/openssl/openssl/blob/24d06e8ca07f705635a072dcb6ad08c2555c9025/test/drbgtest.c/#L509
d2a_code_trace_data_43574
uint32_t ngx_utf8_decode(u_char **p, size_t n) { size_t len; uint32_t u, i, valid; u = **p; if (u > 0xf0) { u &= 0x07; valid = 0xffff; len = 3; } else if (u > 0xe0) { u &= 0x0f; valid = 0x7ff; len = 2; } else if (u > 0xc0) { u &= 0x1f; valid = 0x7f; len = 1; } else { (*p)++; return 0xffffffff; } if (n - 1 < len) { return 0xfffffffe; } (*p)++; while (len) { i = *(*p)++; if (i < 0x80) { return 0xffffffff; } u = (u << 6) | (i & 0x3f); len--; } if (u > valid) { return u; } return 0xffffffff; } src/http/modules/ngx_http_autoindex_module.c:337: error: Integer Overflow L2 ([0, +oo] - 1):unsigned64 by call to `ngx_utf8_length`. src/http/modules/ngx_http_autoindex_module.c:254:9: Unknown value from: __errno_location 252. 253. for ( ;; ) { 254. ngx_set_errno(0); ^ 255. 256. if (ngx_read_dir(&dir) == NGX_ERROR) { src/http/modules/ngx_http_autoindex_module.c:271:9: Assignment 269. "http autoindex file: \"%s\"", ngx_de_name(&dir)); 270. 271. len = ngx_de_namelen(&dir); ^ 272. 273. if (ngx_de_name(&dir)[0] == '.') { src/http/modules/ngx_http_autoindex_module.c:324:9: Assignment 322. } 323. 324. entry->name.len = len; ^ 325. 326. entry->name.data = ngx_pnalloc(pool, len + 1); src/http/modules/ngx_http_autoindex_module.c:337:30: Call 335. 336. if (r->utf8) { 337. entry->utf_len = ngx_utf8_length(entry->name.data, entry->name.len); ^ 338. } else { 339. entry->utf_len = len; src/core/ngx_string.c:1138:1: Parameter `n` 1136. 1137. 1138. size_t ^ 1139. ngx_utf8_length(u_char *p, size_t n) 1140. { src/core/ngx_string.c:1155:13: Call 1153. } 1154. 1155. if (ngx_utf8_decode(&p, n) > 0x10ffff) { ^ 1156. /* invalid UTF-8 */ 1157. return n; src/core/ngx_string.c:1081:1: <LHS trace> 1079. */ 1080. 1081. uint32_t ^ 1082. ngx_utf8_decode(u_char **p, size_t n) 1083. { src/core/ngx_string.c:1081:1: Parameter `n` 1079. */ 1080. 1081. uint32_t ^ 1082. ngx_utf8_decode(u_char **p, size_t n) 1083. { src/core/ngx_string.c:1112:9: Binary operation: ([0, +oo] - 1):unsigned64 by call to `ngx_utf8_length` 1110. } 1111. 1112. if (n - 1 < len) { ^ 1113. return 0xfffffffe; 1114. }
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_string.c/#L1112
d2a_code_trace_data_43575
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: BUFFER_OVERRUN_L1 Offset: [-oo, -1] Size: 1 by call to `SCT_new_from_base64`. Showing all 10 steps of the trace test/ct_test.c:468:1: Array declaration 466. } 467. 468. > static int test_encode_tls_sct(void) 469. { 470. const char log_id[] = "3xwuwRUAlFJHqWFoMl3cXHlZ6PfG04j8AC4LvT9012Q="; 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` 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: <Offset 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:24:1: <Length 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` 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:50:12: Array access: Offset: [-oo, -1] Size: 1 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_43576
static int do_multi(int multi) { int n; int fd[2]; int *fds; static char sep[]=":"; fds=malloc(multi*sizeof *fds); for(n=0 ; n < multi ; ++n) { pipe(fd); if(fork()) { close(fd[1]); fds[n]=fd[0]; } else { close(fd[0]); close(1); dup(fd[1]); close(fd[1]); mr=1; usertime=0; return 0; } printf("Forked child %d\n",n); } for(n=0 ; n < multi ; ++n) { FILE *f; char buf[1024]; char *p; f=fdopen(fds[n],"r"); while(fgets(buf,sizeof buf,f)) { p=strchr(buf,'\n'); if(p) *p='\0'; if(buf[0] != '+') { fprintf(stderr,"Don't understand line '%s' from child %d\n", buf,n); continue; } printf("Got: %s from %d\n",buf,n); if(!strncmp(buf,"+F:",3)) { int alg; int j; p=buf+3; alg=atoi(sstrsep(&p,sep)); sstrsep(&p,sep); for(j=0 ; j < SIZE_NUM ; ++j) results[alg][j]+=atof(sstrsep(&p,sep)); } else if(!strncmp(buf,"+F2:",4)) { int k; double d; p=buf+4; k=atoi(sstrsep(&p,sep)); sstrsep(&p,sep); d=atof(sstrsep(&p,sep)); if(n) rsa_results[k][0]=1/(1/rsa_results[k][0]+1/d); else rsa_results[k][0]=d; d=atof(sstrsep(&p,sep)); if(n) rsa_results[k][1]=1/(1/rsa_results[k][1]+1/d); else rsa_results[k][1]=d; } else if(!strncmp(buf,"+F2:",4)) { int k; double d; p=buf+4; k=atoi(sstrsep(&p,sep)); sstrsep(&p,sep); d=atof(sstrsep(&p,sep)); if(n) rsa_results[k][0]=1/(1/rsa_results[k][0]+1/d); else rsa_results[k][0]=d; d=atof(sstrsep(&p,sep)); if(n) rsa_results[k][1]=1/(1/rsa_results[k][1]+1/d); else rsa_results[k][1]=d; } else if(!strncmp(buf,"+F3:",4)) { int k; double d; p=buf+4; k=atoi(sstrsep(&p,sep)); sstrsep(&p,sep); d=atof(sstrsep(&p,sep)); if(n) dsa_results[k][0]=1/(1/dsa_results[k][0]+1/d); else dsa_results[k][0]=d; d=atof(sstrsep(&p,sep)); if(n) dsa_results[k][1]=1/(1/dsa_results[k][1]+1/d); else dsa_results[k][1]=d; } #ifndef OPENSSL_NO_ECDSA else if(!strncmp(buf,"+F4:",4)) { int k; double d; p=buf+4; k=atoi(sstrsep(&p,sep)); sstrsep(&p,sep); d=atof(sstrsep(&p,sep)); if(n) ecdsa_results[k][0]=1/(1/ecdsa_results[k][0]+1/d); else ecdsa_results[k][0]=d; d=atof(sstrsep(&p,sep)); if(n) ecdsa_results[k][1]=1/(1/ecdsa_results[k][1]+1/d); else ecdsa_results[k][1]=d; } #endif #ifndef OPENSSL_NO_ECDH else if(!strncmp(buf,"+F5:",4)) { int k; double d; p=buf+4; k=atoi(sstrsep(&p,sep)); sstrsep(&p,sep); d=atof(sstrsep(&p,sep)); if(n) ecdh_results[k][0]=1/(1/ecdh_results[k][0]+1/d); else ecdh_results[k][0]=d; } #endif else if(!strncmp(buf,"+H:",3)) { } else fprintf(stderr,"Unknown type '%s' from child %d\n",buf,n); } } return 1; } apps/speed.c:2433: error: NULL_DEREFERENCE pointer `f` last assigned on line 2432 could be null and is dereferenced by call to `fgets()` at line 2433, column 9. Showing all 9 steps of the trace apps/speed.c:2396:1: start of procedure do_multi() 2394. 2395. #ifdef HAVE_FORK 2396. > static int do_multi(int multi) 2397. { 2398. int n; apps/speed.c:2401:2: 2399. int fd[2]; 2400. int *fds; 2401. > static char sep[]=":"; 2402. 2403. fds=malloc(multi*sizeof *fds); apps/speed.c:2403:2: 2401. static char sep[]=":"; 2402. 2403. > fds=malloc(multi*sizeof *fds); 2404. for(n=0 ; n < multi ; ++n) 2405. { apps/speed.c:2404:6: 2402. 2403. fds=malloc(multi*sizeof *fds); 2404. > for(n=0 ; n < multi ; ++n) 2405. { 2406. pipe(fd); apps/speed.c:2404:12: Loop condition is false. Leaving loop 2402. 2403. fds=malloc(multi*sizeof *fds); 2404. for(n=0 ; n < multi ; ++n) ^ 2405. { 2406. pipe(fd); apps/speed.c:2426:6: 2424. 2425. /* for now, assume the pipe is long enough to take all the output */ 2426. > for(n=0 ; n < multi ; ++n) 2427. { 2428. FILE *f; apps/speed.c:2426:12: Loop condition is true. Entering loop body 2424. 2425. /* for now, assume the pipe is long enough to take all the output */ 2426. for(n=0 ; n < multi ; ++n) ^ 2427. { 2428. FILE *f; apps/speed.c:2432:3: 2430. char *p; 2431. 2432. > f=fdopen(fds[n],"r"); 2433. while(fgets(buf,sizeof buf,f)) 2434. { apps/speed.c:2433:9: 2431. 2432. f=fdopen(fds[n],"r"); 2433. > while(fgets(buf,sizeof buf,f)) 2434. { 2435. p=strchr(buf,'\n');
https://github.com/openssl/openssl/blob/a1d85309ee183c97a5ee4f8277f17d87d7786e25/apps/speed.c/#L2433
d2a_code_trace_data_43577
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:1056: error: Uninitialized Value The value read from ymin was never initialized. libavcodec/motion_est_template.c:1056:9: 1054. return dmin; 1055. } 1056. CHECK_MV( P_MEDIAN[0] >>shift , P_MEDIAN[1] >>shift) ^ 1057. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)-1) 1058. CHECK_CLIPPED_MV((P_MEDIAN[0]>>shift) , (P_MEDIAN[1]>>shift)+1)
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L1056
d2a_code_trace_data_43578
OCSP_RESPONSE *process_responder(OCSP_REQUEST *req, const char *host, const char *path, const char *port, int use_ssl, STACK_OF(CONF_VALUE) *headers, int req_timeout) { BIO *cbio = NULL; SSL_CTX *ctx = NULL; OCSP_RESPONSE *resp = NULL; cbio = BIO_new_connect(host); if (cbio == NULL) { BIO_printf(bio_err, "Error creating connect BIO\n"); goto end; } if (port != NULL) BIO_set_conn_port(cbio, port); if (use_ssl == 1) { BIO *sbio; ctx = SSL_CTX_new(TLS_client_method()); if (ctx == NULL) { BIO_printf(bio_err, "Error creating SSL context.\n"); goto end; } SSL_CTX_set_mode(ctx, SSL_MODE_AUTO_RETRY); sbio = BIO_new_ssl(ctx, 1); cbio = BIO_push(sbio, cbio); } resp = query_responder(cbio, host, path, headers, req, req_timeout); if (resp == NULL) BIO_printf(bio_err, "Error querying OCSP responder\n"); end: BIO_free_all(cbio); SSL_CTX_free(ctx); return resp; } apps/ocsp.c:1643: error: NULL_DEREFERENCE pointer `ctx` last assigned on line 1616 could be null and is dereferenced by call to `SSL_CTX_free()` at line 1643, column 5. Showing all 31 steps of the trace apps/ocsp.c:1609:1: start of procedure process_responder() 1607. } 1608. 1609. > OCSP_RESPONSE *process_responder(OCSP_REQUEST *req, 1610. const char *host, const char *path, 1611. const char *port, int use_ssl, apps/ocsp.c:1615:5: 1613. int req_timeout) 1614. { 1615. > BIO *cbio = NULL; 1616. SSL_CTX *ctx = NULL; 1617. OCSP_RESPONSE *resp = NULL; apps/ocsp.c:1616:5: 1614. { 1615. BIO *cbio = NULL; 1616. > SSL_CTX *ctx = NULL; 1617. OCSP_RESPONSE *resp = NULL; 1618. apps/ocsp.c:1617:5: 1615. BIO *cbio = NULL; 1616. SSL_CTX *ctx = NULL; 1617. > OCSP_RESPONSE *resp = NULL; 1618. 1619. cbio = BIO_new_connect(host); apps/ocsp.c:1619:5: 1617. OCSP_RESPONSE *resp = NULL; 1618. 1619. > cbio = BIO_new_connect(host); 1620. if (cbio == NULL) { 1621. BIO_printf(bio_err, "Error creating connect BIO\n"); crypto/bio/bss_conn.c:527:1: start of procedure BIO_new_connect() 525. } 526. 527. > BIO *BIO_new_connect(const char *str) 528. { 529. BIO *ret; crypto/bio/bss_conn.c:531:5: 529. BIO *ret; 530. 531. > ret = BIO_new(BIO_s_connect()); 532. if (ret == NULL) 533. return NULL; crypto/bio/bss_conn.c:245:1: start of procedure BIO_s_connect() 243. } 244. 245. > const BIO_METHOD *BIO_s_connect(void) 246. { 247. return &methods_connectp; crypto/bio/bss_conn.c:247:5: 245. const BIO_METHOD *BIO_s_connect(void) 246. { 247. > return &methods_connectp; 248. } 249. crypto/bio/bss_conn.c:248:1: return from a call to BIO_s_connect 246. { 247. return &methods_connectp; 248. > } 249. 250. static int conn_new(BIO *bi) crypto/bio/bss_conn.c:531:5: Skipping BIO_new(): empty list of specs 529. BIO *ret; 530. 531. ret = BIO_new(BIO_s_connect()); ^ 532. if (ret == NULL) 533. return NULL; crypto/bio/bss_conn.c:532:9: Taking true branch 530. 531. ret = BIO_new(BIO_s_connect()); 532. if (ret == NULL) ^ 533. return NULL; 534. if (BIO_set_conn_hostname(ret, str)) crypto/bio/bss_conn.c:533:9: 531. ret = BIO_new(BIO_s_connect()); 532. if (ret == NULL) 533. > return NULL; 534. if (BIO_set_conn_hostname(ret, str)) 535. return ret; crypto/bio/bss_conn.c:538:1: return from a call to BIO_new_connect 536. BIO_free(ret); 537. return NULL; 538. > } 539. 540. #endif apps/ocsp.c:1620:9: Taking true branch 1618. 1619. cbio = BIO_new_connect(host); 1620. if (cbio == NULL) { ^ 1621. BIO_printf(bio_err, "Error creating connect BIO\n"); 1622. goto end; apps/ocsp.c:1621:9: Skipping BIO_printf(): empty list of specs 1619. cbio = BIO_new_connect(host); 1620. if (cbio == NULL) { 1621. BIO_printf(bio_err, "Error creating connect BIO\n"); ^ 1622. goto end; 1623. } apps/ocsp.c:1641:2: 1639. if (resp == NULL) 1640. BIO_printf(bio_err, "Error querying OCSP responder\n"); 1641. > end: 1642. BIO_free_all(cbio); 1643. SSL_CTX_free(ctx); apps/ocsp.c:1642:5: Skipping BIO_free_all(): empty list of specs 1640. BIO_printf(bio_err, "Error querying OCSP responder\n"); 1641. end: 1642. BIO_free_all(cbio); ^ 1643. SSL_CTX_free(ctx); 1644. return resp; apps/ocsp.c:1643:5: 1641. end: 1642. BIO_free_all(cbio); 1643. > SSL_CTX_free(ctx); 1644. return resp; 1645. } ssl/ssl_lib.c:3239:1: start of procedure SSL_CTX_free() 3237. } 3238. 3239. > void SSL_CTX_free(SSL_CTX *a) 3240. { 3241. int i; ssl/ssl_lib.c:3243:9: Taking false branch 3241. int i; 3242. 3243. if (a == NULL) ^ 3244. return; 3245. ssl/ssl_lib.c:3246:5: 3244. return; 3245. 3246. > CRYPTO_DOWN_REF(&a->references, &i, a->lock); 3247. REF_PRINT_COUNT("SSL_CTX", a); 3248. if (i > 0) include/internal/refcount.h:49:1: start of procedure CRYPTO_DOWN_REF() 47. * otherwise imply an acquire fence. Hence conditional acquire fence... 48. */ 49. > static inline int CRYPTO_DOWN_REF(_Atomic int *val, int *ret, void *lock) 50. { 51. *ret = atomic_fetch_sub_explicit(val, 1, memory_order_relaxed) - 1; include/internal/refcount.h:51:5: 49. static inline int CRYPTO_DOWN_REF(_Atomic int *val, int *ret, void *lock) 50. { 51. > *ret = atomic_fetch_sub_explicit(val, 1, memory_order_relaxed) - 1; 52. if (*ret == 0) 53. atomic_thread_fence(memory_order_acquire); include/internal/refcount.h:52:9: Taking true branch 50. { 51. *ret = atomic_fetch_sub_explicit(val, 1, memory_order_relaxed) - 1; 52. if (*ret == 0) ^ 53. atomic_thread_fence(memory_order_acquire); 54. return 1; include/internal/refcount.h:53:9: Skipping __c11_atomic_thread_fence(): method has no implementation 51. *ret = atomic_fetch_sub_explicit(val, 1, memory_order_relaxed) - 1; 52. if (*ret == 0) 53. atomic_thread_fence(memory_order_acquire); ^ 54. return 1; 55. } include/internal/refcount.h:54:5: 52. if (*ret == 0) 53. atomic_thread_fence(memory_order_acquire); 54. > return 1; 55. } 56. include/internal/refcount.h:55:1: return from a call to CRYPTO_DOWN_REF 53. atomic_thread_fence(memory_order_acquire); 54. return 1; 55. > } 56. 57. # elif defined(__GNUC__) && defined(__ATOMIC_RELAXED) && __GCC_ATOMIC_INT_LOCK_FREE > 0 ssl/ssl_lib.c:3248:9: Taking true branch 3246. CRYPTO_DOWN_REF(&a->references, &i, a->lock); 3247. REF_PRINT_COUNT("SSL_CTX", a); 3248. if (i > 0) ^ 3249. return; 3250. REF_ASSERT_ISNT(i < 0); ssl/ssl_lib.c:3249:9: 3247. REF_PRINT_COUNT("SSL_CTX", a); 3248. if (i > 0) 3249. > return; 3250. REF_ASSERT_ISNT(i < 0); 3251. ssl/ssl_lib.c:3301:1: return from a call to SSL_CTX_free 3299. 3300. OPENSSL_free(a); 3301. > } 3302. 3303. void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb)
https://github.com/openssl/openssl/blob/c3612970465d0a13f2fc5b47bc28ca18516a699d/apps/ocsp.c/#L1643
d2a_code_trace_data_43579
int test_gf2m_mod_div(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b[2], *c, *d, *e, *f; 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(); f = BN_new(); BN_GF2m_arr2poly(p0, b[0]); BN_GF2m_arr2poly(p1, b[1]); for (i = 0; i < num0; i++) { BN_bntest_rand(a, 512, 0, 0); BN_bntest_rand(c, 512, 0, 0); for (j = 0; j < 2; j++) { BN_GF2m_mod_div(d, a, c, b[j], ctx); BN_GF2m_mod_mul(e, d, c, b[j], ctx); BN_GF2m_mod_div(f, a, e, b[j], ctx); if (!BN_is_one(f)) { fprintf(stderr, "GF(2^m) modular division 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); BN_free(f); return ret; } test/bntest.c:1475: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 1448, column 9 is not reachable after line 1475, column 5. Showing all 177 steps of the trace test/bntest.c:1441:1: start of procedure test_gf2m_mod_div() 1439. } 1440. 1441. > int test_gf2m_mod_div(BIO *bp, BN_CTX *ctx) 1442. { 1443. BIGNUM *a, *b[2], *c, *d, *e, *f; test/bntest.c:1444:5: 1442. { 1443. BIGNUM *a, *b[2], *c, *d, *e, *f; 1444. > int i, j, ret = 0; 1445. int p0[] = { 163, 7, 6, 3, 0, -1 }; 1446. int p1[] = { 193, 15, 0, -1 }; test/bntest.c:1445:5: 1443. BIGNUM *a, *b[2], *c, *d, *e, *f; 1444. int i, j, ret = 0; 1445. > int p0[] = { 163, 7, 6, 3, 0, -1 }; 1446. int p1[] = { 193, 15, 0, -1 }; 1447. test/bntest.c:1446:5: 1444. int i, j, ret = 0; 1445. int p0[] = { 163, 7, 6, 3, 0, -1 }; 1446. > int p1[] = { 193, 15, 0, -1 }; 1447. 1448. a = BN_new(); test/bntest.c:1448:5: 1446. int p1[] = { 193, 15, 0, -1 }; 1447. 1448. > a = BN_new(); 1449. b[0] = BN_new(); 1450. 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:1449:5: 1447. 1448. a = BN_new(); 1449. > b[0] = BN_new(); 1450. b[1] = BN_new(); 1451. 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:1450:5: 1448. a = BN_new(); 1449. b[0] = BN_new(); 1450. > b[1] = BN_new(); 1451. c = BN_new(); 1452. 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:1451:5: 1449. b[0] = BN_new(); 1450. b[1] = BN_new(); 1451. > c = BN_new(); 1452. d = BN_new(); 1453. 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:1452:5: 1450. b[1] = BN_new(); 1451. c = BN_new(); 1452. > d = BN_new(); 1453. e = BN_new(); 1454. f = 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:1453:5: 1451. c = BN_new(); 1452. d = BN_new(); 1453. > e = BN_new(); 1454. f = BN_new(); 1455. 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:1454:5: 1452. d = BN_new(); 1453. e = BN_new(); 1454. > f = BN_new(); 1455. 1456. 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:1456:5: Skipping BN_GF2m_arr2poly(): empty list of specs 1454. f = BN_new(); 1455. 1456. BN_GF2m_arr2poly(p0, b[0]); ^ 1457. BN_GF2m_arr2poly(p1, b[1]); 1458. test/bntest.c:1457:5: Skipping BN_GF2m_arr2poly(): empty list of specs 1455. 1456. BN_GF2m_arr2poly(p0, b[0]); 1457. BN_GF2m_arr2poly(p1, b[1]); ^ 1458. 1459. for (i = 0; i < num0; i++) { test/bntest.c:1459:10: 1457. BN_GF2m_arr2poly(p1, b[1]); 1458. 1459. > for (i = 0; i < num0; i++) { 1460. BN_bntest_rand(a, 512, 0, 0); 1461. BN_bntest_rand(c, 512, 0, 0); test/bntest.c:1459:17: Loop condition is false. Leaving loop 1457. BN_GF2m_arr2poly(p1, b[1]); 1458. 1459. for (i = 0; i < num0; i++) { ^ 1460. BN_bntest_rand(a, 512, 0, 0); 1461. BN_bntest_rand(c, 512, 0, 0); test/bntest.c:1473:5: 1471. } 1472. } 1473. > ret = 1; 1474. err: 1475. BN_free(a); test/bntest.c:1474:2: 1472. } 1473. ret = 1; 1474. > err: 1475. BN_free(a); 1476. BN_free(b[0]); test/bntest.c:1475:5: 1473. ret = 1; 1474. err: 1475. > BN_free(a); 1476. BN_free(b[0]); 1477. 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/#L1475
d2a_code_trace_data_43580
static int verify_alpn(SSL *client, SSL *server) { const unsigned char *client_proto, *server_proto; unsigned int client_proto_len = 0, server_proto_len = 0; SSL_get0_alpn_selected(client, &client_proto, &client_proto_len); SSL_get0_alpn_selected(server, &server_proto, &server_proto_len); OPENSSL_free(alpn_selected); alpn_selected = NULL; if (client_proto_len != server_proto_len) { BIO_printf(bio_stdout, "ALPN selected protocols differ!\n"); goto err; } if (client_proto != NULL && memcmp(client_proto, server_proto, client_proto_len) != 0) { BIO_printf(bio_stdout, "ALPN selected protocols differ!\n"); goto err; } if (client_proto_len > 0 && alpn_expected == NULL) { BIO_printf(bio_stdout, "ALPN unexpectedly negotiated\n"); goto err; } if (alpn_expected != NULL && (client_proto_len != strlen(alpn_expected) || memcmp(client_proto, alpn_expected, client_proto_len) != 0)) { BIO_printf(bio_stdout, "ALPN selected protocols not equal to expected protocol: %s\n", alpn_expected); goto err; } return 0; err: BIO_printf(bio_stdout, "ALPN results: client: '"); BIO_write(bio_stdout, client_proto, client_proto_len); BIO_printf(bio_stdout, "', server: '"); BIO_write(bio_stdout, server_proto, server_proto_len); BIO_printf(bio_stdout, "'\n"); BIO_printf(bio_stdout, "ALPN configured: client: '%s', server: '%s'\n", alpn_client, alpn_server); return -1; } test/ssltest.c:465: error: NULL_DEREFERENCE pointer `server_proto` last assigned on line 454 could be null and is dereferenced by call to `memcmp()` at line 465, column 9. Showing all 33 steps of the trace test/ssltest.c:449:1: start of procedure verify_alpn() 447. } 448. 449. > static int verify_alpn(SSL *client, SSL *server) 450. { 451. const unsigned char *client_proto, *server_proto; test/ssltest.c:452:5: 450. { 451. const unsigned char *client_proto, *server_proto; 452. > unsigned int client_proto_len = 0, server_proto_len = 0; 453. SSL_get0_alpn_selected(client, &client_proto, &client_proto_len); 454. SSL_get0_alpn_selected(server, &server_proto, &server_proto_len); test/ssltest.c:453:5: 451. const unsigned char *client_proto, *server_proto; 452. unsigned int client_proto_len = 0, server_proto_len = 0; 453. > SSL_get0_alpn_selected(client, &client_proto, &client_proto_len); 454. SSL_get0_alpn_selected(server, &server_proto, &server_proto_len); 455. ssl/ssl_lib.c:1725:1: start of procedure SSL_get0_alpn_selected() 1723. * respond with a negotiated protocol then |*len| will be zero. 1724. */ 1725. > void SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data, 1726. unsigned *len) 1727. { ssl/ssl_lib.c:1728:5: 1726. unsigned *len) 1727. { 1728. > *data = NULL; 1729. if (ssl->s3) 1730. *data = ssl->s3->alpn_selected; ssl/ssl_lib.c:1729:9: Taking true branch 1727. { 1728. *data = NULL; 1729. if (ssl->s3) ^ 1730. *data = ssl->s3->alpn_selected; 1731. if (*data == NULL) ssl/ssl_lib.c:1730:9: 1728. *data = NULL; 1729. if (ssl->s3) 1730. > *data = ssl->s3->alpn_selected; 1731. if (*data == NULL) 1732. *len = 0; ssl/ssl_lib.c:1731:9: Taking false branch 1729. if (ssl->s3) 1730. *data = ssl->s3->alpn_selected; 1731. if (*data == NULL) ^ 1732. *len = 0; 1733. else ssl/ssl_lib.c:1734:9: 1732. *len = 0; 1733. else 1734. > *len = ssl->s3->alpn_selected_len; 1735. } 1736. ssl/ssl_lib.c:1731:5: 1729. if (ssl->s3) 1730. *data = ssl->s3->alpn_selected; 1731. > if (*data == NULL) 1732. *len = 0; 1733. else ssl/ssl_lib.c:1735:1: return from a call to SSL_get0_alpn_selected 1733. else 1734. *len = ssl->s3->alpn_selected_len; 1735. > } 1736. 1737. test/ssltest.c:454:5: 452. unsigned int client_proto_len = 0, server_proto_len = 0; 453. SSL_get0_alpn_selected(client, &client_proto, &client_proto_len); 454. > SSL_get0_alpn_selected(server, &server_proto, &server_proto_len); 455. 456. OPENSSL_free(alpn_selected); ssl/ssl_lib.c:1725:1: start of procedure SSL_get0_alpn_selected() 1723. * respond with a negotiated protocol then |*len| will be zero. 1724. */ 1725. > void SSL_get0_alpn_selected(const SSL *ssl, const unsigned char **data, 1726. unsigned *len) 1727. { ssl/ssl_lib.c:1728:5: 1726. unsigned *len) 1727. { 1728. > *data = NULL; 1729. if (ssl->s3) 1730. *data = ssl->s3->alpn_selected; ssl/ssl_lib.c:1729:9: Taking true branch 1727. { 1728. *data = NULL; 1729. if (ssl->s3) ^ 1730. *data = ssl->s3->alpn_selected; 1731. if (*data == NULL) ssl/ssl_lib.c:1730:9: 1728. *data = NULL; 1729. if (ssl->s3) 1730. > *data = ssl->s3->alpn_selected; 1731. if (*data == NULL) 1732. *len = 0; ssl/ssl_lib.c:1731:9: Taking true branch 1729. if (ssl->s3) 1730. *data = ssl->s3->alpn_selected; 1731. if (*data == NULL) ^ 1732. *len = 0; 1733. else ssl/ssl_lib.c:1732:9: 1730. *data = ssl->s3->alpn_selected; 1731. if (*data == NULL) 1732. > *len = 0; 1733. else 1734. *len = ssl->s3->alpn_selected_len; ssl/ssl_lib.c:1731:5: 1729. if (ssl->s3) 1730. *data = ssl->s3->alpn_selected; 1731. > if (*data == NULL) 1732. *len = 0; 1733. else ssl/ssl_lib.c:1735:1: return from a call to SSL_get0_alpn_selected 1733. else 1734. *len = ssl->s3->alpn_selected_len; 1735. > } 1736. 1737. test/ssltest.c:456:5: 454. SSL_get0_alpn_selected(server, &server_proto, &server_proto_len); 455. 456. > OPENSSL_free(alpn_selected); 457. alpn_selected = NULL; 458. crypto/mem.c:371:1: start of procedure CRYPTO_free() 369. } 370. 371. > void CRYPTO_free(void *str) 372. { 373. if (free_debug_func != NULL) crypto/mem.c:373:9: Taking true branch 371. void CRYPTO_free(void *str) 372. { 373. if (free_debug_func != NULL) ^ 374. free_debug_func(str, 0); 375. free_func(str); crypto/mem.c:374:9: Skipping __function_pointer__(): unresolved function pointer 372. { 373. if (free_debug_func != NULL) 374. free_debug_func(str, 0); ^ 375. free_func(str); 376. if (free_debug_func != NULL) crypto/mem.c:375:5: Skipping __function_pointer__(): unresolved function pointer 373. if (free_debug_func != NULL) 374. free_debug_func(str, 0); 375. free_func(str); ^ 376. if (free_debug_func != NULL) 377. free_debug_func(NULL, 1); crypto/mem.c:376:9: Taking true branch 374. free_debug_func(str, 0); 375. free_func(str); 376. if (free_debug_func != NULL) ^ 377. free_debug_func(NULL, 1); 378. } crypto/mem.c:377:9: Skipping __function_pointer__(): unresolved function pointer 375. free_func(str); 376. if (free_debug_func != NULL) 377. free_debug_func(NULL, 1); ^ 378. } 379. crypto/mem.c:376:5: 374. free_debug_func(str, 0); 375. free_func(str); 376. > if (free_debug_func != NULL) 377. free_debug_func(NULL, 1); 378. } crypto/mem.c:378:1: return from a call to CRYPTO_free 376. if (free_debug_func != NULL) 377. free_debug_func(NULL, 1); 378. > } 379. 380. void CRYPTO_clear_free(void *str, size_t num) test/ssltest.c:457:5: 455. 456. OPENSSL_free(alpn_selected); 457. > alpn_selected = NULL; 458. 459. if (client_proto_len != server_proto_len) { test/ssltest.c:459:9: Taking false branch 457. alpn_selected = NULL; 458. 459. if (client_proto_len != server_proto_len) { ^ 460. BIO_printf(bio_stdout, "ALPN selected protocols differ!\n"); 461. goto err; test/ssltest.c:464:9: Taking true branch 462. } 463. 464. if (client_proto != NULL && ^ 465. memcmp(client_proto, server_proto, client_proto_len) != 0) { 466. BIO_printf(bio_stdout, "ALPN selected protocols differ!\n"); test/ssltest.c:465:9: 463. 464. if (client_proto != NULL && 465. > memcmp(client_proto, server_proto, client_proto_len) != 0) { 466. BIO_printf(bio_stdout, "ALPN selected protocols differ!\n"); 467. goto err;
https://github.com/openssl/openssl/blob/57ce7b617c602ae8513c22daa2bda31f179edb0f/test/ssltest.c/#L465
d2a_code_trace_data_43581
int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len) { register UCHAR *p; if (len == 0) return 1; p=c->data; if (c->num != 0) { if ((c->num+len) >= MD2_BLOCK) { memcpy(&(p[c->num]),data,MD2_BLOCK-c->num); md2_block(c,c->data); data+=(MD2_BLOCK - c->num); len-=(MD2_BLOCK - c->num); c->num=0; } else { memcpy(&(p[c->num]),data,(int)len); c->num+=(int)len; return 1; } } while (len >= MD2_BLOCK) { md2_block(c,data); data+=MD2_BLOCK; len-=MD2_BLOCK; } memcpy(p,data,(int)len); c->num=(int)len; return 1; } apps/speed.c:927: error: BUFFER_OVERRUN_L2 Offset added: [8, 8192] Size: 16 by call to `MD2`. Showing all 9 steps of the trace apps/speed.c:393:31: Assignment 391. #define D_EVP 15 392. double d,results[ALGOR_NUM][SIZE_NUM]; 393. static int lengths[SIZE_NUM]={8,64,256,1024,8*1024}; ^ 394. long c[ALGOR_NUM][SIZE_NUM]; 395. static const char *names[ALGOR_NUM]={ apps/speed.c:927:5: Call 925. Time_F(START,usertime); 926. for (count=0,run=1; COND(c[D_MD2][j]); count++) 927. MD2(buf,(unsigned long)lengths[j],&(md2[0])); ^ 928. d=Time_F(STOP,usertime); 929. BIO_printf(bio_err,"%ld %s's in %.2fs\n", crypto/md2/md2_one.c:66:1: Parameter `n` 64. * map my MD functions to different names */ 65. 66. > unsigned char *MD2(const unsigned char *d, unsigned long n, unsigned char *md) 67. { 68. MD2_CTX c; crypto/md2/md2_one.c:74:2: Call 72. MD2_Init(&c); 73. #ifndef CHARSET_EBCDIC 74. MD2_Update(&c,d,n); ^ 75. #else 76. { crypto/md2/md2_dgst.c:127:1: <Offset trace> 125. } 126. 127. > int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len) 128. { 129. register UCHAR *p; crypto/md2/md2_dgst.c:127:1: Parameter `len` 125. } 126. 127. > int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len) 128. { 129. register UCHAR *p; crypto/md2/md2_dgst.c:127:1: <Length trace> 125. } 126. 127. > int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len) 128. { 129. register UCHAR *p; crypto/md2/md2_dgst.c:127:1: Parameter `c->data[*]` 125. } 126. 127. > int MD2_Update(MD2_CTX *c, const unsigned char *data, unsigned long len) 128. { 129. register UCHAR *p; crypto/md2/md2_dgst.c:147:4: Array access: Offset added: [8, 8192] Size: 16 by call to `MD2` 145. else 146. { 147. memcpy(&(p[c->num]),data,(int)len); ^ 148. /* data+=len; */ 149. c->num+=(int)len;
https://github.com/openssl/openssl/blob/a45e4a5537e009761652db0d9aa1ef28b1ce8937/crypto/md2/md2_dgst.c/#L147
d2a_code_trace_data_43582
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } crypto/ec/ec_key.c:418: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `EC_POINT_mul`. Showing all 28 steps of the trace crypto/ec/ec_key.c:395:10: Call 393. } 394. /* 5.6.2.3.3 (Step 4) : pub_key * order is the point at infinity. */ 395. if (!EC_POINT_mul(eckey->group, point, NULL, eckey->pub_key, order, ctx)) { ^ 396. ECerr(EC_F_EC_KEY_SIMPLE_CHECK_KEY, ERR_R_EC_LIB); 397. goto err; 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 `r->Z->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_key.c:418:14: Call 416. * Check if generator * priv_key = pub_key 417. */ 418. if (!EC_POINT_mul(eckey->group, point, eckey->priv_key, ^ 419. NULL, NULL, ctx)) { 420. ECerr(EC_F_EC_KEY_SIMPLE_CHECK_KEY, ERR_R_EC_LIB); crypto/ec/ec_lib.c:971:1: Parameter `r->X->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 `r->X->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 `r->X->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 `r->X->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:253:13: Call 251. || (bn_wexpand(s->Y, group_top) == NULL) 252. || (bn_wexpand(s->Z, group_top) == NULL) 253. || (bn_wexpand(r->X, group_top) == NULL) ^ 254. || (bn_wexpand(r->Y, group_top) == NULL) 255. || (bn_wexpand(r->Z, group_top) == NULL) crypto/bn/bn_lib.c:962:1: Parameter `a->top` 960. } 961. 962. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 963. { 964. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:964:37: Call 962. BIGNUM *bn_wexpand(BIGNUM *a, int words) 963. { 964. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 965. } 966. crypto/bn/bn_lib.c:245:1: Parameter `b->top` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `words` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:224:13: Call 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/mem.c:228:1: Parameter `num` 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:17: Call 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/mem.c:230:5: Assignment 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:235:5: Assignment 233. if (ret != NULL) 234. memset(ret, 0, num); 235. return ret; ^ 236. } 237. crypto/bn/bn_lib.c:224:9: Assignment 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `EC_POINT_mul` 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/3051bf2afab7ac8b7b9c64e68755d1addd2fb8ff/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_43583
int ssl3_cbc_copy_mac(unsigned char *out, const SSL3_RECORD *rec, size_t md_size) { #if defined(CBC_MAC_ROTATE_IN_PLACE) unsigned char rotated_mac_buf[64 + EVP_MAX_MD_SIZE]; unsigned char *rotated_mac; #else unsigned char rotated_mac[EVP_MAX_MD_SIZE]; #endif size_t mac_end = rec->length; size_t mac_start = mac_end - md_size; size_t in_mac; size_t scan_start = 0; size_t i, j; size_t rotate_offset; if (!ossl_assert(rec->orig_len >= md_size && md_size <= EVP_MAX_MD_SIZE)) return 0; #if defined(CBC_MAC_ROTATE_IN_PLACE) rotated_mac = rotated_mac_buf + ((0 - (size_t)rotated_mac_buf) & 63); #endif if (rec->orig_len > md_size + 255 + 1) scan_start = rec->orig_len - (md_size + 255 + 1); in_mac = 0; rotate_offset = 0; memset(rotated_mac, 0, md_size); for (i = scan_start, j = 0; i < rec->orig_len; i++) { size_t mac_started = constant_time_eq_s(i, mac_start); size_t mac_ended = constant_time_lt_s(i, mac_end); unsigned char b = rec->data[i]; in_mac |= mac_started; in_mac &= mac_ended; rotate_offset |= j & mac_started; rotated_mac[j++] |= b & in_mac; j &= constant_time_lt_s(j, md_size); } #if defined(CBC_MAC_ROTATE_IN_PLACE) j = 0; for (i = 0; i < md_size; i++) { ((volatile unsigned char *)rotated_mac)[rotate_offset ^ 32]; out[j++] = rotated_mac[rotate_offset++]; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); } #else memset(out, 0, md_size); rotate_offset = md_size - rotate_offset; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); for (i = 0; i < md_size; i++) { for (j = 0; j < md_size; j++) out[j] |= rotated_mac[i] & constant_time_eq_8_s(j, rotate_offset); rotate_offset++; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); } #endif return 1; } ssl/record/ssl3_record.c:1914: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, 17728]):unsigned64 by call to `dtls1_process_record`. Showing all 10 steps of the trace ssl/record/ssl3_record.c:1745:1: Parameter `s->session->ext.max_fragment_len_mode` 1743. */ 1744. /* used only by dtls1_read_bytes */ 1745. > int dtls1_get_record(SSL *s) 1746. { 1747. int ssl_major, ssl_minor; ssl/record/ssl3_record.c:1914:10: Call 1912. } 1913. 1914. if (!dtls1_process_record(s, bitmap)) { ^ 1915. rr->length = 0; 1916. RECORD_LAYER_reset_packet_length(&s->rlayer); /* dump this record */ ssl/record/ssl3_record.c:1519:1: Parameter `s->rlayer.rrec.length` 1517. } 1518. 1519. > int dtls1_process_record(SSL *s, DTLS1_BITMAP *bitmap) 1520. { 1521. int i, al; ssl/record/ssl3_record.c:1652:18: Call 1650. */ 1651. mac = mac_tmp; 1652. if (!ssl3_cbc_copy_mac(mac_tmp, rr, mac_size)) { ^ 1653. al = SSL_AD_INTERNAL_ERROR; 1654. SSLerr(SSL_F_DTLS1_PROCESS_RECORD, ERR_R_INTERNAL_ERROR); ssl/record/ssl3_record.c:1444:1: <LHS trace> 1442. #define CBC_MAC_ROTATE_IN_PLACE 1443. 1444. > int ssl3_cbc_copy_mac(unsigned char *out, 1445. const SSL3_RECORD *rec, size_t md_size) 1446. { ssl/record/ssl3_record.c:1444:1: Parameter `rec->length` 1442. #define CBC_MAC_ROTATE_IN_PLACE 1443. 1444. > int ssl3_cbc_copy_mac(unsigned char *out, 1445. const SSL3_RECORD *rec, size_t md_size) 1446. { ssl/record/ssl3_record.c:1457:5: Assignment 1455. * mac_end is the index of |rec->data| just after the end of the MAC. 1456. */ 1457. size_t mac_end = rec->length; ^ 1458. size_t mac_start = mac_end - md_size; 1459. size_t in_mac; ssl/record/ssl3_record.c:1444:1: <RHS trace> 1442. #define CBC_MAC_ROTATE_IN_PLACE 1443. 1444. > int ssl3_cbc_copy_mac(unsigned char *out, 1445. const SSL3_RECORD *rec, size_t md_size) 1446. { ssl/record/ssl3_record.c:1444:1: Parameter `md_size` 1442. #define CBC_MAC_ROTATE_IN_PLACE 1443. 1444. > int ssl3_cbc_copy_mac(unsigned char *out, 1445. const SSL3_RECORD *rec, size_t md_size) 1446. { ssl/record/ssl3_record.c:1458:5: Binary operation: ([0, +oo] - [0, 17728]):unsigned64 by call to `dtls1_process_record` 1456. */ 1457. size_t mac_end = rec->length; 1458. size_t mac_start = mac_end - md_size; ^ 1459. size_t in_mac; 1460. /*
https://github.com/openssl/openssl/blob/9f5671c7e9f30dfa53b1a2b553f234c2761ceb66/ssl/record/ssl3_record.c/#L1458
d2a_code_trace_data_43584
static int flv_read_packet(AVFormatContext *s, AVPacket *pkt) { int ret, i, type, size, pts, flags, is_audio, next, pos; AVStream *st = NULL; for(;;){ pos = url_ftell(s->pb); url_fskip(s->pb, 4); type = get_byte(s->pb); size = get_be24(s->pb); pts = get_be24(s->pb); pts |= get_byte(s->pb) << 24; if (url_feof(s->pb)) return AVERROR(EIO); url_fskip(s->pb, 3); flags = 0; if(size == 0) continue; next= size + url_ftell(s->pb); if (type == FLV_TAG_TYPE_AUDIO) { is_audio=1; flags = get_byte(s->pb); } else if (type == FLV_TAG_TYPE_VIDEO) { is_audio=0; flags = get_byte(s->pb); } else { if (type == FLV_TAG_TYPE_META && size > 13+1+4) flv_read_metabody(s, next); else av_log(s, AV_LOG_ERROR, "skipping flv packet: type %d, size %d, flags %d\n", type, size, flags); url_fseek(s->pb, next, SEEK_SET); continue; } for(i=0;i<s->nb_streams;i++) { st = s->streams[i]; if (st->id == is_audio) break; } if(i == s->nb_streams){ av_log(NULL, AV_LOG_ERROR, "invalid stream\n"); st= create_stream(s, is_audio); } if( (st->discard >= AVDISCARD_NONKEY && !((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY || is_audio)) ||(st->discard >= AVDISCARD_BIDIR && ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_DISP_INTER && !is_audio)) || st->discard >= AVDISCARD_ALL ){ url_fseek(s->pb, next, SEEK_SET); continue; } if ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY) av_add_index_entry(st, pos, pts, size, 0, AVINDEX_KEYFRAME); break; } if(!url_is_streamed(s->pb) && s->duration==AV_NOPTS_VALUE){ int size; const int pos= url_ftell(s->pb); const int fsize= url_fsize(s->pb); url_fseek(s->pb, fsize-4, SEEK_SET); size= get_be32(s->pb); url_fseek(s->pb, fsize-3-size, SEEK_SET); if(size == get_be24(s->pb) + 11){ s->duration= get_be24(s->pb) * (int64_t)AV_TIME_BASE / 1000; } url_fseek(s->pb, pos, SEEK_SET); } if(is_audio){ if(!st->codec->sample_rate || !st->codec->bits_per_sample || (!st->codec->codec_id && !st->codec->codec_tag)) { st->codec->channels = (flags & FLV_AUDIO_CHANNEL_MASK) == FLV_STEREO ? 2 : 1; if((flags & FLV_AUDIO_CODECID_MASK) == FLV_CODECID_NELLYMOSER_8HZ_MONO) st->codec->sample_rate= 8000; else st->codec->sample_rate = (44100 << ((flags & FLV_AUDIO_SAMPLERATE_MASK) >> FLV_AUDIO_SAMPLERATE_OFFSET) >> 3); st->codec->bits_per_sample = (flags & FLV_AUDIO_SAMPLESIZE_MASK) ? 16 : 8; flv_set_audio_codec(s, st, flags & FLV_AUDIO_CODECID_MASK); } }else{ size -= flv_set_video_codec(s, st, flags & FLV_VIDEO_CODECID_MASK); } ret= av_get_packet(s->pb, pkt, size - 1); if (ret <= 0) { return AVERROR(EIO); } pkt->size = ret; pkt->pts = pts; pkt->stream_index = st->index; if (is_audio || ((flags & FLV_VIDEO_FRAMETYPE_MASK) == FLV_FRAME_KEY)) pkt->flags |= PKT_FLAG_KEY; return ret; } libavformat/flvdec.c:358: error: Uninitialized Value The value read from flags was never initialized. libavformat/flvdec.c:358:17: 356. st->codec->sample_rate= 8000; 357. else 358. st->codec->sample_rate = (44100 << ((flags & FLV_AUDIO_SAMPLERATE_MASK) >> FLV_AUDIO_SAMPLERATE_OFFSET) >> 3); ^ 359. st->codec->bits_per_sample = (flags & FLV_AUDIO_SAMPLESIZE_MASK) ? 16 : 8; 360. flv_set_audio_codec(s, st, flags & FLV_AUDIO_CODECID_MASK);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavformat/flvdec.c/#L358
d2a_code_trace_data_43585
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/wavpack.c:253: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `bitstream_read_bit`. libavcodec/wavpack.c:249:11: Unknown value from: __builtin_clz 247. if (k < 1) 248. return 0; 249. p = av_log2(k); ^ 250. e = (1 << (p + 1)) - k - 1; 251. res = bitstream_read(bc, p); libavcodec/wavpack.c:249:5: Assignment 247. if (k < 1) 248. return 0; 249. p = av_log2(k); ^ 250. e = (1 << (p + 1)) - k - 1; 251. res = bitstream_read(bc, p); libavcodec/wavpack.c:251:11: Call 249. p = av_log2(k); 250. e = (1 << (p + 1)) - k - 1; 251. res = bitstream_read(bc, p); ^ 252. if (res >= e) 253. res = (res << 1) - e + bitstream_read_bit(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/wavpack.c:253:32: Call 251. res = bitstream_read(bc, p); 252. if (res >= e) 253. res = (res << 1) - e + bitstream_read_bit(bc); ^ 254. return res; 255. } libavcodec/bitstream.h:145:1: Parameter `bc->bits_left` 143. 144. /* Return one bit from the buffer. */ 145. static inline unsigned bitstream_read_bit(BitstreamContext *bc) ^ 146. { 147. if (!bc->bits_left) libavcodec/bitstream.h:150:12: Call 148. refill_64(bc); 149. 150. return get_val(bc, 1); ^ 151. } 152. libavcodec/bitstream.h:130:1: <LHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `bc->bits_left` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: <RHS trace> 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:130:1: Parameter `n` 128. } 129. 130. static inline uint64_t get_val(BitstreamContext *bc, unsigned n) ^ 131. { 132. #ifdef BITSTREAM_READER_LE libavcodec/bitstream.h:139:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `bitstream_read_bit` 137. bc->bits <<= n; 138. #endif 139. bc->bits_left -= n; ^ 140. 141. return ret;
https://github.com/libav/libav/blob/562ef82d6a7f96f6b9da1219a5aaf7d9d7056f1b/libavcodec/bitstream.h/#L139
d2a_code_trace_data_43586
const uint8_t *ff_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state){ int i; assert(p<=end); if(p>=end) return end; for(i=0; i<3; i++){ uint32_t tmp= *state << 8; *state= tmp + *(p++); if(tmp == 0x100 || p==end) return p; } while(p<end){ if (p[-1] > 1 ) p+= 3; else if(p[-2] ) p+= 2; else if(p[-3]|(p[-1]-1)) p++; else{ p++; break; } } p= FFMIN(p, end)-4; *state= AV_RB32(p); return p+4; } libavcodec/mpegvideo_parser.c:42: error: Integer Overflow L1 ([1099511627520, +oo] + [0, +oo]):unsigned32 by call to `ff_find_start_code`. libavcodec/mpegvideo_parser.c:26:1: Parameter `*buf` 24. #include "mpegvideo.h" 25. 26. static void mpegvideo_extract_headers(AVCodecParserContext *s, ^ 27. AVCodecContext *avctx, 28. const uint8_t *buf, int buf_size) libavcodec/mpegvideo_parser.c:42:14: Call 40. while (buf < buf_end) { 41. start_code= -1; 42. buf= ff_find_start_code(buf, buf_end, &start_code); ^ 43. bytes_left = buf_end - buf; 44. switch(start_code) { libavcodec/mpegvideo.c:82:1: <LHS trace> 80. 81. 82. const uint8_t *ff_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state){ ^ 83. int i; 84. libavcodec/mpegvideo.c:82:1: Parameter `*state` 80. 81. 82. const uint8_t *ff_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state){ ^ 83. int i; 84. libavcodec/mpegvideo.c:90:9: Assignment 88. 89. for(i=0; i<3; i++){ 90. uint32_t tmp= *state << 8; ^ 91. *state= tmp + *(p++); 92. if(tmp == 0x100 || p==end) libavcodec/mpegvideo.c:82:1: <RHS trace> 80. 81. 82. const uint8_t *ff_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state){ ^ 83. int i; 84. libavcodec/mpegvideo.c:82:1: Parameter `*p` 80. 81. 82. const uint8_t *ff_find_start_code(const uint8_t * restrict p, const uint8_t *end, uint32_t * restrict state){ ^ 83. int i; 84. libavcodec/mpegvideo.c:91:9: Binary operation: ([1099511627520, +oo] + [0, +oo]):unsigned32 by call to `ff_find_start_code` 89. for(i=0; i<3; i++){ 90. uint32_t tmp= *state << 8; 91. *state= tmp + *(p++); ^ 92. if(tmp == 0x100 || p==end) 93. return p;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo.c/#L91
d2a_code_trace_data_43587
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:317: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_exp_mont_consttime`. Showing all 29 steps of the trace test/bntest.c:317:10: Call 315. BN_bntest_rand(a, 1024, 0, 0); 316. BN_zero(p); 317. if (!BN_mod_exp_mont_consttime(d, a, p, m, ctx, NULL)) ^ 318. return 0; 319. if (!BN_is_one(d)) { crypto/bn/bn_exp.c:601:1: Parameter `ctx->stack.depth` 599. * http://www.daemonology.net/hyperthreading-considered-harmful/) 600. */ 601. > int BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, 602. const BIGNUM *m, BN_CTX *ctx, 603. BN_MONT_CTX *in_mont) crypto/bn/bn_exp.c:641:5: Call 639. } 640. 641. BN_CTX_start(ctx); ^ 642. 643. /* crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_exp.c:652:14: Call 650. if ((mont = BN_MONT_CTX_new()) == NULL) 651. goto err; 652. if (!BN_MONT_CTX_set(mont, m, ctx)) ^ 653. goto err; 654. } 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_mod_exp_mont_consttime` 271. static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; ^ 274. } 275.
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_43588
static int cng_decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *avpkt) { CNGContext *p = avctx->priv_data; int buf_size = avpkt->size; int ret, i; int16_t *buf_out; float e = 1.0; float scaling; if (avpkt->size) { float dbov = -avpkt->data[0] / 10.0; p->target_energy = 1081109975 * pow(10, dbov) * 0.75; memset(p->target_refl_coef, 0, sizeof(p->refl_coef)); for (i = 0; i < FFMIN(avpkt->size - 1, p->order); i++) { p->target_refl_coef[i] = (avpkt->data[1 + i] - 127) / 128.0; } make_lpc_coefs(p->lpc_coef, p->refl_coef, p->order); } p->energy = p->energy / 2 + p->target_energy / 2; for (i = 0; i < p->order; i++) p->refl_coef[i] = 0.6 *p->refl_coef[i] + 0.4 * p->target_refl_coef[i]; for (i = 0; i < p->order; i++) e *= 1.0 - p->refl_coef[i]*p->refl_coef[i]; scaling = sqrt(e * p->energy / 1081109975); for (i = 0; i < avctx->frame_size; i++) { int r = (av_lfg_get(&p->lfg) & 0xffff) - 0x8000; p->excitation[i] = scaling * r; } ff_celp_lp_synthesis_filterf(p->filter_out + p->order, p->lpc_coef, p->excitation, avctx->frame_size, p->order); p->avframe.nb_samples = avctx->frame_size; if ((ret = avctx->get_buffer(avctx, &p->avframe)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } buf_out = (int16_t *)p->avframe.data[0]; for (i = 0; i < avctx->frame_size; i++) buf_out[i] = p->filter_out[i + p->order]; memcpy(p->filter_out, p->filter_out + avctx->frame_size, p->order * sizeof(*p->filter_out)); *got_frame_ptr = 1; *(AVFrame *)data = p->avframe; return buf_size; } libavcodec/cngdec.c:127: error: Integer Overflow L2 ([0, 65535] - 32768):unsigned32. libavcodec/cngdec.c:125:15: <LHS trace> 123. e *= 1.0 - p->refl_coef[i]*p->refl_coef[i]; 124. 125. scaling = sqrt(e * p->energy / 1081109975); ^ 126. for (i = 0; i < avctx->frame_size; i++) { 127. int r = (av_lfg_get(&p->lfg) & 0xffff) - 0x8000; libavcodec/cngdec.c:125:15: Unknown value from: sqrt 123. e *= 1.0 - p->refl_coef[i]*p->refl_coef[i]; 124. 125. scaling = sqrt(e * p->energy / 1081109975); ^ 126. for (i = 0; i < avctx->frame_size; i++) { 127. int r = (av_lfg_get(&p->lfg) & 0xffff) - 0x8000; libavcodec/cngdec.c:127:18: Call 125. scaling = sqrt(e * p->energy / 1081109975); 126. for (i = 0; i < avctx->frame_size; i++) { 127. int r = (av_lfg_get(&p->lfg) & 0xffff) - 0x8000; ^ 128. p->excitation[i] = scaling * r; 129. } libavutil/lfg.h:38:1: Parameter `c->state[*]` 36. * it may be good enough and faster for your specific use case. 37. */ 38. static inline unsigned int av_lfg_get(AVLFG *c){ ^ 39. c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63]; 40. return c->state[c->index++ & 63]; libavutil/lfg.h:40:5: Assignment 38. static inline unsigned int av_lfg_get(AVLFG *c){ 39. c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63]; 40. return c->state[c->index++ & 63]; ^ 41. } 42. libavcodec/cngdec.c:127:9: Binary operation: ([0, 65535] - 32768):unsigned32 125. scaling = sqrt(e * p->energy / 1081109975); 126. for (i = 0; i < avctx->frame_size; i++) { 127. int r = (av_lfg_get(&p->lfg) & 0xffff) - 0x8000; ^ 128. p->excitation[i] = scaling * r; 129. }
https://github.com/libav/libav/blob/9b500b8f6c9806f3979f9d1fb874b7f4a802c656/libavcodec/cngdec.c/#L127
d2a_code_trace_data_43589
static av_always_inline void encode_mb_internal(MpegEncContext *s, int motion_x, int motion_y, int mb_block_height, int mb_block_count) { int16_t weight[8][64]; DCTELEM orig[8][64]; const int mb_x= s->mb_x; const int mb_y= s->mb_y; int i; int skip_dct[8]; int dct_offset = s->linesize*8; uint8_t *ptr_y, *ptr_cb, *ptr_cr; int wrap_y, wrap_c; for(i=0; i<mb_block_count; i++) skip_dct[i]=s->skipdct; if(s->adaptive_quant){ const int last_qp= s->qscale; const int mb_xy= mb_x + mb_y*s->mb_stride; s->lambda= s->lambda_table[mb_xy]; update_qscale(s); if(!(s->flags&CODEC_FLAG_QP_RD)){ s->qscale= s->current_picture_ptr->qscale_table[mb_xy]; s->dquant= s->qscale - last_qp; if(s->out_format==FMT_H263){ s->dquant= av_clip(s->dquant, -2, 2); if(s->codec_id==CODEC_ID_MPEG4){ if(!s->mb_intra){ if(s->pict_type == FF_B_TYPE){ if(s->dquant&1 || s->mv_dir&MV_DIRECT) s->dquant= 0; } if(s->mv_type==MV_TYPE_8X8) s->dquant=0; } } } } ff_set_qscale(s, last_qp + s->dquant); }else if(s->flags&CODEC_FLAG_QP_RD) ff_set_qscale(s, s->qscale + s->dquant); wrap_y = s->linesize; wrap_c = s->uvlinesize; ptr_y = s->new_picture.data[0] + (mb_y * 16 * wrap_y) + mb_x * 16; ptr_cb = s->new_picture.data[1] + (mb_y * mb_block_height * wrap_c) + mb_x * 8; ptr_cr = s->new_picture.data[2] + (mb_y * mb_block_height * wrap_c) + mb_x * 8; if(mb_x*16+16 > s->width || mb_y*16+16 > s->height){ uint8_t *ebuf= s->edge_emu_buffer + 32; ff_emulated_edge_mc(ebuf , ptr_y , wrap_y,16,16,mb_x*16,mb_y*16, s->width , s->height); ptr_y= ebuf; ff_emulated_edge_mc(ebuf+18*wrap_y , ptr_cb, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1); ptr_cb= ebuf+18*wrap_y; ff_emulated_edge_mc(ebuf+18*wrap_y+8, ptr_cr, wrap_c, 8, mb_block_height, mb_x*8, mb_y*8, s->width>>1, s->height>>1); ptr_cr= ebuf+18*wrap_y+8; } if (s->mb_intra) { if(s->flags&CODEC_FLAG_INTERLACED_DCT){ int progressive_score, interlaced_score; s->interlaced_dct=0; progressive_score= s->dsp.ildct_cmp[4](s, ptr_y , NULL, wrap_y, 8) +s->dsp.ildct_cmp[4](s, ptr_y + wrap_y*8, NULL, wrap_y, 8) - 400; if(progressive_score > 0){ interlaced_score = s->dsp.ildct_cmp[4](s, ptr_y , NULL, wrap_y*2, 8) +s->dsp.ildct_cmp[4](s, ptr_y + wrap_y , NULL, wrap_y*2, 8); if(progressive_score > interlaced_score){ s->interlaced_dct=1; dct_offset= wrap_y; wrap_y<<=1; if (s->chroma_format == CHROMA_422) wrap_c<<=1; } } } s->dsp.get_pixels(s->block[0], ptr_y , wrap_y); s->dsp.get_pixels(s->block[1], ptr_y + 8, wrap_y); s->dsp.get_pixels(s->block[2], ptr_y + dct_offset , wrap_y); s->dsp.get_pixels(s->block[3], ptr_y + dct_offset + 8, wrap_y); if(s->flags&CODEC_FLAG_GRAY){ skip_dct[4]= 1; skip_dct[5]= 1; }else{ s->dsp.get_pixels(s->block[4], ptr_cb, wrap_c); s->dsp.get_pixels(s->block[5], ptr_cr, wrap_c); if(!s->chroma_y_shift){ s->dsp.get_pixels(s->block[6], ptr_cb + (dct_offset>>1), wrap_c); s->dsp.get_pixels(s->block[7], ptr_cr + (dct_offset>>1), wrap_c); } } }else{ op_pixels_func (*op_pix)[4]; qpel_mc_func (*op_qpix)[16]; uint8_t *dest_y, *dest_cb, *dest_cr; dest_y = s->dest[0]; dest_cb = s->dest[1]; dest_cr = s->dest[2]; if ((!s->no_rounding) || s->pict_type==FF_B_TYPE){ op_pix = s->dsp.put_pixels_tab; op_qpix= s->dsp.put_qpel_pixels_tab; }else{ op_pix = s->dsp.put_no_rnd_pixels_tab; op_qpix= s->dsp.put_no_rnd_qpel_pixels_tab; } if (s->mv_dir & MV_DIR_FORWARD) { MPV_motion(s, dest_y, dest_cb, dest_cr, 0, s->last_picture.data, op_pix, op_qpix); op_pix = s->dsp.avg_pixels_tab; op_qpix= s->dsp.avg_qpel_pixels_tab; } if (s->mv_dir & MV_DIR_BACKWARD) { MPV_motion(s, dest_y, dest_cb, dest_cr, 1, s->next_picture.data, op_pix, op_qpix); } if(s->flags&CODEC_FLAG_INTERLACED_DCT){ int progressive_score, interlaced_score; s->interlaced_dct=0; progressive_score= s->dsp.ildct_cmp[0](s, dest_y , ptr_y , wrap_y, 8) +s->dsp.ildct_cmp[0](s, dest_y + wrap_y*8, ptr_y + wrap_y*8, wrap_y, 8) - 400; if(s->avctx->ildct_cmp == FF_CMP_VSSE) progressive_score -= 400; if(progressive_score>0){ interlaced_score = s->dsp.ildct_cmp[0](s, dest_y , ptr_y , wrap_y*2, 8) +s->dsp.ildct_cmp[0](s, dest_y + wrap_y , ptr_y + wrap_y , wrap_y*2, 8); if(progressive_score > interlaced_score){ s->interlaced_dct=1; dct_offset= wrap_y; wrap_y<<=1; if (s->chroma_format == CHROMA_422) wrap_c<<=1; } } } s->dsp.diff_pixels(s->block[0], ptr_y , dest_y , wrap_y); s->dsp.diff_pixels(s->block[1], ptr_y + 8, dest_y + 8, wrap_y); s->dsp.diff_pixels(s->block[2], ptr_y + dct_offset , dest_y + dct_offset , wrap_y); s->dsp.diff_pixels(s->block[3], ptr_y + dct_offset + 8, dest_y + dct_offset + 8, wrap_y); if(s->flags&CODEC_FLAG_GRAY){ skip_dct[4]= 1; skip_dct[5]= 1; }else{ s->dsp.diff_pixels(s->block[4], ptr_cb, dest_cb, wrap_c); s->dsp.diff_pixels(s->block[5], ptr_cr, dest_cr, wrap_c); if(!s->chroma_y_shift){ s->dsp.diff_pixels(s->block[6], ptr_cb + (dct_offset>>1), dest_cb + (dct_offset>>1), wrap_c); s->dsp.diff_pixels(s->block[7], ptr_cr + (dct_offset>>1), dest_cr + (dct_offset>>1), wrap_c); } } if(s->current_picture.mc_mb_var[s->mb_stride*mb_y+ mb_x]<2*s->qscale*s->qscale){ if(s->dsp.sad[1](NULL, ptr_y , dest_y , wrap_y, 8) < 20*s->qscale) skip_dct[0]= 1; if(s->dsp.sad[1](NULL, ptr_y + 8, dest_y + 8, wrap_y, 8) < 20*s->qscale) skip_dct[1]= 1; if(s->dsp.sad[1](NULL, ptr_y +dct_offset , dest_y +dct_offset , wrap_y, 8) < 20*s->qscale) skip_dct[2]= 1; if(s->dsp.sad[1](NULL, ptr_y +dct_offset+ 8, dest_y +dct_offset+ 8, wrap_y, 8) < 20*s->qscale) skip_dct[3]= 1; if(s->dsp.sad[1](NULL, ptr_cb , dest_cb , wrap_c, 8) < 20*s->qscale) skip_dct[4]= 1; if(s->dsp.sad[1](NULL, ptr_cr , dest_cr , wrap_c, 8) < 20*s->qscale) skip_dct[5]= 1; if(!s->chroma_y_shift){ if(s->dsp.sad[1](NULL, ptr_cb +(dct_offset>>1), dest_cb +(dct_offset>>1), wrap_c, 8) < 20*s->qscale) skip_dct[6]= 1; if(s->dsp.sad[1](NULL, ptr_cr +(dct_offset>>1), dest_cr +(dct_offset>>1), wrap_c, 8) < 20*s->qscale) skip_dct[7]= 1; } } } if(s->avctx->quantizer_noise_shaping){ if(!skip_dct[0]) get_visual_weight(weight[0], ptr_y , wrap_y); if(!skip_dct[1]) get_visual_weight(weight[1], ptr_y + 8, wrap_y); if(!skip_dct[2]) get_visual_weight(weight[2], ptr_y + dct_offset , wrap_y); if(!skip_dct[3]) get_visual_weight(weight[3], ptr_y + dct_offset + 8, wrap_y); if(!skip_dct[4]) get_visual_weight(weight[4], ptr_cb , wrap_c); if(!skip_dct[5]) get_visual_weight(weight[5], ptr_cr , wrap_c); if(!s->chroma_y_shift){ if(!skip_dct[6]) get_visual_weight(weight[6], ptr_cb + (dct_offset>>1), wrap_c); if(!skip_dct[7]) get_visual_weight(weight[7], ptr_cr + (dct_offset>>1), wrap_c); } memcpy(orig[0], s->block[0], sizeof(DCTELEM)*64*mb_block_count); } assert(s->out_format!=FMT_MJPEG || s->qscale==8); { for(i=0;i<mb_block_count;i++) { if(!skip_dct[i]){ int overflow; s->block_last_index[i] = s->dct_quantize(s, s->block[i], i, s->qscale, &overflow); if (overflow) clip_coeffs(s, s->block[i], s->block_last_index[i]); }else s->block_last_index[i]= -1; } if(s->avctx->quantizer_noise_shaping){ for(i=0;i<mb_block_count;i++) { if(!skip_dct[i]){ s->block_last_index[i] = dct_quantize_refine(s, s->block[i], weight[i], orig[i], i, s->qscale); } } } if(s->luma_elim_threshold && !s->mb_intra) for(i=0; i<4; i++) dct_single_coeff_elimination(s, i, s->luma_elim_threshold); if(s->chroma_elim_threshold && !s->mb_intra) for(i=4; i<mb_block_count; i++) dct_single_coeff_elimination(s, i, s->chroma_elim_threshold); if(s->flags & CODEC_FLAG_CBP_RD){ for(i=0;i<mb_block_count;i++) { if(s->block_last_index[i] == -1) s->coded_score[i]= INT_MAX/256; } } } if((s->flags&CODEC_FLAG_GRAY) && s->mb_intra){ s->block_last_index[4]= s->block_last_index[5]= 0; s->block[4][0]= s->block[5][0]= (1024 + s->c_dc_scale/2)/ s->c_dc_scale; } if(s->alternate_scan && s->dct_quantize != dct_quantize_c){ for(i=0; i<mb_block_count; i++){ int j; if(s->block_last_index[i]>0){ for(j=63; j>0; j--){ if(s->block[i][ s->intra_scantable.permutated[j] ]) break; } s->block_last_index[i]= j; } } } switch(s->codec_id){ case CODEC_ID_MPEG1VIDEO: case CODEC_ID_MPEG2VIDEO: if (ENABLE_MPEG1VIDEO_ENCODER || ENABLE_MPEG2VIDEO_ENCODER) mpeg1_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_MPEG4: if (ENABLE_MPEG4_ENCODER) mpeg4_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_MSMPEG4V2: case CODEC_ID_MSMPEG4V3: case CODEC_ID_WMV1: if (ENABLE_MSMPEG4_ENCODER) msmpeg4_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_WMV2: if (ENABLE_WMV2_ENCODER) ff_wmv2_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_H261: if (ENABLE_H261_ENCODER) ff_h261_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_H263: case CODEC_ID_H263P: case CODEC_ID_FLV1: case CODEC_ID_RV10: case CODEC_ID_RV20: if (ENABLE_H263_ENCODER || ENABLE_H263P_ENCODER || ENABLE_FLV_ENCODER || ENABLE_RV10_ENCODER || ENABLE_RV20_ENCODER) h263_encode_mb(s, s->block, motion_x, motion_y); break; case CODEC_ID_MJPEG: if (ENABLE_MJPEG_ENCODER) ff_mjpeg_encode_mb(s, s->block); break; default: assert(0); } } libavcodec/mpegvideo_enc.c:1639: error: Uninitialized Value The value read from skip_dct[_] was never initialized. libavcodec/mpegvideo_enc.c:1639:13: 1637. if(s->avctx->quantizer_noise_shaping){ 1638. if(!skip_dct[0]) get_visual_weight(weight[0], ptr_y , wrap_y); 1639. if(!skip_dct[1]) get_visual_weight(weight[1], ptr_y + 8, wrap_y); ^ 1640. if(!skip_dct[2]) get_visual_weight(weight[2], ptr_y + dct_offset , wrap_y); 1641. if(!skip_dct[3]) get_visual_weight(weight[3], ptr_y + dct_offset + 8, wrap_y);
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/mpegvideo_enc.c/#L1639
d2a_code_trace_data_43590
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/tls13secretstest.c:382: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `SSL_free`. Showing all 16 steps of the trace test/tls13secretstest.c:270:9: Call 268. goto err; 269. 270. s = SSL_new(ctx); ^ 271. if (!TEST_ptr(s )) 272. goto err; ssl/ssl_lib.c:522:1: Parameter `ctx->sessions->num_items` 520. } 521. 522. > SSL *SSL_new(SSL_CTX *ctx) 523. { 524. SSL *s; test/tls13secretstest.c:382:5: Call 380. ret = 1; 381. err: 382. SSL_free(s); ^ 383. SSL_CTX_free(ctx); 384. return ret; ssl/ssl_lib.c:968:1: Parameter `s->session_ctx->sessions->num_items` 966. } 967. 968. > void SSL_free(SSL *s) 969. { 970. int i; ssl/ssl_lib.c:999:9: Call 997. /* Make the next call work :-) */ 998. if (s->session != NULL) { 999. ssl_clear_bad_session(s); ^ 1000. SSL_SESSION_free(s->session); 1001. } ssl/ssl_sess.c:1049:1: Parameter `s->session_ctx->sessions->num_items` 1047. } 1048. 1049. > int ssl_clear_bad_session(SSL *s) 1050. { 1051. if ((s->session != NULL) && ssl/ssl_sess.c:1054:9: Call 1052. !(s->shutdown & SSL_SENT_SHUTDOWN) && 1053. !(SSL_in_init(s) || SSL_in_before(s))) { 1054. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 1055. return (1); 1056. } else ssl/ssl_sess.c:725:1: Parameter `ctx->sessions->num_items` 723. } 724. 725. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 726. { 727. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:727:12: Call 725. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 726. { 727. return remove_session_lock(ctx, c, 1); ^ 728. } 729. ssl/ssl_sess.c:730:1: Parameter `ctx->sessions->num_items` 728. } 729. 730. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 731. { 732. SSL_SESSION *r; ssl/ssl_sess.c:740:17: Call 738. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 739. ret = 1; 740. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 741. SSL_SESSION_list_remove(ctx, c); 742. } ssl/ssl_locl.h:721:1: Parameter `lh->num_items` 719. } TLSEXT_INDEX; 720. 721. > DEFINE_LHASH_OF(SSL_SESSION); 722. /* Needed in ssl_cert.c */ 723. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:721:1: Call 719. } TLSEXT_INDEX; 720. 721. > DEFINE_LHASH_OF(SSL_SESSION); 722. /* Needed in ssl_cert.c */ 723. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:103:1: <LHS trace> 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:103:1: Parameter `lh->num_items` 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:123:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `SSL_free` 121. } 122. 123. lh->num_items--; ^ 124. if ((lh->num_nodes > MIN_NODES) && 125. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
https://github.com/openssl/openssl/blob/7f7eb90b8ac55997c5c825bb3ebcfe28611e06f5/crypto/lhash/lhash.c/#L123
d2a_code_trace_data_43591
DH *ssl_get_auto_dh(SSL *s) { int dh_secbits = 80; if (s->cert->dh_tmp_auto == 2) return DH_get_1024_160(); if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) { if (s->s3->tmp.new_cipher->strength_bits == 256) dh_secbits = 128; else dh_secbits = 80; } else { CERT_PKEY *cpk = ssl_get_server_send_pkey(s); dh_secbits = EVP_PKEY_security_bits(cpk->privatekey); } if (dh_secbits >= 128) { DH *dhp = DH_new(); BIGNUM *p, *g; if (dhp == NULL) return NULL; g = BN_new(); if (g != NULL) BN_set_word(g, 2); if (dh_secbits >= 192) p = BN_get_rfc3526_prime_8192(NULL); else p = BN_get_rfc3526_prime_3072(NULL); if (p == NULL || g == NULL || !DH_set0_pqg(dhp, p, NULL, g)) { DH_free(dhp); BN_free(p); BN_free(g); return NULL; } return dhp; } if (dh_secbits >= 112) return DH_get_2048_224(); return DH_get_1024_160(); } ssl/t1_lib.c:4298: error: NULL_DEREFERENCE pointer `cpk` last assigned on line 4297 could be null and is dereferenced at line 4298, column 45. Showing all 30 steps of the trace ssl/t1_lib.c:4286:1: start of procedure ssl_get_auto_dh() 4284. 4285. #ifndef OPENSSL_NO_DH 4286. > DH *ssl_get_auto_dh(SSL *s) 4287. { 4288. int dh_secbits = 80; ssl/t1_lib.c:4288:5: 4286. DH *ssl_get_auto_dh(SSL *s) 4287. { 4288. > int dh_secbits = 80; 4289. if (s->cert->dh_tmp_auto == 2) 4290. return DH_get_1024_160(); ssl/t1_lib.c:4289:9: Taking false branch 4287. { 4288. int dh_secbits = 80; 4289. if (s->cert->dh_tmp_auto == 2) ^ 4290. return DH_get_1024_160(); 4291. if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) { ssl/t1_lib.c:4291:9: Taking false branch 4289. if (s->cert->dh_tmp_auto == 2) 4290. return DH_get_1024_160(); 4291. if (s->s3->tmp.new_cipher->algorithm_auth & (SSL_aNULL | SSL_aPSK)) { ^ 4292. if (s->s3->tmp.new_cipher->strength_bits == 256) 4293. dh_secbits = 128; ssl/t1_lib.c:4297:9: 4295. dh_secbits = 80; 4296. } else { 4297. > CERT_PKEY *cpk = ssl_get_server_send_pkey(s); 4298. dh_secbits = EVP_PKEY_security_bits(cpk->privatekey); 4299. } ssl/ssl_lib.c:2857:1: start of procedure ssl_get_server_send_pkey() 2855. } 2856. 2857. > CERT_PKEY *ssl_get_server_send_pkey(SSL *s) 2858. { 2859. CERT *c; ssl/ssl_lib.c:2862:5: 2860. int i; 2861. 2862. > c = s->cert; 2863. if (!s->s3 || !s->s3->tmp.new_cipher) 2864. return NULL; ssl/ssl_lib.c:2863:10: Taking false branch 2861. 2862. c = s->cert; 2863. if (!s->s3 || !s->s3->tmp.new_cipher) ^ 2864. return NULL; 2865. ssl_set_masks(s); ssl/ssl_lib.c:2863:20: Taking false branch 2861. 2862. c = s->cert; 2863. if (!s->s3 || !s->s3->tmp.new_cipher) ^ 2864. return NULL; 2865. ssl_set_masks(s); ssl/ssl_lib.c:2865:5: Skipping ssl_set_masks(): empty list of specs 2863. if (!s->s3 || !s->s3->tmp.new_cipher) 2864. return NULL; 2865. ssl_set_masks(s); ^ 2866. 2867. i = ssl_get_server_cert_index(s); ssl/ssl_lib.c:2867:5: 2865. ssl_set_masks(s); 2866. 2867. > i = ssl_get_server_cert_index(s); 2868. 2869. /* This may or may not be an error. */ ssl/ssl_lib.c:2836:1: start of procedure ssl_get_server_cert_index() 2834. #endif 2835. 2836. > static int ssl_get_server_cert_index(const SSL *s) 2837. { 2838. int idx; ssl/ssl_lib.c:2839:5: 2837. { 2838. int idx; 2839. > idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher); 2840. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509) 2841. idx = SSL_PKEY_RSA_SIGN; ssl/ssl_ciph.c:1893:1: start of procedure ssl_cipher_get_cert_index() 1891. 1892. /* For a cipher return the index corresponding to the certificate type */ 1893. > int ssl_cipher_get_cert_index(const SSL_CIPHER *c) 1894. { 1895. uint32_t alg_a; ssl/ssl_ciph.c:1897:5: 1895. uint32_t alg_a; 1896. 1897. > alg_a = c->algorithm_auth; 1898. 1899. if (alg_a & SSL_aECDSA) ssl/ssl_ciph.c:1899:9: Taking false branch 1897. alg_a = c->algorithm_auth; 1898. 1899. if (alg_a & SSL_aECDSA) ^ 1900. return SSL_PKEY_ECC; 1901. else if (alg_a & SSL_aDSS) ssl/ssl_ciph.c:1901:14: Taking false branch 1899. if (alg_a & SSL_aECDSA) 1900. return SSL_PKEY_ECC; 1901. else if (alg_a & SSL_aDSS) ^ 1902. return SSL_PKEY_DSA_SIGN; 1903. else if (alg_a & SSL_aRSA) ssl/ssl_ciph.c:1903:14: Taking true branch 1901. else if (alg_a & SSL_aDSS) 1902. return SSL_PKEY_DSA_SIGN; 1903. else if (alg_a & SSL_aRSA) ^ 1904. return SSL_PKEY_RSA_ENC; 1905. else if (alg_a & SSL_aGOST12) ssl/ssl_ciph.c:1904:9: 1902. return SSL_PKEY_DSA_SIGN; 1903. else if (alg_a & SSL_aRSA) 1904. > return SSL_PKEY_RSA_ENC; 1905. else if (alg_a & SSL_aGOST12) 1906. return SSL_PKEY_GOST_EC; ssl/ssl_ciph.c:1911:1: return from a call to ssl_cipher_get_cert_index 1909. 1910. return -1; 1911. > } 1912. 1913. const SSL_CIPHER *ssl_get_cipher_by_char(SSL *ssl, const unsigned char *ptr) ssl/ssl_lib.c:2840:9: Taking true branch 2838. int idx; 2839. idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher); 2840. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509) ^ 2841. idx = SSL_PKEY_RSA_SIGN; 2842. if (idx == SSL_PKEY_GOST_EC) { ssl/ssl_lib.c:2840:37: Taking false branch 2838. int idx; 2839. idx = ssl_cipher_get_cert_index(s->s3->tmp.new_cipher); 2840. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509) ^ 2841. idx = SSL_PKEY_RSA_SIGN; 2842. if (idx == SSL_PKEY_GOST_EC) { ssl/ssl_lib.c:2842:9: Taking false branch 2840. if (idx == SSL_PKEY_RSA_ENC && !s->cert->pkeys[SSL_PKEY_RSA_ENC].x509) 2841. idx = SSL_PKEY_RSA_SIGN; 2842. if (idx == SSL_PKEY_GOST_EC) { ^ 2843. if (s->cert->pkeys[SSL_PKEY_GOST12_512].x509) 2844. idx = SSL_PKEY_GOST12_512; ssl/ssl_lib.c:2852:9: Taking false branch 2850. idx = -1; 2851. } 2852. if (idx == -1) ^ 2853. SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR); 2854. return idx; ssl/ssl_lib.c:2854:5: 2852. if (idx == -1) 2853. SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR); 2854. > return idx; 2855. } 2856. ssl/ssl_lib.c:2855:1: return from a call to ssl_get_server_cert_index 2853. SSLerr(SSL_F_SSL_GET_SERVER_CERT_INDEX, ERR_R_INTERNAL_ERROR); 2854. return idx; 2855. > } 2856. 2857. CERT_PKEY *ssl_get_server_send_pkey(SSL *s) ssl/ssl_lib.c:2870:9: Taking true branch 2868. 2869. /* This may or may not be an error. */ 2870. if (i < 0) ^ 2871. return NULL; 2872. ssl/ssl_lib.c:2871:9: 2869. /* This may or may not be an error. */ 2870. if (i < 0) 2871. > return NULL; 2872. 2873. /* May be NULL. */ ssl/ssl_lib.c:2875:1: return from a call to ssl_get_server_send_pkey 2873. /* May be NULL. */ 2874. return &c->pkeys[i]; 2875. > } 2876. 2877. EVP_PKEY *ssl_get_sign_pkey(SSL *s, const SSL_CIPHER *cipher, ssl/t1_lib.c:4298:9: 4296. } else { 4297. CERT_PKEY *cpk = ssl_get_server_send_pkey(s); 4298. > dh_secbits = EVP_PKEY_security_bits(cpk->privatekey); 4299. } 4300.
https://github.com/openssl/openssl/blob/0d9824c1712b6cacd9b0ecfba26fb66ae4badfb4/ssl/t1_lib.c/#L4298
d2a_code_trace_data_43592
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/dh/dh_check.c:164: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_rshift1`. Showing all 21 steps of the trace crypto/dh/dh_check.c:136:14: Call 134. *ret |= DH_CHECK_Q_NOT_PRIME; 135. /* Check p == 1 mod q i.e. q divides p - 1 */ 136. if (!BN_div(t1, t2, dh->p, dh->q, ctx)) ^ 137. goto err; 138. if (!BN_is_one(t2)) crypto/bn/bn_div.c:137:1: Parameter `dv->top` 135. * If 'dv' or 'rm' is NULL, the respective value is not returned. 136. */ 137. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 138. BN_CTX *ctx) 139. { crypto/dh/dh_check.c:164:14: Call 162. *ret |= DH_CHECK_P_NOT_PRIME; 163. else if (!dh->q) { 164. if (!BN_rshift1(t1, dh->p)) ^ 165. goto err; 166. r = BN_is_prime_ex(t1, BN_prime_checks, ctx, NULL); crypto/bn/bn_shift.c:46:1: Parameter `r->top` 44. } 45. 46. > int BN_rshift1(BIGNUM *r, const BIGNUM *a) 47. { 48. BN_ULONG *ap, *rp, t, c; crypto/bn/bn_shift.c:62:13: Call 60. j = i - (ap[i - 1] == 1); 61. if (a != r) { 62. if (bn_wexpand(r, j) == NULL) ^ 63. return 0; 64. r->neg = a->neg; crypto/bn/bn_lib.c:941:1: Parameter `a->top` 939. } 940. 941. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 942. { 943. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:943:37: Call 941. BIGNUM *bn_wexpand(BIGNUM *a, int words) 942. { 943. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 944. } 945. 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_rshift1` 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/b48d4397b8ee4256f0b0a115eb99f27ae89995e0/crypto/bn/bn_lib.c/#L233
d2a_code_trace_data_43593
int BN_num_bits_word(BN_ULONG l) { BN_ULONG x, mask; int bits = (l != 0); #if BN_BITS2 > 32 x = l >> 32; mask = (0 - x) & BN_MASK2; mask = (0 - (mask >> (BN_BITS2 - 1))); bits += 32 & mask; l ^= (x ^ l) & mask; #endif x = l >> 16; mask = (0 - x) & BN_MASK2; mask = (0 - (mask >> (BN_BITS2 - 1))); bits += 16 & mask; l ^= (x ^ l) & mask; x = l >> 8; mask = (0 - x) & BN_MASK2; mask = (0 - (mask >> (BN_BITS2 - 1))); bits += 8 & mask; l ^= (x ^ l) & mask; x = l >> 4; mask = (0 - x) & BN_MASK2; mask = (0 - (mask >> (BN_BITS2 - 1))); bits += 4 & mask; l ^= (x ^ l) & mask; x = l >> 2; mask = (0 - x) & BN_MASK2; mask = (0 - (mask >> (BN_BITS2 - 1))); bits += 2 & mask; l ^= (x ^ l) & mask; x = l >> 1; mask = (0 - x) & BN_MASK2; mask = (0 - (mask >> (BN_BITS2 - 1))); bits += 1 & mask; return bits; } crypto/ec/ecdsa_ossl.c:490: error: INTEGER_OVERFLOW_L2 (0 - [0, max(1, `eckey->group->order->top`)]):unsigned64 by call to `EC_POINT_mul`. Showing all 24 steps of the trace crypto/ec/ecdsa_ossl.c:400:1: Parameter `eckey->group->order->top` 398. } 399. 400. > int ossl_ecdsa_verify_sig(const unsigned char *dgst, int dgst_len, 401. const ECDSA_SIG *sig, EC_KEY *eckey) 402. { crypto/ec/ecdsa_ossl.c:460:9: Call 458. } 459. /* digest -> m */ 460. i = BN_num_bits(order); ^ 461. /* 462. * Need to truncate digest if it is too long: first truncate whole bytes. crypto/bn/bn_lib.c:139:9: Call 137. bn_check_top(a); 138. 139. if (BN_is_zero(a)) ^ 140. return 0; 141. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); crypto/bn/bn_lib.c:845:1: Parameter `a->top` 843. } 844. 845. > int BN_is_zero(const BIGNUM *a) 846. { 847. return a->top == 0; crypto/ec/ecdsa_ossl.c:476:10: Call 474. } 475. /* u1 = m * tmp mod order */ 476. if (!BN_mod_mul(u1, m, u2, order, ctx)) { ^ 477. ECerr(EC_F_OSSL_ECDSA_VERIFY_SIG, ERR_R_BN_LIB); 478. goto err; crypto/bn/bn_mod.c:73:1: Parameter `m->top` 71. 72. /* slow but works */ 73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 74. BN_CTX *ctx) 75. { crypto/ec/ecdsa_ossl.c:481:10: Call 479. } 480. /* u2 = r * w mod q */ 481. if (!BN_mod_mul(u2, sig->r, u2, order, ctx)) { ^ 482. ECerr(EC_F_OSSL_ECDSA_VERIFY_SIG, ERR_R_BN_LIB); 483. goto err; crypto/bn/bn_mod.c:73:1: Parameter `m->top` 71. 72. /* slow but works */ 73. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 74. BN_CTX *ctx) 75. { crypto/ec/ecdsa_ossl.c:490:10: Call 488. goto err; 489. } 490. if (!EC_POINT_mul(group, point, u1, pub_key, u2, ctx)) { ^ 491. ECerr(EC_F_OSSL_ECDSA_VERIFY_SIG, ERR_R_EC_LIB); 492. goto err; crypto/ec/ec_lib.c:929:1: Parameter `group->order->top` 927. } 928. 929. > int EC_POINT_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *g_scalar, 930. const EC_POINT *point, const BIGNUM *p_scalar, BN_CTX *ctx) 931. { crypto/ec/ec_lib.c:940:12: Call 938. scalars[0] = p_scalar; 939. 940. return EC_POINTs_mul(group, r, g_scalar, ^ 941. (point != NULL 942. && p_scalar != NULL), points, scalars, ctx); crypto/ec/ec_lib.c:918:1: Parameter `group->order->top` 916. */ 917. 918. > int EC_POINTs_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 919. size_t num, const EC_POINT *points[], 920. const BIGNUM *scalars[], BN_CTX *ctx) crypto/ec/ec_lib.c:924:16: Call 922. if (group->meth->mul == 0) 923. /* use default */ 924. return ec_wNAF_mul(group, r, scalar, num, points, scalars, ctx); ^ 925. 926. return group->meth->mul(group, r, scalar, num, points, scalars, ctx); crypto/ec/ec_mult.c:354:1: Parameter `group->order->top` 352. * in the addition if scalar != NULL 353. */ 354. > int ec_wNAF_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, 355. size_t num, const EC_POINT *points[], const BIGNUM *scalars[], 356. BN_CTX *ctx) crypto/ec/ec_mult.c:405:16: Call 403. * constant time version. 404. */ 405. return ec_mul_consttime(group, r, scalar, NULL, ctx); ^ 406. } 407. if ((scalar == NULL) && (num == 1)) { crypto/ec/ec_mult.c:131:1: Parameter `group->order->top` 129. * Returns 1 on success, 0 otherwise. 130. */ 131. > static int ec_mul_consttime(const EC_GROUP *group, EC_POINT *r, 132. const BIGNUM *scalar, const EC_POINT *point, 133. BN_CTX *ctx) crypto/ec/ec_mult.c:165:23: Call 163. lambda = BN_CTX_get(ctx); 164. k = BN_CTX_get(ctx); 165. if (k == NULL || !BN_mul(cardinality, group->order, group->cofactor, ctx)) ^ 166. goto err; 167. crypto/bn/bn_mul.c:497:1: Parameter `a->top` 495. #endif /* BN_RECURSION */ 496. 497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = 0; crypto/bn/bn_mul.c:514:5: Assignment 512. bn_check_top(r); 513. 514. al = a->top; ^ 515. bl = b->top; 516. crypto/bn/bn_mul.c:561:21: Call 559. */ 560. if (i >= 0) { 561. j = BN_num_bits_word((BN_ULONG)al); ^ 562. } 563. if (i == -1) { crypto/bn/bn_lib.c:89:1: <RHS trace> 87. } 88. 89. > int BN_num_bits_word(BN_ULONG l) 90. { 91. BN_ULONG x, mask; crypto/bn/bn_lib.c:89:1: Parameter `l` 87. } 88. 89. > int BN_num_bits_word(BN_ULONG l) 90. { 91. BN_ULONG x, mask; crypto/bn/bn_lib.c:95:5: Assignment 93. 94. #if BN_BITS2 > 32 95. x = l >> 32; ^ 96. mask = (0 - x) & BN_MASK2; 97. mask = (0 - (mask >> (BN_BITS2 - 1))); crypto/bn/bn_lib.c:96:5: Binary operation: (0 - [0, max(1, eckey->group->order->top)]):unsigned64 by call to `EC_POINT_mul` 94. #if BN_BITS2 > 32 95. x = l >> 32; 96. mask = (0 - x) & BN_MASK2; ^ 97. mask = (0 - (mask >> (BN_BITS2 - 1))); 98. bits += 32 & mask;
https://github.com/openssl/openssl/blob/a766aab93a282774e63ba918d0bb1c6680a5f292/crypto/bn/bn_lib.c/#L96
d2a_code_trace_data_43594
void RAND_seed(const void *buf, int num) { const RAND_METHOD *meth = RAND_get_rand_method(); if (meth->seed != NULL) meth->seed(buf, num); } crypto/rand/rand_lib.c:608: error: NULL_DEREFERENCE pointer `meth` last assigned on line 606 could be null and is dereferenced at line 608, column 9. Showing all 14 steps of the trace crypto/rand/rand_lib.c:604:1: start of procedure RAND_seed() 602. #endif 603. 604. > void RAND_seed(const void *buf, int num) 605. { 606. const RAND_METHOD *meth = RAND_get_rand_method(); crypto/rand/rand_lib.c:606:5: 604. void RAND_seed(const void *buf, int num) 605. { 606. > const RAND_METHOD *meth = RAND_get_rand_method(); 607. 608. if (meth->seed != NULL) crypto/rand/rand_lib.c:548:1: start of procedure RAND_get_rand_method() 546. } 547. 548. > const RAND_METHOD *RAND_get_rand_method(void) 549. { 550. const RAND_METHOD *tmp_meth = NULL; crypto/rand/rand_lib.c:550:5: 548. const RAND_METHOD *RAND_get_rand_method(void) 549. { 550. > const RAND_METHOD *tmp_meth = NULL; 551. 552. if (!RUN_ONCE(&rand_init, do_rand_init)) crypto/rand/rand_lib.c:552:10: 550. const RAND_METHOD *tmp_meth = NULL; 551. 552. > if (!RUN_ONCE(&rand_init, do_rand_init)) 553. return NULL; 554. crypto/threads_pthread.c:105:1: start of procedure CRYPTO_THREAD_run_once() 103. } 104. 105. > int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 106. { 107. if (pthread_once(once, init) != 0) crypto/threads_pthread.c:107:9: Taking true branch 105. int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) 106. { 107. if (pthread_once(once, init) != 0) ^ 108. return 0; 109. crypto/threads_pthread.c:108:9: 106. { 107. if (pthread_once(once, init) != 0) 108. > return 0; 109. 110. return 1; crypto/threads_pthread.c:111:1: return from a call to CRYPTO_THREAD_run_once 109. 110. return 1; 111. > } 112. 113. int CRYPTO_THREAD_init_local(CRYPTO_THREAD_LOCAL *key, void (*cleanup)(void *)) crypto/rand/rand_lib.c:552:10: Condition is false 550. const RAND_METHOD *tmp_meth = NULL; 551. 552. if (!RUN_ONCE(&rand_init, do_rand_init)) ^ 553. return NULL; 554. crypto/rand/rand_lib.c:552:10: Taking true branch 550. const RAND_METHOD *tmp_meth = NULL; 551. 552. if (!RUN_ONCE(&rand_init, do_rand_init)) ^ 553. return NULL; 554. crypto/rand/rand_lib.c:553:9: 551. 552. if (!RUN_ONCE(&rand_init, do_rand_init)) 553. > return NULL; 554. 555. CRYPTO_THREAD_write_lock(rand_meth_lock); crypto/rand/rand_lib.c:576:1: return from a call to RAND_get_rand_method 574. CRYPTO_THREAD_unlock(rand_meth_lock); 575. return tmp_meth; 576. > } 577. 578. #ifndef OPENSSL_NO_ENGINE crypto/rand/rand_lib.c:608:9: 606. const RAND_METHOD *meth = RAND_get_rand_method(); 607. 608. > if (meth->seed != NULL) 609. meth->seed(buf, num); 610. }
https://github.com/openssl/openssl/blob/e0b625f9db00509af9004b7907d44b78f332754a/crypto/rand/rand_lib.c/#L608
d2a_code_trace_data_43595
int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->buf->length - pkt->written < len) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } *allocbytes = (unsigned char *)pkt->buf->data + pkt->curr; pkt->written += len; pkt->curr += len; return 1; } ssl/t1_lib.c:1062: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, `s->s3->previous_client_finished_len` + `pkt->written` + 15]):unsigned64 by call to `WPACKET_put_bytes__`. Showing all 10 steps of the trace ssl/t1_lib.c:1061:21: Call 1059. || !WPACKET_start_sub_packet_u16(pkt) 1060. /* Sub-packet for servername list (always 1 hostname)*/ 1061. || !WPACKET_start_sub_packet_u16(pkt) ^ 1062. || !WPACKET_put_bytes_u8(pkt, TLSEXT_NAMETYPE_host_name) 1063. || !WPACKET_sub_memcpy_u16(pkt, s->tlsext_hostname, ssl/packet.c:205:1: Parameter `pkt->buf->length` 203. } 204. 205. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 206. { 207. WPACKET_SUB *sub; ssl/t1_lib.c:1062:21: Call 1060. /* Sub-packet for servername list (always 1 hostname)*/ 1061. || !WPACKET_start_sub_packet_u16(pkt) 1062. || !WPACKET_put_bytes_u8(pkt, TLSEXT_NAMETYPE_host_name) ^ 1063. || !WPACKET_sub_memcpy_u16(pkt, s->tlsext_hostname, 1064. strlen(s->tlsext_hostname)) ssl/packet.c:242:1: Parameter `pkt->written` 240. } 241. 242. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 243. { 244. unsigned char *data; ssl/packet.c:250:17: Call 248. 249. if (size > sizeof(unsigned int) 250. || !WPACKET_allocate_bytes(pkt, size, &data) ^ 251. || !put_value(data, val, size)) 252. return 0; ssl/packet.c:15:1: <LHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `pkt->buf->length` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: <RHS trace> 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:15:1: Parameter `len` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. /* Internal API, so should not fail */ ssl/packet.c:25:9: Binary operation: ([0, +oo] - [0, s->s3->previous_client_finished_len + pkt->written + 15]):unsigned64 by call to `WPACKET_put_bytes__` 23. return 0; 24. 25. if (pkt->buf->length - pkt->written < len) { ^ 26. size_t newlen; 27. size_t reflen;
https://github.com/openssl/openssl/blob/a6972f346248fbc37e42056bb943fae0896a2967/ssl/packet.c/#L25
d2a_code_trace_data_43596
int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x) { int rv; if (x == NULL) { SSLerr(SSL_F_SSL_CTX_USE_CERTIFICATE, ERR_R_PASSED_NULL_PARAMETER); return (0); } rv = ssl_security_cert(NULL, ctx, x, 0, 1); if (rv != 1) { SSLerr(SSL_F_SSL_CTX_USE_CERTIFICATE, rv); return 0; } return (ssl_set_cert(ctx->cert, x)); } ssl/ssl_rsa.c:359: error: NULL_DEREFERENCE pointer `null` is dereferenced by call to `ssl_security_cert()` at line 359, column 10. Showing all 3 steps of the trace ssl/ssl_rsa.c:352:1: start of procedure SSL_CTX_use_certificate() 350. } 351. 352. > int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x) 353. { 354. int rv; ssl/ssl_rsa.c:355:9: Taking false branch 353. { 354. int rv; 355. if (x == NULL) { ^ 356. SSLerr(SSL_F_SSL_CTX_USE_CERTIFICATE, ERR_R_PASSED_NULL_PARAMETER); 357. return (0); ssl/ssl_rsa.c:359:5: 357. return (0); 358. } 359. > rv = ssl_security_cert(NULL, ctx, x, 0, 1); 360. if (rv != 1) { 361. SSLerr(SSL_F_SSL_CTX_USE_CERTIFICATE, rv);
https://github.com/openssl/openssl/blob/bc71f91064a3eec10310fa4cc14fe2a3fd9bc7bb/ssl/ssl_rsa.c/#L359
d2a_code_trace_data_43597
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:359: error: INTEGER_OVERFLOW_L2 ([9, +oo] - [8, 16]):unsigned64 by call to `tls13_enc`. Showing all 8 steps of the trace test/tls13encryptiontest.c:339:14: Call 337. /* Load the record */ 338. ivlen = EVP_CIPHER_iv_length(ciph); 339. if (!load_record(&rec, &refdata[ctr], &key, s->read_iv, ivlen, ^ 340. RECORD_LAYER_get_read_sequence(&s->rlayer))) { 341. TEST_error("Failed loading key into EVP_CIPHER_CTX"); test/tls13encryptiontest.c:233:1: Parameter `rec->length` 231. } 232. 233. > static int load_record(SSL3_RECORD *rec, RECORD_DATA *recd, unsigned char **key, 234. unsigned char *iv, size_t ivlen, unsigned char *seq) 235. { test/tls13encryptiontest.c:359:14: Call 357. 358. /* Encrypt it */ 359. if (!TEST_size_t_eq(tls13_enc(s, &rec, 1, 1), 1)) { ^ 360. TEST_info("Failed to encrypt record %zu", ctr); 361. 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/8ccc237720d59cdf249c2c901d19f1fec739e66e/ssl/record/ssl3_record_tls13.c/#L96
d2a_code_trace_data_43598
static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) { BN_ULONG *a = NULL; if (words > (INT_MAX / (4 * BN_BITS2))) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_BIGNUM_TOO_LONG); return NULL; } if (BN_get_flags(b, BN_FLG_STATIC_DATA)) { BNerr(BN_F_BN_EXPAND_INTERNAL, BN_R_EXPAND_ON_STATIC_BIGNUM_DATA); return NULL; } if (BN_get_flags(b, BN_FLG_SECURE)) a = OPENSSL_secure_zalloc(words * sizeof(*a)); else a = OPENSSL_zalloc(words * sizeof(*a)); if (a == NULL) { BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); return NULL; } assert(b->top <= words); if (b->top > 0) memcpy(a, b->d, sizeof(*a) * b->top); return a; } crypto/ec/ecp_smpl.c:723: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_mod_add_quick`. Showing all 23 steps of the trace crypto/ec/ecp_smpl.c:656:14: Call 654. /* n1, n2 */ 655. if (b->Z_is_one) { 656. if (!BN_copy(n1, a->X)) ^ 657. goto end; 658. if (!BN_copy(n2, a->Y)) crypto/bn/bn_lib.c:281:1: Parameter `a->top` 279. } 280. 281. > BIGNUM *BN_copy(BIGNUM *a, const BIGNUM *b) 282. { 283. bn_check_top(b); crypto/ec/ecp_smpl.c:723:10: Call 721. 722. /* 'n7', 'n8' */ 723. if (!BN_mod_add_quick(n1, n1, n3, p)) ^ 724. goto end; 725. if (!BN_mod_add_quick(n2, n2, n4, p)) crypto/bn/bn_mod.c:93:1: Parameter `r->top` 91. } 92. 93. > int BN_mod_add_quick(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 94. const BIGNUM *m) 95. { crypto/bn/bn_mod.c:96:15: Call 94. const BIGNUM *m) 95. { 96. int ret = bn_mod_add_fixed_top(r, a, b, m); ^ 97. 98. if (ret) crypto/bn/bn_mod.c:48:1: Parameter `r->top` 46. * move depending on whether or not subtraction borrowed. 47. */ 48. > int bn_mod_add_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 49. const BIGNUM *m) 50. { crypto/bn/bn_mod.c:56:9: Call 54. const BN_ULONG *ap, *bp; 55. 56. if (bn_wexpand(r, mtop) == NULL) ^ 57. return 0; 58. crypto/bn/bn_lib.c:948:1: Parameter `a->top` 946. } 947. 948. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_lib.c:950:37: Call 948. BIGNUM *bn_wexpand(BIGNUM *a, int words) 949. { 950. return (words <= a->dmax) ? a : bn_expand2(a, words); ^ 951. } 952. crypto/bn/bn_lib.c:245:1: Parameter `b->top` 243. */ 244. 245. > BIGNUM *bn_expand2(BIGNUM *b, int words) 246. { 247. if (words > b->dmax) { crypto/bn/bn_lib.c:248:23: Call 246. { 247. if (words > b->dmax) { 248. BN_ULONG *a = bn_expand_internal(b, words); ^ 249. if (!a) 250. return NULL; crypto/bn/bn_lib.c:209:1: <Offset trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `b->top` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: <Length trace> 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:209:1: Parameter `words` 207. /* This is used by bn_expand2() */ 208. /* The caller MUST check that words > b->dmax before calling this */ 209. > static BN_ULONG *bn_expand_internal(const BIGNUM *b, int words) 210. { 211. BN_ULONG *a = NULL; crypto/bn/bn_lib.c:224:13: Call 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/mem.c:228:1: Parameter `num` 226. } 227. 228. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:230:17: Call 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:201:9: Assignment 199. 200. if (num == 0) 201. return NULL; ^ 202. 203. FAILTEST(); crypto/mem.c:230:5: Assignment 228. void *CRYPTO_zalloc(size_t num, const char *file, int line) 229. { 230. void *ret = CRYPTO_malloc(num, file, line); ^ 231. 232. FAILTEST(); crypto/mem.c:235:5: Assignment 233. if (ret != NULL) 234. memset(ret, 0, num); 235. return ret; ^ 236. } 237. crypto/bn/bn_lib.c:224:9: Assignment 222. a = OPENSSL_secure_zalloc(words * sizeof(*a)); 223. else 224. a = OPENSSL_zalloc(words * sizeof(*a)); ^ 225. if (a == NULL) { 226. BNerr(BN_F_BN_EXPAND_INTERNAL, ERR_R_MALLOC_FAILURE); crypto/bn/bn_lib.c:232:9: Array access: Offset added: [8, +oo] Size: [0, 67108856] by call to `BN_mod_add_quick` 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/4cc968df403ed9321d0df722aba33323ae575ce0/crypto/bn/bn_lib.c/#L232
d2a_code_trace_data_43599
int OPENSSL_SA_set(OPENSSL_SA *sa, size_t posn, void *val) { int i, level = 1; size_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:89: 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:89:14: Call 87. goto err; 88. for (i = 0; i < OSSL_NELEM(cases); i++) 89. if (!TEST_true(ossl_sa_char_set(sa, cases[i].n, cases[i].v)) ^ 90. || !TEST_size_t_eq(ossl_sa_char_num(sa), cases[i].num)) 91. 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:176:1: Parameter `sa->nelem` 174. } 175. 176. > int OPENSSL_SA_set(OPENSSL_SA *sa, size_t posn, void *val) 177. { 178. int i, level = 1; test/sparse_array_test.c:89:14: Call 87. goto err; 88. for (i = 0; i < OSSL_NELEM(cases); i++) 89. if (!TEST_true(ossl_sa_char_set(sa, cases[i].n, cases[i].v)) ^ 90. || !TEST_size_t_eq(ossl_sa_char_num(sa), cases[i].num)) 91. 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:176:1: <LHS trace> 174. } 175. 176. > int OPENSSL_SA_set(OPENSSL_SA *sa, size_t posn, void *val) 177. { 178. int i, level = 1; crypto/sparse_array.c:176:1: Parameter `sa->nelem` 174. } 175. 176. > int OPENSSL_SA_set(OPENSSL_SA *sa, size_t posn, void *val) 177. { 178. int i, level = 1; crypto/sparse_array.c:208:9: Binary operation: ([0, +oo] - 1):unsigned64 by call to `ossl_sa_char_set` 206. p += posn & SA_BLOCK_MASK; 207. if (val == NULL && *p != NULL) 208. sa->nelem--; ^ 209. else if (val != NULL && *p == NULL) 210. sa->nelem++;
https://github.com/openssl/openssl/blob/a40f0f6475711f01d32c4cdc39e54311b7e9c876/crypto/sparse_array.c/#L208
d2a_code_trace_data_43600
void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) { int i, j, max; const BN_ULONG *ap; BN_ULONG *rp; max = n * 2; ap = a; rp = r; rp[0] = rp[max - 1] = 0; rp++; j = n; if (--j > 0) { ap++; rp[j] = bn_mul_words(rp, ap, j, ap[-1]); rp += 2; } for (i = n - 2; i > 0; i--) { j--; ap++; rp[j] = bn_mul_add_words(rp, ap, j, ap[-1]); rp += 2; } bn_add_words(r, r, r, max); bn_sqr_words(tmp, a, n); bn_add_words(r, r, tmp, max); } crypto/ec/ecdsa_ossl.c:257: error: BUFFER_OVERRUN_L3 Offset: [31, +oo] Size: [0, 8388607] by call to `BN_mod_mul_montgomery`. Showing all 17 steps of the trace crypto/ec/ecdsa_ossl.c:212:10: Call 210. if (8 * dgst_len > i) 211. dgst_len = (i + 7) / 8; 212. if (!BN_bin2bn(dgst, dgst_len, m)) { ^ 213. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB); 214. goto err; crypto/bn/bn_lib.c:372:1: Parameter `ret->top` 370. } 371. 372. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) 373. { 374. unsigned int i, m; crypto/ec/ecdsa_ossl.c:257:17: Call 255. */ 256. if (!bn_to_mont_fixed_top(s, s, group->mont_data, ctx) 257. || !BN_mod_mul_montgomery(s, s, ckinv, group->mont_data, ctx)) { ^ 258. ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_BN_LIB); 259. goto err; 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:29:15: Call 27. BN_MONT_CTX *mont, BN_CTX *ctx) 28. { 29. int ret = bn_mul_mont_fixed_top(r, a, b, mont, ctx); ^ 30. 31. bn_correct_top(r); crypto/bn/bn_mont.c:37:1: Parameter `b->top` 35. } 36. 37. > int bn_mul_mont_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 38. BN_MONT_CTX *mont, BN_CTX *ctx) 39. { crypto/bn/bn_mont.c:67:14: Call 65. bn_check_top(tmp); 66. if (a == b) { 67. if (!BN_sqr(tmp, a, ctx)) ^ 68. goto err; 69. } else { crypto/bn/bn_sqr.c: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:99:1: <Offset trace> 97. 98. /* tmp must have 2*n words */ 99. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 100. { 101. int i, j, max; crypto/bn/bn_sqr.c:99:1: Parameter `n` 97. 98. /* tmp must have 2*n words */ 99. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 100. { 101. int i, j, max; crypto/bn/bn_sqr.c:105:5: Assignment 103. BN_ULONG *rp; 104. 105. max = n * 2; ^ 106. ap = a; 107. rp = r; crypto/bn/bn_sqr.c:99:1: <Length trace> 97. 98. /* tmp must have 2*n words */ 99. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 100. { 101. int i, j, max; crypto/bn/bn_sqr.c:99:1: Parameter `*r` 97. 98. /* tmp must have 2*n words */ 99. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp) 100. { 101. int i, j, max; crypto/bn/bn_sqr.c:107:5: Assignment 105. max = n * 2; 106. ap = a; 107. rp = r; ^ 108. rp[0] = rp[max - 1] = 0; 109. rp++; crypto/bn/bn_sqr.c:108:13: Array access: Offset: [31, +oo] Size: [0, 8388607] by call to `BN_mod_mul_montgomery` 106. ap = a; 107. rp = r; 108. rp[0] = rp[max - 1] = 0; ^ 109. rp++; 110. j = n;
https://github.com/openssl/openssl/blob/4cc968df403ed9321d0df722aba33323ae575ce0/crypto/bn/bn_sqr.c/#L108
d2a_code_trace_data_43601
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:525: error: Integer Overflow L2 ([1, +oo] - 2):unsigned32 by call to `bitstream_read`. libavcodec/takdec.c:525:25: Call 523. avctx->bits_per_coded_sample - 524. s->sample_shift[chan]); 525. s->lpc_mode[chan] = bitstream_read(bc, 2); ^ 526. nb_subframes = bitstream_read(bc, 3) + 1; 527. 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] - 2):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_43602
static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, OPENSSL_LH_DOALL_FUNC func, OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) { int i; OPENSSL_LH_NODE *a, *n; if (lh == NULL) return; for (i = lh->num_nodes - 1; i >= 0; i--) { a = lh->b[i]; while (a != NULL) { n = a->next; if (use_arg) func_arg(a->data, arg); else func(a->data); a = n; } } } test/tls13encryptiontest.c:375: error: INTEGER_OVERFLOW_L2 ([0, 8] - 1):unsigned32 by call to `SSL_free`. Showing all 18 steps of the trace test/tls13encryptiontest.c:296:11: Call 294. rec.data = NULL; 295. 296. ctx = SSL_CTX_new(TLS_method()); ^ 297. if (ctx == NULL) { 298. fprintf(stderr, "Failed creating SSL_CTX\n"); ssl/ssl_lib.c:2470:21: Call 2468. goto err; 2469. 2470. ret->sessions = lh_SSL_SESSION_new(ssl_session_hash, ssl_session_cmp); ^ 2471. if (ret->sessions == NULL) 2472. goto err; ssl/ssl_locl.h: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:37:5: Assignment 35. ret->comp = ((c == NULL) ? (OPENSSL_LH_COMPFUNC)strcmp : c); 36. ret->hash = ((h == NULL) ? (OPENSSL_LH_HASHFUNC)OPENSSL_LH_strhash : h); 37. ret->num_nodes = MIN_NODES / 2; ^ 38. ret->num_alloc_nodes = MIN_NODES; 39. ret->pmax = MIN_NODES / 2; test/tls13encryptiontest.c:375:5: Call 373. OPENSSL_free(iv); 374. OPENSSL_free(seq); 375. SSL_free(s); ^ 376. SSL_CTX_free(ctx); 377. return ret; ssl/ssl_lib.c:961:1: Parameter `s->ctx->sessions->num_nodes` 959. } 960. 961. > void SSL_free(SSL *s) 962. { 963. int i; ssl/ssl_lib.c:1026:5: Call 1024. RECORD_LAYER_release(&s->rlayer); 1025. 1026. SSL_CTX_free(s->ctx); ^ 1027. 1028. ASYNC_WAIT_CTX_free(s->waitctx); ssl/ssl_lib.c:2581:1: Parameter `a->sessions->num_nodes` 2579. } 2580. 2581. > void SSL_CTX_free(SSL_CTX *a) 2582. { 2583. int i; ssl/ssl_lib.c:2607:9: Call 2605. */ 2606. if (a->sessions != NULL) 2607. SSL_CTX_flush_sessions(a, 0); ^ 2608. 2609. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:1008:1: Parameter `s->sessions->num_nodes` 1006. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1007. 1008. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 1009. { 1010. unsigned long i; ssl/ssl_sess.c:1021:5: Call 1019. i = lh_SSL_SESSION_get_down_load(s->sessions); 1020. lh_SSL_SESSION_set_down_load(s->sessions, 0); 1021. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp); ^ 1022. lh_SSL_SESSION_set_down_load(s->sessions, i); 1023. CRYPTO_THREAD_unlock(s->lock); ssl/ssl_sess.c:1006:1: Parameter `lh->num_nodes` 1004. } 1005. 1006. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1007. 1008. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) ssl/ssl_sess.c:1006:1: Call 1004. } 1005. 1006. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 1007. 1008. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) crypto/lhash/lhash.c:182:1: Parameter `lh->num_nodes` 180. } 181. 182. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); crypto/lhash/lhash.c:184:5: Call 182. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); ^ 185. } 186. crypto/lhash/lhash.c:150:1: <LHS trace> 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:150:1: Parameter `lh->num_nodes` 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:164:10: Binary operation: ([0, 8] - 1):unsigned32 by call to `SSL_free` 162. * memory leaks otherwise 163. */ 164. for (i = lh->num_nodes - 1; i >= 0; i--) { ^ 165. a = lh->b[i]; 166. while (a != NULL) {
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/lhash/lhash.c/#L164
d2a_code_trace_data_43603
static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type) { OutputStream *ost; AVStream *st = avformat_new_stream(oc, NULL); int idx = oc->nb_streams - 1, ret = 0; char *bsf = NULL, *next, *codec_tag = NULL; AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; double qscale = -1; char *buf = NULL, *arg = NULL, *preset = NULL; AVIOContext *s = NULL; if (!st) { av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n"); exit_program(1); } if (oc->nb_streams - 1 < o->nb_streamid_map) st->id = o->streamid_map[oc->nb_streams - 1]; output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams, nb_output_streams + 1); ost = &output_streams[nb_output_streams - 1]; ost->file_index = nb_output_files; ost->index = idx; ost->st = st; st->codec->codec_type = type; choose_encoder(o, oc, ost); if (ost->enc) { ost->opts = filter_codec_opts(codec_opts, ost->enc->id, oc, st); } avcodec_get_context_defaults3(st->codec, ost->enc); st->codec->codec_type = type; MATCH_PER_STREAM_OPT(presets, str, preset, oc, st); if (preset && (!(ret = get_preset_file_2(preset, ost->enc->name, &s)))) { do { buf = get_line(s); if (!buf[0] || buf[0] == '#') { av_free(buf); continue; } if (!(arg = strchr(buf, '='))) { av_log(NULL, AV_LOG_FATAL, "Invalid line found in the preset file.\n"); exit_program(1); } *arg++ = 0; av_dict_set(&ost->opts, buf, arg, AV_DICT_DONT_OVERWRITE); av_free(buf); } while (!s->eof_reached); avio_close(s); } if (ret) { av_log(NULL, AV_LOG_FATAL, "Preset %s specified for stream %d:%d, but could not be opened.\n", preset, ost->file_index, ost->index); exit_program(1); } ost->max_frames = INT64_MAX; MATCH_PER_STREAM_OPT(max_frames, i64, ost->max_frames, oc, st); MATCH_PER_STREAM_OPT(bitstream_filters, str, bsf, oc, st); while (bsf) { if (next = strchr(bsf, ',')) *next++ = 0; if (!(bsfc = av_bitstream_filter_init(bsf))) { av_log(NULL, AV_LOG_FATAL, "Unknown bitstream filter %s\n", bsf); exit_program(1); } if (bsfc_prev) bsfc_prev->next = bsfc; else ost->bitstream_filters = bsfc; bsfc_prev = bsfc; bsf = next; } MATCH_PER_STREAM_OPT(codec_tags, str, codec_tag, oc, st); if (codec_tag) { uint32_t tag = strtol(codec_tag, &next, 0); if (*next) tag = AV_RL32(codec_tag); st->codec->codec_tag = tag; } MATCH_PER_STREAM_OPT(qscale, dbl, qscale, oc, st); if (qscale >= 0 || same_quant) { st->codec->flags |= CODEC_FLAG_QSCALE; st->codec->global_quality = FF_QP2LAMBDA * qscale; } if (oc->oformat->flags & AVFMT_GLOBALHEADER) st->codec->flags |= CODEC_FLAG_GLOBAL_HEADER; av_opt_get_int(sws_opts, "sws_flags", 0, &ost->sws_flags); return ost; } avconv.c:3238: error: Null Dereference pointer `st` last assigned on line 3224 could be null and is dereferenced at line 3238, column 9. avconv.c:3221:1: start of procedure new_output_stream() 3219. } 3220. 3221. static OutputStream *new_output_stream(OptionsContext *o, AVFormatContext *oc, enum AVMediaType type) ^ 3222. { 3223. OutputStream *ost; avconv.c:3224:5: 3222. { 3223. OutputStream *ost; 3224. AVStream *st = avformat_new_stream(oc, NULL); ^ 3225. int idx = oc->nb_streams - 1, ret = 0; 3226. char *bsf = NULL, *next, *codec_tag = NULL; libavformat/utils.c:2724:1: start of procedure avformat_new_stream() 2722. #endif 2723. 2724. AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c) ^ 2725. { 2726. AVStream *st; libavformat/utils.c:2730:9: Taking true branch 2728. AVStream **streams; 2729. 2730. if (s->nb_streams >= INT_MAX/sizeof(*streams)) ^ 2731. return NULL; 2732. streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams)); libavformat/utils.c:2731:9: 2729. 2730. if (s->nb_streams >= INT_MAX/sizeof(*streams)) 2731. return NULL; ^ 2732. streams = av_realloc(s->streams, (s->nb_streams + 1) * sizeof(*streams)); 2733. if (!streams) libavformat/utils.c:2772:1: return from a call to avformat_new_stream 2770. s->streams[s->nb_streams++] = st; 2771. return st; 2772. } ^ 2773. 2774. AVProgram *av_new_program(AVFormatContext *ac, int id) avconv.c:3225:5: 3223. OutputStream *ost; 3224. AVStream *st = avformat_new_stream(oc, NULL); 3225. int idx = oc->nb_streams - 1, ret = 0; ^ 3226. char *bsf = NULL, *next, *codec_tag = NULL; 3227. AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; avconv.c:3226:5: 3224. AVStream *st = avformat_new_stream(oc, NULL); 3225. int idx = oc->nb_streams - 1, ret = 0; 3226. char *bsf = NULL, *next, *codec_tag = NULL; ^ 3227. AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; 3228. double qscale = -1; avconv.c:3227:5: 3225. int idx = oc->nb_streams - 1, ret = 0; 3226. char *bsf = NULL, *next, *codec_tag = NULL; 3227. AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; ^ 3228. double qscale = -1; 3229. char *buf = NULL, *arg = NULL, *preset = NULL; avconv.c:3228:5: 3226. char *bsf = NULL, *next, *codec_tag = NULL; 3227. AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; 3228. double qscale = -1; ^ 3229. char *buf = NULL, *arg = NULL, *preset = NULL; 3230. AVIOContext *s = NULL; avconv.c:3229:5: 3227. AVBitStreamFilterContext *bsfc, *bsfc_prev = NULL; 3228. double qscale = -1; 3229. char *buf = NULL, *arg = NULL, *preset = NULL; ^ 3230. AVIOContext *s = NULL; 3231. avconv.c:3230:5: 3228. double qscale = -1; 3229. char *buf = NULL, *arg = NULL, *preset = NULL; 3230. AVIOContext *s = NULL; ^ 3231. 3232. if (!st) { avconv.c:3232:10: Taking true branch 3230. AVIOContext *s = NULL; 3231. 3232. if (!st) { ^ 3233. av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n"); 3234. exit_program(1); avconv.c:3233:9: Skipping av_log(): empty list of specs 3231. 3232. if (!st) { 3233. av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n"); ^ 3234. exit_program(1); 3235. } avconv.c:3234:9: Skipping exit_program(): empty list of specs 3232. if (!st) { 3233. av_log(NULL, AV_LOG_FATAL, "Could not alloc stream.\n"); 3234. exit_program(1); ^ 3235. } 3236. avconv.c:3237:9: Taking true branch 3235. } 3236. 3237. if (oc->nb_streams - 1 < o->nb_streamid_map) ^ 3238. st->id = o->streamid_map[oc->nb_streams - 1]; 3239. avconv.c:3238:9: 3236. 3237. if (oc->nb_streams - 1 < o->nb_streamid_map) 3238. st->id = o->streamid_map[oc->nb_streams - 1]; ^ 3239. 3240. output_streams = grow_array(output_streams, sizeof(*output_streams), &nb_output_streams,
https://github.com/libav/libav/blob/4bf3c8f226252e18de8051fd0d417c1d39857b67/avconv.c/#L3238
d2a_code_trace_data_43604
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:576: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 536, column 9 is not reachable after line 576, column 5. Showing all 60 steps of the trace test/bntest.c:530:1: start of procedure test_div_word() 528. } 529. 530. > int test_div_word(BIO *bp) 531. { 532. BIGNUM *a, *b; test/bntest.c:536:5: 534. int i; 535. 536. > a = BN_new(); 537. b = BN_new(); 538. 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:537:5: 535. 536. a = BN_new(); 537. > b = BN_new(); 538. 539. 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:539:10: 537. b = BN_new(); 538. 539. > for (i = 0; i < num0; i++) { 540. do { 541. BN_bntest_rand(a, 512, -1, 0); test/bntest.c:539:17: Loop condition is false. Leaving loop 537. b = BN_new(); 538. 539. for (i = 0; i < num0; i++) { ^ 540. do { 541. BN_bntest_rand(a, 512, -1, 0); test/bntest.c:576:5: 574. } 575. } 576. > BN_free(a); 577. BN_free(b); 578. 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)
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/test/bntest.c/#L576
d2a_code_trace_data_43605
static int opt_streamid(OptionsContext *o, const char *opt, const char *arg) { int idx; char *p; char idx_str[16]; av_strlcpy(idx_str, arg, sizeof(idx_str)); p = strchr(idx_str, ':'); if (!p) { av_log(NULL, AV_LOG_FATAL, "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", arg, opt); exit_program(1); } *p++ = '\0'; idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX); o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1); o->streamid_map[idx] = parse_number_or_die(opt, p, OPT_INT, 0, INT_MAX); return 0; } avconv.c:3466: error: Null Dereference pointer `p` last assigned on line 3466 could be null and is dereferenced at line 3466, column 5. avconv.c:3452:1: start of procedure opt_streamid() 3450. 3451. /* arg format is "output-stream-index:streamid-value". */ 3452. static int opt_streamid(OptionsContext *o, const char *opt, const char *arg) ^ 3453. { 3454. int idx; avconv.c:3458:5: 3456. char idx_str[16]; 3457. 3458. av_strlcpy(idx_str, arg, sizeof(idx_str)); ^ 3459. p = strchr(idx_str, ':'); 3460. if (!p) { libavutil/avstring.c:64:1: start of procedure av_strlcpy() 62. } 63. 64. size_t av_strlcpy(char *dst, const char *src, size_t size) ^ 65. { 66. size_t len = 0; libavutil/avstring.c:66:5: 64. size_t av_strlcpy(char *dst, const char *src, size_t size) 65. { 66. size_t len = 0; ^ 67. while (++len < size && *src) 68. *dst++ = *src++; libavutil/avstring.c:67:12: Loop condition is true. Entering loop body 65. { 66. size_t len = 0; 67. while (++len < size && *src) ^ 68. *dst++ = *src++; 69. if (len <= size) libavutil/avstring.c:67:28: Loop condition is false. Leaving loop 65. { 66. size_t len = 0; 67. while (++len < size && *src) ^ 68. *dst++ = *src++; 69. if (len <= size) libavutil/avstring.c:69:9: Taking true branch 67. while (++len < size && *src) 68. *dst++ = *src++; 69. if (len <= size) ^ 70. *dst = 0; 71. return len + strlen(src) - 1; libavutil/avstring.c:70:9: 68. *dst++ = *src++; 69. if (len <= size) 70. *dst = 0; ^ 71. return len + strlen(src) - 1; 72. } libavutil/avstring.c:71:5: 69. if (len <= size) 70. *dst = 0; 71. return len + strlen(src) - 1; ^ 72. } 73. libavutil/avstring.c:72:1: return from a call to av_strlcpy 70. *dst = 0; 71. return len + strlen(src) - 1; 72. } ^ 73. 74. size_t av_strlcat(char *dst, const char *src, size_t size) avconv.c:3459:5: 3457. 3458. av_strlcpy(idx_str, arg, sizeof(idx_str)); 3459. p = strchr(idx_str, ':'); ^ 3460. if (!p) { 3461. av_log(NULL, AV_LOG_FATAL, avconv.c:3460:10: Taking true branch 3458. av_strlcpy(idx_str, arg, sizeof(idx_str)); 3459. p = strchr(idx_str, ':'); 3460. if (!p) { ^ 3461. av_log(NULL, AV_LOG_FATAL, 3462. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", avconv.c:3461:9: Skipping av_log(): empty list of specs 3459. p = strchr(idx_str, ':'); 3460. if (!p) { 3461. av_log(NULL, AV_LOG_FATAL, ^ 3462. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", 3463. arg, opt); avconv.c:3464:9: Skipping exit_program(): empty list of specs 3462. "Invalid value '%s' for option '%s', required syntax is 'index:value'\n", 3463. arg, opt); 3464. exit_program(1); ^ 3465. } 3466. *p++ = '\0'; avconv.c:3466:5: 3464. exit_program(1); 3465. } 3466. *p++ = '\0'; ^ 3467. idx = parse_number_or_die(opt, idx_str, OPT_INT, 0, INT_MAX); 3468. o->streamid_map = grow_array(o->streamid_map, sizeof(*o->streamid_map), &o->nb_streamid_map, idx+1);
https://github.com/libav/libav/blob/e1edfbcb240cace69d92701e6910c2b03555b7d7/avconv.c/#L3466
d2a_code_trace_data_43606
static void opt_output_file(const char *filename) { AVFormatContext *oc; int err, use_video, use_audio, use_subtitle; int input_has_video, input_has_audio, input_has_subtitle; AVFormatParameters params, *ap = &params; AVOutputFormat *file_oformat; AVMetadataTag *tag = NULL; if (!strcmp(filename, "-")) filename = "pipe:"; oc = avformat_alloc_context(); if (!oc) { print_error(filename, AVERROR(ENOMEM)); ffmpeg_exit(1); } if (last_asked_format) { file_oformat = av_guess_format(last_asked_format, NULL, NULL); if (!file_oformat) { fprintf(stderr, "Requested output format '%s' is not a suitable output format\n", last_asked_format); ffmpeg_exit(1); } last_asked_format = NULL; } else { file_oformat = av_guess_format(NULL, filename, NULL); if (!file_oformat) { fprintf(stderr, "Unable to find a suitable output format for '%s'\n", filename); ffmpeg_exit(1); } } oc->oformat = file_oformat; av_strlcpy(oc->filename, filename, sizeof(oc->filename)); if (!strcmp(file_oformat->name, "ffm") && av_strstart(filename, "http:", NULL)) { int err = read_ffserver_streams(oc, filename); if (err < 0) { print_error(filename, err); ffmpeg_exit(1); } } else { use_video = file_oformat->video_codec != CODEC_ID_NONE || video_stream_copy || video_codec_name; use_audio = file_oformat->audio_codec != CODEC_ID_NONE || audio_stream_copy || audio_codec_name; use_subtitle = file_oformat->subtitle_codec != CODEC_ID_NONE || subtitle_stream_copy || subtitle_codec_name; if (nb_input_files > 0) { check_audio_video_sub_inputs(&input_has_video, &input_has_audio, &input_has_subtitle); if (!input_has_video) use_video = 0; if (!input_has_audio) use_audio = 0; if (!input_has_subtitle) use_subtitle = 0; } if (audio_disable) use_audio = 0; if (video_disable) use_video = 0; if (subtitle_disable) use_subtitle = 0; if (use_video) new_video_stream(oc, nb_output_files); if (use_audio) new_audio_stream(oc, nb_output_files); if (use_subtitle) new_subtitle_stream(oc, nb_output_files); oc->timestamp = recording_timestamp; while ((tag = av_metadata_get(metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) av_metadata_set2(&oc->metadata, tag->key, tag->value, 0); av_metadata_free(&metadata); } output_files[nb_output_files++] = oc; if (oc->oformat->flags & AVFMT_NEEDNUMBER) { if (!av_filename_number_test(oc->filename)) { print_error(oc->filename, AVERROR_NUMEXPECTED); ffmpeg_exit(1); } } if (!(oc->oformat->flags & AVFMT_NOFILE)) { if (!file_overwrite && (strchr(filename, ':') == NULL || filename[1] == ':' || av_strstart(filename, "file:", NULL))) { if (url_exist(filename)) { if (!using_stdin) { fprintf(stderr,"File '%s' already exists. Overwrite ? [y/N] ", filename); fflush(stderr); if (!read_yesno()) { fprintf(stderr, "Not overwriting - exiting\n"); ffmpeg_exit(1); } } else { fprintf(stderr,"File '%s' already exists. Exiting.\n", filename); ffmpeg_exit(1); } } } if ((err = url_fopen(&oc->pb, filename, URL_WRONLY)) < 0) { print_error(filename, err); ffmpeg_exit(1); } } memset(ap, 0, sizeof(*ap)); if (av_set_parameters(oc, ap) < 0) { fprintf(stderr, "%s: Invalid encoding parameters\n", oc->filename); ffmpeg_exit(1); } oc->preload= (int)(mux_preload*AV_TIME_BASE); oc->max_delay= (int)(mux_max_delay*AV_TIME_BASE); oc->loop_output = loop_output; oc->flags |= AVFMT_FLAG_NONBLOCK; set_context_opts(oc, avformat_opts, AV_OPT_FLAG_ENCODING_PARAM, NULL); nb_streamid_map = 0; av_freep(&forced_key_frames); } ffmpeg.c:3723: error: Null Dereference pointer `file_oformat` last assigned on line 3712 could be null and is dereferenced at line 3723, column 17. ffmpeg.c:3686:1: start of procedure opt_output_file() 3684. } 3685. 3686. static void opt_output_file(const char *filename) ^ 3687. { 3688. AVFormatContext *oc; ffmpeg.c:3691:5: 3689. int err, use_video, use_audio, use_subtitle; 3690. int input_has_video, input_has_audio, input_has_subtitle; 3691. AVFormatParameters params, *ap = &params; ^ 3692. AVOutputFormat *file_oformat; 3693. AVMetadataTag *tag = NULL; ffmpeg.c:3693:5: 3691. AVFormatParameters params, *ap = &params; 3692. AVOutputFormat *file_oformat; 3693. AVMetadataTag *tag = NULL; ^ 3694. 3695. if (!strcmp(filename, "-")) ffmpeg.c:3695:10: Taking false branch 3693. AVMetadataTag *tag = NULL; 3694. 3695. if (!strcmp(filename, "-")) ^ 3696. filename = "pipe:"; 3697. ffmpeg.c:3698:5: 3696. filename = "pipe:"; 3697. 3698. oc = avformat_alloc_context(); ^ 3699. if (!oc) { 3700. print_error(filename, AVERROR(ENOMEM)); libavformat/options.c:82:1: start of procedure avformat_alloc_context() 80. } 81. 82. AVFormatContext *avformat_alloc_context(void) ^ 83. { 84. AVFormatContext *ic; libavformat/options.c:85:5: 83. { 84. AVFormatContext *ic; 85. ic = av_malloc(sizeof(AVFormatContext)); ^ 86. if (!ic) return ic; 87. avformat_get_context_defaults(ic); libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(FF_INTERNAL_MEM_TYPE size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(FF_INTERNAL_MEM_TYPE size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-16) ) ^ 73. return NULL; 74. libavutil/mem.c:83:9: Taking false branch 81. ((char*)ptr)[-1]= diff; 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,16,size)) ^ 84. ptr = NULL; 85. #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, FF_INTERNAL_MEM_TYPE size) libavformat/options.c:86:10: Taking false branch 84. AVFormatContext *ic; 85. ic = av_malloc(sizeof(AVFormatContext)); 86. if (!ic) return ic; ^ 87. avformat_get_context_defaults(ic); 88. ic->av_class = &av_format_context_class; libavformat/options.c:87:5: Skipping avformat_get_context_defaults(): empty list of specs 85. ic = av_malloc(sizeof(AVFormatContext)); 86. if (!ic) return ic; 87. avformat_get_context_defaults(ic); ^ 88. ic->av_class = &av_format_context_class; 89. return ic; libavformat/options.c:88:5: 86. if (!ic) return ic; 87. avformat_get_context_defaults(ic); 88. ic->av_class = &av_format_context_class; ^ 89. return ic; 90. } libavformat/options.c:89:5: 87. avformat_get_context_defaults(ic); 88. ic->av_class = &av_format_context_class; 89. return ic; ^ 90. } 91. libavformat/options.c:90:1: return from a call to avformat_alloc_context 88. ic->av_class = &av_format_context_class; 89. return ic; 90. } ^ 91. 92. #if FF_API_ALLOC_FORMAT_CONTEXT ffmpeg.c:3699:10: Taking false branch 3697. 3698. oc = avformat_alloc_context(); 3699. if (!oc) { ^ 3700. print_error(filename, AVERROR(ENOMEM)); 3701. ffmpeg_exit(1); ffmpeg.c:3704:9: Taking false branch 3702. } 3703. 3704. if (last_asked_format) { ^ 3705. file_oformat = av_guess_format(last_asked_format, NULL, NULL); 3706. if (!file_oformat) { ffmpeg.c:3712:9: Skipping av_guess_format(): empty list of specs 3710. last_asked_format = NULL; 3711. } else { 3712. file_oformat = av_guess_format(NULL, filename, NULL); ^ 3713. if (!file_oformat) { 3714. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", ffmpeg.c:3713:14: Taking true branch 3711. } else { 3712. file_oformat = av_guess_format(NULL, filename, NULL); 3713. if (!file_oformat) { ^ 3714. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", 3715. filename); ffmpeg.c:3714:13: 3712. file_oformat = av_guess_format(NULL, filename, NULL); 3713. if (!file_oformat) { 3714. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", ^ 3715. filename); 3716. ffmpeg_exit(1); ffmpeg.c:3716:13: Skipping ffmpeg_exit(): empty list of specs 3714. fprintf(stderr, "Unable to find a suitable output format for '%s'\n", 3715. filename); 3716. ffmpeg_exit(1); ^ 3717. } 3718. } ffmpeg.c:3720:5: 3718. } 3719. 3720. oc->oformat = file_oformat; ^ 3721. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); 3722. ffmpeg.c:3721:5: 3719. 3720. oc->oformat = file_oformat; 3721. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); ^ 3722. 3723. if (!strcmp(file_oformat->name, "ffm") && libavutil/avstring.c:64:1: start of procedure av_strlcpy() 62. } 63. 64. size_t av_strlcpy(char *dst, const char *src, size_t size) ^ 65. { 66. size_t len = 0; libavutil/avstring.c:66:5: 64. size_t av_strlcpy(char *dst, const char *src, size_t size) 65. { 66. size_t len = 0; ^ 67. while (++len < size && *src) 68. *dst++ = *src++; libavutil/avstring.c:67:12: Loop condition is true. Entering loop body 65. { 66. size_t len = 0; 67. while (++len < size && *src) ^ 68. *dst++ = *src++; 69. if (len <= size) libavutil/avstring.c:67:28: Loop condition is false. Leaving loop 65. { 66. size_t len = 0; 67. while (++len < size && *src) ^ 68. *dst++ = *src++; 69. if (len <= size) libavutil/avstring.c:69:9: Taking true branch 67. while (++len < size && *src) 68. *dst++ = *src++; 69. if (len <= size) ^ 70. *dst = 0; 71. return len + strlen(src) - 1; libavutil/avstring.c:70:9: 68. *dst++ = *src++; 69. if (len <= size) 70. *dst = 0; ^ 71. return len + strlen(src) - 1; 72. } libavutil/avstring.c:71:5: 69. if (len <= size) 70. *dst = 0; 71. return len + strlen(src) - 1; ^ 72. } 73. libavutil/avstring.c:72:1: return from a call to av_strlcpy 70. *dst = 0; 71. return len + strlen(src) - 1; 72. } ^ 73. 74. size_t av_strlcat(char *dst, const char *src, size_t size) ffmpeg.c:3723:10: 3721. av_strlcpy(oc->filename, filename, sizeof(oc->filename)); 3722. 3723. if (!strcmp(file_oformat->name, "ffm") && ^ 3724. av_strstart(filename, "http:", NULL)) { 3725. /* special case for files sent to ffserver: we get the stream
https://github.com/libav/libav/blob/2d777bb7a20041ac0564ffef85bf40619af8ccd1/ffmpeg.c/#L3723
d2a_code_trace_data_43607
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_gf2m.c:878: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_mul_arr`. Showing all 26 steps of the trace crypto/bn/bn_gf2m.c:851:1: Parameter `ctx->stack.depth` 849. * P1363. 850. */ 851. > int BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 852. const int p[], BN_CTX *ctx) 853. { crypto/bn/bn_gf2m.c:866:5: Call 864. return (BN_copy(r, a) != NULL); 865. 866. BN_CTX_start(ctx); ^ 867. if ((u = BN_CTX_get(ctx)) == NULL) 868. goto err; crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_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:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gf2m.c:875:14: Call 873. n = BN_num_bits(b) - 1; 874. for (i = n - 1; i >= 0; i--) { 875. if (!BN_GF2m_mod_sqr_arr(u, u, p, ctx)) ^ 876. goto err; 877. if (BN_is_bit_set(b, i)) { crypto/bn/bn_gf2m.c:489:1: Parameter `ctx->stack.depth` 487. 488. /* Square a, reduce the result mod p, and store it in a. r could be a. */ 489. > int BN_GF2m_mod_sqr_arr(BIGNUM *r, const BIGNUM *a, const int p[], 490. BN_CTX *ctx) 491. { crypto/bn/bn_gf2m.c:496:5: Call 494. 495. bn_check_top(a); 496. BN_CTX_start(ctx); ^ 497. if ((s = BN_CTX_get(ctx)) == NULL) 498. goto err; crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gf2m.c:497:14: Call 495. bn_check_top(a); 496. BN_CTX_start(ctx); 497. if ((s = BN_CTX_get(ctx)) == NULL) ^ 498. goto err; 499. if (!bn_wexpand(s, 2 * a->top)) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gf2m.c:514:5: Call 512. ret = 1; 513. err: 514. BN_CTX_end(ctx); ^ 515. return ret; 516. } crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_gf2m.c:878:18: Call 876. goto err; 877. if (BN_is_bit_set(b, i)) { 878. if (!BN_GF2m_mod_mul_arr(u, u, a, p, ctx)) ^ 879. goto err; 880. } crypto/bn/bn_gf2m.c:410:1: Parameter `ctx->stack.depth` 408. * the result in r. r could be a or b; a could be b. 409. */ 410. > int BN_GF2m_mod_mul_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 411. const int p[], BN_CTX *ctx) 412. { crypto/bn/bn_gf2m.c:421:16: Call 419. 420. if (a == b) { 421. return BN_GF2m_mod_sqr_arr(r, a, p, ctx); ^ 422. } 423. crypto/bn/bn_gf2m.c:496:5: Call 494. 495. bn_check_top(a); 496. BN_CTX_start(ctx); ^ 497. if ((s = BN_CTX_get(ctx)) == NULL) 498. goto err; crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gf2m.c:514:5: Call 512. ret = 1; 513. err: 514. BN_CTX_end(ctx); ^ 515. return ret; 516. } crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_mul_arr` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_43608
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:258: 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:257:5: Call 255. 256. curve448_scalar_t scalar1x; 257. curve448_scalar_add(scalar1x, scalar, precomputed_scalarmul_adjustment); ^ 258. curve448_scalar_halve(scalar1x, scalar1x); 259. crypto/ec/curve448/scalar.c:123:1: Parameter `b->limb[*]` 121. } 122. 123. > void curve448_scalar_add(curve448_scalar_t out, const curve448_scalar_t a, 124. const curve448_scalar_t b) 125. { crypto/ec/curve448/curve448.c:258:5: Call 256. curve448_scalar_t scalar1x; 257. curve448_scalar_add(scalar1x, scalar, precomputed_scalarmul_adjustment); 258. curve448_scalar_halve(scalar1x, scalar1x); ^ 259. 260. for (i = s - 1; i >= 0; i--) { 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_43609
static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose) { size_t packlen = pkt->written - sub->pwritten; if (packlen == 0 && (sub->flags & WPACKET_FLAGS_NON_ZERO_LENGTH) != 0) return 0; if (packlen == 0 && sub->flags & WPACKET_FLAGS_ABANDON_ON_ZERO_LENGTH) { if (!doclose) return 0; if ((pkt->curr - sub->lenbytes) == sub->packet_len) { pkt->written -= sub->lenbytes; pkt->curr -= sub->lenbytes; } sub->packet_len = 0; sub->lenbytes = 0; } if (sub->lenbytes > 0 && !put_value(&GETBUF(pkt)[sub->packet_len], packlen, sub->lenbytes)) return 0; if (doclose) { pkt->subs = sub->parent; OPENSSL_free(sub); } return 1; } test/wpackettest.c:348: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `WPACKET_finish`. Showing all 12 steps of the trace test/wpackettest.c:346:10: Call 344. const unsigned char bytes[] = { 0xfe, 0xff }; 345. 346. if (!TEST_true(WPACKET_init_len(&pkt, buf, 1)) ^ 347. || !TEST_true(WPACKET_memcpy(&pkt, bytes, sizeof(bytes))) 348. || !TEST_true(WPACKET_finish(&pkt)) ssl/packet.c:134:1: Parameter `pkt->written` 132. } 133. 134. > int WPACKET_init_len(WPACKET *pkt, BUF_MEM *buf, size_t lenbytes) 135. { 136. /* Internal API, so should not fail */ test/wpackettest.c:347:17: Call 345. 346. if (!TEST_true(WPACKET_init_len(&pkt, buf, 1)) 347. || !TEST_true(WPACKET_memcpy(&pkt, bytes, sizeof(bytes))) ^ 348. || !TEST_true(WPACKET_finish(&pkt)) 349. || !TEST_true(WPACKET_get_total_written(&pkt, &written)) ssl/packet.c:353:1: Parameter `pkt->written` 351. } 352. 353. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) 354. { 355. unsigned char *dest; test/wpackettest.c:348:17: Call 346. if (!TEST_true(WPACKET_init_len(&pkt, buf, 1)) 347. || !TEST_true(WPACKET_memcpy(&pkt, bytes, sizeof(bytes))) 348. || !TEST_true(WPACKET_finish(&pkt)) ^ 349. || !TEST_true(WPACKET_get_total_written(&pkt, &written)) 350. || !TEST_mem_eq(buf->data, written, alloc, sizeof(alloc))) ssl/packet.c:255:1: Parameter `pkt->written` 253. } 254. 255. > int WPACKET_finish(WPACKET *pkt) 256. { 257. int ret; ssl/packet.c:266:11: Call 264. return 0; 265. 266. ret = wpacket_intern_close(pkt, pkt->subs, 1); ^ 267. if (ret) { 268. OPENSSL_free(pkt->subs); ssl/packet.c:188:1: <LHS trace> 186. * (i.e. it fills in all the lengths), but doesn't actually close anything. 187. */ 188. > static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose) 189. { 190. size_t packlen = pkt->written - sub->pwritten; ssl/packet.c:188:1: Parameter `pkt->written` 186. * (i.e. it fills in all the lengths), but doesn't actually close anything. 187. */ 188. > static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose) 189. { 190. size_t packlen = pkt->written - sub->pwritten; ssl/packet.c:188:1: <RHS trace> 186. * (i.e. it fills in all the lengths), but doesn't actually close anything. 187. */ 188. > static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose) 189. { 190. size_t packlen = pkt->written - sub->pwritten; ssl/packet.c:188:1: Parameter `sub->pwritten` 186. * (i.e. it fills in all the lengths), but doesn't actually close anything. 187. */ 188. > static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose) 189. { 190. size_t packlen = pkt->written - sub->pwritten; ssl/packet.c:190:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `WPACKET_finish` 188. static int wpacket_intern_close(WPACKET *pkt, WPACKET_SUB *sub, int doclose) 189. { 190. size_t packlen = pkt->written - sub->pwritten; ^ 191. 192. if (packlen == 0
https://github.com/openssl/openssl/blob/424aa352458486d67e1e9cd3d3990dc06a60ba4a/ssl/packet.c/#L190
d2a_code_trace_data_43610
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/dh/dh_check.c:62: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end`. Showing all 10 steps of the trace crypto/dh/dh_check.c:45:5: Call 43. if (ctx == NULL) 44. goto err; 45. BN_CTX_start(ctx); ^ 46. tmp = BN_CTX_get(ctx); 47. if (tmp == NULL) crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/dh/dh_check.c:62:9: Call 60. err: 61. if (ctx != NULL) { 62. BN_CTX_end(ctx); ^ 63. BN_CTX_free(ctx); 64. } crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_CTX_end` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_43611
int test_gf2m_add(BIO *bp) { BIGNUM *a, *b, *c; int i, ret = 0; a = BN_new(); b = BN_new(); c = BN_new(); for (i = 0; i < num0; i++) { BN_rand(a, 512, 0, 0); BN_copy(b, BN_value_one()); a->neg = rand_neg(); b->neg = rand_neg(); BN_GF2m_add(c, a, b); if ((BN_is_odd(a) && BN_is_odd(c)) || (!BN_is_odd(a) && !BN_is_odd(c))) { fprintf(stderr, "GF(2^m) addition test (a) failed!\n"); goto err; } BN_GF2m_add(c, c, c); if (!BN_is_zero(c)) { fprintf(stderr, "GF(2^m) addition test (b) failed!\n"); goto err; } } ret = 1; err: BN_free(a); BN_free(b); BN_free(c); return ret; } test/bntest.c:1253: error: MEMORY_LEAK memory dynamically allocated by call to `BN_new()` at line 1228, column 9 is not reachable after line 1253, column 5. Showing all 85 steps of the trace test/bntest.c:1223:1: start of procedure test_gf2m_add() 1221. 1222. #ifndef OPENSSL_NO_EC2M 1223. > int test_gf2m_add(BIO *bp) 1224. { 1225. BIGNUM *a, *b, *c; test/bntest.c:1226:5: 1224. { 1225. BIGNUM *a, *b, *c; 1226. > int i, ret = 0; 1227. 1228. a = BN_new(); test/bntest.c:1228:5: 1226. int i, ret = 0; 1227. 1228. > a = BN_new(); 1229. b = BN_new(); 1230. c = BN_new(); crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1229:5: 1227. 1228. a = BN_new(); 1229. > b = BN_new(); 1230. c = BN_new(); 1231. crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1230:5: 1228. a = BN_new(); 1229. b = BN_new(); 1230. > c = BN_new(); 1231. 1232. for (i = 0; i < num0; i++) { crypto/bn/bn_lib.c:277:1: start of procedure BN_new() 275. } 276. 277. > BIGNUM *BN_new(void) 278. { 279. BIGNUM *ret; crypto/bn/bn_lib.c:281:9: 279. BIGNUM *ret; 280. 281. > if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/mem.c:157:1: start of procedure CRYPTO_zalloc() 155. } 156. 157. > void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. void *ret = CRYPTO_malloc(num, file, line); crypto/mem.c:159:5: 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) 158. { 159. > void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/mem.c:161:9: Taking true branch 159. void *ret = CRYPTO_malloc(num, file, line); 160. 161. if (ret != NULL) ^ 162. memset(ret, 0, num); 163. return ret; crypto/mem.c:162:9: 160. 161. if (ret != NULL) 162. > memset(ret, 0, num); 163. return ret; 164. } crypto/mem.c:163:5: 161. if (ret != NULL) 162. memset(ret, 0, num); 163. > return ret; 164. } 165. crypto/mem.c:164:1: return from a call to CRYPTO_zalloc 162. memset(ret, 0, num); 163. return ret; 164. > } 165. 166. void *CRYPTO_realloc(void *str, size_t num, const char *file, int line) crypto/bn/bn_lib.c:281:9: Taking false branch 279. BIGNUM *ret; 280. 281. if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL) { ^ 282. BNerr(BN_F_BN_NEW, ERR_R_MALLOC_FAILURE); 283. return (NULL); crypto/bn/bn_lib.c:285:5: 283. return (NULL); 284. } 285. > ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. return (ret); crypto/bn/bn_lib.c:287:5: 285. ret->flags = BN_FLG_MALLOCED; 286. bn_check_top(ret); 287. > return (ret); 288. } 289. crypto/bn/bn_lib.c:288:1: return from a call to BN_new 286. bn_check_top(ret); 287. return (ret); 288. > } 289. 290. BIGNUM *BN_secure_new(void) test/bntest.c:1232:10: 1230. c = BN_new(); 1231. 1232. > for (i = 0; i < num0; i++) { 1233. BN_rand(a, 512, 0, 0); 1234. BN_copy(b, BN_value_one()); test/bntest.c:1232:17: Loop condition is false. Leaving loop 1230. c = BN_new(); 1231. 1232. for (i = 0; i < num0; i++) { ^ 1233. BN_rand(a, 512, 0, 0); 1234. BN_copy(b, BN_value_one()); test/bntest.c:1251:5: 1249. } 1250. } 1251. > ret = 1; 1252. err: 1253. BN_free(a); test/bntest.c:1252:2: 1250. } 1251. ret = 1; 1252. > err: 1253. BN_free(a); 1254. BN_free(b); test/bntest.c:1253:5: 1251. ret = 1; 1252. err: 1253. > BN_free(a); 1254. BN_free(b); 1255. BN_free(c); crypto/bn/bn_lib.c:252:1: start of procedure BN_free() 250. } 251. 252. > void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) crypto/bn/bn_lib.c:254:9: Taking false branch 252. void BN_free(BIGNUM *a) 253. { 254. if (a == NULL) ^ 255. return; 256. bn_check_top(a); crypto/bn/bn_lib.c:257:10: 255. return; 256. bn_check_top(a); 257. > if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:965:1: start of procedure BN_get_flags() 963. } 964. 965. > int BN_get_flags(const BIGNUM *b, int n) 966. { 967. return b->flags & n; crypto/bn/bn_lib.c:967:5: 965. int BN_get_flags(const BIGNUM *b, int n) 966. { 967. > return b->flags & n; 968. } 969. crypto/bn/bn_lib.c:968:1: return from a call to BN_get_flags 966. { 967. return b->flags & n; 968. > } 969. 970. /* Populate a BN_GENCB structure with an "old"-style callback */ crypto/bn/bn_lib.c:257:10: Taking false branch 255. return; 256. bn_check_top(a); 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) ^ 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) crypto/bn/bn_lib.c:259:9: Taking false branch 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. if (a->flags & BN_FLG_MALLOCED) ^ 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:263:9: 261. else { 262. #if OPENSSL_API_COMPAT < 0x00908000L 263. > a->flags |= BN_FLG_FREE; 264. #endif 265. a->d = NULL; crypto/bn/bn_lib.c:265:9: 263. a->flags |= BN_FLG_FREE; 264. #endif 265. > a->d = NULL; 266. } 267. } crypto/bn/bn_lib.c:259:5: 257. if (!BN_get_flags(a, BN_FLG_STATIC_DATA)) 258. bn_free_d(a); 259. > if (a->flags & BN_FLG_MALLOCED) 260. OPENSSL_free(a); 261. else { crypto/bn/bn_lib.c:267:1: return from a call to BN_free 265. a->d = NULL; 266. } 267. > } 268. 269. void bn_init(BIGNUM *a)
https://github.com/openssl/openssl/blob/d9e309a675900030d7308e36f614962a344816f9/test/bntest.c/#L1253
d2a_code_trace_data_43612
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:132: error: NULL_DEREFERENCE pointer `ex_data` last assigned on line 113 could be null and is dereferenced at line 132, column 9. Showing all 45 steps of the trace test/handshake_helper.c:110:1: start of procedure select_server_ctx() 108. * An empty SNI extension also returns SSL_TSLEXT_ERR_NOACK. 109. */ 110. > static int select_server_ctx(SSL *s, void *arg, int ignore) 111. { 112. const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); test/handshake_helper.c:112:5: 110. static int select_server_ctx(SSL *s, void *arg, int ignore) 111. { 112. > const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); 113. HANDSHAKE_EX_DATA *ex_data = 114. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); ssl/ssl_lib.c:2683:1: start of procedure SSL_get_servername() 2681. */ 2682. 2683. > const char *SSL_get_servername(const SSL *s, const int type) 2684. { 2685. if (type != TLSEXT_NAMETYPE_host_name) ssl/ssl_lib.c:2685:9: Taking false branch 2683. const char *SSL_get_servername(const SSL *s, const int type) 2684. { 2685. if (type != TLSEXT_NAMETYPE_host_name) ^ 2686. return NULL; 2687. ssl/ssl_lib.c:2688:12: Condition is true 2686. return NULL; 2687. 2688. return s->session && !s->ext.hostname ? ^ 2689. s->session->ext.hostname : s->ext.hostname; 2690. } ssl/ssl_lib.c:2688:27: Condition is true 2686. return NULL; 2687. 2688. return s->session && !s->ext.hostname ? ^ 2689. s->session->ext.hostname : s->ext.hostname; 2690. } ssl/ssl_lib.c:2688:12: 2686. return NULL; 2687. 2688. > return s->session && !s->ext.hostname ? 2689. s->session->ext.hostname : s->ext.hostname; 2690. } ssl/ssl_lib.c:2688:5: 2686. return NULL; 2687. 2688. > return s->session && !s->ext.hostname ? 2689. s->session->ext.hostname : s->ext.hostname; 2690. } ssl/ssl_lib.c:2690:1: return from a call to SSL_get_servername 2688. return s->session && !s->ext.hostname ? 2689. s->session->ext.hostname : s->ext.hostname; 2690. > } 2691. 2692. int SSL_get_servername_type(const SSL *s) test/handshake_helper.c:113:5: 111. { 112. const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); 113. > HANDSHAKE_EX_DATA *ex_data = 114. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); 115. ssl/ssl_lib.c:4154:1: start of procedure SSL_get_ex_data() 4152. } 4153. 4154. > void *SSL_get_ex_data(const SSL *s, int idx) 4155. { 4156. return CRYPTO_get_ex_data(&s->ex_data, idx); ssl/ssl_lib.c:4156:5: 4154. void *SSL_get_ex_data(const SSL *s, int idx) 4155. { 4156. > return CRYPTO_get_ex_data(&s->ex_data, idx); 4157. } 4158. 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:4157:1: return from a call to SSL_get_ex_data 4155. { 4156. return CRYPTO_get_ex_data(&s->ex_data, idx); 4157. > } 4158. 4159. int SSL_CTX_set_ex_data(SSL_CTX *s, int idx, void *arg) test/handshake_helper.c:116:9: Taking false branch 114. (HANDSHAKE_EX_DATA*)(SSL_get_ex_data(s, ex_data_idx)); 115. 116. if (servername == NULL) { ^ 117. ex_data->servername = SSL_TEST_SERVERNAME_SERVER1; 118. return SSL_TLSEXT_ERR_NOACK; test/handshake_helper.c:121:9: Taking true branch 119. } 120. 121. if (strcmp(servername, "server2") == 0) { ^ 122. SSL_CTX *new_ctx = (SSL_CTX*)arg; 123. SSL_set_SSL_CTX(s, new_ctx); test/handshake_helper.c:122:9: 120. 121. if (strcmp(servername, "server2") == 0) { 122. > SSL_CTX *new_ctx = (SSL_CTX*)arg; 123. SSL_set_SSL_CTX(s, new_ctx); 124. /* test/handshake_helper.c:123:9: 121. if (strcmp(servername, "server2") == 0) { 122. SSL_CTX *new_ctx = (SSL_CTX*)arg; 123. > SSL_set_SSL_CTX(s, new_ctx); 124. /* 125. * Copy over all the SSL_CTX options - reasonable behavior ssl/ssl_lib.c:3991:1: start of procedure SSL_set_SSL_CTX() 3989. } 3990. 3991. > SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX *ctx) 3992. { 3993. CERT *new_cert; ssl/ssl_lib.c:3994:9: Taking false branch 3992. { 3993. CERT *new_cert; 3994. if (ssl->ctx == ctx) ^ 3995. return ssl->ctx; 3996. if (ctx == NULL) ssl/ssl_lib.c:3996:9: Taking false branch 3994. if (ssl->ctx == ctx) 3995. return ssl->ctx; 3996. if (ctx == NULL) ^ 3997. ctx = ssl->session_ctx; 3998. new_cert = ssl_cert_dup(ctx->cert); ssl/ssl_lib.c:3998:5: Skipping ssl_cert_dup(): empty list of specs 3996. if (ctx == NULL) 3997. ctx = ssl->session_ctx; 3998. new_cert = ssl_cert_dup(ctx->cert); ^ 3999. if (new_cert == NULL) { 4000. return NULL; ssl/ssl_lib.c:3999:9: Taking false branch 3997. ctx = ssl->session_ctx; 3998. new_cert = ssl_cert_dup(ctx->cert); 3999. if (new_cert == NULL) { ^ 4000. return NULL; 4001. } ssl/ssl_lib.c:4003:10: Taking false branch 4001. } 4002. 4003. if (!custom_exts_copy_flags(&new_cert->custext, &ssl->cert->custext)) { ^ 4004. ssl_cert_free(new_cert); 4005. return NULL; ssl/ssl_lib.c:4008:5: Skipping ssl_cert_free(): empty list of specs 4006. } 4007. 4008. ssl_cert_free(ssl->cert); ^ 4009. ssl->cert = new_cert; 4010. ssl/ssl_lib.c:4009:5: 4007. 4008. ssl_cert_free(ssl->cert); 4009. > ssl->cert = new_cert; 4010. 4011. /* ssl/ssl_lib.c:4015:10: Condition is false 4013. * so setter APIs must prevent invalid lengths from entering the system. 4014. */ 4015. if (!ossl_assert(ssl->sid_ctx_length <= sizeof(ssl->sid_ctx))) ^ 4016. return NULL; 4017. ssl/ssl_lib.c:4015:10: Taking true branch 4013. * so setter APIs must prevent invalid lengths from entering the system. 4014. */ 4015. if (!ossl_assert(ssl->sid_ctx_length <= sizeof(ssl->sid_ctx))) ^ 4016. return NULL; 4017. ssl/ssl_lib.c:4016:9: 4014. */ 4015. if (!ossl_assert(ssl->sid_ctx_length <= sizeof(ssl->sid_ctx))) 4016. > return NULL; 4017. 4018. /* ssl/ssl_lib.c:4036:1: return from a call to SSL_set_SSL_CTX 4034. 4035. return ssl->ctx; 4036. > } 4037. 4038. int SSL_CTX_set_default_verify_paths(SSL_CTX *ctx) test/handshake_helper.c:129:9: 127. * contexts differ/conflict 128. */ 129. > SSL_clear_options(s, 0xFFFFFFFFL); 130. SSL_set_options(s, SSL_CTX_get_options(new_ctx)); 131. ssl/ssl_lib.c:4578:1: start of procedure SSL_clear_options() 4576. } 4577. 4578. > unsigned long SSL_clear_options(SSL *s, unsigned long op) 4579. { 4580. return s->options &= ~op; ssl/ssl_lib.c:4580:5: 4578. unsigned long SSL_clear_options(SSL *s, unsigned long op) 4579. { 4580. > return s->options &= ~op; 4581. } 4582. ssl/ssl_lib.c:4581:1: return from a call to SSL_clear_options 4579. { 4580. return s->options &= ~op; 4581. > } 4582. 4583. STACK_OF(X509) *SSL_get0_verified_chain(const SSL *s) test/handshake_helper.c:130:9: 128. */ 129. SSL_clear_options(s, 0xFFFFFFFFL); 130. > SSL_set_options(s, SSL_CTX_get_options(new_ctx)); 131. 132. ex_data->servername = SSL_TEST_SERVERNAME_SERVER2; ssl/ssl_lib.c:4553:1: start of procedure SSL_CTX_get_options() 4551. * control interface. 4552. */ 4553. > unsigned long SSL_CTX_get_options(const SSL_CTX *ctx) 4554. { 4555. return ctx->options; ssl/ssl_lib.c:4555:5: 4553. unsigned long SSL_CTX_get_options(const SSL_CTX *ctx) 4554. { 4555. > return ctx->options; 4556. } 4557. ssl/ssl_lib.c:4556:1: return from a call to SSL_CTX_get_options 4554. { 4555. return ctx->options; 4556. > } 4557. 4558. unsigned long SSL_get_options(const SSL *s) ssl/ssl_lib.c:4568:1: start of procedure SSL_set_options() 4566. } 4567. 4568. > unsigned long SSL_set_options(SSL *s, unsigned long op) 4569. { 4570. return s->options |= op; ssl/ssl_lib.c:4570:5: 4568. unsigned long SSL_set_options(SSL *s, unsigned long op) 4569. { 4570. > return s->options |= op; 4571. } 4572. ssl/ssl_lib.c:4571:1: return from a call to SSL_set_options 4569. { 4570. return s->options |= op; 4571. > } 4572. 4573. unsigned long SSL_CTX_clear_options(SSL_CTX *ctx, unsigned long op) test/handshake_helper.c:132:9: 130. SSL_set_options(s, SSL_CTX_get_options(new_ctx)); 131. 132. > ex_data->servername = SSL_TEST_SERVERNAME_SERVER2; 133. return SSL_TLSEXT_ERR_OK; 134. } else if (strcmp(servername, "server1") == 0) {
https://github.com/openssl/openssl/blob/f770d75b1cac264d6280ec7326277daff6965cbb/test/handshake_helper.c/#L132
d2a_code_trace_data_43613
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:2515: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned64 by call to `SSL_free`. Showing all 17 steps of the trace test/sslapitest.c:2487:10: Call 2485. } 2486. 2487. if (!TEST_true(create_ssl_objects(sctx, cctx, &serverssl, ^ 2488. &clientssl, NULL, NULL))) 2489. goto end; test/ssltestlib.c:576:15: Call 574. if (*sssl != NULL) 575. serverssl = *sssl; 576. else if (!TEST_ptr(serverssl = SSL_new(serverctx))) ^ 577. goto error; 578. if (*cssl != NULL) ssl/ssl_lib.c:668:1: Parameter `ctx->sessions->num_items` 666. } 667. 668. > SSL *SSL_new(SSL_CTX *ctx) 669. { 670. SSL *s; test/sslapitest.c:2515:5: Call 2513. 2514. end: 2515. SSL_free(serverssl); ^ 2516. SSL_free(clientssl); 2517. SSL_CTX_free(sctx); ssl/ssl_lib.c:1124:1: Parameter `s->session_ctx->sessions->num_items` 1122. } 1123. 1124. > void SSL_free(SSL *s) 1125. { 1126. int i; ssl/ssl_lib.c:1155:9: Call 1153. /* Make the next call work :-) */ 1154. if (s->session != NULL) { 1155. ssl_clear_bad_session(s); ^ 1156. SSL_SESSION_free(s->session); 1157. } ssl/ssl_sess.c:1134:1: Parameter `s->session_ctx->sessions->num_items` 1132. } 1133. 1134. > int ssl_clear_bad_session(SSL *s) 1135. { 1136. if ((s->session != NULL) && ssl/ssl_sess.c:1139:9: Call 1137. !(s->shutdown & SSL_SENT_SHUTDOWN) && 1138. !(SSL_in_init(s) || SSL_in_before(s))) { 1139. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 1140. return 1; 1141. } else ssl/ssl_sess.c:751:1: Parameter `ctx->sessions->num_items` 749. } 750. 751. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 752. { 753. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:753:12: Call 751. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 752. { 753. return remove_session_lock(ctx, c, 1); ^ 754. } 755. ssl/ssl_sess.c:756:1: Parameter `ctx->sessions->num_items` 754. } 755. 756. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 757. { 758. SSL_SESSION *r; ssl/ssl_sess.c:766:17: Call 764. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) != NULL) { 765. ret = 1; 766. r = lh_SSL_SESSION_delete(ctx->sessions, r); ^ 767. SSL_SESSION_list_remove(ctx, r); 768. } ssl/ssl_locl.h:732:1: Parameter `lh->num_items` 730. } TLSEXT_INDEX; 731. 732. > DEFINE_LHASH_OF(SSL_SESSION); 733. /* Needed in ssl_cert.c */ 734. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:732:1: Call 730. } TLSEXT_INDEX; 731. 732. > DEFINE_LHASH_OF(SSL_SESSION); 733. /* Needed in ssl_cert.c */ 734. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:119:1: <LHS trace> 117. } 118. 119. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 120. { 121. unsigned long hash; crypto/lhash/lhash.c:119:1: Parameter `lh->num_items` 117. } 118. 119. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 120. { 121. unsigned long hash; crypto/lhash/lhash.c:139:5: Binary operation: ([0, +oo] - 1):unsigned64 by call to `SSL_free` 137. } 138. 139. lh->num_items--; ^ 140. if ((lh->num_nodes > MIN_NODES) && 141. (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes)))
https://github.com/openssl/openssl/blob/034cb87b6c7758986b40692d1d5abdd2a7ba826e/crypto/lhash/lhash.c/#L139
d2a_code_trace_data_43614
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:1018: error: Uninitialized Value The value read from ref[_] was never initialized. libavcodec/h264.c:1018:20: 1016. }else{ 1017. for(list=0; list<2; list++){ 1018. if(ref[list] >= 0) ^ 1019. pred_motion(h, 0, 4, list, ref[list], &mv[list][0], &mv[list][1]); 1020. else
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/h264.c/#L1018
d2a_code_trace_data_43615
static inline unsigned int constant_time_ge(unsigned int a, unsigned int b) { unsigned int ge; ge = ~((a ^ b) | (a - b)); ge |= a & ~b; return constant_time_msb(ge); } ssl/d1_pkt.c:712: error: INTEGER_OVERFLOW_L2 ([0, 17727] - [0, 17728]):unsigned32 by call to `dtls1_process_record`. Showing all 13 steps of the trace ssl/d1_pkt.c:583:4: Assignment 581. if (s->packet_length != DTLS1_RT_HEADER_LENGTH) 582. { 583. s->packet_length = 0; ^ 584. goto again; 585. } ssl/d1_pkt.c:712:7: Call 710. } 711. 712. if (!dtls1_process_record(s)) ^ 713. { 714. rr->length = 0; ssl/d1_pkt.c:376:1: Parameter `s->s3->rrec.length` 374. #endif 375. 376. > static int 377. dtls1_process_record(SSL *s) 378. { ssl/d1_pkt.c:469:4: Call 467. * */ 468. mac = mac_tmp; 469. ssl3_cbc_copy_mac(mac_tmp, rr, mac_size); ^ 470. rr->length -= mac_size; 471. } ssl/s3_cbc.c:215:1: Parameter `md_size` 213. #define CBC_MAC_ROTATE_IN_PLACE 214. 215. > void ssl3_cbc_copy_mac(unsigned char* out, 216. const SSL3_RECORD *rec, 217. unsigned md_size) ssl/s3_cbc.c:261:29: Call 259. { 260. unsigned char mac_started = constant_time_ge_8(i, mac_start); 261. unsigned char mac_ended = constant_time_ge_8(i, mac_end); ^ 262. unsigned char b = rec->data[i]; 263. rotated_mac[j++] |= b & mac_started & ~mac_ended; crypto/constant_time_locl.h:140:1: Parameter `a` 138. } 139. 140. > static inline unsigned char constant_time_ge_8(unsigned int a, unsigned int b) 141. { 142. return (unsigned char)(constant_time_ge(a, b)); crypto/constant_time_locl.h:142:25: Call 140. static inline unsigned char constant_time_ge_8(unsigned int a, unsigned int b) 141. { 142. return (unsigned char)(constant_time_ge(a, b)); ^ 143. } 144. crypto/constant_time_locl.h:130:1: <LHS trace> 128. } 129. 130. > static inline unsigned int constant_time_ge(unsigned int a, unsigned int b) 131. { 132. unsigned int ge; crypto/constant_time_locl.h:130:1: Parameter `a` 128. } 129. 130. > static inline unsigned int constant_time_ge(unsigned int a, unsigned int b) 131. { 132. unsigned int ge; crypto/constant_time_locl.h:130:1: <RHS trace> 128. } 129. 130. > static inline unsigned int constant_time_ge(unsigned int a, unsigned int b) 131. { 132. unsigned int ge; crypto/constant_time_locl.h:130:1: Parameter `b` 128. } 129. 130. > static inline unsigned int constant_time_ge(unsigned int a, unsigned int b) 131. { 132. unsigned int ge; crypto/constant_time_locl.h:134:2: Binary operation: ([0, 17727] - [0, 17728]):unsigned32 by call to `dtls1_process_record` 132. unsigned int ge; 133. /* Case 1: msb(a) == msb(b). a >= b iff the MSB of a - b is not set.*/ 134. ge = ~((a ^ b) | (a - b)); ^ 135. /* Case 2: msb(a) != msb(b). a >= b iff the MSB of a is set. */ 136. ge |= a & ~b;
https://github.com/openssl/openssl/blob/360928b7d0f16dde70e26841bbf9e1af727e8b8f/crypto/constant_time_locl.h/#L134
d2a_code_trace_data_43616
static void test_ctx_replace(EVP_CIPHER_CTX **pctx) { EVP_CIPHER_CTX *ctx_copy; ctx_copy = EVP_CIPHER_CTX_new(); EVP_CIPHER_CTX_copy(ctx_copy, *pctx); EVP_CIPHER_CTX_free(*pctx); *pctx = ctx_copy; } crypto/evp/evp_test.c:142: error: NULL_DEREFERENCE pointer `ctx_copy` last assigned on line 141 could be null and is dereferenced by call to `EVP_CIPHER_CTX_copy()` at line 142, column 2. Showing all 17 steps of the trace crypto/evp/evp_test.c:137:1: start of procedure test_ctx_replace() 135. 136. /* Test copying of contexts */ 137. > static void test_ctx_replace(EVP_CIPHER_CTX **pctx) 138. { 139. /* Make copy of context and replace original */ crypto/evp/evp_test.c:141:2: 139. /* Make copy of context and replace original */ 140. EVP_CIPHER_CTX *ctx_copy; 141. > ctx_copy = EVP_CIPHER_CTX_new(); 142. EVP_CIPHER_CTX_copy(ctx_copy, *pctx); 143. EVP_CIPHER_CTX_free(*pctx); crypto/evp/evp_enc.c:77:1: start of procedure EVP_CIPHER_CTX_new() 75. } 76. 77. > EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void) 78. { 79. EVP_CIPHER_CTX *ctx=OPENSSL_malloc(sizeof *ctx); crypto/evp/evp_enc.c:79:2: 77. EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void) 78. { 79. > EVP_CIPHER_CTX *ctx=OPENSSL_malloc(sizeof *ctx); 80. if (ctx) 81. EVP_CIPHER_CTX_init(ctx); crypto/mem.c:295:1: start of procedure CRYPTO_malloc() 293. } 294. 295. > void *CRYPTO_malloc(int num, const char *file, int line) 296. { 297. void *ret = NULL; crypto/mem.c:297:2: 295. void *CRYPTO_malloc(int num, const char *file, int line) 296. { 297. > void *ret = NULL; 298. 299. if (num <= 0) return NULL; crypto/mem.c:299:6: Taking false branch 297. void *ret = NULL; 298. 299. if (num <= 0) return NULL; ^ 300. 301. allow_customize = 0; crypto/mem.c:301:2: 299. if (num <= 0) return NULL; 300. 301. > allow_customize = 0; 302. if (malloc_debug_func != NULL) 303. { crypto/mem.c:302:6: Taking false branch 300. 301. allow_customize = 0; 302. if (malloc_debug_func != NULL) ^ 303. { 304. allow_customize_debug = 0; crypto/mem.c:307:2: Skipping __function_pointer__(): unresolved function pointer 305. malloc_debug_func(NULL, num, file, line, 0); 306. } 307. ret = malloc_ex_func(num,file,line); ^ 308. #ifdef LEVITTE_DEBUG_MEM 309. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num); crypto/mem.c:311:6: Taking false branch 309. fprintf(stderr, "LEVITTE_DEBUG_MEM: > 0x%p (%d)\n", ret, num); 310. #endif 311. if (malloc_debug_func != NULL) ^ 312. malloc_debug_func(ret, num, file, line, 1); 313. crypto/mem.c:324:2: 322. #endif 323. 324. > return ret; 325. } 326. char *CRYPTO_strdup(const char *str, const char *file, int line) crypto/mem.c:325:2: return from a call to CRYPTO_malloc 323. 324. return ret; 325. } ^ 326. char *CRYPTO_strdup(const char *str, const char *file, int line) 327. { crypto/evp/evp_enc.c:80:6: Taking false branch 78. { 79. EVP_CIPHER_CTX *ctx=OPENSSL_malloc(sizeof *ctx); 80. if (ctx) ^ 81. EVP_CIPHER_CTX_init(ctx); 82. return ctx; crypto/evp/evp_enc.c:82:2: 80. if (ctx) 81. EVP_CIPHER_CTX_init(ctx); 82. > return ctx; 83. } 84. crypto/evp/evp_enc.c:83:2: return from a call to EVP_CIPHER_CTX_new 81. EVP_CIPHER_CTX_init(ctx); 82. return ctx; 83. } ^ 84. 85. int EVP_CipherInit(EVP_CIPHER_CTX *ctx, const EVP_CIPHER *cipher, crypto/evp/evp_test.c:142:2: 140. EVP_CIPHER_CTX *ctx_copy; 141. ctx_copy = EVP_CIPHER_CTX_new(); 142. > EVP_CIPHER_CTX_copy(ctx_copy, *pctx); 143. EVP_CIPHER_CTX_free(*pctx); 144. *pctx = ctx_copy;
https://github.com/openssl/openssl/blob/e67ddd19af4f3e987a3c97de3c9baf436fd40ad1/crypto/evp/evp_test.c/#L142
d2a_code_trace_data_43617
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:393: error: Integer Overflow L2 ([1, +oo] - 2):unsigned32 by call to `bitstream_read`. libavcodec/takdec.c:393:46: Call 391. for (i = 4; i < filter_order; i++) { 392. if (!(i & 3)) 393. code_size = code_size_base - bitstream_read(bc, 2); ^ 394. predictors[i] = bitstream_read_signed(bc, code_size) << (10 - size); 395. } 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] - 2):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_43618
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ecdh_ossl.c:69: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_mul`. Showing all 12 steps of the trace crypto/ec/ecdh_ossl.c:52:5: Call 50. if ((ctx = BN_CTX_new()) == NULL) 51. goto err; 52. BN_CTX_start(ctx); ^ 53. x = BN_CTX_get(ctx); 54. if (x == NULL) { crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/ec/ecdh_ossl.c:69:14: Call 67. if (EC_KEY_get_flags(ecdh) & EC_FLAG_COFACTOR_ECDH) { 68. if (!EC_GROUP_get_cofactor(group, x, NULL) || 69. !BN_mul(x, x, priv_key, ctx)) { ^ 70. ECerr(EC_F_ECDH_SIMPLE_COMPUTE_KEY, ERR_R_MALLOC_FAILURE); 71. goto err; crypto/bn/bn_mul.c:497:1: Parameter `ctx->stack.depth` 495. #endif /* BN_RECURSION */ 496. 497. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 498. { 499. int ret = 0; crypto/bn/bn_mul.c:523:5: Call 521. top = al + bl; 522. 523. BN_CTX_start(ctx); ^ 524. if ((r == a) || (r == b)) { 525. if ((rr = BN_CTX_get(ctx)) == NULL) crypto/bn/bn_ctx.c:181:1: Parameter `ctx->stack.depth` 179. } 180. 181. > void BN_CTX_start(BN_CTX *ctx) 182. { 183. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mul.c:608:5: Call 606. err: 607. bn_check_top(r); 608. BN_CTX_end(ctx); ^ 609. return ret; 610. } 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_mul` 271. static unsigned int BN_STACK_pop(BN_STACK *st) 272. { 273. return st->indexes[--(st->depth)]; ^ 274. } 275.
https://github.com/openssl/openssl/blob/e613b1eff40f21cd99240f9884cd3396b0ab50f1/crypto/bn/bn_ctx.c/#L273
d2a_code_trace_data_43619
static void decode(Real288_internal *glob, unsigned int input) { unsigned int x,y; float f; double sum,sumsum; float *p1,*p2; float buffer[5]; const float *table; for (x=36;x--;glob->sb[x+5]=glob->sb[x]); for (x=5;x--;) { p1=glob->sb+x;p2=glob->pr1; for (sum=0,y=36;y--;sum-=(*(++p1))*(*(p2++))); glob->sb[x]=sum; } f=amptable[input&7]; table=codetable+(input>>3)*5; for (sum=32,x=10;x--;sum-=glob->pr2[x]*glob->lhist[x]); if (sum<0) sum=0; else if (sum>60) sum=60; sumsum=exp(sum*0.1151292546497)*f; for (sum=0,x=5;x--;) { buffer[x]=table[x]*sumsum; sum+=buffer[x]*buffer[x]; } if ((sum/=5)<1) sum=1; for (x=10;--x;glob->lhist[x]=glob->lhist[x-1]); *glob->lhist=glob->history[glob->phase]=10*log10(sum)-32; for (x=1;x<5;x++) for (y=x;y--;buffer[x]-=glob->pr1[x-y-1]*buffer[y]); for (x=0;x<5;x++) { f=glob->sb[4-x]+buffer[x]; if (f>4095) f=4095; else if (f<-4095) f=-4095; glob->output[glob->phasep+x]=glob->sb[4-x]=f; } } libavcodec/ra288.c:122: error: Integer Overflow L2 ([1, 4] - [-oo, 3]):unsigned32. libavcodec/ra288.c:122:8: <LHS trace> 120. *glob->lhist=glob->history[glob->phase]=10*log10(sum)-32; 121. 122. for (x=1;x<5;x++) for (y=x;y--;buffer[x]-=glob->pr1[x-y-1]*buffer[y]); ^ 123. 124. /* output */ libavcodec/ra288.c:122:8: Assignment 120. *glob->lhist=glob->history[glob->phase]=10*log10(sum)-32; 121. 122. for (x=1;x<5;x++) for (y=x;y--;buffer[x]-=glob->pr1[x-y-1]*buffer[y]); ^ 123. 124. /* output */ libavcodec/ra288.c:122:8: <RHS trace> 120. *glob->lhist=glob->history[glob->phase]=10*log10(sum)-32; 121. 122. for (x=1;x<5;x++) for (y=x;y--;buffer[x]-=glob->pr1[x-y-1]*buffer[y]); ^ 123. 124. /* output */ libavcodec/ra288.c:122:8: Assignment 120. *glob->lhist=glob->history[glob->phase]=10*log10(sum)-32; 121. 122. for (x=1;x<5;x++) for (y=x;y--;buffer[x]-=glob->pr1[x-y-1]*buffer[y]); ^ 123. 124. /* output */ libavcodec/ra288.c:122:26: Assignment 120. *glob->lhist=glob->history[glob->phase]=10*log10(sum)-32; 121. 122. for (x=1;x<5;x++) for (y=x;y--;buffer[x]-=glob->pr1[x-y-1]*buffer[y]); ^ 123. 124. /* output */ libavcodec/ra288.c:122:30: Assignment 120. *glob->lhist=glob->history[glob->phase]=10*log10(sum)-32; 121. 122. for (x=1;x<5;x++) for (y=x;y--;buffer[x]-=glob->pr1[x-y-1]*buffer[y]); ^ 123. 124. /* output */ libavcodec/ra288.c:122:45: Binary operation: ([1, 4] - [-oo, 3]):unsigned32 120. *glob->lhist=glob->history[glob->phase]=10*log10(sum)-32; 121. 122. for (x=1;x<5;x++) for (y=x;y--;buffer[x]-=glob->pr1[x-y-1]*buffer[y]); ^ 123. 124. /* output */
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ra288.c/#L122
d2a_code_trace_data_43620
void TIFFSwabLong8(uint64* lp) { register unsigned char* cp = (unsigned char*) lp; unsigned char t; assert(sizeof(uint64)==8); t = cp[7]; cp[7] = cp[0]; cp[0] = t; t = cp[6]; cp[6] = cp[1]; cp[1] = t; t = cp[5]; cp[5] = cp[2]; cp[2] = t; t = cp[4]; cp[4] = cp[3]; cp[3] = t; } libtiff/tif_dirread.c:964: error: Buffer Overrun L3 Offset: [7, +oo] (⇐ [0, +oo] + 7) Size: [0, +oo] by call to `TIFFSwabLong8`. libtiff/tif_dirread.c:842:6: Call 840. return(TIFFReadDirEntryErrType); 841. } 842. err=TIFFReadDirEntryArray(tif,direntry,&count,1,&origdata); ^ 843. if ((err!=TIFFReadDirEntryErrOk)||(origdata==0)) 844. { libtiff/tif_dirread.c:756:1: Parameter `**value` 754. } 755. 756. static enum TIFFReadDirEntryErr TIFFReadDirEntryArray(TIFF* tif, TIFFDirEntry* direntry, uint32* count, uint32 desttypesize, void** value) ^ 757. { 758. int typesize; libtiff/tif_dirread.c:959:5: Assignment 957. uint8* mb; 958. uint32 n; 959. ma=(uint64*)origdata; ^ 960. mb=data; 961. for (n=0; n<count; n++) libtiff/tif_dirread.c:964:7: Call 962. { 963. if (tif->tif_flags&TIFF_SWAB) 964. TIFFSwabLong8(ma); ^ 965. err=TIFFReadDirEntryCheckRangeByteLong8(*ma); 966. if (err!=TIFFReadDirEntryErrOk) libtiff/tif_swab.c:58:1: <Length trace> 56. 57. #ifndef TIFFSwabLong8 58. void ^ 59. TIFFSwabLong8(uint64* lp) 60. { libtiff/tif_swab.c:58:1: Parameter `*lp` 56. 57. #ifndef TIFFSwabLong8 58. void ^ 59. TIFFSwabLong8(uint64* lp) 60. { libtiff/tif_swab.c:61:2: Assignment 59. TIFFSwabLong8(uint64* lp) 60. { 61. register unsigned char* cp = (unsigned char*) lp; ^ 62. unsigned char t; 63. assert(sizeof(uint64)==8); libtiff/tif_swab.c:64:6: Array access: Offset: [7, +oo] (⇐ [0, +oo] + 7) Size: [0, +oo] by call to `TIFFSwabLong8` 62. unsigned char t; 63. assert(sizeof(uint64)==8); 64. t = cp[7]; cp[7] = cp[0]; cp[0] = t; ^ 65. t = cp[6]; cp[6] = cp[1]; cp[1] = t; 66. t = cp[5]; cp[5] = cp[2]; cp[2] = t;
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_swab.c/#L64
d2a_code_trace_data_43621
static int createCroppedImage(struct image_data *image, struct crop_mask *crop, unsigned char **read_buff_ptr, unsigned char **crop_buff_ptr) { tsize_t cropsize; unsigned char *read_buff = NULL; unsigned char *crop_buff = NULL; unsigned char *new_buff = NULL; static tsize_t prev_cropsize = 0; read_buff = *read_buff_ptr; crop_buff = read_buff; *crop_buff_ptr = read_buff; crop->combined_width = image->width; crop->combined_length = image->length; cropsize = crop->bufftotal; crop_buff = *crop_buff_ptr; if (!crop_buff) { crop_buff = (unsigned char *)limitMalloc(cropsize); *crop_buff_ptr = crop_buff; _TIFFmemset(crop_buff, 0, cropsize); prev_cropsize = cropsize; } else { if (prev_cropsize < cropsize) { new_buff = _TIFFrealloc(crop_buff, cropsize); if (!new_buff) { free (crop_buff); crop_buff = (unsigned char *)limitMalloc(cropsize); } else crop_buff = new_buff; _TIFFmemset(crop_buff, 0, cropsize); } } if (!crop_buff) { TIFFError("createCroppedImage", "Unable to allocate/reallocate crop buffer"); return (-1); } *crop_buff_ptr = crop_buff; if (crop->crop_mode & CROP_INVERT) { switch (crop->photometric) { case PHOTOMETRIC_MINISWHITE: case PHOTOMETRIC_MINISBLACK: image->photometric = crop->photometric; break; case INVERT_DATA_ONLY: case INVERT_DATA_AND_TAG: if (invertImage(image->photometric, image->spp, image->bps, crop->combined_width, crop->combined_length, crop_buff)) { TIFFError("createCroppedImage", "Failed to invert colorspace for image or cropped selection"); return (-1); } if (crop->photometric == INVERT_DATA_AND_TAG) { switch (image->photometric) { case PHOTOMETRIC_MINISWHITE: image->photometric = PHOTOMETRIC_MINISBLACK; break; case PHOTOMETRIC_MINISBLACK: image->photometric = PHOTOMETRIC_MINISWHITE; break; default: break; } } break; default: break; } } if (crop->crop_mode & CROP_MIRROR) { if (mirrorImage(image->spp, image->bps, crop->mirror, crop->combined_width, crop->combined_length, crop_buff)) { TIFFError("createCroppedImage", "Failed to mirror image or cropped selection %s", (crop->rotation == MIRROR_HORIZ) ? "horizontally" : "vertically"); return (-1); } } if (crop->crop_mode & CROP_ROTATE) { if (rotateImage(crop->rotation, image, &crop->combined_width, &crop->combined_length, crop_buff_ptr)) { TIFFError("createCroppedImage", "Failed to rotate image or cropped selection by %d degrees", crop->rotation); return (-1); } } if (crop_buff == read_buff) *read_buff_ptr = NULL; return (0); } tools/tiffcrop.c:7671: error: Null Dereference pointer `crop_buff` last assigned on line 7667 could be null and is dereferenced by call to `_TIFFmemset()` at line 7671, column 7. tools/tiffcrop.c:7632:1: start of procedure createCroppedImage() 7630. * the most optimized path when no Zones or Regions are required. 7631. */ 7632. static int ^ 7633. createCroppedImage(struct image_data *image, struct crop_mask *crop, 7634. unsigned char **read_buff_ptr, unsigned char **crop_buff_ptr) tools/tiffcrop.c:7637:3: 7635. { 7636. tsize_t cropsize; 7637. unsigned char *read_buff = NULL; ^ 7638. unsigned char *crop_buff = NULL; 7639. unsigned char *new_buff = NULL; tools/tiffcrop.c:7638:3: 7636. tsize_t cropsize; 7637. unsigned char *read_buff = NULL; 7638. unsigned char *crop_buff = NULL; ^ 7639. unsigned char *new_buff = NULL; 7640. static tsize_t prev_cropsize = 0; tools/tiffcrop.c:7639:3: 7637. unsigned char *read_buff = NULL; 7638. unsigned char *crop_buff = NULL; 7639. unsigned char *new_buff = NULL; ^ 7640. static tsize_t prev_cropsize = 0; 7641. tools/tiffcrop.c:7640:3: 7638. unsigned char *crop_buff = NULL; 7639. unsigned char *new_buff = NULL; 7640. static tsize_t prev_cropsize = 0; ^ 7641. 7642. read_buff = *read_buff_ptr; tools/tiffcrop.c:7642:3: 7640. static tsize_t prev_cropsize = 0; 7641. 7642. read_buff = *read_buff_ptr; ^ 7643. 7644. /* process full image, no crop buffer needed */ tools/tiffcrop.c:7645:3: 7643. 7644. /* process full image, no crop buffer needed */ 7645. crop_buff = read_buff; ^ 7646. *crop_buff_ptr = read_buff; 7647. crop->combined_width = image->width; tools/tiffcrop.c:7646:3: 7644. /* process full image, no crop buffer needed */ 7645. crop_buff = read_buff; 7646. *crop_buff_ptr = read_buff; ^ 7647. crop->combined_width = image->width; 7648. crop->combined_length = image->length; tools/tiffcrop.c:7647:3: 7645. crop_buff = read_buff; 7646. *crop_buff_ptr = read_buff; 7647. crop->combined_width = image->width; ^ 7648. crop->combined_length = image->length; 7649. tools/tiffcrop.c:7648:3: 7646. *crop_buff_ptr = read_buff; 7647. crop->combined_width = image->width; 7648. crop->combined_length = image->length; ^ 7649. 7650. cropsize = crop->bufftotal; tools/tiffcrop.c:7650:3: 7648. crop->combined_length = image->length; 7649. 7650. cropsize = crop->bufftotal; ^ 7651. crop_buff = *crop_buff_ptr; 7652. if (!crop_buff) tools/tiffcrop.c:7651:3: 7649. 7650. cropsize = crop->bufftotal; 7651. crop_buff = *crop_buff_ptr; ^ 7652. if (!crop_buff) 7653. { tools/tiffcrop.c:7652:8: Taking false branch 7650. cropsize = crop->bufftotal; 7651. crop_buff = *crop_buff_ptr; 7652. if (!crop_buff) ^ 7653. { 7654. crop_buff = (unsigned char *)limitMalloc(cropsize); tools/tiffcrop.c:7661:9: Taking true branch 7659. else 7660. { 7661. if (prev_cropsize < cropsize) ^ 7662. { 7663. new_buff = _TIFFrealloc(crop_buff, cropsize); tools/tiffcrop.c:7663:7: 7661. if (prev_cropsize < cropsize) 7662. { 7663. new_buff = _TIFFrealloc(crop_buff, cropsize); ^ 7664. if (!new_buff) 7665. { libtiff/tif_unix.c:331:1: start of procedure _TIFFrealloc() 329. } 330. 331. void* ^ 332. _TIFFrealloc(void* p, tmsize_t s) 333. { libtiff/tif_unix.c:334:2: 332. _TIFFrealloc(void* p, tmsize_t s) 333. { 334. return (realloc(p, (size_t) s)); ^ 335. } 336. libtiff/tif_unix.c:335:1: return from a call to _TIFFrealloc 333. { 334. return (realloc(p, (size_t) s)); 335. } ^ 336. 337. void tools/tiffcrop.c:7664:12: Taking true branch 7662. { 7663. new_buff = _TIFFrealloc(crop_buff, cropsize); 7664. if (!new_buff) ^ 7665. { 7666. free (crop_buff); tools/tiffcrop.c:7666:2: 7664. if (!new_buff) 7665. { 7666. free (crop_buff); ^ 7667. crop_buff = (unsigned char *)limitMalloc(cropsize); 7668. } tools/tiffcrop.c:7667:9: 7665. { 7666. free (crop_buff); 7667. crop_buff = (unsigned char *)limitMalloc(cropsize); ^ 7668. } 7669. else tools/tiffcrop.c:629:1: start of procedure limitMalloc() 627. * This custom malloc function enforce a maximum allocation size 628. */ 629. static void* limitMalloc(tmsize_t s) ^ 630. { 631. if (maxMalloc && (s > maxMalloc)) { tools/tiffcrop.c:631:7: Taking true branch 629. static void* limitMalloc(tmsize_t s) 630. { 631. if (maxMalloc && (s > maxMalloc)) { ^ 632. fprintf(stderr, "MemoryLimitError: allocation of " TIFF_UINT64_FORMAT " bytes is forbidden. Limit is " TIFF_UINT64_FORMAT ".\n", 633. (uint64)s, (uint64)maxMalloc); tools/tiffcrop.c:631:21: Taking true branch 629. static void* limitMalloc(tmsize_t s) 630. { 631. if (maxMalloc && (s > maxMalloc)) { ^ 632. fprintf(stderr, "MemoryLimitError: allocation of " TIFF_UINT64_FORMAT " bytes is forbidden. Limit is " TIFF_UINT64_FORMAT ".\n", 633. (uint64)s, (uint64)maxMalloc); tools/tiffcrop.c:632:5: 630. { 631. if (maxMalloc && (s > maxMalloc)) { 632. fprintf(stderr, "MemoryLimitError: allocation of " TIFF_UINT64_FORMAT " bytes is forbidden. Limit is " TIFF_UINT64_FORMAT ".\n", ^ 633. (uint64)s, (uint64)maxMalloc); 634. fprintf(stderr, " use -k option to change limit.\n"); return NULL; tools/tiffcrop.c:634:5: 632. fprintf(stderr, "MemoryLimitError: allocation of " TIFF_UINT64_FORMAT " bytes is forbidden. Limit is " TIFF_UINT64_FORMAT ".\n", 633. (uint64)s, (uint64)maxMalloc); 634. fprintf(stderr, " use -k option to change limit.\n"); return NULL; ^ 635. } 636. return _TIFFmalloc(s); tools/tiffcrop.c:634:76: 632. fprintf(stderr, "MemoryLimitError: allocation of " TIFF_UINT64_FORMAT " bytes is forbidden. Limit is " TIFF_UINT64_FORMAT ".\n", 633. (uint64)s, (uint64)maxMalloc); 634. fprintf(stderr, " use -k option to change limit.\n"); return NULL; ^ 635. } 636. return _TIFFmalloc(s); tools/tiffcrop.c:637:1: return from a call to limitMalloc 635. } 636. return _TIFFmalloc(s); 637. } ^ 638. 639. tools/tiffcrop.c:7671:7: 7669. else 7670. crop_buff = new_buff; 7671. _TIFFmemset(crop_buff, 0, cropsize); ^ 7672. } 7673. } libtiff/tif_unix.c:337:1: start of procedure _TIFFmemset() 335. } 336. 337. void ^ 338. _TIFFmemset(void* p, int v, tmsize_t c) 339. { libtiff/tif_unix.c:340:2: 338. _TIFFmemset(void* p, int v, tmsize_t c) 339. { 340. memset(p, v, (size_t) c); ^ 341. } 342. libtiff/tif_unix.c:341:1: return from a call to _TIFFmemset 339. { 340. memset(p, v, (size_t) c); 341. } ^ 342. 343. void
https://gitlab.com/libtiff/libtiff/blob/632f6a1a4f830f69d62fc0314b2109a2d9025963/tools/tiffcrop.c/#L7671
d2a_code_trace_data_43622
void err_clear_last_constant_time(int clear) { ERR_STATE *es; int top; es = ERR_get_state(); if (es == NULL) return; top = es->top; es->err_flags[top] &= ~(0 - clear); es->err_buffer[top] &= ~(0UL - clear); es->err_file[top] = (const char *)((UINTPTR_T)es->err_file[top] & ~((UINTPTR_T)0 - clear)); es->err_line[top] |= 0 - clear; es->top = (top + ERR_NUM_ERRORS - clear) % ERR_NUM_ERRORS; } crypto/rsa/rsa_oaep.c:264: error: INTEGER_OVERFLOW_L2 (0 - [0, 1]):unsigned64 by call to `err_clear_last_constant_time`. Showing all 7 steps of the trace crypto/rsa/rsa_oaep.c:208:5: Assignment 206. good &= constant_time_is_zero(CRYPTO_memcmp(db, phash, mdlen)); 207. 208. found_one_byte = 0; ^ 209. for (i = mdlen; i < dblen; i++) { 210. /* crypto/rsa/rsa_oaep.c:221:5: Assignment 219. } 220. 221. good &= found_one_byte; ^ 222. 223. /* crypto/rsa/rsa_oaep.c:234:5: Assignment 232. * For good measure, do this check in constant time as well. 233. */ 234. good &= constant_time_ge(tlen, mlen); ^ 235. 236. /* crypto/rsa/rsa_oaep.c:264:5: Call 262. RSAerr(RSA_F_RSA_PADDING_CHECK_PKCS1_OAEP_MGF1, 263. RSA_R_OAEP_DECODING_ERROR); 264. err_clear_last_constant_time(1 & good); ^ 265. cleanup: 266. OPENSSL_cleanse(seed, sizeof(seed)); crypto/err/err.c:936:1: <RHS trace> 934. #endif 935. 936. > void err_clear_last_constant_time(int clear) 937. { 938. ERR_STATE *es; crypto/err/err.c:936:1: Parameter `clear` 934. #endif 935. 936. > void err_clear_last_constant_time(int clear) 937. { 938. ERR_STATE *es; crypto/err/err.c:948:5: Binary operation: (0 - [0, 1]):unsigned64 by call to `err_clear_last_constant_time` 946. 947. es->err_flags[top] &= ~(0 - clear); 948. es->err_buffer[top] &= ~(0UL - clear); ^ 949. es->err_file[top] = (const char *)((UINTPTR_T)es->err_file[top] & 950. ~((UINTPTR_T)0 - clear));
https://github.com/openssl/openssl/blob/4c2883a9bf59c5ee31e8e2e101b3894a16c06950/crypto/err/err.c/#L948
d2a_code_trace_data_43623
static inline int w_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int w, int h, int type){ int s, i, j; const int dec_count= w==8 ? 3 : 4; int tmp[32*32]; int level, ori; static const int scale[2][2][4][4]={ { { {268, 239, 239, 213}, { 0, 224, 224, 152}, { 0, 135, 135, 110}, },{ {344, 310, 310, 280}, { 0, 320, 320, 228}, { 0, 175, 175, 136}, { 0, 129, 129, 102}, } },{ { {275, 245, 245, 218}, { 0, 230, 230, 156}, { 0, 138, 138, 113}, },{ {352, 317, 317, 286}, { 0, 328, 328, 233}, { 0, 180, 180, 140}, { 0, 132, 132, 105}, } } }; for (i = 0; i < h; i++) { for (j = 0; j < w; j+=4) { tmp[32*i+j+0] = (pix1[j+0] - pix2[j+0])<<4; tmp[32*i+j+1] = (pix1[j+1] - pix2[j+1])<<4; tmp[32*i+j+2] = (pix1[j+2] - pix2[j+2])<<4; tmp[32*i+j+3] = (pix1[j+3] - pix2[j+3])<<4; } pix1 += line_size; pix2 += line_size; } ff_spatial_dwt(tmp, w, h, 32, type, dec_count); s=0; assert(w==h); for(level=0; level<dec_count; level++){ for(ori= level ? 1 : 0; ori<4; ori++){ int size= w>>(dec_count-level); int sx= (ori&1) ? size : 0; int stride= 32<<(dec_count-level); int sy= (ori&2) ? stride>>1 : 0; for(i=0; i<size; i++){ for(j=0; j<size; j++){ int v= tmp[sx + sy + i*stride + j] * scale[type][dec_count-3][level][ori]; s += FFABS(v); } } } } assert(s>=0); return s>>9; } libavcodec/snow.c:2848: error: Buffer Overrun L2 Offset: [3, 1026] Size: 1024 by call to `w97_32_c`. libavcodec/snow.c:2848:26: Call 2846. * estimation does not always converge. */ 2847. if(s->avctx->me_cmp == FF_CMP_W97) 2848. distortion = w97_32_c(&s->m, src + sx + sy*ref_stride, dst + sx + sy*ref_stride, ref_stride, 32); ^ 2849. else if(s->avctx->me_cmp == FF_CMP_W53) 2850. distortion = w53_32_c(&s->m, src + sx + sy*ref_stride, dst + sx + sy*ref_stride, ref_stride, 32); libavcodec/dsputil.c:425:1: Parameter `h` 423. } 424. 425. int w97_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){ ^ 426. return w_c(v, pix1, pix2, line_size, 32, h, 0); 427. } libavcodec/dsputil.c:426:12: Call 424. 425. int w97_32_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int h){ 426. return w_c(v, pix1, pix2, line_size, 32, h, 0); ^ 427. } 428. #endif libavcodec/dsputil.c:336:1: <Offset trace> 334. 335. #ifdef CONFIG_SNOW_ENCODER //dwt is in snow.c 336. static inline int w_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int w, int h, int type){ ^ 337. int s, i, j; 338. const int dec_count= w==8 ? 3 : 4; libavcodec/dsputil.c:336:1: Parameter `w` 334. 335. #ifdef CONFIG_SNOW_ENCODER //dwt is in snow.c 336. static inline int w_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int w, int h, int type){ ^ 337. int s, i, j; 338. const int dec_count= w==8 ? 3 : 4; libavcodec/dsputil.c:336:1: <Length trace> 334. 335. #ifdef CONFIG_SNOW_ENCODER //dwt is in snow.c 336. static inline int w_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int w, int h, int type){ ^ 337. int s, i, j; 338. const int dec_count= w==8 ? 3 : 4; libavcodec/dsputil.c:336:1: Array declaration 334. 335. #ifdef CONFIG_SNOW_ENCODER //dwt is in snow.c 336. static inline int w_c(void *v, uint8_t * pix1, uint8_t * pix2, int line_size, int w, int h, int type){ ^ 337. int s, i, j; 338. const int dec_count= w==8 ? 3 : 4; libavcodec/dsputil.c:376:13: Array access: Offset: [3, 1026] Size: 1024 by call to `w97_32_c` 374. tmp[32*i+j+1] = (pix1[j+1] - pix2[j+1])<<4; 375. tmp[32*i+j+2] = (pix1[j+2] - pix2[j+2])<<4; 376. tmp[32*i+j+3] = (pix1[j+3] - pix2[j+3])<<4; ^ 377. } 378. pix1 += line_size;
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/dsputil.c/#L376
d2a_code_trace_data_43624
void ngx_slab_free_locked(ngx_slab_pool_t *pool, void *p) { size_t size; uintptr_t slab, m, *bitmap; ngx_uint_t n, type, slot, shift, map; ngx_slab_page_t *slots, *page; ngx_log_debug1(NGX_LOG_DEBUG_ALLOC, ngx_cycle->log, 0, "slab free: %p", p); if ((u_char *) p < pool->start || (u_char *) p > pool->end) { ngx_slab_error(pool, NGX_LOG_ALERT, "ngx_slab_free(): outside of pool"); goto fail; } n = ((u_char *) p - pool->start) >> ngx_pagesize_shift; page = &pool->pages[n]; slab = page->slab; type = page->prev & NGX_SLAB_PAGE_MASK; switch (type) { case NGX_SLAB_SMALL: shift = slab & NGX_SLAB_SHIFT_MASK; size = 1 << shift; if ((uintptr_t) p & (size - 1)) { goto wrong_chunk; } n = ((uintptr_t) p & (ngx_pagesize - 1)) >> shift; m = (uintptr_t) 1 << (n & (sizeof(uintptr_t) * 8 - 1)); n /= (sizeof(uintptr_t) * 8); bitmap = (uintptr_t *) ((uintptr_t) p & ~(ngx_pagesize - 1)); if (bitmap[n] & m) { if (page->next == NULL) { slots = (ngx_slab_page_t *) ((u_char *) pool + sizeof(ngx_slab_pool_t)); slot = shift - pool->min_shift; page->next = slots[slot].next; slots[slot].next = page; page->prev = (uintptr_t) &slots[slot] | NGX_SLAB_SMALL; page->next->prev = (uintptr_t) page | NGX_SLAB_SMALL; } bitmap[n] &= ~m; n = (1 << (ngx_pagesize_shift - shift)) / 8 / (1 << shift); if (n == 0) { n = 1; } if (bitmap[0] & ~(((uintptr_t) 1 << n) - 1)) { goto done; } map = (1 << (ngx_pagesize_shift - shift)) / (sizeof(uintptr_t) * 8); for (n = 1; n < map; n++) { if (bitmap[n]) { goto done; } } ngx_slab_free_pages(pool, page, 1); goto done; } goto chunk_already_free; case NGX_SLAB_EXACT: m = (uintptr_t) 1 << (((uintptr_t) p & (ngx_pagesize - 1)) >> ngx_slab_exact_shift); size = ngx_slab_exact_size; if ((uintptr_t) p & (size - 1)) { goto wrong_chunk; } if (slab & m) { if (slab == NGX_SLAB_BUSY) { slots = (ngx_slab_page_t *) ((u_char *) pool + sizeof(ngx_slab_pool_t)); slot = ngx_slab_exact_shift - pool->min_shift; page->next = slots[slot].next; slots[slot].next = page; page->prev = (uintptr_t) &slots[slot] | NGX_SLAB_EXACT; page->next->prev = (uintptr_t) page | NGX_SLAB_EXACT; } page->slab &= ~m; if (page->slab) { goto done; } ngx_slab_free_pages(pool, page, 1); goto done; } goto chunk_already_free; case NGX_SLAB_BIG: shift = slab & NGX_SLAB_SHIFT_MASK; size = 1 << shift; if ((uintptr_t) p & (size - 1)) { goto wrong_chunk; } m = (uintptr_t) 1 << ((((uintptr_t) p & (ngx_pagesize - 1)) >> shift) + NGX_SLAB_MAP_SHIFT); if (slab & m) { if (page->next == NULL) { slots = (ngx_slab_page_t *) ((u_char *) pool + sizeof(ngx_slab_pool_t)); slot = shift - pool->min_shift; page->next = slots[slot].next; slots[slot].next = page; page->prev = (uintptr_t) &slots[slot] | NGX_SLAB_BIG; page->next->prev = (uintptr_t) page | NGX_SLAB_BIG; } page->slab &= ~m; if (page->slab & NGX_SLAB_MAP_MASK) { goto done; } ngx_slab_free_pages(pool, page, 1); goto done; } goto chunk_already_free; case NGX_SLAB_PAGE: if ((uintptr_t) p & (ngx_pagesize - 1)) { goto wrong_chunk; } if (slab == NGX_SLAB_PAGE_FREE) { ngx_slab_error(pool, NGX_LOG_ALERT, "ngx_slab_free(): page is already free"); goto fail; } if (slab == NGX_SLAB_PAGE_BUSY) { ngx_slab_error(pool, NGX_LOG_ALERT, "ngx_slab_free(): pointer to wrong page"); goto fail; } n = ((u_char *) p - pool->start) >> ngx_pagesize_shift; size = slab & ~NGX_SLAB_PAGE_START; ngx_slab_free_pages(pool, &pool->pages[n], size); ngx_slab_junk(p, size << ngx_pagesize_shift); return; } return; done: ngx_slab_junk(p, size); return; wrong_chunk: ngx_slab_error(pool, NGX_LOG_ALERT, "ngx_slab_free(): pointer to wrong chunk"); goto fail; chunk_already_free: ngx_slab_error(pool, NGX_LOG_ALERT, "ngx_slab_free(): chunk is already free"); fail: return; } src/http/ngx_http_file_cache.c:998: error: Integer Overflow L2 ([0, +oo] - [0, 15]):unsigned64 by call to `ngx_slab_free_locked`. src/http/ngx_http_file_cache.c:998:5: Call 996. ngx_rbtree_delete(cache->rbtree, &fcn->node); 997. 998. ngx_slab_free_locked(cache->shpool, fcn); ^ 999. 1000. ngx_shmtx_unlock(&cache->shpool->mutex); src/core/ngx_slab.c:412:1: <LHS trace> 410. 411. 412. void ^ 413. ngx_slab_free_locked(ngx_slab_pool_t *pool, void *p) 414. { src/core/ngx_slab.c:412:1: Global `ngx_pagesize_shift` 410. 411. 412. void ^ 413. ngx_slab_free_locked(ngx_slab_pool_t *pool, void *p) 414. { src/core/ngx_slab.c:412:1: <RHS trace> 410. 411. 412. void ^ 413. ngx_slab_free_locked(ngx_slab_pool_t *pool, void *p) 414. { src/core/ngx_slab.c:412:1: Parameter `pool->pages->slab` 410. 411. 412. void ^ 413. ngx_slab_free_locked(ngx_slab_pool_t *pool, void *p) 414. { src/core/ngx_slab.c:429:5: Assignment 427. n = ((u_char *) p - pool->start) >> ngx_pagesize_shift; 428. page = &pool->pages[n]; 429. slab = page->slab; ^ 430. type = page->prev & NGX_SLAB_PAGE_MASK; 431. src/core/ngx_slab.c:436:9: Assignment 434. case NGX_SLAB_SMALL: 435. 436. shift = slab & NGX_SLAB_SHIFT_MASK; ^ 437. size = 1 << shift; 438. src/core/ngx_slab.c:464:13: Binary operation: ([0, +oo] - [0, 15]):unsigned64 by call to `ngx_slab_free_locked` 462. bitmap[n] &= ~m; 463. 464. n = (1 << (ngx_pagesize_shift - shift)) / 8 / (1 << shift); ^ 465. 466. if (n == 0) {
https://github.com/nginx/nginx/blob/e4ecddfdb0d2ffc872658e36028971ad9a873726/src/core/ngx_slab.c/#L464
d2a_code_trace_data_43625
void ssl3_cbc_copy_mac(unsigned char *out, const SSL3_RECORD *rec, unsigned md_size) { #if defined(CBC_MAC_ROTATE_IN_PLACE) unsigned char rotated_mac_buf[64 + EVP_MAX_MD_SIZE]; unsigned char *rotated_mac; #else unsigned char rotated_mac[EVP_MAX_MD_SIZE]; #endif unsigned mac_end = rec->length; unsigned mac_start = mac_end - md_size; unsigned scan_start = 0; unsigned i, j; unsigned div_spoiler; unsigned rotate_offset; OPENSSL_assert(rec->orig_len >= md_size); OPENSSL_assert(md_size <= EVP_MAX_MD_SIZE); #if defined(CBC_MAC_ROTATE_IN_PLACE) rotated_mac = rotated_mac_buf + ((0 - (size_t)rotated_mac_buf) & 63); #endif if (rec->orig_len > md_size + 255 + 1) scan_start = rec->orig_len - (md_size + 255 + 1); div_spoiler = md_size >> 1; div_spoiler <<= (sizeof(div_spoiler) - 1) * 8; rotate_offset = (div_spoiler + mac_start - scan_start) % md_size; memset(rotated_mac, 0, md_size); for (i = scan_start, j = 0; i < rec->orig_len; i++) { unsigned char mac_started = constant_time_ge_8(i, mac_start); unsigned char mac_ended = constant_time_ge_8(i, mac_end); unsigned char b = rec->data[i]; rotated_mac[j++] |= b & mac_started & ~mac_ended; j &= constant_time_lt(j, md_size); } #if defined(CBC_MAC_ROTATE_IN_PLACE) j = 0; for (i = 0; i < md_size; i++) { ((volatile unsigned char *)rotated_mac)[rotate_offset ^ 32]; out[j++] = rotated_mac[rotate_offset++]; rotate_offset &= constant_time_lt(rotate_offset, md_size); } #else memset(out, 0, md_size); rotate_offset = md_size - rotate_offset; rotate_offset &= constant_time_lt(rotate_offset, md_size); for (i = 0; i < md_size; i++) { for (j = 0; j < md_size; j++) out[j] |= rotated_mac[i] & constant_time_eq_8(j, rotate_offset); rotate_offset++; rotate_offset &= constant_time_lt(rotate_offset, md_size); } #endif } ssl/record/ssl3_record.c:424: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [256, 320]):unsigned32 by call to `ssl3_cbc_copy_mac`. Showing all 8 steps of the trace ssl/record/ssl3_record.c:126:1: Parameter `s->rlayer.rrec.length` 124. */ 125. /* used only by ssl3_read_bytes */ 126. > int ssl3_get_record(SSL *s) 127. { 128. int ssl_major, ssl_minor, al; ssl/record/ssl3_record.c:323:9: Assignment 321. /* decrypt in place in 'rr->input' */ 322. rr[num_recs].data = rr[num_recs].input; 323. rr[num_recs].orig_len = rr[num_recs].length; ^ 324. 325. /* Mark this record as not read by upper layers yet */ ssl/record/ssl3_record.c:424:17: Call 422. */ 423. mac = mac_tmp; 424. ssl3_cbc_copy_mac(mac_tmp, &rr[j], mac_size); ^ 425. rr[j].length -= mac_size; 426. } else { ssl/record/ssl3_record.c:1187:1: <LHS trace> 1185. #define CBC_MAC_ROTATE_IN_PLACE 1186. 1187. > void ssl3_cbc_copy_mac(unsigned char *out, 1188. const SSL3_RECORD *rec, unsigned md_size) 1189. { ssl/record/ssl3_record.c:1187:1: Parameter `md_size` 1185. #define CBC_MAC_ROTATE_IN_PLACE 1186. 1187. > void ssl3_cbc_copy_mac(unsigned char *out, 1188. const SSL3_RECORD *rec, unsigned md_size) 1189. { ssl/record/ssl3_record.c:1187:1: <RHS trace> 1185. #define CBC_MAC_ROTATE_IN_PLACE 1186. 1187. > void ssl3_cbc_copy_mac(unsigned char *out, 1188. const SSL3_RECORD *rec, unsigned md_size) 1189. { ssl/record/ssl3_record.c:1187:1: Parameter `md_size` 1185. #define CBC_MAC_ROTATE_IN_PLACE 1186. 1187. > void ssl3_cbc_copy_mac(unsigned char *out, 1188. const SSL3_RECORD *rec, unsigned md_size) 1189. { ssl/record/ssl3_record.c:1220:9: Binary operation: ([0, +oo] - [256, 320]):unsigned32 by call to `ssl3_cbc_copy_mac` 1218. /* This information is public so it's safe to branch based on it. */ 1219. if (rec->orig_len > md_size + 255 + 1) 1220. scan_start = rec->orig_len - (md_size + 255 + 1); ^ 1221. /* 1222. * div_spoiler contains a multiple of md_size that is used to cause the
https://github.com/openssl/openssl/blob/2a7de0fd5d9baf946ef4d2c51096b04dd47a8143/ssl/record/ssl3_record.c/#L1220
d2a_code_trace_data_43626
int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) { int line_size; int sample_size = av_get_bytes_per_sample(sample_fmt); int planar = av_sample_fmt_is_planar(sample_fmt); if (!sample_size || nb_samples <= 0 || nb_channels <= 0) return AVERROR(EINVAL); if (!align) { if (nb_samples > INT_MAX - 31) return AVERROR(EINVAL); align = 1; nb_samples = FFALIGN(nb_samples, 32); } if (nb_channels > INT_MAX / align || (int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size) return AVERROR(EINVAL); line_size = planar ? FFALIGN(nb_samples * sample_size, align) : FFALIGN(nb_samples * sample_size * nb_channels, align); if (linesize) *linesize = line_size; return planar ? line_size * nb_channels : line_size; } libavcodec/takdec.c:754: error: Integer Overflow L2 ([1, 2147483616] + 32):signed32 by call to `av_samples_fill_arrays`. libavcodec/takdec.c:684:16: Call 682. init_get_bits(gb, pkt->data, pkt->size * 8); 683. 684. if ((ret = ff_tak_decode_frame_header(avctx, gb, &s->ti, 0)) < 0) ^ 685. return ret; 686. libavcodec/tak.c:121:1: Parameter `ti->frame_samples` 119. } 120. 121. int ff_tak_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb, ^ 122. TAKStreamInfo *ti, int log_level_offset) 123. { libavcodec/takdec.c:740:21: Assignment 738. avctx->channels = s->ti.channels; 739. 740. s->nb_samples = s->ti.last_frame_samples ? s->ti.last_frame_samples ^ 741. : s->ti.frame_samples; 742. libavcodec/takdec.c:740:5: Assignment 738. avctx->channels = s->ti.channels; 739. 740. s->nb_samples = s->ti.last_frame_samples ? s->ti.last_frame_samples ^ 741. : s->ti.frame_samples; 742. libavcodec/takdec.c:754:15: Call 752. if (!s->decode_buffer) 753. return AVERROR(ENOMEM); 754. ret = av_samples_fill_arrays((uint8_t **)s->decoded, NULL, ^ 755. s->decode_buffer, avctx->channels, 756. s->nb_samples, AV_SAMPLE_FMT_S32P, 0); libavutil/samplefmt.c:140:1: Parameter `nb_samples` 138. } 139. 140. int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, ^ 141. const uint8_t *buf, int nb_channels, int nb_samples, 142. enum AVSampleFormat sample_fmt, int align) libavutil/samplefmt.c:147:16: Call 145. 146. planar = av_sample_fmt_is_planar(sample_fmt); 147. buf_size = av_samples_get_buffer_size(&line_size, nb_channels, nb_samples, ^ 148. sample_fmt, align); 149. if (buf_size < 0) libavutil/samplefmt.c:108:1: <LHS trace> 106. } 107. 108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, ^ 109. enum AVSampleFormat sample_fmt, int align) 110. { libavutil/samplefmt.c:108:1: Parameter `nb_samples` 106. } 107. 108. int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, ^ 109. enum AVSampleFormat sample_fmt, int align) 110. { libavutil/samplefmt.c:124:9: Binary operation: ([1, 2147483616] + 32):signed32 by call to `av_samples_fill_arrays` 122. return AVERROR(EINVAL); 123. align = 1; 124. nb_samples = FFALIGN(nb_samples, 32); ^ 125. } 126.
https://github.com/libav/libav/blob/0e830094ad0dc251613a0aa3234d9c5c397e02e6/libavutil/samplefmt.c/#L124
d2a_code_trace_data_43627
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:1057: error: BUFFER_OVERRUN_L2 Offset added: [0, 17179869176] Size: [0, 67108856] by call to `BN_lshift`. Showing all 13 steps of the trace test/bntest.c:1051:5: Assignment 1049. BIGNUM *lshift = getBN(s, "LShift"); 1050. BIGNUM *ret = BN_new(); 1051. int n = 0; ^ 1052. int st = 0; 1053. test/bntest.c:1054:56: Call 1052. int st = 0; 1053. 1054. if (a == NULL || lshift == NULL || ret == NULL || !getint(s, &n, "N")) ^ 1055. goto err; 1056. test/bntest.c:122:1: Parameter `*out` 120. } 121. 122. > static int getint(STANZA *s, int *out, const char *attribute) 123. { 124. BIGNUM *ret = getBN(s, attribute); test/bntest.c:1057:10: Call 1055. goto err; 1056. 1057. if (!BN_lshift(ret, a, n) ^ 1058. || !equalBN("A << N", lshift, ret) 1059. || !BN_rshift(ret, lshift, n) 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:113:5: Array access: Offset added: [0, 17179869176] Size: [0, 67108856] by call to `BN_lshift` 111. t[nw + i] = (l << lb) & BN_MASK2; 112. } 113. memset(t, 0, sizeof(*t) * nw); ^ 114. r->top = a->top + nw + 1; 115. bn_correct_top(r);
https://github.com/openssl/openssl/blob/0282aeb690d63fab73a07191b63300a2fe30d212/crypto/bn/bn_shift.c/#L113
d2a_code_trace_data_43628
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_exp.c:1380: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul`. Showing all 30 steps of the trace crypto/bn/bn_exp.c:1277:1: Parameter `ctx->stack.depth` 1275. 1276. /* The old fallback, simple version :-) */ 1277. > int BN_mod_exp_simple(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, 1278. const BIGNUM *m, BN_CTX *ctx) 1279. { crypto/bn/bn_exp.c:1306:5: Call 1304. } 1305. 1306. BN_CTX_start(ctx); ^ 1307. d = BN_CTX_get(ctx); 1308. val[0] = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_exp.c:1307:9: Call 1305. 1306. BN_CTX_start(ctx); 1307. d = BN_CTX_get(ctx); ^ 1308. val[0] = BN_CTX_get(ctx); 1309. if (val[0] == NULL) crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_exp.c:1308:14: Call 1306. BN_CTX_start(ctx); 1307. d = BN_CTX_get(ctx); 1308. val[0] = BN_CTX_get(ctx); ^ 1309. if (val[0] == NULL) 1310. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_exp.c:1312:10: Call 1310. goto err; 1311. 1312. if (!BN_nnmod(val[0], a, m, ctx)) ^ 1313. goto err; /* 1 */ 1314. if (BN_is_zero(val[0])) { crypto/bn/bn_mod.c:13:1: Parameter `ctx->stack.depth` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:209:1: Parameter `ctx->stack.depth` 207. * If 'dv' or 'rm' is NULL, the respective value is not returned. 208. */ 209. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 210. BN_CTX *ctx) 211. { crypto/bn/bn_exp.c:1380:14: Call 1378. 1379. /* wvalue will be an odd number < 2^window */ 1380. if (!BN_mod_mul(r, r, val[wvalue >> 1], m, ctx)) ^ 1381. goto err; 1382. crypto/bn/bn_mod.c:193:1: Parameter `ctx->stack.depth` 191. 192. /* slow but works */ 193. > int BN_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const BIGNUM *m, 194. BN_CTX *ctx) 195. { crypto/bn/bn_mod.c:203:5: Call 201. bn_check_top(m); 202. 203. BN_CTX_start(ctx); ^ 204. if ((t = BN_CTX_get(ctx)) == NULL) 205. goto err; crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_mod.c:204:14: Call 202. 203. BN_CTX_start(ctx); 204. if ((t = BN_CTX_get(ctx)) == NULL) ^ 205. goto err; 206. if (a == b) { crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_mod.c:207:14: Call 205. goto err; 206. if (a == b) { 207. if (!BN_sqr(t, a, ctx)) ^ 208. goto err; 209. } else { crypto/bn/bn_sqr.c:17:1: Parameter `ctx->stack.depth` 15. * I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 16. */ 17. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int ret = bn_sqr_fixed_top(r, a, ctx); crypto/bn/bn_sqr.c:19:15: Call 17. int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx) 18. { 19. int ret = bn_sqr_fixed_top(r, a, ctx); ^ 20. 21. bn_correct_top(r); crypto/bn/bn_sqr.c:42:5: Call 40. } 41. 42. BN_CTX_start(ctx); ^ 43. rr = (a != r) ? r : BN_CTX_get(ctx); 44. tmp = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_sqr.c:104:5: Call 102. bn_check_top(rr); 103. bn_check_top(tmp); 104. BN_CTX_end(ctx); ^ 105. return ret; 106. } crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_mod_mul` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_43629
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/rsa/rsa_sp800_56b_gen.c:130: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end`. Showing all 9 steps of the trace crypto/rsa/rsa_sp800_56b_gen.c:51:1: Parameter `ctx->stack.depth` 49. * (Required for CAVS testing). 50. */ 51. > int rsa_fips186_4_gen_prob_primes(RSA *rsa, BIGNUM *p1, BIGNUM *p2, 52. BIGNUM *Xpout, const BIGNUM *Xp, 53. const BIGNUM *Xp1, const BIGNUM *Xp2, crypto/rsa/rsa_sp800_56b_gen.c:82:5: Call 80. */ 81. 82. BN_CTX_start(ctx); ^ 83. tmp = BN_CTX_get(ctx); 84. Xpo = (Xpout != NULL) ? Xpout : BN_CTX_get(ctx); crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/rsa/rsa_sp800_56b_gen.c:130:5: Call 128. BN_clear(tmp); 129. 130. BN_CTX_end(ctx); ^ 131. return ret; 132. } crypto/bn/bn_ctx.c:185:1: Parameter `ctx->stack.depth` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. if (ctx == NULL) crypto/bn/bn_ctx.c:193:27: Call 191. ctx->err_stack--; 192. else { 193. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 194. /* Does this stack frame have anything to release? */ 195. if (fp < ctx->used) crypto/bn/bn_ctx.c:268:1: <LHS trace> 266. } 267. 268. > static unsigned int BN_STACK_pop(BN_STACK *st) 269. { 270. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:1: Parameter `st->depth` 266. } 267. 268. > static unsigned int BN_STACK_pop(BN_STACK *st) 269. { 270. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:270:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_CTX_end` 268. static unsigned int BN_STACK_pop(BN_STACK *st) 269. { 270. return st->indexes[--(st->depth)]; ^ 271. } 272.
https://github.com/openssl/openssl/blob/cd353c7768e7f1dfdfe369be900666241ddedefb/crypto/bn/bn_ctx.c/#L270
d2a_code_trace_data_43630
void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb) { BN_ULONG *rr; if (na < nb) { int itmp; BN_ULONG *ltmp; itmp = na; na = nb; nb = itmp; ltmp = a; a = b; b = ltmp; } rr = &(r[na]); if (nb <= 0) { (void)bn_mul_words(r, a, na, 0); return; } else rr[0] = bn_mul_words(r, a, na, b[0]); for (;;) { if (--nb <= 0) return; rr[1] = bn_mul_add_words(&(r[1]), a, na, b[1]); if (--nb <= 0) return; rr[2] = bn_mul_add_words(&(r[2]), a, na, b[2]); if (--nb <= 0) return; rr[3] = bn_mul_add_words(&(r[3]), a, na, b[3]); if (--nb <= 0) return; rr[4] = bn_mul_add_words(&(r[4]), a, na, b[4]); rr += 4; r += 4; b += 4; } } test/bntest.c:1795: error: BUFFER_OVERRUN_L3 Offset: [4, +oo] (⇐ [0, +oo] + 4) Size: [0, 8388607] by call to `BN_mul`. Showing all 12 steps of the trace test/bntest.c:1791:10: Call 1789. 1790. /* Test that BN_mul never gives negative zero. */ 1791. if (!TEST_true(BN_set_word(a, 1))) ^ 1792. goto err; 1793. BN_set_negative(a, 1); crypto/bn/bn_lib.c:395:1: Parameter `*a->d` 393. } 394. 395. > int BN_set_word(BIGNUM *a, BN_ULONG w) 396. { 397. bn_check_top(a); crypto/bn/bn_lib.c:398:9: Call 396. { 397. bn_check_top(a); 398. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 399. return (0); 400. a->neg = 0; crypto/bn/bn_lcl.h:660:1: Parameter `*a->d` 658. const BIGNUM *add, const BIGNUM *rem, BN_CTX *ctx); 659. 660. > static ossl_inline BIGNUM *bn_expand(BIGNUM *a, int bits) 661. { 662. if (bits > (INT_MAX - BN_BITS2 + 1)) test/bntest.c:1795:10: Call 1793. BN_set_negative(a, 1); 1794. BN_zero(b); 1795. if (!TEST_true(BN_mul(c, a, b, ctx))) ^ 1796. goto err; 1797. if (!TEST_BN_eq_zero(c) crypto/bn/bn_mul.c:495:1: Parameter `*b->d` 493. #endif /* BN_RECURSION */ 494. 495. > int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) 496. { 497. int ret = 0; crypto/bn/bn_mul.c:575:17: Call 573. if (bn_wexpand(rr, k * 4) == NULL) 574. goto err; 575. bn_mul_part_recursive(rr->d, a->d, b->d, ^ 576. j, al - j, bl - j, t->d); 577. } else { /* al <= j || bl <= j */ crypto/bn/bn_mul.c:320:1: Parameter `*b` 318. */ 319. /* tnX may not be negative but less than n */ 320. > void bn_mul_part_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n, 321. int tna, int tnb, BN_ULONG *t) 322. { crypto/bn/bn_mul.c:328:9: Call 326. 327. if (n < 8) { 328. bn_mul_normal(r, a, n + tna, b, n + tnb); ^ 329. return; 330. } crypto/bn/bn_mul.c:650:1: <Length trace> 648. } 649. 650. > void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb) 651. { 652. BN_ULONG *rr; crypto/bn/bn_mul.c:650:1: Parameter `*b` 648. } 649. 650. > void bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb) 651. { 652. BN_ULONG *rr; crypto/bn/bn_mul.c:685:50: Array access: Offset: [4, +oo] (⇐ [0, +oo] + 4) Size: [0, 8388607] by call to `BN_mul` 683. if (--nb <= 0) 684. return; 685. rr[4] = bn_mul_add_words(&(r[4]), a, na, b[4]); ^ 686. rr += 4; 687. r += 4;
https://github.com/openssl/openssl/blob/3f97052392cb10fca5309212bf720685262ad4a6/crypto/bn/bn_mul.c/#L685
d2a_code_trace_data_43631
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } test/bntest.c:802: error: BUFFER_OVERRUN_L3 Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_div`. Showing all 43 steps of the trace test/bntest.c:802:13: Call 800. BN_bntest_rand(c, 512, 0, 0); 801. for (j = 0; j < 2; j++) { 802. BN_GF2m_mod_div(d, a, c, b[j], ctx); ^ 803. BN_GF2m_mod_mul(e, d, c, b[j], ctx); 804. BN_GF2m_mod_div(f, a, e, b[j], ctx); crypto/bn/bn_gf2m.c:790:1: Parameter `ctx->stack.depth` 788. * or y, x could equal y. 789. */ 790. > int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *y, const BIGNUM *x, 791. const BIGNUM *p, BN_CTX *ctx) 792. { crypto/bn/bn_gf2m.c:800:5: Call 798. bn_check_top(p); 799. 800. BN_CTX_start(ctx); ^ 801. xinv = BN_CTX_get(ctx); 802. if (xinv == NULL) crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gf2m.c:801:12: Call 799. 800. BN_CTX_start(ctx); 801. xinv = BN_CTX_get(ctx); ^ 802. if (xinv == NULL) 803. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gf2m.c:813:5: Call 811. 812. err: 813. BN_CTX_end(ctx); ^ 814. return ret; 815. } 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); test/bntest.c:803:13: Call 801. for (j = 0; j < 2; j++) { 802. BN_GF2m_mod_div(d, a, c, b[j], ctx); 803. BN_GF2m_mod_mul(e, d, c, b[j], ctx); ^ 804. BN_GF2m_mod_div(f, a, e, b[j], ctx); 805. /* Test that ((a/c)*c)/a = 1. */ crypto/bn/bn_gf2m.c:465:1: Parameter `ctx->stack.depth` 463. * BN_GF2m_mod_mul_arr function. 464. */ 465. > int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 466. const BIGNUM *p, BN_CTX *ctx) 467. { test/bntest.c:804:13: Call 802. BN_GF2m_mod_div(d, a, c, b[j], ctx); 803. BN_GF2m_mod_mul(e, d, c, b[j], ctx); 804. BN_GF2m_mod_div(f, a, e, b[j], ctx); ^ 805. /* Test that ((a/c)*c)/a = 1. */ 806. if (!TEST_BN_eq_one(f)) crypto/bn/bn_gf2m.c:790:1: Parameter `ctx->stack.depth` 788. * or y, x could equal y. 789. */ 790. > int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *y, const BIGNUM *x, 791. const BIGNUM *p, BN_CTX *ctx) 792. { crypto/bn/bn_gf2m.c:800:5: Call 798. bn_check_top(p); 799. 800. BN_CTX_start(ctx); ^ 801. xinv = BN_CTX_get(ctx); 802. if (xinv == NULL) crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gf2m.c:801:12: Call 799. 800. BN_CTX_start(ctx); 801. xinv = BN_CTX_get(ctx); ^ 802. if (xinv == NULL) 803. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gf2m.c:813:5: Call 811. 812. err: 813. BN_CTX_end(ctx); ^ 814. return ret; 815. } 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); test/bntest.c:802:13: Call 800. BN_bntest_rand(c, 512, 0, 0); 801. for (j = 0; j < 2; j++) { 802. BN_GF2m_mod_div(d, a, c, b[j], ctx); ^ 803. BN_GF2m_mod_mul(e, d, c, b[j], ctx); 804. BN_GF2m_mod_div(f, a, e, b[j], ctx); crypto/bn/bn_gf2m.c:790:1: Parameter `ctx->stack.depth` 788. * or y, x could equal y. 789. */ 790. > int BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *y, const BIGNUM *x, 791. const BIGNUM *p, BN_CTX *ctx) 792. { crypto/bn/bn_gf2m.c:800:5: Call 798. bn_check_top(p); 799. 800. BN_CTX_start(ctx); ^ 801. xinv = BN_CTX_get(ctx); 802. if (xinv == NULL) crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gf2m.c:801:12: Call 799. 800. BN_CTX_start(ctx); 801. xinv = BN_CTX_get(ctx); ^ 802. if (xinv == NULL) 803. goto err; crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gf2m.c:805:10: Call 803. goto err; 804. 805. if (!BN_GF2m_mod_inv(xinv, x, p, ctx)) ^ 806. goto err; 807. if (!BN_GF2m_mod_mul(r, y, xinv, p, ctx)) crypto/bn/bn_gf2m.c:724:1: Parameter `ctx->stack.depth` 722. * But it does eliminate first order deduction on the input. 723. */ 724. > int BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) 725. { 726. BIGNUM *b = NULL; crypto/bn/bn_gf2m.c:729:5: Call 727. int ret = 0; 728. 729. BN_CTX_start(ctx); ^ 730. if ((b = BN_CTX_get(ctx)) == NULL) 731. goto err; crypto/bn/bn_ctx.c:171:1: Parameter `ctx->stack.depth` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gf2m.c:730:14: Call 728. 729. BN_CTX_start(ctx); 730. if ((b = BN_CTX_get(ctx)) == NULL) ^ 731. goto err; 732. crypto/bn/bn_ctx.c:202:1: Parameter `ctx->stack.depth` 200. } 201. 202. > BIGNUM *BN_CTX_get(BN_CTX *ctx) 203. { 204. BIGNUM *ret; crypto/bn/bn_gf2m.c:741:10: Call 739. 740. /* r := a * b */ 741. if (!BN_GF2m_mod_mul(r, a, b, p, ctx)) ^ 742. goto err; 743. crypto/bn/bn_gf2m.c:465:1: Parameter `ctx->stack.depth` 463. * BN_GF2m_mod_mul_arr function. 464. */ 465. > int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, 466. const BIGNUM *p, BN_CTX *ctx) 467. { crypto/bn/bn_gf2m.c:481:11: Call 479. goto err; 480. } 481. ret = BN_GF2m_mod_mul_arr(r, a, b, arr, ctx); ^ 482. bn_check_top(r); 483. err: crypto/bn/bn_gf2m.c:424:5: Call 422. } 423. 424. BN_CTX_start(ctx); ^ 425. if ((s = BN_CTX_get(ctx)) == NULL) 426. goto err; crypto/bn/bn_ctx.c:171:1: Parameter `*ctx->stack.indexes` 169. } 170. 171. > void BN_CTX_start(BN_CTX *ctx) 172. { 173. CTXDBG("ENTER BN_CTX_start()", ctx); crypto/bn/bn_gf2m.c:454:5: Call 452. 453. err: 454. BN_CTX_end(ctx); ^ 455. return ret; 456. } crypto/bn/bn_ctx.c:185:1: Parameter `*ctx->stack.indexes` 183. } 184. 185. > void BN_CTX_end(BN_CTX *ctx) 186. { 187. CTXDBG("ENTER BN_CTX_end()", ctx); crypto/bn/bn_ctx.c:191:27: Call 189. ctx->err_stack--; 190. else { 191. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 192. /* Does this stack frame have anything to release? */ 193. if (fp < ctx->used) crypto/bn/bn_ctx.c:266:1: <Offset trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `st->depth` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: <Length trace> 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:266:1: Parameter `*st->indexes` 264. } 265. 266. > static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:268:12: Array access: Offset: [-1, +oo] Size: [1, +oo] by call to `BN_GF2m_mod_div` 266. static unsigned int BN_STACK_pop(BN_STACK *st) 267. { 268. return st->indexes[--(st->depth)]; ^ 269. } 270.
https://github.com/openssl/openssl/blob/18e1e302452e6dea4500b6f981cee7e151294dea/crypto/bn/bn_ctx.c/#L268
d2a_code_trace_data_43632
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/ec/ec_lib.c:997: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set`. Showing all 24 steps of the trace crypto/ec/ec_lib.c:997:10: Call 995. goto err; 996. 997. if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)) { ^ 998. BN_MONT_CTX_free(group->mont_data); 999. group->mont_data = NULL; crypto/bn/bn_mont.c:348:1: Parameter `ctx->stack.depth` 346. } 347. 348. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) 349. { 350. int ret = 0; crypto/bn/bn_mont.c:356:5: Call 354. return 0; 355. 356. BN_CTX_start(ctx); ^ 357. if ((Ri = BN_CTX_get(ctx)) == NULL) 358. goto err; crypto/bn/bn_ctx.c:235:1: Parameter `ctx->stack.depth` 233. } 234. 235. > void BN_CTX_start(BN_CTX *ctx) 236. { 237. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_mont.c:427:14: Call 425. tmod.top = buf[0] != 0 ? 1 : 0; 426. /* Ri = R^-1 mod N */ 427. if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL) ^ 428. goto err; 429. if (!BN_lshift(Ri, Ri, BN_BITS2)) crypto/bn/bn_gcd.c:225:1: Parameter `ctx->stack.depth` 223. BN_CTX *ctx); 224. 225. > BIGNUM *BN_mod_inverse(BIGNUM *in, 226. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx) 227. { crypto/bn/bn_gcd.c:230:10: Call 228. BIGNUM *rv; 229. int noinv; 230. rv = int_bn_mod_inverse(in, a, n, ctx, &noinv); ^ 231. if (noinv) 232. BNerr(BN_F_BN_MOD_INVERSE, BN_R_NO_INVERSE); crypto/bn/bn_gcd.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > BIGNUM *int_bn_mod_inverse(BIGNUM *in, 237. const BIGNUM *a, const BIGNUM *n, BN_CTX *ctx, 238. int *pnoinv) crypto/bn/bn_gcd.c:249:16: Call 247. if ((BN_get_flags(a, BN_FLG_CONSTTIME) != 0) 248. || (BN_get_flags(n, BN_FLG_CONSTTIME) != 0)) { 249. return BN_mod_inverse_no_branch(in, a, n, ctx); ^ 250. } 251. crypto/bn/bn_gcd.c:556:1: Parameter `ctx->stack.depth` 554. * not contain branches that may leak sensitive information. 555. */ 556. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 557. const BIGNUM *a, const BIGNUM *n, 558. BN_CTX *ctx) crypto/bn/bn_gcd.c:567:5: Call 565. bn_check_top(n); 566. 567. BN_CTX_start(ctx); ^ 568. A = BN_CTX_get(ctx); 569. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:235:1: Parameter `ctx->stack.depth` 233. } 234. 235. > void BN_CTX_start(BN_CTX *ctx) 236. { 237. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gcd.c:602:18: Call 600. bn_init(&local_B); 601. BN_with_flags(&local_B, B, BN_FLG_CONSTTIME); 602. if (!BN_nnmod(B, &local_B, A, ctx)) ^ 603. goto err; 604. /* Ensure local_B goes out of scope before any further use of B */ crypto/bn/bn_mod.c:118:1: Parameter `ctx->stack.depth` 116. #include "bn_lcl.h" 117. 118. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 119. { 120. /* crypto/bn/bn_mod.c:125:11: Call 123. */ 124. 125. if (!(BN_mod(r, m, d, ctx))) ^ 126. return 0; 127. if (!r->neg) crypto/bn/bn_div.c:188:1: Parameter `ctx->stack.depth` 186. * If 'dv' or 'rm' is NULL, the respective value is not returned. 187. */ 188. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 189. BN_CTX *ctx) 190. { crypto/bn/bn_div.c:241:5: Call 239. } 240. 241. BN_CTX_start(ctx); ^ 242. tmp = BN_CTX_get(ctx); 243. snum = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:235:1: Parameter `ctx->stack.depth` 233. } 234. 235. > void BN_CTX_start(BN_CTX *ctx) 236. { 237. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:460:5: Call 458. if (no_branch) 459. bn_correct_top(res); 460. BN_CTX_end(ctx); ^ 461. return (1); 462. err: crypto/bn/bn_ctx.c:249:1: Parameter `ctx->stack.depth` 247. } 248. 249. > void BN_CTX_end(BN_CTX *ctx) 250. { 251. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:255:27: Call 253. ctx->err_stack--; 254. else { 255. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 256. /* Does this stack frame have anything to release? */ 257. if (fp < ctx->used) crypto/bn/bn_ctx.c:325:1: <LHS trace> 323. } 324. 325. > static unsigned int BN_STACK_pop(BN_STACK *st) 326. { 327. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:325:1: Parameter `st->depth` 323. } 324. 325. > static unsigned int BN_STACK_pop(BN_STACK *st) 326. { 327. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:327:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_MONT_CTX_set` 325. static unsigned int BN_STACK_pop(BN_STACK *st) 326. { 327. return st->indexes[--(st->depth)]; ^ 328. } 329.
https://github.com/openssl/openssl/blob/be2e334fce734e726a4085701bc3cbbaabf9d893/crypto/bn/bn_ctx.c/#L327
d2a_code_trace_data_43633
static void contract(LHASH *lh) { LHASH_NODE **n,*n1,*np; np=lh->b[lh->p+lh->pmax-1]; lh->b[lh->p+lh->pmax-1]=NULL; if (lh->p == 0) { n=(LHASH_NODE **)Realloc(lh->b, (unsigned int)(sizeof(LHASH_NODE *)*lh->pmax)); if (n == NULL) { lh->error++; return; } lh->num_contract_reallocs++; lh->num_alloc_nodes/=2; lh->pmax/=2; lh->p=lh->pmax-1; lh->b=n; } else lh->p--; lh->num_nodes--; lh->num_contracts++; n1=lh->b[(int)lh->p]; if (n1 == NULL) lh->b[(int)lh->p]=np; else { while (n1->next != NULL) n1=n1->next; n1->next=np; } } ssl/s3_pkt.c:772: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `ssl3_get_record`. Showing all 15 steps of the trace ssl/s3_pkt.c:710:1: Parameter `s->ctx->sessions->p` 708. * none of our business 709. */ 710. > int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len) 711. { 712. int al,i,j,n,ret; ssl/s3_pkt.c:772:7: Call 770. if ((rr->length == 0) || (s->rstate == SSL_ST_READ_BODY)) 771. { 772. ret=ssl3_get_record(s); ^ 773. if (ret <= 0) return(ret); 774. } ssl/s3_pkt.c:231:1: Parameter `s->ctx->sessions->p` 229. */ 230. /* used only by ssl3_read_bytes */ 231. > static int ssl3_get_record(SSL *s) 232. { 233. int ssl_major,ssl_minor,al; ssl/s3_pkt.c:431:2: Call 429. return(1); 430. f_err: 431. ssl3_send_alert(s,SSL3_AL_FATAL,al); ^ 432. err: 433. return(ret); ssl/s3_pkt.c:1142:1: Parameter `s->ctx->sessions->p` 1140. } 1141. 1142. > void ssl3_send_alert(SSL *s, int level, int desc) 1143. { 1144. /* Map tls/ssl alert value to correct one */ ssl/s3_pkt.c:1149:3: Call 1147. /* If a fatal one, remove from cache */ 1148. if ((level == 2) && (s->session != NULL)) 1149. SSL_CTX_remove_session(s->ctx,s->session); ^ 1150. 1151. s->s3->alert_dispatch=1; ssl/ssl_sess.c:413:1: Parameter `ctx->sessions->p` 411. } 412. 413. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 414. { 415. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:415:9: Call 413. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 414. { 415. return remove_session_lock(ctx, c, 1); ^ 416. } 417. ssl/ssl_sess.c:418:1: Parameter `ctx->sessions->p` 416. } 417. 418. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 419. { 420. SSL_SESSION *r; ssl/ssl_sess.c:426:20: Call 424. { 425. if(lck) CRYPTO_w_lock(CRYPTO_LOCK_SSL_CTX); 426. r=(SSL_SESSION *)lh_delete(ctx->sessions,c); ^ 427. if (r != NULL) 428. { crypto/lhash/lhash.c:217:1: Parameter `lh->pmax` 215. } 216. 217. > void *lh_delete(LHASH *lh, void *data) 218. { 219. unsigned long hash; crypto/lhash/lhash.c:243:3: Call 241. if ((lh->num_nodes > MIN_NODES) && 242. (lh->down_load >= (lh->num_items*LH_LOAD_MULT/lh->num_nodes))) 243. contract(lh); ^ 244. 245. return(ret); crypto/lhash/lhash.c:352:1: <LHS trace> 350. } 351. 352. > static void contract(LHASH *lh) 353. { 354. LHASH_NODE **n,*n1,*np; crypto/lhash/lhash.c:352:1: Parameter `lh->p` 350. } 351. 352. > static void contract(LHASH *lh) 353. { 354. LHASH_NODE **n,*n1,*np; crypto/lhash/lhash.c:356:5: Binary operation: ([0, +oo] - 1):unsigned32 by call to `ssl3_get_record` 354. LHASH_NODE **n,*n1,*np; 355. 356. np=lh->b[lh->p+lh->pmax-1]; ^ 357. lh->b[lh->p+lh->pmax-1]=NULL; /* 24/07-92 - eay - weird but :-( */ 358. if (lh->p == 0)
https://github.com/openssl/openssl/blob/dab6f09573742df94c4767663565aca3863f8173/crypto/lhash/lhash.c/#L356
d2a_code_trace_data_43634
int ssl_print_tmp_key(BIO *out, SSL *s) { EVP_PKEY *key; if (!SSL_get_peer_tmp_key(s, &key)) return 1; BIO_puts(out, "Server Temp Key: "); switch (EVP_PKEY_id(key)) { case EVP_PKEY_RSA: BIO_printf(out, "RSA, %d bits\n", EVP_PKEY_bits(key)); break; case EVP_PKEY_DH: BIO_printf(out, "DH, %d bits\n", EVP_PKEY_bits(key)); break; #ifndef OPENSSL_NO_EC case 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 == NULL) cname = OBJ_nid2sn(nid); BIO_printf(out, "ECDH, %s, %d bits\n", cname, EVP_PKEY_bits(key)); } break; #endif default: BIO_printf(out, "%s, %d bits\n", OBJ_nid2sn(EVP_PKEY_id(key)), EVP_PKEY_bits(key)); } EVP_PKEY_free(key); return 1; } apps/s_cb.c:415: error: NULL_DEREFERENCE pointer `ec` last assigned on line 412 could be null and is dereferenced by call to `EC_KEY_get0_group()` at line 415, column 43. Showing all 38 steps of the trace apps/s_cb.c:394:1: start of procedure ssl_print_tmp_key() 392. #endif 393. 394. > int ssl_print_tmp_key(BIO *out, SSL *s) 395. { 396. EVP_PKEY *key; apps/s_cb.c:398:10: Taking false branch 396. EVP_PKEY *key; 397. 398. if (!SSL_get_peer_tmp_key(s, &key)) ^ 399. return 1; 400. BIO_puts(out, "Server Temp Key: "); apps/s_cb.c:400:5: 398. if (!SSL_get_peer_tmp_key(s, &key)) 399. return 1; 400. > BIO_puts(out, "Server Temp Key: "); 401. switch (EVP_PKEY_id(key)) { 402. case EVP_PKEY_RSA: crypto/bio/bio_lib.c:387:1: start of procedure BIO_puts() 385. } 386. 387. > int BIO_puts(BIO *b, const char *buf) 388. { 389. int ret; crypto/bio/bio_lib.c:390:5: 388. { 389. int ret; 390. > size_t written = 0; 391. 392. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) { crypto/bio/bio_lib.c:392:10: Taking false branch 390. size_t written = 0; 391. 392. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) { ^ 393. BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD); 394. return -2; crypto/bio/bio_lib.c:392:25: Taking false branch 390. size_t written = 0; 391. 392. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) { ^ 393. BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD); 394. return -2; crypto/bio/bio_lib.c:392:48: Taking false branch 390. size_t written = 0; 391. 392. if ((b == NULL) || (b->method == NULL) || (b->method->bputs == NULL)) { ^ 393. BIOerr(BIO_F_BIO_PUTS, BIO_R_UNSUPPORTED_METHOD); 394. return -2; crypto/bio/bio_lib.c:397:9: Taking false branch 395. } 396. 397. if (b->callback != NULL || b->callback_ex != NULL) { ^ 398. ret = (int)bio_call_callback(b, BIO_CB_PUTS, buf, 0, 0, 0L, 1L, NULL); 399. if (ret <= 0) crypto/bio/bio_lib.c:397:32: Taking false branch 395. } 396. 397. if (b->callback != NULL || b->callback_ex != NULL) { ^ 398. ret = (int)bio_call_callback(b, BIO_CB_PUTS, buf, 0, 0, 0L, 1L, NULL); 399. if (ret <= 0) crypto/bio/bio_lib.c:403:10: Taking false branch 401. } 402. 403. if (!b->init) { ^ 404. BIOerr(BIO_F_BIO_PUTS, BIO_R_UNINITIALIZED); 405. return -2; crypto/bio/bio_lib.c:408:5: Skipping __function_pointer__(): unresolved function pointer 406. } 407. 408. ret = b->method->bputs(b, buf); ^ 409. 410. if (ret > 0) { crypto/bio/bio_lib.c:410:9: Taking false branch 408. ret = b->method->bputs(b, buf); 409. 410. if (ret > 0) { ^ 411. b->num_write += (uint64_t)ret; 412. written = ret; crypto/bio/bio_lib.c:416:9: Taking false branch 414. } 415. 416. if (b->callback != NULL || b->callback_ex != NULL) ^ 417. ret = (int)bio_call_callback(b, BIO_CB_PUTS | BIO_CB_RETURN, buf, 0, 0, 418. 0L, ret, &written); crypto/bio/bio_lib.c:416:32: Taking false branch 414. } 415. 416. if (b->callback != NULL || b->callback_ex != NULL) ^ 417. ret = (int)bio_call_callback(b, BIO_CB_PUTS | BIO_CB_RETURN, buf, 0, 0, 418. 0L, ret, &written); crypto/bio/bio_lib.c:420:9: Taking false branch 418. 0L, ret, &written); 419. 420. if (ret > 0) { ^ 421. if (written > INT_MAX) { 422. BIOerr(BIO_F_BIO_PUTS, BIO_R_LENGTH_TOO_LONG); crypto/bio/bio_lib.c:429:5: 427. } 428. 429. > return ret; 430. } 431. crypto/bio/bio_lib.c:430:1: return from a call to BIO_puts 428. 429. return ret; 430. > } 431. 432. int BIO_gets(BIO *b, char *buf, int size) apps/s_cb.c:401:5: 399. return 1; 400. BIO_puts(out, "Server Temp Key: "); 401. > switch (EVP_PKEY_id(key)) { 402. case EVP_PKEY_RSA: 403. BIO_printf(out, "RSA, %d bits\n", EVP_PKEY_bits(key)); crypto/evp/p_lib.c:585:1: start of procedure EVP_PKEY_id() 583. } 584. 585. > int EVP_PKEY_id(const EVP_PKEY *pkey) 586. { 587. return pkey->type; crypto/evp/p_lib.c:587:5: 585. int EVP_PKEY_id(const EVP_PKEY *pkey) 586. { 587. > return pkey->type; 588. } 589. crypto/evp/p_lib.c:588:1: return from a call to EVP_PKEY_id 586. { 587. return pkey->type; 588. > } 589. 590. int EVP_PKEY_base_id(const EVP_PKEY *pkey) apps/s_cb.c:402:5: Switch condition is false. Skipping switch case 400. BIO_puts(out, "Server Temp Key: "); 401. switch (EVP_PKEY_id(key)) { 402. case EVP_PKEY_RSA: ^ 403. BIO_printf(out, "RSA, %d bits\n", EVP_PKEY_bits(key)); 404. break; apps/s_cb.c:406:5: Switch condition is false. Skipping switch case 404. break; 405. 406. case EVP_PKEY_DH: ^ 407. BIO_printf(out, "DH, %d bits\n", EVP_PKEY_bits(key)); 408. break; apps/s_cb.c:410:5: Switch condition is true. Entering switch case 408. break; 409. #ifndef OPENSSL_NO_EC 410. case EVP_PKEY_EC: ^ 411. { 412. EC_KEY *ec = EVP_PKEY_get1_EC_KEY(key); apps/s_cb.c:412:13: 410. case EVP_PKEY_EC: 411. { 412. > EC_KEY *ec = EVP_PKEY_get1_EC_KEY(key); 413. int nid; 414. const char *cname; crypto/evp/p_lib.c:532:1: start of procedure EVP_PKEY_get1_EC_KEY() 530. } 531. 532. > EC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey) 533. { 534. EC_KEY *ret = EVP_PKEY_get0_EC_KEY(pkey); crypto/evp/p_lib.c:534:5: 532. EC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey) 533. { 534. > EC_KEY *ret = EVP_PKEY_get0_EC_KEY(pkey); 535. if (ret != NULL) 536. EC_KEY_up_ref(ret); crypto/evp/p_lib.c:523:1: start of procedure EVP_PKEY_get0_EC_KEY() 521. } 522. 523. > EC_KEY *EVP_PKEY_get0_EC_KEY(const EVP_PKEY *pkey) 524. { 525. if (pkey->type != EVP_PKEY_EC) { crypto/evp/p_lib.c:525:9: Taking false branch 523. EC_KEY *EVP_PKEY_get0_EC_KEY(const EVP_PKEY *pkey) 524. { 525. if (pkey->type != EVP_PKEY_EC) { ^ 526. EVPerr(EVP_F_EVP_PKEY_GET0_EC_KEY, EVP_R_EXPECTING_A_EC_KEY); 527. return NULL; crypto/evp/p_lib.c:529:5: 527. return NULL; 528. } 529. > return pkey->pkey.ec; 530. } 531. crypto/evp/p_lib.c:530:1: return from a call to EVP_PKEY_get0_EC_KEY 528. } 529. return pkey->pkey.ec; 530. > } 531. 532. EC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey) crypto/evp/p_lib.c:535:9: Taking false branch 533. { 534. EC_KEY *ret = EVP_PKEY_get0_EC_KEY(pkey); 535. if (ret != NULL) ^ 536. EC_KEY_up_ref(ret); 537. return ret; crypto/evp/p_lib.c:537:5: 535. if (ret != NULL) 536. EC_KEY_up_ref(ret); 537. > return ret; 538. } 539. #endif crypto/evp/p_lib.c:538:1: return from a call to EVP_PKEY_get1_EC_KEY 536. EC_KEY_up_ref(ret); 537. return ret; 538. > } 539. #endif 540. apps/s_cb.c:415:13: 413. int nid; 414. const char *cname; 415. > nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec)); 416. EC_KEY_free(ec); 417. cname = EC_curve_nid2nist(nid); crypto/ec/ec_key.c:494:1: start of procedure EC_KEY_get0_group() 492. } 493. 494. > const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key) 495. { 496. return key->group; crypto/ec/ec_key.c:496:5: 494. const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key) 495. { 496. > return key->group; 497. } 498.
https://github.com/openssl/openssl/blob/c3612970465d0a13f2fc5b47bc28ca18516a699d/apps/s_cb.c/#L415
d2a_code_trace_data_43635
int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) { assert(pkt->subs != NULL && len != 0); if (pkt->subs == NULL || len == 0) return 0; if (pkt->maxsize - pkt->written < len) return 0; if (pkt->staticbuf == NULL && (pkt->buf->length - pkt->written < len)) { size_t newlen; size_t reflen; reflen = (len > pkt->buf->length) ? len : pkt->buf->length; if (reflen > SIZE_MAX / 2) { newlen = SIZE_MAX; } else { newlen = reflen * 2; if (newlen < DEFAULT_BUF_SIZE) newlen = DEFAULT_BUF_SIZE; } if (BUF_MEM_grow(pkt->buf, newlen) == 0) return 0; } if (allocbytes != NULL) *allocbytes = WPACKET_get_curr(pkt); return 1; } ssl/statem/statem_srvr.c:3469: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [`pkt->written`, `pkt->written` + 7]):unsigned64 by call to `WPACKET_sub_memcpy__`. Showing all 16 steps of the trace ssl/statem/statem_srvr.c:3466:1: Parameter `pkt->written` 3464. * create a separate message. Returns 1 on success or 0 on failure. 3465. */ 3466. > int tls_construct_cert_status_body(SSL *s, WPACKET *pkt) 3467. { 3468. if (!WPACKET_put_bytes_u8(pkt, s->ext.status_type) ssl/statem/statem_srvr.c:3468:10: Call 3466. int tls_construct_cert_status_body(SSL *s, WPACKET *pkt) 3467. { 3468. if (!WPACKET_put_bytes_u8(pkt, s->ext.status_type) ^ 3469. || !WPACKET_sub_memcpy_u24(pkt, s->ext.ocsp.resp, 3470. s->ext.ocsp.resp_len)) { ssl/packet.c:289:1: Parameter `pkt->written` 287. } 288. 289. > int WPACKET_put_bytes__(WPACKET *pkt, unsigned int val, size_t size) 290. { 291. unsigned char *data; ssl/statem/statem_srvr.c:3469:17: Call 3467. { 3468. if (!WPACKET_put_bytes_u8(pkt, s->ext.status_type) 3469. || !WPACKET_sub_memcpy_u24(pkt, s->ext.ocsp.resp, ^ 3470. s->ext.ocsp.resp_len)) { 3471. SSLerr(SSL_F_TLS_CONSTRUCT_CERT_STATUS_BODY, ERR_R_INTERNAL_ERROR); ssl/packet.c:348:10: Call 346. size_t lenbytes) 347. { 348. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) ^ 349. || !WPACKET_memcpy(pkt, src, len) 350. || !WPACKET_close(pkt)) ssl/packet.c:252:1: Parameter `pkt->buf->length` 250. } 251. 252. > int WPACKET_start_sub_packet_len__(WPACKET *pkt, size_t lenbytes) 253. { 254. WPACKET_SUB *sub; ssl/packet.c:349:17: Call 347. { 348. if (!WPACKET_start_sub_packet_len__(pkt, lenbytes) 349. || !WPACKET_memcpy(pkt, src, len) ^ 350. || !WPACKET_close(pkt)) 351. return 0; ssl/packet.c:330:1: Parameter `pkt->written` 328. } 329. 330. > int WPACKET_memcpy(WPACKET *pkt, const void *src, size_t len) 331. { 332. unsigned char *dest; ssl/packet.c:337:10: Call 335. return 1; 336. 337. if (!WPACKET_allocate_bytes(pkt, len, &dest)) ^ 338. return 0; 339. ssl/packet.c:15:1: Parameter `pkt->written` 13. #define DEFAULT_BUF_SIZE 256 14. 15. > int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ssl/packet.c:17:10: Call 15. int WPACKET_allocate_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 16. { 17. if (!WPACKET_reserve_bytes(pkt, len, allocbytes)) ^ 18. return 0; 19. ssl/packet.c:39:1: <LHS trace> 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: Parameter `pkt->buf->length` 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: <RHS trace> 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:39:1: Parameter `len` 37. ? (p)->staticbuf : (unsigned char *)(p)->buf->data) 38. 39. > int WPACKET_reserve_bytes(WPACKET *pkt, size_t len, unsigned char **allocbytes) 40. { 41. /* Internal API, so should not fail */ ssl/packet.c:49:36: Binary operation: ([0, +oo] - [pkt->written, pkt->written + 7]):unsigned64 by call to `WPACKET_sub_memcpy__` 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/f61c5ca6ca183bf0a51651857e3efb02a98889ad/ssl/packet.c/#L49
d2a_code_trace_data_43636
int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, const BIGNUM *order, const BIGNUM *cofactor) { if (generator == NULL) { ECerr(EC_F_EC_GROUP_SET_GENERATOR, ERR_R_PASSED_NULL_PARAMETER); return 0; } if (group->generator == NULL) { group->generator = EC_POINT_new(group); if (group->generator == NULL) return 0; } if (!EC_POINT_copy(group->generator, generator)) return 0; if (order != NULL) { if (!BN_copy(group->order, order)) return 0; } else BN_zero(group->order); if (cofactor != NULL) { if (!BN_copy(group->cofactor, cofactor)) return 0; } else BN_zero(group->cofactor); ec_precompute_mont_data(group); return 1; } crypto/ec/ec_lib.c:298: error: MEMORY_LEAK memory dynamically allocated by call to `EC_POINT_new()` at line 274, column 28 is not reachable after line 298, column 5. Showing all 54 steps of the trace crypto/ec/ec_lib.c:265:1: start of procedure EC_GROUP_set_generator() 263. } 264. 265. > int EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, 266. const BIGNUM *order, const BIGNUM *cofactor) 267. { crypto/ec/ec_lib.c:268:9: Taking false branch 266. const BIGNUM *order, const BIGNUM *cofactor) 267. { 268. if (generator == NULL) { ^ 269. ECerr(EC_F_EC_GROUP_SET_GENERATOR, ERR_R_PASSED_NULL_PARAMETER); 270. return 0; crypto/ec/ec_lib.c:273:9: Taking true branch 271. } 272. 273. if (group->generator == NULL) { ^ 274. group->generator = EC_POINT_new(group); 275. if (group->generator == NULL) crypto/ec/ec_lib.c:274:9: 272. 273. if (group->generator == NULL) { 274. > group->generator = EC_POINT_new(group); 275. if (group->generator == NULL) 276. return 0; crypto/ec/ec_lib.c:668:1: start of procedure EC_POINT_new() 666. /* functions for EC_POINT objects */ 667. 668. > EC_POINT *EC_POINT_new(const EC_GROUP *group) 669. { 670. EC_POINT *ret; crypto/ec/ec_lib.c:672:9: Taking false branch 670. EC_POINT *ret; 671. 672. if (group == NULL) { ^ 673. ECerr(EC_F_EC_POINT_NEW, ERR_R_PASSED_NULL_PARAMETER); 674. return NULL; crypto/ec/ec_lib.c:676:9: Taking false branch 674. return NULL; 675. } 676. if (group->meth->point_init == 0) { ^ 677. ECerr(EC_F_EC_POINT_NEW, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); 678. return NULL; crypto/ec/ec_lib.c:681:5: 679. } 680. 681. > ret = OPENSSL_malloc(sizeof(*ret)); 682. if (ret == NULL) { 683. ECerr(EC_F_EC_POINT_NEW, ERR_R_MALLOC_FAILURE); crypto/mem.c:120:1: start of procedure CRYPTO_malloc() 118. } 119. 120. > void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. void *ret = NULL; crypto/mem.c:122:5: 120. void *CRYPTO_malloc(size_t num, const char *file, int line) 121. { 122. > void *ret = NULL; 123. 124. if (num <= 0) crypto/mem.c:124:9: Taking false branch 122. void *ret = NULL; 123. 124. if (num <= 0) ^ 125. return NULL; 126. crypto/mem.c:127:5: 125. return NULL; 126. 127. > allow_customize = 0; 128. #ifndef OPENSSL_NO_CRYPTO_MDEBUG 129. if (call_malloc_debug) { crypto/mem.c:137:5: 135. } 136. #else 137. > (void)file; 138. (void)line; 139. ret = malloc(num); crypto/mem.c:138:5: 136. #else 137. (void)file; 138. > (void)line; 139. ret = malloc(num); 140. #endif crypto/mem.c:139:5: 137. (void)file; 138. (void)line; 139. > ret = malloc(num); 140. #endif 141. crypto/mem.c:154:5: 152. #endif 153. 154. > return ret; 155. } 156. crypto/mem.c:155:1: return from a call to CRYPTO_malloc 153. 154. return ret; 155. > } 156. 157. void *CRYPTO_zalloc(size_t num, const char *file, int line) crypto/ec/ec_lib.c:682:9: Taking false branch 680. 681. ret = OPENSSL_malloc(sizeof(*ret)); 682. if (ret == NULL) { ^ 683. ECerr(EC_F_EC_POINT_NEW, ERR_R_MALLOC_FAILURE); 684. return NULL; crypto/ec/ec_lib.c:687:5: 685. } 686. 687. > ret->meth = group->meth; 688. 689. if (!ret->meth->point_init(ret)) { crypto/ec/ec_lib.c:689:10: Taking false branch 687. ret->meth = group->meth; 688. 689. if (!ret->meth->point_init(ret)) { ^ 690. OPENSSL_free(ret); 691. return NULL; crypto/ec/ec_lib.c:694:5: 692. } 693. 694. > return ret; 695. } 696. crypto/ec/ec_lib.c:695:1: return from a call to EC_POINT_new 693. 694. return ret; 695. > } 696. 697. void EC_POINT_free(EC_POINT *point) crypto/ec/ec_lib.c:275:13: Taking false branch 273. if (group->generator == NULL) { 274. group->generator = EC_POINT_new(group); 275. if (group->generator == NULL) ^ 276. return 0; 277. } crypto/ec/ec_lib.c:278:10: 276. return 0; 277. } 278. > if (!EC_POINT_copy(group->generator, generator)) 279. return 0; 280. crypto/ec/ec_lib.c:719:1: start of procedure EC_POINT_copy() 717. } 718. 719. > int EC_POINT_copy(EC_POINT *dest, const EC_POINT *src) 720. { 721. if (dest->meth->point_copy == 0) { crypto/ec/ec_lib.c:721:9: Taking false branch 719. int EC_POINT_copy(EC_POINT *dest, const EC_POINT *src) 720. { 721. if (dest->meth->point_copy == 0) { ^ 722. ECerr(EC_F_EC_POINT_COPY, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); 723. return 0; crypto/ec/ec_lib.c:725:9: Taking false branch 723. return 0; 724. } 725. if (dest->meth != src->meth) { ^ 726. ECerr(EC_F_EC_POINT_COPY, EC_R_INCOMPATIBLE_OBJECTS); 727. return 0; crypto/ec/ec_lib.c:729:9: Taking false branch 727. return 0; 728. } 729. if (dest == src) ^ 730. return 1; 731. return dest->meth->point_copy(dest, src); crypto/ec/ec_lib.c:731:5: Skipping __function_pointer__(): unresolved function pointer 729. if (dest == src) 730. return 1; 731. return dest->meth->point_copy(dest, src); ^ 732. } 733. crypto/ec/ec_lib.c:732:1: return from a call to EC_POINT_copy 730. return 1; 731. return dest->meth->point_copy(dest, src); 732. > } 733. 734. EC_POINT *EC_POINT_dup(const EC_POINT *a, const EC_GROUP *group) crypto/ec/ec_lib.c:278:10: Taking false branch 276. return 0; 277. } 278. if (!EC_POINT_copy(group->generator, generator)) ^ 279. return 0; 280. crypto/ec/ec_lib.c:281:9: Taking false branch 279. return 0; 280. 281. if (order != NULL) { ^ 282. if (!BN_copy(group->order, order)) 283. return 0; crypto/ec/ec_lib.c:285:9: 283. return 0; 284. } else 285. > BN_zero(group->order); 286. 287. if (cofactor != NULL) { crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is false 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) crypto/ec/ec_lib.c:287:9: Taking false branch 285. BN_zero(group->order); 286. 287. if (cofactor != NULL) { ^ 288. if (!BN_copy(group->cofactor, cofactor)) 289. return 0; crypto/ec/ec_lib.c:291:9: 289. return 0; 290. } else 291. > BN_zero(group->cofactor); 292. 293. /* crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word() 528. } 529. 530. > int BN_set_word(BIGNUM *a, BN_ULONG w) 531. { 532. bn_check_top(a); crypto/bn/bn_lib.c:533:9: Condition is true 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:533:9: Taking false branch 531. { 532. bn_check_top(a); 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) ^ 534. return (0); 535. a->neg = 0; crypto/bn/bn_lib.c:535:5: 533. if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL) 534. return (0); 535. > a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); crypto/bn/bn_lib.c:536:5: 534. return (0); 535. a->neg = 0; 536. > a->d[0] = w; 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); crypto/bn/bn_lib.c:537:15: Condition is false 535. a->neg = 0; 536. a->d[0] = w; 537. a->top = (w ? 1 : 0); ^ 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:537:5: 535. a->neg = 0; 536. a->d[0] = w; 537. > a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. return (1); crypto/bn/bn_lib.c:539:5: 537. a->top = (w ? 1 : 0); 538. bn_check_top(a); 539. > return (1); 540. } 541. crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word 538. bn_check_top(a); 539. return (1); 540. > } 541. 542. BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret) crypto/ec/ec_lib.c:298:5: Skipping ec_precompute_mont_data(): empty list of specs 296. * |group->mont_data| will be NULL in this case. 297. */ 298. ec_precompute_mont_data(group); ^ 299. 300. return 1;
https://github.com/openssl/openssl/blob/ec04e866343d40a1e3e8e5db79557e279a2dd0d8/crypto/ec/ec_lib.c/#L298
d2a_code_trace_data_43637
void ssl3_cbc_digest_record(const EVP_MD_CTX *ctx, unsigned char *md_out, size_t *md_out_size, const unsigned char header[13], const unsigned char *data, size_t data_plus_mac_size, size_t data_plus_mac_plus_padding_size, const unsigned char *mac_secret, unsigned mac_secret_length, char is_sslv3) { union { double align; unsigned char c[sizeof(LARGEST_DIGEST_CTX)]; } md_state; void (*md_final_raw) (void *ctx, unsigned char *md_out); void (*md_transform) (void *ctx, const unsigned char *block); unsigned md_size, md_block_size = 64; unsigned sslv3_pad_length = 40, header_length, variance_blocks, len, max_mac_bytes, num_blocks, num_starting_blocks, k, mac_end_offset, c, index_a, index_b; unsigned int bits; unsigned char length_bytes[MAX_HASH_BIT_COUNT_BYTES]; unsigned char hmac_pad[MAX_HASH_BLOCK_SIZE]; unsigned char first_block[MAX_HASH_BLOCK_SIZE]; unsigned char mac_out[EVP_MAX_MD_SIZE]; unsigned i, j, md_out_size_u; EVP_MD_CTX md_ctx; unsigned md_length_size = 8; char length_is_big_endian = 1; int ret; OPENSSL_assert(data_plus_mac_plus_padding_size < 1024 * 1024); switch (EVP_MD_CTX_type(ctx)) { case NID_md5: MD5_Init((MD5_CTX *)md_state.c); md_final_raw = tls1_md5_final_raw; md_transform = (void (*)(void *ctx, const unsigned char *block))MD5_Transform; md_size = 16; sslv3_pad_length = 48; length_is_big_endian = 0; break; case NID_sha1: SHA1_Init((SHA_CTX *)md_state.c); md_final_raw = tls1_sha1_final_raw; md_transform = (void (*)(void *ctx, const unsigned char *block))SHA1_Transform; md_size = 20; break; #ifndef OPENSSL_NO_SHA256 case NID_sha224: SHA224_Init((SHA256_CTX *)md_state.c); md_final_raw = tls1_sha256_final_raw; md_transform = (void (*)(void *ctx, const unsigned char *block))SHA256_Transform; md_size = 224 / 8; break; case NID_sha256: SHA256_Init((SHA256_CTX *)md_state.c); md_final_raw = tls1_sha256_final_raw; md_transform = (void (*)(void *ctx, const unsigned char *block))SHA256_Transform; md_size = 32; break; #endif #ifndef OPENSSL_NO_SHA512 case NID_sha384: SHA384_Init((SHA512_CTX *)md_state.c); md_final_raw = tls1_sha512_final_raw; md_transform = (void (*)(void *ctx, const unsigned char *block))SHA512_Transform; md_size = 384 / 8; md_block_size = 128; md_length_size = 16; break; case NID_sha512: SHA512_Init((SHA512_CTX *)md_state.c); md_final_raw = tls1_sha512_final_raw; md_transform = (void (*)(void *ctx, const unsigned char *block))SHA512_Transform; md_size = 64; md_block_size = 128; md_length_size = 16; break; #endif default: OPENSSL_assert(0); if (md_out_size) *md_out_size = -1; return; } OPENSSL_assert(md_length_size <= MAX_HASH_BIT_COUNT_BYTES); OPENSSL_assert(md_block_size <= MAX_HASH_BLOCK_SIZE); OPENSSL_assert(md_size <= EVP_MAX_MD_SIZE); header_length = 13; if (is_sslv3) { header_length = mac_secret_length + sslv3_pad_length + 8 + 1 + 2 ; } variance_blocks = is_sslv3 ? 2 : 6; len = data_plus_mac_plus_padding_size + header_length; max_mac_bytes = len - md_size - 1; num_blocks = (max_mac_bytes + 1 + md_length_size + md_block_size - 1) / md_block_size; num_starting_blocks = 0; k = 0; mac_end_offset = data_plus_mac_size + header_length - md_size; c = mac_end_offset % md_block_size; index_a = mac_end_offset / md_block_size; index_b = (mac_end_offset + md_length_size) / md_block_size; if (num_blocks > variance_blocks + (is_sslv3 ? 1 : 0)) { num_starting_blocks = num_blocks - variance_blocks; k = md_block_size * num_starting_blocks; } bits = 8 * mac_end_offset; if (!is_sslv3) { bits += 8 * md_block_size; memset(hmac_pad, 0, md_block_size); OPENSSL_assert(mac_secret_length <= sizeof(hmac_pad)); memcpy(hmac_pad, mac_secret, mac_secret_length); for (i = 0; i < md_block_size; i++) hmac_pad[i] ^= 0x36; md_transform(md_state.c, hmac_pad); } if (length_is_big_endian) { memset(length_bytes, 0, md_length_size - 4); length_bytes[md_length_size - 4] = (unsigned char)(bits >> 24); length_bytes[md_length_size - 3] = (unsigned char)(bits >> 16); length_bytes[md_length_size - 2] = (unsigned char)(bits >> 8); length_bytes[md_length_size - 1] = (unsigned char)bits; } else { memset(length_bytes, 0, md_length_size); length_bytes[md_length_size - 5] = (unsigned char)(bits >> 24); length_bytes[md_length_size - 6] = (unsigned char)(bits >> 16); length_bytes[md_length_size - 7] = (unsigned char)(bits >> 8); length_bytes[md_length_size - 8] = (unsigned char)bits; } if (k > 0) { if (is_sslv3) { unsigned overhang = header_length - md_block_size; md_transform(md_state.c, header); memcpy(first_block, header + md_block_size, overhang); memcpy(first_block + overhang, data, md_block_size - overhang); md_transform(md_state.c, first_block); for (i = 1; i < k / md_block_size - 1; i++) md_transform(md_state.c, data + md_block_size * i - overhang); } else { memcpy(first_block, header, 13); memcpy(first_block + 13, data, md_block_size - 13); md_transform(md_state.c, first_block); for (i = 1; i < k / md_block_size; i++) md_transform(md_state.c, data + md_block_size * i - 13); } } memset(mac_out, 0, sizeof(mac_out)); for (i = num_starting_blocks; i <= num_starting_blocks + variance_blocks; i++) { unsigned char block[MAX_HASH_BLOCK_SIZE]; unsigned char is_block_a = constant_time_eq_8(i, index_a); unsigned char is_block_b = constant_time_eq_8(i, index_b); for (j = 0; j < md_block_size; j++) { unsigned char b = 0, is_past_c, is_past_cp1; if (k < header_length) b = header[k]; else if (k < data_plus_mac_plus_padding_size + header_length) b = data[k - header_length]; k++; is_past_c = is_block_a & constant_time_ge_8(j, c); is_past_cp1 = is_block_a & constant_time_ge_8(j, c + 1); b = constant_time_select_8(is_past_c, 0x80, b); b = b & ~is_past_cp1; b &= ~is_block_b | is_block_a; if (j >= md_block_size - md_length_size) { b = constant_time_select_8(is_block_b, length_bytes[j - (md_block_size - md_length_size)], b); } block[j] = b; } md_transform(md_state.c, block); md_final_raw(md_state.c, block); for (j = 0; j < md_size; j++) mac_out[j] |= block[j] & is_block_b; } EVP_MD_CTX_init(&md_ctx); EVP_DigestInit_ex(&md_ctx, ctx->digest, NULL ); if (is_sslv3) { memset(hmac_pad, 0x5c, sslv3_pad_length); EVP_DigestUpdate(&md_ctx, mac_secret, mac_secret_length); EVP_DigestUpdate(&md_ctx, hmac_pad, sslv3_pad_length); EVP_DigestUpdate(&md_ctx, mac_out, md_size); } else { for (i = 0; i < md_block_size; i++) hmac_pad[i] ^= 0x6a; EVP_DigestUpdate(&md_ctx, hmac_pad, md_block_size); EVP_DigestUpdate(&md_ctx, mac_out, md_size); } ret = EVP_DigestFinal(&md_ctx, md_out, &md_out_size_u); if (ret && md_out_size) *md_out_size = md_out_size_u; EVP_MD_CTX_cleanup(&md_ctx); } ssl/s3_enc.c:772: error: BUFFER_OVERRUN_L3 Offset added: [-115, +oo] Size: 128 by call to `ssl3_cbc_digest_record`. Showing all 12 steps of the trace ssl/s3_enc.c:713:1: Parameter `ssl->read_hash->digest->md_size` 711. } 712. 713. > int n_ssl3_mac(SSL *ssl, unsigned char *md, int send) 714. { 715. SSL3_RECORD *rec; ssl/s3_enc.c:736:9: Call 734. } 735. 736. t = EVP_MD_CTX_size(hash); ^ 737. if (t < 0) 738. return -1; crypto/evp/evp_lib.c:276:9: Assignment 274. if (!md) { 275. EVPerr(EVP_F_EVP_MD_SIZE, EVP_R_MESSAGE_DIGEST_IS_NULL); 276. return -1; ^ 277. } 278. return md->md_size; ssl/s3_enc.c:736:5: Assignment 734. } 735. 736. t = EVP_MD_CTX_size(hash); ^ 737. if (t < 0) 738. return -1; ssl/s3_enc.c:739:5: Assignment 737. if (t < 0) 738. return -1; 739. md_size = t; ^ 740. npad = (48 / md_size) * md_size; 741. ssl/s3_enc.c:772:9: Call 770. 771. /* Final param == is SSLv3 */ 772. ssl3_cbc_digest_record(hash, ^ 773. md, &md_size, 774. header, rec->input, ssl/s3_cbc.c:425:5: <Offset trace> 423. void (*md_final_raw) (void *ctx, unsigned char *md_out); 424. void (*md_transform) (void *ctx, const unsigned char *block); 425. unsigned md_size, md_block_size = 64; ^ 426. unsigned sslv3_pad_length = 40, header_length, variance_blocks, 427. len, max_mac_bytes, num_blocks, ssl/s3_cbc.c:425:5: Assignment 423. void (*md_final_raw) (void *ctx, unsigned char *md_out); 424. void (*md_transform) (void *ctx, const unsigned char *block); 425. unsigned md_size, md_block_size = 64; ^ 426. unsigned sslv3_pad_length = 40, header_length, variance_blocks, 427. len, max_mac_bytes, num_blocks, ssl/s3_cbc.c:642:13: Assignment 640. * consumes: either 7 bytes (SHA1) or 11 bytes (MD5). 641. */ 642. unsigned overhang = header_length - md_block_size; ^ 643. md_transform(md_state.c, header); 644. memcpy(first_block, header + md_block_size, overhang); ssl/s3_cbc.c:409:1: <Length trace> 407. * padding too. ) 408. */ 409. > void ssl3_cbc_digest_record(const EVP_MD_CTX *ctx, 410. unsigned char *md_out, 411. size_t *md_out_size, ssl/s3_cbc.c:409:1: Array declaration 407. * padding too. ) 408. */ 409. > void ssl3_cbc_digest_record(const EVP_MD_CTX *ctx, 410. unsigned char *md_out, 411. size_t *md_out_size, ssl/s3_cbc.c:644:13: Array access: Offset added: [-115, +oo] Size: 128 by call to `ssl3_cbc_digest_record` 642. unsigned overhang = header_length - md_block_size; 643. md_transform(md_state.c, header); 644. memcpy(first_block, header + md_block_size, overhang); ^ 645. memcpy(first_block + overhang, data, md_block_size - overhang); 646. md_transform(md_state.c, first_block);
https://github.com/openssl/openssl/blob/9c46f4b9cd4912b61cb546c48b678488d7f26ed6/ssl/s3_cbc.c/#L644
d2a_code_trace_data_43638
DECLAREContigPutFunc(put4bitcmaptile) { uint32** PALmap = img->PALmap; (void) x; (void) y; fromskew /= 2; while (h-- > 0) { uint32* bw; UNROLL2(w, bw = PALmap[*pp++], *cp++ = *bw++); cp += toskew; pp += fromskew; } } libtiff/tif_getimage.c:1095: error: Integer Overflow L2 ([0, `h`] - 1):unsigned32. libtiff/tif_getimage.c:1089:1: <LHS trace> 1087. * 4-bit palette => colormap/RGB 1088. */ 1089. DECLAREContigPutFunc(put4bitcmaptile) ^ 1090. { 1091. uint32** PALmap = img->PALmap; libtiff/tif_getimage.c:1089:1: Parameter `h` 1087. * 4-bit palette => colormap/RGB 1088. */ 1089. DECLAREContigPutFunc(put4bitcmaptile) ^ 1090. { 1091. uint32** PALmap = img->PALmap; libtiff/tif_getimage.c:1095:12: Binary operation: ([0, h] - 1):unsigned32 1093. (void) x; (void) y; 1094. fromskew /= 2; 1095. while (h-- > 0) { ^ 1096. uint32* bw; 1097. UNROLL2(w, bw = PALmap[*pp++], *cp++ = *bw++);
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_getimage.c/#L1095
d2a_code_trace_data_43639
static int mkv_add_cuepoint(mkv_cues *cues, int stream, int64_t ts, int64_t cluster_pos) { int err; if (ts < 0) return 0; if ((err = av_reallocp_array(&cues->entries, cues->num_entries + 1, sizeof(*cues->entries))) < 0) { cues->num_entries = 0; return err; } cues->entries[cues->num_entries].pts = ts; cues->entries[cues->num_entries].tracknum = stream + 1; cues->entries[cues->num_entries++].cluster_pos = cluster_pos - cues->segment_offset; return 0; } libavformat/matroskaenc.c:391: error: Null Dereference pointer `cues->entries` last assigned on line 385 could be null and is dereferenced at line 391, column 5. libavformat/matroskaenc.c:378:1: start of procedure mkv_add_cuepoint() 376. } 377. 378. static int mkv_add_cuepoint(mkv_cues *cues, int stream, int64_t ts, int64_t cluster_pos) ^ 379. { 380. int err; libavformat/matroskaenc.c:382:9: Taking false branch 380. int err; 381. 382. if (ts < 0) ^ 383. return 0; 384. libavformat/matroskaenc.c:385:9: 383. return 0; 384. 385. if ((err = av_reallocp_array(&cues->entries, cues->num_entries + 1, ^ 386. sizeof(*cues->entries))) < 0) { 387. cues->num_entries = 0; libavutil/mem.c:146:1: start of procedure av_reallocp_array() 144. } 145. 146. int av_reallocp_array(void *ptr, size_t nmemb, size_t size) ^ 147. { 148. void **ptrptr = ptr; libavutil/mem.c:148:5: 146. int av_reallocp_array(void *ptr, size_t nmemb, size_t size) 147. { 148. void **ptrptr = ptr; ^ 149. void *ret; 150. if (!size || nmemb >= INT_MAX / size) libavutil/mem.c:150:10: Taking false branch 148. void **ptrptr = ptr; 149. void *ret; 150. if (!size || nmemb >= INT_MAX / size) ^ 151. return AVERROR(ENOMEM); 152. if (!nmemb) { libavutil/mem.c:150:18: Taking false branch 148. void **ptrptr = ptr; 149. void *ret; 150. if (!size || nmemb >= INT_MAX / size) ^ 151. return AVERROR(ENOMEM); 152. if (!nmemb) { libavutil/mem.c:152:10: Taking true branch 150. if (!size || nmemb >= INT_MAX / size) 151. return AVERROR(ENOMEM); 152. if (!nmemb) { ^ 153. av_freep(ptr); 154. return 0; libavutil/mem.c:153:9: 151. return AVERROR(ENOMEM); 152. if (!nmemb) { 153. av_freep(ptr); ^ 154. return 0; 155. } libavutil/mem.c:177:1: start of procedure av_freep() 175. } 176. 177. void av_freep(void *arg) ^ 178. { 179. void **ptr = (void **)arg; libavutil/mem.c:179:5: 177. void av_freep(void *arg) 178. { 179. void **ptr = (void **)arg; ^ 180. av_free(*ptr); 181. *ptr = NULL; libavutil/mem.c:180:5: 178. { 179. void **ptr = (void **)arg; 180. av_free(*ptr); ^ 181. *ptr = NULL; 182. } libavutil/mem.c:165:1: start of procedure av_free() 163. } 164. 165. void av_free(void *ptr) ^ 166. { 167. #if CONFIG_MEMALIGN_HACK libavutil/mem.c:173:5: 171. _aligned_free(ptr); 172. #else 173. free(ptr); ^ 174. #endif 175. } libavutil/mem.c:175:1: return from a call to av_free 173. free(ptr); 174. #endif 175. } ^ 176. 177. void av_freep(void *arg) libavutil/mem.c:181:5: 179. void **ptr = (void **)arg; 180. av_free(*ptr); 181. *ptr = NULL; ^ 182. } 183. libavutil/mem.c:182:1: return from a call to av_freep 180. av_free(*ptr); 181. *ptr = NULL; 182. } ^ 183. 184. void *av_mallocz(size_t size) libavutil/mem.c:154:9: 152. if (!nmemb) { 153. av_freep(ptr); 154. return 0; ^ 155. } 156. ret = av_realloc(*ptrptr, nmemb * size); libavutil/mem.c:163:1: return from a call to av_reallocp_array 161. *ptrptr = ret; 162. return 0; 163. } ^ 164. 165. void av_free(void *ptr) libavformat/matroskaenc.c:385:9: Taking false branch 383. return 0; 384. 385. if ((err = av_reallocp_array(&cues->entries, cues->num_entries + 1, ^ 386. sizeof(*cues->entries))) < 0) { 387. cues->num_entries = 0; libavformat/matroskaenc.c:391:5: 389. } 390. 391. cues->entries[cues->num_entries].pts = ts; ^ 392. cues->entries[cues->num_entries].tracknum = stream + 1; 393. cues->entries[cues->num_entries++].cluster_pos = cluster_pos - cues->segment_offset;
https://github.com/libav/libav/blob/00a63bfb87af6cf7bcdf85848830a90c7e052d41/libavformat/matroskaenc.c/#L391
d2a_code_trace_data_43640
static void unhook_drbg(RAND_DRBG *drbg) { HOOK_CTX *ctx = get_hook_ctx(drbg); drbg->get_entropy = ctx->get_entropy; CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DRBG, drbg, &drbg->ex_data); } test/drbgtest.c:554: error: NULL_DEREFERENCE pointer `ctx` last assigned on line 552 could be null and is dereferenced at line 554, column 25. Showing all 13 steps of the trace test/drbgtest.c:550:1: start of procedure unhook_drbg() 548. 549. /* Installs the hook for the get_entropy() callback of the given drbg */ 550. > static void unhook_drbg(RAND_DRBG *drbg) 551. { 552. HOOK_CTX *ctx = get_hook_ctx(drbg); test/drbgtest.c:552:5: 550. static void unhook_drbg(RAND_DRBG *drbg) 551. { 552. > HOOK_CTX *ctx = get_hook_ctx(drbg); 553. 554. drbg->get_entropy = ctx->get_entropy; test/drbgtest.c:515:1: start of procedure get_hook_ctx() 513. static HOOK_CTX master_ctx, public_ctx, private_ctx; 514. 515. > static HOOK_CTX *get_hook_ctx(RAND_DRBG *drbg) 516. { 517. return (HOOK_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); test/drbgtest.c:517:5: 515. static HOOK_CTX *get_hook_ctx(RAND_DRBG *drbg) 516. { 517. > return (HOOK_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); 518. } 519. crypto/rand/drbg_lib.c:911:1: start of procedure RAND_DRBG_get_ex_data() 909. } 910. 911. > void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx) 912. { 913. return CRYPTO_get_ex_data(&drbg->ex_data, idx); crypto/rand/drbg_lib.c:913:5: 911. void *RAND_DRBG_get_ex_data(const RAND_DRBG *drbg, int idx) 912. { 913. > return CRYPTO_get_ex_data(&drbg->ex_data, idx); 914. } 915. crypto/ex_data.c:394:1: start of procedure CRYPTO_get_ex_data() 392. * particular index in the class used by this variable 393. */ 394. > void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 395. { 396. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) crypto/ex_data.c:396:9: Taking true branch 394. void *CRYPTO_get_ex_data(const CRYPTO_EX_DATA *ad, int idx) 395. { 396. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) ^ 397. return NULL; 398. return sk_void_value(ad->sk, idx); crypto/ex_data.c:397:9: 395. { 396. if (ad->sk == NULL || idx >= sk_void_num(ad->sk)) 397. > return NULL; 398. return sk_void_value(ad->sk, idx); 399. } crypto/ex_data.c:399:1: return from a call to CRYPTO_get_ex_data 397. return NULL; 398. return sk_void_value(ad->sk, idx); 399. > } crypto/rand/drbg_lib.c:914:1: return from a call to RAND_DRBG_get_ex_data 912. { 913. return CRYPTO_get_ex_data(&drbg->ex_data, idx); 914. > } 915. 916. test/drbgtest.c:518:1: return from a call to get_hook_ctx 516. { 517. return (HOOK_CTX *)RAND_DRBG_get_ex_data(drbg, app_data_index); 518. > } 519. 520. /* Intercepts and counts calls to the get_entropy() callback */ test/drbgtest.c:554:5: 552. HOOK_CTX *ctx = get_hook_ctx(drbg); 553. 554. > drbg->get_entropy = ctx->get_entropy; 555. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_DRBG, drbg, &drbg->ex_data); 556. }
https://github.com/openssl/openssl/blob/b44882a0bd0717e0aab84f5dc3ef81ab673155e9/test/drbgtest.c/#L554
d2a_code_trace_data_43641
void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end, int snr_offset, int floor, uint8_t *bap) { int i, j, k, end1, v, address; if(snr_offset == -960) { memset(bap, 0, 256); return; } i = start; j = bin_to_band_tab[start]; do { v = (FFMAX(mask[j] - snr_offset - floor, 0) & 0x1FE0) + floor; end1 = FFMIN(band_start_tab[j] + ff_ac3_critical_band_size_tab[j], end); for (k = i; k < end1; k++) { address = av_clip((psd[i] - v) >> 5, 0, 63); bap[i] = ff_ac3_bap_tab[address]; i++; } } while (end > band_start_tab[j++]); } libavcodec/ac3enc.c:464: error: Buffer Overrun L1 Offset added: 256 Size: 48 by call to `ff_ac3_bit_alloc_calc_bap`. libavcodec/ac3enc.c:447:1: Parameter `(*bap)[*]` 445. } 446. 447. static int bit_alloc(AC3EncodeContext *s, ^ 448. int16_t mask[NB_BLOCKS][AC3_MAX_CHANNELS][50], 449. int16_t psd[NB_BLOCKS][AC3_MAX_CHANNELS][N/2], libavcodec/ac3enc.c:464:13: Call 462. s->mant4_cnt = 0; 463. for(ch=0;ch<s->nb_all_channels;ch++) { 464. ff_ac3_bit_alloc_calc_bap(mask[i][ch], psd[i][ch], 0, ^ 465. s->nb_coefs[ch], snr_offset, 466. s->bit_alloc.floor, bap[i][ch]); libavcodec/ac3.c:175:1: <Length trace> 173. } 174. 175. void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end, ^ 176. int snr_offset, int floor, uint8_t *bap) 177. { libavcodec/ac3.c:175:1: Parameter `*bap` 173. } 174. 175. void ff_ac3_bit_alloc_calc_bap(int16_t *mask, int16_t *psd, int start, int end, ^ 176. int snr_offset, int floor, uint8_t *bap) 177. { libavcodec/ac3.c:182:9: Array access: Offset added: 256 Size: 48 by call to `ff_ac3_bit_alloc_calc_bap` 180. /* special case, if snr offset is -960, set all bap's to zero */ 181. if(snr_offset == -960) { 182. memset(bap, 0, 256); ^ 183. return; 184. }
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/ac3.c/#L182
d2a_code_trace_data_43642
int TIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s) { TIFFDirectory *td = &tif->tif_dir; if (x >= td->td_imagewidth) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Col out of range, max %lu", (unsigned long) x, (unsigned long) (td->td_imagewidth - 1)); return (0); } if (y >= td->td_imagelength) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Row out of range, max %lu", (unsigned long) y, (unsigned long) (td->td_imagelength - 1)); return (0); } if (z >= td->td_imagedepth) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Depth out of range, max %lu", (unsigned long) z, (unsigned long) (td->td_imagedepth - 1)); return (0); } if (td->td_planarconfig == PLANARCONFIG_SEPARATE && s >= td->td_samplesperpixel) { TIFFErrorExt(tif->tif_clientdata, tif->tif_name, "%lu: Sample out of range, max %lu", (unsigned long) s, (unsigned long) (td->td_samplesperpixel - 1)); return (0); } return (1); } libtiff/tif_getimage.c:722: error: Integer Overflow L2 ([0, +oo] - 1):unsigned32 by call to `TIFFReadTile`. libtiff/tif_getimage.c:722:8: Call 720. for (col = 0; col < w; col += tw) 721. { 722. if (TIFFReadTile(tif, p0, col+img->col_offset, ^ 723. row+img->row_offset,0,0)!=(tmsize_t)(-1) && img->stoponerr) 724. { libtiff/tif_read.c:415:1: Parameter `tif->tif_dir.td_imagewidth` 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_getimage.c:728:8: Call 726. break; 727. } 728. if (TIFFReadTile(tif, p1, col+img->col_offset, ^ 729. row+img->row_offset,0,1)!=(tmsize_t)(-1) && img->stoponerr) 730. { libtiff/tif_read.c:415:1: Parameter `tif->tif_dir.td_imagewidth` 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_getimage.c:734:8: Call 732. break; 733. } 734. if (TIFFReadTile(tif, p2, col+img->col_offset, ^ 735. row+img->row_offset,0,2)!=(tmsize_t)(-1) && img->stoponerr) 736. { libtiff/tif_read.c:415:1: Parameter `tif->tif_dir.td_imagewidth` 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_getimage.c:722:8: Call 720. for (col = 0; col < w; col += tw) 721. { 722. if (TIFFReadTile(tif, p0, col+img->col_offset, ^ 723. row+img->row_offset,0,0)!=(tmsize_t)(-1) && img->stoponerr) 724. { libtiff/tif_read.c:415:1: Parameter `tif->tif_dir.td_imagewidth` 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:418:33: Call 416. TIFFReadTile(TIFF* tif, void* buf, uint32 x, uint32 y, uint32 z, uint16 s) 417. { 418. if (!TIFFCheckRead(tif, 1) || !TIFFCheckTile(tif, x, y, z, s)) ^ 419. return ((tmsize_t)(-1)); 420. return (TIFFReadEncodedTile(tif, libtiff/tif_tile.c:100:1: <LHS trace> 98. * against the image bounds. 99. */ 100. int ^ 101. TIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s) 102. { libtiff/tif_tile.c:100:1: Parameter `x` 98. * against the image bounds. 99. */ 100. int ^ 101. TIFFCheckTile(TIFF* tif, uint32 x, uint32 y, uint32 z, uint16 s) 102. { libtiff/tif_tile.c:106:3: Binary operation: ([0, +oo] - 1):unsigned32 by call to `TIFFReadTile` 104. 105. if (x >= td->td_imagewidth) { 106. TIFFErrorExt(tif->tif_clientdata, tif->tif_name, ^ 107. "%lu: Col out of range, max %lu", 108. (unsigned long) x,
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_tile.c/#L106
d2a_code_trace_data_43643
DECLAREContigPutFunc(put2bitbwtile) { uint32** BWmap = img->BWmap; (void) x; (void) y; fromskew /= 4; while (h-- > 0) { uint32* bw; UNROLL4(w, bw = BWmap[*pp++], *cp++ = *bw++); cp += toskew; pp += fromskew; } } libtiff/tif_getimage.c:1208: error: Integer Overflow L2 ([0, `h`] - 1):unsigned32. libtiff/tif_getimage.c:1202:1: <LHS trace> 1200. * 2-bit greyscale => colormap/RGB 1201. */ 1202. DECLAREContigPutFunc(put2bitbwtile) ^ 1203. { 1204. uint32** BWmap = img->BWmap; libtiff/tif_getimage.c:1202:1: Parameter `h` 1200. * 2-bit greyscale => colormap/RGB 1201. */ 1202. DECLAREContigPutFunc(put2bitbwtile) ^ 1203. { 1204. uint32** BWmap = img->BWmap; libtiff/tif_getimage.c:1208:12: Binary operation: ([0, h] - 1):unsigned32 1206. (void) x; (void) y; 1207. fromskew /= 4; 1208. while (h-- > 0) { ^ 1209. uint32* bw; 1210. UNROLL4(w, bw = BWmap[*pp++], *cp++ = *bw++);
https://gitlab.com/libtiff/libtiff/blob/771a4ea0a98c7a218c9f3add9a05e08d29625758/libtiff/tif_getimage.c/#L1208
d2a_code_trace_data_43644
static int var_diamond_search(MpegEncContext * s, int *best, int dmin, int src_index, int ref_index, int const penalty_factor, int size, int h, int flags) { MotionEstContext * const c= &s->me; me_cmp_func cmpf, chroma_cmpf; int dia_size; LOAD_COMMON LOAD_COMMON2 int map_generation= c->map_generation; cmpf= s->dsp.me_cmp[size]; chroma_cmpf= s->dsp.me_cmp[size+1]; for(dia_size=1; dia_size<=c->dia_size; dia_size++){ int dir, start, end; const int x= best[0]; const int y= best[1]; start= FFMAX(0, y + dia_size - ymax); end = FFMIN(dia_size, xmax - x + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x + dir , y + dia_size - dir); } start= FFMAX(0, x + dia_size - xmax); end = FFMIN(dia_size, y - ymin + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x + dia_size - dir, y - dir ); } start= FFMAX(0, -y + dia_size + ymin ); end = FFMIN(dia_size, x - xmin + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x - dir , y - dia_size + dir); } start= FFMAX(0, -x + dia_size + xmin ); end = FFMIN(dia_size, ymax - y + 1); for(dir= start; dir<end; dir++){ int d; CHECK_MV(x - dia_size + dir, y + dir ); } if(x!=best[0] || y!=best[1]) dia_size=0; #if 0 { int dx, dy, i; static int stats[8*8]; dx= FFABS(x-best[0]); dy= FFABS(y-best[1]); stats[dy*8 + dx] ++; if(256*256*256*64 % (stats[0]+1)==0){ for(i=0; i<64; i++){ if((i&7)==0) printf("\n"); printf("%6d ", stats[i]); } printf("\n"); } } #endif } return dmin; } libavcodec/motion_est_template.c:933: error: Uninitialized Value The value read from ymin was never initialized. libavcodec/motion_est_template.c:933:16: 931. } 932. 933. start= FFMAX(0, -y + dia_size + ymin ); ^ 934. end = FFMIN(dia_size, x - xmin + 1); 935. for(dir= start; dir<end; dir++){
https://github.com/libav/libav/blob/3ec394ea823c2a6e65a6abbdb2041ce1c66964f8/libavcodec/motion_est_template.c/#L933
d2a_code_trace_data_43645
static int estimate_best_b_count(MpegEncContext *s) { AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id); AVCodecContext *c = avcodec_alloc_context3(NULL); AVFrame input[FF_MAX_B_FRAMES + 2]; const int scale = s->avctx->brd_scale; int i, j, out_size, p_lambda, b_lambda, lambda2; int outbuf_size = s->width * s->height; uint8_t *outbuf = av_malloc(outbuf_size); 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 | CODEC_FLAG_INPUT_PRESERVED ; 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 = 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++) { int ysize = c->width * c->height; int csize = (c->width / 2) * (c->height / 2); Picture pre_input, *pre_input_ptr = i ? s->input_picture[i - 1] : s->next_picture_ptr; avcodec_get_frame_defaults(&input[i]); input[i].data[0] = av_malloc(ysize + 2 * csize); input[i].data[1] = input[i].data[0] + ysize; input[i].data[2] = input[i].data[1] + csize; input[i].linesize[0] = c->width; input[i].linesize[1] = input[i].linesize[2] = c->width / 2; if (pre_input_ptr && (!i || s->input_picture[i - 1])) { pre_input = *pre_input_ptr; if (pre_input.f.type != FF_BUFFER_TYPE_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](input[i].data[0], input[i].linesize[0], pre_input.f.data[0], pre_input.f.linesize[0], c->width, c->height); s->dsp.shrink[scale](input[i].data[1], input[i].linesize[1], pre_input.f.data[1], pre_input.f.linesize[1], c->width >> 1, c->height >> 1); s->dsp.shrink[scale](input[i].data[2], input[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; input[0].pict_type = AV_PICTURE_TYPE_I; input[0].quality = 1 * FF_QP2LAMBDA; out_size = avcodec_encode_video(c, outbuf, outbuf_size, &input[0]); for (i = 0; i < s->max_b_frames + 1; i++) { int is_p = i % (j + 1) == j || i == s->max_b_frames; input[i + 1].pict_type = is_p ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_B; input[i + 1].quality = is_p ? p_lambda : b_lambda; out_size = avcodec_encode_video(c, outbuf, outbuf_size, &input[i + 1]); rd += (out_size * lambda2) >> (FF_LAMBDA_SHIFT - 3); } while (out_size) { out_size = avcodec_encode_video(c, outbuf, outbuf_size, 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; } } av_freep(&outbuf); avcodec_close(c); av_freep(&c); for (i = 0; i < s->max_b_frames + 2; i++) { av_freep(&input[i].data[0]); } return best_b_count; } libavcodec/mpegvideo_enc.c:1107: error: Null Dereference pointer `c` last assigned on line 1086 could be null and is dereferenced at line 1107, column 5. libavcodec/mpegvideo_enc.c:1083:1: start of procedure estimate_best_b_count() 1081. } 1082. 1083. static int estimate_best_b_count(MpegEncContext *s) ^ 1084. { 1085. AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id); libavcodec/mpegvideo_enc.c:1085:5: Skipping avcodec_find_encoder(): empty list of specs 1083. static int estimate_best_b_count(MpegEncContext *s) 1084. { 1085. AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id); ^ 1086. AVCodecContext *c = avcodec_alloc_context3(NULL); 1087. AVFrame input[FF_MAX_B_FRAMES + 2]; libavcodec/mpegvideo_enc.c:1086:5: 1084. { 1085. AVCodec *codec = avcodec_find_encoder(s->avctx->codec_id); 1086. AVCodecContext *c = avcodec_alloc_context3(NULL); ^ 1087. AVFrame input[FF_MAX_B_FRAMES + 2]; 1088. const int scale = s->avctx->brd_scale; libavcodec/options.c:486:1: start of procedure avcodec_alloc_context3() 484. } 485. 486. AVCodecContext *avcodec_alloc_context3(AVCodec *codec){ ^ 487. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); 488. libavcodec/options.c:487:5: 485. 486. AVCodecContext *avcodec_alloc_context3(AVCodec *codec){ 487. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); ^ 488. 489. if(avctx==NULL) return NULL; libavutil/mem.c:64:1: start of procedure av_malloc() 62. linker will do it automatically. */ 63. 64. void *av_malloc(size_t size) ^ 65. { 66. void *ptr = NULL; libavutil/mem.c:66:5: 64. void *av_malloc(size_t size) 65. { 66. void *ptr = NULL; ^ 67. #if CONFIG_MEMALIGN_HACK 68. long diff; libavutil/mem.c:72:8: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) ^ 73. return NULL; 74. libavutil/mem.c:83:9: Taking false branch 81. ((char*)ptr)[-1]= diff; 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,32,size)) ^ 84. ptr = NULL; 85. #elif HAVE_MEMALIGN libavutil/mem.c:114:5: 112. ptr = malloc(size); 113. #endif 114. return ptr; ^ 115. } 116. libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavcodec/options.c:489:8: Taking true branch 487. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); 488. 489. if(avctx==NULL) return NULL; ^ 490. 491. if(avcodec_get_context_defaults3(avctx, codec) < 0){ libavcodec/options.c:489:21: 487. AVCodecContext *avctx= av_malloc(sizeof(AVCodecContext)); 488. 489. if(avctx==NULL) return NULL; ^ 490. 491. if(avcodec_get_context_defaults3(avctx, codec) < 0){ libavcodec/options.c:497:1: return from a call to avcodec_alloc_context3 495. 496. return avctx; 497. } ^ 498. 499. int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src) libavcodec/mpegvideo_enc.c:1088:5: 1086. AVCodecContext *c = avcodec_alloc_context3(NULL); 1087. AVFrame input[FF_MAX_B_FRAMES + 2]; 1088. const int scale = s->avctx->brd_scale; ^ 1089. int i, j, out_size, p_lambda, b_lambda, lambda2; 1090. int outbuf_size = s->width * s->height; // FIXME libavcodec/mpegvideo_enc.c:1090:5: 1088. const int scale = s->avctx->brd_scale; 1089. int i, j, out_size, p_lambda, b_lambda, lambda2; 1090. int outbuf_size = s->width * s->height; // FIXME ^ 1091. uint8_t *outbuf = av_malloc(outbuf_size); 1092. int64_t best_rd = INT64_MAX; libavcodec/mpegvideo_enc.c:1091:5: 1089. int i, j, out_size, p_lambda, b_lambda, lambda2; 1090. int outbuf_size = s->width * s->height; // FIXME 1091. uint8_t *outbuf = av_malloc(outbuf_size); ^ 1092. int64_t best_rd = INT64_MAX; 1093. int best_b_count = -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:72:8: Taking false branch 70. 71. /* let's disallow possible ambiguous cases */ 72. if(size > (INT_MAX-32) ) ^ 73. return NULL; 74. libavutil/mem.c:83:9: Taking false branch 81. ((char*)ptr)[-1]= diff; 82. #elif HAVE_POSIX_MEMALIGN 83. if (posix_memalign(&ptr,32,size)) ^ 84. ptr = NULL; 85. #elif HAVE_MEMALIGN libavutil/mem.c:114:5: 112. ptr = malloc(size); 113. #endif 114. return ptr; ^ 115. } 116. libavutil/mem.c:115:1: return from a call to av_malloc 113. #endif 114. return ptr; 115. } ^ 116. 117. void *av_realloc(void *ptr, size_t size) libavcodec/mpegvideo_enc.c:1092:5: 1090. int outbuf_size = s->width * s->height; // FIXME 1091. uint8_t *outbuf = av_malloc(outbuf_size); 1092. int64_t best_rd = INT64_MAX; ^ 1093. int best_b_count = -1; 1094. libavcodec/mpegvideo_enc.c:1093:5: 1091. uint8_t *outbuf = av_malloc(outbuf_size); 1092. int64_t best_rd = INT64_MAX; 1093. int best_b_count = -1; ^ 1094. 1095. assert(scale >= 0 && scale <= 3); libavcodec/mpegvideo_enc.c:1095:5: 1093. int best_b_count = -1; 1094. 1095. assert(scale >= 0 && scale <= 3); ^ 1096. 1097. //emms_c(); libavcodec/mpegvideo_enc.c:1099:5: 1097. //emms_c(); 1098. //s->next_picture_ptr->quality; 1099. p_lambda = s->last_lambda_for[AV_PICTURE_TYPE_P]; ^ 1100. //p_lambda * FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; 1101. b_lambda = s->last_lambda_for[AV_PICTURE_TYPE_B]; libavcodec/mpegvideo_enc.c:1101:5: 1099. p_lambda = s->last_lambda_for[AV_PICTURE_TYPE_P]; 1100. //p_lambda * FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; 1101. b_lambda = s->last_lambda_for[AV_PICTURE_TYPE_B]; ^ 1102. if (!b_lambda) // FIXME we should do this somewhere else 1103. b_lambda = p_lambda; libavcodec/mpegvideo_enc.c:1102:10: Taking false branch 1100. //p_lambda * FFABS(s->avctx->b_quant_factor) + s->avctx->b_quant_offset; 1101. b_lambda = s->last_lambda_for[AV_PICTURE_TYPE_B]; 1102. if (!b_lambda) // FIXME we should do this somewhere else ^ 1103. b_lambda = p_lambda; 1104. lambda2 = (b_lambda * b_lambda + (1 << FF_LAMBDA_SHIFT) / 2) >> libavcodec/mpegvideo_enc.c:1104:5: 1102. if (!b_lambda) // FIXME we should do this somewhere else 1103. b_lambda = p_lambda; 1104. lambda2 = (b_lambda * b_lambda + (1 << FF_LAMBDA_SHIFT) / 2) >> ^ 1105. FF_LAMBDA_SHIFT; 1106. libavcodec/mpegvideo_enc.c:1107:5: 1105. FF_LAMBDA_SHIFT; 1106. 1107. c->width = s->width >> scale; ^ 1108. c->height = s->height >> scale; 1109. c->flags = CODEC_FLAG_QSCALE | CODEC_FLAG_PSNR |
https://github.com/libav/libav/blob/cc412b71047ebf77c7e810c90b044f018a1c0c2d/libavcodec/mpegvideo_enc.c/#L1107
d2a_code_trace_data_43646
void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) { unsigned long hash; OPENSSL_LH_NODE *nn, **rn; void *ret; lh->error = 0; rn = getrn(lh, data, &hash); if (*rn == NULL) { lh->num_no_delete++; return (NULL); } else { nn = *rn; *rn = nn->next; ret = nn->data; OPENSSL_free(nn); lh->num_delete++; } lh->num_items--; if ((lh->num_nodes > MIN_NODES) && (lh->down_load >= (lh->num_items * LH_LOAD_MULT / lh->num_nodes))) contract(lh); return (ret); } ssl/statem/statem.c:332: error: INTEGER_OVERFLOW_L2 ([0, max(0, `s->session_ctx->sessions->num_items`)] - 1):unsigned64 by call to `tls_setup_handshake`. Showing all 15 steps of the trace ssl/statem/statem.c:230:1: Parameter `s->session_ctx->sessions->num_items` 228. * <=0: NBIO or error 229. */ 230. > static int state_machine(SSL *s, int server) 231. { 232. BUF_MEM *buf = NULL; ssl/statem/statem.c:332:18: Call 330. && s->early_data_state != SSL_EARLY_DATA_FINISHED_READING) 331. || s->renegotiate) { 332. if (!tls_setup_handshake(s)) { ^ 333. ossl_statem_set_error(s); 334. goto end; ssl/statem/statem_lib.c:75:1: Parameter `s->session_ctx->sessions->num_items` 73. } 74. 75. > int tls_setup_handshake(SSL *s) 76. { 77. if (!ssl3_init_finished_mac(s)) ssl/statem/statem_lib.c:92:13: Call 90. SSLerr(SSL_F_TLS_SETUP_HANDSHAKE, 91. SSL_R_UNSAFE_LEGACY_RENEGOTIATION_DISABLED); 92. ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE); ^ 93. return 0; 94. } else { ssl/s3_msg.c:63:1: Parameter `s->session_ctx->sessions->num_items` 61. } 62. 63. > int ssl3_send_alert(SSL *s, int level, int desc) 64. { 65. /* Map tls/ssl alert value to correct one */ ssl/s3_msg.c:77:9: Call 75. /* If a fatal one, remove from cache */ 76. if ((level == SSL3_AL_FATAL) && (s->session != NULL)) 77. SSL_CTX_remove_session(s->session_ctx, s->session); ^ 78. 79. s->s3->alert_dispatch = 1; ssl/ssl_sess.c:724:1: Parameter `ctx->sessions->num_items` 722. } 723. 724. > int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 725. { 726. return remove_session_lock(ctx, c, 1); ssl/ssl_sess.c:726:12: Call 724. int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c) 725. { 726. return remove_session_lock(ctx, c, 1); ^ 727. } 728. ssl/ssl_sess.c:729:1: Parameter `ctx->sessions->num_items` 727. } 728. 729. > static int remove_session_lock(SSL_CTX *ctx, SSL_SESSION *c, int lck) 730. { 731. SSL_SESSION *r; ssl/ssl_sess.c:739:17: Call 737. if ((r = lh_SSL_SESSION_retrieve(ctx->sessions, c)) == c) { 738. ret = 1; 739. r = lh_SSL_SESSION_delete(ctx->sessions, c); ^ 740. SSL_SESSION_list_remove(ctx, c); 741. } ssl/ssl_locl.h:684:1: Parameter `lh->num_items` 682. } CLIENTHELLO_MSG; 683. 684. > DEFINE_LHASH_OF(SSL_SESSION); 685. /* Needed in ssl_cert.c */ 686. DEFINE_LHASH_OF(X509_NAME); ssl/ssl_locl.h:684:1: Call 682. } CLIENTHELLO_MSG; 683. 684. > DEFINE_LHASH_OF(SSL_SESSION); 685. /* Needed in ssl_cert.c */ 686. DEFINE_LHASH_OF(X509_NAME); crypto/lhash/lhash.c:103:1: <LHS trace> 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:103:1: Parameter `lh->num_items` 101. } 102. 103. > void *OPENSSL_LH_delete(OPENSSL_LHASH *lh, const void *data) 104. { 105. unsigned long hash; crypto/lhash/lhash.c:123:5: Binary operation: ([0, max(0, s->session_ctx->sessions->num_items)] - 1):unsigned64 by call to `tls_setup_handshake` 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/538bea6c8184670a8d1608ef288a4e1813dcefa6/crypto/lhash/lhash.c/#L123
d2a_code_trace_data_43647
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/ec_key.c:253: error: BUFFER_OVERRUN_L3 Offset added: [8, +oo] Size: [0, 536870848] by call to `EC_POINT_mul`. Showing all 19 steps of the trace crypto/ec/ec_key.c:241:14: Call 239. */ 240. do 241. if (!BN_priv_rand_range(priv_key, order)) ^ 242. goto err; 243. while (BN_is_zero(priv_key)) ; crypto/bn/bn_rand.c:184:12: Call 182. int BN_priv_rand_range(BIGNUM *r, const BIGNUM *range) 183. { 184. return bnrand_range(PRIVATE, r, range); ^ 185. } 186. crypto/bn/bn_rand.c:113:1: Parameter `r->top` 111. 112. /* random number r: 0 <= r < range */ 113. > static int bnrand_range(BNRAND_FLAG flag, BIGNUM *r, const BIGNUM *range) 114. { 115. int n; crypto/ec/ec_key.c:253:10: Call 251. 252. /* Step (8) : pub_key = priv_key * G (where G is a point on the curve) */ 253. if (!EC_POINT_mul(group, pub_key, priv_key, NULL, NULL, NULL)) ^ 254. goto err; 255. 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_43648
int ssl3_cbc_copy_mac(unsigned char *out, const SSL3_RECORD *rec, size_t md_size) { #if defined(CBC_MAC_ROTATE_IN_PLACE) unsigned char rotated_mac_buf[64 + EVP_MAX_MD_SIZE]; unsigned char *rotated_mac; #else unsigned char rotated_mac[EVP_MAX_MD_SIZE]; #endif size_t mac_end = rec->length; size_t mac_start = mac_end - md_size; size_t in_mac; size_t scan_start = 0; size_t i, j; size_t rotate_offset; if (!ossl_assert(rec->orig_len >= md_size && md_size <= EVP_MAX_MD_SIZE)) return 0; #if defined(CBC_MAC_ROTATE_IN_PLACE) rotated_mac = rotated_mac_buf + ((0 - (size_t)rotated_mac_buf) & 63); #endif if (rec->orig_len > md_size + 255 + 1) scan_start = rec->orig_len - (md_size + 255 + 1); in_mac = 0; rotate_offset = 0; memset(rotated_mac, 0, md_size); for (i = scan_start, j = 0; i < rec->orig_len; i++) { size_t mac_started = constant_time_eq_s(i, mac_start); size_t mac_ended = constant_time_lt_s(i, mac_end); unsigned char b = rec->data[i]; in_mac |= mac_started; in_mac &= mac_ended; rotate_offset |= j & mac_started; rotated_mac[j++] |= b & in_mac; j &= constant_time_lt_s(j, md_size); } #if defined(CBC_MAC_ROTATE_IN_PLACE) j = 0; for (i = 0; i < md_size; i++) { ((volatile unsigned char *)rotated_mac)[rotate_offset ^ 32]; out[j++] = rotated_mac[rotate_offset++]; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); } #else memset(out, 0, md_size); rotate_offset = md_size - rotate_offset; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); for (i = 0; i < md_size; i++) { for (j = 0; j < md_size; j++) out[j] |= rotated_mac[i] & constant_time_eq_8_s(j, rotate_offset); rotate_offset++; rotate_offset &= constant_time_lt_s(rotate_offset, md_size); } #endif return 1; } ssl/record/rec_layer_d1.c:279: error: INTEGER_OVERFLOW_L2 ([0, +oo] - [0, 64]):unsigned64 by call to `dtls1_process_record`. Showing all 10 steps of the trace ssl/record/rec_layer_d1.c:222:1: Parameter `s->rlayer.rrec.length` 220. &((s)->rlayer.d->unprocessed_rcds)) 221. 222. > int dtls1_process_buffered_records(SSL *s) 223. { 224. pitem *item; ssl/record/rec_layer_d1.c:279:31: Call 277. } 278. 279. if (!replayok || !dtls1_process_record(s, bitmap)) { ^ 280. /* dump this record */ 281. rr->length = 0; ssl/record/ssl3_record.c:1495:1: Parameter `s->rlayer.rrec.length` 1493. } 1494. 1495. > int dtls1_process_record(SSL *s, DTLS1_BITMAP *bitmap) 1496. { 1497. int i, al; ssl/record/ssl3_record.c:1628:18: Call 1626. */ 1627. mac = mac_tmp; 1628. if (!ssl3_cbc_copy_mac(mac_tmp, rr, mac_size)) { ^ 1629. al = SSL_AD_INTERNAL_ERROR; 1630. SSLerr(SSL_F_DTLS1_PROCESS_RECORD, ERR_R_INTERNAL_ERROR); ssl/record/ssl3_record.c:1420:1: <LHS trace> 1418. #define CBC_MAC_ROTATE_IN_PLACE 1419. 1420. > int ssl3_cbc_copy_mac(unsigned char *out, 1421. const SSL3_RECORD *rec, size_t md_size) 1422. { ssl/record/ssl3_record.c:1420:1: Parameter `rec->length` 1418. #define CBC_MAC_ROTATE_IN_PLACE 1419. 1420. > int ssl3_cbc_copy_mac(unsigned char *out, 1421. const SSL3_RECORD *rec, size_t md_size) 1422. { ssl/record/ssl3_record.c:1433:5: Assignment 1431. * mac_end is the index of |rec->data| just after the end of the MAC. 1432. */ 1433. size_t mac_end = rec->length; ^ 1434. size_t mac_start = mac_end - md_size; 1435. size_t in_mac; ssl/record/ssl3_record.c:1420:1: <RHS trace> 1418. #define CBC_MAC_ROTATE_IN_PLACE 1419. 1420. > int ssl3_cbc_copy_mac(unsigned char *out, 1421. const SSL3_RECORD *rec, size_t md_size) 1422. { ssl/record/ssl3_record.c:1420:1: Parameter `md_size` 1418. #define CBC_MAC_ROTATE_IN_PLACE 1419. 1420. > int ssl3_cbc_copy_mac(unsigned char *out, 1421. const SSL3_RECORD *rec, size_t md_size) 1422. { ssl/record/ssl3_record.c:1434:5: Binary operation: ([0, +oo] - [0, 64]):unsigned64 by call to `dtls1_process_record` 1432. */ 1433. size_t mac_end = rec->length; 1434. size_t mac_start = mac_end - md_size; ^ 1435. size_t in_mac; 1436. /*
https://github.com/openssl/openssl/blob/7f7eb90b8ac55997c5c825bb3ebcfe28611e06f5/ssl/record/ssl3_record.c/#L1434
d2a_code_trace_data_43649
static enum SUB_STATE_RETURN write_state_machine(SSL *s) { STATEM *st = &s->statem; int ret; enum WRITE_TRAN (*transition)(SSL *s); enum WORK_STATE (*pre_work)(SSL *s, enum WORK_STATE wst); enum WORK_STATE (*post_work)(SSL *s, enum WORK_STATE wst); int (*construct_message)(SSL *s); void (*cb) (const SSL *ssl, int type, int val) = NULL; if (s->info_callback != NULL) cb = s->info_callback; else if (s->ctx->info_callback != NULL) cb = s->ctx->info_callback; if(s->server) { transition = NULL; pre_work = NULL; post_work = NULL; construct_message = NULL; } else { transition = NULL; pre_work = NULL; post_work = NULL; construct_message = NULL; } while(1) { switch(st->write_state) { case WRITE_STATE_TRANSITION: if (cb != NULL) { if (s->server) cb(s, SSL_CB_ACCEPT_LOOP, 1); else cb(s, SSL_CB_CONNECT_LOOP, 1); } switch(transition(s)) { case WRITE_TRAN_CONTINUE: st->write_state = WRITE_STATE_PRE_WORK; st->write_state_work = WORK_MORE_A; break; case WRITE_TRAN_FINISHED: return SUB_STATE_FINISHED; break; default: return SUB_STATE_ERROR; } break; case WRITE_STATE_PRE_WORK: switch(st->write_state_work = pre_work(s, st->write_state_work)) { default: return SUB_STATE_ERROR; case WORK_FINISHED_CONTINUE: st->write_state = WRITE_STATE_SEND; break; case WORK_FINISHED_STOP: return SUB_STATE_END_HANDSHAKE; } if(construct_message(s) == 0) return SUB_STATE_ERROR; case WRITE_STATE_SEND: if (SSL_IS_DTLS(s) && st->use_timer) { dtls1_start_timer(s); } ret = statem_do_write(s); if (ret <= 0) { return SUB_STATE_ERROR; } st->write_state = WRITE_STATE_POST_WORK; st->write_state_work = WORK_MORE_A; case WRITE_STATE_POST_WORK: switch(st->write_state_work = post_work(s, st->write_state_work)) { default: return SUB_STATE_ERROR; case WORK_FINISHED_CONTINUE: st->write_state = WRITE_STATE_TRANSITION; break; case WORK_FINISHED_STOP: return SUB_STATE_END_HANDSHAKE; } break; default: return SUB_STATE_ERROR; } } } ssl/statem.c:659: error: NULL_DEREFERENCE pointer `pre_work` last assigned on line 622 could be null and is dereferenced at line 659, column 43. Showing all 16 steps of the trace ssl/statem.c:604:1: start of procedure write_state_machine() 602. * result in an NBIO event. 603. */ 604. > static enum SUB_STATE_RETURN write_state_machine(SSL *s) 605. { 606. STATEM *st = &s->statem; ssl/statem.c:606:5: 604. static enum SUB_STATE_RETURN write_state_machine(SSL *s) 605. { 606. > STATEM *st = &s->statem; 607. int ret; 608. enum WRITE_TRAN (*transition)(SSL *s); ssl/statem.c:612:5: 610. enum WORK_STATE (*post_work)(SSL *s, enum WORK_STATE wst); 611. int (*construct_message)(SSL *s); 612. > void (*cb) (const SSL *ssl, int type, int val) = NULL; 613. 614. if (s->info_callback != NULL) ssl/statem.c:614:9: Taking false branch 612. void (*cb) (const SSL *ssl, int type, int val) = NULL; 613. 614. if (s->info_callback != NULL) ^ 615. cb = s->info_callback; 616. else if (s->ctx->info_callback != NULL) ssl/statem.c:616:14: Taking true branch 614. if (s->info_callback != NULL) 615. cb = s->info_callback; 616. else if (s->ctx->info_callback != NULL) ^ 617. cb = s->ctx->info_callback; 618. ssl/statem.c:617:9: 615. cb = s->info_callback; 616. else if (s->ctx->info_callback != NULL) 617. > cb = s->ctx->info_callback; 618. 619. if(s->server) { ssl/statem.c:619:8: Taking true branch 617. cb = s->ctx->info_callback; 618. 619. if(s->server) { ^ 620. /* TODO: Fill these in later when we've implemented them */ 621. transition = NULL; ssl/statem.c:621:9: 619. if(s->server) { 620. /* TODO: Fill these in later when we've implemented them */ 621. > transition = NULL; 622. pre_work = NULL; 623. post_work = NULL; ssl/statem.c:622:9: 620. /* TODO: Fill these in later when we've implemented them */ 621. transition = NULL; 622. > pre_work = NULL; 623. post_work = NULL; 624. construct_message = NULL; ssl/statem.c:623:9: 621. transition = NULL; 622. pre_work = NULL; 623. > post_work = NULL; 624. construct_message = NULL; 625. } else { ssl/statem.c:624:9: 622. pre_work = NULL; 623. post_work = NULL; 624. > construct_message = NULL; 625. } else { 626. /* TODO: Fill these in later when we've implemented them */ ssl/statem.c:633:11: Loop condition is true. Entering loop body 631. } 632. 633. while(1) { ^ 634. switch(st->write_state) { 635. case WRITE_STATE_TRANSITION: ssl/statem.c:634:9: 632. 633. while(1) { 634. > switch(st->write_state) { 635. case WRITE_STATE_TRANSITION: 636. if (cb != NULL) { ssl/statem.c:635:9: Switch condition is false. Skipping switch case 633. while(1) { 634. switch(st->write_state) { 635. case WRITE_STATE_TRANSITION: ^ 636. if (cb != NULL) { 637. /* Notify callback of an impending state change */ ssl/statem.c:658:9: Switch condition is true. Entering switch case 656. break; 657. 658. case WRITE_STATE_PRE_WORK: ^ 659. switch(st->write_state_work = pre_work(s, st->write_state_work)) { 660. default: ssl/statem.c:659:13: 657. 658. case WRITE_STATE_PRE_WORK: 659. > switch(st->write_state_work = pre_work(s, st->write_state_work)) { 660. default: 661. return SUB_STATE_ERROR;
https://github.com/openssl/openssl/blob/f8e0a5573820bd7318782d4954c6643ff7e58102/ssl/statem.c/#L659
d2a_code_trace_data_43650
static void opt_vstats (void) { char filename[40]; time_t today2 = time(NULL); struct tm *today = localtime(&today2); snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, today->tm_sec); opt_vstats_file(filename); } ffmpeg.c:3670: error: Null Dereference pointer `today` last assigned on line 3668 could be null and is dereferenced at line 3670, column 69. ffmpeg.c:3664:1: start of procedure opt_vstats() 3662. } 3663. 3664. static void opt_vstats (void) ^ 3665. { 3666. char filename[40]; ffmpeg.c:3667:5: 3665. { 3666. char filename[40]; 3667. time_t today2 = time(NULL); ^ 3668. struct tm *today = localtime(&today2); 3669. ffmpeg.c:3668:5: 3666. char filename[40]; 3667. time_t today2 = time(NULL); 3668. struct tm *today = localtime(&today2); ^ 3669. 3670. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, ffmpeg.c:3670:5: 3668. struct tm *today = localtime(&today2); 3669. 3670. snprintf(filename, sizeof(filename), "vstats_%02d%02d%02d.log", today->tm_hour, today->tm_min, ^ 3671. today->tm_sec); 3672. opt_vstats_file(filename);
https://github.com/libav/libav/blob/184bc53db4fded8857af09cee2adc7197940deb7/ffmpeg.c/#L3670
d2a_code_trace_data_43651
int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) { int i, nw, lb, rb; BN_ULONG *t, *f; BN_ULONG l; bn_check_top(r); bn_check_top(a); if (n < 0) { BNerr(BN_F_BN_LSHIFT, BN_R_INVALID_SHIFT); return 0; } r->neg = a->neg; nw = n / BN_BITS2; if (bn_wexpand(r, a->top + nw + 1) == NULL) return (0); lb = n % BN_BITS2; rb = BN_BITS2 - lb; f = a->d; t = r->d; t[a->top + nw] = 0; if (lb == 0) for (i = a->top - 1; i >= 0; i--) t[nw + i] = f[i]; else for (i = a->top - 1; i >= 0; i--) { l = f[i]; t[nw + i + 1] |= (l >> rb) & BN_MASK2; t[nw + i] = (l << lb) & BN_MASK2; } memset(t, 0, sizeof(*t) * nw); r->top = a->top + nw + 1; bn_correct_top(r); bn_check_top(r); return (1); } crypto/ec/ec_ameth.c:435: error: BUFFER_OVERRUN_L3 Offset: [1, +oo] Size: [0, 8388607] by call to `d2i_ECPrivateKey`. Showing all 28 steps of the trace crypto/ec/ec_ameth.c:435:15: Call 433. EC_KEY *ec; 434. 435. if ((ec = d2i_ECPrivateKey(NULL, pder, derlen)) == NULL) { ^ 436. ECerr(EC_F_OLD_EC_PRIV_DECODE, EC_R_DECODE_ERROR); 437. return 0; crypto/ec/ec_asn1.c:918:1: Parameter `(*a)->group->field->top` 916. /* some EC_KEY functions */ 917. 918. > EC_KEY *d2i_ECPrivateKey(EC_KEY **a, const unsigned char **in, long len) 919. { 920. EC_KEY *ret = NULL; crypto/ec/ec_asn1.c:972:14: Call 970. pub_oct = ASN1_STRING_get0_data(priv_key->publicKey); 971. pub_oct_len = ASN1_STRING_length(priv_key->publicKey); 972. if (!EC_KEY_oct2key(ret, pub_oct, pub_oct_len, NULL)) { ^ 973. ECerr(EC_F_D2I_ECPRIVATEKEY, ERR_R_EC_LIB); 974. goto err; crypto/ec/ec_key.c:526:1: Parameter `key->group->field->top` 524. } 525. 526. > int EC_KEY_oct2key(EC_KEY *key, const unsigned char *buf, size_t len, 527. BN_CTX *ctx) 528. { crypto/ec/ec_key.c:535:9: Call 533. if (key->pub_key == NULL) 534. return 0; 535. if (EC_POINT_oct2point(key->group, key->pub_key, buf, len, ctx) == 0) ^ 536. return 0; 537. /* crypto/ec/ec_oct.c:118:1: Parameter `group->field->top` 116. } 117. 118. > int EC_POINT_oct2point(const EC_GROUP *group, EC_POINT *point, 119. const unsigned char *buf, size_t len, BN_CTX *ctx) 120. { crypto/ec/ec_oct.c:140:20: Call 138. } 139. #else 140. return ec_GF2m_simple_oct2point(group, point, buf, len, ctx); ^ 141. #endif 142. } crypto/ec/ec2_oct.c:249:1: Parameter `group->field->top` 247. * simple implementation only uses affine coordinates. 248. */ 249. > int ec_GF2m_simple_oct2point(const EC_GROUP *group, EC_POINT *point, 250. const unsigned char *buf, size_t len, 251. BN_CTX *ctx) crypto/ec/ec2_oct.c:318:14: Call 316. 317. if (form == POINT_CONVERSION_COMPRESSED) { 318. if (!EC_POINT_set_compressed_coordinates_GF2m ^ 319. (group, point, x, y_bit, ctx)) 320. goto err; crypto/ec/ec_oct.c:59:1: Parameter `group->field->top` 57. 58. #ifndef OPENSSL_NO_EC2M 59. > int EC_POINT_set_compressed_coordinates_GF2m(const EC_GROUP *group, 60. EC_POINT *point, const BIGNUM *x, 61. int y_bit, BN_CTX *ctx) crypto/ec/ec_oct.c:76:20: Call 74. if (group->meth->flags & EC_FLAGS_DEFAULT_OCT) { 75. if (group->meth->field_type == NID_X9_62_prime_field) 76. return ec_GFp_simple_set_compressed_coordinates(group, point, x, ^ 77. y_bit, ctx); 78. else crypto/ec/ecp_oct.c:21:1: Parameter `group->field->top` 19. #include "ec_lcl.h" 20. 21. > int ec_GFp_simple_set_compressed_coordinates(const EC_GROUP *group, 22. EC_POINT *point, 23. const BIGNUM *x_, int y_bit, crypto/ec/ecp_oct.c:56:10: Call 54. 55. /* tmp1 := x^3 */ 56. if (!BN_nnmod(x, x_, group->field, ctx)) ^ 57. goto err; 58. if (group->meth->field_decode == 0) { crypto/bn/bn_mod.c:13:1: Parameter `d->top` 11. #include "bn_lcl.h" 12. 13. > int BN_nnmod(BIGNUM *r, const BIGNUM *m, const BIGNUM *d, BN_CTX *ctx) 14. { 15. /* crypto/bn/bn_mod.c:20:11: Call 18. */ 19. 20. if (!(BN_mod(r, m, d, ctx))) ^ 21. return 0; 22. if (!r->neg) crypto/bn/bn_div.c:205:31: Call 203. 204. /* First we normalise the numbers */ 205. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 206. if (!(BN_lshift(sdiv, divisor, norm_shift))) 207. goto err; crypto/bn/bn_lib.c:167:9: Assignment 165. 166. if (BN_is_zero(a)) 167. return 0; ^ 168. return ((i * BN_BITS2) + BN_num_bits_word(a->d[i])); 169. } crypto/bn/bn_div.c:205:5: Assignment 203. 204. /* First we normalise the numbers */ 205. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); ^ 206. if (!(BN_lshift(sdiv, divisor, norm_shift))) 207. goto err; crypto/bn/bn_div.c:206:11: Call 204. /* First we normalise the numbers */ 205. norm_shift = BN_BITS2 - ((BN_num_bits(divisor)) % BN_BITS2); 206. if (!(BN_lshift(sdiv, divisor, norm_shift))) ^ 207. goto err; 208. sdiv->neg = 0; crypto/bn/bn_shift.c:81:1: <Offset trace> 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:81:1: Parameter `n` 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:96:5: Assignment 94. 95. r->neg = a->neg; 96. nw = n / BN_BITS2; ^ 97. if (bn_wexpand(r, a->top + nw + 1) == NULL) 98. return (0); crypto/bn/bn_shift.c:81:1: <Length trace> 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:81:1: Parameter `*r->d` 79. } 80. 81. > int BN_lshift(BIGNUM *r, const BIGNUM *a, int n) 82. { 83. int i, nw, lb, rb; crypto/bn/bn_shift.c:97:9: Call 95. r->neg = a->neg; 96. nw = n / BN_BITS2; 97. if (bn_wexpand(r, a->top + nw + 1) == NULL) ^ 98. return (0); 99. lb = n % BN_BITS2; crypto/bn/bn_lib.c:1016:1: Parameter `*a->d` 1014. } 1015. 1016. > BIGNUM *bn_wexpand(BIGNUM *a, int words) 1017. { 1018. return (words <= a->dmax) ? a : bn_expand2(a, words); crypto/bn/bn_shift.c:102:5: Assignment 100. rb = BN_BITS2 - lb; 101. f = a->d; 102. t = r->d; ^ 103. t[a->top + nw] = 0; 104. if (lb == 0) crypto/bn/bn_shift.c:110:13: Array access: Offset: [1, +oo] Size: [0, 8388607] by call to `d2i_ECPrivateKey` 108. for (i = a->top - 1; i >= 0; i--) { 109. l = f[i]; 110. t[nw + i + 1] |= (l >> rb) & BN_MASK2; ^ 111. t[nw + i] = (l << lb) & BN_MASK2; 112. }
https://github.com/openssl/openssl/blob/2238119751bb95efc1dfafabf0e70e86f71fc6f6/crypto/bn/bn_shift.c/#L110
d2a_code_trace_data_43652
static unsigned int BN_STACK_pop(BN_STACK *st) { return st->indexes[--(st->depth)]; } crypto/bn/bn_gcd.c:636: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `BN_div`. Showing all 13 steps of the trace crypto/bn/bn_gcd.c:557:1: Parameter `ctx->stack.depth` 555. * not contain branches that may leak sensitive information. 556. */ 557. > static BIGNUM *BN_mod_inverse_no_branch(BIGNUM *in, 558. const BIGNUM *a, const BIGNUM *n, 559. BN_CTX *ctx) crypto/bn/bn_gcd.c:568:5: Call 566. bn_check_top(n); 567. 568. BN_CTX_start(ctx); ^ 569. A = BN_CTX_get(ctx); 570. B = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_gcd.c:636:18: Call 634. 635. /* (D, M) := (A/B, A%B) ... */ 636. if (!BN_div(D, M, &local_A, B, ctx)) ^ 637. goto err; 638. /* Ensure local_A goes out of scope before any further use of A */ crypto/bn/bn_div.c:189:1: Parameter `ctx->stack.depth` 187. * If 'dv' or 'rm' is NULL, the respective value is not returned. 188. */ 189. > int BN_div(BIGNUM *dv, BIGNUM *rm, const BIGNUM *num, const BIGNUM *divisor, 190. BN_CTX *ctx) 191. { crypto/bn/bn_div.c:242:5: Call 240. } 241. 242. BN_CTX_start(ctx); ^ 243. tmp = BN_CTX_get(ctx); 244. snum = BN_CTX_get(ctx); crypto/bn/bn_ctx.c:236:1: Parameter `ctx->stack.depth` 234. } 235. 236. > void BN_CTX_start(BN_CTX *ctx) 237. { 238. CTXDBG_ENTRY("BN_CTX_start", ctx); crypto/bn/bn_div.c:469:5: Call 467. if (no_branch) 468. bn_correct_top(res); 469. BN_CTX_end(ctx); ^ 470. return (1); 471. err: crypto/bn/bn_ctx.c:250:1: Parameter `ctx->stack.depth` 248. } 249. 250. > void BN_CTX_end(BN_CTX *ctx) 251. { 252. CTXDBG_ENTRY("BN_CTX_end", ctx); crypto/bn/bn_ctx.c:256:27: Call 254. ctx->err_stack--; 255. else { 256. unsigned int fp = BN_STACK_pop(&ctx->stack); ^ 257. /* Does this stack frame have anything to release? */ 258. if (fp < ctx->used) crypto/bn/bn_ctx.c:326:1: <LHS trace> 324. } 325. 326. > static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:326:1: Parameter `st->depth` 324. } 325. 326. > static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; crypto/bn/bn_ctx.c:328:12: Binary operation: ([0, +oo] - 1):unsigned32 by call to `BN_div` 326. static unsigned int BN_STACK_pop(BN_STACK *st) 327. { 328. return st->indexes[--(st->depth)]; ^ 329. } 330.
https://github.com/openssl/openssl/blob/e113c9c59dcb419dd00525cec431edb854a6c897/crypto/bn/bn_ctx.c/#L328
d2a_code_trace_data_43653
static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, OPENSSL_LH_DOALL_FUNC func, OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) { int i; OPENSSL_LH_NODE *a, *n; if (lh == NULL) return; for (i = lh->num_nodes - 1; i >= 0; i--) { a = lh->b[i]; while (a != NULL) { n = a->next; if (use_arg) func_arg(a->data, arg); else func(a->data); a = n; } } } test/sslapitest.c:98: error: INTEGER_OVERFLOW_L2 ([0, +oo] - 1):unsigned32 by call to `SSL_free`. Showing all 17 steps of the trace test/sslapitest.c:84:10: Call 82. } 83. 84. if (!create_ssl_objects(sctx, cctx, &serverssl, &clientssl, NULL, NULL)) { ^ 85. printf("Unable to create SSL objects\n"); 86. goto end; test/ssltestlib.c:575:21: Call 573. 574. if (*sssl == NULL) 575. serverssl = SSL_new(serverctx); ^ 576. else 577. serverssl = *sssl; ssl/ssl_lib.c:520:1: Parameter `ctx->sessions->num_nodes` 518. } 519. 520. > SSL *SSL_new(SSL_CTX *ctx) 521. { 522. SSL *s; test/sslapitest.c:98:5: Call 96. end: 97. X509_free(chaincert); 98. SSL_free(serverssl); ^ 99. SSL_free(clientssl); 100. SSL_CTX_free(sctx); ssl/ssl_lib.c:962:1: Parameter `s->ctx->sessions->num_nodes` 960. } 961. 962. > void SSL_free(SSL *s) 963. { 964. int i; ssl/ssl_lib.c:1027:5: Call 1025. RECORD_LAYER_release(&s->rlayer); 1026. 1027. SSL_CTX_free(s->ctx); ^ 1028. 1029. ASYNC_WAIT_CTX_free(s->waitctx); ssl/ssl_lib.c:2496:1: Parameter `a->sessions->num_nodes` 2494. } 2495. 2496. > void SSL_CTX_free(SSL_CTX *a) 2497. { 2498. int i; ssl/ssl_lib.c:2522:9: Call 2520. */ 2521. if (a->sessions != NULL) 2522. SSL_CTX_flush_sessions(a, 0); ^ 2523. 2524. CRYPTO_free_ex_data(CRYPTO_EX_INDEX_SSL_CTX, a, &a->ex_data); ssl/ssl_sess.c:990:1: Parameter `s->sessions->num_nodes` 988. IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 989. 990. > void SSL_CTX_flush_sessions(SSL_CTX *s, long t) 991. { 992. unsigned long i; ssl/ssl_sess.c:1003:5: Call 1001. i = lh_SSL_SESSION_get_down_load(s->sessions); 1002. lh_SSL_SESSION_set_down_load(s->sessions, 0); 1003. lh_SSL_SESSION_doall_TIMEOUT_PARAM(tp.cache, timeout_cb, &tp); ^ 1004. lh_SSL_SESSION_set_down_load(s->sessions, i); 1005. CRYPTO_THREAD_unlock(s->lock); ssl/ssl_sess.c:988:1: Parameter `lh->num_nodes` 986. } 987. 988. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 989. 990. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) ssl/ssl_sess.c:988:1: Call 986. } 987. 988. > IMPLEMENT_LHASH_DOALL_ARG(SSL_SESSION, TIMEOUT_PARAM); 989. 990. void SSL_CTX_flush_sessions(SSL_CTX *s, long t) crypto/lhash/lhash.c:182:1: Parameter `lh->num_nodes` 180. } 181. 182. > void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); crypto/lhash/lhash.c:184:5: Call 182. void OPENSSL_LH_doall_arg(OPENSSL_LHASH *lh, OPENSSL_LH_DOALL_FUNCARG func, void *arg) 183. { 184. doall_util_fn(lh, 1, (OPENSSL_LH_DOALL_FUNC)0, func, arg); ^ 185. } 186. crypto/lhash/lhash.c:150:1: <LHS trace> 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:150:1: Parameter `lh->num_nodes` 148. } 149. 150. > static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg, 151. OPENSSL_LH_DOALL_FUNC func, 152. OPENSSL_LH_DOALL_FUNCARG func_arg, void *arg) crypto/lhash/lhash.c:164:10: Binary operation: ([0, +oo] - 1):unsigned32 by call to `SSL_free` 162. * memory leaks otherwise 163. */ 164. for (i = lh->num_nodes - 1; i >= 0; i--) { ^ 165. a = lh->b[i]; 166. while (a != NULL) {
https://github.com/openssl/openssl/blob/a6972f346248fbc37e42056bb943fae0896a2967/crypto/lhash/lhash.c/#L164